typeof window < "u" && ((window.__svelte ??= {}).v ??= /* @__PURE__ */ new Set()).add("5");
let Kt = !1, Cr = !1;
function Lr() {
  Kt = !0;
}
Lr();
const Ir = 1, Mr = 2, In = 4, Fr = 8, jr = 16, zr = 1, Dr = 2, Ur = 4, qr = 1, Br = 2, Ye = "[", Mn = "[!", Fn = "]", Nt = {}, N = Symbol(), Vr = "http://www.w3.org/1999/xhtml", jn = !1;
var Ge = Array.isArray, Wr = Array.prototype.indexOf, Hr = Array.from, he = Object.keys, Lt = Object.defineProperty, st = Object.getOwnPropertyDescriptor, zn = Object.getOwnPropertyDescriptors, Yr = Object.prototype, Gr = Array.prototype, Je = Object.getPrototypeOf, dn = Object.isExtensible;
function Rt(t) {
  return typeof t == "function";
}
const Ut = () => {
};
function Jr(t) {
  return t();
}
function ge(t) {
  for (var e = 0; e < t.length; e++)
    t[e]();
}
function Kr() {
  var t, e, n = new Promise((r, s) => {
    t = r, e = s;
  });
  return { promise: n, resolve: t, reject: e };
}
const D = 2, Ke = 4, be = 8, Ft = 16, ct = 32, vt = 64, Dn = 128, B = 256, ve = 512, L = 1024, W = 2048, _t = 4096, gt = 8192, Pt = 16384, we = 32768, Xt = 65536, hn = 1 << 17, Un = 1 << 18, Xe = 1 << 19, Ze = 1 << 20, Le = 1 << 21, Qe = 1 << 22, pt = 1 << 23, ht = Symbol("$state"), tn = Symbol("legacy props"), Xr = Symbol(""), en = new class extends Error {
  name = "StaleReactionError";
  message = "The reaction that called `getAbortSignal()` was re-run or destroyed";
}(), Zr = 3, Wt = 8;
function Qr() {
  throw new Error("https://svelte.dev/e/await_outside_boundary");
}
function ti() {
  throw new Error("https://svelte.dev/e/async_derived_orphan");
}
function ei(t) {
  throw new Error("https://svelte.dev/e/effect_in_teardown");
}
function ni() {
  throw new Error("https://svelte.dev/e/effect_in_unowned_derived");
}
function ri(t) {
  throw new Error("https://svelte.dev/e/effect_orphan");
}
function ii() {
  throw new Error("https://svelte.dev/e/effect_update_depth_exceeded");
}
function si() {
  throw new Error("https://svelte.dev/e/hydration_failed");
}
function oi(t) {
  throw new Error("https://svelte.dev/e/props_invalid_value");
}
function ai() {
  throw new Error("https://svelte.dev/e/state_descriptors_fixed");
}
function li() {
  throw new Error("https://svelte.dev/e/state_prototype_fixed");
}
function ci() {
  throw new Error("https://svelte.dev/e/state_unsafe_mutation");
}
function ye(t) {
  console.warn("https://svelte.dev/e/hydration_mismatch");
}
let E = !1;
function ft(t) {
  E = t;
}
let T;
function at(t) {
  if (t === null)
    throw ye(), Nt;
  return T = t;
}
function Zt() {
  return at(
    /** @type {TemplateNode} */
    /* @__PURE__ */ X(T)
  );
}
function oe(t) {
  if (E) {
    if (/* @__PURE__ */ X(T) !== null)
      throw ye(), Nt;
    T = t;
  }
}
function ui(t = 1) {
  if (E) {
    for (var e = t, n = T; e--; )
      n = /** @type {TemplateNode} */
      /* @__PURE__ */ X(n);
    T = n;
  }
}
function fi() {
  for (var t = 0, e = T; ; ) {
    if (e.nodeType === Wt) {
      var n = (
        /** @type {Comment} */
        e.data
      );
      if (n === Fn) {
        if (t === 0) return e;
        t -= 1;
      } else (n === Ye || n === Mn) && (t += 1);
    }
    var r = (
      /** @type {TemplateNode} */
      /* @__PURE__ */ X(e)
    );
    e.remove(), e = r;
  }
}
function di(t) {
  if (!t || t.nodeType !== Wt)
    throw ye(), Nt;
  return (
    /** @type {Comment} */
    t.data
  );
}
function qn(t) {
  return t === this.v;
}
function hi(t, e) {
  return t != t ? e == e : t !== e || t !== null && typeof t == "object" || typeof t == "function";
}
function Bn(t) {
  return !hi(t, this.v);
}
let C = null;
function _e(t) {
  C = t;
}
function et(t, e = !1, n) {
  C = {
    p: C,
    c: null,
    e: null,
    s: t,
    x: null,
    l: Kt && !e ? { s: null, u: null, $: [] } : null
  };
}
function nt(t) {
  var e = (
    /** @type {ComponentContext} */
    C
  ), n = e.e;
  if (n !== null) {
    e.e = null;
    for (var r of n)
      ir(r);
  }
  return t !== void 0 && (e.x = t), C = e.p, t ?? /** @type {T} */
  {};
}
function Qt() {
  return !Kt || C !== null && C.l === null;
}
const gi = /* @__PURE__ */ new WeakMap();
function vi(t) {
  var e = k;
  if (e === null)
    return $.f |= pt, t;
  if ((e.f & we) === 0) {
    if ((e.f & Dn) === 0)
      throw !e.parent && t instanceof Error && Vn(t), t;
    e.b.error(t);
  } else
    nn(t, e);
}
function nn(t, e) {
  for (; e !== null; ) {
    if ((e.f & Dn) !== 0)
      try {
        e.b.error(t);
        return;
      } catch (n) {
        t = n;
      }
    e = e.parent;
  }
  throw t instanceof Error && Vn(t), t;
}
function Vn(t) {
  const e = gi.get(t);
  e && (Lt(t, "message", {
    value: e.message
  }), Lt(t, "stack", {
    value: e.stack
  }));
}
let Ht = [], Ie = [];
function Wn() {
  var t = Ht;
  Ht = [], ge(t);
}
function _i() {
  var t = Ie;
  Ie = [], ge(t);
}
function rn(t) {
  Ht.length === 0 && queueMicrotask(Wn), Ht.push(t);
}
function pi() {
  Ht.length > 0 && Wn(), Ie.length > 0 && _i();
}
function mi() {
  for (var t = (
    /** @type {Effect} */
    k.b
  ); t !== null && !t.has_pending_snippet(); )
    t = t.parent;
  return t === null && Qr(), t;
}
// @__NO_SIDE_EFFECTS__
function ke(t) {
  var e = D | W, n = $ !== null && ($.f & D) !== 0 ? (
    /** @type {Derived} */
    $
  ) : null;
  return k === null || n !== null && (n.f & B) !== 0 ? e |= B : k.f |= Xe, {
    ctx: C,
    deps: null,
    effects: null,
    equals: qn,
    f: e,
    fn: t,
    reactions: null,
    rv: 0,
    v: (
      /** @type {V} */
      N
    ),
    wv: 0,
    parent: n ?? k,
    ac: null
  };
}
// @__NO_SIDE_EFFECTS__
function bi(t, e) {
  let n = (
    /** @type {Effect | null} */
    k
  );
  n === null && ti();
  var r = (
    /** @type {Boundary} */
    n.b
  ), s = (
    /** @type {Promise<V>} */
    /** @type {unknown} */
    void 0
  ), i = Ee(
    /** @type {V} */
    N
  ), o = null, a = !$;
  return Oi(() => {
    try {
      var l = t();
    } catch (g) {
      l = Promise.reject(g);
    }
    var c = () => l;
    s = o?.then(c, c) ?? Promise.resolve(l), o = s;
    var d = (
      /** @type {Batch} */
      A
    ), v = r.pending;
    a && (r.update_pending_count(1), v || d.increment());
    const h = (g, u = void 0) => {
      o = null, v || d.activate(), u ? u !== en && (i.f |= pt, Fe(i, u)) : ((i.f & pt) !== 0 && (i.f ^= pt), Fe(i, g)), a && (r.update_pending_count(-1), v || d.decrement()), Jn();
    };
    if (s.then(h, (g) => h(null, g || "unknown")), d)
      return () => {
        queueMicrotask(() => d.neuter());
      };
  }), new Promise((l) => {
    function c(d) {
      function v() {
        d === s ? l(i) : c(s);
      }
      d.then(v, v);
    }
    c(s);
  });
}
// @__NO_SIDE_EFFECTS__
function Hn(t) {
  const e = /* @__PURE__ */ ke(t);
  return e.equals = Bn, e;
}
function Yn(t) {
  var e = t.effects;
  if (e !== null) {
    t.effects = null;
    for (var n = 0; n < e.length; n += 1)
      lt(
        /** @type {Effect} */
        e[n]
      );
  }
}
function wi(t) {
  for (var e = t.parent; e !== null; ) {
    if ((e.f & D) === 0)
      return (
        /** @type {Effect} */
        e
      );
    e = e.parent;
  }
  return null;
}
function sn(t) {
  var e, n = k;
  Q(wi(t));
  try {
    Yn(t), e = gr(t);
  } finally {
    Q(n);
  }
  return e;
}
function Gn(t) {
  var e = sn(t);
  if (t.equals(e) || (t.v = e, t.wv = dr()), !Tt)
    if (It !== null)
      It.set(t, t.v);
    else {
      var n = (dt || (t.f & B) !== 0) && t.deps !== null ? _t : L;
      F(t, n);
    }
}
function yi(t, e, n) {
  const r = Qt() ? ke : Hn;
  if (e.length === 0) {
    n(t.map(r));
    return;
  }
  var s = A, i = (
    /** @type {Effect} */
    k
  ), o = ki(), a = mi();
  Promise.all(e.map((l) => /* @__PURE__ */ bi(l))).then((l) => {
    s?.activate(), o();
    try {
      n([...t.map(r), ...l]);
    } catch (c) {
      (i.f & Pt) === 0 && nn(c, i);
    }
    s?.deactivate(), Jn();
  }).catch((l) => {
    a.error(l);
  });
}
function ki() {
  var t = k, e = $, n = C;
  return function() {
    Q(t), Z(e), _e(n);
  };
}
function Jn() {
  Q(null), Z(null), _e(null);
}
const qt = /* @__PURE__ */ new Set();
let A = null, It = null, gn = /* @__PURE__ */ new Set(), pe = [];
function Kn() {
  const t = (
    /** @type {() => void} */
    pe.shift()
  );
  pe.length > 0 && queueMicrotask(Kn), t();
}
let wt = [], $e = null, Me = !1, ae = !1;
class yt {
  /**
   * The current values of any sources that are updated in this batch
   * They keys of this map are identical to `this.#previous`
   * @type {Map<Source, any>}
   */
  current = /* @__PURE__ */ new Map();
  /**
   * The values of any sources that are updated in this batch _before_ those updates took place.
   * They keys of this map are identical to `this.#current`
   * @type {Map<Source, any>}
   */
  #e = /* @__PURE__ */ new Map();
  /**
   * When the batch is committed (and the DOM is updated), we need to remove old branches
   * and append new ones by calling the functions added inside (if/each/key/etc) blocks
   * @type {Set<() => void>}
   */
  #t = /* @__PURE__ */ new Set();
  /**
   * The number of async effects that are currently in flight
   */
  #n = 0;
  /**
   * A deferred that resolves when the batch is committed, used with `settled()`
   * TODO replace with Promise.withResolvers once supported widely enough
   * @type {{ promise: Promise<void>, resolve: (value?: any) => void, reject: (reason: unknown) => void } | null}
   */
  #c = null;
  /**
   * True if an async effect inside this batch resolved and
   * its parent branch was already deleted
   */
  #u = !1;
  /**
   * Async effects (created inside `async_derived`) encountered during processing.
   * These run after the rest of the batch has updated, since they should
   * always have the latest values
   * @type {Effect[]}
   */
  #i = [];
  /**
   * The same as `#async_effects`, but for effects inside a newly-created
   * `<svelte:boundary>` — these do not prevent the batch from committing
   * @type {Effect[]}
   */
  #o = [];
  /**
   * Template effects and `$effect.pre` effects, which run when
   * a batch is committed
   * @type {Effect[]}
   */
  #s = [];
  /**
   * The same as `#render_effects`, but for `$effect` (which runs after)
   * @type {Effect[]}
   */
  #r = [];
  /**
   * Block effects, which may need to re-run on subsequent flushes
   * in order to update internal sources (e.g. each block items)
   * @type {Effect[]}
   */
  #a = [];
  /**
   * Deferred effects (which run after async work has completed) that are DIRTY
   * @type {Effect[]}
   */
  #f = [];
  /**
   * Deferred effects that are MAYBE_DIRTY
   * @type {Effect[]}
   */
  #d = [];
  /**
   * A set of branches that still exist, but will be destroyed when this batch
   * is committed — we skip over these during `process`
   * @type {Set<Effect>}
   */
  skipped_effects = /* @__PURE__ */ new Set();
  /**
   *
   * @param {Effect[]} root_effects
   */
  process(e) {
    wt = [];
    var n = null;
    if (qt.size > 1) {
      n = /* @__PURE__ */ new Map(), It = /* @__PURE__ */ new Map();
      for (const [i, o] of this.current)
        n.set(i, { v: i.v, wv: i.wv }), i.v = o;
      for (const i of qt)
        if (i !== this)
          for (const [o, a] of i.#e)
            n.has(o) || (n.set(o, { v: o.v, wv: o.wv }), o.v = a);
    }
    for (const i of e)
      this.#g(i);
    if (this.#i.length === 0 && this.#n === 0) {
      this.#h();
      var r = this.#s, s = this.#r;
      this.#s = [], this.#r = [], this.#a = [], A = null, vn(r), vn(s), A === null ? A = this : qt.delete(this), this.#c?.resolve();
    } else
      this.#l(this.#s), this.#l(this.#r), this.#l(this.#a);
    if (n) {
      for (const [i, { v: o, wv: a }] of n)
        i.wv <= a && (i.v = o);
      It = null;
    }
    for (const i of this.#i)
      Vt(i);
    for (const i of this.#o)
      Vt(i);
    this.#i = [], this.#o = [];
  }
  /**
   * Traverse the effect tree, executing effects or stashing
   * them for later execution as appropriate
   * @param {Effect} root
   */
  #g(e) {
    e.f ^= L;
    for (var n = e.first; n !== null; ) {
      var r = n.f, s = (r & (ct | vt)) !== 0, i = s && (r & L) !== 0, o = i || (r & gt) !== 0 || this.skipped_effects.has(n);
      if (!o && n.fn !== null) {
        if (s)
          n.f ^= L;
        else if ((r & L) === 0)
          if ((r & Ke) !== 0)
            this.#r.push(n);
          else if ((r & Qe) !== 0) {
            var a = n.b?.pending ? this.#o : this.#i;
            a.push(n);
          } else Ae(n) && ((n.f & Ft) !== 0 && this.#a.push(n), Vt(n));
        var l = n.first;
        if (l !== null) {
          n = l;
          continue;
        }
      }
      var c = n.parent;
      for (n = n.next; n === null && c !== null; )
        n = c.next, c = c.parent;
    }
  }
  /**
   * @param {Effect[]} effects
   */
  #l(e) {
    for (const n of e)
      ((n.f & W) !== 0 ? this.#f : this.#d).push(n), F(n, L);
    e.length = 0;
  }
  /**
   * Associate a change to a given source with the current
   * batch, noting its previous and current values
   * @param {Source} source
   * @param {any} value
   */
  capture(e, n) {
    this.#e.has(e) || this.#e.set(e, n), this.current.set(e, e.v);
  }
  activate() {
    A = this;
  }
  deactivate() {
    A = null;
    for (const e of gn)
      if (gn.delete(e), e(), A !== null)
        break;
  }
  neuter() {
    this.#u = !0;
  }
  flush() {
    wt.length > 0 ? Xn() : this.#h(), A === this && (this.#n === 0 && qt.delete(this), this.deactivate());
  }
  /**
   * Append and remove branches to/from the DOM
   */
  #h() {
    if (!this.#u)
      for (const e of this.#t)
        e();
    this.#t.clear();
  }
  increment() {
    this.#n += 1;
  }
  decrement() {
    if (this.#n -= 1, this.#n === 0) {
      for (const e of this.#f)
        F(e, W), kt(e);
      for (const e of this.#d)
        F(e, _t), kt(e);
      this.#s = [], this.#r = [], this.flush();
    } else
      this.deactivate();
  }
  /** @param {() => void} fn */
  add_callback(e) {
    this.#t.add(e);
  }
  settled() {
    return (this.#c ??= Kr()).promise;
  }
  static ensure() {
    if (A === null) {
      const e = A = new yt();
      qt.add(A), ae || yt.enqueue(() => {
        A === e && e.flush();
      });
    }
    return A;
  }
  /** @param {() => void} task */
  static enqueue(e) {
    pe.length === 0 && queueMicrotask(Kn), pe.unshift(e);
  }
}
function p(t) {
  var e = ae;
  ae = !0;
  try {
    for (var n; ; ) {
      if (pi(), wt.length === 0 && (A?.flush(), wt.length === 0))
        return $e = null, /** @type {T} */
        n;
      Xn();
    }
  } finally {
    ae = e;
  }
}
function Xn() {
  var t = Ct;
  Me = !0;
  try {
    var e = 0;
    for (wn(!0); wt.length > 0; ) {
      var n = yt.ensure();
      if (e++ > 1e3) {
        var r, s;
        $i();
      }
      n.process(wt), mt.clear();
    }
  } finally {
    Me = !1, wn(t), $e = null;
  }
}
function $i() {
  try {
    ii();
  } catch (t) {
    nn(t, $e);
  }
}
function vn(t) {
  var e = t.length;
  if (e !== 0) {
    for (var n = 0; n < e; ) {
      var r = t[n++];
      if ((r.f & (Pt | gt)) === 0 && Ae(r)) {
        var s = A ? A.current.size : 0;
        if (Vt(r), r.deps === null && r.first === null && r.nodes_start === null && (r.teardown === null && r.ac === null ? lr(r) : r.fn = null), A !== null && A.current.size > s && (r.f & Ze) !== 0)
          break;
      }
    }
    for (; n < e; )
      kt(t[n++]);
  }
}
function kt(t) {
  for (var e = $e = t; e.parent !== null; ) {
    e = e.parent;
    var n = e.f;
    if (Me && e === k && (n & Ft) !== 0)
      return;
    if ((n & (vt | ct)) !== 0) {
      if ((n & L) === 0) return;
      e.f ^= L;
    }
  }
  wt.push(e);
}
const mt = /* @__PURE__ */ new Map();
function Ee(t, e) {
  var n = {
    f: 0,
    // TODO ideally we could skip this altogether, but it causes type errors
    v: t,
    reactions: null,
    equals: qn,
    rv: 0,
    wv: 0
  };
  return n;
}
// @__NO_SIDE_EFFECTS__
function rt(t, e) {
  const n = Ee(t);
  return Mi(n), n;
}
// @__NO_SIDE_EFFECTS__
function Se(t, e = !1, n = !0) {
  const r = Ee(t);
  return e || (r.equals = Bn), Kt && n && C !== null && C.l !== null && (C.l.s ??= []).push(r), r;
}
function M(t, e, n = !1) {
  $ !== 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
  (!K || ($.f & hn) !== 0) && Qt() && ($.f & (D | Ft | Qe | hn)) !== 0 && !ot?.includes(t) && ci();
  let r = n ? Ot(e) : e;
  return Fe(t, r);
}
function Fe(t, e) {
  if (!t.equals(e)) {
    var n = t.v;
    Tt ? mt.set(t, e) : mt.set(t, n), t.v = e;
    var r = yt.ensure();
    r.capture(t, n), (t.f & D) !== 0 && ((t.f & W) !== 0 && sn(
      /** @type {Derived} */
      t
    ), F(t, (t.f & B) === 0 ? L : _t)), t.wv = dr(), Zn(t, W), Qt() && k !== null && (k.f & L) !== 0 && (k.f & (ct | vt)) === 0 && (q === null ? Fi([t]) : q.push(t));
  }
  return e;
}
function _n(t, e = 1) {
  var n = x(t), r = e === 1 ? n++ : n--;
  return M(t, n), r;
}
function Oe(t) {
  M(t, t.v + 1);
}
function Zn(t, e) {
  var n = t.reactions;
  if (n !== null)
    for (var r = Qt(), s = n.length, i = 0; i < s; i++) {
      var o = n[i], a = o.f;
      if (!(!r && o === k)) {
        var l = (a & W) === 0;
        l && F(o, e), (a & D) !== 0 ? Zn(
          /** @type {Derived} */
          o,
          _t
        ) : l && kt(
          /** @type {Effect} */
          o
        );
      }
    }
}
function Ot(t) {
  if (typeof t != "object" || t === null || ht in t)
    return t;
  const e = Je(t);
  if (e !== Yr && e !== Gr)
    return t;
  var n = /* @__PURE__ */ new Map(), r = Ge(t), s = /* @__PURE__ */ rt(0), i = bt, o = (a) => {
    if (bt === i)
      return a();
    var l = $, c = bt;
    Z(null), kn(i);
    var d = a();
    return Z(l), kn(c), d;
  };
  return r && n.set("length", /* @__PURE__ */ rt(
    /** @type {any[]} */
    t.length
  )), new Proxy(
    /** @type {any} */
    t,
    {
      defineProperty(a, l, c) {
        (!("value" in c) || c.configurable === !1 || c.enumerable === !1 || c.writable === !1) && ai();
        var d = n.get(l);
        return d === void 0 ? d = o(() => {
          var v = /* @__PURE__ */ rt(c.value);
          return n.set(l, v), v;
        }) : M(d, c.value, !0), !0;
      },
      deleteProperty(a, l) {
        var c = n.get(l);
        if (c === void 0) {
          if (l in a) {
            const d = o(() => /* @__PURE__ */ rt(N));
            n.set(l, d), Oe(s);
          }
        } else
          M(c, N), Oe(s);
        return !0;
      },
      get(a, l, c) {
        if (l === ht)
          return t;
        var d = n.get(l), v = l in a;
        if (d === void 0 && (!v || st(a, l)?.writable) && (d = o(() => {
          var g = Ot(v ? a[l] : N), u = /* @__PURE__ */ rt(g);
          return u;
        }), n.set(l, d)), d !== void 0) {
          var h = x(d);
          return h === N ? void 0 : h;
        }
        return Reflect.get(a, l, c);
      },
      getOwnPropertyDescriptor(a, l) {
        var c = Reflect.getOwnPropertyDescriptor(a, l);
        if (c && "value" in c) {
          var d = n.get(l);
          d && (c.value = x(d));
        } else if (c === void 0) {
          var v = n.get(l), h = v?.v;
          if (v !== void 0 && h !== N)
            return {
              enumerable: !0,
              configurable: !0,
              value: h,
              writable: !0
            };
        }
        return c;
      },
      has(a, l) {
        if (l === ht)
          return !0;
        var c = n.get(l), d = c !== void 0 && c.v !== N || Reflect.has(a, l);
        if (c !== void 0 || k !== null && (!d || st(a, l)?.writable)) {
          c === void 0 && (c = o(() => {
            var h = d ? Ot(a[l]) : N, g = /* @__PURE__ */ rt(h);
            return g;
          }), n.set(l, c));
          var v = x(c);
          if (v === N)
            return !1;
        }
        return d;
      },
      set(a, l, c, d) {
        var v = n.get(l), h = l in a;
        if (r && l === "length")
          for (var g = c; g < /** @type {Source<number>} */
          v.v; g += 1) {
            var u = n.get(g + "");
            u !== void 0 ? M(u, N) : g in a && (u = o(() => /* @__PURE__ */ rt(N)), n.set(g + "", u));
          }
        if (v === void 0)
          (!h || st(a, l)?.writable) && (v = o(() => /* @__PURE__ */ rt(void 0)), M(v, Ot(c)), n.set(l, v));
        else {
          h = v.v !== N;
          var f = o(() => Ot(c));
          M(v, f);
        }
        var w = Reflect.getOwnPropertyDescriptor(a, l);
        if (w?.set && w.set.call(d, c), !h) {
          if (r && typeof l == "string") {
            var b = (
              /** @type {Source<number>} */
              n.get("length")
            ), y = Number(l);
            Number.isInteger(y) && y >= b.v && M(b, y + 1);
          }
          Oe(s);
        }
        return !0;
      },
      ownKeys(a) {
        x(s);
        var l = Reflect.ownKeys(a).filter((v) => {
          var h = n.get(v);
          return h === void 0 || h.v !== N;
        });
        for (var [c, d] of n)
          d.v !== N && !(c in a) && l.push(c);
        return l;
      },
      setPrototypeOf() {
        li();
      }
    }
  );
}
var pn, Qn, tr, er;
function je() {
  if (pn === void 0) {
    pn = window, Qn = /Firefox/.test(navigator.userAgent);
    var t = Element.prototype, e = Node.prototype, n = Text.prototype;
    tr = st(e, "firstChild").get, er = st(e, "nextSibling").get, dn(t) && (t.__click = void 0, t.__className = void 0, t.__attributes = null, t.__style = void 0, t.__e = void 0), dn(n) && (n.__t = void 0);
  }
}
function jt(t = "") {
  return document.createTextNode(t);
}
// @__NO_SIDE_EFFECTS__
function $t(t) {
  return tr.call(t);
}
// @__NO_SIDE_EFFECTS__
function X(t) {
  return er.call(t);
}
function le(t, e) {
  if (!E)
    return /* @__PURE__ */ $t(t);
  var n = (
    /** @type {TemplateNode} */
    /* @__PURE__ */ $t(T)
  );
  return n === null && (n = T.appendChild(jt())), at(n), n;
}
function Ei(t, e) {
  if (!E) {
    var n = (
      /** @type {DocumentFragment} */
      /* @__PURE__ */ $t(
        /** @type {Node} */
        t
      )
    );
    return n instanceof Comment && n.data === "" ? /* @__PURE__ */ X(n) : n;
  }
  return T;
}
function mn(t, e = 1, n = !1) {
  let r = E ? T : t;
  for (var s; e--; )
    s = r, r = /** @type {TemplateNode} */
    /* @__PURE__ */ X(r);
  if (!E)
    return r;
  if (n && r?.nodeType !== Zr) {
    var i = jt();
    return r === null ? s?.after(i) : r.before(i), at(i), i;
  }
  return at(r), /** @type {TemplateNode} */
  r;
}
function Si(t) {
  t.textContent = "";
}
function nr() {
  return !1;
}
function te(t) {
  var e = $, n = k;
  Z(null), Q(null);
  try {
    return t();
  } finally {
    Z(e), Q(n);
  }
}
function rr(t) {
  k === null && $ === null && ri(), $ !== null && ($.f & B) !== 0 && k === null && ni(), Tt && ei();
}
function Pi(t, e) {
  var n = e.last;
  n === null ? e.last = e.first = t : (n.next = t, t.prev = n, e.last = t);
}
function G(t, e, n, r = !0) {
  var s = k;
  s !== null && (s.f & gt) !== 0 && (t |= gt);
  var i = {
    ctx: C,
    deps: null,
    nodes_start: null,
    nodes_end: null,
    f: t | W,
    first: null,
    fn: e,
    last: null,
    next: null,
    parent: s,
    b: s && s.b,
    prev: null,
    teardown: null,
    transitions: null,
    wv: 0,
    ac: null
  };
  if (n)
    try {
      Vt(i), i.f |= we;
    } catch (l) {
      throw lt(i), l;
    }
  else e !== null && kt(i);
  var o = n && i.deps === null && i.first === null && i.nodes_start === null && i.teardown === null && (i.f & Xe) === 0;
  if (!o && r && (s !== null && Pi(i, s), $ !== null && ($.f & D) !== 0 && (t & vt) === 0)) {
    var a = (
      /** @type {Derived} */
      $
    );
    (a.effects ??= []).push(i);
  }
  return i;
}
function Ti(t) {
  const e = G(be, null, !1);
  return F(e, L), e.teardown = t, e;
}
function bn(t) {
  rr();
  var e = (
    /** @type {Effect} */
    k.f
  ), n = !$ && (e & ct) !== 0 && (e & we) === 0;
  if (n) {
    var r = (
      /** @type {ComponentContext} */
      C
    );
    (r.e ??= []).push(t);
  } else
    return ir(t);
}
function ir(t) {
  return G(Ke | Ze, t, !1);
}
function Ai(t) {
  return rr(), G(be | Ze, t, !0);
}
function xi(t) {
  yt.ensure();
  const e = G(vt, t, !0);
  return () => {
    lt(e);
  };
}
function Ri(t) {
  yt.ensure();
  const e = G(vt, t, !0);
  return (n = {}) => new Promise((r) => {
    n.outro ? on(e, () => {
      lt(e), r(void 0);
    }) : (lt(e), r(void 0));
  });
}
function Pe(t) {
  return G(Ke, t, !1);
}
function Oi(t) {
  return G(Qe | Xe, t, !0);
}
function sr(t, e = 0) {
  return G(be | e, t, !0);
}
function Et(t, e = [], n = []) {
  yi(e, n, (r) => {
    G(be, () => t(...r.map(x)), !0);
  });
}
function Te(t, e = 0) {
  var n = G(Ft | e, t, !0);
  return n;
}
function Yt(t, e = !0) {
  return G(ct, t, !0, e);
}
function or(t) {
  var e = t.teardown;
  if (e !== null) {
    const n = Tt, r = $;
    yn(!0), Z(null);
    try {
      e.call(null);
    } finally {
      yn(n), Z(r);
    }
  }
}
function ar(t, e = !1) {
  var n = t.first;
  for (t.first = t.last = null; n !== null; ) {
    const s = n.ac;
    s !== null && te(() => {
      s.abort(en);
    });
    var r = n.next;
    (n.f & vt) !== 0 ? n.parent = null : lt(n, e), n = r;
  }
}
function Ni(t) {
  for (var e = t.first; e !== null; ) {
    var n = e.next;
    (e.f & ct) === 0 && lt(e), e = n;
  }
}
function lt(t, e = !0) {
  var n = !1;
  (e || (t.f & Un) !== 0) && t.nodes_start !== null && t.nodes_end !== null && (Ci(
    t.nodes_start,
    /** @type {TemplateNode} */
    t.nodes_end
  ), n = !0), ar(t, e && !n), me(t, 0), F(t, Pt);
  var r = t.transitions;
  if (r !== null)
    for (const i of r)
      i.stop();
  or(t);
  var s = t.parent;
  s !== null && s.first !== null && lr(t), t.next = t.prev = t.teardown = t.ctx = t.deps = t.fn = t.nodes_start = t.nodes_end = t.ac = null;
}
function Ci(t, e) {
  for (; t !== null; ) {
    var n = t === e ? null : (
      /** @type {TemplateNode} */
      /* @__PURE__ */ X(t)
    );
    t.remove(), t = n;
  }
}
function lr(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 on(t, e) {
  var n = [];
  cr(t, n, !0), Li(n, () => {
    lt(t), e && e();
  });
}
function Li(t, e) {
  var n = t.length;
  if (n > 0) {
    var r = () => --n || e();
    for (var s of t)
      s.out(r);
  } else
    e();
}
function cr(t, e, n) {
  if ((t.f & gt) === 0) {
    if (t.f ^= gt, t.transitions !== null)
      for (const o of t.transitions)
        (o.is_global || n) && e.push(o);
    for (var r = t.first; r !== null; ) {
      var s = r.next, i = (r.f & Xt) !== 0 || (r.f & ct) !== 0;
      cr(r, e, i ? n : !1), r = s;
    }
  }
}
function Ii(t) {
  ur(t, !0);
}
function ur(t, e) {
  if ((t.f & gt) !== 0) {
    t.f ^= gt, (t.f & L) === 0 && (F(t, W), kt(t));
    for (var n = t.first; n !== null; ) {
      var r = n.next, s = (n.f & Xt) !== 0 || (n.f & ct) !== 0;
      ur(n, s ? e : !1), n = r;
    }
    if (t.transitions !== null)
      for (const i of t.transitions)
        (i.is_global || e) && i.in();
  }
}
let Ct = !1;
function wn(t) {
  Ct = t;
}
let Tt = !1;
function yn(t) {
  Tt = t;
}
let $ = null, K = !1;
function Z(t) {
  $ = t;
}
let k = null;
function Q(t) {
  k = t;
}
let ot = null;
function Mi(t) {
  $ !== null && (ot === null ? ot = [t] : ot.push(t));
}
let I = null, z = 0, q = null;
function Fi(t) {
  q = t;
}
let fr = 1, Gt = 0, bt = Gt;
function kn(t) {
  bt = t;
}
let dt = !1;
function dr() {
  return ++fr;
}
function Ae(t) {
  var e = t.f;
  if ((e & W) !== 0)
    return !0;
  if ((e & _t) !== 0) {
    var n = t.deps, r = (e & B) !== 0;
    if (n !== null) {
      var s, i, o = (e & ve) !== 0, a = r && k !== null && !dt, l = n.length;
      if ((o || a) && (k === null || (k.f & Pt) === 0)) {
        var c = (
          /** @type {Derived} */
          t
        ), d = c.parent;
        for (s = 0; s < l; s++)
          i = n[s], (o || !i?.reactions?.includes(c)) && (i.reactions ??= []).push(c);
        o && (c.f ^= ve), a && d !== null && (d.f & B) === 0 && (c.f ^= B);
      }
      for (s = 0; s < l; s++)
        if (i = n[s], Ae(
          /** @type {Derived} */
          i
        ) && Gn(
          /** @type {Derived} */
          i
        ), i.wv > t.wv)
          return !0;
    }
    (!r || k !== null && !dt) && F(t, L);
  }
  return !1;
}
function hr(t, e, n = !0) {
  var r = t.reactions;
  if (r !== null && !ot?.includes(t))
    for (var s = 0; s < r.length; s++) {
      var i = r[s];
      (i.f & D) !== 0 ? hr(
        /** @type {Derived} */
        i,
        e,
        !1
      ) : e === i && (n ? F(i, W) : (i.f & L) !== 0 && F(i, _t), kt(
        /** @type {Effect} */
        i
      ));
    }
}
function gr(t) {
  var e = I, n = z, r = q, s = $, i = dt, o = ot, a = C, l = K, c = bt, d = t.f;
  I = /** @type {null | Value[]} */
  null, z = 0, q = null, dt = (d & B) !== 0 && (K || !Ct || $ === null), $ = (d & (ct | vt)) === 0 ? t : null, ot = null, _e(t.ctx), K = !1, bt = ++Gt, t.ac !== null && (te(() => {
    t.ac.abort(en);
  }), t.ac = null);
  try {
    t.f |= Le;
    var v = (
      /** @type {Function} */
      t.fn
    ), h = v(), g = t.deps;
    if (I !== null) {
      var u;
      if (me(t, z), g !== null && z > 0)
        for (g.length = z + I.length, u = 0; u < I.length; u++)
          g[z + u] = I[u];
      else
        t.deps = g = I;
      if (!dt || // Deriveds that already have reactions can cleanup, so we still add them as reactions
      (d & D) !== 0 && /** @type {import('#client').Derived} */
      t.reactions !== null)
        for (u = z; u < g.length; u++)
          (g[u].reactions ??= []).push(t);
    } else g !== null && z < g.length && (me(t, z), g.length = z);
    if (Qt() && q !== null && !K && g !== null && (t.f & (D | _t | W)) === 0)
      for (u = 0; u < /** @type {Source[]} */
      q.length; u++)
        hr(
          q[u],
          /** @type {Effect} */
          t
        );
    return s !== null && s !== t && (Gt++, q !== null && (r === null ? r = q : r.push(.../** @type {Source[]} */
    q))), (t.f & pt) !== 0 && (t.f ^= pt), h;
  } catch (f) {
    return vi(f);
  } finally {
    t.f ^= Le, I = e, z = n, q = r, $ = s, dt = i, ot = o, _e(a), K = l, bt = c;
  }
}
function ji(t, e) {
  let n = e.reactions;
  if (n !== null) {
    var r = Wr.call(n, t);
    if (r !== -1) {
      var s = n.length - 1;
      s === 0 ? n = e.reactions = null : (n[r] = n[s], n.pop());
    }
  }
  n === null && (e.f & D) !== 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
  (I === null || !I.includes(e)) && (F(e, _t), (e.f & (B | ve)) === 0 && (e.f ^= ve), Yn(
    /** @type {Derived} **/
    e
  ), me(
    /** @type {Derived} **/
    e,
    0
  ));
}
function me(t, e) {
  var n = t.deps;
  if (n !== null)
    for (var r = e; r < n.length; r++)
      ji(t, n[r]);
}
function Vt(t) {
  var e = t.f;
  if ((e & Pt) === 0) {
    F(t, L);
    var n = k, r = Ct;
    k = t, Ct = !0;
    try {
      (e & Ft) !== 0 ? Ni(t) : ar(t), or(t);
      var s = gr(t);
      t.teardown = typeof s == "function" ? s : null, t.wv = fr;
      var i;
      jn && Cr && (t.f & W) !== 0 && t.deps;
    } finally {
      Ct = r, k = n;
    }
  }
}
function x(t) {
  var e = t.f, n = (e & D) !== 0;
  if ($ !== null && !K) {
    var r = k !== null && (k.f & Pt) !== 0;
    if (!r && !ot?.includes(t)) {
      var s = $.deps;
      if (($.f & Le) !== 0)
        t.rv < Gt && (t.rv = Gt, I === null && s !== null && s[z] === t ? z++ : I === null ? I = [t] : (!dt || !I.includes(t)) && I.push(t));
      else {
        ($.deps ??= []).push(t);
        var i = t.reactions;
        i === null ? t.reactions = [$] : i.includes($) || i.push($);
      }
    }
  } else if (n && /** @type {Derived} */
  t.deps === null && /** @type {Derived} */
  t.effects === null) {
    var o = (
      /** @type {Derived} */
      t
    ), a = o.parent;
    a !== null && (a.f & B) === 0 && (o.f ^= B);
  }
  if (Tt) {
    if (mt.has(t))
      return mt.get(t);
    if (n) {
      o = /** @type {Derived} */
      t;
      var l = o.v;
      return ((o.f & L) === 0 && o.reactions !== null || vr(o)) && (l = sn(o)), mt.set(o, l), l;
    }
  } else if (n) {
    if (o = /** @type {Derived} */
    t, It?.has(o))
      return It.get(o);
    Ae(o) && Gn(o);
  }
  if ((t.f & pt) !== 0)
    throw t.v;
  return t.v;
}
function vr(t) {
  if (t.v === N) return !0;
  if (t.deps === null) return !1;
  for (const e of t.deps)
    if (mt.has(e) || (e.f & D) !== 0 && vr(
      /** @type {Derived} */
      e
    ))
      return !0;
  return !1;
}
function ee(t) {
  var e = K;
  try {
    return K = !0, t();
  } finally {
    K = e;
  }
}
const zi = -7169;
function F(t, e) {
  t.f = t.f & zi | e;
}
function ce(t) {
  if (!(typeof t != "object" || !t || t instanceof EventTarget)) {
    if (ht in t)
      ze(t);
    else if (!Array.isArray(t))
      for (let e in t) {
        const n = t[e];
        typeof n == "object" && n && ht in n && ze(n);
      }
  }
}
function ze(t, e = /* @__PURE__ */ new Set()) {
  if (typeof t == "object" && t !== null && // We don't want to traverse DOM elements
  !(t instanceof EventTarget) && !e.has(t)) {
    e.add(t), t instanceof Date && t.getTime();
    for (let r in t)
      try {
        ze(t[r], e);
      } catch {
      }
    const n = Je(t);
    if (n !== Object.prototype && n !== Array.prototype && n !== Map.prototype && n !== Set.prototype && n !== Date.prototype) {
      const r = zn(n);
      for (let s in r) {
        const i = r[s].get;
        if (i)
          try {
            i.call(t);
          } catch {
          }
      }
    }
  }
}
const Di = /* @__PURE__ */ new Set(), $n = /* @__PURE__ */ new Set();
function _r(t, e, n, r = {}) {
  function s(i) {
    if (r.capture || Bt.call(e, i), !i.cancelBubble)
      return te(() => n?.call(this, i));
  }
  return t.startsWith("pointer") || t.startsWith("touch") || t === "wheel" ? rn(() => {
    e.addEventListener(t, s, r);
  }) : e.addEventListener(t, s, r), s;
}
function Ui(t, e, n, r = {}) {
  var s = _r(e, t, n, r);
  return () => {
    t.removeEventListener(e, s, r);
  };
}
function Jt(t, e, n, r, s) {
  var i = { capture: r, passive: s }, o = _r(t, e, n, i);
  (e === document.body || // @ts-ignore
  e === window || // @ts-ignore
  e === document || // Firefox has quirky behavior, it can happen that we still get "canplay" events when the element is already removed
  e instanceof HTMLMediaElement) && Ti(() => {
    e.removeEventListener(t, o, i);
  });
}
let En = null;
function Bt(t) {
  var e = this, n = (
    /** @type {Node} */
    e.ownerDocument
  ), r = t.type, s = t.composedPath?.() || [], i = (
    /** @type {null | Element} */
    s[0] || t.target
  );
  En = t;
  var o = 0, a = En === t && t.__root;
  if (a) {
    var l = s.indexOf(a);
    if (l !== -1 && (e === document || e === /** @type {any} */
    window)) {
      t.__root = e;
      return;
    }
    var c = s.indexOf(e);
    if (c === -1)
      return;
    l <= c && (o = l);
  }
  if (i = /** @type {Element} */
  s[o] || t.target, i !== e) {
    Lt(t, "currentTarget", {
      configurable: !0,
      get() {
        return i || n;
      }
    });
    var d = $, v = k;
    Z(null), Q(null);
    try {
      for (var h, g = []; i !== null; ) {
        var u = i.assignedSlot || i.parentNode || /** @type {any} */
        i.host || null;
        try {
          var f = i["__" + r];
          if (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
          t.target === i))
            if (Ge(f)) {
              var [w, ...b] = f;
              w.apply(i, [t, ...b]);
            } else
              f.call(i, t);
        } catch (y) {
          h ? g.push(y) : h = y;
        }
        if (t.cancelBubble || u === e || u === null)
          break;
        i = u;
      }
      if (h) {
        for (let y of g)
          queueMicrotask(() => {
            throw y;
          });
        throw h;
      }
    } finally {
      t.__root = e, delete t.currentTarget, Z(d), Q(v);
    }
  }
}
let U;
function qi() {
  U = void 0;
}
function Bi(t) {
  let e = null, n = E;
  var r;
  if (E) {
    for (e = T, U === void 0 && (U = /** @type {TemplateNode} */
    /* @__PURE__ */ $t(document.head)); U !== null && (U.nodeType !== Wt || /** @type {Comment} */
    U.data !== Ye); )
      U = /** @type {TemplateNode} */
      /* @__PURE__ */ X(U);
    U === null ? ft(!1) : U = at(
      /** @type {TemplateNode} */
      /* @__PURE__ */ X(U)
    );
  }
  E || (r = document.head.appendChild(jt()));
  try {
    Te(() => t(r), Un);
  } finally {
    n && (ft(!0), U = T, at(
      /** @type {TemplateNode} */
      e
    ));
  }
}
function Vi(t) {
  var e = document.createElement("template");
  return e.innerHTML = t.replaceAll("<!>", "<!---->"), e.content;
}
function ue(t, e) {
  var n = (
    /** @type {Effect} */
    k
  );
  n.nodes_start === null && (n.nodes_start = t, n.nodes_end = e);
}
// @__NO_SIDE_EFFECTS__
function J(t, e) {
  var n = (e & qr) !== 0, r = (e & Br) !== 0, s, i = !t.startsWith("<!>");
  return () => {
    if (E)
      return ue(T, null), T;
    s === void 0 && (s = Vi(i ? t : "<!>" + t), n || (s = /** @type {Node} */
    /* @__PURE__ */ $t(s)));
    var o = (
      /** @type {TemplateNode} */
      r || Qn ? document.importNode(s, !0) : s.cloneNode(!0)
    );
    if (n) {
      var a = (
        /** @type {TemplateNode} */
        /* @__PURE__ */ $t(o)
      ), l = (
        /** @type {TemplateNode} */
        o.lastChild
      );
      ue(a, l);
    } else
      ue(o, o);
    return o;
  };
}
function V(t, e) {
  if (E) {
    k.nodes_end = T, Zt();
    return;
  }
  t !== null && t.before(
    /** @type {Node} */
    e
  );
}
const Wi = ["touchstart", "touchmove"];
function Hi(t) {
  return Wi.includes(t);
}
let De = !0;
function pr(t, e) {
  return mr(t, e);
}
function Yi(t, e) {
  je(), e.intro = e.intro ?? !1;
  const n = e.target, r = E, s = T;
  try {
    for (var i = (
      /** @type {TemplateNode} */
      /* @__PURE__ */ $t(n)
    ); i && (i.nodeType !== Wt || /** @type {Comment} */
    i.data !== Ye); )
      i = /** @type {TemplateNode} */
      /* @__PURE__ */ X(i);
    if (!i)
      throw Nt;
    ft(!0), at(
      /** @type {Comment} */
      i
    ), Zt();
    const o = mr(t, { ...e, anchor: i });
    if (T === null || T.nodeType !== Wt || /** @type {Comment} */
    T.data !== Fn)
      throw ye(), Nt;
    return ft(!1), /**  @type {Exports} */
    o;
  } catch (o) {
    if (o instanceof Error && o.message.split(`
`).some((a) => a.startsWith("https://svelte.dev/e/")))
      throw o;
    return o !== Nt && console.warn("Failed to hydrate: ", o), e.recover === !1 && si(), je(), Si(n), ft(!1), pr(t, e);
  } finally {
    ft(r), at(s), qi();
  }
}
const xt = /* @__PURE__ */ new Map();
function mr(t, { target: e, anchor: n, props: r = {}, events: s, context: i, intro: o = !0 }) {
  je();
  var a = /* @__PURE__ */ new Set(), l = (v) => {
    for (var h = 0; h < v.length; h++) {
      var g = v[h];
      if (!a.has(g)) {
        a.add(g);
        var u = Hi(g);
        e.addEventListener(g, Bt, { passive: u });
        var f = xt.get(g);
        f === void 0 ? (document.addEventListener(g, Bt, { passive: u }), xt.set(g, 1)) : xt.set(g, f + 1);
      }
    }
  };
  l(Hr(Di)), $n.add(l);
  var c = void 0, d = Ri(() => {
    var v = n ?? e.appendChild(jt());
    return Yt(() => {
      if (i) {
        et({});
        var h = (
          /** @type {ComponentContext} */
          C
        );
        h.c = i;
      }
      s && (r.$$events = s), E && ue(
        /** @type {TemplateNode} */
        v,
        null
      ), De = o, c = t(v, r) || {}, De = !0, E && (k.nodes_end = T), i && nt();
    }), () => {
      for (var h of a) {
        e.removeEventListener(h, Bt);
        var g = (
          /** @type {number} */
          xt.get(h)
        );
        --g === 0 ? (document.removeEventListener(h, Bt), xt.delete(h)) : xt.set(h, g);
      }
      $n.delete(l), v !== n && v.parentNode?.removeChild(v);
    };
  });
  return Ue.set(c, d), c;
}
let Ue = /* @__PURE__ */ new WeakMap();
function Gi(t, e) {
  const n = Ue.get(t);
  return n ? (Ue.delete(t), n(e)) : Promise.resolve();
}
function Ji(t, e, n = !1) {
  E && Zt();
  var r = t, s = null, i = null, o = N, a = n ? Xt : 0, l = !1;
  const c = (g, u = !0) => {
    l = !0, h(u, g);
  };
  var d = null;
  function v() {
    d !== null && (d.lastChild.remove(), r.before(d), d = null);
    var g = o ? s : i, u = o ? i : s;
    g && Ii(g), u && on(u, () => {
      o ? i = null : s = null;
    });
  }
  const h = (g, u) => {
    if (o === (o = g)) return;
    let f = !1;
    if (E) {
      const S = di(r) === Mn;
      !!o === S && (r = fi(), at(r), ft(!1), f = !0);
    }
    var w = nr(), b = r;
    if (w && (d = document.createDocumentFragment(), d.append(b = jt())), o ? s ??= u && Yt(() => u(b)) : i ??= u && Yt(() => u(b)), w) {
      var y = (
        /** @type {Batch} */
        A
      ), _ = o ? s : i, P = o ? i : s;
      _ && y.skipped_effects.delete(_), P && y.skipped_effects.add(P), y.add_callback(v);
    } else
      v();
    f && ft(!0);
  };
  Te(() => {
    l = !1, e(c), l || h(null, null);
  }, a), E && (r = T);
}
function Ki(t, e, n, r, s) {
  E && Zt();
  var i = e.$$slots?.[n], o = !1;
  i === !0 && (i = e.children, o = !0), i === void 0 ? s !== null && s(t) : i(t, o ? () => r : r);
}
function Xi(t, e, n) {
  E && Zt();
  var r = t, s, i, o = null, a = null;
  function l() {
    i && (on(i), i = null), o && (o.lastChild.remove(), r.before(o), o = null), i = a, a = null;
  }
  Te(() => {
    if (s !== (s = e())) {
      var c = nr();
      if (s) {
        var d = r;
        c && (o = document.createDocumentFragment(), o.append(d = jt()), i && A.skipped_effects.add(i)), a = Yt(() => n(d, s));
      }
      c ? A.add_callback(l) : l();
    }
  }, Xt), E && (r = T);
}
function an(t, e) {
  Pe(() => {
    var n = t.getRootNode(), r = (
      /** @type {ShadowRoot} */
      n.host ? (
        /** @type {ShadowRoot} */
        n
      ) : (
        /** @type {Document} */
        n.head ?? /** @type {Document} */
        n.ownerDocument.head
      )
    );
    if (!r.querySelector("#" + e.hash)) {
      const s = document.createElement("style");
      s.id = e.hash, s.textContent = e.code, r.appendChild(s);
    }
  });
}
function Zi(t, e) {
  var n = void 0, r;
  Te(() => {
    n !== (n = e()) && (r && (lt(r), r = null), n && (r = Yt(() => {
      Pe(() => (
        /** @type {(node: Element) => void} */
        n(t)
      ));
    })));
  });
}
function Qi(t, e, n) {
  var r = t == null ? "" : "" + t;
  return r = r ? r + " " + e : e, r === "" ? null : r;
}
function Sn(t, e = !1) {
  var n = e ? " !important;" : ";", r = "";
  for (var s in t) {
    var i = t[s];
    i != null && i !== "" && (r += " " + s + ": " + i + n);
  }
  return r;
}
function Ne(t) {
  return t[0] !== "-" || t[1] !== "-" ? t.toLowerCase() : t;
}
function ts(t, e) {
  if (e) {
    var n = "", r, s;
    if (Array.isArray(e) ? (r = e[0], s = e[1]) : r = e, t) {
      t = String(t).replaceAll(/\s*\/\*.*?\*\/\s*/g, "").trim();
      var i = !1, o = 0, a = !1, l = [];
      r && l.push(...Object.keys(r).map(Ne)), s && l.push(...Object.keys(s).map(Ne));
      var c = 0, d = -1;
      const f = t.length;
      for (var v = 0; v < f; v++) {
        var h = t[v];
        if (a ? h === "/" && t[v - 1] === "*" && (a = !1) : i ? i === h && (i = !1) : h === "/" && t[v + 1] === "*" ? a = !0 : h === '"' || h === "'" ? i = h : h === "(" ? o++ : h === ")" && o--, !a && i === !1 && o === 0) {
          if (h === ":" && d === -1)
            d = v;
          else if (h === ";" || v === f - 1) {
            if (d !== -1) {
              var g = Ne(t.substring(c, d).trim());
              if (!l.includes(g)) {
                h !== ";" && v++;
                var u = t.substring(c, v).trim();
                n += " " + u + ";";
              }
            }
            c = v + 1, d = -1;
          }
        }
      }
    }
    return r && (n += Sn(r)), s && (n += Sn(s, !0)), n = n.trim(), n === "" ? null : n;
  }
  return t == null ? null : String(t);
}
function es(t, e, n, r, s, i) {
  var o = t.__className;
  if (E || o !== n || o === void 0) {
    var a = Qi(n, r);
    (!E || a !== t.getAttribute("class")) && (a == null ? t.removeAttribute("class") : t.className = a), t.__className = n;
  }
  return i;
}
function Ce(t, e = {}, n, r) {
  for (var s in n) {
    var i = n[s];
    e[s] !== i && (n[s] == null ? t.style.removeProperty(s) : t.style.setProperty(s, i, r));
  }
}
function br(t, e, n, r) {
  var s = t.__style;
  if (E || s !== e) {
    var i = ts(e, r);
    (!E || i !== t.getAttribute("style")) && (i == null ? t.removeAttribute("style") : t.style.cssText = i), t.__style = e;
  } else r && (Array.isArray(r) ? (Ce(t, n?.[0], r[0]), Ce(t, n?.[1], r[1], "important")) : Ce(t, n, r));
  return r;
}
const ns = Symbol("is custom element"), rs = Symbol("is html");
function j(t, e, n, r) {
  var s = is(t);
  E && (s[e] = t.getAttribute(e), e === "src" || e === "srcset" || e === "href" && t.nodeName === "LINK") || s[e] !== (s[e] = n) && (e === "loading" && (t[Xr] = n), n == null ? t.removeAttribute(e) : typeof n != "string" && ss(t).includes(e) ? t[e] = n : t.setAttribute(e, n));
}
function is(t) {
  return (
    /** @type {Record<string | symbol, unknown>} **/
    // @ts-expect-error
    t.__attributes ??= {
      [ns]: t.nodeName.includes("-"),
      [rs]: t.namespaceURI === Vr
    }
  );
}
var Pn = /* @__PURE__ */ new Map();
function ss(t) {
  var e = Pn.get(t.nodeName);
  if (e) return e;
  Pn.set(t.nodeName, e = []);
  for (var n, r = t, s = Element.prototype; s !== r; ) {
    n = zn(r);
    for (var i in n)
      n[i].set && e.push(i);
    r = Je(r);
  }
  return e;
}
const os = () => performance.now(), it = {
  // don't access requestAnimationFrame eagerly outside method
  // this allows basic testing of user code without JSDOM
  // bunder will eval and remove ternary when the user's app is built
  tick: (
    /** @param {any} _ */
    (t) => requestAnimationFrame(t)
  ),
  now: () => os(),
  tasks: /* @__PURE__ */ new Set()
};
function wr() {
  const t = it.now();
  it.tasks.forEach((e) => {
    e.c(t) || (it.tasks.delete(e), e.f());
  }), it.tasks.size !== 0 && it.tick(wr);
}
function as(t) {
  let e;
  return it.tasks.size === 0 && it.tick(wr), {
    promise: new Promise((n) => {
      it.tasks.add(e = { c: t, f: n });
    }),
    abort() {
      it.tasks.delete(e);
    }
  };
}
function ie(t, e) {
  te(() => {
    t.dispatchEvent(new CustomEvent(e));
  });
}
function ls(t) {
  if (t === "float") return "cssFloat";
  if (t === "offset") return "cssOffset";
  if (t.startsWith("--")) return t;
  const e = t.split("-");
  return e.length === 1 ? e[0] : e[0] + e.slice(1).map(
    /** @param {any} word */
    (n) => n[0].toUpperCase() + n.slice(1)
  ).join("");
}
function Tn(t) {
  const e = {}, n = t.split(";");
  for (const r of n) {
    const [s, i] = r.split(":");
    if (!s || i === void 0) break;
    const o = ls(s.trim());
    e[o] = i.trim();
  }
  return e;
}
const cs = (t) => t;
function qe(t, e, n, r) {
  var s = (t & zr) !== 0, i = (t & Dr) !== 0, o = s && i, a = (t & Ur) !== 0, l = o ? "both" : s ? "in" : "out", c, d = e.inert, v = e.style.overflow, h, g;
  function u() {
    return te(() => c ??= n()(e, r?.() ?? /** @type {P} */
    {}, {
      direction: l
    }));
  }
  var f = {
    is_global: a,
    in() {
      if (e.inert = d, !s) {
        g?.abort(), g?.reset?.();
        return;
      }
      i || h?.abort(), ie(e, "introstart"), h = Be(e, u(), g, 1, () => {
        ie(e, "introend"), h?.abort(), h = c = void 0, e.style.overflow = v;
      });
    },
    out(_) {
      if (!i) {
        _?.(), c = void 0;
        return;
      }
      e.inert = !0, ie(e, "outrostart"), g = Be(e, u(), h, 0, () => {
        ie(e, "outroend"), _?.();
      });
    },
    stop: () => {
      h?.abort(), g?.abort();
    }
  }, w = (
    /** @type {Effect} */
    k
  );
  if ((w.transitions ??= []).push(f), s && De) {
    var b = a;
    if (!b) {
      for (var y = (
        /** @type {Effect | null} */
        w.parent
      ); y && (y.f & Xt) !== 0; )
        for (; (y = y.parent) && (y.f & Ft) === 0; )
          ;
      b = !y || (y.f & we) !== 0;
    }
    b && Pe(() => {
      ee(() => f.in());
    });
  }
}
function Be(t, e, n, r, s) {
  var i = r === 1;
  if (Rt(e)) {
    var o, a = !1;
    return rn(() => {
      if (!a) {
        var w = e({ direction: i ? "in" : "out" });
        o = Be(t, w, n, r, s);
      }
    }), {
      abort: () => {
        a = !0, o?.abort();
      },
      deactivate: () => o.deactivate(),
      reset: () => o.reset(),
      t: () => o.t()
    };
  }
  if (n?.deactivate(), !e?.duration)
    return s(), {
      abort: Ut,
      deactivate: Ut,
      reset: Ut,
      t: () => r
    };
  const { delay: l = 0, css: c, tick: d, easing: v = cs } = e;
  var h = [];
  if (i && n === void 0 && (d && d(0, 1), c)) {
    var g = Tn(c(0, 1));
    h.push(g, g);
  }
  var u = () => 1 - r, f = t.animate(h, { duration: l, fill: "forwards" });
  return f.onfinish = () => {
    f.cancel();
    var w = n?.t() ?? 1 - r;
    n?.abort();
    var b = r - w, y = (
      /** @type {number} */
      e.duration * Math.abs(b)
    ), _ = [];
    if (y > 0) {
      var P = !1;
      if (c)
        for (var S = Math.ceil(y / 16.666666666666668), R = 0; R <= S; R += 1) {
          var H = w + b * v(R / S), At = Tn(c(H, 1 - H));
          _.push(At), P ||= At.overflow === "hidden";
        }
      P && (t.style.overflow = "hidden"), u = () => {
        var O = (
          /** @type {number} */
          /** @type {globalThis.Animation} */
          f.currentTime
        );
        return w + b * v(O / y);
      }, d && as(() => {
        if (f.playState !== "running") return !1;
        var O = u();
        return d(O, 1 - O), !0;
      });
    }
    f = t.animate(_, { duration: y, fill: "forwards" }), f.onfinish = () => {
      u = () => r, d?.(r, 1 - r), s();
    };
  }, {
    abort: () => {
      f && (f.cancel(), f.effect = null, f.onfinish = Ut);
    },
    deactivate: () => {
      s = Ut;
    },
    reset: () => {
      r === 0 && d?.(1, 0);
    },
    t: () => u()
  };
}
function An(t, e) {
  return t === e || t?.[ht] === e;
}
function ln(t = {}, e, n, r) {
  return Pe(() => {
    var s, i;
    return sr(() => {
      s = i, i = [], ee(() => {
        t !== n(...i) && (e(t, ...i), s && An(n(...s), t) && e(null, ...s));
      });
    }), () => {
      rn(() => {
        i && An(n(...i), t) && e(null, ...i);
      });
    };
  }), t;
}
function zt(t = !1) {
  const e = (
    /** @type {ComponentContextLegacy} */
    C
  ), n = e.l.u;
  if (!n) return;
  let r = () => ce(e.s);
  if (t) {
    let s = 0, i = (
      /** @type {Record<string, any>} */
      {}
    );
    const o = /* @__PURE__ */ ke(() => {
      let a = !1;
      const l = e.s;
      for (const c in l)
        l[c] !== i[c] && (i[c] = l[c], a = !0);
      return a && s++, s;
    });
    r = () => x(o);
  }
  n.b.length && Ai(() => {
    xn(e, r), ge(n.b);
  }), bn(() => {
    const s = ee(() => n.m.map(Jr));
    return () => {
      for (const i of s)
        typeof i == "function" && i();
    };
  }), n.a.length && bn(() => {
    xn(e, r), ge(n.a);
  });
}
function xn(t, e) {
  if (t.l.s)
    for (const n of t.l.s) x(n);
  e();
}
function Rn(t, e) {
  var n = (
    /** @type {Record<string, Function[] | Function>} */
    t.$$events?.[e.type]
  ), r = Ge(n) ? n.slice() : n == null ? [] : [n];
  for (var s of r)
    s.call(this, e);
}
let se = !1;
function us(t) {
  var e = se;
  try {
    return se = !1, [t(), se];
  } finally {
    se = e;
  }
}
const fs = {
  get(t, e) {
    if (!t.exclude.includes(e))
      return x(t.version), e in t.special ? t.special[e]() : t.props[e];
  },
  set(t, e, n) {
    if (!(e in t.special)) {
      var r = k;
      try {
        Q(t.parent_effect), t.special[e] = m(
          {
            get [e]() {
              return t.props[e];
            }
          },
          /** @type {string} */
          e,
          In
        );
      } finally {
        Q(r);
      }
    }
    return t.special[e](n), _n(t.version), !0;
  },
  getOwnPropertyDescriptor(t, e) {
    if (!t.exclude.includes(e) && e in t.props)
      return {
        enumerable: !0,
        configurable: !0,
        value: t.props[e]
      };
  },
  deleteProperty(t, e) {
    return t.exclude.includes(e) || (t.exclude.push(e), _n(t.version)), !0;
  },
  has(t, e) {
    return t.exclude.includes(e) ? !1 : e in t.props;
  },
  ownKeys(t) {
    return Reflect.ownKeys(t.props).filter((e) => !t.exclude.includes(e));
  }
};
function ds(t, e) {
  return new Proxy(
    {
      props: t,
      exclude: e,
      special: {},
      version: Ee(0),
      // TODO this is only necessary because we need to track component
      // destruction inside `prop`, because of `bind:this`, but it
      // seems likely that we can simplify `bind:this` instead
      parent_effect: (
        /** @type {Effect} */
        k
      )
    },
    fs
  );
}
const hs = {
  get(t, e) {
    let n = t.props.length;
    for (; n--; ) {
      let r = t.props[n];
      if (Rt(r) && (r = r()), typeof r == "object" && r !== null && e in r) return r[e];
    }
  },
  set(t, e, n) {
    let r = t.props.length;
    for (; r--; ) {
      let s = t.props[r];
      Rt(s) && (s = s());
      const i = st(s, e);
      if (i && i.set)
        return i.set(n), !0;
    }
    return !1;
  },
  getOwnPropertyDescriptor(t, e) {
    let n = t.props.length;
    for (; n--; ) {
      let r = t.props[n];
      if (Rt(r) && (r = r()), typeof r == "object" && r !== null && e in r) {
        const s = st(r, e);
        return s && !s.configurable && (s.configurable = !0), s;
      }
    }
  },
  has(t, e) {
    if (e === ht || e === tn) return !1;
    for (let n of t.props)
      if (Rt(n) && (n = n()), n != null && e in n) return !0;
    return !1;
  },
  ownKeys(t) {
    const e = [];
    for (let n of t.props)
      if (Rt(n) && (n = n()), !!n) {
        for (const r in n)
          e.includes(r) || e.push(r);
        for (const r of Object.getOwnPropertySymbols(n))
          e.includes(r) || e.push(r);
      }
    return e;
  }
};
function gs(...t) {
  return new Proxy({ props: t }, hs);
}
function m(t, e, n, r) {
  var s = !Kt || (n & Mr) !== 0, i = (n & Fr) !== 0, o = (n & jr) !== 0, a = (
    /** @type {V} */
    r
  ), l = !0, c = () => (l && (l = !1, a = o ? ee(
    /** @type {() => V} */
    r
  ) : (
    /** @type {V} */
    r
  )), a), d;
  if (i) {
    var v = ht in t || tn in t;
    d = st(t, e)?.set ?? (v && e in t ? (_) => t[e] = _ : void 0);
  }
  var h, g = !1;
  i ? [h, g] = us(() => (
    /** @type {V} */
    t[e]
  )) : h = /** @type {V} */
  t[e], h === void 0 && r !== void 0 && (h = c(), d && (s && oi(), d(h)));
  var u;
  if (s ? u = () => {
    var _ = (
      /** @type {V} */
      t[e]
    );
    return _ === void 0 ? c() : (l = !0, _);
  } : u = () => {
    var _ = (
      /** @type {V} */
      t[e]
    );
    return _ !== void 0 && (a = /** @type {V} */
    void 0), _ === void 0 ? a : _;
  }, s && (n & In) === 0)
    return u;
  if (d) {
    var f = t.$$legacy;
    return (
      /** @type {() => V} */
      (function(_, P) {
        return arguments.length > 0 ? ((!s || !P || f || g) && d(P ? u() : _), _) : u();
      })
    );
  }
  var w = !1, b = ((n & Ir) !== 0 ? ke : Hn)(() => (w = !1, u()));
  i && x(b);
  var y = (
    /** @type {Effect} */
    k
  );
  return (
    /** @type {() => V} */
    (function(_, P) {
      if (arguments.length > 0) {
        const S = P ? x(b) : s && i ? Ot(_) : _;
        return M(b, S), w = !0, a !== void 0 && (a = S), _;
      }
      return Tt && w || (y.f & Pt) !== 0 ? b.v : x(b);
    })
  );
}
function vs(t) {
  return new _s(t);
}
class _s {
  /** @type {any} */
  #e;
  /** @type {Record<string, any>} */
  #t;
  /**
   * @param {ComponentConstructorOptions & {
   *  component: any;
   * }} options
   */
  constructor(e) {
    var n = /* @__PURE__ */ new Map(), r = (i, o) => {
      var a = /* @__PURE__ */ Se(o, !1, !1);
      return n.set(i, a), a;
    };
    const s = new Proxy(
      { ...e.props || {}, $$events: {} },
      {
        get(i, o) {
          return x(n.get(o) ?? r(o, Reflect.get(i, o)));
        },
        has(i, o) {
          return o === tn ? !0 : (x(n.get(o) ?? r(o, Reflect.get(i, o))), Reflect.has(i, o));
        },
        set(i, o, a) {
          return M(n.get(o) ?? r(o, a), a), Reflect.set(i, o, a);
        }
      }
    );
    this.#t = (e.hydrate ? Yi : pr)(e.component, {
      target: e.target,
      anchor: e.anchor,
      props: s,
      context: e.context,
      intro: e.intro ?? !1,
      recover: e.recover
    }), (!e?.props?.$$host || e.sync === !1) && p(), this.#e = s.$$events;
    for (const i of Object.keys(this.#t))
      i === "$set" || i === "$destroy" || i === "$on" || Lt(this, i, {
        get() {
          return this.#t[i];
        },
        /** @param {any} value */
        set(o) {
          this.#t[i] = o;
        },
        enumerable: !0
      });
    this.#t.$set = /** @param {Record<string, any>} next */
    (i) => {
      Object.assign(s, i);
    }, this.#t.$destroy = () => {
      Gi(this.#t);
    };
  }
  /** @param {Record<string, any>} props */
  $set(e) {
    this.#t.$set(e);
  }
  /**
   * @param {string} event
   * @param {(...args: any[]) => any} callback
   * @returns {any}
   */
  $on(e, n) {
    this.#e[e] = this.#e[e] || [];
    const r = (...s) => n.call(this, ...s);
    return this.#e[e].push(r), () => {
      this.#e[e] = this.#e[e].filter(
        /** @param {any} fn */
        (s) => s !== r
      );
    };
  }
  $destroy() {
    this.#t.$destroy();
  }
}
let yr;
typeof HTMLElement == "function" && (yr = 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;
  /**
   * @param {*} $$componentCtor
   * @param {*} $$slots
   * @param {*} use_shadow_dom
   */
  constructor(t, e, n) {
    super(), this.$$ctor = t, this.$$s = e, n && this.attachShadow({ mode: "open" });
  }
  /**
   * @param {string} type
   * @param {EventListenerOrEventListenerObject} listener
   * @param {boolean | AddEventListenerOptions} [options]
   */
  addEventListener(t, e, n) {
    if (this.$$l[t] = this.$$l[t] || [], this.$$l[t].push(e), this.$$c) {
      const r = this.$$c.$on(t, e);
      this.$$l_u.set(e, r);
    }
    super.addEventListener(t, e, n);
  }
  /**
   * @param {string} type
   * @param {EventListenerOrEventListenerObject} listener
   * @param {boolean | AddEventListenerOptions} [options]
   */
  removeEventListener(t, e, n) {
    if (super.removeEventListener(t, e, n), this.$$c) {
      const 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 (s) => {
          const i = document.createElement("slot");
          r !== "default" && (i.name = r), V(s, i);
        };
      };
      if (await Promise.resolve(), !this.$$cn || this.$$c)
        return;
      const e = {}, n = ps(this);
      for (const 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 (const r of this.attributes) {
        const s = this.$$g_p(r.name);
        s in this.$$d || (this.$$d[s] = fe(s, r.value, this.$$p_d, "toProp"));
      }
      for (const r in this.$$p_d)
        !(r in this.$$d) && this[r] !== void 0 && (this.$$d[r] = this[r], delete this[r]);
      this.$$c = vs({
        component: this.$$ctor,
        target: this.shadowRoot || this,
        props: {
          ...this.$$d,
          $$slots: e,
          $$host: this
        }
      }), this.$$me = xi(() => {
        sr(() => {
          this.$$r = !0;
          for (const r of he(this.$$c)) {
            if (!this.$$p_d[r]?.reflect) continue;
            this.$$d[r] = this.$$c[r];
            const s = fe(
              r,
              this.$$d[r],
              this.$$p_d,
              "toAttribute"
            );
            s == null ? this.removeAttribute(this.$$p_d[r].attribute || r) : this.setAttribute(this.$$p_d[r].attribute || r, s);
          }
          this.$$r = !1;
        });
      });
      for (const r in this.$$l)
        for (const s of this.$$l[r]) {
          const i = this.$$c.$on(r, s);
          this.$$l_u.set(s, i);
        }
      this.$$l = {};
    }
  }
  // We don't need this when working within Svelte code, but for compatibility of people using this outside of Svelte
  // and setting attributes through setAttribute etc, this is helpful
  /**
   * @param {string} attr
   * @param {string} _oldValue
   * @param {string} newValue
   */
  attributeChangedCallback(t, e, n) {
    this.$$r || (t = this.$$g_p(t), this.$$d[t] = fe(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);
    });
  }
  /**
   * @param {string} attribute_name
   */
  $$g_p(t) {
    return he(this.$$p_d).find(
      (e) => this.$$p_d[e].attribute === t || !this.$$p_d[e].attribute && e.toLowerCase() === t
    ) || t;
  }
});
function fe(t, e, n, r) {
  const s = n[t]?.type;
  if (e = s === "Boolean" && typeof e != "boolean" ? e != null : e, !r || !n[t])
    return e;
  if (r === "toAttribute")
    switch (s) {
      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 (s) {
      case "Object":
      case "Array":
        return e && JSON.parse(e);
      case "Boolean":
        return e;
      // conversion already handled above
      case "Number":
        return e != null ? +e : e;
      default:
        return e;
    }
}
function ps(t) {
  const e = {};
  return t.childNodes.forEach((n) => {
    e[
      /** @type {Element} node */
      n.slot || "default"
    ] = !0;
  }), e;
}
function ut(t, e, n, r, s, i) {
  let o = class extends yr {
    constructor() {
      super(t, n, s), this.$$p_d = e;
    }
    static get observedAttributes() {
      return he(e).map(
        (a) => (e[a].attribute || a).toLowerCase()
      );
    }
  };
  return he(e).forEach((a) => {
    Lt(o.prototype, a, {
      get() {
        return this.$$c && a in this.$$c ? this.$$c[a] : this.$$d[a];
      },
      set(l) {
        l = fe(a, l, e), this.$$d[a] = l;
        var c = this.$$c;
        if (c) {
          var d = st(c, a)?.get;
          d ? c[a] = l : c.$set({ [a]: l });
        }
      }
    });
  }), r.forEach((a) => {
    Lt(o.prototype, a, {
      get() {
        return this.$$c?.[a];
      }
    });
  }), i && (o = i(o)), t.element = /** @type {any} */
  o, o;
}
var de = { exports: {} }, ms = de.exports, On;
function bs() {
  return On || (On = 1, (function(t) {
    (function(e) {
      if (typeof n != "function") {
        var n = function(u) {
          return u;
        };
        n.nonNative = !0;
      }
      const r = n("plaintext"), s = n("html"), i = n("comment"), o = /<(\w*)>/g, a = /<\/?([^\s\/>]+)/;
      function l(u, f, w) {
        u = u || "", f = f || [], w = w || "";
        let b = d(f, w);
        return v(u, b);
      }
      function c(u, f) {
        u = u || [], f = f || "";
        let w = d(u, f);
        return function(y) {
          return v(y || "", w);
        };
      }
      l.init_streaming_mode = c;
      function d(u, f) {
        return u = h(u), {
          allowable_tags: u,
          tag_replacement: f,
          state: r,
          tag_buffer: "",
          depth: 0,
          in_quote_char: ""
        };
      }
      function v(u, f) {
        if (typeof u != "string")
          throw new TypeError("'html' parameter must be a string");
        let w = f.allowable_tags, b = f.tag_replacement, y = f.state, _ = f.tag_buffer, P = f.depth, S = f.in_quote_char, R = "";
        for (let H = 0, At = u.length; H < At; H++) {
          let O = u[H];
          if (y === r)
            switch (O) {
              case "<":
                y = s, _ += O;
                break;
              default:
                R += O;
                break;
            }
          else if (y === s)
            switch (O) {
              case "<":
                if (S)
                  break;
                P++;
                break;
              case ">":
                if (S)
                  break;
                if (P) {
                  P--;
                  break;
                }
                S = "", y = r, _ += ">", w.has(g(_)) ? R += _ : R += b, _ = "";
                break;
              case '"':
              case "'":
                O === S ? S = "" : S = S || O, _ += O;
                break;
              case "-":
                _ === "<!-" && (y = i), _ += O;
                break;
              case " ":
              case `
`:
                if (_ === "<") {
                  y = r, R += "< ", _ = "";
                  break;
                }
                _ += O;
                break;
              default:
                _ += O;
                break;
            }
          else if (y === i)
            switch (O) {
              case ">":
                _.slice(-2) == "--" && (y = r), _ = "";
                break;
              default:
                _ += O;
                break;
            }
        }
        return f.state = y, f.tag_buffer = _, f.depth = P, f.in_quote_char = S, R;
      }
      function h(u) {
        let f = /* @__PURE__ */ new Set();
        if (typeof u == "string") {
          let w;
          for (; w = o.exec(u); )
            f.add(w[1]);
        } else !n.nonNative && typeof u[n.iterator] == "function" ? f = new Set(u) : typeof u.forEach == "function" && u.forEach(f.add, f);
        return f;
      }
      function g(u) {
        let f = a.exec(u);
        return f ? f[1].toLowerCase() : null;
      }
      t.exports ? t.exports = l : e.striptags = l;
    })(ms);
  })(de)), de.exports;
}
bs();
class ws {
  constructor(e, n, r) {
    this.isLocal = e, this.branch = n, this.tld = r;
  }
  _format(e, n = {}) {
    const {
      supportsBranchEnvironments: r = !0,
      localPort: s
    } = n;
    if (this.isLocal && Number.isFinite(s))
      return new URL(`http://${this.tld}:${s}`);
    const i = e ? `${e}-` : "", o = this.branch && r ? `${i}${this.branch}` : e;
    return o ? new URL(`https://${o}.${this.tld}`) : new URL(`https://${this.tld}`);
  }
}
class ys extends ws {
  get homepage() {
    return this._format(void 0, { localPort: 1155 });
  }
  get dashboard() {
    return this._format("dashboard", { localPort: 1158 });
  }
  get checkin() {
    return this._format("checkin", { localPort: 1166 });
  }
  get checkout() {
    return this._format("checkout", { localPort: 1157 });
  }
  get auth() {
    return this._format("auth", { localPort: 3132 });
  }
  get api() {
    return this._format("api", { localPort: 3e3 });
  }
  get selfserve() {
    return this._format("my", { localPort: 1159 });
  }
  get conversations() {
    return this._format("conversations");
  }
  get integrations() {
    return this._format("integrations", { localPort: 1160 });
  }
  get shop() {
    return this._format("shop", { localPort: 1161 });
  }
  get video() {
    return this._format("video", { supportsBranchEnvironments: !1 });
  }
  get cdn() {
    return this._format("bcdn", { supportsBranchEnvironments: !1 });
  }
}
const Dt = new ys(
  !1,
  "",
  "beyonk.com"
);
class ks {
  constructor(e) {
    this.w = e, this.version = 1;
  }
  dispatch(e, n) {
    const r = JSON.stringify({
      version: this.version,
      eventName: e,
      meta: n
    });
    this.w.parent.postMessage(r, "*");
  }
}
class ne {
  constructor(e, n = {}) {
    this.w = e, this.originFilter = n.originFilter || /.*/, this.callbacks = {}, this.debug = this._hasRuntimeDebuggingEnabled || n.debug || !1, this.debug && console.debug("Debugging is enabled"), this.listening = !1, this.version = 1;
  }
  get _hasRuntimeDebuggingEnabled() {
    try {
      return !!localStorage.getItem("_byk_embedded_debug");
    } catch {
      return !1;
    }
  }
  handle(e) {
    if (!e.origin.match(this.originFilter)) {
      this.debug && console.debug("Ignoring event from untrusted origin", e.origin);
      return;
    }
    try {
      const { version: n, eventName: r, meta: s } = JSON.parse(e.data);
      if (n && n !== this.version) {
        this.debug && console.debug(`Received v${n} event in v${this.version} observer. Ignoring.`);
        return;
      }
      const i = this.callbacks[r];
      if (!i) {
        this.debug && console.debug(`No registered handlers for ${r}`);
        return;
      }
      return i(r === $s ? s.height : s);
    } catch {
      this.debug && console.debug("Recieved unparseable event", e.data);
    }
  }
  listen(e, n) {
    this.debug && console.debug("Registered listener for", e), this.callbacks[e] = n, this.listening || (this.binding = this.handle.bind(this), this.w.addEventListener("message", this.binding, !1), this.listening = !0, this.debug && console.debug("Now listening for events"));
  }
  ignore(e) {
    this.callbacks[e] && delete this.callbacks[e], this.callbacks.length || (this.w.removeEventListener("message", this.binding, !1), this.listening = !1, this.debug && console.debug("No more listeners, stopped listening for events"));
  }
}
const $s = "whitelabel:header:resize", tt = {
  ResizePortal: "beyonk:resize-portal",
  RedirectParent: "beyonk:redirect-parent",
  RegisterCart: "beyonk:register-cart",
  Analytics: "beyonk:analytics",
  ScrollIntoView: "beyonk:scroll-into-view"
};
var Es = /* @__PURE__ */ J('<button type="button">View Cart</button>');
function Ss(t, e) {
  et(e, !1);
  const n = new ks(window), r = sessionStorage?.getItem("cart");
  function s() {
    const o = new URL(`/cart/${r}`, Dt.checkout).toString();
    n.dispatch(tt.RedirectParent, { url: o });
  }
  zt();
  var i = Es();
  Jt("click", i, s), V(t, i), nt();
}
customElements.define("view-cart-button", ut(Ss, {}, [], [], !0));
const Ps = [
  "utm_id",
  "utm_source",
  "utm_medium",
  "utm_campaign",
  "utm_term",
  "utm_content"
];
function kr(t) {
  return t.replace(/[^\x00-\x7F]/g, "");
}
function $r(t) {
  const { searchParams: e } = t instanceof URL ? t : new URL(t), n = new URLSearchParams();
  for (const r of Ps)
    e.has(r) && n.set(r, kr(e.get(r)));
  return n.toJSON = () => Object.fromEntries(n.entries()), n;
}
function Ts(t) {
  const e = Object.fromEntries(
    Object.entries(t).map(([n, r]) => [n, kr(r)])
  );
  try {
    sessionStorage.setItem("_byk_utm_data", JSON.stringify(e));
  } catch {
  }
}
function As() {
  try {
    const t = sessionStorage.getItem("_byk_utm_data") || "{}";
    return JSON.parse(t);
  } catch {
    return {};
  }
}
function xs(t) {
  const e = $r(t).toJSON();
  return { ...As(), ...e };
}
function re(t, e = window.location.href) {
  const n = xs(e);
  Object.entries(n).forEach(([r, s]) => {
    s && t.searchParams.set(r, s);
  });
}
var Rs = /* @__PURE__ */ J('<iframe title="Beyonk Booking Form" frameborder="0" scrolling="no" allow="payment *" class="svelte-1oepb7w"></iframe>');
const Os = {
  hash: "svelte-1oepb7w",
  code: "iframe.svelte-1oepb7w {max-width:639px;min-height:480px;}"
};
function Ns(t, e) {
  et(e, !0), an(t, Os);
  const n = m(e, "organisation", 7), r = m(e, "experience", 7), s = m(e, "colour", 7, "#32b0a2"), i = m(e, "color", 23, s), o = m(e, "source", 7, "form"), a = m(e, "integration", 7, "byk-light"), l = m(e, "width", 7, "100%"), c = m(e, "height", 7, "100%");
  function d() {
    const h = new URL(`${n()}/form/experience/${r()}/tickets`, Dt.checkout);
    return h.searchParams.set("source", o()), h.searchParams.set("theme", (i() || s()).slice(1)), h.searchParams.set("integration", a()), re(h), h.toString();
  }
  var v = Rs();
  return Et(
    (h) => {
      j(v, "src", h), j(v, "width", l()), j(v, "height", c());
    },
    [d]
  ), V(t, v), nt({
    get organisation() {
      return n();
    },
    set organisation(h) {
      n(h), p();
    },
    get experience() {
      return r();
    },
    set experience(h) {
      r(h), p();
    },
    get colour() {
      return s();
    },
    set colour(h = "#32b0a2") {
      s(h), p();
    },
    get color() {
      return i();
    },
    set color(h = s) {
      i(h), p();
    },
    get source() {
      return o();
    },
    set source(h = "form") {
      o(h), p();
    },
    get integration() {
      return a();
    },
    set integration(h = "byk-light") {
      a(h), p();
    },
    get width() {
      return l();
    },
    set width(h = "100%") {
      l(h), p();
    },
    get height() {
      return c();
    },
    set height(h = "100%") {
      c(h), p();
    }
  });
}
customElements.define("booking-form", ut(
  Ns,
  {
    organisation: {},
    experience: {},
    colour: {},
    color: {},
    source: {},
    integration: {},
    width: {},
    height: {}
  },
  [],
  [],
  !0
));
var Cs = /* @__PURE__ */ J('<iframe style="min-height: 480px;" frameborder="0" scrolling="no" allow="payment *" title="Beyonk Gift Voucher Form"></iframe>');
function Ls(t, e) {
  et(e, !1);
  let n = m(e, "organisation", 12), r = m(e, "experience", 12, null), s = m(e, "colour", 12, "#32b0a2"), i = m(e, "color", 12), o = m(e, "source", 12, "form"), a = m(e, "integration", 12, "byk-light"), l = m(e, "width", 12, "100%"), c = m(e, "height", 12, "100%");
  function d() {
    const g = new URL(`/${n()}/form/gift-voucher`, Dt.checkout);
    return g.searchParams.set("source", o()), g.searchParams.set("theme", (i() || s()).slice(1)), r() && g.searchParams.set("experience", r()), g.searchParams.set("integration", a()), re(g), g.toString();
  }
  const v = d();
  zt();
  var h = Cs();
  return Et(() => {
    j(h, "src", v), j(h, "width", l()), j(h, "height", c());
  }), V(t, h), nt({
    get organisation() {
      return n();
    },
    set organisation(g) {
      n(g), p();
    },
    get experience() {
      return r();
    },
    set experience(g) {
      r(g), p();
    },
    get colour() {
      return s();
    },
    set colour(g) {
      s(g), p();
    },
    get color() {
      return i();
    },
    set color(g) {
      i(g), p();
    },
    get source() {
      return o();
    },
    set source(g) {
      o(g), p();
    },
    get integration() {
      return a();
    },
    set integration(g) {
      a(g), p();
    },
    get width() {
      return l();
    },
    set width(g) {
      l(g), p();
    },
    get height() {
      return c();
    },
    set height(g) {
      c(g), p();
    }
  });
}
customElements.define("gift-voucher-form", ut(
  Ls,
  {
    organisation: {},
    experience: {},
    colour: {},
    color: {},
    source: {},
    integration: {},
    width: {},
    height: {}
  },
  [],
  [],
  !0
));
function Is(t) {
  return t.getBoundingClientRect().top < 0;
}
function cn(t) {
  t && setTimeout(() => {
    Is(t) && t.scrollIntoView({ behavior: "instant", block: "start" });
  }, 100);
}
var Ms = /* @__PURE__ */ J('<iframe frameborder="0" allow="payment *" title="Beyonk Portal"></iframe>');
function Er(t, e) {
  et(e, !1);
  let n = m(e, "integration", 12, "byk-light"), r = m(e, "organisation", 12), s = m(e, "tags", 12, null), i = m(e, "colour", 12), o = m(e, "color", 28, i), a = m(e, "autoResize", 12, !0), l = m(e, "width", 12, "100%"), c = m(e, "height", 12, "100%"), d = /* @__PURE__ */ Se();
  const v = new ne(window);
  v.listen(tt.ScrollIntoView, () => cn(x(d))), a() && v.listen(tt.ResizePortal, (f) => {
    c(f.height);
  });
  function h() {
    const f = new URL(`/${r()}`, Dt.shop);
    if (f.searchParams.set("integration", n()), s())
      for (const w of s().split(","))
        f.searchParams.append("tags", w);
    return o() && f.searchParams.set("theme", o().slice(1)), re(f), f.toString();
  }
  const g = h();
  zt();
  var u = Ms();
  return ln(u, (f) => M(d, f), () => x(d)), Et(() => {
    j(u, "src", g), j(u, "width", l()), j(u, "height", c());
  }), V(t, u), nt({
    get integration() {
      return n();
    },
    set integration(f) {
      n(f), p();
    },
    get organisation() {
      return r();
    },
    set organisation(f) {
      r(f), p();
    },
    get tags() {
      return s();
    },
    set tags(f) {
      s(f), p();
    },
    get colour() {
      return i();
    },
    set colour(f) {
      i(f), p();
    },
    get color() {
      return o();
    },
    set color(f) {
      o(f), p();
    },
    get autoResize() {
      return a();
    },
    set autoResize(f) {
      a(f), p();
    },
    get width() {
      return l();
    },
    set width(f) {
      l(f), p();
    },
    get height() {
      return c();
    },
    set height(f) {
      c(f), p();
    }
  });
}
customElements.define("organisation-portal", ut(
  Er,
  {
    autoResize: { attribute: "auto-resize", type: "Boolean" },
    integration: {},
    organisation: {},
    tags: {},
    colour: {},
    color: {},
    width: {},
    height: {}
  },
  [],
  [],
  !0
));
var Fs = /* @__PURE__ */ J('<iframe frameborder="0" allow="payment *" title="Beyonk Experience Overview"></iframe>');
function Sr(t, e) {
  et(e, !1);
  let n = m(e, "integration", 12, "byk-light"), r = m(e, "experience", 12), s = m(e, "colour", 12), i = m(e, "color", 28, s), o = m(e, "autoResize", 12, !0), a = m(e, "width", 12, "100%"), l = m(e, "height", 12, "100%"), c = /* @__PURE__ */ Se();
  const d = new ne(window);
  d.listen(tt.ScrollIntoView, () => cn(x(c))), o() && d.listen(tt.ResizePortal, (u) => {
    l(u.height);
  });
  function v() {
    const u = new URL(`/experiences/${r()}`, Dt.shop);
    return u.searchParams.set("integration", n()), u.searchParams.set("home", `/experiences/${r()}`), i() && u.searchParams.set("theme", i().slice(1)), re(u), u.toString();
  }
  const h = v();
  zt();
  var g = Fs();
  return ln(g, (u) => M(c, u), () => x(c)), Et(() => {
    j(g, "src", h), j(g, "width", a()), j(g, "height", l());
  }), V(t, g), nt({
    get integration() {
      return n();
    },
    set integration(u) {
      n(u), p();
    },
    get experience() {
      return r();
    },
    set experience(u) {
      r(u), p();
    },
    get colour() {
      return s();
    },
    set colour(u) {
      s(u), p();
    },
    get color() {
      return i();
    },
    set color(u) {
      i(u), p();
    },
    get autoResize() {
      return o();
    },
    set autoResize(u) {
      o(u), p();
    },
    get width() {
      return a();
    },
    set width(u) {
      a(u), p();
    },
    get height() {
      return l();
    },
    set height(u) {
      l(u), p();
    }
  });
}
customElements.define("experience-overview", ut(
  Sr,
  {
    autoResize: { attribute: "auto-resize", type: "Boolean" },
    integration: {},
    experience: {},
    colour: {},
    color: {},
    width: {},
    height: {}
  },
  [],
  [],
  !0
));
const js = (t) => t;
function xe(t) {
  const e = t - 1;
  return e * e * e + 1;
}
function Pr(t) {
  return t < 0.5 ? 4 * t * t * t : 0.5 * Math.pow(2 * t - 2, 3) + 1;
}
function Ve(t) {
  const e = typeof t == "string" && t.match(/^\s*(-?[\d.]+)([^\s]*)\s*$/);
  return e ? [parseFloat(e[1]), e[2] || "px"] : [
    /** @type {number} */
    t,
    "px"
  ];
}
function zs(t, { delay: e = 0, duration: n = 400, easing: r = Pr, amount: s = 5, opacity: i = 0 } = {}) {
  const o = getComputedStyle(t), a = +o.opacity, l = o.filter === "none" ? "" : o.filter, c = a * (1 - i), [d, v] = Ve(s);
  return {
    delay: e,
    duration: n,
    easing: r,
    css: (h, g) => `opacity: ${a - c * g}; filter: ${l} blur(${g * d}${v});`
  };
}
function We(t, { delay: e = 0, duration: n = 400, easing: r = js } = {}) {
  const s = +getComputedStyle(t).opacity;
  return {
    delay: e,
    duration: n,
    easing: r,
    css: (i) => `opacity: ${i * s}`
  };
}
function Ds(t, { delay: e = 0, duration: n = 400, easing: r = xe, x: s = 0, y: i = 0, opacity: o = 0 } = {}) {
  const a = getComputedStyle(t), l = +a.opacity, c = a.transform === "none" ? "" : a.transform, d = l * (1 - o), [v, h] = Ve(s), [g, u] = Ve(i);
  return {
    delay: e,
    duration: n,
    easing: r,
    css: (f, w) => `
			transform: ${c} translate(${(1 - f) * v}${h}, ${(1 - f) * g}${u});
			opacity: ${l - d * w}`
  };
}
function Us(t, { delay: e = 0, duration: n = 400, easing: r = xe, axis: s = "y" } = {}) {
  const i = getComputedStyle(t), o = +i.opacity, a = s === "y" ? "height" : "width", l = parseFloat(i[a]), c = s === "y" ? ["top", "bottom"] : ["left", "right"], d = c.map(
    (b) => (
      /** @type {'Left' | 'Right' | 'Top' | 'Bottom'} */
      `${b[0].toUpperCase()}${b.slice(1)}`
    )
  ), v = parseFloat(i[`padding${d[0]}`]), h = parseFloat(i[`padding${d[1]}`]), g = parseFloat(i[`margin${d[0]}`]), u = parseFloat(i[`margin${d[1]}`]), f = parseFloat(
    i[`border${d[0]}Width`]
  ), w = parseFloat(
    i[`border${d[1]}Width`]
  );
  return {
    delay: e,
    duration: n,
    easing: r,
    css: (b) => `overflow: hidden;opacity: ${Math.min(b * 20, 1) * o};${a}: ${b * l}px;padding-${c[0]}: ${b * v}px;padding-${c[1]}: ${b * h}px;margin-${c[0]}: ${b * g}px;margin-${c[1]}: ${b * u}px;border-${c[0]}-width: ${b * f}px;border-${c[1]}-width: ${b * w}px;min-${a}: 0`
  };
}
function Tr(t, { delay: e = 0, duration: n = 400, easing: r = xe, start: s = 0, opacity: i = 0 } = {}) {
  const o = getComputedStyle(t), a = +o.opacity, l = o.transform === "none" ? "" : o.transform, c = 1 - s, d = a * (1 - i);
  return {
    delay: e,
    duration: n,
    easing: r,
    css: (v, h) => `
			transform: ${l} scale(${1 - c * h});
			opacity: ${a - d * h}
		`
  };
}
function qs(t, { delay: e = 0, speed: n, duration: r, easing: s = Pr } = {}) {
  let i = t.getTotalLength();
  const o = getComputedStyle(t);
  return o.strokeLinecap !== "butt" && (i += parseInt(o.strokeWidth)), r === void 0 ? n === void 0 ? r = 800 : r = i / n : typeof r == "function" && (r = r(i)), {
    delay: e,
    duration: r,
    easing: s,
    css: (a, l) => `
			stroke-dasharray: ${i};
			stroke-dashoffset: ${l * i};
		`
  };
}
function Nn(t, e) {
  for (const n in e) t[n] = e[n];
  return (
    /** @type {T & S} */
    t
  );
}
function Bs({ fallback: t, ...e }) {
  const n = /* @__PURE__ */ new Map(), r = /* @__PURE__ */ new Map();
  function s(o, a, l) {
    const {
      delay: c = 0,
      duration: d = (
        /** @param {number} d */
        (R) => Math.sqrt(R) * 30
      ),
      easing: v = xe
    } = Nn(Nn({}, e), l), h = o.getBoundingClientRect(), g = a.getBoundingClientRect(), u = h.left - g.left, f = h.top - g.top, w = h.width / g.width, b = h.height / g.height, y = Math.sqrt(u * u + f * f), _ = getComputedStyle(a), P = _.transform === "none" ? "" : _.transform, S = +_.opacity;
    return {
      delay: c,
      duration: typeof d == "function" ? d(y) : d,
      easing: v,
      css: (R, H) => `
			   opacity: ${R * S};
			   transform-origin: top left;
			   transform: ${P} translate(${H * u}px,${H * f}px) scale(${R + (1 - R) * w}, ${R + (1 - R) * b});
		   `
    };
  }
  function i(o, a, l) {
    return (c, d) => (o.set(d.key, c), () => {
      if (a.has(d.key)) {
        const v = a.get(d.key);
        return a.delete(d.key), s(
          /** @type {Element} */
          v,
          c,
          d
        );
      }
      return o.delete(d.key), t && t(c, d, l);
    });
  }
  return [i(r, n, !1), i(n, r, !0)];
}
const Vs = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
  __proto__: null,
  blur: zs,
  crossfade: Bs,
  draw: qs,
  fade: We,
  fly: Ds,
  scale: Tr,
  slide: Us
}, Symbol.toStringTag, { value: "Module" }));
var Ws = /* @__PURE__ */ J('<div role="button" tabindex="0" class="svelte-12llyur"></div>');
const Hs = {
  hash: "svelte-12llyur",
  code: "div.svelte-12llyur {z-index:-1;position:fixed;inset:0;background-color:black;opacity:0.32;}"
};
function Ar(t, e) {
  et(e, !1), an(t, Hs);
  let n = m(e, "duration", 12, null), r = m(e, "enter", 28, () => n() || 150), s = m(e, "leave", 28, () => n() || 75);
  var i = Ws();
  return qe(1, i, () => We, () => ({ duration: r() })), qe(2, i, () => We, () => ({ duration: s() })), Jt("click", i, function(o) {
    Rn.call(this, e, o);
  }), Jt("keydown", i, function(o) {
    Rn.call(this, e, o);
  }), V(t, i), nt({
    get duration() {
      return n();
    },
    set duration(o) {
      n(o), p();
    },
    get enter() {
      return r();
    },
    set enter(o) {
      r(o), p();
    },
    get leave() {
      return s();
    },
    set leave(o) {
      s(o), p();
    }
  });
}
ut(Ar, { duration: {}, enter: {}, leave: {} }, [], [], !0);
const Ys = /^#?([A-Fa-f0-9]{6}|[A-Fa-f0-9]{3})$/, Gs = /^#?([A-Fa-f0-9]{8}|[A-Fa-f0-9]{4})$/, Js = (t) => {
  if (t.match(Ys)) {
    (t.length === 4 || t.length === 7) && (t = t.substr(1)), t.length === 3 && (t = t.split(""), t = t[0] + t[0] + t[1] + t[1] + t[2] + t[2]);
    const e = parseInt(t, 16), n = e >> 16, r = e >> 8 & 255, s = e & 255;
    return [n, r, s, 1];
  }
  if (t.match(Gs)) {
    (t.length === 5 || t.length === 9) && (t = t.substr(1)), t.length === 4 && (t = t.split(""), t = t[0] + t[0] + t[1] + t[1] + t[2] + t[2] + t[3] + t[3]);
    const e = parseInt(t, 16), n = e >> 24 & 255, r = e >> 16 & 255, s = e >> 8 & 255, i = Math.round((e & 255) / 255 * 100) / 100;
    return [n, r, s, i];
  }
  throw new Error(`unknown hex color: ${t}`);
}, Ks = (t, e, n) => {
  const r = (s) => (s /= 255, s <= 0.03928 ? s / 12.92 : Math.pow((s + 0.055) / 1.055, 2.4));
  return t = r(t), e = r(e), n = r(n), 0.2126 * t + 0.7152 * e + 0.0722 * n;
};
function Cn(t) {
  const [e, n, r] = Js(t), s = Ks(e, n, r), i = (s + 0.05) / 0.05;
  return 1.05 / (s + 0.05) > i ? "#fff" : "#000";
}
var Xs = /* @__PURE__ */ J('<aside class="svelte-rdamco"><dialog open class="svelte-rdamco"><!></dialog> <!></aside>'), Zs = /* @__PURE__ */ J('<div class="click-to-book-with-beyonk svelte-rdamco"><span>Book now</span></div>'), Qs = /* @__PURE__ */ J("<!> <button><!></button>", 1);
const to = {
  hash: "svelte-rdamco",
  code: `button.svelte-rdamco {z-index:98999;background:transparent;border:0;padding:0;}.click-to-book-with-beyonk.svelte-rdamco {font-size:16px;line-height:28px;font-weight:500;color:white;box-shadow:rgba(0, 0, 0, 0.16) 0px 10px 36px 0px, rgba(0, 0, 0, 0.06) 0px 0px 0px 1px;padding:8px 16px 8px 16px;border-radius:4px;font-family:Cabin, sans-serif;}.click-to-book-with-beyonk.svelte-rdamco:hover {cursor:pointer;}.h-right.svelte-rdamco {position:fixed;right:20px;}.h-left.svelte-rdamco {position:fixed;left:20px;}.v-top.svelte-rdamco {position:fixed;top:20px;}.v-bottom.svelte-rdamco {position:fixed;bottom:20px;}.h-center.svelte-rdamco,
  .h-centre.svelte-rdamco {position:fixed;left:50%;transform:translateX(-50%);}.v-center.svelte-rdamco,
  .v-centre.svelte-rdamco {position:fixed;top:50%;transform:translateY(-50%);}aside.svelte-rdamco {z-index:99999;position:fixed;top:0;left:0;display:flex;align-items:center;width:100%;height:100%;}dialog.svelte-rdamco {overflow:hidden;width:92%;height:92%;padding:0;border:none;border-radius:4px;background-color:white;}`
};
function eo(t, e) {
  const n = ds(e, ["children", "$$slots", "$$events", "$$legacy", "$$host"]);
  et(e, !1), an(t, to);
  let r = m(e, "horizontal", 12), s = m(e, "vertical", 12), i = m(e, "transition", 12, "scale"), o = m(e, "experience", 12), a = m(e, "colour", 12, "#32B0A2"), l = m(e, "color", 12);
  const c = o() ? Sr : Er, d = Vs[i()] || Tr;
  let v = /* @__PURE__ */ Se(!1);
  function h() {
    M(v, !0);
  }
  function g() {
    M(v, !1);
  }
  zt();
  var u = Qs(), f = Ei(u);
  {
    var w = (_) => {
      var P = Xs(), S = le(P), R = le(S);
      Xi(R, () => c, (At, O) => {
        O(At, gs({ autoResize: !1 }, () => n));
      }), oe(S);
      var H = mn(S, 2);
      Ar(H, { $$events: { click: g } }), oe(P), qe(3, S, () => d, () => ({ y: 200, duration: 500 })), V(_, P);
    };
    Ji(f, (_) => {
      x(v) && _(w);
    });
  }
  var b = mn(f, 2), y = le(b);
  return Ki(y, e, "default", {}, (_) => {
    var P = Zs();
    Et((S) => br(P, `background-color: ${(l() || a()) ?? ""}; color: ${S ?? ""}`), [
      () => (ce(Cn), ce(l()), ce(a()), ee(() => Cn(l() || a())))
    ]), V(_, P);
  }), oe(b), Et(() => {
    es(b, 1, `h-${r() ?? "none" ?? ""} v-${s() ?? "none" ?? ""}`, "svelte-rdamco"), b.disabled = x(v);
  }), Jt("click", b, h), Jt("keydown", b, (_) => _.key === "Enter" && h()), V(t, u), nt({
    get horizontal() {
      return r();
    },
    set horizontal(_) {
      r(_), p();
    },
    get vertical() {
      return s();
    },
    set vertical(_) {
      s(_), p();
    },
    get transition() {
      return i();
    },
    set transition(_) {
      i(_), p();
    },
    get experience() {
      return o();
    },
    set experience(_) {
      o(_), p();
    },
    get colour() {
      return a();
    },
    set colour(_) {
      a(_), p();
    },
    get color() {
      return l();
    },
    set color(_) {
      l(_), p();
    }
  });
}
customElements.define("portal-button", ut(
  eo,
  {
    horizontal: {},
    vertical: {},
    transition: {},
    experience: {},
    colour: {},
    color: {}
  },
  ["default"],
  [],
  !0
));
const xr = "adaptive", no = "responsive", ro = [
  {
    platform: "Wix Editor",
    strategy: xr,
    test: () => document.body.classList.contains("device-mobile-optimized")
  },
  {
    platform: "Wix Studio",
    stategy: no,
    test: () => document.body.classList.contains("device-mobile-responsive")
  }
];
function io(t) {
  function e() {
    const i = window.innerWidth / window.outerWidth;
    t.style.setProperty("--adaptive-design-scale", i);
  }
  const n = ro.find((i) => i.test()), r = t.querySelector("iframe");
  if (n?.strategy !== xr)
    return;
  const s = Ui(window, "resize", e);
  return r.style.width = "calc(100% / var(--adaptive-design-scale))", r.style.transform = "scale(var(--adaptive-design-scale))", r.style.transformOrigin = "top left", t.style.height = "calc(var(--height) * var(--adaptive-design-scale))", e(), () => {
    s();
  };
}
var so = /* @__PURE__ */ J('<div><iframe title="Beyonk Shop" width="100%" frameborder="0" allow="payment *"></iframe></div>');
function oo(t, e) {
  et(e, !0);
  const n = m(e, "integration", 7, "byk-light"), r = m(e, "organisation", 7), s = m(e, "tab", 7), i = m(e, "colour", 7), o = m(e, "color", 23, i), a = m(e, "autoResize", 7, !0), l = new ne(window);
  let c, d = /* @__PURE__ */ rt("100%");
  l.listen(tt.ScrollIntoView, () => cn(c)), a() && l.listen(tt.ResizePortal, (f) => {
    M(d, f.height, !0);
  });
  function v() {
    const f = new URL(`/${r()}`, Dt.shop);
    return f.searchParams.set("integration", n()), s() && f.searchParams.set("home", `/${s()}`), o() && f.searchParams.set("theme", o().slice(1)), re(f), f.toString();
  }
  var h = so();
  let g;
  var u = le(h);
  return ln(u, (f) => c = f, () => c), oe(h), Zi(h, () => io), Et(
    (f, w) => {
      g = br(h, "", g, f), j(u, "src", w), j(u, "height", x(d));
    },
    [() => ({ "--height": x(d) }), v]
  ), V(t, h), nt({
    get integration() {
      return n();
    },
    set integration(f = "byk-light") {
      n(f), p();
    },
    get organisation() {
      return r();
    },
    set organisation(f) {
      r(f), p();
    },
    get tab() {
      return s();
    },
    set tab(f) {
      s(f), p();
    },
    get colour() {
      return i();
    },
    set colour(f) {
      i(f), p();
    },
    get color() {
      return o();
    },
    set color(f = i) {
      o(f), p();
    },
    get autoResize() {
      return a();
    },
    set autoResize(f = !0) {
      a(f), p();
    }
  });
}
customElements.define("beyonk-shop", ut(
  oo,
  {
    autoResize: { attribute: "auto-resize", type: "Boolean" },
    integration: {},
    organisation: {},
    tab: {},
    colour: {},
    color: {}
  },
  [],
  [],
  !0,
  (t) => class extends t {
    constructor() {
      super(), setTimeout(
        () => {
          this.style.minHeight = "auto", this.style.height = "auto";
        },
        1
      );
    }
  }
));
let He = !1;
try {
  He = !!localStorage.getItem("_byk_analytics_debug");
} catch {
  He = !1;
}
function Y(...t) {
  He && console.debug(...t);
}
const Mt = /* @__PURE__ */ new Map(), un = (t) => {
  const e = [], n = [];
  for (const r of t.items) {
    const { item_id: s, ...i } = r;
    e.push(s), n.push({
      id: s,
      ...i
    });
  }
  return {
    content_ids: e,
    contents: n,
    currency: t.currency,
    value: t.value
  };
};
Mt.set("add_payment_info", {
  name: "AddPaymentInfo",
  remap: un
});
Mt.set("begin_checkout", {
  name: "InitiateCheckout",
  remap: un
});
Mt.set("select_item", {
  name: "Schedule",
  remap: (t) => ({
    occurrence: t.items?.[0]?.item_id
  })
});
Mt.set("purchase", {
  name: "Purchase",
  remap: un
});
function ao({ type: t, data: e }) {
  if (typeof window.fbq != "function") {
    Y("No Meta pixel detected, ignoring tracking event");
    return;
  }
  if (!Mt.has(t))
    return;
  const { name: n, remap: r } = Mt.get(t);
  window.fbq("track", n, r(e));
}
const Rr = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
  __proto__: null,
  trigger: ao
}, Symbol.toStringTag, { value: "Module" }));
function lo() {
  window.dataLayer.push(arguments);
}
function co({ type: t, data: e }) {
  if (!Array.isArray(window.dataLayer)) {
    Y("No Google Analytics dataLayer detected, ignoring tracking event");
    return;
  }
  lo("event", t, e);
}
const Or = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
  __proto__: null,
  trigger: co
}, Symbol.toStringTag, { value: "Module" })), St = /* @__PURE__ */ new Map(), Re = (t) => {
  const e = [], n = [];
  for (const r of t.items) {
    const { item_id: s, ...i } = r;
    e.push(s), n.push({
      id: s,
      ...i
    });
  }
  return {
    content_ids: e,
    contents: n,
    content_type: "product_group",
    currency: t.currency,
    value: t.value
  };
};
St.set("add_payment_info", {
  name: "AddPaymentInfo",
  remap: Re
});
St.set("add_to_cart", {
  name: "AddToCart",
  remap: Re
});
St.set("begin_checkout", {
  name: "InitiateCheckout",
  remap: Re
});
St.set("select_item", {
  name: "CustomizeProduct",
  remap: (t) => ({
    occurrence: t.items?.[0]?.item_id
  })
});
St.set("purchase", {
  name: "CompletePayment",
  remap: Re
});
function uo({ type: t, data: e }) {
  const n = window[window.TiktokAnalyticsObject];
  if (typeof n.track != "function") {
    Y(`No TikTok pixel detected when looking for one named "${window.TiktokAnalyticsObject}", ignoring tracking event`);
    return;
  }
  if (!St.has(t))
    return;
  const { name: r, remap: s } = St.get(t);
  n.track(r, s(e));
}
const Nr = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
  __proto__: null,
  trigger: uo
}, Symbol.toStringTag, { value: "Module" }));
let fo = class {
  constructor() {
    this.mappers = {
      meta: Rr,
      google: Or,
      tiktok: Nr
    };
  }
  trigger({ type: e, data: n }) {
    for (const r of Object.values(this.mappers))
      r.trigger({ type: e, data: n });
  }
};
function ho({ url: t }) {
  window.location.href = t;
}
function go({ cartId: t }) {
  sessionStorage?.setItem("cart", t);
}
const fn = new ne(window), Ln = new fo();
fn.listen(tt.RedirectParent, ho);
fn.listen(tt.RegisterCart, go);
fn.listen(tt.Analytics, Ln.trigger.bind(Ln));
class vo {
  constructor() {
    this.mappers = {
      meta: Rr,
      google: Or,
      tiktok: Nr
    };
  }
  trigger({ type: e, data: n }) {
    for (const r of Object.values(this.mappers))
      r.trigger({ type: e, data: n });
  }
}
const _o = {
  Analytics: "beyonk:analytics"
};
function po(t = []) {
  (function(e, n, r, s, i, o, a) {
    e.fbq || (i = e.fbq = function() {
      i.callMethod ? i.callMethod.apply(i, arguments) : i.queue.push(arguments);
    }, e._fbq || (e._fbq = i, i.push = i, i.loaded = !0, i.version = "2.0"), i.queue = [], o = n.createElement(r), o.async = !0, o.src = s, a = n.getElementsByTagName(r)[0], a.parentNode.insertBefore(o, a));
  })(
    window,
    document,
    "script",
    "//connect.facebook.net/en_US/fbevents.js"
  );
  for (const e of t)
    fbq("init", e), Y("analytics: adding meta pixel tracker", e);
  return {
    postSetup() {
      fbq("track", "PageView");
    }
  };
}
const mo = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
  __proto__: null,
  initialise: po
}, Symbol.toStringTag, { value: "Module" }));
function bo(t, e, n) {
  t.length;
  function r() {
  }
  if (e())
    return n();
  for (const { type: s, url: i, content: o, options: a = { async: !0, defer: !0 } } of t) {
    const l = s === "script", c = document.createElement(l ? "script" : "link"), d = l ? "src" : "href", v = (!!i).valueOf();
    l ? (c.async = a.async, c.defer = a.defer) : c.rel = "stylesheet", v ? c[d] = i : c.appendChild(
      document.createTextNode(o)
    ), c.onload = r, document.body.appendChild(c);
  }
}
function wo(t = []) {
  bo(
    [{ type: "script", url: `//www.googletagmanager.com/gtag/js?id=${t[0]}` }],
    () => !!window.ga,
    () => {
    }
  ), window.dataLayer = window.dataLayer || [];
  function e() {
    dataLayer.push(arguments);
  }
  e("js", /* @__PURE__ */ new Date());
  for (const n of t)
    e("config", n), Y("analytics: adding google tracker", n);
  return {
    postSetup() {
    }
  };
}
const yo = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
  __proto__: null,
  initialise: wo
}, Symbol.toStringTag, { value: "Module" }));
function ko(t = []) {
  return (function(e, n, r) {
    e.TiktokAnalyticsObject = r;
    const s = e[r] = e[r] || [];
    s.methods = [
      "page",
      "track",
      "identify",
      "instances",
      "debug",
      "on",
      "off",
      "once",
      "ready",
      "alias",
      "group",
      "enableCookie",
      "disableCookie",
      "holdConsent",
      "revokeConsent",
      "grantConsent"
    ], s.setAndDefer = function(i, o) {
      i[o] = function() {
        i.push([o].concat(Array.prototype.slice.call(arguments, 0)));
      };
    };
    for (let i = 0; i < s.methods.length; i++)
      s.setAndDefer(s, s.methods[i]);
    s.instance = function(i) {
      const o = s._i[i] || [];
      for (let a = 0; a < s.methods.length; a++)
        s.setAndDefer(o, s.methods[a]);
      return o;
    }, s.load = function(i, o) {
      const a = "//analytics.tiktok.com/i18n/pixel/events.js";
      s._i = s._i || {}, s._i[i] = [], s._i[i]._u = a, s._t = s._t || {}, s._t[i] = +/* @__PURE__ */ new Date(), s._o = s._o || {}, s._o[i] = o || {};
      const l = n.createElement("script");
      l.type = "text/javascript", l.async = !0, l.src = a + "?sdkid=" + i + "&lib=" + r;
      const c = n.getElementsByTagName("script")[0];
      c.parentNode.insertBefore(l, c);
    };
    for (const i of t)
      s.load(i), Y("analytics: adding tiktok pixel tracker", i);
  })(window, document, "ttq"), {
    postSetup() {
      ttq.page();
    }
  };
}
const $o = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
  __proto__: null,
  initialise: ko
}, Symbol.toStringTag, { value: "Module" }));
class Eo {
  constructor(e = {}, n = []) {
    this.trackers = {};
    const r = {
      meta: mo,
      google: yo,
      tiktok: $o
    }, s = {
      meta: e.meta || [],
      google: e.google || [],
      tiktok: e.tiktok || []
    };
    for (const { type: i, value: o } of n) {
      if (!s[i]) {
        Y("analytics: unknown tracking provider", i, "with id", o);
        continue;
      }
      s[i].push(o), Y(`analytics: adding provider ${i} tracker`, o);
    }
    for (const [i, o] of Object.entries(s)) {
      if (!o.length) {
        Y("analytics: no", i, "accounts to initialise");
        continue;
      }
      Y("analytics: initialising", i, "with", o.length, "accounts"), this.trackers[i] = r[i].initialise(o);
    }
    for (const i of Object.values(this.trackers))
      i.postSetup();
  }
}
var So = /* @__PURE__ */ J('<link rel="preconnect" href="//www.google-analytics.com"/> <link rel="preconnect" href="//www.googletagmanager.com"/> <link rel="preconnect" href="//www.facebook.com"/> <link rel="preconnect" href="//connect.facebook.net"/> <link rel="preconnect" href="//analytics.tiktok.com"/>', 1);
function Po(t, e) {
  et(e, !1);
  let n = m(e, "googleAnalyticsAccounts", 28, () => []), r = m(e, "metaPixelAccounts", 28, () => []), s = m(e, "tiktokPixelAccounts", 28, () => []), i = m(e, "organisationTracking", 28, () => []);
  if (!(window.location !== window.parent.location)) {
    Y("analytics: standalone mode"), new Eo(
      {
        // eslint-disable-line no-new
        meta: r(),
        google: n(),
        tiktok: s()
      },
      i()
    );
    const a = new ne(window), l = new vo();
    a.listen(_o.Analytics, l.trigger.bind(l));
  }
  return zt(), Bi((a) => {
    var l = So();
    ui(8), V(a, l);
  }), nt({
    get googleAnalyticsAccounts() {
      return n();
    },
    set googleAnalyticsAccounts(a) {
      n(a), p();
    },
    get metaPixelAccounts() {
      return r();
    },
    set metaPixelAccounts(a) {
      r(a), p();
    },
    get tiktokPixelAccounts() {
      return s();
    },
    set tiktokPixelAccounts(a) {
      s(a), p();
    },
    get organisationTracking() {
      return i();
    },
    set organisationTracking(a) {
      i(a), p();
    }
  });
}
customElements.define("beyonk-analytics", ut(
  Po,
  {
    googleAnalyticsAccounts: { attribute: "google-analytics-accounts", type: "Array" },
    metaPixelAccounts: { attribute: "meta-pixel-accounts", type: "Array" },
    tiktokPixelAccounts: { attribute: "tiktok-pixel-accounts", type: "Array" },
    organisationTracking: { attribute: "organisation-tracking", type: "Array" }
  },
  [],
  [],
  !0
));
if (typeof window < "u") {
  const t = $r(window.location.href);
  t.size > 0 && Ts(t.toJSON());
}
export {
  Po as Analytics,
  Ns as BookingForm,
  Ss as CartButton,
  Ls as GiftVoucherForm,
  Sr as Overview,
  Er as Portal,
  eo as PortalButton,
  oo as Shop
};
