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,423 +1,390 @@ -const { setContext: io, getContext: At } = window.__gradio__svelte__internal, Bt = "WORKER_PROXY_CONTEXT_KEY"; -function Dt() { - return At(Bt); -} -function Ht(t) { - return t.host === window.location.host || t.host === "localhost:7860" || t.host === "127.0.0.1:7860" || // Ref: https://github.com/gradio-app/gradio/blob/v3.32.0/js/app/src/Index.svelte#L194 - t.host === "lite.local"; -} -function Tt(t, e) { - const n = e.toLowerCase(); - for (const [i, l] of Object.entries(t)) - if (i.toLowerCase() === n) - return l; -} -function qt(t) { - if (t == null) +const { setContext: $l, getContext: Bn } = window.__gradio__svelte__internal, Xn = "WORKER_PROXY_CONTEXT_KEY"; +function Yn() { + return Bn(Xn); +} +function Hn(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) { + const t = e.toLowerCase(); + for (const [i, s] of Object.entries(n)) + if (i.toLowerCase() === t) + return s; +} +function Rn(n) { + if (n == null) return !1; - const e = new URL(t, window.location.href); - return !(!Ht(e) || e.protocol !== "http:" && e.protocol !== "https:"); + const e = new URL(n, window.location.href); + return !(!Hn(e) || e.protocol !== "http:" && e.protocol !== "https:"); } -async function Lt(t) { - if (t == null || !qt(t)) - return t; - const e = Dt(); +async function Ln(n) { + if (n == null || !Rn(n)) + return n; + const e = Yn(); if (e == null) - return t; - const i = new URL(t, window.location.href).pathname; + return n; + const i = new URL(n, window.location.href).pathname; return e.httpRequest({ method: "GET", path: i, headers: {}, query_string: "" - }).then((l) => { - if (l.status !== 200) + }).then((s) => { + if (s.status !== 200) throw new Error(`Failed to get file ${i} from the Wasm worker.`); - const a = new Blob([l.body], { - type: Tt(l.headers, "content-type") + const l = new Blob([s.body], { + type: Dn(s.headers, "content-type") }); - return URL.createObjectURL(a); + return URL.createObjectURL(l); }); } const { - SvelteComponent: Rt, - append: tn, - attr: U, - detach: Xt, - init: Yt, - insert: Ot, - noop: ln, - safe_not_equal: It, - set_style: P, - svg_element: He + SvelteComponent: Tn, + append: J, + attr: k, + detach: qn, + init: On, + insert: In, + noop: st, + safe_not_equal: Un, + set_style: Z, + svg_element: K } = window.__gradio__svelte__internal; -function jt(t) { - let e, n, i, l; +function Wn(n) { + let e, t, i, s, l, r, a, o, u; return { c() { - e = He("svg"), n = He("g"), i = He("path"), l = He("path"), U(i, "d", "M18,6L6.087,17.913"), P(i, "fill", "none"), P(i, "fill-rule", "nonzero"), P(i, "stroke-width", "2px"), U(n, "transform", "matrix(1.14096,-0.140958,-0.140958,1.14096,-0.0559523,0.0559523)"), U(l, "d", "M4.364,4.364L19.636,19.636"), P(l, "fill", "none"), P(l, "fill-rule", "nonzero"), P(l, "stroke-width", "2px"), U(e, "width", "100%"), U(e, "height", "100%"), U(e, "viewBox", "0 0 24 24"), U(e, "version", "1.1"), U(e, "xmlns", "http://www.w3.org/2000/svg"), U(e, "xmlns:xlink", "http://www.w3.org/1999/xlink"), U(e, "xml:space", "preserve"), U(e, "stroke", "currentColor"), P(e, "fill-rule", "evenodd"), P(e, "clip-rule", "evenodd"), P(e, "stroke-linecap", "round"), P(e, "stroke-linejoin", "round"); + 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"); }, - m(a, r) { - Ot(a, e, r), tn(e, n), tn(n, i), tn(e, l); + 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); }, - p: ln, - i: ln, - o: ln, - d(a) { - a && Xt(e); - } - }; -} -class Ut extends Rt { - constructor(e) { - super(), Yt(this, e, null, jt, It, {}); - } -} -const { - SvelteComponent: Wt, - append: Nt, - attr: oe, - detach: Ft, - init: Pt, - insert: Kt, - noop: sn, - safe_not_equal: Vt, - svg_element: Mn -} = window.__gradio__svelte__internal; -function Gt(t) { - let e, n; - return { - c() { - e = Mn("svg"), n = Mn("path"), oe(n, "d", "M5 8l4 4 4-4z"), oe(e, "class", "dropdown-arrow svelte-145leq6"), oe(e, "xmlns", "http://www.w3.org/2000/svg"), oe(e, "width", "100%"), oe(e, "height", "100%"), oe(e, "viewBox", "0 0 18 18"); - }, - m(i, l) { - Kt(i, e, l), Nt(e, n); - }, - p: sn, - i: sn, - o: sn, - d(i) { - i && Ft(e); + p: st, + i: st, + o: st, + d(f) { + f && qn(e); } }; } -class Jt extends Wt { +class jn extends Tn { constructor(e) { - super(), Pt(this, e, null, Gt, Vt, {}); + super(), On(this, e, null, Wn, Un, {}); } } const { - SvelteComponent: Qt, - append: Zt, - attr: W, - detach: $t, - init: ei, - insert: ni, - noop: on, - safe_not_equal: ti, - svg_element: An + SvelteComponent: Nn, + append: Vn, + attr: N, + detach: Fn, + init: Pn, + insert: Kn, + noop: lt, + safe_not_equal: Gn, + set_style: Re, + svg_element: Mt } = window.__gradio__svelte__internal; -function ii(t) { - let e, n; +function Jn(n) { + let e, t; return { c() { - e = An("svg"), n = An("path"), W(n, "d", "M17 3a2.828 2.828 0 1 1 4 4L7.5 20.5 2 22l1.5-5.5L17 3z"), W(e, "xmlns", "http://www.w3.org/2000/svg"), W(e, "width", "100%"), W(e, "height", "100%"), W(e, "viewBox", "0 0 24 24"), W(e, "fill", "none"), W(e, "stroke", "currentColor"), W(e, "stroke-width", "1.5"), W(e, "stroke-linecap", "round"), W(e, "stroke-linejoin", "round"), W(e, "class", "feather feather-edit-2"); + 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"); }, - m(i, l) { - ni(i, e, l), Zt(e, n); + m(i, s) { + Kn(i, e, s), Vn(e, t); }, - p: on, - i: on, - o: on, + p: lt, + i: lt, + o: lt, d(i) { - i && $t(e); - } - }; -} -class li extends Qt { - constructor(e) { - super(), ei(this, e, null, ii, ti, {}); - } -} -const { - SvelteComponent: si, - append: Bn, - attr: T, - detach: oi, - init: ai, - insert: ri, - noop: an, - safe_not_equal: fi, - set_style: Q, - svg_element: rn -} = window.__gradio__svelte__internal; -function ci(t) { - let e, n, i; - return { - c() { - e = rn("svg"), n = rn("line"), i = rn("line"), T(n, "x1", "4"), T(n, "y1", "12"), T(n, "x2", "20"), T(n, "y2", "12"), Q(n, "fill", "none"), Q(n, "stroke-width", "2px"), T(i, "x1", "12"), T(i, "y1", "4"), T(i, "x2", "12"), T(i, "y2", "20"), Q(i, "fill", "none"), Q(i, "stroke-width", "2px"), T(e, "width", "100%"), T(e, "height", "100%"), T(e, "viewBox", "0 0 24 24"), T(e, "version", "1.1"), T(e, "xmlns", "http://www.w3.org/2000/svg"), T(e, "xmlns:xlink", "http://www.w3.org/1999/xlink"), T(e, "xml:space", "preserve"), T(e, "stroke", "currentColor"), Q(e, "fill-rule", "evenodd"), Q(e, "clip-rule", "evenodd"), Q(e, "stroke-linecap", "round"), Q(e, "stroke-linejoin", "round"); - }, - m(l, a) { - ri(l, e, a), Bn(e, n), Bn(e, i); - }, - p: an, - i: an, - o: an, - d(l) { - l && oi(e); + i && Fn(e); } }; } -class ui extends si { +class Zn extends Nn { constructor(e) { - super(), ai(this, e, null, ci, fi, {}); + super(), Pn(this, e, null, Jn, Gn, {}); } } const { - SvelteComponent: hi, - attr: _i, - create_slot: di, - detach: mi, - element: bi, - get_all_dirty_from_scope: gi, - get_slot_changes: wi, - init: ki, - insert: pi, - safe_not_equal: vi, - transition_in: yi, - transition_out: Ci, - update_slot_base: Si + 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 } = window.__gradio__svelte__internal; -function zi(t) { - let e, n; +function ui(n) { + let e, t; const i = ( /*#slots*/ - t[1].default - ), l = di( + n[1].default + ), s = ei( i, - t, + n, /*$$scope*/ - t[0], + n[0], null ); return { c() { - e = bi("div"), l && l.c(), _i(e, "class", "svelte-1hnfib2"); + e = ni("div"), s && s.c(), $n(e, "class", "svelte-1hnfib2"); }, - m(a, r) { - pi(a, e, r), l && l.m(e, null), n = !0; + m(l, r) { + oi(l, e, r), s && s.m(e, null), t = !0; }, - p(a, [r]) { - l && l.p && (!n || r & /*$$scope*/ - 1) && Si( - l, + p(l, [r]) { + s && s.p && (!t || r & /*$$scope*/ + 1) && ci( + s, i, - a, + l, /*$$scope*/ - a[0], - n ? wi( + l[0], + t ? si( i, /*$$scope*/ - a[0], + l[0], r, null - ) : gi( + ) : ii( /*$$scope*/ - a[0] + l[0] ), null ); }, - i(a) { - n || (yi(l, a), n = !0); + i(l) { + t || (ri(s, l), t = !0); }, - o(a) { - Ci(l, a), n = !1; + o(l) { + fi(s, l), t = !1; }, - d(a) { - a && mi(e), l && l.d(a); + d(l) { + l && ti(e), s && s.d(l); } }; } -function xi(t, e, n) { - let { $$slots: i = {}, $$scope: l } = e; - return t.$$set = (a) => { - "$$scope" in a && n(0, l = a.$$scope); - }, [l, i]; +function hi(n, e, t) { + let { $$slots: i = {}, $$scope: s } = e; + return n.$$set = (l) => { + "$$scope" in l && t(0, s = l.$$scope); + }, [s, i]; } -class Ei extends hi { +class mi extends Qn { constructor(e) { - super(), ki(this, e, xi, zi, vi, {}); + super(), li(this, e, hi, ui, ai, {}); } } const { - SvelteComponent: Mi, - attr: Dn, - check_outros: Ai, - create_component: Bi, - create_slot: Di, - destroy_component: Hi, - detach: je, - element: Ti, - empty: qi, - get_all_dirty_from_scope: Li, - get_slot_changes: Ri, - group_outros: Xi, - init: Yi, + 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: Oi, - safe_not_equal: Ii, - set_data: ji, - space: Ui, - text: Wi, - toggle_class: ae, - transition_in: be, + 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: Ni + update_slot_base: Bi } = window.__gradio__svelte__internal; -function Hn(t) { - let e, n; - return e = new Ei({ +function Xt(n) { + let e, t; + return e = new mi({ props: { - $$slots: { default: [Fi] }, - $$scope: { ctx: t } + $$slots: { default: [Xi] }, + $$scope: { ctx: n } } }), { c() { - Bi(e.$$.fragment); + bi(e.$$.fragment); }, - m(i, l) { - Oi(e, i, l), n = !0; + m(i, s) { + Si(e, i, s), t = !0; }, - p(i, l) { - const a = {}; - l & /*$$scope, info*/ - 10 && (a.$$scope = { dirty: l, ctx: i }), e.$set(a); + p(i, s) { + const l = {}; + s & /*$$scope, info*/ + 10 && (l.$$scope = { dirty: s, ctx: i }), e.$set(l); }, i(i) { - n || (be(e.$$.fragment, i), n = !0); + t || (we(e.$$.fragment, i), t = !0); }, o(i) { - We(e.$$.fragment, i), n = !1; + We(e.$$.fragment, i), t = !1; }, d(i) { - Hi(e, i); + wi(e, i); } }; } -function Fi(t) { +function Xi(n) { let e; return { c() { - e = Wi( + e = Mi( /*info*/ - t[1] + n[1] ); }, - m(n, i) { - Ue(n, e, i); + m(t, i) { + Ue(t, e, i); }, - p(n, i) { + p(t, i) { i & /*info*/ - 2 && ji( + 2 && Ei( e, /*info*/ - n[1] + t[1] ); }, - d(n) { - n && je(e); + d(t) { + t && Ie(e); } }; } -function Pi(t) { - let e, n, i, l; - const a = ( +function Yi(n) { + let e, t, i, s; + const l = ( /*#slots*/ - t[2].default - ), r = Di( - a, - t, + n[2].default + ), r = gi( + l, + n, /*$$scope*/ - t[3], + n[3], null ); - let o = ( + let a = ( /*info*/ - t[1] && Hn(t) + n[1] && Xt(n) ); return { c() { - e = Ti("span"), r && r.c(), n = Ui(), o && o.c(), i = qi(), Dn(e, "data-testid", "block-info"), Dn(e, "class", "svelte-22c38v"), ae(e, "sr-only", !/*show_label*/ - t[0]), ae(e, "hide", !/*show_label*/ - t[0]), ae( + 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, "has-info", /*info*/ - t[1] != null + n[1] != null ); }, - m(s, c) { - Ue(s, e, c), r && r.m(e, null), Ue(s, n, c), o && o.m(s, c), Ue(s, i, c), l = !0; + 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; }, - p(s, [c]) { - r && r.p && (!l || c & /*$$scope*/ - 8) && Ni( + p(o, [u]) { + r && r.p && (!s || u & /*$$scope*/ + 8) && Bi( r, - a, - s, + l, + o, /*$$scope*/ - s[3], - l ? Ri( - a, + o[3], + s ? pi( + l, /*$$scope*/ - s[3], - c, + o[3], + u, null - ) : Li( + ) : ki( /*$$scope*/ - s[3] + o[3] ), null - ), (!l || c & /*show_label*/ - 1) && ae(e, "sr-only", !/*show_label*/ - s[0]), (!l || c & /*show_label*/ - 1) && ae(e, "hide", !/*show_label*/ - s[0]), (!l || c & /*info*/ - 2) && ae( + ), (!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( e, "has-info", /*info*/ - s[1] != null + o[1] != null ), /*info*/ - s[1] ? o ? (o.p(s, c), c & /*info*/ - 2 && be(o, 1)) : (o = Hn(s), o.c(), be(o, 1), o.m(i.parentNode, i)) : o && (Xi(), We(o, 1, 1, () => { - o = null; - }), Ai()); + 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, () => { + a = null; + }), di()); }, - i(s) { - l || (be(r, s), be(o), l = !0); + i(o) { + s || (we(r, o), we(a), s = !0); }, - o(s) { - We(r, s), We(o), l = !1; + o(o) { + We(r, o), We(a), s = !1; }, - d(s) { - s && (je(e), je(n), je(i)), r && r.d(s), o && o.d(s); + d(o) { + o && (Ie(e), Ie(t), Ie(i)), r && r.d(o), a && a.d(o); } }; } -function Ki(t, e, n) { - let { $$slots: i = {}, $$scope: l } = e, { show_label: a = !0 } = e, { info: r = void 0 } = e; - return t.$$set = (o) => { - "show_label" in o && n(0, a = o.show_label), "info" in o && n(1, r = o.info), "$$scope" in o && n(3, l = o.$$scope); - }, [a, r, i, l]; +function Hi(n, e, t) { + let { $$slots: i = {}, $$scope: s } = e, { show_label: l = !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]; } -class ot extends Mi { +class ln extends _i { constructor(e) { - super(), Yi(this, e, Ki, Pi, Ii, { show_label: 0, info: 1 }); + super(), Ci(this, e, Hi, Yi, zi, { show_label: 0, info: 1 }); } } -const Vi = [ +const { + SvelteComponent: Di, + append: Ri, + attr: ae, + detach: Li, + init: Ti, + insert: qi, + noop: ot, + safe_not_equal: Oi, + svg_element: Yt +} = window.__gradio__svelte__internal; +function Ii(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"); + }, + m(i, s) { + qi(i, e, s), Ri(e, t); + }, + p: ot, + i: ot, + o: ot, + d(i) { + i && Li(e); + } + }; +} +class Ui extends Di { + constructor(e) { + super(), Ti(this, e, null, Ii, Oi, {}); + } +} +const Wi = [ { color: "red", primary: 600, secondary: 100 }, { color: "green", primary: 600, secondary: 100 }, { color: "blue", primary: 600, secondary: 100 }, @@ -428,7 +395,7 @@ const Vi = [ { color: "cyan", primary: 600, secondary: 100 }, { color: "lime", primary: 500, secondary: 100 }, { color: "pink", primary: 600, secondary: 100 } -], Tn = { +], Ht = { inherit: "inherit", current: "currentColor", transparent: "transparent", @@ -721,174 +688,174 @@ const Vi = [ 950: "#4c0519" } }; -Vi.reduce( - (t, { color: e, primary: n, secondary: i }) => ({ - ...t, +Wi.reduce( + (n, { color: e, primary: t, secondary: i }) => ({ + ...n, [e]: { - primary: Tn[e][n], - secondary: Tn[e][i] + primary: Ht[e][t], + secondary: Ht[e][i] } }), {} ); const { - SvelteComponent: Gi, - append: qn, - attr: fn, - bubble: Ln, - create_component: Ji, - destroy_component: Qi, - detach: at, - element: Rn, - init: Zi, - insert: rt, - listen: cn, - mount_component: $i, - run_all: el, - safe_not_equal: nl, - set_data: tl, - set_input_value: Xn, - space: il, - text: ll, - transition_in: sl, - transition_out: ol -} = window.__gradio__svelte__internal, { createEventDispatcher: al, afterUpdate: rl } = window.__gradio__svelte__internal; -function fl(t) { + 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) { let e; return { c() { - e = ll( + e = Qi( /*label*/ - t[1] + n[1] ); }, - m(n, i) { - rt(n, e, i); + m(t, i) { + an(t, e, i); }, - p(n, i) { + p(t, i) { i & /*label*/ - 2 && tl( + 2 && Ji( e, /*label*/ - n[1] + t[1] ); }, - d(n) { - n && at(e); + d(t) { + t && on(e); } }; } -function cl(t) { - let e, n, i, l, a, r, o; - return n = new ot({ +function ss(n) { + let e, t, i, s, l, r, a; + return t = new ln({ props: { show_label: ( /*show_label*/ - t[4] + n[4] ), info: ( /*info*/ - t[2] + n[2] ), - $$slots: { default: [fl] }, - $$scope: { ctx: t } + $$slots: { default: [is] }, + $$scope: { ctx: n } } }), { c() { - e = Rn("label"), Ji(n.$$.fragment), i = il(), l = Rn("input"), fn(l, "type", "color"), l.disabled = /*disabled*/ - t[3], fn(l, "class", "svelte-16l8u73"), fn(e, "class", "block"); + 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"); }, - m(s, c) { - rt(s, e, c), $i(n, e, null), qn(e, i), qn(e, l), Xn( - l, + m(o, u) { + an(o, e, u), Pi(t, e, null), Dt(e, i), Dt(e, s), Tt( + s, /*value*/ - t[0] - ), a = !0, r || (o = [ - cn( - l, + n[0] + ), l = !0, r || (a = [ + rt( + s, "input", /*input_input_handler*/ - t[8] + n[8] ), - cn( - l, + rt( + s, "focus", /*focus_handler*/ - t[6] + n[6] ), - cn( - l, + rt( + s, "blur", /*blur_handler*/ - t[7] + n[7] ) ], r = !0); }, - p(s, [c]) { + p(o, [u]) { const f = {}; - c & /*show_label*/ + u & /*show_label*/ 16 && (f.show_label = /*show_label*/ - s[4]), c & /*info*/ + o[4]), u & /*info*/ 4 && (f.info = /*info*/ - s[2]), c & /*$$scope, label*/ - 2050 && (f.$$scope = { dirty: c, ctx: s }), n.$set(f), (!a || c & /*disabled*/ - 8) && (l.disabled = /*disabled*/ - s[3]), c & /*value*/ - 1 && Xn( - l, + o[2]), u & /*$$scope, label*/ + 2050 && (f.$$scope = { dirty: u, ctx: o }), t.$set(f), (!l || u & /*disabled*/ + 8) && (s.disabled = /*disabled*/ + o[3]), u & /*value*/ + 1 && Tt( + s, /*value*/ - s[0] + o[0] ); }, - i(s) { - a || (sl(n.$$.fragment, s), a = !0); + i(o) { + l || ($i(t.$$.fragment, o), l = !0); }, - o(s) { - ol(n.$$.fragment, s), a = !1; + o(o) { + es(t.$$.fragment, o), l = !1; }, - d(s) { - s && at(e), Qi(n), r = !1, el(o); + d(o) { + o && on(e), Vi(t), r = !1, Ki(a); } }; } -function ul(t, e, n) { - let { value: i = "#000000" } = e, { value_is_output: l = !1 } = e, { label: a } = e, { info: r = void 0 } = e, { disabled: o = !1 } = e, { show_label: s = !0 } = e; - const c = al(); +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() { - c("change", i), l || c("input"); + u("change", i), s || u("input"); } - rl(() => { - n(5, l = !1); + ns(() => { + t(5, s = !1); }); - function u(d) { - Ln.call(this, t, d); + function c(v) { + Rt.call(this, n, v); } - function b(d) { - Ln.call(this, t, d); + function w(v) { + Rt.call(this, n, v); } function g() { - i = this.value, n(0, i); + i = this.value, t(0, i); } - return t.$$set = (d) => { - "value" in d && n(0, i = d.value), "value_is_output" in d && n(5, l = d.value_is_output), "label" in d && n(1, a = d.label), "info" in d && n(2, r = d.info), "disabled" in d && n(3, o = d.disabled), "show_label" in d && n(4, s = d.show_label); - }, t.$$.update = () => { - t.$$.dirty & /*value*/ + 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); + }, n.$$.update = () => { + n.$$.dirty & /*value*/ 1 && f(); }, [ i, - a, + l, r, + a, o, s, - l, - u, - b, + c, + w, g ]; } -class hl extends Gi { +class os extends ji { constructor(e) { - super(), Zi(this, e, ul, cl, nl, { + super(), Fi(this, e, ls, ss, Gi, { value: 0, value_is_output: 5, label: 1, @@ -898,419 +865,419 @@ class hl extends Gi { }); } } -function Yn(t) { - const e = typeof t == "string" && t.match(/^\s*(-?[\d.]+)([^\s]*)\s*$/); +function qt(n) { + const e = typeof n == "string" && n.match(/^\s*(-?[\d.]+)([^\s]*)\s*$/); return e ? [parseFloat(e[1]), e[2] || "px"] : [ /** @type {number} */ - t, + n, "px" ]; } -function _l(t) { - const e = t - 1; +function as(n) { + const e = n - 1; return e * e * e + 1; } -function On(t, { delay: e = 0, duration: n = 400, easing: i = _l, x: l = 0, y: a = 0, opacity: r = 0 } = {}) { - const o = getComputedStyle(t), s = +o.opacity, c = o.transform === "none" ? "" : o.transform, f = s * (1 - r), [u, b] = Yn(l), [g, d] = Yn(a); +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); return { delay: e, - duration: n, + duration: t, easing: i, - css: (k, _) => ` - transform: ${c} translate(${(1 - k) * u}${b}, ${(1 - k) * g}${d}); - opacity: ${s - f * _}` + css: (_, d) => ` + transform: ${u} translate(${(1 - _) * c}${w}, ${(1 - _) * g}${v}); + opacity: ${o - f * d}` }; } const { - SvelteComponent: dl, - append: ft, - attr: A, - bubble: ml, - check_outros: bl, - create_slot: ct, - detach: xe, - element: Qe, - empty: gl, - get_all_dirty_from_scope: ut, - get_slot_changes: ht, - group_outros: wl, - init: kl, - insert: Ee, - listen: pl, - safe_not_equal: vl, - set_style: L, - space: _t, - src_url_equal: Ke, - toggle_class: he, - transition_in: Ve, - transition_out: Ge, - update_slot_base: dt + 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, + set_style: T, + space: hn, + src_url_equal: Fe, + toggle_class: de, + transition_in: Pe, + transition_out: Ke, + update_slot_base: mn } = window.__gradio__svelte__internal; -function yl(t) { - let e, n, i, l, a, r, o = ( +function bs(n) { + let e, t, i, s, l, r, a = ( /*icon*/ - t[7] && In(t) + n[7] && It(n) ); - const s = ( + const o = ( /*#slots*/ - t[12].default - ), c = ct( - s, - t, + n[12].default + ), u = fn( + o, + n, /*$$scope*/ - t[11], + n[11], null ); return { c() { - e = Qe("button"), o && o.c(), n = _t(), c && c.c(), A(e, "class", i = /*size*/ - t[4] + " " + /*variant*/ - t[3] + " " + /*elem_classes*/ - t[1].join(" ") + " svelte-8huxfn"), A( + e = $e("button"), a && a.c(), t = hn(), u && u.c(), X(e, "class", i = /*size*/ + n[4] + " " + /*variant*/ + n[3] + " " + /*elem_classes*/ + n[1].join(" ") + " svelte-8huxfn"), X( e, "id", /*elem_id*/ - t[0] + n[0] ), e.disabled = /*disabled*/ - t[8], he(e, "hidden", !/*visible*/ - t[2]), L( + n[8], de(e, "hidden", !/*visible*/ + n[2]), T( e, "flex-grow", /*scale*/ - t[9] - ), L( + n[9] + ), T( e, "width", /*scale*/ - t[9] === 0 ? "fit-content" : null - ), L(e, "min-width", typeof /*min_width*/ - t[10] == "number" ? `calc(min(${/*min_width*/ - t[10]}px, 100%))` : null); + n[9] === 0 ? "fit-content" : null + ), T(e, "min-width", typeof /*min_width*/ + n[10] == "number" ? `calc(min(${/*min_width*/ + n[10]}px, 100%))` : null); }, - m(f, u) { - Ee(f, e, u), o && o.m(e, null), ft(e, n), c && c.m(e, null), l = !0, a || (r = pl( + 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( e, "click", /*click_handler*/ - t[13] - ), a = !0); + n[13] + ), l = !0); }, - p(f, u) { + p(f, c) { /*icon*/ - f[7] ? o ? o.p(f, u) : (o = In(f), o.c(), o.m(e, n)) : o && (o.d(1), o = null), c && c.p && (!l || u & /*$$scope*/ - 2048) && dt( - c, - s, + 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( + u, + o, f, /*$$scope*/ f[11], - l ? ht( - s, + s ? un( + o, /*$$scope*/ f[11], - u, + c, null - ) : ut( + ) : cn( /*$$scope*/ f[11] ), null - ), (!l || u & /*size, variant, elem_classes*/ + ), (!s || c & /*size, variant, elem_classes*/ 26 && i !== (i = /*size*/ f[4] + " " + /*variant*/ f[3] + " " + /*elem_classes*/ - f[1].join(" ") + " svelte-8huxfn")) && A(e, "class", i), (!l || u & /*elem_id*/ - 1) && A( + f[1].join(" ") + " svelte-8huxfn")) && X(e, "class", i), (!s || c & /*elem_id*/ + 1) && X( e, "id", /*elem_id*/ f[0] - ), (!l || u & /*disabled*/ + ), (!s || c & /*disabled*/ 256) && (e.disabled = /*disabled*/ - f[8]), (!l || u & /*size, variant, elem_classes, visible*/ - 30) && he(e, "hidden", !/*visible*/ - f[2]), u & /*scale*/ - 512 && L( + f[8]), (!s || c & /*size, variant, elem_classes, visible*/ + 30) && de(e, "hidden", !/*visible*/ + f[2]), c & /*scale*/ + 512 && T( e, "flex-grow", /*scale*/ f[9] - ), u & /*scale*/ - 512 && L( + ), c & /*scale*/ + 512 && T( e, "width", /*scale*/ f[9] === 0 ? "fit-content" : null - ), u & /*min_width*/ - 1024 && L(e, "min-width", typeof /*min_width*/ + ), c & /*min_width*/ + 1024 && T(e, "min-width", typeof /*min_width*/ f[10] == "number" ? `calc(min(${/*min_width*/ f[10]}px, 100%))` : null); }, i(f) { - l || (Ve(c, f), l = !0); + s || (Pe(u, f), s = !0); }, o(f) { - Ge(c, f), l = !1; + Ke(u, f), s = !1; }, d(f) { - f && xe(e), o && o.d(), c && c.d(f), a = !1, r(); + f && Ae(e), a && a.d(), u && u.d(f), l = !1, r(); } }; } -function Cl(t) { - let e, n, i, l, a = ( +function gs(n) { + let e, t, i, s, l = ( /*icon*/ - t[7] && jn(t) + n[7] && Ut(n) ); const r = ( /*#slots*/ - t[12].default - ), o = ct( + n[12].default + ), a = fn( r, - t, + n, /*$$scope*/ - t[11], + n[11], null ); return { c() { - e = Qe("a"), a && a.c(), n = _t(), o && o.c(), A( + e = $e("a"), l && l.c(), t = hn(), a && a.c(), X( e, "href", /*link*/ - t[6] - ), A(e, "rel", "noopener noreferrer"), A( + n[6] + ), X(e, "rel", "noopener noreferrer"), X( e, "aria-disabled", /*disabled*/ - t[8] - ), A(e, "class", i = /*size*/ - t[4] + " " + /*variant*/ - t[3] + " " + /*elem_classes*/ - t[1].join(" ") + " svelte-8huxfn"), A( + n[8] + ), X(e, "class", i = /*size*/ + n[4] + " " + /*variant*/ + n[3] + " " + /*elem_classes*/ + n[1].join(" ") + " svelte-8huxfn"), X( e, "id", /*elem_id*/ - t[0] - ), he(e, "hidden", !/*visible*/ - t[2]), he( + n[0] + ), de(e, "hidden", !/*visible*/ + n[2]), de( e, "disabled", /*disabled*/ - t[8] - ), L( + n[8] + ), T( e, "flex-grow", /*scale*/ - t[9] - ), L( + n[9] + ), T( e, "pointer-events", /*disabled*/ - t[8] ? "none" : null - ), L( + n[8] ? "none" : null + ), T( e, "width", /*scale*/ - t[9] === 0 ? "fit-content" : null - ), L(e, "min-width", typeof /*min_width*/ - t[10] == "number" ? `calc(min(${/*min_width*/ - t[10]}px, 100%))` : null); + n[9] === 0 ? "fit-content" : null + ), T(e, "min-width", typeof /*min_width*/ + n[10] == "number" ? `calc(min(${/*min_width*/ + n[10]}px, 100%))` : null); }, - m(s, c) { - Ee(s, e, c), a && a.m(e, null), ft(e, n), o && o.m(e, null), l = !0; + m(o, u) { + Me(o, e, u), l && l.m(e, null), rn(e, t), a && a.m(e, null), s = !0; }, - p(s, c) { + p(o, u) { /*icon*/ - s[7] ? a ? a.p(s, c) : (a = jn(s), a.c(), a.m(e, n)) : a && (a.d(1), a = null), o && o.p && (!l || c & /*$$scope*/ - 2048) && dt( - o, + 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( + a, r, - s, + o, /*$$scope*/ - s[11], - l ? ht( + o[11], + s ? un( r, /*$$scope*/ - s[11], - c, + o[11], + u, null - ) : ut( + ) : cn( /*$$scope*/ - s[11] + o[11] ), null - ), (!l || c & /*link*/ - 64) && A( + ), (!s || u & /*link*/ + 64) && X( e, "href", /*link*/ - s[6] - ), (!l || c & /*disabled*/ - 256) && A( + o[6] + ), (!s || u & /*disabled*/ + 256) && X( e, "aria-disabled", /*disabled*/ - s[8] - ), (!l || c & /*size, variant, elem_classes*/ + o[8] + ), (!s || u & /*size, variant, elem_classes*/ 26 && i !== (i = /*size*/ - s[4] + " " + /*variant*/ - s[3] + " " + /*elem_classes*/ - s[1].join(" ") + " svelte-8huxfn")) && A(e, "class", i), (!l || c & /*elem_id*/ - 1) && A( + o[4] + " " + /*variant*/ + o[3] + " " + /*elem_classes*/ + o[1].join(" ") + " svelte-8huxfn")) && X(e, "class", i), (!s || u & /*elem_id*/ + 1) && X( e, "id", /*elem_id*/ - s[0] - ), (!l || c & /*size, variant, elem_classes, visible*/ - 30) && he(e, "hidden", !/*visible*/ - s[2]), (!l || c & /*size, variant, elem_classes, disabled*/ - 282) && he( + o[0] + ), (!s || u & /*size, variant, elem_classes, visible*/ + 30) && de(e, "hidden", !/*visible*/ + o[2]), (!s || u & /*size, variant, elem_classes, disabled*/ + 282) && de( e, "disabled", /*disabled*/ - s[8] - ), c & /*scale*/ - 512 && L( + o[8] + ), u & /*scale*/ + 512 && T( e, "flex-grow", /*scale*/ - s[9] - ), c & /*disabled*/ - 256 && L( + o[9] + ), u & /*disabled*/ + 256 && T( e, "pointer-events", /*disabled*/ - s[8] ? "none" : null - ), c & /*scale*/ - 512 && L( + o[8] ? "none" : null + ), u & /*scale*/ + 512 && T( e, "width", /*scale*/ - s[9] === 0 ? "fit-content" : null - ), c & /*min_width*/ - 1024 && L(e, "min-width", typeof /*min_width*/ - s[10] == "number" ? `calc(min(${/*min_width*/ - s[10]}px, 100%))` : null); + o[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); }, - i(s) { - l || (Ve(o, s), l = !0); + i(o) { + s || (Pe(a, o), s = !0); }, - o(s) { - Ge(o, s), l = !1; + o(o) { + Ke(a, o), s = !1; }, - d(s) { - s && xe(e), a && a.d(), o && o.d(s); + d(o) { + o && Ae(e), l && l.d(), a && a.d(o); } }; } -function In(t) { - let e, n, i; +function It(n) { + let e, t, i; return { c() { - e = Qe("img"), A(e, "class", "button-icon svelte-8huxfn"), Ke(e.src, n = /*icon*/ - t[7].url) || A(e, "src", n), A(e, "alt", i = `${/*value*/ - t[5]} icon`); + 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*/ + n[5]} icon`); }, - m(l, a) { - Ee(l, e, a); + m(s, l) { + Me(s, e, l); }, - p(l, a) { - a & /*icon*/ - 128 && !Ke(e.src, n = /*icon*/ - l[7].url) && A(e, "src", n), a & /*value*/ + p(s, l) { + l & /*icon*/ + 128 && !Fe(e.src, t = /*icon*/ + s[7].url) && X(e, "src", t), l & /*value*/ 32 && i !== (i = `${/*value*/ - l[5]} icon`) && A(e, "alt", i); + s[5]} icon`) && X(e, "alt", i); }, - d(l) { - l && xe(e); + d(s) { + s && Ae(e); } }; } -function jn(t) { - let e, n, i; +function Ut(n) { + let e, t, i; return { c() { - e = Qe("img"), A(e, "class", "button-icon svelte-8huxfn"), Ke(e.src, n = /*icon*/ - t[7].url) || A(e, "src", n), A(e, "alt", i = `${/*value*/ - t[5]} icon`); + 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*/ + n[5]} icon`); }, - m(l, a) { - Ee(l, e, a); + m(s, l) { + Me(s, e, l); }, - p(l, a) { - a & /*icon*/ - 128 && !Ke(e.src, n = /*icon*/ - l[7].url) && A(e, "src", n), a & /*value*/ + p(s, l) { + l & /*icon*/ + 128 && !Fe(e.src, t = /*icon*/ + s[7].url) && X(e, "src", t), l & /*value*/ 32 && i !== (i = `${/*value*/ - l[5]} icon`) && A(e, "alt", i); + s[5]} icon`) && X(e, "alt", i); }, - d(l) { - l && xe(e); + d(s) { + s && Ae(e); } }; } -function Sl(t) { - let e, n, i, l; - const a = [Cl, yl], r = []; - function o(s, c) { +function ws(n) { + let e, t, i, s; + const l = [gs, bs], r = []; + function a(o, u) { return ( /*link*/ - s[6] && /*link*/ - s[6].length > 0 ? 0 : 1 + o[6] && /*link*/ + o[6].length > 0 ? 0 : 1 ); } - return e = o(t), n = r[e] = a[e](t), { + return e = a(n), t = r[e] = l[e](n), { c() { - n.c(), i = gl(); + t.c(), i = us(); }, - m(s, c) { - r[e].m(s, c), Ee(s, i, c), l = !0; + m(o, u) { + r[e].m(o, u), Me(o, i, u), s = !0; }, - p(s, [c]) { + p(o, [u]) { let f = e; - e = o(s), e === f ? r[e].p(s, c) : (wl(), Ge(r[f], 1, 1, () => { + e = a(o), e === f ? r[e].p(o, u) : (hs(), Ke(r[f], 1, 1, () => { r[f] = null; - }), bl(), n = r[e], n ? n.p(s, c) : (n = r[e] = a[e](s), n.c()), Ve(n, 1), n.m(i.parentNode, i)); + }), 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)); }, - i(s) { - l || (Ve(n), l = !0); + i(o) { + s || (Pe(t), s = !0); }, - o(s) { - Ge(n), l = !1; + o(o) { + Ke(t), s = !1; }, - d(s) { - s && xe(i), r[e].d(s); + d(o) { + o && Ae(i), r[e].d(o); } }; } -function zl(t, e, n) { - let { $$slots: i = {}, $$scope: l } = e, { elem_id: a = "" } = e, { elem_classes: r = [] } = e, { visible: o = !0 } = e, { variant: s = "secondary" } = e, { size: c = "lg" } = e, { value: f = null } = e, { link: u = null } = e, { icon: b = null } = e, { disabled: g = !1 } = e, { scale: d = null } = e, { min_width: k = void 0 } = e; - function _(h) { - ml.call(this, t, h); +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); } - return t.$$set = (h) => { - "elem_id" in h && n(0, a = h.elem_id), "elem_classes" in h && n(1, r = h.elem_classes), "visible" in h && n(2, o = h.visible), "variant" in h && n(3, s = h.variant), "size" in h && n(4, c = h.size), "value" in h && n(5, f = h.value), "link" in h && n(6, u = h.link), "icon" in h && n(7, b = h.icon), "disabled" in h && n(8, g = h.disabled), "scale" in h && n(9, d = h.scale), "min_width" in h && n(10, k = h.min_width), "$$scope" in h && n(11, l = h.$$scope); + 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); }, [ - a, + l, r, + a, o, - s, - c, - f, u, - b, + f, + c, + w, g, - d, - k, - l, + v, + _, + s, i, - _ + d ]; } -class Un extends dl { +class bt extends rs { constructor(e) { - super(), kl(this, e, zl, Sl, vl, { + super(), ms(this, e, ys, ws, ds, { elem_id: 0, elem_classes: 1, visible: 2, @@ -1326,195 +1293,195 @@ class Un extends dl { } } const { - SvelteComponent: xl, - add_render_callback: mt, - append: Te, - attr: Y, - binding_callbacks: Wn, - check_outros: El, - create_bidirectional_transition: Nn, - destroy_each: Ml, - detach: ke, - element: Je, - empty: Al, - ensure_array_like: Fn, - group_outros: Bl, - init: Dl, - insert: pe, - listen: bn, - prevent_default: Hl, - run_all: Tl, - safe_not_equal: ql, - set_data: Ll, + SvelteComponent: vs, + add_render_callback: _n, + append: Le, + 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: gn, - text: Rl, - toggle_class: K, - transition_in: un, - transition_out: Pn -} = window.__gradio__svelte__internal, { createEventDispatcher: Xl } = window.__gradio__svelte__internal; -function Kn(t, e, n) { - const i = t.slice(); - return i[26] = e[n], i; -} -function Vn(t) { - let e, n, i, l, a, r = Fn( + 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) { + const i = n.slice(); + return i[26] = e[t], i; +} +function Pt(n) { + let e, t, i, s, l, r = Nt( /*filtered_indices*/ - t[1] - ), o = []; - for (let s = 0; s < r.length; s += 1) - o[s] = Gn(Kn(t, r, s)); + n[1] + ), a = []; + for (let o = 0; o < r.length; o += 1) + a[o] = Kt(Ft(n, r, o)); return { c() { - e = Je("ul"); - for (let s = 0; s < o.length; s += 1) - o[s].c(); - Y(e, "class", "options svelte-yuohum"), Y(e, "role", "listbox"), re( + 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, "bottom", /*bottom*/ - t[9] + n[9] ), re(e, "max-height", `calc(${/*max_height*/ - t[10]}px - var(--window-padding))`), re( + n[10]}px - var(--window-padding))`), re( e, "width", /*input_width*/ - t[8] + "px" + n[8] + "px" ); }, - m(s, c) { - pe(s, e, c); - for (let f = 0; f < o.length; f += 1) - o[f] && o[f].m(e, null); - t[22](e), i = !0, l || (a = bn(e, "mousedown", Hl( + 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( /*mousedown_handler*/ - t[21] - )), l = !0); + n[21] + )), s = !0); }, - p(s, c) { - if (c & /*filtered_indices, choices, selected_indices, active_index*/ + p(o, u) { + if (u & /*filtered_indices, choices, selected_indices, active_index*/ 51) { - r = Fn( + r = Nt( /*filtered_indices*/ - s[1] + o[1] ); let f; for (f = 0; f < r.length; f += 1) { - const u = Kn(s, r, f); - o[f] ? o[f].p(u, c) : (o[f] = Gn(u), o[f].c(), o[f].m(e, null)); + 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)); } - for (; f < o.length; f += 1) - o[f].d(1); - o.length = r.length; + for (; f < a.length; f += 1) + a[f].d(1); + a.length = r.length; } - c & /*bottom*/ + u & /*bottom*/ 512 && re( e, "bottom", /*bottom*/ - s[9] - ), c & /*max_height*/ + o[9] + ), u & /*max_height*/ 1024 && re(e, "max-height", `calc(${/*max_height*/ - s[10]}px - var(--window-padding))`), c & /*input_width*/ + o[10]}px - var(--window-padding))`), u & /*input_width*/ 256 && re( e, "width", /*input_width*/ - s[8] + "px" + o[8] + "px" ); }, - i(s) { - i || (s && mt(() => { - i && (n || (n = Nn(e, On, { duration: 200, y: 5 }, !0)), n.run(1)); + i(o) { + i || (o && _n(() => { + i && (t || (t = jt(e, Ot, { duration: 200, y: 5 }, !0)), t.run(1)); }), i = !0); }, - o(s) { - s && (n || (n = Nn(e, On, { duration: 200, y: 5 }, !1)), n.run(0)), i = !1; + o(o) { + o && (t || (t = jt(e, Ot, { duration: 200, y: 5 }, !1)), t.run(0)), i = !1; }, - d(s) { - s && ke(e), Ml(o, s), t[22](null), s && n && n.end(), l = !1, a(); + d(o) { + o && Ce(e), ps(a, o), n[22](null), o && t && t.end(), s = !1, l(); } }; } -function Gn(t) { - let e, n, i, l = ( +function Kt(n) { + let e, t, i, s = ( /*choices*/ - t[0][ + n[0][ /*index*/ - t[26] + n[26] ][0] + "" - ), a, r, o, s, c; + ), l, r, a, o, u; return { c() { - e = Je("li"), n = Je("span"), n.textContent = "✓", i = gn(), a = Rl(l), r = gn(), Y(n, "class", "inner-item svelte-yuohum"), K(n, "hide", !/*selected_indices*/ - t[4].includes( + 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*/ + n[4].includes( /*index*/ - t[26] - )), Y(e, "class", "item svelte-yuohum"), Y(e, "data-index", o = /*index*/ - t[26]), Y(e, "aria-label", s = /*choices*/ - t[0][ + n[26] + )), O(e, "class", "item svelte-yuohum"), O(e, "data-index", a = /*index*/ + n[26]), O(e, "aria-label", o = /*choices*/ + n[0][ /*index*/ - t[26] - ][0]), Y(e, "data-testid", "dropdown-option"), Y(e, "role", "option"), Y(e, "aria-selected", c = /*selected_indices*/ - t[4].includes( + n[26] + ][0]), O(e, "data-testid", "dropdown-option"), O(e, "role", "option"), O(e, "aria-selected", u = /*selected_indices*/ + n[4].includes( /*index*/ - t[26] - )), K( + n[26] + )), V( e, "selected", /*selected_indices*/ - t[4].includes( + n[4].includes( /*index*/ - t[26] + n[26] ) - ), K( + ), V( e, "active", /*index*/ - t[26] === /*active_index*/ - t[5] - ), K( + n[26] === /*active_index*/ + n[5] + ), V( e, "bg-gray-100", /*index*/ - t[26] === /*active_index*/ - t[5] - ), K( + n[26] === /*active_index*/ + n[5] + ), V( e, "dark:bg-gray-600", /*index*/ - t[26] === /*active_index*/ - t[5] + n[26] === /*active_index*/ + n[5] ); }, - m(f, u) { - pe(f, e, u), Te(e, n), Te(e, i), Te(e, a), Te(e, r); + m(f, c) { + Se(f, e, c), Le(e, t), Le(e, i), Le(e, l), Le(e, r); }, - p(f, u) { - u & /*selected_indices, filtered_indices*/ - 18 && K(n, "hide", !/*selected_indices*/ + p(f, c) { + c & /*selected_indices, filtered_indices*/ + 18 && V(t, "hide", !/*selected_indices*/ f[4].includes( /*index*/ f[26] - )), u & /*choices, filtered_indices*/ - 3 && l !== (l = /*choices*/ + )), c & /*choices, filtered_indices*/ + 3 && s !== (s = /*choices*/ f[0][ /*index*/ f[26] - ][0] + "") && Ll(a, l), u & /*filtered_indices*/ - 2 && o !== (o = /*index*/ - f[26]) && Y(e, "data-index", o), u & /*choices, filtered_indices*/ - 3 && s !== (s = /*choices*/ + ][0] + "") && Ms(l, s), c & /*filtered_indices*/ + 2 && a !== (a = /*index*/ + f[26]) && O(e, "data-index", a), c & /*choices, filtered_indices*/ + 3 && o !== (o = /*choices*/ f[0][ /*index*/ f[26] - ][0]) && Y(e, "aria-label", s), u & /*selected_indices, filtered_indices*/ - 18 && c !== (c = /*selected_indices*/ + ][0]) && O(e, "aria-label", o), c & /*selected_indices, filtered_indices*/ + 18 && u !== (u = /*selected_indices*/ f[4].includes( /*index*/ f[26] - )) && Y(e, "aria-selected", c), u & /*selected_indices, filtered_indices*/ - 18 && K( + )) && O(e, "aria-selected", u), c & /*selected_indices, filtered_indices*/ + 18 && V( e, "selected", /*selected_indices*/ @@ -1522,22 +1489,22 @@ function Gn(t) { /*index*/ f[26] ) - ), u & /*filtered_indices, active_index*/ - 34 && K( + ), c & /*filtered_indices, active_index*/ + 34 && V( e, "active", /*index*/ f[26] === /*active_index*/ f[5] - ), u & /*filtered_indices, active_index*/ - 34 && K( + ), c & /*filtered_indices, active_index*/ + 34 && V( e, "bg-gray-100", /*index*/ f[26] === /*active_index*/ f[5] - ), u & /*filtered_indices, active_index*/ - 34 && K( + ), c & /*filtered_indices, active_index*/ + 34 && V( e, "dark:bg-gray-600", /*index*/ @@ -1546,140 +1513,140 @@ function Gn(t) { ); }, d(f) { - f && ke(e); + f && Ce(e); } }; } -function Yl(t) { - let e, n, i, l, a; - mt( +function Ys(n) { + let e, t, i, s, l; + _n( /*onwindowresize*/ - t[19] + n[19] ); let r = ( /*show_options*/ - t[2] && !/*disabled*/ - t[3] && Vn(t) + n[2] && !/*disabled*/ + n[3] && Pt(n) ); return { c() { - e = Je("div"), n = gn(), r && r.c(), i = Al(), Y(e, "class", "reference"); + e = Ge("div"), t = wt(), r && r.c(), i = xs(), O(e, "class", "reference"); }, - m(o, s) { - pe(o, e, s), t[20](e), pe(o, n, s), r && r.m(o, s), pe(o, i, s), l || (a = [ - bn( + 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( window, "scroll", /*scroll_listener*/ - t[12] + n[12] ), - bn( + gt( window, "resize", /*onwindowresize*/ - t[19] + n[19] ) - ], l = !0); + ], s = !0); }, - p(o, [s]) { + p(a, [o]) { /*show_options*/ - o[2] && !/*disabled*/ - o[3] ? r ? (r.p(o, s), s & /*show_options, disabled*/ - 12 && un(r, 1)) : (r = Vn(o), r.c(), un(r, 1), r.m(i.parentNode, i)) : r && (Bl(), Pn(r, 1, 1, () => { + 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, () => { r = null; - }), El()); + }), ks()); }, - i(o) { - un(r); + i(a) { + ft(r); }, - o(o) { - Pn(r); + o(a) { + Vt(r); }, - d(o) { - o && (ke(e), ke(n), ke(i)), t[20](null), r && r.d(o), l = !1, Tl(a); + d(a) { + a && (Ce(e), Ce(t), Ce(i)), n[20](null), r && r.d(a), s = !1, Es(l); } }; } -function Ol(t, e, n) { - var i, l; - let { choices: a } = e, { filtered_indices: r } = e, { show_options: o = !1 } = e, { disabled: s = !1 } = e, { selected_indices: c = [] } = e, { active_index: f = null } = e, u, b, g, d, k, _, h, p, m; - function E() { - const { top: v, bottom: F } = k.getBoundingClientRect(); - n(16, u = v), n(17, b = m - F); - } - let z = null; +function Hs(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() { - o && (z !== null && clearTimeout(z), z = setTimeout( + const { top: z, bottom: U } = _.getBoundingClientRect(); + t(16, c = z), t(17, w = h - U); + } + let p = null; + function M() { + a && (p !== null && clearTimeout(p), p = setTimeout( () => { - E(), z = null; + x(), p = null; }, 10 )); } - const M = Xl(); - function y() { - n(11, m = window.innerHeight); + const A = Xs(); + function C() { + t(11, h = window.innerHeight); } - function H(v) { - Wn[v ? "unshift" : "push"](() => { - k = v, n(6, k); + function B(z) { + Wt[z ? "unshift" : "push"](() => { + _ = z, t(6, _); }); } - const R = (v) => M("change", v); - function N(v) { - Wn[v ? "unshift" : "push"](() => { - _ = v, n(7, _); + const D = (z) => A("change", z); + function G(z) { + Wt[z ? "unshift" : "push"](() => { + d = z, t(7, d); }); } - return t.$$set = (v) => { - "choices" in v && n(0, a = v.choices), "filtered_indices" in v && n(1, r = v.filtered_indices), "show_options" in v && n(2, o = v.show_options), "disabled" in v && n(3, s = v.disabled), "selected_indices" in v && n(4, c = v.selected_indices), "active_index" in v && n(5, f = v.active_index); - }, t.$$.update = () => { - if (t.$$.dirty & /*show_options, refElement, listElement, selected_indices, _a, _b, distance_from_bottom, distance_from_top, input_height*/ + 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); + }, n.$$.update = () => { + if (n.$$.dirty & /*show_options, refElement, listElement, selected_indices, _a, _b, distance_from_bottom, distance_from_top, input_height*/ 508116) { - if (o && k) { - if (_ && c.length > 0) { - let F = _.querySelectorAll("li"); - for (const se of Array.from(F)) - if (se.getAttribute("data-index") === c[0].toString()) { - n(14, i = _ == null ? void 0 : _.scrollTo) === null || i === void 0 || i.call(_, 0, se.offsetTop); + 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); break; } } - E(); - const v = n(15, l = k.parentElement) === null || l === void 0 ? void 0 : l.getBoundingClientRect(); - n(18, g = (v == null ? void 0 : v.height) || 0), n(8, d = (v == null ? void 0 : v.width) || 0); + 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 > u ? (n(10, p = b), n(9, h = null)) : (n(9, h = `${b + g}px`), n(10, p = u - g)); + w > c ? (t(10, y = w), t(9, m = null)) : (t(9, m = `${w + g}px`), t(10, y = c - g)); } }, [ - a, + l, r, + a, o, - s, - c, + u, f, - k, _, d, - h, - p, + v, m, - x, + y, + h, M, + A, i, - l, - u, - b, + s, + c, + w, g, - y, - H, - R, - N + C, + B, + D, + G ]; } -class Il extends xl { +class Ds extends vs { constructor(e) { - super(), Dl(this, e, Ol, Yl, ql, { + super(), Ss(this, e, Hs, Ys, As, { choices: 0, filtered_indices: 1, show_options: 2, @@ -1689,395 +1656,395 @@ class Il extends xl { }); } } -function jl(t, e) { - return (t % e + e) % e; +function Rs(n, e) { + return (n % e + e) % e; } -function Jn(t, e) { - return t.reduce((n, i, l) => ((!e || i[0].toLowerCase().includes(e.toLowerCase())) && n.push(l), n), []); +function Gt(n, e) { + return n.reduce((t, i, s) => ((!e || i[0].toLowerCase().includes(e.toLowerCase())) && t.push(s), t), []); } -function Ul(t, e, n) { - t("change", e), n || t("input"); +function Ls(n, e, t) { + n("change", e), t || n("input"); } -function Wl(t, e, n) { - if (t.key === "Escape") +function Ts(n, e, t) { + if (n.key === "Escape") return [!1, e]; - if ((t.key === "ArrowDown" || t.key === "ArrowUp") && n.length >= 0) + if ((n.key === "ArrowDown" || n.key === "ArrowUp") && t.length >= 0) if (e === null) - e = t.key === "ArrowDown" ? n[0] : n[n.length - 1]; + e = n.key === "ArrowDown" ? t[0] : t[t.length - 1]; else { - const i = n.indexOf(e), l = t.key === "ArrowUp" ? -1 : 1; - e = n[jl(i + l, n.length)]; + const i = t.indexOf(e), s = n.key === "ArrowUp" ? -1 : 1; + e = t[Rs(i + s, t.length)]; } return [!0, e]; } const { - SvelteComponent: Nl, - append: ee, - attr: X, - binding_callbacks: Fl, - check_outros: Pl, - create_component: wn, - destroy_component: kn, - detach: yn, - element: ce, - group_outros: Kl, - init: Vl, - insert: Cn, - listen: me, - mount_component: pn, - run_all: Gl, - safe_not_equal: Jl, - set_data: Ql, - set_input_value: Qn, - space: hn, - text: Zl, + SvelteComponent: qs, + append: ie, + 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: ue, - transition_out: ge -} = window.__gradio__svelte__internal, { onMount: $l } = window.__gradio__svelte__internal, { createEventDispatcher: es, afterUpdate: ns } = window.__gradio__svelte__internal; -function ts(t) { + 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) { let e; return { c() { - e = Zl( + e = Fs( /*label*/ - t[0] + n[0] ); }, - m(n, i) { - Cn(n, e, i); + m(t, i) { + Ct(t, e, i); }, - p(n, i) { + p(t, i) { i[0] & /*label*/ - 1 && Ql( + 1 && Vs( e, /*label*/ - n[0] + t[0] ); }, - d(n) { - n && yn(e); + d(t) { + t && xt(e); } }; } -function Zn(t) { - let e, n, i; - return n = new Jt({}), { +function Zt(n) { + let e, t, i; + return t = new Ui({}), { c() { - e = ce("div"), wn(n.$$.fragment), X(e, "class", "icon-wrap svelte-1m1zvyj"); + e = ue("div"), yt(t.$$.fragment), q(e, "class", "icon-wrap svelte-1m1zvyj"); }, - m(l, a) { - Cn(l, e, a), pn(n, e, null), i = !0; + m(s, l) { + Ct(s, e, l), kt(t, e, null), i = !0; }, - i(l) { - i || (ue(n.$$.fragment, l), i = !0); + i(s) { + i || (he(t.$$.fragment, s), i = !0); }, - o(l) { - ge(n.$$.fragment, l), i = !1; + o(s) { + ye(t.$$.fragment, s), i = !1; }, - d(l) { - l && yn(e), kn(n); + d(s) { + s && xt(e), vt(t); } }; } -function is(t) { - let e, n, i, l, a, r, o, s, c, f, u, b, g, d; - n = new ot({ +function Zs(n) { + let e, t, i, s, l, r, a, o, u, f, c, w, g, v; + t = new ln({ props: { show_label: ( /*show_label*/ - t[4] + n[4] ), info: ( /*info*/ - t[1] + n[1] ), - $$slots: { default: [ts] }, - $$scope: { ctx: t } + $$slots: { default: [Js] }, + $$scope: { ctx: n } } }); - let k = !/*disabled*/ - t[3] && Zn(); - return u = new Il({ + let _ = !/*disabled*/ + n[3] && Zt(); + return c = new Ds({ props: { show_options: ( /*show_options*/ - t[12] + n[12] ), choices: ( /*choices*/ - t[2] + n[2] ), filtered_indices: ( /*filtered_indices*/ - t[10] + n[10] ), disabled: ( /*disabled*/ - t[3] + n[3] ), selected_indices: ( /*selected_index*/ - t[11] === null ? [] : [ + n[11] === null ? [] : [ /*selected_index*/ - t[11] + n[11] ] ), active_index: ( /*active_index*/ - t[14] + n[14] ) } - }), u.$on( + }), c.$on( "change", /*handle_option_selected*/ - t[16] + n[16] ), { c() { - e = ce("div"), wn(n.$$.fragment), i = hn(), l = ce("div"), a = ce("div"), r = ce("div"), o = ce("input"), c = hn(), k && k.c(), f = hn(), wn(u.$$.fragment), X(o, "role", "listbox"), X(o, "aria-controls", "dropdown-options"), X( - o, + 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( + a, "aria-expanded", /*show_options*/ - t[12] - ), X( - o, + n[12] + ), q( + a, "aria-label", /*label*/ - t[0] - ), X(o, "class", "border-none svelte-1m1zvyj"), o.disabled = /*disabled*/ - t[3], X(o, "autocomplete", "off"), o.readOnly = s = !/*filterable*/ - t[7], fe(o, "subdued", !/*choices_names*/ - t[13].includes( + 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[13].includes( /*input_text*/ - t[9] + n[9] ) && !/*allow_custom_value*/ - t[6]), X(r, "class", "secondary-wrap svelte-1m1zvyj"), X(a, "class", "wrap-inner svelte-1m1zvyj"), fe( - a, + n[6]), q(r, "class", "secondary-wrap svelte-1m1zvyj"), q(l, "class", "wrap-inner svelte-1m1zvyj"), fe( + l, "show_options", /*show_options*/ - t[12] - ), X(l, "class", "wrap svelte-1m1zvyj"), X(e, "class", "svelte-1m1zvyj"), fe( + n[12] + ), q(s, "class", "wrap svelte-1m1zvyj"), q(e, "class", "svelte-1m1zvyj"), fe( e, "container", /*container*/ - t[5] + n[5] ); }, - m(_, h) { - Cn(_, e, h), pn(n, e, null), ee(e, i), ee(e, l), ee(l, a), ee(a, r), ee(r, o), Qn( - o, + 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( + a, /*input_text*/ - t[9] - ), t[29](o), ee(r, c), k && k.m(r, null), ee(l, f), pn(u, l, null), b = !0, g || (d = [ - me( - o, + n[9] + ), n[29](a), ie(r, u), _ && _.m(r, null), ie(s, f), kt(c, s, null), w = !0, g || (v = [ + ge( + a, "input", /*input_input_handler*/ - t[28] + n[28] ), - me( - o, + ge( + a, "keydown", /*handle_key_down*/ - t[19] + n[19] ), - me( - o, + ge( + a, "keyup", /*keyup_handler*/ - t[30] + n[30] ), - me( - o, + ge( + a, "blur", /*handle_blur*/ - t[18] + n[18] ), - me( - o, + ge( + a, "focus", /*handle_focus*/ - t[17] + n[17] ) ], g = !0); }, - p(_, h) { - const p = {}; - h[0] & /*show_label*/ - 16 && (p.show_label = /*show_label*/ - _[4]), h[0] & /*info*/ - 2 && (p.info = /*info*/ - _[1]), h[0] & /*label*/ - 1 | h[1] & /*$$scope*/ - 4 && (p.$$scope = { dirty: h, ctx: _ }), n.$set(p), (!b || h[0] & /*show_options*/ - 4096) && X( - o, + 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*/ + 4096) && q( + a, "aria-expanded", /*show_options*/ - _[12] - ), (!b || h[0] & /*label*/ - 1) && X( - o, + d[12] + ), (!w || m[0] & /*label*/ + 1) && q( + a, "aria-label", /*label*/ - _[0] - ), (!b || h[0] & /*disabled*/ - 8) && (o.disabled = /*disabled*/ - _[3]), (!b || h[0] & /*filterable*/ - 128 && s !== (s = !/*filterable*/ - _[7])) && (o.readOnly = s), h[0] & /*input_text*/ - 512 && o.value !== /*input_text*/ - _[9] && Qn( - o, + d[0] + ), (!w || m[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*/ + 512 && a.value !== /*input_text*/ + d[9] && Jt( + a, /*input_text*/ - _[9] - ), (!b || h[0] & /*choices_names, input_text, allow_custom_value*/ - 8768) && fe(o, "subdued", !/*choices_names*/ - _[13].includes( + d[9] + ), (!w || m[0] & /*choices_names, input_text, allow_custom_value*/ + 8768) && fe(a, "subdued", !/*choices_names*/ + d[13].includes( /*input_text*/ - _[9] + d[9] ) && !/*allow_custom_value*/ - _[6]), /*disabled*/ - _[3] ? k && (Kl(), ge(k, 1, 1, () => { - k = null; - }), Pl()) : k ? h[0] & /*disabled*/ - 8 && ue(k, 1) : (k = Zn(), k.c(), ue(k, 1), k.m(r, null)), (!b || h[0] & /*show_options*/ + 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( - a, + l, "show_options", /*show_options*/ - _[12] + d[12] ); - const m = {}; - h[0] & /*show_options*/ - 4096 && (m.show_options = /*show_options*/ - _[12]), h[0] & /*choices*/ - 4 && (m.choices = /*choices*/ - _[2]), h[0] & /*filtered_indices*/ - 1024 && (m.filtered_indices = /*filtered_indices*/ - _[10]), h[0] & /*disabled*/ - 8 && (m.disabled = /*disabled*/ - _[3]), h[0] & /*selected_index*/ - 2048 && (m.selected_indices = /*selected_index*/ - _[11] === null ? [] : [ + const h = {}; + m[0] & /*show_options*/ + 4096 && (h.show_options = /*show_options*/ + d[12]), m[0] & /*choices*/ + 4 && (h.choices = /*choices*/ + d[2]), m[0] & /*filtered_indices*/ + 1024 && (h.filtered_indices = /*filtered_indices*/ + d[10]), m[0] & /*disabled*/ + 8 && (h.disabled = /*disabled*/ + d[3]), m[0] & /*selected_index*/ + 2048 && (h.selected_indices = /*selected_index*/ + d[11] === null ? [] : [ /*selected_index*/ - _[11] - ]), h[0] & /*active_index*/ - 16384 && (m.active_index = /*active_index*/ - _[14]), u.$set(m), (!b || h[0] & /*container*/ + d[11] + ]), m[0] & /*active_index*/ + 16384 && (h.active_index = /*active_index*/ + d[14]), c.$set(h), (!w || m[0] & /*container*/ 32) && fe( e, "container", /*container*/ - _[5] + d[5] ); }, - i(_) { - b || (ue(n.$$.fragment, _), ue(k), ue(u.$$.fragment, _), b = !0); + i(d) { + w || (he(t.$$.fragment, d), he(_), he(c.$$.fragment, d), w = !0); }, - o(_) { - ge(n.$$.fragment, _), ge(k), ge(u.$$.fragment, _), b = !1; + o(d) { + ye(t.$$.fragment, d), ye(_), ye(c.$$.fragment, d), w = !1; }, - d(_) { - _ && yn(e), kn(n), t[29](null), k && k.d(), kn(u), g = !1, Gl(d); + d(d) { + d && xt(e), vt(t), n[29](null), _ && _.d(), vt(c), g = !1, js(v); } }; } -function ls(t, e, n) { - let { label: i } = e, { info: l = void 0 } = e, { value: a = [] } = e, r = [], { value_is_output: o = !1 } = e, { choices: s } = e, c, { disabled: f = !1 } = e, { show_label: u } = e, { container: b = !0 } = e, { allow_custom_value: g = !1 } = e, { filterable: d = !0 } = e, k, _ = !1, h, p, m = "", E = "", z = !1, x = [], M = null, y = null, H; - const R = es(); - a ? (H = s.map((C) => C[1]).indexOf(a), y = H, y === -1 ? (r = a, y = null) : ([m, r] = s[y], E = m), v()) : s.length > 0 && (H = 0, y = 0, [m, a] = s[y], r = a, E = m); - function N() { - n(13, h = s.map((C) => C[0])), n(24, p = s.map((C) => C[1])); +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 v() { - N(), a === void 0 || Array.isArray(a) && a.length === 0 ? (n(9, m = ""), n(11, y = null)) : p.includes(a) ? (n(9, m = h[p.indexOf(a)]), n(11, y = p.indexOf(a))) : g ? (n(9, m = a), n(11, y = null)) : (n(9, m = ""), n(11, y = null)), n(27, H = y); + 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); } - function F(C) { - if (n(11, y = parseInt(C.detail.target.dataset.index)), isNaN(y)) { - n(11, y = null); + function U(S) { + if (t(11, C = parseInt(S.detail.target.dataset.index)), isNaN(C)) { + t(11, C = null); return; } - n(12, _ = !1), n(14, M = null), k.blur(); + t(12, d = !1), t(14, A = null), _.blur(); } - function se(C) { - n(10, x = s.map((xn, en) => en)), n(12, _ = !0), R("focus"); + function R(S) { + t(10, M = o.map((it, Ye) => Ye)), t(12, d = !0), D("focus"); } - function Ze() { - g ? n(20, a = m) : n(9, m = h[p.indexOf(a)]), n(12, _ = !1), n(14, M = null), R("blur"); + 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 de(C) { - n(12, [_, M] = Wl(C, M, x), _, (n(14, M), n(2, s), n(23, c), n(6, g), n(9, m), n(10, x), n(8, k), n(25, E), n(11, y), n(27, H), n(26, z), n(24, p))), C.key === "Enter" && (M !== null ? (n(11, y = M), n(12, _ = !1), k.blur(), n(14, M = null)) : h.includes(m) ? (n(11, y = h.indexOf(m)), n(12, _ = !1), n(14, M = null), k.blur()) : g && (n(20, a = m), n(11, y = null), n(12, _ = !1), n(14, M = null), k.blur()), R("enter", a)); + 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)); } - ns(() => { - n(21, o = !1), n(26, z = !0); - }), $l(() => { - k.focus(); + Gs(() => { + t(21, a = !1), t(26, p = !0); + }), Ps(() => { + _.focus(); }); - function Me() { - m = this.value, n(9, m), n(11, y), n(27, H), n(26, z), n(2, s), n(24, p); + function tt() { + h = this.value, t(9, h), t(11, C), t(27, B), t(26, p), t(2, o), t(24, y); } - function Ae(C) { - Fl[C ? "unshift" : "push"](() => { - k = C, n(8, k); + function nt(S) { + Os[S ? "unshift" : "push"](() => { + _ = S, t(8, _); }); } - const $e = (C) => R("key_up", { key: C.key, input_value: m }); - return t.$$set = (C) => { - "label" in C && n(0, i = C.label), "info" in C && n(1, l = C.info), "value" in C && n(20, a = C.value), "value_is_output" in C && n(21, o = C.value_is_output), "choices" in C && n(2, s = C.choices), "disabled" in C && n(3, f = C.disabled), "show_label" in C && n(4, u = C.show_label), "container" in C && n(5, b = C.container), "allow_custom_value" in C && n(6, g = C.allow_custom_value), "filterable" in C && n(7, d = C.filterable); - }, t.$$.update = () => { - t.$$.dirty[0] & /*selected_index, old_selected_index, initialized, choices, choices_values*/ - 218105860 && y !== H && y !== null && z && (n(9, [m, a] = s[y], m, (n(20, a), n(11, y), n(27, H), n(26, z), n(2, s), n(24, p))), n(27, H = y), R("select", { - index: y, - value: p[y], + const be = (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); + }, 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", { + index: C, + value: y[C], selected: !0 - })), t.$$.dirty[0] & /*value, old_value, value_is_output*/ - 7340032 && a != r && (v(), Ul(R, a, o), n(22, r = a)), t.$$.dirty[0] & /*choices*/ - 4 && N(), t.$$.dirty[0] & /*choices, old_choices, allow_custom_value, input_text, filtered_indices, filter_input*/ - 8390468 && s !== c && (g || v(), n(23, c = s), n(10, x = Jn(s, m)), !g && x.length > 0 && n(14, M = x[0]), k == document.activeElement && n(12, _ = !0)), t.$$.dirty[0] & /*input_text, old_input_text, choices, allow_custom_value, filtered_indices*/ - 33556036 && m !== E && (n(10, x = Jn(s, m)), n(25, E = m), !g && x.length > 0 && n(14, M = x[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])); }, [ i, - l, s, + o, f, - u, - b, + c, + w, g, - d, - k, - m, - x, - y, + v, _, h, M, + C, + d, + m, + A, + D, + U, R, - F, - se, - Ze, - de, + ne, + et, + l, a, - o, r, - c, + u, + y, + x, p, - E, - z, - H, - Me, - Ae, - $e + B, + tt, + nt, + be ]; } -class ss extends Nl { +class $s extends qs { constructor(e) { - super(), Vl( + super(), Ws( this, e, - ls, - is, - Jl, + Qs, + Zs, + Ns, { label: 0, info: 1, @@ -2096,261 +2063,336 @@ class ss extends Nl { } } const { - SvelteComponent: os, - append: G, - attr: qe, - create_component: Le, - destroy_component: Re, - detach: Sn, - element: ne, - init: as, - insert: zn, - mount_component: Xe, - safe_not_equal: rs, - set_style: Ye, - space: _n, - text: bt, - transition_in: Oe, - transition_out: Ie -} = window.__gradio__svelte__internal, { createEventDispatcher: fs } = window.__gradio__svelte__internal, { onMount: cs, onDestroy: us } = window.__gradio__svelte__internal; -function hs(t) { + 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) { + let e; + return { + c() { + e = St("Cancel"); + }, + m(t, i) { + Xe(t, e, i); + }, + d(t) { + t && Be(e); + } + }; +} +function Qt(n) { + let e, t, i; + return t = new bt({ + props: { + variant: "stop", + $$slots: { default: [fl] }, + $$scope: { ctx: n } + } + }), t.$on( + "click", + /*click_handler_1*/ + n[12] + ), { + c() { + e = $("div"), ve(t.$$.fragment), xe(e, "margin-right", "8px"); + }, + m(s, l) { + Xe(s, e, l), pe(t, e, null), i = !0; + }, + p(s, l) { + const r = {}; + l & /*$$scope*/ + 65536 && (r.$$scope = { dirty: l, ctx: s }), t.$set(r); + }, + i(s) { + i || (ee(t.$$.fragment, s), i = !0); + }, + o(s) { + se(t.$$.fragment, s), i = !1; + }, + d(s) { + s && Be(e), ke(t); + } + }; +} +function fl(n) { let e; return { c() { - e = bt("Cancel"); + e = St("Remove"); }, - m(n, i) { - zn(n, e, i); + m(t, i) { + Xe(t, e, i); }, - d(n) { - n && Sn(e); + d(t) { + t && Be(e); } }; } -function _s(t) { +function cl(n) { let e; return { c() { - e = bt("OK"); + e = St("OK"); }, - m(n, i) { - zn(n, e, i); + m(t, i) { + Xe(t, e, i); }, - d(n) { - n && Sn(e); + d(t) { + t && Be(e); } }; } -function ds(t) { - let e, n, i, l, a, r, o, s, c, f, u, b, g, d, k; - return a = new ss({ +function ul(n) { + let e, t, i, s, l, r, a, o, u, f, c, w, g, v, _, d; + l = new $s({ props: { value: ( /*currentLabel*/ - t[0] + n[0] ), label: "Label", choices: ( /*choices*/ - t[2] + n[2] ), show_label: !1, allow_custom_value: !0 } - }), a.$on( + }), l.$on( "change", /*onDropDownChange*/ - t[4] - ), a.$on( + n[5] + ), l.$on( "enter", /*onDropDownEnter*/ - t[6] - ), s = new hl({ + n[7] + ), o = new os({ props: { value: ( /*currentColor*/ - t[1] + n[1] ), label: "Color", show_label: !1 } - }), s.$on( + }), o.$on( "change", /*onColorChange*/ - t[5] - ), u = new Un({ + n[6] + ), c = new bt({ props: { - $$slots: { default: [hs] }, - $$scope: { ctx: t } + $$slots: { default: [rl] }, + $$scope: { ctx: n } } - }), u.$on( + }), c.$on( "click", /*click_handler*/ - t[10] - ), d = new Un({ + n[11] + ); + let m = ( + /*showRemove*/ + n[3] && Qt(n) + ); + return _ = new bt({ props: { variant: "primary", - $$slots: { default: [_s] }, - $$scope: { ctx: t } + $$slots: { default: [cl] }, + $$scope: { ctx: n } } - }), d.$on( + }), _.$on( "click", - /*click_handler_1*/ - t[11] + /*click_handler_2*/ + n[13] ), { c() { - e = ne("div"), n = ne("div"), i = ne("span"), l = ne("div"), Le(a.$$.fragment), r = _n(), o = ne("div"), Le(s.$$.fragment), c = _n(), f = ne("div"), Le(u.$$.fragment), b = _n(), g = ne("div"), Le(d.$$.fragment), Ye(l, "margin-right", "10px"), Ye(o, "margin-right", "40px"), Ye(o, "margin-bottom", "8px"), Ye(f, "margin-right", "8px"), qe(i, "class", "model-content svelte-hkn2q1"), qe(n, "class", "modal-container svelte-hkn2q1"), qe(e, "class", "modal svelte-hkn2q1"), qe(e, "id", "model-box-edit"); + 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"); }, - m(_, h) { - zn(_, e, h), G(e, n), G(n, i), G(i, l), Xe(a, l, null), G(i, r), G(i, o), Xe(s, o, null), G(i, c), G(i, f), Xe(u, f, null), G(i, b), G(i, g), Xe(d, g, null), k = !0; + 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; }, - p(_, [h]) { - const p = {}; + p(y, [h]) { + const x = {}; h & /*currentLabel*/ - 1 && (p.value = /*currentLabel*/ - _[0]), h & /*choices*/ - 4 && (p.choices = /*choices*/ - _[2]), a.$set(p); - const m = {}; + 1 && (x.value = /*currentLabel*/ + y[0]), h & /*choices*/ + 4 && (x.choices = /*choices*/ + y[2]), l.$set(x); + const p = {}; h & /*currentColor*/ - 2 && (m.value = /*currentColor*/ - _[1]), s.$set(m); - const E = {}; + 2 && (p.value = /*currentColor*/ + y[1]), o.$set(p); + const M = {}; h & /*$$scope*/ - 16384 && (E.$$scope = { dirty: h, ctx: _ }), u.$set(E); - const z = {}; + 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()); + const A = {}; h & /*$$scope*/ - 16384 && (z.$$scope = { dirty: h, ctx: _ }), d.$set(z); + 65536 && (A.$$scope = { dirty: h, ctx: y }), _.$set(A); }, - i(_) { - k || (Oe(a.$$.fragment, _), Oe(s.$$.fragment, _), Oe(u.$$.fragment, _), Oe(d.$$.fragment, _), k = !0); + i(y) { + d || (ee(l.$$.fragment, y), ee(o.$$.fragment, y), ee(c.$$.fragment, y), ee(m), ee(_.$$.fragment, y), d = !0); }, - o(_) { - Ie(a.$$.fragment, _), Ie(s.$$.fragment, _), Ie(u.$$.fragment, _), Ie(d.$$.fragment, _), k = !1; + o(y) { + se(l.$$.fragment, y), se(o.$$.fragment, y), se(c.$$.fragment, y), se(m), se(_.$$.fragment, y), d = !1; }, - d(_) { - _ && Sn(e), Re(a), Re(s), Re(u), Re(d); + d(y) { + y && Be(e), ke(l), ke(o), ke(c), m && m.d(), ke(_); } }; } -function ms(t, e, n) { - let { label: i = "" } = e, { currentLabel: l = "" } = e, { choices: a = [] } = e, { choicesColors: r = [] } = e, { color: o = "" } = e, { currentColor: s = "" } = e; - const c = fs(); - function f(h) { - c("change", { - label: l, - color: s, - ok: h +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", { + label: s, + color: o, + ret: h + // -1: remove, 0: cancel, 1: change }); } - function u(h) { - const { detail: p } = h; - let m = p; - Number.isInteger(m) ? (Array.isArray(r) && m < r.length && n(1, s = r[m]), Array.isArray(a) && m < a.length && n(0, l = a[m][0])) : n(0, l = m); - } - function b(h) { - const { detail: p } = h; - n(1, s = p); + 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 g(h) { - u(h), f(!0); + const { detail: x } = h; + t(1, o = x); } - function d(h) { + function v(h) { + w(h), c(1); + } + function _(h) { switch (h.key) { case "Enter": - f(!0); + c(1); break; } } - cs(() => { - document.addEventListener("keydown", d), n(0, l = i), n(1, s = o); - }), us(() => { - document.removeEventListener("keydown", d); + ol(() => { + document.addEventListener("keydown", _), t(0, s = i), t(1, o = a); + }), al(() => { + document.removeEventListener("keydown", _); }); - const k = () => f(!1), _ = () => f(!0); - return t.$$set = (h) => { - "label" in h && n(7, i = h.label), "currentLabel" in h && n(0, l = h.currentLabel), "choices" in h && n(2, a = h.choices), "choicesColors" in h && n(8, r = h.choicesColors), "color" in h && n(9, o = h.color), "currentColor" in h && n(1, s = h.currentColor); + const d = () => c(0), m = () => c(-1), y = () => c(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); }, [ - l, s, - a, - f, + o, + l, u, - b, + c, + w, g, + v, i, r, - o, - k, - _ + a, + d, + m, + y ]; } -class gt extends os { +class dn extends el { constructor(e) { - super(), as(this, e, ms, ds, rs, { - label: 7, + super(), il(this, e, hl, ul, sl, { + label: 8, currentLabel: 0, choices: 2, - choicesColors: 8, - color: 9, - currentColor: 1 + choicesColors: 9, + color: 10, + currentColor: 1, + showRemove: 3 }); } } -const q = (t, e, n) => Math.min(Math.max(t, e), n); -function dn(t, e) { - if (t.startsWith("rgba")) - return t.replace(/[\d.]+$/, e.toString()); - const n = t.match(/\d+/g); - if (!n || n.length !== 3) +const H = (n, e, t) => Math.min(Math.max(n, e), t); +function ut(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, l, a] = n; - return `rgba(${i}, ${l}, ${a}, ${e})`; + const [i, s, l] = t; + return `rgba(${i}, ${s}, ${l}, ${e})`; } -class mn { - constructor(e, n, i, l, a, r, o, s, c, f, u = "rgb(255, 255, 255)", b = 0.5, g = 25, d = 8, k = 2, _ = 4, h = 1) { +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) { this.stopDrag = () => { this.isDragging = !1, document.removeEventListener("mousemove", this.handleDrag), document.removeEventListener("mouseup", this.stopDrag); - }, this.handleDrag = (p) => { + }, this.handleDrag = (h) => { if (this.isDragging) { - let m = p.clientX - this.offsetMouseX - this.xmin, E = p.clientY - this.offsetMouseY - this.ymin; - const z = this.canvasXmax - this.canvasXmin, x = this.canvasYmax - this.canvasYmin; - m = q(m, -this.xmin, z - this.xmax), E = q(E, -this.ymin, x - this.ymax), this.xmin += m, this.ymin += E, this.xmax += m, this.ymax += E, this.updateHandles(), this.renderCallBack(); + 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(); + } + }, 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(); + } + }, 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(); } - }, this.handleResize = (p) => { + this.onFinishCreation(); + }, this.handleResize = (h) => { if (this.isResizing) { - const m = p.clientX, E = p.clientY, z = m - this.resizeHandles[this.resizingHandleIndex].xmin - this.offsetMouseX, x = E - this.resizeHandles[this.resizingHandleIndex].ymin - this.offsetMouseY, M = this.canvasXmax - this.canvasXmin, y = this.canvasYmax - this.canvasYmin; + 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; switch (this.resizingHandleIndex) { case 0: - this.xmin += z, this.ymin += x, this.xmin = q(this.xmin, 0, this.xmax - this.minSize), this.ymin = q(this.ymin, 0, this.ymax - this.minSize); + 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); break; case 1: - this.xmax += z, this.ymin += x, this.xmax = q(this.xmax, this.xmin + this.minSize, M), this.ymin = q(this.ymin, 0, this.ymax - this.minSize); + 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); break; case 2: - this.xmax += z, this.ymax += x, this.xmax = q(this.xmax, this.xmin + this.minSize, M), this.ymax = q(this.ymax, this.ymin + this.minSize, y); + 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); break; case 3: - this.xmin += z, this.ymax += x, this.xmin = q(this.xmin, 0, this.xmax - this.minSize), this.ymax = q(this.ymax, this.ymin + this.minSize, y); + 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); break; case 4: - this.ymin += x, this.ymin = q(this.ymin, 0, this.ymax - this.minSize); + this.ymin += A, this.ymin = H(this.ymin, 0, this.ymax - this.minSize); break; case 5: - this.xmax += z, this.xmax = q(this.xmax, this.xmin + this.minSize, M); + this.xmax += M, this.xmax = H(this.xmax, this.xmin + this.minSize, C); break; case 6: - this.ymax += x, this.ymax = q(this.ymax, this.ymin + this.minSize, y); + this.ymax += A, this.ymax = H(this.ymax, this.ymin + this.minSize, B); break; case 7: - this.xmin += z, this.xmin = q(this.xmin, 0, this.xmax - this.minSize); + this.xmin += M, this.xmin = H(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.canvasXmin = n, this.canvasYmin = i, this.canvasXmax = l, this.canvasYmax = a, this.scaleFactor = h, this.label = r, this.isDragging = !1, this.xmin = o, this.ymin = s, this.xmax = c, this.ymax = f, this.isResizing = !1, this.isSelected = !1, this.offsetMouseX = 0, this.offsetMouseY = 0, this.resizeHandleSize = d, this.thickness = k, this.selectedThickness = _, this.updateHandles(), this.resizingHandleIndex = -1, this.minSize = g, this.color = u, this.alpha = b; + }, 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"; } toJSON() { return { @@ -2367,11 +2409,11 @@ class mn { this.isSelected = e; } setScaleFactor(e) { - let n = e / this.scaleFactor; - this.xmin = Math.round(this.xmin * n), this.ymin = Math.round(this.ymin * n), this.xmax = Math.round(this.xmax * n), this.ymax = Math.round(this.ymax * n), this.updateHandles(), this.scaleFactor = e; + let t = e / this.scaleFactor; + this.xmin = Math.round(this.xmin * t), this.ymin = Math.round(this.ymin * t), this.xmax = Math.round(this.xmax * t), this.ymax = Math.round(this.ymax * t), this.updateHandles(), this.scaleFactor = e; } updateHandles() { - const e = this.resizeHandleSize / 2, n = this.getWidth(), i = this.getHeight(); + const e = this.resizeHandleSize / 2, t = this.getWidth(), i = this.getHeight(); this.resizeHandles = [ { // Top left @@ -2403,9 +2445,9 @@ class mn { }, { // Top center - xmin: this.xmin + n / 2 - e, + xmin: this.xmin + t / 2 - e, ymin: this.ymin - e, - xmax: this.xmin + n / 2 + e, + xmax: this.xmin + t / 2 + e, ymax: this.ymin + e }, { @@ -2417,9 +2459,9 @@ class mn { }, { // Bottom center - xmin: this.xmin + n / 2 - e, + xmin: this.xmin + t / 2 - e, ymin: this.ymax - e, - xmax: this.xmin + n / 2 + e, + xmax: this.xmin + t / 2 + e, ymax: this.ymax + e }, { @@ -2437,49 +2479,55 @@ class mn { getHeight() { return this.ymax - this.ymin; } - toCanvasCoordinates(e, n) { - return e = e + this.canvasXmin, n = n + this.canvasYmin, [e, n]; + getArea() { + return this.getWidth() * this.getHeight(); } - toBoxCoordinates(e, n) { - return e = e - this.canvasXmin, n = n - this.canvasYmin, [e, n]; + toCanvasCoordinates(e, t) { + return e = e + this.canvasXmin, t = t + this.canvasYmin, [e, t]; + } + toBoxCoordinates(e, t) { + return e = e - this.canvasXmin, t = t - this.canvasYmin, [e, t]; } render(e) { - let n, i; - if (e.beginPath(), [n, i] = this.toCanvasCoordinates(this.xmin, this.ymin), e.rect(n, i, this.getWidth(), this.getHeight()), e.fillStyle = dn(this.color, this.alpha), e.fill(), this.isSelected ? e.lineWidth = this.selectedThickness : e.lineWidth = this.thickness, e.strokeStyle = dn(this.color, 1), e.stroke(), e.closePath(), this.label !== null && this.label.trim() !== "") { + 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() !== "") { this.isSelected ? e.font = "bold 14px Arial" : e.font = "12px Arial"; - const l = e.measureText(this.label).width + 10, a = 20; - let r = this.xmin, o = this.ymin - a; - e.fillStyle = "white", [r, o] = this.toCanvasCoordinates(r, o), e.fillRect(r, o, l, a), e.lineWidth = 1, e.strokeStyle = "black", e.strokeRect(r, o, l, a), e.fillStyle = "black", e.fillText(this.label, r + 5, o + 15); + 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); } - e.fillStyle = dn(this.color, 1); - for (const l of this.resizeHandles) - [n, i] = this.toCanvasCoordinates(l.xmin, l.ymin), e.fillRect( - n, + e.fillStyle = ut(this.color, 1); + for (const s of this.resizeHandles) + [t, i] = this.toCanvasCoordinates(s.xmin, s.ymin), e.fillRect( + t, i, - l.xmax - l.xmin, - l.ymax - l.ymin + s.xmax - s.xmin, + s.ymax - s.ymin ); } startDrag(e) { this.isDragging = !0, this.offsetMouseX = e.clientX - this.xmin, this.offsetMouseY = e.clientY - this.ymin, document.addEventListener("mousemove", this.handleDrag), document.addEventListener("mouseup", this.stopDrag); } - isPointInsideBox(e, n) { - return [e, n] = this.toBoxCoordinates(e, n), e >= this.xmin && e <= this.xmax && n >= this.ymin && n <= this.ymax; + isPointInsideBox(e, t) { + return [e, t] = this.toBoxCoordinates(e, t), e >= this.xmin && e <= this.xmax && t >= this.ymin && t <= this.ymax; } - indexOfPointInsideHandle(e, n) { - [e, n] = this.toBoxCoordinates(e, n); + indexOfPointInsideHandle(e, t) { + [e, t] = this.toBoxCoordinates(e, t); for (let i = 0; i < this.resizeHandles.length; i++) { - const l = this.resizeHandles[i]; - if (e >= l.xmin && e <= l.xmax && n >= l.ymin && n <= l.ymax) + const s = this.resizeHandles[i]; + if (e >= s.xmin && e <= s.xmax && t >= s.ymin && t <= s.ymax) return this.resizingHandleIndex = i, i; } return -1; } - startResize(e, n) { - this.resizingHandleIndex = e, this.isResizing = !0, this.offsetMouseX = n.clientX - this.resizeHandles[e].xmin, this.offsetMouseY = n.clientY - this.resizeHandles[e].ymin, document.addEventListener("mousemove", this.handleResize), document.addEventListener("mouseup", this.stopResize); + startCreating(e, t, i) { + this.isCreating = !0, this.offsetMouseX = t, this.offsetMouseY = i, document.addEventListener("mousemove", this.handleCreating), document.addEventListener("mouseup", this.stopCreating); + } + startResize(e, t) { + 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 V = [ +const ce = [ "rgb(255, 168, 77)", "rgb(92, 172, 238)", "rgb(255, 99, 71)", @@ -2494,131 +2542,124 @@ const V = [ "rgb(255, 193, 7)", "rgb(255, 250, 138)" ], { - SvelteComponent: bs, - append: we, - attr: le, - binding_callbacks: gs, - bubble: $n, - check_outros: Ne, - create_component: ye, - destroy_component: Ce, - detach: te, - element: _e, - empty: ws, - group_outros: Fe, - init: ks, - insert: ie, - listen: $, - mount_component: Se, - noop: ps, - run_all: wt, - safe_not_equal: vs, - space: ve, - transition_in: D, - transition_out: O -} = window.__gradio__svelte__internal, { onMount: ys, onDestroy: Cs, createEventDispatcher: Ss } = window.__gradio__svelte__internal; -function et(t) { - let e, n, i, l, a, r, o, s, c, f; - i = new ui({}); - let u = !/*disableEditBoxes*/ - t[4] && nt(t); - return o = new Ut({}), { + 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({}), { c() { - e = _e("span"), n = _e("button"), ye(i.$$.fragment), l = ve(), u && u.c(), a = ve(), r = _e("button"), ye(o.$$.fragment), le(n, "class", "icon svelte-182gnnj"), le(r, "class", "icon svelte-182gnnj"), le(e, "class", "canvas-control svelte-182gnnj"); - }, - m(b, g) { - ie(b, e, g), we(e, n), Se(i, n, null), we(e, l), u && u.m(e, null), we(e, a), we(e, r), Se(o, r, null), s = !0, c || (f = [ - $( - n, + 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( + t, + "selected", + /*mode*/ + n[7] === /*Mode*/ + n[4].creation + ), te(l, "class", "icon svelte-10jprmi"), te(l, "aria-label", "Edit boxes"), Oe( + l, + "selected", + /*mode*/ + n[7] === /*Mode*/ + n[4].drag + ), te(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( + t, "click", /*click_handler*/ - t[26] + n[27] ), - $( - r, + le( + l, "click", - /*click_handler_2*/ - t[28] + /*click_handler_1*/ + n[28] ) - ], c = !0); - }, - p(b, g) { - /*disableEditBoxes*/ - b[4] ? u && (Fe(), O(u, 1, 1, () => { - u = null; - }), Ne()) : u ? (u.p(b, g), g[0] & /*disableEditBoxes*/ - 16 && D(u, 1)) : (u = nt(b), u.c(), D(u, 1), u.m(e, a)); - }, - i(b) { - s || (D(i.$$.fragment, b), D(u), D(o.$$.fragment, b), s = !0); - }, - o(b) { - O(i.$$.fragment, b), O(u), O(o.$$.fragment, b), s = !1; - }, - d(b) { - b && te(e), Ce(i), u && u.d(), Ce(o), c = !1, wt(f); - } - }; -} -function nt(t) { - let e, n, i, l, a; - return n = new li({}), { - c() { - e = _e("button"), ye(n.$$.fragment), le(e, "class", "icon svelte-182gnnj"); + ], o = !0); }, - m(r, o) { - ie(r, e, o), Se(n, e, null), i = !0, l || (a = $( - e, - "click", - /*click_handler_1*/ - t[27] - ), l = !0); + p(f, c) { + (!a || c[0] & /*mode, Mode*/ + 144) && Oe( + t, + "selected", + /*mode*/ + f[7] === /*Mode*/ + f[4].creation + ), (!a || c[0] & /*mode, Mode*/ + 144) && Oe( + l, + "selected", + /*mode*/ + f[7] === /*Mode*/ + f[4].drag + ); }, - p: ps, - i(r) { - i || (D(n.$$.fragment, r), i = !0); + i(f) { + a || (I(i.$$.fragment, f), I(r.$$.fragment, f), a = !0); }, - o(r) { - O(n.$$.fragment, r), i = !1; + o(f) { + P(i.$$.fragment, f), P(r.$$.fragment, f), a = !1; }, - d(r) { - r && te(e), Ce(n), l = !1, a(); + d(f) { + f && me(e), Ze(i), Ze(r), o = !1, bn(u); } }; } -function tt(t) { - let e, n; - return e = new gt({ +function tn(n) { + let e, t; + return e = new dn({ props: { choices: ( /*choices*/ - t[2] + n[2] ), choicesColors: ( /*choicesColors*/ - t[3] + n[3] ), label: ( /*selectedBox*/ - t[6] >= 0 && /*selectedBox*/ - t[6] < /*value*/ - t[0].boxes.length ? ( + n[6] >= 0 && /*selectedBox*/ + n[6] < /*value*/ + n[0].boxes.length ? ( /*value*/ - t[0].boxes[ + n[0].boxes[ /*selectedBox*/ - t[6] + n[6] ].label ) : "" ), color: ( /*selectedBox*/ - t[6] >= 0 && /*selectedBox*/ - t[6] < /*value*/ - t[0].boxes.length ? ze( + n[6] >= 0 && /*selectedBox*/ + n[6] < /*value*/ + n[0].boxes.length ? Ee( /*value*/ - t[0].boxes[ + n[0].boxes[ /*selectedBox*/ - t[6] + n[6] ].color ) : "" ) @@ -2626,26 +2667,26 @@ function tt(t) { }), e.$on( "change", /*onModalEditChange*/ - t[15] + n[15] ), e.$on( "enter{onModalEditChange}", /*enter_onModalEditChange_handler*/ - t[29] + n[29] ), { c() { - ye(e.$$.fragment); - }, - m(i, l) { - Se(e, i, l), n = !0; - }, - p(i, l) { - const a = {}; - l[0] & /*choices*/ - 4 && (a.choices = /*choices*/ - i[2]), l[0] & /*choicesColors*/ - 8 && (a.choicesColors = /*choicesColors*/ - i[3]), l[0] & /*selectedBox, value*/ - 65 && (a.label = /*selectedBox*/ + Je(e.$$.fragment); + }, + m(i, s) { + Qe(e, i, s), t = !0; + }, + p(i, s) { + const l = {}; + 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*/ i[0].boxes.length ? ( @@ -2654,365 +2695,407 @@ function tt(t) { /*selectedBox*/ i[6] ].label - ) : ""), l[0] & /*selectedBox, value*/ - 65 && (a.color = /*selectedBox*/ + ) : ""), s[0] & /*selectedBox, value*/ + 65 && (l.color = /*selectedBox*/ i[6] >= 0 && /*selectedBox*/ i[6] < /*value*/ - i[0].boxes.length ? ze( + i[0].boxes.length ? Ee( /*value*/ i[0].boxes[ /*selectedBox*/ i[6] ].color - ) : ""), e.$set(a); + ) : ""), e.$set(l); }, i(i) { - n || (D(e.$$.fragment, i), n = !0); + t || (I(e.$$.fragment, i), t = !0); }, o(i) { - O(e.$$.fragment, i), n = !1; + P(e.$$.fragment, i), t = !1; }, d(i) { - Ce(e, i); + Ze(e, i); } }; } -function it(t) { - let e, n; - return e = new gt({ +function nn(n) { + let e, t; + return e = new dn({ props: { choices: ( /*choices*/ - t[2] + n[2] ), + showRemove: !1, choicesColors: ( /*choicesColors*/ - t[3] + n[3] ), - color: Array.isArray( - /*choicesColors*/ - t[3] - ) && /*choicesColors*/ - t[3].length > 0 ? ( - /*choicesColors*/ - t[3][0] - ) : ze(V[ - /*value*/ - t[0].boxes.length % V.length - ]) + label: ( + /*selectedBox*/ + n[6] >= 0 && /*selectedBox*/ + n[6] < /*value*/ + n[0].boxes.length ? ( + /*value*/ + n[0].boxes[ + /*selectedBox*/ + n[6] + ].label + ) : "" + ), + color: ( + /*selectedBox*/ + n[6] >= 0 && /*selectedBox*/ + n[6] < /*value*/ + n[0].boxes.length ? Ee( + /*value*/ + n[0].boxes[ + /*selectedBox*/ + n[6] + ].color + ) : "" + ) } }), e.$on( "change", /*onModalNewChange*/ - t[12] + n[16] ), e.$on( "enter{onModalNewChange}", /*enter_onModalNewChange_handler*/ - t[30] + n[30] ), { c() { - ye(e.$$.fragment); - }, - m(i, l) { - Se(e, i, l), n = !0; - }, - p(i, l) { - const a = {}; - l[0] & /*choices*/ - 4 && (a.choices = /*choices*/ - i[2]), l[0] & /*choicesColors*/ - 8 && (a.choicesColors = /*choicesColors*/ - i[3]), l[0] & /*choicesColors, value*/ - 9 && (a.color = Array.isArray( - /*choicesColors*/ - i[3] - ) && /*choicesColors*/ - i[3].length > 0 ? ( - /*choicesColors*/ - i[3][0] - ) : ze(V[ + Je(e.$$.fragment); + }, + m(i, s) { + Qe(e, i, s), t = !0; + }, + p(i, s) { + const l = {}; + 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*/ + i[0].boxes.length ? ( /*value*/ - i[0].boxes.length % V.length - ])), e.$set(a); + i[0].boxes[ + /*selectedBox*/ + i[6] + ].label + ) : ""), s[0] & /*selectedBox, value*/ + 65 && (l.color = /*selectedBox*/ + i[6] >= 0 && /*selectedBox*/ + i[6] < /*value*/ + i[0].boxes.length ? Ee( + /*value*/ + i[0].boxes[ + /*selectedBox*/ + i[6] + ].color + ) : ""), e.$set(l); }, i(i) { - n || (D(e.$$.fragment, i), n = !0); + t || (I(e.$$.fragment, i), t = !0); }, o(i) { - O(e.$$.fragment, i), n = !1; + P(e.$$.fragment, i), t = !1; }, d(i) { - Ce(e, i); + Ze(e, i); } }; } -function zs(t) { - let e, n, i, l, a, r, o, s, c, f = ( +function kl(n) { + let e, t, i, s, l, r, a, o, u, f = ( /*interactive*/ - t[1] && et(t) - ), u = ( + n[1] && en(n) + ), c = ( /*editModalVisible*/ - t[7] && tt(t) - ), b = ( + n[8] && tn(n) + ), w = ( /*newModalVisible*/ - t[8] && it(t) + n[9] && nn(n) ); return { c() { - e = _e("div"), n = _e("canvas"), i = ve(), f && f.c(), l = ve(), u && u.c(), a = ve(), b && b.c(), r = ws(), le(n, "class", "canvas-annotator svelte-182gnnj"), le(e, "class", "canvas-container svelte-182gnnj"), le(e, "tabindex", "-1"); + 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"); }, - m(g, d) { - ie(g, e, d), we(e, n), t[25](n), ie(g, i, d), f && f.m(g, d), ie(g, l, d), u && u.m(g, d), ie(g, a, d), b && b.m(g, d), ie(g, r, d), o = !0, s || (c = [ - $( - n, + 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( + t, "mousedown", /*handleMouseDown*/ - t[9] + n[10] ), - $( - n, + le( + t, "mouseup", /*handleMouseUp*/ - t[10] + n[11] ), - $( - n, + le( + t, "dblclick", /*handleDoubleClick*/ - t[14] + n[14] ), - $( + le( e, "focusin", /*handleCanvasFocus*/ - t[17] + n[17] ), - $( + le( e, "focusout", /*handleCanvasBlur*/ - t[18] + n[18] ) - ], s = !0); + ], o = !0); }, - p(g, d) { + p(g, v) { /*interactive*/ - g[1] ? f ? (f.p(g, d), d[0] & /*interactive*/ - 2 && D(f, 1)) : (f = et(g), f.c(), D(f, 1), f.m(l.parentNode, l)) : f && (Fe(), O(f, 1, 1, () => { + 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; - }), Ne()), /*editModalVisible*/ - g[7] ? u ? (u.p(g, d), d[0] & /*editModalVisible*/ - 128 && D(u, 1)) : (u = tt(g), u.c(), D(u, 1), u.m(a.parentNode, a)) : u && (Fe(), O(u, 1, 1, () => { - u = null; - }), Ne()), /*newModalVisible*/ - g[8] ? b ? (b.p(g, d), d[0] & /*newModalVisible*/ - 256 && D(b, 1)) : (b = it(g), b.c(), D(b, 1), b.m(r.parentNode, r)) : b && (Fe(), O(b, 1, 1, () => { - b = null; - }), Ne()); + }), 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, () => { + 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()); }, i(g) { - o || (D(f), D(u), D(b), o = !0); + a || (I(f), I(c), I(w), a = !0); }, o(g) { - O(f), O(u), O(b), o = !1; + P(f), P(c), P(w), a = !1; }, d(g) { - g && (te(e), te(i), te(l), te(a), te(r)), t[25](null), f && f.d(g), u && u.d(g), b && b.d(g), s = !1, wt(c); + 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); } }; } -function lt(t) { - var e = parseInt(t.slice(1, 3), 16), n = parseInt(t.slice(3, 5), 16), i = parseInt(t.slice(5, 7), 16); - return "rgb(" + e + ", " + n + ", " + i + ")"; -} -function ze(t) { - const e = t.match(/(\d+(\.\d+)?)/g), n = parseInt(e[0]), i = parseInt(e[1]), l = parseInt(e[2]); - return "#" + (1 << 24 | n << 16 | i << 8 | l).toString(16).slice(1); -} -function xs(t, e, n) { - let { imageUrl: i = null } = e, { interactive: l } = e, { boxAlpha: a = 0.5 } = e, { boxMinSize: r = 25 } = e, { handleSize: o } = e, { boxThickness: s } = e, { boxSelectedThickness: c } = e, { value: f } = e, { choices: u = [] } = e, { choicesColors: b = [] } = e, { disableEditBoxes: g = !1 } = e, d, k, _ = null, h = -1, p = 0, m = 0, E = 0, z = 0, x = 1, M = 0, y = 0, H = !1, R = !1; - const N = Ss(); - function v() { - if (k) { - k.clearRect(0, 0, d.width, d.height), _ !== null && k.drawImage(_, p, m, M, y); - for (const w of f.boxes.slice().reverse()) - w.render(k); +function dt(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) { + 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) { + var i; + (function(b) { + b[b.creation = 0] = "creation", b[b.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); } } - function F(w) { - n(6, h = w), f.boxes.forEach((S) => { - S.setSelected(!1); - }), w >= 0 && w < f.boxes.length && f.boxes[w].setSelected(!0), v(); + function ne(b) { + t(6, y = b), c.boxes.forEach((E) => { + E.setSelected(!1); + }), b >= 0 && b < c.boxes.length && c.boxes[b].setSelected(!0), R(); } - function se(w) { - if (!l) - return; - const S = d.getBoundingClientRect(), B = w.clientX - S.left, j = w.clientY - S.top; - for (const [J, I] of f.boxes.entries()) { - const De = I.indexOfPointInsideHandle(B, j); - if (De >= 0) { - F(J), I.startResize(De, w); + function et(b) { + l && (h === i.creation ? S(b) : h === i.drag && tt(b)); + } + 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); return; } } - for (const [J, I] of f.boxes.entries()) - if (I.isPointInsideBox(B, j)) { - F(J), I.startDrag(w); + for (const [j, L] of c.boxes.entries()) + if (L.isPointInsideBox(Y, W)) { + ne(j), L.startDrag(b); return; } - F(-1); + ne(-1); } - function Ze(w) { - N("change"); + function nt(b) { + U("change"); } - function de(w) { + function be(b) { if (l) - switch (w.key) { + switch (b.key) { case "Delete": - nn(); + He(); break; } } - function Me() { - g ? Ae() : n(8, R = !0); + 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 Ae(w = null, S = null, B = null, j = null, J = null, I = null) { - S === null || S === "" ? S = V[f.boxes.length % V.length] : S = lt(S), w === null && (w = ""), B === null && (B = M / 3 / x), J === null && (J = M / 3 * 2 / x), j === null && (j = y / 3 / x), I === null && (I = y / 3 * 2 / x); - let De = new mn(v, p, m, E, z, w, Math.round(B), Math.round(j), Math.round(J), Math.round(I), S, a, r, o, s, c); - n(0, f.boxes = [De, ...f.boxes], f), v(), N("change"); + function it() { + t(7, h = i.creation), t(5, _.style.cursor = "crosshair", _); } - function $e(w) { - n(8, R = !1); - const { detail: S } = w; - S.ok && Ae(S.label, S.color); + function Ye() { + t(7, h = i.drag), t(5, _.style.cursor = "default", _); } - function C() { - h >= 0 && h < f.boxes.length && !g && n(7, H = !0); - } - function xn(w) { - l && C(); - } - function en(w) { - n(7, H = !1); - const { detail: S } = w; - let B = S.label, j = S.color; - if (S.ok && h >= 0 && h < f.boxes.length) { - let I = f.boxes[h]; - I.label = B, I.color = lt(j), v(), N("change"); + function zt() { + y >= 0 && y < c.boxes.length && (c.boxes[y].getArea() < 1 ? He() : v || t(9, z = !0)); + } + function gn() { + y >= 0 && y < c.boxes.length && !v && t(8, G = !0); + } + function wn(b) { + l && gn(); + } + 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 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 nn() { - h >= 0 && h < f.boxes.length && (f.boxes.splice(h, 1), F(-1), N("change")); + function He() { + y >= 0 && y < c.boxes.length && (c.boxes.splice(y, 1), ne(-1), U("change")); } - function Be() { - if (d) { - if (x = 1, n(5, d.width = d.clientWidth, d), _ !== null) - if (_.width > d.width) - x = d.width / _.width, M = _.width * x, y = _.height * x, p = 0, m = 0, E = M, z = y, n(5, d.height = y, d); + 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, _); else { - M = _.width, y = _.height; - var w = (d.width - M) / 2; - p = w, m = 0, E = w + M, z = _.height, n(5, d.height = y, d); + 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, _); } else - p = 0, m = 0, E = d.width, z = d.height, n(5, d.height = d.clientHeight, d); - if (E > 0 && z > 0) - for (const S of f.boxes) - S.canvasXmin = p, S.canvasYmin = m, S.canvasXmax = E, S.canvasYmax = z, S.setScaleFactor(x); - v(), N("change"); + 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"); } } - const kt = new ResizeObserver(Be); - function pt() { - for (let w = 0; w < f.boxes.length; w++) { - let S = f.boxes[w]; - if (!(S instanceof mn)) { - let B = "", j = ""; - S.hasOwnProperty("color") ? (B = S.color, Array.isArray(B) && B.length === 3 && (B = `rgb(${B[0]}, ${B[1]}, ${B[2]})`)) : B = V[w % V.length], S.hasOwnProperty("label") && (j = S.label), S = new mn(v, p, m, E, z, j, S.xmin, S.ymin, S.xmax, S.ymax, B, a, r, o, s, c), n(0, f.boxes[w] = S, f); + 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); } } } - function En() { - i !== null && (_ === null || _.src != i) && (_ = new Image(), _.src = i, _.onload = function() { - Be(), v(); + function Et() { + s !== null && (m === null || m.src != s) && (m = new Image(), m.src = s, m.onload = function() { + De(), R(); }); } - ys(() => { - if (Array.isArray(u) && u.length > 0 && (!Array.isArray(b) || b.length == 0)) - for (let w = 0; w < u.length; w++) { - let S = V[w % V.length]; - b.push(ze(S)); + 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)); } - k = d.getContext("2d"), kt.observe(d), En(), Be(), v(); + d = _.getContext("2d"), kn.observe(_), Et(), De(), R(); }); - function vt() { - document.addEventListener("keydown", de); + function xn() { + document.addEventListener("keydown", be); } - function yt() { - document.removeEventListener("keydown", de); + function Cn() { + document.removeEventListener("keydown", be); } - Cs(() => { - document.removeEventListener("keydown", de); + yl(() => { + document.removeEventListener("keydown", be); }); - function Ct(w) { - gs[w ? "unshift" : "push"](() => { - d = w, n(5, d); + function Sn(b) { + _l[b ? "unshift" : "push"](() => { + _ = b, t(5, _); }); } - const St = () => Me(), zt = () => C(), xt = () => nn(); - function Et(w) { - $n.call(this, t, w); + const zn = () => it(), En = () => Ye(); + function An(b) { + $t.call(this, n, b); } - function Mt(w) { - $n.call(this, t, w); + function Mn(b) { + $t.call(this, n, b); } - return t.$$set = (w) => { - "imageUrl" in w && n(19, i = w.imageUrl), "interactive" in w && n(1, l = w.interactive), "boxAlpha" in w && n(20, a = w.boxAlpha), "boxMinSize" in w && n(21, r = w.boxMinSize), "handleSize" in w && n(22, o = w.handleSize), "boxThickness" in w && n(23, s = w.boxThickness), "boxSelectedThickness" in w && n(24, c = w.boxSelectedThickness), "value" in w && n(0, f = w.value), "choices" in w && n(2, u = w.choices), "choicesColors" in w && n(3, b = w.choicesColors), "disableEditBoxes" in w && n(4, g = w.disableEditBoxes); - }, t.$$.update = () => { - t.$$.dirty[0] & /*value*/ - 1 && (En(), pt(), Be(), v()); + 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); + }, n.$$.update = () => { + n.$$.dirty[0] & /*value*/ + 1 && (Et(), pn(), De(), R()); }, [ - f, + c, l, - u, - b, + w, g, - d, + i, + _, + y, h, - H, - R, - se, - Ze, - Me, - $e, - C, + G, + z, + et, + nt, + it, + Ye, + wn, + yn, + vn, xn, - en, - nn, - vt, - yt, - i, - a, + Cn, + s, r, + a, o, - s, - c, - Ct, - St, - zt, - xt, - Et, - Mt + u, + f, + v, + Sn, + zn, + En, + An, + Mn ]; } -class Es extends bs { +class xl extends ml { constructor(e) { - super(), ks( + super(), bl( this, e, - xs, - zs, - vs, + pl, + kl, + gl, { imageUrl: 19, interactive: 1, @@ -3024,7 +3107,7 @@ class Es extends bs { value: 0, choices: 2, choicesColors: 3, - disableEditBoxes: 4 + disableEditBoxes: 25 }, null, [-1, -1] @@ -3032,157 +3115,157 @@ class Es extends bs { } } const { - SvelteComponent: Ms, - add_flush_callback: As, - bind: Bs, - binding_callbacks: Ds, - create_component: Hs, - destroy_component: Ts, - init: qs, - mount_component: Ls, - safe_not_equal: Rs, - transition_in: Xs, - transition_out: Ys -} = window.__gradio__svelte__internal, { createEventDispatcher: Os } = window.__gradio__svelte__internal; -function Is(t) { - let e, n, i; - function l(r) { - t[14](r); - } - let a = { + 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) { + let e, t, i; + function s(r) { + n[14](r); + } + let l = { interactive: ( /*interactive*/ - t[1] + n[1] ), boxAlpha: ( /*boxesAlpha*/ - t[2] + n[2] ), choices: ( /*labelList*/ - t[3] + n[3] ), choicesColors: ( /*labelColors*/ - t[4] + n[4] ), boxMinSize: ( /*boxMinSize*/ - t[5] + n[5] ), handleSize: ( /*handleSize*/ - t[6] + n[6] ), boxThickness: ( /*boxThickness*/ - t[7] + n[7] ), boxSelectedThickness: ( /*boxSelectedThickness*/ - t[8] + n[8] ), disableEditBoxes: ( /*disableEditBoxes*/ - t[9] + n[9] ), imageUrl: ( /*resolved_src*/ - t[10] + n[10] ) }; return ( /*value*/ - t[0] !== void 0 && (a.value = /*value*/ - t[0]), e = new Es({ props: a }), Ds.push(() => Bs(e, "value", l)), e.$on( + n[0] !== void 0 && (l.value = /*value*/ + n[0]), e = new xl({ props: l }), El.push(() => zl(e, "value", s)), e.$on( "change", /*change_handler*/ - t[15] + n[15] ), { c() { - Hs(e.$$.fragment); + Al(e.$$.fragment); }, - m(r, o) { - Ls(e, r, o), i = !0; + m(r, a) { + Xl(e, r, a), i = !0; }, - p(r, [o]) { - const s = {}; - o & /*interactive*/ - 2 && (s.interactive = /*interactive*/ - r[1]), o & /*boxesAlpha*/ - 4 && (s.boxAlpha = /*boxesAlpha*/ - r[2]), o & /*labelList*/ - 8 && (s.choices = /*labelList*/ - r[3]), o & /*labelColors*/ - 16 && (s.choicesColors = /*labelColors*/ - r[4]), o & /*boxMinSize*/ - 32 && (s.boxMinSize = /*boxMinSize*/ - r[5]), o & /*handleSize*/ - 64 && (s.handleSize = /*handleSize*/ - r[6]), o & /*boxThickness*/ - 128 && (s.boxThickness = /*boxThickness*/ - r[7]), o & /*boxSelectedThickness*/ - 256 && (s.boxSelectedThickness = /*boxSelectedThickness*/ - r[8]), o & /*disableEditBoxes*/ - 512 && (s.disableEditBoxes = /*disableEditBoxes*/ - r[9]), o & /*resolved_src*/ - 1024 && (s.imageUrl = /*resolved_src*/ - r[10]), !n && o & /*value*/ - 1 && (n = !0, s.value = /*value*/ - r[0], As(() => n = !1)), e.$set(s); + p(r, [a]) { + const o = {}; + a & /*interactive*/ + 2 && (o.interactive = /*interactive*/ + r[1]), a & /*boxesAlpha*/ + 4 && (o.boxAlpha = /*boxesAlpha*/ + r[2]), a & /*labelList*/ + 8 && (o.choices = /*labelList*/ + r[3]), a & /*labelColors*/ + 16 && (o.choicesColors = /*labelColors*/ + r[4]), a & /*boxMinSize*/ + 32 && (o.boxMinSize = /*boxMinSize*/ + r[5]), a & /*handleSize*/ + 64 && (o.handleSize = /*handleSize*/ + r[6]), a & /*boxThickness*/ + 128 && (o.boxThickness = /*boxThickness*/ + r[7]), a & /*boxSelectedThickness*/ + 256 && (o.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); }, i(r) { - i || (Xs(e.$$.fragment, r), i = !0); + i || (Hl(e.$$.fragment, r), i = !0); }, o(r) { - Ys(e.$$.fragment, r), i = !1; + Dl(e.$$.fragment, r), i = !1; }, d(r) { - Ts(e, r); + Ml(e, r); } } ); } -function js(t, e, n) { - let { src: i = void 0 } = e, { interactive: l } = e, { boxesAlpha: a } = e, { labelList: r } = e, { labelColors: o } = e, { boxMinSize: s } = e, { handleSize: c } = e, { boxThickness: f } = e, { boxSelectedThickness: u } = e, { value: b } = e, { disableEditBoxes: g } = e, d, k; - const _ = Os(); - function h(m) { - b = m, n(0, b); - } - const p = () => _("change"); - return t.$$set = (m) => { - "src" in m && n(12, i = m.src), "interactive" in m && n(1, l = m.interactive), "boxesAlpha" in m && n(2, a = m.boxesAlpha), "labelList" in m && n(3, r = m.labelList), "labelColors" in m && n(4, o = m.labelColors), "boxMinSize" in m && n(5, s = m.boxMinSize), "handleSize" in m && n(6, c = m.handleSize), "boxThickness" in m && n(7, f = m.boxThickness), "boxSelectedThickness" in m && n(8, u = m.boxSelectedThickness), "value" in m && n(0, b = m.value), "disableEditBoxes" in m && n(9, g = m.disableEditBoxes); - }, t.$$.update = () => { - if (t.$$.dirty & /*src, latest_src*/ +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); + } + 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); + }, n.$$.update = () => { + if (n.$$.dirty & /*src, latest_src*/ 12288) { - n(10, d = i), n(13, k = i); - const m = i; - Lt(m).then((E) => { - k === m && n(10, d = E); + t(10, v = i), t(13, _ = i); + const h = i; + Ln(h).then((x) => { + _ === h && t(10, v = x); }); } }, [ - b, + w, + s, l, - a, r, + a, o, - s, - c, - f, u, + f, + c, g, + v, d, - _, i, - k, - h, - p + _, + m, + y ]; } -class Us extends Ms { +class ql extends Cl { constructor(e) { - super(), qs(this, e, js, Is, Rs, { + super(), Bl(this, e, Tl, Ll, Yl, { src: 12, interactive: 1, boxesAlpha: 2, @@ -3198,141 +3281,141 @@ class Us extends Ms { } } const { - SvelteComponent: Ws, - attr: Ns, - check_outros: Fs, - create_component: Ps, - destroy_component: Ks, - detach: Vs, - element: Gs, - group_outros: Js, - init: Qs, - insert: Zs, - mount_component: $s, - safe_not_equal: eo, - toggle_class: Z, - transition_in: Pe, - transition_out: vn + 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 } = window.__gradio__svelte__internal; -function st(t) { - let e, n; - return e = new Us({ +function sn(n) { + let e, t; + return e = new ql({ props: { src: ( /*samples_dir*/ - t[1] + /*value*/ - t[0].path + n[1] + /*value*/ + n[0].path ), alt: "" } }), { c() { - Ps(e.$$.fragment); + Wl(e.$$.fragment); }, - m(i, l) { - $s(e, i, l), n = !0; + m(i, s) { + Gl(e, i, s), t = !0; }, - p(i, l) { - const a = {}; - l & /*samples_dir, value*/ - 3 && (a.src = /*samples_dir*/ + p(i, s) { + const l = {}; + s & /*samples_dir, value*/ + 3 && (l.src = /*samples_dir*/ i[1] + /*value*/ - i[0].path), e.$set(a); + i[0].path), e.$set(l); }, i(i) { - n || (Pe(e.$$.fragment, i), n = !0); + t || (Ve(e.$$.fragment, i), t = !0); }, o(i) { - vn(e.$$.fragment, i), n = !1; + pt(e.$$.fragment, i), t = !1; }, d(i) { - Ks(e, i); + jl(e, i); } }; } -function no(t) { - let e, n, i = ( +function Zl(n) { + let e, t, i = ( /*value*/ - t[0] && st(t) + n[0] && sn(n) ); return { c() { - e = Gs("div"), i && i.c(), Ns(e, "class", "container svelte-1sgcyba"), Z( + e = Vl("div"), i && i.c(), Il(e, "class", "container svelte-1sgcyba"), Q( e, "table", /*type*/ - t[2] === "table" - ), Z( + n[2] === "table" + ), Q( e, "gallery", /*type*/ - t[2] === "gallery" - ), Z( + n[2] === "gallery" + ), Q( e, "selected", /*selected*/ - t[3] - ), Z( + n[3] + ), Q( e, "border", /*value*/ - t[0] + n[0] ); }, - m(l, a) { - Zs(l, e, a), i && i.m(e, null), n = !0; + m(s, l) { + Kl(s, e, l), i && i.m(e, null), t = !0; }, - p(l, [a]) { + p(s, [l]) { /*value*/ - l[0] ? i ? (i.p(l, a), a & /*value*/ - 1 && Pe(i, 1)) : (i = st(l), i.c(), Pe(i, 1), i.m(e, null)) : i && (Js(), vn(i, 1, 1, () => { + 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, () => { i = null; - }), Fs()), (!n || a & /*type*/ - 4) && Z( + }), Ul()), (!t || l & /*type*/ + 4) && Q( e, "table", /*type*/ - l[2] === "table" - ), (!n || a & /*type*/ - 4) && Z( + s[2] === "table" + ), (!t || l & /*type*/ + 4) && Q( e, "gallery", /*type*/ - l[2] === "gallery" - ), (!n || a & /*selected*/ - 8) && Z( + s[2] === "gallery" + ), (!t || l & /*selected*/ + 8) && Q( e, "selected", /*selected*/ - l[3] - ), (!n || a & /*value*/ - 1) && Z( + s[3] + ), (!t || l & /*value*/ + 1) && Q( e, "border", /*value*/ - l[0] + s[0] ); }, - i(l) { - n || (Pe(i), n = !0); + i(s) { + t || (Ve(i), t = !0); }, - o(l) { - vn(i), n = !1; + o(s) { + pt(i), t = !1; }, - d(l) { - l && Vs(e), i && i.d(); + d(s) { + s && Nl(e), i && i.d(); } }; } -function to(t, e, n) { - let { value: i } = e, { samples_dir: l } = e, { type: a } = e, { selected: r = !1 } = e; - return t.$$set = (o) => { - "value" in o && n(0, i = o.value), "samples_dir" in o && n(1, l = o.samples_dir), "type" in o && n(2, a = o.type), "selected" in o && n(3, r = o.selected); - }, [i, l, a, r]; +function Ql(n, e, t) { + let { value: i } = e, { samples_dir: s } = e, { type: l } = 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]; } -class lo extends Ws { +class eo extends Ol { constructor(e) { - super(), Qs(this, e, to, no, eo, { + super(), Pl(this, e, Ql, Zl, Jl, { value: 0, samples_dir: 1, type: 2, @@ -3341,5 +3424,5 @@ class lo extends Ws { } } export { - lo as default + eo as default };