@chainrails/react 0.0.37 → 0.1.0

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,5 +1,5 @@
1
- import { useState as Ne, useRef as se, useEffect as ne, useMemo as me, useSyncExternalStore as Tt, useCallback as At, useLayoutEffect as vt, useDebugValue as Pt } from "react";
2
- import { jsx as U, Fragment as It, jsxs as ye } from "react/jsx-runtime";
1
+ import { useState as Fe, useRef as he, useEffect as de, useMemo as ve, useSyncExternalStore as Ot, useCallback as Dt, useLayoutEffect as Nt, useDebugValue as Mt } from "react";
2
+ import { jsx as U, Fragment as Bt, jsxs as Pe } from "react/jsx-runtime";
3
3
  import './index.css';class X extends Error {
4
4
  response;
5
5
  request;
@@ -9,7 +9,7 @@ import './index.css';class X extends Error {
9
9
  super(`Request failed with ${a}: ${s.method} ${s.url}`), this.name = "HTTPError", this.response = t, this.request = s, this.options = n;
10
10
  }
11
11
  }
12
- class Me extends Error {
12
+ class He extends Error {
13
13
  name = "NonError";
14
14
  value;
15
15
  constructor(t) {
@@ -27,11 +27,11 @@ class F extends Error {
27
27
  code;
28
28
  customRequest;
29
29
  constructor(t) {
30
- const s = t?.cause ? t.cause instanceof Error ? t.cause : new Me(t.cause) : void 0;
30
+ const s = t?.cause ? t.cause instanceof Error ? t.cause : new He(t.cause) : void 0;
31
31
  super(t?.code ? `Forced retry: ${t.code}` : "Forced retry", s ? { cause: s } : void 0), this.customDelay = t?.delay, this.code = t?.code, this.customRequest = t?.request;
32
32
  }
33
33
  }
34
- const we = (() => {
34
+ const Ue = (() => {
35
35
  let e = !1, t = !1;
36
36
  const s = typeof globalThis.ReadableStream == "function", n = typeof globalThis.Request == "function";
37
37
  if (s && n)
@@ -50,7 +50,7 @@ const we = (() => {
50
50
  throw r;
51
51
  }
52
52
  return e && !t;
53
- })(), Ut = typeof globalThis.AbortController == "function", Be = typeof globalThis.AbortSignal == "function" && typeof globalThis.AbortSignal.any == "function", Ct = typeof globalThis.ReadableStream == "function", xt = typeof globalThis.FormData == "function", _e = ["get", "post", "put", "patch", "head", "delete"], kt = {
53
+ })(), $t = typeof globalThis.AbortController == "function", Ke = typeof globalThis.AbortSignal == "function" && typeof globalThis.AbortSignal.any == "function", _t = typeof globalThis.ReadableStream == "function", Lt = typeof globalThis.FormData == "function", We = ["get", "post", "put", "patch", "head", "delete"], zt = {
54
54
  json: "application/json",
55
55
  text: "text/*",
56
56
  formData: "multipart/form-data",
@@ -59,14 +59,14 @@ const we = (() => {
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
- }, H = 2147483647, Ot = new TextEncoder().encode("------WebKitFormBoundaryaxpyiPgbbPti10Rw").length, $e = Symbol("stop");
63
- class Le {
62
+ }, H = 2147483647, jt = new TextEncoder().encode("------WebKitFormBoundaryaxpyiPgbbPti10Rw").length, Ve = Symbol("stop");
63
+ class Ye {
64
64
  options;
65
65
  constructor(t) {
66
66
  this.options = t;
67
67
  }
68
68
  }
69
- const Dt = (e) => new Le(e), Nt = {
69
+ const qt = (e) => new Ye(e), Ft = {
70
70
  json: !0,
71
71
  parseJson: !0,
72
72
  stringifyJson: !0,
@@ -80,10 +80,10 @@ const Dt = (e) => new Le(e), Nt = {
80
80
  onUploadProgress: !0,
81
81
  fetch: !0,
82
82
  context: !0
83
- }, Mt = {
83
+ }, Ht = {
84
84
  next: !0
85
85
  // Next.js cache revalidation (revalidate, tags)
86
- }, Bt = {
86
+ }, Kt = {
87
87
  method: !0,
88
88
  headers: !0,
89
89
  body: !0,
@@ -98,13 +98,13 @@ const Dt = (e) => new Le(e), Nt = {
98
98
  signal: !0,
99
99
  window: !0,
100
100
  duplex: !0
101
- }, _t = (e) => {
101
+ }, Wt = (e) => {
102
102
  if (!e)
103
103
  return 0;
104
104
  if (e instanceof FormData) {
105
105
  let t = 0;
106
106
  for (const [s, n] of e)
107
- t += Ot, t += new TextEncoder().encode(`Content-Disposition: form-data; name="${s}"`).length, t += typeof n == "string" ? new TextEncoder().encode(n).length : n.size;
107
+ t += jt, 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)
@@ -125,7 +125,7 @@ const Dt = (e) => new Le(e), Nt = {
125
125
  return 0;
126
126
  }
127
127
  return 0;
128
- }, ze = (e, t, s) => {
128
+ }, Xe = (e, t, s) => {
129
129
  let n, r = 0;
130
130
  return e.pipeThrough(new TransformStream({
131
131
  transform(i, o) {
@@ -140,7 +140,7 @@ const Dt = (e) => new Le(e), Nt = {
140
140
  n && (r += n.byteLength, s?.({ percent: 1, totalBytes: Math.max(t, r), transferredBytes: r }, n));
141
141
  }
142
142
  }));
143
- }, $t = (e, t) => {
143
+ }, Vt = (e, t) => {
144
144
  if (!e.body)
145
145
  return e;
146
146
  if (e.status === 204)
@@ -150,40 +150,40 @@ const Dt = (e) => new Le(e), Nt = {
150
150
  headers: e.headers
151
151
  });
152
152
  const s = Math.max(0, Number(e.headers.get("content-length")) || 0);
153
- return new Response(ze(e.body, s, t), {
153
+ return new Response(Xe(e.body, s, t), {
154
154
  status: e.status,
155
155
  statusText: e.statusText,
156
156
  headers: e.headers
157
157
  });
158
- }, Lt = (e, t, s) => {
158
+ }, Yt = (e, t, s) => {
159
159
  if (!e.body)
160
160
  return e;
161
- const n = _t(s ?? e.body);
161
+ const n = Wt(s ?? e.body);
162
162
  return new Request(e, {
163
163
  // @ts-expect-error - Types are outdated.
164
164
  duplex: "half",
165
- body: ze(e.body, n, t)
165
+ body: Xe(e.body, n, t)
166
166
  });
167
- }, P = (e) => e !== null && typeof e == "object", N = (...e) => {
167
+ }, v = (e) => e !== null && typeof e == "object", N = (...e) => {
168
168
  for (const t of e)
169
- if ((!P(t) || Array.isArray(t)) && t !== void 0)
169
+ if ((!v(t) || Array.isArray(t)) && t !== void 0)
170
170
  throw new TypeError("The `options` argument must be an object");
171
- return re({}, ...e);
172
- }, qe = (e = {}, t = {}) => {
171
+ return pe({}, ...e);
172
+ }, Je = (e = {}, t = {}) => {
173
173
  const s = new globalThis.Headers(e), n = t instanceof globalThis.Headers, r = new globalThis.Headers(t);
174
174
  for (const [i, o] of r.entries())
175
175
  n && o === "undefined" || o === void 0 ? s.delete(i) : s.set(i, o);
176
176
  return s;
177
177
  };
178
178
  function M(e, t, s) {
179
- return Object.hasOwn(t, s) && t[s] === void 0 ? [] : re(e[s] ?? [], t[s] ?? []);
179
+ return Object.hasOwn(t, s) && t[s] === void 0 ? [] : pe(e[s] ?? [], t[s] ?? []);
180
180
  }
181
- const je = (e = {}, t = {}) => ({
181
+ const Ge = (e = {}, t = {}) => ({
182
182
  beforeRequest: M(e, t, "beforeRequest"),
183
183
  beforeRetry: M(e, t, "beforeRetry"),
184
184
  afterResponse: M(e, t, "afterResponse"),
185
185
  beforeError: M(e, t, "beforeError")
186
- }), zt = (e, t) => {
186
+ }), Xt = (e, t) => {
187
187
  const s = new URLSearchParams();
188
188
  for (const n of [e, t])
189
189
  if (n !== void 0)
@@ -196,7 +196,7 @@ const je = (e = {}, t = {}) => ({
196
196
  throw new TypeError("Array search parameters must be provided in [[key, value], ...] format");
197
197
  s.append(String(r[0]), String(r[1]));
198
198
  }
199
- else if (P(n))
199
+ else if (v(n))
200
200
  for (const [r, i] of Object.entries(n))
201
201
  i !== void 0 && s.append(r, String(i));
202
202
  else {
@@ -205,20 +205,20 @@ const je = (e = {}, t = {}) => ({
205
205
  s.append(i, o);
206
206
  }
207
207
  return s;
208
- }, re = (...e) => {
208
+ }, pe = (...e) => {
209
209
  let t = {}, s = {}, n = {}, r;
210
210
  const i = [];
211
211
  for (const o of e)
212
212
  if (Array.isArray(o))
213
213
  Array.isArray(t) || (t = []), t = [...t, ...o];
214
- else if (P(o)) {
214
+ else if (v(o)) {
215
215
  for (let [a, c] of Object.entries(o)) {
216
216
  if (a === "signal" && c instanceof globalThis.AbortSignal) {
217
217
  i.push(c);
218
218
  continue;
219
219
  }
220
220
  if (a === "context") {
221
- if (c != null && (!P(c) || Array.isArray(c)))
221
+ if (c != null && (!v(c) || Array.isArray(c)))
222
222
  throw new TypeError("The `context` option must be an object");
223
223
  t = {
224
224
  ...t,
@@ -227,28 +227,28 @@ const je = (e = {}, t = {}) => ({
227
227
  continue;
228
228
  }
229
229
  if (a === "searchParams") {
230
- c == null ? r = void 0 : r = r === void 0 ? c : zt(r, c);
230
+ c == null ? r = void 0 : r = r === void 0 ? c : Xt(r, c);
231
231
  continue;
232
232
  }
233
- P(c) && a in t && (c = re(t[a], c)), t = { ...t, [a]: c };
233
+ v(c) && a in t && (c = pe(t[a], c)), t = { ...t, [a]: c };
234
234
  }
235
- P(o.hooks) && (n = je(n, o.hooks), t.hooks = n), P(o.headers) && (s = qe(s, o.headers), t.headers = s);
235
+ v(o.hooks) && (n = Ge(n, o.hooks), t.hooks = n), v(o.headers) && (s = Je(s, o.headers), t.headers = s);
236
236
  }
237
- return r !== void 0 && (t.searchParams = r), i.length > 0 && (i.length === 1 ? t.signal = i[0] : Be ? t.signal = AbortSignal.any(i) : t.signal = i.at(-1)), t.context === void 0 && (t.context = {}), t;
238
- }, qt = (e) => _e.includes(e) ? e.toUpperCase() : e, jt = ["get", "put", "head", "delete", "options", "trace"], Ft = [408, 413, 429, 500, 502, 503, 504], Ht = [413, 429, 503], be = {
237
+ return r !== void 0 && (t.searchParams = r), i.length > 0 && (i.length === 1 ? t.signal = i[0] : Ke ? t.signal = AbortSignal.any(i) : t.signal = i.at(-1)), t.context === void 0 && (t.context = {}), t;
238
+ }, Jt = (e) => We.includes(e) ? e.toUpperCase() : e, Gt = ["get", "put", "head", "delete", "options", "trace"], Zt = [408, 413, 429, 500, 502, 503, 504], Qt = [413, 429, 503], Ce = {
239
239
  limit: 2,
240
- methods: jt,
241
- statusCodes: Ft,
242
- afterStatusCodes: Ht,
240
+ methods: Gt,
241
+ statusCodes: Zt,
242
+ afterStatusCodes: Qt,
243
243
  maxRetryAfter: Number.POSITIVE_INFINITY,
244
244
  backoffLimit: Number.POSITIVE_INFINITY,
245
245
  delay: (e) => 0.3 * 2 ** (e - 1) * 1e3,
246
246
  jitter: void 0,
247
247
  retryOnTimeout: !1
248
- }, Kt = (e = {}) => {
248
+ }, es = (e = {}) => {
249
249
  if (typeof e == "number")
250
250
  return {
251
- ...be,
251
+ ...Ce,
252
252
  limit: e
253
253
  };
254
254
  if (e.methods && !Array.isArray(e.methods))
@@ -256,7 +256,7 @@ const je = (e = {}, t = {}) => ({
256
256
  if (e.statusCodes && !Array.isArray(e.statusCodes))
257
257
  throw new Error("retry.statusCodes must be an array");
258
258
  return {
259
- ...be,
259
+ ...Ce,
260
260
  ...e
261
261
  };
262
262
  };
@@ -266,7 +266,7 @@ class J extends Error {
266
266
  super(`Request timed out: ${t.method} ${t.url}`), this.name = "TimeoutError", this.request = t;
267
267
  }
268
268
  }
269
- async function Wt(e, t, s, n) {
269
+ async function ts(e, t, s, n) {
270
270
  return new Promise((r, i) => {
271
271
  const o = setTimeout(() => {
272
272
  s && s.abort(), i(new J(e));
@@ -276,7 +276,7 @@ async function Wt(e, t, s, n) {
276
276
  });
277
277
  });
278
278
  }
279
- async function Vt(e, { signal: t }) {
279
+ async function ss(e, { signal: t }) {
280
280
  return new Promise((s, n) => {
281
281
  t && (t.throwIfAborted(), t.addEventListener("abort", r, { once: !0 }));
282
282
  function r() {
@@ -287,16 +287,16 @@ async function Vt(e, { signal: t }) {
287
287
  }, e);
288
288
  });
289
289
  }
290
- const Yt = (e, t) => {
290
+ const ns = (e, t) => {
291
291
  const s = {};
292
292
  for (const n in t)
293
- Object.hasOwn(t, n) && !(n in Bt) && !(n in Nt) && (!(n in e) || n in Mt) && (s[n] = t[n]);
293
+ Object.hasOwn(t, n) && !(n in Kt) && !(n in Ft) && (!(n in e) || n in Ht) && (s[n] = t[n]);
294
294
  return s;
295
- }, Xt = (e) => e === void 0 ? !1 : Array.isArray(e) ? e.length > 0 : e instanceof URLSearchParams ? e.size > 0 : typeof e == "object" ? Object.keys(e).length > 0 : typeof e == "string" ? e.trim().length > 0 : !!e;
296
- function Jt(e) {
295
+ }, rs = (e) => e === void 0 ? !1 : Array.isArray(e) ? e.length > 0 : e instanceof URLSearchParams ? e.size > 0 : typeof e == "object" ? Object.keys(e).length > 0 : typeof e == "string" ? e.trim().length > 0 : !!e;
296
+ function os(e) {
297
297
  return e instanceof X || e?.name === X.name;
298
298
  }
299
- function Gt(e) {
299
+ function is(e) {
300
300
  return e instanceof J || e?.name === J.name;
301
301
  }
302
302
  class O {
@@ -308,7 +308,7 @@ class O {
308
308
  let o = await n.#g();
309
309
  for (const a of n.#e.hooks.afterResponse) {
310
310
  const c = n.#l(o.clone()), u = await a(n.request, n.#a(), c, { retryCount: n.#s });
311
- if (u instanceof globalThis.Response && (o = u), u instanceof Le)
311
+ if (u instanceof globalThis.Response && (o = u), u instanceof Ye)
312
312
  throw await Promise.all([
313
313
  c.body?.cancel(),
314
314
  o.body?.cancel()
@@ -323,16 +323,16 @@ class O {
323
323
  if (n.#e.onDownloadProgress) {
324
324
  if (typeof n.#e.onDownloadProgress != "function")
325
325
  throw new TypeError("The `onDownloadProgress` option must be a function");
326
- if (!Ct)
326
+ if (!_t)
327
327
  throw new Error("Streams are not supported in your environment. `ReadableStream` is missing.");
328
- return $t(o.clone(), n.#e.onDownloadProgress);
328
+ return Vt(o.clone(), n.#e.onDownloadProgress);
329
329
  }
330
330
  return o;
331
331
  }, i = n.#f(r).finally(async () => {
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(kt))
335
+ for (const [o, a] of Object.entries(zt))
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;
@@ -363,17 +363,17 @@ class O {
363
363
  constructor(t, s = {}) {
364
364
  if (this.#t = t, this.#e = {
365
365
  ...s,
366
- headers: qe(this.#t.headers, s.headers),
367
- hooks: je({
366
+ headers: Je(this.#t.headers, s.headers),
367
+ hooks: Ge({
368
368
  beforeRequest: [],
369
369
  beforeRetry: [],
370
370
  beforeError: [],
371
371
  afterResponse: []
372
372
  }, s.hooks),
373
- method: qt(s.method ?? this.#t.method ?? "GET"),
373
+ method: Jt(s.method ?? this.#t.method ?? "GET"),
374
374
  // eslint-disable-next-line @typescript-eslint/prefer-nullish-coalescing
375
375
  prefixUrl: String(s.prefixUrl || ""),
376
- retry: Kt(s.retry),
376
+ retry: es(s.retry),
377
377
  throwHttpErrors: s.throwHttpErrors ?? !0,
378
378
  timeout: s.timeout ?? 1e4,
379
379
  fetch: s.fetch ?? globalThis.fetch.bind(globalThis),
@@ -385,16 +385,16 @@ class O {
385
385
  throw new Error("`input` must not begin with a slash when using `prefixUrl`");
386
386
  this.#e.prefixUrl.endsWith("/") || (this.#e.prefixUrl += "/"), this.#t = this.#e.prefixUrl + this.#t;
387
387
  }
388
- Ut && Be && (this.#r = this.#e.signal ?? this.#t.signal, this.#n = new globalThis.AbortController(), this.#e.signal = this.#r ? AbortSignal.any([this.#r, this.#n.signal]) : this.#n.signal), we && (this.#e.duplex = "half"), this.#e.json !== void 0 && (this.#e.body = this.#e.stringifyJson?.(this.#e.json) ?? JSON.stringify(this.#e.json), this.#e.headers.set("content-type", this.#e.headers.get("content-type") ?? "application/json"));
388
+ $t && Ke && (this.#r = this.#e.signal ?? this.#t.signal, this.#n = new globalThis.AbortController(), this.#e.signal = this.#r ? AbortSignal.any([this.#r, this.#n.signal]) : this.#n.signal), Ue && (this.#e.duplex = "half"), this.#e.json !== void 0 && (this.#e.body = this.#e.stringifyJson?.(this.#e.json) ?? JSON.stringify(this.#e.json), this.#e.headers.set("content-type", this.#e.headers.get("content-type") ?? "application/json"));
389
389
  const n = s.headers && new globalThis.Headers(s.headers).has("content-type");
390
- if (this.#t instanceof globalThis.Request && (xt && this.#e.body instanceof globalThis.FormData || this.#e.body instanceof URLSearchParams) && !n && this.#e.headers.delete("content-type"), this.request = new globalThis.Request(this.#t, this.#e), Xt(this.#e.searchParams)) {
390
+ if (this.#t instanceof globalThis.Request && (Lt && this.#e.body instanceof globalThis.FormData || this.#e.body instanceof URLSearchParams) && !n && this.#e.headers.delete("content-type"), this.request = new globalThis.Request(this.#t, this.#e), rs(this.#e.searchParams)) {
391
391
  const i = "?" + (typeof this.#e.searchParams == "string" ? this.#e.searchParams.replace(/^\?/, "") : new URLSearchParams(O.#d(this.#e.searchParams)).toString()), o = this.request.url.replace(/(?:\?.*?)?(?=#|$)/, i);
392
392
  this.request = new globalThis.Request(o, this.#e);
393
393
  }
394
394
  if (this.#e.onUploadProgress) {
395
395
  if (typeof this.#e.onUploadProgress != "function")
396
396
  throw new TypeError("The `onUploadProgress` option must be a function");
397
- if (!we)
397
+ if (!Ue)
398
398
  throw new Error("Request streams are not supported in your environment. The `duplex` option for `Request` is not available.");
399
399
  this.request = this.#h(this.request, this.#e.body ?? void 0);
400
400
  }
@@ -407,7 +407,7 @@ class O {
407
407
  async #p(t) {
408
408
  if (this.#s++, this.#s > this.#e.retry.limit)
409
409
  throw t;
410
- const s = t instanceof Error ? t : new Me(t);
410
+ const s = t instanceof Error ? t : new He(t);
411
411
  if (s instanceof F)
412
412
  return s.customDelay ?? this.#c();
413
413
  if (!this.#e.retry.methods.includes(this.request.method.toLowerCase()))
@@ -419,9 +419,9 @@ class O {
419
419
  if (n === !0)
420
420
  return this.#c();
421
421
  }
422
- if (Gt(t) && !this.#e.retry.retryOnTimeout)
422
+ if (is(t) && !this.#e.retry.retryOnTimeout)
423
423
  throw t;
424
- if (Jt(t)) {
424
+ if (os(t)) {
425
425
  if (!this.#e.retry.statusCodes.includes(t.response.status))
426
426
  throw t;
427
427
  const n = t.response.headers.get("Retry-After") ?? t.response.headers.get("RateLimit-Reset") ?? t.response.headers.get("X-RateLimit-Retry-After") ?? t.response.headers.get("X-RateLimit-Reset") ?? t.response.headers.get("X-Rate-Limit-Reset");
@@ -446,7 +446,7 @@ class O {
446
446
  const n = Math.min(await this.#p(s), H);
447
447
  if (this.#s < 1)
448
448
  throw s;
449
- if (await Vt(n, this.#r ? { signal: this.#r } : {}), s instanceof F && s.customRequest) {
449
+ if (await ss(n, this.#r ? { signal: this.#r } : {}), s instanceof F && s.customRequest) {
450
450
  const r = this.#e.signal ? new globalThis.Request(s.customRequest, { signal: this.#e.signal }) : new globalThis.Request(s.customRequest);
451
451
  this.#u(r);
452
452
  }
@@ -463,7 +463,7 @@ class O {
463
463
  }
464
464
  if (i instanceof globalThis.Response)
465
465
  return i;
466
- if (i === $e)
466
+ if (i === Ve)
467
467
  return;
468
468
  }
469
469
  return this.#f(t);
@@ -480,8 +480,8 @@ class O {
480
480
  break;
481
481
  }
482
482
  }
483
- const t = Yt(this.request, this.#e);
484
- return this.#o = this.request, this.request = this.#o.clone(), this.#e.timeout === !1 ? this.#e.fetch(this.#o, t) : Wt(this.#o, t, this.#n, this.#e);
483
+ const t = ns(this.request, this.#e);
484
+ return this.#o = this.request, this.request = this.#o.clone(), this.#e.timeout === !1 ? this.#e.fetch(this.#o, t) : ts(this.#o, t, this.#n, this.#e);
485
485
  }
486
486
  #a() {
487
487
  if (!this.#i) {
@@ -494,72 +494,72 @@ class O {
494
494
  this.#i = void 0, this.request = this.#h(t);
495
495
  }
496
496
  #h(t, s) {
497
- return !this.#e.onUploadProgress || !t.body ? t : Lt(t, this.#e.onUploadProgress, s ?? this.#e.body ?? void 0);
497
+ return !this.#e.onUploadProgress || !t.body ? t : Yt(t, this.#e.onUploadProgress, s ?? this.#e.body ?? void 0);
498
498
  }
499
499
  }
500
500
  /*! MIT License © Sindre Sorhus */
501
501
  const G = (e) => {
502
502
  const t = (s, n) => O.create(s, N(e, n));
503
- for (const s of _e)
503
+ for (const s of We)
504
504
  t[s] = (n, r) => O.create(n, N(e, r, { method: s }));
505
- return t.create = (s) => G(N(s)), t.extend = (s) => (typeof s == "function" && (s = s(e ?? {})), G(N(e, s))), t.stop = $e, t.retry = Dt, t;
506
- }, Zt = G();
505
+ return t.create = (s) => G(N(s)), t.extend = (s) => (typeof s == "function" && (s = s(e ?? {})), G(N(e, s))), t.stop = Ve, t.retry = qt, t;
506
+ }, as = G();
507
507
  var E = /* @__PURE__ */ ((e) => (e.USDC = "USDC", e))(E || {});
508
- const Fe = {
508
+ const Ze = {
509
509
  type: "evm",
510
510
  chainId: 42161,
511
511
  name: "Arbitrum",
512
512
  cctpDomain: 3,
513
513
  logoURI: "/images/chains/arbitrum.svg"
514
- }, He = {
514
+ }, Qe = {
515
515
  type: "evm",
516
516
  chainId: 421614,
517
517
  name: "Arbitrum Sepolia",
518
518
  cctpDomain: 3,
519
519
  logoURI: "/images/chains/arbitrum.svg"
520
- }, Ke = {
520
+ }, et = {
521
521
  type: "evm",
522
522
  chainId: 8453,
523
523
  name: "Base",
524
524
  cctpDomain: 6,
525
525
  logoURI: "/images/chains/base.webp"
526
- }, We = {
526
+ }, tt = {
527
527
  type: "evm",
528
528
  chainId: 84532,
529
529
  name: "Base Sepolia",
530
530
  cctpDomain: 6,
531
531
  logoURI: "/images/chains/base.webp"
532
- }, Ve = {
532
+ }, st = {
533
533
  type: "evm",
534
534
  chainId: 56,
535
535
  name: "BNB Chain",
536
536
  cctpDomain: null,
537
537
  logoURI: "/images/chains/bsc.webp"
538
- }, Ye = {
538
+ }, nt = {
539
539
  type: "evm",
540
540
  chainId: 1,
541
541
  name: "Ethereum",
542
542
  cctpDomain: 0,
543
543
  logoURI: "/images/chains/ethereum.svg"
544
- }, Xe = {
544
+ }, rt = {
545
545
  type: "evm",
546
546
  chainId: 11155111,
547
547
  name: "Ethereum Sepolia",
548
548
  cctpDomain: 0,
549
549
  logoURI: "/images/chains/ethereum.svg"
550
- }, Je = {
550
+ }, ot = {
551
551
  type: "evm",
552
552
  chainId: 43114,
553
553
  name: "Avalanche",
554
554
  cctpDomain: 1,
555
555
  logoURI: "/images/chains/avalanche.svg"
556
- }, Ge = {
556
+ }, it = {
557
557
  type: "evm",
558
558
  chainId: 43113,
559
559
  name: "Avalanche Fuji",
560
560
  cctpDomain: 1,
561
561
  logoURI: "/images/chains/avalanche.svg"
562
- }, Ze = {
562
+ }, at = {
563
563
  type: "starknet",
564
564
  chainId: "0x534e5f4d41494e",
565
565
  // SN_MAIN
@@ -567,16 +567,16 @@ const Fe = {
567
567
  cctpDomain: null,
568
568
  logoURI: "/images/chains/starknet.svg"
569
569
  };
570
- function oe(e, { strict: t = !0 } = {}) {
570
+ function ge(e, { strict: t = !0 } = {}) {
571
571
  return !e || typeof e != "string" ? !1 : t ? /^0x[0-9a-fA-F]*$/.test(e) : e.startsWith("0x");
572
572
  }
573
- function Ee(e) {
574
- return oe(e, { strict: !1 }) ? Math.ceil((e.length - 2) / 2) : e.length;
573
+ function xe(e) {
574
+ return ge(e, { strict: !1 }) ? Math.ceil((e.length - 2) / 2) : e.length;
575
575
  }
576
- const Qe = "2.43.4";
576
+ const ct = "2.43.4";
577
577
  let K = {
578
578
  getDocsUrl: ({ docsBaseUrl: e, docsPath: t = "", docsSlug: s }) => t ? `${e ?? "https://viem.sh"}${t}${s ? `#${s}` : ""}` : void 0,
579
- version: `viem@${Qe}`
579
+ version: `viem@${ct}`
580
580
  };
581
581
  class A extends Error {
582
582
  constructor(t, s = {}) {
@@ -619,40 +619,40 @@ class A extends Error {
619
619
  configurable: !0,
620
620
  writable: !0,
621
621
  value: "BaseError"
622
- }), this.details = n, this.docsPath = r, this.metaMessages = s.metaMessages, this.name = s.name ?? this.name, this.shortMessage = t, this.version = Qe;
622
+ }), this.details = n, this.docsPath = r, this.metaMessages = s.metaMessages, this.name = s.name ?? this.name, this.shortMessage = t, this.version = ct;
623
623
  }
624
624
  walk(t) {
625
- return et(this, t);
625
+ return ut(this, t);
626
626
  }
627
627
  }
628
- function et(e, t) {
629
- return t?.(e) ? e : e && typeof e == "object" && "cause" in e && e.cause !== void 0 ? et(e.cause, t) : t ? null : e;
628
+ function ut(e, t) {
629
+ return t?.(e) ? e : e && typeof e == "object" && "cause" in e && e.cause !== void 0 ? ut(e.cause, t) : t ? null : e;
630
630
  }
631
- class tt extends A {
631
+ class lt extends A {
632
632
  constructor({ size: t, targetSize: s, type: n }) {
633
633
  super(`${n.charAt(0).toUpperCase()}${n.slice(1).toLowerCase()} size (${t}) exceeds padding size (${s}).`, { name: "SizeExceedsPaddingSizeError" });
634
634
  }
635
635
  }
636
- function q(e, { dir: t, size: s = 32 } = {}) {
637
- return typeof e == "string" ? Qt(e, { dir: t, size: s }) : es(e, { dir: t, size: s });
636
+ function j(e, { dir: t, size: s = 32 } = {}) {
637
+ return typeof e == "string" ? cs(e, { dir: t, size: s }) : us(e, { dir: t, size: s });
638
638
  }
639
- function Qt(e, { dir: t, size: s = 32 } = {}) {
639
+ function cs(e, { dir: t, size: s = 32 } = {}) {
640
640
  if (s === null)
641
641
  return e;
642
642
  const n = e.replace("0x", "");
643
643
  if (n.length > s * 2)
644
- throw new tt({
644
+ throw new lt({
645
645
  size: Math.ceil(n.length / 2),
646
646
  targetSize: s,
647
647
  type: "hex"
648
648
  });
649
649
  return `0x${n[t === "right" ? "padEnd" : "padStart"](s * 2, "0")}`;
650
650
  }
651
- function es(e, { dir: t, size: s = 32 } = {}) {
651
+ function us(e, { dir: t, size: s = 32 } = {}) {
652
652
  if (s === null)
653
653
  return e;
654
654
  if (e.length > s)
655
- throw new tt({
655
+ throw new lt({
656
656
  size: e.length,
657
657
  targetSize: s,
658
658
  type: "bytes"
@@ -664,31 +664,31 @@ function es(e, { dir: t, size: s = 32 } = {}) {
664
664
  }
665
665
  return n;
666
666
  }
667
- class ts extends A {
667
+ class ls extends A {
668
668
  constructor({ max: t, min: s, signed: n, size: r, value: i }) {
669
669
  super(`Number "${i}" is not in safe ${r ? `${r * 8}-bit ${n ? "signed" : "unsigned"} ` : ""}integer range ${t ? `(${s} to ${t})` : `(above ${s})`}`, { name: "IntegerOutOfRangeError" });
670
670
  }
671
671
  }
672
- class ss extends A {
672
+ class fs extends A {
673
673
  constructor({ givenSize: t, maxSize: s }) {
674
674
  super(`Size cannot exceed ${s} bytes. Given size: ${t} bytes.`, { name: "SizeOverflowError" });
675
675
  }
676
676
  }
677
- function ie(e, { size: t }) {
678
- if (Ee(e) > t)
679
- throw new ss({
680
- givenSize: Ee(e),
677
+ function me(e, { size: t }) {
678
+ if (xe(e) > t)
679
+ throw new fs({
680
+ givenSize: xe(e),
681
681
  maxSize: t
682
682
  });
683
683
  }
684
- function ns(e, t = {}) {
684
+ function hs(e, t = {}) {
685
685
  const { signed: s, size: n } = t, r = BigInt(e);
686
686
  let i;
687
687
  n ? s ? i = (1n << BigInt(n) * 8n - 1n) - 1n : i = 2n ** (BigInt(n) * 8n) - 1n : typeof e == "number" && (i = BigInt(Number.MAX_SAFE_INTEGER));
688
688
  const o = typeof i == "bigint" && s ? -i - 1n : 0;
689
689
  if (i && r > i || r < o) {
690
690
  const c = typeof e == "bigint" ? "n" : "";
691
- throw new ts({
691
+ throw new ls({
692
692
  max: i ? `${i}${c}` : void 0,
693
693
  min: `${o}${c}`,
694
694
  signed: s,
@@ -697,15 +697,15 @@ function ns(e, t = {}) {
697
697
  });
698
698
  }
699
699
  const a = `0x${(s && r < 0 ? (1n << BigInt(n * 8)) + BigInt(r) : r).toString(16)}`;
700
- return n ? q(a, { size: n }) : a;
700
+ return n ? j(a, { size: n }) : a;
701
701
  }
702
- const rs = /* @__PURE__ */ new TextEncoder();
703
- function os(e, t = {}) {
704
- return typeof e == "number" || typeof e == "bigint" ? as(e, t) : typeof e == "boolean" ? is(e, t) : oe(e) ? st(e, t) : nt(e, t);
702
+ const ds = /* @__PURE__ */ new TextEncoder();
703
+ function ps(e, t = {}) {
704
+ return typeof e == "number" || typeof e == "bigint" ? ms(e, t) : typeof e == "boolean" ? gs(e, t) : ge(e) ? ft(e, t) : ht(e, t);
705
705
  }
706
- function is(e, t = {}) {
706
+ function gs(e, t = {}) {
707
707
  const s = new Uint8Array(1);
708
- return s[0] = Number(e), typeof t.size == "number" ? (ie(s, { size: t.size }), q(s, { size: t.size })) : s;
708
+ return s[0] = Number(e), typeof t.size == "number" ? (me(s, { size: t.size }), j(s, { size: t.size })) : s;
709
709
  }
710
710
  const S = {
711
711
  zero: 48,
@@ -715,7 +715,7 @@ const S = {
715
715
  a: 97,
716
716
  f: 102
717
717
  };
718
- function Se(e) {
718
+ function ke(e) {
719
719
  if (e >= S.zero && e <= S.nine)
720
720
  return e - S.zero;
721
721
  if (e >= S.A && e <= S.F)
@@ -723,121 +723,121 @@ function Se(e) {
723
723
  if (e >= S.a && e <= S.f)
724
724
  return e - (S.a - 10);
725
725
  }
726
- function st(e, t = {}) {
726
+ function ft(e, t = {}) {
727
727
  let s = e;
728
- t.size && (ie(s, { size: t.size }), s = q(s, { dir: "right", size: t.size }));
728
+ t.size && (me(s, { size: t.size }), s = j(s, { dir: "right", size: t.size }));
729
729
  let n = s.slice(2);
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 = Se(n.charCodeAt(a++)), u = Se(n.charCodeAt(a++));
733
+ const c = ke(n.charCodeAt(a++)), u = ke(n.charCodeAt(a++));
734
734
  if (c === void 0 || u === void 0)
735
735
  throw new A(`Invalid byte sequence ("${n[a - 2]}${n[a - 1]}" in "${n}").`);
736
736
  i[o] = c * 16 + u;
737
737
  }
738
738
  return i;
739
739
  }
740
- function as(e, t) {
741
- const s = ns(e, t);
742
- return st(s);
740
+ function ms(e, t) {
741
+ const s = hs(e, t);
742
+ return ft(s);
743
743
  }
744
- function nt(e, t = {}) {
745
- const s = rs.encode(e);
746
- return typeof t.size == "number" ? (ie(s, { size: t.size }), q(s, { dir: "right", size: t.size })) : s;
744
+ function ht(e, t = {}) {
745
+ const s = ds.encode(e);
746
+ return typeof t.size == "number" ? (me(s, { size: t.size }), j(s, { dir: "right", size: t.size })) : s;
747
747
  }
748
- const B = /* @__PURE__ */ BigInt(2 ** 32 - 1), Re = /* @__PURE__ */ BigInt(32);
749
- function cs(e, t = !1) {
750
- return t ? { h: Number(e & B), l: Number(e >> Re & B) } : { h: Number(e >> Re & B) | 0, l: Number(e & B) | 0 };
748
+ const B = /* @__PURE__ */ BigInt(2 ** 32 - 1), Oe = /* @__PURE__ */ BigInt(32);
749
+ function ys(e, t = !1) {
750
+ return t ? { h: Number(e & B), l: Number(e >> Oe & B) } : { h: Number(e >> Oe & B) | 0, l: Number(e & B) | 0 };
751
751
  }
752
- function us(e, t = !1) {
752
+ function ws(e, t = !1) {
753
753
  const s = e.length;
754
754
  let n = new Uint32Array(s), r = new Uint32Array(s);
755
755
  for (let i = 0; i < s; i++) {
756
- const { h: o, l: a } = cs(e[i], t);
756
+ const { h: o, l: a } = ys(e[i], t);
757
757
  [n[i], r[i]] = [o, a];
758
758
  }
759
759
  return [n, r];
760
760
  }
761
- const ls = (e, t, s) => e << s | t >>> 32 - s, fs = (e, t, s) => t << s | e >>> 32 - s, hs = (e, t, s) => t << s - 32 | e >>> 64 - s, ds = (e, t, s) => e << s - 32 | t >>> 64 - s;
761
+ const bs = (e, t, s) => e << s | t >>> 32 - s, Es = (e, t, s) => t << s | e >>> 32 - s, Ss = (e, t, s) => t << s - 32 | e >>> 64 - s, Rs = (e, t, s) => e << s - 32 | t >>> 64 - s;
762
762
  /*! noble-hashes - MIT License (c) 2022 Paul Miller (paulmillr.com) */
763
- function ps(e) {
763
+ function Ts(e) {
764
764
  return e instanceof Uint8Array || ArrayBuffer.isView(e) && e.constructor.name === "Uint8Array";
765
765
  }
766
- function Te(e) {
766
+ function De(e) {
767
767
  if (!Number.isSafeInteger(e) || e < 0)
768
768
  throw new Error("positive integer expected, got " + e);
769
769
  }
770
- function _(e, ...t) {
771
- if (!ps(e))
770
+ function $(e, ...t) {
771
+ if (!Ts(e))
772
772
  throw new Error("Uint8Array expected");
773
773
  if (t.length > 0 && !t.includes(e.length))
774
774
  throw new Error("Uint8Array expected of length " + t + ", got length=" + e.length);
775
775
  }
776
- function Ae(e, t = !0) {
776
+ function Ne(e, t = !0) {
777
777
  if (e.destroyed)
778
778
  throw new Error("Hash instance has been destroyed");
779
779
  if (t && e.finished)
780
780
  throw new Error("Hash#digest() has already been called");
781
781
  }
782
- function gs(e, t) {
783
- _(e);
782
+ function As(e, t) {
783
+ $(e);
784
784
  const s = t.outputLen;
785
785
  if (e.length < s)
786
786
  throw new Error("digestInto() expects output buffer of length at least " + s);
787
787
  }
788
- function ms(e) {
788
+ function Is(e) {
789
789
  return new Uint32Array(e.buffer, e.byteOffset, Math.floor(e.byteLength / 4));
790
790
  }
791
- function rt(...e) {
791
+ function dt(...e) {
792
792
  for (let t = 0; t < e.length; t++)
793
793
  e[t].fill(0);
794
794
  }
795
- const ys = new Uint8Array(new Uint32Array([287454020]).buffer)[0] === 68;
796
- function ws(e) {
795
+ const vs = new Uint8Array(new Uint32Array([287454020]).buffer)[0] === 68;
796
+ function Ps(e) {
797
797
  return e << 24 & 4278190080 | e << 8 & 16711680 | e >>> 8 & 65280 | e >>> 24 & 255;
798
798
  }
799
- function bs(e) {
799
+ function Us(e) {
800
800
  for (let t = 0; t < e.length; t++)
801
- e[t] = ws(e[t]);
801
+ e[t] = Ps(e[t]);
802
802
  return e;
803
803
  }
804
- const ve = ys ? (e) => e : bs;
805
- function Es(e) {
804
+ const Me = vs ? (e) => e : Us;
805
+ function Cs(e) {
806
806
  if (typeof e != "string")
807
807
  throw new Error("string expected");
808
808
  return new Uint8Array(new TextEncoder().encode(e));
809
809
  }
810
- function ot(e) {
811
- return typeof e == "string" && (e = Es(e)), _(e), e;
810
+ function pt(e) {
811
+ return typeof e == "string" && (e = Cs(e)), $(e), e;
812
812
  }
813
- class Ss {
813
+ class xs {
814
814
  }
815
- function Rs(e) {
816
- const t = (n) => e().update(ot(n)).digest(), s = e();
815
+ function ks(e) {
816
+ const t = (n) => e().update(pt(n)).digest(), s = e();
817
817
  return t.outputLen = s.outputLen, t.blockLen = s.blockLen, t.create = () => e(), t;
818
818
  }
819
- const Ts = BigInt(0), C = BigInt(1), As = BigInt(2), vs = BigInt(7), Ps = BigInt(256), Is = BigInt(113), it = [], at = [], ct = [];
819
+ const Os = BigInt(0), C = BigInt(1), Ds = BigInt(2), Ns = BigInt(7), Ms = BigInt(256), Bs = BigInt(113), gt = [], mt = [], yt = [];
820
820
  for (let e = 0, t = C, s = 1, n = 0; e < 24; e++) {
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 = Ts;
821
+ [s, n] = [n, (2 * s + 3 * n) % 5], gt.push(2 * (5 * n + s)), mt.push((e + 1) * (e + 2) / 2 % 64);
822
+ let r = Os;
823
823
  for (let i = 0; i < 7; i++)
824
- t = (t << C ^ (t >> vs) * Is) % Ps, t & As && (r ^= C << (C << /* @__PURE__ */ BigInt(i)) - C);
825
- ct.push(r);
824
+ t = (t << C ^ (t >> Ns) * Bs) % Ms, t & Ds && (r ^= C << (C << /* @__PURE__ */ BigInt(i)) - C);
825
+ yt.push(r);
826
826
  }
827
- const ut = us(ct, !0), Us = ut[0], Cs = ut[1], Pe = (e, t, s) => s > 32 ? hs(e, t, s) : ls(e, t, s), Ie = (e, t, s) => s > 32 ? ds(e, t, s) : fs(e, t, s);
828
- function xs(e, t = 24) {
827
+ const wt = ws(yt, !0), $s = wt[0], _s = wt[1], Be = (e, t, s) => s > 32 ? Ss(e, t, s) : bs(e, t, s), $e = (e, t, s) => s > 32 ? Rs(e, t, s) : Es(e, t, s);
828
+ function Ls(e, t = 24) {
829
829
  const s = new Uint32Array(10);
830
830
  for (let n = 24 - t; n < 24; n++) {
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 = Pe(u, l, 1) ^ s[a], d = Ie(u, l, 1) ^ s[a + 1];
835
- for (let m = 0; m < 50; m += 10)
836
- e[o + m] ^= w, e[o + m + 1] ^= d;
834
+ const a = (o + 8) % 10, c = (o + 2) % 10, u = s[c], l = s[c + 1], w = Be(u, l, 1) ^ s[a], d = $e(u, l, 1) ^ s[a + 1];
835
+ for (let y = 0; y < 50; y += 10)
836
+ e[o + y] ^= w, e[o + y + 1] ^= d;
837
837
  }
838
838
  let r = e[2], i = e[3];
839
839
  for (let o = 0; o < 24; o++) {
840
- const a = at[o], c = Pe(r, i, a), u = Ie(r, i, a), l = it[o];
840
+ const a = mt[o], c = Be(r, i, a), u = $e(r, i, a), l = gt[o];
841
841
  r = e[l], i = e[l + 1], e[l] = c, e[l + 1] = u;
842
842
  }
843
843
  for (let o = 0; o < 50; o += 10) {
@@ -846,25 +846,25 @@ function xs(e, t = 24) {
846
846
  for (let a = 0; a < 10; a++)
847
847
  e[o + a] ^= ~s[(a + 2) % 10] & s[(a + 4) % 10];
848
848
  }
849
- e[0] ^= Us[n], e[1] ^= Cs[n];
849
+ e[0] ^= $s[n], e[1] ^= _s[n];
850
850
  }
851
- rt(s);
851
+ dt(s);
852
852
  }
853
- class ae extends Ss {
853
+ class ye extends xs {
854
854
  // NOTE: we accept arguments in bytes instead of bits here.
855
855
  constructor(t, s, n, r = !1, i = 24) {
856
- if (super(), this.pos = 0, this.posOut = 0, this.finished = !1, this.destroyed = !1, this.enableXOF = !1, this.blockLen = t, this.suffix = s, this.outputLen = n, this.enableXOF = r, this.rounds = i, Te(n), !(0 < t && t < 200))
856
+ if (super(), this.pos = 0, this.posOut = 0, this.finished = !1, this.destroyed = !1, this.enableXOF = !1, this.blockLen = t, this.suffix = s, this.outputLen = n, this.enableXOF = r, this.rounds = i, De(n), !(0 < t && t < 200))
857
857
  throw new Error("only keccak-f1600 function is supported");
858
- this.state = new Uint8Array(200), this.state32 = ms(this.state);
858
+ this.state = new Uint8Array(200), this.state32 = Is(this.state);
859
859
  }
860
860
  clone() {
861
861
  return this._cloneInto();
862
862
  }
863
863
  keccak() {
864
- ve(this.state32), xs(this.state32, this.rounds), ve(this.state32), this.posOut = 0, this.pos = 0;
864
+ Me(this.state32), Ls(this.state32, this.rounds), Me(this.state32), this.posOut = 0, this.pos = 0;
865
865
  }
866
866
  update(t) {
867
- Ae(this), t = ot(t), _(t);
867
+ Ne(this), t = pt(t), $(t);
868
868
  const { blockLen: s, state: n } = this, r = t.length;
869
869
  for (let i = 0; i < r; ) {
870
870
  const o = Math.min(s - this.pos, r - i);
@@ -882,7 +882,7 @@ class ae extends Ss {
882
882
  t[n] ^= s, (s & 128) !== 0 && n === r - 1 && this.keccak(), t[r - 1] ^= 128, this.keccak();
883
883
  }
884
884
  writeInto(t) {
885
- Ae(this, !1), _(t), this.finish();
885
+ Ne(this, !1), $(t), this.finish();
886
886
  const s = this.state, { blockLen: n } = this;
887
887
  for (let r = 0, i = t.length; r < i; ) {
888
888
  this.posOut >= n && this.keccak();
@@ -897,10 +897,10 @@ class ae extends Ss {
897
897
  return this.writeInto(t);
898
898
  }
899
899
  xof(t) {
900
- return Te(t), this.xofInto(new Uint8Array(t));
900
+ return De(t), this.xofInto(new Uint8Array(t));
901
901
  }
902
902
  digestInto(t) {
903
- if (gs(t, this), this.finished)
903
+ if (As(t, this), this.finished)
904
904
  throw new Error("digest() was already called");
905
905
  return this.writeInto(t), this.destroy(), t;
906
906
  }
@@ -908,18 +908,18 @@ class ae extends Ss {
908
908
  return this.digestInto(new Uint8Array(this.outputLen));
909
909
  }
910
910
  destroy() {
911
- this.destroyed = !0, rt(this.state);
911
+ this.destroyed = !0, dt(this.state);
912
912
  }
913
913
  _cloneInto(t) {
914
914
  const { blockLen: s, suffix: n, outputLen: r, rounds: i, enableXOF: o } = this;
915
- return t || (t = new ae(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;
915
+ return t || (t = new ye(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 ks = (e, t, s) => Rs(() => new ae(t, e, s)), Os = ks(1, 136, 256 / 8);
919
- function Ds(e, t) {
920
- return Os(oe(e, { strict: !1 }) ? os(e) : e);
918
+ const zs = (e, t, s) => ks(() => new ye(t, e, s)), js = zs(1, 136, 256 / 8);
919
+ function qs(e, t) {
920
+ return js(ge(e, { strict: !1 }) ? ps(e) : e);
921
921
  }
922
- class Ns extends A {
922
+ class Fs extends A {
923
923
  constructor({ address: t }) {
924
924
  super(`Address "${t}" is invalid.`, {
925
925
  metaMessages: [
@@ -930,7 +930,7 @@ class Ns extends A {
930
930
  });
931
931
  }
932
932
  }
933
- class lt extends Map {
933
+ class bt extends Map {
934
934
  constructor(t) {
935
935
  super(), Object.defineProperty(this, "maxSize", {
936
936
  enumerable: !0,
@@ -951,190 +951,203 @@ class lt extends Map {
951
951
  return this;
952
952
  }
953
953
  }
954
- const W = /* @__PURE__ */ new lt(8192);
955
- function ft(e, t) {
954
+ const W = /* @__PURE__ */ new bt(8192);
955
+ function Et(e, t) {
956
956
  if (W.has(`${e}.${t}`))
957
957
  return W.get(`${e}.${t}`);
958
- const s = e.substring(2).toLowerCase(), n = Ds(nt(s)), r = s.split("");
958
+ const s = e.substring(2).toLowerCase(), n = qs(ht(s)), r = s.split("");
959
959
  for (let o = 0; o < 40; o += 2)
960
960
  n[o >> 1] >> 4 >= 8 && r[o] && (r[o] = r[o].toUpperCase()), (n[o >> 1] & 15) >= 8 && r[o + 1] && (r[o + 1] = r[o + 1].toUpperCase());
961
961
  const i = `0x${r.join("")}`;
962
962
  return W.set(`${e}.${t}`, i), i;
963
963
  }
964
964
  function R(e, t) {
965
- if (!Bs(e, { strict: !1 }))
966
- throw new Ns({ address: e });
967
- return ft(e, t);
965
+ if (!Ks(e, { strict: !1 }))
966
+ throw new Fs({ address: e });
967
+ return Et(e, t);
968
968
  }
969
- const Ms = /^0x[a-fA-F0-9]{40}$/, V = /* @__PURE__ */ new lt(8192);
970
- function Bs(e, t) {
969
+ const Hs = /^0x[a-fA-F0-9]{40}$/, V = /* @__PURE__ */ new bt(8192);
970
+ function Ks(e, t) {
971
971
  const { strict: s = !0 } = t ?? {}, n = `${e}.${s}`;
972
972
  if (V.has(n))
973
973
  return V.get(n);
974
- const r = Ms.test(e) ? e.toLowerCase() === e ? !0 : s ? ft(e) === e : !0 : !1;
974
+ const r = Hs.test(e) ? e.toLowerCase() === e ? !0 : s ? Et(e) === e : !0 : !1;
975
975
  return V.set(n, r), r;
976
976
  }
977
- const _s = {
978
- chainId: He.chainId,
977
+ const Z = {
978
+ chainId: Qe.chainId,
979
979
  address: R("0x75faf114eafb1BDbe2F0316DF893fd58CE46AA4d"),
980
980
  symbol: "USDC",
981
981
  fiatISO: "USD",
982
982
  decimals: 6,
983
983
  logoURI: "https://pay.daimo.com/coin-logos/usdc.png",
984
984
  logoSourceURI: "https://pay.daimo.com/coin-logos/usdc.png"
985
- }, $s = {
986
- chainId: Fe.chainId,
985
+ }, Q = {
986
+ chainId: Ze.chainId,
987
987
  address: R("0xaf88d065e77c8cC2239327C5EDb3A432268e5831"),
988
988
  symbol: "USDC",
989
989
  name: "USD Coin",
990
990
  decimals: 6,
991
991
  logoURI: "https://pay.daimo.com/coin-logos/usdc.png"
992
992
  /* USDC */
993
- }, Ls = {
994
- chainId: Ge.chainId,
993
+ }, ee = {
994
+ chainId: it.chainId,
995
995
  address: R("0x5425890298aed601595a70ab815c96711a31bc65"),
996
996
  symbol: "USDC",
997
997
  fiatISO: "USD",
998
998
  decimals: 6,
999
999
  logoURI: "https://pay.daimo.com/coin-logos/usdc.png",
1000
1000
  logoSourceURI: "https://pay.daimo.com/coin-logos/usdc.png"
1001
- }, zs = {
1002
- chainId: Je.chainId,
1001
+ }, te = {
1002
+ chainId: ot.chainId,
1003
1003
  address: R("0xB97EF9Ef8734C71904D8002F8b6Bc66Dd9c48a6E"),
1004
1004
  symbol: "USDC",
1005
1005
  fiatISO: "USD",
1006
1006
  decimals: 6,
1007
1007
  logoURI: "https://pay.daimo.com/coin-logos/usdc.png",
1008
1008
  logoSourceURI: "https://pay.daimo.com/coin-logos/usdc.png"
1009
- }, qs = {
1010
- chainId: We.chainId,
1009
+ }, se = {
1010
+ chainId: tt.chainId,
1011
1011
  address: R("0x036CbD53842c5426634e7929541eC2318f3dCF7e"),
1012
1012
  symbol: "USDC",
1013
1013
  fiatISO: "USD",
1014
1014
  decimals: 6,
1015
1015
  logoURI: "https://pay.daimo.com/coin-logos/usdc.png",
1016
1016
  logoSourceURI: "https://pay.daimo.com/coin-logos/usdc.png"
1017
- }, js = {
1018
- chainId: Ke.chainId,
1017
+ }, ne = {
1018
+ chainId: et.chainId,
1019
1019
  address: R("0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913"),
1020
1020
  symbol: "USDC",
1021
1021
  fiatISO: "USD",
1022
1022
  decimals: 6,
1023
1023
  logoURI: "https://pay.daimo.com/coin-logos/usdc.png",
1024
1024
  logoSourceURI: "https://pay.daimo.com/coin-logos/usdc.png"
1025
- }, Fs = {
1026
- chainId: Ve.chainId,
1025
+ }, re = {
1026
+ chainId: st.chainId,
1027
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
- }, Hs = {
1033
- chainId: Xe.chainId,
1032
+ }, oe = {
1033
+ chainId: rt.chainId,
1034
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
- }, Ks = {
1040
- chainId: Ye.chainId,
1039
+ }, ie = {
1040
+ chainId: nt.chainId,
1041
1041
  address: R("0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48"),
1042
1042
  symbol: "USDC",
1043
1043
  decimals: 6,
1044
1044
  logoURI: "https://pay.daimo.com/coin-logos/usdc.png",
1045
1045
  logoSourceURI: "https://pay.daimo.com/coin-logos/usdc.png"
1046
1046
  }, Ws = {
1047
- chainId: Ze.chainId,
1047
+ chainId: at.chainId,
1048
1048
  address: "0x053C91253BC9682c04929cA02ED00b3E423f6710D2ee7e0D5EBB06F3eCF368A8",
1049
1049
  symbol: "USDC",
1050
1050
  decimals: 6,
1051
1051
  logoURI: "https://pay.daimo.com/coin-logos/usdc.png",
1052
1052
  logoSourceURI: "https://pay.daimo.com/coin-logos/usdc.png"
1053
- }, Ue = {
1053
+ }, Vs = {
1054
+ [Z.chainId]: Z,
1055
+ [Q.chainId]: Q,
1056
+ [ee.chainId]: ee,
1057
+ [te.chainId]: te,
1058
+ [se.chainId]: se,
1059
+ [ne.chainId]: ne,
1060
+ [oe.chainId]: oe,
1061
+ [ie.chainId]: ie,
1062
+ [re.chainId]: re
1063
+ }, ae = {
1054
1064
  ARBITRUM_MAINNET: {
1055
- ...Fe,
1065
+ ...Ze,
1056
1066
  tokens: {
1057
- [E.USDC]: $s
1067
+ [E.USDC]: Q
1058
1068
  },
1059
1069
  explorer: "https://arbiscan.io"
1060
1070
  },
1061
1071
  ARBITRUM_TESTNET: {
1062
- ...He,
1072
+ ...Qe,
1063
1073
  explorer: "https://sepolia.arbiscan.io",
1064
1074
  tokens: {
1065
- [E.USDC]: _s
1075
+ [E.USDC]: Z
1066
1076
  }
1067
1077
  },
1068
1078
  AVALANCHE_MAINNET: {
1069
- ...Je,
1079
+ ...ot,
1070
1080
  tokens: {
1071
- [E.USDC]: zs
1081
+ [E.USDC]: te
1072
1082
  },
1073
1083
  explorer: "https://snowtrace.io"
1074
1084
  },
1075
1085
  AVALANCHE_TESTNET: {
1076
- ...Ge,
1086
+ ...it,
1077
1087
  tokens: {
1078
- [E.USDC]: Ls
1088
+ [E.USDC]: ee
1079
1089
  },
1080
1090
  explorer: "https://testnet.snowtrace.io"
1081
1091
  },
1082
1092
  BASE_MAINNET: {
1083
- ...Ke,
1093
+ ...et,
1084
1094
  tokens: {
1085
- [E.USDC]: js
1095
+ [E.USDC]: ne
1086
1096
  },
1087
1097
  explorer: "https://basescan.org"
1088
1098
  },
1089
1099
  BASE_TESTNET: {
1090
- ...We,
1100
+ ...tt,
1091
1101
  tokens: {
1092
- [E.USDC]: qs
1102
+ [E.USDC]: se
1093
1103
  },
1094
1104
  explorer: "https://sepolia.basescan.org"
1095
1105
  },
1096
1106
  BSC_MAINNET: {
1097
- ...Ve,
1107
+ ...st,
1098
1108
  tokens: {
1099
- [E.USDC]: Fs
1109
+ [E.USDC]: re
1100
1110
  },
1101
1111
  explorer: "https://bscscan.com"
1102
1112
  },
1103
1113
  ETHEREUM_MAINNET: {
1104
- ...Ye,
1114
+ ...nt,
1105
1115
  tokens: {
1106
- [E.USDC]: Ks
1116
+ [E.USDC]: ie
1107
1117
  },
1108
1118
  explorer: "https://etherscan.io"
1109
1119
  },
1110
1120
  ETHEREUM_TESTNET: {
1111
- ...Xe,
1121
+ ...rt,
1112
1122
  tokens: {
1113
- [E.USDC]: Hs
1123
+ [E.USDC]: oe
1114
1124
  },
1115
1125
  explorer: "https://sepolia.etherscan.io"
1116
1126
  },
1117
1127
  STARKNET_MAINNET: {
1118
- ...Ze,
1128
+ ...at,
1119
1129
  tokens: {
1120
1130
  [E.USDC]: Ws
1121
1131
  },
1122
1132
  explorer: ""
1123
1133
  }
1124
1134
  };
1125
- var Z = /* @__PURE__ */ ((e) => (e.ARBITRUM = "ARBITRUM_MAINNET", e.ARBITRUM_TESTNET = "ARBITRUM_TESTNET", e.AVALANCHE = "AVALANCHE_MAINNET", e.AVALANCHE_TESTNET = "AVALANCHE_TESTNET", e.BASE = "BASE_MAINNET", e.BASE_TESTNET = "BASE_TESTNET", e.BSC = "BSC_MAINNET", e.ETHEREUM = "ETHEREUM_MAINNET", e.ETHEREUM_TESTNET = "ETHEREUM_TESTNET", e.STARKNET = "STARKNET_MAINNET", e))(Z || {}), ht = /* @__PURE__ */ ((e) => (e.USDC = "USDC", e))(ht || {});
1126
- const Vs = (e) => {
1135
+ var ce = /* @__PURE__ */ ((e) => (e.ARBITRUM = "ARBITRUM_MAINNET", e.ARBITRUM_TESTNET = "ARBITRUM_TESTNET", e.AVALANCHE = "AVALANCHE_MAINNET", e.AVALANCHE_TESTNET = "AVALANCHE_TESTNET", e.BASE = "BASE_MAINNET", e.BASE_TESTNET = "BASE_TESTNET", e.BSC = "BSC_MAINNET", e.ETHEREUM = "ETHEREUM_MAINNET", e.ETHEREUM_TESTNET = "ETHEREUM_TESTNET", e.STARKNET = "STARKNET_MAINNET", e))(ce || {}), St = /* @__PURE__ */ ((e) => (e.USDC = "USDC", e))(St || {});
1136
+ function Ys(e) {
1137
+ return Vs[ae[e || ""].chainId]?.decimals || 6;
1138
+ }
1139
+ const Xs = (e) => {
1127
1140
  const t = e?.trim().toUpperCase();
1128
- if (Ue[t])
1129
- return Ue[t];
1141
+ if (ae[t])
1142
+ return ae[t];
1130
1143
  };
1131
- function Ys(e, t) {
1132
- return Vs(e)?.tokens[t]?.address;
1144
+ function Js(e, t) {
1145
+ return Xs(e)?.tokens[t]?.address;
1133
1146
  }
1134
- var ce = /* @__PURE__ */ ((e) => (e.PRODUCTION = "production", e.STAGING = "staging", e))(ce || {});
1147
+ var we = /* @__PURE__ */ ((e) => (e.PRODUCTION = "production", e.STAGING = "staging", e))(we || {});
1135
1148
  class h {
1136
1149
  constructor({ api_key: t, env: s, seesion_token: n }) {
1137
- this.api_key = t || "", this.sessionToken = n || "", this.env = s ?? ce.PRODUCTION;
1150
+ this.api_key = t || "", this.sessionToken = n || "", this.env = s ?? we.PRODUCTION;
1138
1151
  }
1139
1152
  static async config(t) {
1140
1153
  if (!h.app) {
@@ -1180,9 +1193,9 @@ class h {
1180
1193
  return i + o + a;
1181
1194
  }
1182
1195
  }
1183
- let Q = null;
1184
- function Xs() {
1185
- Q = Zt.create({
1196
+ let ue = null;
1197
+ function Gs() {
1198
+ ue = as.create({
1186
1199
  prefixUrl: h.getBaseUrl(),
1187
1200
  headers: {
1188
1201
  "Content-Type": "application/json"
@@ -1201,106 +1214,118 @@ function Xs() {
1201
1214
  }
1202
1215
  });
1203
1216
  }
1204
- function y() {
1205
- return Q || Xs(), Q;
1217
+ function m() {
1218
+ return ue || Gs(), ue;
1206
1219
  }
1207
- class Js {
1220
+ class Zs {
1208
1221
  async getById(t) {
1209
- return await y().get("intents/" + t).json();
1222
+ return await m().get("intents/" + t).json();
1210
1223
  }
1211
1224
  async getForSender(t) {
1212
- return await y().get("intents/user/" + t).json();
1225
+ return await m().get("intents/user/" + t).json();
1213
1226
  }
1214
1227
  async getForAddress(t) {
1215
- return await y().get("intents/address/" + t).json();
1228
+ return await m().get("intents/address/" + t).json();
1229
+ }
1230
+ async getForSession(t) {
1231
+ return await m().get("modal/sessions/intents/" + t).json();
1216
1232
  }
1217
1233
  async getAll(t) {
1218
- return await y().get("intents", { searchParams: t }).json();
1234
+ return await m().get("intents", { searchParams: t }).json();
1219
1235
  }
1220
1236
  async create(t) {
1221
- return await y().post("intents", { json: t }).json();
1237
+ return await m().post("intents", { json: t }).json();
1238
+ }
1239
+ async createForSession(t) {
1240
+ return await m().post("modal/sessions/intents", { json: t }).json();
1222
1241
  }
1223
1242
  async update(t, s) {
1224
- return await y().post("intents", { json: s }).json();
1243
+ return await m().post("intents", { json: s }).json();
1225
1244
  }
1226
1245
  async triggerProcessing(t) {
1227
- return await y().post(`intents/${t}/trigger-processing`).json();
1246
+ return await m().post(`intents/${t}/trigger-processing`).json();
1247
+ }
1248
+ async triggerProcessingForSession(t) {
1249
+ return await m().post(`modal/sessions/intents/${t}/process`).json();
1228
1250
  }
1229
1251
  }
1230
- class Gs {
1252
+ class Qs {
1231
1253
  async getFromSpecificBridge(t) {
1232
- return await y().get("quotes/single", { searchParams: t }).json();
1254
+ return await m().get("quotes/single", { searchParams: t }).json();
1233
1255
  }
1234
1256
  async getFromAllBridges(t) {
1235
- return await y().get("quotes/multiple", { searchParams: t }).json();
1257
+ return await m().get("quotes/multiple", { searchParams: t }).json();
1236
1258
  }
1237
1259
  async getBestAcrossBridges(t) {
1238
- return await y().get("quotes/best", { searchParams: t }).json();
1260
+ return await m().get("quotes/best", { searchParams: t }).json();
1239
1261
  }
1240
1262
  async getAll(t) {
1241
- return await y().get("quotes/multi-source", { searchParams: t }).json();
1263
+ return await m().get("quotes/multi-source", { searchParams: t }).json();
1264
+ }
1265
+ async getAllForSession(t) {
1266
+ return await m().get("modal/sessions/quotes", { searchParams: t }).json();
1242
1267
  }
1243
1268
  }
1244
- class Zs {
1269
+ class en {
1245
1270
  async getOptimalRoutes(t) {
1246
- return await y().get("router/optimal-route", { searchParams: t }).json();
1271
+ return await m().get("router/optimal-route", { searchParams: t }).json();
1247
1272
  }
1248
1273
  async getAllSupportedBridges() {
1249
- return await y().get("router/supported-bridges/all").json();
1274
+ return await m().get("router/supported-bridges/all").json();
1250
1275
  }
1251
1276
  async getSupportedBridges(t) {
1252
- return await y().get("router/supported-bridges/route", { searchParams: t }).json();
1277
+ return await m().get("router/supported-bridges/route", { searchParams: t }).json();
1253
1278
  }
1254
1279
  async getSupportedRoutes(t, s) {
1255
- return await y().get("router/supported-bridges/bridge/" + t, { searchParams: s }).json();
1280
+ return await m().get("router/supported-bridges/bridge/" + t, { searchParams: s }).json();
1256
1281
  }
1257
1282
  }
1258
- class Qs {
1283
+ class tn {
1259
1284
  async getSupported(t) {
1260
- return await y().get("chains", { searchParams: t }).json();
1285
+ return await m().get("chains", { searchParams: t }).json();
1261
1286
  }
1262
1287
  }
1263
- class en {
1288
+ class sn {
1264
1289
  async getClientInfo() {
1265
- return await y().get("client/auth/client-info").json();
1290
+ return await m().get("client/auth/client-info").json();
1266
1291
  }
1267
1292
  }
1268
- class tn {
1293
+ class nn {
1269
1294
  getSessionToken(t) {
1270
1295
  const s = {
1271
1296
  recipient: t.recipient,
1272
- tokenOut: Ys(
1273
- Z[t.destinationChain],
1274
- ht[t.token]
1297
+ tokenOut: Js(
1298
+ ce[t.destinationChain],
1299
+ St[t.token]
1275
1300
  ),
1276
- destinationChain: Z[t.destinationChain],
1301
+ destinationChain: ce[t.destinationChain],
1277
1302
  amount: t.amount
1278
1303
  };
1279
- return y().post("modal/sessions", { json: s }).json();
1304
+ return m().post("modal/sessions", { json: s }).json();
1280
1305
  }
1281
1306
  }
1282
- const Pn = {
1283
- router: new Zs(),
1284
- quotes: new Gs(),
1285
- intents: new Js(),
1286
- chains: new Qs(),
1287
- client: new en(),
1288
- auth: new tn()
1307
+ const xn = {
1308
+ router: new en(),
1309
+ quotes: new Qs(),
1310
+ intents: new Zs(),
1311
+ chains: new tn(),
1312
+ client: new sn(),
1313
+ auth: new nn()
1289
1314
  };
1290
- function dt(e) {
1315
+ function Rt(e) {
1291
1316
  var t, s, n = "";
1292
1317
  if (typeof e == "string" || typeof e == "number") n += e;
1293
1318
  else if (typeof e == "object") if (Array.isArray(e)) {
1294
1319
  var r = e.length;
1295
- for (t = 0; t < r; t++) e[t] && (s = dt(e[t])) && (n && (n += " "), n += s);
1320
+ for (t = 0; t < r; t++) e[t] && (s = Rt(e[t])) && (n && (n += " "), n += s);
1296
1321
  } else for (s in e) e[s] && (n && (n += " "), n += s);
1297
1322
  return n;
1298
1323
  }
1299
- function sn() {
1300
- for (var e, t, s = 0, n = "", r = arguments.length; s < r; s++) (e = arguments[s]) && (t = dt(e)) && (n && (n += " "), n += t);
1324
+ function rn() {
1325
+ for (var e, t, s = 0, n = "", r = arguments.length; s < r; s++) (e = arguments[s]) && (t = Rt(e)) && (n && (n += " "), n += t);
1301
1326
  return n;
1302
1327
  }
1303
- function In(e) {
1328
+ function kn(e) {
1304
1329
  const {
1305
1330
  to: t,
1306
1331
  token: s,
@@ -1313,8 +1338,8 @@ function In(e) {
1313
1338
  onCancel: u,
1314
1339
  onSuccess: l,
1315
1340
  data: w
1316
- } = e, [d, m] = Ne(!0), T = se(null);
1317
- ne(() => {
1341
+ } = e, [d, y] = Fe(!0), T = he(null);
1342
+ de(() => {
1318
1343
  f();
1319
1344
  const p = document.body.style.overflow;
1320
1345
  i ? (document.body.style.overflow = "hidden", document.body.style.overflow = "hidden") : document.body.style.overflow = p || "";
@@ -1325,24 +1350,24 @@ function In(e) {
1325
1350
  document.body.style.overflow = p || "", window.removeEventListener("message", g);
1326
1351
  };
1327
1352
  }, [i, u, l]);
1328
- function j() {
1329
- m(!1), f();
1353
+ function q() {
1354
+ y(!1), f();
1330
1355
  }
1331
1356
  function f() {
1332
1357
  if (!w?.sessionToken) return;
1333
1358
  const p = {
1334
1359
  type: "session",
1335
1360
  session_token: w.sessionToken,
1336
- environment: h.getEnv() || ce.PRODUCTION
1361
+ environment: h.getEnv() || we.PRODUCTION
1337
1362
  };
1338
1363
  T.current?.contentWindow?.postMessage(p, "https://app.chainrails.io"), T.current?.contentWindow?.postMessage(p, "https://chainrails-frontend-git-staging-horus-labs.vercel.app");
1339
1364
  }
1340
- return w?.sessionToken ? /* @__PURE__ */ ye("div", {
1341
- className: sn("payment-modal-wrapper", d || o ? "loading" : "not-loading", i ? "open" : "closed"),
1365
+ return w?.sessionToken ? /* @__PURE__ */ Pe("div", {
1366
+ className: rn("payment-modal-wrapper", d || o ? "loading" : "not-loading", i ? "open" : "closed"),
1342
1367
  children: [(d || o) && /* @__PURE__ */ U("div", {
1343
1368
  role: "status",
1344
1369
  className: "payment-modal-loader",
1345
- children: /* @__PURE__ */ ye("svg", {
1370
+ children: /* @__PURE__ */ Pe("svg", {
1346
1371
  "aria-hidden": "true",
1347
1372
  className: "icon",
1348
1373
  viewBox: "0 0 100 101",
@@ -1359,25 +1384,31 @@ function In(e) {
1359
1384
  }), /* @__PURE__ */ U("iframe", {
1360
1385
  allow: "clipboard-read *; clipboard-write *",
1361
1386
  src: h.getPayModalUrl(n, s, t, r),
1362
- onLoad: j,
1387
+ onLoad: q,
1363
1388
  className: `payment-modal ${d || o ? "invisible" : "visible"}`,
1364
1389
  "data-id": r,
1365
1390
  ref: T
1366
1391
  })]
1367
- }) : /* @__PURE__ */ U(It, {});
1392
+ }) : /* @__PURE__ */ U(Bt, {});
1393
+ }
1394
+ function on(e) {
1395
+ return BigInt(e).toString();
1368
1396
  }
1369
- const nn = Symbol(), ue = Symbol(), x = "a", pt = "f", Ce = "p", gt = "c", mt = "t", le = "h", k = "w", fe = "o", he = "k";
1370
- let rn = (e, t) => new Proxy(e, t);
1371
- const ee = Object.getPrototypeOf, te = /* @__PURE__ */ new WeakMap(), yt = (e) => e && (te.has(e) ? te.get(e) : ee(e) === Object.prototype || ee(e) === Array.prototype), $ = (e) => typeof e == "object" && e !== null, on = (e) => Object.values(Object.getOwnPropertyDescriptors(e)).some((t) => !t.configurable && !t.writable), an = (e) => {
1397
+ function an(e, t) {
1398
+ return Number(e) * Math.pow(10, t);
1399
+ }
1400
+ const cn = Symbol(), be = Symbol(), x = "a", Tt = "f", _e = "p", At = "c", It = "t", Ee = "h", k = "w", Se = "o", Re = "k";
1401
+ let un = (e, t) => new Proxy(e, t);
1402
+ const le = Object.getPrototypeOf, fe = /* @__PURE__ */ new WeakMap(), vt = (e) => e && (fe.has(e) ? fe.get(e) : le(e) === Object.prototype || le(e) === Array.prototype), _ = (e) => typeof e == "object" && e !== null, ln = (e) => Object.values(Object.getOwnPropertyDescriptors(e)).some((t) => !t.configurable && !t.writable), fn = (e) => {
1372
1403
  if (Array.isArray(e))
1373
1404
  return Array.from(e);
1374
1405
  const t = Object.getOwnPropertyDescriptors(e);
1375
1406
  return Object.values(t).forEach((s) => {
1376
1407
  s.configurable = !0;
1377
- }), Object.create(ee(e), t);
1378
- }, cn = (e, t) => {
1408
+ }), Object.create(le(e), t);
1409
+ }, hn = (e, t) => {
1379
1410
  const s = {
1380
- [pt]: t
1411
+ [Tt]: t
1381
1412
  };
1382
1413
  let n = !1;
1383
1414
  const r = (a, c) => {
@@ -1394,43 +1425,43 @@ const ee = Object.getPrototypeOf, te = /* @__PURE__ */ new WeakMap(), yt = (e) =
1394
1425
  n = !0, s[x].delete(e);
1395
1426
  }, o = {
1396
1427
  get(a, c) {
1397
- return c === ue ? e : (r(he, c), wt(Reflect.get(a, c), s[x], s[gt], s[mt]));
1428
+ return c === be ? e : (r(Re, c), Pt(Reflect.get(a, c), s[x], s[At], s[It]));
1398
1429
  },
1399
1430
  has(a, c) {
1400
- return c === nn ? (i(), !0) : (r(le, c), Reflect.has(a, c));
1431
+ return c === cn ? (i(), !0) : (r(Ee, c), Reflect.has(a, c));
1401
1432
  },
1402
1433
  getOwnPropertyDescriptor(a, c) {
1403
- return r(fe, c), Reflect.getOwnPropertyDescriptor(a, c);
1434
+ return r(Se, c), Reflect.getOwnPropertyDescriptor(a, c);
1404
1435
  },
1405
1436
  ownKeys(a) {
1406
1437
  return r(k), Reflect.ownKeys(a);
1407
1438
  }
1408
1439
  };
1409
1440
  return t && (o.set = o.deleteProperty = () => !1), [o, s];
1410
- }, de = (e) => (
1441
+ }, Te = (e) => (
1411
1442
  // unwrap proxy
1412
- e[ue] || // otherwise
1443
+ e[be] || // otherwise
1413
1444
  e
1414
- ), wt = (e, t, s, n) => {
1415
- if (!yt(e))
1445
+ ), Pt = (e, t, s, n) => {
1446
+ if (!vt(e))
1416
1447
  return e;
1417
1448
  let r = n && n.get(e);
1418
1449
  if (!r) {
1419
- const c = de(e);
1420
- on(c) ? r = [c, an(c)] : r = [c], n?.set(e, r);
1450
+ const c = Te(e);
1451
+ ln(c) ? r = [c, fn(c)] : r = [c], n?.set(e, r);
1421
1452
  }
1422
1453
  const [i, o] = r;
1423
1454
  let a = s && s.get(i);
1424
- return (!a || a[1][pt] !== !!o) && (a = cn(i, !!o), a[1][Ce] = rn(o || i, a[0]), s && s.set(i, a)), a[1][x] = t, a[1][gt] = s, a[1][mt] = n, a[1][Ce];
1425
- }, un = (e, t) => {
1455
+ return (!a || a[1][Tt] !== !!o) && (a = hn(i, !!o), a[1][_e] = un(o || i, a[0]), s && s.set(i, a)), a[1][x] = t, a[1][At] = s, a[1][It] = n, a[1][_e];
1456
+ }, dn = (e, t) => {
1426
1457
  const s = Reflect.ownKeys(e), n = Reflect.ownKeys(t);
1427
1458
  return s.length !== n.length || s.some((r, i) => r !== n[i]);
1428
- }, bt = (e, t, s, n, r = Object.is) => {
1459
+ }, Ut = (e, t, s, n, r = Object.is) => {
1429
1460
  if (r(e, t))
1430
1461
  return !1;
1431
- if (!$(e) || !$(t))
1462
+ if (!_(e) || !_(t))
1432
1463
  return !0;
1433
- const i = s.get(de(e));
1464
+ const i = s.get(Te(e));
1434
1465
  if (!i)
1435
1466
  return !0;
1436
1467
  if (n) {
@@ -1439,57 +1470,57 @@ const ee = Object.getPrototypeOf, te = /* @__PURE__ */ new WeakMap(), yt = (e) =
1439
1470
  n.set(e, t);
1440
1471
  }
1441
1472
  let o = null;
1442
- for (const a of i[le] || [])
1473
+ for (const a of i[Ee] || [])
1443
1474
  if (o = Reflect.has(e, a) !== Reflect.has(t, a), o)
1444
1475
  return o;
1445
1476
  if (i[k] === !0) {
1446
- if (o = un(e, t), o)
1477
+ if (o = dn(e, t), o)
1447
1478
  return o;
1448
1479
  } else
1449
- for (const a of i[fe] || []) {
1480
+ for (const a of i[Se] || []) {
1450
1481
  const c = !!Reflect.getOwnPropertyDescriptor(e, a), u = !!Reflect.getOwnPropertyDescriptor(t, a);
1451
1482
  if (o = c !== u, o)
1452
1483
  return o;
1453
1484
  }
1454
- for (const a of i[he] || [])
1455
- if (o = bt(e[a], t[a], s, n, r), o)
1485
+ for (const a of i[Re] || [])
1486
+ if (o = Ut(e[a], t[a], s, n, r), o)
1456
1487
  return o;
1457
1488
  if (o === null)
1458
1489
  throw new Error("invalid used");
1459
1490
  return o;
1460
- }, ln = (e) => yt(e) && e[ue] || null, xe = (e, t = !0) => {
1461
- te.set(e, t);
1462
- }, fn = (e, t, s) => {
1491
+ }, pn = (e) => vt(e) && e[be] || null, Le = (e, t = !0) => {
1492
+ fe.set(e, t);
1493
+ }, gn = (e, t, s) => {
1463
1494
  const n = [], r = /* @__PURE__ */ new WeakSet(), i = (o, a) => {
1464
1495
  var c, u, l;
1465
1496
  if (r.has(o))
1466
1497
  return;
1467
- $(o) && r.add(o);
1468
- const w = $(o) && t.get(de(o));
1498
+ _(o) && r.add(o);
1499
+ const w = _(o) && t.get(Te(o));
1469
1500
  if (w) {
1470
- if ((c = w[le]) === null || c === void 0 || c.forEach((d) => {
1471
- const m = `:has(${String(d)})`;
1472
- n.push(a ? [...a, m] : [m]);
1501
+ if ((c = w[Ee]) === null || c === void 0 || c.forEach((d) => {
1502
+ const y = `:has(${String(d)})`;
1503
+ n.push(a ? [...a, y] : [y]);
1473
1504
  }), w[k] === !0) {
1474
1505
  const d = ":ownKeys";
1475
1506
  n.push(a ? [...a, d] : [d]);
1476
1507
  } else
1477
- (u = w[fe]) === null || u === void 0 || u.forEach((d) => {
1478
- const m = `:hasOwn(${String(d)})`;
1479
- n.push(a ? [...a, m] : [m]);
1508
+ (u = w[Se]) === null || u === void 0 || u.forEach((d) => {
1509
+ const y = `:hasOwn(${String(d)})`;
1510
+ n.push(a ? [...a, y] : [y]);
1480
1511
  });
1481
- (l = w[he]) === null || l === void 0 || l.forEach((d) => {
1512
+ (l = w[Re]) === null || l === void 0 || l.forEach((d) => {
1482
1513
  "value" in (Object.getOwnPropertyDescriptor(o, d) || {}) && i(o[d], a ? [...a, d] : [d]);
1483
1514
  });
1484
1515
  } else a && n.push(a);
1485
1516
  };
1486
1517
  return i(e), n;
1487
- }, L = {}, pe = (e) => typeof e == "object" && e !== null, hn = (e) => pe(e) && !ge.has(e) && (Array.isArray(e) || !(Symbol.iterator in e)) && !(e instanceof WeakMap) && !(e instanceof WeakSet) && !(e instanceof Error) && !(e instanceof Number) && !(e instanceof Date) && !(e instanceof String) && !(e instanceof RegExp) && !(e instanceof ArrayBuffer) && !(e instanceof Promise), Et = (e, t) => {
1488
- const s = ke.get(e);
1518
+ }, L = {}, Ae = (e) => typeof e == "object" && e !== null, mn = (e) => Ae(e) && !Ie.has(e) && (Array.isArray(e) || !(Symbol.iterator in e)) && !(e instanceof WeakMap) && !(e instanceof WeakSet) && !(e instanceof Error) && !(e instanceof Number) && !(e instanceof Date) && !(e instanceof String) && !(e instanceof RegExp) && !(e instanceof ArrayBuffer) && !(e instanceof Promise), Ct = (e, t) => {
1519
+ const s = ze.get(e);
1489
1520
  if (s?.[0] === t)
1490
1521
  return s[1];
1491
1522
  const n = Array.isArray(e) ? [] : Object.create(Object.getPrototypeOf(e));
1492
- return xe(n, !0), ke.set(e, [t, n]), Reflect.ownKeys(e).forEach((r) => {
1523
+ return Le(n, !0), ze.set(e, [t, n]), Reflect.ownKeys(e).forEach((r) => {
1493
1524
  if (Object.getOwnPropertyDescriptor(n, r))
1494
1525
  return;
1495
1526
  const i = Reflect.get(e, r), { enumerable: o } = Reflect.getOwnPropertyDescriptor(
@@ -1502,17 +1533,17 @@ const ee = Object.getPrototypeOf, te = /* @__PURE__ */ new WeakMap(), yt = (e) =
1502
1533
  // It's still non-writable, so it avoids assigning a value.
1503
1534
  configurable: !0
1504
1535
  };
1505
- if (ge.has(i))
1506
- xe(i, !1);
1507
- else if (I.has(i)) {
1508
- const [c, u] = I.get(
1536
+ if (Ie.has(i))
1537
+ Le(i, !1);
1538
+ else if (P.has(i)) {
1539
+ const [c, u] = P.get(
1509
1540
  i
1510
1541
  );
1511
- a.value = Et(c, u());
1542
+ a.value = Ct(c, u());
1512
1543
  }
1513
1544
  Object.defineProperty(n, r, a);
1514
1545
  }), Object.preventExtensions(n);
1515
- }, dn = (e, t, s, n) => ({
1546
+ }, yn = (e, t, s, n) => ({
1516
1547
  deleteProperty(r, i) {
1517
1548
  const o = Reflect.get(r, i);
1518
1549
  s(i);
@@ -1521,16 +1552,16 @@ const ee = Object.getPrototypeOf, te = /* @__PURE__ */ new WeakMap(), yt = (e) =
1521
1552
  },
1522
1553
  set(r, i, o, a) {
1523
1554
  const c = !e() && Reflect.has(r, i), u = Reflect.get(r, i, a);
1524
- if (c && (Oe(u, o) || z.has(o) && Oe(u, z.get(o))))
1555
+ if (c && (je(u, o) || z.has(o) && je(u, z.get(o))))
1525
1556
  return !0;
1526
- s(i), pe(o) && (o = ln(o) || o);
1527
- const l = !I.has(o) && gn(o) ? St(o) : o;
1557
+ s(i), Ae(o) && (o = pn(o) || o);
1558
+ const l = !P.has(o) && bn(o) ? xt(o) : o;
1528
1559
  return t(i, l), Reflect.set(r, i, l, a), n(["set", [i], o, u]), !0;
1529
1560
  }
1530
- }), I = /* @__PURE__ */ new WeakMap(), ge = /* @__PURE__ */ new WeakSet(), ke = /* @__PURE__ */ new WeakMap(), Y = [1], z = /* @__PURE__ */ new WeakMap();
1531
- let Oe = Object.is, pn = (e, t) => new Proxy(e, t), gn = hn, mn = Et, yn = dn;
1532
- function St(e = {}) {
1533
- if (!pe(e))
1561
+ }), P = /* @__PURE__ */ new WeakMap(), Ie = /* @__PURE__ */ new WeakSet(), ze = /* @__PURE__ */ new WeakMap(), Y = [1], z = /* @__PURE__ */ new WeakMap();
1562
+ let je = Object.is, wn = (e, t) => new Proxy(e, t), bn = mn, En = Ct, Sn = yn;
1563
+ function xt(e = {}) {
1564
+ if (!Ae(e))
1534
1565
  throw new Error("object required");
1535
1566
  const t = z.get(e);
1536
1567
  if (t)
@@ -1547,7 +1578,7 @@ function St(e = {}) {
1547
1578
  const b = [...p];
1548
1579
  b[1] = [f, ...b[1]], r(b, g);
1549
1580
  }, c = /* @__PURE__ */ new Map(), u = (f, p) => {
1550
- const g = !ge.has(p) && I.get(p);
1581
+ const g = !Ie.has(p) && P.get(p);
1551
1582
  if (g) {
1552
1583
  if ((L ? "production" : void 0) !== "production" && c.has(f))
1553
1584
  throw new Error("prop listener already exists");
@@ -1564,23 +1595,23 @@ function St(e = {}) {
1564
1595
  }, w = (f) => (n.add(f), n.size === 1 && c.forEach(([g, b], D) => {
1565
1596
  if ((L ? "production" : void 0) !== "production" && b)
1566
1597
  throw new Error("remove already exists");
1567
- const Rt = g[2](a(D));
1568
- c.set(D, [g, Rt]);
1598
+ const kt = g[2](a(D));
1599
+ c.set(D, [g, kt]);
1569
1600
  }), () => {
1570
1601
  n.delete(f), n.size === 0 && c.forEach(([g, b], D) => {
1571
1602
  b && (b(), c.set(D, [g]));
1572
1603
  });
1573
1604
  });
1574
1605
  let d = !0;
1575
- const m = yn(
1606
+ const y = Sn(
1576
1607
  () => d,
1577
1608
  u,
1578
1609
  l,
1579
1610
  r
1580
- ), T = pn(e, m);
1611
+ ), T = wn(e, y);
1581
1612
  z.set(e, T);
1582
- const j = [e, o, w];
1583
- return I.set(T, j), Reflect.ownKeys(e).forEach((f) => {
1613
+ const q = [e, o, w];
1614
+ return P.set(T, q), Reflect.ownKeys(e).forEach((f) => {
1584
1615
  const p = Object.getOwnPropertyDescriptor(
1585
1616
  e,
1586
1617
  f
@@ -1588,8 +1619,8 @@ function St(e = {}) {
1588
1619
  "value" in p && p.writable && (T[f] = e[f]);
1589
1620
  }), d = !1, T;
1590
1621
  }
1591
- function wn(e, t, s) {
1592
- const n = I.get(e);
1622
+ function Rn(e, t, s) {
1623
+ const n = P.get(e);
1593
1624
  (L ? "production" : void 0) !== "production" && !n && console.warn("Please use proxy object");
1594
1625
  let r;
1595
1626
  const i = [], o = n[2];
@@ -1603,36 +1634,36 @@ function wn(e, t, s) {
1603
1634
  a = !1, u();
1604
1635
  };
1605
1636
  }
1606
- function De(e) {
1607
- const t = I.get(e);
1637
+ function qe(e) {
1638
+ const t = P.get(e);
1608
1639
  (L ? "production" : void 0) !== "production" && !t && console.warn("Please use proxy object");
1609
1640
  const [s, n] = t;
1610
- return mn(s, n());
1611
- }
1612
- const bn = {}, En = (e, t) => {
1613
- const s = se(void 0);
1614
- ne(() => {
1615
- s.current = fn(e, t);
1616
- }), Pt(s.current);
1617
- }, Sn = En, Rn = /* @__PURE__ */ new WeakMap();
1618
- function Tn(e, t) {
1619
- const n = me(
1641
+ return En(s, n());
1642
+ }
1643
+ const Tn = {}, An = (e, t) => {
1644
+ const s = he(void 0);
1645
+ de(() => {
1646
+ s.current = gn(e, t);
1647
+ }), Mt(s.current);
1648
+ }, In = An, vn = /* @__PURE__ */ new WeakMap();
1649
+ function Pn(e, t) {
1650
+ const n = ve(
1620
1651
  () => e && /* @__PURE__ */ new WeakMap(),
1621
1652
  [e]
1622
- ), r = se(void 0);
1653
+ ), r = he(void 0);
1623
1654
  let i = !0;
1624
- const o = Tt(
1625
- At(
1655
+ const o = Ot(
1656
+ Dt(
1626
1657
  (c) => {
1627
- const u = wn(e, c);
1658
+ const u = Rn(e, c);
1628
1659
  return c(), u;
1629
1660
  },
1630
1661
  [e, void 0]
1631
1662
  ),
1632
1663
  () => {
1633
- const c = De(e);
1664
+ const c = qe(e);
1634
1665
  try {
1635
- if (!i && r.current && !bt(
1666
+ if (!i && r.current && !Ut(
1636
1667
  r.current,
1637
1668
  c,
1638
1669
  n,
@@ -1643,29 +1674,29 @@ function Tn(e, t) {
1643
1674
  }
1644
1675
  return c;
1645
1676
  },
1646
- () => De(e)
1677
+ () => qe(e)
1647
1678
  );
1648
- i = !1, vt(() => {
1679
+ i = !1, Nt(() => {
1649
1680
  r.current = o;
1650
- }), (bn ? "production" : void 0) !== "production" && Sn(o, n);
1651
- const a = me(() => /* @__PURE__ */ new WeakMap(), []);
1652
- return wt(o, n, a, Rn);
1681
+ }), (Tn ? "production" : void 0) !== "production" && In(o, n);
1682
+ const a = ve(() => /* @__PURE__ */ new WeakMap(), []);
1683
+ return Pt(o, n, a, vn);
1653
1684
  }
1654
- const v = St({
1685
+ const I = xt({
1655
1686
  data: null,
1656
1687
  isPending: !1,
1657
1688
  error: null
1658
1689
  });
1659
- function Un({
1660
- auth_url: e,
1661
- chain: t,
1690
+ function On({
1691
+ session_url: e,
1692
+ destinationChain: t,
1662
1693
  token: s,
1663
1694
  amount: n,
1664
- to: r,
1695
+ recipient: r,
1665
1696
  onCancel: i,
1666
1697
  onSuccess: o
1667
1698
  }) {
1668
- const a = Tn(v), [c, u] = Ne(!1);
1699
+ const a = Pn(I), [c, u] = Fe(!1);
1669
1700
  function l() {
1670
1701
  u(!0);
1671
1702
  }
@@ -1673,32 +1704,32 @@ function Un({
1673
1704
  u(!1);
1674
1705
  }
1675
1706
  const d = () => {
1676
- v.isPending = !0, v.error = null, fetch(e, {
1707
+ I.isPending = !0, I.error = null, fetch(e, {
1677
1708
  method: "POST",
1678
1709
  headers: {
1679
1710
  "Content-Type": "application/json"
1680
1711
  },
1681
1712
  body: JSON.stringify({
1682
- chain: t,
1713
+ destinationChain: t,
1683
1714
  token: s,
1684
- amount: n,
1685
- to: r
1715
+ amount: n ? on(an(n, Ys(t))) : "0",
1716
+ recipient: r
1686
1717
  })
1687
- }).then((m) => m.json()).then((m) => {
1688
- v.data = m, h.config({
1689
- api_key: m.sessionToken
1690
- }), v.isPending = !1;
1691
- }).catch((m) => {
1692
- v.error = m?.toString(), v.isPending = !1;
1718
+ }).then((y) => y.json()).then((y) => {
1719
+ I.data = y, h.config({
1720
+ api_key: y.sessionToken
1721
+ }), I.isPending = !1;
1722
+ }).catch((y) => {
1723
+ I.error = y?.toString(), I.isPending = !1;
1693
1724
  });
1694
1725
  };
1695
- return ne(() => {
1726
+ return de(() => {
1696
1727
  d();
1697
1728
  }, [t, s, n, r]), {
1698
1729
  ...a,
1699
- chain: t,
1730
+ destinationChain: t,
1700
1731
  token: s,
1701
- to: r,
1732
+ recipient: r,
1702
1733
  isOpen: c,
1703
1734
  open: l,
1704
1735
  close: w,
@@ -1709,9 +1740,9 @@ function Un({
1709
1740
  }
1710
1741
  export {
1711
1742
  h as Chainrails,
1712
- In as PaymentModal,
1713
- Z as chains,
1714
- Pn as crapi,
1715
- ht as tokens,
1716
- Un as usePaymentSession
1743
+ kn as PaymentModal,
1744
+ ce as chains,
1745
+ xn as crapi,
1746
+ St as tokens,
1747
+ On as usePaymentSession
1717
1748
  };