@chainrails/react 0.3.1 → 0.3.3
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,6 +1,6 @@
|
|
|
1
|
-
import { useState as
|
|
2
|
-
import { jsxs as
|
|
3
|
-
import './index.css';class
|
|
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;
|
|
@@ -9,7 +9,7 @@ import './index.css';class ee extends 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
|
|
12
|
+
class je extends Error {
|
|
13
13
|
name = "NonError";
|
|
14
14
|
value;
|
|
15
15
|
constructor(e) {
|
|
@@ -21,17 +21,17 @@ class Le extends Error {
|
|
|
21
21
|
super(s), this.value = e;
|
|
22
22
|
}
|
|
23
23
|
}
|
|
24
|
-
class
|
|
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
|
|
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
|
|
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)
|
|
@@ -50,7 +50,7 @@ const Se = (() => {
|
|
|
50
50
|
throw o;
|
|
51
51
|
}
|
|
52
52
|
return t && !e;
|
|
53
|
-
})(),
|
|
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
|
-
},
|
|
63
|
-
class
|
|
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
|
|
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 Ct = (t) => new $e(t), At = {
|
|
|
80
80
|
onUploadProgress: !0,
|
|
81
81
|
fetch: !0,
|
|
82
82
|
context: !0
|
|
83
|
-
},
|
|
83
|
+
}, It = {
|
|
84
84
|
next: !0
|
|
85
85
|
// Next.js cache revalidation (revalidate, tags)
|
|
86
|
-
},
|
|
86
|
+
}, Pt = {
|
|
87
87
|
method: !0,
|
|
88
88
|
headers: !0,
|
|
89
89
|
body: !0,
|
|
@@ -98,13 +98,13 @@ const Ct = (t) => new $e(t), At = {
|
|
|
98
98
|
signal: !0,
|
|
99
99
|
window: !0,
|
|
100
100
|
duplex: !0
|
|
101
|
-
},
|
|
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 +=
|
|
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,7 +125,7 @@ const Ct = (t) => new $e(t), At = {
|
|
|
125
125
|
return 0;
|
|
126
126
|
}
|
|
127
127
|
return 0;
|
|
128
|
-
},
|
|
128
|
+
}, Ve = (t, e, s) => {
|
|
129
129
|
let n, o = 0;
|
|
130
130
|
return t.pipeThrough(new TransformStream({
|
|
131
131
|
transform(i, r) {
|
|
@@ -140,7 +140,7 @@ const Ct = (t) => new $e(t), At = {
|
|
|
140
140
|
n && (o += n.byteLength, s?.({ percent: 1, totalBytes: Math.max(e, o), transferredBytes: o }, n));
|
|
141
141
|
}
|
|
142
142
|
}));
|
|
143
|
-
},
|
|
143
|
+
}, Nt = (t, e) => {
|
|
144
144
|
if (!t.body)
|
|
145
145
|
return t;
|
|
146
146
|
if (t.status === 204)
|
|
@@ -150,40 +150,40 @@ const Ct = (t) => new $e(t), At = {
|
|
|
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(
|
|
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
|
-
},
|
|
158
|
+
}, Ot = (t, e, s) => {
|
|
159
159
|
if (!t.body)
|
|
160
160
|
return t;
|
|
161
|
-
const n =
|
|
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:
|
|
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
|
-
if ((!
|
|
169
|
+
if ((!P(e) || Array.isArray(e)) && e !== void 0)
|
|
170
170
|
throw new TypeError("The `options` argument must be an object");
|
|
171
|
-
return
|
|
172
|
-
},
|
|
171
|
+
return de({}, ...t);
|
|
172
|
+
}, Ye = (t = {}, e = {}) => {
|
|
173
173
|
const s = new globalThis.Headers(t), n = e instanceof globalThis.Headers, o = new globalThis.Headers(e);
|
|
174
174
|
for (const [i, r] of o.entries())
|
|
175
175
|
n && r === "undefined" || r === void 0 ? s.delete(i) : s.set(i, r);
|
|
176
176
|
return s;
|
|
177
177
|
};
|
|
178
|
-
function
|
|
179
|
-
return Object.hasOwn(e, s) && e[s] === void 0 ? [] :
|
|
180
|
-
}
|
|
181
|
-
const
|
|
182
|
-
beforeRequest:
|
|
183
|
-
beforeRetry:
|
|
184
|
-
afterResponse:
|
|
185
|
-
beforeError:
|
|
186
|
-
}),
|
|
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)
|
|
@@ -196,7 +196,7 @@ const qe = (t = {}, e = {}) => ({
|
|
|
196
196
|
throw new TypeError("Array search parameters must be provided in [[key, value], ...] format");
|
|
197
197
|
s.append(String(o[0]), String(o[1]));
|
|
198
198
|
}
|
|
199
|
-
else if (
|
|
199
|
+
else if (P(n))
|
|
200
200
|
for (const [o, i] of Object.entries(n))
|
|
201
201
|
i !== void 0 && s.append(o, String(i));
|
|
202
202
|
else {
|
|
@@ -205,20 +205,20 @@ const qe = (t = {}, e = {}) => ({
|
|
|
205
205
|
s.append(i, r);
|
|
206
206
|
}
|
|
207
207
|
return s;
|
|
208
|
-
},
|
|
208
|
+
}, de = (...t) => {
|
|
209
209
|
let e = {}, s = {}, n = {}, o;
|
|
210
210
|
const i = [];
|
|
211
211
|
for (const r of t)
|
|
212
212
|
if (Array.isArray(r))
|
|
213
213
|
Array.isArray(e) || (e = []), e = [...e, ...r];
|
|
214
|
-
else if (
|
|
214
|
+
else if (P(r)) {
|
|
215
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;
|
|
219
219
|
}
|
|
220
220
|
if (a === "context") {
|
|
221
|
-
if (u != null && (!
|
|
221
|
+
if (u != null && (!P(u) || Array.isArray(u)))
|
|
222
222
|
throw new TypeError("The `context` option must be an object");
|
|
223
223
|
e = {
|
|
224
224
|
...e,
|
|
@@ -227,28 +227,28 @@ const qe = (t = {}, e = {}) => ({
|
|
|
227
227
|
continue;
|
|
228
228
|
}
|
|
229
229
|
if (a === "searchParams") {
|
|
230
|
-
u == null ? o = void 0 : o = o === void 0 ? u :
|
|
230
|
+
u == null ? o = void 0 : o = o === void 0 ? u : Bt(o, u);
|
|
231
231
|
continue;
|
|
232
232
|
}
|
|
233
|
-
|
|
233
|
+
P(u) && a in e && (u = de(e[a], u)), e = { ...e, [a]: u };
|
|
234
234
|
}
|
|
235
|
-
|
|
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 o !== void 0 && (e.searchParams = o), i.length > 0 && (i.length === 1 ? e.signal = i[0] :
|
|
238
|
-
},
|
|
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:
|
|
241
|
-
statusCodes:
|
|
242
|
-
afterStatusCodes:
|
|
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
|
-
},
|
|
248
|
+
}, Ht = (t = {}) => {
|
|
249
249
|
if (typeof t == "number")
|
|
250
250
|
return {
|
|
251
|
-
...
|
|
251
|
+
...Ue,
|
|
252
252
|
limit: t
|
|
253
253
|
};
|
|
254
254
|
if (t.methods && !Array.isArray(t.methods))
|
|
@@ -256,27 +256,27 @@ const qe = (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
|
-
...
|
|
259
|
+
...Ue,
|
|
260
260
|
...t
|
|
261
261
|
};
|
|
262
262
|
};
|
|
263
|
-
class
|
|
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
|
|
269
|
+
async function $t(t, e, s, n) {
|
|
270
270
|
return new Promise((o, i) => {
|
|
271
271
|
const r = setTimeout(() => {
|
|
272
|
-
s && s.abort(), i(new
|
|
272
|
+
s && s.abort(), i(new re(t));
|
|
273
273
|
}, n.timeout);
|
|
274
274
|
n.fetch(t, e).then(o).catch(i).then(() => {
|
|
275
275
|
clearTimeout(r);
|
|
276
276
|
});
|
|
277
277
|
});
|
|
278
278
|
}
|
|
279
|
-
async function
|
|
279
|
+
async function jt(t, { signal: e }) {
|
|
280
280
|
return new Promise((s, n) => {
|
|
281
281
|
e && (e.throwIfAborted(), e.addEventListener("abort", o, { once: !0 }));
|
|
282
282
|
function o() {
|
|
@@ -287,35 +287,35 @@ async function Ft(t, { signal: e }) {
|
|
|
287
287
|
}, t);
|
|
288
288
|
});
|
|
289
289
|
}
|
|
290
|
-
const
|
|
290
|
+
const zt = (t, e) => {
|
|
291
291
|
const s = {};
|
|
292
292
|
for (const n in e)
|
|
293
|
-
Object.hasOwn(e, n) && !(n in
|
|
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
|
-
},
|
|
296
|
-
function
|
|
297
|
-
return t instanceof
|
|
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
|
|
300
|
-
return t instanceof
|
|
299
|
+
function Wt(t) {
|
|
300
|
+
return t instanceof re || t?.name === re.name;
|
|
301
301
|
}
|
|
302
|
-
class
|
|
302
|
+
class L {
|
|
303
303
|
static create(e, s) {
|
|
304
|
-
const n = new
|
|
305
|
-
if (typeof n.#e.timeout == "number" && n.#e.timeout >
|
|
306
|
-
throw new RangeError(`The \`timeout\` option cannot be greater than ${
|
|
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 r = await n.#
|
|
308
|
+
let r = await n.#g();
|
|
309
309
|
for (const a of n.#e.hooks.afterResponse) {
|
|
310
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
|
|
311
|
+
if (l instanceof globalThis.Response && (r = l), l instanceof We)
|
|
312
312
|
throw await Promise.all([
|
|
313
313
|
u.body?.cancel(),
|
|
314
314
|
r.body?.cancel()
|
|
315
|
-
]), new
|
|
315
|
+
]), new J(l.options);
|
|
316
316
|
}
|
|
317
317
|
if (n.#l(r), !r.ok && (typeof n.#e.throwHttpErrors == "function" ? n.#e.throwHttpErrors(r.status) : n.#e.throwHttpErrors)) {
|
|
318
|
-
let a = new
|
|
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,16 +323,16 @@ 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 (!
|
|
326
|
+
if (!Ct)
|
|
327
327
|
throw new Error("Streams are not supported in your environment. `ReadableStream` is missing.");
|
|
328
|
-
return
|
|
328
|
+
return Nt(r.clone(), n.#e.onDownloadProgress);
|
|
329
329
|
}
|
|
330
330
|
return r;
|
|
331
331
|
}, i = n.#d(o).finally(async () => {
|
|
332
332
|
const r = n.#r, a = [];
|
|
333
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 [r, a] of Object.entries(
|
|
335
|
+
for (const [r, a] of Object.entries(Dt))
|
|
336
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;
|
|
@@ -363,17 +363,17 @@ class M {
|
|
|
363
363
|
constructor(e, s = {}) {
|
|
364
364
|
if (this.#t = e, this.#e = {
|
|
365
365
|
...s,
|
|
366
|
-
headers:
|
|
367
|
-
hooks:
|
|
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:
|
|
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:
|
|
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
|
-
|
|
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 && (
|
|
391
|
-
const i = "?" + (typeof this.#e.searchParams == "string" ? this.#e.searchParams.replace(/^\?/, "") : new URLSearchParams(
|
|
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
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 (!
|
|
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 #
|
|
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
|
|
411
|
-
if (s instanceof
|
|
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,9 +419,9 @@ class M {
|
|
|
419
419
|
if (n === !0)
|
|
420
420
|
return this.#c();
|
|
421
421
|
}
|
|
422
|
-
if (
|
|
422
|
+
if (Wt(e) && !this.#e.retry.retryOnTimeout)
|
|
423
423
|
throw e;
|
|
424
|
-
if (
|
|
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");
|
|
@@ -443,10 +443,10 @@ class M {
|
|
|
443
443
|
try {
|
|
444
444
|
return await e();
|
|
445
445
|
} catch (s) {
|
|
446
|
-
const n = Math.min(await this.#
|
|
446
|
+
const n = Math.min(await this.#m(s), Z);
|
|
447
447
|
if (this.#s < 1)
|
|
448
448
|
throw s;
|
|
449
|
-
if (await
|
|
449
|
+
if (await jt(n, this.#o ? { signal: this.#o } : {}), s instanceof J && s.customRequest) {
|
|
450
450
|
const o = this.#e.signal ? new globalThis.Request(s.customRequest, { signal: this.#e.signal }) : new globalThis.Request(s.customRequest);
|
|
451
451
|
this.#u(o);
|
|
452
452
|
}
|
|
@@ -463,13 +463,13 @@ class M {
|
|
|
463
463
|
}
|
|
464
464
|
if (i instanceof globalThis.Response)
|
|
465
465
|
return i;
|
|
466
|
-
if (i ===
|
|
466
|
+
if (i === Ke)
|
|
467
467
|
return;
|
|
468
468
|
}
|
|
469
469
|
return this.#d(e);
|
|
470
470
|
}
|
|
471
471
|
}
|
|
472
|
-
async #
|
|
472
|
+
async #g() {
|
|
473
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 });
|
|
@@ -480,8 +480,8 @@ class M {
|
|
|
480
480
|
break;
|
|
481
481
|
}
|
|
482
482
|
}
|
|
483
|
-
const e =
|
|
484
|
-
return this.#r = this.request, this.request = this.#r.clone(), this.#e.timeout === !1 ? this.#e.fetch(this.#r, 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 :
|
|
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
|
|
502
|
-
const e = (s, n) =>
|
|
503
|
-
for (const s of
|
|
504
|
-
e[s] = (n, o) =>
|
|
505
|
-
return e.create = (s) =>
|
|
506
|
-
},
|
|
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
|
-
},
|
|
525
|
+
}, mn = {
|
|
526
526
|
ARBITRUM: "ARBITRUM",
|
|
527
527
|
ARBITRUM_TESTNET: "ARBITRUM_TESTNET",
|
|
528
528
|
AVALANCHE: "AVALANCHE",
|
|
@@ -542,26 +542,26 @@ const se = (t) => {
|
|
|
542
542
|
STARKNET: "STARKNET",
|
|
543
543
|
STARKNET_TESTNET: "STARKNET_TESTNET"
|
|
544
544
|
};
|
|
545
|
-
function
|
|
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
|
|
549
|
-
return
|
|
548
|
+
function ve(t) {
|
|
549
|
+
return fe(t, { strict: !1 }) ? Math.ceil((t.length - 2) / 2) : t.length;
|
|
550
550
|
}
|
|
551
|
-
const
|
|
552
|
-
let
|
|
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@${
|
|
554
|
+
version: `viem@${Xe}`
|
|
555
555
|
};
|
|
556
|
-
class
|
|
556
|
+
class I extends Error {
|
|
557
557
|
constructor(e, s = {}) {
|
|
558
|
-
const n = s.cause instanceof
|
|
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
|
-
...
|
|
564
|
+
...Q.version ? [`Version: ${Q.version}`] : []
|
|
565
565
|
].join(`
|
|
566
566
|
`);
|
|
567
567
|
super(r, s.cause ? { cause: s.cause } : void 0), Object.defineProperty(this, "details", {
|
|
@@ -594,40 +594,40 @@ class U extends Error {
|
|
|
594
594
|
configurable: !0,
|
|
595
595
|
writable: !0,
|
|
596
596
|
value: "BaseError"
|
|
597
|
-
}), this.details = n, this.docsPath = o, this.metaMessages = s.metaMessages, this.name = s.name ?? this.name, this.shortMessage = e, this.version =
|
|
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
|
|
600
|
+
return Je(this, e);
|
|
601
601
|
}
|
|
602
602
|
}
|
|
603
|
-
function
|
|
604
|
-
return e?.(t) ? t : t && typeof t == "object" && "cause" in t && t.cause !== void 0 ?
|
|
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
|
|
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
|
|
612
|
-
return typeof t == "string" ?
|
|
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
|
|
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
|
|
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
|
|
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
|
|
630
|
+
throw new Ze({
|
|
631
631
|
size: t.length,
|
|
632
632
|
targetSize: s,
|
|
633
633
|
type: "bytes"
|
|
@@ -639,31 +639,31 @@ function Kt(t, { dir: e, size: s = 32 } = {}) {
|
|
|
639
639
|
}
|
|
640
640
|
return n;
|
|
641
641
|
}
|
|
642
|
-
class
|
|
642
|
+
class Xt extends I {
|
|
643
643
|
constructor({ max: e, min: s, signed: n, size: o, value: i }) {
|
|
644
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
|
|
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
|
|
653
|
-
if (
|
|
654
|
-
throw new
|
|
655
|
-
givenSize:
|
|
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
|
|
659
|
+
function Zt(t, e = {}) {
|
|
660
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
663
|
const r = typeof i == "bigint" && s ? -i - 1n : 0;
|
|
664
664
|
if (i && o > i || o < r) {
|
|
665
665
|
const u = typeof t == "bigint" ? "n" : "";
|
|
666
|
-
throw new
|
|
666
|
+
throw new Xt({
|
|
667
667
|
max: i ? `${i}${u}` : void 0,
|
|
668
668
|
min: `${r}${u}`,
|
|
669
669
|
signed: s,
|
|
@@ -672,17 +672,17 @@ function Yt(t, e = {}) {
|
|
|
672
672
|
});
|
|
673
673
|
}
|
|
674
674
|
const a = `0x${(s && o < 0 ? (1n << BigInt(n * 8)) + BigInt(o) : o).toString(16)}`;
|
|
675
|
-
return n ?
|
|
675
|
+
return n ? W(a, { size: n }) : a;
|
|
676
676
|
}
|
|
677
|
-
const
|
|
678
|
-
function
|
|
679
|
-
return typeof t == "number" || typeof t == "bigint" ?
|
|
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
|
|
681
|
+
function ts(t, e = {}) {
|
|
682
682
|
const s = new Uint8Array(1);
|
|
683
|
-
return s[0] = Number(t), typeof e.size == "number" ? (
|
|
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
|
|
685
|
+
const U = {
|
|
686
686
|
zero: 48,
|
|
687
687
|
nine: 57,
|
|
688
688
|
A: 65,
|
|
@@ -690,130 +690,130 @@ const A = {
|
|
|
690
690
|
a: 97,
|
|
691
691
|
f: 102
|
|
692
692
|
};
|
|
693
|
-
function
|
|
694
|
-
if (t >=
|
|
695
|
-
return t -
|
|
696
|
-
if (t >=
|
|
697
|
-
return t - (
|
|
698
|
-
if (t >=
|
|
699
|
-
return t - (
|
|
700
|
-
}
|
|
701
|
-
function
|
|
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 && (
|
|
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
706
|
const o = n.length / 2, i = new Uint8Array(o);
|
|
707
707
|
for (let r = 0, a = 0; r < o; r++) {
|
|
708
|
-
const u =
|
|
708
|
+
const u = ke(n.charCodeAt(a++)), l = ke(n.charCodeAt(a++));
|
|
709
709
|
if (u === void 0 || l === void 0)
|
|
710
|
-
throw new
|
|
710
|
+
throw new I(`Invalid byte sequence ("${n[a - 2]}${n[a - 1]}" in "${n}").`);
|
|
711
711
|
i[r] = u * 16 + l;
|
|
712
712
|
}
|
|
713
713
|
return i;
|
|
714
714
|
}
|
|
715
|
-
function
|
|
716
|
-
const s =
|
|
717
|
-
return
|
|
715
|
+
function ss(t, e) {
|
|
716
|
+
const s = Zt(t, e);
|
|
717
|
+
return Qe(s);
|
|
718
718
|
}
|
|
719
|
-
function
|
|
720
|
-
const s =
|
|
721
|
-
return typeof e.size == "number" ? (
|
|
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
|
|
724
|
-
function
|
|
725
|
-
return e ? { h: Number(t &
|
|
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
|
|
727
|
+
function os(t, e = !1) {
|
|
728
728
|
const s = t.length;
|
|
729
729
|
let n = new Uint32Array(s), o = new Uint32Array(s);
|
|
730
730
|
for (let i = 0; i < s; i++) {
|
|
731
|
-
const { h: r, l: a } =
|
|
731
|
+
const { h: r, l: a } = ns(t[i], e);
|
|
732
732
|
[n[i], o[i]] = [r, a];
|
|
733
733
|
}
|
|
734
734
|
return [n, o];
|
|
735
735
|
}
|
|
736
|
-
const
|
|
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
|
|
738
|
+
function us(t) {
|
|
739
739
|
return t instanceof Uint8Array || ArrayBuffer.isView(t) && t.constructor.name === "Uint8Array";
|
|
740
740
|
}
|
|
741
|
-
function
|
|
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
|
|
746
|
-
if (!
|
|
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
|
|
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
|
|
758
|
-
|
|
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
|
|
763
|
+
function ds(t) {
|
|
764
764
|
return new Uint32Array(t.buffer, t.byteOffset, Math.floor(t.byteLength / 4));
|
|
765
765
|
}
|
|
766
|
-
function
|
|
766
|
+
function tt(...t) {
|
|
767
767
|
for (let e = 0; e < t.length; e++)
|
|
768
768
|
t[e].fill(0);
|
|
769
769
|
}
|
|
770
|
-
const
|
|
771
|
-
function
|
|
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
|
|
774
|
+
function ms(t) {
|
|
775
775
|
for (let e = 0; e < t.length; e++)
|
|
776
|
-
t[e] =
|
|
776
|
+
t[e] = hs(t[e]);
|
|
777
777
|
return t;
|
|
778
778
|
}
|
|
779
|
-
const
|
|
780
|
-
function
|
|
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
|
|
786
|
-
return typeof t == "string" && (t =
|
|
785
|
+
function st(t) {
|
|
786
|
+
return typeof t == "string" && (t = gs(t)), j(t), t;
|
|
787
787
|
}
|
|
788
|
-
class
|
|
788
|
+
class ps {
|
|
789
789
|
}
|
|
790
|
-
function
|
|
791
|
-
const e = (n) => t().update(
|
|
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
|
|
795
|
-
for (let t = 0, e =
|
|
796
|
-
[s, n] = [n, (2 * s + 3 * n) % 5],
|
|
797
|
-
let o =
|
|
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 <<
|
|
800
|
-
|
|
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
|
|
803
|
-
function
|
|
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
806
|
for (let r = 0; r < 10; r++)
|
|
807
807
|
s[r] = t[r] ^ t[r + 10] ^ t[r + 20] ^ t[r + 30] ^ t[r + 40];
|
|
808
808
|
for (let r = 0; r < 10; r += 2) {
|
|
809
|
-
const a = (r + 8) % 10, u = (r + 2) % 10, l = s[u],
|
|
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[r + y] ^= E, t[r + y + 1] ^=
|
|
811
|
+
t[r + y] ^= E, t[r + y + 1] ^= h;
|
|
812
812
|
}
|
|
813
813
|
let o = t[2], i = t[3];
|
|
814
814
|
for (let r = 0; r < 24; r++) {
|
|
815
|
-
const a =
|
|
816
|
-
o = t[
|
|
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
818
|
for (let r = 0; r < 50; r += 10) {
|
|
819
819
|
for (let a = 0; a < 10; a++)
|
|
@@ -821,25 +821,25 @@ function Ss(t, e = 24) {
|
|
|
821
821
|
for (let a = 0; a < 10; a++)
|
|
822
822
|
t[r + a] ^= ~s[(a + 2) % 10] & s[(a + 4) % 10];
|
|
823
823
|
}
|
|
824
|
-
t[0] ^=
|
|
824
|
+
t[0] ^= Rs[n], t[1] ^= Cs[n];
|
|
825
825
|
}
|
|
826
|
-
|
|
826
|
+
tt(s);
|
|
827
827
|
}
|
|
828
|
-
class
|
|
828
|
+
class me extends ps {
|
|
829
829
|
// NOTE: we accept arguments in bytes instead of bits here.
|
|
830
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,
|
|
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 =
|
|
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
|
-
|
|
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
|
-
|
|
842
|
+
xe(this), e = st(e), j(e);
|
|
843
843
|
const { blockLen: s, state: n } = this, o = e.length;
|
|
844
844
|
for (let i = 0; i < o; ) {
|
|
845
845
|
const r = Math.min(s - this.pos, o - i);
|
|
@@ -857,7 +857,7 @@ class le extends fs {
|
|
|
857
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
|
-
|
|
860
|
+
xe(this, !1), j(e), this.finish();
|
|
861
861
|
const s = this.state, { blockLen: n } = this;
|
|
862
862
|
for (let o = 0, i = e.length; o < i; ) {
|
|
863
863
|
this.posOut >= n && this.keccak();
|
|
@@ -872,10 +872,10 @@ class le extends fs {
|
|
|
872
872
|
return this.writeInto(e);
|
|
873
873
|
}
|
|
874
874
|
xof(e) {
|
|
875
|
-
return
|
|
875
|
+
return Pe(e), this.xofInto(new Uint8Array(e));
|
|
876
876
|
}
|
|
877
877
|
digestInto(e) {
|
|
878
|
-
if (
|
|
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 fs {
|
|
|
883
883
|
return this.digestInto(new Uint8Array(this.outputLen));
|
|
884
884
|
}
|
|
885
885
|
destroy() {
|
|
886
|
-
this.destroyed = !0,
|
|
886
|
+
this.destroyed = !0, tt(this.state);
|
|
887
887
|
}
|
|
888
888
|
_cloneInto(e) {
|
|
889
889
|
const { blockLen: s, suffix: n, outputLen: o, rounds: i, enableXOF: r } = this;
|
|
890
|
-
return e || (e = new
|
|
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
|
|
894
|
-
function
|
|
895
|
-
return
|
|
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
|
|
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 As extends U {
|
|
|
905
905
|
});
|
|
906
906
|
}
|
|
907
907
|
}
|
|
908
|
-
class
|
|
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 st extends Map {
|
|
|
926
926
|
return this;
|
|
927
927
|
}
|
|
928
928
|
}
|
|
929
|
-
const
|
|
930
|
-
function
|
|
931
|
-
if (
|
|
932
|
-
return
|
|
933
|
-
const s = t.substring(2).toLowerCase(), n =
|
|
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
934
|
for (let r = 0; r < 40; r += 2)
|
|
935
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
936
|
const i = `0x${o.join("")}`;
|
|
937
|
-
return
|
|
937
|
+
return ee.set(`${t}.${e}`, i), i;
|
|
938
938
|
}
|
|
939
|
-
function
|
|
940
|
-
if (!
|
|
941
|
-
throw new
|
|
942
|
-
return
|
|
939
|
+
function w(t, e) {
|
|
940
|
+
if (!Ps(t, { strict: !1 }))
|
|
941
|
+
throw new ks({ address: t });
|
|
942
|
+
return ct(t, e);
|
|
943
943
|
}
|
|
944
|
-
const
|
|
945
|
-
function
|
|
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 (
|
|
948
|
-
return
|
|
949
|
-
const o =
|
|
950
|
-
return
|
|
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,10 +962,10 @@ const c = {
|
|
|
962
962
|
LORDS: "LORDS"
|
|
963
963
|
};
|
|
964
964
|
c.USDC;
|
|
965
|
-
const
|
|
966
|
-
[
|
|
965
|
+
const ut = {
|
|
966
|
+
[b.ARBITRUM]: {
|
|
967
967
|
[c.DAI]: {
|
|
968
|
-
address:
|
|
968
|
+
address: w("0xDA10009cBd5D07dd0CeCc66161FC93D7c9000da1"),
|
|
969
969
|
symbol: c.DAI,
|
|
970
970
|
name: "Dai Stablecoin",
|
|
971
971
|
decimals: 18,
|
|
@@ -981,7 +981,7 @@ const ot = {
|
|
|
981
981
|
nativeToken: !0
|
|
982
982
|
},
|
|
983
983
|
[c.USDC]: {
|
|
984
|
-
address:
|
|
984
|
+
address: w("0xaf88d065e77c8cC2239327C5EDb3A432268e5831"),
|
|
985
985
|
symbol: c.USDC,
|
|
986
986
|
name: "USD Coin",
|
|
987
987
|
decimals: 6,
|
|
@@ -989,7 +989,7 @@ const ot = {
|
|
|
989
989
|
nativeToken: !1
|
|
990
990
|
},
|
|
991
991
|
[c.USDT]: {
|
|
992
|
-
address:
|
|
992
|
+
address: w("0xFd086bC7CD5C481DCC9C85ebE478A1C0b69FCbb9"),
|
|
993
993
|
symbol: c.USDT,
|
|
994
994
|
name: "Tether USD",
|
|
995
995
|
decimals: 6,
|
|
@@ -997,7 +997,7 @@ const ot = {
|
|
|
997
997
|
nativeToken: !1
|
|
998
998
|
},
|
|
999
999
|
[c.WETH]: {
|
|
1000
|
-
address:
|
|
1000
|
+
address: w("0x82aF49447D8a07e3bd95BD0d56f35241523fBab1"),
|
|
1001
1001
|
symbol: c.WETH,
|
|
1002
1002
|
name: "Wrapped Ether",
|
|
1003
1003
|
decimals: 18,
|
|
@@ -1005,9 +1005,9 @@ const ot = {
|
|
|
1005
1005
|
nativeToken: !1
|
|
1006
1006
|
}
|
|
1007
1007
|
},
|
|
1008
|
-
[
|
|
1008
|
+
[b.ARBITRUM_TESTNET]: {
|
|
1009
1009
|
[c.USDC]: {
|
|
1010
|
-
address:
|
|
1010
|
+
address: w("0x75faf114eafb1BDbe2F0316DF893fd58CE46AA4d"),
|
|
1011
1011
|
symbol: c.USDC,
|
|
1012
1012
|
name: "USD Coin",
|
|
1013
1013
|
fiatISO: "USD",
|
|
@@ -1017,7 +1017,7 @@ const ot = {
|
|
|
1017
1017
|
nativeToken: !1
|
|
1018
1018
|
}
|
|
1019
1019
|
},
|
|
1020
|
-
[
|
|
1020
|
+
[b.AVALANCHE]: {
|
|
1021
1021
|
[c.DAI]: {
|
|
1022
1022
|
address: "0xd586E7F844cEa2F87f50152665BCbc2C279D8d70",
|
|
1023
1023
|
symbol: c.DAI,
|
|
@@ -1027,7 +1027,7 @@ const ot = {
|
|
|
1027
1027
|
nativeToken: !1
|
|
1028
1028
|
},
|
|
1029
1029
|
[c.USDC]: {
|
|
1030
|
-
address:
|
|
1030
|
+
address: w("0xB97EF9Ef8734C71904D8002F8b6Bc66Dd9c48a6E"),
|
|
1031
1031
|
symbol: c.USDC,
|
|
1032
1032
|
name: "USD Coin",
|
|
1033
1033
|
fiatISO: "USD",
|
|
@@ -1053,9 +1053,9 @@ const ot = {
|
|
|
1053
1053
|
nativeToken: !1
|
|
1054
1054
|
}
|
|
1055
1055
|
},
|
|
1056
|
-
[
|
|
1056
|
+
[b.AVALANCHE_TESTNET]: {
|
|
1057
1057
|
[c.USDC]: {
|
|
1058
|
-
address:
|
|
1058
|
+
address: w("0x5425890298aed601595a70AB815c96711a31Bc65"),
|
|
1059
1059
|
symbol: c.USDC,
|
|
1060
1060
|
name: "USD Coin",
|
|
1061
1061
|
fiatISO: "USD",
|
|
@@ -1065,7 +1065,7 @@ const ot = {
|
|
|
1065
1065
|
nativeToken: !1
|
|
1066
1066
|
}
|
|
1067
1067
|
},
|
|
1068
|
-
[
|
|
1068
|
+
[b.BASE]: {
|
|
1069
1069
|
[c.DAI]: {
|
|
1070
1070
|
address: "0x50c5725949A6F0c72E6C4a641F24049A917DB0Cb",
|
|
1071
1071
|
symbol: c.DAI,
|
|
@@ -1091,7 +1091,7 @@ const ot = {
|
|
|
1091
1091
|
nativeToken: !1
|
|
1092
1092
|
},
|
|
1093
1093
|
[c.USDC]: {
|
|
1094
|
-
address:
|
|
1094
|
+
address: w("0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913"),
|
|
1095
1095
|
symbol: c.USDC,
|
|
1096
1096
|
name: "USD Coin",
|
|
1097
1097
|
fiatISO: "USD",
|
|
@@ -1101,7 +1101,7 @@ const ot = {
|
|
|
1101
1101
|
nativeToken: !1
|
|
1102
1102
|
},
|
|
1103
1103
|
[c.WETH]: {
|
|
1104
|
-
address:
|
|
1104
|
+
address: w("0x4200000000000000000000000000000000000006"),
|
|
1105
1105
|
symbol: c.WETH,
|
|
1106
1106
|
name: "Wrapped Ether",
|
|
1107
1107
|
decimals: 18,
|
|
@@ -1109,9 +1109,9 @@ const ot = {
|
|
|
1109
1109
|
nativeToken: !1
|
|
1110
1110
|
}
|
|
1111
1111
|
},
|
|
1112
|
-
[
|
|
1112
|
+
[b.BASE_TESTNET]: {
|
|
1113
1113
|
[c.USDC]: {
|
|
1114
|
-
address:
|
|
1114
|
+
address: w("0x036CbD53842c5426634e7929541eC2318f3dCF7e"),
|
|
1115
1115
|
symbol: c.USDC,
|
|
1116
1116
|
name: "USD Coin",
|
|
1117
1117
|
fiatISO: "USD",
|
|
@@ -1121,7 +1121,7 @@ const ot = {
|
|
|
1121
1121
|
nativeToken: !1
|
|
1122
1122
|
}
|
|
1123
1123
|
},
|
|
1124
|
-
[
|
|
1124
|
+
[b.BSC]: {
|
|
1125
1125
|
[c.BNB]: {
|
|
1126
1126
|
address: "0x0000000000000000000000000000000000000000",
|
|
1127
1127
|
symbol: c.BNB,
|
|
@@ -1155,7 +1155,7 @@ const ot = {
|
|
|
1155
1155
|
nativeToken: !1
|
|
1156
1156
|
},
|
|
1157
1157
|
[c.USDC]: {
|
|
1158
|
-
address:
|
|
1158
|
+
address: w("0x8AC76a51cc950d9822D68b83fE1Ad97B32Cd580d"),
|
|
1159
1159
|
symbol: c.USDC,
|
|
1160
1160
|
decimals: 18,
|
|
1161
1161
|
name: "USD Coin",
|
|
@@ -1172,7 +1172,7 @@ const ot = {
|
|
|
1172
1172
|
nativeToken: !1
|
|
1173
1173
|
}
|
|
1174
1174
|
},
|
|
1175
|
-
[
|
|
1175
|
+
[b.ETHEREUM]: {
|
|
1176
1176
|
[c.BUSD]: {
|
|
1177
1177
|
address: "0x4Fabb145d64652a948d72533023f6E7A623C7C53",
|
|
1178
1178
|
symbol: c.BUSD,
|
|
@@ -1182,7 +1182,7 @@ const ot = {
|
|
|
1182
1182
|
nativeToken: !1
|
|
1183
1183
|
},
|
|
1184
1184
|
[c.DAI]: {
|
|
1185
|
-
address:
|
|
1185
|
+
address: w("0x6B175474E89094C44Da98b954EedeAC495271d0F"),
|
|
1186
1186
|
symbol: c.DAI,
|
|
1187
1187
|
name: "Dai Stablecoin",
|
|
1188
1188
|
decimals: 18,
|
|
@@ -1214,7 +1214,7 @@ const ot = {
|
|
|
1214
1214
|
nativeToken: !1
|
|
1215
1215
|
},
|
|
1216
1216
|
[c.USDC]: {
|
|
1217
|
-
address:
|
|
1217
|
+
address: w("0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48"),
|
|
1218
1218
|
symbol: c.USDC,
|
|
1219
1219
|
name: "USD Coin",
|
|
1220
1220
|
decimals: 6,
|
|
@@ -1223,7 +1223,7 @@ const ot = {
|
|
|
1223
1223
|
nativeToken: !1
|
|
1224
1224
|
},
|
|
1225
1225
|
[c.USDT]: {
|
|
1226
|
-
address:
|
|
1226
|
+
address: w("0xdAC17F958D2ee523a2206206994597C13D831ec7"),
|
|
1227
1227
|
symbol: c.USDT,
|
|
1228
1228
|
name: "Tether USD",
|
|
1229
1229
|
decimals: 6,
|
|
@@ -1231,7 +1231,7 @@ const ot = {
|
|
|
1231
1231
|
nativeToken: !1
|
|
1232
1232
|
},
|
|
1233
1233
|
[c.WETH]: {
|
|
1234
|
-
address:
|
|
1234
|
+
address: w("0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2"),
|
|
1235
1235
|
symbol: c.WETH,
|
|
1236
1236
|
name: "Wrapped Ether",
|
|
1237
1237
|
decimals: 18,
|
|
@@ -1239,9 +1239,9 @@ const ot = {
|
|
|
1239
1239
|
nativeToken: !1
|
|
1240
1240
|
}
|
|
1241
1241
|
},
|
|
1242
|
-
[
|
|
1242
|
+
[b.ETHEREUM_TESTNET]: {
|
|
1243
1243
|
[c.USDC]: {
|
|
1244
|
-
address:
|
|
1244
|
+
address: w("0x1c7D4B196Cb0C7B01d743Fbc6116a902379C7238"),
|
|
1245
1245
|
symbol: c.USDC,
|
|
1246
1246
|
decimals: 6,
|
|
1247
1247
|
name: "USD Coin",
|
|
@@ -1250,7 +1250,7 @@ const ot = {
|
|
|
1250
1250
|
nativeToken: !1
|
|
1251
1251
|
}
|
|
1252
1252
|
},
|
|
1253
|
-
[
|
|
1253
|
+
[b.HYPEREVM]: {
|
|
1254
1254
|
[c.USDC]: {
|
|
1255
1255
|
address: "0xb88339CB7199b77E23DB6E890353E22632Ba630f",
|
|
1256
1256
|
symbol: c.USDC,
|
|
@@ -1260,7 +1260,7 @@ const ot = {
|
|
|
1260
1260
|
nativeToken: !1
|
|
1261
1261
|
}
|
|
1262
1262
|
},
|
|
1263
|
-
[
|
|
1263
|
+
[b.LISK]: {
|
|
1264
1264
|
[c.USDC]: {
|
|
1265
1265
|
address: "0xF242275d3a6527d877f2c927a82D9b057609cc71",
|
|
1266
1266
|
symbol: c.USDC,
|
|
@@ -1270,7 +1270,7 @@ const ot = {
|
|
|
1270
1270
|
nativeToken: !1
|
|
1271
1271
|
}
|
|
1272
1272
|
},
|
|
1273
|
-
[
|
|
1273
|
+
[b.MONAD]: {
|
|
1274
1274
|
[c.USDC]: {
|
|
1275
1275
|
address: "0x754704Bc059F8C67012fEd69BC8A327a5aafb603",
|
|
1276
1276
|
symbol: c.USDC,
|
|
@@ -1280,7 +1280,7 @@ const ot = {
|
|
|
1280
1280
|
nativeToken: !1
|
|
1281
1281
|
}
|
|
1282
1282
|
},
|
|
1283
|
-
[
|
|
1283
|
+
[b.MONAD_TESTNET]: {
|
|
1284
1284
|
[c.USDC]: {
|
|
1285
1285
|
address: "0x534b2f3A21130d7a60830c2Df862319e593943A3",
|
|
1286
1286
|
symbol: c.USDC,
|
|
@@ -1290,7 +1290,7 @@ const ot = {
|
|
|
1290
1290
|
nativeToken: !1
|
|
1291
1291
|
}
|
|
1292
1292
|
},
|
|
1293
|
-
[
|
|
1293
|
+
[b.OPTIMISM]: {
|
|
1294
1294
|
[c.DAI]: {
|
|
1295
1295
|
address: "0xDA10009cBd5D07dd0CeCc66161FC93D7c9000da1",
|
|
1296
1296
|
symbol: c.DAI,
|
|
@@ -1332,7 +1332,7 @@ const ot = {
|
|
|
1332
1332
|
nativeToken: !1
|
|
1333
1333
|
}
|
|
1334
1334
|
},
|
|
1335
|
-
[
|
|
1335
|
+
[b.OPTIMISM_TESTNET]: {
|
|
1336
1336
|
[c.USDC]: {
|
|
1337
1337
|
address: "0x5fd84259d66Cd46123540766Be93DFE6D43130D7",
|
|
1338
1338
|
symbol: c.USDC,
|
|
@@ -1342,7 +1342,7 @@ const ot = {
|
|
|
1342
1342
|
nativeToken: !1
|
|
1343
1343
|
}
|
|
1344
1344
|
},
|
|
1345
|
-
[
|
|
1345
|
+
[b.POLYGON]: {
|
|
1346
1346
|
[c.DAI]: {
|
|
1347
1347
|
address: "0x8f3Cf7ad23Cd3CaDbD9735AFf958023239c6A063",
|
|
1348
1348
|
symbol: c.DAI,
|
|
@@ -1376,7 +1376,7 @@ const ot = {
|
|
|
1376
1376
|
nativeToken: !1
|
|
1377
1377
|
}
|
|
1378
1378
|
},
|
|
1379
|
-
[
|
|
1379
|
+
[b.STARKNET]: {
|
|
1380
1380
|
[c.DAI]: {
|
|
1381
1381
|
address: "0x05574eb6b8789a91466f902c380d978e472db68170ff82a5b650b95a58ddf4ad",
|
|
1382
1382
|
symbol: c.DAI,
|
|
@@ -1427,7 +1427,7 @@ const ot = {
|
|
|
1427
1427
|
nativeToken: !1
|
|
1428
1428
|
}
|
|
1429
1429
|
},
|
|
1430
|
-
[
|
|
1430
|
+
[b.STARKNET_TESTNET]: {
|
|
1431
1431
|
[c.USDC]: {
|
|
1432
1432
|
address: "0x0512feAc6339Ff7889822cb5aA2a86C848e9D392bB0E3E237C008674feeD8343",
|
|
1433
1433
|
symbol: c.USDC,
|
|
@@ -1437,20 +1437,20 @@ const ot = {
|
|
|
1437
1437
|
nativeToken: !1
|
|
1438
1438
|
}
|
|
1439
1439
|
}
|
|
1440
|
-
},
|
|
1441
|
-
function
|
|
1442
|
-
if (
|
|
1440
|
+
}, xs = new Set(Object.values(b));
|
|
1441
|
+
function R(t) {
|
|
1442
|
+
if (Ns(t))
|
|
1443
1443
|
return t;
|
|
1444
|
-
const e =
|
|
1444
|
+
const e = b[t];
|
|
1445
1445
|
if (!e)
|
|
1446
1446
|
throw new Error(`Invalid chain: ${t}. Chain must be a valid chain alias or internal chain value from Chains.`);
|
|
1447
1447
|
return e;
|
|
1448
1448
|
}
|
|
1449
|
-
function
|
|
1450
|
-
return
|
|
1449
|
+
function Ns(t) {
|
|
1450
|
+
return xs.has(t);
|
|
1451
1451
|
}
|
|
1452
|
-
function
|
|
1453
|
-
const s = e.toLowerCase().trim(), n =
|
|
1452
|
+
function Os(t, e) {
|
|
1453
|
+
const s = e.toLowerCase().trim(), n = ut[t];
|
|
1454
1454
|
if (!n)
|
|
1455
1455
|
throw new Error(
|
|
1456
1456
|
`Chain not found: ${t}. The chain key must be a valid chain identifier.`
|
|
@@ -1469,57 +1469,57 @@ function Is(t, e) {
|
|
|
1469
1469
|
);
|
|
1470
1470
|
return o;
|
|
1471
1471
|
}
|
|
1472
|
-
function
|
|
1473
|
-
const n =
|
|
1472
|
+
function se(t, e, s) {
|
|
1473
|
+
const n = Os(t, e);
|
|
1474
1474
|
if (n.symbol !== s)
|
|
1475
1475
|
throw new Error(
|
|
1476
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.`
|
|
1477
1477
|
);
|
|
1478
1478
|
return n;
|
|
1479
1479
|
}
|
|
1480
|
-
function
|
|
1481
|
-
return
|
|
1480
|
+
function Bs(t, e) {
|
|
1481
|
+
return ut[t]?.[e];
|
|
1482
1482
|
}
|
|
1483
|
-
function
|
|
1484
|
-
return
|
|
1483
|
+
function Me(t, e) {
|
|
1484
|
+
return Bs(t, e)?.address;
|
|
1485
1485
|
}
|
|
1486
|
-
var
|
|
1487
|
-
class
|
|
1486
|
+
var ge = /* @__PURE__ */ ((t) => (t.PRODUCTION = "production", t.STAGING = "staging", t))(ge || {});
|
|
1487
|
+
class d {
|
|
1488
1488
|
constructor({ api_key: e, env: s, seesion_token: n, props: o }) {
|
|
1489
|
-
this.api_key = e || "", this.sessionToken = n || "", this.env = s ??
|
|
1489
|
+
this.api_key = e || "", this.sessionToken = n || "", this.env = s ?? ge.PRODUCTION, this.props = o;
|
|
1490
1490
|
}
|
|
1491
1491
|
static async config(e) {
|
|
1492
|
-
if (!
|
|
1492
|
+
if (!d.app) {
|
|
1493
1493
|
if (!e)
|
|
1494
1494
|
throw new Error("Please provide an api_key");
|
|
1495
|
-
|
|
1495
|
+
d.app = new d(e);
|
|
1496
1496
|
}
|
|
1497
|
-
return e && (e.api_key !== void 0 && (
|
|
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;
|
|
1498
1498
|
}
|
|
1499
1499
|
static getApiKey() {
|
|
1500
|
-
if (!
|
|
1500
|
+
if (!d.app)
|
|
1501
1501
|
throw new Error("Chainrails SDK not configured. Please call Chainrails.config() first.");
|
|
1502
|
-
return
|
|
1502
|
+
return d.app.api_key;
|
|
1503
1503
|
}
|
|
1504
1504
|
static getSessionToken() {
|
|
1505
|
-
if (!
|
|
1505
|
+
if (!d.app)
|
|
1506
1506
|
throw new Error("Chainrails SDK not configured. Please call Chainrails.config() first.");
|
|
1507
|
-
return
|
|
1507
|
+
return d.app.sessionToken;
|
|
1508
1508
|
}
|
|
1509
1509
|
static getProps() {
|
|
1510
|
-
if (!
|
|
1510
|
+
if (!d.app)
|
|
1511
1511
|
throw new Error("Chainrails SDK not configured. Please call Chainrails.config() first.");
|
|
1512
|
-
return
|
|
1512
|
+
return d.app.props;
|
|
1513
1513
|
}
|
|
1514
1514
|
static getEnv() {
|
|
1515
|
-
if (!
|
|
1515
|
+
if (!d.app)
|
|
1516
1516
|
throw new Error("Chainrails SDK not configured. Please call Chainrails.config() first.");
|
|
1517
|
-
return
|
|
1517
|
+
return d.app.env === "internal" ? "staging" : d.app.env;
|
|
1518
1518
|
}
|
|
1519
1519
|
static getBaseUrl() {
|
|
1520
|
-
if (!
|
|
1520
|
+
if (!d.app)
|
|
1521
1521
|
throw new Error("Chainrails SDK not configured. Please call Chainrails.config() first.");
|
|
1522
|
-
switch (
|
|
1522
|
+
switch (d.app.env) {
|
|
1523
1523
|
case "production":
|
|
1524
1524
|
return "https://api.chainrails.io/api/v1";
|
|
1525
1525
|
case "staging":
|
|
@@ -1531,23 +1531,23 @@ class g {
|
|
|
1531
1531
|
}
|
|
1532
1532
|
}
|
|
1533
1533
|
static getPayModalUrl(e) {
|
|
1534
|
-
if (!
|
|
1534
|
+
if (!d.app)
|
|
1535
1535
|
throw new Error("Chainrails SDK not configured. Please call Chainrails.config() first.");
|
|
1536
|
-
const s =
|
|
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
1537
|
return s + o + i;
|
|
1538
1538
|
}
|
|
1539
1539
|
}
|
|
1540
|
-
let
|
|
1541
|
-
function
|
|
1542
|
-
|
|
1543
|
-
prefixUrl:
|
|
1540
|
+
let ae = null;
|
|
1541
|
+
function Ms() {
|
|
1542
|
+
ae = Vt.create({
|
|
1543
|
+
prefixUrl: d.getBaseUrl(),
|
|
1544
1544
|
headers: {
|
|
1545
1545
|
"Content-Type": "application/json"
|
|
1546
1546
|
},
|
|
1547
1547
|
hooks: {
|
|
1548
1548
|
beforeRequest: [
|
|
1549
1549
|
(t) => {
|
|
1550
|
-
const e =
|
|
1550
|
+
const e = d.getSessionToken() || d.getApiKey();
|
|
1551
1551
|
t.headers.set("Authorization", `Bearer ${e}`);
|
|
1552
1552
|
}
|
|
1553
1553
|
],
|
|
@@ -1559,9 +1559,9 @@ function xs() {
|
|
|
1559
1559
|
});
|
|
1560
1560
|
}
|
|
1561
1561
|
function p() {
|
|
1562
|
-
return
|
|
1562
|
+
return ae || Ms(), ae;
|
|
1563
1563
|
}
|
|
1564
|
-
class
|
|
1564
|
+
class Ls {
|
|
1565
1565
|
async getById(e) {
|
|
1566
1566
|
return await p().get("intents/" + e).json();
|
|
1567
1567
|
}
|
|
@@ -1578,7 +1578,7 @@ class Ns {
|
|
|
1578
1578
|
return await p().get("intents", { searchParams: e }).json();
|
|
1579
1579
|
}
|
|
1580
1580
|
async create(e) {
|
|
1581
|
-
const s =
|
|
1581
|
+
const s = R(e.source_chain), n = R(e.destination_chain);
|
|
1582
1582
|
return await p().post("intents", {
|
|
1583
1583
|
json: {
|
|
1584
1584
|
...e,
|
|
@@ -1588,7 +1588,7 @@ class Ns {
|
|
|
1588
1588
|
}).json();
|
|
1589
1589
|
}
|
|
1590
1590
|
async createForSession(e) {
|
|
1591
|
-
const s =
|
|
1591
|
+
const s = R(e.sourceChain);
|
|
1592
1592
|
return await p().post("modal/sessions/intents", {
|
|
1593
1593
|
json: { ...e, sourceChain: s }
|
|
1594
1594
|
}).json();
|
|
@@ -1603,11 +1603,11 @@ class Ns {
|
|
|
1603
1603
|
return await p().post(`modal/sessions/intents/${e}/process`).json();
|
|
1604
1604
|
}
|
|
1605
1605
|
}
|
|
1606
|
-
class
|
|
1606
|
+
class _s {
|
|
1607
1607
|
async getFromSpecificBridge(e) {
|
|
1608
|
-
const s =
|
|
1609
|
-
|
|
1610
|
-
const n =
|
|
1608
|
+
const s = R(e.sourceChain);
|
|
1609
|
+
se(s, e.tokenIn, e.amountSymbol);
|
|
1610
|
+
const n = R(e.destinationChain);
|
|
1611
1611
|
return await p().get("quotes/single", {
|
|
1612
1612
|
searchParams: {
|
|
1613
1613
|
...e,
|
|
@@ -1617,9 +1617,9 @@ class Os {
|
|
|
1617
1617
|
}).json();
|
|
1618
1618
|
}
|
|
1619
1619
|
async getFromAllBridges(e) {
|
|
1620
|
-
const s =
|
|
1621
|
-
|
|
1622
|
-
const n =
|
|
1620
|
+
const s = R(e.sourceChain);
|
|
1621
|
+
se(s, e.tokenIn, e.amountSymbol);
|
|
1622
|
+
const n = R(e.destinationChain);
|
|
1623
1623
|
return await p().get("quotes/multiple", {
|
|
1624
1624
|
searchParams: {
|
|
1625
1625
|
...e,
|
|
@@ -1629,9 +1629,9 @@ class Os {
|
|
|
1629
1629
|
}).json();
|
|
1630
1630
|
}
|
|
1631
1631
|
async getBestAcrossBridges(e) {
|
|
1632
|
-
const s =
|
|
1633
|
-
|
|
1634
|
-
const n =
|
|
1632
|
+
const s = R(e.sourceChain);
|
|
1633
|
+
se(s, e.tokenIn, e.amountSymbol);
|
|
1634
|
+
const n = R(e.destinationChain);
|
|
1635
1635
|
return await p().get("quotes/best", { searchParams: {
|
|
1636
1636
|
...e,
|
|
1637
1637
|
sourceChain: s,
|
|
@@ -1639,7 +1639,7 @@ class Os {
|
|
|
1639
1639
|
} }).json();
|
|
1640
1640
|
}
|
|
1641
1641
|
async getAll(e) {
|
|
1642
|
-
const s =
|
|
1642
|
+
const s = R(e.destinationChain);
|
|
1643
1643
|
return await p().get("quotes/multi-source", { searchParams: {
|
|
1644
1644
|
...e,
|
|
1645
1645
|
destinationChain: s
|
|
@@ -1649,9 +1649,9 @@ class Os {
|
|
|
1649
1649
|
return await p().get("modal/sessions/quotes", { searchParams: e }).json();
|
|
1650
1650
|
}
|
|
1651
1651
|
}
|
|
1652
|
-
class
|
|
1652
|
+
class Fs {
|
|
1653
1653
|
async getOptimalRoutes(e) {
|
|
1654
|
-
const s =
|
|
1654
|
+
const s = R(e.sourceChain), n = R(e.destinationChain);
|
|
1655
1655
|
return await p().get("router/optimal-route", {
|
|
1656
1656
|
searchParams: {
|
|
1657
1657
|
...e,
|
|
@@ -1664,7 +1664,7 @@ class Bs {
|
|
|
1664
1664
|
return await p().get("router/supported-bridges/all").json();
|
|
1665
1665
|
}
|
|
1666
1666
|
async getSupportedBridges(e) {
|
|
1667
|
-
const s =
|
|
1667
|
+
const s = R(e.sourceChain), n = R(e.destinationChain);
|
|
1668
1668
|
return await p().get("router/supported-bridges/route", { searchParams: {
|
|
1669
1669
|
...e,
|
|
1670
1670
|
sourceChain: s,
|
|
@@ -1675,7 +1675,7 @@ class Bs {
|
|
|
1675
1675
|
return await p().get("router/supported-routes/bridge/" + e).json();
|
|
1676
1676
|
}
|
|
1677
1677
|
}
|
|
1678
|
-
class
|
|
1678
|
+
class Hs {
|
|
1679
1679
|
async getSupported(e) {
|
|
1680
1680
|
return await p().get("chains", { searchParams: e }).json();
|
|
1681
1681
|
}
|
|
@@ -1683,7 +1683,7 @@ class Ms {
|
|
|
1683
1683
|
return await p().get(`chains/balances/${e.address}`, { searchParams: e }).json();
|
|
1684
1684
|
}
|
|
1685
1685
|
}
|
|
1686
|
-
class
|
|
1686
|
+
class $s {
|
|
1687
1687
|
async getClientInfo() {
|
|
1688
1688
|
return await p().get("client/auth/client-info").json();
|
|
1689
1689
|
}
|
|
@@ -1691,11 +1691,11 @@ class Ls {
|
|
|
1691
1691
|
return await p().get("modal/sessions/client").json();
|
|
1692
1692
|
}
|
|
1693
1693
|
}
|
|
1694
|
-
class
|
|
1694
|
+
class js {
|
|
1695
1695
|
async getSessionToken(e) {
|
|
1696
|
-
const s =
|
|
1697
|
-
let n =
|
|
1698
|
-
n || (console.error(`${e.token} on ${e.destinationChain} is currently unsupported, defaulting to usdc`), n =
|
|
1696
|
+
const s = R(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
1699
|
const o = {
|
|
1700
1700
|
recipient: e.recipient,
|
|
1701
1701
|
tokenOut: n,
|
|
@@ -1705,28 +1705,29 @@ class Fs {
|
|
|
1705
1705
|
return p().post("modal/sessions", { json: o }).json().then((i) => ({ ...i, amount: o.amount }));
|
|
1706
1706
|
}
|
|
1707
1707
|
}
|
|
1708
|
-
const
|
|
1709
|
-
router: new
|
|
1710
|
-
quotes: new
|
|
1711
|
-
intents: new
|
|
1712
|
-
chains: new
|
|
1713
|
-
client: new
|
|
1714
|
-
auth: new
|
|
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()
|
|
1715
1715
|
};
|
|
1716
|
-
function
|
|
1716
|
+
function lt(t) {
|
|
1717
1717
|
var e, s, n = "";
|
|
1718
1718
|
if (typeof t == "string" || typeof t == "number") n += t;
|
|
1719
1719
|
else if (typeof t == "object") if (Array.isArray(t)) {
|
|
1720
1720
|
var o = t.length;
|
|
1721
|
-
for (e = 0; e < o; e++) t[e] && (s =
|
|
1721
|
+
for (e = 0; e < o; e++) t[e] && (s = lt(t[e])) && (n && (n += " "), n += s);
|
|
1722
1722
|
} else for (s in t) t[s] && (n && (n += " "), n += s);
|
|
1723
1723
|
return n;
|
|
1724
1724
|
}
|
|
1725
|
-
function
|
|
1726
|
-
for (var t, e, s = 0, n = "", o = arguments.length; s < o; s++) (t = arguments[s]) && (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);
|
|
1727
1727
|
return n;
|
|
1728
1728
|
}
|
|
1729
|
-
|
|
1729
|
+
const qs = ["light", "dark", "system"];
|
|
1730
|
+
function pn(t) {
|
|
1730
1731
|
const {
|
|
1731
1732
|
amount: e,
|
|
1732
1733
|
styles: s,
|
|
@@ -1737,140 +1738,168 @@ function dn(t) {
|
|
|
1737
1738
|
close: a,
|
|
1738
1739
|
onCancel: u,
|
|
1739
1740
|
onSuccess: l,
|
|
1740
|
-
session_url:
|
|
1741
|
+
session_url: f,
|
|
1741
1742
|
sessionToken: E
|
|
1742
|
-
} = t, [
|
|
1743
|
-
|
|
1743
|
+
} = t, [h, y] = k(0), [C, V] = k(""), [m, T] = k(null), g = le(null);
|
|
1744
|
+
d.config({
|
|
1744
1745
|
api_key: "",
|
|
1745
1746
|
// @ts-expect-error
|
|
1746
1747
|
env: t.env === "internal" ? "internal" : "production"
|
|
1747
1748
|
}), x(() => {
|
|
1748
|
-
|
|
1749
|
+
V(d.getPayModalUrl(e));
|
|
1749
1750
|
}, [e]), x(() => {
|
|
1750
|
-
const
|
|
1751
|
-
|
|
1752
|
-
|
|
1753
|
-
|
|
1751
|
+
const S = s?.theme;
|
|
1752
|
+
if (console.log({
|
|
1753
|
+
themeValue: S
|
|
1754
|
+
}), !S || qs.includes(S)) {
|
|
1755
|
+
T(null);
|
|
1756
|
+
return;
|
|
1757
|
+
}
|
|
1758
|
+
let D = !1;
|
|
1759
|
+
return (async () => {
|
|
1760
|
+
try {
|
|
1761
|
+
const G = d.getBaseUrl(), Re = await fetch(`${G}/themes/${S}`);
|
|
1762
|
+
if (!Re.ok) return;
|
|
1763
|
+
const X = await Re.json();
|
|
1764
|
+
!D && X.status === "approved" && X.css_content && T(X.css_content);
|
|
1765
|
+
} catch (G) {
|
|
1766
|
+
console.error("Failed to fetch theme:", G);
|
|
1767
|
+
} finally {
|
|
1768
|
+
console.log({
|
|
1769
|
+
themeCss: m
|
|
1770
|
+
});
|
|
1771
|
+
}
|
|
1772
|
+
})(), () => {
|
|
1773
|
+
D = !0;
|
|
1754
1774
|
};
|
|
1755
|
-
|
|
1756
|
-
|
|
1775
|
+
}, [s?.theme]), x(() => {
|
|
1776
|
+
const S = document.body.style.overflow;
|
|
1777
|
+
o ? (document.body.style.overflow = "hidden", document.body.style.overflow = "hidden") : document.body.style.overflow = S || "";
|
|
1778
|
+
const D = (Y) => {
|
|
1779
|
+
Y.data === "closed" && (a(), u?.()), Y.data === "completed" && (window.setTimeout(a, 2e3), l?.());
|
|
1780
|
+
};
|
|
1781
|
+
return window.addEventListener("message", D), () => {
|
|
1782
|
+
document.body.style.overflow = S || "", window.removeEventListener("message", D);
|
|
1757
1783
|
};
|
|
1758
1784
|
}, [o, u, l]), x(() => {
|
|
1759
1785
|
if (!E) return;
|
|
1760
|
-
const
|
|
1786
|
+
const S = t.css || m || void 0;
|
|
1787
|
+
console.log({
|
|
1788
|
+
cssToSend: S
|
|
1789
|
+
});
|
|
1790
|
+
const D = {
|
|
1761
1791
|
type: "session",
|
|
1762
1792
|
session_token: E,
|
|
1763
|
-
environment:
|
|
1793
|
+
environment: d.getEnv() || ge.PRODUCTION,
|
|
1764
1794
|
styles: s,
|
|
1765
1795
|
props: {
|
|
1766
1796
|
excludeChains: n?.join(",")
|
|
1767
1797
|
},
|
|
1768
|
-
|
|
1769
|
-
|
|
1770
|
-
css: t.css
|
|
1798
|
+
...S ? {
|
|
1799
|
+
css: S
|
|
1771
1800
|
} : {}
|
|
1772
1801
|
};
|
|
1773
|
-
|
|
1774
|
-
|
|
1802
|
+
g.current?.contentWindow?.postMessage(D, "https://app.chainrails.io"), g.current?.contentWindow?.postMessage(D, "https://chainrails-frontend-git-staging-horus-labs.vercel.app"), window.setTimeout(() => {
|
|
1803
|
+
g.current?.contentWindow?.postMessage(D, "https://app.chainrails.io"), g.current?.contentWindow?.postMessage(D, "https://chainrails-frontend-git-staging-horus-labs.vercel.app");
|
|
1775
1804
|
}, 1e3);
|
|
1776
|
-
}, [E,
|
|
1777
|
-
function
|
|
1805
|
+
}, [E, h, o, s, m]);
|
|
1806
|
+
function A() {
|
|
1778
1807
|
y(Math.random());
|
|
1779
1808
|
}
|
|
1780
|
-
return /* @__PURE__ */
|
|
1781
|
-
className:
|
|
1782
|
-
children: [(
|
|
1809
|
+
return /* @__PURE__ */ Ae("div", {
|
|
1810
|
+
className: zs("payment-modal-wrapper", h === 0 || i ? "loading" : "not-loading", o ? "open" : "closed"),
|
|
1811
|
+
children: [(h === 0 || i) && /* @__PURE__ */ _("div", {
|
|
1783
1812
|
role: "status",
|
|
1784
1813
|
className: "payment-modal-loader",
|
|
1785
|
-
children: /* @__PURE__ */
|
|
1814
|
+
children: /* @__PURE__ */ Ae("svg", {
|
|
1786
1815
|
"aria-hidden": "true",
|
|
1787
1816
|
className: "icon",
|
|
1788
1817
|
viewBox: "0 0 100 101",
|
|
1789
1818
|
fill: "none",
|
|
1790
1819
|
xmlns: "http://www.w3.org/2000/svg",
|
|
1791
|
-
children: [/* @__PURE__ */
|
|
1820
|
+
children: [/* @__PURE__ */ _("path", {
|
|
1792
1821
|
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",
|
|
1793
1822
|
fill: "currentColor"
|
|
1794
|
-
}), /* @__PURE__ */
|
|
1823
|
+
}), /* @__PURE__ */ _("path", {
|
|
1795
1824
|
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",
|
|
1796
1825
|
fill: "currentFill"
|
|
1797
1826
|
})]
|
|
1798
1827
|
})
|
|
1799
|
-
}), /* @__PURE__ */
|
|
1828
|
+
}), /* @__PURE__ */ _("iframe", {
|
|
1800
1829
|
allow: "clipboard-read *; clipboard-write *",
|
|
1801
|
-
src:
|
|
1802
|
-
onLoad:
|
|
1803
|
-
className: `payment-modal ${
|
|
1830
|
+
src: C || void 0,
|
|
1831
|
+
onLoad: A,
|
|
1832
|
+
className: `payment-modal ${h === 0 || i ? "invisible" : "visible"}`,
|
|
1804
1833
|
"data-id": e,
|
|
1805
|
-
ref:
|
|
1834
|
+
ref: g
|
|
1806
1835
|
}, e)]
|
|
1807
1836
|
});
|
|
1808
1837
|
}
|
|
1809
|
-
const
|
|
1810
|
-
let
|
|
1811
|
-
const
|
|
1838
|
+
const Ks = Symbol(), pe = Symbol(), B = "a", dt = "f", Le = "p", ft = "c", ht = "t", ye = "h", M = "w", Te = "o", be = "k";
|
|
1839
|
+
let Ws = (t, e) => new Proxy(t, e);
|
|
1840
|
+
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) => {
|
|
1812
1841
|
if (Array.isArray(t))
|
|
1813
1842
|
return Array.from(t);
|
|
1814
1843
|
const e = Object.getOwnPropertyDescriptors(t);
|
|
1815
1844
|
return Object.values(e).forEach((s) => {
|
|
1816
1845
|
s.configurable = !0;
|
|
1817
|
-
}), Object.create(
|
|
1818
|
-
},
|
|
1846
|
+
}), Object.create(ce(t), e);
|
|
1847
|
+
}, Gs = (t, e) => {
|
|
1819
1848
|
const s = {
|
|
1820
|
-
[
|
|
1849
|
+
[dt]: e
|
|
1821
1850
|
};
|
|
1822
1851
|
let n = !1;
|
|
1823
1852
|
const o = (a, u) => {
|
|
1824
1853
|
if (!n) {
|
|
1825
|
-
let l = s[
|
|
1826
|
-
if (l || (l = {}, s[
|
|
1827
|
-
l[
|
|
1854
|
+
let l = s[B].get(t);
|
|
1855
|
+
if (l || (l = {}, s[B].set(t, l)), a === M)
|
|
1856
|
+
l[M] = !0;
|
|
1828
1857
|
else {
|
|
1829
|
-
let
|
|
1830
|
-
|
|
1858
|
+
let f = l[a];
|
|
1859
|
+
f || (f = /* @__PURE__ */ new Set(), l[a] = f), f.add(u);
|
|
1831
1860
|
}
|
|
1832
1861
|
}
|
|
1833
1862
|
}, i = () => {
|
|
1834
|
-
n = !0, s[
|
|
1863
|
+
n = !0, s[B].delete(t);
|
|
1835
1864
|
}, r = {
|
|
1836
1865
|
get(a, u) {
|
|
1837
|
-
return u ===
|
|
1866
|
+
return u === pe ? t : (o(be, u), gt(Reflect.get(a, u), s[B], s[ft], s[ht]));
|
|
1838
1867
|
},
|
|
1839
1868
|
has(a, u) {
|
|
1840
|
-
return u ===
|
|
1869
|
+
return u === Ks ? (i(), !0) : (o(ye, u), Reflect.has(a, u));
|
|
1841
1870
|
},
|
|
1842
1871
|
getOwnPropertyDescriptor(a, u) {
|
|
1843
|
-
return o(
|
|
1872
|
+
return o(Te, u), Reflect.getOwnPropertyDescriptor(a, u);
|
|
1844
1873
|
},
|
|
1845
1874
|
ownKeys(a) {
|
|
1846
|
-
return o(
|
|
1875
|
+
return o(M), Reflect.ownKeys(a);
|
|
1847
1876
|
}
|
|
1848
1877
|
};
|
|
1849
1878
|
return e && (r.set = r.deleteProperty = () => !1), [r, s];
|
|
1850
|
-
},
|
|
1879
|
+
}, Ee = (t) => (
|
|
1851
1880
|
// unwrap proxy
|
|
1852
|
-
t[
|
|
1881
|
+
t[pe] || // otherwise
|
|
1853
1882
|
t
|
|
1854
|
-
),
|
|
1855
|
-
if (!
|
|
1883
|
+
), gt = (t, e, s, n) => {
|
|
1884
|
+
if (!mt(t))
|
|
1856
1885
|
return t;
|
|
1857
1886
|
let o = n && n.get(t);
|
|
1858
1887
|
if (!o) {
|
|
1859
|
-
const u =
|
|
1860
|
-
|
|
1888
|
+
const u = Ee(t);
|
|
1889
|
+
Vs(u) ? o = [u, Ys(u)] : o = [u], n?.set(t, o);
|
|
1861
1890
|
}
|
|
1862
1891
|
const [i, r] = o;
|
|
1863
1892
|
let a = s && s.get(i);
|
|
1864
|
-
return (!a || a[1][
|
|
1865
|
-
},
|
|
1893
|
+
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];
|
|
1894
|
+
}, Xs = (t, e) => {
|
|
1866
1895
|
const s = Reflect.ownKeys(t), n = Reflect.ownKeys(e);
|
|
1867
1896
|
return s.length !== n.length || s.some((o, i) => o !== n[i]);
|
|
1868
|
-
},
|
|
1897
|
+
}, pt = (t, e, s, n, o = Object.is) => {
|
|
1869
1898
|
if (o(t, e))
|
|
1870
1899
|
return !1;
|
|
1871
1900
|
if (!z(t) || !z(e))
|
|
1872
1901
|
return !0;
|
|
1873
|
-
const i = s.get(
|
|
1902
|
+
const i = s.get(Ee(t));
|
|
1874
1903
|
if (!i)
|
|
1875
1904
|
return !0;
|
|
1876
1905
|
if (n) {
|
|
@@ -1879,57 +1908,57 @@ const oe = Object.getPrototypeOf, re = /* @__PURE__ */ new WeakMap(), ut = (t) =
|
|
|
1879
1908
|
n.set(t, e);
|
|
1880
1909
|
}
|
|
1881
1910
|
let r = null;
|
|
1882
|
-
for (const a of i[
|
|
1911
|
+
for (const a of i[ye] || [])
|
|
1883
1912
|
if (r = Reflect.has(t, a) !== Reflect.has(e, a), r)
|
|
1884
1913
|
return r;
|
|
1885
|
-
if (i[
|
|
1886
|
-
if (r =
|
|
1914
|
+
if (i[M] === !0) {
|
|
1915
|
+
if (r = Xs(t, e), r)
|
|
1887
1916
|
return r;
|
|
1888
1917
|
} else
|
|
1889
|
-
for (const a of i[
|
|
1918
|
+
for (const a of i[Te] || []) {
|
|
1890
1919
|
const u = !!Reflect.getOwnPropertyDescriptor(t, a), l = !!Reflect.getOwnPropertyDescriptor(e, a);
|
|
1891
1920
|
if (r = u !== l, r)
|
|
1892
1921
|
return r;
|
|
1893
1922
|
}
|
|
1894
|
-
for (const a of i[
|
|
1895
|
-
if (r =
|
|
1923
|
+
for (const a of i[be] || [])
|
|
1924
|
+
if (r = pt(t[a], e[a], s, n, o), r)
|
|
1896
1925
|
return r;
|
|
1897
1926
|
if (r === null)
|
|
1898
1927
|
throw new Error("invalid used");
|
|
1899
1928
|
return r;
|
|
1900
|
-
},
|
|
1901
|
-
|
|
1902
|
-
},
|
|
1929
|
+
}, Js = (t) => mt(t) && t[pe] || null, _e = (t, e = !0) => {
|
|
1930
|
+
ue.set(t, e);
|
|
1931
|
+
}, Zs = (t, e, s) => {
|
|
1903
1932
|
const n = [], o = /* @__PURE__ */ new WeakSet(), i = (r, a) => {
|
|
1904
|
-
var u, l,
|
|
1933
|
+
var u, l, f;
|
|
1905
1934
|
if (o.has(r))
|
|
1906
1935
|
return;
|
|
1907
1936
|
z(r) && o.add(r);
|
|
1908
|
-
const E = z(r) && e.get(
|
|
1937
|
+
const E = z(r) && e.get(Ee(r));
|
|
1909
1938
|
if (E) {
|
|
1910
|
-
if ((u = E[
|
|
1911
|
-
const y = `:has(${String(
|
|
1939
|
+
if ((u = E[ye]) === null || u === void 0 || u.forEach((h) => {
|
|
1940
|
+
const y = `:has(${String(h)})`;
|
|
1912
1941
|
n.push(a ? [...a, y] : [y]);
|
|
1913
|
-
}), E[
|
|
1914
|
-
const
|
|
1915
|
-
n.push(a ? [...a,
|
|
1942
|
+
}), E[M] === !0) {
|
|
1943
|
+
const h = ":ownKeys";
|
|
1944
|
+
n.push(a ? [...a, h] : [h]);
|
|
1916
1945
|
} else
|
|
1917
|
-
(l = E[
|
|
1918
|
-
const y = `:hasOwn(${String(
|
|
1946
|
+
(l = E[Te]) === null || l === void 0 || l.forEach((h) => {
|
|
1947
|
+
const y = `:hasOwn(${String(h)})`;
|
|
1919
1948
|
n.push(a ? [...a, y] : [y]);
|
|
1920
1949
|
});
|
|
1921
|
-
(
|
|
1922
|
-
"value" in (Object.getOwnPropertyDescriptor(r,
|
|
1950
|
+
(f = E[be]) === null || f === void 0 || f.forEach((h) => {
|
|
1951
|
+
"value" in (Object.getOwnPropertyDescriptor(r, h) || {}) && i(r[h], a ? [...a, h] : [h]);
|
|
1923
1952
|
});
|
|
1924
1953
|
} else a && n.push(a);
|
|
1925
1954
|
};
|
|
1926
1955
|
return i(t), n;
|
|
1927
|
-
},
|
|
1928
|
-
const s =
|
|
1956
|
+
}, 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) => {
|
|
1957
|
+
const s = Fe.get(t);
|
|
1929
1958
|
if (s?.[0] === e)
|
|
1930
1959
|
return s[1];
|
|
1931
1960
|
const n = Array.isArray(t) ? [] : Object.create(Object.getPrototypeOf(t));
|
|
1932
|
-
return
|
|
1961
|
+
return _e(n, !0), Fe.set(t, [e, n]), Reflect.ownKeys(t).forEach((o) => {
|
|
1933
1962
|
if (Object.getOwnPropertyDescriptor(n, o))
|
|
1934
1963
|
return;
|
|
1935
1964
|
const i = Reflect.get(t, o), { enumerable: r } = Reflect.getOwnPropertyDescriptor(
|
|
@@ -1942,17 +1971,17 @@ const oe = Object.getPrototypeOf, re = /* @__PURE__ */ new WeakMap(), ut = (t) =
|
|
|
1942
1971
|
// It's still non-writable, so it avoids assigning a value.
|
|
1943
1972
|
configurable: !0
|
|
1944
1973
|
};
|
|
1945
|
-
if (
|
|
1946
|
-
|
|
1947
|
-
else if (
|
|
1948
|
-
const [u, l] =
|
|
1974
|
+
if (we.has(i))
|
|
1975
|
+
_e(i, !1);
|
|
1976
|
+
else if (N.has(i)) {
|
|
1977
|
+
const [u, l] = N.get(
|
|
1949
1978
|
i
|
|
1950
1979
|
);
|
|
1951
|
-
a.value =
|
|
1980
|
+
a.value = yt(u, l());
|
|
1952
1981
|
}
|
|
1953
1982
|
Object.defineProperty(n, o, a);
|
|
1954
1983
|
}), Object.preventExtensions(n);
|
|
1955
|
-
},
|
|
1984
|
+
}, en = (t, e, s, n) => ({
|
|
1956
1985
|
deleteProperty(o, i) {
|
|
1957
1986
|
const r = Reflect.get(o, i);
|
|
1958
1987
|
s(i);
|
|
@@ -1961,81 +1990,81 @@ const oe = Object.getPrototypeOf, re = /* @__PURE__ */ new WeakMap(), ut = (t) =
|
|
|
1961
1990
|
},
|
|
1962
1991
|
set(o, i, r, a) {
|
|
1963
1992
|
const u = !t() && Reflect.has(o, i), l = Reflect.get(o, i, a);
|
|
1964
|
-
if (u && (
|
|
1993
|
+
if (u && (He(l, r) || K.has(r) && He(l, K.get(r))))
|
|
1965
1994
|
return !0;
|
|
1966
|
-
s(i),
|
|
1967
|
-
const
|
|
1968
|
-
return e(i,
|
|
1969
|
-
}
|
|
1970
|
-
}),
|
|
1971
|
-
let
|
|
1972
|
-
function
|
|
1973
|
-
if (!
|
|
1995
|
+
s(i), Se(r) && (r = Js(r) || r);
|
|
1996
|
+
const f = !N.has(r) && sn(r) ? Tt(r) : r;
|
|
1997
|
+
return e(i, f), Reflect.set(o, i, f, a), n(["set", [i], r, l]), !0;
|
|
1998
|
+
}
|
|
1999
|
+
}), N = /* @__PURE__ */ new WeakMap(), we = /* @__PURE__ */ new WeakSet(), Fe = /* @__PURE__ */ new WeakMap(), ne = [1], K = /* @__PURE__ */ new WeakMap();
|
|
2000
|
+
let He = Object.is, tn = (t, e) => new Proxy(t, e), sn = Qs, nn = yt, on = en;
|
|
2001
|
+
function Tt(t = {}) {
|
|
2002
|
+
if (!Se(t))
|
|
1974
2003
|
throw new Error("object required");
|
|
1975
|
-
const e =
|
|
2004
|
+
const e = K.get(t);
|
|
1976
2005
|
if (e)
|
|
1977
2006
|
return e;
|
|
1978
|
-
let s =
|
|
1979
|
-
const n = /* @__PURE__ */ new Set(), o = (
|
|
1980
|
-
s !==
|
|
2007
|
+
let s = ne[0];
|
|
2008
|
+
const n = /* @__PURE__ */ new Set(), o = (m, T = ++ne[0]) => {
|
|
2009
|
+
s !== T && (i = s = T, n.forEach((g) => g(m, T)));
|
|
1981
2010
|
};
|
|
1982
2011
|
let i = s;
|
|
1983
|
-
const r = (
|
|
1984
|
-
const
|
|
1985
|
-
|
|
1986
|
-
})), s), a = (
|
|
1987
|
-
const
|
|
1988
|
-
|
|
1989
|
-
}, u = /* @__PURE__ */ new Map(), l = (
|
|
1990
|
-
const
|
|
1991
|
-
if (
|
|
1992
|
-
if ((
|
|
2012
|
+
const r = (m = ne[0]) => (i !== m && (i = m, u.forEach(([T]) => {
|
|
2013
|
+
const g = T[1](m);
|
|
2014
|
+
g > s && (s = g);
|
|
2015
|
+
})), s), a = (m) => (T, g) => {
|
|
2016
|
+
const A = [...T];
|
|
2017
|
+
A[1] = [m, ...A[1]], o(A, g);
|
|
2018
|
+
}, u = /* @__PURE__ */ new Map(), l = (m, T) => {
|
|
2019
|
+
const g = !we.has(T) && N.get(T);
|
|
2020
|
+
if (g) {
|
|
2021
|
+
if ((q ? "production" : void 0) !== "production" && u.has(m))
|
|
1993
2022
|
throw new Error("prop listener already exists");
|
|
1994
2023
|
if (n.size) {
|
|
1995
|
-
const
|
|
1996
|
-
u.set(
|
|
2024
|
+
const A = g[2](a(m));
|
|
2025
|
+
u.set(m, [g, A]);
|
|
1997
2026
|
} else
|
|
1998
|
-
u.set(
|
|
2027
|
+
u.set(m, [g]);
|
|
1999
2028
|
}
|
|
2000
|
-
},
|
|
2001
|
-
var
|
|
2002
|
-
const
|
|
2003
|
-
|
|
2004
|
-
}, E = (
|
|
2005
|
-
if ((
|
|
2029
|
+
}, f = (m) => {
|
|
2030
|
+
var T;
|
|
2031
|
+
const g = u.get(m);
|
|
2032
|
+
g && (u.delete(m), (T = g[1]) == null || T.call(g));
|
|
2033
|
+
}, E = (m) => (n.add(m), n.size === 1 && u.forEach(([g, A], S) => {
|
|
2034
|
+
if ((q ? "production" : void 0) !== "production" && A)
|
|
2006
2035
|
throw new Error("remove already exists");
|
|
2007
|
-
const
|
|
2008
|
-
u.set(
|
|
2036
|
+
const D = g[2](a(S));
|
|
2037
|
+
u.set(S, [g, D]);
|
|
2009
2038
|
}), () => {
|
|
2010
|
-
n.delete(
|
|
2011
|
-
|
|
2039
|
+
n.delete(m), n.size === 0 && u.forEach(([g, A], S) => {
|
|
2040
|
+
A && (A(), u.set(S, [g]));
|
|
2012
2041
|
});
|
|
2013
2042
|
});
|
|
2014
|
-
let
|
|
2015
|
-
const y =
|
|
2016
|
-
() =>
|
|
2043
|
+
let h = !0;
|
|
2044
|
+
const y = on(
|
|
2045
|
+
() => h,
|
|
2017
2046
|
l,
|
|
2018
|
-
|
|
2047
|
+
f,
|
|
2019
2048
|
o
|
|
2020
|
-
),
|
|
2021
|
-
|
|
2022
|
-
const
|
|
2023
|
-
return
|
|
2024
|
-
const
|
|
2049
|
+
), C = tn(t, y);
|
|
2050
|
+
K.set(t, C);
|
|
2051
|
+
const V = [t, r, E];
|
|
2052
|
+
return N.set(C, V), Reflect.ownKeys(t).forEach((m) => {
|
|
2053
|
+
const T = Object.getOwnPropertyDescriptor(
|
|
2025
2054
|
t,
|
|
2026
|
-
|
|
2055
|
+
m
|
|
2027
2056
|
);
|
|
2028
|
-
"value" in
|
|
2029
|
-
}),
|
|
2057
|
+
"value" in T && T.writable && (C[m] = t[m]);
|
|
2058
|
+
}), h = !1, C;
|
|
2030
2059
|
}
|
|
2031
|
-
function
|
|
2032
|
-
const n =
|
|
2033
|
-
(
|
|
2060
|
+
function rn(t, e, s) {
|
|
2061
|
+
const n = N.get(t);
|
|
2062
|
+
(q ? "production" : void 0) !== "production" && !n && console.warn("Please use proxy object");
|
|
2034
2063
|
let o;
|
|
2035
2064
|
const i = [], r = n[2];
|
|
2036
2065
|
let a = !1;
|
|
2037
|
-
const l = r((
|
|
2038
|
-
i.push(
|
|
2066
|
+
const l = r((f) => {
|
|
2067
|
+
i.push(f), o || (o = Promise.resolve().then(() => {
|
|
2039
2068
|
o = void 0, a && e(i.splice(0));
|
|
2040
2069
|
}));
|
|
2041
2070
|
});
|
|
@@ -2043,36 +2072,36 @@ function en(t, e, s) {
|
|
|
2043
2072
|
a = !1, l();
|
|
2044
2073
|
};
|
|
2045
2074
|
}
|
|
2046
|
-
function
|
|
2047
|
-
const e =
|
|
2048
|
-
(
|
|
2075
|
+
function $e(t) {
|
|
2076
|
+
const e = N.get(t);
|
|
2077
|
+
(q ? "production" : void 0) !== "production" && !e && console.warn("Please use proxy object");
|
|
2049
2078
|
const [s, n] = e;
|
|
2050
|
-
return
|
|
2079
|
+
return nn(s, n());
|
|
2051
2080
|
}
|
|
2052
|
-
const
|
|
2053
|
-
const s =
|
|
2081
|
+
const an = {}, cn = (t, e) => {
|
|
2082
|
+
const s = le(void 0);
|
|
2054
2083
|
x(() => {
|
|
2055
|
-
s.current =
|
|
2056
|
-
}),
|
|
2057
|
-
},
|
|
2058
|
-
function
|
|
2059
|
-
const n =
|
|
2084
|
+
s.current = Zs(t, e);
|
|
2085
|
+
}), wt(s.current);
|
|
2086
|
+
}, un = cn, ln = /* @__PURE__ */ new WeakMap();
|
|
2087
|
+
function dn(t, e) {
|
|
2088
|
+
const n = Ce(
|
|
2060
2089
|
() => t && /* @__PURE__ */ new WeakMap(),
|
|
2061
2090
|
[t]
|
|
2062
|
-
), o =
|
|
2091
|
+
), o = le(void 0);
|
|
2063
2092
|
let i = !0;
|
|
2064
|
-
const r =
|
|
2065
|
-
|
|
2093
|
+
const r = bt(
|
|
2094
|
+
Et(
|
|
2066
2095
|
(u) => {
|
|
2067
|
-
const l =
|
|
2096
|
+
const l = rn(t, u);
|
|
2068
2097
|
return u(), l;
|
|
2069
2098
|
},
|
|
2070
2099
|
[t, void 0]
|
|
2071
2100
|
),
|
|
2072
2101
|
() => {
|
|
2073
|
-
const u =
|
|
2102
|
+
const u = $e(t);
|
|
2074
2103
|
try {
|
|
2075
|
-
if (!i && o.current && !
|
|
2104
|
+
if (!i && o.current && !pt(
|
|
2076
2105
|
o.current,
|
|
2077
2106
|
u,
|
|
2078
2107
|
n,
|
|
@@ -2083,26 +2112,26 @@ function rn(t, e) {
|
|
|
2083
2112
|
}
|
|
2084
2113
|
return u;
|
|
2085
2114
|
},
|
|
2086
|
-
() =>
|
|
2115
|
+
() => $e(t)
|
|
2087
2116
|
);
|
|
2088
|
-
i = !1,
|
|
2117
|
+
i = !1, St(() => {
|
|
2089
2118
|
o.current = r;
|
|
2090
|
-
}), (
|
|
2091
|
-
const a =
|
|
2092
|
-
return
|
|
2119
|
+
}), (an ? "production" : void 0) !== "production" && un(r, n);
|
|
2120
|
+
const a = Ce(() => /* @__PURE__ */ new WeakMap(), []);
|
|
2121
|
+
return gt(r, n, a, ln);
|
|
2093
2122
|
}
|
|
2094
|
-
const
|
|
2123
|
+
const v = Tt({
|
|
2095
2124
|
data: null,
|
|
2096
2125
|
isPending: !1,
|
|
2097
2126
|
error: null
|
|
2098
2127
|
});
|
|
2099
|
-
function
|
|
2128
|
+
function yn({
|
|
2100
2129
|
session_url: t,
|
|
2101
2130
|
onCancel: e,
|
|
2102
2131
|
onSuccess: s
|
|
2103
2132
|
}) {
|
|
2104
|
-
const n =
|
|
2105
|
-
function
|
|
2133
|
+
const n = dn(v), [o, i] = k(!1), [r, a] = k(Date.now()), u = n?.data?.sessionToken, l = n?.data?.amount;
|
|
2134
|
+
function f() {
|
|
2106
2135
|
u || window.setTimeout(() => {
|
|
2107
2136
|
u && i(!0);
|
|
2108
2137
|
}, 200), i(!0);
|
|
@@ -2110,46 +2139,46 @@ function fn({
|
|
|
2110
2139
|
function E() {
|
|
2111
2140
|
i(!1);
|
|
2112
2141
|
}
|
|
2113
|
-
const
|
|
2142
|
+
const h = () => {
|
|
2114
2143
|
const y = Date.now();
|
|
2115
|
-
|
|
2144
|
+
v.isPending = !0, v.error = null, v.data = null, fetch(t, {
|
|
2116
2145
|
headers: {
|
|
2117
2146
|
"Content-Type": "application/json"
|
|
2118
2147
|
}
|
|
2119
|
-
}).then((
|
|
2120
|
-
y < r || (
|
|
2121
|
-
}).catch((
|
|
2122
|
-
y < r || (
|
|
2148
|
+
}).then((C) => C.json()).then((C) => {
|
|
2149
|
+
y < r || (v.data = C, v.isPending = !1, a(y));
|
|
2150
|
+
}).catch((C) => {
|
|
2151
|
+
y < r || (v.error = C?.toString(), v.isPending = !1, a(y), setInterval(h, 5e3));
|
|
2123
2152
|
});
|
|
2124
2153
|
};
|
|
2125
2154
|
return x(() => {
|
|
2126
|
-
|
|
2155
|
+
h();
|
|
2127
2156
|
}, [t]), {
|
|
2128
2157
|
sessionToken: u,
|
|
2129
2158
|
amount: l,
|
|
2130
2159
|
isOpen: o,
|
|
2131
2160
|
session_url: t,
|
|
2132
|
-
open:
|
|
2161
|
+
open: f,
|
|
2133
2162
|
close: E,
|
|
2134
2163
|
isPending: n.isPending,
|
|
2135
2164
|
error: n.error,
|
|
2136
|
-
refetch:
|
|
2165
|
+
refetch: h,
|
|
2137
2166
|
onSuccess: s,
|
|
2138
2167
|
onCancel: e
|
|
2139
2168
|
};
|
|
2140
2169
|
}
|
|
2141
|
-
function
|
|
2170
|
+
function Tn({
|
|
2142
2171
|
sessionToken: t,
|
|
2143
2172
|
amount: e,
|
|
2144
2173
|
onCancel: s,
|
|
2145
2174
|
onSuccess: n
|
|
2146
2175
|
}) {
|
|
2147
|
-
const [o, i] =
|
|
2148
|
-
function
|
|
2176
|
+
const [o, i] = k(!1), [r, a] = k(t), [u, l] = k(e);
|
|
2177
|
+
function f({
|
|
2149
2178
|
sessionToken: y,
|
|
2150
|
-
amount:
|
|
2179
|
+
amount: C
|
|
2151
2180
|
}) {
|
|
2152
|
-
a(y), l(
|
|
2181
|
+
a(y), l(C);
|
|
2153
2182
|
}
|
|
2154
2183
|
x(() => {
|
|
2155
2184
|
a(t);
|
|
@@ -2159,26 +2188,26 @@ function hn({
|
|
|
2159
2188
|
r && i(!0);
|
|
2160
2189
|
}, 200), i(!0);
|
|
2161
2190
|
}
|
|
2162
|
-
function
|
|
2191
|
+
function h() {
|
|
2163
2192
|
i(!1);
|
|
2164
2193
|
}
|
|
2165
2194
|
return {
|
|
2166
2195
|
sessionToken: r,
|
|
2167
|
-
updateSession:
|
|
2196
|
+
updateSession: f,
|
|
2168
2197
|
amount: u,
|
|
2169
2198
|
isOpen: o,
|
|
2170
2199
|
open: E,
|
|
2171
|
-
close:
|
|
2200
|
+
close: h,
|
|
2172
2201
|
onSuccess: n,
|
|
2173
2202
|
onCancel: s
|
|
2174
2203
|
};
|
|
2175
2204
|
}
|
|
2176
2205
|
export {
|
|
2177
2206
|
c as AmountSymbols,
|
|
2178
|
-
|
|
2179
|
-
|
|
2180
|
-
|
|
2181
|
-
|
|
2182
|
-
|
|
2183
|
-
|
|
2207
|
+
d as Chainrails,
|
|
2208
|
+
mn as Chains,
|
|
2209
|
+
pn as PaymentModal,
|
|
2210
|
+
gn as crapi,
|
|
2211
|
+
Tn as usePaymentModal,
|
|
2212
|
+
yn as usePaymentSession
|
|
2184
2213
|
};
|