const { SvelteComponent: mr, assign: gr, create_slot: br, detach: wr, element: pr, get_all_dirty_from_scope: vr, get_slot_changes: kr, get_spread_update: yr, init: Cr, insert: Sr, safe_not_equal: zr, set_dynamic_element_data: go, set_style: Ae, toggle_class: xe, transition_in: oa, transition_out: sa, update_slot_base: Br } = window.__gradio__svelte__internal; function qr(l) { let e, t, n; const i = ( /*#slots*/ l[18].default ), o = br( i, l, /*$$scope*/ l[17], null ); let s = [ { "data-testid": ( /*test_id*/ l[7] ) }, { id: ( /*elem_id*/ l[2] ) }, { class: t = "block " + /*elem_classes*/ l[3].join(" ") + " svelte-nl1om8" } ], r = {}; for (let a = 0; a < s.length; a += 1) r = gr(r, s[a]); return { c() { e = pr( /*tag*/ l[14] ), o && o.c(), go( /*tag*/ l[14] )(e, r), xe( e, "hidden", /*visible*/ l[10] === !1 ), xe( e, "padded", /*padding*/ l[6] ), xe( e, "border_focus", /*border_mode*/ l[5] === "focus" ), xe( e, "border_contrast", /*border_mode*/ l[5] === "contrast" ), xe(e, "hide-container", !/*explicit_call*/ l[8] && !/*container*/ l[9]), Ae( e, "height", /*get_dimension*/ l[15]( /*height*/ l[0] ) ), Ae(e, "width", typeof /*width*/ l[1] == "number" ? `calc(min(${/*width*/ l[1]}px, 100%))` : ( /*get_dimension*/ l[15]( /*width*/ l[1] ) )), Ae( e, "border-style", /*variant*/ l[4] ), Ae( e, "overflow", /*allow_overflow*/ l[11] ? "visible" : "hidden" ), Ae( e, "flex-grow", /*scale*/ l[12] ), Ae(e, "min-width", `calc(min(${/*min_width*/ l[13]}px, 100%))`), Ae(e, "border-width", "var(--block-border-width)"); }, m(a, f) { Sr(a, e, f), o && o.m(e, null), n = !0; }, p(a, f) { o && o.p && (!n || f & /*$$scope*/ 131072) && Br( o, i, a, /*$$scope*/ a[17], n ? kr( i, /*$$scope*/ a[17], f, null ) : vr( /*$$scope*/ a[17] ), null ), go( /*tag*/ a[14] )(e, r = yr(s, [ (!n || f & /*test_id*/ 128) && { "data-testid": ( /*test_id*/ a[7] ) }, (!n || f & /*elem_id*/ 4) && { id: ( /*elem_id*/ a[2] ) }, (!n || f & /*elem_classes*/ 8 && t !== (t = "block " + /*elem_classes*/ a[3].join(" ") + " svelte-nl1om8")) && { class: t } ])), xe( e, "hidden", /*visible*/ a[10] === !1 ), xe( e, "padded", /*padding*/ a[6] ), xe( e, "border_focus", /*border_mode*/ a[5] === "focus" ), xe( e, "border_contrast", /*border_mode*/ a[5] === "contrast" ), xe(e, "hide-container", !/*explicit_call*/ a[8] && !/*container*/ a[9]), f & /*height*/ 1 && Ae( e, "height", /*get_dimension*/ a[15]( /*height*/ a[0] ) ), f & /*width*/ 2 && Ae(e, "width", typeof /*width*/ a[1] == "number" ? `calc(min(${/*width*/ a[1]}px, 100%))` : ( /*get_dimension*/ a[15]( /*width*/ a[1] ) )), f & /*variant*/ 16 && Ae( e, "border-style", /*variant*/ a[4] ), f & /*allow_overflow*/ 2048 && Ae( e, "overflow", /*allow_overflow*/ a[11] ? "visible" : "hidden" ), f & /*scale*/ 4096 && Ae( e, "flex-grow", /*scale*/ a[12] ), f & /*min_width*/ 8192 && Ae(e, "min-width", `calc(min(${/*min_width*/ a[13]}px, 100%))`); }, i(a) { n || (oa(o, a), n = !0); }, o(a) { sa(o, a), n = !1; }, d(a) { a && wr(e), o && o.d(a); } }; } function Er(l) { let e, t = ( /*tag*/ l[14] && qr(l) ); return { c() { t && t.c(); }, m(n, i) { t && t.m(n, i), e = !0; }, p(n, [i]) { /*tag*/ n[14] && t.p(n, i); }, i(n) { e || (oa(t, n), e = !0); }, o(n) { sa(t, n), e = !1; }, d(n) { t && t.d(n); } }; } function Mr(l, e, t) { let { $$slots: n = {}, $$scope: i } = e, { height: o = void 0 } = e, { width: s = void 0 } = e, { elem_id: r = "" } = e, { elem_classes: a = [] } = e, { variant: f = "solid" } = e, { border_mode: u = "base" } = e, { padding: c = !0 } = e, { type: _ = "normal" } = e, { test_id: d = void 0 } = e, { explicit_call: h = !1 } = e, { container: m = !0 } = e, { visible: w = !0 } = e, { allow_overflow: b = !0 } = e, { scale: p = null } = e, { min_width: g = 0 } = e, v = _ === "fieldset" ? "fieldset" : "div"; const E = (y) => { if (y !== void 0) { if (typeof y == "number") return y + "px"; if (typeof y == "string") return y; } }; return l.$$set = (y) => { "height" in y && t(0, o = y.height), "width" in y && t(1, s = y.width), "elem_id" in y && t(2, r = y.elem_id), "elem_classes" in y && t(3, a = y.elem_classes), "variant" in y && t(4, f = y.variant), "border_mode" in y && t(5, u = y.border_mode), "padding" in y && t(6, c = y.padding), "type" in y && t(16, _ = y.type), "test_id" in y && t(7, d = y.test_id), "explicit_call" in y && t(8, h = y.explicit_call), "container" in y && t(9, m = y.container), "visible" in y && t(10, w = y.visible), "allow_overflow" in y && t(11, b = y.allow_overflow), "scale" in y && t(12, p = y.scale), "min_width" in y && t(13, g = y.min_width), "$$scope" in y && t(17, i = y.$$scope); }, [ o, s, r, a, f, u, c, d, h, m, w, b, p, g, v, E, _, i, n ]; } class Ar extends mr { constructor(e) { super(), Cr(this, e, Mr, Er, zr, { height: 0, width: 1, elem_id: 2, elem_classes: 3, variant: 4, border_mode: 5, padding: 6, type: 16, test_id: 7, explicit_call: 8, container: 9, visible: 10, allow_overflow: 11, scale: 12, min_width: 13 }); } } const { SvelteComponent: Lr, attr: Dr, create_slot: Rr, detach: Tr, element: Ir, get_all_dirty_from_scope: jr, get_slot_changes: Hr, init: Fr, insert: Xr, safe_not_equal: Yr, transition_in: Nr, transition_out: Ur, update_slot_base: Or } = window.__gradio__svelte__internal; function Wr(l) { let e, t; const n = ( /*#slots*/ l[1].default ), i = Rr( n, l, /*$$scope*/ l[0], null ); return { c() { e = Ir("div"), i && i.c(), Dr(e, "class", "svelte-1hnfib2"); }, m(o, s) { Xr(o, e, s), i && i.m(e, null), t = !0; }, p(o, [s]) { i && i.p && (!t || s & /*$$scope*/ 1) && Or( i, n, o, /*$$scope*/ o[0], t ? Hr( n, /*$$scope*/ o[0], s, null ) : jr( /*$$scope*/ o[0] ), null ); }, i(o) { t || (Nr(i, o), t = !0); }, o(o) { Ur(i, o), t = !1; }, d(o) { o && Tr(e), i && i.d(o); } }; } function Vr(l, e, t) { let { $$slots: n = {}, $$scope: i } = e; return l.$$set = (o) => { "$$scope" in o && t(0, i = o.$$scope); }, [i, n]; } class Pr extends Lr { constructor(e) { super(), Fr(this, e, Vr, Wr, Yr, {}); } } const { SvelteComponent: Zr, attr: bo, check_outros: Kr, create_component: Gr, create_slot: Jr, destroy_component: Qr, detach: yl, element: xr, empty: $r, get_all_dirty_from_scope: ef, get_slot_changes: tf, group_outros: nf, init: lf, insert: Cl, mount_component: of, safe_not_equal: sf, set_data: af, space: rf, text: ff, toggle_class: nn, transition_in: An, transition_out: Sl, update_slot_base: uf } = window.__gradio__svelte__internal; function wo(l) { let e, t; return e = new Pr({ props: { $$slots: { default: [cf] }, $$scope: { ctx: l } } }), { c() { Gr(e.$$.fragment); }, m(n, i) { of(e, n, i), t = !0; }, p(n, i) { const o = {}; i & /*$$scope, info*/ 10 && (o.$$scope = { dirty: i, ctx: n }), e.$set(o); }, i(n) { t || (An(e.$$.fragment, n), t = !0); }, o(n) { Sl(e.$$.fragment, n), t = !1; }, d(n) { Qr(e, n); } }; } function cf(l) { let e; return { c() { e = ff( /*info*/ l[1] ); }, m(t, n) { Cl(t, e, n); }, p(t, n) { n & /*info*/ 2 && af( e, /*info*/ t[1] ); }, d(t) { t && yl(e); } }; } function _f(l) { let e, t, n, i; const o = ( /*#slots*/ l[2].default ), s = Jr( o, l, /*$$scope*/ l[3], null ); let r = ( /*info*/ l[1] && wo(l) ); return { c() { e = xr("span"), s && s.c(), t = rf(), r && r.c(), n = $r(), bo(e, "data-testid", "block-info"), bo(e, "class", "svelte-22c38v"), nn(e, "sr-only", !/*show_label*/ l[0]), nn(e, "hide", !/*show_label*/ l[0]), nn( e, "has-info", /*info*/ l[1] != null ); }, m(a, f) { Cl(a, e, f), s && s.m(e, null), Cl(a, t, f), r && r.m(a, f), Cl(a, n, f), i = !0; }, p(a, [f]) { s && s.p && (!i || f & /*$$scope*/ 8) && uf( s, o, a, /*$$scope*/ a[3], i ? tf( o, /*$$scope*/ a[3], f, null ) : ef( /*$$scope*/ a[3] ), null ), (!i || f & /*show_label*/ 1) && nn(e, "sr-only", !/*show_label*/ a[0]), (!i || f & /*show_label*/ 1) && nn(e, "hide", !/*show_label*/ a[0]), (!i || f & /*info*/ 2) && nn( e, "has-info", /*info*/ a[1] != null ), /*info*/ a[1] ? r ? (r.p(a, f), f & /*info*/ 2 && An(r, 1)) : (r = wo(a), r.c(), An(r, 1), r.m(n.parentNode, n)) : r && (nf(), Sl(r, 1, 1, () => { r = null; }), Kr()); }, i(a) { i || (An(s, a), An(r), i = !0); }, o(a) { Sl(s, a), Sl(r), i = !1; }, d(a) { a && (yl(e), yl(t), yl(n)), s && s.d(a), r && r.d(a); } }; } function df(l, e, t) { let { $$slots: n = {}, $$scope: i } = e, { show_label: o = !0 } = e, { info: s = void 0 } = e; return l.$$set = (r) => { "show_label" in r && t(0, o = r.show_label), "info" in r && t(1, s = r.info), "$$scope" in r && t(3, i = r.$$scope); }, [o, s, n, i]; } class aa extends Zr { constructor(e) { super(), lf(this, e, df, _f, sf, { show_label: 0, info: 1 }); } } const { SvelteComponent: hf, append: ii, attr: ol, create_component: mf, destroy_component: gf, detach: bf, element: po, init: wf, insert: pf, mount_component: vf, safe_not_equal: kf, set_data: yf, space: Cf, text: Sf, toggle_class: pt, transition_in: zf, transition_out: Bf } = window.__gradio__svelte__internal; function qf(l) { let e, t, n, i, o, s; return n = new /*Icon*/ l[1]({}), { c() { e = po("label"), t = po("span"), mf(n.$$.fragment), i = Cf(), o = Sf( /*label*/ l[0] ), ol(t, "class", "svelte-9gxdi0"), ol(e, "for", ""), ol(e, "data-testid", "block-label"), ol(e, "class", "svelte-9gxdi0"), pt(e, "hide", !/*show_label*/ l[2]), pt(e, "sr-only", !/*show_label*/ l[2]), pt( e, "float", /*float*/ l[4] ), pt( e, "hide-label", /*disable*/ l[3] ); }, m(r, a) { pf(r, e, a), ii(e, t), vf(n, t, null), ii(e, i), ii(e, o), s = !0; }, p(r, [a]) { (!s || a & /*label*/ 1) && yf( o, /*label*/ r[0] ), (!s || a & /*show_label*/ 4) && pt(e, "hide", !/*show_label*/ r[2]), (!s || a & /*show_label*/ 4) && pt(e, "sr-only", !/*show_label*/ r[2]), (!s || a & /*float*/ 16) && pt( e, "float", /*float*/ r[4] ), (!s || a & /*disable*/ 8) && pt( e, "hide-label", /*disable*/ r[3] ); }, i(r) { s || (zf(n.$$.fragment, r), s = !0); }, o(r) { Bf(n.$$.fragment, r), s = !1; }, d(r) { r && bf(e), gf(n); } }; } function Ef(l, e, t) { let { label: n = null } = e, { Icon: i } = e, { show_label: o = !0 } = e, { disable: s = !1 } = e, { float: r = !0 } = e; return l.$$set = (a) => { "label" in a && t(0, n = a.label), "Icon" in a && t(1, i = a.Icon), "show_label" in a && t(2, o = a.show_label), "disable" in a && t(3, s = a.disable), "float" in a && t(4, r = a.float); }, [n, i, o, s, r]; } class Mf extends hf { constructor(e) { super(), wf(this, e, Ef, qf, kf, { label: 0, Icon: 1, show_label: 2, disable: 3, float: 4 }); } } const { SvelteComponent: Af, append: Xi, attr: ft, bubble: Lf, create_component: Df, destroy_component: Rf, detach: ra, element: Yi, init: Tf, insert: fa, listen: If, mount_component: jf, safe_not_equal: Hf, set_data: Ff, set_style: ln, space: Xf, text: Yf, toggle_class: ye, transition_in: Nf, transition_out: Uf } = window.__gradio__svelte__internal; function vo(l) { let e, t; return { c() { e = Yi("span"), t = Yf( /*label*/ l[1] ), ft(e, "class", "svelte-1lrphxw"); }, m(n, i) { fa(n, e, i), Xi(e, t); }, p(n, i) { i & /*label*/ 2 && Ff( t, /*label*/ n[1] ); }, d(n) { n && ra(e); } }; } function Of(l) { let e, t, n, i, o, s, r, a = ( /*show_label*/ l[2] && vo(l) ); return i = new /*Icon*/ l[0]({}), { c() { e = Yi("button"), a && a.c(), t = Xf(), n = Yi("div"), Df(i.$$.fragment), ft(n, "class", "svelte-1lrphxw"), ye( n, "small", /*size*/ l[4] === "small" ), ye( n, "large", /*size*/ l[4] === "large" ), ye( n, "medium", /*size*/ l[4] === "medium" ), e.disabled = /*disabled*/ l[7], ft( e, "aria-label", /*label*/ l[1] ), ft( e, "aria-haspopup", /*hasPopup*/ l[8] ), ft( e, "title", /*label*/ l[1] ), ft(e, "class", "svelte-1lrphxw"), ye( e, "pending", /*pending*/ l[3] ), ye( e, "padded", /*padded*/ l[5] ), ye( e, "highlight", /*highlight*/ l[6] ), ye( e, "transparent", /*transparent*/ l[9] ), ln(e, "color", !/*disabled*/ l[7] && /*_color*/ l[12] ? ( /*_color*/ l[12] ) : "var(--block-label-text-color)"), ln(e, "--bg-color", /*disabled*/ l[7] ? "auto" : ( /*background*/ l[10] )), ln( e, "margin-left", /*offset*/ l[11] + "px" ); }, m(f, u) { fa(f, e, u), a && a.m(e, null), Xi(e, t), Xi(e, n), jf(i, n, null), o = !0, s || (r = If( e, "click", /*click_handler*/ l[14] ), s = !0); }, p(f, [u]) { /*show_label*/ f[2] ? a ? a.p(f, u) : (a = vo(f), a.c(), a.m(e, t)) : a && (a.d(1), a = null), (!o || u & /*size*/ 16) && ye( n, "small", /*size*/ f[4] === "small" ), (!o || u & /*size*/ 16) && ye( n, "large", /*size*/ f[4] === "large" ), (!o || u & /*size*/ 16) && ye( n, "medium", /*size*/ f[4] === "medium" ), (!o || u & /*disabled*/ 128) && (e.disabled = /*disabled*/ f[7]), (!o || u & /*label*/ 2) && ft( e, "aria-label", /*label*/ f[1] ), (!o || u & /*hasPopup*/ 256) && ft( e, "aria-haspopup", /*hasPopup*/ f[8] ), (!o || u & /*label*/ 2) && ft( e, "title", /*label*/ f[1] ), (!o || u & /*pending*/ 8) && ye( e, "pending", /*pending*/ f[3] ), (!o || u & /*padded*/ 32) && ye( e, "padded", /*padded*/ f[5] ), (!o || u & /*highlight*/ 64) && ye( e, "highlight", /*highlight*/ f[6] ), (!o || u & /*transparent*/ 512) && ye( e, "transparent", /*transparent*/ f[9] ), u & /*disabled, _color*/ 4224 && ln(e, "color", !/*disabled*/ f[7] && /*_color*/ f[12] ? ( /*_color*/ f[12] ) : "var(--block-label-text-color)"), u & /*disabled, background*/ 1152 && ln(e, "--bg-color", /*disabled*/ f[7] ? "auto" : ( /*background*/ f[10] )), u & /*offset*/ 2048 && ln( e, "margin-left", /*offset*/ f[11] + "px" ); }, i(f) { o || (Nf(i.$$.fragment, f), o = !0); }, o(f) { Uf(i.$$.fragment, f), o = !1; }, d(f) { f && ra(e), a && a.d(), Rf(i), s = !1, r(); } }; } function Wf(l, e, t) { let n, { Icon: i } = e, { label: o = "" } = e, { show_label: s = !1 } = e, { pending: r = !1 } = e, { size: a = "small" } = e, { padded: f = !0 } = e, { highlight: u = !1 } = e, { disabled: c = !1 } = e, { hasPopup: _ = !1 } = e, { color: d = "var(--block-label-text-color)" } = e, { transparent: h = !1 } = e, { background: m = "var(--background-fill-primary)" } = e, { offset: w = 0 } = e; function b(p) { Lf.call(this, l, p); } return l.$$set = (p) => { "Icon" in p && t(0, i = p.Icon), "label" in p && t(1, o = p.label), "show_label" in p && t(2, s = p.show_label), "pending" in p && t(3, r = p.pending), "size" in p && t(4, a = p.size), "padded" in p && t(5, f = p.padded), "highlight" in p && t(6, u = p.highlight), "disabled" in p && t(7, c = p.disabled), "hasPopup" in p && t(8, _ = p.hasPopup), "color" in p && t(13, d = p.color), "transparent" in p && t(9, h = p.transparent), "background" in p && t(10, m = p.background), "offset" in p && t(11, w = p.offset); }, l.$$.update = () => { l.$$.dirty & /*highlight, color*/ 8256 && t(12, n = u ? "var(--color-accent)" : d); }, [ i, o, s, r, a, f, u, c, _, h, m, w, n, d, b ]; } class Vl extends Af { constructor(e) { super(), Tf(this, e, Wf, Of, Hf, { Icon: 0, label: 1, show_label: 2, pending: 3, size: 4, padded: 5, highlight: 6, disabled: 7, hasPopup: 8, color: 13, transparent: 9, background: 10, offset: 11 }); } } const { SvelteComponent: Vf, append: Pf, attr: oi, binding_callbacks: Zf, create_slot: Kf, detach: Gf, element: ko, get_all_dirty_from_scope: Jf, get_slot_changes: Qf, init: xf, insert: $f, safe_not_equal: eu, toggle_class: vt, transition_in: tu, transition_out: nu, update_slot_base: lu } = window.__gradio__svelte__internal; function iu(l) { let e, t, n; const i = ( /*#slots*/ l[5].default ), o = Kf( i, l, /*$$scope*/ l[4], null ); return { c() { e = ko("div"), t = ko("div"), o && o.c(), oi(t, "class", "icon svelte-3w3rth"), oi(e, "class", "empty svelte-3w3rth"), oi(e, "aria-label", "Empty value"), vt( e, "small", /*size*/ l[0] === "small" ), vt( e, "large", /*size*/ l[0] === "large" ), vt( e, "unpadded_box", /*unpadded_box*/ l[1] ), vt( e, "small_parent", /*parent_height*/ l[3] ); }, m(s, r) { $f(s, e, r), Pf(e, t), o && o.m(t, null), l[6](e), n = !0; }, p(s, [r]) { o && o.p && (!n || r & /*$$scope*/ 16) && lu( o, i, s, /*$$scope*/ s[4], n ? Qf( i, /*$$scope*/ s[4], r, null ) : Jf( /*$$scope*/ s[4] ), null ), (!n || r & /*size*/ 1) && vt( e, "small", /*size*/ s[0] === "small" ), (!n || r & /*size*/ 1) && vt( e, "large", /*size*/ s[0] === "large" ), (!n || r & /*unpadded_box*/ 2) && vt( e, "unpadded_box", /*unpadded_box*/ s[1] ), (!n || r & /*parent_height*/ 8) && vt( e, "small_parent", /*parent_height*/ s[3] ); }, i(s) { n || (tu(o, s), n = !0); }, o(s) { nu(o, s), n = !1; }, d(s) { s && Gf(e), o && o.d(s), l[6](null); } }; } function ou(l, e, t) { let n, { $$slots: i = {}, $$scope: o } = e, { size: s = "small" } = e, { unpadded_box: r = !1 } = e, a; function f(c) { var _; if (!c) return !1; const { height: d } = c.getBoundingClientRect(), { height: h } = ((_ = c.parentElement) === null || _ === void 0 ? void 0 : _.getBoundingClientRect()) || { height: d }; return d > h + 2; } function u(c) { Zf[c ? "unshift" : "push"](() => { a = c, t(2, a); }); } return l.$$set = (c) => { "size" in c && t(0, s = c.size), "unpadded_box" in c && t(1, r = c.unpadded_box), "$$scope" in c && t(4, o = c.$$scope); }, l.$$.update = () => { l.$$.dirty & /*el*/ 4 && t(3, n = f(a)); }, [s, r, a, n, o, i, u]; } class su extends Vf { constructor(e) { super(), xf(this, e, ou, iu, eu, { size: 0, unpadded_box: 1 }); } } const { SvelteComponent: au, append: yo, attr: Ce, detach: ru, init: fu, insert: uu, noop: si, safe_not_equal: cu, svg_element: ai } = window.__gradio__svelte__internal; function _u(l) { let e, t, n; return { c() { e = ai("svg"), t = ai("path"), n = ai("circle"), Ce(t, "d", "M23 19a2 2 0 0 1-2 2H3a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h4l2-3h6l2 3h4a2 2 0 0 1 2 2z"), Ce(n, "cx", "12"), Ce(n, "cy", "13"), Ce(n, "r", "4"), Ce(e, "xmlns", "http://www.w3.org/2000/svg"), Ce(e, "width", "100%"), Ce(e, "height", "100%"), Ce(e, "viewBox", "0 0 24 24"), Ce(e, "fill", "none"), Ce(e, "stroke", "currentColor"), Ce(e, "stroke-width", "1.5"), Ce(e, "stroke-linecap", "round"), Ce(e, "stroke-linejoin", "round"), Ce(e, "class", "feather feather-camera"); }, m(i, o) { uu(i, e, o), yo(e, t), yo(e, n); }, p: si, i: si, o: si, d(i) { i && ru(e); } }; } class du extends au { constructor(e) { super(), fu(this, e, null, _u, cu, {}); } } const { SvelteComponent: hu, append: mu, attr: Oe, detach: gu, init: bu, insert: wu, noop: ri, safe_not_equal: pu, svg_element: Co } = window.__gradio__svelte__internal; function vu(l) { let e, t; return { c() { e = Co("svg"), t = Co("circle"), Oe(t, "cx", "12"), Oe(t, "cy", "12"), Oe(t, "r", "10"), Oe(e, "xmlns", "http://www.w3.org/2000/svg"), Oe(e, "width", "100%"), Oe(e, "height", "100%"), Oe(e, "viewBox", "0 0 24 24"), Oe(e, "stroke-width", "1.5"), Oe(e, "stroke-linecap", "round"), Oe(e, "stroke-linejoin", "round"), Oe(e, "class", "feather feather-circle"); }, m(n, i) { wu(n, e, i), mu(e, t); }, p: ri, i: ri, o: ri, d(n) { n && gu(e); } }; } class ku extends hu { constructor(e) { super(), bu(this, e, null, vu, pu, {}); } } const { SvelteComponent: yu, append: fi, attr: We, detach: Cu, init: Su, insert: zu, noop: ui, safe_not_equal: Bu, set_style: $e, svg_element: sl } = window.__gradio__svelte__internal; function qu(l) { let e, t, n, i; return { c() { e = sl("svg"), t = sl("g"), n = sl("path"), i = sl("path"), We(n, "d", "M18,6L6.087,17.913"), $e(n, "fill", "none"), $e(n, "fill-rule", "nonzero"), $e(n, "stroke-width", "2px"), We(t, "transform", "matrix(1.14096,-0.140958,-0.140958,1.14096,-0.0559523,0.0559523)"), We(i, "d", "M4.364,4.364L19.636,19.636"), $e(i, "fill", "none"), $e(i, "fill-rule", "nonzero"), $e(i, "stroke-width", "2px"), We(e, "width", "100%"), We(e, "height", "100%"), We(e, "viewBox", "0 0 24 24"), We(e, "version", "1.1"), We(e, "xmlns", "http://www.w3.org/2000/svg"), We(e, "xmlns:xlink", "http://www.w3.org/1999/xlink"), We(e, "xml:space", "preserve"), We(e, "stroke", "currentColor"), $e(e, "fill-rule", "evenodd"), $e(e, "clip-rule", "evenodd"), $e(e, "stroke-linecap", "round"), $e(e, "stroke-linejoin", "round"); }, m(o, s) { zu(o, e, s), fi(e, t), fi(t, n), fi(e, i); }, p: ui, i: ui, o: ui, d(o) { o && Cu(e); } }; } class ua extends yu { constructor(e) { super(), Su(this, e, null, qu, Bu, {}); } } const { SvelteComponent: Eu, append: Mu, attr: zn, detach: Au, init: Lu, insert: Du, noop: ci, safe_not_equal: Ru, svg_element: So } = window.__gradio__svelte__internal; function Tu(l) { let e, t; return { c() { e = So("svg"), t = So("path"), zn(t, "d", "M23,20a5,5,0,0,0-3.89,1.89L11.8,17.32a4.46,4.46,0,0,0,0-2.64l7.31-4.57A5,5,0,1,0,18,7a4.79,4.79,0,0,0,.2,1.32l-7.31,4.57a5,5,0,1,0,0,6.22l7.31,4.57A4.79,4.79,0,0,0,18,25a5,5,0,1,0,5-5ZM23,4a3,3,0,1,1-3,3A3,3,0,0,1,23,4ZM7,19a3,3,0,1,1,3-3A3,3,0,0,1,7,19Zm16,9a3,3,0,1,1,3-3A3,3,0,0,1,23,28Z"), zn(t, "fill", "currentColor"), zn(e, "id", "icon"), zn(e, "xmlns", "http://www.w3.org/2000/svg"), zn(e, "viewBox", "0 0 32 32"); }, m(n, i) { Du(n, e, i), Mu(e, t); }, p: ci, i: ci, o: ci, d(n) { n && Au(e); } }; } class Iu extends Eu { constructor(e) { super(), Lu(this, e, null, Tu, Ru, {}); } } const { SvelteComponent: ju, append: Hu, attr: on, detach: Fu, init: Xu, insert: Yu, noop: _i, safe_not_equal: Nu, svg_element: zo } = window.__gradio__svelte__internal; function Uu(l) { let e, t; return { c() { e = zo("svg"), t = zo("path"), on(t, "fill", "currentColor"), on(t, "d", "M26 24v4H6v-4H4v4a2 2 0 0 0 2 2h20a2 2 0 0 0 2-2v-4zm0-10l-1.41-1.41L17 20.17V2h-2v18.17l-7.59-7.58L6 14l10 10l10-10z"), on(e, "xmlns", "http://www.w3.org/2000/svg"), on(e, "width", "100%"), on(e, "height", "100%"), on(e, "viewBox", "0 0 32 32"); }, m(n, i) { Yu(n, e, i), Hu(e, t); }, p: _i, i: _i, o: _i, d(n) { n && Fu(e); } }; } class Ou extends ju { constructor(e) { super(), Xu(this, e, null, Uu, Nu, {}); } } const { SvelteComponent: Wu, append: Vu, attr: sn, detach: Pu, init: Zu, insert: Ku, noop: di, safe_not_equal: Gu, svg_element: Bo } = window.__gradio__svelte__internal; function Ju(l) { let e, t; return { c() { e = Bo("svg"), t = Bo("path"), sn(t, "d", "M5 8l4 4 4-4z"), sn(e, "class", "dropdown-arrow svelte-145leq6"), sn(e, "xmlns", "http://www.w3.org/2000/svg"), sn(e, "width", "100%"), sn(e, "height", "100%"), sn(e, "viewBox", "0 0 18 18"); }, m(n, i) { Ku(n, e, i), Vu(e, t); }, p: di, i: di, o: di, d(n) { n && Pu(e); } }; } class io extends Wu { constructor(e) { super(), Zu(this, e, null, Ju, Gu, {}); } } const { SvelteComponent: Qu, append: hi, attr: se, detach: xu, init: $u, insert: ec, noop: mi, safe_not_equal: tc, svg_element: al } = window.__gradio__svelte__internal; function nc(l) { let e, t, n, i; return { c() { e = al("svg"), t = al("rect"), n = al("circle"), i = al("polyline"), se(t, "x", "3"), se(t, "y", "3"), se(t, "width", "18"), se(t, "height", "18"), se(t, "rx", "2"), se(t, "ry", "2"), se(n, "cx", "8.5"), se(n, "cy", "8.5"), se(n, "r", "1.5"), se(i, "points", "21 15 16 10 5 21"), se(e, "xmlns", "http://www.w3.org/2000/svg"), se(e, "width", "100%"), se(e, "height", "100%"), se(e, "viewBox", "0 0 24 24"), se(e, "fill", "none"), se(e, "stroke", "currentColor"), se(e, "stroke-width", "1.5"), se(e, "stroke-linecap", "round"), se(e, "stroke-linejoin", "round"), se(e, "class", "feather feather-image"); }, m(o, s) { ec(o, e, s), hi(e, t), hi(e, n), hi(e, i); }, p: mi, i: mi, o: mi, d(o) { o && xu(e); } }; } let ca = class extends Qu { constructor(e) { super(), $u(this, e, null, nc, tc, {}); } }; const { SvelteComponent: lc, append: ic, attr: rl, detach: oc, init: sc, insert: ac, noop: gi, safe_not_equal: rc, svg_element: qo } = window.__gradio__svelte__internal; function fc(l) { let e, t; return { c() { e = qo("svg"), t = qo("path"), rl(t, "fill", "currentColor"), rl(t, "d", "M13.75 2a2.25 2.25 0 0 1 2.236 2.002V4h1.764A2.25 2.25 0 0 1 20 6.25V11h-1.5V6.25a.75.75 0 0 0-.75-.75h-2.129c-.404.603-1.091 1-1.871 1h-3.5c-.78 0-1.467-.397-1.871-1H6.25a.75.75 0 0 0-.75.75v13.5c0 .414.336.75.75.75h4.78a4 4 0 0 0 .505 1.5H6.25A2.25 2.25 0 0 1 4 19.75V6.25A2.25 2.25 0 0 1 6.25 4h1.764a2.25 2.25 0 0 1 2.236-2zm2.245 2.096L16 4.25q0-.078-.005-.154M13.75 3.5h-3.5a.75.75 0 0 0 0 1.5h3.5a.75.75 0 0 0 0-1.5M15 12a3 3 0 0 0-3 3v5c0 .556.151 1.077.415 1.524l3.494-3.494a2.25 2.25 0 0 1 3.182 0l3.494 3.494c.264-.447.415-.968.415-1.524v-5a3 3 0 0 0-3-3zm0 11a3 3 0 0 1-1.524-.415l3.494-3.494a.75.75 0 0 1 1.06 0l3.494 3.494A3 3 0 0 1 20 23zm5-7a1 1 0 1 1 0-2 1 1 0 0 1 0 2"), rl(e, "xmlns", "http://www.w3.org/2000/svg"), rl(e, "viewBox", "0 0 24 24"); }, m(n, i) { ac(n, e, i), ic(e, t); }, p: gi, i: gi, o: gi, d(n) { n && oc(e); } }; } class _a extends lc { constructor(e) { super(), sc(this, e, null, fc, rc, {}); } } const { SvelteComponent: uc, append: fl, attr: ae, detach: cc, init: _c, insert: dc, noop: bi, safe_not_equal: hc, svg_element: Bn } = window.__gradio__svelte__internal; function mc(l) { let e, t, n, i, o; return { c() { e = Bn("svg"), t = Bn("path"), n = Bn("path"), i = Bn("line"), o = Bn("line"), ae(t, "d", "M12 1a3 3 0 0 0-3 3v8a3 3 0 0 0 6 0V4a3 3 0 0 0-3-3z"), ae(n, "d", "M19 10v2a7 7 0 0 1-14 0v-2"), ae(i, "x1", "12"), ae(i, "y1", "19"), ae(i, "x2", "12"), ae(i, "y2", "23"), ae(o, "x1", "8"), ae(o, "y1", "23"), ae(o, "x2", "16"), ae(o, "y2", "23"), ae(e, "xmlns", "http://www.w3.org/2000/svg"), ae(e, "width", "100%"), ae(e, "height", "100%"), ae(e, "viewBox", "0 0 24 24"), ae(e, "fill", "none"), ae(e, "stroke", "currentColor"), ae(e, "stroke-width", "2"), ae(e, "stroke-linecap", "round"), ae(e, "stroke-linejoin", "round"), ae(e, "class", "feather feather-mic"); }, m(s, r) { dc(s, e, r), fl(e, t), fl(e, n), fl(e, i), fl(e, o); }, p: bi, i: bi, o: bi, d(s) { s && cc(e); } }; } class gc extends uc { constructor(e) { super(), _c(this, e, null, mc, hc, {}); } } const { SvelteComponent: bc, append: wc, attr: Se, detach: pc, init: vc, insert: kc, noop: wi, safe_not_equal: yc, svg_element: Eo } = window.__gradio__svelte__internal; function Cc(l) { let e, t; return { c() { e = Eo("svg"), t = Eo("rect"), Se(t, "x", "3"), Se(t, "y", "3"), Se(t, "width", "18"), Se(t, "height", "18"), Se(t, "rx", "2"), Se(t, "ry", "2"), Se(e, "xmlns", "http://www.w3.org/2000/svg"), Se(e, "width", "100%"), Se(e, "height", "100%"), Se(e, "viewBox", "0 0 24 24"), Se(e, "stroke-width", "1.5"), Se(e, "stroke-linecap", "round"), Se(e, "stroke-linejoin", "round"), Se(e, "class", "feather feather-square"); }, m(n, i) { kc(n, e, i), wc(e, t); }, p: wi, i: wi, o: wi, d(n) { n && pc(e); } }; } class Sc extends bc { constructor(e) { super(), vc(this, e, null, Cc, yc, {}); } } const { SvelteComponent: zc, append: pi, attr: we, detach: Bc, init: qc, insert: Ec, noop: vi, safe_not_equal: Mc, svg_element: ul } = window.__gradio__svelte__internal; function Ac(l) { let e, t, n, i; return { c() { e = ul("svg"), t = ul("path"), n = ul("polyline"), i = ul("line"), we(t, "d", "M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4"), we(n, "points", "17 8 12 3 7 8"), we(i, "x1", "12"), we(i, "y1", "3"), we(i, "x2", "12"), we(i, "y2", "15"), we(e, "xmlns", "http://www.w3.org/2000/svg"), we(e, "width", "90%"), we(e, "height", "90%"), we(e, "viewBox", "0 0 24 24"), we(e, "fill", "none"), we(e, "stroke", "currentColor"), we(e, "stroke-width", "2"), we(e, "stroke-linecap", "round"), we(e, "stroke-linejoin", "round"), we(e, "class", "feather feather-upload"); }, m(o, s) { Ec(o, e, s), pi(e, t), pi(e, n), pi(e, i); }, p: vi, i: vi, o: vi, d(o) { o && Bc(e); } }; } let da = class extends zc { constructor(e) { super(), qc(this, e, null, Ac, Mc, {}); } }; const { SvelteComponent: Lc, append: Mo, attr: kt, detach: Dc, init: Rc, insert: Tc, noop: ki, safe_not_equal: Ic, svg_element: yi } = window.__gradio__svelte__internal; function jc(l) { let e, t, n; return { c() { e = yi("svg"), t = yi("path"), n = yi("path"), kt(t, "fill", "currentColor"), kt(t, "d", "M12 2c-4.963 0-9 4.038-9 9c0 3.328 1.82 6.232 4.513 7.79l-2.067 1.378A1 1 0 0 0 6 22h12a1 1 0 0 0 .555-1.832l-2.067-1.378C19.18 17.232 21 14.328 21 11c0-4.962-4.037-9-9-9zm0 16c-3.859 0-7-3.141-7-7c0-3.86 3.141-7 7-7s7 3.14 7 7c0 3.859-3.141 7-7 7z"), kt(n, "fill", "currentColor"), kt(n, "d", "M12 6c-2.757 0-5 2.243-5 5s2.243 5 5 5s5-2.243 5-5s-2.243-5-5-5zm0 8c-1.654 0-3-1.346-3-3s1.346-3 3-3s3 1.346 3 3s-1.346 3-3 3z"), kt(e, "xmlns", "http://www.w3.org/2000/svg"), kt(e, "width", "100%"), kt(e, "height", "100%"), kt(e, "viewBox", "0 0 24 24"); }, m(i, o) { Tc(i, e, o), Mo(e, t), Mo(e, n); }, p: ki, i: ki, o: ki, d(i) { i && Dc(e); } }; } let ha = class extends Lc { constructor(e) { super(), Rc(this, e, null, jc, Ic, {}); } }; const Hc = [ { color: "red", primary: 600, secondary: 100 }, { color: "green", primary: 600, secondary: 100 }, { color: "blue", primary: 600, secondary: 100 }, { color: "yellow", primary: 500, secondary: 100 }, { color: "purple", primary: 600, secondary: 100 }, { color: "teal", primary: 600, secondary: 100 }, { color: "orange", primary: 600, secondary: 100 }, { color: "cyan", primary: 600, secondary: 100 }, { color: "lime", primary: 500, secondary: 100 }, { color: "pink", primary: 600, secondary: 100 } ], Ao = { inherit: "inherit", current: "currentColor", transparent: "transparent", black: "#000", white: "#fff", slate: { 50: "#f8fafc", 100: "#f1f5f9", 200: "#e2e8f0", 300: "#cbd5e1", 400: "#94a3b8", 500: "#64748b", 600: "#475569", 700: "#334155", 800: "#1e293b", 900: "#0f172a", 950: "#020617" }, gray: { 50: "#f9fafb", 100: "#f3f4f6", 200: "#e5e7eb", 300: "#d1d5db", 400: "#9ca3af", 500: "#6b7280", 600: "#4b5563", 700: "#374151", 800: "#1f2937", 900: "#111827", 950: "#030712" }, zinc: { 50: "#fafafa", 100: "#f4f4f5", 200: "#e4e4e7", 300: "#d4d4d8", 400: "#a1a1aa", 500: "#71717a", 600: "#52525b", 700: "#3f3f46", 800: "#27272a", 900: "#18181b", 950: "#09090b" }, neutral: { 50: "#fafafa", 100: "#f5f5f5", 200: "#e5e5e5", 300: "#d4d4d4", 400: "#a3a3a3", 500: "#737373", 600: "#525252", 700: "#404040", 800: "#262626", 900: "#171717", 950: "#0a0a0a" }, stone: { 50: "#fafaf9", 100: "#f5f5f4", 200: "#e7e5e4", 300: "#d6d3d1", 400: "#a8a29e", 500: "#78716c", 600: "#57534e", 700: "#44403c", 800: "#292524", 900: "#1c1917", 950: "#0c0a09" }, red: { 50: "#fef2f2", 100: "#fee2e2", 200: "#fecaca", 300: "#fca5a5", 400: "#f87171", 500: "#ef4444", 600: "#dc2626", 700: "#b91c1c", 800: "#991b1b", 900: "#7f1d1d", 950: "#450a0a" }, orange: { 50: "#fff7ed", 100: "#ffedd5", 200: "#fed7aa", 300: "#fdba74", 400: "#fb923c", 500: "#f97316", 600: "#ea580c", 700: "#c2410c", 800: "#9a3412", 900: "#7c2d12", 950: "#431407" }, amber: { 50: "#fffbeb", 100: "#fef3c7", 200: "#fde68a", 300: "#fcd34d", 400: "#fbbf24", 500: "#f59e0b", 600: "#d97706", 700: "#b45309", 800: "#92400e", 900: "#78350f", 950: "#451a03" }, yellow: { 50: "#fefce8", 100: "#fef9c3", 200: "#fef08a", 300: "#fde047", 400: "#facc15", 500: "#eab308", 600: "#ca8a04", 700: "#a16207", 800: "#854d0e", 900: "#713f12", 950: "#422006" }, lime: { 50: "#f7fee7", 100: "#ecfccb", 200: "#d9f99d", 300: "#bef264", 400: "#a3e635", 500: "#84cc16", 600: "#65a30d", 700: "#4d7c0f", 800: "#3f6212", 900: "#365314", 950: "#1a2e05" }, green: { 50: "#f0fdf4", 100: "#dcfce7", 200: "#bbf7d0", 300: "#86efac", 400: "#4ade80", 500: "#22c55e", 600: "#16a34a", 700: "#15803d", 800: "#166534", 900: "#14532d", 950: "#052e16" }, emerald: { 50: "#ecfdf5", 100: "#d1fae5", 200: "#a7f3d0", 300: "#6ee7b7", 400: "#34d399", 500: "#10b981", 600: "#059669", 700: "#047857", 800: "#065f46", 900: "#064e3b", 950: "#022c22" }, teal: { 50: "#f0fdfa", 100: "#ccfbf1", 200: "#99f6e4", 300: "#5eead4", 400: "#2dd4bf", 500: "#14b8a6", 600: "#0d9488", 700: "#0f766e", 800: "#115e59", 900: "#134e4a", 950: "#042f2e" }, cyan: { 50: "#ecfeff", 100: "#cffafe", 200: "#a5f3fc", 300: "#67e8f9", 400: "#22d3ee", 500: "#06b6d4", 600: "#0891b2", 700: "#0e7490", 800: "#155e75", 900: "#164e63", 950: "#083344" }, sky: { 50: "#f0f9ff", 100: "#e0f2fe", 200: "#bae6fd", 300: "#7dd3fc", 400: "#38bdf8", 500: "#0ea5e9", 600: "#0284c7", 700: "#0369a1", 800: "#075985", 900: "#0c4a6e", 950: "#082f49" }, blue: { 50: "#eff6ff", 100: "#dbeafe", 200: "#bfdbfe", 300: "#93c5fd", 400: "#60a5fa", 500: "#3b82f6", 600: "#2563eb", 700: "#1d4ed8", 800: "#1e40af", 900: "#1e3a8a", 950: "#172554" }, indigo: { 50: "#eef2ff", 100: "#e0e7ff", 200: "#c7d2fe", 300: "#a5b4fc", 400: "#818cf8", 500: "#6366f1", 600: "#4f46e5", 700: "#4338ca", 800: "#3730a3", 900: "#312e81", 950: "#1e1b4b" }, violet: { 50: "#f5f3ff", 100: "#ede9fe", 200: "#ddd6fe", 300: "#c4b5fd", 400: "#a78bfa", 500: "#8b5cf6", 600: "#7c3aed", 700: "#6d28d9", 800: "#5b21b6", 900: "#4c1d95", 950: "#2e1065" }, purple: { 50: "#faf5ff", 100: "#f3e8ff", 200: "#e9d5ff", 300: "#d8b4fe", 400: "#c084fc", 500: "#a855f7", 600: "#9333ea", 700: "#7e22ce", 800: "#6b21a8", 900: "#581c87", 950: "#3b0764" }, fuchsia: { 50: "#fdf4ff", 100: "#fae8ff", 200: "#f5d0fe", 300: "#f0abfc", 400: "#e879f9", 500: "#d946ef", 600: "#c026d3", 700: "#a21caf", 800: "#86198f", 900: "#701a75", 950: "#4a044e" }, pink: { 50: "#fdf2f8", 100: "#fce7f3", 200: "#fbcfe8", 300: "#f9a8d4", 400: "#f472b6", 500: "#ec4899", 600: "#db2777", 700: "#be185d", 800: "#9d174d", 900: "#831843", 950: "#500724" }, rose: { 50: "#fff1f2", 100: "#ffe4e6", 200: "#fecdd3", 300: "#fda4af", 400: "#fb7185", 500: "#f43f5e", 600: "#e11d48", 700: "#be123c", 800: "#9f1239", 900: "#881337", 950: "#4c0519" } }; Hc.reduce( (l, { color: e, primary: t, secondary: n }) => ({ ...l, [e]: { primary: Ao[e][t], secondary: Ao[e][n] } }), {} ); class zl extends Error { constructor(e) { super(e), this.name = "ShareError"; } } async function Fc(l, e) { var a; if (window.__gradio_space__ == null) throw new zl("Must be on Spaces to share."); let t, n, i; t = Xc(l), n = l.split(";")[0].split(":")[1], i = "file" + n.split("/")[1]; const o = new File([t], i, { type: n }), s = await fetch("https://huggingface.co/uploads", { method: "POST", body: o, headers: { "Content-Type": o.type, "X-Requested-With": "XMLHttpRequest" } }); if (!s.ok) { if ((a = s.headers.get("content-type")) != null && a.includes("application/json")) { const f = await s.json(); throw new zl(`Upload failed: ${f.error}`); } throw new zl("Upload failed."); } return await s.text(); } function Xc(l) { for (var e = l.split(","), t = e[0].match(/:(.*?);/)[1], n = atob(e[1]), i = n.length, o = new Uint8Array(i); i--; ) o[i] = n.charCodeAt(i); return new Blob([o], { type: t }); } const { SvelteComponent: Yc, create_component: Nc, destroy_component: Uc, init: Oc, mount_component: Wc, safe_not_equal: Vc, transition_in: Pc, transition_out: Zc } = window.__gradio__svelte__internal, { createEventDispatcher: Kc } = window.__gradio__svelte__internal; function Gc(l) { let e, t; return e = new Vl({ props: { Icon: Iu, label: ( /*i18n*/ l[2]("common.share") ), pending: ( /*pending*/ l[3] ) } }), e.$on( "click", /*click_handler*/ l[5] ), { c() { Nc(e.$$.fragment); }, m(n, i) { Wc(e, n, i), t = !0; }, p(n, [i]) { const o = {}; i & /*i18n*/ 4 && (o.label = /*i18n*/ n[2]("common.share")), i & /*pending*/ 8 && (o.pending = /*pending*/ n[3]), e.$set(o); }, i(n) { t || (Pc(e.$$.fragment, n), t = !0); }, o(n) { Zc(e.$$.fragment, n), t = !1; }, d(n) { Uc(e, n); } }; } function Jc(l, e, t) { const n = Kc(); let { formatter: i } = e, { value: o } = e, { i18n: s } = e, r = !1; const a = async () => { try { t(3, r = !0); const f = await i(o); n("share", { description: f }); } catch (f) { console.error(f); let u = f instanceof zl ? f.message : "Share failed."; n("error", u); } finally { t(3, r = !1); } }; return l.$$set = (f) => { "formatter" in f && t(0, i = f.formatter), "value" in f && t(1, o = f.value), "i18n" in f && t(2, s = f.i18n); }, [i, o, s, r, n, a]; } class Qc extends Yc { constructor(e) { super(), Oc(this, e, Jc, Gc, Vc, { formatter: 0, value: 1, i18n: 2 }); } } const { SvelteComponent: xc, append: Vt, attr: Ni, check_outros: $c, create_component: ma, destroy_component: ga, detach: Bl, element: Ui, group_outros: e_, init: t_, insert: ql, mount_component: ba, safe_not_equal: n_, set_data: Oi, space: Wi, text: Ln, toggle_class: Lo, transition_in: Dl, transition_out: Rl } = window.__gradio__svelte__internal; function l_(l) { let e, t; return e = new da({}), { c() { ma(e.$$.fragment); }, m(n, i) { ba(e, n, i), t = !0; }, i(n) { t || (Dl(e.$$.fragment, n), t = !0); }, o(n) { Rl(e.$$.fragment, n), t = !1; }, d(n) { ga(e, n); } }; } function i_(l) { let e, t; return e = new _a({}), { c() { ma(e.$$.fragment); }, m(n, i) { ba(e, n, i), t = !0; }, i(n) { t || (Dl(e.$$.fragment, n), t = !0); }, o(n) { Rl(e.$$.fragment, n), t = !1; }, d(n) { ga(e, n); } }; } function Do(l) { let e, t, n = ( /*i18n*/ l[1]("common.or") + "" ), i, o, s, r = ( /*message*/ (l[2] || /*i18n*/ l[1]("upload_text.click_to_upload")) + "" ), a; return { c() { e = Ui("span"), t = Ln("- "), i = Ln(n), o = Ln(" -"), s = Wi(), a = Ln(r), Ni(e, "class", "or svelte-kzcjhc"); }, m(f, u) { ql(f, e, u), Vt(e, t), Vt(e, i), Vt(e, o), ql(f, s, u), ql(f, a, u); }, p(f, u) { u & /*i18n*/ 2 && n !== (n = /*i18n*/ f[1]("common.or") + "") && Oi(i, n), u & /*message, i18n*/ 6 && r !== (r = /*message*/ (f[2] || /*i18n*/ f[1]("upload_text.click_to_upload")) + "") && Oi(a, r); }, d(f) { f && (Bl(e), Bl(s), Bl(a)); } }; } function o_(l) { let e, t, n, i, o, s = ( /*i18n*/ l[1]( /*defs*/ l[5][ /*type*/ l[0] ] || /*defs*/ l[5].file ) + "" ), r, a, f; const u = [i_, l_], c = []; function _(h, m) { return ( /*type*/ h[0] === "clipboard" ? 0 : 1 ); } n = _(l), i = c[n] = u[n](l); let d = ( /*mode*/ l[3] !== "short" && Do(l) ); return { c() { e = Ui("div"), t = Ui("span"), i.c(), o = Wi(), r = Ln(s), a = Wi(), d && d.c(), Ni(t, "class", "icon-wrap svelte-kzcjhc"), Lo( t, "hovered", /*hovered*/ l[4] ), Ni(e, "class", "wrap svelte-kzcjhc"); }, m(h, m) { ql(h, e, m), Vt(e, t), c[n].m(t, null), Vt(e, o), Vt(e, r), Vt(e, a), d && d.m(e, null), f = !0; }, p(h, [m]) { let w = n; n = _(h), n !== w && (e_(), Rl(c[w], 1, 1, () => { c[w] = null; }), $c(), i = c[n], i || (i = c[n] = u[n](h), i.c()), Dl(i, 1), i.m(t, null)), (!f || m & /*hovered*/ 16) && Lo( t, "hovered", /*hovered*/ h[4] ), (!f || m & /*i18n, type*/ 3) && s !== (s = /*i18n*/ h[1]( /*defs*/ h[5][ /*type*/ h[0] ] || /*defs*/ h[5].file ) + "") && Oi(r, s), /*mode*/ h[3] !== "short" ? d ? d.p(h, m) : (d = Do(h), d.c(), d.m(e, null)) : d && (d.d(1), d = null); }, i(h) { f || (Dl(i), f = !0); }, o(h) { Rl(i), f = !1; }, d(h) { h && Bl(e), c[n].d(), d && d.d(); } }; } function s_(l, e, t) { let { type: n = "file" } = e, { i18n: i } = e, { message: o = void 0 } = e, { mode: s = "full" } = e, { hovered: r = !1 } = e; const a = { image: "upload_text.drop_image", video: "upload_text.drop_video", audio: "upload_text.drop_audio", file: "upload_text.drop_file", csv: "upload_text.drop_csv", gallery: "upload_text.drop_gallery", clipboard: "upload_text.paste_clipboard" }; return l.$$set = (f) => { "type" in f && t(0, n = f.type), "i18n" in f && t(1, i = f.i18n), "message" in f && t(2, o = f.message), "mode" in f && t(3, s = f.mode), "hovered" in f && t(4, r = f.hovered); }, [n, i, o, s, r, a]; } class wa extends xc { constructor(e) { super(), t_(this, e, s_, o_, n_, { type: 0, i18n: 1, message: 2, mode: 3, hovered: 4 }); } } const { SvelteComponent: a_, append: Ci, attr: ot, check_outros: Dn, create_component: Pl, destroy_component: Zl, detach: wn, element: el, empty: r_, group_outros: Rn, init: f_, insert: pn, listen: Kl, mount_component: Gl, safe_not_equal: u_, space: Si, toggle_class: At, transition_in: fe, transition_out: ze } = window.__gradio__svelte__internal; function Ro(l) { let e, t = ( /*sources*/ l[1].includes("upload") ), n, i = ( /*sources*/ l[1].includes("microphone") ), o, s = ( /*sources*/ l[1].includes("webcam") ), r, a = ( /*sources*/ l[1].includes("clipboard") ), f, u = t && To(l), c = i && Io(l), _ = s && jo(l), d = a && Ho(l); return { c() { e = el("span"), u && u.c(), n = Si(), c && c.c(), o = Si(), _ && _.c(), r = Si(), d && d.c(), ot(e, "class", "source-selection svelte-1jp3vgd"), ot(e, "data-testid", "source-select"); }, m(h, m) { pn(h, e, m), u && u.m(e, null), Ci(e, n), c && c.m(e, null), Ci(e, o), _ && _.m(e, null), Ci(e, r), d && d.m(e, null), f = !0; }, p(h, m) { m & /*sources*/ 2 && (t = /*sources*/ h[1].includes("upload")), t ? u ? (u.p(h, m), m & /*sources*/ 2 && fe(u, 1)) : (u = To(h), u.c(), fe(u, 1), u.m(e, n)) : u && (Rn(), ze(u, 1, 1, () => { u = null; }), Dn()), m & /*sources*/ 2 && (i = /*sources*/ h[1].includes("microphone")), i ? c ? (c.p(h, m), m & /*sources*/ 2 && fe(c, 1)) : (c = Io(h), c.c(), fe(c, 1), c.m(e, o)) : c && (Rn(), ze(c, 1, 1, () => { c = null; }), Dn()), m & /*sources*/ 2 && (s = /*sources*/ h[1].includes("webcam")), s ? _ ? (_.p(h, m), m & /*sources*/ 2 && fe(_, 1)) : (_ = jo(h), _.c(), fe(_, 1), _.m(e, r)) : _ && (Rn(), ze(_, 1, 1, () => { _ = null; }), Dn()), m & /*sources*/ 2 && (a = /*sources*/ h[1].includes("clipboard")), a ? d ? (d.p(h, m), m & /*sources*/ 2 && fe(d, 1)) : (d = Ho(h), d.c(), fe(d, 1), d.m(e, null)) : d && (Rn(), ze(d, 1, 1, () => { d = null; }), Dn()); }, i(h) { f || (fe(u), fe(c), fe(_), fe(d), f = !0); }, o(h) { ze(u), ze(c), ze(_), ze(d), f = !1; }, d(h) { h && wn(e), u && u.d(), c && c.d(), _ && _.d(), d && d.d(); } }; } function To(l) { let e, t, n, i, o; return t = new da({}), { c() { e = el("button"), Pl(t.$$.fragment), ot(e, "class", "icon svelte-1jp3vgd"), ot(e, "aria-label", "Upload file"), At( e, "selected", /*active_source*/ l[0] === "upload" || !/*active_source*/ l[0] ); }, m(s, r) { pn(s, e, r), Gl(t, e, null), n = !0, i || (o = Kl( e, "click", /*click_handler*/ l[6] ), i = !0); }, p(s, r) { (!n || r & /*active_source*/ 1) && At( e, "selected", /*active_source*/ s[0] === "upload" || !/*active_source*/ s[0] ); }, i(s) { n || (fe(t.$$.fragment, s), n = !0); }, o(s) { ze(t.$$.fragment, s), n = !1; }, d(s) { s && wn(e), Zl(t), i = !1, o(); } }; } function Io(l) { let e, t, n, i, o; return t = new gc({}), { c() { e = el("button"), Pl(t.$$.fragment), ot(e, "class", "icon svelte-1jp3vgd"), ot(e, "aria-label", "Record audio"), At( e, "selected", /*active_source*/ l[0] === "microphone" ); }, m(s, r) { pn(s, e, r), Gl(t, e, null), n = !0, i || (o = Kl( e, "click", /*click_handler_1*/ l[7] ), i = !0); }, p(s, r) { (!n || r & /*active_source*/ 1) && At( e, "selected", /*active_source*/ s[0] === "microphone" ); }, i(s) { n || (fe(t.$$.fragment, s), n = !0); }, o(s) { ze(t.$$.fragment, s), n = !1; }, d(s) { s && wn(e), Zl(t), i = !1, o(); } }; } function jo(l) { let e, t, n, i, o; return t = new ha({}), { c() { e = el("button"), Pl(t.$$.fragment), ot(e, "class", "icon svelte-1jp3vgd"), ot(e, "aria-label", "Capture from camera"), At( e, "selected", /*active_source*/ l[0] === "webcam" ); }, m(s, r) { pn(s, e, r), Gl(t, e, null), n = !0, i || (o = Kl( e, "click", /*click_handler_2*/ l[8] ), i = !0); }, p(s, r) { (!n || r & /*active_source*/ 1) && At( e, "selected", /*active_source*/ s[0] === "webcam" ); }, i(s) { n || (fe(t.$$.fragment, s), n = !0); }, o(s) { ze(t.$$.fragment, s), n = !1; }, d(s) { s && wn(e), Zl(t), i = !1, o(); } }; } function Ho(l) { let e, t, n, i, o; return t = new _a({}), { c() { e = el("button"), Pl(t.$$.fragment), ot(e, "class", "icon svelte-1jp3vgd"), ot(e, "aria-label", "Paste from clipboard"), At( e, "selected", /*active_source*/ l[0] === "clipboard" ); }, m(s, r) { pn(s, e, r), Gl(t, e, null), n = !0, i || (o = Kl( e, "click", /*click_handler_3*/ l[9] ), i = !0); }, p(s, r) { (!n || r & /*active_source*/ 1) && At( e, "selected", /*active_source*/ s[0] === "clipboard" ); }, i(s) { n || (fe(t.$$.fragment, s), n = !0); }, o(s) { ze(t.$$.fragment, s), n = !1; }, d(s) { s && wn(e), Zl(t), i = !1, o(); } }; } function c_(l) { let e, t, n = ( /*unique_sources*/ l[2].length > 1 && Ro(l) ); return { c() { n && n.c(), e = r_(); }, m(i, o) { n && n.m(i, o), pn(i, e, o), t = !0; }, p(i, [o]) { /*unique_sources*/ i[2].length > 1 ? n ? (n.p(i, o), o & /*unique_sources*/ 4 && fe(n, 1)) : (n = Ro(i), n.c(), fe(n, 1), n.m(e.parentNode, e)) : n && (Rn(), ze(n, 1, 1, () => { n = null; }), Dn()); }, i(i) { t || (fe(n), t = !0); }, o(i) { ze(n), t = !1; }, d(i) { i && wn(e), n && n.d(i); } }; } function __(l, e, t) { let n; var i = this && this.__awaiter || function(h, m, w, b) { function p(g) { return g instanceof w ? g : new w(function(v) { v(g); }); } return new (w || (w = Promise))(function(g, v) { function E(k) { try { C(b.next(k)); } catch (A) { v(A); } } function y(k) { try { C(b.throw(k)); } catch (A) { v(A); } } function C(k) { k.done ? g(k.value) : p(k.value).then(E, y); } C((b = b.apply(h, m || [])).next()); }); }; let { sources: o } = e, { active_source: s } = e, { handle_clear: r = () => { } } = e, { handle_select: a = () => { } } = e; function f(h) { return i(this, void 0, void 0, function* () { r(), t(0, s = h), a(h); }); } const u = () => f("upload"), c = () => f("microphone"), _ = () => f("webcam"), d = () => f("clipboard"); return l.$$set = (h) => { "sources" in h && t(1, o = h.sources), "active_source" in h && t(0, s = h.active_source), "handle_clear" in h && t(4, r = h.handle_clear), "handle_select" in h && t(5, a = h.handle_select); }, l.$$.update = () => { l.$$.dirty & /*sources*/ 2 && t(2, n = [...new Set(o)]); }, [ s, o, n, f, r, a, u, c, _, d ]; } class d_ extends a_ { constructor(e) { super(), f_(this, e, __, c_, u_, { sources: 1, active_source: 0, handle_clear: 4, handle_select: 5 }); } } function dn(l) { let e = ["", "k", "M", "G", "T", "P", "E", "Z"], t = 0; for (; l > 1e3 && t < e.length - 1; ) l /= 1e3, t++; let n = e[t]; return (Number.isInteger(l) ? l : l.toFixed(1)) + n; } function El() { } const h_ = (l) => l; function m_(l, e) { return l != l ? e == e : l !== e || l && typeof l == "object" || typeof l == "function"; } function Fo(l) { const e = typeof l == "string" && l.match(/^\s*(-?[\d.]+)([^\s]*)\s*$/); return e ? [parseFloat(e[1]), e[2] || "px"] : [ /** @type {number} */ l, "px" ]; } const pa = typeof window < "u"; let Xo = pa ? () => window.performance.now() : () => Date.now(), va = pa ? (l) => requestAnimationFrame(l) : El; const gn = /* @__PURE__ */ new Set(); function ka(l) { gn.forEach((e) => { e.c(l) || (gn.delete(e), e.f()); }), gn.size !== 0 && va(ka); } function g_(l) { let e; return gn.size === 0 && va(ka), { promise: new Promise((t) => { gn.add(e = { c: l, f: t }); }), abort() { gn.delete(e); } }; } function b_(l) { const e = l - 1; return e * e * e + 1; } function w_(l, { delay: e = 0, duration: t = 400, easing: n = h_ } = {}) { const i = +getComputedStyle(l).opacity; return { delay: e, duration: t, easing: n, css: (o) => `opacity: ${o * i}` }; } function Yo(l, { delay: e = 0, duration: t = 400, easing: n = b_, x: i = 0, y: o = 0, opacity: s = 0 } = {}) { const r = getComputedStyle(l), a = +r.opacity, f = r.transform === "none" ? "" : r.transform, u = a * (1 - s), [c, _] = Fo(i), [d, h] = Fo(o); return { delay: e, duration: t, easing: n, css: (m, w) => ` transform: ${f} translate(${(1 - m) * c}${_}, ${(1 - m) * d}${h}); opacity: ${a - u * w}` }; } const an = []; function p_(l, e = El) { let t; const n = /* @__PURE__ */ new Set(); function i(r) { if (m_(l, r) && (l = r, t)) { const a = !an.length; for (const f of n) f[1](), an.push(f, l); if (a) { for (let f = 0; f < an.length; f += 2) an[f][0](an[f + 1]); an.length = 0; } } } function o(r) { i(r(l)); } function s(r, a = El) { const f = [r, a]; return n.add(f), n.size === 1 && (t = e(i, o) || El), r(l), () => { n.delete(f), n.size === 0 && t && (t(), t = null); }; } return { set: i, update: o, subscribe: s }; } function No(l) { return Object.prototype.toString.call(l) === "[object Date]"; } function Vi(l, e, t, n) { if (typeof t == "number" || No(t)) { const i = n - t, o = (t - e) / (l.dt || 1 / 60), s = l.opts.stiffness * i, r = l.opts.damping * o, a = (s - r) * l.inv_mass, f = (o + a) * l.dt; return Math.abs(f) < l.opts.precision && Math.abs(i) < l.opts.precision ? n : (l.settled = !1, No(t) ? new Date(t.getTime() + f) : t + f); } else { if (Array.isArray(t)) return t.map( (i, o) => Vi(l, e[o], t[o], n[o]) ); if (typeof t == "object") { const i = {}; for (const o in t) i[o] = Vi(l, e[o], t[o], n[o]); return i; } else throw new Error(`Cannot spring ${typeof t} values`); } } function Uo(l, e = {}) { const t = p_(l), { stiffness: n = 0.15, damping: i = 0.8, precision: o = 0.01 } = e; let s, r, a, f = l, u = l, c = 1, _ = 0, d = !1; function h(w, b = {}) { u = w; const p = a = {}; return l == null || b.hard || m.stiffness >= 1 && m.damping >= 1 ? (d = !0, s = Xo(), f = w, t.set(l = u), Promise.resolve()) : (b.soft && (_ = 1 / ((b.soft === !0 ? 0.5 : +b.soft) * 60), c = 0), r || (s = Xo(), d = !1, r = g_((g) => { if (d) return d = !1, r = null, !1; c = Math.min(c + _, 1); const v = { inv_mass: c, opts: m, settled: !0, dt: (g - s) * 60 / 1e3 }, E = Vi(v, f, l, u); return s = g, f = l, t.set(l = E), v.settled && (r = null), !v.settled; })), new Promise((g) => { r.promise.then(() => { p === a && g(); }); })); } const m = { set: h, update: (w, b) => h(w(u, l), b), subscribe: t.subscribe, stiffness: n, damping: i, precision: o }; return m; } const { SvelteComponent: v_, append: Ve, attr: O, component_subscribe: Oo, detach: k_, element: y_, init: C_, insert: S_, noop: Wo, safe_not_equal: z_, set_style: cl, svg_element: Pe, toggle_class: Vo } = window.__gradio__svelte__internal, { onMount: B_ } = window.__gradio__svelte__internal; function q_(l) { let e, t, n, i, o, s, r, a, f, u, c, _; return { c() { e = y_("div"), t = Pe("svg"), n = Pe("g"), i = Pe("path"), o = Pe("path"), s = Pe("path"), r = Pe("path"), a = Pe("g"), f = Pe("path"), u = Pe("path"), c = Pe("path"), _ = Pe("path"), O(i, "d", "M255.926 0.754768L509.702 139.936V221.027L255.926 81.8465V0.754768Z"), O(i, "fill", "#FF7C00"), O(i, "fill-opacity", "0.4"), O(i, "class", "svelte-43sxxs"), O(o, "d", "M509.69 139.936L254.981 279.641V361.255L509.69 221.55V139.936Z"), O(o, "fill", "#FF7C00"), O(o, "class", "svelte-43sxxs"), O(s, "d", "M0.250138 139.937L254.981 279.641V361.255L0.250138 221.55V139.937Z"), O(s, "fill", "#FF7C00"), O(s, "fill-opacity", "0.4"), O(s, "class", "svelte-43sxxs"), O(r, "d", "M255.923 0.232622L0.236328 139.936V221.55L255.923 81.8469V0.232622Z"), O(r, "fill", "#FF7C00"), O(r, "class", "svelte-43sxxs"), cl(n, "transform", "translate(" + /*$top*/ l[1][0] + "px, " + /*$top*/ l[1][1] + "px)"), O(f, "d", "M255.926 141.5L509.702 280.681V361.773L255.926 222.592V141.5Z"), O(f, "fill", "#FF7C00"), O(f, "fill-opacity", "0.4"), O(f, "class", "svelte-43sxxs"), O(u, "d", "M509.69 280.679L254.981 420.384V501.998L509.69 362.293V280.679Z"), O(u, "fill", "#FF7C00"), O(u, "class", "svelte-43sxxs"), O(c, "d", "M0.250138 280.681L254.981 420.386V502L0.250138 362.295V280.681Z"), O(c, "fill", "#FF7C00"), O(c, "fill-opacity", "0.4"), O(c, "class", "svelte-43sxxs"), O(_, "d", "M255.923 140.977L0.236328 280.68V362.294L255.923 222.591V140.977Z"), O(_, "fill", "#FF7C00"), O(_, "class", "svelte-43sxxs"), cl(a, "transform", "translate(" + /*$bottom*/ l[2][0] + "px, " + /*$bottom*/ l[2][1] + "px)"), O(t, "viewBox", "-1200 -1200 3000 3000"), O(t, "fill", "none"), O(t, "xmlns", "http://www.w3.org/2000/svg"), O(t, "class", "svelte-43sxxs"), O(e, "class", "svelte-43sxxs"), Vo( e, "margin", /*margin*/ l[0] ); }, m(d, h) { S_(d, e, h), Ve(e, t), Ve(t, n), Ve(n, i), Ve(n, o), Ve(n, s), Ve(n, r), Ve(t, a), Ve(a, f), Ve(a, u), Ve(a, c), Ve(a, _); }, p(d, [h]) { h & /*$top*/ 2 && cl(n, "transform", "translate(" + /*$top*/ d[1][0] + "px, " + /*$top*/ d[1][1] + "px)"), h & /*$bottom*/ 4 && cl(a, "transform", "translate(" + /*$bottom*/ d[2][0] + "px, " + /*$bottom*/ d[2][1] + "px)"), h & /*margin*/ 1 && Vo( e, "margin", /*margin*/ d[0] ); }, i: Wo, o: Wo, d(d) { d && k_(e); } }; } function E_(l, e, t) { let n, i; var o = this && this.__awaiter || function(d, h, m, w) { function b(p) { return p instanceof m ? p : new m(function(g) { g(p); }); } return new (m || (m = Promise))(function(p, g) { function v(C) { try { y(w.next(C)); } catch (k) { g(k); } } function E(C) { try { y(w.throw(C)); } catch (k) { g(k); } } function y(C) { C.done ? p(C.value) : b(C.value).then(v, E); } y((w = w.apply(d, h || [])).next()); }); }; let { margin: s = !0 } = e; const r = Uo([0, 0]); Oo(l, r, (d) => t(1, n = d)); const a = Uo([0, 0]); Oo(l, a, (d) => t(2, i = d)); let f; function u() { return o(this, void 0, void 0, function* () { yield Promise.all([r.set([125, 140]), a.set([-125, -140])]), yield Promise.all([r.set([-125, 140]), a.set([125, -140])]), yield Promise.all([r.set([-125, 0]), a.set([125, -0])]), yield Promise.all([r.set([125, 0]), a.set([-125, 0])]); }); } function c() { return o(this, void 0, void 0, function* () { yield u(), f || c(); }); } function _() { return o(this, void 0, void 0, function* () { yield Promise.all([r.set([125, 0]), a.set([-125, 0])]), c(); }); } return B_(() => (_(), () => f = !0)), l.$$set = (d) => { "margin" in d && t(0, s = d.margin); }, [s, n, i, r, a]; } class M_ extends v_ { constructor(e) { super(), C_(this, e, E_, q_, z_, { margin: 0 }); } } const { SvelteComponent: A_, append: Pt, attr: Je, binding_callbacks: Po, check_outros: Pi, create_component: ya, create_slot: Ca, destroy_component: Sa, destroy_each: za, detach: X, element: lt, empty: vn, ensure_array_like: Tl, get_all_dirty_from_scope: Ba, get_slot_changes: qa, group_outros: Zi, init: L_, insert: Y, mount_component: Ea, noop: Ki, safe_not_equal: D_, set_data: Fe, set_style: Et, space: He, text: le, toggle_class: je, transition_in: Ge, transition_out: it, update_slot_base: Ma } = window.__gradio__svelte__internal, { tick: R_ } = window.__gradio__svelte__internal, { onDestroy: T_ } = window.__gradio__svelte__internal, { createEventDispatcher: I_ } = window.__gradio__svelte__internal, j_ = (l) => ({}), Zo = (l) => ({}), H_ = (l) => ({}), Ko = (l) => ({}); function Go(l, e, t) { const n = l.slice(); return n[41] = e[t], n[43] = t, n; } function Jo(l, e, t) { const n = l.slice(); return n[41] = e[t], n; } function F_(l) { let e, t, n, i, o = ( /*i18n*/ l[1]("common.error") + "" ), s, r, a; t = new Vl({ props: { Icon: ua, label: ( /*i18n*/ l[1]("common.clear") ), disabled: !1 } }), t.$on( "click", /*click_handler*/ l[32] ); const f = ( /*#slots*/ l[30].error ), u = Ca( f, l, /*$$scope*/ l[29], Zo ); return { c() { e = lt("div"), ya(t.$$.fragment), n = He(), i = lt("span"), s = le(o), r = He(), u && u.c(), Je(e, "class", "clear-status svelte-16nch4a"), Je(i, "class", "error svelte-16nch4a"); }, m(c, _) { Y(c, e, _), Ea(t, e, null), Y(c, n, _), Y(c, i, _), Pt(i, s), Y(c, r, _), u && u.m(c, _), a = !0; }, p(c, _) { const d = {}; _[0] & /*i18n*/ 2 && (d.label = /*i18n*/ c[1]("common.clear")), t.$set(d), (!a || _[0] & /*i18n*/ 2) && o !== (o = /*i18n*/ c[1]("common.error") + "") && Fe(s, o), u && u.p && (!a || _[0] & /*$$scope*/ 536870912) && Ma( u, f, c, /*$$scope*/ c[29], a ? qa( f, /*$$scope*/ c[29], _, j_ ) : Ba( /*$$scope*/ c[29] ), Zo ); }, i(c) { a || (Ge(t.$$.fragment, c), Ge(u, c), a = !0); }, o(c) { it(t.$$.fragment, c), it(u, c), a = !1; }, d(c) { c && (X(e), X(n), X(i), X(r)), Sa(t), u && u.d(c); } }; } function X_(l) { let e, t, n, i, o, s, r, a, f, u = ( /*variant*/ l[8] === "default" && /*show_eta_bar*/ l[18] && /*show_progress*/ l[6] === "full" && Qo(l) ); function c(g, v) { if ( /*progress*/ g[7] ) return U_; if ( /*queue_position*/ g[2] !== null && /*queue_size*/ g[3] !== void 0 && /*queue_position*/ g[2] >= 0 ) return N_; if ( /*queue_position*/ g[2] === 0 ) return Y_; } let _ = c(l), d = _ && _(l), h = ( /*timer*/ l[5] && es(l) ); const m = [P_, V_], w = []; function b(g, v) { return ( /*last_progress_level*/ g[15] != null ? 0 : ( /*show_progress*/ g[6] === "full" ? 1 : -1 ) ); } ~(o = b(l)) && (s = w[o] = m[o](l)); let p = !/*timer*/ l[5] && as(l); return { c() { u && u.c(), e = He(), t = lt("div"), d && d.c(), n = He(), h && h.c(), i = He(), s && s.c(), r = He(), p && p.c(), a = vn(), Je(t, "class", "progress-text svelte-16nch4a"), je( t, "meta-text-center", /*variant*/ l[8] === "center" ), je( t, "meta-text", /*variant*/ l[8] === "default" ); }, m(g, v) { u && u.m(g, v), Y(g, e, v), Y(g, t, v), d && d.m(t, null), Pt(t, n), h && h.m(t, null), Y(g, i, v), ~o && w[o].m(g, v), Y(g, r, v), p && p.m(g, v), Y(g, a, v), f = !0; }, p(g, v) { /*variant*/ g[8] === "default" && /*show_eta_bar*/ g[18] && /*show_progress*/ g[6] === "full" ? u ? u.p(g, v) : (u = Qo(g), u.c(), u.m(e.parentNode, e)) : u && (u.d(1), u = null), _ === (_ = c(g)) && d ? d.p(g, v) : (d && d.d(1), d = _ && _(g), d && (d.c(), d.m(t, n))), /*timer*/ g[5] ? h ? h.p(g, v) : (h = es(g), h.c(), h.m(t, null)) : h && (h.d(1), h = null), (!f || v[0] & /*variant*/ 256) && je( t, "meta-text-center", /*variant*/ g[8] === "center" ), (!f || v[0] & /*variant*/ 256) && je( t, "meta-text", /*variant*/ g[8] === "default" ); let E = o; o = b(g), o === E ? ~o && w[o].p(g, v) : (s && (Zi(), it(w[E], 1, 1, () => { w[E] = null; }), Pi()), ~o ? (s = w[o], s ? s.p(g, v) : (s = w[o] = m[o](g), s.c()), Ge(s, 1), s.m(r.parentNode, r)) : s = null), /*timer*/ g[5] ? p && (Zi(), it(p, 1, 1, () => { p = null; }), Pi()) : p ? (p.p(g, v), v[0] & /*timer*/ 32 && Ge(p, 1)) : (p = as(g), p.c(), Ge(p, 1), p.m(a.parentNode, a)); }, i(g) { f || (Ge(s), Ge(p), f = !0); }, o(g) { it(s), it(p), f = !1; }, d(g) { g && (X(e), X(t), X(i), X(r), X(a)), u && u.d(g), d && d.d(), h && h.d(), ~o && w[o].d(g), p && p.d(g); } }; } function Qo(l) { let e, t = `translateX(${/*eta_level*/ (l[17] || 0) * 100 - 100}%)`; return { c() { e = lt("div"), Je(e, "class", "eta-bar svelte-16nch4a"), Et(e, "transform", t); }, m(n, i) { Y(n, e, i); }, p(n, i) { i[0] & /*eta_level*/ 131072 && t !== (t = `translateX(${/*eta_level*/ (n[17] || 0) * 100 - 100}%)`) && Et(e, "transform", t); }, d(n) { n && X(e); } }; } function Y_(l) { let e; return { c() { e = le("processing |"); }, m(t, n) { Y(t, e, n); }, p: Ki, d(t) { t && X(e); } }; } function N_(l) { let e, t = ( /*queue_position*/ l[2] + 1 + "" ), n, i, o, s; return { c() { e = le("queue: "), n = le(t), i = le("/"), o = le( /*queue_size*/ l[3] ), s = le(" |"); }, m(r, a) { Y(r, e, a), Y(r, n, a), Y(r, i, a), Y(r, o, a), Y(r, s, a); }, p(r, a) { a[0] & /*queue_position*/ 4 && t !== (t = /*queue_position*/ r[2] + 1 + "") && Fe(n, t), a[0] & /*queue_size*/ 8 && Fe( o, /*queue_size*/ r[3] ); }, d(r) { r && (X(e), X(n), X(i), X(o), X(s)); } }; } function U_(l) { let e, t = Tl( /*progress*/ l[7] ), n = []; for (let i = 0; i < t.length; i += 1) n[i] = $o(Jo(l, t, i)); return { c() { for (let i = 0; i < n.length; i += 1) n[i].c(); e = vn(); }, m(i, o) { for (let s = 0; s < n.length; s += 1) n[s] && n[s].m(i, o); Y(i, e, o); }, p(i, o) { if (o[0] & /*progress*/ 128) { t = Tl( /*progress*/ i[7] ); let s; for (s = 0; s < t.length; s += 1) { const r = Jo(i, t, s); n[s] ? n[s].p(r, o) : (n[s] = $o(r), n[s].c(), n[s].m(e.parentNode, e)); } for (; s < n.length; s += 1) n[s].d(1); n.length = t.length; } }, d(i) { i && X(e), za(n, i); } }; } function xo(l) { let e, t = ( /*p*/ l[41].unit + "" ), n, i, o = " ", s; function r(u, c) { return ( /*p*/ u[41].length != null ? W_ : O_ ); } let a = r(l), f = a(l); return { c() { f.c(), e = He(), n = le(t), i = le(" | "), s = le(o); }, m(u, c) { f.m(u, c), Y(u, e, c), Y(u, n, c), Y(u, i, c), Y(u, s, c); }, p(u, c) { a === (a = r(u)) && f ? f.p(u, c) : (f.d(1), f = a(u), f && (f.c(), f.m(e.parentNode, e))), c[0] & /*progress*/ 128 && t !== (t = /*p*/ u[41].unit + "") && Fe(n, t); }, d(u) { u && (X(e), X(n), X(i), X(s)), f.d(u); } }; } function O_(l) { let e = dn( /*p*/ l[41].index || 0 ) + "", t; return { c() { t = le(e); }, m(n, i) { Y(n, t, i); }, p(n, i) { i[0] & /*progress*/ 128 && e !== (e = dn( /*p*/ n[41].index || 0 ) + "") && Fe(t, e); }, d(n) { n && X(t); } }; } function W_(l) { let e = dn( /*p*/ l[41].index || 0 ) + "", t, n, i = dn( /*p*/ l[41].length ) + "", o; return { c() { t = le(e), n = le("/"), o = le(i); }, m(s, r) { Y(s, t, r), Y(s, n, r), Y(s, o, r); }, p(s, r) { r[0] & /*progress*/ 128 && e !== (e = dn( /*p*/ s[41].index || 0 ) + "") && Fe(t, e), r[0] & /*progress*/ 128 && i !== (i = dn( /*p*/ s[41].length ) + "") && Fe(o, i); }, d(s) { s && (X(t), X(n), X(o)); } }; } function $o(l) { let e, t = ( /*p*/ l[41].index != null && xo(l) ); return { c() { t && t.c(), e = vn(); }, m(n, i) { t && t.m(n, i), Y(n, e, i); }, p(n, i) { /*p*/ n[41].index != null ? t ? t.p(n, i) : (t = xo(n), t.c(), t.m(e.parentNode, e)) : t && (t.d(1), t = null); }, d(n) { n && X(e), t && t.d(n); } }; } function es(l) { let e, t = ( /*eta*/ l[0] ? `/${/*formatted_eta*/ l[19]}` : "" ), n, i; return { c() { e = le( /*formatted_timer*/ l[20] ), n = le(t), i = le("s"); }, m(o, s) { Y(o, e, s), Y(o, n, s), Y(o, i, s); }, p(o, s) { s[0] & /*formatted_timer*/ 1048576 && Fe( e, /*formatted_timer*/ o[20] ), s[0] & /*eta, formatted_eta*/ 524289 && t !== (t = /*eta*/ o[0] ? `/${/*formatted_eta*/ o[19]}` : "") && Fe(n, t); }, d(o) { o && (X(e), X(n), X(i)); } }; } function V_(l) { let e, t; return e = new M_({ props: { margin: ( /*variant*/ l[8] === "default" ) } }), { c() { ya(e.$$.fragment); }, m(n, i) { Ea(e, n, i), t = !0; }, p(n, i) { const o = {}; i[0] & /*variant*/ 256 && (o.margin = /*variant*/ n[8] === "default"), e.$set(o); }, i(n) { t || (Ge(e.$$.fragment, n), t = !0); }, o(n) { it(e.$$.fragment, n), t = !1; }, d(n) { Sa(e, n); } }; } function P_(l) { let e, t, n, i, o, s = `${/*last_progress_level*/ l[15] * 100}%`, r = ( /*progress*/ l[7] != null && ts(l) ); return { c() { e = lt("div"), t = lt("div"), r && r.c(), n = He(), i = lt("div"), o = lt("div"), Je(t, "class", "progress-level-inner svelte-16nch4a"), Je(o, "class", "progress-bar svelte-16nch4a"), Et(o, "width", s), Je(i, "class", "progress-bar-wrap svelte-16nch4a"), Je(e, "class", "progress-level svelte-16nch4a"); }, m(a, f) { Y(a, e, f), Pt(e, t), r && r.m(t, null), Pt(e, n), Pt(e, i), Pt(i, o), l[31](o); }, p(a, f) { /*progress*/ a[7] != null ? r ? r.p(a, f) : (r = ts(a), r.c(), r.m(t, null)) : r && (r.d(1), r = null), f[0] & /*last_progress_level*/ 32768 && s !== (s = `${/*last_progress_level*/ a[15] * 100}%`) && Et(o, "width", s); }, i: Ki, o: Ki, d(a) { a && X(e), r && r.d(), l[31](null); } }; } function ts(l) { let e, t = Tl( /*progress*/ l[7] ), n = []; for (let i = 0; i < t.length; i += 1) n[i] = ss(Go(l, t, i)); return { c() { for (let i = 0; i < n.length; i += 1) n[i].c(); e = vn(); }, m(i, o) { for (let s = 0; s < n.length; s += 1) n[s] && n[s].m(i, o); Y(i, e, o); }, p(i, o) { if (o[0] & /*progress_level, progress*/ 16512) { t = Tl( /*progress*/ i[7] ); let s; for (s = 0; s < t.length; s += 1) { const r = Go(i, t, s); n[s] ? n[s].p(r, o) : (n[s] = ss(r), n[s].c(), n[s].m(e.parentNode, e)); } for (; s < n.length; s += 1) n[s].d(1); n.length = t.length; } }, d(i) { i && X(e), za(n, i); } }; } function ns(l) { let e, t, n, i, o = ( /*i*/ l[43] !== 0 && Z_() ), s = ( /*p*/ l[41].desc != null && ls(l) ), r = ( /*p*/ l[41].desc != null && /*progress_level*/ l[14] && /*progress_level*/ l[14][ /*i*/ l[43] ] != null && is() ), a = ( /*progress_level*/ l[14] != null && os(l) ); return { c() { o && o.c(), e = He(), s && s.c(), t = He(), r && r.c(), n = He(), a && a.c(), i = vn(); }, m(f, u) { o && o.m(f, u), Y(f, e, u), s && s.m(f, u), Y(f, t, u), r && r.m(f, u), Y(f, n, u), a && a.m(f, u), Y(f, i, u); }, p(f, u) { /*p*/ f[41].desc != null ? s ? s.p(f, u) : (s = ls(f), s.c(), s.m(t.parentNode, t)) : s && (s.d(1), s = null), /*p*/ f[41].desc != null && /*progress_level*/ f[14] && /*progress_level*/ f[14][ /*i*/ f[43] ] != null ? r || (r = is(), r.c(), r.m(n.parentNode, n)) : r && (r.d(1), r = null), /*progress_level*/ f[14] != null ? a ? a.p(f, u) : (a = os(f), a.c(), a.m(i.parentNode, i)) : a && (a.d(1), a = null); }, d(f) { f && (X(e), X(t), X(n), X(i)), o && o.d(f), s && s.d(f), r && r.d(f), a && a.d(f); } }; } function Z_(l) { let e; return { c() { e = le(" /"); }, m(t, n) { Y(t, e, n); }, d(t) { t && X(e); } }; } function ls(l) { let e = ( /*p*/ l[41].desc + "" ), t; return { c() { t = le(e); }, m(n, i) { Y(n, t, i); }, p(n, i) { i[0] & /*progress*/ 128 && e !== (e = /*p*/ n[41].desc + "") && Fe(t, e); }, d(n) { n && X(t); } }; } function is(l) { let e; return { c() { e = le("-"); }, m(t, n) { Y(t, e, n); }, d(t) { t && X(e); } }; } function os(l) { let e = (100 * /*progress_level*/ (l[14][ /*i*/ l[43] ] || 0)).toFixed(1) + "", t, n; return { c() { t = le(e), n = le("%"); }, m(i, o) { Y(i, t, o), Y(i, n, o); }, p(i, o) { o[0] & /*progress_level*/ 16384 && e !== (e = (100 * /*progress_level*/ (i[14][ /*i*/ i[43] ] || 0)).toFixed(1) + "") && Fe(t, e); }, d(i) { i && (X(t), X(n)); } }; } function ss(l) { let e, t = ( /*p*/ (l[41].desc != null || /*progress_level*/ l[14] && /*progress_level*/ l[14][ /*i*/ l[43] ] != null) && ns(l) ); return { c() { t && t.c(), e = vn(); }, m(n, i) { t && t.m(n, i), Y(n, e, i); }, p(n, i) { /*p*/ n[41].desc != null || /*progress_level*/ n[14] && /*progress_level*/ n[14][ /*i*/ n[43] ] != null ? t ? t.p(n, i) : (t = ns(n), t.c(), t.m(e.parentNode, e)) : t && (t.d(1), t = null); }, d(n) { n && X(e), t && t.d(n); } }; } function as(l) { let e, t, n, i; const o = ( /*#slots*/ l[30]["additional-loading-text"] ), s = Ca( o, l, /*$$scope*/ l[29], Ko ); return { c() { e = lt("p"), t = le( /*loading_text*/ l[9] ), n = He(), s && s.c(), Je(e, "class", "loading svelte-16nch4a"); }, m(r, a) { Y(r, e, a), Pt(e, t), Y(r, n, a), s && s.m(r, a), i = !0; }, p(r, a) { (!i || a[0] & /*loading_text*/ 512) && Fe( t, /*loading_text*/ r[9] ), s && s.p && (!i || a[0] & /*$$scope*/ 536870912) && Ma( s, o, r, /*$$scope*/ r[29], i ? qa( o, /*$$scope*/ r[29], a, H_ ) : Ba( /*$$scope*/ r[29] ), Ko ); }, i(r) { i || (Ge(s, r), i = !0); }, o(r) { it(s, r), i = !1; }, d(r) { r && (X(e), X(n)), s && s.d(r); } }; } function K_(l) { let e, t, n, i, o; const s = [X_, F_], r = []; function a(f, u) { return ( /*status*/ f[4] === "pending" ? 0 : ( /*status*/ f[4] === "error" ? 1 : -1 ) ); } return ~(t = a(l)) && (n = r[t] = s[t](l)), { c() { e = lt("div"), n && n.c(), Je(e, "class", i = "wrap " + /*variant*/ l[8] + " " + /*show_progress*/ l[6] + " svelte-16nch4a"), je(e, "hide", !/*status*/ l[4] || /*status*/ l[4] === "complete" || /*show_progress*/ l[6] === "hidden"), je( e, "translucent", /*variant*/ l[8] === "center" && /*status*/ (l[4] === "pending" || /*status*/ l[4] === "error") || /*translucent*/ l[11] || /*show_progress*/ l[6] === "minimal" ), je( e, "generating", /*status*/ l[4] === "generating" ), je( e, "border", /*border*/ l[12] ), Et( e, "position", /*absolute*/ l[10] ? "absolute" : "static" ), Et( e, "padding", /*absolute*/ l[10] ? "0" : "var(--size-8) 0" ); }, m(f, u) { Y(f, e, u), ~t && r[t].m(e, null), l[33](e), o = !0; }, p(f, u) { let c = t; t = a(f), t === c ? ~t && r[t].p(f, u) : (n && (Zi(), it(r[c], 1, 1, () => { r[c] = null; }), Pi()), ~t ? (n = r[t], n ? n.p(f, u) : (n = r[t] = s[t](f), n.c()), Ge(n, 1), n.m(e, null)) : n = null), (!o || u[0] & /*variant, show_progress*/ 320 && i !== (i = "wrap " + /*variant*/ f[8] + " " + /*show_progress*/ f[6] + " svelte-16nch4a")) && Je(e, "class", i), (!o || u[0] & /*variant, show_progress, status, show_progress*/ 336) && je(e, "hide", !/*status*/ f[4] || /*status*/ f[4] === "complete" || /*show_progress*/ f[6] === "hidden"), (!o || u[0] & /*variant, show_progress, variant, status, translucent, show_progress*/ 2384) && je( e, "translucent", /*variant*/ f[8] === "center" && /*status*/ (f[4] === "pending" || /*status*/ f[4] === "error") || /*translucent*/ f[11] || /*show_progress*/ f[6] === "minimal" ), (!o || u[0] & /*variant, show_progress, status*/ 336) && je( e, "generating", /*status*/ f[4] === "generating" ), (!o || u[0] & /*variant, show_progress, border*/ 4416) && je( e, "border", /*border*/ f[12] ), u[0] & /*absolute*/ 1024 && Et( e, "position", /*absolute*/ f[10] ? "absolute" : "static" ), u[0] & /*absolute*/ 1024 && Et( e, "padding", /*absolute*/ f[10] ? "0" : "var(--size-8) 0" ); }, i(f) { o || (Ge(n), o = !0); }, o(f) { it(n), o = !1; }, d(f) { f && X(e), ~t && r[t].d(), l[33](null); } }; } var G_ = function(l, e, t, n) { function i(o) { return o instanceof t ? o : new t(function(s) { s(o); }); } return new (t || (t = Promise))(function(o, s) { function r(u) { try { f(n.next(u)); } catch (c) { s(c); } } function a(u) { try { f(n.throw(u)); } catch (c) { s(c); } } function f(u) { u.done ? o(u.value) : i(u.value).then(r, a); } f((n = n.apply(l, e || [])).next()); }); }; let _l = [], zi = !1; function J_(l) { return G_(this, arguments, void 0, function* (e, t = !0) { if (!(window.__gradio_mode__ === "website" || window.__gradio_mode__ !== "app" && t !== !0)) { if (_l.push(e), !zi) zi = !0; else return; yield R_(), requestAnimationFrame(() => { let n = [0, 0]; for (let i = 0; i < _l.length; i++) { const s = _l[i].getBoundingClientRect(); (i === 0 || s.top + window.scrollY <= n[0]) && (n[0] = s.top + window.scrollY, n[1] = i); } window.scrollTo({ top: n[0] - 20, behavior: "smooth" }), zi = !1, _l = []; }); } }); } function Q_(l, e, t) { let n, { $$slots: i = {}, $$scope: o } = e; this && this.__awaiter; const s = I_(); let { i18n: r } = e, { eta: a = null } = e, { queue_position: f } = e, { queue_size: u } = e, { status: c } = e, { scroll_to_output: _ = !1 } = e, { timer: d = !0 } = e, { show_progress: h = "full" } = e, { message: m = null } = e, { progress: w = null } = e, { variant: b = "default" } = e, { loading_text: p = "Loading..." } = e, { absolute: g = !0 } = e, { translucent: v = !1 } = e, { border: E = !1 } = e, { autoscroll: y } = e, C, k = !1, A = 0, S = 0, T = null, R = null, U = 0, Z = null, Q, J = null, K = !0; const L = () => { t(0, a = t(27, T = t(19, W = null))), t(25, A = performance.now()), t(26, S = 0), k = !0, F(); }; function F() { requestAnimationFrame(() => { t(26, S = (performance.now() - A) / 1e3), k && F(); }); } function D() { t(26, S = 0), t(0, a = t(27, T = t(19, W = null))), k && (k = !1); } T_(() => { k && D(); }); let W = null; function $(I) { Po[I ? "unshift" : "push"](() => { J = I, t(16, J), t(7, w), t(14, Z), t(15, Q); }); } const oe = () => { s("clear_status"); }; function ge(I) { Po[I ? "unshift" : "push"](() => { C = I, t(13, C); }); } return l.$$set = (I) => { "i18n" in I && t(1, r = I.i18n), "eta" in I && t(0, a = I.eta), "queue_position" in I && t(2, f = I.queue_position), "queue_size" in I && t(3, u = I.queue_size), "status" in I && t(4, c = I.status), "scroll_to_output" in I && t(22, _ = I.scroll_to_output), "timer" in I && t(5, d = I.timer), "show_progress" in I && t(6, h = I.show_progress), "message" in I && t(23, m = I.message), "progress" in I && t(7, w = I.progress), "variant" in I && t(8, b = I.variant), "loading_text" in I && t(9, p = I.loading_text), "absolute" in I && t(10, g = I.absolute), "translucent" in I && t(11, v = I.translucent), "border" in I && t(12, E = I.border), "autoscroll" in I && t(24, y = I.autoscroll), "$$scope" in I && t(29, o = I.$$scope); }, l.$$.update = () => { l.$$.dirty[0] & /*eta, old_eta, timer_start, eta_from_start*/ 436207617 && (a === null && t(0, a = T), a != null && T !== a && (t(28, R = (performance.now() - A) / 1e3 + a), t(19, W = R.toFixed(1)), t(27, T = a))), l.$$.dirty[0] & /*eta_from_start, timer_diff*/ 335544320 && t(17, U = R === null || R <= 0 || !S ? null : Math.min(S / R, 1)), l.$$.dirty[0] & /*progress*/ 128 && w != null && t(18, K = !1), l.$$.dirty[0] & /*progress, progress_level, progress_bar, last_progress_level*/ 114816 && (w != null ? t(14, Z = w.map((I) => { if (I.index != null && I.length != null) return I.index / I.length; if (I.progress != null) return I.progress; })) : t(14, Z = null), Z ? (t(15, Q = Z[Z.length - 1]), J && (Q === 0 ? t(16, J.style.transition = "0", J) : t(16, J.style.transition = "150ms", J))) : t(15, Q = void 0)), l.$$.dirty[0] & /*status*/ 16 && (c === "pending" ? L() : D()), l.$$.dirty[0] & /*el, scroll_to_output, status, autoscroll*/ 20979728 && C && _ && (c === "pending" || c === "complete") && J_(C, y), l.$$.dirty[0] & /*status, message*/ 8388624, l.$$.dirty[0] & /*timer_diff*/ 67108864 && t(20, n = S.toFixed(1)); }, [ a, r, f, u, c, d, h, w, b, p, g, v, E, C, Z, Q, J, U, K, W, n, s, _, m, y, A, S, T, R, o, i, $, oe, ge ]; } class x_ extends A_ { constructor(e) { super(), L_( this, e, Q_, K_, D_, { i18n: 1, eta: 0, queue_position: 2, queue_size: 3, status: 4, scroll_to_output: 22, timer: 5, show_progress: 6, message: 23, progress: 7, variant: 8, loading_text: 9, absolute: 10, translucent: 11, border: 12, autoscroll: 24 }, null, [-1, -1] ); } } const { setContext: Km, getContext: $_ } = window.__gradio__svelte__internal, ed = "WORKER_PROXY_CONTEXT_KEY"; function Aa() { return $_(ed); } function td(l) { return l.host === window.location.host || l.host === "localhost:7860" || l.host === "127.0.0.1:7860" || // Ref: https://github.com/gradio-app/gradio/blob/v3.32.0/js/app/src/Index.svelte#L194 l.host === "lite.local"; } function La(l, e) { const t = e.toLowerCase(); for (const [n, i] of Object.entries(l)) if (n.toLowerCase() === t) return i; } function Da(l) { if (l == null) return !1; const e = new URL(l, window.location.href); return !(!td(e) || e.protocol !== "http:" && e.protocol !== "https:"); } async function nd(l) { if (l == null || !Da(l)) return l; const e = Aa(); if (e == null) return l; const n = new URL(l, window.location.href).pathname; return e.httpRequest({ method: "GET", path: n, headers: {}, query_string: "" }).then((i) => { if (i.status !== 200) throw new Error(`Failed to get file ${n} from the Wasm worker.`); const o = new Blob([i.body], { type: La(i.headers, "content-type") }); return URL.createObjectURL(o); }); } const { SvelteComponent: ld, assign: Il, check_outros: Ra, compute_rest_props: rs, create_slot: oo, detach: Jl, element: Ta, empty: Ia, exclude_internal_props: id, get_all_dirty_from_scope: so, get_slot_changes: ao, get_spread_update: ja, group_outros: Ha, init: od, insert: Ql, listen: Fa, prevent_default: sd, safe_not_equal: ad, set_attributes: jl, transition_in: Gt, transition_out: Jt, update_slot_base: ro } = window.__gradio__svelte__internal, { createEventDispatcher: rd } = window.__gradio__svelte__internal; function fd(l) { let e, t, n, i, o; const s = ( /*#slots*/ l[8].default ), r = oo( s, l, /*$$scope*/ l[7], null ); let a = [ { href: ( /*href*/ l[0] ) }, { target: t = typeof window < "u" && window.__is_colab__ ? "_blank" : null }, { rel: "noopener noreferrer" }, { download: ( /*download*/ l[1] ) }, /*$$restProps*/ l[6] ], f = {}; for (let u = 0; u < a.length; u += 1) f = Il(f, a[u]); return { c() { e = Ta("a"), r && r.c(), jl(e, f); }, m(u, c) { Ql(u, e, c), r && r.m(e, null), n = !0, i || (o = Fa( e, "click", /*dispatch*/ l[3].bind(null, "click") ), i = !0); }, p(u, c) { r && r.p && (!n || c & /*$$scope*/ 128) && ro( r, s, u, /*$$scope*/ u[7], n ? ao( s, /*$$scope*/ u[7], c, null ) : so( /*$$scope*/ u[7] ), null ), jl(e, f = ja(a, [ (!n || c & /*href*/ 1) && { href: ( /*href*/ u[0] ) }, { target: t }, { rel: "noopener noreferrer" }, (!n || c & /*download*/ 2) && { download: ( /*download*/ u[1] ) }, c & /*$$restProps*/ 64 && /*$$restProps*/ u[6] ])); }, i(u) { n || (Gt(r, u), n = !0); }, o(u) { Jt(r, u), n = !1; }, d(u) { u && Jl(e), r && r.d(u), i = !1, o(); } }; } function ud(l) { let e, t, n, i; const o = [_d, cd], s = []; function r(a, f) { return ( /*is_downloading*/ a[2] ? 0 : 1 ); } return e = r(l), t = s[e] = o[e](l), { c() { t.c(), n = Ia(); }, m(a, f) { s[e].m(a, f), Ql(a, n, f), i = !0; }, p(a, f) { let u = e; e = r(a), e === u ? s[e].p(a, f) : (Ha(), Jt(s[u], 1, 1, () => { s[u] = null; }), Ra(), t = s[e], t ? t.p(a, f) : (t = s[e] = o[e](a), t.c()), Gt(t, 1), t.m(n.parentNode, n)); }, i(a) { i || (Gt(t), i = !0); }, o(a) { Jt(t), i = !1; }, d(a) { a && Jl(n), s[e].d(a); } }; } function cd(l) { let e, t, n, i; const o = ( /*#slots*/ l[8].default ), s = oo( o, l, /*$$scope*/ l[7], null ); let r = [ /*$$restProps*/ l[6], { href: ( /*href*/ l[0] ) } ], a = {}; for (let f = 0; f < r.length; f += 1) a = Il(a, r[f]); return { c() { e = Ta("a"), s && s.c(), jl(e, a); }, m(f, u) { Ql(f, e, u), s && s.m(e, null), t = !0, n || (i = Fa(e, "click", sd( /*wasm_click_handler*/ l[5] )), n = !0); }, p(f, u) { s && s.p && (!t || u & /*$$scope*/ 128) && ro( s, o, f, /*$$scope*/ f[7], t ? ao( o, /*$$scope*/ f[7], u, null ) : so( /*$$scope*/ f[7] ), null ), jl(e, a = ja(r, [ u & /*$$restProps*/ 64 && /*$$restProps*/ f[6], (!t || u & /*href*/ 1) && { href: ( /*href*/ f[0] ) } ])); }, i(f) { t || (Gt(s, f), t = !0); }, o(f) { Jt(s, f), t = !1; }, d(f) { f && Jl(e), s && s.d(f), n = !1, i(); } }; } function _d(l) { let e; const t = ( /*#slots*/ l[8].default ), n = oo( t, l, /*$$scope*/ l[7], null ); return { c() { n && n.c(); }, m(i, o) { n && n.m(i, o), e = !0; }, p(i, o) { n && n.p && (!e || o & /*$$scope*/ 128) && ro( n, t, i, /*$$scope*/ i[7], e ? ao( t, /*$$scope*/ i[7], o, null ) : so( /*$$scope*/ i[7] ), null ); }, i(i) { e || (Gt(n, i), e = !0); }, o(i) { Jt(n, i), e = !1; }, d(i) { n && n.d(i); } }; } function dd(l) { let e, t, n, i, o; const s = [ud, fd], r = []; function a(f, u) { return u & /*href*/ 1 && (e = null), e == null && (e = !!/*worker_proxy*/ (f[4] && Da( /*href*/ f[0] ))), e ? 0 : 1; } return t = a(l, -1), n = r[t] = s[t](l), { c() { n.c(), i = Ia(); }, m(f, u) { r[t].m(f, u), Ql(f, i, u), o = !0; }, p(f, [u]) { let c = t; t = a(f, u), t === c ? r[t].p(f, u) : (Ha(), Jt(r[c], 1, 1, () => { r[c] = null; }), Ra(), n = r[t], n ? n.p(f, u) : (n = r[t] = s[t](f), n.c()), Gt(n, 1), n.m(i.parentNode, i)); }, i(f) { o || (Gt(n), o = !0); }, o(f) { Jt(n), o = !1; }, d(f) { f && Jl(i), r[t].d(f); } }; } function hd(l, e, t) { const n = ["href", "download"]; let i = rs(e, n), { $$slots: o = {}, $$scope: s } = e; var r = this && this.__awaiter || function(h, m, w, b) { function p(g) { return g instanceof w ? g : new w(function(v) { v(g); }); } return new (w || (w = Promise))(function(g, v) { function E(k) { try { C(b.next(k)); } catch (A) { v(A); } } function y(k) { try { C(b.throw(k)); } catch (A) { v(A); } } function C(k) { k.done ? g(k.value) : p(k.value).then(E, y); } C((b = b.apply(h, m || [])).next()); }); }; let { href: a = void 0 } = e, { download: f } = e; const u = rd(); let c = !1; const _ = Aa(); function d() { return r(this, void 0, void 0, function* () { if (c) return; if (u("click"), a == null) throw new Error("href is not defined."); if (_ == null) throw new Error("Wasm worker proxy is not available."); const m = new URL(a, window.location.href).pathname; t(2, c = !0), _.httpRequest({ method: "GET", path: m, headers: {}, query_string: "" }).then((w) => { if (w.status !== 200) throw new Error(`Failed to get file ${m} from the Wasm worker.`); const b = new Blob( [w.body], { type: La(w.headers, "content-type") } ), p = URL.createObjectURL(b), g = document.createElement("a"); g.href = p, g.download = f, g.click(), URL.revokeObjectURL(p); }).finally(() => { t(2, c = !1); }); }); } return l.$$set = (h) => { e = Il(Il({}, e), id(h)), t(6, i = rs(e, n)), "href" in h && t(0, a = h.href), "download" in h && t(1, f = h.download), "$$scope" in h && t(7, s = h.$$scope); }, [ a, f, c, u, _, d, i, s, o ]; } class md extends ld { constructor(e) { super(), od(this, e, hd, dd, ad, { href: 0, download: 1 }); } } var gd = Object.defineProperty, bd = (l, e, t) => e in l ? gd(l, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : l[e] = t, at = (l, e, t) => (bd(l, typeof e != "symbol" ? e + "" : e, t), t), Xa = (l, e, t) => { if (!e.has(l)) throw TypeError("Cannot " + t); }, qn = (l, e, t) => (Xa(l, e, "read from private field"), t ? t.call(l) : e.get(l)), wd = (l, e, t) => { if (e.has(l)) throw TypeError("Cannot add the same private member more than once"); e instanceof WeakSet ? e.add(l) : e.set(l, t); }, pd = (l, e, t, n) => (Xa(l, e, "write to private field"), e.set(l, t), t), zt; new Intl.Collator(0, { numeric: 1 }).compare; async function Ya(l, e) { return l.map( (t) => new vd({ path: t.name, orig_name: t.name, blob: t, size: t.size, mime_type: t.type, is_stream: e }) ); } class vd { constructor({ path: e, url: t, orig_name: n, size: i, blob: o, is_stream: s, mime_type: r, alt_text: a }) { at(this, "path"), at(this, "url"), at(this, "orig_name"), at(this, "size"), at(this, "blob"), at(this, "is_stream"), at(this, "mime_type"), at(this, "alt_text"), at(this, "meta", { _type: "gradio.FileData" }), this.path = e, this.url = t, this.orig_name = n, this.size = i, this.blob = t ? void 0 : o, this.is_stream = s, this.mime_type = r, this.alt_text = a; } } typeof process < "u" && process.versions && process.versions.node; class Gm extends TransformStream { /** Constructs a new instance. */ constructor(e = { allowCR: !1 }) { super({ transform: (t, n) => { for (t = qn(this, zt) + t; ; ) { const i = t.indexOf(` `), o = e.allowCR ? t.indexOf("\r") : -1; if (o !== -1 && o !== t.length - 1 && (i === -1 || i - 1 > o)) { n.enqueue(t.slice(0, o)), t = t.slice(o + 1); continue; } if (i === -1) break; const s = t[i - 1] === "\r" ? i - 1 : i; n.enqueue(t.slice(0, s)), t = t.slice(i + 1); } pd(this, zt, t); }, flush: (t) => { if (qn(this, zt) === "") return; const n = e.allowCR && qn(this, zt).endsWith("\r") ? qn(this, zt).slice(0, -1) : qn(this, zt); t.enqueue(n); } }), wd(this, zt, ""); } } zt = /* @__PURE__ */ new WeakMap(); const { SvelteComponent: kd, append: qe, attr: Nt, detach: Na, element: Ut, init: yd, insert: Ua, noop: fs, safe_not_equal: Cd, set_data: Hl, set_style: Bi, space: Gi, text: hn, toggle_class: us } = window.__gradio__svelte__internal, { onMount: Sd, createEventDispatcher: zd, onDestroy: Bd } = window.__gradio__svelte__internal; function cs(l) { let e, t, n, i, o = Tn( /*file_to_display*/ l[2] ) + "", s, r, a, f, u = ( /*file_to_display*/ l[2].orig_name + "" ), c; return { c() { e = Ut("div"), t = Ut("span"), n = Ut("div"), i = Ut("progress"), s = hn(o), a = Gi(), f = Ut("span"), c = hn(u), Bi(i, "visibility", "hidden"), Bi(i, "height", "0"), Bi(i, "width", "0"), i.value = r = Tn( /*file_to_display*/ l[2] ), Nt(i, "max", "100"), Nt(i, "class", "svelte-cr2edf"), Nt(n, "class", "progress-bar svelte-cr2edf"), Nt(f, "class", "file-name svelte-cr2edf"), Nt(e, "class", "file svelte-cr2edf"); }, m(_, d) { Ua(_, e, d), qe(e, t), qe(t, n), qe(n, i), qe(i, s), qe(e, a), qe(e, f), qe(f, c); }, p(_, d) { d & /*file_to_display*/ 4 && o !== (o = Tn( /*file_to_display*/ _[2] ) + "") && Hl(s, o), d & /*file_to_display*/ 4 && r !== (r = Tn( /*file_to_display*/ _[2] )) && (i.value = r), d & /*file_to_display*/ 4 && u !== (u = /*file_to_display*/ _[2].orig_name + "") && Hl(c, u); }, d(_) { _ && Na(e); } }; } function qd(l) { let e, t, n, i = ( /*files_with_progress*/ l[0].length + "" ), o, s, r = ( /*files_with_progress*/ l[0].length > 1 ? "files" : "file" ), a, f, u, c = ( /*file_to_display*/ l[2] && cs(l) ); return { c() { e = Ut("div"), t = Ut("span"), n = hn("Uploading "), o = hn(i), s = Gi(), a = hn(r), f = hn("..."), u = Gi(), c && c.c(), Nt(t, "class", "uploading svelte-cr2edf"), Nt(e, "class", "wrap svelte-cr2edf"), us( e, "progress", /*progress*/ l[1] ); }, m(_, d) { Ua(_, e, d), qe(e, t), qe(t, n), qe(t, o), qe(t, s), qe(t, a), qe(t, f), qe(e, u), c && c.m(e, null); }, p(_, [d]) { d & /*files_with_progress*/ 1 && i !== (i = /*files_with_progress*/ _[0].length + "") && Hl(o, i), d & /*files_with_progress*/ 1 && r !== (r = /*files_with_progress*/ _[0].length > 1 ? "files" : "file") && Hl(a, r), /*file_to_display*/ _[2] ? c ? c.p(_, d) : (c = cs(_), c.c(), c.m(e, null)) : c && (c.d(1), c = null), d & /*progress*/ 2 && us( e, "progress", /*progress*/ _[1] ); }, i: fs, o: fs, d(_) { _ && Na(e), c && c.d(); } }; } function Tn(l) { return l.progress * 100 / (l.size || 0) || 0; } function Ed(l) { let e = 0; return l.forEach((t) => { e += Tn(t); }), document.documentElement.style.setProperty("--upload-progress-width", (e / l.length).toFixed(2) + "%"), e / l.length; } function Md(l, e, t) { var n = this && this.__awaiter || function(m, w, b, p) { function g(v) { return v instanceof b ? v : new b(function(E) { E(v); }); } return new (b || (b = Promise))(function(v, E) { function y(A) { try { k(p.next(A)); } catch (S) { E(S); } } function C(A) { try { k(p.throw(A)); } catch (S) { E(S); } } function k(A) { A.done ? v(A.value) : g(A.value).then(y, C); } k((p = p.apply(m, w || [])).next()); }); }; let { upload_id: i } = e, { root: o } = e, { files: s } = e, { stream_handler: r } = e, a, f = !1, u, c, _ = s.map((m) => Object.assign(Object.assign({}, m), { progress: 0 })); const d = zd(); function h(m, w) { t(0, _ = _.map((b) => (b.orig_name === m && (b.progress += w), b))); } return Sd(() => n(void 0, void 0, void 0, function* () { if (a = yield r(new URL(`${o}/upload_progress?upload_id=${i}`)), a == null) throw new Error("Event source is not defined"); a.onmessage = function(m) { return n(this, void 0, void 0, function* () { const w = JSON.parse(m.data); f || t(1, f = !0), w.msg === "done" ? (a == null || a.close(), d("done")) : (t(7, u = w), h(w.orig_name, w.chunk_size)); }); }; })), Bd(() => { (a != null || a != null) && a.close(); }), l.$$set = (m) => { "upload_id" in m && t(3, i = m.upload_id), "root" in m && t(4, o = m.root), "files" in m && t(5, s = m.files), "stream_handler" in m && t(6, r = m.stream_handler); }, l.$$.update = () => { l.$$.dirty & /*files_with_progress*/ 1 && Ed(_), l.$$.dirty & /*current_file_upload, files_with_progress*/ 129 && t(2, c = u || _[0]); }, [ _, f, c, i, o, s, r, u ]; } class Ad extends kd { constructor(e) { super(), yd(this, e, Md, qd, Cd, { upload_id: 3, root: 4, files: 5, stream_handler: 6 }); } } const { SvelteComponent: Ld, append: _s, attr: pe, binding_callbacks: Dd, bubble: Dt, check_outros: Oa, create_component: Rd, create_slot: Wa, destroy_component: Td, detach: xl, element: Ji, empty: Va, get_all_dirty_from_scope: Pa, get_slot_changes: Za, group_outros: Ka, init: Id, insert: $l, listen: Le, mount_component: jd, prevent_default: Rt, run_all: Hd, safe_not_equal: Fd, set_style: Ga, space: Xd, stop_propagation: Tt, toggle_class: de, transition_in: Mt, transition_out: Qt, update_slot_base: Ja } = window.__gradio__svelte__internal, { createEventDispatcher: Yd, tick: Nd } = window.__gradio__svelte__internal; function Ud(l) { let e, t, n, i, o, s, r, a, f, u, c; const _ = ( /*#slots*/ l[26].default ), d = Wa( _, l, /*$$scope*/ l[25], null ); return { c() { e = Ji("button"), d && d.c(), t = Xd(), n = Ji("input"), pe(n, "aria-label", "file upload"), pe(n, "data-testid", "file-upload"), pe(n, "type", "file"), pe(n, "accept", i = /*accept_file_types*/ l[16] || void 0), n.multiple = o = /*file_count*/ l[6] === "multiple" || void 0, pe(n, "webkitdirectory", s = /*file_count*/ l[6] === "directory" || void 0), pe(n, "mozdirectory", r = /*file_count*/ l[6] === "directory" || void 0), pe(n, "class", "svelte-1s26xmt"), pe(e, "tabindex", a = /*hidden*/ l[9] ? -1 : 0), pe(e, "class", "svelte-1s26xmt"), de( e, "hidden", /*hidden*/ l[9] ), de( e, "center", /*center*/ l[4] ), de( e, "boundedheight", /*boundedheight*/ l[3] ), de( e, "flex", /*flex*/ l[5] ), de( e, "disable_click", /*disable_click*/ l[7] ), Ga(e, "height", "100%"); }, m(h, m) { $l(h, e, m), d && d.m(e, null), _s(e, t), _s(e, n), l[34](n), f = !0, u || (c = [ Le( n, "change", /*load_files_from_upload*/ l[18] ), Le(e, "drag", Tt(Rt( /*drag_handler*/ l[27] ))), Le(e, "dragstart", Tt(Rt( /*dragstart_handler*/ l[28] ))), Le(e, "dragend", Tt(Rt( /*dragend_handler*/ l[29] ))), Le(e, "dragover", Tt(Rt( /*dragover_handler*/ l[30] ))), Le(e, "dragenter", Tt(Rt( /*dragenter_handler*/ l[31] ))), Le(e, "dragleave", Tt(Rt( /*dragleave_handler*/ l[32] ))), Le(e, "drop", Tt(Rt( /*drop_handler*/ l[33] ))), Le( e, "click", /*open_file_upload*/ l[13] ), Le( e, "drop", /*loadFilesFromDrop*/ l[19] ), Le( e, "dragenter", /*updateDragging*/ l[17] ), Le( e, "dragleave", /*updateDragging*/ l[17] ) ], u = !0); }, p(h, m) { d && d.p && (!f || m[0] & /*$$scope*/ 33554432) && Ja( d, _, h, /*$$scope*/ h[25], f ? Za( _, /*$$scope*/ h[25], m, null ) : Pa( /*$$scope*/ h[25] ), null ), (!f || m[0] & /*accept_file_types*/ 65536 && i !== (i = /*accept_file_types*/ h[16] || void 0)) && pe(n, "accept", i), (!f || m[0] & /*file_count*/ 64 && o !== (o = /*file_count*/ h[6] === "multiple" || void 0)) && (n.multiple = o), (!f || m[0] & /*file_count*/ 64 && s !== (s = /*file_count*/ h[6] === "directory" || void 0)) && pe(n, "webkitdirectory", s), (!f || m[0] & /*file_count*/ 64 && r !== (r = /*file_count*/ h[6] === "directory" || void 0)) && pe(n, "mozdirectory", r), (!f || m[0] & /*hidden*/ 512 && a !== (a = /*hidden*/ h[9] ? -1 : 0)) && pe(e, "tabindex", a), (!f || m[0] & /*hidden*/ 512) && de( e, "hidden", /*hidden*/ h[9] ), (!f || m[0] & /*center*/ 16) && de( e, "center", /*center*/ h[4] ), (!f || m[0] & /*boundedheight*/ 8) && de( e, "boundedheight", /*boundedheight*/ h[3] ), (!f || m[0] & /*flex*/ 32) && de( e, "flex", /*flex*/ h[5] ), (!f || m[0] & /*disable_click*/ 128) && de( e, "disable_click", /*disable_click*/ h[7] ); }, i(h) { f || (Mt(d, h), f = !0); }, o(h) { Qt(d, h), f = !1; }, d(h) { h && xl(e), d && d.d(h), l[34](null), u = !1, Hd(c); } }; } function Od(l) { let e, t, n = !/*hidden*/ l[9] && ds(l); return { c() { n && n.c(), e = Va(); }, m(i, o) { n && n.m(i, o), $l(i, e, o), t = !0; }, p(i, o) { /*hidden*/ i[9] ? n && (Ka(), Qt(n, 1, 1, () => { n = null; }), Oa()) : n ? (n.p(i, o), o[0] & /*hidden*/ 512 && Mt(n, 1)) : (n = ds(i), n.c(), Mt(n, 1), n.m(e.parentNode, e)); }, i(i) { t || (Mt(n), t = !0); }, o(i) { Qt(n), t = !1; }, d(i) { i && xl(e), n && n.d(i); } }; } function Wd(l) { let e, t, n, i, o; const s = ( /*#slots*/ l[26].default ), r = Wa( s, l, /*$$scope*/ l[25], null ); return { c() { e = Ji("button"), r && r.c(), pe(e, "tabindex", t = /*hidden*/ l[9] ? -1 : 0), pe(e, "class", "svelte-1s26xmt"), de( e, "hidden", /*hidden*/ l[9] ), de( e, "center", /*center*/ l[4] ), de( e, "boundedheight", /*boundedheight*/ l[3] ), de( e, "flex", /*flex*/ l[5] ), Ga(e, "height", "100%"); }, m(a, f) { $l(a, e, f), r && r.m(e, null), n = !0, i || (o = Le( e, "click", /*paste_clipboard*/ l[12] ), i = !0); }, p(a, f) { r && r.p && (!n || f[0] & /*$$scope*/ 33554432) && Ja( r, s, a, /*$$scope*/ a[25], n ? Za( s, /*$$scope*/ a[25], f, null ) : Pa( /*$$scope*/ a[25] ), null ), (!n || f[0] & /*hidden*/ 512 && t !== (t = /*hidden*/ a[9] ? -1 : 0)) && pe(e, "tabindex", t), (!n || f[0] & /*hidden*/ 512) && de( e, "hidden", /*hidden*/ a[9] ), (!n || f[0] & /*center*/ 16) && de( e, "center", /*center*/ a[4] ), (!n || f[0] & /*boundedheight*/ 8) && de( e, "boundedheight", /*boundedheight*/ a[3] ), (!n || f[0] & /*flex*/ 32) && de( e, "flex", /*flex*/ a[5] ); }, i(a) { n || (Mt(r, a), n = !0); }, o(a) { Qt(r, a), n = !1; }, d(a) { a && xl(e), r && r.d(a), i = !1, o(); } }; } function ds(l) { let e, t; return e = new Ad({ props: { root: ( /*root*/ l[8] ), upload_id: ( /*upload_id*/ l[14] ), files: ( /*file_data*/ l[15] ), stream_handler: ( /*stream_handler*/ l[11] ) } }), { c() { Rd(e.$$.fragment); }, m(n, i) { jd(e, n, i), t = !0; }, p(n, i) { const o = {}; i[0] & /*root*/ 256 && (o.root = /*root*/ n[8]), i[0] & /*upload_id*/ 16384 && (o.upload_id = /*upload_id*/ n[14]), i[0] & /*file_data*/ 32768 && (o.files = /*file_data*/ n[15]), i[0] & /*stream_handler*/ 2048 && (o.stream_handler = /*stream_handler*/ n[11]), e.$set(o); }, i(n) { t || (Mt(e.$$.fragment, n), t = !0); }, o(n) { Qt(e.$$.fragment, n), t = !1; }, d(n) { Td(e, n); } }; } function Vd(l) { let e, t, n, i; const o = [Wd, Od, Ud], s = []; function r(a, f) { return ( /*filetype*/ a[0] === "clipboard" ? 0 : ( /*uploading*/ a[1] && /*show_progress*/ a[10] ? 1 : 2 ) ); } return e = r(l), t = s[e] = o[e](l), { c() { t.c(), n = Va(); }, m(a, f) { s[e].m(a, f), $l(a, n, f), i = !0; }, p(a, f) { let u = e; e = r(a), e === u ? s[e].p(a, f) : (Ka(), Qt(s[u], 1, 1, () => { s[u] = null; }), Oa(), t = s[e], t ? t.p(a, f) : (t = s[e] = o[e](a), t.c()), Mt(t, 1), t.m(n.parentNode, n)); }, i(a) { i || (Mt(t), i = !0); }, o(a) { Qt(t), i = !1; }, d(a) { a && xl(n), s[e].d(a); } }; } function Pd(l, e, t) { if (!l || l === "*" || l === "file/*" || Array.isArray(l) && l.some((i) => i === "*" || i === "file/*")) return !0; let n; if (typeof l == "string") n = l.split(",").map((i) => i.trim()); else if (Array.isArray(l)) n = l; else return !1; return n.includes(e) || n.some((i) => { const [o] = i.split("/").map((s) => s.trim()); return i.endsWith("/*") && t.startsWith(o + "/"); }); } function Zd(l, e, t) { let { $$slots: n = {}, $$scope: i } = e; var o = this && this.__awaiter || function(M, H, G, q) { function ue(Ye) { return Ye instanceof G ? Ye : new G(function(Qe) { Qe(Ye); }); } return new (G || (G = Promise))(function(Ye, Qe) { function ke(Ue) { try { Ne(q.next(Ue)); } catch (bt) { Qe(bt); } } function be(Ue) { try { Ne(q.throw(Ue)); } catch (bt) { Qe(bt); } } function Ne(Ue) { Ue.done ? Ye(Ue.value) : ue(Ue.value).then(ke, be); } Ne((q = q.apply(M, H || [])).next()); }); }; let { filetype: s = null } = e, { dragging: r = !1 } = e, { boundedheight: a = !0 } = e, { center: f = !0 } = e, { flex: u = !0 } = e, { file_count: c = "single" } = e, { disable_click: _ = !1 } = e, { root: d } = e, { hidden: h = !1 } = e, { format: m = "file" } = e, { uploading: w = !1 } = e, { hidden_upload: b = null } = e, { show_progress: p = !0 } = e, { max_file_size: g = null } = e, { upload: v } = e, { stream_handler: E } = e, y, C, k; const A = Yd(), S = ["image", "video", "audio", "text", "file"], T = (M) => M.startsWith(".") || M.endsWith("/*") ? M : S.includes(M) ? M + "/*" : "." + M; function R() { t(20, r = !r); } function U() { navigator.clipboard.read().then((M) => o(this, void 0, void 0, function* () { for (let H = 0; H < M.length; H++) { const G = M[H].types.find((q) => q.startsWith("image/")); if (G) { M[H].getType(G).then((q) => o(this, void 0, void 0, function* () { const ue = new File([q], `clipboard.${G.replace("image/", "")}`); yield J([ue]); })); break; } } })); } function Z() { _ || b && (t(2, b.value = "", b), b.click()); } function Q(M) { return o(this, void 0, void 0, function* () { yield Nd(), t(14, y = Math.random().toString(36).substring(2, 15)), t(1, w = !0); try { const H = yield v(M, d, y, g ?? 1 / 0); return A("load", c === "single" ? H == null ? void 0 : H[0] : H), t(1, w = !1), H || []; } catch (H) { return A("error", H.message), t(1, w = !1), []; } }); } function J(M) { return o(this, void 0, void 0, function* () { if (!M.length) return; let H = M.map((G) => new File([G], G instanceof File ? G.name : "file", { type: G.type })); return t(15, C = yield Ya(H)), yield Q(C); }); } function K(M) { return o(this, void 0, void 0, function* () { const H = M.target; if (H.files) if (m != "blob") yield J(Array.from(H.files)); else { if (c === "single") { A("load", H.files[0]); return; } A("load", H.files); } }); } function L(M) { return o(this, void 0, void 0, function* () { var H; if (t(20, r = !1), !(!((H = M.dataTransfer) === null || H === void 0) && H.files)) return; const G = Array.from(M.dataTransfer.files).filter((q) => { const ue = "." + q.name.split(".").pop(); return ue && Pd(k, ue, q.type) || (ue && Array.isArray(s) ? s.includes(ue) : ue === s) ? !0 : (A("error", `Invalid file type only ${s} allowed.`), !1); }); yield J(G); }); } function F(M) { Dt.call(this, l, M); } function D(M) { Dt.call(this, l, M); } function W(M) { Dt.call(this, l, M); } function $(M) { Dt.call(this, l, M); } function oe(M) { Dt.call(this, l, M); } function ge(M) { Dt.call(this, l, M); } function I(M) { Dt.call(this, l, M); } function Xe(M) { Dd[M ? "unshift" : "push"](() => { b = M, t(2, b); }); } return l.$$set = (M) => { "filetype" in M && t(0, s = M.filetype), "dragging" in M && t(20, r = M.dragging), "boundedheight" in M && t(3, a = M.boundedheight), "center" in M && t(4, f = M.center), "flex" in M && t(5, u = M.flex), "file_count" in M && t(6, c = M.file_count), "disable_click" in M && t(7, _ = M.disable_click), "root" in M && t(8, d = M.root), "hidden" in M && t(9, h = M.hidden), "format" in M && t(21, m = M.format), "uploading" in M && t(1, w = M.uploading), "hidden_upload" in M && t(2, b = M.hidden_upload), "show_progress" in M && t(10, p = M.show_progress), "max_file_size" in M && t(22, g = M.max_file_size), "upload" in M && t(23, v = M.upload), "stream_handler" in M && t(11, E = M.stream_handler), "$$scope" in M && t(25, i = M.$$scope); }, l.$$.update = () => { l.$$.dirty[0] & /*filetype*/ 1 && (s == null ? t(16, k = null) : typeof s == "string" ? t(16, k = T(s)) : (t(0, s = s.map(T)), t(16, k = s.join(", ")))); }, [ s, w, b, a, f, u, c, _, d, h, p, E, U, Z, y, C, k, R, K, L, r, m, g, v, J, i, n, F, D, W, $, oe, ge, I, Xe ]; } class Kd extends Ld { constructor(e) { super(), Id( this, e, Zd, Vd, Fd, { filetype: 0, dragging: 20, boundedheight: 3, center: 4, flex: 5, file_count: 6, disable_click: 7, root: 8, hidden: 9, format: 21, uploading: 1, hidden_upload: 2, show_progress: 10, max_file_size: 22, upload: 23, stream_handler: 11, paste_clipboard: 12, open_file_upload: 13, load_files: 24 }, null, [-1, -1] ); } get paste_clipboard() { return this.$$.ctx[12]; } get open_file_upload() { return this.$$.ctx[13]; } get load_files() { return this.$$.ctx[24]; } } const { SvelteComponent: Gd, append: dl, attr: qi, create_component: Jd, destroy_component: Qd, detach: xd, element: Ei, init: $d, insert: e1, listen: t1, mount_component: n1, noop: l1, safe_not_equal: i1, set_style: o1, space: s1, text: a1, transition_in: r1, transition_out: f1 } = window.__gradio__svelte__internal, { createEventDispatcher: u1 } = window.__gradio__svelte__internal; function c1(l) { let e, t, n, i, o, s = "Click to Access Webcam", r, a, f, u; return i = new ha({}), { c() { e = Ei("button"), t = Ei("div"), n = Ei("span"), Jd(i.$$.fragment), o = s1(), r = a1(s), qi(n, "class", "icon-wrap svelte-fjcd9c"), qi(t, "class", "wrap svelte-fjcd9c"), qi(e, "class", "svelte-fjcd9c"), o1(e, "height", "100%"); }, m(c, _) { e1(c, e, _), dl(e, t), dl(t, n), n1(i, n, null), dl(t, o), dl(t, r), a = !0, f || (u = t1( e, "click", /*click_handler*/ l[1] ), f = !0); }, p: l1, i(c) { a || (r1(i.$$.fragment, c), a = !0); }, o(c) { f1(i.$$.fragment, c), a = !1; }, d(c) { c && xd(e), Qd(i), f = !1, u(); } }; } function _1(l) { const e = u1(); return [e, () => e("click")]; } class d1 extends Gd { constructor(e) { super(), $d(this, e, _1, c1, i1, {}); } } function h1() { return navigator.mediaDevices.enumerateDevices(); } function m1(l, e) { e.srcObject = l, e.muted = !0, e.play(); } async function hs(l, e, t) { const n = { width: { ideal: 1920 }, height: { ideal: 1440 } }, i = { video: t ? { deviceId: { exact: t }, ...n } : n, audio: l }; return navigator.mediaDevices.getUserMedia(i).then((o) => (m1(o, e), o)); } function g1(l) { return l.filter( (t) => t.kind === "videoinput" ); } const { SvelteComponent: b1, action_destroyer: w1, add_render_callback: p1, append: ct, attr: re, binding_callbacks: v1, check_outros: Un, create_component: kn, create_in_transition: k1, destroy_component: yn, destroy_each: y1, detach: Ee, element: Ie, empty: fo, ensure_array_like: ms, group_outros: On, init: C1, insert: Me, listen: Fl, mount_component: Cn, noop: uo, run_all: S1, safe_not_equal: z1, set_data: Qa, set_input_value: Qi, space: Kn, stop_propagation: B1, text: xa, toggle_class: hl, transition_in: he, transition_out: ve } = window.__gradio__svelte__internal, { createEventDispatcher: q1, onMount: E1 } = window.__gradio__svelte__internal; function gs(l, e, t) { const n = l.slice(); return n[32] = e[t], n; } function M1(l) { let e, t, n, i, o, s, r, a, f, u, c; const _ = [D1, L1], d = []; function h(b, p) { return ( /*mode*/ b[1] === "video" || /*streaming*/ b[0] ? 0 : 1 ); } n = h(l), i = d[n] = _[n](l); let m = !/*recording*/ l[8] && bs(l), w = ( /*options_open*/ l[10] && /*selected_device*/ l[7] && ws(l) ); return { c() { e = Ie("div"), t = Ie("button"), i.c(), s = Kn(), m && m.c(), r = Kn(), w && w.c(), a = fo(), re(t, "aria-label", o = /*mode*/ l[1] === "image" ? "capture photo" : "start recording"), re(t, "class", "svelte-8hqvb6"), re(e, "class", "button-wrap svelte-8hqvb6"); }, m(b, p) { Me(b, e, p), ct(e, t), d[n].m(t, null), ct(e, s), m && m.m(e, null), Me(b, r, p), w && w.m(b, p), Me(b, a, p), f = !0, u || (c = Fl( t, "click", /*record_video_or_photo*/ l[13] ), u = !0); }, p(b, p) { let g = n; n = h(b), n === g ? d[n].p(b, p) : (On(), ve(d[g], 1, 1, () => { d[g] = null; }), Un(), i = d[n], i ? i.p(b, p) : (i = d[n] = _[n](b), i.c()), he(i, 1), i.m(t, null)), (!f || p[0] & /*mode*/ 2 && o !== (o = /*mode*/ b[1] === "image" ? "capture photo" : "start recording")) && re(t, "aria-label", o), /*recording*/ b[8] ? m && (On(), ve(m, 1, 1, () => { m = null; }), Un()) : m ? (m.p(b, p), p[0] & /*recording*/ 256 && he(m, 1)) : (m = bs(b), m.c(), he(m, 1), m.m(e, null)), /*options_open*/ b[10] && /*selected_device*/ b[7] ? w ? (w.p(b, p), p[0] & /*options_open, selected_device*/ 1152 && he(w, 1)) : (w = ws(b), w.c(), he(w, 1), w.m(a.parentNode, a)) : w && (On(), ve(w, 1, 1, () => { w = null; }), Un()); }, i(b) { f || (he(i), he(m), he(w), f = !0); }, o(b) { ve(i), ve(m), ve(w), f = !1; }, d(b) { b && (Ee(e), Ee(r), Ee(a)), d[n].d(), m && m.d(), w && w.d(b), u = !1, c(); } }; } function A1(l) { let e, t, n, i; return t = new d1({}), t.$on( "click", /*click_handler*/ l[20] ), { c() { e = Ie("div"), kn(t.$$.fragment), re(e, "title", "grant webcam access"); }, m(o, s) { Me(o, e, s), Cn(t, e, null), i = !0; }, p: uo, i(o) { i || (he(t.$$.fragment, o), o && (n || p1(() => { n = k1(e, w_, { delay: 100, duration: 200 }), n.start(); })), i = !0); }, o(o) { ve(t.$$.fragment, o), i = !1; }, d(o) { o && Ee(e), yn(t); } }; } function L1(l) { let e, t, n; return t = new du({}), { c() { e = Ie("div"), kn(t.$$.fragment), re(e, "class", "icon svelte-8hqvb6"), re(e, "title", "capture photo"); }, m(i, o) { Me(i, e, o), Cn(t, e, null), n = !0; }, p: uo, i(i) { n || (he(t.$$.fragment, i), n = !0); }, o(i) { ve(t.$$.fragment, i), n = !1; }, d(i) { i && Ee(e), yn(t); } }; } function D1(l) { let e, t, n, i; const o = [T1, R1], s = []; function r(a, f) { return ( /*recording*/ a[8] ? 0 : 1 ); } return e = r(l), t = s[e] = o[e](l), { c() { t.c(), n = fo(); }, m(a, f) { s[e].m(a, f), Me(a, n, f), i = !0; }, p(a, f) { let u = e; e = r(a), e !== u && (On(), ve(s[u], 1, 1, () => { s[u] = null; }), Un(), t = s[e], t || (t = s[e] = o[e](a), t.c()), he(t, 1), t.m(n.parentNode, n)); }, i(a) { i || (he(t), i = !0); }, o(a) { ve(t), i = !1; }, d(a) { a && Ee(n), s[e].d(a); } }; } function R1(l) { let e, t, n; return t = new ku({}), { c() { e = Ie("div"), kn(t.$$.fragment), re(e, "class", "icon red svelte-8hqvb6"), re(e, "title", "start recording"); }, m(i, o) { Me(i, e, o), Cn(t, e, null), n = !0; }, i(i) { n || (he(t.$$.fragment, i), n = !0); }, o(i) { ve(t.$$.fragment, i), n = !1; }, d(i) { i && Ee(e), yn(t); } }; } function T1(l) { let e, t, n; return t = new Sc({}), { c() { e = Ie("div"), kn(t.$$.fragment), re(e, "class", "icon red svelte-8hqvb6"), re(e, "title", "stop recording"); }, m(i, o) { Me(i, e, o), Cn(t, e, null), n = !0; }, i(i) { n || (he(t.$$.fragment, i), n = !0); }, o(i) { ve(t.$$.fragment, i), n = !1; }, d(i) { i && Ee(e), yn(t); } }; } function bs(l) { let e, t, n, i, o; return t = new io({}), { c() { e = Ie("button"), kn(t.$$.fragment), re(e, "class", "icon svelte-8hqvb6"), re(e, "aria-label", "select input source"); }, m(s, r) { Me(s, e, r), Cn(t, e, null), n = !0, i || (o = Fl( e, "click", /*click_handler_1*/ l[21] ), i = !0); }, p: uo, i(s) { n || (he(t.$$.fragment, s), n = !0); }, o(s) { ve(t.$$.fragment, s), n = !1; }, d(s) { s && Ee(e), yn(t), i = !1, o(); } }; } function ws(l) { let e, t, n, i, o, s, r; n = new io({}); function a(c, _) { return ( /*available_video_devices*/ c[6].length === 0 ? j1 : I1 ); } let f = a(l), u = f(l); return { c() { e = Ie("select"), t = Ie("button"), kn(n.$$.fragment), i = Kn(), u.c(), re(t, "class", "inset-icon svelte-8hqvb6"), re(e, "class", "select-wrap svelte-8hqvb6"), re(e, "aria-label", "select source"); }, m(c, _) { Me(c, e, _), ct(e, t), Cn(n, t, null), ct(t, i), u.m(e, null), o = !0, s || (r = [ Fl(t, "click", B1( /*click_handler_2*/ l[22] )), w1(co.call( null, e, /*handle_click_outside*/ l[14] )), Fl( e, "change", /*handle_device_change*/ l[11] ) ], s = !0); }, p(c, _) { f === (f = a(c)) && u ? u.p(c, _) : (u.d(1), u = f(c), u && (u.c(), u.m(e, null))); }, i(c) { o || (he(n.$$.fragment, c), o = !0); }, o(c) { ve(n.$$.fragment, c), o = !1; }, d(c) { c && Ee(e), yn(n), u.d(), s = !1, S1(r); } }; } function I1(l) { let e, t = ms( /*available_video_devices*/ l[6] ), n = []; for (let i = 0; i < t.length; i += 1) n[i] = ps(gs(l, t, i)); return { c() { for (let i = 0; i < n.length; i += 1) n[i].c(); e = fo(); }, m(i, o) { for (let s = 0; s < n.length; s += 1) n[s] && n[s].m(i, o); Me(i, e, o); }, p(i, o) { if (o[0] & /*available_video_devices, selected_device*/ 192) { t = ms( /*available_video_devices*/ i[6] ); let s; for (s = 0; s < t.length; s += 1) { const r = gs(i, t, s); n[s] ? n[s].p(r, o) : (n[s] = ps(r), n[s].c(), n[s].m(e.parentNode, e)); } for (; s < n.length; s += 1) n[s].d(1); n.length = t.length; } }, d(i) { i && Ee(e), y1(n, i); } }; } function j1(l) { let e, t = ( /*i18n*/ l[3]("common.no_devices") + "" ), n; return { c() { e = Ie("option"), n = xa(t), e.__value = "", Qi(e, e.__value), re(e, "class", "svelte-8hqvb6"); }, m(i, o) { Me(i, e, o), ct(e, n); }, p(i, o) { o[0] & /*i18n*/ 8 && t !== (t = /*i18n*/ i[3]("common.no_devices") + "") && Qa(n, t); }, d(i) { i && Ee(e); } }; } function ps(l) { let e, t = ( /*device*/ l[32].label + "" ), n, i, o, s; return { c() { e = Ie("option"), n = xa(t), i = Kn(), e.__value = o = /*device*/ l[32].deviceId, Qi(e, e.__value), e.selected = s = /*selected_device*/ l[7].deviceId === /*device*/ l[32].deviceId, re(e, "class", "svelte-8hqvb6"); }, m(r, a) { Me(r, e, a), ct(e, n), ct(e, i); }, p(r, a) { a[0] & /*available_video_devices*/ 64 && t !== (t = /*device*/ r[32].label + "") && Qa(n, t), a[0] & /*available_video_devices*/ 64 && o !== (o = /*device*/ r[32].deviceId) && (e.__value = o, Qi(e, e.__value)), a[0] & /*selected_device, available_video_devices*/ 192 && s !== (s = /*selected_device*/ r[7].deviceId === /*device*/ r[32].deviceId) && (e.selected = s); }, d(r) { r && Ee(e); } }; } function H1(l) { let e, t, n, i, o, s; const r = [A1, M1], a = []; function f(u, c) { return ( /*webcam_accessed*/ u[9] ? 1 : 0 ); } return i = f(l), o = a[i] = r[i](l), { c() { e = Ie("div"), t = Ie("video"), n = Kn(), o.c(), re(t, "class", "svelte-8hqvb6"), hl( t, "flip", /*mirror_webcam*/ l[2] ), hl(t, "hide", !/*webcam_accessed*/ l[9]), re(e, "class", "wrap svelte-8hqvb6"); }, m(u, c) { Me(u, e, c), ct(e, t), l[19](t), ct(e, n), a[i].m(e, null), s = !0; }, p(u, c) { (!s || c[0] & /*mirror_webcam*/ 4) && hl( t, "flip", /*mirror_webcam*/ u[2] ), (!s || c[0] & /*webcam_accessed*/ 512) && hl(t, "hide", !/*webcam_accessed*/ u[9]); let _ = i; i = f(u), i === _ ? a[i].p(u, c) : (On(), ve(a[_], 1, 1, () => { a[_] = null; }), Un(), o = a[i], o ? o.p(u, c) : (o = a[i] = r[i](u), o.c()), he(o, 1), o.m(e, null)); }, i(u) { s || (he(o), s = !0); }, o(u) { ve(o), s = !1; }, d(u) { u && Ee(e), l[19](null), a[i].d(); } }; } function co(l, e) { const t = (n) => { l && !l.contains(n.target) && !n.defaultPrevented && e(n); }; return document.addEventListener("click", t, !0), { destroy() { document.removeEventListener("click", t, !0); } }; } function F1(l, e, t) { var n = this && this.__awaiter || function(L, F, D, W) { function $(oe) { return oe instanceof D ? oe : new D(function(ge) { ge(oe); }); } return new (D || (D = Promise))(function(oe, ge) { function I(H) { try { M(W.next(H)); } catch (G) { ge(G); } } function Xe(H) { try { M(W.throw(H)); } catch (G) { ge(G); } } function M(H) { H.done ? oe(H.value) : $(H.value).then(I, Xe); } M((W = W.apply(L, F || [])).next()); }); }; let i, o = [], s = null, r, { streaming: a = !1 } = e, { pending: f = !1 } = e, { root: u = "" } = e, { mode: c = "image" } = e, { mirror_webcam: _ } = e, { include_audio: d } = e, { i18n: h } = e, { upload: m } = e; const w = q1(); E1(() => r = document.createElement("canvas")); const b = (L) => n(void 0, void 0, void 0, function* () { const D = L.target.value; yield hs(d, i, D).then((W) => n(void 0, void 0, void 0, function* () { y = W, t(7, s = o.find(($) => $.deviceId === D) || null), t(10, R = !1); })); }); function p() { return n(this, void 0, void 0, function* () { try { hs(d, i).then((L) => n(this, void 0, void 0, function* () { t(9, S = !0), t(6, o = yield h1()), y = L; })).then(() => g1(o)).then((L) => { t(6, o = L); const F = y.getTracks().map((D) => { var W; return (W = D.getSettings()) === null || W === void 0 ? void 0 : W.deviceId; })[0]; t(7, s = F && L.find((D) => D.deviceId === F) || o[0]); }), (!navigator.mediaDevices || !navigator.mediaDevices.getUserMedia) && w("error", h("image.no_webcam_support")); } catch (L) { if (L instanceof DOMException && L.name == "NotAllowedError") w("error", h("image.allow_webcam_access")); else throw L; } }); } function g() { var L = r.getContext("2d"); (!a || a && v) && i.videoWidth && i.videoHeight && (r.width = i.videoWidth, r.height = i.videoHeight, L.drawImage(i, 0, 0, i.videoWidth, i.videoHeight), _ && (L.scale(-1, 1), L.drawImage(i, -i.videoWidth, 0)), r.toBlob( (F) => { w(a ? "stream" : "capture", F); }, "image/png", 0.8 )); } let v = !1, E = [], y, C, k; function A() { if (v) { k.stop(); let L = new Blob(E, { type: C }), F = new FileReader(); F.onload = function(D) { return n(this, void 0, void 0, function* () { var W; if (D.target) { let $ = new File([L], "sample." + C.substring(6)); const oe = yield Ya([$]); let ge = ((W = yield m(oe, u)) === null || W === void 0 ? void 0 : W.filter(Boolean))[0]; w("capture", ge), w("stop_recording"); } }); }, F.readAsDataURL(L); } else { w("start_recording"), E = []; let L = ["video/webm", "video/mp4"]; for (let F of L) if (MediaRecorder.isTypeSupported(F)) { C = F; break; } if (C === null) { console.error("No supported MediaRecorder mimeType"); return; } k = new MediaRecorder(y, { mimeType: C }), k.addEventListener("dataavailable", function(F) { E.push(F.data); }), k.start(200); } t(8, v = !v); } let S = !1; function T() { c === "image" && a && t(8, v = !v), c === "image" ? g() : A(), !v && y && (y.getTracks().forEach((L) => L.stop()), t(5, i.srcObject = null, i), t(9, S = !1)); } a && c === "image" && window.setInterval( () => { i && !f && g(); }, 500 ); let R = !1; function U(L) { L.preventDefault(), L.stopPropagation(), t(10, R = !1); } function Z(L) { v1[L ? "unshift" : "push"](() => { i = L, t(5, i); }); } const Q = async () => p(), J = () => t(10, R = !0), K = () => t(10, R = !1); return l.$$set = (L) => { "streaming" in L && t(0, a = L.streaming), "pending" in L && t(15, f = L.pending), "root" in L && t(16, u = L.root), "mode" in L && t(1, c = L.mode), "mirror_webcam" in L && t(2, _ = L.mirror_webcam), "include_audio" in L && t(17, d = L.include_audio), "i18n" in L && t(3, h = L.i18n), "upload" in L && t(18, m = L.upload); }, [ a, c, _, h, co, i, o, s, v, S, R, b, p, T, U, f, u, d, m, Z, Q, J, K ]; } class X1 extends b1 { constructor(e) { super(), C1( this, e, F1, H1, z1, { streaming: 0, pending: 15, root: 16, mode: 1, mirror_webcam: 2, include_audio: 17, i18n: 3, upload: 18, click_outside: 4 }, null, [-1, -1] ); } get click_outside() { return co; } } const { SvelteComponent: Y1, append: yt, attr: j, detach: N1, init: U1, insert: O1, noop: Mi, safe_not_equal: W1, set_style: Ct, svg_element: rt } = window.__gradio__svelte__internal; function V1(l) { let e, t, n, i, o, s, r, a, f; return { c() { e = rt("svg"), t = rt("rect"), n = rt("rect"), i = rt("rect"), o = rt("rect"), s = rt("line"), r = rt("line"), a = rt("line"), f = rt("line"), j(t, "x", "2"), j(t, "y", "2"), j(t, "width", "5"), j(t, "height", "5"), j(t, "rx", "1"), j(t, "ry", "1"), j(t, "stroke-width", "2"), j(t, "fill", "none"), j(n, "x", "17"), j(n, "y", "2"), j(n, "width", "5"), j(n, "height", "5"), j(n, "rx", "1"), j(n, "ry", "1"), j(n, "stroke-width", "2"), j(n, "fill", "none"), j(i, "x", "2"), j(i, "y", "17"), j(i, "width", "5"), j(i, "height", "5"), j(i, "rx", "1"), j(i, "ry", "1"), j(i, "stroke-width", "2"), j(i, "fill", "none"), j(o, "x", "17"), j(o, "y", "17"), j(o, "width", "5"), j(o, "height", "5"), j(o, "rx", "1"), j(o, "ry", "1"), j(o, "stroke-width", "2"), j(o, "fill", "none"), j(s, "x1", "7.5"), j(s, "y1", "4.5"), j(s, "x2", "16"), j(s, "y2", "4.5"), Ct(s, "stroke-width", "2px"), j(r, "x1", "7.5"), j(r, "y1", "19.5"), j(r, "x2", "16"), j(r, "y2", "19.5"), Ct(r, "stroke-width", "2px"), j(a, "x1", "4.5"), j(a, "y1", "8"), j(a, "x2", "4.5"), j(a, "y2", "16"), Ct(a, "stroke-width", "2px"), j(f, "x1", "19.5"), j(f, "y1", "8"), j(f, "x2", "19.5"), j(f, "y2", "16"), Ct(f, "stroke-width", "2px"), j(e, "width", "100%"), j(e, "height", "100%"), j(e, "viewBox", "0 0 24 24"), j(e, "version", "1.1"), j(e, "xmlns", "http://www.w3.org/2000/svg"), j(e, "xmlns:xlink", "http://www.w3.org/1999/xlink"), j(e, "xml:space", "preserve"), j(e, "stroke", "currentColor"), Ct(e, "fill-rule", "evenodd"), Ct(e, "clip-rule", "evenodd"), Ct(e, "stroke-linecap", "round"), Ct(e, "stroke-linejoin", "round"); }, m(u, c) { O1(u, e, c), yt(e, t), yt(e, n), yt(e, i), yt(e, o), yt(e, s), yt(e, r), yt(e, a), yt(e, f); }, p: Mi, i: Mi, o: Mi, d(u) { u && N1(e); } }; } class P1 extends Y1 { constructor(e) { super(), U1(this, e, null, V1, W1, {}); } } const { SvelteComponent: Z1, append: K1, attr: Ze, detach: G1, init: J1, insert: Q1, noop: Ai, safe_not_equal: x1, set_style: ml, svg_element: vs } = window.__gradio__svelte__internal; function $1(l) { let e, t; return { c() { e = vs("svg"), t = vs("path"), Ze(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"), Ze(t, "fill", "none"), Ze(t, "stroke-width", "2"), Ze(e, "width", "100%"), Ze(e, "height", "100%"), Ze(e, "viewBox", "0 0 24 24"), Ze(e, "version", "1.1"), Ze(e, "xmlns", "http://www.w3.org/2000/svg"), Ze(e, "xmlns:xlink", "http://www.w3.org/1999/xlink"), Ze(e, "xml:space", "preserve"), Ze(e, "stroke", "currentColor"), ml(e, "fill-rule", "evenodd"), ml(e, "clip-rule", "evenodd"), ml(e, "stroke-linecap", "round"), ml(e, "stroke-linejoin", "round"); }, m(n, i) { Q1(n, e, i), K1(e, t); }, p: Ai, i: Ai, o: Ai, d(n) { n && G1(e); } }; } class e0 extends Z1 { constructor(e) { super(), J1(this, e, null, $1, x1, {}); } } const { SvelteComponent: t0, append: n0, attr: Ke, detach: l0, init: i0, insert: o0, noop: Li, safe_not_equal: s0, set_style: gl, svg_element: ks } = window.__gradio__svelte__internal; function a0(l) { let e, t; return { c() { e = ks("svg"), t = ks("path"), Ke(t, "d", "M10 12L14 16M14 12L10 16M4 6H20M16 6L15.7294 5.18807C15.4671 4.40125 15.3359 4.00784 15.0927 3.71698C14.8779 3.46013 14.6021 3.26132 14.2905 3.13878C13.9376 3 13.523 3 12.6936 3H11.3064C10.477 3 10.0624 3 9.70951 3.13878C9.39792 3.26132 9.12208 3.46013 8.90729 3.71698C8.66405 4.00784 8.53292 4.40125 8.27064 5.18807L8 6M18 6V16.2C18 17.8802 18 18.7202 17.673 19.362C17.3854 19.9265 16.9265 20.3854 16.362 20.673C15.7202 21 14.8802 21 13.2 21H10.8C9.11984 21 8.27976 21 7.63803 20.673C7.07354 20.3854 6.6146 19.9265 6.32698 19.362C6 18.7202 6 17.8802 6 16.2V6"), Ke(t, "fill", "none"), Ke(t, "stroke-width", "2"), Ke(e, "width", "100%"), Ke(e, "height", "100%"), Ke(e, "viewBox", "0 0 24 24"), Ke(e, "version", "1.1"), Ke(e, "xmlns", "http://www.w3.org/2000/svg"), Ke(e, "xmlns:xlink", "http://www.w3.org/1999/xlink"), Ke(e, "xml:space", "preserve"), Ke(e, "stroke", "currentColor"), gl(e, "fill-rule", "evenodd"), gl(e, "clip-rule", "evenodd"), gl(e, "stroke-linecap", "round"), gl(e, "stroke-linejoin", "round"); }, m(n, i) { o0(n, e, i), n0(e, t); }, p: Li, i: Li, o: Li, d(n) { n && l0(e); } }; } class r0 extends t0 { constructor(e) { super(), i0(this, e, null, a0, s0, {}); } } const { SvelteComponent: f0, append: ys, attr: Di, bubble: Cs, create_component: u0, destroy_component: c0, detach: $a, element: Ss, init: _0, insert: er, listen: Ri, mount_component: d0, run_all: h0, safe_not_equal: m0, set_data: g0, set_input_value: zs, space: b0, text: w0, transition_in: p0, transition_out: v0 } = window.__gradio__svelte__internal, { createEventDispatcher: k0, afterUpdate: y0 } = window.__gradio__svelte__internal; function C0(l) { let e; return { c() { e = w0( /*label*/ l[1] ); }, m(t, n) { er(t, e, n); }, p(t, n) { n & /*label*/ 2 && g0( e, /*label*/ t[1] ); }, d(t) { t && $a(e); } }; } function S0(l) { let e, t, n, i, o, s, r; return t = new aa({ props: { show_label: ( /*show_label*/ l[4] ), info: ( /*info*/ l[2] ), $$slots: { default: [C0] }, $$scope: { ctx: l } } }), { c() { e = Ss("label"), u0(t.$$.fragment), n = b0(), i = Ss("input"), Di(i, "type", "color"), i.disabled = /*disabled*/ l[3], Di(i, "class", "svelte-16l8u73"), Di(e, "class", "block"); }, m(a, f) { er(a, e, f), d0(t, e, null), ys(e, n), ys(e, i), zs( i, /*value*/ l[0] ), o = !0, s || (r = [ Ri( i, "input", /*input_input_handler*/ l[8] ), Ri( i, "focus", /*focus_handler*/ l[6] ), Ri( i, "blur", /*blur_handler*/ l[7] ) ], s = !0); }, p(a, [f]) { const u = {}; f & /*show_label*/ 16 && (u.show_label = /*show_label*/ a[4]), f & /*info*/ 4 && (u.info = /*info*/ a[2]), f & /*$$scope, label*/ 2050 && (u.$$scope = { dirty: f, ctx: a }), t.$set(u), (!o || f & /*disabled*/ 8) && (i.disabled = /*disabled*/ a[3]), f & /*value*/ 1 && zs( i, /*value*/ a[0] ); }, i(a) { o || (p0(t.$$.fragment, a), o = !0); }, o(a) { v0(t.$$.fragment, a), o = !1; }, d(a) { a && $a(e), c0(t), s = !1, h0(r); } }; } function z0(l, e, t) { let { value: n = "#000000" } = e, { value_is_output: i = !1 } = e, { label: o } = e, { info: s = void 0 } = e, { disabled: r = !1 } = e, { show_label: a = !0 } = e; const f = k0(); function u() { f("change", n), i || f("input"); } y0(() => { t(5, i = !1); }); function c(h) { Cs.call(this, l, h); } function _(h) { Cs.call(this, l, h); } function d() { n = this.value, t(0, n); } return l.$$set = (h) => { "value" in h && t(0, n = h.value), "value_is_output" in h && t(5, i = h.value_is_output), "label" in h && t(1, o = h.label), "info" in h && t(2, s = h.info), "disabled" in h && t(3, r = h.disabled), "show_label" in h && t(4, a = h.show_label); }, l.$$.update = () => { l.$$.dirty & /*value*/ 1 && u(); }, [ n, o, s, r, a, i, c, _, d ]; } class B0 extends f0 { constructor(e) { super(), _0(this, e, z0, S0, m0, { value: 0, value_is_output: 5, label: 1, info: 2, disabled: 3, show_label: 4 }); } } const { SvelteComponent: q0, append: tr, attr: ne, bubble: E0, check_outros: M0, create_slot: nr, detach: tl, element: ei, empty: A0, get_all_dirty_from_scope: lr, get_slot_changes: ir, group_outros: L0, init: D0, insert: nl, listen: R0, safe_not_equal: T0, set_style: Be, space: or, src_url_equal: Xl, toggle_class: mn, transition_in: Yl, transition_out: Nl, update_slot_base: sr } = window.__gradio__svelte__internal; function I0(l) { let e, t, n, i, o, s, r = ( /*icon*/ l[7] && Bs(l) ); const a = ( /*#slots*/ l[12].default ), f = nr( a, l, /*$$scope*/ l[11], null ); return { c() { e = ei("button"), r && r.c(), t = or(), f && f.c(), ne(e, "class", n = /*size*/ l[4] + " " + /*variant*/ l[3] + " " + /*elem_classes*/ l[1].join(" ") + " svelte-8huxfn"), ne( e, "id", /*elem_id*/ l[0] ), e.disabled = /*disabled*/ l[8], mn(e, "hidden", !/*visible*/ l[2]), Be( e, "flex-grow", /*scale*/ l[9] ), Be( e, "width", /*scale*/ l[9] === 0 ? "fit-content" : null ), Be(e, "min-width", typeof /*min_width*/ l[10] == "number" ? `calc(min(${/*min_width*/ l[10]}px, 100%))` : null); }, m(u, c) { nl(u, e, c), r && r.m(e, null), tr(e, t), f && f.m(e, null), i = !0, o || (s = R0( e, "click", /*click_handler*/ l[13] ), o = !0); }, p(u, c) { /*icon*/ u[7] ? r ? r.p(u, c) : (r = Bs(u), r.c(), r.m(e, t)) : r && (r.d(1), r = null), f && f.p && (!i || c & /*$$scope*/ 2048) && sr( f, a, u, /*$$scope*/ u[11], i ? ir( a, /*$$scope*/ u[11], c, null ) : lr( /*$$scope*/ u[11] ), null ), (!i || c & /*size, variant, elem_classes*/ 26 && n !== (n = /*size*/ u[4] + " " + /*variant*/ u[3] + " " + /*elem_classes*/ u[1].join(" ") + " svelte-8huxfn")) && ne(e, "class", n), (!i || c & /*elem_id*/ 1) && ne( e, "id", /*elem_id*/ u[0] ), (!i || c & /*disabled*/ 256) && (e.disabled = /*disabled*/ u[8]), (!i || c & /*size, variant, elem_classes, visible*/ 30) && mn(e, "hidden", !/*visible*/ u[2]), c & /*scale*/ 512 && Be( e, "flex-grow", /*scale*/ u[9] ), c & /*scale*/ 512 && Be( e, "width", /*scale*/ u[9] === 0 ? "fit-content" : null ), c & /*min_width*/ 1024 && Be(e, "min-width", typeof /*min_width*/ u[10] == "number" ? `calc(min(${/*min_width*/ u[10]}px, 100%))` : null); }, i(u) { i || (Yl(f, u), i = !0); }, o(u) { Nl(f, u), i = !1; }, d(u) { u && tl(e), r && r.d(), f && f.d(u), o = !1, s(); } }; } function j0(l) { let e, t, n, i, o = ( /*icon*/ l[7] && qs(l) ); const s = ( /*#slots*/ l[12].default ), r = nr( s, l, /*$$scope*/ l[11], null ); return { c() { e = ei("a"), o && o.c(), t = or(), r && r.c(), ne( e, "href", /*link*/ l[6] ), ne(e, "rel", "noopener noreferrer"), ne( e, "aria-disabled", /*disabled*/ l[8] ), ne(e, "class", n = /*size*/ l[4] + " " + /*variant*/ l[3] + " " + /*elem_classes*/ l[1].join(" ") + " svelte-8huxfn"), ne( e, "id", /*elem_id*/ l[0] ), mn(e, "hidden", !/*visible*/ l[2]), mn( e, "disabled", /*disabled*/ l[8] ), Be( e, "flex-grow", /*scale*/ l[9] ), Be( e, "pointer-events", /*disabled*/ l[8] ? "none" : null ), Be( e, "width", /*scale*/ l[9] === 0 ? "fit-content" : null ), Be(e, "min-width", typeof /*min_width*/ l[10] == "number" ? `calc(min(${/*min_width*/ l[10]}px, 100%))` : null); }, m(a, f) { nl(a, e, f), o && o.m(e, null), tr(e, t), r && r.m(e, null), i = !0; }, p(a, f) { /*icon*/ a[7] ? o ? o.p(a, f) : (o = qs(a), o.c(), o.m(e, t)) : o && (o.d(1), o = null), r && r.p && (!i || f & /*$$scope*/ 2048) && sr( r, s, a, /*$$scope*/ a[11], i ? ir( s, /*$$scope*/ a[11], f, null ) : lr( /*$$scope*/ a[11] ), null ), (!i || f & /*link*/ 64) && ne( e, "href", /*link*/ a[6] ), (!i || f & /*disabled*/ 256) && ne( e, "aria-disabled", /*disabled*/ a[8] ), (!i || f & /*size, variant, elem_classes*/ 26 && n !== (n = /*size*/ a[4] + " " + /*variant*/ a[3] + " " + /*elem_classes*/ a[1].join(" ") + " svelte-8huxfn")) && ne(e, "class", n), (!i || f & /*elem_id*/ 1) && ne( e, "id", /*elem_id*/ a[0] ), (!i || f & /*size, variant, elem_classes, visible*/ 30) && mn(e, "hidden", !/*visible*/ a[2]), (!i || f & /*size, variant, elem_classes, disabled*/ 282) && mn( e, "disabled", /*disabled*/ a[8] ), f & /*scale*/ 512 && Be( e, "flex-grow", /*scale*/ a[9] ), f & /*disabled*/ 256 && Be( e, "pointer-events", /*disabled*/ a[8] ? "none" : null ), f & /*scale*/ 512 && Be( e, "width", /*scale*/ a[9] === 0 ? "fit-content" : null ), f & /*min_width*/ 1024 && Be(e, "min-width", typeof /*min_width*/ a[10] == "number" ? `calc(min(${/*min_width*/ a[10]}px, 100%))` : null); }, i(a) { i || (Yl(r, a), i = !0); }, o(a) { Nl(r, a), i = !1; }, d(a) { a && tl(e), o && o.d(), r && r.d(a); } }; } function Bs(l) { let e, t, n; return { c() { e = ei("img"), ne(e, "class", "button-icon svelte-8huxfn"), Xl(e.src, t = /*icon*/ l[7].url) || ne(e, "src", t), ne(e, "alt", n = `${/*value*/ l[5]} icon`); }, m(i, o) { nl(i, e, o); }, p(i, o) { o & /*icon*/ 128 && !Xl(e.src, t = /*icon*/ i[7].url) && ne(e, "src", t), o & /*value*/ 32 && n !== (n = `${/*value*/ i[5]} icon`) && ne(e, "alt", n); }, d(i) { i && tl(e); } }; } function qs(l) { let e, t, n; return { c() { e = ei("img"), ne(e, "class", "button-icon svelte-8huxfn"), Xl(e.src, t = /*icon*/ l[7].url) || ne(e, "src", t), ne(e, "alt", n = `${/*value*/ l[5]} icon`); }, m(i, o) { nl(i, e, o); }, p(i, o) { o & /*icon*/ 128 && !Xl(e.src, t = /*icon*/ i[7].url) && ne(e, "src", t), o & /*value*/ 32 && n !== (n = `${/*value*/ i[5]} icon`) && ne(e, "alt", n); }, d(i) { i && tl(e); } }; } function H0(l) { let e, t, n, i; const o = [j0, I0], s = []; function r(a, f) { return ( /*link*/ a[6] && /*link*/ a[6].length > 0 ? 0 : 1 ); } return e = r(l), t = s[e] = o[e](l), { c() { t.c(), n = A0(); }, m(a, f) { s[e].m(a, f), nl(a, n, f), i = !0; }, p(a, [f]) { let u = e; e = r(a), e === u ? s[e].p(a, f) : (L0(), Nl(s[u], 1, 1, () => { s[u] = null; }), M0(), t = s[e], t ? t.p(a, f) : (t = s[e] = o[e](a), t.c()), Yl(t, 1), t.m(n.parentNode, n)); }, i(a) { i || (Yl(t), i = !0); }, o(a) { Nl(t), i = !1; }, d(a) { a && tl(n), s[e].d(a); } }; } function F0(l, e, t) { let { $$slots: n = {}, $$scope: i } = e, { elem_id: o = "" } = e, { elem_classes: s = [] } = e, { visible: r = !0 } = e, { variant: a = "secondary" } = e, { size: f = "lg" } = e, { value: u = null } = e, { link: c = null } = e, { icon: _ = null } = e, { disabled: d = !1 } = e, { scale: h = null } = e, { min_width: m = void 0 } = e; function w(b) { E0.call(this, l, b); } return l.$$set = (b) => { "elem_id" in b && t(0, o = b.elem_id), "elem_classes" in b && t(1, s = b.elem_classes), "visible" in b && t(2, r = b.visible), "variant" in b && t(3, a = b.variant), "size" in b && t(4, f = b.size), "value" in b && t(5, u = b.value), "link" in b && t(6, c = b.link), "icon" in b && t(7, _ = b.icon), "disabled" in b && t(8, d = b.disabled), "scale" in b && t(9, h = b.scale), "min_width" in b && t(10, m = b.min_width), "$$scope" in b && t(11, i = b.$$scope); }, [ o, s, r, a, f, u, c, _, d, h, m, i, n, w ]; } class xi extends q0 { constructor(e) { super(), D0(this, e, F0, H0, T0, { elem_id: 0, elem_classes: 1, visible: 2, variant: 3, size: 4, value: 5, link: 6, icon: 7, disabled: 8, scale: 9, min_width: 10 }); } } const { SvelteComponent: X0, add_render_callback: ar, append: bl, attr: Re, binding_callbacks: Es, check_outros: Y0, create_bidirectional_transition: Ms, destroy_each: N0, detach: Wn, element: Ul, empty: U0, ensure_array_like: As, group_outros: O0, init: W0, insert: Vn, listen: $i, prevent_default: V0, run_all: P0, safe_not_equal: Z0, set_data: K0, set_style: rn, space: eo, text: G0, toggle_class: et, transition_in: Ti, transition_out: Ls } = window.__gradio__svelte__internal, { createEventDispatcher: J0 } = window.__gradio__svelte__internal; function Ds(l, e, t) { const n = l.slice(); return n[26] = e[t], n; } function Rs(l) { let e, t, n, i, o, s = As( /*filtered_indices*/ l[1] ), r = []; for (let a = 0; a < s.length; a += 1) r[a] = Ts(Ds(l, s, a)); return { c() { e = Ul("ul"); for (let a = 0; a < r.length; a += 1) r[a].c(); Re(e, "class", "options svelte-yuohum"), Re(e, "role", "listbox"), rn( e, "bottom", /*bottom*/ l[9] ), rn(e, "max-height", `calc(${/*max_height*/ l[10]}px - var(--window-padding))`), rn( e, "width", /*input_width*/ l[8] + "px" ); }, m(a, f) { Vn(a, e, f); for (let u = 0; u < r.length; u += 1) r[u] && r[u].m(e, null); l[22](e), n = !0, i || (o = $i(e, "mousedown", V0( /*mousedown_handler*/ l[21] )), i = !0); }, p(a, f) { if (f & /*filtered_indices, choices, selected_indices, active_index*/ 51) { s = As( /*filtered_indices*/ a[1] ); let u; for (u = 0; u < s.length; u += 1) { const c = Ds(a, s, u); r[u] ? r[u].p(c, f) : (r[u] = Ts(c), r[u].c(), r[u].m(e, null)); } for (; u < r.length; u += 1) r[u].d(1); r.length = s.length; } f & /*bottom*/ 512 && rn( e, "bottom", /*bottom*/ a[9] ), f & /*max_height*/ 1024 && rn(e, "max-height", `calc(${/*max_height*/ a[10]}px - var(--window-padding))`), f & /*input_width*/ 256 && rn( e, "width", /*input_width*/ a[8] + "px" ); }, i(a) { n || (a && ar(() => { n && (t || (t = Ms(e, Yo, { duration: 200, y: 5 }, !0)), t.run(1)); }), n = !0); }, o(a) { a && (t || (t = Ms(e, Yo, { duration: 200, y: 5 }, !1)), t.run(0)), n = !1; }, d(a) { a && Wn(e), N0(r, a), l[22](null), a && t && t.end(), i = !1, o(); } }; } function Ts(l) { let e, t, n, i = ( /*choices*/ l[0][ /*index*/ l[26] ][0] + "" ), o, s, r, a, f; return { c() { e = Ul("li"), t = Ul("span"), t.textContent = "✓", n = eo(), o = G0(i), s = eo(), Re(t, "class", "inner-item svelte-yuohum"), et(t, "hide", !/*selected_indices*/ l[4].includes( /*index*/ l[26] )), Re(e, "class", "item svelte-yuohum"), Re(e, "data-index", r = /*index*/ l[26]), Re(e, "aria-label", a = /*choices*/ l[0][ /*index*/ l[26] ][0]), Re(e, "data-testid", "dropdown-option"), Re(e, "role", "option"), Re(e, "aria-selected", f = /*selected_indices*/ l[4].includes( /*index*/ l[26] )), et( e, "selected", /*selected_indices*/ l[4].includes( /*index*/ l[26] ) ), et( e, "active", /*index*/ l[26] === /*active_index*/ l[5] ), et( e, "bg-gray-100", /*index*/ l[26] === /*active_index*/ l[5] ), et( e, "dark:bg-gray-600", /*index*/ l[26] === /*active_index*/ l[5] ); }, m(u, c) { Vn(u, e, c), bl(e, t), bl(e, n), bl(e, o), bl(e, s); }, p(u, c) { c & /*selected_indices, filtered_indices*/ 18 && et(t, "hide", !/*selected_indices*/ u[4].includes( /*index*/ u[26] )), c & /*choices, filtered_indices*/ 3 && i !== (i = /*choices*/ u[0][ /*index*/ u[26] ][0] + "") && K0(o, i), c & /*filtered_indices*/ 2 && r !== (r = /*index*/ u[26]) && Re(e, "data-index", r), c & /*choices, filtered_indices*/ 3 && a !== (a = /*choices*/ u[0][ /*index*/ u[26] ][0]) && Re(e, "aria-label", a), c & /*selected_indices, filtered_indices*/ 18 && f !== (f = /*selected_indices*/ u[4].includes( /*index*/ u[26] )) && Re(e, "aria-selected", f), c & /*selected_indices, filtered_indices*/ 18 && et( e, "selected", /*selected_indices*/ u[4].includes( /*index*/ u[26] ) ), c & /*filtered_indices, active_index*/ 34 && et( e, "active", /*index*/ u[26] === /*active_index*/ u[5] ), c & /*filtered_indices, active_index*/ 34 && et( e, "bg-gray-100", /*index*/ u[26] === /*active_index*/ u[5] ), c & /*filtered_indices, active_index*/ 34 && et( e, "dark:bg-gray-600", /*index*/ u[26] === /*active_index*/ u[5] ); }, d(u) { u && Wn(e); } }; } function Q0(l) { let e, t, n, i, o; ar( /*onwindowresize*/ l[19] ); let s = ( /*show_options*/ l[2] && !/*disabled*/ l[3] && Rs(l) ); return { c() { e = Ul("div"), t = eo(), s && s.c(), n = U0(), Re(e, "class", "reference"); }, m(r, a) { Vn(r, e, a), l[20](e), Vn(r, t, a), s && s.m(r, a), Vn(r, n, a), i || (o = [ $i( window, "scroll", /*scroll_listener*/ l[12] ), $i( window, "resize", /*onwindowresize*/ l[19] ) ], i = !0); }, p(r, [a]) { /*show_options*/ r[2] && !/*disabled*/ r[3] ? s ? (s.p(r, a), a & /*show_options, disabled*/ 12 && Ti(s, 1)) : (s = Rs(r), s.c(), Ti(s, 1), s.m(n.parentNode, n)) : s && (O0(), Ls(s, 1, 1, () => { s = null; }), Y0()); }, i(r) { Ti(s); }, o(r) { Ls(s); }, d(r) { r && (Wn(e), Wn(t), Wn(n)), l[20](null), s && s.d(r), i = !1, P0(o); } }; } function x0(l, e, t) { var n, i; let { choices: o } = e, { filtered_indices: s } = e, { show_options: r = !1 } = e, { disabled: a = !1 } = e, { selected_indices: f = [] } = e, { active_index: u = null } = e, c, _, d, h, m, w, b, p, g; function v() { const { top: R, bottom: U } = m.getBoundingClientRect(); t(16, c = R), t(17, _ = g - U); } let E = null; function y() { r && (E !== null && clearTimeout(E), E = setTimeout( () => { v(), E = null; }, 10 )); } const C = J0(); function k() { t(11, g = window.innerHeight); } function A(R) { Es[R ? "unshift" : "push"](() => { m = R, t(6, m); }); } const S = (R) => C("change", R); function T(R) { Es[R ? "unshift" : "push"](() => { w = R, t(7, w); }); } return l.$$set = (R) => { "choices" in R && t(0, o = R.choices), "filtered_indices" in R && t(1, s = R.filtered_indices), "show_options" in R && t(2, r = R.show_options), "disabled" in R && t(3, a = R.disabled), "selected_indices" in R && t(4, f = R.selected_indices), "active_index" in R && t(5, u = R.active_index); }, l.$$.update = () => { if (l.$$.dirty & /*show_options, refElement, listElement, selected_indices, _a, _b, distance_from_bottom, distance_from_top, input_height*/ 508116) { if (r && m) { if (w && f.length > 0) { let U = w.querySelectorAll("li"); for (const Z of Array.from(U)) if (Z.getAttribute("data-index") === f[0].toString()) { t(14, n = w == null ? void 0 : w.scrollTo) === null || n === void 0 || n.call(w, 0, Z.offsetTop); break; } } v(); const R = t(15, i = m.parentElement) === null || i === void 0 ? void 0 : i.getBoundingClientRect(); t(18, d = (R == null ? void 0 : R.height) || 0), t(8, h = (R == null ? void 0 : R.width) || 0); } _ > c ? (t(10, p = _), t(9, b = null)) : (t(9, b = `${_ + d}px`), t(10, p = c - d)); } }, [ o, s, r, a, f, u, m, w, h, b, p, g, y, C, n, i, c, _, d, k, A, S, T ]; } class $0 extends X0 { constructor(e) { super(), W0(this, e, x0, Q0, Z0, { choices: 0, filtered_indices: 1, show_options: 2, disabled: 3, selected_indices: 4, active_index: 5 }); } } function eh(l, e) { return (l % e + e) % e; } function Is(l, e) { return l.reduce((t, n, i) => ((!e || n[0].toLowerCase().includes(e.toLowerCase())) && t.push(i), t), []); } function th(l, e, t) { l("change", e), t || l("input"); } function nh(l, e, t) { if (l.key === "Escape") return [!1, e]; if ((l.key === "ArrowDown" || l.key === "ArrowUp") && t.length >= 0) if (e === null) e = l.key === "ArrowDown" ? t[0] : t[t.length - 1]; else { const n = t.indexOf(e), i = l.key === "ArrowUp" ? -1 : 1; e = t[eh(n + i, t.length)]; } return [!0, e]; } const { SvelteComponent: lh, append: It, attr: De, binding_callbacks: ih, check_outros: oh, create_component: to, destroy_component: no, detach: _o, element: cn, group_outros: sh, init: ah, insert: ho, listen: En, mount_component: lo, run_all: rh, safe_not_equal: fh, set_data: uh, set_input_value: js, space: Ii, text: ch, toggle_class: fn, transition_in: _n, transition_out: In } = window.__gradio__svelte__internal, { onMount: _h } = window.__gradio__svelte__internal, { createEventDispatcher: dh, afterUpdate: hh } = window.__gradio__svelte__internal; function mh(l) { let e; return { c() { e = ch( /*label*/ l[0] ); }, m(t, n) { ho(t, e, n); }, p(t, n) { n[0] & /*label*/ 1 && uh( e, /*label*/ t[0] ); }, d(t) { t && _o(e); } }; } function Hs(l) { let e, t, n; return t = new io({}), { c() { e = cn("div"), to(t.$$.fragment), De(e, "class", "icon-wrap svelte-1m1zvyj"); }, m(i, o) { ho(i, e, o), lo(t, e, null), n = !0; }, i(i) { n || (_n(t.$$.fragment, i), n = !0); }, o(i) { In(t.$$.fragment, i), n = !1; }, d(i) { i && _o(e), no(t); } }; } function gh(l) { let e, t, n, i, o, s, r, a, f, u, c, _, d, h; t = new aa({ props: { show_label: ( /*show_label*/ l[4] ), info: ( /*info*/ l[1] ), $$slots: { default: [mh] }, $$scope: { ctx: l } } }); let m = !/*disabled*/ l[3] && Hs(); return c = new $0({ props: { show_options: ( /*show_options*/ l[12] ), choices: ( /*choices*/ l[2] ), filtered_indices: ( /*filtered_indices*/ l[10] ), disabled: ( /*disabled*/ l[3] ), selected_indices: ( /*selected_index*/ l[11] === null ? [] : [ /*selected_index*/ l[11] ] ), active_index: ( /*active_index*/ l[14] ) } }), c.$on( "change", /*handle_option_selected*/ l[16] ), { c() { e = cn("div"), to(t.$$.fragment), n = Ii(), i = cn("div"), o = cn("div"), s = cn("div"), r = cn("input"), f = Ii(), m && m.c(), u = Ii(), to(c.$$.fragment), De(r, "role", "listbox"), De(r, "aria-controls", "dropdown-options"), De( r, "aria-expanded", /*show_options*/ l[12] ), De( r, "aria-label", /*label*/ l[0] ), De(r, "class", "border-none svelte-1m1zvyj"), r.disabled = /*disabled*/ l[3], De(r, "autocomplete", "off"), r.readOnly = a = !/*filterable*/ l[7], fn(r, "subdued", !/*choices_names*/ l[13].includes( /*input_text*/ l[9] ) && !/*allow_custom_value*/ l[6]), De(s, "class", "secondary-wrap svelte-1m1zvyj"), De(o, "class", "wrap-inner svelte-1m1zvyj"), fn( o, "show_options", /*show_options*/ l[12] ), De(i, "class", "wrap svelte-1m1zvyj"), De(e, "class", "svelte-1m1zvyj"), fn( e, "container", /*container*/ l[5] ); }, m(w, b) { ho(w, e, b), lo(t, e, null), It(e, n), It(e, i), It(i, o), It(o, s), It(s, r), js( r, /*input_text*/ l[9] ), l[29](r), It(s, f), m && m.m(s, null), It(i, u), lo(c, i, null), _ = !0, d || (h = [ En( r, "input", /*input_input_handler*/ l[28] ), En( r, "keydown", /*handle_key_down*/ l[19] ), En( r, "keyup", /*keyup_handler*/ l[30] ), En( r, "blur", /*handle_blur*/ l[18] ), En( r, "focus", /*handle_focus*/ l[17] ) ], d = !0); }, p(w, b) { const p = {}; b[0] & /*show_label*/ 16 && (p.show_label = /*show_label*/ w[4]), b[0] & /*info*/ 2 && (p.info = /*info*/ w[1]), b[0] & /*label*/ 1 | b[1] & /*$$scope*/ 4 && (p.$$scope = { dirty: b, ctx: w }), t.$set(p), (!_ || b[0] & /*show_options*/ 4096) && De( r, "aria-expanded", /*show_options*/ w[12] ), (!_ || b[0] & /*label*/ 1) && De( r, "aria-label", /*label*/ w[0] ), (!_ || b[0] & /*disabled*/ 8) && (r.disabled = /*disabled*/ w[3]), (!_ || b[0] & /*filterable*/ 128 && a !== (a = !/*filterable*/ w[7])) && (r.readOnly = a), b[0] & /*input_text*/ 512 && r.value !== /*input_text*/ w[9] && js( r, /*input_text*/ w[9] ), (!_ || b[0] & /*choices_names, input_text, allow_custom_value*/ 8768) && fn(r, "subdued", !/*choices_names*/ w[13].includes( /*input_text*/ w[9] ) && !/*allow_custom_value*/ w[6]), /*disabled*/ w[3] ? m && (sh(), In(m, 1, 1, () => { m = null; }), oh()) : m ? b[0] & /*disabled*/ 8 && _n(m, 1) : (m = Hs(), m.c(), _n(m, 1), m.m(s, null)), (!_ || b[0] & /*show_options*/ 4096) && fn( o, "show_options", /*show_options*/ w[12] ); const g = {}; b[0] & /*show_options*/ 4096 && (g.show_options = /*show_options*/ w[12]), b[0] & /*choices*/ 4 && (g.choices = /*choices*/ w[2]), b[0] & /*filtered_indices*/ 1024 && (g.filtered_indices = /*filtered_indices*/ w[10]), b[0] & /*disabled*/ 8 && (g.disabled = /*disabled*/ w[3]), b[0] & /*selected_index*/ 2048 && (g.selected_indices = /*selected_index*/ w[11] === null ? [] : [ /*selected_index*/ w[11] ]), b[0] & /*active_index*/ 16384 && (g.active_index = /*active_index*/ w[14]), c.$set(g), (!_ || b[0] & /*container*/ 32) && fn( e, "container", /*container*/ w[5] ); }, i(w) { _ || (_n(t.$$.fragment, w), _n(m), _n(c.$$.fragment, w), _ = !0); }, o(w) { In(t.$$.fragment, w), In(m), In(c.$$.fragment, w), _ = !1; }, d(w) { w && _o(e), no(t), l[29](null), m && m.d(), no(c), d = !1, rh(h); } }; } function bh(l, e, t) { let { label: n } = e, { info: i = void 0 } = e, { value: o = [] } = e, s = [], { value_is_output: r = !1 } = e, { choices: a } = e, f, { disabled: u = !1 } = e, { show_label: c } = e, { container: _ = !0 } = e, { allow_custom_value: d = !1 } = e, { filterable: h = !0 } = e, m, w = !1, b, p, g = "", v = "", E = !1, y = [], C = null, k = null, A; const S = dh(); o ? (A = a.map((D) => D[1]).indexOf(o), k = A, k === -1 ? (s = o, k = null) : ([g, s] = a[k], v = g), R()) : a.length > 0 && (A = 0, k = 0, [g, o] = a[k], s = o, v = g); function T() { t(13, b = a.map((D) => D[0])), t(24, p = a.map((D) => D[1])); } function R() { T(), o === void 0 || Array.isArray(o) && o.length === 0 ? (t(9, g = ""), t(11, k = null)) : p.includes(o) ? (t(9, g = b[p.indexOf(o)]), t(11, k = p.indexOf(o))) : d ? (t(9, g = o), t(11, k = null)) : (t(9, g = ""), t(11, k = null)), t(27, A = k); } function U(D) { if (t(11, k = parseInt(D.detail.target.dataset.index)), isNaN(k)) { t(11, k = null); return; } t(12, w = !1), t(14, C = null), m.blur(); } function Z(D) { t(10, y = a.map((W, $) => $)), t(12, w = !0), S("focus"); } function Q() { d ? t(20, o = g) : t(9, g = b[p.indexOf(o)]), t(12, w = !1), t(14, C = null), S("blur"); } function J(D) { t(12, [w, C] = nh(D, C, y), w, (t(14, C), t(2, a), t(23, f), t(6, d), t(9, g), t(10, y), t(8, m), t(25, v), t(11, k), t(27, A), t(26, E), t(24, p))), D.key === "Enter" && (C !== null ? (t(11, k = C), t(12, w = !1), m.blur(), t(14, C = null)) : b.includes(g) ? (t(11, k = b.indexOf(g)), t(12, w = !1), t(14, C = null), m.blur()) : d && (t(20, o = g), t(11, k = null), t(12, w = !1), t(14, C = null), m.blur()), S("enter", o)); } hh(() => { t(21, r = !1), t(26, E = !0); }), _h(() => { m.focus(); }); function K() { g = this.value, t(9, g), t(11, k), t(27, A), t(26, E), t(2, a), t(24, p); } function L(D) { ih[D ? "unshift" : "push"](() => { m = D, t(8, m); }); } const F = (D) => S("key_up", { key: D.key, input_value: g }); return l.$$set = (D) => { "label" in D && t(0, n = D.label), "info" in D && t(1, i = D.info), "value" in D && t(20, o = D.value), "value_is_output" in D && t(21, r = D.value_is_output), "choices" in D && t(2, a = D.choices), "disabled" in D && t(3, u = D.disabled), "show_label" in D && t(4, c = D.show_label), "container" in D && t(5, _ = D.container), "allow_custom_value" in D && t(6, d = D.allow_custom_value), "filterable" in D && t(7, h = D.filterable); }, l.$$.update = () => { l.$$.dirty[0] & /*selected_index, old_selected_index, initialized, choices, choices_values*/ 218105860 && k !== A && k !== null && E && (t(9, [g, o] = a[k], g, (t(20, o), t(11, k), t(27, A), t(26, E), t(2, a), t(24, p))), t(27, A = k), S("select", { index: k, value: p[k], selected: !0 })), l.$$.dirty[0] & /*value, old_value, value_is_output*/ 7340032 && o != s && (R(), th(S, o, r), t(22, s = o)), l.$$.dirty[0] & /*choices*/ 4 && T(), l.$$.dirty[0] & /*choices, old_choices, allow_custom_value, input_text, filtered_indices, filter_input*/ 8390468 && a !== f && (d || R(), t(23, f = a), t(10, y = Is(a, g)), !d && y.length > 0 && t(14, C = y[0]), m == document.activeElement && t(12, w = !0)), l.$$.dirty[0] & /*input_text, old_input_text, choices, allow_custom_value, filtered_indices*/ 33556036 && g !== v && (t(10, y = Is(a, g)), t(25, v = g), !d && y.length > 0 && t(14, C = y[0])); }, [ n, i, a, u, c, _, d, h, m, g, y, k, w, b, C, S, U, Z, Q, J, o, r, s, f, p, v, E, A, K, L, F ]; } class wh extends lh { constructor(e) { super(), ah( this, e, bh, gh, fh, { label: 0, info: 1, value: 20, value_is_output: 21, choices: 2, disabled: 3, show_label: 4, container: 5, allow_custom_value: 6, filterable: 7 }, null, [-1, -1] ); } } const { SvelteComponent: ph, append: tt, attr: wl, check_outros: vh, create_component: jn, destroy_component: Hn, detach: ll, element: Bt, group_outros: kh, init: yh, insert: il, mount_component: Fn, safe_not_equal: Ch, set_style: Xn, space: pl, text: mo, transition_in: qt, transition_out: Ft } = window.__gradio__svelte__internal, { createEventDispatcher: Sh } = window.__gradio__svelte__internal, { onMount: zh, onDestroy: Bh } = window.__gradio__svelte__internal; function qh(l) { let e; return { c() { e = mo("Cancel"); }, m(t, n) { il(t, e, n); }, d(t) { t && ll(e); } }; } function Fs(l) { let e, t, n; return t = new xi({ props: { variant: "stop", $$slots: { default: [Eh] }, $$scope: { ctx: l } } }), t.$on( "click", /*click_handler_1*/ l[12] ), { c() { e = Bt("div"), jn(t.$$.fragment), Xn(e, "margin-right", "8px"); }, m(i, o) { il(i, e, o), Fn(t, e, null), n = !0; }, p(i, o) { const s = {}; o & /*$$scope*/ 65536 && (s.$$scope = { dirty: o, ctx: i }), t.$set(s); }, i(i) { n || (qt(t.$$.fragment, i), n = !0); }, o(i) { Ft(t.$$.fragment, i), n = !1; }, d(i) { i && ll(e), Hn(t); } }; } function Eh(l) { let e; return { c() { e = mo("Remove"); }, m(t, n) { il(t, e, n); }, d(t) { t && ll(e); } }; } function Mh(l) { let e; return { c() { e = mo("OK"); }, m(t, n) { il(t, e, n); }, d(t) { t && ll(e); } }; } function Ah(l) { let e, t, n, i, o, s, r, a, f, u, c, _, d, h, m, w; o = new wh({ props: { value: ( /*currentLabel*/ l[0] ), label: "Label", choices: ( /*choices*/ l[2] ), show_label: !1, allow_custom_value: !0 } }), o.$on( "change", /*onDropDownChange*/ l[5] ), o.$on( "enter", /*onDropDownEnter*/ l[7] ), a = new B0({ props: { value: ( /*currentColor*/ l[1] ), label: "Color", show_label: !1 } }), a.$on( "change", /*onColorChange*/ l[6] ), c = new xi({ props: { $$slots: { default: [qh] }, $$scope: { ctx: l } } }), c.$on( "click", /*click_handler*/ l[11] ); let b = ( /*showRemove*/ l[3] && Fs(l) ); return m = new xi({ props: { variant: "primary", $$slots: { default: [Mh] }, $$scope: { ctx: l } } }), m.$on( "click", /*click_handler_2*/ l[13] ), { c() { e = Bt("div"), t = Bt("div"), n = Bt("span"), i = Bt("div"), jn(o.$$.fragment), s = pl(), r = Bt("div"), jn(a.$$.fragment), f = pl(), u = Bt("div"), jn(c.$$.fragment), _ = pl(), b && b.c(), d = pl(), h = Bt("div"), jn(m.$$.fragment), Xn(i, "margin-right", "10px"), Xn(r, "margin-right", "40px"), Xn(r, "margin-bottom", "8px"), Xn(u, "margin-right", "8px"), wl(n, "class", "model-content svelte-hkn2q1"), wl(t, "class", "modal-container svelte-hkn2q1"), wl(e, "class", "modal svelte-hkn2q1"), wl(e, "id", "model-box-edit"); }, m(p, g) { il(p, e, g), tt(e, t), tt(t, n), tt(n, i), Fn(o, i, null), tt(n, s), tt(n, r), Fn(a, r, null), tt(n, f), tt(n, u), Fn(c, u, null), tt(n, _), b && b.m(n, null), tt(n, d), tt(n, h), Fn(m, h, null), w = !0; }, p(p, [g]) { const v = {}; g & /*currentLabel*/ 1 && (v.value = /*currentLabel*/ p[0]), g & /*choices*/ 4 && (v.choices = /*choices*/ p[2]), o.$set(v); const E = {}; g & /*currentColor*/ 2 && (E.value = /*currentColor*/ p[1]), a.$set(E); const y = {}; g & /*$$scope*/ 65536 && (y.$$scope = { dirty: g, ctx: p }), c.$set(y), /*showRemove*/ p[3] ? b ? (b.p(p, g), g & /*showRemove*/ 8 && qt(b, 1)) : (b = Fs(p), b.c(), qt(b, 1), b.m(n, d)) : b && (kh(), Ft(b, 1, 1, () => { b = null; }), vh()); const C = {}; g & /*$$scope*/ 65536 && (C.$$scope = { dirty: g, ctx: p }), m.$set(C); }, i(p) { w || (qt(o.$$.fragment, p), qt(a.$$.fragment, p), qt(c.$$.fragment, p), qt(b), qt(m.$$.fragment, p), w = !0); }, o(p) { Ft(o.$$.fragment, p), Ft(a.$$.fragment, p), Ft(c.$$.fragment, p), Ft(b), Ft(m.$$.fragment, p), w = !1; }, d(p) { p && ll(e), Hn(o), Hn(a), Hn(c), b && b.d(), Hn(m); } }; } function Lh(l, e, t) { let { label: n = "" } = e, { currentLabel: i = "" } = e, { choices: o = [] } = e, { choicesColors: s = [] } = e, { color: r = "" } = e, { currentColor: a = "" } = e, { showRemove: f = !0 } = e; const u = Sh(); function c(g) { u("change", { label: i, color: a, ret: g // -1: remove, 0: cancel, 1: change }); } function _(g) { const { detail: v } = g; let E = v; Number.isInteger(E) ? (Array.isArray(s) && E < s.length && t(1, a = s[E]), Array.isArray(o) && E < o.length && t(0, i = o[E][0])) : t(0, i = E); } function d(g) { const { detail: v } = g; t(1, a = v); } function h(g) { _(g), c(1); } function m(g) { switch (g.key) { case "Enter": c(1); break; } } zh(() => { document.addEventListener("keydown", m), t(0, i = n), t(1, a = r); }), Bh(() => { document.removeEventListener("keydown", m); }); const w = () => c(0), b = () => c(-1), p = () => c(1); return l.$$set = (g) => { "label" in g && t(8, n = g.label), "currentLabel" in g && t(0, i = g.currentLabel), "choices" in g && t(2, o = g.choices), "choicesColors" in g && t(9, s = g.choicesColors), "color" in g && t(10, r = g.color), "currentColor" in g && t(1, a = g.currentColor), "showRemove" in g && t(3, f = g.showRemove); }, [ i, a, o, f, c, _, d, h, n, s, r, w, b, p ]; } class rr extends ph { constructor(e) { super(), yh(this, e, Lh, Ah, Ch, { label: 8, currentLabel: 0, choices: 2, choicesColors: 9, color: 10, currentColor: 1, showRemove: 3 }); } } const _e = (l, e, t) => Math.min(Math.max(l, e), t); function ji(l, e) { if (l.startsWith("rgba")) return l.replace(/[\d.]+$/, e.toString()); const t = l.match(/\d+/g); if (!t || t.length !== 3) return `rgba(50, 50, 50, ${e})`; const [n, i, o] = t; return `rgba(${n}, ${i}, ${o}, ${e})`; } class Hi { constructor(e, t, n, i, o, s, r, a, f, u, c, _ = "rgb(255, 255, 255)", d = 0.5, h = 25, m = 8, w = 2, b = 4, p = 1) { this.stopDrag = () => { this.isDragging = !1, document.removeEventListener("pointermove", this.handleDrag), document.removeEventListener("pointerup", this.stopDrag); }, this.handleDrag = (g) => { if (this.isDragging) { let v = g.clientX - this.offsetMouseX - this.xmin, E = g.clientY - this.offsetMouseY - this.ymin; const y = this.canvasXmax - this.canvasXmin, C = this.canvasYmax - this.canvasYmin; v = _e(v, -this.xmin, y - this.xmax), E = _e(E, -this.ymin, C - this.ymax), this.xmin += v, this.ymin += E, this.xmax += v, this.ymax += E, this.updateHandles(), this.renderCallBack(); } }, this.handleCreating = (g) => { if (this.isCreating) { let [v, E] = this.toBoxCoordinates(g.clientX, g.clientY); v -= this.offsetMouseX, E -= this.offsetMouseY, v > this.xmax ? (this.creatingAnchorX == "xmax" && (this.xmin = this.xmax), this.xmax = v, this.creatingAnchorX = "xmin") : v > this.xmin && v < this.xmax && this.creatingAnchorX == "xmin" ? this.xmax = v : v > this.xmin && v < this.xmax && this.creatingAnchorX == "xmax" ? this.xmin = v : v < this.xmin && (this.creatingAnchorX == "xmin" && (this.xmax = this.xmin), this.xmin = v, this.creatingAnchorX = "xmax"), E > this.ymax ? (this.creatingAnchorY == "ymax" && (this.ymin = this.ymax), this.ymax = E, this.creatingAnchorY = "ymin") : E > this.ymin && E < this.ymax && this.creatingAnchorY == "ymin" ? this.ymax = E : E > this.ymin && E < this.ymax && this.creatingAnchorY == "ymax" ? this.ymin = E : E < this.ymin && (this.creatingAnchorY == "ymin" && (this.ymax = this.ymin), this.ymin = E, this.creatingAnchorY = "ymax"), this.updateHandles(), this.renderCallBack(); } }, this.stopCreating = (g) => { if (this.isCreating = !1, document.removeEventListener("pointermove", this.handleCreating), document.removeEventListener("pointerup", this.stopCreating), this.getArea() > 0) { const v = this.canvasXmax - this.canvasXmin, E = this.canvasYmax - this.canvasYmin; this.xmin = _e(this.xmin, 0, v - this.minSize), this.ymin = _e(this.ymin, 0, E - this.minSize), this.xmax = _e(this.xmax, this.minSize, v), this.ymax = _e(this.ymax, this.minSize, E), 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 > v ? (this.xmin -= this.xmax - v, this.xmax = v) : this.xmin < 0 && (this.xmax -= this.xmin, this.xmin = 0), this.ymax > E ? (this.ymin -= this.ymax - E, this.ymax = E) : this.ymin < 0 && (this.ymax -= this.ymin, this.ymin = 0)), this.updateHandles(), this.renderCallBack(); } this.onFinishCreation(); }, this.handleResize = (g) => { if (this.isResizing) { const v = g.clientX, E = g.clientY, y = v - this.resizeHandles[this.resizingHandleIndex].xmin - this.offsetMouseX, C = E - this.resizeHandles[this.resizingHandleIndex].ymin - this.offsetMouseY, k = this.canvasXmax - this.canvasXmin, A = this.canvasYmax - this.canvasYmin; switch (this.resizingHandleIndex) { case 0: this.xmin += y, this.ymin += C, this.xmin = _e(this.xmin, 0, this.xmax - this.minSize), this.ymin = _e(this.ymin, 0, this.ymax - this.minSize); break; case 1: this.xmax += y, this.ymin += C, this.xmax = _e(this.xmax, this.xmin + this.minSize, k), this.ymin = _e(this.ymin, 0, this.ymax - this.minSize); break; case 2: this.xmax += y, this.ymax += C, this.xmax = _e(this.xmax, this.xmin + this.minSize, k), this.ymax = _e(this.ymax, this.ymin + this.minSize, A); break; case 3: this.xmin += y, this.ymax += C, this.xmin = _e(this.xmin, 0, this.xmax - this.minSize), this.ymax = _e(this.ymax, this.ymin + this.minSize, A); break; case 4: this.ymin += C, this.ymin = _e(this.ymin, 0, this.ymax - this.minSize); break; case 5: this.xmax += y, this.xmax = _e(this.xmax, this.xmin + this.minSize, k); break; case 6: this.ymax += C, this.ymax = _e(this.ymax, this.ymin + this.minSize, A); break; case 7: this.xmin += y, this.xmin = _e(this.xmin, 0, this.xmax - this.minSize); break; } this.updateHandles(), this.renderCallBack(); } }, this.stopResize = () => { this.isResizing = !1, document.removeEventListener("pointermove", this.handleResize), document.removeEventListener("pointerup", this.stopResize); }, this.renderCallBack = e, this.onFinishCreation = t, this.canvasXmin = n, this.canvasYmin = i, this.canvasXmax = o, this.canvasYmax = s, this.scaleFactor = p, this.label = r, this.isDragging = !1, this.isCreating = !1, this.xmin = a, this.ymin = f, this.xmax = u, this.ymax = c, this.isResizing = !1, this.isSelected = !1, this.offsetMouseX = 0, this.offsetMouseY = 0, this.resizeHandleSize = m, this.thickness = w, this.selectedThickness = b, this.updateHandles(), this.resizingHandleIndex = -1, this.minSize = h, this.color = _, this.alpha = d, this.creatingAnchorX = "xmin", this.creatingAnchorY = "ymin"; } toJSON() { return { label: this.label, xmin: this.xmin, ymin: this.ymin, xmax: this.xmax, ymax: this.ymax, color: this.color, scaleFactor: this.scaleFactor }; } setSelected(e) { this.isSelected = e; } setScaleFactor(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, t = this.getWidth(), n = this.getHeight(); this.resizeHandles = [ { // Top left xmin: this.xmin - e, ymin: this.ymin - e, xmax: this.xmin + e, ymax: this.ymin + e, cursor: "nwse-resize" }, { // Top right xmin: this.xmax - e, ymin: this.ymin - e, xmax: this.xmax + e, ymax: this.ymin + e, cursor: "nesw-resize" }, { // Bottom right xmin: this.xmax - e, ymin: this.ymax - e, xmax: this.xmax + e, ymax: this.ymax + e, cursor: "nwse-resize" }, { // Bottom left xmin: this.xmin - e, ymin: this.ymax - e, xmax: this.xmin + e, ymax: this.ymax + e, cursor: "nesw-resize" }, { // Top center xmin: this.xmin + t / 2 - e, ymin: this.ymin - e, xmax: this.xmin + t / 2 + e, ymax: this.ymin + e, cursor: "ns-resize" }, { // Right center xmin: this.xmax - e, ymin: this.ymin + n / 2 - e, xmax: this.xmax + e, ymax: this.ymin + n / 2 + e, cursor: "ew-resize" }, { // Bottom center xmin: this.xmin + t / 2 - e, ymin: this.ymax - e, xmax: this.xmin + t / 2 + e, ymax: this.ymax + e, cursor: "ns-resize" }, { // Left center xmin: this.xmin - e, ymin: this.ymin + n / 2 - e, xmax: this.xmin + e, ymax: this.ymin + n / 2 + e, cursor: "ew-resize" } ]; } getWidth() { return this.xmax - this.xmin; } getHeight() { return this.ymax - this.ymin; } getArea() { return this.getWidth() * this.getHeight(); } 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 t, n; if (e.beginPath(), [t, n] = this.toCanvasCoordinates(this.xmin, this.ymin), e.rect(t, n, this.getWidth(), this.getHeight()), e.fillStyle = ji(this.color, this.alpha), e.fill(), this.isSelected ? e.lineWidth = this.selectedThickness : e.lineWidth = this.thickness, e.strokeStyle = ji(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 i = e.measureText(this.label).width + 10, o = 20; let s = this.xmin, r = this.ymin - o; e.fillStyle = "white", [s, r] = this.toCanvasCoordinates(s, r), e.fillRect(s, r, i, o), e.lineWidth = 1, e.strokeStyle = "black", e.strokeRect(s, r, i, o), e.fillStyle = "black", e.fillText(this.label, s + 5, r + 15); } e.fillStyle = ji(this.color, 1); for (const i of this.resizeHandles) [t, n] = this.toCanvasCoordinates(i.xmin, i.ymin), e.fillRect( t, n, i.xmax - i.xmin, i.ymax - i.ymin ); } startDrag(e) { this.isDragging = !0, this.offsetMouseX = e.clientX - this.xmin, this.offsetMouseY = e.clientY - this.ymin, document.addEventListener("pointermove", this.handleDrag), document.addEventListener("pointerup", this.stopDrag); } isPointInsideBox(e, t) { return [e, t] = this.toBoxCoordinates(e, t), e >= this.xmin && e <= this.xmax && t >= this.ymin && t <= this.ymax; } indexOfPointInsideHandle(e, t) { [e, t] = this.toBoxCoordinates(e, t); for (let n = 0; n < this.resizeHandles.length; n++) { const i = this.resizeHandles[n]; if (e >= i.xmin && e <= i.xmax && t >= i.ymin && t <= i.ymax) return this.resizingHandleIndex = n, n; } return -1; } startCreating(e, t, n) { this.isCreating = !0, this.offsetMouseX = t, this.offsetMouseY = n, document.addEventListener("pointermove", this.handleCreating), document.addEventListener("pointerup", 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("pointermove", this.handleResize), document.addEventListener("pointerup", this.stopResize); } } const jt = [ "rgb(255, 168, 77)", "rgb(92, 172, 238)", "rgb(255, 99, 71)", "rgb(118, 238, 118)", "rgb(255, 145, 164)", "rgb(0, 191, 255)", "rgb(255, 218, 185)", "rgb(255, 69, 0)", "rgb(34, 139, 34)", "rgb(255, 240, 245)", "rgb(255, 193, 37)", "rgb(255, 193, 7)", "rgb(255, 250, 138)" ], { SvelteComponent: Dh, append: Yn, attr: nt, binding_callbacks: Rh, bubble: Xs, check_outros: Ml, create_component: Gn, destroy_component: Jn, detach: Ot, element: bn, empty: Th, group_outros: Al, init: Ih, insert: Wt, is_function: jh, listen: ut, mount_component: Qn, noop: Hh, run_all: fr, safe_not_equal: Fh, set_style: vl, space: Pn, toggle_class: kl, transition_in: me, transition_out: Te } = window.__gradio__svelte__internal, { onMount: Xh, onDestroy: Yh, createEventDispatcher: Nh } = window.__gradio__svelte__internal; function Ys(l) { let e, t, n, i, o, s, r, a, f, u; n = new P1({}), s = new e0({}); let c = ( /*showRemoveButton*/ l[1] && Ns(l) ); return { c() { e = bn("span"), t = bn("button"), Gn(n.$$.fragment), i = Pn(), o = bn("button"), Gn(s.$$.fragment), r = Pn(), c && c.c(), nt(t, "class", "icon svelte-1m8vz1h"), nt(t, "aria-label", "Create box"), kl( t, "selected", /*mode*/ l[11] === /*Mode*/ l[8].creation ), nt(o, "class", "icon svelte-1m8vz1h"), nt(o, "aria-label", "Edit boxes"), kl( o, "selected", /*mode*/ l[11] === /*Mode*/ l[8].drag ), nt(e, "class", "canvas-control svelte-1m8vz1h"); }, m(_, d) { Wt(_, e, d), Yn(e, t), Qn(n, t, null), Yn(e, i), Yn(e, o), Qn(s, o, null), Yn(e, r), c && c.m(e, null), a = !0, f || (u = [ ut( t, "click", /*click_handler*/ l[34] ), ut( o, "click", /*click_handler_1*/ l[35] ) ], f = !0); }, p(_, d) { (!a || d[0] & /*mode, Mode*/ 2304) && kl( t, "selected", /*mode*/ _[11] === /*Mode*/ _[8].creation ), (!a || d[0] & /*mode, Mode*/ 2304) && kl( o, "selected", /*mode*/ _[11] === /*Mode*/ _[8].drag ), /*showRemoveButton*/ _[1] ? c ? (c.p(_, d), d[0] & /*showRemoveButton*/ 2 && me(c, 1)) : (c = Ns(_), c.c(), me(c, 1), c.m(e, null)) : c && (Al(), Te(c, 1, 1, () => { c = null; }), Ml()); }, i(_) { a || (me(n.$$.fragment, _), me(s.$$.fragment, _), me(c), a = !0); }, o(_) { Te(n.$$.fragment, _), Te(s.$$.fragment, _), Te(c), a = !1; }, d(_) { _ && Ot(e), Jn(n), Jn(s), c && c.d(), f = !1, fr(u); } }; } function Ns(l) { let e, t, n, i, o; return t = new r0({}), { c() { e = bn("button"), Gn(t.$$.fragment), nt(e, "class", "icon svelte-1m8vz1h"), nt(e, "aria-label", "Remove boxes"); }, m(s, r) { Wt(s, e, r), Qn(t, e, null), n = !0, i || (o = ut( e, "click", /*click_handler_2*/ l[36] ), i = !0); }, p: Hh, i(s) { n || (me(t.$$.fragment, s), n = !0); }, o(s) { Te(t.$$.fragment, s), n = !1; }, d(s) { s && Ot(e), Jn(t), i = !1, o(); } }; } function Us(l) { let e, t; return e = new rr({ props: { choices: ( /*choices*/ l[3] ), choicesColors: ( /*choicesColors*/ l[4] ), label: ( /*selectedBox*/ l[10] >= 0 && /*selectedBox*/ l[10] < /*value*/ l[0].boxes.length ? ( /*value*/ l[0].boxes[ /*selectedBox*/ l[10] ].label ) : "" ), color: ( /*selectedBox*/ l[10] >= 0 && /*selectedBox*/ l[10] < /*value*/ l[0].boxes.length ? xn( /*value*/ l[0].boxes[ /*selectedBox*/ l[10] ].color ) : "" ) } }), e.$on( "change", /*onModalEditChange*/ l[20] ), e.$on( "enter{onModalEditChange}", /*enter_onModalEditChange_handler*/ l[37] ), { c() { Gn(e.$$.fragment); }, m(n, i) { Qn(e, n, i), t = !0; }, p(n, i) { const o = {}; i[0] & /*choices*/ 8 && (o.choices = /*choices*/ n[3]), i[0] & /*choicesColors*/ 16 && (o.choicesColors = /*choicesColors*/ n[4]), i[0] & /*selectedBox, value*/ 1025 && (o.label = /*selectedBox*/ n[10] >= 0 && /*selectedBox*/ n[10] < /*value*/ n[0].boxes.length ? ( /*value*/ n[0].boxes[ /*selectedBox*/ n[10] ].label ) : ""), i[0] & /*selectedBox, value*/ 1025 && (o.color = /*selectedBox*/ n[10] >= 0 && /*selectedBox*/ n[10] < /*value*/ n[0].boxes.length ? xn( /*value*/ n[0].boxes[ /*selectedBox*/ n[10] ].color ) : ""), e.$set(o); }, i(n) { t || (me(e.$$.fragment, n), t = !0); }, o(n) { Te(e.$$.fragment, n), t = !1; }, d(n) { Jn(e, n); } }; } function Os(l) { let e, t; return e = new rr({ props: { choices: ( /*choices*/ l[3] ), showRemove: !1, choicesColors: ( /*choicesColors*/ l[4] ), label: ( /*selectedBox*/ l[10] >= 0 && /*selectedBox*/ l[10] < /*value*/ l[0].boxes.length ? ( /*value*/ l[0].boxes[ /*selectedBox*/ l[10] ].label ) : "" ), color: ( /*selectedBox*/ l[10] >= 0 && /*selectedBox*/ l[10] < /*value*/ l[0].boxes.length ? xn( /*value*/ l[0].boxes[ /*selectedBox*/ l[10] ].color ) : "" ) } }), e.$on( "change", /*onModalNewChange*/ l[21] ), e.$on( "enter{onModalNewChange}", /*enter_onModalNewChange_handler*/ l[38] ), { c() { Gn(e.$$.fragment); }, m(n, i) { Qn(e, n, i), t = !0; }, p(n, i) { const o = {}; i[0] & /*choices*/ 8 && (o.choices = /*choices*/ n[3]), i[0] & /*choicesColors*/ 16 && (o.choicesColors = /*choicesColors*/ n[4]), i[0] & /*selectedBox, value*/ 1025 && (o.label = /*selectedBox*/ n[10] >= 0 && /*selectedBox*/ n[10] < /*value*/ n[0].boxes.length ? ( /*value*/ n[0].boxes[ /*selectedBox*/ n[10] ].label ) : ""), i[0] & /*selectedBox, value*/ 1025 && (o.color = /*selectedBox*/ n[10] >= 0 && /*selectedBox*/ n[10] < /*value*/ n[0].boxes.length ? xn( /*value*/ n[0].boxes[ /*selectedBox*/ n[10] ].color ) : ""), e.$set(o); }, i(n) { t || (me(e.$$.fragment, n), t = !0); }, o(n) { Te(e.$$.fragment, n), t = !1; }, d(n) { Jn(e, n); } }; } function Uh(l) { let e, t, n, i, o, s, r, a, f, u = ( /*interactive*/ l[2] && Ys(l) ), c = ( /*editModalVisible*/ l[12] && Us(l) ), _ = ( /*newModalVisible*/ l[13] && Os(l) ); return { c() { e = bn("div"), t = bn("canvas"), n = Pn(), u && u.c(), i = Pn(), c && c.c(), o = Pn(), _ && _.c(), s = Th(), vl( t, "height", /*height*/ l[5] ), vl( t, "width", /*width*/ l[6] ), nt(t, "class", "canvas-annotator svelte-1m8vz1h"), nt(e, "class", "canvas-container svelte-1m8vz1h"), nt(e, "tabindex", "-1"); }, m(d, h) { Wt(d, e, h), Yn(e, t), l[33](t), Wt(d, n, h), u && u.m(d, h), Wt(d, i, h), c && c.m(d, h), Wt(d, o, h), _ && _.m(d, h), Wt(d, s, h), r = !0, a || (f = [ ut( t, "pointerdown", /*handlePointerDown*/ l[14] ), ut( t, "pointerup", /*handlePointerUp*/ l[15] ), ut(t, "pointermove", function() { jh( /*handlesCursor*/ l[7] ? ( /*handlePointerMove*/ l[16] ) : null ) && /*handlesCursor*/ (l[7] ? ( /*handlePointerMove*/ l[16] ) : null).apply(this, arguments); }), ut( t, "dblclick", /*handleDoubleClick*/ l[19] ), ut( e, "focusin", /*handleCanvasFocus*/ l[23] ), ut( e, "focusout", /*handleCanvasBlur*/ l[24] ) ], a = !0); }, p(d, h) { l = d, (!r || h[0] & /*height*/ 32) && vl( t, "height", /*height*/ l[5] ), (!r || h[0] & /*width*/ 64) && vl( t, "width", /*width*/ l[6] ), /*interactive*/ l[2] ? u ? (u.p(l, h), h[0] & /*interactive*/ 4 && me(u, 1)) : (u = Ys(l), u.c(), me(u, 1), u.m(i.parentNode, i)) : u && (Al(), Te(u, 1, 1, () => { u = null; }), Ml()), /*editModalVisible*/ l[12] ? c ? (c.p(l, h), h[0] & /*editModalVisible*/ 4096 && me(c, 1)) : (c = Us(l), c.c(), me(c, 1), c.m(o.parentNode, o)) : c && (Al(), Te(c, 1, 1, () => { c = null; }), Ml()), /*newModalVisible*/ l[13] ? _ ? (_.p(l, h), h[0] & /*newModalVisible*/ 8192 && me(_, 1)) : (_ = Os(l), _.c(), me(_, 1), _.m(s.parentNode, s)) : _ && (Al(), Te(_, 1, 1, () => { _ = null; }), Ml()); }, i(d) { r || (me(u), me(c), me(_), r = !0); }, o(d) { Te(u), Te(c), Te(_), r = !1; }, d(d) { d && (Ot(e), Ot(n), Ot(i), Ot(o), Ot(s)), l[33](null), u && u.d(d), c && c.d(d), _ && _.d(d), a = !1, fr(f); } }; } function Fi(l) { var e = parseInt(l.slice(1, 3), 16), t = parseInt(l.slice(3, 5), 16), n = parseInt(l.slice(5, 7), 16); return "rgb(" + e + ", " + t + ", " + n + ")"; } function xn(l) { const e = l.match(/(\d+(\.\d+)?)/g), t = parseInt(e[0]), n = parseInt(e[1]), i = parseInt(e[2]); return "#" + (1 << 24 | t << 16 | n << 8 | i).toString(16).slice(1); } function Oh(l, e, t) { var n; (function(B) { B[B.creation = 0] = "creation", B[B.drag = 1] = "drag"; })(n || (n = {})); let { imageUrl: i = null } = e, { interactive: o } = e, { boxAlpha: s = 0.5 } = e, { boxMinSize: r = 25 } = e, { handleSize: a } = e, { boxThickness: f } = e, { boxSelectedThickness: u } = e, { value: c } = e, { choices: _ = [] } = e, { choicesColors: d = [] } = e, { disableEditBoxes: h = !1 } = e, { height: m = "100%" } = e, { width: w = "100%" } = e, { singleBox: b = !1 } = e, { showRemoveButton: p = null } = e, { handlesCursor: g = !0 } = e; p === null && (p = h); let v, E, y = null, C = -1, k = n.drag; c !== null && c.boxes.length == 0 && (k = n.creation); let A = 0, S = 0, T = 0, R = 0, U = 1, Z = 0, Q = 0, J = !1, K = !1; const L = Nh(); function F() { if (E) { E.clearRect(0, 0, v.width, v.height), y !== null && E.drawImage(y, A, S, Z, Q); for (const B of c.boxes.slice().reverse()) B.render(E); } } function D(B) { t(10, C = B), c.boxes.forEach((N) => { N.setSelected(!1); }), B >= 0 && B < c.boxes.length && c.boxes[B].setSelected(!0), F(); } function W(B) { o && (B.target instanceof Element && B.target.hasPointerCapture(B.pointerId) && B.target.releasePointerCapture(B.pointerId), k === n.creation ? Xe(B) : k === n.drag && $(B)); } function $(B) { const N = v.getBoundingClientRect(), ee = B.clientX - N.left, ce = B.clientY - N.top; for (const [te, ie] of c.boxes.entries()) { const Sn = ie.indexOfPointInsideHandle(ee, ce); if (Sn >= 0) { D(te), ie.startResize(Sn, B); return; } } for (const [te, ie] of c.boxes.entries()) if (ie.isPointInsideBox(ee, ce)) { D(te), ie.startDrag(B); return; } b || D(-1); } function oe(B) { L("change"); } function ge(B) { if (c === null || k !== n.drag) return; const N = v.getBoundingClientRect(), ee = B.clientX - N.left, ce = B.clientY - N.top; for (const [te, ie] of c.boxes.entries()) { const Sn = ie.indexOfPointInsideHandle(ee, ce); if (Sn >= 0) { t(9, v.style.cursor = ie.resizeHandles[Sn].cursor, v); return; } } t(9, v.style.cursor = "default", v); } function I(B) { if (o) switch (B.key) { case "Delete": ke(); break; } } function Xe(B) { const N = v.getBoundingClientRect(), ee = (B.clientX - N.left - A) / U, ce = (B.clientY - N.top - S) / U; let te; d.length > 0 ? te = Fi(d[0]) : b ? c.boxes.length > 0 ? te = c.boxes[0].color : te = jt[0] : te = jt[c.boxes.length % jt.length]; let ie = new Hi(F, G, A, S, T, R, "", ee, ce, ee, ce, te, s, r, a, f, u); ie.startCreating(B, N.left, N.top), b ? t(0, c.boxes = [ie], c) : t(0, c.boxes = [ie, ...c.boxes], c), D(0), F(), L("change"); } function M() { t(11, k = n.creation), t(9, v.style.cursor = "crosshair", v); } function H() { t(11, k = n.drag), t(9, v.style.cursor = "default", v); } function G() { C >= 0 && C < c.boxes.length && (c.boxes[C].getArea() < 1 ? ke() : (h || t(13, K = !0), b && H())); } function q() { C >= 0 && C < c.boxes.length && !h && t(12, J = !0); } function ue(B) { o && q(); } function Ye(B) { t(12, J = !1); const { detail: N } = B; let ee = N.label, ce = N.color, te = N.ret; if (C >= 0 && C < c.boxes.length) { let ie = c.boxes[C]; te == 1 ? (ie.label = ee, ie.color = Fi(ce), F(), L("change")) : te == -1 && ke(); } } function Qe(B) { t(13, K = !1); const { detail: N } = B; let ee = N.label, ce = N.color, te = N.ret; if (C >= 0 && C < c.boxes.length) { let ie = c.boxes[C]; te == 1 ? (ie.label = ee, ie.color = Fi(ce), F(), L("change")) : ke(); } } function ke() { C >= 0 && C < c.boxes.length && (c.boxes.splice(C, 1), D(-1), b && M(), L("change")); } function be() { if (v) { if (U = 1, t(9, v.width = v.clientWidth, v), y !== null) if (y.width > v.width) U = v.width / y.width, Z = y.width * U, Q = y.height * U, A = 0, S = 0, T = Z, R = Q, t(9, v.height = Q, v); else { Z = y.width, Q = y.height; var B = (v.width - Z) / 2; A = B, S = 0, T = B + Z, R = y.height, t(9, v.height = Q, v); } else A = 0, S = 0, T = v.width, R = v.height, t(9, v.height = v.clientHeight, v); if (T > 0 && R > 0) for (const N of c.boxes) N.canvasXmin = A, N.canvasYmin = S, N.canvasXmax = T, N.canvasYmax = R, N.setScaleFactor(U); F(), L("change"); } } const Ne = new ResizeObserver(be); function Ue() { for (let B = 0; B < c.boxes.length; B++) { let N = c.boxes[B]; if (!(N instanceof Hi)) { let ee = "", ce = ""; N.hasOwnProperty("color") ? (ee = N.color, Array.isArray(ee) && ee.length === 3 && (ee = `rgb(${ee[0]}, ${ee[1]}, ${ee[2]})`)) : ee = jt[B % jt.length], N.hasOwnProperty("label") && (ce = N.label), N = new Hi(F, G, A, S, T, R, ce, N.xmin, N.ymin, N.xmax, N.ymax, ee, s, r, a, f, u), t(0, c.boxes[B] = N, c); } } } function bt() { i !== null && (y === null || y.src != i) && (y = new Image(), y.src = i, y.onload = function() { be(), F(); }); } Xh(() => { if (Array.isArray(_) && _.length > 0 && (!Array.isArray(d) || d.length == 0)) for (let B = 0; B < _.length; B++) { let N = jt[B % jt.length]; d.push(xn(N)); } E = v.getContext("2d"), Ne.observe(v), C < 0 && c !== null && c.boxes.length > 0 && D(0), bt(), be(), F(); }); function ti() { document.addEventListener("keydown", I); } function ni() { document.removeEventListener("keydown", I); } Yh(() => { document.removeEventListener("keydown", I); }); function z(B) { Rh[B ? "unshift" : "push"](() => { v = B, t(9, v); }); } const wt = () => M(), st = () => H(), tn = () => ke(); function li(B) { Xs.call(this, l, B); } function Lt(B) { Xs.call(this, l, B); } return l.$$set = (B) => { "imageUrl" in B && t(25, i = B.imageUrl), "interactive" in B && t(2, o = B.interactive), "boxAlpha" in B && t(26, s = B.boxAlpha), "boxMinSize" in B && t(27, r = B.boxMinSize), "handleSize" in B && t(28, a = B.handleSize), "boxThickness" in B && t(29, f = B.boxThickness), "boxSelectedThickness" in B && t(30, u = B.boxSelectedThickness), "value" in B && t(0, c = B.value), "choices" in B && t(3, _ = B.choices), "choicesColors" in B && t(4, d = B.choicesColors), "disableEditBoxes" in B && t(31, h = B.disableEditBoxes), "height" in B && t(5, m = B.height), "width" in B && t(6, w = B.width), "singleBox" in B && t(32, b = B.singleBox), "showRemoveButton" in B && t(1, p = B.showRemoveButton), "handlesCursor" in B && t(7, g = B.handlesCursor); }, l.$$.update = () => { l.$$.dirty[0] & /*value*/ 1 && (bt(), Ue(), be(), F()); }, [ c, p, o, _, d, m, w, g, n, v, C, k, J, K, W, oe, ge, M, H, ue, Ye, Qe, ke, ti, ni, i, s, r, a, f, u, h, b, z, wt, st, tn, li, Lt ]; } class Wh extends Dh { constructor(e) { super(), Ih( this, e, Oh, Uh, Fh, { imageUrl: 25, interactive: 2, boxAlpha: 26, boxMinSize: 27, handleSize: 28, boxThickness: 29, boxSelectedThickness: 30, value: 0, choices: 3, choicesColors: 4, disableEditBoxes: 31, height: 5, width: 6, singleBox: 32, showRemoveButton: 1, handlesCursor: 7 }, null, [-1, -1] ); } } const { SvelteComponent: Vh, add_flush_callback: Ph, bind: Zh, binding_callbacks: Kh, create_component: Gh, destroy_component: Jh, init: Qh, mount_component: xh, safe_not_equal: $h, transition_in: em, transition_out: tm } = window.__gradio__svelte__internal, { createEventDispatcher: nm } = window.__gradio__svelte__internal; function lm(l) { let e, t, n; function i(s) { l[19](s); } let o = { interactive: ( /*interactive*/ l[1] ), boxAlpha: ( /*boxesAlpha*/ l[2] ), choices: ( /*labelList*/ l[3] ), choicesColors: ( /*labelColors*/ l[4] ), height: ( /*height*/ l[8] ), width: ( /*width*/ l[9] ), boxMinSize: ( /*boxMinSize*/ l[5] ), handleSize: ( /*handleSize*/ l[6] ), boxThickness: ( /*boxThickness*/ l[7] ), boxSelectedThickness: ( /*boxSelectedThickness*/ l[10] ), disableEditBoxes: ( /*disableEditBoxes*/ l[11] ), singleBox: ( /*singleBox*/ l[12] ), showRemoveButton: ( /*showRemoveButton*/ l[13] ), handlesCursor: ( /*handlesCursor*/ l[14] ), imageUrl: ( /*resolved_src*/ l[15] ) }; return ( /*value*/ l[0] !== void 0 && (o.value = /*value*/ l[0]), e = new Wh({ props: o }), Kh.push(() => Zh(e, "value", i)), e.$on( "change", /*change_handler*/ l[20] ), { c() { Gh(e.$$.fragment); }, m(s, r) { xh(e, s, r), n = !0; }, p(s, [r]) { const a = {}; r & /*interactive*/ 2 && (a.interactive = /*interactive*/ s[1]), r & /*boxesAlpha*/ 4 && (a.boxAlpha = /*boxesAlpha*/ s[2]), r & /*labelList*/ 8 && (a.choices = /*labelList*/ s[3]), r & /*labelColors*/ 16 && (a.choicesColors = /*labelColors*/ s[4]), r & /*height*/ 256 && (a.height = /*height*/ s[8]), r & /*width*/ 512 && (a.width = /*width*/ s[9]), r & /*boxMinSize*/ 32 && (a.boxMinSize = /*boxMinSize*/ s[5]), r & /*handleSize*/ 64 && (a.handleSize = /*handleSize*/ s[6]), r & /*boxThickness*/ 128 && (a.boxThickness = /*boxThickness*/ s[7]), r & /*boxSelectedThickness*/ 1024 && (a.boxSelectedThickness = /*boxSelectedThickness*/ s[10]), r & /*disableEditBoxes*/ 2048 && (a.disableEditBoxes = /*disableEditBoxes*/ s[11]), r & /*singleBox*/ 4096 && (a.singleBox = /*singleBox*/ s[12]), r & /*showRemoveButton*/ 8192 && (a.showRemoveButton = /*showRemoveButton*/ s[13]), r & /*handlesCursor*/ 16384 && (a.handlesCursor = /*handlesCursor*/ s[14]), r & /*resolved_src*/ 32768 && (a.imageUrl = /*resolved_src*/ s[15]), !t && r & /*value*/ 1 && (t = !0, a.value = /*value*/ s[0], Ph(() => t = !1)), e.$set(a); }, i(s) { n || (em(e.$$.fragment, s), n = !0); }, o(s) { tm(e.$$.fragment, s), n = !1; }, d(s) { Jh(e, s); } } ); } function im(l, e, t) { let { src: n = void 0 } = e, { interactive: i } = e, { boxesAlpha: o } = e, { labelList: s } = e, { labelColors: r } = e, { boxMinSize: a } = e, { handleSize: f } = e, { boxThickness: u } = e, { height: c } = e, { width: _ } = e, { boxSelectedThickness: d } = e, { value: h } = e, { disableEditBoxes: m } = e, { singleBox: w } = e, { showRemoveButton: b } = e, { handlesCursor: p } = e, g, v; const E = nm(); function y(k) { h = k, t(0, h); } const C = () => E("change"); return l.$$set = (k) => { "src" in k && t(17, n = k.src), "interactive" in k && t(1, i = k.interactive), "boxesAlpha" in k && t(2, o = k.boxesAlpha), "labelList" in k && t(3, s = k.labelList), "labelColors" in k && t(4, r = k.labelColors), "boxMinSize" in k && t(5, a = k.boxMinSize), "handleSize" in k && t(6, f = k.handleSize), "boxThickness" in k && t(7, u = k.boxThickness), "height" in k && t(8, c = k.height), "width" in k && t(9, _ = k.width), "boxSelectedThickness" in k && t(10, d = k.boxSelectedThickness), "value" in k && t(0, h = k.value), "disableEditBoxes" in k && t(11, m = k.disableEditBoxes), "singleBox" in k && t(12, w = k.singleBox), "showRemoveButton" in k && t(13, b = k.showRemoveButton), "handlesCursor" in k && t(14, p = k.handlesCursor); }, l.$$.update = () => { if (l.$$.dirty & /*src, latest_src*/ 393216) { t(15, g = n), t(18, v = n); const k = n; nd(k).then((A) => { v === k && t(15, g = A); }); } }, [ h, i, o, s, r, a, f, u, c, _, d, m, w, b, p, g, E, n, v, y, C ]; } class om extends Vh { constructor(e) { super(), Qh(this, e, im, lm, $h, { src: 17, interactive: 1, boxesAlpha: 2, labelList: 3, labelColors: 4, boxMinSize: 5, handleSize: 6, boxThickness: 7, height: 8, width: 9, boxSelectedThickness: 10, value: 0, disableEditBoxes: 11, singleBox: 12, showRemoveButton: 13, handlesCursor: 14 }); } } class Ws { constructor() { this.boxes = []; } } const { SvelteComponent: sm, add_flush_callback: Ol, append: un, attr: Nn, bind: Wl, binding_callbacks: $n, bubble: Mn, check_outros: Xt, create_component: _t, create_slot: am, destroy_component: dt, detach: Zt, element: Zn, empty: rm, get_all_dirty_from_scope: fm, get_slot_changes: um, group_outros: Yt, init: cm, insert: Kt, mount_component: ht, noop: _m, safe_not_equal: dm, space: Ht, toggle_class: Vs, transition_in: P, transition_out: x, update_slot_base: hm } = window.__gradio__svelte__internal, { createEventDispatcher: mm, tick: gm } = window.__gradio__svelte__internal; function Ps(l) { let e, t; return e = new md({ props: { href: ( /*value*/ l[1].image.url ), download: ( /*value*/ l[1].image.orig_name || "image" ), $$slots: { default: [bm] }, $$scope: { ctx: l } } }), { c() { _t(e.$$.fragment); }, m(n, i) { ht(e, n, i), t = !0; }, p(n, i) { const o = {}; i[0] & /*value*/ 2 && (o.href = /*value*/ n[1].image.url), i[0] & /*value*/ 2 && (o.download = /*value*/ n[1].image.orig_name || "image"), i[0] & /*i18n*/ 256 | i[1] & /*$$scope*/ 2097152 && (o.$$scope = { dirty: i, ctx: n }), e.$set(o); }, i(n) { t || (P(e.$$.fragment, n), t = !0); }, o(n) { x(e.$$.fragment, n), t = !1; }, d(n) { dt(e, n); } }; } function bm(l) { let e, t; return e = new Vl({ props: { Icon: Ou, label: ( /*i18n*/ l[8]("common.download") ) } }), { c() { _t(e.$$.fragment); }, m(n, i) { ht(e, n, i), t = !0; }, p(n, i) { const o = {}; i[0] & /*i18n*/ 256 && (o.label = /*i18n*/ n[8]("common.download")), e.$set(o); }, i(n) { t || (P(e.$$.fragment, n), t = !0); }, o(n) { x(e.$$.fragment, n), t = !1; }, d(n) { dt(e, n); } }; } function Zs(l) { let e, t; return e = new Qc({ props: { i18n: ( /*i18n*/ l[8] ), formatter: ( /*func*/ l[37] ), value: ( /*value*/ l[1] ) } }), e.$on( "share", /*share_handler*/ l[38] ), e.$on( "error", /*error_handler*/ l[39] ), { c() { _t(e.$$.fragment); }, m(n, i) { ht(e, n, i), t = !0; }, p(n, i) { const o = {}; i[0] & /*i18n*/ 256 && (o.i18n = /*i18n*/ n[8]), i[0] & /*value*/ 2 && (o.value = /*value*/ n[1]), e.$set(o); }, i(n) { t || (P(e.$$.fragment, n), t = !0); }, o(n) { x(e.$$.fragment, n), t = !1; }, d(n) { dt(e, n); } }; } function Ks(l) { let e, t, n; return t = new Vl({ props: { Icon: ua, label: "Remove Image" } }), t.$on( "click", /*clear*/ l[35] ), { c() { e = Zn("div"), _t(t.$$.fragment); }, m(i, o) { Kt(i, e, o), ht(t, e, null), n = !0; }, p: _m, i(i) { n || (P(t.$$.fragment, i), n = !0); }, o(i) { x(t.$$.fragment, i), n = !1; }, d(i) { i && Zt(e), dt(t); } }; } function Gs(l) { let e; const t = ( /*#slots*/ l[36].default ), n = am( t, l, /*$$scope*/ l[52], null ); return { c() { n && n.c(); }, m(i, o) { n && n.m(i, o), e = !0; }, p(i, o) { n && n.p && (!e || o[1] & /*$$scope*/ 2097152) && hm( n, t, i, /*$$scope*/ i[52], e ? um( t, /*$$scope*/ i[52], o, null ) : fm( /*$$scope*/ i[52] ), null ); }, i(i) { e || (P(n, i), e = !0); }, o(i) { x(n, i), e = !1; }, d(i) { n && n.d(i); } }; } function wm(l) { let e, t, n = ( /*value*/ l[1] === null && Gs(l) ); return { c() { n && n.c(), e = rm(); }, m(i, o) { n && n.m(i, o), Kt(i, e, o), t = !0; }, p(i, o) { /*value*/ i[1] === null ? n ? (n.p(i, o), o[0] & /*value*/ 2 && P(n, 1)) : (n = Gs(i), n.c(), P(n, 1), n.m(e.parentNode, e)) : n && (Yt(), x(n, 1, 1, () => { n = null; }), Xt()); }, i(i) { t || (P(n), t = !0); }, o(i) { x(n), t = !1; }, d(i) { i && Zt(e), n && n.d(i); } }; } function Js(l) { let e, t; return e = new X1({ props: { root: ( /*root*/ l[6] ), mode: "image", include_audio: !1, i18n: ( /*i18n*/ l[8] ), upload: ( /*upload*/ l[30] ) } }), e.$on( "capture", /*capture_handler*/ l[44] ), e.$on( "stream", /*stream_handler_1*/ l[45] ), e.$on( "error", /*error_handler_2*/ l[46] ), e.$on( "drag", /*drag_handler*/ l[47] ), e.$on( "upload", /*upload_handler*/ l[48] ), { c() { _t(e.$$.fragment); }, m(n, i) { ht(e, n, i), t = !0; }, p(n, i) { const o = {}; i[0] & /*root*/ 64 && (o.root = /*root*/ n[6]), i[0] & /*i18n*/ 256 && (o.i18n = /*i18n*/ n[8]), i[0] & /*upload*/ 1073741824 && (o.upload = /*upload*/ n[30]), e.$set(o); }, i(n) { t || (P(e.$$.fragment, n), t = !0); }, o(n) { x(e.$$.fragment, n), t = !1; }, d(n) { dt(e, n); } }; } function Qs(l) { let e, t, n, i; function o(r) { l[49](r); } let s = { height: ( /*height*/ l[17] ), width: ( /*width*/ l[18] ), boxesAlpha: ( /*boxesAlpha*/ l[12] ), labelList: ( /*labelList*/ l[13] ), labelColors: ( /*labelColors*/ l[14] ), boxMinSize: ( /*boxMinSize*/ l[15] ), interactive: ( /*interactive*/ l[7] ), handleSize: ( /*handleSize*/ l[16] ), boxThickness: ( /*boxThickness*/ l[19] ), singleBox: ( /*singleBox*/ l[21] ), disableEditBoxes: ( /*disableEditBoxes*/ l[20] ), showRemoveButton: ( /*showRemoveButton*/ l[22] ), handlesCursor: ( /*handlesCursor*/ l[23] ), boxSelectedThickness: ( /*boxSelectedThickness*/ l[24] ), src: ( /*value*/ l[1].image.url ) }; return ( /*value*/ l[1] !== void 0 && (s.value = /*value*/ l[1]), t = new om({ props: s }), $n.push(() => Wl(t, "value", o)), t.$on( "change", /*change_handler*/ l[50] ), { c() { e = Zn("div"), _t(t.$$.fragment), Nn(e, "class", "image-frame svelte-1gjdske"), Vs( e, "selectable", /*selectable*/ l[5] ); }, m(r, a) { Kt(r, e, a), ht(t, e, null), i = !0; }, p(r, a) { const f = {}; a[0] & /*height*/ 131072 && (f.height = /*height*/ r[17]), a[0] & /*width*/ 262144 && (f.width = /*width*/ r[18]), a[0] & /*boxesAlpha*/ 4096 && (f.boxesAlpha = /*boxesAlpha*/ r[12]), a[0] & /*labelList*/ 8192 && (f.labelList = /*labelList*/ r[13]), a[0] & /*labelColors*/ 16384 && (f.labelColors = /*labelColors*/ r[14]), a[0] & /*boxMinSize*/ 32768 && (f.boxMinSize = /*boxMinSize*/ r[15]), a[0] & /*interactive*/ 128 && (f.interactive = /*interactive*/ r[7]), a[0] & /*handleSize*/ 65536 && (f.handleSize = /*handleSize*/ r[16]), a[0] & /*boxThickness*/ 524288 && (f.boxThickness = /*boxThickness*/ r[19]), a[0] & /*singleBox*/ 2097152 && (f.singleBox = /*singleBox*/ r[21]), a[0] & /*disableEditBoxes*/ 1048576 && (f.disableEditBoxes = /*disableEditBoxes*/ r[20]), a[0] & /*showRemoveButton*/ 4194304 && (f.showRemoveButton = /*showRemoveButton*/ r[22]), a[0] & /*handlesCursor*/ 8388608 && (f.handlesCursor = /*handlesCursor*/ r[23]), a[0] & /*boxSelectedThickness*/ 16777216 && (f.boxSelectedThickness = /*boxSelectedThickness*/ r[24]), a[0] & /*value*/ 2 && (f.src = /*value*/ r[1].image.url), !n && a[0] & /*value*/ 2 && (n = !0, f.value = /*value*/ r[1], Ol(() => n = !1)), t.$set(f), (!i || a[0] & /*selectable*/ 32) && Vs( e, "selectable", /*selectable*/ r[5] ); }, i(r) { i || (P(t.$$.fragment, r), i = !0); }, o(r) { x(t.$$.fragment, r), i = !1; }, d(r) { r && Zt(e), dt(t); } } ); } function xs(l) { let e, t, n; function i(s) { l[51](s); } let o = { sources: ( /*sources*/ l[4] ), handle_clear: ( /*clear*/ l[35] ), handle_select: ( /*handle_select_source*/ l[34] ) }; return ( /*active_source*/ l[0] !== void 0 && (o.active_source = /*active_source*/ l[0]), e = new d_({ props: o }), $n.push(() => Wl(e, "active_source", i)), { c() { _t(e.$$.fragment); }, m(s, r) { ht(e, s, r), n = !0; }, p(s, r) { const a = {}; r[0] & /*sources*/ 16 && (a.sources = /*sources*/ s[4]), !t && r[0] & /*active_source*/ 1 && (t = !0, a.active_source = /*active_source*/ s[0], Ol(() => t = !1)), e.$set(a); }, i(s) { n || (P(e.$$.fragment, s), n = !0); }, o(s) { x(e.$$.fragment, s), n = !1; }, d(s) { dt(e, s); } } ); } function pm(l) { let e, t, n, i, o, s, r, a, f, u, c, _, d, h, m = ( /*sources*/ (l[4].length > 1 || /*sources*/ l[4].includes("clipboard")) && /*value*/ l[1] === null && /*interactive*/ l[7] ), w; e = new Mf({ props: { show_label: ( /*show_label*/ l[3] ), Icon: ca, label: ( /*label*/ l[2] || "Image Annotator" ) } }); let b = ( /*showDownloadButton*/ l[10] && /*value*/ l[1] !== null && Ps(l) ), p = ( /*showShareButton*/ l[9] && /*value*/ l[1] !== null && Zs(l) ), g = ( /*showClearButton*/ l[11] && /*value*/ l[1] !== null && /*interactive*/ l[7] && Ks(l) ); function v(S) { l[41](S); } function E(S) { l[42](S); } let y = { hidden: ( /*value*/ l[1] !== null || /*active_source*/ l[0] === "webcam" ), filetype: ( /*active_source*/ l[0] === "clipboard" ? "clipboard" : "image/*" ), root: ( /*root*/ l[6] ), max_file_size: ( /*max_file_size*/ l[25] ), disable_click: !/*sources*/ l[4].includes("upload"), upload: ( /*cli_upload*/ l[26] ), stream_handler: ( /*stream_handler*/ l[27] ), $$slots: { default: [wm] }, $$scope: { ctx: l } }; /*uploading*/ l[28] !== void 0 && (y.uploading = /*uploading*/ l[28]), /*dragging*/ l[29] !== void 0 && (y.dragging = /*dragging*/ l[29]), f = new Kd({ props: y }), l[40](f), $n.push(() => Wl(f, "uploading", v)), $n.push(() => Wl(f, "dragging", E)), f.$on( "load", /*handle_upload*/ l[31] ), f.$on( "error", /*error_handler_1*/ l[43] ); let C = ( /*value*/ l[1] === null && /*active_source*/ l[0] === "webcam" && Js(l) ), k = ( /*value*/ l[1] !== null && Qs(l) ), A = m && xs(l); return { c() { _t(e.$$.fragment), t = Ht(), n = Zn("div"), b && b.c(), i = Ht(), p && p.c(), o = Ht(), g && g.c(), s = Ht(), r = Zn("div"), a = Zn("div"), _t(f.$$.fragment), _ = Ht(), C && C.c(), d = Ht(), k && k.c(), h = Ht(), A && A.c(), Nn(n, "class", "icon-buttons svelte-1gjdske"), Nn(a, "class", "upload-container svelte-1gjdske"), Nn(r, "data-testid", "image"), Nn(r, "class", "image-container svelte-1gjdske"); }, m(S, T) { ht(e, S, T), Kt(S, t, T), Kt(S, n, T), b && b.m(n, null), un(n, i), p && p.m(n, null), un(n, o), g && g.m(n, null), Kt(S, s, T), Kt(S, r, T), un(r, a), ht(f, a, null), un(a, _), C && C.m(a, null), un(a, d), k && k.m(a, null), un(r, h), A && A.m(r, null), w = !0; }, p(S, T) { const R = {}; T[0] & /*show_label*/ 8 && (R.show_label = /*show_label*/ S[3]), T[0] & /*label*/ 4 && (R.label = /*label*/ S[2] || "Image Annotator"), e.$set(R), /*showDownloadButton*/ S[10] && /*value*/ S[1] !== null ? b ? (b.p(S, T), T[0] & /*showDownloadButton, value*/ 1026 && P(b, 1)) : (b = Ps(S), b.c(), P(b, 1), b.m(n, i)) : b && (Yt(), x(b, 1, 1, () => { b = null; }), Xt()), /*showShareButton*/ S[9] && /*value*/ S[1] !== null ? p ? (p.p(S, T), T[0] & /*showShareButton, value*/ 514 && P(p, 1)) : (p = Zs(S), p.c(), P(p, 1), p.m(n, o)) : p && (Yt(), x(p, 1, 1, () => { p = null; }), Xt()), /*showClearButton*/ S[11] && /*value*/ S[1] !== null && /*interactive*/ S[7] ? g ? (g.p(S, T), T[0] & /*showClearButton, value, interactive*/ 2178 && P(g, 1)) : (g = Ks(S), g.c(), P(g, 1), g.m(n, null)) : g && (Yt(), x(g, 1, 1, () => { g = null; }), Xt()); const U = {}; T[0] & /*value, active_source*/ 3 && (U.hidden = /*value*/ S[1] !== null || /*active_source*/ S[0] === "webcam"), T[0] & /*active_source*/ 1 && (U.filetype = /*active_source*/ S[0] === "clipboard" ? "clipboard" : "image/*"), T[0] & /*root*/ 64 && (U.root = /*root*/ S[6]), T[0] & /*max_file_size*/ 33554432 && (U.max_file_size = /*max_file_size*/ S[25]), T[0] & /*sources*/ 16 && (U.disable_click = !/*sources*/ S[4].includes("upload")), T[0] & /*cli_upload*/ 67108864 && (U.upload = /*cli_upload*/ S[26]), T[0] & /*stream_handler*/ 134217728 && (U.stream_handler = /*stream_handler*/ S[27]), T[0] & /*value*/ 2 | T[1] & /*$$scope*/ 2097152 && (U.$$scope = { dirty: T, ctx: S }), !u && T[0] & /*uploading*/ 268435456 && (u = !0, U.uploading = /*uploading*/ S[28], Ol(() => u = !1)), !c && T[0] & /*dragging*/ 536870912 && (c = !0, U.dragging = /*dragging*/ S[29], Ol(() => c = !1)), f.$set(U), /*value*/ S[1] === null && /*active_source*/ S[0] === "webcam" ? C ? (C.p(S, T), T[0] & /*value, active_source*/ 3 && P(C, 1)) : (C = Js(S), C.c(), P(C, 1), C.m(a, d)) : C && (Yt(), x(C, 1, 1, () => { C = null; }), Xt()), /*value*/ S[1] !== null ? k ? (k.p(S, T), T[0] & /*value*/ 2 && P(k, 1)) : (k = Qs(S), k.c(), P(k, 1), k.m(a, null)) : k && (Yt(), x(k, 1, 1, () => { k = null; }), Xt()), T[0] & /*sources, value, interactive*/ 146 && (m = /*sources*/ (S[4].length > 1 || /*sources*/ S[4].includes("clipboard")) && /*value*/ S[1] === null && /*interactive*/ S[7]), m ? A ? (A.p(S, T), T[0] & /*sources, value, interactive*/ 146 && P(A, 1)) : (A = xs(S), A.c(), P(A, 1), A.m(r, null)) : A && (Yt(), x(A, 1, 1, () => { A = null; }), Xt()); }, i(S) { w || (P(e.$$.fragment, S), P(b), P(p), P(g), P(f.$$.fragment, S), P(C), P(k), P(A), w = !0); }, o(S) { x(e.$$.fragment, S), x(b), x(p), x(g), x(f.$$.fragment, S), x(C), x(k), x(A), w = !1; }, d(S) { S && (Zt(t), Zt(n), Zt(s), Zt(r)), dt(e, S), b && b.d(), p && p.d(), g && g.d(), l[40](null), dt(f), C && C.d(), k && k.d(), A && A.d(); } }; } function vm(l, e, t) { let { $$slots: n = {}, $$scope: i } = e; var o = this && this.__awaiter || function(z, wt, st, tn) { function li(Lt) { return Lt instanceof st ? Lt : new st(function(B) { B(Lt); }); } return new (st || (st = Promise))(function(Lt, B) { function N(te) { try { ce(tn.next(te)); } catch (ie) { B(ie); } } function ee(te) { try { ce(tn.throw(te)); } catch (ie) { B(ie); } } function ce(te) { te.done ? Lt(te.value) : li(te.value).then(N, ee); } ce((tn = tn.apply(z, wt || [])).next()); }); }; let { value: s } = e, { label: r = void 0 } = e, { show_label: a } = e, { sources: f = ["upload", "webcam", "clipboard"] } = e, { selectable: u = !1 } = e, { root: c } = e, { interactive: _ } = e, { i18n: d } = e, { showShareButton: h } = e, { showDownloadButton: m } = e, { showClearButton: w } = e, { boxesAlpha: b } = e, { labelList: p } = e, { labelColors: g } = e, { boxMinSize: v } = e, { handleSize: E } = e, { height: y } = e, { width: C } = e, { boxThickness: k } = e, { disableEditBoxes: A } = e, { singleBox: S } = e, { showRemoveButton: T } = e, { handlesCursor: R } = e, { boxSelectedThickness: U } = e, { max_file_size: Z = null } = e, { cli_upload: Q } = e, { stream_handler: J } = e, K, L = !1, { active_source: F = null } = e; function D({ detail: z }) { t(1, s = new Ws()), t(1, s.image = z, s), $("upload"); } function W(z) { return o(this, void 0, void 0, function* () { const wt = yield K.load_files([new File([z], "webcam.png")]), st = (wt == null ? void 0 : wt[0]) || null; st ? (t(1, s = new Ws()), t(1, s.image = st, s)) : t(1, s = null), yield gm(), $("change"); }); } const $ = mm(); let oe = !1; function ge(z) { return o(this, void 0, void 0, function* () { switch (z) { case "clipboard": K.paste_clipboard(); break; } }); } function I() { t(1, s = null), $("clear"), $("change"); } const Xe = async (z) => z === null ? "" : ``; function M(z) { Mn.call(this, l, z); } function H(z) { Mn.call(this, l, z); } function G(z) { $n[z ? "unshift" : "push"](() => { K = z, t(30, K); }); } function q(z) { L = z, t(28, L); } function ue(z) { oe = z, t(29, oe); } function Ye(z) { Mn.call(this, l, z); } const Qe = (z) => W(z.detail), ke = (z) => W(z.detail); function be(z) { Mn.call(this, l, z); } function Ne(z) { Mn.call(this, l, z); } const Ue = (z) => W(z.detail); function bt(z) { s = z, t(1, s); } const ti = () => $("change"); function ni(z) { F = z, t(0, F), t(4, f); } return l.$$set = (z) => { "value" in z && t(1, s = z.value), "label" in z && t(2, r = z.label), "show_label" in z && t(3, a = z.show_label), "sources" in z && t(4, f = z.sources), "selectable" in z && t(5, u = z.selectable), "root" in z && t(6, c = z.root), "interactive" in z && t(7, _ = z.interactive), "i18n" in z && t(8, d = z.i18n), "showShareButton" in z && t(9, h = z.showShareButton), "showDownloadButton" in z && t(10, m = z.showDownloadButton), "showClearButton" in z && t(11, w = z.showClearButton), "boxesAlpha" in z && t(12, b = z.boxesAlpha), "labelList" in z && t(13, p = z.labelList), "labelColors" in z && t(14, g = z.labelColors), "boxMinSize" in z && t(15, v = z.boxMinSize), "handleSize" in z && t(16, E = z.handleSize), "height" in z && t(17, y = z.height), "width" in z && t(18, C = z.width), "boxThickness" in z && t(19, k = z.boxThickness), "disableEditBoxes" in z && t(20, A = z.disableEditBoxes), "singleBox" in z && t(21, S = z.singleBox), "showRemoveButton" in z && t(22, T = z.showRemoveButton), "handlesCursor" in z && t(23, R = z.handlesCursor), "boxSelectedThickness" in z && t(24, U = z.boxSelectedThickness), "max_file_size" in z && t(25, Z = z.max_file_size), "cli_upload" in z && t(26, Q = z.cli_upload), "stream_handler" in z && t(27, J = z.stream_handler), "active_source" in z && t(0, F = z.active_source), "$$scope" in z && t(52, i = z.$$scope); }, l.$$.update = () => { l.$$.dirty[0] & /*uploading*/ 268435456 && L && I(), l.$$.dirty[0] & /*dragging*/ 536870912 && $("drag", oe), l.$$.dirty[0] & /*active_source, sources*/ 17 && !F && f && t(0, F = f[0]); }, [ F, s, r, a, f, u, c, _, d, h, m, w, b, p, g, v, E, y, C, k, A, S, T, R, U, Z, Q, J, L, oe, K, D, W, $, ge, I, n, Xe, M, H, G, q, ue, Ye, Qe, ke, be, Ne, Ue, bt, ti, ni, i ]; } class km extends sm { constructor(e) { super(), cm( this, e, vm, pm, dm, { value: 1, label: 2, show_label: 3, sources: 4, selectable: 5, root: 6, interactive: 7, i18n: 8, showShareButton: 9, showDownloadButton: 10, showClearButton: 11, boxesAlpha: 12, labelList: 13, labelColors: 14, boxMinSize: 15, handleSize: 16, height: 17, width: 18, boxThickness: 19, disableEditBoxes: 20, singleBox: 21, showRemoveButton: 22, handlesCursor: 23, boxSelectedThickness: 24, max_file_size: 25, cli_upload: 26, stream_handler: 27, active_source: 0 }, null, [-1, -1] ); } } const { SvelteComponent: ym, attr: Ll, detach: ur, element: cr, init: Cm, insert: _r, noop: $s, safe_not_equal: Sm, src_url_equal: ea, toggle_class: St } = window.__gradio__svelte__internal; function ta(l) { let e, t; return { c() { e = cr("img"), ea(e.src, t = /*value*/ l[0].url) || Ll(e, "src", t), Ll(e, "alt", ""); }, m(n, i) { _r(n, e, i); }, p(n, i) { i & /*value*/ 1 && !ea(e.src, t = /*value*/ n[0].url) && Ll(e, "src", t); }, d(n) { n && ur(e); } }; } function zm(l) { let e, t = ( /*value*/ l[0] && ta(l) ); return { c() { e = cr("div"), t && t.c(), Ll(e, "class", "container svelte-1sgcyba"), St( e, "table", /*type*/ l[1] === "table" ), St( e, "gallery", /*type*/ l[1] === "gallery" ), St( e, "selected", /*selected*/ l[2] ), St( e, "border", /*value*/ l[0] ); }, m(n, i) { _r(n, e, i), t && t.m(e, null); }, p(n, [i]) { /*value*/ n[0] ? t ? t.p(n, i) : (t = ta(n), t.c(), t.m(e, null)) : t && (t.d(1), t = null), i & /*type*/ 2 && St( e, "table", /*type*/ n[1] === "table" ), i & /*type*/ 2 && St( e, "gallery", /*type*/ n[1] === "gallery" ), i & /*selected*/ 4 && St( e, "selected", /*selected*/ n[2] ), i & /*value*/ 1 && St( e, "border", /*value*/ n[0] ); }, i: $s, o: $s, d(n) { n && ur(e), t && t.d(); } }; } function Bm(l, e, t) { let { value: n } = e, { type: i } = e, { selected: o = !1 } = e; return l.$$set = (s) => { "value" in s && t(0, n = s.value), "type" in s && t(1, i = s.type), "selected" in s && t(2, o = s.selected); }, [n, i, o]; } class Jm extends ym { constructor(e) { super(), Cm(this, e, Bm, zm, Sm, { value: 0, type: 1, selected: 2 }); } } const { SvelteComponent: qm, add_flush_callback: na, assign: Em, bind: la, binding_callbacks: ia, check_outros: Mm, create_component: xt, destroy_component: $t, detach: dr, empty: Am, flush: V, get_spread_object: Lm, get_spread_update: Dm, group_outros: Rm, init: Tm, insert: hr, mount_component: en, safe_not_equal: Im, space: jm, transition_in: mt, transition_out: gt } = window.__gradio__svelte__internal; function Hm(l) { let e, t; return e = new su({ props: { unpadded_box: !0, size: "large", $$slots: { default: [Ym] }, $$scope: { ctx: l } } }), { c() { xt(e.$$.fragment); }, m(n, i) { en(e, n, i), t = !0; }, p(n, i) { const o = {}; i[1] & /*$$scope*/ 4096 && (o.$$scope = { dirty: i, ctx: n }), e.$set(o); }, i(n) { t || (mt(e.$$.fragment, n), t = !0); }, o(n) { gt(e.$$.fragment, n), t = !1; }, d(n) { $t(e, n); } }; } function Fm(l) { let e, t; return e = new wa({ props: { i18n: ( /*gradio*/ l[30].i18n ), type: "clipboard", mode: "short" } }), { c() { xt(e.$$.fragment); }, m(n, i) { en(e, n, i), t = !0; }, p(n, i) { const o = {}; i[0] & /*gradio*/ 1073741824 && (o.i18n = /*gradio*/ n[30].i18n), e.$set(o); }, i(n) { t || (mt(e.$$.fragment, n), t = !0); }, o(n) { gt(e.$$.fragment, n), t = !1; }, d(n) { $t(e, n); } }; } function Xm(l) { let e, t; return e = new wa({ props: { i18n: ( /*gradio*/ l[30].i18n ), type: "image" } }), { c() { xt(e.$$.fragment); }, m(n, i) { en(e, n, i), t = !0; }, p(n, i) { const o = {}; i[0] & /*gradio*/ 1073741824 && (o.i18n = /*gradio*/ n[30].i18n), e.$set(o); }, i(n) { t || (mt(e.$$.fragment, n), t = !0); }, o(n) { gt(e.$$.fragment, n), t = !1; }, d(n) { $t(e, n); } }; } function Ym(l) { let e, t; return e = new ca({}), { c() { xt(e.$$.fragment); }, m(n, i) { en(e, n, i), t = !0; }, i(n) { t || (mt(e.$$.fragment, n), t = !0); }, o(n) { gt(e.$$.fragment, n), t = !1; }, d(n) { $t(e, n); } }; } function Nm(l) { let e, t, n, i; const o = [Xm, Fm, Hm], s = []; function r(a, f) { return ( /*active_source*/ a[32] === "upload" ? 0 : ( /*active_source*/ a[32] === "clipboard" ? 1 : 2 ) ); } return e = r(l), t = s[e] = o[e](l), { c() { t.c(), n = Am(); }, m(a, f) { s[e].m(a, f), hr(a, n, f), i = !0; }, p(a, f) { let u = e; e = r(a), e === u ? s[e].p(a, f) : (Rm(), gt(s[u], 1, 1, () => { s[u] = null; }), Mm(), t = s[e], t ? t.p(a, f) : (t = s[e] = o[e](a), t.c()), mt(t, 1), t.m(n.parentNode, n)); }, i(a) { i || (mt(t), i = !0); }, o(a) { gt(t), i = !1; }, d(a) { a && dr(n), s[e].d(a); } }; } function Um(l) { let e, t, n, i, o, s; const r = [ { autoscroll: ( /*gradio*/ l[30].autoscroll ) }, { i18n: ( /*gradio*/ l[30].i18n ) }, /*loading_status*/ l[1] ]; let a = {}; for (let _ = 0; _ < r.length; _ += 1) a = Em(a, r[_]); e = new x_({ props: a }); function f(_) { l[33](_); } function u(_) { l[34](_); } let c = { selectable: ( /*_selectable*/ l[10] ), root: ( /*root*/ l[7] ), sources: ( /*sources*/ l[14] ), interactive: ( /*interactive*/ l[18] ), showDownloadButton: ( /*show_download_button*/ l[15] ), showShareButton: ( /*show_share_button*/ l[16] ), showClearButton: ( /*show_clear_button*/ l[17] ), i18n: ( /*gradio*/ l[30].i18n ), boxesAlpha: ( /*boxes_alpha*/ l[19] ), height: ( /*height*/ l[8] ), width: ( /*width*/ l[9] ), labelList: ( /*label_list*/ l[20] ), labelColors: ( /*label_colors*/ l[21] ), boxMinSize: ( /*box_min_size*/ l[22] ), label: ( /*label*/ l[5] ), show_label: ( /*show_label*/ l[6] ), max_file_size: ( /*gradio*/ l[30].max_file_size ), cli_upload: ( /*gradio*/ l[30].client.upload ), stream_handler: ( /*gradio*/ l[30].client.stream ), handleSize: ( /*handle_size*/ l[23] ), boxThickness: ( /*box_thickness*/ l[24] ), boxSelectedThickness: ( /*box_selected_thickness*/ l[25] ), disableEditBoxes: ( /*disable_edit_boxes*/ l[26] ), singleBox: ( /*single_box*/ l[27] ), showRemoveButton: ( /*show_remove_button*/ l[28] ), handlesCursor: ( /*handles_cursor*/ l[29] ), $$slots: { default: [Nm] }, $$scope: { ctx: l } }; return ( /*active_source*/ l[32] !== void 0 && (c.active_source = /*active_source*/ l[32]), /*value*/ l[0] !== void 0 && (c.value = /*value*/ l[0]), n = new km({ props: c }), ia.push(() => la(n, "active_source", f)), ia.push(() => la(n, "value", u)), n.$on( "change", /*change_handler*/ l[35] ), n.$on( "edit", /*edit_handler*/ l[36] ), n.$on( "clear", /*clear_handler*/ l[37] ), n.$on( "drag", /*drag_handler*/ l[38] ), n.$on( "upload", /*upload_handler*/ l[39] ), n.$on( "select", /*select_handler*/ l[40] ), n.$on( "share", /*share_handler*/ l[41] ), n.$on( "error", /*error_handler*/ l[42] ), { c() { xt(e.$$.fragment), t = jm(), xt(n.$$.fragment); }, m(_, d) { en(e, _, d), hr(_, t, d), en(n, _, d), s = !0; }, p(_, d) { const h = d[0] & /*gradio, loading_status*/ 1073741826 ? Dm(r, [ d[0] & /*gradio*/ 1073741824 && { autoscroll: ( /*gradio*/ _[30].autoscroll ) }, d[0] & /*gradio*/ 1073741824 && { i18n: ( /*gradio*/ _[30].i18n ) }, d[0] & /*loading_status*/ 2 && Lm( /*loading_status*/ _[1] ) ]) : {}; e.$set(h); const m = {}; d[0] & /*_selectable*/ 1024 && (m.selectable = /*_selectable*/ _[10]), d[0] & /*root*/ 128 && (m.root = /*root*/ _[7]), d[0] & /*sources*/ 16384 && (m.sources = /*sources*/ _[14]), d[0] & /*interactive*/ 262144 && (m.interactive = /*interactive*/ _[18]), d[0] & /*show_download_button*/ 32768 && (m.showDownloadButton = /*show_download_button*/ _[15]), d[0] & /*show_share_button*/ 65536 && (m.showShareButton = /*show_share_button*/ _[16]), d[0] & /*show_clear_button*/ 131072 && (m.showClearButton = /*show_clear_button*/ _[17]), d[0] & /*gradio*/ 1073741824 && (m.i18n = /*gradio*/ _[30].i18n), d[0] & /*boxes_alpha*/ 524288 && (m.boxesAlpha = /*boxes_alpha*/ _[19]), d[0] & /*height*/ 256 && (m.height = /*height*/ _[8]), d[0] & /*width*/ 512 && (m.width = /*width*/ _[9]), d[0] & /*label_list*/ 1048576 && (m.labelList = /*label_list*/ _[20]), d[0] & /*label_colors*/ 2097152 && (m.labelColors = /*label_colors*/ _[21]), d[0] & /*box_min_size*/ 4194304 && (m.boxMinSize = /*box_min_size*/ _[22]), d[0] & /*label*/ 32 && (m.label = /*label*/ _[5]), d[0] & /*show_label*/ 64 && (m.show_label = /*show_label*/ _[6]), d[0] & /*gradio*/ 1073741824 && (m.max_file_size = /*gradio*/ _[30].max_file_size), d[0] & /*gradio*/ 1073741824 && (m.cli_upload = /*gradio*/ _[30].client.upload), d[0] & /*gradio*/ 1073741824 && (m.stream_handler = /*gradio*/ _[30].client.stream), d[0] & /*handle_size*/ 8388608 && (m.handleSize = /*handle_size*/ _[23]), d[0] & /*box_thickness*/ 16777216 && (m.boxThickness = /*box_thickness*/ _[24]), d[0] & /*box_selected_thickness*/ 33554432 && (m.boxSelectedThickness = /*box_selected_thickness*/ _[25]), d[0] & /*disable_edit_boxes*/ 67108864 && (m.disableEditBoxes = /*disable_edit_boxes*/ _[26]), d[0] & /*single_box*/ 134217728 && (m.singleBox = /*single_box*/ _[27]), d[0] & /*show_remove_button*/ 268435456 && (m.showRemoveButton = /*show_remove_button*/ _[28]), d[0] & /*handles_cursor*/ 536870912 && (m.handlesCursor = /*handles_cursor*/ _[29]), d[0] & /*gradio*/ 1073741824 | d[1] & /*$$scope, active_source*/ 4098 && (m.$$scope = { dirty: d, ctx: _ }), !i && d[1] & /*active_source*/ 2 && (i = !0, m.active_source = /*active_source*/ _[32], na(() => i = !1)), !o && d[0] & /*value*/ 1 && (o = !0, m.value = /*value*/ _[0], na(() => o = !1)), n.$set(m); }, i(_) { s || (mt(e.$$.fragment, _), mt(n.$$.fragment, _), s = !0); }, o(_) { gt(e.$$.fragment, _), gt(n.$$.fragment, _), s = !1; }, d(_) { _ && dr(t), $t(e, _), $t(n, _); } } ); } function Om(l) { let e, t; return e = new Ar({ props: { visible: ( /*visible*/ l[4] ), variant: "solid", border_mode: ( /*dragging*/ l[31] ? "focus" : "base" ), padding: !1, elem_id: ( /*elem_id*/ l[2] ), elem_classes: ( /*elem_classes*/ l[3] ), width: ( /*width*/ l[9] ), allow_overflow: !1, container: ( /*container*/ l[11] ), scale: ( /*scale*/ l[12] ), min_width: ( /*min_width*/ l[13] ), $$slots: { default: [Um] }, $$scope: { ctx: l } } }), { c() { xt(e.$$.fragment); }, m(n, i) { en(e, n, i), t = !0; }, p(n, i) { const o = {}; i[0] & /*visible*/ 16 && (o.visible = /*visible*/ n[4]), i[1] & /*dragging*/ 1 && (o.border_mode = /*dragging*/ n[31] ? "focus" : "base"), i[0] & /*elem_id*/ 4 && (o.elem_id = /*elem_id*/ n[2]), i[0] & /*elem_classes*/ 8 && (o.elem_classes = /*elem_classes*/ n[3]), i[0] & /*width*/ 512 && (o.width = /*width*/ n[9]), i[0] & /*container*/ 2048 && (o.container = /*container*/ n[11]), i[0] & /*scale*/ 4096 && (o.scale = /*scale*/ n[12]), i[0] & /*min_width*/ 8192 && (o.min_width = /*min_width*/ n[13]), i[0] & /*_selectable, root, sources, interactive, show_download_button, show_share_button, show_clear_button, gradio, boxes_alpha, height, width, label_list, label_colors, box_min_size, label, show_label, handle_size, box_thickness, box_selected_thickness, disable_edit_boxes, single_box, show_remove_button, handles_cursor, value, loading_status*/ 2147469283 | i[1] & /*$$scope, active_source, dragging*/ 4099 && (o.$$scope = { dirty: i, ctx: n }), e.$set(o); }, i(n) { t || (mt(e.$$.fragment, n), t = !0); }, o(n) { gt(e.$$.fragment, n), t = !1; }, d(n) { $t(e, n); } }; } function Wm(l, e, t) { let { elem_id: n = "" } = e, { elem_classes: i = [] } = e, { visible: o = !0 } = e, { value: s = null } = e, { label: r } = e, { show_label: a } = e, { root: f } = e, { height: u } = e, { width: c } = e, { _selectable: _ = !1 } = e, { container: d = !0 } = e, { scale: h = null } = e, { min_width: m = void 0 } = e, { loading_status: w } = e, { sources: b = ["upload", "webcam", "clipboard"] } = e, { show_download_button: p } = e, { show_share_button: g } = e, { show_clear_button: v } = e, { interactive: E } = e, { boxes_alpha: y } = e, { label_list: C } = e, { label_colors: k } = e, { box_min_size: A } = e, { handle_size: S } = e, { box_thickness: T } = e, { box_selected_thickness: R } = e, { disable_edit_boxes: U } = e, { single_box: Z } = e, { show_remove_button: Q } = e, { handles_cursor: J } = e, { gradio: K } = e, L, F = null; function D(q) { F = q, t(32, F); } function W(q) { s = q, t(0, s); } const $ = () => K.dispatch("change"), oe = () => K.dispatch("edit"), ge = () => { K.dispatch("clear"); }, I = ({ detail: q }) => t(31, L = q), Xe = () => K.dispatch("upload"), M = ({ detail: q }) => K.dispatch("select", q), H = ({ detail: q }) => K.dispatch("share", q), G = ({ detail: q }) => { t(1, w = w || {}), t(1, w.status = "error", w), K.dispatch("error", q); }; return l.$$set = (q) => { "elem_id" in q && t(2, n = q.elem_id), "elem_classes" in q && t(3, i = q.elem_classes), "visible" in q && t(4, o = q.visible), "value" in q && t(0, s = q.value), "label" in q && t(5, r = q.label), "show_label" in q && t(6, a = q.show_label), "root" in q && t(7, f = q.root), "height" in q && t(8, u = q.height), "width" in q && t(9, c = q.width), "_selectable" in q && t(10, _ = q._selectable), "container" in q && t(11, d = q.container), "scale" in q && t(12, h = q.scale), "min_width" in q && t(13, m = q.min_width), "loading_status" in q && t(1, w = q.loading_status), "sources" in q && t(14, b = q.sources), "show_download_button" in q && t(15, p = q.show_download_button), "show_share_button" in q && t(16, g = q.show_share_button), "show_clear_button" in q && t(17, v = q.show_clear_button), "interactive" in q && t(18, E = q.interactive), "boxes_alpha" in q && t(19, y = q.boxes_alpha), "label_list" in q && t(20, C = q.label_list), "label_colors" in q && t(21, k = q.label_colors), "box_min_size" in q && t(22, A = q.box_min_size), "handle_size" in q && t(23, S = q.handle_size), "box_thickness" in q && t(24, T = q.box_thickness), "box_selected_thickness" in q && t(25, R = q.box_selected_thickness), "disable_edit_boxes" in q && t(26, U = q.disable_edit_boxes), "single_box" in q && t(27, Z = q.single_box), "show_remove_button" in q && t(28, Q = q.show_remove_button), "handles_cursor" in q && t(29, J = q.handles_cursor), "gradio" in q && t(30, K = q.gradio); }, [ s, w, n, i, o, r, a, f, u, c, _, d, h, m, b, p, g, v, E, y, C, k, A, S, T, R, U, Z, Q, J, K, L, F, D, W, $, oe, ge, I, Xe, M, H, G ]; } class Qm extends qm { constructor(e) { super(), Tm( this, e, Wm, Om, Im, { elem_id: 2, elem_classes: 3, visible: 4, value: 0, label: 5, show_label: 6, root: 7, height: 8, width: 9, _selectable: 10, container: 11, scale: 12, min_width: 13, loading_status: 1, sources: 14, show_download_button: 15, show_share_button: 16, show_clear_button: 17, interactive: 18, boxes_alpha: 19, label_list: 20, label_colors: 21, box_min_size: 22, handle_size: 23, box_thickness: 24, box_selected_thickness: 25, disable_edit_boxes: 26, single_box: 27, show_remove_button: 28, handles_cursor: 29, gradio: 30 }, null, [-1, -1] ); } get elem_id() { return this.$$.ctx[2]; } set elem_id(e) { this.$$set({ elem_id: e }), V(); } get elem_classes() { return this.$$.ctx[3]; } set elem_classes(e) { this.$$set({ elem_classes: e }), V(); } get visible() { return this.$$.ctx[4]; } set visible(e) { this.$$set({ visible: e }), V(); } get value() { return this.$$.ctx[0]; } set value(e) { this.$$set({ value: e }), V(); } get label() { return this.$$.ctx[5]; } set label(e) { this.$$set({ label: e }), V(); } get show_label() { return this.$$.ctx[6]; } set show_label(e) { this.$$set({ show_label: e }), V(); } get root() { return this.$$.ctx[7]; } set root(e) { this.$$set({ root: e }), V(); } get height() { return this.$$.ctx[8]; } set height(e) { this.$$set({ height: e }), V(); } get width() { return this.$$.ctx[9]; } set width(e) { this.$$set({ width: e }), V(); } get _selectable() { return this.$$.ctx[10]; } set _selectable(e) { this.$$set({ _selectable: e }), V(); } get container() { return this.$$.ctx[11]; } set container(e) { this.$$set({ container: e }), V(); } get scale() { return this.$$.ctx[12]; } set scale(e) { this.$$set({ scale: e }), V(); } get min_width() { return this.$$.ctx[13]; } set min_width(e) { this.$$set({ min_width: e }), V(); } get loading_status() { return this.$$.ctx[1]; } set loading_status(e) { this.$$set({ loading_status: e }), V(); } get sources() { return this.$$.ctx[14]; } set sources(e) { this.$$set({ sources: e }), V(); } get show_download_button() { return this.$$.ctx[15]; } set show_download_button(e) { this.$$set({ show_download_button: e }), V(); } get show_share_button() { return this.$$.ctx[16]; } set show_share_button(e) { this.$$set({ show_share_button: e }), V(); } get show_clear_button() { return this.$$.ctx[17]; } set show_clear_button(e) { this.$$set({ show_clear_button: e }), V(); } get interactive() { return this.$$.ctx[18]; } set interactive(e) { this.$$set({ interactive: e }), V(); } get boxes_alpha() { return this.$$.ctx[19]; } set boxes_alpha(e) { this.$$set({ boxes_alpha: e }), V(); } get label_list() { return this.$$.ctx[20]; } set label_list(e) { this.$$set({ label_list: e }), V(); } get label_colors() { return this.$$.ctx[21]; } set label_colors(e) { this.$$set({ label_colors: e }), V(); } get box_min_size() { return this.$$.ctx[22]; } set box_min_size(e) { this.$$set({ box_min_size: e }), V(); } get handle_size() { return this.$$.ctx[23]; } set handle_size(e) { this.$$set({ handle_size: e }), V(); } get box_thickness() { return this.$$.ctx[24]; } set box_thickness(e) { this.$$set({ box_thickness: e }), V(); } get box_selected_thickness() { return this.$$.ctx[25]; } set box_selected_thickness(e) { this.$$set({ box_selected_thickness: e }), V(); } get disable_edit_boxes() { return this.$$.ctx[26]; } set disable_edit_boxes(e) { this.$$set({ disable_edit_boxes: e }), V(); } get single_box() { return this.$$.ctx[27]; } set single_box(e) { this.$$set({ single_box: e }), V(); } get show_remove_button() { return this.$$.ctx[28]; } set show_remove_button(e) { this.$$set({ show_remove_button: e }), V(); } get handles_cursor() { return this.$$.ctx[29]; } set handles_cursor(e) { this.$$set({ handles_cursor: e }), V(); } get gradio() { return this.$$.ctx[30]; } set gradio(e) { this.$$set({ gradio: e }), V(); } } export { Jm as BaseExample, Qm as default };