var Ci = Object.defineProperty; var cr = (e) => { throw TypeError(e); }; var Oi = (e, t, n) => t in e ? Ci(e, t, { enumerable: !0, configurable: !0, writable: !0, value: n }) : e[t] = n; var O = (e, t, n) => Oi(e, typeof t != "symbol" ? t + "" : t, n), wn = (e, t, n) => t.has(e) || cr("Cannot " + n); var u = (e, t, n) => (wn(e, t, "read from private field"), n ? n.call(e) : t.get(e)), S = (e, t, n) => t.has(e) ? cr("Cannot add the same private member more than once") : t instanceof WeakSet ? t.add(e) : t.set(e, n), b = (e, t, n, r) => (wn(e, t, "write to private field"), r ? r.call(e, n) : t.set(e, n), n), M = (e, t, n) => (wn(e, t, "access private method"), n); const Mi = "5"; var Tr; typeof window < "u" && ((Tr = window.__svelte ?? (window.__svelte = {})).v ?? (Tr.v = /* @__PURE__ */ new Set())).add(Mi); let Nt = !1, Di = !1; function Li() { Nt = !0; } Li(); const Pi = 1, Ii = 2, Fi = 16, ji = 2, qi = 8, zi = 1, Hi = 2, Kn = "[", an = "[!", dr = "[?", Gn = "]", $t = {}, j = Symbol(), Nr = "http://www.w3.org/1999/xhtml", xn = !1; var Rr = Array.isArray, Bi = Array.prototype.indexOf, Et = Array.prototype.includes, un = Array.from, rn = Object.keys, sn = Object.defineProperty, rt = Object.getOwnPropertyDescriptor, Vi = Object.getOwnPropertyDescriptors, Ui = Object.prototype, Yi = Array.prototype, Cr = Object.getPrototypeOf, hr = Object.isExtensible; const Ki = () => { }; function Gi(e) { return e(); } function Sn(e) { for (var t = 0; t < e.length; t++) e[t](); } function Or() { var e, t, n = new Promise((r, s) => { e = r, t = s; }); return { promise: n, resolve: e, reject: t }; } const z = 2, qt = 4, zt = 8, Mr = 1 << 24, Pe = 16, me = 32, Ge = 64, Tn = 128, se = 512, I = 1024, H = 2048, pe = 4096, Q = 8192, Me = 16384, Ye = 32768, xt = 65536, vr = 1 << 17, Dr = 1 << 18, ut = 1 << 19, Lr = 1 << 20, qe = 1 << 25, ot = 65536, kn = 1 << 21, Wn = 1 << 22, He = 1 << 23, it = Symbol("$state"), Pr = Symbol("legacy props"), Wi = Symbol(""), We = new class extends Error { constructor() { super(...arguments); O(this, "name", "StaleReactionError"); O(this, "message", "The reaction that called `getAbortSignal()` was re-run or destroyed"); } }(); var kr; const Ji = ( // We gotta write it like this because after downleveling the pure comment may end up in the wrong location !!((kr = globalThis.document) != null && kr.contentType) && /* @__PURE__ */ globalThis.document.contentType.includes("xml") ), cn = 3, Ht = 8; function Xi(e) { throw new Error("https://svelte.dev/e/lifecycle_outside_component"); } function Zi() { throw new Error("https://svelte.dev/e/async_derived_orphan"); } function Qi(e, t, n) { throw new Error("https://svelte.dev/e/each_key_duplicate"); } function es(e) { throw new Error("https://svelte.dev/e/effect_in_teardown"); } function ts() { throw new Error("https://svelte.dev/e/effect_in_unowned_derived"); } function ns(e) { throw new Error("https://svelte.dev/e/effect_orphan"); } function rs() { throw new Error("https://svelte.dev/e/effect_update_depth_exceeded"); } function is() { throw new Error("https://svelte.dev/e/hydration_failed"); } function ss(e) { throw new Error("https://svelte.dev/e/props_invalid_value"); } function ls() { throw new Error("https://svelte.dev/e/state_descriptors_fixed"); } function fs() { throw new Error("https://svelte.dev/e/state_prototype_fixed"); } function os() { throw new Error("https://svelte.dev/e/state_unsafe_mutation"); } function as() { throw new Error("https://svelte.dev/e/svelte_boundary_reset_onerror"); } function dn(e) { console.warn("https://svelte.dev/e/hydration_mismatch"); } function us() { console.warn("https://svelte.dev/e/svelte_boundary_reset_noop"); } let N = !1; function Ce(e) { N = e; } let k; function ee(e) { if (e === null) throw dn(), $t; return k = e; } function Bt() { return ee(/* @__PURE__ */ Se(k)); } function ce(e) { if (N) { if (/* @__PURE__ */ Se(k) !== null) throw dn(), $t; k = e; } } function Jn(e = 1) { if (N) { for (var t = e, n = k; t--; ) n = /** @type {TemplateNode} */ /* @__PURE__ */ Se(n); k = n; } } function ln(e = !0) { for (var t = 0, n = k; ; ) { if (n.nodeType === Ht) { var r = ( /** @type {Comment} */ n.data ); if (r === Gn) { if (t === 0) return n; t -= 1; } else (r === Kn || r === an || // "[1", "[2", etc. for if blocks r[0] === "[" && !isNaN(Number(r.slice(1)))) && (t += 1); } var s = ( /** @type {TemplateNode} */ /* @__PURE__ */ Se(n) ); e && n.remove(), n = s; } } function Ir(e) { if (!e || e.nodeType !== Ht) throw dn(), $t; return ( /** @type {Comment} */ e.data ); } function Fr(e) { return e === this.v; } function cs(e, t) { return e != e ? t == t : e !== t || e !== null && typeof e == "object" || typeof e == "function"; } function jr(e) { return !cs(e, this.v); } let L = null; function St(e) { L = e; } function hn(e, t = !1, n) { L = { p: L, i: !1, c: null, e: null, s: e, x: null, l: Nt && !t ? { s: null, u: null, $: [] } : null }; } function vn(e) { var t = ( /** @type {ComponentContext} */ L ), n = t.e; if (n !== null) { t.e = null; for (var r of n) ci(r); } return e !== void 0 && (t.x = e), t.i = !0, L = t.p, e ?? /** @type {T} */ {}; } function Vt() { return !Nt || L !== null && L.l === null; } let Je = []; function qr() { var e = Je; Je = [], Sn(e); } function De(e) { if (Je.length === 0 && !Ot) { var t = Je; queueMicrotask(() => { t === Je && qr(); }); } Je.push(e); } function ds() { for (; Je.length > 0; ) qr(); } function zr(e) { var t = A; if (t === null) return T.f |= He, e; if (!(t.f & Ye) && !(t.f & qt)) throw e; ze(e, t); } function ze(e, t) { for (; t !== null; ) { if (t.f & Tn) { if (!(t.f & Ye)) throw e; try { t.b.error(e); return; } catch (n) { e = n; } } t = t.parent; } throw e; } const hs = -7169; function D(e, t) { e.f = e.f & hs | t; } function Xn(e) { e.f & se || e.deps === null ? D(e, I) : D(e, pe); } function Hr(e) { if (e !== null) for (const t of e) !(t.f & z) || !(t.f & ot) || (t.f ^= ot, Hr( /** @type {Derived} */ t.deps )); } function Br(e, t, n) { e.f & H ? t.add(e) : e.f & pe && n.add(e), Hr(e.deps), D(e, I); } const Gt = /* @__PURE__ */ new Set(); let E = null, An = null, q = null, K = [], _n = null, Nn = !1, Ot = !1; var _t, pt, Ze, gt, Lt, Pt, Qe, Te, mt, te, Rn, Cn, On, Vr; const ur = class ur { constructor() { S(this, te); /** * The current values of any sources that are updated in this batch * They keys of this map are identical to `this.#previous` * @type {Map} */ O(this, "current", /* @__PURE__ */ new Map()); /** * The values of any sources that are updated in this batch _before_ those updates took place. * They keys of this map are identical to `this.#current` * @type {Map} */ O(this, "previous", /* @__PURE__ */ new Map()); /** * When the batch is committed (and the DOM is updated), we need to remove old branches * and append new ones by calling the functions added inside (if/each/key/etc) blocks * @type {Set<() => void>} */ S(this, _t, /* @__PURE__ */ new Set()); /** * If a fork is discarded, we need to destroy any effects that are no longer needed * @type {Set<(batch: Batch) => void>} */ S(this, pt, /* @__PURE__ */ new Set()); /** * The number of async effects that are currently in flight */ S(this, Ze, 0); /** * The number of async effects that are currently in flight, _not_ inside a pending boundary */ S(this, gt, 0); /** * A deferred that resolves when the batch is committed, used with `settled()` * TODO replace with Promise.withResolvers once supported widely enough * @type {{ promise: Promise, resolve: (value?: any) => void, reject: (reason: unknown) => void } | null} */ S(this, Lt, null); /** * Deferred effects (which run after async work has completed) that are DIRTY * @type {Set} */ S(this, Pt, /* @__PURE__ */ new Set()); /** * Deferred effects that are MAYBE_DIRTY * @type {Set} */ S(this, Qe, /* @__PURE__ */ new Set()); /** * A map of branches that still exist, but will be destroyed when this batch * is committed — we skip over these during `process`. * The value contains child effects that were dirty/maybe_dirty before being reset, * so they can be rescheduled if the branch survives. * @type {Map} */ S(this, Te, /* @__PURE__ */ new Map()); O(this, "is_fork", !1); S(this, mt, !1); } /** * Add an effect to the #skipped_branches map and reset its children * @param {Effect} effect */ skip_effect(t) { u(this, Te).has(t) || u(this, Te).set(t, { d: [], m: [] }); } /** * Remove an effect from the #skipped_branches map and reschedule * any tracked dirty/maybe_dirty child effects * @param {Effect} effect */ unskip_effect(t) { var n = u(this, Te).get(t); if (n) { u(this, Te).delete(t); for (var r of n.d) D(r, H), ve(r); for (r of n.m) D(r, pe), ve(r); } } /** * * @param {Effect[]} root_effects */ process(t) { var s; K = [], this.apply(); var n = [], r = []; for (const i of t) M(this, te, Cn).call(this, i, n, r); if (M(this, te, Rn).call(this)) { M(this, te, On).call(this, r), M(this, te, On).call(this, n); for (const [i, l] of u(this, Te)) Gr(i, l); } else { for (const i of u(this, _t)) i(); u(this, _t).clear(), u(this, Ze) === 0 && M(this, te, Vr).call(this), An = this, E = null, _r(r), _r(n), An = null, (s = u(this, Lt)) == null || s.resolve(); } q = null; } /** * Associate a change to a given source with the current * batch, noting its previous and current values * @param {Source} source * @param {any} value */ capture(t, n) { n !== j && !this.previous.has(t) && this.previous.set(t, n), t.f & He || (this.current.set(t, t.v), q == null || q.set(t, t.v)); } activate() { E = this, this.apply(); } deactivate() { E === this && (E = null, q = null); } flush() { if (this.activate(), K.length > 0) { if (Ur(), E !== null && E !== this) return; } else u(this, Ze) === 0 && this.process([]); this.deactivate(); } discard() { for (const t of u(this, pt)) t(this); u(this, pt).clear(); } /** * * @param {boolean} blocking */ increment(t) { b(this, Ze, u(this, Ze) + 1), t && b(this, gt, u(this, gt) + 1); } /** * * @param {boolean} blocking */ decrement(t) { b(this, Ze, u(this, Ze) - 1), t && b(this, gt, u(this, gt) - 1), !u(this, mt) && (b(this, mt, !0), De(() => { b(this, mt, !1), M(this, te, Rn).call(this) ? K.length > 0 && this.flush() : this.revive(); })); } revive() { for (const t of u(this, Pt)) u(this, Qe).delete(t), D(t, H), ve(t); for (const t of u(this, Qe)) D(t, pe), ve(t); this.flush(); } /** @param {() => void} fn */ oncommit(t) { u(this, _t).add(t); } /** @param {(batch: Batch) => void} fn */ ondiscard(t) { u(this, pt).add(t); } settled() { return (u(this, Lt) ?? b(this, Lt, Or())).promise; } static ensure() { if (E === null) { const t = E = new ur(); Gt.add(E), Ot || De(() => { E === t && t.flush(); }); } return E; } apply() { } }; _t = new WeakMap(), pt = new WeakMap(), Ze = new WeakMap(), gt = new WeakMap(), Lt = new WeakMap(), Pt = new WeakMap(), Qe = new WeakMap(), Te = new WeakMap(), mt = new WeakMap(), te = new WeakSet(), Rn = function() { return this.is_fork || u(this, gt) > 0; }, /** * Traverse the effect tree, executing effects or stashing * them for later execution as appropriate * @param {Effect} root * @param {Effect[]} effects * @param {Effect[]} render_effects */ Cn = function(t, n, r) { t.f ^= I; for (var s = t.first; s !== null; ) { var i = s.f, l = (i & (me | Ge)) !== 0, f = l && (i & I) !== 0, o = f || (i & Q) !== 0 || u(this, Te).has(s); if (!o && s.fn !== null) { l ? s.f ^= I : i & qt ? n.push(s) : Ut(s) && (i & Pe && u(this, Qe).add(s), At(s)); var a = s.first; if (a !== null) { s = a; continue; } } for (; s !== null; ) { var c = s.next; if (c !== null) { s = c; break; } s = s.parent; } } }, /** * @param {Effect[]} effects */ On = function(t) { for (var n = 0; n < t.length; n += 1) Br(t[n], u(this, Pt), u(this, Qe)); }, Vr = function() { var s; if (Gt.size > 1) { this.previous.clear(); var t = q, n = !0; for (const i of Gt) { if (i === this) { n = !1; continue; } const l = []; for (const [o, a] of this.current) { if (i.current.has(o)) if (n && a !== i.current.get(o)) i.current.set(o, a); else continue; l.push(o); } if (l.length === 0) continue; const f = [...i.current.keys()].filter((o) => !this.current.has(o)); if (f.length > 0) { var r = K; K = []; const o = /* @__PURE__ */ new Set(), a = /* @__PURE__ */ new Map(); for (const c of l) Yr(c, f, o, a); if (K.length > 0) { E = i, i.apply(); for (const c of K) M(s = i, te, Cn).call(s, c, [], []); i.deactivate(); } K = r; } } E = null, q = t; } Gt.delete(this); }; let Le = ur; function he(e) { var t = Ot; Ot = !0; try { for (var n; ; ) { if (ds(), K.length === 0 && (E == null || E.flush(), K.length === 0)) return _n = null, /** @type {T} */ n; Ur(); } } finally { Ot = t; } } function Ur() { Nn = !0; var e = null; try { for (var t = 0; K.length > 0; ) { var n = Le.ensure(); if (t++ > 1e3) { var r, s; vs(); } n.process(K), Be.clear(); } } finally { K = [], Nn = !1, _n = null; } } function vs() { try { rs(); } catch (e) { ze(e, _n); } } let oe = null; function _r(e) { var t = e.length; if (t !== 0) { for (var n = 0; n < t; ) { var r = e[n++]; if (!(r.f & (Me | Q)) && Ut(r) && (oe = /* @__PURE__ */ new Set(), At(r), r.deps === null && r.first === null && r.nodes === null && r.teardown === null && r.ac === null && vi(r), (oe == null ? void 0 : oe.size) > 0)) { Be.clear(); for (const s of oe) { if (s.f & (Me | Q)) continue; const i = [s]; let l = s.parent; for (; l !== null; ) oe.has(l) && (oe.delete(l), i.push(l)), l = l.parent; for (let f = i.length - 1; f >= 0; f--) { const o = i[f]; o.f & (Me | Q) || At(o); } } oe.clear(); } } oe = null; } } function Yr(e, t, n, r) { if (!n.has(e) && (n.add(e), e.reactions !== null)) for (const s of e.reactions) { const i = s.f; i & z ? Yr( /** @type {Derived} */ s, t, n, r ) : i & (Wn | Pe) && !(i & H) && Kr(s, t, r) && (D(s, H), ve( /** @type {Effect} */ s )); } } function Kr(e, t, n) { const r = n.get(e); if (r !== void 0) return r; if (e.deps !== null) for (const s of e.deps) { if (Et.call(t, s)) return !0; if (s.f & z && Kr( /** @type {Derived} */ s, t, n )) return n.set( /** @type {Derived} */ s, !0 ), !0; } return n.set(e, !1), !1; } function ve(e) { var t = _n = e, n = t.b; if (n != null && n.is_pending && e.f & (qt | zt | Mr) && !(e.f & Ye)) { n.defer_effect(e); return; } for (; t.parent !== null; ) { t = t.parent; var r = t.f; if (Nn && t === A && r & Pe && !(r & Dr) && r & Ye) return; if (r & (Ge | me)) { if (!(r & I)) return; t.f ^= I; } } K.push(t); } function Gr(e, t) { if (!(e.f & me && e.f & I)) { e.f & H ? t.d.push(e) : e.f & pe && t.m.push(e), D(e, I); for (var n = e.first; n !== null; ) Gr(n, t), n = n.next; } } function _s(e) { let t = 0, n = at(0), r; return () => { rr() && (x(n), gn(() => (t === 0 && (r = Ue(() => e(() => Mt(n)))), t += 1, () => { De(() => { t -= 1, t === 0 && (r == null || r(), r = void 0, Mt(n)); }); }))); }; } var ps = xt | ut; function gs(e, t, n, r) { new ms(e, t, n, r); } var J, It, ye, et, Y, $e, X, ae, ke, tt, je, bt, wt, yt, Ae, fn, R, Wr, Jr, Xr, Mn, Zt, Qt, Dn; class ms { /** * @param {TemplateNode} node * @param {BoundaryProps} props * @param {((anchor: Node) => void)} children * @param {((error: unknown) => unknown) | undefined} [transform_error] */ constructor(t, n, r, s) { S(this, R); /** @type {Boundary | null} */ O(this, "parent"); O(this, "is_pending", !1); /** * API-level transformError transform function. Transforms errors before they reach the `failed` snippet. * Inherited from parent boundary, or defaults to identity. * @type {(error: unknown) => unknown} */ O(this, "transform_error"); /** @type {TemplateNode} */ S(this, J); /** @type {TemplateNode | null} */ S(this, It, N ? k : null); /** @type {BoundaryProps} */ S(this, ye); /** @type {((anchor: Node) => void)} */ S(this, et); /** @type {Effect} */ S(this, Y); /** @type {Effect | null} */ S(this, $e, null); /** @type {Effect | null} */ S(this, X, null); /** @type {Effect | null} */ S(this, ae, null); /** @type {DocumentFragment | null} */ S(this, ke, null); S(this, tt, 0); S(this, je, 0); S(this, bt, !1); /** @type {Set} */ S(this, wt, /* @__PURE__ */ new Set()); /** @type {Set} */ S(this, yt, /* @__PURE__ */ new Set()); /** * A source containing the number of pending async deriveds/expressions. * Only created if `$effect.pending()` is used inside the boundary, * otherwise updating the source results in needless `Batch.ensure()` * calls followed by no-op flushes * @type {Source | null} */ S(this, Ae, null); S(this, fn, _s(() => (b(this, Ae, at(u(this, tt))), () => { b(this, Ae, null); }))); var i; b(this, J, t), b(this, ye, n), b(this, et, (l) => { var f = ( /** @type {Effect} */ A ); f.b = this, f.f |= Tn, r(l); }), this.parent = /** @type {Effect} */ A.b, this.transform_error = s ?? ((i = this.parent) == null ? void 0 : i.transform_error) ?? ((l) => l), b(this, Y, ir(() => { if (N) { const l = ( /** @type {Comment} */ u(this, It) ); Bt(); const f = l.data === an; if (l.data.startsWith(dr)) { const a = JSON.parse(l.data.slice(dr.length)); M(this, R, Jr).call(this, a); } else f ? M(this, R, Xr).call(this) : M(this, R, Wr).call(this); } else M(this, R, Mn).call(this); }, ps)), N && b(this, J, k); } /** * Defer an effect inside a pending boundary until the boundary resolves * @param {Effect} effect */ defer_effect(t) { Br(t, u(this, wt), u(this, yt)); } /** * Returns `false` if the effect exists inside a boundary whose pending snippet is shown * @returns {boolean} */ is_rendered() { return !this.is_pending && (!this.parent || this.parent.is_rendered()); } has_pending_snippet() { return !!u(this, ye).pending; } /** * Update the source that powers `$effect.pending()` inside this boundary, * and controls when the current `pending` snippet (if any) is removed. * Do not call from inside the class * @param {1 | -1} d */ update_pending_count(t) { M(this, R, Dn).call(this, t), b(this, tt, u(this, tt) + t), !(!u(this, Ae) || u(this, bt)) && (b(this, bt, !0), De(() => { b(this, bt, !1), u(this, Ae) && Tt(u(this, Ae), u(this, tt)); })); } get_effect_pending() { return u(this, fn).call(this), x( /** @type {Source} */ u(this, Ae) ); } /** @param {unknown} error */ error(t) { var n = u(this, ye).onerror; let r = u(this, ye).failed; if (!n && !r) throw t; u(this, $e) && (U(u(this, $e)), b(this, $e, null)), u(this, X) && (U(u(this, X)), b(this, X, null)), u(this, ae) && (U(u(this, ae)), b(this, ae, null)), N && (ee( /** @type {TemplateNode} */ u(this, It) ), Jn(), ee(ln())); var s = !1, i = !1; const l = () => { if (s) { us(); return; } s = !0, i && as(), u(this, ae) !== null && st(u(this, ae), () => { b(this, ae, null); }), M(this, R, Qt).call(this, () => { Le.ensure(), M(this, R, Mn).call(this); }); }, f = (o) => { try { i = !0, n == null || n(o, l), i = !1; } catch (a) { ze(a, u(this, Y) && u(this, Y).parent); } r && b(this, ae, M(this, R, Qt).call(this, () => { Le.ensure(); try { return ie(() => { var a = ( /** @type {Effect} */ A ); a.b = this, a.f |= Tn, r( u(this, J), () => o, () => l ); }); } catch (a) { return ze( a, /** @type {Effect} */ u(this, Y).parent ), null; } })); }; De(() => { var o; try { o = this.transform_error(t); } catch (a) { ze(a, u(this, Y) && u(this, Y).parent); return; } o !== null && typeof o == "object" && typeof /** @type {any} */ o.then == "function" ? o.then( f, /** @param {unknown} e */ (a) => ze(a, u(this, Y) && u(this, Y).parent) ) : f(o); }); } } J = new WeakMap(), It = new WeakMap(), ye = new WeakMap(), et = new WeakMap(), Y = new WeakMap(), $e = new WeakMap(), X = new WeakMap(), ae = new WeakMap(), ke = new WeakMap(), tt = new WeakMap(), je = new WeakMap(), bt = new WeakMap(), wt = new WeakMap(), yt = new WeakMap(), Ae = new WeakMap(), fn = new WeakMap(), R = new WeakSet(), Wr = function() { try { b(this, $e, ie(() => u(this, et).call(this, u(this, J)))); } catch (t) { this.error(t); } }, /** * @param {unknown} error The deserialized error from the server's hydration comment */ Jr = function(t) { const n = u(this, ye).failed; n && b(this, ae, ie(() => { n( u(this, J), () => t, () => () => { } ); })); }, Xr = function() { const t = u(this, ye).pending; t && (this.is_pending = !0, b(this, X, ie(() => t(u(this, J)))), De(() => { var n = b(this, ke, document.createDocumentFragment()), r = ge(); n.append(r), b(this, $e, M(this, R, Qt).call(this, () => (Le.ensure(), ie(() => u(this, et).call(this, r))))), u(this, je) === 0 && (u(this, J).before(n), b(this, ke, null), st( /** @type {Effect} */ u(this, X), () => { b(this, X, null); } ), M(this, R, Zt).call(this)); })); }, Mn = function() { try { if (this.is_pending = this.has_pending_snippet(), b(this, je, 0), b(this, tt, 0), b(this, $e, ie(() => { u(this, et).call(this, u(this, J)); })), u(this, je) > 0) { var t = b(this, ke, document.createDocumentFragment()); gi(u(this, $e), t); const n = ( /** @type {(anchor: Node) => void} */ u(this, ye).pending ); b(this, X, ie(() => n(u(this, J)))); } else M(this, R, Zt).call(this); } catch (n) { this.error(n); } }, Zt = function() { this.is_pending = !1; for (const t of u(this, wt)) D(t, H), ve(t); for (const t of u(this, yt)) D(t, pe), ve(t); u(this, wt).clear(), u(this, yt).clear(); }, /** * @template T * @param {() => T} fn */ Qt = function(t) { var n = A, r = T, s = L; xe(u(this, Y)), fe(u(this, Y)), St(u(this, Y).ctx); try { return t(); } catch (i) { return zr(i), null; } finally { xe(n), fe(r), St(s); } }, /** * Updates the pending count associated with the currently visible pending snippet, * if any, such that we can replace the snippet with content once work is done * @param {1 | -1} d */ Dn = function(t) { var n; if (!this.has_pending_snippet()) { this.parent && M(n = this.parent, R, Dn).call(n, t); return; } b(this, je, u(this, je) + t), u(this, je) === 0 && (M(this, R, Zt).call(this), u(this, X) && st(u(this, X), () => { b(this, X, null); }), u(this, ke) && (u(this, J).before(u(this, ke)), b(this, ke, null))); }; function bs(e, t, n, r) { const s = Vt() ? Zn : Qn; var i = e.filter((h) => !h.settled); if (n.length === 0 && i.length === 0) { r(t.map(s)); return; } var l = ( /** @type {Effect} */ A ), f = ws(), o = i.length === 1 ? i[0].promise : i.length > 1 ? Promise.all(i.map((h) => h.promise)) : null; function a(h) { f(); try { r(h); } catch (_) { l.f & Me || ze(_, l); } Ln(); } if (n.length === 0) { o.then(() => a(t.map(s))); return; } function c() { f(), Promise.all(n.map((h) => /* @__PURE__ */ $s(h))).then((h) => a([...t.map(s), ...h])).catch((h) => ze(h, l)); } o ? o.then(c) : c(); } function ws() { var e = A, t = T, n = L, r = E; return function(i = !0) { xe(e), fe(t), St(n), i && (r == null || r.activate()); }; } function Ln(e = !0) { xe(null), fe(null), St(null), e && (E == null || E.deactivate()); } function ys() { var e = ( /** @type {Boundary} */ /** @type {Effect} */ A.b ), t = ( /** @type {Batch} */ E ), n = e.is_rendered(); return e.update_pending_count(1), t.increment(n), () => { e.update_pending_count(-1), t.decrement(n); }; } // @__NO_SIDE_EFFECTS__ function Zn(e) { var t = z | H, n = T !== null && T.f & z ? ( /** @type {Derived} */ T ) : null; return A !== null && (A.f |= ut), { ctx: L, deps: null, effects: null, equals: Fr, f: t, fn: e, reactions: null, rv: 0, v: ( /** @type {V} */ j ), wv: 0, parent: n ?? A, ac: null }; } // @__NO_SIDE_EFFECTS__ function $s(e, t, n) { /** @type {Effect | null} */ A === null && Zi(); var s = ( /** @type {Promise} */ /** @type {unknown} */ void 0 ), i = at( /** @type {V} */ j ), l = !T, f = /* @__PURE__ */ new Map(); return Os(() => { var _; var o = Or(); s = o.promise; try { Promise.resolve(e()).then(o.resolve, o.reject).finally(Ln); } catch (g) { o.reject(g), Ln(); } var a = ( /** @type {Batch} */ E ); if (l) { var c = ys(); (_ = f.get(a)) == null || _.reject(We), f.delete(a), f.set(a, o); } const h = (g, d = void 0) => { if (a.activate(), d) d !== We && (i.f |= He, Tt(i, d)); else { i.f & He && (i.f ^= He), Tt(i, g); for (const [v, p] of f) { if (f.delete(v), v === a) break; p.reject(We); } } c && c(); }; o.promise.then(h, (g) => h(null, g || "unknown")); }), ui(() => { for (const o of f.values()) o.reject(We); }), new Promise((o) => { function a(c) { function h() { c === s ? o(i) : a(s); } c.then(h, h); } a(s); }); } // @__NO_SIDE_EFFECTS__ function Qn(e) { const t = /* @__PURE__ */ Zn(e); return t.equals = jr, t; } function Es(e) { var t = e.effects; if (t !== null) { e.effects = null; for (var n = 0; n < t.length; n += 1) U( /** @type {Effect} */ t[n] ); } } function xs(e) { for (var t = e.parent; t !== null; ) { if (!(t.f & z)) return t.f & Me ? null : ( /** @type {Effect} */ t ); t = t.parent; } return null; } function er(e) { var t, n = A; xe(xs(e)); try { e.f &= ~ot, Es(e), t = yi(e); } finally { xe(n); } return t; } function Zr(e) { var t = er(e); if (!e.equals(t) && (e.wv = bi(), (!(E != null && E.is_fork) || e.deps === null) && (e.v = t, e.deps === null))) { D(e, I); return; } Ke || (q !== null ? (rr() || E != null && E.is_fork) && q.set(e, t) : Xn(e)); } function Ss(e) { var t, n; if (e.effects !== null) for (const r of e.effects) (r.teardown || r.ac) && ((t = r.teardown) == null || t.call(r), (n = r.ac) == null || n.abort(We), r.teardown = Ki, r.ac = null, Dt(r, 0), sr(r)); } function Qr(e) { if (e.effects !== null) for (const t of e.effects) t.teardown && At(t); } let Pn = /* @__PURE__ */ new Set(); const Be = /* @__PURE__ */ new Map(); let ei = !1; function at(e, t) { var n = { f: 0, // TODO ideally we could skip this altogether, but it causes type errors v: e, reactions: null, equals: Fr, rv: 0, wv: 0 }; return n; } // @__NO_SIDE_EFFECTS__ function Ie(e, t) { const n = at(e); return Ls(n), n; } // @__NO_SIDE_EFFECTS__ function Ve(e, t = !1, n = !0) { var s; const r = at(e); return t || (r.equals = jr), Nt && n && L !== null && L.l !== null && ((s = L.l).s ?? (s.s = [])).push(r), r; } function V(e, t, n = !1) { T !== null && // since we are untracking the function inside `$inspect.with` we need to add this check // to ensure we error if state is set inside an inspect effect (!_e || T.f & vr) && Vt() && T.f & (z | Pe | Wn | vr) && (le === null || !Et.call(le, e)) && os(); let r = n ? ht(t) : t; return Tt(e, r); } function Tt(e, t) { if (!e.equals(t)) { var n = e.v; Ke ? Be.set(e, t) : Be.set(e, n), e.v = t; var r = Le.ensure(); if (r.capture(e, n), e.f & z) { const s = ( /** @type {Derived} */ e ); e.f & H && er(s), Xn(s); } e.wv = bi(), ti(e, H), Vt() && A !== null && A.f & I && !(A.f & (me | Ge)) && (ne === null ? Ps([e]) : ne.push(e)), !r.is_fork && Pn.size > 0 && !ei && Ts(); } return t; } function Ts() { ei = !1; for (const e of Pn) e.f & I && D(e, pe), Ut(e) && At(e); Pn.clear(); } function Mt(e) { V(e, e.v + 1); } function ti(e, t) { var n = e.reactions; if (n !== null) for (var r = Vt(), s = n.length, i = 0; i < s; i++) { var l = n[i], f = l.f; if (!(!r && l === A)) { var o = (f & H) === 0; if (o && D(l, t), f & z) { var a = ( /** @type {Derived} */ l ); q == null || q.delete(a), f & ot || (f & se && (l.f |= ot), ti(a, pe)); } else o && (f & Pe && oe !== null && oe.add( /** @type {Effect} */ l ), ve( /** @type {Effect} */ l )); } } } function ht(e) { if (typeof e != "object" || e === null || it in e) return e; const t = Cr(e); if (t !== Ui && t !== Yi) return e; var n = /* @__PURE__ */ new Map(), r = Rr(e), s = /* @__PURE__ */ Ie(0), i = lt, l = (f) => { if (lt === i) return f(); var o = T, a = lt; fe(null), br(i); var c = f(); return fe(o), br(a), c; }; return r && n.set("length", /* @__PURE__ */ Ie( /** @type {any[]} */ e.length )), new Proxy( /** @type {any} */ e, { defineProperty(f, o, a) { (!("value" in a) || a.configurable === !1 || a.enumerable === !1 || a.writable === !1) && ls(); var c = n.get(o); return c === void 0 ? l(() => { var h = /* @__PURE__ */ Ie(a.value); return n.set(o, h), h; }) : V(c, a.value, !0), !0; }, deleteProperty(f, o) { var a = n.get(o); if (a === void 0) { if (o in f) { const c = l(() => /* @__PURE__ */ Ie(j)); n.set(o, c), Mt(s); } } else V(a, j), Mt(s); return !0; }, get(f, o, a) { var g; if (o === it) return e; var c = n.get(o), h = o in f; if (c === void 0 && (!h || (g = rt(f, o)) != null && g.writable) && (c = l(() => { var d = ht(h ? f[o] : j), v = /* @__PURE__ */ Ie(d); return v; }), n.set(o, c)), c !== void 0) { var _ = x(c); return _ === j ? void 0 : _; } return Reflect.get(f, o, a); }, getOwnPropertyDescriptor(f, o) { var a = Reflect.getOwnPropertyDescriptor(f, o); if (a && "value" in a) { var c = n.get(o); c && (a.value = x(c)); } else if (a === void 0) { var h = n.get(o), _ = h == null ? void 0 : h.v; if (h !== void 0 && _ !== j) return { enumerable: !0, configurable: !0, value: _, writable: !0 }; } return a; }, has(f, o) { var _; if (o === it) return !0; var a = n.get(o), c = a !== void 0 && a.v !== j || Reflect.has(f, o); if (a !== void 0 || A !== null && (!c || (_ = rt(f, o)) != null && _.writable)) { a === void 0 && (a = l(() => { var g = c ? ht(f[o]) : j, d = /* @__PURE__ */ Ie(g); return d; }), n.set(o, a)); var h = x(a); if (h === j) return !1; } return c; }, set(f, o, a, c) { var m; var h = n.get(o), _ = o in f; if (r && o === "length") for (var g = a; g < /** @type {Source} */ h.v; g += 1) { var d = n.get(g + ""); d !== void 0 ? V(d, j) : g in f && (d = l(() => /* @__PURE__ */ Ie(j)), n.set(g + "", d)); } if (h === void 0) (!_ || (m = rt(f, o)) != null && m.writable) && (h = l(() => /* @__PURE__ */ Ie(void 0)), V(h, ht(a)), n.set(o, h)); else { _ = h.v !== j; var v = l(() => ht(a)); V(h, v); } var p = Reflect.getOwnPropertyDescriptor(f, o); if (p != null && p.set && p.set.call(c, a), !_) { if (r && typeof o == "string") { var y = ( /** @type {Source} */ n.get("length") ), w = Number(o); Number.isInteger(w) && w >= y.v && V(y, w + 1); } Mt(s); } return !0; }, ownKeys(f) { x(s); var o = Reflect.ownKeys(f).filter((h) => { var _ = n.get(h); return _ === void 0 || _.v !== j; }); for (var [a, c] of n) c.v !== j && !(a in f) && o.push(a); return o; }, setPrototypeOf() { fs(); } } ); } var pr, ni, ri, ii; function In() { if (pr === void 0) { pr = window, ni = /Firefox/.test(navigator.userAgent); var e = Element.prototype, t = Node.prototype, n = Text.prototype; ri = rt(t, "firstChild").get, ii = rt(t, "nextSibling").get, hr(e) && (e.__click = void 0, e.__className = void 0, e.__attributes = null, e.__style = void 0, e.__e = void 0), hr(n) && (n.__t = void 0); } } function ge(e = "") { return document.createTextNode(e); } // @__NO_SIDE_EFFECTS__ function kt(e) { return ( /** @type {TemplateNode | null} */ ri.call(e) ); } // @__NO_SIDE_EFFECTS__ function Se(e) { return ( /** @type {TemplateNode | null} */ ii.call(e) ); } function de(e, t) { if (!N) return /* @__PURE__ */ kt(e); var n = /* @__PURE__ */ kt(k); if (n === null) n = k.appendChild(ge()); else if (t && n.nodeType !== cn) { var r = ge(); return n == null || n.before(r), ee(r), r; } return t && nr( /** @type {Text} */ n ), ee(n), n; } function si(e, t = !1) { if (!N) { var n = /* @__PURE__ */ kt(e); return n instanceof Comment && n.data === "" ? /* @__PURE__ */ Se(n) : n; } if (t) { if ((k == null ? void 0 : k.nodeType) !== cn) { var r = ge(); return k == null || k.before(r), ee(r), r; } nr( /** @type {Text} */ k ); } return k; } function en(e, t = 1, n = !1) { let r = N ? k : e; for (var s; t--; ) s = r, r = /** @type {TemplateNode} */ /* @__PURE__ */ Se(r); if (!N) return r; if (n) { if ((r == null ? void 0 : r.nodeType) !== cn) { var i = ge(); return r === null ? s == null || s.after(i) : r.before(i), ee(i), i; } nr( /** @type {Text} */ r ); } return ee(r), r; } function li(e) { e.textContent = ""; } function fi() { return !1; } function tr(e, t, n) { return ( /** @type {T extends keyof HTMLElementTagNameMap ? HTMLElementTagNameMap[T] : Element} */ document.createElementNS(Nr, e, void 0) ); } function nr(e) { if ( /** @type {string} */ e.nodeValue.length < 65536 ) return; let t = e.nextSibling; for (; t !== null && t.nodeType === cn; ) t.remove(), e.nodeValue += /** @type {string} */ t.nodeValue, t = e.nextSibling; } let gr = !1; function oi() { gr || (gr = !0, document.addEventListener( "reset", (e) => { Promise.resolve().then(() => { var t; if (!e.defaultPrevented) for ( const n of /**@type {HTMLFormElement} */ e.target.elements ) (t = n.__on_r) == null || t.call(n); }); }, // In the capture phase to guarantee we get noticed of it (no possibility of stopPropagation) { capture: !0 } )); } function pn(e) { var t = T, n = A; fe(null), xe(null); try { return e(); } finally { fe(t), xe(n); } } function ks(e, t, n, r = n) { e.addEventListener(t, () => pn(n)); const s = e.__on_r; s ? e.__on_r = () => { s(), r(!0); } : e.__on_r = () => r(!0), oi(); } function ai(e) { A === null && (T === null && ns(), ts()), Ke && es(); } function As(e, t) { var n = t.last; n === null ? t.last = t.first = e : (n.next = e, e.prev = n, t.last = e); } function be(e, t, n) { var r = A; r !== null && r.f & Q && (e |= Q); var s = { ctx: L, deps: null, nodes: null, f: e | H | se, first: null, fn: t, last: null, next: null, parent: r, b: r && r.b, prev: null, teardown: null, wv: 0, ac: null }; if (n) try { At(s); } catch (f) { throw U(s), f; } else t !== null && ve(s); var i = s; if (n && i.deps === null && i.teardown === null && i.nodes === null && i.first === i.last && // either `null`, or a singular child !(i.f & ut) && (i = i.first, e & Pe && e & xt && i !== null && (i.f |= xt)), i !== null && (i.parent = r, r !== null && As(i, r), T !== null && T.f & z && !(e & Ge))) { var l = ( /** @type {Derived} */ T ); (l.effects ?? (l.effects = [])).push(i); } return s; } function rr() { return T !== null && !_e; } function ui(e) { const t = be(zt, null, !1); return D(t, I), t.teardown = e, t; } function Fn(e) { ai(); var t = ( /** @type {Effect} */ A.f ), n = !T && (t & me) !== 0 && (t & Ye) === 0; if (n) { var r = ( /** @type {ComponentContext} */ L ); (r.e ?? (r.e = [])).push(e); } else return ci(e); } function ci(e) { return be(qt | Lr, e, !1); } function Ns(e) { return ai(), be(zt | Lr, e, !0); } function Rs(e) { Le.ensure(); const t = be(Ge | ut, e, !0); return () => { U(t); }; } function Cs(e) { Le.ensure(); const t = be(Ge | ut, e, !0); return (n = {}) => new Promise((r) => { n.outro ? st(t, () => { U(t), r(void 0); }) : (U(t), r(void 0)); }); } function di(e) { return be(qt, e, !1); } function Os(e) { return be(Wn | ut, e, !0); } function gn(e, t = 0) { return be(zt | t, e, !0); } function jn(e, t = [], n = [], r = []) { bs(r, t, n, (s) => { be(zt, () => e(...s.map(x)), !0); }); } function ir(e, t = 0) { var n = be(Pe | t, e, !0); return n; } function ie(e) { return be(me | ut, e, !0); } function hi(e) { var t = e.teardown; if (t !== null) { const n = Ke, r = T; mr(!0), fe(null); try { t.call(null); } finally { mr(n), fe(r); } } } function sr(e, t = !1) { var n = e.first; for (e.first = e.last = null; n !== null; ) { const s = n.ac; s !== null && pn(() => { s.abort(We); }); var r = n.next; n.f & Ge ? n.parent = null : U(n, t), n = r; } } function Ms(e) { for (var t = e.first; t !== null; ) { var n = t.next; t.f & me || U(t), t = n; } } function U(e, t = !0) { var n = !1; (t || e.f & Dr) && e.nodes !== null && e.nodes.end !== null && (Ds( e.nodes.start, /** @type {TemplateNode} */ e.nodes.end ), n = !0), sr(e, t && !n), Dt(e, 0), D(e, Me); var r = e.nodes && e.nodes.t; if (r !== null) for (const i of r) i.stop(); hi(e); var s = e.parent; s !== null && s.first !== null && vi(e), e.next = e.prev = e.teardown = e.ctx = e.deps = e.fn = e.nodes = e.ac = null; } function Ds(e, t) { for (; e !== null; ) { var n = e === t ? null : /* @__PURE__ */ Se(e); e.remove(), e = n; } } function vi(e) { var t = e.parent, n = e.prev, r = e.next; n !== null && (n.next = r), r !== null && (r.prev = n), t !== null && (t.first === e && (t.first = r), t.last === e && (t.last = n)); } function st(e, t, n = !0) { var r = []; _i(e, r, !0); var s = () => { n && U(e), t && t(); }, i = r.length; if (i > 0) { var l = () => --i || s(); for (var f of r) f.out(l); } else s(); } function _i(e, t, n) { if (!(e.f & Q)) { e.f ^= Q; var r = e.nodes && e.nodes.t; if (r !== null) for (const f of r) (f.is_global || n) && t.push(f); for (var s = e.first; s !== null; ) { var i = s.next, l = (s.f & xt) !== 0 || // If this is a branch effect without a block effect parent, // it means the parent block effect was pruned. In that case, // transparency information was transferred to the branch effect. (s.f & me) !== 0 && (e.f & Pe) !== 0; _i(s, t, l ? n : !1), s = i; } } } function lr(e) { pi(e, !0); } function pi(e, t) { if (e.f & Q) { e.f ^= Q, e.f & I || (D(e, H), ve(e)); for (var n = e.first; n !== null; ) { var r = n.next, s = (n.f & xt) !== 0 || (n.f & me) !== 0; pi(n, s ? t : !1), n = r; } var i = e.nodes && e.nodes.t; if (i !== null) for (const l of i) (l.is_global || t) && l.in(); } } function gi(e, t) { if (e.nodes) for (var n = e.nodes.start, r = e.nodes.end; n !== null; ) { var s = n === r ? null : /* @__PURE__ */ Se(n); t.append(n), n = s; } } let tn = !1, Ke = !1; function mr(e) { Ke = e; } let T = null, _e = !1; function fe(e) { T = e; } let A = null; function xe(e) { A = e; } let le = null; function Ls(e) { T !== null && (le === null ? le = [e] : le.push(e)); } let G = null, W = 0, ne = null; function Ps(e) { ne = e; } let mi = 1, Xe = 0, lt = Xe; function br(e) { lt = e; } function bi() { return ++mi; } function Ut(e) { var t = e.f; if (t & H) return !0; if (t & z && (e.f &= ~ot), t & pe) { for (var n = ( /** @type {Value[]} */ e.deps ), r = n.length, s = 0; s < r; s++) { var i = n[s]; if (Ut( /** @type {Derived} */ i ) && Zr( /** @type {Derived} */ i ), i.wv > e.wv) return !0; } t & se && // During time traveling we don't want to reset the status so that // traversal of the graph in the other batches still happens q === null && D(e, I); } return !1; } function wi(e, t, n = !0) { var r = e.reactions; if (r !== null && !(le !== null && Et.call(le, e))) for (var s = 0; s < r.length; s++) { var i = r[s]; i.f & z ? wi( /** @type {Derived} */ i, t, !1 ) : t === i && (n ? D(i, H) : i.f & I && D(i, pe), ve( /** @type {Effect} */ i )); } } function yi(e) { var v; var t = G, n = W, r = ne, s = T, i = le, l = L, f = _e, o = lt, a = e.f; G = /** @type {null | Value[]} */ null, W = 0, ne = null, T = a & (me | Ge) ? null : e, le = null, St(e.ctx), _e = !1, lt = ++Xe, e.ac !== null && (pn(() => { e.ac.abort(We); }), e.ac = null); try { e.f |= kn; var c = ( /** @type {Function} */ e.fn ), h = c(); e.f |= Ye; var _ = e.deps, g = E == null ? void 0 : E.is_fork; if (G !== null) { var d; if (g || Dt(e, W), _ !== null && W > 0) for (_.length = W + G.length, d = 0; d < G.length; d++) _[W + d] = G[d]; else e.deps = _ = G; if (rr() && e.f & se) for (d = W; d < _.length; d++) ((v = _[d]).reactions ?? (v.reactions = [])).push(e); } else !g && _ !== null && W < _.length && (Dt(e, W), _.length = W); if (Vt() && ne !== null && !_e && _ !== null && !(e.f & (z | pe | H))) for (d = 0; d < /** @type {Source[]} */ ne.length; d++) wi( ne[d], /** @type {Effect} */ e ); if (s !== null && s !== e) { if (Xe++, s.deps !== null) for (let p = 0; p < n; p += 1) s.deps[p].rv = Xe; if (t !== null) for (const p of t) p.rv = Xe; ne !== null && (r === null ? r = ne : r.push(.../** @type {Source[]} */ ne)); } return e.f & He && (e.f ^= He), h; } catch (p) { return zr(p); } finally { e.f ^= kn, G = t, W = n, ne = r, T = s, le = i, St(l), _e = f, lt = o; } } function Is(e, t) { let n = t.reactions; if (n !== null) { var r = Bi.call(n, e); if (r !== -1) { var s = n.length - 1; s === 0 ? n = t.reactions = null : (n[r] = n[s], n.pop()); } } if (n === null && t.f & z && // Destroying a child effect while updating a parent effect can cause a dependency to appear // to be unused, when in fact it is used by the currently-updating parent. Checking `new_deps` // allows us to skip the expensive work of disconnecting and immediately reconnecting it (G === null || !Et.call(G, t))) { var i = ( /** @type {Derived} */ t ); i.f & se && (i.f ^= se, i.f &= ~ot), Xn(i), Ss(i), Dt(i, 0); } } function Dt(e, t) { var n = e.deps; if (n !== null) for (var r = t; r < n.length; r++) Is(e, n[r]); } function At(e) { var t = e.f; if (!(t & Me)) { D(e, I); var n = A, r = tn; A = e, tn = !0; try { t & (Pe | Mr) ? Ms(e) : sr(e), hi(e); var s = yi(e); e.teardown = typeof s == "function" ? s : null, e.wv = mi; var i; xn && Di && e.f & H && e.deps; } finally { tn = r, A = n; } } } async function Fs() { await Promise.resolve(), he(); } function x(e) { var t = e.f, n = (t & z) !== 0; if (T !== null && !_e) { var r = A !== null && (A.f & Me) !== 0; if (!r && (le === null || !Et.call(le, e))) { var s = T.deps; if (T.f & kn) e.rv < Xe && (e.rv = Xe, G === null && s !== null && s[W] === e ? W++ : G === null ? G = [e] : G.push(e)); else { (T.deps ?? (T.deps = [])).push(e); var i = e.reactions; i === null ? e.reactions = [T] : Et.call(i, T) || i.push(T); } } } if (Ke && Be.has(e)) return Be.get(e); if (n) { var l = ( /** @type {Derived} */ e ); if (Ke) { var f = l.v; return (!(l.f & I) && l.reactions !== null || Ei(l)) && (f = er(l)), Be.set(l, f), f; } var o = (l.f & se) === 0 && !_e && T !== null && (tn || (T.f & se) !== 0), a = (l.f & Ye) === 0; Ut(l) && (o && (l.f |= se), Zr(l)), o && !a && (Qr(l), $i(l)); } if (q != null && q.has(e)) return q.get(e); if (e.f & He) throw e.v; return e.v; } function $i(e) { if (e.f |= se, e.deps !== null) for (const t of e.deps) (t.reactions ?? (t.reactions = [])).push(e), t.f & z && !(t.f & se) && (Qr( /** @type {Derived} */ t ), $i( /** @type {Derived} */ t )); } function Ei(e) { if (e.v === j) return !0; if (e.deps === null) return !1; for (const t of e.deps) if (Be.has(t) || t.f & z && Ei( /** @type {Derived} */ t )) return !0; return !1; } function Ue(e) { var t = _e; try { return _e = !0, e(); } finally { _e = t; } } function js(e) { if (!(typeof e != "object" || !e || e instanceof EventTarget)) { if (it in e) qn(e); else if (!Array.isArray(e)) for (let t in e) { const n = e[t]; typeof n == "object" && n && it in n && qn(n); } } } function qn(e, t = /* @__PURE__ */ new Set()) { if (typeof e == "object" && e !== null && // We don't want to traverse DOM elements !(e instanceof EventTarget) && !t.has(e)) { t.add(e), e instanceof Date && e.getTime(); for (let r in e) try { qn(e[r], t); } catch { } const n = Cr(e); if (n !== Object.prototype && n !== Array.prototype && n !== Map.prototype && n !== Set.prototype && n !== Date.prototype) { const r = Vi(n); for (let s in r) { const i = r[s].get; if (i) try { i.call(e); } catch { } } } } } const Wt = Symbol("events"), qs = /* @__PURE__ */ new Set(), wr = /* @__PURE__ */ new Set(); function zs(e, t, n, r = {}) { function s(i) { if (r.capture || zn.call(t, i), !i.cancelBubble) return pn(() => n == null ? void 0 : n.call(this, i)); } return e.startsWith("pointer") || e.startsWith("touch") || e === "wheel" ? De(() => { t.addEventListener(e, s, r); }) : t.addEventListener(e, s, r), s; } function ft(e, t, n, r, s) { var i = { capture: r, passive: s }, l = zs(e, t, n, i); (t === document.body || // @ts-ignore t === window || // @ts-ignore t === document || // Firefox has quirky behavior, it can happen that we still get "canplay" events when the element is already removed t instanceof HTMLMediaElement) && ui(() => { t.removeEventListener(e, l, i); }); } let yr = null; function zn(e) { var p, y; var t = this, n = ( /** @type {Node} */ t.ownerDocument ), r = e.type, s = ((p = e.composedPath) == null ? void 0 : p.call(e)) || [], i = ( /** @type {null | Element} */ s[0] || e.target ); yr = e; var l = 0, f = yr === e && e[Wt]; if (f) { var o = s.indexOf(f); if (o !== -1 && (t === document || t === /** @type {any} */ window)) { e[Wt] = t; return; } var a = s.indexOf(t); if (a === -1) return; o <= a && (l = o); } if (i = /** @type {Element} */ s[l] || e.target, i !== t) { sn(e, "currentTarget", { configurable: !0, get() { return i || n; } }); var c = T, h = A; fe(null), xe(null); try { for (var _, g = []; i !== null; ) { var d = i.assignedSlot || i.parentNode || /** @type {any} */ i.host || null; try { var v = (y = i[Wt]) == null ? void 0 : y[r]; v != null && (!/** @type {any} */ i.disabled || // DOM could've been updated already by the time this is reached, so we check this as well // -> the target could not have been disabled because it emits the event in the first place e.target === i) && v.call(i, e); } catch (w) { _ ? g.push(w) : _ = w; } if (e.cancelBubble || d === t || d === null) break; i = d; } if (_) { for (let w of g) queueMicrotask(() => { throw w; }); throw _; } } finally { e[Wt] = t, delete e.currentTarget, fe(c), xe(h); } } } var Ar; const yn = ( // We gotta write it like this because after downleveling the pure comment may end up in the wrong location ((Ar = globalThis == null ? void 0 : globalThis.window) == null ? void 0 : Ar.trustedTypes) && /* @__PURE__ */ globalThis.window.trustedTypes.createPolicy("svelte-trusted-html", { /** @param {string} html */ createHTML: (e) => e }) ); function Hs(e) { return ( /** @type {string} */ (yn == null ? void 0 : yn.createHTML(e)) ?? e ); } function Bs(e) { var t = tr("template"); return t.innerHTML = Hs(e.replaceAll("", "")), t.content; } function vt(e, t) { var n = ( /** @type {Effect} */ A ); n.nodes === null && (n.nodes = { start: e, end: t, a: null, t: null }); } // @__NO_SIDE_EFFECTS__ function ct(e, t) { var n = (t & zi) !== 0, r = (t & Hi) !== 0, s, i = !e.startsWith(""); return () => { if (N) return vt(k, null), k; s === void 0 && (s = Bs(i ? e : "" + e), n || (s = /** @type {TemplateNode} */ /* @__PURE__ */ kt(s))); var l = ( /** @type {TemplateNode} */ r || ni ? document.importNode(s, !0) : s.cloneNode(!0) ); if (n) { var f = ( /** @type {TemplateNode} */ /* @__PURE__ */ kt(l) ), o = ( /** @type {TemplateNode} */ l.lastChild ); vt(f, o); } else vt(l, l); return l; }; } function Vs() { if (N) return vt(k, null), k; var e = document.createDocumentFragment(), t = document.createComment(""), n = ge(); return e.append(t, n), vt(t, n), e; } function Re(e, t) { if (N) { var n = ( /** @type {Effect & { nodes: EffectNodes }} */ A ); (!(n.f & Ye) || n.nodes.end === null) && (n.nodes.end = k), Bt(); return; } e !== null && e.before( /** @type {Node} */ t ); } const Us = ["touchstart", "touchmove"]; function Ys(e) { return Us.includes(e); } function Hn(e, t) { var n = t == null ? "" : typeof t == "object" ? t + "" : t; n !== (e.__t ?? (e.__t = e.nodeValue)) && (e.__t = n, e.nodeValue = n + ""); } function xi(e, t) { return Si(e, t); } function Ks(e, t) { In(), t.intro = t.intro ?? !1; const n = t.target, r = N, s = k; try { for (var i = /* @__PURE__ */ kt(n); i && (i.nodeType !== Ht || /** @type {Comment} */ i.data !== Kn); ) i = /* @__PURE__ */ Se(i); if (!i) throw $t; Ce(!0), ee( /** @type {Comment} */ i ); const l = Si(e, { ...t, anchor: i }); return Ce(!1), /** @type {Exports} */ l; } catch (l) { if (l instanceof Error && l.message.split(` `).some((f) => f.startsWith("https://svelte.dev/e/"))) throw l; return l !== $t && console.warn("Failed to hydrate: ", l), t.recover === !1 && is(), In(), li(n), Ce(!1), xi(e, t); } finally { Ce(r), ee(s); } } const Jt = /* @__PURE__ */ new Map(); function Si(e, { target: t, anchor: n, props: r = {}, events: s, context: i, intro: l = !0, transformError: f }) { In(); var o = void 0, a = Cs(() => { var c = n ?? t.appendChild(ge()); gs( /** @type {TemplateNode} */ c, { pending: () => { } }, (g) => { hn({}); var d = ( /** @type {ComponentContext} */ L ); if (i && (d.c = i), s && (r.$$events = s), N && vt( /** @type {TemplateNode} */ g, null ), o = e(g, r) || {}, N && (A.nodes.end = k, k === null || k.nodeType !== Ht || /** @type {Comment} */ k.data !== Gn)) throw dn(), $t; vn(); }, f ); var h = /* @__PURE__ */ new Set(), _ = (g) => { for (var d = 0; d < g.length; d++) { var v = g[d]; if (!h.has(v)) { h.add(v); var p = Ys(v); for (const m of [t, document]) { var y = Jt.get(m); y === void 0 && (y = /* @__PURE__ */ new Map(), Jt.set(m, y)); var w = y.get(v); w === void 0 ? (m.addEventListener(v, zn, { passive: p }), y.set(v, 1)) : y.set(v, w + 1); } } } }; return _(un(qs)), wr.add(_), () => { var p; for (var g of h) for (const y of [t, document]) { var d = ( /** @type {Map} */ Jt.get(y) ), v = ( /** @type {number} */ d.get(g) ); --v == 0 ? (y.removeEventListener(g, zn), d.delete(g), d.size === 0 && Jt.delete(y)) : d.set(g, v); } wr.delete(_), c !== n && ((p = c.parentNode) == null || p.removeChild(c)); }; }); return Bn.set(o, a), o; } let Bn = /* @__PURE__ */ new WeakMap(); function Gs(e, t) { const n = Bn.get(e); return n ? (Bn.delete(e), n(t)) : Promise.resolve(); } var ue, Ee, Z, nt, Ft, jt, on; class Ws { /** * @param {TemplateNode} anchor * @param {boolean} transition */ constructor(t, n = !0) { /** @type {TemplateNode} */ O(this, "anchor"); /** @type {Map} */ S(this, ue, /* @__PURE__ */ new Map()); /** * Map of keys to effects that are currently rendered in the DOM. * These effects are visible and actively part of the document tree. * Example: * ``` * {#if condition} * foo * {:else} * bar * {/if} * ``` * Can result in the entries `true->Effect` and `false->Effect` * @type {Map} */ S(this, Ee, /* @__PURE__ */ new Map()); /** * Similar to #onscreen with respect to the keys, but contains branches that are not yet * in the DOM, because their insertion is deferred. * @type {Map} */ S(this, Z, /* @__PURE__ */ new Map()); /** * Keys of effects that are currently outroing * @type {Set} */ S(this, nt, /* @__PURE__ */ new Set()); /** * Whether to pause (i.e. outro) on change, or destroy immediately. * This is necessary for `` */ S(this, Ft, !0); S(this, jt, () => { var t = ( /** @type {Batch} */ E ); if (u(this, ue).has(t)) { var n = ( /** @type {Key} */ u(this, ue).get(t) ), r = u(this, Ee).get(n); if (r) lr(r), u(this, nt).delete(n); else { var s = u(this, Z).get(n); s && (u(this, Ee).set(n, s.effect), u(this, Z).delete(n), s.fragment.lastChild.remove(), this.anchor.before(s.fragment), r = s.effect); } for (const [i, l] of u(this, ue)) { if (u(this, ue).delete(i), i === t) break; const f = u(this, Z).get(l); f && (U(f.effect), u(this, Z).delete(l)); } for (const [i, l] of u(this, Ee)) { if (i === n || u(this, nt).has(i)) continue; const f = () => { if (Array.from(u(this, ue).values()).includes(i)) { var a = document.createDocumentFragment(); gi(l, a), a.append(ge()), u(this, Z).set(i, { effect: l, fragment: a }); } else U(l); u(this, nt).delete(i), u(this, Ee).delete(i); }; u(this, Ft) || !r ? (u(this, nt).add(i), st(l, f, !1)) : f(); } } }); /** * @param {Batch} batch */ S(this, on, (t) => { u(this, ue).delete(t); const n = Array.from(u(this, ue).values()); for (const [r, s] of u(this, Z)) n.includes(r) || (U(s.effect), u(this, Z).delete(r)); }); this.anchor = t, b(this, Ft, n); } /** * * @param {any} key * @param {null | ((target: TemplateNode) => void)} fn */ ensure(t, n) { var r = ( /** @type {Batch} */ E ), s = fi(); if (n && !u(this, Ee).has(t) && !u(this, Z).has(t)) if (s) { var i = document.createDocumentFragment(), l = ge(); i.append(l), u(this, Z).set(t, { effect: ie(() => n(l)), fragment: i }); } else u(this, Ee).set( t, ie(() => n(this.anchor)) ); if (u(this, ue).set(r, t), s) { for (const [f, o] of u(this, Ee)) f === t ? r.unskip_effect(o) : r.skip_effect(o); for (const [f, o] of u(this, Z)) f === t ? r.unskip_effect(o.effect) : r.skip_effect(o.effect); r.oncommit(u(this, jt)), r.ondiscard(u(this, on)); } else N && (this.anchor = k), u(this, jt).call(this); } } ue = new WeakMap(), Ee = new WeakMap(), Z = new WeakMap(), nt = new WeakMap(), Ft = new WeakMap(), jt = new WeakMap(), on = new WeakMap(); function Ti(e) { L === null && Xi(), Nt && L.l !== null ? Js(L).m.push(e) : Fn(() => { const t = Ue(e); if (typeof t == "function") return ( /** @type {() => void} */ t ); }); } function Js(e) { var t = ( /** @type {ComponentContextLegacy} */ e.l ); return t.u ?? (t.u = { a: [], b: [], m: [] }); } function Vn(e, t, n = !1) { N && Bt(); var r = new Ws(e), s = n ? xt : 0; function i(l, f) { if (N) { const c = Ir(e); var o; if (c === Kn ? o = 0 : c === an ? o = !1 : o = parseInt(c.substring(1)), l !== o) { var a = ln(); ee(a), r.anchor = a, Ce(!1), r.ensure(l, f), Ce(!0); return; } } r.ensure(l, f); } ir(() => { var l = !1; t((f, o = 0) => { l = !0, i(o, f); }), l || i(!1, null); }, s); } function Xs(e, t) { return t; } function Zs(e, t, n) { for (var r = [], s = t.length, i, l = t.length, f = 0; f < s; f++) { let h = t[f]; st( h, () => { if (i) { if (i.pending.delete(h), i.done.add(h), i.pending.size === 0) { var _ = ( /** @type {Set} */ e.outrogroups ); Un(un(i.done)), _.delete(i), _.size === 0 && (e.outrogroups = null); } } else l -= 1; }, !1 ); } if (l === 0) { var o = r.length === 0 && n !== null; if (o) { var a = ( /** @type {Element} */ n ), c = ( /** @type {Element} */ a.parentNode ); li(c), c.append(a), e.items.clear(); } Un(t, !o); } else i = { pending: new Set(t), done: /* @__PURE__ */ new Set() }, (e.outrogroups ?? (e.outrogroups = /* @__PURE__ */ new Set())).add(i); } function Un(e, t = !0) { for (var n = 0; n < e.length; n++) U(e[n], t); } var $r; function Qs(e, t, n, r, s, i = null) { var l = e, f = /* @__PURE__ */ new Map(); N && Bt(); var o = null, a = /* @__PURE__ */ Qn(() => { var v = n(); return Rr(v) ? v : v == null ? [] : un(v); }), c, h = !0; function _() { d.fallback = o, el(d, c, l, t, r), o !== null && (c.length === 0 ? o.f & qe ? (o.f ^= qe, Ct(o, null, l)) : lr(o) : st(o, () => { o = null; })); } var g = ir(() => { c = /** @type {V[]} */ x(a); var v = c.length; let p = !1; if (N) { var y = Ir(l) === an; y !== (v === 0) && (l = ln(), ee(l), Ce(!1), p = !0); } for (var w = /* @__PURE__ */ new Set(), m = ( /** @type {Batch} */ E ), P = fi(), C = 0; C < v; C += 1) { N && k.nodeType === Ht && /** @type {Comment} */ k.data === Gn && (l = /** @type {Comment} */ k, p = !0, Ce(!1)); var $ = c[C], F = r($, C), B = h ? null : f.get(F); B ? (B.v && Tt(B.v, $), B.i && Tt(B.i, C), P && m.unskip_effect(B.e)) : (B = tl( f, h ? l : $r ?? ($r = ge()), $, F, C, s, t, n ), h || (B.e.f |= qe), f.set(F, B)), w.add(F); } if (v === 0 && i && !o && (h ? o = ie(() => i(l)) : (o = ie(() => i($r ?? ($r = ge()))), o.f |= qe)), v > w.size && Qi(), N && v > 0 && ee(ln()), !h) if (P) { for (const [we, mn] of f) w.has(we) || m.skip_effect(mn.e); m.oncommit(_), m.ondiscard(() => { }); } else _(); p && Ce(!0), x(a); }), d = { effect: g, items: f, outrogroups: null, fallback: o }; h = !1, N && (l = k); } function Rt(e) { for (; e !== null && !(e.f & me); ) e = e.next; return e; } function el(e, t, n, r, s) { var B; var i = t.length, l = e.items, f = Rt(e.effect.first), o, a = null, c = [], h = [], _, g, d, v; for (v = 0; v < i; v += 1) { if (_ = t[v], g = s(_, v), d = /** @type {EachItem} */ l.get(g).e, e.outrogroups !== null) for (const we of e.outrogroups) we.pending.delete(d), we.done.delete(d); if (d.f & qe) if (d.f ^= qe, d === f) Ct(d, null, n); else { var p = a ? a.next : f; d === e.effect.last && (e.effect.last = d.prev), d.prev && (d.prev.next = d.next), d.next && (d.next.prev = d.prev), Fe(e, a, d), Fe(e, d, p), Ct(d, p, n), a = d, c = [], h = [], f = Rt(a.next); continue; } if (d.f & Q && lr(d), d !== f) { if (o !== void 0 && o.has(d)) { if (c.length < h.length) { var y = h[0], w; a = y.prev; var m = c[0], P = c[c.length - 1]; for (w = 0; w < c.length; w += 1) Ct(c[w], y, n); for (w = 0; w < h.length; w += 1) o.delete(h[w]); Fe(e, m.prev, P.next), Fe(e, a, m), Fe(e, P, y), f = y, a = P, v -= 1, c = [], h = []; } else o.delete(d), Ct(d, f, n), Fe(e, d.prev, d.next), Fe(e, d, a === null ? e.effect.first : a.next), Fe(e, a, d), a = d; continue; } for (c = [], h = []; f !== null && f !== d; ) (o ?? (o = /* @__PURE__ */ new Set())).add(f), h.push(f), f = Rt(f.next); if (f === null) continue; } d.f & qe || c.push(d), a = d, f = Rt(d.next); } if (e.outrogroups !== null) { for (const we of e.outrogroups) we.pending.size === 0 && (Un(un(we.done)), (B = e.outrogroups) == null || B.delete(we)); e.outrogroups.size === 0 && (e.outrogroups = null); } if (f !== null || o !== void 0) { var C = []; if (o !== void 0) for (d of o) d.f & Q || C.push(d); for (; f !== null; ) !(f.f & Q) && f !== e.fallback && C.push(f), f = Rt(f.next); var $ = C.length; if ($ > 0) { var F = null; Zs(e, C, F); } } } function tl(e, t, n, r, s, i, l, f) { var o = l & Pi ? l & Fi ? at(n) : /* @__PURE__ */ Ve(n, !1, !1) : null, a = l & Ii ? at(s) : null; return { v: o, i: a, e: ie(() => (i(t, o ?? n, a ?? s, f), () => { e.delete(r); })) }; } function Ct(e, t, n) { if (e.nodes) for (var r = e.nodes.start, s = e.nodes.end, i = t && !(t.f & qe) ? ( /** @type {EffectNodes} */ t.nodes.start ) : n; r !== null; ) { var l = ( /** @type {TemplateNode} */ /* @__PURE__ */ Se(r) ); if (i.before(r), r === s) return; r = l; } } function Fe(e, t, n) { t === null ? e.effect.first = n : t.next = n, n === null ? e.effect.last = t : n.prev = t; } function nl(e, t, n, r, s) { var f; N && Bt(); var i = (f = t.$$slots) == null ? void 0 : f[n], l = !1; i === !0 && (i = t.children, l = !0), i === void 0 || i(e, l ? () => r : r); } function fr(e, t) { di(() => { var n = e.getRootNode(), r = ( /** @type {ShadowRoot} */ n.host ? ( /** @type {ShadowRoot} */ n ) : ( /** @type {Document} */ n.head ?? /** @type {Document} */ n.ownerDocument.head ) ); if (!r.querySelector("#" + t.hash)) { const s = tr("style"); s.id = t.hash, s.textContent = t.code, r.appendChild(s); } }); } const rl = Symbol("is custom element"), il = Symbol("is html"), sl = Ji ? "link" : "LINK"; function ll(e) { if (N) { var t = !1, n = () => { if (!t) { if (t = !0, e.hasAttribute("value")) { var r = e.value; Er(e, "value", null), e.value = r; } if (e.hasAttribute("checked")) { var s = e.checked; Er(e, "checked", null), e.checked = s; } } }; e.__on_r = n, De(n), oi(); } } function Er(e, t, n, r) { var s = fl(e); N && (s[t] = e.getAttribute(t), t === "src" || t === "srcset" || t === "href" && e.nodeName === sl) || s[t] !== (s[t] = n) && (t === "loading" && (e[Wi] = n), e.removeAttribute(t)); } function fl(e) { return ( /** @type {Record} **/ // @ts-expect-error e.__attributes ?? (e.__attributes = { [rl]: e.nodeName.includes("-"), [il]: e.namespaceURI === Nr }) ); } function ol(e, t, n = t) { var r = /* @__PURE__ */ new WeakSet(); ks(e, "input", async (s) => { var i = s ? e.defaultValue : e.value; if (i = $n(e) ? En(i) : i, n(i), E !== null && r.add(E), await Fs(), i !== (i = t())) { var l = e.selectionStart, f = e.selectionEnd, o = e.value.length; if (e.value = i ?? "", f !== null) { var a = e.value.length; l === f && f === o && a > o ? (e.selectionStart = a, e.selectionEnd = a) : (e.selectionStart = l, e.selectionEnd = Math.min(f, a)); } } }), // If we are hydrating and the value has since changed, // then use the updated value from the input instead. (N && e.defaultValue !== e.value || // If defaultValue is set, then value == defaultValue // TODO Svelte 6: remove input.value check and set to empty string? Ue(t) == null && e.value) && (n($n(e) ? En(e.value) : e.value), E !== null && r.add(E)), gn(() => { var s = t(); if (e === document.activeElement) { var i = ( /** @type {Batch} */ An ?? E ); if (r.has(i)) return; } $n(e) && s === En(e.value) || e.type === "date" && !s && !e.value || s !== e.value && (e.value = s ?? ""); }); } function $n(e) { var t = e.type; return t === "number" || t === "range"; } function En(e) { return e === "" ? null : +e; } function xr(e, t) { return e === t || (e == null ? void 0 : e[it]) === t; } function Yn(e = {}, t, n, r) { return di(() => { var s, i; return gn(() => { s = i, i = [], Ue(() => { e !== n(...i) && (t(e, ...i), s && xr(n(...s), e) && t(null, ...s)); }); }), () => { De(() => { i && xr(n(...i), e) && t(null, ...i); }); }; }), e; } function al(e) { return function(...t) { var n = ( /** @type {Event} */ t[0] ); return n.preventDefault(), e == null ? void 0 : e.apply(this, t); }; } function or(e = !1) { const t = ( /** @type {ComponentContextLegacy} */ L ), n = t.l.u; if (!n) return; let r = () => js(t.s); if (e) { let s = 0, i = ( /** @type {Record} */ {} ); const l = /* @__PURE__ */ Zn(() => { let f = !1; const o = t.s; for (const a in o) o[a] !== i[a] && (i[a] = o[a], f = !0); return f && s++, s; }); r = () => x(l); } n.b.length && Ns(() => { Sr(t, r), Sn(n.b); }), Fn(() => { const s = Ue(() => n.m.map(Gi)); return () => { for (const i of s) typeof i == "function" && i(); }; }), n.a.length && Fn(() => { Sr(t, r), Sn(n.a); }); } function Sr(e, t) { if (e.l.s) for (const n of e.l.s) x(n); t(); } let Xt = !1; function ul(e) { var t = Xt; try { return Xt = !1, [e(), Xt]; } finally { Xt = t; } } function Oe(e, t, n, r) { var w; var s = !Nt || (n & ji) !== 0, i = (n & qi) !== 0, l = ( /** @type {V} */ r ), f = !0, o = () => (f && (f = !1, l = /** @type {V} */ r), l), a; { var c = it in e || Pr in e; a = ((w = rt(e, t)) == null ? void 0 : w.set) ?? (c && t in e ? (m) => e[t] = m : void 0); } var h, _ = !1; [h, _] = ul(() => ( /** @type {V} */ e[t] )), h === void 0 && r !== void 0 && (h = o(), a && (s && ss(), a(h))); var g; if (s ? g = () => { var m = ( /** @type {V} */ e[t] ); return m === void 0 ? o() : (f = !0, m); } : g = () => { var m = ( /** @type {V} */ e[t] ); return m !== void 0 && (l = /** @type {V} */ void 0), m === void 0 ? l : m; }, a) { var d = e.$$legacy; return ( /** @type {() => V} */ function(m, P) { return arguments.length > 0 ? ((!s || !P || d || _) && a(P ? g() : m), m) : g(); } ); } var v = !1, p = /* @__PURE__ */ Qn(() => (v = !1, g())); x(p); var y = ( /** @type {Effect} */ A ); return ( /** @type {() => V} */ function(m, P) { if (arguments.length > 0) { const C = P ? x(p) : s && i ? ht(m) : m; return V(p, C), v = !0, l !== void 0 && (l = C), m; } return Ke && v || y.f & Me ? p.v : x(p); } ); } function cl(e) { return new dl(e); } var Ne, re; class dl { /** * @param {ComponentConstructorOptions & { * component: any; * }} options */ constructor(t) { /** @type {any} */ S(this, Ne); /** @type {Record} */ S(this, re); var i; var n = /* @__PURE__ */ new Map(), r = (l, f) => { var o = /* @__PURE__ */ Ve(f, !1, !1); return n.set(l, o), o; }; const s = new Proxy( { ...t.props || {}, $$events: {} }, { get(l, f) { return x(n.get(f) ?? r(f, Reflect.get(l, f))); }, has(l, f) { return f === Pr ? !0 : (x(n.get(f) ?? r(f, Reflect.get(l, f))), Reflect.has(l, f)); }, set(l, f, o) { return V(n.get(f) ?? r(f, o), o), Reflect.set(l, f, o); } } ); b(this, re, (t.hydrate ? Ks : xi)(t.component, { target: t.target, anchor: t.anchor, props: s, context: t.context, intro: t.intro ?? !1, recover: t.recover, transformError: t.transformError })), (!((i = t == null ? void 0 : t.props) != null && i.$$host) || t.sync === !1) && he(), b(this, Ne, s.$$events); for (const l of Object.keys(u(this, re))) l === "$set" || l === "$destroy" || l === "$on" || sn(this, l, { get() { return u(this, re)[l]; }, /** @param {any} value */ set(f) { u(this, re)[l] = f; }, enumerable: !0 }); u(this, re).$set = /** @param {Record} next */ (l) => { Object.assign(s, l); }, u(this, re).$destroy = () => { Gs(u(this, re)); }; } /** @param {Record} props */ $set(t) { u(this, re).$set(t); } /** * @param {string} event * @param {(...args: any[]) => any} callback * @returns {any} */ $on(t, n) { u(this, Ne)[t] = u(this, Ne)[t] || []; const r = (...s) => n.call(this, ...s); return u(this, Ne)[t].push(r), () => { u(this, Ne)[t] = u(this, Ne)[t].filter( /** @param {any} fn */ (s) => s !== r ); }; } $destroy() { u(this, re).$destroy(); } } Ne = new WeakMap(), re = new WeakMap(); let ki; typeof HTMLElement == "function" && (ki = class extends HTMLElement { /** * @param {*} $$componentCtor * @param {*} $$slots * @param {ShadowRootInit | undefined} shadow_root_init */ constructor(t, n, r) { super(); /** The Svelte component constructor */ O(this, "$$ctor"); /** Slots */ O(this, "$$s"); /** @type {any} The Svelte component instance */ O(this, "$$c"); /** Whether or not the custom element is connected */ O(this, "$$cn", !1); /** @type {Record} Component props data */ O(this, "$$d", {}); /** `true` if currently in the process of reflecting component props back to attributes */ O(this, "$$r", !1); /** @type {Record} Props definition (name, reflected, type etc) */ O(this, "$$p_d", {}); /** @type {Record} Event listeners */ O(this, "$$l", {}); /** @type {Map} Event listener unsubscribe functions */ O(this, "$$l_u", /* @__PURE__ */ new Map()); /** @type {any} The managed render effect for reflecting attributes */ O(this, "$$me"); /** @type {ShadowRoot | null} The ShadowRoot of the custom element */ O(this, "$$shadowRoot", null); this.$$ctor = t, this.$$s = n, r && (this.$$shadowRoot = this.attachShadow(r)); } /** * @param {string} type * @param {EventListenerOrEventListenerObject} listener * @param {boolean | AddEventListenerOptions} [options] */ addEventListener(t, n, r) { if (this.$$l[t] = this.$$l[t] || [], this.$$l[t].push(n), this.$$c) { const s = this.$$c.$on(t, n); this.$$l_u.set(n, s); } super.addEventListener(t, n, r); } /** * @param {string} type * @param {EventListenerOrEventListenerObject} listener * @param {boolean | AddEventListenerOptions} [options] */ removeEventListener(t, n, r) { if (super.removeEventListener(t, n, r), this.$$c) { const s = this.$$l_u.get(n); s && (s(), this.$$l_u.delete(n)); } } async connectedCallback() { if (this.$$cn = !0, !this.$$c) { let n = function(i) { return (l) => { const f = tr("slot"); i !== "default" && (f.name = i), Re(l, f); }; }; var t = n; if (await Promise.resolve(), !this.$$cn || this.$$c) return; const r = {}, s = hl(this); for (const i of this.$$s) i in s && (i === "default" && !this.$$d.children ? (this.$$d.children = n(i), r.default = !0) : r[i] = n(i)); for (const i of this.attributes) { const l = this.$$g_p(i.name); l in this.$$d || (this.$$d[l] = nn(l, i.value, this.$$p_d, "toProp")); } for (const i in this.$$p_d) !(i in this.$$d) && this[i] !== void 0 && (this.$$d[i] = this[i], delete this[i]); this.$$c = cl({ component: this.$$ctor, target: this.$$shadowRoot || this, props: { ...this.$$d, $$slots: r, $$host: this } }), this.$$me = Rs(() => { gn(() => { var i; this.$$r = !0; for (const l of rn(this.$$c)) { if (!((i = this.$$p_d[l]) != null && i.reflect)) continue; this.$$d[l] = this.$$c[l]; const f = nn( l, this.$$d[l], this.$$p_d, "toAttribute" ); f == null ? this.removeAttribute(this.$$p_d[l].attribute || l) : this.setAttribute(this.$$p_d[l].attribute || l, f); } this.$$r = !1; }); }); for (const i in this.$$l) for (const l of this.$$l[i]) { const f = this.$$c.$on(i, l); this.$$l_u.set(l, f); } this.$$l = {}; } } // We don't need this when working within Svelte code, but for compatibility of people using this outside of Svelte // and setting attributes through setAttribute etc, this is helpful /** * @param {string} attr * @param {string} _oldValue * @param {string} newValue */ attributeChangedCallback(t, n, r) { var s; this.$$r || (t = this.$$g_p(t), this.$$d[t] = nn(t, r, this.$$p_d, "toProp"), (s = this.$$c) == null || s.$set({ [t]: this.$$d[t] })); } disconnectedCallback() { this.$$cn = !1, Promise.resolve().then(() => { !this.$$cn && this.$$c && (this.$$c.$destroy(), this.$$me(), this.$$c = void 0); }); } /** * @param {string} attribute_name */ $$g_p(t) { return rn(this.$$p_d).find( (n) => this.$$p_d[n].attribute === t || !this.$$p_d[n].attribute && n.toLowerCase() === t ) || t; } }); function nn(e, t, n, r) { var i; const s = (i = n[e]) == null ? void 0 : i.type; if (t = s === "Boolean" && typeof t != "boolean" ? t != null : t, !r || !n[e]) return t; if (r === "toAttribute") switch (s) { case "Object": case "Array": return t == null ? null : JSON.stringify(t); case "Boolean": return t ? "" : null; case "Number": return t ?? null; default: return t; } else switch (s) { case "Object": case "Array": return t && JSON.parse(t); case "Boolean": return t; case "Number": return t != null ? +t : t; default: return t; } } function hl(e) { const t = {}; return e.childNodes.forEach((n) => { t[ /** @type {Element} node */ n.slot || "default" ] = !0; }), t; } function ar(e, t, n, r, s, i) { let l = class extends ki { constructor() { super(e, n, s), this.$$p_d = t; } static get observedAttributes() { return rn(t).map( (f) => (t[f].attribute || f).toLowerCase() ); } }; return rn(t).forEach((f) => { sn(l.prototype, f, { get() { return this.$$c && f in this.$$c ? this.$$c[f] : this.$$d[f]; }, set(o) { var h; o = nn(f, o, t), this.$$d[f] = o; var a = this.$$c; if (a) { var c = (h = rt(a, f)) == null ? void 0 : h.get; c ? a[f] = o : a.$set({ [f]: o }); } } }); }), r.forEach((f) => { sn(l.prototype, f, { get() { var o; return (o = this.$$c) == null ? void 0 : o[f]; } }); }), e.element = /** @type {any} */ l, l; } var vl = /* @__PURE__ */ ct(''), _l = /* @__PURE__ */ ct(' ', 1); const pl = { hash: "svelte-128flmn", code: ".overlay.svelte-128flmn {position:fixed;inset:0;background:var(--ui-overlay);display:grid;place-items:center;z-index:1000;}.panel.svelte-128flmn {width:min(640px, calc(100vw - 32px));max-height:calc(100vh - 48px);overflow:auto;background:var(--ui-panel);border-radius:var(--ui-radius);box-shadow:var(--ui-shadow);outline:none;}.header.svelte-128flmn {display:flex;align-items:center;justify-content:space-between;padding:14px 16px;border-bottom:1px solid var(--ui-border);}h3.svelte-128flmn {margin:0;font-size:1rem;}.close.svelte-128flmn {border:0;background:transparent;font-size:1.4rem;cursor:pointer;}.body.svelte-128flmn {padding:12px 16px 16px;}" }; function gl(e, t) { hn(t, !1), fr(e, pl); let n = Oe(t, "title", 12, ""), r = Oe(t, "open", 12, !1), s = /* @__PURE__ */ Ve(), i = /* @__PURE__ */ Ve(); function l() { var v, p; r(!1), (v = x(s)) == null || v.removeAttribute("open"), (p = x(s)) == null || p.dispatchEvent(new CustomEvent("ui:close", { bubbles: !0, composed: !0 })); } function f(v) { if (r()) { if (v.key === "Escape") { v.preventDefault(), l(); return; } v.key === "Tab" && o(v); } } function o(v) { var P, C; const p = (P = x(i)) == null ? void 0 : P.querySelectorAll('a[href], button:not([disabled]), textarea, input, select, [tabindex]:not([tabindex="-1"])'); if (!p || p.length === 0) { v.preventDefault(), (C = x(i)) == null || C.focus(); return; } const y = p[0], w = p[p.length - 1], m = document.activeElement; if (v.shiftKey && m === y) { v.preventDefault(), w.focus(); return; } !v.shiftKey && m === w && (v.preventDefault(), y.focus()); } function a(v) { v.target === v.currentTarget && l(); } Ti(() => { const v = x(s).getRootNode().host, p = new MutationObserver(() => { r(v.hasAttribute("open")), r() && setTimeout( () => { var w, m; (m = ((w = x(i)) == null ? void 0 : w.querySelector("[autofocus]")) || x(i)) == null || m.focus(); }, 0 ); }); return p.observe(v, { attributes: !0, attributeFilter: ["open"] }), () => p.disconnect(); }); var c = { get title() { return n(); }, set title(v) { n(v), he(); }, get open() { return r(); }, set open(v) { r(v), he(); } }; or(); var h = _l(), _ = si(h); { var g = (v) => { var p = vl(), y = de(p), w = de(y), m = de(w), P = de(m, !0); ce(m); var C = en(m, 2); ce(w); var $ = en(w, 2), F = de($); nl(F, t, "default", {}), ce($), ce(y), Yn(y, (B) => V(i, B), () => x(i)), ce(p), jn(() => Hn(P, n())), ft("click", C, l), ft("click", p, a), ft("keydown", p, f), Re(v, p); }; Vn(_, (v) => { r() && v(g); }); } var d = en(_, 2); return Yn(d, (v) => V(s, v), () => x(s)), Re(e, h), vn(c); } customElements.define("ui-modal", ar(gl, { title: {}, open: {} }, ["default"], [], { mode: "open" })); var ml = /* @__PURE__ */ ct('
No options
'), bl = /* @__PURE__ */ ct(''), wl = /* @__PURE__ */ ct(''), yl = /* @__PURE__ */ ct(''); const $l = { hash: "svelte-j52qxt", code: ".dropdown.svelte-j52qxt {position:relative;display:inline-block;min-width:180px;}.trigger.svelte-j52qxt {width:100%;display:flex;align-items:center;justify-content:space-between;padding:10px 12px;border:1px solid var(--ui-border);border-radius:8px;background:var(--ui-bg);cursor:pointer;}.menu.svelte-j52qxt {position:absolute;z-index:30;left:0;right:0;margin-top:6px;border:1px solid var(--ui-border);background:var(--ui-bg);border-radius:8px;box-shadow:var(--ui-shadow);overflow:hidden;}.item.svelte-j52qxt {width:100%;text-align:left;border:0;background:transparent;padding:10px 12px;cursor:pointer;}.item.svelte-j52qxt:hover {background:#f3f4f6;}.empty.svelte-j52qxt {padding:10px 12px;color:var(--ui-muted);}" }; function El(e, t) { hn(t, !1), fr(e, $l); let n = Oe(t, "value", 12, ""), r = Oe(t, "name", 12, ""), s = Oe(t, "placeholder", 12, "Select..."), i = Oe(t, "disabled", 12, !1), l = /* @__PURE__ */ Ve(), f, o, a = /* @__PURE__ */ Ve(!1), c = /* @__PURE__ */ Ve([]); function h() { if (V(c, Array.from(f.querySelectorAll("option")).map(($) => { var F; return { value: $.value, label: ((F = $.textContent) == null ? void 0 : F.trim()) || $.value }; })), !n()) { const $ = f.querySelector("option[selected]"); $ && n($.value); } } function _() { var $; return n() && (($ = x(c).find((F) => F.value === n())) == null ? void 0 : $.label) || s(); } function g($) { n($), V(a, !1), d(), f.dispatchEvent(new Event("change", { bubbles: !0 })), f.dispatchEvent(new CustomEvent("ui:change", { detail: { value: n() }, bubbles: !0, composed: !0 })); } function d() { o && (o.name = r(), o.value = n(), o.disabled = i() || !r()); } Ti(() => { if (f = x(l).getRootNode().host, !f) return; o = f.querySelector('input[data-ui-dropdown-hidden="true"]'), o || (o = document.createElement("input"), o.type = "hidden", o.setAttribute("data-ui-dropdown-hidden", "true"), f.appendChild(o)), h(), d(); const $ = new MutationObserver(() => { h(), d(); }); return $.observe(f, { childList: !0, subtree: !0, attributes: !0 }), () => $.disconnect(); }); var v = { get value() { return n(); }, set value($) { n($), he(); }, get name() { return r(); }, set name($) { r($), he(); }, get placeholder() { return s(); }, set placeholder($) { s($), he(); }, get disabled() { return i(); }, set disabled($) { i($), he(); } }; or(); var p = yl(), y = de(p), w = de(y), m = de(w, !0); ce(w), Jn(2), ce(y); var P = en(y, 2); { var C = ($) => { var F = wl(), B = de(F); { var we = (dt) => { var Yt = ml(); Re(dt, Yt); }, mn = (dt) => { var Yt = Vs(), Ai = si(Yt); Qs(Ai, 1, () => x(c), Xs, (Ni, bn) => { var Kt = bl(), Ri = de(Kt, !0); ce(Kt), jn(() => Hn(Ri, (x(bn), Ue(() => x(bn).label)))), ft("click", Kt, () => g(x(bn).value)), Re(Ni, Kt); }), Re(dt, Yt); }; Vn(B, (dt) => { x(c), Ue(() => x(c).length === 0) ? dt(we) : dt(mn, !1); }); } ce(F), Re($, F); }; Vn(P, ($) => { x(a) && $(C); }); } return ce(p), Yn(p, ($) => V(l, $), () => x(l)), jn( ($) => { y.disabled = i(), Hn(m, $); }, [() => Ue(_)] ), ft("click", y, () => V(a, !x(a))), Re(e, p), vn(v); } customElements.define("ui-drop-down", ar(El, { value: {}, name: {}, placeholder: {}, disabled: {} }, [], [], { mode: "open" })); var xl = /* @__PURE__ */ ct('
'); const Sl = { hash: "svelte-12g6igs", code: ".toolbar.svelte-12g6igs {display:flex;gap:8px;align-items:center;margin-bottom:12px;}input[type='search'].svelte-12g6igs {flex:1;min-width:180px;padding:10px;border:1px solid var(--ui-border);border-radius:8px;}button.svelte-12g6igs {border:0;border-radius:8px;background:var(--ui-primary);color:var(--ui-primary-contrast);padding:10px 12px;cursor:pointer;}" }; function Tl(e, t) { hn(t, !1), fr(e, Sl); let n = Oe(t, "endpoint", 12, ""), r = Oe(t, "target", 12, ""), s = Oe(t, "pageSize", 12, 10), i = /* @__PURE__ */ Ve(""); function l(c = 1) { if (!n() || !r()) return; const h = new URLSearchParams(); x(i).trim() && h.set("q", x(i).trim()), h.set("page", String(c)), h.set("pageSize", String(s())); const _ = `${n()}${n().includes("?") ? "&" : "?"}${h.toString()}`, g = window.htmx; if (g && typeof g.ajax == "function") { g.ajax("GET", _, { target: r() }); return; } const d = document.querySelector(r()); d && fetch(_).then((v) => v.text()).then((v) => { d.innerHTML = v; }).catch(() => { }); } var f = { get endpoint() { return n(); }, set endpoint(c) { n(c), he(); }, get target() { return r(); }, set target(c) { r(c), he(); }, get pageSize() { return s(); }, set pageSize(c) { s(c), he(); } }; or(); var o = xl(), a = de(o); return ll(a), Jn(2), ce(o), ol(a, () => x(i), (c) => V(i, c)), ft("keydown", a, (c) => c.key === "Enter" && l(1)), ft("submit", o, al(() => l(1))), Re(e, o), vn(f); } customElements.define("ui-data-table-shell", ar(Tl, { endpoint: {}, target: {}, pageSize: {} }, [], [], { mode: "open" }));