@solarpunkltd/swarm-chat-js 4.0.0 → 4.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.esm.js +448 -451
- package/dist/index.js +8 -8
- package/dist/lib/core.d.ts +2 -1
- package/dist/lib/core.d.ts.map +1 -1
- package/dist/lib/types/chat.d.ts +0 -2
- package/dist/lib/types/chat.d.ts.map +1 -1
- package/dist/lib/utils.d.ts +1 -1
- package/dist/lib/utils.d.ts.map +1 -1
- package/dist/swarm-chat-umd.js +8 -8
- package/dist/utils/validation.d.ts.map +1 -1
- package/package.json +1 -1
package/dist/index.esm.js
CHANGED
|
@@ -37,12 +37,12 @@ var ci = {};
|
|
|
37
37
|
return i(Promise.all(e.map(i)));
|
|
38
38
|
}
|
|
39
39
|
async function u(e, t = 1) {
|
|
40
|
-
const r = As(e, t), s = [], o = r.map(async (
|
|
41
|
-
for (const f of
|
|
40
|
+
const r = As(e, t), s = [], o = r.map(async (l) => {
|
|
41
|
+
for (const f of l) s.push(await f());
|
|
42
42
|
});
|
|
43
43
|
return await Promise.all(o), s;
|
|
44
44
|
}
|
|
45
|
-
async function
|
|
45
|
+
async function d(e) {
|
|
46
46
|
return new Promise(
|
|
47
47
|
(t) => setTimeout(() => {
|
|
48
48
|
t(!0);
|
|
@@ -87,14 +87,14 @@ var ci = {};
|
|
|
87
87
|
const s = [];
|
|
88
88
|
for (let o = 0; o < e; o++) {
|
|
89
89
|
s.push([]);
|
|
90
|
-
for (let
|
|
90
|
+
for (let l = 0; l < t; l++) s[o].push(r);
|
|
91
91
|
}
|
|
92
92
|
return s;
|
|
93
93
|
}
|
|
94
94
|
function Fe(e, t, r, s) {
|
|
95
95
|
if (r < 0 || s < 0 || s + t[0].length > e[0].length || r + t.length > e.length) return !1;
|
|
96
96
|
for (let o = 0; o < t.length; o++)
|
|
97
|
-
for (let
|
|
97
|
+
for (let l = 0; l < t[o].length; l++) if (t[o][l] !== void 0 && e[r + o][s + l] !== t[o][l]) return !1;
|
|
98
98
|
return !0;
|
|
99
99
|
}
|
|
100
100
|
function Te(e, t, r = Math.random) {
|
|
@@ -122,11 +122,11 @@ var ci = {};
|
|
|
122
122
|
return t >= e.x && t < e.x + e.width && r >= e.y && r < e.y + e.height;
|
|
123
123
|
}
|
|
124
124
|
function ki(e, t, r, s = Math.random) {
|
|
125
|
-
let o,
|
|
125
|
+
let o, l;
|
|
126
126
|
do
|
|
127
|
-
o = Ve(0, e - 1, s),
|
|
128
|
-
while (r && xi(r, o,
|
|
129
|
-
return [o,
|
|
127
|
+
o = Ve(0, e - 1, s), l = Ve(0, t - 1, s);
|
|
128
|
+
while (r && xi(r, o, l));
|
|
129
|
+
return [o, l];
|
|
130
130
|
}
|
|
131
131
|
function Ei(e, t = Math.random) {
|
|
132
132
|
const r = Math.floor(e), s = e - r;
|
|
@@ -146,18 +146,18 @@ var ci = {};
|
|
|
146
146
|
if (t > e.length) throw new Error(`Count (${t}) is greater than array length (${e.length})`);
|
|
147
147
|
const o = [];
|
|
148
148
|
for (; o.length < t; ) {
|
|
149
|
-
const
|
|
150
|
-
o.some((f) => r(f,
|
|
149
|
+
const l = Kt(e, s);
|
|
150
|
+
o.some((f) => r(f, l)) || o.push(l);
|
|
151
151
|
}
|
|
152
152
|
return o;
|
|
153
153
|
}
|
|
154
|
-
function Si(e, t, r, s, o,
|
|
154
|
+
function Si(e, t, r, s, o, l = Math.random) {
|
|
155
155
|
const f = e.filter((p) => p !== t && p !== r), g = [];
|
|
156
156
|
for (t !== null && g.push(t); f.length && g.length < s; ) {
|
|
157
|
-
const p = a.Random.intBetween(0, f.length - 1,
|
|
157
|
+
const p = a.Random.intBetween(0, f.length - 1, l);
|
|
158
158
|
o(f[p], g) && g.push(f[p]), f.splice(p, 1);
|
|
159
159
|
}
|
|
160
|
-
return h(g,
|
|
160
|
+
return h(g, l), { values: g, indexOfGuaranteed: t !== null ? g.indexOf(t) : -1 };
|
|
161
161
|
}
|
|
162
162
|
function We(e) {
|
|
163
163
|
if (!e.length) throw Error("Received empty array");
|
|
@@ -171,15 +171,15 @@ var ci = {};
|
|
|
171
171
|
}
|
|
172
172
|
function Ii(e, t, r) {
|
|
173
173
|
if (r === void 0 && (r = Math.random()), e.length !== t.length) throw new Error("Array length mismatch");
|
|
174
|
-
let s = t.reduce((
|
|
174
|
+
let s = t.reduce((l, f) => l + f, 0);
|
|
175
175
|
const o = r * s;
|
|
176
|
-
for (let
|
|
176
|
+
for (let l = 0; l < e.length - 1; l++) if (s -= t[l], o >= s) return e[l];
|
|
177
177
|
return We(e);
|
|
178
178
|
}
|
|
179
179
|
function Mi(e, t, r = Math.random) {
|
|
180
|
-
const s = t.map((
|
|
181
|
-
for (let
|
|
182
|
-
return o.sort((
|
|
180
|
+
const s = t.map((l) => r() * l), o = [];
|
|
181
|
+
for (let l = 0; l < e.length; l++) o.push([e[l], s[l]]);
|
|
182
|
+
return o.sort((l, f) => f[1] - l[1]).map((l) => l[0]);
|
|
183
183
|
}
|
|
184
184
|
function pe(e, t) {
|
|
185
185
|
if (e == null) return null;
|
|
@@ -194,9 +194,9 @@ var ci = {};
|
|
|
194
194
|
function ge(e, t, r) {
|
|
195
195
|
const s = t.split(/\.|\[/);
|
|
196
196
|
let o = e;
|
|
197
|
-
for (let
|
|
198
|
-
const f = s[
|
|
199
|
-
if (
|
|
197
|
+
for (let l = 0; l < s.length; l++) {
|
|
198
|
+
const f = s[l], g = l < s.length - 1 && s[l + 1].includes("]"), p = f.includes("]") ? f.replace(/\[|\]/g, "") : f;
|
|
199
|
+
if (l === s.length - 1) return o[p] = r, r;
|
|
200
200
|
oe(o[p]) || (g ? o[p] = [] : o[p] = {}), o = o[p];
|
|
201
201
|
}
|
|
202
202
|
return r;
|
|
@@ -237,7 +237,7 @@ var ci = {};
|
|
|
237
237
|
} catch (s) {
|
|
238
238
|
r && r("Error in forever", s);
|
|
239
239
|
}
|
|
240
|
-
await
|
|
240
|
+
await d(t);
|
|
241
241
|
}
|
|
242
242
|
}
|
|
243
243
|
function Ui(e, t) {
|
|
@@ -262,7 +262,7 @@ var ci = {};
|
|
|
262
262
|
return "#" + e.map((t) => t.toString(16).padStart(2, "0")).join("");
|
|
263
263
|
}
|
|
264
264
|
function zi(e, t, r, s) {
|
|
265
|
-
const o = e * Math.PI / 180,
|
|
265
|
+
const o = e * Math.PI / 180, l = r * Math.PI / 180, f = (r - e) * Math.PI / 180, g = (s - t) * Math.PI / 180, p = Math.sin(f / 2) * Math.sin(f / 2) + Math.cos(o) * Math.cos(l) * Math.sin(g / 2) * Math.sin(g / 2);
|
|
266
266
|
return 6371e3 * (2 * Math.atan2(Math.sqrt(p), Math.sqrt(1 - p)));
|
|
267
267
|
}
|
|
268
268
|
function kt(e, t) {
|
|
@@ -508,12 +508,12 @@ var ci = {};
|
|
|
508
508
|
if (r > 1) return "[object Object]";
|
|
509
509
|
if (t === "json") {
|
|
510
510
|
if (Array.isArray(e)) {
|
|
511
|
-
const o = e.map((
|
|
511
|
+
const o = e.map((l) => He(l, "json", r + 1));
|
|
512
512
|
return r === 0 ? JSON.stringify(o) : o;
|
|
513
513
|
}
|
|
514
514
|
const s = {};
|
|
515
515
|
e.message && (s.message = He(e.message, "json", r + 1));
|
|
516
|
-
for (const [o,
|
|
516
|
+
for (const [o, l] of Object.entries(e)) s[o] = He(l, "json", r + 1);
|
|
517
517
|
return r === 0 ? JSON.stringify(s) : s;
|
|
518
518
|
} else if (t === "key-value") {
|
|
519
519
|
const s = Object.keys(e);
|
|
@@ -604,8 +604,8 @@ var ci = {};
|
|
|
604
604
|
}
|
|
605
605
|
function Pa(e, t) {
|
|
606
606
|
for (let r = 0; r < e.length; r++) {
|
|
607
|
-
const s = e[r], o = t[r],
|
|
608
|
-
setTimeout(s,
|
|
607
|
+
const s = e[r], o = t[r], l = Math.max(0, o.getTime() - Date.now());
|
|
608
|
+
setTimeout(s, l);
|
|
609
609
|
}
|
|
610
610
|
}
|
|
611
611
|
function Ba(e, t, r) {
|
|
@@ -738,10 +738,10 @@ var ci = {};
|
|
|
738
738
|
function Yn(e) {
|
|
739
739
|
const t = /\{(.+?)\}/, r = e.match(t);
|
|
740
740
|
if (!r || !r.index) return [e];
|
|
741
|
-
const s = r[1].split(","), o = e.slice(0, r.index),
|
|
741
|
+
const s = r[1].split(","), o = e.slice(0, r.index), l = e.slice(r.index + r[0].length);
|
|
742
742
|
let f = [];
|
|
743
743
|
for (const g of s) {
|
|
744
|
-
const p = Yn(o + g +
|
|
744
|
+
const p = Yn(o + g + l);
|
|
745
745
|
f = f.concat(p);
|
|
746
746
|
}
|
|
747
747
|
return f;
|
|
@@ -792,22 +792,22 @@ var ci = {};
|
|
|
792
792
|
let s = 0;
|
|
793
793
|
for (const o of t)
|
|
794
794
|
if (o instanceof RegExp) {
|
|
795
|
-
const
|
|
796
|
-
if (!
|
|
797
|
-
s =
|
|
795
|
+
const l = ts(e, o, s);
|
|
796
|
+
if (!l) return !1;
|
|
797
|
+
s = l.index + l.match.length;
|
|
798
798
|
} else {
|
|
799
|
-
const
|
|
800
|
-
if (
|
|
801
|
-
s =
|
|
799
|
+
const l = e.indexOf(o, s);
|
|
800
|
+
if (l === -1) return !1;
|
|
801
|
+
s = l + o.length;
|
|
802
802
|
}
|
|
803
803
|
return !0;
|
|
804
804
|
}
|
|
805
805
|
function po(e, t, r = !0) {
|
|
806
806
|
let s = 0;
|
|
807
807
|
for (const o of t) {
|
|
808
|
-
let
|
|
809
|
-
for (; !
|
|
810
|
-
if (!
|
|
808
|
+
let l = !1;
|
|
809
|
+
for (; !l && s < e.length; ) rs(e[s], o, r) && (l = !0), s++;
|
|
810
|
+
if (!l) return !1;
|
|
811
811
|
}
|
|
812
812
|
return !0;
|
|
813
813
|
}
|
|
@@ -817,8 +817,8 @@ var ci = {};
|
|
|
817
817
|
function Ie(e, t, r = 0) {
|
|
818
818
|
let s = -1;
|
|
819
819
|
for (const o of t) {
|
|
820
|
-
const
|
|
821
|
-
|
|
820
|
+
const l = e.indexOf(o, r);
|
|
821
|
+
l !== -1 && (s === -1 || l < s) && (s = l);
|
|
822
822
|
}
|
|
823
823
|
return s;
|
|
824
824
|
}
|
|
@@ -835,10 +835,10 @@ var ci = {};
|
|
|
835
835
|
}
|
|
836
836
|
function ss(e, t = 0, r = "{", s = "}") {
|
|
837
837
|
let o = 1;
|
|
838
|
-
for (let
|
|
839
|
-
if (e.slice(
|
|
840
|
-
if (--o === 0) return
|
|
841
|
-
} else e.slice(
|
|
838
|
+
for (let l = t; l < e.length; l++)
|
|
839
|
+
if (e.slice(l, l + s.length) === s) {
|
|
840
|
+
if (--o === 0) return l;
|
|
841
|
+
} else e.slice(l, l + r.length) === r && o++;
|
|
842
842
|
return -1;
|
|
843
843
|
}
|
|
844
844
|
function is(e, t) {
|
|
@@ -886,8 +886,8 @@ var ci = {};
|
|
|
886
886
|
for (; ; ) {
|
|
887
887
|
const o = a.Strings.extractBlock(e, { ...r, start: s });
|
|
888
888
|
if (!o) return e;
|
|
889
|
-
const
|
|
890
|
-
s = e.indexOf(o, s) +
|
|
889
|
+
const l = t(o);
|
|
890
|
+
s = e.indexOf(o, s) + l.length, e = e.replace(o, l);
|
|
891
891
|
}
|
|
892
892
|
}
|
|
893
893
|
function _o(e, t) {
|
|
@@ -899,12 +899,12 @@ var ci = {};
|
|
|
899
899
|
r.push({ string: e.slice(s), symbol: null });
|
|
900
900
|
break;
|
|
901
901
|
}
|
|
902
|
-
const
|
|
903
|
-
if (o > s &&
|
|
902
|
+
const l = e.indexOf(t, o + t.length);
|
|
903
|
+
if (o > s && l !== -1 && r.push({ string: e.slice(s, o), symbol: null }), l === -1) {
|
|
904
904
|
r.push({ string: e.slice(s), symbol: null });
|
|
905
905
|
break;
|
|
906
906
|
}
|
|
907
|
-
r.push({ string: e.slice(o + t.length,
|
|
907
|
+
r.push({ string: e.slice(o + t.length, l), symbol: t }), s = l + t.length;
|
|
908
908
|
}
|
|
909
909
|
return r;
|
|
910
910
|
}
|
|
@@ -967,23 +967,23 @@ var ci = {};
|
|
|
967
967
|
}
|
|
968
968
|
function cs(e, t) {
|
|
969
969
|
const r = "=", s = t.length;
|
|
970
|
-
let o = 0,
|
|
970
|
+
let o = 0, l = 0;
|
|
971
971
|
const f = [];
|
|
972
972
|
for (let g = 0; g < e.length; g++) {
|
|
973
973
|
const p = e[g];
|
|
974
974
|
if (p === r) break;
|
|
975
975
|
const x = t.indexOf(p);
|
|
976
976
|
if (x === -1) throw new Error(`Invalid character: ${p}`);
|
|
977
|
-
|
|
977
|
+
l = l << Math.log2(s) | x, o += Math.log2(s), o >= 8 && (o -= 8, f.push(l >> o & 255));
|
|
978
978
|
}
|
|
979
979
|
return new Uint8Array(f);
|
|
980
980
|
}
|
|
981
981
|
function us(e, t) {
|
|
982
982
|
const r = t.length;
|
|
983
|
-
let s = 0, o = 0,
|
|
983
|
+
let s = 0, o = 0, l = "";
|
|
984
984
|
for (let f = 0; f < e.length; f++)
|
|
985
|
-
for (o = o << 8 | e[f], s += 8; s >= Math.log2(r); ) s -= Math.log2(r),
|
|
986
|
-
return s > 0 && (
|
|
985
|
+
for (o = o << 8 | e[f], s += 8; s >= Math.log2(r); ) s -= Math.log2(r), l += t[o >> s & r - 1];
|
|
986
|
+
return s > 0 && (l += t[o << Math.log2(r) - s & r - 1]), l.length % 4 !== 0 && (l += "=".repeat(4 - l.length % 4)), l;
|
|
987
987
|
}
|
|
988
988
|
function Oo(e) {
|
|
989
989
|
e.startsWith("0x") && (e = e.slice(2));
|
|
@@ -998,13 +998,13 @@ var ci = {};
|
|
|
998
998
|
return Array.from(e).map((t) => t.toString(16).padStart(2, "0")).join("");
|
|
999
999
|
}
|
|
1000
1000
|
function Mo(e, t) {
|
|
1001
|
-
const r = e.split("/").filter((
|
|
1001
|
+
const r = e.split("/").filter((l) => l), s = t.split("/").filter((l) => l);
|
|
1002
1002
|
if (r.length !== s.length) return null;
|
|
1003
1003
|
const o = {};
|
|
1004
|
-
for (let
|
|
1005
|
-
const f = r[
|
|
1006
|
-
if (f.startsWith(":")) o[f.slice(1)] = s[
|
|
1007
|
-
else if (f !== s[
|
|
1004
|
+
for (let l = 0; l < r.length; l++) {
|
|
1005
|
+
const f = r[l];
|
|
1006
|
+
if (f.startsWith(":")) o[f.slice(1)] = s[l];
|
|
1007
|
+
else if (f !== s[l]) return null;
|
|
1008
1008
|
}
|
|
1009
1009
|
return o;
|
|
1010
1010
|
}
|
|
@@ -1023,17 +1023,17 @@ var ci = {};
|
|
|
1023
1023
|
avoid: f.avoid
|
|
1024
1024
|
})),
|
|
1025
1025
|
s
|
|
1026
|
-
),
|
|
1026
|
+
), l = [];
|
|
1027
1027
|
for (const f of o) {
|
|
1028
1028
|
const g = f.variants.filter((x) => x !== f.avoid), p = g.find((x) => e.includes(x));
|
|
1029
|
-
if (p && (St(
|
|
1029
|
+
if (p && (St(l, ur(e, p, g)), l.length >= r)) break;
|
|
1030
1030
|
}
|
|
1031
|
-
if (
|
|
1031
|
+
if (l.length < r)
|
|
1032
1032
|
for (const f of o) {
|
|
1033
1033
|
const g = f.variants.find((p) => e.includes(p));
|
|
1034
|
-
if (g && (St(
|
|
1034
|
+
if (g && (St(l, ur(e, g, f.variants)), l.length >= r)) break;
|
|
1035
1035
|
}
|
|
1036
|
-
return
|
|
1036
|
+
return l.slice(0, r);
|
|
1037
1037
|
}
|
|
1038
1038
|
function Co(e, t, r, s = !1) {
|
|
1039
1039
|
const o = new RegExp(s ? `(?<=\\s|^)${t}(?=\\s|$)` : `\\b${t}\\b`, "g");
|
|
@@ -1057,12 +1057,12 @@ var ci = {};
|
|
|
1057
1057
|
}
|
|
1058
1058
|
function jo(e, t, r = {}) {
|
|
1059
1059
|
const s = [];
|
|
1060
|
-
let o = "",
|
|
1060
|
+
let o = "", l = 0;
|
|
1061
1061
|
for (let f = 0; f < e.length; f++) {
|
|
1062
1062
|
const g = e[f], p = r[g] || 1;
|
|
1063
|
-
if (o += g,
|
|
1063
|
+
if (o += g, l += p, l > t) {
|
|
1064
1064
|
const { line: x, rest: M } = ls(o);
|
|
1065
|
-
s.push(x), o = M,
|
|
1065
|
+
s.push(x), o = M, l = M.split("").map((j) => r[j] || 1).reduce((j, Ne) => j + Ne, 0);
|
|
1066
1066
|
}
|
|
1067
1067
|
}
|
|
1068
1068
|
return o && s.push(o), s;
|
|
@@ -1073,8 +1073,8 @@ var ci = {};
|
|
|
1073
1073
|
for (let s = 0; s <= t.length; s++) r[0][s] = s;
|
|
1074
1074
|
for (let s = 1; s <= e.length; s++)
|
|
1075
1075
|
for (let o = 1; o <= t.length; o++) {
|
|
1076
|
-
const
|
|
1077
|
-
r[s][o] = Math.min(r[s - 1][o] + 1, r[s][o - 1] + 1, r[s - 1][o - 1] +
|
|
1076
|
+
const l = e[s - 1] === t[o - 1] ? 0 : 1;
|
|
1077
|
+
r[s][o] = Math.min(r[s - 1][o] + 1, r[s][o - 1] + 1, r[s - 1][o - 1] + l);
|
|
1078
1078
|
}
|
|
1079
1079
|
return r[e.length][t.length];
|
|
1080
1080
|
}
|
|
@@ -1088,8 +1088,8 @@ var ci = {};
|
|
|
1088
1088
|
const t = {}, r = e.match(/([a-z\-]+)="([^"]+)"/g);
|
|
1089
1089
|
if (r)
|
|
1090
1090
|
for (const s of r) {
|
|
1091
|
-
const [o,
|
|
1092
|
-
t[o] =
|
|
1091
|
+
const [o, l] = ar(s, "=");
|
|
1092
|
+
t[o] = l.slice(1, l.length - 1);
|
|
1093
1093
|
}
|
|
1094
1094
|
return t;
|
|
1095
1095
|
}
|
|
@@ -1104,16 +1104,16 @@ var ci = {};
|
|
|
1104
1104
|
}
|
|
1105
1105
|
function ds(e, t, r, s = "$", o = ":") {
|
|
1106
1106
|
if (r === "") return e;
|
|
1107
|
-
let
|
|
1108
|
-
for (;
|
|
1109
|
-
if (e[
|
|
1110
|
-
if (e[
|
|
1107
|
+
let l = e.indexOf(`${s}${t}`);
|
|
1108
|
+
for (; l !== -1; ) {
|
|
1109
|
+
if (e[l + t.length + 1] === o)
|
|
1110
|
+
if (e[l + t.length + 2] === o) e = e.replace(`${s}${t}${o}${o}`, r);
|
|
1111
1111
|
else {
|
|
1112
|
-
const f = Mt(e,
|
|
1112
|
+
const f = Mt(e, l + t.length + 2, ["_"]);
|
|
1113
1113
|
e = e.replace(`${s}${t}${o}${f}`, r);
|
|
1114
1114
|
}
|
|
1115
1115
|
else e = e.replace(`${s}${t}`, r);
|
|
1116
|
-
|
|
1116
|
+
l = e.indexOf(`${s}${t}`, l + r.length);
|
|
1117
1117
|
}
|
|
1118
1118
|
return e;
|
|
1119
1119
|
}
|
|
@@ -1124,8 +1124,8 @@ var ci = {};
|
|
|
1124
1124
|
if (e[s + o.length + 1] === r)
|
|
1125
1125
|
if (e[s + o.length + 2] === r) e = e.replace(`${t}${o}${r}${r}`, "");
|
|
1126
1126
|
else {
|
|
1127
|
-
const
|
|
1128
|
-
e = e.replace(`${t}${o}${r}${
|
|
1127
|
+
const l = Mt(e, s + o.length + 2);
|
|
1128
|
+
e = e.replace(`${t}${o}${r}${l}`, l);
|
|
1129
1129
|
}
|
|
1130
1130
|
s = e.indexOf(t, s + 1);
|
|
1131
1131
|
}
|
|
@@ -1136,7 +1136,7 @@ var ci = {};
|
|
|
1136
1136
|
for (; r !== -1; ) {
|
|
1137
1137
|
const s = ns(e, "[", r), o = e.indexOf(")", r);
|
|
1138
1138
|
if (s !== -1 && o !== -1) {
|
|
1139
|
-
const [
|
|
1139
|
+
const [l, f] = e.slice(s + 1, o).split("]("), g = t(l, f);
|
|
1140
1140
|
e = e.slice(0, s) + g + e.slice(o + 1);
|
|
1141
1141
|
}
|
|
1142
1142
|
r = e.indexOf("](", r + 1);
|
|
@@ -1150,8 +1150,8 @@ var ci = {};
|
|
|
1150
1150
|
function zo(e) {
|
|
1151
1151
|
const t = {}, r = e.split("&");
|
|
1152
1152
|
for (const s of r) {
|
|
1153
|
-
const [o,
|
|
1154
|
-
o &&
|
|
1153
|
+
const [o, l] = s.split("=");
|
|
1154
|
+
o && l && (t[o] = decodeURIComponent(l));
|
|
1155
1155
|
}
|
|
1156
1156
|
return t;
|
|
1157
1157
|
}
|
|
@@ -1160,15 +1160,15 @@ var ci = {};
|
|
|
1160
1160
|
}
|
|
1161
1161
|
function Vo(e, t) {
|
|
1162
1162
|
let r = null, s = -1 / 0;
|
|
1163
|
-
for (const [o,
|
|
1164
|
-
const f = t(
|
|
1163
|
+
for (const [o, l] of Object.entries(e)) {
|
|
1164
|
+
const f = t(l);
|
|
1165
1165
|
f > s && (s = f, r = o);
|
|
1166
1166
|
}
|
|
1167
1167
|
return r ? [r, e[r]] : null;
|
|
1168
1168
|
}
|
|
1169
1169
|
function Wo(e, t, r, s) {
|
|
1170
|
-
const o = e.find((f) => f[t] === r),
|
|
1171
|
-
o &&
|
|
1170
|
+
const o = e.find((f) => f[t] === r), l = e.find((f) => f[t] === r + s);
|
|
1171
|
+
o && l ? (o[t] = r + s, l[t] = r) : o && (o[t] = r + s), e.sort((f, g) => At(f[t]) - At(g[t])), e.forEach((f, g) => f[t] = g + 1);
|
|
1172
1172
|
}
|
|
1173
1173
|
function Ho(e) {
|
|
1174
1174
|
const t = Object.keys(e);
|
|
@@ -1185,9 +1185,9 @@ var ci = {};
|
|
|
1185
1185
|
}
|
|
1186
1186
|
function Jo(e, t = ",", r = '"') {
|
|
1187
1187
|
const s = [];
|
|
1188
|
-
let o = "",
|
|
1188
|
+
let o = "", l = !1;
|
|
1189
1189
|
const f = e.split("");
|
|
1190
|
-
for (const g of f) g === t && !
|
|
1190
|
+
for (const g of f) g === t && !l ? (s.push(o), o = "") : g === r && (!o && !l || l) ? l = !l : o += g;
|
|
1191
1191
|
return s.push(o), s;
|
|
1192
1192
|
}
|
|
1193
1193
|
function Ko(e) {
|
|
@@ -1201,7 +1201,7 @@ var ci = {};
|
|
|
1201
1201
|
if (await e()) return !0;
|
|
1202
1202
|
} catch {
|
|
1203
1203
|
}
|
|
1204
|
-
s < r - 1 && await
|
|
1204
|
+
s < r - 1 && await d(t);
|
|
1205
1205
|
}
|
|
1206
1206
|
return !1;
|
|
1207
1207
|
}
|
|
@@ -1265,8 +1265,8 @@ var ci = {};
|
|
|
1265
1265
|
const r = new Date((t == null ? void 0 : t.now) || Date.now()), s = (t == null ? void 0 : t.labels) || ac, o = Oe(e) ? e : new Date(e);
|
|
1266
1266
|
if (ve(r) === ve(o)) return s.today(o.getUTCHours(), o.getUTCMinutes(), o.getUTCHours() > 12);
|
|
1267
1267
|
if (ve(r) - ve(o) === 1) return s.yesterday();
|
|
1268
|
-
const
|
|
1269
|
-
return ve(r) - ve(o) < 7 ? s[
|
|
1268
|
+
const l = fr(o);
|
|
1269
|
+
return ve(r) - ve(o) < 7 ? s[l.day]() : s.weeks(Math.round((r.getTime() - o.getTime()) / 6048e5));
|
|
1270
1270
|
}
|
|
1271
1271
|
const ms = {
|
|
1272
1272
|
now: () => "A few seconds",
|
|
@@ -1278,15 +1278,15 @@ var ci = {};
|
|
|
1278
1278
|
};
|
|
1279
1279
|
function ps(e, t) {
|
|
1280
1280
|
const r = (t == null ? void 0 : t.now) ?? Date.now(), s = (t == null ? void 0 : t.labels) || ms, o = a.Types.isDate(e) ? e.getTime() : e;
|
|
1281
|
-
let
|
|
1282
|
-
return
|
|
1281
|
+
let l = (r - o) / 1e3;
|
|
1282
|
+
return l < 10 ? s.now() : l < 120 ? s.seconds(Math.floor(l)) : (l /= 60, l < 120 ? s.minutes(Math.floor(l)) : (l /= 60, l < 48 ? s.hours(Math.floor(l)) : (l /= 24, l < 14 ? s.days(Math.floor(l)) : (l /= 7, s.weeks(Math.floor(l))))));
|
|
1283
1283
|
}
|
|
1284
1284
|
function cc(e, t = ms) {
|
|
1285
1285
|
return ps(0, { now: e * 1e3, labels: t });
|
|
1286
1286
|
}
|
|
1287
1287
|
function uc(e, t, r) {
|
|
1288
|
-
const s = ((r == null ? void 0 : r.now) ?? Date.now()) - e, o = Math.floor(s / t),
|
|
1289
|
-
return { cycles: o, remaining:
|
|
1288
|
+
const s = ((r == null ? void 0 : r.now) ?? Date.now()) - e, o = Math.floor(s / t), l = t / ((r == null ? void 0 : r.precision) ?? 1) - Math.ceil(s % t / ((r == null ? void 0 : r.precision) ?? 1));
|
|
1289
|
+
return { cycles: o, remaining: l };
|
|
1290
1290
|
}
|
|
1291
1291
|
const dr = {};
|
|
1292
1292
|
function lc(e, t) {
|
|
@@ -1298,8 +1298,8 @@ var ci = {};
|
|
|
1298
1298
|
}
|
|
1299
1299
|
function hc(e, t, r, s) {
|
|
1300
1300
|
s || (s = Date.now());
|
|
1301
|
-
const o = t / r,
|
|
1302
|
-
return { deltaMs:
|
|
1301
|
+
const o = t / r, l = s - e, f = l / t, g = f * r, p = g - l;
|
|
1302
|
+
return { deltaMs: l, progress: o, baseTimeMs: f, totalTimeMs: g, remainingTimeMs: p };
|
|
1303
1303
|
}
|
|
1304
1304
|
const mc = {
|
|
1305
1305
|
0: "sunday",
|
|
@@ -1398,8 +1398,8 @@ var ci = {};
|
|
|
1398
1398
|
async function Ac(e, t, r) {
|
|
1399
1399
|
const s = Date.now(), o = hr[e];
|
|
1400
1400
|
if (o && o.validUntil > s) return o.value;
|
|
1401
|
-
const
|
|
1402
|
-
return hr[e] = { value:
|
|
1401
|
+
const l = await r(), f = s + t;
|
|
1402
|
+
return hr[e] = { value: l, validUntil: f }, l;
|
|
1403
1403
|
}
|
|
1404
1404
|
function Tc(e) {
|
|
1405
1405
|
delete hr[e];
|
|
@@ -1408,9 +1408,9 @@ var ci = {};
|
|
|
1408
1408
|
return e.filter((t) => t).join("/").replace(new RegExp("(?<!:)\\/+", "g"), "/");
|
|
1409
1409
|
}
|
|
1410
1410
|
function Sc(e, t, r, s, o = !0) {
|
|
1411
|
-
const
|
|
1412
|
-
if (
|
|
1413
|
-
return o ? e.substring(0,
|
|
1411
|
+
const l = e.indexOf(t), f = e.indexOf(r, l + t.length);
|
|
1412
|
+
if (l === -1 || f === -1) throw Error("Start or end not found");
|
|
1413
|
+
return o ? e.substring(0, l + t.length) + s + e.substring(f) : e.substring(0, l) + s + e.substring(f + r.length);
|
|
1414
1414
|
}
|
|
1415
1415
|
function Oc(e) {
|
|
1416
1416
|
let t = "p";
|
|
@@ -1473,14 +1473,14 @@ var ci = {};
|
|
|
1473
1473
|
};
|
|
1474
1474
|
}
|
|
1475
1475
|
function jc(e, t, r, s, o) {
|
|
1476
|
-
const
|
|
1477
|
-
for (const f of Object.keys(t))
|
|
1478
|
-
|
|
1476
|
+
const l = {};
|
|
1477
|
+
for (const f of Object.keys(t)) l[f] = [];
|
|
1478
|
+
l[s] = [], o && (e = e.sort(o));
|
|
1479
1479
|
for (const f of e) {
|
|
1480
1480
|
const g = f[r], p = t[g] ? g : s;
|
|
1481
|
-
|
|
1481
|
+
l[p].length >= t[p] ? l[s].push(f) : l[p].push(f);
|
|
1482
1482
|
}
|
|
1483
|
-
return
|
|
1483
|
+
return l;
|
|
1484
1484
|
}
|
|
1485
1485
|
function Uc(e, t) {
|
|
1486
1486
|
const r = Object.keys(e), s = Object.keys(t);
|
|
@@ -1522,15 +1522,15 @@ var ci = {};
|
|
|
1522
1522
|
function Lc(e, t, r) {
|
|
1523
1523
|
let s = e.length - t;
|
|
1524
1524
|
if (s <= 0) return "0." + "0".repeat(-s) + e + (r ? " " + r : "");
|
|
1525
|
-
let o = e.substring(0, s),
|
|
1526
|
-
return o === "" && (o = "0"), o + "." +
|
|
1525
|
+
let o = e.substring(0, s), l = e.substring(s);
|
|
1526
|
+
return o === "" && (o = "0"), o + "." + l + (r ? " " + r : "");
|
|
1527
1527
|
}
|
|
1528
1528
|
function zc(e, t) {
|
|
1529
|
-
const r = (t == null ? void 0 : t.longForm) ?? !1, s = t != null && t.unit ? ` ${t.unit}` : "", o = r ? Bc : xs,
|
|
1529
|
+
const r = (t == null ? void 0 : t.longForm) ?? !1, s = t != null && t.unit ? ` ${t.unit}` : "", o = r ? Bc : xs, l = (t == null ? void 0 : t.precision) ?? 1;
|
|
1530
1530
|
if (e < ue[0]) return `${e}${s}`;
|
|
1531
1531
|
for (let f = 0; f < ue.length - 1; f++)
|
|
1532
|
-
if (e < ue[f + 1]) return `${(e / ue[f]).toFixed(
|
|
1533
|
-
return `${(e / ue[ue.length - 1]).toFixed(
|
|
1532
|
+
if (e < ue[f + 1]) return `${(e / ue[f]).toFixed(l)}${r ? " " : ""}${o[f]}${s}`;
|
|
1533
|
+
return `${(e / ue[ue.length - 1]).toFixed(l)}${r ? " " : ""}${o[ue.length - 1]}${s}`;
|
|
1534
1534
|
}
|
|
1535
1535
|
function mr(e) {
|
|
1536
1536
|
const t = parseFloat(e);
|
|
@@ -1615,13 +1615,13 @@ var ci = {};
|
|
|
1615
1615
|
function iu(e) {
|
|
1616
1616
|
const t = Object.keys(e), r = t.map((g) => e[g].length), s = r.reduce((g, p) => g *= p);
|
|
1617
1617
|
let o = 1;
|
|
1618
|
-
const
|
|
1619
|
-
for (let g = 0; g < r.length - 1; g++) o *= r[g],
|
|
1618
|
+
const l = [1];
|
|
1619
|
+
for (let g = 0; g < r.length - 1; g++) o *= r[g], l.push(o);
|
|
1620
1620
|
const f = [];
|
|
1621
1621
|
for (let g = 0; g < s; g++) {
|
|
1622
1622
|
const p = {};
|
|
1623
1623
|
for (let x = 0; x < t.length; x++) {
|
|
1624
|
-
const M = e[t[x]], j = Math.floor(g /
|
|
1624
|
+
const M = e[t[x]], j = Math.floor(g / l[x]) % M.length;
|
|
1625
1625
|
p[t[x]] = M[j];
|
|
1626
1626
|
}
|
|
1627
1627
|
f.push(p);
|
|
@@ -1636,8 +1636,8 @@ var ci = {};
|
|
|
1636
1636
|
}
|
|
1637
1637
|
function Ct(e, t, r, s, o) {
|
|
1638
1638
|
if (!oe(t)) return t;
|
|
1639
|
-
for (const [
|
|
1640
|
-
const g = ou(r,
|
|
1639
|
+
for (const [l, f] of Object.entries(t)) {
|
|
1640
|
+
const g = ou(r, l, s);
|
|
1641
1641
|
Array.isArray(f) ? o ? Ct(e, f, g, !0, o) : e[g] = f.map((p) => Ct(Array.isArray(p) ? [] : {}, p, "", !1, o)) : oe(f) ? Ct(e, f, g, !1, o) : e[g] = f;
|
|
1642
1642
|
}
|
|
1643
1643
|
return e;
|
|
@@ -1698,8 +1698,8 @@ var ci = {};
|
|
|
1698
1698
|
return Object.values(Es(e, t));
|
|
1699
1699
|
}
|
|
1700
1700
|
function mu(e, t, r, s, o) {
|
|
1701
|
-
const
|
|
1702
|
-
for (const p of
|
|
1701
|
+
const l = t ? e.map(t) : e, f = {};
|
|
1702
|
+
for (const p of l) f[p] = (f[p] || 0) + 1;
|
|
1703
1703
|
const g = s ? Ss(f, o ? (p, x) => p[1] - x[1] : (p, x) => x[1] - p[1]) : f;
|
|
1704
1704
|
return r ? Object.keys(g) : g;
|
|
1705
1705
|
}
|
|
@@ -1709,9 +1709,9 @@ var ci = {};
|
|
|
1709
1709
|
function pu(e) {
|
|
1710
1710
|
const t = [], r = Object.keys(e), s = e[r[0]].length;
|
|
1711
1711
|
for (let o = 0; o < s; o++) {
|
|
1712
|
-
const
|
|
1713
|
-
for (const f of r)
|
|
1714
|
-
t.push(
|
|
1712
|
+
const l = {};
|
|
1713
|
+
for (const f of r) l[f] = e[f][o];
|
|
1714
|
+
t.push(l);
|
|
1715
1715
|
}
|
|
1716
1716
|
return t;
|
|
1717
1717
|
}
|
|
@@ -1724,8 +1724,8 @@ var ci = {};
|
|
|
1724
1724
|
function gr(e, t) {
|
|
1725
1725
|
const r = [];
|
|
1726
1726
|
let s = [];
|
|
1727
|
-
return e.forEach((o,
|
|
1728
|
-
(
|
|
1727
|
+
return e.forEach((o, l) => {
|
|
1728
|
+
(l === 0 || !t(o, e[l - 1])) && (s = [], r.push(s)), s.push(o);
|
|
1729
1729
|
}), r;
|
|
1730
1730
|
}
|
|
1731
1731
|
function vu() {
|
|
@@ -1846,16 +1846,16 @@ var ci = {};
|
|
|
1846
1846
|
}
|
|
1847
1847
|
}
|
|
1848
1848
|
function Cu(e, t, r, s, o = !1) {
|
|
1849
|
-
const
|
|
1849
|
+
const l = /* @__PURE__ */ new Map(), f = [];
|
|
1850
1850
|
e.forEach((p) => {
|
|
1851
1851
|
const x = new $u(p);
|
|
1852
|
-
|
|
1852
|
+
l.set(p[t], x);
|
|
1853
1853
|
}), e.forEach((p) => {
|
|
1854
|
-
const x =
|
|
1854
|
+
const x = l.get(p[t]);
|
|
1855
1855
|
if (!x) return;
|
|
1856
1856
|
const M = p[r];
|
|
1857
1857
|
if (M) {
|
|
1858
|
-
const j =
|
|
1858
|
+
const j = l.get(M);
|
|
1859
1859
|
j && j.children.push(x);
|
|
1860
1860
|
} else f.push(x);
|
|
1861
1861
|
});
|
|
@@ -1873,15 +1873,15 @@ var ci = {};
|
|
|
1873
1873
|
for (; r.length > 1; ) {
|
|
1874
1874
|
const s = [];
|
|
1875
1875
|
for (let o = 0; o < r.length; o += 2) {
|
|
1876
|
-
const
|
|
1877
|
-
s.push(t(r[o],
|
|
1876
|
+
const l = r[o + 1];
|
|
1877
|
+
s.push(t(r[o], l));
|
|
1878
1878
|
}
|
|
1879
1879
|
r = s;
|
|
1880
1880
|
}
|
|
1881
1881
|
return r[0];
|
|
1882
1882
|
}
|
|
1883
1883
|
function Me(...e) {
|
|
1884
|
-
const t = e.reduce((o,
|
|
1884
|
+
const t = e.reduce((o, l) => o + l.length, 0), r = new Uint8Array(t);
|
|
1885
1885
|
let s = 0;
|
|
1886
1886
|
return e.forEach((o) => {
|
|
1887
1887
|
r.set(o, s), s += o.length;
|
|
@@ -2008,7 +2008,7 @@ var ci = {};
|
|
|
2008
2008
|
];
|
|
2009
2009
|
function zu(e) {
|
|
2010
2010
|
for (let t = 0; t < 24; t++) {
|
|
2011
|
-
const r = 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],
|
|
2011
|
+
const r = 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], l = e[3] ^ e[13] ^ e[23] ^ e[33] ^ e[43], f = e[4] ^ e[14] ^ e[24] ^ e[34] ^ e[44], g = e[5] ^ e[15] ^ e[25] ^ e[35] ^ e[45], p = 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], j = e[9] ^ e[19] ^ e[29] ^ e[39] ^ e[49], Ne = o << 1 | l >>> 31, El = l << 1 | o >>> 31, Ye = M ^ Ne, Qe = j ^ El, Al = f << 1 | g >>> 31, Tl = g << 1 | f >>> 31, Xe = r ^ Al, et = s ^ Tl, Sl = p << 1 | x >>> 31, Ol = x << 1 | p >>> 31, tt = o ^ Sl, rt = l ^ Ol, Il = M << 1 | j >>> 31, Ml = j << 1 | M >>> 31, nt = f ^ Il, st = g ^ Ml, $l = r << 1 | s >>> 31, Cl = s << 1 | r >>> 31, it = p ^ $l, at = x ^ Cl;
|
|
2012
2012
|
e[0] ^= Ye, e[1] ^= Qe, e[2] ^= Xe, e[3] ^= et, e[4] ^= tt, e[5] ^= rt, e[6] ^= nt, e[7] ^= st, e[8] ^= it, e[9] ^= at, e[10] ^= Ye, e[11] ^= Qe, e[12] ^= Xe, e[13] ^= et, e[14] ^= tt, e[15] ^= rt, e[16] ^= nt, e[17] ^= st, e[18] ^= it, e[19] ^= at, e[20] ^= Ye, e[21] ^= Qe, e[22] ^= Xe, e[23] ^= et, e[24] ^= tt, e[25] ^= rt, e[26] ^= nt, e[27] ^= st, e[28] ^= it, e[29] ^= at, e[30] ^= Ye, e[31] ^= Qe, e[32] ^= Xe, e[33] ^= et, e[34] ^= tt, e[35] ^= rt, e[36] ^= nt, e[37] ^= st, e[38] ^= it, e[39] ^= at, e[40] ^= Ye, e[41] ^= Qe, e[42] ^= Xe, e[43] ^= et, e[44] ^= tt, e[45] ^= rt, e[46] ^= nt, e[47] ^= st, e[48] ^= it, e[49] ^= at;
|
|
2013
2013
|
const Er = e[0], Ar = e[1], Tr = e[2] << 1 | e[3] >>> 31, Sr = e[3] << 1 | e[2] >>> 31, Or = e[5] << 30 | e[4] >>> 2, Ir = e[4] << 30 | e[5] >>> 2, Mr = e[6] << 28 | e[7] >>> 4, $r = e[7] << 28 | e[6] >>> 4, Cr = e[8] << 27 | e[9] >>> 5, Nr = e[9] << 27 | e[8] >>> 5, Rr = e[11] << 4 | e[10] >>> 28, Dr = e[10] << 4 | e[11] >>> 28, jr = e[13] << 12 | e[12] >>> 20, Ur = e[12] << 12 | e[13] >>> 20, Zr = e[14] << 6 | e[15] >>> 26, Pr = e[15] << 6 | e[14] >>> 26, Br = e[17] << 23 | e[16] >>> 9, Lr = e[16] << 23 | e[17] >>> 9, zr = e[18] << 20 | e[19] >>> 12, Fr = e[19] << 20 | e[18] >>> 12, Vr = e[20] << 3 | e[21] >>> 29, Wr = e[21] << 3 | e[20] >>> 29, Hr = e[22] << 10 | e[23] >>> 22, qr = e[23] << 10 | e[22] >>> 22, Gr = e[25] << 11 | e[24] >>> 21, Jr = e[24] << 11 | e[25] >>> 21, Kr = e[26] << 25 | e[27] >>> 7, Yr = e[27] << 25 | e[26] >>> 7, Qr = e[29] << 7 | e[28] >>> 25, Xr = e[28] << 7 | e[29] >>> 25, en = e[31] << 9 | e[30] >>> 23, tn = e[30] << 9 | e[31] >>> 23, rn = e[33] << 13 | e[32] >>> 19, nn = e[32] << 13 | e[33] >>> 19, sn = e[34] << 15 | e[35] >>> 17, an = e[35] << 15 | e[34] >>> 17, on = e[36] << 21 | e[37] >>> 11, cn = e[37] << 21 | e[36] >>> 11, un = e[38] << 8 | e[39] >>> 24, ln = e[39] << 8 | e[38] >>> 24, dn = e[40] << 18 | e[41] >>> 14, fn = e[41] << 18 | e[40] >>> 14, hn = e[42] << 2 | e[43] >>> 30, mn = e[43] << 2 | e[42] >>> 30, pn = e[45] << 29 | e[44] >>> 3, gn = e[44] << 29 | e[45] >>> 3, yn = e[47] << 24 | e[46] >>> 8, vn = e[46] << 24 | e[47] >>> 8, wn = e[48] << 14 | e[49] >>> 18, bn = e[49] << 14 | e[48] >>> 18;
|
|
2014
2014
|
e[0] = Er ^ ~jr & Gr, e[1] = Ar ^ ~Ur & Jr, e[2] = jr ^ ~Gr & on, e[3] = Ur ^ ~Jr & cn, e[4] = Gr ^ ~on & wn, e[5] = Jr ^ ~cn & bn, e[6] = on ^ ~wn & Er, e[7] = cn ^ ~bn & Ar, e[8] = wn ^ ~Er & jr, e[9] = bn ^ ~Ar & Ur, e[10] = Mr ^ ~zr & Vr, e[11] = $r ^ ~Fr & Wr, e[12] = zr ^ ~Vr & rn, e[13] = Fr ^ ~Wr & nn, e[14] = Vr ^ ~rn & pn, e[15] = Wr ^ ~nn & gn, e[16] = rn ^ ~pn & Mr, e[17] = nn ^ ~gn & $r, e[18] = pn ^ ~Mr & zr, e[19] = gn ^ ~$r & Fr, e[20] = Tr ^ ~Zr & Kr, e[21] = Sr ^ ~Pr & Yr, e[22] = Zr ^ ~Kr & un, e[23] = Pr ^ ~Yr & ln, e[24] = Kr ^ ~un & dn, e[25] = Yr ^ ~ln & fn, e[26] = un ^ ~dn & Tr, e[27] = ln ^ ~fn & Sr, e[28] = dn ^ ~Tr & Zr, e[29] = fn ^ ~Sr & Pr, e[30] = Cr ^ ~Rr & Hr, e[31] = Nr ^ ~Dr & qr, e[32] = Rr ^ ~Hr & sn, e[33] = Dr ^ ~qr & an, e[34] = Hr ^ ~sn & yn, e[35] = qr ^ ~an & vn, e[36] = sn ^ ~yn & Cr, e[37] = an ^ ~vn & Nr, e[38] = yn ^ ~Cr & Rr, e[39] = vn ^ ~Nr & Dr, e[40] = Or ^ ~Br & Qr, e[41] = Ir ^ ~Lr & Xr, e[42] = Br ^ ~Qr & en, e[43] = Lr ^ ~Xr & tn, e[44] = Qr ^ ~en & hn, e[45] = Xr ^ ~tn & mn, e[46] = en ^ ~hn & Or, e[47] = tn ^ ~mn & Ir, e[48] = hn ^ ~Or & Br, e[49] = mn ^ ~Ir & Lr, e[0] ^= Ns[t * 2], e[1] ^= Ns[t * 2 + 1];
|
|
@@ -2087,8 +2087,8 @@ var ci = {};
|
|
|
2087
2087
|
function Vu(e, t, r) {
|
|
2088
2088
|
const s = Math.min(e.length, t.length, r / 8 + 1);
|
|
2089
2089
|
for (let o = 0; o < s; o++) {
|
|
2090
|
-
const
|
|
2091
|
-
for (let f = 0; f < 8; f++) if (
|
|
2090
|
+
const l = e[o] ^ t[o];
|
|
2091
|
+
for (let f = 0; f < 8; f++) if (l >> 7 - f & 1) return o * 8 + f;
|
|
2092
2092
|
}
|
|
2093
2093
|
return r;
|
|
2094
2094
|
}
|
|
@@ -2098,8 +2098,8 @@ var ci = {};
|
|
|
2098
2098
|
return e.subarray(0, r);
|
|
2099
2099
|
}
|
|
2100
2100
|
function Hu(e, t, r, s) {
|
|
2101
|
-
const o = Math.floor(t / 8),
|
|
2102
|
-
r === 1 ? e[o] |= 1 << (s === "BE" ? 7 -
|
|
2101
|
+
const o = Math.floor(t / 8), l = t % 8;
|
|
2102
|
+
r === 1 ? e[o] |= 1 << (s === "BE" ? 7 - l : l) : e[o] &= ~(1 << (s === "BE" ? 7 - l : l));
|
|
2103
2103
|
}
|
|
2104
2104
|
function qu(e, t, r) {
|
|
2105
2105
|
const s = Math.floor(t / 8), o = t % 8;
|
|
@@ -2143,10 +2143,10 @@ var ci = {};
|
|
|
2143
2143
|
}
|
|
2144
2144
|
function Je(e, t) {
|
|
2145
2145
|
e = $(e, t);
|
|
2146
|
-
let [r, s] = [0n, 1n], [o,
|
|
2147
|
-
for (;
|
|
2148
|
-
const f = o /
|
|
2149
|
-
[r, s] = [s, r - f * s], [o,
|
|
2146
|
+
let [r, s] = [0n, 1n], [o, l] = [t, e];
|
|
2147
|
+
for (; l !== 0n; ) {
|
|
2148
|
+
const f = o / l;
|
|
2149
|
+
[r, s] = [s, r - f * s], [o, l] = [l, o - f * l];
|
|
2150
2150
|
}
|
|
2151
2151
|
if (o > 1n) throw new Error("a is not invertible");
|
|
2152
2152
|
return r < 0n && (r += t), r;
|
|
@@ -2162,15 +2162,15 @@ var ci = {};
|
|
|
2162
2162
|
const Z = 0xfffffffffffffffffffffffffffffffffffffffffffffffffffffffefffffc2fn, D = 0xfffffffffffffffffffffffffffffffebaaedce6af48a03bbfd25e8cd0364141n, Nt = 0x79be667ef9dcbbac55a06295ce870b07029bfcdb2dce28d959f2815b16f81798n, Rt = 0x483ada7726a3c4655da4fbfc0e1108a8fd17b448a68554199c47d08ffb10d4b8n;
|
|
2163
2163
|
function wr(e, t, r) {
|
|
2164
2164
|
if (t === 0n) return [0n, 0n];
|
|
2165
|
-
const s = $(3n * e * e * Je(2n * t, r), r), o = $(s * s - 2n * e, r),
|
|
2166
|
-
return [o,
|
|
2165
|
+
const s = $(3n * e * e * Je(2n * t, r), r), o = $(s * s - 2n * e, r), l = $(s * (e - o) - t, r);
|
|
2166
|
+
return [o, l];
|
|
2167
2167
|
}
|
|
2168
2168
|
function Dt(e, t, r, s, o) {
|
|
2169
2169
|
if (e === 0n && t === 0n) return [r, s];
|
|
2170
2170
|
if (r === 0n && s === 0n) return [e, t];
|
|
2171
2171
|
if (e === r && t === $(-s, o)) return [0n, 0n];
|
|
2172
2172
|
if (e === r && t === s) return wr(e, t, o);
|
|
2173
|
-
const
|
|
2173
|
+
const l = $((s - t) * Je(r - e, o), o), f = $(l * l - e - r, o), g = $(l * (e - f) - t, o);
|
|
2174
2174
|
return [f, g];
|
|
2175
2175
|
}
|
|
2176
2176
|
function el(e) {
|
|
@@ -2199,10 +2199,10 @@ var ci = {};
|
|
|
2199
2199
|
return s;
|
|
2200
2200
|
}
|
|
2201
2201
|
function be(e, t, r, s) {
|
|
2202
|
-
let o = [0n, 0n],
|
|
2202
|
+
let o = [0n, 0n], l = [e, t];
|
|
2203
2203
|
const f = r.toString(2);
|
|
2204
2204
|
for (const g of f)
|
|
2205
|
-
g === "0" ? (
|
|
2205
|
+
g === "0" ? (l = Dt(o[0], o[1], l[0], l[1], s), o = wr(o[0], o[1], s)) : (o = Dt(o[0], o[1], l[0], l[1], s), l = wr(l[0], l[1], s));
|
|
2206
2206
|
return o;
|
|
2207
2207
|
}
|
|
2208
2208
|
function il(e, t, r) {
|
|
@@ -2218,20 +2218,20 @@ var ci = {};
|
|
|
2218
2218
|
D
|
|
2219
2219
|
)), r <= 0n || r >= D)
|
|
2220
2220
|
throw new Error("Invalid nonce");
|
|
2221
|
-
const s = $(e, D), o = be(Nt, Rt, r, Z),
|
|
2222
|
-
let f = $((s + $(
|
|
2223
|
-
if (
|
|
2221
|
+
const s = $(e, D), o = be(Nt, Rt, r, Z), l = $(o[0], D);
|
|
2222
|
+
let f = $((s + $(l, D) * t) * Je(r, D), D);
|
|
2223
|
+
if (l === 0n || f === 0n) throw new Error("Invalid r or s value");
|
|
2224
2224
|
let g = o[1] % 2n === 0n ? 27n : 28n;
|
|
2225
|
-
return f > D / 2n && (f = D - f, g = g === 27n ? 28n : 27n), [
|
|
2225
|
+
return f > D / 2n && (f = D - f, g = g === 27n ? 28n : 27n), [l, f, g];
|
|
2226
2226
|
}
|
|
2227
2227
|
function al(e, t, r, s) {
|
|
2228
2228
|
const o = Bs($(t ** 3n + 7n, Z), Z);
|
|
2229
2229
|
if (!o) throw new Error("Invalid r: does not correspond to a valid curve point");
|
|
2230
|
-
const
|
|
2230
|
+
const l = s === 27n ? 0n : 1n, f = o % 2n === l ? o : Z - o, g = $(Ce(ne(e), "BE"), D), p = be(t, f, r, Z), x = be(Nt, Rt, g, Z), M = Dt(p[0], p[1], x[0], $(-x[1], Z), Z);
|
|
2231
2231
|
return be(M[0], M[1], Je(t, D), Z);
|
|
2232
2232
|
}
|
|
2233
2233
|
function ol(e, t, r, s) {
|
|
2234
|
-
const o = $(Ce(ne(e), "BE"), D),
|
|
2234
|
+
const o = $(Ce(ne(e), "BE"), D), l = Je(s, D), f = $(o * l, D), g = $(r * l, D), p = be(Nt, Rt, f, Z), x = be(t[0], t[1], g, Z), M = Dt(p[0], p[1], x[0], x[1], Z);
|
|
2235
2235
|
return r === $(M[0], D);
|
|
2236
2236
|
}
|
|
2237
2237
|
class zs {
|
|
@@ -2285,8 +2285,8 @@ var ci = {};
|
|
|
2285
2285
|
const o = new zs(t);
|
|
2286
2286
|
for (; o.max() > 0; ) {
|
|
2287
2287
|
this.chunks[r].writer.max() === 0 && await this.elevate(r);
|
|
2288
|
-
const
|
|
2289
|
-
s ? this.chunks[r].span += s : this.chunks[0].span += BigInt(
|
|
2288
|
+
const l = this.chunks[r].writer.write(o);
|
|
2289
|
+
s ? this.chunks[r].span += s : this.chunks[0].span += BigInt(l);
|
|
2290
2290
|
}
|
|
2291
2291
|
}
|
|
2292
2292
|
async elevate(t) {
|
|
@@ -2323,8 +2323,8 @@ var ci = {};
|
|
|
2323
2323
|
}
|
|
2324
2324
|
exchange(t, r, s) {
|
|
2325
2325
|
if (t === "*") {
|
|
2326
|
-
const
|
|
2327
|
-
return new G(
|
|
2326
|
+
const l = this.value * r.value / 10n ** BigInt(this.scale);
|
|
2327
|
+
return new G(l, s);
|
|
2328
2328
|
}
|
|
2329
2329
|
this.assertSameScale(r);
|
|
2330
2330
|
const o = this.value * 10n ** BigInt(s) / r.value;
|
|
@@ -2355,9 +2355,9 @@ var ci = {};
|
|
|
2355
2355
|
return t.ttlMax ? --t.ttl <= 0 && e.shift() : t.ttlMax = t.ttl, { progress: (t.ttlMax - t.ttl) / t.ttlMax, data: t.data };
|
|
2356
2356
|
}
|
|
2357
2357
|
function Ut(e, t, r, s) {
|
|
2358
|
-
const o = e.findIndex((g) => g === `--${t}` || g.startsWith(`--${t}=`)),
|
|
2359
|
-
if (!
|
|
2360
|
-
if (
|
|
2358
|
+
const o = e.findIndex((g) => g === `--${t}` || g.startsWith(`--${t}=`)), l = e[o];
|
|
2359
|
+
if (!l) return (r || {})[s || t || ""] || null;
|
|
2360
|
+
if (l.includes("=")) return l.split("=")[1];
|
|
2361
2361
|
const f = e[o + 1];
|
|
2362
2362
|
return f && !f.startsWith("-") ? f : (r || {})[s || t || ""] || null;
|
|
2363
2363
|
}
|
|
@@ -2371,13 +2371,13 @@ var ci = {};
|
|
|
2371
2371
|
}
|
|
2372
2372
|
}
|
|
2373
2373
|
function ll(e, t, r, s) {
|
|
2374
|
-
const o = e.some((p) => p.endsWith("-" + t)),
|
|
2375
|
-
if (!
|
|
2376
|
-
if (!
|
|
2374
|
+
const o = e.some((p) => p.endsWith("-" + t)), l = Ut(e, t, r, s);
|
|
2375
|
+
if (!l && o) return !0;
|
|
2376
|
+
if (!l && !o) return null;
|
|
2377
2377
|
const f = ["true", "1", "yes", "y", "on"], g = ["false", "0", "no", "n", "off"];
|
|
2378
|
-
if (f.includes(
|
|
2379
|
-
if (g.includes(
|
|
2380
|
-
throw Error(`Invalid boolean argument ${t}: ${
|
|
2378
|
+
if (f.includes(l.toLowerCase())) return !0;
|
|
2379
|
+
if (g.includes(l.toLowerCase())) return !1;
|
|
2380
|
+
throw Error(`Invalid boolean argument ${t}: ${l}`);
|
|
2381
2381
|
}
|
|
2382
2382
|
function Vs(e, t, r, s) {
|
|
2383
2383
|
const o = Ut(e, t, r, s);
|
|
@@ -2422,8 +2422,8 @@ var ci = {};
|
|
|
2422
2422
|
function Ke(e, t, r = "row-first") {
|
|
2423
2423
|
const s = [];
|
|
2424
2424
|
if (r === "column-first")
|
|
2425
|
-
for (let o = 0; o < e.length; o++) for (let
|
|
2426
|
-
else for (let o = 0; o < e[0].length; o++) for (let
|
|
2425
|
+
for (let o = 0; o < e.length; o++) for (let l = 0; l < e[0].length; l++) t(o, l) && s.push({ x: o, y: l });
|
|
2426
|
+
else for (let o = 0; o < e[0].length; o++) for (let l = 0; l < e.length; l++) t(l, o) && s.push({ x: l, y: o });
|
|
2427
2427
|
return s;
|
|
2428
2428
|
}
|
|
2429
2429
|
function pl(e, t, r) {
|
|
@@ -2449,9 +2449,9 @@ var ci = {};
|
|
|
2449
2449
|
return !e[t][r + 1];
|
|
2450
2450
|
}
|
|
2451
2451
|
function yl(e, t, r) {
|
|
2452
|
-
var o,
|
|
2452
|
+
var o, l, f, g, p, x, M, j;
|
|
2453
2453
|
const s = [];
|
|
2454
|
-
return e[t][r] ? pl(e, t, r) || gl(e, t, r) ? [] : (!((o = e[t - 1]) != null && o[r - 1]) && Js(e, t, r) && Ys(e, t, r) && s.push({ x: t, y: r }), !((
|
|
2454
|
+
return e[t][r] ? pl(e, t, r) || gl(e, t, r) ? [] : (!((o = e[t - 1]) != null && o[r - 1]) && Js(e, t, r) && Ys(e, t, r) && s.push({ x: t, y: r }), !((l = e[t + 1]) != null && l[r - 1]) && Ks(e, t, r) && Ys(e, t, r) && s.push({ x: t + 1, y: r }), !((f = e[t - 1]) != null && f[r + 1]) && Js(e, t, r) && Qs(e, t, r) && s.push({ x: t, y: r + 1 }), !((g = e[t + 1]) != null && g[r + 1]) && Ks(e, t, r) && Qs(e, t, r) && s.push({ x: t + 1, y: r + 1 }), s) : ((p = e[t - 1]) != null && p[r] && e[t][r - 1] && s.push({ x: t, y: r }), (x = e[t + 1]) != null && x[r] && e[t][r - 1] && s.push({ x: t + 1, y: r }), (M = e[t - 1]) != null && M[r] && e[t][r + 1] && s.push({ x: t, y: r + 1 }), (j = e[t + 1]) != null && j[r] && e[t][r + 1] && s.push({ x: t + 1, y: r + 1 }), s);
|
|
2455
2455
|
}
|
|
2456
2456
|
function vl(e, t, r, s) {
|
|
2457
2457
|
const o = [
|
|
@@ -2460,12 +2460,12 @@ var ci = {};
|
|
|
2460
2460
|
{ x: 0, y: s },
|
|
2461
2461
|
{ x: r, y: s }
|
|
2462
2462
|
];
|
|
2463
|
-
for (let
|
|
2463
|
+
for (let l = 0; l < e.length; l++)
|
|
2464
2464
|
for (let f = 0; f < e[0].length; f++) {
|
|
2465
|
-
const g = yl(e,
|
|
2465
|
+
const g = yl(e, l, f);
|
|
2466
2466
|
for (const p of g) o.some((x) => x.x === p.x && x.y === p.y) || o.push(p);
|
|
2467
2467
|
}
|
|
2468
|
-
return o.map((
|
|
2468
|
+
return o.map((l) => ({ x: l.x * t, y: l.y * t }));
|
|
2469
2469
|
}
|
|
2470
2470
|
function wl(e, t) {
|
|
2471
2471
|
const r = Ke(e, (p, x) => e[p][x] === 0 && e[p][x + 1] !== 0, "row-first").map((p) => ({
|
|
@@ -2483,7 +2483,7 @@ var ci = {};
|
|
|
2483
2483
|
...p,
|
|
2484
2484
|
dx: 0,
|
|
2485
2485
|
dy: 1
|
|
2486
|
-
})),
|
|
2486
|
+
})), l = Ke(e, (p, x) => {
|
|
2487
2487
|
var M;
|
|
2488
2488
|
return e[p][x] === 0 && ((M = e[p + 1]) == null ? void 0 : M[x]) !== 0;
|
|
2489
2489
|
}, "column-first").map((p) => ({
|
|
@@ -2491,8 +2491,8 @@ var ci = {};
|
|
|
2491
2491
|
dx: 0,
|
|
2492
2492
|
dy: 1
|
|
2493
2493
|
}));
|
|
2494
|
-
r.forEach((p) => p.y++),
|
|
2495
|
-
const f = gr([...o, ...
|
|
2494
|
+
r.forEach((p) => p.y++), l.forEach((p) => p.x++);
|
|
2495
|
+
const f = gr([...o, ...l], (p, x) => p.x === x.x && p.y - 1 === x.y), g = gr([...s, ...r], (p, x) => p.y === x.y && p.x - 1 === x.x);
|
|
2496
2496
|
return [...f, ...g].map((p) => ({ start: p[0], end: We(p) })).map((p) => ({
|
|
2497
2497
|
start: _r(p.start, t),
|
|
2498
2498
|
end: _r(Hs(p.end, { x: p.start.dx, y: p.start.dy }), t)
|
|
@@ -2507,25 +2507,25 @@ var ci = {};
|
|
|
2507
2507
|
function Xs(e, t, r, s) {
|
|
2508
2508
|
const o = (s.y - r.y) * (t.x - e.x) - (s.x - r.x) * (t.y - e.y);
|
|
2509
2509
|
if (o === 0) return null;
|
|
2510
|
-
let
|
|
2511
|
-
const g = (s.x - r.x) *
|
|
2512
|
-
return
|
|
2510
|
+
let l = e.y - r.y, f = e.x - r.x;
|
|
2511
|
+
const g = (s.x - r.x) * l - (s.y - r.y) * f, p = (t.x - e.x) * l - (t.y - e.y) * f;
|
|
2512
|
+
return l = g / o, f = p / o, l > 0 && l < 1 && f > 0 && f < 1 ? { x: e.x + l * (t.x - e.x), y: e.y + l * (t.y - e.y) } : null;
|
|
2513
2513
|
}
|
|
2514
2514
|
function xr(e, t, r) {
|
|
2515
2515
|
const s = [], o = qs(e, r, 1e4);
|
|
2516
|
-
for (const
|
|
2517
|
-
const f = Xs(e, o,
|
|
2516
|
+
for (const l of t) {
|
|
2517
|
+
const f = Xs(e, o, l.start, l.end);
|
|
2518
2518
|
f && s.push(f);
|
|
2519
2519
|
}
|
|
2520
|
-
return s.length ? s.reduce((
|
|
2521
|
-
const g = Gs(e, f), p = Gs(e,
|
|
2522
|
-
return g < p ? f :
|
|
2520
|
+
return s.length ? s.reduce((l, f) => {
|
|
2521
|
+
const g = Gs(e, f), p = Gs(e, l);
|
|
2522
|
+
return g < p ? f : l;
|
|
2523
2523
|
}) : null;
|
|
2524
2524
|
}
|
|
2525
2525
|
function xl(e, t, r) {
|
|
2526
2526
|
const s = _l(e, r), o = [];
|
|
2527
|
-
for (const
|
|
2528
|
-
const f = xr(e, t,
|
|
2527
|
+
for (const l of s) {
|
|
2528
|
+
const f = xr(e, t, l - 1e-3), g = xr(e, t, l + 1e-3);
|
|
2529
2529
|
f && o.push(f), g && o.push(g);
|
|
2530
2530
|
}
|
|
2531
2531
|
return o;
|
|
@@ -2686,7 +2686,7 @@ var ci = {};
|
|
|
2686
2686
|
createHierarchy: Cu,
|
|
2687
2687
|
multicall: Au,
|
|
2688
2688
|
maxBy: Tu
|
|
2689
|
-
}, a.System = { sleepMillis:
|
|
2689
|
+
}, a.System = { sleepMillis: d, forever: ji, scheduleMany: Pa, waitFor: Yo, expandError: ka, runAndSetInterval: Ui }, a.Numbers = {
|
|
2690
2690
|
make: mr,
|
|
2691
2691
|
sum: La,
|
|
2692
2692
|
average: za,
|
|
@@ -3002,9 +3002,9 @@ function Gl(a, n) {
|
|
|
3002
3002
|
}
|
|
3003
3003
|
function si(a, n, i) {
|
|
3004
3004
|
n = new Pt(n), i = new _e(i);
|
|
3005
|
-
const c = Gl(n, i.publicKey().address()), u = i.sign(P.concatBytes(n.toUint8Array(), a.address.toUint8Array())),
|
|
3005
|
+
const c = Gl(n, i.publicKey().address()), u = i.sign(P.concatBytes(n.toUint8Array(), a.address.toUint8Array())), d = P.concatBytes(n.toUint8Array(), u.toUint8Array(), a.data), h = Pe.fromSlice(a.data, 0), m = je.fromSlice(a.data, Pe.LENGTH);
|
|
3006
3006
|
return {
|
|
3007
|
-
data:
|
|
3007
|
+
data: d,
|
|
3008
3008
|
identifier: n,
|
|
3009
3009
|
signature: u,
|
|
3010
3010
|
span: h,
|
|
@@ -3081,31 +3081,31 @@ var I;
|
|
|
3081
3081
|
throw new Error();
|
|
3082
3082
|
}
|
|
3083
3083
|
a.assertNever = i, a.arrayToEnum = (u) => {
|
|
3084
|
-
const
|
|
3084
|
+
const d = {};
|
|
3085
3085
|
for (const h of u)
|
|
3086
|
-
|
|
3087
|
-
return
|
|
3086
|
+
d[h] = h;
|
|
3087
|
+
return d;
|
|
3088
3088
|
}, a.getValidEnumValues = (u) => {
|
|
3089
|
-
const
|
|
3090
|
-
for (const m of
|
|
3089
|
+
const d = a.objectKeys(u).filter((m) => typeof u[u[m]] != "number"), h = {};
|
|
3090
|
+
for (const m of d)
|
|
3091
3091
|
h[m] = u[m];
|
|
3092
3092
|
return a.objectValues(h);
|
|
3093
|
-
}, a.objectValues = (u) => a.objectKeys(u).map(function(
|
|
3094
|
-
return u[
|
|
3093
|
+
}, a.objectValues = (u) => a.objectKeys(u).map(function(d) {
|
|
3094
|
+
return u[d];
|
|
3095
3095
|
}), a.objectKeys = typeof Object.keys == "function" ? (u) => Object.keys(u) : (u) => {
|
|
3096
|
-
const
|
|
3096
|
+
const d = [];
|
|
3097
3097
|
for (const h in u)
|
|
3098
|
-
Object.prototype.hasOwnProperty.call(u, h) &&
|
|
3099
|
-
return
|
|
3100
|
-
}, a.find = (u,
|
|
3098
|
+
Object.prototype.hasOwnProperty.call(u, h) && d.push(h);
|
|
3099
|
+
return d;
|
|
3100
|
+
}, a.find = (u, d) => {
|
|
3101
3101
|
for (const h of u)
|
|
3102
|
-
if (
|
|
3102
|
+
if (d(h))
|
|
3103
3103
|
return h;
|
|
3104
3104
|
}, a.isInteger = typeof Number.isInteger == "function" ? (u) => Number.isInteger(u) : (u) => typeof u == "number" && isFinite(u) && Math.floor(u) === u;
|
|
3105
|
-
function c(u,
|
|
3106
|
-
return u.map((h) => typeof h == "string" ? `'${h}'` : h).join(
|
|
3105
|
+
function c(u, d = " | ") {
|
|
3106
|
+
return u.map((h) => typeof h == "string" ? `'${h}'` : h).join(d);
|
|
3107
3107
|
}
|
|
3108
|
-
a.joinValues = c, a.jsonStringifyReplacer = (u,
|
|
3108
|
+
a.joinValues = c, a.jsonStringifyReplacer = (u, d) => typeof d == "bigint" ? d.toString() : d;
|
|
3109
3109
|
})(I || (I = {}));
|
|
3110
3110
|
var Tn;
|
|
3111
3111
|
(function(a) {
|
|
@@ -3189,10 +3189,10 @@ class z extends Error {
|
|
|
3189
3189
|
Object.setPrototypeOf ? Object.setPrototypeOf(this, i) : this.__proto__ = i, this.name = "ZodError", this.issues = n;
|
|
3190
3190
|
}
|
|
3191
3191
|
format(n) {
|
|
3192
|
-
const i = n || function(
|
|
3193
|
-
return
|
|
3194
|
-
}, c = { _errors: [] }, u = (
|
|
3195
|
-
for (const h of
|
|
3192
|
+
const i = n || function(d) {
|
|
3193
|
+
return d.message;
|
|
3194
|
+
}, c = { _errors: [] }, u = (d) => {
|
|
3195
|
+
for (const h of d.issues)
|
|
3196
3196
|
if (h.code === "invalid_union")
|
|
3197
3197
|
h.unionErrors.map(u);
|
|
3198
3198
|
else if (h.code === "invalid_return_type")
|
|
@@ -3299,14 +3299,14 @@ function Bt() {
|
|
|
3299
3299
|
return li;
|
|
3300
3300
|
}
|
|
3301
3301
|
const Lt = (a) => {
|
|
3302
|
-
const { data: n, path: i, errorMaps: c, issueData: u } = a,
|
|
3302
|
+
const { data: n, path: i, errorMaps: c, issueData: u } = a, d = [...i, ...u.path || []], h = {
|
|
3303
3303
|
...u,
|
|
3304
|
-
path:
|
|
3304
|
+
path: d
|
|
3305
3305
|
};
|
|
3306
3306
|
if (u.message !== void 0)
|
|
3307
3307
|
return {
|
|
3308
3308
|
...u,
|
|
3309
|
-
path:
|
|
3309
|
+
path: d,
|
|
3310
3310
|
message: u.message
|
|
3311
3311
|
};
|
|
3312
3312
|
let m = "";
|
|
@@ -3315,7 +3315,7 @@ const Lt = (a) => {
|
|
|
3315
3315
|
m = v(h, { data: n, defaultError: m }).message;
|
|
3316
3316
|
return {
|
|
3317
3317
|
...u,
|
|
3318
|
-
path:
|
|
3318
|
+
path: d,
|
|
3319
3319
|
message: m
|
|
3320
3320
|
};
|
|
3321
3321
|
}, Ql = [];
|
|
@@ -3359,9 +3359,9 @@ class B {
|
|
|
3359
3359
|
static async mergeObjectAsync(n, i) {
|
|
3360
3360
|
const c = [];
|
|
3361
3361
|
for (const u of i) {
|
|
3362
|
-
const
|
|
3362
|
+
const d = await u.key, h = await u.value;
|
|
3363
3363
|
c.push({
|
|
3364
|
-
key:
|
|
3364
|
+
key: d,
|
|
3365
3365
|
value: h
|
|
3366
3366
|
});
|
|
3367
3367
|
}
|
|
@@ -3370,10 +3370,10 @@ class B {
|
|
|
3370
3370
|
static mergeObjectSync(n, i) {
|
|
3371
3371
|
const c = {};
|
|
3372
3372
|
for (const u of i) {
|
|
3373
|
-
const { key:
|
|
3374
|
-
if (
|
|
3373
|
+
const { key: d, value: h } = u;
|
|
3374
|
+
if (d.status === "aborted" || h.status === "aborted")
|
|
3375
3375
|
return T;
|
|
3376
|
-
|
|
3376
|
+
d.status === "dirty" && n.dirty(), h.status === "dirty" && n.dirty(), d.value !== "__proto__" && (typeof h.value < "u" || u.alwaysSet) && (c[d.value] = h.value);
|
|
3377
3377
|
}
|
|
3378
3378
|
return { status: n.value, value: c };
|
|
3379
3379
|
}
|
|
@@ -3488,8 +3488,8 @@ class O {
|
|
|
3488
3488
|
parent: null,
|
|
3489
3489
|
data: n,
|
|
3490
3490
|
parsedType: ie(n)
|
|
3491
|
-
},
|
|
3492
|
-
return ii(u,
|
|
3491
|
+
}, d = this._parseSync({ data: n, path: u.path, parent: u });
|
|
3492
|
+
return ii(u, d);
|
|
3493
3493
|
}
|
|
3494
3494
|
"~validate"(n) {
|
|
3495
3495
|
var i, c;
|
|
@@ -3506,20 +3506,20 @@ class O {
|
|
|
3506
3506
|
};
|
|
3507
3507
|
if (!this["~standard"].async)
|
|
3508
3508
|
try {
|
|
3509
|
-
const
|
|
3510
|
-
return ke(
|
|
3511
|
-
value:
|
|
3509
|
+
const d = this._parseSync({ data: n, path: [], parent: u });
|
|
3510
|
+
return ke(d) ? {
|
|
3511
|
+
value: d.value
|
|
3512
3512
|
} : {
|
|
3513
3513
|
issues: u.common.issues
|
|
3514
3514
|
};
|
|
3515
|
-
} catch (
|
|
3516
|
-
!((c = (i =
|
|
3515
|
+
} catch (d) {
|
|
3516
|
+
!((c = (i = d == null ? void 0 : d.message) === null || i === void 0 ? void 0 : i.toLowerCase()) === null || c === void 0) && c.includes("encountered") && (this["~standard"].async = !0), u.common = {
|
|
3517
3517
|
issues: [],
|
|
3518
3518
|
async: !0
|
|
3519
3519
|
};
|
|
3520
3520
|
}
|
|
3521
|
-
return this._parseAsync({ data: n, path: [], parent: u }).then((
|
|
3522
|
-
value:
|
|
3521
|
+
return this._parseAsync({ data: n, path: [], parent: u }).then((d) => ke(d) ? {
|
|
3522
|
+
value: d.value
|
|
3523
3523
|
} : {
|
|
3524
3524
|
issues: u.common.issues
|
|
3525
3525
|
});
|
|
@@ -3542,13 +3542,13 @@ class O {
|
|
|
3542
3542
|
parent: null,
|
|
3543
3543
|
data: n,
|
|
3544
3544
|
parsedType: ie(n)
|
|
3545
|
-
}, u = this._parse({ data: n, path: c.path, parent: c }),
|
|
3546
|
-
return ii(c,
|
|
3545
|
+
}, u = this._parse({ data: n, path: c.path, parent: c }), d = await (ut(u) ? u : Promise.resolve(u));
|
|
3546
|
+
return ii(c, d);
|
|
3547
3547
|
}
|
|
3548
3548
|
refine(n, i) {
|
|
3549
3549
|
const c = (u) => typeof i == "string" || typeof i > "u" ? { message: i } : typeof i == "function" ? i(u) : i;
|
|
3550
|
-
return this._refinement((u,
|
|
3551
|
-
const h = n(u), m = () =>
|
|
3550
|
+
return this._refinement((u, d) => {
|
|
3551
|
+
const h = n(u), m = () => d.addIssue({
|
|
3552
3552
|
code: y.custom,
|
|
3553
3553
|
...c(u)
|
|
3554
3554
|
});
|
|
@@ -3683,156 +3683,156 @@ function vd(a, n) {
|
|
|
3683
3683
|
class V extends O {
|
|
3684
3684
|
_parse(n) {
|
|
3685
3685
|
if (this._def.coerce && (n.data = String(n.data)), this._getType(n) !== _.string) {
|
|
3686
|
-
const
|
|
3687
|
-
return b(
|
|
3686
|
+
const d = this._getOrReturnCtx(n);
|
|
3687
|
+
return b(d, {
|
|
3688
3688
|
code: y.invalid_type,
|
|
3689
3689
|
expected: _.string,
|
|
3690
|
-
received:
|
|
3690
|
+
received: d.parsedType
|
|
3691
3691
|
}), T;
|
|
3692
3692
|
}
|
|
3693
3693
|
const c = new B();
|
|
3694
3694
|
let u;
|
|
3695
|
-
for (const
|
|
3696
|
-
if (
|
|
3697
|
-
n.data.length <
|
|
3695
|
+
for (const d of this._def.checks)
|
|
3696
|
+
if (d.kind === "min")
|
|
3697
|
+
n.data.length < d.value && (u = this._getOrReturnCtx(n, u), b(u, {
|
|
3698
3698
|
code: y.too_small,
|
|
3699
|
-
minimum:
|
|
3699
|
+
minimum: d.value,
|
|
3700
3700
|
type: "string",
|
|
3701
3701
|
inclusive: !0,
|
|
3702
3702
|
exact: !1,
|
|
3703
|
-
message:
|
|
3703
|
+
message: d.message
|
|
3704
3704
|
}), c.dirty());
|
|
3705
|
-
else if (
|
|
3706
|
-
n.data.length >
|
|
3705
|
+
else if (d.kind === "max")
|
|
3706
|
+
n.data.length > d.value && (u = this._getOrReturnCtx(n, u), b(u, {
|
|
3707
3707
|
code: y.too_big,
|
|
3708
|
-
maximum:
|
|
3708
|
+
maximum: d.value,
|
|
3709
3709
|
type: "string",
|
|
3710
3710
|
inclusive: !0,
|
|
3711
3711
|
exact: !1,
|
|
3712
|
-
message:
|
|
3712
|
+
message: d.message
|
|
3713
3713
|
}), c.dirty());
|
|
3714
|
-
else if (
|
|
3715
|
-
const h = n.data.length >
|
|
3714
|
+
else if (d.kind === "length") {
|
|
3715
|
+
const h = n.data.length > d.value, m = n.data.length < d.value;
|
|
3716
3716
|
(h || m) && (u = this._getOrReturnCtx(n, u), h ? b(u, {
|
|
3717
3717
|
code: y.too_big,
|
|
3718
|
-
maximum:
|
|
3718
|
+
maximum: d.value,
|
|
3719
3719
|
type: "string",
|
|
3720
3720
|
inclusive: !0,
|
|
3721
3721
|
exact: !0,
|
|
3722
|
-
message:
|
|
3722
|
+
message: d.message
|
|
3723
3723
|
}) : m && b(u, {
|
|
3724
3724
|
code: y.too_small,
|
|
3725
|
-
minimum:
|
|
3725
|
+
minimum: d.value,
|
|
3726
3726
|
type: "string",
|
|
3727
3727
|
inclusive: !0,
|
|
3728
3728
|
exact: !0,
|
|
3729
|
-
message:
|
|
3729
|
+
message: d.message
|
|
3730
3730
|
}), c.dirty());
|
|
3731
|
-
} else if (
|
|
3731
|
+
} else if (d.kind === "email")
|
|
3732
3732
|
ad.test(n.data) || (u = this._getOrReturnCtx(n, u), b(u, {
|
|
3733
3733
|
validation: "email",
|
|
3734
3734
|
code: y.invalid_string,
|
|
3735
|
-
message:
|
|
3735
|
+
message: d.message
|
|
3736
3736
|
}), c.dirty());
|
|
3737
|
-
else if (
|
|
3737
|
+
else if (d.kind === "emoji")
|
|
3738
3738
|
En || (En = new RegExp(od, "u")), En.test(n.data) || (u = this._getOrReturnCtx(n, u), b(u, {
|
|
3739
3739
|
validation: "emoji",
|
|
3740
3740
|
code: y.invalid_string,
|
|
3741
|
-
message:
|
|
3741
|
+
message: d.message
|
|
3742
3742
|
}), c.dirty());
|
|
3743
|
-
else if (
|
|
3743
|
+
else if (d.kind === "uuid")
|
|
3744
3744
|
rd.test(n.data) || (u = this._getOrReturnCtx(n, u), b(u, {
|
|
3745
3745
|
validation: "uuid",
|
|
3746
3746
|
code: y.invalid_string,
|
|
3747
|
-
message:
|
|
3747
|
+
message: d.message
|
|
3748
3748
|
}), c.dirty());
|
|
3749
|
-
else if (
|
|
3749
|
+
else if (d.kind === "nanoid")
|
|
3750
3750
|
nd.test(n.data) || (u = this._getOrReturnCtx(n, u), b(u, {
|
|
3751
3751
|
validation: "nanoid",
|
|
3752
3752
|
code: y.invalid_string,
|
|
3753
|
-
message:
|
|
3753
|
+
message: d.message
|
|
3754
3754
|
}), c.dirty());
|
|
3755
|
-
else if (
|
|
3755
|
+
else if (d.kind === "cuid")
|
|
3756
3756
|
Xl.test(n.data) || (u = this._getOrReturnCtx(n, u), b(u, {
|
|
3757
3757
|
validation: "cuid",
|
|
3758
3758
|
code: y.invalid_string,
|
|
3759
|
-
message:
|
|
3759
|
+
message: d.message
|
|
3760
3760
|
}), c.dirty());
|
|
3761
|
-
else if (
|
|
3761
|
+
else if (d.kind === "cuid2")
|
|
3762
3762
|
ed.test(n.data) || (u = this._getOrReturnCtx(n, u), b(u, {
|
|
3763
3763
|
validation: "cuid2",
|
|
3764
3764
|
code: y.invalid_string,
|
|
3765
|
-
message:
|
|
3765
|
+
message: d.message
|
|
3766
3766
|
}), c.dirty());
|
|
3767
|
-
else if (
|
|
3767
|
+
else if (d.kind === "ulid")
|
|
3768
3768
|
td.test(n.data) || (u = this._getOrReturnCtx(n, u), b(u, {
|
|
3769
3769
|
validation: "ulid",
|
|
3770
3770
|
code: y.invalid_string,
|
|
3771
|
-
message:
|
|
3771
|
+
message: d.message
|
|
3772
3772
|
}), c.dirty());
|
|
3773
|
-
else if (
|
|
3773
|
+
else if (d.kind === "url")
|
|
3774
3774
|
try {
|
|
3775
3775
|
new URL(n.data);
|
|
3776
3776
|
} catch {
|
|
3777
3777
|
u = this._getOrReturnCtx(n, u), b(u, {
|
|
3778
3778
|
validation: "url",
|
|
3779
3779
|
code: y.invalid_string,
|
|
3780
|
-
message:
|
|
3780
|
+
message: d.message
|
|
3781
3781
|
}), c.dirty();
|
|
3782
3782
|
}
|
|
3783
|
-
else
|
|
3783
|
+
else d.kind === "regex" ? (d.regex.lastIndex = 0, d.regex.test(n.data) || (u = this._getOrReturnCtx(n, u), b(u, {
|
|
3784
3784
|
validation: "regex",
|
|
3785
3785
|
code: y.invalid_string,
|
|
3786
|
-
message:
|
|
3787
|
-
}), c.dirty())) :
|
|
3786
|
+
message: d.message
|
|
3787
|
+
}), c.dirty())) : d.kind === "trim" ? n.data = n.data.trim() : d.kind === "includes" ? n.data.includes(d.value, d.position) || (u = this._getOrReturnCtx(n, u), b(u, {
|
|
3788
3788
|
code: y.invalid_string,
|
|
3789
|
-
validation: { includes:
|
|
3790
|
-
message:
|
|
3791
|
-
}), c.dirty()) :
|
|
3789
|
+
validation: { includes: d.value, position: d.position },
|
|
3790
|
+
message: d.message
|
|
3791
|
+
}), c.dirty()) : d.kind === "toLowerCase" ? n.data = n.data.toLowerCase() : d.kind === "toUpperCase" ? n.data = n.data.toUpperCase() : d.kind === "startsWith" ? n.data.startsWith(d.value) || (u = this._getOrReturnCtx(n, u), b(u, {
|
|
3792
3792
|
code: y.invalid_string,
|
|
3793
|
-
validation: { startsWith:
|
|
3794
|
-
message:
|
|
3795
|
-
}), c.dirty()) :
|
|
3793
|
+
validation: { startsWith: d.value },
|
|
3794
|
+
message: d.message
|
|
3795
|
+
}), c.dirty()) : d.kind === "endsWith" ? n.data.endsWith(d.value) || (u = this._getOrReturnCtx(n, u), b(u, {
|
|
3796
3796
|
code: y.invalid_string,
|
|
3797
|
-
validation: { endsWith:
|
|
3798
|
-
message:
|
|
3799
|
-
}), c.dirty()) :
|
|
3797
|
+
validation: { endsWith: d.value },
|
|
3798
|
+
message: d.message
|
|
3799
|
+
}), c.dirty()) : d.kind === "datetime" ? mi(d).test(n.data) || (u = this._getOrReturnCtx(n, u), b(u, {
|
|
3800
3800
|
code: y.invalid_string,
|
|
3801
3801
|
validation: "datetime",
|
|
3802
|
-
message:
|
|
3803
|
-
}), c.dirty()) :
|
|
3802
|
+
message: d.message
|
|
3803
|
+
}), c.dirty()) : d.kind === "date" ? md.test(n.data) || (u = this._getOrReturnCtx(n, u), b(u, {
|
|
3804
3804
|
code: y.invalid_string,
|
|
3805
3805
|
validation: "date",
|
|
3806
|
-
message:
|
|
3807
|
-
}), c.dirty()) :
|
|
3806
|
+
message: d.message
|
|
3807
|
+
}), c.dirty()) : d.kind === "time" ? pd(d).test(n.data) || (u = this._getOrReturnCtx(n, u), b(u, {
|
|
3808
3808
|
code: y.invalid_string,
|
|
3809
3809
|
validation: "time",
|
|
3810
|
-
message:
|
|
3811
|
-
}), c.dirty()) :
|
|
3810
|
+
message: d.message
|
|
3811
|
+
}), c.dirty()) : d.kind === "duration" ? id.test(n.data) || (u = this._getOrReturnCtx(n, u), b(u, {
|
|
3812
3812
|
validation: "duration",
|
|
3813
3813
|
code: y.invalid_string,
|
|
3814
|
-
message:
|
|
3815
|
-
}), c.dirty()) :
|
|
3814
|
+
message: d.message
|
|
3815
|
+
}), c.dirty()) : d.kind === "ip" ? gd(n.data, d.version) || (u = this._getOrReturnCtx(n, u), b(u, {
|
|
3816
3816
|
validation: "ip",
|
|
3817
3817
|
code: y.invalid_string,
|
|
3818
|
-
message:
|
|
3819
|
-
}), c.dirty()) :
|
|
3818
|
+
message: d.message
|
|
3819
|
+
}), c.dirty()) : d.kind === "jwt" ? yd(n.data, d.alg) || (u = this._getOrReturnCtx(n, u), b(u, {
|
|
3820
3820
|
validation: "jwt",
|
|
3821
3821
|
code: y.invalid_string,
|
|
3822
|
-
message:
|
|
3823
|
-
}), c.dirty()) :
|
|
3822
|
+
message: d.message
|
|
3823
|
+
}), c.dirty()) : d.kind === "cidr" ? vd(n.data, d.version) || (u = this._getOrReturnCtx(n, u), b(u, {
|
|
3824
3824
|
validation: "cidr",
|
|
3825
3825
|
code: y.invalid_string,
|
|
3826
|
-
message:
|
|
3827
|
-
}), c.dirty()) :
|
|
3826
|
+
message: d.message
|
|
3827
|
+
}), c.dirty()) : d.kind === "base64" ? fd.test(n.data) || (u = this._getOrReturnCtx(n, u), b(u, {
|
|
3828
3828
|
validation: "base64",
|
|
3829
3829
|
code: y.invalid_string,
|
|
3830
|
-
message:
|
|
3831
|
-
}), c.dirty()) :
|
|
3830
|
+
message: d.message
|
|
3831
|
+
}), c.dirty()) : d.kind === "base64url" ? hd.test(n.data) || (u = this._getOrReturnCtx(n, u), b(u, {
|
|
3832
3832
|
validation: "base64url",
|
|
3833
3833
|
code: y.invalid_string,
|
|
3834
|
-
message:
|
|
3835
|
-
}), c.dirty()) : I.assertNever(
|
|
3834
|
+
message: d.message
|
|
3835
|
+
}), c.dirty()) : I.assertNever(d);
|
|
3836
3836
|
return { status: c.value, value: n.data };
|
|
3837
3837
|
}
|
|
3838
3838
|
_regex(n, i, c) {
|
|
@@ -4068,8 +4068,8 @@ V.create = (a) => {
|
|
|
4068
4068
|
});
|
|
4069
4069
|
};
|
|
4070
4070
|
function wd(a, n) {
|
|
4071
|
-
const i = (a.toString().split(".")[1] || "").length, c = (n.toString().split(".")[1] || "").length, u = i > c ? i : c,
|
|
4072
|
-
return
|
|
4071
|
+
const i = (a.toString().split(".")[1] || "").length, c = (n.toString().split(".")[1] || "").length, u = i > c ? i : c, d = parseInt(a.toFixed(u).replace(".", "")), h = parseInt(n.toFixed(u).replace(".", ""));
|
|
4072
|
+
return d % h / Math.pow(10, u);
|
|
4073
4073
|
}
|
|
4074
4074
|
class de extends O {
|
|
4075
4075
|
constructor() {
|
|
@@ -4077,43 +4077,43 @@ class de extends O {
|
|
|
4077
4077
|
}
|
|
4078
4078
|
_parse(n) {
|
|
4079
4079
|
if (this._def.coerce && (n.data = Number(n.data)), this._getType(n) !== _.number) {
|
|
4080
|
-
const
|
|
4081
|
-
return b(
|
|
4080
|
+
const d = this._getOrReturnCtx(n);
|
|
4081
|
+
return b(d, {
|
|
4082
4082
|
code: y.invalid_type,
|
|
4083
4083
|
expected: _.number,
|
|
4084
|
-
received:
|
|
4084
|
+
received: d.parsedType
|
|
4085
4085
|
}), T;
|
|
4086
4086
|
}
|
|
4087
4087
|
let c;
|
|
4088
4088
|
const u = new B();
|
|
4089
|
-
for (const
|
|
4090
|
-
|
|
4089
|
+
for (const d of this._def.checks)
|
|
4090
|
+
d.kind === "int" ? I.isInteger(n.data) || (c = this._getOrReturnCtx(n, c), b(c, {
|
|
4091
4091
|
code: y.invalid_type,
|
|
4092
4092
|
expected: "integer",
|
|
4093
4093
|
received: "float",
|
|
4094
|
-
message:
|
|
4095
|
-
}), u.dirty()) :
|
|
4094
|
+
message: d.message
|
|
4095
|
+
}), u.dirty()) : d.kind === "min" ? (d.inclusive ? n.data < d.value : n.data <= d.value) && (c = this._getOrReturnCtx(n, c), b(c, {
|
|
4096
4096
|
code: y.too_small,
|
|
4097
|
-
minimum:
|
|
4097
|
+
minimum: d.value,
|
|
4098
4098
|
type: "number",
|
|
4099
|
-
inclusive:
|
|
4099
|
+
inclusive: d.inclusive,
|
|
4100
4100
|
exact: !1,
|
|
4101
|
-
message:
|
|
4102
|
-
}), u.dirty()) :
|
|
4101
|
+
message: d.message
|
|
4102
|
+
}), u.dirty()) : d.kind === "max" ? (d.inclusive ? n.data > d.value : n.data >= d.value) && (c = this._getOrReturnCtx(n, c), b(c, {
|
|
4103
4103
|
code: y.too_big,
|
|
4104
|
-
maximum:
|
|
4104
|
+
maximum: d.value,
|
|
4105
4105
|
type: "number",
|
|
4106
|
-
inclusive:
|
|
4106
|
+
inclusive: d.inclusive,
|
|
4107
4107
|
exact: !1,
|
|
4108
|
-
message:
|
|
4109
|
-
}), u.dirty()) :
|
|
4108
|
+
message: d.message
|
|
4109
|
+
}), u.dirty()) : d.kind === "multipleOf" ? wd(n.data, d.value) !== 0 && (c = this._getOrReturnCtx(n, c), b(c, {
|
|
4110
4110
|
code: y.not_multiple_of,
|
|
4111
|
-
multipleOf:
|
|
4112
|
-
message:
|
|
4113
|
-
}), u.dirty()) :
|
|
4111
|
+
multipleOf: d.value,
|
|
4112
|
+
message: d.message
|
|
4113
|
+
}), u.dirty()) : d.kind === "finite" ? Number.isFinite(n.data) || (c = this._getOrReturnCtx(n, c), b(c, {
|
|
4114
4114
|
code: y.not_finite,
|
|
4115
|
-
message:
|
|
4116
|
-
}), u.dirty()) : I.assertNever(
|
|
4115
|
+
message: d.message
|
|
4116
|
+
}), u.dirty()) : I.assertNever(d);
|
|
4117
4117
|
return { status: u.value, value: n.data };
|
|
4118
4118
|
}
|
|
4119
4119
|
gte(n, i) {
|
|
@@ -4258,24 +4258,24 @@ class fe extends O {
|
|
|
4258
4258
|
return this._getInvalidInput(n);
|
|
4259
4259
|
let c;
|
|
4260
4260
|
const u = new B();
|
|
4261
|
-
for (const
|
|
4262
|
-
|
|
4261
|
+
for (const d of this._def.checks)
|
|
4262
|
+
d.kind === "min" ? (d.inclusive ? n.data < d.value : n.data <= d.value) && (c = this._getOrReturnCtx(n, c), b(c, {
|
|
4263
4263
|
code: y.too_small,
|
|
4264
4264
|
type: "bigint",
|
|
4265
|
-
minimum:
|
|
4266
|
-
inclusive:
|
|
4267
|
-
message:
|
|
4268
|
-
}), u.dirty()) :
|
|
4265
|
+
minimum: d.value,
|
|
4266
|
+
inclusive: d.inclusive,
|
|
4267
|
+
message: d.message
|
|
4268
|
+
}), u.dirty()) : d.kind === "max" ? (d.inclusive ? n.data > d.value : n.data >= d.value) && (c = this._getOrReturnCtx(n, c), b(c, {
|
|
4269
4269
|
code: y.too_big,
|
|
4270
4270
|
type: "bigint",
|
|
4271
|
-
maximum:
|
|
4272
|
-
inclusive:
|
|
4273
|
-
message:
|
|
4274
|
-
}), u.dirty()) :
|
|
4271
|
+
maximum: d.value,
|
|
4272
|
+
inclusive: d.inclusive,
|
|
4273
|
+
message: d.message
|
|
4274
|
+
}), u.dirty()) : d.kind === "multipleOf" ? n.data % d.value !== BigInt(0) && (c = this._getOrReturnCtx(n, c), b(c, {
|
|
4275
4275
|
code: y.not_multiple_of,
|
|
4276
|
-
multipleOf:
|
|
4277
|
-
message:
|
|
4278
|
-
}), u.dirty()) : I.assertNever(
|
|
4276
|
+
multipleOf: d.value,
|
|
4277
|
+
message: d.message
|
|
4278
|
+
}), u.dirty()) : I.assertNever(d);
|
|
4279
4279
|
return { status: u.value, value: n.data };
|
|
4280
4280
|
}
|
|
4281
4281
|
_getInvalidInput(n) {
|
|
@@ -4400,37 +4400,37 @@ lt.create = (a) => new lt({
|
|
|
4400
4400
|
class Ee extends O {
|
|
4401
4401
|
_parse(n) {
|
|
4402
4402
|
if (this._def.coerce && (n.data = new Date(n.data)), this._getType(n) !== _.date) {
|
|
4403
|
-
const
|
|
4404
|
-
return b(
|
|
4403
|
+
const d = this._getOrReturnCtx(n);
|
|
4404
|
+
return b(d, {
|
|
4405
4405
|
code: y.invalid_type,
|
|
4406
4406
|
expected: _.date,
|
|
4407
|
-
received:
|
|
4407
|
+
received: d.parsedType
|
|
4408
4408
|
}), T;
|
|
4409
4409
|
}
|
|
4410
4410
|
if (isNaN(n.data.getTime())) {
|
|
4411
|
-
const
|
|
4412
|
-
return b(
|
|
4411
|
+
const d = this._getOrReturnCtx(n);
|
|
4412
|
+
return b(d, {
|
|
4413
4413
|
code: y.invalid_date
|
|
4414
4414
|
}), T;
|
|
4415
4415
|
}
|
|
4416
4416
|
const c = new B();
|
|
4417
4417
|
let u;
|
|
4418
|
-
for (const
|
|
4419
|
-
|
|
4418
|
+
for (const d of this._def.checks)
|
|
4419
|
+
d.kind === "min" ? n.data.getTime() < d.value && (u = this._getOrReturnCtx(n, u), b(u, {
|
|
4420
4420
|
code: y.too_small,
|
|
4421
|
-
message:
|
|
4421
|
+
message: d.message,
|
|
4422
4422
|
inclusive: !0,
|
|
4423
4423
|
exact: !1,
|
|
4424
|
-
minimum:
|
|
4424
|
+
minimum: d.value,
|
|
4425
4425
|
type: "date"
|
|
4426
|
-
}), c.dirty()) :
|
|
4426
|
+
}), c.dirty()) : d.kind === "max" ? n.data.getTime() > d.value && (u = this._getOrReturnCtx(n, u), b(u, {
|
|
4427
4427
|
code: y.too_big,
|
|
4428
|
-
message:
|
|
4428
|
+
message: d.message,
|
|
4429
4429
|
inclusive: !0,
|
|
4430
4430
|
exact: !1,
|
|
4431
|
-
maximum:
|
|
4431
|
+
maximum: d.value,
|
|
4432
4432
|
type: "date"
|
|
4433
|
-
}), c.dirty()) : I.assertNever(
|
|
4433
|
+
}), c.dirty()) : I.assertNever(d);
|
|
4434
4434
|
return {
|
|
4435
4435
|
status: c.value,
|
|
4436
4436
|
value: new Date(n.data.getTime())
|
|
@@ -4618,8 +4618,8 @@ class W extends O {
|
|
|
4618
4618
|
message: u.maxLength.message
|
|
4619
4619
|
}), c.dirty()), i.common.async)
|
|
4620
4620
|
return Promise.all([...i.data].map((h, m) => u.type._parseAsync(new X(i, h, i.path, m)))).then((h) => B.mergeArray(c, h));
|
|
4621
|
-
const
|
|
4622
|
-
return B.mergeArray(c,
|
|
4621
|
+
const d = [...i.data].map((h, m) => u.type._parseSync(new X(i, h, i.path, m)));
|
|
4622
|
+
return B.mergeArray(c, d);
|
|
4623
4623
|
}
|
|
4624
4624
|
get element() {
|
|
4625
4625
|
return this._def.type;
|
|
@@ -4689,13 +4689,13 @@ class N extends O {
|
|
|
4689
4689
|
received: v.parsedType
|
|
4690
4690
|
}), T;
|
|
4691
4691
|
}
|
|
4692
|
-
const { status: c, ctx: u } = this._processInputParams(n), { shape:
|
|
4692
|
+
const { status: c, ctx: u } = this._processInputParams(n), { shape: d, keys: h } = this._getCached(), m = [];
|
|
4693
4693
|
if (!(this._def.catchall instanceof ae && this._def.unknownKeys === "strip"))
|
|
4694
4694
|
for (const v in u.data)
|
|
4695
4695
|
h.includes(v) || m.push(v);
|
|
4696
4696
|
const w = [];
|
|
4697
4697
|
for (const v of h) {
|
|
4698
|
-
const E =
|
|
4698
|
+
const E = d[v], R = u.data[v];
|
|
4699
4699
|
w.push({
|
|
4700
4700
|
key: { status: "valid", value: v },
|
|
4701
4701
|
value: E._parse(new X(u, R, u.path, v)),
|
|
@@ -4752,8 +4752,8 @@ class N extends O {
|
|
|
4752
4752
|
unknownKeys: "strict",
|
|
4753
4753
|
...n !== void 0 ? {
|
|
4754
4754
|
errorMap: (i, c) => {
|
|
4755
|
-
var u,
|
|
4756
|
-
const w = (h = (
|
|
4755
|
+
var u, d, h, m;
|
|
4756
|
+
const w = (h = (d = (u = this._def).errorMap) === null || d === void 0 ? void 0 : d.call(u, i, c).message) !== null && h !== void 0 ? h : c.defaultError;
|
|
4757
4757
|
return i.code === "unrecognized_keys" ? {
|
|
4758
4758
|
message: (m = k.errToObj(n).message) !== null && m !== void 0 ? m : w
|
|
4759
4759
|
} : {
|
|
@@ -4922,10 +4922,10 @@ class N extends O {
|
|
|
4922
4922
|
if (n && !n[c])
|
|
4923
4923
|
i[c] = this.shape[c];
|
|
4924
4924
|
else {
|
|
4925
|
-
let
|
|
4926
|
-
for (;
|
|
4927
|
-
|
|
4928
|
-
i[c] =
|
|
4925
|
+
let d = this.shape[c];
|
|
4926
|
+
for (; d instanceof Q; )
|
|
4927
|
+
d = d._def.innerType;
|
|
4928
|
+
i[c] = d;
|
|
4929
4929
|
}
|
|
4930
4930
|
}), new N({
|
|
4931
4931
|
...this._def,
|
|
@@ -4960,21 +4960,21 @@ N.lazycreate = (a, n) => new N({
|
|
|
4960
4960
|
class ht extends O {
|
|
4961
4961
|
_parse(n) {
|
|
4962
4962
|
const { ctx: i } = this._processInputParams(n), c = this._def.options;
|
|
4963
|
-
function u(
|
|
4964
|
-
for (const m of
|
|
4963
|
+
function u(d) {
|
|
4964
|
+
for (const m of d)
|
|
4965
4965
|
if (m.result.status === "valid")
|
|
4966
4966
|
return m.result;
|
|
4967
|
-
for (const m of
|
|
4967
|
+
for (const m of d)
|
|
4968
4968
|
if (m.result.status === "dirty")
|
|
4969
4969
|
return i.common.issues.push(...m.ctx.common.issues), m.result;
|
|
4970
|
-
const h =
|
|
4970
|
+
const h = d.map((m) => new z(m.ctx.common.issues));
|
|
4971
4971
|
return b(i, {
|
|
4972
4972
|
code: y.invalid_union,
|
|
4973
4973
|
unionErrors: h
|
|
4974
4974
|
}), T;
|
|
4975
4975
|
}
|
|
4976
4976
|
if (i.common.async)
|
|
4977
|
-
return Promise.all(c.map(async (
|
|
4977
|
+
return Promise.all(c.map(async (d) => {
|
|
4978
4978
|
const h = {
|
|
4979
4979
|
...i,
|
|
4980
4980
|
common: {
|
|
@@ -4984,7 +4984,7 @@ class ht extends O {
|
|
|
4984
4984
|
parent: null
|
|
4985
4985
|
};
|
|
4986
4986
|
return {
|
|
4987
|
-
result: await
|
|
4987
|
+
result: await d._parseAsync({
|
|
4988
4988
|
data: i.data,
|
|
4989
4989
|
path: i.path,
|
|
4990
4990
|
parent: h
|
|
@@ -4993,7 +4993,7 @@ class ht extends O {
|
|
|
4993
4993
|
};
|
|
4994
4994
|
})).then(u);
|
|
4995
4995
|
{
|
|
4996
|
-
let
|
|
4996
|
+
let d;
|
|
4997
4997
|
const h = [];
|
|
4998
4998
|
for (const w of c) {
|
|
4999
4999
|
const v = {
|
|
@@ -5010,10 +5010,10 @@ class ht extends O {
|
|
|
5010
5010
|
});
|
|
5011
5011
|
if (E.status === "valid")
|
|
5012
5012
|
return E;
|
|
5013
|
-
E.status === "dirty" && !
|
|
5013
|
+
E.status === "dirty" && !d && (d = { result: E, ctx: v }), v.common.issues.length && h.push(v.common.issues);
|
|
5014
5014
|
}
|
|
5015
|
-
if (
|
|
5016
|
-
return i.common.issues.push(...
|
|
5015
|
+
if (d)
|
|
5016
|
+
return i.common.issues.push(...d.ctx.common.issues), d.result;
|
|
5017
5017
|
const m = h.map((w) => new z(w));
|
|
5018
5018
|
return b(i, {
|
|
5019
5019
|
code: y.invalid_union,
|
|
@@ -5040,12 +5040,12 @@ class qt extends O {
|
|
|
5040
5040
|
expected: _.object,
|
|
5041
5041
|
received: i.parsedType
|
|
5042
5042
|
}), T;
|
|
5043
|
-
const c = this.discriminator, u = i.data[c],
|
|
5044
|
-
return
|
|
5043
|
+
const c = this.discriminator, u = i.data[c], d = this.optionsMap.get(u);
|
|
5044
|
+
return d ? i.common.async ? d._parseAsync({
|
|
5045
5045
|
data: i.data,
|
|
5046
5046
|
path: i.path,
|
|
5047
5047
|
parent: i
|
|
5048
|
-
}) :
|
|
5048
|
+
}) : d._parseSync({
|
|
5049
5049
|
data: i.data,
|
|
5050
5050
|
path: i.path,
|
|
5051
5051
|
parent: i
|
|
@@ -5074,14 +5074,14 @@ class qt extends O {
|
|
|
5074
5074
|
*/
|
|
5075
5075
|
static create(n, i, c) {
|
|
5076
5076
|
const u = /* @__PURE__ */ new Map();
|
|
5077
|
-
for (const
|
|
5078
|
-
const h = se(
|
|
5077
|
+
for (const d of i) {
|
|
5078
|
+
const h = se(d.shape[n]);
|
|
5079
5079
|
if (!h.length)
|
|
5080
5080
|
throw new Error(`A discriminator value for key \`${n}\` could not be extracted from all schema options`);
|
|
5081
5081
|
for (const m of h) {
|
|
5082
5082
|
if (u.has(m))
|
|
5083
5083
|
throw new Error(`Discriminator property ${String(n)} has duplicate value ${String(m)}`);
|
|
5084
|
-
u.set(m,
|
|
5084
|
+
u.set(m, d);
|
|
5085
5085
|
}
|
|
5086
5086
|
}
|
|
5087
5087
|
return new qt({
|
|
@@ -5098,8 +5098,8 @@ function In(a, n) {
|
|
|
5098
5098
|
if (a === n)
|
|
5099
5099
|
return { valid: !0, data: a };
|
|
5100
5100
|
if (i === _.object && c === _.object) {
|
|
5101
|
-
const u = I.objectKeys(n),
|
|
5102
|
-
for (const m of
|
|
5101
|
+
const u = I.objectKeys(n), d = I.objectKeys(a).filter((m) => u.indexOf(m) !== -1), h = { ...a, ...n };
|
|
5102
|
+
for (const m of d) {
|
|
5103
5103
|
const w = In(a[m], n[m]);
|
|
5104
5104
|
if (!w.valid)
|
|
5105
5105
|
return { valid: !1 };
|
|
@@ -5110,8 +5110,8 @@ function In(a, n) {
|
|
|
5110
5110
|
if (a.length !== n.length)
|
|
5111
5111
|
return { valid: !1 };
|
|
5112
5112
|
const u = [];
|
|
5113
|
-
for (let
|
|
5114
|
-
const h = a[
|
|
5113
|
+
for (let d = 0; d < a.length; d++) {
|
|
5114
|
+
const h = a[d], m = n[d], w = In(h, m);
|
|
5115
5115
|
if (!w.valid)
|
|
5116
5116
|
return { valid: !1 };
|
|
5117
5117
|
u.push(w.data);
|
|
@@ -5121,11 +5121,11 @@ function In(a, n) {
|
|
|
5121
5121
|
}
|
|
5122
5122
|
class mt extends O {
|
|
5123
5123
|
_parse(n) {
|
|
5124
|
-
const { status: i, ctx: c } = this._processInputParams(n), u = (
|
|
5125
|
-
if (Sn(
|
|
5124
|
+
const { status: i, ctx: c } = this._processInputParams(n), u = (d, h) => {
|
|
5125
|
+
if (Sn(d) || Sn(h))
|
|
5126
5126
|
return T;
|
|
5127
|
-
const m = In(
|
|
5128
|
-
return m.valid ? ((On(
|
|
5127
|
+
const m = In(d.value, h.value);
|
|
5128
|
+
return m.valid ? ((On(d) || On(h)) && i.dirty(), { status: i.value, value: m.data }) : (b(c, {
|
|
5129
5129
|
code: y.invalid_intersection_types
|
|
5130
5130
|
}), T);
|
|
5131
5131
|
};
|
|
@@ -5140,7 +5140,7 @@ class mt extends O {
|
|
|
5140
5140
|
path: c.path,
|
|
5141
5141
|
parent: c
|
|
5142
5142
|
})
|
|
5143
|
-
]).then(([
|
|
5143
|
+
]).then(([d, h]) => u(d, h)) : u(this._def.left._parseSync({
|
|
5144
5144
|
data: c.data,
|
|
5145
5145
|
path: c.path,
|
|
5146
5146
|
parent: c
|
|
@@ -5181,11 +5181,11 @@ class ee extends O {
|
|
|
5181
5181
|
exact: !1,
|
|
5182
5182
|
type: "array"
|
|
5183
5183
|
}), i.dirty());
|
|
5184
|
-
const
|
|
5184
|
+
const d = [...c.data].map((h, m) => {
|
|
5185
5185
|
const w = this._def.items[m] || this._def.rest;
|
|
5186
5186
|
return w ? w._parse(new X(c, h, c.path, m)) : null;
|
|
5187
5187
|
}).filter((h) => !!h);
|
|
5188
|
-
return c.common.async ? Promise.all(
|
|
5188
|
+
return c.common.async ? Promise.all(d).then((h) => B.mergeArray(i, h)) : B.mergeArray(i, d);
|
|
5189
5189
|
}
|
|
5190
5190
|
get items() {
|
|
5191
5191
|
return this._def.items;
|
|
@@ -5222,10 +5222,10 @@ class pt extends O {
|
|
|
5222
5222
|
expected: _.object,
|
|
5223
5223
|
received: c.parsedType
|
|
5224
5224
|
}), T;
|
|
5225
|
-
const u = [],
|
|
5225
|
+
const u = [], d = this._def.keyType, h = this._def.valueType;
|
|
5226
5226
|
for (const m in c.data)
|
|
5227
5227
|
u.push({
|
|
5228
|
-
key:
|
|
5228
|
+
key: d._parse(new X(c, m, c.path, m)),
|
|
5229
5229
|
value: h._parse(new X(c, c.data[m], c.path, m)),
|
|
5230
5230
|
alwaysSet: m in c.data
|
|
5231
5231
|
});
|
|
@@ -5263,9 +5263,9 @@ class Wt extends O {
|
|
|
5263
5263
|
expected: _.map,
|
|
5264
5264
|
received: c.parsedType
|
|
5265
5265
|
}), T;
|
|
5266
|
-
const u = this._def.keyType,
|
|
5266
|
+
const u = this._def.keyType, d = this._def.valueType, h = [...c.data.entries()].map(([m, w], v) => ({
|
|
5267
5267
|
key: u._parse(new X(c, m, c.path, [v, "key"])),
|
|
5268
|
-
value:
|
|
5268
|
+
value: d._parse(new X(c, w, c.path, [v, "value"]))
|
|
5269
5269
|
}));
|
|
5270
5270
|
if (c.common.async) {
|
|
5271
5271
|
const m = /* @__PURE__ */ new Map();
|
|
@@ -5321,7 +5321,7 @@ class Ae extends O {
|
|
|
5321
5321
|
exact: !1,
|
|
5322
5322
|
message: u.maxSize.message
|
|
5323
5323
|
}), i.dirty());
|
|
5324
|
-
const
|
|
5324
|
+
const d = this._def.valueType;
|
|
5325
5325
|
function h(w) {
|
|
5326
5326
|
const v = /* @__PURE__ */ new Set();
|
|
5327
5327
|
for (const E of w) {
|
|
@@ -5331,7 +5331,7 @@ class Ae extends O {
|
|
|
5331
5331
|
}
|
|
5332
5332
|
return { status: i.value, value: v };
|
|
5333
5333
|
}
|
|
5334
|
-
const m = [...c.data.values()].map((w, v) =>
|
|
5334
|
+
const m = [...c.data.values()].map((w, v) => d._parse(new X(c, w, c.path, v)));
|
|
5335
5335
|
return c.common.async ? Promise.all(m).then((w) => h(w)) : h(m);
|
|
5336
5336
|
}
|
|
5337
5337
|
min(n, i) {
|
|
@@ -5404,24 +5404,24 @@ class Ze extends O {
|
|
|
5404
5404
|
}
|
|
5405
5405
|
});
|
|
5406
5406
|
}
|
|
5407
|
-
const
|
|
5407
|
+
const d = { errorMap: i.common.contextualErrorMap }, h = i.data;
|
|
5408
5408
|
if (this._def.returns instanceof ze) {
|
|
5409
5409
|
const m = this;
|
|
5410
5410
|
return L(async function(...w) {
|
|
5411
|
-
const v = new z([]), E = await m._def.args.parseAsync(w,
|
|
5411
|
+
const v = new z([]), E = await m._def.args.parseAsync(w, d).catch((re) => {
|
|
5412
5412
|
throw v.addIssue(c(w, re)), v;
|
|
5413
5413
|
}), R = await Reflect.apply(h, this, E);
|
|
5414
|
-
return await m._def.returns._def.type.parseAsync(R,
|
|
5414
|
+
return await m._def.returns._def.type.parseAsync(R, d).catch((re) => {
|
|
5415
5415
|
throw v.addIssue(u(R, re)), v;
|
|
5416
5416
|
});
|
|
5417
5417
|
});
|
|
5418
5418
|
} else {
|
|
5419
5419
|
const m = this;
|
|
5420
5420
|
return L(function(...w) {
|
|
5421
|
-
const v = m._def.args.safeParse(w,
|
|
5421
|
+
const v = m._def.args.safeParse(w, d);
|
|
5422
5422
|
if (!v.success)
|
|
5423
5423
|
throw new z([c(w, v.error)]);
|
|
5424
|
-
const E = Reflect.apply(h, this, v.data), R = m._def.returns.safeParse(E,
|
|
5424
|
+
const E = Reflect.apply(h, this, v.data), R = m._def.returns.safeParse(E, d);
|
|
5425
5425
|
if (!R.success)
|
|
5426
5426
|
throw new z([u(E, R.error)]);
|
|
5427
5427
|
return R.data;
|
|
@@ -5628,7 +5628,7 @@ class H extends O {
|
|
|
5628
5628
|
return this._def.schema._def.typeName === A.ZodEffects ? this._def.schema.sourceType() : this._def.schema;
|
|
5629
5629
|
}
|
|
5630
5630
|
_parse(n) {
|
|
5631
|
-
const { status: i, ctx: c } = this._processInputParams(n), u = this._def.effect || null,
|
|
5631
|
+
const { status: i, ctx: c } = this._processInputParams(n), u = this._def.effect || null, d = {
|
|
5632
5632
|
addIssue: (h) => {
|
|
5633
5633
|
b(c, h), h.fatal ? i.abort() : i.dirty();
|
|
5634
5634
|
},
|
|
@@ -5636,8 +5636,8 @@ class H extends O {
|
|
|
5636
5636
|
return c.path;
|
|
5637
5637
|
}
|
|
5638
5638
|
};
|
|
5639
|
-
if (
|
|
5640
|
-
const h = u.transform(c.data,
|
|
5639
|
+
if (d.addIssue = d.addIssue.bind(d), u.type === "preprocess") {
|
|
5640
|
+
const h = u.transform(c.data, d);
|
|
5641
5641
|
if (c.common.async)
|
|
5642
5642
|
return Promise.resolve(h).then(async (m) => {
|
|
5643
5643
|
if (i.value === "aborted")
|
|
@@ -5662,7 +5662,7 @@ class H extends O {
|
|
|
5662
5662
|
}
|
|
5663
5663
|
if (u.type === "refinement") {
|
|
5664
5664
|
const h = (m) => {
|
|
5665
|
-
const w = u.refinement(m,
|
|
5665
|
+
const w = u.refinement(m, d);
|
|
5666
5666
|
if (c.common.async)
|
|
5667
5667
|
return Promise.resolve(w);
|
|
5668
5668
|
if (w instanceof Promise)
|
|
@@ -5688,12 +5688,12 @@ class H extends O {
|
|
|
5688
5688
|
});
|
|
5689
5689
|
if (!ke(h))
|
|
5690
5690
|
return h;
|
|
5691
|
-
const m = u.transform(h.value,
|
|
5691
|
+
const m = u.transform(h.value, d);
|
|
5692
5692
|
if (m instanceof Promise)
|
|
5693
5693
|
throw new Error("Asynchronous transform encountered during synchronous parse operation. Use .parseAsync instead.");
|
|
5694
5694
|
return { status: i.value, value: m };
|
|
5695
5695
|
} else
|
|
5696
|
-
return this._def.schema._parseAsync({ data: c.data, path: c.path, parent: c }).then((h) => ke(h) ? Promise.resolve(u.transform(h.value,
|
|
5696
|
+
return this._def.schema._parseAsync({ data: c.data, path: c.path, parent: c }).then((h) => ke(h) ? Promise.resolve(u.transform(h.value, d)).then((m) => ({ status: i.value, value: m })) : h);
|
|
5697
5697
|
I.assertNever(u);
|
|
5698
5698
|
}
|
|
5699
5699
|
}
|
|
@@ -5770,9 +5770,9 @@ class bt extends O {
|
|
|
5770
5770
|
...c
|
|
5771
5771
|
}
|
|
5772
5772
|
});
|
|
5773
|
-
return ut(u) ? u.then((
|
|
5773
|
+
return ut(u) ? u.then((d) => ({
|
|
5774
5774
|
status: "valid",
|
|
5775
|
-
value:
|
|
5775
|
+
value: d.status === "valid" ? d.value : this._def.catchValue({
|
|
5776
5776
|
get error() {
|
|
5777
5777
|
return new z(c.common.issues);
|
|
5778
5778
|
},
|
|
@@ -5834,13 +5834,13 @@ class xt extends O {
|
|
|
5834
5834
|
const { status: i, ctx: c } = this._processInputParams(n);
|
|
5835
5835
|
if (c.common.async)
|
|
5836
5836
|
return (async () => {
|
|
5837
|
-
const
|
|
5837
|
+
const d = await this._def.in._parseAsync({
|
|
5838
5838
|
data: c.data,
|
|
5839
5839
|
path: c.path,
|
|
5840
5840
|
parent: c
|
|
5841
5841
|
});
|
|
5842
|
-
return
|
|
5843
|
-
data:
|
|
5842
|
+
return d.status === "aborted" ? T : d.status === "dirty" ? (i.dirty(), Ue(d.value)) : this._def.out._parseAsync({
|
|
5843
|
+
data: d.value,
|
|
5844
5844
|
path: c.path,
|
|
5845
5845
|
parent: c
|
|
5846
5846
|
});
|
|
@@ -5885,9 +5885,9 @@ _t.create = (a, n) => new _t({
|
|
|
5885
5885
|
});
|
|
5886
5886
|
function gi(a, n = {}, i) {
|
|
5887
5887
|
return a ? Le.create().superRefine((c, u) => {
|
|
5888
|
-
var
|
|
5888
|
+
var d, h;
|
|
5889
5889
|
if (!a(c)) {
|
|
5890
|
-
const m = typeof n == "function" ? n(c) : typeof n == "string" ? { message: n } : n, w = (h = (
|
|
5890
|
+
const m = typeof n == "function" ? n(c) : typeof n == "string" ? { message: n } : n, w = (h = (d = m.fatal) !== null && d !== void 0 ? d : i) !== null && h !== void 0 ? h : !0, v = typeof m == "string" ? { message: m } : m;
|
|
5891
5891
|
u.addIssue({ code: "custom", ...v, fatal: w });
|
|
5892
5892
|
}
|
|
5893
5893
|
}) : Le.create();
|
|
@@ -6040,11 +6040,7 @@ const bi = Y.getInstance(), sf = J.object({
|
|
|
6040
6040
|
});
|
|
6041
6041
|
function af(a) {
|
|
6042
6042
|
const n = sf.safeParse(a);
|
|
6043
|
-
return n.success ? of(
|
|
6044
|
-
usnermame: a.username,
|
|
6045
|
-
address: a.address,
|
|
6046
|
-
timestamp: a.timestamp
|
|
6047
|
-
}) ? !0 : (console.warn("Invalid messageSender"), !1) : (bi.warn(n.error.format()), !1);
|
|
6043
|
+
return n.success ? of(a) ? !0 : (console.warn("Invalid messageSender"), !1) : (bi.warn(n.error.format()), !1);
|
|
6048
6044
|
}
|
|
6049
6045
|
function of(a) {
|
|
6050
6046
|
try {
|
|
@@ -6080,7 +6076,7 @@ class cf {
|
|
|
6080
6076
|
async init() {
|
|
6081
6077
|
try {
|
|
6082
6078
|
const n = await this.utils.fetchLatestChatMessage();
|
|
6083
|
-
return this.historyIndex = n.index, await this.fetchPreviousMessages(),
|
|
6079
|
+
return this.historyIndex = n.index, await this.fetchPreviousMessages(), n.index;
|
|
6084
6080
|
} catch (n) {
|
|
6085
6081
|
return this.errorHandler.handleError(n, "SwarmHistory.init"), Zt.fromBigInt(0n);
|
|
6086
6082
|
}
|
|
@@ -6097,8 +6093,8 @@ class cf {
|
|
|
6097
6093
|
}
|
|
6098
6094
|
const i = this.historyIndex.toBigInt(), c = i > BigInt(n) ? i - BigInt(n) : 0n;
|
|
6099
6095
|
for (let u = i - 1n; u >= c; u--) {
|
|
6100
|
-
const
|
|
6101
|
-
if (this.emitter.emit(K.MESSAGE_RECEIVED,
|
|
6096
|
+
const d = await this.utils.fetchChatMessage(Zt.fromBigInt(u));
|
|
6097
|
+
if (this.emitter.emit(K.MESSAGE_RECEIVED, d), this.historyIndex = Zt.fromBigInt(u), u === 0n) break;
|
|
6102
6098
|
}
|
|
6103
6099
|
} catch (i) {
|
|
6104
6100
|
this.errorHandler.handleError(i, "SwarmHistory.fetchPreviousMessages");
|
|
@@ -6119,14 +6115,14 @@ class uf {
|
|
|
6119
6115
|
throw new Error("Enveloped mode is enabled, but stamp is not provided");
|
|
6120
6116
|
}
|
|
6121
6117
|
async writeOwnFeedDataByIndexOwned(n, i) {
|
|
6122
|
-
const { bee: c, stamp: u, chatTopic:
|
|
6118
|
+
const { bee: c, stamp: u, chatTopic: d } = this.swarmSettings, { privateKey: h, ownAddress: m } = this.userDetails, w = this.generateUserOwnedFeedId(d, m), v = Re.fromString(w);
|
|
6123
6119
|
console.log("DEBUG: feedID write", v.toString(), m, n, w), await c.makeFeedWriter(v, new _e(h)).uploadPayload(u, JSON.stringify(i), {
|
|
6124
6120
|
index: n
|
|
6125
6121
|
});
|
|
6126
6122
|
}
|
|
6127
6123
|
// TODO: support for wrapped chunks
|
|
6128
6124
|
async writeOwnFeedDataByIndexEnvelope(n, i) {
|
|
6129
|
-
const { bee: c, stamp: u, chatTopic:
|
|
6125
|
+
const { bee: c, stamp: u, chatTopic: d } = this.swarmSettings, { privateKey: h, ownAddress: m } = this.userDetails, w = new _e(h), v = _n.fromBlank(h, u, this.depth), E = this.generateUserOwnedFeedId(d, m), R = Re.fromString(E), te = ui(R, n), re = ni(i), Fe = si(re, te, w), Te = {
|
|
6130
6126
|
hash: () => Fe.address.toUint8Array()
|
|
6131
6127
|
}, Gt = v.stamp(Te), { upload: Jt } = c.makeSOCWriter(w), Ve = je.fromUtf8(i);
|
|
6132
6128
|
return (await Jt(Gt, te, Ve.toUint8Array())).reference.toHex();
|
|
@@ -6142,11 +6138,11 @@ class uf {
|
|
|
6142
6138
|
* @returns The result of the operation.
|
|
6143
6139
|
*/
|
|
6144
6140
|
async retryAwaitableAsync(n, i = 3, c = 250) {
|
|
6145
|
-
return new Promise((u,
|
|
6141
|
+
return new Promise((u, d) => {
|
|
6146
6142
|
n().then(u).catch((h) => {
|
|
6147
6143
|
i > 0 ? (this.logger.info(`Retrying... Attempts left: ${i}. Error: ${h.message}`), setTimeout(() => {
|
|
6148
|
-
this.retryAwaitableAsync(n, i - 1, c).then(u).catch(
|
|
6149
|
-
}, c)) : (this.errorHandler.handleError(h, "Utils.retryAwaitableAsync"),
|
|
6144
|
+
this.retryAwaitableAsync(n, i - 1, c).then(u).catch(d);
|
|
6145
|
+
}, c)) : (this.errorHandler.handleError(h, "Utils.retryAwaitableAsync"), d(h));
|
|
6150
6146
|
});
|
|
6151
6147
|
});
|
|
6152
6148
|
}
|
|
@@ -6168,8 +6164,8 @@ class uf {
|
|
|
6168
6164
|
}
|
|
6169
6165
|
async uploadObjectToBeeEnvelope(n) {
|
|
6170
6166
|
try {
|
|
6171
|
-
const { bee: i, stamp: c } = this.swarmSettings, { privateKey: u } = this.userDetails,
|
|
6172
|
-
await i.uploadChunk(
|
|
6167
|
+
const { bee: i, stamp: c } = this.swarmSettings, { privateKey: u } = this.userDetails, d = _n.fromBlank(u, c, this.depth), h = je.fromUtf8(JSON.stringify(n)), m = new Fl(async (v) => {
|
|
6168
|
+
await i.uploadChunk(d.stamp(v), v.build());
|
|
6173
6169
|
});
|
|
6174
6170
|
await m.append(h.toUint8Array());
|
|
6175
6171
|
const w = await m.finalize();
|
|
@@ -6180,7 +6176,7 @@ class uf {
|
|
|
6180
6176
|
}
|
|
6181
6177
|
async getOwnLatestFeedIndex() {
|
|
6182
6178
|
try {
|
|
6183
|
-
const { bee: n, chatTopic: i } = this.swarmSettings, { ownAddress: c } = this.userDetails, u = this.generateUserOwnedFeedId(i, c),
|
|
6179
|
+
const { bee: n, chatTopic: i } = this.swarmSettings, { ownAddress: c } = this.userDetails, u = this.generateUserOwnedFeedId(i, c), d = Re.fromString(u), m = await n.makeFeedReader(d, c).downloadPayload(), w = Number(m.feedIndex.toBigInt()), v = w + 1;
|
|
6184
6180
|
return console.log("DEBUG: getLatestFeedIndex", w, v), { latestIndex: w, nextIndex: v };
|
|
6185
6181
|
} catch (n) {
|
|
6186
6182
|
if (this.isNotFoundError(n))
|
|
@@ -6189,8 +6185,8 @@ class uf {
|
|
|
6189
6185
|
}
|
|
6190
6186
|
}
|
|
6191
6187
|
async fetchLatestChatMessage() {
|
|
6192
|
-
const { bee: n, chatTopic: i, chatAddress: c } = this.swarmSettings,
|
|
6193
|
-
return { message:
|
|
6188
|
+
const { bee: n, chatTopic: i, chatAddress: c } = this.swarmSettings, d = await n.makeFeedReader(Re.fromString(i), An(c)).downloadPayload();
|
|
6189
|
+
return { message: d.payload.toJSON(), index: d.feedIndex };
|
|
6194
6190
|
}
|
|
6195
6191
|
async fetchChatMessage(n) {
|
|
6196
6192
|
const { bee: i, chatTopic: c, chatAddress: u } = this.swarmSettings;
|
|
@@ -6213,18 +6209,18 @@ class uf {
|
|
|
6213
6209
|
});
|
|
6214
6210
|
if (!u.ok)
|
|
6215
6211
|
throw new Error(`Failed to fetch: ${n}/${i}`);
|
|
6216
|
-
return u;
|
|
6212
|
+
return u.text();
|
|
6217
6213
|
}
|
|
6218
6214
|
async sendMessageToGsocOwn(n) {
|
|
6219
6215
|
this.logger.debug("sendMessageToGsoc entry CALLED");
|
|
6220
|
-
const { bee: i, stamp: c, gsocTopic: u, gsocResourceId:
|
|
6216
|
+
const { bee: i, stamp: c, gsocTopic: u, gsocResourceId: d } = this.swarmSettings, h = new _e(d), m = Pt.fromString(u), w = je.fromUtf8(n), { upload: v } = i.makeSOCWriter(h, {
|
|
6221
6217
|
timeout: this.UPLOAD_GSOC_TIMEOUT
|
|
6222
6218
|
});
|
|
6223
6219
|
await v(c, m, w.toUint8Array()), this.logger.debug("sendMessageToGsoc end CALLED");
|
|
6224
6220
|
}
|
|
6225
6221
|
async sendMessageToGsocEnvelope(n) {
|
|
6226
6222
|
this.logger.debug("sendMessageToGsoc entry CALLED");
|
|
6227
|
-
const { bee: i, stamp: c, gsocTopic: u, gsocResourceId:
|
|
6223
|
+
const { bee: i, stamp: c, gsocTopic: u, gsocResourceId: d } = this.swarmSettings, { privateKey: h } = this.userDetails, m = _n.fromBlank(h, c, this.depth), w = new _e(d), v = Pt.fromString(u), E = je.fromUtf8(n), R = ni(E.toUint8Array()), te = si(R, v, w), re = {
|
|
6228
6224
|
hash: () => te.address.toUint8Array()
|
|
6229
6225
|
}, Fe = m.stamp(re), { upload: Te } = i.makeSOCWriter(w, {
|
|
6230
6226
|
timeout: this.UPLOAD_GSOC_TIMEOUT
|
|
@@ -6235,12 +6231,12 @@ class uf {
|
|
|
6235
6231
|
return `${n}_EthercastChat_${i}`;
|
|
6236
6232
|
}
|
|
6237
6233
|
isNotFoundError(n) {
|
|
6238
|
-
return n.stack.includes("404") || n.message.includes("Not Found") || n.message.includes("404");
|
|
6234
|
+
return n.stack.includes("404") || n.message.includes("Not Found") || n.message.includes("404") || n.code === 404;
|
|
6239
6235
|
}
|
|
6240
6236
|
}
|
|
6241
6237
|
class df {
|
|
6242
6238
|
constructor(n) {
|
|
6243
|
-
this.logger = Y.getInstance(), this.errorHandler = new Mn(), this.gsocIndex = null, this.
|
|
6239
|
+
this.logger = Y.getInstance(), this.errorHandler = new Mn(), this.gsocIndex = null, this.fetchProcessRunning = !1, this.stopFetch = !1;
|
|
6244
6240
|
const i = new _e(An(n.user.privateKey));
|
|
6245
6241
|
this.userDetails = {
|
|
6246
6242
|
privateKey: n.user.privateKey,
|
|
@@ -6255,8 +6251,7 @@ class df {
|
|
|
6255
6251
|
gsocTopic: n.infra.gsocTopic,
|
|
6256
6252
|
gsocResourceId: n.infra.gsocResourceId,
|
|
6257
6253
|
chatTopic: n.infra.chatTopic,
|
|
6258
|
-
chatAddress: n.infra.chatAddress
|
|
6259
|
-
messageFetchInterval: n.infra.messageFetchInterval || 1500
|
|
6254
|
+
chatAddress: n.infra.chatAddress
|
|
6260
6255
|
}, this.emitter = new Jl(), this.utils = new uf(this.userDetails, this.swarmSettings), this.history = new cf(this.utils, this.emitter);
|
|
6261
6256
|
}
|
|
6262
6257
|
start() {
|
|
@@ -6285,8 +6280,8 @@ class df {
|
|
|
6285
6280
|
};
|
|
6286
6281
|
try {
|
|
6287
6282
|
this.emitter.emit(K.MESSAGE_REQUEST_INITIATED, u), await this.utils.writeOwnFeedDataByIndex(c, JSON.stringify(u)), this.userDetails.ownIndex = c, this.emitter.emit(K.MESSAGE_REQUEST_UPLOADED, u), await this.broadcastUserMessage(u);
|
|
6288
|
-
} catch (
|
|
6289
|
-
this.emitter.emit(K.MESSAGE_REQUEST_ERROR, u), this.errorHandler.handleError(
|
|
6283
|
+
} catch (d) {
|
|
6284
|
+
this.emitter.emit(K.MESSAGE_REQUEST_ERROR, u), this.errorHandler.handleError(d, "Chat.sendMessage");
|
|
6290
6285
|
}
|
|
6291
6286
|
}
|
|
6292
6287
|
async fetchPreviousMessages() {
|
|
@@ -6324,21 +6319,19 @@ class df {
|
|
|
6324
6319
|
}
|
|
6325
6320
|
// TODO - batch requests
|
|
6326
6321
|
async fetchLatestMessage() {
|
|
6327
|
-
var n;
|
|
6328
6322
|
try {
|
|
6329
|
-
|
|
6330
|
-
if (!i) {
|
|
6331
|
-
this.logger.error("No next index available for fetching the latest message.");
|
|
6323
|
+
if (!this.gsocIndex)
|
|
6332
6324
|
return;
|
|
6333
|
-
|
|
6334
|
-
|
|
6335
|
-
if (this.logger.debug("fetchLatestMessage entry CALLED", l), !af(l)) {
|
|
6325
|
+
const n = Re.fromString(this.swarmSettings.chatTopic), i = ui(n, this.gsocIndex), c = await this.utils.rawSocDownload(this.swarmSettings.chatAddress, i.toString()), u = JSON.parse(c);
|
|
6326
|
+
if (this.logger.debug("fetchLatestMessage entry CALLED", c), !af(u)) {
|
|
6336
6327
|
this.logger.warn("Invalid GSOC message during fetching");
|
|
6337
6328
|
return;
|
|
6338
6329
|
}
|
|
6339
|
-
this.emitter.emit(K.MESSAGE_RECEIVED,
|
|
6340
|
-
} catch (
|
|
6341
|
-
this.
|
|
6330
|
+
this.emitter.emit(K.MESSAGE_RECEIVED, u), this.gsocIndex = this.gsocIndex.next();
|
|
6331
|
+
} catch (n) {
|
|
6332
|
+
if (this.utils.isNotFoundError(n) || n.message.includes("Failed to fetch"))
|
|
6333
|
+
return;
|
|
6334
|
+
this.errorHandler.handleError(n, "Chat.fetchLatestMessage");
|
|
6342
6335
|
}
|
|
6343
6336
|
}
|
|
6344
6337
|
async broadcastUserMessage(n) {
|
|
@@ -6349,22 +6342,26 @@ class df {
|
|
|
6349
6342
|
}
|
|
6350
6343
|
}
|
|
6351
6344
|
getSignature() {
|
|
6352
|
-
const { ownAddress: n, privateKey: i, nickname: c } = this.userDetails, u = new jl(n).toString(),
|
|
6353
|
-
if (
|
|
6345
|
+
const { ownAddress: n, privateKey: i, nickname: c } = this.userDetails, u = new jl(n).toString(), d = new _e(i);
|
|
6346
|
+
if (d.publicKey().address().toString() !== u)
|
|
6354
6347
|
throw new Error("The provided address does not match the address derived from the private key");
|
|
6355
6348
|
const m = Date.now();
|
|
6356
|
-
return
|
|
6357
|
-
}
|
|
6358
|
-
startMessagesFetchProcess() {
|
|
6359
|
-
|
|
6360
|
-
|
|
6361
|
-
|
|
6362
|
-
|
|
6363
|
-
|
|
6364
|
-
|
|
6349
|
+
return d.sign(JSON.stringify({ username: c, address: u, timestamp: m })).toHex();
|
|
6350
|
+
}
|
|
6351
|
+
async startMessagesFetchProcess() {
|
|
6352
|
+
if (this.fetchProcessRunning) return;
|
|
6353
|
+
this.fetchProcessRunning = !0, this.stopFetch = !1;
|
|
6354
|
+
const n = async () => {
|
|
6355
|
+
if (this.stopFetch) {
|
|
6356
|
+
this.fetchProcessRunning = !1;
|
|
6357
|
+
return;
|
|
6358
|
+
}
|
|
6359
|
+
await this.fetchLatestMessage(), setTimeout(n, 200);
|
|
6360
|
+
};
|
|
6361
|
+
n();
|
|
6365
6362
|
}
|
|
6366
6363
|
stopMessagesFetchProcess() {
|
|
6367
|
-
this.
|
|
6364
|
+
this.stopFetch = !0;
|
|
6368
6365
|
}
|
|
6369
6366
|
}
|
|
6370
6367
|
export {
|