react-luminus-components 1.3.41 → 1.3.44
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 +89 -72
- package/dist/{PrimaryButton-C02v_GlZ.js → PrimaryButton-BFrVtg6N.js} +22 -22
- package/dist/PrimaryButton-gfx7ORrl.cjs +1 -0
- package/dist/SimpleTooltip-CPiESoIG.cjs +1 -0
- package/dist/{SimpleTooltip-niijtN07.js → SimpleTooltip-Dr2e0zFE.js} +1 -1
- package/dist/components/common/AuthTemplate/AuthTemplate.d.ts +1 -2
- package/dist/components/common/DynamicForm/DynamicForm.d.ts +24 -0
- package/dist/components/common/DynamicForm/comps/DynamicFormErrors/DynamicFormErrors.d.ts +9 -0
- package/dist/components/common/DynamicForm/comps/DynamicFormMasterPicker/DynamicFormMasterPicker.d.ts +10 -0
- package/dist/components/common/DynamicForm/comps/DynamicFormTable/DynamicFormTable.d.ts +16 -0
- package/dist/components/common/DynamicForm/comps/DynamicFormTable/comps/DynamicFormCreateTableRow/DynamicFormCreateTableRow.d.ts +9 -0
- package/dist/components/common/DynamicForm/comps/DynamicFormTable/comps/DynamicFormTableRow/DynamicFormTableRow.d.ts +11 -0
- package/dist/components/common/DynamicForm/comps/DynamicFormTable/comps/comps/DynamicFormInput/DynamicFormInput.d.ts +17 -0
- package/dist/components/common/DynamicForm/comps/DynamicFormTable/comps/comps/index.d.ts +1 -0
- package/dist/components/common/DynamicForm/comps/DynamicFormTable/comps/index.d.ts +2 -0
- package/dist/components/common/DynamicForm/comps/index.d.ts +3 -0
- package/dist/components/common/DynamicForm/utils/itemTransformers.d.ts +4 -0
- package/dist/components/common/MonthPickerSearchParams/MonthPickerSearchParams.d.ts +8 -0
- package/dist/components/common/PieChart/PieChart.d.ts +11 -0
- package/dist/components/common/SettingsFormPicker/SettingsFormPicker.d.ts +19 -0
- package/dist/components/common/YearPickerSearchParams/YearPickerSearchParams.d.ts +9 -0
- package/dist/components/common/index.d.ts +5 -0
- package/dist/contexts/luminus-components/LuminusComponentsContext.d.ts +1 -0
- package/dist/contexts/luminus-components/LuminusComponentsProvider.d.ts +2 -1
- package/dist/contexts.cjs.js +1 -1
- package/dist/contexts.es.js +89 -79
- package/dist/dateUtils-5RIOiPgp.cjs +1 -0
- package/dist/{dateUtils-DrwxA2JS.js → dateUtils-CurTn67f.js} +38 -37
- package/dist/hooks.cjs.js +1 -1
- package/dist/hooks.es.js +541 -569
- package/dist/layout.cjs.js +1 -1
- package/dist/layout.es.js +3 -3
- package/dist/main.cjs.js +1 -1
- package/dist/main.d.ts +5 -0
- package/dist/main.es.js +2535 -2094
- package/dist/models/index.d.ts +1 -0
- package/dist/models/luminus-context-types/CommonLuminusIcons.d.ts +1 -1
- package/dist/models/texts/ComponentsContextTexts.d.ts +2 -0
- package/dist/models/texts/DynamicFormsTexts.d.ts +13 -0
- package/dist/models/types/dynamicForms/formPickerTypes/SettingsFormGroup.d.ts +8 -0
- package/dist/models/types/dynamicForms/formPickerTypes/SettingsFormItem.d.ts +8 -0
- package/dist/models/types/dynamicForms/index.d.ts +8 -0
- package/dist/models/types/dynamicForms/types/DynamicFormColumnDef.d.ts +12 -0
- package/dist/models/types/dynamicForms/types/DynamicFormColumnSchemaModel.d.ts +12 -0
- package/dist/models/types/dynamicForms/types/DynamicFormFilters.d.ts +4 -0
- package/dist/models/types/dynamicForms/types/DynamicFormIndexModel.d.ts +7 -0
- package/dist/models/types/dynamicForms/types/DynamicFormSchemaModel.d.ts +16 -0
- package/dist/models/types/dynamicForms/types/DynamicFormValueTypes.d.ts +12 -0
- package/dist/nivo-pie.es-DOBgqEbs.js +14707 -0
- package/dist/nivo-pie.es-DUIcm7NP.cjs +279 -0
- package/dist/searchUtils-BbsPikLG.cjs +1 -0
- package/dist/{searchUtils-Dc5EhzQd.js → searchUtils-CeX2CGdl.js} +1 -1
- package/dist/style.css +1 -1
- package/dist/useConfirm-Cak-t9R_.js +18 -0
- package/dist/useConfirm-DRK_YsaF.cjs +1 -0
- package/dist/useLocalStorageState-Cl-kvA9s.cjs +1 -0
- package/dist/useLocalStorageState-f0wzUR9M.js +61 -0
- package/dist/{usePermissions-D-_3huge.js → usePermissions-By1zm7HJ.js} +3 -3
- package/dist/usePermissions-CnhjSqOt.cjs +1 -0
- package/dist/useSearchQueryState-CS609A_4.cjs +1 -0
- package/dist/useSearchQueryState-QkR88Mks.js +51 -0
- package/dist/utils.cjs.js +1 -1
- package/dist/utils.es.js +22 -22
- package/dist/variables.scss +171 -171
- package/package.json +108 -106
- package/dist/FromToDatePickerDropdownToggle-BCwF6VkO.cjs +0 -253
- package/dist/FromToDatePickerDropdownToggle-CzfOe1nC.js +0 -7774
- package/dist/PrimaryButton-Ct8WgIre.cjs +0 -1
- package/dist/SimpleTooltip-C0dAO5Mm.cjs +0 -1
- package/dist/dateUtils-inGq3OTd.cjs +0 -1
- package/dist/searchUtils-CfdzpUt_.cjs +0 -1
- package/dist/useFormControlType-Dqz8sV4J.cjs +0 -1
- package/dist/useFormControlType-oJGqgThz.js +0 -20
- package/dist/useLocalStorageState--QCnJ6Yt.js +0 -75
- package/dist/useLocalStorageState-CTWtPpAn.cjs +0 -1
- package/dist/usePermissions-C0v67oim.cjs +0 -1
package/dist/hooks.es.js
CHANGED
|
@@ -1,14 +1,15 @@
|
|
|
1
|
-
import { U as
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
1
|
+
import { U as We, aG as Ye, a5 as Ge } from "./nivo-pie.es-DOBgqEbs.js";
|
|
2
|
+
import { aH as hr, aa as mr, al as pr } from "./nivo-pie.es-DOBgqEbs.js";
|
|
3
|
+
import { u as _r } from "./useConfirm-Cak-t9R_.js";
|
|
4
|
+
import { b as gr, a as xr, u as kr } from "./useLocalStorageState-f0wzUR9M.js";
|
|
5
|
+
import { useContext as He, useState as Je, useEffect as Qe } from "react";
|
|
6
|
+
import { i as Xe } from "./dateUtils-CurTn67f.js";
|
|
6
7
|
import "@azure/msal-browser";
|
|
7
8
|
import "@azure/msal-react";
|
|
8
|
-
import
|
|
9
|
+
import "react-router-dom";
|
|
9
10
|
import "react-hook-form";
|
|
10
|
-
import { b as
|
|
11
|
-
import { u as
|
|
11
|
+
import { a as wr, b as Tr, u as Zr, c as Sr, d as Cr } from "./useSearchQueryState-QkR88Mks.js";
|
|
12
|
+
import { u as Nr } from "./usePermissions-By1zm7HJ.js";
|
|
12
13
|
var x;
|
|
13
14
|
(function(r) {
|
|
14
15
|
r.assertEqual = (s) => s;
|
|
@@ -20,39 +21,39 @@ var x;
|
|
|
20
21
|
}
|
|
21
22
|
r.assertNever = t, r.arrayToEnum = (s) => {
|
|
22
23
|
const a = {};
|
|
23
|
-
for (const
|
|
24
|
-
a[
|
|
24
|
+
for (const i of s)
|
|
25
|
+
a[i] = i;
|
|
25
26
|
return a;
|
|
26
27
|
}, r.getValidEnumValues = (s) => {
|
|
27
|
-
const a = r.objectKeys(s).filter((
|
|
28
|
-
for (const
|
|
29
|
-
o
|
|
30
|
-
return r.objectValues(
|
|
28
|
+
const a = r.objectKeys(s).filter((o) => typeof s[s[o]] != "number"), i = {};
|
|
29
|
+
for (const o of a)
|
|
30
|
+
i[o] = s[o];
|
|
31
|
+
return r.objectValues(i);
|
|
31
32
|
}, r.objectValues = (s) => r.objectKeys(s).map(function(a) {
|
|
32
33
|
return s[a];
|
|
33
34
|
}), r.objectKeys = typeof Object.keys == "function" ? (s) => Object.keys(s) : (s) => {
|
|
34
35
|
const a = [];
|
|
35
|
-
for (const
|
|
36
|
-
Object.prototype.hasOwnProperty.call(s,
|
|
36
|
+
for (const i in s)
|
|
37
|
+
Object.prototype.hasOwnProperty.call(s, i) && a.push(i);
|
|
37
38
|
return a;
|
|
38
39
|
}, r.find = (s, a) => {
|
|
39
|
-
for (const
|
|
40
|
-
if (a(
|
|
41
|
-
return
|
|
40
|
+
for (const i of s)
|
|
41
|
+
if (a(i))
|
|
42
|
+
return i;
|
|
42
43
|
}, r.isInteger = typeof Number.isInteger == "function" ? (s) => Number.isInteger(s) : (s) => typeof s == "number" && isFinite(s) && Math.floor(s) === s;
|
|
43
44
|
function n(s, a = " | ") {
|
|
44
|
-
return s.map((
|
|
45
|
+
return s.map((i) => typeof i == "string" ? `'${i}'` : i).join(a);
|
|
45
46
|
}
|
|
46
47
|
r.joinValues = n, r.jsonStringifyReplacer = (s, a) => typeof a == "bigint" ? a.toString() : a;
|
|
47
48
|
})(x || (x = {}));
|
|
48
|
-
var
|
|
49
|
+
var Se;
|
|
49
50
|
(function(r) {
|
|
50
51
|
r.mergeShapes = (e, t) => ({
|
|
51
52
|
...e,
|
|
52
53
|
...t
|
|
53
54
|
// second overwrites first
|
|
54
55
|
});
|
|
55
|
-
})(
|
|
56
|
+
})(Se || (Se = {}));
|
|
56
57
|
const f = x.arrayToEnum([
|
|
57
58
|
"string",
|
|
58
59
|
"nan",
|
|
@@ -74,7 +75,7 @@ const f = x.arrayToEnum([
|
|
|
74
75
|
"never",
|
|
75
76
|
"map",
|
|
76
77
|
"set"
|
|
77
|
-
]),
|
|
78
|
+
]), P = (r) => {
|
|
78
79
|
switch (typeof r) {
|
|
79
80
|
case "undefined":
|
|
80
81
|
return f.undefined;
|
|
@@ -95,7 +96,7 @@ const f = x.arrayToEnum([
|
|
|
95
96
|
default:
|
|
96
97
|
return f.unknown;
|
|
97
98
|
}
|
|
98
|
-
},
|
|
99
|
+
}, d = x.arrayToEnum([
|
|
99
100
|
"invalid_type",
|
|
100
101
|
"invalid_literal",
|
|
101
102
|
"custom",
|
|
@@ -112,8 +113,8 @@ const f = x.arrayToEnum([
|
|
|
112
113
|
"invalid_intersection_types",
|
|
113
114
|
"not_multiple_of",
|
|
114
115
|
"not_finite"
|
|
115
|
-
]),
|
|
116
|
-
class
|
|
116
|
+
]), Ke = (r) => JSON.stringify(r, null, 2).replace(/"([^"]+)":/g, "$1:");
|
|
117
|
+
class N extends Error {
|
|
117
118
|
constructor(e) {
|
|
118
119
|
super(), this.issues = [], this.addIssue = (n) => {
|
|
119
120
|
this.issues = [...this.issues, n];
|
|
@@ -130,27 +131,27 @@ class O extends Error {
|
|
|
130
131
|
const t = e || function(a) {
|
|
131
132
|
return a.message;
|
|
132
133
|
}, n = { _errors: [] }, s = (a) => {
|
|
133
|
-
for (const
|
|
134
|
-
if (
|
|
135
|
-
|
|
136
|
-
else if (
|
|
137
|
-
s(
|
|
138
|
-
else if (
|
|
139
|
-
s(
|
|
140
|
-
else if (
|
|
141
|
-
n._errors.push(t(
|
|
134
|
+
for (const i of a.issues)
|
|
135
|
+
if (i.code === "invalid_union")
|
|
136
|
+
i.unionErrors.map(s);
|
|
137
|
+
else if (i.code === "invalid_return_type")
|
|
138
|
+
s(i.returnTypeError);
|
|
139
|
+
else if (i.code === "invalid_arguments")
|
|
140
|
+
s(i.argumentsError);
|
|
141
|
+
else if (i.path.length === 0)
|
|
142
|
+
n._errors.push(t(i));
|
|
142
143
|
else {
|
|
143
|
-
let
|
|
144
|
-
for (;
|
|
145
|
-
const
|
|
146
|
-
|
|
144
|
+
let o = n, u = 0;
|
|
145
|
+
for (; u < i.path.length; ) {
|
|
146
|
+
const c = i.path[u];
|
|
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++;
|
|
147
148
|
}
|
|
148
149
|
}
|
|
149
150
|
};
|
|
150
151
|
return s(this), n;
|
|
151
152
|
}
|
|
152
153
|
static assert(e) {
|
|
153
|
-
if (!(e instanceof
|
|
154
|
+
if (!(e instanceof N))
|
|
154
155
|
throw new Error(`Not a ZodError: ${e}`);
|
|
155
156
|
}
|
|
156
157
|
toString() {
|
|
@@ -172,56 +173,56 @@ class O extends Error {
|
|
|
172
173
|
return this.flatten();
|
|
173
174
|
}
|
|
174
175
|
}
|
|
175
|
-
|
|
176
|
-
const
|
|
176
|
+
N.create = (r) => new N(r);
|
|
177
|
+
const J = (r, e) => {
|
|
177
178
|
let t;
|
|
178
179
|
switch (r.code) {
|
|
179
|
-
case
|
|
180
|
+
case d.invalid_type:
|
|
180
181
|
r.received === f.undefined ? t = "Required" : t = `Expected ${r.expected}, received ${r.received}`;
|
|
181
182
|
break;
|
|
182
|
-
case
|
|
183
|
+
case d.invalid_literal:
|
|
183
184
|
t = `Invalid literal value, expected ${JSON.stringify(r.expected, x.jsonStringifyReplacer)}`;
|
|
184
185
|
break;
|
|
185
|
-
case
|
|
186
|
+
case d.unrecognized_keys:
|
|
186
187
|
t = `Unrecognized key(s) in object: ${x.joinValues(r.keys, ", ")}`;
|
|
187
188
|
break;
|
|
188
|
-
case
|
|
189
|
+
case d.invalid_union:
|
|
189
190
|
t = "Invalid input";
|
|
190
191
|
break;
|
|
191
|
-
case
|
|
192
|
+
case d.invalid_union_discriminator:
|
|
192
193
|
t = `Invalid discriminator value. Expected ${x.joinValues(r.options)}`;
|
|
193
194
|
break;
|
|
194
|
-
case
|
|
195
|
+
case d.invalid_enum_value:
|
|
195
196
|
t = `Invalid enum value. Expected ${x.joinValues(r.options)}, received '${r.received}'`;
|
|
196
197
|
break;
|
|
197
|
-
case
|
|
198
|
+
case d.invalid_arguments:
|
|
198
199
|
t = "Invalid function arguments";
|
|
199
200
|
break;
|
|
200
|
-
case
|
|
201
|
+
case d.invalid_return_type:
|
|
201
202
|
t = "Invalid function return type";
|
|
202
203
|
break;
|
|
203
|
-
case
|
|
204
|
+
case d.invalid_date:
|
|
204
205
|
t = "Invalid date";
|
|
205
206
|
break;
|
|
206
|
-
case
|
|
207
|
+
case d.invalid_string:
|
|
207
208
|
typeof r.validation == "object" ? "includes" in r.validation ? (t = `Invalid input: must include "${r.validation.includes}"`, typeof r.validation.position == "number" && (t = `${t} at one or more positions greater than or equal to ${r.validation.position}`)) : "startsWith" in r.validation ? t = `Invalid input: must start with "${r.validation.startsWith}"` : "endsWith" in r.validation ? t = `Invalid input: must end with "${r.validation.endsWith}"` : x.assertNever(r.validation) : r.validation !== "regex" ? t = `Invalid ${r.validation}` : t = "Invalid";
|
|
208
209
|
break;
|
|
209
|
-
case
|
|
210
|
+
case d.too_small:
|
|
210
211
|
r.type === "array" ? t = `Array must contain ${r.exact ? "exactly" : r.inclusive ? "at least" : "more than"} ${r.minimum} element(s)` : r.type === "string" ? t = `String must contain ${r.exact ? "exactly" : r.inclusive ? "at least" : "over"} ${r.minimum} character(s)` : r.type === "number" ? t = `Number must be ${r.exact ? "exactly equal to " : r.inclusive ? "greater than or equal to " : "greater than "}${r.minimum}` : r.type === "date" ? t = `Date must be ${r.exact ? "exactly equal to " : r.inclusive ? "greater than or equal to " : "greater than "}${new Date(Number(r.minimum))}` : t = "Invalid input";
|
|
211
212
|
break;
|
|
212
|
-
case
|
|
213
|
+
case d.too_big:
|
|
213
214
|
r.type === "array" ? t = `Array must contain ${r.exact ? "exactly" : r.inclusive ? "at most" : "less than"} ${r.maximum} element(s)` : r.type === "string" ? t = `String must contain ${r.exact ? "exactly" : r.inclusive ? "at most" : "under"} ${r.maximum} character(s)` : r.type === "number" ? t = `Number must be ${r.exact ? "exactly" : r.inclusive ? "less than or equal to" : "less than"} ${r.maximum}` : r.type === "bigint" ? t = `BigInt must be ${r.exact ? "exactly" : r.inclusive ? "less than or equal to" : "less than"} ${r.maximum}` : r.type === "date" ? t = `Date must be ${r.exact ? "exactly" : r.inclusive ? "smaller than or equal to" : "smaller than"} ${new Date(Number(r.maximum))}` : t = "Invalid input";
|
|
214
215
|
break;
|
|
215
|
-
case
|
|
216
|
+
case d.custom:
|
|
216
217
|
t = "Invalid input";
|
|
217
218
|
break;
|
|
218
|
-
case
|
|
219
|
+
case d.invalid_intersection_types:
|
|
219
220
|
t = "Intersection results could not be merged";
|
|
220
221
|
break;
|
|
221
|
-
case
|
|
222
|
+
case d.not_multiple_of:
|
|
222
223
|
t = `Number must be a multiple of ${r.multipleOf}`;
|
|
223
224
|
break;
|
|
224
|
-
case
|
|
225
|
+
case d.not_finite:
|
|
225
226
|
t = "Number must be finite";
|
|
226
227
|
break;
|
|
227
228
|
default:
|
|
@@ -229,15 +230,15 @@ const H = (r, e) => {
|
|
|
229
230
|
}
|
|
230
231
|
return { message: t };
|
|
231
232
|
};
|
|
232
|
-
let
|
|
233
|
-
function
|
|
234
|
-
|
|
233
|
+
let Ae = J;
|
|
234
|
+
function Fe(r) {
|
|
235
|
+
Ae = r;
|
|
235
236
|
}
|
|
236
237
|
function ye() {
|
|
237
|
-
return
|
|
238
|
+
return Ae;
|
|
238
239
|
}
|
|
239
240
|
const _e = (r) => {
|
|
240
|
-
const { data: e, path: t, errorMaps: n, issueData: s } = r, a = [...t, ...s.path || []],
|
|
241
|
+
const { data: e, path: t, errorMaps: n, issueData: s } = r, a = [...t, ...s.path || []], i = {
|
|
241
242
|
...s,
|
|
242
243
|
path: a
|
|
243
244
|
};
|
|
@@ -247,16 +248,16 @@ const _e = (r) => {
|
|
|
247
248
|
path: a,
|
|
248
249
|
message: s.message
|
|
249
250
|
};
|
|
250
|
-
let
|
|
251
|
-
const
|
|
252
|
-
for (const
|
|
253
|
-
|
|
251
|
+
let o = "";
|
|
252
|
+
const u = n.filter((c) => !!c).slice().reverse();
|
|
253
|
+
for (const c of u)
|
|
254
|
+
o = c(i, { data: e, defaultError: o }).message;
|
|
254
255
|
return {
|
|
255
256
|
...s,
|
|
256
257
|
path: a,
|
|
257
|
-
message:
|
|
258
|
+
message: o
|
|
258
259
|
};
|
|
259
|
-
},
|
|
260
|
+
}, et = [];
|
|
260
261
|
function l(r, e) {
|
|
261
262
|
const t = ye(), n = _e({
|
|
262
263
|
issueData: e,
|
|
@@ -266,13 +267,13 @@ function l(r, e) {
|
|
|
266
267
|
r.common.contextualErrorMap,
|
|
267
268
|
r.schemaErrorMap,
|
|
268
269
|
t,
|
|
269
|
-
t ===
|
|
270
|
+
t === J ? void 0 : J
|
|
270
271
|
// then global default map
|
|
271
272
|
].filter((s) => !!s)
|
|
272
273
|
});
|
|
273
274
|
r.common.issues.push(n);
|
|
274
275
|
}
|
|
275
|
-
class
|
|
276
|
+
class Z {
|
|
276
277
|
constructor() {
|
|
277
278
|
this.value = "valid";
|
|
278
279
|
}
|
|
@@ -294,33 +295,33 @@ class S {
|
|
|
294
295
|
static async mergeObjectAsync(e, t) {
|
|
295
296
|
const n = [];
|
|
296
297
|
for (const s of t) {
|
|
297
|
-
const a = await s.key,
|
|
298
|
+
const a = await s.key, i = await s.value;
|
|
298
299
|
n.push({
|
|
299
300
|
key: a,
|
|
300
|
-
value:
|
|
301
|
+
value: i
|
|
301
302
|
});
|
|
302
303
|
}
|
|
303
|
-
return
|
|
304
|
+
return Z.mergeObjectSync(e, n);
|
|
304
305
|
}
|
|
305
306
|
static mergeObjectSync(e, t) {
|
|
306
307
|
const n = {};
|
|
307
308
|
for (const s of t) {
|
|
308
|
-
const { key: a, value:
|
|
309
|
-
if (a.status === "aborted" ||
|
|
309
|
+
const { key: a, value: i } = s;
|
|
310
|
+
if (a.status === "aborted" || i.status === "aborted")
|
|
310
311
|
return p;
|
|
311
|
-
a.status === "dirty" && e.dirty(),
|
|
312
|
+
a.status === "dirty" && e.dirty(), i.status === "dirty" && e.dirty(), a.value !== "__proto__" && (typeof i.value < "u" || s.alwaysSet) && (n[a.value] = i.value);
|
|
312
313
|
}
|
|
313
314
|
return { status: e.value, value: n };
|
|
314
315
|
}
|
|
315
316
|
}
|
|
316
317
|
const p = Object.freeze({
|
|
317
318
|
status: "aborted"
|
|
318
|
-
}),
|
|
319
|
+
}), G = (r) => ({ status: "dirty", value: r }), S = (r) => ({ status: "valid", value: r }), Ce = (r) => r.status === "aborted", Oe = (r) => r.status === "dirty", ee = (r) => r.status === "valid", te = (r) => typeof Promise < "u" && r instanceof Promise;
|
|
319
320
|
function ve(r, e, t, n) {
|
|
320
321
|
if (typeof e == "function" ? r !== e || !n : !e.has(r)) throw new TypeError("Cannot read private member from an object whose class did not declare it");
|
|
321
322
|
return e.get(r);
|
|
322
323
|
}
|
|
323
|
-
function
|
|
324
|
+
function Me(r, e, t, n, s) {
|
|
324
325
|
if (typeof e == "function" ? r !== e || !s : !e.has(r)) throw new TypeError("Cannot write private member to an object whose class did not declare it");
|
|
325
326
|
return e.set(r, t), t;
|
|
326
327
|
}
|
|
@@ -328,7 +329,7 @@ var h;
|
|
|
328
329
|
(function(r) {
|
|
329
330
|
r.errToObj = (e) => typeof e == "string" ? { message: e } : e || {}, r.toString = (e) => typeof e == "string" ? e : e == null ? void 0 : e.message;
|
|
330
331
|
})(h || (h = {}));
|
|
331
|
-
var
|
|
332
|
+
var K, F;
|
|
332
333
|
class A {
|
|
333
334
|
constructor(e, t, n, s) {
|
|
334
335
|
this._cachedPath = [], this.parent = e, this.data = t, this._path = n, this._key = s;
|
|
@@ -347,7 +348,7 @@ const Ie = (r, e) => {
|
|
|
347
348
|
get error() {
|
|
348
349
|
if (this._error)
|
|
349
350
|
return this._error;
|
|
350
|
-
const t = new
|
|
351
|
+
const t = new N(r.common.issues);
|
|
351
352
|
return this._error = t, this._error;
|
|
352
353
|
}
|
|
353
354
|
};
|
|
@@ -358,10 +359,10 @@ function _(r) {
|
|
|
358
359
|
const { errorMap: e, invalid_type_error: t, required_error: n, description: s } = r;
|
|
359
360
|
if (e && (t || n))
|
|
360
361
|
throw new Error(`Can't use "invalid_type_error" or "required_error" in conjunction with custom error map.`);
|
|
361
|
-
return e ? { errorMap: e, description: s } : { errorMap: (
|
|
362
|
-
var
|
|
362
|
+
return e ? { errorMap: e, description: s } : { errorMap: (i, o) => {
|
|
363
|
+
var u, c;
|
|
363
364
|
const { message: y } = r;
|
|
364
|
-
return
|
|
365
|
+
return i.code === "invalid_enum_value" ? { message: y ?? o.defaultError } : typeof o.data > "u" ? { message: (u = y ?? n) !== null && u !== void 0 ? u : o.defaultError } : i.code !== "invalid_type" ? { message: o.defaultError } : { message: (c = y ?? t) !== null && c !== void 0 ? c : o.defaultError };
|
|
365
366
|
}, description: s };
|
|
366
367
|
}
|
|
367
368
|
class v {
|
|
@@ -372,13 +373,13 @@ class v {
|
|
|
372
373
|
return this._def.description;
|
|
373
374
|
}
|
|
374
375
|
_getType(e) {
|
|
375
|
-
return
|
|
376
|
+
return P(e.data);
|
|
376
377
|
}
|
|
377
378
|
_getOrReturnCtx(e, t) {
|
|
378
379
|
return t || {
|
|
379
380
|
common: e.parent.common,
|
|
380
381
|
data: e.data,
|
|
381
|
-
parsedType:
|
|
382
|
+
parsedType: P(e.data),
|
|
382
383
|
schemaErrorMap: this._def.errorMap,
|
|
383
384
|
path: e.path,
|
|
384
385
|
parent: e.parent
|
|
@@ -386,11 +387,11 @@ class v {
|
|
|
386
387
|
}
|
|
387
388
|
_processInputParams(e) {
|
|
388
389
|
return {
|
|
389
|
-
status: new
|
|
390
|
+
status: new Z(),
|
|
390
391
|
ctx: {
|
|
391
392
|
common: e.parent.common,
|
|
392
393
|
data: e.data,
|
|
393
|
-
parsedType:
|
|
394
|
+
parsedType: P(e.data),
|
|
394
395
|
schemaErrorMap: this._def.errorMap,
|
|
395
396
|
path: e.path,
|
|
396
397
|
parent: e.parent
|
|
@@ -425,7 +426,7 @@ class v {
|
|
|
425
426
|
schemaErrorMap: this._def.errorMap,
|
|
426
427
|
parent: null,
|
|
427
428
|
data: e,
|
|
428
|
-
parsedType:
|
|
429
|
+
parsedType: P(e)
|
|
429
430
|
}, a = this._parseSync({ data: e, path: s.path, parent: s });
|
|
430
431
|
return Ie(s, a);
|
|
431
432
|
}
|
|
@@ -446,18 +447,18 @@ class v {
|
|
|
446
447
|
schemaErrorMap: this._def.errorMap,
|
|
447
448
|
parent: null,
|
|
448
449
|
data: e,
|
|
449
|
-
parsedType:
|
|
450
|
+
parsedType: P(e)
|
|
450
451
|
}, s = this._parse({ data: e, path: n.path, parent: n }), a = await (te(s) ? s : Promise.resolve(s));
|
|
451
452
|
return Ie(n, a);
|
|
452
453
|
}
|
|
453
454
|
refine(e, t) {
|
|
454
455
|
const n = (s) => typeof t == "string" || typeof t > "u" ? { message: t } : typeof t == "function" ? t(s) : t;
|
|
455
456
|
return this._refinement((s, a) => {
|
|
456
|
-
const
|
|
457
|
-
code:
|
|
457
|
+
const i = e(s), o = () => a.addIssue({
|
|
458
|
+
code: d.custom,
|
|
458
459
|
...n(s)
|
|
459
460
|
});
|
|
460
|
-
return typeof Promise < "u" &&
|
|
461
|
+
return typeof Promise < "u" && i instanceof Promise ? i.then((u) => u ? !0 : (o(), !1)) : i ? !0 : (o(), !1);
|
|
461
462
|
});
|
|
462
463
|
}
|
|
463
464
|
refinement(e, t) {
|
|
@@ -547,40 +548,40 @@ class v {
|
|
|
547
548
|
return this.safeParse(null).success;
|
|
548
549
|
}
|
|
549
550
|
}
|
|
550
|
-
const
|
|
551
|
-
let
|
|
552
|
-
const
|
|
551
|
+
const tt = /^c[^\s-]{8,}$/i, rt = /^[0-9a-z]+$/, nt = /^[0-9A-HJKMNP-TV-Z]{26}$/, st = /^[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, at = /^[a-z0-9_-]{21}$/i, it = /^[-+]?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)?)??$/, ot = /^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i, dt = "^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$";
|
|
552
|
+
let Ze;
|
|
553
|
+
const ct = /^(?:(?: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])$/, ut = /^(([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})))$/, lt = /^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/, $e = "((\\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])))", ft = new RegExp(`^${$e}$`);
|
|
553
554
|
function ze(r) {
|
|
554
555
|
let e = "([01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d";
|
|
555
556
|
return r.precision ? e = `${e}\\.\\d{${r.precision}}` : r.precision == null && (e = `${e}(\\.\\d+)?`), e;
|
|
556
557
|
}
|
|
557
|
-
function
|
|
558
|
+
function ht(r) {
|
|
558
559
|
return new RegExp(`^${ze(r)}$`);
|
|
559
560
|
}
|
|
560
|
-
function
|
|
561
|
-
let e = `${
|
|
561
|
+
function Pe(r) {
|
|
562
|
+
let e = `${$e}T${ze(r)}`;
|
|
562
563
|
const t = [];
|
|
563
564
|
return t.push(r.local ? "Z?" : "Z"), r.offset && t.push("([+-]\\d{2}:?\\d{2})"), e = `${e}(${t.join("|")})`, new RegExp(`^${e}$`);
|
|
564
565
|
}
|
|
565
|
-
function
|
|
566
|
-
return !!((e === "v4" || !e) &&
|
|
566
|
+
function mt(r, e) {
|
|
567
|
+
return !!((e === "v4" || !e) && ct.test(r) || (e === "v6" || !e) && ut.test(r));
|
|
567
568
|
}
|
|
568
569
|
class E extends v {
|
|
569
570
|
_parse(e) {
|
|
570
571
|
if (this._def.coerce && (e.data = String(e.data)), this._getType(e) !== f.string) {
|
|
571
572
|
const a = this._getOrReturnCtx(e);
|
|
572
573
|
return l(a, {
|
|
573
|
-
code:
|
|
574
|
+
code: d.invalid_type,
|
|
574
575
|
expected: f.string,
|
|
575
576
|
received: a.parsedType
|
|
576
577
|
}), p;
|
|
577
578
|
}
|
|
578
|
-
const n = new
|
|
579
|
+
const n = new Z();
|
|
579
580
|
let s;
|
|
580
581
|
for (const a of this._def.checks)
|
|
581
582
|
if (a.kind === "min")
|
|
582
583
|
e.data.length < a.value && (s = this._getOrReturnCtx(e, s), l(s, {
|
|
583
|
-
code:
|
|
584
|
+
code: d.too_small,
|
|
584
585
|
minimum: a.value,
|
|
585
586
|
type: "string",
|
|
586
587
|
inclusive: !0,
|
|
@@ -589,7 +590,7 @@ class E extends v {
|
|
|
589
590
|
}), n.dirty());
|
|
590
591
|
else if (a.kind === "max")
|
|
591
592
|
e.data.length > a.value && (s = this._getOrReturnCtx(e, s), l(s, {
|
|
592
|
-
code:
|
|
593
|
+
code: d.too_big,
|
|
593
594
|
maximum: a.value,
|
|
594
595
|
type: "string",
|
|
595
596
|
inclusive: !0,
|
|
@@ -597,16 +598,16 @@ class E extends v {
|
|
|
597
598
|
message: a.message
|
|
598
599
|
}), n.dirty());
|
|
599
600
|
else if (a.kind === "length") {
|
|
600
|
-
const
|
|
601
|
-
(
|
|
602
|
-
code:
|
|
601
|
+
const i = e.data.length > a.value, o = e.data.length < a.value;
|
|
602
|
+
(i || o) && (s = this._getOrReturnCtx(e, s), i ? l(s, {
|
|
603
|
+
code: d.too_big,
|
|
603
604
|
maximum: a.value,
|
|
604
605
|
type: "string",
|
|
605
606
|
inclusive: !0,
|
|
606
607
|
exact: !0,
|
|
607
608
|
message: a.message
|
|
608
|
-
}) :
|
|
609
|
-
code:
|
|
609
|
+
}) : o && l(s, {
|
|
610
|
+
code: d.too_small,
|
|
610
611
|
minimum: a.value,
|
|
611
612
|
type: "string",
|
|
612
613
|
inclusive: !0,
|
|
@@ -614,45 +615,45 @@ class E extends v {
|
|
|
614
615
|
message: a.message
|
|
615
616
|
}), n.dirty());
|
|
616
617
|
} else if (a.kind === "email")
|
|
617
|
-
|
|
618
|
+
ot.test(e.data) || (s = this._getOrReturnCtx(e, s), l(s, {
|
|
618
619
|
validation: "email",
|
|
619
|
-
code:
|
|
620
|
+
code: d.invalid_string,
|
|
620
621
|
message: a.message
|
|
621
622
|
}), n.dirty());
|
|
622
623
|
else if (a.kind === "emoji")
|
|
623
|
-
|
|
624
|
+
Ze || (Ze = new RegExp(dt, "u")), Ze.test(e.data) || (s = this._getOrReturnCtx(e, s), l(s, {
|
|
624
625
|
validation: "emoji",
|
|
625
|
-
code:
|
|
626
|
+
code: d.invalid_string,
|
|
626
627
|
message: a.message
|
|
627
628
|
}), n.dirty());
|
|
628
629
|
else if (a.kind === "uuid")
|
|
629
|
-
|
|
630
|
+
st.test(e.data) || (s = this._getOrReturnCtx(e, s), l(s, {
|
|
630
631
|
validation: "uuid",
|
|
631
|
-
code:
|
|
632
|
+
code: d.invalid_string,
|
|
632
633
|
message: a.message
|
|
633
634
|
}), n.dirty());
|
|
634
635
|
else if (a.kind === "nanoid")
|
|
635
|
-
|
|
636
|
+
at.test(e.data) || (s = this._getOrReturnCtx(e, s), l(s, {
|
|
636
637
|
validation: "nanoid",
|
|
637
|
-
code:
|
|
638
|
+
code: d.invalid_string,
|
|
638
639
|
message: a.message
|
|
639
640
|
}), n.dirty());
|
|
640
641
|
else if (a.kind === "cuid")
|
|
641
|
-
|
|
642
|
+
tt.test(e.data) || (s = this._getOrReturnCtx(e, s), l(s, {
|
|
642
643
|
validation: "cuid",
|
|
643
|
-
code:
|
|
644
|
+
code: d.invalid_string,
|
|
644
645
|
message: a.message
|
|
645
646
|
}), n.dirty());
|
|
646
647
|
else if (a.kind === "cuid2")
|
|
647
|
-
|
|
648
|
+
rt.test(e.data) || (s = this._getOrReturnCtx(e, s), l(s, {
|
|
648
649
|
validation: "cuid2",
|
|
649
|
-
code:
|
|
650
|
+
code: d.invalid_string,
|
|
650
651
|
message: a.message
|
|
651
652
|
}), n.dirty());
|
|
652
653
|
else if (a.kind === "ulid")
|
|
653
|
-
|
|
654
|
+
nt.test(e.data) || (s = this._getOrReturnCtx(e, s), l(s, {
|
|
654
655
|
validation: "ulid",
|
|
655
|
-
code:
|
|
656
|
+
code: d.invalid_string,
|
|
656
657
|
message: a.message
|
|
657
658
|
}), n.dirty());
|
|
658
659
|
else if (a.kind === "url")
|
|
@@ -661,49 +662,49 @@ class E extends v {
|
|
|
661
662
|
} catch {
|
|
662
663
|
s = this._getOrReturnCtx(e, s), l(s, {
|
|
663
664
|
validation: "url",
|
|
664
|
-
code:
|
|
665
|
+
code: d.invalid_string,
|
|
665
666
|
message: a.message
|
|
666
667
|
}), n.dirty();
|
|
667
668
|
}
|
|
668
669
|
else a.kind === "regex" ? (a.regex.lastIndex = 0, a.regex.test(e.data) || (s = this._getOrReturnCtx(e, s), l(s, {
|
|
669
670
|
validation: "regex",
|
|
670
|
-
code:
|
|
671
|
+
code: d.invalid_string,
|
|
671
672
|
message: a.message
|
|
672
673
|
}), n.dirty())) : a.kind === "trim" ? e.data = e.data.trim() : a.kind === "includes" ? e.data.includes(a.value, a.position) || (s = this._getOrReturnCtx(e, s), l(s, {
|
|
673
|
-
code:
|
|
674
|
+
code: d.invalid_string,
|
|
674
675
|
validation: { includes: a.value, position: a.position },
|
|
675
676
|
message: a.message
|
|
676
677
|
}), n.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) || (s = this._getOrReturnCtx(e, s), l(s, {
|
|
677
|
-
code:
|
|
678
|
+
code: d.invalid_string,
|
|
678
679
|
validation: { startsWith: a.value },
|
|
679
680
|
message: a.message
|
|
680
681
|
}), n.dirty()) : a.kind === "endsWith" ? e.data.endsWith(a.value) || (s = this._getOrReturnCtx(e, s), l(s, {
|
|
681
|
-
code:
|
|
682
|
+
code: d.invalid_string,
|
|
682
683
|
validation: { endsWith: a.value },
|
|
683
684
|
message: a.message
|
|
684
|
-
}), n.dirty()) : a.kind === "datetime" ?
|
|
685
|
-
code:
|
|
685
|
+
}), n.dirty()) : a.kind === "datetime" ? Pe(a).test(e.data) || (s = this._getOrReturnCtx(e, s), l(s, {
|
|
686
|
+
code: d.invalid_string,
|
|
686
687
|
validation: "datetime",
|
|
687
688
|
message: a.message
|
|
688
|
-
}), n.dirty()) : a.kind === "date" ?
|
|
689
|
-
code:
|
|
689
|
+
}), n.dirty()) : a.kind === "date" ? ft.test(e.data) || (s = this._getOrReturnCtx(e, s), l(s, {
|
|
690
|
+
code: d.invalid_string,
|
|
690
691
|
validation: "date",
|
|
691
692
|
message: a.message
|
|
692
|
-
}), n.dirty()) : a.kind === "time" ?
|
|
693
|
-
code:
|
|
693
|
+
}), n.dirty()) : a.kind === "time" ? ht(a).test(e.data) || (s = this._getOrReturnCtx(e, s), l(s, {
|
|
694
|
+
code: d.invalid_string,
|
|
694
695
|
validation: "time",
|
|
695
696
|
message: a.message
|
|
696
|
-
}), n.dirty()) : a.kind === "duration" ?
|
|
697
|
+
}), n.dirty()) : a.kind === "duration" ? it.test(e.data) || (s = this._getOrReturnCtx(e, s), l(s, {
|
|
697
698
|
validation: "duration",
|
|
698
|
-
code:
|
|
699
|
+
code: d.invalid_string,
|
|
699
700
|
message: a.message
|
|
700
|
-
}), n.dirty()) : a.kind === "ip" ?
|
|
701
|
+
}), n.dirty()) : a.kind === "ip" ? mt(e.data, a.version) || (s = this._getOrReturnCtx(e, s), l(s, {
|
|
701
702
|
validation: "ip",
|
|
702
|
-
code:
|
|
703
|
+
code: d.invalid_string,
|
|
703
704
|
message: a.message
|
|
704
|
-
}), n.dirty()) : a.kind === "base64" ?
|
|
705
|
+
}), n.dirty()) : a.kind === "base64" ? lt.test(e.data) || (s = this._getOrReturnCtx(e, s), l(s, {
|
|
705
706
|
validation: "base64",
|
|
706
|
-
code:
|
|
707
|
+
code: d.invalid_string,
|
|
707
708
|
message: a.message
|
|
708
709
|
}), n.dirty()) : x.assertNever(a);
|
|
709
710
|
return { status: n.value, value: e.data };
|
|
@@ -711,7 +712,7 @@ class E extends v {
|
|
|
711
712
|
_regex(e, t, n) {
|
|
712
713
|
return this.refinement((s) => e.test(s), {
|
|
713
714
|
validation: t,
|
|
714
|
-
code:
|
|
715
|
+
code: d.invalid_string,
|
|
715
716
|
...h.errToObj(n)
|
|
716
717
|
});
|
|
717
718
|
}
|
|
@@ -923,9 +924,9 @@ E.create = (r) => {
|
|
|
923
924
|
..._(r)
|
|
924
925
|
});
|
|
925
926
|
};
|
|
926
|
-
function
|
|
927
|
-
const t = (r.toString().split(".")[1] || "").length, n = (e.toString().split(".")[1] || "").length, s = t > n ? t : n, a = parseInt(r.toFixed(s).replace(".", "")),
|
|
928
|
-
return a %
|
|
927
|
+
function pt(r, e) {
|
|
928
|
+
const t = (r.toString().split(".")[1] || "").length, n = (e.toString().split(".")[1] || "").length, s = t > n ? t : n, a = parseInt(r.toFixed(s).replace(".", "")), i = parseInt(e.toFixed(s).replace(".", ""));
|
|
929
|
+
return a % i / Math.pow(10, s);
|
|
929
930
|
}
|
|
930
931
|
class V extends v {
|
|
931
932
|
constructor() {
|
|
@@ -935,39 +936,39 @@ class V extends v {
|
|
|
935
936
|
if (this._def.coerce && (e.data = Number(e.data)), this._getType(e) !== f.number) {
|
|
936
937
|
const a = this._getOrReturnCtx(e);
|
|
937
938
|
return l(a, {
|
|
938
|
-
code:
|
|
939
|
+
code: d.invalid_type,
|
|
939
940
|
expected: f.number,
|
|
940
941
|
received: a.parsedType
|
|
941
942
|
}), p;
|
|
942
943
|
}
|
|
943
944
|
let n;
|
|
944
|
-
const s = new
|
|
945
|
+
const s = new Z();
|
|
945
946
|
for (const a of this._def.checks)
|
|
946
947
|
a.kind === "int" ? x.isInteger(e.data) || (n = this._getOrReturnCtx(e, n), l(n, {
|
|
947
|
-
code:
|
|
948
|
+
code: d.invalid_type,
|
|
948
949
|
expected: "integer",
|
|
949
950
|
received: "float",
|
|
950
951
|
message: a.message
|
|
951
952
|
}), s.dirty()) : a.kind === "min" ? (a.inclusive ? e.data < a.value : e.data <= a.value) && (n = this._getOrReturnCtx(e, n), l(n, {
|
|
952
|
-
code:
|
|
953
|
+
code: d.too_small,
|
|
953
954
|
minimum: a.value,
|
|
954
955
|
type: "number",
|
|
955
956
|
inclusive: a.inclusive,
|
|
956
957
|
exact: !1,
|
|
957
958
|
message: a.message
|
|
958
959
|
}), s.dirty()) : a.kind === "max" ? (a.inclusive ? e.data > a.value : e.data >= a.value) && (n = this._getOrReturnCtx(e, n), l(n, {
|
|
959
|
-
code:
|
|
960
|
+
code: d.too_big,
|
|
960
961
|
maximum: a.value,
|
|
961
962
|
type: "number",
|
|
962
963
|
inclusive: a.inclusive,
|
|
963
964
|
exact: !1,
|
|
964
965
|
message: a.message
|
|
965
|
-
}), s.dirty()) : a.kind === "multipleOf" ?
|
|
966
|
-
code:
|
|
966
|
+
}), s.dirty()) : a.kind === "multipleOf" ? pt(e.data, a.value) !== 0 && (n = this._getOrReturnCtx(e, n), l(n, {
|
|
967
|
+
code: d.not_multiple_of,
|
|
967
968
|
multipleOf: a.value,
|
|
968
969
|
message: a.message
|
|
969
970
|
}), s.dirty()) : a.kind === "finite" ? Number.isFinite(e.data) || (n = this._getOrReturnCtx(e, n), l(n, {
|
|
970
|
-
code:
|
|
971
|
+
code: d.not_finite,
|
|
971
972
|
message: a.message
|
|
972
973
|
}), s.dirty()) : x.assertNever(a);
|
|
973
974
|
return { status: s.value, value: e.data };
|
|
@@ -1107,28 +1108,28 @@ class D extends v {
|
|
|
1107
1108
|
if (this._def.coerce && (e.data = BigInt(e.data)), this._getType(e) !== f.bigint) {
|
|
1108
1109
|
const a = this._getOrReturnCtx(e);
|
|
1109
1110
|
return l(a, {
|
|
1110
|
-
code:
|
|
1111
|
+
code: d.invalid_type,
|
|
1111
1112
|
expected: f.bigint,
|
|
1112
1113
|
received: a.parsedType
|
|
1113
1114
|
}), p;
|
|
1114
1115
|
}
|
|
1115
1116
|
let n;
|
|
1116
|
-
const s = new
|
|
1117
|
+
const s = new Z();
|
|
1117
1118
|
for (const a of this._def.checks)
|
|
1118
1119
|
a.kind === "min" ? (a.inclusive ? e.data < a.value : e.data <= a.value) && (n = this._getOrReturnCtx(e, n), l(n, {
|
|
1119
|
-
code:
|
|
1120
|
+
code: d.too_small,
|
|
1120
1121
|
type: "bigint",
|
|
1121
1122
|
minimum: a.value,
|
|
1122
1123
|
inclusive: a.inclusive,
|
|
1123
1124
|
message: a.message
|
|
1124
1125
|
}), s.dirty()) : a.kind === "max" ? (a.inclusive ? e.data > a.value : e.data >= a.value) && (n = this._getOrReturnCtx(e, n), l(n, {
|
|
1125
|
-
code:
|
|
1126
|
+
code: d.too_big,
|
|
1126
1127
|
type: "bigint",
|
|
1127
1128
|
maximum: a.value,
|
|
1128
1129
|
inclusive: a.inclusive,
|
|
1129
1130
|
message: a.message
|
|
1130
1131
|
}), s.dirty()) : a.kind === "multipleOf" ? e.data % a.value !== BigInt(0) && (n = this._getOrReturnCtx(e, n), l(n, {
|
|
1131
|
-
code:
|
|
1132
|
+
code: d.not_multiple_of,
|
|
1132
1133
|
multipleOf: a.value,
|
|
1133
1134
|
message: a.message
|
|
1134
1135
|
}), s.dirty()) : x.assertNever(a);
|
|
@@ -1232,12 +1233,12 @@ class re extends v {
|
|
|
1232
1233
|
if (this._def.coerce && (e.data = !!e.data), this._getType(e) !== f.boolean) {
|
|
1233
1234
|
const n = this._getOrReturnCtx(e);
|
|
1234
1235
|
return l(n, {
|
|
1235
|
-
code:
|
|
1236
|
+
code: d.invalid_type,
|
|
1236
1237
|
expected: f.boolean,
|
|
1237
1238
|
received: n.parsedType
|
|
1238
1239
|
}), p;
|
|
1239
1240
|
}
|
|
1240
|
-
return
|
|
1241
|
+
return S(e.data);
|
|
1241
1242
|
}
|
|
1242
1243
|
}
|
|
1243
1244
|
re.create = (r) => new re({
|
|
@@ -1250,7 +1251,7 @@ class B extends v {
|
|
|
1250
1251
|
if (this._def.coerce && (e.data = new Date(e.data)), this._getType(e) !== f.date) {
|
|
1251
1252
|
const a = this._getOrReturnCtx(e);
|
|
1252
1253
|
return l(a, {
|
|
1253
|
-
code:
|
|
1254
|
+
code: d.invalid_type,
|
|
1254
1255
|
expected: f.date,
|
|
1255
1256
|
received: a.parsedType
|
|
1256
1257
|
}), p;
|
|
@@ -1258,21 +1259,21 @@ class B extends v {
|
|
|
1258
1259
|
if (isNaN(e.data.getTime())) {
|
|
1259
1260
|
const a = this._getOrReturnCtx(e);
|
|
1260
1261
|
return l(a, {
|
|
1261
|
-
code:
|
|
1262
|
+
code: d.invalid_date
|
|
1262
1263
|
}), p;
|
|
1263
1264
|
}
|
|
1264
|
-
const n = new
|
|
1265
|
+
const n = new Z();
|
|
1265
1266
|
let s;
|
|
1266
1267
|
for (const a of this._def.checks)
|
|
1267
1268
|
a.kind === "min" ? e.data.getTime() < a.value && (s = this._getOrReturnCtx(e, s), l(s, {
|
|
1268
|
-
code:
|
|
1269
|
+
code: d.too_small,
|
|
1269
1270
|
message: a.message,
|
|
1270
1271
|
inclusive: !0,
|
|
1271
1272
|
exact: !1,
|
|
1272
1273
|
minimum: a.value,
|
|
1273
1274
|
type: "date"
|
|
1274
1275
|
}), n.dirty()) : a.kind === "max" ? e.data.getTime() > a.value && (s = this._getOrReturnCtx(e, s), l(s, {
|
|
1275
|
-
code:
|
|
1276
|
+
code: d.too_big,
|
|
1276
1277
|
message: a.message,
|
|
1277
1278
|
inclusive: !0,
|
|
1278
1279
|
exact: !1,
|
|
@@ -1328,12 +1329,12 @@ class ge extends v {
|
|
|
1328
1329
|
if (this._getType(e) !== f.symbol) {
|
|
1329
1330
|
const n = this._getOrReturnCtx(e);
|
|
1330
1331
|
return l(n, {
|
|
1331
|
-
code:
|
|
1332
|
+
code: d.invalid_type,
|
|
1332
1333
|
expected: f.symbol,
|
|
1333
1334
|
received: n.parsedType
|
|
1334
1335
|
}), p;
|
|
1335
1336
|
}
|
|
1336
|
-
return
|
|
1337
|
+
return S(e.data);
|
|
1337
1338
|
}
|
|
1338
1339
|
}
|
|
1339
1340
|
ge.create = (r) => new ge({
|
|
@@ -1345,12 +1346,12 @@ class ne extends v {
|
|
|
1345
1346
|
if (this._getType(e) !== f.undefined) {
|
|
1346
1347
|
const n = this._getOrReturnCtx(e);
|
|
1347
1348
|
return l(n, {
|
|
1348
|
-
code:
|
|
1349
|
+
code: d.invalid_type,
|
|
1349
1350
|
expected: f.undefined,
|
|
1350
1351
|
received: n.parsedType
|
|
1351
1352
|
}), p;
|
|
1352
1353
|
}
|
|
1353
|
-
return
|
|
1354
|
+
return S(e.data);
|
|
1354
1355
|
}
|
|
1355
1356
|
}
|
|
1356
1357
|
ne.create = (r) => new ne({
|
|
@@ -1362,12 +1363,12 @@ class se extends v {
|
|
|
1362
1363
|
if (this._getType(e) !== f.null) {
|
|
1363
1364
|
const n = this._getOrReturnCtx(e);
|
|
1364
1365
|
return l(n, {
|
|
1365
|
-
code:
|
|
1366
|
+
code: d.invalid_type,
|
|
1366
1367
|
expected: f.null,
|
|
1367
1368
|
received: n.parsedType
|
|
1368
1369
|
}), p;
|
|
1369
1370
|
}
|
|
1370
|
-
return
|
|
1371
|
+
return S(e.data);
|
|
1371
1372
|
}
|
|
1372
1373
|
}
|
|
1373
1374
|
se.create = (r) => new se({
|
|
@@ -1379,7 +1380,7 @@ class Q extends v {
|
|
|
1379
1380
|
super(...arguments), this._any = !0;
|
|
1380
1381
|
}
|
|
1381
1382
|
_parse(e) {
|
|
1382
|
-
return
|
|
1383
|
+
return S(e.data);
|
|
1383
1384
|
}
|
|
1384
1385
|
}
|
|
1385
1386
|
Q.create = (r) => new Q({
|
|
@@ -1391,24 +1392,24 @@ class U extends v {
|
|
|
1391
1392
|
super(...arguments), this._unknown = !0;
|
|
1392
1393
|
}
|
|
1393
1394
|
_parse(e) {
|
|
1394
|
-
return
|
|
1395
|
+
return S(e.data);
|
|
1395
1396
|
}
|
|
1396
1397
|
}
|
|
1397
1398
|
U.create = (r) => new U({
|
|
1398
1399
|
typeName: m.ZodUnknown,
|
|
1399
1400
|
..._(r)
|
|
1400
1401
|
});
|
|
1401
|
-
class
|
|
1402
|
+
class z extends v {
|
|
1402
1403
|
_parse(e) {
|
|
1403
1404
|
const t = this._getOrReturnCtx(e);
|
|
1404
1405
|
return l(t, {
|
|
1405
|
-
code:
|
|
1406
|
+
code: d.invalid_type,
|
|
1406
1407
|
expected: f.never,
|
|
1407
1408
|
received: t.parsedType
|
|
1408
1409
|
}), p;
|
|
1409
1410
|
}
|
|
1410
1411
|
}
|
|
1411
|
-
|
|
1412
|
+
z.create = (r) => new z({
|
|
1412
1413
|
typeName: m.ZodNever,
|
|
1413
1414
|
..._(r)
|
|
1414
1415
|
});
|
|
@@ -1417,12 +1418,12 @@ class xe extends v {
|
|
|
1417
1418
|
if (this._getType(e) !== f.undefined) {
|
|
1418
1419
|
const n = this._getOrReturnCtx(e);
|
|
1419
1420
|
return l(n, {
|
|
1420
|
-
code:
|
|
1421
|
+
code: d.invalid_type,
|
|
1421
1422
|
expected: f.void,
|
|
1422
1423
|
received: n.parsedType
|
|
1423
1424
|
}), p;
|
|
1424
1425
|
}
|
|
1425
|
-
return
|
|
1426
|
+
return S(e.data);
|
|
1426
1427
|
}
|
|
1427
1428
|
}
|
|
1428
1429
|
xe.create = (r) => new xe({
|
|
@@ -1434,16 +1435,16 @@ class R extends v {
|
|
|
1434
1435
|
const { ctx: t, status: n } = this._processInputParams(e), s = this._def;
|
|
1435
1436
|
if (t.parsedType !== f.array)
|
|
1436
1437
|
return l(t, {
|
|
1437
|
-
code:
|
|
1438
|
+
code: d.invalid_type,
|
|
1438
1439
|
expected: f.array,
|
|
1439
1440
|
received: t.parsedType
|
|
1440
1441
|
}), p;
|
|
1441
1442
|
if (s.exactLength !== null) {
|
|
1442
|
-
const
|
|
1443
|
-
(
|
|
1444
|
-
code:
|
|
1445
|
-
minimum:
|
|
1446
|
-
maximum:
|
|
1443
|
+
const i = t.data.length > s.exactLength.value, o = t.data.length < s.exactLength.value;
|
|
1444
|
+
(i || o) && (l(t, {
|
|
1445
|
+
code: i ? d.too_big : d.too_small,
|
|
1446
|
+
minimum: o ? s.exactLength.value : void 0,
|
|
1447
|
+
maximum: i ? s.exactLength.value : void 0,
|
|
1447
1448
|
type: "array",
|
|
1448
1449
|
inclusive: !0,
|
|
1449
1450
|
exact: !0,
|
|
@@ -1451,23 +1452,23 @@ class R extends v {
|
|
|
1451
1452
|
}), n.dirty());
|
|
1452
1453
|
}
|
|
1453
1454
|
if (s.minLength !== null && t.data.length < s.minLength.value && (l(t, {
|
|
1454
|
-
code:
|
|
1455
|
+
code: d.too_small,
|
|
1455
1456
|
minimum: s.minLength.value,
|
|
1456
1457
|
type: "array",
|
|
1457
1458
|
inclusive: !0,
|
|
1458
1459
|
exact: !1,
|
|
1459
1460
|
message: s.minLength.message
|
|
1460
1461
|
}), n.dirty()), s.maxLength !== null && t.data.length > s.maxLength.value && (l(t, {
|
|
1461
|
-
code:
|
|
1462
|
+
code: d.too_big,
|
|
1462
1463
|
maximum: s.maxLength.value,
|
|
1463
1464
|
type: "array",
|
|
1464
1465
|
inclusive: !0,
|
|
1465
1466
|
exact: !1,
|
|
1466
1467
|
message: s.maxLength.message
|
|
1467
1468
|
}), n.dirty()), t.common.async)
|
|
1468
|
-
return Promise.all([...t.data].map((
|
|
1469
|
-
const a = [...t.data].map((
|
|
1470
|
-
return
|
|
1469
|
+
return Promise.all([...t.data].map((i, o) => s.type._parseAsync(new A(t, i, t.path, o)))).then((i) => Z.mergeArray(n, i));
|
|
1470
|
+
const a = [...t.data].map((i, o) => s.type._parseSync(new A(t, i, t.path, o)));
|
|
1471
|
+
return Z.mergeArray(n, a);
|
|
1471
1472
|
}
|
|
1472
1473
|
get element() {
|
|
1473
1474
|
return this._def.type;
|
|
@@ -1502,23 +1503,23 @@ R.create = (r, e) => new R({
|
|
|
1502
1503
|
typeName: m.ZodArray,
|
|
1503
1504
|
..._(e)
|
|
1504
1505
|
});
|
|
1505
|
-
function
|
|
1506
|
-
if (r instanceof
|
|
1506
|
+
function Y(r) {
|
|
1507
|
+
if (r instanceof k) {
|
|
1507
1508
|
const e = {};
|
|
1508
1509
|
for (const t in r.shape) {
|
|
1509
1510
|
const n = r.shape[t];
|
|
1510
|
-
e[t] = j.create(
|
|
1511
|
+
e[t] = j.create(Y(n));
|
|
1511
1512
|
}
|
|
1512
|
-
return new
|
|
1513
|
+
return new k({
|
|
1513
1514
|
...r._def,
|
|
1514
1515
|
shape: () => e
|
|
1515
1516
|
});
|
|
1516
1517
|
} else return r instanceof R ? new R({
|
|
1517
1518
|
...r._def,
|
|
1518
|
-
type:
|
|
1519
|
-
}) : r instanceof j ? j.create(
|
|
1519
|
+
type: Y(r.element)
|
|
1520
|
+
}) : r instanceof j ? j.create(Y(r.unwrap())) : r instanceof q ? q.create(Y(r.unwrap())) : r instanceof M ? M.create(r.items.map((e) => Y(e))) : r;
|
|
1520
1521
|
}
|
|
1521
|
-
class
|
|
1522
|
+
class k extends v {
|
|
1522
1523
|
constructor() {
|
|
1523
1524
|
super(...arguments), this._cached = null, this.nonstrict = this.passthrough, this.augment = this.extend;
|
|
1524
1525
|
}
|
|
@@ -1530,48 +1531,48 @@ class b extends v {
|
|
|
1530
1531
|
}
|
|
1531
1532
|
_parse(e) {
|
|
1532
1533
|
if (this._getType(e) !== f.object) {
|
|
1533
|
-
const
|
|
1534
|
-
return l(
|
|
1535
|
-
code:
|
|
1534
|
+
const c = this._getOrReturnCtx(e);
|
|
1535
|
+
return l(c, {
|
|
1536
|
+
code: d.invalid_type,
|
|
1536
1537
|
expected: f.object,
|
|
1537
|
-
received:
|
|
1538
|
+
received: c.parsedType
|
|
1538
1539
|
}), p;
|
|
1539
1540
|
}
|
|
1540
|
-
const { status: n, ctx: s } = this._processInputParams(e), { shape: a, keys:
|
|
1541
|
-
if (!(this._def.catchall instanceof
|
|
1542
|
-
for (const
|
|
1543
|
-
|
|
1544
|
-
const
|
|
1545
|
-
for (const
|
|
1546
|
-
const y = a[
|
|
1547
|
-
|
|
1548
|
-
key: { status: "valid", value:
|
|
1549
|
-
value: y._parse(new A(s,
|
|
1550
|
-
alwaysSet:
|
|
1541
|
+
const { status: n, ctx: s } = this._processInputParams(e), { shape: a, keys: i } = this._getCached(), o = [];
|
|
1542
|
+
if (!(this._def.catchall instanceof z && this._def.unknownKeys === "strip"))
|
|
1543
|
+
for (const c in s.data)
|
|
1544
|
+
i.includes(c) || o.push(c);
|
|
1545
|
+
const u = [];
|
|
1546
|
+
for (const c of i) {
|
|
1547
|
+
const y = a[c], O = s.data[c];
|
|
1548
|
+
u.push({
|
|
1549
|
+
key: { status: "valid", value: c },
|
|
1550
|
+
value: y._parse(new A(s, O, s.path, c)),
|
|
1551
|
+
alwaysSet: c in s.data
|
|
1551
1552
|
});
|
|
1552
1553
|
}
|
|
1553
|
-
if (this._def.catchall instanceof
|
|
1554
|
-
const
|
|
1555
|
-
if (
|
|
1556
|
-
for (const y of
|
|
1557
|
-
|
|
1554
|
+
if (this._def.catchall instanceof z) {
|
|
1555
|
+
const c = this._def.unknownKeys;
|
|
1556
|
+
if (c === "passthrough")
|
|
1557
|
+
for (const y of o)
|
|
1558
|
+
u.push({
|
|
1558
1559
|
key: { status: "valid", value: y },
|
|
1559
1560
|
value: { status: "valid", value: s.data[y] }
|
|
1560
1561
|
});
|
|
1561
|
-
else if (
|
|
1562
|
-
|
|
1563
|
-
code:
|
|
1564
|
-
keys:
|
|
1562
|
+
else if (c === "strict")
|
|
1563
|
+
o.length > 0 && (l(s, {
|
|
1564
|
+
code: d.unrecognized_keys,
|
|
1565
|
+
keys: o
|
|
1565
1566
|
}), n.dirty());
|
|
1566
|
-
else if (
|
|
1567
|
+
else if (c !== "strip") throw new Error("Internal ZodObject error: invalid unknownKeys value.");
|
|
1567
1568
|
} else {
|
|
1568
|
-
const
|
|
1569
|
-
for (const y of
|
|
1570
|
-
const
|
|
1571
|
-
|
|
1569
|
+
const c = this._def.catchall;
|
|
1570
|
+
for (const y of o) {
|
|
1571
|
+
const O = s.data[y];
|
|
1572
|
+
u.push({
|
|
1572
1573
|
key: { status: "valid", value: y },
|
|
1573
|
-
value:
|
|
1574
|
-
new A(s,
|
|
1574
|
+
value: c._parse(
|
|
1575
|
+
new A(s, O, s.path, y)
|
|
1575
1576
|
//, ctx.child(key), value, getParsedType(value)
|
|
1576
1577
|
),
|
|
1577
1578
|
alwaysSet: y in s.data
|
|
@@ -1579,46 +1580,46 @@ class b extends v {
|
|
|
1579
1580
|
}
|
|
1580
1581
|
}
|
|
1581
1582
|
return s.common.async ? Promise.resolve().then(async () => {
|
|
1582
|
-
const
|
|
1583
|
-
for (const y of
|
|
1584
|
-
const
|
|
1585
|
-
|
|
1586
|
-
key:
|
|
1583
|
+
const c = [];
|
|
1584
|
+
for (const y of u) {
|
|
1585
|
+
const O = await y.key, Te = await y.value;
|
|
1586
|
+
c.push({
|
|
1587
|
+
key: O,
|
|
1587
1588
|
value: Te,
|
|
1588
1589
|
alwaysSet: y.alwaysSet
|
|
1589
1590
|
});
|
|
1590
1591
|
}
|
|
1591
|
-
return
|
|
1592
|
-
}).then((
|
|
1592
|
+
return c;
|
|
1593
|
+
}).then((c) => Z.mergeObjectSync(n, c)) : Z.mergeObjectSync(n, u);
|
|
1593
1594
|
}
|
|
1594
1595
|
get shape() {
|
|
1595
1596
|
return this._def.shape();
|
|
1596
1597
|
}
|
|
1597
1598
|
strict(e) {
|
|
1598
|
-
return h.errToObj, new
|
|
1599
|
+
return h.errToObj, new k({
|
|
1599
1600
|
...this._def,
|
|
1600
1601
|
unknownKeys: "strict",
|
|
1601
1602
|
...e !== void 0 ? {
|
|
1602
1603
|
errorMap: (t, n) => {
|
|
1603
|
-
var s, a,
|
|
1604
|
-
const
|
|
1604
|
+
var s, a, i, o;
|
|
1605
|
+
const u = (i = (a = (s = this._def).errorMap) === null || a === void 0 ? void 0 : a.call(s, t, n).message) !== null && i !== void 0 ? i : n.defaultError;
|
|
1605
1606
|
return t.code === "unrecognized_keys" ? {
|
|
1606
|
-
message: (
|
|
1607
|
+
message: (o = h.errToObj(e).message) !== null && o !== void 0 ? o : u
|
|
1607
1608
|
} : {
|
|
1608
|
-
message:
|
|
1609
|
+
message: u
|
|
1609
1610
|
};
|
|
1610
1611
|
}
|
|
1611
1612
|
} : {}
|
|
1612
1613
|
});
|
|
1613
1614
|
}
|
|
1614
1615
|
strip() {
|
|
1615
|
-
return new
|
|
1616
|
+
return new k({
|
|
1616
1617
|
...this._def,
|
|
1617
1618
|
unknownKeys: "strip"
|
|
1618
1619
|
});
|
|
1619
1620
|
}
|
|
1620
1621
|
passthrough() {
|
|
1621
|
-
return new
|
|
1622
|
+
return new k({
|
|
1622
1623
|
...this._def,
|
|
1623
1624
|
unknownKeys: "passthrough"
|
|
1624
1625
|
});
|
|
@@ -1641,7 +1642,7 @@ class b extends v {
|
|
|
1641
1642
|
// }) as any;
|
|
1642
1643
|
// };
|
|
1643
1644
|
extend(e) {
|
|
1644
|
-
return new
|
|
1645
|
+
return new k({
|
|
1645
1646
|
...this._def,
|
|
1646
1647
|
shape: () => ({
|
|
1647
1648
|
...this._def.shape(),
|
|
@@ -1655,7 +1656,7 @@ class b extends v {
|
|
|
1655
1656
|
* upgrade if you are experiencing issues.
|
|
1656
1657
|
*/
|
|
1657
1658
|
merge(e) {
|
|
1658
|
-
return new
|
|
1659
|
+
return new k({
|
|
1659
1660
|
unknownKeys: e._def.unknownKeys,
|
|
1660
1661
|
catchall: e._def.catchall,
|
|
1661
1662
|
shape: () => ({
|
|
@@ -1725,7 +1726,7 @@ class b extends v {
|
|
|
1725
1726
|
// return merged;
|
|
1726
1727
|
// }
|
|
1727
1728
|
catchall(e) {
|
|
1728
|
-
return new
|
|
1729
|
+
return new k({
|
|
1729
1730
|
...this._def,
|
|
1730
1731
|
catchall: e
|
|
1731
1732
|
});
|
|
@@ -1734,7 +1735,7 @@ class b extends v {
|
|
|
1734
1735
|
const t = {};
|
|
1735
1736
|
return x.objectKeys(e).forEach((n) => {
|
|
1736
1737
|
e[n] && this.shape[n] && (t[n] = this.shape[n]);
|
|
1737
|
-
}), new
|
|
1738
|
+
}), new k({
|
|
1738
1739
|
...this._def,
|
|
1739
1740
|
shape: () => t
|
|
1740
1741
|
});
|
|
@@ -1743,7 +1744,7 @@ class b extends v {
|
|
|
1743
1744
|
const t = {};
|
|
1744
1745
|
return x.objectKeys(this.shape).forEach((n) => {
|
|
1745
1746
|
e[n] || (t[n] = this.shape[n]);
|
|
1746
|
-
}), new
|
|
1747
|
+
}), new k({
|
|
1747
1748
|
...this._def,
|
|
1748
1749
|
shape: () => t
|
|
1749
1750
|
});
|
|
@@ -1752,14 +1753,14 @@ class b extends v {
|
|
|
1752
1753
|
* @deprecated
|
|
1753
1754
|
*/
|
|
1754
1755
|
deepPartial() {
|
|
1755
|
-
return
|
|
1756
|
+
return Y(this);
|
|
1756
1757
|
}
|
|
1757
1758
|
partial(e) {
|
|
1758
1759
|
const t = {};
|
|
1759
1760
|
return x.objectKeys(this.shape).forEach((n) => {
|
|
1760
1761
|
const s = this.shape[n];
|
|
1761
1762
|
e && !e[n] ? t[n] = s : t[n] = s.optional();
|
|
1762
|
-
}), new
|
|
1763
|
+
}), new k({
|
|
1763
1764
|
...this._def,
|
|
1764
1765
|
shape: () => t
|
|
1765
1766
|
});
|
|
@@ -1775,33 +1776,33 @@ class b extends v {
|
|
|
1775
1776
|
a = a._def.innerType;
|
|
1776
1777
|
t[n] = a;
|
|
1777
1778
|
}
|
|
1778
|
-
}), new
|
|
1779
|
+
}), new k({
|
|
1779
1780
|
...this._def,
|
|
1780
1781
|
shape: () => t
|
|
1781
1782
|
});
|
|
1782
1783
|
}
|
|
1783
1784
|
keyof() {
|
|
1784
|
-
return
|
|
1785
|
+
return Ve(x.objectKeys(this.shape));
|
|
1785
1786
|
}
|
|
1786
1787
|
}
|
|
1787
|
-
|
|
1788
|
+
k.create = (r, e) => new k({
|
|
1788
1789
|
shape: () => r,
|
|
1789
1790
|
unknownKeys: "strip",
|
|
1790
|
-
catchall:
|
|
1791
|
+
catchall: z.create(),
|
|
1791
1792
|
typeName: m.ZodObject,
|
|
1792
1793
|
..._(e)
|
|
1793
1794
|
});
|
|
1794
|
-
|
|
1795
|
+
k.strictCreate = (r, e) => new k({
|
|
1795
1796
|
shape: () => r,
|
|
1796
1797
|
unknownKeys: "strict",
|
|
1797
|
-
catchall:
|
|
1798
|
+
catchall: z.create(),
|
|
1798
1799
|
typeName: m.ZodObject,
|
|
1799
1800
|
..._(e)
|
|
1800
1801
|
});
|
|
1801
|
-
|
|
1802
|
+
k.lazycreate = (r, e) => new k({
|
|
1802
1803
|
shape: r,
|
|
1803
1804
|
unknownKeys: "strip",
|
|
1804
|
-
catchall:
|
|
1805
|
+
catchall: z.create(),
|
|
1805
1806
|
typeName: m.ZodObject,
|
|
1806
1807
|
..._(e)
|
|
1807
1808
|
});
|
|
@@ -1809,21 +1810,21 @@ class ae extends v {
|
|
|
1809
1810
|
_parse(e) {
|
|
1810
1811
|
const { ctx: t } = this._processInputParams(e), n = this._def.options;
|
|
1811
1812
|
function s(a) {
|
|
1812
|
-
for (const
|
|
1813
|
-
if (
|
|
1814
|
-
return
|
|
1815
|
-
for (const
|
|
1816
|
-
if (
|
|
1817
|
-
return t.common.issues.push(...
|
|
1818
|
-
const
|
|
1813
|
+
for (const o of a)
|
|
1814
|
+
if (o.result.status === "valid")
|
|
1815
|
+
return o.result;
|
|
1816
|
+
for (const o of a)
|
|
1817
|
+
if (o.result.status === "dirty")
|
|
1818
|
+
return t.common.issues.push(...o.ctx.common.issues), o.result;
|
|
1819
|
+
const i = a.map((o) => new N(o.ctx.common.issues));
|
|
1819
1820
|
return l(t, {
|
|
1820
|
-
code:
|
|
1821
|
-
unionErrors:
|
|
1821
|
+
code: d.invalid_union,
|
|
1822
|
+
unionErrors: i
|
|
1822
1823
|
}), p;
|
|
1823
1824
|
}
|
|
1824
1825
|
if (t.common.async)
|
|
1825
1826
|
return Promise.all(n.map(async (a) => {
|
|
1826
|
-
const
|
|
1827
|
+
const i = {
|
|
1827
1828
|
...t,
|
|
1828
1829
|
common: {
|
|
1829
1830
|
...t.common,
|
|
@@ -1835,37 +1836,37 @@ class ae extends v {
|
|
|
1835
1836
|
result: await a._parseAsync({
|
|
1836
1837
|
data: t.data,
|
|
1837
1838
|
path: t.path,
|
|
1838
|
-
parent:
|
|
1839
|
+
parent: i
|
|
1839
1840
|
}),
|
|
1840
|
-
ctx:
|
|
1841
|
+
ctx: i
|
|
1841
1842
|
};
|
|
1842
1843
|
})).then(s);
|
|
1843
1844
|
{
|
|
1844
1845
|
let a;
|
|
1845
|
-
const
|
|
1846
|
-
for (const
|
|
1847
|
-
const
|
|
1846
|
+
const i = [];
|
|
1847
|
+
for (const u of n) {
|
|
1848
|
+
const c = {
|
|
1848
1849
|
...t,
|
|
1849
1850
|
common: {
|
|
1850
1851
|
...t.common,
|
|
1851
1852
|
issues: []
|
|
1852
1853
|
},
|
|
1853
1854
|
parent: null
|
|
1854
|
-
}, y =
|
|
1855
|
+
}, y = u._parseSync({
|
|
1855
1856
|
data: t.data,
|
|
1856
1857
|
path: t.path,
|
|
1857
|
-
parent:
|
|
1858
|
+
parent: c
|
|
1858
1859
|
});
|
|
1859
1860
|
if (y.status === "valid")
|
|
1860
1861
|
return y;
|
|
1861
|
-
y.status === "dirty" && !a && (a = { result: y, ctx:
|
|
1862
|
+
y.status === "dirty" && !a && (a = { result: y, ctx: c }), c.common.issues.length && i.push(c.common.issues);
|
|
1862
1863
|
}
|
|
1863
1864
|
if (a)
|
|
1864
1865
|
return t.common.issues.push(...a.ctx.common.issues), a.result;
|
|
1865
|
-
const
|
|
1866
|
+
const o = i.map((u) => new N(u));
|
|
1866
1867
|
return l(t, {
|
|
1867
|
-
code:
|
|
1868
|
-
unionErrors:
|
|
1868
|
+
code: d.invalid_union,
|
|
1869
|
+
unionErrors: o
|
|
1869
1870
|
}), p;
|
|
1870
1871
|
}
|
|
1871
1872
|
}
|
|
@@ -1878,13 +1879,13 @@ ae.create = (r, e) => new ae({
|
|
|
1878
1879
|
typeName: m.ZodUnion,
|
|
1879
1880
|
..._(e)
|
|
1880
1881
|
});
|
|
1881
|
-
const $ = (r) => r instanceof
|
|
1882
|
+
const $ = (r) => r instanceof de ? $(r.schema) : r instanceof I ? $(r.innerType()) : r instanceof ce ? [r.value] : r instanceof L ? r.options : r instanceof ue ? x.objectValues(r.enum) : r instanceof le ? $(r._def.innerType) : r instanceof ne ? [void 0] : r instanceof se ? [null] : r instanceof j ? [void 0, ...$(r.unwrap())] : r instanceof q ? [null, ...$(r.unwrap())] : r instanceof Ee || r instanceof he ? $(r.unwrap()) : r instanceof fe ? $(r._def.innerType) : [];
|
|
1882
1883
|
class we extends v {
|
|
1883
1884
|
_parse(e) {
|
|
1884
1885
|
const { ctx: t } = this._processInputParams(e);
|
|
1885
1886
|
if (t.parsedType !== f.object)
|
|
1886
1887
|
return l(t, {
|
|
1887
|
-
code:
|
|
1888
|
+
code: d.invalid_type,
|
|
1888
1889
|
expected: f.object,
|
|
1889
1890
|
received: t.parsedType
|
|
1890
1891
|
}), p;
|
|
@@ -1898,7 +1899,7 @@ class we extends v {
|
|
|
1898
1899
|
path: t.path,
|
|
1899
1900
|
parent: t
|
|
1900
1901
|
}) : (l(t, {
|
|
1901
|
-
code:
|
|
1902
|
+
code: d.invalid_union_discriminator,
|
|
1902
1903
|
options: Array.from(this.optionsMap.keys()),
|
|
1903
1904
|
path: [n]
|
|
1904
1905
|
}), p);
|
|
@@ -1923,13 +1924,13 @@ class we extends v {
|
|
|
1923
1924
|
static create(e, t, n) {
|
|
1924
1925
|
const s = /* @__PURE__ */ new Map();
|
|
1925
1926
|
for (const a of t) {
|
|
1926
|
-
const
|
|
1927
|
-
if (!
|
|
1927
|
+
const i = $(a.shape[e]);
|
|
1928
|
+
if (!i.length)
|
|
1928
1929
|
throw new Error(`A discriminator value for key \`${e}\` could not be extracted from all schema options`);
|
|
1929
|
-
for (const
|
|
1930
|
-
if (s.has(
|
|
1931
|
-
throw new Error(`Discriminator property ${String(e)} has duplicate value ${String(
|
|
1932
|
-
s.set(
|
|
1930
|
+
for (const o of i) {
|
|
1931
|
+
if (s.has(o))
|
|
1932
|
+
throw new Error(`Discriminator property ${String(e)} has duplicate value ${String(o)}`);
|
|
1933
|
+
s.set(o, a);
|
|
1933
1934
|
}
|
|
1934
1935
|
}
|
|
1935
1936
|
return new we({
|
|
@@ -1941,40 +1942,40 @@ class we extends v {
|
|
|
1941
1942
|
});
|
|
1942
1943
|
}
|
|
1943
1944
|
}
|
|
1944
|
-
function
|
|
1945
|
-
const t =
|
|
1945
|
+
function Ne(r, e) {
|
|
1946
|
+
const t = P(r), n = P(e);
|
|
1946
1947
|
if (r === e)
|
|
1947
1948
|
return { valid: !0, data: r };
|
|
1948
1949
|
if (t === f.object && n === f.object) {
|
|
1949
|
-
const s = x.objectKeys(e), a = x.objectKeys(r).filter((
|
|
1950
|
-
for (const
|
|
1951
|
-
const
|
|
1952
|
-
if (!
|
|
1950
|
+
const s = x.objectKeys(e), a = x.objectKeys(r).filter((o) => s.indexOf(o) !== -1), i = { ...r, ...e };
|
|
1951
|
+
for (const o of a) {
|
|
1952
|
+
const u = Ne(r[o], e[o]);
|
|
1953
|
+
if (!u.valid)
|
|
1953
1954
|
return { valid: !1 };
|
|
1954
|
-
o
|
|
1955
|
+
i[o] = u.data;
|
|
1955
1956
|
}
|
|
1956
|
-
return { valid: !0, data:
|
|
1957
|
+
return { valid: !0, data: i };
|
|
1957
1958
|
} else if (t === f.array && n === f.array) {
|
|
1958
1959
|
if (r.length !== e.length)
|
|
1959
1960
|
return { valid: !1 };
|
|
1960
1961
|
const s = [];
|
|
1961
1962
|
for (let a = 0; a < r.length; a++) {
|
|
1962
|
-
const
|
|
1963
|
-
if (!
|
|
1963
|
+
const i = r[a], o = e[a], u = Ne(i, o);
|
|
1964
|
+
if (!u.valid)
|
|
1964
1965
|
return { valid: !1 };
|
|
1965
|
-
s.push(
|
|
1966
|
+
s.push(u.data);
|
|
1966
1967
|
}
|
|
1967
1968
|
return { valid: !0, data: s };
|
|
1968
1969
|
} else return t === f.date && n === f.date && +r == +e ? { valid: !0, data: r } : { valid: !1 };
|
|
1969
1970
|
}
|
|
1970
1971
|
class ie extends v {
|
|
1971
1972
|
_parse(e) {
|
|
1972
|
-
const { status: t, ctx: n } = this._processInputParams(e), s = (a,
|
|
1973
|
-
if (Ce(a) || Ce(
|
|
1973
|
+
const { status: t, ctx: n } = this._processInputParams(e), s = (a, i) => {
|
|
1974
|
+
if (Ce(a) || Ce(i))
|
|
1974
1975
|
return p;
|
|
1975
|
-
const
|
|
1976
|
-
return
|
|
1977
|
-
code:
|
|
1976
|
+
const o = Ne(a.value, i.value);
|
|
1977
|
+
return o.valid ? ((Oe(a) || Oe(i)) && t.dirty(), { status: t.value, value: o.data }) : (l(n, {
|
|
1978
|
+
code: d.invalid_intersection_types
|
|
1978
1979
|
}), p);
|
|
1979
1980
|
};
|
|
1980
1981
|
return n.common.async ? Promise.all([
|
|
@@ -1988,7 +1989,7 @@ class ie extends v {
|
|
|
1988
1989
|
path: n.path,
|
|
1989
1990
|
parent: n
|
|
1990
1991
|
})
|
|
1991
|
-
]).then(([a,
|
|
1992
|
+
]).then(([a, i]) => s(a, i)) : s(this._def.left._parseSync({
|
|
1992
1993
|
data: n.data,
|
|
1993
1994
|
path: n.path,
|
|
1994
1995
|
parent: n
|
|
@@ -2010,30 +2011,30 @@ class M extends v {
|
|
|
2010
2011
|
const { status: t, ctx: n } = this._processInputParams(e);
|
|
2011
2012
|
if (n.parsedType !== f.array)
|
|
2012
2013
|
return l(n, {
|
|
2013
|
-
code:
|
|
2014
|
+
code: d.invalid_type,
|
|
2014
2015
|
expected: f.array,
|
|
2015
2016
|
received: n.parsedType
|
|
2016
2017
|
}), p;
|
|
2017
2018
|
if (n.data.length < this._def.items.length)
|
|
2018
2019
|
return l(n, {
|
|
2019
|
-
code:
|
|
2020
|
+
code: d.too_small,
|
|
2020
2021
|
minimum: this._def.items.length,
|
|
2021
2022
|
inclusive: !0,
|
|
2022
2023
|
exact: !1,
|
|
2023
2024
|
type: "array"
|
|
2024
2025
|
}), p;
|
|
2025
2026
|
!this._def.rest && n.data.length > this._def.items.length && (l(n, {
|
|
2026
|
-
code:
|
|
2027
|
+
code: d.too_big,
|
|
2027
2028
|
maximum: this._def.items.length,
|
|
2028
2029
|
inclusive: !0,
|
|
2029
2030
|
exact: !1,
|
|
2030
2031
|
type: "array"
|
|
2031
2032
|
}), t.dirty());
|
|
2032
|
-
const a = [...n.data].map((
|
|
2033
|
-
const
|
|
2034
|
-
return
|
|
2035
|
-
}).filter((
|
|
2036
|
-
return n.common.async ? Promise.all(a).then((
|
|
2033
|
+
const a = [...n.data].map((i, o) => {
|
|
2034
|
+
const u = this._def.items[o] || this._def.rest;
|
|
2035
|
+
return u ? u._parse(new A(n, i, n.path, o)) : null;
|
|
2036
|
+
}).filter((i) => !!i);
|
|
2037
|
+
return n.common.async ? Promise.all(a).then((i) => Z.mergeArray(t, i)) : Z.mergeArray(t, a);
|
|
2037
2038
|
}
|
|
2038
2039
|
get items() {
|
|
2039
2040
|
return this._def.items;
|
|
@@ -2066,18 +2067,18 @@ class oe extends v {
|
|
|
2066
2067
|
const { status: t, ctx: n } = this._processInputParams(e);
|
|
2067
2068
|
if (n.parsedType !== f.object)
|
|
2068
2069
|
return l(n, {
|
|
2069
|
-
code:
|
|
2070
|
+
code: d.invalid_type,
|
|
2070
2071
|
expected: f.object,
|
|
2071
2072
|
received: n.parsedType
|
|
2072
2073
|
}), p;
|
|
2073
|
-
const s = [], a = this._def.keyType,
|
|
2074
|
-
for (const
|
|
2074
|
+
const s = [], a = this._def.keyType, i = this._def.valueType;
|
|
2075
|
+
for (const o in n.data)
|
|
2075
2076
|
s.push({
|
|
2076
|
-
key: a._parse(new A(n,
|
|
2077
|
-
value:
|
|
2078
|
-
alwaysSet:
|
|
2077
|
+
key: a._parse(new A(n, o, n.path, o)),
|
|
2078
|
+
value: i._parse(new A(n, n.data[o], n.path, o)),
|
|
2079
|
+
alwaysSet: o in n.data
|
|
2079
2080
|
});
|
|
2080
|
-
return n.common.async ?
|
|
2081
|
+
return n.common.async ? Z.mergeObjectAsync(t, s) : Z.mergeObjectSync(t, s);
|
|
2081
2082
|
}
|
|
2082
2083
|
get element() {
|
|
2083
2084
|
return this._def.valueType;
|
|
@@ -2096,7 +2097,7 @@ class oe extends v {
|
|
|
2096
2097
|
});
|
|
2097
2098
|
}
|
|
2098
2099
|
}
|
|
2099
|
-
class
|
|
2100
|
+
class ke extends v {
|
|
2100
2101
|
get keySchema() {
|
|
2101
2102
|
return this._def.keyType;
|
|
2102
2103
|
}
|
|
@@ -2107,38 +2108,38 @@ class be extends v {
|
|
|
2107
2108
|
const { status: t, ctx: n } = this._processInputParams(e);
|
|
2108
2109
|
if (n.parsedType !== f.map)
|
|
2109
2110
|
return l(n, {
|
|
2110
|
-
code:
|
|
2111
|
+
code: d.invalid_type,
|
|
2111
2112
|
expected: f.map,
|
|
2112
2113
|
received: n.parsedType
|
|
2113
2114
|
}), p;
|
|
2114
|
-
const s = this._def.keyType, a = this._def.valueType,
|
|
2115
|
-
key: s._parse(new A(n,
|
|
2116
|
-
value: a._parse(new A(n,
|
|
2115
|
+
const s = this._def.keyType, a = this._def.valueType, i = [...n.data.entries()].map(([o, u], c) => ({
|
|
2116
|
+
key: s._parse(new A(n, o, n.path, [c, "key"])),
|
|
2117
|
+
value: a._parse(new A(n, u, n.path, [c, "value"]))
|
|
2117
2118
|
}));
|
|
2118
2119
|
if (n.common.async) {
|
|
2119
|
-
const
|
|
2120
|
+
const o = /* @__PURE__ */ new Map();
|
|
2120
2121
|
return Promise.resolve().then(async () => {
|
|
2121
|
-
for (const
|
|
2122
|
-
const
|
|
2123
|
-
if (
|
|
2122
|
+
for (const u of i) {
|
|
2123
|
+
const c = await u.key, y = await u.value;
|
|
2124
|
+
if (c.status === "aborted" || y.status === "aborted")
|
|
2124
2125
|
return p;
|
|
2125
|
-
(
|
|
2126
|
+
(c.status === "dirty" || y.status === "dirty") && t.dirty(), o.set(c.value, y.value);
|
|
2126
2127
|
}
|
|
2127
|
-
return { status: t.value, value:
|
|
2128
|
+
return { status: t.value, value: o };
|
|
2128
2129
|
});
|
|
2129
2130
|
} else {
|
|
2130
|
-
const
|
|
2131
|
-
for (const
|
|
2132
|
-
const
|
|
2133
|
-
if (
|
|
2131
|
+
const o = /* @__PURE__ */ new Map();
|
|
2132
|
+
for (const u of i) {
|
|
2133
|
+
const c = u.key, y = u.value;
|
|
2134
|
+
if (c.status === "aborted" || y.status === "aborted")
|
|
2134
2135
|
return p;
|
|
2135
|
-
(
|
|
2136
|
+
(c.status === "dirty" || y.status === "dirty") && t.dirty(), o.set(c.value, y.value);
|
|
2136
2137
|
}
|
|
2137
|
-
return { status: t.value, value:
|
|
2138
|
+
return { status: t.value, value: o };
|
|
2138
2139
|
}
|
|
2139
2140
|
}
|
|
2140
2141
|
}
|
|
2141
|
-
|
|
2142
|
+
ke.create = (r, e, t) => new ke({
|
|
2142
2143
|
valueType: e,
|
|
2143
2144
|
keyType: r,
|
|
2144
2145
|
typeName: m.ZodMap,
|
|
@@ -2149,20 +2150,20 @@ class W extends v {
|
|
|
2149
2150
|
const { status: t, ctx: n } = this._processInputParams(e);
|
|
2150
2151
|
if (n.parsedType !== f.set)
|
|
2151
2152
|
return l(n, {
|
|
2152
|
-
code:
|
|
2153
|
+
code: d.invalid_type,
|
|
2153
2154
|
expected: f.set,
|
|
2154
2155
|
received: n.parsedType
|
|
2155
2156
|
}), p;
|
|
2156
2157
|
const s = this._def;
|
|
2157
2158
|
s.minSize !== null && n.data.size < s.minSize.value && (l(n, {
|
|
2158
|
-
code:
|
|
2159
|
+
code: d.too_small,
|
|
2159
2160
|
minimum: s.minSize.value,
|
|
2160
2161
|
type: "set",
|
|
2161
2162
|
inclusive: !0,
|
|
2162
2163
|
exact: !1,
|
|
2163
2164
|
message: s.minSize.message
|
|
2164
2165
|
}), t.dirty()), s.maxSize !== null && n.data.size > s.maxSize.value && (l(n, {
|
|
2165
|
-
code:
|
|
2166
|
+
code: d.too_big,
|
|
2166
2167
|
maximum: s.maxSize.value,
|
|
2167
2168
|
type: "set",
|
|
2168
2169
|
inclusive: !0,
|
|
@@ -2170,17 +2171,17 @@ class W extends v {
|
|
|
2170
2171
|
message: s.maxSize.message
|
|
2171
2172
|
}), t.dirty());
|
|
2172
2173
|
const a = this._def.valueType;
|
|
2173
|
-
function
|
|
2174
|
-
const
|
|
2175
|
-
for (const y of
|
|
2174
|
+
function i(u) {
|
|
2175
|
+
const c = /* @__PURE__ */ new Set();
|
|
2176
|
+
for (const y of u) {
|
|
2176
2177
|
if (y.status === "aborted")
|
|
2177
2178
|
return p;
|
|
2178
|
-
y.status === "dirty" && t.dirty(),
|
|
2179
|
+
y.status === "dirty" && t.dirty(), c.add(y.value);
|
|
2179
2180
|
}
|
|
2180
|
-
return { status: t.value, value:
|
|
2181
|
+
return { status: t.value, value: c };
|
|
2181
2182
|
}
|
|
2182
|
-
const
|
|
2183
|
-
return n.common.async ? Promise.all(
|
|
2183
|
+
const o = [...n.data.values()].map((u, c) => a._parse(new A(n, u, n.path, c)));
|
|
2184
|
+
return n.common.async ? Promise.all(o).then((u) => i(u)) : i(o);
|
|
2184
2185
|
}
|
|
2185
2186
|
min(e, t) {
|
|
2186
2187
|
return new W({
|
|
@@ -2208,7 +2209,7 @@ W.create = (r, e) => new W({
|
|
|
2208
2209
|
typeName: m.ZodSet,
|
|
2209
2210
|
..._(e)
|
|
2210
2211
|
});
|
|
2211
|
-
class
|
|
2212
|
+
class H extends v {
|
|
2212
2213
|
constructor() {
|
|
2213
2214
|
super(...arguments), this.validate = this.implement;
|
|
2214
2215
|
}
|
|
@@ -2216,63 +2217,63 @@ class G extends v {
|
|
|
2216
2217
|
const { ctx: t } = this._processInputParams(e);
|
|
2217
2218
|
if (t.parsedType !== f.function)
|
|
2218
2219
|
return l(t, {
|
|
2219
|
-
code:
|
|
2220
|
+
code: d.invalid_type,
|
|
2220
2221
|
expected: f.function,
|
|
2221
2222
|
received: t.parsedType
|
|
2222
2223
|
}), p;
|
|
2223
|
-
function n(
|
|
2224
|
+
function n(o, u) {
|
|
2224
2225
|
return _e({
|
|
2225
|
-
data:
|
|
2226
|
+
data: o,
|
|
2226
2227
|
path: t.path,
|
|
2227
2228
|
errorMaps: [
|
|
2228
2229
|
t.common.contextualErrorMap,
|
|
2229
2230
|
t.schemaErrorMap,
|
|
2230
2231
|
ye(),
|
|
2231
|
-
|
|
2232
|
-
].filter((
|
|
2232
|
+
J
|
|
2233
|
+
].filter((c) => !!c),
|
|
2233
2234
|
issueData: {
|
|
2234
|
-
code:
|
|
2235
|
-
argumentsError:
|
|
2235
|
+
code: d.invalid_arguments,
|
|
2236
|
+
argumentsError: u
|
|
2236
2237
|
}
|
|
2237
2238
|
});
|
|
2238
2239
|
}
|
|
2239
|
-
function s(
|
|
2240
|
+
function s(o, u) {
|
|
2240
2241
|
return _e({
|
|
2241
|
-
data:
|
|
2242
|
+
data: o,
|
|
2242
2243
|
path: t.path,
|
|
2243
2244
|
errorMaps: [
|
|
2244
2245
|
t.common.contextualErrorMap,
|
|
2245
2246
|
t.schemaErrorMap,
|
|
2246
2247
|
ye(),
|
|
2247
|
-
|
|
2248
|
-
].filter((
|
|
2248
|
+
J
|
|
2249
|
+
].filter((c) => !!c),
|
|
2249
2250
|
issueData: {
|
|
2250
|
-
code:
|
|
2251
|
-
returnTypeError:
|
|
2251
|
+
code: d.invalid_return_type,
|
|
2252
|
+
returnTypeError: u
|
|
2252
2253
|
}
|
|
2253
2254
|
});
|
|
2254
2255
|
}
|
|
2255
|
-
const a = { errorMap: t.common.contextualErrorMap },
|
|
2256
|
+
const a = { errorMap: t.common.contextualErrorMap }, i = t.data;
|
|
2256
2257
|
if (this._def.returns instanceof X) {
|
|
2257
|
-
const
|
|
2258
|
-
return
|
|
2259
|
-
const
|
|
2260
|
-
throw
|
|
2261
|
-
}),
|
|
2262
|
-
return await
|
|
2263
|
-
throw
|
|
2258
|
+
const o = this;
|
|
2259
|
+
return S(async function(...u) {
|
|
2260
|
+
const c = new N([]), y = await o._def.args.parseAsync(u, a).catch((pe) => {
|
|
2261
|
+
throw c.addIssue(n(u, pe)), c;
|
|
2262
|
+
}), O = await Reflect.apply(i, this, y);
|
|
2263
|
+
return await o._def.returns._def.type.parseAsync(O, a).catch((pe) => {
|
|
2264
|
+
throw c.addIssue(s(O, pe)), c;
|
|
2264
2265
|
});
|
|
2265
2266
|
});
|
|
2266
2267
|
} else {
|
|
2267
|
-
const
|
|
2268
|
-
return
|
|
2269
|
-
const
|
|
2270
|
-
if (!
|
|
2271
|
-
throw new
|
|
2272
|
-
const y = Reflect.apply(
|
|
2273
|
-
if (!
|
|
2274
|
-
throw new
|
|
2275
|
-
return
|
|
2268
|
+
const o = this;
|
|
2269
|
+
return S(function(...u) {
|
|
2270
|
+
const c = o._def.args.safeParse(u, a);
|
|
2271
|
+
if (!c.success)
|
|
2272
|
+
throw new N([n(u, c.error)]);
|
|
2273
|
+
const y = Reflect.apply(i, this, c.data), O = o._def.returns.safeParse(y, a);
|
|
2274
|
+
if (!O.success)
|
|
2275
|
+
throw new N([s(y, O.error)]);
|
|
2276
|
+
return O.data;
|
|
2276
2277
|
});
|
|
2277
2278
|
}
|
|
2278
2279
|
}
|
|
@@ -2283,13 +2284,13 @@ class G extends v {
|
|
|
2283
2284
|
return this._def.returns;
|
|
2284
2285
|
}
|
|
2285
2286
|
args(...e) {
|
|
2286
|
-
return new
|
|
2287
|
+
return new H({
|
|
2287
2288
|
...this._def,
|
|
2288
2289
|
args: M.create(e).rest(U.create())
|
|
2289
2290
|
});
|
|
2290
2291
|
}
|
|
2291
2292
|
returns(e) {
|
|
2292
|
-
return new
|
|
2293
|
+
return new H({
|
|
2293
2294
|
...this._def,
|
|
2294
2295
|
returns: e
|
|
2295
2296
|
});
|
|
@@ -2301,7 +2302,7 @@ class G extends v {
|
|
|
2301
2302
|
return this.parse(e);
|
|
2302
2303
|
}
|
|
2303
2304
|
static create(e, t, n) {
|
|
2304
|
-
return new
|
|
2305
|
+
return new H({
|
|
2305
2306
|
args: e || M.create([]).rest(U.create()),
|
|
2306
2307
|
returns: t || U.create(),
|
|
2307
2308
|
typeName: m.ZodFunction,
|
|
@@ -2309,7 +2310,7 @@ class G extends v {
|
|
|
2309
2310
|
});
|
|
2310
2311
|
}
|
|
2311
2312
|
}
|
|
2312
|
-
class
|
|
2313
|
+
class de extends v {
|
|
2313
2314
|
get schema() {
|
|
2314
2315
|
return this._def.getter();
|
|
2315
2316
|
}
|
|
@@ -2318,18 +2319,18 @@ class ce extends v {
|
|
|
2318
2319
|
return this._def.getter()._parse({ data: t.data, path: t.path, parent: t });
|
|
2319
2320
|
}
|
|
2320
2321
|
}
|
|
2321
|
-
|
|
2322
|
+
de.create = (r, e) => new de({
|
|
2322
2323
|
getter: r,
|
|
2323
2324
|
typeName: m.ZodLazy,
|
|
2324
2325
|
..._(e)
|
|
2325
2326
|
});
|
|
2326
|
-
class
|
|
2327
|
+
class ce extends v {
|
|
2327
2328
|
_parse(e) {
|
|
2328
2329
|
if (e.data !== this._def.value) {
|
|
2329
2330
|
const t = this._getOrReturnCtx(e);
|
|
2330
2331
|
return l(t, {
|
|
2331
2332
|
received: t.data,
|
|
2332
|
-
code:
|
|
2333
|
+
code: d.invalid_literal,
|
|
2333
2334
|
expected: this._def.value
|
|
2334
2335
|
}), p;
|
|
2335
2336
|
}
|
|
@@ -2339,12 +2340,12 @@ class de extends v {
|
|
|
2339
2340
|
return this._def.value;
|
|
2340
2341
|
}
|
|
2341
2342
|
}
|
|
2342
|
-
|
|
2343
|
+
ce.create = (r, e) => new ce({
|
|
2343
2344
|
value: r,
|
|
2344
2345
|
typeName: m.ZodLiteral,
|
|
2345
2346
|
..._(e)
|
|
2346
2347
|
});
|
|
2347
|
-
function
|
|
2348
|
+
function Ve(r, e) {
|
|
2348
2349
|
return new L({
|
|
2349
2350
|
values: r,
|
|
2350
2351
|
typeName: m.ZodEnum,
|
|
@@ -2353,7 +2354,7 @@ function De(r, e) {
|
|
|
2353
2354
|
}
|
|
2354
2355
|
class L extends v {
|
|
2355
2356
|
constructor() {
|
|
2356
|
-
super(...arguments),
|
|
2357
|
+
super(...arguments), K.set(this, void 0);
|
|
2357
2358
|
}
|
|
2358
2359
|
_parse(e) {
|
|
2359
2360
|
if (typeof e.data != "string") {
|
|
@@ -2361,18 +2362,18 @@ class L extends v {
|
|
|
2361
2362
|
return l(t, {
|
|
2362
2363
|
expected: x.joinValues(n),
|
|
2363
2364
|
received: t.parsedType,
|
|
2364
|
-
code:
|
|
2365
|
+
code: d.invalid_type
|
|
2365
2366
|
}), p;
|
|
2366
2367
|
}
|
|
2367
|
-
if (ve(this,
|
|
2368
|
+
if (ve(this, K) || Me(this, K, new Set(this._def.values)), !ve(this, K).has(e.data)) {
|
|
2368
2369
|
const t = this._getOrReturnCtx(e), n = this._def.values;
|
|
2369
2370
|
return l(t, {
|
|
2370
2371
|
received: t.data,
|
|
2371
|
-
code:
|
|
2372
|
+
code: d.invalid_enum_value,
|
|
2372
2373
|
options: n
|
|
2373
2374
|
}), p;
|
|
2374
2375
|
}
|
|
2375
|
-
return
|
|
2376
|
+
return S(e.data);
|
|
2376
2377
|
}
|
|
2377
2378
|
get options() {
|
|
2378
2379
|
return this._def.values;
|
|
@@ -2408,11 +2409,11 @@ class L extends v {
|
|
|
2408
2409
|
});
|
|
2409
2410
|
}
|
|
2410
2411
|
}
|
|
2411
|
-
|
|
2412
|
-
L.create =
|
|
2412
|
+
K = /* @__PURE__ */ new WeakMap();
|
|
2413
|
+
L.create = Ve;
|
|
2413
2414
|
class ue extends v {
|
|
2414
2415
|
constructor() {
|
|
2415
|
-
super(...arguments),
|
|
2416
|
+
super(...arguments), F.set(this, void 0);
|
|
2416
2417
|
}
|
|
2417
2418
|
_parse(e) {
|
|
2418
2419
|
const t = x.getValidEnumValues(this._def.values), n = this._getOrReturnCtx(e);
|
|
@@ -2421,24 +2422,24 @@ class ue extends v {
|
|
|
2421
2422
|
return l(n, {
|
|
2422
2423
|
expected: x.joinValues(s),
|
|
2423
2424
|
received: n.parsedType,
|
|
2424
|
-
code:
|
|
2425
|
+
code: d.invalid_type
|
|
2425
2426
|
}), p;
|
|
2426
2427
|
}
|
|
2427
|
-
if (ve(this,
|
|
2428
|
+
if (ve(this, F) || Me(this, F, new Set(x.getValidEnumValues(this._def.values))), !ve(this, F).has(e.data)) {
|
|
2428
2429
|
const s = x.objectValues(t);
|
|
2429
2430
|
return l(n, {
|
|
2430
2431
|
received: n.data,
|
|
2431
|
-
code:
|
|
2432
|
+
code: d.invalid_enum_value,
|
|
2432
2433
|
options: s
|
|
2433
2434
|
}), p;
|
|
2434
2435
|
}
|
|
2435
|
-
return
|
|
2436
|
+
return S(e.data);
|
|
2436
2437
|
}
|
|
2437
2438
|
get enum() {
|
|
2438
2439
|
return this._def.values;
|
|
2439
2440
|
}
|
|
2440
2441
|
}
|
|
2441
|
-
|
|
2442
|
+
F = /* @__PURE__ */ new WeakMap();
|
|
2442
2443
|
ue.create = (r, e) => new ue({
|
|
2443
2444
|
values: r,
|
|
2444
2445
|
typeName: m.ZodNativeEnum,
|
|
@@ -2452,12 +2453,12 @@ class X extends v {
|
|
|
2452
2453
|
const { ctx: t } = this._processInputParams(e);
|
|
2453
2454
|
if (t.parsedType !== f.promise && t.common.async === !1)
|
|
2454
2455
|
return l(t, {
|
|
2455
|
-
code:
|
|
2456
|
+
code: d.invalid_type,
|
|
2456
2457
|
expected: f.promise,
|
|
2457
2458
|
received: t.parsedType
|
|
2458
2459
|
}), p;
|
|
2459
2460
|
const n = t.parsedType === f.promise ? t.data : Promise.resolve(t.data);
|
|
2460
|
-
return
|
|
2461
|
+
return S(n.then((s) => this._def.type.parseAsync(s, {
|
|
2461
2462
|
path: t.path,
|
|
2462
2463
|
errorMap: t.common.contextualErrorMap
|
|
2463
2464
|
})));
|
|
@@ -2477,71 +2478,71 @@ class I extends v {
|
|
|
2477
2478
|
}
|
|
2478
2479
|
_parse(e) {
|
|
2479
2480
|
const { status: t, ctx: n } = this._processInputParams(e), s = this._def.effect || null, a = {
|
|
2480
|
-
addIssue: (
|
|
2481
|
-
l(n,
|
|
2481
|
+
addIssue: (i) => {
|
|
2482
|
+
l(n, i), i.fatal ? t.abort() : t.dirty();
|
|
2482
2483
|
},
|
|
2483
2484
|
get path() {
|
|
2484
2485
|
return n.path;
|
|
2485
2486
|
}
|
|
2486
2487
|
};
|
|
2487
2488
|
if (a.addIssue = a.addIssue.bind(a), s.type === "preprocess") {
|
|
2488
|
-
const
|
|
2489
|
+
const i = s.transform(n.data, a);
|
|
2489
2490
|
if (n.common.async)
|
|
2490
|
-
return Promise.resolve(
|
|
2491
|
+
return Promise.resolve(i).then(async (o) => {
|
|
2491
2492
|
if (t.value === "aborted")
|
|
2492
2493
|
return p;
|
|
2493
|
-
const
|
|
2494
|
-
data:
|
|
2494
|
+
const u = await this._def.schema._parseAsync({
|
|
2495
|
+
data: o,
|
|
2495
2496
|
path: n.path,
|
|
2496
2497
|
parent: n
|
|
2497
2498
|
});
|
|
2498
|
-
return
|
|
2499
|
+
return u.status === "aborted" ? p : u.status === "dirty" || t.value === "dirty" ? G(u.value) : u;
|
|
2499
2500
|
});
|
|
2500
2501
|
{
|
|
2501
2502
|
if (t.value === "aborted")
|
|
2502
2503
|
return p;
|
|
2503
|
-
const
|
|
2504
|
-
data:
|
|
2504
|
+
const o = this._def.schema._parseSync({
|
|
2505
|
+
data: i,
|
|
2505
2506
|
path: n.path,
|
|
2506
2507
|
parent: n
|
|
2507
2508
|
});
|
|
2508
|
-
return
|
|
2509
|
+
return o.status === "aborted" ? p : o.status === "dirty" || t.value === "dirty" ? G(o.value) : o;
|
|
2509
2510
|
}
|
|
2510
2511
|
}
|
|
2511
2512
|
if (s.type === "refinement") {
|
|
2512
|
-
const
|
|
2513
|
-
const
|
|
2513
|
+
const i = (o) => {
|
|
2514
|
+
const u = s.refinement(o, a);
|
|
2514
2515
|
if (n.common.async)
|
|
2515
|
-
return Promise.resolve(
|
|
2516
|
-
if (
|
|
2516
|
+
return Promise.resolve(u);
|
|
2517
|
+
if (u instanceof Promise)
|
|
2517
2518
|
throw new Error("Async refinement encountered during synchronous parse operation. Use .parseAsync instead.");
|
|
2518
|
-
return
|
|
2519
|
+
return o;
|
|
2519
2520
|
};
|
|
2520
2521
|
if (n.common.async === !1) {
|
|
2521
|
-
const
|
|
2522
|
+
const o = this._def.schema._parseSync({
|
|
2522
2523
|
data: n.data,
|
|
2523
2524
|
path: n.path,
|
|
2524
2525
|
parent: n
|
|
2525
2526
|
});
|
|
2526
|
-
return
|
|
2527
|
+
return o.status === "aborted" ? p : (o.status === "dirty" && t.dirty(), i(o.value), { status: t.value, value: o.value });
|
|
2527
2528
|
} else
|
|
2528
|
-
return this._def.schema._parseAsync({ data: n.data, path: n.path, parent: n }).then((
|
|
2529
|
+
return this._def.schema._parseAsync({ data: n.data, path: n.path, parent: n }).then((o) => o.status === "aborted" ? p : (o.status === "dirty" && t.dirty(), i(o.value).then(() => ({ status: t.value, value: o.value }))));
|
|
2529
2530
|
}
|
|
2530
2531
|
if (s.type === "transform")
|
|
2531
2532
|
if (n.common.async === !1) {
|
|
2532
|
-
const
|
|
2533
|
+
const i = this._def.schema._parseSync({
|
|
2533
2534
|
data: n.data,
|
|
2534
2535
|
path: n.path,
|
|
2535
2536
|
parent: n
|
|
2536
2537
|
});
|
|
2537
|
-
if (!ee(
|
|
2538
|
-
return
|
|
2539
|
-
const
|
|
2540
|
-
if (
|
|
2538
|
+
if (!ee(i))
|
|
2539
|
+
return i;
|
|
2540
|
+
const o = s.transform(i.value, a);
|
|
2541
|
+
if (o instanceof Promise)
|
|
2541
2542
|
throw new Error("Asynchronous transform encountered during synchronous parse operation. Use .parseAsync instead.");
|
|
2542
|
-
return { status: t.value, value:
|
|
2543
|
+
return { status: t.value, value: o };
|
|
2543
2544
|
} else
|
|
2544
|
-
return this._def.schema._parseAsync({ data: n.data, path: n.path, parent: n }).then((
|
|
2545
|
+
return this._def.schema._parseAsync({ data: n.data, path: n.path, parent: n }).then((i) => ee(i) ? Promise.resolve(s.transform(i.value, a)).then((o) => ({ status: t.value, value: o })) : i);
|
|
2545
2546
|
x.assertNever(s);
|
|
2546
2547
|
}
|
|
2547
2548
|
}
|
|
@@ -2559,7 +2560,7 @@ I.createWithPreprocess = (r, e, t) => new I({
|
|
|
2559
2560
|
});
|
|
2560
2561
|
class j extends v {
|
|
2561
2562
|
_parse(e) {
|
|
2562
|
-
return this._getType(e) === f.undefined ?
|
|
2563
|
+
return this._getType(e) === f.undefined ? S(void 0) : this._def.innerType._parse(e);
|
|
2563
2564
|
}
|
|
2564
2565
|
unwrap() {
|
|
2565
2566
|
return this._def.innerType;
|
|
@@ -2572,7 +2573,7 @@ j.create = (r, e) => new j({
|
|
|
2572
2573
|
});
|
|
2573
2574
|
class q extends v {
|
|
2574
2575
|
_parse(e) {
|
|
2575
|
-
return this._getType(e) === f.null ?
|
|
2576
|
+
return this._getType(e) === f.null ? S(null) : this._def.innerType._parse(e);
|
|
2576
2577
|
}
|
|
2577
2578
|
unwrap() {
|
|
2578
2579
|
return this._def.innerType;
|
|
@@ -2622,7 +2623,7 @@ class fe extends v {
|
|
|
2622
2623
|
status: "valid",
|
|
2623
2624
|
value: a.status === "valid" ? a.value : this._def.catchValue({
|
|
2624
2625
|
get error() {
|
|
2625
|
-
return new
|
|
2626
|
+
return new N(n.common.issues);
|
|
2626
2627
|
},
|
|
2627
2628
|
input: n.data
|
|
2628
2629
|
})
|
|
@@ -2630,7 +2631,7 @@ class fe extends v {
|
|
|
2630
2631
|
status: "valid",
|
|
2631
2632
|
value: s.status === "valid" ? s.value : this._def.catchValue({
|
|
2632
2633
|
get error() {
|
|
2633
|
-
return new
|
|
2634
|
+
return new N(n.common.issues);
|
|
2634
2635
|
},
|
|
2635
2636
|
input: n.data
|
|
2636
2637
|
})
|
|
@@ -2646,12 +2647,12 @@ fe.create = (r, e) => new fe({
|
|
|
2646
2647
|
catchValue: typeof e.catch == "function" ? e.catch : () => e.catch,
|
|
2647
2648
|
..._(e)
|
|
2648
2649
|
});
|
|
2649
|
-
class
|
|
2650
|
+
class be extends v {
|
|
2650
2651
|
_parse(e) {
|
|
2651
2652
|
if (this._getType(e) !== f.nan) {
|
|
2652
2653
|
const n = this._getOrReturnCtx(e);
|
|
2653
2654
|
return l(n, {
|
|
2654
|
-
code:
|
|
2655
|
+
code: d.invalid_type,
|
|
2655
2656
|
expected: f.nan,
|
|
2656
2657
|
received: n.parsedType
|
|
2657
2658
|
}), p;
|
|
@@ -2659,11 +2660,11 @@ class ke extends v {
|
|
|
2659
2660
|
return { status: "valid", value: e.data };
|
|
2660
2661
|
}
|
|
2661
2662
|
}
|
|
2662
|
-
|
|
2663
|
+
be.create = (r) => new be({
|
|
2663
2664
|
typeName: m.ZodNaN,
|
|
2664
2665
|
..._(r)
|
|
2665
2666
|
});
|
|
2666
|
-
const
|
|
2667
|
+
const yt = Symbol("zod_brand");
|
|
2667
2668
|
class Ee extends v {
|
|
2668
2669
|
_parse(e) {
|
|
2669
2670
|
const { ctx: t } = this._processInputParams(e), n = t.data;
|
|
@@ -2687,7 +2688,7 @@ class me extends v {
|
|
|
2687
2688
|
path: n.path,
|
|
2688
2689
|
parent: n
|
|
2689
2690
|
});
|
|
2690
|
-
return a.status === "aborted" ? p : a.status === "dirty" ? (t.dirty(),
|
|
2691
|
+
return a.status === "aborted" ? p : a.status === "dirty" ? (t.dirty(), G(a.value)) : this._def.out._parseAsync({
|
|
2691
2692
|
data: a.value,
|
|
2692
2693
|
path: n.path,
|
|
2693
2694
|
parent: n
|
|
@@ -2731,25 +2732,25 @@ he.create = (r, e) => new he({
|
|
|
2731
2732
|
typeName: m.ZodReadonly,
|
|
2732
2733
|
..._(e)
|
|
2733
2734
|
});
|
|
2734
|
-
function
|
|
2735
|
+
function De(r, e = {}, t) {
|
|
2735
2736
|
return r ? Q.create().superRefine((n, s) => {
|
|
2736
|
-
var a,
|
|
2737
|
+
var a, i;
|
|
2737
2738
|
if (!r(n)) {
|
|
2738
|
-
const
|
|
2739
|
-
s.addIssue({ code: "custom", ...
|
|
2739
|
+
const o = typeof e == "function" ? e(n) : 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
|
+
s.addIssue({ code: "custom", ...c, fatal: u });
|
|
2740
2741
|
}
|
|
2741
2742
|
}) : Q.create();
|
|
2742
2743
|
}
|
|
2743
|
-
const
|
|
2744
|
-
object:
|
|
2744
|
+
const _t = {
|
|
2745
|
+
object: k.lazycreate
|
|
2745
2746
|
};
|
|
2746
2747
|
var m;
|
|
2747
2748
|
(function(r) {
|
|
2748
2749
|
r.ZodString = "ZodString", r.ZodNumber = "ZodNumber", r.ZodNaN = "ZodNaN", r.ZodBigInt = "ZodBigInt", r.ZodBoolean = "ZodBoolean", r.ZodDate = "ZodDate", r.ZodSymbol = "ZodSymbol", r.ZodUndefined = "ZodUndefined", r.ZodNull = "ZodNull", r.ZodAny = "ZodAny", r.ZodUnknown = "ZodUnknown", r.ZodNever = "ZodNever", r.ZodVoid = "ZodVoid", r.ZodArray = "ZodArray", r.ZodObject = "ZodObject", r.ZodUnion = "ZodUnion", r.ZodDiscriminatedUnion = "ZodDiscriminatedUnion", r.ZodIntersection = "ZodIntersection", r.ZodTuple = "ZodTuple", r.ZodRecord = "ZodRecord", r.ZodMap = "ZodMap", r.ZodSet = "ZodSet", r.ZodFunction = "ZodFunction", r.ZodLazy = "ZodLazy", r.ZodLiteral = "ZodLiteral", r.ZodEnum = "ZodEnum", r.ZodEffects = "ZodEffects", r.ZodNativeEnum = "ZodNativeEnum", r.ZodOptional = "ZodOptional", r.ZodNullable = "ZodNullable", r.ZodDefault = "ZodDefault", r.ZodCatch = "ZodCatch", r.ZodPromise = "ZodPromise", r.ZodBranded = "ZodBranded", r.ZodPipeline = "ZodPipeline", r.ZodReadonly = "ZodReadonly";
|
|
2749
2750
|
})(m || (m = {}));
|
|
2750
|
-
const
|
|
2751
|
+
const vt = (r, e = {
|
|
2751
2752
|
message: `Input not instance of ${r.name}`
|
|
2752
|
-
}) =>
|
|
2753
|
+
}) => De((t) => t instanceof r, e), Le = E.create, qe = V.create, gt = be.create, xt = D.create, Ue = re.create, kt = B.create, bt = ge.create, wt = ne.create, Tt = se.create, Zt = Q.create, St = U.create, Ct = z.create, Ot = xe.create, Nt = R.create, Et = k.create, Rt = k.strictCreate, It = ae.create, jt = we.create, At = ie.create, Mt = M.create, $t = oe.create, zt = ke.create, Pt = W.create, Vt = H.create, Dt = de.create, Lt = ce.create, qt = L.create, Ut = ue.create, Bt = X.create, je = I.create, Wt = j.create, Yt = q.create, Gt = I.createWithPreprocess, Ht = me.create, Jt = () => Le().optional(), Qt = () => qe().optional(), Xt = () => Ue().optional(), Kt = {
|
|
2753
2754
|
string: (r) => E.create({ ...r, coerce: !0 }),
|
|
2754
2755
|
number: (r) => V.create({ ...r, coerce: !0 }),
|
|
2755
2756
|
boolean: (r) => re.create({
|
|
@@ -2758,33 +2759,33 @@ const bt = (r, e = {
|
|
|
2758
2759
|
}),
|
|
2759
2760
|
bigint: (r) => D.create({ ...r, coerce: !0 }),
|
|
2760
2761
|
date: (r) => B.create({ ...r, coerce: !0 })
|
|
2761
|
-
},
|
|
2762
|
+
}, Ft = p;
|
|
2762
2763
|
var C = /* @__PURE__ */ Object.freeze({
|
|
2763
2764
|
__proto__: null,
|
|
2764
|
-
defaultErrorMap:
|
|
2765
|
-
setErrorMap:
|
|
2765
|
+
defaultErrorMap: J,
|
|
2766
|
+
setErrorMap: Fe,
|
|
2766
2767
|
getErrorMap: ye,
|
|
2767
2768
|
makeIssue: _e,
|
|
2768
|
-
EMPTY_PATH:
|
|
2769
|
+
EMPTY_PATH: et,
|
|
2769
2770
|
addIssueToContext: l,
|
|
2770
|
-
ParseStatus:
|
|
2771
|
+
ParseStatus: Z,
|
|
2771
2772
|
INVALID: p,
|
|
2772
|
-
DIRTY:
|
|
2773
|
-
OK:
|
|
2773
|
+
DIRTY: G,
|
|
2774
|
+
OK: S,
|
|
2774
2775
|
isAborted: Ce,
|
|
2775
|
-
isDirty:
|
|
2776
|
+
isDirty: Oe,
|
|
2776
2777
|
isValid: ee,
|
|
2777
2778
|
isAsync: te,
|
|
2778
2779
|
get util() {
|
|
2779
2780
|
return x;
|
|
2780
2781
|
},
|
|
2781
2782
|
get objectUtil() {
|
|
2782
|
-
return
|
|
2783
|
+
return Se;
|
|
2783
2784
|
},
|
|
2784
2785
|
ZodParsedType: f,
|
|
2785
|
-
getParsedType:
|
|
2786
|
+
getParsedType: P,
|
|
2786
2787
|
ZodType: v,
|
|
2787
|
-
datetimeRegex:
|
|
2788
|
+
datetimeRegex: Pe,
|
|
2788
2789
|
ZodString: E,
|
|
2789
2790
|
ZodNumber: V,
|
|
2790
2791
|
ZodBigInt: D,
|
|
@@ -2795,20 +2796,20 @@ var C = /* @__PURE__ */ Object.freeze({
|
|
|
2795
2796
|
ZodNull: se,
|
|
2796
2797
|
ZodAny: Q,
|
|
2797
2798
|
ZodUnknown: U,
|
|
2798
|
-
ZodNever:
|
|
2799
|
+
ZodNever: z,
|
|
2799
2800
|
ZodVoid: xe,
|
|
2800
2801
|
ZodArray: R,
|
|
2801
|
-
ZodObject:
|
|
2802
|
+
ZodObject: k,
|
|
2802
2803
|
ZodUnion: ae,
|
|
2803
2804
|
ZodDiscriminatedUnion: we,
|
|
2804
2805
|
ZodIntersection: ie,
|
|
2805
2806
|
ZodTuple: M,
|
|
2806
2807
|
ZodRecord: oe,
|
|
2807
|
-
ZodMap:
|
|
2808
|
+
ZodMap: ke,
|
|
2808
2809
|
ZodSet: W,
|
|
2809
|
-
ZodFunction:
|
|
2810
|
-
ZodLazy:
|
|
2811
|
-
ZodLiteral:
|
|
2810
|
+
ZodFunction: H,
|
|
2811
|
+
ZodLazy: de,
|
|
2812
|
+
ZodLiteral: ce,
|
|
2812
2813
|
ZodEnum: L,
|
|
2813
2814
|
ZodNativeEnum: ue,
|
|
2814
2815
|
ZodPromise: X,
|
|
@@ -2818,80 +2819,80 @@ var C = /* @__PURE__ */ Object.freeze({
|
|
|
2818
2819
|
ZodNullable: q,
|
|
2819
2820
|
ZodDefault: le,
|
|
2820
2821
|
ZodCatch: fe,
|
|
2821
|
-
ZodNaN:
|
|
2822
|
-
BRAND:
|
|
2822
|
+
ZodNaN: be,
|
|
2823
|
+
BRAND: yt,
|
|
2823
2824
|
ZodBranded: Ee,
|
|
2824
2825
|
ZodPipeline: me,
|
|
2825
2826
|
ZodReadonly: he,
|
|
2826
|
-
custom:
|
|
2827
|
+
custom: De,
|
|
2827
2828
|
Schema: v,
|
|
2828
2829
|
ZodSchema: v,
|
|
2829
|
-
late:
|
|
2830
|
+
late: _t,
|
|
2830
2831
|
get ZodFirstPartyTypeKind() {
|
|
2831
2832
|
return m;
|
|
2832
2833
|
},
|
|
2833
|
-
coerce:
|
|
2834
|
-
any:
|
|
2835
|
-
array:
|
|
2836
|
-
bigint:
|
|
2837
|
-
boolean:
|
|
2838
|
-
date:
|
|
2839
|
-
discriminatedUnion:
|
|
2834
|
+
coerce: Kt,
|
|
2835
|
+
any: Zt,
|
|
2836
|
+
array: Nt,
|
|
2837
|
+
bigint: xt,
|
|
2838
|
+
boolean: Ue,
|
|
2839
|
+
date: kt,
|
|
2840
|
+
discriminatedUnion: jt,
|
|
2840
2841
|
effect: je,
|
|
2841
|
-
enum:
|
|
2842
|
-
function:
|
|
2843
|
-
instanceof:
|
|
2844
|
-
intersection:
|
|
2845
|
-
lazy:
|
|
2846
|
-
literal:
|
|
2847
|
-
map:
|
|
2848
|
-
nan:
|
|
2849
|
-
nativeEnum:
|
|
2850
|
-
never:
|
|
2851
|
-
null:
|
|
2852
|
-
nullable:
|
|
2853
|
-
number:
|
|
2854
|
-
object:
|
|
2855
|
-
oboolean:
|
|
2856
|
-
onumber:
|
|
2857
|
-
optional:
|
|
2858
|
-
ostring:
|
|
2859
|
-
pipeline:
|
|
2860
|
-
preprocess:
|
|
2861
|
-
promise:
|
|
2862
|
-
record:
|
|
2863
|
-
set:
|
|
2864
|
-
strictObject:
|
|
2865
|
-
string:
|
|
2866
|
-
symbol:
|
|
2842
|
+
enum: qt,
|
|
2843
|
+
function: Vt,
|
|
2844
|
+
instanceof: vt,
|
|
2845
|
+
intersection: At,
|
|
2846
|
+
lazy: Dt,
|
|
2847
|
+
literal: Lt,
|
|
2848
|
+
map: zt,
|
|
2849
|
+
nan: gt,
|
|
2850
|
+
nativeEnum: Ut,
|
|
2851
|
+
never: Ct,
|
|
2852
|
+
null: Tt,
|
|
2853
|
+
nullable: Yt,
|
|
2854
|
+
number: qe,
|
|
2855
|
+
object: Et,
|
|
2856
|
+
oboolean: Xt,
|
|
2857
|
+
onumber: Qt,
|
|
2858
|
+
optional: Wt,
|
|
2859
|
+
ostring: Jt,
|
|
2860
|
+
pipeline: Ht,
|
|
2861
|
+
preprocess: Gt,
|
|
2862
|
+
promise: Bt,
|
|
2863
|
+
record: $t,
|
|
2864
|
+
set: Pt,
|
|
2865
|
+
strictObject: Rt,
|
|
2866
|
+
string: Le,
|
|
2867
|
+
symbol: bt,
|
|
2867
2868
|
transformer: je,
|
|
2868
|
-
tuple:
|
|
2869
|
-
undefined:
|
|
2870
|
-
union:
|
|
2871
|
-
unknown:
|
|
2872
|
-
void:
|
|
2873
|
-
NEVER:
|
|
2874
|
-
ZodIssueCode:
|
|
2875
|
-
quotelessJson:
|
|
2876
|
-
ZodError:
|
|
2869
|
+
tuple: Mt,
|
|
2870
|
+
undefined: wt,
|
|
2871
|
+
union: It,
|
|
2872
|
+
unknown: St,
|
|
2873
|
+
void: Ot,
|
|
2874
|
+
NEVER: Ft,
|
|
2875
|
+
ZodIssueCode: d,
|
|
2876
|
+
quotelessJson: Ke,
|
|
2877
|
+
ZodError: N
|
|
2877
2878
|
});
|
|
2878
|
-
const
|
|
2879
|
-
const { texts: { formValidation: r } } = He(
|
|
2879
|
+
const cr = () => {
|
|
2880
|
+
const { texts: { formValidation: r } } = He(We), e = (g) => (g != null && g.useCoerce ? C.coerce : C).string({
|
|
2880
2881
|
invalid_type_error: r.required,
|
|
2881
2882
|
required_error: r.required
|
|
2882
|
-
}).transform((w) => w ?? null), t = (g) => e(g).nullable().optional().transform((
|
|
2883
|
-
const
|
|
2883
|
+
}).transform((w) => w ?? null), t = (g) => e(g).nullable().optional().transform((b) => b ?? null), n = (g) => {
|
|
2884
|
+
const b = (g != null && g.useCoerce ? C.coerce : C).number({
|
|
2884
2885
|
invalid_type_error: r.required,
|
|
2885
2886
|
required_error: r.required
|
|
2886
2887
|
});
|
|
2887
|
-
return (g == null ? void 0 : g.min) !== void 0 &&
|
|
2888
|
-
}, s = (g) => n(g).nullable().optional().transform((
|
|
2888
|
+
return (g == null ? void 0 : g.min) !== void 0 && b.min(g.min), (g == null ? void 0 : g.max) !== void 0 && b.max(g.max), b.transform((w) => w ?? null);
|
|
2889
|
+
}, s = (g) => n(g).nullable().optional().transform((b) => b ?? null), a = (g) => (g != null && g.useCoerce ? C.coerce : C).boolean({
|
|
2889
2890
|
invalid_type_error: r.required,
|
|
2890
2891
|
required_error: r.required
|
|
2891
|
-
}).transform((
|
|
2892
|
+
}).transform((b) => b ?? null), i = (g) => (g != null && g.useCoerce ? C.coerce : C).string({
|
|
2892
2893
|
invalid_type_error: r.required,
|
|
2893
2894
|
required_error: r.required
|
|
2894
|
-
}).refine(
|
|
2895
|
+
}).refine(Xe, { message: r.invalidDate }).transform((w) => w ?? null), o = (g) => i(g).nullable().transform((b) => b ?? null), u = (g, b) => C.enum(g, {
|
|
2895
2896
|
invalid_type_error: r.required,
|
|
2896
2897
|
required_error: r.required
|
|
2897
2898
|
}).transform((Re) => Re ?? null);
|
|
@@ -2901,17 +2902,17 @@ const hr = () => {
|
|
|
2901
2902
|
zNumber: s,
|
|
2902
2903
|
zNumberRequired: n,
|
|
2903
2904
|
zBool: a,
|
|
2904
|
-
zDate:
|
|
2905
|
-
zDateRequired:
|
|
2906
|
-
zEnum: (g,
|
|
2907
|
-
zEnumRequired:
|
|
2905
|
+
zDate: o,
|
|
2906
|
+
zDateRequired: i,
|
|
2907
|
+
zEnum: (g, b) => u(g).nullable().transform((w) => w ?? null),
|
|
2908
|
+
zEnumRequired: u,
|
|
2908
2909
|
zObjectIdInt: (g) => C.object({ id: s({ useCoerce: !0 }) }).nullable().transform((w) => w ?? null),
|
|
2909
2910
|
zObjectIdIntRequired: (g) => C.object({ id: n() }).transform((w) => w ?? null),
|
|
2910
2911
|
zObjectIdStr: (g) => C.object({ id: t({ useCoerce: !0 }) }).nullable().transform((w) => w ?? null),
|
|
2911
2912
|
zObjectIdStrRequired: (g) => C.object({ id: e() }).transform((w) => w ?? null),
|
|
2912
|
-
zFile: ({ required: g, multiple:
|
|
2913
|
+
zFile: ({ required: g, multiple: b, maxFileSize: w }) => C.any().transform((T) => Array.from(T ?? [])).refine((T) => !g || (T == null ? void 0 : T.length) > 0, "File is required.").refine((T) => b || (T == null ? void 0 : T.length) <= 1, "Multiple files not allowed.").refine((T) => T.every((Be) => Be.size <= w), `Maximum file size is ${Ye(w)}.`).transform((T) => (b ? T : T == null ? void 0 : T[0]) ?? null)
|
|
2913
2914
|
};
|
|
2914
|
-
},
|
|
2915
|
+
}, er = (r) => {
|
|
2915
2916
|
let e = "pending", t;
|
|
2916
2917
|
const n = r.then((s) => {
|
|
2917
2918
|
e = "success", t = s;
|
|
@@ -2931,59 +2932,30 @@ const hr = () => {
|
|
|
2931
2932
|
}
|
|
2932
2933
|
};
|
|
2933
2934
|
};
|
|
2934
|
-
function
|
|
2935
|
-
const e = Ge({ silent: !0 }), [t, n] =
|
|
2936
|
-
return
|
|
2935
|
+
function ur(r) {
|
|
2936
|
+
const e = Ge({ silent: !0 }), [t, n] = Je(null);
|
|
2937
|
+
return Qe(() => {
|
|
2937
2938
|
(async () => {
|
|
2938
|
-
const a = e.get(r).then((
|
|
2939
|
-
n(
|
|
2939
|
+
const a = e.get(r).then((i) => i.data);
|
|
2940
|
+
n(er(a));
|
|
2940
2941
|
})();
|
|
2941
2942
|
}, [e, r]), t;
|
|
2942
2943
|
}
|
|
2943
|
-
const sr = () => {
|
|
2944
|
-
const [r, e] = et(), t = Ae((n, s) => {
|
|
2945
|
-
e((a) => (s === null && a.delete(n), a.get(n) === s || a.set(n, s ?? ""), a), { replace: !0 });
|
|
2946
|
-
}, [e]);
|
|
2947
|
-
return {
|
|
2948
|
-
searchParams: r,
|
|
2949
|
-
setSearch: t
|
|
2950
|
-
};
|
|
2951
|
-
}, pr = (r, e, t) => {
|
|
2952
|
-
const { searchParams: n, setSearch: s } = sr(), a = Fe(() => {
|
|
2953
|
-
const i = n.get(r), d = i ? Number(i) : e, u = Number.isNaN(d) ? typeof e : "number";
|
|
2954
|
-
switch (t ?? u) {
|
|
2955
|
-
case "number":
|
|
2956
|
-
return d;
|
|
2957
|
-
case "string":
|
|
2958
|
-
return i ?? e;
|
|
2959
|
-
case "boolean":
|
|
2960
|
-
return i === "true";
|
|
2961
|
-
case "object":
|
|
2962
|
-
return i ? JSON.parse(i) : e;
|
|
2963
|
-
default:
|
|
2964
|
-
throw console.error(t, u), new Error(`useSearchQueryState is not implemented for type ${typeof (t ?? u)}.`);
|
|
2965
|
-
}
|
|
2966
|
-
}, [e, t, r, n]), o = Ae((i) => {
|
|
2967
|
-
let d;
|
|
2968
|
-
typeof i == "function" ? d = i(a) : d = i, typeof d == "object" ? s(r, d === null ? null : JSON.stringify(d)) : s(r, d === null ? null : d.toString());
|
|
2969
|
-
}, [r, s, a]);
|
|
2970
|
-
return [a, o];
|
|
2971
|
-
};
|
|
2972
2944
|
export {
|
|
2973
|
-
|
|
2974
|
-
|
|
2945
|
+
hr as cancelToken,
|
|
2946
|
+
mr as useAuth,
|
|
2975
2947
|
Ge as useAxios,
|
|
2976
|
-
|
|
2977
|
-
|
|
2978
|
-
|
|
2979
|
-
|
|
2980
|
-
|
|
2981
|
-
|
|
2982
|
-
|
|
2983
|
-
|
|
2984
|
-
|
|
2985
|
-
|
|
2986
|
-
|
|
2987
|
-
|
|
2988
|
-
|
|
2948
|
+
wr as useClickOutside,
|
|
2949
|
+
_r as useConfirm,
|
|
2950
|
+
Tr as useFormControlType,
|
|
2951
|
+
gr as useGetApiData,
|
|
2952
|
+
ur as useGetDataBound,
|
|
2953
|
+
Zr as useKeyPress,
|
|
2954
|
+
xr as useLocalStorageState,
|
|
2955
|
+
pr as useNotifications,
|
|
2956
|
+
Nr as usePermissions,
|
|
2957
|
+
kr as usePrompt,
|
|
2958
|
+
Sr as useSearchQuery,
|
|
2959
|
+
Cr as useSearchQueryState,
|
|
2960
|
+
cr as useZodSchemaTypes
|
|
2989
2961
|
};
|