import { t as R } from "./defineProperty-8fd4b6d7.js";
import { a as ii, i as S, n as $, r as E, t as o } from "./classPrivateFieldGet2-0d1db22c.js";
import { d as xl, f as Sl, l as jr, o as Dr, p as Ml, u as zl } from "./dist-6d707927.js";
var Fr, qr, Be, Ht, Bt, He, Ae, Xt, qt, ve, et, dn, Ut, Mt, At, De, pe, L, Un, ut, vn, mt, be, nt, wt, Q, st, Kt, Zt, Gt, Ce, pn, gn, Lt, Fn, U, kt, Ot, it, ue, ln, on, qn, jt, gt;
typeof window < "u" && ((Fr = (qr = window).__svelte ?? (qr.__svelte = {})).v ?? (Fr.v = /* @__PURE__ */ new Set())).add("5");
var ye = {}, q = /* @__PURE__ */ Symbol("uninitialized"), Tl = "http://www.w3.org/1999/xhtml", li = Array.isArray, El = Array.prototype.indexOf, bn = Array.prototype.includes, On = Array.from, yn = Object.keys, $n = Object.defineProperty, ne = Object.getOwnPropertyDescriptor, Wl = Object.getOwnPropertyDescriptors, Il = Object.prototype, Ol = Array.prototype, oi = Object.getPrototypeOf, Br = Object.isExtensible, Al = () => {
};
function Cl(t) {
  for (var e = 0; e < t.length; e++) t[e]();
}
function si() {
  var t, e;
  return {
    promise: new Promise((n, r) => {
      t = n, e = r;
    }),
    resolve: t,
    reject: e
  };
}
var ct = 1024, vt = 2048, oe = 4096, rr = 8192, Nl = 16384, ir = 32768, Hr = 1 << 25, lr = 65536, Me = 1 << 19, Pl = 1 << 20, Ve = 1 << 25, Qe = 65536, Vr = 1 << 21, Rl = 1 << 22, kn = 1 << 23, Ue = /* @__PURE__ */ Symbol("$state"), ai = /* @__PURE__ */ Symbol("legacy props"), Ll = /* @__PURE__ */ Symbol(""), Kn = /* @__PURE__ */ Symbol("attributes"), Gn = /* @__PURE__ */ Symbol("class"), jl = /* @__PURE__ */ Symbol("style"), mn = /* @__PURE__ */ Symbol("text"), An = new class extends Error {
  constructor(...t) {
    super(...t), R(this, "name", "StaleReactionError"), R(this, "message", "The reaction that called `getAbortSignal()` was re-run or destroyed");
  }
}(), Dl = !!globalThis.document?.contentType && /* @__PURE__ */ globalThis.document.contentType.includes("xml");
function Fl() {
  throw Error("https://svelte.dev/e/async_derived_orphan");
}
function ql(t, e, n) {
  throw Error("https://svelte.dev/e/each_key_duplicate");
}
function Bl(t) {
  throw Error("https://svelte.dev/e/effect_in_teardown");
}
function Hl() {
  throw Error("https://svelte.dev/e/effect_in_unowned_derived");
}
function Vl(t) {
  throw Error("https://svelte.dev/e/effect_orphan");
}
function Ul() {
  throw Error("https://svelte.dev/e/effect_update_depth_exceeded");
}
function Kl() {
  throw Error("https://svelte.dev/e/hydration_failed");
}
function Gl(t) {
  throw Error("https://svelte.dev/e/props_invalid_value");
}
function Jl() {
  throw Error("https://svelte.dev/e/state_descriptors_fixed");
}
function Yl() {
  throw Error("https://svelte.dev/e/state_prototype_fixed");
}
function Ql() {
  throw Error("https://svelte.dev/e/state_unsafe_mutation");
}
function Xl() {
  throw Error("https://svelte.dev/e/svelte_boundary_reset_onerror");
}
function Zl() {
  console.warn("https://svelte.dev/e/derived_inert");
}
function Cn(t) {
  console.warn("https://svelte.dev/e/hydration_mismatch");
}
function to() {
  console.warn("https://svelte.dev/e/svelte_boundary_reset_noop");
}
var O = !1;
function Ct(t) {
  O = t;
}
var W;
function X(t) {
  if (t === null) throw Cn(), ye;
  return W = t;
}
function Nn() {
  return X(/* @__PURE__ */ Tt(W));
}
function fe(t) {
  if (O) {
    if (/* @__PURE__ */ Tt(W) !== null) throw Cn(), ye;
    W = t;
  }
}
function eo(t = 1) {
  if (O) {
    for (var e = t, n = W; e--; ) n = /* @__PURE__ */ Tt(n);
    W = n;
  }
}
function xn(t = !0) {
  for (var e = 0, n = W; ; ) {
    if (n.nodeType === 8) {
      var r = n.data;
      if (r === "]") {
        if (e === 0) return n;
        --e;
      } else (r === "[" || r === "[!" || r[0] === "[" && !isNaN(Number(r.slice(1)))) && (e += 1);
    }
    var i = /* @__PURE__ */ Tt(n);
    t && n.remove(), n = i;
  }
}
function ui(t) {
  if (!t || t.nodeType !== 8) throw Cn(), ye;
  return t.data;
}
function fi(t) {
  return t === this.v;
}
function no(t, e) {
  return t == t ? t !== e || typeof t == "object" && !!t || typeof t == "function" : e == e;
}
function ci(t) {
  return !no(t, this.v);
}
var Pt = !1, Pn = !1, F = null;
function $e(t) {
  F = t;
}
function hi(t, e = !1, n) {
  F = {
    p: F,
    i: !1,
    c: null,
    e: null,
    s: t,
    x: null,
    r: M,
    l: Pn && !e ? {
      s: null,
      u: null,
      $: []
    } : null
  };
}
function di(t) {
  var e = F, n = e.e;
  if (n !== null) {
    e.e = null;
    for (var r of n) Li(r);
  }
  return t !== void 0 && (e.x = t), e.i = !0, F = e.p, t ?? {};
}
function Xe() {
  return !Pn || F !== null && F.l === null;
}
var te = [];
function vi() {
  var t = te;
  te = [], Cl(t);
}
function Jt(t) {
  if (te.length === 0 && !Ke) {
    var e = te;
    queueMicrotask(() => {
      e === te && vi();
    });
  }
  te.push(t);
}
function ro() {
  for (; te.length > 0; ) vi();
}
function pi(t) {
  var e = M;
  if (e === null) return T.f |= kn, t;
  if (!(e.f & 32768) && !(e.f & 4)) throw t;
  Vt(t, e);
}
function Vt(t, e) {
  for (; e !== null; ) {
    if (e.f & 128) {
      if (!(e.f & 32768)) throw t;
      try {
        e.b.error(t);
        return;
      } catch (n) {
        t = n;
      }
    }
    e = e.parent;
  }
  throw t;
}
var io = ~(vt | oe | ct);
function j(t, e) {
  t.f = t.f & io | e;
}
function or(t) {
  t.f & 512 || t.deps === null ? j(t, ct) : j(t, oe);
}
function gi(t) {
  if (t !== null) for (let e of t) !(e.f & 2) || !(e.f & 65536) || (e.f ^= Qe, gi(e.deps));
}
function mi(t, e, n) {
  t.f & 2048 ? e.add(t) : t.f & 4096 && n.add(t), gi(t.deps), j(t, ct);
}
var lo = !1, sn = !1;
function oo(t) {
  var e = sn;
  try {
    return sn = !1, [t(), sn];
  } finally {
    sn = e;
  }
}
var Sn = null, ge = null, z = null, Jn = null, G = null, Yn = null, Ke = !1, Bn = !1, ke = null, Mn = null, wi = 0, so = 1, ze = (Be = /* @__PURE__ */ new WeakMap(), Ht = /* @__PURE__ */ new WeakMap(), Bt = /* @__PURE__ */ new WeakMap(), He = /* @__PURE__ */ new WeakMap(), Ae = /* @__PURE__ */ new WeakMap(), Xt = /* @__PURE__ */ new WeakMap(), qt = /* @__PURE__ */ new WeakMap(), ve = /* @__PURE__ */ new WeakMap(), et = /* @__PURE__ */ new WeakMap(), dn = /* @__PURE__ */ new WeakMap(), Ut = /* @__PURE__ */ new WeakMap(), Mt = /* @__PURE__ */ new WeakMap(), At = /* @__PURE__ */ new WeakMap(), De = /* @__PURE__ */ new WeakMap(), pe = /* @__PURE__ */ new WeakMap(), L = /* @__PURE__ */ new WeakSet(), Un = class _i {
  constructor() {
    ii(this, L), R(this, "id", so++), S(this, Be, !1), R(this, "linked", !0), S(this, Ht, null), S(this, Bt, null), R(this, "async_deriveds", /* @__PURE__ */ new Map()), R(this, "current", /* @__PURE__ */ new Map()), R(this, "previous", /* @__PURE__ */ new Map()), S(this, He, /* @__PURE__ */ new Set()), S(this, Ae, /* @__PURE__ */ new Set()), S(this, Xt, 0), S(this, qt, /* @__PURE__ */ new Map()), S(this, ve, null), S(this, et, []), S(this, dn, []), S(this, Ut, /* @__PURE__ */ new Set()), S(this, Mt, /* @__PURE__ */ new Set()), S(this, At, /* @__PURE__ */ new Map()), S(this, De, /* @__PURE__ */ new Set()), R(this, "is_fork", !1), S(this, pe, !1), ge === null ? Sn = ge = this : ($(Bt, ge, this), $(Ht, this, ge)), ge = this;
  }
  skip_effect(e) {
    o(At, this).has(e) || o(At, this).set(e, {
      d: [],
      m: []
    }), o(De, this).delete(e);
  }
  unskip_effect(e, n = (r) => this.schedule(r)) {
    var r = o(At, this).get(e);
    if (r) {
      o(At, this).delete(e);
      for (var i of r.d) j(i, vt), n(i);
      for (i of r.m) j(i, oe), n(i);
    }
    o(De, this).add(e);
  }
  capture(e, n, r = !1) {
    e.v !== q && !this.previous.has(e) && this.previous.set(e, e.v), e.f & 8388608 || (this.current.set(e, [n, r]), G?.set(e, n)), this.is_fork || (e.v = n);
  }
  activate() {
    z = this;
  }
  deactivate() {
    z = null, G = null;
  }
  flush() {
    try {
      Bn = !0, z = this, E(L, this, zn).call(this);
    } finally {
      wi = 0, Yn = null, ke = null, Mn = null, Bn = !1, z = null, G = null, re.clear();
    }
  }
  discard() {
    for (let e of o(Ae, this)) e(this);
    o(Ae, this).clear(), E(L, this, Tn).call(this), o(ve, this)?.resolve();
  }
  register_created_effect(e) {
    o(dn, this).push(e);
  }
  increment(e, n) {
    if ($(Xt, this, o(Xt, this) + 1), e) {
      let r = o(qt, this).get(n) ?? 0;
      o(qt, this).set(n, r + 1);
    }
  }
  decrement(e, n) {
    var r;
    if ($(Xt, this, (r = o(Xt, this), --r)), e) {
      let i = o(qt, this).get(n) ?? 0;
      i === 1 ? o(qt, this).delete(n) : o(qt, this).set(n, i - 1);
    }
    o(pe, this) || ($(pe, this, !0), Jt(() => {
      $(pe, this, !1), this.linked && this.flush();
    }));
  }
  transfer_effects(e, n) {
    for (let r of e) o(Ut, this).add(r);
    for (let r of n) o(Mt, this).add(r);
    e.clear(), n.clear();
  }
  oncommit(e) {
    o(He, this).add(e);
  }
  ondiscard(e) {
    o(Ae, this).add(e);
  }
  settled() {
    return (o(ve, this) ?? $(ve, this, si())).promise;
  }
  static ensure() {
    if (z === null) {
      let e = z = new _i();
      !Bn && !Ke && Jt(() => {
        o(Be, e) || e.flush();
      });
    }
    return z;
  }
  apply() {
    if (!Pt || !this.is_fork && o(Ht, this) === null && o(Bt, this) === null) {
      G = null;
      return;
    }
    G = /* @__PURE__ */ new Map();
    for (let [n, [r]] of this.current) G.set(n, r);
    for (let n = Sn; n !== null; n = o(Bt, n)) if (!(n === this || n.is_fork)) {
      var e = !1;
      if (n.id < this.id) {
        for (let [r, [, i]] of n.current) if (!i && this.current.has(r)) {
          e = !0;
          break;
        }
      }
      if (!e) for (let [r, i] of n.previous) G.has(r) || G.set(r, i);
    }
  }
  schedule(e) {
    if (Yn = e, e.b?.is_pending && e.f & 16777228 && !(e.f & 32768)) {
      e.b.defer_effect(e);
      return;
    }
    for (var n = e; n.parent !== null; ) {
      n = n.parent;
      var r = n.f;
      if (ke !== null && n === M && (Pt || (T === null || !(T.f & 2)) && !lo)) return;
      if (r & 96) {
        if (!(r & 1024)) return;
        n.f ^= ct;
      }
    }
    o(et, this).push(n);
  }
}, Un);
function Ur() {
  if (this.is_fork) return !0;
  for (let n of o(qt, this).keys()) {
    for (var t = n, e = !1; t.parent !== null; ) {
      if (o(At, this).has(t)) {
        e = !0;
        break;
      }
      t = t.parent;
    }
    if (!e) return !0;
  }
  return !1;
}
function zn() {
  $(Be, this, !0), wi++ > 1e3 && (E(L, this, Tn).call(this), co());
  for (let a of o(Ut, this)) o(Mt, this).delete(a), j(a, vt), this.schedule(a);
  for (let a of o(Mt, this)) j(a, oe), this.schedule(a);
  let t = o(et, this);
  $(et, this, []), this.apply();
  var e = ke = [], n = [], r = Mn = [];
  for (let a of t) try {
    E(L, this, bi).call(this, a, e, n);
  } catch (u) {
    throw ki(a), E(L, this, Ur).call(this) || this.discard(), u;
  }
  if (z = null, r.length > 0) {
    var i = Un.ensure();
    for (let a of r) i.schedule(a);
  }
  if (ke = null, Mn = null, E(L, this, Ur).call(this)) {
    E(L, this, Fe).call(this, n), E(L, this, Fe).call(this, e);
    for (let [a, u] of o(At, this)) $i(a, u);
    r.length > 0 && E(L, z, zn).call(z);
    return;
  }
  let l = E(L, this, ao).call(this);
  if (l) {
    E(L, this, Fe).call(this, n), E(L, this, Fe).call(this, e), E(L, l, uo).call(l, this);
    return;
  }
  o(Ut, this).clear(), o(Mt, this).clear();
  for (let a of o(He, this)) a(this);
  o(He, this).clear(), Jn = this, Kr(n), Kr(e), Jn = null, o(ve, this)?.resolve();
  var s = z;
  if (o(Xt, this) === 0 && (o(et, this).length === 0 || s !== null) && (E(L, this, Tn).call(this), Pt && (E(L, this, fo).call(this), z = s)), o(et, this).length > 0) if (s !== null) {
    let a = s;
    o(et, a).push(...o(et, this).filter((u) => !o(et, a).includes(u)));
  } else s = this;
  s !== null && E(L, s, zn).call(s);
}
function bi(t, e, n) {
  t.f ^= ct;
  for (var r = t.first; r !== null; ) {
    var i = r.f, l = (i & 96) != 0;
    if (!(l && i & 1024 || i & 8192 || o(At, this).has(r)) && r.fn !== null) {
      l ? r.f ^= ct : i & 4 ? e.push(r) : Pt && i & 16777224 ? n.push(r) : Ze(r) && (i & 16 && o(Mt, this).add(r), Se(r));
      var s = r.first;
      if (s !== null) {
        r = s;
        continue;
      }
    }
    for (; r !== null; ) {
      var a = r.next;
      if (a !== null) {
        r = a;
        break;
      }
      r = r.parent;
    }
  }
}
function ao() {
  for (var t = o(Ht, this); t !== null; ) {
    if (!t.is_fork) {
      for (let [e, [, n]] of this.current) if (t.current.has(e) && !n) return t;
    }
    t = o(Ht, t);
  }
  return null;
}
function uo(t) {
  for (let [n, r] of t.current) !this.previous.has(n) && t.previous.has(n) && this.previous.set(n, t.previous.get(n)), this.current.set(n, r);
  for (let [n, r] of t.async_deriveds) {
    let i = this.async_deriveds.get(n);
    i && r.promise.then(i.resolve).catch(i.reject);
  }
  this.transfer_effects(o(Ut, t), o(Mt, t));
  let e = (n) => {
    var r = n.reactions;
    if (r !== null) for (let s of r) {
      var i = s.f;
      if (i & 2) e(s);
      else {
        var l = s;
        i & 4194320 && !this.async_deriveds.has(l) && (o(Mt, this).delete(l), j(l, vt), this.schedule(l));
      }
    }
  };
  for (let n of this.current.keys()) e(n);
  this.oncommit(() => t.discard()), E(L, t, Tn).call(t), z = this, E(L, this, zn).call(this);
}
function Fe(t) {
  for (var e = 0; e < t.length; e += 1) mi(t[e], o(Ut, this), o(Mt, this));
}
function fo() {
  for (let f = Sn; f !== null; f = o(Bt, f)) {
    var t = f.id < this.id, e = [];
    for (let [h, [v, d]] of this.current) {
      if (f.current.has(h)) {
        var n = f.current.get(h)[0];
        if (t && v !== n) f.current.set(h, [v, d]);
        else continue;
      }
      e.push(h);
    }
    if (t) for (let [h, v] of this.async_deriveds) {
      let d = f.async_deriveds.get(h);
      d && v.promise.then(d.resolve).catch(d.reject);
    }
    if (o(Be, f)) {
      var r = [...f.current.keys()].filter((h) => !f.current.get(h)[1] && !this.current.has(h));
      if (r.length === 0) t && f.discard();
      else if (e.length > 0) {
        if (t) for (let h of o(De, this)) f.unskip_effect(h, (v) => {
          v.f & 4194320 ? f.schedule(v) : E(L, f, Fe).call(f, [v]);
        });
        f.activate();
        var i = /* @__PURE__ */ new Set(), l = /* @__PURE__ */ new Map();
        for (var s of e) yi(s, r, i, l);
        l = /* @__PURE__ */ new Map();
        var a = [...f.current].filter(([h, v]) => {
          let d = this.current.get(h);
          return d ? d[0] !== v[0] || d[1] !== v[1] : !0;
        }).map(([h]) => h);
        if (a.length > 0) for (let h of o(dn, this)) !(h.f & 155648) && sr(h, a, l) && (h.f & 4194320 ? (j(h, vt), f.schedule(h)) : o(Ut, f).add(h));
        if (o(et, f).length > 0 && !o(pe, f)) {
          f.apply();
          for (var u of o(et, f)) E(L, f, bi).call(f, u, [], []);
          $(et, f, []);
        }
        f.deactivate();
      }
    }
  }
}
function Tn() {
  if (this.linked) {
    var t = o(Ht, this), e = o(Bt, this);
    t === null ? Sn = e : $(Bt, t, e), e === null ? ge = t : $(Ht, e, t), this.linked = !1;
  }
}
function me(t) {
  var e = Ke;
  Ke = !0;
  try {
    var n;
    for (t && (z !== null && !z.is_fork && z.flush(), n = t()); ; ) {
      if (ro(), z === null) return n;
      z.flush();
    }
  } finally {
    Ke = e;
  }
}
function co() {
  try {
    Ul();
  } catch (t) {
    Vt(t, Yn);
  }
}
var St = null;
function Kr(t) {
  var e = t.length;
  if (e !== 0) {
    for (var n = 0; n < e; ) {
      var r = t[n++];
      if (!(r.f & 24576) && Ze(r) && (St = /* @__PURE__ */ new Set(), Se(r), r.deps === null && r.first === null && r.nodes === null && r.teardown === null && r.ac === null && Fi(r), St?.size > 0)) {
        re.clear();
        for (let i of St) {
          if (i.f & 24576) continue;
          let l = [i], s = i.parent;
          for (; s !== null; ) St.has(s) && (St.delete(s), l.push(s)), s = s.parent;
          for (let a = l.length - 1; a >= 0; a--) {
            let u = l[a];
            u.f & 24576 || Se(u);
          }
        }
        St.clear();
      }
    }
    St = null;
  }
}
function yi(t, e, n, r) {
  if (!n.has(t) && (n.add(t), t.reactions !== null)) for (let i of t.reactions) {
    let l = i.f;
    l & 2 ? yi(i, e, n, r) : l & 4194320 && !(l & 2048) && sr(i, e, r) && (j(i, vt), ar(i));
  }
}
function sr(t, e, n) {
  let r = n.get(t);
  if (r !== void 0) return r;
  if (t.deps !== null) for (let i of t.deps) {
    if (bn.call(e, i)) return !0;
    if (i.f & 2 && sr(i, e, n)) return n.set(i, !0), !0;
  }
  return n.set(t, !1), !1;
}
function ar(t) {
  z.schedule(t);
}
function $i(t, e) {
  if (!(t.f & 32 && t.f & 1024)) {
    t.f & 2048 ? e.d.push(t) : t.f & 4096 && e.m.push(t), j(t, ct);
    for (var n = t.first; n !== null; ) $i(n, e), n = n.next;
  }
}
function ki(t) {
  j(t, ct);
  for (var e = t.first; e !== null; ) ki(e), e = e.next;
}
function ho(t) {
  let e = 0, n = le(0), r;
  return () => {
    pr() && (c(n), gr(() => (e === 0 && (r = br(() => t(() => Ge(n)))), e += 1, () => {
      Jt(() => {
        --e, e === 0 && (r?.(), r = void 0, Ge(n));
      });
    })));
  };
}
var vo = lr | Me;
function po(t, e, n, r) {
  new go(t, e, n, r);
}
var go = (ut = /* @__PURE__ */ new WeakMap(), vn = /* @__PURE__ */ new WeakMap(), mt = /* @__PURE__ */ new WeakMap(), be = /* @__PURE__ */ new WeakMap(), nt = /* @__PURE__ */ new WeakMap(), wt = /* @__PURE__ */ new WeakMap(), Q = /* @__PURE__ */ new WeakMap(), st = /* @__PURE__ */ new WeakMap(), Kt = /* @__PURE__ */ new WeakMap(), Zt = /* @__PURE__ */ new WeakMap(), Gt = /* @__PURE__ */ new WeakMap(), Ce = /* @__PURE__ */ new WeakMap(), pn = /* @__PURE__ */ new WeakMap(), gn = /* @__PURE__ */ new WeakMap(), Lt = /* @__PURE__ */ new WeakMap(), Fn = /* @__PURE__ */ new WeakMap(), U = /* @__PURE__ */ new WeakSet(), class {
  constructor(t, e, n, r) {
    ii(this, U), R(this, "parent", void 0), R(this, "is_pending", !1), R(this, "transform_error", void 0), S(this, ut, void 0), S(this, vn, O ? W : null), S(this, mt, void 0), S(this, be, void 0), S(this, nt, void 0), S(this, wt, null), S(this, Q, null), S(this, st, null), S(this, Kt, null), S(this, Zt, 0), S(this, Gt, 0), S(this, Ce, !1), S(this, pn, /* @__PURE__ */ new Set()), S(this, gn, /* @__PURE__ */ new Set()), S(this, Lt, null), S(this, Fn, ho(() => ($(Lt, this, le(o(Zt, this))), () => {
      $(Lt, this, null);
    }))), $(ut, this, t), $(mt, this, e), $(be, this, (i) => {
      var l = M;
      l.b = this, l.f |= 128, n(i);
    }), this.parent = M.b, this.transform_error = r ?? this.parent?.transform_error ?? ((i) => i), $(nt, this, mr(() => {
      if (O) {
        let i = o(vn, this);
        Nn();
        let l = i.data === "[!";
        if (i.data.startsWith("[?")) {
          let s = JSON.parse(i.data.slice(2));
          E(U, this, wo).call(this, s);
        } else l ? E(U, this, _o).call(this) : E(U, this, mo).call(this);
      } else E(U, this, xi).call(this);
    }, vo)), O && $(ut, this, W);
  }
  defer_effect(t) {
    mi(t, o(pn, this), o(gn, this));
  }
  is_rendered() {
    return !this.is_pending && (!this.parent || this.parent.is_rendered());
  }
  has_pending_snippet() {
    return !!o(mt, this).pending;
  }
  update_pending_count(t, e) {
    E(U, this, Si).call(this, t, e), $(Zt, this, o(Zt, this) + t), !(!o(Lt, this) || o(Ce, this)) && ($(Ce, this, !0), Jt(() => {
      $(Ce, this, !1), o(Lt, this) && xe(o(Lt, this), o(Zt, this));
    }));
  }
  get_effect_pending() {
    return o(Fn, this).call(this), c(o(Lt, this));
  }
  error(t) {
    if (!o(mt, this).onerror && !o(mt, this).failed) throw t;
    z?.is_fork ? (o(wt, this) && z.skip_effect(o(wt, this)), o(Q, this) && z.skip_effect(o(Q, this)), o(st, this) && z.skip_effect(o(st, this)), z.oncommit(() => {
      E(U, this, Gr).call(this, t);
    })) : E(U, this, Gr).call(this, t);
  }
});
function mo() {
  try {
    $(wt, this, ht(() => o(be, this).call(this, o(ut, this))));
  } catch (t) {
    this.error(t);
  }
}
function wo(t) {
  let e = o(mt, this).failed;
  e && $(st, this, ht(() => {
    e(o(ut, this), () => t, () => () => {
    });
  }));
}
function _o() {
  let t = o(mt, this).pending;
  t && (this.is_pending = !0, $(Q, this, ht(() => t(o(ut, this)))), Jt(() => {
    var e = $(Kt, this, document.createDocumentFragment()), n = ft();
    e.append(n), $(wt, this, E(U, this, Qn).call(this, () => ht(() => o(be, this).call(this, n)))), o(Gt, this) === 0 && (o(ut, this).before(e), $(Kt, this, null), se(o(Q, this), () => {
      $(Q, this, null);
    }), E(U, this, ur).call(this, z));
  }));
}
function xi() {
  try {
    if (this.is_pending = this.has_pending_snippet(), $(Gt, this, 0), $(Zt, this, 0), $(wt, this, ht(() => {
      o(be, this).call(this, o(ut, this));
    })), o(Gt, this) > 0) {
      var t = $(Kt, this, document.createDocumentFragment());
      _r(o(wt, this), t);
      let e = o(mt, this).pending;
      $(Q, this, ht(() => e(o(ut, this))));
    } else E(U, this, ur).call(this, z);
  } catch (e) {
    this.error(e);
  }
}
function ur(t) {
  this.is_pending = !1, t.transfer_effects(o(pn, this), o(gn, this));
}
function Qn(t) {
  var e = M, n = T, r = F;
  zt(o(nt, this)), dt(o(nt, this)), $e(o(nt, this).ctx);
  try {
    return ze.ensure(), t();
  } catch (i) {
    return pi(i), null;
  } finally {
    zt(e), dt(n), $e(r);
  }
}
function Si(t, e) {
  if (!this.has_pending_snippet()) {
    var n;
    this.parent && E(U, n = this.parent, Si).call(n, t, e);
    return;
  }
  $(Gt, this, o(Gt, this) + t), o(Gt, this) === 0 && (E(U, this, ur).call(this, e), o(Q, this) && se(o(Q, this), () => {
    $(Q, this, null);
  }), o(Kt, this) && $(Kt, this, (o(ut, this).before(o(Kt, this)), null)));
}
function Gr(t) {
  o(wt, this) && $(wt, this, (J(o(wt, this)), null)), o(Q, this) && $(Q, this, (J(o(Q, this)), null)), o(st, this) && $(st, this, (J(o(st, this)), null)), O && (X(o(vn, this)), eo(), X(xn()));
  var e = o(mt, this).onerror;
  let n = o(mt, this).failed;
  var r = !1, i = !1;
  let l = () => {
    if (r) {
      to();
      return;
    }
    r = !0, i && Xl(), o(st, this) !== null && se(o(st, this), () => {
      $(st, this, null);
    }), E(U, this, Qn).call(this, () => {
      E(U, this, xi).call(this);
    });
  }, s = (a) => {
    try {
      i = !0, e?.(a, l), i = !1;
    } catch (u) {
      Vt(u, o(nt, this) && o(nt, this).parent);
    }
    n && $(st, this, E(U, this, Qn).call(this, () => {
      try {
        return ht(() => {
          var u = M;
          u.b = this, u.f |= 128, n(o(ut, this), () => a, () => l);
        });
      } catch (u) {
        return Vt(u, o(nt, this).parent), null;
      }
    }));
  };
  Jt(() => {
    var a;
    try {
      a = this.transform_error(t);
    } catch (u) {
      Vt(u, o(nt, this) && o(nt, this).parent);
      return;
    }
    typeof a == "object" && a && typeof a.then == "function" ? a.then(s, (u) => Vt(u, o(nt, this) && o(nt, this).parent)) : s(a);
  });
}
function bo(t, e, n, r) {
  let i = Xe() ? Je : fr;
  var l = t.filter((d) => !d.settled);
  if (n.length === 0 && l.length === 0) {
    r(e.map(i));
    return;
  }
  var s = M, a = yo(), u = l.length === 1 ? l[0].promise : l.length > 1 ? Promise.all(l.map((d) => d.promise)) : null;
  function f(d) {
    if (!(s.f & 16384)) {
      a();
      try {
        r(d);
      } catch (w) {
        Vt(w, s);
      }
      En();
    }
  }
  var h = Mi();
  if (n.length === 0) {
    u.then(() => f(e.map(i))).finally(h);
    return;
  }
  function v() {
    Promise.all(n.map((d) => /* @__PURE__ */ $o(d))).then((d) => f([...e.map(i), ...d])).catch((d) => Vt(d, s)).finally(h);
  }
  u ? u.then(() => {
    a(), v(), En();
  }) : v();
}
function yo() {
  var t = M, e = T, n = F, r = z;
  return function(i = !0) {
    zt(t), dt(e), $e(n), i && !(t.f & 16384) && (r?.activate(), r?.apply());
  };
}
function En(t = !0) {
  zt(null), dt(null), $e(null), t && z?.deactivate();
}
function Mi() {
  var t = M, e = t.b, n = z, r = !!e?.is_rendered();
  return e?.update_pending_count(1, n), n.increment(r, t), () => {
    e?.update_pending_count(-1, n), n.decrement(r, t);
  };
}
// @__NO_SIDE_EFFECTS__
function Je(t) {
  var e = 2 | vt;
  return M !== null && (M.f |= Me), {
    ctx: F,
    deps: null,
    effects: null,
    equals: fi,
    f: e,
    fn: t,
    reactions: null,
    rv: 0,
    v: q,
    wv: 0,
    parent: M,
    ac: null
  };
}
var an = /* @__PURE__ */ Symbol("obsolete");
// @__NO_SIDE_EFFECTS__
function $o(t, e, n) {
  let r = M;
  r === null && Fl();
  var i = void 0, l = le(q), s = !T, a = /* @__PURE__ */ new Set();
  return Wo(() => {
    var u = M, f = si();
    i = f.promise;
    try {
      Promise.resolve(t()).then(f.resolve, (w) => {
        w !== An && f.reject(w);
      }).finally(En);
    } catch (w) {
      f.reject(w), En();
    }
    var h = z;
    if (s) {
      if (u.f & 32768) var v = Mi();
      if (r.b?.is_rendered()) h.async_deriveds.get(u)?.reject(an);
      else for (let w of a.values()) w.reject(an);
      a.add(f), h.async_deriveds.set(u, f);
    }
    let d = (w, x = void 0) => {
      v?.(), a.delete(f), x !== an && (h.activate(), x ? (l.f |= kn, xe(l, x)) : (l.f & 8388608 && (l.f ^= kn), xe(l, w)), h.deactivate());
    };
    f.promise.then(d, (w) => d(null, w || "unknown"));
  }), Ri(() => {
    for (let u of a) u.reject(an);
  }), new Promise((u) => {
    function f(h) {
      function v() {
        h === i ? u(l) : f(i);
      }
      h.then(v, v);
    }
    f(i);
  });
}
// @__NO_SIDE_EFFECTS__
function Dt(t) {
  let e = /* @__PURE__ */ Je(t);
  return Pt || Hi(e), e;
}
// @__NO_SIDE_EFFECTS__
function fr(t) {
  let e = /* @__PURE__ */ Je(t);
  return e.equals = ci, e;
}
function ko(t) {
  var e = t.effects;
  if (e !== null) {
    t.effects = null;
    for (var n = 0; n < e.length; n += 1) J(e[n]);
  }
}
function cr(t) {
  var e, n = M, r = t.parent;
  if (!Rt && r !== null && t.v !== q && r.f & 24576) return Zl(), t.v;
  zt(r);
  try {
    t.f &= ~Qe, ko(t), e = Gi(t);
  } finally {
    zt(n);
  }
  return e;
}
function zi(t) {
  var e = cr(t);
  if (!t.equals(e) && (t.wv = Ui(), (!z?.is_fork || t.deps === null) && (z === null ? t.v = e : (z.capture(t, e, !0), Jn?.capture(t, e, !0)), t.deps === null))) {
    j(t, ct);
    return;
  }
  Rt || (G === null ? or(t) : (pr() || z?.is_fork) && G.set(t, e));
}
function xo(t) {
  if (t.effects !== null) for (let e of t.effects) (e.teardown || e.ac) && (e.teardown?.(), e.ac?.abort(An), e.fn !== null && (e.teardown = Al), e.ac = null, Ye(e, 0), wr(e));
}
function Ti(t) {
  if (t.effects !== null) for (let e of t.effects) e.teardown && e.fn !== null && Se(e);
}
var Wn = /* @__PURE__ */ new Set(), re = /* @__PURE__ */ new Map(), Ei = !1;
function le(t, e) {
  return {
    f: 0,
    v: t,
    reactions: null,
    equals: fi,
    rv: 0,
    wv: 0
  };
}
// @__NO_SIDE_EFFECTS__
function D(t, e) {
  let n = le(t, e);
  return Hi(n), n;
}
// @__NO_SIDE_EFFECTS__
function Wi(t, e = !1, n = !0) {
  var r;
  let i = le(t);
  return e || (i.equals = ci), Pn && n && F !== null && F.l !== null && ((r = F.l).s ?? (r.s = [])).push(i), i;
}
function b(t, e, n = !1) {
  return T !== null && (!_t || T.f & 131072) && Xe() && T.f & 4325394 && (bt === null || !bt.has(t)) && Ql(), xe(t, n ? we(e) : e, Mn);
}
function xe(t, e, n = null) {
  if (!t.equals(e)) {
    re.set(t, Rt ? e : t.v);
    var r = ze.ensure();
    if (r.capture(t, e), t.f & 2) {
      let i = t;
      t.f & 2048 && cr(i), G === null && or(i);
    }
    t.wv = Ui(), Ii(t, vt, n), Xe() && M !== null && M.f & 1024 && !(M.f & 96) && (ot === null ? Co([t]) : ot.push(t)), !r.is_fork && Wn.size > 0 && !Ei && So();
  }
  return e;
}
function So() {
  Ei = !1;
  for (let t of Wn) {
    t.f & 1024 && j(t, oe);
    let e;
    try {
      e = Ze(t);
    } catch {
      e = !0;
    }
    e && Se(t);
  }
  Wn.clear();
}
function Ge(t) {
  b(t, t.v + 1);
}
function Ii(t, e, n) {
  var r = t.reactions;
  if (r !== null) for (var i = Xe(), l = r.length, s = 0; s < l; s++) {
    var a = r[s], u = a.f;
    if (!(!i && a === M)) {
      var f = (u & vt) === 0;
      if (f && j(a, e), u & 131072) Wn.add(a);
      else if (u & 2) {
        var h = a;
        G?.delete(h), u & 65536 || (u & 512 && (M === null || !(M.f & 2097152)) && (a.f |= Qe), Ii(h, oe, n));
      } else if (f) {
        var v = a;
        u & 16 && St !== null && St.add(v), n === null ? ar(v) : n.push(v);
      }
    }
  }
}
function we(t) {
  if (typeof t != "object" || !t || Ue in t) return t;
  let e = oi(t);
  if (e !== Il && e !== Ol) return t;
  var n = /* @__PURE__ */ new Map(), r = li(t), i = /* @__PURE__ */ D(0), l = null, s = ie, a = (u) => {
    if (ie === s) return u();
    var f = T, h = ie;
    dt(null), Qr(s);
    var v = u();
    return dt(f), Qr(h), v;
  };
  return r && n.set("length", /* @__PURE__ */ D(t.length, l)), new Proxy(t, {
    defineProperty(u, f, h) {
      (!("value" in h) || h.configurable === !1 || h.enumerable === !1 || h.writable === !1) && Jl();
      var v = n.get(f);
      return v === void 0 ? a(() => {
        var d = /* @__PURE__ */ D(h.value, l);
        return n.set(f, d), d;
      }) : b(v, h.value, !0), !0;
    },
    deleteProperty(u, f) {
      var h = n.get(f);
      if (h === void 0) {
        if (f in u) {
          let v = a(() => /* @__PURE__ */ D(q, l));
          n.set(f, v), Ge(i);
        }
      } else b(h, q), Ge(i);
      return !0;
    },
    get(u, f, h) {
      if (f === Ue) return t;
      var v = n.get(f), d = f in u;
      if (v === void 0 && (!d || ne(u, f)?.writable) && (v = a(() => /* @__PURE__ */ D(we(d ? u[f] : q), l)), n.set(f, v)), v !== void 0) {
        var w = c(v);
        return w === q ? void 0 : w;
      }
      return Reflect.get(u, f, h);
    },
    getOwnPropertyDescriptor(u, f) {
      var h = Reflect.getOwnPropertyDescriptor(u, f);
      if (h && "value" in h) {
        var v = n.get(f);
        v && (h.value = c(v));
      } else if (h === void 0) {
        var d = n.get(f), w = d?.v;
        if (d !== void 0 && w !== q) return {
          enumerable: !0,
          configurable: !0,
          value: w,
          writable: !0
        };
      }
      return h;
    },
    has(u, f) {
      if (f === Ue) return !0;
      var h = n.get(f), v = h !== void 0 && h.v !== q || Reflect.has(u, f);
      return (h !== void 0 || M !== null && (!v || ne(u, f)?.writable)) && (h === void 0 && (h = a(() => /* @__PURE__ */ D(v ? we(u[f]) : q, l)), n.set(f, h)), c(h) === q) ? !1 : v;
    },
    set(u, f, h, v) {
      var d = n.get(f), w = f in u;
      if (r && f === "length") for (var x = h; x < d.v; x += 1) {
        var m = n.get(x + "");
        m === void 0 ? x in u && (m = a(() => /* @__PURE__ */ D(q, l)), n.set(x + "", m)) : b(m, q);
      }
      if (d === void 0) (!w || ne(u, f)?.writable) && (d = a(() => /* @__PURE__ */ D(void 0, l)), b(d, we(h)), n.set(f, d));
      else {
        w = d.v !== q;
        var p = a(() => we(h));
        b(d, p);
      }
      var _ = Reflect.getOwnPropertyDescriptor(u, f);
      if (_?.set && _.set.call(v, h), !w) {
        if (r && typeof f == "string") {
          var A = n.get("length"), I = Number(f);
          Number.isInteger(I) && I >= A.v && b(A, I + 1);
        }
        Ge(i);
      }
      return !0;
    },
    ownKeys(u) {
      c(i);
      var f = Reflect.ownKeys(u).filter((d) => {
        var w = n.get(d);
        return w === void 0 || w.v !== q;
      });
      for (var [h, v] of n) v.v !== q && !(h in u) && f.push(h);
      return f;
    },
    setPrototypeOf() {
      Yl();
    }
  });
}
var Jr, Oi, Ai, Ci;
function Xn() {
  if (Jr === void 0) {
    Jr = window, Oi = /Firefox/.test(navigator.userAgent);
    var t = Element.prototype, e = Node.prototype, n = Text.prototype;
    Ai = ne(e, "firstChild").get, Ci = ne(e, "nextSibling").get, Br(t) && (t[Gn] = void 0, t[Kn] = null, t[jl] = void 0, t.__e = void 0), Br(n) && (n[mn] = void 0);
  }
}
function ft(t = "") {
  return document.createTextNode(t);
}
// @__NO_SIDE_EFFECTS__
function at(t) {
  return Ai.call(t);
}
// @__NO_SIDE_EFFECTS__
function Tt(t) {
  return Ci.call(t);
}
function ce(t, e) {
  if (!O) return /* @__PURE__ */ at(t);
  var n = /* @__PURE__ */ at(W);
  if (n === null) n = W.appendChild(ft());
  else if (e && n.nodeType !== 3) {
    var r = ft();
    return n?.before(r), X(r), r;
  }
  return e && dr(n), X(n), n;
}
function Ne(t, e = !1) {
  if (!O) {
    var n = /* @__PURE__ */ at(t);
    return n instanceof Comment && n.data === "" ? /* @__PURE__ */ Tt(n) : n;
  }
  if (e) {
    if (W?.nodeType !== 3) {
      var r = ft();
      return W?.before(r), X(r), r;
    }
    dr(W);
  }
  return W;
}
function he(t, e = 1, n = !1) {
  let r = O ? W : t;
  for (var i; e--; ) i = r, r = /* @__PURE__ */ Tt(r);
  if (!O) return r;
  if (n) {
    if (r?.nodeType !== 3) {
      var l = ft();
      return r === null ? i?.after(l) : r.before(l), X(l), l;
    }
    dr(r);
  }
  return X(r), r;
}
function Ni(t) {
  t.textContent = "";
}
function Pi() {
  return !Pt || St !== null ? !1 : (M.f & ir) !== 0;
}
function hr(t, e, n) {
  return e == null || e === "http://www.w3.org/1999/xhtml" ? n ? document.createElement(t, { is: n }) : document.createElement(t) : n ? document.createElementNS(e, t, { is: n }) : document.createElementNS(e, t);
}
function dr(t) {
  if (t.nodeValue.length < 65536) return;
  let e = t.nextSibling;
  for (; e !== null && e.nodeType === 3; ) e.remove(), t.nodeValue += e.nodeValue, e = t.nextSibling;
}
function vr(t) {
  var e = T, n = M;
  dt(null), zt(null);
  try {
    return t();
  } finally {
    dt(e), zt(n);
  }
}
function Mo(t) {
  M === null && (T === null && Vl(t), Hl()), Rt && Bl(t);
}
function zo(t, e) {
  var n = e.last;
  n === null ? e.last = e.first = t : (n.next = t, t.prev = n, e.last = t);
}
function Et(t, e) {
  var n = M;
  n !== null && n.f & 8192 && (t |= rr);
  var r = {
    ctx: F,
    deps: null,
    nodes: null,
    f: t | vt | 512,
    first: null,
    fn: e,
    last: null,
    next: null,
    parent: n,
    b: n && n.b,
    prev: null,
    teardown: null,
    wv: 0,
    ac: null
  };
  z?.register_created_effect(r);
  var i = r;
  if (t & 4) ke === null ? ze.ensure().schedule(r) : ke.push(r);
  else if (e !== null) {
    try {
      Se(r);
    } catch (s) {
      throw J(r), s;
    }
    i.deps === null && i.teardown === null && i.nodes === null && i.first === i.last && !(i.f & 524288) && (i = i.first, t & 16 && t & 65536 && i !== null && (i.f |= lr));
  }
  if (i !== null && (i.parent = n, n !== null && zo(i, n), T !== null && T.f & 2 && !(t & 64))) {
    var l = T;
    (l.effects ?? (l.effects = [])).push(i);
  }
  return r;
}
function pr() {
  return T !== null && !_t;
}
function Ri(t) {
  let e = Et(8, null);
  return j(e, ct), e.teardown = t, e;
}
function Qt(t) {
  Mo("$effect");
  var e = M.f;
  if (!T && e & 32 && F !== null && !F.i) {
    var n = F;
    (n.e ?? (n.e = [])).push(t);
  } else return Li(t);
}
function Li(t) {
  return Et(4 | Pl, t);
}
function To(t) {
  ze.ensure();
  let e = Et(64 | Me, t);
  return () => {
    J(e);
  };
}
function Eo(t) {
  ze.ensure();
  let e = Et(64 | Me, t);
  return (n = {}) => new Promise((r) => {
    n.outro ? se(e, () => {
      J(e), r(void 0);
    }) : (J(e), r(void 0));
  });
}
function ji(t) {
  return Et(4, t);
}
function Wo(t) {
  return Et(Rl | Me, t);
}
function gr(t, e = 0) {
  return Et(8 | e, t);
}
function Pe(t, e = [], n = [], r = []) {
  bo(r, e, n, (i) => {
    Et(8, () => t(...i.map(c)));
  });
}
function mr(t, e = 0) {
  return Et(16 | e, t);
}
function ht(t) {
  return Et(32 | Me, t);
}
function Di(t) {
  var e = t.teardown;
  if (e !== null) {
    let n = Rt, r = T;
    Yr(!0), dt(null);
    try {
      e.call(null);
    } finally {
      Yr(n), dt(r);
    }
  }
}
function wr(t, e = !1) {
  var n = t.first;
  for (t.first = t.last = null; n !== null; ) {
    let i = n.ac;
    i !== null && vr(() => {
      i.abort(An);
    });
    var r = n.next;
    n.f & 64 ? n.parent = null : J(n, e), n = r;
  }
}
function Io(t) {
  for (var e = t.first; e !== null; ) {
    var n = e.next;
    e.f & 32 || J(e), e = n;
  }
}
function J(t, e = !0) {
  var n = !1;
  (e || t.f & 262144) && t.nodes !== null && t.nodes.end !== null && (Oo(t.nodes.start, t.nodes.end), n = !0), j(t, Hr), wr(t, e && !n), Ye(t, 0);
  var r = t.nodes && t.nodes.t;
  if (r !== null) for (let l of r) l.stop();
  Di(t), t.f ^= Hr, t.f |= Nl;
  var i = t.parent;
  i !== null && i.first !== null && Fi(t), t.next = t.prev = t.teardown = t.ctx = t.deps = t.fn = t.nodes = t.ac = t.b = null;
}
function Oo(t, e) {
  for (; t !== null; ) {
    var n = t === e ? null : /* @__PURE__ */ Tt(t);
    t.remove(), t = n;
  }
}
function Fi(t) {
  var e = t.parent, n = t.prev, r = t.next;
  n !== null && (n.next = r), r !== null && (r.prev = n), e !== null && (e.first === t && (e.first = r), e.last === t && (e.last = n));
}
function se(t, e, n = !0) {
  var r = [];
  qi(t, r, !0);
  var i = () => {
    n && J(t), e && e();
  }, l = r.length;
  if (l > 0) {
    var s = () => --l || i();
    for (var a of r) a.out(s);
  } else i();
}
function qi(t, e, n) {
  if (!(t.f & 8192)) {
    t.f ^= rr;
    var r = t.nodes && t.nodes.t;
    if (r !== null) for (let a of r) (a.is_global || n) && e.push(a);
    for (var i = t.first; i !== null; ) {
      var l = i.next;
      if (!(i.f & 64)) {
        var s = (i.f & 65536) != 0 || (i.f & 32) != 0 && (t.f & 16) != 0;
        qi(i, e, s ? n : !1);
      }
      i = l;
    }
  }
}
function In(t) {
  Bi(t, !0);
}
function Bi(t, e) {
  if (t.f & 8192) {
    t.f ^= rr, t.f & 1024 || (j(t, vt), ze.ensure().schedule(t));
    for (var n = t.first; n !== null; ) {
      var r = n.next, i = (n.f & 65536) != 0 || (n.f & 32) != 0;
      Bi(n, i ? e : !1), n = r;
    }
    var l = t.nodes && t.nodes.t;
    if (l !== null) for (let s of l) (s.is_global || e) && s.in();
  }
}
function _r(t, e) {
  if (t.nodes) for (var n = t.nodes.start, r = t.nodes.end; n !== null; ) {
    var i = n === r ? null : /* @__PURE__ */ Tt(n);
    e.append(n), n = i;
  }
}
var Ao = null, wn = !1, Rt = !1;
function Yr(t) {
  Rt = t;
}
var T = null, _t = !1;
function dt(t) {
  T = t;
}
var M = null;
function zt(t) {
  M = t;
}
var bt = null;
function Hi(t) {
  T !== null && (!Pt || T.f & 2) && (bt ?? (bt = /* @__PURE__ */ new Set())).add(t);
}
var Y = null, tt = 0, ot = null;
function Co(t) {
  ot = t;
}
var Vi = 1, ee = 0, ie = ee;
function Qr(t) {
  ie = t;
}
function Ui() {
  return ++Vi;
}
function Ze(t) {
  var e = t.f;
  if (e & 2048) return !0;
  if (e & 2 && (t.f &= ~Qe), e & 4096) {
    for (var n = t.deps, r = n.length, i = 0; i < r; i++) {
      var l = n[i];
      if (Ze(l) && zi(l), l.wv > t.wv) return !0;
    }
    e & 512 && G === null && j(t, ct);
  }
  return !1;
}
function Ki(t, e, n = !0) {
  var r = t.reactions;
  if (r !== null && !(!Pt && bt !== null && bt.has(t))) for (var i = 0; i < r.length; i++) {
    var l = r[i];
    l.f & 2 ? Ki(l, e, !1) : e === l && (n ? j(l, vt) : l.f & 1024 && j(l, oe), ar(l));
  }
}
function Gi(t) {
  var e = Y, n = tt, r = ot, i = T, l = bt, s = F, a = _t, u = ie, f = t.f;
  Y = null, tt = 0, ot = null, T = f & 96 ? null : t, bt = null, $e(t.ctx), _t = !1, ie = ++ee, t.ac !== null && (vr(() => {
    t.ac.abort(An);
  }), t.ac = null);
  try {
    t.f |= Vr;
    var h = t.fn, v = h();
    t.f |= ir;
    var d = t.deps, w = z?.is_fork;
    if (Y !== null) {
      var x, m;
      if (w || Ye(t, tt), d !== null && tt > 0) for (d.length = tt + Y.length, m = 0; m < Y.length; m++) d[tt + m] = Y[m];
      else t.deps = d = Y;
      if (pr() && t.f & 512) for (m = tt; m < d.length; m++) ((x = d[m]).reactions ?? (x.reactions = [])).push(t);
    } else !w && d !== null && tt < d.length && (Ye(t, tt), d.length = tt);
    if (Xe() && ot !== null && !_t && d !== null && !(t.f & 6146)) for (m = 0; m < ot.length; m++) Ki(ot[m], t);
    if (i !== null && i !== t) {
      if (ee++, i.deps !== null) for (let p = 0; p < n; p += 1) i.deps[p].rv = ee;
      if (e !== null) for (let p of e) p.rv = ee;
      ot !== null && (r === null ? r = ot : r.push(...ot));
    }
    return t.f & 8388608 && (t.f ^= kn), v;
  } catch (p) {
    return pi(p);
  } finally {
    t.f ^= Vr, Y = e, tt = n, ot = r, T = i, bt = l, $e(s), _t = a, ie = u;
  }
}
function No(t, e) {
  let n = e.reactions;
  if (n !== null) {
    var r = El.call(n, t);
    if (r !== -1) {
      var i = n.length - 1;
      i === 0 ? n = e.reactions = null : (n[r] = n[i], n.pop());
    }
  }
  if (n === null && e.f & 2 && (Y === null || !bn.call(Y, e))) {
    var l = e;
    l.f & 512 && (l.f ^= 512, l.f &= ~Qe), l.v !== q && or(l), xo(l), Ye(l, 0);
  }
}
function Ye(t, e) {
  var n = t.deps;
  if (n !== null) for (var r = e; r < n.length; r++) No(t, n[r]);
}
function Se(t) {
  var e = t.f;
  if (!(e & 16384)) {
    j(t, ct);
    var n = M, r = wn;
    M = t, wn = !0;
    try {
      e & 16777232 ? Io(t) : wr(t), Di(t);
      var i = Gi(t);
      t.teardown = typeof i == "function" ? i : null, t.wv = Vi;
    } finally {
      wn = r, M = n;
    }
  }
}
function c(t) {
  var e = (t.f & 2) != 0;
  if (Ao?.add(t), T !== null && !_t && !(M !== null && M.f & 16384) && (bt === null || !bt.has(t))) {
    var n = T.deps;
    if (T.f & 2097152) t.rv < ee && (t.rv = ee, Y === null && n !== null && n[tt] === t ? tt++ : Y === null ? Y = [t] : Y.push(t));
    else {
      var r;
      (r = T).deps ?? (r.deps = []), bn.call(T.deps, t) || T.deps.push(t);
      var i = t.reactions;
      i === null ? t.reactions = [T] : bn.call(i, T) || i.push(T);
    }
  }
  if (Rt && re.has(t)) return re.get(t);
  if (e) {
    var l = t;
    if (Rt) {
      var s = l.v;
      return (!(l.f & 1024) && l.reactions !== null || Yi(l)) && (s = cr(l)), re.set(l, s), s;
    }
    var a = (l.f & 512) == 0 && !_t && T !== null && (wn || (T.f & 512) != 0), u = (l.f & ir) === 0;
    Ze(l) && (a && (l.f |= 512), zi(l)), a && !u && (Ti(l), Ji(l));
  }
  if (G?.has(t)) return G.get(t);
  if (t.f & 8388608) throw t.v;
  return t.v;
}
function Ji(t) {
  if (t.f |= 512, t.deps !== null) for (let e of t.deps) (e.reactions ?? (e.reactions = [])).push(t), e.f & 2 && !(e.f & 512) && (Ti(e), Ji(e));
}
function Yi(t) {
  if (t.v === q) return !0;
  if (t.deps === null) return !1;
  for (let e of t.deps) if (re.has(e) || e.f & 2 && Yi(e)) return !0;
  return !1;
}
function br(t) {
  var e = _t;
  try {
    return _t = !0, t();
  } finally {
    _t = e;
  }
}
var _e = /* @__PURE__ */ Symbol("events"), Qi = /* @__PURE__ */ new Set(), Zn = /* @__PURE__ */ new Set();
function Po(t, e, n, r = {}) {
  function i(l) {
    if (r.capture || tr.call(e, l), !l.cancelBubble) return vr(() => n?.call(this, l));
  }
  return t.startsWith("pointer") || t.startsWith("touch") || t === "wheel" ? Jt(() => {
    e.addEventListener(t, i, r);
  }) : e.addEventListener(t, i, r), i;
}
function un(t, e, n, r, i) {
  var l = {
    capture: r,
    passive: i
  }, s = Po(t, e, n, l);
  (e === document.body || e === window || e === document || e instanceof HTMLMediaElement) && Ri(() => {
    e.removeEventListener(t, s, l);
  });
}
function de(t, e, n) {
  (e[_e] ?? (e[_e] = {}))[t] = n;
}
function Ro(t) {
  for (var e = 0; e < t.length; e++) Qi.add(t[e]);
  for (var n of Zn) n(t);
}
var Xr = null;
function tr(t) {
  var e = this, n = e.ownerDocument, r = t.type, i = t.composedPath?.() || [], l = i[0] || t.target;
  Xr = t;
  var s = 0, a = Xr === t && t[_e];
  if (a) {
    var u = i.indexOf(a);
    if (u !== -1 && (e === document || e === window)) {
      t[_e] = e;
      return;
    }
    var f = i.indexOf(e);
    if (f === -1) return;
    u <= f && (s = u);
  }
  if (l = i[s] || t.target, l !== e) {
    $n(t, "currentTarget", {
      configurable: !0,
      get() {
        return l || n;
      }
    });
    var h = T, v = M;
    dt(null), zt(null);
    try {
      for (var d, w = []; l !== null && l !== e; ) {
        try {
          var x = l[_e]?.[r];
          x != null && (!l.disabled || t.target === l) && x.call(l, t);
        } catch (m) {
          d ? w.push(m) : d = m;
        }
        if (t.cancelBubble) break;
        s++, l = s < i.length ? i[s] : null;
      }
      if (d) {
        for (let m of w) queueMicrotask(() => {
          throw m;
        });
        throw d;
      }
    } finally {
      t[_e] = e, delete t.currentTarget, dt(h), zt(v);
    }
  }
}
var Lo = globalThis?.window?.trustedTypes && /* @__PURE__ */ globalThis.window.trustedTypes.createPolicy("svelte-trusted-html", { createHTML: (t) => t });
function jo(t) {
  return Lo?.createHTML(t) ?? t;
}
function Xi(t) {
  var e = hr("template");
  return e.innerHTML = jo(t.replaceAll("<!>", "<!---->")), e.content;
}
function Nt(t, e) {
  var n = M;
  n.nodes === null && (n.nodes = {
    start: t,
    end: e,
    a: null,
    t: null
  });
}
// @__NO_SIDE_EFFECTS__
function tn(t, e) {
  var n = (e & 1) != 0, r = (e & 2) != 0, i, l = !t.startsWith("<!>");
  return () => {
    if (O) return Nt(W, null), W;
    i === void 0 && (i = Xi(l ? t : "<!>" + t), n || (i = /* @__PURE__ */ at(i)));
    var s = r || Oi ? document.importNode(i, !0) : i.cloneNode(!0);
    if (n) {
      var a = /* @__PURE__ */ at(s), u = s.lastChild;
      Nt(a, u);
    } else Nt(s, s);
    return s;
  };
}
// @__NO_SIDE_EFFECTS__
function Do(t, e, n = "svg") {
  var r = !t.startsWith("<!>"), i = (e & 1) != 0, l = `<${n}>${r ? t : "<!>" + t}</${n}>`, s;
  return () => {
    if (O) return Nt(W, null), W;
    if (!s) {
      var a = /* @__PURE__ */ at(Xi(l));
      if (i) for (s = document.createDocumentFragment(); /* @__PURE__ */ at(a); ) s.appendChild(/* @__PURE__ */ at(a));
      else s = /* @__PURE__ */ at(a);
    }
    var u = s.cloneNode(!0);
    if (i) {
      var f = /* @__PURE__ */ at(u), h = u.lastChild;
      Nt(f, h);
    } else Nt(u, u);
    return u;
  };
}
// @__NO_SIDE_EFFECTS__
function Zi(t, e) {
  return /* @__PURE__ */ Do(t, e, "svg");
}
function Hn() {
  if (O) return Nt(W, null), W;
  var t = document.createDocumentFragment(), e = document.createComment(""), n = ft();
  return t.append(e, n), Nt(e, n), t;
}
function lt(t, e) {
  if (O) {
    var n = M;
    (!(n.f & 32768) || n.nodes.end === null) && (n.nodes.end = W), Nn();
    return;
  }
  t !== null && t.before(e);
}
[.../* @__PURE__ */ "allowfullscreen.async.autofocus.autoplay.checked.controls.default.disabled.formnovalidate.indeterminate.inert.ismap.loop.multiple.muted.nomodule.novalidate.open.playsinline.readonly.required.reversed.seamless.selected.webkitdirectory.defer.disablepictureinpicture.disableremoteplayback".split(".")];
var Fo = ["touchstart", "touchmove"];
function qo(t) {
  return Fo.includes(t);
}
function Zr(t, e) {
  var n = e == null ? "" : typeof e == "object" ? `${e}` : e;
  n !== (t[mn] ?? (t[mn] = t.nodeValue)) && (t[mn] = n, t.nodeValue = `${n}`);
}
function tl(t, e) {
  return el(t, e);
}
function Bo(t, e) {
  Xn(), e.intro = e.intro ?? !1;
  let n = e.target, r = O, i = W;
  try {
    for (var l = /* @__PURE__ */ at(n); l && (l.nodeType !== 8 || l.data !== "["); ) l = /* @__PURE__ */ Tt(l);
    if (!l) throw ye;
    Ct(!0), X(l);
    let s = el(t, {
      ...e,
      anchor: l
    });
    return Ct(!1), s;
  } catch (s) {
    if (s instanceof Error && s.message.split(`
`).some((a) => a.startsWith("https://svelte.dev/e/"))) throw s;
    return s !== ye && console.warn("Failed to hydrate: ", s), e.recover === !1 && Kl(), Xn(), Ni(n), Ct(!1), tl(t, e);
  } finally {
    Ct(r), X(i);
  }
}
var fn = /* @__PURE__ */ new Map();
function el(t, { target: e, anchor: n, props: r = {}, events: i, context: l, intro: s = !0, transformError: a }) {
  Xn();
  var u = void 0, f = Eo(() => {
    var h = n ?? e.appendChild(ft());
    po(h, { pending: () => {
    } }, (w) => {
      hi({});
      var x = F;
      if (l && (x.c = l), i && (r.$$events = i), O && Nt(w, null), u = t(w, r) || {}, O && (M.nodes.end = W, W === null || W.nodeType !== 8 || W.data !== "]")) throw Cn(), ye;
      di();
    }, a);
    var v = /* @__PURE__ */ new Set(), d = (w) => {
      for (var x = 0; x < w.length; x++) {
        var m = w[x];
        if (!v.has(m)) {
          v.add(m);
          var p = qo(m);
          for (let I of [e, document]) {
            var _ = fn.get(I);
            _ === void 0 && (_ = /* @__PURE__ */ new Map(), fn.set(I, _));
            var A = _.get(m);
            A === void 0 ? (I.addEventListener(m, tr, { passive: p }), _.set(m, 1)) : _.set(m, A + 1);
          }
        }
      }
    };
    return d(On(Qi)), Zn.add(d), () => {
      for (var w of v) for (let p of [e, document]) {
        var x = fn.get(p), m = x.get(w);
        --m == 0 ? (p.removeEventListener(w, tr), x.delete(w), x.size === 0 && fn.delete(p)) : x.set(w, m);
      }
      Zn.delete(d), h !== n && h.parentNode?.removeChild(h);
    };
  });
  return er.set(u, f), u;
}
var er = /* @__PURE__ */ new WeakMap();
function Ho(t, e) {
  let n = er.get(t);
  return n ? (er.delete(t), n(e)) : Promise.resolve();
}
var Vo = (kt = /* @__PURE__ */ new WeakMap(), Ot = /* @__PURE__ */ new WeakMap(), it = /* @__PURE__ */ new WeakMap(), ue = /* @__PURE__ */ new WeakMap(), ln = /* @__PURE__ */ new WeakMap(), on = /* @__PURE__ */ new WeakMap(), qn = /* @__PURE__ */ new WeakMap(), class {
  constructor(t, e = !0) {
    R(this, "anchor", void 0), S(this, kt, /* @__PURE__ */ new Map()), S(this, Ot, /* @__PURE__ */ new Map()), S(this, it, /* @__PURE__ */ new Map()), S(this, ue, /* @__PURE__ */ new Set()), S(this, ln, !0), S(this, on, (n) => {
      if (o(kt, this).has(n)) {
        var r = o(kt, this).get(n), i = o(Ot, this).get(r);
        if (i) In(i), o(ue, this).delete(r);
        else {
          var l = o(it, this).get(r);
          l && (In(l.effect), o(Ot, this).set(r, l.effect), o(it, this).delete(r), l.fragment.lastChild.remove(), this.anchor.before(l.fragment), i = l.effect);
        }
        for (let [s, a] of o(kt, this)) {
          if (o(kt, this).delete(s), s === n) break;
          let u = o(it, this).get(a);
          u && (J(u.effect), o(it, this).delete(a));
        }
        for (let [s, a] of o(Ot, this)) {
          if (s === r || o(ue, this).has(s)) continue;
          let u = () => {
            if (Array.from(o(kt, this).values()).includes(s)) {
              var f = document.createDocumentFragment();
              _r(a, f), f.append(ft()), o(it, this).set(s, {
                effect: a,
                fragment: f
              });
            } else J(a);
            o(ue, this).delete(s), o(Ot, this).delete(s);
          };
          o(ln, this) || !i ? (o(ue, this).add(s), se(a, u, !1)) : u();
        }
      }
    }), S(this, qn, (n) => {
      o(kt, this).delete(n);
      let r = Array.from(o(kt, this).values());
      for (let [i, l] of o(it, this)) r.includes(i) || (J(l.effect), o(it, this).delete(i));
    }), this.anchor = t, $(ln, this, e);
  }
  ensure(t, e) {
    var n = z, r = Pi();
    if (e && !o(Ot, this).has(t) && !o(it, this).has(t)) if (r) {
      var i = document.createDocumentFragment(), l = ft();
      i.append(l), o(it, this).set(t, {
        effect: ht(() => e(l)),
        fragment: i
      });
    } else o(Ot, this).set(t, ht(() => e(this.anchor)));
    if (o(kt, this).set(n, t), r) {
      for (let [s, a] of o(Ot, this)) s === t ? n.unskip_effect(a) : n.skip_effect(a);
      for (let [s, a] of o(it, this)) s === t ? n.unskip_effect(a.effect) : n.skip_effect(a.effect);
      n.oncommit(o(on, this)), n.ondiscard(o(qn, this));
    } else O && (this.anchor = W), o(on, this).call(this, n);
  }
});
function Re(t, e, n = !1) {
  var r;
  O && (r = W, Nn());
  var i = new Vo(t), l = n ? lr : 0;
  function s(a, u) {
    if (O) {
      var f = ui(r);
      if (a !== parseInt(f.substring(1))) {
        var h = xn();
        X(h), i.anchor = h, Ct(!1), i.ensure(a, u), Ct(!0);
        return;
      }
    }
    i.ensure(a, u);
  }
  mr(() => {
    var a = !1;
    e((u, f = 0) => {
      a = !0, s(f, u);
    }), a || s(-1, null);
  }, l);
}
function Uo(t, e, n) {
  for (var r = [], i = e.length, l, s = e.length, a = 0; a < i; a++) {
    let v = e[a];
    se(v, () => {
      if (l) {
        if (l.pending.delete(v), l.done.add(v), l.pending.size === 0) {
          var d = t.outrogroups;
          nr(t, On(l.done)), d.delete(l), d.size === 0 && (t.outrogroups = null);
        }
      } else --s;
    }, !1);
  }
  if (s === 0) {
    var u = r.length === 0 && n !== null;
    if (u) {
      var f = n, h = f.parentNode;
      Ni(h), h.append(f), t.items.clear();
    }
    nr(t, e, !u);
  } else l = {
    pending: new Set(e),
    done: /* @__PURE__ */ new Set()
  }, (t.outrogroups ?? (t.outrogroups = /* @__PURE__ */ new Set())).add(l);
}
function nr(t, e, n = !0) {
  var r;
  if (t.pending.size > 0) {
    r = /* @__PURE__ */ new Set();
    for (let s of t.pending.values()) for (let a of s) r.add(t.items.get(a).e);
  }
  for (var i = 0; i < e.length; i++) {
    var l = e[i];
    r?.has(l) ? (l.f |= Ve, _r(l, document.createDocumentFragment())) : J(e[i], n);
  }
}
var cn;
function Ko(t, e, n, r, i, l = null) {
  var s = t, a = /* @__PURE__ */ new Map();
  if (e & 4) {
    var u = t;
    s = O ? X(/* @__PURE__ */ at(u)) : u.appendChild(ft());
  }
  O && Nn();
  var f = null, h = /* @__PURE__ */ fr(() => {
    var _ = n();
    return li(_) ? _ : _ == null ? [] : On(_);
  }), v, d = /* @__PURE__ */ new Map(), w = !0;
  function x(_) {
    p.effect.f & 16384 || (p.pending.delete(_), p.fallback = f, Go(p, v, s, e, r), f !== null && (v.length === 0 ? f.f & 33554432 ? (f.f ^= Ve, qe(f, null, s)) : In(f) : se(f, () => {
      f = null;
    })));
  }
  function m(_) {
    p.pending.delete(_);
  }
  var p = {
    effect: mr(() => {
      v = c(h);
      var _ = v.length;
      let A = !1;
      O && ui(s) === "[!" != (_ === 0) && (s = xn(), X(s), Ct(!1), A = !0);
      for (var I = /* @__PURE__ */ new Set(), k = z, C = Pi(), B = 0; B < _; B += 1) {
        O && W.nodeType === 8 && W.data === "]" && (s = W, A = !0, Ct(!1));
        var P = v[B], Z = r(P, B), K = w ? null : a.get(Z);
        K ? (K.v && xe(K.v, P), K.i && xe(K.i, B), C && k.unskip_effect(K.e)) : (K = Jo(a, w ? s : cn ?? (cn = ft()), P, Z, B, i, e, n), w || (K.e.f |= Ve), a.set(Z, K)), I.add(Z);
      }
      if (_ === 0 && l && !f && (w ? f = ht(() => l(s)) : (f = ht(() => l(cn ?? (cn = ft()))), f.f |= Ve)), _ > I.size && ql("", "", ""), O && _ > 0 && X(xn()), !w) if (d.set(k, I), C) {
        for (let [V, pt] of a) I.has(V) || k.skip_effect(pt.e);
        k.oncommit(x), k.ondiscard(m);
      } else x(k);
      A && Ct(!0), c(h);
    }),
    flags: e,
    items: a,
    pending: d,
    outrogroups: null,
    fallback: f
  };
  w = !1, O && (s = W);
}
function Le(t) {
  for (; t !== null && !(t.f & 32); ) t = t.next;
  return t;
}
function Go(t, e, n, r, i) {
  var l = (r & 8) != 0, s = e.length, a = t.items, u = Le(t.effect.first), f, h = null, v, d = [], w = [], x, m, p, _;
  if (l) for (_ = 0; _ < s; _ += 1) x = e[_], m = i(x, _), p = a.get(m).e, p.f & 33554432 || (p.nodes?.a?.measure(), (v ?? (v = /* @__PURE__ */ new Set())).add(p));
  for (_ = 0; _ < s; _ += 1) {
    if (x = e[_], m = i(x, _), p = a.get(m).e, t.outrogroups !== null) for (let V of t.outrogroups) V.pending.delete(p), V.done.delete(p);
    if (p.f & 8192 && (In(p), l && (p.nodes?.a?.unfix(), (v ?? (v = /* @__PURE__ */ new Set())).delete(p))), p.f & 33554432) if (p.f ^= Ve, p === u) qe(p, null, n);
    else {
      var A = h ? h.next : u;
      p === t.effect.last && (t.effect.last = p.prev), p.prev && (p.prev.next = p.next), p.next && (p.next.prev = p.prev), Ft(t, h, p), Ft(t, p, A), qe(p, A, n), h = p, d = [], w = [], u = Le(h.next);
      continue;
    }
    if (p !== u) {
      if (f !== void 0 && f.has(p)) {
        if (d.length < w.length) {
          var I = w[0], k;
          h = I.prev;
          var C = d[0], B = d[d.length - 1];
          for (k = 0; k < d.length; k += 1) qe(d[k], I, n);
          for (k = 0; k < w.length; k += 1) f.delete(w[k]);
          Ft(t, C.prev, B.next), Ft(t, h, C), Ft(t, B, I), u = I, h = B, --_, d = [], w = [];
        } else f.delete(p), qe(p, u, n), Ft(t, p.prev, p.next), Ft(t, p, h === null ? t.effect.first : h.next), Ft(t, h, p), h = p;
        continue;
      }
      for (d = [], w = []; u !== null && u !== p; ) (f ?? (f = /* @__PURE__ */ new Set())).add(u), w.push(u), u = Le(u.next);
      if (u === null) continue;
    }
    p.f & 33554432 || d.push(p), h = p, u = Le(p.next);
  }
  if (t.outrogroups !== null) {
    for (let V of t.outrogroups) V.pending.size === 0 && (nr(t, On(V.done)), t.outrogroups?.delete(V));
    t.outrogroups.size === 0 && (t.outrogroups = null);
  }
  if (u !== null || f !== void 0) {
    var P = [];
    if (f !== void 0) for (p of f) p.f & 8192 || P.push(p);
    for (; u !== null; ) !(u.f & 8192) && u !== t.fallback && P.push(u), u = Le(u.next);
    var Z = P.length;
    if (Z > 0) {
      var K = r & 4 && s === 0 ? n : null;
      if (l) {
        for (_ = 0; _ < Z; _ += 1) P[_].nodes?.a?.measure();
        for (_ = 0; _ < Z; _ += 1) P[_].nodes?.a?.fix();
      }
      Uo(t, P, K);
    }
  }
  l && Jt(() => {
    if (v !== void 0) for (p of v) p.nodes?.a?.apply();
  });
}
function Jo(t, e, n, r, i, l, s, a) {
  var u = s & 1 ? s & 16 ? le(n) : /* @__PURE__ */ Wi(n, !1, !1) : null, f = s & 2 ? le(i) : null;
  return {
    v: u,
    i: f,
    e: ht(() => (l(e, u ?? n, f ?? i, a), () => {
      t.delete(r);
    }))
  };
}
function qe(t, e, n) {
  if (t.nodes) for (var r = t.nodes.start, i = t.nodes.end, l = e && !(e.f & 33554432) ? e.nodes.start : n; r !== null; ) {
    var s = /* @__PURE__ */ Tt(r);
    if (l.before(r), r === i) return;
    r = s;
  }
}
function Ft(t, e, n) {
  e === null ? t.effect.first = n : e.next = n, n === null ? t.effect.last = e : n.prev = e;
}
function Yo(t, e) {
  ji(() => {
    var n = t.getRootNode(), r = n.host ? n : n.head ?? n.ownerDocument.head;
    if (!r.querySelector("#" + e.hash)) {
      let i = hr("style");
      i.id = e.hash, i.textContent = e.code, r.appendChild(i);
    }
  });
}
var ti = [...` 	
\r\f \v\uFEFF`];
function Qo(t, e, n) {
  var r = t == null ? "" : "" + t;
  if (e && (r = r ? r + " " + e : e), n) {
    for (var i of Object.keys(n)) if (n[i]) r = r ? r + " " + i : i;
    else if (r.length) for (var l = i.length, s = 0; (s = r.indexOf(i, s)) >= 0; ) {
      var a = s + l;
      (s === 0 || ti.includes(r[s - 1])) && (a === r.length || ti.includes(r[a])) ? r = (s === 0 ? "" : r.substring(0, s)) + r.substring(a + 1) : s = a;
    }
  }
  return r === "" ? null : r;
}
function hn(t, e, n, r, i, l) {
  var s = t[Gn];
  if (O || s !== n || s === void 0) {
    var a = Qo(n, r, l);
    (!O || a !== t.getAttribute("class")) && (a == null ? t.removeAttribute("class") : e ? t.className = a : t.setAttribute("class", a)), t[Gn] = n;
  } else if (l && i !== l) for (var u in l) {
    var f = !!l[u];
    (i == null || f !== !!i[u]) && t.classList.toggle(u, f);
  }
  return l;
}
var Xo = /* @__PURE__ */ Symbol("is custom element"), Zo = /* @__PURE__ */ Symbol("is html"), ts = Dl ? "link" : "LINK";
function xt(t, e, n, r) {
  var i = es(t);
  O && (i[e] = t.getAttribute(e), e === "src" || e === "srcset" || e === "href" && t.nodeName === ts) || i[e] !== (i[e] = n) && (e === "loading" && (t[Ll] = n), n == null ? t.removeAttribute(e) : typeof n != "string" && ns(t).includes(e) ? t[e] = n : t.setAttribute(e, n));
}
function es(t) {
  return t[Kn] ?? (t[Kn] = {
    [Xo]: t.nodeName.includes("-"),
    [Zo]: t.namespaceURI === Tl
  });
}
var ei = /* @__PURE__ */ new Map();
function ns(t) {
  var e = t.getAttribute("is") || t.nodeName, n = ei.get(e);
  if (n) return n;
  ei.set(e, n = []);
  for (var r, i = t, l = Element.prototype; l !== i; ) {
    for (var s in r = Wl(i), r) r[s].set && s !== "innerHTML" && s !== "textContent" && s !== "innerText" && n.push(s);
    i = oi(i);
  }
  return n;
}
function Vn(t, e) {
  return t === e || t?.[Ue] === e;
}
function ni(t = {}, e, n, r) {
  var i = F.r, l = M;
  return ji(() => {
    var s, a;
    return gr(() => {
      s = a, a = r?.() || [], br(() => {
        Vn(n(...a), t) || (e(t, ...a), s && Vn(n(...s), t) && e(null, ...s));
      });
    }), () => {
      let u = l;
      for (; u !== i && u.parent !== null && u.parent.f & 33554432; ) u = u.parent;
      let f = () => {
        a && Vn(n(...a), t) && e(null, ...a);
      }, h = u.teardown;
      u.teardown = () => {
        f(), h?.();
      };
    };
  }), t;
}
function je(t, e, n, r) {
  var i = !Pn || (n & 2) != 0, l = (n & 8) != 0, s = (n & 16) != 0, a = r, u = !0, f = void 0, h = () => s && i ? (f ?? (f = /* @__PURE__ */ Je(r)), c(f)) : (u && (u = !1, a = s ? br(r) : r), a);
  let v;
  if (l) {
    var d = Ue in t || ai in t;
    v = ne(t, e)?.set ?? (d && e in t ? (k) => t[e] = k : void 0);
  }
  var w, x = !1;
  l ? [w, x] = oo(() => t[e]) : w = t[e], w === void 0 && r !== void 0 && (w = h(), v && (i && Gl(e), v(w)));
  var m = i ? () => {
    var k = t[e];
    return k === void 0 ? h() : (u = !0, k);
  } : () => {
    var k = t[e];
    return k !== void 0 && (a = void 0), k === void 0 ? a : k;
  };
  if (i && !(n & 4)) return m;
  if (v) {
    var p = t.$$legacy;
    return (function(k, C) {
      return arguments.length > 0 ? ((!i || !C || p || x) && v(C ? m() : k), k) : m();
    });
  }
  var _ = !1, A = (n & 1 ? Je : fr)(() => (_ = !1, m()));
  l && c(A);
  var I = M;
  return (function(k, C) {
    if (arguments.length > 0) {
      let B = C ? c(A) : i && l ? we(k) : k;
      return b(A, B), _ = !0, a !== void 0 && (a = B), k;
    }
    return Rt && _ || I.f & 16384 ? A.v : c(A);
  });
}
function rs(t) {
  return new is(t);
}
var is = (jt = /* @__PURE__ */ new WeakMap(), gt = /* @__PURE__ */ new WeakMap(), class {
  constructor(t) {
    S(this, jt, void 0), S(this, gt, void 0);
    var e = /* @__PURE__ */ new Map(), n = (i, l) => {
      var s = /* @__PURE__ */ Wi(l, !1, !1);
      return e.set(i, s), s;
    };
    let r = new Proxy({
      ...t.props || {},
      $$events: {}
    }, {
      get(i, l) {
        return c(e.get(l) ?? n(l, Reflect.get(i, l)));
      },
      has(i, l) {
        return l === ai ? !0 : (c(e.get(l) ?? n(l, Reflect.get(i, l))), Reflect.has(i, l));
      },
      set(i, l, s) {
        return b(e.get(l) ?? n(l, s), s), Reflect.set(i, l, s);
      }
    });
    $(gt, this, (t.hydrate ? Bo : tl)(t.component, {
      target: t.target,
      anchor: t.anchor,
      props: r,
      context: t.context,
      intro: t.intro ?? !1,
      recover: t.recover,
      transformError: t.transformError
    })), !Pt && (!t?.props?.$$host || t.sync === !1) && me(), $(jt, this, r.$$events);
    for (let i of Object.keys(o(gt, this))) i === "$set" || i === "$destroy" || i === "$on" || $n(this, i, {
      get() {
        return o(gt, this)[i];
      },
      set(l) {
        o(gt, this)[i] = l;
      },
      enumerable: !0
    });
    o(gt, this).$set = (i) => {
      Object.assign(r, i);
    }, o(gt, this).$destroy = () => {
      Ho(o(gt, this));
    };
  }
  $set(t) {
    o(gt, this).$set(t);
  }
  $on(t, e) {
    o(jt, this)[t] = o(jt, this)[t] || [];
    let n = (...r) => e.call(this, ...r);
    return o(jt, this)[t].push(n), () => {
      o(jt, this)[t] = o(jt, this)[t].filter((r) => r !== n);
    };
  }
  $destroy() {
    o(gt, this).$destroy();
  }
}), nl;
typeof HTMLElement == "function" && (nl = class extends HTMLElement {
  constructor(t, e, n) {
    var r = (...i) => (super(...i), R(this, "$$ctor", void 0), R(this, "$$s", void 0), R(this, "$$c", void 0), R(this, "$$cn", !1), R(this, "$$d", {}), R(this, "$$r", !1), R(this, "$$p_d", {}), R(this, "$$l", {}), R(this, "$$l_u", /* @__PURE__ */ new Map()), R(this, "$$me", void 0), R(this, "$$shadowRoot", null), this);
    r(), this.$$ctor = t, this.$$s = e, n && (this.$$shadowRoot = this.attachShadow(n));
  }
  addEventListener(t, e, n) {
    if (this.$$l[t] = this.$$l[t] || [], this.$$l[t].push(e), this.$$c) {
      let r = this.$$c.$on(t, e);
      this.$$l_u.set(e, r);
    }
    super.addEventListener(t, e, n);
  }
  removeEventListener(t, e, n) {
    if (super.removeEventListener(t, e, n), this.$$c) {
      let r = this.$$l_u.get(e);
      r && (r(), this.$$l_u.delete(e));
    }
  }
  async connectedCallback() {
    if (this.$$cn = !0, !this.$$c) {
      let t = function(r) {
        return (i) => {
          let l = hr("slot");
          r !== "default" && (l.name = r), lt(i, l);
        };
      };
      if (await Promise.resolve(), !this.$$cn || this.$$c) return;
      let e = {}, n = ls(this);
      for (let r of this.$$s) r in n && (r === "default" && !this.$$d.children ? (this.$$d.children = t(r), e.default = !0) : e[r] = t(r));
      for (let r of this.attributes) {
        let i = this.$$g_p(r.name);
        i in this.$$d || (this.$$d[i] = _n(i, r.value, this.$$p_d, "toProp"));
      }
      for (let r in this.$$p_d) !(r in this.$$d) && this[r] !== void 0 && (this.$$d[r] = this[r], delete this[r]);
      this.$$c = rs({
        component: this.$$ctor,
        target: this.$$shadowRoot || this,
        props: {
          ...this.$$d,
          $$slots: e,
          $$host: this
        }
      }), this.$$me = To(() => {
        gr(() => {
          this.$$r = !0;
          for (let r of yn(this.$$c)) {
            if (!this.$$p_d[r]?.reflect) continue;
            this.$$d[r] = this.$$c[r];
            let i = _n(r, this.$$d[r], this.$$p_d, "toAttribute");
            i == null ? this.removeAttribute(this.$$p_d[r].attribute || r) : this.setAttribute(this.$$p_d[r].attribute || r, i);
          }
          this.$$r = !1;
        });
      });
      for (let r in this.$$l) for (let i of this.$$l[r]) {
        let l = this.$$c.$on(r, i);
        this.$$l_u.set(i, l);
      }
      this.$$l = {};
    }
  }
  attributeChangedCallback(t, e, n) {
    this.$$r || (t = this.$$g_p(t), this.$$d[t] = _n(t, n, this.$$p_d, "toProp"), this.$$c?.$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);
    });
  }
  $$g_p(t) {
    return yn(this.$$p_d).find((e) => this.$$p_d[e].attribute === t || !this.$$p_d[e].attribute && e.toLowerCase() === t) || t;
  }
});
function _n(t, e, n, r) {
  let i = n[t]?.type;
  if (e = i === "Boolean" && typeof e != "boolean" ? e != null : e, !r || !n[t]) return e;
  if (r === "toAttribute") switch (i) {
    case "Object":
    case "Array":
      return e == null ? null : JSON.stringify(e);
    case "Boolean":
      return e ? "" : null;
    case "Number":
      return e ?? null;
    default:
      return e;
  }
  else switch (i) {
    case "Object":
    case "Array":
      return e && JSON.parse(e);
    case "Boolean":
      return e;
    case "Number":
      return e == null ? e : +e;
    default:
      return e;
  }
}
function ls(t) {
  let e = {};
  return t.childNodes.forEach((n) => {
    e[n.slot || "default"] = !0;
  }), e;
}
function os(t, e, n, r, i, l) {
  let s = class extends nl {
    constructor() {
      super(t, n, i), this.$$p_d = e;
    }
    static get observedAttributes() {
      return yn(e).map((a) => (e[a].attribute || a).toLowerCase());
    }
  };
  return yn(e).forEach((a) => {
    $n(s.prototype, a, {
      get() {
        return this.$$c && a in this.$$c ? this.$$c[a] : this.$$d[a];
      },
      set(u) {
        u = _n(a, u, e), this.$$d[a] = u;
        var f = this.$$c;
        f && (ne(f, a)?.get ? f[a] = u : f.$set({ [a]: u }));
      }
    });
  }), r.forEach((a) => {
    $n(s.prototype, a, { get() {
      return this.$$c?.[a];
    } });
  }), l && (s = l(s)), t.element = s, s;
}
var ss = /* @__PURE__ */ Zi('<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" class="pie-tool-tts-inline__icon svelte-18mzc0g" aria-hidden="true"><path d="M6 19h4V5H6v14zm8-14v14h4V5h-4z"></path></svg>'), as = /* @__PURE__ */ Zi('<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" class="pie-tool-tts-inline__icon svelte-18mzc0g" aria-hidden="true"><path d="M8 5v14l11-7z"></path></svg>'), us = /* @__PURE__ */ tn('<button type="button"><!></button>'), fs = /* @__PURE__ */ tn('<button type="button" data-pie-tts-control=""><span aria-hidden="true"> </span></button>'), cs = /* @__PURE__ */ tn('<div role="toolbar" aria-label="Reading controls" tabindex="-1"><!> <button type="button" data-pie-tts-control="" class="pie-tool-tts-inline__control svelte-18mzc0g" aria-label="Rewind"><svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" class="pie-tool-tts-inline__icon svelte-18mzc0g" aria-hidden="true"><path d="M20 18V6l-8.5 6L20 18zM10.5 18V6L2 12l8.5 6z"></path></svg></button> <button type="button" data-pie-tts-control="" class="pie-tool-tts-inline__control svelte-18mzc0g" aria-label="Fast-forward"><svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" class="pie-tool-tts-inline__icon svelte-18mzc0g" aria-hidden="true"><path d="M4 18l8.5-6L4 6v12zm9.5 0L22 12l-8.5-6v12z"></path></svg></button> <button type="button" data-pie-tts-control="" class="pie-tool-tts-inline__control svelte-18mzc0g" aria-label="Stop reading"><svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" class="pie-tool-tts-inline__icon svelte-18mzc0g" aria-hidden="true"><path d="M6 6h12v12H6z"></path></svg></button></div>'), ri = /* @__PURE__ */ tn("<!> <!>", 1), hs = /* @__PURE__ */ tn('<div><!> <div class="pie-sr-only svelte-18mzc0g" role="status" aria-live="polite" aria-atomic="true"> </div></div>'), ds = {
  hash: "svelte-18mzc0g",
  code: `.pie-tool-tts-inline.svelte-18mzc0g {position:relative;display:inline-flex;align-items:center;}.pie-tool-tts-inline--controls-row.svelte-18mzc0g {width:100%;justify-content:flex-end;}.pie-tool-tts-inline__trigger.svelte-18mzc0g {display:inline-flex;align-items:center;justify-content:center;width:2rem;height:2rem;border:1px solid var(--pie-button-border-color, var(--pie-border, #c6c6c6));background-color:var(--pie-button-background-color, var(--pie-background, #fff));color:var(--pie-button-color, var(--pie-text, #333));border-radius:0.25rem;cursor:pointer;transition:background-color 0.15s ease, box-shadow 0.15s ease, transform 0.1s ease;}.pie-tool-tts-inline__trigger.svelte-18mzc0g:hover:not(:disabled),
	.pie-tool-tts-inline__control.svelte-18mzc0g:hover:not(:disabled) {background-color:var(--pie-button-hover-background-color, var(--pie-secondary-background, #f2f4f8));transform:translateY(-1px);box-shadow:0 2px 6px color-mix(in srgb, var(--pie-shadow, #000) 14%, transparent);}.pie-tool-tts-inline__trigger.svelte-18mzc0g:active:not(:disabled),
	.pie-tool-tts-inline__control.svelte-18mzc0g:active:not(:disabled) {transform:translateY(0);box-shadow:none;}.pie-tool-tts-inline__trigger.svelte-18mzc0g:focus-visible,
	.pie-tool-tts-inline__control.svelte-18mzc0g:focus-visible {outline:2px solid var(--pie-focus-outline, var(--pie-button-focus-outline, var(--pie-primary, #0066cc)));outline-offset:2px;box-shadow:0 0 0 4px color-mix(in srgb, var(--pie-primary, #0066cc) 22%, transparent);}.pie-tool-tts-inline__trigger--active.svelte-18mzc0g {border-color:var(--pie-primary, #1565c0);background-color:color-mix(in srgb, var(--pie-primary, #1565c0) 10%, var(--pie-background, #fff));}.pie-tool-tts-inline__panel.svelte-18mzc0g {display:inline-flex;flex-wrap:nowrap;align-items:center;justify-content:flex-end;gap:0.25rem;box-sizing:border-box;height:var(--pie-tts-controls-row-height, 2.875rem);padding:0 0.5rem;background:var(--pie-surface, var(--pie-background, #fff));border:1px solid var(--pie-border, #d0d0d0);border-radius:0.5rem;}.pie-tool-tts-inline__panel--floating.svelte-18mzc0g {position:absolute;z-index:2;top:100%;right:0;left:auto;}.pie-tool-tts-inline__panel--left-aligned-inline.svelte-18mzc0g {position:static;margin-right:0.5rem;}.pie-tool-tts-inline__panel--row.svelte-18mzc0g {position:absolute;z-index:2;top:100%;right:0;left:auto;}.pie-tool-tts-inline__control.svelte-18mzc0g {display:inline-flex;align-items:center;justify-content:center;width:2rem;height:2rem;border:1px solid var(--pie-button-border-color, var(--pie-border, #c6c6c6));border-radius:0.25rem;background:var(--pie-button-background-color, var(--pie-background, #fff));color:var(--pie-button-color, var(--pie-text, #222));cursor:pointer;transition:background-color 0.15s ease, box-shadow 0.15s ease, transform 0.1s ease;}.pie-tool-tts-inline__control--speed.svelte-18mzc0g {font-size:0.6875rem;font-weight:400;letter-spacing:0;white-space:nowrap;}.pie-tool-tts-inline__control--speed-active.svelte-18mzc0g {border-color:var(--pie-primary, #1565c0);background:color-mix(in srgb, var(--pie-primary, #1565c0) 14%, var(--pie-background, #fff));color:var(--pie-primary, #1565c0);font-weight:600;}.pie-tool-tts-inline__trigger.svelte-18mzc0g:disabled,
	.pie-tool-tts-inline__control.svelte-18mzc0g:disabled {cursor:not-allowed;opacity:0.6;}.pie-tool-tts-inline__trigger--sm.svelte-18mzc0g {width:1.75rem;height:1.75rem;}.pie-tool-tts-inline__trigger--sm.svelte-18mzc0g .pie-tool-tts-inline__icon:where(.svelte-18mzc0g) {width:1rem;height:1rem;}.pie-tool-tts-inline__trigger--md.svelte-18mzc0g {width:2rem;height:2rem;}.pie-tool-tts-inline__trigger--md.svelte-18mzc0g .pie-tool-tts-inline__icon:where(.svelte-18mzc0g) {width:1.25rem;height:1.25rem;}.pie-tool-tts-inline__trigger--lg.svelte-18mzc0g {width:2.5rem;height:2.5rem;}.pie-tool-tts-inline__trigger--lg.svelte-18mzc0g .pie-tool-tts-inline__icon:where(.svelte-18mzc0g) {width:1.5rem;height:1.5rem;}.pie-tool-tts-inline__icon.svelte-18mzc0g {
		/* Default explicit size so control-button icons (rewind/fast-forward/stop)
		   render in WebKit, which sizes an inline SVG that has only a viewBox (no
		   width/height attributes) to 0. The play/pause trigger icon already works
		   because the __trigger--sm/md/lg rules below set these dimensions; this
		   gives the control-panel icons the same treatment. Keep the SVG's default
		   inline display — forcing display:block makes WebKit collapse it to 0. */width:1.25rem;height:1.25rem;fill:currentColor;color:currentColor;}.pie-sr-only.svelte-18mzc0g {position:absolute;width:1px;height:1px;padding:0;margin:-1px;overflow:hidden;clip:rect(0, 0, 0, 0);white-space:nowrap;border:0;}

	@media (prefers-reduced-motion: reduce) {.pie-tool-tts-inline__trigger.svelte-18mzc0g,
		.pie-tool-tts-inline__control.svelte-18mzc0g {transition:none !important;}
	}`
};
function vs(t, e) {
  hi(e, !0), Yo(t, ds);
  let n = je(e, "catalogId", 7, ""), r = je(e, "language", 7, "en-US"), i = je(e, "size", 7, "md"), l = je(e, "speedOptions", 23, () => [...jr]), s = je(e, "layoutMode", 7, "expanding-row"), a = typeof window < "u", u = "__pie_tts_inline_active_owner__", f = "pie-tts-inline-owner-change", h = /* @__PURE__ */ D(void 0), v = /* @__PURE__ */ D(void 0), d = /* @__PURE__ */ D(null), w = /* @__PURE__ */ D(null), x = /* @__PURE__ */ D(null), m = /* @__PURE__ */ Dt(() => c(d)?.ttsService), p = /* @__PURE__ */ Dt(() => c(d)?.highlightCoordinator), _ = /* @__PURE__ */ Dt(() => c(x)?.scopeElement || c(w)?.scopeElement || null), A = /* @__PURE__ */ D(!1), I = /* @__PURE__ */ D(!1), k = /* @__PURE__ */ D(!1), C = /* @__PURE__ */ D(""), B = /* @__PURE__ */ D(1), P = /* @__PURE__ */ D(0), Z = /* @__PURE__ */ D(!1), K = /* @__PURE__ */ D(!1), V = /* @__PURE__ */ Dt(() => zl(l())), pt = `pie-tts-inline-instance-${Math.random().toString(36).slice(2)}`, yr = `pie-tts-inline-${Math.random().toString(36).slice(2)}`, $r = `${pt}-controls`;
  function Rn() {
    if (!a) return null;
    let g = window[u];
    return typeof g == "string" ? g : null;
  }
  function ae() {
    return Rn() === pt;
  }
  function kr(g, y) {
    a && window.dispatchEvent(new CustomEvent(f, { detail: {
      ownerId: g,
      previousOwnerId: y
    } }));
  }
  function rl() {
    if (!a) return;
    let g = Rn();
    g !== pt && (window[u] = pt, kr(pt, g));
  }
  function Ln() {
    a && Rn() === pt && (delete window[u], kr(null, pt));
  }
  function xr(g = "", y = !1) {
    b(I, !1), b(k, !1), b(P, 0), b(A, y, !0), b(C, g, !0);
  }
  function il(g) {
    if (!c(h) || !g) return;
    let y = c(h).getRootNode();
    y instanceof ShadowRoot && y.querySelector(".pie-tool-tts-inline__trigger")?.focus();
  }
  function Sr(g = "Reading switched to another section", y = !1) {
    if (!c(K) && !(!c(A) && !ae())) {
      b(K, !0);
      try {
        let N = (() => {
          if (!c(h) || !c(v)) return !1;
          let Yt = c(h).getRootNode();
          if (!(Yt instanceof ShadowRoot)) return !1;
          let nn = Yt.activeElement;
          return !!(nn && c(v).contains(nn));
        })();
        ae() && Ln(), xr(g), y && queueMicrotask(() => {
          il(N);
        });
      } finally {
        b(K, !1);
      }
    }
  }
  Qt(() => {
    if (c(h)) return Sl(c(h), (g) => {
      b(d, g, !0);
    });
  }), Qt(() => {
    if (!c(h)) return;
    let g = Ml(c(h), (N) => {
      b(w, N, !0);
    }), y = xl(c(h), (N) => {
      b(x, N, !0);
    });
    return () => {
      y(), g();
    };
  }), Qt(() => {
    if (!c(m)) return;
    let g = (N) => {
      if (!c(A) || !ae()) {
        b(I, !1), b(k, !1);
        return;
      }
      b(I, N === "playing" || N === "paused", !0), b(k, N === "paused");
    }, y = (N) => {
      g(N);
    };
    return c(m).onStateChange(yr, y), g(c(m).getState()), () => {
      c(m).offStateChange(yr, y);
    };
  }), Qt(() => {
    if (!a) return;
    let g = (y) => {
      let { ownerId: N = null, previousOwnerId: Yt = null } = y.detail || {};
      Yt === pt && N !== pt && Sr("Reading switched to another section");
    };
    return window.addEventListener(f, g), () => {
      window.removeEventListener(f, g);
    };
  }), Qt(() => {
    if (!a) return;
    let g = () => {
      Sr("Reading switched to another section", !0);
    };
    return window.addEventListener(Dr, g), () => {
      window.removeEventListener(Dr, g);
    };
  }), Qt(() => () => {
    Ln();
  });
  async function ll() {
    if (!c(m)) return !1;
    try {
      return await c(d)?.toolkitCoordinator?.ensureTTSReady?.(), !0;
    } catch (g) {
      return console.error("[TTS Inline] Failed to initialize TTS:", g), !1;
    }
  }
  function Mr() {
    return c(v) ? Array.from(c(v).querySelectorAll("[data-pie-tts-control]")) : [];
  }
  function en(g) {
    let y = Mr();
    if (!y.length) return;
    let N = (g + y.length) % y.length;
    b(P, N), y[N].focus();
  }
  function ol(g) {
    let y = Mr();
    if (y.length) switch (g.key) {
      case "ArrowDown":
      case "ArrowRight":
        g.preventDefault(), en(c(P) + 1);
        break;
      case "ArrowUp":
      case "ArrowLeft":
        g.preventDefault(), en(c(P) - 1);
        break;
      case "Home":
        g.preventDefault(), en(0);
        break;
      case "End":
        g.preventDefault(), en(y.length - 1);
        break;
    }
  }
  function sl() {
    if (!c(_)) return null;
    let g = c(_);
    if (g.getAttribute?.("data-region") === "content") return g;
    let y = g.querySelector?.("[data-region='content']");
    return y instanceof Element ? y : g;
  }
  function al() {
    if (c(w)) return c(w).kind === "passage" ? {
      ownerKind: "passage",
      assessmentId: c(d)?.assessmentId || "",
      sectionId: c(d)?.sectionId || "",
      passageId: c(w).canonicalItemId || c(w).itemId
    } : {
      ownerKind: "itemModel",
      assessmentId: c(d)?.assessmentId || "",
      sectionId: c(d)?.sectionId || "",
      itemId: c(w).itemId,
      canonicalItemId: c(w).canonicalItemId || c(w).itemId
    };
  }
  function ul() {
    if (!c(m)) return;
    let g = sl();
    if (!g) {
      console.warn("[TTS Inline] No target container found from shell scope context");
      return;
    }
    try {
      b(A, !0);
      let y = g.textContent || "";
      if (!y) {
        console.warn("[TTS Inline] No text content found");
        return;
      }
      c(p) && c(m).setHighlightCoordinator && c(m).setHighlightCoordinator(c(p)), c(m).setRootElement?.(g), b(C, "Reading started"), c(m).speak(y, {
        catalogId: n() || void 0,
        catalogContext: al(),
        language: r(),
        contentElement: g
      }).catch((N) => {
        console.error("[TTS Inline] Error:", N), b(C, "Unable to start reading"), c(p) && c(p).clearTTS();
      });
    } catch (y) {
      console.error("[TTS Inline] Error:", y), b(C, "Unable to start reading"), c(p) && c(p).clearTTS();
    }
  }
  async function fl() {
    if (c(m)) {
      if (ae() && c(k)) {
        c(m).resume(), b(C, "Reading resumed");
        return;
      }
      if (ae() && c(I) && !c(k)) {
        c(m).pause(), b(C, "Reading paused");
        return;
      }
      if (!c(Z)) {
        b(Z, !0);
        try {
          if (b(C, "Initializing text-to-speech"), !await ll()) {
            b(C, "Unable to initialize text-to-speech. Try again.");
            return;
          }
          let g = String(c(m).getState?.() || "");
          (g === "playing" || g === "paused" || g === "loading") && !ae() && c(m).stop(), rl(), ul();
        } finally {
          b(Z, !1);
        }
      }
    }
  }
  function cl() {
    c(m) && (c(m).stop(), Ln(), xr("Reading stopped"), c(p) && c(p).clearTTS());
  }
  async function hl() {
    if (!(!c(m) || !c(I))) try {
      await c(m).seekForward?.(1), b(C, "Skipped forward");
    } catch (g) {
      console.error("[TTS Inline] Seek forward failed:", g), b(C, "Unable to skip forward");
    }
  }
  async function dl() {
    if (!(!c(m) || !c(I))) try {
      await c(m).seekBackward?.(1), b(C, "Skipped backward");
    } catch (g) {
      console.error("[TTS Inline] Seek backward failed:", g), b(C, "Unable to skip backward");
    }
  }
  async function vl(g) {
    if (!c(m)) return;
    let y = c(B) === g ? 1 : g;
    b(B, y, !0), await c(m).updateSettings({ rate: y }), b(C, y === 1 ? "Playback speed reset to 1x" : `Playback speed ${y}x`, !0);
  }
  let pl = /* @__PURE__ */ Dt(() => i() === "sm" ? "pie-tool-tts-inline__trigger--sm" : i() === "lg" ? "pie-tool-tts-inline__trigger--lg" : "pie-tool-tts-inline__trigger--md"), zr = /* @__PURE__ */ Dt(() => s() === "reserved-row" || s() === "expanding-row"), Tr = /* @__PURE__ */ Dt(() => s() === "floating-overlay"), Er = /* @__PURE__ */ Dt(() => s() === "left-aligned");
  function gl() {
    if (!c(h)) return null;
    let g = c(h).getRootNode();
    return g instanceof ShadowRoot ? g.host : null;
  }
  Qt(() => {
    let g = gl();
    if (!g) return;
    let y = c(A) === !0;
    g.setAttribute("data-active", y ? "true" : "false");
    let N = !1;
    return queueMicrotask(() => {
      N || g.dispatchEvent(new CustomEvent("pie-tool-active-change", {
        detail: { active: y },
        bubbles: !0,
        composed: !0
      }));
    }), () => {
      N = !0;
    };
  });
  var ml = {
    get catalogId() {
      return n();
    },
    set catalogId(g = "") {
      n(g), me();
    },
    get language() {
      return r();
    },
    set language(g = "en-US") {
      r(g), me();
    },
    get size() {
      return i();
    },
    set size(g = "md") {
      i(g), me();
    },
    get speedOptions() {
      return l();
    },
    set speedOptions(g = [...jr]) {
      l(g), me();
    },
    get layoutMode() {
      return s();
    },
    set layoutMode(g = "expanding-row") {
      s(g), me();
    }
  }, Wr = Hn(), wl = Ne(Wr), _l = (g) => {
    var y = hs();
    let N;
    {
      let Or = (rt) => {
        var H = us();
        let yt;
        var jn = ce(H), Te = (It) => {
          lt(It, ss());
        }, Wt = (It) => {
          lt(It, as());
        };
        Re(jn, (It) => {
          c(I) && !c(k) ? It(Te) : It(Wt, -1);
        }), fe(H), Pe(() => {
          yt = hn(H, 1, `pie-tool-tts-inline__trigger ${c(pl) ?? ""}`, "svelte-18mzc0g", yt, { "pie-tool-tts-inline__trigger--active": c(A) }), xt(H, "aria-label", c(I) && !c(k) ? "Pause reading" : c(k) ? "Resume reading" : "Play reading"), xt(H, "aria-expanded", c(A)), xt(H, "aria-controls", c(A) ? $r : void 0), H.disabled = !c(m) || c(Z);
        }), de("click", H, fl), lt(rt, H);
      }, Ar = (rt) => {
        var H = Hn(), yt = Ne(H), jn = (Te) => {
          var Wt = cs();
          let It;
          var Cr = ce(Wt), $l = (Ie) => {
            var Nr = Hn();
            Ko(Ne(Nr), 18, () => c(V), (Dn) => Dn, (Dn, Oe, Pr) => {
              var $t = fs();
              let Rr;
              var Lr = ce($t), kl = ce(Lr);
              fe(Lr), fe($t), Pe(() => {
                Rr = hn($t, 1, "pie-tool-tts-inline__control pie-tool-tts-inline__control--speed svelte-18mzc0g", null, Rr, { "pie-tool-tts-inline__control--speed-active": c(B) === Oe }), xt($t, "tabindex", c(P) === c(Pr) ? 0 : -1), xt($t, "aria-label", `Speed ${Oe}x`), xt($t, "aria-pressed", c(B) === Oe), $t.disabled = !c(m), Zr(kl, `${Oe ?? ""}x`);
              }), de("click", $t, () => vl(Oe)), un("focus", $t, () => b(P, c(Pr), !0)), lt(Dn, $t);
            }), lt(Ie, Nr);
          };
          Re(Cr, (Ie) => {
            c(V).length > 0 && Ie($l);
          });
          var Ee = he(Cr, 2), We = he(Ee, 2), rn = he(We, 2);
          fe(Wt), ni(Wt, (Ie) => b(v, Ie), () => c(v)), Pe(() => {
            xt(Wt, "id", $r), It = hn(Wt, 1, "pie-tool-tts-inline__panel svelte-18mzc0g", null, It, {
              "pie-tool-tts-inline__panel--floating": c(Tr),
              "pie-tool-tts-inline__panel--row": c(zr),
              "pie-tool-tts-inline__panel--left-aligned-inline": c(Er)
            }), xt(Ee, "tabindex", c(P) === c(V).length ? 0 : -1), Ee.disabled = !c(m) || !c(I), xt(We, "tabindex", c(P) === c(V).length + 1 ? 0 : -1), We.disabled = !c(m) || !c(I), xt(rn, "tabindex", c(P) === c(V).length + 2 ? 0 : -1), rn.disabled = !c(m) || !c(I) && !c(k);
          }), de("keydown", Wt, ol), de("click", Ee, dl), un("focus", Ee, () => b(P, c(V).length, !0)), de("click", We, hl), un("focus", We, () => b(P, c(V).length + 1)), de("click", rn, cl), un("focus", rn, () => b(P, c(V).length + 2)), lt(Te, Wt);
        };
        Re(yt, (Te) => {
          c(A) && Te(jn);
        }), lt(rt, H);
      };
      var Yt = ce(y), nn = (rt) => {
        var H = ri(), yt = Ne(H);
        Ar(yt), Or(he(yt, 2)), lt(rt, H);
      }, bl = (rt) => {
        var H = ri(), yt = Ne(H);
        Or(yt), Ar(he(yt, 2)), lt(rt, H);
      };
      Re(Yt, (rt) => {
        c(Er) ? rt(nn) : rt(bl, -1);
      });
      var Ir = he(Yt, 2), yl = ce(Ir, !0);
      fe(Ir), fe(y), ni(y, (rt) => b(h, rt), () => c(h)), Pe(() => Zr(yl, c(C)));
    }
    Pe(() => N = hn(y, 1, "pie-tool-tts-inline svelte-18mzc0g", null, N, {
      "pie-tool-tts-inline--controls-row": c(zr),
      "pie-tool-tts-inline--floating": c(Tr)
    })), lt(g, y);
  };
  return Re(wl, (g) => {
    a && g(_l);
  }), lt(t, Wr), di(ml);
}
Ro(["click", "keydown"]), customElements.define("pie-tool-tts-inline", os(vs, {
  catalogId: {
    attribute: "catalog-id",
    type: "String"
  },
  language: {
    attribute: "language",
    type: "String"
  },
  size: {
    attribute: "size",
    type: "String"
  },
  speedOptions: {
    attribute: "speed-options",
    type: "Array"
  },
  layoutMode: {
    attribute: "layout-mode",
    type: "String"
  }
}, [], [], { mode: "open" }));
export {
  vs as default
};
