@argent/x-shared 1.30.0 → 1.31.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,2644 @@
1
+ import { z as e } from "zod";
2
+ import { validateChecksumAddress as Cr, validateAndParseAddress as Dr, getChecksumAddress as Pr, num as be, constants as xe, CairoCustomEnum as jr, uint256 as Qe, hash as Nt } from "starknet";
3
+ import { memoize as Pt, noop as kr, isString as Ur, isEmpty as Fr } from "lodash-es";
4
+ import "@scure/base";
5
+ import { jsx as xr } from "react/jsx-runtime";
6
+ import { createContext as Br, useContext as Mr, useEffect as Gr } from "react";
7
+ import "object-hash";
8
+ import "swr";
9
+ function Vr(t, o) {
10
+ let [E, T = ""] = t.split(".");
11
+ const N = E.startsWith("-");
12
+ return N && (E = E.slice(1)), T.length > o ? Number(T[o]) >= 5 ? T = (BigInt(T.slice(0, o)) + 1n).toString().padStart(o, "0") : T = T.slice(0, o) : T = T.padEnd(o, "0"), {
13
+ value: BigInt(`${N ? "-" : ""}${E}${T}`),
14
+ decimals: o
15
+ };
16
+ }
17
+ const jt = e.string().refine((t) => {
18
+ if (t.toLowerCase() === t)
19
+ return !0;
20
+ try {
21
+ return Cr(t) && Wr(t);
22
+ } catch {
23
+ }
24
+ return !1;
25
+ }, "Invalid address (checksum error)"), $r = e.string().refine((t) => {
26
+ try {
27
+ return Dr(t);
28
+ } catch {
29
+ }
30
+ return !1;
31
+ }, "Invalid address (validation error)"), Ve = e.string().regex(/^0x[0-9a-fA-F]+$/, "Invalid address"), Xr = Ve.min(50, "Addresses must at least be 50 characters long").max(66, "Addresses must at most be 66 characters long"), Hr = Ve.length(66, "Address must be 66 characters long"), K = Xr.pipe(jt).transform((t) => `0x${(t.startsWith("0x") ? t.slice(2) : t).padStart(64, "0")}`), ka = K.or(e.literal("")).transform((t) => t === "" ? void 0 : t).optional(), H = Ve.transform((t) => `0x${t.replace(/^0x/, "").toLowerCase().padStart(64, "0")}`), zr = (t) => K.safeParse(t).success, qr = zr, $e = (t) => Pr(t), Ua = (t) => {
32
+ const o = $e(t), E = o.slice(0, 2), T = o.slice(2, 6), N = o.slice(-4);
33
+ return `${E}${T}…${N}`;
34
+ }, Fa = (t) => {
35
+ const o = $e(t), E = o.slice(0, 2), N = o.slice(2).match(/.{1,4}/g) || [];
36
+ return `${E} ${N.join(" ")}`;
37
+ }, Wr = (t) => !/^0x[0-9a-f]{63,64}$/.test(t), Kr = (t, o) => {
38
+ try {
39
+ return !t || !o ? !1 : be.hexToDecimalString(t) === be.hexToDecimalString(o);
40
+ } catch {
41
+ }
42
+ return !1;
43
+ }, Yr = (t) => {
44
+ try {
45
+ return be.toBigInt(Ve.parse(t)) === xe.ZERO;
46
+ } catch {
47
+ }
48
+ return !1;
49
+ }, xa = (t, o) => !!(o != null && o.some((E) => Kr(E, t))), Ba = Pt((t) => {
50
+ const o = t.slice(0, 6), E = t.slice(-4);
51
+ return `${o}…${E}`;
52
+ }), Ma = Pt((t, o) => {
53
+ if (t.length < o)
54
+ return t;
55
+ const E = Math.floor((o - 1) / 2), T = t.slice(0, E), N = t.slice(-E);
56
+ return `${T}…${N}`;
57
+ }), Ga = e.string().regex(/^[a-zA-Z0-9.-]*$/g, "Invalid address character").max(66, "Address cannot be over 66 characters"), Zr = Hr.pipe(jt).pipe($r), Xe = e.string().regex(/^([a-zA-Z0-9-]+\.)+argent.xyz$/, "Invalid Argent name").max(253, "Argent name cannot be over 253 characters"), Jr = (t) => Xe.safeParse(t).success, Qr = (t, o) => {
58
+ try {
59
+ return o ? et(t) === et(o) : !1;
60
+ } catch {
61
+ }
62
+ return !1;
63
+ }, et = (t) => Xe.parse(t).toLowerCase(), ht = e.string().regex(/^([a-zA-Z0-9-]+\.)+stark$/, "Invalid Starknet ID").max(50, "Starknet ID cannot be over 50 characters"), en = (t) => ht.safeParse(t).success, tn = (t, o) => {
64
+ try {
65
+ return o ? tt(t) === tt(o) : !1;
66
+ } catch {
67
+ }
68
+ return !1;
69
+ }, tt = (t) => ht.parse(t).toLowerCase(), mt = e.union([
70
+ Xe,
71
+ ht
72
+ ]), Va = e.union([
73
+ K,
74
+ mt
75
+ ]), $a = e.union([
76
+ Zr,
77
+ mt
78
+ ]), Xa = (t) => mt.safeParse(t).success, Ha = (t, o) => {
79
+ try {
80
+ return o ? Qr(t, o) || tn(t, o) : !1;
81
+ } catch {
82
+ }
83
+ return !1;
84
+ }, za = (t) => en(t) ? tt(t) : Jr(t) ? et(t) : $e(t), rn = e.union([e.literal("0"), e.literal("1")]), qa = "0x049d36570d4e46f48e99674bd3fcc84644ddd6b96f7c741b1562b82f9e004dc7", Wa = "0x04718f5a0fc34cc1af16a1cdee98ffb20c31f5cd61d6ab07201858f4287c938d", Ka = "0x1a736d6ed154502257f02b1ccdf4d9d1089f80811cd6acad48e6b6a9d1f2003", Ya = "0x036078334509b514626504edc9fb252328d1a240e4e948bef8d0c08dff45927f", Za = "0x737ee2f87ce571a58c6c8da558ec18a07ceb64a6172d5ec46171fbc80077a48", Ja = "0x6e150953b26271a740bf2b6e9bca17cc52c68d765f761295de51ceb8526ee72", Qa = "0x4d07e40e93398ed3c76981e72dd1fd22557a78ce36c0515f679e27f0bb5bc5f";
85
+ function nn(t) {
86
+ var o = [];
87
+ if (t.length === 0)
88
+ return "";
89
+ if (typeof t[0] != "string")
90
+ throw new TypeError("Url must be a string. Received " + t[0]);
91
+ if (t[0].match(/^[^/:]+:\/*$/) && t.length > 1) {
92
+ var E = t.shift();
93
+ t[0] = E + t[0];
94
+ }
95
+ t[0].match(/^file:\/\/\//) ? t[0] = t[0].replace(/^([^/:]+):\/*/, "$1:///") : t[0] = t[0].replace(/^([^/:]+):\/*/, "$1://");
96
+ for (var T = 0; T < t.length; T++) {
97
+ var N = t[T];
98
+ if (typeof N != "string")
99
+ throw new TypeError("Url must be a string. Received " + N);
100
+ N !== "" && (T > 0 && (N = N.replace(/^[\/]+/, "")), T < t.length - 1 ? N = N.replace(/[\/]+$/, "") : N = N.replace(/[\/]+$/, "/"), o.push(N));
101
+ }
102
+ var D = o.join("/");
103
+ D = D.replace(/\/(\?|&|#[^!])/g, "$1");
104
+ var w = D.split("?");
105
+ return D = w.shift() + (w.length > 0 ? "?" : "") + w.join("&"), D;
106
+ }
107
+ function an() {
108
+ var t;
109
+ return typeof arguments[0] == "object" ? t = arguments[0] : t = [].slice.call(arguments), nn(t);
110
+ }
111
+ class we extends Error {
112
+ constructor({ code: o, message: E, options: T = {} }, N) {
113
+ const { error: D, context: w } = T;
114
+ super(E, { cause: D }), this.errorMessages = N, this.name = "BaseError", this.context = w, this.code = o, this.setMessageByCode(o, E);
115
+ }
116
+ setMessageByCode(o, E) {
117
+ !o || !this.errorMessages || E || (this.message = this.errorMessages[o]);
118
+ }
119
+ }
120
+ var rt;
121
+ (function(t) {
122
+ t.NOT_VALID = "Invalid address", t.NOT_FOUND = "Address not found", t.STARKNAME_NOT_FOUND = "Stark name not found", t.STARKNAME_ERROR = "Could not get address from stark name", t.STARKNAME_INVALID_ADDRESS = "Stark name resolved to an invalid address", t.ARGENT_NAME_NOT_FOUND = "Argent name not found", t.NO_ADDRESS_FROM_ARGENT_NAME = "Could not get address from Argent name", t.ARGENT_NAME_INVALID_ADDRESS = "Argent name resolved to an invalid address", t.NO_ADDRESS_FROM_DOMAIN = "Could not get address from domain", t.ARGENT_NAME_INVALID_NETWORK = "Argent name is not enabled on the requested network";
123
+ })(rt || (rt = {}));
124
+ class ke extends we {
125
+ constructor(o) {
126
+ super(o, rt), this.name = "AddressError";
127
+ }
128
+ }
129
+ class dt extends Error {
130
+ constructor(o, E, T) {
131
+ super(o), this.status = E, this.data = T, Object.setPrototypeOf(this, dt.prototype);
132
+ }
133
+ }
134
+ var St;
135
+ (function(t) {
136
+ t.FAILED_TO_FETCH_URL = "Failed to fetch url", t.FAILED_TO_POST_URL = "Failed to post url";
137
+ })(St || (St = {}));
138
+ const ei = e.object({
139
+ walletAddress: H,
140
+ ens: Xe,
141
+ chain: e.enum(["ethereum", "starknet"]),
142
+ deleted: e.boolean(),
143
+ walletDeployed: e.boolean()
144
+ }).or(e.object({
145
+ status: e.string()
146
+ }));
147
+ async function ti(t, o, E, T = "starknet") {
148
+ const N = {
149
+ ens: t,
150
+ chain: T
151
+ }, D = new URLSearchParams(N), w = an(E, "wallet", `?${D}`);
152
+ try {
153
+ const k = await o.get(w), L = k && "walletAddress" in k ? k.walletAddress : void 0;
154
+ if (!L)
155
+ throw new ke({
156
+ code: "NO_ADDRESS_FROM_ARGENT_NAME"
157
+ });
158
+ if (Yr(L))
159
+ throw new ke({
160
+ code: "ARGENT_NAME_NOT_FOUND",
161
+ message: `${t} not found`
162
+ });
163
+ if (!qr(L))
164
+ throw new ke({
165
+ code: "ARGENT_NAME_INVALID_ADDRESS",
166
+ message: `${t} resolved to an invalid address (${L})`
167
+ });
168
+ return $e(L);
169
+ } catch (k) {
170
+ throw k instanceof dt && k.status === 404 ? new ke({
171
+ code: "ARGENT_NAME_NOT_FOUND",
172
+ message: `${t} not found`
173
+ }) : k;
174
+ }
175
+ }
176
+ var nt;
177
+ (function(t) {
178
+ t.NOT_VALID = "Invalid call";
179
+ })(nt || (nt = {}));
180
+ class ri extends we {
181
+ constructor(o) {
182
+ super(o, nt), this.name = "CallError";
183
+ }
184
+ }
185
+ var at;
186
+ (function(t) {
187
+ t.NO_NETWORK_OR_MULTICALL = "Missing networkId or multicall", t.NOT_FOUND = "Network not found";
188
+ })(at || (at = {}));
189
+ class ni extends we {
190
+ constructor(o) {
191
+ super(o, at), this.name = "NetworkError";
192
+ }
193
+ }
194
+ const De = e.union([e.string(), e.number(), e.bigint()]), sn = e.object({
195
+ low: De,
196
+ high: De
197
+ }), on = e.array(e.string()).and(e.object({
198
+ __compiled__: e.boolean().optional()
199
+ }).optional()), cn = e.lazy(() => e.array(e.union([Be, e.array(Be), gt]))), Be = e.union([
200
+ De,
201
+ sn,
202
+ e.any(),
203
+ e.boolean()
204
+ ]), ln = e.lazy(() => e.record(e.union([Be, e.array(Be), gt]))), gt = e.lazy(() => e.union([ln, cn])), un = e.lazy(() => e.object({
205
+ contractAddress: e.string(),
206
+ calldata: e.union([gt, on]).optional(),
207
+ entrypoint: e.string().optional()
208
+ })), bt = e.lazy(() => un.and(e.object({
209
+ entrypoint: e.string()
210
+ }))), he = e.string().refine((t) => typeof parseInt(t) == "number"), ai = e.tuple([he]), ii = e.tuple([he]), si = e.object({
211
+ new_threshold: e.string().refine((t) => typeof parseInt(t) == "number"),
212
+ signers_to_add: e.array(he)
213
+ }), oi = e.object({
214
+ new_threshold: e.string().refine((t) => typeof parseInt(t) == "number"),
215
+ signers_to_remove: e.array(he)
216
+ }), ci = e.object({
217
+ signer_to_remove: he,
218
+ signer_to_add: he
219
+ }), li = e.tuple([he]), ui = e.tuple([he]), fi = e.tuple([he]), pi = e.tuple([he]).rest(he), hi = e.object({
220
+ recipient: K,
221
+ amount: e.object({
222
+ low: De,
223
+ high: De
224
+ })
225
+ }), fn = e.string().regex(/^(0x)?[0-9a-fA-F]+$/, "Invalid hex string"), Me = fn.transform((t) => {
226
+ const o = t.startsWith("0x") ? t.slice(2) : t;
227
+ return `0x${o.length % 2 === 0 ? o : `0${o}`}`;
228
+ }), mi = e.object({
229
+ cairoVersion: rn,
230
+ accountClassHash: Me
231
+ }), pn = e.array(e.string()), di = e.object({
232
+ implementation: e.string(),
233
+ selector: Me,
234
+ calldata: pn
235
+ }), gi = e.object({
236
+ owner: e.string(),
237
+ guardian: e.string().optional().transform((t) => t ?? "0")
238
+ });
239
+ var Tt;
240
+ (function(t) {
241
+ t.Starknet = "Starknet", t.Secp256k1 = "Secp256k1", t.Secp256r1 = "Secp256r1", t.Eip191 = "Eip191", t.Webauthn = "Webauthn";
242
+ })(Tt || (Tt = {}));
243
+ function Ei(t, o) {
244
+ const E = {
245
+ Starknet: void 0,
246
+ Secp256k1: void 0,
247
+ Secp256r1: void 0,
248
+ Eip191: void 0,
249
+ Webauthn: void 0
250
+ };
251
+ return E[o] = t, new jr(E);
252
+ }
253
+ var it;
254
+ (function(t) {
255
+ t.NOT_FOUND = "Account not found", t.CALCULATED_ADDRESS_NO_MATCH = "Calculated address does not match account address";
256
+ })(it || (it = {}));
257
+ class Ii extends we {
258
+ constructor(o) {
259
+ super(o, it), this.name = "AccountError";
260
+ }
261
+ }
262
+ function hn(t) {
263
+ return t && t.__esModule && Object.prototype.hasOwnProperty.call(t, "default") ? t.default : t;
264
+ }
265
+ var st = { exports: {} };
266
+ (function(t, o) {
267
+ o = t.exports = j;
268
+ var E;
269
+ typeof process == "object" && process.env && process.env.NODE_DEBUG && /\bsemver\b/i.test(process.env.NODE_DEBUG) ? E = function() {
270
+ var r = Array.prototype.slice.call(arguments, 0);
271
+ r.unshift("SEMVER"), console.log.apply(console, r);
272
+ } : E = function() {
273
+ }, o.SEMVER_SPEC_VERSION = "2.0.0";
274
+ var T = 256, N = Number.MAX_SAFE_INTEGER || /* istanbul ignore next */
275
+ 9007199254740991, D = 16, w = T - 6, k = o.re = [], L = o.safeRe = [], A = o.src = [], d = o.tokens = {}, Y = 0;
276
+ function P(r) {
277
+ d[r] = Y++;
278
+ }
279
+ var fe = "[a-zA-Z0-9-]", ee = [
280
+ ["\\s", 1],
281
+ ["\\d", T],
282
+ [fe, w]
283
+ ];
284
+ function Ie(r) {
285
+ for (var s = 0; s < ee.length; s++) {
286
+ var l = ee[s][0], S = ee[s][1];
287
+ r = r.split(l + "*").join(l + "{0," + S + "}").split(l + "+").join(l + "{1," + S + "}");
288
+ }
289
+ return r;
290
+ }
291
+ P("NUMERICIDENTIFIER"), A[d.NUMERICIDENTIFIER] = "0|[1-9]\\d*", P("NUMERICIDENTIFIERLOOSE"), A[d.NUMERICIDENTIFIERLOOSE] = "\\d+", P("NONNUMERICIDENTIFIER"), A[d.NONNUMERICIDENTIFIER] = "\\d*[a-zA-Z-]" + fe + "*", P("MAINVERSION"), A[d.MAINVERSION] = "(" + A[d.NUMERICIDENTIFIER] + ")\\.(" + A[d.NUMERICIDENTIFIER] + ")\\.(" + A[d.NUMERICIDENTIFIER] + ")", P("MAINVERSIONLOOSE"), A[d.MAINVERSIONLOOSE] = "(" + A[d.NUMERICIDENTIFIERLOOSE] + ")\\.(" + A[d.NUMERICIDENTIFIERLOOSE] + ")\\.(" + A[d.NUMERICIDENTIFIERLOOSE] + ")", P("PRERELEASEIDENTIFIER"), A[d.PRERELEASEIDENTIFIER] = "(?:" + A[d.NUMERICIDENTIFIER] + "|" + A[d.NONNUMERICIDENTIFIER] + ")", P("PRERELEASEIDENTIFIERLOOSE"), A[d.PRERELEASEIDENTIFIERLOOSE] = "(?:" + A[d.NUMERICIDENTIFIERLOOSE] + "|" + A[d.NONNUMERICIDENTIFIER] + ")", P("PRERELEASE"), A[d.PRERELEASE] = "(?:-(" + A[d.PRERELEASEIDENTIFIER] + "(?:\\." + A[d.PRERELEASEIDENTIFIER] + ")*))", P("PRERELEASELOOSE"), A[d.PRERELEASELOOSE] = "(?:-?(" + A[d.PRERELEASEIDENTIFIERLOOSE] + "(?:\\." + A[d.PRERELEASEIDENTIFIERLOOSE] + ")*))", P("BUILDIDENTIFIER"), A[d.BUILDIDENTIFIER] = fe + "+", P("BUILD"), A[d.BUILD] = "(?:\\+(" + A[d.BUILDIDENTIFIER] + "(?:\\." + A[d.BUILDIDENTIFIER] + ")*))", P("FULL"), P("FULLPLAIN"), A[d.FULLPLAIN] = "v?" + A[d.MAINVERSION] + A[d.PRERELEASE] + "?" + A[d.BUILD] + "?", A[d.FULL] = "^" + A[d.FULLPLAIN] + "$", P("LOOSEPLAIN"), A[d.LOOSEPLAIN] = "[v=\\s]*" + A[d.MAINVERSIONLOOSE] + A[d.PRERELEASELOOSE] + "?" + A[d.BUILD] + "?", P("LOOSE"), A[d.LOOSE] = "^" + A[d.LOOSEPLAIN] + "$", P("GTLT"), A[d.GTLT] = "((?:<|>)?=?)", P("XRANGEIDENTIFIERLOOSE"), A[d.XRANGEIDENTIFIERLOOSE] = A[d.NUMERICIDENTIFIERLOOSE] + "|x|X|\\*", P("XRANGEIDENTIFIER"), A[d.XRANGEIDENTIFIER] = A[d.NUMERICIDENTIFIER] + "|x|X|\\*", P("XRANGEPLAIN"), A[d.XRANGEPLAIN] = "[v=\\s]*(" + A[d.XRANGEIDENTIFIER] + ")(?:\\.(" + A[d.XRANGEIDENTIFIER] + ")(?:\\.(" + A[d.XRANGEIDENTIFIER] + ")(?:" + A[d.PRERELEASE] + ")?" + A[d.BUILD] + "?)?)?", P("XRANGEPLAINLOOSE"), A[d.XRANGEPLAINLOOSE] = "[v=\\s]*(" + A[d.XRANGEIDENTIFIERLOOSE] + ")(?:\\.(" + A[d.XRANGEIDENTIFIERLOOSE] + ")(?:\\.(" + A[d.XRANGEIDENTIFIERLOOSE] + ")(?:" + A[d.PRERELEASELOOSE] + ")?" + A[d.BUILD] + "?)?)?", P("XRANGE"), A[d.XRANGE] = "^" + A[d.GTLT] + "\\s*" + A[d.XRANGEPLAIN] + "$", P("XRANGELOOSE"), A[d.XRANGELOOSE] = "^" + A[d.GTLT] + "\\s*" + A[d.XRANGEPLAINLOOSE] + "$", P("COERCE"), A[d.COERCE] = "(^|[^\\d])(\\d{1," + D + "})(?:\\.(\\d{1," + D + "}))?(?:\\.(\\d{1," + D + "}))?(?:$|[^\\d])", P("COERCERTL"), k[d.COERCERTL] = new RegExp(A[d.COERCE], "g"), L[d.COERCERTL] = new RegExp(Ie(A[d.COERCE]), "g"), P("LONETILDE"), A[d.LONETILDE] = "(?:~>?)", P("TILDETRIM"), A[d.TILDETRIM] = "(\\s*)" + A[d.LONETILDE] + "\\s+", k[d.TILDETRIM] = new RegExp(A[d.TILDETRIM], "g"), L[d.TILDETRIM] = new RegExp(Ie(A[d.TILDETRIM]), "g");
292
+ var Ae = "$1~";
293
+ P("TILDE"), A[d.TILDE] = "^" + A[d.LONETILDE] + A[d.XRANGEPLAIN] + "$", P("TILDELOOSE"), A[d.TILDELOOSE] = "^" + A[d.LONETILDE] + A[d.XRANGEPLAINLOOSE] + "$", P("LONECARET"), A[d.LONECARET] = "(?:\\^)", P("CARETTRIM"), A[d.CARETTRIM] = "(\\s*)" + A[d.LONECARET] + "\\s+", k[d.CARETTRIM] = new RegExp(A[d.CARETTRIM], "g"), L[d.CARETTRIM] = new RegExp(Ie(A[d.CARETTRIM]), "g");
294
+ var _e = "$1^";
295
+ P("CARET"), A[d.CARET] = "^" + A[d.LONECARET] + A[d.XRANGEPLAIN] + "$", P("CARETLOOSE"), A[d.CARETLOOSE] = "^" + A[d.LONECARET] + A[d.XRANGEPLAINLOOSE] + "$", P("COMPARATORLOOSE"), A[d.COMPARATORLOOSE] = "^" + A[d.GTLT] + "\\s*(" + A[d.LOOSEPLAIN] + ")$|^$", P("COMPARATOR"), A[d.COMPARATOR] = "^" + A[d.GTLT] + "\\s*(" + A[d.FULLPLAIN] + ")$|^$", P("COMPARATORTRIM"), A[d.COMPARATORTRIM] = "(\\s*)" + A[d.GTLT] + "\\s*(" + A[d.LOOSEPLAIN] + "|" + A[d.XRANGEPLAIN] + ")", k[d.COMPARATORTRIM] = new RegExp(A[d.COMPARATORTRIM], "g"), L[d.COMPARATORTRIM] = new RegExp(Ie(A[d.COMPARATORTRIM]), "g");
296
+ var R = "$1$2$3";
297
+ P("HYPHENRANGE"), A[d.HYPHENRANGE] = "^\\s*(" + A[d.XRANGEPLAIN] + ")\\s+-\\s+(" + A[d.XRANGEPLAIN] + ")\\s*$", P("HYPHENRANGELOOSE"), A[d.HYPHENRANGELOOSE] = "^\\s*(" + A[d.XRANGEPLAINLOOSE] + ")\\s+-\\s+(" + A[d.XRANGEPLAINLOOSE] + ")\\s*$", P("STAR"), A[d.STAR] = "(<|>)?=?\\s*\\*";
298
+ for (var ae = 0; ae < Y; ae++)
299
+ E(ae, A[ae]), k[ae] || (k[ae] = new RegExp(A[ae]), L[ae] = new RegExp(Ie(A[ae])));
300
+ o.parse = me;
301
+ function me(r, s) {
302
+ if ((!s || typeof s != "object") && (s = {
303
+ loose: !!s,
304
+ includePrerelease: !1
305
+ }), r instanceof j)
306
+ return r;
307
+ if (typeof r != "string" || r.length > T)
308
+ return null;
309
+ var l = s.loose ? L[d.LOOSE] : L[d.FULL];
310
+ if (!l.test(r))
311
+ return null;
312
+ try {
313
+ return new j(r, s);
314
+ } catch {
315
+ return null;
316
+ }
317
+ }
318
+ o.valid = Le;
319
+ function Le(r, s) {
320
+ var l = me(r, s);
321
+ return l ? l.version : null;
322
+ }
323
+ o.clean = te;
324
+ function te(r, s) {
325
+ var l = me(r.trim().replace(/^[=v]+/, ""), s);
326
+ return l ? l.version : null;
327
+ }
328
+ o.SemVer = j;
329
+ function j(r, s) {
330
+ if ((!s || typeof s != "object") && (s = {
331
+ loose: !!s,
332
+ includePrerelease: !1
333
+ }), r instanceof j) {
334
+ if (r.loose === s.loose)
335
+ return r;
336
+ r = r.version;
337
+ } else if (typeof r != "string")
338
+ throw new TypeError("Invalid Version: " + r);
339
+ if (r.length > T)
340
+ throw new TypeError("version is longer than " + T + " characters");
341
+ if (!(this instanceof j))
342
+ return new j(r, s);
343
+ E("SemVer", r, s), this.options = s, this.loose = !!s.loose;
344
+ var l = r.trim().match(s.loose ? L[d.LOOSE] : L[d.FULL]);
345
+ if (!l)
346
+ throw new TypeError("Invalid Version: " + r);
347
+ if (this.raw = r, this.major = +l[1], this.minor = +l[2], this.patch = +l[3], this.major > N || this.major < 0)
348
+ throw new TypeError("Invalid major version");
349
+ if (this.minor > N || this.minor < 0)
350
+ throw new TypeError("Invalid minor version");
351
+ if (this.patch > N || this.patch < 0)
352
+ throw new TypeError("Invalid patch version");
353
+ l[4] ? this.prerelease = l[4].split(".").map(function(S) {
354
+ if (/^[0-9]+$/.test(S)) {
355
+ var y = +S;
356
+ if (y >= 0 && y < N)
357
+ return y;
358
+ }
359
+ return S;
360
+ }) : this.prerelease = [], this.build = l[5] ? l[5].split(".") : [], this.format();
361
+ }
362
+ j.prototype.format = function() {
363
+ return this.version = this.major + "." + this.minor + "." + this.patch, this.prerelease.length && (this.version += "-" + this.prerelease.join(".")), this.version;
364
+ }, j.prototype.toString = function() {
365
+ return this.version;
366
+ }, j.prototype.compare = function(r) {
367
+ return E("SemVer.compare", this.version, this.options, r), r instanceof j || (r = new j(r, this.options)), this.compareMain(r) || this.comparePre(r);
368
+ }, j.prototype.compareMain = function(r) {
369
+ return r instanceof j || (r = new j(r, this.options)), h(this.major, r.major) || h(this.minor, r.minor) || h(this.patch, r.patch);
370
+ }, j.prototype.comparePre = function(r) {
371
+ if (r instanceof j || (r = new j(r, this.options)), this.prerelease.length && !r.prerelease.length)
372
+ return -1;
373
+ if (!this.prerelease.length && r.prerelease.length)
374
+ return 1;
375
+ if (!this.prerelease.length && !r.prerelease.length)
376
+ return 0;
377
+ var s = 0;
378
+ do {
379
+ var l = this.prerelease[s], S = r.prerelease[s];
380
+ if (E("prerelease compare", s, l, S), l === void 0 && S === void 0)
381
+ return 0;
382
+ if (S === void 0)
383
+ return 1;
384
+ if (l === void 0)
385
+ return -1;
386
+ if (l === S)
387
+ continue;
388
+ return h(l, S);
389
+ } while (++s);
390
+ }, j.prototype.compareBuild = function(r) {
391
+ r instanceof j || (r = new j(r, this.options));
392
+ var s = 0;
393
+ do {
394
+ var l = this.build[s], S = r.build[s];
395
+ if (E("prerelease compare", s, l, S), l === void 0 && S === void 0)
396
+ return 0;
397
+ if (S === void 0)
398
+ return 1;
399
+ if (l === void 0)
400
+ return -1;
401
+ if (l === S)
402
+ continue;
403
+ return h(l, S);
404
+ } while (++s);
405
+ }, j.prototype.inc = function(r, s) {
406
+ switch (r) {
407
+ case "premajor":
408
+ this.prerelease.length = 0, this.patch = 0, this.minor = 0, this.major++, this.inc("pre", s);
409
+ break;
410
+ case "preminor":
411
+ this.prerelease.length = 0, this.patch = 0, this.minor++, this.inc("pre", s);
412
+ break;
413
+ case "prepatch":
414
+ this.prerelease.length = 0, this.inc("patch", s), this.inc("pre", s);
415
+ break;
416
+ case "prerelease":
417
+ this.prerelease.length === 0 && this.inc("patch", s), this.inc("pre", s);
418
+ break;
419
+ case "major":
420
+ (this.minor !== 0 || this.patch !== 0 || this.prerelease.length === 0) && this.major++, this.minor = 0, this.patch = 0, this.prerelease = [];
421
+ break;
422
+ case "minor":
423
+ (this.patch !== 0 || this.prerelease.length === 0) && this.minor++, this.patch = 0, this.prerelease = [];
424
+ break;
425
+ case "patch":
426
+ this.prerelease.length === 0 && this.patch++, this.prerelease = [];
427
+ break;
428
+ case "pre":
429
+ if (this.prerelease.length === 0)
430
+ this.prerelease = [0];
431
+ else {
432
+ for (var l = this.prerelease.length; --l >= 0; )
433
+ typeof this.prerelease[l] == "number" && (this.prerelease[l]++, l = -2);
434
+ l === -1 && this.prerelease.push(0);
435
+ }
436
+ s && (this.prerelease[0] === s ? isNaN(this.prerelease[1]) && (this.prerelease = [s, 0]) : this.prerelease = [s, 0]);
437
+ break;
438
+ default:
439
+ throw new Error("invalid increment argument: " + r);
440
+ }
441
+ return this.format(), this.raw = this.version, this;
442
+ }, o.inc = n;
443
+ function n(r, s, l, S) {
444
+ typeof l == "string" && (S = l, l = void 0);
445
+ try {
446
+ return new j(r, l).inc(s, S).version;
447
+ } catch {
448
+ return null;
449
+ }
450
+ }
451
+ o.diff = a;
452
+ function a(r, s) {
453
+ if (z(r, s))
454
+ return null;
455
+ var l = me(r), S = me(s), y = "";
456
+ if (l.prerelease.length || S.prerelease.length) {
457
+ y = "pre";
458
+ var v = "prerelease";
459
+ }
460
+ for (var O in l)
461
+ if ((O === "major" || O === "minor" || O === "patch") && l[O] !== S[O])
462
+ return y + O;
463
+ return v;
464
+ }
465
+ o.compareIdentifiers = h;
466
+ var i = /^[0-9]+$/;
467
+ function h(r, s) {
468
+ var l = i.test(r), S = i.test(s);
469
+ return l && S && (r = +r, s = +s), r === s ? 0 : l && !S ? -1 : S && !l ? 1 : r < s ? -1 : 1;
470
+ }
471
+ o.rcompareIdentifiers = u;
472
+ function u(r, s) {
473
+ return h(s, r);
474
+ }
475
+ o.major = p;
476
+ function p(r, s) {
477
+ return new j(r, s).major;
478
+ }
479
+ o.minor = I;
480
+ function I(r, s) {
481
+ return new j(r, s).minor;
482
+ }
483
+ o.patch = c;
484
+ function c(r, s) {
485
+ return new j(r, s).patch;
486
+ }
487
+ o.compare = f;
488
+ function f(r, s, l) {
489
+ return new j(r, l).compare(new j(s, l));
490
+ }
491
+ o.compareLoose = g;
492
+ function g(r, s) {
493
+ return f(r, s, !0);
494
+ }
495
+ o.compareBuild = m;
496
+ function m(r, s, l) {
497
+ var S = new j(r, l), y = new j(s, l);
498
+ return S.compare(y) || S.compareBuild(y);
499
+ }
500
+ o.rcompare = b;
501
+ function b(r, s, l) {
502
+ return f(s, r, l);
503
+ }
504
+ o.sort = _;
505
+ function _(r, s) {
506
+ return r.sort(function(l, S) {
507
+ return o.compareBuild(l, S, s);
508
+ });
509
+ }
510
+ o.rsort = C;
511
+ function C(r, s) {
512
+ return r.sort(function(l, S) {
513
+ return o.compareBuild(S, l, s);
514
+ });
515
+ }
516
+ o.gt = x;
517
+ function x(r, s, l) {
518
+ return f(r, s, l) > 0;
519
+ }
520
+ o.lt = X;
521
+ function X(r, s, l) {
522
+ return f(r, s, l) < 0;
523
+ }
524
+ o.eq = z;
525
+ function z(r, s, l) {
526
+ return f(r, s, l) === 0;
527
+ }
528
+ o.neq = M;
529
+ function M(r, s, l) {
530
+ return f(r, s, l) !== 0;
531
+ }
532
+ o.gte = $;
533
+ function $(r, s, l) {
534
+ return f(r, s, l) >= 0;
535
+ }
536
+ o.lte = W;
537
+ function W(r, s, l) {
538
+ return f(r, s, l) <= 0;
539
+ }
540
+ o.cmp = Ne;
541
+ function Ne(r, s, l, S) {
542
+ switch (s) {
543
+ case "===":
544
+ return typeof r == "object" && (r = r.version), typeof l == "object" && (l = l.version), r === l;
545
+ case "!==":
546
+ return typeof r == "object" && (r = r.version), typeof l == "object" && (l = l.version), r !== l;
547
+ case "":
548
+ case "=":
549
+ case "==":
550
+ return z(r, l, S);
551
+ case "!=":
552
+ return M(r, l, S);
553
+ case ">":
554
+ return x(r, l, S);
555
+ case ">=":
556
+ return $(r, l, S);
557
+ case "<":
558
+ return X(r, l, S);
559
+ case "<=":
560
+ return W(r, l, S);
561
+ default:
562
+ throw new TypeError("Invalid operator: " + s);
563
+ }
564
+ }
565
+ o.Comparator = Q;
566
+ function Q(r, s) {
567
+ if ((!s || typeof s != "object") && (s = {
568
+ loose: !!s,
569
+ includePrerelease: !1
570
+ }), r instanceof Q) {
571
+ if (r.loose === !!s.loose)
572
+ return r;
573
+ r = r.value;
574
+ }
575
+ if (!(this instanceof Q))
576
+ return new Q(r, s);
577
+ r = r.trim().split(/\s+/).join(" "), E("comparator", r, s), this.options = s, this.loose = !!s.loose, this.parse(r), this.semver === de ? this.value = "" : this.value = this.operator + this.semver.version, E("comp", this);
578
+ }
579
+ var de = {};
580
+ Q.prototype.parse = function(r) {
581
+ var s = this.options.loose ? L[d.COMPARATORLOOSE] : L[d.COMPARATOR], l = r.match(s);
582
+ if (!l)
583
+ throw new TypeError("Invalid comparator: " + r);
584
+ this.operator = l[1] !== void 0 ? l[1] : "", this.operator === "=" && (this.operator = ""), l[2] ? this.semver = new j(l[2], this.options.loose) : this.semver = de;
585
+ }, Q.prototype.toString = function() {
586
+ return this.value;
587
+ }, Q.prototype.test = function(r) {
588
+ if (E("Comparator.test", r, this.options.loose), this.semver === de || r === de)
589
+ return !0;
590
+ if (typeof r == "string")
591
+ try {
592
+ r = new j(r, this.options);
593
+ } catch {
594
+ return !1;
595
+ }
596
+ return Ne(r, this.operator, this.semver, this.options);
597
+ }, Q.prototype.intersects = function(r, s) {
598
+ if (!(r instanceof Q))
599
+ throw new TypeError("a Comparator is required");
600
+ (!s || typeof s != "object") && (s = {
601
+ loose: !!s,
602
+ includePrerelease: !1
603
+ });
604
+ var l;
605
+ if (this.operator === "")
606
+ return this.value === "" ? !0 : (l = new G(r.value, s), je(this.value, l, s));
607
+ if (r.operator === "")
608
+ return r.value === "" ? !0 : (l = new G(this.value, s), je(r.semver, l, s));
609
+ var S = (this.operator === ">=" || this.operator === ">") && (r.operator === ">=" || r.operator === ">"), y = (this.operator === "<=" || this.operator === "<") && (r.operator === "<=" || r.operator === "<"), v = this.semver.version === r.semver.version, O = (this.operator === ">=" || this.operator === "<=") && (r.operator === ">=" || r.operator === "<="), V = Ne(this.semver, "<", r.semver, s) && (this.operator === ">=" || this.operator === ">") && (r.operator === "<=" || r.operator === "<"), F = Ne(this.semver, ">", r.semver, s) && (this.operator === "<=" || this.operator === "<") && (r.operator === ">=" || r.operator === ">");
610
+ return S || y || v && O || V || F;
611
+ }, o.Range = G;
612
+ function G(r, s) {
613
+ if ((!s || typeof s != "object") && (s = {
614
+ loose: !!s,
615
+ includePrerelease: !1
616
+ }), r instanceof G)
617
+ return r.loose === !!s.loose && r.includePrerelease === !!s.includePrerelease ? r : new G(r.raw, s);
618
+ if (r instanceof Q)
619
+ return new G(r.value, s);
620
+ if (!(this instanceof G))
621
+ return new G(r, s);
622
+ if (this.options = s, this.loose = !!s.loose, this.includePrerelease = !!s.includePrerelease, this.raw = r.trim().split(/\s+/).join(" "), this.set = this.raw.split("||").map(function(l) {
623
+ return this.parseRange(l.trim());
624
+ }, this).filter(function(l) {
625
+ return l.length;
626
+ }), !this.set.length)
627
+ throw new TypeError("Invalid SemVer Range: " + this.raw);
628
+ this.format();
629
+ }
630
+ G.prototype.format = function() {
631
+ return this.range = this.set.map(function(r) {
632
+ return r.join(" ").trim();
633
+ }).join("||").trim(), this.range;
634
+ }, G.prototype.toString = function() {
635
+ return this.range;
636
+ }, G.prototype.parseRange = function(r) {
637
+ var s = this.options.loose, l = s ? L[d.HYPHENRANGELOOSE] : L[d.HYPHENRANGE];
638
+ r = r.replace(l, Nr), E("hyphen replace", r), r = r.replace(L[d.COMPARATORTRIM], R), E("comparator trim", r, L[d.COMPARATORTRIM]), r = r.replace(L[d.TILDETRIM], Ae), r = r.replace(L[d.CARETTRIM], _e), r = r.split(/\s+/).join(" ");
639
+ var S = s ? L[d.COMPARATORLOOSE] : L[d.COMPARATOR], y = r.split(" ").map(function(v) {
640
+ return J(v, this.options);
641
+ }, this).join(" ").split(/\s+/);
642
+ return this.options.loose && (y = y.filter(function(v) {
643
+ return !!v.match(S);
644
+ })), y = y.map(function(v) {
645
+ return new Q(v, this.options);
646
+ }, this), y;
647
+ }, G.prototype.intersects = function(r, s) {
648
+ if (!(r instanceof G))
649
+ throw new TypeError("a Range is required");
650
+ return this.set.some(function(l) {
651
+ return Te(l, s) && r.set.some(function(S) {
652
+ return Te(S, s) && l.every(function(y) {
653
+ return S.every(function(v) {
654
+ return y.intersects(v, s);
655
+ });
656
+ });
657
+ });
658
+ });
659
+ };
660
+ function Te(r, s) {
661
+ for (var l = !0, S = r.slice(), y = S.pop(); l && S.length; )
662
+ l = S.every(function(v) {
663
+ return y.intersects(v, s);
664
+ }), y = S.pop();
665
+ return l;
666
+ }
667
+ o.toComparators = re;
668
+ function re(r, s) {
669
+ return new G(r, s).set.map(function(l) {
670
+ return l.map(function(S) {
671
+ return S.value;
672
+ }).join(" ").trim().split(" ");
673
+ });
674
+ }
675
+ function J(r, s) {
676
+ return E("comp", r, s), r = dr(r, s), E("caret", r), r = hr(r, s), E("tildes", r), r = Er(r, s), E("xrange", r), r = Ar(r, s), E("stars", r), r;
677
+ }
678
+ function B(r) {
679
+ return !r || r.toLowerCase() === "x" || r === "*";
680
+ }
681
+ function hr(r, s) {
682
+ return r.trim().split(/\s+/).map(function(l) {
683
+ return mr(l, s);
684
+ }).join(" ");
685
+ }
686
+ function mr(r, s) {
687
+ var l = s.loose ? L[d.TILDELOOSE] : L[d.TILDE];
688
+ return r.replace(l, function(S, y, v, O, V) {
689
+ E("tilde", r, S, y, v, O, V);
690
+ var F;
691
+ return B(y) ? F = "" : B(v) ? F = ">=" + y + ".0.0 <" + (+y + 1) + ".0.0" : B(O) ? F = ">=" + y + "." + v + ".0 <" + y + "." + (+v + 1) + ".0" : V ? (E("replaceTilde pr", V), F = ">=" + y + "." + v + "." + O + "-" + V + " <" + y + "." + (+v + 1) + ".0") : F = ">=" + y + "." + v + "." + O + " <" + y + "." + (+v + 1) + ".0", E("tilde return", F), F;
692
+ });
693
+ }
694
+ function dr(r, s) {
695
+ return r.trim().split(/\s+/).map(function(l) {
696
+ return gr(l, s);
697
+ }).join(" ");
698
+ }
699
+ function gr(r, s) {
700
+ E("caret", r, s);
701
+ var l = s.loose ? L[d.CARETLOOSE] : L[d.CARET];
702
+ return r.replace(l, function(S, y, v, O, V) {
703
+ E("caret", r, S, y, v, O, V);
704
+ var F;
705
+ return B(y) ? F = "" : B(v) ? F = ">=" + y + ".0.0 <" + (+y + 1) + ".0.0" : B(O) ? y === "0" ? F = ">=" + y + "." + v + ".0 <" + y + "." + (+v + 1) + ".0" : F = ">=" + y + "." + v + ".0 <" + (+y + 1) + ".0.0" : V ? (E("replaceCaret pr", V), y === "0" ? v === "0" ? F = ">=" + y + "." + v + "." + O + "-" + V + " <" + y + "." + v + "." + (+O + 1) : F = ">=" + y + "." + v + "." + O + "-" + V + " <" + y + "." + (+v + 1) + ".0" : F = ">=" + y + "." + v + "." + O + "-" + V + " <" + (+y + 1) + ".0.0") : (E("no pr"), y === "0" ? v === "0" ? F = ">=" + y + "." + v + "." + O + " <" + y + "." + v + "." + (+O + 1) : F = ">=" + y + "." + v + "." + O + " <" + y + "." + (+v + 1) + ".0" : F = ">=" + y + "." + v + "." + O + " <" + (+y + 1) + ".0.0"), E("caret return", F), F;
706
+ });
707
+ }
708
+ function Er(r, s) {
709
+ return E("replaceXRanges", r, s), r.split(/\s+/).map(function(l) {
710
+ return Ir(l, s);
711
+ }).join(" ");
712
+ }
713
+ function Ir(r, s) {
714
+ r = r.trim();
715
+ var l = s.loose ? L[d.XRANGELOOSE] : L[d.XRANGE];
716
+ return r.replace(l, function(S, y, v, O, V, F) {
717
+ E("xRange", r, S, y, v, O, V, F);
718
+ var ge = B(v), Ee = ge || B(O), se = Ee || B(V), ie = se;
719
+ return y === "=" && ie && (y = ""), F = s.includePrerelease ? "-0" : "", ge ? y === ">" || y === "<" ? S = "<0.0.0-0" : S = "*" : y && ie ? (Ee && (O = 0), V = 0, y === ">" ? (y = ">=", Ee ? (v = +v + 1, O = 0, V = 0) : (O = +O + 1, V = 0)) : y === "<=" && (y = "<", Ee ? v = +v + 1 : O = +O + 1), S = y + v + "." + O + "." + V + F) : Ee ? S = ">=" + v + ".0.0" + F + " <" + (+v + 1) + ".0.0" + F : se && (S = ">=" + v + "." + O + ".0" + F + " <" + v + "." + (+O + 1) + ".0" + F), E("xRange return", S), S;
720
+ });
721
+ }
722
+ function Ar(r, s) {
723
+ return E("replaceStars", r, s), r.trim().replace(L[d.STAR], "");
724
+ }
725
+ function Nr(r, s, l, S, y, v, O, V, F, ge, Ee, se, ie) {
726
+ return B(l) ? s = "" : B(S) ? s = ">=" + l + ".0.0" : B(y) ? s = ">=" + l + "." + S + ".0" : s = ">=" + s, B(F) ? V = "" : B(ge) ? V = "<" + (+F + 1) + ".0.0" : B(Ee) ? V = "<" + F + "." + (+ge + 1) + ".0" : se ? V = "<=" + F + "." + ge + "." + Ee + "-" + se : V = "<=" + V, (s + " " + V).trim();
727
+ }
728
+ G.prototype.test = function(r) {
729
+ if (!r)
730
+ return !1;
731
+ if (typeof r == "string")
732
+ try {
733
+ r = new j(r, this.options);
734
+ } catch {
735
+ return !1;
736
+ }
737
+ for (var s = 0; s < this.set.length; s++)
738
+ if (Sr(this.set[s], r, this.options))
739
+ return !0;
740
+ return !1;
741
+ };
742
+ function Sr(r, s, l) {
743
+ for (var S = 0; S < r.length; S++)
744
+ if (!r[S].test(s))
745
+ return !1;
746
+ if (s.prerelease.length && !l.includePrerelease) {
747
+ for (S = 0; S < r.length; S++)
748
+ if (E(r[S].semver), r[S].semver !== de && r[S].semver.prerelease.length > 0) {
749
+ var y = r[S].semver;
750
+ if (y.major === s.major && y.minor === s.minor && y.patch === s.patch)
751
+ return !0;
752
+ }
753
+ return !1;
754
+ }
755
+ return !0;
756
+ }
757
+ o.satisfies = je;
758
+ function je(r, s, l) {
759
+ try {
760
+ s = new G(s, l);
761
+ } catch {
762
+ return !1;
763
+ }
764
+ return s.test(r);
765
+ }
766
+ o.maxSatisfying = br;
767
+ function br(r, s, l) {
768
+ var S = null, y = null;
769
+ try {
770
+ var v = new G(s, l);
771
+ } catch {
772
+ return null;
773
+ }
774
+ return r.forEach(function(O) {
775
+ v.test(O) && (!S || y.compare(O) === -1) && (S = O, y = new j(S, l));
776
+ }), S;
777
+ }
778
+ o.minSatisfying = Tr;
779
+ function Tr(r, s, l) {
780
+ var S = null, y = null;
781
+ try {
782
+ var v = new G(s, l);
783
+ } catch {
784
+ return null;
785
+ }
786
+ return r.forEach(function(O) {
787
+ v.test(O) && (!S || y.compare(O) === 1) && (S = O, y = new j(S, l));
788
+ }), S;
789
+ }
790
+ o.minVersion = yr;
791
+ function yr(r, s) {
792
+ r = new G(r, s);
793
+ var l = new j("0.0.0");
794
+ if (r.test(l) || (l = new j("0.0.0-0"), r.test(l)))
795
+ return l;
796
+ l = null;
797
+ for (var S = 0; S < r.set.length; ++S) {
798
+ var y = r.set[S];
799
+ y.forEach(function(v) {
800
+ var O = new j(v.semver.version);
801
+ switch (v.operator) {
802
+ case ">":
803
+ O.prerelease.length === 0 ? O.patch++ : O.prerelease.push(0), O.raw = O.format();
804
+ case "":
805
+ case ">=":
806
+ (!l || x(l, O)) && (l = O);
807
+ break;
808
+ case "<":
809
+ case "<=":
810
+ break;
811
+ default:
812
+ throw new Error("Unexpected operation: " + v.operator);
813
+ }
814
+ });
815
+ }
816
+ return l && r.test(l) ? l : null;
817
+ }
818
+ o.validRange = Rr;
819
+ function Rr(r, s) {
820
+ try {
821
+ return new G(r, s).range || "*";
822
+ } catch {
823
+ return null;
824
+ }
825
+ }
826
+ o.ltr = vr;
827
+ function vr(r, s, l) {
828
+ return ze(r, s, "<", l);
829
+ }
830
+ o.gtr = Or;
831
+ function Or(r, s, l) {
832
+ return ze(r, s, ">", l);
833
+ }
834
+ o.outside = ze;
835
+ function ze(r, s, l, S) {
836
+ r = new j(r, S), s = new G(s, S);
837
+ var y, v, O, V, F;
838
+ switch (l) {
839
+ case ">":
840
+ y = x, v = W, O = X, V = ">", F = ">=";
841
+ break;
842
+ case "<":
843
+ y = X, v = $, O = x, V = "<", F = "<=";
844
+ break;
845
+ default:
846
+ throw new TypeError('Must provide a hilo val of "<" or ">"');
847
+ }
848
+ if (je(r, s, S))
849
+ return !1;
850
+ for (var ge = 0; ge < s.set.length; ++ge) {
851
+ var Ee = s.set[ge], se = null, ie = null;
852
+ if (Ee.forEach(function(ye) {
853
+ ye.semver === de && (ye = new Q(">=0.0.0")), se = se || ye, ie = ie || ye, y(ye.semver, se.semver, S) ? se = ye : O(ye.semver, ie.semver, S) && (ie = ye);
854
+ }), se.operator === V || se.operator === F || (!ie.operator || ie.operator === V) && v(r, ie.semver))
855
+ return !1;
856
+ if (ie.operator === F && O(r, ie.semver))
857
+ return !1;
858
+ }
859
+ return !0;
860
+ }
861
+ o.prerelease = wr;
862
+ function wr(r, s) {
863
+ var l = me(r, s);
864
+ return l && l.prerelease.length ? l.prerelease : null;
865
+ }
866
+ o.intersects = _r;
867
+ function _r(r, s, l) {
868
+ return r = new G(r, l), s = new G(s, l), r.intersects(s);
869
+ }
870
+ o.coerce = Lr;
871
+ function Lr(r, s) {
872
+ if (r instanceof j)
873
+ return r;
874
+ if (typeof r == "number" && (r = String(r)), typeof r != "string")
875
+ return null;
876
+ s = s || {};
877
+ var l = null;
878
+ if (!s.rtl)
879
+ l = r.match(L[d.COERCE]);
880
+ else {
881
+ for (var S; (S = L[d.COERCERTL].exec(r)) && (!l || l.index + l[0].length !== r.length); )
882
+ (!l || S.index + S[0].length !== l.index + l[0].length) && (l = S), L[d.COERCERTL].lastIndex = S.index + S[1].length + S[2].length;
883
+ L[d.COERCERTL].lastIndex = -1;
884
+ }
885
+ return l === null ? null : me(l[2] + "." + (l[3] || "0") + "." + (l[4] || "0"), s);
886
+ }
887
+ })(st, st.exports);
888
+ var mn = st.exports;
889
+ const Ai = /* @__PURE__ */ hn(mn), Ni = (t) => t == null ? [] : Array.isArray(t) ? t : [t], Si = e.any().refine((t) => typeof t == "bigint", {
890
+ message: "Value must be a BigInt"
891
+ }).transform((t) => BigInt(t));
892
+ var dn = /^-?(?:\d+(?:\.\d*)?|\.\d+)(?:e[+-]?\d+)?$/i, qe = Math.ceil, ce = Math.floor, ne = "[BigNumber Error] ", yt = ne + "Number primitive has more than 15 significant digits: ", pe = 1e14, U = 14, We = 9007199254740991, Ke = [1, 10, 100, 1e3, 1e4, 1e5, 1e6, 1e7, 1e8, 1e9, 1e10, 1e11, 1e12, 1e13], Re = 1e7, Z = 1e9;
893
+ function kt(t) {
894
+ var o, E, T, N = R.prototype = { constructor: R, toString: null, valueOf: null }, D = new R(1), w = 20, k = 4, L = -7, A = 21, d = -1e7, Y = 1e7, P = !1, fe = 1, ee = 0, Ie = {
895
+ prefix: "",
896
+ groupSize: 3,
897
+ secondaryGroupSize: 0,
898
+ groupSeparator: ",",
899
+ decimalSeparator: ".",
900
+ fractionGroupSize: 0,
901
+ fractionGroupSeparator: " ",
902
+ // non-breaking space
903
+ suffix: ""
904
+ }, Ae = "0123456789abcdefghijklmnopqrstuvwxyz", _e = !0;
905
+ function R(n, a) {
906
+ var i, h, u, p, I, c, f, g, m = this;
907
+ if (!(m instanceof R)) return new R(n, a);
908
+ if (a == null) {
909
+ if (n && n._isBigNumber === !0) {
910
+ m.s = n.s, !n.c || n.e > Y ? m.c = m.e = null : n.e < d ? m.c = [m.e = 0] : (m.e = n.e, m.c = n.c.slice());
911
+ return;
912
+ }
913
+ if ((c = typeof n == "number") && n * 0 == 0) {
914
+ if (m.s = 1 / n < 0 ? (n = -n, -1) : 1, n === ~~n) {
915
+ for (p = 0, I = n; I >= 10; I /= 10, p++) ;
916
+ p > Y ? m.c = m.e = null : (m.e = p, m.c = [n]);
917
+ return;
918
+ }
919
+ g = String(n);
920
+ } else {
921
+ if (!dn.test(g = String(n))) return T(m, g, c);
922
+ m.s = g.charCodeAt(0) == 45 ? (g = g.slice(1), -1) : 1;
923
+ }
924
+ (p = g.indexOf(".")) > -1 && (g = g.replace(".", "")), (I = g.search(/e/i)) > 0 ? (p < 0 && (p = I), p += +g.slice(I + 1), g = g.substring(0, I)) : p < 0 && (p = g.length);
925
+ } else {
926
+ if (q(a, 2, Ae.length, "Base"), a == 10 && _e)
927
+ return m = new R(n), te(m, w + m.e + 1, k);
928
+ if (g = String(n), c = typeof n == "number") {
929
+ if (n * 0 != 0) return T(m, g, c, a);
930
+ if (m.s = 1 / n < 0 ? (g = g.slice(1), -1) : 1, R.DEBUG && g.replace(/^0\.0*|\./, "").length > 15)
931
+ throw Error(yt + n);
932
+ } else
933
+ m.s = g.charCodeAt(0) === 45 ? (g = g.slice(1), -1) : 1;
934
+ for (i = Ae.slice(0, a), p = I = 0, f = g.length; I < f; I++)
935
+ if (i.indexOf(h = g.charAt(I)) < 0) {
936
+ if (h == ".") {
937
+ if (I > p) {
938
+ p = f;
939
+ continue;
940
+ }
941
+ } else if (!u && (g == g.toUpperCase() && (g = g.toLowerCase()) || g == g.toLowerCase() && (g = g.toUpperCase()))) {
942
+ u = !0, I = -1, p = 0;
943
+ continue;
944
+ }
945
+ return T(m, String(n), c, a);
946
+ }
947
+ c = !1, g = E(g, a, 10, m.s), (p = g.indexOf(".")) > -1 ? g = g.replace(".", "") : p = g.length;
948
+ }
949
+ for (I = 0; g.charCodeAt(I) === 48; I++) ;
950
+ for (f = g.length; g.charCodeAt(--f) === 48; ) ;
951
+ if (g = g.slice(I, ++f)) {
952
+ if (f -= I, c && R.DEBUG && f > 15 && (n > We || n !== ce(n)))
953
+ throw Error(yt + m.s * n);
954
+ if ((p = p - I - 1) > Y)
955
+ m.c = m.e = null;
956
+ else if (p < d)
957
+ m.c = [m.e = 0];
958
+ else {
959
+ if (m.e = p, m.c = [], I = (p + 1) % U, p < 0 && (I += U), I < f) {
960
+ for (I && m.c.push(+g.slice(0, I)), f -= U; I < f; )
961
+ m.c.push(+g.slice(I, I += U));
962
+ I = U - (g = g.slice(I)).length;
963
+ } else
964
+ I -= f;
965
+ for (; I--; g += "0") ;
966
+ m.c.push(+g);
967
+ }
968
+ } else
969
+ m.c = [m.e = 0];
970
+ }
971
+ R.clone = kt, R.ROUND_UP = 0, R.ROUND_DOWN = 1, R.ROUND_CEIL = 2, R.ROUND_FLOOR = 3, R.ROUND_HALF_UP = 4, R.ROUND_HALF_DOWN = 5, R.ROUND_HALF_EVEN = 6, R.ROUND_HALF_CEIL = 7, R.ROUND_HALF_FLOOR = 8, R.EUCLID = 9, R.config = R.set = function(n) {
972
+ var a, i;
973
+ if (n != null)
974
+ if (typeof n == "object") {
975
+ if (n.hasOwnProperty(a = "DECIMAL_PLACES") && (i = n[a], q(i, 0, Z, a), w = i), n.hasOwnProperty(a = "ROUNDING_MODE") && (i = n[a], q(i, 0, 8, a), k = i), n.hasOwnProperty(a = "EXPONENTIAL_AT") && (i = n[a], i && i.pop ? (q(i[0], -Z, 0, a), q(i[1], 0, Z, a), L = i[0], A = i[1]) : (q(i, -Z, Z, a), L = -(A = i < 0 ? -i : i))), n.hasOwnProperty(a = "RANGE"))
976
+ if (i = n[a], i && i.pop)
977
+ q(i[0], -Z, -1, a), q(i[1], 1, Z, a), d = i[0], Y = i[1];
978
+ else if (q(i, -Z, Z, a), i)
979
+ d = -(Y = i < 0 ? -i : i);
980
+ else
981
+ throw Error(ne + a + " cannot be zero: " + i);
982
+ if (n.hasOwnProperty(a = "CRYPTO"))
983
+ if (i = n[a], i === !!i)
984
+ if (i)
985
+ if (typeof crypto < "u" && crypto && (crypto.getRandomValues || crypto.randomBytes))
986
+ P = i;
987
+ else
988
+ throw P = !i, Error(ne + "crypto unavailable");
989
+ else
990
+ P = i;
991
+ else
992
+ throw Error(ne + a + " not true or false: " + i);
993
+ if (n.hasOwnProperty(a = "MODULO_MODE") && (i = n[a], q(i, 0, 9, a), fe = i), n.hasOwnProperty(a = "POW_PRECISION") && (i = n[a], q(i, 0, Z, a), ee = i), n.hasOwnProperty(a = "FORMAT"))
994
+ if (i = n[a], typeof i == "object") Ie = i;
995
+ else throw Error(ne + a + " not an object: " + i);
996
+ if (n.hasOwnProperty(a = "ALPHABET"))
997
+ if (i = n[a], typeof i == "string" && !/^.?$|[+\-.\s]|(.).*\1/.test(i))
998
+ _e = i.slice(0, 10) == "0123456789", Ae = i;
999
+ else
1000
+ throw Error(ne + a + " invalid: " + i);
1001
+ } else
1002
+ throw Error(ne + "Object expected: " + n);
1003
+ return {
1004
+ DECIMAL_PLACES: w,
1005
+ ROUNDING_MODE: k,
1006
+ EXPONENTIAL_AT: [L, A],
1007
+ RANGE: [d, Y],
1008
+ CRYPTO: P,
1009
+ MODULO_MODE: fe,
1010
+ POW_PRECISION: ee,
1011
+ FORMAT: Ie,
1012
+ ALPHABET: Ae
1013
+ };
1014
+ }, R.isBigNumber = function(n) {
1015
+ if (!n || n._isBigNumber !== !0) return !1;
1016
+ if (!R.DEBUG) return !0;
1017
+ var a, i, h = n.c, u = n.e, p = n.s;
1018
+ e: if ({}.toString.call(h) == "[object Array]") {
1019
+ if ((p === 1 || p === -1) && u >= -Z && u <= Z && u === ce(u)) {
1020
+ if (h[0] === 0) {
1021
+ if (u === 0 && h.length === 1) return !0;
1022
+ break e;
1023
+ }
1024
+ if (a = (u + 1) % U, a < 1 && (a += U), String(h[0]).length == a) {
1025
+ for (a = 0; a < h.length; a++)
1026
+ if (i = h[a], i < 0 || i >= pe || i !== ce(i)) break e;
1027
+ if (i !== 0) return !0;
1028
+ }
1029
+ }
1030
+ } else if (h === null && u === null && (p === null || p === 1 || p === -1))
1031
+ return !0;
1032
+ throw Error(ne + "Invalid BigNumber: " + n);
1033
+ }, R.maximum = R.max = function() {
1034
+ return me(arguments, -1);
1035
+ }, R.minimum = R.min = function() {
1036
+ return me(arguments, 1);
1037
+ }, R.random = function() {
1038
+ var n = 9007199254740992, a = Math.random() * n & 2097151 ? function() {
1039
+ return ce(Math.random() * n);
1040
+ } : function() {
1041
+ return (Math.random() * 1073741824 | 0) * 8388608 + (Math.random() * 8388608 | 0);
1042
+ };
1043
+ return function(i) {
1044
+ var h, u, p, I, c, f = 0, g = [], m = new R(D);
1045
+ if (i == null ? i = w : q(i, 0, Z), I = qe(i / U), P)
1046
+ if (crypto.getRandomValues) {
1047
+ for (h = crypto.getRandomValues(new Uint32Array(I *= 2)); f < I; )
1048
+ c = h[f] * 131072 + (h[f + 1] >>> 11), c >= 9e15 ? (u = crypto.getRandomValues(new Uint32Array(2)), h[f] = u[0], h[f + 1] = u[1]) : (g.push(c % 1e14), f += 2);
1049
+ f = I / 2;
1050
+ } else if (crypto.randomBytes) {
1051
+ for (h = crypto.randomBytes(I *= 7); f < I; )
1052
+ c = (h[f] & 31) * 281474976710656 + h[f + 1] * 1099511627776 + h[f + 2] * 4294967296 + h[f + 3] * 16777216 + (h[f + 4] << 16) + (h[f + 5] << 8) + h[f + 6], c >= 9e15 ? crypto.randomBytes(7).copy(h, f) : (g.push(c % 1e14), f += 7);
1053
+ f = I / 7;
1054
+ } else
1055
+ throw P = !1, Error(ne + "crypto unavailable");
1056
+ if (!P)
1057
+ for (; f < I; )
1058
+ c = a(), c < 9e15 && (g[f++] = c % 1e14);
1059
+ for (I = g[--f], i %= U, I && i && (c = Ke[U - i], g[f] = ce(I / c) * c); g[f] === 0; g.pop(), f--) ;
1060
+ if (f < 0)
1061
+ g = [p = 0];
1062
+ else {
1063
+ for (p = -1; g[0] === 0; g.splice(0, 1), p -= U) ;
1064
+ for (f = 1, c = g[0]; c >= 10; c /= 10, f++) ;
1065
+ f < U && (p -= U - f);
1066
+ }
1067
+ return m.e = p, m.c = g, m;
1068
+ };
1069
+ }(), R.sum = function() {
1070
+ for (var n = 1, a = arguments, i = new R(a[0]); n < a.length; ) i = i.plus(a[n++]);
1071
+ return i;
1072
+ }, E = /* @__PURE__ */ function() {
1073
+ var n = "0123456789";
1074
+ function a(i, h, u, p) {
1075
+ for (var I, c = [0], f, g = 0, m = i.length; g < m; ) {
1076
+ for (f = c.length; f--; c[f] *= h) ;
1077
+ for (c[0] += p.indexOf(i.charAt(g++)), I = 0; I < c.length; I++)
1078
+ c[I] > u - 1 && (c[I + 1] == null && (c[I + 1] = 0), c[I + 1] += c[I] / u | 0, c[I] %= u);
1079
+ }
1080
+ return c.reverse();
1081
+ }
1082
+ return function(i, h, u, p, I) {
1083
+ var c, f, g, m, b, _, C, x, X = i.indexOf("."), z = w, M = k;
1084
+ for (X >= 0 && (m = ee, ee = 0, i = i.replace(".", ""), x = new R(h), _ = x.pow(i.length - X), ee = m, x.c = a(
1085
+ Se(oe(_.c), _.e, "0"),
1086
+ 10,
1087
+ u,
1088
+ n
1089
+ ), x.e = x.c.length), C = a(i, h, u, I ? (c = Ae, n) : (c = n, Ae)), g = m = C.length; C[--m] == 0; C.pop()) ;
1090
+ if (!C[0]) return c.charAt(0);
1091
+ if (X < 0 ? --g : (_.c = C, _.e = g, _.s = p, _ = o(_, x, z, M, u), C = _.c, b = _.r, g = _.e), f = g + z + 1, X = C[f], m = u / 2, b = b || f < 0 || C[f + 1] != null, b = M < 4 ? (X != null || b) && (M == 0 || M == (_.s < 0 ? 3 : 2)) : X > m || X == m && (M == 4 || b || M == 6 && C[f - 1] & 1 || M == (_.s < 0 ? 8 : 7)), f < 1 || !C[0])
1092
+ i = b ? Se(c.charAt(1), -z, c.charAt(0)) : c.charAt(0);
1093
+ else {
1094
+ if (C.length = f, b)
1095
+ for (--u; ++C[--f] > u; )
1096
+ C[f] = 0, f || (++g, C = [1].concat(C));
1097
+ for (m = C.length; !C[--m]; ) ;
1098
+ for (X = 0, i = ""; X <= m; i += c.charAt(C[X++])) ;
1099
+ i = Se(i, g, c.charAt(0));
1100
+ }
1101
+ return i;
1102
+ };
1103
+ }(), o = /* @__PURE__ */ function() {
1104
+ function n(h, u, p) {
1105
+ var I, c, f, g, m = 0, b = h.length, _ = u % Re, C = u / Re | 0;
1106
+ for (h = h.slice(); b--; )
1107
+ f = h[b] % Re, g = h[b] / Re | 0, I = C * f + g * _, c = _ * f + I % Re * Re + m, m = (c / p | 0) + (I / Re | 0) + C * g, h[b] = c % p;
1108
+ return m && (h = [m].concat(h)), h;
1109
+ }
1110
+ function a(h, u, p, I) {
1111
+ var c, f;
1112
+ if (p != I)
1113
+ f = p > I ? 1 : -1;
1114
+ else
1115
+ for (c = f = 0; c < p; c++)
1116
+ if (h[c] != u[c]) {
1117
+ f = h[c] > u[c] ? 1 : -1;
1118
+ break;
1119
+ }
1120
+ return f;
1121
+ }
1122
+ function i(h, u, p, I) {
1123
+ for (var c = 0; p--; )
1124
+ h[p] -= c, c = h[p] < u[p] ? 1 : 0, h[p] = c * I + h[p] - u[p];
1125
+ for (; !h[0] && h.length > 1; h.splice(0, 1)) ;
1126
+ }
1127
+ return function(h, u, p, I, c) {
1128
+ var f, g, m, b, _, C, x, X, z, M, $, W, Ne, Q, de, G, Te, re = h.s == u.s ? 1 : -1, J = h.c, B = u.c;
1129
+ if (!J || !J[0] || !B || !B[0])
1130
+ return new R(
1131
+ // Return NaN if either NaN, or both Infinity or 0.
1132
+ !h.s || !u.s || (J ? B && J[0] == B[0] : !B) ? NaN : (
1133
+ // Return ±0 if x is ±0 or y is ±Infinity, or return ±Infinity as y is ±0.
1134
+ J && J[0] == 0 || !B ? re * 0 : re / 0
1135
+ )
1136
+ );
1137
+ for (X = new R(re), z = X.c = [], g = h.e - u.e, re = p + g + 1, c || (c = pe, g = le(h.e / U) - le(u.e / U), re = re / U | 0), m = 0; B[m] == (J[m] || 0); m++) ;
1138
+ if (B[m] > (J[m] || 0) && g--, re < 0)
1139
+ z.push(1), b = !0;
1140
+ else {
1141
+ for (Q = J.length, G = B.length, m = 0, re += 2, _ = ce(c / (B[0] + 1)), _ > 1 && (B = n(B, _, c), J = n(J, _, c), G = B.length, Q = J.length), Ne = G, M = J.slice(0, G), $ = M.length; $ < G; M[$++] = 0) ;
1142
+ Te = B.slice(), Te = [0].concat(Te), de = B[0], B[1] >= c / 2 && de++;
1143
+ do {
1144
+ if (_ = 0, f = a(B, M, G, $), f < 0) {
1145
+ if (W = M[0], G != $ && (W = W * c + (M[1] || 0)), _ = ce(W / de), _ > 1)
1146
+ for (_ >= c && (_ = c - 1), C = n(B, _, c), x = C.length, $ = M.length; a(C, M, x, $) == 1; )
1147
+ _--, i(C, G < x ? Te : B, x, c), x = C.length, f = 1;
1148
+ else
1149
+ _ == 0 && (f = _ = 1), C = B.slice(), x = C.length;
1150
+ if (x < $ && (C = [0].concat(C)), i(M, C, $, c), $ = M.length, f == -1)
1151
+ for (; a(B, M, G, $) < 1; )
1152
+ _++, i(M, G < $ ? Te : B, $, c), $ = M.length;
1153
+ } else f === 0 && (_++, M = [0]);
1154
+ z[m++] = _, M[0] ? M[$++] = J[Ne] || 0 : (M = [J[Ne]], $ = 1);
1155
+ } while ((Ne++ < Q || M[0] != null) && re--);
1156
+ b = M[0] != null, z[0] || z.splice(0, 1);
1157
+ }
1158
+ if (c == pe) {
1159
+ for (m = 1, re = z[0]; re >= 10; re /= 10, m++) ;
1160
+ te(X, p + (X.e = m + g * U - 1) + 1, I, b);
1161
+ } else
1162
+ X.e = g, X.r = +b;
1163
+ return X;
1164
+ };
1165
+ }();
1166
+ function ae(n, a, i, h) {
1167
+ var u, p, I, c, f;
1168
+ if (i == null ? i = k : q(i, 0, 8), !n.c) return n.toString();
1169
+ if (u = n.c[0], I = n.e, a == null)
1170
+ f = oe(n.c), f = h == 1 || h == 2 && (I <= L || I >= A) ? Fe(f, I) : Se(f, I, "0");
1171
+ else if (n = te(new R(n), a, i), p = n.e, f = oe(n.c), c = f.length, h == 1 || h == 2 && (a <= p || p <= L)) {
1172
+ for (; c < a; f += "0", c++) ;
1173
+ f = Fe(f, p);
1174
+ } else if (a -= I, f = Se(f, p, "0"), p + 1 > c) {
1175
+ if (--a > 0) for (f += "."; a--; f += "0") ;
1176
+ } else if (a += p - c, a > 0)
1177
+ for (p + 1 == c && (f += "."); a--; f += "0") ;
1178
+ return n.s < 0 && u ? "-" + f : f;
1179
+ }
1180
+ function me(n, a) {
1181
+ for (var i, h, u = 1, p = new R(n[0]); u < n.length; u++)
1182
+ h = new R(n[u]), (!h.s || (i = Oe(p, h)) === a || i === 0 && p.s === a) && (p = h);
1183
+ return p;
1184
+ }
1185
+ function Le(n, a, i) {
1186
+ for (var h = 1, u = a.length; !a[--u]; a.pop()) ;
1187
+ for (u = a[0]; u >= 10; u /= 10, h++) ;
1188
+ return (i = h + i * U - 1) > Y ? n.c = n.e = null : i < d ? n.c = [n.e = 0] : (n.e = i, n.c = a), n;
1189
+ }
1190
+ T = /* @__PURE__ */ function() {
1191
+ var n = /^(-?)0([xbo])(?=\w[\w.]*$)/i, a = /^([^.]+)\.$/, i = /^\.([^.]+)$/, h = /^-?(Infinity|NaN)$/, u = /^\s*\+(?=[\w.])|^\s+|\s+$/g;
1192
+ return function(p, I, c, f) {
1193
+ var g, m = c ? I : I.replace(u, "");
1194
+ if (h.test(m))
1195
+ p.s = isNaN(m) ? null : m < 0 ? -1 : 1;
1196
+ else {
1197
+ if (!c && (m = m.replace(n, function(b, _, C) {
1198
+ return g = (C = C.toLowerCase()) == "x" ? 16 : C == "b" ? 2 : 8, !f || f == g ? _ : b;
1199
+ }), f && (g = f, m = m.replace(a, "$1").replace(i, "0.$1")), I != m))
1200
+ return new R(m, g);
1201
+ if (R.DEBUG)
1202
+ throw Error(ne + "Not a" + (f ? " base " + f : "") + " number: " + I);
1203
+ p.s = null;
1204
+ }
1205
+ p.c = p.e = null;
1206
+ };
1207
+ }();
1208
+ function te(n, a, i, h) {
1209
+ var u, p, I, c, f, g, m, b = n.c, _ = Ke;
1210
+ if (b) {
1211
+ e: {
1212
+ for (u = 1, c = b[0]; c >= 10; c /= 10, u++) ;
1213
+ if (p = a - u, p < 0)
1214
+ p += U, I = a, f = b[g = 0], m = ce(f / _[u - I - 1] % 10);
1215
+ else if (g = qe((p + 1) / U), g >= b.length)
1216
+ if (h) {
1217
+ for (; b.length <= g; b.push(0)) ;
1218
+ f = m = 0, u = 1, p %= U, I = p - U + 1;
1219
+ } else
1220
+ break e;
1221
+ else {
1222
+ for (f = c = b[g], u = 1; c >= 10; c /= 10, u++) ;
1223
+ p %= U, I = p - U + u, m = I < 0 ? 0 : ce(f / _[u - I - 1] % 10);
1224
+ }
1225
+ if (h = h || a < 0 || // Are there any non-zero digits after the rounding digit?
1226
+ // The expression n % pows10[d - j - 1] returns all digits of n to the right
1227
+ // of the digit at j, e.g. if n is 908714 and j is 2, the expression gives 714.
1228
+ b[g + 1] != null || (I < 0 ? f : f % _[u - I - 1]), h = i < 4 ? (m || h) && (i == 0 || i == (n.s < 0 ? 3 : 2)) : m > 5 || m == 5 && (i == 4 || h || i == 6 && // Check whether the digit to the left of the rounding digit is odd.
1229
+ (p > 0 ? I > 0 ? f / _[u - I] : 0 : b[g - 1]) % 10 & 1 || i == (n.s < 0 ? 8 : 7)), a < 1 || !b[0])
1230
+ return b.length = 0, h ? (a -= n.e + 1, b[0] = _[(U - a % U) % U], n.e = -a || 0) : b[0] = n.e = 0, n;
1231
+ if (p == 0 ? (b.length = g, c = 1, g--) : (b.length = g + 1, c = _[U - p], b[g] = I > 0 ? ce(f / _[u - I] % _[I]) * c : 0), h)
1232
+ for (; ; )
1233
+ if (g == 0) {
1234
+ for (p = 1, I = b[0]; I >= 10; I /= 10, p++) ;
1235
+ for (I = b[0] += c, c = 1; I >= 10; I /= 10, c++) ;
1236
+ p != c && (n.e++, b[0] == pe && (b[0] = 1));
1237
+ break;
1238
+ } else {
1239
+ if (b[g] += c, b[g] != pe) break;
1240
+ b[g--] = 0, c = 1;
1241
+ }
1242
+ for (p = b.length; b[--p] === 0; b.pop()) ;
1243
+ }
1244
+ n.e > Y ? n.c = n.e = null : n.e < d && (n.c = [n.e = 0]);
1245
+ }
1246
+ return n;
1247
+ }
1248
+ function j(n) {
1249
+ var a, i = n.e;
1250
+ return i === null ? n.toString() : (a = oe(n.c), a = i <= L || i >= A ? Fe(a, i) : Se(a, i, "0"), n.s < 0 ? "-" + a : a);
1251
+ }
1252
+ return N.absoluteValue = N.abs = function() {
1253
+ var n = new R(this);
1254
+ return n.s < 0 && (n.s = 1), n;
1255
+ }, N.comparedTo = function(n, a) {
1256
+ return Oe(this, new R(n, a));
1257
+ }, N.decimalPlaces = N.dp = function(n, a) {
1258
+ var i, h, u, p = this;
1259
+ if (n != null)
1260
+ return q(n, 0, Z), a == null ? a = k : q(a, 0, 8), te(new R(p), n + p.e + 1, a);
1261
+ if (!(i = p.c)) return null;
1262
+ if (h = ((u = i.length - 1) - le(this.e / U)) * U, u = i[u]) for (; u % 10 == 0; u /= 10, h--) ;
1263
+ return h < 0 && (h = 0), h;
1264
+ }, N.dividedBy = N.div = function(n, a) {
1265
+ return o(this, new R(n, a), w, k);
1266
+ }, N.dividedToIntegerBy = N.idiv = function(n, a) {
1267
+ return o(this, new R(n, a), 0, 1);
1268
+ }, N.exponentiatedBy = N.pow = function(n, a) {
1269
+ var i, h, u, p, I, c, f, g, m, b = this;
1270
+ if (n = new R(n), n.c && !n.isInteger())
1271
+ throw Error(ne + "Exponent not an integer: " + j(n));
1272
+ if (a != null && (a = new R(a)), c = n.e > 14, !b.c || !b.c[0] || b.c[0] == 1 && !b.e && b.c.length == 1 || !n.c || !n.c[0])
1273
+ return m = new R(Math.pow(+j(b), c ? n.s * (2 - Ue(n)) : +j(n))), a ? m.mod(a) : m;
1274
+ if (f = n.s < 0, a) {
1275
+ if (a.c ? !a.c[0] : !a.s) return new R(NaN);
1276
+ h = !f && b.isInteger() && a.isInteger(), h && (b = b.mod(a));
1277
+ } else {
1278
+ if (n.e > 9 && (b.e > 0 || b.e < -1 || (b.e == 0 ? b.c[0] > 1 || c && b.c[1] >= 24e7 : b.c[0] < 8e13 || c && b.c[0] <= 9999975e7)))
1279
+ return p = b.s < 0 && Ue(n) ? -0 : 0, b.e > -1 && (p = 1 / p), new R(f ? 1 / p : p);
1280
+ ee && (p = qe(ee / U + 2));
1281
+ }
1282
+ for (c ? (i = new R(0.5), f && (n.s = 1), g = Ue(n)) : (u = Math.abs(+j(n)), g = u % 2), m = new R(D); ; ) {
1283
+ if (g) {
1284
+ if (m = m.times(b), !m.c) break;
1285
+ p ? m.c.length > p && (m.c.length = p) : h && (m = m.mod(a));
1286
+ }
1287
+ if (u) {
1288
+ if (u = ce(u / 2), u === 0) break;
1289
+ g = u % 2;
1290
+ } else if (n = n.times(i), te(n, n.e + 1, 1), n.e > 14)
1291
+ g = Ue(n);
1292
+ else {
1293
+ if (u = +j(n), u === 0) break;
1294
+ g = u % 2;
1295
+ }
1296
+ b = b.times(b), p ? b.c && b.c.length > p && (b.c.length = p) : h && (b = b.mod(a));
1297
+ }
1298
+ return h ? m : (f && (m = D.div(m)), a ? m.mod(a) : p ? te(m, ee, k, I) : m);
1299
+ }, N.integerValue = function(n) {
1300
+ var a = new R(this);
1301
+ return n == null ? n = k : q(n, 0, 8), te(a, a.e + 1, n);
1302
+ }, N.isEqualTo = N.eq = function(n, a) {
1303
+ return Oe(this, new R(n, a)) === 0;
1304
+ }, N.isFinite = function() {
1305
+ return !!this.c;
1306
+ }, N.isGreaterThan = N.gt = function(n, a) {
1307
+ return Oe(this, new R(n, a)) > 0;
1308
+ }, N.isGreaterThanOrEqualTo = N.gte = function(n, a) {
1309
+ return (a = Oe(this, new R(n, a))) === 1 || a === 0;
1310
+ }, N.isInteger = function() {
1311
+ return !!this.c && le(this.e / U) > this.c.length - 2;
1312
+ }, N.isLessThan = N.lt = function(n, a) {
1313
+ return Oe(this, new R(n, a)) < 0;
1314
+ }, N.isLessThanOrEqualTo = N.lte = function(n, a) {
1315
+ return (a = Oe(this, new R(n, a))) === -1 || a === 0;
1316
+ }, N.isNaN = function() {
1317
+ return !this.s;
1318
+ }, N.isNegative = function() {
1319
+ return this.s < 0;
1320
+ }, N.isPositive = function() {
1321
+ return this.s > 0;
1322
+ }, N.isZero = function() {
1323
+ return !!this.c && this.c[0] == 0;
1324
+ }, N.minus = function(n, a) {
1325
+ var i, h, u, p, I = this, c = I.s;
1326
+ if (n = new R(n, a), a = n.s, !c || !a) return new R(NaN);
1327
+ if (c != a)
1328
+ return n.s = -a, I.plus(n);
1329
+ var f = I.e / U, g = n.e / U, m = I.c, b = n.c;
1330
+ if (!f || !g) {
1331
+ if (!m || !b) return m ? (n.s = -a, n) : new R(b ? I : NaN);
1332
+ if (!m[0] || !b[0])
1333
+ return b[0] ? (n.s = -a, n) : new R(m[0] ? I : (
1334
+ // IEEE 754 (2008) 6.3: n - n = -0 when rounding to -Infinity
1335
+ k == 3 ? -0 : 0
1336
+ ));
1337
+ }
1338
+ if (f = le(f), g = le(g), m = m.slice(), c = f - g) {
1339
+ for ((p = c < 0) ? (c = -c, u = m) : (g = f, u = b), u.reverse(), a = c; a--; u.push(0)) ;
1340
+ u.reverse();
1341
+ } else
1342
+ for (h = (p = (c = m.length) < (a = b.length)) ? c : a, c = a = 0; a < h; a++)
1343
+ if (m[a] != b[a]) {
1344
+ p = m[a] < b[a];
1345
+ break;
1346
+ }
1347
+ if (p && (u = m, m = b, b = u, n.s = -n.s), a = (h = b.length) - (i = m.length), a > 0) for (; a--; m[i++] = 0) ;
1348
+ for (a = pe - 1; h > c; ) {
1349
+ if (m[--h] < b[h]) {
1350
+ for (i = h; i && !m[--i]; m[i] = a) ;
1351
+ --m[i], m[h] += pe;
1352
+ }
1353
+ m[h] -= b[h];
1354
+ }
1355
+ for (; m[0] == 0; m.splice(0, 1), --g) ;
1356
+ return m[0] ? Le(n, m, g) : (n.s = k == 3 ? -1 : 1, n.c = [n.e = 0], n);
1357
+ }, N.modulo = N.mod = function(n, a) {
1358
+ var i, h, u = this;
1359
+ return n = new R(n, a), !u.c || !n.s || n.c && !n.c[0] ? new R(NaN) : !n.c || u.c && !u.c[0] ? new R(u) : (fe == 9 ? (h = n.s, n.s = 1, i = o(u, n, 0, 3), n.s = h, i.s *= h) : i = o(u, n, 0, fe), n = u.minus(i.times(n)), !n.c[0] && fe == 1 && (n.s = u.s), n);
1360
+ }, N.multipliedBy = N.times = function(n, a) {
1361
+ var i, h, u, p, I, c, f, g, m, b, _, C, x, X, z, M = this, $ = M.c, W = (n = new R(n, a)).c;
1362
+ if (!$ || !W || !$[0] || !W[0])
1363
+ return !M.s || !n.s || $ && !$[0] && !W || W && !W[0] && !$ ? n.c = n.e = n.s = null : (n.s *= M.s, !$ || !W ? n.c = n.e = null : (n.c = [0], n.e = 0)), n;
1364
+ for (h = le(M.e / U) + le(n.e / U), n.s *= M.s, f = $.length, b = W.length, f < b && (x = $, $ = W, W = x, u = f, f = b, b = u), u = f + b, x = []; u--; x.push(0)) ;
1365
+ for (X = pe, z = Re, u = b; --u >= 0; ) {
1366
+ for (i = 0, _ = W[u] % z, C = W[u] / z | 0, I = f, p = u + I; p > u; )
1367
+ g = $[--I] % z, m = $[I] / z | 0, c = C * g + m * _, g = _ * g + c % z * z + x[p] + i, i = (g / X | 0) + (c / z | 0) + C * m, x[p--] = g % X;
1368
+ x[p] = i;
1369
+ }
1370
+ return i ? ++h : x.splice(0, 1), Le(n, x, h);
1371
+ }, N.negated = function() {
1372
+ var n = new R(this);
1373
+ return n.s = -n.s || null, n;
1374
+ }, N.plus = function(n, a) {
1375
+ var i, h = this, u = h.s;
1376
+ if (n = new R(n, a), a = n.s, !u || !a) return new R(NaN);
1377
+ if (u != a)
1378
+ return n.s = -a, h.minus(n);
1379
+ var p = h.e / U, I = n.e / U, c = h.c, f = n.c;
1380
+ if (!p || !I) {
1381
+ if (!c || !f) return new R(u / 0);
1382
+ if (!c[0] || !f[0]) return f[0] ? n : new R(c[0] ? h : u * 0);
1383
+ }
1384
+ if (p = le(p), I = le(I), c = c.slice(), u = p - I) {
1385
+ for (u > 0 ? (I = p, i = f) : (u = -u, i = c), i.reverse(); u--; i.push(0)) ;
1386
+ i.reverse();
1387
+ }
1388
+ for (u = c.length, a = f.length, u - a < 0 && (i = f, f = c, c = i, a = u), u = 0; a; )
1389
+ u = (c[--a] = c[a] + f[a] + u) / pe | 0, c[a] = pe === c[a] ? 0 : c[a] % pe;
1390
+ return u && (c = [u].concat(c), ++I), Le(n, c, I);
1391
+ }, N.precision = N.sd = function(n, a) {
1392
+ var i, h, u, p = this;
1393
+ if (n != null && n !== !!n)
1394
+ return q(n, 1, Z), a == null ? a = k : q(a, 0, 8), te(new R(p), n, a);
1395
+ if (!(i = p.c)) return null;
1396
+ if (u = i.length - 1, h = u * U + 1, u = i[u]) {
1397
+ for (; u % 10 == 0; u /= 10, h--) ;
1398
+ for (u = i[0]; u >= 10; u /= 10, h++) ;
1399
+ }
1400
+ return n && p.e + 1 > h && (h = p.e + 1), h;
1401
+ }, N.shiftedBy = function(n) {
1402
+ return q(n, -We, We), this.times("1e" + n);
1403
+ }, N.squareRoot = N.sqrt = function() {
1404
+ var n, a, i, h, u, p = this, I = p.c, c = p.s, f = p.e, g = w + 4, m = new R("0.5");
1405
+ if (c !== 1 || !I || !I[0])
1406
+ return new R(!c || c < 0 && (!I || I[0]) ? NaN : I ? p : 1 / 0);
1407
+ if (c = Math.sqrt(+j(p)), c == 0 || c == 1 / 0 ? (a = oe(I), (a.length + f) % 2 == 0 && (a += "0"), c = Math.sqrt(+a), f = le((f + 1) / 2) - (f < 0 || f % 2), c == 1 / 0 ? a = "5e" + f : (a = c.toExponential(), a = a.slice(0, a.indexOf("e") + 1) + f), i = new R(a)) : i = new R(c + ""), i.c[0]) {
1408
+ for (f = i.e, c = f + g, c < 3 && (c = 0); ; )
1409
+ if (u = i, i = m.times(u.plus(o(p, u, g, 1))), oe(u.c).slice(0, c) === (a = oe(i.c)).slice(0, c))
1410
+ if (i.e < f && --c, a = a.slice(c - 3, c + 1), a == "9999" || !h && a == "4999") {
1411
+ if (!h && (te(u, u.e + w + 2, 0), u.times(u).eq(p))) {
1412
+ i = u;
1413
+ break;
1414
+ }
1415
+ g += 4, c += 4, h = 1;
1416
+ } else {
1417
+ (!+a || !+a.slice(1) && a.charAt(0) == "5") && (te(i, i.e + w + 2, 1), n = !i.times(i).eq(p));
1418
+ break;
1419
+ }
1420
+ }
1421
+ return te(i, i.e + w + 1, k, n);
1422
+ }, N.toExponential = function(n, a) {
1423
+ return n != null && (q(n, 0, Z), n++), ae(this, n, a, 1);
1424
+ }, N.toFixed = function(n, a) {
1425
+ return n != null && (q(n, 0, Z), n = n + this.e + 1), ae(this, n, a);
1426
+ }, N.toFormat = function(n, a, i) {
1427
+ var h, u = this;
1428
+ if (i == null)
1429
+ n != null && a && typeof a == "object" ? (i = a, a = null) : n && typeof n == "object" ? (i = n, n = a = null) : i = Ie;
1430
+ else if (typeof i != "object")
1431
+ throw Error(ne + "Argument not an object: " + i);
1432
+ if (h = u.toFixed(n, a), u.c) {
1433
+ var p, I = h.split("."), c = +i.groupSize, f = +i.secondaryGroupSize, g = i.groupSeparator || "", m = I[0], b = I[1], _ = u.s < 0, C = _ ? m.slice(1) : m, x = C.length;
1434
+ if (f && (p = c, c = f, f = p, x -= p), c > 0 && x > 0) {
1435
+ for (p = x % c || c, m = C.substr(0, p); p < x; p += c) m += g + C.substr(p, c);
1436
+ f > 0 && (m += g + C.slice(p)), _ && (m = "-" + m);
1437
+ }
1438
+ h = b ? m + (i.decimalSeparator || "") + ((f = +i.fractionGroupSize) ? b.replace(
1439
+ new RegExp("\\d{" + f + "}\\B", "g"),
1440
+ "$&" + (i.fractionGroupSeparator || "")
1441
+ ) : b) : m;
1442
+ }
1443
+ return (i.prefix || "") + h + (i.suffix || "");
1444
+ }, N.toFraction = function(n) {
1445
+ var a, i, h, u, p, I, c, f, g, m, b, _, C = this, x = C.c;
1446
+ if (n != null && (c = new R(n), !c.isInteger() && (c.c || c.s !== 1) || c.lt(D)))
1447
+ throw Error(ne + "Argument " + (c.isInteger() ? "out of range: " : "not an integer: ") + j(c));
1448
+ if (!x) return new R(C);
1449
+ for (a = new R(D), g = i = new R(D), h = f = new R(D), _ = oe(x), p = a.e = _.length - C.e - 1, a.c[0] = Ke[(I = p % U) < 0 ? U + I : I], n = !n || c.comparedTo(a) > 0 ? p > 0 ? a : g : c, I = Y, Y = 1 / 0, c = new R(_), f.c[0] = 0; m = o(c, a, 0, 1), u = i.plus(m.times(h)), u.comparedTo(n) != 1; )
1450
+ i = h, h = u, g = f.plus(m.times(u = g)), f = u, a = c.minus(m.times(u = a)), c = u;
1451
+ return u = o(n.minus(i), h, 0, 1), f = f.plus(u.times(g)), i = i.plus(u.times(h)), f.s = g.s = C.s, p = p * 2, b = o(g, h, p, k).minus(C).abs().comparedTo(
1452
+ o(f, i, p, k).minus(C).abs()
1453
+ ) < 1 ? [g, h] : [f, i], Y = I, b;
1454
+ }, N.toNumber = function() {
1455
+ return +j(this);
1456
+ }, N.toPrecision = function(n, a) {
1457
+ return n != null && q(n, 1, Z), ae(this, n, a, 2);
1458
+ }, N.toString = function(n) {
1459
+ var a, i = this, h = i.s, u = i.e;
1460
+ return u === null ? h ? (a = "Infinity", h < 0 && (a = "-" + a)) : a = "NaN" : (n == null ? a = u <= L || u >= A ? Fe(oe(i.c), u) : Se(oe(i.c), u, "0") : n === 10 && _e ? (i = te(new R(i), w + u + 1, k), a = Se(oe(i.c), i.e, "0")) : (q(n, 2, Ae.length, "Base"), a = E(Se(oe(i.c), u, "0"), 10, n, h, !0)), h < 0 && i.c[0] && (a = "-" + a)), a;
1461
+ }, N.valueOf = N.toJSON = function() {
1462
+ return j(this);
1463
+ }, N._isBigNumber = !0, N[Symbol.toStringTag] = "BigNumber", N[Symbol.for("nodejs.util.inspect.custom")] = N.valueOf, t != null && R.set(t), R;
1464
+ }
1465
+ function le(t) {
1466
+ var o = t | 0;
1467
+ return t > 0 || t === o ? o : o - 1;
1468
+ }
1469
+ function oe(t) {
1470
+ for (var o, E, T = 1, N = t.length, D = t[0] + ""; T < N; ) {
1471
+ for (o = t[T++] + "", E = U - o.length; E--; o = "0" + o) ;
1472
+ D += o;
1473
+ }
1474
+ for (N = D.length; D.charCodeAt(--N) === 48; ) ;
1475
+ return D.slice(0, N + 1 || 1);
1476
+ }
1477
+ function Oe(t, o) {
1478
+ var E, T, N = t.c, D = o.c, w = t.s, k = o.s, L = t.e, A = o.e;
1479
+ if (!w || !k) return null;
1480
+ if (E = N && !N[0], T = D && !D[0], E || T) return E ? T ? 0 : -k : w;
1481
+ if (w != k) return w;
1482
+ if (E = w < 0, T = L == A, !N || !D) return T ? 0 : !N ^ E ? 1 : -1;
1483
+ if (!T) return L > A ^ E ? 1 : -1;
1484
+ for (k = (L = N.length) < (A = D.length) ? L : A, w = 0; w < k; w++) if (N[w] != D[w]) return N[w] > D[w] ^ E ? 1 : -1;
1485
+ return L == A ? 0 : L > A ^ E ? 1 : -1;
1486
+ }
1487
+ function q(t, o, E, T) {
1488
+ if (t < o || t > E || t !== ce(t))
1489
+ throw Error(ne + (T || "Argument") + (typeof t == "number" ? t < o || t > E ? " out of range: " : " not an integer: " : " not a primitive number: ") + String(t));
1490
+ }
1491
+ function Ue(t) {
1492
+ var o = t.c.length - 1;
1493
+ return le(t.e / U) == o && t.c[o] % 2 != 0;
1494
+ }
1495
+ function Fe(t, o) {
1496
+ return (t.length > 1 ? t.charAt(0) + "." + t.slice(1) : t) + (o < 0 ? "e" : "e+") + o;
1497
+ }
1498
+ function Se(t, o, E) {
1499
+ var T, N;
1500
+ if (o < 0) {
1501
+ for (N = E + "."; ++o; N += E) ;
1502
+ t = N + t;
1503
+ } else if (T = t.length, ++o > T) {
1504
+ for (N = E, o -= T; --o; N += E) ;
1505
+ t += N;
1506
+ } else o < T && (t = t.slice(0, o) + "." + t.slice(o));
1507
+ return t;
1508
+ }
1509
+ var bi = kt();
1510
+ const Ti = e.boolean().transform((t) => String(t)), yi = e.string().transform((t) => t === "true");
1511
+ var ot;
1512
+ (function(t) {
1513
+ t[t.function = 0] = "function", t[t.l1_handler = 1] = "l1_handler", t[t.constructor = 2] = "constructor";
1514
+ })(ot || (ot = {}));
1515
+ const Ut = e.array(e.string()), Ye = e.object({
1516
+ selector: e.string(),
1517
+ offset: e.string(),
1518
+ builtins: Ut.optional()
1519
+ }), Ft = e.object({
1520
+ CONSTRUCTOR: e.array(Ye),
1521
+ EXTERNAL: e.array(Ye),
1522
+ L1_HANDLER: e.array(Ye)
1523
+ }), Ri = e.string(), gn = e.object({
1524
+ builtins: Ut,
1525
+ data: e.array(e.string())
1526
+ }), ct = e.object({
1527
+ name: e.string(),
1528
+ type: e.union([e.literal("felt"), e.literal("felt*"), e.string()])
1529
+ }), En = e.nativeEnum(ot), In = e.object({
1530
+ inputs: e.array(ct),
1531
+ name: e.string(),
1532
+ outputs: e.array(ct),
1533
+ stateMutability: e.literal("view").optional(),
1534
+ state_mutability: e.string().optional(),
1535
+ type: En
1536
+ }), lt = e.object({
1537
+ name: e.string(),
1538
+ type: e.union([e.literal("felt"), e.literal("felt*"), e.string()]),
1539
+ kind: e.union([e.literal("key"), e.literal("data")])
1540
+ }), An = e.object({
1541
+ name: e.string(),
1542
+ type: e.literal("event"),
1543
+ data: e.array(lt),
1544
+ keys: e.array(lt)
1545
+ }), Nn = e.object({
1546
+ name: e.string(),
1547
+ members: e.array(lt),
1548
+ kind: e.literal("struct"),
1549
+ type: e.literal("event")
1550
+ }), Sn = e.object({
1551
+ members: e.array(ct.and(e.object({
1552
+ offset: e.number()
1553
+ }))),
1554
+ name: e.string(),
1555
+ size: e.number(),
1556
+ type: e.literal("struct")
1557
+ }), bn = e.union([Nn, An]), xt = e.array(e.union([In, bn, Sn, e.any()])), Tn = e.object({
1558
+ program: gn,
1559
+ entry_points_by_type: Ft,
1560
+ abi: xt
1561
+ }), Bt = e.array(e.string()), yn = e.object({
1562
+ type_names: e.array(e.tuple([e.number(), e.string()])),
1563
+ libfunc_names: e.array(e.tuple([e.number(), e.string()])),
1564
+ user_func_names: e.array(e.tuple([e.number(), e.string()]))
1565
+ }), Ze = e.object({
1566
+ selector: e.string(),
1567
+ function_idx: e.number()
1568
+ }), Rn = e.object({
1569
+ CONSTRUCTOR: e.array(Ze),
1570
+ EXTERNAL: e.array(Ze),
1571
+ L1_HANDLER: e.array(Ze)
1572
+ }), vn = e.object({
1573
+ sierra_program: Bt,
1574
+ sierra_program_debug_info: yn.optional(),
1575
+ contract_class_version: e.string(),
1576
+ entry_points_by_type: Rn,
1577
+ abi: xt
1578
+ }), On = e.array(e.tuple([e.number(), e.array(e.string())])), wn = e.object({
1579
+ prime: e.string(),
1580
+ compiler_version: e.string(),
1581
+ bytecode: Bt,
1582
+ hints: e.array(e.any()),
1583
+ pythonic_hints: On,
1584
+ entry_points_by_type: Ft
1585
+ }), vi = wn, Oi = e.union([
1586
+ Tn,
1587
+ vn
1588
+ ]), Mt = Br(null), Gt = () => Mr(Mt), wi = () => {
1589
+ var t;
1590
+ return !!((t = Gt()) != null && t.emitter);
1591
+ }, _i = ({ emitter: t, children: o }) => /* @__PURE__ */ xr(Mt.Provider, { value: {
1592
+ emitter: t
1593
+ }, children: o });
1594
+ let Rt = !1;
1595
+ const Vt = () => {
1596
+ var E;
1597
+ const t = (E = Gt()) == null ? void 0 : E.emitter;
1598
+ if (!t && !Rt) {
1599
+ Rt = !0;
1600
+ return;
1601
+ }
1602
+ return t;
1603
+ }, Li = () => {
1604
+ const t = Vt();
1605
+ return t ? t.emit.bind(t) : kr;
1606
+ }, Ci = () => {
1607
+ const t = Vt();
1608
+ return (E, T) => {
1609
+ Gr(() => t ? t.on(E, T) : void 0, [E, T]);
1610
+ };
1611
+ };
1612
+ var _n = {};
1613
+ function ue(t, o) {
1614
+ typeof o == "boolean" && (o = { forever: o }), this._originalTimeouts = JSON.parse(JSON.stringify(t)), this._timeouts = t, this._options = o || {}, this._maxRetryTime = o && o.maxRetryTime || 1 / 0, this._fn = null, this._errors = [], this._attempts = 1, this._operationTimeout = null, this._operationTimeoutCb = null, this._timeout = null, this._operationStart = null, this._timer = null, this._options.forever && (this._cachedTimeouts = this._timeouts.slice(0));
1615
+ }
1616
+ var Ln = ue;
1617
+ ue.prototype.reset = function() {
1618
+ this._attempts = 1, this._timeouts = this._originalTimeouts.slice(0);
1619
+ };
1620
+ ue.prototype.stop = function() {
1621
+ this._timeout && clearTimeout(this._timeout), this._timer && clearTimeout(this._timer), this._timeouts = [], this._cachedTimeouts = null;
1622
+ };
1623
+ ue.prototype.retry = function(t) {
1624
+ if (this._timeout && clearTimeout(this._timeout), !t)
1625
+ return !1;
1626
+ var o = (/* @__PURE__ */ new Date()).getTime();
1627
+ if (t && o - this._operationStart >= this._maxRetryTime)
1628
+ return this._errors.push(t), this._errors.unshift(new Error("RetryOperation timeout occurred")), !1;
1629
+ this._errors.push(t);
1630
+ var E = this._timeouts.shift();
1631
+ if (E === void 0)
1632
+ if (this._cachedTimeouts)
1633
+ this._errors.splice(0, this._errors.length - 1), E = this._cachedTimeouts.slice(-1);
1634
+ else
1635
+ return !1;
1636
+ var T = this;
1637
+ return this._timer = setTimeout(function() {
1638
+ T._attempts++, T._operationTimeoutCb && (T._timeout = setTimeout(function() {
1639
+ T._operationTimeoutCb(T._attempts);
1640
+ }, T._operationTimeout), T._options.unref && T._timeout.unref()), T._fn(T._attempts);
1641
+ }, E), this._options.unref && this._timer.unref(), !0;
1642
+ };
1643
+ ue.prototype.attempt = function(t, o) {
1644
+ this._fn = t, o && (o.timeout && (this._operationTimeout = o.timeout), o.cb && (this._operationTimeoutCb = o.cb));
1645
+ var E = this;
1646
+ this._operationTimeoutCb && (this._timeout = setTimeout(function() {
1647
+ E._operationTimeoutCb();
1648
+ }, E._operationTimeout)), this._operationStart = (/* @__PURE__ */ new Date()).getTime(), this._fn(this._attempts);
1649
+ };
1650
+ ue.prototype.try = function(t) {
1651
+ this.attempt(t);
1652
+ };
1653
+ ue.prototype.start = function(t) {
1654
+ this.attempt(t);
1655
+ };
1656
+ ue.prototype.start = ue.prototype.try;
1657
+ ue.prototype.errors = function() {
1658
+ return this._errors;
1659
+ };
1660
+ ue.prototype.attempts = function() {
1661
+ return this._attempts;
1662
+ };
1663
+ ue.prototype.mainError = function() {
1664
+ if (this._errors.length === 0)
1665
+ return null;
1666
+ for (var t = {}, o = null, E = 0, T = 0; T < this._errors.length; T++) {
1667
+ var N = this._errors[T], D = N.message, w = (t[D] || 0) + 1;
1668
+ t[D] = w, w >= E && (o = N, E = w);
1669
+ }
1670
+ return o;
1671
+ };
1672
+ (function(t) {
1673
+ var o = Ln;
1674
+ t.operation = function(E) {
1675
+ var T = t.timeouts(E);
1676
+ return new o(T, {
1677
+ forever: E && (E.forever || E.retries === 1 / 0),
1678
+ unref: E && E.unref,
1679
+ maxRetryTime: E && E.maxRetryTime
1680
+ });
1681
+ }, t.timeouts = function(E) {
1682
+ if (E instanceof Array)
1683
+ return [].concat(E);
1684
+ var T = {
1685
+ retries: 10,
1686
+ factor: 2,
1687
+ minTimeout: 1 * 1e3,
1688
+ maxTimeout: 1 / 0,
1689
+ randomize: !1
1690
+ };
1691
+ for (var N in E)
1692
+ T[N] = E[N];
1693
+ if (T.minTimeout > T.maxTimeout)
1694
+ throw new Error("minTimeout is greater than maxTimeout");
1695
+ for (var D = [], w = 0; w < T.retries; w++)
1696
+ D.push(this.createTimeout(w, T));
1697
+ return E && E.forever && !D.length && D.push(this.createTimeout(w, T)), D.sort(function(k, L) {
1698
+ return k - L;
1699
+ }), D;
1700
+ }, t.createTimeout = function(E, T) {
1701
+ var N = T.randomize ? Math.random() + 1 : 1, D = Math.round(N * Math.max(T.minTimeout, 1) * Math.pow(T.factor, E));
1702
+ return D = Math.min(D, T.maxTimeout), D;
1703
+ }, t.wrap = function(E, T, N) {
1704
+ if (T instanceof Array && (N = T, T = null), !N) {
1705
+ N = [];
1706
+ for (var D in E)
1707
+ typeof E[D] == "function" && N.push(D);
1708
+ }
1709
+ for (var w = 0; w < N.length; w++) {
1710
+ var k = N[w], L = E[k];
1711
+ E[k] = (function(d) {
1712
+ var Y = t.operation(T), P = Array.prototype.slice.call(arguments, 1), fe = P.pop();
1713
+ P.push(function(ee) {
1714
+ Y.retry(ee) || (ee && (arguments[0] = Y.mainError()), fe.apply(this, arguments));
1715
+ }), Y.attempt(function() {
1716
+ d.apply(E, P);
1717
+ });
1718
+ }).bind(E, L), E[k].options = T;
1719
+ }
1720
+ };
1721
+ })(_n);
1722
+ var ut;
1723
+ (function(t) {
1724
+ t.NO_TOKEN_API_URL = "NO_TOKEN_API_URL is not defined", t.NO_TOKEN_PRICE_API_URL = "NO_TOKEN_PRICE_API_URL is not defined", t.TOKENS_DEFI_DECOMPOSITION_URL = "TOKENS_DEFI_DECOMPOSITION_URL is not defined", t.TOKENS_AIRDROPS_API_URL = "TOKENS_AIRDROPS_API_URL is not defined", t.TOKEN_PARSING_ERROR = "Unable to parse token data response", t.TOKEN_PRICE_PARSING_ERROR = "Unable to parse token price response", t.TOKEN_DEFI_DECOMPOSITION_PARSING_ERROR = "Unable to parse token defi decomposition response", t.TOKEN_PRICE_NOT_FOUND = "Token price not found", t.TOKEN_NOT_FOUND = "Token not found", t.TOKEN_DETAILS_NOT_FOUND = "Token details not found", t.FEE_TOKEN_NOT_FOUND = "Fee token not found", t.UNABLE_TO_CALCULATE_CURRENCY_VALUE = "Unable to calculate currency value", t.UNSAFE_DECIMALS = "Unsafe decimals in token";
1725
+ })(ut || (ut = {}));
1726
+ class Di extends we {
1727
+ constructor(o) {
1728
+ super(o, ut), this.name = "TokenError";
1729
+ }
1730
+ }
1731
+ const $t = e.union([
1732
+ e.literal("concentratedLiquidityPosition"),
1733
+ e.literal("collateralizedDebtPosition")
1734
+ ]), Pi = e.object({
1735
+ status: e.literal("initialising")
1736
+ }).or(e.object({
1737
+ status: e.literal("initialised"),
1738
+ balances: e.array(e.object({
1739
+ tokenAddress: H,
1740
+ tokenBalance: e.string()
1741
+ }))
1742
+ })), Pe = e.object({
1743
+ id: e.number(),
1744
+ address: K,
1745
+ brandColor: e.string().optional(),
1746
+ name: e.string(),
1747
+ symbol: e.string(),
1748
+ decimals: e.number(),
1749
+ iconUrl: e.string().optional(),
1750
+ sendable: e.boolean(),
1751
+ popular: e.boolean(),
1752
+ refundable: e.boolean(),
1753
+ listed: e.boolean(),
1754
+ tradable: e.boolean(),
1755
+ category: e.union([
1756
+ e.literal("tokens"),
1757
+ e.literal("currencies"),
1758
+ e.literal("savings")
1759
+ ]),
1760
+ pricingId: e.number().optional(),
1761
+ dappId: e.string().optional(),
1762
+ marketData: e.object({
1763
+ marketCap: e.number(),
1764
+ marketCap24hChange: e.number(),
1765
+ dailyVolume: e.number(),
1766
+ rank: e.number()
1767
+ }).optional(),
1768
+ tags: e.array(e.string()).optional()
1769
+ }), ji = e.object({
1770
+ tokens: e.array(Pe)
1771
+ }), ki = Pe, Xt = e.object({
1772
+ pricingId: e.number(),
1773
+ ethValue: e.string(),
1774
+ ccyValue: e.string(),
1775
+ ethDayChange: e.string(),
1776
+ ccyDayChange: e.string()
1777
+ }), Ui = e.object({
1778
+ prices: e.array(Xt)
1779
+ }), vt = e.object({
1780
+ tokenAddress: H,
1781
+ principal: e.string(),
1782
+ accruedFees: e.string(),
1783
+ minPrice: e.string(),
1784
+ maxPrice: e.string(),
1785
+ currentPrice: e.string()
1786
+ }), Ht = e.object({
1787
+ tokenAddress: K.optional(),
1788
+ totalBalances: e.record(e.string())
1789
+ }), zt = Ht.extend({
1790
+ tokenId: e.string(),
1791
+ data: e.object({
1792
+ poolFeePercentage: e.string(),
1793
+ tickSpacingPercentage: e.string().optional(),
1794
+ token0: vt,
1795
+ token1: vt
1796
+ })
1797
+ }), Fi = e.array(zt), qt = Ht.extend({
1798
+ data: e.object({
1799
+ apy: e.string().optional(),
1800
+ group: e.number().optional(),
1801
+ collateral: e.boolean(),
1802
+ debt: e.boolean(),
1803
+ lending: e.boolean()
1804
+ })
1805
+ }), xi = e.array(qt), Cn = e.array(zt.or(qt)), Dn = e.object({
1806
+ name: e.string(),
1807
+ manageUrl: e.string(),
1808
+ type: $t,
1809
+ groups: e.record(e.object({
1810
+ name: e.string().optional(),
1811
+ healthRatio: e.string().optional()
1812
+ })).optional(),
1813
+ positions: Cn
1814
+ }), Pn = e.object({
1815
+ dappId: e.string(),
1816
+ products: e.array(Dn)
1817
+ }), Bi = e.object({
1818
+ dapps: e.array(Pn)
1819
+ }), jn = e.object({
1820
+ name: e.string().optional(),
1821
+ tokenAddress: K,
1822
+ amount: e.string().optional(),
1823
+ claimUrl: e.string().optional(),
1824
+ claimStart: e.number(),
1825
+ claimEnd: e.number().optional()
1826
+ }), Mi = e.object({
1827
+ accountAddress: K,
1828
+ chain: e.string(),
1829
+ airdrops: e.array(jn)
1830
+ }), He = e.object({
1831
+ address: K,
1832
+ networkId: e.string({ required_error: "Network is required" })
1833
+ }, { required_error: "BaseToken is required" });
1834
+ He.required().extend({
1835
+ balance: e.string()
1836
+ });
1837
+ const Wt = He.required().extend({
1838
+ id: e.number().optional(),
1839
+ name: e.string().optional(),
1840
+ symbol: e.string().optional(),
1841
+ decimals: e.coerce.number().optional(),
1842
+ iconUrl: e.string().url("").optional().or(e.literal("")),
1843
+ // fallback since some iconUrls are empty, causing validation to fail
1844
+ pricingId: e.number().optional(),
1845
+ category: e.string().optional(),
1846
+ dappId: e.string().optional(),
1847
+ brandColor: e.string().optional()
1848
+ }), kn = Wt.extend({
1849
+ balance: e.string()
1850
+ }), Un = Wt.extend({
1851
+ currencyValue: e.string(),
1852
+ ccyDayChange: e.string().optional(),
1853
+ ethDayChange: e.string().optional(),
1854
+ unitCurrencyValue: e.string().optional()
1855
+ }), Et = Un.extend({
1856
+ ...kn.shape
1857
+ });
1858
+ e.array(Et);
1859
+ He.extend({
1860
+ ...Xt.shape
1861
+ });
1862
+ He.extend({
1863
+ ...Pe.shape
1864
+ });
1865
+ const Ot = Et.extend({
1866
+ accruedFees: e.string(),
1867
+ currentPrice: e.string(),
1868
+ maxPrice: e.string(),
1869
+ minPrice: e.string(),
1870
+ principal: e.string()
1871
+ }), Kt = e.object({
1872
+ address: K.optional(),
1873
+ currencyValue: e.string().default("0")
1874
+ }), Yt = Kt.extend({
1875
+ poolFeePercentage: e.string(),
1876
+ tickSpacingPercentage: e.string().optional(),
1877
+ tokenId: e.string().optional(),
1878
+ unitCurrencyValueToken0: e.string().optional(),
1879
+ unitCurrencyValueToken1: e.string().optional(),
1880
+ token0: Ot,
1881
+ token1: Ot
1882
+ }), Gi = e.array(Yt), Vi = e.object({
1883
+ name: e.string().optional(),
1884
+ healthRatio: e.string().optional(),
1885
+ accountAddress: K.optional()
1886
+ }), Zt = Kt.extend({
1887
+ totalBalances: e.record(e.string()),
1888
+ collateral: e.boolean(),
1889
+ debt: e.boolean(),
1890
+ lending: e.boolean(),
1891
+ apy: e.string().optional(),
1892
+ group: e.string().optional(),
1893
+ unitCurrencyValue: e.string().optional(),
1894
+ positionToken: Pe.or(e.undefined()),
1895
+ token: Et.optional(),
1896
+ accountAddress: K.optional(),
1897
+ accountAddressGroup: e.string().optional()
1898
+ }), $i = e.array(Zt), Fn = Yt.or(Zt), xn = e.record(e.object({
1899
+ name: e.string().optional(),
1900
+ healthRatio: e.string().optional(),
1901
+ accountAddress: K.optional()
1902
+ })), Bn = e.object({
1903
+ type: $t,
1904
+ manageUrl: e.string().url().optional(),
1905
+ name: e.string(),
1906
+ positions: e.array(Fn),
1907
+ // other types will be added when available from be
1908
+ positionsTotalValue: e.string(),
1909
+ brandColor: e.string().optional(),
1910
+ groups: xn.optional(),
1911
+ accountAddress: K
1912
+ }), Mn = e.array(Bn), Xi = e.object({
1913
+ dappId: e.string(),
1914
+ products: Mn
1915
+ }), Gn = e.object({
1916
+ name: e.string().optional(),
1917
+ tokenAddress: K,
1918
+ token: Pe.optional(),
1919
+ amount: e.string().optional(),
1920
+ claimUrl: e.string().optional(),
1921
+ claimStart: e.number(),
1922
+ claimEnd: e.number().optional()
1923
+ }), Hi = e.array(Gn), Vn = (t, o = 18) => Vr(t.replace(",", "."), Number(o)), $n = e.string().trim().refine((t) => t !== "", {
1924
+ message: "Amount is required"
1925
+ }).refine((t) => {
1926
+ try {
1927
+ const o = Vn(t).value;
1928
+ if (o < 0n)
1929
+ throw new Error("Amount must be positive");
1930
+ if (o === 0n)
1931
+ throw new Error("Amount can not be zero");
1932
+ if (o > Qe.UINT_256_MAX)
1933
+ throw new Error("Amount is too big");
1934
+ } catch {
1935
+ throw new Error("Amount should be a number");
1936
+ }
1937
+ return !0;
1938
+ }, { message: "Invalid amount" }), zi = (t) => !!$n.parse(t), Xn = e.object({
1939
+ data: e.object({
1940
+ code: e.string().optional(),
1941
+ // "STARKNAME_NOT_FOUND",
1942
+ name: e.string().optional(),
1943
+ // "AddressError"
1944
+ message: e.string()
1945
+ // "foo.stark not found"
1946
+ })
1947
+ }), qi = (t) => {
1948
+ const o = Xn.safeParse(t);
1949
+ if (o.success)
1950
+ return o.data.data.message;
1951
+ }, Hn = 3, Jt = process.env.FEE_OVERHEAD ? parseFloat(process.env.FEE_OVERHEAD) : Hn, zn = 1.5, Ge = 10, qn = ({ estimatedFee: t, overheadMultiplier: o = Jt }) => {
1952
+ const T = be.toBigInt(t) * BigInt(o * Ge) / BigInt(Ge);
1953
+ return be.toHex(T);
1954
+ }, Wi = ({ suggestedMaxFee: t, overheadMultiplier: o = Jt, starknetJsOverheadMultiplier: E = zn }) => {
1955
+ const N = be.toBigInt(t) * BigInt(Ge) / BigInt(E * Ge);
1956
+ return qn({ estimatedFee: N, overheadMultiplier: o });
1957
+ };
1958
+ var ft;
1959
+ (function(t) {
1960
+ t.SIMULATE_AND_REVIEW_FAILED = "Missing simulation";
1961
+ })(ft || (ft = {}));
1962
+ class Ki extends we {
1963
+ constructor(o) {
1964
+ super(o, ft), this.name = "EstimateError";
1965
+ }
1966
+ }
1967
+ const Yi = e.object({
1968
+ type: e.enum(["DECLARE", "DEPLOY", "DEPLOY_ACCOUNT", "INVOKE"]).default("INVOKE"),
1969
+ calls: e.array(bt).or(bt).optional(),
1970
+ calldata: e.array(e.string()).optional(),
1971
+ classHash: Me.optional(),
1972
+ salt: Me.optional(),
1973
+ signature: e.array(e.string()).optional()
1974
+ }), Wn = e.object({
1975
+ amount: e.bigint(),
1976
+ pricePerUnit: e.bigint()
1977
+ }).or(e.object({ maxFee: e.bigint() })), wt = e.object({
1978
+ feeTokenAddress: K,
1979
+ amount: e.bigint(),
1980
+ pricePerUnit: e.bigint(),
1981
+ max: Wn.optional(),
1982
+ dataGasConsumed: e.bigint().optional(),
1983
+ dataGasPrice: e.bigint().optional()
1984
+ }), Kn = e.object({
1985
+ deployment: wt.optional(),
1986
+ transactions: wt
1987
+ }), Yn = e.union([
1988
+ e.literal("critical"),
1989
+ e.literal("high"),
1990
+ e.literal("caution"),
1991
+ e.literal("info")
1992
+ ]), Zn = e.string(), Jn = e.object({
1993
+ name: e.string(),
1994
+ url: e.string(),
1995
+ position: e.number()
1996
+ }), Je = e.object({
1997
+ address: e.string(),
1998
+ name: e.string(),
1999
+ symbol: e.string().optional(),
2000
+ decimals: e.number().optional(),
2001
+ unknown: e.boolean(),
2002
+ iconUrl: e.string().optional(),
2003
+ type: e.string()
2004
+ }), _t = e.discriminatedUnion("type", [
2005
+ e.object({
2006
+ type: e.literal("amount"),
2007
+ label: e.string(),
2008
+ token: Je,
2009
+ amount: e.string(),
2010
+ usd: e.string(),
2011
+ editable: e.boolean()
2012
+ }),
2013
+ e.object({
2014
+ type: e.literal("address"),
2015
+ label: e.string(),
2016
+ address: e.string(),
2017
+ addressName: e.string().optional(),
2018
+ // tbd whether it's isVerified or verified
2019
+ verified: e.boolean().optional()
2020
+ }),
2021
+ e.object({
2022
+ type: e.literal("timestamp"),
2023
+ label: e.string(),
2024
+ value: e.string()
2025
+ }),
2026
+ e.object({
2027
+ type: e.literal("token_address"),
2028
+ label: e.string(),
2029
+ token: Je
2030
+ }),
2031
+ e.object({
2032
+ type: e.literal("calldata"),
2033
+ label: e.string(),
2034
+ entrypoint: e.string(),
2035
+ calldata: e.array(e.string())
2036
+ }),
2037
+ e.object({
2038
+ type: e.literal("text"),
2039
+ label: e.string(),
2040
+ text: e.string()
2041
+ }),
2042
+ e.object({
2043
+ type: e.literal("nft"),
2044
+ label: e.string(),
2045
+ token: Je
2046
+ })
2047
+ ]), Qt = e.object({
2048
+ name: e.string(),
2049
+ properties: e.array(_t),
2050
+ defaultProperties: e.array(_t).optional()
2051
+ }), Qn = e.union([
2052
+ e.literal("verified"),
2053
+ e.literal("neutral"),
2054
+ e.literal("partial"),
2055
+ e.literal("warn")
2056
+ ]), ea = e.object({
2057
+ unknown_token: e.unknown().optional(),
2058
+ date_of_addition: e.string().optional(),
2059
+ contract_address: K.optional(),
2060
+ reason: e.string().optional(),
2061
+ value: e.string().or(e.number()).optional()
2062
+ }), er = e.object({
2063
+ reason: Zn,
2064
+ details: ea.optional(),
2065
+ severity: Yn
2066
+ }), ta = e.object({
2067
+ assessment: Qn,
2068
+ warnings: e.array(er).optional(),
2069
+ assessmentReasons: e.array(e.string()).optional(),
2070
+ assessmentDetails: e.object({
2071
+ contract_address: e.string()
2072
+ }).optional(),
2073
+ action: Qt
2074
+ }), tr = e.object({
2075
+ name: e.string(),
2076
+ description: e.string(),
2077
+ logoUrl: e.string(),
2078
+ iconUrl: e.string(),
2079
+ argentVerified: e.boolean(),
2080
+ links: e.array(Jn)
2081
+ }), rr = e.object({
2082
+ assessment: e.union([
2083
+ e.literal("verified"),
2084
+ e.literal("neutral"),
2085
+ e.literal("partial"),
2086
+ e.literal("warn")
2087
+ ]),
2088
+ warnings: e.array(er).optional(),
2089
+ assessmentDetails: e.object({
2090
+ contract_address: e.string()
2091
+ }).optional(),
2092
+ targetedDapp: tr.optional(),
2093
+ reviews: e.array(ta)
2094
+ }).optional(), nr = e.object({
2095
+ banner: e.string().nullable().optional(),
2096
+ preview: e.string().nullable().optional(),
2097
+ full: e.string().nullable().optional(),
2098
+ original: e.string().nullable().optional()
2099
+ }), ra = e.object({
2100
+ twitter: e.string().optional(),
2101
+ external: e.string().optional(),
2102
+ discord: e.string().optional()
2103
+ }), It = e.object({
2104
+ address: H,
2105
+ decimals: e.number().optional(),
2106
+ symbol: e.string().optional(),
2107
+ name: e.string(),
2108
+ description: e.string().optional(),
2109
+ type: e.string().optional(),
2110
+ usdValue: e.string().optional(),
2111
+ iconUrl: e.string().optional(),
2112
+ unknown: e.boolean().optional(),
2113
+ imageUrls: nr.optional(),
2114
+ links: ra.optional()
2115
+ }), na = e.object({
2116
+ tokenAddress: H,
2117
+ owner: H,
2118
+ spender: H,
2119
+ value: e.string().optional(),
2120
+ approvalForAll: e.boolean(),
2121
+ details: It.optional()
2122
+ }), aa = e.object({
2123
+ tokenAddress: H,
2124
+ from: H,
2125
+ to: H,
2126
+ tokenId: e.string().optional(),
2127
+ value: e.string().optional(),
2128
+ details: It.optional()
2129
+ }), ve = e.union([e.string(), e.number(), e.bigint()]).transform((t) => parseInt(t.toString(), 10)), Lt = {
2130
+ overallFee: ve,
2131
+ gasPrice: ve,
2132
+ gasUsage: ve,
2133
+ dataGasPrice: ve.optional(),
2134
+ dataGasConsumed: ve.optional()
2135
+ }, ia = e.object({
2136
+ ...Lt,
2137
+ unit: e.string().transform((t) => t.toUpperCase()).pipe(e.literal("WEI")),
2138
+ maxFee: ve
2139
+ }).or(e.object({
2140
+ ...Lt,
2141
+ unit: e.string().transform((t) => t.toUpperCase()).pipe(e.literal("FRI")),
2142
+ maxAmount: ve,
2143
+ maxPricePerUnit: ve
2144
+ })), sa = e.object({
2145
+ type: e.string(),
2146
+ label: e.string(),
2147
+ tokenId: e.string().optional(),
2148
+ value: e.string().optional(),
2149
+ usdValue: e.string().optional(),
2150
+ token: It,
2151
+ sent: e.boolean().optional(),
2152
+ tokenIdDetails: e.object({
2153
+ name: e.string().optional(),
2154
+ description: e.string().optional(),
2155
+ imageUrls: nr.optional()
2156
+ }).optional()
2157
+ }), oa = e.object({
2158
+ approvals: e.array(na).optional(),
2159
+ transfers: e.array(aa).optional(),
2160
+ calculatedNonce: e.string().optional(),
2161
+ feeEstimation: ia,
2162
+ summary: e.array(sa).optional()
2163
+ }), ca = e.object({
2164
+ label: e.string().optional(),
2165
+ code: e.number().optional(),
2166
+ message: e.string().optional(),
2167
+ error: e.string().optional()
2168
+ }), ar = e.object({
2169
+ reviewOfTransaction: rr,
2170
+ simulation: oa,
2171
+ simulationError: e.undefined()
2172
+ }), ir = e.object({
2173
+ reviewOfTransaction: rr,
2174
+ simulation: e.undefined(),
2175
+ simulationError: ca
2176
+ }), sr = ar.or(ir), Zi = e.object({
2177
+ transactions: e.array(sr)
2178
+ }), Ji = e.object({
2179
+ transactions: e.array(sr),
2180
+ enrichedFeeEstimation: Kn.optional(),
2181
+ isBackendDown: e.boolean().default(!1).optional()
2182
+ });
2183
+ function Qi(t) {
2184
+ return ar.safeParse(t).success;
2185
+ }
2186
+ function es(t) {
2187
+ return ir.safeParse(t).success;
2188
+ }
2189
+ const or = e.object({
2190
+ network: e.string(),
2191
+ hash: e.string(),
2192
+ status: e.string(),
2193
+ blockNumber: e.number().optional(),
2194
+ transactionIndex: e.number()
2195
+ }), Ce = e.object({
2196
+ type: e.enum(["token", "nft"]),
2197
+ tokenAddress: H,
2198
+ amount: e.string().optional(),
2199
+ fiatAmount: e.object({
2200
+ currency: e.string(),
2201
+ currencyAmount: e.number()
2202
+ }).optional().nullable()
2203
+ }), At = e.enum(["ethereum", "starknet", "zksync", "zksync2"]), la = e.object({
2204
+ type: e.enum(["payment", "gasFee"]),
2205
+ leg: e.enum(["credit", "debit"]),
2206
+ asset: Ce,
2207
+ counterParty: H.optional(),
2208
+ counterPartyNetwork: At.optional()
2209
+ }), ua = e.object({
2210
+ address: H,
2211
+ network: At,
2212
+ type: e.enum(["wallet", "token"])
2213
+ }), fa = e.object({
2214
+ chainId: e.enum(["TESTNET", "MAINNET", "SEPOLIA"]),
2215
+ ethereumNetwork: e.enum(["mainnet", "sepolia"])
2216
+ }), pa = e.enum([
2217
+ "approval",
2218
+ "changePubKey",
2219
+ "dappInteraction",
2220
+ "deploy",
2221
+ "gift",
2222
+ "multicall",
2223
+ "payment",
2224
+ "security",
2225
+ "trade"
2226
+ ]), cr = e.enum([
2227
+ "triggerEscapeGuardian",
2228
+ "triggerEscapeSigner",
2229
+ "escapeGuardian",
2230
+ "escapeSigner",
2231
+ "guardianChanged",
2232
+ "guardianBackupChanged",
2233
+ "signerChanged",
2234
+ "cancelEscape",
2235
+ "accountUpgraded",
2236
+ "multisigConfigurationUpdated"
2237
+ ]), ha = e.object({
2238
+ name: e.string(),
2239
+ parameters: e.array(e.unknown()).optional()
2240
+ }), ma = e.object({
2241
+ activeAt: e.string().optional(),
2242
+ newGuardian: e.string().optional(),
2243
+ newImplementation: e.string().optional(),
2244
+ newVersion: e.string().optional()
2245
+ }), Ct = e.discriminatedUnion("type", [
2246
+ e.object({
2247
+ type: e.literal("deploy"),
2248
+ deployer: H,
2249
+ contractAddress: H
2250
+ }),
2251
+ e.object({
2252
+ type: e.literal("approval"),
2253
+ spender: H,
2254
+ asset: Ce,
2255
+ approvalType: e.string()
2256
+ }),
2257
+ e.object({
2258
+ type: e.literal("payment"),
2259
+ counterparty: H,
2260
+ leg: e.string(),
2261
+ asset: Ce,
2262
+ counterpartyNetwork: At.optional()
2263
+ }),
2264
+ e.object({
2265
+ type: e.literal("trade"),
2266
+ srcAsset: Ce,
2267
+ destAsset: Ce
2268
+ }),
2269
+ e.object({
2270
+ type: e.literal("security"),
2271
+ action: cr,
2272
+ context: ma.optional()
2273
+ }),
2274
+ e.object({
2275
+ type: e.literal("dappInteraction"),
2276
+ dappAddress: H,
2277
+ function: ha.optional().nullable()
2278
+ // This object is often null. It happens when we were unable to get the ABI or failed decoding the function call
2279
+ })
2280
+ ]), da = e.union([
2281
+ Ct,
2282
+ e.object({
2283
+ type: e.literal("multicall"),
2284
+ calls: e.array(e.object({
2285
+ details: Ct
2286
+ }))
2287
+ })
2288
+ ]), ga = e.object({
2289
+ dappId: e.string(),
2290
+ name: e.string().optional().nullable()
2291
+ }), lr = e.object({
2292
+ sent: e.boolean(),
2293
+ asset: e.discriminatedUnion("type", [
2294
+ e.object({
2295
+ type: e.literal("nft"),
2296
+ tokenAddress: H,
2297
+ tokenId: e.coerce.number().optional(),
2298
+ amount: e.string().optional(),
2299
+ collectionName: e.string().optional(),
2300
+ collectionPreviewImage: e.string().optional().nullable(),
2301
+ nftName: e.string().optional().nullable(),
2302
+ nftPreviewImage: e.string().optional().nullable()
2303
+ }),
2304
+ e.object({
2305
+ type: e.literal("token"),
2306
+ tokenAddress: H,
2307
+ amount: e.string().optional(),
2308
+ fiatAmount: e.object({
2309
+ currency: e.string(),
2310
+ currencyAmount: e.coerce.string()
2311
+ }).optional().nullable()
2312
+ })
2313
+ ])
2314
+ }), Ea = e.object({
2315
+ type: e.string(),
2316
+ // "gas" for example
2317
+ to: H,
2318
+ actualFee: e.object({
2319
+ type: e.string(),
2320
+ tokenAddress: H,
2321
+ amount: e.string().optional(),
2322
+ fiatAmount: e.object({
2323
+ currency: e.string(),
2324
+ currencyAmount: e.number()
2325
+ }).optional().nullable()
2326
+ })
2327
+ }), ur = e.enum(["pending", "success", "failure"]), fr = e.object({
2328
+ compositeId: e.string(),
2329
+ id: e.string().uuid(),
2330
+ status: ur,
2331
+ wallet: H,
2332
+ txSender: H,
2333
+ source: e.string(),
2334
+ type: pa,
2335
+ group: e.enum(["finance", "security"]),
2336
+ submitted: e.number(),
2337
+ lastModified: e.number(),
2338
+ transaction: or,
2339
+ transfers: e.array(la),
2340
+ // to be clarified
2341
+ fees: e.array(Ea).optional(),
2342
+ relatedAddresses: e.array(ua).nullable(),
2343
+ network: e.string(),
2344
+ networkDetails: fa.optional(),
2345
+ details: da,
2346
+ transferSummary: e.array(lr).optional(),
2347
+ dapp: ga.optional(),
2348
+ actions: e.array(Qt).optional(),
2349
+ title: e.string().optional()
2350
+ }), Ia = e.object({
2351
+ title: e.string().optional(),
2352
+ shortTitle: e.string().optional(),
2353
+ subtitle: e.string().optional(),
2354
+ /** let's not import the keys from x-ui here */
2355
+ icon: e.string().optional()
2356
+ }), Aa = "native", Na = "rejected", Sa = "cancelled", ba = "queued", ts = fr.pick({
2357
+ status: !0,
2358
+ actions: !0,
2359
+ submitted: !0,
2360
+ lastModified: !0,
2361
+ transferSummary: !0,
2362
+ fees: !0
2363
+ }).extend({
2364
+ status: e.union([
2365
+ ur,
2366
+ e.enum([
2367
+ Na,
2368
+ Sa,
2369
+ ba
2370
+ ])
2371
+ ]),
2372
+ type: e.literal(Aa),
2373
+ transaction: or.pick({
2374
+ hash: !0
2375
+ }),
2376
+ dapp: tr.optional(),
2377
+ meta: Ia.optional()
2378
+ }), Ta = e.array(fr), rs = e.object({
2379
+ activities: Ta,
2380
+ page: e.number(),
2381
+ pageSize: e.number(),
2382
+ totalElements: e.number(),
2383
+ totalPages: e.number()
2384
+ });
2385
+ function ns(t) {
2386
+ return cr.safeParse(t).success;
2387
+ }
2388
+ const pr = (t) => lr.safeParse(t).success, as = (t) => pr(t) && t.asset.type === "token", is = (t) => pr(t) && t.asset.type === "nft", Dt = {
2389
+ Transfer: Nt.getSelectorFromName("Transfer"),
2390
+ // 0x99cd8bde557814842a3121e8ddfd433a539b8c9f14bf31ebf108d12e6196e9
2391
+ Approval: Nt.getSelectorFromName("Approval")
2392
+ // 0x134692b230b9e1ffa39098904722134159652b09c5bc41d88d6698779d228ff
2393
+ }, ya = (t, o, E) => {
2394
+ for (const T of t) {
2395
+ const { events: N, internal_calls: D } = T;
2396
+ for (const w of N)
2397
+ for (const k of w.keys)
2398
+ k === Dt.Approval && o.push({
2399
+ tokenAddress: K.parse(T.contract_address),
2400
+ owner: w.data[0],
2401
+ spender: w.data[1],
2402
+ value: Qe.uint256ToBN({ low: w.data[2], high: w.data[3] }).toString()
2403
+ }), k === Dt.Transfer && E.push({
2404
+ tokenAddress: K.parse(T.contract_address),
2405
+ from: w.data[0],
2406
+ to: w.data[1],
2407
+ value: Qe.uint256ToBN({ low: w.data[2], high: w.data[3] }).toString()
2408
+ });
2409
+ D && ya(D, o, E);
2410
+ }
2411
+ return { approvals: o, transfers: E };
2412
+ }, Ra = /(0x[a-fA-F0-9]+)\s*\('(.*?)'\)/, ss = (t) => {
2413
+ if (!Ur(t))
2414
+ return;
2415
+ const o = t.match(Ra);
2416
+ if (o && !Fr(o[2]))
2417
+ return o[2];
2418
+ };
2419
+ var pt;
2420
+ (function(t) {
2421
+ t.SIMULATE_AND_REVIEW_FAILED = "Something went wrong fetching review", t.NO_CALLS_FOUND = "No calls found", t.ONCHAIN_FEE_ESTIMATION_FAILED = "Failed to estimate fees onchain";
2422
+ })(pt || (pt = {}));
2423
+ class os extends we {
2424
+ constructor(o) {
2425
+ super(o, pt), this.name = "ReviewError";
2426
+ }
2427
+ }
2428
+ const cs = e.object({
2429
+ reason: e.string(),
2430
+ severity: e.string().optional(),
2431
+ title: e.string(),
2432
+ description: e.string().optional()
2433
+ }), va = Object.values(xe.TRANSACTION_VERSION), ls = e.string().default("0x3").refine((t) => {
2434
+ const o = be.toBigInt(t);
2435
+ return va.map((E) => be.toBigInt(E)).includes(o);
2436
+ }).transform((t) => be.toHex(t));
2437
+ function us(t) {
2438
+ if (t === xe.TRANSACTION_VERSION.V3 || t === xe.TRANSACTION_VERSION.F3)
2439
+ throw Error("Only txv1 is supported");
2440
+ }
2441
+ export {
2442
+ Fa as $,
2443
+ ke as A,
2444
+ bi as B,
2445
+ ri as C,
2446
+ ki as D,
2447
+ Pi as E,
2448
+ Bi as F,
2449
+ Wa as G,
2450
+ dt as H,
2451
+ qa as I,
2452
+ hi as J,
2453
+ ia as K,
2454
+ Ki as L,
2455
+ Tt as M,
2456
+ ni as N,
2457
+ qn as O,
2458
+ Zi as P,
2459
+ es as Q,
2460
+ os as R,
2461
+ Qa as S,
2462
+ Di as T,
2463
+ jt as U,
2464
+ $r as V,
2465
+ Ve as W,
2466
+ Xr as X,
2467
+ Hr as Y,
2468
+ ka as Z,
2469
+ Ua as _,
2470
+ St as a,
2471
+ ls as a$,
2472
+ xa as a0,
2473
+ Ba as a1,
2474
+ Ma as a2,
2475
+ mt as a3,
2476
+ Va as a4,
2477
+ $a as a5,
2478
+ Xa as a6,
2479
+ Ha as a7,
2480
+ za as a8,
2481
+ Ga as a9,
2482
+ Mi as aA,
2483
+ Yt as aB,
2484
+ Gi as aC,
2485
+ Vi as aD,
2486
+ Zt as aE,
2487
+ $i as aF,
2488
+ Fn as aG,
2489
+ xn as aH,
2490
+ Bn as aI,
2491
+ Mn as aJ,
2492
+ Xi as aK,
2493
+ $t as aL,
2494
+ Gn as aM,
2495
+ Hi as aN,
2496
+ Vn as aO,
2497
+ $n as aP,
2498
+ zi as aQ,
2499
+ Xn as aR,
2500
+ qi as aS,
2501
+ Jt as aT,
2502
+ Wi as aU,
2503
+ ft as aV,
2504
+ Yi as aW,
2505
+ Dt as aX,
2506
+ ya as aY,
2507
+ ss as aZ,
2508
+ cs as a_,
2509
+ Zr as aa,
2510
+ Xe as ab,
2511
+ Qr as ac,
2512
+ et as ad,
2513
+ rn as ae,
2514
+ Ka as af,
2515
+ Ya as ag,
2516
+ Za as ah,
2517
+ Ja as ai,
2518
+ ei as aj,
2519
+ tn as ak,
2520
+ tt as al,
2521
+ we as am,
2522
+ ut as an,
2523
+ Pe as ao,
2524
+ Xt as ap,
2525
+ Ui as aq,
2526
+ vt as ar,
2527
+ zt as as,
2528
+ Fi as at,
2529
+ qt as au,
2530
+ xi as av,
2531
+ Cn as aw,
2532
+ Dn as ax,
2533
+ Pn as ay,
2534
+ jn as az,
2535
+ qr as b,
2536
+ Na as b$,
2537
+ us as b0,
2538
+ Si as b1,
2539
+ fn as b2,
2540
+ Ti as b3,
2541
+ yi as b4,
2542
+ De as b5,
2543
+ sn as b6,
2544
+ on as b7,
2545
+ cn as b8,
2546
+ Be as b9,
2547
+ xt as bA,
2548
+ Tn as bB,
2549
+ Bt as bC,
2550
+ yn as bD,
2551
+ Ze as bE,
2552
+ Rn as bF,
2553
+ vn as bG,
2554
+ On as bH,
2555
+ wn as bI,
2556
+ vi as bJ,
2557
+ Oi as bK,
2558
+ Gt as bL,
2559
+ wi as bM,
2560
+ _i as bN,
2561
+ Vt as bO,
2562
+ Li as bP,
2563
+ Ci as bQ,
2564
+ pr as bR,
2565
+ lr as bS,
2566
+ Aa as bT,
2567
+ ts as bU,
2568
+ la as bV,
2569
+ da as bW,
2570
+ ga as bX,
2571
+ Ea as bY,
2572
+ fr as bZ,
2573
+ Ia as b_,
2574
+ ln as ba,
2575
+ gt as bb,
2576
+ un as bc,
2577
+ he as bd,
2578
+ ai as be,
2579
+ ii as bf,
2580
+ si as bg,
2581
+ oi as bh,
2582
+ ci as bi,
2583
+ li as bj,
2584
+ ui as bk,
2585
+ fi as bl,
2586
+ pi as bm,
2587
+ Ut as bn,
2588
+ Ye as bo,
2589
+ Ft as bp,
2590
+ Ri as bq,
2591
+ gn as br,
2592
+ ct as bs,
2593
+ En as bt,
2594
+ In as bu,
2595
+ lt as bv,
2596
+ An as bw,
2597
+ Nn as bx,
2598
+ Sn as by,
2599
+ bn as bz,
2600
+ bt as c,
2601
+ Sa as c0,
2602
+ ba as c1,
2603
+ Ta as c2,
2604
+ rs as c3,
2605
+ ns as c4,
2606
+ as as c5,
2607
+ is as c6,
2608
+ wt as c7,
2609
+ Kn as c8,
2610
+ _t as c9,
2611
+ Qt as ca,
2612
+ Qn as cb,
2613
+ ea as cc,
2614
+ er as cd,
2615
+ ta as ce,
2616
+ tr as cf,
2617
+ Ji as cg,
2618
+ Qi as ch,
2619
+ Yn as ci,
2620
+ Zn as cj,
2621
+ zr as d,
2622
+ en as e,
2623
+ Jr as f,
2624
+ ti as g,
2625
+ Kr as h,
2626
+ Yr as i,
2627
+ mi as j,
2628
+ Ii as k,
2629
+ Ei as l,
2630
+ di as m,
2631
+ $e as n,
2632
+ gi as o,
2633
+ Vr as p,
2634
+ H as q,
2635
+ ht as r,
2636
+ Ai as s,
2637
+ K as t,
2638
+ an as u,
2639
+ Ni as v,
2640
+ Me as w,
2641
+ _n as x,
2642
+ hn as y,
2643
+ ji as z
2644
+ };