import { a2 as _t, E as I, g as pe, a3 as vt, C as O, a4 as Te, q as U, a5 as T, h as b, a6 as L, b as ge, a as K, a7 as be, H as Ye, a8 as R, B as re, a9 as ee, aa as F, ab as pt, ac as V, ad as te, ae as Ne, af as gt, ag as je, ah as we, ai as He, aj as Ie, ak as bt, al as Oe, am as wt, f as yt, an as M, s as Y, A as qe, d as We, ao as Re, ap as mt, aq as ye, ar as Et, as as At, at as St, au as me, av as Tt, aw as Ee, ax as fe, ay as Nt, az as It, aA as Ot, aB as Rt, aC as Pt, aD as Lt, aE as ue, aF as ze, aG as Mt, aH as oe, e as D, aI as Dt, aJ as Ct, aK as $t, aL as Bt, t as Ge, aM as Ft, aN as kt, r as Ke, aO as Pe, aP as xt, aQ as Ut, aR as Vt, aS as Ae, aT as Ze, aU as Yt, aV as jt, aW as Ht, aX as qt, aY as Wt, aZ as zt, a_ as Gt, a$ as Kt, b0 as Zt, b1 as Jt, b2 as Xt, U as Qt, b3 as er, b4 as Le, b5 as Me, b6 as tr, v as P, b7 as Je, b8 as De, m as Xe, b9 as rr, J as sr, D as Se, ba as ir, bb as ar, bc as nr, V as fr, bd as Ce, be as Qe, bf as ur, bg as or, bh as et, bi as lr, bj as cr, bk as dr, bl as hr, bm as _r, bn as vr, l as le, bo as pr, w as $, x as B, z as se, y as J } from "./index-BBXAtvZr.js";
function gr(e) {
  let t = 0, r = pe(0), s;
  return () => {
    _t() && (I(r), vt(() => (t === 0 && (s = O(() => e(() => Te(r)))), t += 1, () => {
      U(() => {
        t -= 1, t === 0 && (s?.(), s = void 0, Te(r));
      });
    })));
  };
}
var br = ye | Et | At;
function wr(e, t, r) {
  new yr(e, t, r);
}
class yr {
  /** @type {Boundary | null} */
  parent;
  is_pending = !1;
  /** @type {TemplateNode} */
  #e;
  /** @type {TemplateNode | null} */
  #t = b ? T : null;
  /** @type {BoundaryProps} */
  #r;
  /** @type {((anchor: Node) => void)} */
  #n;
  /** @type {Effect} */
  #a;
  /** @type {Effect | null} */
  #i = null;
  /** @type {Effect | null} */
  #s = null;
  /** @type {Effect | null} */
  #f = null;
  /** @type {DocumentFragment | null} */
  #u = null;
  /** @type {TemplateNode | null} */
  #c = null;
  #d = 0;
  #o = 0;
  #_ = !1;
  #h = !1;
  /** @type {Set<Effect>} */
  #v = /* @__PURE__ */ new Set();
  /** @type {Set<Effect>} */
  #p = /* @__PURE__ */ new Set();
  /**
   * A source containing the number of pending async deriveds/expressions.
   * Only created if `$effect.pending()` is used inside the boundary,
   * otherwise updating the source results in needless `Batch.ensure()`
   * calls followed by no-op flushes
   * @type {Source<number> | null}
   */
  #l = null;
  #m = gr(() => (this.#l = pe(this.#d), () => {
    this.#l = null;
  }));
  /**
   * @param {TemplateNode} node
   * @param {BoundaryProps} props
   * @param {((anchor: Node) => void)} children
   */
  constructor(t, r, s) {
    this.#e = t, this.#r = r, this.#n = s, this.parent = /** @type {Effect} */
    L.b, this.is_pending = !!this.#r.pending, this.#a = ge(() => {
      if (L.b = this, b) {
        const i = this.#t;
        K(), /** @type {Comment} */
        i.nodeType === be && /** @type {Comment} */
        i.data === Ye ? this.#A() : (this.#E(), this.#o === 0 && (this.is_pending = !1));
      } else {
        var a = this.#w();
        try {
          this.#i = R(() => s(a));
        } catch (i) {
          this.error(i);
        }
        this.#o > 0 ? this.#b() : this.is_pending = !1;
      }
      return () => {
        this.#c?.remove();
      };
    }, br), b && (this.#e = T);
  }
  #E() {
    try {
      this.#i = R(() => this.#n(this.#e));
    } catch (t) {
      this.error(t);
    }
  }
  #A() {
    const t = this.#r.pending;
    t && (this.#s = R(() => t(this.#e)), U(() => {
      var r = this.#w();
      this.#i = this.#g(() => (re.ensure(), R(() => this.#n(r)))), this.#o > 0 ? this.#b() : (ee(
        /** @type {Effect} */
        this.#s,
        () => {
          this.#s = null;
        }
      ), this.is_pending = !1);
    }));
  }
  #w() {
    var t = this.#e;
    return this.is_pending && (this.#c = F(), this.#e.before(this.#c), t = this.#c), t;
  }
  /**
   * Defer an effect inside a pending boundary until the boundary resolves
   * @param {Effect} effect
   */
  defer_effect(t) {
    pt(t, this.#v, this.#p);
  }
  /**
   * Returns `false` if the effect exists inside a boundary whose pending snippet is shown
   * @returns {boolean}
   */
  is_rendered() {
    return !this.is_pending && (!this.parent || this.parent.is_rendered());
  }
  has_pending_snippet() {
    return !!this.#r.pending;
  }
  /**
   * @param {() => Effect | null} fn
   */
  #g(t) {
    var r = L, s = je, a = we;
    V(this.#a), te(this.#a), Ne(this.#a.ctx);
    try {
      return t();
    } catch (i) {
      return gt(i), null;
    } finally {
      V(r), te(s), Ne(a);
    }
  }
  #b() {
    const t = (
      /** @type {(anchor: Node) => void} */
      this.#r.pending
    );
    this.#i !== null && (this.#u = document.createDocumentFragment(), this.#u.append(
      /** @type {TemplateNode} */
      this.#c
    ), He(this.#i, this.#u)), this.#s === null && (this.#s = R(() => t(this.#e)));
  }
  /**
   * Updates the pending count associated with the currently visible pending snippet,
   * if any, such that we can replace the snippet with content once work is done
   * @param {1 | -1} d
   */
  #y(t) {
    if (!this.has_pending_snippet()) {
      this.parent && this.parent.#y(t);
      return;
    }
    if (this.#o += t, this.#o === 0) {
      this.is_pending = !1;
      for (const r of this.#v)
        Ie(r, bt), Oe(r);
      for (const r of this.#p)
        Ie(r, wt), Oe(r);
      this.#v.clear(), this.#p.clear(), this.#s && ee(this.#s, () => {
        this.#s = null;
      }), this.#u && (this.#e.before(this.#u), this.#u = null);
    }
  }
  /**
   * Update the source that powers `$effect.pending()` inside this boundary,
   * and controls when the current `pending` snippet (if any) is removed.
   * Do not call from inside the class
   * @param {1 | -1} d
   */
  update_pending_count(t) {
    this.#y(t), this.#d += t, !(!this.#l || this.#_) && (this.#_ = !0, U(() => {
      this.#_ = !1, this.#l && yt(this.#l, this.#d);
    }));
  }
  get_effect_pending() {
    return this.#m(), I(
      /** @type {Source<number>} */
      this.#l
    );
  }
  /** @param {unknown} error */
  error(t) {
    var r = this.#r.onerror;
    let s = this.#r.failed;
    if (this.#h || !r && !s)
      throw t;
    this.#i && (M(this.#i), this.#i = null), this.#s && (M(this.#s), this.#s = null), this.#f && (M(this.#f), this.#f = null), b && (Y(
      /** @type {TemplateNode} */
      this.#t
    ), qe(), Y(We()));
    var a = !1, i = !1;
    const n = () => {
      if (a) {
        St();
        return;
      }
      a = !0, i && mt(), re.ensure(), this.#d = 0, this.#f !== null && ee(this.#f, () => {
        this.#f = null;
      }), this.is_pending = this.has_pending_snippet(), this.#i = this.#g(() => (this.#h = !1, R(() => this.#n(this.#e)))), this.#o > 0 ? this.#b() : this.is_pending = !1;
    };
    U(() => {
      try {
        i = !0, r?.(t, n), i = !1;
      } catch (f) {
        Re(f, this.#a && this.#a.parent);
      }
      s && (this.#f = this.#g(() => {
        re.ensure(), this.#h = !0;
        try {
          return R(() => {
            s(
              this.#e,
              () => t,
              () => n
            );
          });
        } catch (f) {
          return Re(
            f,
            /** @type {Effect} */
            this.#a.parent
          ), null;
        } finally {
          this.#h = !1;
        }
      }));
    });
  }
}
function mr(e) {
  return e.endsWith("capture") && e !== "gotpointercapture" && e !== "lostpointercapture";
}
const Er = [
  "beforeinput",
  "click",
  "change",
  "dblclick",
  "contextmenu",
  "focusin",
  "focusout",
  "input",
  "keydown",
  "keyup",
  "mousedown",
  "mousemove",
  "mouseout",
  "mouseover",
  "mouseup",
  "pointerdown",
  "pointermove",
  "pointerout",
  "pointerover",
  "pointerup",
  "touchend",
  "touchmove",
  "touchstart"
];
function Ar(e) {
  return Er.includes(e);
}
const Sr = {
  // no `class: 'className'` because we handle that separately
  formnovalidate: "formNoValidate",
  ismap: "isMap",
  nomodule: "noModule",
  playsinline: "playsInline",
  readonly: "readOnly",
  defaultvalue: "defaultValue",
  defaultchecked: "defaultChecked",
  srcobject: "srcObject",
  novalidate: "noValidate",
  allowfullscreen: "allowFullscreen",
  disablepictureinpicture: "disablePictureInPicture",
  disableremoteplayback: "disableRemotePlayback"
};
function Tr(e) {
  return e = e.toLowerCase(), Sr[e] ?? e;
}
const Nr = ["touchstart", "touchmove"];
function Ir(e) {
  return Nr.includes(e);
}
const tt = /* @__PURE__ */ new Set(), ce = /* @__PURE__ */ new Set();
function rt(e, t, r, s = {}) {
  function a(i) {
    if (s.capture || z.call(t, i), !i.cancelBubble)
      return Tt(() => r?.call(this, i));
  }
  return e.startsWith("pointer") || e.startsWith("touch") || e === "wheel" ? U(() => {
    t.addEventListener(e, a, s);
  }) : t.addEventListener(e, a, s), a;
}
function ss(e, t, r, s, a) {
  var i = { capture: s, passive: a }, n = rt(e, t, r, i);
  (t === document.body || // @ts-ignore
  t === window || // @ts-ignore
  t === document || // Firefox has quirky behavior, it can happen that we still get "canplay" events when the element is already removed
  t instanceof HTMLMediaElement) && me(() => {
    t.removeEventListener(e, n, i);
  });
}
function st(e) {
  for (var t = 0; t < e.length; t++)
    tt.add(e[t]);
  for (var r of ce)
    r(e);
}
let $e = null;
function z(e) {
  var t = this, r = (
    /** @type {Node} */
    t.ownerDocument
  ), s = e.type, a = e.composedPath?.() || [], i = (
    /** @type {null | Element} */
    a[0] || e.target
  );
  $e = e;
  var n = 0, f = $e === e && e.__root;
  if (f) {
    var o = a.indexOf(f);
    if (o !== -1 && (t === document || t === /** @type {any} */
    window)) {
      e.__root = t;
      return;
    }
    var l = a.indexOf(t);
    if (l === -1)
      return;
    o <= l && (n = o);
  }
  if (i = /** @type {Element} */
  a[n] || e.target, i !== t) {
    Ee(e, "currentTarget", {
      configurable: !0,
      get() {
        return i || r;
      }
    });
    var h = je, d = L;
    te(null), V(null);
    try {
      for (var u, _ = []; i !== null; ) {
        var v = i.assignedSlot || i.parentNode || /** @type {any} */
        i.host || null;
        try {
          var E = i["__" + s];
          E != null && (!/** @type {any} */
          i.disabled || // DOM could've been updated already by the time this is reached, so we check this as well
          // -> the target could not have been disabled because it emits the event in the first place
          e.target === i) && E.call(i, e);
        } catch (A) {
          u ? _.push(A) : u = A;
        }
        if (e.cancelBubble || v === t || v === null)
          break;
        i = v;
      }
      if (u) {
        for (let A of _)
          queueMicrotask(() => {
            throw A;
          });
        throw u;
      }
    } finally {
      e.__root = t, delete e.currentTarget, te(h), V(d);
    }
  }
}
function Or(e) {
  var t = document.createElement("template");
  return t.innerHTML = e.replaceAll("<!>", "<!---->"), t.content;
}
function C(e, t) {
  var r = (
    /** @type {Effect} */
    L
  );
  r.nodes === null && (r.nodes = { start: e, end: t, a: null, t: null });
}
// @__NO_SIDE_EFFECTS__
function Z(e, t) {
  var r = (t & Lt) !== 0, s = (t & It) !== 0, a, i = !e.startsWith("<!>");
  return () => {
    if (b)
      return C(T, null), T;
    a === void 0 && (a = Or(i ? e : "<!>" + e), r || (a = /** @type {TemplateNode} */
    fe(a)));
    var n = (
      /** @type {TemplateNode} */
      s || Nt ? document.importNode(a, !0) : a.cloneNode(!0)
    );
    if (r) {
      var f = (
        /** @type {TemplateNode} */
        fe(n)
      ), o = (
        /** @type {TemplateNode} */
        n.lastChild
      );
      C(f, o);
    } else
      C(n, n);
    return n;
  };
}
function is(e = "") {
  if (!b) {
    var t = F(e + "");
    return C(t, t), t;
  }
  var r = T;
  return r.nodeType !== Ot ? (r.before(r = F()), Y(r)) : Rt(
    /** @type {Text} */
    r
  ), C(r, r), r;
}
function as() {
  if (b)
    return C(T, null), T;
  var e = document.createDocumentFragment(), t = document.createComment(""), r = F();
  return e.append(t, r), C(t, r), e;
}
function H(e, t) {
  if (b) {
    var r = (
      /** @type {Effect & { nodes: EffectNodes }} */
      L
    );
    ((r.f & Pt) === 0 || r.nodes.end === null) && (r.nodes.end = T), K();
    return;
  }
  e !== null && e.before(
    /** @type {Node} */
    t
  );
}
function ie(e, t) {
  var r = t == null ? "" : typeof t == "object" ? t + "" : t;
  r !== (e.__t ??= e.nodeValue) && (e.__t = r, e.nodeValue = r + "");
}
function it(e, t) {
  return at(e, t);
}
function Rr(e, t) {
  ue(), t.intro = t.intro ?? !1;
  const r = t.target, s = b, a = T;
  try {
    for (var i = fe(r); i && (i.nodeType !== be || /** @type {Comment} */
    i.data !== ze); )
      i = Mt(i);
    if (!i)
      throw oe;
    D(!0), Y(
      /** @type {Comment} */
      i
    );
    const n = at(e, { ...t, anchor: i });
    return D(!1), /**  @type {Exports} */
    n;
  } catch (n) {
    if (n instanceof Error && n.message.split(`
`).some((f) => f.startsWith("https://svelte.dev/e/")))
      throw n;
    return n !== oe && console.warn("Failed to hydrate: ", n), t.recover === !1 && Dt(), ue(), Ct(r), D(!1), it(e, t);
  } finally {
    D(s), Y(a);
  }
}
const x = /* @__PURE__ */ new Map();
function at(e, { target: t, anchor: r, props: s = {}, events: a, context: i, intro: n = !0 }) {
  ue();
  var f = /* @__PURE__ */ new Set(), o = (d) => {
    for (var u = 0; u < d.length; u++) {
      var _ = d[u];
      if (!f.has(_)) {
        f.add(_);
        var v = Ir(_);
        t.addEventListener(_, z, { passive: v });
        var E = x.get(_);
        E === void 0 ? (document.addEventListener(_, z, { passive: v }), x.set(_, 1)) : x.set(_, E + 1);
      }
    }
  };
  o($t(tt)), ce.add(o);
  var l = void 0, h = Bt(() => {
    var d = r ?? t.appendChild(F());
    return wr(
      /** @type {TemplateNode} */
      d,
      {
        pending: () => {
        }
      },
      (u) => {
        Ge({});
        var _ = (
          /** @type {ComponentContext} */
          we
        );
        if (i && (_.c = i), a && (s.$$events = a), b && C(
          /** @type {TemplateNode} */
          u,
          null
        ), l = e(u, s) || {}, b && (L.nodes.end = T, T === null || T.nodeType !== be || /** @type {Comment} */
        T.data !== Ft))
          throw kt(), oe;
        Ke();
      }
    ), () => {
      for (var u of f) {
        t.removeEventListener(u, z);
        var _ = (
          /** @type {number} */
          x.get(u)
        );
        --_ === 0 ? (document.removeEventListener(u, z), x.delete(u)) : x.set(u, _);
      }
      ce.delete(o), d !== r && d.parentNode?.removeChild(d);
    };
  });
  return de.set(l, h), l;
}
let de = /* @__PURE__ */ new WeakMap();
function Pr(e, t) {
  const r = de.get(e);
  return r ? (de.delete(e), r(t)) : Promise.resolve();
}
class nt {
  /** @type {TemplateNode} */
  anchor;
  /** @type {Map<Batch, Key>} */
  #e = /* @__PURE__ */ new Map();
  /**
   * Map of keys to effects that are currently rendered in the DOM.
   * These effects are visible and actively part of the document tree.
   * Example:
   * ```
   * {#if condition}
   * 	foo
   * {:else}
   * 	bar
   * {/if}
   * ```
   * Can result in the entries `true->Effect` and `false->Effect`
   * @type {Map<Key, Effect>}
   */
  #t = /* @__PURE__ */ new Map();
  /**
   * Similar to #onscreen with respect to the keys, but contains branches that are not yet
   * in the DOM, because their insertion is deferred.
   * @type {Map<Key, Branch>}
   */
  #r = /* @__PURE__ */ new Map();
  /**
   * Keys of effects that are currently outroing
   * @type {Set<Key>}
   */
  #n = /* @__PURE__ */ new Set();
  /**
   * Whether to pause (i.e. outro) on change, or destroy immediately.
   * This is necessary for `<svelte:element>`
   */
  #a = !0;
  /**
   * @param {TemplateNode} anchor
   * @param {boolean} transition
   */
  constructor(t, r = !0) {
    this.anchor = t, this.#a = r;
  }
  #i = () => {
    var t = (
      /** @type {Batch} */
      Pe
    );
    if (this.#e.has(t)) {
      var r = (
        /** @type {Key} */
        this.#e.get(t)
      ), s = this.#t.get(r);
      if (s)
        xt(s), this.#n.delete(r);
      else {
        var a = this.#r.get(r);
        a && (this.#t.set(r, a.effect), this.#r.delete(r), a.fragment.lastChild.remove(), this.anchor.before(a.fragment), s = a.effect);
      }
      for (const [i, n] of this.#e) {
        if (this.#e.delete(i), i === t)
          break;
        const f = this.#r.get(n);
        f && (M(f.effect), this.#r.delete(n));
      }
      for (const [i, n] of this.#t) {
        if (i === r || this.#n.has(i)) continue;
        const f = () => {
          if (Array.from(this.#e.values()).includes(i)) {
            var l = document.createDocumentFragment();
            He(n, l), l.append(F()), this.#r.set(i, { effect: n, fragment: l });
          } else
            M(n);
          this.#n.delete(i), this.#t.delete(i);
        };
        this.#a || !s ? (this.#n.add(i), ee(n, f, !1)) : f();
      }
    }
  };
  /**
   * @param {Batch} batch
   */
  #s = (t) => {
    this.#e.delete(t);
    const r = Array.from(this.#e.values());
    for (const [s, a] of this.#r)
      r.includes(s) || (M(a.effect), this.#r.delete(s));
  };
  /**
   *
   * @param {any} key
   * @param {null | ((target: TemplateNode) => void)} fn
   */
  ensure(t, r) {
    var s = (
      /** @type {Batch} */
      Pe
    ), a = Ut();
    if (r && !this.#t.has(t) && !this.#r.has(t))
      if (a) {
        var i = document.createDocumentFragment(), n = F();
        i.append(n), this.#r.set(t, {
          effect: R(() => r(n)),
          fragment: i
        });
      } else
        this.#t.set(
          t,
          R(() => r(this.anchor))
        );
    if (this.#e.set(s, t), a) {
      for (const [f, o] of this.#t)
        f === t ? s.unskip_effect(o) : s.skip_effect(o);
      for (const [f, o] of this.#r)
        f === t ? s.unskip_effect(o.effect) : s.skip_effect(o.effect);
      s.oncommit(this.#i), s.ondiscard(this.#s);
    } else
      b && (this.anchor = T), this.#i();
  }
}
function X(e, t, r = !1) {
  b && K();
  var s = new nt(e), a = r ? ye : 0;
  function i(n, f) {
    if (b) {
      const h = Vt(e);
      var o;
      if (h === ze ? o = 0 : h === Ye ? o = !1 : o = parseInt(h.substring(1)), n !== o) {
        var l = We();
        Y(l), s.anchor = l, D(!1), s.ensure(n, f), D(!0);
        return;
      }
    }
    s.ensure(n, f);
  }
  ge(() => {
    var n = !1;
    t((f, o = 0) => {
      n = !0, i(o, f);
    }), n || i(!1, null);
  }, a);
}
function ns(e, t, r, s, a) {
  b && K();
  var i = t.$$slots?.[r], n = !1;
  i === !0 && (i = t[r === "default" ? "children" : r], n = !0), i === void 0 || i(e, n ? () => s : s);
}
function fs(e, t, r) {
  b && K();
  var s = new nt(e);
  ge(() => {
    var a = t() ?? null;
    s.ensure(a, a && ((i) => r(i, a)));
  }, ye);
}
function us(e, t) {
  Ae(() => {
    var r = e.getRootNode(), s = (
      /** @type {ShadowRoot} */
      r.host ? (
        /** @type {ShadowRoot} */
        r
      ) : (
        /** @type {Document} */
        r.head ?? /** @type {Document} */
        r.ownerDocument.head
      )
    );
    if (!s.querySelector("#" + t.hash)) {
      const a = document.createElement("style");
      a.id = t.hash, a.textContent = t.code, s.appendChild(a);
    }
  });
}
function Lr(e, t) {
  var r = void 0, s;
  Ze(() => {
    r !== (r = t()) && (s && (M(s), s = null), r && (s = R(() => {
      Ae(() => (
        /** @type {(node: Element) => void} */
        r(e)
      ));
    })));
  });
}
function ft(e) {
  var t, r, s = "";
  if (typeof e == "string" || typeof e == "number") s += e;
  else if (typeof e == "object") if (Array.isArray(e)) {
    var a = e.length;
    for (t = 0; t < a; t++) e[t] && (r = ft(e[t])) && (s && (s += " "), s += r);
  } else for (r in e) e[r] && (s && (s += " "), s += r);
  return s;
}
function Mr() {
  for (var e, t, r = 0, s = "", a = arguments.length; r < a; r++) (e = arguments[r]) && (t = ft(e)) && (s && (s += " "), s += t);
  return s;
}
function Dr(e) {
  return typeof e == "object" ? Mr(e) : e ?? "";
}
const Be = [...` 	
\r\f \v\uFEFF`];
function Cr(e, t, r) {
  var s = e == null ? "" : "" + e;
  if (t && (s = s ? s + " " + t : t), r) {
    for (var a in r)
      if (r[a])
        s = s ? s + " " + a : a;
      else if (s.length)
        for (var i = a.length, n = 0; (n = s.indexOf(a, n)) >= 0; ) {
          var f = n + i;
          (n === 0 || Be.includes(s[n - 1])) && (f === s.length || Be.includes(s[f])) ? s = (n === 0 ? "" : s.substring(0, n)) + s.substring(f + 1) : n = f;
        }
  }
  return s === "" ? null : s;
}
function Fe(e, t = !1) {
  var r = t ? " !important;" : ";", s = "";
  for (var a in e) {
    var i = e[a];
    i != null && i !== "" && (s += " " + a + ": " + i + r);
  }
  return s;
}
function ae(e) {
  return e[0] !== "-" || e[1] !== "-" ? e.toLowerCase() : e;
}
function $r(e, t) {
  if (t) {
    var r = "", s, a;
    if (Array.isArray(t) ? (s = t[0], a = t[1]) : s = t, e) {
      e = String(e).replaceAll(/\s*\/\*.*?\*\/\s*/g, "").trim();
      var i = !1, n = 0, f = !1, o = [];
      s && o.push(...Object.keys(s).map(ae)), a && o.push(...Object.keys(a).map(ae));
      var l = 0, h = -1;
      const E = e.length;
      for (var d = 0; d < E; d++) {
        var u = e[d];
        if (f ? u === "/" && e[d - 1] === "*" && (f = !1) : i ? i === u && (i = !1) : u === "/" && e[d + 1] === "*" ? f = !0 : u === '"' || u === "'" ? i = u : u === "(" ? n++ : u === ")" && n--, !f && i === !1 && n === 0) {
          if (u === ":" && h === -1)
            h = d;
          else if (u === ";" || d === E - 1) {
            if (h !== -1) {
              var _ = ae(e.substring(l, h).trim());
              if (!o.includes(_)) {
                u !== ";" && d++;
                var v = e.substring(l, d).trim();
                r += " " + v + ";";
              }
            }
            l = d + 1, h = -1;
          }
        }
      }
    }
    return s && (r += Fe(s)), a && (r += Fe(a, !0)), r = r.trim(), r === "" ? null : r;
  }
  return e == null ? null : String(e);
}
function Br(e, t, r, s, a, i) {
  var n = e.__className;
  if (b || n !== r || n === void 0) {
    var f = Cr(r, s, i);
    (!b || f !== e.getAttribute("class")) && (f == null ? e.removeAttribute("class") : t ? e.className = f : e.setAttribute("class", f)), e.__className = r;
  } else if (i && a !== i)
    for (var o in i) {
      var l = !!i[o];
      (a == null || l !== !!a[o]) && e.classList.toggle(o, l);
    }
  return i;
}
function ne(e, t = {}, r, s) {
  for (var a in r) {
    var i = r[a];
    t[a] !== i && (r[a] == null ? e.style.removeProperty(a) : e.style.setProperty(a, i, s));
  }
}
function Fr(e, t, r, s) {
  var a = e.__style;
  if (b || a !== t) {
    var i = $r(t, s);
    (!b || i !== e.getAttribute("style")) && (i == null ? e.removeAttribute("style") : e.style.cssText = i), e.__style = t;
  } else s && (Array.isArray(s) ? (ne(e, r?.[0], s[0]), ne(e, r?.[1], s[1], "important")) : ne(e, r, s));
  return s;
}
function he(e, t, r = !1) {
  if (e.multiple) {
    if (t == null)
      return;
    if (!Yt(t))
      return jt();
    for (var s of e.options)
      s.selected = t.includes(ke(s));
    return;
  }
  for (s of e.options) {
    var a = ke(s);
    if (Ht(a, t)) {
      s.selected = !0;
      return;
    }
  }
  (!r || t !== void 0) && (e.selectedIndex = -1);
}
function kr(e) {
  var t = new MutationObserver(() => {
    he(e, e.__value);
  });
  t.observe(e, {
    // Listen to option element changes
    childList: !0,
    subtree: !0,
    // because of <optgroup>
    // Listen to option element value attribute changes
    // (doesn't get notified of select value changes,
    // because that property is not reflected as an attribute)
    attributes: !0,
    attributeFilter: ["value"]
  }), me(() => {
    t.disconnect();
  });
}
function ke(e) {
  return "__value" in e ? e.__value : e.value;
}
const q = /* @__PURE__ */ Symbol("class"), W = /* @__PURE__ */ Symbol("style"), ut = /* @__PURE__ */ Symbol("is custom element"), ot = /* @__PURE__ */ Symbol("is html");
function xr(e) {
  if (b) {
    var t = !1, r = () => {
      if (!t) {
        if (t = !0, e.hasAttribute("value")) {
          var s = e.value;
          G(e, "value", null), e.value = s;
        }
        if (e.hasAttribute("checked")) {
          var a = e.checked;
          G(e, "checked", null), e.checked = a;
        }
      }
    };
    e.__on_r = r, U(r), Jt();
  }
}
function Ur(e, t) {
  t ? e.hasAttribute("selected") || e.setAttribute("selected", "") : e.removeAttribute("selected");
}
function G(e, t, r, s) {
  var a = lt(e);
  b && (a[t] = e.getAttribute(t), t === "src" || t === "srcset" || t === "href" && e.nodeName === "LINK") || a[t] !== (a[t] = r) && (t === "loading" && (e[Gt] = r), r == null ? e.removeAttribute(t) : typeof r != "string" && ct(e).includes(t) ? e[t] = r : e.setAttribute(t, r));
}
function Vr(e, t, r, s, a = !1, i = !1) {
  if (b && a && e.tagName === "INPUT") {
    var n = (
      /** @type {HTMLInputElement} */
      e
    ), f = n.type === "checkbox" ? "defaultChecked" : "defaultValue";
    f in r || xr(n);
  }
  var o = lt(e), l = o[ut], h = !o[ot];
  let d = b && l;
  d && D(!1);
  var u = t || {}, _ = e.tagName === "OPTION";
  for (var v in t)
    v in r || (r[v] = null);
  r.class ? r.class = Dr(r.class) : (s || r[q]) && (r.class = null), r[W] && (r.style ??= null);
  var E = ct(e);
  for (const g in r) {
    let w = r[g];
    if (_ && g === "value" && w == null) {
      e.value = e.__value = "", u[g] = w;
      continue;
    }
    if (g === "class") {
      var A = e.namespaceURI === "http://www.w3.org/1999/xhtml";
      Br(e, A, w, s, t?.[q], r[q]), u[g] = w, u[q] = r[q];
      continue;
    }
    if (g === "style") {
      Fr(e, w, t?.[W], r[W]), u[g] = w, u[W] = r[W];
      continue;
    }
    var c = u[g];
    if (!(w === c && !(w === void 0 && e.hasAttribute(g)))) {
      u[g] = w;
      var y = g[0] + g[1];
      if (y !== "$$")
        if (y === "on") {
          const N = {}, k = "$$" + g;
          let S = g.slice(2);
          var p = Ar(S);
          if (mr(S) && (S = S.slice(0, -7), N.capture = !0), !p && c) {
            if (w != null) continue;
            e.removeEventListener(S, u[k], N), u[k] = null;
          }
          if (w != null)
            if (p)
              e[`__${S}`] = w, st([S]);
            else {
              let dt = function(ht) {
                u[g].call(this, ht);
              };
              u[k] = rt(S, e, dt, N);
            }
          else p && (e[`__${S}`] = void 0);
        } else if (g === "style")
          G(e, g, w);
        else if (g === "autofocus")
          Xt(
            /** @type {HTMLElement} */
            e,
            !!w
          );
        else if (!l && (g === "__value" || g === "value" && w != null))
          e.value = e.__value = w;
        else if (g === "selected" && _)
          Ur(
            /** @type {HTMLOptionElement} */
            e,
            w
          );
        else {
          var m = g;
          h || (m = Tr(m));
          var j = m === "defaultValue" || m === "defaultChecked";
          if (w == null && !l && !j)
            if (o[g] = null, m === "value" || m === "checked") {
              let N = (
                /** @type {HTMLInputElement} */
                e
              );
              const k = t === void 0;
              if (m === "value") {
                let S = N.defaultValue;
                N.removeAttribute(m), N.defaultValue = S, N.value = N.__value = k ? S : null;
              } else {
                let S = N.defaultChecked;
                N.removeAttribute(m), N.defaultChecked = S, N.checked = k ? S : !1;
              }
            } else
              e.removeAttribute(g);
          else j || E.includes(m) && (l || typeof w != "string") ? (e[m] = w, m in o && (o[m] = Qt)) : typeof w != "function" && G(e, m, w);
        }
    }
  }
  return d && D(!0), u;
}
function os(e, t, r = [], s = [], a = [], i, n = !1, f = !1) {
  Kt(a, r, s, (o) => {
    var l = void 0, h = {}, d = e.nodeName === "SELECT", u = !1;
    if (Ze(() => {
      var v = t(...o.map(I)), E = Vr(
        e,
        l,
        v,
        i,
        n,
        f
      );
      u && d && "value" in v && he(
        /** @type {HTMLSelectElement} */
        e,
        v.value
      );
      for (let c of Object.getOwnPropertySymbols(h))
        v[c] || M(h[c]);
      for (let c of Object.getOwnPropertySymbols(v)) {
        var A = v[c];
        c.description === Zt && (!l || A !== l[c]) && (h[c] && M(h[c]), h[c] = R(() => Lr(e, () => A))), E[c] = A;
      }
      l = E;
    }), d) {
      var _ = (
        /** @type {HTMLSelectElement} */
        e
      );
      Ae(() => {
        he(
          _,
          /** @type {Record<string | symbol, any>} */
          l.value,
          !0
        ), kr(_);
      });
    }
    u = !0;
  });
}
function lt(e) {
  return (
    /** @type {Record<string | symbol, unknown>} **/
    // @ts-expect-error
    e.__attributes ??= {
      [ut]: e.nodeName.includes("-"),
      [ot]: e.namespaceURI === qt
    }
  );
}
var xe = /* @__PURE__ */ new Map();
function ct(e) {
  var t = e.getAttribute("is") || e.nodeName, r = xe.get(t);
  if (r) return r;
  xe.set(t, r = []);
  for (var s, a = e, i = Element.prototype; i !== a; ) {
    s = zt(a);
    for (var n in s)
      s[n].set && r.push(n);
    a = Wt(a);
  }
  return r;
}
function Yr(e = !1) {
  const t = (
    /** @type {ComponentContextLegacy} */
    we
  ), r = t.l.u;
  if (!r) return;
  let s = () => P(t.s);
  if (e) {
    let a = 0, i = (
      /** @type {Record<string, any>} */
      {}
    );
    const n = Je(() => {
      let f = !1;
      const o = t.s;
      for (const l in o)
        o[l] !== i[l] && (i[l] = o[l], f = !0);
      return f && a++, a;
    });
    s = () => I(n);
  }
  r.b.length && er(() => {
    Ue(t, s), Me(r.b);
  }), Le(() => {
    const a = O(() => r.m.map(tr));
    return () => {
      for (const i of a)
        typeof i == "function" && i();
    };
  }), r.a.length && Le(() => {
    Ue(t, s), Me(r.a);
  });
}
function Ue(e, t) {
  if (e.l.s)
    for (const r of e.l.s) I(r);
  t();
}
function jr(e, t, r) {
  e.$$events ||= {}, e.$$events[t] ||= [], e.$$events[t].push(r);
}
function Hr(e) {
  for (var t in e)
    t in this && (this[t] = e[t]);
}
let Q = !1, _e = /* @__PURE__ */ Symbol();
function ls(e, t, r) {
  const s = r[t] ??= {
    store: null,
    source: Xe(void 0),
    unsubscribe: De
  };
  if (s.store !== e && !(_e in r))
    if (s.unsubscribe(), s.store = e ?? null, e == null)
      s.source.v = void 0, s.unsubscribe = De;
    else {
      var a = !0;
      s.unsubscribe = rr(e, (i) => {
        a ? s.source.v = i : Se(s.source, i);
      }), a = !1;
    }
  return e && _e in r ? sr(e) : I(s.source);
}
function cs() {
  const e = {};
  function t() {
    me(() => {
      for (var r in e)
        e[r].unsubscribe();
      Ee(e, _e, {
        enumerable: !1,
        value: !0
      });
    });
  }
  return [e, t];
}
function ds(e, t, r) {
  return e.set(r), t;
}
function qr(e) {
  var t = Q;
  try {
    return Q = !1, [e(), Q];
  } finally {
    Q = t;
  }
}
const Wr = {
  get(e, t) {
    if (!e.exclude.includes(t))
      return I(e.version), t in e.special ? e.special[t]() : e.props[t];
  },
  set(e, t, r) {
    if (!(t in e.special)) {
      var s = L;
      try {
        V(e.parent_effect), e.special[t] = ve(
          {
            get [t]() {
              return e.props[t];
            }
          },
          /** @type {string} */
          t,
          Qe
        );
      } finally {
        V(s);
      }
    }
    return e.special[t](r), Ce(e.version), !0;
  },
  getOwnPropertyDescriptor(e, t) {
    if (!e.exclude.includes(t) && t in e.props)
      return {
        enumerable: !0,
        configurable: !0,
        value: e.props[t]
      };
  },
  deleteProperty(e, t) {
    return e.exclude.includes(t) || (e.exclude.push(t), Ce(e.version)), !0;
  },
  has(e, t) {
    return e.exclude.includes(t) ? !1 : t in e.props;
  },
  ownKeys(e) {
    return Reflect.ownKeys(e.props).filter((t) => !e.exclude.includes(t));
  }
};
function hs(e, t) {
  return new Proxy(
    {
      props: e,
      exclude: t,
      special: {},
      version: pe(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} */
        L
      )
    },
    Wr
  );
}
function ve(e, t, r, s) {
  var a = !dr || (r & hr) !== 0, i = (r & cr) !== 0, n = (r & _r) !== 0, f = (
    /** @type {V} */
    s
  ), o = !0, l = () => (o && (o = !1, f = n ? O(
    /** @type {() => V} */
    s
  ) : (
    /** @type {V} */
    s
  )), f), h;
  if (i) {
    var d = or in e || et in e;
    h = ir(e, t)?.set ?? (d && t in e ? (p) => e[t] = p : void 0);
  }
  var u, _ = !1;
  i ? [u, _] = qr(() => (
    /** @type {V} */
    e[t]
  )) : u = /** @type {V} */
  e[t], u === void 0 && s !== void 0 && (u = l(), h && (a && vr(), h(u)));
  var v;
  if (a ? v = () => {
    var p = (
      /** @type {V} */
      e[t]
    );
    return p === void 0 ? l() : (o = !0, p);
  } : v = () => {
    var p = (
      /** @type {V} */
      e[t]
    );
    return p !== void 0 && (f = /** @type {V} */
    void 0), p === void 0 ? f : p;
  }, a && (r & Qe) === 0)
    return v;
  if (h) {
    var E = e.$$legacy;
    return (
      /** @type {() => V} */
      (function(p, m) {
        return arguments.length > 0 ? ((!a || !m || E || _) && h(m ? v() : p), p) : v();
      })
    );
  }
  var A = !1, c = ((r & lr) !== 0 ? Je : fr)(() => (A = !1, v()));
  i && I(c);
  var y = (
    /** @type {Effect} */
    L
  );
  return (
    /** @type {() => V} */
    (function(p, m) {
      if (arguments.length > 0) {
        const j = m ? I(c) : a && i ? ar(p) : p;
        return Se(c, j), A = !0, f !== void 0 && (f = j), p;
      }
      return ur && A || (y.f & nr) !== 0 ? c.v : I(c);
    })
  );
}
function zr(e) {
  return new Gr(e);
}
class Gr {
  /** @type {any} */
  #e;
  /** @type {Record<string, any>} */
  #t;
  /**
   * @param {ComponentConstructorOptions & {
   *  component: any;
   * }} options
   */
  constructor(t) {
    var r = /* @__PURE__ */ new Map(), s = (i, n) => {
      var f = Xe(n, !1, !1);
      return r.set(i, f), f;
    };
    const a = new Proxy(
      { ...t.props || {}, $$events: {} },
      {
        get(i, n) {
          return I(r.get(n) ?? s(n, Reflect.get(i, n)));
        },
        has(i, n) {
          return n === et ? !0 : (I(r.get(n) ?? s(n, Reflect.get(i, n))), Reflect.has(i, n));
        },
        set(i, n, f) {
          return Se(r.get(n) ?? s(n, f), f), Reflect.set(i, n, f);
        }
      }
    );
    this.#t = (t.hydrate ? Rr : it)(t.component, {
      target: t.target,
      anchor: t.anchor,
      props: a,
      context: t.context,
      intro: t.intro ?? !1,
      recover: t.recover
    }), (!t?.props?.$$host || t.sync === !1) && le(), this.#e = a.$$events;
    for (const i of Object.keys(this.#t))
      i === "$set" || i === "$destroy" || i === "$on" || Ee(this, i, {
        get() {
          return this.#t[i];
        },
        /** @param {any} value */
        set(n) {
          this.#t[i] = n;
        },
        enumerable: !0
      });
    this.#t.$set = /** @param {Record<string, any>} next */
    (i) => {
      Object.assign(a, i);
    }, this.#t.$destroy = () => {
      Pr(this.#t);
    };
  }
  /** @param {Record<string, any>} props */
  $set(t) {
    this.#t.$set(t);
  }
  /**
   * @param {string} event
   * @param {(...args: any[]) => any} callback
   * @returns {any}
   */
  $on(t, r) {
    this.#e[t] = this.#e[t] || [];
    const s = (...a) => r.call(this, ...a);
    return this.#e[t].push(s), () => {
      this.#e[t] = this.#e[t].filter(
        /** @param {any} fn */
        (a) => a !== s
      );
    };
  }
  $destroy() {
    this.#t.$destroy();
  }
}
const Kr = "5";
typeof window < "u" && ((window.__svelte ??= {}).v ??= /* @__PURE__ */ new Set()).add(Kr);
pr();
function Ve(e) {
  return e?.replace(/^ipfs:\/\/ipfs\//, "https://ipfs.io/ipfs/")?.replace(/^ipfs:\/\//, "https://ipfs.io/ipfs/");
}
var Zr = /* @__PURE__ */ Z('<img alt="Asset" class="crtw-w-full crtw-h-full crtw-object-cover"/>'), Jr = /* @__PURE__ */ Z('<p class="crtw-text-xl crtw-font-bold crtw-text-gray-900"> <span class="crtw-text-[10px] crtw-text-gray-400 crtw-align-top crtw-uppercase">usd</span></p>'), Xr = /* @__PURE__ */ Z('<h3 class="crtw-font-bold crtw-text-gray-800"> </h3>'), Qr = /* @__PURE__ */ Z('<p class="crtw-text-xs crtw-text-gray-500 crtw-leading-tight"> </p>'), es = /* @__PURE__ */ Z('<div role="button" tabindex="0" class="crtw-flex crtw-flex-1 crtw-max-w-[120px] crtw-cursor-pointer"><div><div class="crtx-flex crtw-h-[120px] crtw-aspect-square crtw-bg-[#B4A7D6] crtw-rounded-sm crtw-mb-4 crtw-overflow-hidden"><!></div> <div class="crtw-space-y-1"><!> <!> <!></div></div></div>');
function ts(e, t) {
  if (new.target) return zr({ component: ts, ...e });
  Ge(t, !1);
  let r = ve(t, "asset", 12), s = ve(t, "onSelect", 12);
  var a = {
    get asset() {
      return r();
    },
    set asset(c) {
      r(c), le();
    },
    get onSelect() {
      return s();
    },
    set onSelect(c) {
      s(c), le();
    },
    $set: Hr,
    $on: (c, y) => jr(t, c, y)
  };
  Yr();
  var i = es();
  i.__click = () => s()(r()), i.__keydown = () => {
  };
  var n = $(i), f = $(n), o = $(f);
  {
    var l = (c) => {
      var y = Zr();
      J((p) => G(y, "src", p), [
        () => (P(Ve), P(r()), O(() => Ve(r().metadata?.image || r().metadata?.image_url)))
      ]), H(c, y);
    };
    X(o, (c) => {
      P(r()), O(() => r().metadata?.image || r().metadata?.image_url) && c(l);
    });
  }
  B(f);
  var h = se(f, 2), d = $(h);
  {
    var u = (c) => {
      var y = Jr(), p = $(y);
      qe(), B(y), J(() => ie(p, `${P(r()), O(() => r().metadata?.price) ?? ""} `)), H(c, y);
    };
    X(d, (c) => {
      P(r()), O(() => r().metadata?.price) && c(u);
    });
  }
  var _ = se(d, 2);
  {
    var v = (c) => {
      var y = Xr(), p = $(y, !0);
      B(y), J(() => ie(p, (P(r()), O(() => r().metadata?.name)))), H(c, y);
    };
    X(_, (c) => {
      P(r()), O(() => r().metadata?.name) && c(v);
    });
  }
  var E = se(_, 2);
  {
    var A = (c) => {
      var y = Qr(), p = $(y, !0);
      B(y), J(() => ie(p, (P(r()), O(() => r().metadata?.description)))), H(c, y);
    };
    X(E, (c) => {
      P(r()), O(() => r().metadata?.description) && c(A);
    });
  }
  return B(h), B(n), B(i), H(e, i), Ke(a);
}
st(["click", "keydown"]);
export {
  Dr as A,
  nt as B,
  q as C,
  ds as D,
  Ve as E,
  ts as F,
  as as a,
  H as b,
  zr as c,
  jr as d,
  ss as e,
  Z as f,
  ns as g,
  Yr as h,
  X as i,
  Fr as j,
  Br as k,
  hs as l,
  us as m,
  cs as n,
  ls as o,
  ve as p,
  fs as q,
  ie as r,
  G as s,
  is as t,
  Hr as u,
  xr as v,
  Ur as w,
  os as x,
  C as y,
  Or as z
};
//# sourceMappingURL=AssetItem-BxjLUzNd.js.map
