import { c as me, m as at, p as N, f as Z, i as re, k as $e, e as Ue, b as U, d as Te, u as fe, t as Ce, o as le, h as we, s as it, g as Se, a as xe, j as st, n as rt } from "./AssetItem-CFsdMEwW.js";
import { a as Fe, o as pt } from "./index-client-DJaMHbvZ.js";
import { v as be, x as q, y as j, z as de, t as ve, n as F, m as B, bO as J, o as oe, G as C, w as O, p as Pe, A as Y, I as t, Y as ce, D as K, C as ot, r as ue, bP as De, N as Q, P as X, M as G, bD as ze, O as Ae, L as ke, bQ as We, bz as Le, a3 as qe, a1 as je, bR as Ye, Q as ne, S as ie, T as se, bS as ut, bT as Ve, E as Be, F as ye, a0 as Ge, a2 as pe, a4 as Ze, bU as Ie, bV as _e, bI as yt, bW as lt, bH as dt } from "./index-BxjwuJ6T.js";
import { a as ct } from "./App-pmcYlKkW.js";
import { L as Oe } from "./Loader-BMEbL3GG.js";
import { B as mt } from "./ButtonBack-TLkmy8GZ.js";
import { p as Tt } from "./event-modifiers-D4czZCB6.js";
import { B as He } from "./Button-S2OwL6nP.js";
const ft = "data:image/svg+xml,%3csvg%20xmlns='http://www.w3.org/2000/svg'%20width='22'%20height='22'%20viewBox='0%200%2024%2024'%3e%3cpath%20fill='%23bbb'%20d='M17%209.761v-4.761c0-2.761-2.238-5-5-5-2.763%200-5%202.239-5%205v4.761c-1.827%201.466-3%203.714-3%206.239%200%204.418%203.582%208%208%208s8-3.582%208-8c0-2.525-1.173-4.773-3-6.239zm-8-4.761c0-1.654%201.346-3%203-3s3%201.346%203%203v3.587c-.927-.376-1.938-.587-3-.587s-2.073.211-3%20.587v-3.587zm4%2011.723v2.277h-2v-2.277c-.596-.347-1-.984-1-1.723%200-1.104.896-2%202-2s2%20.896%202%202c0%20.738-.404%201.376-1%201.723z'/%3e%3c/svg%3e";
var bt = Z('<button type="submit"><!></button>');
const vt = {
  hash: "svelte-m3cnza",
  code: ".active.svelte-m3cnza {background-color:#ffff;font-weight:500;color:#000;}.btn-disabled.svelte-m3cnza {pointer-events:none;background-color:#d0d2d5;}"
};
function Ne(d, a) {
  if (new.target) return me({ component: Ne, ...d });
  be(a, !1), at(d, vt);
  let n = N(a, "onClick", 12), c = N(a, "text", 12), T = N(a, "disabled", 12, !1), l = N(a, "isLoading", 12, !1), m = N(a, "isActive", 12, !1);
  var y = {
    get onClick() {
      return n();
    },
    set onClick(p) {
      n(p), F();
    },
    get text() {
      return c();
    },
    set text(p) {
      c(p), F();
    },
    get disabled() {
      return T();
    },
    set disabled(p) {
      T(p), F();
    },
    get isLoading() {
      return l();
    },
    set isLoading(p) {
      l(p), F();
    },
    get isActive() {
      return m();
    },
    set isActive(p) {
      m(p), F();
    },
    $set: fe,
    $on: (p, I) => Te(a, p, I)
  }, w = bt();
  let k;
  var o = q(w);
  {
    var S = (p) => {
      Oe(p, {});
    }, f = (p) => {
      var I = Ce();
      de(() => le(I, c())), U(p, I);
    };
    re(o, (p) => {
      l() ? p(S) : p(f, -1);
    });
  }
  return j(w), de(() => k = $e(w, 1, `crtw-flex crtw-justify-center crtw-items-center crtw-w-full crtw-h-[50px] crtw-cursor-pointer crtw-border crtw-border-gray-300
  crtw-rounded crtw-font-['poppins'] crtw-text-gray-600 svelte-m3cnza`, null, k, {
    "btn-disabled": T() || l(),
    active: m()
  })), Ue("click", w, Tt(function(...p) {
    n()?.apply(this, p);
  })), U(d, w), ve(y);
}
var gt = Z("<div> </div>"), wt = Z("<!> <!>", 1), kt = Z('<div><div class="crtw-text-right crtw-text-[13px] crtw-text-gray-400 crtw-mb-6"><div class="crtw-break-words"> </div> <div> </div></div> <div class="crtw-font-bold crtw-text-xl"> </div> <div class="crtw-flex crtw-justify-between crtw-mb-3 crtw-text-gray-600 crtw-font-bold"><!></div> <div class="crtw-flex crtw-bg-gray-200 crtw-rounded-md crtw-p-px"><!> <!></div> <hr class="crtw-block crtw-border-t-2 crtw-border-gray-200 crtw-w-1/2 crtw-mx-auto crtw-mt-3.5 crtw-mb-[15px]"/> <!> <div class="crtw-flex crtw-w-full crtw-justify-center crtw-items-center"><img alt=""/><span class="crtw-text-sm crtw-text-gray-400 crtw-ml-1">Payments are secure and encrypted</span></div> <div class="crtw-mt-1.5"><!></div></div>');
function Je(d, a) {
  if (new.target) return me({ component: Je, ...d });
  be(a, !1);
  const n = B();
  let c = N(a, "isLoading", 12), T = N(a, "options", 12), { user: l, title: m, subtitle: y, onBackClick: w, isCardDisabled: k } = T(), o = B(k ? J.CREDENZA_BALANCE : J.CREDIT_CARD);
  oe(() => O(T()), () => {
    C(n, T().isCredezaValueDisabled);
  }), Pe();
  var S = {
    get isLoading() {
      return c();
    },
    set isLoading(e) {
      c(e), F();
    },
    get options() {
      return T();
    },
    set options(e) {
      T(e), F();
    },
    $set: fe,
    $on: (e, u) => Te(a, e, u)
  };
  we();
  var f = kt();
  let p;
  var I = q(f), M = q(I), h = q(M, !0);
  j(M);
  var b = Y(M, 2), R = q(b, !0);
  j(b), j(I);
  var x = Y(I, 2), D = q(x, !0);
  j(x);
  var W = Y(x, 2), ee = q(W);
  {
    var H = (e) => {
      var u = gt(), i = q(u, !0);
      j(u), de(() => le(i, y)), U(e, u);
    };
    re(ee, (e) => {
      y && e(H);
    });
  }
  j(W);
  var _ = Y(W, 2), z = q(_);
  {
    let e = ce(() => (t(o), O(J), K(() => t(o) === J.CREDIT_CARD)));
    Ne(z, {
      text: "Credit Card",
      onClick: () => C(o, J.CREDIT_CARD),
      get isActive() {
        return t(e);
      },
      get disabled() {
        return k;
      }
    });
  }
  var te = Y(z, 2);
  {
    let e = ce(() => (t(o), O(J), K(() => t(o) === J.CREDENZA_BALANCE)));
    Ne(te, {
      text: "Credenza Balance",
      onClick: () => C(o, J.CREDENZA_BALANCE),
      get isActive() {
        return t(e);
      },
      get disabled() {
        return t(n);
      }
    });
  }
  j(_);
  var ae = Y(_, 4);
  {
    var v = (e) => {
      var u = wt(), i = ue(u);
      Se(i, a, "card-provider-switch", {});
      var P = Y(i, 2);
      Se(P, a, "credit-card", {}), U(e, u);
    }, s = (e) => {
      var u = xe(), i = ue(u);
      Se(i, a, "cred-balance", {}), U(e, u);
    };
    re(ae, (e) => {
      t(o), O(J), K(() => t(o) === J.CREDIT_CARD) ? e(v) : (t(o), O(J), K(() => t(o) === J.CREDENZA_BALANCE) && e(s, 1));
    });
  }
  var r = Y(ae, 2), A = q(r);
  ot(), j(r);
  var g = Y(r, 2), L = q(g);
  return mt(L, {
    get onClick() {
      return w;
    }
  }), j(g), j(f), de(() => {
    p = $e(f, 1, "cpui-payment crtw-text-left crtw-w-full", null, p, { "crtw-hidden": c() }), le(h, K(() => l?.email || l?.pending?.email || "")), le(R, K(() => l?.phone || l?.pending?.phone || "")), le(D, m), it(A, "src", ft);
  }), U(d, f), ve(S);
}
var Mt = Z('<span class="crtw-text-xs crtw-text-stone-200"> </span>'), ht = Z('<div class="crtw-text-base crtw-mb-1.5">Credit card details</div> <div id="cpui-card-element" class="crtw-border crtw-border-gray-300 crtw-rounded crtw-px-2.5 crtw-py-4 crtw-mb-2.5 crtw-w-full"></div> <div id="card-errors" role="alert"></div> <!> <!>', 1);
function Ke(d, a) {
  if (new.target) return me({ component: Ke, ...d });
  be(a, !1);
  let n = N(a, "options", 12), c = N(a, "isPaymentDisabled", 12), T = N(a, "isLoading", 12), l = N(a, "totalToPay", 12);
  const m = 0.5, y = +l() < m;
  let { isCardFocused: w, onPay: k, currencySymbol: o = "$" } = n();
  var S = {
    get options() {
      return n();
    },
    set options(b) {
      n(b), F();
    },
    get isPaymentDisabled() {
      return c();
    },
    set isPaymentDisabled(b) {
      c(b), F();
    },
    get isLoading() {
      return T();
    },
    set isLoading(b) {
      T(b), F();
    },
    get totalToPay() {
      return l();
    },
    set totalToPay(b) {
      l(b), F();
    },
    $set: fe,
    $on: (b, R) => Te(a, b, R)
  };
  we();
  var f = ht(), p = Y(ue(f), 2), I = Y(p, 4);
  {
    let b = ce(() => y ? `Minimum card payment: ${o}${m}` : `Pay ${o}${l()}`), R = ce(() => c() || y);
    He(I, {
      get text() {
        return t(b);
      },
      get onClick() {
        return k;
      },
      get disabled() {
        return t(R);
      },
      get isLoading() {
        return T();
      },
      set isLoading(x) {
        T(x);
      },
      $$legacy: !0
    });
  }
  var M = Y(I, 2);
  {
    var h = (b) => {
      var R = Mt(), x = q(R);
      j(R), de(() => le(x, `Fee of ${O(n()), K(() => n().feeToApply * 100) ?? ""}% is automatically added.`)), U(b, R);
    };
    re(M, (b) => {
      O(n()), K(() => n().feeToApply) && b(h);
    });
  }
  return de(() => st(p, w ? "border-color: #121e2b" : "")), U(d, f), ve(S);
}
var _t = Z('You do not have enough stored value to make this payment. <span class="crtw-text-black crtw-cursor-pointer" role="button" tabindex="0"> </span>', 1), Ct = Z('<div class="crtw-w-full crtw-text-center crtw-my-5"><div class="crtw-text-3xl crtw-text-black crtw-font-bold"><!></div> <div class="crtw-mb-5 crtw-text-gray-600"><!></div> <!></div>');
function Qe(d, a) {
  if (new.target) return me({ component: Qe, ...d });
  be(a, !1);
  const n = B(), c = B(), T = B(), l = B(), m = B();
  let y = N(a, "options", 12), { credAlias: w, onPay: k, onGetCred: o } = y();
  oe(() => O(y()), () => {
    C(n, y().isLoading);
  }), oe(() => O(y()), () => {
    C(c, y().isPaymentDisabled);
  }), oe(() => O(y()), () => {
    C(T, y().formattedBalance);
  }), oe(() => O(y()), () => {
    C(l, y().totalToPay);
  }), oe(() => O(y()), () => {
    C(m, y().balance);
  }), Pe();
  var S = {
    get options() {
      return y();
    },
    set options(_) {
      y(_), F();
    },
    $set: fe,
    $on: (_, z) => Te(a, _, z)
  };
  we();
  var f = Ct(), p = q(f), I = q(p);
  {
    var M = (_) => {
      var z = Ce("INSUFFICIENT FUNDS");
      U(_, z);
    }, h = De(() => (t(l), t(m), K(() => Number(t(l)) > t(m)))), b = (_) => {
      var z = Ce();
      de(() => le(z, `${t(T) ?? ""} ${w ?? ""}`)), U(_, z);
    };
    re(I, (_) => {
      t(h) ? _(M) : _(b, -1);
    });
  }
  j(p);
  var R = Y(p, 2), x = q(R);
  {
    var D = (_) => {
      var z = _t(), te = Y(ue(z)), ae = q(te);
      j(te), de(() => le(ae, `Click to get some ${w ?? ""}`)), Ue("click", te, o), U(_, z);
    }, W = De(() => (t(l), t(m), K(() => Number(t(l)) > t(m)))), ee = (_) => {
      var z = Ce("Your balance after purchase");
      U(_, z);
    };
    re(x, (_) => {
      t(W) ? _(D) : _(ee, -1);
    });
  }
  j(R);
  var H = Y(R, 2);
  {
    let _ = ce(() => `Pay ${t(l)} ${w}`);
    He(H, {
      get text() {
        return t(_);
      },
      get onClick() {
        return k;
      },
      get disabled() {
        return t(c);
      },
      get isLoading() {
        return t(n);
      }
    });
  }
  return j(f), U(d, f), ve(S);
}
var It = Z('<div id="ctui-wallet-pay" class="crtw-w-full crtw-my-4" style="dispay: none;"><div id="ctui-payment-request-button"></div></div>');
function Xe(d, a) {
  if (new.target) return me({ component: Xe, ...d });
  be(a, !1);
  var n = this && this.__awaiter || function(o, S, f, p) {
    function I(M) {
      return M instanceof f ? M : new f(function(h) {
        h(M);
      });
    }
    return new (f || (f = Promise))(function(M, h) {
      function b(D) {
        try {
          x(p.next(D));
        } catch (W) {
          h(W);
        }
      }
      function R(D) {
        try {
          x(p.throw(D));
        } catch (W) {
          h(W);
        }
      }
      function x(D) {
        D.done ? M(D.value) : I(D.value).then(b, R);
      }
      x((p = p.apply(o, S || [])).next());
    });
  };
  let c = N(a, "doPayment", 12), T = N(a, "stripe", 12), l = N(a, "stripeElements", 12), m = N(a, "priceCents", 12), y = N(a, "isLoading", 12);
  Fe(() => n(void 0, void 0, void 0, function* () {
    const o = T().paymentRequest({
      country: "US",
      currency: "usd",
      total: {
        label: "Apple/Google payment",
        amount: Math.ceil(m())
      },
      requestPayerName: !0,
      requestPayerEmail: !0
    });
    if (!(yield o.canMakePayment())) return;
    const f = document.getElementById("ctui-wallet-pay");
    f && (f.style.display = "crtw-block"), l().create("paymentRequestButton", {
      paymentRequest: o,
      style: { paymentRequestButton: { height: "48px" } }
    }).mount("#ctui-payment-request-button"), o.on("token", (I) => n(void 0, void 0, void 0, function* () {
      y(!0);
      try {
        yield c()(I.token.id), yield I.complete("success");
      } catch (M) {
        yield I.complete("error"), Q(X.ERROR, { error: M });
      }
      y(!1);
    }));
  }));
  var w = {
    get doPayment() {
      return c();
    },
    set doPayment(o) {
      c(o), F();
    },
    get stripe() {
      return T();
    },
    set stripe(o) {
      T(o), F();
    },
    get stripeElements() {
      return l();
    },
    set stripeElements(o) {
      l(o), F();
    },
    get priceCents() {
      return m();
    },
    set priceCents(o) {
      m(o), F();
    },
    get isLoading() {
      return y();
    },
    set isLoading(o) {
      y(o), F();
    },
    $set: fe,
    $on: (o, S) => Te(a, o, S)
  };
  we();
  var k = It();
  return U(d, k), ve(w);
}
const xt = {
  base: {
    color: "#121e2b",
    fontSize: "12px",
    "::placeholder": {
      color: "#d9d9d9"
    }
  },
  invalid: {
    color: "#fa755a"
  }
}, Pt = (d) => new Promise((a, n) => {
  const c = document.createElement("script");
  c.src = d, document.body.appendChild(c), c.addEventListener("load", () => a(c)), c.addEventListener("error", () => n(c));
}), Zt = async (d, a, n = 5) => {
  let c = 0;
  for (; c < n; ) {
    const T = await fetch(`${d}/orders/completed/${a}`, {
      headers: {
        "Content-Type": "application/json",
        Authorization: `Bearer ${G(ze)}`
      },
      method: "GET"
    });
    if (T.status === 204) {
      if (c++, c < n)
        continue;
      throw new Error("No content received after multiple attempts");
    }
    if (!T.ok) throw new Error("Failed to get order details");
    const l = await T.json();
    if (l.status === "PAYMENT_ERROR")
      throw new Error(`Order failed: ${l.status}`);
    return l;
  }
}, At = (d, a) => {
  if (d.every((n) => n === null))
    throw new Error(`All transactions failed. 
${a}`);
}, Lt = (d) => {
  const a = d.filter((n) => n.error).map(
    (n) => `Name: ${n.metadata?.name || n.directive.resource_id}, reason: ${n.error}`
  ).join(`
`);
  if (d?.every((n) => n.status === "ERROR"))
    throw new Error("All transactions failed.}");
  return a;
}, Et = async ({
  hash: d,
  stripeChargeId: a,
  title: n,
  subtitle: c,
  amount: T,
  currency: l
}) => {
  const { credenza: m, receiptTarget: y, clientId: w } = G(ke), k = y ? y.filter(
    (S) => {
      const f = G(Le);
      if (f)
        return f[S];
    }
  ) : [ut.EMAIL];
  let o = 0;
  for (const S of k) {
    const f = await fetch(`${m.evmApiUrl}/contracts/receipt`, {
      method: "POST",
      body: JSON.stringify({
        ...d ? { tx: d } : { charge_id: a },
        ...T ? { amount: T } : {},
        ...l ? { currency: l } : {},
        target: S,
        title: n,
        subtitle: c,
        source: Ve(w).name
      }),
      headers: {
        Authorization: `Bearer ${G(ze)}`,
        "Content-Type": "application/json"
      }
    });
    f.ok ? o++ : console.warn(`Failed to send receipt to ${S}:`, f.status);
  }
  return o > 0;
}, Rt = async (d, a, n) => {
  const { toastAlert: c } = G(Ae), T = G(ke), l = Lt(d.items);
  (n.tokens?.length || n.memberships?.length) && At(d.chain_txs, l), Q(X.PAYMENT, {
    type: We.CARD,
    results: { ...d, tokens: n.tokens, memberships: n.memberships, licenses: n.licenses }
  }), c("Your payment was successful"), Q(X.RECHECK_BALANCE, d.chain_txs);
  const m = G(Le);
  m && qe.track("cp_payment_fiat", {
    $email: m.email,
    $phone: m.phone,
    chain: T.chainId,
    clientId: T.clientId,
    address: await je(),
    location: window.location.href,
    tokens: n?.tokens,
    memberships: n?.memberships,
    licenses: n?.licenses,
    total: a / 100,
    description: (n?.title ?? "") + `(${n?.subtitle ?? ""})`
  }), await Ye(), a === 0 && ne.set({ subtitle: "Your claim was successful!", receipt: !1 }), l && ne.set({
    title: "Done!",
    subtitle: "Your payment was partly successful",
    orders: d.items
  }), ie.set(se.PAYMENT_RESULT);
};
var St = Z("<!> <!>", 1);
function et(d, a) {
  if (new.target) return me({ component: et, ...d });
  be(a, !1);
  const n = () => ye(ne, "$pageOptsStore", c), [c, T] = Be(), l = B(), m = B();
  var y = this && this.__awaiter || function(v, s, r, A) {
    function g(L) {
      return L instanceof r ? L : new r(function(e) {
        e(L);
      });
    }
    return new (r || (r = Promise))(function(L, e) {
      function u($) {
        try {
          P(A.next($));
        } catch (E) {
          e(E);
        }
      }
      function i($) {
        try {
          P(A.throw($));
        } catch (E) {
          e(E);
        }
      }
      function P($) {
        $.done ? L($.value) : g($.value).then(u, i);
      }
      P((A = A.apply(v, s || [])).next());
    });
  };
  let w = N(a, "priceCents", 12), k = N(a, "isLoading", 12), o = N(a, "isPriceLoading", 12), S = N(a, "feeToApply", 12, 0);
  const { toastAlert: f } = G(Ae), p = G(ke);
  let I, M = B(), h = B(), b, R = B(), x = B(!1);
  Fe(() => y(void 0, void 0, void 0, function* () {
    var v;
    try {
      if (!I) {
        if (!window.Stripe && (yield Pt("https://js.stripe.com/v3/"), !window.Stripe))
          throw {};
        I = window.Stripe;
      }
    } catch {
      return console.log("Please include stripe to use payments.");
    }
    if (t(M)) return;
    const s = Ve(p.clientId).name;
    C(M, I((v = p.stripe.pk[s]) !== null && v !== void 0 ? v : p.stripe.pk.DEFAULT)), C(h, t(M).elements()), b = t(h).create("card", { style: xt }), b.mount("#cpui-card-element"), b.on("change", (r) => {
      C(R, r.complete && !r.error);
    }), b.on("focus", () => C(x, !0)), b.on("blur", () => C(x, !1));
  }));
  const D = () => y(void 0, void 0, void 0, function* () {
    try {
      if (!t(R)) return;
      k(!0);
      const v = yield t(M).createToken(b);
      if (v.error) throw v.error;
      yield W(v.token.id);
    } catch (v) {
      Q(X.ERROR, { error: v });
    }
    k(!1);
  }), W = (v) => y(void 0, void 0, void 0, function* () {
    try {
      const { processPayment: s } = yield import("./Stripe.service-wIEg9mCi.js"), r = yield s(v);
      yield Rt(r, w(), n());
    } catch (s) {
      f(`Payment error: ${s.message || s}`, "failure"), ne.set({ errorMessage: s.message || s }), ie.set(se.ERROR), Q(X.ERROR, { error: s });
    }
  });
  oe(() => O(w()), () => {
    C(l, (Math.ceil(w()) / 100).toFixed(2));
  }), oe(
    () => (t(R), O(k()), O(o())),
    () => {
      C(m, !t(R) || k() || o());
    }
  ), Pe();
  var ee = {
    get priceCents() {
      return w();
    },
    set priceCents(v) {
      w(v), F();
    },
    get isLoading() {
      return k();
    },
    set isLoading(v) {
      k(v), F();
    },
    get isPriceLoading() {
      return o();
    },
    set isPriceLoading(v) {
      o(v), F();
    },
    get feeToApply() {
      return S();
    },
    set feeToApply(v) {
      S(v), F();
    },
    $set: fe,
    $on: (v, s) => Te(a, v, s)
  };
  we();
  var H = St(), _ = ue(H);
  {
    let v = ce(() => ({
      isCardFocused: t(x),
      onPay: D,
      feeToApply: S()
    }));
    Ke(_, {
      get options() {
        return t(v);
      },
      get isPaymentDisabled() {
        return t(m);
      },
      set isPaymentDisabled(s) {
        C(m, s);
      },
      get isLoading() {
        return k();
      },
      set isLoading(s) {
        k(s);
      },
      get totalToPay() {
        return t(l);
      },
      set totalToPay(s) {
        C(l, s);
      },
      $$legacy: !0
    });
  }
  var z = Y(_, 2);
  {
    var te = (v) => {
      Xe(v, {
        doPayment: W,
        get stripe() {
          return t(M);
        },
        get stripeElements() {
          return t(h);
        },
        get priceCents() {
          return w();
        },
        get isLoading() {
          return k();
        },
        set isLoading(s) {
          k(s);
        },
        $$legacy: !0
      });
    };
    re(z, (v) => {
      t(M) && t(h) && v(te);
    });
  }
  U(d, H);
  var ae = ve(ee);
  return T(), ae;
}
const Nt = /* @__PURE__ */ JSON.parse('[{"inputs":[{"internalType":"string","name":"name","type":"string"},{"internalType":"string","name":"symbol","type":"string"}],"stateMutability":"nonpayable","type":"constructor"},{"inputs":[],"name":"InvalidShortString","type":"error"},{"inputs":[{"internalType":"string","name":"str","type":"string"}],"name":"StringTooLong","type":"error"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"owner","type":"address"},{"indexed":true,"internalType":"address","name":"approved","type":"address"},{"indexed":true,"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"Approval","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"owner","type":"address"},{"indexed":true,"internalType":"address","name":"operator","type":"address"},{"indexed":false,"internalType":"bool","name":"approved","type":"bool"}],"name":"ApprovalForAll","type":"event"},{"anonymous":false,"inputs":[],"name":"EIP712DomainChanged","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"buyer","type":"address"},{"indexed":true,"internalType":"uint256","name":"contentNftId","type":"uint256"},{"indexed":false,"internalType":"enum ContentNftTypes.LicenseType","name":"licenseType","type":"uint8"},{"indexed":false,"internalType":"uint256","name":"priceFiat","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"priceEther","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"priceToken","type":"uint256"},{"indexed":false,"internalType":"address","name":"currencyTokenContract","type":"address"}],"name":"LicenseBought","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"buyer","type":"address"},{"indexed":true,"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"Redeemed","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"from","type":"address"},{"indexed":true,"internalType":"address","name":"to","type":"address"},{"indexed":true,"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"Transfer","type":"event"},{"inputs":[{"internalType":"address","name":"contractAddress","type":"address"}],"name":"addAvailableCurrencyTokenContract","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"newOwner","type":"address"}],"name":"addOwner","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"approve","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"owner","type":"address"}],"name":"balanceOf","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"contentTokenId","type":"uint256"},{"internalType":"address","name":"recipient","type":"address"},{"internalType":"enum ContentNftTypes.LicenseType","name":"licenseType","type":"uint8"}],"name":"buyLicenseWithEther","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"payable","type":"function"},{"inputs":[{"internalType":"uint256","name":"contentTokenId","type":"uint256"},{"internalType":"address","name":"recipient","type":"address"},{"internalType":"enum ContentNftTypes.LicenseType","name":"licenseType","type":"uint8"}],"name":"buyLicenseWithToken","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"contentTokenId","type":"uint256"},{"internalType":"address","name":"recipient","type":"address"},{"internalType":"address","name":"currencyTokenContract","type":"address"},{"internalType":"enum ContentNftTypes.LicenseType","name":"licenseType","type":"uint8"}],"name":"buyLicenseWithToken","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_tokenId","type":"uint256"},{"internalType":"uint256","name":"_requestedAmount","type":"uint256"},{"internalType":"address","name":"_recipient","type":"address"}],"name":"buyWithEther","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_tokenId","type":"uint256"},{"internalType":"uint256","name":"_requestedAmount","type":"uint256"},{"internalType":"address","name":"_recipient","type":"address"},{"internalType":"address","name":"_currencyTokenContract","type":"address"}],"name":"buyWithToken","outputs":[],"stateMutability":"pure","type":"function"},{"inputs":[{"internalType":"uint256","name":"_tokenId","type":"uint256"},{"internalType":"uint256","name":"_requestedAmount","type":"uint256"},{"internalType":"address","name":"_recipient","type":"address"}],"name":"buyWithToken","outputs":[],"stateMutability":"pure","type":"function"},{"inputs":[],"name":"clearOwners","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"contentNftContractAddress","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"eip712Domain","outputs":[{"internalType":"bytes1","name":"fields","type":"bytes1"},{"internalType":"string","name":"name","type":"string"},{"internalType":"string","name":"version","type":"string"},{"internalType":"uint256","name":"chainId","type":"uint256"},{"internalType":"address","name":"verifyingContract","type":"address"},{"internalType":"bytes32","name":"salt","type":"bytes32"},{"internalType":"uint256[]","name":"extensions","type":"uint256[]"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"getApproved","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getAvailableCurrencyTokenContractsList","outputs":[{"internalType":"address[]","name":"","type":"address[]"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getBeneficiaryAddress","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getDefaultCurrencyTokenContract","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getDescription","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getOwners","outputs":[{"internalType":"address[]","name":"","type":"address[]"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"id","type":"uint256"}],"name":"getPriceEther","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"id","type":"uint256"}],"name":"getPriceFiat","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"currencyContract","type":"address"},{"internalType":"uint256","name":"id","type":"uint256"}],"name":"getPriceToken","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"id","type":"uint256"}],"name":"getPriceToken","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"getTokenLicenseContentNftId","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"getTokenLicenseExpiresAt","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"getTokenLicenseType","outputs":[{"internalType":"enum ContentNftTypes.LicenseType","name":"","type":"uint8"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getTrustedForwarder","outputs":[{"internalType":"address","name":"forwarder","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getVersion","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"pure","type":"function"},{"inputs":[],"name":"image","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"owner","type":"address"},{"internalType":"address","name":"operator","type":"address"}],"name":"isApprovedForAll","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"contractAddress","type":"address"}],"name":"isAvailableCurrencyTokenContract","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"addr","type":"address"}],"name":"isOwner","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"forwarder","type":"address"}],"name":"isTrustedForwarder","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"recipient","type":"address"},{"internalType":"string","name":"tokenURI","type":"string"},{"internalType":"enum ContentNftTypes.LicenseType","name":"licenseType","type":"uint8"},{"internalType":"uint256","name":"contentNftId","type":"uint256"},{"internalType":"uint256","name":"expiresAt","type":"uint256"}],"name":"mint","outputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"recipient","type":"address"},{"internalType":"string","name":"tokenURI","type":"string"}],"name":"mint","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"recipient","type":"address"},{"internalType":"uint256","name":"amount","type":"uint256"}],"name":"mintBatch","outputs":[{"internalType":"uint256[]","name":"arr","type":"uint256[]"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"recipient","type":"address"},{"internalType":"uint256","name":"amount","type":"uint256"},{"internalType":"enum ContentNftTypes.LicenseType","name":"licenseType","type":"uint8"},{"internalType":"uint256","name":"contentNftId","type":"uint256"},{"internalType":"uint256","name":"expiresAt","type":"uint256"}],"name":"mintBatch","outputs":[{"internalType":"uint256[]","name":"arr","type":"uint256[]"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"name","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"","type":"uint256"}],"name":"nonceUsed","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"ownerOf","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"recipient","type":"address"},{"components":[{"internalType":"uint256","name":"nonce","type":"uint256"},{"internalType":"uint256","name":"price","type":"uint256"},{"internalType":"uint256","name":"priceToken","type":"uint256"},{"internalType":"uint256","name":"priceFiat","type":"uint256"},{"internalType":"address","name":"targetAddress","type":"address"},{"internalType":"uint256","name":"contentNftId","type":"uint256"},{"internalType":"enum ContentNftTypes.LicenseType","name":"licenseType","type":"uint8"},{"internalType":"uint256","name":"expiresAt","type":"uint256"},{"internalType":"string","name":"uri","type":"string"}],"internalType":"struct LicenseNftContract.LicenseNFTVoucher","name":"voucher","type":"tuple"},{"internalType":"bytes","name":"signature","type":"bytes"}],"name":"redeem","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"payable","type":"function"},{"inputs":[{"internalType":"address","name":"contractAddress","type":"address"}],"name":"removeAvailableCurrencyTokenContract","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"owner","type":"address"}],"name":"removeOwner","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"from","type":"address"},{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"safeTransferFrom","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"from","type":"address"},{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256","name":"tokenId","type":"uint256"},{"internalType":"bytes","name":"data","type":"bytes"}],"name":"safeTransferFrom","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"operator","type":"address"},{"internalType":"bool","name":"approved","type":"bool"}],"name":"setApprovalForAll","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"string","name":"uri","type":"string"}],"name":"setBaseUri","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address payable","name":"addr","type":"address"}],"name":"setBeneficiaryAddress","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"contractAddress","type":"address"}],"name":"setContentNftContractAddress","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"tokenContract","type":"address"}],"name":"setDefaultCurrencyTokenContractAddress","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"string","name":"description","type":"string"}],"name":"setDescription","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"string","name":"newImage","type":"string"}],"name":"setImage","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"id","type":"uint256"},{"internalType":"uint256","name":"price","type":"uint256"}],"name":"setPriceEther","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"id","type":"uint256"},{"internalType":"uint256","name":"price","type":"uint256"}],"name":"setPriceFiat","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"id","type":"uint256"},{"internalType":"uint256","name":"price","type":"uint256"}],"name":"setPriceToken","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"currencyContract","type":"address"},{"internalType":"uint256","name":"id","type":"uint256"},{"internalType":"uint256","name":"price","type":"uint256"}],"name":"setPriceToken","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"string","name":"newSymbol","type":"string"}],"name":"setSymbol","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"},{"internalType":"string","name":"_tokenURI","type":"string"}],"name":"setTokenURI","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"},{"internalType":"uint256","name":"index","type":"uint256"},{"internalType":"string","name":"_tokenURI","type":"string"}],"name":"setTokenURIByIndex","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_forwarder","type":"address"}],"name":"setTrustedForwarder","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes4","name":"interfaceId","type":"bytes4"}],"name":"supportsInterface","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"symbol","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"index","type":"uint256"}],"name":"tokenByIndex","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"owner","type":"address"},{"internalType":"uint256","name":"index","type":"uint256"}],"name":"tokenOfOwnerByIndex","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"tokenURI","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"},{"internalType":"uint256","name":"index","type":"uint256"}],"name":"tokenURIByIndex","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"totalSupply","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"from","type":"address"},{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"transferFrom","outputs":[],"stateMutability":"nonpayable","type":"function"}]');
var Ft = Z('<div class="crtw-w-full crtw-justify-items-center crtw-my-5"><!></div>');
function tt(d, a) {
  if (new.target) return me({ component: tt, ...d });
  be(a, !1);
  const n = () => ye(ne, "$pageOptsStore", T), c = () => ye(Ze, "$clientPublicStore", T), [T, l] = Be();
  var m = this && this.__awaiter || function(e, u, i, P) {
    function $(E) {
      return E instanceof i ? E : new i(function(V) {
        V(E);
      });
    }
    return new (i || (i = Promise))(function(E, V) {
      function Me(ge) {
        try {
          Ee(P.next(ge));
        } catch (Re) {
          V(Re);
        }
      }
      function he(ge) {
        try {
          Ee(P.throw(ge));
        } catch (Re) {
          V(Re);
        }
      }
      function Ee(ge) {
        ge.done ? E(ge.value) : $(ge.value).then(Me, he);
      }
      Ee((P = P.apply(e, u || [])).next());
    });
  };
  let y = N(a, "totalPriceToken", 12), w = N(a, "isLoading", 12), k = N(a, "isPriceLoading", 12), o = N(a, "pricesByToken", 12);
  const { getCREDContract: S, toastAlert: f } = G(Ae), { chainId: p, clientId: I } = G(ke);
  let M = B(!1), h = B(BigInt(0)), b = B(), R = "", x, D = B(), W, ee, H;
  const _ = (e, u, i) => m(void 0, void 0, void 0, function* () {
    f(`<a href="${yt(u.hash)}" target="_blank">Purchase TX #${e}</a> was created`), Q(X.PAYMENT, { type: We.ERC20, data: u }), Q(X.RECHECK_BALANCE), yield Et({
      hash: u.hash,
      title: n().title,
      subtitle: n().subtitle,
      currency: "CRED",
      amount: +pe.formatUnits(i, t(D))
    }), Q(X.RECEIPT, { hash: u.hash });
  }), z = (e, u) => m(void 0, void 0, void 0, function* () {
    try {
      const { credenzaSellableMinAbi: i } = yield import("./abi-DIVtyi6o.js"), P = new pe.Contract(e.contractAddress, i, ee), $ = e.tokenId || e.membershipTokenId || Ie, E = o()[`${e.contractAddress}/${$}`], V = yield x.approve.populateTransaction(yield P.getAddress(), E);
      yield _e(V, x);
      const Me = yield P.buyWithToken.populateTransaction($, e.amount || 1, W), he = yield _e(Me, P);
      yield _(u, he, E);
    } catch (i) {
      f(`Payment error: ${i.message || i}`, "failure"), ne.set({ errorMessage: i.message }), ie.set(se.ERROR), Q(X.ERROR, { error: i });
    }
  }), te = (e, u) => m(void 0, void 0, void 0, function* () {
    if (e.licenseContractAddress)
      try {
        const i = new pe.Contract(e.licenseContractAddress, Nt, ee), P = o()[`${e.contractAddress}/${e.contentTokenId}`], $ = yield x.approve.populateTransaction(yield i.getAddress(), P);
        yield _e($, x), yield new Promise((he) => setTimeout(he, 3e3));
        const E = i.interface.getFunction("buyLicenseWithToken", ["uint", "address", "uint"]);
        if (!E) throw new Error("buyLicenseWithToken function not found");
        const V = yield i[E.format()].populateTransaction(e.contentTokenId, W, e.licenseType), Me = yield _e(V, i);
        yield _(u, Me, P);
      } catch (i) {
        f(`Payment error: ${i.message || i}`, "failure"), ne.set({ errorMessage: i.message }), ie.set(se.ERROR), Q(X.ERROR, { error: i });
      }
  }), ae = () => m(void 0, void 0, void 0, function* () {
    var e, u;
    try {
      if (BigInt(y()) > t(h)) return;
      w(!0);
      const i = [
        ...n().tokens || [],
        ...n().memberships || []
      ].map((E, V) => z(E, V + 1)), P = [...n().licenses || []].map((E, V) => te(E, V + 1));
      yield Promise.all([
        ...i,
        ...P
      ]);
      const $ = G(Le);
      $ && qe.track("cp_payment_stored_value", {
        $email: $.email,
        $phone: $.phone,
        chain: p,
        clientId: I,
        address: W,
        location: window.location.href,
        tokens: n().tokens,
        memberships: n().memberships,
        total: y(),
        description: ((e = n() === null || n() === void 0 ? void 0 : n().title) !== null && e !== void 0 ? e : "") + `(${(u = n() === null || n() === void 0 ? void 0 : n().subtitle) !== null && u !== void 0 ? u : ""})`
      }), yield Ye(), y() === 0 && ne.set({ subtitle: "Your claim was successful!", receipt: !1 }), ie.set(se.PAYMENT_RESULT);
    } catch (i) {
      f(`Payment error: ${i.message || i}`, "failure"), ne.set({ errorMessage: i.message }), ie.set(se.ERROR), Q(X.ERROR, { error: i });
    } finally {
      w(!1);
    }
  });
  Fe(() => m(void 0, void 0, void 0, function* () {
    try {
      C(M, !0), H = yield S();
      const e = G(Ge);
      if (!e) return;
      ee = yield e.getSigner(), x = H.contract, C(D, H.decimals), [W, R] = yield Promise.all([je(), x.symbol()]), C(h, yield x.balanceOf(W)), C(b, `${pe.formatUnits(BigInt(t(h)) - BigInt(y()), t(D))}`);
    } catch (e) {
      console.log(e);
    } finally {
      C(M, !1);
    }
  }));
  var v = {
    get totalPriceToken() {
      return y();
    },
    set totalPriceToken(e) {
      y(e), F();
    },
    get isLoading() {
      return w();
    },
    set isLoading(e) {
      w(e), F();
    },
    get isPriceLoading() {
      return k();
    },
    set isPriceLoading(e) {
      k(e), F();
    },
    get pricesByToken() {
      return o();
    },
    set pricesByToken(e) {
      o(e), F();
    },
    $set: fe,
    $on: (e, u) => Te(a, e, u)
  };
  we();
  var s = xe(), r = ue(s);
  {
    var A = (e) => {
      var u = Ft(), i = q(u);
      Oe(i, {}), j(u), U(e, u);
    }, g = (e) => {
      {
        let u = ce(() => (t(b), O(pe), t(h), t(D), c(), O(ie), O(se), O(y()), O(w()), O(k()), K(() => ({
          formattedBalance: t(b),
          balance: Number((+pe.formatUnits(BigInt(t(h)), t(D))).toFixed(2)),
          credAlias: c()?.ui_settings.cred_alias,
          onPay: ae,
          onGetCred: () => ie.set(se.WALLET),
          totalToPay: (+pe.formatUnits(y(), t(D))).toFixed(2),
          isLoading: w(),
          isPaymentDisabled: !Number(t(h)) || BigInt(y()) > t(h) || k()
        }))));
        Qe(e, {
          get options() {
            return t(u);
          }
        });
      }
    };
    re(r, (e) => {
      t(M) ? e(A) : e(g, -1);
    });
  }
  U(d, s);
  var L = ve(v);
  return l(), L;
}
const Bt = /* @__PURE__ */ JSON.parse('[{"inputs":[{"internalType":"string","name":"name","type":"string"},{"internalType":"string","name":"symbol","type":"string"},{"internalType":"uint8","name":"_platformFee","type":"uint8"},{"internalType":"uint8","name":"_defaultAgencyFee","type":"uint8"}],"stateMutability":"nonpayable","type":"constructor"},{"inputs":[],"name":"InvalidShortString","type":"error"},{"inputs":[{"internalType":"string","name":"str","type":"string"}],"name":"StringTooLong","type":"error"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"owner","type":"address"},{"indexed":true,"internalType":"address","name":"approved","type":"address"},{"indexed":true,"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"Approval","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"owner","type":"address"},{"indexed":true,"internalType":"address","name":"operator","type":"address"},{"indexed":false,"internalType":"bool","name":"approved","type":"bool"}],"name":"ApprovalForAll","type":"event"},{"anonymous":false,"inputs":[],"name":"EIP712DomainChanged","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"buyer","type":"address"},{"indexed":true,"internalType":"uint256","name":"tokenId","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"price","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"priceToken","type":"uint256"}],"name":"Redeemed","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"from","type":"address"},{"indexed":true,"internalType":"address","name":"to","type":"address"},{"indexed":true,"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"Transfer","type":"event"},{"inputs":[{"internalType":"address","name":"contractAddress","type":"address"}],"name":"addAvailableCurrencyTokenContract","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"newOwner","type":"address"}],"name":"addOwner","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"approve","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"owner","type":"address"}],"name":"balanceOf","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"burn","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"},{"internalType":"uint256","name":"requestedAmount","type":"uint256"},{"internalType":"address","name":"recipient","type":"address"}],"name":"buyWithEther","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"},{"internalType":"uint256","name":"requestedAmount","type":"uint256"},{"internalType":"address","name":"recipient","type":"address"},{"internalType":"address","name":"currencyTokenContract","type":"address"}],"name":"buyWithToken","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"},{"internalType":"uint256","name":"requestedAmount","type":"uint256"},{"internalType":"address","name":"recipient","type":"address"}],"name":"buyWithToken","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"clearOwners","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"defaultAgencyFee","outputs":[{"internalType":"uint8","name":"","type":"uint8"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"eip712Domain","outputs":[{"internalType":"bytes1","name":"fields","type":"bytes1"},{"internalType":"string","name":"name","type":"string"},{"internalType":"string","name":"version","type":"string"},{"internalType":"uint256","name":"chainId","type":"uint256"},{"internalType":"address","name":"verifyingContract","type":"address"},{"internalType":"bytes32","name":"salt","type":"bytes32"},{"internalType":"uint256[]","name":"extensions","type":"uint256[]"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"getApproved","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getAvailableCurrencyTokenContractsList","outputs":[{"internalType":"address[]","name":"","type":"address[]"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getBeneficiaryAddress","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getDefaultCurrencyTokenContract","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getDescription","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"},{"internalType":"enum ContentNftTypes.LicenseType","name":"licenseType","type":"uint8"}],"name":"getLicensePriceEther","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"},{"internalType":"enum ContentNftTypes.LicenseType","name":"licenseType","type":"uint8"}],"name":"getLicensePriceFiat","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"currencyTokenContract","type":"address"},{"internalType":"uint256","name":"tokenId","type":"uint256"},{"internalType":"enum ContentNftTypes.LicenseType","name":"licenseType","type":"uint8"}],"name":"getLicensePriceToken","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"},{"internalType":"enum ContentNftTypes.LicenseType","name":"licenseType","type":"uint8"}],"name":"getLicensePriceToken","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getOwners","outputs":[{"internalType":"address[]","name":"","type":"address[]"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"id","type":"uint256"}],"name":"getPriceEther","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"id","type":"uint256"}],"name":"getPriceFiat","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"currencyContract","type":"address"},{"internalType":"uint256","name":"id","type":"uint256"}],"name":"getPriceToken","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"id","type":"uint256"}],"name":"getPriceToken","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"getTokenLicenseInfo","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getTrustedForwarder","outputs":[{"internalType":"address","name":"forwarder","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getVersion","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"pure","type":"function"},{"inputs":[],"name":"image","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"owner","type":"address"},{"internalType":"address","name":"operator","type":"address"}],"name":"isApprovedForAll","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"contractAddress","type":"address"}],"name":"isAvailableCurrencyTokenContract","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"addr","type":"address"}],"name":"isOwner","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"forwarder","type":"address"}],"name":"isTrustedForwarder","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"recipient","type":"address"},{"internalType":"string","name":"tokenURI","type":"string"}],"name":"mint","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"recipient","type":"address"},{"internalType":"uint256","name":"amount","type":"uint256"}],"name":"mintBatch","outputs":[{"internalType":"uint256[]","name":"arr","type":"uint256[]"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"recipient","type":"address"},{"internalType":"string","name":"tokenURI","type":"string"},{"internalType":"string","name":"licenseInfo","type":"string"},{"internalType":"uint256","name":"fullLicensePriceFiat","type":"uint256"},{"internalType":"uint256","name":"fullLicensePriceToken","type":"uint256"},{"internalType":"uint256","name":"fullLicensePriceEther","type":"uint256"},{"internalType":"uint256","name":"timeLicensePriceFiat","type":"uint256"},{"internalType":"uint256","name":"timeLicensePriceToken","type":"uint256"},{"internalType":"uint256","name":"timeLicensePriceEther","type":"uint256"},{"internalType":"uint256","name":"oneTimeLicensePriceFiat","type":"uint256"},{"internalType":"uint256","name":"oneTimeLicensePriceToken","type":"uint256"},{"internalType":"uint256","name":"oneTimeLicensePriceEther","type":"uint256"}],"name":"mintWithPrices","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"name","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"","type":"uint256"}],"name":"nonceUsed","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"ownerOf","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"platformAddress","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"platformFee","outputs":[{"internalType":"uint8","name":"","type":"uint8"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"publisherAgency","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"publisherAgencyFee","outputs":[{"internalType":"uint8","name":"","type":"uint8"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"recipient","type":"address"},{"components":[{"internalType":"uint256","name":"nonce","type":"uint256"},{"internalType":"uint256","name":"price","type":"uint256"},{"internalType":"uint256","name":"priceToken","type":"uint256"},{"internalType":"string","name":"licenseInfo","type":"string"},{"internalType":"string","name":"uri","type":"string"}],"internalType":"struct ContentNftContract.ContentNFTVoucher","name":"voucher","type":"tuple"},{"internalType":"bytes","name":"signature","type":"bytes"}],"name":"redeem","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"payable","type":"function"},{"inputs":[{"internalType":"address","name":"contractAddress","type":"address"}],"name":"removeAvailableCurrencyTokenContract","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"owner","type":"address"}],"name":"removeOwner","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"from","type":"address"},{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"safeTransferFrom","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"from","type":"address"},{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256","name":"tokenId","type":"uint256"},{"internalType":"bytes","name":"data","type":"bytes"}],"name":"safeTransferFrom","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"operator","type":"address"},{"internalType":"bool","name":"approved","type":"bool"}],"name":"setApprovalForAll","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"string","name":"uri","type":"string"}],"name":"setBaseUri","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address payable","name":"addr","type":"address"}],"name":"setBeneficiaryAddress","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint8","name":"agencyFee","type":"uint8"}],"name":"setDefaultAgencyFee","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"tokenContract","type":"address"}],"name":"setDefaultCurrencyTokenContractAddress","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"string","name":"description","type":"string"}],"name":"setDescription","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"string","name":"newImage","type":"string"}],"name":"setImage","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"},{"internalType":"enum ContentNftTypes.LicenseType","name":"licenseType","type":"uint8"},{"internalType":"uint256","name":"priceEther","type":"uint256"}],"name":"setLicensePriceEther","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"},{"internalType":"enum ContentNftTypes.LicenseType","name":"licenseType","type":"uint8"},{"internalType":"uint256","name":"priceFiat","type":"uint256"}],"name":"setLicensePriceFiat","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"},{"internalType":"enum ContentNftTypes.LicenseType","name":"licenseType","type":"uint8"},{"internalType":"uint256","name":"priceToken","type":"uint256"}],"name":"setLicensePriceToken","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"currencyTokenContract","type":"address"},{"internalType":"uint256","name":"tokenId","type":"uint256"},{"internalType":"enum ContentNftTypes.LicenseType","name":"licenseType","type":"uint8"},{"internalType":"uint256","name":"priceToken","type":"uint256"}],"name":"setLicensePriceToken","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"},{"internalType":"address","name":"newOwner","type":"address"}],"name":"setOwner","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"addr","type":"address"}],"name":"setPlatformAddress","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint8","name":"fee","type":"uint8"}],"name":"setPlatformFee","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"id","type":"uint256"},{"internalType":"uint256","name":"price","type":"uint256"}],"name":"setPriceEther","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"id","type":"uint256"},{"internalType":"uint256","name":"price","type":"uint256"}],"name":"setPriceFiat","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"id","type":"uint256"},{"internalType":"uint256","name":"price","type":"uint256"}],"name":"setPriceToken","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"currencyContract","type":"address"},{"internalType":"uint256","name":"id","type":"uint256"},{"internalType":"uint256","name":"price","type":"uint256"}],"name":"setPriceToken","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"publisher","type":"address"},{"internalType":"address","name":"agency","type":"address"}],"name":"setPublisherAgency","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"publisher","type":"address"},{"internalType":"uint8","name":"agencyFee","type":"uint8"}],"name":"setPublisherAgencyFee","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"string","name":"newSymbol","type":"string"}],"name":"setSymbol","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"},{"internalType":"string","name":"licenseInfo","type":"string"}],"name":"setTokenLicenseInfo","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"},{"internalType":"string","name":"_tokenURI","type":"string"}],"name":"setTokenURI","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"},{"internalType":"uint256","name":"index","type":"uint256"},{"internalType":"string","name":"_tokenURI","type":"string"}],"name":"setTokenURIByIndex","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_forwarder","type":"address"}],"name":"setTrustedForwarder","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes4","name":"interfaceId","type":"bytes4"}],"name":"supportsInterface","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"symbol","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"index","type":"uint256"}],"name":"tokenByIndex","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"owner","type":"address"},{"internalType":"uint256","name":"index","type":"uint256"}],"name":"tokenOfOwnerByIndex","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"tokenURI","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"},{"internalType":"uint256","name":"index","type":"uint256"}],"name":"tokenURIByIndex","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"totalSupply","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"from","type":"address"},{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"transferFrom","outputs":[],"stateMutability":"nonpayable","type":"function"}]');
var Ot = Z('<div slot="credit-card"><!></div>'), Dt = Z('<div slot="cred-balance"><!></div>'), $t = Z("<!> <!>", 1);
function nt(d, a) {
  if (new.target) return me({ component: nt, ...d });
  be(a, !1);
  const n = () => ye(ke, "$configStore", y), c = () => ye(Ge, "$providerStore", y), T = () => ye(dt, "$contractsStore", y), l = () => ye(Le, "$userStore", y), m = () => ye(ne, "$pageOptsStore", y), [y, w] = Be();
  var k = this && this.__awaiter || function(s, r, A, g) {
    function L(e) {
      return e instanceof A ? e : new A(function(u) {
        u(e);
      });
    }
    return new (A || (A = Promise))(function(e, u) {
      function i(E) {
        try {
          $(g.next(E));
        } catch (V) {
          u(V);
        }
      }
      function P(E) {
        try {
          $(g.throw(E));
        } catch (V) {
          u(V);
        }
      }
      function $(E) {
        E.done ? e(E.value) : L(E.value).then(i, P);
      }
      $((g = g.apply(s, r || [])).next());
    });
  }, o;
  const { close: S } = G(Ae), f = G(ke).chainId;
  let p = B(0), I = B(0), M = B(!1), h = B(!1), b = B(0);
  const R = (o = G(Ze).client_payment_configuration) === null || o === void 0 ? void 0 : o.token_fee;
  let x = B({});
  const D = (s, r, A) => k(void 0, void 0, void 0, function* () {
    let g = 0, L = 0;
    if (A) {
      const i = new pe.Contract(s, Bt, c());
      return g = yield i.getLicensePriceFiat(String(r), A).then((P) => Number(P)), L = yield i.getLicensePriceToken(String(r), A).then((P) => Number(P)), [g, L];
    }
    const { credenzaSellableMinAbi: e } = yield import("./abi-DIVtyi6o.js"), u = new pe.Contract(s, e, c());
    return g = yield u.getPriceFiat(r).then((i) => Number(i)), L = 0, g === 0 ? [g, L] = yield Promise.all([
      u.getPriceFiat(Ie).then((i) => Number(i)),
      u.getPriceToken(Ie).then((i) => Number(i))
    ]) : L = yield u.getPriceToken(r).then((i) => Number(i)), [g, L];
  }), W = (s) => k(void 0, void 0, void 0, function* () {
    try {
      C(M, !0);
      for (const r of s)
        if (r.contractAddress === T().erc20Cred.address)
          C(p, t(p) + r.amount * 100), R && (C(b, R), C(p, t(p) + t(p) * R));
        else {
          const A = r.membershipTokenId || Ie, g = r.tokenId || r.contentTokenId || A;
          let [L, e] = yield D(r.contractAddress, g, r.licenseType);
          r?.amount && r?.amount !== 0 && (L *= r.amount, e *= r.amount), C(p, t(p) + L), C(I, t(I) + e), lt(x, t(x)[`${r.contractAddress}/${g}`] = e);
        }
    } catch (r) {
      Q(X.ERROR, r);
    } finally {
      C(M, !1);
    }
  }), ee = ne.subscribe((s) => k(void 0, void 0, void 0, function* () {
    var r, A, g;
    !(!((r = s?.tokens) === null || r === void 0) && r.length) && !(!((A = s?.memberships) === null || A === void 0) && A.length) && !(!((g = s?.licenses) === null || g === void 0) && g.length) || (yield W([
      ...s?.tokens || [],
      ...s?.memberships || [],
      ...s?.licenses || []
    ]));
  }));
  pt(ee), oe(() => n(), () => {
    n().chainId !== f && S();
  }), Pe();
  var H = {
    $set: fe,
    $on: (s, r) => Te(a, s, r)
  };
  we();
  var _ = $t(), z = ue(_);
  {
    var te = (s) => {
      var r = xe(), A = ue(r);
      ct(A, () => import("./ProgressVideo-C0mOhkcx.js"), null, (g, L) => {
        var e = xe(), u = ue(e);
        rt(u, () => t(L).default, (i, P) => {
          P(i, {});
        }), U(g, e);
      }), U(s, r);
    };
    re(z, (s) => {
      t(h) && s(te);
    });
  }
  var ae = Y(z, 2);
  {
    let s = ce(() => (l(), m(), O(ie), O(se), t(p), K(() => ({
      user: l(),
      title: m().title || "Order Summary",
      subtitle: m().subtitle,
      onBackClick: () => ie.set(se.WALLET),
      isCardDisabled: m().payments?.card?.disabled,
      isCredezaValueDisabled: !t(p) || m().payments?.credenzaStoredValue?.disabled
    }))));
    Je(ae, {
      get options() {
        return t(s);
      },
      get isLoading() {
        return t(h);
      },
      set isLoading(r) {
        C(h, r);
      },
      $$slots: {
        "credit-card": (r, A) => {
          var g = Ot(), L = q(g);
          {
            var e = (i) => {
              Oe(i, {});
            }, u = (i) => {
              et(i, {
                get priceCents() {
                  return t(p);
                },
                get isPriceLoading() {
                  return t(M);
                },
                get feeToApply() {
                  return t(b);
                },
                get isLoading() {
                  return t(h);
                },
                set isLoading(P) {
                  C(h, P);
                },
                $$legacy: !0
              });
            };
            re(L, (i) => {
              t(h) || t(M) ? i(e) : i(u, -1);
            });
          }
          j(g), U(r, g);
        },
        "cred-balance": (r, A) => {
          var g = Dt(), L = q(g);
          tt(L, {
            get pricesByToken() {
              return t(x);
            },
            get totalPriceToken() {
              return t(I);
            },
            get isPriceLoading() {
              return t(M);
            },
            get isLoading() {
              return t(h);
            },
            set isLoading(e) {
              C(h, e);
            },
            $$legacy: !0
          }), j(g), U(r, g);
        }
      },
      $$legacy: !0
    });
  }
  U(d, _);
  var v = ve(H);
  return w(), v;
}
const Ht = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
  __proto__: null,
  default: nt
}, Symbol.toStringTag, { value: "Module" }));
export {
  Ht as P,
  Zt as g,
  Et as r
};
//# sourceMappingURL=Payment-jc4oelQs.js.map
