@solarpunkltd/swarm-chat-js 6.2.3 → 6.2.4
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.
- package/dist/index.esm.js +760 -759
- package/dist/index.js +9 -9
- package/dist/interfaces/chat.d.ts +6 -0
- package/dist/interfaces/chat.d.ts.map +1 -1
- package/dist/lib/core.d.ts.map +1 -1
- package/dist/lib/utils.d.ts +0 -2
- package/dist/lib/utils.d.ts.map +1 -1
- package/dist/swarm-chat-umd.js +7 -7
- package/package.json +1 -1
package/dist/index.esm.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { FeedIndex as
|
|
1
|
+
import { FeedIndex as ci, Identifier as Lt, Span as Be, Bytes as Ue, PrivateKey as ke, Reference as ui, BeeArgumentError as Pl, Signature as Zl, Topic as ut, Stamper as xn, Bee as Bl, EthAddress as Ll } from "@ethersphere/bee-js";
|
|
2
2
|
const P = [];
|
|
3
3
|
for (let a = 0; a < 256; ++a)
|
|
4
4
|
P.push((a + 256).toString(16).slice(1));
|
|
@@ -15,10 +15,10 @@ function Fl() {
|
|
|
15
15
|
}
|
|
16
16
|
return kn(Vl);
|
|
17
17
|
}
|
|
18
|
-
const Wl = typeof crypto < "u" && crypto.randomUUID && crypto.randomUUID.bind(crypto),
|
|
18
|
+
const Wl = typeof crypto < "u" && crypto.randomUUID && crypto.randomUUID.bind(crypto), ti = { randomUUID: Wl };
|
|
19
19
|
function Hl(a, r, i) {
|
|
20
|
-
if (
|
|
21
|
-
return
|
|
20
|
+
if (ti.randomUUID && !r && !a)
|
|
21
|
+
return ti.randomUUID();
|
|
22
22
|
a = a || {};
|
|
23
23
|
const c = a.random || (a.rng || Fl)();
|
|
24
24
|
return c[6] = c[6] & 15 | 64, c[8] = c[8] & 63 | 128, zl(c);
|
|
@@ -97,7 +97,7 @@ class ql {
|
|
|
97
97
|
function Gl(a) {
|
|
98
98
|
return a && a.__esModule && Object.prototype.hasOwnProperty.call(a, "default") ? a.default : a;
|
|
99
99
|
}
|
|
100
|
-
var
|
|
100
|
+
var li = {};
|
|
101
101
|
(function(a) {
|
|
102
102
|
var r;
|
|
103
103
|
Object.defineProperty(a, "__esModule", { value: !0 }), a.Vector = a.Cache = a.Assertions = a.Strings = a.Types = a.Objects = a.Dates = a.Promises = a.Numbers = a.System = a.Arrays = a.Random = a.Elliptic = a.Binary = a.AsyncQueue = a.PubSubChannel = a.FixedPointNumber = a.MerkleTree = a.Chunk = a.Uint8ArrayWriter = a.Uint8ArrayReader = a.AsyncLazy = a.Lazy = a.Optional = void 0;
|
|
@@ -108,8 +108,8 @@ var di = {};
|
|
|
108
108
|
return i(Promise.all(e.map(i)));
|
|
109
109
|
}
|
|
110
110
|
async function u(e, t = 1) {
|
|
111
|
-
const n =
|
|
112
|
-
for (const
|
|
111
|
+
const n = Ts(e, t), s = [], o = n.map(async (d) => {
|
|
112
|
+
for (const p of d) s.push(await p());
|
|
113
113
|
});
|
|
114
114
|
return await Promise.all(o), s;
|
|
115
115
|
}
|
|
@@ -127,7 +127,7 @@ var di = {};
|
|
|
127
127
|
}
|
|
128
128
|
return e;
|
|
129
129
|
}
|
|
130
|
-
function
|
|
130
|
+
function h(e) {
|
|
131
131
|
if (e.length === 1) return e[0];
|
|
132
132
|
throw Error(`Expected exactly one element, actual: ${e.length}`);
|
|
133
133
|
}
|
|
@@ -137,7 +137,7 @@ var di = {};
|
|
|
137
137
|
function y(e) {
|
|
138
138
|
return e.length > 0 ? e[0] : null;
|
|
139
139
|
}
|
|
140
|
-
function
|
|
140
|
+
function x(e) {
|
|
141
141
|
if (!e.length) throw Error("Received empty array");
|
|
142
142
|
return e[0];
|
|
143
143
|
}
|
|
@@ -162,16 +162,16 @@ var di = {};
|
|
|
162
162
|
}
|
|
163
163
|
return s;
|
|
164
164
|
}
|
|
165
|
-
function
|
|
165
|
+
function Fe(e, t, n, s) {
|
|
166
166
|
if (n < 0 || s < 0 || s + t[0].length > e[0].length || n + t.length > e.length) return !1;
|
|
167
167
|
for (let o = 0; o < t.length; o++)
|
|
168
168
|
for (let d = 0; d < t[o].length; d++) if (t[o][d] !== void 0 && e[n + o][s + d] !== t[o][d]) return !1;
|
|
169
169
|
return !0;
|
|
170
170
|
}
|
|
171
171
|
function Oe(e, t, n = Math.random) {
|
|
172
|
-
return f(
|
|
172
|
+
return f(Gn(0, e.length - 1), n).slice(0, t);
|
|
173
173
|
}
|
|
174
|
-
function
|
|
174
|
+
function We(e, t) {
|
|
175
175
|
return e.map((n) => n[t]);
|
|
176
176
|
}
|
|
177
177
|
function Kt(e) {
|
|
@@ -183,7 +183,7 @@ var di = {};
|
|
|
183
183
|
function He(e, t, n = Math.random) {
|
|
184
184
|
return Math.floor(n() * (t - e + 1)) + e;
|
|
185
185
|
}
|
|
186
|
-
function
|
|
186
|
+
function Cn(e, t, n = Math.random) {
|
|
187
187
|
return n() * (t - e) + e;
|
|
188
188
|
}
|
|
189
189
|
function Ti() {
|
|
@@ -201,9 +201,9 @@ var di = {};
|
|
|
201
201
|
}
|
|
202
202
|
function Ii(e, t = Math.random) {
|
|
203
203
|
const n = Math.floor(e), s = e - n;
|
|
204
|
-
return
|
|
204
|
+
return Nn(s, t) ? n + 1 : n;
|
|
205
205
|
}
|
|
206
|
-
function
|
|
206
|
+
function Nn(e, t = Math.random) {
|
|
207
207
|
return t() < e;
|
|
208
208
|
}
|
|
209
209
|
function Yt(e, t = Math.random) {
|
|
@@ -218,15 +218,15 @@ var di = {};
|
|
|
218
218
|
const o = [];
|
|
219
219
|
for (; o.length < t; ) {
|
|
220
220
|
const d = Yt(e, s);
|
|
221
|
-
o.some((
|
|
221
|
+
o.some((p) => n(p, d)) || o.push(d);
|
|
222
222
|
}
|
|
223
223
|
return o;
|
|
224
224
|
}
|
|
225
225
|
function Ri(e, t, n, s, o, d = Math.random) {
|
|
226
|
-
const
|
|
227
|
-
for (t !== null && v.push(t);
|
|
228
|
-
const m = a.Random.intBetween(0,
|
|
229
|
-
o(
|
|
226
|
+
const p = e.filter((m) => m !== t && m !== n), v = [];
|
|
227
|
+
for (t !== null && v.push(t); p.length && v.length < s; ) {
|
|
228
|
+
const m = a.Random.intBetween(0, p.length - 1, d);
|
|
229
|
+
o(p[m], v) && v.push(p[m]), p.splice(m, 1);
|
|
230
230
|
}
|
|
231
231
|
return f(v, d), { values: v, indexOfGuaranteed: t !== null ? v.indexOf(t) : -1 };
|
|
232
232
|
}
|
|
@@ -234,15 +234,15 @@ var di = {};
|
|
|
234
234
|
if (!e.length) throw Error("Received empty array");
|
|
235
235
|
return e[e.length - 1];
|
|
236
236
|
}
|
|
237
|
-
function
|
|
237
|
+
function jn(e, t, n) {
|
|
238
238
|
return n(t.reduce((s, o) => o(s), e));
|
|
239
239
|
}
|
|
240
240
|
function Ci(e, t) {
|
|
241
|
-
return (n) =>
|
|
241
|
+
return (n) => jn(n, e, t);
|
|
242
242
|
}
|
|
243
243
|
function Ni(e, t, n) {
|
|
244
244
|
if (n === void 0 && (n = Math.random()), e.length !== t.length) throw new Error("Array length mismatch");
|
|
245
|
-
let s = t.reduce((d,
|
|
245
|
+
let s = t.reduce((d, p) => d + p, 0);
|
|
246
246
|
const o = n * s;
|
|
247
247
|
for (let d = 0; d < e.length - 1; d++) if (s -= t[d], o >= s) return e[d];
|
|
248
248
|
return qe(e);
|
|
@@ -250,7 +250,7 @@ var di = {};
|
|
|
250
250
|
function ji(e, t, n = Math.random) {
|
|
251
251
|
const s = t.map((d) => n() * d), o = [];
|
|
252
252
|
for (let d = 0; d < e.length; d++) o.push([e[d], s[d]]);
|
|
253
|
-
return o.sort((d,
|
|
253
|
+
return o.sort((d, p) => p[1] - d[1]).map((d) => d[0]);
|
|
254
254
|
}
|
|
255
255
|
function ye(e, t) {
|
|
256
256
|
if (e == null) return null;
|
|
@@ -266,7 +266,7 @@ var di = {};
|
|
|
266
266
|
const s = t.split(/\.|\[/);
|
|
267
267
|
let o = e;
|
|
268
268
|
for (let d = 0; d < s.length; d++) {
|
|
269
|
-
const
|
|
269
|
+
const p = s[d], v = d < s.length - 1 && s[d + 1].includes("]"), m = p.includes("]") ? p.replace(/\[|\]/g, "") : p;
|
|
270
270
|
if (d === s.length - 1) return o[m] = n, n;
|
|
271
271
|
ce(o[m]) || (v ? o[m] = [] : o[m] = {}), o = o[m];
|
|
272
272
|
}
|
|
@@ -280,7 +280,7 @@ var di = {};
|
|
|
280
280
|
return ye(e, t) || ve(e, t, n);
|
|
281
281
|
}
|
|
282
282
|
function Pi(e, t) {
|
|
283
|
-
const n = ar(t, "."), s =
|
|
283
|
+
const n = ar(t, "."), s = Kn(t, ".");
|
|
284
284
|
if (!n || !s) return;
|
|
285
285
|
const o = ye(e, n);
|
|
286
286
|
delete o[s];
|
|
@@ -333,14 +333,14 @@ var di = {};
|
|
|
333
333
|
return "#" + e.map((t) => t.toString(16).padStart(2, "0")).join("");
|
|
334
334
|
}
|
|
335
335
|
function qi(e, t, n, s) {
|
|
336
|
-
const o = e * Math.PI / 180, d = n * Math.PI / 180,
|
|
336
|
+
const o = e * Math.PI / 180, d = n * Math.PI / 180, p = (n - e) * Math.PI / 180, v = (s - t) * Math.PI / 180, m = Math.sin(p / 2) * Math.sin(p / 2) + Math.cos(o) * Math.cos(d) * Math.sin(v / 2) * Math.sin(v / 2);
|
|
337
337
|
return 6371e3 * (2 * Math.atan2(Math.sqrt(m), Math.sqrt(1 - m)));
|
|
338
338
|
}
|
|
339
|
-
function
|
|
339
|
+
function Tt(e, t) {
|
|
340
340
|
return Math.round(e / t) * t;
|
|
341
341
|
}
|
|
342
342
|
function Gi(e) {
|
|
343
|
-
return e > 1e3 ? (e / 1e3).toFixed(0) + " km" : e >= 500 ?
|
|
343
|
+
return e > 1e3 ? (e / 1e3).toFixed(0) + " km" : e >= 500 ? Tt(e, 100) + " m" : e >= 100 ? Tt(e, 50) + " m" : Tt(e, 10) + " m";
|
|
344
344
|
}
|
|
345
345
|
function Ji(e) {
|
|
346
346
|
return e * (e + 1) / 2;
|
|
@@ -356,7 +356,7 @@ var di = {};
|
|
|
356
356
|
function Ie(e) {
|
|
357
357
|
return ce(e) && !Array.isArray(e);
|
|
358
358
|
}
|
|
359
|
-
function
|
|
359
|
+
function Dn(e) {
|
|
360
360
|
return Array.isArray(e) && e.length === 0;
|
|
361
361
|
}
|
|
362
362
|
function Yi(e) {
|
|
@@ -374,25 +374,25 @@ var di = {};
|
|
|
374
374
|
function ue(e) {
|
|
375
375
|
return typeof e == "number" && isFinite(e);
|
|
376
376
|
}
|
|
377
|
-
function
|
|
377
|
+
function Un(e) {
|
|
378
378
|
return e === !0 || e === !1;
|
|
379
379
|
}
|
|
380
380
|
function Me(e) {
|
|
381
381
|
return Object.prototype.toString.call(e) === "[object Date]";
|
|
382
382
|
}
|
|
383
|
-
function
|
|
383
|
+
function At(e) {
|
|
384
384
|
return !F(e) || e.trim().length === 0;
|
|
385
385
|
}
|
|
386
386
|
function er(e) {
|
|
387
387
|
return ue(e) && Number.isInteger(e) && e >= 1;
|
|
388
388
|
}
|
|
389
|
-
function
|
|
389
|
+
function Pn(e) {
|
|
390
390
|
return F(e) && e.match(/^-?\d+$/) !== null;
|
|
391
391
|
}
|
|
392
|
-
function
|
|
392
|
+
function Zn(e) {
|
|
393
393
|
return F(e) && e.match(/^(0x)?[0-9a-f]+$/i) !== null;
|
|
394
394
|
}
|
|
395
|
-
const Qi = "!@#$%^&*()_+-=[]{}|;:<>?,./", Xi = "!@#$%^&*()_+-=[]{}|;:<>?,./".split(""), tr = "abcdefghijklmnopqrstuvwxyz", ea = "ABCDEFGHIJKLMNOPQRSTUVWXYZ", ta = "1234567890", rr = tr + ea + ta,
|
|
395
|
+
const Qi = "!@#$%^&*()_+-=[]{}|;:<>?,./", Xi = "!@#$%^&*()_+-=[]{}|;:<>?,./".split(""), tr = "abcdefghijklmnopqrstuvwxyz", ea = "ABCDEFGHIJKLMNOPQRSTUVWXYZ", ta = "1234567890", rr = tr + ea + ta, Bn = rr + Qi, Ln = [
|
|
396
396
|
"—",
|
|
397
397
|
"\\",
|
|
398
398
|
"東",
|
|
@@ -409,7 +409,7 @@ var di = {};
|
|
|
409
409
|
"ᛇ",
|
|
410
410
|
"ᚻ",
|
|
411
411
|
"ᛦ"
|
|
412
|
-
],
|
|
412
|
+
], zn = "0123456789abcdef";
|
|
413
413
|
function ra(e, t = Math.random) {
|
|
414
414
|
let n = "";
|
|
415
415
|
for (let s = 0; s < e; s++) n += tr[Math.floor(t() * tr.length)];
|
|
@@ -422,12 +422,12 @@ var di = {};
|
|
|
422
422
|
}
|
|
423
423
|
function sa(e, t = Math.random) {
|
|
424
424
|
let n = "";
|
|
425
|
-
for (let s = 0; s < e; s++) n +=
|
|
425
|
+
for (let s = 0; s < e; s++) n += Bn[Math.floor(t() * Bn.length)];
|
|
426
426
|
return n;
|
|
427
427
|
}
|
|
428
428
|
function ia(e, t = Math.random) {
|
|
429
429
|
let n = "";
|
|
430
|
-
for (let s = 0; s < e; s++) n +=
|
|
430
|
+
for (let s = 0; s < e; s++) n += Ln[Math.floor(t() * Ln.length)];
|
|
431
431
|
return n;
|
|
432
432
|
}
|
|
433
433
|
function aa(e, t) {
|
|
@@ -435,17 +435,17 @@ var di = {};
|
|
|
435
435
|
return s ? s[0] : null;
|
|
436
436
|
}
|
|
437
437
|
function oa(e, t, n = Xi) {
|
|
438
|
-
const s =
|
|
438
|
+
const s = Yn(e, n);
|
|
439
439
|
for (const o of s) if (t(o)) return o;
|
|
440
440
|
return null;
|
|
441
441
|
}
|
|
442
442
|
function ca(e, t = Math.random) {
|
|
443
443
|
let n = "";
|
|
444
|
-
for (let s = 0; s < e; s++) n +=
|
|
444
|
+
for (let s = 0; s < e; s++) n += zn[Math.floor(t() * zn.length)];
|
|
445
445
|
return n;
|
|
446
446
|
}
|
|
447
447
|
function ua(e, t) {
|
|
448
|
-
if (!
|
|
448
|
+
if (!Pn(e)) throw new TypeError(`Expected integer string${t != null && t.name ? ` for ${t.name}` : ""}, got: ` + e);
|
|
449
449
|
const n = BigInt(e);
|
|
450
450
|
if (t && (t.min && n < t.min || t.max && n > t.max))
|
|
451
451
|
throw RangeError(
|
|
@@ -453,8 +453,8 @@ var di = {};
|
|
|
453
453
|
);
|
|
454
454
|
return e;
|
|
455
455
|
}
|
|
456
|
-
function
|
|
457
|
-
if (
|
|
456
|
+
function Vn(e, t) {
|
|
457
|
+
if (At(e)) throw new TypeError(`Expected string${t != null && t.name ? ` for ${t.name}` : ""}, got: ` + e);
|
|
458
458
|
if (t && (t.min !== void 0 && e.length < t.min || t.max !== void 0 && e.length > t.max))
|
|
459
459
|
throw RangeError(
|
|
460
460
|
`Expected string${t != null && t.name ? ` for ${t.name}` : ""} length in range: ${t.min ?? "-inf"}..${t.max ?? "inf"}; got: ${e.length}`
|
|
@@ -462,7 +462,7 @@ var di = {};
|
|
|
462
462
|
return e;
|
|
463
463
|
}
|
|
464
464
|
function la(e, t) {
|
|
465
|
-
if (!
|
|
465
|
+
if (!Zn(e)) throw new TypeError(`Expected hex string${t != null && t.name ? ` for ${t.name}` : ""}, got: ` + e);
|
|
466
466
|
const n = e.replace(/^0x/, "");
|
|
467
467
|
if (t && t.byteLength && n.length !== t.byteLength * 2)
|
|
468
468
|
throw RangeError(
|
|
@@ -471,11 +471,11 @@ var di = {};
|
|
|
471
471
|
return n;
|
|
472
472
|
}
|
|
473
473
|
function da(e, t) {
|
|
474
|
-
if (!
|
|
474
|
+
if (!Vn(e, t).split("").every((n) => n === "_" || Ke(n)))
|
|
475
475
|
throw new TypeError(`Expected safe string${t != null && t.name ? ` for ${t.name}` : ""}, got: ` + e);
|
|
476
476
|
return e;
|
|
477
477
|
}
|
|
478
|
-
function
|
|
478
|
+
function Fn(e, t) {
|
|
479
479
|
if (t.min !== void 0 && e < t.min || t.max !== void 0 && e > t.max)
|
|
480
480
|
throw RangeError(
|
|
481
481
|
`Expected value${t != null && t.name ? ` for ${t.name}` : ""} in range: ${t.min ?? "-inf"}..${t.max ?? "inf"}; got: ${e}`
|
|
@@ -485,20 +485,20 @@ var di = {};
|
|
|
485
485
|
if (!Xt(e)) throw new TypeError(`Expected function${t != null && t.name ? ` for ${t.name}` : ""}, got: ` + e);
|
|
486
486
|
return e;
|
|
487
487
|
}
|
|
488
|
-
function
|
|
489
|
-
if (ue(e)) return t &&
|
|
488
|
+
function Ot(e, t) {
|
|
489
|
+
if (ue(e)) return t && Fn(e, t), e;
|
|
490
490
|
if (!F(e) || !e.match(/^-?\d+(\.\d+)?$/))
|
|
491
491
|
throw new TypeError(`Expected number${t != null && t.name ? ` for ${t.name}` : ""}, got: ` + e);
|
|
492
492
|
const n = parseFloat(e);
|
|
493
|
-
return t &&
|
|
493
|
+
return t && Fn(n, t), n;
|
|
494
494
|
}
|
|
495
495
|
function nr(e, t) {
|
|
496
|
-
return
|
|
496
|
+
return Ot(e, t) | 0;
|
|
497
497
|
}
|
|
498
498
|
function ha(e, t) {
|
|
499
499
|
if (e === "true") return !0;
|
|
500
500
|
if (e === "false") return !1;
|
|
501
|
-
if (!
|
|
501
|
+
if (!Un(e)) throw new TypeError(`Expected boolean${t != null && t.name ? ` for ${t.name}` : ""}, got: ` + e);
|
|
502
502
|
return e;
|
|
503
503
|
}
|
|
504
504
|
function pa(e, t) {
|
|
@@ -506,7 +506,7 @@ var di = {};
|
|
|
506
506
|
return e;
|
|
507
507
|
}
|
|
508
508
|
function ma(e) {
|
|
509
|
-
return
|
|
509
|
+
return At(e) ? null : e;
|
|
510
510
|
}
|
|
511
511
|
function ga(e, t) {
|
|
512
512
|
if (!F(e)) throw new TypeError(`Expected string${t != null && t.name ? ` for ${t.name}` : ""}, got: ` + e);
|
|
@@ -531,30 +531,30 @@ var di = {};
|
|
|
531
531
|
if (!Array.isArray(e)) throw new TypeError(`Expected array${t != null && t.name ? ` for ${t.name}` : ""}, got: ` + e);
|
|
532
532
|
return e;
|
|
533
533
|
}
|
|
534
|
-
function
|
|
534
|
+
function It(e, t) {
|
|
535
535
|
if (!Ie(e)) throw new TypeError(`Expected object${t != null && t.name ? ` for ${t.name}` : ""}, got: ` + e);
|
|
536
536
|
return e;
|
|
537
537
|
}
|
|
538
538
|
function ba(e, t) {
|
|
539
|
-
return e === null ? null :
|
|
539
|
+
return e === null ? null : It(e, t);
|
|
540
540
|
}
|
|
541
541
|
function _a(e, t) {
|
|
542
|
-
const n =
|
|
542
|
+
const n = It(e, t);
|
|
543
543
|
for (const s of Object.keys(n))
|
|
544
544
|
if (!F(n[s])) throw new TypeError(`Expected string map${t != null && t.name ? ` for ${t.name}` : ""}, got: ` + e);
|
|
545
545
|
return n;
|
|
546
546
|
}
|
|
547
547
|
function xa(e, t) {
|
|
548
|
-
const n =
|
|
548
|
+
const n = It(e), s = Object.keys(n), o = Object.values(n);
|
|
549
549
|
if (!s.every(F) || !o.every(ue))
|
|
550
550
|
throw new TypeError(`Expected numeric dictionary${t != null && t.name ? ` for ${t.name}` : ""}, got: ` + e);
|
|
551
551
|
return n;
|
|
552
552
|
}
|
|
553
|
-
function
|
|
553
|
+
function Wn(e) {
|
|
554
554
|
return F(e) && e.match(/^https?:\/\/.+/) !== null;
|
|
555
555
|
}
|
|
556
556
|
function ka(e, t) {
|
|
557
|
-
if (!
|
|
557
|
+
if (!Wn(e)) throw new TypeError(`Expected url${t != null && t.name ? ` for ${t.name}` : ""}, got: ` + e);
|
|
558
558
|
return e;
|
|
559
559
|
}
|
|
560
560
|
function Ea(e, t) {
|
|
@@ -566,13 +566,13 @@ var di = {};
|
|
|
566
566
|
function Ta(e, t) {
|
|
567
567
|
return t == null ? void 0 : e(t);
|
|
568
568
|
}
|
|
569
|
-
function
|
|
569
|
+
function Hn(e, t) {
|
|
570
570
|
for (const [n, s] of Object.entries(t)) if (!s(e[n])) throw TypeError(`${n} in value does not exist or match shape`);
|
|
571
571
|
for (const n of Object.keys(e)) if (!t[n]) throw TypeError(`${n} exists in value but not in shape`);
|
|
572
572
|
return !0;
|
|
573
573
|
}
|
|
574
574
|
function Aa(e, t) {
|
|
575
|
-
return e.every((n) =>
|
|
575
|
+
return e.every((n) => Hn(n, t));
|
|
576
576
|
}
|
|
577
577
|
function Ge(e, t = "json", n = 0) {
|
|
578
578
|
if (ce(e, !1)) {
|
|
@@ -615,13 +615,13 @@ var di = {};
|
|
|
615
615
|
const s = {};
|
|
616
616
|
return we(s, e), we(s, t), we(s, n), s;
|
|
617
617
|
}
|
|
618
|
-
function
|
|
618
|
+
function qn(e, t) {
|
|
619
619
|
const n = {};
|
|
620
620
|
for (const s of e) for (const o of Object.keys(s)) n[o] ? n[o] = t(n[o], s[o]) : n[o] = s[o];
|
|
621
621
|
return n;
|
|
622
622
|
}
|
|
623
623
|
function $a(e) {
|
|
624
|
-
return
|
|
624
|
+
return qn(e, (t, n) => t + n);
|
|
625
625
|
}
|
|
626
626
|
function Ra(e, t, n) {
|
|
627
627
|
e[t] || (e[t] = []), e[t].push(n);
|
|
@@ -633,7 +633,7 @@ var di = {};
|
|
|
633
633
|
let n = t % e.length;
|
|
634
634
|
return n < 0 && (n += e.length), e[n];
|
|
635
635
|
}
|
|
636
|
-
function
|
|
636
|
+
function Mt(e, t) {
|
|
637
637
|
Array.prototype.push.apply(e, t);
|
|
638
638
|
}
|
|
639
639
|
function ja(e, t) {
|
|
@@ -695,7 +695,7 @@ var di = {};
|
|
|
695
695
|
function Ja(e, t) {
|
|
696
696
|
return e - (t - 1) / 2;
|
|
697
697
|
}
|
|
698
|
-
function
|
|
698
|
+
function Gn(e, t) {
|
|
699
699
|
const n = [];
|
|
700
700
|
for (let s = e; s <= t; s++) n.push(s);
|
|
701
701
|
return n;
|
|
@@ -713,13 +713,13 @@ var di = {};
|
|
|
713
713
|
return sr(e).replaceAll("-", "");
|
|
714
714
|
}
|
|
715
715
|
function Xa(e) {
|
|
716
|
-
return
|
|
716
|
+
return Rt(e.replace(/([A-Z])/g, " $1"));
|
|
717
717
|
}
|
|
718
718
|
function eo(e) {
|
|
719
|
-
return e.split("-").map(
|
|
719
|
+
return e.split("-").map(Rt).join(" ");
|
|
720
720
|
}
|
|
721
721
|
function to(e) {
|
|
722
|
-
return
|
|
722
|
+
return Xn(e.split("-").map(Rt).join(""));
|
|
723
723
|
}
|
|
724
724
|
function ro(e, t = ", ", n = " and ") {
|
|
725
725
|
return !e || !e.length ? "" : e.length === 1 ? e[0] : e.length === 2 ? `${e[0]}${n}${e[1]}` : `${e.slice(0, e.length - 1).join(t)}${n}${e[e.length - 1]}`;
|
|
@@ -730,13 +730,13 @@ var di = {};
|
|
|
730
730
|
function so(e) {
|
|
731
731
|
return sr(e).replace(/-/g, "_").toUpperCase();
|
|
732
732
|
}
|
|
733
|
-
function
|
|
733
|
+
function $t(e, t) {
|
|
734
734
|
if (t.length === 0) return 0;
|
|
735
735
|
const n = e.toLowerCase(), s = t.toLowerCase();
|
|
736
736
|
return e === t ? 1e4 : n.startsWith(s) ? 1e4 - e.length : n.includes(s) ? 5e3 - e.length : new RegExp(".*" + s.split("").join(".*") + ".*").test(n) ? 1e3 - e.length : 0;
|
|
737
737
|
}
|
|
738
738
|
function io(e, t) {
|
|
739
|
-
return e.filter((n) =>
|
|
739
|
+
return e.filter((n) => $t(n, t)).sort((n, s) => $t(s, t) - $t(n, t));
|
|
740
740
|
}
|
|
741
741
|
function ao(e) {
|
|
742
742
|
return e.replace(/</g, "<").replace(/>/g, ">").replace(/"/g, """);
|
|
@@ -747,7 +747,7 @@ var di = {};
|
|
|
747
747
|
for (const [n, s] of Object.entries(oo)) t = t.replaceAll(n, s);
|
|
748
748
|
return t;
|
|
749
749
|
}
|
|
750
|
-
function
|
|
750
|
+
function Jn(e, t) {
|
|
751
751
|
const n = e.indexOf(t);
|
|
752
752
|
return n === -1 ? null : e.slice(0, n);
|
|
753
753
|
}
|
|
@@ -759,7 +759,7 @@ var di = {};
|
|
|
759
759
|
const n = e.lastIndexOf(t);
|
|
760
760
|
return n === -1 ? null : e.slice(0, n);
|
|
761
761
|
}
|
|
762
|
-
function
|
|
762
|
+
function Kn(e, t) {
|
|
763
763
|
const n = e.lastIndexOf(t);
|
|
764
764
|
return n === -1 ? null : e.slice(n + t.length);
|
|
765
765
|
}
|
|
@@ -769,13 +769,13 @@ var di = {};
|
|
|
769
769
|
}
|
|
770
770
|
function lo(e, t, n) {
|
|
771
771
|
const s = ir(e, t);
|
|
772
|
-
return s ?
|
|
772
|
+
return s ? Jn(s, n) : null;
|
|
773
773
|
}
|
|
774
774
|
function or(e, t, n = !1) {
|
|
775
775
|
const s = n ? e.lastIndexOf(t) : e.indexOf(t);
|
|
776
776
|
return s === -1 ? n ? [null, e] : [e, null] : [e.slice(0, s), e.slice(s + t.length)];
|
|
777
777
|
}
|
|
778
|
-
function
|
|
778
|
+
function Yn(e, t) {
|
|
779
779
|
let n = [e];
|
|
780
780
|
for (const s of t) n = n.flatMap((o) => o.split(s));
|
|
781
781
|
return n.filter((s) => s);
|
|
@@ -806,16 +806,16 @@ var di = {};
|
|
|
806
806
|
function mo(e, t = Math.random) {
|
|
807
807
|
return e.replace(/\{(.+?)\}/g, (n, s) => Yt(s.split("|"), t));
|
|
808
808
|
}
|
|
809
|
-
function
|
|
809
|
+
function Qn(e) {
|
|
810
810
|
const t = /\{(.+?)\}/, n = e.match(t);
|
|
811
811
|
if (!n || !n.index) return [e];
|
|
812
812
|
const s = n[1].split(","), o = e.slice(0, n.index), d = e.slice(n.index + n[0].length);
|
|
813
|
-
let
|
|
813
|
+
let p = [];
|
|
814
814
|
for (const v of s) {
|
|
815
|
-
const m =
|
|
816
|
-
|
|
815
|
+
const m = Qn(o + v + d);
|
|
816
|
+
p = p.concat(m);
|
|
817
817
|
}
|
|
818
|
-
return
|
|
818
|
+
return p;
|
|
819
819
|
}
|
|
820
820
|
function Je(e) {
|
|
821
821
|
return e.split(
|
|
@@ -824,24 +824,24 @@ var di = {};
|
|
|
824
824
|
).map((t) => t.trim().replace(/\s+/g, " ")).filter((t) => t.length > 0).join(`
|
|
825
825
|
`);
|
|
826
826
|
}
|
|
827
|
-
function
|
|
827
|
+
function Rt(e) {
|
|
828
828
|
return e.charAt(0).toUpperCase() + e.slice(1);
|
|
829
829
|
}
|
|
830
|
-
function
|
|
830
|
+
function Xn(e) {
|
|
831
831
|
return e.charAt(0).toLowerCase() + e.slice(1);
|
|
832
832
|
}
|
|
833
|
-
function
|
|
833
|
+
function es(e) {
|
|
834
834
|
if (!e) return !1;
|
|
835
835
|
const t = e.charCodeAt(0);
|
|
836
836
|
return t >= 65 && t <= 90 || t >= 97 && t <= 122;
|
|
837
837
|
}
|
|
838
|
-
function
|
|
838
|
+
function ts(e) {
|
|
839
839
|
if (!e) return !1;
|
|
840
840
|
const t = e.charCodeAt(0);
|
|
841
841
|
return t >= 48 && t <= 57;
|
|
842
842
|
}
|
|
843
843
|
function Ke(e) {
|
|
844
|
-
return
|
|
844
|
+
return es(e) || ts(e);
|
|
845
845
|
}
|
|
846
846
|
const go = `
|
|
847
847
|
\r.,?!:;"'\`(){}[]~@#$%^&*-+=|<>/\\`.split("");
|
|
@@ -854,16 +854,16 @@ var di = {};
|
|
|
854
854
|
function wo(e, t, n, s, o) {
|
|
855
855
|
return e.slice(0, t) + s + e.slice(t, t + n) + o + e.slice(t + n);
|
|
856
856
|
}
|
|
857
|
-
function
|
|
857
|
+
function rs(e, t, n = 0) {
|
|
858
858
|
const s = t.exec(e.slice(n));
|
|
859
859
|
return s ? { index: s.index, match: s[0] } : null;
|
|
860
860
|
}
|
|
861
|
-
function
|
|
861
|
+
function ns(e, t, n = !0) {
|
|
862
862
|
if (!n) return t.every((o) => o instanceof RegExp ? o.test(e) : e.indexOf(o, 0) !== -1);
|
|
863
863
|
let s = 0;
|
|
864
864
|
for (const o of t)
|
|
865
865
|
if (o instanceof RegExp) {
|
|
866
|
-
const d =
|
|
866
|
+
const d = rs(e, o, s);
|
|
867
867
|
if (!d) return !1;
|
|
868
868
|
s = d.index + d.match.length;
|
|
869
869
|
} else {
|
|
@@ -877,7 +877,7 @@ var di = {};
|
|
|
877
877
|
let s = 0;
|
|
878
878
|
for (const o of t) {
|
|
879
879
|
let d = !1;
|
|
880
|
-
for (; !d && s < e.length; )
|
|
880
|
+
for (; !d && s < e.length; ) ns(e[s], o, n) && (d = !0), s++;
|
|
881
881
|
if (!d) return !1;
|
|
882
882
|
}
|
|
883
883
|
return !0;
|
|
@@ -901,10 +901,10 @@ var di = {};
|
|
|
901
901
|
for (let n = t; n < e.length; n++) if (e[n] === "#" && Ke(e[n + 1])) return n;
|
|
902
902
|
return -1;
|
|
903
903
|
}
|
|
904
|
-
function
|
|
904
|
+
function ss(e, t, n = 0) {
|
|
905
905
|
return e.slice(0, n).lastIndexOf(t);
|
|
906
906
|
}
|
|
907
|
-
function
|
|
907
|
+
function is(e, t = 0, n = "{", s = "}") {
|
|
908
908
|
let o = 1;
|
|
909
909
|
for (let d = t; d < e.length; d++)
|
|
910
910
|
if (e.slice(d, d + s.length) === s) {
|
|
@@ -912,7 +912,7 @@ var di = {};
|
|
|
912
912
|
} else e.slice(d, d + n.length) === n && o++;
|
|
913
913
|
return -1;
|
|
914
914
|
}
|
|
915
|
-
function
|
|
915
|
+
function as(e, t) {
|
|
916
916
|
const n = t.wordBoundary ? $e(
|
|
917
917
|
e,
|
|
918
918
|
[
|
|
@@ -923,7 +923,7 @@ var di = {};
|
|
|
923
923
|
t.start || 0
|
|
924
924
|
) : e.indexOf(t.opening, t.start || 0);
|
|
925
925
|
if (n === -1) return null;
|
|
926
|
-
const s =
|
|
926
|
+
const s = is(e, n + t.opening.length, t.opening, t.closing);
|
|
927
927
|
return s === -1 ? null : t.exclusive ? e.slice(n + t.opening.length, s) : e.slice(n, s + t.closing.length);
|
|
928
928
|
}
|
|
929
929
|
function Eo(e, t) {
|
|
@@ -939,7 +939,7 @@ var di = {};
|
|
|
939
939
|
) : e.indexOf(t.opening, t.start || 0);
|
|
940
940
|
for (; ; ) {
|
|
941
941
|
if (s === -1) return n;
|
|
942
|
-
const o =
|
|
942
|
+
const o = as(e, { ...t, start: s });
|
|
943
943
|
if (!o) return n;
|
|
944
944
|
n.push(o), s = t.wordBoundary ? $e(
|
|
945
945
|
e,
|
|
@@ -1023,37 +1023,37 @@ var di = {};
|
|
|
1023
1023
|
}
|
|
1024
1024
|
return t;
|
|
1025
1025
|
}
|
|
1026
|
-
const
|
|
1026
|
+
const os = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/", cs = "ABCDEFGHIJKLMNOPQRSTUVWXYZ234567";
|
|
1027
1027
|
function Io(e) {
|
|
1028
|
-
return
|
|
1028
|
+
return us(e, os);
|
|
1029
1029
|
}
|
|
1030
1030
|
function Mo(e) {
|
|
1031
|
-
return
|
|
1031
|
+
return ls(e, os);
|
|
1032
1032
|
}
|
|
1033
1033
|
function $o(e) {
|
|
1034
|
-
return
|
|
1034
|
+
return us(e, cs);
|
|
1035
1035
|
}
|
|
1036
1036
|
function Ro(e) {
|
|
1037
|
-
return
|
|
1037
|
+
return ls(e, cs);
|
|
1038
1038
|
}
|
|
1039
|
-
function
|
|
1039
|
+
function us(e, t) {
|
|
1040
1040
|
const n = "=", s = t.length;
|
|
1041
1041
|
let o = 0, d = 0;
|
|
1042
|
-
const
|
|
1042
|
+
const p = [];
|
|
1043
1043
|
for (let v = 0; v < e.length; v++) {
|
|
1044
1044
|
const m = e[v];
|
|
1045
1045
|
if (m === n) break;
|
|
1046
|
-
const
|
|
1047
|
-
if (
|
|
1048
|
-
d = d << Math.log2(s) |
|
|
1046
|
+
const k = t.indexOf(m);
|
|
1047
|
+
if (k === -1) throw new Error(`Invalid character: ${m}`);
|
|
1048
|
+
d = d << Math.log2(s) | k, o += Math.log2(s), o >= 8 && (o -= 8, p.push(d >> o & 255));
|
|
1049
1049
|
}
|
|
1050
|
-
return new Uint8Array(
|
|
1050
|
+
return new Uint8Array(p);
|
|
1051
1051
|
}
|
|
1052
|
-
function
|
|
1052
|
+
function ls(e, t) {
|
|
1053
1053
|
const n = t.length;
|
|
1054
1054
|
let s = 0, o = 0, d = "";
|
|
1055
|
-
for (let
|
|
1056
|
-
for (o = o << 8 | e[
|
|
1055
|
+
for (let p = 0; p < e.length; p++)
|
|
1056
|
+
for (o = o << 8 | e[p], s += 8; s >= Math.log2(n); ) s -= Math.log2(n), d += t[o >> s & n - 1];
|
|
1057
1057
|
return s > 0 && (d += t[o << Math.log2(n) - s & n - 1]), d.length % 4 !== 0 && (d += "=".repeat(4 - d.length % 4)), d;
|
|
1058
1058
|
}
|
|
1059
1059
|
function Co(e) {
|
|
@@ -1073,9 +1073,9 @@ var di = {};
|
|
|
1073
1073
|
if (n.length !== s.length) return null;
|
|
1074
1074
|
const o = {};
|
|
1075
1075
|
for (let d = 0; d < n.length; d++) {
|
|
1076
|
-
const
|
|
1077
|
-
if (
|
|
1078
|
-
else if (
|
|
1076
|
+
const p = n[d];
|
|
1077
|
+
if (p.startsWith(":")) o[p.slice(1)] = s[d];
|
|
1078
|
+
else if (p !== s[d]) return null;
|
|
1079
1079
|
}
|
|
1080
1080
|
return o;
|
|
1081
1081
|
}
|
|
@@ -1086,23 +1086,23 @@ var di = {};
|
|
|
1086
1086
|
}
|
|
1087
1087
|
function Do(e, t, n, s = Math.random) {
|
|
1088
1088
|
const o = a.Arrays.shuffle(
|
|
1089
|
-
t.map((
|
|
1089
|
+
t.map((p) => ({
|
|
1090
1090
|
variants: a.Arrays.shuffle(
|
|
1091
|
-
|
|
1091
|
+
p.variants.map((v) => v),
|
|
1092
1092
|
s
|
|
1093
1093
|
),
|
|
1094
|
-
avoid:
|
|
1094
|
+
avoid: p.avoid
|
|
1095
1095
|
})),
|
|
1096
1096
|
s
|
|
1097
1097
|
), d = [];
|
|
1098
|
-
for (const
|
|
1099
|
-
const v =
|
|
1100
|
-
if (m && (
|
|
1098
|
+
for (const p of o) {
|
|
1099
|
+
const v = p.variants.filter((k) => k !== p.avoid), m = v.find((k) => e.includes(k));
|
|
1100
|
+
if (m && (Mt(d, lr(e, m, v)), d.length >= n)) break;
|
|
1101
1101
|
}
|
|
1102
1102
|
if (d.length < n)
|
|
1103
|
-
for (const
|
|
1104
|
-
const v =
|
|
1105
|
-
if (v && (
|
|
1103
|
+
for (const p of o) {
|
|
1104
|
+
const v = p.variants.find((m) => e.includes(m));
|
|
1105
|
+
if (v && (Mt(d, lr(e, v, p.variants)), d.length >= n)) break;
|
|
1106
1106
|
}
|
|
1107
1107
|
return d.slice(0, n);
|
|
1108
1108
|
}
|
|
@@ -1117,7 +1117,7 @@ var di = {};
|
|
|
1117
1117
|
function Zo(e) {
|
|
1118
1118
|
return e.replace(/<[^>]*>/g, "");
|
|
1119
1119
|
}
|
|
1120
|
-
function
|
|
1120
|
+
function ds(e) {
|
|
1121
1121
|
const t = e.lastIndexOf(" ");
|
|
1122
1122
|
if (t === -1) return { line: e, rest: "" };
|
|
1123
1123
|
const n = e.slice(0, t), s = e.slice(t + 1);
|
|
@@ -1129,11 +1129,11 @@ var di = {};
|
|
|
1129
1129
|
function Lo(e, t, n = {}) {
|
|
1130
1130
|
const s = [];
|
|
1131
1131
|
let o = "", d = 0;
|
|
1132
|
-
for (let
|
|
1133
|
-
const v = e[
|
|
1132
|
+
for (let p = 0; p < e.length; p++) {
|
|
1133
|
+
const v = e[p], m = n[v] || 1;
|
|
1134
1134
|
if (o += v, d += m, d > t) {
|
|
1135
|
-
const { line:
|
|
1136
|
-
s.push(
|
|
1135
|
+
const { line: k, rest: M } = ds(o);
|
|
1136
|
+
s.push(k), o = M, d = M.split("").map((U) => n[U] || 1).reduce((U, je) => U + je, 0);
|
|
1137
1137
|
}
|
|
1138
1138
|
}
|
|
1139
1139
|
return o && s.push(o), s;
|
|
@@ -1164,38 +1164,38 @@ var di = {};
|
|
|
1164
1164
|
}
|
|
1165
1165
|
return t;
|
|
1166
1166
|
}
|
|
1167
|
-
function
|
|
1167
|
+
function Ct(e, t, n = []) {
|
|
1168
1168
|
let s = "";
|
|
1169
1169
|
for (; t < e.length && (Ke(e[t]) || n.includes(e[t])); ) s += e[t++];
|
|
1170
1170
|
return s;
|
|
1171
1171
|
}
|
|
1172
1172
|
function Wo(e, t, n = "$", s = ":") {
|
|
1173
|
-
for (const o in t) e =
|
|
1174
|
-
return e =
|
|
1173
|
+
for (const o in t) e = fs(e, o, t[o], n, s);
|
|
1174
|
+
return e = hs(e), e;
|
|
1175
1175
|
}
|
|
1176
|
-
function
|
|
1176
|
+
function fs(e, t, n, s = "$", o = ":") {
|
|
1177
1177
|
if (n === "") return e;
|
|
1178
1178
|
let d = e.indexOf(`${s}${t}`);
|
|
1179
1179
|
for (; d !== -1; ) {
|
|
1180
1180
|
if (e[d + t.length + 1] === o)
|
|
1181
1181
|
if (e[d + t.length + 2] === o) e = e.replace(`${s}${t}${o}${o}`, n);
|
|
1182
1182
|
else {
|
|
1183
|
-
const
|
|
1184
|
-
e = e.replace(`${s}${t}${o}${
|
|
1183
|
+
const p = Ct(e, d + t.length + 2, ["_"]);
|
|
1184
|
+
e = e.replace(`${s}${t}${o}${p}`, n);
|
|
1185
1185
|
}
|
|
1186
1186
|
else e = e.replace(`${s}${t}`, n);
|
|
1187
1187
|
d = e.indexOf(`${s}${t}`, d + n.length);
|
|
1188
1188
|
}
|
|
1189
1189
|
return e;
|
|
1190
1190
|
}
|
|
1191
|
-
function
|
|
1191
|
+
function hs(e, t = "$", n = ":") {
|
|
1192
1192
|
let s = e.indexOf(t);
|
|
1193
1193
|
for (; s !== -1; ) {
|
|
1194
|
-
const o =
|
|
1194
|
+
const o = Ct(e, s + 1);
|
|
1195
1195
|
if (e[s + o.length + 1] === n)
|
|
1196
1196
|
if (e[s + o.length + 2] === n) e = e.replace(`${t}${o}${n}${n}`, "");
|
|
1197
1197
|
else {
|
|
1198
|
-
const d =
|
|
1198
|
+
const d = Ct(e, s + o.length + 2);
|
|
1199
1199
|
e = e.replace(`${t}${o}${n}${d}`, d);
|
|
1200
1200
|
}
|
|
1201
1201
|
s = e.indexOf(t, s + 1);
|
|
@@ -1205,16 +1205,16 @@ var di = {};
|
|
|
1205
1205
|
function Ho(e, t) {
|
|
1206
1206
|
let n = e.indexOf("](");
|
|
1207
1207
|
for (; n !== -1; ) {
|
|
1208
|
-
const s =
|
|
1208
|
+
const s = ss(e, "[", n), o = e.indexOf(")", n);
|
|
1209
1209
|
if (s !== -1 && o !== -1) {
|
|
1210
|
-
const [d,
|
|
1210
|
+
const [d, p] = e.slice(s + 1, o).split("]("), v = t(d, p);
|
|
1211
1211
|
e = e.slice(0, s) + v + e.slice(o + 1);
|
|
1212
1212
|
}
|
|
1213
1213
|
n = e.indexOf("](", n + 1);
|
|
1214
1214
|
}
|
|
1215
1215
|
return e;
|
|
1216
1216
|
}
|
|
1217
|
-
function
|
|
1217
|
+
function ps(e, t = !0) {
|
|
1218
1218
|
const n = Object.entries(e).filter(([s, o]) => o != null).map(([s, o]) => `${s}=${encodeURIComponent(o)}`).join("&");
|
|
1219
1219
|
return n ? (t ? "?" : "") + n : "";
|
|
1220
1220
|
}
|
|
@@ -1232,14 +1232,14 @@ var di = {};
|
|
|
1232
1232
|
function Jo(e, t) {
|
|
1233
1233
|
let n = null, s = -1 / 0;
|
|
1234
1234
|
for (const [o, d] of Object.entries(e)) {
|
|
1235
|
-
const
|
|
1236
|
-
|
|
1235
|
+
const p = t(d);
|
|
1236
|
+
p > s && (s = p, n = o);
|
|
1237
1237
|
}
|
|
1238
1238
|
return n ? [n, e[n]] : null;
|
|
1239
1239
|
}
|
|
1240
1240
|
function Ko(e, t, n, s) {
|
|
1241
|
-
const o = e.find((
|
|
1242
|
-
o && d ? (o[t] = n + s, d[t] = n) : o && (o[t] = n + s), e.sort((
|
|
1241
|
+
const o = e.find((p) => p[t] === n), d = e.find((p) => p[t] === n + s);
|
|
1242
|
+
o && d ? (o[t] = n + s, d[t] = n) : o && (o[t] = n + s), e.sort((p, v) => Ot(p[t]) - Ot(v[t])), e.forEach((p, v) => p[t] = v + 1);
|
|
1243
1243
|
}
|
|
1244
1244
|
function Yo(e) {
|
|
1245
1245
|
const t = Object.keys(e);
|
|
@@ -1252,19 +1252,19 @@ var di = {};
|
|
|
1252
1252
|
);
|
|
1253
1253
|
}
|
|
1254
1254
|
function Xo(e, t, n) {
|
|
1255
|
-
return
|
|
1255
|
+
return vs(e, t) + ps(n || {});
|
|
1256
1256
|
}
|
|
1257
1257
|
function ec(e, t = ",", n = '"') {
|
|
1258
1258
|
const s = [];
|
|
1259
1259
|
let o = "", d = !1;
|
|
1260
|
-
const
|
|
1261
|
-
for (const v of
|
|
1260
|
+
const p = e.split("");
|
|
1261
|
+
for (const v of p) v === t && !d ? (s.push(o), o = "") : v === n && (!o && !d || d) ? d = !d : o += v;
|
|
1262
1262
|
return s.push(o), s;
|
|
1263
1263
|
}
|
|
1264
1264
|
function tc(e) {
|
|
1265
|
-
return `[${Math.floor(e.progress * 100)}%] ${
|
|
1265
|
+
return `[${Math.floor(e.progress * 100)}%] ${Nt(e.deltaMs)} out of ${Nt(
|
|
1266
1266
|
e.totalTimeMs
|
|
1267
|
-
)} (${
|
|
1267
|
+
)} (${Nt(e.remainingTimeMs)} left) [${Math.round(e.baseTimeMs)} ms each]`;
|
|
1268
1268
|
}
|
|
1269
1269
|
async function rc(e, t, n) {
|
|
1270
1270
|
for (let s = 0; s < n; s++) {
|
|
@@ -1309,7 +1309,7 @@ var di = {};
|
|
|
1309
1309
|
let s = gr(nr(t), 0, 23), o = gr(nr(n), 0, 59);
|
|
1310
1310
|
return `${K(s)}:${K(o)}`;
|
|
1311
1311
|
}
|
|
1312
|
-
function
|
|
1312
|
+
function Nt(e) {
|
|
1313
1313
|
const t = Math.floor(e / 36e5);
|
|
1314
1314
|
e = e % 36e5;
|
|
1315
1315
|
const n = Math.floor(e / 6e4);
|
|
@@ -1339,7 +1339,7 @@ var di = {};
|
|
|
1339
1339
|
const d = hr(o);
|
|
1340
1340
|
return be(n) - be(o) < 7 ? s[d.day]() : s.weeks(Math.round((n.getTime() - o.getTime()) / 6048e5));
|
|
1341
1341
|
}
|
|
1342
|
-
const
|
|
1342
|
+
const ms = {
|
|
1343
1343
|
now: () => "A few seconds",
|
|
1344
1344
|
seconds: (e) => `${e} seconds`,
|
|
1345
1345
|
minutes: (e) => `${e} minutes`,
|
|
@@ -1347,13 +1347,13 @@ var di = {};
|
|
|
1347
1347
|
days: (e) => `${e} days`,
|
|
1348
1348
|
weeks: (e) => `${e} weeks`
|
|
1349
1349
|
};
|
|
1350
|
-
function
|
|
1351
|
-
const n = (t == null ? void 0 : t.now) ?? Date.now(), s = (t == null ? void 0 : t.labels) ||
|
|
1350
|
+
function gs(e, t) {
|
|
1351
|
+
const n = (t == null ? void 0 : t.now) ?? Date.now(), s = (t == null ? void 0 : t.labels) || ms, o = a.Types.isDate(e) ? e.getTime() : e;
|
|
1352
1352
|
let d = (n - o) / 1e3;
|
|
1353
1353
|
return d < 10 ? s.now() : d < 120 ? s.seconds(Math.floor(d)) : (d /= 60, d < 120 ? s.minutes(Math.floor(d)) : (d /= 60, d < 48 ? s.hours(Math.floor(d)) : (d /= 24, d < 14 ? s.days(Math.floor(d)) : (d /= 7, s.weeks(Math.floor(d))))));
|
|
1354
1354
|
}
|
|
1355
|
-
function hc(e, t =
|
|
1356
|
-
return
|
|
1355
|
+
function hc(e, t = ms) {
|
|
1356
|
+
return gs(0, { now: e * 1e3, labels: t });
|
|
1357
1357
|
}
|
|
1358
1358
|
function pc(e, t, n) {
|
|
1359
1359
|
const s = ((n == null ? void 0 : n.now) ?? Date.now()) - e, o = Math.floor(s / t), d = t / ((n == null ? void 0 : n.precision) ?? 1) - Math.ceil(s % t / ((n == null ? void 0 : n.precision) ?? 1));
|
|
@@ -1369,8 +1369,8 @@ var di = {};
|
|
|
1369
1369
|
}
|
|
1370
1370
|
function vc(e, t, n, s) {
|
|
1371
1371
|
s || (s = Date.now());
|
|
1372
|
-
const o = t / n, d = s - e,
|
|
1373
|
-
return { deltaMs: d, progress: o, baseTimeMs:
|
|
1372
|
+
const o = t / n, d = s - e, p = d / t, v = p * n, m = v - d;
|
|
1373
|
+
return { deltaMs: d, progress: o, baseTimeMs: p, totalTimeMs: v, remainingTimeMs: m };
|
|
1374
1374
|
}
|
|
1375
1375
|
const wc = {
|
|
1376
1376
|
0: "sunday",
|
|
@@ -1381,11 +1381,11 @@ var di = {};
|
|
|
1381
1381
|
5: "friday",
|
|
1382
1382
|
6: "saturday"
|
|
1383
1383
|
};
|
|
1384
|
-
function
|
|
1384
|
+
function ys(e) {
|
|
1385
1385
|
return { zeroBasedIndex: e, day: wc[e] };
|
|
1386
1386
|
}
|
|
1387
1387
|
function hr(e) {
|
|
1388
|
-
return
|
|
1388
|
+
return ys(e.getDay());
|
|
1389
1389
|
}
|
|
1390
1390
|
function bc(e) {
|
|
1391
1391
|
return hr(new Date(e));
|
|
@@ -1469,19 +1469,19 @@ var di = {};
|
|
|
1469
1469
|
async function Mc(e, t, n) {
|
|
1470
1470
|
const s = Date.now(), o = pr[e];
|
|
1471
1471
|
if (o && o.validUntil > s) return o.value;
|
|
1472
|
-
const d = await n(),
|
|
1473
|
-
return pr[e] = { value: d, validUntil:
|
|
1472
|
+
const d = await n(), p = s + t;
|
|
1473
|
+
return pr[e] = { value: d, validUntil: p }, d;
|
|
1474
1474
|
}
|
|
1475
1475
|
function $c(e) {
|
|
1476
1476
|
delete pr[e];
|
|
1477
1477
|
}
|
|
1478
|
-
function
|
|
1478
|
+
function vs(...e) {
|
|
1479
1479
|
return e.filter((t) => t).join("/").replace(new RegExp("(?<!:)\\/+", "g"), "/");
|
|
1480
1480
|
}
|
|
1481
1481
|
function Rc(e, t, n, s, o = !0) {
|
|
1482
|
-
const d = e.indexOf(t),
|
|
1483
|
-
if (d === -1 ||
|
|
1484
|
-
return o ? e.substring(0, d + t.length) + s + e.substring(
|
|
1482
|
+
const d = e.indexOf(t), p = e.indexOf(n, d + t.length);
|
|
1483
|
+
if (d === -1 || p === -1) throw Error("Start or end not found");
|
|
1484
|
+
return o ? e.substring(0, d + t.length) + s + e.substring(p) : e.substring(0, d) + s + e.substring(p + n.length);
|
|
1485
1485
|
}
|
|
1486
1486
|
function Cc(e) {
|
|
1487
1487
|
let t = "p";
|
|
@@ -1502,23 +1502,23 @@ var di = {};
|
|
|
1502
1502
|
for (; e = e.replace(/(\w+)[\s,']+\w+/g, "$1"), e.length !== t; ) t = e.length;
|
|
1503
1503
|
return e = e.replaceAll(/[A-Z][a-zA-Z0-9]*/g, "A"), e = e.replaceAll(/[a-z][a-zA-Z0-9]*/g, "a"), e = e.replaceAll(/[\u4E00-\u9FA5]+/g, "Z"), e;
|
|
1504
1504
|
}
|
|
1505
|
-
function
|
|
1505
|
+
function ws(e) {
|
|
1506
1506
|
const t = Object.keys(e).sort((s, o) => s.localeCompare(o)), n = {};
|
|
1507
1507
|
for (const s of t) n[s] = _e(e[s]);
|
|
1508
1508
|
return n;
|
|
1509
1509
|
}
|
|
1510
|
-
function
|
|
1510
|
+
function bs(e) {
|
|
1511
1511
|
const t = [];
|
|
1512
1512
|
return e.sort((n, s) => JSON.stringify(_e(n)).localeCompare(JSON.stringify(_e(s)))).forEach((n) => t.push(_e(n))), t;
|
|
1513
1513
|
}
|
|
1514
1514
|
function _e(e) {
|
|
1515
|
-
return Array.isArray(e) ?
|
|
1515
|
+
return Array.isArray(e) ? bs(e) : ce(e) ? ws(e) : e;
|
|
1516
1516
|
}
|
|
1517
|
-
function
|
|
1517
|
+
function _s(e, t) {
|
|
1518
1518
|
return JSON.stringify(_e(e)) === JSON.stringify(_e(t));
|
|
1519
1519
|
}
|
|
1520
1520
|
function Dc(...e) {
|
|
1521
|
-
for (let t = 1; t < e.length; t++) if (!
|
|
1521
|
+
for (let t = 1; t < e.length; t++) if (!_s(e[t - 1], e[t])) return !1;
|
|
1522
1522
|
return !0;
|
|
1523
1523
|
}
|
|
1524
1524
|
function Uc(e) {
|
|
@@ -1545,11 +1545,11 @@ var di = {};
|
|
|
1545
1545
|
}
|
|
1546
1546
|
function Lc(e, t, n, s, o) {
|
|
1547
1547
|
const d = {};
|
|
1548
|
-
for (const
|
|
1548
|
+
for (const p of Object.keys(t)) d[p] = [];
|
|
1549
1549
|
d[s] = [], o && (e = e.sort(o));
|
|
1550
|
-
for (const
|
|
1551
|
-
const v =
|
|
1552
|
-
d[m].length >= t[m] ? d[s].push(
|
|
1550
|
+
for (const p of e) {
|
|
1551
|
+
const v = p[n], m = t[v] ? v : s;
|
|
1552
|
+
d[m].length >= t[m] ? d[s].push(p) : d[m].push(p);
|
|
1553
1553
|
}
|
|
1554
1554
|
return d;
|
|
1555
1555
|
}
|
|
@@ -1557,12 +1557,12 @@ var di = {};
|
|
|
1557
1557
|
const n = Object.keys(e), s = Object.keys(t);
|
|
1558
1558
|
return { uniqueToA: n.filter((o) => !s.includes(o)), uniqueToB: s.filter((o) => !n.includes(o)) };
|
|
1559
1559
|
}
|
|
1560
|
-
function
|
|
1560
|
+
function xs(e) {
|
|
1561
1561
|
const t = Object.keys(e);
|
|
1562
1562
|
return t[Math.floor(Math.random() * t.length)];
|
|
1563
1563
|
}
|
|
1564
1564
|
function Vc(e, t) {
|
|
1565
|
-
const n =
|
|
1565
|
+
const n = xs(e);
|
|
1566
1566
|
return e[n] = t(e[n]), n;
|
|
1567
1567
|
}
|
|
1568
1568
|
function Fc(e) {
|
|
@@ -1589,7 +1589,7 @@ var di = {};
|
|
|
1589
1589
|
"eth",
|
|
1590
1590
|
"dai",
|
|
1591
1591
|
"decillion"
|
|
1592
|
-
],
|
|
1592
|
+
], ks = ["K", "M", "B", "T", "Qa", "Qi", "Sx", "Sp", "O", "N", "gwei", "bzz", "eth", "btc", "dai", "D"];
|
|
1593
1593
|
function Hc(e, t, n) {
|
|
1594
1594
|
let s = e.length - t;
|
|
1595
1595
|
if (s <= 0) return "0." + "0".repeat(-s) + e + (n ? " " + n : "");
|
|
@@ -1597,16 +1597,16 @@ var di = {};
|
|
|
1597
1597
|
return o === "" && (o = "0"), o + "." + d + (n ? " " + n : "");
|
|
1598
1598
|
}
|
|
1599
1599
|
function qc(e, t) {
|
|
1600
|
-
const n = (t == null ? void 0 : t.longForm) ?? !1, s = t != null && t.unit ? ` ${t.unit}` : "", o = n ? Wc :
|
|
1600
|
+
const n = (t == null ? void 0 : t.longForm) ?? !1, s = t != null && t.unit ? ` ${t.unit}` : "", o = n ? Wc : ks, d = (t == null ? void 0 : t.precision) ?? 1;
|
|
1601
1601
|
if (e < le[0]) return `${e}${s}`;
|
|
1602
|
-
for (let
|
|
1603
|
-
if (e < le[
|
|
1602
|
+
for (let p = 0; p < le.length - 1; p++)
|
|
1603
|
+
if (e < le[p + 1]) return `${(e / le[p]).toFixed(d)}${n ? " " : ""}${o[p]}${s}`;
|
|
1604
1604
|
return `${(e / le[le.length - 1]).toFixed(d)}${n ? " " : ""}${o[le.length - 1]}${s}`;
|
|
1605
1605
|
}
|
|
1606
1606
|
function mr(e) {
|
|
1607
1607
|
const t = parseFloat(e);
|
|
1608
1608
|
if (isNaN(t)) throw Error("makeNumber got NaN for input");
|
|
1609
|
-
const n = e.replace(/^-?[0-9.]+/, "").trim(), s =
|
|
1609
|
+
const n = e.replace(/^-?[0-9.]+/, "").trim(), s = ks.findIndex((o) => o.toLowerCase() === n.toLowerCase());
|
|
1610
1610
|
return s === -1 ? t : t * le[s];
|
|
1611
1611
|
}
|
|
1612
1612
|
function gr(e, t, n) {
|
|
@@ -1628,19 +1628,19 @@ var di = {};
|
|
|
1628
1628
|
}
|
|
1629
1629
|
function Qc(e, t) {
|
|
1630
1630
|
const n = Object.keys(t);
|
|
1631
|
-
for (const s of n) Array.isArray(t[s]) && Array.isArray(e[s]) &&
|
|
1631
|
+
for (const s of n) Array.isArray(t[s]) && Array.isArray(e[s]) && Mt(e[s], t[s]);
|
|
1632
1632
|
}
|
|
1633
1633
|
function Xc(e) {
|
|
1634
1634
|
return e.splice(0, e.length), e;
|
|
1635
1635
|
}
|
|
1636
1636
|
function eu(e) {
|
|
1637
1637
|
for (const t of Object.keys(e))
|
|
1638
|
-
(
|
|
1638
|
+
(Dn(e[t]) || Array.isArray(e[t]) && e[t].every((n) => n == null)) && delete e[t];
|
|
1639
1639
|
return e;
|
|
1640
1640
|
}
|
|
1641
1641
|
function tu(e) {
|
|
1642
1642
|
for (const t of Object.entries(e))
|
|
1643
|
-
(t[1] === null || t[1] === void 0 || F(t[1]) &&
|
|
1643
|
+
(t[1] === null || t[1] === void 0 || F(t[1]) && At(t[1])) && delete e[t[0]];
|
|
1644
1644
|
return e;
|
|
1645
1645
|
}
|
|
1646
1646
|
function ru(e, t) {
|
|
@@ -1688,16 +1688,16 @@ var di = {};
|
|
|
1688
1688
|
let o = 1;
|
|
1689
1689
|
const d = [1];
|
|
1690
1690
|
for (let v = 0; v < n.length - 1; v++) o *= n[v], d.push(o);
|
|
1691
|
-
const
|
|
1691
|
+
const p = [];
|
|
1692
1692
|
for (let v = 0; v < s; v++) {
|
|
1693
1693
|
const m = {};
|
|
1694
|
-
for (let
|
|
1695
|
-
const M = e[t[
|
|
1696
|
-
m[t[
|
|
1694
|
+
for (let k = 0; k < t.length; k++) {
|
|
1695
|
+
const M = e[t[k]], U = Math.floor(v / d[k]) % M.length;
|
|
1696
|
+
m[t[k]] = M[U];
|
|
1697
1697
|
}
|
|
1698
|
-
|
|
1698
|
+
p.push(m);
|
|
1699
1699
|
}
|
|
1700
|
-
return
|
|
1700
|
+
return p;
|
|
1701
1701
|
}
|
|
1702
1702
|
function du(e) {
|
|
1703
1703
|
return Object.values(e).filter((t) => t).length;
|
|
@@ -1705,32 +1705,32 @@ var di = {};
|
|
|
1705
1705
|
function fu(e, t, n) {
|
|
1706
1706
|
return e + (n ? "[" + t + "]" : (e.length ? "." : "") + t);
|
|
1707
1707
|
}
|
|
1708
|
-
function
|
|
1708
|
+
function jt(e, t, n, s, o) {
|
|
1709
1709
|
if (!ce(t)) return t;
|
|
1710
|
-
for (const [d,
|
|
1710
|
+
for (const [d, p] of Object.entries(t)) {
|
|
1711
1711
|
const v = fu(n, d, s);
|
|
1712
|
-
Array.isArray(
|
|
1712
|
+
Array.isArray(p) ? o ? jt(e, p, v, !0, o) : e[v] = p.map((m) => jt(Array.isArray(m) ? [] : {}, m, "", !1, o)) : ce(p) ? jt(e, p, v, !1, o) : e[v] = p;
|
|
1713
1713
|
}
|
|
1714
1714
|
return e;
|
|
1715
1715
|
}
|
|
1716
1716
|
function hu(e, t = !1, n) {
|
|
1717
|
-
return
|
|
1717
|
+
return jt({}, e, n || "", !1, t);
|
|
1718
1718
|
}
|
|
1719
|
-
function
|
|
1719
|
+
function Es(e) {
|
|
1720
1720
|
if (!ce(e)) return e;
|
|
1721
1721
|
const t = Array.isArray(e) ? [] : {};
|
|
1722
1722
|
for (const [n, s] of Object.entries(e))
|
|
1723
1723
|
Array.isArray(s) ? ve(
|
|
1724
1724
|
t,
|
|
1725
1725
|
n,
|
|
1726
|
-
s.map((o) =>
|
|
1726
|
+
s.map((o) => Es(o))
|
|
1727
1727
|
) : ve(t, n, s);
|
|
1728
1728
|
return t;
|
|
1729
1729
|
}
|
|
1730
1730
|
function pu(e, t, n) {
|
|
1731
1731
|
return t[e] ? t[e] : n;
|
|
1732
1732
|
}
|
|
1733
|
-
function
|
|
1733
|
+
function Ss(e, t) {
|
|
1734
1734
|
const n = {};
|
|
1735
1735
|
for (const s of e) {
|
|
1736
1736
|
const o = t(s);
|
|
@@ -1751,37 +1751,37 @@ var di = {};
|
|
|
1751
1751
|
for (let s = 0; s < e.length; s += t) n.push(e.slice(s, s + t));
|
|
1752
1752
|
return n;
|
|
1753
1753
|
}
|
|
1754
|
-
function
|
|
1754
|
+
function Ts(e, t) {
|
|
1755
1755
|
const n = Math.ceil(e.length / t), s = [];
|
|
1756
1756
|
for (let o = 0; o < e.length; o += n) s.push(e.slice(o, o + n));
|
|
1757
1757
|
return s;
|
|
1758
1758
|
}
|
|
1759
|
-
function
|
|
1759
|
+
function As(e, t) {
|
|
1760
1760
|
const n = [], s = Math.ceil(e.length / t);
|
|
1761
1761
|
for (let o = 0; o < s; o++) n.push(e.slice(o * t, o * t + t));
|
|
1762
1762
|
return n;
|
|
1763
1763
|
}
|
|
1764
1764
|
function yu(e, t) {
|
|
1765
1765
|
const n = Math.ceil(e.length / t);
|
|
1766
|
-
return
|
|
1766
|
+
return As(e, n);
|
|
1767
1767
|
}
|
|
1768
1768
|
function vu(e, t) {
|
|
1769
|
-
return Object.values(
|
|
1769
|
+
return Object.values(Ss(e, t));
|
|
1770
1770
|
}
|
|
1771
1771
|
function wu(e, t, n, s, o) {
|
|
1772
|
-
const d = t ? e.map(t) : e,
|
|
1773
|
-
for (const m of d)
|
|
1774
|
-
const v = s ?
|
|
1772
|
+
const d = t ? e.map(t) : e, p = {};
|
|
1773
|
+
for (const m of d) p[m] = (p[m] || 0) + 1;
|
|
1774
|
+
const v = s ? Os(p, o ? (m, k) => m[1] - k[1] : (m, k) => k[1] - m[1]) : p;
|
|
1775
1775
|
return n ? Object.keys(v) : v;
|
|
1776
1776
|
}
|
|
1777
|
-
function
|
|
1777
|
+
function Os(e, t) {
|
|
1778
1778
|
return Object.fromEntries(Object.entries(e).sort(t));
|
|
1779
1779
|
}
|
|
1780
1780
|
function bu(e) {
|
|
1781
1781
|
const t = [], n = Object.keys(e), s = e[n[0]].length;
|
|
1782
1782
|
for (let o = 0; o < s; o++) {
|
|
1783
1783
|
const d = {};
|
|
1784
|
-
for (const
|
|
1784
|
+
for (const p of n) d[p] = e[p][o];
|
|
1785
1785
|
t.push(d);
|
|
1786
1786
|
}
|
|
1787
1787
|
return t;
|
|
@@ -1805,7 +1805,7 @@ var di = {};
|
|
|
1805
1805
|
function Eu() {
|
|
1806
1806
|
return { map: /* @__PURE__ */ new Map(), keys: [] };
|
|
1807
1807
|
}
|
|
1808
|
-
function
|
|
1808
|
+
function Is(e, t, n, s = 100) {
|
|
1809
1809
|
if (e.map.has(t)) {
|
|
1810
1810
|
const o = e.keys.indexOf(t);
|
|
1811
1811
|
e.keys.splice(o, 1);
|
|
@@ -1826,7 +1826,7 @@ var di = {};
|
|
|
1826
1826
|
}
|
|
1827
1827
|
}
|
|
1828
1828
|
function Tu(e, t, n, s, o = 100) {
|
|
1829
|
-
|
|
1829
|
+
Is(e, t, { validUntil: Date.now() + s, data: n }, o);
|
|
1830
1830
|
}
|
|
1831
1831
|
function Au(e, t) {
|
|
1832
1832
|
const n = e.map.get(t);
|
|
@@ -1917,28 +1917,28 @@ var di = {};
|
|
|
1917
1917
|
}
|
|
1918
1918
|
}
|
|
1919
1919
|
function Uu(e, t, n, s, o = !1) {
|
|
1920
|
-
const d = /* @__PURE__ */ new Map(),
|
|
1920
|
+
const d = /* @__PURE__ */ new Map(), p = [];
|
|
1921
1921
|
e.forEach((m) => {
|
|
1922
|
-
const
|
|
1923
|
-
d.set(m[t],
|
|
1922
|
+
const k = new Du(m);
|
|
1923
|
+
d.set(m[t], k);
|
|
1924
1924
|
}), e.forEach((m) => {
|
|
1925
|
-
const
|
|
1926
|
-
if (!
|
|
1925
|
+
const k = d.get(m[t]);
|
|
1926
|
+
if (!k) return;
|
|
1927
1927
|
const M = m[n];
|
|
1928
1928
|
if (M) {
|
|
1929
1929
|
const U = d.get(M);
|
|
1930
|
-
U && U.children.push(
|
|
1931
|
-
} else
|
|
1930
|
+
U && U.children.push(k);
|
|
1931
|
+
} else p.push(k);
|
|
1932
1932
|
});
|
|
1933
1933
|
const v = (m) => {
|
|
1934
|
-
m.children.sort((
|
|
1935
|
-
const U =
|
|
1934
|
+
m.children.sort((k, M) => {
|
|
1935
|
+
const U = k.value[s], je = M.value[s];
|
|
1936
1936
|
return o ? je - U : U - je;
|
|
1937
1937
|
}), m.children.forEach(v);
|
|
1938
1938
|
};
|
|
1939
|
-
return
|
|
1939
|
+
return p.forEach(v), p;
|
|
1940
1940
|
}
|
|
1941
|
-
function
|
|
1941
|
+
function Ms(e, t) {
|
|
1942
1942
|
if (Math.log2(e.length) % 1 !== 0) throw new Error("Array length must be a power of 2");
|
|
1943
1943
|
let n = [...e];
|
|
1944
1944
|
for (; n.length > 1; ) {
|
|
@@ -1958,17 +1958,17 @@ var di = {};
|
|
|
1958
1958
|
n.set(o, s), s += o.length;
|
|
1959
1959
|
}), n;
|
|
1960
1960
|
}
|
|
1961
|
-
function
|
|
1961
|
+
function $s(e) {
|
|
1962
1962
|
return e[0] === 137 && e[1] === 80 && e[2] === 78 && e[3] === 71;
|
|
1963
1963
|
}
|
|
1964
|
-
function
|
|
1964
|
+
function Rs(e) {
|
|
1965
1965
|
return e[0] === 255 && e[1] === 216;
|
|
1966
1966
|
}
|
|
1967
|
-
function
|
|
1967
|
+
function Cs(e) {
|
|
1968
1968
|
return e[8] === 87 && e[9] === 69 && e[10] === 66 && e[11] === 80;
|
|
1969
1969
|
}
|
|
1970
1970
|
function Pu(e) {
|
|
1971
|
-
return
|
|
1971
|
+
return $s(e) || Rs(e) || Cs(e);
|
|
1972
1972
|
}
|
|
1973
1973
|
function Zu(e) {
|
|
1974
1974
|
return new Uint8Array([e]);
|
|
@@ -2027,7 +2027,7 @@ var di = {};
|
|
|
2027
2027
|
for (let s = 0; s < e.length; s += t) n.push(e.subarray(s, s + t));
|
|
2028
2028
|
return n;
|
|
2029
2029
|
}
|
|
2030
|
-
const
|
|
2030
|
+
const Ns = [
|
|
2031
2031
|
0,
|
|
2032
2032
|
1,
|
|
2033
2033
|
0,
|
|
@@ -2079,21 +2079,21 @@ var di = {};
|
|
|
2079
2079
|
];
|
|
2080
2080
|
function qu(e) {
|
|
2081
2081
|
for (let t = 0; t < 24; t++) {
|
|
2082
|
-
const n = e[0] ^ e[10] ^ e[20] ^ e[30] ^ e[40], s = e[1] ^ e[11] ^ e[21] ^ e[31] ^ e[41], o = e[2] ^ e[12] ^ e[22] ^ e[32] ^ e[42], d = e[3] ^ e[13] ^ e[23] ^ e[33] ^ e[43],
|
|
2082
|
+
const n = e[0] ^ e[10] ^ e[20] ^ e[30] ^ e[40], s = e[1] ^ e[11] ^ e[21] ^ e[31] ^ e[41], o = e[2] ^ e[12] ^ e[22] ^ e[32] ^ e[42], d = e[3] ^ e[13] ^ e[23] ^ e[33] ^ e[43], p = e[4] ^ e[14] ^ e[24] ^ e[34] ^ e[44], v = e[5] ^ e[15] ^ e[25] ^ e[35] ^ e[45], m = e[6] ^ e[16] ^ e[26] ^ e[36] ^ e[46], k = e[7] ^ e[17] ^ e[27] ^ e[37] ^ e[47], M = e[8] ^ e[18] ^ e[28] ^ e[38] ^ e[48], U = e[9] ^ e[19] ^ e[29] ^ e[39] ^ e[49], je = o << 1 | d >>> 31, Il = d << 1 | o >>> 31, Xe = M ^ je, et = U ^ Il, Ml = p << 1 | v >>> 31, $l = v << 1 | p >>> 31, tt = n ^ Ml, rt = s ^ $l, Rl = m << 1 | k >>> 31, Cl = k << 1 | m >>> 31, nt = o ^ Rl, st = d ^ Cl, Nl = M << 1 | U >>> 31, jl = U << 1 | M >>> 31, it = p ^ Nl, at = v ^ jl, Dl = n << 1 | s >>> 31, Ul = s << 1 | n >>> 31, ot = m ^ Dl, ct = k ^ Ul;
|
|
2083
2083
|
e[0] ^= Xe, e[1] ^= et, e[2] ^= tt, e[3] ^= rt, e[4] ^= nt, e[5] ^= st, e[6] ^= it, e[7] ^= at, e[8] ^= ot, e[9] ^= ct, e[10] ^= Xe, e[11] ^= et, e[12] ^= tt, e[13] ^= rt, e[14] ^= nt, e[15] ^= st, e[16] ^= it, e[17] ^= at, e[18] ^= ot, e[19] ^= ct, e[20] ^= Xe, e[21] ^= et, e[22] ^= tt, e[23] ^= rt, e[24] ^= nt, e[25] ^= st, e[26] ^= it, e[27] ^= at, e[28] ^= ot, e[29] ^= ct, e[30] ^= Xe, e[31] ^= et, e[32] ^= tt, e[33] ^= rt, e[34] ^= nt, e[35] ^= st, e[36] ^= it, e[37] ^= at, e[38] ^= ot, e[39] ^= ct, e[40] ^= Xe, e[41] ^= et, e[42] ^= tt, e[43] ^= rt, e[44] ^= nt, e[45] ^= st, e[46] ^= it, e[47] ^= at, e[48] ^= ot, e[49] ^= ct;
|
|
2084
2084
|
const Sr = e[0], Tr = e[1], Ar = e[2] << 1 | e[3] >>> 31, Or = e[3] << 1 | e[2] >>> 31, Ir = e[5] << 30 | e[4] >>> 2, Mr = e[4] << 30 | e[5] >>> 2, $r = e[6] << 28 | e[7] >>> 4, Rr = e[7] << 28 | e[6] >>> 4, Cr = e[8] << 27 | e[9] >>> 5, Nr = e[9] << 27 | e[8] >>> 5, jr = e[11] << 4 | e[10] >>> 28, Dr = e[10] << 4 | e[11] >>> 28, Ur = e[13] << 12 | e[12] >>> 20, Pr = e[12] << 12 | e[13] >>> 20, Zr = e[14] << 6 | e[15] >>> 26, Br = e[15] << 6 | e[14] >>> 26, Lr = e[17] << 23 | e[16] >>> 9, zr = e[16] << 23 | e[17] >>> 9, Vr = e[18] << 20 | e[19] >>> 12, Fr = e[19] << 20 | e[18] >>> 12, Wr = e[20] << 3 | e[21] >>> 29, Hr = e[21] << 3 | e[20] >>> 29, qr = e[22] << 10 | e[23] >>> 22, Gr = e[23] << 10 | e[22] >>> 22, Jr = e[25] << 11 | e[24] >>> 21, Kr = e[24] << 11 | e[25] >>> 21, Yr = e[26] << 25 | e[27] >>> 7, Qr = e[27] << 25 | e[26] >>> 7, Xr = e[29] << 7 | e[28] >>> 25, en = e[28] << 7 | e[29] >>> 25, tn = e[31] << 9 | e[30] >>> 23, rn = e[30] << 9 | e[31] >>> 23, nn = e[33] << 13 | e[32] >>> 19, sn = e[32] << 13 | e[33] >>> 19, an = e[34] << 15 | e[35] >>> 17, on = e[35] << 15 | e[34] >>> 17, cn = e[36] << 21 | e[37] >>> 11, un = e[37] << 21 | e[36] >>> 11, ln = e[38] << 8 | e[39] >>> 24, dn = e[39] << 8 | e[38] >>> 24, fn = e[40] << 18 | e[41] >>> 14, hn = e[41] << 18 | e[40] >>> 14, pn = e[42] << 2 | e[43] >>> 30, mn = e[43] << 2 | e[42] >>> 30, gn = e[45] << 29 | e[44] >>> 3, yn = e[44] << 29 | e[45] >>> 3, vn = e[47] << 24 | e[46] >>> 8, wn = e[46] << 24 | e[47] >>> 8, bn = e[48] << 14 | e[49] >>> 18, _n = e[49] << 14 | e[48] >>> 18;
|
|
2085
|
-
e[0] = Sr ^ ~Ur & Jr, e[1] = Tr ^ ~Pr & Kr, e[2] = Ur ^ ~Jr & cn, e[3] = Pr ^ ~Kr & un, e[4] = Jr ^ ~cn & bn, e[5] = Kr ^ ~un & _n, e[6] = cn ^ ~bn & Sr, e[7] = un ^ ~_n & Tr, e[8] = bn ^ ~Sr & Ur, e[9] = _n ^ ~Tr & Pr, e[10] = $r ^ ~Vr & Wr, e[11] = Rr ^ ~Fr & Hr, e[12] = Vr ^ ~Wr & nn, e[13] = Fr ^ ~Hr & sn, e[14] = Wr ^ ~nn & gn, e[15] = Hr ^ ~sn & yn, e[16] = nn ^ ~gn & $r, e[17] = sn ^ ~yn & Rr, e[18] = gn ^ ~$r & Vr, e[19] = yn ^ ~Rr & Fr, e[20] = Ar ^ ~Zr & Yr, e[21] = Or ^ ~Br & Qr, e[22] = Zr ^ ~Yr & ln, e[23] = Br ^ ~Qr & dn, e[24] = Yr ^ ~ln & fn, e[25] = Qr ^ ~dn & hn, e[26] = ln ^ ~fn & Ar, e[27] = dn ^ ~hn & Or, e[28] = fn ^ ~Ar & Zr, e[29] = hn ^ ~Or & Br, e[30] = Cr ^ ~jr & qr, e[31] = Nr ^ ~Dr & Gr, e[32] = jr ^ ~qr & an, e[33] = Dr ^ ~Gr & on, e[34] = qr ^ ~an & vn, e[35] = Gr ^ ~on & wn, e[36] = an ^ ~vn & Cr, e[37] = on ^ ~wn & Nr, e[38] = vn ^ ~Cr & jr, e[39] = wn ^ ~Nr & Dr, e[40] = Ir ^ ~Lr & Xr, e[41] = Mr ^ ~zr & en, e[42] = Lr ^ ~Xr & tn, e[43] = zr ^ ~en & rn, e[44] = Xr ^ ~tn & pn, e[45] = en ^ ~rn & mn, e[46] = tn ^ ~pn & Ir, e[47] = rn ^ ~mn & Mr, e[48] = pn ^ ~Ir & Lr, e[49] = mn ^ ~Mr & zr, e[0] ^=
|
|
2085
|
+
e[0] = Sr ^ ~Ur & Jr, e[1] = Tr ^ ~Pr & Kr, e[2] = Ur ^ ~Jr & cn, e[3] = Pr ^ ~Kr & un, e[4] = Jr ^ ~cn & bn, e[5] = Kr ^ ~un & _n, e[6] = cn ^ ~bn & Sr, e[7] = un ^ ~_n & Tr, e[8] = bn ^ ~Sr & Ur, e[9] = _n ^ ~Tr & Pr, e[10] = $r ^ ~Vr & Wr, e[11] = Rr ^ ~Fr & Hr, e[12] = Vr ^ ~Wr & nn, e[13] = Fr ^ ~Hr & sn, e[14] = Wr ^ ~nn & gn, e[15] = Hr ^ ~sn & yn, e[16] = nn ^ ~gn & $r, e[17] = sn ^ ~yn & Rr, e[18] = gn ^ ~$r & Vr, e[19] = yn ^ ~Rr & Fr, e[20] = Ar ^ ~Zr & Yr, e[21] = Or ^ ~Br & Qr, e[22] = Zr ^ ~Yr & ln, e[23] = Br ^ ~Qr & dn, e[24] = Yr ^ ~ln & fn, e[25] = Qr ^ ~dn & hn, e[26] = ln ^ ~fn & Ar, e[27] = dn ^ ~hn & Or, e[28] = fn ^ ~Ar & Zr, e[29] = hn ^ ~Or & Br, e[30] = Cr ^ ~jr & qr, e[31] = Nr ^ ~Dr & Gr, e[32] = jr ^ ~qr & an, e[33] = Dr ^ ~Gr & on, e[34] = qr ^ ~an & vn, e[35] = Gr ^ ~on & wn, e[36] = an ^ ~vn & Cr, e[37] = on ^ ~wn & Nr, e[38] = vn ^ ~Cr & jr, e[39] = wn ^ ~Nr & Dr, e[40] = Ir ^ ~Lr & Xr, e[41] = Mr ^ ~zr & en, e[42] = Lr ^ ~Xr & tn, e[43] = zr ^ ~en & rn, e[44] = Xr ^ ~tn & pn, e[45] = en ^ ~rn & mn, e[46] = tn ^ ~pn & Ir, e[47] = rn ^ ~mn & Mr, e[48] = pn ^ ~Ir & Lr, e[49] = mn ^ ~Mr & zr, e[0] ^= Ns[t * 2], e[1] ^= Ns[t * 2 + 1];
|
|
2086
2086
|
}
|
|
2087
2087
|
}
|
|
2088
|
-
function
|
|
2088
|
+
function js(e) {
|
|
2089
2089
|
const t = [];
|
|
2090
2090
|
for (let n = 0; n < e.length; n += 4) t.push(e[n] | e[n + 1] << 8 | e[n + 2] << 16 | e[n + 3] << 24);
|
|
2091
2091
|
return t;
|
|
2092
2092
|
}
|
|
2093
|
-
function
|
|
2093
|
+
function Ds(e, t) {
|
|
2094
2094
|
if (!e.length) {
|
|
2095
2095
|
const o = new Uint8Array(136);
|
|
2096
|
-
return o[0] = t, o[135] = 128, [
|
|
2096
|
+
return o[0] = t, o[135] = 128, [js(o)];
|
|
2097
2097
|
}
|
|
2098
2098
|
const n = wr(e, 136), s = n[n.length - 1];
|
|
2099
2099
|
if (s.length < 136) {
|
|
@@ -2104,16 +2104,16 @@ var di = {};
|
|
|
2104
2104
|
const o = new Uint8Array(136);
|
|
2105
2105
|
o[0] = t, o[135] = 128, n.push(o);
|
|
2106
2106
|
}
|
|
2107
|
-
return n.map(
|
|
2107
|
+
return n.map(js);
|
|
2108
2108
|
}
|
|
2109
|
-
function
|
|
2109
|
+
function Us(e, t) {
|
|
2110
2110
|
for (const n of t) {
|
|
2111
2111
|
for (let s = 0; s < 34; s += 2) e[s] ^= n[s + 1], e[s + 1] ^= n[s];
|
|
2112
2112
|
qu(e);
|
|
2113
2113
|
}
|
|
2114
2114
|
return e;
|
|
2115
2115
|
}
|
|
2116
|
-
function
|
|
2116
|
+
function Ps(e) {
|
|
2117
2117
|
return new Uint8Array([
|
|
2118
2118
|
e[1],
|
|
2119
2119
|
e[1] >> -24,
|
|
@@ -2150,16 +2150,16 @@ var di = {};
|
|
|
2150
2150
|
]);
|
|
2151
2151
|
}
|
|
2152
2152
|
function se(e) {
|
|
2153
|
-
return
|
|
2153
|
+
return Ps(Us(new Array(50).fill(0), Ds(e, 1)));
|
|
2154
2154
|
}
|
|
2155
2155
|
function Gu(e) {
|
|
2156
|
-
return
|
|
2156
|
+
return Ps(Us(new Array(50).fill(0), Ds(e, 6)));
|
|
2157
2157
|
}
|
|
2158
2158
|
function Ju(e, t, n) {
|
|
2159
2159
|
const s = Math.min(e.length, t.length, n / 8 + 1);
|
|
2160
2160
|
for (let o = 0; o < s; o++) {
|
|
2161
2161
|
const d = e[o] ^ t[o];
|
|
2162
|
-
for (let
|
|
2162
|
+
for (let p = 0; p < 8; p++) if (d >> 7 - p & 1) return o * 8 + p;
|
|
2163
2163
|
}
|
|
2164
2164
|
return n;
|
|
2165
2165
|
}
|
|
@@ -2181,23 +2181,23 @@ var di = {};
|
|
|
2181
2181
|
for (let o = 0; o < t.length && e[s + o] === t[o]; o++) if (o === t.length - 1) return s;
|
|
2182
2182
|
return -1;
|
|
2183
2183
|
}
|
|
2184
|
-
function
|
|
2184
|
+
function Zs(e, t, n = 0) {
|
|
2185
2185
|
if (e.length >= t) return e;
|
|
2186
2186
|
const s = new Uint8Array(t);
|
|
2187
2187
|
return s.fill(n), s.set(e, t - e.length), s;
|
|
2188
2188
|
}
|
|
2189
2189
|
function el(e, t, n = 0) {
|
|
2190
2190
|
const s = e.length % t;
|
|
2191
|
-
return s === 0 ? e :
|
|
2191
|
+
return s === 0 ? e : Zs(e, e.length + t - s, n);
|
|
2192
2192
|
}
|
|
2193
|
-
function
|
|
2193
|
+
function Bs(e, t, n = 0) {
|
|
2194
2194
|
if (e.length >= t) return e;
|
|
2195
2195
|
const s = new Uint8Array(t);
|
|
2196
2196
|
return s.fill(n), s.set(e, 0), s;
|
|
2197
2197
|
}
|
|
2198
2198
|
function tl(e, t, n = 0) {
|
|
2199
2199
|
const s = e.length % t;
|
|
2200
|
-
return s === 0 ? e :
|
|
2200
|
+
return s === 0 ? e : Bs(e, e.length + t - s, n);
|
|
2201
2201
|
}
|
|
2202
2202
|
function rl(e, t) {
|
|
2203
2203
|
const n = new Uint8Array(e.length);
|
|
@@ -2216,8 +2216,8 @@ var di = {};
|
|
|
2216
2216
|
e = $(e, t);
|
|
2217
2217
|
let [n, s] = [0n, 1n], [o, d] = [t, e];
|
|
2218
2218
|
for (; d !== 0n; ) {
|
|
2219
|
-
const
|
|
2220
|
-
[n, s] = [s, n -
|
|
2219
|
+
const p = o / d;
|
|
2220
|
+
[n, s] = [s, n - p * s], [o, d] = [d, o - p * d];
|
|
2221
2221
|
}
|
|
2222
2222
|
if (o > 1n) throw new Error("a is not invertible");
|
|
2223
2223
|
return n < 0n && (n += t), n;
|
|
@@ -2227,26 +2227,26 @@ var di = {};
|
|
|
2227
2227
|
for (e = $(e, n); t > 0; ) t % 2n === 1n && (s = $(s * e, n)), e = $(e * e, n), t = t / 2n;
|
|
2228
2228
|
return s;
|
|
2229
2229
|
}
|
|
2230
|
-
function
|
|
2230
|
+
function Ls(e, t) {
|
|
2231
2231
|
return $(e, t) === 0n ? 0n : t % 4n === 3n ? sl(e, (t + 1n) / 4n, t) : null;
|
|
2232
2232
|
}
|
|
2233
|
-
const Z = 0xfffffffffffffffffffffffffffffffffffffffffffffffffffffffefffffc2fn, D = 0xfffffffffffffffffffffffffffffffebaaedce6af48a03bbfd25e8cd0364141n,
|
|
2233
|
+
const Z = 0xfffffffffffffffffffffffffffffffffffffffffffffffffffffffefffffc2fn, D = 0xfffffffffffffffffffffffffffffffebaaedce6af48a03bbfd25e8cd0364141n, Dt = 0x79be667ef9dcbbac55a06295ce870b07029bfcdb2dce28d959f2815b16f81798n, Ut = 0x483ada7726a3c4655da4fbfc0e1108a8fd17b448a68554199c47d08ffb10d4b8n;
|
|
2234
2234
|
function br(e, t, n) {
|
|
2235
2235
|
if (t === 0n) return [0n, 0n];
|
|
2236
2236
|
const s = $(3n * e * e * Ye(2n * t, n), n), o = $(s * s - 2n * e, n), d = $(s * (e - o) - t, n);
|
|
2237
2237
|
return [o, d];
|
|
2238
2238
|
}
|
|
2239
|
-
function
|
|
2239
|
+
function Pt(e, t, n, s, o) {
|
|
2240
2240
|
if (e === 0n && t === 0n) return [n, s];
|
|
2241
2241
|
if (n === 0n && s === 0n) return [e, t];
|
|
2242
2242
|
if (e === n && t === $(-s, o)) return [0n, 0n];
|
|
2243
2243
|
if (e === n && t === s) return br(e, t, o);
|
|
2244
|
-
const d = $((s - t) * Ye(n - e, o), o),
|
|
2245
|
-
return [
|
|
2244
|
+
const d = $((s - t) * Ye(n - e, o), o), p = $(d * d - e - n, o), v = $(d * (e - p) - t, o);
|
|
2245
|
+
return [p, v];
|
|
2246
2246
|
}
|
|
2247
2247
|
function il(e) {
|
|
2248
2248
|
if (e <= 0n || e >= D) throw new Error("Invalid private key");
|
|
2249
|
-
return xe(
|
|
2249
|
+
return xe(Dt, Ut, e, Z);
|
|
2250
2250
|
}
|
|
2251
2251
|
function al(e) {
|
|
2252
2252
|
const t = e[1] % 2n === 0n ? 2 : 3;
|
|
@@ -2254,7 +2254,7 @@ var di = {};
|
|
|
2254
2254
|
}
|
|
2255
2255
|
function ol(e) {
|
|
2256
2256
|
if (e.length !== 33 || e[0] !== 2 && e[0] !== 3) throw new Error("Invalid compressed public key");
|
|
2257
|
-
const t = Ne(e.slice(1), "BE"), n =
|
|
2257
|
+
const t = Ne(e.slice(1), "BE"), n = Ls($(t ** 3n + 7n, Z), Z);
|
|
2258
2258
|
if (!n) throw Error("Invalid x: does not correspond to a valid curve point");
|
|
2259
2259
|
const s = $(-n, Z), o = n % 2n === 0n;
|
|
2260
2260
|
return [t, e[0] === 2 ? o ? n : s : o ? s : n];
|
|
@@ -2271,15 +2271,15 @@ var di = {};
|
|
|
2271
2271
|
}
|
|
2272
2272
|
function xe(e, t, n, s) {
|
|
2273
2273
|
let o = [0n, 0n], d = [e, t];
|
|
2274
|
-
const
|
|
2275
|
-
for (const v of
|
|
2276
|
-
v === "0" ? (d =
|
|
2274
|
+
const p = n.toString(2);
|
|
2275
|
+
for (const v of p)
|
|
2276
|
+
v === "0" ? (d = Pt(o[0], o[1], d[0], d[1], s), o = br(o[0], o[1], s)) : (o = Pt(o[0], o[1], d[0], d[1], s), d = br(d[0], d[1], s));
|
|
2277
2277
|
return o;
|
|
2278
2278
|
}
|
|
2279
2279
|
function ll(e, t, n) {
|
|
2280
|
-
return
|
|
2280
|
+
return zs(Ne(se(e), "BE"), t, n);
|
|
2281
2281
|
}
|
|
2282
|
-
function
|
|
2282
|
+
function zs(e, t, n) {
|
|
2283
2283
|
if (t <= 0n || t >= D) throw new Error("Invalid private key");
|
|
2284
2284
|
if (n || (n = $(
|
|
2285
2285
|
Ne(
|
|
@@ -2289,23 +2289,23 @@ var di = {};
|
|
|
2289
2289
|
D
|
|
2290
2290
|
)), n <= 0n || n >= D)
|
|
2291
2291
|
throw new Error("Invalid nonce");
|
|
2292
|
-
const s = $(e, D), o = xe(
|
|
2293
|
-
let
|
|
2294
|
-
if (d === 0n ||
|
|
2292
|
+
const s = $(e, D), o = xe(Dt, Ut, n, Z), d = $(o[0], D);
|
|
2293
|
+
let p = $((s + $(d, D) * t) * Ye(n, D), D);
|
|
2294
|
+
if (d === 0n || p === 0n) throw new Error("Invalid r or s value");
|
|
2295
2295
|
let v = o[1] % 2n === 0n ? 27n : 28n;
|
|
2296
|
-
return
|
|
2296
|
+
return p > D / 2n && (p = D - p, v = v === 27n ? 28n : 27n), [d, p, v];
|
|
2297
2297
|
}
|
|
2298
2298
|
function dl(e, t, n, s) {
|
|
2299
|
-
const o =
|
|
2299
|
+
const o = Ls($(t ** 3n + 7n, Z), Z);
|
|
2300
2300
|
if (!o) throw new Error("Invalid r: does not correspond to a valid curve point");
|
|
2301
|
-
const d = s === 27n ? 0n : 1n,
|
|
2301
|
+
const d = s === 27n ? 0n : 1n, p = o % 2n === d ? o : Z - o, v = $(Ne(se(e), "BE"), D), m = xe(t, p, n, Z), k = xe(Dt, Ut, v, Z), M = Pt(m[0], m[1], k[0], $(-k[1], Z), Z);
|
|
2302
2302
|
return xe(M[0], M[1], Ye(t, D), Z);
|
|
2303
2303
|
}
|
|
2304
2304
|
function fl(e, t, n, s) {
|
|
2305
|
-
const o = $(Ne(se(e), "BE"), D), d = Ye(s, D),
|
|
2305
|
+
const o = $(Ne(se(e), "BE"), D), d = Ye(s, D), p = $(o * d, D), v = $(n * d, D), m = xe(Dt, Ut, p, Z), k = xe(t[0], t[1], v, Z), M = Pt(m[0], m[1], k[0], k[1], Z);
|
|
2306
2306
|
return n === $(M[0], D);
|
|
2307
2307
|
}
|
|
2308
|
-
class
|
|
2308
|
+
class Vs {
|
|
2309
2309
|
constructor(t) {
|
|
2310
2310
|
this.cursor = 0, this.buffer = t;
|
|
2311
2311
|
}
|
|
@@ -2317,8 +2317,8 @@ var di = {};
|
|
|
2317
2317
|
return this.buffer.length - this.cursor;
|
|
2318
2318
|
}
|
|
2319
2319
|
}
|
|
2320
|
-
a.Uint8ArrayReader =
|
|
2321
|
-
class
|
|
2320
|
+
a.Uint8ArrayReader = Vs;
|
|
2321
|
+
class Fs {
|
|
2322
2322
|
constructor(t) {
|
|
2323
2323
|
this.buffer = t, this.cursor = 0;
|
|
2324
2324
|
}
|
|
@@ -2330,30 +2330,30 @@ var di = {};
|
|
|
2330
2330
|
return this.buffer.length - this.cursor;
|
|
2331
2331
|
}
|
|
2332
2332
|
}
|
|
2333
|
-
a.Uint8ArrayWriter =
|
|
2334
|
-
class
|
|
2333
|
+
a.Uint8ArrayWriter = Fs;
|
|
2334
|
+
class Zt {
|
|
2335
2335
|
constructor(t, n = 0n) {
|
|
2336
|
-
this.span = n, this.writer = new
|
|
2336
|
+
this.span = n, this.writer = new Fs(new Uint8Array(t));
|
|
2337
2337
|
}
|
|
2338
2338
|
build() {
|
|
2339
2339
|
return Re(vr(this.span, "LE"), this.writer.buffer);
|
|
2340
2340
|
}
|
|
2341
2341
|
hash() {
|
|
2342
|
-
const t =
|
|
2342
|
+
const t = Ms(wr(this.writer.buffer, 32), (n, s) => se(Re(n, s)));
|
|
2343
2343
|
return se(Re(vr(this.span, "LE"), t));
|
|
2344
2344
|
}
|
|
2345
2345
|
}
|
|
2346
|
-
a.Chunk =
|
|
2346
|
+
a.Chunk = Zt;
|
|
2347
2347
|
class _r {
|
|
2348
2348
|
constructor(t, n = 4096) {
|
|
2349
|
-
this.counters = [1], this.capacity = n, this.chunks = [new
|
|
2349
|
+
this.counters = [1], this.capacity = n, this.chunks = [new Zt(n)], this.onChunk = t;
|
|
2350
2350
|
}
|
|
2351
2351
|
static async root(t, n = 4096) {
|
|
2352
2352
|
const s = new r(r.NOOP, n);
|
|
2353
2353
|
return await s.append(t), s.finalize();
|
|
2354
2354
|
}
|
|
2355
2355
|
async append(t, n = 0, s = 0n) {
|
|
2356
|
-
const o = new
|
|
2356
|
+
const o = new Vs(t);
|
|
2357
2357
|
for (; o.max() > 0; ) {
|
|
2358
2358
|
this.chunks[n].writer.max() === 0 && await this.elevate(n);
|
|
2359
2359
|
const d = this.chunks[n].writer.write(o);
|
|
@@ -2361,7 +2361,7 @@ var di = {};
|
|
|
2361
2361
|
}
|
|
2362
2362
|
}
|
|
2363
2363
|
async elevate(t) {
|
|
2364
|
-
this.counters[t] = ++this.counters[t] % (this.capacity / 32), this.chunks[t + 1] || (this.chunks.push(new
|
|
2364
|
+
this.counters[t] = ++this.counters[t] % (this.capacity / 32), this.chunks[t + 1] || (this.chunks.push(new Zt(this.capacity)), this.counters.push(1)), await this.append(this.chunks[t].hash(), t + 1, this.chunks[t].span), await this.onChunk(this.chunks[t]), this.chunks[t] = new Zt(this.capacity);
|
|
2365
2365
|
}
|
|
2366
2366
|
async finalize(t = 0) {
|
|
2367
2367
|
return this.chunks[t + 1] ? this.counters[t] === 1 ? (await this.elevate(t + 1), this.chunks[t + 1] = this.chunks[t], this.finalize(t + 1)) : (await this.elevate(t), this.finalize(t + 1)) : (await this.onChunk(this.chunks[t]), this.chunks[t]);
|
|
@@ -2425,15 +2425,15 @@ var di = {};
|
|
|
2425
2425
|
const t = e[0];
|
|
2426
2426
|
return t.ttlMax ? --t.ttl <= 0 && e.shift() : t.ttlMax = t.ttl, { progress: (t.ttlMax - t.ttl) / t.ttlMax, data: t.data };
|
|
2427
2427
|
}
|
|
2428
|
-
function
|
|
2428
|
+
function Bt(e, t, n, s) {
|
|
2429
2429
|
const o = e.findIndex((v) => v === `--${t}` || v.startsWith(`--${t}=`)), d = e[o];
|
|
2430
2430
|
if (!d) return (n || {})[s || t || ""] || null;
|
|
2431
2431
|
if (d.includes("=")) return d.split("=")[1];
|
|
2432
|
-
const
|
|
2433
|
-
return
|
|
2432
|
+
const p = e[o + 1];
|
|
2433
|
+
return p && !p.startsWith("-") ? p : (n || {})[s || t || ""] || null;
|
|
2434
2434
|
}
|
|
2435
2435
|
function pl(e, t, n, s) {
|
|
2436
|
-
const o =
|
|
2436
|
+
const o = Bt(e, t, n, s);
|
|
2437
2437
|
if (!o) return null;
|
|
2438
2438
|
try {
|
|
2439
2439
|
return mr(o);
|
|
@@ -2442,36 +2442,36 @@ var di = {};
|
|
|
2442
2442
|
}
|
|
2443
2443
|
}
|
|
2444
2444
|
function ml(e, t, n, s) {
|
|
2445
|
-
const o = e.some((m) => m.endsWith("-" + t)), d =
|
|
2445
|
+
const o = e.some((m) => m.endsWith("-" + t)), d = Bt(e, t, n, s);
|
|
2446
2446
|
if (!d && o) return !0;
|
|
2447
2447
|
if (!d && !o) return null;
|
|
2448
|
-
const
|
|
2449
|
-
if (
|
|
2448
|
+
const p = ["true", "1", "yes", "y", "on"], v = ["false", "0", "no", "n", "off"];
|
|
2449
|
+
if (p.includes(d.toLowerCase())) return !0;
|
|
2450
2450
|
if (v.includes(d.toLowerCase())) return !1;
|
|
2451
2451
|
throw Error(`Invalid boolean argument ${t}: ${d}`);
|
|
2452
2452
|
}
|
|
2453
|
-
function
|
|
2454
|
-
const o =
|
|
2453
|
+
function Ws(e, t, n, s) {
|
|
2454
|
+
const o = Bt(e, t, n, s);
|
|
2455
2455
|
if (!o) throw new Error(`Missing argument ${t}`);
|
|
2456
2456
|
return o;
|
|
2457
2457
|
}
|
|
2458
2458
|
function gl(e, t, n, s) {
|
|
2459
|
-
const o =
|
|
2459
|
+
const o = Ws(e, t, n, s);
|
|
2460
2460
|
try {
|
|
2461
2461
|
return mr(o);
|
|
2462
2462
|
} catch {
|
|
2463
2463
|
throw new Error(`Invalid argument ${t}: ${o}`);
|
|
2464
2464
|
}
|
|
2465
2465
|
}
|
|
2466
|
-
function
|
|
2466
|
+
function Hs(e, t) {
|
|
2467
2467
|
const n = e[t];
|
|
2468
2468
|
e.splice(t, 1), e.unshift(n);
|
|
2469
2469
|
}
|
|
2470
2470
|
function yl(e, t) {
|
|
2471
2471
|
const n = [...e];
|
|
2472
|
-
return
|
|
2472
|
+
return Hs(n, t), n;
|
|
2473
2473
|
}
|
|
2474
|
-
function
|
|
2474
|
+
function qs(e, t) {
|
|
2475
2475
|
return { x: e.x + t.x, y: e.y + t.y };
|
|
2476
2476
|
}
|
|
2477
2477
|
function vl(e, t) {
|
|
@@ -2484,10 +2484,10 @@ var di = {};
|
|
|
2484
2484
|
const t = Math.sqrt(e.x * e.x + e.y * e.y);
|
|
2485
2485
|
return { x: e.x / t, y: e.y / t };
|
|
2486
2486
|
}
|
|
2487
|
-
function
|
|
2487
|
+
function Gs(e, t, n) {
|
|
2488
2488
|
return { x: e.x + Math.cos(t) * n, y: e.y + Math.sin(t) * n };
|
|
2489
2489
|
}
|
|
2490
|
-
function
|
|
2490
|
+
function Js(e, t) {
|
|
2491
2491
|
return Math.sqrt((e.x - t.x) ** 2 + (e.y - t.y) ** 2);
|
|
2492
2492
|
}
|
|
2493
2493
|
function Qe(e, t, n = "row-first") {
|
|
@@ -2505,24 +2505,24 @@ var di = {};
|
|
|
2505
2505
|
var s, o;
|
|
2506
2506
|
return e[t][n + 1] && e[t][n - 1] && !((s = e[t - 1]) != null && s[n]) && !((o = e[t + 1]) != null && o[n]);
|
|
2507
2507
|
}
|
|
2508
|
-
function
|
|
2508
|
+
function Ks(e, t, n) {
|
|
2509
2509
|
var s;
|
|
2510
2510
|
return !((s = e[t - 1]) != null && s[n]);
|
|
2511
2511
|
}
|
|
2512
|
-
function
|
|
2512
|
+
function Ys(e, t, n) {
|
|
2513
2513
|
var s;
|
|
2514
2514
|
return !((s = e[t + 1]) != null && s[n]);
|
|
2515
2515
|
}
|
|
2516
|
-
function
|
|
2516
|
+
function Qs(e, t, n) {
|
|
2517
2517
|
return !e[t][n - 1];
|
|
2518
2518
|
}
|
|
2519
|
-
function
|
|
2519
|
+
function Xs(e, t, n) {
|
|
2520
2520
|
return !e[t][n + 1];
|
|
2521
2521
|
}
|
|
2522
2522
|
function xl(e, t, n) {
|
|
2523
|
-
var o, d,
|
|
2523
|
+
var o, d, p, v, m, k, M, U;
|
|
2524
2524
|
const s = [];
|
|
2525
|
-
return e[t][n] ? bl(e, t, n) || _l(e, t, n) ? [] : (!((o = e[t - 1]) != null && o[n - 1]) &&
|
|
2525
|
+
return e[t][n] ? bl(e, t, n) || _l(e, t, n) ? [] : (!((o = e[t - 1]) != null && o[n - 1]) && Ks(e, t, n) && Qs(e, t, n) && s.push({ x: t, y: n }), !((d = e[t + 1]) != null && d[n - 1]) && Ys(e, t, n) && Qs(e, t, n) && s.push({ x: t + 1, y: n }), !((p = e[t - 1]) != null && p[n + 1]) && Ks(e, t, n) && Xs(e, t, n) && s.push({ x: t, y: n + 1 }), !((v = e[t + 1]) != null && v[n + 1]) && Ys(e, t, n) && Xs(e, t, n) && s.push({ x: t + 1, y: n + 1 }), s) : ((m = e[t - 1]) != null && m[n] && e[t][n - 1] && s.push({ x: t, y: n }), (k = e[t + 1]) != null && k[n] && e[t][n - 1] && s.push({ x: t + 1, y: n }), (M = e[t - 1]) != null && M[n] && e[t][n + 1] && s.push({ x: t, y: n + 1 }), (U = e[t + 1]) != null && U[n] && e[t][n + 1] && s.push({ x: t + 1, y: n + 1 }), s);
|
|
2526
2526
|
}
|
|
2527
2527
|
function kl(e, t, n, s) {
|
|
2528
2528
|
const o = [
|
|
@@ -2532,41 +2532,41 @@ var di = {};
|
|
|
2532
2532
|
{ x: n, y: s }
|
|
2533
2533
|
];
|
|
2534
2534
|
for (let d = 0; d < e.length; d++)
|
|
2535
|
-
for (let
|
|
2536
|
-
const v = xl(e, d,
|
|
2537
|
-
for (const m of v) o.some((
|
|
2535
|
+
for (let p = 0; p < e[0].length; p++) {
|
|
2536
|
+
const v = xl(e, d, p);
|
|
2537
|
+
for (const m of v) o.some((k) => k.x === m.x && k.y === m.y) || o.push(m);
|
|
2538
2538
|
}
|
|
2539
2539
|
return o.map((d) => ({ x: d.x * t, y: d.y * t }));
|
|
2540
2540
|
}
|
|
2541
2541
|
function El(e, t) {
|
|
2542
|
-
const n = Qe(e, (m,
|
|
2542
|
+
const n = Qe(e, (m, k) => e[m][k] === 0 && e[m][k + 1] !== 0, "row-first").map((m) => ({
|
|
2543
2543
|
...m,
|
|
2544
2544
|
dx: 1,
|
|
2545
2545
|
dy: 0
|
|
2546
|
-
})), s = Qe(e, (m,
|
|
2546
|
+
})), s = Qe(e, (m, k) => e[m][k] === 0 && e[m][k - 1] !== 0, "row-first").map((m) => ({
|
|
2547
2547
|
...m,
|
|
2548
2548
|
dx: 1,
|
|
2549
2549
|
dy: 0
|
|
2550
|
-
})), o = Qe(e, (m,
|
|
2550
|
+
})), o = Qe(e, (m, k) => {
|
|
2551
2551
|
var M;
|
|
2552
|
-
return e[m][
|
|
2552
|
+
return e[m][k] === 0 && ((M = e[m - 1]) == null ? void 0 : M[k]) !== 0;
|
|
2553
2553
|
}, "column-first").map((m) => ({
|
|
2554
2554
|
...m,
|
|
2555
2555
|
dx: 0,
|
|
2556
2556
|
dy: 1
|
|
2557
|
-
})), d = Qe(e, (m,
|
|
2557
|
+
})), d = Qe(e, (m, k) => {
|
|
2558
2558
|
var M;
|
|
2559
|
-
return e[m][
|
|
2559
|
+
return e[m][k] === 0 && ((M = e[m + 1]) == null ? void 0 : M[k]) !== 0;
|
|
2560
2560
|
}, "column-first").map((m) => ({
|
|
2561
2561
|
...m,
|
|
2562
2562
|
dx: 0,
|
|
2563
2563
|
dy: 1
|
|
2564
2564
|
}));
|
|
2565
2565
|
n.forEach((m) => m.y++), d.forEach((m) => m.x++);
|
|
2566
|
-
const
|
|
2567
|
-
return [...
|
|
2566
|
+
const p = yr([...o, ...d], (m, k) => m.x === k.x && m.y - 1 === k.y), v = yr([...s, ...n], (m, k) => m.y === k.y && m.x - 1 === k.x);
|
|
2567
|
+
return [...p, ...v].map((m) => ({ start: m[0], end: qe(m) })).map((m) => ({
|
|
2568
2568
|
start: xr(m.start, t),
|
|
2569
|
-
end: xr(
|
|
2569
|
+
end: xr(qs(m.end, { x: m.start.dx, y: m.start.dy }), t)
|
|
2570
2570
|
}));
|
|
2571
2571
|
}
|
|
2572
2572
|
function Sl(e, t) {
|
|
@@ -2575,29 +2575,29 @@ var di = {};
|
|
|
2575
2575
|
function Tl(e, t) {
|
|
2576
2576
|
return t.map((n) => Sl(e, n)).sort((n, s) => n - s);
|
|
2577
2577
|
}
|
|
2578
|
-
function
|
|
2578
|
+
function ei(e, t, n, s) {
|
|
2579
2579
|
const o = (s.y - n.y) * (t.x - e.x) - (s.x - n.x) * (t.y - e.y);
|
|
2580
2580
|
if (o === 0) return null;
|
|
2581
|
-
let d = e.y - n.y,
|
|
2582
|
-
const v = (s.x - n.x) * d - (s.y - n.y) *
|
|
2583
|
-
return d = v / o,
|
|
2581
|
+
let d = e.y - n.y, p = e.x - n.x;
|
|
2582
|
+
const v = (s.x - n.x) * d - (s.y - n.y) * p, m = (t.x - e.x) * d - (t.y - e.y) * p;
|
|
2583
|
+
return d = v / o, p = m / o, d > 0 && d < 1 && p > 0 && p < 1 ? { x: e.x + d * (t.x - e.x), y: e.y + d * (t.y - e.y) } : null;
|
|
2584
2584
|
}
|
|
2585
2585
|
function kr(e, t, n) {
|
|
2586
|
-
const s = [], o =
|
|
2586
|
+
const s = [], o = Gs(e, n, 1e4);
|
|
2587
2587
|
for (const d of t) {
|
|
2588
|
-
const
|
|
2589
|
-
|
|
2588
|
+
const p = ei(e, o, d.start, d.end);
|
|
2589
|
+
p && s.push(p);
|
|
2590
2590
|
}
|
|
2591
|
-
return s.length ? s.reduce((d,
|
|
2592
|
-
const v =
|
|
2593
|
-
return v < m ?
|
|
2591
|
+
return s.length ? s.reduce((d, p) => {
|
|
2592
|
+
const v = Js(e, p), m = Js(e, d);
|
|
2593
|
+
return v < m ? p : d;
|
|
2594
2594
|
}) : null;
|
|
2595
2595
|
}
|
|
2596
2596
|
function Al(e, t, n) {
|
|
2597
2597
|
const s = Tl(e, n), o = [];
|
|
2598
2598
|
for (const d of s) {
|
|
2599
|
-
const
|
|
2600
|
-
|
|
2599
|
+
const p = kr(e, t, d - 1e-3), v = kr(e, t, d + 1e-3);
|
|
2600
|
+
p && o.push(p), v && o.push(v);
|
|
2601
2601
|
}
|
|
2602
2602
|
return o;
|
|
2603
2603
|
}
|
|
@@ -2658,7 +2658,7 @@ var di = {};
|
|
|
2658
2658
|
uint8ArrayToBase64: Mo,
|
|
2659
2659
|
base32ToUint8Array: $o,
|
|
2660
2660
|
uint8ArrayToBase32: Ro,
|
|
2661
|
-
log2Reduce:
|
|
2661
|
+
log2Reduce: Ms,
|
|
2662
2662
|
partition: wr,
|
|
2663
2663
|
concatBytes: Re,
|
|
2664
2664
|
numberToUint8: Zu,
|
|
@@ -2680,9 +2680,9 @@ var di = {};
|
|
|
2680
2680
|
getBit: Qu,
|
|
2681
2681
|
indexOf: Xu,
|
|
2682
2682
|
equals: nl,
|
|
2683
|
-
padStart:
|
|
2683
|
+
padStart: Zs,
|
|
2684
2684
|
padStartToMultiple: el,
|
|
2685
|
-
padEnd:
|
|
2685
|
+
padEnd: Bs,
|
|
2686
2686
|
padEndToMultiple: tl,
|
|
2687
2687
|
xorCypher: rl
|
|
2688
2688
|
}, a.Elliptic = {
|
|
@@ -2691,14 +2691,14 @@ var di = {};
|
|
|
2691
2691
|
publicKeyFromCompressed: ol,
|
|
2692
2692
|
publicKeyToAddress: cl,
|
|
2693
2693
|
signMessage: ll,
|
|
2694
|
-
signHash:
|
|
2694
|
+
signHash: zs,
|
|
2695
2695
|
verifySignature: fl,
|
|
2696
2696
|
recoverPublicKey: dl,
|
|
2697
2697
|
checksumEncode: ul
|
|
2698
2698
|
}, a.Random = {
|
|
2699
2699
|
intBetween: He,
|
|
2700
|
-
floatBetween:
|
|
2701
|
-
chance:
|
|
2700
|
+
floatBetween: Cn,
|
|
2701
|
+
chance: Nn,
|
|
2702
2702
|
signed: Ti,
|
|
2703
2703
|
makeSeededRng: Kt,
|
|
2704
2704
|
point: Oi,
|
|
@@ -2707,20 +2707,20 @@ var di = {};
|
|
|
2707
2707
|
countUnique: wu,
|
|
2708
2708
|
makeUnique: vu,
|
|
2709
2709
|
splitBySize: gu,
|
|
2710
|
-
splitByCount:
|
|
2711
|
-
index:
|
|
2710
|
+
splitByCount: Ts,
|
|
2711
|
+
index: Ss,
|
|
2712
2712
|
indexCollection: mu,
|
|
2713
|
-
onlyOrThrow:
|
|
2713
|
+
onlyOrThrow: h,
|
|
2714
2714
|
onlyOrNull: g,
|
|
2715
|
-
firstOrThrow:
|
|
2715
|
+
firstOrThrow: x,
|
|
2716
2716
|
firstOrNull: y,
|
|
2717
2717
|
shuffle: f,
|
|
2718
2718
|
initialize: N,
|
|
2719
2719
|
initialize2D: ne,
|
|
2720
2720
|
rotate2D: re,
|
|
2721
|
-
containsShape:
|
|
2721
|
+
containsShape: Fe,
|
|
2722
2722
|
glue: Ua,
|
|
2723
|
-
pluck:
|
|
2723
|
+
pluck: We,
|
|
2724
2724
|
pick: Yt,
|
|
2725
2725
|
pickMany: Mi,
|
|
2726
2726
|
pickManyUnique: $i,
|
|
@@ -2728,10 +2728,10 @@ var di = {};
|
|
|
2728
2728
|
pickRandomIndices: Oe,
|
|
2729
2729
|
pickGuaranteed: Ri,
|
|
2730
2730
|
last: qe,
|
|
2731
|
-
pipe:
|
|
2731
|
+
pipe: jn,
|
|
2732
2732
|
makePipe: Ci,
|
|
2733
2733
|
sortWeighted: ji,
|
|
2734
|
-
pushAll:
|
|
2734
|
+
pushAll: Mt,
|
|
2735
2735
|
unshiftAll: ja,
|
|
2736
2736
|
filterAndRemove: nc,
|
|
2737
2737
|
merge: Qc,
|
|
@@ -2743,13 +2743,13 @@ var di = {};
|
|
|
2743
2743
|
createOscillator: Zc,
|
|
2744
2744
|
organiseWithLimits: Lc,
|
|
2745
2745
|
tickPlaybook: hl,
|
|
2746
|
-
getArgument:
|
|
2746
|
+
getArgument: Bt,
|
|
2747
2747
|
getBooleanArgument: ml,
|
|
2748
2748
|
getNumberArgument: pl,
|
|
2749
|
-
requireStringArgument:
|
|
2749
|
+
requireStringArgument: Ws,
|
|
2750
2750
|
requireNumberArgument: gl,
|
|
2751
2751
|
bringToFront: yl,
|
|
2752
|
-
bringToFrontInPlace:
|
|
2752
|
+
bringToFrontInPlace: Hs,
|
|
2753
2753
|
findInstance: Ru,
|
|
2754
2754
|
filterInstances: Cu,
|
|
2755
2755
|
interleave: Nu,
|
|
@@ -2764,7 +2764,7 @@ var di = {};
|
|
|
2764
2764
|
median: Ga,
|
|
2765
2765
|
getDistanceFromMidpoint: Ja,
|
|
2766
2766
|
clamp: gr,
|
|
2767
|
-
range:
|
|
2767
|
+
range: Gn,
|
|
2768
2768
|
interpolate: Wa,
|
|
2769
2769
|
createSequence: Pc,
|
|
2770
2770
|
increment: Gc,
|
|
@@ -2777,13 +2777,13 @@ var di = {};
|
|
|
2777
2777
|
hexToRgb: Wi,
|
|
2778
2778
|
rgbToHex: Hi,
|
|
2779
2779
|
haversineDistanceToMeters: qi,
|
|
2780
|
-
roundToNearest:
|
|
2780
|
+
roundToNearest: Tt,
|
|
2781
2781
|
formatDistance: Gi,
|
|
2782
2782
|
triangularNumber: Ji,
|
|
2783
2783
|
searchFloat: Ki
|
|
2784
2784
|
}, a.Promises = { raceFulfilled: c, invert: i, runInParallelBatches: u }, a.Dates = {
|
|
2785
2785
|
getTimestamp: fc,
|
|
2786
|
-
getTimeDelta:
|
|
2786
|
+
getTimeDelta: gs,
|
|
2787
2787
|
secondsToHumanTime: hc,
|
|
2788
2788
|
countCycles: pc,
|
|
2789
2789
|
isoDate: ac,
|
|
@@ -2794,10 +2794,10 @@ var di = {};
|
|
|
2794
2794
|
fromUtcString: cc,
|
|
2795
2795
|
fromMillis: uc,
|
|
2796
2796
|
getProgress: vc,
|
|
2797
|
-
humanizeTime:
|
|
2797
|
+
humanizeTime: Nt,
|
|
2798
2798
|
humanizeProgress: tc,
|
|
2799
2799
|
createTimeDigits: K,
|
|
2800
|
-
mapDayNumber:
|
|
2800
|
+
mapDayNumber: ys,
|
|
2801
2801
|
getDayInfoFromDate: hr,
|
|
2802
2802
|
getDayInfoFromDateTimeString: bc,
|
|
2803
2803
|
seconds: _c,
|
|
@@ -2821,21 +2821,21 @@ var di = {};
|
|
|
2821
2821
|
deepMerge3: Ma,
|
|
2822
2822
|
mapAllAsync: Da,
|
|
2823
2823
|
cloneWithJson: sc,
|
|
2824
|
-
sortObject:
|
|
2825
|
-
sortArray:
|
|
2824
|
+
sortObject: ws,
|
|
2825
|
+
sortArray: bs,
|
|
2826
2826
|
sortAny: _e,
|
|
2827
|
-
deepEquals:
|
|
2827
|
+
deepEquals: _s,
|
|
2828
2828
|
deepEqualsEvery: Dc,
|
|
2829
2829
|
runOn: Kc,
|
|
2830
2830
|
ifPresent: Yc,
|
|
2831
|
-
zip:
|
|
2831
|
+
zip: qn,
|
|
2832
2832
|
zipSum: $a,
|
|
2833
2833
|
removeEmptyArrays: eu,
|
|
2834
2834
|
removeEmptyValues: tu,
|
|
2835
2835
|
flatten: hu,
|
|
2836
|
-
unflatten:
|
|
2836
|
+
unflatten: Es,
|
|
2837
2837
|
match: pu,
|
|
2838
|
-
sort:
|
|
2838
|
+
sort: Os,
|
|
2839
2839
|
map: su,
|
|
2840
2840
|
mapIterable: iu,
|
|
2841
2841
|
filterKeys: ru,
|
|
@@ -2851,16 +2851,16 @@ var di = {};
|
|
|
2851
2851
|
incrementMulti: _u,
|
|
2852
2852
|
createBidirectionalMap: ku,
|
|
2853
2853
|
createTemporalBidirectionalMap: Eu,
|
|
2854
|
-
pushToBidirectionalMap:
|
|
2854
|
+
pushToBidirectionalMap: Is,
|
|
2855
2855
|
unshiftToBidirectionalMap: Su,
|
|
2856
2856
|
addToTemporalBidirectionalMap: Tu,
|
|
2857
2857
|
getFromTemporalBidirectionalMap: Au,
|
|
2858
2858
|
createStatefulToggle: Bc,
|
|
2859
2859
|
diffKeys: zc,
|
|
2860
|
-
pickRandomKey:
|
|
2860
|
+
pickRandomKey: xs,
|
|
2861
2861
|
mapRandomKey: Vc,
|
|
2862
2862
|
fromObjectString: Fc,
|
|
2863
|
-
toQueryString:
|
|
2863
|
+
toQueryString: ps,
|
|
2864
2864
|
parseQueryString: qo,
|
|
2865
2865
|
hasKey: Go,
|
|
2866
2866
|
selectMax: Jo,
|
|
@@ -2871,24 +2871,24 @@ var di = {};
|
|
|
2871
2871
|
isFunction: Xt,
|
|
2872
2872
|
isObject: ce,
|
|
2873
2873
|
isStrictlyObject: Ie,
|
|
2874
|
-
isEmptyArray:
|
|
2874
|
+
isEmptyArray: Dn,
|
|
2875
2875
|
isEmptyObject: Yi,
|
|
2876
2876
|
isUndefined: Qt,
|
|
2877
2877
|
isString: F,
|
|
2878
2878
|
isNumber: ue,
|
|
2879
|
-
isBoolean:
|
|
2879
|
+
isBoolean: Un,
|
|
2880
2880
|
isDate: Me,
|
|
2881
|
-
isBlank:
|
|
2881
|
+
isBlank: At,
|
|
2882
2882
|
isId: er,
|
|
2883
|
-
isIntegerString:
|
|
2884
|
-
isHexString:
|
|
2885
|
-
isUrl:
|
|
2883
|
+
isIntegerString: Pn,
|
|
2884
|
+
isHexString: Zn,
|
|
2885
|
+
isUrl: Wn,
|
|
2886
2886
|
isNullable: Ea,
|
|
2887
|
-
asString:
|
|
2887
|
+
asString: Vn,
|
|
2888
2888
|
asHexString: la,
|
|
2889
2889
|
asSafeString: da,
|
|
2890
2890
|
asIntegerString: ua,
|
|
2891
|
-
asNumber:
|
|
2891
|
+
asNumber: Ot,
|
|
2892
2892
|
asFunction: fa,
|
|
2893
2893
|
asInteger: nr,
|
|
2894
2894
|
asBoolean: ha,
|
|
@@ -2898,22 +2898,22 @@ var di = {};
|
|
|
2898
2898
|
asId: ya,
|
|
2899
2899
|
asTime: va,
|
|
2900
2900
|
asArray: wa,
|
|
2901
|
-
asObject:
|
|
2901
|
+
asObject: It,
|
|
2902
2902
|
asNullableObject: ba,
|
|
2903
2903
|
asStringMap: _a,
|
|
2904
2904
|
asNumericDictionary: xa,
|
|
2905
2905
|
asUrl: ka,
|
|
2906
2906
|
asNullable: Sa,
|
|
2907
2907
|
asOptional: Ta,
|
|
2908
|
-
enforceObjectShape:
|
|
2908
|
+
enforceObjectShape: Hn,
|
|
2909
2909
|
enforceArrayShape: Aa,
|
|
2910
|
-
isPng:
|
|
2911
|
-
isJpg:
|
|
2912
|
-
isWebp:
|
|
2910
|
+
isPng: $s,
|
|
2911
|
+
isJpg: Rs,
|
|
2912
|
+
isWebp: Cs,
|
|
2913
2913
|
isImage: Pu
|
|
2914
2914
|
}, a.Strings = {
|
|
2915
2915
|
tokenizeByCount: yu,
|
|
2916
|
-
tokenizeByLength:
|
|
2916
|
+
tokenizeByLength: As,
|
|
2917
2917
|
searchHex: aa,
|
|
2918
2918
|
searchSubstring: oa,
|
|
2919
2919
|
randomHex: ca,
|
|
@@ -2928,24 +2928,24 @@ var di = {};
|
|
|
2928
2928
|
escapeHtml: ao,
|
|
2929
2929
|
decodeHtmlEntities: co,
|
|
2930
2930
|
after: ir,
|
|
2931
|
-
afterLast:
|
|
2932
|
-
before:
|
|
2931
|
+
afterLast: Kn,
|
|
2932
|
+
before: Jn,
|
|
2933
2933
|
beforeLast: ar,
|
|
2934
2934
|
betweenWide: uo,
|
|
2935
2935
|
betweenNarrow: lo,
|
|
2936
2936
|
getPreLine: Ic,
|
|
2937
2937
|
containsWord: dr,
|
|
2938
2938
|
containsWords: Vo,
|
|
2939
|
-
joinUrl:
|
|
2940
|
-
getFuzzyMatchScore:
|
|
2939
|
+
joinUrl: vs,
|
|
2940
|
+
getFuzzyMatchScore: $t,
|
|
2941
2941
|
sortByFuzzyScore: io,
|
|
2942
2942
|
splitOnce: or,
|
|
2943
|
-
splitAll:
|
|
2943
|
+
splitAll: Yn,
|
|
2944
2944
|
randomize: mo,
|
|
2945
|
-
expand:
|
|
2945
|
+
expand: Qn,
|
|
2946
2946
|
shrinkTrim: Je,
|
|
2947
|
-
capitalize:
|
|
2948
|
-
decapitalize:
|
|
2947
|
+
capitalize: Rt,
|
|
2948
|
+
decapitalize: Xn,
|
|
2949
2949
|
csvEscape: _o,
|
|
2950
2950
|
parseCsv: ec,
|
|
2951
2951
|
surroundInOut: no,
|
|
@@ -2958,24 +2958,24 @@ var di = {};
|
|
|
2958
2958
|
slugToTitle: eo,
|
|
2959
2959
|
slugToCamel: to,
|
|
2960
2960
|
joinHumanly: ro,
|
|
2961
|
-
findWeightedPair:
|
|
2962
|
-
extractBlock:
|
|
2961
|
+
findWeightedPair: is,
|
|
2962
|
+
extractBlock: as,
|
|
2963
2963
|
extractAllBlocks: Eo,
|
|
2964
2964
|
replaceBlocks: So,
|
|
2965
2965
|
indexOfEarliest: $e,
|
|
2966
|
-
lastIndexOfBefore:
|
|
2966
|
+
lastIndexOfBefore: ss,
|
|
2967
2967
|
parseHtmlAttributes: Fo,
|
|
2968
|
-
readNextWord:
|
|
2968
|
+
readNextWord: Ct,
|
|
2969
2969
|
resolveVariables: Wo,
|
|
2970
|
-
resolveVariableWithDefaultSyntax:
|
|
2971
|
-
resolveRemainingVariablesWithDefaults:
|
|
2972
|
-
isLetter:
|
|
2973
|
-
isDigit:
|
|
2970
|
+
resolveVariableWithDefaultSyntax: fs,
|
|
2971
|
+
resolveRemainingVariablesWithDefaults: hs,
|
|
2972
|
+
isLetter: es,
|
|
2973
|
+
isDigit: ts,
|
|
2974
2974
|
isLetterOrDigit: Ke,
|
|
2975
2975
|
isValidObjectPathCharacter: vo,
|
|
2976
2976
|
insert: wo,
|
|
2977
|
-
indexOfRegex:
|
|
2978
|
-
lineMatches:
|
|
2977
|
+
indexOfRegex: rs,
|
|
2978
|
+
lineMatches: ns,
|
|
2979
2979
|
linesMatchInOrder: bo,
|
|
2980
2980
|
represent: Ge,
|
|
2981
2981
|
resolveMarkdownLinks: Ho,
|
|
@@ -2994,25 +2994,25 @@ var di = {};
|
|
|
2994
2994
|
replaceWord: Uo,
|
|
2995
2995
|
replacePascalCaseWords: Po,
|
|
2996
2996
|
stripHtml: Zo,
|
|
2997
|
-
breakLine:
|
|
2997
|
+
breakLine: ds,
|
|
2998
2998
|
measureTextWidth: Bo,
|
|
2999
2999
|
toLines: Lo,
|
|
3000
3000
|
levenshteinDistance: zo
|
|
3001
3001
|
}, a.Assertions = { asEqual: Pa, asTrue: Za, asTruthy: Ba, asFalse: La, asFalsy: za, asEither: Va }, a.Cache = { get: Mc, invalidate: $c }, a.Vector = {
|
|
3002
|
-
addPoint:
|
|
3002
|
+
addPoint: qs,
|
|
3003
3003
|
subtractPoint: vl,
|
|
3004
3004
|
multiplyPoint: xr,
|
|
3005
3005
|
normalizePoint: wl,
|
|
3006
|
-
pushPoint:
|
|
3006
|
+
pushPoint: Gs,
|
|
3007
3007
|
filterCoordinates: Qe,
|
|
3008
3008
|
findCorners: kl,
|
|
3009
3009
|
findLines: El,
|
|
3010
3010
|
raycast: kr,
|
|
3011
3011
|
raycastCircle: Al,
|
|
3012
|
-
getLineIntersectionPoint:
|
|
3012
|
+
getLineIntersectionPoint: ei
|
|
3013
3013
|
};
|
|
3014
|
-
})(
|
|
3015
|
-
const R = /* @__PURE__ */ Gl(
|
|
3014
|
+
})(li);
|
|
3015
|
+
const R = /* @__PURE__ */ Gl(li);
|
|
3016
3016
|
R.Arrays;
|
|
3017
3017
|
R.Assertions;
|
|
3018
3018
|
const B = R.Binary;
|
|
@@ -3038,13 +3038,13 @@ R.AsyncLazy;
|
|
|
3038
3038
|
R.AsyncQueue;
|
|
3039
3039
|
R.Uint8ArrayReader;
|
|
3040
3040
|
R.Uint8ArrayWriter;
|
|
3041
|
-
const Kl = new TextEncoder(),
|
|
3042
|
-
function
|
|
3043
|
-
return r = typeof r == "number" ?
|
|
3041
|
+
const Kl = new TextEncoder(), ri = 1, ni = 4096, En = 4096, Yl = 32;
|
|
3042
|
+
function di(a, r) {
|
|
3043
|
+
return r = typeof r == "number" ? ci.fromBigInt(BigInt(r)) : r, new Lt(B.keccak256(B.concatBytes(a.toUint8Array(), r.toUint8Array())));
|
|
3044
3044
|
}
|
|
3045
3045
|
function Ql(a) {
|
|
3046
|
-
const r = a.slice(0,
|
|
3047
|
-
return new
|
|
3046
|
+
const r = a.slice(0, Be.LENGTH), i = a.slice(Be.LENGTH), c = Xl(i), u = B.keccak256(B.concatBytes(r, c));
|
|
3047
|
+
return new ui(u);
|
|
3048
3048
|
}
|
|
3049
3049
|
function Xl(a) {
|
|
3050
3050
|
if (a.length > En)
|
|
@@ -3055,31 +3055,31 @@ function Xl(a) {
|
|
|
3055
3055
|
const r = new Uint8Array(En);
|
|
3056
3056
|
return r.set(a), B.log2Reduce(B.partition(r, Yl), (i, c) => B.keccak256(B.concatBytes(i, c)));
|
|
3057
3057
|
}
|
|
3058
|
-
function
|
|
3059
|
-
if (a instanceof Uint8Array || (a = Kl.encode(a)), a.length <
|
|
3058
|
+
function si(a) {
|
|
3059
|
+
if (a instanceof Uint8Array || (a = Kl.encode(a)), a.length < ri || a.length > ni)
|
|
3060
3060
|
throw new RangeError(
|
|
3061
|
-
`payload size ${a.length} exceeds limits [${
|
|
3061
|
+
`payload size ${a.length} exceeds limits [${ri}, ${ni}]`
|
|
3062
3062
|
);
|
|
3063
|
-
const r =
|
|
3063
|
+
const r = Be.fromBigInt(BigInt(a.length)), i = B.concatBytes(r.toUint8Array(), a);
|
|
3064
3064
|
return {
|
|
3065
3065
|
data: i,
|
|
3066
3066
|
span: r,
|
|
3067
|
-
payload:
|
|
3067
|
+
payload: Ue.fromSlice(i, Be.LENGTH),
|
|
3068
3068
|
address: Ql(i)
|
|
3069
3069
|
};
|
|
3070
3070
|
}
|
|
3071
3071
|
function ed(a, r) {
|
|
3072
|
-
return new
|
|
3072
|
+
return new ui(B.keccak256(B.concatBytes(a.toUint8Array(), r.toUint8Array())));
|
|
3073
3073
|
}
|
|
3074
|
-
function
|
|
3075
|
-
r = new
|
|
3076
|
-
const c = ed(r, i.publicKey().address()), u = i.sign(B.concatBytes(r.toUint8Array(), a.address.toUint8Array())), l = B.concatBytes(r.toUint8Array(), u.toUint8Array(), a.data), f =
|
|
3074
|
+
function ii(a, r, i) {
|
|
3075
|
+
r = new Lt(r), i = new ke(i);
|
|
3076
|
+
const c = ed(r, i.publicKey().address()), u = i.sign(B.concatBytes(r.toUint8Array(), a.address.toUint8Array())), l = B.concatBytes(r.toUint8Array(), u.toUint8Array(), a.data), f = Be.fromSlice(a.data, 0), h = Ue.fromSlice(a.data, Be.LENGTH);
|
|
3077
3077
|
return {
|
|
3078
3078
|
data: l,
|
|
3079
3079
|
identifier: r,
|
|
3080
3080
|
signature: u,
|
|
3081
3081
|
span: f,
|
|
3082
|
-
payload:
|
|
3082
|
+
payload: h,
|
|
3083
3083
|
address: c,
|
|
3084
3084
|
owner: i.publicKey().address()
|
|
3085
3085
|
};
|
|
@@ -3090,14 +3090,14 @@ function nd(a) {
|
|
|
3090
3090
|
setTimeout(r, a);
|
|
3091
3091
|
});
|
|
3092
3092
|
}
|
|
3093
|
-
function
|
|
3093
|
+
function fi(a) {
|
|
3094
3094
|
return (a.startsWith("0x") ? a.slice(2) : a).toLowerCase();
|
|
3095
3095
|
}
|
|
3096
|
-
async function
|
|
3096
|
+
async function Tn(a, r = 3, i = 250) {
|
|
3097
3097
|
return new Promise((c, u) => {
|
|
3098
3098
|
a().then(c).catch((l) => {
|
|
3099
3099
|
r > 0 ? (td.info(`Retrying... Attempts left: ${r}. Error: ${l.message}`), setTimeout(() => {
|
|
3100
|
-
|
|
3100
|
+
Tn(a, r - 1, i).then(c).catch(u);
|
|
3101
3101
|
}, i)) : (rd.handleError(l, "Utils.retryAwaitableAsync"), u(l));
|
|
3102
3102
|
});
|
|
3103
3103
|
});
|
|
@@ -3136,9 +3136,9 @@ var I;
|
|
|
3136
3136
|
l[f] = f;
|
|
3137
3137
|
return l;
|
|
3138
3138
|
}, a.getValidEnumValues = (u) => {
|
|
3139
|
-
const l = a.objectKeys(u).filter((
|
|
3140
|
-
for (const
|
|
3141
|
-
f[
|
|
3139
|
+
const l = a.objectKeys(u).filter((h) => typeof u[u[h]] != "number"), f = {};
|
|
3140
|
+
for (const h of l)
|
|
3141
|
+
f[h] = u[h];
|
|
3142
3142
|
return a.objectValues(f);
|
|
3143
3143
|
}, a.objectValues = (u) => a.objectKeys(u).map(function(l) {
|
|
3144
3144
|
return u[l];
|
|
@@ -3157,14 +3157,14 @@ var I;
|
|
|
3157
3157
|
}
|
|
3158
3158
|
a.joinValues = c, a.jsonStringifyReplacer = (u, l) => typeof l == "bigint" ? l.toString() : l;
|
|
3159
3159
|
})(I || (I = {}));
|
|
3160
|
-
var
|
|
3160
|
+
var An;
|
|
3161
3161
|
(function(a) {
|
|
3162
3162
|
a.mergeShapes = (r, i) => ({
|
|
3163
3163
|
...r,
|
|
3164
3164
|
...i
|
|
3165
3165
|
// second overwrites first
|
|
3166
3166
|
});
|
|
3167
|
-
})(
|
|
3167
|
+
})(An || (An = {}));
|
|
3168
3168
|
const _ = I.arrayToEnum([
|
|
3169
3169
|
"string",
|
|
3170
3170
|
"nan",
|
|
@@ -3252,10 +3252,10 @@ class V extends Error {
|
|
|
3252
3252
|
else if (f.path.length === 0)
|
|
3253
3253
|
c._errors.push(i(f));
|
|
3254
3254
|
else {
|
|
3255
|
-
let
|
|
3255
|
+
let h = c, g = 0;
|
|
3256
3256
|
for (; g < f.path.length; ) {
|
|
3257
3257
|
const y = f.path[g];
|
|
3258
|
-
g === f.path.length - 1 ? (
|
|
3258
|
+
g === f.path.length - 1 ? (h[y] = h[y] || { _errors: [] }, h[y]._errors.push(i(f))) : h[y] = h[y] || { _errors: [] }, h = h[y], g++;
|
|
3259
3259
|
}
|
|
3260
3260
|
}
|
|
3261
3261
|
};
|
|
@@ -3285,7 +3285,7 @@ class V extends Error {
|
|
|
3285
3285
|
}
|
|
3286
3286
|
}
|
|
3287
3287
|
V.create = (a) => new V(a);
|
|
3288
|
-
const
|
|
3288
|
+
const Le = (a, r) => {
|
|
3289
3289
|
let i;
|
|
3290
3290
|
switch (a.code) {
|
|
3291
3291
|
case w.invalid_type:
|
|
@@ -3341,14 +3341,14 @@ const ze = (a, r) => {
|
|
|
3341
3341
|
}
|
|
3342
3342
|
return { message: i };
|
|
3343
3343
|
};
|
|
3344
|
-
let hi =
|
|
3344
|
+
let hi = Le;
|
|
3345
3345
|
function ad(a) {
|
|
3346
3346
|
hi = a;
|
|
3347
3347
|
}
|
|
3348
|
-
function
|
|
3348
|
+
function zt() {
|
|
3349
3349
|
return hi;
|
|
3350
3350
|
}
|
|
3351
|
-
const
|
|
3351
|
+
const Vt = (a) => {
|
|
3352
3352
|
const { data: r, path: i, errorMaps: c, issueData: u } = a, l = [...i, ...u.path || []], f = {
|
|
3353
3353
|
...u,
|
|
3354
3354
|
path: l
|
|
@@ -3359,18 +3359,18 @@ const zt = (a) => {
|
|
|
3359
3359
|
path: l,
|
|
3360
3360
|
message: u.message
|
|
3361
3361
|
};
|
|
3362
|
-
let
|
|
3362
|
+
let h = "";
|
|
3363
3363
|
const g = c.filter((y) => !!y).slice().reverse();
|
|
3364
3364
|
for (const y of g)
|
|
3365
|
-
|
|
3365
|
+
h = y(f, { data: r, defaultError: h }).message;
|
|
3366
3366
|
return {
|
|
3367
3367
|
...u,
|
|
3368
3368
|
path: l,
|
|
3369
|
-
message:
|
|
3369
|
+
message: h
|
|
3370
3370
|
};
|
|
3371
3371
|
}, od = [];
|
|
3372
3372
|
function b(a, r) {
|
|
3373
|
-
const i =
|
|
3373
|
+
const i = zt(), c = Vt({
|
|
3374
3374
|
issueData: r,
|
|
3375
3375
|
data: a.data,
|
|
3376
3376
|
path: a.path,
|
|
@@ -3381,7 +3381,7 @@ function b(a, r) {
|
|
|
3381
3381
|
// then schema-bound map if available
|
|
3382
3382
|
i,
|
|
3383
3383
|
// then global override map
|
|
3384
|
-
i ===
|
|
3384
|
+
i === Le ? void 0 : Le
|
|
3385
3385
|
// then global default map
|
|
3386
3386
|
].filter((u) => !!u)
|
|
3387
3387
|
});
|
|
@@ -3430,8 +3430,8 @@ class L {
|
|
|
3430
3430
|
}
|
|
3431
3431
|
const T = Object.freeze({
|
|
3432
3432
|
status: "aborted"
|
|
3433
|
-
}),
|
|
3434
|
-
function
|
|
3433
|
+
}), Pe = (a) => ({ status: "dirty", value: a }), z = (a) => ({ status: "valid", value: a }), On = (a) => a.status === "aborted", In = (a) => a.status === "dirty", Se = (a) => a.status === "valid", ft = (a) => typeof Promise < "u" && a instanceof Promise;
|
|
3434
|
+
function Ft(a, r, i, c) {
|
|
3435
3435
|
if (typeof r == "function" ? a !== r || !c : !r.has(a)) throw new TypeError("Cannot read private member from an object whose class did not declare it");
|
|
3436
3436
|
return r.get(a);
|
|
3437
3437
|
}
|
|
@@ -3439,11 +3439,11 @@ function pi(a, r, i, c, u) {
|
|
|
3439
3439
|
if (typeof r == "function" ? a !== r || !u : !r.has(a)) throw new TypeError("Cannot write private member to an object whose class did not declare it");
|
|
3440
3440
|
return r.set(a, i), i;
|
|
3441
3441
|
}
|
|
3442
|
-
var
|
|
3442
|
+
var E;
|
|
3443
3443
|
(function(a) {
|
|
3444
3444
|
a.errToObj = (r) => typeof r == "string" ? { message: r } : r || {}, a.toString = (r) => typeof r == "string" ? r : r == null ? void 0 : r.message;
|
|
3445
|
-
})(
|
|
3446
|
-
var
|
|
3445
|
+
})(E || (E = {}));
|
|
3446
|
+
var lt, dt;
|
|
3447
3447
|
class ee {
|
|
3448
3448
|
constructor(r, i, c, u) {
|
|
3449
3449
|
this._cachedPath = [], this.parent = r, this.data = i, this._path = c, this._key = u;
|
|
@@ -3452,7 +3452,7 @@ class ee {
|
|
|
3452
3452
|
return this._cachedPath.length || (this._key instanceof Array ? this._cachedPath.push(...this._path, ...this._key) : this._cachedPath.push(...this._path, this._key)), this._cachedPath;
|
|
3453
3453
|
}
|
|
3454
3454
|
}
|
|
3455
|
-
const
|
|
3455
|
+
const ai = (a, r) => {
|
|
3456
3456
|
if (Se(r))
|
|
3457
3457
|
return { success: !0, data: r.value };
|
|
3458
3458
|
if (!a.common.issues.length)
|
|
@@ -3473,10 +3473,10 @@ function A(a) {
|
|
|
3473
3473
|
const { errorMap: r, invalid_type_error: i, required_error: c, description: u } = a;
|
|
3474
3474
|
if (r && (i || c))
|
|
3475
3475
|
throw new Error(`Can't use "invalid_type_error" or "required_error" in conjunction with custom error map.`);
|
|
3476
|
-
return r ? { errorMap: r, description: u } : { errorMap: (f,
|
|
3476
|
+
return r ? { errorMap: r, description: u } : { errorMap: (f, h) => {
|
|
3477
3477
|
var g, y;
|
|
3478
|
-
const { message:
|
|
3479
|
-
return f.code === "invalid_enum_value" ? { message:
|
|
3478
|
+
const { message: x } = a;
|
|
3479
|
+
return f.code === "invalid_enum_value" ? { message: x ?? h.defaultError } : typeof h.data > "u" ? { message: (g = x ?? c) !== null && g !== void 0 ? g : h.defaultError } : f.code !== "invalid_type" ? { message: h.defaultError } : { message: (y = x ?? i) !== null && y !== void 0 ? y : h.defaultError };
|
|
3480
3480
|
}, description: u };
|
|
3481
3481
|
}
|
|
3482
3482
|
class O {
|
|
@@ -3511,7 +3511,7 @@ class O {
|
|
|
3511
3511
|
}
|
|
3512
3512
|
_parseSync(r) {
|
|
3513
3513
|
const i = this._parse(r);
|
|
3514
|
-
if (
|
|
3514
|
+
if (ft(i))
|
|
3515
3515
|
throw new Error("Synchronous parse encountered promise.");
|
|
3516
3516
|
return i;
|
|
3517
3517
|
}
|
|
@@ -3539,7 +3539,7 @@ class O {
|
|
|
3539
3539
|
data: r,
|
|
3540
3540
|
parsedType: ae(r)
|
|
3541
3541
|
}, l = this._parseSync({ data: r, path: u.path, parent: u });
|
|
3542
|
-
return
|
|
3542
|
+
return ai(u, l);
|
|
3543
3543
|
}
|
|
3544
3544
|
"~validate"(r) {
|
|
3545
3545
|
var i, c;
|
|
@@ -3592,17 +3592,17 @@ class O {
|
|
|
3592
3592
|
parent: null,
|
|
3593
3593
|
data: r,
|
|
3594
3594
|
parsedType: ae(r)
|
|
3595
|
-
}, u = this._parse({ data: r, path: c.path, parent: c }), l = await (
|
|
3596
|
-
return
|
|
3595
|
+
}, u = this._parse({ data: r, path: c.path, parent: c }), l = await (ft(u) ? u : Promise.resolve(u));
|
|
3596
|
+
return ai(c, l);
|
|
3597
3597
|
}
|
|
3598
3598
|
refine(r, i) {
|
|
3599
3599
|
const c = (u) => typeof i == "string" || typeof i > "u" ? { message: i } : typeof i == "function" ? i(u) : i;
|
|
3600
3600
|
return this._refinement((u, l) => {
|
|
3601
|
-
const f = r(u),
|
|
3601
|
+
const f = r(u), h = () => l.addIssue({
|
|
3602
3602
|
code: w.custom,
|
|
3603
3603
|
...c(u)
|
|
3604
3604
|
});
|
|
3605
|
-
return typeof Promise < "u" && f instanceof Promise ? f.then((g) => g ? !0 : (
|
|
3605
|
+
return typeof Promise < "u" && f instanceof Promise ? f.then((g) => g ? !0 : (h(), !1)) : f ? !0 : (h(), !1);
|
|
3606
3606
|
});
|
|
3607
3607
|
}
|
|
3608
3608
|
refinement(r, i) {
|
|
@@ -3638,13 +3638,13 @@ class O {
|
|
|
3638
3638
|
return G.create(this);
|
|
3639
3639
|
}
|
|
3640
3640
|
promise() {
|
|
3641
|
-
return
|
|
3641
|
+
return Ve.create(this, this._def);
|
|
3642
3642
|
}
|
|
3643
3643
|
or(r) {
|
|
3644
|
-
return
|
|
3644
|
+
return gt.create([this, r], this._def);
|
|
3645
3645
|
}
|
|
3646
3646
|
and(r) {
|
|
3647
|
-
return
|
|
3647
|
+
return yt.create(this, r, this._def);
|
|
3648
3648
|
}
|
|
3649
3649
|
transform(r) {
|
|
3650
3650
|
return new J({
|
|
@@ -3656,7 +3656,7 @@ class O {
|
|
|
3656
3656
|
}
|
|
3657
3657
|
default(r) {
|
|
3658
3658
|
const i = typeof r == "function" ? r : () => r;
|
|
3659
|
-
return new
|
|
3659
|
+
return new xt({
|
|
3660
3660
|
...A(this._def),
|
|
3661
3661
|
innerType: this,
|
|
3662
3662
|
defaultValue: i,
|
|
@@ -3664,7 +3664,7 @@ class O {
|
|
|
3664
3664
|
});
|
|
3665
3665
|
}
|
|
3666
3666
|
brand() {
|
|
3667
|
-
return new
|
|
3667
|
+
return new $n({
|
|
3668
3668
|
typeName: S.ZodBranded,
|
|
3669
3669
|
type: this,
|
|
3670
3670
|
...A(this._def)
|
|
@@ -3672,7 +3672,7 @@ class O {
|
|
|
3672
3672
|
}
|
|
3673
3673
|
catch(r) {
|
|
3674
3674
|
const i = typeof r == "function" ? r : () => r;
|
|
3675
|
-
return new
|
|
3675
|
+
return new kt({
|
|
3676
3676
|
...A(this._def),
|
|
3677
3677
|
innerType: this,
|
|
3678
3678
|
catchValue: i,
|
|
@@ -3687,10 +3687,10 @@ class O {
|
|
|
3687
3687
|
});
|
|
3688
3688
|
}
|
|
3689
3689
|
pipe(r) {
|
|
3690
|
-
return
|
|
3690
|
+
return St.create(this, r);
|
|
3691
3691
|
}
|
|
3692
3692
|
readonly() {
|
|
3693
|
-
return
|
|
3693
|
+
return Et.create(this);
|
|
3694
3694
|
}
|
|
3695
3695
|
isOptional() {
|
|
3696
3696
|
return this.safeParse(void 0).success;
|
|
@@ -3762,15 +3762,15 @@ class q extends O {
|
|
|
3762
3762
|
message: l.message
|
|
3763
3763
|
}), c.dirty());
|
|
3764
3764
|
else if (l.kind === "length") {
|
|
3765
|
-
const f = r.data.length > l.value,
|
|
3766
|
-
(f ||
|
|
3765
|
+
const f = r.data.length > l.value, h = r.data.length < l.value;
|
|
3766
|
+
(f || h) && (u = this._getOrReturnCtx(r, u), f ? b(u, {
|
|
3767
3767
|
code: w.too_big,
|
|
3768
3768
|
maximum: l.value,
|
|
3769
3769
|
type: "string",
|
|
3770
3770
|
inclusive: !0,
|
|
3771
3771
|
exact: !0,
|
|
3772
3772
|
message: l.message
|
|
3773
|
-
}) :
|
|
3773
|
+
}) : h && b(u, {
|
|
3774
3774
|
code: w.too_small,
|
|
3775
3775
|
minimum: l.value,
|
|
3776
3776
|
type: "string",
|
|
@@ -3889,7 +3889,7 @@ class q extends O {
|
|
|
3889
3889
|
return this.refinement((u) => r.test(u), {
|
|
3890
3890
|
validation: i,
|
|
3891
3891
|
code: w.invalid_string,
|
|
3892
|
-
...
|
|
3892
|
+
...E.errToObj(c)
|
|
3893
3893
|
});
|
|
3894
3894
|
}
|
|
3895
3895
|
_addCheck(r) {
|
|
@@ -3899,46 +3899,46 @@ class q extends O {
|
|
|
3899
3899
|
});
|
|
3900
3900
|
}
|
|
3901
3901
|
email(r) {
|
|
3902
|
-
return this._addCheck({ kind: "email", ...
|
|
3902
|
+
return this._addCheck({ kind: "email", ...E.errToObj(r) });
|
|
3903
3903
|
}
|
|
3904
3904
|
url(r) {
|
|
3905
|
-
return this._addCheck({ kind: "url", ...
|
|
3905
|
+
return this._addCheck({ kind: "url", ...E.errToObj(r) });
|
|
3906
3906
|
}
|
|
3907
3907
|
emoji(r) {
|
|
3908
|
-
return this._addCheck({ kind: "emoji", ...
|
|
3908
|
+
return this._addCheck({ kind: "emoji", ...E.errToObj(r) });
|
|
3909
3909
|
}
|
|
3910
3910
|
uuid(r) {
|
|
3911
|
-
return this._addCheck({ kind: "uuid", ...
|
|
3911
|
+
return this._addCheck({ kind: "uuid", ...E.errToObj(r) });
|
|
3912
3912
|
}
|
|
3913
3913
|
nanoid(r) {
|
|
3914
|
-
return this._addCheck({ kind: "nanoid", ...
|
|
3914
|
+
return this._addCheck({ kind: "nanoid", ...E.errToObj(r) });
|
|
3915
3915
|
}
|
|
3916
3916
|
cuid(r) {
|
|
3917
|
-
return this._addCheck({ kind: "cuid", ...
|
|
3917
|
+
return this._addCheck({ kind: "cuid", ...E.errToObj(r) });
|
|
3918
3918
|
}
|
|
3919
3919
|
cuid2(r) {
|
|
3920
|
-
return this._addCheck({ kind: "cuid2", ...
|
|
3920
|
+
return this._addCheck({ kind: "cuid2", ...E.errToObj(r) });
|
|
3921
3921
|
}
|
|
3922
3922
|
ulid(r) {
|
|
3923
|
-
return this._addCheck({ kind: "ulid", ...
|
|
3923
|
+
return this._addCheck({ kind: "ulid", ...E.errToObj(r) });
|
|
3924
3924
|
}
|
|
3925
3925
|
base64(r) {
|
|
3926
|
-
return this._addCheck({ kind: "base64", ...
|
|
3926
|
+
return this._addCheck({ kind: "base64", ...E.errToObj(r) });
|
|
3927
3927
|
}
|
|
3928
3928
|
base64url(r) {
|
|
3929
3929
|
return this._addCheck({
|
|
3930
3930
|
kind: "base64url",
|
|
3931
|
-
...
|
|
3931
|
+
...E.errToObj(r)
|
|
3932
3932
|
});
|
|
3933
3933
|
}
|
|
3934
3934
|
jwt(r) {
|
|
3935
|
-
return this._addCheck({ kind: "jwt", ...
|
|
3935
|
+
return this._addCheck({ kind: "jwt", ...E.errToObj(r) });
|
|
3936
3936
|
}
|
|
3937
3937
|
ip(r) {
|
|
3938
|
-
return this._addCheck({ kind: "ip", ...
|
|
3938
|
+
return this._addCheck({ kind: "ip", ...E.errToObj(r) });
|
|
3939
3939
|
}
|
|
3940
3940
|
cidr(r) {
|
|
3941
|
-
return this._addCheck({ kind: "cidr", ...
|
|
3941
|
+
return this._addCheck({ kind: "cidr", ...E.errToObj(r) });
|
|
3942
3942
|
}
|
|
3943
3943
|
datetime(r) {
|
|
3944
3944
|
var i, c;
|
|
@@ -3953,7 +3953,7 @@ class q extends O {
|
|
|
3953
3953
|
precision: typeof (r == null ? void 0 : r.precision) > "u" ? null : r == null ? void 0 : r.precision,
|
|
3954
3954
|
offset: (i = r == null ? void 0 : r.offset) !== null && i !== void 0 ? i : !1,
|
|
3955
3955
|
local: (c = r == null ? void 0 : r.local) !== null && c !== void 0 ? c : !1,
|
|
3956
|
-
...
|
|
3956
|
+
...E.errToObj(r == null ? void 0 : r.message)
|
|
3957
3957
|
});
|
|
3958
3958
|
}
|
|
3959
3959
|
date(r) {
|
|
@@ -3967,17 +3967,17 @@ class q extends O {
|
|
|
3967
3967
|
}) : this._addCheck({
|
|
3968
3968
|
kind: "time",
|
|
3969
3969
|
precision: typeof (r == null ? void 0 : r.precision) > "u" ? null : r == null ? void 0 : r.precision,
|
|
3970
|
-
...
|
|
3970
|
+
...E.errToObj(r == null ? void 0 : r.message)
|
|
3971
3971
|
});
|
|
3972
3972
|
}
|
|
3973
3973
|
duration(r) {
|
|
3974
|
-
return this._addCheck({ kind: "duration", ...
|
|
3974
|
+
return this._addCheck({ kind: "duration", ...E.errToObj(r) });
|
|
3975
3975
|
}
|
|
3976
3976
|
regex(r, i) {
|
|
3977
3977
|
return this._addCheck({
|
|
3978
3978
|
kind: "regex",
|
|
3979
3979
|
regex: r,
|
|
3980
|
-
...
|
|
3980
|
+
...E.errToObj(i)
|
|
3981
3981
|
});
|
|
3982
3982
|
}
|
|
3983
3983
|
includes(r, i) {
|
|
@@ -3985,49 +3985,49 @@ class q extends O {
|
|
|
3985
3985
|
kind: "includes",
|
|
3986
3986
|
value: r,
|
|
3987
3987
|
position: i == null ? void 0 : i.position,
|
|
3988
|
-
...
|
|
3988
|
+
...E.errToObj(i == null ? void 0 : i.message)
|
|
3989
3989
|
});
|
|
3990
3990
|
}
|
|
3991
3991
|
startsWith(r, i) {
|
|
3992
3992
|
return this._addCheck({
|
|
3993
3993
|
kind: "startsWith",
|
|
3994
3994
|
value: r,
|
|
3995
|
-
...
|
|
3995
|
+
...E.errToObj(i)
|
|
3996
3996
|
});
|
|
3997
3997
|
}
|
|
3998
3998
|
endsWith(r, i) {
|
|
3999
3999
|
return this._addCheck({
|
|
4000
4000
|
kind: "endsWith",
|
|
4001
4001
|
value: r,
|
|
4002
|
-
...
|
|
4002
|
+
...E.errToObj(i)
|
|
4003
4003
|
});
|
|
4004
4004
|
}
|
|
4005
4005
|
min(r, i) {
|
|
4006
4006
|
return this._addCheck({
|
|
4007
4007
|
kind: "min",
|
|
4008
4008
|
value: r,
|
|
4009
|
-
...
|
|
4009
|
+
...E.errToObj(i)
|
|
4010
4010
|
});
|
|
4011
4011
|
}
|
|
4012
4012
|
max(r, i) {
|
|
4013
4013
|
return this._addCheck({
|
|
4014
4014
|
kind: "max",
|
|
4015
4015
|
value: r,
|
|
4016
|
-
...
|
|
4016
|
+
...E.errToObj(i)
|
|
4017
4017
|
});
|
|
4018
4018
|
}
|
|
4019
4019
|
length(r, i) {
|
|
4020
4020
|
return this._addCheck({
|
|
4021
4021
|
kind: "length",
|
|
4022
4022
|
value: r,
|
|
4023
|
-
...
|
|
4023
|
+
...E.errToObj(i)
|
|
4024
4024
|
});
|
|
4025
4025
|
}
|
|
4026
4026
|
/**
|
|
4027
4027
|
* Equivalent to `.min(1)`
|
|
4028
4028
|
*/
|
|
4029
4029
|
nonempty(r) {
|
|
4030
|
-
return this.min(1,
|
|
4030
|
+
return this.min(1, E.errToObj(r));
|
|
4031
4031
|
}
|
|
4032
4032
|
trim() {
|
|
4033
4033
|
return new q({
|
|
@@ -4167,16 +4167,16 @@ class fe extends O {
|
|
|
4167
4167
|
return { status: u.value, value: r.data };
|
|
4168
4168
|
}
|
|
4169
4169
|
gte(r, i) {
|
|
4170
|
-
return this.setLimit("min", r, !0,
|
|
4170
|
+
return this.setLimit("min", r, !0, E.toString(i));
|
|
4171
4171
|
}
|
|
4172
4172
|
gt(r, i) {
|
|
4173
|
-
return this.setLimit("min", r, !1,
|
|
4173
|
+
return this.setLimit("min", r, !1, E.toString(i));
|
|
4174
4174
|
}
|
|
4175
4175
|
lte(r, i) {
|
|
4176
|
-
return this.setLimit("max", r, !0,
|
|
4176
|
+
return this.setLimit("max", r, !0, E.toString(i));
|
|
4177
4177
|
}
|
|
4178
4178
|
lt(r, i) {
|
|
4179
|
-
return this.setLimit("max", r, !1,
|
|
4179
|
+
return this.setLimit("max", r, !1, E.toString(i));
|
|
4180
4180
|
}
|
|
4181
4181
|
setLimit(r, i, c, u) {
|
|
4182
4182
|
return new fe({
|
|
@@ -4187,7 +4187,7 @@ class fe extends O {
|
|
|
4187
4187
|
kind: r,
|
|
4188
4188
|
value: i,
|
|
4189
4189
|
inclusive: c,
|
|
4190
|
-
message:
|
|
4190
|
+
message: E.toString(u)
|
|
4191
4191
|
}
|
|
4192
4192
|
]
|
|
4193
4193
|
});
|
|
@@ -4201,7 +4201,7 @@ class fe extends O {
|
|
|
4201
4201
|
int(r) {
|
|
4202
4202
|
return this._addCheck({
|
|
4203
4203
|
kind: "int",
|
|
4204
|
-
message:
|
|
4204
|
+
message: E.toString(r)
|
|
4205
4205
|
});
|
|
4206
4206
|
}
|
|
4207
4207
|
positive(r) {
|
|
@@ -4209,7 +4209,7 @@ class fe extends O {
|
|
|
4209
4209
|
kind: "min",
|
|
4210
4210
|
value: 0,
|
|
4211
4211
|
inclusive: !1,
|
|
4212
|
-
message:
|
|
4212
|
+
message: E.toString(r)
|
|
4213
4213
|
});
|
|
4214
4214
|
}
|
|
4215
4215
|
negative(r) {
|
|
@@ -4217,7 +4217,7 @@ class fe extends O {
|
|
|
4217
4217
|
kind: "max",
|
|
4218
4218
|
value: 0,
|
|
4219
4219
|
inclusive: !1,
|
|
4220
|
-
message:
|
|
4220
|
+
message: E.toString(r)
|
|
4221
4221
|
});
|
|
4222
4222
|
}
|
|
4223
4223
|
nonpositive(r) {
|
|
@@ -4225,7 +4225,7 @@ class fe extends O {
|
|
|
4225
4225
|
kind: "max",
|
|
4226
4226
|
value: 0,
|
|
4227
4227
|
inclusive: !0,
|
|
4228
|
-
message:
|
|
4228
|
+
message: E.toString(r)
|
|
4229
4229
|
});
|
|
4230
4230
|
}
|
|
4231
4231
|
nonnegative(r) {
|
|
@@ -4233,20 +4233,20 @@ class fe extends O {
|
|
|
4233
4233
|
kind: "min",
|
|
4234
4234
|
value: 0,
|
|
4235
4235
|
inclusive: !0,
|
|
4236
|
-
message:
|
|
4236
|
+
message: E.toString(r)
|
|
4237
4237
|
});
|
|
4238
4238
|
}
|
|
4239
4239
|
multipleOf(r, i) {
|
|
4240
4240
|
return this._addCheck({
|
|
4241
4241
|
kind: "multipleOf",
|
|
4242
4242
|
value: r,
|
|
4243
|
-
message:
|
|
4243
|
+
message: E.toString(i)
|
|
4244
4244
|
});
|
|
4245
4245
|
}
|
|
4246
4246
|
finite(r) {
|
|
4247
4247
|
return this._addCheck({
|
|
4248
4248
|
kind: "finite",
|
|
4249
|
-
message:
|
|
4249
|
+
message: E.toString(r)
|
|
4250
4250
|
});
|
|
4251
4251
|
}
|
|
4252
4252
|
safe(r) {
|
|
@@ -4254,12 +4254,12 @@ class fe extends O {
|
|
|
4254
4254
|
kind: "min",
|
|
4255
4255
|
inclusive: !0,
|
|
4256
4256
|
value: Number.MIN_SAFE_INTEGER,
|
|
4257
|
-
message:
|
|
4257
|
+
message: E.toString(r)
|
|
4258
4258
|
})._addCheck({
|
|
4259
4259
|
kind: "max",
|
|
4260
4260
|
inclusive: !0,
|
|
4261
4261
|
value: Number.MAX_SAFE_INTEGER,
|
|
4262
|
-
message:
|
|
4262
|
+
message: E.toString(r)
|
|
4263
4263
|
});
|
|
4264
4264
|
}
|
|
4265
4265
|
get minValue() {
|
|
@@ -4337,16 +4337,16 @@ class he extends O {
|
|
|
4337
4337
|
}), T;
|
|
4338
4338
|
}
|
|
4339
4339
|
gte(r, i) {
|
|
4340
|
-
return this.setLimit("min", r, !0,
|
|
4340
|
+
return this.setLimit("min", r, !0, E.toString(i));
|
|
4341
4341
|
}
|
|
4342
4342
|
gt(r, i) {
|
|
4343
|
-
return this.setLimit("min", r, !1,
|
|
4343
|
+
return this.setLimit("min", r, !1, E.toString(i));
|
|
4344
4344
|
}
|
|
4345
4345
|
lte(r, i) {
|
|
4346
|
-
return this.setLimit("max", r, !0,
|
|
4346
|
+
return this.setLimit("max", r, !0, E.toString(i));
|
|
4347
4347
|
}
|
|
4348
4348
|
lt(r, i) {
|
|
4349
|
-
return this.setLimit("max", r, !1,
|
|
4349
|
+
return this.setLimit("max", r, !1, E.toString(i));
|
|
4350
4350
|
}
|
|
4351
4351
|
setLimit(r, i, c, u) {
|
|
4352
4352
|
return new he({
|
|
@@ -4357,7 +4357,7 @@ class he extends O {
|
|
|
4357
4357
|
kind: r,
|
|
4358
4358
|
value: i,
|
|
4359
4359
|
inclusive: c,
|
|
4360
|
-
message:
|
|
4360
|
+
message: E.toString(u)
|
|
4361
4361
|
}
|
|
4362
4362
|
]
|
|
4363
4363
|
});
|
|
@@ -4373,7 +4373,7 @@ class he extends O {
|
|
|
4373
4373
|
kind: "min",
|
|
4374
4374
|
value: BigInt(0),
|
|
4375
4375
|
inclusive: !1,
|
|
4376
|
-
message:
|
|
4376
|
+
message: E.toString(r)
|
|
4377
4377
|
});
|
|
4378
4378
|
}
|
|
4379
4379
|
negative(r) {
|
|
@@ -4381,7 +4381,7 @@ class he extends O {
|
|
|
4381
4381
|
kind: "max",
|
|
4382
4382
|
value: BigInt(0),
|
|
4383
4383
|
inclusive: !1,
|
|
4384
|
-
message:
|
|
4384
|
+
message: E.toString(r)
|
|
4385
4385
|
});
|
|
4386
4386
|
}
|
|
4387
4387
|
nonpositive(r) {
|
|
@@ -4389,7 +4389,7 @@ class he extends O {
|
|
|
4389
4389
|
kind: "max",
|
|
4390
4390
|
value: BigInt(0),
|
|
4391
4391
|
inclusive: !0,
|
|
4392
|
-
message:
|
|
4392
|
+
message: E.toString(r)
|
|
4393
4393
|
});
|
|
4394
4394
|
}
|
|
4395
4395
|
nonnegative(r) {
|
|
@@ -4397,14 +4397,14 @@ class he extends O {
|
|
|
4397
4397
|
kind: "min",
|
|
4398
4398
|
value: BigInt(0),
|
|
4399
4399
|
inclusive: !0,
|
|
4400
|
-
message:
|
|
4400
|
+
message: E.toString(r)
|
|
4401
4401
|
});
|
|
4402
4402
|
}
|
|
4403
4403
|
multipleOf(r, i) {
|
|
4404
4404
|
return this._addCheck({
|
|
4405
4405
|
kind: "multipleOf",
|
|
4406
4406
|
value: r,
|
|
4407
|
-
message:
|
|
4407
|
+
message: E.toString(i)
|
|
4408
4408
|
});
|
|
4409
4409
|
}
|
|
4410
4410
|
get minValue() {
|
|
@@ -4429,7 +4429,7 @@ he.create = (a) => {
|
|
|
4429
4429
|
...A(a)
|
|
4430
4430
|
});
|
|
4431
4431
|
};
|
|
4432
|
-
class
|
|
4432
|
+
class ht extends O {
|
|
4433
4433
|
_parse(r) {
|
|
4434
4434
|
if (this._def.coerce && (r.data = !!r.data), this._getType(r) !== _.boolean) {
|
|
4435
4435
|
const c = this._getOrReturnCtx(r);
|
|
@@ -4442,7 +4442,7 @@ class ft extends O {
|
|
|
4442
4442
|
return z(r.data);
|
|
4443
4443
|
}
|
|
4444
4444
|
}
|
|
4445
|
-
|
|
4445
|
+
ht.create = (a) => new ht({
|
|
4446
4446
|
typeName: S.ZodBoolean,
|
|
4447
4447
|
coerce: (a == null ? void 0 : a.coerce) || !1,
|
|
4448
4448
|
...A(a)
|
|
@@ -4496,14 +4496,14 @@ class Te extends O {
|
|
|
4496
4496
|
return this._addCheck({
|
|
4497
4497
|
kind: "min",
|
|
4498
4498
|
value: r.getTime(),
|
|
4499
|
-
message:
|
|
4499
|
+
message: E.toString(i)
|
|
4500
4500
|
});
|
|
4501
4501
|
}
|
|
4502
4502
|
max(r, i) {
|
|
4503
4503
|
return this._addCheck({
|
|
4504
4504
|
kind: "max",
|
|
4505
4505
|
value: r.getTime(),
|
|
4506
|
-
message:
|
|
4506
|
+
message: E.toString(i)
|
|
4507
4507
|
});
|
|
4508
4508
|
}
|
|
4509
4509
|
get minDate() {
|
|
@@ -4525,7 +4525,7 @@ Te.create = (a) => new Te({
|
|
|
4525
4525
|
typeName: S.ZodDate,
|
|
4526
4526
|
...A(a)
|
|
4527
4527
|
});
|
|
4528
|
-
class
|
|
4528
|
+
class Wt extends O {
|
|
4529
4529
|
_parse(r) {
|
|
4530
4530
|
if (this._getType(r) !== _.symbol) {
|
|
4531
4531
|
const c = this._getOrReturnCtx(r);
|
|
@@ -4538,11 +4538,11 @@ class Ft extends O {
|
|
|
4538
4538
|
return z(r.data);
|
|
4539
4539
|
}
|
|
4540
4540
|
}
|
|
4541
|
-
|
|
4541
|
+
Wt.create = (a) => new Wt({
|
|
4542
4542
|
typeName: S.ZodSymbol,
|
|
4543
4543
|
...A(a)
|
|
4544
4544
|
});
|
|
4545
|
-
class
|
|
4545
|
+
class pt extends O {
|
|
4546
4546
|
_parse(r) {
|
|
4547
4547
|
if (this._getType(r) !== _.undefined) {
|
|
4548
4548
|
const c = this._getOrReturnCtx(r);
|
|
@@ -4555,11 +4555,11 @@ class ht extends O {
|
|
|
4555
4555
|
return z(r.data);
|
|
4556
4556
|
}
|
|
4557
4557
|
}
|
|
4558
|
-
|
|
4558
|
+
pt.create = (a) => new pt({
|
|
4559
4559
|
typeName: S.ZodUndefined,
|
|
4560
4560
|
...A(a)
|
|
4561
4561
|
});
|
|
4562
|
-
class
|
|
4562
|
+
class mt extends O {
|
|
4563
4563
|
_parse(r) {
|
|
4564
4564
|
if (this._getType(r) !== _.null) {
|
|
4565
4565
|
const c = this._getOrReturnCtx(r);
|
|
@@ -4572,11 +4572,11 @@ class pt extends O {
|
|
|
4572
4572
|
return z(r.data);
|
|
4573
4573
|
}
|
|
4574
4574
|
}
|
|
4575
|
-
|
|
4575
|
+
mt.create = (a) => new mt({
|
|
4576
4576
|
typeName: S.ZodNull,
|
|
4577
4577
|
...A(a)
|
|
4578
4578
|
});
|
|
4579
|
-
class
|
|
4579
|
+
class ze extends O {
|
|
4580
4580
|
constructor() {
|
|
4581
4581
|
super(...arguments), this._any = !0;
|
|
4582
4582
|
}
|
|
@@ -4584,7 +4584,7 @@ class Ve extends O {
|
|
|
4584
4584
|
return z(r.data);
|
|
4585
4585
|
}
|
|
4586
4586
|
}
|
|
4587
|
-
|
|
4587
|
+
ze.create = (a) => new ze({
|
|
4588
4588
|
typeName: S.ZodAny,
|
|
4589
4589
|
...A(a)
|
|
4590
4590
|
});
|
|
@@ -4614,7 +4614,7 @@ oe.create = (a) => new oe({
|
|
|
4614
4614
|
typeName: S.ZodNever,
|
|
4615
4615
|
...A(a)
|
|
4616
4616
|
});
|
|
4617
|
-
class
|
|
4617
|
+
class Ht extends O {
|
|
4618
4618
|
_parse(r) {
|
|
4619
4619
|
if (this._getType(r) !== _.undefined) {
|
|
4620
4620
|
const c = this._getOrReturnCtx(r);
|
|
@@ -4627,7 +4627,7 @@ class Wt extends O {
|
|
|
4627
4627
|
return z(r.data);
|
|
4628
4628
|
}
|
|
4629
4629
|
}
|
|
4630
|
-
|
|
4630
|
+
Ht.create = (a) => new Ht({
|
|
4631
4631
|
typeName: S.ZodVoid,
|
|
4632
4632
|
...A(a)
|
|
4633
4633
|
});
|
|
@@ -4641,10 +4641,10 @@ class G extends O {
|
|
|
4641
4641
|
received: i.parsedType
|
|
4642
4642
|
}), T;
|
|
4643
4643
|
if (u.exactLength !== null) {
|
|
4644
|
-
const f = i.data.length > u.exactLength.value,
|
|
4645
|
-
(f ||
|
|
4644
|
+
const f = i.data.length > u.exactLength.value, h = i.data.length < u.exactLength.value;
|
|
4645
|
+
(f || h) && (b(i, {
|
|
4646
4646
|
code: f ? w.too_big : w.too_small,
|
|
4647
|
-
minimum:
|
|
4647
|
+
minimum: h ? u.exactLength.value : void 0,
|
|
4648
4648
|
maximum: f ? u.exactLength.value : void 0,
|
|
4649
4649
|
type: "array",
|
|
4650
4650
|
inclusive: !0,
|
|
@@ -4667,8 +4667,8 @@ class G extends O {
|
|
|
4667
4667
|
exact: !1,
|
|
4668
4668
|
message: u.maxLength.message
|
|
4669
4669
|
}), c.dirty()), i.common.async)
|
|
4670
|
-
return Promise.all([...i.data].map((f,
|
|
4671
|
-
const l = [...i.data].map((f,
|
|
4670
|
+
return Promise.all([...i.data].map((f, h) => u.type._parseAsync(new ee(i, f, i.path, h)))).then((f) => L.mergeArray(c, f));
|
|
4671
|
+
const l = [...i.data].map((f, h) => u.type._parseSync(new ee(i, f, i.path, h)));
|
|
4672
4672
|
return L.mergeArray(c, l);
|
|
4673
4673
|
}
|
|
4674
4674
|
get element() {
|
|
@@ -4677,19 +4677,19 @@ class G extends O {
|
|
|
4677
4677
|
min(r, i) {
|
|
4678
4678
|
return new G({
|
|
4679
4679
|
...this._def,
|
|
4680
|
-
minLength: { value: r, message:
|
|
4680
|
+
minLength: { value: r, message: E.toString(i) }
|
|
4681
4681
|
});
|
|
4682
4682
|
}
|
|
4683
4683
|
max(r, i) {
|
|
4684
4684
|
return new G({
|
|
4685
4685
|
...this._def,
|
|
4686
|
-
maxLength: { value: r, message:
|
|
4686
|
+
maxLength: { value: r, message: E.toString(i) }
|
|
4687
4687
|
});
|
|
4688
4688
|
}
|
|
4689
4689
|
length(r, i) {
|
|
4690
4690
|
return new G({
|
|
4691
4691
|
...this._def,
|
|
4692
|
-
exactLength: { value: r, message:
|
|
4692
|
+
exactLength: { value: r, message: E.toString(i) }
|
|
4693
4693
|
});
|
|
4694
4694
|
}
|
|
4695
4695
|
nonempty(r) {
|
|
@@ -4704,12 +4704,12 @@ G.create = (a, r) => new G({
|
|
|
4704
4704
|
typeName: S.ZodArray,
|
|
4705
4705
|
...A(r)
|
|
4706
4706
|
});
|
|
4707
|
-
function
|
|
4707
|
+
function De(a) {
|
|
4708
4708
|
if (a instanceof C) {
|
|
4709
4709
|
const r = {};
|
|
4710
4710
|
for (const i in a.shape) {
|
|
4711
4711
|
const c = a.shape[i];
|
|
4712
|
-
r[i] = X.create(
|
|
4712
|
+
r[i] = X.create(De(c));
|
|
4713
4713
|
}
|
|
4714
4714
|
return new C({
|
|
4715
4715
|
...a._def,
|
|
@@ -4717,8 +4717,8 @@ function Ue(a) {
|
|
|
4717
4717
|
});
|
|
4718
4718
|
} else return a instanceof G ? new G({
|
|
4719
4719
|
...a._def,
|
|
4720
|
-
type:
|
|
4721
|
-
}) : a instanceof X ? X.create(
|
|
4720
|
+
type: De(a.element)
|
|
4721
|
+
}) : a instanceof X ? X.create(De(a.unwrap())) : a instanceof me ? me.create(De(a.unwrap())) : a instanceof te ? te.create(a.items.map((r) => De(r))) : a;
|
|
4722
4722
|
}
|
|
4723
4723
|
class C extends O {
|
|
4724
4724
|
constructor() {
|
|
@@ -4739,55 +4739,55 @@ class C extends O {
|
|
|
4739
4739
|
received: y.parsedType
|
|
4740
4740
|
}), T;
|
|
4741
4741
|
}
|
|
4742
|
-
const { status: c, ctx: u } = this._processInputParams(r), { shape: l, keys: f } = this._getCached(),
|
|
4742
|
+
const { status: c, ctx: u } = this._processInputParams(r), { shape: l, keys: f } = this._getCached(), h = [];
|
|
4743
4743
|
if (!(this._def.catchall instanceof oe && this._def.unknownKeys === "strip"))
|
|
4744
4744
|
for (const y in u.data)
|
|
4745
|
-
f.includes(y) ||
|
|
4745
|
+
f.includes(y) || h.push(y);
|
|
4746
4746
|
const g = [];
|
|
4747
4747
|
for (const y of f) {
|
|
4748
|
-
const
|
|
4748
|
+
const x = l[y], N = u.data[y];
|
|
4749
4749
|
g.push({
|
|
4750
4750
|
key: { status: "valid", value: y },
|
|
4751
|
-
value:
|
|
4751
|
+
value: x._parse(new ee(u, N, u.path, y)),
|
|
4752
4752
|
alwaysSet: y in u.data
|
|
4753
4753
|
});
|
|
4754
4754
|
}
|
|
4755
4755
|
if (this._def.catchall instanceof oe) {
|
|
4756
4756
|
const y = this._def.unknownKeys;
|
|
4757
4757
|
if (y === "passthrough")
|
|
4758
|
-
for (const
|
|
4758
|
+
for (const x of h)
|
|
4759
4759
|
g.push({
|
|
4760
|
-
key: { status: "valid", value:
|
|
4761
|
-
value: { status: "valid", value: u.data[
|
|
4760
|
+
key: { status: "valid", value: x },
|
|
4761
|
+
value: { status: "valid", value: u.data[x] }
|
|
4762
4762
|
});
|
|
4763
4763
|
else if (y === "strict")
|
|
4764
|
-
|
|
4764
|
+
h.length > 0 && (b(u, {
|
|
4765
4765
|
code: w.unrecognized_keys,
|
|
4766
|
-
keys:
|
|
4766
|
+
keys: h
|
|
4767
4767
|
}), c.dirty());
|
|
4768
4768
|
else if (y !== "strip") throw new Error("Internal ZodObject error: invalid unknownKeys value.");
|
|
4769
4769
|
} else {
|
|
4770
4770
|
const y = this._def.catchall;
|
|
4771
|
-
for (const
|
|
4772
|
-
const N = u.data[
|
|
4771
|
+
for (const x of h) {
|
|
4772
|
+
const N = u.data[x];
|
|
4773
4773
|
g.push({
|
|
4774
|
-
key: { status: "valid", value:
|
|
4774
|
+
key: { status: "valid", value: x },
|
|
4775
4775
|
value: y._parse(
|
|
4776
|
-
new ee(u, N, u.path,
|
|
4776
|
+
new ee(u, N, u.path, x)
|
|
4777
4777
|
//, ctx.child(key), value, getParsedType(value)
|
|
4778
4778
|
),
|
|
4779
|
-
alwaysSet:
|
|
4779
|
+
alwaysSet: x in u.data
|
|
4780
4780
|
});
|
|
4781
4781
|
}
|
|
4782
4782
|
}
|
|
4783
4783
|
return u.common.async ? Promise.resolve().then(async () => {
|
|
4784
4784
|
const y = [];
|
|
4785
|
-
for (const
|
|
4786
|
-
const N = await
|
|
4785
|
+
for (const x of g) {
|
|
4786
|
+
const N = await x.key, re = await x.value;
|
|
4787
4787
|
y.push({
|
|
4788
4788
|
key: N,
|
|
4789
4789
|
value: re,
|
|
4790
|
-
alwaysSet:
|
|
4790
|
+
alwaysSet: x.alwaysSet
|
|
4791
4791
|
});
|
|
4792
4792
|
}
|
|
4793
4793
|
return y;
|
|
@@ -4797,15 +4797,15 @@ class C extends O {
|
|
|
4797
4797
|
return this._def.shape();
|
|
4798
4798
|
}
|
|
4799
4799
|
strict(r) {
|
|
4800
|
-
return
|
|
4800
|
+
return E.errToObj, new C({
|
|
4801
4801
|
...this._def,
|
|
4802
4802
|
unknownKeys: "strict",
|
|
4803
4803
|
...r !== void 0 ? {
|
|
4804
4804
|
errorMap: (i, c) => {
|
|
4805
|
-
var u, l, f,
|
|
4805
|
+
var u, l, f, h;
|
|
4806
4806
|
const g = (f = (l = (u = this._def).errorMap) === null || l === void 0 ? void 0 : l.call(u, i, c).message) !== null && f !== void 0 ? f : c.defaultError;
|
|
4807
4807
|
return i.code === "unrecognized_keys" ? {
|
|
4808
|
-
message: (
|
|
4808
|
+
message: (h = E.errToObj(r).message) !== null && h !== void 0 ? h : g
|
|
4809
4809
|
} : {
|
|
4810
4810
|
message: g
|
|
4811
4811
|
};
|
|
@@ -4954,7 +4954,7 @@ class C extends O {
|
|
|
4954
4954
|
* @deprecated
|
|
4955
4955
|
*/
|
|
4956
4956
|
deepPartial() {
|
|
4957
|
-
return
|
|
4957
|
+
return De(this);
|
|
4958
4958
|
}
|
|
4959
4959
|
partial(r) {
|
|
4960
4960
|
const i = {};
|
|
@@ -5007,17 +5007,17 @@ C.lazycreate = (a, r) => new C({
|
|
|
5007
5007
|
typeName: S.ZodObject,
|
|
5008
5008
|
...A(r)
|
|
5009
5009
|
});
|
|
5010
|
-
class
|
|
5010
|
+
class gt extends O {
|
|
5011
5011
|
_parse(r) {
|
|
5012
5012
|
const { ctx: i } = this._processInputParams(r), c = this._def.options;
|
|
5013
5013
|
function u(l) {
|
|
5014
|
-
for (const
|
|
5015
|
-
if (
|
|
5016
|
-
return
|
|
5017
|
-
for (const
|
|
5018
|
-
if (
|
|
5019
|
-
return i.common.issues.push(...
|
|
5020
|
-
const f = l.map((
|
|
5014
|
+
for (const h of l)
|
|
5015
|
+
if (h.result.status === "valid")
|
|
5016
|
+
return h.result;
|
|
5017
|
+
for (const h of l)
|
|
5018
|
+
if (h.result.status === "dirty")
|
|
5019
|
+
return i.common.issues.push(...h.ctx.common.issues), h.result;
|
|
5020
|
+
const f = l.map((h) => new V(h.ctx.common.issues));
|
|
5021
5021
|
return b(i, {
|
|
5022
5022
|
code: w.invalid_union,
|
|
5023
5023
|
unionErrors: f
|
|
@@ -5053,21 +5053,21 @@ class mt extends O {
|
|
|
5053
5053
|
issues: []
|
|
5054
5054
|
},
|
|
5055
5055
|
parent: null
|
|
5056
|
-
},
|
|
5056
|
+
}, x = g._parseSync({
|
|
5057
5057
|
data: i.data,
|
|
5058
5058
|
path: i.path,
|
|
5059
5059
|
parent: y
|
|
5060
5060
|
});
|
|
5061
|
-
if (
|
|
5062
|
-
return
|
|
5063
|
-
|
|
5061
|
+
if (x.status === "valid")
|
|
5062
|
+
return x;
|
|
5063
|
+
x.status === "dirty" && !l && (l = { result: x, ctx: y }), y.common.issues.length && f.push(y.common.issues);
|
|
5064
5064
|
}
|
|
5065
5065
|
if (l)
|
|
5066
5066
|
return i.common.issues.push(...l.ctx.common.issues), l.result;
|
|
5067
|
-
const
|
|
5067
|
+
const h = f.map((g) => new V(g));
|
|
5068
5068
|
return b(i, {
|
|
5069
5069
|
code: w.invalid_union,
|
|
5070
|
-
unionErrors:
|
|
5070
|
+
unionErrors: h
|
|
5071
5071
|
}), T;
|
|
5072
5072
|
}
|
|
5073
5073
|
}
|
|
@@ -5075,13 +5075,13 @@ class mt extends O {
|
|
|
5075
5075
|
return this._def.options;
|
|
5076
5076
|
}
|
|
5077
5077
|
}
|
|
5078
|
-
|
|
5078
|
+
gt.create = (a, r) => new gt({
|
|
5079
5079
|
options: a,
|
|
5080
5080
|
typeName: S.ZodUnion,
|
|
5081
5081
|
...A(r)
|
|
5082
5082
|
});
|
|
5083
|
-
const ie = (a) => a instanceof
|
|
5084
|
-
class
|
|
5083
|
+
const ie = (a) => a instanceof wt ? ie(a.schema) : a instanceof J ? ie(a.innerType()) : a instanceof bt ? [a.value] : a instanceof pe ? a.options : a instanceof _t ? I.objectValues(a.enum) : a instanceof xt ? ie(a._def.innerType) : a instanceof pt ? [void 0] : a instanceof mt ? [null] : a instanceof X ? [void 0, ...ie(a.unwrap())] : a instanceof me ? [null, ...ie(a.unwrap())] : a instanceof $n || a instanceof Et ? ie(a.unwrap()) : a instanceof kt ? ie(a._def.innerType) : [];
|
|
5084
|
+
class Jt extends O {
|
|
5085
5085
|
_parse(r) {
|
|
5086
5086
|
const { ctx: i } = this._processInputParams(r);
|
|
5087
5087
|
if (i.parsedType !== _.object)
|
|
@@ -5128,13 +5128,13 @@ class Gt extends O {
|
|
|
5128
5128
|
const f = ie(l.shape[r]);
|
|
5129
5129
|
if (!f.length)
|
|
5130
5130
|
throw new Error(`A discriminator value for key \`${r}\` could not be extracted from all schema options`);
|
|
5131
|
-
for (const
|
|
5132
|
-
if (u.has(
|
|
5133
|
-
throw new Error(`Discriminator property ${String(r)} has duplicate value ${String(
|
|
5134
|
-
u.set(
|
|
5131
|
+
for (const h of f) {
|
|
5132
|
+
if (u.has(h))
|
|
5133
|
+
throw new Error(`Discriminator property ${String(r)} has duplicate value ${String(h)}`);
|
|
5134
|
+
u.set(h, l);
|
|
5135
5135
|
}
|
|
5136
5136
|
}
|
|
5137
|
-
return new
|
|
5137
|
+
return new Jt({
|
|
5138
5138
|
typeName: S.ZodDiscriminatedUnion,
|
|
5139
5139
|
discriminator: r,
|
|
5140
5140
|
options: i,
|
|
@@ -5143,17 +5143,17 @@ class Gt extends O {
|
|
|
5143
5143
|
});
|
|
5144
5144
|
}
|
|
5145
5145
|
}
|
|
5146
|
-
function
|
|
5146
|
+
function Mn(a, r) {
|
|
5147
5147
|
const i = ae(a), c = ae(r);
|
|
5148
5148
|
if (a === r)
|
|
5149
5149
|
return { valid: !0, data: a };
|
|
5150
5150
|
if (i === _.object && c === _.object) {
|
|
5151
|
-
const u = I.objectKeys(r), l = I.objectKeys(a).filter((
|
|
5152
|
-
for (const
|
|
5153
|
-
const g =
|
|
5151
|
+
const u = I.objectKeys(r), l = I.objectKeys(a).filter((h) => u.indexOf(h) !== -1), f = { ...a, ...r };
|
|
5152
|
+
for (const h of l) {
|
|
5153
|
+
const g = Mn(a[h], r[h]);
|
|
5154
5154
|
if (!g.valid)
|
|
5155
5155
|
return { valid: !1 };
|
|
5156
|
-
f[
|
|
5156
|
+
f[h] = g.data;
|
|
5157
5157
|
}
|
|
5158
5158
|
return { valid: !0, data: f };
|
|
5159
5159
|
} else if (i === _.array && c === _.array) {
|
|
@@ -5161,7 +5161,7 @@ function $n(a, r) {
|
|
|
5161
5161
|
return { valid: !1 };
|
|
5162
5162
|
const u = [];
|
|
5163
5163
|
for (let l = 0; l < a.length; l++) {
|
|
5164
|
-
const f = a[l],
|
|
5164
|
+
const f = a[l], h = r[l], g = Mn(f, h);
|
|
5165
5165
|
if (!g.valid)
|
|
5166
5166
|
return { valid: !1 };
|
|
5167
5167
|
u.push(g.data);
|
|
@@ -5169,13 +5169,13 @@ function $n(a, r) {
|
|
|
5169
5169
|
return { valid: !0, data: u };
|
|
5170
5170
|
} else return i === _.date && c === _.date && +a == +r ? { valid: !0, data: a } : { valid: !1 };
|
|
5171
5171
|
}
|
|
5172
|
-
class
|
|
5172
|
+
class yt extends O {
|
|
5173
5173
|
_parse(r) {
|
|
5174
5174
|
const { status: i, ctx: c } = this._processInputParams(r), u = (l, f) => {
|
|
5175
|
-
if (
|
|
5175
|
+
if (On(l) || On(f))
|
|
5176
5176
|
return T;
|
|
5177
|
-
const
|
|
5178
|
-
return
|
|
5177
|
+
const h = Mn(l.value, f.value);
|
|
5178
|
+
return h.valid ? ((In(l) || In(f)) && i.dirty(), { status: i.value, value: h.data }) : (b(c, {
|
|
5179
5179
|
code: w.invalid_intersection_types
|
|
5180
5180
|
}), T);
|
|
5181
5181
|
};
|
|
@@ -5201,7 +5201,7 @@ class gt extends O {
|
|
|
5201
5201
|
}));
|
|
5202
5202
|
}
|
|
5203
5203
|
}
|
|
5204
|
-
|
|
5204
|
+
yt.create = (a, r, i) => new yt({
|
|
5205
5205
|
left: a,
|
|
5206
5206
|
right: r,
|
|
5207
5207
|
typeName: S.ZodIntersection,
|
|
@@ -5231,9 +5231,9 @@ class te extends O {
|
|
|
5231
5231
|
exact: !1,
|
|
5232
5232
|
type: "array"
|
|
5233
5233
|
}), i.dirty());
|
|
5234
|
-
const l = [...c.data].map((f,
|
|
5235
|
-
const g = this._def.items[
|
|
5236
|
-
return g ? g._parse(new ee(c, f, c.path,
|
|
5234
|
+
const l = [...c.data].map((f, h) => {
|
|
5235
|
+
const g = this._def.items[h] || this._def.rest;
|
|
5236
|
+
return g ? g._parse(new ee(c, f, c.path, h)) : null;
|
|
5237
5237
|
}).filter((f) => !!f);
|
|
5238
5238
|
return c.common.async ? Promise.all(l).then((f) => L.mergeArray(i, f)) : L.mergeArray(i, l);
|
|
5239
5239
|
}
|
|
@@ -5257,7 +5257,7 @@ te.create = (a, r) => {
|
|
|
5257
5257
|
...A(r)
|
|
5258
5258
|
});
|
|
5259
5259
|
};
|
|
5260
|
-
class
|
|
5260
|
+
class vt extends O {
|
|
5261
5261
|
get keySchema() {
|
|
5262
5262
|
return this._def.keyType;
|
|
5263
5263
|
}
|
|
@@ -5273,11 +5273,11 @@ class yt extends O {
|
|
|
5273
5273
|
received: c.parsedType
|
|
5274
5274
|
}), T;
|
|
5275
5275
|
const u = [], l = this._def.keyType, f = this._def.valueType;
|
|
5276
|
-
for (const
|
|
5276
|
+
for (const h in c.data)
|
|
5277
5277
|
u.push({
|
|
5278
|
-
key: l._parse(new ee(c,
|
|
5279
|
-
value: f._parse(new ee(c, c.data[
|
|
5280
|
-
alwaysSet:
|
|
5278
|
+
key: l._parse(new ee(c, h, c.path, h)),
|
|
5279
|
+
value: f._parse(new ee(c, c.data[h], c.path, h)),
|
|
5280
|
+
alwaysSet: h in c.data
|
|
5281
5281
|
});
|
|
5282
5282
|
return c.common.async ? L.mergeObjectAsync(i, u) : L.mergeObjectSync(i, u);
|
|
5283
5283
|
}
|
|
@@ -5285,12 +5285,12 @@ class yt extends O {
|
|
|
5285
5285
|
return this._def.valueType;
|
|
5286
5286
|
}
|
|
5287
5287
|
static create(r, i, c) {
|
|
5288
|
-
return i instanceof O ? new
|
|
5288
|
+
return i instanceof O ? new vt({
|
|
5289
5289
|
keyType: r,
|
|
5290
5290
|
valueType: i,
|
|
5291
5291
|
typeName: S.ZodRecord,
|
|
5292
5292
|
...A(c)
|
|
5293
|
-
}) : new
|
|
5293
|
+
}) : new vt({
|
|
5294
5294
|
keyType: q.create(),
|
|
5295
5295
|
valueType: r,
|
|
5296
5296
|
typeName: S.ZodRecord,
|
|
@@ -5298,7 +5298,7 @@ class yt extends O {
|
|
|
5298
5298
|
});
|
|
5299
5299
|
}
|
|
5300
5300
|
}
|
|
5301
|
-
class
|
|
5301
|
+
class qt extends O {
|
|
5302
5302
|
get keySchema() {
|
|
5303
5303
|
return this._def.keyType;
|
|
5304
5304
|
}
|
|
@@ -5313,34 +5313,34 @@ class Ht extends O {
|
|
|
5313
5313
|
expected: _.map,
|
|
5314
5314
|
received: c.parsedType
|
|
5315
5315
|
}), T;
|
|
5316
|
-
const u = this._def.keyType, l = this._def.valueType, f = [...c.data.entries()].map(([
|
|
5317
|
-
key: u._parse(new ee(c,
|
|
5316
|
+
const u = this._def.keyType, l = this._def.valueType, f = [...c.data.entries()].map(([h, g], y) => ({
|
|
5317
|
+
key: u._parse(new ee(c, h, c.path, [y, "key"])),
|
|
5318
5318
|
value: l._parse(new ee(c, g, c.path, [y, "value"]))
|
|
5319
5319
|
}));
|
|
5320
5320
|
if (c.common.async) {
|
|
5321
|
-
const
|
|
5321
|
+
const h = /* @__PURE__ */ new Map();
|
|
5322
5322
|
return Promise.resolve().then(async () => {
|
|
5323
5323
|
for (const g of f) {
|
|
5324
|
-
const y = await g.key,
|
|
5325
|
-
if (y.status === "aborted" ||
|
|
5324
|
+
const y = await g.key, x = await g.value;
|
|
5325
|
+
if (y.status === "aborted" || x.status === "aborted")
|
|
5326
5326
|
return T;
|
|
5327
|
-
(y.status === "dirty" ||
|
|
5327
|
+
(y.status === "dirty" || x.status === "dirty") && i.dirty(), h.set(y.value, x.value);
|
|
5328
5328
|
}
|
|
5329
|
-
return { status: i.value, value:
|
|
5329
|
+
return { status: i.value, value: h };
|
|
5330
5330
|
});
|
|
5331
5331
|
} else {
|
|
5332
|
-
const
|
|
5332
|
+
const h = /* @__PURE__ */ new Map();
|
|
5333
5333
|
for (const g of f) {
|
|
5334
|
-
const y = g.key,
|
|
5335
|
-
if (y.status === "aborted" ||
|
|
5334
|
+
const y = g.key, x = g.value;
|
|
5335
|
+
if (y.status === "aborted" || x.status === "aborted")
|
|
5336
5336
|
return T;
|
|
5337
|
-
(y.status === "dirty" ||
|
|
5337
|
+
(y.status === "dirty" || x.status === "dirty") && i.dirty(), h.set(y.value, x.value);
|
|
5338
5338
|
}
|
|
5339
|
-
return { status: i.value, value:
|
|
5339
|
+
return { status: i.value, value: h };
|
|
5340
5340
|
}
|
|
5341
5341
|
}
|
|
5342
5342
|
}
|
|
5343
|
-
|
|
5343
|
+
qt.create = (a, r, i) => new qt({
|
|
5344
5344
|
valueType: r,
|
|
5345
5345
|
keyType: a,
|
|
5346
5346
|
typeName: S.ZodMap,
|
|
@@ -5374,26 +5374,26 @@ class Ae extends O {
|
|
|
5374
5374
|
const l = this._def.valueType;
|
|
5375
5375
|
function f(g) {
|
|
5376
5376
|
const y = /* @__PURE__ */ new Set();
|
|
5377
|
-
for (const
|
|
5378
|
-
if (
|
|
5377
|
+
for (const x of g) {
|
|
5378
|
+
if (x.status === "aborted")
|
|
5379
5379
|
return T;
|
|
5380
|
-
|
|
5380
|
+
x.status === "dirty" && i.dirty(), y.add(x.value);
|
|
5381
5381
|
}
|
|
5382
5382
|
return { status: i.value, value: y };
|
|
5383
5383
|
}
|
|
5384
|
-
const
|
|
5385
|
-
return c.common.async ? Promise.all(
|
|
5384
|
+
const h = [...c.data.values()].map((g, y) => l._parse(new ee(c, g, c.path, y)));
|
|
5385
|
+
return c.common.async ? Promise.all(h).then((g) => f(g)) : f(h);
|
|
5386
5386
|
}
|
|
5387
5387
|
min(r, i) {
|
|
5388
5388
|
return new Ae({
|
|
5389
5389
|
...this._def,
|
|
5390
|
-
minSize: { value: r, message:
|
|
5390
|
+
minSize: { value: r, message: E.toString(i) }
|
|
5391
5391
|
});
|
|
5392
5392
|
}
|
|
5393
5393
|
max(r, i) {
|
|
5394
5394
|
return new Ae({
|
|
5395
5395
|
...this._def,
|
|
5396
|
-
maxSize: { value: r, message:
|
|
5396
|
+
maxSize: { value: r, message: E.toString(i) }
|
|
5397
5397
|
});
|
|
5398
5398
|
}
|
|
5399
5399
|
size(r, i) {
|
|
@@ -5410,7 +5410,7 @@ Ae.create = (a, r) => new Ae({
|
|
|
5410
5410
|
typeName: S.ZodSet,
|
|
5411
5411
|
...A(r)
|
|
5412
5412
|
});
|
|
5413
|
-
class
|
|
5413
|
+
class Ze extends O {
|
|
5414
5414
|
constructor() {
|
|
5415
5415
|
super(...arguments), this.validate = this.implement;
|
|
5416
5416
|
}
|
|
@@ -5422,15 +5422,15 @@ class Be extends O {
|
|
|
5422
5422
|
expected: _.function,
|
|
5423
5423
|
received: i.parsedType
|
|
5424
5424
|
}), T;
|
|
5425
|
-
function c(
|
|
5426
|
-
return
|
|
5427
|
-
data:
|
|
5425
|
+
function c(h, g) {
|
|
5426
|
+
return Vt({
|
|
5427
|
+
data: h,
|
|
5428
5428
|
path: i.path,
|
|
5429
5429
|
errorMaps: [
|
|
5430
5430
|
i.common.contextualErrorMap,
|
|
5431
5431
|
i.schemaErrorMap,
|
|
5432
|
-
|
|
5433
|
-
|
|
5432
|
+
zt(),
|
|
5433
|
+
Le
|
|
5434
5434
|
].filter((y) => !!y),
|
|
5435
5435
|
issueData: {
|
|
5436
5436
|
code: w.invalid_arguments,
|
|
@@ -5438,15 +5438,15 @@ class Be extends O {
|
|
|
5438
5438
|
}
|
|
5439
5439
|
});
|
|
5440
5440
|
}
|
|
5441
|
-
function u(
|
|
5442
|
-
return
|
|
5443
|
-
data:
|
|
5441
|
+
function u(h, g) {
|
|
5442
|
+
return Vt({
|
|
5443
|
+
data: h,
|
|
5444
5444
|
path: i.path,
|
|
5445
5445
|
errorMaps: [
|
|
5446
5446
|
i.common.contextualErrorMap,
|
|
5447
5447
|
i.schemaErrorMap,
|
|
5448
|
-
|
|
5449
|
-
|
|
5448
|
+
zt(),
|
|
5449
|
+
Le
|
|
5450
5450
|
].filter((y) => !!y),
|
|
5451
5451
|
issueData: {
|
|
5452
5452
|
code: w.invalid_return_type,
|
|
@@ -5455,25 +5455,25 @@ class Be extends O {
|
|
|
5455
5455
|
});
|
|
5456
5456
|
}
|
|
5457
5457
|
const l = { errorMap: i.common.contextualErrorMap }, f = i.data;
|
|
5458
|
-
if (this._def.returns instanceof
|
|
5459
|
-
const
|
|
5458
|
+
if (this._def.returns instanceof Ve) {
|
|
5459
|
+
const h = this;
|
|
5460
5460
|
return z(async function(...g) {
|
|
5461
|
-
const y = new V([]),
|
|
5461
|
+
const y = new V([]), x = await h._def.args.parseAsync(g, l).catch((ne) => {
|
|
5462
5462
|
throw y.addIssue(c(g, ne)), y;
|
|
5463
|
-
}), N = await Reflect.apply(f, this,
|
|
5464
|
-
return await
|
|
5463
|
+
}), N = await Reflect.apply(f, this, x);
|
|
5464
|
+
return await h._def.returns._def.type.parseAsync(N, l).catch((ne) => {
|
|
5465
5465
|
throw y.addIssue(u(N, ne)), y;
|
|
5466
5466
|
});
|
|
5467
5467
|
});
|
|
5468
5468
|
} else {
|
|
5469
|
-
const
|
|
5469
|
+
const h = this;
|
|
5470
5470
|
return z(function(...g) {
|
|
5471
|
-
const y =
|
|
5471
|
+
const y = h._def.args.safeParse(g, l);
|
|
5472
5472
|
if (!y.success)
|
|
5473
5473
|
throw new V([c(g, y.error)]);
|
|
5474
|
-
const
|
|
5474
|
+
const x = Reflect.apply(f, this, y.data), N = h._def.returns.safeParse(x, l);
|
|
5475
5475
|
if (!N.success)
|
|
5476
|
-
throw new V([u(
|
|
5476
|
+
throw new V([u(x, N.error)]);
|
|
5477
5477
|
return N.data;
|
|
5478
5478
|
});
|
|
5479
5479
|
}
|
|
@@ -5485,13 +5485,13 @@ class Be extends O {
|
|
|
5485
5485
|
return this._def.returns;
|
|
5486
5486
|
}
|
|
5487
5487
|
args(...r) {
|
|
5488
|
-
return new
|
|
5488
|
+
return new Ze({
|
|
5489
5489
|
...this._def,
|
|
5490
5490
|
args: te.create(r).rest(Ee.create())
|
|
5491
5491
|
});
|
|
5492
5492
|
}
|
|
5493
5493
|
returns(r) {
|
|
5494
|
-
return new
|
|
5494
|
+
return new Ze({
|
|
5495
5495
|
...this._def,
|
|
5496
5496
|
returns: r
|
|
5497
5497
|
});
|
|
@@ -5503,7 +5503,7 @@ class Be extends O {
|
|
|
5503
5503
|
return this.parse(r);
|
|
5504
5504
|
}
|
|
5505
5505
|
static create(r, i, c) {
|
|
5506
|
-
return new
|
|
5506
|
+
return new Ze({
|
|
5507
5507
|
args: r || te.create([]).rest(Ee.create()),
|
|
5508
5508
|
returns: i || Ee.create(),
|
|
5509
5509
|
typeName: S.ZodFunction,
|
|
@@ -5511,7 +5511,7 @@ class Be extends O {
|
|
|
5511
5511
|
});
|
|
5512
5512
|
}
|
|
5513
5513
|
}
|
|
5514
|
-
class
|
|
5514
|
+
class wt extends O {
|
|
5515
5515
|
get schema() {
|
|
5516
5516
|
return this._def.getter();
|
|
5517
5517
|
}
|
|
@@ -5520,12 +5520,12 @@ class vt extends O {
|
|
|
5520
5520
|
return this._def.getter()._parse({ data: i.data, path: i.path, parent: i });
|
|
5521
5521
|
}
|
|
5522
5522
|
}
|
|
5523
|
-
|
|
5523
|
+
wt.create = (a, r) => new wt({
|
|
5524
5524
|
getter: a,
|
|
5525
5525
|
typeName: S.ZodLazy,
|
|
5526
5526
|
...A(r)
|
|
5527
5527
|
});
|
|
5528
|
-
class
|
|
5528
|
+
class bt extends O {
|
|
5529
5529
|
_parse(r) {
|
|
5530
5530
|
if (r.data !== this._def.value) {
|
|
5531
5531
|
const i = this._getOrReturnCtx(r);
|
|
@@ -5541,7 +5541,7 @@ class wt extends O {
|
|
|
5541
5541
|
return this._def.value;
|
|
5542
5542
|
}
|
|
5543
5543
|
}
|
|
5544
|
-
|
|
5544
|
+
bt.create = (a, r) => new bt({
|
|
5545
5545
|
value: a,
|
|
5546
5546
|
typeName: S.ZodLiteral,
|
|
5547
5547
|
...A(r)
|
|
@@ -5555,7 +5555,7 @@ function vi(a, r) {
|
|
|
5555
5555
|
}
|
|
5556
5556
|
class pe extends O {
|
|
5557
5557
|
constructor() {
|
|
5558
|
-
super(...arguments),
|
|
5558
|
+
super(...arguments), lt.set(this, void 0);
|
|
5559
5559
|
}
|
|
5560
5560
|
_parse(r) {
|
|
5561
5561
|
if (typeof r.data != "string") {
|
|
@@ -5566,7 +5566,7 @@ class pe extends O {
|
|
|
5566
5566
|
code: w.invalid_type
|
|
5567
5567
|
}), T;
|
|
5568
5568
|
}
|
|
5569
|
-
if (
|
|
5569
|
+
if (Ft(this, lt) || pi(this, lt, new Set(this._def.values)), !Ft(this, lt).has(r.data)) {
|
|
5570
5570
|
const i = this._getOrReturnCtx(r), c = this._def.values;
|
|
5571
5571
|
return b(i, {
|
|
5572
5572
|
received: i.data,
|
|
@@ -5610,11 +5610,11 @@ class pe extends O {
|
|
|
5610
5610
|
});
|
|
5611
5611
|
}
|
|
5612
5612
|
}
|
|
5613
|
-
|
|
5613
|
+
lt = /* @__PURE__ */ new WeakMap();
|
|
5614
5614
|
pe.create = vi;
|
|
5615
|
-
class
|
|
5615
|
+
class _t extends O {
|
|
5616
5616
|
constructor() {
|
|
5617
|
-
super(...arguments),
|
|
5617
|
+
super(...arguments), dt.set(this, void 0);
|
|
5618
5618
|
}
|
|
5619
5619
|
_parse(r) {
|
|
5620
5620
|
const i = I.getValidEnumValues(this._def.values), c = this._getOrReturnCtx(r);
|
|
@@ -5626,7 +5626,7 @@ class bt extends O {
|
|
|
5626
5626
|
code: w.invalid_type
|
|
5627
5627
|
}), T;
|
|
5628
5628
|
}
|
|
5629
|
-
if (
|
|
5629
|
+
if (Ft(this, dt) || pi(this, dt, new Set(I.getValidEnumValues(this._def.values))), !Ft(this, dt).has(r.data)) {
|
|
5630
5630
|
const u = I.objectValues(i);
|
|
5631
5631
|
return b(c, {
|
|
5632
5632
|
received: c.data,
|
|
@@ -5640,13 +5640,13 @@ class bt extends O {
|
|
|
5640
5640
|
return this._def.values;
|
|
5641
5641
|
}
|
|
5642
5642
|
}
|
|
5643
|
-
|
|
5644
|
-
|
|
5643
|
+
dt = /* @__PURE__ */ new WeakMap();
|
|
5644
|
+
_t.create = (a, r) => new _t({
|
|
5645
5645
|
values: a,
|
|
5646
5646
|
typeName: S.ZodNativeEnum,
|
|
5647
5647
|
...A(r)
|
|
5648
5648
|
});
|
|
5649
|
-
class
|
|
5649
|
+
class Ve extends O {
|
|
5650
5650
|
unwrap() {
|
|
5651
5651
|
return this._def.type;
|
|
5652
5652
|
}
|
|
@@ -5665,7 +5665,7 @@ class Fe extends O {
|
|
|
5665
5665
|
})));
|
|
5666
5666
|
}
|
|
5667
5667
|
}
|
|
5668
|
-
|
|
5668
|
+
Ve.create = (a, r) => new Ve({
|
|
5669
5669
|
type: a,
|
|
5670
5670
|
typeName: S.ZodPromise,
|
|
5671
5671
|
...A(r)
|
|
@@ -5689,45 +5689,45 @@ class J extends O {
|
|
|
5689
5689
|
if (l.addIssue = l.addIssue.bind(l), u.type === "preprocess") {
|
|
5690
5690
|
const f = u.transform(c.data, l);
|
|
5691
5691
|
if (c.common.async)
|
|
5692
|
-
return Promise.resolve(f).then(async (
|
|
5692
|
+
return Promise.resolve(f).then(async (h) => {
|
|
5693
5693
|
if (i.value === "aborted")
|
|
5694
5694
|
return T;
|
|
5695
5695
|
const g = await this._def.schema._parseAsync({
|
|
5696
|
-
data:
|
|
5696
|
+
data: h,
|
|
5697
5697
|
path: c.path,
|
|
5698
5698
|
parent: c
|
|
5699
5699
|
});
|
|
5700
|
-
return g.status === "aborted" ? T : g.status === "dirty" || i.value === "dirty" ?
|
|
5700
|
+
return g.status === "aborted" ? T : g.status === "dirty" || i.value === "dirty" ? Pe(g.value) : g;
|
|
5701
5701
|
});
|
|
5702
5702
|
{
|
|
5703
5703
|
if (i.value === "aborted")
|
|
5704
5704
|
return T;
|
|
5705
|
-
const
|
|
5705
|
+
const h = this._def.schema._parseSync({
|
|
5706
5706
|
data: f,
|
|
5707
5707
|
path: c.path,
|
|
5708
5708
|
parent: c
|
|
5709
5709
|
});
|
|
5710
|
-
return
|
|
5710
|
+
return h.status === "aborted" ? T : h.status === "dirty" || i.value === "dirty" ? Pe(h.value) : h;
|
|
5711
5711
|
}
|
|
5712
5712
|
}
|
|
5713
5713
|
if (u.type === "refinement") {
|
|
5714
|
-
const f = (
|
|
5715
|
-
const g = u.refinement(
|
|
5714
|
+
const f = (h) => {
|
|
5715
|
+
const g = u.refinement(h, l);
|
|
5716
5716
|
if (c.common.async)
|
|
5717
5717
|
return Promise.resolve(g);
|
|
5718
5718
|
if (g instanceof Promise)
|
|
5719
5719
|
throw new Error("Async refinement encountered during synchronous parse operation. Use .parseAsync instead.");
|
|
5720
|
-
return
|
|
5720
|
+
return h;
|
|
5721
5721
|
};
|
|
5722
5722
|
if (c.common.async === !1) {
|
|
5723
|
-
const
|
|
5723
|
+
const h = this._def.schema._parseSync({
|
|
5724
5724
|
data: c.data,
|
|
5725
5725
|
path: c.path,
|
|
5726
5726
|
parent: c
|
|
5727
5727
|
});
|
|
5728
|
-
return
|
|
5728
|
+
return h.status === "aborted" ? T : (h.status === "dirty" && i.dirty(), f(h.value), { status: i.value, value: h.value });
|
|
5729
5729
|
} else
|
|
5730
|
-
return this._def.schema._parseAsync({ data: c.data, path: c.path, parent: c }).then((
|
|
5730
|
+
return this._def.schema._parseAsync({ data: c.data, path: c.path, parent: c }).then((h) => h.status === "aborted" ? T : (h.status === "dirty" && i.dirty(), f(h.value).then(() => ({ status: i.value, value: h.value }))));
|
|
5731
5731
|
}
|
|
5732
5732
|
if (u.type === "transform")
|
|
5733
5733
|
if (c.common.async === !1) {
|
|
@@ -5738,12 +5738,12 @@ class J extends O {
|
|
|
5738
5738
|
});
|
|
5739
5739
|
if (!Se(f))
|
|
5740
5740
|
return f;
|
|
5741
|
-
const
|
|
5742
|
-
if (
|
|
5741
|
+
const h = u.transform(f.value, l);
|
|
5742
|
+
if (h instanceof Promise)
|
|
5743
5743
|
throw new Error("Asynchronous transform encountered during synchronous parse operation. Use .parseAsync instead.");
|
|
5744
|
-
return { status: i.value, value:
|
|
5744
|
+
return { status: i.value, value: h };
|
|
5745
5745
|
} else
|
|
5746
|
-
return this._def.schema._parseAsync({ data: c.data, path: c.path, parent: c }).then((f) => Se(f) ? Promise.resolve(u.transform(f.value, l)).then((
|
|
5746
|
+
return this._def.schema._parseAsync({ data: c.data, path: c.path, parent: c }).then((f) => Se(f) ? Promise.resolve(u.transform(f.value, l)).then((h) => ({ status: i.value, value: h })) : f);
|
|
5747
5747
|
I.assertNever(u);
|
|
5748
5748
|
}
|
|
5749
5749
|
}
|
|
@@ -5785,7 +5785,7 @@ me.create = (a, r) => new me({
|
|
|
5785
5785
|
typeName: S.ZodNullable,
|
|
5786
5786
|
...A(r)
|
|
5787
5787
|
});
|
|
5788
|
-
class
|
|
5788
|
+
class xt extends O {
|
|
5789
5789
|
_parse(r) {
|
|
5790
5790
|
const { ctx: i } = this._processInputParams(r);
|
|
5791
5791
|
let c = i.data;
|
|
@@ -5799,13 +5799,13 @@ class _t extends O {
|
|
|
5799
5799
|
return this._def.innerType;
|
|
5800
5800
|
}
|
|
5801
5801
|
}
|
|
5802
|
-
|
|
5802
|
+
xt.create = (a, r) => new xt({
|
|
5803
5803
|
innerType: a,
|
|
5804
5804
|
typeName: S.ZodDefault,
|
|
5805
5805
|
defaultValue: typeof r.default == "function" ? r.default : () => r.default,
|
|
5806
5806
|
...A(r)
|
|
5807
5807
|
});
|
|
5808
|
-
class
|
|
5808
|
+
class kt extends O {
|
|
5809
5809
|
_parse(r) {
|
|
5810
5810
|
const { ctx: i } = this._processInputParams(r), c = {
|
|
5811
5811
|
...i,
|
|
@@ -5820,7 +5820,7 @@ class xt extends O {
|
|
|
5820
5820
|
...c
|
|
5821
5821
|
}
|
|
5822
5822
|
});
|
|
5823
|
-
return
|
|
5823
|
+
return ft(u) ? u.then((l) => ({
|
|
5824
5824
|
status: "valid",
|
|
5825
5825
|
value: l.status === "valid" ? l.value : this._def.catchValue({
|
|
5826
5826
|
get error() {
|
|
@@ -5842,13 +5842,13 @@ class xt extends O {
|
|
|
5842
5842
|
return this._def.innerType;
|
|
5843
5843
|
}
|
|
5844
5844
|
}
|
|
5845
|
-
|
|
5845
|
+
kt.create = (a, r) => new kt({
|
|
5846
5846
|
innerType: a,
|
|
5847
5847
|
typeName: S.ZodCatch,
|
|
5848
5848
|
catchValue: typeof r.catch == "function" ? r.catch : () => r.catch,
|
|
5849
5849
|
...A(r)
|
|
5850
5850
|
});
|
|
5851
|
-
class
|
|
5851
|
+
class Gt extends O {
|
|
5852
5852
|
_parse(r) {
|
|
5853
5853
|
if (this._getType(r) !== _.nan) {
|
|
5854
5854
|
const c = this._getOrReturnCtx(r);
|
|
@@ -5861,12 +5861,12 @@ class qt extends O {
|
|
|
5861
5861
|
return { status: "valid", value: r.data };
|
|
5862
5862
|
}
|
|
5863
5863
|
}
|
|
5864
|
-
|
|
5864
|
+
Gt.create = (a) => new Gt({
|
|
5865
5865
|
typeName: S.ZodNaN,
|
|
5866
5866
|
...A(a)
|
|
5867
5867
|
});
|
|
5868
5868
|
const Id = Symbol("zod_brand");
|
|
5869
|
-
class
|
|
5869
|
+
class $n extends O {
|
|
5870
5870
|
_parse(r) {
|
|
5871
5871
|
const { ctx: i } = this._processInputParams(r), c = i.data;
|
|
5872
5872
|
return this._def.type._parse({
|
|
@@ -5879,7 +5879,7 @@ class Rn extends O {
|
|
|
5879
5879
|
return this._def.type;
|
|
5880
5880
|
}
|
|
5881
5881
|
}
|
|
5882
|
-
class
|
|
5882
|
+
class St extends O {
|
|
5883
5883
|
_parse(r) {
|
|
5884
5884
|
const { status: i, ctx: c } = this._processInputParams(r);
|
|
5885
5885
|
if (c.common.async)
|
|
@@ -5889,7 +5889,7 @@ class Et extends O {
|
|
|
5889
5889
|
path: c.path,
|
|
5890
5890
|
parent: c
|
|
5891
5891
|
});
|
|
5892
|
-
return l.status === "aborted" ? T : l.status === "dirty" ? (i.dirty(),
|
|
5892
|
+
return l.status === "aborted" ? T : l.status === "dirty" ? (i.dirty(), Pe(l.value)) : this._def.out._parseAsync({
|
|
5893
5893
|
data: l.value,
|
|
5894
5894
|
path: c.path,
|
|
5895
5895
|
parent: c
|
|
@@ -5912,35 +5912,35 @@ class Et extends O {
|
|
|
5912
5912
|
}
|
|
5913
5913
|
}
|
|
5914
5914
|
static create(r, i) {
|
|
5915
|
-
return new
|
|
5915
|
+
return new St({
|
|
5916
5916
|
in: r,
|
|
5917
5917
|
out: i,
|
|
5918
5918
|
typeName: S.ZodPipeline
|
|
5919
5919
|
});
|
|
5920
5920
|
}
|
|
5921
5921
|
}
|
|
5922
|
-
class
|
|
5922
|
+
class Et extends O {
|
|
5923
5923
|
_parse(r) {
|
|
5924
5924
|
const i = this._def.innerType._parse(r), c = (u) => (Se(u) && (u.value = Object.freeze(u.value)), u);
|
|
5925
|
-
return
|
|
5925
|
+
return ft(i) ? i.then((u) => c(u)) : c(i);
|
|
5926
5926
|
}
|
|
5927
5927
|
unwrap() {
|
|
5928
5928
|
return this._def.innerType;
|
|
5929
5929
|
}
|
|
5930
5930
|
}
|
|
5931
|
-
|
|
5931
|
+
Et.create = (a, r) => new Et({
|
|
5932
5932
|
innerType: a,
|
|
5933
5933
|
typeName: S.ZodReadonly,
|
|
5934
5934
|
...A(r)
|
|
5935
5935
|
});
|
|
5936
5936
|
function wi(a, r = {}, i) {
|
|
5937
|
-
return a ?
|
|
5937
|
+
return a ? ze.create().superRefine((c, u) => {
|
|
5938
5938
|
var l, f;
|
|
5939
5939
|
if (!a(c)) {
|
|
5940
|
-
const
|
|
5940
|
+
const h = typeof r == "function" ? r(c) : typeof r == "string" ? { message: r } : r, g = (f = (l = h.fatal) !== null && l !== void 0 ? l : i) !== null && f !== void 0 ? f : !0, y = typeof h == "string" ? { message: h } : h;
|
|
5941
5941
|
u.addIssue({ code: "custom", ...y, fatal: g });
|
|
5942
5942
|
}
|
|
5943
|
-
}) :
|
|
5943
|
+
}) : ze.create();
|
|
5944
5944
|
}
|
|
5945
5945
|
const Md = {
|
|
5946
5946
|
object: C.lazycreate
|
|
@@ -5951,10 +5951,10 @@ var S;
|
|
|
5951
5951
|
})(S || (S = {}));
|
|
5952
5952
|
const $d = (a, r = {
|
|
5953
5953
|
message: `Input not instance of ${a.name}`
|
|
5954
|
-
}) => wi((i) => i instanceof a, r), bi = q.create, _i = fe.create, Rd =
|
|
5954
|
+
}) => wi((i) => i instanceof a, r), bi = q.create, _i = fe.create, Rd = Gt.create, Cd = he.create, xi = ht.create, Nd = Te.create, jd = Wt.create, Dd = pt.create, Ud = mt.create, Pd = ze.create, Zd = Ee.create, Bd = oe.create, Ld = Ht.create, zd = G.create, Vd = C.create, Fd = C.strictCreate, Wd = gt.create, Hd = Jt.create, qd = yt.create, Gd = te.create, Jd = vt.create, Kd = qt.create, Yd = Ae.create, Qd = Ze.create, Xd = wt.create, ef = bt.create, tf = pe.create, rf = _t.create, nf = Ve.create, oi = J.create, sf = X.create, af = me.create, of = J.createWithPreprocess, cf = St.create, uf = () => bi().optional(), lf = () => _i().optional(), df = () => xi().optional(), ff = {
|
|
5955
5955
|
string: (a) => q.create({ ...a, coerce: !0 }),
|
|
5956
5956
|
number: (a) => fe.create({ ...a, coerce: !0 }),
|
|
5957
|
-
boolean: (a) =>
|
|
5957
|
+
boolean: (a) => ht.create({
|
|
5958
5958
|
...a,
|
|
5959
5959
|
coerce: !0
|
|
5960
5960
|
}),
|
|
@@ -5963,25 +5963,25 @@ const $d = (a, r = {
|
|
|
5963
5963
|
}, hf = T;
|
|
5964
5964
|
var j = /* @__PURE__ */ Object.freeze({
|
|
5965
5965
|
__proto__: null,
|
|
5966
|
-
defaultErrorMap:
|
|
5966
|
+
defaultErrorMap: Le,
|
|
5967
5967
|
setErrorMap: ad,
|
|
5968
|
-
getErrorMap:
|
|
5969
|
-
makeIssue:
|
|
5968
|
+
getErrorMap: zt,
|
|
5969
|
+
makeIssue: Vt,
|
|
5970
5970
|
EMPTY_PATH: od,
|
|
5971
5971
|
addIssueToContext: b,
|
|
5972
5972
|
ParseStatus: L,
|
|
5973
5973
|
INVALID: T,
|
|
5974
|
-
DIRTY:
|
|
5974
|
+
DIRTY: Pe,
|
|
5975
5975
|
OK: z,
|
|
5976
|
-
isAborted:
|
|
5977
|
-
isDirty:
|
|
5976
|
+
isAborted: On,
|
|
5977
|
+
isDirty: In,
|
|
5978
5978
|
isValid: Se,
|
|
5979
|
-
isAsync:
|
|
5979
|
+
isAsync: ft,
|
|
5980
5980
|
get util() {
|
|
5981
5981
|
return I;
|
|
5982
5982
|
},
|
|
5983
5983
|
get objectUtil() {
|
|
5984
|
-
return
|
|
5984
|
+
return An;
|
|
5985
5985
|
},
|
|
5986
5986
|
ZodParsedType: _,
|
|
5987
5987
|
getParsedType: ae,
|
|
@@ -5990,41 +5990,41 @@ var j = /* @__PURE__ */ Object.freeze({
|
|
|
5990
5990
|
ZodString: q,
|
|
5991
5991
|
ZodNumber: fe,
|
|
5992
5992
|
ZodBigInt: he,
|
|
5993
|
-
ZodBoolean:
|
|
5993
|
+
ZodBoolean: ht,
|
|
5994
5994
|
ZodDate: Te,
|
|
5995
|
-
ZodSymbol:
|
|
5996
|
-
ZodUndefined:
|
|
5997
|
-
ZodNull:
|
|
5998
|
-
ZodAny:
|
|
5995
|
+
ZodSymbol: Wt,
|
|
5996
|
+
ZodUndefined: pt,
|
|
5997
|
+
ZodNull: mt,
|
|
5998
|
+
ZodAny: ze,
|
|
5999
5999
|
ZodUnknown: Ee,
|
|
6000
6000
|
ZodNever: oe,
|
|
6001
|
-
ZodVoid:
|
|
6001
|
+
ZodVoid: Ht,
|
|
6002
6002
|
ZodArray: G,
|
|
6003
6003
|
ZodObject: C,
|
|
6004
|
-
ZodUnion:
|
|
6005
|
-
ZodDiscriminatedUnion:
|
|
6006
|
-
ZodIntersection:
|
|
6004
|
+
ZodUnion: gt,
|
|
6005
|
+
ZodDiscriminatedUnion: Jt,
|
|
6006
|
+
ZodIntersection: yt,
|
|
6007
6007
|
ZodTuple: te,
|
|
6008
|
-
ZodRecord:
|
|
6009
|
-
ZodMap:
|
|
6008
|
+
ZodRecord: vt,
|
|
6009
|
+
ZodMap: qt,
|
|
6010
6010
|
ZodSet: Ae,
|
|
6011
|
-
ZodFunction:
|
|
6012
|
-
ZodLazy:
|
|
6013
|
-
ZodLiteral:
|
|
6011
|
+
ZodFunction: Ze,
|
|
6012
|
+
ZodLazy: wt,
|
|
6013
|
+
ZodLiteral: bt,
|
|
6014
6014
|
ZodEnum: pe,
|
|
6015
|
-
ZodNativeEnum:
|
|
6016
|
-
ZodPromise:
|
|
6015
|
+
ZodNativeEnum: _t,
|
|
6016
|
+
ZodPromise: Ve,
|
|
6017
6017
|
ZodEffects: J,
|
|
6018
6018
|
ZodTransformer: J,
|
|
6019
6019
|
ZodOptional: X,
|
|
6020
6020
|
ZodNullable: me,
|
|
6021
|
-
ZodDefault:
|
|
6022
|
-
ZodCatch:
|
|
6023
|
-
ZodNaN:
|
|
6021
|
+
ZodDefault: xt,
|
|
6022
|
+
ZodCatch: kt,
|
|
6023
|
+
ZodNaN: Gt,
|
|
6024
6024
|
BRAND: Id,
|
|
6025
|
-
ZodBranded:
|
|
6026
|
-
ZodPipeline:
|
|
6027
|
-
ZodReadonly:
|
|
6025
|
+
ZodBranded: $n,
|
|
6026
|
+
ZodPipeline: St,
|
|
6027
|
+
ZodReadonly: Et,
|
|
6028
6028
|
custom: wi,
|
|
6029
6029
|
Schema: O,
|
|
6030
6030
|
ZodSchema: O,
|
|
@@ -6039,7 +6039,7 @@ var j = /* @__PURE__ */ Object.freeze({
|
|
|
6039
6039
|
boolean: xi,
|
|
6040
6040
|
date: Nd,
|
|
6041
6041
|
discriminatedUnion: Hd,
|
|
6042
|
-
effect:
|
|
6042
|
+
effect: oi,
|
|
6043
6043
|
enum: tf,
|
|
6044
6044
|
function: Qd,
|
|
6045
6045
|
instanceof: $d,
|
|
@@ -6066,7 +6066,7 @@ var j = /* @__PURE__ */ Object.freeze({
|
|
|
6066
6066
|
strictObject: Fd,
|
|
6067
6067
|
string: bi,
|
|
6068
6068
|
symbol: jd,
|
|
6069
|
-
transformer:
|
|
6069
|
+
transformer: oi,
|
|
6070
6070
|
tuple: Gd,
|
|
6071
6071
|
undefined: Dd,
|
|
6072
6072
|
union: Wd,
|
|
@@ -6090,7 +6090,7 @@ const ge = H.getInstance(), pf = [
|
|
|
6090
6090
|
"chatTopic",
|
|
6091
6091
|
"userTopic",
|
|
6092
6092
|
"additionalProps"
|
|
6093
|
-
],
|
|
6093
|
+
], Rn = j.object({
|
|
6094
6094
|
id: j.string(),
|
|
6095
6095
|
targetMessageId: j.string().optional(),
|
|
6096
6096
|
type: j.nativeEnum(ki),
|
|
@@ -6112,7 +6112,7 @@ const ge = H.getInstance(), pf = [
|
|
|
6112
6112
|
reference: j.string(),
|
|
6113
6113
|
timestamp: j.number()
|
|
6114
6114
|
}), gf = j.object({
|
|
6115
|
-
message:
|
|
6115
|
+
message: Rn,
|
|
6116
6116
|
messageStateRefs: j.array(mf).nullable()
|
|
6117
6117
|
});
|
|
6118
6118
|
function Ei(a) {
|
|
@@ -6128,7 +6128,7 @@ function yf(a) {
|
|
|
6128
6128
|
return !0;
|
|
6129
6129
|
}
|
|
6130
6130
|
function vf(a) {
|
|
6131
|
-
const r =
|
|
6131
|
+
const r = Rn.safeParse(a);
|
|
6132
6132
|
return r.success ? Si(a) ? !0 : (ge.warn("Invalid message signature"), !1) : (ge.warn("Message data validation failed:", r.error.format()), !1);
|
|
6133
6133
|
}
|
|
6134
6134
|
function Si(a) {
|
|
@@ -6164,32 +6164,32 @@ function wf(a) {
|
|
|
6164
6164
|
function f(g, y = 0) {
|
|
6165
6165
|
if (y > l) return !1;
|
|
6166
6166
|
if (typeof g == "object" && g !== null && !Array.isArray(g)) {
|
|
6167
|
-
for (const
|
|
6168
|
-
if (!f(
|
|
6167
|
+
for (const x of Object.values(g))
|
|
6168
|
+
if (!f(x, y + 1)) return !1;
|
|
6169
6169
|
}
|
|
6170
6170
|
return !0;
|
|
6171
6171
|
}
|
|
6172
6172
|
f(a) || r.push(`Additional properties nested too deeply (max depth: ${l})`);
|
|
6173
6173
|
for (const [g, y] of Object.entries(a))
|
|
6174
6174
|
if (g.length > 100 && r.push(`Property key '${g}' too long (max: 100 characters)`), typeof y == "string" && y.length > 1e3 && r.push(`Property '${g}' value too long (max: 1000 characters)`), typeof y == "string") {
|
|
6175
|
-
const
|
|
6175
|
+
const x = [
|
|
6176
6176
|
/<script\b[^<]*(?:(?!<\/script>)<[^<]*)*<\/script>/gi,
|
|
6177
6177
|
/javascript:/gi,
|
|
6178
6178
|
/data:text\/html/gi,
|
|
6179
6179
|
/vbscript:/gi,
|
|
6180
6180
|
/on\w+\s*=/gi
|
|
6181
6181
|
];
|
|
6182
|
-
for (const N of
|
|
6182
|
+
for (const N of x)
|
|
6183
6183
|
if (N.test(y)) {
|
|
6184
6184
|
r.push(`Property '${g}' contains potentially dangerous content`);
|
|
6185
6185
|
break;
|
|
6186
6186
|
}
|
|
6187
6187
|
}
|
|
6188
|
-
const
|
|
6189
|
-
return Object.keys(a).length >
|
|
6188
|
+
const h = 20;
|
|
6189
|
+
return Object.keys(a).length > h && r.push(`Too many additional properties: ${Object.keys(a).length} (max: ${h})`), { isValid: r.length === 0, errors: r };
|
|
6190
6190
|
}
|
|
6191
6191
|
function bf(a) {
|
|
6192
|
-
const r =
|
|
6192
|
+
const r = Rn.safeParse(a);
|
|
6193
6193
|
if (!r.success) {
|
|
6194
6194
|
const i = r.error.issues.map(
|
|
6195
6195
|
(c) => c.path.length > 0 ? `${c.path.join(".")}: ${c.message}` : c.message
|
|
@@ -6222,7 +6222,7 @@ class _f {
|
|
|
6222
6222
|
}
|
|
6223
6223
|
return i;
|
|
6224
6224
|
} catch (r) {
|
|
6225
|
-
return this.errorHandler.handleError(r, "SwarmHistory.init"),
|
|
6225
|
+
return this.errorHandler.handleError(r, "SwarmHistory.init"), ci.fromBigInt(0n);
|
|
6226
6226
|
}
|
|
6227
6227
|
}
|
|
6228
6228
|
async initMessageState(r) {
|
|
@@ -6301,7 +6301,7 @@ class _f {
|
|
|
6301
6301
|
}
|
|
6302
6302
|
class xf {
|
|
6303
6303
|
constructor(r, i) {
|
|
6304
|
-
this.userDetails = r, this.swarmSettings = i, this.depth = 26, this.errorHandler = Q.getInstance()
|
|
6304
|
+
this.userDetails = r, this.swarmSettings = i, this.depth = 26, this.errorHandler = Q.getInstance();
|
|
6305
6305
|
}
|
|
6306
6306
|
generateUserOwnedFeedId(r, i) {
|
|
6307
6307
|
return `${r}_EthercastChat_${i}`;
|
|
@@ -6319,17 +6319,17 @@ class xf {
|
|
|
6319
6319
|
throw new Error("Enveloped mode is enabled, but stamp is not provided");
|
|
6320
6320
|
}
|
|
6321
6321
|
async writeOwnFeedDataByIndexOwned(r, i) {
|
|
6322
|
-
const { bee: c, stamp: u, chatTopic: l } = this.swarmSettings, { privateKey: f, ownAddress:
|
|
6322
|
+
const { bee: c, stamp: u, chatTopic: l } = this.swarmSettings, { privateKey: f, ownAddress: h } = this.userDetails, g = this.generateUserOwnedFeedId(l, h), y = ut.fromString(g);
|
|
6323
6323
|
await c.makeFeedWriter(y, new ke(f)).uploadPayload(u, JSON.stringify(i), {
|
|
6324
6324
|
index: r
|
|
6325
6325
|
});
|
|
6326
6326
|
}
|
|
6327
6327
|
// TODO: support for wrapped chunks
|
|
6328
6328
|
async writeOwnFeedDataByIndexEnvelope(r, i) {
|
|
6329
|
-
const { bee: c, stamp: u, chatTopic: l } = this.swarmSettings, { privateKey: f, ownAddress:
|
|
6330
|
-
hash: () =>
|
|
6331
|
-
},
|
|
6332
|
-
return (await Kt(
|
|
6329
|
+
const { bee: c, stamp: u, chatTopic: l } = this.swarmSettings, { privateKey: f, ownAddress: h } = this.userDetails, g = new ke(f), y = xn.fromBlank(f, u, this.depth), x = this.generateUserOwnedFeedId(l, h), N = ut.fromString(x), re = di(N, r), ne = si(i), Fe = ii(ne, re, g), Oe = {
|
|
6330
|
+
hash: () => Fe.address.toUint8Array()
|
|
6331
|
+
}, We = y.stamp(Oe), { upload: Kt } = c.makeSOCWriter(g), He = Ue.fromUtf8(i);
|
|
6332
|
+
return (await Kt(We, re, He.toUint8Array())).reference.toHex();
|
|
6333
6333
|
}
|
|
6334
6334
|
orderMessages(r) {
|
|
6335
6335
|
return r.sort((i, c) => i.timestamp - c.timestamp);
|
|
@@ -6360,11 +6360,11 @@ class xf {
|
|
|
6360
6360
|
}
|
|
6361
6361
|
async uploadObjectToBeeEnvelope(r) {
|
|
6362
6362
|
try {
|
|
6363
|
-
const { bee: i, stamp: c } = this.swarmSettings, { privateKey: u } = this.userDetails, l = xn.fromBlank(u, c, this.depth), f =
|
|
6363
|
+
const { bee: i, stamp: c } = this.swarmSettings, { privateKey: u } = this.userDetails, l = xn.fromBlank(u, c, this.depth), f = Ue.fromUtf8(JSON.stringify(r)), h = new Jl(async (y) => {
|
|
6364
6364
|
await i.uploadChunk(l.stamp(y), y.build());
|
|
6365
6365
|
});
|
|
6366
|
-
await
|
|
6367
|
-
const g = await
|
|
6366
|
+
await h.append(f.toUint8Array());
|
|
6367
|
+
const g = await h.finalize();
|
|
6368
6368
|
return B.uint8ArrayToHex(g.hash());
|
|
6369
6369
|
} catch (i) {
|
|
6370
6370
|
return this.errorHandler.handleError(i, "Utils.uploadObjectToBee"), null;
|
|
@@ -6372,8 +6372,10 @@ class xf {
|
|
|
6372
6372
|
}
|
|
6373
6373
|
async getOwnLatestFeedIndex() {
|
|
6374
6374
|
try {
|
|
6375
|
-
const { bee: r, chatTopic: i } = this.swarmSettings, { ownAddress:
|
|
6376
|
-
|
|
6375
|
+
const { bee: r, chatTopic: i, feedReadTimeout: c } = this.swarmSettings, { ownAddress: u } = this.userDetails, l = this.generateUserOwnedFeedId(i, u), f = ut.fromString(l), g = await r.makeFeedReader(f, u, {
|
|
6376
|
+
timeout: c
|
|
6377
|
+
}).downloadPayload(), y = Number(g.feedIndex.toBigInt()), x = y + 1;
|
|
6378
|
+
return { latestIndex: y, nextIndex: x };
|
|
6377
6379
|
} catch (r) {
|
|
6378
6380
|
if (this.isNotFoundError(r))
|
|
6379
6381
|
return { latestIndex: -1, nextIndex: 0 };
|
|
@@ -6381,14 +6383,10 @@ class xf {
|
|
|
6381
6383
|
}
|
|
6382
6384
|
}
|
|
6383
6385
|
async fetchLatestChatMessage() {
|
|
6384
|
-
const { bee: r, chatTopic: i, chatAddress: c } = this.swarmSettings,
|
|
6385
|
-
timeout:
|
|
6386
|
+
const { bee: r, chatTopic: i, chatAddress: c, feedReadTimeout: u } = this.swarmSettings, f = await r.makeFeedReader(ut.fromString(i), fi(c), {
|
|
6387
|
+
timeout: u
|
|
6386
6388
|
}).downloadPayload();
|
|
6387
|
-
return { data:
|
|
6388
|
-
}
|
|
6389
|
-
async fetchChatMessage(r) {
|
|
6390
|
-
const { bee: i, chatTopic: c, chatAddress: u } = this.swarmSettings;
|
|
6391
|
-
return (await i.makeFeedReader(De.fromString(c), Tn(u)).downloadPayload({ index: r })).payload.toJSON();
|
|
6389
|
+
return { data: f.payload.toJSON(), index: f.feedIndex };
|
|
6392
6390
|
}
|
|
6393
6391
|
async sendMessageToGsoc(r) {
|
|
6394
6392
|
const { enveloped: i, stamp: c } = this.swarmSettings;
|
|
@@ -6400,44 +6398,44 @@ class xf {
|
|
|
6400
6398
|
throw new Error("Enveloped mode is enabled, but stamp is not provided");
|
|
6401
6399
|
}
|
|
6402
6400
|
async rawSocDownload(r, i) {
|
|
6403
|
-
const { beeUrl: c } = this.swarmSettings,
|
|
6401
|
+
const { beeUrl: c, socReadTimeout: u } = this.swarmSettings, l = new AbortController(), f = setTimeout(() => l.abort(), u);
|
|
6404
6402
|
try {
|
|
6405
|
-
const
|
|
6403
|
+
const h = await fetch(`${c}/soc/${r}/${i}`, {
|
|
6406
6404
|
headers: {
|
|
6407
6405
|
"swarm-chunk-retrieval-timeout": "2000ms"
|
|
6408
6406
|
},
|
|
6409
|
-
signal:
|
|
6407
|
+
signal: l.signal
|
|
6410
6408
|
});
|
|
6411
|
-
if (!
|
|
6412
|
-
const
|
|
6413
|
-
throw
|
|
6409
|
+
if (!h.ok) {
|
|
6410
|
+
const g = new Error(`Failed to fetch: ${r}/${i} [${h.status}]`);
|
|
6411
|
+
throw g.status = h.status, g;
|
|
6414
6412
|
}
|
|
6415
|
-
return await
|
|
6416
|
-
} catch (
|
|
6417
|
-
throw
|
|
6413
|
+
return await h.text();
|
|
6414
|
+
} catch (h) {
|
|
6415
|
+
throw h.name === "AbortError" ? new Error(`Request timeout: ${r}/${i}`) : h;
|
|
6418
6416
|
} finally {
|
|
6419
|
-
clearTimeout(
|
|
6417
|
+
clearTimeout(f);
|
|
6420
6418
|
}
|
|
6421
6419
|
}
|
|
6422
6420
|
async sendMessageToGsocOwn(r) {
|
|
6423
|
-
const { bee: i, stamp: c, gsocTopic: u, gsocResourceId: l } = this.swarmSettings,
|
|
6424
|
-
timeout:
|
|
6421
|
+
const { bee: i, stamp: c, gsocTopic: u, gsocResourceId: l, gsocWriteTimeout: f } = this.swarmSettings, h = new ke(l), g = Lt.fromString(u), y = Ue.fromUtf8(r), { upload: x } = i.makeSOCWriter(h, {
|
|
6422
|
+
timeout: f
|
|
6425
6423
|
});
|
|
6426
|
-
await
|
|
6424
|
+
await x(c, g, y.toUint8Array());
|
|
6427
6425
|
}
|
|
6428
6426
|
async sendMessageToGsocEnvelope(r) {
|
|
6429
|
-
const { bee: i, stamp: c, gsocTopic: u, gsocResourceId: l } = this.swarmSettings, { privateKey:
|
|
6430
|
-
hash: () =>
|
|
6431
|
-
},
|
|
6432
|
-
timeout:
|
|
6427
|
+
const { bee: i, stamp: c, gsocTopic: u, gsocResourceId: l, gsocWriteTimeout: f } = this.swarmSettings, { privateKey: h } = this.userDetails, g = xn.fromBlank(h, c, this.depth), y = new ke(l), x = Lt.fromString(u), N = Ue.fromUtf8(r), re = si(N.toUint8Array()), ne = ii(re, x, y), Fe = {
|
|
6428
|
+
hash: () => ne.address.toUint8Array()
|
|
6429
|
+
}, Oe = g.stamp(Fe), { upload: We } = i.makeSOCWriter(y, {
|
|
6430
|
+
timeout: f
|
|
6433
6431
|
});
|
|
6434
|
-
await Oe
|
|
6432
|
+
await We(Oe, x, N.toUint8Array());
|
|
6435
6433
|
}
|
|
6436
6434
|
}
|
|
6437
6435
|
class Ef {
|
|
6438
6436
|
constructor(r, i) {
|
|
6439
6437
|
this.fallbackTransport = null, this.logger = H.getInstance(), this.errorHandler = Q.getInstance(), this.gsocIndex = null;
|
|
6440
|
-
const c = new ke(
|
|
6438
|
+
const c = new ke(fi(r.user.privateKey));
|
|
6441
6439
|
this.userDetails = {
|
|
6442
6440
|
privateKey: r.user.privateKey,
|
|
6443
6441
|
ownAddress: c.publicKey().address().toString(),
|
|
@@ -6452,7 +6450,10 @@ class Ef {
|
|
|
6452
6450
|
gsocTopic: r.infra.gsocTopic,
|
|
6453
6451
|
gsocResourceId: r.infra.gsocResourceId,
|
|
6454
6452
|
chatTopic: r.infra.chatTopic,
|
|
6455
|
-
chatAddress: r.infra.chatAddress
|
|
6453
|
+
chatAddress: r.infra.chatAddress,
|
|
6454
|
+
feedReadTimeout: r.infra.feedReadTimeout || 12e3,
|
|
6455
|
+
gsocWriteTimeout: r.infra.gsocWriteTimeout || 2e3,
|
|
6456
|
+
socReadTimeout: r.infra.socReadTimeout || 5e3
|
|
6456
6457
|
}, this.emitter = new sd(), this.utils = new xf(this.userDetails, this.swarmSettings), this.history = new _f(this.utils, this.emitter);
|
|
6457
6458
|
const u = r.infra.pollingInterval || 1e3;
|
|
6458
6459
|
i ? (this.transport = i, r.infra.enableFallbackPolling && (this.logger.info(`Fallback polling enabled with interval: ${u}ms`), this.fallbackTransport = this.createDefaultPollingTransport(u), this.fallbackTransport.onMessage((l) => {
|
|
@@ -6467,7 +6468,7 @@ class Ef {
|
|
|
6467
6468
|
try {
|
|
6468
6469
|
if (!this.gsocIndex)
|
|
6469
6470
|
return null;
|
|
6470
|
-
const i =
|
|
6471
|
+
const i = ut.fromString(this.swarmSettings.chatTopic), c = di(i, this.gsocIndex), u = await this.utils.rawSocDownload(this.swarmSettings.chatAddress, c.toString()), l = JSON.parse(u);
|
|
6471
6472
|
return Ei(l) ? (this.gsocIndex = this.gsocIndex.next(), l.message) : (this.logger.warn("Invalid GSOC message during fetching"), null);
|
|
6472
6473
|
} catch (i) {
|
|
6473
6474
|
if (this.utils.isNotFoundError(i))
|
|
@@ -6491,7 +6492,7 @@ class Ef {
|
|
|
6491
6492
|
return this.utils.orderMessages(r);
|
|
6492
6493
|
}
|
|
6493
6494
|
async sendMessage(r, i, c, u, l) {
|
|
6494
|
-
const f = this.userDetails.ownIndex === -1 ? 0 : this.userDetails.ownIndex + 1,
|
|
6495
|
+
const f = this.userDetails.ownIndex === -1 ? 0 : this.userDetails.ownIndex + 1, h = {
|
|
6495
6496
|
id: u || Hl(),
|
|
6496
6497
|
username: this.userDetails.nickname,
|
|
6497
6498
|
address: this.userDetails.ownAddress,
|
|
@@ -6504,15 +6505,15 @@ class Ef {
|
|
|
6504
6505
|
targetMessageId: c,
|
|
6505
6506
|
message: r,
|
|
6506
6507
|
additionalProps: l
|
|
6507
|
-
}, g = bf(
|
|
6508
|
+
}, g = bf(h);
|
|
6508
6509
|
if (!g.isValid) {
|
|
6509
6510
|
const y = `Invalid message: ${g.errors.join(", ")}`;
|
|
6510
6511
|
throw this.logger.error(y), new Error(y);
|
|
6511
6512
|
}
|
|
6512
6513
|
try {
|
|
6513
|
-
this.emitter.emit(W.MESSAGE_REQUEST_INITIATED,
|
|
6514
|
+
this.emitter.emit(W.MESSAGE_REQUEST_INITIATED, h), await this.utils.writeOwnFeedDataByIndex(f, JSON.stringify(h)), this.userDetails.ownIndex = f, this.emitter.emit(W.MESSAGE_REQUEST_UPLOADED, h), await this.broadcastUserMessage(h);
|
|
6514
6515
|
} catch (y) {
|
|
6515
|
-
this.emitter.emit(W.MESSAGE_REQUEST_ERROR,
|
|
6516
|
+
this.emitter.emit(W.MESSAGE_REQUEST_ERROR, h), this.errorHandler.handleError(y, "Chat.sendMessage");
|
|
6516
6517
|
}
|
|
6517
6518
|
}
|
|
6518
6519
|
async fetchPreviousMessages() {
|
|
@@ -6543,12 +6544,12 @@ class Ef {
|
|
|
6543
6544
|
}
|
|
6544
6545
|
}
|
|
6545
6546
|
async initOwnIndex() {
|
|
6546
|
-
const { latestIndex: c } = await
|
|
6547
|
+
const { latestIndex: c } = await Tn(() => this.utils.getOwnLatestFeedIndex(), 10, 1e3);
|
|
6547
6548
|
this.userDetails.ownIndex = c;
|
|
6548
6549
|
}
|
|
6549
6550
|
async broadcastUserMessage(r) {
|
|
6550
6551
|
try {
|
|
6551
|
-
return
|
|
6552
|
+
return Tn(() => this.utils.sendMessageToGsoc(JSON.stringify(r)));
|
|
6552
6553
|
} catch (i) {
|
|
6553
6554
|
this.errorHandler.handleError(i, "Chat.broadcastUserMessage");
|
|
6554
6555
|
}
|