@chainrails/react 0.2.12 → 0.2.15

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.
@@ -1,4 +1,4 @@
1
- import { useState as O, useRef as re, useEffect as k, useMemo as ye, useSyncExternalStore as Tt, useCallback as At, useLayoutEffect as vt, useDebugValue as Pt } from "react";
1
+ import { useState as I, useRef as re, useEffect as C, useMemo as ye, useSyncExternalStore as Rt, useCallback as At, useLayoutEffect as vt, useDebugValue as Pt } from "react";
2
2
  import { jsxs as we, jsx as B } from "react/jsx-runtime";
3
3
  import './index.css';class G extends Error {
4
4
  response;
@@ -50,7 +50,7 @@ const be = (() => {
50
50
  throw r;
51
51
  }
52
52
  return e && !t;
53
- })(), It = typeof globalThis.AbortController == "function", Be = typeof globalThis.AbortSignal == "function" && typeof globalThis.AbortSignal.any == "function", Ut = typeof globalThis.ReadableStream == "function", Ct = typeof globalThis.FormData == "function", $e = ["get", "post", "put", "patch", "head", "delete"], xt = {
53
+ })(), It = typeof globalThis.AbortController == "function", Be = typeof globalThis.AbortSignal == "function" && typeof globalThis.AbortSignal.any == "function", Ut = typeof globalThis.ReadableStream == "function", Ct = typeof globalThis.FormData == "function", $e = ["get", "post", "put", "patch", "head", "delete"], kt = {
54
54
  json: "application/json",
55
55
  text: "text/*",
56
56
  formData: "multipart/form-data",
@@ -59,7 +59,7 @@ const be = (() => {
59
59
  // Supported in modern Fetch implementations (for example, browsers and recent Node.js/undici).
60
60
  // We still feature-check at runtime before exposing the shortcut.
61
61
  bytes: "*/*"
62
- }, W = 2147483647, kt = new TextEncoder().encode("------WebKitFormBoundaryaxpyiPgbbPti10Rw").length, ze = Symbol("stop");
62
+ }, W = 2147483647, xt = new TextEncoder().encode("------WebKitFormBoundaryaxpyiPgbbPti10Rw").length, ze = Symbol("stop");
63
63
  class Le {
64
64
  options;
65
65
  constructor(t) {
@@ -104,7 +104,7 @@ const Dt = (e) => new Le(e), Ot = {
104
104
  if (e instanceof FormData) {
105
105
  let t = 0;
106
106
  for (const [s, n] of e)
107
- t += kt, t += new TextEncoder().encode(`Content-Disposition: form-data; name="${s}"`).length, t += typeof n == "string" ? new TextEncoder().encode(n).length : n.size;
107
+ t += xt, t += new TextEncoder().encode(`Content-Disposition: form-data; name="${s}"`).length, t += typeof n == "string" ? new TextEncoder().encode(n).length : n.size;
108
108
  return t;
109
109
  }
110
110
  if (e instanceof Blob)
@@ -332,7 +332,7 @@ class N {
332
332
  const o = n.#o, a = [];
333
333
  o && !o.bodyUsed && a.push(o.body?.cancel()), n.request.bodyUsed || a.push(n.request.body?.cancel()), await Promise.all(a);
334
334
  });
335
- for (const [o, a] of Object.entries(xt))
335
+ for (const [o, a] of Object.entries(kt))
336
336
  o === "bytes" && typeof globalThis.Response?.prototype?.bytes != "function" || (i[o] = async () => {
337
337
  n.request.headers.set("accept", n.request.headers.get("accept") || a);
338
338
  const c = await i;
@@ -707,7 +707,7 @@ function os(e, t = {}) {
707
707
  const s = new Uint8Array(1);
708
708
  return s[0] = Number(e), typeof t.size == "number" ? (ae(s, { size: t.size }), H(s, { size: t.size })) : s;
709
709
  }
710
- const R = {
710
+ const T = {
711
711
  zero: 48,
712
712
  nine: 57,
713
713
  A: 65,
@@ -715,13 +715,13 @@ const R = {
715
715
  a: 97,
716
716
  f: 102
717
717
  };
718
- function Re(e) {
719
- if (e >= R.zero && e <= R.nine)
720
- return e - R.zero;
721
- if (e >= R.A && e <= R.F)
722
- return e - (R.A - 10);
723
- if (e >= R.a && e <= R.f)
724
- return e - (R.a - 10);
718
+ function Te(e) {
719
+ if (e >= T.zero && e <= T.nine)
720
+ return e - T.zero;
721
+ if (e >= T.A && e <= T.F)
722
+ return e - (T.A - 10);
723
+ if (e >= T.a && e <= T.f)
724
+ return e - (T.a - 10);
725
725
  }
726
726
  function st(e, t = {}) {
727
727
  let s = e;
@@ -730,7 +730,7 @@ function st(e, t = {}) {
730
730
  n.length % 2 && (n = `0${n}`);
731
731
  const r = n.length / 2, i = new Uint8Array(r);
732
732
  for (let o = 0, a = 0; o < r; o++) {
733
- const c = Re(n.charCodeAt(a++)), u = Re(n.charCodeAt(a++));
733
+ const c = Te(n.charCodeAt(a++)), u = Te(n.charCodeAt(a++));
734
734
  if (c === void 0 || u === void 0)
735
735
  throw new v(`Invalid byte sequence ("${n[a - 2]}${n[a - 1]}" in "${n}").`);
736
736
  i[o] = c * 16 + u;
@@ -745,9 +745,9 @@ function nt(e, t = {}) {
745
745
  const s = ns.encode(e);
746
746
  return typeof t.size == "number" ? (ae(s, { size: t.size }), H(s, { dir: "right", size: t.size })) : s;
747
747
  }
748
- const L = /* @__PURE__ */ BigInt(2 ** 32 - 1), Te = /* @__PURE__ */ BigInt(32);
748
+ const L = /* @__PURE__ */ BigInt(2 ** 32 - 1), Re = /* @__PURE__ */ BigInt(32);
749
749
  function as(e, t = !1) {
750
- return t ? { h: Number(e & L), l: Number(e >> Te & L) } : { h: Number(e >> Te & L) | 0, l: Number(e & L) | 0 };
750
+ return t ? { h: Number(e & L), l: Number(e >> Re & L) } : { h: Number(e >> Re & L) | 0, l: Number(e & L) | 0 };
751
751
  }
752
752
  function cs(e, t = !1) {
753
753
  const s = e.length;
@@ -816,12 +816,12 @@ function Ss(e) {
816
816
  const t = (n) => e().update(ot(n)).digest(), s = e();
817
817
  return t.outputLen = s.outputLen, t.blockLen = s.blockLen, t.create = () => e(), t;
818
818
  }
819
- const Rs = BigInt(0), C = BigInt(1), Ts = BigInt(2), As = BigInt(7), vs = BigInt(256), Ps = BigInt(113), it = [], at = [], ct = [];
820
- for (let e = 0, t = C, s = 1, n = 0; e < 24; e++) {
819
+ const Ts = BigInt(0), x = BigInt(1), Rs = BigInt(2), As = BigInt(7), vs = BigInt(256), Ps = BigInt(113), it = [], at = [], ct = [];
820
+ for (let e = 0, t = x, s = 1, n = 0; e < 24; e++) {
821
821
  [s, n] = [n, (2 * s + 3 * n) % 5], it.push(2 * (5 * n + s)), at.push((e + 1) * (e + 2) / 2 % 64);
822
- let r = Rs;
822
+ let r = Ts;
823
823
  for (let i = 0; i < 7; i++)
824
- t = (t << C ^ (t >> As) * Ps) % vs, t & Ts && (r ^= C << (C << /* @__PURE__ */ BigInt(i)) - C);
824
+ t = (t << x ^ (t >> As) * Ps) % vs, t & Rs && (r ^= x << (x << /* @__PURE__ */ BigInt(i)) - x);
825
825
  ct.push(r);
826
826
  }
827
827
  const ut = cs(ct, !0), Is = ut[0], Us = ut[1], Ie = (e, t, s) => s > 32 ? fs(e, t, s) : us(e, t, s), Ue = (e, t, s) => s > 32 ? hs(e, t, s) : ls(e, t, s);
@@ -831,9 +831,9 @@ function Cs(e, t = 24) {
831
831
  for (let o = 0; o < 10; o++)
832
832
  s[o] = e[o] ^ e[o + 10] ^ e[o + 20] ^ e[o + 30] ^ e[o + 40];
833
833
  for (let o = 0; o < 10; o += 2) {
834
- const a = (o + 8) % 10, c = (o + 2) % 10, u = s[c], l = s[c + 1], w = Ie(u, l, 1) ^ s[a], m = Ue(u, l, 1) ^ s[a + 1];
834
+ const a = (o + 8) % 10, c = (o + 2) % 10, u = s[c], l = s[c + 1], w = Ie(u, l, 1) ^ s[a], p = Ue(u, l, 1) ^ s[a + 1];
835
835
  for (let y = 0; y < 50; y += 10)
836
- e[o + y] ^= w, e[o + y + 1] ^= m;
836
+ e[o + y] ^= w, e[o + y + 1] ^= p;
837
837
  }
838
838
  let r = e[2], i = e[3];
839
839
  for (let o = 0; o < 24; o++) {
@@ -915,9 +915,9 @@ class ce extends Es {
915
915
  return t || (t = new ce(s, n, r, o, i)), t.state32.set(this.state32), t.pos = this.pos, t.posOut = this.posOut, t.finished = this.finished, t.rounds = i, t.suffix = n, t.outputLen = r, t.enableXOF = o, t.destroyed = this.destroyed, t;
916
916
  }
917
917
  }
918
- const xs = (e, t, s) => Ss(() => new ce(t, e, s)), ks = xs(1, 136, 256 / 8);
918
+ const ks = (e, t, s) => Ss(() => new ce(t, e, s)), xs = ks(1, 136, 256 / 8);
919
919
  function Ds(e, t) {
920
- return ks(ie(e, { strict: !1 }) ? rs(e) : e);
920
+ return xs(ie(e, { strict: !1 }) ? rs(e) : e);
921
921
  }
922
922
  class Os extends v {
923
923
  constructor({ address: t }) {
@@ -961,7 +961,7 @@ function ft(e, t) {
961
961
  const i = `0x${r.join("")}`;
962
962
  return Y.set(`${e}.${t}`, i), i;
963
963
  }
964
- function T(e, t) {
964
+ function R(e, t) {
965
965
  if (!Ms(e, { strict: !1 }))
966
966
  throw new Os({ address: e });
967
967
  return ft(e, t);
@@ -976,7 +976,7 @@ function Ms(e, t) {
976
976
  }
977
977
  const Bs = {
978
978
  chainId: He.chainId,
979
- address: T("0x75faf114eafb1BDbe2F0316DF893fd58CE46AA4d"),
979
+ address: R("0x75faf114eafb1BDbe2F0316DF893fd58CE46AA4d"),
980
980
  symbol: "USDC",
981
981
  fiatISO: "USD",
982
982
  decimals: 6,
@@ -984,7 +984,7 @@ const Bs = {
984
984
  logoSourceURI: "https://pay.daimo.com/coin-logos/usdc.png"
985
985
  }, $s = {
986
986
  chainId: Fe.chainId,
987
- address: T("0xaf88d065e77c8cC2239327C5EDb3A432268e5831"),
987
+ address: R("0xaf88d065e77c8cC2239327C5EDb3A432268e5831"),
988
988
  symbol: "USDC",
989
989
  name: "USD Coin",
990
990
  decimals: 6,
@@ -992,7 +992,7 @@ const Bs = {
992
992
  /* USDC */
993
993
  }, zs = {
994
994
  chainId: Ge.chainId,
995
- address: T("0x5425890298aed601595a70ab815c96711a31bc65"),
995
+ address: R("0x5425890298aed601595a70ab815c96711a31bc65"),
996
996
  symbol: "USDC",
997
997
  fiatISO: "USD",
998
998
  decimals: 6,
@@ -1000,7 +1000,7 @@ const Bs = {
1000
1000
  logoSourceURI: "https://pay.daimo.com/coin-logos/usdc.png"
1001
1001
  }, Ls = {
1002
1002
  chainId: Je.chainId,
1003
- address: T("0xB97EF9Ef8734C71904D8002F8b6Bc66Dd9c48a6E"),
1003
+ address: R("0xB97EF9Ef8734C71904D8002F8b6Bc66Dd9c48a6E"),
1004
1004
  symbol: "USDC",
1005
1005
  fiatISO: "USD",
1006
1006
  decimals: 6,
@@ -1008,7 +1008,7 @@ const Bs = {
1008
1008
  logoSourceURI: "https://pay.daimo.com/coin-logos/usdc.png"
1009
1009
  }, js = {
1010
1010
  chainId: We.chainId,
1011
- address: T("0x036CbD53842c5426634e7929541eC2318f3dCF7e"),
1011
+ address: R("0x036CbD53842c5426634e7929541eC2318f3dCF7e"),
1012
1012
  symbol: "USDC",
1013
1013
  fiatISO: "USD",
1014
1014
  decimals: 6,
@@ -1016,7 +1016,7 @@ const Bs = {
1016
1016
  logoSourceURI: "https://pay.daimo.com/coin-logos/usdc.png"
1017
1017
  }, qs = {
1018
1018
  chainId: Ke.chainId,
1019
- address: T("0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913"),
1019
+ address: R("0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913"),
1020
1020
  symbol: "USDC",
1021
1021
  fiatISO: "USD",
1022
1022
  decimals: 6,
@@ -1024,21 +1024,21 @@ const Bs = {
1024
1024
  logoSourceURI: "https://pay.daimo.com/coin-logos/usdc.png"
1025
1025
  }, _s = {
1026
1026
  chainId: Ve.chainId,
1027
- address: T("0x8AC76a51cc950d9822D68b83fE1Ad97B32Cd580d"),
1027
+ address: R("0x8AC76a51cc950d9822D68b83fE1Ad97B32Cd580d"),
1028
1028
  symbol: "USDC",
1029
1029
  decimals: 18,
1030
1030
  logoURI: "https://pay.daimo.com/coin-logos/usdc.png",
1031
1031
  logoSourceURI: "https://pay.daimo.com/coin-logos/usdc.png"
1032
1032
  }, Fs = {
1033
1033
  chainId: Xe.chainId,
1034
- address: T("0x1c7D4B196Cb0C7B01d743Fbc6116a902379C7238"),
1034
+ address: R("0x1c7D4B196Cb0C7B01d743Fbc6116a902379C7238"),
1035
1035
  symbol: "USDC",
1036
1036
  decimals: 6,
1037
1037
  logoURI: "https://pay.daimo.com/coin-logos/usdc.png",
1038
1038
  logoSourceURI: "https://pay.daimo.com/coin-logos/usdc.png"
1039
1039
  }, Hs = {
1040
1040
  chainId: Ye.chainId,
1041
- address: T("0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48"),
1041
+ address: R("0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48"),
1042
1042
  symbol: "USDC",
1043
1043
  decimals: 6,
1044
1044
  logoURI: "https://pay.daimo.com/coin-logos/usdc.png",
@@ -1176,8 +1176,8 @@ class h {
1176
1176
  static getPayModalUrl(t) {
1177
1177
  if (!h.app)
1178
1178
  throw new Error("Chainrails SDK not configured. Please call Chainrails.config() first.");
1179
- const s = h.app.env === "internal" ? "https://chainrails-frontend-git-staging-horus-labs.vercel.app" : "https://app.chainrails.io", n = t && t > 0 ? "/pay/" : "/deposit/", r = `${t && t > 0 ? t * 100 : ""}`;
1180
- return s + n + r;
1179
+ const s = h.app.env === "internal" ? "https://chainrails-frontend-git-staging-horus-labs.vercel.app" : "https://app.chainrails.io", n = Number(t), r = t && !isNaN(Number(t)) && n > 0 ? "/pay/" : "/deposit/", i = `${t && !isNaN(Number(t)) && n > 0 ? n * 100 : ""}`;
1180
+ return s + r + i;
1181
1181
  }
1182
1182
  }
1183
1183
  let te = null;
@@ -1201,83 +1201,83 @@ function Ys() {
1201
1201
  }
1202
1202
  });
1203
1203
  }
1204
- function g() {
1204
+ function m() {
1205
1205
  return te || Ys(), te;
1206
1206
  }
1207
1207
  class Xs {
1208
1208
  async getById(t) {
1209
- return await g().get("intents/" + t).json();
1209
+ return await m().get("intents/" + t).json();
1210
1210
  }
1211
1211
  async getForSender(t) {
1212
- return await g().get("intents/user/" + t).json();
1212
+ return await m().get("intents/user/" + t).json();
1213
1213
  }
1214
1214
  async getForAddress(t) {
1215
- return await g().get("intents/address/" + t).json();
1215
+ return await m().get("intents/address/" + t).json();
1216
1216
  }
1217
1217
  async getForSession(t) {
1218
- return await g().get("modal/sessions/intents/" + t).json();
1218
+ return await m().get("modal/sessions/intents/" + t).json();
1219
1219
  }
1220
1220
  async getAll(t) {
1221
- return await g().get("intents", { searchParams: t }).json();
1221
+ return await m().get("intents", { searchParams: t }).json();
1222
1222
  }
1223
1223
  async create(t) {
1224
- return await g().post("intents", { json: t }).json();
1224
+ return await m().post("intents", { json: t }).json();
1225
1225
  }
1226
1226
  async createForSession(t) {
1227
- return await g().post("modal/sessions/intents", { json: t }).json();
1227
+ return await m().post("modal/sessions/intents", { json: t }).json();
1228
1228
  }
1229
1229
  async update(t, s) {
1230
- return await g().post("intents", { json: s }).json();
1230
+ return await m().post("intents", { json: s }).json();
1231
1231
  }
1232
1232
  async triggerProcessing(t) {
1233
- return await g().post(`intents/${t}/trigger-processing`).json();
1233
+ return await m().post(`intents/${t}/trigger-processing`).json();
1234
1234
  }
1235
1235
  async triggerProcessingForSession(t) {
1236
- return await g().post(`modal/sessions/intents/${t}/process`).json();
1236
+ return await m().post(`modal/sessions/intents/${t}/process`).json();
1237
1237
  }
1238
1238
  }
1239
1239
  class Js {
1240
1240
  async getFromSpecificBridge(t) {
1241
- return await g().get("quotes/single", { searchParams: t }).json();
1241
+ return await m().get("quotes/single", { searchParams: t }).json();
1242
1242
  }
1243
1243
  async getFromAllBridges(t) {
1244
- return await g().get("quotes/multiple", { searchParams: t }).json();
1244
+ return await m().get("quotes/multiple", { searchParams: t }).json();
1245
1245
  }
1246
1246
  async getBestAcrossBridges(t) {
1247
- return await g().get("quotes/best", { searchParams: t }).json();
1247
+ return await m().get("quotes/best", { searchParams: t }).json();
1248
1248
  }
1249
1249
  async getAll(t) {
1250
- return await g().get("quotes/multi-source", { searchParams: t }).json();
1250
+ return await m().get("quotes/multi-source", { searchParams: t }).json();
1251
1251
  }
1252
1252
  async getAllForSession(t) {
1253
- return await g().get("modal/sessions/quotes", { searchParams: t }).json();
1253
+ return await m().get("modal/sessions/quotes", { searchParams: t }).json();
1254
1254
  }
1255
1255
  }
1256
1256
  class Gs {
1257
1257
  async getOptimalRoutes(t) {
1258
- return await g().get("router/optimal-route", { searchParams: t }).json();
1258
+ return await m().get("router/optimal-route", { searchParams: t }).json();
1259
1259
  }
1260
1260
  async getAllSupportedBridges() {
1261
- return await g().get("router/supported-bridges/all").json();
1261
+ return await m().get("router/supported-bridges/all").json();
1262
1262
  }
1263
1263
  async getSupportedBridges(t) {
1264
- return await g().get("router/supported-bridges/route", { searchParams: t }).json();
1264
+ return await m().get("router/supported-bridges/route", { searchParams: t }).json();
1265
1265
  }
1266
1266
  async getSupportedRoutes(t, s) {
1267
- return await g().get("router/supported-bridges/bridge/" + t, { searchParams: s }).json();
1267
+ return await m().get("router/supported-bridges/bridge/" + t, { searchParams: s }).json();
1268
1268
  }
1269
1269
  }
1270
1270
  class Zs {
1271
1271
  async getSupported(t) {
1272
- return await g().get("chains", { searchParams: t }).json();
1272
+ return await m().get("chains", { searchParams: t }).json();
1273
1273
  }
1274
1274
  }
1275
1275
  class Qs {
1276
1276
  async getClientInfo() {
1277
- return await g().get("client/auth/client-info").json();
1277
+ return await m().get("client/auth/client-info").json();
1278
1278
  }
1279
1279
  async getClientInfoForSession() {
1280
- return await g().get("modal/sessions/client").json();
1280
+ return await m().get("modal/sessions/client").json();
1281
1281
  }
1282
1282
  }
1283
1283
  class en {
@@ -1291,7 +1291,7 @@ class en {
1291
1291
  destinationChain: ee[t.destinationChain],
1292
1292
  amount: t.amount
1293
1293
  };
1294
- return g().post("modal/sessions", { json: s }).json().then((n) => ({ ...n, amount: s.amount }));
1294
+ return m().post("modal/sessions", { json: s }).json().then((n) => ({ ...n, amount: s.amount }));
1295
1295
  }
1296
1296
  }
1297
1297
  const vn = {
@@ -1327,25 +1327,25 @@ function Pn(e) {
1327
1327
  onSuccess: c,
1328
1328
  session_url: u,
1329
1329
  sessionToken: l
1330
- } = e, [w, m] = O(0), [y, E] = O(""), U = re(null);
1331
- k(() => {
1330
+ } = e, [w, p] = I(0), [y, b] = I(""), k = re(null);
1331
+ C(() => {
1332
1332
  const f = document.body.style.overflow;
1333
1333
  n ? (document.body.style.overflow = "hidden", document.body.style.overflow = "hidden") : document.body.style.overflow = f || "";
1334
- const p = (b) => {
1335
- b.data === "closed" && (o(), a?.()), b.data === "completed" && (window.setTimeout(o, 2e3), c?.());
1334
+ const g = (E) => {
1335
+ E.data === "closed" && (o(), a?.()), E.data === "completed" && (window.setTimeout(o, 2e3), c?.());
1336
1336
  };
1337
- return window.addEventListener("message", p), () => {
1338
- document.body.style.overflow = f || "", window.removeEventListener("message", p);
1337
+ return window.addEventListener("message", g), () => {
1338
+ document.body.style.overflow = f || "", window.removeEventListener("message", g);
1339
1339
  };
1340
- }, [n, a, c]), k(() => {
1340
+ }, [n, a, c]), C(() => {
1341
1341
  h.config({
1342
1342
  api_key: l || "",
1343
1343
  // @ts-expect-error
1344
1344
  env: e.env === "internal" ? "internal" : "production"
1345
1345
  }).then((f) => {
1346
- window.chainrails = f, E(h.getPayModalUrl(t));
1346
+ window.chainrails = f, b(h.getPayModalUrl(t));
1347
1347
  });
1348
- }, [n, t]), k(() => {
1348
+ }, [n, t]), C(() => {
1349
1349
  if (!l) return;
1350
1350
  const f = {
1351
1351
  type: "session",
@@ -1353,10 +1353,10 @@ function Pn(e) {
1353
1353
  environment: h.getEnv() || ue.PRODUCTION,
1354
1354
  styles: s
1355
1355
  };
1356
- U.current?.contentWindow?.postMessage(f, "https://app.chainrails.io"), U.current?.contentWindow?.postMessage(f, "https://chainrails-frontend-git-staging-horus-labs.vercel.app");
1357
- }, [l, w, n, t, s]);
1356
+ k.current?.contentWindow?.postMessage(f, "https://app.chainrails.io"), k.current?.contentWindow?.postMessage(f, "https://chainrails-frontend-git-staging-horus-labs.vercel.app");
1357
+ }, [l, w, n, s]);
1358
1358
  function d() {
1359
- m(Math.random());
1359
+ p(Math.random());
1360
1360
  }
1361
1361
  return /* @__PURE__ */ we("div", {
1362
1362
  className: tn("payment-modal-wrapper", w === 0 || r ? "loading" : "not-loading", n ? "open" : "closed"),
@@ -1383,11 +1383,11 @@ function Pn(e) {
1383
1383
  onLoad: d,
1384
1384
  className: `payment-modal ${w === 0 || r ? "invisible" : "visible"}`,
1385
1385
  "data-id": t,
1386
- ref: U
1386
+ ref: k
1387
1387
  }, l)]
1388
1388
  });
1389
1389
  }
1390
- const sn = Symbol(), le = Symbol(), x = "a", pt = "f", xe = "p", gt = "c", mt = "t", fe = "h", D = "w", he = "o", de = "k";
1390
+ const sn = Symbol(), le = Symbol(), D = "a", pt = "f", ke = "p", gt = "c", mt = "t", fe = "h", O = "w", he = "o", de = "k";
1391
1391
  let nn = (e, t) => new Proxy(e, t);
1392
1392
  const se = Object.getPrototypeOf, ne = /* @__PURE__ */ new WeakMap(), yt = (e) => e && (ne.has(e) ? ne.get(e) : se(e) === Object.prototype || se(e) === Array.prototype), q = (e) => typeof e == "object" && e !== null, rn = (e) => Object.values(Object.getOwnPropertyDescriptors(e)).some((t) => !t.configurable && !t.writable), on = (e) => {
1393
1393
  if (Array.isArray(e))
@@ -1403,19 +1403,19 @@ const se = Object.getPrototypeOf, ne = /* @__PURE__ */ new WeakMap(), yt = (e) =
1403
1403
  let n = !1;
1404
1404
  const r = (a, c) => {
1405
1405
  if (!n) {
1406
- let u = s[x].get(e);
1407
- if (u || (u = {}, s[x].set(e, u)), a === D)
1408
- u[D] = !0;
1406
+ let u = s[D].get(e);
1407
+ if (u || (u = {}, s[D].set(e, u)), a === O)
1408
+ u[O] = !0;
1409
1409
  else {
1410
1410
  let l = u[a];
1411
1411
  l || (l = /* @__PURE__ */ new Set(), u[a] = l), l.add(c);
1412
1412
  }
1413
1413
  }
1414
1414
  }, i = () => {
1415
- n = !0, s[x].delete(e);
1415
+ n = !0, s[D].delete(e);
1416
1416
  }, o = {
1417
1417
  get(a, c) {
1418
- return c === le ? e : (r(de, c), wt(Reflect.get(a, c), s[x], s[gt], s[mt]));
1418
+ return c === le ? e : (r(de, c), wt(Reflect.get(a, c), s[D], s[gt], s[mt]));
1419
1419
  },
1420
1420
  has(a, c) {
1421
1421
  return c === sn ? (i(), !0) : (r(fe, c), Reflect.has(a, c));
@@ -1424,7 +1424,7 @@ const se = Object.getPrototypeOf, ne = /* @__PURE__ */ new WeakMap(), yt = (e) =
1424
1424
  return r(he, c), Reflect.getOwnPropertyDescriptor(a, c);
1425
1425
  },
1426
1426
  ownKeys(a) {
1427
- return r(D), Reflect.ownKeys(a);
1427
+ return r(O), Reflect.ownKeys(a);
1428
1428
  }
1429
1429
  };
1430
1430
  return t && (o.set = o.deleteProperty = () => !1), [o, s];
@@ -1442,7 +1442,7 @@ const se = Object.getPrototypeOf, ne = /* @__PURE__ */ new WeakMap(), yt = (e) =
1442
1442
  }
1443
1443
  const [i, o] = r;
1444
1444
  let a = s && s.get(i);
1445
- return (!a || a[1][pt] !== !!o) && (a = an(i, !!o), a[1][xe] = nn(o || i, a[0]), s && s.set(i, a)), a[1][x] = t, a[1][gt] = s, a[1][mt] = n, a[1][xe];
1445
+ return (!a || a[1][pt] !== !!o) && (a = an(i, !!o), a[1][ke] = nn(o || i, a[0]), s && s.set(i, a)), a[1][D] = t, a[1][gt] = s, a[1][mt] = n, a[1][ke];
1446
1446
  }, cn = (e, t) => {
1447
1447
  const s = Reflect.ownKeys(e), n = Reflect.ownKeys(t);
1448
1448
  return s.length !== n.length || s.some((r, i) => r !== n[i]);
@@ -1463,7 +1463,7 @@ const se = Object.getPrototypeOf, ne = /* @__PURE__ */ new WeakMap(), yt = (e) =
1463
1463
  for (const a of i[fe] || [])
1464
1464
  if (o = Reflect.has(e, a) !== Reflect.has(t, a), o)
1465
1465
  return o;
1466
- if (i[D] === !0) {
1466
+ if (i[O] === !0) {
1467
1467
  if (o = cn(e, t), o)
1468
1468
  return o;
1469
1469
  } else
@@ -1478,7 +1478,7 @@ const se = Object.getPrototypeOf, ne = /* @__PURE__ */ new WeakMap(), yt = (e) =
1478
1478
  if (o === null)
1479
1479
  throw new Error("invalid used");
1480
1480
  return o;
1481
- }, un = (e) => yt(e) && e[le] || null, ke = (e, t = !0) => {
1481
+ }, un = (e) => yt(e) && e[le] || null, xe = (e, t = !0) => {
1482
1482
  ne.set(e, t);
1483
1483
  }, ln = (e, t, s) => {
1484
1484
  const n = [], r = /* @__PURE__ */ new WeakSet(), i = (o, a) => {
@@ -1488,19 +1488,19 @@ const se = Object.getPrototypeOf, ne = /* @__PURE__ */ new WeakMap(), yt = (e) =
1488
1488
  q(o) && r.add(o);
1489
1489
  const w = q(o) && t.get(pe(o));
1490
1490
  if (w) {
1491
- if ((c = w[fe]) === null || c === void 0 || c.forEach((m) => {
1492
- const y = `:has(${String(m)})`;
1491
+ if ((c = w[fe]) === null || c === void 0 || c.forEach((p) => {
1492
+ const y = `:has(${String(p)})`;
1493
1493
  n.push(a ? [...a, y] : [y]);
1494
- }), w[D] === !0) {
1495
- const m = ":ownKeys";
1496
- n.push(a ? [...a, m] : [m]);
1494
+ }), w[O] === !0) {
1495
+ const p = ":ownKeys";
1496
+ n.push(a ? [...a, p] : [p]);
1497
1497
  } else
1498
- (u = w[he]) === null || u === void 0 || u.forEach((m) => {
1499
- const y = `:hasOwn(${String(m)})`;
1498
+ (u = w[he]) === null || u === void 0 || u.forEach((p) => {
1499
+ const y = `:hasOwn(${String(p)})`;
1500
1500
  n.push(a ? [...a, y] : [y]);
1501
1501
  });
1502
- (l = w[de]) === null || l === void 0 || l.forEach((m) => {
1503
- "value" in (Object.getOwnPropertyDescriptor(o, m) || {}) && i(o[m], a ? [...a, m] : [m]);
1502
+ (l = w[de]) === null || l === void 0 || l.forEach((p) => {
1503
+ "value" in (Object.getOwnPropertyDescriptor(o, p) || {}) && i(o[p], a ? [...a, p] : [p]);
1504
1504
  });
1505
1505
  } else a && n.push(a);
1506
1506
  };
@@ -1510,7 +1510,7 @@ const se = Object.getPrototypeOf, ne = /* @__PURE__ */ new WeakMap(), yt = (e) =
1510
1510
  if (s?.[0] === t)
1511
1511
  return s[1];
1512
1512
  const n = Array.isArray(e) ? [] : Object.create(Object.getPrototypeOf(e));
1513
- return ke(n, !0), De.set(e, [t, n]), Reflect.ownKeys(e).forEach((r) => {
1513
+ return xe(n, !0), De.set(e, [t, n]), Reflect.ownKeys(e).forEach((r) => {
1514
1514
  if (Object.getOwnPropertyDescriptor(n, r))
1515
1515
  return;
1516
1516
  const i = Reflect.get(e, r), { enumerable: o } = Reflect.getOwnPropertyDescriptor(
@@ -1524,9 +1524,9 @@ const se = Object.getPrototypeOf, ne = /* @__PURE__ */ new WeakMap(), yt = (e) =
1524
1524
  configurable: !0
1525
1525
  };
1526
1526
  if (me.has(i))
1527
- ke(i, !1);
1528
- else if (I.has(i)) {
1529
- const [c, u] = I.get(
1527
+ xe(i, !1);
1528
+ else if (U.has(i)) {
1529
+ const [c, u] = U.get(
1530
1530
  i
1531
1531
  );
1532
1532
  a.value = Et(c, u());
@@ -1545,10 +1545,10 @@ const se = Object.getPrototypeOf, ne = /* @__PURE__ */ new WeakMap(), yt = (e) =
1545
1545
  if (c && (Oe(u, o) || F.has(o) && Oe(u, F.get(o))))
1546
1546
  return !0;
1547
1547
  s(i), ge(o) && (o = un(o) || o);
1548
- const l = !I.has(o) && pn(o) ? St(o) : o;
1548
+ const l = !U.has(o) && pn(o) ? St(o) : o;
1549
1549
  return t(i, l), Reflect.set(r, i, l, a), n(["set", [i], o, u]), !0;
1550
1550
  }
1551
- }), I = /* @__PURE__ */ new WeakMap(), me = /* @__PURE__ */ new WeakSet(), De = /* @__PURE__ */ new WeakMap(), J = [1], F = /* @__PURE__ */ new WeakMap();
1551
+ }), U = /* @__PURE__ */ new WeakMap(), me = /* @__PURE__ */ new WeakSet(), De = /* @__PURE__ */ new WeakMap(), J = [1], F = /* @__PURE__ */ new WeakMap();
1552
1552
  let Oe = Object.is, dn = (e, t) => new Proxy(e, t), pn = fn, gn = Et, mn = hn;
1553
1553
  function St(e = {}) {
1554
1554
  if (!ge(e))
@@ -1558,59 +1558,59 @@ function St(e = {}) {
1558
1558
  return t;
1559
1559
  let s = J[0];
1560
1560
  const n = /* @__PURE__ */ new Set(), r = (d, f = ++J[0]) => {
1561
- s !== f && (i = s = f, n.forEach((p) => p(d, f)));
1561
+ s !== f && (i = s = f, n.forEach((g) => g(d, f)));
1562
1562
  };
1563
1563
  let i = s;
1564
1564
  const o = (d = J[0]) => (i !== d && (i = d, c.forEach(([f]) => {
1565
- const p = f[1](d);
1566
- p > s && (s = p);
1567
- })), s), a = (d) => (f, p) => {
1568
- const b = [...f];
1569
- b[1] = [d, ...b[1]], r(b, p);
1565
+ const g = f[1](d);
1566
+ g > s && (s = g);
1567
+ })), s), a = (d) => (f, g) => {
1568
+ const E = [...f];
1569
+ E[1] = [d, ...E[1]], r(E, g);
1570
1570
  }, c = /* @__PURE__ */ new Map(), u = (d, f) => {
1571
- const p = !me.has(f) && I.get(f);
1572
- if (p) {
1571
+ const g = !me.has(f) && U.get(f);
1572
+ if (g) {
1573
1573
  if ((_ ? "production" : void 0) !== "production" && c.has(d))
1574
1574
  throw new Error("prop listener already exists");
1575
1575
  if (n.size) {
1576
- const b = p[2](a(d));
1577
- c.set(d, [p, b]);
1576
+ const E = g[2](a(d));
1577
+ c.set(d, [g, E]);
1578
1578
  } else
1579
- c.set(d, [p]);
1579
+ c.set(d, [g]);
1580
1580
  }
1581
1581
  }, l = (d) => {
1582
1582
  var f;
1583
- const p = c.get(d);
1584
- p && (c.delete(d), (f = p[1]) == null || f.call(p));
1585
- }, w = (d) => (n.add(d), n.size === 1 && c.forEach(([p, b], M) => {
1586
- if ((_ ? "production" : void 0) !== "production" && b)
1583
+ const g = c.get(d);
1584
+ g && (c.delete(d), (f = g[1]) == null || f.call(g));
1585
+ }, w = (d) => (n.add(d), n.size === 1 && c.forEach(([g, E], M) => {
1586
+ if ((_ ? "production" : void 0) !== "production" && E)
1587
1587
  throw new Error("remove already exists");
1588
- const Rt = p[2](a(M));
1589
- c.set(M, [p, Rt]);
1588
+ const Tt = g[2](a(M));
1589
+ c.set(M, [g, Tt]);
1590
1590
  }), () => {
1591
- n.delete(d), n.size === 0 && c.forEach(([p, b], M) => {
1592
- b && (b(), c.set(M, [p]));
1591
+ n.delete(d), n.size === 0 && c.forEach(([g, E], M) => {
1592
+ E && (E(), c.set(M, [g]));
1593
1593
  });
1594
1594
  });
1595
- let m = !0;
1595
+ let p = !0;
1596
1596
  const y = mn(
1597
- () => m,
1597
+ () => p,
1598
1598
  u,
1599
1599
  l,
1600
1600
  r
1601
- ), E = dn(e, y);
1602
- F.set(e, E);
1603
- const U = [e, o, w];
1604
- return I.set(E, U), Reflect.ownKeys(e).forEach((d) => {
1601
+ ), b = dn(e, y);
1602
+ F.set(e, b);
1603
+ const k = [e, o, w];
1604
+ return U.set(b, k), Reflect.ownKeys(e).forEach((d) => {
1605
1605
  const f = Object.getOwnPropertyDescriptor(
1606
1606
  e,
1607
1607
  d
1608
1608
  );
1609
- "value" in f && f.writable && (E[d] = e[d]);
1610
- }), m = !1, E;
1609
+ "value" in f && f.writable && (b[d] = e[d]);
1610
+ }), p = !1, b;
1611
1611
  }
1612
1612
  function yn(e, t, s) {
1613
- const n = I.get(e);
1613
+ const n = U.get(e);
1614
1614
  (_ ? "production" : void 0) !== "production" && !n && console.warn("Please use proxy object");
1615
1615
  let r;
1616
1616
  const i = [], o = n[2];
@@ -1625,24 +1625,24 @@ function yn(e, t, s) {
1625
1625
  };
1626
1626
  }
1627
1627
  function Ne(e) {
1628
- const t = I.get(e);
1628
+ const t = U.get(e);
1629
1629
  (_ ? "production" : void 0) !== "production" && !t && console.warn("Please use proxy object");
1630
1630
  const [s, n] = t;
1631
1631
  return gn(s, n());
1632
1632
  }
1633
1633
  const wn = {}, bn = (e, t) => {
1634
1634
  const s = re(void 0);
1635
- k(() => {
1635
+ C(() => {
1636
1636
  s.current = ln(e, t);
1637
1637
  }), Pt(s.current);
1638
1638
  }, En = bn, Sn = /* @__PURE__ */ new WeakMap();
1639
- function Rn(e, t) {
1639
+ function Tn(e, t) {
1640
1640
  const n = ye(
1641
1641
  () => e && /* @__PURE__ */ new WeakMap(),
1642
1642
  [e]
1643
1643
  ), r = re(void 0);
1644
1644
  let i = !0;
1645
- const o = Tt(
1645
+ const o = Rt(
1646
1646
  At(
1647
1647
  (c) => {
1648
1648
  const u = yn(e, c);
@@ -1682,27 +1682,29 @@ function In({
1682
1682
  onCancel: t,
1683
1683
  onSuccess: s
1684
1684
  }) {
1685
- const n = Rn(A), [r, i] = O(!1), [o, a] = O(Date.now()), c = n?.data?.sessionToken, u = n?.data?.amount;
1685
+ const n = Tn(A), [r, i] = I(!1), [o, a] = I(Date.now()), c = n?.data?.sessionToken, u = n?.data?.amount;
1686
1686
  function l() {
1687
- c && i(!0);
1687
+ c || window.setTimeout(() => {
1688
+ c && i(!0);
1689
+ }, 1e3), i(!0);
1688
1690
  }
1689
1691
  function w() {
1690
1692
  i(!1);
1691
1693
  }
1692
- const m = () => {
1694
+ const p = () => {
1693
1695
  const y = Date.now();
1694
1696
  A.isPending = !0, A.error = null, A.data = null, fetch(e, {
1695
1697
  headers: {
1696
1698
  "Content-Type": "application/json"
1697
1699
  }
1698
- }).then((E) => E.json()).then((E) => {
1699
- y < o || (A.data = E, A.isPending = !1, a(y));
1700
- }).catch((E) => {
1701
- y < o || (A.error = E?.toString(), A.isPending = !1, a(y));
1700
+ }).then((b) => b.json()).then((b) => {
1701
+ y < o || (A.data = b, A.isPending = !1, a(y));
1702
+ }).catch((b) => {
1703
+ y < o || (A.error = b?.toString(), A.isPending = !1, a(y));
1702
1704
  });
1703
1705
  };
1704
- return k(() => {
1705
- m();
1706
+ return C(() => {
1707
+ p();
1706
1708
  }, [e]), {
1707
1709
  sessionToken: c,
1708
1710
  amount: u,
@@ -1710,30 +1712,44 @@ function In({
1710
1712
  session_url: e,
1711
1713
  open: l,
1712
1714
  close: w,
1713
- refetch: m,
1715
+ refetch: p,
1714
1716
  onSuccess: s,
1715
1717
  onCancel: t
1716
1718
  };
1717
1719
  }
1718
1720
  function Un({
1719
1721
  sessionToken: e,
1720
- onCancel: t,
1721
- onSuccess: s
1722
+ amount: t,
1723
+ onCancel: s,
1724
+ onSuccess: n
1722
1725
  }) {
1723
- const [n, r] = O(!1);
1724
- function i() {
1725
- r(!0);
1726
+ const [r, i] = I(!1), [o, a] = I(e), [c, u] = I(t);
1727
+ function l({
1728
+ sessionToken: y,
1729
+ amount: b
1730
+ }) {
1731
+ a(y), u(b);
1732
+ }
1733
+ C(() => {
1734
+ a(e);
1735
+ }, [e]);
1736
+ function w() {
1737
+ o || window.setTimeout(() => {
1738
+ o && i(!0);
1739
+ }, 1e3), i(!0);
1726
1740
  }
1727
- function o() {
1728
- r(!1);
1741
+ function p() {
1742
+ i(!1);
1729
1743
  }
1730
1744
  return {
1731
- sessionToken: e,
1732
- isOpen: n,
1733
- open: i,
1734
- close: o,
1735
- onSuccess: s,
1736
- onCancel: t
1745
+ sessionToken: o,
1746
+ updateSession: l,
1747
+ amount: c,
1748
+ isOpen: r,
1749
+ open: w,
1750
+ close: p,
1751
+ onSuccess: n,
1752
+ onCancel: s
1737
1753
  };
1738
1754
  }
1739
1755
  export {