diff --git "a/src/backend/gradio_image_annotation/templates/example/index.js" "b/src/backend/gradio_image_annotation/templates/example/index.js" --- "a/src/backend/gradio_image_annotation/templates/example/index.js" +++ "b/src/backend/gradio_image_annotation/templates/example/index.js" @@ -1,27 +1,27 @@ -const { setContext: $l, getContext: Bn } = window.__gradio__svelte__internal, Xn = "WORKER_PROXY_CONTEXT_KEY"; -function Yn() { - return Bn(Xn); +const { setContext: bo, getContext: Tn } = window.__gradio__svelte__internal, qn = "WORKER_PROXY_CONTEXT_KEY"; +function On() { + return Tn(qn); } -function Hn(n) { +function In(n) { return n.host === window.location.host || n.host === "localhost:7860" || n.host === "127.0.0.1:7860" || // Ref: https://github.com/gradio-app/gradio/blob/v3.32.0/js/app/src/Index.svelte#L194 n.host === "lite.local"; } -function Dn(n, e) { +function jn(n, e) { const t = e.toLowerCase(); for (const [i, s] of Object.entries(n)) if (i.toLowerCase() === t) return s; } -function Rn(n) { +function Un(n) { if (n == null) return !1; const e = new URL(n, window.location.href); - return !(!Hn(e) || e.protocol !== "http:" && e.protocol !== "https:"); + return !(!In(e) || e.protocol !== "http:" && e.protocol !== "https:"); } -async function Ln(n) { - if (n == null || !Rn(n)) +async function Wn(n) { + if (n == null || !Un(n)) return n; - const e = Yn(); + const e = On(); if (e == null) return n; const i = new URL(n, window.location.href).pathname; @@ -33,101 +33,135 @@ async function Ln(n) { }).then((s) => { if (s.status !== 200) throw new Error(`Failed to get file ${i} from the Wasm worker.`); - const l = new Blob([s.body], { - type: Dn(s.headers, "content-type") + const o = new Blob([s.body], { + type: jn(s.headers, "content-type") }); - return URL.createObjectURL(l); + return URL.createObjectURL(o); }); } const { - SvelteComponent: Tn, - append: J, - attr: k, - detach: qn, - init: On, - insert: In, - noop: st, - safe_not_equal: Un, - set_style: Z, - svg_element: K + SvelteComponent: Vn, + append: $, + attr: x, + detach: Nn, + init: Fn, + insert: Pn, + noop: at, + safe_not_equal: Kn, + set_style: ee, + svg_element: Q } = window.__gradio__svelte__internal; -function Wn(n) { - let e, t, i, s, l, r, a, o, u; +function Gn(n) { + let e, t, i, s, o, r, a, l, u; return { c() { - e = K("svg"), t = K("rect"), i = K("rect"), s = K("rect"), l = K("rect"), r = K("line"), a = K("line"), o = K("line"), u = K("line"), k(t, "x", "2"), k(t, "y", "2"), k(t, "width", "5"), k(t, "height", "5"), k(t, "rx", "1"), k(t, "ry", "1"), k(t, "stroke-width", "2"), k(t, "fill", "none"), k(i, "x", "17"), k(i, "y", "2"), k(i, "width", "5"), k(i, "height", "5"), k(i, "rx", "1"), k(i, "ry", "1"), k(i, "stroke-width", "2"), k(i, "fill", "none"), k(s, "x", "2"), k(s, "y", "17"), k(s, "width", "5"), k(s, "height", "5"), k(s, "rx", "1"), k(s, "ry", "1"), k(s, "stroke-width", "2"), k(s, "fill", "none"), k(l, "x", "17"), k(l, "y", "17"), k(l, "width", "5"), k(l, "height", "5"), k(l, "rx", "1"), k(l, "ry", "1"), k(l, "stroke-width", "2"), k(l, "fill", "none"), k(r, "x1", "7.5"), k(r, "y1", "4.5"), k(r, "x2", "16"), k(r, "y2", "4.5"), Z(r, "stroke-width", "2px"), k(a, "x1", "7.5"), k(a, "y1", "19.5"), k(a, "x2", "16"), k(a, "y2", "19.5"), Z(a, "stroke-width", "2px"), k(o, "x1", "4.5"), k(o, "y1", "8"), k(o, "x2", "4.5"), k(o, "y2", "16"), Z(o, "stroke-width", "2px"), k(u, "x1", "19.5"), k(u, "y1", "8"), k(u, "x2", "19.5"), k(u, "y2", "16"), Z(u, "stroke-width", "2px"), k(e, "width", "100%"), k(e, "height", "100%"), k(e, "viewBox", "0 0 24 24"), k(e, "version", "1.1"), k(e, "xmlns", "http://www.w3.org/2000/svg"), k(e, "xmlns:xlink", "http://www.w3.org/1999/xlink"), k(e, "xml:space", "preserve"), k(e, "stroke", "currentColor"), Z(e, "fill-rule", "evenodd"), Z(e, "clip-rule", "evenodd"), Z(e, "stroke-linecap", "round"), Z(e, "stroke-linejoin", "round"); + e = Q("svg"), t = Q("rect"), i = Q("rect"), s = Q("rect"), o = Q("rect"), r = Q("line"), a = Q("line"), l = Q("line"), u = Q("line"), x(t, "x", "2"), x(t, "y", "2"), x(t, "width", "5"), x(t, "height", "5"), x(t, "rx", "1"), x(t, "ry", "1"), x(t, "stroke-width", "2"), x(t, "fill", "none"), x(i, "x", "17"), x(i, "y", "2"), x(i, "width", "5"), x(i, "height", "5"), x(i, "rx", "1"), x(i, "ry", "1"), x(i, "stroke-width", "2"), x(i, "fill", "none"), x(s, "x", "2"), x(s, "y", "17"), x(s, "width", "5"), x(s, "height", "5"), x(s, "rx", "1"), x(s, "ry", "1"), x(s, "stroke-width", "2"), x(s, "fill", "none"), x(o, "x", "17"), x(o, "y", "17"), x(o, "width", "5"), x(o, "height", "5"), x(o, "rx", "1"), x(o, "ry", "1"), x(o, "stroke-width", "2"), x(o, "fill", "none"), x(r, "x1", "7.5"), x(r, "y1", "4.5"), x(r, "x2", "16"), x(r, "y2", "4.5"), ee(r, "stroke-width", "2px"), x(a, "x1", "7.5"), x(a, "y1", "19.5"), x(a, "x2", "16"), x(a, "y2", "19.5"), ee(a, "stroke-width", "2px"), x(l, "x1", "4.5"), x(l, "y1", "8"), x(l, "x2", "4.5"), x(l, "y2", "16"), ee(l, "stroke-width", "2px"), x(u, "x1", "19.5"), x(u, "y1", "8"), x(u, "x2", "19.5"), x(u, "y2", "16"), ee(u, "stroke-width", "2px"), x(e, "width", "100%"), x(e, "height", "100%"), x(e, "viewBox", "0 0 24 24"), x(e, "version", "1.1"), x(e, "xmlns", "http://www.w3.org/2000/svg"), x(e, "xmlns:xlink", "http://www.w3.org/1999/xlink"), x(e, "xml:space", "preserve"), x(e, "stroke", "currentColor"), ee(e, "fill-rule", "evenodd"), ee(e, "clip-rule", "evenodd"), ee(e, "stroke-linecap", "round"), ee(e, "stroke-linejoin", "round"); }, - m(f, c) { - In(f, e, c), J(e, t), J(e, i), J(e, s), J(e, l), J(e, r), J(e, a), J(e, o), J(e, u); + m(c, f) { + Pn(c, e, f), $(e, t), $(e, i), $(e, s), $(e, o), $(e, r), $(e, a), $(e, l), $(e, u); }, - p: st, - i: st, - o: st, - d(f) { - f && qn(e); + p: at, + i: at, + o: at, + d(c) { + c && Nn(e); } }; } -class jn extends Tn { +class Jn extends Vn { constructor(e) { - super(), On(this, e, null, Wn, Un, {}); + super(), Fn(this, e, null, Gn, Kn, {}); } } const { - SvelteComponent: Nn, - append: Vn, - attr: N, - detach: Fn, - init: Pn, - insert: Kn, - noop: lt, - safe_not_equal: Gn, - set_style: Re, - svg_element: Mt + SvelteComponent: Zn, + append: Qn, + attr: F, + detach: $n, + init: ei, + insert: ti, + noop: rt, + safe_not_equal: ni, + set_style: je, + svg_element: Xt } = window.__gradio__svelte__internal; -function Jn(n) { +function ii(n) { let e, t; return { c() { - e = Mt("svg"), t = Mt("path"), N(t, "d", "M 14.4 2.85 V 11.1 V 3.95 C 14.4 3.0387 15.1388 2.3 16.05 2.3 C 16.9612 2.3 17.7 3.0387 17.7 3.95 V 11.1 V 7.25 C 17.7 6.3387 18.4388 5.6 19.35 5.6 C 20.2612 5.6 21 6.3387 21 7.25 V 16.6 C 21 20.2451 18.0451 23.2 14.4 23.2 H 13.16 C 11.4831 23.2 9.8692 22.5618 8.6459 21.4149 L 3.1915 16.3014 C 2.403 15.5622 2.3829 14.3171 3.1472 13.5528 C 3.8943 12.8057 5.1057 12.8057 5.8528 13.5528 L 7.8 15.5 V 6.15 C 7.8 5.2387 8.5387 4.5 9.45 4.5 C 10.3612 4.5 11.1 5.2387 11.1 6.15 V 11.1 V 2.85 C 11.1 1.9387 11.8388 1.2 12.75 1.2 C 13.6612 1.2 14.4 1.9387 14.4 2.85 Z"), N(t, "fill", "none"), N(t, "stroke-width", "2"), N(e, "width", "100%"), N(e, "height", "100%"), N(e, "viewBox", "0 0 24 24"), N(e, "version", "1.1"), N(e, "xmlns", "http://www.w3.org/2000/svg"), N(e, "xmlns:xlink", "http://www.w3.org/1999/xlink"), N(e, "xml:space", "preserve"), N(e, "stroke", "currentColor"), Re(e, "fill-rule", "evenodd"), Re(e, "clip-rule", "evenodd"), Re(e, "stroke-linecap", "round"), Re(e, "stroke-linejoin", "round"); + e = Xt("svg"), t = Xt("path"), F(t, "d", "M 14.4 2.85 V 11.1 V 3.95 C 14.4 3.0387 15.1388 2.3 16.05 2.3 C 16.9612 2.3 17.7 3.0387 17.7 3.95 V 11.1 V 7.25 C 17.7 6.3387 18.4388 5.6 19.35 5.6 C 20.2612 5.6 21 6.3387 21 7.25 V 16.6 C 21 20.2451 18.0451 23.2 14.4 23.2 H 13.16 C 11.4831 23.2 9.8692 22.5618 8.6459 21.4149 L 3.1915 16.3014 C 2.403 15.5622 2.3829 14.3171 3.1472 13.5528 C 3.8943 12.8057 5.1057 12.8057 5.8528 13.5528 L 7.8 15.5 V 6.15 C 7.8 5.2387 8.5387 4.5 9.45 4.5 C 10.3612 4.5 11.1 5.2387 11.1 6.15 V 11.1 V 2.85 C 11.1 1.9387 11.8388 1.2 12.75 1.2 C 13.6612 1.2 14.4 1.9387 14.4 2.85 Z"), F(t, "fill", "none"), F(t, "stroke-width", "2"), F(e, "width", "100%"), F(e, "height", "100%"), F(e, "viewBox", "0 0 24 24"), F(e, "version", "1.1"), F(e, "xmlns", "http://www.w3.org/2000/svg"), F(e, "xmlns:xlink", "http://www.w3.org/1999/xlink"), F(e, "xml:space", "preserve"), F(e, "stroke", "currentColor"), je(e, "fill-rule", "evenodd"), je(e, "clip-rule", "evenodd"), je(e, "stroke-linecap", "round"), je(e, "stroke-linejoin", "round"); }, m(i, s) { - Kn(i, e, s), Vn(e, t); + ti(i, e, s), Qn(e, t); }, - p: lt, - i: lt, - o: lt, + p: rt, + i: rt, + o: rt, d(i) { - i && Fn(e); + i && $n(e); } }; } -class Zn extends Nn { +class si extends Zn { constructor(e) { - super(), Pn(this, e, null, Jn, Gn, {}); + super(), ei(this, e, null, ii, ni, {}); } } const { - SvelteComponent: Qn, - attr: $n, - create_slot: ei, - detach: ti, - element: ni, - get_all_dirty_from_scope: ii, - get_slot_changes: si, - init: li, - insert: oi, - safe_not_equal: ai, - transition_in: ri, - transition_out: fi, - update_slot_base: ci + SvelteComponent: li, + append: oi, + attr: P, + detach: ai, + init: ri, + insert: fi, + noop: ft, + safe_not_equal: ci, + set_style: Ue, + svg_element: Yt } = window.__gradio__svelte__internal; function ui(n) { + let e, t; + return { + c() { + e = Yt("svg"), t = Yt("path"), P(t, "d", "M10 12L14 16M14 12L10 16M4 6H20M16 6L15.7294 5.18807C15.4671 4.40125 15.3359 4.00784 15.0927 3.71698C14.8779 3.46013 14.6021 3.26132 14.2905 3.13878C13.9376 3 13.523 3 12.6936 3H11.3064C10.477 3 10.0624 3 9.70951 3.13878C9.39792 3.26132 9.12208 3.46013 8.90729 3.71698C8.66405 4.00784 8.53292 4.40125 8.27064 5.18807L8 6M18 6V16.2C18 17.8802 18 18.7202 17.673 19.362C17.3854 19.9265 16.9265 20.3854 16.362 20.673C15.7202 21 14.8802 21 13.2 21H10.8C9.11984 21 8.27976 21 7.63803 20.673C7.07354 20.3854 6.6146 19.9265 6.32698 19.362C6 18.7202 6 17.8802 6 16.2V6"), P(t, "fill", "none"), P(t, "stroke-width", "2"), P(e, "width", "100%"), P(e, "height", "100%"), P(e, "viewBox", "0 0 24 24"), P(e, "version", "1.1"), P(e, "xmlns", "http://www.w3.org/2000/svg"), P(e, "xmlns:xlink", "http://www.w3.org/1999/xlink"), P(e, "xml:space", "preserve"), P(e, "stroke", "currentColor"), Ue(e, "fill-rule", "evenodd"), Ue(e, "clip-rule", "evenodd"), Ue(e, "stroke-linecap", "round"), Ue(e, "stroke-linejoin", "round"); + }, + m(i, s) { + fi(i, e, s), oi(e, t); + }, + p: ft, + i: ft, + o: ft, + d(i) { + i && ai(e); + } + }; +} +class hi extends li { + constructor(e) { + super(), ri(this, e, null, ui, ci, {}); + } +} +const { + SvelteComponent: mi, + attr: _i, + create_slot: di, + detach: bi, + element: gi, + get_all_dirty_from_scope: wi, + get_slot_changes: yi, + init: vi, + insert: ki, + safe_not_equal: pi, + transition_in: xi, + transition_out: Ci, + update_slot_base: Si +} = window.__gradio__svelte__internal; +function zi(n) { let e, t; const i = ( /*#slots*/ n[1].default - ), s = ei( + ), s = di( i, n, /*$$scope*/ @@ -136,141 +170,141 @@ function ui(n) { ); return { c() { - e = ni("div"), s && s.c(), $n(e, "class", "svelte-1hnfib2"); + e = gi("div"), s && s.c(), _i(e, "class", "svelte-1hnfib2"); }, - m(l, r) { - oi(l, e, r), s && s.m(e, null), t = !0; + m(o, r) { + ki(o, e, r), s && s.m(e, null), t = !0; }, - p(l, [r]) { + p(o, [r]) { s && s.p && (!t || r & /*$$scope*/ - 1) && ci( + 1) && Si( s, i, - l, + o, /*$$scope*/ - l[0], - t ? si( + o[0], + t ? yi( i, /*$$scope*/ - l[0], + o[0], r, null - ) : ii( + ) : wi( /*$$scope*/ - l[0] + o[0] ), null ); }, - i(l) { - t || (ri(s, l), t = !0); + i(o) { + t || (xi(s, o), t = !0); }, - o(l) { - fi(s, l), t = !1; + o(o) { + Ci(s, o), t = !1; }, - d(l) { - l && ti(e), s && s.d(l); + d(o) { + o && bi(e), s && s.d(o); } }; } -function hi(n, e, t) { +function Ei(n, e, t) { let { $$slots: i = {}, $$scope: s } = e; - return n.$$set = (l) => { - "$$scope" in l && t(0, s = l.$$scope); + return n.$$set = (o) => { + "$$scope" in o && t(0, s = o.$$scope); }, [s, i]; } -class mi extends Qn { +class Bi extends mi { constructor(e) { - super(), li(this, e, hi, ui, ai, {}); + super(), vi(this, e, Ei, zi, pi, {}); } } const { - SvelteComponent: _i, - attr: Bt, - check_outros: di, - create_component: bi, - create_slot: gi, - destroy_component: wi, - detach: Ie, - element: yi, - empty: vi, - get_all_dirty_from_scope: ki, - get_slot_changes: pi, - group_outros: xi, - init: Ci, - insert: Ue, - mount_component: Si, - safe_not_equal: zi, - set_data: Ei, - space: Ai, - text: Mi, - toggle_class: oe, - transition_in: we, - transition_out: We, - update_slot_base: Bi + SvelteComponent: Ai, + attr: Dt, + check_outros: Mi, + create_component: Ri, + create_slot: Hi, + destroy_component: Xi, + detach: Pe, + element: Yi, + empty: Di, + get_all_dirty_from_scope: Li, + get_slot_changes: Ti, + group_outros: qi, + init: Oi, + insert: Ke, + mount_component: Ii, + safe_not_equal: ji, + set_data: Ui, + space: Wi, + text: Vi, + toggle_class: ue, + transition_in: ke, + transition_out: Ge, + update_slot_base: Ni } = window.__gradio__svelte__internal; -function Xt(n) { +function Lt(n) { let e, t; - return e = new mi({ + return e = new Bi({ props: { - $$slots: { default: [Xi] }, + $$slots: { default: [Fi] }, $$scope: { ctx: n } } }), { c() { - bi(e.$$.fragment); + Ri(e.$$.fragment); }, m(i, s) { - Si(e, i, s), t = !0; + Ii(e, i, s), t = !0; }, p(i, s) { - const l = {}; + const o = {}; s & /*$$scope, info*/ - 10 && (l.$$scope = { dirty: s, ctx: i }), e.$set(l); + 10 && (o.$$scope = { dirty: s, ctx: i }), e.$set(o); }, i(i) { - t || (we(e.$$.fragment, i), t = !0); + t || (ke(e.$$.fragment, i), t = !0); }, o(i) { - We(e.$$.fragment, i), t = !1; + Ge(e.$$.fragment, i), t = !1; }, d(i) { - wi(e, i); + Xi(e, i); } }; } -function Xi(n) { +function Fi(n) { let e; return { c() { - e = Mi( + e = Vi( /*info*/ n[1] ); }, m(t, i) { - Ue(t, e, i); + Ke(t, e, i); }, p(t, i) { i & /*info*/ - 2 && Ei( + 2 && Ui( e, /*info*/ t[1] ); }, d(t) { - t && Ie(e); + t && Pe(e); } }; } -function Yi(n) { +function Pi(n) { let e, t, i, s; - const l = ( + const o = ( /*#slots*/ n[2].default - ), r = gi( - l, + ), r = Hi( + o, n, /*$$scope*/ n[3], @@ -278,113 +312,113 @@ function Yi(n) { ); let a = ( /*info*/ - n[1] && Xt(n) + n[1] && Lt(n) ); return { c() { - e = yi("span"), r && r.c(), t = Ai(), a && a.c(), i = vi(), Bt(e, "data-testid", "block-info"), Bt(e, "class", "svelte-22c38v"), oe(e, "sr-only", !/*show_label*/ - n[0]), oe(e, "hide", !/*show_label*/ - n[0]), oe( + e = Yi("span"), r && r.c(), t = Wi(), a && a.c(), i = Di(), Dt(e, "data-testid", "block-info"), Dt(e, "class", "svelte-22c38v"), ue(e, "sr-only", !/*show_label*/ + n[0]), ue(e, "hide", !/*show_label*/ + n[0]), ue( e, "has-info", /*info*/ n[1] != null ); }, - m(o, u) { - Ue(o, e, u), r && r.m(e, null), Ue(o, t, u), a && a.m(o, u), Ue(o, i, u), s = !0; + m(l, u) { + Ke(l, e, u), r && r.m(e, null), Ke(l, t, u), a && a.m(l, u), Ke(l, i, u), s = !0; }, - p(o, [u]) { + p(l, [u]) { r && r.p && (!s || u & /*$$scope*/ - 8) && Bi( + 8) && Ni( r, - l, o, + l, /*$$scope*/ - o[3], - s ? pi( - l, + l[3], + s ? Ti( + o, /*$$scope*/ - o[3], + l[3], u, null - ) : ki( + ) : Li( /*$$scope*/ - o[3] + l[3] ), null ), (!s || u & /*show_label*/ - 1) && oe(e, "sr-only", !/*show_label*/ - o[0]), (!s || u & /*show_label*/ - 1) && oe(e, "hide", !/*show_label*/ - o[0]), (!s || u & /*info*/ - 2) && oe( + 1) && ue(e, "sr-only", !/*show_label*/ + l[0]), (!s || u & /*show_label*/ + 1) && ue(e, "hide", !/*show_label*/ + l[0]), (!s || u & /*info*/ + 2) && ue( e, "has-info", /*info*/ - o[1] != null + l[1] != null ), /*info*/ - o[1] ? a ? (a.p(o, u), u & /*info*/ - 2 && we(a, 1)) : (a = Xt(o), a.c(), we(a, 1), a.m(i.parentNode, i)) : a && (xi(), We(a, 1, 1, () => { + l[1] ? a ? (a.p(l, u), u & /*info*/ + 2 && ke(a, 1)) : (a = Lt(l), a.c(), ke(a, 1), a.m(i.parentNode, i)) : a && (qi(), Ge(a, 1, 1, () => { a = null; - }), di()); + }), Mi()); }, - i(o) { - s || (we(r, o), we(a), s = !0); + i(l) { + s || (ke(r, l), ke(a), s = !0); }, - o(o) { - We(r, o), We(a), s = !1; + o(l) { + Ge(r, l), Ge(a), s = !1; }, - d(o) { - o && (Ie(e), Ie(t), Ie(i)), r && r.d(o), a && a.d(o); + d(l) { + l && (Pe(e), Pe(t), Pe(i)), r && r.d(l), a && a.d(l); } }; } -function Hi(n, e, t) { - let { $$slots: i = {}, $$scope: s } = e, { show_label: l = !0 } = e, { info: r = void 0 } = e; +function Ki(n, e, t) { + let { $$slots: i = {}, $$scope: s } = e, { show_label: o = !0 } = e, { info: r = void 0 } = e; return n.$$set = (a) => { - "show_label" in a && t(0, l = a.show_label), "info" in a && t(1, r = a.info), "$$scope" in a && t(3, s = a.$$scope); - }, [l, r, i, s]; + "show_label" in a && t(0, o = a.show_label), "info" in a && t(1, r = a.info), "$$scope" in a && t(3, s = a.$$scope); + }, [o, r, i, s]; } -class ln extends _i { +class un extends Ai { constructor(e) { - super(), Ci(this, e, Hi, Yi, zi, { show_label: 0, info: 1 }); + super(), Oi(this, e, Ki, Pi, ji, { show_label: 0, info: 1 }); } } const { - SvelteComponent: Di, - append: Ri, - attr: ae, - detach: Li, - init: Ti, - insert: qi, - noop: ot, - safe_not_equal: Oi, - svg_element: Yt + SvelteComponent: Gi, + append: Ji, + attr: he, + detach: Zi, + init: Qi, + insert: $i, + noop: ct, + safe_not_equal: es, + svg_element: Tt } = window.__gradio__svelte__internal; -function Ii(n) { +function ts(n) { let e, t; return { c() { - e = Yt("svg"), t = Yt("path"), ae(t, "d", "M5 8l4 4 4-4z"), ae(e, "class", "dropdown-arrow svelte-145leq6"), ae(e, "xmlns", "http://www.w3.org/2000/svg"), ae(e, "width", "100%"), ae(e, "height", "100%"), ae(e, "viewBox", "0 0 18 18"); + e = Tt("svg"), t = Tt("path"), he(t, "d", "M5 8l4 4 4-4z"), he(e, "class", "dropdown-arrow svelte-145leq6"), he(e, "xmlns", "http://www.w3.org/2000/svg"), he(e, "width", "100%"), he(e, "height", "100%"), he(e, "viewBox", "0 0 18 18"); }, m(i, s) { - qi(i, e, s), Ri(e, t); + $i(i, e, s), Ji(e, t); }, - p: ot, - i: ot, - o: ot, + p: ct, + i: ct, + o: ct, d(i) { - i && Li(e); + i && Zi(e); } }; } -class Ui extends Di { +class ns extends Gi { constructor(e) { - super(), Ti(this, e, null, Ii, Oi, {}); + super(), Qi(this, e, null, ts, es, {}); } } -const Wi = [ +const is = [ { color: "red", primary: 600, secondary: 100 }, { color: "green", primary: 600, secondary: 100 }, { color: "blue", primary: 600, secondary: 100 }, @@ -395,7 +429,7 @@ const Wi = [ { color: "cyan", primary: 600, secondary: 100 }, { color: "lime", primary: 500, secondary: 100 }, { color: "pink", primary: 600, secondary: 100 } -], Ht = { +], qt = { inherit: "inherit", current: "currentColor", transparent: "transparent", @@ -688,66 +722,66 @@ const Wi = [ 950: "#4c0519" } }; -Wi.reduce( +is.reduce( (n, { color: e, primary: t, secondary: i }) => ({ ...n, [e]: { - primary: Ht[e][t], - secondary: Ht[e][i] + primary: qt[e][t], + secondary: qt[e][i] } }), {} ); const { - SvelteComponent: ji, - append: Dt, - attr: at, - bubble: Rt, - create_component: Ni, - destroy_component: Vi, - detach: on, - element: Lt, - init: Fi, - insert: an, - listen: rt, - mount_component: Pi, - run_all: Ki, - safe_not_equal: Gi, - set_data: Ji, - set_input_value: Tt, - space: Zi, - text: Qi, - transition_in: $i, - transition_out: es -} = window.__gradio__svelte__internal, { createEventDispatcher: ts, afterUpdate: ns } = window.__gradio__svelte__internal; -function is(n) { + SvelteComponent: ss, + append: Ot, + attr: ut, + bubble: It, + create_component: ls, + destroy_component: os, + detach: hn, + element: jt, + init: as, + insert: mn, + listen: ht, + mount_component: rs, + run_all: fs, + safe_not_equal: cs, + set_data: us, + set_input_value: Ut, + space: hs, + text: ms, + transition_in: _s, + transition_out: ds +} = window.__gradio__svelte__internal, { createEventDispatcher: bs, afterUpdate: gs } = window.__gradio__svelte__internal; +function ws(n) { let e; return { c() { - e = Qi( + e = ms( /*label*/ n[1] ); }, m(t, i) { - an(t, e, i); + mn(t, e, i); }, p(t, i) { i & /*label*/ - 2 && Ji( + 2 && us( e, /*label*/ t[1] ); }, d(t) { - t && on(e); + t && hn(e); } }; } -function ss(n) { - let e, t, i, s, l, r, a; - return t = new ln({ +function ys(n) { + let e, t, i, s, o, r, a; + return t = new un({ props: { show_label: ( /*show_label*/ @@ -757,33 +791,33 @@ function ss(n) { /*info*/ n[2] ), - $$slots: { default: [is] }, + $$slots: { default: [ws] }, $$scope: { ctx: n } } }), { c() { - e = Lt("label"), Ni(t.$$.fragment), i = Zi(), s = Lt("input"), at(s, "type", "color"), s.disabled = /*disabled*/ - n[3], at(s, "class", "svelte-16l8u73"), at(e, "class", "block"); + e = jt("label"), ls(t.$$.fragment), i = hs(), s = jt("input"), ut(s, "type", "color"), s.disabled = /*disabled*/ + n[3], ut(s, "class", "svelte-16l8u73"), ut(e, "class", "block"); }, - m(o, u) { - an(o, e, u), Pi(t, e, null), Dt(e, i), Dt(e, s), Tt( + m(l, u) { + mn(l, e, u), rs(t, e, null), Ot(e, i), Ot(e, s), Ut( s, /*value*/ n[0] - ), l = !0, r || (a = [ - rt( + ), o = !0, r || (a = [ + ht( s, "input", /*input_input_handler*/ n[8] ), - rt( + ht( s, "focus", /*focus_handler*/ n[6] ), - rt( + ht( s, "blur", /*blur_handler*/ @@ -791,71 +825,71 @@ function ss(n) { ) ], r = !0); }, - p(o, [u]) { - const f = {}; + p(l, [u]) { + const c = {}; u & /*show_label*/ - 16 && (f.show_label = /*show_label*/ - o[4]), u & /*info*/ - 4 && (f.info = /*info*/ - o[2]), u & /*$$scope, label*/ - 2050 && (f.$$scope = { dirty: u, ctx: o }), t.$set(f), (!l || u & /*disabled*/ + 16 && (c.show_label = /*show_label*/ + l[4]), u & /*info*/ + 4 && (c.info = /*info*/ + l[2]), u & /*$$scope, label*/ + 2050 && (c.$$scope = { dirty: u, ctx: l }), t.$set(c), (!o || u & /*disabled*/ 8) && (s.disabled = /*disabled*/ - o[3]), u & /*value*/ - 1 && Tt( + l[3]), u & /*value*/ + 1 && Ut( s, /*value*/ - o[0] + l[0] ); }, - i(o) { - l || ($i(t.$$.fragment, o), l = !0); + i(l) { + o || (_s(t.$$.fragment, l), o = !0); }, - o(o) { - es(t.$$.fragment, o), l = !1; + o(l) { + ds(t.$$.fragment, l), o = !1; }, - d(o) { - o && on(e), Vi(t), r = !1, Ki(a); + d(l) { + l && hn(e), os(t), r = !1, fs(a); } }; } -function ls(n, e, t) { - let { value: i = "#000000" } = e, { value_is_output: s = !1 } = e, { label: l } = e, { info: r = void 0 } = e, { disabled: a = !1 } = e, { show_label: o = !0 } = e; - const u = ts(); - function f() { +function vs(n, e, t) { + let { value: i = "#000000" } = e, { value_is_output: s = !1 } = e, { label: o } = e, { info: r = void 0 } = e, { disabled: a = !1 } = e, { show_label: l = !0 } = e; + const u = bs(); + function c() { u("change", i), s || u("input"); } - ns(() => { + gs(() => { t(5, s = !1); }); - function c(v) { - Rt.call(this, n, v); + function f(k) { + It.call(this, n, k); } - function w(v) { - Rt.call(this, n, v); + function d(k) { + It.call(this, n, k); } function g() { i = this.value, t(0, i); } - return n.$$set = (v) => { - "value" in v && t(0, i = v.value), "value_is_output" in v && t(5, s = v.value_is_output), "label" in v && t(1, l = v.label), "info" in v && t(2, r = v.info), "disabled" in v && t(3, a = v.disabled), "show_label" in v && t(4, o = v.show_label); + return n.$$set = (k) => { + "value" in k && t(0, i = k.value), "value_is_output" in k && t(5, s = k.value_is_output), "label" in k && t(1, o = k.label), "info" in k && t(2, r = k.info), "disabled" in k && t(3, a = k.disabled), "show_label" in k && t(4, l = k.show_label); }, n.$$.update = () => { n.$$.dirty & /*value*/ - 1 && f(); + 1 && c(); }, [ i, - l, + o, r, a, - o, + l, s, - c, - w, + f, + d, g ]; } -class os extends ji { +class ks extends ss { constructor(e) { - super(), Fi(this, e, ls, ss, Gi, { + super(), as(this, e, vs, ys, cs, { value: 0, value_is_output: 5, label: 1, @@ -865,7 +899,7 @@ class os extends ji { }); } } -function qt(n) { +function Wt(n) { const e = typeof n == "string" && n.match(/^\s*(-?[\d.]+)([^\s]*)\s*$/); return e ? [parseFloat(e[1]), e[2] || "px"] : [ /** @type {number} */ @@ -873,56 +907,56 @@ function qt(n) { "px" ]; } -function as(n) { +function ps(n) { const e = n - 1; return e * e * e + 1; } -function Ot(n, { delay: e = 0, duration: t = 400, easing: i = as, x: s = 0, y: l = 0, opacity: r = 0 } = {}) { - const a = getComputedStyle(n), o = +a.opacity, u = a.transform === "none" ? "" : a.transform, f = o * (1 - r), [c, w] = qt(s), [g, v] = qt(l); +function Vt(n, { delay: e = 0, duration: t = 400, easing: i = ps, x: s = 0, y: o = 0, opacity: r = 0 } = {}) { + const a = getComputedStyle(n), l = +a.opacity, u = a.transform === "none" ? "" : a.transform, c = l * (1 - r), [f, d] = Wt(s), [g, k] = Wt(o); return { delay: e, duration: t, easing: i, - css: (_, d) => ` - transform: ${u} translate(${(1 - _) * c}${w}, ${(1 - _) * g}${v}); - opacity: ${o - f * d}` + css: (y, m) => ` + transform: ${u} translate(${(1 - y) * f}${d}, ${(1 - y) * g}${k}); + opacity: ${l - c * m}` }; } const { - SvelteComponent: rs, - append: rn, - attr: X, - bubble: fs, - check_outros: cs, - create_slot: fn, - detach: Ae, - element: $e, - empty: us, - get_all_dirty_from_scope: cn, - get_slot_changes: un, - group_outros: hs, - init: ms, - insert: Me, - listen: _s, - safe_not_equal: ds, + SvelteComponent: xs, + append: _n, + attr: R, + bubble: Cs, + check_outros: Ss, + create_slot: dn, + detach: De, + element: it, + empty: zs, + get_all_dirty_from_scope: bn, + get_slot_changes: gn, + group_outros: Es, + init: Bs, + insert: Le, + listen: As, + safe_not_equal: Ms, set_style: T, - space: hn, - src_url_equal: Fe, - toggle_class: de, - transition_in: Pe, - transition_out: Ke, - update_slot_base: mn + space: wn, + src_url_equal: $e, + toggle_class: we, + transition_in: et, + transition_out: tt, + update_slot_base: yn } = window.__gradio__svelte__internal; -function bs(n) { - let e, t, i, s, l, r, a = ( +function Rs(n) { + let e, t, i, s, o, r, a = ( /*icon*/ - n[7] && It(n) + n[7] && Nt(n) ); - const o = ( + const l = ( /*#slots*/ n[12].default - ), u = fn( - o, + ), u = dn( + l, n, /*$$scope*/ n[11], @@ -930,16 +964,16 @@ function bs(n) { ); return { c() { - e = $e("button"), a && a.c(), t = hn(), u && u.c(), X(e, "class", i = /*size*/ + e = it("button"), a && a.c(), t = wn(), u && u.c(), R(e, "class", i = /*size*/ n[4] + " " + /*variant*/ n[3] + " " + /*elem_classes*/ - n[1].join(" ") + " svelte-8huxfn"), X( + n[1].join(" ") + " svelte-8huxfn"), R( e, "id", /*elem_id*/ n[0] ), e.disabled = /*disabled*/ - n[8], de(e, "hidden", !/*visible*/ + n[8], we(e, "hidden", !/*visible*/ n[2]), T( e, "flex-grow", @@ -954,85 +988,85 @@ function bs(n) { n[10] == "number" ? `calc(min(${/*min_width*/ n[10]}px, 100%))` : null); }, - m(f, c) { - Me(f, e, c), a && a.m(e, null), rn(e, t), u && u.m(e, null), s = !0, l || (r = _s( + m(c, f) { + Le(c, e, f), a && a.m(e, null), _n(e, t), u && u.m(e, null), s = !0, o || (r = As( e, "click", /*click_handler*/ n[13] - ), l = !0); + ), o = !0); }, - p(f, c) { + p(c, f) { /*icon*/ - f[7] ? a ? a.p(f, c) : (a = It(f), a.c(), a.m(e, t)) : a && (a.d(1), a = null), u && u.p && (!s || c & /*$$scope*/ - 2048) && mn( + c[7] ? a ? a.p(c, f) : (a = Nt(c), a.c(), a.m(e, t)) : a && (a.d(1), a = null), u && u.p && (!s || f & /*$$scope*/ + 2048) && yn( u, - o, - f, + l, + c, /*$$scope*/ - f[11], - s ? un( - o, + c[11], + s ? gn( + l, /*$$scope*/ - f[11], - c, + c[11], + f, null - ) : cn( + ) : bn( /*$$scope*/ - f[11] + c[11] ), null - ), (!s || c & /*size, variant, elem_classes*/ + ), (!s || f & /*size, variant, elem_classes*/ 26 && i !== (i = /*size*/ - f[4] + " " + /*variant*/ - f[3] + " " + /*elem_classes*/ - f[1].join(" ") + " svelte-8huxfn")) && X(e, "class", i), (!s || c & /*elem_id*/ - 1) && X( + c[4] + " " + /*variant*/ + c[3] + " " + /*elem_classes*/ + c[1].join(" ") + " svelte-8huxfn")) && R(e, "class", i), (!s || f & /*elem_id*/ + 1) && R( e, "id", /*elem_id*/ - f[0] - ), (!s || c & /*disabled*/ + c[0] + ), (!s || f & /*disabled*/ 256) && (e.disabled = /*disabled*/ - f[8]), (!s || c & /*size, variant, elem_classes, visible*/ - 30) && de(e, "hidden", !/*visible*/ - f[2]), c & /*scale*/ + c[8]), (!s || f & /*size, variant, elem_classes, visible*/ + 30) && we(e, "hidden", !/*visible*/ + c[2]), f & /*scale*/ 512 && T( e, "flex-grow", /*scale*/ - f[9] - ), c & /*scale*/ + c[9] + ), f & /*scale*/ 512 && T( e, "width", /*scale*/ - f[9] === 0 ? "fit-content" : null - ), c & /*min_width*/ + c[9] === 0 ? "fit-content" : null + ), f & /*min_width*/ 1024 && T(e, "min-width", typeof /*min_width*/ - f[10] == "number" ? `calc(min(${/*min_width*/ - f[10]}px, 100%))` : null); + c[10] == "number" ? `calc(min(${/*min_width*/ + c[10]}px, 100%))` : null); }, - i(f) { - s || (Pe(u, f), s = !0); + i(c) { + s || (et(u, c), s = !0); }, - o(f) { - Ke(u, f), s = !1; + o(c) { + tt(u, c), s = !1; }, - d(f) { - f && Ae(e), a && a.d(), u && u.d(f), l = !1, r(); + d(c) { + c && De(e), a && a.d(), u && u.d(c), o = !1, r(); } }; } -function gs(n) { - let e, t, i, s, l = ( +function Hs(n) { + let e, t, i, s, o = ( /*icon*/ - n[7] && Ut(n) + n[7] && Ft(n) ); const r = ( /*#slots*/ n[12].default - ), a = fn( + ), a = dn( r, n, /*$$scope*/ @@ -1041,26 +1075,26 @@ function gs(n) { ); return { c() { - e = $e("a"), l && l.c(), t = hn(), a && a.c(), X( + e = it("a"), o && o.c(), t = wn(), a && a.c(), R( e, "href", /*link*/ n[6] - ), X(e, "rel", "noopener noreferrer"), X( + ), R(e, "rel", "noopener noreferrer"), R( e, "aria-disabled", /*disabled*/ n[8] - ), X(e, "class", i = /*size*/ + ), R(e, "class", i = /*size*/ n[4] + " " + /*variant*/ n[3] + " " + /*elem_classes*/ - n[1].join(" ") + " svelte-8huxfn"), X( + n[1].join(" ") + " svelte-8huxfn"), R( e, "id", /*elem_id*/ n[0] - ), de(e, "hidden", !/*visible*/ - n[2]), de( + ), we(e, "hidden", !/*visible*/ + n[2]), we( e, "disabled", /*disabled*/ @@ -1084,200 +1118,200 @@ function gs(n) { n[10] == "number" ? `calc(min(${/*min_width*/ n[10]}px, 100%))` : null); }, - m(o, u) { - Me(o, e, u), l && l.m(e, null), rn(e, t), a && a.m(e, null), s = !0; + m(l, u) { + Le(l, e, u), o && o.m(e, null), _n(e, t), a && a.m(e, null), s = !0; }, - p(o, u) { + p(l, u) { /*icon*/ - o[7] ? l ? l.p(o, u) : (l = Ut(o), l.c(), l.m(e, t)) : l && (l.d(1), l = null), a && a.p && (!s || u & /*$$scope*/ - 2048) && mn( + l[7] ? o ? o.p(l, u) : (o = Ft(l), o.c(), o.m(e, t)) : o && (o.d(1), o = null), a && a.p && (!s || u & /*$$scope*/ + 2048) && yn( a, r, - o, + l, /*$$scope*/ - o[11], - s ? un( + l[11], + s ? gn( r, /*$$scope*/ - o[11], + l[11], u, null - ) : cn( + ) : bn( /*$$scope*/ - o[11] + l[11] ), null ), (!s || u & /*link*/ - 64) && X( + 64) && R( e, "href", /*link*/ - o[6] + l[6] ), (!s || u & /*disabled*/ - 256) && X( + 256) && R( e, "aria-disabled", /*disabled*/ - o[8] + l[8] ), (!s || u & /*size, variant, elem_classes*/ 26 && i !== (i = /*size*/ - o[4] + " " + /*variant*/ - o[3] + " " + /*elem_classes*/ - o[1].join(" ") + " svelte-8huxfn")) && X(e, "class", i), (!s || u & /*elem_id*/ - 1) && X( + l[4] + " " + /*variant*/ + l[3] + " " + /*elem_classes*/ + l[1].join(" ") + " svelte-8huxfn")) && R(e, "class", i), (!s || u & /*elem_id*/ + 1) && R( e, "id", /*elem_id*/ - o[0] + l[0] ), (!s || u & /*size, variant, elem_classes, visible*/ - 30) && de(e, "hidden", !/*visible*/ - o[2]), (!s || u & /*size, variant, elem_classes, disabled*/ - 282) && de( + 30) && we(e, "hidden", !/*visible*/ + l[2]), (!s || u & /*size, variant, elem_classes, disabled*/ + 282) && we( e, "disabled", /*disabled*/ - o[8] + l[8] ), u & /*scale*/ 512 && T( e, "flex-grow", /*scale*/ - o[9] + l[9] ), u & /*disabled*/ 256 && T( e, "pointer-events", /*disabled*/ - o[8] ? "none" : null + l[8] ? "none" : null ), u & /*scale*/ 512 && T( e, "width", /*scale*/ - o[9] === 0 ? "fit-content" : null + l[9] === 0 ? "fit-content" : null ), u & /*min_width*/ 1024 && T(e, "min-width", typeof /*min_width*/ - o[10] == "number" ? `calc(min(${/*min_width*/ - o[10]}px, 100%))` : null); + l[10] == "number" ? `calc(min(${/*min_width*/ + l[10]}px, 100%))` : null); }, - i(o) { - s || (Pe(a, o), s = !0); + i(l) { + s || (et(a, l), s = !0); }, - o(o) { - Ke(a, o), s = !1; + o(l) { + tt(a, l), s = !1; }, - d(o) { - o && Ae(e), l && l.d(), a && a.d(o); + d(l) { + l && De(e), o && o.d(), a && a.d(l); } }; } -function It(n) { +function Nt(n) { let e, t, i; return { c() { - e = $e("img"), X(e, "class", "button-icon svelte-8huxfn"), Fe(e.src, t = /*icon*/ - n[7].url) || X(e, "src", t), X(e, "alt", i = `${/*value*/ + e = it("img"), R(e, "class", "button-icon svelte-8huxfn"), $e(e.src, t = /*icon*/ + n[7].url) || R(e, "src", t), R(e, "alt", i = `${/*value*/ n[5]} icon`); }, - m(s, l) { - Me(s, e, l); + m(s, o) { + Le(s, e, o); }, - p(s, l) { - l & /*icon*/ - 128 && !Fe(e.src, t = /*icon*/ - s[7].url) && X(e, "src", t), l & /*value*/ + p(s, o) { + o & /*icon*/ + 128 && !$e(e.src, t = /*icon*/ + s[7].url) && R(e, "src", t), o & /*value*/ 32 && i !== (i = `${/*value*/ - s[5]} icon`) && X(e, "alt", i); + s[5]} icon`) && R(e, "alt", i); }, d(s) { - s && Ae(e); + s && De(e); } }; } -function Ut(n) { +function Ft(n) { let e, t, i; return { c() { - e = $e("img"), X(e, "class", "button-icon svelte-8huxfn"), Fe(e.src, t = /*icon*/ - n[7].url) || X(e, "src", t), X(e, "alt", i = `${/*value*/ + e = it("img"), R(e, "class", "button-icon svelte-8huxfn"), $e(e.src, t = /*icon*/ + n[7].url) || R(e, "src", t), R(e, "alt", i = `${/*value*/ n[5]} icon`); }, - m(s, l) { - Me(s, e, l); + m(s, o) { + Le(s, e, o); }, - p(s, l) { - l & /*icon*/ - 128 && !Fe(e.src, t = /*icon*/ - s[7].url) && X(e, "src", t), l & /*value*/ + p(s, o) { + o & /*icon*/ + 128 && !$e(e.src, t = /*icon*/ + s[7].url) && R(e, "src", t), o & /*value*/ 32 && i !== (i = `${/*value*/ - s[5]} icon`) && X(e, "alt", i); + s[5]} icon`) && R(e, "alt", i); }, d(s) { - s && Ae(e); + s && De(e); } }; } -function ws(n) { +function Xs(n) { let e, t, i, s; - const l = [gs, bs], r = []; - function a(o, u) { + const o = [Hs, Rs], r = []; + function a(l, u) { return ( /*link*/ - o[6] && /*link*/ - o[6].length > 0 ? 0 : 1 + l[6] && /*link*/ + l[6].length > 0 ? 0 : 1 ); } - return e = a(n), t = r[e] = l[e](n), { + return e = a(n), t = r[e] = o[e](n), { c() { - t.c(), i = us(); + t.c(), i = zs(); }, - m(o, u) { - r[e].m(o, u), Me(o, i, u), s = !0; + m(l, u) { + r[e].m(l, u), Le(l, i, u), s = !0; }, - p(o, [u]) { - let f = e; - e = a(o), e === f ? r[e].p(o, u) : (hs(), Ke(r[f], 1, 1, () => { - r[f] = null; - }), cs(), t = r[e], t ? t.p(o, u) : (t = r[e] = l[e](o), t.c()), Pe(t, 1), t.m(i.parentNode, i)); + p(l, [u]) { + let c = e; + e = a(l), e === c ? r[e].p(l, u) : (Es(), tt(r[c], 1, 1, () => { + r[c] = null; + }), Ss(), t = r[e], t ? t.p(l, u) : (t = r[e] = o[e](l), t.c()), et(t, 1), t.m(i.parentNode, i)); }, - i(o) { - s || (Pe(t), s = !0); + i(l) { + s || (et(t), s = !0); }, - o(o) { - Ke(t), s = !1; + o(l) { + tt(t), s = !1; }, - d(o) { - o && Ae(i), r[e].d(o); + d(l) { + l && De(i), r[e].d(l); } }; } -function ys(n, e, t) { - let { $$slots: i = {}, $$scope: s } = e, { elem_id: l = "" } = e, { elem_classes: r = [] } = e, { visible: a = !0 } = e, { variant: o = "secondary" } = e, { size: u = "lg" } = e, { value: f = null } = e, { link: c = null } = e, { icon: w = null } = e, { disabled: g = !1 } = e, { scale: v = null } = e, { min_width: _ = void 0 } = e; - function d(m) { - fs.call(this, n, m); +function Ys(n, e, t) { + let { $$slots: i = {}, $$scope: s } = e, { elem_id: o = "" } = e, { elem_classes: r = [] } = e, { visible: a = !0 } = e, { variant: l = "secondary" } = e, { size: u = "lg" } = e, { value: c = null } = e, { link: f = null } = e, { icon: d = null } = e, { disabled: g = !1 } = e, { scale: k = null } = e, { min_width: y = void 0 } = e; + function m(_) { + Cs.call(this, n, _); } - return n.$$set = (m) => { - "elem_id" in m && t(0, l = m.elem_id), "elem_classes" in m && t(1, r = m.elem_classes), "visible" in m && t(2, a = m.visible), "variant" in m && t(3, o = m.variant), "size" in m && t(4, u = m.size), "value" in m && t(5, f = m.value), "link" in m && t(6, c = m.link), "icon" in m && t(7, w = m.icon), "disabled" in m && t(8, g = m.disabled), "scale" in m && t(9, v = m.scale), "min_width" in m && t(10, _ = m.min_width), "$$scope" in m && t(11, s = m.$$scope); + return n.$$set = (_) => { + "elem_id" in _ && t(0, o = _.elem_id), "elem_classes" in _ && t(1, r = _.elem_classes), "visible" in _ && t(2, a = _.visible), "variant" in _ && t(3, l = _.variant), "size" in _ && t(4, u = _.size), "value" in _ && t(5, c = _.value), "link" in _ && t(6, f = _.link), "icon" in _ && t(7, d = _.icon), "disabled" in _ && t(8, g = _.disabled), "scale" in _ && t(9, k = _.scale), "min_width" in _ && t(10, y = _.min_width), "$$scope" in _ && t(11, s = _.$$scope); }, [ - l, + o, r, a, - o, + l, u, - f, c, - w, + f, + d, g, - v, - _, + k, + y, s, i, - d + m ]; } -class bt extends rs { +class wt extends xs { constructor(e) { - super(), ms(this, e, ys, ws, ds, { + super(), Bs(this, e, Ys, Xs, Ms, { elem_id: 0, elem_classes: 1, visible: 2, @@ -1293,132 +1327,132 @@ class bt extends rs { } } const { - SvelteComponent: vs, - add_render_callback: _n, - append: Le, + SvelteComponent: Ds, + add_render_callback: vn, + append: We, attr: O, - binding_callbacks: Wt, - check_outros: ks, - create_bidirectional_transition: jt, - destroy_each: ps, - detach: Ce, - element: Ge, - empty: xs, - ensure_array_like: Nt, - group_outros: Cs, - init: Ss, - insert: Se, - listen: gt, - prevent_default: zs, - run_all: Es, - safe_not_equal: As, - set_data: Ms, - set_style: re, - space: wt, - text: Bs, - toggle_class: V, - transition_in: ft, - transition_out: Vt -} = window.__gradio__svelte__internal, { createEventDispatcher: Xs } = window.__gradio__svelte__internal; -function Ft(n, e, t) { + binding_callbacks: Pt, + check_outros: Ls, + create_bidirectional_transition: Kt, + destroy_each: Ts, + detach: Be, + element: nt, + empty: qs, + ensure_array_like: Gt, + group_outros: Os, + init: Is, + insert: Ae, + listen: yt, + prevent_default: js, + run_all: Us, + safe_not_equal: Ws, + set_data: Vs, + set_style: me, + space: vt, + text: Ns, + toggle_class: K, + transition_in: mt, + transition_out: Jt +} = window.__gradio__svelte__internal, { createEventDispatcher: Fs } = window.__gradio__svelte__internal; +function Zt(n, e, t) { const i = n.slice(); return i[26] = e[t], i; } -function Pt(n) { - let e, t, i, s, l, r = Nt( +function Qt(n) { + let e, t, i, s, o, r = Gt( /*filtered_indices*/ n[1] ), a = []; - for (let o = 0; o < r.length; o += 1) - a[o] = Kt(Ft(n, r, o)); + for (let l = 0; l < r.length; l += 1) + a[l] = $t(Zt(n, r, l)); return { c() { - e = Ge("ul"); - for (let o = 0; o < a.length; o += 1) - a[o].c(); - O(e, "class", "options svelte-yuohum"), O(e, "role", "listbox"), re( + e = nt("ul"); + for (let l = 0; l < a.length; l += 1) + a[l].c(); + O(e, "class", "options svelte-yuohum"), O(e, "role", "listbox"), me( e, "bottom", /*bottom*/ n[9] - ), re(e, "max-height", `calc(${/*max_height*/ - n[10]}px - var(--window-padding))`), re( + ), me(e, "max-height", `calc(${/*max_height*/ + n[10]}px - var(--window-padding))`), me( e, "width", /*input_width*/ n[8] + "px" ); }, - m(o, u) { - Se(o, e, u); - for (let f = 0; f < a.length; f += 1) - a[f] && a[f].m(e, null); - n[22](e), i = !0, s || (l = gt(e, "mousedown", zs( + m(l, u) { + Ae(l, e, u); + for (let c = 0; c < a.length; c += 1) + a[c] && a[c].m(e, null); + n[22](e), i = !0, s || (o = yt(e, "mousedown", js( /*mousedown_handler*/ n[21] )), s = !0); }, - p(o, u) { + p(l, u) { if (u & /*filtered_indices, choices, selected_indices, active_index*/ 51) { - r = Nt( + r = Gt( /*filtered_indices*/ - o[1] + l[1] ); - let f; - for (f = 0; f < r.length; f += 1) { - const c = Ft(o, r, f); - a[f] ? a[f].p(c, u) : (a[f] = Kt(c), a[f].c(), a[f].m(e, null)); + let c; + for (c = 0; c < r.length; c += 1) { + const f = Zt(l, r, c); + a[c] ? a[c].p(f, u) : (a[c] = $t(f), a[c].c(), a[c].m(e, null)); } - for (; f < a.length; f += 1) - a[f].d(1); + for (; c < a.length; c += 1) + a[c].d(1); a.length = r.length; } u & /*bottom*/ - 512 && re( + 512 && me( e, "bottom", /*bottom*/ - o[9] + l[9] ), u & /*max_height*/ - 1024 && re(e, "max-height", `calc(${/*max_height*/ - o[10]}px - var(--window-padding))`), u & /*input_width*/ - 256 && re( + 1024 && me(e, "max-height", `calc(${/*max_height*/ + l[10]}px - var(--window-padding))`), u & /*input_width*/ + 256 && me( e, "width", /*input_width*/ - o[8] + "px" + l[8] + "px" ); }, - i(o) { - i || (o && _n(() => { - i && (t || (t = jt(e, Ot, { duration: 200, y: 5 }, !0)), t.run(1)); + i(l) { + i || (l && vn(() => { + i && (t || (t = Kt(e, Vt, { duration: 200, y: 5 }, !0)), t.run(1)); }), i = !0); }, - o(o) { - o && (t || (t = jt(e, Ot, { duration: 200, y: 5 }, !1)), t.run(0)), i = !1; + o(l) { + l && (t || (t = Kt(e, Vt, { duration: 200, y: 5 }, !1)), t.run(0)), i = !1; }, - d(o) { - o && Ce(e), ps(a, o), n[22](null), o && t && t.end(), s = !1, l(); + d(l) { + l && Be(e), Ts(a, l), n[22](null), l && t && t.end(), s = !1, o(); } }; } -function Kt(n) { +function $t(n) { let e, t, i, s = ( /*choices*/ n[0][ /*index*/ n[26] ][0] + "" - ), l, r, a, o, u; + ), o, r, a, l, u; return { c() { - e = Ge("li"), t = Ge("span"), t.textContent = "✓", i = wt(), l = Bs(s), r = wt(), O(t, "class", "inner-item svelte-yuohum"), V(t, "hide", !/*selected_indices*/ + e = nt("li"), t = nt("span"), t.textContent = "✓", i = vt(), o = Ns(s), r = vt(), O(t, "class", "inner-item svelte-yuohum"), K(t, "hide", !/*selected_indices*/ n[4].includes( /*index*/ n[26] )), O(e, "class", "item svelte-yuohum"), O(e, "data-index", a = /*index*/ - n[26]), O(e, "aria-label", o = /*choices*/ + n[26]), O(e, "aria-label", l = /*choices*/ n[0][ /*index*/ n[26] @@ -1426,7 +1460,7 @@ function Kt(n) { n[4].includes( /*index*/ n[26] - )), V( + )), K( e, "selected", /*selected_indices*/ @@ -1434,19 +1468,19 @@ function Kt(n) { /*index*/ n[26] ) - ), V( + ), K( e, "active", /*index*/ n[26] === /*active_index*/ n[5] - ), V( + ), K( e, "bg-gray-100", /*index*/ n[26] === /*active_index*/ n[5] - ), V( + ), K( e, "dark:bg-gray-600", /*index*/ @@ -1454,93 +1488,93 @@ function Kt(n) { n[5] ); }, - m(f, c) { - Se(f, e, c), Le(e, t), Le(e, i), Le(e, l), Le(e, r); + m(c, f) { + Ae(c, e, f), We(e, t), We(e, i), We(e, o), We(e, r); }, - p(f, c) { - c & /*selected_indices, filtered_indices*/ - 18 && V(t, "hide", !/*selected_indices*/ - f[4].includes( + p(c, f) { + f & /*selected_indices, filtered_indices*/ + 18 && K(t, "hide", !/*selected_indices*/ + c[4].includes( /*index*/ - f[26] - )), c & /*choices, filtered_indices*/ + c[26] + )), f & /*choices, filtered_indices*/ 3 && s !== (s = /*choices*/ - f[0][ + c[0][ /*index*/ - f[26] - ][0] + "") && Ms(l, s), c & /*filtered_indices*/ + c[26] + ][0] + "") && Vs(o, s), f & /*filtered_indices*/ 2 && a !== (a = /*index*/ - f[26]) && O(e, "data-index", a), c & /*choices, filtered_indices*/ - 3 && o !== (o = /*choices*/ - f[0][ + c[26]) && O(e, "data-index", a), f & /*choices, filtered_indices*/ + 3 && l !== (l = /*choices*/ + c[0][ /*index*/ - f[26] - ][0]) && O(e, "aria-label", o), c & /*selected_indices, filtered_indices*/ + c[26] + ][0]) && O(e, "aria-label", l), f & /*selected_indices, filtered_indices*/ 18 && u !== (u = /*selected_indices*/ - f[4].includes( + c[4].includes( /*index*/ - f[26] - )) && O(e, "aria-selected", u), c & /*selected_indices, filtered_indices*/ - 18 && V( + c[26] + )) && O(e, "aria-selected", u), f & /*selected_indices, filtered_indices*/ + 18 && K( e, "selected", /*selected_indices*/ - f[4].includes( + c[4].includes( /*index*/ - f[26] + c[26] ) - ), c & /*filtered_indices, active_index*/ - 34 && V( + ), f & /*filtered_indices, active_index*/ + 34 && K( e, "active", /*index*/ - f[26] === /*active_index*/ - f[5] - ), c & /*filtered_indices, active_index*/ - 34 && V( + c[26] === /*active_index*/ + c[5] + ), f & /*filtered_indices, active_index*/ + 34 && K( e, "bg-gray-100", /*index*/ - f[26] === /*active_index*/ - f[5] - ), c & /*filtered_indices, active_index*/ - 34 && V( + c[26] === /*active_index*/ + c[5] + ), f & /*filtered_indices, active_index*/ + 34 && K( e, "dark:bg-gray-600", /*index*/ - f[26] === /*active_index*/ - f[5] + c[26] === /*active_index*/ + c[5] ); }, - d(f) { - f && Ce(e); + d(c) { + c && Be(e); } }; } -function Ys(n) { - let e, t, i, s, l; - _n( +function Ps(n) { + let e, t, i, s, o; + vn( /*onwindowresize*/ n[19] ); let r = ( /*show_options*/ n[2] && !/*disabled*/ - n[3] && Pt(n) + n[3] && Qt(n) ); return { c() { - e = Ge("div"), t = wt(), r && r.c(), i = xs(), O(e, "class", "reference"); + e = nt("div"), t = vt(), r && r.c(), i = qs(), O(e, "class", "reference"); }, - m(a, o) { - Se(a, e, o), n[20](e), Se(a, t, o), r && r.m(a, o), Se(a, i, o), s || (l = [ - gt( + m(a, l) { + Ae(a, e, l), n[20](e), Ae(a, t, l), r && r.m(a, l), Ae(a, i, l), s || (o = [ + yt( window, "scroll", /*scroll_listener*/ n[12] ), - gt( + yt( window, "resize", /*onwindowresize*/ @@ -1548,105 +1582,105 @@ function Ys(n) { ) ], s = !0); }, - p(a, [o]) { + p(a, [l]) { /*show_options*/ a[2] && !/*disabled*/ - a[3] ? r ? (r.p(a, o), o & /*show_options, disabled*/ - 12 && ft(r, 1)) : (r = Pt(a), r.c(), ft(r, 1), r.m(i.parentNode, i)) : r && (Cs(), Vt(r, 1, 1, () => { + a[3] ? r ? (r.p(a, l), l & /*show_options, disabled*/ + 12 && mt(r, 1)) : (r = Qt(a), r.c(), mt(r, 1), r.m(i.parentNode, i)) : r && (Os(), Jt(r, 1, 1, () => { r = null; - }), ks()); + }), Ls()); }, i(a) { - ft(r); + mt(r); }, o(a) { - Vt(r); + Jt(r); }, d(a) { - a && (Ce(e), Ce(t), Ce(i)), n[20](null), r && r.d(a), s = !1, Es(l); + a && (Be(e), Be(t), Be(i)), n[20](null), r && r.d(a), s = !1, Us(o); } }; } -function Hs(n, e, t) { +function Ks(n, e, t) { var i, s; - let { choices: l } = e, { filtered_indices: r } = e, { show_options: a = !1 } = e, { disabled: o = !1 } = e, { selected_indices: u = [] } = e, { active_index: f = null } = e, c, w, g, v, _, d, m, y, h; - function x() { - const { top: z, bottom: U } = _.getBoundingClientRect(); - t(16, c = z), t(17, w = h - U); + let { choices: o } = e, { filtered_indices: r } = e, { show_options: a = !1 } = e, { disabled: l = !1 } = e, { selected_indices: u = [] } = e, { active_index: c = null } = e, f, d, g, k, y, m, _, v, h; + function b() { + const { top: z, bottom: Z } = y.getBoundingClientRect(); + t(16, f = z), t(17, d = h - Z); } let p = null; - function M() { + function A() { a && (p !== null && clearTimeout(p), p = setTimeout( () => { - x(), p = null; + b(), p = null; }, 10 )); } - const A = Xs(); + const B = Fs(); function C() { t(11, h = window.innerHeight); } - function B(z) { - Wt[z ? "unshift" : "push"](() => { - _ = z, t(6, _); + function M(z) { + Pt[z ? "unshift" : "push"](() => { + y = z, t(6, y); }); } - const D = (z) => A("change", z); - function G(z) { - Wt[z ? "unshift" : "push"](() => { - d = z, t(7, d); + const D = (z) => B("change", z); + function V(z) { + Pt[z ? "unshift" : "push"](() => { + m = z, t(7, m); }); } return n.$$set = (z) => { - "choices" in z && t(0, l = z.choices), "filtered_indices" in z && t(1, r = z.filtered_indices), "show_options" in z && t(2, a = z.show_options), "disabled" in z && t(3, o = z.disabled), "selected_indices" in z && t(4, u = z.selected_indices), "active_index" in z && t(5, f = z.active_index); + "choices" in z && t(0, o = z.choices), "filtered_indices" in z && t(1, r = z.filtered_indices), "show_options" in z && t(2, a = z.show_options), "disabled" in z && t(3, l = z.disabled), "selected_indices" in z && t(4, u = z.selected_indices), "active_index" in z && t(5, c = z.active_index); }, n.$$.update = () => { if (n.$$.dirty & /*show_options, refElement, listElement, selected_indices, _a, _b, distance_from_bottom, distance_from_top, input_height*/ 508116) { - if (a && _) { - if (d && u.length > 0) { - let U = d.querySelectorAll("li"); - for (const R of Array.from(U)) - if (R.getAttribute("data-index") === u[0].toString()) { - t(14, i = d == null ? void 0 : d.scrollTo) === null || i === void 0 || i.call(d, 0, R.offsetTop); + if (a && y) { + if (m && u.length > 0) { + let Z = m.querySelectorAll("li"); + for (const N of Array.from(Z)) + if (N.getAttribute("data-index") === u[0].toString()) { + t(14, i = m == null ? void 0 : m.scrollTo) === null || i === void 0 || i.call(m, 0, N.offsetTop); break; } } - x(); - const z = t(15, s = _.parentElement) === null || s === void 0 ? void 0 : s.getBoundingClientRect(); - t(18, g = (z == null ? void 0 : z.height) || 0), t(8, v = (z == null ? void 0 : z.width) || 0); + b(); + const z = t(15, s = y.parentElement) === null || s === void 0 ? void 0 : s.getBoundingClientRect(); + t(18, g = (z == null ? void 0 : z.height) || 0), t(8, k = (z == null ? void 0 : z.width) || 0); } - w > c ? (t(10, y = w), t(9, m = null)) : (t(9, m = `${w + g}px`), t(10, y = c - g)); + d > f ? (t(10, v = d), t(9, _ = null)) : (t(9, _ = `${d + g}px`), t(10, v = f - g)); } }, [ - l, + o, r, a, - o, + l, u, - f, + c, + y, + m, + k, _, - d, v, - m, - y, h, - M, A, + B, i, s, - c, - w, + f, + d, g, C, - B, + M, D, - G + V ]; } -class Ds extends vs { +class Gs extends Ds { constructor(e) { - super(), Ss(this, e, Hs, Ys, As, { + super(), Is(this, e, Ks, Ps, Ws, { choices: 0, filtered_indices: 1, show_options: 2, @@ -1656,16 +1690,16 @@ class Ds extends vs { }); } } -function Rs(n, e) { +function Js(n, e) { return (n % e + e) % e; } -function Gt(n, e) { +function en(n, e) { return n.reduce((t, i, s) => ((!e || i[0].toLowerCase().includes(e.toLowerCase())) && t.push(s), t), []); } -function Ls(n, e, t) { +function Zs(n, e, t) { n("change", e), t || n("input"); } -function Ts(n, e, t) { +function Qs(n, e, t) { if (n.key === "Escape") return [!1, e]; if ((n.key === "ArrowDown" || n.key === "ArrowUp") && t.length >= 0) @@ -1673,83 +1707,83 @@ function Ts(n, e, t) { e = n.key === "ArrowDown" ? t[0] : t[t.length - 1]; else { const i = t.indexOf(e), s = n.key === "ArrowUp" ? -1 : 1; - e = t[Rs(i + s, t.length)]; + e = t[Js(i + s, t.length)]; } return [!0, e]; } const { - SvelteComponent: qs, - append: ie, + SvelteComponent: $s, + append: oe, attr: q, - binding_callbacks: Os, - check_outros: Is, - create_component: yt, - destroy_component: vt, - detach: xt, - element: ue, - group_outros: Us, - init: Ws, - insert: Ct, - listen: ge, - mount_component: kt, - run_all: js, - safe_not_equal: Ns, - set_data: Vs, - set_input_value: Jt, - space: ct, - text: Fs, - toggle_class: fe, - transition_in: he, - transition_out: ye -} = window.__gradio__svelte__internal, { onMount: Ps } = window.__gradio__svelte__internal, { createEventDispatcher: Ks, afterUpdate: Gs } = window.__gradio__svelte__internal; -function Js(n) { + binding_callbacks: el, + check_outros: tl, + create_component: kt, + destroy_component: pt, + detach: St, + element: be, + group_outros: nl, + init: il, + insert: zt, + listen: ve, + mount_component: xt, + run_all: sl, + safe_not_equal: ll, + set_data: ol, + set_input_value: tn, + space: _t, + text: al, + toggle_class: _e, + transition_in: ge, + transition_out: pe +} = window.__gradio__svelte__internal, { onMount: rl } = window.__gradio__svelte__internal, { createEventDispatcher: fl, afterUpdate: cl } = window.__gradio__svelte__internal; +function ul(n) { let e; return { c() { - e = Fs( + e = al( /*label*/ n[0] ); }, m(t, i) { - Ct(t, e, i); + zt(t, e, i); }, p(t, i) { i[0] & /*label*/ - 1 && Vs( + 1 && ol( e, /*label*/ t[0] ); }, d(t) { - t && xt(e); + t && St(e); } }; } -function Zt(n) { +function nn(n) { let e, t, i; - return t = new Ui({}), { + return t = new ns({}), { c() { - e = ue("div"), yt(t.$$.fragment), q(e, "class", "icon-wrap svelte-1m1zvyj"); + e = be("div"), kt(t.$$.fragment), q(e, "class", "icon-wrap svelte-1m1zvyj"); }, - m(s, l) { - Ct(s, e, l), kt(t, e, null), i = !0; + m(s, o) { + zt(s, e, o), xt(t, e, null), i = !0; }, i(s) { - i || (he(t.$$.fragment, s), i = !0); + i || (ge(t.$$.fragment, s), i = !0); }, o(s) { - ye(t.$$.fragment, s), i = !1; + pe(t.$$.fragment, s), i = !1; }, d(s) { - s && xt(e), vt(t); + s && St(e), pt(t); } }; } -function Zs(n) { - let e, t, i, s, l, r, a, o, u, f, c, w, g, v; - t = new ln({ +function hl(n) { + let e, t, i, s, o, r, a, l, u, c, f, d, g, k; + t = new un({ props: { show_label: ( /*show_label*/ @@ -1759,13 +1793,13 @@ function Zs(n) { /*info*/ n[1] ), - $$slots: { default: [Js] }, + $$slots: { default: [ul] }, $$scope: { ctx: n } } }); - let _ = !/*disabled*/ - n[3] && Zt(); - return c = new Ds({ + let y = !/*disabled*/ + n[3] && nn(); + return f = new Gs({ props: { show_options: ( /*show_options*/ @@ -1795,13 +1829,13 @@ function Zs(n) { n[14] ) } - }), c.$on( + }), f.$on( "change", /*handle_option_selected*/ n[16] ), { c() { - e = ue("div"), yt(t.$$.fragment), i = ct(), s = ue("div"), l = ue("div"), r = ue("div"), a = ue("input"), u = ct(), _ && _.c(), f = ct(), yt(c.$$.fragment), q(a, "role", "listbox"), q(a, "aria-controls", "dropdown-options"), q( + e = be("div"), kt(t.$$.fragment), i = _t(), s = be("div"), o = be("div"), r = be("div"), a = be("input"), u = _t(), y && y.c(), c = _t(), kt(f.$$.fragment), q(a, "role", "listbox"), q(a, "aria-controls", "dropdown-options"), q( a, "aria-expanded", /*show_options*/ @@ -1812,55 +1846,55 @@ function Zs(n) { /*label*/ n[0] ), q(a, "class", "border-none svelte-1m1zvyj"), a.disabled = /*disabled*/ - n[3], q(a, "autocomplete", "off"), a.readOnly = o = !/*filterable*/ - n[7], fe(a, "subdued", !/*choices_names*/ + n[3], q(a, "autocomplete", "off"), a.readOnly = l = !/*filterable*/ + n[7], _e(a, "subdued", !/*choices_names*/ n[13].includes( /*input_text*/ n[9] ) && !/*allow_custom_value*/ - n[6]), q(r, "class", "secondary-wrap svelte-1m1zvyj"), q(l, "class", "wrap-inner svelte-1m1zvyj"), fe( - l, + n[6]), q(r, "class", "secondary-wrap svelte-1m1zvyj"), q(o, "class", "wrap-inner svelte-1m1zvyj"), _e( + o, "show_options", /*show_options*/ n[12] - ), q(s, "class", "wrap svelte-1m1zvyj"), q(e, "class", "svelte-1m1zvyj"), fe( + ), q(s, "class", "wrap svelte-1m1zvyj"), q(e, "class", "svelte-1m1zvyj"), _e( e, "container", /*container*/ n[5] ); }, - m(d, m) { - Ct(d, e, m), kt(t, e, null), ie(e, i), ie(e, s), ie(s, l), ie(l, r), ie(r, a), Jt( + m(m, _) { + zt(m, e, _), xt(t, e, null), oe(e, i), oe(e, s), oe(s, o), oe(o, r), oe(r, a), tn( a, /*input_text*/ n[9] - ), n[29](a), ie(r, u), _ && _.m(r, null), ie(s, f), kt(c, s, null), w = !0, g || (v = [ - ge( + ), n[29](a), oe(r, u), y && y.m(r, null), oe(s, c), xt(f, s, null), d = !0, g || (k = [ + ve( a, "input", /*input_input_handler*/ n[28] ), - ge( + ve( a, "keydown", /*handle_key_down*/ n[19] ), - ge( + ve( a, "keyup", /*keyup_handler*/ n[30] ), - ge( + ve( a, "blur", /*handle_blur*/ n[18] ), - ge( + ve( a, "focus", /*handle_focus*/ @@ -1868,183 +1902,183 @@ function Zs(n) { ) ], g = !0); }, - p(d, m) { - const y = {}; - m[0] & /*show_label*/ - 16 && (y.show_label = /*show_label*/ - d[4]), m[0] & /*info*/ - 2 && (y.info = /*info*/ - d[1]), m[0] & /*label*/ - 1 | m[1] & /*$$scope*/ - 4 && (y.$$scope = { dirty: m, ctx: d }), t.$set(y), (!w || m[0] & /*show_options*/ + p(m, _) { + const v = {}; + _[0] & /*show_label*/ + 16 && (v.show_label = /*show_label*/ + m[4]), _[0] & /*info*/ + 2 && (v.info = /*info*/ + m[1]), _[0] & /*label*/ + 1 | _[1] & /*$$scope*/ + 4 && (v.$$scope = { dirty: _, ctx: m }), t.$set(v), (!d || _[0] & /*show_options*/ 4096) && q( a, "aria-expanded", /*show_options*/ - d[12] - ), (!w || m[0] & /*label*/ + m[12] + ), (!d || _[0] & /*label*/ 1) && q( a, "aria-label", /*label*/ - d[0] - ), (!w || m[0] & /*disabled*/ + m[0] + ), (!d || _[0] & /*disabled*/ 8) && (a.disabled = /*disabled*/ - d[3]), (!w || m[0] & /*filterable*/ - 128 && o !== (o = !/*filterable*/ - d[7])) && (a.readOnly = o), m[0] & /*input_text*/ + m[3]), (!d || _[0] & /*filterable*/ + 128 && l !== (l = !/*filterable*/ + m[7])) && (a.readOnly = l), _[0] & /*input_text*/ 512 && a.value !== /*input_text*/ - d[9] && Jt( + m[9] && tn( a, /*input_text*/ - d[9] - ), (!w || m[0] & /*choices_names, input_text, allow_custom_value*/ - 8768) && fe(a, "subdued", !/*choices_names*/ - d[13].includes( + m[9] + ), (!d || _[0] & /*choices_names, input_text, allow_custom_value*/ + 8768) && _e(a, "subdued", !/*choices_names*/ + m[13].includes( /*input_text*/ - d[9] + m[9] ) && !/*allow_custom_value*/ - d[6]), /*disabled*/ - d[3] ? _ && (Us(), ye(_, 1, 1, () => { - _ = null; - }), Is()) : _ ? m[0] & /*disabled*/ - 8 && he(_, 1) : (_ = Zt(), _.c(), he(_, 1), _.m(r, null)), (!w || m[0] & /*show_options*/ - 4096) && fe( - l, + m[6]), /*disabled*/ + m[3] ? y && (nl(), pe(y, 1, 1, () => { + y = null; + }), tl()) : y ? _[0] & /*disabled*/ + 8 && ge(y, 1) : (y = nn(), y.c(), ge(y, 1), y.m(r, null)), (!d || _[0] & /*show_options*/ + 4096) && _e( + o, "show_options", /*show_options*/ - d[12] + m[12] ); const h = {}; - m[0] & /*show_options*/ + _[0] & /*show_options*/ 4096 && (h.show_options = /*show_options*/ - d[12]), m[0] & /*choices*/ + m[12]), _[0] & /*choices*/ 4 && (h.choices = /*choices*/ - d[2]), m[0] & /*filtered_indices*/ + m[2]), _[0] & /*filtered_indices*/ 1024 && (h.filtered_indices = /*filtered_indices*/ - d[10]), m[0] & /*disabled*/ + m[10]), _[0] & /*disabled*/ 8 && (h.disabled = /*disabled*/ - d[3]), m[0] & /*selected_index*/ + m[3]), _[0] & /*selected_index*/ 2048 && (h.selected_indices = /*selected_index*/ - d[11] === null ? [] : [ + m[11] === null ? [] : [ /*selected_index*/ - d[11] - ]), m[0] & /*active_index*/ + m[11] + ]), _[0] & /*active_index*/ 16384 && (h.active_index = /*active_index*/ - d[14]), c.$set(h), (!w || m[0] & /*container*/ - 32) && fe( + m[14]), f.$set(h), (!d || _[0] & /*container*/ + 32) && _e( e, "container", /*container*/ - d[5] + m[5] ); }, - i(d) { - w || (he(t.$$.fragment, d), he(_), he(c.$$.fragment, d), w = !0); + i(m) { + d || (ge(t.$$.fragment, m), ge(y), ge(f.$$.fragment, m), d = !0); }, - o(d) { - ye(t.$$.fragment, d), ye(_), ye(c.$$.fragment, d), w = !1; + o(m) { + pe(t.$$.fragment, m), pe(y), pe(f.$$.fragment, m), d = !1; }, - d(d) { - d && xt(e), vt(t), n[29](null), _ && _.d(), vt(c), g = !1, js(v); + d(m) { + m && St(e), pt(t), n[29](null), y && y.d(), pt(f), g = !1, sl(k); } }; } -function Qs(n, e, t) { - let { label: i } = e, { info: s = void 0 } = e, { value: l = [] } = e, r = [], { value_is_output: a = !1 } = e, { choices: o } = e, u, { disabled: f = !1 } = e, { show_label: c } = e, { container: w = !0 } = e, { allow_custom_value: g = !1 } = e, { filterable: v = !0 } = e, _, d = !1, m, y, h = "", x = "", p = !1, M = [], A = null, C = null, B; - const D = Ks(); - l ? (B = o.map((S) => S[1]).indexOf(l), C = B, C === -1 ? (r = l, C = null) : ([h, r] = o[C], x = h), z()) : o.length > 0 && (B = 0, C = 0, [h, l] = o[C], r = l, x = h); - function G() { - t(13, m = o.map((S) => S[0])), t(24, y = o.map((S) => S[1])); +function ml(n, e, t) { + let { label: i } = e, { info: s = void 0 } = e, { value: o = [] } = e, r = [], { value_is_output: a = !1 } = e, { choices: l } = e, u, { disabled: c = !1 } = e, { show_label: f } = e, { container: d = !0 } = e, { allow_custom_value: g = !1 } = e, { filterable: k = !0 } = e, y, m = !1, _, v, h = "", b = "", p = !1, A = [], B = null, C = null, M; + const D = fl(); + o ? (M = l.map((S) => S[1]).indexOf(o), C = M, C === -1 ? (r = o, C = null) : ([h, r] = l[C], b = h), z()) : l.length > 0 && (M = 0, C = 0, [h, o] = l[C], r = o, b = h); + function V() { + t(13, _ = l.map((S) => S[0])), t(24, v = l.map((S) => S[1])); } function z() { - G(), l === void 0 || Array.isArray(l) && l.length === 0 ? (t(9, h = ""), t(11, C = null)) : y.includes(l) ? (t(9, h = m[y.indexOf(l)]), t(11, C = y.indexOf(l))) : g ? (t(9, h = l), t(11, C = null)) : (t(9, h = ""), t(11, C = null)), t(27, B = C); + V(), o === void 0 || Array.isArray(o) && o.length === 0 ? (t(9, h = ""), t(11, C = null)) : v.includes(o) ? (t(9, h = _[v.indexOf(o)]), t(11, C = v.indexOf(o))) : g ? (t(9, h = o), t(11, C = null)) : (t(9, h = ""), t(11, C = null)), t(27, M = C); } - function U(S) { + function Z(S) { if (t(11, C = parseInt(S.detail.target.dataset.index)), isNaN(C)) { t(11, C = null); return; } - t(12, d = !1), t(14, A = null), _.blur(); + t(12, m = !1), t(14, B = null), y.blur(); } - function R(S) { - t(10, M = o.map((it, Ye) => Ye)), t(12, d = !0), D("focus"); + function N(S) { + t(10, A = l.map((Bt, Oe) => Oe)), t(12, m = !0), D("focus"); } - function ne() { - g ? t(20, l = h) : t(9, h = m[y.indexOf(l)]), t(12, d = !1), t(14, A = null), D("blur"); + function j() { + g ? t(20, o = h) : t(9, h = _[v.indexOf(o)]), t(12, m = !1), t(14, B = null), D("blur"); } - function et(S) { - t(12, [d, A] = Ts(S, A, M), d, (t(14, A), t(2, o), t(23, u), t(6, g), t(9, h), t(10, M), t(8, _), t(25, x), t(11, C), t(27, B), t(26, p), t(24, y))), S.key === "Enter" && (A !== null ? (t(11, C = A), t(12, d = !1), _.blur(), t(14, A = null)) : m.includes(h) ? (t(11, C = m.indexOf(h)), t(12, d = !1), t(14, A = null), _.blur()) : g && (t(20, l = h), t(11, C = null), t(12, d = !1), t(14, A = null), _.blur()), D("enter", l)); + function le(S) { + t(12, [m, B] = Qs(S, B, A), m, (t(14, B), t(2, l), t(23, u), t(6, g), t(9, h), t(10, A), t(8, y), t(25, b), t(11, C), t(27, M), t(26, p), t(24, v))), S.key === "Enter" && (B !== null ? (t(11, C = B), t(12, m = !1), y.blur(), t(14, B = null)) : _.includes(h) ? (t(11, C = _.indexOf(h)), t(12, m = !1), t(14, B = null), y.blur()) : g && (t(20, o = h), t(11, C = null), t(12, m = !1), t(14, B = null), y.blur()), D("enter", o)); } - Gs(() => { + cl(() => { t(21, a = !1), t(26, p = !0); - }), Ps(() => { - _.focus(); + }), rl(() => { + y.focus(); }); - function tt() { - h = this.value, t(9, h), t(11, C), t(27, B), t(26, p), t(2, o), t(24, y); + function st() { + h = this.value, t(9, h), t(11, C), t(27, M), t(26, p), t(2, l), t(24, v); } - function nt(S) { - Os[S ? "unshift" : "push"](() => { - _ = S, t(8, _); + function lt(S) { + el[S ? "unshift" : "push"](() => { + y = S, t(8, y); }); } - const be = (S) => D("key_up", { key: S.key, input_value: h }); + const ot = (S) => D("key_up", { key: S.key, input_value: h }); return n.$$set = (S) => { - "label" in S && t(0, i = S.label), "info" in S && t(1, s = S.info), "value" in S && t(20, l = S.value), "value_is_output" in S && t(21, a = S.value_is_output), "choices" in S && t(2, o = S.choices), "disabled" in S && t(3, f = S.disabled), "show_label" in S && t(4, c = S.show_label), "container" in S && t(5, w = S.container), "allow_custom_value" in S && t(6, g = S.allow_custom_value), "filterable" in S && t(7, v = S.filterable); + "label" in S && t(0, i = S.label), "info" in S && t(1, s = S.info), "value" in S && t(20, o = S.value), "value_is_output" in S && t(21, a = S.value_is_output), "choices" in S && t(2, l = S.choices), "disabled" in S && t(3, c = S.disabled), "show_label" in S && t(4, f = S.show_label), "container" in S && t(5, d = S.container), "allow_custom_value" in S && t(6, g = S.allow_custom_value), "filterable" in S && t(7, k = S.filterable); }, n.$$.update = () => { n.$$.dirty[0] & /*selected_index, old_selected_index, initialized, choices, choices_values*/ - 218105860 && C !== B && C !== null && p && (t(9, [h, l] = o[C], h, (t(20, l), t(11, C), t(27, B), t(26, p), t(2, o), t(24, y))), t(27, B = C), D("select", { + 218105860 && C !== M && C !== null && p && (t(9, [h, o] = l[C], h, (t(20, o), t(11, C), t(27, M), t(26, p), t(2, l), t(24, v))), t(27, M = C), D("select", { index: C, - value: y[C], + value: v[C], selected: !0 })), n.$$.dirty[0] & /*value, old_value, value_is_output*/ - 7340032 && l != r && (z(), Ls(D, l, a), t(22, r = l)), n.$$.dirty[0] & /*choices*/ - 4 && G(), n.$$.dirty[0] & /*choices, old_choices, allow_custom_value, input_text, filtered_indices, filter_input*/ - 8390468 && o !== u && (g || z(), t(23, u = o), t(10, M = Gt(o, h)), !g && M.length > 0 && t(14, A = M[0]), _ == document.activeElement && t(12, d = !0)), n.$$.dirty[0] & /*input_text, old_input_text, choices, allow_custom_value, filtered_indices*/ - 33556036 && h !== x && (t(10, M = Gt(o, h)), t(25, x = h), !g && M.length > 0 && t(14, A = M[0])); + 7340032 && o != r && (z(), Zs(D, o, a), t(22, r = o)), n.$$.dirty[0] & /*choices*/ + 4 && V(), n.$$.dirty[0] & /*choices, old_choices, allow_custom_value, input_text, filtered_indices, filter_input*/ + 8390468 && l !== u && (g || z(), t(23, u = l), t(10, A = en(l, h)), !g && A.length > 0 && t(14, B = A[0]), y == document.activeElement && t(12, m = !0)), n.$$.dirty[0] & /*input_text, old_input_text, choices, allow_custom_value, filtered_indices*/ + 33556036 && h !== b && (t(10, A = en(l, h)), t(25, b = h), !g && A.length > 0 && t(14, B = A[0])); }, [ i, s, - o, - f, + l, c, - w, + f, + d, g, - v, - _, + k, + y, h, - M, + A, C, - d, m, - A, + _, + B, D, - U, - R, - ne, - et, - l, + Z, + N, + j, + le, + o, a, r, u, - y, - x, + v, + b, p, - B, - tt, - nt, - be + M, + st, + lt, + ot ]; } -class $s extends qs { +class _l extends $s { constructor(e) { - super(), Ws( + super(), il( this, e, - Qs, - Zs, - Ns, + ml, + hl, + ll, { label: 0, info: 1, @@ -2063,45 +2097,45 @@ class $s extends qs { } } const { - SvelteComponent: el, - append: F, - attr: Te, - check_outros: tl, - create_component: ve, - destroy_component: ke, - detach: Be, - element: $, - group_outros: nl, - init: il, - insert: Xe, - mount_component: pe, - safe_not_equal: sl, - set_style: xe, - space: qe, - text: St, - transition_in: ee, - transition_out: se -} = window.__gradio__svelte__internal, { createEventDispatcher: ll } = window.__gradio__svelte__internal, { onMount: ol, onDestroy: al } = window.__gradio__svelte__internal; -function rl(n) { + SvelteComponent: dl, + append: G, + attr: Ve, + check_outros: bl, + create_component: xe, + destroy_component: Ce, + detach: Te, + element: ne, + group_outros: gl, + init: wl, + insert: qe, + mount_component: Se, + safe_not_equal: yl, + set_style: ze, + space: Ne, + text: Et, + transition_in: ie, + transition_out: ae +} = window.__gradio__svelte__internal, { createEventDispatcher: vl } = window.__gradio__svelte__internal, { onMount: kl, onDestroy: pl } = window.__gradio__svelte__internal; +function xl(n) { let e; return { c() { - e = St("Cancel"); + e = Et("Cancel"); }, m(t, i) { - Xe(t, e, i); + qe(t, e, i); }, d(t) { - t && Be(e); + t && Te(e); } }; } -function Qt(n) { +function sn(n) { let e, t, i; - return t = new bt({ + return t = new wt({ props: { variant: "stop", - $$slots: { default: [fl] }, + $$slots: { default: [Cl] }, $$scope: { ctx: n } } }), t.$on( @@ -2110,58 +2144,58 @@ function Qt(n) { n[12] ), { c() { - e = $("div"), ve(t.$$.fragment), xe(e, "margin-right", "8px"); + e = ne("div"), xe(t.$$.fragment), ze(e, "margin-right", "8px"); }, - m(s, l) { - Xe(s, e, l), pe(t, e, null), i = !0; + m(s, o) { + qe(s, e, o), Se(t, e, null), i = !0; }, - p(s, l) { + p(s, o) { const r = {}; - l & /*$$scope*/ - 65536 && (r.$$scope = { dirty: l, ctx: s }), t.$set(r); + o & /*$$scope*/ + 65536 && (r.$$scope = { dirty: o, ctx: s }), t.$set(r); }, i(s) { - i || (ee(t.$$.fragment, s), i = !0); + i || (ie(t.$$.fragment, s), i = !0); }, o(s) { - se(t.$$.fragment, s), i = !1; + ae(t.$$.fragment, s), i = !1; }, d(s) { - s && Be(e), ke(t); + s && Te(e), Ce(t); } }; } -function fl(n) { +function Cl(n) { let e; return { c() { - e = St("Remove"); + e = Et("Remove"); }, m(t, i) { - Xe(t, e, i); + qe(t, e, i); }, d(t) { - t && Be(e); + t && Te(e); } }; } -function cl(n) { +function Sl(n) { let e; return { c() { - e = St("OK"); + e = Et("OK"); }, m(t, i) { - Xe(t, e, i); + qe(t, e, i); }, d(t) { - t && Be(e); + t && Te(e); } }; } -function ul(n) { - let e, t, i, s, l, r, a, o, u, f, c, w, g, v, _, d; - l = new $s({ +function zl(n) { + let e, t, i, s, o, r, a, l, u, c, f, d, g, k, y, m; + o = new _l({ props: { value: ( /*currentLabel*/ @@ -2175,15 +2209,15 @@ function ul(n) { show_label: !1, allow_custom_value: !0 } - }), l.$on( + }), o.$on( "change", /*onDropDownChange*/ n[5] - ), l.$on( + ), o.$on( "enter", /*onDropDownEnter*/ n[7] - ), o = new os({ + ), l = new ks({ props: { value: ( /*currentColor*/ @@ -2192,132 +2226,132 @@ function ul(n) { label: "Color", show_label: !1 } - }), o.$on( + }), l.$on( "change", /*onColorChange*/ n[6] - ), c = new bt({ + ), f = new wt({ props: { - $$slots: { default: [rl] }, + $$slots: { default: [xl] }, $$scope: { ctx: n } } - }), c.$on( + }), f.$on( "click", /*click_handler*/ n[11] ); - let m = ( + let _ = ( /*showRemove*/ - n[3] && Qt(n) + n[3] && sn(n) ); - return _ = new bt({ + return y = new wt({ props: { variant: "primary", - $$slots: { default: [cl] }, + $$slots: { default: [Sl] }, $$scope: { ctx: n } } - }), _.$on( + }), y.$on( "click", /*click_handler_2*/ n[13] ), { c() { - e = $("div"), t = $("div"), i = $("span"), s = $("div"), ve(l.$$.fragment), r = qe(), a = $("div"), ve(o.$$.fragment), u = qe(), f = $("div"), ve(c.$$.fragment), w = qe(), m && m.c(), g = qe(), v = $("div"), ve(_.$$.fragment), xe(s, "margin-right", "10px"), xe(a, "margin-right", "40px"), xe(a, "margin-bottom", "8px"), xe(f, "margin-right", "8px"), Te(i, "class", "model-content svelte-hkn2q1"), Te(t, "class", "modal-container svelte-hkn2q1"), Te(e, "class", "modal svelte-hkn2q1"), Te(e, "id", "model-box-edit"); + e = ne("div"), t = ne("div"), i = ne("span"), s = ne("div"), xe(o.$$.fragment), r = Ne(), a = ne("div"), xe(l.$$.fragment), u = Ne(), c = ne("div"), xe(f.$$.fragment), d = Ne(), _ && _.c(), g = Ne(), k = ne("div"), xe(y.$$.fragment), ze(s, "margin-right", "10px"), ze(a, "margin-right", "40px"), ze(a, "margin-bottom", "8px"), ze(c, "margin-right", "8px"), Ve(i, "class", "model-content svelte-hkn2q1"), Ve(t, "class", "modal-container svelte-hkn2q1"), Ve(e, "class", "modal svelte-hkn2q1"), Ve(e, "id", "model-box-edit"); }, - m(y, h) { - Xe(y, e, h), F(e, t), F(t, i), F(i, s), pe(l, s, null), F(i, r), F(i, a), pe(o, a, null), F(i, u), F(i, f), pe(c, f, null), F(i, w), m && m.m(i, null), F(i, g), F(i, v), pe(_, v, null), d = !0; + m(v, h) { + qe(v, e, h), G(e, t), G(t, i), G(i, s), Se(o, s, null), G(i, r), G(i, a), Se(l, a, null), G(i, u), G(i, c), Se(f, c, null), G(i, d), _ && _.m(i, null), G(i, g), G(i, k), Se(y, k, null), m = !0; }, - p(y, [h]) { - const x = {}; + p(v, [h]) { + const b = {}; h & /*currentLabel*/ - 1 && (x.value = /*currentLabel*/ - y[0]), h & /*choices*/ - 4 && (x.choices = /*choices*/ - y[2]), l.$set(x); + 1 && (b.value = /*currentLabel*/ + v[0]), h & /*choices*/ + 4 && (b.choices = /*choices*/ + v[2]), o.$set(b); const p = {}; h & /*currentColor*/ 2 && (p.value = /*currentColor*/ - y[1]), o.$set(p); - const M = {}; - h & /*$$scope*/ - 65536 && (M.$$scope = { dirty: h, ctx: y }), c.$set(M), /*showRemove*/ - y[3] ? m ? (m.p(y, h), h & /*showRemove*/ - 8 && ee(m, 1)) : (m = Qt(y), m.c(), ee(m, 1), m.m(i, g)) : m && (nl(), se(m, 1, 1, () => { - m = null; - }), tl()); + v[1]), l.$set(p); const A = {}; h & /*$$scope*/ - 65536 && (A.$$scope = { dirty: h, ctx: y }), _.$set(A); + 65536 && (A.$$scope = { dirty: h, ctx: v }), f.$set(A), /*showRemove*/ + v[3] ? _ ? (_.p(v, h), h & /*showRemove*/ + 8 && ie(_, 1)) : (_ = sn(v), _.c(), ie(_, 1), _.m(i, g)) : _ && (gl(), ae(_, 1, 1, () => { + _ = null; + }), bl()); + const B = {}; + h & /*$$scope*/ + 65536 && (B.$$scope = { dirty: h, ctx: v }), y.$set(B); }, - i(y) { - d || (ee(l.$$.fragment, y), ee(o.$$.fragment, y), ee(c.$$.fragment, y), ee(m), ee(_.$$.fragment, y), d = !0); + i(v) { + m || (ie(o.$$.fragment, v), ie(l.$$.fragment, v), ie(f.$$.fragment, v), ie(_), ie(y.$$.fragment, v), m = !0); }, - o(y) { - se(l.$$.fragment, y), se(o.$$.fragment, y), se(c.$$.fragment, y), se(m), se(_.$$.fragment, y), d = !1; + o(v) { + ae(o.$$.fragment, v), ae(l.$$.fragment, v), ae(f.$$.fragment, v), ae(_), ae(y.$$.fragment, v), m = !1; }, - d(y) { - y && Be(e), ke(l), ke(o), ke(c), m && m.d(), ke(_); + d(v) { + v && Te(e), Ce(o), Ce(l), Ce(f), _ && _.d(), Ce(y); } }; } -function hl(n, e, t) { - let { label: i = "" } = e, { currentLabel: s = "" } = e, { choices: l = [] } = e, { choicesColors: r = [] } = e, { color: a = "" } = e, { currentColor: o = "" } = e, { showRemove: u = !0 } = e; - const f = ll(); - function c(h) { - f("change", { +function El(n, e, t) { + let { label: i = "" } = e, { currentLabel: s = "" } = e, { choices: o = [] } = e, { choicesColors: r = [] } = e, { color: a = "" } = e, { currentColor: l = "" } = e, { showRemove: u = !0 } = e; + const c = vl(); + function f(h) { + c("change", { label: s, - color: o, + color: l, ret: h // -1: remove, 0: cancel, 1: change }); } - function w(h) { - const { detail: x } = h; - let p = x; - Number.isInteger(p) ? (Array.isArray(r) && p < r.length && t(1, o = r[p]), Array.isArray(l) && p < l.length && t(0, s = l[p][0])) : t(0, s = p); + function d(h) { + const { detail: b } = h; + let p = b; + Number.isInteger(p) ? (Array.isArray(r) && p < r.length && t(1, l = r[p]), Array.isArray(o) && p < o.length && t(0, s = o[p][0])) : t(0, s = p); } function g(h) { - const { detail: x } = h; - t(1, o = x); + const { detail: b } = h; + t(1, l = b); } - function v(h) { - w(h), c(1); + function k(h) { + d(h), f(1); } - function _(h) { + function y(h) { switch (h.key) { case "Enter": - c(1); + f(1); break; } } - ol(() => { - document.addEventListener("keydown", _), t(0, s = i), t(1, o = a); - }), al(() => { - document.removeEventListener("keydown", _); + kl(() => { + document.addEventListener("keydown", y), t(0, s = i), t(1, l = a); + }), pl(() => { + document.removeEventListener("keydown", y); }); - const d = () => c(0), m = () => c(-1), y = () => c(1); + const m = () => f(0), _ = () => f(-1), v = () => f(1); return n.$$set = (h) => { - "label" in h && t(8, i = h.label), "currentLabel" in h && t(0, s = h.currentLabel), "choices" in h && t(2, l = h.choices), "choicesColors" in h && t(9, r = h.choicesColors), "color" in h && t(10, a = h.color), "currentColor" in h && t(1, o = h.currentColor), "showRemove" in h && t(3, u = h.showRemove); + "label" in h && t(8, i = h.label), "currentLabel" in h && t(0, s = h.currentLabel), "choices" in h && t(2, o = h.choices), "choicesColors" in h && t(9, r = h.choicesColors), "color" in h && t(10, a = h.color), "currentColor" in h && t(1, l = h.currentColor), "showRemove" in h && t(3, u = h.showRemove); }, [ s, - o, l, + o, u, - c, - w, + f, + d, g, - v, + k, i, r, a, - d, m, - y + _, + v ]; } -class dn extends el { +class kn extends dl { constructor(e) { - super(), il(this, e, hl, ul, sl, { + super(), wl(this, e, El, zl, yl, { label: 8, currentLabel: 0, choices: 2, @@ -2328,71 +2362,71 @@ class dn extends el { }); } } -const H = (n, e, t) => Math.min(Math.max(n, e), t); -function ut(n, e) { +const X = (n, e, t) => Math.min(Math.max(n, e), t); +function dt(n, e) { if (n.startsWith("rgba")) return n.replace(/[\d.]+$/, e.toString()); const t = n.match(/\d+/g); if (!t || t.length !== 3) return `rgba(50, 50, 50, ${e})`; - const [i, s, l] = t; - return `rgba(${i}, ${s}, ${l}, ${e})`; + const [i, s, o] = t; + return `rgba(${i}, ${s}, ${o}, ${e})`; } -class ht { - constructor(e, t, i, s, l, r, a, o, u, f, c, w = "rgb(255, 255, 255)", g = 0.5, v = 25, _ = 8, d = 2, m = 4, y = 1) { +class bt { + constructor(e, t, i, s, o, r, a, l, u, c, f, d = "rgb(255, 255, 255)", g = 0.5, k = 25, y = 8, m = 2, _ = 4, v = 1) { this.stopDrag = () => { this.isDragging = !1, document.removeEventListener("mousemove", this.handleDrag), document.removeEventListener("mouseup", this.stopDrag); }, this.handleDrag = (h) => { if (this.isDragging) { - let x = h.clientX - this.offsetMouseX - this.xmin, p = h.clientY - this.offsetMouseY - this.ymin; - const M = this.canvasXmax - this.canvasXmin, A = this.canvasYmax - this.canvasYmin; - x = H(x, -this.xmin, M - this.xmax), p = H(p, -this.ymin, A - this.ymax), this.xmin += x, this.ymin += p, this.xmax += x, this.ymax += p, this.updateHandles(), this.renderCallBack(); + let b = h.clientX - this.offsetMouseX - this.xmin, p = h.clientY - this.offsetMouseY - this.ymin; + const A = this.canvasXmax - this.canvasXmin, B = this.canvasYmax - this.canvasYmin; + b = X(b, -this.xmin, A - this.xmax), p = X(p, -this.ymin, B - this.ymax), this.xmin += b, this.ymin += p, this.xmax += b, this.ymax += p, this.updateHandles(), this.renderCallBack(); } }, this.handleCreating = (h) => { if (this.isCreating) { - let [x, p] = this.toBoxCoordinates(h.clientX, h.clientY); - x -= this.offsetMouseX, p -= this.offsetMouseY, x > this.xmax ? (this.creatingAnchorX == "xmax" && (this.xmin = this.xmax), this.xmax = x, this.creatingAnchorX = "xmin") : x > this.xmin && x < this.xmax && this.creatingAnchorX == "xmin" ? this.xmax = x : x > this.xmin && x < this.xmax && this.creatingAnchorX == "xmax" ? this.xmin = x : x < this.xmin && (this.creatingAnchorX == "xmin" && (this.xmax = this.xmin), this.xmin = x, this.creatingAnchorX = "xmax"), p > this.ymax ? (this.creatingAnchorY == "ymax" && (this.ymin = this.ymax), this.ymax = p, this.creatingAnchorY = "ymin") : p > this.ymin && p < this.ymax && this.creatingAnchorY == "ymin" ? this.ymax = p : p > this.ymin && p < this.ymax && this.creatingAnchorY == "ymax" ? this.ymin = p : p < this.ymin && (this.creatingAnchorY == "ymin" && (this.ymax = this.ymin), this.ymin = p, this.creatingAnchorY = "ymax"), this.updateHandles(), this.renderCallBack(); + let [b, p] = this.toBoxCoordinates(h.clientX, h.clientY); + b -= this.offsetMouseX, p -= this.offsetMouseY, b > this.xmax ? (this.creatingAnchorX == "xmax" && (this.xmin = this.xmax), this.xmax = b, this.creatingAnchorX = "xmin") : b > this.xmin && b < this.xmax && this.creatingAnchorX == "xmin" ? this.xmax = b : b > this.xmin && b < this.xmax && this.creatingAnchorX == "xmax" ? this.xmin = b : b < this.xmin && (this.creatingAnchorX == "xmin" && (this.xmax = this.xmin), this.xmin = b, this.creatingAnchorX = "xmax"), p > this.ymax ? (this.creatingAnchorY == "ymax" && (this.ymin = this.ymax), this.ymax = p, this.creatingAnchorY = "ymin") : p > this.ymin && p < this.ymax && this.creatingAnchorY == "ymin" ? this.ymax = p : p > this.ymin && p < this.ymax && this.creatingAnchorY == "ymax" ? this.ymin = p : p < this.ymin && (this.creatingAnchorY == "ymin" && (this.ymax = this.ymin), this.ymin = p, this.creatingAnchorY = "ymax"), this.updateHandles(), this.renderCallBack(); } }, this.stopCreating = (h) => { if (this.isCreating = !1, document.removeEventListener("mousemove", this.handleCreating), document.removeEventListener("mouseup", this.stopCreating), this.getArea() > 0) { - const x = this.canvasXmax - this.canvasXmin, p = this.canvasYmax - this.canvasYmin; - this.xmin = H(this.xmin, 0, x - this.minSize), this.ymin = H(this.ymin, 0, p - this.minSize), this.xmax = H(this.xmax, this.minSize, x), this.ymax = H(this.ymax, this.minSize, p), this.minSize > 0 && (this.getWidth() < this.minSize && (this.creatingAnchorX == "xmin" ? this.xmax = this.xmin + this.minSize : this.xmin = this.xmax - this.minSize), this.getHeight() < this.minSize && (this.creatingAnchorY == "ymin" ? this.ymax = this.ymin + this.minSize : this.ymin = this.ymax - this.minSize), this.xmax > x ? (this.xmin -= this.xmax - x, this.xmax = x) : this.xmin < 0 && (this.xmax -= this.xmin, this.xmin = 0), this.ymax > p ? (this.ymin -= this.ymax - p, this.ymax = p) : this.ymin < 0 && (this.ymax -= this.ymin, this.ymin = 0)), this.updateHandles(), this.renderCallBack(); + const b = this.canvasXmax - this.canvasXmin, p = this.canvasYmax - this.canvasYmin; + this.xmin = X(this.xmin, 0, b - this.minSize), this.ymin = X(this.ymin, 0, p - this.minSize), this.xmax = X(this.xmax, this.minSize, b), this.ymax = X(this.ymax, this.minSize, p), this.minSize > 0 && (this.getWidth() < this.minSize && (this.creatingAnchorX == "xmin" ? this.xmax = this.xmin + this.minSize : this.xmin = this.xmax - this.minSize), this.getHeight() < this.minSize && (this.creatingAnchorY == "ymin" ? this.ymax = this.ymin + this.minSize : this.ymin = this.ymax - this.minSize), this.xmax > b ? (this.xmin -= this.xmax - b, this.xmax = b) : this.xmin < 0 && (this.xmax -= this.xmin, this.xmin = 0), this.ymax > p ? (this.ymin -= this.ymax - p, this.ymax = p) : this.ymin < 0 && (this.ymax -= this.ymin, this.ymin = 0)), this.updateHandles(), this.renderCallBack(); } this.onFinishCreation(); }, this.handleResize = (h) => { if (this.isResizing) { - const x = h.clientX, p = h.clientY, M = x - this.resizeHandles[this.resizingHandleIndex].xmin - this.offsetMouseX, A = p - this.resizeHandles[this.resizingHandleIndex].ymin - this.offsetMouseY, C = this.canvasXmax - this.canvasXmin, B = this.canvasYmax - this.canvasYmin; + const b = h.clientX, p = h.clientY, A = b - this.resizeHandles[this.resizingHandleIndex].xmin - this.offsetMouseX, B = p - this.resizeHandles[this.resizingHandleIndex].ymin - this.offsetMouseY, C = this.canvasXmax - this.canvasXmin, M = this.canvasYmax - this.canvasYmin; switch (this.resizingHandleIndex) { case 0: - this.xmin += M, this.ymin += A, this.xmin = H(this.xmin, 0, this.xmax - this.minSize), this.ymin = H(this.ymin, 0, this.ymax - this.minSize); + this.xmin += A, this.ymin += B, this.xmin = X(this.xmin, 0, this.xmax - this.minSize), this.ymin = X(this.ymin, 0, this.ymax - this.minSize); break; case 1: - this.xmax += M, this.ymin += A, this.xmax = H(this.xmax, this.xmin + this.minSize, C), this.ymin = H(this.ymin, 0, this.ymax - this.minSize); + this.xmax += A, this.ymin += B, this.xmax = X(this.xmax, this.xmin + this.minSize, C), this.ymin = X(this.ymin, 0, this.ymax - this.minSize); break; case 2: - this.xmax += M, this.ymax += A, this.xmax = H(this.xmax, this.xmin + this.minSize, C), this.ymax = H(this.ymax, this.ymin + this.minSize, B); + this.xmax += A, this.ymax += B, this.xmax = X(this.xmax, this.xmin + this.minSize, C), this.ymax = X(this.ymax, this.ymin + this.minSize, M); break; case 3: - this.xmin += M, this.ymax += A, this.xmin = H(this.xmin, 0, this.xmax - this.minSize), this.ymax = H(this.ymax, this.ymin + this.minSize, B); + this.xmin += A, this.ymax += B, this.xmin = X(this.xmin, 0, this.xmax - this.minSize), this.ymax = X(this.ymax, this.ymin + this.minSize, M); break; case 4: - this.ymin += A, this.ymin = H(this.ymin, 0, this.ymax - this.minSize); + this.ymin += B, this.ymin = X(this.ymin, 0, this.ymax - this.minSize); break; case 5: - this.xmax += M, this.xmax = H(this.xmax, this.xmin + this.minSize, C); + this.xmax += A, this.xmax = X(this.xmax, this.xmin + this.minSize, C); break; case 6: - this.ymax += A, this.ymax = H(this.ymax, this.ymin + this.minSize, B); + this.ymax += B, this.ymax = X(this.ymax, this.ymin + this.minSize, M); break; case 7: - this.xmin += M, this.xmin = H(this.xmin, 0, this.xmax - this.minSize); + this.xmin += A, this.xmin = X(this.xmin, 0, this.xmax - this.minSize); break; } this.updateHandles(), this.renderCallBack(); } }, this.stopResize = () => { this.isResizing = !1, document.removeEventListener("mousemove", this.handleResize), document.removeEventListener("mouseup", this.stopResize); - }, this.renderCallBack = e, this.onFinishCreation = t, this.canvasXmin = i, this.canvasYmin = s, this.canvasXmax = l, this.canvasYmax = r, this.scaleFactor = y, this.label = a, this.isDragging = !1, this.isCreating = !1, this.xmin = o, this.ymin = u, this.xmax = f, this.ymax = c, this.isResizing = !1, this.isSelected = !1, this.offsetMouseX = 0, this.offsetMouseY = 0, this.resizeHandleSize = _, this.thickness = d, this.selectedThickness = m, this.updateHandles(), this.resizingHandleIndex = -1, this.minSize = v, this.color = w, this.alpha = g, this.creatingAnchorX = "xmin", this.creatingAnchorY = "ymin"; + }, this.renderCallBack = e, this.onFinishCreation = t, this.canvasXmin = i, this.canvasYmin = s, this.canvasXmax = o, this.canvasYmax = r, this.scaleFactor = v, this.label = a, this.isDragging = !1, this.isCreating = !1, this.xmin = l, this.ymin = u, this.xmax = c, this.ymax = f, this.isResizing = !1, this.isSelected = !1, this.offsetMouseX = 0, this.offsetMouseY = 0, this.resizeHandleSize = y, this.thickness = m, this.selectedThickness = _, this.updateHandles(), this.resizingHandleIndex = -1, this.minSize = k, this.color = d, this.alpha = g, this.creatingAnchorX = "xmin", this.creatingAnchorY = "ymin"; } toJSON() { return { @@ -2490,13 +2524,13 @@ class ht { } render(e) { let t, i; - if (e.beginPath(), [t, i] = this.toCanvasCoordinates(this.xmin, this.ymin), e.rect(t, i, this.getWidth(), this.getHeight()), e.fillStyle = ut(this.color, this.alpha), e.fill(), this.isSelected ? e.lineWidth = this.selectedThickness : e.lineWidth = this.thickness, e.strokeStyle = ut(this.color, 1), e.stroke(), e.closePath(), this.label !== null && this.label.trim() !== "") { + if (e.beginPath(), [t, i] = this.toCanvasCoordinates(this.xmin, this.ymin), e.rect(t, i, this.getWidth(), this.getHeight()), e.fillStyle = dt(this.color, this.alpha), e.fill(), this.isSelected ? e.lineWidth = this.selectedThickness : e.lineWidth = this.thickness, e.strokeStyle = dt(this.color, 1), e.stroke(), e.closePath(), this.label !== null && this.label.trim() !== "") { this.isSelected ? e.font = "bold 14px Arial" : e.font = "12px Arial"; - const s = e.measureText(this.label).width + 10, l = 20; - let r = this.xmin, a = this.ymin - l; - e.fillStyle = "white", [r, a] = this.toCanvasCoordinates(r, a), e.fillRect(r, a, s, l), e.lineWidth = 1, e.strokeStyle = "black", e.strokeRect(r, a, s, l), e.fillStyle = "black", e.fillText(this.label, r + 5, a + 15); + const s = e.measureText(this.label).width + 10, o = 20; + let r = this.xmin, a = this.ymin - o; + e.fillStyle = "white", [r, a] = this.toCanvasCoordinates(r, a), e.fillRect(r, a, s, o), e.lineWidth = 1, e.strokeStyle = "black", e.strokeRect(r, a, s, o), e.fillStyle = "black", e.fillText(this.label, r + 5, a + 15); } - e.fillStyle = ut(this.color, 1); + e.fillStyle = dt(this.color, 1); for (const s of this.resizeHandles) [t, i] = this.toCanvasCoordinates(s.xmin, s.ymin), e.fillRect( t, @@ -2527,7 +2561,7 @@ class ht { this.resizingHandleIndex = e, this.isResizing = !0, this.offsetMouseX = t.clientX - this.resizeHandles[e].xmin, this.offsetMouseY = t.clientY - this.resizeHandles[e].ymin, document.addEventListener("mousemove", this.handleResize), document.addEventListener("mouseup", this.stopResize); } } -const ce = [ +const de = [ "rgb(255, 168, 77)", "rgb(92, 172, 238)", "rgb(255, 99, 71)", @@ -2542,124 +2576,160 @@ const ce = [ "rgb(255, 193, 7)", "rgb(255, 250, 138)" ], { - SvelteComponent: ml, - append: je, - attr: te, - binding_callbacks: _l, - bubble: $t, - check_outros: mt, - create_component: Je, - destroy_component: Ze, - detach: me, - element: ze, - empty: dl, - group_outros: _t, - init: bl, - insert: _e, - listen: le, - mount_component: Qe, - run_all: bn, - safe_not_equal: gl, - space: Ne, - toggle_class: Oe, - transition_in: I, - transition_out: P -} = window.__gradio__svelte__internal, { onMount: wl, onDestroy: yl, createEventDispatcher: vl } = window.__gradio__svelte__internal; -function en(n) { - let e, t, i, s, l, r, a, o, u; - return i = new jn({}), r = new Zn({}), { + SvelteComponent: Bl, + append: Ee, + attr: J, + binding_callbacks: Al, + bubble: ln, + check_outros: Je, + create_component: Re, + destroy_component: He, + detach: re, + element: ye, + empty: Ml, + group_outros: Ze, + init: Rl, + insert: fe, + listen: se, + mount_component: Xe, + noop: Hl, + run_all: pn, + safe_not_equal: Xl, + space: Me, + toggle_class: Fe, + transition_in: Y, + transition_out: I +} = window.__gradio__svelte__internal, { onMount: Yl, onDestroy: Dl, createEventDispatcher: Ll } = window.__gradio__svelte__internal; +function on(n) { + let e, t, i, s, o, r, a, l, u, c; + i = new Jn({}), r = new si({}); + let f = ( + /*showRemoveButton*/ + n[1] && an(n) + ); + return { c() { - e = ze("span"), t = ze("button"), Je(i.$$.fragment), s = Ne(), l = ze("button"), Je(r.$$.fragment), te(t, "class", "icon svelte-10jprmi"), te(t, "aria-label", "Create box"), Oe( + e = ye("span"), t = ye("button"), Re(i.$$.fragment), s = Me(), o = ye("button"), Re(r.$$.fragment), a = Me(), f && f.c(), J(t, "class", "icon svelte-10jprmi"), J(t, "aria-label", "Create box"), Fe( t, "selected", /*mode*/ - n[7] === /*Mode*/ - n[4].creation - ), te(l, "class", "icon svelte-10jprmi"), te(l, "aria-label", "Edit boxes"), Oe( - l, + n[8] === /*Mode*/ + n[5].creation + ), J(o, "class", "icon svelte-10jprmi"), J(o, "aria-label", "Edit boxes"), Fe( + o, "selected", /*mode*/ - n[7] === /*Mode*/ - n[4].drag - ), te(e, "class", "canvas-control svelte-10jprmi"); + n[8] === /*Mode*/ + n[5].drag + ), J(e, "class", "canvas-control svelte-10jprmi"); }, - m(f, c) { - _e(f, e, c), je(e, t), Qe(i, t, null), je(e, s), je(e, l), Qe(r, l, null), a = !0, o || (u = [ - le( + m(d, g) { + fe(d, e, g), Ee(e, t), Xe(i, t, null), Ee(e, s), Ee(e, o), Xe(r, o, null), Ee(e, a), f && f.m(e, null), l = !0, u || (c = [ + se( t, "click", /*click_handler*/ - n[27] + n[29] ), - le( - l, + se( + o, "click", /*click_handler_1*/ - n[28] + n[30] ) - ], o = !0); + ], u = !0); }, - p(f, c) { - (!a || c[0] & /*mode, Mode*/ - 144) && Oe( + p(d, g) { + (!l || g[0] & /*mode, Mode*/ + 288) && Fe( t, "selected", /*mode*/ - f[7] === /*Mode*/ - f[4].creation - ), (!a || c[0] & /*mode, Mode*/ - 144) && Oe( - l, + d[8] === /*Mode*/ + d[5].creation + ), (!l || g[0] & /*mode, Mode*/ + 288) && Fe( + o, "selected", /*mode*/ - f[7] === /*Mode*/ - f[4].drag - ); + d[8] === /*Mode*/ + d[5].drag + ), /*showRemoveButton*/ + d[1] ? f ? (f.p(d, g), g[0] & /*showRemoveButton*/ + 2 && Y(f, 1)) : (f = an(d), f.c(), Y(f, 1), f.m(e, null)) : f && (Ze(), I(f, 1, 1, () => { + f = null; + }), Je()); + }, + i(d) { + l || (Y(i.$$.fragment, d), Y(r.$$.fragment, d), Y(f), l = !0); + }, + o(d) { + I(i.$$.fragment, d), I(r.$$.fragment, d), I(f), l = !1; + }, + d(d) { + d && re(e), He(i), He(r), f && f.d(), u = !1, pn(c); + } + }; +} +function an(n) { + let e, t, i, s, o; + return t = new hi({}), { + c() { + e = ye("button"), Re(t.$$.fragment), J(e, "class", "icon svelte-10jprmi"), J(e, "aria-label", "Remove boxes"); + }, + m(r, a) { + fe(r, e, a), Xe(t, e, null), i = !0, s || (o = se( + e, + "click", + /*click_handler_2*/ + n[31] + ), s = !0); }, - i(f) { - a || (I(i.$$.fragment, f), I(r.$$.fragment, f), a = !0); + p: Hl, + i(r) { + i || (Y(t.$$.fragment, r), i = !0); }, - o(f) { - P(i.$$.fragment, f), P(r.$$.fragment, f), a = !1; + o(r) { + I(t.$$.fragment, r), i = !1; }, - d(f) { - f && me(e), Ze(i), Ze(r), o = !1, bn(u); + d(r) { + r && re(e), He(t), s = !1, o(); } }; } -function tn(n) { +function rn(n) { let e, t; - return e = new dn({ + return e = new kn({ props: { choices: ( /*choices*/ - n[2] + n[3] ), choicesColors: ( /*choicesColors*/ - n[3] + n[4] ), label: ( /*selectedBox*/ - n[6] >= 0 && /*selectedBox*/ - n[6] < /*value*/ + n[7] >= 0 && /*selectedBox*/ + n[7] < /*value*/ n[0].boxes.length ? ( /*value*/ n[0].boxes[ /*selectedBox*/ - n[6] + n[7] ].label ) : "" ), color: ( /*selectedBox*/ - n[6] >= 0 && /*selectedBox*/ - n[6] < /*value*/ - n[0].boxes.length ? Ee( + n[7] >= 0 && /*selectedBox*/ + n[7] < /*value*/ + n[0].boxes.length ? Ye( /*value*/ n[0].boxes[ /*selectedBox*/ - n[6] + n[7] ].color ) : "" ) @@ -2667,91 +2737,91 @@ function tn(n) { }), e.$on( "change", /*onModalEditChange*/ - n[15] + n[16] ), e.$on( "enter{onModalEditChange}", /*enter_onModalEditChange_handler*/ - n[29] + n[32] ), { c() { - Je(e.$$.fragment); + Re(e.$$.fragment); }, m(i, s) { - Qe(e, i, s), t = !0; + Xe(e, i, s), t = !0; }, p(i, s) { - const l = {}; + const o = {}; s[0] & /*choices*/ - 4 && (l.choices = /*choices*/ - i[2]), s[0] & /*choicesColors*/ - 8 && (l.choicesColors = /*choicesColors*/ - i[3]), s[0] & /*selectedBox, value*/ - 65 && (l.label = /*selectedBox*/ - i[6] >= 0 && /*selectedBox*/ - i[6] < /*value*/ + 8 && (o.choices = /*choices*/ + i[3]), s[0] & /*choicesColors*/ + 16 && (o.choicesColors = /*choicesColors*/ + i[4]), s[0] & /*selectedBox, value*/ + 129 && (o.label = /*selectedBox*/ + i[7] >= 0 && /*selectedBox*/ + i[7] < /*value*/ i[0].boxes.length ? ( /*value*/ i[0].boxes[ /*selectedBox*/ - i[6] + i[7] ].label ) : ""), s[0] & /*selectedBox, value*/ - 65 && (l.color = /*selectedBox*/ - i[6] >= 0 && /*selectedBox*/ - i[6] < /*value*/ - i[0].boxes.length ? Ee( + 129 && (o.color = /*selectedBox*/ + i[7] >= 0 && /*selectedBox*/ + i[7] < /*value*/ + i[0].boxes.length ? Ye( /*value*/ i[0].boxes[ /*selectedBox*/ - i[6] + i[7] ].color - ) : ""), e.$set(l); + ) : ""), e.$set(o); }, i(i) { - t || (I(e.$$.fragment, i), t = !0); + t || (Y(e.$$.fragment, i), t = !0); }, o(i) { - P(e.$$.fragment, i), t = !1; + I(e.$$.fragment, i), t = !1; }, d(i) { - Ze(e, i); + He(e, i); } }; } -function nn(n) { +function fn(n) { let e, t; - return e = new dn({ + return e = new kn({ props: { choices: ( /*choices*/ - n[2] + n[3] ), showRemove: !1, choicesColors: ( /*choicesColors*/ - n[3] + n[4] ), label: ( /*selectedBox*/ - n[6] >= 0 && /*selectedBox*/ - n[6] < /*value*/ + n[7] >= 0 && /*selectedBox*/ + n[7] < /*value*/ n[0].boxes.length ? ( /*value*/ n[0].boxes[ /*selectedBox*/ - n[6] + n[7] ].label ) : "" ), color: ( /*selectedBox*/ - n[6] >= 0 && /*selectedBox*/ - n[6] < /*value*/ - n[0].boxes.length ? Ee( + n[7] >= 0 && /*selectedBox*/ + n[7] < /*value*/ + n[0].boxes.length ? Ye( /*value*/ n[0].boxes[ /*selectedBox*/ - n[6] + n[7] ].color ) : "" ) @@ -2759,355 +2829,361 @@ function nn(n) { }), e.$on( "change", /*onModalNewChange*/ - n[16] + n[17] ), e.$on( "enter{onModalNewChange}", /*enter_onModalNewChange_handler*/ - n[30] + n[33] ), { c() { - Je(e.$$.fragment); + Re(e.$$.fragment); }, m(i, s) { - Qe(e, i, s), t = !0; + Xe(e, i, s), t = !0; }, p(i, s) { - const l = {}; + const o = {}; s[0] & /*choices*/ - 4 && (l.choices = /*choices*/ - i[2]), s[0] & /*choicesColors*/ - 8 && (l.choicesColors = /*choicesColors*/ - i[3]), s[0] & /*selectedBox, value*/ - 65 && (l.label = /*selectedBox*/ - i[6] >= 0 && /*selectedBox*/ - i[6] < /*value*/ + 8 && (o.choices = /*choices*/ + i[3]), s[0] & /*choicesColors*/ + 16 && (o.choicesColors = /*choicesColors*/ + i[4]), s[0] & /*selectedBox, value*/ + 129 && (o.label = /*selectedBox*/ + i[7] >= 0 && /*selectedBox*/ + i[7] < /*value*/ i[0].boxes.length ? ( /*value*/ i[0].boxes[ /*selectedBox*/ - i[6] + i[7] ].label ) : ""), s[0] & /*selectedBox, value*/ - 65 && (l.color = /*selectedBox*/ - i[6] >= 0 && /*selectedBox*/ - i[6] < /*value*/ - i[0].boxes.length ? Ee( + 129 && (o.color = /*selectedBox*/ + i[7] >= 0 && /*selectedBox*/ + i[7] < /*value*/ + i[0].boxes.length ? Ye( /*value*/ i[0].boxes[ /*selectedBox*/ - i[6] + i[7] ].color - ) : ""), e.$set(l); + ) : ""), e.$set(o); }, i(i) { - t || (I(e.$$.fragment, i), t = !0); + t || (Y(e.$$.fragment, i), t = !0); }, o(i) { - P(e.$$.fragment, i), t = !1; + I(e.$$.fragment, i), t = !1; }, d(i) { - Ze(e, i); + He(e, i); } }; } -function kl(n) { - let e, t, i, s, l, r, a, o, u, f = ( +function Tl(n) { + let e, t, i, s, o, r, a, l, u, c = ( /*interactive*/ - n[1] && en(n) - ), c = ( + n[2] && on(n) + ), f = ( /*editModalVisible*/ - n[8] && tn(n) - ), w = ( + n[9] && rn(n) + ), d = ( /*newModalVisible*/ - n[9] && nn(n) + n[10] && fn(n) ); return { c() { - e = ze("div"), t = ze("canvas"), i = Ne(), f && f.c(), s = Ne(), c && c.c(), l = Ne(), w && w.c(), r = dl(), te(t, "class", "canvas-annotator svelte-10jprmi"), te(e, "class", "canvas-container svelte-10jprmi"), te(e, "tabindex", "-1"); + e = ye("div"), t = ye("canvas"), i = Me(), c && c.c(), s = Me(), f && f.c(), o = Me(), d && d.c(), r = Ml(), J(t, "class", "canvas-annotator svelte-10jprmi"), J(e, "class", "canvas-container svelte-10jprmi"), J(e, "tabindex", "-1"); }, - m(g, v) { - _e(g, e, v), je(e, t), n[26](t), _e(g, i, v), f && f.m(g, v), _e(g, s, v), c && c.m(g, v), _e(g, l, v), w && w.m(g, v), _e(g, r, v), a = !0, o || (u = [ - le( + m(g, k) { + fe(g, e, k), Ee(e, t), n[28](t), fe(g, i, k), c && c.m(g, k), fe(g, s, k), f && f.m(g, k), fe(g, o, k), d && d.m(g, k), fe(g, r, k), a = !0, l || (u = [ + se( t, "mousedown", /*handleMouseDown*/ - n[10] + n[11] ), - le( + se( t, "mouseup", /*handleMouseUp*/ - n[11] + n[12] ), - le( + se( t, "dblclick", /*handleDoubleClick*/ - n[14] + n[15] ), - le( + se( e, "focusin", /*handleCanvasFocus*/ - n[17] + n[19] ), - le( + se( e, "focusout", /*handleCanvasBlur*/ - n[18] + n[20] ) - ], o = !0); + ], l = !0); }, - p(g, v) { + p(g, k) { /*interactive*/ - g[1] ? f ? (f.p(g, v), v[0] & /*interactive*/ - 2 && I(f, 1)) : (f = en(g), f.c(), I(f, 1), f.m(s.parentNode, s)) : f && (_t(), P(f, 1, 1, () => { - f = null; - }), mt()), /*editModalVisible*/ - g[8] ? c ? (c.p(g, v), v[0] & /*editModalVisible*/ - 256 && I(c, 1)) : (c = tn(g), c.c(), I(c, 1), c.m(l.parentNode, l)) : c && (_t(), P(c, 1, 1, () => { + g[2] ? c ? (c.p(g, k), k[0] & /*interactive*/ + 4 && Y(c, 1)) : (c = on(g), c.c(), Y(c, 1), c.m(s.parentNode, s)) : c && (Ze(), I(c, 1, 1, () => { c = null; - }), mt()), /*newModalVisible*/ - g[9] ? w ? (w.p(g, v), v[0] & /*newModalVisible*/ - 512 && I(w, 1)) : (w = nn(g), w.c(), I(w, 1), w.m(r.parentNode, r)) : w && (_t(), P(w, 1, 1, () => { - w = null; - }), mt()); + }), Je()), /*editModalVisible*/ + g[9] ? f ? (f.p(g, k), k[0] & /*editModalVisible*/ + 512 && Y(f, 1)) : (f = rn(g), f.c(), Y(f, 1), f.m(o.parentNode, o)) : f && (Ze(), I(f, 1, 1, () => { + f = null; + }), Je()), /*newModalVisible*/ + g[10] ? d ? (d.p(g, k), k[0] & /*newModalVisible*/ + 1024 && Y(d, 1)) : (d = fn(g), d.c(), Y(d, 1), d.m(r.parentNode, r)) : d && (Ze(), I(d, 1, 1, () => { + d = null; + }), Je()); }, i(g) { - a || (I(f), I(c), I(w), a = !0); + a || (Y(c), Y(f), Y(d), a = !0); }, o(g) { - P(f), P(c), P(w), a = !1; + I(c), I(f), I(d), a = !1; }, d(g) { - g && (me(e), me(i), me(s), me(l), me(r)), n[26](null), f && f.d(g), c && c.d(g), w && w.d(g), o = !1, bn(u); + g && (re(e), re(i), re(s), re(o), re(r)), n[28](null), c && c.d(g), f && f.d(g), d && d.d(g), l = !1, pn(u); } }; } -function dt(n) { +function gt(n) { var e = parseInt(n.slice(1, 3), 16), t = parseInt(n.slice(3, 5), 16), i = parseInt(n.slice(5, 7), 16); return "rgb(" + e + ", " + t + ", " + i + ")"; } -function Ee(n) { +function Ye(n) { const e = n.match(/(\d+(\.\d+)?)/g), t = parseInt(e[0]), i = parseInt(e[1]), s = parseInt(e[2]); return "#" + (1 << 24 | t << 16 | i << 8 | s).toString(16).slice(1); } -function pl(n, e, t) { +function ql(n, e, t) { var i; - (function(b) { - b[b.creation = 0] = "creation", b[b.drag = 1] = "drag"; + (function(w) { + w[w.creation = 0] = "creation", w[w.drag = 1] = "drag"; })(i || (i = {})); - let { imageUrl: s = null } = e, { interactive: l } = e, { boxAlpha: r = 0.5 } = e, { boxMinSize: a = 25 } = e, { handleSize: o } = e, { boxThickness: u } = e, { boxSelectedThickness: f } = e, { value: c } = e, { choices: w = [] } = e, { choicesColors: g = [] } = e, { disableEditBoxes: v = !1 } = e, _, d, m = null, y = -1, h = i.drag; - c !== null && c.boxes.length == 0 && (h = i.creation); - let x = 0, p = 0, M = 0, A = 0, C = 1, B = 0, D = 0, G = !1, z = !1; - const U = vl(); - function R() { - if (d) { - d.clearRect(0, 0, _.width, _.height), m !== null && d.drawImage(m, x, p, B, D); - for (const b of c.boxes.slice().reverse()) - b.render(d); + let { imageUrl: s = null } = e, { interactive: o } = e, { boxAlpha: r = 0.5 } = e, { boxMinSize: a = 25 } = e, { handleSize: l } = e, { boxThickness: u } = e, { boxSelectedThickness: c } = e, { value: f } = e, { choices: d = [] } = e, { choicesColors: g = [] } = e, { disableEditBoxes: k = !1 } = e, { showRemoveButton: y = null } = e; + y === null && (y = k); + let m, _, v = null, h = -1, b = i.drag; + f !== null && f.boxes.length == 0 && (b = i.creation); + let p = 0, A = 0, B = 0, C = 0, M = 1, D = 0, V = 0, z = !1, Z = !1; + const N = Ll(); + function j() { + if (_) { + _.clearRect(0, 0, m.width, m.height), v !== null && _.drawImage(v, p, A, D, V); + for (const w of f.boxes.slice().reverse()) + w.render(_); } } - function ne(b) { - t(6, y = b), c.boxes.forEach((E) => { + function le(w) { + t(7, h = w), f.boxes.forEach((E) => { E.setSelected(!1); - }), b >= 0 && b < c.boxes.length && c.boxes[b].setSelected(!0), R(); + }), w >= 0 && w < f.boxes.length && f.boxes[w].setSelected(!0), j(); } - function et(b) { - l && (h === i.creation ? S(b) : h === i.drag && tt(b)); + function st(w) { + o && (b === i.creation ? Bt(w) : b === i.drag && lt(w)); } - function tt(b) { - const E = _.getBoundingClientRect(), Y = b.clientX - E.left, W = b.clientY - E.top; - for (const [j, L] of c.boxes.entries()) { - const At = L.indexOfPointInsideHandle(Y, W); - if (At >= 0) { - ne(j), L.startResize(At, b); + function lt(w) { + const E = m.getBoundingClientRect(), H = w.clientX - E.left, U = w.clientY - E.top; + for (const [W, L] of f.boxes.entries()) { + const Ht = L.indexOfPointInsideHandle(H, U); + if (Ht >= 0) { + le(W), L.startResize(Ht, w); return; } } - for (const [j, L] of c.boxes.entries()) - if (L.isPointInsideBox(Y, W)) { - ne(j), L.startDrag(b); + for (const [W, L] of f.boxes.entries()) + if (L.isPointInsideBox(H, U)) { + le(W), L.startDrag(w); return; } - ne(-1); + le(-1); } - function nt(b) { - U("change"); + function ot(w) { + N("change"); } - function be(b) { - if (l) - switch (b.key) { + function S(w) { + if (o) + switch (w.key) { case "Delete": - He(); + ce(); break; } } - function S(b) { - const E = _.getBoundingClientRect(), Y = (b.clientX - E.left - x) / C, W = (b.clientY - E.top - p) / C; - let j; - g.length > 0 ? j = dt(g[0]) : j = ce[c.boxes.length % ce.length]; - let L = new ht(R, zt, x, p, M, A, "", Y, W, Y, W, j, r, a, o, u, f); - L.startCreating(b, E.left, E.top), t(0, c.boxes = [L, ...c.boxes], c), ne(0), R(), U("change"); + function Bt(w) { + const E = m.getBoundingClientRect(), H = (w.clientX - E.left - p) / M, U = (w.clientY - E.top - A) / M; + let W; + g.length > 0 ? W = gt(g[0]) : W = de[f.boxes.length % de.length]; + let L = new bt(j, Mt, p, A, B, C, "", H, U, H, U, W, r, a, l, u, c); + L.startCreating(w, E.left, E.top), t(0, f.boxes = [L, ...f.boxes], f), le(0), j(), N("change"); } - function it() { - t(7, h = i.creation), t(5, _.style.cursor = "crosshair", _); + function Oe() { + t(8, b = i.creation), t(6, m.style.cursor = "crosshair", m); } - function Ye() { - t(7, h = i.drag), t(5, _.style.cursor = "default", _); + function At() { + t(8, b = i.drag), t(6, m.style.cursor = "default", m); } - function zt() { - y >= 0 && y < c.boxes.length && (c.boxes[y].getArea() < 1 ? He() : v || t(9, z = !0)); + function Mt() { + h >= 0 && h < f.boxes.length && (f.boxes[h].getArea() < 1 ? ce() : k || t(10, Z = !0)); } - function gn() { - y >= 0 && y < c.boxes.length && !v && t(8, G = !0); + function xn() { + h >= 0 && h < f.boxes.length && !k && t(9, z = !0); } - function wn(b) { - l && gn(); + function Cn(w) { + o && xn(); } - function yn(b) { - t(8, G = !1); - const { detail: E } = b; - let Y = E.label, W = E.color, j = E.ret; - if (y >= 0 && y < c.boxes.length) { - let L = c.boxes[y]; - j == 1 ? (L.label = Y, L.color = dt(W), R(), U("change")) : j == -1 && He(); + function Sn(w) { + t(9, z = !1); + const { detail: E } = w; + let H = E.label, U = E.color, W = E.ret; + if (h >= 0 && h < f.boxes.length) { + let L = f.boxes[h]; + W == 1 ? (L.label = H, L.color = gt(U), j(), N("change")) : W == -1 && ce(); } } - function vn(b) { - t(9, z = !1); - const { detail: E } = b; - let Y = E.label, W = E.color, j = E.ret; - if (y >= 0 && y < c.boxes.length) { - let L = c.boxes[y]; - j == 1 ? (L.label = Y, L.color = dt(W), R(), U("change")) : He(); + function zn(w) { + t(10, Z = !1); + const { detail: E } = w; + let H = E.label, U = E.color, W = E.ret; + if (h >= 0 && h < f.boxes.length) { + let L = f.boxes[h]; + W == 1 ? (L.label = H, L.color = gt(U), j(), N("change")) : ce(); } } - function He() { - y >= 0 && y < c.boxes.length && (c.boxes.splice(y, 1), ne(-1), U("change")); + function ce() { + h >= 0 && h < f.boxes.length && (f.boxes.splice(h, 1), le(-1), N("change")); } - function De() { - if (_) { - if (C = 1, t(5, _.width = _.clientWidth, _), m !== null) - if (m.width > _.width) - C = _.width / m.width, B = m.width * C, D = m.height * C, x = 0, p = 0, M = B, A = D, t(5, _.height = D, _); + function Ie() { + if (m) { + if (M = 1, t(6, m.width = m.clientWidth, m), v !== null) + if (v.width > m.width) + M = m.width / v.width, D = v.width * M, V = v.height * M, p = 0, A = 0, B = D, C = V, t(6, m.height = V, m); else { - B = m.width, D = m.height; - var b = (_.width - B) / 2; - x = b, p = 0, M = b + B, A = m.height, t(5, _.height = D, _); + D = v.width, V = v.height; + var w = (m.width - D) / 2; + p = w, A = 0, B = w + D, C = v.height, t(6, m.height = V, m); } else - x = 0, p = 0, M = _.width, A = _.height, t(5, _.height = _.clientHeight, _); - if (M > 0 && A > 0) - for (const E of c.boxes) - E.canvasXmin = x, E.canvasYmin = p, E.canvasXmax = M, E.canvasYmax = A, E.setScaleFactor(C); - R(), U("change"); + p = 0, A = 0, B = m.width, C = m.height, t(6, m.height = m.clientHeight, m); + if (B > 0 && C > 0) + for (const E of f.boxes) + E.canvasXmin = p, E.canvasYmin = A, E.canvasXmax = B, E.canvasYmax = C, E.setScaleFactor(M); + j(), N("change"); } } - const kn = new ResizeObserver(De); - function pn() { - for (let b = 0; b < c.boxes.length; b++) { - let E = c.boxes[b]; - if (!(E instanceof ht)) { - let Y = "", W = ""; - E.hasOwnProperty("color") ? (Y = E.color, Array.isArray(Y) && Y.length === 3 && (Y = `rgb(${Y[0]}, ${Y[1]}, ${Y[2]})`)) : Y = ce[b % ce.length], E.hasOwnProperty("label") && (W = E.label), E = new ht(R, zt, x, p, M, A, W, E.xmin, E.ymin, E.xmax, E.ymax, Y, r, a, o, u, f), t(0, c.boxes[b] = E, c); + const En = new ResizeObserver(Ie); + function Bn() { + for (let w = 0; w < f.boxes.length; w++) { + let E = f.boxes[w]; + if (!(E instanceof bt)) { + let H = "", U = ""; + E.hasOwnProperty("color") ? (H = E.color, Array.isArray(H) && H.length === 3 && (H = `rgb(${H[0]}, ${H[1]}, ${H[2]})`)) : H = de[w % de.length], E.hasOwnProperty("label") && (U = E.label), E = new bt(j, Mt, p, A, B, C, U, E.xmin, E.ymin, E.xmax, E.ymax, H, r, a, l, u, c), t(0, f.boxes[w] = E, f); } } } - function Et() { - s !== null && (m === null || m.src != s) && (m = new Image(), m.src = s, m.onload = function() { - De(), R(); + function Rt() { + s !== null && (v === null || v.src != s) && (v = new Image(), v.src = s, v.onload = function() { + Ie(), j(); }); } - wl(() => { - if (Array.isArray(w) && w.length > 0 && (!Array.isArray(g) || g.length == 0)) - for (let b = 0; b < w.length; b++) { - let E = ce[b % ce.length]; - g.push(Ee(E)); + Yl(() => { + if (Array.isArray(d) && d.length > 0 && (!Array.isArray(g) || g.length == 0)) + for (let w = 0; w < d.length; w++) { + let E = de[w % de.length]; + g.push(Ye(E)); } - d = _.getContext("2d"), kn.observe(_), Et(), De(), R(); + _ = m.getContext("2d"), En.observe(m), Rt(), Ie(), j(); }); - function xn() { - document.addEventListener("keydown", be); + function An() { + document.addEventListener("keydown", S); } - function Cn() { - document.removeEventListener("keydown", be); + function Mn() { + document.removeEventListener("keydown", S); } - yl(() => { - document.removeEventListener("keydown", be); + Dl(() => { + document.removeEventListener("keydown", S); }); - function Sn(b) { - _l[b ? "unshift" : "push"](() => { - _ = b, t(5, _); + function Rn(w) { + Al[w ? "unshift" : "push"](() => { + m = w, t(6, m); }); } - const zn = () => it(), En = () => Ye(); - function An(b) { - $t.call(this, n, b); + const Hn = () => Oe(), Xn = () => At(), Yn = () => ce(); + function Dn(w) { + ln.call(this, n, w); } - function Mn(b) { - $t.call(this, n, b); + function Ln(w) { + ln.call(this, n, w); } - return n.$$set = (b) => { - "imageUrl" in b && t(19, s = b.imageUrl), "interactive" in b && t(1, l = b.interactive), "boxAlpha" in b && t(20, r = b.boxAlpha), "boxMinSize" in b && t(21, a = b.boxMinSize), "handleSize" in b && t(22, o = b.handleSize), "boxThickness" in b && t(23, u = b.boxThickness), "boxSelectedThickness" in b && t(24, f = b.boxSelectedThickness), "value" in b && t(0, c = b.value), "choices" in b && t(2, w = b.choices), "choicesColors" in b && t(3, g = b.choicesColors), "disableEditBoxes" in b && t(25, v = b.disableEditBoxes); + return n.$$set = (w) => { + "imageUrl" in w && t(21, s = w.imageUrl), "interactive" in w && t(2, o = w.interactive), "boxAlpha" in w && t(22, r = w.boxAlpha), "boxMinSize" in w && t(23, a = w.boxMinSize), "handleSize" in w && t(24, l = w.handleSize), "boxThickness" in w && t(25, u = w.boxThickness), "boxSelectedThickness" in w && t(26, c = w.boxSelectedThickness), "value" in w && t(0, f = w.value), "choices" in w && t(3, d = w.choices), "choicesColors" in w && t(4, g = w.choicesColors), "disableEditBoxes" in w && t(27, k = w.disableEditBoxes), "showRemoveButton" in w && t(1, y = w.showRemoveButton); }, n.$$.update = () => { n.$$.dirty[0] & /*value*/ - 1 && (Et(), pn(), De(), R()); + 1 && (Rt(), Bn(), Ie(), j()); }, [ - c, - l, - w, + f, + y, + o, + d, g, i, - _, - y, + m, h, - G, + b, z, - et, - nt, - it, - Ye, - wn, - yn, - vn, - xn, + Z, + st, + ot, + Oe, + At, Cn, + Sn, + zn, + ce, + An, + Mn, s, r, a, - o, + l, u, - f, - v, - Sn, - zn, - En, - An, - Mn + c, + k, + Rn, + Hn, + Xn, + Yn, + Dn, + Ln ]; } -class xl extends ml { +class Ol extends Bl { constructor(e) { - super(), bl( + super(), Rl( this, e, - pl, - kl, - gl, + ql, + Tl, + Xl, { - imageUrl: 19, - interactive: 1, - boxAlpha: 20, - boxMinSize: 21, - handleSize: 22, - boxThickness: 23, - boxSelectedThickness: 24, + imageUrl: 21, + interactive: 2, + boxAlpha: 22, + boxMinSize: 23, + handleSize: 24, + boxThickness: 25, + boxSelectedThickness: 26, value: 0, - choices: 2, - choicesColors: 3, - disableEditBoxes: 25 + choices: 3, + choicesColors: 4, + disableEditBoxes: 27, + showRemoveButton: 1 }, null, [-1, -1] @@ -3115,24 +3191,24 @@ class xl extends ml { } } const { - SvelteComponent: Cl, - add_flush_callback: Sl, - bind: zl, - binding_callbacks: El, - create_component: Al, - destroy_component: Ml, - init: Bl, - mount_component: Xl, - safe_not_equal: Yl, - transition_in: Hl, - transition_out: Dl -} = window.__gradio__svelte__internal, { createEventDispatcher: Rl } = window.__gradio__svelte__internal; -function Ll(n) { + SvelteComponent: Il, + add_flush_callback: jl, + bind: Ul, + binding_callbacks: Wl, + create_component: Vl, + destroy_component: Nl, + init: Fl, + mount_component: Pl, + safe_not_equal: Kl, + transition_in: Gl, + transition_out: Jl +} = window.__gradio__svelte__internal, { createEventDispatcher: Zl } = window.__gradio__svelte__internal; +function Ql(n) { let e, t, i; function s(r) { - n[14](r); + n[15](r); } - let l = { + let o = { interactive: ( /*interactive*/ n[1] @@ -3169,104 +3245,111 @@ function Ll(n) { /*disableEditBoxes*/ n[9] ), + showRemoveButton: ( + /*showRemoveButton*/ + n[10] + ), imageUrl: ( /*resolved_src*/ - n[10] + n[11] ) }; return ( /*value*/ - n[0] !== void 0 && (l.value = /*value*/ - n[0]), e = new xl({ props: l }), El.push(() => zl(e, "value", s)), e.$on( + n[0] !== void 0 && (o.value = /*value*/ + n[0]), e = new Ol({ props: o }), Wl.push(() => Ul(e, "value", s)), e.$on( "change", /*change_handler*/ - n[15] + n[16] ), { c() { - Al(e.$$.fragment); + Vl(e.$$.fragment); }, m(r, a) { - Xl(e, r, a), i = !0; + Pl(e, r, a), i = !0; }, p(r, [a]) { - const o = {}; + const l = {}; a & /*interactive*/ - 2 && (o.interactive = /*interactive*/ + 2 && (l.interactive = /*interactive*/ r[1]), a & /*boxesAlpha*/ - 4 && (o.boxAlpha = /*boxesAlpha*/ + 4 && (l.boxAlpha = /*boxesAlpha*/ r[2]), a & /*labelList*/ - 8 && (o.choices = /*labelList*/ + 8 && (l.choices = /*labelList*/ r[3]), a & /*labelColors*/ - 16 && (o.choicesColors = /*labelColors*/ + 16 && (l.choicesColors = /*labelColors*/ r[4]), a & /*boxMinSize*/ - 32 && (o.boxMinSize = /*boxMinSize*/ + 32 && (l.boxMinSize = /*boxMinSize*/ r[5]), a & /*handleSize*/ - 64 && (o.handleSize = /*handleSize*/ + 64 && (l.handleSize = /*handleSize*/ r[6]), a & /*boxThickness*/ - 128 && (o.boxThickness = /*boxThickness*/ + 128 && (l.boxThickness = /*boxThickness*/ r[7]), a & /*boxSelectedThickness*/ - 256 && (o.boxSelectedThickness = /*boxSelectedThickness*/ + 256 && (l.boxSelectedThickness = /*boxSelectedThickness*/ r[8]), a & /*disableEditBoxes*/ - 512 && (o.disableEditBoxes = /*disableEditBoxes*/ - r[9]), a & /*resolved_src*/ - 1024 && (o.imageUrl = /*resolved_src*/ - r[10]), !t && a & /*value*/ - 1 && (t = !0, o.value = /*value*/ - r[0], Sl(() => t = !1)), e.$set(o); + 512 && (l.disableEditBoxes = /*disableEditBoxes*/ + r[9]), a & /*showRemoveButton*/ + 1024 && (l.showRemoveButton = /*showRemoveButton*/ + r[10]), a & /*resolved_src*/ + 2048 && (l.imageUrl = /*resolved_src*/ + r[11]), !t && a & /*value*/ + 1 && (t = !0, l.value = /*value*/ + r[0], jl(() => t = !1)), e.$set(l); }, i(r) { - i || (Hl(e.$$.fragment, r), i = !0); + i || (Gl(e.$$.fragment, r), i = !0); }, o(r) { - Dl(e.$$.fragment, r), i = !1; + Jl(e.$$.fragment, r), i = !1; }, d(r) { - Ml(e, r); + Nl(e, r); } } ); } -function Tl(n, e, t) { - let { src: i = void 0 } = e, { interactive: s } = e, { boxesAlpha: l } = e, { labelList: r } = e, { labelColors: a } = e, { boxMinSize: o } = e, { handleSize: u } = e, { boxThickness: f } = e, { boxSelectedThickness: c } = e, { value: w } = e, { disableEditBoxes: g } = e, v, _; - const d = Rl(); - function m(h) { - w = h, t(0, w); +function $l(n, e, t) { + let { src: i = void 0 } = e, { interactive: s } = e, { boxesAlpha: o } = e, { labelList: r } = e, { labelColors: a } = e, { boxMinSize: l } = e, { handleSize: u } = e, { boxThickness: c } = e, { boxSelectedThickness: f } = e, { value: d } = e, { disableEditBoxes: g } = e, { showRemoveButton: k } = e, y, m; + const _ = Zl(); + function v(b) { + d = b, t(0, d); } - const y = () => d("change"); - return n.$$set = (h) => { - "src" in h && t(12, i = h.src), "interactive" in h && t(1, s = h.interactive), "boxesAlpha" in h && t(2, l = h.boxesAlpha), "labelList" in h && t(3, r = h.labelList), "labelColors" in h && t(4, a = h.labelColors), "boxMinSize" in h && t(5, o = h.boxMinSize), "handleSize" in h && t(6, u = h.handleSize), "boxThickness" in h && t(7, f = h.boxThickness), "boxSelectedThickness" in h && t(8, c = h.boxSelectedThickness), "value" in h && t(0, w = h.value), "disableEditBoxes" in h && t(9, g = h.disableEditBoxes); + const h = () => _("change"); + return n.$$set = (b) => { + "src" in b && t(13, i = b.src), "interactive" in b && t(1, s = b.interactive), "boxesAlpha" in b && t(2, o = b.boxesAlpha), "labelList" in b && t(3, r = b.labelList), "labelColors" in b && t(4, a = b.labelColors), "boxMinSize" in b && t(5, l = b.boxMinSize), "handleSize" in b && t(6, u = b.handleSize), "boxThickness" in b && t(7, c = b.boxThickness), "boxSelectedThickness" in b && t(8, f = b.boxSelectedThickness), "value" in b && t(0, d = b.value), "disableEditBoxes" in b && t(9, g = b.disableEditBoxes), "showRemoveButton" in b && t(10, k = b.showRemoveButton); }, n.$$.update = () => { if (n.$$.dirty & /*src, latest_src*/ - 12288) { - t(10, v = i), t(13, _ = i); - const h = i; - Ln(h).then((x) => { - _ === h && t(10, v = x); + 24576) { + t(11, y = i), t(14, m = i); + const b = i; + Wn(b).then((p) => { + m === b && t(11, y = p); }); } }, [ - w, + d, s, - l, + o, r, a, - o, + l, u, - f, c, + f, g, - v, - d, - i, + k, + y, _, + i, m, - y + v, + h ]; } -class ql extends Cl { +class eo extends Il { constructor(e) { - super(), Bl(this, e, Tl, Ll, Yl, { - src: 12, + super(), Fl(this, e, $l, Ql, Kl, { + src: 13, interactive: 1, boxesAlpha: 2, labelList: 3, @@ -3276,30 +3359,31 @@ class ql extends Cl { boxThickness: 7, boxSelectedThickness: 8, value: 0, - disableEditBoxes: 9 + disableEditBoxes: 9, + showRemoveButton: 10 }); } } const { - SvelteComponent: Ol, - attr: Il, - check_outros: Ul, - create_component: Wl, - destroy_component: jl, - detach: Nl, - element: Vl, - group_outros: Fl, - init: Pl, - insert: Kl, - mount_component: Gl, - safe_not_equal: Jl, - toggle_class: Q, - transition_in: Ve, - transition_out: pt + SvelteComponent: to, + attr: no, + check_outros: io, + create_component: so, + destroy_component: lo, + detach: oo, + element: ao, + group_outros: ro, + init: fo, + insert: co, + mount_component: uo, + safe_not_equal: ho, + toggle_class: te, + transition_in: Qe, + transition_out: Ct } = window.__gradio__svelte__internal; -function sn(n) { +function cn(n) { let e, t; - return e = new ql({ + return e = new eo({ props: { src: ( /*samples_dir*/ @@ -3310,86 +3394,86 @@ function sn(n) { } }), { c() { - Wl(e.$$.fragment); + so(e.$$.fragment); }, m(i, s) { - Gl(e, i, s), t = !0; + uo(e, i, s), t = !0; }, p(i, s) { - const l = {}; + const o = {}; s & /*samples_dir, value*/ - 3 && (l.src = /*samples_dir*/ + 3 && (o.src = /*samples_dir*/ i[1] + /*value*/ - i[0].path), e.$set(l); + i[0].path), e.$set(o); }, i(i) { - t || (Ve(e.$$.fragment, i), t = !0); + t || (Qe(e.$$.fragment, i), t = !0); }, o(i) { - pt(e.$$.fragment, i), t = !1; + Ct(e.$$.fragment, i), t = !1; }, d(i) { - jl(e, i); + lo(e, i); } }; } -function Zl(n) { +function mo(n) { let e, t, i = ( /*value*/ - n[0] && sn(n) + n[0] && cn(n) ); return { c() { - e = Vl("div"), i && i.c(), Il(e, "class", "container svelte-1sgcyba"), Q( + e = ao("div"), i && i.c(), no(e, "class", "container svelte-1sgcyba"), te( e, "table", /*type*/ n[2] === "table" - ), Q( + ), te( e, "gallery", /*type*/ n[2] === "gallery" - ), Q( + ), te( e, "selected", /*selected*/ n[3] - ), Q( + ), te( e, "border", /*value*/ n[0] ); }, - m(s, l) { - Kl(s, e, l), i && i.m(e, null), t = !0; + m(s, o) { + co(s, e, o), i && i.m(e, null), t = !0; }, - p(s, [l]) { + p(s, [o]) { /*value*/ - s[0] ? i ? (i.p(s, l), l & /*value*/ - 1 && Ve(i, 1)) : (i = sn(s), i.c(), Ve(i, 1), i.m(e, null)) : i && (Fl(), pt(i, 1, 1, () => { + s[0] ? i ? (i.p(s, o), o & /*value*/ + 1 && Qe(i, 1)) : (i = cn(s), i.c(), Qe(i, 1), i.m(e, null)) : i && (ro(), Ct(i, 1, 1, () => { i = null; - }), Ul()), (!t || l & /*type*/ - 4) && Q( + }), io()), (!t || o & /*type*/ + 4) && te( e, "table", /*type*/ s[2] === "table" - ), (!t || l & /*type*/ - 4) && Q( + ), (!t || o & /*type*/ + 4) && te( e, "gallery", /*type*/ s[2] === "gallery" - ), (!t || l & /*selected*/ - 8) && Q( + ), (!t || o & /*selected*/ + 8) && te( e, "selected", /*selected*/ s[3] - ), (!t || l & /*value*/ - 1) && Q( + ), (!t || o & /*value*/ + 1) && te( e, "border", /*value*/ @@ -3397,25 +3481,25 @@ function Zl(n) { ); }, i(s) { - t || (Ve(i), t = !0); + t || (Qe(i), t = !0); }, o(s) { - pt(i), t = !1; + Ct(i), t = !1; }, d(s) { - s && Nl(e), i && i.d(); + s && oo(e), i && i.d(); } }; } -function Ql(n, e, t) { - let { value: i } = e, { samples_dir: s } = e, { type: l } = e, { selected: r = !1 } = e; +function _o(n, e, t) { + let { value: i } = e, { samples_dir: s } = e, { type: o } = e, { selected: r = !1 } = e; return n.$$set = (a) => { - "value" in a && t(0, i = a.value), "samples_dir" in a && t(1, s = a.samples_dir), "type" in a && t(2, l = a.type), "selected" in a && t(3, r = a.selected); - }, [i, s, l, r]; + "value" in a && t(0, i = a.value), "samples_dir" in a && t(1, s = a.samples_dir), "type" in a && t(2, o = a.type), "selected" in a && t(3, r = a.selected); + }, [i, s, o, r]; } -class eo extends Ol { +class go extends to { constructor(e) { - super(), Pl(this, e, Ql, Zl, Jl, { + super(), fo(this, e, _o, mo, ho, { value: 0, samples_dir: 1, type: 2, @@ -3424,5 +3508,5 @@ class eo extends Ol { } } export { - eo as default + go as default };