Files
treatvault/internal/adminui/dist/assets/entry.js

3415 lines
98 KiB
JavaScript
Raw Blame History

This file contains invisible Unicode characters
This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
typeof window < "u" && ((window.__svelte ??= {}).v ??= /* @__PURE__ */ new Set()).add("5");
const ws = 1, ys = 2, ks = 16, $s = 1, Es = 2, nn = "[", _r = "[!", Hr = "[?", br = "]", Je = {}, R = /* @__PURE__ */ Symbol("uninitialized"), qs = "http://www.w3.org/1999/xhtml", sn = !1;
var an = Array.isArray, xs = Array.prototype.indexOf, St = Array.prototype.includes, Pt = Array.from, At = Object.keys, vt = Object.defineProperty, Ke = Object.getOwnPropertyDescriptor, Ts = Object.prototype, Ss = Array.prototype, As = Object.getPrototypeOf, Ur = Object.isExtensible;
const Ns = () => {
};
function Cs(e) {
for (var t = 0; t < e.length; t++)
e[t]();
}
function ln() {
var e, t, r = new Promise((n, s) => {
e = n, t = s;
});
return { promise: r, resolve: e, reject: t };
}
const I = 2, Xe = 4, Lt = 8, on = 1 << 24, re = 16, Q = 32, de = 64, lr = 128, gr = 256, Z = 512, O = 1024, N = 2048, ie = 4096, j = 8192, U = 16384, Ve = 32768, Nt = 1 << 25, Ze = 65536, Ct = 1 << 17, Rs = 1 << 18, je = 1 << 19, Os = 1 << 20, me = 1 << 25, Pe = 65536, Rt = 1 << 21, We = 1 << 22, Ae = 1 << 23, $t = /* @__PURE__ */ Symbol("$state"), un = /* @__PURE__ */ Symbol("component"), Ms = /* @__PURE__ */ Symbol("legacy props"), Ds = /* @__PURE__ */ Symbol(""), fn = /* @__PURE__ */ Symbol("attributes"), or = /* @__PURE__ */ Symbol("class"), Is = /* @__PURE__ */ Symbol("style"), ur = /* @__PURE__ */ Symbol("text"), ft = /* @__PURE__ */ Symbol("form reset"), pt = new class extends Error {
name = "StaleReactionError";
message = "The reaction that called `getAbortSignal()` was re-run or destroyed";
}(), Ps = (
// We gotta write it like this because after downleveling the pure comment may end up in the wrong location
!!globalThis.document?.contentType && /* @__PURE__ */ globalThis.document.contentType.includes("xml")
), Ft = 3, _t = 8;
function Ls() {
console.warn("https://svelte.dev/e/derived_inert");
}
function Vt(e) {
console.warn("https://svelte.dev/e/hydration_mismatch");
}
function Fs() {
console.warn("https://svelte.dev/e/svelte_boundary_reset_noop");
}
let y = !1;
function we(e) {
y = e;
}
let k;
function K(e) {
if (e === null)
throw Vt(), Je;
return k = e;
}
function jt() {
return K(/* @__PURE__ */ pe(k));
}
function M(e) {
if (y) {
if (/* @__PURE__ */ pe(k) !== null)
throw Vt(), Je;
k = e;
}
}
function cn(e = 1) {
if (y) {
for (var t = e, r = k; t--; )
r = /** @type {TemplateNode} */
/* @__PURE__ */ pe(r);
k = r;
}
}
function Ot(e = !0) {
for (var t = 0, r = k; ; ) {
if (r.nodeType === _t) {
var n = (
/** @type {Comment} */
r.data
);
if (n === br) {
if (t === 0) return r;
t -= 1;
} else (n === nn || n === _r || // "[1", "[2", etc. for if blocks
n[0] === "[" && !isNaN(Number(n.slice(1)))) && (t += 1);
}
var s = (
/** @type {TemplateNode} */
/* @__PURE__ */ pe(r)
);
e && r.remove(), r = s;
}
}
function dn(e) {
if (!e || e.nodeType !== _t)
throw Vt(), Je;
return (
/** @type {Comment} */
e.data
);
}
function vn(e) {
return e === this.v;
}
function Vs(e, t) {
return e != e ? t == t : e !== t || e !== null && typeof e == "object" || typeof e == "function";
}
function hn(e) {
return !Vs(e, this.v);
}
function js(e) {
throw new Error("https://svelte.dev/e/lifecycle_outside_component");
}
function zs() {
throw new Error("https://svelte.dev/e/async_derived_orphan");
}
function Hs(e, t, r) {
throw new Error("https://svelte.dev/e/each_key_duplicate");
}
function Us(e) {
throw new Error("https://svelte.dev/e/effect_in_teardown");
}
function Bs() {
throw new Error("https://svelte.dev/e/effect_in_unowned_derived");
}
function Ys(e) {
throw new Error("https://svelte.dev/e/effect_orphan");
}
function Gs() {
throw new Error("https://svelte.dev/e/effect_update_depth_exceeded");
}
function Ks() {
throw new Error("https://svelte.dev/e/hydration_failed");
}
function Ws() {
throw new Error("https://svelte.dev/e/state_descriptors_fixed");
}
function Js() {
throw new Error("https://svelte.dev/e/state_prototype_fixed");
}
function Xs() {
throw new Error("https://svelte.dev/e/state_unsafe_mutation");
}
function Zs() {
throw new Error("https://svelte.dev/e/svelte_boundary_reset_onerror");
}
let Qs = !1, L = null;
function Qe(e) {
L = e;
}
function pn(e, t = !1, r) {
L = {
p: L,
i: !1,
c: null,
e: null,
s: e,
x: null,
r: (
/** @type {Effect} */
g
),
l: null
};
}
function _n(e) {
var t = (
/** @type {ComponentContext} */
L
), r = t.e;
if (r !== null) {
t.e = null;
for (var n of r)
Pn(n);
}
return e !== void 0 && (t.x = e), t.i = !0, L = t.p, mr(e);
}
function mr(e = {}) {
return vt(e, un, { value: !0 }), e;
}
function bn() {
return !0;
}
let Oe = [];
function gn() {
var e = Oe;
Oe = [], Cs(e);
}
function Se(e) {
if (Oe.length === 0 && !ct) {
var t = Oe;
queueMicrotask(() => {
t === Oe && gn();
});
}
Oe.push(e);
}
function ei() {
for (; Oe.length > 0; )
gn();
}
const ti = -7169;
function T(e, t) {
e.f = e.f & ti | t;
}
function wr(e) {
(e.f & Z) !== 0 || e.deps === null ? T(e, O) : T(e, ie);
}
function mn(e) {
if (e !== null)
for (const t of e)
(t.f & I) === 0 || (t.f & Pe) === 0 || (t.f ^= Pe, mn(
/** @type {Derived} */
t.deps
));
}
function wn(e, t, r) {
(e.f & N) !== 0 ? t.add(e) : (e.f & ie) !== 0 && r.add(e), mn(e.deps), T(e, O);
}
let Br = !1;
function yn() {
Br || (Br = !0, document.addEventListener(
"reset",
(e) => {
Promise.resolve().then(() => {
if (!e.defaultPrevented)
for (
const t of
/**@type {HTMLFormElement} */
e.target.elements
)
t[ft]?.();
});
},
// In the capture phase to guarantee we get noticed of it (no possibility of stopPropagation)
{ capture: !0 }
));
}
function bt(e) {
var t = w, r = g;
ee(null), he(null);
try {
return e();
} finally {
ee(t), he(r);
}
}
function ri(e, t, r, n = r) {
e.addEventListener(t, () => bt(r));
const s = (
/** @type {any} */
e[ft]
);
s ? e[ft] = () => {
s(), n(!0);
} : e[ft] = () => n(!0), yn();
}
function ni(e, t, r, n) {
const s = yr;
var i = e.filter((h) => !h.settled), l = t.map(s);
if (r.length === 0 && i.length === 0) {
n(l);
return;
}
var a = (
/** @type {Effect} */
g
), o = si(), u = i.length === 1 ? i[0].promise : i.length > 1 ? Promise.all(i.map((h) => h.promise)) : null;
function c(h) {
if ((a.f & U) === 0) {
o();
try {
n([...l, ...h]);
} catch (f) {
ue(f, a);
}
Mt();
}
}
var d = kn();
if (r.length === 0) {
u.then(() => c([])).finally(d);
return;
}
function v() {
Promise.all(r.map((h) => /* @__PURE__ */ ii(h))).then(c).catch((h) => ue(h, a)).finally(d);
}
u ? u.then(() => {
o(), v(), Mt();
}) : v();
}
function si() {
var e = (
/** @type {Effect} */
g
), t = w, r = L, n = (
/** @type {Batch} */
b
);
return function(i = !0) {
he(e), ee(t), Qe(r), i && (e.f & U) === 0 && (n?.activate(), n?.apply());
};
}
function Mt(e = !0) {
he(null), ee(null), Qe(null), e && b?.deactivate();
}
function kn() {
var e = (
/** @type {Effect} */
g
), t = e.b, r = (
/** @type {Batch} */
b
), n = !!t?.is_rendered();
return t?.update_pending_count(1, r), r.increment(n, e), () => {
t?.update_pending_count(-1, r), r.decrement(n, e);
};
}
// @__NO_SIDE_EFFECTS__
function yr(e) {
var t = I | N;
return g !== null && (g.f |= je), {
ctx: L,
deps: null,
effects: null,
equals: vn,
f: t,
fn: e,
reactions: null,
rv: 0,
v: (
/** @type {V} */
R
),
wv: 0,
parent: g,
ac: null
};
}
const at = /* @__PURE__ */ Symbol("obsolete");
// @__NO_SIDE_EFFECTS__
function ii(e, t, r) {
let n = (
/** @type {Effect | null} */
g
);
n === null && zs();
var s = (
/** @type {Promise<V>} */
/** @type {unknown} */
void 0
), i = Le(
/** @type {V} */
R
), l = !w, a = /* @__PURE__ */ new Set();
return gi(() => {
var o = (
/** @type {Effect} */
g
), u = ln();
s = u.promise;
try {
Promise.resolve(e()).then(u.resolve, (h) => {
h !== pt && u.reject(h);
}).finally(Mt);
} catch (h) {
u.reject(h), Mt();
}
var c = (
/** @type {Batch} */
b
);
if (l) {
if ((o.f & Ve) !== 0)
var d = kn();
if (
// boundary can be null if the async derived is inside an $effect.root not connected to the component render tree
n.b?.is_rendered()
)
c.async_deriveds.get(o)?.reject(at);
else
for (const h of a.values())
h.reject(at);
a.add(u), c.async_deriveds.set(o, u);
}
const v = (h, f = void 0) => {
d?.(), a.delete(u), f !== at && (c.activate(), f ? (i.f |= Ae, et(i, f)) : ((i.f & Ae) !== 0 && (i.f ^= Ae), et(i, h)), c.deactivate());
};
u.promise.then(v, (h) => v(null, h || "unknown"));
}), pi(() => {
for (const o of a)
o.reject(at);
}), new Promise((o) => {
function u(c) {
function d() {
c === s ? o(i) : u(s);
}
c.then(d, d);
}
u(s);
});
}
// @__NO_SIDE_EFFECTS__
function ai(e) {
const t = /* @__PURE__ */ yr(e);
return t.equals = hn, t;
}
function li(e) {
var t = e.effects;
if (t !== null) {
e.effects = null;
for (var r = 0; r < t.length; r += 1)
z(
/** @type {Effect} */
t[r]
);
}
}
function kr(e) {
var t, r = g, n = e.parent;
if (!ke && n !== null && e.v !== R && // if it was never evaluated before, it's guaranteed to fail downstream, so we try to execute instead
(n.f & (U | j)) !== 0)
return Ls(), e.v;
he(n);
try {
e.f &= ~Pe, li(e), t = Yn(e);
} finally {
he(r);
}
return t;
}
function $n(e) {
var t = kr(e);
if (!e.equals(t) && (e.wv = Un(), (!b?.is_fork || e.deps === null) && (b !== null ? (b.capture(e, t, !0), fr?.capture(e, t, !0)) : e.v = t, e.deps === null))) {
T(e, O);
return;
}
ke || (ne !== null ? (Sr() || b?.is_fork) && ne.set(e, t) : wr(e));
}
function oi(e) {
if (e.effects !== null)
for (const t of e.effects)
(t.teardown || t.ac) && (t.teardown?.(), t.ac !== null && bt(() => {
t.ac.abort(pt), t.ac = null;
}), t.fn !== null && (t.teardown = Ns), ht(t, 0), Nr(t));
}
function En(e) {
if (e.effects !== null)
for (const t of e.effects)
t.teardown && t.fn !== null && tt(t);
}
let Xt = null, Ue = null, b = null, fr = null, ne = null, cr = null, ct = !1, Zt = !1, Ge = null, Et = null;
var Yr = 0;
let ui = 1;
class ye {
id = ui++;
/** True as soon as `#process` was called */
#e = !1;
linked = !0;
/** @type {Batch | null} */
#t = null;
/** @type {Batch | null} */
#r = null;
/** @type {Map<Effect, ReturnType<typeof deferred<any>>>} */
async_deriveds = /* @__PURE__ */ new Map();
/**
* The current values of any signals that are updated in this batch.
* Tuple format: [value, is_derived] (note: is_derived is false for deriveds, too, if they were overridden via assignment)
* They keys of this map are identical to `this.#previous`
* @type {Map<Value, [any, boolean]>}
*/
current = /* @__PURE__ */ new Map();
/**
* The values of any signals (sources and deriveds) that are updated in this batch _before_ those updates took place.
* They keys of this map are identical to `this.#current`
* @type {Map<Value, any>}
*/
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<(batch: Batch) => void>}
*/
#o = /* @__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 = /* @__PURE__ */ new Set();
/**
* The number of async effects that are currently in flight
*/
#a = 0;
/**
* Async effects that are currently in flight, _not_ inside a pending boundary
* @type {Map<Effect, number>}
*/
#n = /* @__PURE__ */ new Map();
/**
* A deferred that resolves when the batch is committed, used with `settled()`
* TODO replace with Promise.withResolvers once supported widely enough
* @type {{ promise: Promise<void>, resolve: (value?: any) => void, reject: (reason: unknown) => void } | null}
*/
#l = null;
/**
* The root effects that need to be flushed
* @type {Effect[]}
*/
#i = [];
/**
* Effects created while this batch was active.
* @type {Effect[]}
*/
#p = [];
/**
* Deferred effects (which run after async work has completed) that are DIRTY
* @type {Set<Effect>}
*/
#u = /* @__PURE__ */ new Set();
/**
* Deferred effects that are MAYBE_DIRTY
* @type {Set<Effect>}
*/
#f = /* @__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<Effect, { d: Effect[], m: Effect[] }>}
*/
#d = /* @__PURE__ */ new Map();
/**
* Inverse of #skipped_branches which we need to tell prior batches to unskip them when committing
* @type {Set<Effect>}
*/
#_ = /* @__PURE__ */ new Set();
is_fork = !1;
#c = !1;
constructor() {
Ue === null ? Xt = Ue = this : (Ue.#r = this, this.#t = Ue), Ue = this;
}
#m() {
if (this.is_fork) return !0;
for (const n of this.#n.keys()) {
for (var t = n, r = !1; t.parent !== null; ) {
if (this.#d.has(t)) {
r = !0;
break;
}
t = t.parent;
}
if (!r)
return !0;
}
return !1;
}
/**
* Add an effect to the #skipped_branches map and reset its children
* @param {Effect} effect
*/
skip_effect(t) {
this.#d.has(t) || this.#d.set(t, { d: [], m: [] }), this.#_.delete(t);
}
/**
* Remove an effect from the #skipped_branches map and reschedule
* any tracked dirty/maybe_dirty child effects
* @param {Effect} effect
* @param {(e: Effect) => void} callback
*/
unskip_effect(t, r = (n) => this.schedule(n)) {
var n = this.#d.get(t);
if (n) {
this.#d.delete(t);
for (var s of n.d)
T(s, N), r(s);
for (s of n.m)
T(s, ie), r(s);
}
this.#_.add(t);
}
#b() {
this.#e = !0, Yr++ > 1e3 && (this.#h(), fi());
for (const o of this.#u)
this.#f.delete(o), T(o, N), this.schedule(o);
for (const o of this.#f)
T(o, ie), this.schedule(o);
const t = this.#i;
this.#i = [], this.apply();
var r = Ge = [], n = [], s = Et = [];
for (const o of t)
try {
this.#w(o, r, n);
} catch (u) {
throw Tn(o), this.#m() || this.discard(), u;
}
if (b = null, s.length > 0) {
var i = ye.ensure();
for (const o of s)
i.schedule(o);
}
if (Ge = null, Et = null, this.#m()) {
this.#v(n), this.#v(r);
for (const [o, u] of this.#d)
xn(o, u);
s.length > 0 && /** @type {unknown} */
b.#b();
return;
}
const l = this.#y();
if (l) {
this.#v(n), this.#v(r), l.#k(this);
return;
}
this.#u.clear(), this.#f.clear();
for (const o of this.#o) o(this);
this.#o.clear(), fr = this, Gr(n), Gr(r), fr = null, this.#l?.resolve();
var a = (
/** @type {Batch | null} */
/** @type {unknown} */
b
);
if (this.#a === 0 && (this.#i.length === 0 || a !== null) && this.#h(), this.#i.length > 0)
if (a !== null) {
const o = a;
o.#i.push(...this.#i.filter((u) => !o.#i.includes(u)));
} else
a = this;
a !== null && (fe.clear(), a.#b());
}
/**
* Traverse the effect tree, executing effects or stashing
* them for later execution as appropriate
* @param {Effect} root
* @param {Effect[]} effects
* @param {Effect[]} render_effects
*/
#w(t, r, n) {
t.f ^= O;
for (var s = t.first; s !== null; ) {
var i = s.f, l = (i & (Q | de)) !== 0, a = l && (i & O) !== 0, o = a || (i & j) !== 0 || this.#d.has(s);
if (!o && s.fn !== null) {
l ? s.f ^= O : (i & Xe) !== 0 ? r.push(s) : gt(s) && ((i & re) !== 0 && this.#f.add(s), tt(s));
var u = s.first;
if (u !== null) {
s = u;
continue;
}
}
for (; s !== null; ) {
var c = s.next;
if (c !== null) {
s = c;
break;
}
s = s.parent;
}
}
}
#y() {
for (var t = this.#t; t !== null; ) {
if (!t.is_fork) {
for (const [r, [, n]] of this.current)
if (t.current.has(r) && !n)
return t;
}
t = t.#t;
}
return null;
}
/**
* @param {Batch} batch
*/
#k(t) {
for (const [n, s] of t.current)
!this.previous.has(n) && t.previous.has(n) && this.previous.set(n, t.previous.get(n)), this.current.set(n, s);
for (const [n, s] of t.async_deriveds) {
const i = this.async_deriveds.get(n);
i && s.promise.then(i.resolve).catch(i.reject);
}
t.async_deriveds.clear(), this.transfer_effects(t.#u, t.#f);
const r = (n) => {
var s = n.reactions;
if (s !== null && !((n.f & I) !== 0 && (n.f & (N | ie)) === 0))
for (const a of s) {
var i = a.f;
if ((i & I) !== 0)
r(
/** @type {Derived} */
a
);
else {
var l = (
/** @type {Effect} */
a
);
i & (We | re) && !this.async_deriveds.has(l) && (this.#f.delete(l), T(l, N), this.schedule(l));
}
}
};
for (const n of this.current.keys())
r(n);
this.oncommit(() => t.discard()), t.#h(), b = this, this.#b();
}
/**
* @param {Effect[]} effects
*/
#v(t) {
for (var r = 0; r < t.length; r += 1)
wn(t[r], this.#u, this.#f);
}
/**
* Associate a change to a given source with the current
* batch, noting its previous and current values
* @param {Value} source
* @param {any} value
* @param {boolean} [is_derived]
*/
capture(t, r, n = !1) {
t.v !== R && !this.previous.has(t) && this.previous.set(t, t.v), (t.f & Ae) === 0 && (this.current.set(t, [r, n]), ne?.set(t, r)), this.is_fork || (t.v = r);
}
activate() {
b = this;
}
deactivate() {
b = null, ne = null;
}
flush() {
try {
Zt = !0, b = this, this.#b();
} finally {
Yr = 0, cr = null, Ge = null, Et = null, Zt = !1, b = null, ne = null, fe.clear();
}
}
discard() {
for (const t of this.#s) t(this);
this.#s.clear();
for (const t of this.async_deriveds.values())
t.reject(at);
this.#h(), this.#l?.resolve();
}
/**
* @param {Effect} effect
*/
register_created_effect(t) {
this.#p.push(t);
}
#g() {
for (let d = Xt; d !== null; d = d.#r) {
var t = d.id < this.id, r = [];
for (const [v, [h, f]] of this.current) {
if (d.current.has(v)) {
var n = (
/** @type {[any, boolean]} */
d.current.get(v)[0]
);
if (t && h !== n)
d.current.set(v, [h, f]);
else
continue;
}
r.push(v);
}
if (t)
for (const [v, h] of this.async_deriveds) {
const f = d.async_deriveds.get(v);
f && h.promise.then(f.resolve).catch(f.reject);
}
var s = [...d.current.keys()].filter(
(v) => !/** @type {[any, boolean]} */
d.current.get(v)[1]
);
if (!(!d.#e || s.length === 0)) {
var i = s.filter((v) => !this.current.has(v));
if (i.length === 0)
t && d.discard();
else if (r.length > 0) {
if (t)
for (const v of this.#_)
d.unskip_effect(v, (h) => {
(h.f & (re | We)) !== 0 ? d.schedule(h) : d.#v([h]);
});
d.activate();
var l = /* @__PURE__ */ new Set(), a = /* @__PURE__ */ new Map();
for (var o of r)
qn(o, i, l, a);
a = /* @__PURE__ */ new Map();
var u = [...d.current].filter(([v, h]) => {
const f = this.current.get(v);
return f ? f[0] !== h[0] || f[1] !== h[1] : !0;
}).map(([v]) => v);
if (u.length > 0)
for (const v of this.#p)
(v.f & (U | j | Ct)) === 0 && Er(v, u, a) && ((v.f & (We | re)) !== 0 ? (T(v, N), d.schedule(v)) : d.#u.add(v));
if (d.#i.length > 0 && !d.#c) {
d.apply();
for (var c of d.#i)
d.#w(c, [], []);
d.#i = [];
}
d.deactivate();
}
}
}
}
/**
* @param {boolean} blocking
* @param {Effect} effect
*/
increment(t, r) {
if (this.#a += 1, t) {
let n = this.#n.get(r) ?? 0;
this.#n.set(r, n + 1);
}
}
/**
* @param {boolean} blocking
* @param {Effect} effect
*/
decrement(t, r) {
if (this.#a -= 1, t) {
let n = this.#n.get(r) ?? 0;
n === 1 ? this.#n.delete(r) : this.#n.set(r, n - 1);
}
this.#c || (this.#c = !0, Se(() => {
this.#c = !1, this.linked && this.flush();
}));
}
/**
* @param {Set<Effect>} dirty_effects
* @param {Set<Effect>} maybe_dirty_effects
*/
transfer_effects(t, r) {
for (const n of t)
this.#u.add(n);
for (const n of r)
this.#f.add(n);
t.clear(), r.clear();
}
/** @param {(batch: Batch) => void} fn */
oncommit(t) {
this.#o.add(t);
}
/** @param {(batch: Batch) => void} fn */
ondiscard(t) {
this.#s.add(t);
}
settled() {
return (this.#l ??= ln()).promise;
}
static ensure() {
if (b === null) {
const t = b = new ye();
!Zt && !ct && Se(() => {
t.#e || t.flush();
});
}
return b;
}
apply() {
{
ne = null;
return;
}
}
/**
*
* @param {Effect} effect
*/
schedule(t) {
if (cr = t, t.b?.is_pending && (t.f & (Xe | Lt | on)) !== 0 && (t.f & Ve) === 0) {
t.b.defer_effect(t);
return;
}
for (var r = t; r.parent !== null; ) {
r = r.parent;
var n = r.f;
if (Ge !== null && r === g && (w === null || (w.f & I) === 0))
return;
if ((n & (de | Q)) !== 0) {
if ((n & O) === 0)
return;
r.f ^= O;
}
}
this.#i.push(r);
}
#h() {
if (this.linked) {
var t = this.#t, r = this.#r;
t === null ? Xt = r : t.#r = r, r === null ? Ue = t : r.#t = t, this.linked = !1;
}
}
}
function $r(e) {
var t = ct;
ct = !0;
try {
for (var r; ; ) {
if (ei(), b === null)
return (
/** @type {T} */
r
);
b.flush();
}
} finally {
ct = t;
}
}
function fi() {
try {
Gs();
} catch (e) {
ue(e, cr);
}
}
let ge = null;
function Gr(e) {
var t = e.length;
if (t !== 0) {
for (var r = 0; r < t; ) {
var n = e[r++];
if ((n.f & (U | j)) === 0 && gt(n) && (ge = /* @__PURE__ */ new Set(), tt(n), n.deps === null && n.first === null && n.nodes === null && n.teardown === null && n.ac === null && Vn(n), ge?.size > 0)) {
fe.clear();
for (const s of ge) {
if ((s.f & (U | j)) !== 0) continue;
const i = [s];
let l = s.parent;
for (; l !== null; )
ge.has(l) && (ge.delete(l), i.push(l)), l = l.parent;
for (let a = i.length - 1; a >= 0; a--) {
const o = i[a];
(o.f & (U | j)) === 0 && tt(o);
}
}
ge.clear();
}
}
ge = null;
}
}
function qn(e, t, r, n) {
if (!r.has(e) && (r.add(e), e.reactions !== null))
for (const s of e.reactions) {
const i = s.f;
(i & I) !== 0 ? qn(
/** @type {Derived} */
s,
t,
r,
n
) : (i & (We | re)) !== 0 && (i & N) === 0 && Er(s, t, n) && (T(s, N), qr(
/** @type {Effect} */
s
));
}
}
function Er(e, t, r) {
const n = r.get(e);
if (n !== void 0) return n;
if (e.deps !== null)
for (const s of e.deps) {
if (St.call(t, s))
return !0;
if ((s.f & I) !== 0 && Er(
/** @type {Derived} */
s,
t,
r
))
return r.set(
/** @type {Derived} */
s,
!0
), !0;
}
return r.set(e, !1), !1;
}
function qr(e) {
b.schedule(e);
}
function xn(e, t) {
if (!((e.f & Q) !== 0 && (e.f & O) !== 0)) {
(e.f & N) !== 0 ? t.d.push(e) : (e.f & ie) !== 0 && t.m.push(e), T(e, O);
for (var r = e.first; r !== null; )
xn(r, t), r = r.next;
}
}
function Tn(e) {
T(e, O);
for (var t = e.first; t !== null; )
Tn(t), t = t.next;
}
let Dt = /* @__PURE__ */ new Set();
const fe = /* @__PURE__ */ new Map();
let Sn = !1;
function Le(e, t) {
var r = {
f: 0,
// TODO ideally we could skip this altogether, but it causes type errors
v: e,
reactions: null,
equals: vn,
rv: 0,
wv: 0
};
return r;
}
// @__NO_SIDE_EFFECTS__
function P(e, t) {
const r = Le(e);
return yi(r), r;
}
// @__NO_SIDE_EFFECTS__
function An(e, t = !1, r = !0) {
const n = Le(e);
return t || (n.equals = hn), n;
}
function q(e, t, r = !1) {
w !== 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
(!se || (w.f & Ct) !== 0) && bn() && (w.f & (I | re | We | Ct)) !== 0 && (ce === null || !ce.has(e)) && Xs();
let n = r ? lt(t) : t;
return et(e, n, Et);
}
function et(e, t, r = null) {
if (!e.equals(t)) {
ke ? fe.set(e, t) : fe.has(e) || fe.set(e, e.v);
var n = ye.ensure();
if (n.capture(e, t), (e.f & I) !== 0) {
const s = (
/** @type {Derived} */
e
);
(e.f & N) !== 0 && kr(s), ne === null && wr(s);
}
e.wv = Un(), Nn(e, N, r), g !== null && (g.f & O) !== 0 && (g.f & (Q | de)) === 0 && (J === null ? ki([e]) : J.push(e)), !n.is_fork && Dt.size > 0 && !Sn && ci();
}
return t;
}
function ci() {
Sn = !1;
for (const e of Dt) {
(e.f & O) !== 0 && T(e, ie);
let t;
try {
t = gt(e);
} catch {
t = !0;
}
t && tt(e);
}
Dt.clear();
}
function dt(e) {
q(e, e.v + 1);
}
function Nn(e, t, r) {
var n = e.reactions;
if (n !== null)
for (var s = n.length, i = 0; i < s; i++) {
var l = n[i], a = l.f, o = (a & N) === 0;
if (o && T(l, t), (a & Ct) !== 0)
Dt.add(
/** @type {Effect} */
l
);
else if ((a & I) !== 0) {
var u = (
/** @type {Derived} */
l
);
ne?.delete(u), (a & Pe) === 0 && (a & Z && (g === null || (g.f & Rt) === 0) && (l.f |= Pe), Nn(u, ie, r));
} else if (o) {
var c = (
/** @type {Effect} */
l
);
(a & re) !== 0 && ge !== null && ge.add(c), r !== null ? r.push(c) : qr(c);
}
}
}
function lt(e) {
if (typeof e != "object" || e === null || $t in e || un in e)
return e;
const t = As(e);
if (t !== Ts && t !== Ss)
return e;
var r = /* @__PURE__ */ new Map(), n = an(e), s = /* @__PURE__ */ P(0), i = Ie, l = (a) => {
if (Ie === i)
return a();
var o = w, u = Ie;
ee(null), Jr(i);
var c = a();
return ee(o), Jr(u), c;
};
return n && r.set("length", /* @__PURE__ */ P(
/** @type {any[]} */
e.length
)), new Proxy(
/** @type {any} */
e,
{
defineProperty(a, o, u) {
(!("value" in u) || u.configurable === !1 || u.enumerable === !1 || u.writable === !1) && Ws();
var c = r.get(o);
return c === void 0 ? l(() => {
var d = /* @__PURE__ */ P(u.value);
return r.set(o, d), d;
}) : q(c, u.value, !0), !0;
},
deleteProperty(a, o) {
var u = r.get(o);
if (u === void 0) {
if (o in a) {
const c = l(() => /* @__PURE__ */ P(R));
r.set(o, c), dt(s);
}
} else
q(u, R), dt(s);
return !0;
},
get(a, o, u) {
if (o === $t)
return e;
var c = r.get(o), d = o in a;
if (c === void 0 && (!d || Ke(a, o)?.writable) && (c = l(() => {
var h = lt(d ? a[o] : R), f = /* @__PURE__ */ P(h);
return f;
}), r.set(o, c)), c !== void 0) {
var v = p(c);
return v === R ? void 0 : v;
}
return Reflect.get(a, o, u);
},
getOwnPropertyDescriptor(a, o) {
var u = Reflect.getOwnPropertyDescriptor(a, o);
if (u && "value" in u) {
var c = r.get(o);
c && (u.value = p(c));
} else if (u === void 0) {
var d = r.get(o), v = d?.v;
if (d !== void 0 && v !== R)
return {
enumerable: !0,
configurable: !0,
value: v,
writable: !0
};
}
return u;
},
has(a, o) {
if (o === $t)
return !0;
var u = r.get(o), c = u !== void 0 && u.v !== R || Reflect.has(a, o);
if (u !== void 0 || g !== null && (!c || Ke(a, o)?.writable)) {
u === void 0 && (u = l(() => {
var v = c ? lt(a[o]) : R, h = /* @__PURE__ */ P(v);
return h;
}), r.set(o, u));
var d = p(u);
if (d === R)
return !1;
}
return c;
},
set(a, o, u, c) {
var d = r.get(o), v = o in a;
if (n && o === "length")
for (var h = u; h < /** @type {Source<number>} */
d.v; h += 1) {
var f = r.get(h + "");
f !== void 0 ? q(f, R) : h in a && (f = l(() => /* @__PURE__ */ P(R)), r.set(h + "", f));
}
if (d === void 0)
(!v || Ke(a, o)?.writable) && (d = l(() => /* @__PURE__ */ P(void 0)), q(d, lt(u)), r.set(o, d));
else {
v = d.v !== R;
var $ = l(() => lt(u));
q(d, $);
}
var C = Reflect.getOwnPropertyDescriptor(a, o);
if (C?.set && C.set.call(c, u), !v) {
if (n && typeof o == "string") {
var m = (
/** @type {Source<number>} */
r.get("length")
), S = Number(o);
Number.isInteger(S) && S >= m.v && q(m, S + 1);
}
dt(s);
}
return !0;
},
ownKeys(a) {
p(s);
var o = Reflect.ownKeys(a).filter((d) => {
var v = r.get(d);
return v === void 0 || v.v !== R;
});
for (var [u, c] of r)
c.v !== R && !(u in a) && o.push(u);
return o;
},
setPrototypeOf() {
Js();
}
}
);
}
var Kr, Cn, Rn, On;
function dr() {
if (Kr === void 0) {
Kr = window, Cn = /Firefox/.test(navigator.userAgent);
var e = Element.prototype, t = Node.prototype, r = Text.prototype;
Rn = Ke(t, "firstChild").get, On = Ke(t, "nextSibling").get, Ur(e) && (e[or] = void 0, e[fn] = null, e[Is] = void 0, e.__e = void 0), Ur(r) && (r[ur] = void 0);
}
}
function ve(e = "") {
return document.createTextNode(e);
}
// @__NO_SIDE_EFFECTS__
function Fe(e) {
return (
/** @type {TemplateNode | null} */
Rn.call(e)
);
}
// @__NO_SIDE_EFFECTS__
function pe(e) {
return (
/** @type {TemplateNode | null} */
On.call(e)
);
}
function D(e, t) {
if (!y)
return /* @__PURE__ */ Fe(e);
var r = /* @__PURE__ */ Fe(k);
if (r === null)
r = k.appendChild(ve());
else if (t && r.nodeType !== Ft) {
var n = ve();
return r?.before(n), K(n), n;
}
return t && Tr(
/** @type {Text} */
r
), K(r), r;
}
function Qt(e, t = !1) {
if (!y) {
var r = /* @__PURE__ */ Fe(e);
return r instanceof Comment && r.data === "" ? /* @__PURE__ */ pe(r) : r;
}
if (t) {
if (k?.nodeType !== Ft) {
var n = ve();
return k?.before(n), K(n), n;
}
Tr(
/** @type {Text} */
k
);
}
return k;
}
function Be(e, t = !1) {
if (!y)
return /* @__PURE__ */ Fe(e);
var r = D(e, t);
return M(e), r;
}
function E(e, t = 1, r = !1) {
let n = y ? k : e;
for (var s; t--; )
s = n, n = /** @type {TemplateNode} */
/* @__PURE__ */ pe(n);
if (!y)
return n;
if (r) {
if (n?.nodeType !== Ft) {
var i = ve();
return n === null ? s?.after(i) : n.before(i), K(i), i;
}
Tr(
/** @type {Text} */
n
);
}
return K(n), n;
}
function Mn(e) {
e.textContent = "";
}
function Dn() {
return !1;
}
function xr(e, t, r) {
return (
/** @type {T extends keyof HTMLElementTagNameMap ? HTMLElementTagNameMap[T] : Element} */
document.createElement(e)
);
}
function Tr(e) {
if (
/** @type {string} */
e.nodeValue.length < 65536
)
return;
let t = e.nextSibling;
for (; t !== null && t.nodeType === Ft; )
t.remove(), e.nodeValue += /** @type {string} */
t.nodeValue, t = e.nextSibling;
}
function di(e) {
var t = g;
if (t === null)
return w.f |= Ae, e;
if ((t.f & Ve) === 0 && (t.f & Xe) === 0)
throw e;
ue(e, t);
}
function ue(e, t) {
if (!(t !== null && (t.f & U) !== 0)) {
for (; t !== null; ) {
if ((t.f & lr) !== 0 && (t.f & (U | Nt)) === 0) {
if ((t.f & Ve) === 0)
throw e;
try {
t.b.error(e);
return;
} catch (r) {
e = r;
}
}
t = t.parent;
}
throw e;
}
}
function vi(e) {
g === null && (w === null && Ys(), Bs()), ke && Us();
}
function hi(e, t) {
var r = t.last;
r === null ? t.last = t.first = e : (r.next = e, e.prev = r, t.last = e);
}
function _e(e, t) {
var r = g;
r !== null && (r.f & j) !== 0 && (e |= j);
var n = {
ctx: L,
deps: null,
nodes: null,
f: e | N | Z,
first: null,
fn: t,
last: null,
next: null,
parent: r,
b: r && r.b,
prev: null,
teardown: null,
wv: 0,
ac: null
};
b?.register_created_effect(n);
var s = n;
if ((e & Xe) !== 0)
Ge !== null ? Ge.push(n) : ye.ensure().schedule(n);
else if (t !== null) {
try {
tt(n);
} catch (l) {
throw z(n), l;
}
s.deps === null && s.teardown === null && s.nodes === null && s.first === s.last && // either `null`, or a singular child
(s.f & je) === 0 && (s = s.first, (e & re) !== 0 && (e & Ze) !== 0 && s !== null && (s.f |= Ze));
}
if (s !== null && (s.parent = r, r !== null && hi(s, r), w !== null && (w.f & I) !== 0 && (e & de) === 0)) {
var i = (
/** @type {Derived} */
w
);
(i.effects ??= []).push(s);
}
return n;
}
function Sr() {
return w !== null && !se;
}
function pi(e) {
const t = _e(Lt, null);
return T(t, O), t.teardown = e, t;
}
function In(e) {
vi();
var t = (
/** @type {Effect} */
g.f
), r = !w && (t & Q) !== 0 && L !== null && !L.i;
if (r) {
var n = (
/** @type {ComponentContext} */
L
);
(n.e ??= []).push(e);
} else
return Pn(e);
}
function Pn(e) {
return _e(Xe | Os, e);
}
function _i(e) {
ye.ensure();
const t = _e(de | je, e);
return () => {
z(t);
};
}
function bi(e) {
ye.ensure();
const t = _e(de | je, e);
return (r = {}) => new Promise((n) => {
r.outro ? De(t, () => {
z(t), n(void 0);
}) : (z(t), n(void 0));
});
}
function Ln(e) {
return _e(Xe, e);
}
function gi(e) {
return _e(We | je, e);
}
function zt(e, t = 0) {
return _e(Lt | t, e);
}
function Ce(e, t = [], r = [], n = []) {
ni(n, t, r, (s) => {
_e(Lt, () => {
e(...s.map(p));
});
});
}
function Ar(e, t = 0) {
var r = _e(re | t, e);
return r;
}
function X(e) {
return _e(Q | je, e);
}
function Fn(e) {
var t = e.teardown;
if (t !== null) {
const r = ke, n = w;
Wr(!0), ee(null);
try {
t.call(null);
} catch (s) {
ue(s, e.parent);
} finally {
Wr(r), ee(n);
}
}
}
function Nr(e, t = !1) {
var r = e.first;
for (e.first = e.last = null; r !== null; ) {
const s = r.ac;
s !== null && bt(() => {
s.abort(pt);
});
var n = r.next;
(r.f & de) !== 0 ? r.parent = null : z(r, t), r = n;
}
}
function mi(e) {
for (var t = e.first; t !== null; ) {
var r = t.next;
(t.f & Q) === 0 && z(t), t = r;
}
}
function z(e, t = !0) {
var r = !1;
(t || (e.f & Rs) !== 0) && e.nodes !== null && e.nodes.end !== null && (wi(
e.nodes.start,
/** @type {TemplateNode} */
e.nodes.end
), r = !0), e.f |= Nt, Nr(e, t && !r), ht(e, 0);
var n = e.nodes && e.nodes.t;
if (n !== null)
for (const i of n)
i.stop();
Fn(e), e.f ^= Nt, e.f |= U;
var s = e.parent;
s !== null && s.first !== null && Vn(e), e.next = e.prev = e.teardown = e.ctx = e.deps = e.fn = e.nodes = e.ac = e.b = null;
}
function wi(e, t) {
for (; e !== null; ) {
var r = e === t ? null : /* @__PURE__ */ pe(e);
e.remove(), e = r;
}
}
function Vn(e) {
var t = e.parent, r = e.prev, n = e.next;
r !== null && (r.next = n), n !== null && (n.prev = r), t !== null && (t.first === e && (t.first = n), t.last === e && (t.last = r));
}
function De(e, t, r = !0) {
var n = [];
e.f |= gr, jn(e, n, !0);
var s = () => {
r && z(e), t && t();
}, i = n.length;
if (i > 0) {
var l = () => --i || s();
for (var a of n)
a.out(l);
} else
s();
}
function jn(e, t, r) {
if ((e.f & j) === 0) {
e.f ^= j;
var n = e.nodes && e.nodes.t;
if (n !== null)
for (const a of n)
(a.is_global || r) && t.push(a);
for (var s = e.first; s !== null; ) {
var i = s.next;
if ((s.f & de) === 0) {
var l = (s.f & Ze) !== 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 & Q) !== 0 && (e.f & re) !== 0;
jn(s, t, l ? r : !1);
}
s = i;
}
}
}
function It(e) {
e.f &= ~gr, zn(e, !0);
}
function zn(e, t) {
if ((e.f & gr) === 0 && (e.f & j) !== 0) {
e.f ^= j, (e.f & O) === 0 && (T(e, N), ye.ensure().schedule(e));
for (var r = e.first; r !== null; ) {
var n = r.next, s = (r.f & Ze) !== 0 || (r.f & Q) !== 0;
zn(r, s ? t : !1), r = n;
}
var i = e.nodes && e.nodes.t;
if (i !== null)
for (const l of i)
(l.is_global || t) && l.in();
}
}
function Cr(e, t) {
if (e.nodes)
for (var r = e.nodes.start, n = e.nodes.end; r !== null; ) {
var s = r === n ? null : /* @__PURE__ */ pe(r);
t.append(r), r = s;
}
}
let qt = !1, ke = !1;
function Wr(e) {
ke = e;
}
let w = null, se = !1;
function ee(e) {
w = e;
}
let g = null;
function he(e) {
g = e;
}
let ce = null;
function yi(e) {
w !== null && (ce ??= /* @__PURE__ */ new Set()).add(e);
}
let H = null, G = 0, J = null;
function ki(e) {
J = e;
}
let Hn = 1, Me = 0, Ie = Me;
function Jr(e) {
Ie = e;
}
function Un() {
return ++Hn;
}
function gt(e) {
var t = e.f;
if ((t & N) !== 0)
return !0;
if (t & I && (e.f &= ~Pe), (t & ie) !== 0) {
for (var r = (
/** @type {Value[]} */
e.deps
), n = r.length, s = 0; s < n; s++) {
var i = r[s];
if (gt(
/** @type {Derived} */
i
) && $n(
/** @type {Derived} */
i
), i.wv > e.wv)
return !0;
}
(t & Z) !== 0 && // During time traveling we don't want to reset the status so that
// traversal of the graph in the other batches still happens
ne === null && T(e, O);
}
return !1;
}
function Bn(e, t, r = !0) {
var n = e.reactions;
if (n !== null && !(ce !== null && ce.has(e)))
for (var s = 0; s < n.length; s++) {
var i = n[s];
(i.f & I) !== 0 ? Bn(
/** @type {Derived} */
i,
t,
!1
) : t === i && (r ? T(i, N) : (i.f & O) !== 0 && T(i, ie), qr(
/** @type {Effect} */
i
));
}
}
function Yn(e) {
var t = H, r = G, n = J, s = w, i = ce, l = L, a = se, o = Ie, u = e.f;
H = /** @type {null | Value[]} */
null, G = 0, J = null, w = (u & (Q | de)) === 0 ? e : null, ce = null, Qe(e.ctx), se = !1, Ie = ++Me, e.ac !== null && (bt(() => {
e.ac.abort(pt);
}), e.ac = null);
try {
e.f |= Rt;
var c = (
/** @type {Function} */
e.fn
), d = c();
e.f |= Ve;
var v = Xr(e);
if (bn() && J !== null && !se && v !== null && (e.f & (I | ie | N)) === 0)
for (var h = 0; h < /** @type {Source[]} */
J.length; h++)
Bn(
J[h],
/** @type {Effect} */
e
);
if (s !== null && s !== e) {
if (Me++, s.deps !== null)
for (let f = 0; f < r; f += 1)
s.deps[f].rv = Me;
if (t !== null)
for (const f of t)
f.rv = Me;
J !== null && (n === null ? n = J : n.push(.../** @type {Source[]} */
J));
}
return (e.f & Ae) !== 0 && (e.f ^= Ae), d;
} catch (f) {
return Xr(e), di(f);
} finally {
e.f ^= Rt, H = t, G = r, J = n, w = s, ce = i, Qe(l), se = a, Ie = o;
}
}
function Xr(e) {
var t = e.deps, r = b?.is_fork;
if (H !== null) {
var n;
if (r || ht(e, G), t !== null && G > 0)
for (t.length = G + H.length, n = 0; n < H.length; n++)
t[G + n] = H[n];
else
e.deps = t = H;
if (Sr() && (e.f & Z) !== 0)
for (n = G; n < t.length; n++)
(t[n].reactions ??= []).push(e);
} else !r && t !== null && G < t.length && (ht(e, G), t.length = G);
return t;
}
function $i(e, t) {
let r = t.reactions;
if (r !== null) {
var n = xs.call(r, e);
if (n !== -1) {
var s = r.length - 1;
s === 0 ? r = t.reactions = null : (r[n] = r[s], r.pop());
}
}
if (r === null && (t.f & I) !== 0 && // 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
(H === null || !St.call(H, t))) {
var i = (
/** @type {Derived} */
t
);
(i.f & Z) !== 0 && (i.f ^= Z, i.f &= ~Pe), i.v !== R && wr(i), i.ac !== null && bt(() => {
i.ac.abort(pt), i.ac = null, T(i, N);
}), oi(i), ht(i, 0);
}
}
function ht(e, t) {
var r = e.deps;
if (r !== null)
for (var n = t; n < r.length; n++)
$i(e, r[n]);
}
function tt(e) {
var t = e.f;
if ((t & U) === 0) {
T(e, O);
var r = g, n = qt;
g = e, qt = (t & (Q | de)) === 0;
try {
(t & (re | on)) !== 0 ? mi(e) : Nr(e), Fn(e);
var s = Yn(e);
e.teardown = typeof s == "function" ? s : null, e.wv = Hn;
var i;
sn && Qs && (e.f & N) !== 0 && e.deps;
} finally {
qt = n, g = r;
}
}
}
async function Ei() {
await Promise.resolve(), $r();
}
function p(e) {
var t = e.f, r = (t & I) !== 0;
if (w !== null && !se) {
var n = g !== null && (g.f & U) !== 0;
if (!n && (ce === null || !ce.has(e))) {
var s = w.deps;
if ((w.f & Rt) !== 0)
e.rv < Me && (e.rv = Me, H === null && s !== null && s[G] === e ? G++ : H === null ? H = [e] : H.push(e));
else {
w.deps ??= [], St.call(w.deps, e) || w.deps.push(e);
var i = e.reactions;
i === null ? e.reactions = [w] : St.call(i, w) || i.push(w);
}
}
}
if (ke && fe.has(e))
return fe.get(e);
if (r) {
var l = (
/** @type {Derived} */
e
);
if (ke) {
var a = l.v;
return ((l.f & O) === 0 && l.reactions !== null || Kn(l)) && (a = kr(l)), fe.set(l, a), a;
}
var o = (l.f & Z) === 0 && !se && w !== null && (qt || (w.f & Z) !== 0), u = (l.f & Ve) === 0;
gt(l) && (o && (l.f |= Z), $n(l)), o && !u && (En(l), Gn(l));
}
if (ne?.has(e))
return ne.get(e);
if ((e.f & Ae) !== 0)
throw e.v;
return e.v;
}
function Gn(e) {
if (e.f |= Z, e.deps !== null)
for (const t of e.deps)
(t.reactions ??= []).push(e), (t.f & I) !== 0 && (t.f & Z) === 0 && (En(
/** @type {Derived} */
t
), Gn(
/** @type {Derived} */
t
));
}
function Kn(e) {
if (e.v === R) return !0;
if (e.deps === null) return !1;
for (const t of e.deps)
if (fe.has(t) || (t.f & I) !== 0 && Kn(
/** @type {Derived} */
t
))
return !0;
return !1;
}
function Ht(e) {
var t = se;
try {
return se = !0, e();
} finally {
se = t;
}
}
const ot = /* @__PURE__ */ Symbol("events"), Wn = /* @__PURE__ */ new Set(), vr = /* @__PURE__ */ new Set();
function xe(e, t, r) {
(t[ot] ??= {})[e] = r;
}
function qi(e) {
for (var t = 0; t < e.length; t++)
Wn.add(e[t]);
for (var r of vr)
r(e);
}
let er = null, tr = !1;
function Zr(e) {
var t = this, r = (
/** @type {Node} */
t.ownerDocument
), n = e.type, s = e.composedPath?.() || [], i = (
/** @type {null | Element} */
s[0] || e.target
);
er = e, tr || (tr = !0, setTimeout(() => {
tr = !1, er = null;
}));
var l = 0, a = er === e && e[ot];
if (a) {
var o = s.indexOf(a);
if (o !== -1 && (t === document || t === /** @type {any} */
window)) {
e[ot] = t;
return;
}
var u = s.indexOf(t);
if (u === -1)
return;
o <= u && (l = o);
}
if (i = /** @type {Element} */
s[l] || e.target, i !== t) {
vt(e, "currentTarget", {
configurable: !0,
get() {
return i || r;
}
});
var c = w, d = g;
ee(null), he(null);
try {
for (var v, h = []; i !== null && i !== t; ) {
try {
var f = i[ot]?.[n];
f != 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) && f.call(i, e);
} catch ($) {
v ? h.push($) : v = $;
}
if (e.cancelBubble) break;
l++, i = l < s.length ? (
/** @type {Element} */
s[l]
) : null;
}
if (v) {
for (let $ of h)
queueMicrotask(() => {
throw $;
});
throw v;
}
} finally {
e[ot] = t, delete e.currentTarget, ee(c), he(d);
}
}
}
const xi = (
// We gotta write it like this because after downleveling the pure comment may end up in the wrong location
globalThis?.window?.trustedTypes && /* @__PURE__ */ globalThis.window.trustedTypes.createPolicy("svelte-trusted-html", {
/** @param {string} html */
createHTML: (e) => e
})
);
function Ti(e) {
return (
/** @type {string} */
xi?.createHTML(e) ?? e
);
}
function Si(e) {
var t = xr("template");
return t.innerHTML = Ti(e.replaceAll("<!>", "<!---->")), t.content;
}
function xt(e, t) {
var r = (
/** @type {Effect} */
g
);
r.nodes === null && (r.nodes = { start: e, end: t, a: null, t: null });
}
// @__NO_SIDE_EFFECTS__
function te(e, t) {
var r = (t & $s) !== 0, n = (t & Es) !== 0, s, i = !e.startsWith("<!>");
return () => {
if (y)
return xt(k, null), k;
s === void 0 && (s = Si(i ? e : "<!>" + e), r || (s = /** @type {TemplateNode} */
/* @__PURE__ */ Fe(s)));
var l = (
/** @type {TemplateNode} */
n || Cn ? document.importNode(s, !0) : s.cloneNode(!0)
);
if (r) {
var a = (
/** @type {TemplateNode} */
/* @__PURE__ */ Fe(l)
), o = (
/** @type {TemplateNode} */
l.lastChild
);
xt(a, o);
} else
xt(l, l);
return l;
};
}
function Y(e, t) {
if (y) {
var r = (
/** @type {Effect & { nodes: EffectNodes }} */
g
);
((r.f & Ve) === 0 || r.nodes.end === null) && (r.nodes.end = k), jt();
return;
}
e !== null && e.before(
/** @type {Node} */
t
);
}
const Ai = ["touchstart", "touchmove"];
function Ni(e) {
return Ai.includes(e);
}
function Ci(e) {
let t = 0, r = Le(0), n;
return () => {
Sr() && (p(r), zt(() => (t === 0 && (n = Ht(() => e(() => dt(r)))), t += 1, () => {
Se(() => {
t -= 1, t === 0 && (n?.(), n = void 0, dt(r));
});
})));
};
}
var Ri = Ze | je;
function Oi(e, t, r, n) {
new Mi(e, t, r, n);
}
class Mi {
/** @type {Boundary | null} */
parent;
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}
*/
transform_error;
/** @type {TemplateNode} */
#e;
/** @type {TemplateNode | null} */
#t = y ? k : null;
/** @type {BoundaryProps} */
#r;
/** @type {((anchor: Node) => void)} */
#o;
/** @type {Effect} */
#s;
/** @type {Effect | null} */
#a = null;
/** @type {Effect | null} */
#n = null;
/** @type {Effect | null} */
#l = null;
/** @type {DocumentFragment | null} */
#i = null;
#p = 0;
#u = 0;
#f = !1;
/** @type {Set<Effect>} */
#d = /* @__PURE__ */ new Set();
/** @type {Set<Effect>} */
#_ = /* @__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<number> | null}
*/
#c = null;
#m = Ci(() => (this.#c = Le(this.#p), () => {
this.#c = null;
}));
/**
* @param {TemplateNode} node
* @param {BoundaryProps} props
* @param {((anchor: Node) => void)} children
* @param {((error: unknown) => unknown) | undefined} [transform_error]
*/
constructor(t, r, n, s) {
this.#e = t, this.#r = r, this.#o = (i) => {
var l = (
/** @type {Effect} */
g
);
l.b = this, l.f |= lr, n(i);
}, this.parent = /** @type {Effect} */
g.b, this.transform_error = s ?? this.parent?.transform_error ?? ((i) => i), this.#s = Ar(() => {
if (y) {
const i = (
/** @type {Comment} */
this.#t
);
jt();
const l = i.data === _r;
if (i.data.startsWith(Hr)) {
const o = JSON.parse(i.data.slice(Hr.length));
this.#w(o);
} else l ? this.#k() : this.#b();
} else
this.#v();
}, Ri), y && (this.#e = k);
}
#b() {
try {
this.#a = X(() => this.#o(this.#e));
} catch (t) {
this.error(t);
}
}
/**
* @param {unknown} error The deserialized error from the server's hydration comment
*/
#w(t) {
const r = this.#r.failed, { reset: n, invoke_onerror: s } = this.#y(t);
Se(s), r && (this.#l = X(() => {
r(
this.#e,
() => t,
() => n
);
}));
}
/**
* Creates the `reset` function for a failed boundary, along with a function
* that invokes `onerror` with it (if provided)
* @param {unknown} error
* @returns {{ reset: () => void, invoke_onerror: () => void }}
*/
#y(t) {
var r = !1, n = !1;
const s = () => {
if (r) {
Fs();
return;
}
r = !0, n && Zs(), this.#l !== null && De(this.#l, () => {
this.#l = null;
}), this.#h(() => {
this.#v();
});
};
return { reset: s, invoke_onerror: () => {
try {
n = !0, this.#r.onerror?.(t, s), n = !1;
} catch (l) {
ue(l, this.#s && this.#s.parent);
}
} };
}
#k() {
const t = this.#r.pending;
t && (this.is_pending = !0, this.#n = X(() => t(this.#e)), Se(() => {
var r = this.#i = document.createDocumentFragment(), n = ve(), s = !1;
if (r.append(n), this.#a = this.#h(() => {
try {
return X(() => this.#o(n));
} catch (i) {
try {
this.error(i), s = !0;
} catch (l) {
ue(l, this.#s.parent);
}
return null;
}
}), this.#a === null) {
this.#i = null, s && this.#g(
/** @type {Batch} */
b
);
return;
}
this.#u === 0 && (this.#e.before(r), this.#i = null, De(
/** @type {Effect} */
this.#n,
() => {
this.#n = null;
}
), this.#g(
/** @type {Batch} */
b
));
}));
}
#v() {
try {
if (this.is_pending = this.has_pending_snippet(), this.#u = 0, this.#p = 0, this.#a = X(() => {
this.#o(this.#e);
}), this.#u > 0) {
var t = this.#i = document.createDocumentFragment();
Cr(this.#a, t);
const r = (
/** @type {(anchor: Node) => void} */
this.#r.pending
);
this.#n = X(() => r(this.#e));
} else
this.#g(
/** @type {Batch} */
b
);
} catch (r) {
this.error(r);
}
}
/**
* @param {Batch} batch
*/
#g(t) {
this.is_pending = !1, t.transfer_effects(this.#d, this.#_);
}
/**
* Defer an effect inside a pending boundary until the boundary resolves
* @param {Effect} effect
*/
defer_effect(t) {
wn(t, this.#d, this.#_);
}
/**
* 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 !!this.#r.pending;
}
/**
* @template T
* @param {() => T} fn
*/
#h(t) {
var r = g, n = w, s = L;
he(this.#s), ee(this.#s), Qe(this.#s.ctx);
try {
return ye.ensure(), t();
} finally {
he(r), ee(n), Qe(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
* @param {Batch} batch
*/
#$(t, r) {
if (!this.has_pending_snippet()) {
this.parent && this.parent.#$(t, r);
return;
}
this.#u += t, this.#u === 0 && (this.#g(r), this.#n && De(this.#n, () => {
this.#n = null;
}), this.#i && (this.#e.before(this.#i), this.#i = null));
}
/**
* 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
* @param {Batch} batch
*/
update_pending_count(t, r) {
this.#$(t, r), this.#p += t, !(!this.#c || this.#f) && (this.#f = !0, Se(() => {
this.#f = !1, this.#c && et(this.#c, this.#p);
}));
}
get_effect_pending() {
return this.#m(), p(
/** @type {Source<number>} */
this.#c
);
}
/** @param {unknown} error */
error(t) {
if (!this.#r.onerror && !this.#r.failed)
throw t;
b?.is_fork ? (this.#a && b.skip_effect(this.#a), this.#n && b.skip_effect(this.#n), this.#l && b.skip_effect(this.#l), b.oncommit(() => {
this.#E(t);
})) : this.#E(t);
}
/**
* @param {unknown} error
*/
#E(t) {
this.#a && (z(this.#a), this.#a = null), this.#n && (z(this.#n), this.#n = null), this.#l && (z(this.#l), this.#l = null), y && (K(
/** @type {TemplateNode} */
this.#t
), cn(), K(Ot()));
let r = this.#r.failed;
const n = (s) => {
const { reset: i, invoke_onerror: l } = this.#y(s);
l(), r && (this.#l = this.#h(() => {
try {
return X(() => {
var a = (
/** @type {Effect} */
g
);
a.b = this, a.f |= lr, r(
this.#e,
() => s,
() => i
);
});
} catch (a) {
return ue(
a,
/** @type {Effect} */
this.#s.parent
), null;
}
}));
};
Se(() => {
var s;
try {
s = this.transform_error(t);
} catch (i) {
ue(i, this.#s && this.#s.parent);
return;
}
s !== null && typeof s == "object" && typeof /** @type {any} */
s.then == "function" ? s.then(
n,
/** @param {unknown} e */
(i) => ue(i, this.#s && this.#s.parent)
) : n(s);
});
}
}
function Re(e, t) {
var r = t == null ? "" : typeof t == "object" ? `${t}` : t;
r !== /** @type {any} */
(e[ur] ??= e.nodeValue) && (e[ur] = r, e.nodeValue = `${r}`);
}
function Jn(e, t) {
return Xn(e, t);
}
function Di(e, t) {
dr(), t.intro = t.intro ?? !1;
const r = t.target, n = y, s = k;
try {
for (var i = /* @__PURE__ */ Fe(r); i && (i.nodeType !== _t || /** @type {Comment} */
i.data !== nn); )
i = /* @__PURE__ */ pe(i);
if (!i)
throw Je;
we(!0), K(
/** @type {Comment} */
i
);
const l = Xn(e, { ...t, anchor: i });
return we(!1), /** @type {Exports} */
l;
} catch (l) {
if (l instanceof Error && l.message.split(`
`).some((a) => a.startsWith("https://svelte.dev/e/")))
throw l;
return l !== Je && console.warn("Failed to hydrate: ", l), t.recover === !1 && Ks(), dr(), Mn(r), we(!1), Jn(e, t);
} finally {
we(n), K(s);
}
}
const kt = /* @__PURE__ */ new Map();
function Xn(e, { target: t, anchor: r, props: n = {}, events: s, context: i, intro: l = !0, transformError: a }) {
dr();
var o = void 0, u = bi(() => {
var c = r ?? t.appendChild(ve());
Oi(
/** @type {TemplateNode} */
c,
{
pending: () => {
}
},
(h) => {
pn({});
var f = (
/** @type {ComponentContext} */
L
);
if (i && (f.c = i), s && (n.$$events = s), y && xt(
/** @type {TemplateNode} */
h,
null
), o = e(h, n) || mr(), y && (g.nodes.end = k, k === null || k.nodeType !== _t || /** @type {Comment} */
k.data !== br))
throw Vt(), Je;
_n();
},
a
);
var d = /* @__PURE__ */ new Set(), v = (h) => {
for (var f = 0; f < h.length; f++) {
var $ = h[f];
if (!d.has($)) {
d.add($);
var C = Ni($);
for (const ae of [t, document]) {
var m = kt.get(ae);
m === void 0 && (m = /* @__PURE__ */ new Map(), kt.set(ae, m));
var S = m.get($);
S === void 0 ? (ae.addEventListener($, Zr, { passive: C }), m.set($, 1)) : m.set($, S + 1);
}
}
}
};
return v(Pt(Wn)), vr.add(v), () => {
for (var h of d)
for (const C of [t, document]) {
var f = (
/** @type {Map<string, number>} */
kt.get(C)
), $ = (
/** @type {number} */
f.get(h)
);
--$ == 0 ? (C.removeEventListener(h, Zr), f.delete(h), f.size === 0 && kt.delete(C)) : f.set(h, $);
}
vr.delete(v), c !== r && c.parentNode?.removeChild(c);
};
});
return hr.set(o, u), o;
}
let hr = /* @__PURE__ */ new WeakMap();
function Ii(e, t) {
const r = hr.get(e);
return r ? (hr.delete(e), r(t)) : Promise.resolve();
}
class Pi {
/** @type {TemplateNode} */
anchor;
/** @type {Map<Batch, Key>} */
#e = /* @__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<Key, Effect>}
*/
#t = /* @__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<Key, Branch>}
*/
#r = /* @__PURE__ */ new Map();
/**
* Keys of effects that are currently outroing
* @type {Set<Key>}
*/
#o = /* @__PURE__ */ new Set();
/**
* Whether to pause (i.e. outro) on change, or destroy immediately.
* This is necessary for `<svelte:element>`
*/
#s = !0;
/**
* @param {TemplateNode} anchor
* @param {boolean} transition
*/
constructor(t, r = !0) {
this.anchor = t, this.#s = r;
}
/**
* @param {Batch} batch
*/
#a = (t) => {
if (this.#e.has(t)) {
var r = (
/** @type {Key} */
this.#e.get(t)
), n = this.#t.get(r);
if (n)
It(n), this.#o.delete(r);
else {
var s = this.#r.get(r);
s && (It(s.effect), this.#t.set(r, s.effect), this.#r.delete(r), s.fragment.lastChild.remove(), this.anchor.before(s.fragment), n = s.effect);
}
for (const [i, l] of this.#e) {
if (this.#e.delete(i), i === t)
break;
const a = this.#r.get(l);
a && (z(a.effect), this.#r.delete(l));
}
for (const [i, l] of this.#t) {
if (i === r || this.#o.has(i)) continue;
const a = () => {
if (Array.from(this.#e.values()).includes(i)) {
var u = document.createDocumentFragment();
Cr(l, u), u.append(ve()), this.#r.set(i, { effect: l, fragment: u });
} else
z(l);
this.#o.delete(i), this.#t.delete(i);
};
this.#s || !n ? (this.#o.add(i), De(l, a, !1)) : a();
}
}
};
/**
* @param {Batch} batch
*/
#n = (t) => {
this.#e.delete(t);
const r = Array.from(this.#e.values());
for (const [n, s] of this.#r)
r.includes(n) || (z(s.effect), this.#r.delete(n));
};
/**
*
* @param {any} key
* @param {null | ((target: TemplateNode) => void)} fn
*/
ensure(t, r) {
var n = (
/** @type {Batch} */
b
), s = Dn();
if (r && !this.#t.has(t) && !this.#r.has(t))
if (s) {
var i = document.createDocumentFragment(), l = ve();
i.append(l), this.#r.set(t, {
effect: X(() => r(l)),
fragment: i
});
} else
this.#t.set(
t,
X(() => r(this.anchor))
);
if (this.#e.set(n, t), s) {
for (const [a, o] of this.#t)
a === t ? n.unskip_effect(o) : n.skip_effect(o);
for (const [a, o] of this.#r)
a === t ? n.unskip_effect(o.effect) : n.skip_effect(o.effect);
n.oncommit(this.#a), n.ondiscard(this.#n);
} else
y && (this.anchor = k), this.#a(n);
}
}
function Li(e) {
L === null && js(), In(() => {
const t = Ht(e);
if (typeof t == "function") return (
/** @type {() => void} */
t
);
});
}
function Ye(e, t, r = !1) {
var n;
y && (n = k, jt());
var s = new Pi(e), i = r ? Ze : 0;
function l(a, o) {
if (y) {
var u = dn(
/** @type {TemplateNode} */
n
);
if (a !== parseInt(u.substring(1))) {
var c = Ot();
K(c), s.anchor = c, we(!1), s.ensure(a, o), we(!0);
return;
}
}
s.ensure(a, o);
}
Ar(() => {
var a = !1;
t((o, u = 0) => {
a = !0, l(u, o);
}), a || l(-1, null);
}, i);
}
function Fi(e, t, r) {
for (var n = [], s = t.length, i, l = t.length, a = 0; a < s; a++) {
let d = t[a];
De(
d,
() => {
if (i) {
if (i.pending.delete(d), i.done.add(d), i.pending.size === 0) {
var v = (
/** @type {Set<EachOutroGroup>} */
e.outrogroups
);
pr(e, Pt(i.done)), v.delete(i), v.size === 0 && (e.outrogroups = null);
}
} else
l -= 1;
},
!1
);
}
if (l === 0) {
var o = n.length === 0 && r !== null && e.pending.size === 0;
if (o) {
var u = (
/** @type {Element} */
r
), c = (
/** @type {Element} */
u.parentNode
);
Mn(c), c.append(u), e.items.clear();
}
pr(e, t, !o);
} else
i = {
pending: new Set(t),
done: /* @__PURE__ */ new Set()
}, (e.outrogroups ??= /* @__PURE__ */ new Set()).add(i);
}
function pr(e, t, r = !0) {
var n;
if (e.pending.size > 0) {
n = /* @__PURE__ */ new Set();
for (const l of e.pending.values())
for (const a of l)
n.add(
/** @type {EachItem} */
e.items.get(a).e
);
}
for (var s = 0; s < t.length; s++) {
var i = t[s];
if (n?.has(i)) {
i.f |= me;
const l = document.createDocumentFragment();
Cr(i, l);
} else
z(t[s], r);
}
}
var Qr;
function Vi(e, t, r, n, s, i = null) {
var l = e, a = /* @__PURE__ */ new Map();
y && jt();
var o = null, u = /* @__PURE__ */ ai(() => {
var m = r();
return (
/** @type {V[]} */
an(m) ? m : m == null ? [] : Pt(m)
);
}), c, d = /* @__PURE__ */ new Map(), v = !0;
function h(m) {
(C.effect.f & U) === 0 && (C.pending.delete(m), C.fallback = o, ji(C, c, l, t, n), o !== null && (c.length === 0 ? (o.f & me) === 0 ? It(o) : (o.f ^= me, ut(o, null, l)) : De(o, () => {
o = null;
})));
}
function f(m) {
C.pending.delete(m);
}
var $ = Ar(() => {
c = /** @type {V[]} */
p(u);
var m = c.length;
let S = !1;
if (y) {
var ae = dn(l) === _r;
ae !== (m === 0) && (l = Ot(), K(l), we(!1), S = !0);
}
for (var le = /* @__PURE__ */ new Set(), F = (
/** @type {Batch} */
b
), $e = Dn(), oe = 0; oe < m; oe += 1) {
y && k.nodeType === _t && /** @type {Comment} */
k.data === br && (l = /** @type {Comment} */
k, S = !0, we(!1));
var V = c[oe], Ee = n(V, oe), B = v ? null : a.get(Ee);
B ? (B.v && et(B.v, V), B.i && et(B.i, oe), $e && F.unskip_effect(B.e)) : (B = zi(
a,
v ? l : Qr ??= ve(),
V,
Ee,
oe,
s,
t,
r
), v || (B.e.f |= me), a.set(Ee, B)), le.add(Ee);
}
if (m === 0 && i && !o && (v ? o = X(() => i(l)) : (o = X(() => i(Qr ??= ve())), o.f |= me)), m > le.size && Hs(), y && m > 0 && K(Ot()), !v)
if (d.set(F, le), $e) {
for (const [mt, wt] of a)
le.has(mt) || F.skip_effect(wt.e);
F.oncommit(h), F.ondiscard(f);
} else
h(F);
S && we(!0), p(u);
}), C = { effect: $, items: a, pending: d, outrogroups: null, fallback: o };
v = !1, y && (l = k);
}
function it(e) {
for (; e !== null && (e.f & Q) === 0; )
e = e.next;
return e;
}
function ji(e, t, r, n, s) {
var i = t.length, l = e.items, a = it(e.effect.first), o, u = null, c = [], d = [], v, h, f, $;
for ($ = 0; $ < i; $ += 1) {
if (v = t[$], h = s(v, $), f = /** @type {EachItem} */
l.get(h).e, e.outrogroups !== null)
for (const V of e.outrogroups)
V.pending.delete(f), V.done.delete(f);
if ((f.f & j) !== 0 && It(f), (f.f & me) !== 0)
if (f.f ^= me, f === a)
ut(f, null, r);
else {
var C = u ? u.next : a;
f === e.effect.last && (e.effect.last = f.prev), f.prev && (f.prev.next = f.next), f.next && (f.next.prev = f.prev), Te(e, u, f), Te(e, f, C), ut(f, C, r), u = f, c = [], d = [], a = it(u.next);
continue;
}
if (f !== a) {
if (o !== void 0 && o.has(f)) {
if (c.length < d.length) {
var m = d[0], S;
u = m.prev;
var ae = c[0], le = c[c.length - 1];
for (S = 0; S < c.length; S += 1)
ut(c[S], m, r);
for (S = 0; S < d.length; S += 1)
o.delete(d[S]);
Te(e, ae.prev, le.next), Te(e, u, ae), Te(e, le, m), a = m, u = le, $ -= 1, c = [], d = [];
} else
o.delete(f), ut(f, a, r), Te(e, f.prev, f.next), Te(e, f, u === null ? e.effect.first : u.next), Te(e, u, f), u = f;
continue;
}
for (c = [], d = []; a !== null && a !== f; )
(o ??= /* @__PURE__ */ new Set()).add(a), d.push(a), a = it(a.next);
if (a === null)
continue;
}
(f.f & me) === 0 && c.push(f), u = f, a = it(f.next);
}
if (e.outrogroups !== null) {
for (const V of e.outrogroups)
V.pending.size === 0 && (pr(e, Pt(V.done)), e.outrogroups?.delete(V));
e.outrogroups.size === 0 && (e.outrogroups = null);
}
if (a !== null || o !== void 0) {
var F = [];
if (o !== void 0)
for (f of o)
(f.f & j) === 0 && F.push(f);
for (; a !== null; )
(a.f & j) === 0 && a !== e.fallback && F.push(a), a = it(a.next);
var $e = F.length;
if ($e > 0) {
var oe = null;
Fi(e, F, oe);
}
}
}
function zi(e, t, r, n, s, i, l, a) {
var o = (l & ws) !== 0 ? (l & ks) === 0 ? /* @__PURE__ */ An(r, !1, !1) : Le(r) : null, u = (l & ys) !== 0 ? Le(s) : null;
return {
v: o,
i: u,
e: X(() => (i(t, o ?? r, u ?? s, a), () => {
e.delete(n);
}))
};
}
function ut(e, t, r) {
if (e.nodes)
for (var n = e.nodes.start, s = e.nodes.end, i = t && (t.f & me) === 0 ? (
/** @type {EffectNodes} */
t.nodes.start
) : r; n !== null; ) {
var l = (
/** @type {TemplateNode} */
/* @__PURE__ */ pe(n)
);
if (i.before(n), n === s)
return;
n = l;
}
}
function Te(e, t, r) {
t === null ? e.effect.first = r : t.next = r, r === null ? e.effect.last = t : r.prev = t;
}
function Hi(e, t) {
Ln(() => {
e = g?.parent?.nodes?.start ?? e;
var r = e.getRootNode(), n = (
/** @type {ShadowRoot} */
r.host ? (
/** @type {ShadowRoot} */
r
) : (
/** @type {Document} */
r.head ?? /** @type {Document} */
r.ownerDocument.head
)
);
if (!n.querySelector("#" + t.hash)) {
const s = xr("style");
s.id = t.hash, s.textContent = t.code, n.appendChild(s);
}
});
}
const en = [...`
\r\f \v\uFEFF`];
function Ui(e, t, r) {
var n = e == null ? "" : "" + e;
if (r) {
for (var s of Object.keys(r))
if (r[s])
n = n ? n + " " + s : s;
else if (n.length)
for (var i = s.length, l = 0; (l = n.indexOf(s, l)) >= 0; ) {
var a = l + i;
(l === 0 || en.includes(n[l - 1])) && (a === n.length || en.includes(n[a])) ? n = (l === 0 ? "" : n.substring(0, l)) + n.substring(a + 1) : l = a;
}
}
return n === "" ? null : n;
}
function tn(e, t, r, n, s, i) {
var l = (
/** @type {any} */
e[or]
);
if (y || l !== r || l === void 0) {
var a = Ui(r, n, i);
(!y || a !== e.getAttribute("class")) && (a == null ? e.removeAttribute("class") : e.className = a), e[or] = r;
} else if (i && s !== i)
for (var o in i) {
var u = !!i[o];
(s == null || u !== !!s[o]) && e.classList.toggle(o, u);
}
return i;
}
const Bi = /* @__PURE__ */ Symbol("is custom element"), Yi = /* @__PURE__ */ Symbol("is html"), Gi = Ps ? "link" : "LINK";
function rr(e) {
if (y) {
var t = !1, r = () => {
if (!t) {
if (t = !0, e.hasAttribute("value")) {
var n = e.value;
rn(e, "value", null), e.value = n;
}
if (e.hasAttribute("checked")) {
var s = e.checked;
rn(e, "checked", null), e.checked = s;
}
}
};
e[ft] = r, Se(r), yn();
}
}
function rn(e, t, r, n) {
var s = Ki(e);
y && (s[t] = e.getAttribute(t), t === "src" || t === "srcset" || t === "href" && e.nodeName === Gi) || s[t] !== (s[t] = r) && (t === "loading" && (e[Ds] = r), e.removeAttribute(t));
}
function Ki(e) {
return (
/** @type {Record<string | symbol, unknown>} **/
/** @type {any} */
e[fn] ??= {
[Bi]: e.nodeName.includes("-"),
[Yi]: e.namespaceURI === qs
}
);
}
function nr(e, t, r = t) {
var n = /* @__PURE__ */ new WeakSet();
ri(e, "input", async (s) => {
var i = s ? e.defaultValue : e.value;
if (i = sr(e) ? ir(i) : i, r(i), b !== null && n.add(b), await Ei(), i !== (i = t())) {
var l = e.selectionStart, a = e.selectionEnd, o = e.value.length;
if (e.value = i ?? "", a !== null) {
var u = e.value.length;
l === a && a === o && u > o ? (e.selectionStart = u, e.selectionEnd = u) : (e.selectionStart = l, e.selectionEnd = Math.min(a, u));
}
}
}), // If we are hydrating and the value has since changed,
// then use the updated value from the input instead.
(y && e.defaultValue !== e.value || // If defaultValue is set, then value == defaultValue
// TODO Svelte 6: remove input.value check and set to empty string?
Ht(t) == null && e.value) && (r(sr(e) ? ir(e.value) : e.value), b !== null && n.add(b)), zt(() => {
var s = t();
if (e === document.activeElement) {
var i = (
/** @type {Batch} */
b
);
if (n.has(i))
return;
}
sr(e) && s === ir(e.value) || e.type === "date" && !s && !e.value || s !== e.value && (e.value = s ?? "");
});
}
function sr(e) {
var t = e.type;
return t === "number" || t === "range";
}
function ir(e) {
return e === "" ? null : +e;
}
function ar(e, t) {
return e === t || e?.[$t] === t;
}
function Wi(e = mr(), t, r, n) {
var s = (
/** @type {ComponentContext} */
L.r
), i = (
/** @type {Effect} */
g
);
return Ln(() => {
var l, a;
return zt(() => {
l = a, a = [], Ht(() => {
ar(r(...a), e) || (t(e, ...a), l && ar(r(...l), e) && t(null, ...l));
});
}), () => {
let o = i;
for (; o !== s && o.parent !== null && o.parent.f & Nt; )
o = o.parent;
const u = () => {
a && ar(r(...a), e) && t(null, ...a);
}, c = o.teardown;
o.teardown = () => {
u(), c?.();
};
};
}), e;
}
function Ji(e, t, r, n) {
var s = (
/** @type {V} */
n
), i = !0, l = () => (i && (i = !1, s = /** @type {V} */
n), s), a;
a = /** @type {V} */
e[t], a === void 0 && n !== void 0 && (a = l());
var o;
o = () => {
var v = (
/** @type {V} */
e[t]
);
return v === void 0 ? l() : (i = !0, v);
};
var u = !1, c = /* @__PURE__ */ yr(() => (u = !1, o())), d = (
/** @type {Effect} */
g
);
return (
/** @type {() => V} */
(function(v, h) {
if (arguments.length > 0) {
const f = h ? p(c) : v;
return q(c, f), u = !0, s !== void 0 && (s = f), v;
}
return ke && u || (d.f & U) !== 0 ? c.v : p(c);
})
);
}
function Xi(e) {
return new Zi(e);
}
class Zi {
/** @type {any} */
#e;
/** @type {Record<string, any>} */
#t;
/**
* @param {ComponentConstructorOptions & {
* component: any;
* }} options
*/
constructor(t) {
var r = /* @__PURE__ */ new Map(), n = (i, l) => {
var a = /* @__PURE__ */ An(l, !1, !1);
return r.set(i, a), a;
};
const s = new Proxy(
{ ...t.props || {}, $$events: {} },
{
get(i, l) {
return p(r.get(l) ?? n(l, Reflect.get(i, l)));
},
has(i, l) {
return l === Ms ? !0 : (p(r.get(l) ?? n(l, Reflect.get(i, l))), Reflect.has(i, l));
},
set(i, l, a) {
return q(r.get(l) ?? n(l, a), a), Reflect.set(i, l, a);
}
}
);
this.#t = (t.hydrate ? Di : Jn)(t.component, {
target: t.target,
anchor: t.anchor,
props: s,
context: t.context,
intro: t.intro ?? !1,
recover: t.recover,
transformError: t.transformError
}), (!t?.props?.$$host || t.sync === !1) && $r(), this.#e = s.$$events;
for (const i of Object.keys(this.#t))
i === "$set" || i === "$destroy" || i === "$on" || vt(this, i, {
get() {
return this.#t[i];
},
/** @param {any} value */
set(l) {
this.#t[i] = l;
},
enumerable: !0
});
this.#t.$set = /** @param {Record<string, any>} next */
(i) => {
Object.assign(s, i);
}, this.#t.$destroy = () => {
Ii(this.#t);
};
}
/** @param {Record<string, any>} props */
$set(t) {
this.#t.$set(t);
}
/**
* @param {string} event
* @param {(...args: any[]) => any} callback
* @returns {any}
*/
$on(t, r) {
this.#e[t] = this.#e[t] || [];
const n = (...s) => r.call(this, ...s);
return this.#e[t].push(n), () => {
this.#e[t] = this.#e[t].filter(
/** @param {any} fn */
(s) => s !== n
);
};
}
$destroy() {
this.#t.$destroy();
}
}
let Zn;
typeof HTMLElement == "function" && (Zn = class extends HTMLElement {
/** The Svelte component constructor */
$$ctor;
/** Slots */
$$s;
/** @type {any} The Svelte component instance */
$$c;
/** Whether or not the custom element is connected */
$$cn = !1;
/** @type {Record<string, any>} Component props data */
$$d = {};
/** `true` if currently in the process of reflecting component props back to attributes */
$$r = !1;
/** @type {Record<string, CustomElementPropDefinition>} Props definition (name, reflected, type etc) */
$$p_d = {};
/** @type {Record<string, EventListenerOrEventListenerObject[]>} Event listeners */
$$l = {};
/** @type {Map<EventListenerOrEventListenerObject, Function>} Event listener unsubscribe functions */
$$l_u = /* @__PURE__ */ new Map();
/** @type {any} The managed render effect for reflecting attributes */
$$me;
/** @type {ShadowRoot | null} The ShadowRoot of the custom element */
$$shadowRoot = null;
/**
* @param {*} $$componentCtor
* @param {*} $$slots
* @param {ShadowRootInit | undefined} shadow_root_init
*/
constructor(e, t, r) {
super(), this.$$ctor = e, this.$$s = t, r && (this.$$shadowRoot = this.attachShadow(r));
}
/**
* @param {string} type
* @param {EventListenerOrEventListenerObject} listener
* @param {boolean | AddEventListenerOptions} [options]
*/
addEventListener(e, t, r) {
if (this.$$l[e] = this.$$l[e] || [], this.$$l[e].push(t), this.$$c) {
const n = this.$$c.$on(e, t);
this.$$l_u.set(t, n);
}
super.addEventListener(e, t, r);
}
/**
* @param {string} type
* @param {EventListenerOrEventListenerObject} listener
* @param {boolean | AddEventListenerOptions} [options]
*/
removeEventListener(e, t, r) {
if (super.removeEventListener(e, t, r), this.$$c) {
const n = this.$$l_u.get(t);
n && (n(), this.$$l_u.delete(t));
}
}
async connectedCallback() {
if (this.$$cn = !0, !this.$$c) {
let t = function(s) {
return (i) => {
const l = xr("slot");
s !== "default" && (l.name = s), Y(i, l);
};
};
var e = t;
if (await Promise.resolve(), !this.$$cn || this.$$c)
return;
const r = {}, n = Qi(this);
for (const s of this.$$s)
s in n && (s === "default" && !this.$$d.children ? (this.$$d.children = t(s), r.default = !0) : r[s] = t(s));
for (const s of this.attributes) {
const i = this.$$g_p(s.name);
i in this.$$d || (this.$$d[i] = Tt(i, s.value, this.$$p_d, "toProp"));
}
for (const s in this.$$p_d)
!(s in this.$$d) && this[s] !== void 0 && (this.$$d[s] = this[s], delete this[s]);
this.$$c = Xi({
component: this.$$ctor,
target: this.$$shadowRoot || this,
props: {
...this.$$d,
$$slots: r,
$$host: this
}
}), this.$$me = _i(() => {
zt(() => {
this.$$r = !0;
for (const s of At(this.$$c)) {
if (!this.$$p_d[s]?.reflect) continue;
this.$$d[s] = this.$$c[s];
const i = Tt(
s,
this.$$d[s],
this.$$p_d,
"toAttribute"
);
i == null ? this.removeAttribute(this.$$p_d[s].attribute || s) : this.setAttribute(this.$$p_d[s].attribute || s, i);
}
this.$$r = !1;
});
});
for (const s in this.$$l)
for (const i of this.$$l[s]) {
const l = this.$$c.$on(s, i);
this.$$l_u.set(i, l);
}
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(e, t, r) {
this.$$r || (e = this.$$g_p(e), this.$$d[e] = Tt(e, r, this.$$p_d, "toProp"), this.$$c?.$set({ [e]: this.$$d[e] }));
}
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(e) {
return At(this.$$p_d).find(
(t) => this.$$p_d[t].attribute === e || !this.$$p_d[t].attribute && t.toLowerCase() === e
) || e;
}
});
function Tt(e, t, r, n) {
const s = r[e]?.type;
if (t = s === "Boolean" && typeof t != "boolean" ? t != null : t, !n || !r[e])
return t;
if (n === "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;
// conversion already handled above
case "Number":
return t != null ? +t : t;
default:
return t;
}
}
function Qi(e) {
const t = {};
return e.childNodes.forEach((r) => {
t[
/** @type {Element} node */
r.slot || "default"
] = !0;
}), t;
}
function ea(e, t, r, n, s, i) {
let l = class extends Zn {
constructor() {
super(e, r, s), this.$$p_d = t;
}
static get observedAttributes() {
return At(t).map(
(a) => (t[a].attribute || a).toLowerCase()
);
}
};
return At(t).forEach((a) => {
vt(l.prototype, a, {
get() {
return this.$$c && a in this.$$c ? this.$$c[a] : this.$$d[a];
},
set(o) {
o = Tt(a, o, t), this.$$d[a] = o;
var u = this.$$c;
if (u) {
var c = Ke(u, a)?.get;
c ? u[a] = o : u.$set({ [a]: o });
}
}
});
}), n.forEach((a) => {
vt(l.prototype, a, {
get() {
return this.$$c?.[a];
}
});
}), e.element = /** @type {any} */
l, l;
}
function ta(e, t) {
e.dispatchEvent(new CustomEvent("barkstack:navigate", {
bubbles: !0,
composed: !0,
detail: { path: t }
}));
}
function ra(e, t, r) {
e.dispatchEvent(new CustomEvent("barkstack:notify", {
bubbles: !0,
composed: !0,
detail: { level: t, message: r }
}));
}
function na(e, t, r) {
e.dispatchEvent(new CustomEvent("barkstack:confirm", {
bubbles: !0,
composed: !0,
detail: { message: t, resolve: r }
}));
}
var sa = /* @__PURE__ */ te('<button class="back svelte-1q1dueb">← TreatVault overview</button>'), ia = /* @__PURE__ */ te('<div class="loading svelte-1q1dueb"><span class="svelte-1q1dueb"></span><span class="svelte-1q1dueb"></span><span class="svelte-1q1dueb"></span></div>'), aa = /* @__PURE__ */ te('<div class="error svelte-1q1dueb" role="alert"><strong class="svelte-1q1dueb">Live status is unavailable</strong><p class="svelte-1q1dueb"> </p><button class="svelte-1q1dueb">Try again</button></div>'), la = /* @__PURE__ */ te('<div class="warning svelte-1q1dueb" role="alert"><strong class="svelte-1q1dueb">Sync degraded</strong><p class="svelte-1q1dueb"> </p></div>'), oa = /* @__PURE__ */ te('<button class="svelte-1q1dueb">View audit →</button>'), ua = /* @__PURE__ */ te('<div class="empty svelte-1q1dueb">No secrets are stored yet.</div>'), fa = /* @__PURE__ */ te('<input type="password" placeholder="New value" autocomplete="new-password" class="svelte-1q1dueb"/> <button class="svelte-1q1dueb">Save</button> <button class="quiet svelte-1q1dueb">Cancel</button>', 1), ca = /* @__PURE__ */ te('<button class="quiet svelte-1q1dueb">Rotate</button> <button class="danger svelte-1q1dueb">Delete</button>', 1), da = /* @__PURE__ */ te('<div class="row svelte-1q1dueb" role="row"><strong class="svelte-1q1dueb"> </strong> <span><i class="svelte-1q1dueb"></i> </span> <span class="svelte-1q1dueb"> </span> <span class="actions svelte-1q1dueb"><!></span></div>'), va = /* @__PURE__ */ te('<div class="table svelte-1q1dueb" role="table" aria-label="Managed secrets"><div class="row header svelte-1q1dueb" role="row"><span class="svelte-1q1dueb">Name</span><span class="svelte-1q1dueb">Sync</span><span class="svelte-1q1dueb">Consumers</span><span class="svelte-1q1dueb">Actions</span></div> <!></div>'), ha = /* @__PURE__ */ te('<!> <div class="panel svelte-1q1dueb"><div class="panel-heading svelte-1q1dueb"><div class="svelte-1q1dueb"><span class="eyebrow svelte-1q1dueb">Add secret</span><h3 class="svelte-1q1dueb">New namespaced secret</h3></div></div> <div class="form svelte-1q1dueb"><label class="svelte-1q1dueb">Name<input type="text" placeholder="database_password" autocomplete="off" spellcheck="false" class="svelte-1q1dueb"/></label> <label class="svelte-1q1dueb">Value<input type="password" placeholder="Secret value" autocomplete="new-password" class="svelte-1q1dueb"/></label> <button class="svelte-1q1dueb">Store secret</button></div> <p class="hint svelte-1q1dueb">Values are sent to TreatVault and never displayed again. The encrypted file is the source of truth.</p></div> <div class="panel svelte-1q1dueb"><div class="panel-heading svelte-1q1dueb"><div class="svelte-1q1dueb"><span class="eyebrow svelte-1q1dueb">Vault contents</span><h3 class="svelte-1q1dueb"> </h3></div><!></div> <!></div>', 1), pa = /* @__PURE__ */ te('<section class="svelte-1q1dueb"><div class="intro svelte-1q1dueb"><div class="svelte-1q1dueb"><span class="eyebrow svelte-1q1dueb">Secret management</span> <h2 class="svelte-1q1dueb">TreatVault</h2> <p class="svelte-1q1dueb">Namespaced secrets, encrypted at rest, synced to Docker Swarm.</p></div> <div><span class="svelte-1q1dueb"></span><div class="svelte-1q1dueb"><small class="svelte-1q1dueb">Sync state</small><strong class="svelte-1q1dueb"> </strong></div></div></div> <!> <!></section>');
const _a = {
hash: "svelte-1q1dueb",
code: `:host {display:block;color:var(--bark-text, #edf3fb);font-family:var(--bark-font-sans, system-ui, sans-serif);}.svelte-1q1dueb {box-sizing:border-box;}section.svelte-1q1dueb {display:grid;gap:var(--bark-space-5, 1.5rem);}.intro.svelte-1q1dueb {display:flex;justify-content:space-between;align-items:flex-start;gap:var(--bark-space-5, 1.5rem);}.eyebrow.svelte-1q1dueb {color:var(--bark-primary, #6ee7b7);font-size:.69rem;font-weight:800;letter-spacing:.12em;text-transform:uppercase;}h2.svelte-1q1dueb {margin:.55rem 0 .35rem;font-size:2.25rem;letter-spacing:-.05em;}h3.svelte-1q1dueb {margin:.4rem 0 0;font-size:1.15rem;}p.svelte-1q1dueb {margin:0;color:var(--bark-text-muted, #91a1b7);line-height:1.6;}.service-status.svelte-1q1dueb {display:flex;align-items:center;gap:.65rem;padding:.65rem .9rem;border:1px solid var(--bark-border, #27354a);border-radius:var(--bark-radius-md, .75rem);background:var(--bark-surface, #101827);}.service-status.svelte-1q1dueb > span:where(.svelte-1q1dueb) {width:.55rem;height:.55rem;border-radius:50%;background:var(--bark-success, #4ade80);box-shadow:0 0 0 5px color-mix(in srgb, var(--bark-success, #4ade80) 12%, transparent);}.service-status.offline.svelte-1q1dueb > span:where(.svelte-1q1dueb) {background:var(--bark-danger, #fb7185);}.service-status.svelte-1q1dueb small:where(.svelte-1q1dueb), .service-status.svelte-1q1dueb strong:where(.svelte-1q1dueb) {display:block;}.service-status.svelte-1q1dueb small:where(.svelte-1q1dueb) {color:var(--bark-text-muted, #91a1b7);font-size:.66rem;text-transform:uppercase;letter-spacing:.08em;}.back.svelte-1q1dueb {justify-self:start;border:0;background:none;color:var(--bark-text-muted, #91a1b7);cursor:pointer;padding:0;}.back.svelte-1q1dueb:hover {color:var(--bark-text, #edf3fb);}.panel.svelte-1q1dueb {border:1px solid var(--bark-border, #27354a);border-radius:var(--bark-radius-lg, 1rem);background:var(--bark-surface, #101827);overflow:hidden;}.panel-heading.svelte-1q1dueb {display:flex;align-items:center;justify-content:space-between;padding:var(--bark-space-5, 1.5rem);border-bottom:1px solid var(--bark-border, #27354a);}.panel-heading.svelte-1q1dueb button:where(.svelte-1q1dueb) {border:0;background:transparent;color:var(--bark-primary, #6ee7b7);cursor:pointer;}.form.svelte-1q1dueb {display:flex;gap:1rem;align-items:end;padding:var(--bark-space-5, 1.5rem);flex-wrap:wrap;}.form.svelte-1q1dueb label:where(.svelte-1q1dueb) {display:grid;gap:.4rem;font-size:.72rem;color:var(--bark-text-muted, #91a1b7);text-transform:uppercase;letter-spacing:.07em;}.form.svelte-1q1dueb input:where(.svelte-1q1dueb) {min-width:14rem;padding:.55rem .7rem;border:1px solid var(--bark-border, #27354a);border-radius:var(--bark-radius-sm, .45rem);background:var(--bark-surface-raised, #172235);color:var(--bark-text, #edf3fb);font-family:inherit;}.form.svelte-1q1dueb button:where(.svelte-1q1dueb) {padding:.55rem .9rem;border:1px solid var(--bark-primary, #6ee7b7);border-radius:var(--bark-radius-sm, .45rem);background:color-mix(in srgb, var(--bark-primary, #6ee7b7) 15%, transparent);color:var(--bark-text, #edf3fb);cursor:pointer;}.form.svelte-1q1dueb button:where(.svelte-1q1dueb):disabled {opacity:.5;cursor:default;}.hint.svelte-1q1dueb {padding:0 var(--bark-space-5, 1.5rem) var(--bark-space-4, 1rem);font-size:.78rem;}.row.svelte-1q1dueb {display:grid;grid-template-columns:1.4fr .8fr .9fr 1.8fr;gap:1rem;align-items:center;min-height:3.4rem;padding:.75rem var(--bark-space-5, 1.5rem);border-bottom:1px solid var(--bark-border, #27354a);font-size:.82rem;}.row.svelte-1q1dueb:last-child {border-bottom:0;}.row.header.svelte-1q1dueb {min-height:2.8rem;color:var(--bark-text-muted, #91a1b7);background:var(--bark-surface-raised, #172235);font-size:.68rem;font-weight:700;letter-spacing:.07em;text-transform:uppercase;}.ready.svelte-1q1dueb {color:var(--bark-success, #4ade80);}.pending.svelte-1q1dueb {color:var(--bark-warning, #fbbf24);}.ready.svelte-1q1dueb i:where(.svelte-1q1dueb), .pending.svelte-1q1dueb i:where(.svelte-1q1dueb) {display:inline-block;width:.4rem;height:.4rem;margin-right:.4rem;border-radius:50%;background:currentColor;}.actions.svelte-1q1dueb {display:flex;gap:.5rem;align-items:center;}.actions.svelte-1q1dueb input:where(.svelte-1q1dueb) {flex:1;min-width:8rem;padding:.4rem .6rem;border:1px solid var(--bark-border, #27354a);border-radius:var(--bark-radius-sm, .45rem);background:var(--bark-surface-raised, #172235);color:var(--bark-text, #edf3fb);}.actions.svelte-1q1dueb button:where(.svelte-1q1dueb) {padding:.4rem .65rem;border:1px solid var(--bark-border, #27354a);border-radius:var(--bark-radius-sm, .45rem);background:var(--bark-surface-raised, #172235);color:var(--bark-text, #edf3fb);cursor:pointer;}.actions.svelte-1q1dueb button.quiet:where(.svelte-1q1dueb) {background:transparent;}.actions.svelte-1q1dueb button.danger:where(.svelte-1q1dueb) {border-color:color-mix(in srgb, var(--bark-danger, #fb7185) 50%, var(--bark-border, #27354a));color:var(--bark-danger, #fb7185);}.actions.svelte-1q1dueb button:where(.svelte-1q1dueb):disabled {opacity:.5;cursor:default;}.empty.svelte-1q1dueb, .error.svelte-1q1dueb, .warning.svelte-1q1dueb {padding:2.5rem var(--bark-space-5, 1.5rem);text-align:center;color:var(--bark-text-muted, #91a1b7);}.warning.svelte-1q1dueb {border:1px solid color-mix(in srgb, var(--bark-warning, #fbbf24) 35%, var(--bark-border, #27354a));border-radius:var(--bark-radius-lg, 1rem);background:var(--bark-surface, #101827);text-align:left;}.warning.svelte-1q1dueb strong:where(.svelte-1q1dueb) {color:var(--bark-warning, #fbbf24);}.error.svelte-1q1dueb {border:1px solid color-mix(in srgb, var(--bark-danger, #fb7185) 30%, var(--bark-border, #27354a));border-radius:var(--bark-radius-lg, 1rem);background:var(--bark-surface, #101827);}.error.svelte-1q1dueb strong:where(.svelte-1q1dueb) {color:var(--bark-text, #edf3fb);}.error.svelte-1q1dueb button:where(.svelte-1q1dueb), .error.svelte-1q1dueb p:where(.svelte-1q1dueb) {margin:.5rem auto 0;}.error.svelte-1q1dueb button:where(.svelte-1q1dueb) {padding:.45rem .7rem;border:1px solid var(--bark-border, #27354a);border-radius:var(--bark-radius-sm, .45rem);background:var(--bark-surface-raised, #172235);color:var(--bark-text, #edf3fb);cursor:pointer;}.loading.svelte-1q1dueb {display:grid;gap:.8rem;padding:2rem;border:1px solid var(--bark-border, #27354a);border-radius:var(--bark-radius-lg, 1rem);background:var(--bark-surface, #101827);}.loading.svelte-1q1dueb span:where(.svelte-1q1dueb) {height:1rem;border-radius:.3rem;background:var(--bark-surface-raised, #172235); animation: svelte-1q1dueb-pulse 1.4s infinite;}.loading.svelte-1q1dueb span:where(.svelte-1q1dueb):nth-child(2) {width:65%;}.loading.svelte-1q1dueb span:where(.svelte-1q1dueb):nth-child(3) {width:40%;}
@keyframes svelte-1q1dueb-pulse { 50% { opacity: .4; } }
@media (max-width: 850px) {.intro.svelte-1q1dueb {flex-direction:column;}.row.svelte-1q1dueb {grid-template-columns:1fr;gap:.35rem;padding:1rem;}.row.header.svelte-1q1dueb {display:none;}.form.svelte-1q1dueb {flex-direction:column;align-items:stretch;}
}`
};
function ba(e, t) {
pn(t, !0), Hi(e, _a);
let r = Ji(t, "route", 7, "/"), n, s = /* @__PURE__ */ P(void 0), i = /* @__PURE__ */ P(!0), l = /* @__PURE__ */ P(""), a = /* @__PURE__ */ P(""), o = /* @__PURE__ */ P(""), u = /* @__PURE__ */ P(""), c = /* @__PURE__ */ P(""), d = /* @__PURE__ */ P(!1);
const v = /^[a-z][a-z0-9_]*$/, h = "/plugins/treatvault/api/secrets";
async function f() {
try {
const _ = await fetch(h, { headers: { Accept: "application/json" }, cache: "no-store" });
if (!_.ok) throw new Error(`API returned ${_.status}`);
q(s, await _.json(), !0), q(l, "");
} catch (_) {
q(l, _ instanceof Error ? _.message : "TreatVault is unavailable", !0);
} finally {
q(i, !1);
}
}
function $(_) {
ta(n, _);
}
function C(_) {
return v.test(_) && _.length <= 54;
}
function m(_, x) {
ra(n, _, x);
}
async function S() {
if (!C(p(a))) {
m("error", "Name must be lowercase letters, digits, or underscores");
return;
}
if (!p(o)) {
m("error", "Enter a secret value");
return;
}
await F(async () => {
const _ = await fetch(`${h}/${p(a)}`, {
method: "PUT",
headers: { "Content-Type": "application/json" },
body: JSON.stringify({ value: p(o) })
});
if (!_.ok) throw new Error(await $e(_));
m("success", `Secret ${p(a)} stored and synced`), q(a, ""), q(o, "");
});
}
async function ae(_) {
if (!p(c)) {
m("error", "Enter a new value");
return;
}
await F(async () => {
const x = await fetch(`${h}/${_}`, {
method: "PUT",
headers: { "Content-Type": "application/json" },
body: JSON.stringify({ value: p(c) })
});
if (!x.ok) throw new Error(await $e(x));
m("success", `Secret ${_} rotated`), q(u, ""), q(c, "");
});
}
function le(_) {
na(n, `Delete secret ${_}? Services still mounting it will keep their last mounted copy until restarted.`, async (x) => {
x && await F(async () => {
const qe = await fetch(`${h}/${_}`, { method: "DELETE" });
if (!qe.ok) throw new Error(await $e(qe));
m("success", `Secret ${_} deleted`);
});
});
}
async function F(_) {
q(d, !0);
try {
await _(), await f();
} catch (x) {
m("error", x instanceof Error ? x.message : "Operation failed");
} finally {
q(d, !1);
}
}
async function $e(_) {
try {
const x = await _.json();
if (x.error) return x.error;
} catch {
}
return `Request returned ${_.status}`;
}
In(() => {
const _ = setInterval(f, 5e3);
return () => clearInterval(_);
}), Li(f);
var oe = {
get route() {
return r();
},
set route(_ = "/") {
r(_), $r();
}
}, V = pa(), Ee = D(V), B = E(D(Ee), 2);
let mt;
var wt = E(D(B)), Qn = E(D(wt)), es = Be(Qn, !0);
M(wt), M(B), M(Ee);
var Rr = E(Ee, 2);
{
var ts = (_) => {
var x = sa();
xe("click", x, () => $("/treatvault")), Y(_, x);
};
Ye(Rr, (_) => {
r() !== "/" && _(ts);
});
}
var rs = E(Rr, 2);
{
var ns = (_) => {
var x = ia();
Y(_, x);
}, ss = (_) => {
var x = aa(), qe = E(D(x)), Ut = Be(qe, !0), rt = E(qe);
M(x), Ce(() => Re(Ut, p(l))), xe("click", rt, f), Y(_, x);
}, is = (_) => {
var x = ha(), qe = Qt(x);
{
var Ut = (A) => {
var W = la(), Wt = E(D(W)), nt = Be(Wt, !0);
M(W), Ce(() => Re(nt, p(s).error)), Y(A, W);
};
Ye(qe, (A) => {
p(s)?.error && A(Ut);
});
}
var rt = E(qe, 2), Or = E(D(rt), 2), Bt = D(Or), Mr = E(D(Bt));
rr(Mr), M(Bt);
var Yt = E(Bt, 2), Dr = E(D(Yt));
rr(Dr), M(Yt);
var Ir = E(Yt, 2);
M(Or), cn(2), M(rt);
var Pr = E(rt, 2), Gt = D(Pr), Kt = D(Gt), as = E(D(Kt)), ls = Be(as, !0);
M(Kt);
var os = E(Kt);
{
var us = (A) => {
var W = oa();
xe("click", W, () => $("/treatvault/audit")), Y(A, W);
};
Ye(os, (A) => {
r() === "/" && A(us);
});
}
M(Gt);
var fs = E(Gt, 2);
{
var cs = (A) => {
var W = ua();
Y(A, W);
}, ds = (A) => {
var W = va(), Wt = E(D(W), 2);
Vi(Wt, 17, () => p(s).secrets, (nt) => nt.name, (nt, be) => {
var Jt = da(), Lr = D(Jt), vs = Be(Lr, !0), yt = E(Lr, 2);
let Fr;
var hs = E(D(yt), 1, !0);
M(yt);
var Vr = E(yt, 2), ps = Be(Vr, !0), jr = E(Vr, 2), _s = D(jr);
{
var bs = (ze) => {
var st = fa(), Ne = Qt(st);
rr(Ne);
var He = E(Ne, 2), zr = E(He, 2);
Ce(() => {
He.disabled = p(d), zr.disabled = p(d);
}), nr(Ne, () => p(c), (ms) => q(c, ms)), xe("click", He, () => ae(p(be).name)), xe("click", zr, () => {
q(u, ""), q(c, "");
}), Y(ze, st);
}, gs = (ze) => {
var st = ca(), Ne = Qt(st), He = E(Ne, 2);
Ce(() => {
Ne.disabled = p(d), He.disabled = p(d);
}), xe("click", Ne, () => {
q(u, p(be).name, !0), q(c, "");
}), xe("click", He, () => le(p(be).name)), Y(ze, st);
};
Ye(_s, (ze) => {
p(u) === p(be).name ? ze(bs) : ze(gs, -1);
});
}
M(jr), M(Jt), Ce(() => {
Re(vs, p(be).name), Fr = tn(yt, 1, "svelte-1q1dueb", null, Fr, { ready: p(be).synced, pending: !p(be).synced }), Re(hs, p(be).synced ? "Synced" : "Pending"), Re(ps, p(be).inUse ? "In use" : "Unreferenced");
}), Y(nt, Jt);
}), M(W), Y(A, W);
};
Ye(fs, (A) => {
p(s)?.secrets.length ? A(ds, -1) : A(cs);
});
}
M(Pr), Ce(
(A) => {
Ir.disabled = p(d), Re(ls, A);
},
[
() => r().startsWith("/audit") ? "All managed secrets" : "Managed secrets"
]
), nr(Mr, () => p(a), (A) => q(a, A)), nr(Dr, () => p(o), (A) => q(o, A)), xe("click", Ir, S), Y(_, x);
};
Ye(rs, (_) => {
p(i) ? _(ns) : p(l) ? _(ss, 1) : _(is, -1);
});
}
return M(V), Wi(V, (_) => n = _, () => n), Ce(() => {
mt = tn(B, 1, "service-status svelte-1q1dueb", null, mt, { offline: !!p(l) || p(s)?.state !== "ready" }), Re(es, p(l) ? "Degraded" : p(s)?.state ?? "Connecting");
}), Y(e, V), _n(oe);
}
qi(["click"]);
customElements.define("barkstack-treatvault", ea(ba, { route: { reflect: !0, type: "String" } }, [], [], { mode: "open" }));