@nowramp/form 0.2.3 → 0.2.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js CHANGED
@@ -8,8 +8,8 @@
8
8
  }`;
9
9
  document.head.appendChild(s);
10
10
  })();
11
- import { jsx as e, jsxs as i, Fragment as Z } from "react/jsx-runtime";
12
- import ke, { useState as w, useRef as M, useCallback as O, useEffect as U, useMemo as W, useReducer as an, useContext as ga, createContext as xa } from "react";
11
+ import { jsx as e, jsxs as i, Fragment as G } from "react/jsx-runtime";
12
+ import ke, { useState as w, useRef as M, useCallback as O, useEffect as U, useMemo as V, useReducer as an, useContext as ga, createContext as xa } from "react";
13
13
  import { RampApi as gt } from "@nowramp/sdk";
14
14
  import { createPortal as oa } from "react-dom";
15
15
  function nn(t, a, n) {
@@ -537,29 +537,29 @@ function xn(t) {
537
537
  defaultGateway: k,
538
538
  defaultCountry: R,
539
539
  fieldLocks: y,
540
- partnerMetadata: E,
540
+ partnerMetadata: N,
541
541
  statusPollInterval: K = 5e3,
542
- onComplete: te,
543
- onError: z,
542
+ onComplete: z,
543
+ onError: J,
544
544
  children: ie
545
- } = t, J = W(() => ({ apiUrl: r, projectId: n }), [r, n]), ee = h || (s === "BTC" ? "bitcoin" : s ? s.toLowerCase() : ""), be = c === "sell", ae = be ? !!f : !!p, C = (be ? !!(ae && s && ee) : !!(ae && s && ee && g)) && k ? "confirm" : "amount", F = p || (c === "buy" ? "250" : ""), [m, D] = an(gn, {
545
+ } = t, q = V(() => ({ apiUrl: r, projectId: n }), [r, n]), te = h || (s === "BTC" ? "bitcoin" : s ? s.toLowerCase() : ""), be = c === "sell", ae = be ? !!f : !!p, C = (be ? !!(ae && s && te) : !!(ae && s && te && g)) && k ? "confirm" : "amount", F = p || (c === "buy" ? "250" : ""), [m, D] = an(gn, {
546
546
  ...va,
547
547
  step: C,
548
548
  flowType: c,
549
549
  fiatCurrency: d,
550
550
  cryptoCurrency: s,
551
- network: ee,
551
+ network: te,
552
552
  fiatAmount: ia(F, 2),
553
553
  cryptoAmount: ia(f, 6),
554
554
  walletAddress: g,
555
555
  customerId: u,
556
556
  // If defaultCountry is provided, set it immediately with 'manual' source to skip auto-detection
557
557
  ...R ? { country: R.toLowerCase(), countrySource: "manual" } : {}
558
- }), N = m.flowType === "sell", {
558
+ }), E = m.flowType === "sell", {
559
559
  config: b,
560
560
  loading: ne,
561
561
  error: pe
562
- } = nn(J, m.flowType, m.country || void 0), Se = M(!1);
562
+ } = nn(q, m.flowType, m.country || void 0), Se = M(!1);
563
563
  ke.useEffect(() => {
564
564
  var B, I;
565
565
  if (Se.current || !(b != null && b.detectedCountry) || m.country) return;
@@ -587,13 +587,13 @@ function xn(t) {
587
587
  const le = M(m.fiatCurrency);
588
588
  ke.useEffect(() => {
589
589
  var B;
590
- if (m.fiatCurrency === le.current || (le.current = m.fiatCurrency, N || !((B = b == null ? void 0 : b.fiats) != null && B.length) || !m.fiatAmount)) return;
590
+ if (m.fiatCurrency === le.current || (le.current = m.fiatCurrency, E || !((B = b == null ? void 0 : b.fiats) != null && B.length) || !m.fiatAmount)) return;
591
591
  const v = b.fiats.find((I) => I.code === m.fiatCurrency);
592
592
  if (!(v != null && v.minAmount)) return;
593
593
  const A = parseFloat(m.fiatAmount), T = parseFloat(v.minAmount);
594
594
  !isNaN(A) && !isNaN(T) && A < T && D({ type: "SET_FIAT_AMOUNT", amount: String(Math.ceil(T)) });
595
- }, [m.fiatCurrency, m.fiatAmount, b, N]);
596
- const { availableFiats: ce, availableCryptos: X, availablePaymentMethods: fe } = W(() => {
595
+ }, [m.fiatCurrency, m.fiatAmount, b, E]);
596
+ const { availableFiats: ce, availableCryptos: X, availablePaymentMethods: fe } = V(() => {
597
597
  var T, B, I;
598
598
  if (!b)
599
599
  return { availableFiats: [], availableCryptos: [], availablePaymentMethods: [] };
@@ -616,7 +616,7 @@ function xn(t) {
616
616
  m.fiatCurrency
617
617
  )
618
618
  };
619
- }, [b, m.cryptoCurrency, m.network, m.fiatCurrency]), Qe = W(() => {
619
+ }, [b, m.cryptoCurrency, m.network, m.fiatCurrency]), Qe = V(() => {
620
620
  var v, A, T;
621
621
  return ne || !b ? !1 : mn(
622
622
  b,
@@ -669,8 +669,8 @@ function xn(t) {
669
669
  y,
670
670
  D
671
671
  ]);
672
- const oe = W(() => {
673
- if (N) {
672
+ const oe = V(() => {
673
+ if (E) {
674
674
  if (!m.cryptoAmount) return null;
675
675
  const I = parseFloat(m.cryptoAmount);
676
676
  return isNaN(I) || I <= 0 ? "Enter a valid amount" : null;
@@ -682,34 +682,34 @@ function xn(t) {
682
682
  if (!A) return null;
683
683
  const T = parseFloat(A.minAmount), B = parseFloat(A.maxAmount);
684
684
  return !isNaN(T) && v < T ? `Minimum amount is ${A.minAmount} ${m.fiatCurrency}` : !isNaN(B) && v > B ? `Maximum amount is ${A.maxAmount} ${m.fiatCurrency}` : null;
685
- }, [b, m.fiatAmount, m.fiatCurrency, m.cryptoAmount, N]), ye = W(() => {
686
- const v = N ? !!m.cryptoAmount : !!m.fiatAmount;
685
+ }, [b, m.fiatAmount, m.fiatCurrency, m.cryptoAmount, E]), ye = V(() => {
686
+ const v = E ? !!m.cryptoAmount : !!m.fiatAmount;
687
687
  return !b || !v || !m.fiatCurrency || !m.cryptoCurrency || !m.network || oe || b.detectedCountry && m.countrySource === "" && !R ? null : {
688
688
  fiatCurrency: m.fiatCurrency,
689
- ...N ? { cryptoAmount: m.cryptoAmount } : { fiatAmount: m.fiatAmount },
689
+ ...E ? { cryptoAmount: m.cryptoAmount } : { fiatAmount: m.fiatAmount },
690
690
  cryptoCurrency: m.cryptoCurrency,
691
691
  network: m.network,
692
692
  paymentMethodId: m.paymentMethodId || void 0,
693
693
  country: m.country || void 0,
694
694
  orderType: m.flowType
695
695
  };
696
- }, [b, m.fiatCurrency, m.fiatAmount, m.cryptoAmount, m.cryptoCurrency, m.network, m.paymentMethodId, m.country, m.countrySource, oe, N, m.flowType, R]), {
697
- quotes: G,
696
+ }, [b, m.fiatCurrency, m.fiatAmount, m.cryptoAmount, m.cryptoCurrency, m.network, m.paymentMethodId, m.country, m.countrySource, oe, E, m.flowType, R]), {
697
+ quotes: $,
698
698
  loading: Ke,
699
699
  error: ze,
700
700
  refetch: vt
701
- } = rn(J, ye), se = pn(Ke, G, ye), _e = M(!1);
701
+ } = rn(q, ye), se = pn(Ke, $, ye), _e = M(!1);
702
702
  ke.useEffect(() => {
703
703
  var v;
704
- _e.current || m.countrySource === "auto" && ((v = y == null ? void 0 : y.sourceCurrency) != null && v.locked || a.current || Ke || !ye || ze || !G || G.bestQuote || m.fiatCurrency !== "USD" && (_e.current = !0, D({ type: "SET_FIAT_CURRENCY", currency: "USD" }), D({ type: "SET_FIAT_AMOUNT", amount: "250" })));
705
- }, [G, Ke, ze, ye, m.countrySource, m.fiatCurrency]);
704
+ _e.current || m.countrySource === "auto" && ((v = y == null ? void 0 : y.sourceCurrency) != null && v.locked || a.current || Ke || !ye || ze || !$ || $.bestQuote || m.fiatCurrency !== "USD" && (_e.current = !0, D({ type: "SET_FIAT_CURRENCY", currency: "USD" }), D({ type: "SET_FIAT_AMOUNT", amount: "250" })));
705
+ }, [$, Ke, ze, ye, m.countrySource, m.fiatCurrency]);
706
706
  const {
707
707
  order: Le,
708
708
  loading: Ct,
709
709
  error: de,
710
710
  createOrder: j
711
- } = on(J), lt = 15e3, {
712
- status: $,
711
+ } = on(q), lt = 15e3, {
712
+ status: Z,
713
713
  loading: bt
714
714
  } = ln(
715
715
  { apiUrl: r },
@@ -717,19 +717,19 @@ function xn(t) {
717
717
  { pollInterval: K, initialDelay: lt }
718
718
  ), Je = M(null);
719
719
  ke.useEffect(() => {
720
- !($ != null && $.status) || !te || yn.includes($.status) && Je.current !== $.orderId && (Je.current = $.orderId, te($));
721
- }, [$ == null ? void 0 : $.status, $ == null ? void 0 : $.orderId, te]), ke.useEffect(() => {
720
+ !(Z != null && Z.status) || !z || yn.includes(Z.status) && Je.current !== Z.orderId && (Je.current = Z.orderId, z(Z));
721
+ }, [Z == null ? void 0 : Z.status, Z == null ? void 0 : Z.orderId, z]), ke.useEffect(() => {
722
722
  const v = pe || de;
723
- v && z && z(v);
724
- }, [pe, de, z]);
725
- const Fe = k || (b == null ? void 0 : b.defaultGateway) || null, ct = W(() => {
726
- if (!se || !(G != null && G.unavailableGateways)) return null;
727
- const v = G.preferredGatewayId || Fe;
728
- return hn(G.unavailableGateways, v);
729
- }, [se, G, Fe]), je = M(Fe);
723
+ v && J && J(v);
724
+ }, [pe, de, J]);
725
+ const Fe = k || (b == null ? void 0 : b.defaultGateway) || null, ct = V(() => {
726
+ if (!se || !($ != null && $.unavailableGateways)) return null;
727
+ const v = $.preferredGatewayId || Fe;
728
+ return hn($.unavailableGateways, v);
729
+ }, [se, $, Fe]), je = M(Fe);
730
730
  je.current = Fe;
731
- const qe = M(G);
732
- qe.current = G;
731
+ const qe = M($);
732
+ qe.current = $;
733
733
  const et = M(l);
734
734
  et.current = l;
735
735
  const Ue = O(async () => {
@@ -745,7 +745,7 @@ function xn(t) {
745
745
  gateway: v,
746
746
  customerId: m.customerId || void 0,
747
747
  fiatCurrency: m.fiatCurrency,
748
- ...N ? { cryptoAmount: m.cryptoAmount } : { fiatAmount: m.fiatAmount },
748
+ ...E ? { cryptoAmount: m.cryptoAmount } : { fiatAmount: m.fiatAmount },
749
749
  cryptoCurrency: m.cryptoCurrency,
750
750
  network: m.network,
751
751
  walletAddress: m.walletAddress,
@@ -753,19 +753,19 @@ function xn(t) {
753
753
  email: m.email || void 0,
754
754
  orderType: m.flowType,
755
755
  ...et.current ? { metadata: { brand: et.current } } : {},
756
- ...E && Object.keys(E).length > 0 ? { partnerMetadata: E } : {}
756
+ ...N && Object.keys(N).length > 0 ? { partnerMetadata: N } : {}
757
757
  }), D({ type: "SET_STEP", step: "checkout" });
758
758
  } catch (I) {
759
759
  const _ = I instanceof Error ? I.message : "Failed to create order";
760
760
  /wallet|address/i.test(_) ? D({ type: "SET_WALLET_ERROR", message: _.replace(/^Failed to create checkout intent:\s*/i, "") }) : D({ type: "SET_ERROR", message: _ });
761
761
  }
762
- }, [m, j, N, E]), tt = O((v) => {
762
+ }, [m, j, E, N]), tt = O((v) => {
763
763
  D({ type: "SET_STEP", step: v });
764
764
  }, []), St = O(() => {
765
765
  const v = ["confirm", "amount", "quotes", "wallet", "checkout", "processing", "complete"], A = v.indexOf(m.step);
766
766
  A > 0 && D({ type: "SET_STEP", step: v[A - 1] });
767
- }, [m.step, N]), wt = W(() => {
768
- const v = N ? !!m.cryptoAmount : !!m.fiatAmount;
767
+ }, [m.step, E]), wt = V(() => {
768
+ const v = E ? !!m.cryptoAmount : !!m.fiatAmount;
769
769
  switch (m.step) {
770
770
  case "confirm":
771
771
  return !!(v && m.cryptoCurrency && m.network && m.walletAddress && !oe);
@@ -778,15 +778,15 @@ function xn(t) {
778
778
  default:
779
779
  return !1;
780
780
  }
781
- }, [m, oe, N]), st = {
782
- apiConfig: J,
781
+ }, [m, oe, E]), st = {
782
+ apiConfig: q,
783
783
  assetBaseUrl: o,
784
784
  config: b,
785
785
  configLoading: ne,
786
786
  configError: pe,
787
787
  state: m,
788
788
  dispatch: D,
789
- quotes: G,
789
+ quotes: $,
790
790
  quotesLoading: Ke,
791
791
  quotesError: ze,
792
792
  fetchQuotes: vt,
@@ -794,7 +794,7 @@ function xn(t) {
794
794
  orderLoading: Ct,
795
795
  orderError: de,
796
796
  createOrder: Ue,
797
- orderStatus: $,
797
+ orderStatus: Z,
798
798
  orderStatusLoading: bt,
799
799
  fieldLocks: y || null,
800
800
  defaultGateway: Fe,
@@ -1131,7 +1131,7 @@ function vn({
1131
1131
  return Sa(p, h);
1132
1132
  },
1133
1133
  [o]
1134
- ), d = W(
1134
+ ), d = V(
1135
1135
  () => ({ locale: n, setLocale: u, t: l, languages: Ze }),
1136
1136
  [n, u, l]
1137
1137
  );
@@ -2350,7 +2350,7 @@ function pa(t) {
2350
2350
  return t.length <= 12 ? t : `${t.slice(0, 6)}...${t.slice(-6)}`;
2351
2351
  }
2352
2352
  function Un({ className: t = "", stablecoinParity: a, partnerName: n }) {
2353
- var J;
2353
+ var q;
2354
2354
  const {
2355
2355
  config: r,
2356
2356
  configLoading: o,
@@ -2360,12 +2360,12 @@ function Un({ className: t = "", stablecoinParity: a, partnerName: n }) {
2360
2360
  fetchQuotes: d,
2361
2361
  createOrder: s,
2362
2362
  orderLoading: h
2363
- } = Xe(), p = P(), f = c.flowType === "sell", [g, k] = w(null), R = r == null ? void 0 : r.gateways.find((ee) => ee.id === u), y = (J = l == null ? void 0 : l.bestQuote) != null && J.exchangeRate ? parseFloat(l.bestQuote.exchangeRate) : null, E = parseFloat(c.fiatAmount) || 0, K = !!(a && n && !f && Ea(c.cryptoCurrency) && y), te = K && c.cryptoCurrency.toUpperCase().includes(c.fiatCurrency.toUpperCase()), z = K && E > 0 ? Bt(te ? E : E / y) : null, ie = async () => {
2363
+ } = Xe(), p = P(), f = c.flowType === "sell", [g, k] = w(null), R = r == null ? void 0 : r.gateways.find((te) => te.id === u), y = (q = l == null ? void 0 : l.bestQuote) != null && q.exchangeRate ? parseFloat(l.bestQuote.exchangeRate) : null, N = parseFloat(c.fiatAmount) || 0, K = !!(a && n && !f && Ea(c.cryptoCurrency) && y), z = K && c.cryptoCurrency.toUpperCase().includes(c.fiatCurrency.toUpperCase()), J = K && N > 0 ? Bt(z ? N : N / y) : null, ie = async () => {
2364
2364
  k(null);
2365
2365
  try {
2366
2366
  d(), await s();
2367
- } catch (ee) {
2368
- const be = ee instanceof Error ? ee.message : p("error.createOrderFailed");
2367
+ } catch (te) {
2368
+ const be = te instanceof Error ? te.message : p("error.createOrderFailed");
2369
2369
  k(be);
2370
2370
  }
2371
2371
  };
@@ -2382,20 +2382,20 @@ function Un({ className: t = "", stablecoinParity: a, partnerName: n }) {
2382
2382
  /* @__PURE__ */ e("span", { className: "text-[13px] font-medium", style: { color: "var(--t-text)" }, children: R.name })
2383
2383
  ] })
2384
2384
  ] }),
2385
- f ? /* @__PURE__ */ i(Z, { children: [
2385
+ f ? /* @__PURE__ */ i(G, { children: [
2386
2386
  /* @__PURE__ */ e(He, { label: p("confirm.youSell"), value: `${c.cryptoAmount} ${c.cryptoCurrency}`, highlight: !0 }),
2387
2387
  /* @__PURE__ */ e(He, { label: p("confirm.youReceive"), value: p("confirm.payout", { currency: c.fiatCurrency }) })
2388
- ] }) : /* @__PURE__ */ i(Z, { children: [
2388
+ ] }) : /* @__PURE__ */ i(G, { children: [
2389
2389
  /* @__PURE__ */ e(He, { label: p("confirm.youPay"), value: `${c.fiatAmount} ${c.fiatCurrency}`, highlight: !0 }),
2390
2390
  /* @__PURE__ */ e(
2391
2391
  He,
2392
2392
  {
2393
2393
  label: p("confirm.youReceive"),
2394
- value: z ? `${z} ${c.cryptoCurrency}` : p("confirm.cryptoOnNetwork", { crypto: c.cryptoCurrency, network: c.network })
2394
+ value: J ? `${J} ${c.cryptoCurrency}` : p("confirm.cryptoOnNetwork", { crypto: c.cryptoCurrency, network: c.network })
2395
2395
  }
2396
2396
  ),
2397
2397
  /* @__PURE__ */ e(He, { label: p("confirm.wallet"), value: pa(c.walletAddress), mono: !0 }),
2398
- K && z && /* @__PURE__ */ e("div", { className: "py-2 text-[11px]", style: { color: "var(--t-text-muted)", lineHeight: "15px" }, children: p("confirm.parityNote", { amount: z, crypto: c.cryptoCurrency, partner: n }) })
2398
+ K && J && /* @__PURE__ */ e("div", { className: "py-2 text-[11px]", style: { color: "var(--t-text-muted)", lineHeight: "15px" }, children: p("confirm.parityNote", { amount: J, crypto: c.cryptoCurrency, partner: n }) })
2399
2399
  ] }),
2400
2400
  /* @__PURE__ */ e(He, { label: p("confirm.network"), value: c.network }),
2401
2401
  f && c.walletAddress && /* @__PURE__ */ e(He, { label: p("confirm.refundAddress"), value: pa(c.walletAddress), mono: !0 })
@@ -2408,7 +2408,7 @@ function Un({ className: t = "", stablecoinParity: a, partnerName: n }) {
2408
2408
  style: { height: 60, borderRadius: "var(--t-cta-radius, 100px)", background: "var(--t-cta-bg)", color: "var(--t-cta-text)", opacity: h ? 0.7 : 1 },
2409
2409
  disabled: h,
2410
2410
  onClick: ie,
2411
- children: h ? /* @__PURE__ */ i(Z, { children: [
2411
+ children: h ? /* @__PURE__ */ i(G, { children: [
2412
2412
  /* @__PURE__ */ e(Ee, { size: 18 }),
2413
2413
  p("confirm.processing")
2414
2414
  ] }) : p(f ? "confirm.confirmSell" : "confirm.confirmPay")
@@ -2981,7 +2981,7 @@ function Zn() {
2981
2981
  );
2982
2982
  }
2983
2983
  function Xn({ isOpen: t, onClose: a, children: n }) {
2984
- return /* @__PURE__ */ i(Z, { children: [
2984
+ return /* @__PURE__ */ i(G, { children: [
2985
2985
  /* @__PURE__ */ e(
2986
2986
  "div",
2987
2987
  {
@@ -3089,14 +3089,14 @@ function Qn({
3089
3089
  assetBaseUrl: r = "",
3090
3090
  selectedCode: o
3091
3091
  }) {
3092
- const c = P(), [u, l] = w(""), d = W(() => {
3092
+ const c = P(), [u, l] = w(""), d = V(() => {
3093
3093
  if (!n || n.length === 0) return ca;
3094
3094
  const h = new Map(ca.map((p) => [p.code, p.name]));
3095
3095
  return n.map((p) => ({
3096
3096
  code: p.code,
3097
3097
  name: p.name || h.get(p.code) || p.code
3098
3098
  }));
3099
- }, [n]), s = W(() => {
3099
+ }, [n]), s = V(() => {
3100
3100
  const h = u.trim().toLowerCase();
3101
3101
  if (!h) {
3102
3102
  if (o) {
@@ -3112,7 +3112,7 @@ function Qn({
3112
3112
  (p) => p.code.toLowerCase().includes(h) || p.name.toLowerCase().includes(h)
3113
3113
  );
3114
3114
  }, [d, u, o]);
3115
- return /* @__PURE__ */ i(Z, { children: [
3115
+ return /* @__PURE__ */ i(G, { children: [
3116
3116
  /* @__PURE__ */ i("div", { className: "relative shrink-0", style: { height: 128, background: "var(--t-header-bg)", backdropFilter: "blur(var(--t-header-blur))", WebkitBackdropFilter: "blur(var(--t-header-blur))" }, children: [
3117
3117
  /* @__PURE__ */ e("div", { className: "absolute", style: { left: 12, top: 20 }, children: /* @__PURE__ */ e(Ae, { width: 46 }) }),
3118
3118
  /* @__PURE__ */ e("p", { className: "absolute text-[16px] text-center truncate", style: { top: 28, left: 64, right: 64, color: "var(--t-text)", lineHeight: "24px" }, children: c("modal.selectFiat") }),
@@ -3189,7 +3189,7 @@ function fa({ src: t, alt: a, size: n, className: r, style: o }) {
3189
3189
  ] });
3190
3190
  }
3191
3191
  function zn({ onClose: t, onSelect: a, cryptos: n, assetBaseUrl: r = "", selectedCode: o, selectedChain: c }) {
3192
- const u = P(), [l, d] = w(""), s = W(() => {
3192
+ const u = P(), [l, d] = w(""), s = V(() => {
3193
3193
  if (!n || n.length === 0) return Fn;
3194
3194
  const f = [];
3195
3195
  for (const g of n) {
@@ -3198,40 +3198,40 @@ function zn({ onClose: t, onSelect: a, cryptos: n, assetBaseUrl: r = "", selecte
3198
3198
  f.push({ code: g.code, name: R, chain: g.code, popular: ha.includes(g.code) });
3199
3199
  else
3200
3200
  for (const y of k) {
3201
- const E = y.code || y.id || y.name || g.code;
3201
+ const N = y.code || y.id || y.name || g.code;
3202
3202
  f.push({
3203
3203
  code: g.code,
3204
3204
  name: R,
3205
- chain: E,
3205
+ chain: N,
3206
3206
  chainName: y.name,
3207
3207
  popular: ha.includes(g.code)
3208
3208
  });
3209
3209
  }
3210
3210
  }
3211
3211
  return f;
3212
- }, [n]), h = O((f, g) => o === f && c === g, [o, c]), p = W(() => {
3212
+ }, [n]), h = O((f, g) => o === f && c === g, [o, c]), p = V(() => {
3213
3213
  var R;
3214
3214
  const f = l.trim().toLowerCase();
3215
3215
  if (!f) {
3216
3216
  if (o && c) {
3217
- const y = s.find((E) => E.code === o && E.chain === c);
3217
+ const y = s.find((N) => N.code === o && N.chain === c);
3218
3218
  if (y) {
3219
- const E = s.filter((K) => !(K.code === o && K.chain === c));
3220
- return [y, ...E];
3219
+ const N = s.filter((K) => !(K.code === o && K.chain === c));
3220
+ return [y, ...N];
3221
3221
  }
3222
3222
  }
3223
3223
  return s;
3224
3224
  }
3225
3225
  const g = f.split(/\s+/), k = [];
3226
3226
  for (const y of s) {
3227
- const E = yt(y.chain), K = E ? E.name.toLowerCase() : "", te = ((R = E == null ? void 0 : E.shortName) == null ? void 0 : R.toLowerCase()) || "", z = y.chain.toLowerCase(), ie = y.code.toLowerCase(), J = y.name.toLowerCase(), ee = [ie, J, K, te, z];
3228
- if (!g.every((L) => ee.some((C) => C.includes(L)))) continue;
3227
+ const N = yt(y.chain), K = N ? N.name.toLowerCase() : "", z = ((R = N == null ? void 0 : N.shortName) == null ? void 0 : R.toLowerCase()) || "", J = y.chain.toLowerCase(), ie = y.code.toLowerCase(), q = y.name.toLowerCase(), te = [ie, q, K, z, J];
3228
+ if (!g.every((L) => te.some((C) => C.includes(L)))) continue;
3229
3229
  let ae = 0;
3230
- ie === f ? ae += 100 : ie.startsWith(g[0]) && (ae += 50), y.popular && (ae += 10), g.length > 1 && (K.includes(g[1]) || te.includes(g[1]) || z.includes(g[1])) && (ae += 25), k.push({ item: y, score: ae });
3230
+ ie === f ? ae += 100 : ie.startsWith(g[0]) && (ae += 50), y.popular && (ae += 10), g.length > 1 && (K.includes(g[1]) || z.includes(g[1]) || J.includes(g[1])) && (ae += 25), k.push({ item: y, score: ae });
3231
3231
  }
3232
- return k.sort((y, E) => E.score - y.score), k.map((y) => y.item);
3232
+ return k.sort((y, N) => N.score - y.score), k.map((y) => y.item);
3233
3233
  }, [s, l, o, c]);
3234
- return /* @__PURE__ */ i(Z, { children: [
3234
+ return /* @__PURE__ */ i(G, { children: [
3235
3235
  /* @__PURE__ */ i("div", { className: "relative shrink-0", style: { height: 128, background: "var(--t-header-bg)", backdropFilter: "blur(var(--t-header-blur))", WebkitBackdropFilter: "blur(var(--t-header-blur))" }, children: [
3236
3236
  /* @__PURE__ */ e("div", { className: "absolute", style: { left: 12, top: 20 }, children: /* @__PURE__ */ e(Ae, { width: 46 }) }),
3237
3237
  /* @__PURE__ */ e("p", { className: "absolute text-[16px] text-center truncate", style: { top: 28, left: 64, right: 64, color: "var(--t-text)", lineHeight: "24px" }, children: u("modal.selectCrypto") }),
@@ -3361,7 +3361,7 @@ function Wr({
3361
3361
  onOpenModal: n,
3362
3362
  fiatCurrency: r
3363
3363
  }) {
3364
- const o = P(), c = W(
3364
+ const o = P(), c = V(
3365
3365
  () => t.filter((l) => l.supportedFiats.includes(r)),
3366
3366
  [t, r]
3367
3367
  ), u = c.find((l) => l.id === a) || c[0];
@@ -3376,7 +3376,7 @@ function Wr({
3376
3376
  },
3377
3377
  children: /* @__PURE__ */ e("span", { className: "text-[12px]", style: { color: "var(--t-text-muted)" }, children: o("payment.unavailableFor", { currency: r }) })
3378
3378
  }
3379
- ) : /* @__PURE__ */ e(Z, { children: /* @__PURE__ */ i(
3379
+ ) : /* @__PURE__ */ e(G, { children: /* @__PURE__ */ i(
3380
3380
  "div",
3381
3381
  {
3382
3382
  role: "button",
@@ -3410,7 +3410,7 @@ function ar({
3410
3410
  onSelect: n,
3411
3411
  onClose: r
3412
3412
  }) {
3413
- const o = P(), [c, u] = w(""), l = t.length > 0 ? t[0].id : "", d = W(() => {
3413
+ const o = P(), [c, u] = w(""), l = t.length > 0 ? t[0].id : "", d = V(() => {
3414
3414
  const s = c.trim().toLowerCase();
3415
3415
  if (!s) {
3416
3416
  if (a) {
@@ -3426,7 +3426,7 @@ function ar({
3426
3426
  (h) => h.id.toLowerCase().includes(s) || h.name.toLowerCase().includes(s) || h.description && h.description.toLowerCase().includes(s)
3427
3427
  );
3428
3428
  }, [t, c, a]);
3429
- return /* @__PURE__ */ i(Z, { children: [
3429
+ return /* @__PURE__ */ i(G, { children: [
3430
3430
  /* @__PURE__ */ i("div", { className: "relative shrink-0", style: { height: 128, background: "var(--t-header-bg)", backdropFilter: "blur(var(--t-header-blur))", WebkitBackdropFilter: "blur(var(--t-header-blur))" }, children: [
3431
3431
  /* @__PURE__ */ e("div", { className: "absolute", style: { left: 12, top: 20 }, children: /* @__PURE__ */ e(Ae, { width: 46 }) }),
3432
3432
  /* @__PURE__ */ e("p", { className: "absolute text-[16px] text-center truncate", style: { top: 28, left: 64, right: 64, color: "var(--t-text)", lineHeight: "24px" }, children: o("modal.choosePayment") }),
@@ -3528,7 +3528,7 @@ function or({
3528
3528
  }) {
3529
3529
  var y;
3530
3530
  const { t: p, locale: f, languages: g } = _t(), [k, R] = w(!1);
3531
- return /* @__PURE__ */ i(Z, { children: [
3531
+ return /* @__PURE__ */ i(G, { children: [
3532
3532
  /* @__PURE__ */ i("div", { className: "relative shrink-0", style: { height: 80, background: "var(--t-header-bg)", backdropFilter: "blur(var(--t-header-blur))", WebkitBackdropFilter: "blur(var(--t-header-blur))" }, children: [
3533
3533
  /* @__PURE__ */ e("div", { className: "absolute", style: { left: 12, top: 20 }, children: /* @__PURE__ */ e(Ae, { width: 46 }) }),
3534
3534
  /* @__PURE__ */ e("div", { className: "absolute", style: { right: 12, top: 20 }, children: /* @__PURE__ */ e(Oe, { onClick: t }) })
@@ -3581,24 +3581,24 @@ function or({
3581
3581
  style: { ...ht, backgroundColor: "var(--t-surface)", color: "inherit", border: "none", cursor: "pointer", padding: "14px 16px", margin: 0, textAlign: "left", animationDelay: "120ms" },
3582
3582
  children: [
3583
3583
  /* @__PURE__ */ e("span", { className: "font-medium text-[15px]", style: { color: "var(--t-text)" }, children: p("settings.language") }),
3584
- /* @__PURE__ */ e("span", { className: "text-[13px]", style: { color: "var(--t-text-secondary)" }, children: ((y = g.find((E) => E.code === f)) == null ? void 0 : y.name) || f })
3584
+ /* @__PURE__ */ e("span", { className: "text-[13px]", style: { color: "var(--t-text-secondary)" }, children: ((y = g.find((N) => N.code === f)) == null ? void 0 : y.name) || f })
3585
3585
  ]
3586
3586
  }
3587
3587
  ),
3588
- rr.map((E, K) => /* @__PURE__ */ i(
3588
+ rr.map((N, K) => /* @__PURE__ */ i(
3589
3589
  "a",
3590
3590
  {
3591
- href: E.href,
3591
+ href: N.href,
3592
3592
  target: "_blank",
3593
3593
  rel: "noopener noreferrer",
3594
3594
  className: "flex items-center justify-between w-full px-4 transition-colors card-press modal-item-in",
3595
3595
  style: { ...ht, textDecoration: "none", color: "inherit", paddingTop: 14, paddingBottom: 14, animationDelay: `${180 + K * 60}ms` },
3596
3596
  children: [
3597
- /* @__PURE__ */ e("span", { className: "font-medium text-[15px]", style: { color: "var(--t-text)" }, children: p(E.key) }),
3597
+ /* @__PURE__ */ e("span", { className: "font-medium text-[15px]", style: { color: "var(--t-text)" }, children: p(N.key) }),
3598
3598
  /* @__PURE__ */ e(Pn, {})
3599
3599
  ]
3600
3600
  },
3601
- E.key
3601
+ N.key
3602
3602
  ))
3603
3603
  ] })
3604
3604
  ] });
@@ -3617,7 +3617,7 @@ function lr({
3617
3617
  assetBaseUrl: n = "",
3618
3618
  selectedCode: r
3619
3619
  }) {
3620
- const o = P(), [c, u] = w(""), l = W(() => {
3620
+ const o = P(), [c, u] = w(""), l = V(() => {
3621
3621
  const d = c.trim().toLowerCase();
3622
3622
  if (!d) {
3623
3623
  if (r) {
@@ -3633,7 +3633,7 @@ function lr({
3633
3633
  (s) => s.name.toLowerCase().includes(d) || s.code.includes(d) || s.defaultFiat.toLowerCase().includes(d)
3634
3634
  );
3635
3635
  }, [c, r]);
3636
- return /* @__PURE__ */ i(Z, { children: [
3636
+ return /* @__PURE__ */ i(G, { children: [
3637
3637
  /* @__PURE__ */ i("div", { className: "relative shrink-0", style: { height: 128, background: "var(--t-header-bg)", backdropFilter: "blur(var(--t-header-blur))", WebkitBackdropFilter: "blur(var(--t-header-blur))" }, children: [
3638
3638
  /* @__PURE__ */ e("div", { className: "absolute", style: { left: 12, top: 20 }, children: /* @__PURE__ */ e(Ae, { width: 46 }) }),
3639
3639
  /* @__PURE__ */ e("p", { className: "absolute text-[16px] text-center truncate", style: { top: 28, left: 64, right: 64, color: "var(--t-text)", lineHeight: "24px" }, children: o("modal.selectCountry") }),
@@ -3708,7 +3708,7 @@ function sr({
3708
3708
  onSelect: a,
3709
3709
  selectedCode: n
3710
3710
  }) {
3711
- const r = P(), [o, c] = w(""), u = W(() => {
3711
+ const r = P(), [o, c] = w(""), u = V(() => {
3712
3712
  const l = o.trim().toLowerCase();
3713
3713
  if (!l) {
3714
3714
  if (n) {
@@ -3724,7 +3724,7 @@ function sr({
3724
3724
  (d) => d.name.toLowerCase().includes(l) || d.english.toLowerCase().includes(l) || d.code.includes(l)
3725
3725
  );
3726
3726
  }, [o, n]);
3727
- return /* @__PURE__ */ i(Z, { children: [
3727
+ return /* @__PURE__ */ i(G, { children: [
3728
3728
  /* @__PURE__ */ i("div", { className: "relative shrink-0", style: { height: 128, background: "var(--t-header-bg)", backdropFilter: "blur(var(--t-header-blur))", WebkitBackdropFilter: "blur(var(--t-header-blur))" }, children: [
3729
3729
  /* @__PURE__ */ e("div", { className: "absolute", style: { left: 12, top: 20 }, children: /* @__PURE__ */ e(Ae, { width: 46 }) }),
3730
3730
  /* @__PURE__ */ e("p", { className: "absolute text-[16px] text-center truncate", style: { top: 28, left: 64, right: 64, color: "var(--t-text)", lineHeight: "24px" }, children: r("modal.selectLanguage") }),
@@ -3867,9 +3867,9 @@ function ur({
3867
3867
  shaking: g,
3868
3868
  onFocus: k
3869
3869
  }) {
3870
- var y, E, K;
3870
+ var y, N, K;
3871
3871
  const R = P();
3872
- return /* @__PURE__ */ i(Z, { children: [
3872
+ return /* @__PURE__ */ i(G, { children: [
3873
3873
  /* @__PURE__ */ i(
3874
3874
  "div",
3875
3875
  {
@@ -3925,7 +3925,7 @@ function ur({
3925
3925
  backdropFilter: "blur(4px)",
3926
3926
  WebkitBackdropFilter: "blur(4px)"
3927
3927
  },
3928
- disabled: !!((E = l == null ? void 0 : l.sourceCurrency) != null && E.locked),
3928
+ disabled: !!((N = l == null ? void 0 : l.sourceCurrency) != null && N.locked),
3929
3929
  children: [
3930
3930
  /* @__PURE__ */ e(jt, { currencyCode: n, size: 24, baseUrl: c }),
3931
3931
  /* @__PURE__ */ e("span", { className: "text-[14px] font-semibold", style: { color: "var(--t-text)", letterSpacing: "0.14px", lineHeight: "24px" }, children: n }),
@@ -4008,7 +4008,7 @@ function hr({
4008
4008
  autoSelectPending: g,
4009
4009
  rateFlash: k
4010
4010
  }) {
4011
- var y, E;
4011
+ var y, N;
4012
4012
  const R = P();
4013
4013
  return /* @__PURE__ */ e(
4014
4014
  "div",
@@ -4074,7 +4074,7 @@ function hr({
4074
4074
  backdropFilter: "blur(4px)",
4075
4075
  WebkitBackdropFilter: "blur(4px)"
4076
4076
  },
4077
- disabled: !!((E = h == null ? void 0 : h.sourceCurrency) != null && E.locked),
4077
+ disabled: !!((N = h == null ? void 0 : h.sourceCurrency) != null && N.locked),
4078
4078
  children: [
4079
4079
  /* @__PURE__ */ e(jt, { currencyCode: a, size: 24, baseUrl: l }),
4080
4080
  /* @__PURE__ */ e("span", { className: "text-[14px] font-semibold", style: { color: "var(--t-text)", letterSpacing: "0.14px", lineHeight: "24px" }, children: a }),
@@ -4084,10 +4084,10 @@ function hr({
4084
4084
  )
4085
4085
  ] }),
4086
4086
  /* @__PURE__ */ i("div", { className: "flex items-center justify-between", children: [
4087
- /* @__PURE__ */ e("div", { className: "flex items-center gap-[4px]", children: d && !g ? /* @__PURE__ */ i(Z, { children: [
4087
+ /* @__PURE__ */ e("div", { className: "flex items-center gap-[4px]", children: d && !g ? /* @__PURE__ */ i(G, { children: [
4088
4088
  /* @__PURE__ */ e(Ee, { size: 12 }),
4089
4089
  /* @__PURE__ */ e("span", { className: "text-[11px] font-medium", style: { color: "var(--t-text-muted)", letterSpacing: "0.22px", lineHeight: "12px" }, children: R("receive.fetchingRate") })
4090
- ] }) : /* @__PURE__ */ i(Z, { children: [
4090
+ ] }) : /* @__PURE__ */ i(G, { children: [
4091
4091
  /* @__PURE__ */ e("span", { className: "text-[11px] font-medium", style: { color: "var(--t-text-muted)", letterSpacing: "0.22px", lineHeight: "12px" }, children: u || " " }),
4092
4092
  u && /* @__PURE__ */ e(
4093
4093
  "button",
@@ -4142,7 +4142,7 @@ function fr({
4142
4142
  children: [
4143
4143
  /* @__PURE__ */ e("span", { className: "text-[13px] flex-1", style: { color: "var(--t-text-secondary)", letterSpacing: "0.13px", lineHeight: "20px" }, children: o("payment.label") }),
4144
4144
  /* @__PURE__ */ i("span", { className: "flex items-center gap-[6px]", children: [
4145
- t && /* @__PURE__ */ i(Z, { children: [
4145
+ t && /* @__PURE__ */ i(G, { children: [
4146
4146
  /* @__PURE__ */ e("span", { className: "flex items-center justify-center", style: { width: 20, height: 20 }, children: n(t.id, t.icon, 20) }),
4147
4147
  /* @__PURE__ */ e("span", { className: "text-[14px] font-semibold", style: { color: "var(--t-text)", letterSpacing: "0.14px", lineHeight: "16px" }, children: r(t.id, t.name) })
4148
4148
  ] }),
@@ -4179,7 +4179,7 @@ function yr({
4179
4179
  /* @__PURE__ */ i("span", { className: "flex items-center gap-[6px]", children: [
4180
4180
  a && !t && /* @__PURE__ */ e("span", { className: "text-[13px]", style: { color: "var(--t-text-muted)" }, children: "..." }),
4181
4181
  !a && !t && /* @__PURE__ */ e("span", { className: "text-[13px]", style: { color: "var(--t-text-muted)" }, children: o("provider.select") }),
4182
- t && /* @__PURE__ */ i(Z, { children: [
4182
+ t && /* @__PURE__ */ i(G, { children: [
4183
4183
  /* @__PURE__ */ e("span", { className: "flex items-center justify-center overflow-hidden rounded-full", style: { width: 20, height: 20 }, children: /* @__PURE__ */ e(
4184
4184
  "img",
4185
4185
  {
@@ -4287,12 +4287,15 @@ function Sr({
4287
4287
  selectedGatewayId: c,
4288
4288
  assetBaseUrl: u = ""
4289
4289
  }) {
4290
- const l = P(), [d, s] = w(""), h = W(() => {
4290
+ const l = P(), [d, s] = w(""), h = V(() => {
4291
4291
  if (!(n != null && n.quotes)) return [];
4292
4292
  const f = d.trim().toLowerCase();
4293
4293
  return f ? n.quotes.filter((g) => g.gatewayName.toLowerCase().includes(f)) : n.quotes;
4294
- }, [n, d]), p = h.length > 0 ? parseFloat(h[0].cryptoAmount) : 0;
4295
- return /* @__PURE__ */ i(Z, { children: [
4294
+ }, [n, d]), p = V(() => {
4295
+ const f = h.find((g) => parseFloat(g.cryptoAmount) > 0);
4296
+ return f ? parseFloat(f.cryptoAmount) : 0;
4297
+ }, [h]);
4298
+ return /* @__PURE__ */ i(G, { children: [
4296
4299
  /* @__PURE__ */ e("div", { className: "flex justify-end px-5 pt-5", children: /* @__PURE__ */ e(Oe, { onClick: t }) }),
4297
4300
  /* @__PURE__ */ e(
4298
4301
  "h2",
@@ -4305,33 +4308,35 @@ function Sr({
4305
4308
  /* @__PURE__ */ e(Ye, { value: d, onChange: s }),
4306
4309
  /* @__PURE__ */ i("div", { className: "flex-1 overflow-y-auto custom-scroll px-5 space-y-3", children: [
4307
4310
  r ? /* @__PURE__ */ e(br, {}) : h.length === 0 ? /* @__PURE__ */ e("div", { className: "text-center py-10 text-[14px]", style: { color: "var(--t-text-muted)" }, children: n && n.quotes.length === 0 ? l("modal.noQuotes") : l("modal.noProvidersFound") }) : h.map((f, g) => {
4308
- const k = g === 0, R = c === f.gatewayId, y = parseFloat(f.cryptoAmount), E = y >= 1 ? y.toFixed(4) : y.toPrecision(6), K = !k && p > 0 ? (y - p) / p * 100 : 0;
4311
+ const k = g === 0, R = c === f.gatewayId, y = parseFloat(f.cryptoAmount), N = y > 0, K = y >= 1 ? y.toFixed(4) : y.toPrecision(6), z = !k && p > 0 ? (y - p) / p * 100 : 0;
4309
4312
  return /* @__PURE__ */ i(
4310
4313
  "button",
4311
4314
  {
4312
- onClick: () => a(f),
4313
- className: "w-full flex items-center gap-3 transition-colors card-press hover-item modal-item-in",
4315
+ onClick: () => N && a(f),
4316
+ className: `w-full flex items-center gap-3 transition-colors modal-item-in${N ? " card-press hover-item" : ""}`,
4314
4317
  style: {
4315
4318
  borderRadius: "var(--t-card-radius)",
4316
4319
  padding: "12px 16px",
4317
- border: R ? "1.5px solid var(--t-accent)" : "1.5px solid transparent",
4320
+ border: R && N ? "1.5px solid var(--t-accent)" : "1.5px solid transparent",
4318
4321
  background: "var(--t-surface)",
4322
+ opacity: N ? 1 : 0.45,
4323
+ cursor: N ? "pointer" : "default",
4319
4324
  animationDelay: `${Math.min(g * 45, 350)}ms`
4320
4325
  },
4321
4326
  children: [
4322
4327
  /* @__PURE__ */ e(ya, { gatewayId: f.gatewayId, gatewayLogo: f.gatewayLogo, assetBaseUrl: u }),
4323
4328
  /* @__PURE__ */ i("div", { className: "text-left flex-1 min-w-0", children: [
4324
4329
  /* @__PURE__ */ e("div", { className: "font-medium text-[14px] leading-[18px]", style: { color: "var(--t-text)" }, children: f.gatewayName }),
4325
- /* @__PURE__ */ e(vr, { quote: f })
4330
+ N && /* @__PURE__ */ e(vr, { quote: f })
4326
4331
  ] }),
4327
- /* @__PURE__ */ i("div", { className: "text-right shrink-0", children: [
4328
- /* @__PURE__ */ e("div", { className: "text-[11px] leading-[14px]", style: { color: "var(--t-text-secondary)" }, children: k ? l("receive.label") : /* @__PURE__ */ e(Cr, { pct: K }) }),
4332
+ /* @__PURE__ */ e("div", { className: "text-right shrink-0", children: N ? /* @__PURE__ */ i(G, { children: [
4333
+ /* @__PURE__ */ e("div", { className: "text-[11px] leading-[14px]", style: { color: "var(--t-text-secondary)" }, children: k ? l("receive.label") : /* @__PURE__ */ e(Cr, { pct: z }) }),
4329
4334
  /* @__PURE__ */ i("div", { className: "font-medium text-[13px] leading-[18px]", style: { color: "var(--t-text)" }, children: [
4330
4335
  /* @__PURE__ */ e("span", { className: "text-[10px] font-normal", style: { color: "var(--t-text-secondary)" }, children: o }),
4331
4336
  " ",
4332
- E
4337
+ K
4333
4338
  ] })
4334
- ] })
4339
+ ] }) : /* @__PURE__ */ e("span", { className: "text-[11px]", style: { color: "var(--t-text-muted)" }, children: l("rate.noQuote") }) })
4335
4340
  ]
4336
4341
  },
4337
4342
  f.gatewayId
@@ -4495,7 +4500,7 @@ function Er({
4495
4500
  };
4496
4501
  return /* @__PURE__ */ i("div", { className: "px-5 py-5", children: [
4497
4502
  /* @__PURE__ */ i("div", { className: "flex items-center justify-between mb-3", children: [
4498
- /* @__PURE__ */ e("div", { className: "flex items-center gap-2", children: o ? /* @__PURE__ */ e(Ee, { size: 16 }) : /* @__PURE__ */ i(Z, { children: [
4503
+ /* @__PURE__ */ e("div", { className: "flex items-center gap-2", children: o ? /* @__PURE__ */ e(Ee, { size: 16 }) : /* @__PURE__ */ i(G, { children: [
4499
4504
  /* @__PURE__ */ e("span", { className: "text-[12px]", style: { color: "var(--t-text-muted)" }, children: c("rate.updatesInLabel") }),
4500
4505
  /* @__PURE__ */ i(
4501
4506
  "span",
@@ -4600,13 +4605,13 @@ function Rr({
4600
4605
  showFlowToggle: k = !0,
4601
4606
  showSettings: R = !0,
4602
4607
  showThemeToggle: y = !0,
4603
- autoRedirect: E = !1,
4608
+ autoRedirect: N = !1,
4604
4609
  explorerUrl: K,
4605
- doneButtonText: te,
4606
- supportEmail: z,
4610
+ doneButtonText: z,
4611
+ supportEmail: J,
4607
4612
  stablecoinParity: ie,
4608
- partnerName: J,
4609
- containerHeight: ee,
4613
+ partnerName: q,
4614
+ containerHeight: te,
4610
4615
  locale: be,
4611
4616
  onDone: ae
4612
4617
  }) {
@@ -4616,7 +4621,7 @@ function Rr({
4616
4621
  dispatch: F,
4617
4622
  config: m,
4618
4623
  configLoading: D,
4619
- quotes: N,
4624
+ quotes: E,
4620
4625
  quotesLoading: b,
4621
4626
  quotesError: ne,
4622
4627
  fetchQuotes: pe,
@@ -4630,35 +4635,35 @@ function Rr({
4630
4635
  availableCryptos: Qe,
4631
4636
  availablePaymentMethods: oe,
4632
4637
  selectionUnsupported: ye,
4633
- quotesEmpty: G,
4638
+ quotesEmpty: $,
4634
4639
  bestUnavailableReason: Ke
4635
- } = Xe(), { locale: ze, setLocale: vt } = _t(), [se, _e] = w(a === "dark"), [Le, Ct] = w(n), [de, j] = w(null), [lt, $] = w(!1), [bt, Je] = w(!1), [Fe, ct] = w(!1), [je, qe] = w(!1), [et, Ue] = w(null), [tt, St] = w(!0), [wt, st] = w(!1), [v, A] = w(!1), [T, B] = w(!1), [I, _] = w(null), [ue, ge] = w(!1), [La, kt] = w(30), [Fa, Gt] = w(!1), [Ua, $t] = w(!1), Ia = M(null), Nt = M(), Et = M(C.flowType), Ma = ee ?? 640, Zt = M(N);
4640
+ } = Xe(), { locale: ze, setLocale: vt } = _t(), [se, _e] = w(a === "dark"), [Le, Ct] = w(n), [de, j] = w(null), [lt, Z] = w(!1), [bt, Je] = w(!1), [Fe, ct] = w(!1), [je, qe] = w(!1), [et, Ue] = w(null), [tt, St] = w(!0), [wt, st] = w(!1), [v, A] = w(!1), [T, B] = w(!1), [I, _] = w(null), [ue, ge] = w(!1), [La, kt] = w(30), [Fa, Gt] = w(!1), [Ua, $t] = w(!1), Ia = M(null), Nt = M(), Et = M(C.flowType), Ma = te ?? 640, Zt = M(E);
4636
4641
  U(() => {
4637
- N && N !== Zt.current && B(!1), Zt.current = N;
4638
- }, [N]), U(() => {
4642
+ E && E !== Zt.current && B(!1), Zt.current = E;
4643
+ }, [E]), U(() => {
4639
4644
  b && !T && F({ type: "CLEAR_QUOTE" });
4640
4645
  }, [b, T, F]), U(() => {
4641
- T || v || N != null && N.bestQuote && F({ type: "SELECT_QUOTE", quote: N.bestQuote });
4642
- }, [N == null ? void 0 : N.bestQuote, T, v, F]), U(() => {
4646
+ T || v || E != null && E.bestQuote && F({ type: "SELECT_QUOTE", quote: E.bestQuote });
4647
+ }, [E == null ? void 0 : E.bestQuote, T, v, F]), U(() => {
4643
4648
  _e(a === "dark");
4644
4649
  }, [a]), U(() => {
4645
4650
  const x = setTimeout(() => St(!1), D ? 0 : 800);
4646
4651
  return () => clearTimeout(x);
4647
4652
  }, [D]), U(() => {
4648
4653
  if (Et.current !== C.flowType && !tt) {
4649
- Et.current = C.flowType, st(!0), $(!1), Je(!1);
4654
+ Et.current = C.flowType, st(!0), Z(!1), Je(!1);
4650
4655
  const x = setTimeout(() => st(!1), 350);
4651
4656
  return () => clearTimeout(x);
4652
4657
  }
4653
4658
  Et.current = C.flowType;
4654
4659
  }, [C.flowType, tt]);
4655
- const dt = C.flowType, H = dt === "buy", re = C.cryptoCurrency || "BTC", xe = C.fiatCurrency || "USD", Rt = H ? C.fiatAmount : C.cryptoAmount, q = Ln(Rt), ve = C.selectedQuote || (N == null ? void 0 : N.bestQuote) || null, we = ve != null && ve.exchangeRate ? parseFloat(ve.exchangeRate) : null, at = M(null);
4660
+ const dt = C.flowType, H = dt === "buy", re = C.cryptoCurrency || "BTC", xe = C.fiatCurrency || "USD", Rt = H ? C.fiatAmount : C.cryptoAmount, ee = Ln(Rt), ve = C.selectedQuote || (E == null ? void 0 : E.bestQuote) || null, we = ve != null && ve.exchangeRate ? parseFloat(ve.exchangeRate) : null, at = M(null);
4656
4661
  we && re && xe && (at.current = { rate: we, crypto: re, fiat: xe }), U(() => {
4657
- (G || ne) && (at.current = null);
4658
- }, [G, ne]), U(() => {
4659
- q || (ge(!1), C.selectedQuote && F({ type: "CLEAR_QUOTE" }));
4660
- }, [q, C.selectedQuote, F]);
4661
- const Ie = W(() => {
4662
+ ($ || ne) && (at.current = null);
4663
+ }, [$, ne]), U(() => {
4664
+ ee || (ge(!1), C.selectedQuote && F({ type: "CLEAR_QUOTE" }));
4665
+ }, [ee, C.selectedQuote, F]);
4666
+ const Ie = V(() => {
4662
4667
  if (ve) {
4663
4668
  const x = H ? ve.cryptoAmount : ve.fiatAmount;
4664
4669
  if (x) return x;
@@ -4673,10 +4678,10 @@ function Rr({
4673
4678
  }
4674
4679
  At.current = Ie;
4675
4680
  }, [Ie]);
4676
- const nt = !!(ie && J && H && Ea(re) && we), Da = nt && re.toUpperCase().includes(xe.toUpperCase()), Xt = nt && q > 0 ? Bt(Da ? q : q / we) : null, Ba = nt && Xt ? Xt : Ie, Ha = W(() => {
4681
+ const nt = !!(ie && q && H && Ea(re) && we), Da = nt && re.toUpperCase().includes(xe.toUpperCase()), Xt = nt && ee > 0 ? Bt(Da ? ee : ee / we) : null, Ba = nt && Xt ? Xt : Ie, Ha = V(() => {
4677
4682
  var Y, De, Ge;
4678
- const x = we || ((Y = at.current) == null ? void 0 : Y.rate), S = we ? re : (De = at.current) == null ? void 0 : De.crypto, V = we ? xe : (Ge = at.current) == null ? void 0 : Ge.fiat;
4679
- return !x || !S || !V ? "" : `1 ${S} ≈ ${x.toFixed(2)} ${V}`;
4683
+ const x = we || ((Y = at.current) == null ? void 0 : Y.rate), S = we ? re : (De = at.current) == null ? void 0 : De.crypto, W = we ? xe : (Ge = at.current) == null ? void 0 : Ge.fiat;
4684
+ return !x || !S || !W ? "" : `1 ${S} ≈ ${x.toFixed(2)} ${W}`;
4680
4685
  }, [re, xe, we]);
4681
4686
  U(() => {
4682
4687
  const x = C.walletAddress.trim(), S = C.network;
@@ -4685,7 +4690,7 @@ function Rr({
4685
4690
  return;
4686
4691
  }
4687
4692
  qe(!0), Ue(null);
4688
- const V = new AbortController();
4693
+ const W = new AbortController();
4689
4694
  return clearTimeout(Nt.current), Nt.current = setTimeout(async () => {
4690
4695
  var Y, De, Ge;
4691
4696
  try {
@@ -4693,7 +4698,7 @@ function Rr({
4693
4698
  method: "POST",
4694
4699
  headers: { "Content-Type": "application/json" },
4695
4700
  body: JSON.stringify({ address: x, ...S ? { network: S } : {} }),
4696
- signal: V.signal
4701
+ signal: W.signal
4697
4702
  })).json(), It = ((Y = Ut.data) == null ? void 0 : Y.attributes) || Ut.data || Ut;
4698
4703
  if (It.isValid)
4699
4704
  Ue(!0), F({ type: "SET_WALLET_ERROR", message: "" });
@@ -4706,16 +4711,16 @@ function Rr({
4706
4711
  if (Ft instanceof DOMException && Ft.name === "AbortError") return;
4707
4712
  Ue(null);
4708
4713
  } finally {
4709
- V.signal.aborted || qe(!1);
4714
+ W.signal.aborted || qe(!1);
4710
4715
  }
4711
4716
  }, 500), () => {
4712
- clearTimeout(Nt.current), V.abort();
4717
+ clearTimeout(Nt.current), W.abort();
4713
4718
  };
4714
4719
  }, [C.walletAddress, C.network, ce.apiUrl]);
4715
- const ut = !Rt || q === 0, Tt = q > 0 && (H ? q < ua : q < ma), Pa = !!he || Tt || lt && ut, Oa = q > 0 && !he && !Tt, Yt = C.walletAddress.trim().length >= 10 && et !== !1 && !je, Qt = Oa && (H ? Yt : !0) && !!C.cryptoCurrency && !!C.network, Ka = (x) => {
4720
+ const ut = !Rt || ee === 0, Tt = ee > 0 && (H ? ee < ua : ee < ma), Pa = !!he || Tt || lt && ut, Oa = ee > 0 && !he && !Tt, Yt = C.walletAddress.trim().length >= 10 && et !== !1 && !je, Qt = Oa && (H ? Yt : !0) && !!C.cryptoCurrency && !!C.network, Ka = (x) => {
4716
4721
  let S = x.target.value.replace(/[^0-9.,]/g, "");
4717
- const V = H ? 2 : 6, Y = S.indexOf(".");
4718
- Y !== -1 && S.length - Y - 1 > V && (S = S.slice(0, Y + V + 1)), F(H ? { type: "SET_FIAT_AMOUNT", amount: S } : { type: "SET_CRYPTO_AMOUNT", amount: S });
4722
+ const W = H ? 2 : 6, Y = S.indexOf(".");
4723
+ Y !== -1 && S.length - Y - 1 > W && (S = S.slice(0, Y + W + 1)), F(H ? { type: "SET_FIAT_AMOUNT", amount: S } : { type: "SET_CRYPTO_AMOUNT", amount: S });
4719
4724
  }, _a = (x) => {
4720
4725
  x !== dt && F({ type: "SET_FLOW_TYPE", flowType: x, fieldLocks: le });
4721
4726
  }, ja = O(
@@ -4744,7 +4749,7 @@ function Rr({
4744
4749
  j(null), setTimeout(() => j("language"), 280);
4745
4750
  }, []), Xa = C.country ? (na = Ot[C.country.toLowerCase()]) == null ? void 0 : na.name : void 0, Ya = () => {
4746
4751
  if (!Qt) {
4747
- (Pa || ut) && ($(!0), $t(!0), setTimeout(() => $t(!1), 400));
4752
+ (Pa || ut) && (Z(!0), $t(!0), setTimeout(() => $t(!1), 400));
4748
4753
  return;
4749
4754
  }
4750
4755
  if (C.selectedQuote) {
@@ -4758,21 +4763,21 @@ function Rr({
4758
4763
  U(() => {
4759
4764
  var x;
4760
4765
  if (!(!v || b)) {
4761
- if (N != null && N.bestQuote)
4762
- A(!1), F({ type: "SELECT_QUOTE", quote: N.bestQuote }), Se().catch((S) => {
4766
+ if (E != null && E.bestQuote)
4767
+ A(!1), F({ type: "SELECT_QUOTE", quote: E.bestQuote }), Se().catch((S) => {
4763
4768
  _({ type: "error", title: L("toast.orderFailed"), desc: S instanceof Error ? S.message : L("toast.couldNotCreate") });
4764
4769
  });
4765
4770
  else if (ne) {
4766
4771
  A(!1);
4767
4772
  const S = ne.message || L("error.noProviders");
4768
4773
  F({ type: "SET_ERROR", message: S }), _({ type: "error", title: L("toast.quoteError"), desc: S });
4769
- } else if (N && !N.bestQuote) {
4774
+ } else if (E && !E.bestQuote) {
4770
4775
  A(!1);
4771
- const S = (x = N.unavailableGateways) == null ? void 0 : x.map((Y) => Y.reason).filter(Boolean), V = S != null && S.length ? `${L("error.noProviders")}: ${S.join("; ")}` : L("error.noProviders");
4772
- F({ type: "SET_ERROR", message: V }), _({ type: "error", title: L("toast.noProviders"), desc: V });
4776
+ const S = (x = E.unavailableGateways) == null ? void 0 : x.map((Y) => Y.reason).filter(Boolean), W = S != null && S.length ? `${L("error.noProviders")}: ${S.join("; ")}` : L("error.noProviders");
4777
+ F({ type: "SET_ERROR", message: W }), _({ type: "error", title: L("toast.noProviders"), desc: W });
4773
4778
  }
4774
4779
  }
4775
- }, [v, N, b, ne, F, Se]);
4780
+ }, [v, E, b, ne, F, Se]);
4776
4781
  const zt = M(C.step);
4777
4782
  U(() => {
4778
4783
  const x = zt.current;
@@ -4792,8 +4797,8 @@ function Rr({
4792
4797
  ue && Ve && !b && kt(30);
4793
4798
  }, [b, ue, Ve]);
4794
4799
  const Jt = se ? "theme-dark" : "theme-light", mt = sa.find((x) => x.id === Le) || sa[0], Qa = mt.accent === null, za = r ? Ce(r) : !1, qt = (x) => {
4795
- const S = x.replace("#", ""), V = parseInt(S.substring(0, 2), 16), Y = parseInt(S.substring(2, 4), 16), De = parseInt(S.substring(4, 6), 16);
4796
- return (0.299 * V + 0.587 * Y + 0.114 * De) / 255 > 0.5 ? "#000000" : "#ffffff";
4800
+ const S = x.replace("#", ""), W = parseInt(S.substring(0, 2), 16), Y = parseInt(S.substring(2, 4), 16), De = parseInt(S.substring(4, 6), 16);
4801
+ return (0.299 * W + 0.587 * Y + 0.114 * De) / 255 > 0.5 ? "#000000" : "#ffffff";
4797
4802
  }, ea = za ? { "--t-accent": r, "--t-cta-bg": r, "--t-cta-text": qt(r) } : Qa ? {
4798
4803
  "--t-accent": se ? "#ffffff" : "#111111",
4799
4804
  "--t-cta-bg": se ? "#ffffff" : "#111111",
@@ -4808,7 +4813,7 @@ function Rr({
4808
4813
  o && Ce(o) ? Me.backgroundColor = o : Me.backgroundColor = "var(--t-bg)", c && (c.startsWith("https://") || c.startsWith("data:image/")) && (Me.backgroundImage = `url(${c})`, Me.backgroundSize = "cover", Me.backgroundPosition = "center");
4809
4814
  const pt = {};
4810
4815
  u && Ce(u) && (pt.border = `1px solid ${u}`), l && (pt.borderRadius = l);
4811
- const rt = C.network, We = rt ? yt(rt) : null, ta = (We == null ? void 0 : We.shortName) || (We == null ? void 0 : We.name) || rt, Ja = he || (lt && (Tt || ut) ? ut ? L("error.amountZero") : H ? L("error.minAmountFiat", { min: String(ua), currency: xe }) : L("error.minAmountCrypto", { min: String(ma), currency: re }) : void 0), qa = C.walletError ? C.walletError : bt && !Yt && !je ? L("wallet.invalid") : void 0, Lt = oe.filter((x) => x.supportedFiats.includes(C.fiatCurrency)), en = Lt.find((x) => x.id === C.paymentMethodId) || Lt[0], aa = C.step === "checkout" ? /* @__PURE__ */ e(bn, { autoRedirect: E }) : C.step === "processing" ? /* @__PURE__ */ e(wn, {}) : C.step === "complete" ? /* @__PURE__ */ e(kn, { explorerUrl: K, doneButtonText: te, onDone: ae }) : C.step === "error" ? /* @__PURE__ */ e(Nn, { supportEmail: z, onDone: ae, doneButtonText: te }) : C.step === "confirm" ? /* @__PURE__ */ e(Un, { stablecoinParity: nt, partnerName: J }) : null;
4816
+ const rt = C.network, We = rt ? yt(rt) : null, ta = (We == null ? void 0 : We.shortName) || (We == null ? void 0 : We.name) || rt, Ja = he || (lt && (Tt || ut) ? ut ? L("error.amountZero") : H ? L("error.minAmountFiat", { min: String(ua), currency: xe }) : L("error.minAmountCrypto", { min: String(ma), currency: re }) : void 0), qa = C.walletError ? C.walletError : bt && !Yt && !je ? L("wallet.invalid") : void 0, Lt = oe.filter((x) => x.supportedFiats.includes(C.fiatCurrency)), en = Lt.find((x) => x.id === C.paymentMethodId) || Lt[0], aa = C.step === "checkout" ? /* @__PURE__ */ e(bn, { autoRedirect: N }) : C.step === "processing" ? /* @__PURE__ */ e(wn, {}) : C.step === "complete" ? /* @__PURE__ */ e(kn, { explorerUrl: K, doneButtonText: z, onDone: ae }) : C.step === "error" ? /* @__PURE__ */ e(Nn, { supportEmail: J, onDone: ae, doneButtonText: z }) : C.step === "confirm" ? /* @__PURE__ */ e(Un, { stablecoinParity: nt, partnerName: q }) : null;
4812
4817
  return aa ? /* @__PURE__ */ e(
4813
4818
  "div",
4814
4819
  {
@@ -4861,7 +4866,7 @@ function Rr({
4861
4866
  assetBaseUrl: X,
4862
4867
  error: Ja,
4863
4868
  fieldLocks: le,
4864
- onBlur: () => $(!0),
4869
+ onBlur: () => Z(!0),
4865
4870
  inputRef: Ia,
4866
4871
  chainCode: H ? void 0 : rt,
4867
4872
  chainDisplay: H ? void 0 : ta,
@@ -4882,16 +4887,16 @@ function Rr({
4882
4887
  assetBaseUrl: X,
4883
4888
  quotesLoading: b,
4884
4889
  onOpenRateBreakdown: () => {
4885
- q > 0 && ge(!0);
4890
+ ee > 0 && ge(!0);
4886
4891
  },
4887
4892
  fieldLocks: le,
4888
- spendNumeric: q,
4893
+ spendNumeric: ee,
4889
4894
  getChainIconUrl: H ? Dt : void 0,
4890
4895
  autoSelectPending: v,
4891
4896
  rateFlash: Fa
4892
4897
  }
4893
4898
  ),
4894
- G && q > 0 && /* @__PURE__ */ e(
4899
+ $ && ee > 0 && /* @__PURE__ */ e(
4895
4900
  "div",
4896
4901
  {
4897
4902
  className: "px-4 py-2.5 mt-1",
@@ -4899,7 +4904,7 @@ function Rr({
4899
4904
  children: Ke || L("error.noProviders")
4900
4905
  }
4901
4906
  ),
4902
- nt && q > 0 && (N == null ? void 0 : N.bestQuote) && /* @__PURE__ */ i(
4907
+ nt && ee > 0 && (E == null ? void 0 : E.bestQuote) && /* @__PURE__ */ i(
4903
4908
  "div",
4904
4909
  {
4905
4910
  className: "flex items-start gap-2 mt-1 px-4 py-2.5",
@@ -4909,11 +4914,11 @@ function Rr({
4909
4914
  /* @__PURE__ */ e("circle", { cx: "8", cy: "8", r: "7", stroke: "currentColor", strokeWidth: "1.5" }),
4910
4915
  /* @__PURE__ */ e("path", { d: "M8 7v4M8 5.5v-.01", stroke: "currentColor", strokeWidth: "1.5", strokeLinecap: "round" })
4911
4916
  ] }),
4912
- /* @__PURE__ */ e("span", { children: L("parity.info", { receiveAmount: Ie, crypto: re, spendAmount: Bt(q), fiat: xe, partner: J || "" }) })
4917
+ /* @__PURE__ */ e("span", { children: L("parity.info", { receiveAmount: Ie, crypto: re, spendAmount: Bt(ee), fiat: xe, partner: q || "" }) })
4913
4918
  ]
4914
4919
  }
4915
4920
  ),
4916
- (N || b) && /* @__PURE__ */ e(
4921
+ (E || b) && /* @__PURE__ */ e(
4917
4922
  yr,
4918
4923
  {
4919
4924
  selectedQuote: C.selectedQuote,
@@ -4967,7 +4972,7 @@ function Rr({
4967
4972
  kr,
4968
4973
  {
4969
4974
  label: H ? L("cta.buy", { crypto: re }) : L("cta.sell", { crypto: re }),
4970
- disabled: !Qt || Te || v || ye || G,
4975
+ disabled: !Qt || Te || v || ye || $,
4971
4976
  loading: Te || v,
4972
4977
  onClick: Ya
4973
4978
  }
@@ -5011,15 +5016,15 @@ function Rr({
5011
5016
  zn,
5012
5017
  {
5013
5018
  onClose: x,
5014
- onSelect: (S, V) => {
5015
- Va(S, V), x();
5019
+ onSelect: (S, W) => {
5020
+ Va(S, W), x();
5016
5021
  },
5017
5022
  cryptos: Qe.map((S) => {
5018
- var V;
5023
+ var W;
5019
5024
  return {
5020
5025
  code: S.code,
5021
5026
  name: S.code,
5022
- networks: (V = S.networks) == null ? void 0 : V.map((Y) => ({ code: Y.id, name: Y.name }))
5027
+ networks: (W = S.networks) == null ? void 0 : W.map((Y) => ({ code: Y.id, name: Y.name }))
5023
5028
  };
5024
5029
  }),
5025
5030
  assetBaseUrl: X,
@@ -5041,7 +5046,7 @@ function Rr({
5041
5046
  /* @__PURE__ */ e(Pe, { isOpen: de === "provider", onClose: () => j(null), children: (x) => /* @__PURE__ */ e(
5042
5047
  Sr,
5043
5048
  {
5044
- quotes: N,
5049
+ quotes: E,
5045
5050
  quotesLoading: b,
5046
5051
  cryptoCurrency: re,
5047
5052
  selectedGatewayId: C.selectedProvider,
@@ -5113,13 +5118,13 @@ function Ar({
5113
5118
  fieldLocks: k,
5114
5119
  partnerMetadata: R,
5115
5120
  statusPollInterval: y,
5116
- onComplete: E,
5121
+ onComplete: N,
5117
5122
  onError: K,
5118
- className: te,
5119
- theme: z,
5123
+ className: z,
5124
+ theme: J,
5120
5125
  skinId: ie,
5121
- accentColor: J,
5122
- bgColor: ee,
5126
+ accentColor: q,
5127
+ bgColor: te,
5123
5128
  bgImage: be,
5124
5129
  borderColor: ae,
5125
5130
  borderRadius: L,
@@ -5127,7 +5132,7 @@ function Ar({
5127
5132
  inputBgColor: F,
5128
5133
  textColor: m,
5129
5134
  textSecondaryColor: D,
5130
- textMutedColor: N,
5135
+ textMutedColor: E,
5131
5136
  successColor: b,
5132
5137
  showFlowToggle: ne,
5133
5138
  showSettings: pe,
@@ -5162,16 +5167,16 @@ function Ar({
5162
5167
  fieldLocks: k,
5163
5168
  partnerMetadata: R,
5164
5169
  statusPollInterval: y,
5165
- onComplete: E,
5170
+ onComplete: N,
5166
5171
  onError: K,
5167
5172
  children: /* @__PURE__ */ e(vn, { defaultLocale: oe || "en", children: /* @__PURE__ */ e(
5168
5173
  Rr,
5169
5174
  {
5170
- className: te,
5171
- theme: z,
5175
+ className: z,
5176
+ theme: J,
5172
5177
  skinId: ie,
5173
- accentColor: J,
5174
- bgColor: ee,
5178
+ accentColor: q,
5179
+ bgColor: te,
5175
5180
  bgImage: be,
5176
5181
  borderColor: ae,
5177
5182
  borderRadius: L,
@@ -5179,7 +5184,7 @@ function Ar({
5179
5184
  inputBgColor: F,
5180
5185
  textColor: m,
5181
5186
  textSecondaryColor: D,
5182
- textMutedColor: N,
5187
+ textMutedColor: E,
5183
5188
  successColor: b,
5184
5189
  showFlowToggle: ne,
5185
5190
  showSettings: pe,