@chainrails/react 0.3.0 → 0.3.2

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,15 +1,15 @@
1
- import { useState as v, useRef as ie, useEffect as x, useMemo as Ee, useSyncExternalStore as gt, useCallback as mt, useLayoutEffect as pt, useDebugValue as yt } from "react";
2
- import { jsxs as Te, jsx as L } from "react/jsx-runtime";
3
- import './index.css';class ee extends Error {
1
+ import { useState as k, useRef as le, useEffect as x, useMemo as Ce, useSyncExternalStore as bt, useCallback as Et, useLayoutEffect as St, useDebugValue as wt } from "react";
2
+ import { jsxs as Ae, jsx as _ } from "react/jsx-runtime";
3
+ import './index.css';class oe extends Error {
4
4
  response;
5
5
  request;
6
6
  options;
7
7
  constructor(e, s, n) {
8
- const r = e.status || e.status === 0 ? e.status : "", i = e.statusText ?? "", o = `${r} ${i}`.trim(), a = o ? `status code ${o}` : "an unknown error";
8
+ const o = e.status || e.status === 0 ? e.status : "", i = e.statusText ?? "", r = `${o} ${i}`.trim(), a = r ? `status code ${r}` : "an unknown error";
9
9
  super(`Request failed with ${a}: ${s.method} ${s.url}`), this.name = "HTTPError", this.response = e, this.request = s, this.options = n;
10
10
  }
11
11
  }
12
- class Me extends Error {
12
+ class je extends Error {
13
13
  name = "NonError";
14
14
  value;
15
15
  constructor(e) {
@@ -21,17 +21,17 @@ class Me extends Error {
21
21
  super(s), this.value = e;
22
22
  }
23
23
  }
24
- class V extends Error {
24
+ class J extends Error {
25
25
  name = "ForceRetryError";
26
26
  customDelay;
27
27
  code;
28
28
  customRequest;
29
29
  constructor(e) {
30
- const s = e?.cause ? e.cause instanceof Error ? e.cause : new Me(e.cause) : void 0;
30
+ const s = e?.cause ? e.cause instanceof Error ? e.cause : new je(e.cause) : void 0;
31
31
  super(e?.code ? `Forced retry: ${e.code}` : "Forced retry", s ? { cause: s } : void 0), this.customDelay = e?.delay, this.code = e?.code, this.customRequest = e?.request;
32
32
  }
33
33
  }
34
- const Se = (() => {
34
+ const De = (() => {
35
35
  let t = !1, e = !1;
36
36
  const s = typeof globalThis.ReadableStream == "function", n = typeof globalThis.Request == "function";
37
37
  if (s && n)
@@ -44,13 +44,13 @@ const Se = (() => {
44
44
  return t = !0, "half";
45
45
  }
46
46
  }).headers.has("Content-Type");
47
- } catch (r) {
48
- if (r instanceof Error && r.message === "unsupported BodyInit type")
47
+ } catch (o) {
48
+ if (o instanceof Error && o.message === "unsupported BodyInit type")
49
49
  return !1;
50
- throw r;
50
+ throw o;
51
51
  }
52
52
  return t && !e;
53
- })(), bt = typeof globalThis.AbortController == "function", Le = typeof globalThis.AbortSignal == "function" && typeof globalThis.AbortSignal.any == "function", Et = typeof globalThis.ReadableStream == "function", Tt = typeof globalThis.FormData == "function", Fe = ["get", "post", "put", "patch", "head", "delete"], St = {
53
+ })(), Rt = typeof globalThis.AbortController == "function", ze = typeof globalThis.AbortSignal == "function" && typeof globalThis.AbortSignal.any == "function", Ct = typeof globalThis.ReadableStream == "function", At = typeof globalThis.FormData == "function", qe = ["get", "post", "put", "patch", "head", "delete"], Dt = {
54
54
  json: "application/json",
55
55
  text: "text/*",
56
56
  formData: "multipart/form-data",
@@ -59,14 +59,14 @@ const Se = (() => {
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
- }, Y = 2147483647, wt = new TextEncoder().encode("------WebKitFormBoundaryaxpyiPgbbPti10Rw").length, _e = Symbol("stop");
63
- class He {
62
+ }, Z = 2147483647, Ut = new TextEncoder().encode("------WebKitFormBoundaryaxpyiPgbbPti10Rw").length, Ke = Symbol("stop");
63
+ class We {
64
64
  options;
65
65
  constructor(e) {
66
66
  this.options = e;
67
67
  }
68
68
  }
69
- const Rt = (t) => new He(t), Ct = {
69
+ const vt = (t) => new We(t), kt = {
70
70
  json: !0,
71
71
  parseJson: !0,
72
72
  stringifyJson: !0,
@@ -80,10 +80,10 @@ const Rt = (t) => new He(t), Ct = {
80
80
  onUploadProgress: !0,
81
81
  fetch: !0,
82
82
  context: !0
83
- }, At = {
83
+ }, It = {
84
84
  next: !0
85
85
  // Next.js cache revalidation (revalidate, tags)
86
- }, Dt = {
86
+ }, Pt = {
87
87
  method: !0,
88
88
  headers: !0,
89
89
  body: !0,
@@ -98,13 +98,13 @@ const Rt = (t) => new He(t), Ct = {
98
98
  signal: !0,
99
99
  window: !0,
100
100
  duplex: !0
101
- }, Ut = (t) => {
101
+ }, xt = (t) => {
102
102
  if (!t)
103
103
  return 0;
104
104
  if (t instanceof FormData) {
105
105
  let e = 0;
106
106
  for (const [s, n] of t)
107
- e += wt, e += new TextEncoder().encode(`Content-Disposition: form-data; name="${s}"`).length, e += typeof n == "string" ? new TextEncoder().encode(n).length : n.size;
107
+ e += Ut, e += new TextEncoder().encode(`Content-Disposition: form-data; name="${s}"`).length, e += typeof n == "string" ? new TextEncoder().encode(n).length : n.size;
108
108
  return e;
109
109
  }
110
110
  if (t instanceof Blob)
@@ -125,22 +125,22 @@ const Rt = (t) => new He(t), Ct = {
125
125
  return 0;
126
126
  }
127
127
  return 0;
128
- }, $e = (t, e, s) => {
129
- let n, r = 0;
128
+ }, Ve = (t, e, s) => {
129
+ let n, o = 0;
130
130
  return t.pipeThrough(new TransformStream({
131
- transform(i, o) {
132
- if (o.enqueue(i), n) {
133
- r += n.byteLength;
134
- let a = e === 0 ? 0 : r / e;
135
- a >= 1 && (a = 1 - Number.EPSILON), s?.({ percent: a, totalBytes: Math.max(e, r), transferredBytes: r }, n);
131
+ transform(i, r) {
132
+ if (r.enqueue(i), n) {
133
+ o += n.byteLength;
134
+ let a = e === 0 ? 0 : o / e;
135
+ a >= 1 && (a = 1 - Number.EPSILON), s?.({ percent: a, totalBytes: Math.max(e, o), transferredBytes: o }, n);
136
136
  }
137
137
  n = i;
138
138
  },
139
139
  flush() {
140
- n && (r += n.byteLength, s?.({ percent: 1, totalBytes: Math.max(e, r), transferredBytes: r }, n));
140
+ n && (o += n.byteLength, s?.({ percent: 1, totalBytes: Math.max(e, o), transferredBytes: o }, n));
141
141
  }
142
142
  }));
143
- }, It = (t, e) => {
143
+ }, Nt = (t, e) => {
144
144
  if (!t.body)
145
145
  return t;
146
146
  if (t.status === 204)
@@ -150,69 +150,69 @@ const Rt = (t) => new He(t), Ct = {
150
150
  headers: t.headers
151
151
  });
152
152
  const s = Math.max(0, Number(t.headers.get("content-length")) || 0);
153
- return new Response($e(t.body, s, e), {
153
+ return new Response(Ve(t.body, s, e), {
154
154
  status: t.status,
155
155
  statusText: t.statusText,
156
156
  headers: t.headers
157
157
  });
158
- }, Pt = (t, e, s) => {
158
+ }, Ot = (t, e, s) => {
159
159
  if (!t.body)
160
160
  return t;
161
- const n = Ut(s ?? t.body);
161
+ const n = xt(s ?? t.body);
162
162
  return new Request(t, {
163
163
  // @ts-expect-error - Types are outdated.
164
164
  duplex: "half",
165
- body: $e(t.body, n, e)
165
+ body: Ve(t.body, n, e)
166
166
  });
167
167
  }, P = (t) => t !== null && typeof t == "object", F = (...t) => {
168
168
  for (const e of t)
169
169
  if ((!P(e) || Array.isArray(e)) && e !== void 0)
170
170
  throw new TypeError("The `options` argument must be an object");
171
- return ae({}, ...t);
172
- }, ze = (t = {}, e = {}) => {
173
- const s = new globalThis.Headers(t), n = e instanceof globalThis.Headers, r = new globalThis.Headers(e);
174
- for (const [i, o] of r.entries())
175
- n && o === "undefined" || o === void 0 ? s.delete(i) : s.set(i, o);
171
+ return de({}, ...t);
172
+ }, Ye = (t = {}, e = {}) => {
173
+ const s = new globalThis.Headers(t), n = e instanceof globalThis.Headers, o = new globalThis.Headers(e);
174
+ for (const [i, r] of o.entries())
175
+ n && r === "undefined" || r === void 0 ? s.delete(i) : s.set(i, r);
176
176
  return s;
177
177
  };
178
- function _(t, e, s) {
179
- return Object.hasOwn(e, s) && e[s] === void 0 ? [] : ae(t[s] ?? [], e[s] ?? []);
180
- }
181
- const je = (t = {}, e = {}) => ({
182
- beforeRequest: _(t, e, "beforeRequest"),
183
- beforeRetry: _(t, e, "beforeRetry"),
184
- afterResponse: _(t, e, "afterResponse"),
185
- beforeError: _(t, e, "beforeError")
186
- }), vt = (t, e) => {
178
+ function H(t, e, s) {
179
+ return Object.hasOwn(e, s) && e[s] === void 0 ? [] : de(t[s] ?? [], e[s] ?? []);
180
+ }
181
+ const Ge = (t = {}, e = {}) => ({
182
+ beforeRequest: H(t, e, "beforeRequest"),
183
+ beforeRetry: H(t, e, "beforeRetry"),
184
+ afterResponse: H(t, e, "afterResponse"),
185
+ beforeError: H(t, e, "beforeError")
186
+ }), Bt = (t, e) => {
187
187
  const s = new URLSearchParams();
188
188
  for (const n of [t, e])
189
189
  if (n !== void 0)
190
190
  if (n instanceof URLSearchParams)
191
- for (const [r, i] of n.entries())
192
- s.append(r, i);
191
+ for (const [o, i] of n.entries())
192
+ s.append(o, i);
193
193
  else if (Array.isArray(n))
194
- for (const r of n) {
195
- if (!Array.isArray(r) || r.length !== 2)
194
+ for (const o of n) {
195
+ if (!Array.isArray(o) || o.length !== 2)
196
196
  throw new TypeError("Array search parameters must be provided in [[key, value], ...] format");
197
- s.append(String(r[0]), String(r[1]));
197
+ s.append(String(o[0]), String(o[1]));
198
198
  }
199
199
  else if (P(n))
200
- for (const [r, i] of Object.entries(n))
201
- i !== void 0 && s.append(r, String(i));
200
+ for (const [o, i] of Object.entries(n))
201
+ i !== void 0 && s.append(o, String(i));
202
202
  else {
203
- const r = new URLSearchParams(n);
204
- for (const [i, o] of r.entries())
205
- s.append(i, o);
203
+ const o = new URLSearchParams(n);
204
+ for (const [i, r] of o.entries())
205
+ s.append(i, r);
206
206
  }
207
207
  return s;
208
- }, ae = (...t) => {
209
- let e = {}, s = {}, n = {}, r;
208
+ }, de = (...t) => {
209
+ let e = {}, s = {}, n = {}, o;
210
210
  const i = [];
211
- for (const o of t)
212
- if (Array.isArray(o))
213
- Array.isArray(e) || (e = []), e = [...e, ...o];
214
- else if (P(o)) {
215
- for (let [a, u] of Object.entries(o)) {
211
+ for (const r of t)
212
+ if (Array.isArray(r))
213
+ Array.isArray(e) || (e = []), e = [...e, ...r];
214
+ else if (P(r)) {
215
+ for (let [a, u] of Object.entries(r)) {
216
216
  if (a === "signal" && u instanceof globalThis.AbortSignal) {
217
217
  i.push(u);
218
218
  continue;
@@ -227,28 +227,28 @@ const je = (t = {}, e = {}) => ({
227
227
  continue;
228
228
  }
229
229
  if (a === "searchParams") {
230
- u == null ? r = void 0 : r = r === void 0 ? u : vt(r, u);
230
+ u == null ? o = void 0 : o = o === void 0 ? u : Bt(o, u);
231
231
  continue;
232
232
  }
233
- P(u) && a in e && (u = ae(e[a], u)), e = { ...e, [a]: u };
233
+ P(u) && a in e && (u = de(e[a], u)), e = { ...e, [a]: u };
234
234
  }
235
- P(o.hooks) && (n = je(n, o.hooks), e.hooks = n), P(o.headers) && (s = ze(s, o.headers), e.headers = s);
235
+ P(r.hooks) && (n = Ge(n, r.hooks), e.hooks = n), P(r.headers) && (s = Ye(s, r.headers), e.headers = s);
236
236
  }
237
- return r !== void 0 && (e.searchParams = r), i.length > 0 && (i.length === 1 ? e.signal = i[0] : Le ? e.signal = AbortSignal.any(i) : e.signal = i.at(-1)), e.context === void 0 && (e.context = {}), e;
238
- }, kt = (t) => Fe.includes(t) ? t.toUpperCase() : t, xt = ["get", "put", "head", "delete", "options", "trace"], Nt = [408, 413, 429, 500, 502, 503, 504], Ot = [413, 429, 503], we = {
237
+ return o !== void 0 && (e.searchParams = o), i.length > 0 && (i.length === 1 ? e.signal = i[0] : ze ? e.signal = AbortSignal.any(i) : e.signal = i.at(-1)), e.context === void 0 && (e.context = {}), e;
238
+ }, Mt = (t) => qe.includes(t) ? t.toUpperCase() : t, Lt = ["get", "put", "head", "delete", "options", "trace"], _t = [408, 413, 429, 500, 502, 503, 504], Ft = [413, 429, 503], Ue = {
239
239
  limit: 2,
240
- methods: xt,
241
- statusCodes: Nt,
242
- afterStatusCodes: Ot,
240
+ methods: Lt,
241
+ statusCodes: _t,
242
+ afterStatusCodes: Ft,
243
243
  maxRetryAfter: Number.POSITIVE_INFINITY,
244
244
  backoffLimit: Number.POSITIVE_INFINITY,
245
245
  delay: (t) => 0.3 * 2 ** (t - 1) * 1e3,
246
246
  jitter: void 0,
247
247
  retryOnTimeout: !1
248
- }, Bt = (t = {}) => {
248
+ }, Ht = (t = {}) => {
249
249
  if (typeof t == "number")
250
250
  return {
251
- ...we,
251
+ ...Ue,
252
252
  limit: t
253
253
  };
254
254
  if (t.methods && !Array.isArray(t.methods))
@@ -256,66 +256,66 @@ const je = (t = {}, e = {}) => ({
256
256
  if (t.statusCodes && !Array.isArray(t.statusCodes))
257
257
  throw new Error("retry.statusCodes must be an array");
258
258
  return {
259
- ...we,
259
+ ...Ue,
260
260
  ...t
261
261
  };
262
262
  };
263
- class te extends Error {
263
+ class re extends Error {
264
264
  request;
265
265
  constructor(e) {
266
266
  super(`Request timed out: ${e.method} ${e.url}`), this.name = "TimeoutError", this.request = e;
267
267
  }
268
268
  }
269
- async function Mt(t, e, s, n) {
270
- return new Promise((r, i) => {
271
- const o = setTimeout(() => {
272
- s && s.abort(), i(new te(t));
269
+ async function $t(t, e, s, n) {
270
+ return new Promise((o, i) => {
271
+ const r = setTimeout(() => {
272
+ s && s.abort(), i(new re(t));
273
273
  }, n.timeout);
274
- n.fetch(t, e).then(r).catch(i).then(() => {
275
- clearTimeout(o);
274
+ n.fetch(t, e).then(o).catch(i).then(() => {
275
+ clearTimeout(r);
276
276
  });
277
277
  });
278
278
  }
279
- async function Lt(t, { signal: e }) {
279
+ async function jt(t, { signal: e }) {
280
280
  return new Promise((s, n) => {
281
- e && (e.throwIfAborted(), e.addEventListener("abort", r, { once: !0 }));
282
- function r() {
281
+ e && (e.throwIfAborted(), e.addEventListener("abort", o, { once: !0 }));
282
+ function o() {
283
283
  clearTimeout(i), n(e.reason);
284
284
  }
285
285
  const i = setTimeout(() => {
286
- e?.removeEventListener("abort", r), s();
286
+ e?.removeEventListener("abort", o), s();
287
287
  }, t);
288
288
  });
289
289
  }
290
- const Ft = (t, e) => {
290
+ const zt = (t, e) => {
291
291
  const s = {};
292
292
  for (const n in e)
293
- Object.hasOwn(e, n) && !(n in Dt) && !(n in Ct) && (!(n in t) || n in At) && (s[n] = e[n]);
293
+ Object.hasOwn(e, n) && !(n in Pt) && !(n in kt) && (!(n in t) || n in It) && (s[n] = e[n]);
294
294
  return s;
295
- }, _t = (t) => t === void 0 ? !1 : Array.isArray(t) ? t.length > 0 : t instanceof URLSearchParams ? t.size > 0 : typeof t == "object" ? Object.keys(t).length > 0 : typeof t == "string" ? t.trim().length > 0 : !!t;
296
- function Ht(t) {
297
- return t instanceof ee || t?.name === ee.name;
295
+ }, qt = (t) => t === void 0 ? !1 : Array.isArray(t) ? t.length > 0 : t instanceof URLSearchParams ? t.size > 0 : typeof t == "object" ? Object.keys(t).length > 0 : typeof t == "string" ? t.trim().length > 0 : !!t;
296
+ function Kt(t) {
297
+ return t instanceof oe || t?.name === oe.name;
298
298
  }
299
- function $t(t) {
300
- return t instanceof te || t?.name === te.name;
299
+ function Wt(t) {
300
+ return t instanceof re || t?.name === re.name;
301
301
  }
302
- class M {
302
+ class L {
303
303
  static create(e, s) {
304
- const n = new M(e, s), r = async () => {
305
- if (typeof n.#e.timeout == "number" && n.#e.timeout > Y)
306
- throw new RangeError(`The \`timeout\` option cannot be greater than ${Y}`);
304
+ const n = new L(e, s), o = async () => {
305
+ if (typeof n.#e.timeout == "number" && n.#e.timeout > Z)
306
+ throw new RangeError(`The \`timeout\` option cannot be greater than ${Z}`);
307
307
  await Promise.resolve();
308
- let o = await n.#m();
308
+ let r = await n.#g();
309
309
  for (const a of n.#e.hooks.afterResponse) {
310
- const u = n.#l(o.clone()), l = await a(n.request, n.#a(), u, { retryCount: n.#s });
311
- if (l instanceof globalThis.Response && (o = l), l instanceof He)
310
+ const u = n.#l(r.clone()), l = await a(n.request, n.#a(), u, { retryCount: n.#s });
311
+ if (l instanceof globalThis.Response && (r = l), l instanceof We)
312
312
  throw await Promise.all([
313
313
  u.body?.cancel(),
314
- o.body?.cancel()
315
- ]), new V(l.options);
314
+ r.body?.cancel()
315
+ ]), new J(l.options);
316
316
  }
317
- if (n.#l(o), !o.ok && (typeof n.#e.throwHttpErrors == "function" ? n.#e.throwHttpErrors(o.status) : n.#e.throwHttpErrors)) {
318
- let a = new ee(o, n.request, n.#a());
317
+ if (n.#l(r), !r.ok && (typeof n.#e.throwHttpErrors == "function" ? n.#e.throwHttpErrors(r.status) : n.#e.throwHttpErrors)) {
318
+ let a = new oe(r, n.request, n.#a());
319
319
  for (const u of n.#e.hooks.beforeError)
320
320
  a = await u(a, { retryCount: n.#s });
321
321
  throw a;
@@ -323,26 +323,26 @@ class M {
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 (!Et)
326
+ if (!Ct)
327
327
  throw new Error("Streams are not supported in your environment. `ReadableStream` is missing.");
328
- return It(o.clone(), n.#e.onDownloadProgress);
328
+ return Nt(r.clone(), n.#e.onDownloadProgress);
329
329
  }
330
- return o;
331
- }, i = n.#d(r).finally(async () => {
332
- const o = n.#o, a = [];
333
- o && !o.bodyUsed && a.push(o.body?.cancel()), n.request.bodyUsed || a.push(n.request.body?.cancel()), await Promise.all(a);
330
+ return r;
331
+ }, i = n.#d(o).finally(async () => {
332
+ const r = n.#r, a = [];
333
+ r && !r.bodyUsed && a.push(r.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(St))
336
- o === "bytes" && typeof globalThis.Response?.prototype?.bytes != "function" || (i[o] = async () => {
335
+ for (const [r, a] of Object.entries(Dt))
336
+ r === "bytes" && typeof globalThis.Response?.prototype?.bytes != "function" || (i[r] = async () => {
337
337
  n.request.headers.set("accept", n.request.headers.get("accept") || a);
338
338
  const u = await i;
339
- if (o === "json") {
339
+ if (r === "json") {
340
340
  if (u.status === 204)
341
341
  return "";
342
342
  const l = await u.text();
343
343
  return l === "" ? "" : s.parseJson ? s.parseJson(l) : JSON.parse(l);
344
344
  }
345
- return u[o]();
345
+ return u[r]();
346
346
  });
347
347
  return i;
348
348
  }
@@ -356,24 +356,24 @@ class M {
356
356
  // eslint-disable-next-line @typescript-eslint/prefer-readonly -- False positive: #input is reassigned on line 202
357
357
  #t;
358
358
  #e;
359
- #o;
360
359
  #r;
360
+ #o;
361
361
  #i;
362
362
  // eslint-disable-next-line complexity
363
363
  constructor(e, s = {}) {
364
364
  if (this.#t = e, this.#e = {
365
365
  ...s,
366
- headers: ze(this.#t.headers, s.headers),
367
- hooks: je({
366
+ headers: Ye(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: kt(s.method ?? this.#t.method ?? "GET"),
373
+ method: Mt(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: Bt(s.retry),
376
+ retry: Ht(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 M {
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
- bt && Le && (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), Se && (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
+ Rt && ze && (this.#o = this.#e.signal ?? this.#t.signal, this.#n = new globalThis.AbortController(), this.#e.signal = this.#o ? AbortSignal.any([this.#o, this.#n.signal]) : this.#n.signal), De && (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 && (Tt && 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), _t(this.#e.searchParams)) {
391
- const i = "?" + (typeof this.#e.searchParams == "string" ? this.#e.searchParams.replace(/^\?/, "") : new URLSearchParams(M.#h(this.#e.searchParams)).toString()), o = this.request.url.replace(/(?:\?.*?)?(?=#|$)/, i);
392
- this.request = new globalThis.Request(o, this.#e);
390
+ if (this.#t instanceof globalThis.Request && (At && 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), qt(this.#e.searchParams)) {
391
+ const i = "?" + (typeof this.#e.searchParams == "string" ? this.#e.searchParams.replace(/^\?/, "") : new URLSearchParams(L.#h(this.#e.searchParams)).toString()), r = this.request.url.replace(/(?:\?.*?)?(?=#|$)/, i);
392
+ this.request = new globalThis.Request(r, 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 (!Se)
397
+ if (!De)
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.#f(this.request, this.#e.body ?? void 0);
400
400
  }
@@ -404,11 +404,11 @@ class M {
404
404
  let s = e;
405
405
  return this.#e.retry.jitter === !0 ? s = Math.random() * e : typeof this.#e.retry.jitter == "function" && (s = this.#e.retry.jitter(e), (!Number.isFinite(s) || s < 0) && (s = e)), Math.min(this.#e.retry.backoffLimit, s);
406
406
  }
407
- async #g(e) {
407
+ async #m(e) {
408
408
  if (this.#s++, this.#s > this.#e.retry.limit)
409
409
  throw e;
410
- const s = e instanceof Error ? e : new Me(e);
411
- if (s instanceof V)
410
+ const s = e instanceof Error ? e : new je(e);
411
+ if (s instanceof J)
412
412
  return s.customDelay ?? this.#c();
413
413
  if (!this.#e.retry.methods.includes(this.request.method.toLowerCase()))
414
414
  throw e;
@@ -419,17 +419,17 @@ class M {
419
419
  if (n === !0)
420
420
  return this.#c();
421
421
  }
422
- if ($t(e) && !this.#e.retry.retryOnTimeout)
422
+ if (Wt(e) && !this.#e.retry.retryOnTimeout)
423
423
  throw e;
424
- if (Ht(e)) {
424
+ if (Kt(e)) {
425
425
  if (!this.#e.retry.statusCodes.includes(e.response.status))
426
426
  throw e;
427
427
  const n = e.response.headers.get("Retry-After") ?? e.response.headers.get("RateLimit-Reset") ?? e.response.headers.get("X-RateLimit-Retry-After") ?? e.response.headers.get("X-RateLimit-Reset") ?? e.response.headers.get("X-Rate-Limit-Reset");
428
428
  if (n && this.#e.retry.afterStatusCodes.includes(e.response.status)) {
429
- let r = Number(n) * 1e3;
430
- Number.isNaN(r) ? r = Date.parse(n) - Date.now() : r >= Date.parse("2024-01-01") && (r -= Date.now());
431
- const i = this.#e.retry.maxRetryAfter ?? r;
432
- return r < i ? r : i;
429
+ let o = Number(n) * 1e3;
430
+ Number.isNaN(o) ? o = Date.parse(n) - Date.now() : o >= Date.parse("2024-01-01") && (o -= Date.now());
431
+ const i = this.#e.retry.maxRetryAfter ?? o;
432
+ return o < i ? o : i;
433
433
  }
434
434
  if (e.response.status === 413)
435
435
  throw e;
@@ -443,15 +443,15 @@ class M {
443
443
  try {
444
444
  return await e();
445
445
  } catch (s) {
446
- const n = Math.min(await this.#g(s), Y);
446
+ const n = Math.min(await this.#m(s), Z);
447
447
  if (this.#s < 1)
448
448
  throw s;
449
- if (await Lt(n, this.#r ? { signal: this.#r } : {}), s instanceof V && s.customRequest) {
450
- const r = this.#e.signal ? new globalThis.Request(s.customRequest, { signal: this.#e.signal }) : new globalThis.Request(s.customRequest);
451
- this.#u(r);
449
+ if (await jt(n, this.#o ? { signal: this.#o } : {}), s instanceof J && s.customRequest) {
450
+ const o = this.#e.signal ? new globalThis.Request(s.customRequest, { signal: this.#e.signal }) : new globalThis.Request(s.customRequest);
451
+ this.#u(o);
452
452
  }
453
- for (const r of this.#e.hooks.beforeRetry) {
454
- const i = await r({
453
+ for (const o of this.#e.hooks.beforeRetry) {
454
+ const i = await o({
455
455
  request: this.request,
456
456
  options: this.#a(),
457
457
  error: s,
@@ -463,14 +463,14 @@ class M {
463
463
  }
464
464
  if (i instanceof globalThis.Response)
465
465
  return i;
466
- if (i === _e)
466
+ if (i === Ke)
467
467
  return;
468
468
  }
469
469
  return this.#d(e);
470
470
  }
471
471
  }
472
- async #m() {
473
- this.#n?.signal.aborted && (this.#n = new globalThis.AbortController(), this.#e.signal = this.#r ? AbortSignal.any([this.#r, this.#n.signal]) : this.#n.signal, this.request = new globalThis.Request(this.request, { signal: this.#e.signal }));
472
+ async #g() {
473
+ this.#n?.signal.aborted && (this.#n = new globalThis.AbortController(), this.#e.signal = this.#o ? AbortSignal.any([this.#o, this.#n.signal]) : this.#n.signal, this.request = new globalThis.Request(this.request, { signal: this.#e.signal }));
474
474
  for (const s of this.#e.hooks.beforeRequest) {
475
475
  const n = await s(this.request, this.#a(), { retryCount: this.#s });
476
476
  if (n instanceof Response)
@@ -480,8 +480,8 @@ class M {
480
480
  break;
481
481
  }
482
482
  }
483
- const e = Ft(this.request, this.#e);
484
- return this.#o = this.request, this.request = this.#o.clone(), this.#e.timeout === !1 ? this.#e.fetch(this.#o, e) : Mt(this.#o, e, this.#n, this.#e);
483
+ const e = zt(this.request, this.#e);
484
+ return this.#r = this.request, this.request = this.#r.clone(), this.#e.timeout === !1 ? this.#e.fetch(this.#r, e) : $t(this.#r, e, this.#n, this.#e);
485
485
  }
486
486
  #a() {
487
487
  if (!this.#i) {
@@ -494,16 +494,16 @@ class M {
494
494
  this.#i = void 0, this.request = this.#f(e);
495
495
  }
496
496
  #f(e, s) {
497
- return !this.#e.onUploadProgress || !e.body ? e : Pt(e, this.#e.onUploadProgress, s ?? this.#e.body ?? void 0);
497
+ return !this.#e.onUploadProgress || !e.body ? e : Ot(e, this.#e.onUploadProgress, s ?? this.#e.body ?? void 0);
498
498
  }
499
499
  }
500
500
  /*! MIT License © Sindre Sorhus */
501
- const se = (t) => {
502
- const e = (s, n) => M.create(s, F(t, n));
503
- for (const s of Fe)
504
- e[s] = (n, r) => M.create(n, F(t, r, { method: s }));
505
- return e.create = (s) => se(F(s)), e.extend = (s) => (typeof s == "function" && (s = s(t ?? {})), se(F(t, s))), e.stop = _e, e.retry = Rt, e;
506
- }, zt = se(), b = {
501
+ const ie = (t) => {
502
+ const e = (s, n) => L.create(s, F(t, n));
503
+ for (const s of qe)
504
+ e[s] = (n, o) => L.create(n, F(t, o, { method: s }));
505
+ return e.create = (s) => ie(F(s)), e.extend = (s) => (typeof s == "function" && (s = s(t ?? {})), ie(F(t, s))), e.stop = Ke, e.retry = vt, e;
506
+ }, Vt = ie(), b = {
507
507
  ARBITRUM: "ARBITRUM_MAINNET",
508
508
  ARBITRUM_TESTNET: "ARBITRUM_TESTNET",
509
509
  AVALANCHE: "AVALANCHE_MAINNET",
@@ -522,7 +522,7 @@ const se = (t) => {
522
522
  POLYGON: "POLYGON_MAINNET",
523
523
  STARKNET: "STARKNET_MAINNET",
524
524
  STARKNET_TESTNET: "STARKNET_TESTNET"
525
- }, un = {
525
+ }, mn = {
526
526
  ARBITRUM: "ARBITRUM",
527
527
  ARBITRUM_TESTNET: "ARBITRUM_TESTNET",
528
528
  AVALANCHE: "AVALANCHE",
@@ -542,29 +542,29 @@ const se = (t) => {
542
542
  STARKNET: "STARKNET",
543
543
  STARKNET_TESTNET: "STARKNET_TESTNET"
544
544
  };
545
- function ce(t, { strict: e = !0 } = {}) {
545
+ function fe(t, { strict: e = !0 } = {}) {
546
546
  return !t || typeof t != "string" ? !1 : e ? /^0x[0-9a-fA-F]*$/.test(t) : t.startsWith("0x");
547
547
  }
548
- function Re(t) {
549
- return ce(t, { strict: !1 }) ? Math.ceil((t.length - 2) / 2) : t.length;
548
+ function ve(t) {
549
+ return fe(t, { strict: !1 }) ? Math.ceil((t.length - 2) / 2) : t.length;
550
550
  }
551
- const qe = "2.43.4";
552
- let G = {
551
+ const Xe = "2.43.4";
552
+ let Q = {
553
553
  getDocsUrl: ({ docsBaseUrl: t, docsPath: e = "", docsSlug: s }) => e ? `${t ?? "https://viem.sh"}${e}${s ? `#${s}` : ""}` : void 0,
554
- version: `viem@${qe}`
554
+ version: `viem@${Xe}`
555
555
  };
556
- class U extends Error {
556
+ class I extends Error {
557
557
  constructor(e, s = {}) {
558
- const n = s.cause instanceof U ? s.cause.details : s.cause?.message ? s.cause.message : s.details, r = s.cause instanceof U && s.cause.docsPath || s.docsPath, i = G.getDocsUrl?.({ ...s, docsPath: r }), o = [
558
+ const n = s.cause instanceof I ? s.cause.details : s.cause?.message ? s.cause.message : s.details, o = s.cause instanceof I && s.cause.docsPath || s.docsPath, i = Q.getDocsUrl?.({ ...s, docsPath: o }), r = [
559
559
  e || "An error occurred.",
560
560
  "",
561
561
  ...s.metaMessages ? [...s.metaMessages, ""] : [],
562
562
  ...i ? [`Docs: ${i}`] : [],
563
563
  ...n ? [`Details: ${n}`] : [],
564
- ...G.version ? [`Version: ${G.version}`] : []
564
+ ...Q.version ? [`Version: ${Q.version}`] : []
565
565
  ].join(`
566
566
  `);
567
- super(o, s.cause ? { cause: s.cause } : void 0), Object.defineProperty(this, "details", {
567
+ super(r, s.cause ? { cause: s.cause } : void 0), Object.defineProperty(this, "details", {
568
568
  enumerable: !0,
569
569
  configurable: !0,
570
570
  writable: !0,
@@ -594,95 +594,95 @@ class U extends Error {
594
594
  configurable: !0,
595
595
  writable: !0,
596
596
  value: "BaseError"
597
- }), this.details = n, this.docsPath = r, this.metaMessages = s.metaMessages, this.name = s.name ?? this.name, this.shortMessage = e, this.version = qe;
597
+ }), this.details = n, this.docsPath = o, this.metaMessages = s.metaMessages, this.name = s.name ?? this.name, this.shortMessage = e, this.version = Xe;
598
598
  }
599
599
  walk(e) {
600
- return Ke(this, e);
600
+ return Je(this, e);
601
601
  }
602
602
  }
603
- function Ke(t, e) {
604
- return e?.(t) ? t : t && typeof t == "object" && "cause" in t && t.cause !== void 0 ? Ke(t.cause, e) : e ? null : t;
603
+ function Je(t, e) {
604
+ return e?.(t) ? t : t && typeof t == "object" && "cause" in t && t.cause !== void 0 ? Je(t.cause, e) : e ? null : t;
605
605
  }
606
- class We extends U {
606
+ class Ze extends I {
607
607
  constructor({ size: e, targetSize: s, type: n }) {
608
608
  super(`${n.charAt(0).toUpperCase()}${n.slice(1).toLowerCase()} size (${e}) exceeds padding size (${s}).`, { name: "SizeExceedsPaddingSizeError" });
609
609
  }
610
610
  }
611
- function K(t, { dir: e, size: s = 32 } = {}) {
612
- return typeof t == "string" ? jt(t, { dir: e, size: s }) : qt(t, { dir: e, size: s });
611
+ function W(t, { dir: e, size: s = 32 } = {}) {
612
+ return typeof t == "string" ? Yt(t, { dir: e, size: s }) : Gt(t, { dir: e, size: s });
613
613
  }
614
- function jt(t, { dir: e, size: s = 32 } = {}) {
614
+ function Yt(t, { dir: e, size: s = 32 } = {}) {
615
615
  if (s === null)
616
616
  return t;
617
617
  const n = t.replace("0x", "");
618
618
  if (n.length > s * 2)
619
- throw new We({
619
+ throw new Ze({
620
620
  size: Math.ceil(n.length / 2),
621
621
  targetSize: s,
622
622
  type: "hex"
623
623
  });
624
624
  return `0x${n[e === "right" ? "padEnd" : "padStart"](s * 2, "0")}`;
625
625
  }
626
- function qt(t, { dir: e, size: s = 32 } = {}) {
626
+ function Gt(t, { dir: e, size: s = 32 } = {}) {
627
627
  if (s === null)
628
628
  return t;
629
629
  if (t.length > s)
630
- throw new We({
630
+ throw new Ze({
631
631
  size: t.length,
632
632
  targetSize: s,
633
633
  type: "bytes"
634
634
  });
635
635
  const n = new Uint8Array(s);
636
- for (let r = 0; r < s; r++) {
636
+ for (let o = 0; o < s; o++) {
637
637
  const i = e === "right";
638
- n[i ? r : s - r - 1] = t[i ? r : t.length - r - 1];
638
+ n[i ? o : s - o - 1] = t[i ? o : t.length - o - 1];
639
639
  }
640
640
  return n;
641
641
  }
642
- class Kt extends U {
643
- constructor({ max: e, min: s, signed: n, size: r, value: i }) {
644
- super(`Number "${i}" is not in safe ${r ? `${r * 8}-bit ${n ? "signed" : "unsigned"} ` : ""}integer range ${e ? `(${s} to ${e})` : `(above ${s})`}`, { name: "IntegerOutOfRangeError" });
642
+ class Xt extends I {
643
+ constructor({ max: e, min: s, signed: n, size: o, value: i }) {
644
+ super(`Number "${i}" is not in safe ${o ? `${o * 8}-bit ${n ? "signed" : "unsigned"} ` : ""}integer range ${e ? `(${s} to ${e})` : `(above ${s})`}`, { name: "IntegerOutOfRangeError" });
645
645
  }
646
646
  }
647
- class Wt extends U {
647
+ class Jt extends I {
648
648
  constructor({ givenSize: e, maxSize: s }) {
649
649
  super(`Size cannot exceed ${s} bytes. Given size: ${e} bytes.`, { name: "SizeOverflowError" });
650
650
  }
651
651
  }
652
- function ue(t, { size: e }) {
653
- if (Re(t) > e)
654
- throw new Wt({
655
- givenSize: Re(t),
652
+ function he(t, { size: e }) {
653
+ if (ve(t) > e)
654
+ throw new Jt({
655
+ givenSize: ve(t),
656
656
  maxSize: e
657
657
  });
658
658
  }
659
- function Vt(t, e = {}) {
660
- const { signed: s, size: n } = e, r = BigInt(t);
659
+ function Zt(t, e = {}) {
660
+ const { signed: s, size: n } = e, o = BigInt(t);
661
661
  let i;
662
662
  n ? s ? i = (1n << BigInt(n) * 8n - 1n) - 1n : i = 2n ** (BigInt(n) * 8n) - 1n : typeof t == "number" && (i = BigInt(Number.MAX_SAFE_INTEGER));
663
- const o = typeof i == "bigint" && s ? -i - 1n : 0;
664
- if (i && r > i || r < o) {
663
+ const r = typeof i == "bigint" && s ? -i - 1n : 0;
664
+ if (i && o > i || o < r) {
665
665
  const u = typeof t == "bigint" ? "n" : "";
666
- throw new Kt({
666
+ throw new Xt({
667
667
  max: i ? `${i}${u}` : void 0,
668
- min: `${o}${u}`,
668
+ min: `${r}${u}`,
669
669
  signed: s,
670
670
  size: n,
671
671
  value: `${t}${u}`
672
672
  });
673
673
  }
674
- const a = `0x${(s && r < 0 ? (1n << BigInt(n * 8)) + BigInt(r) : r).toString(16)}`;
675
- return n ? K(a, { size: n }) : a;
674
+ const a = `0x${(s && o < 0 ? (1n << BigInt(n * 8)) + BigInt(o) : o).toString(16)}`;
675
+ return n ? W(a, { size: n }) : a;
676
676
  }
677
- const Yt = /* @__PURE__ */ new TextEncoder();
678
- function Gt(t, e = {}) {
679
- return typeof t == "number" || typeof t == "bigint" ? Jt(t, e) : typeof t == "boolean" ? Xt(t, e) : ce(t) ? Ve(t, e) : Ye(t, e);
677
+ const Qt = /* @__PURE__ */ new TextEncoder();
678
+ function es(t, e = {}) {
679
+ return typeof t == "number" || typeof t == "bigint" ? ss(t, e) : typeof t == "boolean" ? ts(t, e) : fe(t) ? Qe(t, e) : et(t, e);
680
680
  }
681
- function Xt(t, e = {}) {
681
+ function ts(t, e = {}) {
682
682
  const s = new Uint8Array(1);
683
- return s[0] = Number(t), typeof e.size == "number" ? (ue(s, { size: e.size }), K(s, { size: e.size })) : s;
683
+ return s[0] = Number(t), typeof e.size == "number" ? (he(s, { size: e.size }), W(s, { size: e.size })) : s;
684
684
  }
685
- const A = {
685
+ const U = {
686
686
  zero: 48,
687
687
  nine: 57,
688
688
  A: 65,
@@ -690,160 +690,160 @@ const A = {
690
690
  a: 97,
691
691
  f: 102
692
692
  };
693
- function Ce(t) {
694
- if (t >= A.zero && t <= A.nine)
695
- return t - A.zero;
696
- if (t >= A.A && t <= A.F)
697
- return t - (A.A - 10);
698
- if (t >= A.a && t <= A.f)
699
- return t - (A.a - 10);
700
- }
701
- function Ve(t, e = {}) {
693
+ function ke(t) {
694
+ if (t >= U.zero && t <= U.nine)
695
+ return t - U.zero;
696
+ if (t >= U.A && t <= U.F)
697
+ return t - (U.A - 10);
698
+ if (t >= U.a && t <= U.f)
699
+ return t - (U.a - 10);
700
+ }
701
+ function Qe(t, e = {}) {
702
702
  let s = t;
703
- e.size && (ue(s, { size: e.size }), s = K(s, { dir: "right", size: e.size }));
703
+ e.size && (he(s, { size: e.size }), s = W(s, { dir: "right", size: e.size }));
704
704
  let n = s.slice(2);
705
705
  n.length % 2 && (n = `0${n}`);
706
- const r = n.length / 2, i = new Uint8Array(r);
707
- for (let o = 0, a = 0; o < r; o++) {
708
- const u = Ce(n.charCodeAt(a++)), l = Ce(n.charCodeAt(a++));
706
+ const o = n.length / 2, i = new Uint8Array(o);
707
+ for (let r = 0, a = 0; r < o; r++) {
708
+ const u = ke(n.charCodeAt(a++)), l = ke(n.charCodeAt(a++));
709
709
  if (u === void 0 || l === void 0)
710
- throw new U(`Invalid byte sequence ("${n[a - 2]}${n[a - 1]}" in "${n}").`);
711
- i[o] = u * 16 + l;
710
+ throw new I(`Invalid byte sequence ("${n[a - 2]}${n[a - 1]}" in "${n}").`);
711
+ i[r] = u * 16 + l;
712
712
  }
713
713
  return i;
714
714
  }
715
- function Jt(t, e) {
716
- const s = Vt(t, e);
717
- return Ve(s);
715
+ function ss(t, e) {
716
+ const s = Zt(t, e);
717
+ return Qe(s);
718
718
  }
719
- function Ye(t, e = {}) {
720
- const s = Yt.encode(t);
721
- return typeof e.size == "number" ? (ue(s, { size: e.size }), K(s, { dir: "right", size: e.size })) : s;
719
+ function et(t, e = {}) {
720
+ const s = Qt.encode(t);
721
+ return typeof e.size == "number" ? (he(s, { size: e.size }), W(s, { dir: "right", size: e.size })) : s;
722
722
  }
723
- const H = /* @__PURE__ */ BigInt(2 ** 32 - 1), Ae = /* @__PURE__ */ BigInt(32);
724
- function Zt(t, e = !1) {
725
- return e ? { h: Number(t & H), l: Number(t >> Ae & H) } : { h: Number(t >> Ae & H) | 0, l: Number(t & H) | 0 };
723
+ const $ = /* @__PURE__ */ BigInt(2 ** 32 - 1), Ie = /* @__PURE__ */ BigInt(32);
724
+ function ns(t, e = !1) {
725
+ return e ? { h: Number(t & $), l: Number(t >> Ie & $) } : { h: Number(t >> Ie & $) | 0, l: Number(t & $) | 0 };
726
726
  }
727
- function Qt(t, e = !1) {
727
+ function os(t, e = !1) {
728
728
  const s = t.length;
729
- let n = new Uint32Array(s), r = new Uint32Array(s);
729
+ let n = new Uint32Array(s), o = new Uint32Array(s);
730
730
  for (let i = 0; i < s; i++) {
731
- const { h: o, l: a } = Zt(t[i], e);
732
- [n[i], r[i]] = [o, a];
731
+ const { h: r, l: a } = ns(t[i], e);
732
+ [n[i], o[i]] = [r, a];
733
733
  }
734
- return [n, r];
734
+ return [n, o];
735
735
  }
736
- const es = (t, e, s) => t << s | e >>> 32 - s, ts = (t, e, s) => e << s | t >>> 32 - s, ss = (t, e, s) => e << s - 32 | t >>> 64 - s, ns = (t, e, s) => t << s - 32 | e >>> 64 - s;
736
+ const rs = (t, e, s) => t << s | e >>> 32 - s, is = (t, e, s) => e << s | t >>> 32 - s, as = (t, e, s) => e << s - 32 | t >>> 64 - s, cs = (t, e, s) => t << s - 32 | e >>> 64 - s;
737
737
  /*! noble-hashes - MIT License (c) 2022 Paul Miller (paulmillr.com) */
738
- function rs(t) {
738
+ function us(t) {
739
739
  return t instanceof Uint8Array || ArrayBuffer.isView(t) && t.constructor.name === "Uint8Array";
740
740
  }
741
- function De(t) {
741
+ function Pe(t) {
742
742
  if (!Number.isSafeInteger(t) || t < 0)
743
743
  throw new Error("positive integer expected, got " + t);
744
744
  }
745
- function $(t, ...e) {
746
- if (!rs(t))
745
+ function j(t, ...e) {
746
+ if (!us(t))
747
747
  throw new Error("Uint8Array expected");
748
748
  if (e.length > 0 && !e.includes(t.length))
749
749
  throw new Error("Uint8Array expected of length " + e + ", got length=" + t.length);
750
750
  }
751
- function Ue(t, e = !0) {
751
+ function xe(t, e = !0) {
752
752
  if (t.destroyed)
753
753
  throw new Error("Hash instance has been destroyed");
754
754
  if (e && t.finished)
755
755
  throw new Error("Hash#digest() has already been called");
756
756
  }
757
- function os(t, e) {
758
- $(t);
757
+ function ls(t, e) {
758
+ j(t);
759
759
  const s = e.outputLen;
760
760
  if (t.length < s)
761
761
  throw new Error("digestInto() expects output buffer of length at least " + s);
762
762
  }
763
- function is(t) {
763
+ function ds(t) {
764
764
  return new Uint32Array(t.buffer, t.byteOffset, Math.floor(t.byteLength / 4));
765
765
  }
766
- function Ge(...t) {
766
+ function tt(...t) {
767
767
  for (let e = 0; e < t.length; e++)
768
768
  t[e].fill(0);
769
769
  }
770
- const as = new Uint8Array(new Uint32Array([287454020]).buffer)[0] === 68;
771
- function cs(t) {
770
+ const fs = new Uint8Array(new Uint32Array([287454020]).buffer)[0] === 68;
771
+ function hs(t) {
772
772
  return t << 24 & 4278190080 | t << 8 & 16711680 | t >>> 8 & 65280 | t >>> 24 & 255;
773
773
  }
774
- function us(t) {
774
+ function ms(t) {
775
775
  for (let e = 0; e < t.length; e++)
776
- t[e] = cs(t[e]);
776
+ t[e] = hs(t[e]);
777
777
  return t;
778
778
  }
779
- const Ie = as ? (t) => t : us;
780
- function ls(t) {
779
+ const Ne = fs ? (t) => t : ms;
780
+ function gs(t) {
781
781
  if (typeof t != "string")
782
782
  throw new Error("string expected");
783
783
  return new Uint8Array(new TextEncoder().encode(t));
784
784
  }
785
- function Xe(t) {
786
- return typeof t == "string" && (t = ls(t)), $(t), t;
785
+ function st(t) {
786
+ return typeof t == "string" && (t = gs(t)), j(t), t;
787
787
  }
788
- class ds {
788
+ class ps {
789
789
  }
790
- function fs(t) {
791
- const e = (n) => t().update(Xe(n)).digest(), s = t();
790
+ function ys(t) {
791
+ const e = (n) => t().update(st(n)).digest(), s = t();
792
792
  return e.outputLen = s.outputLen, e.blockLen = s.blockLen, e.create = () => t(), e;
793
793
  }
794
- const hs = BigInt(0), N = BigInt(1), gs = BigInt(2), ms = BigInt(7), ps = BigInt(256), ys = BigInt(113), Je = [], Ze = [], Qe = [];
795
- for (let t = 0, e = N, s = 1, n = 0; t < 24; t++) {
796
- [s, n] = [n, (2 * s + 3 * n) % 5], Je.push(2 * (5 * n + s)), Ze.push((t + 1) * (t + 2) / 2 % 64);
797
- let r = hs;
794
+ const Ts = BigInt(0), O = BigInt(1), bs = BigInt(2), Es = BigInt(7), Ss = BigInt(256), ws = BigInt(113), nt = [], ot = [], rt = [];
795
+ for (let t = 0, e = O, s = 1, n = 0; t < 24; t++) {
796
+ [s, n] = [n, (2 * s + 3 * n) % 5], nt.push(2 * (5 * n + s)), ot.push((t + 1) * (t + 2) / 2 % 64);
797
+ let o = Ts;
798
798
  for (let i = 0; i < 7; i++)
799
- e = (e << N ^ (e >> ms) * ys) % ps, e & gs && (r ^= N << (N << /* @__PURE__ */ BigInt(i)) - N);
800
- Qe.push(r);
799
+ e = (e << O ^ (e >> Es) * ws) % Ss, e & bs && (o ^= O << (O << /* @__PURE__ */ BigInt(i)) - O);
800
+ rt.push(o);
801
801
  }
802
- const et = Qt(Qe, !0), bs = et[0], Es = et[1], Pe = (t, e, s) => s > 32 ? ss(t, e, s) : es(t, e, s), ve = (t, e, s) => s > 32 ? ns(t, e, s) : ts(t, e, s);
803
- function Ts(t, e = 24) {
802
+ const it = os(rt, !0), Rs = it[0], Cs = it[1], Oe = (t, e, s) => s > 32 ? as(t, e, s) : rs(t, e, s), Be = (t, e, s) => s > 32 ? cs(t, e, s) : is(t, e, s);
803
+ function As(t, e = 24) {
804
804
  const s = new Uint32Array(10);
805
805
  for (let n = 24 - e; n < 24; n++) {
806
- for (let o = 0; o < 10; o++)
807
- s[o] = t[o] ^ t[o + 10] ^ t[o + 20] ^ t[o + 30] ^ t[o + 40];
808
- for (let o = 0; o < 10; o += 2) {
809
- const a = (o + 8) % 10, u = (o + 2) % 10, l = s[u], d = s[u + 1], T = Pe(l, d, 1) ^ s[a], m = ve(l, d, 1) ^ s[a + 1];
806
+ for (let r = 0; r < 10; r++)
807
+ s[r] = t[r] ^ t[r + 10] ^ t[r + 20] ^ t[r + 30] ^ t[r + 40];
808
+ for (let r = 0; r < 10; r += 2) {
809
+ const a = (r + 8) % 10, u = (r + 2) % 10, l = s[u], f = s[u + 1], E = Oe(l, f, 1) ^ s[a], h = Be(l, f, 1) ^ s[a + 1];
810
810
  for (let y = 0; y < 50; y += 10)
811
- t[o + y] ^= T, t[o + y + 1] ^= m;
811
+ t[r + y] ^= E, t[r + y + 1] ^= h;
812
812
  }
813
- let r = t[2], i = t[3];
814
- for (let o = 0; o < 24; o++) {
815
- const a = Ze[o], u = Pe(r, i, a), l = ve(r, i, a), d = Je[o];
816
- r = t[d], i = t[d + 1], t[d] = u, t[d + 1] = l;
813
+ let o = t[2], i = t[3];
814
+ for (let r = 0; r < 24; r++) {
815
+ const a = ot[r], u = Oe(o, i, a), l = Be(o, i, a), f = nt[r];
816
+ o = t[f], i = t[f + 1], t[f] = u, t[f + 1] = l;
817
817
  }
818
- for (let o = 0; o < 50; o += 10) {
818
+ for (let r = 0; r < 50; r += 10) {
819
819
  for (let a = 0; a < 10; a++)
820
- s[a] = t[o + a];
820
+ s[a] = t[r + a];
821
821
  for (let a = 0; a < 10; a++)
822
- t[o + a] ^= ~s[(a + 2) % 10] & s[(a + 4) % 10];
822
+ t[r + a] ^= ~s[(a + 2) % 10] & s[(a + 4) % 10];
823
823
  }
824
- t[0] ^= bs[n], t[1] ^= Es[n];
824
+ t[0] ^= Rs[n], t[1] ^= Cs[n];
825
825
  }
826
- Ge(s);
826
+ tt(s);
827
827
  }
828
- class le extends ds {
828
+ class me extends ps {
829
829
  // NOTE: we accept arguments in bytes instead of bits here.
830
- constructor(e, s, n, r = !1, i = 24) {
831
- if (super(), this.pos = 0, this.posOut = 0, this.finished = !1, this.destroyed = !1, this.enableXOF = !1, this.blockLen = e, this.suffix = s, this.outputLen = n, this.enableXOF = r, this.rounds = i, De(n), !(0 < e && e < 200))
830
+ constructor(e, s, n, o = !1, i = 24) {
831
+ if (super(), this.pos = 0, this.posOut = 0, this.finished = !1, this.destroyed = !1, this.enableXOF = !1, this.blockLen = e, this.suffix = s, this.outputLen = n, this.enableXOF = o, this.rounds = i, Pe(n), !(0 < e && e < 200))
832
832
  throw new Error("only keccak-f1600 function is supported");
833
- this.state = new Uint8Array(200), this.state32 = is(this.state);
833
+ this.state = new Uint8Array(200), this.state32 = ds(this.state);
834
834
  }
835
835
  clone() {
836
836
  return this._cloneInto();
837
837
  }
838
838
  keccak() {
839
- Ie(this.state32), Ts(this.state32, this.rounds), Ie(this.state32), this.posOut = 0, this.pos = 0;
839
+ Ne(this.state32), As(this.state32, this.rounds), Ne(this.state32), this.posOut = 0, this.pos = 0;
840
840
  }
841
841
  update(e) {
842
- Ue(this), e = Xe(e), $(e);
843
- const { blockLen: s, state: n } = this, r = e.length;
844
- for (let i = 0; i < r; ) {
845
- const o = Math.min(s - this.pos, r - i);
846
- for (let a = 0; a < o; a++)
842
+ xe(this), e = st(e), j(e);
843
+ const { blockLen: s, state: n } = this, o = e.length;
844
+ for (let i = 0; i < o; ) {
845
+ const r = Math.min(s - this.pos, o - i);
846
+ for (let a = 0; a < r; a++)
847
847
  n[this.pos++] ^= e[i++];
848
848
  this.pos === s && this.keccak();
849
849
  }
@@ -853,16 +853,16 @@ class le extends ds {
853
853
  if (this.finished)
854
854
  return;
855
855
  this.finished = !0;
856
- const { state: e, suffix: s, pos: n, blockLen: r } = this;
857
- e[n] ^= s, (s & 128) !== 0 && n === r - 1 && this.keccak(), e[r - 1] ^= 128, this.keccak();
856
+ const { state: e, suffix: s, pos: n, blockLen: o } = this;
857
+ e[n] ^= s, (s & 128) !== 0 && n === o - 1 && this.keccak(), e[o - 1] ^= 128, this.keccak();
858
858
  }
859
859
  writeInto(e) {
860
- Ue(this, !1), $(e), this.finish();
860
+ xe(this, !1), j(e), this.finish();
861
861
  const s = this.state, { blockLen: n } = this;
862
- for (let r = 0, i = e.length; r < i; ) {
862
+ for (let o = 0, i = e.length; o < i; ) {
863
863
  this.posOut >= n && this.keccak();
864
- const o = Math.min(n - this.posOut, i - r);
865
- e.set(s.subarray(this.posOut, this.posOut + o), r), this.posOut += o, r += o;
864
+ const r = Math.min(n - this.posOut, i - o);
865
+ e.set(s.subarray(this.posOut, this.posOut + r), o), this.posOut += r, o += r;
866
866
  }
867
867
  return e;
868
868
  }
@@ -872,10 +872,10 @@ class le extends ds {
872
872
  return this.writeInto(e);
873
873
  }
874
874
  xof(e) {
875
- return De(e), this.xofInto(new Uint8Array(e));
875
+ return Pe(e), this.xofInto(new Uint8Array(e));
876
876
  }
877
877
  digestInto(e) {
878
- if (os(e, this), this.finished)
878
+ if (ls(e, this), this.finished)
879
879
  throw new Error("digest() was already called");
880
880
  return this.writeInto(e), this.destroy(), e;
881
881
  }
@@ -883,18 +883,18 @@ class le extends ds {
883
883
  return this.digestInto(new Uint8Array(this.outputLen));
884
884
  }
885
885
  destroy() {
886
- this.destroyed = !0, Ge(this.state);
886
+ this.destroyed = !0, tt(this.state);
887
887
  }
888
888
  _cloneInto(e) {
889
- const { blockLen: s, suffix: n, outputLen: r, rounds: i, enableXOF: o } = this;
890
- return e || (e = new le(s, n, r, o, i)), e.state32.set(this.state32), e.pos = this.pos, e.posOut = this.posOut, e.finished = this.finished, e.rounds = i, e.suffix = n, e.outputLen = r, e.enableXOF = o, e.destroyed = this.destroyed, e;
889
+ const { blockLen: s, suffix: n, outputLen: o, rounds: i, enableXOF: r } = this;
890
+ return e || (e = new me(s, n, o, r, i)), e.state32.set(this.state32), e.pos = this.pos, e.posOut = this.posOut, e.finished = this.finished, e.rounds = i, e.suffix = n, e.outputLen = o, e.enableXOF = r, e.destroyed = this.destroyed, e;
891
891
  }
892
892
  }
893
- const Ss = (t, e, s) => fs(() => new le(e, t, s)), ws = Ss(1, 136, 256 / 8);
894
- function Rs(t, e) {
895
- return ws(ce(t, { strict: !1 }) ? Gt(t) : t);
893
+ const Ds = (t, e, s) => ys(() => new me(e, t, s)), Us = Ds(1, 136, 256 / 8);
894
+ function vs(t, e) {
895
+ return Us(fe(t, { strict: !1 }) ? es(t) : t);
896
896
  }
897
- class Cs extends U {
897
+ class ks extends I {
898
898
  constructor({ address: e }) {
899
899
  super(`Address "${e}" is invalid.`, {
900
900
  metaMessages: [
@@ -905,7 +905,7 @@ class Cs extends U {
905
905
  });
906
906
  }
907
907
  }
908
- class tt extends Map {
908
+ class at extends Map {
909
909
  constructor(e) {
910
910
  super(), Object.defineProperty(this, "maxSize", {
911
911
  enumerable: !0,
@@ -926,28 +926,28 @@ class tt extends Map {
926
926
  return this;
927
927
  }
928
928
  }
929
- const X = /* @__PURE__ */ new tt(8192);
930
- function st(t, e) {
931
- if (X.has(`${t}.${e}`))
932
- return X.get(`${t}.${e}`);
933
- const s = t.substring(2).toLowerCase(), n = Rs(Ye(s)), r = s.split("");
934
- for (let o = 0; o < 40; o += 2)
935
- 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());
936
- const i = `0x${r.join("")}`;
937
- return X.set(`${t}.${e}`, i), i;
929
+ const ee = /* @__PURE__ */ new at(8192);
930
+ function ct(t, e) {
931
+ if (ee.has(`${t}.${e}`))
932
+ return ee.get(`${t}.${e}`);
933
+ const s = t.substring(2).toLowerCase(), n = vs(et(s)), o = s.split("");
934
+ for (let r = 0; r < 40; r += 2)
935
+ n[r >> 1] >> 4 >= 8 && o[r] && (o[r] = o[r].toUpperCase()), (n[r >> 1] & 15) >= 8 && o[r + 1] && (o[r + 1] = o[r + 1].toUpperCase());
936
+ const i = `0x${o.join("")}`;
937
+ return ee.set(`${t}.${e}`, i), i;
938
938
  }
939
- function w(t, e) {
940
- if (!Ds(t, { strict: !1 }))
941
- throw new Cs({ address: t });
942
- return st(t, e);
939
+ function S(t, e) {
940
+ if (!Ps(t, { strict: !1 }))
941
+ throw new ks({ address: t });
942
+ return ct(t, e);
943
943
  }
944
- const As = /^0x[a-fA-F0-9]{40}$/, J = /* @__PURE__ */ new tt(8192);
945
- function Ds(t, e) {
944
+ const Is = /^0x[a-fA-F0-9]{40}$/, te = /* @__PURE__ */ new at(8192);
945
+ function Ps(t, e) {
946
946
  const { strict: s = !0 } = e ?? {}, n = `${t}.${s}`;
947
- if (J.has(n))
948
- return J.get(n);
949
- const r = As.test(t) ? t.toLowerCase() === t ? !0 : s ? st(t) === t : !0 : !1;
950
- return J.set(n, r), r;
947
+ if (te.has(n))
948
+ return te.get(n);
949
+ const o = Is.test(t) ? t.toLowerCase() === t ? !0 : s ? ct(t) === t : !0 : !1;
950
+ return te.set(n, o), o;
951
951
  }
952
952
  const c = {
953
953
  USDC: "USDC",
@@ -962,58 +962,59 @@ const c = {
962
962
  LORDS: "LORDS"
963
963
  };
964
964
  c.USDC;
965
- const nt = {
965
+ const ut = {
966
966
  [b.ARBITRUM]: {
967
967
  [c.DAI]: {
968
- address: w("0xDA10009cBd5D07dd0CeCc66161FC93D7c9000da1"),
968
+ address: S("0xDA10009cBd5D07dd0CeCc66161FC93D7c9000da1"),
969
969
  symbol: c.DAI,
970
970
  name: "Dai Stablecoin",
971
971
  decimals: 18,
972
- logoURI: "/images/tokens/dai.png"
973
- /* DAI */
972
+ logoURI: "/images/tokens/dai.png",
973
+ nativeToken: !1
974
974
  },
975
975
  [c.ETH]: {
976
976
  address: "0x0000000000000000000000000000000000000000",
977
977
  symbol: c.ETH,
978
978
  name: "Ethereum",
979
979
  decimals: 18,
980
- logoURI: "/images/chains/ethereum.svg"
981
- /* ETH */
980
+ logoURI: "/images/chains/ethereum.svg",
981
+ nativeToken: !0
982
982
  },
983
983
  [c.USDC]: {
984
- address: w("0xaf88d065e77c8cC2239327C5EDb3A432268e5831"),
984
+ address: S("0xaf88d065e77c8cC2239327C5EDb3A432268e5831"),
985
985
  symbol: c.USDC,
986
986
  name: "USD Coin",
987
987
  decimals: 6,
988
- logoURI: "/images/tokens/usdc.svg"
989
- /* USDC */
988
+ logoURI: "/images/tokens/usdc.svg",
989
+ nativeToken: !1
990
990
  },
991
991
  [c.USDT]: {
992
- address: w("0xFd086bC7CD5C481DCC9C85ebE478A1C0b69FCbb9"),
992
+ address: S("0xFd086bC7CD5C481DCC9C85ebE478A1C0b69FCbb9"),
993
993
  symbol: c.USDT,
994
994
  name: "Tether USD",
995
995
  decimals: 6,
996
- logoURI: "/images/tokens/usdt.png"
997
- /* USDT */
996
+ logoURI: "/images/tokens/usdt.png",
997
+ nativeToken: !1
998
998
  },
999
999
  [c.WETH]: {
1000
- address: w("0x82aF49447D8a07e3bd95BD0d56f35241523fBab1"),
1000
+ address: S("0x82aF49447D8a07e3bd95BD0d56f35241523fBab1"),
1001
1001
  symbol: c.WETH,
1002
1002
  name: "Wrapped Ether",
1003
1003
  decimals: 18,
1004
- logoURI: "/images/tokens/weth.png"
1005
- /* WETH */
1004
+ logoURI: "/images/tokens/weth.png",
1005
+ nativeToken: !1
1006
1006
  }
1007
1007
  },
1008
1008
  [b.ARBITRUM_TESTNET]: {
1009
1009
  [c.USDC]: {
1010
- address: w("0x75faf114eafb1BDbe2F0316DF893fd58CE46AA4d"),
1010
+ address: S("0x75faf114eafb1BDbe2F0316DF893fd58CE46AA4d"),
1011
1011
  symbol: c.USDC,
1012
1012
  name: "USD Coin",
1013
1013
  fiatISO: "USD",
1014
1014
  decimals: 6,
1015
1015
  logoURI: "/images/tokens/usdc.svg",
1016
- logoSourceURI: "https://pay.daimo.com/coin-logos/usdc.png"
1016
+ logoSourceURI: "https://pay.daimo.com/coin-logos/usdc.png",
1017
+ nativeToken: !1
1017
1018
  }
1018
1019
  },
1019
1020
  [b.AVALANCHE]: {
@@ -1022,44 +1023,46 @@ const nt = {
1022
1023
  symbol: c.DAI,
1023
1024
  name: "Dai Stablecoin",
1024
1025
  decimals: 18,
1025
- logoURI: "/images/tokens/dai.png"
1026
- /* DAI */
1026
+ logoURI: "/images/tokens/dai.png",
1027
+ nativeToken: !1
1027
1028
  },
1028
1029
  [c.USDC]: {
1029
- address: w("0xB97EF9Ef8734C71904D8002F8b6Bc66Dd9c48a6E"),
1030
+ address: S("0xB97EF9Ef8734C71904D8002F8b6Bc66Dd9c48a6E"),
1030
1031
  symbol: c.USDC,
1031
1032
  name: "USD Coin",
1032
1033
  fiatISO: "USD",
1033
1034
  decimals: 6,
1034
1035
  logoURI: "/images/tokens/usdc.svg",
1035
- logoSourceURI: "https://pay.daimo.com/coin-logos/usdc.png"
1036
+ logoSourceURI: "https://pay.daimo.com/coin-logos/usdc.png",
1037
+ nativeToken: !1
1036
1038
  },
1037
1039
  [c.USDT]: {
1038
1040
  address: "0x9702230A8Ea53601f5cD2dc00fDBc13d4dF4A8c7",
1039
1041
  symbol: c.USDT,
1040
1042
  name: "Tether USD",
1041
1043
  decimals: 6,
1042
- logoURI: "/images/tokens/usdt.png"
1043
- /* USDT */
1044
+ logoURI: "/images/tokens/usdt.png",
1045
+ nativeToken: !1
1044
1046
  },
1045
1047
  [c.WETH]: {
1046
1048
  address: "0x49D5c2BdFfac6CE2BFdB6640F4F80f226bc10bAB",
1047
1049
  symbol: c.WETH,
1048
1050
  name: "Wrapped Ether",
1049
1051
  decimals: 18,
1050
- logoURI: "/images/tokens/weth.png"
1051
- /* WETH */
1052
+ logoURI: "/images/tokens/weth.png",
1053
+ nativeToken: !1
1052
1054
  }
1053
1055
  },
1054
1056
  [b.AVALANCHE_TESTNET]: {
1055
1057
  [c.USDC]: {
1056
- address: w("0x5425890298aed601595a70AB815c96711a31Bc65"),
1058
+ address: S("0x5425890298aed601595a70AB815c96711a31Bc65"),
1057
1059
  symbol: c.USDC,
1058
1060
  name: "USD Coin",
1059
1061
  fiatISO: "USD",
1060
1062
  decimals: 6,
1061
1063
  logoURI: "/images/tokens/usdc.svg",
1062
- logoSourceURI: "https://pay.daimo.com/coin-logos/usdc.png"
1064
+ logoSourceURI: "https://pay.daimo.com/coin-logos/usdc.png",
1065
+ nativeToken: !1
1063
1066
  }
1064
1067
  },
1065
1068
  [b.BASE]: {
@@ -1068,52 +1071,54 @@ const nt = {
1068
1071
  symbol: c.DAI,
1069
1072
  name: "Dai Stablecoin",
1070
1073
  decimals: 18,
1071
- logoURI: "/images/tokens/dai.png"
1072
- /* DAI */
1074
+ logoURI: "/images/tokens/dai.png",
1075
+ nativeToken: !1
1073
1076
  },
1074
1077
  [c.ETH]: {
1075
1078
  address: "0x0000000000000000000000000000000000000000",
1076
1079
  symbol: c.ETH,
1077
1080
  name: "Ethereum",
1078
1081
  decimals: 18,
1079
- logoURI: "/images/chains/ethereum.svg"
1080
- /* ETH */
1082
+ logoURI: "/images/chains/ethereum.svg",
1083
+ nativeToken: !0
1081
1084
  },
1082
1085
  [c.EURC]: {
1083
1086
  address: "0x60a3E35Cc302bFA44Cb288Bc5a4F316Fdb1adb42",
1084
1087
  symbol: c.EURC,
1085
1088
  name: "Euro Coin",
1086
1089
  decimals: 6,
1087
- logoURI: "/images/tokens/eurc.png"
1088
- /* EURC */
1090
+ logoURI: "/images/tokens/eurc.png",
1091
+ nativeToken: !1
1089
1092
  },
1090
1093
  [c.USDC]: {
1091
- address: w("0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913"),
1094
+ address: S("0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913"),
1092
1095
  symbol: c.USDC,
1093
1096
  name: "USD Coin",
1094
1097
  fiatISO: "USD",
1095
1098
  decimals: 6,
1096
1099
  logoURI: "/images/tokens/usdc.svg",
1097
- logoSourceURI: "https://pay.daimo.com/coin-logos/usdc.png"
1100
+ logoSourceURI: "https://pay.daimo.com/coin-logos/usdc.png",
1101
+ nativeToken: !1
1098
1102
  },
1099
1103
  [c.WETH]: {
1100
- address: w("0x4200000000000000000000000000000000000006"),
1104
+ address: S("0x4200000000000000000000000000000000000006"),
1101
1105
  symbol: c.WETH,
1102
1106
  name: "Wrapped Ether",
1103
1107
  decimals: 18,
1104
- logoURI: "/images/tokens/weth.png"
1105
- /* WETH */
1108
+ logoURI: "/images/tokens/weth.png",
1109
+ nativeToken: !1
1106
1110
  }
1107
1111
  },
1108
1112
  [b.BASE_TESTNET]: {
1109
1113
  [c.USDC]: {
1110
- address: w("0x036CbD53842c5426634e7929541eC2318f3dCF7e"),
1114
+ address: S("0x036CbD53842c5426634e7929541eC2318f3dCF7e"),
1111
1115
  symbol: c.USDC,
1112
1116
  name: "USD Coin",
1113
1117
  fiatISO: "USD",
1114
1118
  decimals: 6,
1115
1119
  logoURI: "/images/tokens/usdc.svg",
1116
- logoSourceURI: "https://pay.daimo.com/coin-logos/usdc.png"
1120
+ logoSourceURI: "https://pay.daimo.com/coin-logos/usdc.png",
1121
+ nativeToken: !1
1117
1122
  }
1118
1123
  },
1119
1124
  [b.BSC]: {
@@ -1122,48 +1127,49 @@ const nt = {
1122
1127
  symbol: c.BNB,
1123
1128
  name: "BNB",
1124
1129
  decimals: 18,
1125
- logoURI: "/images/chains/bsc.webp"
1126
- /* BNB */
1130
+ logoURI: "/images/chains/bsc.webp",
1131
+ nativeToken: !0
1127
1132
  },
1128
1133
  [c.BUSD]: {
1129
1134
  address: "0xe9e7CEA3DedcA5984780Bafc599bD69ADd087D56",
1130
1135
  symbol: c.BUSD,
1131
1136
  name: "Binance USD",
1132
1137
  decimals: 18,
1133
- logoURI: "/images/tokens/busd.png"
1134
- /* BUSD */
1138
+ logoURI: "/images/tokens/busd.png",
1139
+ nativeToken: !1
1135
1140
  },
1136
1141
  [c.DAI]: {
1137
1142
  address: "0x1AF3F329e8BE154074D8769D1FFa4eE058B1DBc3",
1138
1143
  symbol: c.DAI,
1139
1144
  name: "Dai Stablecoin",
1140
1145
  decimals: 18,
1141
- logoURI: "/images/tokens/dai.png"
1142
- /* DAI */
1146
+ logoURI: "/images/tokens/dai.png",
1147
+ nativeToken: !1
1143
1148
  },
1144
1149
  [c.ETH]: {
1145
1150
  address: "0x2170Ed0880ac9A755fd29B2688956BD959F933F8",
1146
1151
  symbol: c.ETH,
1147
1152
  name: "Ethereum",
1148
1153
  decimals: 18,
1149
- logoURI: "/images/chains/ethereum.svg"
1150
- /* ETH */
1154
+ logoURI: "/images/chains/ethereum.svg",
1155
+ nativeToken: !1
1151
1156
  },
1152
1157
  [c.USDC]: {
1153
- address: w("0x8AC76a51cc950d9822D68b83fE1Ad97B32Cd580d"),
1158
+ address: S("0x8AC76a51cc950d9822D68b83fE1Ad97B32Cd580d"),
1154
1159
  symbol: c.USDC,
1155
1160
  decimals: 18,
1156
1161
  name: "USD Coin",
1157
1162
  logoURI: "/images/tokens/usdc.svg",
1158
- logoSourceURI: "https://pay.daimo.com/coin-logos/usdc.png"
1163
+ logoSourceURI: "https://pay.daimo.com/coin-logos/usdc.png",
1164
+ nativeToken: !1
1159
1165
  },
1160
1166
  [c.USDT]: {
1161
1167
  address: "0x55d398326f99059fF775485246999027B3197955",
1162
1168
  symbol: c.USDT,
1163
1169
  name: "Tether USD",
1164
1170
  decimals: 18,
1165
- logoURI: "/images/tokens/usdt.png"
1166
- /* USDT */
1171
+ logoURI: "/images/tokens/usdt.png",
1172
+ nativeToken: !1
1167
1173
  }
1168
1174
  },
1169
1175
  [b.ETHEREUM]: {
@@ -1172,74 +1178,76 @@ const nt = {
1172
1178
  symbol: c.BUSD,
1173
1179
  name: "Binance USD",
1174
1180
  decimals: 18,
1175
- logoURI: "/images/tokens/busd.png"
1176
- /* BUSD */
1181
+ logoURI: "/images/tokens/busd.png",
1182
+ nativeToken: !1
1177
1183
  },
1178
1184
  [c.DAI]: {
1179
- address: w("0x6B175474E89094C44Da98b954EedeAC495271d0F"),
1185
+ address: S("0x6B175474E89094C44Da98b954EedeAC495271d0F"),
1180
1186
  symbol: c.DAI,
1181
1187
  name: "Dai Stablecoin",
1182
1188
  decimals: 18,
1183
- logoURI: "/images/tokens/dai.png"
1184
- /* DAI */
1189
+ logoURI: "/images/tokens/dai.png",
1190
+ nativeToken: !1
1185
1191
  },
1186
1192
  [c.ETH]: {
1187
1193
  address: "0x0000000000000000000000000000000000000000",
1188
1194
  symbol: c.ETH,
1189
1195
  name: "Ethereum",
1190
1196
  decimals: 18,
1191
- logoURI: "/images/chains/ethereum.svg"
1192
- /* ETH */
1197
+ logoURI: "/images/chains/ethereum.svg",
1198
+ nativeToken: !0
1193
1199
  },
1194
1200
  [c.EURC]: {
1195
1201
  address: "0x1aBaEA1f7C830bD89Acc67eC4af516284b1bC33c",
1196
1202
  symbol: c.EURC,
1197
1203
  name: "Euro Coin",
1198
1204
  decimals: 6,
1199
- logoURI: "/images/tokens/eurc.png"
1200
- /* EURC */
1205
+ logoURI: "/images/tokens/eurc.png",
1206
+ nativeToken: !1
1201
1207
  },
1202
1208
  [c.STRK]: {
1203
1209
  address: "0xCa14007Eff0dB1f8135f4C25B34De49AB0d42766",
1204
1210
  symbol: c.STRK,
1205
1211
  name: "Starknet Token",
1206
1212
  decimals: 18,
1207
- logoURI: "/images/chains/starknet.svg"
1208
- /* STRK */
1213
+ logoURI: "/images/chains/starknet.svg",
1214
+ nativeToken: !1
1209
1215
  },
1210
1216
  [c.USDC]: {
1211
- address: w("0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48"),
1217
+ address: S("0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48"),
1212
1218
  symbol: c.USDC,
1213
1219
  name: "USD Coin",
1214
1220
  decimals: 6,
1215
1221
  logoURI: "/images/tokens/usdc.svg",
1216
- logoSourceURI: "https://pay.daimo.com/coin-logos/usdc.png"
1222
+ logoSourceURI: "https://pay.daimo.com/coin-logos/usdc.png",
1223
+ nativeToken: !1
1217
1224
  },
1218
1225
  [c.USDT]: {
1219
- address: w("0xdAC17F958D2ee523a2206206994597C13D831ec7"),
1226
+ address: S("0xdAC17F958D2ee523a2206206994597C13D831ec7"),
1220
1227
  symbol: c.USDT,
1221
1228
  name: "Tether USD",
1222
1229
  decimals: 6,
1223
- logoURI: "/images/tokens/usdt.png"
1224
- /* USDT */
1230
+ logoURI: "/images/tokens/usdt.png",
1231
+ nativeToken: !1
1225
1232
  },
1226
1233
  [c.WETH]: {
1227
- address: w("0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2"),
1234
+ address: S("0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2"),
1228
1235
  symbol: c.WETH,
1229
1236
  name: "Wrapped Ether",
1230
1237
  decimals: 18,
1231
- logoURI: "/images/tokens/weth.png"
1232
- /* WETH */
1238
+ logoURI: "/images/tokens/weth.png",
1239
+ nativeToken: !1
1233
1240
  }
1234
1241
  },
1235
1242
  [b.ETHEREUM_TESTNET]: {
1236
1243
  [c.USDC]: {
1237
- address: w("0x1c7D4B196Cb0C7B01d743Fbc6116a902379C7238"),
1244
+ address: S("0x1c7D4B196Cb0C7B01d743Fbc6116a902379C7238"),
1238
1245
  symbol: c.USDC,
1239
1246
  decimals: 6,
1240
1247
  name: "USD Coin",
1241
1248
  logoURI: "/images/tokens/usdc.svg",
1242
- logoSourceURI: "https://pay.daimo.com/coin-logos/usdc.png"
1249
+ logoSourceURI: "https://pay.daimo.com/coin-logos/usdc.png",
1250
+ nativeToken: !1
1243
1251
  }
1244
1252
  },
1245
1253
  [b.HYPEREVM]: {
@@ -1248,8 +1256,8 @@ const nt = {
1248
1256
  symbol: c.USDC,
1249
1257
  name: "USD Coin",
1250
1258
  decimals: 6,
1251
- logoURI: "/images/tokens/usdc.svg"
1252
- /* USDC */
1259
+ logoURI: "/images/tokens/usdc.svg",
1260
+ nativeToken: !1
1253
1261
  }
1254
1262
  },
1255
1263
  [b.LISK]: {
@@ -1258,8 +1266,8 @@ const nt = {
1258
1266
  symbol: c.USDC,
1259
1267
  name: "USD Coin",
1260
1268
  decimals: 6,
1261
- logoURI: "/images/tokens/usdc.svg"
1262
- /* USDC */
1269
+ logoURI: "/images/tokens/usdc.svg",
1270
+ nativeToken: !1
1263
1271
  }
1264
1272
  },
1265
1273
  [b.MONAD]: {
@@ -1268,8 +1276,8 @@ const nt = {
1268
1276
  symbol: c.USDC,
1269
1277
  name: "USD Coin",
1270
1278
  decimals: 6,
1271
- logoURI: "/images/tokens/usdc.svg"
1272
- /* USDC */
1279
+ logoURI: "/images/tokens/usdc.svg",
1280
+ nativeToken: !1
1273
1281
  }
1274
1282
  },
1275
1283
  [b.MONAD_TESTNET]: {
@@ -1278,8 +1286,8 @@ const nt = {
1278
1286
  symbol: c.USDC,
1279
1287
  name: "USD Coin",
1280
1288
  decimals: 6,
1281
- logoURI: "/images/tokens/usdc.svg"
1282
- /* USDC */
1289
+ logoURI: "/images/tokens/usdc.svg",
1290
+ nativeToken: !1
1283
1291
  }
1284
1292
  },
1285
1293
  [b.OPTIMISM]: {
@@ -1288,40 +1296,40 @@ const nt = {
1288
1296
  symbol: c.DAI,
1289
1297
  name: "Dai Stablecoin",
1290
1298
  decimals: 18,
1291
- logoURI: "/images/tokens/dai.png"
1292
- /* DAI */
1299
+ logoURI: "/images/tokens/dai.png",
1300
+ nativeToken: !1
1293
1301
  },
1294
1302
  [c.ETH]: {
1295
1303
  address: "0x0000000000000000000000000000000000000000",
1296
1304
  symbol: c.ETH,
1297
1305
  name: "Ethereum",
1298
1306
  decimals: 18,
1299
- logoURI: "/images/chains/ethereum.svg"
1300
- /* ETH */
1307
+ logoURI: "/images/chains/ethereum.svg",
1308
+ nativeToken: !0
1301
1309
  },
1302
1310
  [c.USDC]: {
1303
1311
  address: "0x0b2C639c533813f4Aa9D7837CAf62653d097Ff85",
1304
1312
  symbol: c.USDC,
1305
1313
  name: "USD Coin",
1306
1314
  decimals: 6,
1307
- logoURI: "/images/tokens/usdc.svg"
1308
- /* USDC */
1315
+ logoURI: "/images/tokens/usdc.svg",
1316
+ nativeToken: !1
1309
1317
  },
1310
1318
  [c.USDT]: {
1311
1319
  address: "0x94b008aA00579c1307B0EF2c499aD98a8ce58e58",
1312
1320
  symbol: c.USDT,
1313
1321
  name: "Tether USD",
1314
1322
  decimals: 6,
1315
- logoURI: "/images/tokens/usdt.png"
1316
- /* USDT */
1323
+ logoURI: "/images/tokens/usdt.png",
1324
+ nativeToken: !1
1317
1325
  },
1318
1326
  [c.WETH]: {
1319
1327
  address: "0x4200000000000000000000000000000000000006",
1320
1328
  symbol: c.WETH,
1321
1329
  name: "Wrapped Ether",
1322
1330
  decimals: 18,
1323
- logoURI: "/images/tokens/weth.png"
1324
- /* WETH */
1331
+ logoURI: "/images/tokens/weth.png",
1332
+ nativeToken: !1
1325
1333
  }
1326
1334
  },
1327
1335
  [b.OPTIMISM_TESTNET]: {
@@ -1330,8 +1338,8 @@ const nt = {
1330
1338
  symbol: c.USDC,
1331
1339
  name: "USD Coin",
1332
1340
  decimals: 6,
1333
- logoURI: "/images/tokens/usdc.svg"
1334
- /* USDC */
1341
+ logoURI: "/images/tokens/usdc.svg",
1342
+ nativeToken: !1
1335
1343
  }
1336
1344
  },
1337
1345
  [b.POLYGON]: {
@@ -1340,32 +1348,32 @@ const nt = {
1340
1348
  symbol: c.DAI,
1341
1349
  name: "Dai Stablecoin",
1342
1350
  decimals: 18,
1343
- logoURI: "/images/tokens/dai.png"
1344
- /* DAI */
1351
+ logoURI: "/images/tokens/dai.png",
1352
+ nativeToken: !1
1345
1353
  },
1346
1354
  [c.USDC]: {
1347
1355
  address: "0x3c499c542cEF5E3811e1192ce70d8cC03d5c3359",
1348
1356
  symbol: c.USDC,
1349
1357
  name: "USD Coin",
1350
1358
  decimals: 6,
1351
- logoURI: "/images/tokens/usdc.svg"
1352
- /* USDC */
1359
+ logoURI: "/images/tokens/usdc.svg",
1360
+ nativeToken: !1
1353
1361
  },
1354
1362
  [c.USDT]: {
1355
1363
  address: "0xc2132D05D31c914a87C6611C10748AEb04B58e8F",
1356
1364
  symbol: c.USDT,
1357
1365
  name: "Tether USD",
1358
1366
  decimals: 6,
1359
- logoURI: "/images/tokens/usdt.png"
1360
- /* USDT */
1367
+ logoURI: "/images/tokens/usdt.png",
1368
+ nativeToken: !1
1361
1369
  },
1362
1370
  [c.WETH]: {
1363
1371
  address: "0x7ceB23fD6bC0adD59E62ac25578270cFf1b9f619",
1364
1372
  symbol: c.WETH,
1365
1373
  name: "Wrapped Ether",
1366
1374
  decimals: 18,
1367
- logoURI: "/images/tokens/weth.png"
1368
- /* WETH */
1375
+ logoURI: "/images/tokens/weth.png",
1376
+ nativeToken: !1
1369
1377
  }
1370
1378
  },
1371
1379
  [b.STARKNET]: {
@@ -1374,32 +1382,32 @@ const nt = {
1374
1382
  symbol: c.DAI,
1375
1383
  name: "Dai Stablecoin",
1376
1384
  decimals: 18,
1377
- logoURI: "/images/tokens/dai.png"
1378
- /* DAI */
1385
+ logoURI: "/images/tokens/dai.png",
1386
+ nativeToken: !1
1379
1387
  },
1380
1388
  [c.ETH]: {
1381
1389
  address: "0x049d36570d4e46f48e99674bd3fcc84644ddd6b96f7c741b1562b82f9e004dc7",
1382
1390
  symbol: c.ETH,
1383
1391
  name: "Ethereum",
1384
1392
  decimals: 18,
1385
- logoURI: "/images/chains/ethereum.svg"
1386
- /* ETH */
1393
+ logoURI: "/images/chains/ethereum.svg",
1394
+ nativeToken: !1
1387
1395
  },
1388
1396
  [c.LORDS]: {
1389
1397
  address: "0x0124aeb495b947201f5faC96fD1138E326AD86195B98df6DEc9009158A533B49",
1390
1398
  symbol: c.LORDS,
1391
1399
  name: "LORDS Token",
1392
1400
  decimals: 18,
1393
- logoURI: "/images/tokens/lords.png"
1394
- /* LORDS */
1401
+ logoURI: "/images/tokens/lords.png",
1402
+ nativeToken: !1
1395
1403
  },
1396
1404
  [c.STRK]: {
1397
1405
  address: "0x04718f5a0Fc34cC1AF16A1cdee98fFB20C31f5cD61D6Ab07201858f4287c938D",
1398
1406
  symbol: c.STRK,
1399
1407
  name: "Starknet Token",
1400
1408
  decimals: 18,
1401
- logoURI: "/images/chains/starknet.svg"
1402
- /* STRK */
1409
+ logoURI: "/images/chains/starknet.svg",
1410
+ nativeToken: !1
1403
1411
  },
1404
1412
  [c.USDC]: {
1405
1413
  address: "0x033068F6539f8e6e6b131e6B2B814e6c34A5224bC66947c47DaB9dFeE93b35fb",
@@ -1407,15 +1415,16 @@ const nt = {
1407
1415
  name: "USD Coin",
1408
1416
  decimals: 6,
1409
1417
  logoURI: "/images/tokens/usdc.svg",
1410
- logoSourceURI: "https://pay.daimo.com/coin-logos/usdc.png"
1418
+ logoSourceURI: "https://pay.daimo.com/coin-logos/usdc.png",
1419
+ nativeToken: !1
1411
1420
  },
1412
1421
  [c.USDT]: {
1413
1422
  address: "0x068f5c6a61780768455de69077e07e89787839bf8166decfbf92b645209c0fb8",
1414
1423
  symbol: c.USDT,
1415
1424
  name: "Tether USD",
1416
1425
  decimals: 6,
1417
- logoURI: "/images/tokens/usdt.png"
1418
- /* USDT */
1426
+ logoURI: "/images/tokens/usdt.png",
1427
+ nativeToken: !1
1419
1428
  }
1420
1429
  },
1421
1430
  [b.STARKNET_TESTNET]: {
@@ -1424,93 +1433,93 @@ const nt = {
1424
1433
  symbol: c.USDC,
1425
1434
  name: "USD Coin",
1426
1435
  decimals: 6,
1427
- logoURI: "/images/tokens/usdc.svg"
1428
- /* USDC */
1436
+ logoURI: "/images/tokens/usdc.svg",
1437
+ nativeToken: !1
1429
1438
  }
1430
1439
  }
1431
- }, Us = new Set(Object.values(b));
1432
- function S(t) {
1433
- if (Is(t))
1440
+ }, xs = new Set(Object.values(b));
1441
+ function w(t) {
1442
+ if (Ns(t))
1434
1443
  return t;
1435
1444
  const e = b[t];
1436
1445
  if (!e)
1437
1446
  throw new Error(`Invalid chain: ${t}. Chain must be a valid chain alias or internal chain value from Chains.`);
1438
1447
  return e;
1439
1448
  }
1440
- function Is(t) {
1441
- return Us.has(t);
1449
+ function Ns(t) {
1450
+ return xs.has(t);
1442
1451
  }
1443
- function Ps(t, e) {
1444
- const s = e.toLowerCase().trim(), n = nt[t];
1452
+ function Os(t, e) {
1453
+ const s = e.toLowerCase().trim(), n = ut[t];
1445
1454
  if (!n)
1446
1455
  throw new Error(
1447
1456
  `Chain not found: ${t}. The chain key must be a valid chain identifier.`
1448
1457
  );
1449
- let r;
1458
+ let o;
1450
1459
  for (const i in n) {
1451
- const o = n[i];
1452
- if (o && o.address.toLowerCase() === s.toLowerCase()) {
1453
- r = o;
1460
+ const r = n[i];
1461
+ if (r && r.address.toLowerCase() === s.toLowerCase()) {
1462
+ o = r;
1454
1463
  break;
1455
1464
  }
1456
1465
  }
1457
- if (!r)
1466
+ if (!o)
1458
1467
  throw new Error(
1459
1468
  `Token address mismatch: address ${e} does not exist on chain ${t}. The token address must be a valid token address on the specified chain.`
1460
1469
  );
1461
- return r;
1470
+ return o;
1462
1471
  }
1463
- function Z(t, e, s) {
1464
- const n = Ps(t, e);
1472
+ function se(t, e, s) {
1473
+ const n = Os(t, e);
1465
1474
  if (n.symbol !== s)
1466
1475
  throw new Error(
1467
1476
  `Token address and symbol mismatch: address ${e} on chain ${t} corresponds to token "${n.symbol}", but expected "${s}". The token address must correspond to a token with the expected symbol on the specified chain.`
1468
1477
  );
1469
1478
  return n;
1470
1479
  }
1471
- function vs(t, e) {
1472
- return nt[t]?.[e];
1480
+ function Bs(t, e) {
1481
+ return ut[t]?.[e];
1473
1482
  }
1474
- function ks(t, e) {
1475
- return vs(t, e)?.address;
1483
+ function Me(t, e) {
1484
+ return Bs(t, e)?.address;
1476
1485
  }
1477
- var de = /* @__PURE__ */ ((t) => (t.PRODUCTION = "production", t.STAGING = "staging", t))(de || {});
1478
- class g {
1479
- constructor({ api_key: e, env: s, seesion_token: n, props: r }) {
1480
- this.api_key = e || "", this.sessionToken = n || "", this.env = s ?? de.PRODUCTION, this.props = r;
1486
+ var ge = /* @__PURE__ */ ((t) => (t.PRODUCTION = "production", t.STAGING = "staging", t))(ge || {});
1487
+ class d {
1488
+ constructor({ api_key: e, env: s, seesion_token: n, props: o }) {
1489
+ this.api_key = e || "", this.sessionToken = n || "", this.env = s ?? ge.PRODUCTION, this.props = o;
1481
1490
  }
1482
1491
  static async config(e) {
1483
- if (!g.app) {
1492
+ if (!d.app) {
1484
1493
  if (!e)
1485
1494
  throw new Error("Please provide an api_key");
1486
- g.app = new g(e);
1495
+ d.app = new d(e);
1487
1496
  }
1488
- return e && (e.api_key !== void 0 && (g.app.api_key = e.api_key), e.seesion_token !== void 0 && (g.app.sessionToken = e.seesion_token), e.env !== void 0 && (g.app.env = e.env), e.props !== void 0 && (g.app.props = e.props)), g.app;
1497
+ return e && (e.api_key !== void 0 && (d.app.api_key = e.api_key), e.seesion_token !== void 0 && (d.app.sessionToken = e.seesion_token), e.env !== void 0 && (d.app.env = e.env), e.props !== void 0 && (d.app.props = e.props)), d.app;
1489
1498
  }
1490
1499
  static getApiKey() {
1491
- if (!g.app)
1500
+ if (!d.app)
1492
1501
  throw new Error("Chainrails SDK not configured. Please call Chainrails.config() first.");
1493
- return g.app.api_key;
1502
+ return d.app.api_key;
1494
1503
  }
1495
1504
  static getSessionToken() {
1496
- if (!g.app)
1505
+ if (!d.app)
1497
1506
  throw new Error("Chainrails SDK not configured. Please call Chainrails.config() first.");
1498
- return g.app.sessionToken;
1507
+ return d.app.sessionToken;
1499
1508
  }
1500
1509
  static getProps() {
1501
- if (!g.app)
1510
+ if (!d.app)
1502
1511
  throw new Error("Chainrails SDK not configured. Please call Chainrails.config() first.");
1503
- return g.app.props;
1512
+ return d.app.props;
1504
1513
  }
1505
1514
  static getEnv() {
1506
- if (!g.app)
1515
+ if (!d.app)
1507
1516
  throw new Error("Chainrails SDK not configured. Please call Chainrails.config() first.");
1508
- return g.app.env === "internal" ? "staging" : g.app.env;
1517
+ return d.app.env === "internal" ? "staging" : d.app.env;
1509
1518
  }
1510
1519
  static getBaseUrl() {
1511
- if (!g.app)
1520
+ if (!d.app)
1512
1521
  throw new Error("Chainrails SDK not configured. Please call Chainrails.config() first.");
1513
- switch (g.app.env) {
1522
+ switch (d.app.env) {
1514
1523
  case "production":
1515
1524
  return "https://api.chainrails.io/api/v1";
1516
1525
  case "staging":
@@ -1522,23 +1531,23 @@ class g {
1522
1531
  }
1523
1532
  }
1524
1533
  static getPayModalUrl(e) {
1525
- if (!g.app)
1534
+ if (!d.app)
1526
1535
  throw new Error("Chainrails SDK not configured. Please call Chainrails.config() first.");
1527
- const s = g.app.env === "internal" ? "https://chainrails-frontend-git-staging-horus-labs.vercel.app" : "https://app.chainrails.io", n = Number(e), r = e && !isNaN(Number(e)) && n > 0 ? "/pay/" : "/deposit/", i = `${e && !isNaN(Number(e)) && n > 0 ? n * 100 : ""}`;
1528
- return s + r + i;
1536
+ const s = d.app.env === "internal" ? "https://chainrails-frontend-git-staging-horus-labs.vercel.app" : "https://app.chainrails.io", n = Number(e), o = e && !isNaN(Number(e)) && n > 0 ? "/pay/" : "/deposit/", i = `${e && !isNaN(Number(e)) && n > 0 ? n * 100 : ""}`;
1537
+ return s + o + i;
1529
1538
  }
1530
1539
  }
1531
- let ne = null;
1532
- function xs() {
1533
- ne = zt.create({
1534
- prefixUrl: g.getBaseUrl(),
1540
+ let ae = null;
1541
+ function Ms() {
1542
+ ae = Vt.create({
1543
+ prefixUrl: d.getBaseUrl(),
1535
1544
  headers: {
1536
1545
  "Content-Type": "application/json"
1537
1546
  },
1538
1547
  hooks: {
1539
1548
  beforeRequest: [
1540
1549
  (t) => {
1541
- const e = g.getSessionToken() || g.getApiKey();
1550
+ const e = d.getSessionToken() || d.getApiKey();
1542
1551
  t.headers.set("Authorization", `Bearer ${e}`);
1543
1552
  }
1544
1553
  ],
@@ -1550,9 +1559,9 @@ function xs() {
1550
1559
  });
1551
1560
  }
1552
1561
  function p() {
1553
- return ne || xs(), ne;
1562
+ return ae || Ms(), ae;
1554
1563
  }
1555
- class Ns {
1564
+ class Ls {
1556
1565
  async getById(e) {
1557
1566
  return await p().get("intents/" + e).json();
1558
1567
  }
@@ -1569,7 +1578,7 @@ class Ns {
1569
1578
  return await p().get("intents", { searchParams: e }).json();
1570
1579
  }
1571
1580
  async create(e) {
1572
- const s = S(e.source_chain), n = S(e.destination_chain);
1581
+ const s = w(e.source_chain), n = w(e.destination_chain);
1573
1582
  return await p().post("intents", {
1574
1583
  json: {
1575
1584
  ...e,
@@ -1579,7 +1588,7 @@ class Ns {
1579
1588
  }).json();
1580
1589
  }
1581
1590
  async createForSession(e) {
1582
- const s = S(e.sourceChain);
1591
+ const s = w(e.sourceChain);
1583
1592
  return await p().post("modal/sessions/intents", {
1584
1593
  json: { ...e, sourceChain: s }
1585
1594
  }).json();
@@ -1594,11 +1603,11 @@ class Ns {
1594
1603
  return await p().post(`modal/sessions/intents/${e}/process`).json();
1595
1604
  }
1596
1605
  }
1597
- class Os {
1606
+ class _s {
1598
1607
  async getFromSpecificBridge(e) {
1599
- const s = S(e.sourceChain);
1600
- Z(s, e.tokenIn, e.amountSymbol);
1601
- const n = S(e.destinationChain);
1608
+ const s = w(e.sourceChain);
1609
+ se(s, e.tokenIn, e.amountSymbol);
1610
+ const n = w(e.destinationChain);
1602
1611
  return await p().get("quotes/single", {
1603
1612
  searchParams: {
1604
1613
  ...e,
@@ -1608,9 +1617,9 @@ class Os {
1608
1617
  }).json();
1609
1618
  }
1610
1619
  async getFromAllBridges(e) {
1611
- const s = S(e.sourceChain);
1612
- Z(s, e.tokenIn, e.amountSymbol);
1613
- const n = S(e.destinationChain);
1620
+ const s = w(e.sourceChain);
1621
+ se(s, e.tokenIn, e.amountSymbol);
1622
+ const n = w(e.destinationChain);
1614
1623
  return await p().get("quotes/multiple", {
1615
1624
  searchParams: {
1616
1625
  ...e,
@@ -1620,9 +1629,9 @@ class Os {
1620
1629
  }).json();
1621
1630
  }
1622
1631
  async getBestAcrossBridges(e) {
1623
- const s = S(e.sourceChain);
1624
- Z(s, e.tokenIn, e.amountSymbol);
1625
- const n = S(e.destinationChain);
1632
+ const s = w(e.sourceChain);
1633
+ se(s, e.tokenIn, e.amountSymbol);
1634
+ const n = w(e.destinationChain);
1626
1635
  return await p().get("quotes/best", { searchParams: {
1627
1636
  ...e,
1628
1637
  sourceChain: s,
@@ -1630,7 +1639,7 @@ class Os {
1630
1639
  } }).json();
1631
1640
  }
1632
1641
  async getAll(e) {
1633
- const s = S(e.destinationChain);
1642
+ const s = w(e.destinationChain);
1634
1643
  return await p().get("quotes/multi-source", { searchParams: {
1635
1644
  ...e,
1636
1645
  destinationChain: s
@@ -1640,9 +1649,9 @@ class Os {
1640
1649
  return await p().get("modal/sessions/quotes", { searchParams: e }).json();
1641
1650
  }
1642
1651
  }
1643
- class Bs {
1652
+ class Fs {
1644
1653
  async getOptimalRoutes(e) {
1645
- const s = S(e.sourceChain), n = S(e.destinationChain);
1654
+ const s = w(e.sourceChain), n = w(e.destinationChain);
1646
1655
  return await p().get("router/optimal-route", {
1647
1656
  searchParams: {
1648
1657
  ...e,
@@ -1655,23 +1664,18 @@ class Bs {
1655
1664
  return await p().get("router/supported-bridges/all").json();
1656
1665
  }
1657
1666
  async getSupportedBridges(e) {
1658
- const s = S(e.sourceChain), n = S(e.destinationChain);
1667
+ const s = w(e.sourceChain), n = w(e.destinationChain);
1659
1668
  return await p().get("router/supported-bridges/route", { searchParams: {
1660
1669
  ...e,
1661
1670
  sourceChain: s,
1662
1671
  destinationChain: n
1663
1672
  } }).json();
1664
1673
  }
1665
- async getSupportedRoutes(e, s) {
1666
- const n = S(s.sourceChain), r = S(s.destinationChain);
1667
- return await p().get("router/supported-routes/bridge/" + e, { searchParams: {
1668
- ...s,
1669
- sourceChain: n,
1670
- destinationChain: r
1671
- } }).json();
1674
+ async getSupportedRoutes(e) {
1675
+ return await p().get("router/supported-routes/bridge/" + e).json();
1672
1676
  }
1673
1677
  }
1674
- class Ms {
1678
+ class Hs {
1675
1679
  async getSupported(e) {
1676
1680
  return await p().get("chains", { searchParams: e }).json();
1677
1681
  }
@@ -1679,7 +1683,7 @@ class Ms {
1679
1683
  return await p().get(`chains/balances/${e.address}`, { searchParams: e }).json();
1680
1684
  }
1681
1685
  }
1682
- class Ls {
1686
+ class $s {
1683
1687
  async getClientInfo() {
1684
1688
  return await p().get("client/auth/client-info").json();
1685
1689
  }
@@ -1687,182 +1691,205 @@ class Ls {
1687
1691
  return await p().get("modal/sessions/client").json();
1688
1692
  }
1689
1693
  }
1690
- class Fs {
1694
+ class js {
1691
1695
  async getSessionToken(e) {
1692
- const s = S(e.destinationChain), n = {
1696
+ const s = w(e.destinationChain);
1697
+ let n = Me(s, e.token);
1698
+ n || (console.error(`${e.token} on ${e.destinationChain} is currently unsupported, defaulting to usdc`), n = Me(s, "USDC"));
1699
+ const o = {
1693
1700
  recipient: e.recipient,
1694
- tokenOut: ks(
1695
- s,
1696
- e.token
1697
- ),
1701
+ tokenOut: n,
1698
1702
  destinationChain: s,
1699
1703
  amount: e.amount
1700
1704
  };
1701
- return p().post("modal/sessions", { json: n }).json().then((r) => ({ ...r, amount: n.amount }));
1705
+ return p().post("modal/sessions", { json: o }).json().then((i) => ({ ...i, amount: o.amount }));
1702
1706
  }
1703
1707
  }
1704
- const ln = {
1705
- router: new Bs(),
1706
- quotes: new Os(),
1707
- intents: new Ns(),
1708
- chains: new Ms(),
1709
- client: new Ls(),
1710
- auth: new Fs()
1708
+ const gn = {
1709
+ router: new Fs(),
1710
+ quotes: new _s(),
1711
+ intents: new Ls(),
1712
+ chains: new Hs(),
1713
+ client: new $s(),
1714
+ auth: new js()
1711
1715
  };
1712
- function rt(t) {
1716
+ function lt(t) {
1713
1717
  var e, s, n = "";
1714
1718
  if (typeof t == "string" || typeof t == "number") n += t;
1715
1719
  else if (typeof t == "object") if (Array.isArray(t)) {
1716
- var r = t.length;
1717
- for (e = 0; e < r; e++) t[e] && (s = rt(t[e])) && (n && (n += " "), n += s);
1720
+ var o = t.length;
1721
+ for (e = 0; e < o; e++) t[e] && (s = lt(t[e])) && (n && (n += " "), n += s);
1718
1722
  } else for (s in t) t[s] && (n && (n += " "), n += s);
1719
1723
  return n;
1720
1724
  }
1721
- function _s() {
1722
- for (var t, e, s = 0, n = "", r = arguments.length; s < r; s++) (t = arguments[s]) && (e = rt(t)) && (n && (n += " "), n += e);
1725
+ function zs() {
1726
+ for (var t, e, s = 0, n = "", o = arguments.length; s < o; s++) (t = arguments[s]) && (e = lt(t)) && (n && (n += " "), n += e);
1723
1727
  return n;
1724
1728
  }
1725
- function dn(t) {
1729
+ const qs = ["light", "dark", "system"];
1730
+ function pn(t) {
1726
1731
  const {
1727
1732
  amount: e,
1728
1733
  styles: s,
1729
1734
  excludeChains: n,
1730
- isOpen: r,
1735
+ isOpen: o,
1731
1736
  isPending: i,
1732
- open: o,
1737
+ open: r,
1733
1738
  close: a,
1734
1739
  onCancel: u,
1735
1740
  onSuccess: l,
1736
- session_url: d,
1737
- sessionToken: T
1738
- } = t, [m, y] = v(0), [R, W] = v(""), f = ie(null);
1739
- g.config({
1741
+ session_url: f,
1742
+ sessionToken: E
1743
+ } = t, [h, y] = k(0), [R, V] = k(""), [g, T] = k(null), m = le(null);
1744
+ d.config({
1740
1745
  api_key: "",
1741
1746
  // @ts-expect-error
1742
1747
  env: t.env === "internal" ? "internal" : "production"
1743
1748
  }), x(() => {
1744
- W(g.getPayModalUrl(e));
1749
+ V(d.getPayModalUrl(e));
1745
1750
  }, [e]), x(() => {
1746
- const h = document.body.style.overflow;
1747
- r ? (document.body.style.overflow = "hidden", document.body.style.overflow = "hidden") : document.body.style.overflow = h || "";
1748
- const C = (I) => {
1749
- I.data === "closed" && (a(), u?.()), I.data === "completed" && (window.setTimeout(a, 2e3), l?.());
1751
+ const C = s?.theme;
1752
+ if (!C || qs.includes(C)) {
1753
+ T(null);
1754
+ return;
1755
+ }
1756
+ let D = !1;
1757
+ return (async () => {
1758
+ try {
1759
+ const G = d.getBaseUrl(), Re = await fetch(`${G}/themes/${C}`);
1760
+ if (!Re.ok) return;
1761
+ const X = await Re.json();
1762
+ !D && X.status === "approved" && X.css_content && T(X.css_content);
1763
+ } catch (G) {
1764
+ console.error("Failed to fetch theme:", G);
1765
+ }
1766
+ })(), () => {
1767
+ D = !0;
1768
+ };
1769
+ }, [s?.theme]), x(() => {
1770
+ const C = document.body.style.overflow;
1771
+ o ? (document.body.style.overflow = "hidden", document.body.style.overflow = "hidden") : document.body.style.overflow = C || "";
1772
+ const D = (Y) => {
1773
+ Y.data === "closed" && (a(), u?.()), Y.data === "completed" && (window.setTimeout(a, 2e3), l?.());
1750
1774
  };
1751
- return window.addEventListener("message", C), () => {
1752
- document.body.style.overflow = h || "", window.removeEventListener("message", C);
1775
+ return window.addEventListener("message", D), () => {
1776
+ document.body.style.overflow = C || "", window.removeEventListener("message", D);
1753
1777
  };
1754
- }, [r, u, l]), x(() => {
1755
- if (!T) return;
1756
- const h = {
1778
+ }, [o, u, l]), x(() => {
1779
+ if (!E) return;
1780
+ const C = t.css || g || void 0, D = {
1757
1781
  type: "session",
1758
- session_token: T,
1759
- environment: g.getEnv() || de.PRODUCTION,
1782
+ session_token: E,
1783
+ environment: d.getEnv() || ge.PRODUCTION,
1760
1784
  styles: s,
1761
1785
  props: {
1762
1786
  excludeChains: n?.join(",")
1763
- }
1787
+ },
1788
+ ...C ? {
1789
+ css: C
1790
+ } : {}
1764
1791
  };
1765
- f.current?.contentWindow?.postMessage(h, "https://app.chainrails.io"), f.current?.contentWindow?.postMessage(h, "https://chainrails-frontend-git-staging-horus-labs.vercel.app"), window.setTimeout(() => {
1766
- f.current?.contentWindow?.postMessage(h, "https://app.chainrails.io"), f.current?.contentWindow?.postMessage(h, "https://chainrails-frontend-git-staging-horus-labs.vercel.app");
1792
+ m.current?.contentWindow?.postMessage(D, "https://app.chainrails.io"), m.current?.contentWindow?.postMessage(D, "https://chainrails-frontend-git-staging-horus-labs.vercel.app"), window.setTimeout(() => {
1793
+ m.current?.contentWindow?.postMessage(D, "https://app.chainrails.io"), m.current?.contentWindow?.postMessage(D, "https://chainrails-frontend-git-staging-horus-labs.vercel.app");
1767
1794
  }, 1e3);
1768
- }, [T, m, r, s]);
1769
- function E() {
1795
+ }, [E, h, o, s, g]);
1796
+ function A() {
1770
1797
  y(Math.random());
1771
1798
  }
1772
- return /* @__PURE__ */ Te("div", {
1773
- className: _s("payment-modal-wrapper", m === 0 || i ? "loading" : "not-loading", r ? "open" : "closed"),
1774
- children: [(m === 0 || i) && /* @__PURE__ */ L("div", {
1799
+ return /* @__PURE__ */ Ae("div", {
1800
+ className: zs("payment-modal-wrapper", h === 0 || i ? "loading" : "not-loading", o ? "open" : "closed"),
1801
+ children: [(h === 0 || i) && /* @__PURE__ */ _("div", {
1775
1802
  role: "status",
1776
1803
  className: "payment-modal-loader",
1777
- children: /* @__PURE__ */ Te("svg", {
1804
+ children: /* @__PURE__ */ Ae("svg", {
1778
1805
  "aria-hidden": "true",
1779
1806
  className: "icon",
1780
1807
  viewBox: "0 0 100 101",
1781
1808
  fill: "none",
1782
1809
  xmlns: "http://www.w3.org/2000/svg",
1783
- children: [/* @__PURE__ */ L("path", {
1810
+ children: [/* @__PURE__ */ _("path", {
1784
1811
  d: "M100 50.5908C100 78.2051 77.6142 100.591 50 100.591C22.3858 100.591 0 78.2051 0 50.5908C0 22.9766 22.3858 0.59082 50 0.59082C77.6142 0.59082 100 22.9766 100 50.5908ZM9.08144 50.5908C9.08144 73.1895 27.4013 91.5094 50 91.5094C72.5987 91.5094 90.9186 73.1895 90.9186 50.5908C90.9186 27.9921 72.5987 9.67226 50 9.67226C27.4013 9.67226 9.08144 27.9921 9.08144 50.5908Z",
1785
1812
  fill: "currentColor"
1786
- }), /* @__PURE__ */ L("path", {
1813
+ }), /* @__PURE__ */ _("path", {
1787
1814
  d: "M93.9676 39.0409C96.393 38.4038 97.8624 35.9116 97.0079 33.5539C95.2932 28.8227 92.871 24.3692 89.8167 20.348C85.8452 15.1192 80.8826 10.7238 75.2124 7.41289C69.5422 4.10194 63.2754 1.94025 56.7698 1.05124C51.7666 0.367541 46.6976 0.446843 41.7345 1.27873C39.2613 1.69328 37.813 4.19778 38.4501 6.62326C39.0873 9.04874 41.5694 10.4717 44.0505 10.1071C47.8511 9.54855 51.7191 9.52689 55.5402 10.0491C60.8642 10.7766 65.9928 12.5457 70.6331 15.2552C75.2735 17.9648 79.3347 21.5619 82.5849 25.841C84.9175 28.9121 86.7997 32.2913 88.1811 35.8758C89.083 38.2158 91.5421 39.6781 93.9676 39.0409Z",
1788
1815
  fill: "currentFill"
1789
1816
  })]
1790
1817
  })
1791
- }), /* @__PURE__ */ L("iframe", {
1818
+ }), /* @__PURE__ */ _("iframe", {
1792
1819
  allow: "clipboard-read *; clipboard-write *",
1793
1820
  src: R || void 0,
1794
- onLoad: E,
1795
- className: `payment-modal ${m === 0 || i ? "invisible" : "visible"}`,
1821
+ onLoad: A,
1822
+ className: `payment-modal ${h === 0 || i ? "invisible" : "visible"}`,
1796
1823
  "data-id": e,
1797
- ref: f
1824
+ ref: m
1798
1825
  }, e)]
1799
1826
  });
1800
1827
  }
1801
- const Hs = Symbol(), fe = Symbol(), O = "a", ot = "f", ke = "p", it = "c", at = "t", he = "h", B = "w", ge = "o", me = "k";
1802
- let $s = (t, e) => new Proxy(t, e);
1803
- const re = Object.getPrototypeOf, oe = /* @__PURE__ */ new WeakMap(), ct = (t) => t && (oe.has(t) ? oe.get(t) : re(t) === Object.prototype || re(t) === Array.prototype), z = (t) => typeof t == "object" && t !== null, zs = (t) => Object.values(Object.getOwnPropertyDescriptors(t)).some((e) => !e.configurable && !e.writable), js = (t) => {
1828
+ const Ks = Symbol(), pe = Symbol(), B = "a", dt = "f", Le = "p", ft = "c", ht = "t", ye = "h", M = "w", Te = "o", be = "k";
1829
+ let Ws = (t, e) => new Proxy(t, e);
1830
+ const ce = Object.getPrototypeOf, ue = /* @__PURE__ */ new WeakMap(), mt = (t) => t && (ue.has(t) ? ue.get(t) : ce(t) === Object.prototype || ce(t) === Array.prototype), z = (t) => typeof t == "object" && t !== null, Vs = (t) => Object.values(Object.getOwnPropertyDescriptors(t)).some((e) => !e.configurable && !e.writable), Ys = (t) => {
1804
1831
  if (Array.isArray(t))
1805
1832
  return Array.from(t);
1806
1833
  const e = Object.getOwnPropertyDescriptors(t);
1807
1834
  return Object.values(e).forEach((s) => {
1808
1835
  s.configurable = !0;
1809
- }), Object.create(re(t), e);
1810
- }, qs = (t, e) => {
1836
+ }), Object.create(ce(t), e);
1837
+ }, Gs = (t, e) => {
1811
1838
  const s = {
1812
- [ot]: e
1839
+ [dt]: e
1813
1840
  };
1814
1841
  let n = !1;
1815
- const r = (a, u) => {
1842
+ const o = (a, u) => {
1816
1843
  if (!n) {
1817
- let l = s[O].get(t);
1818
- if (l || (l = {}, s[O].set(t, l)), a === B)
1819
- l[B] = !0;
1844
+ let l = s[B].get(t);
1845
+ if (l || (l = {}, s[B].set(t, l)), a === M)
1846
+ l[M] = !0;
1820
1847
  else {
1821
- let d = l[a];
1822
- d || (d = /* @__PURE__ */ new Set(), l[a] = d), d.add(u);
1848
+ let f = l[a];
1849
+ f || (f = /* @__PURE__ */ new Set(), l[a] = f), f.add(u);
1823
1850
  }
1824
1851
  }
1825
1852
  }, i = () => {
1826
- n = !0, s[O].delete(t);
1827
- }, o = {
1853
+ n = !0, s[B].delete(t);
1854
+ }, r = {
1828
1855
  get(a, u) {
1829
- return u === fe ? t : (r(me, u), ut(Reflect.get(a, u), s[O], s[it], s[at]));
1856
+ return u === pe ? t : (o(be, u), gt(Reflect.get(a, u), s[B], s[ft], s[ht]));
1830
1857
  },
1831
1858
  has(a, u) {
1832
- return u === Hs ? (i(), !0) : (r(he, u), Reflect.has(a, u));
1859
+ return u === Ks ? (i(), !0) : (o(ye, u), Reflect.has(a, u));
1833
1860
  },
1834
1861
  getOwnPropertyDescriptor(a, u) {
1835
- return r(ge, u), Reflect.getOwnPropertyDescriptor(a, u);
1862
+ return o(Te, u), Reflect.getOwnPropertyDescriptor(a, u);
1836
1863
  },
1837
1864
  ownKeys(a) {
1838
- return r(B), Reflect.ownKeys(a);
1865
+ return o(M), Reflect.ownKeys(a);
1839
1866
  }
1840
1867
  };
1841
- return e && (o.set = o.deleteProperty = () => !1), [o, s];
1842
- }, pe = (t) => (
1868
+ return e && (r.set = r.deleteProperty = () => !1), [r, s];
1869
+ }, Ee = (t) => (
1843
1870
  // unwrap proxy
1844
- t[fe] || // otherwise
1871
+ t[pe] || // otherwise
1845
1872
  t
1846
- ), ut = (t, e, s, n) => {
1847
- if (!ct(t))
1873
+ ), gt = (t, e, s, n) => {
1874
+ if (!mt(t))
1848
1875
  return t;
1849
- let r = n && n.get(t);
1850
- if (!r) {
1851
- const u = pe(t);
1852
- zs(u) ? r = [u, js(u)] : r = [u], n?.set(t, r);
1876
+ let o = n && n.get(t);
1877
+ if (!o) {
1878
+ const u = Ee(t);
1879
+ Vs(u) ? o = [u, Ys(u)] : o = [u], n?.set(t, o);
1853
1880
  }
1854
- const [i, o] = r;
1881
+ const [i, r] = o;
1855
1882
  let a = s && s.get(i);
1856
- return (!a || a[1][ot] !== !!o) && (a = qs(i, !!o), a[1][ke] = $s(o || i, a[0]), s && s.set(i, a)), a[1][O] = e, a[1][it] = s, a[1][at] = n, a[1][ke];
1857
- }, Ks = (t, e) => {
1883
+ return (!a || a[1][dt] !== !!r) && (a = Gs(i, !!r), a[1][Le] = Ws(r || i, a[0]), s && s.set(i, a)), a[1][B] = e, a[1][ft] = s, a[1][ht] = n, a[1][Le];
1884
+ }, Xs = (t, e) => {
1858
1885
  const s = Reflect.ownKeys(t), n = Reflect.ownKeys(e);
1859
- return s.length !== n.length || s.some((r, i) => r !== n[i]);
1860
- }, lt = (t, e, s, n, r = Object.is) => {
1861
- if (r(t, e))
1886
+ return s.length !== n.length || s.some((o, i) => o !== n[i]);
1887
+ }, pt = (t, e, s, n, o = Object.is) => {
1888
+ if (o(t, e))
1862
1889
  return !1;
1863
1890
  if (!z(t) || !z(e))
1864
1891
  return !0;
1865
- const i = s.get(pe(t));
1892
+ const i = s.get(Ee(t));
1866
1893
  if (!i)
1867
1894
  return !0;
1868
1895
  if (n) {
@@ -1870,274 +1897,274 @@ const re = Object.getPrototypeOf, oe = /* @__PURE__ */ new WeakMap(), ct = (t) =
1870
1897
  return !1;
1871
1898
  n.set(t, e);
1872
1899
  }
1873
- let o = null;
1874
- for (const a of i[he] || [])
1875
- if (o = Reflect.has(t, a) !== Reflect.has(e, a), o)
1876
- return o;
1877
- if (i[B] === !0) {
1878
- if (o = Ks(t, e), o)
1879
- return o;
1900
+ let r = null;
1901
+ for (const a of i[ye] || [])
1902
+ if (r = Reflect.has(t, a) !== Reflect.has(e, a), r)
1903
+ return r;
1904
+ if (i[M] === !0) {
1905
+ if (r = Xs(t, e), r)
1906
+ return r;
1880
1907
  } else
1881
- for (const a of i[ge] || []) {
1908
+ for (const a of i[Te] || []) {
1882
1909
  const u = !!Reflect.getOwnPropertyDescriptor(t, a), l = !!Reflect.getOwnPropertyDescriptor(e, a);
1883
- if (o = u !== l, o)
1884
- return o;
1910
+ if (r = u !== l, r)
1911
+ return r;
1885
1912
  }
1886
- for (const a of i[me] || [])
1887
- if (o = lt(t[a], e[a], s, n, r), o)
1888
- return o;
1889
- if (o === null)
1913
+ for (const a of i[be] || [])
1914
+ if (r = pt(t[a], e[a], s, n, o), r)
1915
+ return r;
1916
+ if (r === null)
1890
1917
  throw new Error("invalid used");
1891
- return o;
1892
- }, Ws = (t) => ct(t) && t[fe] || null, xe = (t, e = !0) => {
1893
- oe.set(t, e);
1894
- }, Vs = (t, e, s) => {
1895
- const n = [], r = /* @__PURE__ */ new WeakSet(), i = (o, a) => {
1896
- var u, l, d;
1897
- if (r.has(o))
1918
+ return r;
1919
+ }, Js = (t) => mt(t) && t[pe] || null, _e = (t, e = !0) => {
1920
+ ue.set(t, e);
1921
+ }, Zs = (t, e, s) => {
1922
+ const n = [], o = /* @__PURE__ */ new WeakSet(), i = (r, a) => {
1923
+ var u, l, f;
1924
+ if (o.has(r))
1898
1925
  return;
1899
- z(o) && r.add(o);
1900
- const T = z(o) && e.get(pe(o));
1901
- if (T) {
1902
- if ((u = T[he]) === null || u === void 0 || u.forEach((m) => {
1903
- const y = `:has(${String(m)})`;
1926
+ z(r) && o.add(r);
1927
+ const E = z(r) && e.get(Ee(r));
1928
+ if (E) {
1929
+ if ((u = E[ye]) === null || u === void 0 || u.forEach((h) => {
1930
+ const y = `:has(${String(h)})`;
1904
1931
  n.push(a ? [...a, y] : [y]);
1905
- }), T[B] === !0) {
1906
- const m = ":ownKeys";
1907
- n.push(a ? [...a, m] : [m]);
1932
+ }), E[M] === !0) {
1933
+ const h = ":ownKeys";
1934
+ n.push(a ? [...a, h] : [h]);
1908
1935
  } else
1909
- (l = T[ge]) === null || l === void 0 || l.forEach((m) => {
1910
- const y = `:hasOwn(${String(m)})`;
1936
+ (l = E[Te]) === null || l === void 0 || l.forEach((h) => {
1937
+ const y = `:hasOwn(${String(h)})`;
1911
1938
  n.push(a ? [...a, y] : [y]);
1912
1939
  });
1913
- (d = T[me]) === null || d === void 0 || d.forEach((m) => {
1914
- "value" in (Object.getOwnPropertyDescriptor(o, m) || {}) && i(o[m], a ? [...a, m] : [m]);
1940
+ (f = E[be]) === null || f === void 0 || f.forEach((h) => {
1941
+ "value" in (Object.getOwnPropertyDescriptor(r, h) || {}) && i(r[h], a ? [...a, h] : [h]);
1915
1942
  });
1916
1943
  } else a && n.push(a);
1917
1944
  };
1918
1945
  return i(t), n;
1919
- }, j = {}, ye = (t) => typeof t == "object" && t !== null, Ys = (t) => ye(t) && !be.has(t) && (Array.isArray(t) || !(Symbol.iterator in t)) && !(t instanceof WeakMap) && !(t instanceof WeakSet) && !(t instanceof Error) && !(t instanceof Number) && !(t instanceof Date) && !(t instanceof String) && !(t instanceof RegExp) && !(t instanceof ArrayBuffer) && !(t instanceof Promise), dt = (t, e) => {
1920
- const s = Ne.get(t);
1946
+ }, q = {}, Se = (t) => typeof t == "object" && t !== null, Qs = (t) => Se(t) && !we.has(t) && (Array.isArray(t) || !(Symbol.iterator in t)) && !(t instanceof WeakMap) && !(t instanceof WeakSet) && !(t instanceof Error) && !(t instanceof Number) && !(t instanceof Date) && !(t instanceof String) && !(t instanceof RegExp) && !(t instanceof ArrayBuffer) && !(t instanceof Promise), yt = (t, e) => {
1947
+ const s = Fe.get(t);
1921
1948
  if (s?.[0] === e)
1922
1949
  return s[1];
1923
1950
  const n = Array.isArray(t) ? [] : Object.create(Object.getPrototypeOf(t));
1924
- return xe(n, !0), Ne.set(t, [e, n]), Reflect.ownKeys(t).forEach((r) => {
1925
- if (Object.getOwnPropertyDescriptor(n, r))
1951
+ return _e(n, !0), Fe.set(t, [e, n]), Reflect.ownKeys(t).forEach((o) => {
1952
+ if (Object.getOwnPropertyDescriptor(n, o))
1926
1953
  return;
1927
- const i = Reflect.get(t, r), { enumerable: o } = Reflect.getOwnPropertyDescriptor(
1954
+ const i = Reflect.get(t, o), { enumerable: r } = Reflect.getOwnPropertyDescriptor(
1928
1955
  t,
1929
- r
1956
+ o
1930
1957
  ), a = {
1931
1958
  value: i,
1932
- enumerable: o,
1959
+ enumerable: r,
1933
1960
  // This is intentional to avoid copying with proxy-compare.
1934
1961
  // It's still non-writable, so it avoids assigning a value.
1935
1962
  configurable: !0
1936
1963
  };
1937
- if (be.has(i))
1938
- xe(i, !1);
1939
- else if (k.has(i)) {
1940
- const [u, l] = k.get(
1964
+ if (we.has(i))
1965
+ _e(i, !1);
1966
+ else if (N.has(i)) {
1967
+ const [u, l] = N.get(
1941
1968
  i
1942
1969
  );
1943
- a.value = dt(u, l());
1970
+ a.value = yt(u, l());
1944
1971
  }
1945
- Object.defineProperty(n, r, a);
1972
+ Object.defineProperty(n, o, a);
1946
1973
  }), Object.preventExtensions(n);
1947
- }, Gs = (t, e, s, n) => ({
1948
- deleteProperty(r, i) {
1949
- const o = Reflect.get(r, i);
1974
+ }, en = (t, e, s, n) => ({
1975
+ deleteProperty(o, i) {
1976
+ const r = Reflect.get(o, i);
1950
1977
  s(i);
1951
- const a = Reflect.deleteProperty(r, i);
1952
- return a && n(["delete", [i], o]), a;
1978
+ const a = Reflect.deleteProperty(o, i);
1979
+ return a && n(["delete", [i], r]), a;
1953
1980
  },
1954
- set(r, i, o, a) {
1955
- const u = !t() && Reflect.has(r, i), l = Reflect.get(r, i, a);
1956
- if (u && (Oe(l, o) || q.has(o) && Oe(l, q.get(o))))
1981
+ set(o, i, r, a) {
1982
+ const u = !t() && Reflect.has(o, i), l = Reflect.get(o, i, a);
1983
+ if (u && (He(l, r) || K.has(r) && He(l, K.get(r))))
1957
1984
  return !0;
1958
- s(i), ye(o) && (o = Ws(o) || o);
1959
- const d = !k.has(o) && Js(o) ? ft(o) : o;
1960
- return e(i, d), Reflect.set(r, i, d, a), n(["set", [i], o, l]), !0;
1961
- }
1962
- }), k = /* @__PURE__ */ new WeakMap(), be = /* @__PURE__ */ new WeakSet(), Ne = /* @__PURE__ */ new WeakMap(), Q = [1], q = /* @__PURE__ */ new WeakMap();
1963
- let Oe = Object.is, Xs = (t, e) => new Proxy(t, e), Js = Ys, Zs = dt, Qs = Gs;
1964
- function ft(t = {}) {
1965
- if (!ye(t))
1985
+ s(i), Se(r) && (r = Js(r) || r);
1986
+ const f = !N.has(r) && sn(r) ? Tt(r) : r;
1987
+ return e(i, f), Reflect.set(o, i, f, a), n(["set", [i], r, l]), !0;
1988
+ }
1989
+ }), N = /* @__PURE__ */ new WeakMap(), we = /* @__PURE__ */ new WeakSet(), Fe = /* @__PURE__ */ new WeakMap(), ne = [1], K = /* @__PURE__ */ new WeakMap();
1990
+ let He = Object.is, tn = (t, e) => new Proxy(t, e), sn = Qs, nn = yt, on = en;
1991
+ function Tt(t = {}) {
1992
+ if (!Se(t))
1966
1993
  throw new Error("object required");
1967
- const e = q.get(t);
1994
+ const e = K.get(t);
1968
1995
  if (e)
1969
1996
  return e;
1970
- let s = Q[0];
1971
- const n = /* @__PURE__ */ new Set(), r = (f, E = ++Q[0]) => {
1972
- s !== E && (i = s = E, n.forEach((h) => h(f, E)));
1997
+ let s = ne[0];
1998
+ const n = /* @__PURE__ */ new Set(), o = (g, T = ++ne[0]) => {
1999
+ s !== T && (i = s = T, n.forEach((m) => m(g, T)));
1973
2000
  };
1974
2001
  let i = s;
1975
- const o = (f = Q[0]) => (i !== f && (i = f, u.forEach(([E]) => {
1976
- const h = E[1](f);
1977
- h > s && (s = h);
1978
- })), s), a = (f) => (E, h) => {
1979
- const C = [...E];
1980
- C[1] = [f, ...C[1]], r(C, h);
1981
- }, u = /* @__PURE__ */ new Map(), l = (f, E) => {
1982
- const h = !be.has(E) && k.get(E);
1983
- if (h) {
1984
- if ((j ? "production" : void 0) !== "production" && u.has(f))
2002
+ const r = (g = ne[0]) => (i !== g && (i = g, u.forEach(([T]) => {
2003
+ const m = T[1](g);
2004
+ m > s && (s = m);
2005
+ })), s), a = (g) => (T, m) => {
2006
+ const A = [...T];
2007
+ A[1] = [g, ...A[1]], o(A, m);
2008
+ }, u = /* @__PURE__ */ new Map(), l = (g, T) => {
2009
+ const m = !we.has(T) && N.get(T);
2010
+ if (m) {
2011
+ if ((q ? "production" : void 0) !== "production" && u.has(g))
1985
2012
  throw new Error("prop listener already exists");
1986
2013
  if (n.size) {
1987
- const C = h[2](a(f));
1988
- u.set(f, [h, C]);
2014
+ const A = m[2](a(g));
2015
+ u.set(g, [m, A]);
1989
2016
  } else
1990
- u.set(f, [h]);
2017
+ u.set(g, [m]);
1991
2018
  }
1992
- }, d = (f) => {
1993
- var E;
1994
- const h = u.get(f);
1995
- h && (u.delete(f), (E = h[1]) == null || E.call(h));
1996
- }, T = (f) => (n.add(f), n.size === 1 && u.forEach(([h, C], I) => {
1997
- if ((j ? "production" : void 0) !== "production" && C)
2019
+ }, f = (g) => {
2020
+ var T;
2021
+ const m = u.get(g);
2022
+ m && (u.delete(g), (T = m[1]) == null || T.call(m));
2023
+ }, E = (g) => (n.add(g), n.size === 1 && u.forEach(([m, A], C) => {
2024
+ if ((q ? "production" : void 0) !== "production" && A)
1998
2025
  throw new Error("remove already exists");
1999
- const ht = h[2](a(I));
2000
- u.set(I, [h, ht]);
2026
+ const D = m[2](a(C));
2027
+ u.set(C, [m, D]);
2001
2028
  }), () => {
2002
- n.delete(f), n.size === 0 && u.forEach(([h, C], I) => {
2003
- C && (C(), u.set(I, [h]));
2029
+ n.delete(g), n.size === 0 && u.forEach(([m, A], C) => {
2030
+ A && (A(), u.set(C, [m]));
2004
2031
  });
2005
2032
  });
2006
- let m = !0;
2007
- const y = Qs(
2008
- () => m,
2033
+ let h = !0;
2034
+ const y = on(
2035
+ () => h,
2009
2036
  l,
2010
- d,
2011
- r
2012
- ), R = Xs(t, y);
2013
- q.set(t, R);
2014
- const W = [t, o, T];
2015
- return k.set(R, W), Reflect.ownKeys(t).forEach((f) => {
2016
- const E = Object.getOwnPropertyDescriptor(
2037
+ f,
2038
+ o
2039
+ ), R = tn(t, y);
2040
+ K.set(t, R);
2041
+ const V = [t, r, E];
2042
+ return N.set(R, V), Reflect.ownKeys(t).forEach((g) => {
2043
+ const T = Object.getOwnPropertyDescriptor(
2017
2044
  t,
2018
- f
2045
+ g
2019
2046
  );
2020
- "value" in E && E.writable && (R[f] = t[f]);
2021
- }), m = !1, R;
2022
- }
2023
- function en(t, e, s) {
2024
- const n = k.get(t);
2025
- (j ? "production" : void 0) !== "production" && !n && console.warn("Please use proxy object");
2026
- let r;
2027
- const i = [], o = n[2];
2047
+ "value" in T && T.writable && (R[g] = t[g]);
2048
+ }), h = !1, R;
2049
+ }
2050
+ function rn(t, e, s) {
2051
+ const n = N.get(t);
2052
+ (q ? "production" : void 0) !== "production" && !n && console.warn("Please use proxy object");
2053
+ let o;
2054
+ const i = [], r = n[2];
2028
2055
  let a = !1;
2029
- const l = o((d) => {
2030
- i.push(d), r || (r = Promise.resolve().then(() => {
2031
- r = void 0, a && e(i.splice(0));
2056
+ const l = r((f) => {
2057
+ i.push(f), o || (o = Promise.resolve().then(() => {
2058
+ o = void 0, a && e(i.splice(0));
2032
2059
  }));
2033
2060
  });
2034
2061
  return a = !0, () => {
2035
2062
  a = !1, l();
2036
2063
  };
2037
2064
  }
2038
- function Be(t) {
2039
- const e = k.get(t);
2040
- (j ? "production" : void 0) !== "production" && !e && console.warn("Please use proxy object");
2065
+ function $e(t) {
2066
+ const e = N.get(t);
2067
+ (q ? "production" : void 0) !== "production" && !e && console.warn("Please use proxy object");
2041
2068
  const [s, n] = e;
2042
- return Zs(s, n());
2069
+ return nn(s, n());
2043
2070
  }
2044
- const tn = {}, sn = (t, e) => {
2045
- const s = ie(void 0);
2071
+ const an = {}, cn = (t, e) => {
2072
+ const s = le(void 0);
2046
2073
  x(() => {
2047
- s.current = Vs(t, e);
2048
- }), yt(s.current);
2049
- }, nn = sn, rn = /* @__PURE__ */ new WeakMap();
2050
- function on(t, e) {
2051
- const n = Ee(
2074
+ s.current = Zs(t, e);
2075
+ }), wt(s.current);
2076
+ }, un = cn, ln = /* @__PURE__ */ new WeakMap();
2077
+ function dn(t, e) {
2078
+ const n = Ce(
2052
2079
  () => t && /* @__PURE__ */ new WeakMap(),
2053
2080
  [t]
2054
- ), r = ie(void 0);
2081
+ ), o = le(void 0);
2055
2082
  let i = !0;
2056
- const o = gt(
2057
- mt(
2083
+ const r = bt(
2084
+ Et(
2058
2085
  (u) => {
2059
- const l = en(t, u);
2086
+ const l = rn(t, u);
2060
2087
  return u(), l;
2061
2088
  },
2062
2089
  [t, void 0]
2063
2090
  ),
2064
2091
  () => {
2065
- const u = Be(t);
2092
+ const u = $e(t);
2066
2093
  try {
2067
- if (!i && r.current && !lt(
2068
- r.current,
2094
+ if (!i && o.current && !pt(
2095
+ o.current,
2069
2096
  u,
2070
2097
  n,
2071
2098
  /* @__PURE__ */ new WeakMap()
2072
2099
  ))
2073
- return r.current;
2100
+ return o.current;
2074
2101
  } catch {
2075
2102
  }
2076
2103
  return u;
2077
2104
  },
2078
- () => Be(t)
2105
+ () => $e(t)
2079
2106
  );
2080
- i = !1, pt(() => {
2081
- r.current = o;
2082
- }), (tn ? "production" : void 0) !== "production" && nn(o, n);
2083
- const a = Ee(() => /* @__PURE__ */ new WeakMap(), []);
2084
- return ut(o, n, a, rn);
2107
+ i = !1, St(() => {
2108
+ o.current = r;
2109
+ }), (an ? "production" : void 0) !== "production" && un(r, n);
2110
+ const a = Ce(() => /* @__PURE__ */ new WeakMap(), []);
2111
+ return gt(r, n, a, ln);
2085
2112
  }
2086
- const D = ft({
2113
+ const v = Tt({
2087
2114
  data: null,
2088
2115
  isPending: !1,
2089
2116
  error: null
2090
2117
  });
2091
- function fn({
2118
+ function yn({
2092
2119
  session_url: t,
2093
2120
  onCancel: e,
2094
2121
  onSuccess: s
2095
2122
  }) {
2096
- const n = on(D), [r, i] = v(!1), [o, a] = v(Date.now()), u = n?.data?.sessionToken, l = n?.data?.amount;
2097
- function d() {
2123
+ const n = dn(v), [o, i] = k(!1), [r, a] = k(Date.now()), u = n?.data?.sessionToken, l = n?.data?.amount;
2124
+ function f() {
2098
2125
  u || window.setTimeout(() => {
2099
2126
  u && i(!0);
2100
2127
  }, 200), i(!0);
2101
2128
  }
2102
- function T() {
2129
+ function E() {
2103
2130
  i(!1);
2104
2131
  }
2105
- const m = () => {
2132
+ const h = () => {
2106
2133
  const y = Date.now();
2107
- D.isPending = !0, D.error = null, D.data = null, fetch(t, {
2134
+ v.isPending = !0, v.error = null, v.data = null, fetch(t, {
2108
2135
  headers: {
2109
2136
  "Content-Type": "application/json"
2110
2137
  }
2111
2138
  }).then((R) => R.json()).then((R) => {
2112
- y < o || (D.data = R, D.isPending = !1, a(y));
2139
+ y < r || (v.data = R, v.isPending = !1, a(y));
2113
2140
  }).catch((R) => {
2114
- y < o || (D.error = R?.toString(), D.isPending = !1, a(y), setInterval(m, 5e3));
2141
+ y < r || (v.error = R?.toString(), v.isPending = !1, a(y), setInterval(h, 5e3));
2115
2142
  });
2116
2143
  };
2117
2144
  return x(() => {
2118
- m();
2145
+ h();
2119
2146
  }, [t]), {
2120
2147
  sessionToken: u,
2121
2148
  amount: l,
2122
- isOpen: r,
2149
+ isOpen: o,
2123
2150
  session_url: t,
2124
- open: d,
2125
- close: T,
2151
+ open: f,
2152
+ close: E,
2126
2153
  isPending: n.isPending,
2127
2154
  error: n.error,
2128
- refetch: m,
2155
+ refetch: h,
2129
2156
  onSuccess: s,
2130
2157
  onCancel: e
2131
2158
  };
2132
2159
  }
2133
- function hn({
2160
+ function Tn({
2134
2161
  sessionToken: t,
2135
2162
  amount: e,
2136
2163
  onCancel: s,
2137
2164
  onSuccess: n
2138
2165
  }) {
2139
- const [r, i] = v(!1), [o, a] = v(t), [u, l] = v(e);
2140
- function d({
2166
+ const [o, i] = k(!1), [r, a] = k(t), [u, l] = k(e);
2167
+ function f({
2141
2168
  sessionToken: y,
2142
2169
  amount: R
2143
2170
  }) {
@@ -2146,31 +2173,31 @@ function hn({
2146
2173
  x(() => {
2147
2174
  a(t);
2148
2175
  }, [t]);
2149
- function T() {
2150
- o || window.setTimeout(() => {
2151
- o && i(!0);
2176
+ function E() {
2177
+ r || window.setTimeout(() => {
2178
+ r && i(!0);
2152
2179
  }, 200), i(!0);
2153
2180
  }
2154
- function m() {
2181
+ function h() {
2155
2182
  i(!1);
2156
2183
  }
2157
2184
  return {
2158
- sessionToken: o,
2159
- updateSession: d,
2185
+ sessionToken: r,
2186
+ updateSession: f,
2160
2187
  amount: u,
2161
- isOpen: r,
2162
- open: T,
2163
- close: m,
2188
+ isOpen: o,
2189
+ open: E,
2190
+ close: h,
2164
2191
  onSuccess: n,
2165
2192
  onCancel: s
2166
2193
  };
2167
2194
  }
2168
2195
  export {
2169
2196
  c as AmountSymbols,
2170
- g as Chainrails,
2171
- un as Chains,
2172
- dn as PaymentModal,
2173
- ln as crapi,
2174
- hn as usePaymentModal,
2175
- fn as usePaymentSession
2197
+ d as Chainrails,
2198
+ mn as Chains,
2199
+ pn as PaymentModal,
2200
+ gn as crapi,
2201
+ Tn as usePaymentModal,
2202
+ yn as usePaymentSession
2176
2203
  };