react-luminus-components 1.3.64 → 1.3.65
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/README.md +349 -349
- package/dist/.vite/manifest.json +85 -79
- package/dist/{PrimaryButton-BDkoxDxu.js → PrimaryButton-B-4FDBTu.js} +1 -1
- package/dist/{PrimaryButton-FETyQBrz.cjs → PrimaryButton-D597YT4l.cjs} +1 -1
- package/dist/{SimpleTooltip-CSAjJupj.js → SimpleTooltip-DKYGIm0z.js} +1 -1
- package/dist/{SimpleTooltip-SQwP-wdh.cjs → SimpleTooltip-DSvr5tFN.cjs} +1 -1
- package/dist/contexts.cjs.js +1 -1
- package/dist/contexts.es.js +26 -26
- package/dist/{dateUtils-sgEmcvkc.cjs → dateUtils-D-Kr9uyw.cjs} +1 -1
- package/dist/{dateUtils-D96W3tJV.js → dateUtils-D_TxQkwR.js} +15 -15
- package/dist/hooks/index.d.ts +1 -0
- package/dist/hooks/useClipboard/useClipboard.d.ts +4 -0
- package/dist/hooks.cjs.js +1 -1
- package/dist/hooks.es.js +452 -451
- package/dist/layout.cjs.js +1 -1
- package/dist/layout.es.js +3 -3
- package/dist/main.cjs.js +2 -2
- package/dist/main.es.js +2733 -2726
- package/dist/models/texts/ClipboardTexts.d.ts +5 -0
- package/dist/models/texts/ComponentsContextTexts.d.ts +2 -0
- package/dist/{nivo-pie.es-eJiWQGXE.js → nivo-pie.es-BDucg1Se.js} +154 -150
- package/dist/{nivo-pie.es-pXgEulo4.cjs → nivo-pie.es-DDmgfWkx.cjs} +46 -46
- package/dist/{searchUtils-dkrRKG1d.js → searchUtils-BSgX6UMV.js} +1 -1
- package/dist/{searchUtils-D-RwHhib.cjs → searchUtils-LPeUPG5Y.cjs} +1 -1
- package/dist/style.css +1 -1
- package/dist/useClipboard-B7mREbqi.js +70 -0
- package/dist/useClipboard-DQ9COBXW.cjs +1 -0
- package/dist/{useConfirm-DOdWoD_y.js → useConfirm-CA4uEYqW.js} +1 -1
- package/dist/{useConfirm-DoFn2krj.cjs → useConfirm-LVh4L1xZ.cjs} +1 -1
- package/dist/{useLocalStorageState-DLtFymVn.js → useLocalStorageState-B1YahEo2.js} +8 -8
- package/dist/{useLocalStorageState-z1tkSkg6.cjs → useLocalStorageState-bxFIq9SR.cjs} +1 -1
- package/dist/{usePermissions-C7dyau5A.cjs → usePermissions-CYf12h6x.cjs} +1 -1
- package/dist/{usePermissions-CVtO1bZt.js → usePermissions-Cb6jEqr-.js} +3 -3
- package/dist/utils.cjs.js +1 -1
- package/dist/utils.es.js +12 -12
- package/dist/variables.scss +171 -171
- package/package.json +109 -109
- package/dist/useEmployeePhotoPath-BgHzjvUU.cjs +0 -1
- package/dist/useEmployeePhotoPath-BxaDaY0V.js +0 -55
package/dist/hooks.es.js
CHANGED
|
@@ -1,50 +1,50 @@
|
|
|
1
|
-
import { U as Ye,
|
|
2
|
-
import {
|
|
3
|
-
import { u as vr } from "./useConfirm-
|
|
4
|
-
import { b as xr, a as kr, u as br } from "./useLocalStorageState-
|
|
5
|
-
import { useContext as Qe, useCallback as N, useState as
|
|
1
|
+
import { U as Ye, aJ as Ge, a6 as He } from "./nivo-pie.es-BDucg1Se.js";
|
|
2
|
+
import { aK as mr, ab as pr, am as yr } from "./nivo-pie.es-BDucg1Se.js";
|
|
3
|
+
import { u as vr } from "./useConfirm-CA4uEYqW.js";
|
|
4
|
+
import { b as xr, a as kr, u as br } from "./useLocalStorageState-B1YahEo2.js";
|
|
5
|
+
import { useContext as Qe, useCallback as N, useState as Ke, useEffect as Xe } from "react";
|
|
6
6
|
import "react-router-dom";
|
|
7
7
|
import "@azure/msal-browser";
|
|
8
8
|
import "@azure/msal-react";
|
|
9
|
-
import { i as Fe } from "./dateUtils-
|
|
9
|
+
import { i as Fe } from "./dateUtils-D_TxQkwR.js";
|
|
10
10
|
import "react-hook-form";
|
|
11
|
-
import { b as Tr,
|
|
12
|
-
import { u as
|
|
11
|
+
import { b as Tr, u as Zr, f as Sr, c as Cr, a as Nr, d as Or, e as Er } from "./useClipboard-B7mREbqi.js";
|
|
12
|
+
import { u as Ir } from "./usePermissions-Cb6jEqr-.js";
|
|
13
13
|
var x;
|
|
14
14
|
(function(r) {
|
|
15
|
-
r.assertEqual = (
|
|
16
|
-
function e(
|
|
15
|
+
r.assertEqual = (n) => n;
|
|
16
|
+
function e(n) {
|
|
17
17
|
}
|
|
18
18
|
r.assertIs = e;
|
|
19
|
-
function t(
|
|
19
|
+
function t(n) {
|
|
20
20
|
throw new Error();
|
|
21
21
|
}
|
|
22
|
-
r.assertNever = t, r.arrayToEnum = (
|
|
22
|
+
r.assertNever = t, r.arrayToEnum = (n) => {
|
|
23
23
|
const a = {};
|
|
24
|
-
for (const i of
|
|
24
|
+
for (const i of n)
|
|
25
25
|
a[i] = i;
|
|
26
26
|
return a;
|
|
27
|
-
}, r.getValidEnumValues = (
|
|
28
|
-
const a = r.objectKeys(
|
|
27
|
+
}, r.getValidEnumValues = (n) => {
|
|
28
|
+
const a = r.objectKeys(n).filter((o) => typeof n[n[o]] != "number"), i = {};
|
|
29
29
|
for (const o of a)
|
|
30
|
-
i[o] =
|
|
30
|
+
i[o] = n[o];
|
|
31
31
|
return r.objectValues(i);
|
|
32
|
-
}, r.objectValues = (
|
|
33
|
-
return
|
|
34
|
-
}), r.objectKeys = typeof Object.keys == "function" ? (
|
|
32
|
+
}, r.objectValues = (n) => r.objectKeys(n).map(function(a) {
|
|
33
|
+
return n[a];
|
|
34
|
+
}), r.objectKeys = typeof Object.keys == "function" ? (n) => Object.keys(n) : (n) => {
|
|
35
35
|
const a = [];
|
|
36
|
-
for (const i in
|
|
37
|
-
Object.prototype.hasOwnProperty.call(
|
|
36
|
+
for (const i in n)
|
|
37
|
+
Object.prototype.hasOwnProperty.call(n, i) && a.push(i);
|
|
38
38
|
return a;
|
|
39
|
-
}, r.find = (
|
|
40
|
-
for (const i of
|
|
39
|
+
}, r.find = (n, a) => {
|
|
40
|
+
for (const i of n)
|
|
41
41
|
if (a(i))
|
|
42
42
|
return i;
|
|
43
|
-
}, r.isInteger = typeof Number.isInteger == "function" ? (
|
|
44
|
-
function n
|
|
45
|
-
return
|
|
43
|
+
}, r.isInteger = typeof Number.isInteger == "function" ? (n) => Number.isInteger(n) : (n) => typeof n == "number" && isFinite(n) && Math.floor(n) === n;
|
|
44
|
+
function s(n, a = " | ") {
|
|
45
|
+
return n.map((i) => typeof i == "string" ? `'${i}'` : i).join(a);
|
|
46
46
|
}
|
|
47
|
-
r.joinValues =
|
|
47
|
+
r.joinValues = s, r.jsonStringifyReplacer = (n, a) => typeof a == "bigint" ? a.toString() : a;
|
|
48
48
|
})(x || (x = {}));
|
|
49
49
|
var Ce;
|
|
50
50
|
(function(r) {
|
|
@@ -116,10 +116,10 @@ const f = x.arrayToEnum([
|
|
|
116
116
|
]), et = (r) => JSON.stringify(r, null, 2).replace(/"([^"]+)":/g, "$1:");
|
|
117
117
|
class E extends Error {
|
|
118
118
|
constructor(e) {
|
|
119
|
-
super(), this.issues = [], this.addIssue = (
|
|
120
|
-
this.issues = [...this.issues,
|
|
121
|
-
}, this.addIssues = (
|
|
122
|
-
this.issues = [...this.issues, ...
|
|
119
|
+
super(), this.issues = [], this.addIssue = (s) => {
|
|
120
|
+
this.issues = [...this.issues, s];
|
|
121
|
+
}, this.addIssues = (s = []) => {
|
|
122
|
+
this.issues = [...this.issues, ...s];
|
|
123
123
|
};
|
|
124
124
|
const t = new.target.prototype;
|
|
125
125
|
Object.setPrototypeOf ? Object.setPrototypeOf(this, t) : this.__proto__ = t, this.name = "ZodError", this.issues = e;
|
|
@@ -130,25 +130,25 @@ class E extends Error {
|
|
|
130
130
|
format(e) {
|
|
131
131
|
const t = e || function(a) {
|
|
132
132
|
return a.message;
|
|
133
|
-
},
|
|
133
|
+
}, s = { _errors: [] }, n = (a) => {
|
|
134
134
|
for (const i of a.issues)
|
|
135
135
|
if (i.code === "invalid_union")
|
|
136
|
-
i.unionErrors.map(
|
|
136
|
+
i.unionErrors.map(n);
|
|
137
137
|
else if (i.code === "invalid_return_type")
|
|
138
|
-
|
|
138
|
+
n(i.returnTypeError);
|
|
139
139
|
else if (i.code === "invalid_arguments")
|
|
140
|
-
|
|
140
|
+
n(i.argumentsError);
|
|
141
141
|
else if (i.path.length === 0)
|
|
142
|
-
|
|
142
|
+
s._errors.push(t(i));
|
|
143
143
|
else {
|
|
144
|
-
let o =
|
|
144
|
+
let o = s, u = 0;
|
|
145
145
|
for (; u < i.path.length; ) {
|
|
146
146
|
const c = i.path[u];
|
|
147
147
|
u === i.path.length - 1 ? (o[c] = o[c] || { _errors: [] }, o[c]._errors.push(t(i))) : o[c] = o[c] || { _errors: [] }, o = o[c], u++;
|
|
148
148
|
}
|
|
149
149
|
}
|
|
150
150
|
};
|
|
151
|
-
return
|
|
151
|
+
return n(this), s;
|
|
152
152
|
}
|
|
153
153
|
static assert(e) {
|
|
154
154
|
if (!(e instanceof E))
|
|
@@ -164,10 +164,10 @@ class E extends Error {
|
|
|
164
164
|
return this.issues.length === 0;
|
|
165
165
|
}
|
|
166
166
|
flatten(e = (t) => t.message) {
|
|
167
|
-
const t = {},
|
|
168
|
-
for (const
|
|
169
|
-
|
|
170
|
-
return { formErrors:
|
|
167
|
+
const t = {}, s = [];
|
|
168
|
+
for (const n of this.issues)
|
|
169
|
+
n.path.length > 0 ? (t[n.path[0]] = t[n.path[0]] || [], t[n.path[0]].push(e(n))) : s.push(e(n));
|
|
170
|
+
return { formErrors: s, fieldErrors: t };
|
|
171
171
|
}
|
|
172
172
|
get formErrors() {
|
|
173
173
|
return this.flatten();
|
|
@@ -238,28 +238,28 @@ function ve() {
|
|
|
238
238
|
return Me;
|
|
239
239
|
}
|
|
240
240
|
const ge = (r) => {
|
|
241
|
-
const { data: e, path: t, errorMaps:
|
|
242
|
-
...
|
|
241
|
+
const { data: e, path: t, errorMaps: s, issueData: n } = r, a = [...t, ...n.path || []], i = {
|
|
242
|
+
...n,
|
|
243
243
|
path: a
|
|
244
244
|
};
|
|
245
|
-
if (
|
|
245
|
+
if (n.message !== void 0)
|
|
246
246
|
return {
|
|
247
|
-
...
|
|
247
|
+
...n,
|
|
248
248
|
path: a,
|
|
249
|
-
message:
|
|
249
|
+
message: n.message
|
|
250
250
|
};
|
|
251
251
|
let o = "";
|
|
252
|
-
const u =
|
|
252
|
+
const u = s.filter((c) => !!c).slice().reverse();
|
|
253
253
|
for (const c of u)
|
|
254
254
|
o = c(i, { data: e, defaultError: o }).message;
|
|
255
255
|
return {
|
|
256
|
-
...
|
|
256
|
+
...n,
|
|
257
257
|
path: a,
|
|
258
258
|
message: o
|
|
259
259
|
};
|
|
260
260
|
}, rt = [];
|
|
261
261
|
function l(r, e) {
|
|
262
|
-
const t = ve(),
|
|
262
|
+
const t = ve(), s = ge({
|
|
263
263
|
issueData: e,
|
|
264
264
|
data: r.data,
|
|
265
265
|
path: r.path,
|
|
@@ -269,9 +269,9 @@ function l(r, e) {
|
|
|
269
269
|
t,
|
|
270
270
|
t === Q ? void 0 : Q
|
|
271
271
|
// then global default map
|
|
272
|
-
].filter((
|
|
272
|
+
].filter((n) => !!n)
|
|
273
273
|
});
|
|
274
|
-
r.common.issues.push(
|
|
274
|
+
r.common.issues.push(s);
|
|
275
275
|
}
|
|
276
276
|
class Z {
|
|
277
277
|
constructor() {
|
|
@@ -284,45 +284,45 @@ class Z {
|
|
|
284
284
|
this.value !== "aborted" && (this.value = "aborted");
|
|
285
285
|
}
|
|
286
286
|
static mergeArray(e, t) {
|
|
287
|
-
const
|
|
288
|
-
for (const
|
|
289
|
-
if (
|
|
287
|
+
const s = [];
|
|
288
|
+
for (const n of t) {
|
|
289
|
+
if (n.status === "aborted")
|
|
290
290
|
return y;
|
|
291
|
-
|
|
291
|
+
n.status === "dirty" && e.dirty(), s.push(n.value);
|
|
292
292
|
}
|
|
293
|
-
return { status: e.value, value:
|
|
293
|
+
return { status: e.value, value: s };
|
|
294
294
|
}
|
|
295
295
|
static async mergeObjectAsync(e, t) {
|
|
296
|
-
const
|
|
297
|
-
for (const
|
|
298
|
-
const a = await
|
|
299
|
-
|
|
296
|
+
const s = [];
|
|
297
|
+
for (const n of t) {
|
|
298
|
+
const a = await n.key, i = await n.value;
|
|
299
|
+
s.push({
|
|
300
300
|
key: a,
|
|
301
301
|
value: i
|
|
302
302
|
});
|
|
303
303
|
}
|
|
304
|
-
return Z.mergeObjectSync(e,
|
|
304
|
+
return Z.mergeObjectSync(e, s);
|
|
305
305
|
}
|
|
306
306
|
static mergeObjectSync(e, t) {
|
|
307
|
-
const
|
|
308
|
-
for (const
|
|
309
|
-
const { key: a, value: i } =
|
|
307
|
+
const s = {};
|
|
308
|
+
for (const n of t) {
|
|
309
|
+
const { key: a, value: i } = n;
|
|
310
310
|
if (a.status === "aborted" || i.status === "aborted")
|
|
311
311
|
return y;
|
|
312
|
-
a.status === "dirty" && e.dirty(), i.status === "dirty" && e.dirty(), a.value !== "__proto__" && (typeof i.value < "u" ||
|
|
312
|
+
a.status === "dirty" && e.dirty(), i.status === "dirty" && e.dirty(), a.value !== "__proto__" && (typeof i.value < "u" || n.alwaysSet) && (s[a.value] = i.value);
|
|
313
313
|
}
|
|
314
|
-
return { status: e.value, value:
|
|
314
|
+
return { status: e.value, value: s };
|
|
315
315
|
}
|
|
316
316
|
}
|
|
317
317
|
const y = Object.freeze({
|
|
318
318
|
status: "aborted"
|
|
319
|
-
}), G = (r) => ({ status: "dirty", value: r }), S = (r) => ({ status: "valid", value: r }), Ne = (r) => r.status === "aborted", Oe = (r) => r.status === "dirty", re = (r) => r.status === "valid",
|
|
320
|
-
function xe(r, e, t,
|
|
321
|
-
if (typeof e == "function" ? r !== e || !
|
|
319
|
+
}), G = (r) => ({ status: "dirty", value: r }), S = (r) => ({ status: "valid", value: r }), Ne = (r) => r.status === "aborted", Oe = (r) => r.status === "dirty", re = (r) => r.status === "valid", se = (r) => typeof Promise < "u" && r instanceof Promise;
|
|
320
|
+
function xe(r, e, t, s) {
|
|
321
|
+
if (typeof e == "function" ? r !== e || !s : !e.has(r)) throw new TypeError("Cannot read private member from an object whose class did not declare it");
|
|
322
322
|
return e.get(r);
|
|
323
323
|
}
|
|
324
|
-
function $e(r, e, t,
|
|
325
|
-
if (typeof e == "function" ? r !== e || !
|
|
324
|
+
function $e(r, e, t, s, n) {
|
|
325
|
+
if (typeof e == "function" ? r !== e || !n : !e.has(r)) throw new TypeError("Cannot write private member to an object whose class did not declare it");
|
|
326
326
|
return e.set(r, t), t;
|
|
327
327
|
}
|
|
328
328
|
var h;
|
|
@@ -331,8 +331,8 @@ var h;
|
|
|
331
331
|
})(h || (h = {}));
|
|
332
332
|
var ee, te;
|
|
333
333
|
class M {
|
|
334
|
-
constructor(e, t,
|
|
335
|
-
this._cachedPath = [], this.parent = e, this.data = t, this._path =
|
|
334
|
+
constructor(e, t, s, n) {
|
|
335
|
+
this._cachedPath = [], this.parent = e, this.data = t, this._path = s, this._key = n;
|
|
336
336
|
}
|
|
337
337
|
get path() {
|
|
338
338
|
return this._cachedPath.length || (this._key instanceof Array ? this._cachedPath.push(...this._path, ...this._key) : this._cachedPath.push(...this._path, this._key)), this._cachedPath;
|
|
@@ -356,14 +356,14 @@ const je = (r, e) => {
|
|
|
356
356
|
function _(r) {
|
|
357
357
|
if (!r)
|
|
358
358
|
return {};
|
|
359
|
-
const { errorMap: e, invalid_type_error: t, required_error:
|
|
360
|
-
if (e && (t ||
|
|
359
|
+
const { errorMap: e, invalid_type_error: t, required_error: s, description: n } = r;
|
|
360
|
+
if (e && (t || s))
|
|
361
361
|
throw new Error(`Can't use "invalid_type_error" or "required_error" in conjunction with custom error map.`);
|
|
362
|
-
return e ? { errorMap: e, description:
|
|
362
|
+
return e ? { errorMap: e, description: n } : { errorMap: (i, o) => {
|
|
363
363
|
var u, c;
|
|
364
364
|
const { message: p } = r;
|
|
365
|
-
return i.code === "invalid_enum_value" ? { message: p ?? o.defaultError } : typeof o.data > "u" ? { message: (u = p ??
|
|
366
|
-
}, description:
|
|
365
|
+
return i.code === "invalid_enum_value" ? { message: p ?? o.defaultError } : typeof o.data > "u" ? { message: (u = p ?? s) !== null && u !== void 0 ? u : o.defaultError } : i.code !== "invalid_type" ? { message: o.defaultError } : { message: (c = p ?? t) !== null && c !== void 0 ? c : o.defaultError };
|
|
366
|
+
}, description: n };
|
|
367
367
|
}
|
|
368
368
|
class v {
|
|
369
369
|
constructor(e) {
|
|
@@ -400,7 +400,7 @@ class v {
|
|
|
400
400
|
}
|
|
401
401
|
_parseSync(e) {
|
|
402
402
|
const t = this._parse(e);
|
|
403
|
-
if (
|
|
403
|
+
if (se(t))
|
|
404
404
|
throw new Error("Synchronous parse encountered promise.");
|
|
405
405
|
return t;
|
|
406
406
|
}
|
|
@@ -409,17 +409,17 @@ class v {
|
|
|
409
409
|
return Promise.resolve(t);
|
|
410
410
|
}
|
|
411
411
|
parse(e, t) {
|
|
412
|
-
const
|
|
413
|
-
if (
|
|
414
|
-
return
|
|
415
|
-
throw
|
|
412
|
+
const s = this.safeParse(e, t);
|
|
413
|
+
if (s.success)
|
|
414
|
+
return s.data;
|
|
415
|
+
throw s.error;
|
|
416
416
|
}
|
|
417
417
|
safeParse(e, t) {
|
|
418
|
-
var
|
|
419
|
-
const
|
|
418
|
+
var s;
|
|
419
|
+
const n = {
|
|
420
420
|
common: {
|
|
421
421
|
issues: [],
|
|
422
|
-
async: (
|
|
422
|
+
async: (s = t == null ? void 0 : t.async) !== null && s !== void 0 ? s : !1,
|
|
423
423
|
contextualErrorMap: t == null ? void 0 : t.errorMap
|
|
424
424
|
},
|
|
425
425
|
path: (t == null ? void 0 : t.path) || [],
|
|
@@ -427,17 +427,17 @@ class v {
|
|
|
427
427
|
parent: null,
|
|
428
428
|
data: e,
|
|
429
429
|
parsedType: D(e)
|
|
430
|
-
}, a = this._parseSync({ data: e, path:
|
|
431
|
-
return je(
|
|
430
|
+
}, a = this._parseSync({ data: e, path: n.path, parent: n });
|
|
431
|
+
return je(n, a);
|
|
432
432
|
}
|
|
433
433
|
async parseAsync(e, t) {
|
|
434
|
-
const
|
|
435
|
-
if (
|
|
436
|
-
return
|
|
437
|
-
throw
|
|
434
|
+
const s = await this.safeParseAsync(e, t);
|
|
435
|
+
if (s.success)
|
|
436
|
+
return s.data;
|
|
437
|
+
throw s.error;
|
|
438
438
|
}
|
|
439
439
|
async safeParseAsync(e, t) {
|
|
440
|
-
const
|
|
440
|
+
const s = {
|
|
441
441
|
common: {
|
|
442
442
|
issues: [],
|
|
443
443
|
contextualErrorMap: t == null ? void 0 : t.errorMap,
|
|
@@ -448,21 +448,21 @@ class v {
|
|
|
448
448
|
parent: null,
|
|
449
449
|
data: e,
|
|
450
450
|
parsedType: D(e)
|
|
451
|
-
},
|
|
452
|
-
return je(
|
|
451
|
+
}, n = this._parse({ data: e, path: s.path, parent: s }), a = await (se(n) ? n : Promise.resolve(n));
|
|
452
|
+
return je(s, a);
|
|
453
453
|
}
|
|
454
454
|
refine(e, t) {
|
|
455
|
-
const
|
|
456
|
-
return this._refinement((
|
|
457
|
-
const i = e(
|
|
455
|
+
const s = (n) => typeof t == "string" || typeof t > "u" ? { message: t } : typeof t == "function" ? t(n) : t;
|
|
456
|
+
return this._refinement((n, a) => {
|
|
457
|
+
const i = e(n), o = () => a.addIssue({
|
|
458
458
|
code: d.custom,
|
|
459
|
-
...n
|
|
459
|
+
...s(n)
|
|
460
460
|
});
|
|
461
461
|
return typeof Promise < "u" && i instanceof Promise ? i.then((u) => u ? !0 : (o(), !1)) : i ? !0 : (o(), !1);
|
|
462
462
|
});
|
|
463
463
|
}
|
|
464
464
|
refinement(e, t) {
|
|
465
|
-
return this._refinement((
|
|
465
|
+
return this._refinement((s, n) => e(s) ? !0 : (n.addIssue(typeof t == "function" ? t(s, n) : t), !1));
|
|
466
466
|
}
|
|
467
467
|
_refinement(e) {
|
|
468
468
|
return new j({
|
|
@@ -487,7 +487,7 @@ class v {
|
|
|
487
487
|
return I.create(this, this._def);
|
|
488
488
|
}
|
|
489
489
|
promise() {
|
|
490
|
-
return
|
|
490
|
+
return X.create(this, this._def);
|
|
491
491
|
}
|
|
492
492
|
or(e) {
|
|
493
493
|
return oe.create([this, e], this._def);
|
|
@@ -548,7 +548,7 @@ class v {
|
|
|
548
548
|
return this.safeParse(null).success;
|
|
549
549
|
}
|
|
550
550
|
}
|
|
551
|
-
const
|
|
551
|
+
const st = /^c[^\s-]{8,}$/i, nt = /^[0-9a-z]+$/, at = /^[0-9A-HJKMNP-TV-Z]{26}$/, it = /^[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, ot = /^[a-z0-9_-]{21}$/i, dt = /^[-+]?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)?)??$/, ct = /^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i, ut = "^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$";
|
|
552
552
|
let Se;
|
|
553
553
|
const lt = /^(?:(?: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])$/, ft = /^(([a-f0-9]{1,4}:){7}|::([a-f0-9]{1,4}:){0,6}|([a-f0-9]{1,4}:){1}:([a-f0-9]{1,4}:){0,5}|([a-f0-9]{1,4}:){2}:([a-f0-9]{1,4}:){0,4}|([a-f0-9]{1,4}:){3}:([a-f0-9]{1,4}:){0,3}|([a-f0-9]{1,4}:){4}:([a-f0-9]{1,4}:){0,2}|([a-f0-9]{1,4}:){5}:([a-f0-9]{1,4}:){0,1})([a-f0-9]{1,4}|(((25[0-5])|(2[0-4][0-9])|(1[0-9]{2})|([0-9]{1,2}))\.){3}((25[0-5])|(2[0-4][0-9])|(1[0-9]{2})|([0-9]{1,2})))$/, ht = /^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/, Pe = "((\\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])))", mt = new RegExp(`^${Pe}$`);
|
|
554
554
|
function Ve(r) {
|
|
@@ -576,144 +576,144 @@ class R extends v {
|
|
|
576
576
|
received: a.parsedType
|
|
577
577
|
}), y;
|
|
578
578
|
}
|
|
579
|
-
const
|
|
580
|
-
let
|
|
579
|
+
const s = new Z();
|
|
580
|
+
let n;
|
|
581
581
|
for (const a of this._def.checks)
|
|
582
582
|
if (a.kind === "min")
|
|
583
|
-
e.data.length < a.value && (
|
|
583
|
+
e.data.length < a.value && (n = this._getOrReturnCtx(e, n), l(n, {
|
|
584
584
|
code: d.too_small,
|
|
585
585
|
minimum: a.value,
|
|
586
586
|
type: "string",
|
|
587
587
|
inclusive: !0,
|
|
588
588
|
exact: !1,
|
|
589
589
|
message: a.message
|
|
590
|
-
}),
|
|
590
|
+
}), s.dirty());
|
|
591
591
|
else if (a.kind === "max")
|
|
592
|
-
e.data.length > a.value && (
|
|
592
|
+
e.data.length > a.value && (n = this._getOrReturnCtx(e, n), l(n, {
|
|
593
593
|
code: d.too_big,
|
|
594
594
|
maximum: a.value,
|
|
595
595
|
type: "string",
|
|
596
596
|
inclusive: !0,
|
|
597
597
|
exact: !1,
|
|
598
598
|
message: a.message
|
|
599
|
-
}),
|
|
599
|
+
}), s.dirty());
|
|
600
600
|
else if (a.kind === "length") {
|
|
601
601
|
const i = e.data.length > a.value, o = e.data.length < a.value;
|
|
602
|
-
(i || o) && (
|
|
602
|
+
(i || o) && (n = this._getOrReturnCtx(e, n), i ? l(n, {
|
|
603
603
|
code: d.too_big,
|
|
604
604
|
maximum: a.value,
|
|
605
605
|
type: "string",
|
|
606
606
|
inclusive: !0,
|
|
607
607
|
exact: !0,
|
|
608
608
|
message: a.message
|
|
609
|
-
}) : o && l(
|
|
609
|
+
}) : o && l(n, {
|
|
610
610
|
code: d.too_small,
|
|
611
611
|
minimum: a.value,
|
|
612
612
|
type: "string",
|
|
613
613
|
inclusive: !0,
|
|
614
614
|
exact: !0,
|
|
615
615
|
message: a.message
|
|
616
|
-
}),
|
|
616
|
+
}), s.dirty());
|
|
617
617
|
} else if (a.kind === "email")
|
|
618
|
-
ct.test(e.data) || (
|
|
618
|
+
ct.test(e.data) || (n = this._getOrReturnCtx(e, n), l(n, {
|
|
619
619
|
validation: "email",
|
|
620
620
|
code: d.invalid_string,
|
|
621
621
|
message: a.message
|
|
622
|
-
}),
|
|
622
|
+
}), s.dirty());
|
|
623
623
|
else if (a.kind === "emoji")
|
|
624
|
-
Se || (Se = new RegExp(ut, "u")), Se.test(e.data) || (
|
|
624
|
+
Se || (Se = new RegExp(ut, "u")), Se.test(e.data) || (n = this._getOrReturnCtx(e, n), l(n, {
|
|
625
625
|
validation: "emoji",
|
|
626
626
|
code: d.invalid_string,
|
|
627
627
|
message: a.message
|
|
628
|
-
}),
|
|
628
|
+
}), s.dirty());
|
|
629
629
|
else if (a.kind === "uuid")
|
|
630
|
-
it.test(e.data) || (
|
|
630
|
+
it.test(e.data) || (n = this._getOrReturnCtx(e, n), l(n, {
|
|
631
631
|
validation: "uuid",
|
|
632
632
|
code: d.invalid_string,
|
|
633
633
|
message: a.message
|
|
634
|
-
}),
|
|
634
|
+
}), s.dirty());
|
|
635
635
|
else if (a.kind === "nanoid")
|
|
636
|
-
ot.test(e.data) || (
|
|
636
|
+
ot.test(e.data) || (n = this._getOrReturnCtx(e, n), l(n, {
|
|
637
637
|
validation: "nanoid",
|
|
638
638
|
code: d.invalid_string,
|
|
639
639
|
message: a.message
|
|
640
|
-
}),
|
|
640
|
+
}), s.dirty());
|
|
641
641
|
else if (a.kind === "cuid")
|
|
642
|
-
|
|
642
|
+
st.test(e.data) || (n = this._getOrReturnCtx(e, n), l(n, {
|
|
643
643
|
validation: "cuid",
|
|
644
644
|
code: d.invalid_string,
|
|
645
645
|
message: a.message
|
|
646
|
-
}),
|
|
646
|
+
}), s.dirty());
|
|
647
647
|
else if (a.kind === "cuid2")
|
|
648
|
-
|
|
648
|
+
nt.test(e.data) || (n = this._getOrReturnCtx(e, n), l(n, {
|
|
649
649
|
validation: "cuid2",
|
|
650
650
|
code: d.invalid_string,
|
|
651
651
|
message: a.message
|
|
652
|
-
}),
|
|
652
|
+
}), s.dirty());
|
|
653
653
|
else if (a.kind === "ulid")
|
|
654
|
-
at.test(e.data) || (
|
|
654
|
+
at.test(e.data) || (n = this._getOrReturnCtx(e, n), l(n, {
|
|
655
655
|
validation: "ulid",
|
|
656
656
|
code: d.invalid_string,
|
|
657
657
|
message: a.message
|
|
658
|
-
}),
|
|
658
|
+
}), s.dirty());
|
|
659
659
|
else if (a.kind === "url")
|
|
660
660
|
try {
|
|
661
661
|
new URL(e.data);
|
|
662
662
|
} catch {
|
|
663
|
-
|
|
663
|
+
n = this._getOrReturnCtx(e, n), l(n, {
|
|
664
664
|
validation: "url",
|
|
665
665
|
code: d.invalid_string,
|
|
666
666
|
message: a.message
|
|
667
|
-
}),
|
|
667
|
+
}), s.dirty();
|
|
668
668
|
}
|
|
669
|
-
else a.kind === "regex" ? (a.regex.lastIndex = 0, a.regex.test(e.data) || (
|
|
669
|
+
else a.kind === "regex" ? (a.regex.lastIndex = 0, a.regex.test(e.data) || (n = this._getOrReturnCtx(e, n), l(n, {
|
|
670
670
|
validation: "regex",
|
|
671
671
|
code: d.invalid_string,
|
|
672
672
|
message: a.message
|
|
673
|
-
}),
|
|
673
|
+
}), s.dirty())) : a.kind === "trim" ? e.data = e.data.trim() : a.kind === "includes" ? e.data.includes(a.value, a.position) || (n = this._getOrReturnCtx(e, n), l(n, {
|
|
674
674
|
code: d.invalid_string,
|
|
675
675
|
validation: { includes: a.value, position: a.position },
|
|
676
676
|
message: a.message
|
|
677
|
-
}),
|
|
677
|
+
}), s.dirty()) : a.kind === "toLowerCase" ? e.data = e.data.toLowerCase() : a.kind === "toUpperCase" ? e.data = e.data.toUpperCase() : a.kind === "startsWith" ? e.data.startsWith(a.value) || (n = this._getOrReturnCtx(e, n), l(n, {
|
|
678
678
|
code: d.invalid_string,
|
|
679
679
|
validation: { startsWith: a.value },
|
|
680
680
|
message: a.message
|
|
681
|
-
}),
|
|
681
|
+
}), s.dirty()) : a.kind === "endsWith" ? e.data.endsWith(a.value) || (n = this._getOrReturnCtx(e, n), l(n, {
|
|
682
682
|
code: d.invalid_string,
|
|
683
683
|
validation: { endsWith: a.value },
|
|
684
684
|
message: a.message
|
|
685
|
-
}),
|
|
685
|
+
}), s.dirty()) : a.kind === "datetime" ? De(a).test(e.data) || (n = this._getOrReturnCtx(e, n), l(n, {
|
|
686
686
|
code: d.invalid_string,
|
|
687
687
|
validation: "datetime",
|
|
688
688
|
message: a.message
|
|
689
|
-
}),
|
|
689
|
+
}), s.dirty()) : a.kind === "date" ? mt.test(e.data) || (n = this._getOrReturnCtx(e, n), l(n, {
|
|
690
690
|
code: d.invalid_string,
|
|
691
691
|
validation: "date",
|
|
692
692
|
message: a.message
|
|
693
|
-
}),
|
|
693
|
+
}), s.dirty()) : a.kind === "time" ? pt(a).test(e.data) || (n = this._getOrReturnCtx(e, n), l(n, {
|
|
694
694
|
code: d.invalid_string,
|
|
695
695
|
validation: "time",
|
|
696
696
|
message: a.message
|
|
697
|
-
}),
|
|
697
|
+
}), s.dirty()) : a.kind === "duration" ? dt.test(e.data) || (n = this._getOrReturnCtx(e, n), l(n, {
|
|
698
698
|
validation: "duration",
|
|
699
699
|
code: d.invalid_string,
|
|
700
700
|
message: a.message
|
|
701
|
-
}),
|
|
701
|
+
}), s.dirty()) : a.kind === "ip" ? yt(e.data, a.version) || (n = this._getOrReturnCtx(e, n), l(n, {
|
|
702
702
|
validation: "ip",
|
|
703
703
|
code: d.invalid_string,
|
|
704
704
|
message: a.message
|
|
705
|
-
}),
|
|
705
|
+
}), s.dirty()) : a.kind === "base64" ? ht.test(e.data) || (n = this._getOrReturnCtx(e, n), l(n, {
|
|
706
706
|
validation: "base64",
|
|
707
707
|
code: d.invalid_string,
|
|
708
708
|
message: a.message
|
|
709
|
-
}),
|
|
710
|
-
return { status:
|
|
709
|
+
}), s.dirty()) : x.assertNever(a);
|
|
710
|
+
return { status: s.value, value: e.data };
|
|
711
711
|
}
|
|
712
|
-
_regex(e, t,
|
|
713
|
-
return this.refinement((
|
|
712
|
+
_regex(e, t, s) {
|
|
713
|
+
return this.refinement((n) => e.test(n), {
|
|
714
714
|
validation: t,
|
|
715
715
|
code: d.invalid_string,
|
|
716
|
-
...h.errToObj(
|
|
716
|
+
...h.errToObj(s)
|
|
717
717
|
});
|
|
718
718
|
}
|
|
719
719
|
_addCheck(e) {
|
|
@@ -753,7 +753,7 @@ class R extends v {
|
|
|
753
753
|
return this._addCheck({ kind: "ip", ...h.errToObj(e) });
|
|
754
754
|
}
|
|
755
755
|
datetime(e) {
|
|
756
|
-
var t,
|
|
756
|
+
var t, s;
|
|
757
757
|
return typeof e == "string" ? this._addCheck({
|
|
758
758
|
kind: "datetime",
|
|
759
759
|
precision: null,
|
|
@@ -764,7 +764,7 @@ class R extends v {
|
|
|
764
764
|
kind: "datetime",
|
|
765
765
|
precision: typeof (e == null ? void 0 : e.precision) > "u" ? null : e == null ? void 0 : e.precision,
|
|
766
766
|
offset: (t = e == null ? void 0 : e.offset) !== null && t !== void 0 ? t : !1,
|
|
767
|
-
local: (
|
|
767
|
+
local: (s = e == null ? void 0 : e.local) !== null && s !== void 0 ? s : !1,
|
|
768
768
|
...h.errToObj(e == null ? void 0 : e.message)
|
|
769
769
|
});
|
|
770
770
|
}
|
|
@@ -925,8 +925,8 @@ R.create = (r) => {
|
|
|
925
925
|
});
|
|
926
926
|
};
|
|
927
927
|
function _t(r, e) {
|
|
928
|
-
const t = (r.toString().split(".")[1] || "").length,
|
|
929
|
-
return a % i / Math.pow(10,
|
|
928
|
+
const t = (r.toString().split(".")[1] || "").length, s = (e.toString().split(".")[1] || "").length, n = t > s ? t : s, a = parseInt(r.toFixed(n).replace(".", "")), i = parseInt(e.toFixed(n).replace(".", ""));
|
|
929
|
+
return a % i / Math.pow(10, n);
|
|
930
930
|
}
|
|
931
931
|
class z extends v {
|
|
932
932
|
constructor() {
|
|
@@ -941,37 +941,37 @@ class z extends v {
|
|
|
941
941
|
received: a.parsedType
|
|
942
942
|
}), y;
|
|
943
943
|
}
|
|
944
|
-
let
|
|
945
|
-
const
|
|
944
|
+
let s;
|
|
945
|
+
const n = new Z();
|
|
946
946
|
for (const a of this._def.checks)
|
|
947
|
-
a.kind === "int" ? x.isInteger(e.data) || (
|
|
947
|
+
a.kind === "int" ? x.isInteger(e.data) || (s = this._getOrReturnCtx(e, s), l(s, {
|
|
948
948
|
code: d.invalid_type,
|
|
949
949
|
expected: "integer",
|
|
950
950
|
received: "float",
|
|
951
951
|
message: a.message
|
|
952
|
-
}),
|
|
952
|
+
}), n.dirty()) : a.kind === "min" ? (a.inclusive ? e.data < a.value : e.data <= a.value) && (s = this._getOrReturnCtx(e, s), l(s, {
|
|
953
953
|
code: d.too_small,
|
|
954
954
|
minimum: a.value,
|
|
955
955
|
type: "number",
|
|
956
956
|
inclusive: a.inclusive,
|
|
957
957
|
exact: !1,
|
|
958
958
|
message: a.message
|
|
959
|
-
}),
|
|
959
|
+
}), n.dirty()) : a.kind === "max" ? (a.inclusive ? e.data > a.value : e.data >= a.value) && (s = this._getOrReturnCtx(e, s), l(s, {
|
|
960
960
|
code: d.too_big,
|
|
961
961
|
maximum: a.value,
|
|
962
962
|
type: "number",
|
|
963
963
|
inclusive: a.inclusive,
|
|
964
964
|
exact: !1,
|
|
965
965
|
message: a.message
|
|
966
|
-
}),
|
|
966
|
+
}), n.dirty()) : a.kind === "multipleOf" ? _t(e.data, a.value) !== 0 && (s = this._getOrReturnCtx(e, s), l(s, {
|
|
967
967
|
code: d.not_multiple_of,
|
|
968
968
|
multipleOf: a.value,
|
|
969
969
|
message: a.message
|
|
970
|
-
}),
|
|
970
|
+
}), n.dirty()) : a.kind === "finite" ? Number.isFinite(e.data) || (s = this._getOrReturnCtx(e, s), l(s, {
|
|
971
971
|
code: d.not_finite,
|
|
972
972
|
message: a.message
|
|
973
|
-
}),
|
|
974
|
-
return { status:
|
|
973
|
+
}), n.dirty()) : x.assertNever(a);
|
|
974
|
+
return { status: n.value, value: e.data };
|
|
975
975
|
}
|
|
976
976
|
gte(e, t) {
|
|
977
977
|
return this.setLimit("min", e, !0, h.toString(t));
|
|
@@ -985,7 +985,7 @@ class z extends v {
|
|
|
985
985
|
lt(e, t) {
|
|
986
986
|
return this.setLimit("max", e, !1, h.toString(t));
|
|
987
987
|
}
|
|
988
|
-
setLimit(e, t,
|
|
988
|
+
setLimit(e, t, s, n) {
|
|
989
989
|
return new z({
|
|
990
990
|
...this._def,
|
|
991
991
|
checks: [
|
|
@@ -993,8 +993,8 @@ class z extends v {
|
|
|
993
993
|
{
|
|
994
994
|
kind: e,
|
|
995
995
|
value: t,
|
|
996
|
-
inclusive:
|
|
997
|
-
message: h.toString(
|
|
996
|
+
inclusive: s,
|
|
997
|
+
message: h.toString(n)
|
|
998
998
|
}
|
|
999
999
|
]
|
|
1000
1000
|
});
|
|
@@ -1086,10 +1086,10 @@ class z extends v {
|
|
|
1086
1086
|
}
|
|
1087
1087
|
get isFinite() {
|
|
1088
1088
|
let e = null, t = null;
|
|
1089
|
-
for (const
|
|
1090
|
-
if (
|
|
1089
|
+
for (const s of this._def.checks) {
|
|
1090
|
+
if (s.kind === "finite" || s.kind === "int" || s.kind === "multipleOf")
|
|
1091
1091
|
return !0;
|
|
1092
|
-
|
|
1092
|
+
s.kind === "min" ? (t === null || s.value > t) && (t = s.value) : s.kind === "max" && (e === null || s.value < e) && (e = s.value);
|
|
1093
1093
|
}
|
|
1094
1094
|
return Number.isFinite(t) && Number.isFinite(e);
|
|
1095
1095
|
}
|
|
@@ -1113,27 +1113,27 @@ class L extends v {
|
|
|
1113
1113
|
received: a.parsedType
|
|
1114
1114
|
}), y;
|
|
1115
1115
|
}
|
|
1116
|
-
let
|
|
1117
|
-
const
|
|
1116
|
+
let s;
|
|
1117
|
+
const n = new Z();
|
|
1118
1118
|
for (const a of this._def.checks)
|
|
1119
|
-
a.kind === "min" ? (a.inclusive ? e.data < a.value : e.data <= a.value) && (
|
|
1119
|
+
a.kind === "min" ? (a.inclusive ? e.data < a.value : e.data <= a.value) && (s = this._getOrReturnCtx(e, s), l(s, {
|
|
1120
1120
|
code: d.too_small,
|
|
1121
1121
|
type: "bigint",
|
|
1122
1122
|
minimum: a.value,
|
|
1123
1123
|
inclusive: a.inclusive,
|
|
1124
1124
|
message: a.message
|
|
1125
|
-
}),
|
|
1125
|
+
}), n.dirty()) : a.kind === "max" ? (a.inclusive ? e.data > a.value : e.data >= a.value) && (s = this._getOrReturnCtx(e, s), l(s, {
|
|
1126
1126
|
code: d.too_big,
|
|
1127
1127
|
type: "bigint",
|
|
1128
1128
|
maximum: a.value,
|
|
1129
1129
|
inclusive: a.inclusive,
|
|
1130
1130
|
message: a.message
|
|
1131
|
-
}),
|
|
1131
|
+
}), n.dirty()) : a.kind === "multipleOf" ? e.data % a.value !== BigInt(0) && (s = this._getOrReturnCtx(e, s), l(s, {
|
|
1132
1132
|
code: d.not_multiple_of,
|
|
1133
1133
|
multipleOf: a.value,
|
|
1134
1134
|
message: a.message
|
|
1135
|
-
}),
|
|
1136
|
-
return { status:
|
|
1135
|
+
}), n.dirty()) : x.assertNever(a);
|
|
1136
|
+
return { status: n.value, value: e.data };
|
|
1137
1137
|
}
|
|
1138
1138
|
gte(e, t) {
|
|
1139
1139
|
return this.setLimit("min", e, !0, h.toString(t));
|
|
@@ -1147,7 +1147,7 @@ class L extends v {
|
|
|
1147
1147
|
lt(e, t) {
|
|
1148
1148
|
return this.setLimit("max", e, !1, h.toString(t));
|
|
1149
1149
|
}
|
|
1150
|
-
setLimit(e, t,
|
|
1150
|
+
setLimit(e, t, s, n) {
|
|
1151
1151
|
return new L({
|
|
1152
1152
|
...this._def,
|
|
1153
1153
|
checks: [
|
|
@@ -1155,8 +1155,8 @@ class L extends v {
|
|
|
1155
1155
|
{
|
|
1156
1156
|
kind: e,
|
|
1157
1157
|
value: t,
|
|
1158
|
-
inclusive:
|
|
1159
|
-
message: h.toString(
|
|
1158
|
+
inclusive: s,
|
|
1159
|
+
message: h.toString(n)
|
|
1160
1160
|
}
|
|
1161
1161
|
]
|
|
1162
1162
|
});
|
|
@@ -1228,20 +1228,20 @@ L.create = (r) => {
|
|
|
1228
1228
|
..._(r)
|
|
1229
1229
|
});
|
|
1230
1230
|
};
|
|
1231
|
-
class
|
|
1231
|
+
class ne extends v {
|
|
1232
1232
|
_parse(e) {
|
|
1233
1233
|
if (this._def.coerce && (e.data = !!e.data), this._getType(e) !== f.boolean) {
|
|
1234
|
-
const
|
|
1235
|
-
return l(
|
|
1234
|
+
const s = this._getOrReturnCtx(e);
|
|
1235
|
+
return l(s, {
|
|
1236
1236
|
code: d.invalid_type,
|
|
1237
1237
|
expected: f.boolean,
|
|
1238
|
-
received:
|
|
1238
|
+
received: s.parsedType
|
|
1239
1239
|
}), y;
|
|
1240
1240
|
}
|
|
1241
1241
|
return S(e.data);
|
|
1242
1242
|
}
|
|
1243
1243
|
}
|
|
1244
|
-
|
|
1244
|
+
ne.create = (r) => new ne({
|
|
1245
1245
|
typeName: m.ZodBoolean,
|
|
1246
1246
|
coerce: (r == null ? void 0 : r.coerce) || !1,
|
|
1247
1247
|
..._(r)
|
|
@@ -1262,26 +1262,26 @@ class W extends v {
|
|
|
1262
1262
|
code: d.invalid_date
|
|
1263
1263
|
}), y;
|
|
1264
1264
|
}
|
|
1265
|
-
const
|
|
1266
|
-
let
|
|
1265
|
+
const s = new Z();
|
|
1266
|
+
let n;
|
|
1267
1267
|
for (const a of this._def.checks)
|
|
1268
|
-
a.kind === "min" ? e.data.getTime() < a.value && (
|
|
1268
|
+
a.kind === "min" ? e.data.getTime() < a.value && (n = this._getOrReturnCtx(e, n), l(n, {
|
|
1269
1269
|
code: d.too_small,
|
|
1270
1270
|
message: a.message,
|
|
1271
1271
|
inclusive: !0,
|
|
1272
1272
|
exact: !1,
|
|
1273
1273
|
minimum: a.value,
|
|
1274
1274
|
type: "date"
|
|
1275
|
-
}),
|
|
1275
|
+
}), s.dirty()) : a.kind === "max" ? e.data.getTime() > a.value && (n = this._getOrReturnCtx(e, n), l(n, {
|
|
1276
1276
|
code: d.too_big,
|
|
1277
1277
|
message: a.message,
|
|
1278
1278
|
inclusive: !0,
|
|
1279
1279
|
exact: !1,
|
|
1280
1280
|
maximum: a.value,
|
|
1281
1281
|
type: "date"
|
|
1282
|
-
}),
|
|
1282
|
+
}), s.dirty()) : x.assertNever(a);
|
|
1283
1283
|
return {
|
|
1284
|
-
status:
|
|
1284
|
+
status: s.value,
|
|
1285
1285
|
value: new Date(e.data.getTime())
|
|
1286
1286
|
};
|
|
1287
1287
|
}
|
|
@@ -1327,11 +1327,11 @@ W.create = (r) => new W({
|
|
|
1327
1327
|
class ke extends v {
|
|
1328
1328
|
_parse(e) {
|
|
1329
1329
|
if (this._getType(e) !== f.symbol) {
|
|
1330
|
-
const
|
|
1331
|
-
return l(
|
|
1330
|
+
const s = this._getOrReturnCtx(e);
|
|
1331
|
+
return l(s, {
|
|
1332
1332
|
code: d.invalid_type,
|
|
1333
1333
|
expected: f.symbol,
|
|
1334
|
-
received:
|
|
1334
|
+
received: s.parsedType
|
|
1335
1335
|
}), y;
|
|
1336
1336
|
}
|
|
1337
1337
|
return S(e.data);
|
|
@@ -1344,11 +1344,11 @@ ke.create = (r) => new ke({
|
|
|
1344
1344
|
class ae extends v {
|
|
1345
1345
|
_parse(e) {
|
|
1346
1346
|
if (this._getType(e) !== f.undefined) {
|
|
1347
|
-
const
|
|
1348
|
-
return l(
|
|
1347
|
+
const s = this._getOrReturnCtx(e);
|
|
1348
|
+
return l(s, {
|
|
1349
1349
|
code: d.invalid_type,
|
|
1350
1350
|
expected: f.undefined,
|
|
1351
|
-
received:
|
|
1351
|
+
received: s.parsedType
|
|
1352
1352
|
}), y;
|
|
1353
1353
|
}
|
|
1354
1354
|
return S(e.data);
|
|
@@ -1361,11 +1361,11 @@ ae.create = (r) => new ae({
|
|
|
1361
1361
|
class ie extends v {
|
|
1362
1362
|
_parse(e) {
|
|
1363
1363
|
if (this._getType(e) !== f.null) {
|
|
1364
|
-
const
|
|
1365
|
-
return l(
|
|
1364
|
+
const s = this._getOrReturnCtx(e);
|
|
1365
|
+
return l(s, {
|
|
1366
1366
|
code: d.invalid_type,
|
|
1367
1367
|
expected: f.null,
|
|
1368
|
-
received:
|
|
1368
|
+
received: s.parsedType
|
|
1369
1369
|
}), y;
|
|
1370
1370
|
}
|
|
1371
1371
|
return S(e.data);
|
|
@@ -1375,7 +1375,7 @@ ie.create = (r) => new ie({
|
|
|
1375
1375
|
typeName: m.ZodNull,
|
|
1376
1376
|
..._(r)
|
|
1377
1377
|
});
|
|
1378
|
-
class
|
|
1378
|
+
class K extends v {
|
|
1379
1379
|
constructor() {
|
|
1380
1380
|
super(...arguments), this._any = !0;
|
|
1381
1381
|
}
|
|
@@ -1383,7 +1383,7 @@ class X extends v {
|
|
|
1383
1383
|
return S(e.data);
|
|
1384
1384
|
}
|
|
1385
1385
|
}
|
|
1386
|
-
|
|
1386
|
+
K.create = (r) => new K({
|
|
1387
1387
|
typeName: m.ZodAny,
|
|
1388
1388
|
..._(r)
|
|
1389
1389
|
});
|
|
@@ -1416,11 +1416,11 @@ V.create = (r) => new V({
|
|
|
1416
1416
|
class be extends v {
|
|
1417
1417
|
_parse(e) {
|
|
1418
1418
|
if (this._getType(e) !== f.undefined) {
|
|
1419
|
-
const
|
|
1420
|
-
return l(
|
|
1419
|
+
const s = this._getOrReturnCtx(e);
|
|
1420
|
+
return l(s, {
|
|
1421
1421
|
code: d.invalid_type,
|
|
1422
1422
|
expected: f.void,
|
|
1423
|
-
received:
|
|
1423
|
+
received: s.parsedType
|
|
1424
1424
|
}), y;
|
|
1425
1425
|
}
|
|
1426
1426
|
return S(e.data);
|
|
@@ -1432,43 +1432,43 @@ be.create = (r) => new be({
|
|
|
1432
1432
|
});
|
|
1433
1433
|
class I extends v {
|
|
1434
1434
|
_parse(e) {
|
|
1435
|
-
const { ctx: t, status:
|
|
1435
|
+
const { ctx: t, status: s } = this._processInputParams(e), n = this._def;
|
|
1436
1436
|
if (t.parsedType !== f.array)
|
|
1437
1437
|
return l(t, {
|
|
1438
1438
|
code: d.invalid_type,
|
|
1439
1439
|
expected: f.array,
|
|
1440
1440
|
received: t.parsedType
|
|
1441
1441
|
}), y;
|
|
1442
|
-
if (
|
|
1443
|
-
const i = t.data.length >
|
|
1442
|
+
if (n.exactLength !== null) {
|
|
1443
|
+
const i = t.data.length > n.exactLength.value, o = t.data.length < n.exactLength.value;
|
|
1444
1444
|
(i || o) && (l(t, {
|
|
1445
1445
|
code: i ? d.too_big : d.too_small,
|
|
1446
|
-
minimum: o ?
|
|
1447
|
-
maximum: i ?
|
|
1446
|
+
minimum: o ? n.exactLength.value : void 0,
|
|
1447
|
+
maximum: i ? n.exactLength.value : void 0,
|
|
1448
1448
|
type: "array",
|
|
1449
1449
|
inclusive: !0,
|
|
1450
1450
|
exact: !0,
|
|
1451
|
-
message:
|
|
1452
|
-
}),
|
|
1451
|
+
message: n.exactLength.message
|
|
1452
|
+
}), s.dirty());
|
|
1453
1453
|
}
|
|
1454
|
-
if (
|
|
1454
|
+
if (n.minLength !== null && t.data.length < n.minLength.value && (l(t, {
|
|
1455
1455
|
code: d.too_small,
|
|
1456
|
-
minimum:
|
|
1456
|
+
minimum: n.minLength.value,
|
|
1457
1457
|
type: "array",
|
|
1458
1458
|
inclusive: !0,
|
|
1459
1459
|
exact: !1,
|
|
1460
|
-
message:
|
|
1461
|
-
}),
|
|
1460
|
+
message: n.minLength.message
|
|
1461
|
+
}), s.dirty()), n.maxLength !== null && t.data.length > n.maxLength.value && (l(t, {
|
|
1462
1462
|
code: d.too_big,
|
|
1463
|
-
maximum:
|
|
1463
|
+
maximum: n.maxLength.value,
|
|
1464
1464
|
type: "array",
|
|
1465
1465
|
inclusive: !0,
|
|
1466
1466
|
exact: !1,
|
|
1467
|
-
message:
|
|
1468
|
-
}),
|
|
1469
|
-
return Promise.all([...t.data].map((i, o) =>
|
|
1470
|
-
const a = [...t.data].map((i, o) =>
|
|
1471
|
-
return Z.mergeArray(
|
|
1467
|
+
message: n.maxLength.message
|
|
1468
|
+
}), s.dirty()), t.common.async)
|
|
1469
|
+
return Promise.all([...t.data].map((i, o) => n.type._parseAsync(new M(t, i, t.path, o)))).then((i) => Z.mergeArray(s, i));
|
|
1470
|
+
const a = [...t.data].map((i, o) => n.type._parseSync(new M(t, i, t.path, o)));
|
|
1471
|
+
return Z.mergeArray(s, a);
|
|
1472
1472
|
}
|
|
1473
1473
|
get element() {
|
|
1474
1474
|
return this._def.type;
|
|
@@ -1507,8 +1507,8 @@ function Y(r) {
|
|
|
1507
1507
|
if (r instanceof b) {
|
|
1508
1508
|
const e = {};
|
|
1509
1509
|
for (const t in r.shape) {
|
|
1510
|
-
const
|
|
1511
|
-
e[t] = A.create(Y(
|
|
1510
|
+
const s = r.shape[t];
|
|
1511
|
+
e[t] = A.create(Y(s));
|
|
1512
1512
|
}
|
|
1513
1513
|
return new b({
|
|
1514
1514
|
...r._def,
|
|
@@ -1538,17 +1538,17 @@ class b extends v {
|
|
|
1538
1538
|
received: c.parsedType
|
|
1539
1539
|
}), y;
|
|
1540
1540
|
}
|
|
1541
|
-
const { status:
|
|
1541
|
+
const { status: s, ctx: n } = this._processInputParams(e), { shape: a, keys: i } = this._getCached(), o = [];
|
|
1542
1542
|
if (!(this._def.catchall instanceof V && this._def.unknownKeys === "strip"))
|
|
1543
|
-
for (const c in
|
|
1543
|
+
for (const c in n.data)
|
|
1544
1544
|
i.includes(c) || o.push(c);
|
|
1545
1545
|
const u = [];
|
|
1546
1546
|
for (const c of i) {
|
|
1547
|
-
const p = a[c], C =
|
|
1547
|
+
const p = a[c], C = n.data[c];
|
|
1548
1548
|
u.push({
|
|
1549
1549
|
key: { status: "valid", value: c },
|
|
1550
|
-
value: p._parse(new M(
|
|
1551
|
-
alwaysSet: c in
|
|
1550
|
+
value: p._parse(new M(n, C, n.path, c)),
|
|
1551
|
+
alwaysSet: c in n.data
|
|
1552
1552
|
});
|
|
1553
1553
|
}
|
|
1554
1554
|
if (this._def.catchall instanceof V) {
|
|
@@ -1557,29 +1557,29 @@ class b extends v {
|
|
|
1557
1557
|
for (const p of o)
|
|
1558
1558
|
u.push({
|
|
1559
1559
|
key: { status: "valid", value: p },
|
|
1560
|
-
value: { status: "valid", value:
|
|
1560
|
+
value: { status: "valid", value: n.data[p] }
|
|
1561
1561
|
});
|
|
1562
1562
|
else if (c === "strict")
|
|
1563
|
-
o.length > 0 && (l(
|
|
1563
|
+
o.length > 0 && (l(n, {
|
|
1564
1564
|
code: d.unrecognized_keys,
|
|
1565
1565
|
keys: o
|
|
1566
|
-
}),
|
|
1566
|
+
}), s.dirty());
|
|
1567
1567
|
else if (c !== "strip") throw new Error("Internal ZodObject error: invalid unknownKeys value.");
|
|
1568
1568
|
} else {
|
|
1569
1569
|
const c = this._def.catchall;
|
|
1570
1570
|
for (const p of o) {
|
|
1571
|
-
const C =
|
|
1571
|
+
const C = n.data[p];
|
|
1572
1572
|
u.push({
|
|
1573
1573
|
key: { status: "valid", value: p },
|
|
1574
1574
|
value: c._parse(
|
|
1575
|
-
new M(
|
|
1575
|
+
new M(n, C, n.path, p)
|
|
1576
1576
|
//, ctx.child(key), value, getParsedType(value)
|
|
1577
1577
|
),
|
|
1578
|
-
alwaysSet: p in
|
|
1578
|
+
alwaysSet: p in n.data
|
|
1579
1579
|
});
|
|
1580
1580
|
}
|
|
1581
1581
|
}
|
|
1582
|
-
return
|
|
1582
|
+
return n.common.async ? Promise.resolve().then(async () => {
|
|
1583
1583
|
const c = [];
|
|
1584
1584
|
for (const p of u) {
|
|
1585
1585
|
const C = await p.key, _e = await p.value;
|
|
@@ -1590,7 +1590,7 @@ class b extends v {
|
|
|
1590
1590
|
});
|
|
1591
1591
|
}
|
|
1592
1592
|
return c;
|
|
1593
|
-
}).then((c) => Z.mergeObjectSync(
|
|
1593
|
+
}).then((c) => Z.mergeObjectSync(s, c)) : Z.mergeObjectSync(s, u);
|
|
1594
1594
|
}
|
|
1595
1595
|
get shape() {
|
|
1596
1596
|
return this._def.shape();
|
|
@@ -1600,9 +1600,9 @@ class b extends v {
|
|
|
1600
1600
|
...this._def,
|
|
1601
1601
|
unknownKeys: "strict",
|
|
1602
1602
|
...e !== void 0 ? {
|
|
1603
|
-
errorMap: (t,
|
|
1604
|
-
var
|
|
1605
|
-
const u = (i = (a = (
|
|
1603
|
+
errorMap: (t, s) => {
|
|
1604
|
+
var n, a, i, o;
|
|
1605
|
+
const u = (i = (a = (n = this._def).errorMap) === null || a === void 0 ? void 0 : a.call(n, t, s).message) !== null && i !== void 0 ? i : s.defaultError;
|
|
1606
1606
|
return t.code === "unrecognized_keys" ? {
|
|
1607
1607
|
message: (o = h.errToObj(e).message) !== null && o !== void 0 ? o : u
|
|
1608
1608
|
} : {
|
|
@@ -1733,8 +1733,8 @@ class b extends v {
|
|
|
1733
1733
|
}
|
|
1734
1734
|
pick(e) {
|
|
1735
1735
|
const t = {};
|
|
1736
|
-
return x.objectKeys(e).forEach((
|
|
1737
|
-
e[
|
|
1736
|
+
return x.objectKeys(e).forEach((s) => {
|
|
1737
|
+
e[s] && this.shape[s] && (t[s] = this.shape[s]);
|
|
1738
1738
|
}), new b({
|
|
1739
1739
|
...this._def,
|
|
1740
1740
|
shape: () => t
|
|
@@ -1742,8 +1742,8 @@ class b extends v {
|
|
|
1742
1742
|
}
|
|
1743
1743
|
omit(e) {
|
|
1744
1744
|
const t = {};
|
|
1745
|
-
return x.objectKeys(this.shape).forEach((
|
|
1746
|
-
e[
|
|
1745
|
+
return x.objectKeys(this.shape).forEach((s) => {
|
|
1746
|
+
e[s] || (t[s] = this.shape[s]);
|
|
1747
1747
|
}), new b({
|
|
1748
1748
|
...this._def,
|
|
1749
1749
|
shape: () => t
|
|
@@ -1757,9 +1757,9 @@ class b extends v {
|
|
|
1757
1757
|
}
|
|
1758
1758
|
partial(e) {
|
|
1759
1759
|
const t = {};
|
|
1760
|
-
return x.objectKeys(this.shape).forEach((
|
|
1761
|
-
const
|
|
1762
|
-
e && !e[
|
|
1760
|
+
return x.objectKeys(this.shape).forEach((s) => {
|
|
1761
|
+
const n = this.shape[s];
|
|
1762
|
+
e && !e[s] ? t[s] = n : t[s] = n.optional();
|
|
1763
1763
|
}), new b({
|
|
1764
1764
|
...this._def,
|
|
1765
1765
|
shape: () => t
|
|
@@ -1767,14 +1767,14 @@ class b extends v {
|
|
|
1767
1767
|
}
|
|
1768
1768
|
required(e) {
|
|
1769
1769
|
const t = {};
|
|
1770
|
-
return x.objectKeys(this.shape).forEach((
|
|
1771
|
-
if (e && !e[
|
|
1772
|
-
t[
|
|
1770
|
+
return x.objectKeys(this.shape).forEach((s) => {
|
|
1771
|
+
if (e && !e[s])
|
|
1772
|
+
t[s] = this.shape[s];
|
|
1773
1773
|
else {
|
|
1774
|
-
let a = this.shape[
|
|
1774
|
+
let a = this.shape[s];
|
|
1775
1775
|
for (; a instanceof A; )
|
|
1776
1776
|
a = a._def.innerType;
|
|
1777
|
-
t[
|
|
1777
|
+
t[s] = a;
|
|
1778
1778
|
}
|
|
1779
1779
|
}), new b({
|
|
1780
1780
|
...this._def,
|
|
@@ -1808,8 +1808,8 @@ b.lazycreate = (r, e) => new b({
|
|
|
1808
1808
|
});
|
|
1809
1809
|
class oe extends v {
|
|
1810
1810
|
_parse(e) {
|
|
1811
|
-
const { ctx: t } = this._processInputParams(e),
|
|
1812
|
-
function
|
|
1811
|
+
const { ctx: t } = this._processInputParams(e), s = this._def.options;
|
|
1812
|
+
function n(a) {
|
|
1813
1813
|
for (const o of a)
|
|
1814
1814
|
if (o.result.status === "valid")
|
|
1815
1815
|
return o.result;
|
|
@@ -1823,7 +1823,7 @@ class oe extends v {
|
|
|
1823
1823
|
}), y;
|
|
1824
1824
|
}
|
|
1825
1825
|
if (t.common.async)
|
|
1826
|
-
return Promise.all(
|
|
1826
|
+
return Promise.all(s.map(async (a) => {
|
|
1827
1827
|
const i = {
|
|
1828
1828
|
...t,
|
|
1829
1829
|
common: {
|
|
@@ -1840,11 +1840,11 @@ class oe extends v {
|
|
|
1840
1840
|
}),
|
|
1841
1841
|
ctx: i
|
|
1842
1842
|
};
|
|
1843
|
-
})).then(
|
|
1843
|
+
})).then(n);
|
|
1844
1844
|
{
|
|
1845
1845
|
let a;
|
|
1846
1846
|
const i = [];
|
|
1847
|
-
for (const u of
|
|
1847
|
+
for (const u of s) {
|
|
1848
1848
|
const c = {
|
|
1849
1849
|
...t,
|
|
1850
1850
|
common: {
|
|
@@ -1889,7 +1889,7 @@ class Ze extends v {
|
|
|
1889
1889
|
expected: f.object,
|
|
1890
1890
|
received: t.parsedType
|
|
1891
1891
|
}), y;
|
|
1892
|
-
const
|
|
1892
|
+
const s = this.discriminator, n = t.data[s], a = this.optionsMap.get(n);
|
|
1893
1893
|
return a ? t.common.async ? a._parseAsync({
|
|
1894
1894
|
data: t.data,
|
|
1895
1895
|
path: t.path,
|
|
@@ -1901,7 +1901,7 @@ class Ze extends v {
|
|
|
1901
1901
|
}) : (l(t, {
|
|
1902
1902
|
code: d.invalid_union_discriminator,
|
|
1903
1903
|
options: Array.from(this.optionsMap.keys()),
|
|
1904
|
-
path: [
|
|
1904
|
+
path: [s]
|
|
1905
1905
|
}), y);
|
|
1906
1906
|
}
|
|
1907
1907
|
get discriminator() {
|
|
@@ -1921,33 +1921,33 @@ class Ze extends v {
|
|
|
1921
1921
|
* @param types an array of object schemas
|
|
1922
1922
|
* @param params
|
|
1923
1923
|
*/
|
|
1924
|
-
static create(e, t,
|
|
1925
|
-
const
|
|
1924
|
+
static create(e, t, s) {
|
|
1925
|
+
const n = /* @__PURE__ */ new Map();
|
|
1926
1926
|
for (const a of t) {
|
|
1927
1927
|
const i = P(a.shape[e]);
|
|
1928
1928
|
if (!i.length)
|
|
1929
1929
|
throw new Error(`A discriminator value for key \`${e}\` could not be extracted from all schema options`);
|
|
1930
1930
|
for (const o of i) {
|
|
1931
|
-
if (
|
|
1931
|
+
if (n.has(o))
|
|
1932
1932
|
throw new Error(`Discriminator property ${String(e)} has duplicate value ${String(o)}`);
|
|
1933
|
-
|
|
1933
|
+
n.set(o, a);
|
|
1934
1934
|
}
|
|
1935
1935
|
}
|
|
1936
1936
|
return new Ze({
|
|
1937
1937
|
typeName: m.ZodDiscriminatedUnion,
|
|
1938
1938
|
discriminator: e,
|
|
1939
1939
|
options: t,
|
|
1940
|
-
optionsMap:
|
|
1941
|
-
..._(
|
|
1940
|
+
optionsMap: n,
|
|
1941
|
+
..._(s)
|
|
1942
1942
|
});
|
|
1943
1943
|
}
|
|
1944
1944
|
}
|
|
1945
1945
|
function Ee(r, e) {
|
|
1946
|
-
const t = D(r),
|
|
1946
|
+
const t = D(r), s = D(e);
|
|
1947
1947
|
if (r === e)
|
|
1948
1948
|
return { valid: !0, data: r };
|
|
1949
|
-
if (t === f.object &&
|
|
1950
|
-
const
|
|
1949
|
+
if (t === f.object && s === f.object) {
|
|
1950
|
+
const n = x.objectKeys(e), a = x.objectKeys(r).filter((o) => n.indexOf(o) !== -1), i = { ...r, ...e };
|
|
1951
1951
|
for (const o of a) {
|
|
1952
1952
|
const u = Ee(r[o], e[o]);
|
|
1953
1953
|
if (!u.valid)
|
|
@@ -1955,48 +1955,48 @@ function Ee(r, e) {
|
|
|
1955
1955
|
i[o] = u.data;
|
|
1956
1956
|
}
|
|
1957
1957
|
return { valid: !0, data: i };
|
|
1958
|
-
} else if (t === f.array &&
|
|
1958
|
+
} else if (t === f.array && s === f.array) {
|
|
1959
1959
|
if (r.length !== e.length)
|
|
1960
1960
|
return { valid: !1 };
|
|
1961
|
-
const
|
|
1961
|
+
const n = [];
|
|
1962
1962
|
for (let a = 0; a < r.length; a++) {
|
|
1963
1963
|
const i = r[a], o = e[a], u = Ee(i, o);
|
|
1964
1964
|
if (!u.valid)
|
|
1965
1965
|
return { valid: !1 };
|
|
1966
|
-
|
|
1966
|
+
n.push(u.data);
|
|
1967
1967
|
}
|
|
1968
|
-
return { valid: !0, data:
|
|
1969
|
-
} else return t === f.date &&
|
|
1968
|
+
return { valid: !0, data: n };
|
|
1969
|
+
} else return t === f.date && s === f.date && +r == +e ? { valid: !0, data: r } : { valid: !1 };
|
|
1970
1970
|
}
|
|
1971
1971
|
class de extends v {
|
|
1972
1972
|
_parse(e) {
|
|
1973
|
-
const { status: t, ctx:
|
|
1973
|
+
const { status: t, ctx: s } = this._processInputParams(e), n = (a, i) => {
|
|
1974
1974
|
if (Ne(a) || Ne(i))
|
|
1975
1975
|
return y;
|
|
1976
1976
|
const o = Ee(a.value, i.value);
|
|
1977
|
-
return o.valid ? ((Oe(a) || Oe(i)) && t.dirty(), { status: t.value, value: o.data }) : (l(
|
|
1977
|
+
return o.valid ? ((Oe(a) || Oe(i)) && t.dirty(), { status: t.value, value: o.data }) : (l(s, {
|
|
1978
1978
|
code: d.invalid_intersection_types
|
|
1979
1979
|
}), y);
|
|
1980
1980
|
};
|
|
1981
|
-
return
|
|
1981
|
+
return s.common.async ? Promise.all([
|
|
1982
1982
|
this._def.left._parseAsync({
|
|
1983
|
-
data:
|
|
1984
|
-
path:
|
|
1985
|
-
parent:
|
|
1983
|
+
data: s.data,
|
|
1984
|
+
path: s.path,
|
|
1985
|
+
parent: s
|
|
1986
1986
|
}),
|
|
1987
1987
|
this._def.right._parseAsync({
|
|
1988
|
-
data:
|
|
1989
|
-
path:
|
|
1990
|
-
parent:
|
|
1988
|
+
data: s.data,
|
|
1989
|
+
path: s.path,
|
|
1990
|
+
parent: s
|
|
1991
1991
|
})
|
|
1992
|
-
]).then(([a, i]) =>
|
|
1993
|
-
data:
|
|
1994
|
-
path:
|
|
1995
|
-
parent:
|
|
1992
|
+
]).then(([a, i]) => n(a, i)) : n(this._def.left._parseSync({
|
|
1993
|
+
data: s.data,
|
|
1994
|
+
path: s.path,
|
|
1995
|
+
parent: s
|
|
1996
1996
|
}), this._def.right._parseSync({
|
|
1997
|
-
data:
|
|
1998
|
-
path:
|
|
1999
|
-
parent:
|
|
1997
|
+
data: s.data,
|
|
1998
|
+
path: s.path,
|
|
1999
|
+
parent: s
|
|
2000
2000
|
}));
|
|
2001
2001
|
}
|
|
2002
2002
|
}
|
|
@@ -2008,33 +2008,33 @@ de.create = (r, e, t) => new de({
|
|
|
2008
2008
|
});
|
|
2009
2009
|
class $ extends v {
|
|
2010
2010
|
_parse(e) {
|
|
2011
|
-
const { status: t, ctx:
|
|
2012
|
-
if (
|
|
2013
|
-
return l(
|
|
2011
|
+
const { status: t, ctx: s } = this._processInputParams(e);
|
|
2012
|
+
if (s.parsedType !== f.array)
|
|
2013
|
+
return l(s, {
|
|
2014
2014
|
code: d.invalid_type,
|
|
2015
2015
|
expected: f.array,
|
|
2016
|
-
received:
|
|
2016
|
+
received: s.parsedType
|
|
2017
2017
|
}), y;
|
|
2018
|
-
if (
|
|
2019
|
-
return l(
|
|
2018
|
+
if (s.data.length < this._def.items.length)
|
|
2019
|
+
return l(s, {
|
|
2020
2020
|
code: d.too_small,
|
|
2021
2021
|
minimum: this._def.items.length,
|
|
2022
2022
|
inclusive: !0,
|
|
2023
2023
|
exact: !1,
|
|
2024
2024
|
type: "array"
|
|
2025
2025
|
}), y;
|
|
2026
|
-
!this._def.rest &&
|
|
2026
|
+
!this._def.rest && s.data.length > this._def.items.length && (l(s, {
|
|
2027
2027
|
code: d.too_big,
|
|
2028
2028
|
maximum: this._def.items.length,
|
|
2029
2029
|
inclusive: !0,
|
|
2030
2030
|
exact: !1,
|
|
2031
2031
|
type: "array"
|
|
2032
2032
|
}), t.dirty());
|
|
2033
|
-
const a = [...
|
|
2033
|
+
const a = [...s.data].map((i, o) => {
|
|
2034
2034
|
const u = this._def.items[o] || this._def.rest;
|
|
2035
|
-
return u ? u._parse(new M(
|
|
2035
|
+
return u ? u._parse(new M(s, i, s.path, o)) : null;
|
|
2036
2036
|
}).filter((i) => !!i);
|
|
2037
|
-
return
|
|
2037
|
+
return s.common.async ? Promise.all(a).then((i) => Z.mergeArray(t, i)) : Z.mergeArray(t, a);
|
|
2038
2038
|
}
|
|
2039
2039
|
get items() {
|
|
2040
2040
|
return this._def.items;
|
|
@@ -2064,31 +2064,31 @@ class ce extends v {
|
|
|
2064
2064
|
return this._def.valueType;
|
|
2065
2065
|
}
|
|
2066
2066
|
_parse(e) {
|
|
2067
|
-
const { status: t, ctx:
|
|
2068
|
-
if (
|
|
2069
|
-
return l(
|
|
2067
|
+
const { status: t, ctx: s } = this._processInputParams(e);
|
|
2068
|
+
if (s.parsedType !== f.object)
|
|
2069
|
+
return l(s, {
|
|
2070
2070
|
code: d.invalid_type,
|
|
2071
2071
|
expected: f.object,
|
|
2072
|
-
received:
|
|
2072
|
+
received: s.parsedType
|
|
2073
2073
|
}), y;
|
|
2074
|
-
const
|
|
2075
|
-
for (const o in
|
|
2076
|
-
|
|
2077
|
-
key: a._parse(new M(
|
|
2078
|
-
value: i._parse(new M(
|
|
2079
|
-
alwaysSet: o in
|
|
2074
|
+
const n = [], a = this._def.keyType, i = this._def.valueType;
|
|
2075
|
+
for (const o in s.data)
|
|
2076
|
+
n.push({
|
|
2077
|
+
key: a._parse(new M(s, o, s.path, o)),
|
|
2078
|
+
value: i._parse(new M(s, s.data[o], s.path, o)),
|
|
2079
|
+
alwaysSet: o in s.data
|
|
2080
2080
|
});
|
|
2081
|
-
return
|
|
2081
|
+
return s.common.async ? Z.mergeObjectAsync(t, n) : Z.mergeObjectSync(t, n);
|
|
2082
2082
|
}
|
|
2083
2083
|
get element() {
|
|
2084
2084
|
return this._def.valueType;
|
|
2085
2085
|
}
|
|
2086
|
-
static create(e, t,
|
|
2086
|
+
static create(e, t, s) {
|
|
2087
2087
|
return t instanceof v ? new ce({
|
|
2088
2088
|
keyType: e,
|
|
2089
2089
|
valueType: t,
|
|
2090
2090
|
typeName: m.ZodRecord,
|
|
2091
|
-
..._(
|
|
2091
|
+
..._(s)
|
|
2092
2092
|
}) : new ce({
|
|
2093
2093
|
keyType: R.create(),
|
|
2094
2094
|
valueType: e,
|
|
@@ -2105,18 +2105,18 @@ class we extends v {
|
|
|
2105
2105
|
return this._def.valueType;
|
|
2106
2106
|
}
|
|
2107
2107
|
_parse(e) {
|
|
2108
|
-
const { status: t, ctx:
|
|
2109
|
-
if (
|
|
2110
|
-
return l(
|
|
2108
|
+
const { status: t, ctx: s } = this._processInputParams(e);
|
|
2109
|
+
if (s.parsedType !== f.map)
|
|
2110
|
+
return l(s, {
|
|
2111
2111
|
code: d.invalid_type,
|
|
2112
2112
|
expected: f.map,
|
|
2113
|
-
received:
|
|
2113
|
+
received: s.parsedType
|
|
2114
2114
|
}), y;
|
|
2115
|
-
const
|
|
2116
|
-
key:
|
|
2117
|
-
value: a._parse(new M(
|
|
2115
|
+
const n = this._def.keyType, a = this._def.valueType, i = [...s.data.entries()].map(([o, u], c) => ({
|
|
2116
|
+
key: n._parse(new M(s, o, s.path, [c, "key"])),
|
|
2117
|
+
value: a._parse(new M(s, u, s.path, [c, "value"]))
|
|
2118
2118
|
}));
|
|
2119
|
-
if (
|
|
2119
|
+
if (s.common.async) {
|
|
2120
2120
|
const o = /* @__PURE__ */ new Map();
|
|
2121
2121
|
return Promise.resolve().then(async () => {
|
|
2122
2122
|
for (const u of i) {
|
|
@@ -2147,28 +2147,28 @@ we.create = (r, e, t) => new we({
|
|
|
2147
2147
|
});
|
|
2148
2148
|
class J extends v {
|
|
2149
2149
|
_parse(e) {
|
|
2150
|
-
const { status: t, ctx:
|
|
2151
|
-
if (
|
|
2152
|
-
return l(
|
|
2150
|
+
const { status: t, ctx: s } = this._processInputParams(e);
|
|
2151
|
+
if (s.parsedType !== f.set)
|
|
2152
|
+
return l(s, {
|
|
2153
2153
|
code: d.invalid_type,
|
|
2154
2154
|
expected: f.set,
|
|
2155
|
-
received:
|
|
2155
|
+
received: s.parsedType
|
|
2156
2156
|
}), y;
|
|
2157
|
-
const
|
|
2158
|
-
|
|
2157
|
+
const n = this._def;
|
|
2158
|
+
n.minSize !== null && s.data.size < n.minSize.value && (l(s, {
|
|
2159
2159
|
code: d.too_small,
|
|
2160
|
-
minimum:
|
|
2160
|
+
minimum: n.minSize.value,
|
|
2161
2161
|
type: "set",
|
|
2162
2162
|
inclusive: !0,
|
|
2163
2163
|
exact: !1,
|
|
2164
|
-
message:
|
|
2165
|
-
}), t.dirty()),
|
|
2164
|
+
message: n.minSize.message
|
|
2165
|
+
}), t.dirty()), n.maxSize !== null && s.data.size > n.maxSize.value && (l(s, {
|
|
2166
2166
|
code: d.too_big,
|
|
2167
|
-
maximum:
|
|
2167
|
+
maximum: n.maxSize.value,
|
|
2168
2168
|
type: "set",
|
|
2169
2169
|
inclusive: !0,
|
|
2170
2170
|
exact: !1,
|
|
2171
|
-
message:
|
|
2171
|
+
message: n.maxSize.message
|
|
2172
2172
|
}), t.dirty());
|
|
2173
2173
|
const a = this._def.valueType;
|
|
2174
2174
|
function i(u) {
|
|
@@ -2180,8 +2180,8 @@ class J extends v {
|
|
|
2180
2180
|
}
|
|
2181
2181
|
return { status: t.value, value: c };
|
|
2182
2182
|
}
|
|
2183
|
-
const o = [...
|
|
2184
|
-
return
|
|
2183
|
+
const o = [...s.data.values()].map((u, c) => a._parse(new M(s, u, s.path, c)));
|
|
2184
|
+
return s.common.async ? Promise.all(o).then((u) => i(u)) : i(o);
|
|
2185
2185
|
}
|
|
2186
2186
|
min(e, t) {
|
|
2187
2187
|
return new J({
|
|
@@ -2221,7 +2221,7 @@ class H extends v {
|
|
|
2221
2221
|
expected: f.function,
|
|
2222
2222
|
received: t.parsedType
|
|
2223
2223
|
}), y;
|
|
2224
|
-
function
|
|
2224
|
+
function s(o, u) {
|
|
2225
2225
|
return ge({
|
|
2226
2226
|
data: o,
|
|
2227
2227
|
path: t.path,
|
|
@@ -2237,7 +2237,7 @@ class H extends v {
|
|
|
2237
2237
|
}
|
|
2238
2238
|
});
|
|
2239
2239
|
}
|
|
2240
|
-
function
|
|
2240
|
+
function n(o, u) {
|
|
2241
2241
|
return ge({
|
|
2242
2242
|
data: o,
|
|
2243
2243
|
path: t.path,
|
|
@@ -2254,14 +2254,14 @@ class H extends v {
|
|
|
2254
2254
|
});
|
|
2255
2255
|
}
|
|
2256
2256
|
const a = { errorMap: t.common.contextualErrorMap }, i = t.data;
|
|
2257
|
-
if (this._def.returns instanceof
|
|
2257
|
+
if (this._def.returns instanceof X) {
|
|
2258
2258
|
const o = this;
|
|
2259
2259
|
return S(async function(...u) {
|
|
2260
2260
|
const c = new E([]), p = await o._def.args.parseAsync(u, a).catch((F) => {
|
|
2261
|
-
throw c.addIssue(
|
|
2261
|
+
throw c.addIssue(s(u, F)), c;
|
|
2262
2262
|
}), C = await Reflect.apply(i, this, p);
|
|
2263
2263
|
return await o._def.returns._def.type.parseAsync(C, a).catch((F) => {
|
|
2264
|
-
throw c.addIssue(
|
|
2264
|
+
throw c.addIssue(n(C, F)), c;
|
|
2265
2265
|
});
|
|
2266
2266
|
});
|
|
2267
2267
|
} else {
|
|
@@ -2269,10 +2269,10 @@ class H extends v {
|
|
|
2269
2269
|
return S(function(...u) {
|
|
2270
2270
|
const c = o._def.args.safeParse(u, a);
|
|
2271
2271
|
if (!c.success)
|
|
2272
|
-
throw new E([
|
|
2272
|
+
throw new E([s(u, c.error)]);
|
|
2273
2273
|
const p = Reflect.apply(i, this, c.data), C = o._def.returns.safeParse(p, a);
|
|
2274
2274
|
if (!C.success)
|
|
2275
|
-
throw new E([
|
|
2275
|
+
throw new E([n(p, C.error)]);
|
|
2276
2276
|
return C.data;
|
|
2277
2277
|
});
|
|
2278
2278
|
}
|
|
@@ -2301,12 +2301,12 @@ class H extends v {
|
|
|
2301
2301
|
strictImplement(e) {
|
|
2302
2302
|
return this.parse(e);
|
|
2303
2303
|
}
|
|
2304
|
-
static create(e, t,
|
|
2304
|
+
static create(e, t, s) {
|
|
2305
2305
|
return new H({
|
|
2306
2306
|
args: e || $.create([]).rest(B.create()),
|
|
2307
2307
|
returns: t || B.create(),
|
|
2308
2308
|
typeName: m.ZodFunction,
|
|
2309
|
-
..._(
|
|
2309
|
+
..._(s)
|
|
2310
2310
|
});
|
|
2311
2311
|
}
|
|
2312
2312
|
}
|
|
@@ -2358,19 +2358,19 @@ class q extends v {
|
|
|
2358
2358
|
}
|
|
2359
2359
|
_parse(e) {
|
|
2360
2360
|
if (typeof e.data != "string") {
|
|
2361
|
-
const t = this._getOrReturnCtx(e),
|
|
2361
|
+
const t = this._getOrReturnCtx(e), s = this._def.values;
|
|
2362
2362
|
return l(t, {
|
|
2363
|
-
expected: x.joinValues(
|
|
2363
|
+
expected: x.joinValues(s),
|
|
2364
2364
|
received: t.parsedType,
|
|
2365
2365
|
code: d.invalid_type
|
|
2366
2366
|
}), y;
|
|
2367
2367
|
}
|
|
2368
2368
|
if (xe(this, ee) || $e(this, ee, new Set(this._def.values)), !xe(this, ee).has(e.data)) {
|
|
2369
|
-
const t = this._getOrReturnCtx(e),
|
|
2369
|
+
const t = this._getOrReturnCtx(e), s = this._def.values;
|
|
2370
2370
|
return l(t, {
|
|
2371
2371
|
received: t.data,
|
|
2372
2372
|
code: d.invalid_enum_value,
|
|
2373
|
-
options:
|
|
2373
|
+
options: s
|
|
2374
2374
|
}), y;
|
|
2375
2375
|
}
|
|
2376
2376
|
return S(e.data);
|
|
@@ -2403,7 +2403,7 @@ class q extends v {
|
|
|
2403
2403
|
});
|
|
2404
2404
|
}
|
|
2405
2405
|
exclude(e, t = this._def) {
|
|
2406
|
-
return q.create(this.options.filter((
|
|
2406
|
+
return q.create(this.options.filter((s) => !e.includes(s)), {
|
|
2407
2407
|
...this._def,
|
|
2408
2408
|
...t
|
|
2409
2409
|
});
|
|
@@ -2416,21 +2416,21 @@ class fe extends v {
|
|
|
2416
2416
|
super(...arguments), te.set(this, void 0);
|
|
2417
2417
|
}
|
|
2418
2418
|
_parse(e) {
|
|
2419
|
-
const t = x.getValidEnumValues(this._def.values),
|
|
2420
|
-
if (
|
|
2421
|
-
const
|
|
2422
|
-
return l(
|
|
2423
|
-
expected: x.joinValues(
|
|
2424
|
-
received:
|
|
2419
|
+
const t = x.getValidEnumValues(this._def.values), s = this._getOrReturnCtx(e);
|
|
2420
|
+
if (s.parsedType !== f.string && s.parsedType !== f.number) {
|
|
2421
|
+
const n = x.objectValues(t);
|
|
2422
|
+
return l(s, {
|
|
2423
|
+
expected: x.joinValues(n),
|
|
2424
|
+
received: s.parsedType,
|
|
2425
2425
|
code: d.invalid_type
|
|
2426
2426
|
}), y;
|
|
2427
2427
|
}
|
|
2428
2428
|
if (xe(this, te) || $e(this, te, new Set(x.getValidEnumValues(this._def.values))), !xe(this, te).has(e.data)) {
|
|
2429
|
-
const
|
|
2430
|
-
return l(
|
|
2431
|
-
received:
|
|
2429
|
+
const n = x.objectValues(t);
|
|
2430
|
+
return l(s, {
|
|
2431
|
+
received: s.data,
|
|
2432
2432
|
code: d.invalid_enum_value,
|
|
2433
|
-
options:
|
|
2433
|
+
options: n
|
|
2434
2434
|
}), y;
|
|
2435
2435
|
}
|
|
2436
2436
|
return S(e.data);
|
|
@@ -2445,7 +2445,7 @@ fe.create = (r, e) => new fe({
|
|
|
2445
2445
|
typeName: m.ZodNativeEnum,
|
|
2446
2446
|
..._(e)
|
|
2447
2447
|
});
|
|
2448
|
-
class
|
|
2448
|
+
class X extends v {
|
|
2449
2449
|
unwrap() {
|
|
2450
2450
|
return this._def.type;
|
|
2451
2451
|
}
|
|
@@ -2457,14 +2457,14 @@ class K extends v {
|
|
|
2457
2457
|
expected: f.promise,
|
|
2458
2458
|
received: t.parsedType
|
|
2459
2459
|
}), y;
|
|
2460
|
-
const
|
|
2461
|
-
return S(
|
|
2460
|
+
const s = t.parsedType === f.promise ? t.data : Promise.resolve(t.data);
|
|
2461
|
+
return S(s.then((n) => this._def.type.parseAsync(n, {
|
|
2462
2462
|
path: t.path,
|
|
2463
2463
|
errorMap: t.common.contextualErrorMap
|
|
2464
2464
|
})));
|
|
2465
2465
|
}
|
|
2466
2466
|
}
|
|
2467
|
-
|
|
2467
|
+
X.create = (r, e) => new X({
|
|
2468
2468
|
type: r,
|
|
2469
2469
|
typeName: m.ZodPromise,
|
|
2470
2470
|
..._(e)
|
|
@@ -2477,24 +2477,24 @@ class j extends v {
|
|
|
2477
2477
|
return this._def.schema._def.typeName === m.ZodEffects ? this._def.schema.sourceType() : this._def.schema;
|
|
2478
2478
|
}
|
|
2479
2479
|
_parse(e) {
|
|
2480
|
-
const { status: t, ctx:
|
|
2480
|
+
const { status: t, ctx: s } = this._processInputParams(e), n = this._def.effect || null, a = {
|
|
2481
2481
|
addIssue: (i) => {
|
|
2482
|
-
l(
|
|
2482
|
+
l(s, i), i.fatal ? t.abort() : t.dirty();
|
|
2483
2483
|
},
|
|
2484
2484
|
get path() {
|
|
2485
|
-
return
|
|
2485
|
+
return s.path;
|
|
2486
2486
|
}
|
|
2487
2487
|
};
|
|
2488
|
-
if (a.addIssue = a.addIssue.bind(a),
|
|
2489
|
-
const i =
|
|
2490
|
-
if (
|
|
2488
|
+
if (a.addIssue = a.addIssue.bind(a), n.type === "preprocess") {
|
|
2489
|
+
const i = n.transform(s.data, a);
|
|
2490
|
+
if (s.common.async)
|
|
2491
2491
|
return Promise.resolve(i).then(async (o) => {
|
|
2492
2492
|
if (t.value === "aborted")
|
|
2493
2493
|
return y;
|
|
2494
2494
|
const u = await this._def.schema._parseAsync({
|
|
2495
2495
|
data: o,
|
|
2496
|
-
path:
|
|
2497
|
-
parent:
|
|
2496
|
+
path: s.path,
|
|
2497
|
+
parent: s
|
|
2498
2498
|
});
|
|
2499
2499
|
return u.status === "aborted" ? y : u.status === "dirty" || t.value === "dirty" ? G(u.value) : u;
|
|
2500
2500
|
});
|
|
@@ -2503,47 +2503,47 @@ class j extends v {
|
|
|
2503
2503
|
return y;
|
|
2504
2504
|
const o = this._def.schema._parseSync({
|
|
2505
2505
|
data: i,
|
|
2506
|
-
path:
|
|
2507
|
-
parent:
|
|
2506
|
+
path: s.path,
|
|
2507
|
+
parent: s
|
|
2508
2508
|
});
|
|
2509
2509
|
return o.status === "aborted" ? y : o.status === "dirty" || t.value === "dirty" ? G(o.value) : o;
|
|
2510
2510
|
}
|
|
2511
2511
|
}
|
|
2512
|
-
if (
|
|
2512
|
+
if (n.type === "refinement") {
|
|
2513
2513
|
const i = (o) => {
|
|
2514
|
-
const u =
|
|
2515
|
-
if (
|
|
2514
|
+
const u = n.refinement(o, a);
|
|
2515
|
+
if (s.common.async)
|
|
2516
2516
|
return Promise.resolve(u);
|
|
2517
2517
|
if (u instanceof Promise)
|
|
2518
2518
|
throw new Error("Async refinement encountered during synchronous parse operation. Use .parseAsync instead.");
|
|
2519
2519
|
return o;
|
|
2520
2520
|
};
|
|
2521
|
-
if (
|
|
2521
|
+
if (s.common.async === !1) {
|
|
2522
2522
|
const o = this._def.schema._parseSync({
|
|
2523
|
-
data:
|
|
2524
|
-
path:
|
|
2525
|
-
parent:
|
|
2523
|
+
data: s.data,
|
|
2524
|
+
path: s.path,
|
|
2525
|
+
parent: s
|
|
2526
2526
|
});
|
|
2527
2527
|
return o.status === "aborted" ? y : (o.status === "dirty" && t.dirty(), i(o.value), { status: t.value, value: o.value });
|
|
2528
2528
|
} else
|
|
2529
|
-
return this._def.schema._parseAsync({ data:
|
|
2529
|
+
return this._def.schema._parseAsync({ data: s.data, path: s.path, parent: s }).then((o) => o.status === "aborted" ? y : (o.status === "dirty" && t.dirty(), i(o.value).then(() => ({ status: t.value, value: o.value }))));
|
|
2530
2530
|
}
|
|
2531
|
-
if (
|
|
2532
|
-
if (
|
|
2531
|
+
if (n.type === "transform")
|
|
2532
|
+
if (s.common.async === !1) {
|
|
2533
2533
|
const i = this._def.schema._parseSync({
|
|
2534
|
-
data:
|
|
2535
|
-
path:
|
|
2536
|
-
parent:
|
|
2534
|
+
data: s.data,
|
|
2535
|
+
path: s.path,
|
|
2536
|
+
parent: s
|
|
2537
2537
|
});
|
|
2538
2538
|
if (!re(i))
|
|
2539
2539
|
return i;
|
|
2540
|
-
const o =
|
|
2540
|
+
const o = n.transform(i.value, a);
|
|
2541
2541
|
if (o instanceof Promise)
|
|
2542
2542
|
throw new Error("Asynchronous transform encountered during synchronous parse operation. Use .parseAsync instead.");
|
|
2543
2543
|
return { status: t.value, value: o };
|
|
2544
2544
|
} else
|
|
2545
|
-
return this._def.schema._parseAsync({ data:
|
|
2546
|
-
x.assertNever(
|
|
2545
|
+
return this._def.schema._parseAsync({ data: s.data, path: s.path, parent: s }).then((i) => re(i) ? Promise.resolve(n.transform(i.value, a)).then((o) => ({ status: t.value, value: o })) : i);
|
|
2546
|
+
x.assertNever(n);
|
|
2547
2547
|
}
|
|
2548
2548
|
}
|
|
2549
2549
|
j.create = (r, e, t) => new j({
|
|
@@ -2587,9 +2587,9 @@ U.create = (r, e) => new U({
|
|
|
2587
2587
|
class he extends v {
|
|
2588
2588
|
_parse(e) {
|
|
2589
2589
|
const { ctx: t } = this._processInputParams(e);
|
|
2590
|
-
let
|
|
2591
|
-
return t.parsedType === f.undefined && (
|
|
2592
|
-
data:
|
|
2590
|
+
let s = t.data;
|
|
2591
|
+
return t.parsedType === f.undefined && (s = this._def.defaultValue()), this._def.innerType._parse({
|
|
2592
|
+
data: s,
|
|
2593
2593
|
path: t.path,
|
|
2594
2594
|
parent: t
|
|
2595
2595
|
});
|
|
@@ -2606,34 +2606,34 @@ he.create = (r, e) => new he({
|
|
|
2606
2606
|
});
|
|
2607
2607
|
class me extends v {
|
|
2608
2608
|
_parse(e) {
|
|
2609
|
-
const { ctx: t } = this._processInputParams(e),
|
|
2609
|
+
const { ctx: t } = this._processInputParams(e), s = {
|
|
2610
2610
|
...t,
|
|
2611
2611
|
common: {
|
|
2612
2612
|
...t.common,
|
|
2613
2613
|
issues: []
|
|
2614
2614
|
}
|
|
2615
|
-
},
|
|
2616
|
-
data:
|
|
2617
|
-
path:
|
|
2615
|
+
}, n = this._def.innerType._parse({
|
|
2616
|
+
data: s.data,
|
|
2617
|
+
path: s.path,
|
|
2618
2618
|
parent: {
|
|
2619
|
-
...
|
|
2619
|
+
...s
|
|
2620
2620
|
}
|
|
2621
2621
|
});
|
|
2622
|
-
return
|
|
2622
|
+
return se(n) ? n.then((a) => ({
|
|
2623
2623
|
status: "valid",
|
|
2624
2624
|
value: a.status === "valid" ? a.value : this._def.catchValue({
|
|
2625
2625
|
get error() {
|
|
2626
|
-
return new E(
|
|
2626
|
+
return new E(s.common.issues);
|
|
2627
2627
|
},
|
|
2628
|
-
input:
|
|
2628
|
+
input: s.data
|
|
2629
2629
|
})
|
|
2630
2630
|
})) : {
|
|
2631
2631
|
status: "valid",
|
|
2632
|
-
value:
|
|
2632
|
+
value: n.status === "valid" ? n.value : this._def.catchValue({
|
|
2633
2633
|
get error() {
|
|
2634
|
-
return new E(
|
|
2634
|
+
return new E(s.common.issues);
|
|
2635
2635
|
},
|
|
2636
|
-
input:
|
|
2636
|
+
input: s.data
|
|
2637
2637
|
})
|
|
2638
2638
|
};
|
|
2639
2639
|
}
|
|
@@ -2650,11 +2650,11 @@ me.create = (r, e) => new me({
|
|
|
2650
2650
|
class Te extends v {
|
|
2651
2651
|
_parse(e) {
|
|
2652
2652
|
if (this._getType(e) !== f.nan) {
|
|
2653
|
-
const
|
|
2654
|
-
return l(
|
|
2653
|
+
const s = this._getOrReturnCtx(e);
|
|
2654
|
+
return l(s, {
|
|
2655
2655
|
code: d.invalid_type,
|
|
2656
2656
|
expected: f.nan,
|
|
2657
|
-
received:
|
|
2657
|
+
received: s.parsedType
|
|
2658
2658
|
}), y;
|
|
2659
2659
|
}
|
|
2660
2660
|
return { status: "valid", value: e.data };
|
|
@@ -2667,9 +2667,9 @@ Te.create = (r) => new Te({
|
|
|
2667
2667
|
const vt = Symbol("zod_brand");
|
|
2668
2668
|
class Re extends v {
|
|
2669
2669
|
_parse(e) {
|
|
2670
|
-
const { ctx: t } = this._processInputParams(e),
|
|
2670
|
+
const { ctx: t } = this._processInputParams(e), s = t.data;
|
|
2671
2671
|
return this._def.type._parse({
|
|
2672
|
-
data:
|
|
2672
|
+
data: s,
|
|
2673
2673
|
path: t.path,
|
|
2674
2674
|
parent: t
|
|
2675
2675
|
});
|
|
@@ -2680,33 +2680,33 @@ class Re extends v {
|
|
|
2680
2680
|
}
|
|
2681
2681
|
class ye extends v {
|
|
2682
2682
|
_parse(e) {
|
|
2683
|
-
const { status: t, ctx:
|
|
2684
|
-
if (
|
|
2683
|
+
const { status: t, ctx: s } = this._processInputParams(e);
|
|
2684
|
+
if (s.common.async)
|
|
2685
2685
|
return (async () => {
|
|
2686
2686
|
const a = await this._def.in._parseAsync({
|
|
2687
|
-
data:
|
|
2688
|
-
path:
|
|
2689
|
-
parent:
|
|
2687
|
+
data: s.data,
|
|
2688
|
+
path: s.path,
|
|
2689
|
+
parent: s
|
|
2690
2690
|
});
|
|
2691
2691
|
return a.status === "aborted" ? y : a.status === "dirty" ? (t.dirty(), G(a.value)) : this._def.out._parseAsync({
|
|
2692
2692
|
data: a.value,
|
|
2693
|
-
path:
|
|
2694
|
-
parent:
|
|
2693
|
+
path: s.path,
|
|
2694
|
+
parent: s
|
|
2695
2695
|
});
|
|
2696
2696
|
})();
|
|
2697
2697
|
{
|
|
2698
|
-
const
|
|
2699
|
-
data:
|
|
2700
|
-
path:
|
|
2701
|
-
parent:
|
|
2698
|
+
const n = this._def.in._parseSync({
|
|
2699
|
+
data: s.data,
|
|
2700
|
+
path: s.path,
|
|
2701
|
+
parent: s
|
|
2702
2702
|
});
|
|
2703
|
-
return
|
|
2703
|
+
return n.status === "aborted" ? y : n.status === "dirty" ? (t.dirty(), {
|
|
2704
2704
|
status: "dirty",
|
|
2705
|
-
value:
|
|
2705
|
+
value: n.value
|
|
2706
2706
|
}) : this._def.out._parseSync({
|
|
2707
|
-
data:
|
|
2708
|
-
path:
|
|
2709
|
-
parent:
|
|
2707
|
+
data: n.value,
|
|
2708
|
+
path: s.path,
|
|
2709
|
+
parent: s
|
|
2710
2710
|
});
|
|
2711
2711
|
}
|
|
2712
2712
|
}
|
|
@@ -2720,8 +2720,8 @@ class ye extends v {
|
|
|
2720
2720
|
}
|
|
2721
2721
|
class pe extends v {
|
|
2722
2722
|
_parse(e) {
|
|
2723
|
-
const t = this._def.innerType._parse(e),
|
|
2724
|
-
return
|
|
2723
|
+
const t = this._def.innerType._parse(e), s = (n) => (re(n) && (n.value = Object.freeze(n.value)), n);
|
|
2724
|
+
return se(t) ? t.then((n) => s(n)) : s(t);
|
|
2725
2725
|
}
|
|
2726
2726
|
unwrap() {
|
|
2727
2727
|
return this._def.innerType;
|
|
@@ -2733,13 +2733,13 @@ pe.create = (r, e) => new pe({
|
|
|
2733
2733
|
..._(e)
|
|
2734
2734
|
});
|
|
2735
2735
|
function Le(r, e = {}, t) {
|
|
2736
|
-
return r ?
|
|
2736
|
+
return r ? K.create().superRefine((s, n) => {
|
|
2737
2737
|
var a, i;
|
|
2738
|
-
if (!r(
|
|
2739
|
-
const o = typeof e == "function" ? e(
|
|
2740
|
-
|
|
2738
|
+
if (!r(s)) {
|
|
2739
|
+
const o = typeof e == "function" ? e(s) : typeof e == "string" ? { message: e } : e, u = (i = (a = o.fatal) !== null && a !== void 0 ? a : t) !== null && i !== void 0 ? i : !0, c = typeof o == "string" ? { message: o } : o;
|
|
2740
|
+
n.addIssue({ code: "custom", ...c, fatal: u });
|
|
2741
2741
|
}
|
|
2742
|
-
}) :
|
|
2742
|
+
}) : K.create();
|
|
2743
2743
|
}
|
|
2744
2744
|
const gt = {
|
|
2745
2745
|
object: b.lazycreate
|
|
@@ -2750,10 +2750,10 @@ var m;
|
|
|
2750
2750
|
})(m || (m = {}));
|
|
2751
2751
|
const xt = (r, e = {
|
|
2752
2752
|
message: `Input not instance of ${r.name}`
|
|
2753
|
-
}) => Le((t) => t instanceof r, e), qe = R.create, Ue = z.create, kt = Te.create, bt = L.create, Be =
|
|
2753
|
+
}) => Le((t) => t instanceof r, e), qe = R.create, Ue = z.create, kt = Te.create, bt = L.create, Be = ne.create, wt = W.create, Tt = ke.create, Zt = ae.create, St = ie.create, Ct = K.create, Nt = B.create, Ot = V.create, Et = be.create, Rt = I.create, It = b.create, jt = b.strictCreate, At = oe.create, Mt = Ze.create, $t = de.create, Pt = $.create, Vt = ce.create, Dt = we.create, zt = J.create, Lt = H.create, qt = ue.create, Ut = le.create, Bt = q.create, Wt = fe.create, Jt = X.create, Ae = j.create, Yt = A.create, Gt = U.create, Ht = j.createWithPreprocess, Qt = ye.create, Kt = () => qe().optional(), Xt = () => Ue().optional(), Ft = () => Be().optional(), er = {
|
|
2754
2754
|
string: (r) => R.create({ ...r, coerce: !0 }),
|
|
2755
2755
|
number: (r) => z.create({ ...r, coerce: !0 }),
|
|
2756
|
-
boolean: (r) =>
|
|
2756
|
+
boolean: (r) => ne.create({
|
|
2757
2757
|
...r,
|
|
2758
2758
|
coerce: !0
|
|
2759
2759
|
}),
|
|
@@ -2775,7 +2775,7 @@ var O = /* @__PURE__ */ Object.freeze({
|
|
|
2775
2775
|
isAborted: Ne,
|
|
2776
2776
|
isDirty: Oe,
|
|
2777
2777
|
isValid: re,
|
|
2778
|
-
isAsync:
|
|
2778
|
+
isAsync: se,
|
|
2779
2779
|
get util() {
|
|
2780
2780
|
return x;
|
|
2781
2781
|
},
|
|
@@ -2789,12 +2789,12 @@ var O = /* @__PURE__ */ Object.freeze({
|
|
|
2789
2789
|
ZodString: R,
|
|
2790
2790
|
ZodNumber: z,
|
|
2791
2791
|
ZodBigInt: L,
|
|
2792
|
-
ZodBoolean:
|
|
2792
|
+
ZodBoolean: ne,
|
|
2793
2793
|
ZodDate: W,
|
|
2794
2794
|
ZodSymbol: ke,
|
|
2795
2795
|
ZodUndefined: ae,
|
|
2796
2796
|
ZodNull: ie,
|
|
2797
|
-
ZodAny:
|
|
2797
|
+
ZodAny: K,
|
|
2798
2798
|
ZodUnknown: B,
|
|
2799
2799
|
ZodNever: V,
|
|
2800
2800
|
ZodVoid: be,
|
|
@@ -2812,7 +2812,7 @@ var O = /* @__PURE__ */ Object.freeze({
|
|
|
2812
2812
|
ZodLiteral: le,
|
|
2813
2813
|
ZodEnum: q,
|
|
2814
2814
|
ZodNativeEnum: fe,
|
|
2815
|
-
ZodPromise:
|
|
2815
|
+
ZodPromise: X,
|
|
2816
2816
|
ZodEffects: j,
|
|
2817
2817
|
ZodTransformer: j,
|
|
2818
2818
|
ZodOptional: A,
|
|
@@ -2854,9 +2854,9 @@ var O = /* @__PURE__ */ Object.freeze({
|
|
|
2854
2854
|
number: Ue,
|
|
2855
2855
|
object: It,
|
|
2856
2856
|
oboolean: Ft,
|
|
2857
|
-
onumber:
|
|
2857
|
+
onumber: Xt,
|
|
2858
2858
|
optional: Yt,
|
|
2859
|
-
ostring:
|
|
2859
|
+
ostring: Kt,
|
|
2860
2860
|
pipeline: Qt,
|
|
2861
2861
|
preprocess: Ht,
|
|
2862
2862
|
promise: Jt,
|
|
@@ -2880,13 +2880,13 @@ const ur = () => {
|
|
|
2880
2880
|
const { texts: { formValidation: r } } = Qe(Ye), e = N((g) => (g != null && g.useCoerce ? O.coerce : O).string({
|
|
2881
2881
|
invalid_type_error: r.required,
|
|
2882
2882
|
required_error: r.required
|
|
2883
|
-
}).transform((w) => w ?? null), [r.required]), t = N((g) => e(g).nullable().optional().transform((k) => k ?? null), [e]),
|
|
2883
|
+
}).transform((w) => w ?? null), [r.required]), t = N((g) => e(g).nullable().optional().transform((k) => k ?? null), [e]), s = N((g) => {
|
|
2884
2884
|
const k = (g != null && g.useCoerce ? O.coerce : O).number({
|
|
2885
2885
|
invalid_type_error: r.required,
|
|
2886
2886
|
required_error: r.required
|
|
2887
2887
|
});
|
|
2888
2888
|
return (g == null ? void 0 : g.min) !== void 0 && k.min(g.min), (g == null ? void 0 : g.max) !== void 0 && k.max(g.max), k.transform((w) => w ?? null);
|
|
2889
|
-
}, [r.required]),
|
|
2889
|
+
}, [r.required]), n = N((g) => s(g).nullable().optional().transform((k) => k ?? null), [s]), a = N((g) => (g != null && g.useCoerce ? O.coerce : O).boolean({
|
|
2890
2890
|
invalid_type_error: r.required,
|
|
2891
2891
|
required_error: r.required
|
|
2892
2892
|
}).transform((k) => k ?? null), [r.required]), i = N((g) => (g != null && g.useCoerce ? O.coerce : O).string({
|
|
@@ -2901,12 +2901,12 @@ const ur = () => {
|
|
|
2901
2901
|
[r.required]
|
|
2902
2902
|
), c = N((g, k) => u(g, k).nullable().transform((w) => w ?? null), [u]), p = N(
|
|
2903
2903
|
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
2904
|
-
(g) => O.object({ id:
|
|
2905
|
-
[
|
|
2904
|
+
(g) => O.object({ id: n({ useCoerce: !0 }) }).nullable().transform((w) => w ?? null),
|
|
2905
|
+
[n]
|
|
2906
2906
|
), C = N(
|
|
2907
2907
|
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
2908
|
-
(g) => O.object({ id:
|
|
2909
|
-
[
|
|
2908
|
+
(g) => O.object({ id: s() }).transform((w) => w ?? null),
|
|
2909
|
+
[s]
|
|
2910
2910
|
), _e = N(
|
|
2911
2911
|
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
2912
2912
|
(g) => O.object({ id: t({ useCoerce: !0 }) }).nullable().transform((w) => w ?? null),
|
|
@@ -2919,8 +2919,8 @@ const ur = () => {
|
|
|
2919
2919
|
return {
|
|
2920
2920
|
zString: t,
|
|
2921
2921
|
zStringRequired: e,
|
|
2922
|
-
zNumber:
|
|
2923
|
-
zNumberRequired:
|
|
2922
|
+
zNumber: n,
|
|
2923
|
+
zNumberRequired: s,
|
|
2924
2924
|
zBool: a,
|
|
2925
2925
|
zDate: o,
|
|
2926
2926
|
zDateRequired: i,
|
|
@@ -2934,15 +2934,15 @@ const ur = () => {
|
|
|
2934
2934
|
};
|
|
2935
2935
|
}, rr = (r) => {
|
|
2936
2936
|
let e = "pending", t;
|
|
2937
|
-
const
|
|
2938
|
-
e = "success", t =
|
|
2939
|
-
}, (
|
|
2940
|
-
e = "error", t =
|
|
2937
|
+
const s = r.then((n) => {
|
|
2938
|
+
e = "success", t = n;
|
|
2939
|
+
}, (n) => {
|
|
2940
|
+
e = "error", t = n;
|
|
2941
2941
|
});
|
|
2942
2942
|
return () => {
|
|
2943
2943
|
switch (e) {
|
|
2944
2944
|
case "pending":
|
|
2945
|
-
throw
|
|
2945
|
+
throw s;
|
|
2946
2946
|
case "success":
|
|
2947
2947
|
return t;
|
|
2948
2948
|
case "error":
|
|
@@ -2953,11 +2953,11 @@ const ur = () => {
|
|
|
2953
2953
|
};
|
|
2954
2954
|
};
|
|
2955
2955
|
function lr(r) {
|
|
2956
|
-
const e = He({ silent: !0 }), [t,
|
|
2957
|
-
return
|
|
2956
|
+
const e = He({ silent: !0 }), [t, s] = Ke(null);
|
|
2957
|
+
return Xe(() => {
|
|
2958
2958
|
(async () => {
|
|
2959
2959
|
const a = e.get(r).then((i) => i.data);
|
|
2960
|
-
|
|
2960
|
+
s(rr(a));
|
|
2961
2961
|
})();
|
|
2962
2962
|
}, [e, r]), t;
|
|
2963
2963
|
}
|
|
@@ -2966,17 +2966,18 @@ export {
|
|
|
2966
2966
|
pr as useAuth,
|
|
2967
2967
|
He as useAxios,
|
|
2968
2968
|
Tr as useClickOutside,
|
|
2969
|
+
Zr as useClipboard,
|
|
2969
2970
|
vr as useConfirm,
|
|
2970
|
-
|
|
2971
|
-
|
|
2971
|
+
Sr as useEmployeePhotoPath,
|
|
2972
|
+
Cr as useFormControlType,
|
|
2972
2973
|
xr as useGetApiData,
|
|
2973
2974
|
lr as useGetDataBound,
|
|
2974
|
-
|
|
2975
|
+
Nr as useKeyPress,
|
|
2975
2976
|
kr as useLocalStorageState,
|
|
2976
2977
|
yr as useNotifications,
|
|
2977
|
-
|
|
2978
|
+
Ir as usePermissions,
|
|
2978
2979
|
br as usePrompt,
|
|
2979
|
-
|
|
2980
|
-
|
|
2980
|
+
Or as useSearchQuery,
|
|
2981
|
+
Er as useSearchQueryState,
|
|
2981
2982
|
ur as useZodSchemaTypes
|
|
2982
2983
|
};
|