@solarpunkltd/swarm-chat-js 6.2.0 → 6.2.1
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 +234 -225
- package/dist/index.js +1 -1
- package/dist/interfaces/chat.d.ts +2 -0
- package/dist/interfaces/chat.d.ts.map +1 -1
- package/dist/lib/core.d.ts +1 -0
- package/dist/lib/core.d.ts.map +1 -1
- package/dist/swarm-chat-umd.js +10 -10
- package/package.json +1 -1
package/dist/index.esm.js
CHANGED
|
@@ -23,11 +23,11 @@ function Hl(a, r, i) {
|
|
|
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);
|
|
25
25
|
}
|
|
26
|
-
class
|
|
26
|
+
class H {
|
|
27
27
|
constructor() {
|
|
28
28
|
}
|
|
29
29
|
static getInstance() {
|
|
30
|
-
return
|
|
30
|
+
return H.instance || (H.instance = new H()), H.instance;
|
|
31
31
|
}
|
|
32
32
|
formatMessage(r, ...i) {
|
|
33
33
|
return `[${(/* @__PURE__ */ new Date()).toISOString()}] [${r.toUpperCase()}] - ${i.map((u) => typeof u == "object" ? JSON.stringify(u) : u).join(" ")}`;
|
|
@@ -50,7 +50,7 @@ class W {
|
|
|
50
50
|
}
|
|
51
51
|
class Q {
|
|
52
52
|
constructor() {
|
|
53
|
-
this.logger =
|
|
53
|
+
this.logger = H.getInstance();
|
|
54
54
|
}
|
|
55
55
|
static getInstance() {
|
|
56
56
|
return Q.instance || (Q.instance = new Q()), Q.instance;
|
|
@@ -64,7 +64,7 @@ class Q {
|
|
|
64
64
|
}
|
|
65
65
|
class ql {
|
|
66
66
|
constructor(r) {
|
|
67
|
-
this.config = r, this.logger =
|
|
67
|
+
this.config = r, this.logger = H.getInstance(), this.errorHandler = Q.getInstance(), this.isRunning = !1, this.stopRequested = !1, this.messageCallback = null;
|
|
68
68
|
}
|
|
69
69
|
onMessage(r) {
|
|
70
70
|
this.messageCallback = r;
|
|
@@ -108,7 +108,7 @@ var di = {};
|
|
|
108
108
|
return i(Promise.all(e.map(i)));
|
|
109
109
|
}
|
|
110
110
|
async function u(e, t = 1) {
|
|
111
|
-
const n =
|
|
111
|
+
const n = As(e, t), s = [], o = n.map(async (d) => {
|
|
112
112
|
for (const f of d) s.push(await f());
|
|
113
113
|
});
|
|
114
114
|
return await Promise.all(o), s;
|
|
@@ -186,17 +186,17 @@ var di = {};
|
|
|
186
186
|
function Nn(e, t, n = Math.random) {
|
|
187
187
|
return n() * (t - e) + e;
|
|
188
188
|
}
|
|
189
|
-
function
|
|
189
|
+
function Ti() {
|
|
190
190
|
return Math.random() * 2 - 1;
|
|
191
191
|
}
|
|
192
|
-
function
|
|
192
|
+
function Ai(e, t, n) {
|
|
193
193
|
return t >= e.x && t < e.x + e.width && n >= e.y && n < e.y + e.height;
|
|
194
194
|
}
|
|
195
195
|
function Oi(e, t, n, s = Math.random) {
|
|
196
196
|
let o, d;
|
|
197
197
|
do
|
|
198
198
|
o = He(0, e - 1, s), d = He(0, t - 1, s);
|
|
199
|
-
while (n &&
|
|
199
|
+
while (n && Ai(n, o, d));
|
|
200
200
|
return [o, d];
|
|
201
201
|
}
|
|
202
202
|
function Ii(e, t = Math.random) {
|
|
@@ -380,7 +380,7 @@ var di = {};
|
|
|
380
380
|
function Me(e) {
|
|
381
381
|
return Object.prototype.toString.call(e) === "[object Date]";
|
|
382
382
|
}
|
|
383
|
-
function
|
|
383
|
+
function Tt(e) {
|
|
384
384
|
return !F(e) || e.trim().length === 0;
|
|
385
385
|
}
|
|
386
386
|
function er(e) {
|
|
@@ -454,7 +454,7 @@ var di = {};
|
|
|
454
454
|
return e;
|
|
455
455
|
}
|
|
456
456
|
function Fn(e, t) {
|
|
457
|
-
if (
|
|
457
|
+
if (Tt(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}`
|
|
@@ -485,7 +485,7 @@ 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
|
|
488
|
+
function At(e, t) {
|
|
489
489
|
if (ue(e)) return t && Wn(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);
|
|
@@ -493,7 +493,7 @@ var di = {};
|
|
|
493
493
|
return t && Wn(n, t), n;
|
|
494
494
|
}
|
|
495
495
|
function nr(e, t) {
|
|
496
|
-
return
|
|
496
|
+
return At(e, t) | 0;
|
|
497
497
|
}
|
|
498
498
|
function ha(e, t) {
|
|
499
499
|
if (e === "true") return !0;
|
|
@@ -506,7 +506,7 @@ var di = {};
|
|
|
506
506
|
return e;
|
|
507
507
|
}
|
|
508
508
|
function ma(e) {
|
|
509
|
-
return
|
|
509
|
+
return Tt(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);
|
|
@@ -563,7 +563,7 @@ var di = {};
|
|
|
563
563
|
function Sa(e, t) {
|
|
564
564
|
return t == null ? null : e(t);
|
|
565
565
|
}
|
|
566
|
-
function
|
|
566
|
+
function Ta(e, t) {
|
|
567
567
|
return t == null ? void 0 : e(t);
|
|
568
568
|
}
|
|
569
569
|
function qn(e, t) {
|
|
@@ -571,7 +571,7 @@ var di = {};
|
|
|
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
|
-
function
|
|
574
|
+
function Aa(e, t) {
|
|
575
575
|
return e.every((n) => qn(n, t));
|
|
576
576
|
}
|
|
577
577
|
function Ge(e, t = "json", n = 0) {
|
|
@@ -961,7 +961,7 @@ var di = {};
|
|
|
961
961
|
s = e.indexOf(o, s) + d.length, e = e.replace(o, d);
|
|
962
962
|
}
|
|
963
963
|
}
|
|
964
|
-
function
|
|
964
|
+
function To(e, t) {
|
|
965
965
|
const n = [];
|
|
966
966
|
let s = 0;
|
|
967
967
|
for (; s < e.length; ) {
|
|
@@ -979,7 +979,7 @@ var di = {};
|
|
|
979
979
|
}
|
|
980
980
|
return n;
|
|
981
981
|
}
|
|
982
|
-
function
|
|
982
|
+
function Ao(e) {
|
|
983
983
|
const t = [];
|
|
984
984
|
let n = 0;
|
|
985
985
|
for (; n < e.length; ) {
|
|
@@ -1239,7 +1239,7 @@ var di = {};
|
|
|
1239
1239
|
}
|
|
1240
1240
|
function Ko(e, t, n, s) {
|
|
1241
1241
|
const o = e.find((f) => f[t] === n), d = e.find((f) => f[t] === n + s);
|
|
1242
|
-
o && d ? (o[t] = n + s, d[t] = n) : o && (o[t] = n + s), e.sort((f, v) =>
|
|
1242
|
+
o && d ? (o[t] = n + s, d[t] = n) : o && (o[t] = n + s), e.sort((f, v) => At(f[t]) - At(v[t])), e.forEach((f, v) => f[t] = v + 1);
|
|
1243
1243
|
}
|
|
1244
1244
|
function Yo(e) {
|
|
1245
1245
|
const t = Object.keys(e);
|
|
@@ -1300,14 +1300,14 @@ var di = {};
|
|
|
1300
1300
|
function uc(e) {
|
|
1301
1301
|
return new Date(e);
|
|
1302
1302
|
}
|
|
1303
|
-
function
|
|
1303
|
+
function K(e) {
|
|
1304
1304
|
return String(Math.floor(e)).padStart(2, "0");
|
|
1305
1305
|
}
|
|
1306
1306
|
function lc(e) {
|
|
1307
1307
|
let [t, n] = e.split(":");
|
|
1308
1308
|
ue(parseInt(t, 10)) || (t = "0"), ue(parseInt(n, 10)) || (n = "0");
|
|
1309
1309
|
let s = gr(nr(t), 0, 23), o = gr(nr(n), 0, 59);
|
|
1310
|
-
return `${
|
|
1310
|
+
return `${K(s)}:${K(o)}`;
|
|
1311
1311
|
}
|
|
1312
1312
|
function Ct(e) {
|
|
1313
1313
|
const t = Math.floor(e / 36e5);
|
|
@@ -1315,13 +1315,13 @@ var di = {};
|
|
|
1315
1315
|
const n = Math.floor(e / 6e4);
|
|
1316
1316
|
e = e % 6e4;
|
|
1317
1317
|
const s = Math.floor(e / 1e3);
|
|
1318
|
-
return t ? `${
|
|
1318
|
+
return t ? `${K(t)}:${K(n)}:${K(s)}` : `${K(n)}:${K(s)}`;
|
|
1319
1319
|
}
|
|
1320
1320
|
function be(e) {
|
|
1321
1321
|
return Math.floor((Me(e) ? e.getTime() : e) / 864e5);
|
|
1322
1322
|
}
|
|
1323
1323
|
const dc = {
|
|
1324
|
-
today: (e, t) =>
|
|
1324
|
+
today: (e, t) => K(e) + ":" + K(t),
|
|
1325
1325
|
yesterday: () => "Yesterday",
|
|
1326
1326
|
monday: () => "Mon",
|
|
1327
1327
|
tuesday: () => "Tue",
|
|
@@ -1431,14 +1431,14 @@ var di = {};
|
|
|
1431
1431
|
year: 31536e6,
|
|
1432
1432
|
years: 31536e6
|
|
1433
1433
|
};
|
|
1434
|
-
function
|
|
1434
|
+
function Tc(e) {
|
|
1435
1435
|
const t = parseFloat(e);
|
|
1436
1436
|
if (isNaN(t)) throw Error("makeDate got NaN for input");
|
|
1437
1437
|
const n = e.replace(/^-?[0-9.]+/, "").trim().toLowerCase(), s = Sc[n];
|
|
1438
1438
|
if (!s) throw Error(`Unknown unit: "${n}"`);
|
|
1439
1439
|
return t * s;
|
|
1440
1440
|
}
|
|
1441
|
-
const
|
|
1441
|
+
const Ac = {
|
|
1442
1442
|
b: 1,
|
|
1443
1443
|
byte: 1,
|
|
1444
1444
|
bytes: 1,
|
|
@@ -1458,7 +1458,7 @@ var di = {};
|
|
|
1458
1458
|
function Oc(e) {
|
|
1459
1459
|
const t = parseFloat(e);
|
|
1460
1460
|
if (isNaN(t)) throw Error("makeDate got NaN for input");
|
|
1461
|
-
const n = e.replace(/^-?[0-9.]+/, "").trim().toLowerCase(), s =
|
|
1461
|
+
const n = e.replace(/^-?[0-9.]+/, "").trim().toLowerCase(), s = Ac[n];
|
|
1462
1462
|
if (!s) throw Error(`Unknown unit: "${n}"`);
|
|
1463
1463
|
return t * s;
|
|
1464
1464
|
}
|
|
@@ -1640,7 +1640,7 @@ var di = {};
|
|
|
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]) && Tt(t[1])) && delete e[t[0]];
|
|
1644
1644
|
return e;
|
|
1645
1645
|
}
|
|
1646
1646
|
function ru(e, t) {
|
|
@@ -1730,7 +1730,7 @@ var di = {};
|
|
|
1730
1730
|
function pu(e, t, n) {
|
|
1731
1731
|
return t[e] ? t[e] : n;
|
|
1732
1732
|
}
|
|
1733
|
-
function
|
|
1733
|
+
function Ts(e, t) {
|
|
1734
1734
|
const n = {};
|
|
1735
1735
|
for (const s of e) {
|
|
1736
1736
|
const o = t(s);
|
|
@@ -1751,7 +1751,7 @@ 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 As(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;
|
|
@@ -1766,7 +1766,7 @@ var di = {};
|
|
|
1766
1766
|
return Os(e, n);
|
|
1767
1767
|
}
|
|
1768
1768
|
function vu(e, t) {
|
|
1769
|
-
return Object.values(
|
|
1769
|
+
return Object.values(Ts(e, t));
|
|
1770
1770
|
}
|
|
1771
1771
|
function wu(e, t, n, s, o) {
|
|
1772
1772
|
const d = t ? e.map(t) : e, f = {};
|
|
@@ -1825,10 +1825,10 @@ var di = {};
|
|
|
1825
1825
|
o && e.map.delete(o);
|
|
1826
1826
|
}
|
|
1827
1827
|
}
|
|
1828
|
-
function
|
|
1828
|
+
function Tu(e, t, n, s, o = 100) {
|
|
1829
1829
|
Ms(e, t, { validUntil: Date.now() + s, data: n }, o);
|
|
1830
1830
|
}
|
|
1831
|
-
function
|
|
1831
|
+
function Au(e, t) {
|
|
1832
1832
|
const n = e.map.get(t);
|
|
1833
1833
|
return n && n.validUntil > Date.now() ? n.data : null;
|
|
1834
1834
|
}
|
|
@@ -2081,8 +2081,8 @@ var di = {};
|
|
|
2081
2081
|
for (let t = 0; t < 24; t++) {
|
|
2082
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], f = 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], x = 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 = f << 1 | v >>> 31, $l = v << 1 | f >>> 31, tt = n ^ Ml, rt = s ^ $l, Rl = m << 1 | x >>> 31, Cl = x << 1 | m >>> 31, nt = o ^ Rl, st = d ^ Cl, Nl = M << 1 | U >>> 31, jl = U << 1 | M >>> 31, it = f ^ Nl, at = v ^ jl, Dl = n << 1 | s >>> 31, Ul = s << 1 | n >>> 31, ot = m ^ Dl, ct = x ^ 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
|
-
const Sr = e[0],
|
|
2085
|
-
e[0] = Sr ^ ~Ur & Jr, e[1] =
|
|
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] ^= js[t * 2], e[1] ^= js[t * 2 + 1];
|
|
2086
2086
|
}
|
|
2087
2087
|
}
|
|
2088
2088
|
function Ds(e) {
|
|
@@ -2369,37 +2369,37 @@ var di = {};
|
|
|
2369
2369
|
}
|
|
2370
2370
|
a.MerkleTree = _r, r = _r, _r.NOOP = async (e) => {
|
|
2371
2371
|
};
|
|
2372
|
-
class
|
|
2372
|
+
class Y {
|
|
2373
2373
|
constructor(t, n) {
|
|
2374
2374
|
if (n < 0) throw Error("Scale must be non-negative");
|
|
2375
2375
|
this.value = BigInt(t), this.scale = n;
|
|
2376
2376
|
}
|
|
2377
2377
|
static fromDecimalString(t, n) {
|
|
2378
2378
|
let [s, o] = t.split(".");
|
|
2379
|
-
return o = (o || "").padEnd(n, "0").slice(0, n), new
|
|
2379
|
+
return o = (o || "").padEnd(n, "0").slice(0, n), new Y(BigInt(s + o), n);
|
|
2380
2380
|
}
|
|
2381
2381
|
add(t) {
|
|
2382
|
-
return this.assertSameScale(t), new
|
|
2382
|
+
return this.assertSameScale(t), new Y(this.value + t.value, this.scale);
|
|
2383
2383
|
}
|
|
2384
2384
|
subtract(t) {
|
|
2385
|
-
return this.assertSameScale(t), new
|
|
2385
|
+
return this.assertSameScale(t), new Y(this.value - t.value, this.scale);
|
|
2386
2386
|
}
|
|
2387
2387
|
multiply(t) {
|
|
2388
|
-
return new
|
|
2388
|
+
return new Y(this.value * t, this.scale);
|
|
2389
2389
|
}
|
|
2390
2390
|
divmod(t) {
|
|
2391
2391
|
if (t === 0n) throw new Error("Division by zero is not allowed");
|
|
2392
2392
|
const n = this.value / t, s = this.value % t;
|
|
2393
|
-
return [new
|
|
2393
|
+
return [new Y(n, this.scale), new Y(s, this.scale)];
|
|
2394
2394
|
}
|
|
2395
2395
|
exchange(t, n, s) {
|
|
2396
2396
|
if (t === "*") {
|
|
2397
2397
|
const d = this.value * n.value / 10n ** BigInt(this.scale);
|
|
2398
|
-
return new
|
|
2398
|
+
return new Y(d, s);
|
|
2399
2399
|
}
|
|
2400
2400
|
this.assertSameScale(n);
|
|
2401
2401
|
const o = this.value * 10n ** BigInt(s) / n.value;
|
|
2402
|
-
return new
|
|
2402
|
+
return new Y(o, s);
|
|
2403
2403
|
}
|
|
2404
2404
|
compare(t) {
|
|
2405
2405
|
return this.assertSameScale(t), this.value > t.value ? 1 : this.value < t.value ? -1 : 0;
|
|
@@ -2419,7 +2419,7 @@ var di = {};
|
|
|
2419
2419
|
if (this.scale !== t.scale) throw new Error(`Scale mismatch: expected ${this.scale}, but got ${t.scale}`);
|
|
2420
2420
|
}
|
|
2421
2421
|
}
|
|
2422
|
-
a.FixedPointNumber =
|
|
2422
|
+
a.FixedPointNumber = Y;
|
|
2423
2423
|
function hl(e) {
|
|
2424
2424
|
if (e.length === 0) return null;
|
|
2425
2425
|
const t = e[0];
|
|
@@ -2572,7 +2572,7 @@ var di = {};
|
|
|
2572
2572
|
function Sl(e, t) {
|
|
2573
2573
|
return Math.atan2(t.y - e.y, t.x - e.x);
|
|
2574
2574
|
}
|
|
2575
|
-
function
|
|
2575
|
+
function Tl(e, t) {
|
|
2576
2576
|
return t.map((n) => Sl(e, n)).sort((n, s) => n - s);
|
|
2577
2577
|
}
|
|
2578
2578
|
function ti(e, t, n, s) {
|
|
@@ -2593,8 +2593,8 @@ var di = {};
|
|
|
2593
2593
|
return v < m ? f : d;
|
|
2594
2594
|
}) : null;
|
|
2595
2595
|
}
|
|
2596
|
-
function
|
|
2597
|
-
const s =
|
|
2596
|
+
function Al(e, t, n) {
|
|
2597
|
+
const s = Tl(e, n), o = [];
|
|
2598
2598
|
for (const d of s) {
|
|
2599
2599
|
const f = kr(e, t, d - 1e-3), v = kr(e, t, d + 1e-3);
|
|
2600
2600
|
f && o.push(f), v && o.push(v);
|
|
@@ -2699,7 +2699,7 @@ var di = {};
|
|
|
2699
2699
|
intBetween: He,
|
|
2700
2700
|
floatBetween: Nn,
|
|
2701
2701
|
chance: jn,
|
|
2702
|
-
signed:
|
|
2702
|
+
signed: Ti,
|
|
2703
2703
|
makeSeededRng: Kt,
|
|
2704
2704
|
point: Oi,
|
|
2705
2705
|
procs: Ii
|
|
@@ -2707,8 +2707,8 @@ var di = {};
|
|
|
2707
2707
|
countUnique: wu,
|
|
2708
2708
|
makeUnique: vu,
|
|
2709
2709
|
splitBySize: gu,
|
|
2710
|
-
splitByCount:
|
|
2711
|
-
index:
|
|
2710
|
+
splitByCount: As,
|
|
2711
|
+
index: Ts,
|
|
2712
2712
|
indexCollection: mu,
|
|
2713
2713
|
onlyOrThrow: p,
|
|
2714
2714
|
onlyOrNull: g,
|
|
@@ -2796,7 +2796,7 @@ var di = {};
|
|
|
2796
2796
|
getProgress: vc,
|
|
2797
2797
|
humanizeTime: Ct,
|
|
2798
2798
|
humanizeProgress: tc,
|
|
2799
|
-
createTimeDigits:
|
|
2799
|
+
createTimeDigits: K,
|
|
2800
2800
|
mapDayNumber: vs,
|
|
2801
2801
|
getDayInfoFromDate: hr,
|
|
2802
2802
|
getDayInfoFromDateTimeString: bc,
|
|
@@ -2804,7 +2804,7 @@ var di = {};
|
|
|
2804
2804
|
minutes: xc,
|
|
2805
2805
|
hours: kc,
|
|
2806
2806
|
days: Ec,
|
|
2807
|
-
make:
|
|
2807
|
+
make: Tc,
|
|
2808
2808
|
normalizeTime: lc,
|
|
2809
2809
|
absoluteDays: be
|
|
2810
2810
|
}, a.Objects = {
|
|
@@ -2853,8 +2853,8 @@ var di = {};
|
|
|
2853
2853
|
createTemporalBidirectionalMap: Eu,
|
|
2854
2854
|
pushToBidirectionalMap: Ms,
|
|
2855
2855
|
unshiftToBidirectionalMap: Su,
|
|
2856
|
-
addToTemporalBidirectionalMap:
|
|
2857
|
-
getFromTemporalBidirectionalMap:
|
|
2856
|
+
addToTemporalBidirectionalMap: Tu,
|
|
2857
|
+
getFromTemporalBidirectionalMap: Au,
|
|
2858
2858
|
createStatefulToggle: Bc,
|
|
2859
2859
|
diffKeys: zc,
|
|
2860
2860
|
pickRandomKey: ks,
|
|
@@ -2878,7 +2878,7 @@ var di = {};
|
|
|
2878
2878
|
isNumber: ue,
|
|
2879
2879
|
isBoolean: Pn,
|
|
2880
2880
|
isDate: Me,
|
|
2881
|
-
isBlank:
|
|
2881
|
+
isBlank: Tt,
|
|
2882
2882
|
isId: er,
|
|
2883
2883
|
isIntegerString: Zn,
|
|
2884
2884
|
isHexString: Bn,
|
|
@@ -2888,7 +2888,7 @@ var di = {};
|
|
|
2888
2888
|
asHexString: la,
|
|
2889
2889
|
asSafeString: da,
|
|
2890
2890
|
asIntegerString: ua,
|
|
2891
|
-
asNumber:
|
|
2891
|
+
asNumber: At,
|
|
2892
2892
|
asFunction: fa,
|
|
2893
2893
|
asInteger: nr,
|
|
2894
2894
|
asBoolean: ha,
|
|
@@ -2904,9 +2904,9 @@ var di = {};
|
|
|
2904
2904
|
asNumericDictionary: xa,
|
|
2905
2905
|
asUrl: ka,
|
|
2906
2906
|
asNullable: Sa,
|
|
2907
|
-
asOptional:
|
|
2907
|
+
asOptional: Ta,
|
|
2908
2908
|
enforceObjectShape: qn,
|
|
2909
|
-
enforceArrayShape:
|
|
2909
|
+
enforceArrayShape: Aa,
|
|
2910
2910
|
isPng: Rs,
|
|
2911
2911
|
isJpg: Cs,
|
|
2912
2912
|
isWebp: Ns,
|
|
@@ -2985,8 +2985,8 @@ var di = {};
|
|
|
2985
2985
|
describeMarkdown: Cc,
|
|
2986
2986
|
isBalanced: Nc,
|
|
2987
2987
|
textToFormat: jc,
|
|
2988
|
-
splitFormatting:
|
|
2989
|
-
splitHashtags:
|
|
2988
|
+
splitFormatting: To,
|
|
2989
|
+
splitHashtags: Ao,
|
|
2990
2990
|
splitUrls: Oo,
|
|
2991
2991
|
route: jo,
|
|
2992
2992
|
explodeReplace: lr,
|
|
@@ -3008,7 +3008,7 @@ var di = {};
|
|
|
3008
3008
|
findCorners: kl,
|
|
3009
3009
|
findLines: El,
|
|
3010
3010
|
raycast: kr,
|
|
3011
|
-
raycastCircle:
|
|
3011
|
+
raycastCircle: Al,
|
|
3012
3012
|
getLineIntersectionPoint: ti
|
|
3013
3013
|
};
|
|
3014
3014
|
})(di);
|
|
@@ -3084,20 +3084,20 @@ function ai(a, r, i) {
|
|
|
3084
3084
|
owner: i.publicKey().address()
|
|
3085
3085
|
};
|
|
3086
3086
|
}
|
|
3087
|
-
const td =
|
|
3087
|
+
const td = H.getInstance(), rd = Q.getInstance();
|
|
3088
3088
|
function nd(a) {
|
|
3089
3089
|
return new Promise((r) => {
|
|
3090
3090
|
setTimeout(r, a);
|
|
3091
3091
|
});
|
|
3092
3092
|
}
|
|
3093
|
-
function
|
|
3093
|
+
function Tn(a) {
|
|
3094
3094
|
return (a.startsWith("0x") ? a.slice(2) : a).toLowerCase();
|
|
3095
3095
|
}
|
|
3096
|
-
async function
|
|
3096
|
+
async function An(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
|
+
An(a, r - 1, i).then(c).catch(u);
|
|
3101
3101
|
}, i)) : (rd.handleError(l, "Utils.retryAwaitableAsync"), u(l));
|
|
3102
3102
|
});
|
|
3103
3103
|
});
|
|
@@ -3401,7 +3401,7 @@ class L {
|
|
|
3401
3401
|
const c = [];
|
|
3402
3402
|
for (const u of i) {
|
|
3403
3403
|
if (u.status === "aborted")
|
|
3404
|
-
return
|
|
3404
|
+
return T;
|
|
3405
3405
|
u.status === "dirty" && r.dirty(), c.push(u.value);
|
|
3406
3406
|
}
|
|
3407
3407
|
return { status: r.value, value: c };
|
|
@@ -3422,13 +3422,13 @@ class L {
|
|
|
3422
3422
|
for (const u of i) {
|
|
3423
3423
|
const { key: l, value: h } = u;
|
|
3424
3424
|
if (l.status === "aborted" || h.status === "aborted")
|
|
3425
|
-
return
|
|
3425
|
+
return T;
|
|
3426
3426
|
l.status === "dirty" && r.dirty(), h.status === "dirty" && r.dirty(), l.value !== "__proto__" && (typeof h.value < "u" || u.alwaysSet) && (c[l.value] = h.value);
|
|
3427
3427
|
}
|
|
3428
3428
|
return { status: r.value, value: c };
|
|
3429
3429
|
}
|
|
3430
3430
|
}
|
|
3431
|
-
const
|
|
3431
|
+
const T = Object.freeze({
|
|
3432
3432
|
status: "aborted"
|
|
3433
3433
|
}), Ze = (a) => ({ status: "dirty", value: a }), z = (a) => ({ status: "valid", value: a }), In = (a) => a.status === "aborted", Mn = (a) => a.status === "dirty", Se = (a) => a.status === "valid", dt = (a) => typeof Promise < "u" && a instanceof Promise;
|
|
3434
3434
|
function Vt(a, r, i, c) {
|
|
@@ -3467,7 +3467,7 @@ const oi = (a, r) => {
|
|
|
3467
3467
|
}
|
|
3468
3468
|
};
|
|
3469
3469
|
};
|
|
3470
|
-
function
|
|
3470
|
+
function A(a) {
|
|
3471
3471
|
if (!a)
|
|
3472
3472
|
return {};
|
|
3473
3473
|
const { errorMap: r, invalid_type_error: i, required_error: c, description: u } = a;
|
|
@@ -3609,7 +3609,7 @@ class O {
|
|
|
3609
3609
|
return this._refinement((c, u) => r(c) ? !0 : (u.addIssue(typeof i == "function" ? i(c, u) : i), !1));
|
|
3610
3610
|
}
|
|
3611
3611
|
_refinement(r) {
|
|
3612
|
-
return new
|
|
3612
|
+
return new J({
|
|
3613
3613
|
schema: this,
|
|
3614
3614
|
typeName: S.ZodEffects,
|
|
3615
3615
|
effect: { type: "refinement", refinement: r }
|
|
@@ -3635,7 +3635,7 @@ class O {
|
|
|
3635
3635
|
return this.nullable().optional();
|
|
3636
3636
|
}
|
|
3637
3637
|
array() {
|
|
3638
|
-
return
|
|
3638
|
+
return G.create(this);
|
|
3639
3639
|
}
|
|
3640
3640
|
promise() {
|
|
3641
3641
|
return Fe.create(this, this._def);
|
|
@@ -3647,8 +3647,8 @@ class O {
|
|
|
3647
3647
|
return gt.create(this, r, this._def);
|
|
3648
3648
|
}
|
|
3649
3649
|
transform(r) {
|
|
3650
|
-
return new
|
|
3651
|
-
...
|
|
3650
|
+
return new J({
|
|
3651
|
+
...A(this._def),
|
|
3652
3652
|
schema: this,
|
|
3653
3653
|
typeName: S.ZodEffects,
|
|
3654
3654
|
effect: { type: "transform", transform: r }
|
|
@@ -3657,7 +3657,7 @@ class O {
|
|
|
3657
3657
|
default(r) {
|
|
3658
3658
|
const i = typeof r == "function" ? r : () => r;
|
|
3659
3659
|
return new _t({
|
|
3660
|
-
...
|
|
3660
|
+
...A(this._def),
|
|
3661
3661
|
innerType: this,
|
|
3662
3662
|
defaultValue: i,
|
|
3663
3663
|
typeName: S.ZodDefault
|
|
@@ -3667,13 +3667,13 @@ class O {
|
|
|
3667
3667
|
return new Rn({
|
|
3668
3668
|
typeName: S.ZodBranded,
|
|
3669
3669
|
type: this,
|
|
3670
|
-
...
|
|
3670
|
+
...A(this._def)
|
|
3671
3671
|
});
|
|
3672
3672
|
}
|
|
3673
3673
|
catch(r) {
|
|
3674
3674
|
const i = typeof r == "function" ? r : () => r;
|
|
3675
3675
|
return new xt({
|
|
3676
|
-
...
|
|
3676
|
+
...A(this._def),
|
|
3677
3677
|
innerType: this,
|
|
3678
3678
|
catchValue: i,
|
|
3679
3679
|
typeName: S.ZodCatch
|
|
@@ -3717,7 +3717,7 @@ function yi(a) {
|
|
|
3717
3717
|
function Sd(a, r) {
|
|
3718
3718
|
return !!((r === "v4" || !r) && yd.test(a) || (r === "v6" || !r) && wd.test(a));
|
|
3719
3719
|
}
|
|
3720
|
-
function
|
|
3720
|
+
function Td(a, r) {
|
|
3721
3721
|
if (!hd.test(a))
|
|
3722
3722
|
return !1;
|
|
3723
3723
|
try {
|
|
@@ -3727,10 +3727,10 @@ function Ad(a, r) {
|
|
|
3727
3727
|
return !1;
|
|
3728
3728
|
}
|
|
3729
3729
|
}
|
|
3730
|
-
function
|
|
3730
|
+
function Ad(a, r) {
|
|
3731
3731
|
return !!((r === "v4" || !r) && vd.test(a) || (r === "v6" || !r) && bd.test(a));
|
|
3732
3732
|
}
|
|
3733
|
-
class
|
|
3733
|
+
class q extends O {
|
|
3734
3734
|
_parse(r) {
|
|
3735
3735
|
if (this._def.coerce && (r.data = String(r.data)), this._getType(r) !== _.string) {
|
|
3736
3736
|
const l = this._getOrReturnCtx(r);
|
|
@@ -3738,7 +3738,7 @@ class H extends O {
|
|
|
3738
3738
|
code: w.invalid_type,
|
|
3739
3739
|
expected: _.string,
|
|
3740
3740
|
received: l.parsedType
|
|
3741
|
-
}),
|
|
3741
|
+
}), T;
|
|
3742
3742
|
}
|
|
3743
3743
|
const c = new L();
|
|
3744
3744
|
let u;
|
|
@@ -3866,11 +3866,11 @@ class H extends O {
|
|
|
3866
3866
|
validation: "ip",
|
|
3867
3867
|
code: w.invalid_string,
|
|
3868
3868
|
message: l.message
|
|
3869
|
-
}), c.dirty()) : l.kind === "jwt" ?
|
|
3869
|
+
}), c.dirty()) : l.kind === "jwt" ? Td(r.data, l.alg) || (u = this._getOrReturnCtx(r, u), b(u, {
|
|
3870
3870
|
validation: "jwt",
|
|
3871
3871
|
code: w.invalid_string,
|
|
3872
3872
|
message: l.message
|
|
3873
|
-
}), c.dirty()) : l.kind === "cidr" ?
|
|
3873
|
+
}), c.dirty()) : l.kind === "cidr" ? Ad(r.data, l.version) || (u = this._getOrReturnCtx(r, u), b(u, {
|
|
3874
3874
|
validation: "cidr",
|
|
3875
3875
|
code: w.invalid_string,
|
|
3876
3876
|
message: l.message
|
|
@@ -3893,7 +3893,7 @@ class H extends O {
|
|
|
3893
3893
|
});
|
|
3894
3894
|
}
|
|
3895
3895
|
_addCheck(r) {
|
|
3896
|
-
return new
|
|
3896
|
+
return new q({
|
|
3897
3897
|
...this._def,
|
|
3898
3898
|
checks: [...this._def.checks, r]
|
|
3899
3899
|
});
|
|
@@ -4030,19 +4030,19 @@ class H extends O {
|
|
|
4030
4030
|
return this.min(1, k.errToObj(r));
|
|
4031
4031
|
}
|
|
4032
4032
|
trim() {
|
|
4033
|
-
return new
|
|
4033
|
+
return new q({
|
|
4034
4034
|
...this._def,
|
|
4035
4035
|
checks: [...this._def.checks, { kind: "trim" }]
|
|
4036
4036
|
});
|
|
4037
4037
|
}
|
|
4038
4038
|
toLowerCase() {
|
|
4039
|
-
return new
|
|
4039
|
+
return new q({
|
|
4040
4040
|
...this._def,
|
|
4041
4041
|
checks: [...this._def.checks, { kind: "toLowerCase" }]
|
|
4042
4042
|
});
|
|
4043
4043
|
}
|
|
4044
4044
|
toUpperCase() {
|
|
4045
|
-
return new
|
|
4045
|
+
return new q({
|
|
4046
4046
|
...this._def,
|
|
4047
4047
|
checks: [...this._def.checks, { kind: "toUpperCase" }]
|
|
4048
4048
|
});
|
|
@@ -4108,13 +4108,13 @@ class H extends O {
|
|
|
4108
4108
|
return r;
|
|
4109
4109
|
}
|
|
4110
4110
|
}
|
|
4111
|
-
|
|
4111
|
+
q.create = (a) => {
|
|
4112
4112
|
var r;
|
|
4113
|
-
return new
|
|
4113
|
+
return new q({
|
|
4114
4114
|
checks: [],
|
|
4115
4115
|
typeName: S.ZodString,
|
|
4116
4116
|
coerce: (r = a == null ? void 0 : a.coerce) !== null && r !== void 0 ? r : !1,
|
|
4117
|
-
...
|
|
4117
|
+
...A(a)
|
|
4118
4118
|
});
|
|
4119
4119
|
};
|
|
4120
4120
|
function Od(a, r) {
|
|
@@ -4132,7 +4132,7 @@ class fe extends O {
|
|
|
4132
4132
|
code: w.invalid_type,
|
|
4133
4133
|
expected: _.number,
|
|
4134
4134
|
received: l.parsedType
|
|
4135
|
-
}),
|
|
4135
|
+
}), T;
|
|
4136
4136
|
}
|
|
4137
4137
|
let c;
|
|
4138
4138
|
const u = new L();
|
|
@@ -4291,7 +4291,7 @@ fe.create = (a) => new fe({
|
|
|
4291
4291
|
checks: [],
|
|
4292
4292
|
typeName: S.ZodNumber,
|
|
4293
4293
|
coerce: (a == null ? void 0 : a.coerce) || !1,
|
|
4294
|
-
...
|
|
4294
|
+
...A(a)
|
|
4295
4295
|
});
|
|
4296
4296
|
class he extends O {
|
|
4297
4297
|
constructor() {
|
|
@@ -4334,7 +4334,7 @@ class he extends O {
|
|
|
4334
4334
|
code: w.invalid_type,
|
|
4335
4335
|
expected: _.bigint,
|
|
4336
4336
|
received: i.parsedType
|
|
4337
|
-
}),
|
|
4337
|
+
}), T;
|
|
4338
4338
|
}
|
|
4339
4339
|
gte(r, i) {
|
|
4340
4340
|
return this.setLimit("min", r, !0, k.toString(i));
|
|
@@ -4426,7 +4426,7 @@ he.create = (a) => {
|
|
|
4426
4426
|
checks: [],
|
|
4427
4427
|
typeName: S.ZodBigInt,
|
|
4428
4428
|
coerce: (r = a == null ? void 0 : a.coerce) !== null && r !== void 0 ? r : !1,
|
|
4429
|
-
...
|
|
4429
|
+
...A(a)
|
|
4430
4430
|
});
|
|
4431
4431
|
};
|
|
4432
4432
|
class ft extends O {
|
|
@@ -4437,7 +4437,7 @@ class ft extends O {
|
|
|
4437
4437
|
code: w.invalid_type,
|
|
4438
4438
|
expected: _.boolean,
|
|
4439
4439
|
received: c.parsedType
|
|
4440
|
-
}),
|
|
4440
|
+
}), T;
|
|
4441
4441
|
}
|
|
4442
4442
|
return z(r.data);
|
|
4443
4443
|
}
|
|
@@ -4445,9 +4445,9 @@ class ft extends O {
|
|
|
4445
4445
|
ft.create = (a) => new ft({
|
|
4446
4446
|
typeName: S.ZodBoolean,
|
|
4447
4447
|
coerce: (a == null ? void 0 : a.coerce) || !1,
|
|
4448
|
-
...
|
|
4448
|
+
...A(a)
|
|
4449
4449
|
});
|
|
4450
|
-
class
|
|
4450
|
+
class Te extends O {
|
|
4451
4451
|
_parse(r) {
|
|
4452
4452
|
if (this._def.coerce && (r.data = new Date(r.data)), this._getType(r) !== _.date) {
|
|
4453
4453
|
const l = this._getOrReturnCtx(r);
|
|
@@ -4455,13 +4455,13 @@ class Ae extends O {
|
|
|
4455
4455
|
code: w.invalid_type,
|
|
4456
4456
|
expected: _.date,
|
|
4457
4457
|
received: l.parsedType
|
|
4458
|
-
}),
|
|
4458
|
+
}), T;
|
|
4459
4459
|
}
|
|
4460
4460
|
if (isNaN(r.data.getTime())) {
|
|
4461
4461
|
const l = this._getOrReturnCtx(r);
|
|
4462
4462
|
return b(l, {
|
|
4463
4463
|
code: w.invalid_date
|
|
4464
|
-
}),
|
|
4464
|
+
}), T;
|
|
4465
4465
|
}
|
|
4466
4466
|
const c = new L();
|
|
4467
4467
|
let u;
|
|
@@ -4487,7 +4487,7 @@ class Ae extends O {
|
|
|
4487
4487
|
};
|
|
4488
4488
|
}
|
|
4489
4489
|
_addCheck(r) {
|
|
4490
|
-
return new
|
|
4490
|
+
return new Te({
|
|
4491
4491
|
...this._def,
|
|
4492
4492
|
checks: [...this._def.checks, r]
|
|
4493
4493
|
});
|
|
@@ -4519,11 +4519,11 @@ class Ae extends O {
|
|
|
4519
4519
|
return r != null ? new Date(r) : null;
|
|
4520
4520
|
}
|
|
4521
4521
|
}
|
|
4522
|
-
|
|
4522
|
+
Te.create = (a) => new Te({
|
|
4523
4523
|
checks: [],
|
|
4524
4524
|
coerce: (a == null ? void 0 : a.coerce) || !1,
|
|
4525
4525
|
typeName: S.ZodDate,
|
|
4526
|
-
...
|
|
4526
|
+
...A(a)
|
|
4527
4527
|
});
|
|
4528
4528
|
class Ft extends O {
|
|
4529
4529
|
_parse(r) {
|
|
@@ -4533,14 +4533,14 @@ class Ft extends O {
|
|
|
4533
4533
|
code: w.invalid_type,
|
|
4534
4534
|
expected: _.symbol,
|
|
4535
4535
|
received: c.parsedType
|
|
4536
|
-
}),
|
|
4536
|
+
}), T;
|
|
4537
4537
|
}
|
|
4538
4538
|
return z(r.data);
|
|
4539
4539
|
}
|
|
4540
4540
|
}
|
|
4541
4541
|
Ft.create = (a) => new Ft({
|
|
4542
4542
|
typeName: S.ZodSymbol,
|
|
4543
|
-
...
|
|
4543
|
+
...A(a)
|
|
4544
4544
|
});
|
|
4545
4545
|
class ht extends O {
|
|
4546
4546
|
_parse(r) {
|
|
@@ -4550,14 +4550,14 @@ class ht extends O {
|
|
|
4550
4550
|
code: w.invalid_type,
|
|
4551
4551
|
expected: _.undefined,
|
|
4552
4552
|
received: c.parsedType
|
|
4553
|
-
}),
|
|
4553
|
+
}), T;
|
|
4554
4554
|
}
|
|
4555
4555
|
return z(r.data);
|
|
4556
4556
|
}
|
|
4557
4557
|
}
|
|
4558
4558
|
ht.create = (a) => new ht({
|
|
4559
4559
|
typeName: S.ZodUndefined,
|
|
4560
|
-
...
|
|
4560
|
+
...A(a)
|
|
4561
4561
|
});
|
|
4562
4562
|
class pt extends O {
|
|
4563
4563
|
_parse(r) {
|
|
@@ -4567,14 +4567,14 @@ class pt extends O {
|
|
|
4567
4567
|
code: w.invalid_type,
|
|
4568
4568
|
expected: _.null,
|
|
4569
4569
|
received: c.parsedType
|
|
4570
|
-
}),
|
|
4570
|
+
}), T;
|
|
4571
4571
|
}
|
|
4572
4572
|
return z(r.data);
|
|
4573
4573
|
}
|
|
4574
4574
|
}
|
|
4575
4575
|
pt.create = (a) => new pt({
|
|
4576
4576
|
typeName: S.ZodNull,
|
|
4577
|
-
...
|
|
4577
|
+
...A(a)
|
|
4578
4578
|
});
|
|
4579
4579
|
class Ve extends O {
|
|
4580
4580
|
constructor() {
|
|
@@ -4586,7 +4586,7 @@ class Ve extends O {
|
|
|
4586
4586
|
}
|
|
4587
4587
|
Ve.create = (a) => new Ve({
|
|
4588
4588
|
typeName: S.ZodAny,
|
|
4589
|
-
...
|
|
4589
|
+
...A(a)
|
|
4590
4590
|
});
|
|
4591
4591
|
class Ee extends O {
|
|
4592
4592
|
constructor() {
|
|
@@ -4598,7 +4598,7 @@ class Ee extends O {
|
|
|
4598
4598
|
}
|
|
4599
4599
|
Ee.create = (a) => new Ee({
|
|
4600
4600
|
typeName: S.ZodUnknown,
|
|
4601
|
-
...
|
|
4601
|
+
...A(a)
|
|
4602
4602
|
});
|
|
4603
4603
|
class oe extends O {
|
|
4604
4604
|
_parse(r) {
|
|
@@ -4607,12 +4607,12 @@ class oe extends O {
|
|
|
4607
4607
|
code: w.invalid_type,
|
|
4608
4608
|
expected: _.never,
|
|
4609
4609
|
received: i.parsedType
|
|
4610
|
-
}),
|
|
4610
|
+
}), T;
|
|
4611
4611
|
}
|
|
4612
4612
|
}
|
|
4613
4613
|
oe.create = (a) => new oe({
|
|
4614
4614
|
typeName: S.ZodNever,
|
|
4615
|
-
...
|
|
4615
|
+
...A(a)
|
|
4616
4616
|
});
|
|
4617
4617
|
class Wt extends O {
|
|
4618
4618
|
_parse(r) {
|
|
@@ -4622,16 +4622,16 @@ class Wt extends O {
|
|
|
4622
4622
|
code: w.invalid_type,
|
|
4623
4623
|
expected: _.void,
|
|
4624
4624
|
received: c.parsedType
|
|
4625
|
-
}),
|
|
4625
|
+
}), T;
|
|
4626
4626
|
}
|
|
4627
4627
|
return z(r.data);
|
|
4628
4628
|
}
|
|
4629
4629
|
}
|
|
4630
4630
|
Wt.create = (a) => new Wt({
|
|
4631
4631
|
typeName: S.ZodVoid,
|
|
4632
|
-
...
|
|
4632
|
+
...A(a)
|
|
4633
4633
|
});
|
|
4634
|
-
class
|
|
4634
|
+
class G extends O {
|
|
4635
4635
|
_parse(r) {
|
|
4636
4636
|
const { ctx: i, status: c } = this._processInputParams(r), u = this._def;
|
|
4637
4637
|
if (i.parsedType !== _.array)
|
|
@@ -4639,7 +4639,7 @@ class q extends O {
|
|
|
4639
4639
|
code: w.invalid_type,
|
|
4640
4640
|
expected: _.array,
|
|
4641
4641
|
received: i.parsedType
|
|
4642
|
-
}),
|
|
4642
|
+
}), T;
|
|
4643
4643
|
if (u.exactLength !== null) {
|
|
4644
4644
|
const h = i.data.length > u.exactLength.value, p = i.data.length < u.exactLength.value;
|
|
4645
4645
|
(h || p) && (b(i, {
|
|
@@ -4675,19 +4675,19 @@ class q extends O {
|
|
|
4675
4675
|
return this._def.type;
|
|
4676
4676
|
}
|
|
4677
4677
|
min(r, i) {
|
|
4678
|
-
return new
|
|
4678
|
+
return new G({
|
|
4679
4679
|
...this._def,
|
|
4680
4680
|
minLength: { value: r, message: k.toString(i) }
|
|
4681
4681
|
});
|
|
4682
4682
|
}
|
|
4683
4683
|
max(r, i) {
|
|
4684
|
-
return new
|
|
4684
|
+
return new G({
|
|
4685
4685
|
...this._def,
|
|
4686
4686
|
maxLength: { value: r, message: k.toString(i) }
|
|
4687
4687
|
});
|
|
4688
4688
|
}
|
|
4689
4689
|
length(r, i) {
|
|
4690
|
-
return new
|
|
4690
|
+
return new G({
|
|
4691
4691
|
...this._def,
|
|
4692
4692
|
exactLength: { value: r, message: k.toString(i) }
|
|
4693
4693
|
});
|
|
@@ -4696,13 +4696,13 @@ class q extends O {
|
|
|
4696
4696
|
return this.min(1, r);
|
|
4697
4697
|
}
|
|
4698
4698
|
}
|
|
4699
|
-
|
|
4699
|
+
G.create = (a, r) => new G({
|
|
4700
4700
|
type: a,
|
|
4701
4701
|
minLength: null,
|
|
4702
4702
|
maxLength: null,
|
|
4703
4703
|
exactLength: null,
|
|
4704
4704
|
typeName: S.ZodArray,
|
|
4705
|
-
...
|
|
4705
|
+
...A(r)
|
|
4706
4706
|
});
|
|
4707
4707
|
function Ue(a) {
|
|
4708
4708
|
if (a instanceof C) {
|
|
@@ -4715,7 +4715,7 @@ function Ue(a) {
|
|
|
4715
4715
|
...a._def,
|
|
4716
4716
|
shape: () => r
|
|
4717
4717
|
});
|
|
4718
|
-
} else return a instanceof
|
|
4718
|
+
} else return a instanceof G ? new G({
|
|
4719
4719
|
...a._def,
|
|
4720
4720
|
type: Ue(a.element)
|
|
4721
4721
|
}) : a instanceof X ? X.create(Ue(a.unwrap())) : a instanceof me ? me.create(Ue(a.unwrap())) : a instanceof te ? te.create(a.items.map((r) => Ue(r))) : a;
|
|
@@ -4737,7 +4737,7 @@ class C extends O {
|
|
|
4737
4737
|
code: w.invalid_type,
|
|
4738
4738
|
expected: _.object,
|
|
4739
4739
|
received: y.parsedType
|
|
4740
|
-
}),
|
|
4740
|
+
}), T;
|
|
4741
4741
|
}
|
|
4742
4742
|
const { status: c, ctx: u } = this._processInputParams(r), { shape: l, keys: h } = this._getCached(), p = [];
|
|
4743
4743
|
if (!(this._def.catchall instanceof oe && this._def.unknownKeys === "strip"))
|
|
@@ -4991,21 +4991,21 @@ C.create = (a, r) => new C({
|
|
|
4991
4991
|
unknownKeys: "strip",
|
|
4992
4992
|
catchall: oe.create(),
|
|
4993
4993
|
typeName: S.ZodObject,
|
|
4994
|
-
...
|
|
4994
|
+
...A(r)
|
|
4995
4995
|
});
|
|
4996
4996
|
C.strictCreate = (a, r) => new C({
|
|
4997
4997
|
shape: () => a,
|
|
4998
4998
|
unknownKeys: "strict",
|
|
4999
4999
|
catchall: oe.create(),
|
|
5000
5000
|
typeName: S.ZodObject,
|
|
5001
|
-
...
|
|
5001
|
+
...A(r)
|
|
5002
5002
|
});
|
|
5003
5003
|
C.lazycreate = (a, r) => new C({
|
|
5004
5004
|
shape: a,
|
|
5005
5005
|
unknownKeys: "strip",
|
|
5006
5006
|
catchall: oe.create(),
|
|
5007
5007
|
typeName: S.ZodObject,
|
|
5008
|
-
...
|
|
5008
|
+
...A(r)
|
|
5009
5009
|
});
|
|
5010
5010
|
class mt extends O {
|
|
5011
5011
|
_parse(r) {
|
|
@@ -5021,7 +5021,7 @@ class mt extends O {
|
|
|
5021
5021
|
return b(i, {
|
|
5022
5022
|
code: w.invalid_union,
|
|
5023
5023
|
unionErrors: h
|
|
5024
|
-
}),
|
|
5024
|
+
}), T;
|
|
5025
5025
|
}
|
|
5026
5026
|
if (i.common.async)
|
|
5027
5027
|
return Promise.all(c.map(async (l) => {
|
|
@@ -5068,7 +5068,7 @@ class mt extends O {
|
|
|
5068
5068
|
return b(i, {
|
|
5069
5069
|
code: w.invalid_union,
|
|
5070
5070
|
unionErrors: p
|
|
5071
|
-
}),
|
|
5071
|
+
}), T;
|
|
5072
5072
|
}
|
|
5073
5073
|
}
|
|
5074
5074
|
get options() {
|
|
@@ -5078,9 +5078,9 @@ class mt extends O {
|
|
|
5078
5078
|
mt.create = (a, r) => new mt({
|
|
5079
5079
|
options: a,
|
|
5080
5080
|
typeName: S.ZodUnion,
|
|
5081
|
-
...
|
|
5081
|
+
...A(r)
|
|
5082
5082
|
});
|
|
5083
|
-
const ie = (a) => a instanceof vt ? ie(a.schema) : a instanceof
|
|
5083
|
+
const ie = (a) => a instanceof vt ? ie(a.schema) : a instanceof J ? ie(a.innerType()) : a instanceof wt ? [a.value] : a instanceof pe ? a.options : a instanceof bt ? I.objectValues(a.enum) : a instanceof _t ? ie(a._def.innerType) : a instanceof ht ? [void 0] : a instanceof pt ? [null] : a instanceof X ? [void 0, ...ie(a.unwrap())] : a instanceof me ? [null, ...ie(a.unwrap())] : a instanceof Rn || a instanceof kt ? ie(a.unwrap()) : a instanceof xt ? ie(a._def.innerType) : [];
|
|
5084
5084
|
class Gt extends O {
|
|
5085
5085
|
_parse(r) {
|
|
5086
5086
|
const { ctx: i } = this._processInputParams(r);
|
|
@@ -5089,7 +5089,7 @@ class Gt extends O {
|
|
|
5089
5089
|
code: w.invalid_type,
|
|
5090
5090
|
expected: _.object,
|
|
5091
5091
|
received: i.parsedType
|
|
5092
|
-
}),
|
|
5092
|
+
}), T;
|
|
5093
5093
|
const c = this.discriminator, u = i.data[c], l = this.optionsMap.get(u);
|
|
5094
5094
|
return l ? i.common.async ? l._parseAsync({
|
|
5095
5095
|
data: i.data,
|
|
@@ -5103,7 +5103,7 @@ class Gt extends O {
|
|
|
5103
5103
|
code: w.invalid_union_discriminator,
|
|
5104
5104
|
options: Array.from(this.optionsMap.keys()),
|
|
5105
5105
|
path: [c]
|
|
5106
|
-
}),
|
|
5106
|
+
}), T);
|
|
5107
5107
|
}
|
|
5108
5108
|
get discriminator() {
|
|
5109
5109
|
return this._def.discriminator;
|
|
@@ -5139,7 +5139,7 @@ class Gt extends O {
|
|
|
5139
5139
|
discriminator: r,
|
|
5140
5140
|
options: i,
|
|
5141
5141
|
optionsMap: u,
|
|
5142
|
-
...
|
|
5142
|
+
...A(c)
|
|
5143
5143
|
});
|
|
5144
5144
|
}
|
|
5145
5145
|
}
|
|
@@ -5173,11 +5173,11 @@ class gt extends O {
|
|
|
5173
5173
|
_parse(r) {
|
|
5174
5174
|
const { status: i, ctx: c } = this._processInputParams(r), u = (l, h) => {
|
|
5175
5175
|
if (In(l) || In(h))
|
|
5176
|
-
return
|
|
5176
|
+
return T;
|
|
5177
5177
|
const p = $n(l.value, h.value);
|
|
5178
5178
|
return p.valid ? ((Mn(l) || Mn(h)) && i.dirty(), { status: i.value, value: p.data }) : (b(c, {
|
|
5179
5179
|
code: w.invalid_intersection_types
|
|
5180
|
-
}),
|
|
5180
|
+
}), T);
|
|
5181
5181
|
};
|
|
5182
5182
|
return c.common.async ? Promise.all([
|
|
5183
5183
|
this._def.left._parseAsync({
|
|
@@ -5205,7 +5205,7 @@ gt.create = (a, r, i) => new gt({
|
|
|
5205
5205
|
left: a,
|
|
5206
5206
|
right: r,
|
|
5207
5207
|
typeName: S.ZodIntersection,
|
|
5208
|
-
...
|
|
5208
|
+
...A(i)
|
|
5209
5209
|
});
|
|
5210
5210
|
class te extends O {
|
|
5211
5211
|
_parse(r) {
|
|
@@ -5215,7 +5215,7 @@ class te extends O {
|
|
|
5215
5215
|
code: w.invalid_type,
|
|
5216
5216
|
expected: _.array,
|
|
5217
5217
|
received: c.parsedType
|
|
5218
|
-
}),
|
|
5218
|
+
}), T;
|
|
5219
5219
|
if (c.data.length < this._def.items.length)
|
|
5220
5220
|
return b(c, {
|
|
5221
5221
|
code: w.too_small,
|
|
@@ -5223,7 +5223,7 @@ class te extends O {
|
|
|
5223
5223
|
inclusive: !0,
|
|
5224
5224
|
exact: !1,
|
|
5225
5225
|
type: "array"
|
|
5226
|
-
}),
|
|
5226
|
+
}), T;
|
|
5227
5227
|
!this._def.rest && c.data.length > this._def.items.length && (b(c, {
|
|
5228
5228
|
code: w.too_big,
|
|
5229
5229
|
maximum: this._def.items.length,
|
|
@@ -5254,7 +5254,7 @@ te.create = (a, r) => {
|
|
|
5254
5254
|
items: a,
|
|
5255
5255
|
typeName: S.ZodTuple,
|
|
5256
5256
|
rest: null,
|
|
5257
|
-
...
|
|
5257
|
+
...A(r)
|
|
5258
5258
|
});
|
|
5259
5259
|
};
|
|
5260
5260
|
class yt extends O {
|
|
@@ -5271,7 +5271,7 @@ class yt extends O {
|
|
|
5271
5271
|
code: w.invalid_type,
|
|
5272
5272
|
expected: _.object,
|
|
5273
5273
|
received: c.parsedType
|
|
5274
|
-
}),
|
|
5274
|
+
}), T;
|
|
5275
5275
|
const u = [], l = this._def.keyType, h = this._def.valueType;
|
|
5276
5276
|
for (const p in c.data)
|
|
5277
5277
|
u.push({
|
|
@@ -5289,12 +5289,12 @@ class yt extends O {
|
|
|
5289
5289
|
keyType: r,
|
|
5290
5290
|
valueType: i,
|
|
5291
5291
|
typeName: S.ZodRecord,
|
|
5292
|
-
...
|
|
5292
|
+
...A(c)
|
|
5293
5293
|
}) : new yt({
|
|
5294
|
-
keyType:
|
|
5294
|
+
keyType: q.create(),
|
|
5295
5295
|
valueType: r,
|
|
5296
5296
|
typeName: S.ZodRecord,
|
|
5297
|
-
...
|
|
5297
|
+
...A(i)
|
|
5298
5298
|
});
|
|
5299
5299
|
}
|
|
5300
5300
|
}
|
|
@@ -5312,7 +5312,7 @@ class Ht extends O {
|
|
|
5312
5312
|
code: w.invalid_type,
|
|
5313
5313
|
expected: _.map,
|
|
5314
5314
|
received: c.parsedType
|
|
5315
|
-
}),
|
|
5315
|
+
}), T;
|
|
5316
5316
|
const u = this._def.keyType, l = this._def.valueType, h = [...c.data.entries()].map(([p, g], y) => ({
|
|
5317
5317
|
key: u._parse(new ee(c, p, c.path, [y, "key"])),
|
|
5318
5318
|
value: l._parse(new ee(c, g, c.path, [y, "value"]))
|
|
@@ -5323,7 +5323,7 @@ class Ht extends O {
|
|
|
5323
5323
|
for (const g of h) {
|
|
5324
5324
|
const y = await g.key, E = await g.value;
|
|
5325
5325
|
if (y.status === "aborted" || E.status === "aborted")
|
|
5326
|
-
return
|
|
5326
|
+
return T;
|
|
5327
5327
|
(y.status === "dirty" || E.status === "dirty") && i.dirty(), p.set(y.value, E.value);
|
|
5328
5328
|
}
|
|
5329
5329
|
return { status: i.value, value: p };
|
|
@@ -5333,7 +5333,7 @@ class Ht extends O {
|
|
|
5333
5333
|
for (const g of h) {
|
|
5334
5334
|
const y = g.key, E = g.value;
|
|
5335
5335
|
if (y.status === "aborted" || E.status === "aborted")
|
|
5336
|
-
return
|
|
5336
|
+
return T;
|
|
5337
5337
|
(y.status === "dirty" || E.status === "dirty") && i.dirty(), p.set(y.value, E.value);
|
|
5338
5338
|
}
|
|
5339
5339
|
return { status: i.value, value: p };
|
|
@@ -5344,9 +5344,9 @@ Ht.create = (a, r, i) => new Ht({
|
|
|
5344
5344
|
valueType: r,
|
|
5345
5345
|
keyType: a,
|
|
5346
5346
|
typeName: S.ZodMap,
|
|
5347
|
-
...
|
|
5347
|
+
...A(i)
|
|
5348
5348
|
});
|
|
5349
|
-
class
|
|
5349
|
+
class Ae extends O {
|
|
5350
5350
|
_parse(r) {
|
|
5351
5351
|
const { status: i, ctx: c } = this._processInputParams(r);
|
|
5352
5352
|
if (c.parsedType !== _.set)
|
|
@@ -5354,7 +5354,7 @@ class Te extends O {
|
|
|
5354
5354
|
code: w.invalid_type,
|
|
5355
5355
|
expected: _.set,
|
|
5356
5356
|
received: c.parsedType
|
|
5357
|
-
}),
|
|
5357
|
+
}), T;
|
|
5358
5358
|
const u = this._def;
|
|
5359
5359
|
u.minSize !== null && c.data.size < u.minSize.value && (b(c, {
|
|
5360
5360
|
code: w.too_small,
|
|
@@ -5376,7 +5376,7 @@ class Te extends O {
|
|
|
5376
5376
|
const y = /* @__PURE__ */ new Set();
|
|
5377
5377
|
for (const E of g) {
|
|
5378
5378
|
if (E.status === "aborted")
|
|
5379
|
-
return
|
|
5379
|
+
return T;
|
|
5380
5380
|
E.status === "dirty" && i.dirty(), y.add(E.value);
|
|
5381
5381
|
}
|
|
5382
5382
|
return { status: i.value, value: y };
|
|
@@ -5385,13 +5385,13 @@ class Te extends O {
|
|
|
5385
5385
|
return c.common.async ? Promise.all(p).then((g) => h(g)) : h(p);
|
|
5386
5386
|
}
|
|
5387
5387
|
min(r, i) {
|
|
5388
|
-
return new
|
|
5388
|
+
return new Ae({
|
|
5389
5389
|
...this._def,
|
|
5390
5390
|
minSize: { value: r, message: k.toString(i) }
|
|
5391
5391
|
});
|
|
5392
5392
|
}
|
|
5393
5393
|
max(r, i) {
|
|
5394
|
-
return new
|
|
5394
|
+
return new Ae({
|
|
5395
5395
|
...this._def,
|
|
5396
5396
|
maxSize: { value: r, message: k.toString(i) }
|
|
5397
5397
|
});
|
|
@@ -5403,12 +5403,12 @@ class Te extends O {
|
|
|
5403
5403
|
return this.min(1, r);
|
|
5404
5404
|
}
|
|
5405
5405
|
}
|
|
5406
|
-
|
|
5406
|
+
Ae.create = (a, r) => new Ae({
|
|
5407
5407
|
valueType: a,
|
|
5408
5408
|
minSize: null,
|
|
5409
5409
|
maxSize: null,
|
|
5410
5410
|
typeName: S.ZodSet,
|
|
5411
|
-
...
|
|
5411
|
+
...A(r)
|
|
5412
5412
|
});
|
|
5413
5413
|
class Be extends O {
|
|
5414
5414
|
constructor() {
|
|
@@ -5421,7 +5421,7 @@ class Be extends O {
|
|
|
5421
5421
|
code: w.invalid_type,
|
|
5422
5422
|
expected: _.function,
|
|
5423
5423
|
received: i.parsedType
|
|
5424
|
-
}),
|
|
5424
|
+
}), T;
|
|
5425
5425
|
function c(p, g) {
|
|
5426
5426
|
return zt({
|
|
5427
5427
|
data: p,
|
|
@@ -5507,7 +5507,7 @@ class Be extends O {
|
|
|
5507
5507
|
args: r || te.create([]).rest(Ee.create()),
|
|
5508
5508
|
returns: i || Ee.create(),
|
|
5509
5509
|
typeName: S.ZodFunction,
|
|
5510
|
-
...
|
|
5510
|
+
...A(c)
|
|
5511
5511
|
});
|
|
5512
5512
|
}
|
|
5513
5513
|
}
|
|
@@ -5523,7 +5523,7 @@ class vt extends O {
|
|
|
5523
5523
|
vt.create = (a, r) => new vt({
|
|
5524
5524
|
getter: a,
|
|
5525
5525
|
typeName: S.ZodLazy,
|
|
5526
|
-
...
|
|
5526
|
+
...A(r)
|
|
5527
5527
|
});
|
|
5528
5528
|
class wt extends O {
|
|
5529
5529
|
_parse(r) {
|
|
@@ -5533,7 +5533,7 @@ class wt extends O {
|
|
|
5533
5533
|
received: i.data,
|
|
5534
5534
|
code: w.invalid_literal,
|
|
5535
5535
|
expected: this._def.value
|
|
5536
|
-
}),
|
|
5536
|
+
}), T;
|
|
5537
5537
|
}
|
|
5538
5538
|
return { status: "valid", value: r.data };
|
|
5539
5539
|
}
|
|
@@ -5544,13 +5544,13 @@ class wt extends O {
|
|
|
5544
5544
|
wt.create = (a, r) => new wt({
|
|
5545
5545
|
value: a,
|
|
5546
5546
|
typeName: S.ZodLiteral,
|
|
5547
|
-
...
|
|
5547
|
+
...A(r)
|
|
5548
5548
|
});
|
|
5549
5549
|
function vi(a, r) {
|
|
5550
5550
|
return new pe({
|
|
5551
5551
|
values: a,
|
|
5552
5552
|
typeName: S.ZodEnum,
|
|
5553
|
-
...
|
|
5553
|
+
...A(r)
|
|
5554
5554
|
});
|
|
5555
5555
|
}
|
|
5556
5556
|
class pe extends O {
|
|
@@ -5564,7 +5564,7 @@ class pe extends O {
|
|
|
5564
5564
|
expected: I.joinValues(c),
|
|
5565
5565
|
received: i.parsedType,
|
|
5566
5566
|
code: w.invalid_type
|
|
5567
|
-
}),
|
|
5567
|
+
}), T;
|
|
5568
5568
|
}
|
|
5569
5569
|
if (Vt(this, ut) || pi(this, ut, new Set(this._def.values)), !Vt(this, ut).has(r.data)) {
|
|
5570
5570
|
const i = this._getOrReturnCtx(r), c = this._def.values;
|
|
@@ -5572,7 +5572,7 @@ class pe extends O {
|
|
|
5572
5572
|
received: i.data,
|
|
5573
5573
|
code: w.invalid_enum_value,
|
|
5574
5574
|
options: c
|
|
5575
|
-
}),
|
|
5575
|
+
}), T;
|
|
5576
5576
|
}
|
|
5577
5577
|
return z(r.data);
|
|
5578
5578
|
}
|
|
@@ -5624,7 +5624,7 @@ class bt extends O {
|
|
|
5624
5624
|
expected: I.joinValues(u),
|
|
5625
5625
|
received: c.parsedType,
|
|
5626
5626
|
code: w.invalid_type
|
|
5627
|
-
}),
|
|
5627
|
+
}), T;
|
|
5628
5628
|
}
|
|
5629
5629
|
if (Vt(this, lt) || pi(this, lt, new Set(I.getValidEnumValues(this._def.values))), !Vt(this, lt).has(r.data)) {
|
|
5630
5630
|
const u = I.objectValues(i);
|
|
@@ -5632,7 +5632,7 @@ class bt extends O {
|
|
|
5632
5632
|
received: c.data,
|
|
5633
5633
|
code: w.invalid_enum_value,
|
|
5634
5634
|
options: u
|
|
5635
|
-
}),
|
|
5635
|
+
}), T;
|
|
5636
5636
|
}
|
|
5637
5637
|
return z(r.data);
|
|
5638
5638
|
}
|
|
@@ -5644,7 +5644,7 @@ lt = /* @__PURE__ */ new WeakMap();
|
|
|
5644
5644
|
bt.create = (a, r) => new bt({
|
|
5645
5645
|
values: a,
|
|
5646
5646
|
typeName: S.ZodNativeEnum,
|
|
5647
|
-
...
|
|
5647
|
+
...A(r)
|
|
5648
5648
|
});
|
|
5649
5649
|
class Fe extends O {
|
|
5650
5650
|
unwrap() {
|
|
@@ -5657,7 +5657,7 @@ class Fe extends O {
|
|
|
5657
5657
|
code: w.invalid_type,
|
|
5658
5658
|
expected: _.promise,
|
|
5659
5659
|
received: i.parsedType
|
|
5660
|
-
}),
|
|
5660
|
+
}), T;
|
|
5661
5661
|
const c = i.parsedType === _.promise ? i.data : Promise.resolve(i.data);
|
|
5662
5662
|
return z(c.then((u) => this._def.type.parseAsync(u, {
|
|
5663
5663
|
path: i.path,
|
|
@@ -5668,9 +5668,9 @@ class Fe extends O {
|
|
|
5668
5668
|
Fe.create = (a, r) => new Fe({
|
|
5669
5669
|
type: a,
|
|
5670
5670
|
typeName: S.ZodPromise,
|
|
5671
|
-
...
|
|
5671
|
+
...A(r)
|
|
5672
5672
|
});
|
|
5673
|
-
class
|
|
5673
|
+
class J extends O {
|
|
5674
5674
|
innerType() {
|
|
5675
5675
|
return this._def.schema;
|
|
5676
5676
|
}
|
|
@@ -5691,23 +5691,23 @@ class G extends O {
|
|
|
5691
5691
|
if (c.common.async)
|
|
5692
5692
|
return Promise.resolve(h).then(async (p) => {
|
|
5693
5693
|
if (i.value === "aborted")
|
|
5694
|
-
return
|
|
5694
|
+
return T;
|
|
5695
5695
|
const g = await this._def.schema._parseAsync({
|
|
5696
5696
|
data: p,
|
|
5697
5697
|
path: c.path,
|
|
5698
5698
|
parent: c
|
|
5699
5699
|
});
|
|
5700
|
-
return g.status === "aborted" ?
|
|
5700
|
+
return g.status === "aborted" ? T : g.status === "dirty" || i.value === "dirty" ? Ze(g.value) : g;
|
|
5701
5701
|
});
|
|
5702
5702
|
{
|
|
5703
5703
|
if (i.value === "aborted")
|
|
5704
|
-
return
|
|
5704
|
+
return T;
|
|
5705
5705
|
const p = this._def.schema._parseSync({
|
|
5706
5706
|
data: h,
|
|
5707
5707
|
path: c.path,
|
|
5708
5708
|
parent: c
|
|
5709
5709
|
});
|
|
5710
|
-
return p.status === "aborted" ?
|
|
5710
|
+
return p.status === "aborted" ? T : p.status === "dirty" || i.value === "dirty" ? Ze(p.value) : p;
|
|
5711
5711
|
}
|
|
5712
5712
|
}
|
|
5713
5713
|
if (u.type === "refinement") {
|
|
@@ -5725,9 +5725,9 @@ class G extends O {
|
|
|
5725
5725
|
path: c.path,
|
|
5726
5726
|
parent: c
|
|
5727
5727
|
});
|
|
5728
|
-
return p.status === "aborted" ?
|
|
5728
|
+
return p.status === "aborted" ? T : (p.status === "dirty" && i.dirty(), h(p.value), { status: i.value, value: p.value });
|
|
5729
5729
|
} else
|
|
5730
|
-
return this._def.schema._parseAsync({ data: c.data, path: c.path, parent: c }).then((p) => p.status === "aborted" ?
|
|
5730
|
+
return this._def.schema._parseAsync({ data: c.data, path: c.path, parent: c }).then((p) => p.status === "aborted" ? T : (p.status === "dirty" && i.dirty(), h(p.value).then(() => ({ status: i.value, value: p.value }))));
|
|
5731
5731
|
}
|
|
5732
5732
|
if (u.type === "transform")
|
|
5733
5733
|
if (c.common.async === !1) {
|
|
@@ -5747,17 +5747,17 @@ class G extends O {
|
|
|
5747
5747
|
I.assertNever(u);
|
|
5748
5748
|
}
|
|
5749
5749
|
}
|
|
5750
|
-
|
|
5750
|
+
J.create = (a, r, i) => new J({
|
|
5751
5751
|
schema: a,
|
|
5752
5752
|
typeName: S.ZodEffects,
|
|
5753
5753
|
effect: r,
|
|
5754
|
-
...
|
|
5754
|
+
...A(i)
|
|
5755
5755
|
});
|
|
5756
|
-
|
|
5756
|
+
J.createWithPreprocess = (a, r, i) => new J({
|
|
5757
5757
|
schema: r,
|
|
5758
5758
|
effect: { type: "preprocess", transform: a },
|
|
5759
5759
|
typeName: S.ZodEffects,
|
|
5760
|
-
...
|
|
5760
|
+
...A(i)
|
|
5761
5761
|
});
|
|
5762
5762
|
class X extends O {
|
|
5763
5763
|
_parse(r) {
|
|
@@ -5770,7 +5770,7 @@ class X extends O {
|
|
|
5770
5770
|
X.create = (a, r) => new X({
|
|
5771
5771
|
innerType: a,
|
|
5772
5772
|
typeName: S.ZodOptional,
|
|
5773
|
-
...
|
|
5773
|
+
...A(r)
|
|
5774
5774
|
});
|
|
5775
5775
|
class me extends O {
|
|
5776
5776
|
_parse(r) {
|
|
@@ -5783,7 +5783,7 @@ class me extends O {
|
|
|
5783
5783
|
me.create = (a, r) => new me({
|
|
5784
5784
|
innerType: a,
|
|
5785
5785
|
typeName: S.ZodNullable,
|
|
5786
|
-
...
|
|
5786
|
+
...A(r)
|
|
5787
5787
|
});
|
|
5788
5788
|
class _t extends O {
|
|
5789
5789
|
_parse(r) {
|
|
@@ -5803,7 +5803,7 @@ _t.create = (a, r) => new _t({
|
|
|
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
5808
|
class xt extends O {
|
|
5809
5809
|
_parse(r) {
|
|
@@ -5846,7 +5846,7 @@ xt.create = (a, r) => new xt({
|
|
|
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
5851
|
class qt extends O {
|
|
5852
5852
|
_parse(r) {
|
|
@@ -5856,14 +5856,14 @@ class qt extends O {
|
|
|
5856
5856
|
code: w.invalid_type,
|
|
5857
5857
|
expected: _.nan,
|
|
5858
5858
|
received: c.parsedType
|
|
5859
|
-
}),
|
|
5859
|
+
}), T;
|
|
5860
5860
|
}
|
|
5861
5861
|
return { status: "valid", value: r.data };
|
|
5862
5862
|
}
|
|
5863
5863
|
}
|
|
5864
5864
|
qt.create = (a) => new qt({
|
|
5865
5865
|
typeName: S.ZodNaN,
|
|
5866
|
-
...
|
|
5866
|
+
...A(a)
|
|
5867
5867
|
});
|
|
5868
5868
|
const Id = Symbol("zod_brand");
|
|
5869
5869
|
class Rn extends O {
|
|
@@ -5889,7 +5889,7 @@ class Et extends O {
|
|
|
5889
5889
|
path: c.path,
|
|
5890
5890
|
parent: c
|
|
5891
5891
|
});
|
|
5892
|
-
return l.status === "aborted" ?
|
|
5892
|
+
return l.status === "aborted" ? T : l.status === "dirty" ? (i.dirty(), Ze(l.value)) : this._def.out._parseAsync({
|
|
5893
5893
|
data: l.value,
|
|
5894
5894
|
path: c.path,
|
|
5895
5895
|
parent: c
|
|
@@ -5901,7 +5901,7 @@ class Et extends O {
|
|
|
5901
5901
|
path: c.path,
|
|
5902
5902
|
parent: c
|
|
5903
5903
|
});
|
|
5904
|
-
return u.status === "aborted" ?
|
|
5904
|
+
return u.status === "aborted" ? T : u.status === "dirty" ? (i.dirty(), {
|
|
5905
5905
|
status: "dirty",
|
|
5906
5906
|
value: u.value
|
|
5907
5907
|
}) : this._def.out._parseSync({
|
|
@@ -5931,7 +5931,7 @@ class kt extends O {
|
|
|
5931
5931
|
kt.create = (a, r) => new kt({
|
|
5932
5932
|
innerType: a,
|
|
5933
5933
|
typeName: S.ZodReadonly,
|
|
5934
|
-
...
|
|
5934
|
+
...A(r)
|
|
5935
5935
|
});
|
|
5936
5936
|
function wi(a, r = {}, i) {
|
|
5937
5937
|
return a ? Ve.create().superRefine((c, u) => {
|
|
@@ -5951,16 +5951,16 @@ 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 =
|
|
5955
|
-
string: (a) =>
|
|
5954
|
+
}) => wi((i) => i instanceof a, r), bi = q.create, _i = fe.create, Rd = qt.create, Cd = he.create, xi = ft.create, Nd = Te.create, jd = Ft.create, Dd = ht.create, Ud = pt.create, Pd = Ve.create, Zd = Ee.create, Bd = oe.create, Ld = Wt.create, zd = G.create, Vd = C.create, Fd = C.strictCreate, Wd = mt.create, Hd = Gt.create, qd = gt.create, Gd = te.create, Jd = yt.create, Kd = Ht.create, Yd = Ae.create, Qd = Be.create, Xd = vt.create, ef = wt.create, tf = pe.create, rf = bt.create, nf = Fe.create, ci = J.create, sf = X.create, af = me.create, of = J.createWithPreprocess, cf = Et.create, uf = () => bi().optional(), lf = () => _i().optional(), df = () => xi().optional(), ff = {
|
|
5955
|
+
string: (a) => q.create({ ...a, coerce: !0 }),
|
|
5956
5956
|
number: (a) => fe.create({ ...a, coerce: !0 }),
|
|
5957
5957
|
boolean: (a) => ft.create({
|
|
5958
5958
|
...a,
|
|
5959
5959
|
coerce: !0
|
|
5960
5960
|
}),
|
|
5961
5961
|
bigint: (a) => he.create({ ...a, coerce: !0 }),
|
|
5962
|
-
date: (a) =>
|
|
5963
|
-
}, hf =
|
|
5962
|
+
date: (a) => Te.create({ ...a, coerce: !0 })
|
|
5963
|
+
}, hf = T;
|
|
5964
5964
|
var j = /* @__PURE__ */ Object.freeze({
|
|
5965
5965
|
__proto__: null,
|
|
5966
5966
|
defaultErrorMap: ze,
|
|
@@ -5970,7 +5970,7 @@ var j = /* @__PURE__ */ Object.freeze({
|
|
|
5970
5970
|
EMPTY_PATH: od,
|
|
5971
5971
|
addIssueToContext: b,
|
|
5972
5972
|
ParseStatus: L,
|
|
5973
|
-
INVALID:
|
|
5973
|
+
INVALID: T,
|
|
5974
5974
|
DIRTY: Ze,
|
|
5975
5975
|
OK: z,
|
|
5976
5976
|
isAborted: In,
|
|
@@ -5987,11 +5987,11 @@ var j = /* @__PURE__ */ Object.freeze({
|
|
|
5987
5987
|
getParsedType: ae,
|
|
5988
5988
|
ZodType: O,
|
|
5989
5989
|
datetimeRegex: yi,
|
|
5990
|
-
ZodString:
|
|
5990
|
+
ZodString: q,
|
|
5991
5991
|
ZodNumber: fe,
|
|
5992
5992
|
ZodBigInt: he,
|
|
5993
5993
|
ZodBoolean: ft,
|
|
5994
|
-
ZodDate:
|
|
5994
|
+
ZodDate: Te,
|
|
5995
5995
|
ZodSymbol: Ft,
|
|
5996
5996
|
ZodUndefined: ht,
|
|
5997
5997
|
ZodNull: pt,
|
|
@@ -5999,7 +5999,7 @@ var j = /* @__PURE__ */ Object.freeze({
|
|
|
5999
5999
|
ZodUnknown: Ee,
|
|
6000
6000
|
ZodNever: oe,
|
|
6001
6001
|
ZodVoid: Wt,
|
|
6002
|
-
ZodArray:
|
|
6002
|
+
ZodArray: G,
|
|
6003
6003
|
ZodObject: C,
|
|
6004
6004
|
ZodUnion: mt,
|
|
6005
6005
|
ZodDiscriminatedUnion: Gt,
|
|
@@ -6007,15 +6007,15 @@ var j = /* @__PURE__ */ Object.freeze({
|
|
|
6007
6007
|
ZodTuple: te,
|
|
6008
6008
|
ZodRecord: yt,
|
|
6009
6009
|
ZodMap: Ht,
|
|
6010
|
-
ZodSet:
|
|
6010
|
+
ZodSet: Ae,
|
|
6011
6011
|
ZodFunction: Be,
|
|
6012
6012
|
ZodLazy: vt,
|
|
6013
6013
|
ZodLiteral: wt,
|
|
6014
6014
|
ZodEnum: pe,
|
|
6015
6015
|
ZodNativeEnum: bt,
|
|
6016
6016
|
ZodPromise: Fe,
|
|
6017
|
-
ZodEffects:
|
|
6018
|
-
ZodTransformer:
|
|
6017
|
+
ZodEffects: J,
|
|
6018
|
+
ZodTransformer: J,
|
|
6019
6019
|
ZodOptional: X,
|
|
6020
6020
|
ZodNullable: me,
|
|
6021
6021
|
ZodDefault: _t,
|
|
@@ -6077,7 +6077,7 @@ var j = /* @__PURE__ */ Object.freeze({
|
|
|
6077
6077
|
quotelessJson: id,
|
|
6078
6078
|
ZodError: V
|
|
6079
6079
|
}), ki = /* @__PURE__ */ ((a) => (a.TEXT = "text", a.THREAD = "thread", a.REACTION = "reaction", a))(ki || {});
|
|
6080
|
-
const ge =
|
|
6080
|
+
const ge = H.getInstance(), pf = [
|
|
6081
6081
|
"id",
|
|
6082
6082
|
"targetMessageId",
|
|
6083
6083
|
"type",
|
|
@@ -6198,7 +6198,7 @@ function bf(a) {
|
|
|
6198
6198
|
}
|
|
6199
6199
|
return { isValid: !0, errors: [] };
|
|
6200
6200
|
}
|
|
6201
|
-
const
|
|
6201
|
+
const W = {
|
|
6202
6202
|
LOADING_INIT: "loadingInit",
|
|
6203
6203
|
LOADING_PREVIOUS_MESSAGES: "loadingPreviousMessages",
|
|
6204
6204
|
MESSAGE_RECEIVED: "messageReceived",
|
|
@@ -6209,7 +6209,7 @@ const Y = {
|
|
|
6209
6209
|
};
|
|
6210
6210
|
class _f {
|
|
6211
6211
|
constructor(r, i) {
|
|
6212
|
-
this.utils = r, this.emitter = i, this.logger =
|
|
6212
|
+
this.utils = r, this.emitter = i, this.logger = H.getInstance(), this.errorHandler = Q.getInstance(), this.processedRefs = /* @__PURE__ */ new Set(), this.refRetryCount = /* @__PURE__ */ new Map(), this.bannedRefs = /* @__PURE__ */ new Set(), this.latestStatefulMessage = null, this.MAX_RETRIES = 3, this.RETRY_DELAY = 1e3;
|
|
6213
6213
|
}
|
|
6214
6214
|
async init() {
|
|
6215
6215
|
try {
|
|
@@ -6280,7 +6280,7 @@ class _f {
|
|
|
6280
6280
|
throw new Error(`Invalid message state for ref: ${r}`);
|
|
6281
6281
|
this.processedRefs.add(r), this.refRetryCount.delete(r);
|
|
6282
6282
|
for (const u of i)
|
|
6283
|
-
this.emitter.emit(
|
|
6283
|
+
this.emitter.emit(W.MESSAGE_RECEIVED, u);
|
|
6284
6284
|
}
|
|
6285
6285
|
async handleRefError(r, i) {
|
|
6286
6286
|
const c = this.refRetryCount.get(r) || 0, u = c + 1;
|
|
@@ -6381,12 +6381,12 @@ class xf {
|
|
|
6381
6381
|
}
|
|
6382
6382
|
}
|
|
6383
6383
|
async fetchLatestChatMessage() {
|
|
6384
|
-
const { bee: r, chatTopic: i, chatAddress: c } = this.swarmSettings, l = await r.makeFeedReader(De.fromString(i),
|
|
6384
|
+
const { bee: r, chatTopic: i, chatAddress: c } = this.swarmSettings, l = await r.makeFeedReader(De.fromString(i), Tn(c)).downloadPayload();
|
|
6385
6385
|
return { data: l.payload.toJSON(), index: l.feedIndex };
|
|
6386
6386
|
}
|
|
6387
6387
|
async fetchChatMessage(r) {
|
|
6388
6388
|
const { bee: i, chatTopic: c, chatAddress: u } = this.swarmSettings;
|
|
6389
|
-
return (await i.makeFeedReader(De.fromString(c),
|
|
6389
|
+
return (await i.makeFeedReader(De.fromString(c), Tn(u)).downloadPayload({ index: r })).payload.toJSON();
|
|
6390
6390
|
}
|
|
6391
6391
|
async sendMessageToGsoc(r) {
|
|
6392
6392
|
const { enveloped: i, stamp: c } = this.swarmSettings;
|
|
@@ -6426,9 +6426,9 @@ class xf {
|
|
|
6426
6426
|
}
|
|
6427
6427
|
class Ef {
|
|
6428
6428
|
constructor(r, i) {
|
|
6429
|
-
this.logger =
|
|
6430
|
-
const c = new ke(
|
|
6431
|
-
this.userDetails = {
|
|
6429
|
+
this.fallbackTransport = null, this.logger = H.getInstance(), this.errorHandler = Q.getInstance(), this.gsocIndex = null;
|
|
6430
|
+
const c = new ke(Tn(r.user.privateKey));
|
|
6431
|
+
if (this.userDetails = {
|
|
6432
6432
|
privateKey: r.user.privateKey,
|
|
6433
6433
|
ownAddress: c.publicKey().address().toString(),
|
|
6434
6434
|
nickname: r.user.nickname,
|
|
@@ -6443,32 +6443,41 @@ class Ef {
|
|
|
6443
6443
|
gsocResourceId: r.infra.gsocResourceId,
|
|
6444
6444
|
chatTopic: r.infra.chatTopic,
|
|
6445
6445
|
chatAddress: r.infra.chatAddress
|
|
6446
|
-
}, this.emitter = new sd(), this.utils = new xf(this.userDetails, this.swarmSettings), this.history = new _f(this.utils, this.emitter),
|
|
6447
|
-
this.
|
|
6446
|
+
}, this.emitter = new sd(), this.utils = new xf(this.userDetails, this.swarmSettings), this.history = new _f(this.utils, this.emitter), i) {
|
|
6447
|
+
if (this.transport = i, r.infra.enableFallbackPolling) {
|
|
6448
|
+
const u = r.infra.fallbackPollingInterval || 4e3;
|
|
6449
|
+
this.logger.info(`Fallback polling enabled with interval: ${u}ms`), this.fallbackTransport = this.createDefaultPollingTransport(u), this.fallbackTransport.onMessage((l) => {
|
|
6450
|
+
this.emitter.emit(W.MESSAGE_RECEIVED, l);
|
|
6451
|
+
});
|
|
6452
|
+
}
|
|
6453
|
+
} else
|
|
6454
|
+
this.transport = this.createDefaultPollingTransport();
|
|
6455
|
+
this.transport.onMessage((u) => {
|
|
6456
|
+
this.emitter.emit(W.MESSAGE_RECEIVED, u);
|
|
6448
6457
|
});
|
|
6449
6458
|
}
|
|
6450
|
-
createDefaultPollingTransport() {
|
|
6459
|
+
createDefaultPollingTransport(r) {
|
|
6451
6460
|
return new ql({
|
|
6452
6461
|
fetchMessage: async () => {
|
|
6453
6462
|
try {
|
|
6454
6463
|
if (!this.gsocIndex)
|
|
6455
6464
|
return null;
|
|
6456
|
-
const
|
|
6457
|
-
return Ei(
|
|
6458
|
-
} catch (
|
|
6459
|
-
if (this.utils.isNotFoundError(
|
|
6465
|
+
const i = De.fromString(this.swarmSettings.chatTopic), c = fi(i, this.gsocIndex), u = await this.utils.rawSocDownload(this.swarmSettings.chatAddress, c.toString()), l = JSON.parse(u);
|
|
6466
|
+
return Ei(l) ? (this.gsocIndex = this.gsocIndex.next(), l.message) : (this.logger.warn("Invalid GSOC message during fetching"), null);
|
|
6467
|
+
} catch (i) {
|
|
6468
|
+
if (this.utils.isNotFoundError(i))
|
|
6460
6469
|
return null;
|
|
6461
|
-
throw
|
|
6470
|
+
throw i;
|
|
6462
6471
|
}
|
|
6463
6472
|
},
|
|
6464
|
-
pollingInterval: 1e3
|
|
6473
|
+
pollingInterval: r || 1e3
|
|
6465
6474
|
});
|
|
6466
6475
|
}
|
|
6467
6476
|
async start() {
|
|
6468
|
-
await this.init(), await this.transport.start();
|
|
6477
|
+
await this.init(), await this.transport.start(), this.fallbackTransport && await this.fallbackTransport.start();
|
|
6469
6478
|
}
|
|
6470
6479
|
async stop() {
|
|
6471
|
-
this.emitter.cleanAll(), this.history.cleanup(), await this.transport.stop();
|
|
6480
|
+
this.emitter.cleanAll(), this.history.cleanup(), await this.transport.stop(), this.fallbackTransport && await this.fallbackTransport.stop();
|
|
6472
6481
|
}
|
|
6473
6482
|
getEmitter() {
|
|
6474
6483
|
return this.emitter;
|
|
@@ -6496,16 +6505,16 @@ class Ef {
|
|
|
6496
6505
|
throw this.logger.error(y), new Error(y);
|
|
6497
6506
|
}
|
|
6498
6507
|
try {
|
|
6499
|
-
this.emitter.emit(
|
|
6508
|
+
this.emitter.emit(W.MESSAGE_REQUEST_INITIATED, p), await this.utils.writeOwnFeedDataByIndex(h, JSON.stringify(p)), this.userDetails.ownIndex = h, this.emitter.emit(W.MESSAGE_REQUEST_UPLOADED, p), await this.broadcastUserMessage(p);
|
|
6500
6509
|
} catch (y) {
|
|
6501
|
-
this.emitter.emit(
|
|
6510
|
+
this.emitter.emit(W.MESSAGE_REQUEST_ERROR, p), this.errorHandler.handleError(y, "Chat.sendMessage");
|
|
6502
6511
|
}
|
|
6503
6512
|
}
|
|
6504
6513
|
async fetchPreviousMessages() {
|
|
6505
6514
|
try {
|
|
6506
|
-
return this.emitter.emit(
|
|
6515
|
+
return this.emitter.emit(W.LOADING_PREVIOUS_MESSAGES, !0), await this.history.fetchPreviousMessageState();
|
|
6507
6516
|
} finally {
|
|
6508
|
-
this.emitter.emit(
|
|
6517
|
+
this.emitter.emit(W.LOADING_PREVIOUS_MESSAGES, !1);
|
|
6509
6518
|
}
|
|
6510
6519
|
}
|
|
6511
6520
|
hasPreviousMessages() {
|
|
@@ -6519,22 +6528,22 @@ class Ef {
|
|
|
6519
6528
|
}
|
|
6520
6529
|
async init() {
|
|
6521
6530
|
try {
|
|
6522
|
-
this.emitter.emit(
|
|
6531
|
+
this.emitter.emit(W.LOADING_INIT, !0);
|
|
6523
6532
|
const [r, i] = await Promise.allSettled([this.initOwnIndex(), this.history.init()]);
|
|
6524
6533
|
if (r.status === "rejected")
|
|
6525
6534
|
throw r.reason;
|
|
6526
|
-
i.status === "fulfilled" && (this.gsocIndex = i.value), this.emitter.emit(
|
|
6535
|
+
i.status === "fulfilled" && (this.gsocIndex = i.value), this.emitter.emit(W.LOADING_INIT, !1);
|
|
6527
6536
|
} catch (r) {
|
|
6528
|
-
this.errorHandler.handleError(r, "Chat.initSelfState"), this.emitter.emit(
|
|
6537
|
+
this.errorHandler.handleError(r, "Chat.initSelfState"), this.emitter.emit(W.CRITICAL_ERROR, r);
|
|
6529
6538
|
}
|
|
6530
6539
|
}
|
|
6531
6540
|
async initOwnIndex() {
|
|
6532
|
-
const { latestIndex: c } = await
|
|
6541
|
+
const { latestIndex: c } = await An(() => this.utils.getOwnLatestFeedIndex(), 10, 1e3);
|
|
6533
6542
|
this.userDetails.ownIndex = c;
|
|
6534
6543
|
}
|
|
6535
6544
|
async broadcastUserMessage(r) {
|
|
6536
6545
|
try {
|
|
6537
|
-
return
|
|
6546
|
+
return An(() => this.utils.sendMessageToGsoc(JSON.stringify(r)));
|
|
6538
6547
|
} catch (i) {
|
|
6539
6548
|
this.errorHandler.handleError(i, "Chat.broadcastUserMessage");
|
|
6540
6549
|
}
|
|
@@ -6548,7 +6557,7 @@ class Ef {
|
|
|
6548
6557
|
}
|
|
6549
6558
|
}
|
|
6550
6559
|
export {
|
|
6551
|
-
|
|
6560
|
+
W as EVENTS,
|
|
6552
6561
|
ki as MessageType,
|
|
6553
6562
|
ql as PollingTransport,
|
|
6554
6563
|
Ef as SwarmChat
|