@synnaxlabs/drift 0.38.0 → 0.39.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/electron.cjs +1 -1
- package/dist/electron.js +1 -1
- package/dist/index.cjs +1 -1
- package/dist/index.js +138 -138
- package/dist/react.cjs +1 -1
- package/dist/react.js +32 -32
- package/dist/{selectors-DSYdcjUd.cjs → selectors-BOlMfPQR.cjs} +1 -1
- package/dist/{selectors-CDBV8JlK.js → selectors-ChR2waHK.js} +1 -1
- package/dist/src/configureStore.d.ts.map +1 -1
- package/dist/src/debug.d.ts.map +1 -1
- package/dist/src/electron/index.d.ts.map +1 -1
- package/dist/src/middleware.d.ts.map +1 -1
- package/dist/src/react/Provider.d.ts.map +1 -1
- package/dist/src/react/hooks.d.ts.map +1 -1
- package/dist/src/react/selectors.d.ts.map +1 -1
- package/dist/src/selectors.d.ts.map +1 -1
- package/dist/src/serialization/index.d.ts.map +1 -1
- package/dist/src/state.d.ts.map +1 -1
- package/dist/src/sugar.d.ts.map +1 -1
- package/dist/src/sync.d.ts.map +1 -1
- package/dist/src/tauri/index.d.ts.map +1 -1
- package/dist/src/validate.d.ts.map +1 -1
- package/dist/state-5JemPjJN.cjs +13 -0
- package/dist/{state-B6yPmERI.js → state-B4NiJdX7.js} +1319 -1346
- package/dist/tauri.cjs +1 -1
- package/dist/tauri.js +108 -103
- package/package.json +12 -11
- package/dist/state--TjGqMVk.cjs +0 -13
|
@@ -1,41 +1,44 @@
|
|
|
1
|
-
import { createSlice as
|
|
2
|
-
const
|
|
1
|
+
import { createSlice as Nr } from "@reduxjs/toolkit";
|
|
2
|
+
const dt = (n = !1, ...e) => {
|
|
3
3
|
n && console.log(...e);
|
|
4
|
-
},
|
|
4
|
+
}, Ir = (n = !1, ...e) => {
|
|
5
5
|
n && console.group(...e);
|
|
6
|
-
},
|
|
6
|
+
}, hn = (n) => {
|
|
7
7
|
n && console.groupEnd();
|
|
8
|
-
},
|
|
8
|
+
}, kr = (n) => {
|
|
9
9
|
const e = n.replace(/_[a-z]/g, (t) => t[1].toUpperCase());
|
|
10
10
|
return e.length > 1 && e[0] === e[0].toUpperCase() && e[1] === e[1].toUpperCase() || e.length === 0 ? e : e[0].toLowerCase() + e.slice(1);
|
|
11
|
-
},
|
|
12
|
-
const e = (t, r =
|
|
11
|
+
}, Cn = (n) => {
|
|
12
|
+
const e = (t, r = Zt) => {
|
|
13
13
|
if (typeof t == "string") return n(t);
|
|
14
14
|
if (Array.isArray(t)) return t.map((a) => e(a, r));
|
|
15
|
-
if (!
|
|
16
|
-
r =
|
|
15
|
+
if (!Ct(t)) return t;
|
|
16
|
+
r = $r(r);
|
|
17
17
|
const s = {}, i = t;
|
|
18
18
|
return Object.keys(i).forEach((a) => {
|
|
19
19
|
let o = i[a];
|
|
20
20
|
const c = n(a);
|
|
21
|
-
r.recursive && (
|
|
22
|
-
let
|
|
23
|
-
return
|
|
21
|
+
r.recursive && (Ct(o) ? pn(o, r.keepTypesOnRecursion) || (o = e(o, r)) : r.recursiveInArray && fn(o) && (o = [...o].map((l) => {
|
|
22
|
+
let p = l;
|
|
23
|
+
return Ct(l) ? pn(p, r.keepTypesOnRecursion) || (p = e(l, r)) : fn(l) && (p = e({ key: l }, r).key), p;
|
|
24
24
|
}))), s[c] = o;
|
|
25
25
|
}), s;
|
|
26
26
|
};
|
|
27
27
|
return e;
|
|
28
|
-
},
|
|
28
|
+
}, Rn = Cn(kr), Ar = (n) => (
|
|
29
29
|
// Don't convert the first character and don't convert a character that is after a
|
|
30
30
|
// non-alphanumeric character
|
|
31
|
-
n.replace(
|
|
32
|
-
|
|
31
|
+
n.replace(
|
|
32
|
+
/([a-z0-9])([A-Z])/g,
|
|
33
|
+
(e, t, r) => `${t}_${r.toLowerCase()}`
|
|
34
|
+
)
|
|
35
|
+
), Er = Cn(Ar), Zt = {
|
|
33
36
|
recursive: !0,
|
|
34
37
|
recursiveInArray: !0,
|
|
35
38
|
keepTypesOnRecursion: [Number, String, Uint8Array]
|
|
36
|
-
},
|
|
37
|
-
var
|
|
38
|
-
let
|
|
39
|
+
}, $r = (n = Zt) => (n.recursive == null ? n = Zt : n.recursiveInArray ?? (n.recursiveInArray = !1), n), fn = (n) => n != null && Array.isArray(n), Ct = (n) => n != null && typeof n == "object" && !Array.isArray(n), pn = (n, e) => (e || []).some((t) => n instanceof t), Fe = (n) => n != null && typeof n == "object" && !Array.isArray(n);
|
|
40
|
+
var Cr = Object.defineProperty, Rr = (n, e, t) => e in n ? Cr(n, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : n[e] = t, Ye = (n, e, t) => Rr(n, typeof e != "symbol" ? e + "" : e, t);
|
|
41
|
+
let Mr = class {
|
|
39
42
|
constructor() {
|
|
40
43
|
Ye(this, "contentType", "application/json"), Ye(this, "decoder"), Ye(this, "encoder"), this.decoder = new TextDecoder(), this.encoder = new TextEncoder();
|
|
41
44
|
}
|
|
@@ -46,16 +49,16 @@ let qr = class {
|
|
|
46
49
|
return this.decodeString(this.decoder.decode(e), t);
|
|
47
50
|
}
|
|
48
51
|
decodeString(e, t) {
|
|
49
|
-
const r = JSON.parse(e), s =
|
|
52
|
+
const r = JSON.parse(e), s = Rn(r);
|
|
50
53
|
return t != null ? t.parse(s) : s;
|
|
51
54
|
}
|
|
52
55
|
encodeString(e) {
|
|
53
|
-
const t =
|
|
56
|
+
const t = Er(e);
|
|
54
57
|
return JSON.stringify(t, (r, s) => ArrayBuffer.isView(s) ? Array.from(s) : Fe(s) && "encode_value" in s ? typeof s.value == "bigint" ? s.value.toString() : s.value : typeof s == "bigint" ? s.toString() : s);
|
|
55
58
|
}
|
|
56
59
|
static registerCustomType() {
|
|
57
60
|
}
|
|
58
|
-
},
|
|
61
|
+
}, jr = class {
|
|
59
62
|
constructor() {
|
|
60
63
|
Ye(this, "contentType", "text/csv");
|
|
61
64
|
}
|
|
@@ -87,9 +90,9 @@ let qr = class {
|
|
|
87
90
|
a[o] = [];
|
|
88
91
|
}), s.forEach((o) => {
|
|
89
92
|
const c = o.split(",").map((l) => l.trim());
|
|
90
|
-
i.forEach((l,
|
|
91
|
-
const
|
|
92
|
-
|
|
93
|
+
i.forEach((l, p) => {
|
|
94
|
+
const y = this.parseValue(c[p]);
|
|
95
|
+
y != null && a[l].push(y);
|
|
93
96
|
});
|
|
94
97
|
}), t != null ? t.parse(a) : a;
|
|
95
98
|
}
|
|
@@ -100,7 +103,7 @@ let qr = class {
|
|
|
100
103
|
}
|
|
101
104
|
static registerCustomType() {
|
|
102
105
|
}
|
|
103
|
-
},
|
|
106
|
+
}, Zr = class {
|
|
104
107
|
constructor() {
|
|
105
108
|
Ye(this, "contentType", "text/plain");
|
|
106
109
|
}
|
|
@@ -112,9 +115,9 @@ let qr = class {
|
|
|
112
115
|
return t != null ? t.parse(r) : r;
|
|
113
116
|
}
|
|
114
117
|
};
|
|
115
|
-
const
|
|
116
|
-
new
|
|
117
|
-
new
|
|
118
|
+
const pt = new Mr();
|
|
119
|
+
new jr();
|
|
120
|
+
new Zr();
|
|
118
121
|
var S;
|
|
119
122
|
(function(n) {
|
|
120
123
|
n.assertEqual = (s) => s;
|
|
@@ -151,15 +154,15 @@ var S;
|
|
|
151
154
|
}
|
|
152
155
|
n.joinValues = r, n.jsonStringifyReplacer = (s, i) => typeof i == "bigint" ? i.toString() : i;
|
|
153
156
|
})(S || (S = {}));
|
|
154
|
-
var
|
|
157
|
+
var Bt;
|
|
155
158
|
(function(n) {
|
|
156
159
|
n.mergeShapes = (e, t) => ({
|
|
157
160
|
...e,
|
|
158
161
|
...t
|
|
159
162
|
// second overwrites first
|
|
160
163
|
});
|
|
161
|
-
})(
|
|
162
|
-
const
|
|
164
|
+
})(Bt || (Bt = {}));
|
|
165
|
+
const g = S.arrayToEnum([
|
|
163
166
|
"string",
|
|
164
167
|
"nan",
|
|
165
168
|
"number",
|
|
@@ -180,28 +183,28 @@ const y = S.arrayToEnum([
|
|
|
180
183
|
"never",
|
|
181
184
|
"map",
|
|
182
185
|
"set"
|
|
183
|
-
]),
|
|
186
|
+
]), se = (n) => {
|
|
184
187
|
switch (typeof n) {
|
|
185
188
|
case "undefined":
|
|
186
|
-
return
|
|
189
|
+
return g.undefined;
|
|
187
190
|
case "string":
|
|
188
|
-
return
|
|
191
|
+
return g.string;
|
|
189
192
|
case "number":
|
|
190
|
-
return isNaN(n) ?
|
|
193
|
+
return isNaN(n) ? g.nan : g.number;
|
|
191
194
|
case "boolean":
|
|
192
|
-
return
|
|
195
|
+
return g.boolean;
|
|
193
196
|
case "function":
|
|
194
|
-
return
|
|
197
|
+
return g.function;
|
|
195
198
|
case "bigint":
|
|
196
|
-
return
|
|
199
|
+
return g.bigint;
|
|
197
200
|
case "symbol":
|
|
198
|
-
return
|
|
201
|
+
return g.symbol;
|
|
199
202
|
case "object":
|
|
200
|
-
return Array.isArray(n) ?
|
|
203
|
+
return Array.isArray(n) ? g.array : n === null ? g.null : n.then && typeof n.then == "function" && n.catch && typeof n.catch == "function" ? g.promise : typeof Map < "u" && n instanceof Map ? g.map : typeof Set < "u" && n instanceof Set ? g.set : typeof Date < "u" && n instanceof Date ? g.date : g.object;
|
|
201
204
|
default:
|
|
202
|
-
return
|
|
205
|
+
return g.unknown;
|
|
203
206
|
}
|
|
204
|
-
},
|
|
207
|
+
}, f = S.arrayToEnum([
|
|
205
208
|
"invalid_type",
|
|
206
209
|
"invalid_literal",
|
|
207
210
|
"custom",
|
|
@@ -218,8 +221,8 @@ const y = S.arrayToEnum([
|
|
|
218
221
|
"invalid_intersection_types",
|
|
219
222
|
"not_multiple_of",
|
|
220
223
|
"not_finite"
|
|
221
|
-
]),
|
|
222
|
-
class
|
|
224
|
+
]), Br = (n) => JSON.stringify(n, null, 2).replace(/"([^"]+)":/g, "$1:");
|
|
225
|
+
class W extends Error {
|
|
223
226
|
get errors() {
|
|
224
227
|
return this.issues;
|
|
225
228
|
}
|
|
@@ -256,7 +259,7 @@ class z extends Error {
|
|
|
256
259
|
return s(this), r;
|
|
257
260
|
}
|
|
258
261
|
static assert(e) {
|
|
259
|
-
if (!(e instanceof
|
|
262
|
+
if (!(e instanceof W))
|
|
260
263
|
throw new Error(`Not a ZodError: ${e}`);
|
|
261
264
|
}
|
|
262
265
|
toString() {
|
|
@@ -278,56 +281,56 @@ class z extends Error {
|
|
|
278
281
|
return this.flatten();
|
|
279
282
|
}
|
|
280
283
|
}
|
|
281
|
-
|
|
282
|
-
const
|
|
284
|
+
W.create = (n) => new W(n);
|
|
285
|
+
const $e = (n, e) => {
|
|
283
286
|
let t;
|
|
284
287
|
switch (n.code) {
|
|
285
|
-
case
|
|
286
|
-
n.received ===
|
|
288
|
+
case f.invalid_type:
|
|
289
|
+
n.received === g.undefined ? t = "Required" : t = `Expected ${n.expected}, received ${n.received}`;
|
|
287
290
|
break;
|
|
288
|
-
case
|
|
291
|
+
case f.invalid_literal:
|
|
289
292
|
t = `Invalid literal value, expected ${JSON.stringify(n.expected, S.jsonStringifyReplacer)}`;
|
|
290
293
|
break;
|
|
291
|
-
case
|
|
294
|
+
case f.unrecognized_keys:
|
|
292
295
|
t = `Unrecognized key(s) in object: ${S.joinValues(n.keys, ", ")}`;
|
|
293
296
|
break;
|
|
294
|
-
case
|
|
297
|
+
case f.invalid_union:
|
|
295
298
|
t = "Invalid input";
|
|
296
299
|
break;
|
|
297
|
-
case
|
|
300
|
+
case f.invalid_union_discriminator:
|
|
298
301
|
t = `Invalid discriminator value. Expected ${S.joinValues(n.options)}`;
|
|
299
302
|
break;
|
|
300
|
-
case
|
|
303
|
+
case f.invalid_enum_value:
|
|
301
304
|
t = `Invalid enum value. Expected ${S.joinValues(n.options)}, received '${n.received}'`;
|
|
302
305
|
break;
|
|
303
|
-
case
|
|
306
|
+
case f.invalid_arguments:
|
|
304
307
|
t = "Invalid function arguments";
|
|
305
308
|
break;
|
|
306
|
-
case
|
|
309
|
+
case f.invalid_return_type:
|
|
307
310
|
t = "Invalid function return type";
|
|
308
311
|
break;
|
|
309
|
-
case
|
|
312
|
+
case f.invalid_date:
|
|
310
313
|
t = "Invalid date";
|
|
311
314
|
break;
|
|
312
|
-
case
|
|
315
|
+
case f.invalid_string:
|
|
313
316
|
typeof n.validation == "object" ? "includes" in n.validation ? (t = `Invalid input: must include "${n.validation.includes}"`, typeof n.validation.position == "number" && (t = `${t} at one or more positions greater than or equal to ${n.validation.position}`)) : "startsWith" in n.validation ? t = `Invalid input: must start with "${n.validation.startsWith}"` : "endsWith" in n.validation ? t = `Invalid input: must end with "${n.validation.endsWith}"` : S.assertNever(n.validation) : n.validation !== "regex" ? t = `Invalid ${n.validation}` : t = "Invalid";
|
|
314
317
|
break;
|
|
315
|
-
case
|
|
318
|
+
case f.too_small:
|
|
316
319
|
n.type === "array" ? t = `Array must contain ${n.exact ? "exactly" : n.inclusive ? "at least" : "more than"} ${n.minimum} element(s)` : n.type === "string" ? t = `String must contain ${n.exact ? "exactly" : n.inclusive ? "at least" : "over"} ${n.minimum} character(s)` : n.type === "number" ? t = `Number must be ${n.exact ? "exactly equal to " : n.inclusive ? "greater than or equal to " : "greater than "}${n.minimum}` : n.type === "date" ? t = `Date must be ${n.exact ? "exactly equal to " : n.inclusive ? "greater than or equal to " : "greater than "}${new Date(Number(n.minimum))}` : t = "Invalid input";
|
|
317
320
|
break;
|
|
318
|
-
case
|
|
321
|
+
case f.too_big:
|
|
319
322
|
n.type === "array" ? t = `Array must contain ${n.exact ? "exactly" : n.inclusive ? "at most" : "less than"} ${n.maximum} element(s)` : n.type === "string" ? t = `String must contain ${n.exact ? "exactly" : n.inclusive ? "at most" : "under"} ${n.maximum} character(s)` : n.type === "number" ? t = `Number must be ${n.exact ? "exactly" : n.inclusive ? "less than or equal to" : "less than"} ${n.maximum}` : n.type === "bigint" ? t = `BigInt must be ${n.exact ? "exactly" : n.inclusive ? "less than or equal to" : "less than"} ${n.maximum}` : n.type === "date" ? t = `Date must be ${n.exact ? "exactly" : n.inclusive ? "smaller than or equal to" : "smaller than"} ${new Date(Number(n.maximum))}` : t = "Invalid input";
|
|
320
323
|
break;
|
|
321
|
-
case
|
|
324
|
+
case f.custom:
|
|
322
325
|
t = "Invalid input";
|
|
323
326
|
break;
|
|
324
|
-
case
|
|
327
|
+
case f.invalid_intersection_types:
|
|
325
328
|
t = "Intersection results could not be merged";
|
|
326
329
|
break;
|
|
327
|
-
case
|
|
330
|
+
case f.not_multiple_of:
|
|
328
331
|
t = `Number must be a multiple of ${n.multipleOf}`;
|
|
329
332
|
break;
|
|
330
|
-
case
|
|
333
|
+
case f.not_finite:
|
|
331
334
|
t = "Number must be finite";
|
|
332
335
|
break;
|
|
333
336
|
default:
|
|
@@ -335,14 +338,14 @@ const Ce = (n, e) => {
|
|
|
335
338
|
}
|
|
336
339
|
return { message: t };
|
|
337
340
|
};
|
|
338
|
-
let
|
|
339
|
-
function
|
|
340
|
-
|
|
341
|
+
let Mn = $e;
|
|
342
|
+
function Ur(n) {
|
|
343
|
+
Mn = n;
|
|
341
344
|
}
|
|
342
|
-
function
|
|
343
|
-
return
|
|
345
|
+
function wt() {
|
|
346
|
+
return Mn;
|
|
344
347
|
}
|
|
345
|
-
const
|
|
348
|
+
const bt = (n) => {
|
|
346
349
|
const { data: e, path: t, errorMaps: r, issueData: s } = n, i = [...t, ...s.path || []], a = {
|
|
347
350
|
...s,
|
|
348
351
|
path: i
|
|
@@ -362,9 +365,9 @@ const Ot = (n) => {
|
|
|
362
365
|
path: i,
|
|
363
366
|
message: o
|
|
364
367
|
};
|
|
365
|
-
},
|
|
366
|
-
function
|
|
367
|
-
const t =
|
|
368
|
+
}, Dr = [];
|
|
369
|
+
function m(n, e) {
|
|
370
|
+
const t = wt(), r = bt({
|
|
368
371
|
issueData: e,
|
|
369
372
|
data: n.data,
|
|
370
373
|
path: n.path,
|
|
@@ -375,13 +378,13 @@ function p(n, e) {
|
|
|
375
378
|
// then schema-bound map if available
|
|
376
379
|
t,
|
|
377
380
|
// then global override map
|
|
378
|
-
t ===
|
|
381
|
+
t === $e ? void 0 : $e
|
|
379
382
|
// then global default map
|
|
380
383
|
].filter((s) => !!s)
|
|
381
384
|
});
|
|
382
385
|
n.common.issues.push(r);
|
|
383
386
|
}
|
|
384
|
-
class
|
|
387
|
+
class L {
|
|
385
388
|
constructor() {
|
|
386
389
|
this.value = "valid";
|
|
387
390
|
}
|
|
@@ -409,7 +412,7 @@ class D {
|
|
|
409
412
|
value: a
|
|
410
413
|
});
|
|
411
414
|
}
|
|
412
|
-
return
|
|
415
|
+
return L.mergeObjectSync(e, r);
|
|
413
416
|
}
|
|
414
417
|
static mergeObjectSync(e, t) {
|
|
415
418
|
const r = {};
|
|
@@ -424,12 +427,12 @@ class D {
|
|
|
424
427
|
}
|
|
425
428
|
const x = Object.freeze({
|
|
426
429
|
status: "aborted"
|
|
427
|
-
}),
|
|
428
|
-
function
|
|
430
|
+
}), ke = (n) => ({ status: "dirty", value: n }), z = (n) => ({ status: "valid", value: n }), Ut = (n) => n.status === "aborted", Dt = (n) => n.status === "dirty", _e = (n) => n.status === "valid", Ge = (n) => typeof Promise < "u" && n instanceof Promise;
|
|
431
|
+
function xt(n, e, t, r) {
|
|
429
432
|
if (typeof e == "function" ? n !== e || !0 : !e.has(n)) throw new TypeError("Cannot read private member from an object whose class did not declare it");
|
|
430
433
|
return e.get(n);
|
|
431
434
|
}
|
|
432
|
-
function
|
|
435
|
+
function jn(n, e, t, r, s) {
|
|
433
436
|
if (typeof e == "function" ? n !== e || !0 : !e.has(n)) throw new TypeError("Cannot write private member to an object whose class did not declare it");
|
|
434
437
|
return e.set(n, t), t;
|
|
435
438
|
}
|
|
@@ -437,7 +440,7 @@ var v;
|
|
|
437
440
|
(function(n) {
|
|
438
441
|
n.errToObj = (e) => typeof e == "string" ? { message: e } : e || {}, n.toString = (e) => typeof e == "string" ? e : e == null ? void 0 : e.message;
|
|
439
442
|
})(v || (v = {}));
|
|
440
|
-
var
|
|
443
|
+
var je, Ze;
|
|
441
444
|
class K {
|
|
442
445
|
constructor(e, t, r, s) {
|
|
443
446
|
this._cachedPath = [], this.parent = e, this.data = t, this._path = r, this._key = s;
|
|
@@ -446,7 +449,7 @@ class K {
|
|
|
446
449
|
return this._cachedPath.length || (this._key instanceof Array ? this._cachedPath.push(...this._path, ...this._key) : this._cachedPath.push(...this._path, this._key)), this._cachedPath;
|
|
447
450
|
}
|
|
448
451
|
}
|
|
449
|
-
const
|
|
452
|
+
const mn = (n, e) => {
|
|
450
453
|
if (_e(e))
|
|
451
454
|
return { success: !0, data: e.value };
|
|
452
455
|
if (!n.common.issues.length)
|
|
@@ -456,7 +459,7 @@ const An = (n, e) => {
|
|
|
456
459
|
get error() {
|
|
457
460
|
if (this._error)
|
|
458
461
|
return this._error;
|
|
459
|
-
const t = new
|
|
462
|
+
const t = new W(n.common.issues);
|
|
460
463
|
return this._error = t, this._error;
|
|
461
464
|
}
|
|
462
465
|
};
|
|
@@ -469,8 +472,8 @@ function _(n) {
|
|
|
469
472
|
throw new Error(`Can't use "invalid_type_error" or "required_error" in conjunction with custom error map.`);
|
|
470
473
|
return e ? { errorMap: e, description: s } : { errorMap: (a, o) => {
|
|
471
474
|
var c, l;
|
|
472
|
-
const { message:
|
|
473
|
-
return a.code === "invalid_enum_value" ? { message:
|
|
475
|
+
const { message: p } = n;
|
|
476
|
+
return a.code === "invalid_enum_value" ? { message: p ?? o.defaultError } : typeof o.data > "u" ? { message: (c = p ?? r) !== null && c !== void 0 ? c : o.defaultError } : a.code !== "invalid_type" ? { message: o.defaultError } : { message: (l = p ?? t) !== null && l !== void 0 ? l : o.defaultError };
|
|
474
477
|
}, description: s };
|
|
475
478
|
}
|
|
476
479
|
class O {
|
|
@@ -478,13 +481,13 @@ class O {
|
|
|
478
481
|
return this._def.description;
|
|
479
482
|
}
|
|
480
483
|
_getType(e) {
|
|
481
|
-
return
|
|
484
|
+
return se(e.data);
|
|
482
485
|
}
|
|
483
486
|
_getOrReturnCtx(e, t) {
|
|
484
487
|
return t || {
|
|
485
488
|
common: e.parent.common,
|
|
486
489
|
data: e.data,
|
|
487
|
-
parsedType:
|
|
490
|
+
parsedType: se(e.data),
|
|
488
491
|
schemaErrorMap: this._def.errorMap,
|
|
489
492
|
path: e.path,
|
|
490
493
|
parent: e.parent
|
|
@@ -492,11 +495,11 @@ class O {
|
|
|
492
495
|
}
|
|
493
496
|
_processInputParams(e) {
|
|
494
497
|
return {
|
|
495
|
-
status: new
|
|
498
|
+
status: new L(),
|
|
496
499
|
ctx: {
|
|
497
500
|
common: e.parent.common,
|
|
498
501
|
data: e.data,
|
|
499
|
-
parsedType:
|
|
502
|
+
parsedType: se(e.data),
|
|
500
503
|
schemaErrorMap: this._def.errorMap,
|
|
501
504
|
path: e.path,
|
|
502
505
|
parent: e.parent
|
|
@@ -531,9 +534,9 @@ class O {
|
|
|
531
534
|
schemaErrorMap: this._def.errorMap,
|
|
532
535
|
parent: null,
|
|
533
536
|
data: e,
|
|
534
|
-
parsedType:
|
|
537
|
+
parsedType: se(e)
|
|
535
538
|
}, i = this._parseSync({ data: e, path: s.path, parent: s });
|
|
536
|
-
return
|
|
539
|
+
return mn(s, i);
|
|
537
540
|
}
|
|
538
541
|
"~validate"(e) {
|
|
539
542
|
var t, r;
|
|
@@ -546,7 +549,7 @@ class O {
|
|
|
546
549
|
schemaErrorMap: this._def.errorMap,
|
|
547
550
|
parent: null,
|
|
548
551
|
data: e,
|
|
549
|
-
parsedType:
|
|
552
|
+
parsedType: se(e)
|
|
550
553
|
};
|
|
551
554
|
if (!this["~standard"].async)
|
|
552
555
|
try {
|
|
@@ -585,15 +588,15 @@ class O {
|
|
|
585
588
|
schemaErrorMap: this._def.errorMap,
|
|
586
589
|
parent: null,
|
|
587
590
|
data: e,
|
|
588
|
-
parsedType:
|
|
591
|
+
parsedType: se(e)
|
|
589
592
|
}, s = this._parse({ data: e, path: r.path, parent: r }), i = await (Ge(s) ? s : Promise.resolve(s));
|
|
590
|
-
return
|
|
593
|
+
return mn(r, i);
|
|
591
594
|
}
|
|
592
595
|
refine(e, t) {
|
|
593
596
|
const r = (s) => typeof t == "string" || typeof t > "u" ? { message: t } : typeof t == "function" ? t(s) : t;
|
|
594
597
|
return this._refinement((s, i) => {
|
|
595
598
|
const a = e(s), o = () => i.addIssue({
|
|
596
|
-
code:
|
|
599
|
+
code: f.custom,
|
|
597
600
|
...r(s)
|
|
598
601
|
});
|
|
599
602
|
return typeof Promise < "u" && a instanceof Promise ? a.then((c) => c ? !0 : (o(), !1)) : a ? !0 : (o(), !1);
|
|
@@ -623,7 +626,7 @@ class O {
|
|
|
623
626
|
return X.create(this, this._def);
|
|
624
627
|
}
|
|
625
628
|
nullable() {
|
|
626
|
-
return
|
|
629
|
+
return pe.create(this, this._def);
|
|
627
630
|
}
|
|
628
631
|
nullish() {
|
|
629
632
|
return this.nullable().optional();
|
|
@@ -632,7 +635,7 @@ class O {
|
|
|
632
635
|
return F.create(this);
|
|
633
636
|
}
|
|
634
637
|
promise() {
|
|
635
|
-
return
|
|
638
|
+
return Re.create(this, this._def);
|
|
636
639
|
}
|
|
637
640
|
or(e) {
|
|
638
641
|
return Ke.create([this, e], this._def);
|
|
@@ -658,7 +661,7 @@ class O {
|
|
|
658
661
|
});
|
|
659
662
|
}
|
|
660
663
|
brand() {
|
|
661
|
-
return new
|
|
664
|
+
return new Kt({
|
|
662
665
|
typeName: b.ZodBranded,
|
|
663
666
|
type: this,
|
|
664
667
|
..._(this._def)
|
|
@@ -681,7 +684,7 @@ class O {
|
|
|
681
684
|
});
|
|
682
685
|
}
|
|
683
686
|
pipe(e) {
|
|
684
|
-
return
|
|
687
|
+
return ct.create(this, e);
|
|
685
688
|
}
|
|
686
689
|
readonly() {
|
|
687
690
|
return at.create(this);
|
|
@@ -693,26 +696,26 @@ class O {
|
|
|
693
696
|
return this.safeParse(null).success;
|
|
694
697
|
}
|
|
695
698
|
}
|
|
696
|
-
const
|
|
697
|
-
let
|
|
698
|
-
const
|
|
699
|
-
function
|
|
699
|
+
const Lr = /^c[^\s-]{8,}$/i, Pr = /^[0-9a-z]+$/, zr = /^[0-9A-HJKMNP-TV-Z]{26}$/i, Wr = /^[0-9a-fA-F]{8}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{12}$/i, Vr = /^[a-z0-9_-]{21}$/i, qr = /^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/, Fr = /^[-+]?P(?!$)(?:(?:[-+]?\d+Y)|(?:[-+]?\d+[.,]\d+Y$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:(?:[-+]?\d+W)|(?:[-+]?\d+[.,]\d+W$))?(?:(?:[-+]?\d+D)|(?:[-+]?\d+[.,]\d+D$))?(?:T(?=[\d+-])(?:(?:[-+]?\d+H)|(?:[-+]?\d+[.,]\d+H$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:[-+]?\d+(?:[.,]\d+)?S)?)??$/, Yr = /^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i, Gr = "^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$";
|
|
700
|
+
let Rt;
|
|
701
|
+
const Jr = /^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])$/, Hr = /^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\/(3[0-2]|[12]?[0-9])$/, Xr = /^(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))$/, Kr = /^(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/, Qr = /^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/, es = /^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/, Zn = "((\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-((0[13578]|1[02])-(0[1-9]|[12]\\d|3[01])|(0[469]|11)-(0[1-9]|[12]\\d|30)|(02)-(0[1-9]|1\\d|2[0-8])))", ts = new RegExp(`^${Zn}$`);
|
|
702
|
+
function Bn(n) {
|
|
700
703
|
let e = "([01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d";
|
|
701
704
|
return n.precision ? e = `${e}\\.\\d{${n.precision}}` : n.precision == null && (e = `${e}(\\.\\d+)?`), e;
|
|
702
705
|
}
|
|
703
|
-
function
|
|
704
|
-
return new RegExp(`^${
|
|
706
|
+
function ns(n) {
|
|
707
|
+
return new RegExp(`^${Bn(n)}$`);
|
|
705
708
|
}
|
|
706
|
-
function
|
|
707
|
-
let e = `${
|
|
709
|
+
function Un(n) {
|
|
710
|
+
let e = `${Zn}T${Bn(n)}`;
|
|
708
711
|
const t = [];
|
|
709
712
|
return t.push(n.local ? "Z?" : "Z"), n.offset && t.push("([+-]\\d{2}:?\\d{2})"), e = `${e}(${t.join("|")})`, new RegExp(`^${e}$`);
|
|
710
713
|
}
|
|
711
|
-
function
|
|
712
|
-
return !!((e === "v4" || !e) &&
|
|
714
|
+
function rs(n, e) {
|
|
715
|
+
return !!((e === "v4" || !e) && Jr.test(n) || (e === "v6" || !e) && Xr.test(n));
|
|
713
716
|
}
|
|
714
|
-
function
|
|
715
|
-
if (!
|
|
717
|
+
function ss(n, e) {
|
|
718
|
+
if (!qr.test(n))
|
|
716
719
|
return !1;
|
|
717
720
|
try {
|
|
718
721
|
const [t] = n.split("."), r = t.replace(/-/g, "+").replace(/_/g, "/").padEnd(t.length + (4 - t.length % 4) % 4, "="), s = JSON.parse(atob(r));
|
|
@@ -721,25 +724,25 @@ function ms(n, e) {
|
|
|
721
724
|
return !1;
|
|
722
725
|
}
|
|
723
726
|
}
|
|
724
|
-
function
|
|
725
|
-
return !!((e === "v4" || !e) &&
|
|
727
|
+
function is(n, e) {
|
|
728
|
+
return !!((e === "v4" || !e) && Hr.test(n) || (e === "v6" || !e) && Kr.test(n));
|
|
726
729
|
}
|
|
727
730
|
class q extends O {
|
|
728
731
|
_parse(e) {
|
|
729
|
-
if (this._def.coerce && (e.data = String(e.data)), this._getType(e) !==
|
|
732
|
+
if (this._def.coerce && (e.data = String(e.data)), this._getType(e) !== g.string) {
|
|
730
733
|
const i = this._getOrReturnCtx(e);
|
|
731
|
-
return
|
|
732
|
-
code:
|
|
733
|
-
expected:
|
|
734
|
+
return m(i, {
|
|
735
|
+
code: f.invalid_type,
|
|
736
|
+
expected: g.string,
|
|
734
737
|
received: i.parsedType
|
|
735
738
|
}), x;
|
|
736
739
|
}
|
|
737
|
-
const r = new
|
|
740
|
+
const r = new L();
|
|
738
741
|
let s;
|
|
739
742
|
for (const i of this._def.checks)
|
|
740
743
|
if (i.kind === "min")
|
|
741
|
-
e.data.length < i.value && (s = this._getOrReturnCtx(e, s),
|
|
742
|
-
code:
|
|
744
|
+
e.data.length < i.value && (s = this._getOrReturnCtx(e, s), m(s, {
|
|
745
|
+
code: f.too_small,
|
|
743
746
|
minimum: i.value,
|
|
744
747
|
type: "string",
|
|
745
748
|
inclusive: !0,
|
|
@@ -747,8 +750,8 @@ class q extends O {
|
|
|
747
750
|
message: i.message
|
|
748
751
|
}), r.dirty());
|
|
749
752
|
else if (i.kind === "max")
|
|
750
|
-
e.data.length > i.value && (s = this._getOrReturnCtx(e, s),
|
|
751
|
-
code:
|
|
753
|
+
e.data.length > i.value && (s = this._getOrReturnCtx(e, s), m(s, {
|
|
754
|
+
code: f.too_big,
|
|
752
755
|
maximum: i.value,
|
|
753
756
|
type: "string",
|
|
754
757
|
inclusive: !0,
|
|
@@ -757,15 +760,15 @@ class q extends O {
|
|
|
757
760
|
}), r.dirty());
|
|
758
761
|
else if (i.kind === "length") {
|
|
759
762
|
const a = e.data.length > i.value, o = e.data.length < i.value;
|
|
760
|
-
(a || o) && (s = this._getOrReturnCtx(e, s), a ?
|
|
761
|
-
code:
|
|
763
|
+
(a || o) && (s = this._getOrReturnCtx(e, s), a ? m(s, {
|
|
764
|
+
code: f.too_big,
|
|
762
765
|
maximum: i.value,
|
|
763
766
|
type: "string",
|
|
764
767
|
inclusive: !0,
|
|
765
768
|
exact: !0,
|
|
766
769
|
message: i.message
|
|
767
|
-
}) : o &&
|
|
768
|
-
code:
|
|
770
|
+
}) : o && m(s, {
|
|
771
|
+
code: f.too_small,
|
|
769
772
|
minimum: i.value,
|
|
770
773
|
type: "string",
|
|
771
774
|
inclusive: !0,
|
|
@@ -773,108 +776,108 @@ class q extends O {
|
|
|
773
776
|
message: i.message
|
|
774
777
|
}), r.dirty());
|
|
775
778
|
} else if (i.kind === "email")
|
|
776
|
-
|
|
779
|
+
Yr.test(e.data) || (s = this._getOrReturnCtx(e, s), m(s, {
|
|
777
780
|
validation: "email",
|
|
778
|
-
code:
|
|
781
|
+
code: f.invalid_string,
|
|
779
782
|
message: i.message
|
|
780
783
|
}), r.dirty());
|
|
781
784
|
else if (i.kind === "emoji")
|
|
782
|
-
|
|
785
|
+
Rt || (Rt = new RegExp(Gr, "u")), Rt.test(e.data) || (s = this._getOrReturnCtx(e, s), m(s, {
|
|
783
786
|
validation: "emoji",
|
|
784
|
-
code:
|
|
787
|
+
code: f.invalid_string,
|
|
785
788
|
message: i.message
|
|
786
789
|
}), r.dirty());
|
|
787
790
|
else if (i.kind === "uuid")
|
|
788
|
-
|
|
791
|
+
Wr.test(e.data) || (s = this._getOrReturnCtx(e, s), m(s, {
|
|
789
792
|
validation: "uuid",
|
|
790
|
-
code:
|
|
793
|
+
code: f.invalid_string,
|
|
791
794
|
message: i.message
|
|
792
795
|
}), r.dirty());
|
|
793
796
|
else if (i.kind === "nanoid")
|
|
794
|
-
|
|
797
|
+
Vr.test(e.data) || (s = this._getOrReturnCtx(e, s), m(s, {
|
|
795
798
|
validation: "nanoid",
|
|
796
|
-
code:
|
|
799
|
+
code: f.invalid_string,
|
|
797
800
|
message: i.message
|
|
798
801
|
}), r.dirty());
|
|
799
802
|
else if (i.kind === "cuid")
|
|
800
|
-
|
|
803
|
+
Lr.test(e.data) || (s = this._getOrReturnCtx(e, s), m(s, {
|
|
801
804
|
validation: "cuid",
|
|
802
|
-
code:
|
|
805
|
+
code: f.invalid_string,
|
|
803
806
|
message: i.message
|
|
804
807
|
}), r.dirty());
|
|
805
808
|
else if (i.kind === "cuid2")
|
|
806
|
-
|
|
809
|
+
Pr.test(e.data) || (s = this._getOrReturnCtx(e, s), m(s, {
|
|
807
810
|
validation: "cuid2",
|
|
808
|
-
code:
|
|
811
|
+
code: f.invalid_string,
|
|
809
812
|
message: i.message
|
|
810
813
|
}), r.dirty());
|
|
811
814
|
else if (i.kind === "ulid")
|
|
812
|
-
|
|
815
|
+
zr.test(e.data) || (s = this._getOrReturnCtx(e, s), m(s, {
|
|
813
816
|
validation: "ulid",
|
|
814
|
-
code:
|
|
817
|
+
code: f.invalid_string,
|
|
815
818
|
message: i.message
|
|
816
819
|
}), r.dirty());
|
|
817
820
|
else if (i.kind === "url")
|
|
818
821
|
try {
|
|
819
822
|
new URL(e.data);
|
|
820
823
|
} catch {
|
|
821
|
-
s = this._getOrReturnCtx(e, s),
|
|
824
|
+
s = this._getOrReturnCtx(e, s), m(s, {
|
|
822
825
|
validation: "url",
|
|
823
|
-
code:
|
|
826
|
+
code: f.invalid_string,
|
|
824
827
|
message: i.message
|
|
825
828
|
}), r.dirty();
|
|
826
829
|
}
|
|
827
|
-
else i.kind === "regex" ? (i.regex.lastIndex = 0, i.regex.test(e.data) || (s = this._getOrReturnCtx(e, s),
|
|
830
|
+
else i.kind === "regex" ? (i.regex.lastIndex = 0, i.regex.test(e.data) || (s = this._getOrReturnCtx(e, s), m(s, {
|
|
828
831
|
validation: "regex",
|
|
829
|
-
code:
|
|
832
|
+
code: f.invalid_string,
|
|
830
833
|
message: i.message
|
|
831
|
-
}), r.dirty())) : i.kind === "trim" ? e.data = e.data.trim() : i.kind === "includes" ? e.data.includes(i.value, i.position) || (s = this._getOrReturnCtx(e, s),
|
|
832
|
-
code:
|
|
834
|
+
}), r.dirty())) : i.kind === "trim" ? e.data = e.data.trim() : i.kind === "includes" ? e.data.includes(i.value, i.position) || (s = this._getOrReturnCtx(e, s), m(s, {
|
|
835
|
+
code: f.invalid_string,
|
|
833
836
|
validation: { includes: i.value, position: i.position },
|
|
834
837
|
message: i.message
|
|
835
|
-
}), r.dirty()) : i.kind === "toLowerCase" ? e.data = e.data.toLowerCase() : i.kind === "toUpperCase" ? e.data = e.data.toUpperCase() : i.kind === "startsWith" ? e.data.startsWith(i.value) || (s = this._getOrReturnCtx(e, s),
|
|
836
|
-
code:
|
|
838
|
+
}), r.dirty()) : i.kind === "toLowerCase" ? e.data = e.data.toLowerCase() : i.kind === "toUpperCase" ? e.data = e.data.toUpperCase() : i.kind === "startsWith" ? e.data.startsWith(i.value) || (s = this._getOrReturnCtx(e, s), m(s, {
|
|
839
|
+
code: f.invalid_string,
|
|
837
840
|
validation: { startsWith: i.value },
|
|
838
841
|
message: i.message
|
|
839
|
-
}), r.dirty()) : i.kind === "endsWith" ? e.data.endsWith(i.value) || (s = this._getOrReturnCtx(e, s),
|
|
840
|
-
code:
|
|
842
|
+
}), r.dirty()) : i.kind === "endsWith" ? e.data.endsWith(i.value) || (s = this._getOrReturnCtx(e, s), m(s, {
|
|
843
|
+
code: f.invalid_string,
|
|
841
844
|
validation: { endsWith: i.value },
|
|
842
845
|
message: i.message
|
|
843
|
-
}), r.dirty()) : i.kind === "datetime" ?
|
|
844
|
-
code:
|
|
846
|
+
}), r.dirty()) : i.kind === "datetime" ? Un(i).test(e.data) || (s = this._getOrReturnCtx(e, s), m(s, {
|
|
847
|
+
code: f.invalid_string,
|
|
845
848
|
validation: "datetime",
|
|
846
849
|
message: i.message
|
|
847
|
-
}), r.dirty()) : i.kind === "date" ?
|
|
848
|
-
code:
|
|
850
|
+
}), r.dirty()) : i.kind === "date" ? ts.test(e.data) || (s = this._getOrReturnCtx(e, s), m(s, {
|
|
851
|
+
code: f.invalid_string,
|
|
849
852
|
validation: "date",
|
|
850
853
|
message: i.message
|
|
851
|
-
}), r.dirty()) : i.kind === "time" ?
|
|
852
|
-
code:
|
|
854
|
+
}), r.dirty()) : i.kind === "time" ? ns(i).test(e.data) || (s = this._getOrReturnCtx(e, s), m(s, {
|
|
855
|
+
code: f.invalid_string,
|
|
853
856
|
validation: "time",
|
|
854
857
|
message: i.message
|
|
855
|
-
}), r.dirty()) : i.kind === "duration" ?
|
|
858
|
+
}), r.dirty()) : i.kind === "duration" ? Fr.test(e.data) || (s = this._getOrReturnCtx(e, s), m(s, {
|
|
856
859
|
validation: "duration",
|
|
857
|
-
code:
|
|
860
|
+
code: f.invalid_string,
|
|
858
861
|
message: i.message
|
|
859
|
-
}), r.dirty()) : i.kind === "ip" ?
|
|
862
|
+
}), r.dirty()) : i.kind === "ip" ? rs(e.data, i.version) || (s = this._getOrReturnCtx(e, s), m(s, {
|
|
860
863
|
validation: "ip",
|
|
861
|
-
code:
|
|
864
|
+
code: f.invalid_string,
|
|
862
865
|
message: i.message
|
|
863
|
-
}), r.dirty()) : i.kind === "jwt" ?
|
|
866
|
+
}), r.dirty()) : i.kind === "jwt" ? ss(e.data, i.alg) || (s = this._getOrReturnCtx(e, s), m(s, {
|
|
864
867
|
validation: "jwt",
|
|
865
|
-
code:
|
|
868
|
+
code: f.invalid_string,
|
|
866
869
|
message: i.message
|
|
867
|
-
}), r.dirty()) : i.kind === "cidr" ?
|
|
870
|
+
}), r.dirty()) : i.kind === "cidr" ? is(e.data, i.version) || (s = this._getOrReturnCtx(e, s), m(s, {
|
|
868
871
|
validation: "cidr",
|
|
869
|
-
code:
|
|
872
|
+
code: f.invalid_string,
|
|
870
873
|
message: i.message
|
|
871
|
-
}), r.dirty()) : i.kind === "base64" ?
|
|
874
|
+
}), r.dirty()) : i.kind === "base64" ? Qr.test(e.data) || (s = this._getOrReturnCtx(e, s), m(s, {
|
|
872
875
|
validation: "base64",
|
|
873
|
-
code:
|
|
876
|
+
code: f.invalid_string,
|
|
874
877
|
message: i.message
|
|
875
|
-
}), r.dirty()) : i.kind === "base64url" ?
|
|
878
|
+
}), r.dirty()) : i.kind === "base64url" ? es.test(e.data) || (s = this._getOrReturnCtx(e, s), m(s, {
|
|
876
879
|
validation: "base64url",
|
|
877
|
-
code:
|
|
880
|
+
code: f.invalid_string,
|
|
878
881
|
message: i.message
|
|
879
882
|
}), r.dirty()) : S.assertNever(i);
|
|
880
883
|
return { status: r.value, value: e.data };
|
|
@@ -882,7 +885,7 @@ class q extends O {
|
|
|
882
885
|
_regex(e, t, r) {
|
|
883
886
|
return this.refinement((s) => e.test(s), {
|
|
884
887
|
validation: t,
|
|
885
|
-
code:
|
|
888
|
+
code: f.invalid_string,
|
|
886
889
|
...v.errToObj(r)
|
|
887
890
|
});
|
|
888
891
|
}
|
|
@@ -1111,51 +1114,51 @@ q.create = (n) => {
|
|
|
1111
1114
|
..._(n)
|
|
1112
1115
|
});
|
|
1113
1116
|
};
|
|
1114
|
-
function
|
|
1117
|
+
function as(n, e) {
|
|
1115
1118
|
const t = (n.toString().split(".")[1] || "").length, r = (e.toString().split(".")[1] || "").length, s = t > r ? t : r, i = parseInt(n.toFixed(s).replace(".", "")), a = parseInt(e.toFixed(s).replace(".", ""));
|
|
1116
1119
|
return i % a / Math.pow(10, s);
|
|
1117
1120
|
}
|
|
1118
|
-
class
|
|
1121
|
+
class de extends O {
|
|
1119
1122
|
constructor() {
|
|
1120
1123
|
super(...arguments), this.min = this.gte, this.max = this.lte, this.step = this.multipleOf;
|
|
1121
1124
|
}
|
|
1122
1125
|
_parse(e) {
|
|
1123
|
-
if (this._def.coerce && (e.data = Number(e.data)), this._getType(e) !==
|
|
1126
|
+
if (this._def.coerce && (e.data = Number(e.data)), this._getType(e) !== g.number) {
|
|
1124
1127
|
const i = this._getOrReturnCtx(e);
|
|
1125
|
-
return
|
|
1126
|
-
code:
|
|
1127
|
-
expected:
|
|
1128
|
+
return m(i, {
|
|
1129
|
+
code: f.invalid_type,
|
|
1130
|
+
expected: g.number,
|
|
1128
1131
|
received: i.parsedType
|
|
1129
1132
|
}), x;
|
|
1130
1133
|
}
|
|
1131
1134
|
let r;
|
|
1132
|
-
const s = new
|
|
1135
|
+
const s = new L();
|
|
1133
1136
|
for (const i of this._def.checks)
|
|
1134
|
-
i.kind === "int" ? S.isInteger(e.data) || (r = this._getOrReturnCtx(e, r),
|
|
1135
|
-
code:
|
|
1137
|
+
i.kind === "int" ? S.isInteger(e.data) || (r = this._getOrReturnCtx(e, r), m(r, {
|
|
1138
|
+
code: f.invalid_type,
|
|
1136
1139
|
expected: "integer",
|
|
1137
1140
|
received: "float",
|
|
1138
1141
|
message: i.message
|
|
1139
|
-
}), s.dirty()) : i.kind === "min" ? (i.inclusive ? e.data < i.value : e.data <= i.value) && (r = this._getOrReturnCtx(e, r),
|
|
1140
|
-
code:
|
|
1142
|
+
}), s.dirty()) : i.kind === "min" ? (i.inclusive ? e.data < i.value : e.data <= i.value) && (r = this._getOrReturnCtx(e, r), m(r, {
|
|
1143
|
+
code: f.too_small,
|
|
1141
1144
|
minimum: i.value,
|
|
1142
1145
|
type: "number",
|
|
1143
1146
|
inclusive: i.inclusive,
|
|
1144
1147
|
exact: !1,
|
|
1145
1148
|
message: i.message
|
|
1146
|
-
}), s.dirty()) : i.kind === "max" ? (i.inclusive ? e.data > i.value : e.data >= i.value) && (r = this._getOrReturnCtx(e, r),
|
|
1147
|
-
code:
|
|
1149
|
+
}), s.dirty()) : i.kind === "max" ? (i.inclusive ? e.data > i.value : e.data >= i.value) && (r = this._getOrReturnCtx(e, r), m(r, {
|
|
1150
|
+
code: f.too_big,
|
|
1148
1151
|
maximum: i.value,
|
|
1149
1152
|
type: "number",
|
|
1150
1153
|
inclusive: i.inclusive,
|
|
1151
1154
|
exact: !1,
|
|
1152
1155
|
message: i.message
|
|
1153
|
-
}), s.dirty()) : i.kind === "multipleOf" ?
|
|
1154
|
-
code:
|
|
1156
|
+
}), s.dirty()) : i.kind === "multipleOf" ? as(e.data, i.value) !== 0 && (r = this._getOrReturnCtx(e, r), m(r, {
|
|
1157
|
+
code: f.not_multiple_of,
|
|
1155
1158
|
multipleOf: i.value,
|
|
1156
1159
|
message: i.message
|
|
1157
|
-
}), s.dirty()) : i.kind === "finite" ? Number.isFinite(e.data) || (r = this._getOrReturnCtx(e, r),
|
|
1158
|
-
code:
|
|
1160
|
+
}), s.dirty()) : i.kind === "finite" ? Number.isFinite(e.data) || (r = this._getOrReturnCtx(e, r), m(r, {
|
|
1161
|
+
code: f.not_finite,
|
|
1159
1162
|
message: i.message
|
|
1160
1163
|
}), s.dirty()) : S.assertNever(i);
|
|
1161
1164
|
return { status: s.value, value: e.data };
|
|
@@ -1173,7 +1176,7 @@ class le extends O {
|
|
|
1173
1176
|
return this.setLimit("max", e, !1, v.toString(t));
|
|
1174
1177
|
}
|
|
1175
1178
|
setLimit(e, t, r, s) {
|
|
1176
|
-
return new
|
|
1179
|
+
return new de({
|
|
1177
1180
|
...this._def,
|
|
1178
1181
|
checks: [
|
|
1179
1182
|
...this._def.checks,
|
|
@@ -1187,7 +1190,7 @@ class le extends O {
|
|
|
1187
1190
|
});
|
|
1188
1191
|
}
|
|
1189
1192
|
_addCheck(e) {
|
|
1190
|
-
return new
|
|
1193
|
+
return new de({
|
|
1191
1194
|
...this._def,
|
|
1192
1195
|
checks: [...this._def.checks, e]
|
|
1193
1196
|
});
|
|
@@ -1281,13 +1284,13 @@ class le extends O {
|
|
|
1281
1284
|
return Number.isFinite(t) && Number.isFinite(e);
|
|
1282
1285
|
}
|
|
1283
1286
|
}
|
|
1284
|
-
|
|
1287
|
+
de.create = (n) => new de({
|
|
1285
1288
|
checks: [],
|
|
1286
1289
|
typeName: b.ZodNumber,
|
|
1287
1290
|
coerce: (n == null ? void 0 : n.coerce) || !1,
|
|
1288
1291
|
..._(n)
|
|
1289
1292
|
});
|
|
1290
|
-
class
|
|
1293
|
+
class he extends O {
|
|
1291
1294
|
constructor() {
|
|
1292
1295
|
super(...arguments), this.min = this.gte, this.max = this.lte;
|
|
1293
1296
|
}
|
|
@@ -1298,25 +1301,25 @@ class de extends O {
|
|
|
1298
1301
|
} catch {
|
|
1299
1302
|
return this._getInvalidInput(e);
|
|
1300
1303
|
}
|
|
1301
|
-
if (this._getType(e) !==
|
|
1304
|
+
if (this._getType(e) !== g.bigint)
|
|
1302
1305
|
return this._getInvalidInput(e);
|
|
1303
1306
|
let r;
|
|
1304
|
-
const s = new
|
|
1307
|
+
const s = new L();
|
|
1305
1308
|
for (const i of this._def.checks)
|
|
1306
|
-
i.kind === "min" ? (i.inclusive ? e.data < i.value : e.data <= i.value) && (r = this._getOrReturnCtx(e, r),
|
|
1307
|
-
code:
|
|
1309
|
+
i.kind === "min" ? (i.inclusive ? e.data < i.value : e.data <= i.value) && (r = this._getOrReturnCtx(e, r), m(r, {
|
|
1310
|
+
code: f.too_small,
|
|
1308
1311
|
type: "bigint",
|
|
1309
1312
|
minimum: i.value,
|
|
1310
1313
|
inclusive: i.inclusive,
|
|
1311
1314
|
message: i.message
|
|
1312
|
-
}), s.dirty()) : i.kind === "max" ? (i.inclusive ? e.data > i.value : e.data >= i.value) && (r = this._getOrReturnCtx(e, r),
|
|
1313
|
-
code:
|
|
1315
|
+
}), s.dirty()) : i.kind === "max" ? (i.inclusive ? e.data > i.value : e.data >= i.value) && (r = this._getOrReturnCtx(e, r), m(r, {
|
|
1316
|
+
code: f.too_big,
|
|
1314
1317
|
type: "bigint",
|
|
1315
1318
|
maximum: i.value,
|
|
1316
1319
|
inclusive: i.inclusive,
|
|
1317
1320
|
message: i.message
|
|
1318
|
-
}), s.dirty()) : i.kind === "multipleOf" ? e.data % i.value !== BigInt(0) && (r = this._getOrReturnCtx(e, r),
|
|
1319
|
-
code:
|
|
1321
|
+
}), s.dirty()) : i.kind === "multipleOf" ? e.data % i.value !== BigInt(0) && (r = this._getOrReturnCtx(e, r), m(r, {
|
|
1322
|
+
code: f.not_multiple_of,
|
|
1320
1323
|
multipleOf: i.value,
|
|
1321
1324
|
message: i.message
|
|
1322
1325
|
}), s.dirty()) : S.assertNever(i);
|
|
@@ -1324,9 +1327,9 @@ class de extends O {
|
|
|
1324
1327
|
}
|
|
1325
1328
|
_getInvalidInput(e) {
|
|
1326
1329
|
const t = this._getOrReturnCtx(e);
|
|
1327
|
-
return
|
|
1328
|
-
code:
|
|
1329
|
-
expected:
|
|
1330
|
+
return m(t, {
|
|
1331
|
+
code: f.invalid_type,
|
|
1332
|
+
expected: g.bigint,
|
|
1330
1333
|
received: t.parsedType
|
|
1331
1334
|
}), x;
|
|
1332
1335
|
}
|
|
@@ -1343,7 +1346,7 @@ class de extends O {
|
|
|
1343
1346
|
return this.setLimit("max", e, !1, v.toString(t));
|
|
1344
1347
|
}
|
|
1345
1348
|
setLimit(e, t, r, s) {
|
|
1346
|
-
return new
|
|
1349
|
+
return new he({
|
|
1347
1350
|
...this._def,
|
|
1348
1351
|
checks: [
|
|
1349
1352
|
...this._def.checks,
|
|
@@ -1357,7 +1360,7 @@ class de extends O {
|
|
|
1357
1360
|
});
|
|
1358
1361
|
}
|
|
1359
1362
|
_addCheck(e) {
|
|
1360
|
-
return new
|
|
1363
|
+
return new he({
|
|
1361
1364
|
...this._def,
|
|
1362
1365
|
checks: [...this._def.checks, e]
|
|
1363
1366
|
});
|
|
@@ -1414,9 +1417,9 @@ class de extends O {
|
|
|
1414
1417
|
return e;
|
|
1415
1418
|
}
|
|
1416
1419
|
}
|
|
1417
|
-
|
|
1420
|
+
he.create = (n) => {
|
|
1418
1421
|
var e;
|
|
1419
|
-
return new
|
|
1422
|
+
return new he({
|
|
1420
1423
|
checks: [],
|
|
1421
1424
|
typeName: b.ZodBigInt,
|
|
1422
1425
|
coerce: (e = n == null ? void 0 : n.coerce) !== null && e !== void 0 ? e : !1,
|
|
@@ -1425,15 +1428,15 @@ de.create = (n) => {
|
|
|
1425
1428
|
};
|
|
1426
1429
|
class Je extends O {
|
|
1427
1430
|
_parse(e) {
|
|
1428
|
-
if (this._def.coerce && (e.data = !!e.data), this._getType(e) !==
|
|
1431
|
+
if (this._def.coerce && (e.data = !!e.data), this._getType(e) !== g.boolean) {
|
|
1429
1432
|
const r = this._getOrReturnCtx(e);
|
|
1430
|
-
return
|
|
1431
|
-
code:
|
|
1432
|
-
expected:
|
|
1433
|
+
return m(r, {
|
|
1434
|
+
code: f.invalid_type,
|
|
1435
|
+
expected: g.boolean,
|
|
1433
1436
|
received: r.parsedType
|
|
1434
1437
|
}), x;
|
|
1435
1438
|
}
|
|
1436
|
-
return
|
|
1439
|
+
return z(e.data);
|
|
1437
1440
|
}
|
|
1438
1441
|
}
|
|
1439
1442
|
Je.create = (n) => new Je({
|
|
@@ -1443,32 +1446,32 @@ Je.create = (n) => new Je({
|
|
|
1443
1446
|
});
|
|
1444
1447
|
class Te extends O {
|
|
1445
1448
|
_parse(e) {
|
|
1446
|
-
if (this._def.coerce && (e.data = new Date(e.data)), this._getType(e) !==
|
|
1449
|
+
if (this._def.coerce && (e.data = new Date(e.data)), this._getType(e) !== g.date) {
|
|
1447
1450
|
const i = this._getOrReturnCtx(e);
|
|
1448
|
-
return
|
|
1449
|
-
code:
|
|
1450
|
-
expected:
|
|
1451
|
+
return m(i, {
|
|
1452
|
+
code: f.invalid_type,
|
|
1453
|
+
expected: g.date,
|
|
1451
1454
|
received: i.parsedType
|
|
1452
1455
|
}), x;
|
|
1453
1456
|
}
|
|
1454
1457
|
if (isNaN(e.data.getTime())) {
|
|
1455
1458
|
const i = this._getOrReturnCtx(e);
|
|
1456
|
-
return
|
|
1457
|
-
code:
|
|
1459
|
+
return m(i, {
|
|
1460
|
+
code: f.invalid_date
|
|
1458
1461
|
}), x;
|
|
1459
1462
|
}
|
|
1460
|
-
const r = new
|
|
1463
|
+
const r = new L();
|
|
1461
1464
|
let s;
|
|
1462
1465
|
for (const i of this._def.checks)
|
|
1463
|
-
i.kind === "min" ? e.data.getTime() < i.value && (s = this._getOrReturnCtx(e, s),
|
|
1464
|
-
code:
|
|
1466
|
+
i.kind === "min" ? e.data.getTime() < i.value && (s = this._getOrReturnCtx(e, s), m(s, {
|
|
1467
|
+
code: f.too_small,
|
|
1465
1468
|
message: i.message,
|
|
1466
1469
|
inclusive: !0,
|
|
1467
1470
|
exact: !1,
|
|
1468
1471
|
minimum: i.value,
|
|
1469
1472
|
type: "date"
|
|
1470
|
-
}), r.dirty()) : i.kind === "max" ? e.data.getTime() > i.value && (s = this._getOrReturnCtx(e, s),
|
|
1471
|
-
code:
|
|
1473
|
+
}), r.dirty()) : i.kind === "max" ? e.data.getTime() > i.value && (s = this._getOrReturnCtx(e, s), m(s, {
|
|
1474
|
+
code: f.too_big,
|
|
1472
1475
|
message: i.message,
|
|
1473
1476
|
inclusive: !0,
|
|
1474
1477
|
exact: !1,
|
|
@@ -1519,34 +1522,34 @@ Te.create = (n) => new Te({
|
|
|
1519
1522
|
typeName: b.ZodDate,
|
|
1520
1523
|
..._(n)
|
|
1521
1524
|
});
|
|
1522
|
-
class
|
|
1525
|
+
class _t extends O {
|
|
1523
1526
|
_parse(e) {
|
|
1524
|
-
if (this._getType(e) !==
|
|
1527
|
+
if (this._getType(e) !== g.symbol) {
|
|
1525
1528
|
const r = this._getOrReturnCtx(e);
|
|
1526
|
-
return
|
|
1527
|
-
code:
|
|
1528
|
-
expected:
|
|
1529
|
+
return m(r, {
|
|
1530
|
+
code: f.invalid_type,
|
|
1531
|
+
expected: g.symbol,
|
|
1529
1532
|
received: r.parsedType
|
|
1530
1533
|
}), x;
|
|
1531
1534
|
}
|
|
1532
|
-
return
|
|
1535
|
+
return z(e.data);
|
|
1533
1536
|
}
|
|
1534
1537
|
}
|
|
1535
|
-
|
|
1538
|
+
_t.create = (n) => new _t({
|
|
1536
1539
|
typeName: b.ZodSymbol,
|
|
1537
1540
|
..._(n)
|
|
1538
1541
|
});
|
|
1539
1542
|
class He extends O {
|
|
1540
1543
|
_parse(e) {
|
|
1541
|
-
if (this._getType(e) !==
|
|
1544
|
+
if (this._getType(e) !== g.undefined) {
|
|
1542
1545
|
const r = this._getOrReturnCtx(e);
|
|
1543
|
-
return
|
|
1544
|
-
code:
|
|
1545
|
-
expected:
|
|
1546
|
+
return m(r, {
|
|
1547
|
+
code: f.invalid_type,
|
|
1548
|
+
expected: g.undefined,
|
|
1546
1549
|
received: r.parsedType
|
|
1547
1550
|
}), x;
|
|
1548
1551
|
}
|
|
1549
|
-
return
|
|
1552
|
+
return z(e.data);
|
|
1550
1553
|
}
|
|
1551
1554
|
}
|
|
1552
1555
|
He.create = (n) => new He({
|
|
@@ -1555,30 +1558,30 @@ He.create = (n) => new He({
|
|
|
1555
1558
|
});
|
|
1556
1559
|
class Xe extends O {
|
|
1557
1560
|
_parse(e) {
|
|
1558
|
-
if (this._getType(e) !==
|
|
1561
|
+
if (this._getType(e) !== g.null) {
|
|
1559
1562
|
const r = this._getOrReturnCtx(e);
|
|
1560
|
-
return
|
|
1561
|
-
code:
|
|
1562
|
-
expected:
|
|
1563
|
+
return m(r, {
|
|
1564
|
+
code: f.invalid_type,
|
|
1565
|
+
expected: g.null,
|
|
1563
1566
|
received: r.parsedType
|
|
1564
1567
|
}), x;
|
|
1565
1568
|
}
|
|
1566
|
-
return
|
|
1569
|
+
return z(e.data);
|
|
1567
1570
|
}
|
|
1568
1571
|
}
|
|
1569
1572
|
Xe.create = (n) => new Xe({
|
|
1570
1573
|
typeName: b.ZodNull,
|
|
1571
1574
|
..._(n)
|
|
1572
1575
|
});
|
|
1573
|
-
class
|
|
1576
|
+
class Ce extends O {
|
|
1574
1577
|
constructor() {
|
|
1575
1578
|
super(...arguments), this._any = !0;
|
|
1576
1579
|
}
|
|
1577
1580
|
_parse(e) {
|
|
1578
|
-
return
|
|
1581
|
+
return z(e.data);
|
|
1579
1582
|
}
|
|
1580
1583
|
}
|
|
1581
|
-
|
|
1584
|
+
Ce.create = (n) => new Ce({
|
|
1582
1585
|
typeName: b.ZodAny,
|
|
1583
1586
|
..._(n)
|
|
1584
1587
|
});
|
|
@@ -1587,57 +1590,57 @@ class ve extends O {
|
|
|
1587
1590
|
super(...arguments), this._unknown = !0;
|
|
1588
1591
|
}
|
|
1589
1592
|
_parse(e) {
|
|
1590
|
-
return
|
|
1593
|
+
return z(e.data);
|
|
1591
1594
|
}
|
|
1592
1595
|
}
|
|
1593
1596
|
ve.create = (n) => new ve({
|
|
1594
1597
|
typeName: b.ZodUnknown,
|
|
1595
1598
|
..._(n)
|
|
1596
1599
|
});
|
|
1597
|
-
class
|
|
1600
|
+
class ae extends O {
|
|
1598
1601
|
_parse(e) {
|
|
1599
1602
|
const t = this._getOrReturnCtx(e);
|
|
1600
|
-
return
|
|
1601
|
-
code:
|
|
1602
|
-
expected:
|
|
1603
|
+
return m(t, {
|
|
1604
|
+
code: f.invalid_type,
|
|
1605
|
+
expected: g.never,
|
|
1603
1606
|
received: t.parsedType
|
|
1604
1607
|
}), x;
|
|
1605
1608
|
}
|
|
1606
1609
|
}
|
|
1607
|
-
|
|
1610
|
+
ae.create = (n) => new ae({
|
|
1608
1611
|
typeName: b.ZodNever,
|
|
1609
1612
|
..._(n)
|
|
1610
1613
|
});
|
|
1611
|
-
class
|
|
1614
|
+
class Tt extends O {
|
|
1612
1615
|
_parse(e) {
|
|
1613
|
-
if (this._getType(e) !==
|
|
1616
|
+
if (this._getType(e) !== g.undefined) {
|
|
1614
1617
|
const r = this._getOrReturnCtx(e);
|
|
1615
|
-
return
|
|
1616
|
-
code:
|
|
1617
|
-
expected:
|
|
1618
|
+
return m(r, {
|
|
1619
|
+
code: f.invalid_type,
|
|
1620
|
+
expected: g.void,
|
|
1618
1621
|
received: r.parsedType
|
|
1619
1622
|
}), x;
|
|
1620
1623
|
}
|
|
1621
|
-
return
|
|
1624
|
+
return z(e.data);
|
|
1622
1625
|
}
|
|
1623
1626
|
}
|
|
1624
|
-
|
|
1627
|
+
Tt.create = (n) => new Tt({
|
|
1625
1628
|
typeName: b.ZodVoid,
|
|
1626
1629
|
..._(n)
|
|
1627
1630
|
});
|
|
1628
1631
|
class F extends O {
|
|
1629
1632
|
_parse(e) {
|
|
1630
1633
|
const { ctx: t, status: r } = this._processInputParams(e), s = this._def;
|
|
1631
|
-
if (t.parsedType !==
|
|
1632
|
-
return
|
|
1633
|
-
code:
|
|
1634
|
-
expected:
|
|
1634
|
+
if (t.parsedType !== g.array)
|
|
1635
|
+
return m(t, {
|
|
1636
|
+
code: f.invalid_type,
|
|
1637
|
+
expected: g.array,
|
|
1635
1638
|
received: t.parsedType
|
|
1636
1639
|
}), x;
|
|
1637
1640
|
if (s.exactLength !== null) {
|
|
1638
1641
|
const a = t.data.length > s.exactLength.value, o = t.data.length < s.exactLength.value;
|
|
1639
|
-
(a || o) && (
|
|
1640
|
-
code: a ?
|
|
1642
|
+
(a || o) && (m(t, {
|
|
1643
|
+
code: a ? f.too_big : f.too_small,
|
|
1641
1644
|
minimum: o ? s.exactLength.value : void 0,
|
|
1642
1645
|
maximum: a ? s.exactLength.value : void 0,
|
|
1643
1646
|
type: "array",
|
|
@@ -1646,24 +1649,24 @@ class F extends O {
|
|
|
1646
1649
|
message: s.exactLength.message
|
|
1647
1650
|
}), r.dirty());
|
|
1648
1651
|
}
|
|
1649
|
-
if (s.minLength !== null && t.data.length < s.minLength.value && (
|
|
1650
|
-
code:
|
|
1652
|
+
if (s.minLength !== null && t.data.length < s.minLength.value && (m(t, {
|
|
1653
|
+
code: f.too_small,
|
|
1651
1654
|
minimum: s.minLength.value,
|
|
1652
1655
|
type: "array",
|
|
1653
1656
|
inclusive: !0,
|
|
1654
1657
|
exact: !1,
|
|
1655
1658
|
message: s.minLength.message
|
|
1656
|
-
}), r.dirty()), s.maxLength !== null && t.data.length > s.maxLength.value && (
|
|
1657
|
-
code:
|
|
1659
|
+
}), r.dirty()), s.maxLength !== null && t.data.length > s.maxLength.value && (m(t, {
|
|
1660
|
+
code: f.too_big,
|
|
1658
1661
|
maximum: s.maxLength.value,
|
|
1659
1662
|
type: "array",
|
|
1660
1663
|
inclusive: !0,
|
|
1661
1664
|
exact: !1,
|
|
1662
1665
|
message: s.maxLength.message
|
|
1663
1666
|
}), r.dirty()), t.common.async)
|
|
1664
|
-
return Promise.all([...t.data].map((a, o) => s.type._parseAsync(new K(t, a, t.path, o)))).then((a) =>
|
|
1667
|
+
return Promise.all([...t.data].map((a, o) => s.type._parseAsync(new K(t, a, t.path, o)))).then((a) => L.mergeArray(r, a));
|
|
1665
1668
|
const i = [...t.data].map((a, o) => s.type._parseSync(new K(t, a, t.path, o)));
|
|
1666
|
-
return
|
|
1669
|
+
return L.mergeArray(r, i);
|
|
1667
1670
|
}
|
|
1668
1671
|
get element() {
|
|
1669
1672
|
return this._def.type;
|
|
@@ -1698,12 +1701,12 @@ F.create = (n, e) => new F({
|
|
|
1698
1701
|
typeName: b.ZodArray,
|
|
1699
1702
|
..._(e)
|
|
1700
1703
|
});
|
|
1701
|
-
function
|
|
1704
|
+
function Ie(n) {
|
|
1702
1705
|
if (n instanceof R) {
|
|
1703
1706
|
const e = {};
|
|
1704
1707
|
for (const t in n.shape) {
|
|
1705
1708
|
const r = n.shape[t];
|
|
1706
|
-
e[t] = X.create(
|
|
1709
|
+
e[t] = X.create(Ie(r));
|
|
1707
1710
|
}
|
|
1708
1711
|
return new R({
|
|
1709
1712
|
...n._def,
|
|
@@ -1711,8 +1714,8 @@ function ke(n) {
|
|
|
1711
1714
|
});
|
|
1712
1715
|
} else return n instanceof F ? new F({
|
|
1713
1716
|
...n._def,
|
|
1714
|
-
type:
|
|
1715
|
-
}) : n instanceof X ? X.create(
|
|
1717
|
+
type: Ie(n.element)
|
|
1718
|
+
}) : n instanceof X ? X.create(Ie(n.unwrap())) : n instanceof pe ? pe.create(Ie(n.unwrap())) : n instanceof Q ? Q.create(n.items.map((e) => Ie(e))) : n;
|
|
1716
1719
|
}
|
|
1717
1720
|
class R extends O {
|
|
1718
1721
|
constructor() {
|
|
@@ -1725,67 +1728,67 @@ class R extends O {
|
|
|
1725
1728
|
return this._cached = { shape: e, keys: t };
|
|
1726
1729
|
}
|
|
1727
1730
|
_parse(e) {
|
|
1728
|
-
if (this._getType(e) !==
|
|
1731
|
+
if (this._getType(e) !== g.object) {
|
|
1729
1732
|
const l = this._getOrReturnCtx(e);
|
|
1730
|
-
return
|
|
1731
|
-
code:
|
|
1732
|
-
expected:
|
|
1733
|
+
return m(l, {
|
|
1734
|
+
code: f.invalid_type,
|
|
1735
|
+
expected: g.object,
|
|
1733
1736
|
received: l.parsedType
|
|
1734
1737
|
}), x;
|
|
1735
1738
|
}
|
|
1736
1739
|
const { status: r, ctx: s } = this._processInputParams(e), { shape: i, keys: a } = this._getCached(), o = [];
|
|
1737
|
-
if (!(this._def.catchall instanceof
|
|
1740
|
+
if (!(this._def.catchall instanceof ae && this._def.unknownKeys === "strip"))
|
|
1738
1741
|
for (const l in s.data)
|
|
1739
1742
|
a.includes(l) || o.push(l);
|
|
1740
1743
|
const c = [];
|
|
1741
1744
|
for (const l of a) {
|
|
1742
|
-
const
|
|
1745
|
+
const p = i[l], y = s.data[l];
|
|
1743
1746
|
c.push({
|
|
1744
1747
|
key: { status: "valid", value: l },
|
|
1745
|
-
value:
|
|
1748
|
+
value: p._parse(new K(s, y, s.path, l)),
|
|
1746
1749
|
alwaysSet: l in s.data
|
|
1747
1750
|
});
|
|
1748
1751
|
}
|
|
1749
|
-
if (this._def.catchall instanceof
|
|
1752
|
+
if (this._def.catchall instanceof ae) {
|
|
1750
1753
|
const l = this._def.unknownKeys;
|
|
1751
1754
|
if (l === "passthrough")
|
|
1752
|
-
for (const
|
|
1755
|
+
for (const p of o)
|
|
1753
1756
|
c.push({
|
|
1754
|
-
key: { status: "valid", value:
|
|
1755
|
-
value: { status: "valid", value: s.data[
|
|
1757
|
+
key: { status: "valid", value: p },
|
|
1758
|
+
value: { status: "valid", value: s.data[p] }
|
|
1756
1759
|
});
|
|
1757
1760
|
else if (l === "strict")
|
|
1758
|
-
o.length > 0 && (
|
|
1759
|
-
code:
|
|
1761
|
+
o.length > 0 && (m(s, {
|
|
1762
|
+
code: f.unrecognized_keys,
|
|
1760
1763
|
keys: o
|
|
1761
1764
|
}), r.dirty());
|
|
1762
1765
|
else if (l !== "strip") throw new Error("Internal ZodObject error: invalid unknownKeys value.");
|
|
1763
1766
|
} else {
|
|
1764
1767
|
const l = this._def.catchall;
|
|
1765
|
-
for (const
|
|
1766
|
-
const
|
|
1768
|
+
for (const p of o) {
|
|
1769
|
+
const y = s.data[p];
|
|
1767
1770
|
c.push({
|
|
1768
|
-
key: { status: "valid", value:
|
|
1771
|
+
key: { status: "valid", value: p },
|
|
1769
1772
|
value: l._parse(
|
|
1770
|
-
new K(s,
|
|
1773
|
+
new K(s, y, s.path, p)
|
|
1771
1774
|
//, ctx.child(key), value, getParsedType(value)
|
|
1772
1775
|
),
|
|
1773
|
-
alwaysSet:
|
|
1776
|
+
alwaysSet: p in s.data
|
|
1774
1777
|
});
|
|
1775
1778
|
}
|
|
1776
1779
|
}
|
|
1777
1780
|
return s.common.async ? Promise.resolve().then(async () => {
|
|
1778
1781
|
const l = [];
|
|
1779
|
-
for (const
|
|
1780
|
-
const
|
|
1782
|
+
for (const p of c) {
|
|
1783
|
+
const y = await p.key, j = await p.value;
|
|
1781
1784
|
l.push({
|
|
1782
|
-
key:
|
|
1783
|
-
value:
|
|
1784
|
-
alwaysSet:
|
|
1785
|
+
key: y,
|
|
1786
|
+
value: j,
|
|
1787
|
+
alwaysSet: p.alwaysSet
|
|
1785
1788
|
});
|
|
1786
1789
|
}
|
|
1787
1790
|
return l;
|
|
1788
|
-
}).then((l) =>
|
|
1791
|
+
}).then((l) => L.mergeObjectSync(r, l)) : L.mergeObjectSync(r, c);
|
|
1789
1792
|
}
|
|
1790
1793
|
get shape() {
|
|
1791
1794
|
return this._def.shape();
|
|
@@ -1948,7 +1951,7 @@ class R extends O {
|
|
|
1948
1951
|
* @deprecated
|
|
1949
1952
|
*/
|
|
1950
1953
|
deepPartial() {
|
|
1951
|
-
return
|
|
1954
|
+
return Ie(this);
|
|
1952
1955
|
}
|
|
1953
1956
|
partial(e) {
|
|
1954
1957
|
const t = {};
|
|
@@ -1977,27 +1980,27 @@ class R extends O {
|
|
|
1977
1980
|
});
|
|
1978
1981
|
}
|
|
1979
1982
|
keyof() {
|
|
1980
|
-
return
|
|
1983
|
+
return Dn(S.objectKeys(this.shape));
|
|
1981
1984
|
}
|
|
1982
1985
|
}
|
|
1983
1986
|
R.create = (n, e) => new R({
|
|
1984
1987
|
shape: () => n,
|
|
1985
1988
|
unknownKeys: "strip",
|
|
1986
|
-
catchall:
|
|
1989
|
+
catchall: ae.create(),
|
|
1987
1990
|
typeName: b.ZodObject,
|
|
1988
1991
|
..._(e)
|
|
1989
1992
|
});
|
|
1990
1993
|
R.strictCreate = (n, e) => new R({
|
|
1991
1994
|
shape: () => n,
|
|
1992
1995
|
unknownKeys: "strict",
|
|
1993
|
-
catchall:
|
|
1996
|
+
catchall: ae.create(),
|
|
1994
1997
|
typeName: b.ZodObject,
|
|
1995
1998
|
..._(e)
|
|
1996
1999
|
});
|
|
1997
2000
|
R.lazycreate = (n, e) => new R({
|
|
1998
2001
|
shape: n,
|
|
1999
2002
|
unknownKeys: "strip",
|
|
2000
|
-
catchall:
|
|
2003
|
+
catchall: ae.create(),
|
|
2001
2004
|
typeName: b.ZodObject,
|
|
2002
2005
|
..._(e)
|
|
2003
2006
|
});
|
|
@@ -2011,9 +2014,9 @@ class Ke extends O {
|
|
|
2011
2014
|
for (const o of i)
|
|
2012
2015
|
if (o.result.status === "dirty")
|
|
2013
2016
|
return t.common.issues.push(...o.ctx.common.issues), o.result;
|
|
2014
|
-
const a = i.map((o) => new
|
|
2015
|
-
return
|
|
2016
|
-
code:
|
|
2017
|
+
const a = i.map((o) => new W(o.ctx.common.issues));
|
|
2018
|
+
return m(t, {
|
|
2019
|
+
code: f.invalid_union,
|
|
2017
2020
|
unionErrors: a
|
|
2018
2021
|
}), x;
|
|
2019
2022
|
}
|
|
@@ -2047,20 +2050,20 @@ class Ke extends O {
|
|
|
2047
2050
|
issues: []
|
|
2048
2051
|
},
|
|
2049
2052
|
parent: null
|
|
2050
|
-
},
|
|
2053
|
+
}, p = c._parseSync({
|
|
2051
2054
|
data: t.data,
|
|
2052
2055
|
path: t.path,
|
|
2053
2056
|
parent: l
|
|
2054
2057
|
});
|
|
2055
|
-
if (
|
|
2056
|
-
return
|
|
2057
|
-
|
|
2058
|
+
if (p.status === "valid")
|
|
2059
|
+
return p;
|
|
2060
|
+
p.status === "dirty" && !i && (i = { result: p, ctx: l }), l.common.issues.length && a.push(l.common.issues);
|
|
2058
2061
|
}
|
|
2059
2062
|
if (i)
|
|
2060
2063
|
return t.common.issues.push(...i.ctx.common.issues), i.result;
|
|
2061
|
-
const o = a.map((c) => new
|
|
2062
|
-
return
|
|
2063
|
-
code:
|
|
2064
|
+
const o = a.map((c) => new W(c));
|
|
2065
|
+
return m(t, {
|
|
2066
|
+
code: f.invalid_union,
|
|
2064
2067
|
unionErrors: o
|
|
2065
2068
|
}), x;
|
|
2066
2069
|
}
|
|
@@ -2074,14 +2077,14 @@ Ke.create = (n, e) => new Ke({
|
|
|
2074
2077
|
typeName: b.ZodUnion,
|
|
2075
2078
|
..._(e)
|
|
2076
2079
|
});
|
|
2077
|
-
const
|
|
2078
|
-
class
|
|
2080
|
+
const ne = (n) => n instanceof tt ? ne(n.schema) : n instanceof Y ? ne(n.innerType()) : n instanceof nt ? [n.value] : n instanceof fe ? n.options : n instanceof rt ? S.objectValues(n.enum) : n instanceof st ? ne(n._def.innerType) : n instanceof He ? [void 0] : n instanceof Xe ? [null] : n instanceof X ? [void 0, ...ne(n.unwrap())] : n instanceof pe ? [null, ...ne(n.unwrap())] : n instanceof Kt || n instanceof at ? ne(n.unwrap()) : n instanceof it ? ne(n._def.innerType) : [];
|
|
2081
|
+
class It extends O {
|
|
2079
2082
|
_parse(e) {
|
|
2080
2083
|
const { ctx: t } = this._processInputParams(e);
|
|
2081
|
-
if (t.parsedType !==
|
|
2082
|
-
return
|
|
2083
|
-
code:
|
|
2084
|
-
expected:
|
|
2084
|
+
if (t.parsedType !== g.object)
|
|
2085
|
+
return m(t, {
|
|
2086
|
+
code: f.invalid_type,
|
|
2087
|
+
expected: g.object,
|
|
2085
2088
|
received: t.parsedType
|
|
2086
2089
|
}), x;
|
|
2087
2090
|
const r = this.discriminator, s = t.data[r], i = this.optionsMap.get(s);
|
|
@@ -2093,8 +2096,8 @@ class $t extends O {
|
|
|
2093
2096
|
data: t.data,
|
|
2094
2097
|
path: t.path,
|
|
2095
2098
|
parent: t
|
|
2096
|
-
}) : (
|
|
2097
|
-
code:
|
|
2099
|
+
}) : (m(t, {
|
|
2100
|
+
code: f.invalid_union_discriminator,
|
|
2098
2101
|
options: Array.from(this.optionsMap.keys()),
|
|
2099
2102
|
path: [r]
|
|
2100
2103
|
}), x);
|
|
@@ -2119,7 +2122,7 @@ class $t extends O {
|
|
|
2119
2122
|
static create(e, t, r) {
|
|
2120
2123
|
const s = /* @__PURE__ */ new Map();
|
|
2121
2124
|
for (const i of t) {
|
|
2122
|
-
const a =
|
|
2125
|
+
const a = ne(i.shape[e]);
|
|
2123
2126
|
if (!a.length)
|
|
2124
2127
|
throw new Error(`A discriminator value for key \`${e}\` could not be extracted from all schema options`);
|
|
2125
2128
|
for (const o of a) {
|
|
@@ -2128,7 +2131,7 @@ class $t extends O {
|
|
|
2128
2131
|
s.set(o, i);
|
|
2129
2132
|
}
|
|
2130
2133
|
}
|
|
2131
|
-
return new
|
|
2134
|
+
return new It({
|
|
2132
2135
|
typeName: b.ZodDiscriminatedUnion,
|
|
2133
2136
|
discriminator: e,
|
|
2134
2137
|
options: t,
|
|
@@ -2137,40 +2140,40 @@ class $t extends O {
|
|
|
2137
2140
|
});
|
|
2138
2141
|
}
|
|
2139
2142
|
}
|
|
2140
|
-
function
|
|
2141
|
-
const t =
|
|
2143
|
+
function Lt(n, e) {
|
|
2144
|
+
const t = se(n), r = se(e);
|
|
2142
2145
|
if (n === e)
|
|
2143
2146
|
return { valid: !0, data: n };
|
|
2144
|
-
if (t ===
|
|
2147
|
+
if (t === g.object && r === g.object) {
|
|
2145
2148
|
const s = S.objectKeys(e), i = S.objectKeys(n).filter((o) => s.indexOf(o) !== -1), a = { ...n, ...e };
|
|
2146
2149
|
for (const o of i) {
|
|
2147
|
-
const c =
|
|
2150
|
+
const c = Lt(n[o], e[o]);
|
|
2148
2151
|
if (!c.valid)
|
|
2149
2152
|
return { valid: !1 };
|
|
2150
2153
|
a[o] = c.data;
|
|
2151
2154
|
}
|
|
2152
2155
|
return { valid: !0, data: a };
|
|
2153
|
-
} else if (t ===
|
|
2156
|
+
} else if (t === g.array && r === g.array) {
|
|
2154
2157
|
if (n.length !== e.length)
|
|
2155
2158
|
return { valid: !1 };
|
|
2156
2159
|
const s = [];
|
|
2157
2160
|
for (let i = 0; i < n.length; i++) {
|
|
2158
|
-
const a = n[i], o = e[i], c =
|
|
2161
|
+
const a = n[i], o = e[i], c = Lt(a, o);
|
|
2159
2162
|
if (!c.valid)
|
|
2160
2163
|
return { valid: !1 };
|
|
2161
2164
|
s.push(c.data);
|
|
2162
2165
|
}
|
|
2163
2166
|
return { valid: !0, data: s };
|
|
2164
|
-
} else return t ===
|
|
2167
|
+
} else return t === g.date && r === g.date && +n == +e ? { valid: !0, data: n } : { valid: !1 };
|
|
2165
2168
|
}
|
|
2166
2169
|
class Qe extends O {
|
|
2167
2170
|
_parse(e) {
|
|
2168
2171
|
const { status: t, ctx: r } = this._processInputParams(e), s = (i, a) => {
|
|
2169
|
-
if (
|
|
2172
|
+
if (Ut(i) || Ut(a))
|
|
2170
2173
|
return x;
|
|
2171
|
-
const o =
|
|
2172
|
-
return o.valid ? ((
|
|
2173
|
-
code:
|
|
2174
|
+
const o = Lt(i.value, a.value);
|
|
2175
|
+
return o.valid ? ((Dt(i) || Dt(a)) && t.dirty(), { status: t.value, value: o.data }) : (m(r, {
|
|
2176
|
+
code: f.invalid_intersection_types
|
|
2174
2177
|
}), x);
|
|
2175
2178
|
};
|
|
2176
2179
|
return r.common.async ? Promise.all([
|
|
@@ -2204,22 +2207,22 @@ Qe.create = (n, e, t) => new Qe({
|
|
|
2204
2207
|
class Q extends O {
|
|
2205
2208
|
_parse(e) {
|
|
2206
2209
|
const { status: t, ctx: r } = this._processInputParams(e);
|
|
2207
|
-
if (r.parsedType !==
|
|
2208
|
-
return
|
|
2209
|
-
code:
|
|
2210
|
-
expected:
|
|
2210
|
+
if (r.parsedType !== g.array)
|
|
2211
|
+
return m(r, {
|
|
2212
|
+
code: f.invalid_type,
|
|
2213
|
+
expected: g.array,
|
|
2211
2214
|
received: r.parsedType
|
|
2212
2215
|
}), x;
|
|
2213
2216
|
if (r.data.length < this._def.items.length)
|
|
2214
|
-
return
|
|
2215
|
-
code:
|
|
2217
|
+
return m(r, {
|
|
2218
|
+
code: f.too_small,
|
|
2216
2219
|
minimum: this._def.items.length,
|
|
2217
2220
|
inclusive: !0,
|
|
2218
2221
|
exact: !1,
|
|
2219
2222
|
type: "array"
|
|
2220
2223
|
}), x;
|
|
2221
|
-
!this._def.rest && r.data.length > this._def.items.length && (
|
|
2222
|
-
code:
|
|
2224
|
+
!this._def.rest && r.data.length > this._def.items.length && (m(r, {
|
|
2225
|
+
code: f.too_big,
|
|
2223
2226
|
maximum: this._def.items.length,
|
|
2224
2227
|
inclusive: !0,
|
|
2225
2228
|
exact: !1,
|
|
@@ -2229,7 +2232,7 @@ class Q extends O {
|
|
|
2229
2232
|
const c = this._def.items[o] || this._def.rest;
|
|
2230
2233
|
return c ? c._parse(new K(r, a, r.path, o)) : null;
|
|
2231
2234
|
}).filter((a) => !!a);
|
|
2232
|
-
return r.common.async ? Promise.all(i).then((a) =>
|
|
2235
|
+
return r.common.async ? Promise.all(i).then((a) => L.mergeArray(t, a)) : L.mergeArray(t, i);
|
|
2233
2236
|
}
|
|
2234
2237
|
get items() {
|
|
2235
2238
|
return this._def.items;
|
|
@@ -2260,10 +2263,10 @@ class et extends O {
|
|
|
2260
2263
|
}
|
|
2261
2264
|
_parse(e) {
|
|
2262
2265
|
const { status: t, ctx: r } = this._processInputParams(e);
|
|
2263
|
-
if (r.parsedType !==
|
|
2264
|
-
return
|
|
2265
|
-
code:
|
|
2266
|
-
expected:
|
|
2266
|
+
if (r.parsedType !== g.object)
|
|
2267
|
+
return m(r, {
|
|
2268
|
+
code: f.invalid_type,
|
|
2269
|
+
expected: g.object,
|
|
2267
2270
|
received: r.parsedType
|
|
2268
2271
|
}), x;
|
|
2269
2272
|
const s = [], i = this._def.keyType, a = this._def.valueType;
|
|
@@ -2273,7 +2276,7 @@ class et extends O {
|
|
|
2273
2276
|
value: a._parse(new K(r, r.data[o], r.path, o)),
|
|
2274
2277
|
alwaysSet: o in r.data
|
|
2275
2278
|
});
|
|
2276
|
-
return r.common.async ?
|
|
2279
|
+
return r.common.async ? L.mergeObjectAsync(t, s) : L.mergeObjectSync(t, s);
|
|
2277
2280
|
}
|
|
2278
2281
|
get element() {
|
|
2279
2282
|
return this._def.valueType;
|
|
@@ -2292,7 +2295,7 @@ class et extends O {
|
|
|
2292
2295
|
});
|
|
2293
2296
|
}
|
|
2294
2297
|
}
|
|
2295
|
-
class
|
|
2298
|
+
class Ot extends O {
|
|
2296
2299
|
get keySchema() {
|
|
2297
2300
|
return this._def.keyType;
|
|
2298
2301
|
}
|
|
@@ -2301,10 +2304,10 @@ class kt extends O {
|
|
|
2301
2304
|
}
|
|
2302
2305
|
_parse(e) {
|
|
2303
2306
|
const { status: t, ctx: r } = this._processInputParams(e);
|
|
2304
|
-
if (r.parsedType !==
|
|
2305
|
-
return
|
|
2306
|
-
code:
|
|
2307
|
-
expected:
|
|
2307
|
+
if (r.parsedType !== g.map)
|
|
2308
|
+
return m(r, {
|
|
2309
|
+
code: f.invalid_type,
|
|
2310
|
+
expected: g.map,
|
|
2308
2311
|
received: r.parsedType
|
|
2309
2312
|
}), x;
|
|
2310
2313
|
const s = this._def.keyType, i = this._def.valueType, a = [...r.data.entries()].map(([o, c], l) => ({
|
|
@@ -2315,26 +2318,26 @@ class kt extends O {
|
|
|
2315
2318
|
const o = /* @__PURE__ */ new Map();
|
|
2316
2319
|
return Promise.resolve().then(async () => {
|
|
2317
2320
|
for (const c of a) {
|
|
2318
|
-
const l = await c.key,
|
|
2319
|
-
if (l.status === "aborted" ||
|
|
2321
|
+
const l = await c.key, p = await c.value;
|
|
2322
|
+
if (l.status === "aborted" || p.status === "aborted")
|
|
2320
2323
|
return x;
|
|
2321
|
-
(l.status === "dirty" ||
|
|
2324
|
+
(l.status === "dirty" || p.status === "dirty") && t.dirty(), o.set(l.value, p.value);
|
|
2322
2325
|
}
|
|
2323
2326
|
return { status: t.value, value: o };
|
|
2324
2327
|
});
|
|
2325
2328
|
} else {
|
|
2326
2329
|
const o = /* @__PURE__ */ new Map();
|
|
2327
2330
|
for (const c of a) {
|
|
2328
|
-
const l = c.key,
|
|
2329
|
-
if (l.status === "aborted" ||
|
|
2331
|
+
const l = c.key, p = c.value;
|
|
2332
|
+
if (l.status === "aborted" || p.status === "aborted")
|
|
2330
2333
|
return x;
|
|
2331
|
-
(l.status === "dirty" ||
|
|
2334
|
+
(l.status === "dirty" || p.status === "dirty") && t.dirty(), o.set(l.value, p.value);
|
|
2332
2335
|
}
|
|
2333
2336
|
return { status: t.value, value: o };
|
|
2334
2337
|
}
|
|
2335
2338
|
}
|
|
2336
2339
|
}
|
|
2337
|
-
|
|
2340
|
+
Ot.create = (n, e, t) => new Ot({
|
|
2338
2341
|
valueType: e,
|
|
2339
2342
|
keyType: n,
|
|
2340
2343
|
typeName: b.ZodMap,
|
|
@@ -2343,22 +2346,22 @@ kt.create = (n, e, t) => new kt({
|
|
|
2343
2346
|
class Oe extends O {
|
|
2344
2347
|
_parse(e) {
|
|
2345
2348
|
const { status: t, ctx: r } = this._processInputParams(e);
|
|
2346
|
-
if (r.parsedType !==
|
|
2347
|
-
return
|
|
2348
|
-
code:
|
|
2349
|
-
expected:
|
|
2349
|
+
if (r.parsedType !== g.set)
|
|
2350
|
+
return m(r, {
|
|
2351
|
+
code: f.invalid_type,
|
|
2352
|
+
expected: g.set,
|
|
2350
2353
|
received: r.parsedType
|
|
2351
2354
|
}), x;
|
|
2352
2355
|
const s = this._def;
|
|
2353
|
-
s.minSize !== null && r.data.size < s.minSize.value && (
|
|
2354
|
-
code:
|
|
2356
|
+
s.minSize !== null && r.data.size < s.minSize.value && (m(r, {
|
|
2357
|
+
code: f.too_small,
|
|
2355
2358
|
minimum: s.minSize.value,
|
|
2356
2359
|
type: "set",
|
|
2357
2360
|
inclusive: !0,
|
|
2358
2361
|
exact: !1,
|
|
2359
2362
|
message: s.minSize.message
|
|
2360
|
-
}), t.dirty()), s.maxSize !== null && r.data.size > s.maxSize.value && (
|
|
2361
|
-
code:
|
|
2363
|
+
}), t.dirty()), s.maxSize !== null && r.data.size > s.maxSize.value && (m(r, {
|
|
2364
|
+
code: f.too_big,
|
|
2362
2365
|
maximum: s.maxSize.value,
|
|
2363
2366
|
type: "set",
|
|
2364
2367
|
inclusive: !0,
|
|
@@ -2368,10 +2371,10 @@ class Oe extends O {
|
|
|
2368
2371
|
const i = this._def.valueType;
|
|
2369
2372
|
function a(c) {
|
|
2370
2373
|
const l = /* @__PURE__ */ new Set();
|
|
2371
|
-
for (const
|
|
2372
|
-
if (
|
|
2374
|
+
for (const p of c) {
|
|
2375
|
+
if (p.status === "aborted")
|
|
2373
2376
|
return x;
|
|
2374
|
-
|
|
2377
|
+
p.status === "dirty" && t.dirty(), l.add(p.value);
|
|
2375
2378
|
}
|
|
2376
2379
|
return { status: t.value, value: l };
|
|
2377
2380
|
}
|
|
@@ -2404,71 +2407,71 @@ Oe.create = (n, e) => new Oe({
|
|
|
2404
2407
|
typeName: b.ZodSet,
|
|
2405
2408
|
..._(e)
|
|
2406
2409
|
});
|
|
2407
|
-
class
|
|
2410
|
+
class Ee extends O {
|
|
2408
2411
|
constructor() {
|
|
2409
2412
|
super(...arguments), this.validate = this.implement;
|
|
2410
2413
|
}
|
|
2411
2414
|
_parse(e) {
|
|
2412
2415
|
const { ctx: t } = this._processInputParams(e);
|
|
2413
|
-
if (t.parsedType !==
|
|
2414
|
-
return
|
|
2415
|
-
code:
|
|
2416
|
-
expected:
|
|
2416
|
+
if (t.parsedType !== g.function)
|
|
2417
|
+
return m(t, {
|
|
2418
|
+
code: f.invalid_type,
|
|
2419
|
+
expected: g.function,
|
|
2417
2420
|
received: t.parsedType
|
|
2418
2421
|
}), x;
|
|
2419
2422
|
function r(o, c) {
|
|
2420
|
-
return
|
|
2423
|
+
return bt({
|
|
2421
2424
|
data: o,
|
|
2422
2425
|
path: t.path,
|
|
2423
2426
|
errorMaps: [
|
|
2424
2427
|
t.common.contextualErrorMap,
|
|
2425
2428
|
t.schemaErrorMap,
|
|
2426
|
-
|
|
2427
|
-
|
|
2429
|
+
wt(),
|
|
2430
|
+
$e
|
|
2428
2431
|
].filter((l) => !!l),
|
|
2429
2432
|
issueData: {
|
|
2430
|
-
code:
|
|
2433
|
+
code: f.invalid_arguments,
|
|
2431
2434
|
argumentsError: c
|
|
2432
2435
|
}
|
|
2433
2436
|
});
|
|
2434
2437
|
}
|
|
2435
2438
|
function s(o, c) {
|
|
2436
|
-
return
|
|
2439
|
+
return bt({
|
|
2437
2440
|
data: o,
|
|
2438
2441
|
path: t.path,
|
|
2439
2442
|
errorMaps: [
|
|
2440
2443
|
t.common.contextualErrorMap,
|
|
2441
2444
|
t.schemaErrorMap,
|
|
2442
|
-
|
|
2443
|
-
|
|
2445
|
+
wt(),
|
|
2446
|
+
$e
|
|
2444
2447
|
].filter((l) => !!l),
|
|
2445
2448
|
issueData: {
|
|
2446
|
-
code:
|
|
2449
|
+
code: f.invalid_return_type,
|
|
2447
2450
|
returnTypeError: c
|
|
2448
2451
|
}
|
|
2449
2452
|
});
|
|
2450
2453
|
}
|
|
2451
2454
|
const i = { errorMap: t.common.contextualErrorMap }, a = t.data;
|
|
2452
|
-
if (this._def.returns instanceof
|
|
2455
|
+
if (this._def.returns instanceof Re) {
|
|
2453
2456
|
const o = this;
|
|
2454
|
-
return
|
|
2455
|
-
const l = new
|
|
2456
|
-
throw l.addIssue(r(c,
|
|
2457
|
-
}),
|
|
2458
|
-
return await o._def.returns._def.type.parseAsync(
|
|
2459
|
-
throw l.addIssue(s(
|
|
2457
|
+
return z(async function(...c) {
|
|
2458
|
+
const l = new W([]), p = await o._def.args.parseAsync(c, i).catch((U) => {
|
|
2459
|
+
throw l.addIssue(r(c, U)), l;
|
|
2460
|
+
}), y = await Reflect.apply(a, this, p);
|
|
2461
|
+
return await o._def.returns._def.type.parseAsync(y, i).catch((U) => {
|
|
2462
|
+
throw l.addIssue(s(y, U)), l;
|
|
2460
2463
|
});
|
|
2461
2464
|
});
|
|
2462
2465
|
} else {
|
|
2463
2466
|
const o = this;
|
|
2464
|
-
return
|
|
2467
|
+
return z(function(...c) {
|
|
2465
2468
|
const l = o._def.args.safeParse(c, i);
|
|
2466
2469
|
if (!l.success)
|
|
2467
|
-
throw new
|
|
2468
|
-
const
|
|
2469
|
-
if (!
|
|
2470
|
-
throw new
|
|
2471
|
-
return
|
|
2470
|
+
throw new W([r(c, l.error)]);
|
|
2471
|
+
const p = Reflect.apply(a, this, l.data), y = o._def.returns.safeParse(p, i);
|
|
2472
|
+
if (!y.success)
|
|
2473
|
+
throw new W([s(p, y.error)]);
|
|
2474
|
+
return y.data;
|
|
2472
2475
|
});
|
|
2473
2476
|
}
|
|
2474
2477
|
}
|
|
@@ -2479,13 +2482,13 @@ class $e extends O {
|
|
|
2479
2482
|
return this._def.returns;
|
|
2480
2483
|
}
|
|
2481
2484
|
args(...e) {
|
|
2482
|
-
return new
|
|
2485
|
+
return new Ee({
|
|
2483
2486
|
...this._def,
|
|
2484
2487
|
args: Q.create(e).rest(ve.create())
|
|
2485
2488
|
});
|
|
2486
2489
|
}
|
|
2487
2490
|
returns(e) {
|
|
2488
|
-
return new
|
|
2491
|
+
return new Ee({
|
|
2489
2492
|
...this._def,
|
|
2490
2493
|
returns: e
|
|
2491
2494
|
});
|
|
@@ -2497,7 +2500,7 @@ class $e extends O {
|
|
|
2497
2500
|
return this.parse(e);
|
|
2498
2501
|
}
|
|
2499
2502
|
static create(e, t, r) {
|
|
2500
|
-
return new
|
|
2503
|
+
return new Ee({
|
|
2501
2504
|
args: e || Q.create([]).rest(ve.create()),
|
|
2502
2505
|
returns: t || ve.create(),
|
|
2503
2506
|
typeName: b.ZodFunction,
|
|
@@ -2523,9 +2526,9 @@ class nt extends O {
|
|
|
2523
2526
|
_parse(e) {
|
|
2524
2527
|
if (e.data !== this._def.value) {
|
|
2525
2528
|
const t = this._getOrReturnCtx(e);
|
|
2526
|
-
return
|
|
2529
|
+
return m(t, {
|
|
2527
2530
|
received: t.data,
|
|
2528
|
-
code:
|
|
2531
|
+
code: f.invalid_literal,
|
|
2529
2532
|
expected: this._def.value
|
|
2530
2533
|
}), x;
|
|
2531
2534
|
}
|
|
@@ -2540,7 +2543,7 @@ nt.create = (n, e) => new nt({
|
|
|
2540
2543
|
typeName: b.ZodLiteral,
|
|
2541
2544
|
..._(e)
|
|
2542
2545
|
});
|
|
2543
|
-
function
|
|
2546
|
+
function Dn(n, e) {
|
|
2544
2547
|
return new fe({
|
|
2545
2548
|
values: n,
|
|
2546
2549
|
typeName: b.ZodEnum,
|
|
@@ -2549,26 +2552,26 @@ function Xn(n, e) {
|
|
|
2549
2552
|
}
|
|
2550
2553
|
class fe extends O {
|
|
2551
2554
|
constructor() {
|
|
2552
|
-
super(...arguments),
|
|
2555
|
+
super(...arguments), je.set(this, void 0);
|
|
2553
2556
|
}
|
|
2554
2557
|
_parse(e) {
|
|
2555
2558
|
if (typeof e.data != "string") {
|
|
2556
2559
|
const t = this._getOrReturnCtx(e), r = this._def.values;
|
|
2557
|
-
return
|
|
2560
|
+
return m(t, {
|
|
2558
2561
|
expected: S.joinValues(r),
|
|
2559
2562
|
received: t.parsedType,
|
|
2560
|
-
code:
|
|
2563
|
+
code: f.invalid_type
|
|
2561
2564
|
}), x;
|
|
2562
2565
|
}
|
|
2563
|
-
if (
|
|
2566
|
+
if (xt(this, je) || jn(this, je, new Set(this._def.values)), !xt(this, je).has(e.data)) {
|
|
2564
2567
|
const t = this._getOrReturnCtx(e), r = this._def.values;
|
|
2565
|
-
return
|
|
2568
|
+
return m(t, {
|
|
2566
2569
|
received: t.data,
|
|
2567
|
-
code:
|
|
2570
|
+
code: f.invalid_enum_value,
|
|
2568
2571
|
options: r
|
|
2569
2572
|
}), x;
|
|
2570
2573
|
}
|
|
2571
|
-
return
|
|
2574
|
+
return z(e.data);
|
|
2572
2575
|
}
|
|
2573
2576
|
get options() {
|
|
2574
2577
|
return this._def.values;
|
|
@@ -2604,62 +2607,62 @@ class fe extends O {
|
|
|
2604
2607
|
});
|
|
2605
2608
|
}
|
|
2606
2609
|
}
|
|
2607
|
-
|
|
2608
|
-
fe.create =
|
|
2610
|
+
je = /* @__PURE__ */ new WeakMap();
|
|
2611
|
+
fe.create = Dn;
|
|
2609
2612
|
class rt extends O {
|
|
2610
2613
|
constructor() {
|
|
2611
|
-
super(...arguments),
|
|
2614
|
+
super(...arguments), Ze.set(this, void 0);
|
|
2612
2615
|
}
|
|
2613
2616
|
_parse(e) {
|
|
2614
2617
|
const t = S.getValidEnumValues(this._def.values), r = this._getOrReturnCtx(e);
|
|
2615
|
-
if (r.parsedType !==
|
|
2618
|
+
if (r.parsedType !== g.string && r.parsedType !== g.number) {
|
|
2616
2619
|
const s = S.objectValues(t);
|
|
2617
|
-
return
|
|
2620
|
+
return m(r, {
|
|
2618
2621
|
expected: S.joinValues(s),
|
|
2619
2622
|
received: r.parsedType,
|
|
2620
|
-
code:
|
|
2623
|
+
code: f.invalid_type
|
|
2621
2624
|
}), x;
|
|
2622
2625
|
}
|
|
2623
|
-
if (
|
|
2626
|
+
if (xt(this, Ze) || jn(this, Ze, new Set(S.getValidEnumValues(this._def.values))), !xt(this, Ze).has(e.data)) {
|
|
2624
2627
|
const s = S.objectValues(t);
|
|
2625
|
-
return
|
|
2628
|
+
return m(r, {
|
|
2626
2629
|
received: r.data,
|
|
2627
|
-
code:
|
|
2630
|
+
code: f.invalid_enum_value,
|
|
2628
2631
|
options: s
|
|
2629
2632
|
}), x;
|
|
2630
2633
|
}
|
|
2631
|
-
return
|
|
2634
|
+
return z(e.data);
|
|
2632
2635
|
}
|
|
2633
2636
|
get enum() {
|
|
2634
2637
|
return this._def.values;
|
|
2635
2638
|
}
|
|
2636
2639
|
}
|
|
2637
|
-
|
|
2640
|
+
Ze = /* @__PURE__ */ new WeakMap();
|
|
2638
2641
|
rt.create = (n, e) => new rt({
|
|
2639
2642
|
values: n,
|
|
2640
2643
|
typeName: b.ZodNativeEnum,
|
|
2641
2644
|
..._(e)
|
|
2642
2645
|
});
|
|
2643
|
-
class
|
|
2646
|
+
class Re extends O {
|
|
2644
2647
|
unwrap() {
|
|
2645
2648
|
return this._def.type;
|
|
2646
2649
|
}
|
|
2647
2650
|
_parse(e) {
|
|
2648
2651
|
const { ctx: t } = this._processInputParams(e);
|
|
2649
|
-
if (t.parsedType !==
|
|
2650
|
-
return
|
|
2651
|
-
code:
|
|
2652
|
-
expected:
|
|
2652
|
+
if (t.parsedType !== g.promise && t.common.async === !1)
|
|
2653
|
+
return m(t, {
|
|
2654
|
+
code: f.invalid_type,
|
|
2655
|
+
expected: g.promise,
|
|
2653
2656
|
received: t.parsedType
|
|
2654
2657
|
}), x;
|
|
2655
|
-
const r = t.parsedType ===
|
|
2656
|
-
return
|
|
2658
|
+
const r = t.parsedType === g.promise ? t.data : Promise.resolve(t.data);
|
|
2659
|
+
return z(r.then((s) => this._def.type.parseAsync(s, {
|
|
2657
2660
|
path: t.path,
|
|
2658
2661
|
errorMap: t.common.contextualErrorMap
|
|
2659
2662
|
})));
|
|
2660
2663
|
}
|
|
2661
2664
|
}
|
|
2662
|
-
|
|
2665
|
+
Re.create = (n, e) => new Re({
|
|
2663
2666
|
type: n,
|
|
2664
2667
|
typeName: b.ZodPromise,
|
|
2665
2668
|
..._(e)
|
|
@@ -2674,7 +2677,7 @@ class Y extends O {
|
|
|
2674
2677
|
_parse(e) {
|
|
2675
2678
|
const { status: t, ctx: r } = this._processInputParams(e), s = this._def.effect || null, i = {
|
|
2676
2679
|
addIssue: (a) => {
|
|
2677
|
-
|
|
2680
|
+
m(r, a), a.fatal ? t.abort() : t.dirty();
|
|
2678
2681
|
},
|
|
2679
2682
|
get path() {
|
|
2680
2683
|
return r.path;
|
|
@@ -2691,7 +2694,7 @@ class Y extends O {
|
|
|
2691
2694
|
path: r.path,
|
|
2692
2695
|
parent: r
|
|
2693
2696
|
});
|
|
2694
|
-
return c.status === "aborted" ? x : c.status === "dirty" || t.value === "dirty" ?
|
|
2697
|
+
return c.status === "aborted" ? x : c.status === "dirty" || t.value === "dirty" ? ke(c.value) : c;
|
|
2695
2698
|
});
|
|
2696
2699
|
{
|
|
2697
2700
|
if (t.value === "aborted")
|
|
@@ -2701,7 +2704,7 @@ class Y extends O {
|
|
|
2701
2704
|
path: r.path,
|
|
2702
2705
|
parent: r
|
|
2703
2706
|
});
|
|
2704
|
-
return o.status === "aborted" ? x : o.status === "dirty" || t.value === "dirty" ?
|
|
2707
|
+
return o.status === "aborted" ? x : o.status === "dirty" || t.value === "dirty" ? ke(o.value) : o;
|
|
2705
2708
|
}
|
|
2706
2709
|
}
|
|
2707
2710
|
if (s.type === "refinement") {
|
|
@@ -2755,7 +2758,7 @@ Y.createWithPreprocess = (n, e, t) => new Y({
|
|
|
2755
2758
|
});
|
|
2756
2759
|
class X extends O {
|
|
2757
2760
|
_parse(e) {
|
|
2758
|
-
return this._getType(e) ===
|
|
2761
|
+
return this._getType(e) === g.undefined ? z(void 0) : this._def.innerType._parse(e);
|
|
2759
2762
|
}
|
|
2760
2763
|
unwrap() {
|
|
2761
2764
|
return this._def.innerType;
|
|
@@ -2766,15 +2769,15 @@ X.create = (n, e) => new X({
|
|
|
2766
2769
|
typeName: b.ZodOptional,
|
|
2767
2770
|
..._(e)
|
|
2768
2771
|
});
|
|
2769
|
-
class
|
|
2772
|
+
class pe extends O {
|
|
2770
2773
|
_parse(e) {
|
|
2771
|
-
return this._getType(e) ===
|
|
2774
|
+
return this._getType(e) === g.null ? z(null) : this._def.innerType._parse(e);
|
|
2772
2775
|
}
|
|
2773
2776
|
unwrap() {
|
|
2774
2777
|
return this._def.innerType;
|
|
2775
2778
|
}
|
|
2776
2779
|
}
|
|
2777
|
-
|
|
2780
|
+
pe.create = (n, e) => new pe({
|
|
2778
2781
|
innerType: n,
|
|
2779
2782
|
typeName: b.ZodNullable,
|
|
2780
2783
|
..._(e)
|
|
@@ -2783,7 +2786,7 @@ class st extends O {
|
|
|
2783
2786
|
_parse(e) {
|
|
2784
2787
|
const { ctx: t } = this._processInputParams(e);
|
|
2785
2788
|
let r = t.data;
|
|
2786
|
-
return t.parsedType ===
|
|
2789
|
+
return t.parsedType === g.undefined && (r = this._def.defaultValue()), this._def.innerType._parse({
|
|
2787
2790
|
data: r,
|
|
2788
2791
|
path: t.path,
|
|
2789
2792
|
parent: t
|
|
@@ -2818,7 +2821,7 @@ class it extends O {
|
|
|
2818
2821
|
status: "valid",
|
|
2819
2822
|
value: i.status === "valid" ? i.value : this._def.catchValue({
|
|
2820
2823
|
get error() {
|
|
2821
|
-
return new
|
|
2824
|
+
return new W(r.common.issues);
|
|
2822
2825
|
},
|
|
2823
2826
|
input: r.data
|
|
2824
2827
|
})
|
|
@@ -2826,7 +2829,7 @@ class it extends O {
|
|
|
2826
2829
|
status: "valid",
|
|
2827
2830
|
value: s.status === "valid" ? s.value : this._def.catchValue({
|
|
2828
2831
|
get error() {
|
|
2829
|
-
return new
|
|
2832
|
+
return new W(r.common.issues);
|
|
2830
2833
|
},
|
|
2831
2834
|
input: r.data
|
|
2832
2835
|
})
|
|
@@ -2842,25 +2845,25 @@ it.create = (n, e) => new it({
|
|
|
2842
2845
|
catchValue: typeof e.catch == "function" ? e.catch : () => e.catch,
|
|
2843
2846
|
..._(e)
|
|
2844
2847
|
});
|
|
2845
|
-
class
|
|
2848
|
+
class St extends O {
|
|
2846
2849
|
_parse(e) {
|
|
2847
|
-
if (this._getType(e) !==
|
|
2850
|
+
if (this._getType(e) !== g.nan) {
|
|
2848
2851
|
const r = this._getOrReturnCtx(e);
|
|
2849
|
-
return
|
|
2850
|
-
code:
|
|
2851
|
-
expected:
|
|
2852
|
+
return m(r, {
|
|
2853
|
+
code: f.invalid_type,
|
|
2854
|
+
expected: g.nan,
|
|
2852
2855
|
received: r.parsedType
|
|
2853
2856
|
}), x;
|
|
2854
2857
|
}
|
|
2855
2858
|
return { status: "valid", value: e.data };
|
|
2856
2859
|
}
|
|
2857
2860
|
}
|
|
2858
|
-
|
|
2861
|
+
St.create = (n) => new St({
|
|
2859
2862
|
typeName: b.ZodNaN,
|
|
2860
2863
|
..._(n)
|
|
2861
2864
|
});
|
|
2862
|
-
const
|
|
2863
|
-
class
|
|
2865
|
+
const os = Symbol("zod_brand");
|
|
2866
|
+
class Kt extends O {
|
|
2864
2867
|
_parse(e) {
|
|
2865
2868
|
const { ctx: t } = this._processInputParams(e), r = t.data;
|
|
2866
2869
|
return this._def.type._parse({
|
|
@@ -2873,7 +2876,7 @@ class on extends O {
|
|
|
2873
2876
|
return this._def.type;
|
|
2874
2877
|
}
|
|
2875
2878
|
}
|
|
2876
|
-
class
|
|
2879
|
+
class ct extends O {
|
|
2877
2880
|
_parse(e) {
|
|
2878
2881
|
const { status: t, ctx: r } = this._processInputParams(e);
|
|
2879
2882
|
if (r.common.async)
|
|
@@ -2883,7 +2886,7 @@ class lt extends O {
|
|
|
2883
2886
|
path: r.path,
|
|
2884
2887
|
parent: r
|
|
2885
2888
|
});
|
|
2886
|
-
return i.status === "aborted" ? x : i.status === "dirty" ? (t.dirty(),
|
|
2889
|
+
return i.status === "aborted" ? x : i.status === "dirty" ? (t.dirty(), ke(i.value)) : this._def.out._parseAsync({
|
|
2887
2890
|
data: i.value,
|
|
2888
2891
|
path: r.path,
|
|
2889
2892
|
parent: r
|
|
@@ -2906,7 +2909,7 @@ class lt extends O {
|
|
|
2906
2909
|
}
|
|
2907
2910
|
}
|
|
2908
2911
|
static create(e, t) {
|
|
2909
|
-
return new
|
|
2912
|
+
return new ct({
|
|
2910
2913
|
in: e,
|
|
2911
2914
|
out: t,
|
|
2912
2915
|
typeName: b.ZodPipeline
|
|
@@ -2927,152 +2930,165 @@ at.create = (n, e) => new at({
|
|
|
2927
2930
|
typeName: b.ZodReadonly,
|
|
2928
2931
|
..._(e)
|
|
2929
2932
|
});
|
|
2930
|
-
function
|
|
2931
|
-
|
|
2933
|
+
function yn(n, e) {
|
|
2934
|
+
const t = typeof n == "function" ? n(e) : typeof n == "string" ? { message: n } : n;
|
|
2935
|
+
return typeof t == "string" ? { message: t } : t;
|
|
2936
|
+
}
|
|
2937
|
+
function Ln(n, e = {}, t) {
|
|
2938
|
+
return n ? Ce.create().superRefine((r, s) => {
|
|
2932
2939
|
var i, a;
|
|
2933
|
-
|
|
2934
|
-
|
|
2935
|
-
|
|
2940
|
+
const o = n(r);
|
|
2941
|
+
if (o instanceof Promise)
|
|
2942
|
+
return o.then((c) => {
|
|
2943
|
+
var l, p;
|
|
2944
|
+
if (!c) {
|
|
2945
|
+
const y = yn(e, r), j = (p = (l = y.fatal) !== null && l !== void 0 ? l : t) !== null && p !== void 0 ? p : !0;
|
|
2946
|
+
s.addIssue({ code: "custom", ...y, fatal: j });
|
|
2947
|
+
}
|
|
2948
|
+
});
|
|
2949
|
+
if (!o) {
|
|
2950
|
+
const c = yn(e, r), l = (a = (i = c.fatal) !== null && i !== void 0 ? i : t) !== null && a !== void 0 ? a : !0;
|
|
2951
|
+
s.addIssue({ code: "custom", ...c, fatal: l });
|
|
2936
2952
|
}
|
|
2937
|
-
}) :
|
|
2953
|
+
}) : Ce.create();
|
|
2938
2954
|
}
|
|
2939
|
-
const
|
|
2955
|
+
const us = {
|
|
2940
2956
|
object: R.lazycreate
|
|
2941
2957
|
};
|
|
2942
2958
|
var b;
|
|
2943
2959
|
(function(n) {
|
|
2944
2960
|
n.ZodString = "ZodString", n.ZodNumber = "ZodNumber", n.ZodNaN = "ZodNaN", n.ZodBigInt = "ZodBigInt", n.ZodBoolean = "ZodBoolean", n.ZodDate = "ZodDate", n.ZodSymbol = "ZodSymbol", n.ZodUndefined = "ZodUndefined", n.ZodNull = "ZodNull", n.ZodAny = "ZodAny", n.ZodUnknown = "ZodUnknown", n.ZodNever = "ZodNever", n.ZodVoid = "ZodVoid", n.ZodArray = "ZodArray", n.ZodObject = "ZodObject", n.ZodUnion = "ZodUnion", n.ZodDiscriminatedUnion = "ZodDiscriminatedUnion", n.ZodIntersection = "ZodIntersection", n.ZodTuple = "ZodTuple", n.ZodRecord = "ZodRecord", n.ZodMap = "ZodMap", n.ZodSet = "ZodSet", n.ZodFunction = "ZodFunction", n.ZodLazy = "ZodLazy", n.ZodLiteral = "ZodLiteral", n.ZodEnum = "ZodEnum", n.ZodEffects = "ZodEffects", n.ZodNativeEnum = "ZodNativeEnum", n.ZodOptional = "ZodOptional", n.ZodNullable = "ZodNullable", n.ZodDefault = "ZodDefault", n.ZodCatch = "ZodCatch", n.ZodPromise = "ZodPromise", n.ZodBranded = "ZodBranded", n.ZodPipeline = "ZodPipeline", n.ZodReadonly = "ZodReadonly";
|
|
2945
2961
|
})(b || (b = {}));
|
|
2946
|
-
const
|
|
2962
|
+
const cs = (n, e = {
|
|
2947
2963
|
message: `Input not instance of ${n.name}`
|
|
2948
|
-
}) =>
|
|
2964
|
+
}) => Ln((t) => t instanceof n, e), Pn = q.create, zn = de.create, ls = St.create, ds = he.create, Wn = Je.create, hs = Te.create, fs = _t.create, ps = He.create, ms = Xe.create, ys = Ce.create, gs = ve.create, vs = ae.create, ws = Tt.create, bs = F.create, xs = R.create, _s = R.strictCreate, Ts = Ke.create, Os = It.create, Ss = Qe.create, Ns = Q.create, Is = et.create, ks = Ot.create, As = Oe.create, Es = Ee.create, $s = tt.create, Cs = nt.create, Rs = fe.create, Ms = rt.create, js = Re.create, gn = Y.create, Zs = X.create, Bs = pe.create, Us = Y.createWithPreprocess, Ds = ct.create, Ls = () => Pn().optional(), Ps = () => zn().optional(), zs = () => Wn().optional(), Ws = {
|
|
2949
2965
|
string: (n) => q.create({ ...n, coerce: !0 }),
|
|
2950
|
-
number: (n) =>
|
|
2966
|
+
number: (n) => de.create({ ...n, coerce: !0 }),
|
|
2951
2967
|
boolean: (n) => Je.create({
|
|
2952
2968
|
...n,
|
|
2953
2969
|
coerce: !0
|
|
2954
2970
|
}),
|
|
2955
|
-
bigint: (n) =>
|
|
2971
|
+
bigint: (n) => he.create({ ...n, coerce: !0 }),
|
|
2956
2972
|
date: (n) => Te.create({ ...n, coerce: !0 })
|
|
2957
|
-
},
|
|
2973
|
+
}, Vs = x;
|
|
2958
2974
|
var u = /* @__PURE__ */ Object.freeze({
|
|
2959
2975
|
__proto__: null,
|
|
2960
|
-
defaultErrorMap:
|
|
2961
|
-
setErrorMap:
|
|
2962
|
-
getErrorMap:
|
|
2963
|
-
makeIssue:
|
|
2964
|
-
EMPTY_PATH:
|
|
2965
|
-
addIssueToContext:
|
|
2966
|
-
ParseStatus:
|
|
2976
|
+
defaultErrorMap: $e,
|
|
2977
|
+
setErrorMap: Ur,
|
|
2978
|
+
getErrorMap: wt,
|
|
2979
|
+
makeIssue: bt,
|
|
2980
|
+
EMPTY_PATH: Dr,
|
|
2981
|
+
addIssueToContext: m,
|
|
2982
|
+
ParseStatus: L,
|
|
2967
2983
|
INVALID: x,
|
|
2968
|
-
DIRTY:
|
|
2969
|
-
OK:
|
|
2970
|
-
isAborted:
|
|
2971
|
-
isDirty:
|
|
2984
|
+
DIRTY: ke,
|
|
2985
|
+
OK: z,
|
|
2986
|
+
isAborted: Ut,
|
|
2987
|
+
isDirty: Dt,
|
|
2972
2988
|
isValid: _e,
|
|
2973
2989
|
isAsync: Ge,
|
|
2974
2990
|
get util() {
|
|
2975
2991
|
return S;
|
|
2976
2992
|
},
|
|
2977
2993
|
get objectUtil() {
|
|
2978
|
-
return
|
|
2994
|
+
return Bt;
|
|
2979
2995
|
},
|
|
2980
|
-
ZodParsedType:
|
|
2981
|
-
getParsedType:
|
|
2996
|
+
ZodParsedType: g,
|
|
2997
|
+
getParsedType: se,
|
|
2982
2998
|
ZodType: O,
|
|
2983
|
-
datetimeRegex:
|
|
2999
|
+
datetimeRegex: Un,
|
|
2984
3000
|
ZodString: q,
|
|
2985
|
-
ZodNumber:
|
|
2986
|
-
ZodBigInt:
|
|
3001
|
+
ZodNumber: de,
|
|
3002
|
+
ZodBigInt: he,
|
|
2987
3003
|
ZodBoolean: Je,
|
|
2988
3004
|
ZodDate: Te,
|
|
2989
|
-
ZodSymbol:
|
|
3005
|
+
ZodSymbol: _t,
|
|
2990
3006
|
ZodUndefined: He,
|
|
2991
3007
|
ZodNull: Xe,
|
|
2992
|
-
ZodAny:
|
|
3008
|
+
ZodAny: Ce,
|
|
2993
3009
|
ZodUnknown: ve,
|
|
2994
|
-
ZodNever:
|
|
2995
|
-
ZodVoid:
|
|
3010
|
+
ZodNever: ae,
|
|
3011
|
+
ZodVoid: Tt,
|
|
2996
3012
|
ZodArray: F,
|
|
2997
3013
|
ZodObject: R,
|
|
2998
3014
|
ZodUnion: Ke,
|
|
2999
|
-
ZodDiscriminatedUnion:
|
|
3015
|
+
ZodDiscriminatedUnion: It,
|
|
3000
3016
|
ZodIntersection: Qe,
|
|
3001
3017
|
ZodTuple: Q,
|
|
3002
3018
|
ZodRecord: et,
|
|
3003
|
-
ZodMap:
|
|
3019
|
+
ZodMap: Ot,
|
|
3004
3020
|
ZodSet: Oe,
|
|
3005
|
-
ZodFunction:
|
|
3021
|
+
ZodFunction: Ee,
|
|
3006
3022
|
ZodLazy: tt,
|
|
3007
3023
|
ZodLiteral: nt,
|
|
3008
3024
|
ZodEnum: fe,
|
|
3009
3025
|
ZodNativeEnum: rt,
|
|
3010
|
-
ZodPromise:
|
|
3026
|
+
ZodPromise: Re,
|
|
3011
3027
|
ZodEffects: Y,
|
|
3012
3028
|
ZodTransformer: Y,
|
|
3013
3029
|
ZodOptional: X,
|
|
3014
|
-
ZodNullable:
|
|
3030
|
+
ZodNullable: pe,
|
|
3015
3031
|
ZodDefault: st,
|
|
3016
3032
|
ZodCatch: it,
|
|
3017
|
-
ZodNaN:
|
|
3018
|
-
BRAND:
|
|
3019
|
-
ZodBranded:
|
|
3020
|
-
ZodPipeline:
|
|
3033
|
+
ZodNaN: St,
|
|
3034
|
+
BRAND: os,
|
|
3035
|
+
ZodBranded: Kt,
|
|
3036
|
+
ZodPipeline: ct,
|
|
3021
3037
|
ZodReadonly: at,
|
|
3022
|
-
custom:
|
|
3038
|
+
custom: Ln,
|
|
3023
3039
|
Schema: O,
|
|
3024
3040
|
ZodSchema: O,
|
|
3025
|
-
late:
|
|
3041
|
+
late: us,
|
|
3026
3042
|
get ZodFirstPartyTypeKind() {
|
|
3027
3043
|
return b;
|
|
3028
3044
|
},
|
|
3029
|
-
coerce:
|
|
3030
|
-
any:
|
|
3031
|
-
array:
|
|
3032
|
-
bigint:
|
|
3033
|
-
boolean:
|
|
3034
|
-
date:
|
|
3035
|
-
discriminatedUnion:
|
|
3036
|
-
effect:
|
|
3037
|
-
enum:
|
|
3038
|
-
function:
|
|
3039
|
-
instanceof:
|
|
3040
|
-
intersection:
|
|
3041
|
-
lazy:
|
|
3042
|
-
literal:
|
|
3043
|
-
map:
|
|
3044
|
-
nan:
|
|
3045
|
-
nativeEnum:
|
|
3046
|
-
never:
|
|
3047
|
-
null:
|
|
3048
|
-
nullable:
|
|
3049
|
-
number:
|
|
3050
|
-
object:
|
|
3051
|
-
oboolean:
|
|
3052
|
-
onumber:
|
|
3053
|
-
optional:
|
|
3054
|
-
ostring:
|
|
3055
|
-
pipeline:
|
|
3056
|
-
preprocess:
|
|
3057
|
-
promise:
|
|
3058
|
-
record:
|
|
3059
|
-
set:
|
|
3060
|
-
strictObject:
|
|
3061
|
-
string:
|
|
3062
|
-
symbol:
|
|
3063
|
-
transformer:
|
|
3064
|
-
tuple:
|
|
3065
|
-
undefined:
|
|
3066
|
-
union:
|
|
3067
|
-
unknown:
|
|
3068
|
-
void:
|
|
3069
|
-
NEVER:
|
|
3070
|
-
ZodIssueCode:
|
|
3071
|
-
quotelessJson:
|
|
3072
|
-
ZodError:
|
|
3045
|
+
coerce: Ws,
|
|
3046
|
+
any: ys,
|
|
3047
|
+
array: bs,
|
|
3048
|
+
bigint: ds,
|
|
3049
|
+
boolean: Wn,
|
|
3050
|
+
date: hs,
|
|
3051
|
+
discriminatedUnion: Os,
|
|
3052
|
+
effect: gn,
|
|
3053
|
+
enum: Rs,
|
|
3054
|
+
function: Es,
|
|
3055
|
+
instanceof: cs,
|
|
3056
|
+
intersection: Ss,
|
|
3057
|
+
lazy: $s,
|
|
3058
|
+
literal: Cs,
|
|
3059
|
+
map: ks,
|
|
3060
|
+
nan: ls,
|
|
3061
|
+
nativeEnum: Ms,
|
|
3062
|
+
never: vs,
|
|
3063
|
+
null: ms,
|
|
3064
|
+
nullable: Bs,
|
|
3065
|
+
number: zn,
|
|
3066
|
+
object: xs,
|
|
3067
|
+
oboolean: zs,
|
|
3068
|
+
onumber: Ps,
|
|
3069
|
+
optional: Zs,
|
|
3070
|
+
ostring: Ls,
|
|
3071
|
+
pipeline: Ds,
|
|
3072
|
+
preprocess: Us,
|
|
3073
|
+
promise: js,
|
|
3074
|
+
record: Is,
|
|
3075
|
+
set: As,
|
|
3076
|
+
strictObject: _s,
|
|
3077
|
+
string: Pn,
|
|
3078
|
+
symbol: fs,
|
|
3079
|
+
transformer: gn,
|
|
3080
|
+
tuple: Ns,
|
|
3081
|
+
undefined: ps,
|
|
3082
|
+
union: Ts,
|
|
3083
|
+
unknown: gs,
|
|
3084
|
+
void: ws,
|
|
3085
|
+
NEVER: Vs,
|
|
3086
|
+
ZodIssueCode: f,
|
|
3087
|
+
quotelessJson: Br,
|
|
3088
|
+
ZodError: W
|
|
3073
3089
|
});
|
|
3074
|
-
const
|
|
3075
|
-
const t =
|
|
3090
|
+
const qs = (n) => n != null && typeof n == "object" && "toString" in n, Fs = (n, e = !1) => {
|
|
3091
|
+
const t = qs(n) ? "stringer" : typeof n;
|
|
3076
3092
|
let r;
|
|
3077
3093
|
switch (t) {
|
|
3078
3094
|
case "string":
|
|
@@ -3096,242 +3112,174 @@ const ni = (n) => n != null && typeof n == "object" && "toString" in n, ri = (n,
|
|
|
3096
3112
|
default:
|
|
3097
3113
|
return console.warn(`sortFunc: unknown type ${t}`), () => -1;
|
|
3098
3114
|
}
|
|
3099
|
-
return e ?
|
|
3100
|
-
},
|
|
3115
|
+
return e ? Ys(r) : r;
|
|
3116
|
+
}, Ys = (n) => (e, t) => n(t, e), kt = u.tuple([u.number(), u.number()]);
|
|
3101
3117
|
u.tuple([u.bigint(), u.bigint()]);
|
|
3102
|
-
const
|
|
3118
|
+
const Qt = u.object({ width: u.number(), height: u.number() }), Gs = u.object({
|
|
3103
3119
|
signedWidth: u.number(),
|
|
3104
3120
|
signedHeight: u.number()
|
|
3105
|
-
}),
|
|
3106
|
-
u.enum(
|
|
3107
|
-
const
|
|
3108
|
-
u.enum(
|
|
3109
|
-
const ot = u.object({ x: u.number(), y: u.number() }),
|
|
3110
|
-
u.enum(
|
|
3111
|
-
const
|
|
3112
|
-
u.enum(
|
|
3113
|
-
const
|
|
3114
|
-
u.
|
|
3115
|
-
u.
|
|
3116
|
-
u.union([
|
|
3117
|
-
|
|
3121
|
+
}), Js = ["width", "height"];
|
|
3122
|
+
u.enum(Js);
|
|
3123
|
+
const Hs = ["start", "center", "end"], Xs = ["signedWidth", "signedHeight"];
|
|
3124
|
+
u.enum(Xs);
|
|
3125
|
+
const ot = u.object({ x: u.number(), y: u.number() }), Vn = u.object({ clientX: u.number(), clientY: u.number() }), qn = ["x", "y"], Fn = u.enum(qn), Yn = ["top", "right", "bottom", "left"];
|
|
3126
|
+
u.enum(Yn);
|
|
3127
|
+
const en = ["left", "right"], Gn = u.enum(en), tn = ["top", "bottom"], Jn = u.enum(tn), Hn = ["center"], vn = u.enum(Hn), Ks = [...Yn, ...Hn], Xn = u.enum(Ks);
|
|
3128
|
+
u.enum(Hs);
|
|
3129
|
+
const Qs = ["first", "last"];
|
|
3130
|
+
u.enum(Qs);
|
|
3131
|
+
const ei = u.object({ lower: u.number(), upper: u.number() }), ti = u.object({ lower: u.bigint(), upper: u.bigint() });
|
|
3132
|
+
u.union([ei, kt]);
|
|
3133
|
+
u.union([ti, kt]);
|
|
3134
|
+
u.enum([...Fn.options, ...Xn.options]);
|
|
3135
|
+
u.union([Fn, Xn, u.instanceof(String)]);
|
|
3136
|
+
const ni = (n) => typeof n == "bigint" || n instanceof BigInt, Ne = (n, e) => ni(n) ? n.valueOf() * BigInt(e.valueOf()) : n.valueOf() * Number(e.valueOf()), we = (n, e) => {
|
|
3118
3137
|
const t = {};
|
|
3119
3138
|
if (typeof n == "number" || typeof n == "bigint")
|
|
3120
3139
|
e != null ? (t.lower = n, t.upper = e) : (t.lower = typeof n == "bigint" ? 0n : 0, t.upper = n);
|
|
3121
3140
|
else if (Array.isArray(n)) {
|
|
3122
3141
|
if (n.length !== 2) throw new Error("bounds: expected array of length 2");
|
|
3123
3142
|
[t.lower, t.upper] = n;
|
|
3124
|
-
} else return
|
|
3125
|
-
return
|
|
3126
|
-
},
|
|
3143
|
+
} else return wn(n);
|
|
3144
|
+
return wn(t);
|
|
3145
|
+
}, wn = (n) => n.lower > n.upper ? { lower: n.upper, upper: n.lower } : n, bn = (n, e) => {
|
|
3127
3146
|
const t = we(n);
|
|
3128
3147
|
return e < t.lower ? t.lower : e >= t.upper ? t.upper - (typeof t.upper == "number" ? 1 : 1n) : e;
|
|
3129
|
-
},
|
|
3130
|
-
|
|
3131
|
-
|
|
3132
|
-
|
|
3133
|
-
|
|
3134
|
-
|
|
3135
|
-
}, bi = {
|
|
3136
|
-
top: "left",
|
|
3137
|
-
right: "top",
|
|
3138
|
-
bottom: "right",
|
|
3139
|
-
left: "bottom",
|
|
3140
|
-
center: "center"
|
|
3141
|
-
}, xi = pi, pe = (n) => n instanceof String || !cn.includes(n) ? n : n === "x" ? "left" : "top", _i = (n) => wi[pe(n)], Ti = (n) => bi[pe(n)], ut = (n) => {
|
|
3142
|
-
const e = pe(n);
|
|
3143
|
-
return e === "top" || e === "bottom" ? "y" : "x";
|
|
3144
|
-
}, Oi = u.object({
|
|
3145
|
-
x: ln.or(Gt),
|
|
3146
|
-
y: dn.or(Gt)
|
|
3147
|
-
}), ir = u.object({ x: ln, y: dn }), dt = Object.freeze({ x: "left", y: "top" }), mn = Object.freeze({ x: "right", y: "top" }), jt = Object.freeze({ x: "left", y: "bottom" }), yn = Object.freeze({ x: "right", y: "bottom" }), gn = Object.freeze({ x: "center", y: "center" }), ar = Object.freeze({ x: "center", y: "top" }), or = Object.freeze({ x: "center", y: "bottom" }), ur = Object.freeze({ x: "right", y: "center" }), cr = Object.freeze({ x: "left", y: "center" }), Si = Object.freeze([
|
|
3148
|
-
cr,
|
|
3149
|
-
ur,
|
|
3150
|
-
ar,
|
|
3151
|
-
or,
|
|
3152
|
-
dt,
|
|
3153
|
-
mn,
|
|
3154
|
-
jt,
|
|
3155
|
-
yn,
|
|
3156
|
-
gn
|
|
3157
|
-
]), vn = (n, e) => n.x === e.x && n.y === e.y, Ni = (n, e) => {
|
|
3158
|
-
if (typeof e == "object") {
|
|
3159
|
-
let t = !0;
|
|
3160
|
-
return "x" in e && (n.x === e.x || (t = !1)), "y" in e && (n.y === e.y || (t = !1)), t;
|
|
3161
|
-
}
|
|
3162
|
-
return n.x === e || n.y === e;
|
|
3163
|
-
}, lr = (n) => [n.x, n.y], gt = (n) => ut(pe(n)) === "x", Ii = (n) => ut(pe(n)) === "y", ki = (n) => `${n.x}${Pr(n.y)}`, Ai = (n, e) => {
|
|
3164
|
-
let t, r;
|
|
3165
|
-
if (typeof n == "object" && "x" in n ? (t = n.x, r = n.y) : (t = pe(n), r = pe(e ?? n)), ut(t) === ut(r) && t !== "center" && r !== "center")
|
|
3166
|
-
throw new Error(
|
|
3167
|
-
`[XYLocation] - encountered two locations with the same direction: ${t.toString()} - ${r.toString()}`
|
|
3168
|
-
);
|
|
3169
|
-
const s = { ...gn };
|
|
3170
|
-
return t === "center" ? gt(r) ? [s.x, s.y] = [r, t] : [s.x, s.y] = [t, r] : r === "center" ? gt(t) ? [s.x, s.y] = [t, r] : [s.x, s.y] = [r, t] : gt(t) ? [s.x, s.y] = [t, r] : [s.x, s.y] = [r, t], s;
|
|
3171
|
-
}, Ei = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
3172
|
-
__proto__: null,
|
|
3173
|
-
BOTTOM_CENTER: or,
|
|
3174
|
-
BOTTOM_LEFT: jt,
|
|
3175
|
-
BOTTOM_RIGHT: yn,
|
|
3176
|
-
CENTER: gn,
|
|
3177
|
-
CENTER_LOCATIONS: fn,
|
|
3178
|
-
LEFT_CENTER: cr,
|
|
3179
|
-
RIGHT_CENTER: ur,
|
|
3180
|
-
TOP_CENTER: ar,
|
|
3181
|
-
TOP_LEFT: dt,
|
|
3182
|
-
TOP_RIGHT: mn,
|
|
3183
|
-
XY_LOCATIONS: Si,
|
|
3184
|
-
X_LOCATIONS: Rt,
|
|
3185
|
-
Y_LOCATIONS: Mt,
|
|
3186
|
-
center: vi,
|
|
3187
|
-
construct: pe,
|
|
3188
|
-
constructXY: Ai,
|
|
3189
|
-
corner: ir,
|
|
3190
|
-
crude: xi,
|
|
3191
|
-
direction: ut,
|
|
3192
|
-
isX: gt,
|
|
3193
|
-
isY: Ii,
|
|
3194
|
-
location: hn,
|
|
3195
|
-
outer: ci,
|
|
3196
|
-
rotate90: Ti,
|
|
3197
|
-
swap: _i,
|
|
3198
|
-
x: yi,
|
|
3199
|
-
xy: Oi,
|
|
3200
|
-
xyCouple: lr,
|
|
3201
|
-
xyEquals: vn,
|
|
3202
|
-
xyMatches: Ni,
|
|
3203
|
-
xyToString: ki,
|
|
3204
|
-
y: gi
|
|
3205
|
-
}, Symbol.toStringTag, { value: "Module" })), Jt = u.union([
|
|
3148
|
+
}, nn = (n) => qn.includes(n) ? n : tn.includes(n) ? "y" : "x";
|
|
3149
|
+
u.object({
|
|
3150
|
+
x: Gn.or(vn),
|
|
3151
|
+
y: Jn.or(vn)
|
|
3152
|
+
});
|
|
3153
|
+
const ri = u.object({ x: Gn, y: Jn }), rn = Object.freeze({ x: "left", y: "top" }), si = Object.freeze({ x: "right", y: "top" }), Kn = Object.freeze({ x: "left", y: "bottom" }), ii = Object.freeze({ x: "right", y: "bottom" }), Qn = (n, e) => n.x === e.x && n.y === e.y, ai = (n) => [n.x, n.y], Pt = u.union([
|
|
3206
3154
|
u.number(),
|
|
3207
3155
|
ot,
|
|
3208
|
-
|
|
3209
|
-
|
|
3210
|
-
|
|
3211
|
-
|
|
3156
|
+
kt,
|
|
3157
|
+
Qt,
|
|
3158
|
+
Gs,
|
|
3159
|
+
Vn
|
|
3212
3160
|
]), C = (n, e) => {
|
|
3213
3161
|
if (typeof n == "string") {
|
|
3214
3162
|
if (e === void 0) throw new Error("The y coordinate must be given.");
|
|
3215
3163
|
return n === "x" ? { x: e, y: 0 } : { x: 0, y: e };
|
|
3216
3164
|
}
|
|
3217
3165
|
return typeof n == "number" ? { x: n, y: e ?? n } : Array.isArray(n) ? { x: n[0], y: n[1] } : "signedWidth" in n ? { x: n.signedWidth, y: n.signedHeight } : "clientX" in n ? { x: n.clientX, y: n.clientY } : "width" in n ? { x: n.width, y: n.height } : { x: n.x, y: n.y };
|
|
3218
|
-
}, ee = Object.freeze({ x: 0, y: 0 }),
|
|
3166
|
+
}, ee = Object.freeze({ x: 0, y: 0 }), er = Object.freeze({ x: 1, y: 1 }), oi = Object.freeze({ x: 1 / 0, y: 1 / 0 }), ui = Object.freeze({ x: NaN, y: NaN }), Nt = (n, e, t = 0) => {
|
|
3219
3167
|
const r = C(n), s = C(e);
|
|
3220
3168
|
return t === 0 ? r.x === s.x && r.y === s.y : Math.abs(r.x - s.x) <= t && Math.abs(r.y - s.y) <= t;
|
|
3221
|
-
},
|
|
3169
|
+
}, ci = (n) => Nt(n, ee), sn = (n, e, t) => {
|
|
3222
3170
|
const r = C(n), s = C(e, t);
|
|
3223
3171
|
return { x: r.x * s.x, y: r.y * s.y };
|
|
3224
|
-
},
|
|
3172
|
+
}, tr = (n, e) => {
|
|
3225
3173
|
const t = C(n);
|
|
3226
3174
|
return { x: t.x + e, y: t.y };
|
|
3227
|
-
},
|
|
3175
|
+
}, nr = (n, e) => {
|
|
3228
3176
|
const t = C(n);
|
|
3229
3177
|
return { x: t.x, y: t.y + e };
|
|
3230
|
-
},
|
|
3178
|
+
}, ut = (n, e, t, ...r) => typeof e == "string" && typeof t == "number" ? e === "x" ? tr(n, t) : nr(n, t) : [n, e, t ?? ee, ...r].reduce((s, i) => {
|
|
3231
3179
|
const a = C(i);
|
|
3232
3180
|
return { x: s.x + a.x, y: s.y + a.y };
|
|
3233
|
-
}, ee),
|
|
3181
|
+
}, ee), li = (n, e, t) => {
|
|
3234
3182
|
const r = C(n);
|
|
3235
3183
|
return e === "x" ? { x: t, y: r.y } : { x: r.x, y: t };
|
|
3236
|
-
},
|
|
3184
|
+
}, di = (n, e) => {
|
|
3237
3185
|
const t = C(n), r = C(e);
|
|
3238
3186
|
return Math.sqrt((t.x - r.x) ** 2 + (t.y - r.y) ** 2);
|
|
3239
|
-
},
|
|
3187
|
+
}, hi = (n, e) => {
|
|
3240
3188
|
const t = C(n), r = C(e);
|
|
3241
3189
|
return { x: r.x - t.x, y: r.y - t.y };
|
|
3242
|
-
},
|
|
3190
|
+
}, fi = (n) => {
|
|
3243
3191
|
const e = C(n);
|
|
3244
3192
|
return Number.isNaN(e.x) || Number.isNaN(e.y);
|
|
3245
|
-
},
|
|
3193
|
+
}, pi = (n) => {
|
|
3246
3194
|
const e = C(n);
|
|
3247
3195
|
return Number.isFinite(e.x) && Number.isFinite(e.y);
|
|
3248
|
-
},
|
|
3196
|
+
}, mi = (n) => {
|
|
3249
3197
|
const e = C(n);
|
|
3250
3198
|
return [e.x, e.y];
|
|
3251
|
-
},
|
|
3199
|
+
}, yi = (n) => {
|
|
3252
3200
|
const e = C(n);
|
|
3253
3201
|
return { left: e.x, top: e.y };
|
|
3254
|
-
},
|
|
3202
|
+
}, zt = (n, e = 0) => {
|
|
3255
3203
|
const t = C(n);
|
|
3256
3204
|
return { x: Number(t.x.toFixed(e)), y: Number(t.y.toFixed(e)) };
|
|
3257
|
-
},
|
|
3205
|
+
}, Be = (n, e) => {
|
|
3258
3206
|
const t = C(n), r = C(e);
|
|
3259
3207
|
return { x: t.x - r.x, y: t.y - r.y };
|
|
3260
3208
|
}, Ue = (n) => {
|
|
3261
3209
|
const e = C(n), t = Math.hypot(e.x, e.y);
|
|
3262
3210
|
return t === 0 ? { x: 0, y: 0 } : { x: -e.y / t, y: e.x / t };
|
|
3263
|
-
},
|
|
3211
|
+
}, rr = (n) => {
|
|
3264
3212
|
const e = C(n), t = Math.hypot(e.x, e.y);
|
|
3265
3213
|
return t === 0 ? { x: 0, y: 0 } : { x: e.x / t, y: e.y / t };
|
|
3266
|
-
},
|
|
3267
|
-
const e = n.reduce((t, r) =>
|
|
3268
|
-
return
|
|
3269
|
-
},
|
|
3214
|
+
}, sr = (...n) => {
|
|
3215
|
+
const e = n.reduce((t, r) => ut(t, r), ee);
|
|
3216
|
+
return sn(e, 1 / n.length);
|
|
3217
|
+
}, gi = (n, e) => {
|
|
3270
3218
|
const t = [];
|
|
3271
3219
|
for (let r = 0; r < n.length; r++) {
|
|
3272
3220
|
const s = n[r];
|
|
3273
3221
|
let i, a, o, c;
|
|
3274
3222
|
if (r === 0) {
|
|
3275
|
-
const l = n[r + 1],
|
|
3276
|
-
a = Ue(
|
|
3223
|
+
const l = n[r + 1], p = Be(l, s);
|
|
3224
|
+
a = Ue(p), o = a, c = e;
|
|
3277
3225
|
} else if (r === n.length - 1) {
|
|
3278
|
-
const l = n[r - 1],
|
|
3279
|
-
i = Ue(
|
|
3226
|
+
const l = n[r - 1], p = Be(s, l);
|
|
3227
|
+
i = Ue(p), o = i, c = e;
|
|
3280
3228
|
} else {
|
|
3281
|
-
const l = n[r - 1],
|
|
3282
|
-
i = Ue(
|
|
3283
|
-
const
|
|
3284
|
-
(
|
|
3285
|
-
),
|
|
3286
|
-
|
|
3229
|
+
const l = n[r - 1], p = n[r + 1], y = Be(s, l), j = Be(p, s);
|
|
3230
|
+
i = Ue(y), a = Ue(j);
|
|
3231
|
+
const U = Math.acos(
|
|
3232
|
+
(y.x * j.x + y.y * j.y) / (Math.hypot(y.x, y.y) * Math.hypot(j.x, j.y))
|
|
3233
|
+
), Me = Math.sin(U / 2);
|
|
3234
|
+
Me === 0 ? c = e : c = e / Me, o = rr(sr(i, a));
|
|
3287
3235
|
}
|
|
3288
|
-
t.push(
|
|
3236
|
+
t.push(sn(o, c));
|
|
3289
3237
|
}
|
|
3290
3238
|
return t;
|
|
3291
|
-
},
|
|
3239
|
+
}, Wt = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
3292
3240
|
__proto__: null,
|
|
3293
|
-
INFINITY:
|
|
3294
|
-
NAN:
|
|
3295
|
-
ONE:
|
|
3241
|
+
INFINITY: oi,
|
|
3242
|
+
NAN: ui,
|
|
3243
|
+
ONE: er,
|
|
3296
3244
|
ZERO: ee,
|
|
3297
|
-
average:
|
|
3298
|
-
calculateMiters:
|
|
3299
|
-
clientXY:
|
|
3245
|
+
average: sr,
|
|
3246
|
+
calculateMiters: gi,
|
|
3247
|
+
clientXY: Vn,
|
|
3300
3248
|
construct: C,
|
|
3301
|
-
couple:
|
|
3302
|
-
crudeZ:
|
|
3303
|
-
css:
|
|
3304
|
-
distance:
|
|
3305
|
-
equals:
|
|
3306
|
-
isFinite:
|
|
3307
|
-
isNan:
|
|
3308
|
-
isZero:
|
|
3249
|
+
couple: mi,
|
|
3250
|
+
crudeZ: Pt,
|
|
3251
|
+
css: yi,
|
|
3252
|
+
distance: di,
|
|
3253
|
+
equals: Nt,
|
|
3254
|
+
isFinite: pi,
|
|
3255
|
+
isNan: fi,
|
|
3256
|
+
isZero: ci,
|
|
3309
3257
|
normal: Ue,
|
|
3310
|
-
normalize:
|
|
3311
|
-
scale:
|
|
3312
|
-
set:
|
|
3313
|
-
sub:
|
|
3314
|
-
translate:
|
|
3315
|
-
translateX:
|
|
3316
|
-
translateY:
|
|
3317
|
-
translation:
|
|
3318
|
-
truncate:
|
|
3258
|
+
normalize: rr,
|
|
3259
|
+
scale: sn,
|
|
3260
|
+
set: li,
|
|
3261
|
+
sub: Be,
|
|
3262
|
+
translate: ut,
|
|
3263
|
+
translateX: tr,
|
|
3264
|
+
translateY: nr,
|
|
3265
|
+
translation: hi,
|
|
3266
|
+
truncate: zt,
|
|
3319
3267
|
xy: ot
|
|
3320
|
-
}, Symbol.toStringTag, { value: "Module" })),
|
|
3321
|
-
top:
|
|
3322
|
-
left:
|
|
3323
|
-
width:
|
|
3324
|
-
height:
|
|
3325
|
-
}),
|
|
3268
|
+
}, Symbol.toStringTag, { value: "Module" })), ht = u.union([u.number(), u.string()]), vi = u.object({
|
|
3269
|
+
top: ht,
|
|
3270
|
+
left: ht,
|
|
3271
|
+
width: ht,
|
|
3272
|
+
height: ht
|
|
3273
|
+
}), wi = u.object({
|
|
3326
3274
|
left: u.number(),
|
|
3327
3275
|
top: u.number(),
|
|
3328
3276
|
right: u.number(),
|
|
3329
3277
|
bottom: u.number()
|
|
3330
|
-
}),
|
|
3278
|
+
}), bi = u.object({
|
|
3331
3279
|
one: ot,
|
|
3332
3280
|
two: ot,
|
|
3333
|
-
root:
|
|
3334
|
-
}),
|
|
3281
|
+
root: ri
|
|
3282
|
+
}), ir = { one: ee, two: ee, root: rn }, xi = { one: ee, two: er, root: Kn }, ar = (n, e) => ({
|
|
3335
3283
|
one: n.one,
|
|
3336
3284
|
two: n.two,
|
|
3337
3285
|
root: e ?? n.root
|
|
@@ -3339,7 +3287,7 @@ const pi = u.union([rr, hn, u.instanceof(String)]), mi = (n) => typeof n == "big
|
|
|
3339
3287
|
const i = {
|
|
3340
3288
|
one: { ...ee },
|
|
3341
3289
|
two: { ...ee },
|
|
3342
|
-
root: s ??
|
|
3290
|
+
root: s ?? rn
|
|
3343
3291
|
};
|
|
3344
3292
|
if (typeof n == "number") {
|
|
3345
3293
|
if (typeof e != "number")
|
|
@@ -3353,11 +3301,11 @@ const pi = u.union([rr, hn, u.instanceof(String)]), mi = (n) => typeof n == "big
|
|
|
3353
3301
|
x: i.one.x + e.signedWidth,
|
|
3354
3302
|
y: i.one.y + e.signedHeight
|
|
3355
3303
|
} : i.two = e, i));
|
|
3356
|
-
},
|
|
3304
|
+
}, _i = (n, e, t) => {
|
|
3357
3305
|
const r = $(n);
|
|
3358
3306
|
if (typeof e == "string") {
|
|
3359
3307
|
if (t == null) throw new Error("Invalid arguments for resize");
|
|
3360
|
-
const s =
|
|
3308
|
+
const s = nn(e);
|
|
3361
3309
|
return $(
|
|
3362
3310
|
r.one,
|
|
3363
3311
|
void 0,
|
|
@@ -3367,203 +3315,203 @@ const pi = u.union([rr, hn, u.instanceof(String)]), mi = (n) => typeof n == "big
|
|
|
3367
3315
|
);
|
|
3368
3316
|
}
|
|
3369
3317
|
return $(r.one, e, void 0, void 0, r.root);
|
|
3370
|
-
},
|
|
3318
|
+
}, Ti = (n, e, t = !0) => {
|
|
3371
3319
|
const r = $(n);
|
|
3372
3320
|
let s = (i, a) => i < a;
|
|
3373
|
-
return t && (s = (i, a) => i <= a), "one" in e ? s(
|
|
3374
|
-
},
|
|
3321
|
+
return t && (s = (i, a) => i <= a), "one" in e ? s(ce(r), ce(e)) && s(be(e), be(r)) && s(le(r), le(e)) && s(xe(e), xe(r)) : s(ce(r), e.x) && s(e.x, be(r)) && s(le(r), e.y) && s(e.y, xe(r));
|
|
3322
|
+
}, Oi = (n, e) => Nt(n.one, e.one) && Nt(n.two, e.two) && Qn(n.root, e.root), or = (n) => ({
|
|
3375
3323
|
width: me(n),
|
|
3376
3324
|
height: ye(n)
|
|
3377
|
-
}),
|
|
3378
|
-
signedWidth:
|
|
3379
|
-
signedHeight:
|
|
3380
|
-
}),
|
|
3381
|
-
top:
|
|
3382
|
-
left:
|
|
3325
|
+
}), Si = (n) => ({
|
|
3326
|
+
signedWidth: At(n),
|
|
3327
|
+
signedHeight: Et(n)
|
|
3328
|
+
}), Ni = (n) => ({
|
|
3329
|
+
top: le(n),
|
|
3330
|
+
left: ce(n),
|
|
3383
3331
|
width: me(n),
|
|
3384
3332
|
height: ye(n)
|
|
3385
|
-
}),
|
|
3386
|
-
const r =
|
|
3333
|
+
}), an = (n, e, t = !1) => {
|
|
3334
|
+
const r = nn(e) === "y" ? Et(n) : At(n);
|
|
3387
3335
|
return t ? r : Math.abs(r);
|
|
3388
|
-
},
|
|
3336
|
+
}, lt = (n, e) => {
|
|
3389
3337
|
const t = $(n);
|
|
3390
3338
|
return {
|
|
3391
|
-
x: e.x === "center" ?
|
|
3392
|
-
y: e.y === "center" ?
|
|
3339
|
+
x: e.x === "center" ? Vt(t).x : Se(t, e.x),
|
|
3340
|
+
y: e.y === "center" ? Vt(t).y : Se(t, e.y)
|
|
3393
3341
|
};
|
|
3394
3342
|
}, Se = (n, e) => {
|
|
3395
|
-
const t = $(n), r =
|
|
3396
|
-
return
|
|
3397
|
-
},
|
|
3343
|
+
const t = $(n), r = ai(t.root).includes(e) ? Math.min : Math.max;
|
|
3344
|
+
return en.includes(e) ? r(t.one.x, t.two.x) : r(t.one.y, t.two.y);
|
|
3345
|
+
}, Ii = (n) => n.one.x === n.two.x && n.one.y === n.two.y, me = (n) => an(n, "x"), ye = (n) => an(n, "y"), At = (n) => {
|
|
3398
3346
|
const e = $(n);
|
|
3399
3347
|
return e.two.x - e.one.x;
|
|
3400
|
-
},
|
|
3348
|
+
}, Et = (n) => {
|
|
3401
3349
|
const e = $(n);
|
|
3402
3350
|
return e.two.y - e.one.y;
|
|
3403
|
-
},
|
|
3404
|
-
x:
|
|
3405
|
-
y:
|
|
3406
|
-
}),
|
|
3351
|
+
}, ur = (n) => lt(n, rn), ki = (n) => lt(n, si), Ai = (n) => lt(n, Kn), Ei = (n) => lt(n, ii), be = (n) => Se(n, "right"), xe = (n) => Se(n, "bottom"), ce = (n) => Se(n, "left"), le = (n) => Se(n, "top"), Vt = (n) => ut(ur(n), {
|
|
3352
|
+
x: At(n) / 2,
|
|
3353
|
+
y: Et(n) / 2
|
|
3354
|
+
}), on = (n) => {
|
|
3407
3355
|
const e = $(n);
|
|
3408
|
-
return e.root.x === "left" ?
|
|
3409
|
-
},
|
|
3356
|
+
return e.root.x === "left" ? ce(e) : be(e);
|
|
3357
|
+
}, un = (n) => {
|
|
3410
3358
|
const e = $(n);
|
|
3411
|
-
return e.root.y === "top" ?
|
|
3412
|
-
},
|
|
3359
|
+
return e.root.y === "top" ? le(e) : xe(e);
|
|
3360
|
+
}, $i = (n) => ({ x: on(n), y: un(n) }), mt = (n) => {
|
|
3413
3361
|
const e = $(n);
|
|
3414
3362
|
return { lower: e.one.x, upper: e.two.x };
|
|
3415
|
-
},
|
|
3363
|
+
}, yt = (n) => {
|
|
3416
3364
|
const e = $(n);
|
|
3417
3365
|
return { lower: e.one.y, upper: e.two.y };
|
|
3418
|
-
},
|
|
3419
|
-
const t = $(n), r =
|
|
3420
|
-
if (r === null) throw new Error(`Invalid location: ${
|
|
3366
|
+
}, Ci = (n, e) => ar(n, e), Ri = (n, e) => {
|
|
3367
|
+
const t = $(n), r = en.includes(e) ? "x" : tn.includes(e) ? "y" : null;
|
|
3368
|
+
if (r === null) throw new Error(`Invalid location: ${e}`);
|
|
3421
3369
|
const s = e === "top" || e === "left" ? Math.min : Math.max, i = { ...t.one }, a = { ...t.two };
|
|
3422
3370
|
return i[r] = s(t.one[r], t.two[r]), a[r] = s(t.one[r], t.two[r]), [i, a];
|
|
3423
|
-
},
|
|
3424
|
-
const t = $(n), r = $(e), s =
|
|
3425
|
-
return $({ x: s, y: i },
|
|
3426
|
-
},
|
|
3371
|
+
}, Mi = (n, e) => {
|
|
3372
|
+
const t = $(n), r = $(e), s = on(r) + (me(r) - me(t)) / 2, i = un(r) + (ye(r) - ye(t)) / 2;
|
|
3373
|
+
return $({ x: s, y: i }, or(t));
|
|
3374
|
+
}, cr = (n) => typeof n != "object" || n == null ? !1 : "one" in n && "two" in n && "root" in n, ji = (n) => me(n) / ye(n), Zi = (n, e, t) => {
|
|
3427
3375
|
if (typeof e == "string") {
|
|
3428
3376
|
if (t == null) throw new Error("Undefined amount passed into box.translate");
|
|
3429
|
-
const s =
|
|
3377
|
+
const s = nn(e);
|
|
3430
3378
|
e = C(s, t);
|
|
3431
3379
|
}
|
|
3432
3380
|
const r = $(n);
|
|
3433
3381
|
return $(
|
|
3434
|
-
|
|
3435
|
-
|
|
3382
|
+
ut(r.one, e),
|
|
3383
|
+
ut(r.two, e),
|
|
3436
3384
|
void 0,
|
|
3437
3385
|
void 0,
|
|
3438
3386
|
r.root
|
|
3439
3387
|
);
|
|
3440
|
-
},
|
|
3441
|
-
const t = Math.max(
|
|
3442
|
-
return t > s || r > i ?
|
|
3443
|
-
},
|
|
3388
|
+
}, Bi = (n, e) => {
|
|
3389
|
+
const t = Math.max(ce(n), ce(e)), r = Math.max(le(n), le(e)), s = Math.min(be(n), be(e)), i = Math.min(xe(n), xe(e));
|
|
3390
|
+
return t > s || r > i ? ir : $({ x: t, y: r }, { x: s, y: i }, void 0, void 0, n.root);
|
|
3391
|
+
}, Ui = (n) => me(n) * ye(n), Di = (n, e) => {
|
|
3444
3392
|
const t = $(n);
|
|
3445
3393
|
return $(
|
|
3446
|
-
|
|
3447
|
-
|
|
3394
|
+
zt(t.one, e),
|
|
3395
|
+
zt(t.two, e),
|
|
3448
3396
|
void 0,
|
|
3449
3397
|
void 0,
|
|
3450
3398
|
t.root
|
|
3451
3399
|
);
|
|
3452
|
-
},
|
|
3400
|
+
}, Li = (n, e, t, r, s, i) => {
|
|
3453
3401
|
const a = { x: n, y: e }, o = { x: n + t, y: e + r };
|
|
3454
3402
|
return s.x !== i.x && (s.x === "center" ? (a.x -= t / 2, o.x -= t / 2) : (a.x -= t, o.x -= t)), s.y !== i.y && (s.y === "center" ? (a.y -= r / 2, o.y -= r / 2) : (a.y -= r, o.y -= r)), $(a, o, void 0, void 0, i);
|
|
3455
|
-
},
|
|
3403
|
+
}, ft = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
3456
3404
|
__proto__: null,
|
|
3457
|
-
DECIMAL:
|
|
3458
|
-
ZERO:
|
|
3459
|
-
area:
|
|
3460
|
-
areaIsZero:
|
|
3461
|
-
aspect:
|
|
3405
|
+
DECIMAL: xi,
|
|
3406
|
+
ZERO: ir,
|
|
3407
|
+
area: Ui,
|
|
3408
|
+
areaIsZero: Ii,
|
|
3409
|
+
aspect: ji,
|
|
3462
3410
|
bottom: xe,
|
|
3463
|
-
bottomLeft:
|
|
3464
|
-
bottomRight:
|
|
3465
|
-
box:
|
|
3466
|
-
center:
|
|
3411
|
+
bottomLeft: Ai,
|
|
3412
|
+
bottomRight: Ei,
|
|
3413
|
+
box: bi,
|
|
3414
|
+
center: Vt,
|
|
3467
3415
|
construct: $,
|
|
3468
|
-
constructWithAlternateRoot:
|
|
3469
|
-
contains:
|
|
3470
|
-
copy:
|
|
3471
|
-
css:
|
|
3472
|
-
cssBox:
|
|
3473
|
-
dim:
|
|
3474
|
-
dims:
|
|
3475
|
-
domRect:
|
|
3476
|
-
edgePoints:
|
|
3477
|
-
equals:
|
|
3416
|
+
constructWithAlternateRoot: Li,
|
|
3417
|
+
contains: Ti,
|
|
3418
|
+
copy: ar,
|
|
3419
|
+
css: Ni,
|
|
3420
|
+
cssBox: vi,
|
|
3421
|
+
dim: an,
|
|
3422
|
+
dims: or,
|
|
3423
|
+
domRect: wi,
|
|
3424
|
+
edgePoints: Ri,
|
|
3425
|
+
equals: Oi,
|
|
3478
3426
|
height: ye,
|
|
3479
|
-
intersection:
|
|
3480
|
-
isBox:
|
|
3481
|
-
left:
|
|
3427
|
+
intersection: Bi,
|
|
3428
|
+
isBox: cr,
|
|
3429
|
+
left: ce,
|
|
3482
3430
|
loc: Se,
|
|
3483
|
-
positionInCenter:
|
|
3484
|
-
reRoot:
|
|
3485
|
-
resize:
|
|
3431
|
+
positionInCenter: Mi,
|
|
3432
|
+
reRoot: Ci,
|
|
3433
|
+
resize: _i,
|
|
3486
3434
|
right: be,
|
|
3487
|
-
root:
|
|
3488
|
-
signedDims:
|
|
3489
|
-
signedHeight:
|
|
3490
|
-
signedWidth:
|
|
3491
|
-
top:
|
|
3492
|
-
topLeft:
|
|
3493
|
-
topRight:
|
|
3494
|
-
translate:
|
|
3495
|
-
truncate:
|
|
3435
|
+
root: $i,
|
|
3436
|
+
signedDims: Si,
|
|
3437
|
+
signedHeight: Et,
|
|
3438
|
+
signedWidth: At,
|
|
3439
|
+
top: le,
|
|
3440
|
+
topLeft: ur,
|
|
3441
|
+
topRight: ki,
|
|
3442
|
+
translate: Zi,
|
|
3443
|
+
truncate: Di,
|
|
3496
3444
|
width: me,
|
|
3497
|
-
x:
|
|
3498
|
-
xBounds:
|
|
3499
|
-
xyLoc:
|
|
3500
|
-
y:
|
|
3501
|
-
yBounds:
|
|
3502
|
-
}, Symbol.toStringTag, { value: "Module" })),
|
|
3445
|
+
x: on,
|
|
3446
|
+
xBounds: mt,
|
|
3447
|
+
xyLoc: lt,
|
|
3448
|
+
y: un,
|
|
3449
|
+
yBounds: yt
|
|
3450
|
+
}, Symbol.toStringTag, { value: "Module" })), lr = u.object({ signedWidth: u.number(), signedHeight: u.number() }), Pi = u.union([Qt, lr, ot, kt]), zi = { width: 0, height: 0 }, Wi = { width: 1, height: 1 }, G = (n, e) => typeof n == "number" ? { width: n, height: e ?? n } : Array.isArray(n) ? { width: n[0], height: n[1] } : "x" in n ? { width: n.x, height: n.y } : "signedWidth" in n ? { width: n.signedWidth, height: n.signedHeight } : { ...n }, Vi = (n, e) => {
|
|
3503
3451
|
if (e == null) return !1;
|
|
3504
3452
|
const t = G(n), r = G(e);
|
|
3505
3453
|
return t.width === r.width && t.height === r.height;
|
|
3506
|
-
},
|
|
3454
|
+
}, qi = (n) => {
|
|
3507
3455
|
const e = G(n);
|
|
3508
3456
|
return { width: e.height, height: e.width };
|
|
3509
|
-
},
|
|
3457
|
+
}, Fi = (n) => {
|
|
3510
3458
|
const e = G(n);
|
|
3511
3459
|
return `0 0 ${e.width} ${e.height}`;
|
|
3512
|
-
},
|
|
3460
|
+
}, Yi = (n) => {
|
|
3513
3461
|
const e = G(n);
|
|
3514
3462
|
return [e.width, e.height];
|
|
3515
|
-
},
|
|
3463
|
+
}, Gi = (n) => ({
|
|
3516
3464
|
width: Math.max(...n.map((e) => G(e).width)),
|
|
3517
3465
|
height: Math.max(...n.map((e) => G(e).height))
|
|
3518
|
-
}),
|
|
3466
|
+
}), Ji = (n) => ({
|
|
3519
3467
|
width: Math.min(...n.map((e) => G(e).width)),
|
|
3520
3468
|
height: Math.min(...n.map((e) => G(e).height))
|
|
3521
|
-
}),
|
|
3469
|
+
}), Hi = (n, e) => {
|
|
3522
3470
|
const t = G(n);
|
|
3523
3471
|
return { width: t.width * e, height: t.height * e };
|
|
3524
|
-
},
|
|
3472
|
+
}, Mt = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
3525
3473
|
__proto__: null,
|
|
3526
|
-
DECIMAL:
|
|
3527
|
-
ZERO:
|
|
3474
|
+
DECIMAL: Wi,
|
|
3475
|
+
ZERO: zi,
|
|
3528
3476
|
construct: G,
|
|
3529
|
-
couple:
|
|
3530
|
-
crude:
|
|
3531
|
-
dimensions:
|
|
3532
|
-
equals:
|
|
3533
|
-
max:
|
|
3534
|
-
min:
|
|
3535
|
-
scale:
|
|
3536
|
-
signed:
|
|
3537
|
-
svgViewBox:
|
|
3538
|
-
swap:
|
|
3477
|
+
couple: Yi,
|
|
3478
|
+
crude: Pi,
|
|
3479
|
+
dimensions: Qt,
|
|
3480
|
+
equals: Vi,
|
|
3481
|
+
max: Gi,
|
|
3482
|
+
min: Ji,
|
|
3483
|
+
scale: Hi,
|
|
3484
|
+
signed: lr,
|
|
3485
|
+
svgViewBox: Fi,
|
|
3486
|
+
swap: qi
|
|
3539
3487
|
}, Symbol.toStringTag, { value: "Module" }));
|
|
3540
|
-
var
|
|
3541
|
-
const
|
|
3542
|
-
u.object({ offset:
|
|
3488
|
+
var Xi = Object.defineProperty, Ki = (n, e, t) => e in n ? Xi(n, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : n[e] = t, ie = (n, e, t) => Ki(n, typeof e != "symbol" ? e + "" : e, t);
|
|
3489
|
+
const Qi = (n, e, t) => e !== void 0 && n < e ? e : t !== void 0 && n > t ? t : n;
|
|
3490
|
+
u.object({ offset: Pt, scale: Pt });
|
|
3543
3491
|
u.object({ offset: u.number(), scale: u.number() });
|
|
3544
|
-
const
|
|
3492
|
+
const ea = (n) => (e, t, r, s) => t === "dimension" ? [e, r] : [
|
|
3545
3493
|
e,
|
|
3546
3494
|
s ? r - n : r + n
|
|
3547
|
-
],
|
|
3495
|
+
], ta = (n) => (e, t, r, s) => [
|
|
3548
3496
|
e,
|
|
3549
3497
|
s ? r / n : r * n
|
|
3550
|
-
],
|
|
3498
|
+
], na = (n) => (e, t, r) => {
|
|
3551
3499
|
if (e === null) return [n, r];
|
|
3552
3500
|
const { lower: s, upper: i } = e, { lower: a, upper: o } = n, c = i - s, l = o - a;
|
|
3553
3501
|
if (t === "dimension") return [n, r * (l / c)];
|
|
3554
|
-
const
|
|
3555
|
-
return [n,
|
|
3556
|
-
},
|
|
3502
|
+
const p = (r - s) * (l / c) + a;
|
|
3503
|
+
return [n, p];
|
|
3504
|
+
}, ra = (n) => (e, t, r) => [n, r], sa = () => (n, e, t) => {
|
|
3557
3505
|
if (n === null) throw new Error("cannot invert without bounds");
|
|
3558
3506
|
if (e === "dimension") return [n, t];
|
|
3559
3507
|
const { lower: r, upper: s } = n;
|
|
3560
3508
|
return [n, s - (t - r)];
|
|
3561
|
-
},
|
|
3509
|
+
}, ia = (n) => (e, t, r) => {
|
|
3562
3510
|
const { lower: s, upper: i } = n;
|
|
3563
|
-
return r =
|
|
3564
|
-
},
|
|
3511
|
+
return r = Qi(r, s, i), [e, r];
|
|
3512
|
+
}, qt = class De {
|
|
3565
3513
|
constructor() {
|
|
3566
|
-
|
|
3514
|
+
ie(this, "ops", []), ie(this, "currBounds", null), ie(this, "currType", null), ie(this, "reversed", !1), this.ops = [];
|
|
3567
3515
|
}
|
|
3568
3516
|
/**
|
|
3569
3517
|
* @returns a new scale with a translation as its first operation. Any number provided
|
|
@@ -3571,7 +3519,7 @@ const Oa = (n) => (e, t, r, s) => t === "dimension" ? [e, r] : [
|
|
|
3571
3519
|
* @param value - The amount to translate by.
|
|
3572
3520
|
*/
|
|
3573
3521
|
static translate(e) {
|
|
3574
|
-
return new
|
|
3522
|
+
return new De().translate(e);
|
|
3575
3523
|
}
|
|
3576
3524
|
/**
|
|
3577
3525
|
* @returns a new scale with a magnification as its first operation. Any number provided
|
|
@@ -3579,10 +3527,10 @@ const Oa = (n) => (e, t, r, s) => t === "dimension" ? [e, r] : [
|
|
|
3579
3527
|
* @param value - The amount to translate by.
|
|
3580
3528
|
*/
|
|
3581
3529
|
static magnify(e) {
|
|
3582
|
-
return new
|
|
3530
|
+
return new De().magnify(e);
|
|
3583
3531
|
}
|
|
3584
3532
|
static scale(e, t) {
|
|
3585
|
-
return new
|
|
3533
|
+
return new De().scale(e, t);
|
|
3586
3534
|
}
|
|
3587
3535
|
/**
|
|
3588
3536
|
* @returns a copy of the scale with a translation as its next operation. Any
|
|
@@ -3591,7 +3539,7 @@ const Oa = (n) => (e, t, r, s) => t === "dimension" ? [e, r] : [
|
|
|
3591
3539
|
* @param value - The amount to translate by.
|
|
3592
3540
|
*/
|
|
3593
3541
|
translate(e) {
|
|
3594
|
-
const t = this.new(), r =
|
|
3542
|
+
const t = this.new(), r = ea(e);
|
|
3595
3543
|
return r.type = "translate", t.ops.push(r), t;
|
|
3596
3544
|
}
|
|
3597
3545
|
/**
|
|
@@ -3601,23 +3549,23 @@ const Oa = (n) => (e, t, r, s) => t === "dimension" ? [e, r] : [
|
|
|
3601
3549
|
* @param value - The amount to magnify by.
|
|
3602
3550
|
*/
|
|
3603
3551
|
magnify(e) {
|
|
3604
|
-
const t = this.new(), r =
|
|
3552
|
+
const t = this.new(), r = ta(e);
|
|
3605
3553
|
return r.type = "magnify", t.ops.push(r), t;
|
|
3606
3554
|
}
|
|
3607
3555
|
scale(e, t) {
|
|
3608
|
-
const r = we(e, t), s = this.new(), i =
|
|
3556
|
+
const r = we(e, t), s = this.new(), i = na(r);
|
|
3609
3557
|
return i.type = "scale", s.ops.push(i), s;
|
|
3610
3558
|
}
|
|
3611
3559
|
clamp(e, t) {
|
|
3612
|
-
const r = we(e, t), s = this.new(), i =
|
|
3560
|
+
const r = we(e, t), s = this.new(), i = ia(r);
|
|
3613
3561
|
return i.type = "clamp", s.ops.push(i), s;
|
|
3614
3562
|
}
|
|
3615
3563
|
reBound(e, t) {
|
|
3616
|
-
const r = we(e, t), s = this.new(), i =
|
|
3564
|
+
const r = we(e, t), s = this.new(), i = ra(r);
|
|
3617
3565
|
return i.type = "re-bound", s.ops.push(i), s;
|
|
3618
3566
|
}
|
|
3619
3567
|
invert() {
|
|
3620
|
-
const e =
|
|
3568
|
+
const e = sa();
|
|
3621
3569
|
e.type = "invert";
|
|
3622
3570
|
const t = this.new();
|
|
3623
3571
|
return t.ops.push(e), t;
|
|
@@ -3629,7 +3577,7 @@ const Oa = (n) => (e, t, r, s) => t === "dimension" ? [e, r] : [
|
|
|
3629
3577
|
return this.exec("dimension", e);
|
|
3630
3578
|
}
|
|
3631
3579
|
new() {
|
|
3632
|
-
const e = new
|
|
3580
|
+
const e = new De();
|
|
3633
3581
|
return e.ops = this.ops.slice(), e.reversed = this.reversed, e;
|
|
3634
3582
|
}
|
|
3635
3583
|
exec(e, t) {
|
|
@@ -3656,32 +3604,32 @@ const Oa = (n) => (e, t, r, s) => t === "dimension" ? [e, r] : [
|
|
|
3656
3604
|
return { scale: this.dim(1), offset: this.pos(0) };
|
|
3657
3605
|
}
|
|
3658
3606
|
};
|
|
3659
|
-
|
|
3660
|
-
let
|
|
3661
|
-
const
|
|
3662
|
-
constructor(e = new
|
|
3663
|
-
|
|
3607
|
+
ie(qt, "IDENTITY", new qt());
|
|
3608
|
+
let xn = qt;
|
|
3609
|
+
const _n = class re {
|
|
3610
|
+
constructor(e = new xn(), t = new xn(), r = null) {
|
|
3611
|
+
ie(this, "x"), ie(this, "y"), ie(this, "currRoot"), this.x = e, this.y = t, this.currRoot = r;
|
|
3664
3612
|
}
|
|
3665
3613
|
static translate(e, t) {
|
|
3666
|
-
return new
|
|
3614
|
+
return new re().translate(e, t);
|
|
3667
3615
|
}
|
|
3668
3616
|
static translateX(e) {
|
|
3669
|
-
return new
|
|
3617
|
+
return new re().translateX(e);
|
|
3670
3618
|
}
|
|
3671
3619
|
static translateY(e) {
|
|
3672
|
-
return new
|
|
3620
|
+
return new re().translateY(e);
|
|
3673
3621
|
}
|
|
3674
3622
|
static clamp(e) {
|
|
3675
|
-
return new
|
|
3623
|
+
return new re().clamp(e);
|
|
3676
3624
|
}
|
|
3677
3625
|
static magnify(e) {
|
|
3678
|
-
return new
|
|
3626
|
+
return new re().magnify(e);
|
|
3679
3627
|
}
|
|
3680
3628
|
static scale(e) {
|
|
3681
|
-
return new
|
|
3629
|
+
return new re().scale(e);
|
|
3682
3630
|
}
|
|
3683
3631
|
static reBound(e) {
|
|
3684
|
-
return new
|
|
3632
|
+
return new re().reBound(e);
|
|
3685
3633
|
}
|
|
3686
3634
|
translate(e, t) {
|
|
3687
3635
|
const r = C(e, t), s = this.copy();
|
|
@@ -3701,22 +3649,22 @@ const Mn = class ne {
|
|
|
3701
3649
|
}
|
|
3702
3650
|
scale(e) {
|
|
3703
3651
|
const t = this.copy();
|
|
3704
|
-
if (
|
|
3652
|
+
if (cr(e)) {
|
|
3705
3653
|
const r = this.currRoot;
|
|
3706
|
-
return t.currRoot = e.root, r != null && !
|
|
3654
|
+
return t.currRoot = e.root, r != null && !Qn(r, e.root) && (r.x !== e.root.x && (t.x = t.x.invert()), r.y !== e.root.y && (t.y = t.y.invert())), t.x = t.x.scale(mt(e)), t.y = t.y.scale(yt(e)), t;
|
|
3707
3655
|
}
|
|
3708
3656
|
return t.x = t.x.scale(e.width), t.y = t.y.scale(e.height), t;
|
|
3709
3657
|
}
|
|
3710
3658
|
reBound(e) {
|
|
3711
3659
|
const t = this.copy();
|
|
3712
|
-
return t.x = this.x.reBound(
|
|
3660
|
+
return t.x = this.x.reBound(mt(e)), t.y = this.y.reBound(yt(e)), t;
|
|
3713
3661
|
}
|
|
3714
3662
|
clamp(e) {
|
|
3715
3663
|
const t = this.copy();
|
|
3716
|
-
return t.x = this.x.clamp(
|
|
3664
|
+
return t.x = this.x.clamp(mt(e)), t.y = this.y.clamp(yt(e)), t;
|
|
3717
3665
|
}
|
|
3718
3666
|
copy() {
|
|
3719
|
-
const e = new
|
|
3667
|
+
const e = new re();
|
|
3720
3668
|
return e.currRoot = this.currRoot, e.x = this.x, e.y = this.y, e;
|
|
3721
3669
|
}
|
|
3722
3670
|
reverse() {
|
|
@@ -3745,85 +3693,18 @@ const Mn = class ne {
|
|
|
3745
3693
|
};
|
|
3746
3694
|
}
|
|
3747
3695
|
};
|
|
3748
|
-
|
|
3749
|
-
|
|
3750
|
-
|
|
3751
|
-
return r.map((s, i) => {
|
|
3752
|
-
const a = e(s, i, r);
|
|
3753
|
-
return a == null ? null : typeof a == "string" ? a : a.join(t);
|
|
3754
|
-
}).filter((s) => s != null).join(t);
|
|
3755
|
-
}, _r = (n, e, t = { optional: !1, separator: "." }) => {
|
|
3756
|
-
t.separator ?? (t.separator = ".");
|
|
3757
|
-
const { optional: r, getter: s = (o, c) => o[c] } = t, i = e.split(t.separator);
|
|
3758
|
-
if (i.length === 1 && i[0] === "") return n;
|
|
3759
|
-
let a = n;
|
|
3760
|
-
for (const o of i) {
|
|
3761
|
-
const c = s(a, o);
|
|
3762
|
-
if (c == null) {
|
|
3763
|
-
if (r) return null;
|
|
3764
|
-
throw new Error(`Path ${e} does not exist. ${o} is null`);
|
|
3765
|
-
}
|
|
3766
|
-
a = c;
|
|
3767
|
-
}
|
|
3768
|
-
return a;
|
|
3769
|
-
}, $a = (n, e, t) => {
|
|
3770
|
-
const r = e.split(".");
|
|
3771
|
-
let s = n;
|
|
3772
|
-
for (let i = 0; i < r.length - 1; i++) {
|
|
3773
|
-
const a = r[i];
|
|
3774
|
-
s[a] ?? (s[a] = {}), s = s[a];
|
|
3775
|
-
}
|
|
3776
|
-
try {
|
|
3777
|
-
s[r[r.length - 1]] = t;
|
|
3778
|
-
} catch (i) {
|
|
3779
|
-
throw console.error("failed to set value", t, "at path", e, "on object", n), i;
|
|
3780
|
-
}
|
|
3781
|
-
}, Ca = (n, e) => {
|
|
3782
|
-
const t = e.split(".");
|
|
3783
|
-
let r = n;
|
|
3784
|
-
for (let s = 0; s < t.length - 1; s++) {
|
|
3785
|
-
const i = t[s];
|
|
3786
|
-
if (r[i] == null) return;
|
|
3787
|
-
r = r[i];
|
|
3788
|
-
}
|
|
3789
|
-
if (Array.isArray(r)) {
|
|
3790
|
-
const s = parseInt(t[t.length - 1]);
|
|
3791
|
-
if (isNaN(s)) return;
|
|
3792
|
-
r.splice(s, 1);
|
|
3793
|
-
return;
|
|
3794
|
-
}
|
|
3795
|
-
delete r[t[t.length - 1]];
|
|
3796
|
-
}, Ra = (n, e) => {
|
|
3797
|
-
const t = n.split(".");
|
|
3798
|
-
return e < 0 ? t[t.length + e] : t[e];
|
|
3799
|
-
}, Ma = (n, e) => {
|
|
3800
|
-
try {
|
|
3801
|
-
return _r(n, e), !0;
|
|
3802
|
-
} catch {
|
|
3803
|
-
return !1;
|
|
3804
|
-
}
|
|
3805
|
-
}, ja = (n, e) => {
|
|
3806
|
-
if (e.length === 0) return !0;
|
|
3807
|
-
const t = n.split("."), r = e.split(".");
|
|
3808
|
-
if (r.length > t.length) return !1;
|
|
3809
|
-
for (let s = 0; s < r.length; s++) {
|
|
3810
|
-
const i = t[s], a = r[s];
|
|
3811
|
-
if (a !== "*" && i !== a)
|
|
3812
|
-
return !1;
|
|
3813
|
-
}
|
|
3814
|
-
return !0;
|
|
3815
|
-
}, Za = u.bigint().or(u.string().transform(BigInt));
|
|
3816
|
-
var Ba = Object.defineProperty, Da = (n, e, t) => e in n ? Ba(n, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : n[e] = t, f = (n, e, t) => Da(n, typeof e != "symbol" ? e + "" : e, t);
|
|
3817
|
-
let Ua = (n, e = 21) => (t = e) => {
|
|
3696
|
+
ie(_n, "IDENTITY", new _n());
|
|
3697
|
+
var aa = Object.defineProperty, oa = (n, e, t) => e in n ? aa(n, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : n[e] = t, h = (n, e, t) => oa(n, typeof e != "symbol" ? e + "" : e, t);
|
|
3698
|
+
let ua = (n, e = 21) => (t = e) => {
|
|
3818
3699
|
let r = "", s = t | 0;
|
|
3819
3700
|
for (; s--; )
|
|
3820
3701
|
r += n[Math.random() * n.length | 0];
|
|
3821
3702
|
return r;
|
|
3822
3703
|
};
|
|
3823
|
-
const
|
|
3704
|
+
const ca = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz", la = ua(ca, 11), dr = () => la(), Ft = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
3824
3705
|
__proto__: null,
|
|
3825
|
-
|
|
3826
|
-
}, Symbol.toStringTag, { value: "Module" })),
|
|
3706
|
+
create: dr
|
|
3707
|
+
}, Symbol.toStringTag, { value: "Module" })), da = u.enum(["static", "dynamic"]), hr = (n, e) => {
|
|
3827
3708
|
const t = new E(e);
|
|
3828
3709
|
if (![
|
|
3829
3710
|
A.DAY,
|
|
@@ -3841,7 +3722,7 @@ const La = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz", Tr
|
|
|
3841
3722
|
return n instanceof E ? new E(r) : new A(r);
|
|
3842
3723
|
}, I = class w {
|
|
3843
3724
|
constructor(e, t = "UTC") {
|
|
3844
|
-
if (
|
|
3725
|
+
if (h(this, "value"), h(this, "encodeValue", !0), e == null) this.value = w.now().valueOf();
|
|
3845
3726
|
else if (e instanceof Date)
|
|
3846
3727
|
this.value = BigInt(e.getTime()) * w.MILLISECOND.valueOf();
|
|
3847
3728
|
else if (typeof e == "string")
|
|
@@ -3953,7 +3834,7 @@ const La = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz", Tr
|
|
|
3953
3834
|
* valid, regardless of the TimeStamp order.
|
|
3954
3835
|
*/
|
|
3955
3836
|
range(e) {
|
|
3956
|
-
return new
|
|
3837
|
+
return new cn(this, e).makeValid();
|
|
3957
3838
|
}
|
|
3958
3839
|
/**
|
|
3959
3840
|
* Creates a TimeRange starting at the TimeStamp and spanning the given
|
|
@@ -4137,7 +4018,7 @@ const La = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz", Tr
|
|
|
4137
4018
|
* @example TimeStamp.now().remainder(TimeStamp.DAY) // => TimeStamp representing the current day
|
|
4138
4019
|
*/
|
|
4139
4020
|
remainder(e) {
|
|
4140
|
-
return
|
|
4021
|
+
return hr(this, e);
|
|
4141
4022
|
}
|
|
4142
4023
|
/** @returns true if the day portion TimeStamp is today, false otherwise. */
|
|
4143
4024
|
get isToday() {
|
|
@@ -4199,17 +4080,17 @@ const La = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz", Tr
|
|
|
4199
4080
|
return w.hours(e * 24);
|
|
4200
4081
|
}
|
|
4201
4082
|
};
|
|
4202
|
-
|
|
4203
|
-
|
|
4204
|
-
|
|
4205
|
-
|
|
4206
|
-
|
|
4207
|
-
|
|
4208
|
-
|
|
4209
|
-
|
|
4210
|
-
|
|
4211
|
-
|
|
4212
|
-
|
|
4083
|
+
h(I, "NANOSECOND", I.nanoseconds(1)), /** One microsecond after the unix epoch */
|
|
4084
|
+
h(I, "MICROSECOND", I.microseconds(1)), /** One millisecond after the unix epoch */
|
|
4085
|
+
h(I, "MILLISECOND", I.milliseconds(1)), /** One second after the unix epoch */
|
|
4086
|
+
h(I, "SECOND", I.seconds(1)), /** One minute after the unix epoch */
|
|
4087
|
+
h(I, "MINUTE", I.minutes(1)), /** One hour after the unix epoch */
|
|
4088
|
+
h(I, "HOUR", I.hours(1)), /** One day after the unix epoch */
|
|
4089
|
+
h(I, "DAY", I.days(1)), /** The maximum possible value for a timestamp */
|
|
4090
|
+
h(I, "MAX", new I((1n << 63n) - 1n)), /** The minimum possible value for a timestamp */
|
|
4091
|
+
h(I, "MIN", new I(0)), /** The unix epoch */
|
|
4092
|
+
h(I, "ZERO", new I(0)), /** A zod schema for validating timestamps */
|
|
4093
|
+
h(I, "z", u.union([
|
|
4213
4094
|
u.object({ value: u.bigint() }).transform((n) => new I(n.value)),
|
|
4214
4095
|
u.string().transform((n) => new I(BigInt(n))),
|
|
4215
4096
|
u.instanceof(Number).transform((n) => new I(n)),
|
|
@@ -4219,13 +4100,13 @@ f(I, "z", u.union([
|
|
|
4219
4100
|
let E = I;
|
|
4220
4101
|
const k = class T {
|
|
4221
4102
|
constructor(e) {
|
|
4222
|
-
|
|
4103
|
+
h(this, "value"), h(this, "encodeValue", !0), typeof e == "number" && (e = Math.trunc(e.valueOf())), this.value = BigInt(e.valueOf());
|
|
4223
4104
|
}
|
|
4224
4105
|
static fromSeconds(e) {
|
|
4225
|
-
return e instanceof T ? e : e instanceof
|
|
4106
|
+
return e instanceof T ? e : e instanceof Tn ? e.period : e instanceof E ? new T(e) : ["number", "bigint"].includes(typeof e) ? T.seconds(e) : new T(e);
|
|
4226
4107
|
}
|
|
4227
4108
|
static fromMilliseconds(e) {
|
|
4228
|
-
return e instanceof T ? e : e instanceof
|
|
4109
|
+
return e instanceof T ? e : e instanceof Tn ? e.period : e instanceof E ? new T(e) : ["number", "bigint"].includes(typeof e) ? T.milliseconds(e) : new T(e);
|
|
4229
4110
|
}
|
|
4230
4111
|
encode() {
|
|
4231
4112
|
return this.value.toString();
|
|
@@ -4246,7 +4127,7 @@ const k = class T {
|
|
|
4246
4127
|
return this.valueOf() >= new T(e).valueOf();
|
|
4247
4128
|
}
|
|
4248
4129
|
remainder(e) {
|
|
4249
|
-
return
|
|
4130
|
+
return hr(this, e);
|
|
4250
4131
|
}
|
|
4251
4132
|
truncate(e) {
|
|
4252
4133
|
return new T(
|
|
@@ -4254,9 +4135,9 @@ const k = class T {
|
|
|
4254
4135
|
);
|
|
4255
4136
|
}
|
|
4256
4137
|
toString() {
|
|
4257
|
-
const e = this.truncate(T.DAY), t = this.truncate(T.HOUR), r = this.truncate(T.MINUTE), s = this.truncate(T.SECOND), i = this.truncate(T.MILLISECOND), a = this.truncate(T.MICROSECOND), o = this.truncate(T.NANOSECOND), c = e, l = t.sub(e),
|
|
4258
|
-
let
|
|
4259
|
-
return c.isZero || (
|
|
4138
|
+
const e = this.truncate(T.DAY), t = this.truncate(T.HOUR), r = this.truncate(T.MINUTE), s = this.truncate(T.SECOND), i = this.truncate(T.MILLISECOND), a = this.truncate(T.MICROSECOND), o = this.truncate(T.NANOSECOND), c = e, l = t.sub(e), p = r.sub(t), y = s.sub(r), j = i.sub(s), U = a.sub(i), Me = o.sub(a);
|
|
4139
|
+
let oe = "";
|
|
4140
|
+
return c.isZero || (oe += `${c.days}d `), l.isZero || (oe += `${l.hours}h `), p.isZero || (oe += `${p.minutes}m `), y.isZero || (oe += `${y.seconds}s `), j.isZero || (oe += `${j.milliseconds}ms `), U.isZero || (oe += `${U.microseconds}µs `), Me.isZero || (oe += `${Me.nanoseconds}ns`), oe.trim();
|
|
4260
4141
|
}
|
|
4261
4142
|
mult(e) {
|
|
4262
4143
|
return new T(this.valueOf() * BigInt(e));
|
|
@@ -4383,17 +4264,17 @@ const k = class T {
|
|
|
4383
4264
|
return T.hours(Ne(e, 24));
|
|
4384
4265
|
}
|
|
4385
4266
|
};
|
|
4386
|
-
|
|
4387
|
-
|
|
4388
|
-
|
|
4389
|
-
|
|
4390
|
-
|
|
4391
|
-
|
|
4392
|
-
|
|
4393
|
-
|
|
4394
|
-
|
|
4395
|
-
|
|
4396
|
-
|
|
4267
|
+
h(k, "NANOSECOND", k.nanoseconds(1)), /** A microsecond. */
|
|
4268
|
+
h(k, "MICROSECOND", k.microseconds(1)), /** A millisecond. */
|
|
4269
|
+
h(k, "MILLISECOND", k.milliseconds(1)), /** A second. */
|
|
4270
|
+
h(k, "SECOND", k.seconds(1)), /** A minute. */
|
|
4271
|
+
h(k, "MINUTE", k.minutes(1)), /** Represents an hour. */
|
|
4272
|
+
h(k, "HOUR", k.hours(1)), /** Represents a day. */
|
|
4273
|
+
h(k, "DAY", k.days(1)), /** The maximum possible value for a TimeSpan. */
|
|
4274
|
+
h(k, "MAX", new k((1n << 63n) - 1n)), /** The minimum possible value for a TimeSpan. */
|
|
4275
|
+
h(k, "MIN", new k(0)), /** The zero value for a TimeSpan. */
|
|
4276
|
+
h(k, "ZERO", new k(0)), /** A zod schema for validating and transforming timespans */
|
|
4277
|
+
h(k, "z", u.union([
|
|
4397
4278
|
u.object({ value: u.bigint() }).transform((n) => new k(n.value)),
|
|
4398
4279
|
u.string().transform((n) => new k(BigInt(n))),
|
|
4399
4280
|
u.instanceof(Number).transform((n) => new k(n)),
|
|
@@ -4401,7 +4282,7 @@ f(k, "z", u.union([
|
|
|
4401
4282
|
u.instanceof(k)
|
|
4402
4283
|
]));
|
|
4403
4284
|
let A = k;
|
|
4404
|
-
const
|
|
4285
|
+
const Le = class gt extends Number {
|
|
4405
4286
|
constructor(e) {
|
|
4406
4287
|
e instanceof Number ? super(e.valueOf()) : super(e);
|
|
4407
4288
|
}
|
|
@@ -4411,7 +4292,7 @@ const Pe = class bt extends Number {
|
|
|
4411
4292
|
}
|
|
4412
4293
|
/** @returns The number of seconds in the Rate. */
|
|
4413
4294
|
equals(e) {
|
|
4414
|
-
return this.valueOf() === new
|
|
4295
|
+
return this.valueOf() === new gt(e).valueOf();
|
|
4415
4296
|
}
|
|
4416
4297
|
/**
|
|
4417
4298
|
* Calculates the period of the Rate as a TimeSpan.
|
|
@@ -4438,7 +4319,7 @@ const Pe = class bt extends Number {
|
|
|
4438
4319
|
* @returns The number of bytes in the given TimeSpan at this rate.
|
|
4439
4320
|
*/
|
|
4440
4321
|
byteCount(e, t) {
|
|
4441
|
-
return this.sampleCount(e) * new
|
|
4322
|
+
return this.sampleCount(e) * new P(t).valueOf();
|
|
4442
4323
|
}
|
|
4443
4324
|
/**
|
|
4444
4325
|
* Calculates a TimeSpan given the number of samples at this rate.
|
|
@@ -4466,7 +4347,7 @@ const Pe = class bt extends Number {
|
|
|
4466
4347
|
* @returns A Rate representing the given number of Hz.
|
|
4467
4348
|
*/
|
|
4468
4349
|
static hz(e) {
|
|
4469
|
-
return new
|
|
4350
|
+
return new gt(e);
|
|
4470
4351
|
}
|
|
4471
4352
|
/**
|
|
4472
4353
|
* Creates a Rate representing the given number of kHz.
|
|
@@ -4475,16 +4356,16 @@ const Pe = class bt extends Number {
|
|
|
4475
4356
|
* @returns A Rate representing the given number of kHz.
|
|
4476
4357
|
*/
|
|
4477
4358
|
static khz(e) {
|
|
4478
|
-
return
|
|
4359
|
+
return gt.hz(e * 1e3);
|
|
4479
4360
|
}
|
|
4480
4361
|
};
|
|
4481
|
-
|
|
4482
|
-
u.number().transform((n) => new
|
|
4483
|
-
u.instanceof(Number).transform((n) => new
|
|
4484
|
-
u.instanceof(
|
|
4362
|
+
h(Le, "z", u.union([
|
|
4363
|
+
u.number().transform((n) => new Le(n)),
|
|
4364
|
+
u.instanceof(Number).transform((n) => new Le(n)),
|
|
4365
|
+
u.instanceof(Le)
|
|
4485
4366
|
]));
|
|
4486
|
-
let
|
|
4487
|
-
const
|
|
4367
|
+
let Tn = Le;
|
|
4368
|
+
const B = class extends Number {
|
|
4488
4369
|
/**
|
|
4489
4370
|
* Creates a Density representing the given number of bytes per value.
|
|
4490
4371
|
*
|
|
@@ -4499,22 +4380,22 @@ const Z = class extends Number {
|
|
|
4499
4380
|
return e.valueOf() / this.valueOf();
|
|
4500
4381
|
}
|
|
4501
4382
|
size(e) {
|
|
4502
|
-
return new
|
|
4383
|
+
return new Yt(e * this.valueOf());
|
|
4503
4384
|
}
|
|
4504
4385
|
};
|
|
4505
|
-
|
|
4506
|
-
|
|
4507
|
-
|
|
4508
|
-
|
|
4509
|
-
|
|
4510
|
-
|
|
4511
|
-
|
|
4512
|
-
u.number().transform((n) => new
|
|
4513
|
-
u.instanceof(Number).transform((n) => new
|
|
4514
|
-
u.instanceof(
|
|
4386
|
+
h(B, "UNKNOWN", new B(0)), /** 128 bits per value. */
|
|
4387
|
+
h(B, "BIT128", new B(16)), /** 64 bits per value. */
|
|
4388
|
+
h(B, "BIT64", new B(8)), /** 32 bits per value. */
|
|
4389
|
+
h(B, "BIT32", new B(4)), /** 16 bits per value. */
|
|
4390
|
+
h(B, "BIT16", new B(2)), /** 8 bits per value. */
|
|
4391
|
+
h(B, "BIT8", new B(1)), /** A zod schema for validating and transforming densities */
|
|
4392
|
+
h(B, "z", u.union([
|
|
4393
|
+
u.number().transform((n) => new B(n)),
|
|
4394
|
+
u.instanceof(Number).transform((n) => new B(n)),
|
|
4395
|
+
u.instanceof(B)
|
|
4515
4396
|
]));
|
|
4516
|
-
let
|
|
4517
|
-
const J = class
|
|
4397
|
+
let P = B;
|
|
4398
|
+
const J = class vt {
|
|
4518
4399
|
/**
|
|
4519
4400
|
* Creates a TimeRange from the given start and end TimeStamps.
|
|
4520
4401
|
*
|
|
@@ -4522,7 +4403,7 @@ const J = class xt {
|
|
|
4522
4403
|
* @param end - A TimeStamp representing the end of the range.
|
|
4523
4404
|
*/
|
|
4524
4405
|
constructor(e, t) {
|
|
4525
|
-
|
|
4406
|
+
h(this, "start"), h(this, "end"), typeof e == "object" && "start" in e ? (this.start = new E(e.start), this.end = new E(e.end)) : (this.start = new E(e), this.end = new E(t));
|
|
4526
4407
|
}
|
|
4527
4408
|
/** @returns The TimeSpan occupied by the TimeRange. */
|
|
4528
4409
|
get span() {
|
|
@@ -4564,7 +4445,7 @@ const J = class xt {
|
|
|
4564
4445
|
* @returns A TimeRange with the start and end swapped.
|
|
4565
4446
|
*/
|
|
4566
4447
|
swap() {
|
|
4567
|
-
return new
|
|
4448
|
+
return new vt(this.end, this.start);
|
|
4568
4449
|
}
|
|
4569
4450
|
/**
|
|
4570
4451
|
* Checks if the TimeRange is equal to the given TimeRange.
|
|
@@ -4602,21 +4483,21 @@ const J = class xt {
|
|
|
4602
4483
|
return r < 0 && (r = -r), s < 0 && (s = -s), r <= t.valueOf() && s <= t.valueOf();
|
|
4603
4484
|
}
|
|
4604
4485
|
contains(e) {
|
|
4605
|
-
return e instanceof
|
|
4486
|
+
return e instanceof vt ? this.contains(e.start) && this.contains(e.end) : this.start.beforeEq(e) && this.end.after(e);
|
|
4606
4487
|
}
|
|
4607
4488
|
boundBy(e) {
|
|
4608
|
-
const t = new
|
|
4489
|
+
const t = new vt(this.start, this.end);
|
|
4609
4490
|
return e.start.after(this.start) && (t.start = e.start), e.start.after(this.end) && (t.end = e.start), e.end.before(this.end) && (t.end = e.end), e.end.before(this.start) && (t.start = e.end), t;
|
|
4610
4491
|
}
|
|
4611
4492
|
};
|
|
4612
|
-
|
|
4613
|
-
|
|
4614
|
-
|
|
4615
|
-
|
|
4493
|
+
h(J, "MAX", new J(E.MIN, E.MAX)), /** The minimum possible time range. */
|
|
4494
|
+
h(J, "MIN", new J(E.MAX, E.MIN)), /** A zero time range. */
|
|
4495
|
+
h(J, "ZERO", new J(E.ZERO, E.ZERO)), /** A zod schema for validating and transforming time ranges */
|
|
4496
|
+
h(J, "z", u.union([
|
|
4616
4497
|
u.object({ start: E.z, end: E.z }).transform((n) => new J(n.start, n.end)),
|
|
4617
4498
|
u.instanceof(J)
|
|
4618
4499
|
]));
|
|
4619
|
-
let
|
|
4500
|
+
let cn = J;
|
|
4620
4501
|
const d = class M extends String {
|
|
4621
4502
|
constructor(e) {
|
|
4622
4503
|
if (e instanceof M || typeof e == "string" || typeof e.valueOf() == "string") {
|
|
@@ -4703,24 +4584,24 @@ const d = class M extends String {
|
|
|
4703
4584
|
return M.BIG_INT_TYPES.some((e) => e.equals(this));
|
|
4704
4585
|
}
|
|
4705
4586
|
};
|
|
4706
|
-
|
|
4707
|
-
|
|
4708
|
-
|
|
4709
|
-
|
|
4710
|
-
|
|
4711
|
-
|
|
4712
|
-
|
|
4713
|
-
|
|
4714
|
-
|
|
4715
|
-
|
|
4716
|
-
|
|
4717
|
-
|
|
4718
|
-
|
|
4719
|
-
|
|
4587
|
+
h(d, "UNKNOWN", new d("unknown")), /** Represents a 64-bit floating point value. */
|
|
4588
|
+
h(d, "FLOAT64", new d("float64")), /** Represents a 32-bit floating point value. */
|
|
4589
|
+
h(d, "FLOAT32", new d("float32")), /** Represents a 64-bit signed integer value. */
|
|
4590
|
+
h(d, "INT64", new d("int64")), /** Represents a 32-bit signed integer value. */
|
|
4591
|
+
h(d, "INT32", new d("int32")), /** Represents a 16-bit signed integer value. */
|
|
4592
|
+
h(d, "INT16", new d("int16")), /** Represents a 8-bit signed integer value. */
|
|
4593
|
+
h(d, "INT8", new d("int8")), /** Represents a 64-bit unsigned integer value. */
|
|
4594
|
+
h(d, "UINT64", new d("uint64")), /** Represents a 32-bit unsigned integer value. */
|
|
4595
|
+
h(d, "UINT32", new d("uint32")), /** Represents a 16-bit unsigned integer value. */
|
|
4596
|
+
h(d, "UINT16", new d("uint16")), /** Represents a 8-bit unsigned integer value. */
|
|
4597
|
+
h(d, "UINT8", new d("uint8")), /** Represents a boolean value. Alias for UINT8. */
|
|
4598
|
+
h(d, "BOOLEAN", d.UINT8), /** Represents a 64-bit unix epoch. */
|
|
4599
|
+
h(d, "TIMESTAMP", new d("timestamp")), /** Represents a UUID data type */
|
|
4600
|
+
h(d, "UUID", new d("uuid")), /** Represents a string data type. Strings have an unknown density, and are separate
|
|
4720
4601
|
* by a newline character. */
|
|
4721
|
-
|
|
4602
|
+
h(d, "STRING", new d("string")), /** Represents a JSON data type. JSON has an unknown density, and is separated by a
|
|
4722
4603
|
* newline character. */
|
|
4723
|
-
|
|
4604
|
+
h(d, "JSON", new d("json")), h(d, "ARRAY_CONSTRUCTORS", /* @__PURE__ */ new Map([
|
|
4724
4605
|
[d.UINT8.toString(), Uint8Array],
|
|
4725
4606
|
[d.UINT16.toString(), Uint16Array],
|
|
4726
4607
|
[d.UINT32.toString(), Uint32Array],
|
|
@@ -4735,7 +4616,7 @@ f(d, "JSON", new d("json")), f(d, "ARRAY_CONSTRUCTORS", /* @__PURE__ */ new Map(
|
|
|
4735
4616
|
[d.STRING.toString(), Uint8Array],
|
|
4736
4617
|
[d.JSON.toString(), Uint8Array],
|
|
4737
4618
|
[d.UUID.toString(), Uint8Array]
|
|
4738
|
-
])),
|
|
4619
|
+
])), h(d, "ARRAY_CONSTRUCTOR_DATA_TYPES", /* @__PURE__ */ new Map([
|
|
4739
4620
|
[Uint8Array.name, d.UINT8],
|
|
4740
4621
|
[Uint16Array.name, d.UINT16],
|
|
4741
4622
|
[Uint32Array.name, d.UINT32],
|
|
@@ -4746,23 +4627,23 @@ f(d, "JSON", new d("json")), f(d, "ARRAY_CONSTRUCTORS", /* @__PURE__ */ new Map(
|
|
|
4746
4627
|
[Int16Array.name, d.INT16],
|
|
4747
4628
|
[Int32Array.name, d.INT32],
|
|
4748
4629
|
[BigInt64Array.name, d.INT64]
|
|
4749
|
-
])),
|
|
4750
|
-
[d.UINT8.toString(),
|
|
4751
|
-
[d.UINT16.toString(),
|
|
4752
|
-
[d.UINT32.toString(),
|
|
4753
|
-
[d.UINT64.toString(),
|
|
4754
|
-
[d.FLOAT32.toString(),
|
|
4755
|
-
[d.FLOAT64.toString(),
|
|
4756
|
-
[d.INT8.toString(),
|
|
4757
|
-
[d.INT16.toString(),
|
|
4758
|
-
[d.INT32.toString(),
|
|
4759
|
-
[d.INT64.toString(),
|
|
4760
|
-
[d.TIMESTAMP.toString(),
|
|
4761
|
-
[d.STRING.toString(),
|
|
4762
|
-
[d.JSON.toString(),
|
|
4763
|
-
[d.UUID.toString(),
|
|
4630
|
+
])), h(d, "DENSITIES", /* @__PURE__ */ new Map([
|
|
4631
|
+
[d.UINT8.toString(), P.BIT8],
|
|
4632
|
+
[d.UINT16.toString(), P.BIT16],
|
|
4633
|
+
[d.UINT32.toString(), P.BIT32],
|
|
4634
|
+
[d.UINT64.toString(), P.BIT64],
|
|
4635
|
+
[d.FLOAT32.toString(), P.BIT32],
|
|
4636
|
+
[d.FLOAT64.toString(), P.BIT64],
|
|
4637
|
+
[d.INT8.toString(), P.BIT8],
|
|
4638
|
+
[d.INT16.toString(), P.BIT16],
|
|
4639
|
+
[d.INT32.toString(), P.BIT32],
|
|
4640
|
+
[d.INT64.toString(), P.BIT64],
|
|
4641
|
+
[d.TIMESTAMP.toString(), P.BIT64],
|
|
4642
|
+
[d.STRING.toString(), P.UNKNOWN],
|
|
4643
|
+
[d.JSON.toString(), P.UNKNOWN],
|
|
4644
|
+
[d.UUID.toString(), P.BIT128]
|
|
4764
4645
|
])), /** All the data types. */
|
|
4765
|
-
|
|
4646
|
+
h(d, "ALL", [
|
|
4766
4647
|
d.UNKNOWN,
|
|
4767
4648
|
d.FLOAT64,
|
|
4768
4649
|
d.FLOAT32,
|
|
@@ -4778,13 +4659,13 @@ f(d, "ALL", [
|
|
|
4778
4659
|
d.UUID,
|
|
4779
4660
|
d.STRING,
|
|
4780
4661
|
d.JSON
|
|
4781
|
-
]),
|
|
4782
|
-
|
|
4662
|
+
]), h(d, "BIG_INT_TYPES", [d.INT64, d.UINT64, d.TIMESTAMP]), /** A zod schema for a DataType. */
|
|
4663
|
+
h(d, "z", u.union([
|
|
4783
4664
|
u.string().transform((n) => new d(n)),
|
|
4784
4665
|
u.instanceof(d)
|
|
4785
4666
|
]));
|
|
4786
4667
|
let N = d;
|
|
4787
|
-
const
|
|
4668
|
+
const D = class Z extends Number {
|
|
4788
4669
|
constructor(e) {
|
|
4789
4670
|
super(e.valueOf());
|
|
4790
4671
|
}
|
|
@@ -4797,33 +4678,33 @@ const B = class j extends Number {
|
|
|
4797
4678
|
return this.valueOf() < e.valueOf();
|
|
4798
4679
|
}
|
|
4799
4680
|
add(e) {
|
|
4800
|
-
return
|
|
4681
|
+
return Z.bytes(this.valueOf() + e.valueOf());
|
|
4801
4682
|
}
|
|
4802
4683
|
sub(e) {
|
|
4803
|
-
return
|
|
4684
|
+
return Z.bytes(this.valueOf() - e.valueOf());
|
|
4804
4685
|
}
|
|
4805
4686
|
truncate(e) {
|
|
4806
|
-
return new
|
|
4687
|
+
return new Z(Math.trunc(this.valueOf() / e.valueOf()) * e.valueOf());
|
|
4807
4688
|
}
|
|
4808
4689
|
remainder(e) {
|
|
4809
|
-
return
|
|
4690
|
+
return Z.bytes(this.valueOf() % e.valueOf());
|
|
4810
4691
|
}
|
|
4811
4692
|
get gigabytes() {
|
|
4812
|
-
return this.valueOf() /
|
|
4693
|
+
return this.valueOf() / Z.GIGABYTE.valueOf();
|
|
4813
4694
|
}
|
|
4814
4695
|
get megabytes() {
|
|
4815
|
-
return this.valueOf() /
|
|
4696
|
+
return this.valueOf() / Z.MEGABYTE.valueOf();
|
|
4816
4697
|
}
|
|
4817
4698
|
get kilobytes() {
|
|
4818
|
-
return this.valueOf() /
|
|
4699
|
+
return this.valueOf() / Z.KILOBYTE.valueOf();
|
|
4819
4700
|
}
|
|
4820
4701
|
get terabytes() {
|
|
4821
|
-
return this.valueOf() /
|
|
4702
|
+
return this.valueOf() / Z.TERABYTE.valueOf();
|
|
4822
4703
|
}
|
|
4823
4704
|
toString() {
|
|
4824
|
-
const e = this.truncate(
|
|
4825
|
-
let
|
|
4826
|
-
return a.isZero || (
|
|
4705
|
+
const e = this.truncate(Z.TERABYTE), t = this.truncate(Z.GIGABYTE), r = this.truncate(Z.MEGABYTE), s = this.truncate(Z.KILOBYTE), i = this.truncate(Z.BYTE), a = e, o = t.sub(e), c = r.sub(t), l = s.sub(r), p = i.sub(s);
|
|
4706
|
+
let y = "";
|
|
4707
|
+
return a.isZero || (y += `${a.terabytes}TB `), o.isZero || (y += `${o.gigabytes}GB `), c.isZero || (y += `${c.megabytes}MB `), l.isZero || (y += `${l.kilobytes}KB `), (!p.isZero || y === "") && (y += `${p.valueOf()}B`), y.trim();
|
|
4827
4708
|
}
|
|
4828
4709
|
/**
|
|
4829
4710
|
* Creates a Size from the given number of bytes.
|
|
@@ -4832,7 +4713,7 @@ const B = class j extends Number {
|
|
|
4832
4713
|
* @returns A Size representing the given number of bytes.
|
|
4833
4714
|
*/
|
|
4834
4715
|
static bytes(e = 1) {
|
|
4835
|
-
return new
|
|
4716
|
+
return new Z(e);
|
|
4836
4717
|
}
|
|
4837
4718
|
/**
|
|
4838
4719
|
* Creates a Size from the given number if kilobytes.
|
|
@@ -4841,7 +4722,7 @@ const B = class j extends Number {
|
|
|
4841
4722
|
* @returns A Size representing the given number of kilobytes.
|
|
4842
4723
|
*/
|
|
4843
4724
|
static kilobytes(e = 1) {
|
|
4844
|
-
return
|
|
4725
|
+
return Z.bytes(e.valueOf() * 1e3);
|
|
4845
4726
|
}
|
|
4846
4727
|
/**
|
|
4847
4728
|
* Creates a Size from the given number of megabytes.
|
|
@@ -4850,7 +4731,7 @@ const B = class j extends Number {
|
|
|
4850
4731
|
* @returns A Size representing the given number of megabytes.
|
|
4851
4732
|
*/
|
|
4852
4733
|
static megabytes(e = 1) {
|
|
4853
|
-
return
|
|
4734
|
+
return Z.kilobytes(e.valueOf() * 1e3);
|
|
4854
4735
|
}
|
|
4855
4736
|
/**
|
|
4856
4737
|
* Creates a Size from the given number of gigabytes.
|
|
@@ -4859,7 +4740,7 @@ const B = class j extends Number {
|
|
|
4859
4740
|
* @returns A Size representing the given number of gigabytes.
|
|
4860
4741
|
*/
|
|
4861
4742
|
static gigabytes(e = 1) {
|
|
4862
|
-
return
|
|
4743
|
+
return Z.megabytes(e.valueOf() * 1e3);
|
|
4863
4744
|
}
|
|
4864
4745
|
/**
|
|
4865
4746
|
* Creates a Size from the given number of terabytes.
|
|
@@ -4868,23 +4749,23 @@ const B = class j extends Number {
|
|
|
4868
4749
|
* @returns A Size representing the given number of terabytes.
|
|
4869
4750
|
*/
|
|
4870
4751
|
static terabytes(e) {
|
|
4871
|
-
return
|
|
4752
|
+
return Z.gigabytes(e.valueOf() * 1e3);
|
|
4872
4753
|
}
|
|
4873
4754
|
get isZero() {
|
|
4874
4755
|
return this.valueOf() === 0;
|
|
4875
4756
|
}
|
|
4876
4757
|
};
|
|
4877
|
-
|
|
4878
|
-
|
|
4879
|
-
|
|
4880
|
-
|
|
4881
|
-
|
|
4882
|
-
|
|
4883
|
-
|
|
4884
|
-
u.number().transform((n) => new
|
|
4885
|
-
u.instanceof(
|
|
4758
|
+
h(D, "BYTE", new D(1)), /** A kilobyte */
|
|
4759
|
+
h(D, "KILOBYTE", D.kilobytes(1)), /** A megabyte */
|
|
4760
|
+
h(D, "MEGABYTE", D.megabytes(1)), /** A gigabyte */
|
|
4761
|
+
h(D, "GIGABYTE", D.gigabytes(1)), /** A terabyte. */
|
|
4762
|
+
h(D, "TERABYTE", D.terabytes(1)), /** The zero value for Size */
|
|
4763
|
+
h(D, "ZERO", new D(0)), /** A zod schema for a Size. */
|
|
4764
|
+
h(D, "z", u.union([
|
|
4765
|
+
u.number().transform((n) => new D(n)),
|
|
4766
|
+
u.instanceof(D)
|
|
4886
4767
|
]));
|
|
4887
|
-
let
|
|
4768
|
+
let Yt = D;
|
|
4888
4769
|
u.union([
|
|
4889
4770
|
u.instanceof(Uint8Array),
|
|
4890
4771
|
u.instanceof(Uint16Array),
|
|
@@ -4897,69 +4778,73 @@ u.union([
|
|
|
4897
4778
|
u.instanceof(Int32Array),
|
|
4898
4779
|
u.instanceof(BigInt64Array)
|
|
4899
4780
|
]);
|
|
4900
|
-
const
|
|
4781
|
+
const fr = (n) => {
|
|
4901
4782
|
const e = typeof n;
|
|
4902
4783
|
return e === "string" || e === "number" || e === "boolean" || e === "bigint" || n instanceof E || n instanceof A || n instanceof Date;
|
|
4903
|
-
},
|
|
4784
|
+
}, ha = (n, e, t, r = 0) => n.usesBigInt && !e.usesBigInt ? Number(t) - Number(r) : !n.usesBigInt && e.usesBigInt ? BigInt(t.valueOf()) - BigInt(r.valueOf()) : Pe(t, -r).valueOf(), Pe = (n, e) => typeof n == "bigint" && typeof e == "bigint" || typeof n == "number" && typeof e == "number" ? n + e : e === 0 ? n : n === 0 ? e : Number(n) + Number(e), fa = (n) => n == null ? !1 : Array.isArray(n) || n instanceof ArrayBuffer || ArrayBuffer.isView(n) && !(n instanceof DataView) || n instanceof ya ? !0 : fr(n), ue = -1, pa = u.string().transform(
|
|
4904
4785
|
(n) => new Uint8Array(
|
|
4905
4786
|
atob(n).split("").map((e) => e.charCodeAt(0))
|
|
4906
4787
|
).buffer
|
|
4907
|
-
),
|
|
4788
|
+
), ma = u.union([u.null(), u.undefined()]).transform(() => new Uint8Array().buffer), Gt = 10, ze = class H {
|
|
4908
4789
|
constructor(e) {
|
|
4909
|
-
|
|
4790
|
+
h(this, "key", ""), h(this, "isSynnaxSeries", !0), h(this, "dataType"), h(this, "sampleOffset"), h(this, "gl"), h(this, "_data"), h(this, "_timeRange"), h(this, "alignment", 0n), h(this, "_cachedMin"), h(this, "_cachedMax"), h(this, "writePos", ue), h(this, "_refCount", 0), h(this, "_cachedLength"), h(this, "_cachedIndexes"), fa(e) && (e = { data: e });
|
|
4910
4791
|
const {
|
|
4911
4792
|
dataType: t,
|
|
4912
4793
|
timeRange: r,
|
|
4913
4794
|
sampleOffset: s = 0,
|
|
4914
4795
|
glBufferUsage: i = "static",
|
|
4915
4796
|
alignment: a = 0n,
|
|
4916
|
-
key: o =
|
|
4797
|
+
key: o = dr()
|
|
4917
4798
|
} = e, c = e.data ?? [];
|
|
4918
4799
|
if (c instanceof H || typeof c == "object" && "isSynnaxSeries" in c && c.isSynnaxSeries === !0) {
|
|
4919
|
-
const
|
|
4920
|
-
this.key =
|
|
4800
|
+
const y = c;
|
|
4801
|
+
this.key = y.key, this.dataType = y.dataType, this.sampleOffset = y.sampleOffset, this.gl = y.gl, this._data = y._data, this._timeRange = y._timeRange, this.alignment = y.alignment, this._cachedMin = y._cachedMin, this._cachedMax = y._cachedMax, this.writePos = y.writePos, this._refCount = y._refCount, this._cachedLength = y._cachedLength;
|
|
4921
4802
|
return;
|
|
4922
4803
|
}
|
|
4923
|
-
const l =
|
|
4804
|
+
const l = fr(c), p = Array.isArray(c);
|
|
4924
4805
|
if (t != null) this.dataType = new N(t);
|
|
4925
4806
|
else {
|
|
4926
4807
|
if (c instanceof ArrayBuffer)
|
|
4927
4808
|
throw new Error(
|
|
4928
4809
|
"cannot infer data type from an ArrayBuffer instance when constructing a Series. Please provide a data type."
|
|
4929
4810
|
);
|
|
4930
|
-
if (
|
|
4931
|
-
let
|
|
4811
|
+
if (p || l) {
|
|
4812
|
+
let y = c;
|
|
4932
4813
|
if (!l) {
|
|
4933
4814
|
if (c.length === 0)
|
|
4934
4815
|
throw new Error(
|
|
4935
4816
|
"cannot infer data type from a zero length JS array when constructing a Series. Please provide a data type."
|
|
4936
4817
|
);
|
|
4937
|
-
|
|
4818
|
+
y = c[0];
|
|
4938
4819
|
}
|
|
4939
|
-
if (typeof
|
|
4940
|
-
else if (typeof
|
|
4941
|
-
else if (typeof
|
|
4942
|
-
else if (typeof
|
|
4943
|
-
else if (
|
|
4820
|
+
if (typeof y == "string") this.dataType = N.STRING;
|
|
4821
|
+
else if (typeof y == "number") this.dataType = N.FLOAT64;
|
|
4822
|
+
else if (typeof y == "bigint") this.dataType = N.INT64;
|
|
4823
|
+
else if (typeof y == "boolean") this.dataType = N.BOOLEAN;
|
|
4824
|
+
else if (y instanceof E || y instanceof Date || y instanceof E)
|
|
4944
4825
|
this.dataType = N.TIMESTAMP;
|
|
4945
|
-
else if (typeof
|
|
4826
|
+
else if (typeof y == "object") this.dataType = N.JSON;
|
|
4946
4827
|
else
|
|
4947
4828
|
throw new Error(
|
|
4948
|
-
`cannot infer data type of ${typeof
|
|
4829
|
+
`cannot infer data type of ${typeof y} when constructing a Series from a JS array`
|
|
4949
4830
|
);
|
|
4950
4831
|
} else this.dataType = new N(c);
|
|
4951
4832
|
}
|
|
4952
|
-
if (!
|
|
4833
|
+
if (!p && !l) this._data = c;
|
|
4953
4834
|
else {
|
|
4954
|
-
let
|
|
4955
|
-
const
|
|
4956
|
-
(
|
|
4835
|
+
let y = l ? [c] : c;
|
|
4836
|
+
const j = y[0];
|
|
4837
|
+
(j instanceof E || j instanceof Date || j instanceof A) && (y = y.map((U) => new E(U).valueOf())), this.dataType.equals(N.STRING) ? (this._cachedLength = y.length, this._data = new TextEncoder().encode(`${y.join(`
|
|
4957
4838
|
`)}
|
|
4958
|
-
`).buffer) : this.dataType.equals(N.JSON) ? (this._cachedLength =
|
|
4959
|
-
`${
|
|
4839
|
+
`).buffer) : this.dataType.equals(N.JSON) ? (this._cachedLength = y.length, this._data = new TextEncoder().encode(
|
|
4840
|
+
`${y.map((U) => pt.encodeString(U)).join(`
|
|
4960
4841
|
`)}
|
|
4961
4842
|
`
|
|
4962
|
-
).buffer) : this._data = new this.dataType.Array(
|
|
4843
|
+
).buffer) : this.dataType.usesBigInt && typeof j == "number" ? this._data = new this.dataType.Array(
|
|
4844
|
+
y.map((U) => BigInt(Math.round(U)))
|
|
4845
|
+
).buffer : !this.dataType.usesBigInt && typeof j == "bigint" ? this._data = new this.dataType.Array(
|
|
4846
|
+
y.map((U) => Number(U))
|
|
4847
|
+
).buffer : this._data = new this.dataType.Array(y).buffer;
|
|
4963
4848
|
}
|
|
4964
4849
|
this.key = o, this.alignment = a, this.sampleOffset = s ?? 0, this._timeRange = r, this.gl = {
|
|
4965
4850
|
control: null,
|
|
@@ -4978,7 +4863,7 @@ const Sr = (n) => {
|
|
|
4978
4863
|
});
|
|
4979
4864
|
return i.writePos = 0, i;
|
|
4980
4865
|
}
|
|
4981
|
-
static
|
|
4866
|
+
static createTimestamps(e, t, r) {
|
|
4982
4867
|
const s = r.spanRange(t.span(e)), i = new BigInt64Array(e);
|
|
4983
4868
|
for (let a = 0; a < e; a++)
|
|
4984
4869
|
i[a] = BigInt(r.add(t.span(a)).valueOf());
|
|
@@ -4997,7 +4882,7 @@ const Sr = (n) => {
|
|
|
4997
4882
|
}
|
|
4998
4883
|
static fromJSON(e, t) {
|
|
4999
4884
|
const r = new TextEncoder().encode(
|
|
5000
|
-
`${e.map((s) =>
|
|
4885
|
+
`${e.map((s) => pt.encodeString(s)).join(`
|
|
5001
4886
|
`)}
|
|
5002
4887
|
`
|
|
5003
4888
|
);
|
|
@@ -5026,12 +4911,12 @@ const Sr = (n) => {
|
|
|
5026
4911
|
return this.dataType.isVariable ? this.writeVariable(e) : this.writeFixed(e);
|
|
5027
4912
|
}
|
|
5028
4913
|
writeVariable(e) {
|
|
5029
|
-
if (this.writePos ===
|
|
4914
|
+
if (this.writePos === ue) return 0;
|
|
5030
4915
|
const t = this.byteCapacity.valueOf() - this.writePos, r = e.subBytes(0, t);
|
|
5031
4916
|
return this.writeToUnderlyingData(r), this.writePos += r.byteLength.valueOf(), this._cachedLength != null && (this._cachedLength += r.length, this.calculateCachedLength()), r.length;
|
|
5032
4917
|
}
|
|
5033
4918
|
writeFixed(e) {
|
|
5034
|
-
if (this.writePos ===
|
|
4919
|
+
if (this.writePos === ue) return 0;
|
|
5035
4920
|
const t = this.capacity - this.writePos, r = e.sub(0, t);
|
|
5036
4921
|
return this.writeToUnderlyingData(r), this._cachedLength = void 0, this.maybeRecomputeMinMax(r), this.writePos += r.length, r.length;
|
|
5037
4922
|
}
|
|
@@ -5050,7 +4935,7 @@ const Sr = (n) => {
|
|
|
5050
4935
|
}
|
|
5051
4936
|
/** @returns a native typed array with the proper data type. */
|
|
5052
4937
|
get data() {
|
|
5053
|
-
return this.writePos ===
|
|
4938
|
+
return this.writePos === ue ? this.underlyingData : new this.dataType.Array(this._data, 0, this.writePos);
|
|
5054
4939
|
}
|
|
5055
4940
|
toStrings() {
|
|
5056
4941
|
if (!this.dataType.matches(N.STRING, N.UUID))
|
|
@@ -5075,7 +4960,7 @@ const Sr = (n) => {
|
|
|
5075
4960
|
if (!this.dataType.equals(N.JSON))
|
|
5076
4961
|
throw new Error("cannot parse non-JSON series as JSON");
|
|
5077
4962
|
return new TextDecoder().decode(this.underlyingData).split(`
|
|
5078
|
-
`).slice(0, -1).map((t) => e.parse(
|
|
4963
|
+
`).slice(0, -1).map((t) => e.parse(pt.decodeString(t)));
|
|
5079
4964
|
}
|
|
5080
4965
|
/** @returns the time range of this array. */
|
|
5081
4966
|
get timeRange() {
|
|
@@ -5084,7 +4969,7 @@ const Sr = (n) => {
|
|
|
5084
4969
|
}
|
|
5085
4970
|
/** @returns the capacity of the series in bytes. */
|
|
5086
4971
|
get byteCapacity() {
|
|
5087
|
-
return new
|
|
4972
|
+
return new Yt(this.underlyingData.byteLength);
|
|
5088
4973
|
}
|
|
5089
4974
|
/** @returns the capacity of the series in samples. */
|
|
5090
4975
|
get capacity() {
|
|
@@ -5092,11 +4977,11 @@ const Sr = (n) => {
|
|
|
5092
4977
|
}
|
|
5093
4978
|
/** @returns the length of the series in bytes. */
|
|
5094
4979
|
get byteLength() {
|
|
5095
|
-
return this.writePos ===
|
|
4980
|
+
return this.writePos === ue ? this.byteCapacity : this.dataType.isVariable ? new Yt(this.writePos) : this.dataType.density.size(this.writePos);
|
|
5096
4981
|
}
|
|
5097
4982
|
/** @returns the number of samples in this array. */
|
|
5098
4983
|
get length() {
|
|
5099
|
-
return this._cachedLength != null ? this._cachedLength : this.dataType.isVariable ? this.calculateCachedLength() : this.writePos ===
|
|
4984
|
+
return this._cachedLength != null ? this._cachedLength : this.dataType.isVariable ? this.calculateCachedLength() : this.writePos === ue ? this.data.length : this.writePos;
|
|
5100
4985
|
}
|
|
5101
4986
|
calculateCachedLength() {
|
|
5102
4987
|
if (!this.dataType.isVariable)
|
|
@@ -5104,7 +4989,7 @@ const Sr = (n) => {
|
|
|
5104
4989
|
let e = 0;
|
|
5105
4990
|
const t = [0];
|
|
5106
4991
|
return this.data.forEach((r, s) => {
|
|
5107
|
-
r ===
|
|
4992
|
+
r === Gt && (e++, t.push(s + 1));
|
|
5108
4993
|
}), this._cachedIndexes = t, this._cachedLength = e, e;
|
|
5109
4994
|
}
|
|
5110
4995
|
/**
|
|
@@ -5120,7 +5005,7 @@ const Sr = (n) => {
|
|
|
5120
5005
|
if (this.dataType.equals(e)) return this;
|
|
5121
5006
|
const r = new e.Array(this.length);
|
|
5122
5007
|
for (let s = 0; s < this.length; s++)
|
|
5123
|
-
r[s] =
|
|
5008
|
+
r[s] = ha(this.dataType, e, this.data[s], t);
|
|
5124
5009
|
return new H({
|
|
5125
5010
|
data: r.buffer,
|
|
5126
5011
|
dataType: e,
|
|
@@ -5147,7 +5032,7 @@ const Sr = (n) => {
|
|
|
5147
5032
|
get max() {
|
|
5148
5033
|
if (this.dataType.isVariable)
|
|
5149
5034
|
throw new Error("cannot calculate maximum on a variable length data type");
|
|
5150
|
-
return this.writePos === 0 ? -1 / 0 : (this._cachedMax ?? (this._cachedMax = this.calcRawMax()),
|
|
5035
|
+
return this.writePos === 0 ? -1 / 0 : (this._cachedMax ?? (this._cachedMax = this.calcRawMax()), Pe(this._cachedMax, this.sampleOffset));
|
|
5151
5036
|
}
|
|
5152
5037
|
calcRawMin() {
|
|
5153
5038
|
if (this.length === 0) return 1 / 0;
|
|
@@ -5165,7 +5050,7 @@ const Sr = (n) => {
|
|
|
5165
5050
|
get min() {
|
|
5166
5051
|
if (this.dataType.isVariable)
|
|
5167
5052
|
throw new Error("cannot calculate minimum on a variable length data type");
|
|
5168
|
-
return this.writePos === 0 ? 1 / 0 : (this._cachedMin ?? (this._cachedMin = this.calcRawMin()),
|
|
5053
|
+
return this.writePos === 0 ? 1 / 0 : (this._cachedMin ?? (this._cachedMin = this.calcRawMin()), Pe(this._cachedMin, this.sampleOffset));
|
|
5169
5054
|
}
|
|
5170
5055
|
/** @returns the bounds of this array. */
|
|
5171
5056
|
get bounds() {
|
|
@@ -5185,7 +5070,7 @@ const Sr = (n) => {
|
|
|
5185
5070
|
this.max, this.min;
|
|
5186
5071
|
}
|
|
5187
5072
|
get range() {
|
|
5188
|
-
return
|
|
5073
|
+
return Pe(this.max, -this.min);
|
|
5189
5074
|
}
|
|
5190
5075
|
atAlignment(e, t) {
|
|
5191
5076
|
const r = Number(e - this.alignment);
|
|
@@ -5203,7 +5088,7 @@ const Sr = (n) => {
|
|
|
5203
5088
|
if (t === !0) throw new Error(`[series] - no value at index ${e}`);
|
|
5204
5089
|
return;
|
|
5205
5090
|
}
|
|
5206
|
-
return
|
|
5091
|
+
return Pe(r, this.sampleOffset);
|
|
5207
5092
|
}
|
|
5208
5093
|
atVariable(e, t) {
|
|
5209
5094
|
let r = 0, s = 0;
|
|
@@ -5212,7 +5097,7 @@ const Sr = (n) => {
|
|
|
5212
5097
|
else {
|
|
5213
5098
|
e < 0 && (e = this.length + e);
|
|
5214
5099
|
for (let a = 0; a < this.data.length; a++)
|
|
5215
|
-
if (this.data[a] ===
|
|
5100
|
+
if (this.data[a] === Gt) {
|
|
5216
5101
|
if (e === 0) {
|
|
5217
5102
|
s = a;
|
|
5218
5103
|
break;
|
|
@@ -5225,7 +5110,7 @@ const Sr = (n) => {
|
|
|
5225
5110
|
}
|
|
5226
5111
|
}
|
|
5227
5112
|
const i = this.data.slice(r, s);
|
|
5228
|
-
return this.dataType.equals(N.STRING) ? new TextDecoder().decode(i) :
|
|
5113
|
+
return this.dataType.equals(N.STRING) ? new TextDecoder().decode(i) : Rn(JSON.parse(new TextDecoder().decode(i)));
|
|
5229
5114
|
}
|
|
5230
5115
|
/**
|
|
5231
5116
|
* @returns the index of the first sample that is greater than or equal to the given value.
|
|
@@ -5234,7 +5119,7 @@ const Sr = (n) => {
|
|
|
5234
5119
|
*/
|
|
5235
5120
|
binarySearch(e) {
|
|
5236
5121
|
let t = 0, r = this.length - 1;
|
|
5237
|
-
const s =
|
|
5122
|
+
const s = Fs(e);
|
|
5238
5123
|
for (; t <= r; ) {
|
|
5239
5124
|
const i = Math.floor((t + r) / 2), a = s(this.at(i, !0), e);
|
|
5240
5125
|
if (a === 0) return i;
|
|
@@ -5247,7 +5132,7 @@ const Sr = (n) => {
|
|
|
5247
5132
|
throw new Error("Only FLOAT32 and UINT8 arrays can be used in WebGL");
|
|
5248
5133
|
const { buffer: t, bufferUsage: r, prevBuffer: s } = this.gl;
|
|
5249
5134
|
if (t == null && (this.gl.buffer = e.createBuffer()), this.writePos !== s)
|
|
5250
|
-
if (e.bindBuffer(e.ARRAY_BUFFER, this.gl.buffer), this.writePos !==
|
|
5135
|
+
if (e.bindBuffer(e.ARRAY_BUFFER, this.gl.buffer), this.writePos !== ue) {
|
|
5251
5136
|
s === 0 && e.bufferData(e.ARRAY_BUFFER, this.byteCapacity.valueOf(), e.STATIC_DRAW);
|
|
5252
5137
|
const i = this.dataType.density.size(s).valueOf(), a = this.underlyingData.slice(this.gl.prevBuffer, this.writePos);
|
|
5253
5138
|
e.bufferSubData(e.ARRAY_BUFFER, i, a.buffer), this.gl.prevBuffer = this.writePos;
|
|
@@ -5256,7 +5141,7 @@ const Sr = (n) => {
|
|
|
5256
5141
|
e.ARRAY_BUFFER,
|
|
5257
5142
|
this.buffer,
|
|
5258
5143
|
r === "static" ? e.STATIC_DRAW : e.DYNAMIC_DRAW
|
|
5259
|
-
), this.gl.prevBuffer =
|
|
5144
|
+
), this.gl.prevBuffer = ue;
|
|
5260
5145
|
}
|
|
5261
5146
|
as(e) {
|
|
5262
5147
|
if (e === "string") {
|
|
@@ -5289,8 +5174,8 @@ const Sr = (n) => {
|
|
|
5289
5174
|
dataType: this.dataType.toString(),
|
|
5290
5175
|
sampleOffset: this.sampleOffset,
|
|
5291
5176
|
alignment: {
|
|
5292
|
-
lower:
|
|
5293
|
-
upper:
|
|
5177
|
+
lower: An(this.alignmentBounds.lower),
|
|
5178
|
+
upper: An(this.alignmentBounds.upper)
|
|
5294
5179
|
},
|
|
5295
5180
|
timeRange: (e = this._timeRange) == null ? void 0 : e.toString(),
|
|
5296
5181
|
length: this.length,
|
|
@@ -5317,10 +5202,10 @@ const Sr = (n) => {
|
|
|
5317
5202
|
}
|
|
5318
5203
|
[Symbol.iterator]() {
|
|
5319
5204
|
if (this.dataType.isVariable) {
|
|
5320
|
-
const e = new
|
|
5321
|
-
return this.dataType.equals(N.JSON) ? new
|
|
5205
|
+
const e = new ga(this);
|
|
5206
|
+
return this.dataType.equals(N.JSON) ? new va(e) : e;
|
|
5322
5207
|
}
|
|
5323
|
-
return new
|
|
5208
|
+
return new wa(this);
|
|
5324
5209
|
}
|
|
5325
5210
|
slice(e, t) {
|
|
5326
5211
|
return this.sliceSub(!1, e, t);
|
|
@@ -5329,10 +5214,10 @@ const Sr = (n) => {
|
|
|
5329
5214
|
return this.sliceSub(!0, e, t);
|
|
5330
5215
|
}
|
|
5331
5216
|
subIterator(e, t) {
|
|
5332
|
-
return new
|
|
5217
|
+
return new On(this, e, t ?? this.length);
|
|
5333
5218
|
}
|
|
5334
5219
|
subAlignmentIterator(e, t) {
|
|
5335
|
-
return new
|
|
5220
|
+
return new On(
|
|
5336
5221
|
this,
|
|
5337
5222
|
Number(e - this.alignment),
|
|
5338
5223
|
Number(t - this.alignment)
|
|
@@ -5366,31 +5251,31 @@ const Sr = (n) => {
|
|
|
5366
5251
|
return new H({
|
|
5367
5252
|
data: this.buffer,
|
|
5368
5253
|
dataType: this.dataType,
|
|
5369
|
-
timeRange:
|
|
5254
|
+
timeRange: cn.ZERO,
|
|
5370
5255
|
sampleOffset: this.sampleOffset,
|
|
5371
5256
|
glBufferUsage: "static",
|
|
5372
5257
|
alignment: e
|
|
5373
5258
|
});
|
|
5374
5259
|
}
|
|
5375
5260
|
};
|
|
5376
|
-
|
|
5377
|
-
timeRange:
|
|
5261
|
+
h(ze, "crudeZ", u.object({
|
|
5262
|
+
timeRange: cn.z.optional(),
|
|
5378
5263
|
dataType: N.z,
|
|
5379
|
-
alignment:
|
|
5264
|
+
alignment: u.coerce.bigint().optional(),
|
|
5380
5265
|
data: u.union([
|
|
5381
|
-
|
|
5382
|
-
|
|
5266
|
+
pa,
|
|
5267
|
+
ma,
|
|
5383
5268
|
u.instanceof(ArrayBuffer),
|
|
5384
5269
|
u.instanceof(Uint8Array)
|
|
5385
5270
|
]),
|
|
5386
|
-
glBufferUsage:
|
|
5387
|
-
})),
|
|
5388
|
-
let
|
|
5389
|
-
class
|
|
5271
|
+
glBufferUsage: da.optional().default("static").optional()
|
|
5272
|
+
})), h(ze, "z", ze.crudeZ.transform((n) => new ze(n)));
|
|
5273
|
+
let ya = ze;
|
|
5274
|
+
class On {
|
|
5390
5275
|
constructor(e, t, r) {
|
|
5391
|
-
|
|
5276
|
+
h(this, "series"), h(this, "end"), h(this, "index"), this.series = e;
|
|
5392
5277
|
const s = we(0, e.length);
|
|
5393
|
-
this.end =
|
|
5278
|
+
this.end = bn(s, r), this.index = bn(s, t);
|
|
5394
5279
|
}
|
|
5395
5280
|
next() {
|
|
5396
5281
|
return this.index >= this.end ? { done: !0, value: void 0 } : { done: !1, value: this.series.at(this.index++, !0) };
|
|
@@ -5399,9 +5284,9 @@ class Zn {
|
|
|
5399
5284
|
return this;
|
|
5400
5285
|
}
|
|
5401
5286
|
}
|
|
5402
|
-
class
|
|
5287
|
+
class ga {
|
|
5403
5288
|
constructor(e) {
|
|
5404
|
-
if (
|
|
5289
|
+
if (h(this, "series"), h(this, "index"), h(this, "decoder"), !e.dataType.isVariable)
|
|
5405
5290
|
throw new Error(
|
|
5406
5291
|
"cannot create a variable series iterator for a non-variable series"
|
|
5407
5292
|
);
|
|
@@ -5409,7 +5294,7 @@ class Ya {
|
|
|
5409
5294
|
}
|
|
5410
5295
|
next() {
|
|
5411
5296
|
const e = this.index, t = this.series.data;
|
|
5412
|
-
for (; this.index < t.length && t[this.index] !==
|
|
5297
|
+
for (; this.index < t.length && t[this.index] !== Gt; ) this.index++;
|
|
5413
5298
|
const r = this.index;
|
|
5414
5299
|
return e === r ? { done: !0, value: void 0 } : (this.index++, { done: !1, value: this.decoder.decode(this.series.buffer.slice(e, r)) });
|
|
5415
5300
|
}
|
|
@@ -5417,26 +5302,26 @@ class Ya {
|
|
|
5417
5302
|
return this;
|
|
5418
5303
|
}
|
|
5419
5304
|
}
|
|
5420
|
-
var
|
|
5421
|
-
class
|
|
5305
|
+
var Sn, Nn;
|
|
5306
|
+
class va {
|
|
5422
5307
|
constructor(e) {
|
|
5423
|
-
|
|
5308
|
+
h(this, "wrapped"), h(this, Sn, "JSONSeriesIterator"), this.wrapped = e;
|
|
5424
5309
|
}
|
|
5425
5310
|
next() {
|
|
5426
5311
|
const e = this.wrapped.next();
|
|
5427
5312
|
return e.done === !0 ? { done: !0, value: void 0 } : {
|
|
5428
5313
|
done: !1,
|
|
5429
|
-
value:
|
|
5314
|
+
value: pt.decodeString(e.value)
|
|
5430
5315
|
};
|
|
5431
5316
|
}
|
|
5432
|
-
[(
|
|
5317
|
+
[(Nn = Symbol.iterator, Sn = Symbol.toStringTag, Nn)]() {
|
|
5433
5318
|
return this;
|
|
5434
5319
|
}
|
|
5435
5320
|
}
|
|
5436
|
-
var
|
|
5437
|
-
class
|
|
5321
|
+
var In, kn;
|
|
5322
|
+
class wa {
|
|
5438
5323
|
constructor(e) {
|
|
5439
|
-
|
|
5324
|
+
h(this, "series"), h(this, "index"), h(this, In, "SeriesIterator"), this.series = e, this.index = 0;
|
|
5440
5325
|
}
|
|
5441
5326
|
next() {
|
|
5442
5327
|
return this.index >= this.series.length ? { done: !0, value: void 0 } : {
|
|
@@ -5444,20 +5329,86 @@ class Ja {
|
|
|
5444
5329
|
value: this.series.at(this.index++, !0)
|
|
5445
5330
|
};
|
|
5446
5331
|
}
|
|
5447
|
-
[(
|
|
5332
|
+
[(kn = Symbol.iterator, In = Symbol.toStringTag, kn)]() {
|
|
5448
5333
|
return this;
|
|
5449
5334
|
}
|
|
5450
5335
|
}
|
|
5451
|
-
const
|
|
5336
|
+
const An = (n) => {
|
|
5452
5337
|
const e = n >> 32n, t = n & 0xffffffffn;
|
|
5453
5338
|
return { domain: e, sample: t };
|
|
5454
|
-
},
|
|
5339
|
+
}, ba = (n, e, t = ".") => {
|
|
5340
|
+
const r = n.split(t);
|
|
5341
|
+
return r.map((s, i) => {
|
|
5342
|
+
const a = e(s, i, r);
|
|
5343
|
+
return a == null ? null : typeof a == "string" ? a : a.join(t);
|
|
5344
|
+
}).filter((s) => s != null).join(t);
|
|
5345
|
+
}, pr = (n, e, t = { optional: !1, separator: "." }) => {
|
|
5346
|
+
t.separator ?? (t.separator = ".");
|
|
5347
|
+
const { optional: r, getter: s = (o, c) => o[c] } = t, i = e.split(t.separator);
|
|
5348
|
+
if (i.length === 1 && i[0] === "") return n;
|
|
5349
|
+
let a = n;
|
|
5350
|
+
for (const o of i) {
|
|
5351
|
+
const c = s(a, o);
|
|
5352
|
+
if (c == null) {
|
|
5353
|
+
if (r) return null;
|
|
5354
|
+
throw new Error(`Path ${e} does not exist. ${o} is null`);
|
|
5355
|
+
}
|
|
5356
|
+
a = c;
|
|
5357
|
+
}
|
|
5358
|
+
return a;
|
|
5359
|
+
}, xa = (n, e, t) => {
|
|
5360
|
+
const r = e.split(".");
|
|
5361
|
+
let s = n;
|
|
5362
|
+
for (let i = 0; i < r.length - 1; i++) {
|
|
5363
|
+
const a = r[i];
|
|
5364
|
+
s[a] ?? (s[a] = {}), s = s[a];
|
|
5365
|
+
}
|
|
5366
|
+
try {
|
|
5367
|
+
s[r[r.length - 1]] = t;
|
|
5368
|
+
} catch (i) {
|
|
5369
|
+
throw console.error("failed to set value", t, "at path", e, "on object", n), i;
|
|
5370
|
+
}
|
|
5371
|
+
}, _a = (n, e) => {
|
|
5372
|
+
const t = e.split(".");
|
|
5373
|
+
let r = n;
|
|
5374
|
+
for (let s = 0; s < t.length - 1; s++) {
|
|
5375
|
+
const i = t[s];
|
|
5376
|
+
if (r[i] == null) return;
|
|
5377
|
+
r = r[i];
|
|
5378
|
+
}
|
|
5379
|
+
if (Array.isArray(r)) {
|
|
5380
|
+
const s = parseInt(t[t.length - 1]);
|
|
5381
|
+
if (isNaN(s)) return;
|
|
5382
|
+
r.splice(s, 1);
|
|
5383
|
+
return;
|
|
5384
|
+
}
|
|
5385
|
+
delete r[t[t.length - 1]];
|
|
5386
|
+
}, Ta = (n, e) => {
|
|
5387
|
+
const t = n.split(".");
|
|
5388
|
+
return e < 0 ? t[t.length + e] : t[e];
|
|
5389
|
+
}, Oa = (n, e) => {
|
|
5390
|
+
try {
|
|
5391
|
+
return pr(n, e), !0;
|
|
5392
|
+
} catch {
|
|
5393
|
+
return !1;
|
|
5394
|
+
}
|
|
5395
|
+
}, Sa = (n, e) => {
|
|
5396
|
+
if (e.length === 0) return !0;
|
|
5397
|
+
const t = n.split("."), r = e.split(".");
|
|
5398
|
+
if (r.length > t.length) return !1;
|
|
5399
|
+
for (let s = 0; s < r.length; s++) {
|
|
5400
|
+
const i = t[s], a = r[s];
|
|
5401
|
+
if (a !== "*" && i !== a)
|
|
5402
|
+
return !1;
|
|
5403
|
+
}
|
|
5404
|
+
return !0;
|
|
5405
|
+
}, Na = (n) => JSON.parse(JSON.stringify(n)), Ia = (n, ...e) => (e.forEach((t) => {
|
|
5455
5406
|
let r = n;
|
|
5456
5407
|
const s = t.split(".");
|
|
5457
5408
|
s.forEach((i, a) => {
|
|
5458
5409
|
a === s.length - 1 ? delete r[i] : i in r && (r = r[i]);
|
|
5459
5410
|
});
|
|
5460
|
-
}), n),
|
|
5411
|
+
}), n), ka = (n, e, t = "") => {
|
|
5461
5412
|
const r = {}, s = (i, a, o) => {
|
|
5462
5413
|
if (typeof i != typeof a || i === null || a === null) {
|
|
5463
5414
|
r[o] = [i, a];
|
|
@@ -5477,13 +5428,13 @@ const We = (n, e) => typeof n == "bigint" && typeof e == "bigint" || typeof n ==
|
|
|
5477
5428
|
else i !== a && (r[o] = [i, a]);
|
|
5478
5429
|
};
|
|
5479
5430
|
return s(n, e, t), r;
|
|
5480
|
-
},
|
|
5431
|
+
}, Jt = (n, e) => {
|
|
5481
5432
|
const t = Array.isArray(n), r = Array.isArray(e);
|
|
5482
5433
|
if (t !== r) return !1;
|
|
5483
5434
|
if (t && r) {
|
|
5484
5435
|
const a = n, o = e;
|
|
5485
5436
|
if (a.length !== o.length) return !1;
|
|
5486
|
-
for (let c = 0; c < a.length; c++) if (!
|
|
5437
|
+
for (let c = 0; c < a.length; c++) if (!Jt(a[c], o[c])) return !1;
|
|
5487
5438
|
return !0;
|
|
5488
5439
|
}
|
|
5489
5440
|
if (n == null || e == null || typeof n != "object" || typeof e != "object")
|
|
@@ -5494,94 +5445,96 @@ const We = (n, e) => typeof n == "bigint" && typeof e == "bigint" || typeof n ==
|
|
|
5494
5445
|
for (const a of s) {
|
|
5495
5446
|
const o = n[a], c = e[a];
|
|
5496
5447
|
if (typeof o == "object" && typeof c == "object") {
|
|
5497
|
-
if (!
|
|
5448
|
+
if (!Jt(o, c)) return !1;
|
|
5498
5449
|
} else if (o !== c) return !1;
|
|
5499
5450
|
}
|
|
5500
5451
|
return !0;
|
|
5501
|
-
},
|
|
5452
|
+
}, mr = (n, e) => {
|
|
5502
5453
|
if (typeof n != "object" || n == null) return n === e;
|
|
5503
5454
|
const t = Object.keys(n), r = Object.keys(e);
|
|
5504
5455
|
if (r.length > t.length) return !1;
|
|
5505
5456
|
for (const s of r) {
|
|
5506
5457
|
const i = n[s], a = e[s];
|
|
5507
5458
|
if (typeof i == "object" && typeof a == "object") {
|
|
5508
|
-
if (!
|
|
5459
|
+
if (!mr(i, a)) return !1;
|
|
5509
5460
|
} else if (i !== a) return !1;
|
|
5510
5461
|
}
|
|
5511
5462
|
return !0;
|
|
5512
|
-
},
|
|
5463
|
+
}, Ht = (n, ...e) => {
|
|
5513
5464
|
if (e.length === 0) return n;
|
|
5514
5465
|
const t = e.shift();
|
|
5515
5466
|
if (Fe(n) && Fe(t))
|
|
5516
5467
|
for (const r in t)
|
|
5517
5468
|
try {
|
|
5518
|
-
Fe(t[r]) ? (r in n || Object.assign(n, { [r]: {} }),
|
|
5469
|
+
Fe(t[r]) ? (r in n || Object.assign(n, { [r]: {} }), Ht(n[r], t[r])) : Object.assign(n, { [r]: t[r] });
|
|
5519
5470
|
} catch (s) {
|
|
5520
5471
|
throw s instanceof TypeError ? new TypeError(`.${r}: ${s.message}`) : s;
|
|
5521
5472
|
}
|
|
5522
|
-
return
|
|
5523
|
-
},
|
|
5473
|
+
return Ht(n, ...e);
|
|
5474
|
+
}, Aa = (n, e, t) => {
|
|
5524
5475
|
const r = (s, i, a) => {
|
|
5525
5476
|
for (const o in i) {
|
|
5526
|
-
const c = i[o];
|
|
5527
|
-
if (
|
|
5528
|
-
const
|
|
5529
|
-
|
|
5477
|
+
const c = i[o], l = yr(a);
|
|
5478
|
+
if (l != null && l[o]) {
|
|
5479
|
+
const p = l[o].safeParse(c);
|
|
5480
|
+
p.success && (s[o] = p.data);
|
|
5530
5481
|
} else typeof c == "object" && !Array.isArray(c) && c !== null && a && a.shape && a.shape[o] && (s[o] || (s[o] = {}), r(s[o], c, a.shape[o]));
|
|
5531
5482
|
}
|
|
5532
5483
|
return s;
|
|
5533
5484
|
};
|
|
5534
5485
|
return r({ ...n }, e, t);
|
|
5535
|
-
},
|
|
5486
|
+
}, yr = (n) => {
|
|
5487
|
+
var e;
|
|
5488
|
+
return ((e = n._def) == null ? void 0 : e.typeName) === "ZodEffects" ? yr(n._def.schema) : n == null ? void 0 : n.shape;
|
|
5489
|
+
}, gr = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
5536
5490
|
__proto__: null,
|
|
5537
|
-
copy:
|
|
5538
|
-
deleteD:
|
|
5539
|
-
difference:
|
|
5540
|
-
element:
|
|
5541
|
-
equal:
|
|
5542
|
-
get:
|
|
5543
|
-
has:
|
|
5544
|
-
override:
|
|
5545
|
-
overrideValidItems:
|
|
5546
|
-
partialEqual:
|
|
5547
|
-
pathsMatch:
|
|
5548
|
-
remove:
|
|
5549
|
-
set:
|
|
5550
|
-
transformPath:
|
|
5491
|
+
copy: Na,
|
|
5492
|
+
deleteD: Ia,
|
|
5493
|
+
difference: ka,
|
|
5494
|
+
element: Ta,
|
|
5495
|
+
equal: Jt,
|
|
5496
|
+
get: pr,
|
|
5497
|
+
has: Oa,
|
|
5498
|
+
override: Ht,
|
|
5499
|
+
overrideValidItems: Aa,
|
|
5500
|
+
partialEqual: mr,
|
|
5501
|
+
pathsMatch: Sa,
|
|
5502
|
+
remove: _a,
|
|
5503
|
+
set: xa,
|
|
5504
|
+
transformPath: ba
|
|
5551
5505
|
}, Symbol.toStringTag, { value: "Module" }));
|
|
5552
5506
|
u.object({ key: u.string(), value: u.string() });
|
|
5553
5507
|
u.record(
|
|
5554
5508
|
u.union([u.number(), u.string(), u.symbol()]),
|
|
5555
5509
|
u.unknown()
|
|
5556
5510
|
);
|
|
5557
|
-
const
|
|
5558
|
-
macos: "
|
|
5511
|
+
const vr = () => typeof process < "u" && process.versions != null && process.versions.node != null ? "node" : typeof window > "u" || window.document === void 0 ? "webworker" : "browser", Ea = vr(), wr = ["macOS", "Windows", "Linux"], $a = ["macos", "windows", "linux"], Ca = {
|
|
5512
|
+
macos: "macOS",
|
|
5559
5513
|
windows: "Windows",
|
|
5560
|
-
linux: "Linux"
|
|
5561
|
-
|
|
5562
|
-
|
|
5563
|
-
|
|
5564
|
-
);
|
|
5565
|
-
let zt;
|
|
5566
|
-
const so = () => {
|
|
5514
|
+
linux: "Linux"
|
|
5515
|
+
}, Ra = u.enum(wr).or(
|
|
5516
|
+
u.enum($a).transform((n) => Ca[n])
|
|
5517
|
+
), Ma = () => {
|
|
5567
5518
|
if (typeof window > "u") return;
|
|
5568
5519
|
const n = window.navigator.userAgent.toLowerCase();
|
|
5569
|
-
if (n.includes("mac")) return "
|
|
5520
|
+
if (n.includes("mac")) return "macOS";
|
|
5570
5521
|
if (n.includes("win")) return "Windows";
|
|
5571
5522
|
if (n.includes("linux")) return "Linux";
|
|
5572
|
-
}
|
|
5523
|
+
};
|
|
5524
|
+
let jt;
|
|
5525
|
+
const ja = (n = {}) => {
|
|
5573
5526
|
const { force: e, default: t } = n;
|
|
5574
|
-
return e ??
|
|
5575
|
-
},
|
|
5527
|
+
return e ?? jt ?? (jt = Ma(), jt ?? t);
|
|
5528
|
+
}, Bo = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
5576
5529
|
__proto__: null,
|
|
5577
|
-
OPERATING_SYSTEMS:
|
|
5578
|
-
RUNTIME:
|
|
5579
|
-
detect:
|
|
5580
|
-
getOS:
|
|
5581
|
-
osZ:
|
|
5530
|
+
OPERATING_SYSTEMS: wr,
|
|
5531
|
+
RUNTIME: Ea,
|
|
5532
|
+
detect: vr,
|
|
5533
|
+
getOS: ja,
|
|
5534
|
+
osZ: Ra
|
|
5582
5535
|
}, Symbol.toStringTag, { value: "Module" }));
|
|
5583
|
-
var
|
|
5584
|
-
const
|
|
5536
|
+
var Za = Object.defineProperty, Ba = (n, e, t) => e in n ? Za(n, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : n[e] = t, We = (n, e, t) => Ba(n, typeof e != "symbol" ? e + "" : e, t);
|
|
5537
|
+
const Ua = (...n) => n.map(br).join(""), br = (n) => (n.endsWith("/") || (n += "/"), n.startsWith("/") && (n = n.slice(1)), n), Da = (n) => n.endsWith("/") ? n.slice(0, -1) : n, En = class Xt {
|
|
5585
5538
|
/**
|
|
5586
5539
|
* @param host - The hostname or IP address of the server.
|
|
5587
5540
|
* @param port - The port number of the server.
|
|
@@ -5589,7 +5542,7 @@ const uo = (...n) => n.map(Er).join(""), Er = (n) => (n.endsWith("/") || (n += "
|
|
|
5589
5542
|
* @param pathPrefix - A path prefix to use for all requests. Defaults to "".
|
|
5590
5543
|
*/
|
|
5591
5544
|
constructor({ host: e, port: t, protocol: r = "", pathPrefix: s = "" }) {
|
|
5592
|
-
|
|
5545
|
+
We(this, "protocol"), We(this, "host"), We(this, "port"), We(this, "path"), this.protocol = r, this.host = e, this.port = t, this.path = br(s);
|
|
5593
5546
|
}
|
|
5594
5547
|
/**
|
|
5595
5548
|
* Replaces creates a new URL with the specified properties replaced.
|
|
@@ -5597,7 +5550,7 @@ const uo = (...n) => n.map(Er).join(""), Er = (n) => (n.endsWith("/") || (n += "
|
|
|
5597
5550
|
* @returns a new URL.
|
|
5598
5551
|
*/
|
|
5599
5552
|
replace(e) {
|
|
5600
|
-
return new
|
|
5553
|
+
return new Xt({
|
|
5601
5554
|
host: e.host ?? this.host,
|
|
5602
5555
|
port: e.port ?? this.port,
|
|
5603
5556
|
protocol: e.protocol ?? this.protocol,
|
|
@@ -5610,37 +5563,57 @@ const uo = (...n) => n.map(Er).join(""), Er = (n) => (n.endsWith("/") || (n += "
|
|
|
5610
5563
|
* @returns a new URL.
|
|
5611
5564
|
*/
|
|
5612
5565
|
child(e) {
|
|
5613
|
-
return new
|
|
5566
|
+
return new Xt({
|
|
5614
5567
|
...this,
|
|
5615
|
-
pathPrefix:
|
|
5568
|
+
pathPrefix: Ua(this.path, e)
|
|
5616
5569
|
});
|
|
5617
5570
|
}
|
|
5618
5571
|
/** @returns a string representation of the url */
|
|
5619
5572
|
toString() {
|
|
5620
|
-
return
|
|
5573
|
+
return Da(
|
|
5621
5574
|
`${this.protocol}://${this.host}:${this.port}/${this.path}`
|
|
5622
5575
|
);
|
|
5623
5576
|
}
|
|
5624
5577
|
};
|
|
5625
|
-
|
|
5626
|
-
|
|
5578
|
+
We(En, "UNKNOWN", new En({ host: "unknown", port: 0 }));
|
|
5579
|
+
const La = -128, Pa = 127;
|
|
5580
|
+
u.number().int().min(La).max(Pa);
|
|
5581
|
+
const za = -32768, Wa = 32767;
|
|
5582
|
+
u.number().int().min(za).max(Wa);
|
|
5583
|
+
const Va = -2147483648, qa = 2147483647;
|
|
5584
|
+
u.number().int().min(Va).max(qa);
|
|
5585
|
+
const Fa = -9223372036854775808n, Ya = 9223372036854775807n;
|
|
5586
|
+
u.bigint().min(Fa).max(Ya);
|
|
5587
|
+
const Ga = 255;
|
|
5588
|
+
u.number().int().min(0).max(Ga);
|
|
5589
|
+
const Ja = 65535;
|
|
5590
|
+
u.number().int().min(0).max(Ja);
|
|
5591
|
+
const Ha = 4294967295;
|
|
5592
|
+
u.number().int().min(0).max(Ha);
|
|
5593
|
+
const Xa = 18446744073709551615n;
|
|
5594
|
+
u.bigint().min(0n).max(Xa);
|
|
5595
|
+
var Ka = Object.defineProperty, Qa = (n, e, t) => e in n ? Ka(n, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : n[e] = t, Ve = (n, e, t) => Qa(n, typeof e != "symbol" ? e + "" : e, t);
|
|
5627
5596
|
u.object({
|
|
5628
5597
|
interval: A.z.optional(),
|
|
5629
5598
|
maxRetries: u.number().optional(),
|
|
5630
5599
|
scale: u.number().optional()
|
|
5631
5600
|
});
|
|
5632
|
-
const
|
|
5601
|
+
const te = class extends Number {
|
|
5633
5602
|
};
|
|
5634
|
-
|
|
5635
|
-
|
|
5636
|
-
|
|
5637
|
-
|
|
5603
|
+
Ve(te, "ABSOLUTE", 255), Ve(te, "MINIMUM", 0), Ve(te, "BOUNDS", {
|
|
5604
|
+
lower: te.MINIMUM,
|
|
5605
|
+
// upper bound is exclusive, so we add 1
|
|
5606
|
+
upper: te.ABSOLUTE + 1
|
|
5607
|
+
}), Ve(te, "z", u.union([
|
|
5608
|
+
u.instanceof(te),
|
|
5609
|
+
u.number().int().min(0).max(255).transform((n) => new te(n)),
|
|
5610
|
+
u.instanceof(Number).transform((n) => new te(n))
|
|
5638
5611
|
]));
|
|
5639
5612
|
u.object({
|
|
5640
5613
|
name: u.string(),
|
|
5641
5614
|
key: u.string()
|
|
5642
5615
|
});
|
|
5643
|
-
const
|
|
5616
|
+
const xr = class qe extends Error {
|
|
5644
5617
|
constructor() {
|
|
5645
5618
|
super(qe.MESSAGE);
|
|
5646
5619
|
}
|
|
@@ -5649,29 +5622,29 @@ const $r = class qe extends Error {
|
|
|
5649
5622
|
return typeof e == "string" ? e.includes(qe.MESSAGE) : e instanceof qe || e.message.includes(qe.MESSAGE);
|
|
5650
5623
|
}
|
|
5651
5624
|
};
|
|
5652
|
-
|
|
5653
|
-
let
|
|
5654
|
-
new
|
|
5625
|
+
Ve(xr, "MESSAGE", "canceled");
|
|
5626
|
+
let eo = xr;
|
|
5627
|
+
new eo();
|
|
5655
5628
|
u.string().regex(/^\d+\.\d+\.\d+$/);
|
|
5656
|
-
const
|
|
5629
|
+
const Ae = "main", ln = "prerender", dn = {
|
|
5657
5630
|
stage: "creating",
|
|
5658
5631
|
processCount: 0,
|
|
5659
5632
|
reserved: !1,
|
|
5660
5633
|
focusCount: 0,
|
|
5661
5634
|
centerCount: 0
|
|
5662
|
-
},
|
|
5663
|
-
...
|
|
5664
|
-
key:
|
|
5635
|
+
}, _r = {
|
|
5636
|
+
...dn,
|
|
5637
|
+
key: ln,
|
|
5665
5638
|
visible: !1
|
|
5666
|
-
},
|
|
5639
|
+
}, Do = u.object({
|
|
5667
5640
|
key: u.string(),
|
|
5668
5641
|
url: u.string().optional(),
|
|
5669
5642
|
title: u.string().optional(),
|
|
5670
5643
|
center: u.boolean().optional(),
|
|
5671
|
-
position:
|
|
5672
|
-
size:
|
|
5673
|
-
minSize:
|
|
5674
|
-
maxSize:
|
|
5644
|
+
position: Wt.xy.optional(),
|
|
5645
|
+
size: Mt.dimensions.optional(),
|
|
5646
|
+
minSize: Mt.dimensions.optional(),
|
|
5647
|
+
maxSize: Mt.dimensions.optional(),
|
|
5675
5648
|
resizable: u.boolean().optional(),
|
|
5676
5649
|
fullscreen: u.boolean().optional(),
|
|
5677
5650
|
focus: u.boolean().optional(),
|
|
@@ -5683,8 +5656,8 @@ const Ee = "main", On = "prerender", Sn = {
|
|
|
5683
5656
|
fileDropEnabled: u.boolean().optional(),
|
|
5684
5657
|
transparent: u.boolean().optional(),
|
|
5685
5658
|
alwaysOnTop: u.boolean().optional()
|
|
5686
|
-
}),
|
|
5687
|
-
label:
|
|
5659
|
+
}), to = A.milliseconds(50), Tr = () => setTimeout(() => window.location.reload(), to.milliseconds), no = {
|
|
5660
|
+
label: Ae,
|
|
5688
5661
|
config: {
|
|
5689
5662
|
enablePrerender: !0,
|
|
5690
5663
|
debug: !1,
|
|
@@ -5692,28 +5665,28 @@ const Ee = "main", On = "prerender", Sn = {
|
|
|
5692
5665
|
},
|
|
5693
5666
|
windows: {
|
|
5694
5667
|
main: {
|
|
5695
|
-
...
|
|
5696
|
-
key:
|
|
5668
|
+
...dn,
|
|
5669
|
+
key: Ae,
|
|
5697
5670
|
reserved: !0
|
|
5698
5671
|
}
|
|
5699
5672
|
},
|
|
5700
5673
|
labelKeys: {
|
|
5701
|
-
main:
|
|
5674
|
+
main: Ae
|
|
5702
5675
|
},
|
|
5703
5676
|
keyLabels: {
|
|
5704
|
-
main:
|
|
5677
|
+
main: Ae
|
|
5705
5678
|
}
|
|
5706
|
-
},
|
|
5707
|
-
if (n.type ===
|
|
5708
|
-
return e.label !==
|
|
5679
|
+
}, Lo = (n, e) => {
|
|
5680
|
+
if (n.type === Ao.type)
|
|
5681
|
+
return e.label !== Ae || (n.payload.label = Ft.create(), n.payload.prerenderLabel = Ft.create()), n;
|
|
5709
5682
|
if ("label" in n.payload) return n;
|
|
5710
5683
|
let t = e.label;
|
|
5711
5684
|
const r = n.payload;
|
|
5712
5685
|
return r.key != null && (r.key in e.windows ? t = r.key : t = e.keyLabels[r.key]), n.payload = { ...n.payload, label: t }, n;
|
|
5713
|
-
},
|
|
5686
|
+
}, V = (n) => (e, t) => {
|
|
5714
5687
|
if (!("label" in t.payload)) throw new Error("Missing label");
|
|
5715
5688
|
n(e, t);
|
|
5716
|
-
}, ge = (n, e = !1) =>
|
|
5689
|
+
}, ge = (n, e = !1) => V((t, r) => {
|
|
5717
5690
|
let s = e;
|
|
5718
5691
|
const i = t.windows[r.payload.label];
|
|
5719
5692
|
if (i != null) {
|
|
@@ -5724,195 +5697,195 @@ const Ee = "main", On = "prerender", Sn = {
|
|
|
5724
5697
|
}
|
|
5725
5698
|
t.windows[r.payload.label] = { ...i, [n]: s };
|
|
5726
5699
|
}
|
|
5727
|
-
}),
|
|
5700
|
+
}), $t = (n, e = !1) => (t, r) => {
|
|
5728
5701
|
const s = t.windows[r.payload.label];
|
|
5729
5702
|
s != null && (t.windows[r.payload.label] = {
|
|
5730
5703
|
...s,
|
|
5731
5704
|
[n]: s[n] + (e ? -1 : 1)
|
|
5732
5705
|
});
|
|
5733
|
-
},
|
|
5734
|
-
|
|
5735
|
-
|
|
5736
|
-
|
|
5706
|
+
}, ro = (n) => Object.values(n.windows).some((e) => e.key === ln && !e.reserved), Or = "drift", so = (n, e, t) => n.position != null && n.size != null && e == null ? ft.topLeft(
|
|
5707
|
+
ft.positionInCenter(
|
|
5708
|
+
ft.construct(Wt.ZERO, t ?? Wt.ZERO),
|
|
5709
|
+
ft.construct(n.position, n.size)
|
|
5737
5710
|
)
|
|
5738
|
-
) : e,
|
|
5739
|
-
if (e.key ===
|
|
5711
|
+
) : e, io = (n, { payload: e }) => {
|
|
5712
|
+
if (e.key === ln) return;
|
|
5740
5713
|
const { key: t, label: r, prerenderLabel: s } = e;
|
|
5741
5714
|
if (r == null || s == null)
|
|
5742
5715
|
throw new Error("[drift] - bug - missing label and prerender label");
|
|
5743
|
-
console.log(n.config.debug),
|
|
5716
|
+
console.log(n.config.debug), Ir(n.config.debug, "reducer create window");
|
|
5744
5717
|
const i = n.windows.main;
|
|
5745
|
-
if (e.position =
|
|
5746
|
-
|
|
5718
|
+
if (e.position = so(i, e.position, e.size), t in n.keyLabels) {
|
|
5719
|
+
dt(n.config.debug, "window already exists, un-minimize and focus it");
|
|
5747
5720
|
const c = n.keyLabels[e.key];
|
|
5748
|
-
n.windows[c].visible = !0, n.windows[c].focusCount += 1, n.windows[c].minimized = !1, n.windows[c].position = e.position,
|
|
5721
|
+
n.windows[c].visible = !0, n.windows[c].focusCount += 1, n.windows[c].minimized = !1, n.windows[c].position = e.position, hn(n.config.debug);
|
|
5749
5722
|
return;
|
|
5750
5723
|
}
|
|
5751
5724
|
const [a, o] = Object.entries(n.windows).find(
|
|
5752
5725
|
([, c]) => !c.reserved
|
|
5753
5726
|
) ?? [null, null];
|
|
5754
|
-
a != null ? (
|
|
5727
|
+
a != null ? (dt(n.config.debug, "using available pre-rendered window"), n.windows[a] = {
|
|
5755
5728
|
...o,
|
|
5756
5729
|
visible: !0,
|
|
5757
5730
|
reserved: !0,
|
|
5758
5731
|
focusCount: 1,
|
|
5759
5732
|
focus: !0,
|
|
5760
5733
|
...e
|
|
5761
|
-
}, n.labelKeys[a] = e.key, n.keyLabels[e.key] = a) : (
|
|
5734
|
+
}, n.labelKeys[a] = e.key, n.keyLabels[e.key] = a) : (dt(n.config.debug, "creating new window"), n.windows[r] = {
|
|
5762
5735
|
...n.config.defaultWindowProps,
|
|
5763
|
-
...
|
|
5736
|
+
...dn,
|
|
5764
5737
|
...e,
|
|
5765
5738
|
reserved: !0
|
|
5766
|
-
}, n.labelKeys[r] = t, n.keyLabels[t] = r), n.config.enablePrerender && !
|
|
5739
|
+
}, n.labelKeys[r] = t, n.keyLabels[t] = r), n.config.enablePrerender && !ro(n) && (dt(n.config.debug, "creating pre-render window"), n.windows[s] = gr.copy({
|
|
5767
5740
|
...n.config.defaultWindowProps,
|
|
5768
|
-
...
|
|
5769
|
-
})),
|
|
5770
|
-
},
|
|
5741
|
+
..._r
|
|
5742
|
+
})), hn(n.config.debug);
|
|
5743
|
+
}, ao = V((n, e) => {
|
|
5771
5744
|
const t = n.windows[e.payload.label];
|
|
5772
5745
|
t != null && (t.stage = e.payload.stage);
|
|
5773
|
-
}),
|
|
5746
|
+
}), oo = V(
|
|
5774
5747
|
(n, { payload: { label: e } }) => {
|
|
5775
5748
|
const t = n.windows[e];
|
|
5776
5749
|
t == null || t.processCount > 0 || (t.stage = "closing", delete n.windows[e], delete n.labelKeys[e], delete n.keyLabels[t.key]);
|
|
5777
5750
|
}
|
|
5778
|
-
),
|
|
5751
|
+
), uo = V((n, e) => {
|
|
5779
5752
|
const t = n.windows[e.payload.label];
|
|
5780
|
-
t == null || t.processCount > 0 || (t.stage = "reloading",
|
|
5781
|
-
}),
|
|
5782
|
-
|
|
5783
|
-
),
|
|
5784
|
-
|
|
5753
|
+
t == null || t.processCount > 0 || (t.stage = "reloading", Tr());
|
|
5754
|
+
}), co = V(
|
|
5755
|
+
$t("processCount")
|
|
5756
|
+
), lo = V((n, e) => {
|
|
5757
|
+
$t("processCount", !0)(n, e);
|
|
5785
5758
|
const t = n.windows[e.payload.label];
|
|
5786
|
-
t != null && t.processCount === 0 && (t.stage === "reloading" ?
|
|
5787
|
-
}),
|
|
5759
|
+
t != null && t.processCount === 0 && (t.stage === "reloading" ? Tr() : (n.windows[e.payload.label].visible = !1, delete n.windows[e.payload.label], delete n.labelKeys[e.payload.label], delete n.keyLabels[t.key]));
|
|
5760
|
+
}), ho = (n, e) => {
|
|
5788
5761
|
const t = n.windows[e.payload.key];
|
|
5789
5762
|
t != null && (t.error = e.payload.message);
|
|
5790
|
-
},
|
|
5763
|
+
}, fo = V((n, e) => {
|
|
5791
5764
|
const t = n.windows[e.payload.label];
|
|
5792
|
-
t != null && (t.visible !== !0 && (t.visible = !0),
|
|
5793
|
-
}),
|
|
5794
|
-
|
|
5795
|
-
),
|
|
5765
|
+
t != null && (t.visible !== !0 && (t.visible = !0), $t("focusCount")(n, e));
|
|
5766
|
+
}), po = ge("minimized"), mo = ge("maximized"), yo = ge("visible", !0), go = ge("fullscreen", !0), vo = V(
|
|
5767
|
+
$t("centerCount")
|
|
5768
|
+
), wo = V((n, e) => {
|
|
5796
5769
|
n.windows[e.payload.label].position = e.payload.position;
|
|
5797
|
-
}),
|
|
5770
|
+
}), bo = V((n, e) => {
|
|
5798
5771
|
n.windows[e.payload.label].size = e.payload.size;
|
|
5799
|
-
}),
|
|
5772
|
+
}), xo = V((n, e) => {
|
|
5800
5773
|
n.windows[e.payload.label].minSize = e.payload.size;
|
|
5801
|
-
}),
|
|
5774
|
+
}), _o = V((n, e) => {
|
|
5802
5775
|
n.windows[e.payload.label].maxSize = e.payload.size;
|
|
5803
|
-
}),
|
|
5776
|
+
}), To = ge("resizable"), Oo = ge("skipTaskbar"), So = ge("alwaysOnTop"), No = V((n, e) => {
|
|
5804
5777
|
n.windows[e.payload.label].title = e.payload.title;
|
|
5805
|
-
}),
|
|
5778
|
+
}), Io = ge("decorations"), $n = (n, e) => {
|
|
5806
5779
|
const t = n.windows[e.payload.label];
|
|
5807
|
-
|
|
5808
|
-
},
|
|
5809
|
-
if (n.config = { ...n.config, ...e.payload }, n.label = e.payload.label, n.label ===
|
|
5810
|
-
const t =
|
|
5780
|
+
gr.partialEqual(t, e.payload) || (n.windows[e.payload.label] = { ...t, ...e.payload });
|
|
5781
|
+
}, ko = (n, e) => {
|
|
5782
|
+
if (n.config = { ...n.config, ...e.payload }, n.label = e.payload.label, n.label === Ae && n.config.enablePrerender) {
|
|
5783
|
+
const t = Ft.create();
|
|
5811
5784
|
n.windows[t] = {
|
|
5812
5785
|
...n.config.defaultWindowProps,
|
|
5813
|
-
...
|
|
5786
|
+
..._r
|
|
5814
5787
|
};
|
|
5815
5788
|
}
|
|
5816
|
-
},
|
|
5817
|
-
name:
|
|
5818
|
-
initialState:
|
|
5789
|
+
}, Sr = Nr({
|
|
5790
|
+
name: Or,
|
|
5791
|
+
initialState: no,
|
|
5819
5792
|
reducers: {
|
|
5820
|
-
internalSetInitial:
|
|
5821
|
-
createWindow:
|
|
5822
|
-
setWindowStage:
|
|
5823
|
-
closeWindow:
|
|
5824
|
-
registerProcess:
|
|
5825
|
-
completeProcess:
|
|
5826
|
-
setWindowError:
|
|
5827
|
-
focusWindow:
|
|
5828
|
-
reloadWindow:
|
|
5829
|
-
setWindowMinimized:
|
|
5830
|
-
setWindowMaximized:
|
|
5831
|
-
setWindowVisible:
|
|
5832
|
-
setWindowFullscreen:
|
|
5833
|
-
centerWindow:
|
|
5834
|
-
setWindowPosition:
|
|
5835
|
-
setWindowSize:
|
|
5836
|
-
setWindowMinSize:
|
|
5837
|
-
setWindowMaxSize:
|
|
5838
|
-
setWindowResizable:
|
|
5839
|
-
setWindowSkipTaskbar:
|
|
5840
|
-
setWindowAlwaysOnTop:
|
|
5841
|
-
setWindowTitle:
|
|
5842
|
-
setWindowDecorations:
|
|
5843
|
-
runtimeSetWindowProps:
|
|
5844
|
-
setWindowProps:
|
|
5793
|
+
internalSetInitial: ko,
|
|
5794
|
+
createWindow: io,
|
|
5795
|
+
setWindowStage: ao,
|
|
5796
|
+
closeWindow: oo,
|
|
5797
|
+
registerProcess: co,
|
|
5798
|
+
completeProcess: lo,
|
|
5799
|
+
setWindowError: ho,
|
|
5800
|
+
focusWindow: fo,
|
|
5801
|
+
reloadWindow: uo,
|
|
5802
|
+
setWindowMinimized: po,
|
|
5803
|
+
setWindowMaximized: mo,
|
|
5804
|
+
setWindowVisible: yo,
|
|
5805
|
+
setWindowFullscreen: go,
|
|
5806
|
+
centerWindow: vo,
|
|
5807
|
+
setWindowPosition: wo,
|
|
5808
|
+
setWindowSize: bo,
|
|
5809
|
+
setWindowMinSize: xo,
|
|
5810
|
+
setWindowMaxSize: _o,
|
|
5811
|
+
setWindowResizable: To,
|
|
5812
|
+
setWindowSkipTaskbar: Oo,
|
|
5813
|
+
setWindowAlwaysOnTop: So,
|
|
5814
|
+
setWindowTitle: No,
|
|
5815
|
+
setWindowDecorations: Io,
|
|
5816
|
+
runtimeSetWindowProps: $n,
|
|
5817
|
+
setWindowProps: $n
|
|
5845
5818
|
}
|
|
5846
5819
|
}), {
|
|
5847
5820
|
actions: {
|
|
5848
|
-
runtimeSetWindowProps:
|
|
5849
|
-
setWindowProps:
|
|
5850
|
-
createWindow:
|
|
5851
|
-
internalSetInitial:
|
|
5852
|
-
setWindowStage:
|
|
5853
|
-
closeWindow:
|
|
5854
|
-
registerProcess:
|
|
5855
|
-
completeProcess:
|
|
5856
|
-
setWindowError:
|
|
5857
|
-
focusWindow:
|
|
5858
|
-
reloadWindow:
|
|
5859
|
-
setWindowMinimized:
|
|
5860
|
-
setWindowMaximized:
|
|
5861
|
-
setWindowVisible:
|
|
5862
|
-
setWindowFullscreen:
|
|
5863
|
-
centerWindow:
|
|
5864
|
-
setWindowPosition:
|
|
5865
|
-
setWindowSize:
|
|
5866
|
-
setWindowMinSize:
|
|
5867
|
-
setWindowMaxSize:
|
|
5868
|
-
setWindowResizable:
|
|
5869
|
-
setWindowSkipTaskbar:
|
|
5870
|
-
setWindowAlwaysOnTop:
|
|
5871
|
-
setWindowTitle:
|
|
5872
|
-
setWindowDecorations:
|
|
5873
|
-
}
|
|
5874
|
-
} =
|
|
5821
|
+
runtimeSetWindowProps: Po,
|
|
5822
|
+
setWindowProps: zo,
|
|
5823
|
+
createWindow: Ao,
|
|
5824
|
+
internalSetInitial: Eo,
|
|
5825
|
+
setWindowStage: Wo,
|
|
5826
|
+
closeWindow: Vo,
|
|
5827
|
+
registerProcess: qo,
|
|
5828
|
+
completeProcess: Fo,
|
|
5829
|
+
setWindowError: Yo,
|
|
5830
|
+
focusWindow: Go,
|
|
5831
|
+
reloadWindow: Jo,
|
|
5832
|
+
setWindowMinimized: Ho,
|
|
5833
|
+
setWindowMaximized: Xo,
|
|
5834
|
+
setWindowVisible: Ko,
|
|
5835
|
+
setWindowFullscreen: Qo,
|
|
5836
|
+
centerWindow: eu,
|
|
5837
|
+
setWindowPosition: tu,
|
|
5838
|
+
setWindowSize: nu,
|
|
5839
|
+
setWindowMinSize: ru,
|
|
5840
|
+
setWindowMaxSize: su,
|
|
5841
|
+
setWindowResizable: iu,
|
|
5842
|
+
setWindowSkipTaskbar: au,
|
|
5843
|
+
setWindowAlwaysOnTop: ou,
|
|
5844
|
+
setWindowTitle: uu,
|
|
5845
|
+
setWindowDecorations: cu
|
|
5846
|
+
}
|
|
5847
|
+
} = Sr, lu = Sr.reducer, du = (n) => n.startsWith(Or), $o = [Eo.type], hu = (n, e) => !n && !$o.includes(e);
|
|
5875
5848
|
export {
|
|
5876
|
-
|
|
5877
|
-
|
|
5878
|
-
|
|
5879
|
-
|
|
5880
|
-
|
|
5881
|
-
|
|
5882
|
-
|
|
5849
|
+
iu as A,
|
|
5850
|
+
nu as B,
|
|
5851
|
+
au as C,
|
|
5852
|
+
uu as D,
|
|
5853
|
+
Ko as E,
|
|
5854
|
+
Do as F,
|
|
5855
|
+
Wt as G,
|
|
5883
5856
|
A as H,
|
|
5884
|
-
|
|
5885
|
-
|
|
5886
|
-
|
|
5887
|
-
|
|
5888
|
-
|
|
5889
|
-
|
|
5890
|
-
|
|
5891
|
-
|
|
5892
|
-
|
|
5893
|
-
|
|
5894
|
-
|
|
5895
|
-
|
|
5896
|
-
|
|
5897
|
-
|
|
5898
|
-
|
|
5899
|
-
|
|
5900
|
-
|
|
5901
|
-
|
|
5902
|
-
|
|
5903
|
-
|
|
5904
|
-
|
|
5905
|
-
|
|
5906
|
-
|
|
5907
|
-
|
|
5908
|
-
|
|
5909
|
-
|
|
5910
|
-
|
|
5911
|
-
|
|
5912
|
-
|
|
5913
|
-
|
|
5914
|
-
|
|
5915
|
-
|
|
5916
|
-
|
|
5917
|
-
|
|
5857
|
+
dn as I,
|
|
5858
|
+
Bo as J,
|
|
5859
|
+
gr as K,
|
|
5860
|
+
ft as L,
|
|
5861
|
+
Ae as M,
|
|
5862
|
+
Or as S,
|
|
5863
|
+
no as Z,
|
|
5864
|
+
Mt as _,
|
|
5865
|
+
hn as a,
|
|
5866
|
+
Jo as b,
|
|
5867
|
+
Lo as c,
|
|
5868
|
+
Yo as d,
|
|
5869
|
+
Eo as e,
|
|
5870
|
+
Wo as f,
|
|
5871
|
+
Ir as g,
|
|
5872
|
+
Vo as h,
|
|
5873
|
+
du as i,
|
|
5874
|
+
Fo as j,
|
|
5875
|
+
Ao as k,
|
|
5876
|
+
dt as l,
|
|
5877
|
+
Go as m,
|
|
5878
|
+
lu as n,
|
|
5879
|
+
qo as o,
|
|
5880
|
+
ou as p,
|
|
5881
|
+
cu as q,
|
|
5882
|
+
Po as r,
|
|
5883
|
+
hu as s,
|
|
5884
|
+
Qo as t,
|
|
5885
|
+
su as u,
|
|
5886
|
+
Xo as v,
|
|
5887
|
+
ru as w,
|
|
5888
|
+
Ho as x,
|
|
5889
|
+
tu as y,
|
|
5890
|
+
zo as z
|
|
5918
5891
|
};
|