@feedmepos/mf-payment 0.0.0-beta.8 → 1.0.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (90) hide show
  1. package/dist/AdminLayout.vue_vue_type_script_setup_true_lang-BTmMOzwx.js +39 -0
  2. package/dist/AsyncButton.vue_vue_type_script_setup_true_lang-DcjzvYwT.js +42 -0
  3. package/dist/AutoCopyCell.vue_vue_type_script_setup_true_lang-GXPXBEf5.js +40 -0
  4. package/dist/Modal-DB8M9o1T.js +13 -0
  5. package/dist/PayoutAccount-DZaKHWcy.js +612 -0
  6. package/dist/{PayoutAccount-CpatyqJa.js → PayoutAccount-Dc1CYQ0W.js} +38 -35
  7. package/dist/PayoutAccountSetting-BzmNuLFj.js +780 -0
  8. package/dist/RestaurantSelector.vue_vue_type_script_setup_true_lang-CY4ttpKj.js +33 -0
  9. package/dist/Settlement-Bx3zAkIw.js +195 -0
  10. package/dist/Settlement-mwnO-iYH.js +150 -0
  11. package/dist/{SettlementTransactions-DT1A_tI5.js → SettlementTransactions-AaYyTH96.js} +99 -105
  12. package/dist/{SettlementTransactions-CkU0gCHb.js → SettlementTransactions-D_SVuKyR.js} +117 -130
  13. package/dist/Terminal-68OQnhM3.js +372 -0
  14. package/dist/TerminalSetting-DEFim0xg.js +379 -0
  15. package/dist/TerminalTransaction-CQjNdffr.js +426 -0
  16. package/dist/TerminalTransaction-ClihmWOJ.js +250 -0
  17. package/dist/Transaction-68L7JzIk.js +242 -0
  18. package/dist/Transaction-a1VfiCP_.js +405 -0
  19. package/dist/api/index.d.ts +14 -0
  20. package/dist/api/pagination.d.ts +20 -0
  21. package/dist/api/payment-gateway/index.d.ts +9 -0
  22. package/dist/api/settlement/index.d.ts +12 -13
  23. package/dist/api/terminal/index.d.ts +13 -1
  24. package/dist/api/terminal-transaction/index.d.ts +12 -1
  25. package/dist/api/transaction/index.d.ts +7 -2
  26. package/dist/app-C9FRsUfb.js +6343 -0
  27. package/dist/app.js +3 -198
  28. package/dist/assets-Bji7O2YD.js +45 -0
  29. package/dist/clipboard-4jh1WteU.js +10 -0
  30. package/dist/components/AsyncButton.vue.d.ts +21 -0
  31. package/dist/components/AutoCopyCell.vue.d.ts +6 -0
  32. package/dist/components/CursorTable/index.vue.d.ts +24 -5
  33. package/dist/components/RestaurantSelector.vue.d.ts +2 -0
  34. package/dist/components/RouteCell.vue.d.ts +8 -0
  35. package/dist/helpers/assets.d.ts +2 -0
  36. package/dist/index-Bt_OgDYn.js +56107 -0
  37. package/dist/index-CLYePgWW.js +47 -0
  38. package/dist/{index-CF56zGyu.js → index-DBfZnaV1.js} +1 -1
  39. package/dist/index-DSuZG0l6.js +52 -0
  40. package/dist/{index-Bmka-1lQ.js → index-DjDGwRX8.js} +1 -1
  41. package/dist/index-_0TroOJr.js +127 -0
  42. package/dist/index.vue_vue_type_script_setup_true_lang-Jlcg1hAB.js +167 -0
  43. package/dist/model/transaction.d.ts +2 -1
  44. package/dist/package.json +4 -4
  45. package/dist/payout-account-BWcq7OJy.js +1805 -0
  46. package/dist/stores/payoutAccount.d.ts +4 -4
  47. package/dist/transaction-DqrhM5jB.js +87 -0
  48. package/dist/tsconfig.app.tsbuildinfo +1 -1
  49. package/dist/validator-D5jtpt9A.js +2877 -0
  50. package/dist/views/admin/payout-account/tabs/Information.vue.d.ts +4 -4
  51. package/dist/views/admin/payout-account/tabs/PaymentGateway.vue.d.ts +81 -0
  52. package/dist/views/admin/payout-account/tabs/PaymentStatus.vue.d.ts +4 -4
  53. package/dist/views/admin/payout-account/tabs/Settlement.vue.d.ts +4 -4
  54. package/dist/views/admin/payout-account/tabs/gateway/FiuuGateway.vue.d.ts +56 -0
  55. package/dist/views/admin/payout-account/tabs/gateway/GhlGateway.vue.d.ts +50 -0
  56. package/dist/views/admin/payout-account/tabs/gateway/RevenueMonsterGateway.vue.d.ts +52 -0
  57. package/dist/views/admin/settlement/SettlementTable.vue.d.ts +12 -12
  58. package/dist/views/admin/terminal/TerminalDialog.vue.d.ts +83 -0
  59. package/dist/views/admin/terminal/TerminalSetting.vue.d.ts +12 -0
  60. package/dist/views/admin/terminal/cell/Actions.vue.d.ts +80 -9
  61. package/dist/views/admin/terminal/tabs/FiuuGateway.vue.d.ts +94 -0
  62. package/dist/views/admin/terminal/tabs/GhlGateway.vue.d.ts +94 -0
  63. package/dist/views/admin/terminal/tabs/Information.vue.d.ts +85 -0
  64. package/dist/views/admin/terminal/tabs/TerminalGateway.vue.d.ts +94 -0
  65. package/dist/views/admin/terminal-transaction/cell/Actions.vue.d.ts +7 -0
  66. package/dist/views/admin/transaction/TransactionTable.vue.d.ts +6 -2
  67. package/dist/views/admin/transaction/cell/Actions.vue.d.ts +7 -0
  68. package/dist/views/payout-account/PayoutAccountTable.vue.d.ts +8 -8
  69. package/dist/views/settlement/SettlementTable.vue.d.ts +12 -12
  70. package/dist/views/terminal-transaction/TerminalTransaction.vue.d.ts +2 -0
  71. package/dist/views/terminal-transaction/cell/Gateway.vue.d.ts +9 -0
  72. package/dist/views/terminal-transaction/cell/Status.vue.d.ts +9 -0
  73. package/package.json +4 -4
  74. package/dist/AdminLayout.vue_vue_type_script_setup_true_lang-oPYFBeEo.js +0 -42
  75. package/dist/PayoutAccount-C0xyoyTa.js +0 -3485
  76. package/dist/PayoutAccountSetting-CIeos0md.js +0 -425
  77. package/dist/Settlement-BVGACeme.js +0 -136
  78. package/dist/Settlement-Ce48KHrc.js +0 -132
  79. package/dist/Terminal-ByKV2Rof.js +0 -204
  80. package/dist/TerminalTransaction-ClhuAOOF.js +0 -240
  81. package/dist/Transaction-BYq9Ymp_.js +0 -242
  82. package/dist/Transaction-Doq11qIf.js +0 -241
  83. package/dist/api/auth/index.d.ts +0 -7
  84. package/dist/assets-Dg26uQOf.js +0 -1756
  85. package/dist/index-Coz5aeIO.js +0 -61
  86. package/dist/index-DCPNrUDq.js +0 -40075
  87. package/dist/index.vue_vue_type_script_setup_true_lang-CAR-bNaR.js +0 -150
  88. package/dist/mascot-side-D5UubCy7.js +0 -8
  89. package/dist/payout-account-D2Ftjrss.js +0 -3317
  90. package/dist/transaction-vRrBf3FN.js +0 -64
@@ -0,0 +1,2877 @@
1
+ import "@feedmepos/ui-library";
2
+ var g;
3
+ (function(r) {
4
+ r.assertEqual = (n) => n;
5
+ function e(n) {
6
+ }
7
+ r.assertIs = e;
8
+ function t(n) {
9
+ throw new Error();
10
+ }
11
+ r.assertNever = t, r.arrayToEnum = (n) => {
12
+ const a = {};
13
+ for (const i of n)
14
+ a[i] = i;
15
+ return a;
16
+ }, r.getValidEnumValues = (n) => {
17
+ const a = r.objectKeys(n).filter((o) => typeof n[n[o]] != "number"), i = {};
18
+ for (const o of a)
19
+ i[o] = n[o];
20
+ return r.objectValues(i);
21
+ }, r.objectValues = (n) => r.objectKeys(n).map(function(a) {
22
+ return n[a];
23
+ }), r.objectKeys = typeof Object.keys == "function" ? (n) => Object.keys(n) : (n) => {
24
+ const a = [];
25
+ for (const i in n)
26
+ Object.prototype.hasOwnProperty.call(n, i) && a.push(i);
27
+ return a;
28
+ }, r.find = (n, a) => {
29
+ for (const i of n)
30
+ if (a(i))
31
+ return i;
32
+ }, r.isInteger = typeof Number.isInteger == "function" ? (n) => Number.isInteger(n) : (n) => typeof n == "number" && isFinite(n) && Math.floor(n) === n;
33
+ function s(n, a = " | ") {
34
+ return n.map((i) => typeof i == "string" ? `'${i}'` : i).join(a);
35
+ }
36
+ r.joinValues = s, r.jsonStringifyReplacer = (n, a) => typeof a == "bigint" ? a.toString() : a;
37
+ })(g || (g = {}));
38
+ var xe;
39
+ (function(r) {
40
+ r.mergeShapes = (e, t) => ({
41
+ ...e,
42
+ ...t
43
+ // second overwrites first
44
+ });
45
+ })(xe || (xe = {}));
46
+ const f = g.arrayToEnum([
47
+ "string",
48
+ "nan",
49
+ "number",
50
+ "integer",
51
+ "float",
52
+ "boolean",
53
+ "date",
54
+ "bigint",
55
+ "symbol",
56
+ "function",
57
+ "undefined",
58
+ "null",
59
+ "array",
60
+ "object",
61
+ "unknown",
62
+ "promise",
63
+ "void",
64
+ "never",
65
+ "map",
66
+ "set"
67
+ ]), j = (r) => {
68
+ switch (typeof r) {
69
+ case "undefined":
70
+ return f.undefined;
71
+ case "string":
72
+ return f.string;
73
+ case "number":
74
+ return isNaN(r) ? f.nan : f.number;
75
+ case "boolean":
76
+ return f.boolean;
77
+ case "function":
78
+ return f.function;
79
+ case "bigint":
80
+ return f.bigint;
81
+ case "symbol":
82
+ return f.symbol;
83
+ case "object":
84
+ return Array.isArray(r) ? f.array : r === null ? f.null : r.then && typeof r.then == "function" && r.catch && typeof r.catch == "function" ? f.promise : typeof Map < "u" && r instanceof Map ? f.map : typeof Set < "u" && r instanceof Set ? f.set : typeof Date < "u" && r instanceof Date ? f.date : f.object;
85
+ default:
86
+ return f.unknown;
87
+ }
88
+ }, d = g.arrayToEnum([
89
+ "invalid_type",
90
+ "invalid_literal",
91
+ "custom",
92
+ "invalid_union",
93
+ "invalid_union_discriminator",
94
+ "invalid_enum_value",
95
+ "unrecognized_keys",
96
+ "invalid_arguments",
97
+ "invalid_return_type",
98
+ "invalid_date",
99
+ "invalid_string",
100
+ "too_small",
101
+ "too_big",
102
+ "invalid_intersection_types",
103
+ "not_multiple_of",
104
+ "not_finite"
105
+ ]), Ve = (r) => JSON.stringify(r, null, 2).replace(/"([^"]+)":/g, "$1:");
106
+ class w extends Error {
107
+ constructor(e) {
108
+ super(), this.issues = [], this.addIssue = (s) => {
109
+ this.issues = [...this.issues, s];
110
+ }, this.addIssues = (s = []) => {
111
+ this.issues = [...this.issues, ...s];
112
+ };
113
+ const t = new.target.prototype;
114
+ Object.setPrototypeOf ? Object.setPrototypeOf(this, t) : this.__proto__ = t, this.name = "ZodError", this.issues = e;
115
+ }
116
+ get errors() {
117
+ return this.issues;
118
+ }
119
+ format(e) {
120
+ const t = e || function(a) {
121
+ return a.message;
122
+ }, s = { _errors: [] }, n = (a) => {
123
+ for (const i of a.issues)
124
+ if (i.code === "invalid_union")
125
+ i.unionErrors.map(n);
126
+ else if (i.code === "invalid_return_type")
127
+ n(i.returnTypeError);
128
+ else if (i.code === "invalid_arguments")
129
+ n(i.argumentsError);
130
+ else if (i.path.length === 0)
131
+ s._errors.push(t(i));
132
+ else {
133
+ let o = s, l = 0;
134
+ for (; l < i.path.length; ) {
135
+ const c = i.path[l];
136
+ l === i.path.length - 1 ? (o[c] = o[c] || { _errors: [] }, o[c]._errors.push(t(i))) : o[c] = o[c] || { _errors: [] }, o = o[c], l++;
137
+ }
138
+ }
139
+ };
140
+ return n(this), s;
141
+ }
142
+ static assert(e) {
143
+ if (!(e instanceof w))
144
+ throw new Error(`Not a ZodError: ${e}`);
145
+ }
146
+ toString() {
147
+ return this.message;
148
+ }
149
+ get message() {
150
+ return JSON.stringify(this.issues, g.jsonStringifyReplacer, 2);
151
+ }
152
+ get isEmpty() {
153
+ return this.issues.length === 0;
154
+ }
155
+ flatten(e = (t) => t.message) {
156
+ const t = {}, s = [];
157
+ for (const n of this.issues)
158
+ n.path.length > 0 ? (t[n.path[0]] = t[n.path[0]] || [], t[n.path[0]].push(e(n))) : s.push(e(n));
159
+ return { formErrors: s, fieldErrors: t };
160
+ }
161
+ get formErrors() {
162
+ return this.flatten();
163
+ }
164
+ }
165
+ w.create = (r) => new w(r);
166
+ const W = (r, e) => {
167
+ let t;
168
+ switch (r.code) {
169
+ case d.invalid_type:
170
+ r.received === f.undefined ? t = "Required" : t = `Expected ${r.expected}, received ${r.received}`;
171
+ break;
172
+ case d.invalid_literal:
173
+ t = `Invalid literal value, expected ${JSON.stringify(r.expected, g.jsonStringifyReplacer)}`;
174
+ break;
175
+ case d.unrecognized_keys:
176
+ t = `Unrecognized key(s) in object: ${g.joinValues(r.keys, ", ")}`;
177
+ break;
178
+ case d.invalid_union:
179
+ t = "Invalid input";
180
+ break;
181
+ case d.invalid_union_discriminator:
182
+ t = `Invalid discriminator value. Expected ${g.joinValues(r.options)}`;
183
+ break;
184
+ case d.invalid_enum_value:
185
+ t = `Invalid enum value. Expected ${g.joinValues(r.options)}, received '${r.received}'`;
186
+ break;
187
+ case d.invalid_arguments:
188
+ t = "Invalid function arguments";
189
+ break;
190
+ case d.invalid_return_type:
191
+ t = "Invalid function return type";
192
+ break;
193
+ case d.invalid_date:
194
+ t = "Invalid date";
195
+ break;
196
+ case d.invalid_string:
197
+ 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}"` : g.assertNever(r.validation) : r.validation !== "regex" ? t = `Invalid ${r.validation}` : t = "Invalid";
198
+ break;
199
+ case d.too_small:
200
+ 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";
201
+ break;
202
+ case d.too_big:
203
+ 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";
204
+ break;
205
+ case d.custom:
206
+ t = "Invalid input";
207
+ break;
208
+ case d.invalid_intersection_types:
209
+ t = "Intersection results could not be merged";
210
+ break;
211
+ case d.not_multiple_of:
212
+ t = `Number must be a multiple of ${r.multipleOf}`;
213
+ break;
214
+ case d.not_finite:
215
+ t = "Number must be finite";
216
+ break;
217
+ default:
218
+ t = e.defaultError, g.assertNever(r);
219
+ }
220
+ return { message: t };
221
+ };
222
+ let Ne = W;
223
+ function De(r) {
224
+ Ne = r;
225
+ }
226
+ function ue() {
227
+ return Ne;
228
+ }
229
+ const le = (r) => {
230
+ const { data: e, path: t, errorMaps: s, issueData: n } = r, a = [...t, ...n.path || []], i = {
231
+ ...n,
232
+ path: a
233
+ };
234
+ if (n.message !== void 0)
235
+ return {
236
+ ...n,
237
+ path: a,
238
+ message: n.message
239
+ };
240
+ let o = "";
241
+ const l = s.filter((c) => !!c).slice().reverse();
242
+ for (const c of l)
243
+ o = c(i, { data: e, defaultError: o }).message;
244
+ return {
245
+ ...n,
246
+ path: a,
247
+ message: o
248
+ };
249
+ }, Le = [];
250
+ function u(r, e) {
251
+ const t = ue(), s = le({
252
+ issueData: e,
253
+ data: r.data,
254
+ path: r.path,
255
+ errorMaps: [
256
+ r.common.contextualErrorMap,
257
+ r.schemaErrorMap,
258
+ t,
259
+ t === W ? void 0 : W
260
+ // then global default map
261
+ ].filter((n) => !!n)
262
+ });
263
+ r.common.issues.push(s);
264
+ }
265
+ class k {
266
+ constructor() {
267
+ this.value = "valid";
268
+ }
269
+ dirty() {
270
+ this.value === "valid" && (this.value = "dirty");
271
+ }
272
+ abort() {
273
+ this.value !== "aborted" && (this.value = "aborted");
274
+ }
275
+ static mergeArray(e, t) {
276
+ const s = [];
277
+ for (const n of t) {
278
+ if (n.status === "aborted")
279
+ return m;
280
+ n.status === "dirty" && e.dirty(), s.push(n.value);
281
+ }
282
+ return { status: e.value, value: s };
283
+ }
284
+ static async mergeObjectAsync(e, t) {
285
+ const s = [];
286
+ for (const n of t) {
287
+ const a = await n.key, i = await n.value;
288
+ s.push({
289
+ key: a,
290
+ value: i
291
+ });
292
+ }
293
+ return k.mergeObjectSync(e, s);
294
+ }
295
+ static mergeObjectSync(e, t) {
296
+ const s = {};
297
+ for (const n of t) {
298
+ const { key: a, value: i } = n;
299
+ if (a.status === "aborted" || i.status === "aborted")
300
+ return m;
301
+ a.status === "dirty" && e.dirty(), i.status === "dirty" && e.dirty(), a.value !== "__proto__" && (typeof i.value < "u" || n.alwaysSet) && (s[a.value] = i.value);
302
+ }
303
+ return { status: e.value, value: s };
304
+ }
305
+ }
306
+ const m = Object.freeze({
307
+ status: "aborted"
308
+ }), U = (r) => ({ status: "dirty", value: r }), b = (r) => ({ status: "valid", value: r }), ke = (r) => r.status === "aborted", be = (r) => r.status === "dirty", G = (r) => r.status === "valid", X = (r) => typeof Promise < "u" && r instanceof Promise;
309
+ function fe(r, e, t, s) {
310
+ if (typeof e == "function" ? r !== e || !s : !e.has(r)) throw new TypeError("Cannot read private member from an object whose class did not declare it");
311
+ return e.get(r);
312
+ }
313
+ function Oe(r, e, t, s, n) {
314
+ if (typeof e == "function" ? r !== e || !n : !e.has(r)) throw new TypeError("Cannot write private member to an object whose class did not declare it");
315
+ return e.set(r, t), t;
316
+ }
317
+ var h;
318
+ (function(r) {
319
+ r.errToObj = (e) => typeof e == "string" ? { message: e } : e || {}, r.toString = (e) => typeof e == "string" ? e : e == null ? void 0 : e.message;
320
+ })(h || (h = {}));
321
+ var J, H;
322
+ class O {
323
+ constructor(e, t, s, n) {
324
+ this._cachedPath = [], this.parent = e, this.data = t, this._path = s, this._key = n;
325
+ }
326
+ get path() {
327
+ return this._cachedPath.length || (this._key instanceof Array ? this._cachedPath.push(...this._path, ...this._key) : this._cachedPath.push(...this._path, this._key)), this._cachedPath;
328
+ }
329
+ }
330
+ const Se = (r, e) => {
331
+ if (G(e))
332
+ return { success: !0, data: e.value };
333
+ if (!r.common.issues.length)
334
+ throw new Error("Validation failed but no issues detected.");
335
+ return {
336
+ success: !1,
337
+ get error() {
338
+ if (this._error)
339
+ return this._error;
340
+ const t = new w(r.common.issues);
341
+ return this._error = t, this._error;
342
+ }
343
+ };
344
+ };
345
+ function v(r) {
346
+ if (!r)
347
+ return {};
348
+ const { errorMap: e, invalid_type_error: t, required_error: s, description: n } = r;
349
+ if (e && (t || s))
350
+ throw new Error(`Can't use "invalid_type_error" or "required_error" in conjunction with custom error map.`);
351
+ return e ? { errorMap: e, description: n } : { errorMap: (i, o) => {
352
+ var l, c;
353
+ const { message: y } = r;
354
+ return i.code === "invalid_enum_value" ? { message: y ?? o.defaultError } : typeof o.data > "u" ? { message: (l = y ?? s) !== null && l !== void 0 ? l : o.defaultError } : i.code !== "invalid_type" ? { message: o.defaultError } : { message: (c = y ?? t) !== null && c !== void 0 ? c : o.defaultError };
355
+ }, description: n };
356
+ }
357
+ class _ {
358
+ constructor(e) {
359
+ this.spa = this.safeParseAsync, this._def = e, this.parse = this.parse.bind(this), this.safeParse = this.safeParse.bind(this), this.parseAsync = this.parseAsync.bind(this), this.safeParseAsync = this.safeParseAsync.bind(this), this.spa = this.spa.bind(this), this.refine = this.refine.bind(this), this.refinement = this.refinement.bind(this), this.superRefine = this.superRefine.bind(this), this.optional = this.optional.bind(this), this.nullable = this.nullable.bind(this), this.nullish = this.nullish.bind(this), this.array = this.array.bind(this), this.promise = this.promise.bind(this), this.or = this.or.bind(this), this.and = this.and.bind(this), this.transform = this.transform.bind(this), this.brand = this.brand.bind(this), this.default = this.default.bind(this), this.catch = this.catch.bind(this), this.describe = this.describe.bind(this), this.pipe = this.pipe.bind(this), this.readonly = this.readonly.bind(this), this.isNullable = this.isNullable.bind(this), this.isOptional = this.isOptional.bind(this);
360
+ }
361
+ get description() {
362
+ return this._def.description;
363
+ }
364
+ _getType(e) {
365
+ return j(e.data);
366
+ }
367
+ _getOrReturnCtx(e, t) {
368
+ return t || {
369
+ common: e.parent.common,
370
+ data: e.data,
371
+ parsedType: j(e.data),
372
+ schemaErrorMap: this._def.errorMap,
373
+ path: e.path,
374
+ parent: e.parent
375
+ };
376
+ }
377
+ _processInputParams(e) {
378
+ return {
379
+ status: new k(),
380
+ ctx: {
381
+ common: e.parent.common,
382
+ data: e.data,
383
+ parsedType: j(e.data),
384
+ schemaErrorMap: this._def.errorMap,
385
+ path: e.path,
386
+ parent: e.parent
387
+ }
388
+ };
389
+ }
390
+ _parseSync(e) {
391
+ const t = this._parse(e);
392
+ if (X(t))
393
+ throw new Error("Synchronous parse encountered promise.");
394
+ return t;
395
+ }
396
+ _parseAsync(e) {
397
+ const t = this._parse(e);
398
+ return Promise.resolve(t);
399
+ }
400
+ parse(e, t) {
401
+ const s = this.safeParse(e, t);
402
+ if (s.success)
403
+ return s.data;
404
+ throw s.error;
405
+ }
406
+ safeParse(e, t) {
407
+ var s;
408
+ const n = {
409
+ common: {
410
+ issues: [],
411
+ async: (s = t == null ? void 0 : t.async) !== null && s !== void 0 ? s : !1,
412
+ contextualErrorMap: t == null ? void 0 : t.errorMap
413
+ },
414
+ path: (t == null ? void 0 : t.path) || [],
415
+ schemaErrorMap: this._def.errorMap,
416
+ parent: null,
417
+ data: e,
418
+ parsedType: j(e)
419
+ }, a = this._parseSync({ data: e, path: n.path, parent: n });
420
+ return Se(n, a);
421
+ }
422
+ async parseAsync(e, t) {
423
+ const s = await this.safeParseAsync(e, t);
424
+ if (s.success)
425
+ return s.data;
426
+ throw s.error;
427
+ }
428
+ async safeParseAsync(e, t) {
429
+ const s = {
430
+ common: {
431
+ issues: [],
432
+ contextualErrorMap: t == null ? void 0 : t.errorMap,
433
+ async: !0
434
+ },
435
+ path: (t == null ? void 0 : t.path) || [],
436
+ schemaErrorMap: this._def.errorMap,
437
+ parent: null,
438
+ data: e,
439
+ parsedType: j(e)
440
+ }, n = this._parse({ data: e, path: s.path, parent: s }), a = await (X(n) ? n : Promise.resolve(n));
441
+ return Se(s, a);
442
+ }
443
+ refine(e, t) {
444
+ const s = (n) => typeof t == "string" || typeof t > "u" ? { message: t } : typeof t == "function" ? t(n) : t;
445
+ return this._refinement((n, a) => {
446
+ const i = e(n), o = () => a.addIssue({
447
+ code: d.custom,
448
+ ...s(n)
449
+ });
450
+ return typeof Promise < "u" && i instanceof Promise ? i.then((l) => l ? !0 : (o(), !1)) : i ? !0 : (o(), !1);
451
+ });
452
+ }
453
+ refinement(e, t) {
454
+ return this._refinement((s, n) => e(s) ? !0 : (n.addIssue(typeof t == "function" ? t(s, n) : t), !1));
455
+ }
456
+ _refinement(e) {
457
+ return new C({
458
+ schema: this,
459
+ typeName: p.ZodEffects,
460
+ effect: { type: "refinement", refinement: e }
461
+ });
462
+ }
463
+ superRefine(e) {
464
+ return this._refinement(e);
465
+ }
466
+ optional() {
467
+ return N.create(this, this._def);
468
+ }
469
+ nullable() {
470
+ return P.create(this, this._def);
471
+ }
472
+ nullish() {
473
+ return this.nullable().optional();
474
+ }
475
+ array() {
476
+ return S.create(this, this._def);
477
+ }
478
+ promise() {
479
+ return Y.create(this, this._def);
480
+ }
481
+ or(e) {
482
+ return ee.create([this, e], this._def);
483
+ }
484
+ and(e) {
485
+ return te.create(this, e, this._def);
486
+ }
487
+ transform(e) {
488
+ return new C({
489
+ ...v(this._def),
490
+ schema: this,
491
+ typeName: p.ZodEffects,
492
+ effect: { type: "transform", transform: e }
493
+ });
494
+ }
495
+ default(e) {
496
+ const t = typeof e == "function" ? e : () => e;
497
+ return new ie({
498
+ ...v(this._def),
499
+ innerType: this,
500
+ defaultValue: t,
501
+ typeName: p.ZodDefault
502
+ });
503
+ }
504
+ brand() {
505
+ return new Te({
506
+ typeName: p.ZodBranded,
507
+ type: this,
508
+ ...v(this._def)
509
+ });
510
+ }
511
+ catch(e) {
512
+ const t = typeof e == "function" ? e : () => e;
513
+ return new oe({
514
+ ...v(this._def),
515
+ innerType: this,
516
+ catchValue: t,
517
+ typeName: p.ZodCatch
518
+ });
519
+ }
520
+ describe(e) {
521
+ const t = this.constructor;
522
+ return new t({
523
+ ...this._def,
524
+ description: e
525
+ });
526
+ }
527
+ pipe(e) {
528
+ return ce.create(this, e);
529
+ }
530
+ readonly() {
531
+ return de.create(this);
532
+ }
533
+ isOptional() {
534
+ return this.safeParse(void 0).success;
535
+ }
536
+ isNullable() {
537
+ return this.safeParse(null).success;
538
+ }
539
+ }
540
+ const ze = /^c[^\s-]{8,}$/i, Ue = /^[0-9a-z]+$/, Be = /^[0-9A-HJKMNP-TV-Z]{26}$/, We = /^[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, qe = /^[a-z0-9_-]{21}$/i, Ye = /^[-+]?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)?)??$/, Je = /^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i, He = "^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$";
541
+ let ge;
542
+ const Ge = /^(?:(?: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])$/, Xe = /^(([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})))$/, Qe = /^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/, Ee = "((\\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])))", Ke = new RegExp(`^${Ee}$`);
543
+ function Re(r) {
544
+ let e = "([01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d";
545
+ return r.precision ? e = `${e}\\.\\d{${r.precision}}` : r.precision == null && (e = `${e}(\\.\\d+)?`), e;
546
+ }
547
+ function Fe(r) {
548
+ return new RegExp(`^${Re(r)}$`);
549
+ }
550
+ function Ie(r) {
551
+ let e = `${Ee}T${Re(r)}`;
552
+ const t = [];
553
+ return t.push(r.local ? "Z?" : "Z"), r.offset && t.push("([+-]\\d{2}:?\\d{2})"), e = `${e}(${t.join("|")})`, new RegExp(`^${e}$`);
554
+ }
555
+ function et(r, e) {
556
+ return !!((e === "v4" || !e) && Ge.test(r) || (e === "v6" || !e) && Xe.test(r));
557
+ }
558
+ class Z extends _ {
559
+ _parse(e) {
560
+ if (this._def.coerce && (e.data = String(e.data)), this._getType(e) !== f.string) {
561
+ const a = this._getOrReturnCtx(e);
562
+ return u(a, {
563
+ code: d.invalid_type,
564
+ expected: f.string,
565
+ received: a.parsedType
566
+ }), m;
567
+ }
568
+ const s = new k();
569
+ let n;
570
+ for (const a of this._def.checks)
571
+ if (a.kind === "min")
572
+ e.data.length < a.value && (n = this._getOrReturnCtx(e, n), u(n, {
573
+ code: d.too_small,
574
+ minimum: a.value,
575
+ type: "string",
576
+ inclusive: !0,
577
+ exact: !1,
578
+ message: a.message
579
+ }), s.dirty());
580
+ else if (a.kind === "max")
581
+ e.data.length > a.value && (n = this._getOrReturnCtx(e, n), u(n, {
582
+ code: d.too_big,
583
+ maximum: a.value,
584
+ type: "string",
585
+ inclusive: !0,
586
+ exact: !1,
587
+ message: a.message
588
+ }), s.dirty());
589
+ else if (a.kind === "length") {
590
+ const i = e.data.length > a.value, o = e.data.length < a.value;
591
+ (i || o) && (n = this._getOrReturnCtx(e, n), i ? u(n, {
592
+ code: d.too_big,
593
+ maximum: a.value,
594
+ type: "string",
595
+ inclusive: !0,
596
+ exact: !0,
597
+ message: a.message
598
+ }) : o && u(n, {
599
+ code: d.too_small,
600
+ minimum: a.value,
601
+ type: "string",
602
+ inclusive: !0,
603
+ exact: !0,
604
+ message: a.message
605
+ }), s.dirty());
606
+ } else if (a.kind === "email")
607
+ Je.test(e.data) || (n = this._getOrReturnCtx(e, n), u(n, {
608
+ validation: "email",
609
+ code: d.invalid_string,
610
+ message: a.message
611
+ }), s.dirty());
612
+ else if (a.kind === "emoji")
613
+ ge || (ge = new RegExp(He, "u")), ge.test(e.data) || (n = this._getOrReturnCtx(e, n), u(n, {
614
+ validation: "emoji",
615
+ code: d.invalid_string,
616
+ message: a.message
617
+ }), s.dirty());
618
+ else if (a.kind === "uuid")
619
+ We.test(e.data) || (n = this._getOrReturnCtx(e, n), u(n, {
620
+ validation: "uuid",
621
+ code: d.invalid_string,
622
+ message: a.message
623
+ }), s.dirty());
624
+ else if (a.kind === "nanoid")
625
+ qe.test(e.data) || (n = this._getOrReturnCtx(e, n), u(n, {
626
+ validation: "nanoid",
627
+ code: d.invalid_string,
628
+ message: a.message
629
+ }), s.dirty());
630
+ else if (a.kind === "cuid")
631
+ ze.test(e.data) || (n = this._getOrReturnCtx(e, n), u(n, {
632
+ validation: "cuid",
633
+ code: d.invalid_string,
634
+ message: a.message
635
+ }), s.dirty());
636
+ else if (a.kind === "cuid2")
637
+ Ue.test(e.data) || (n = this._getOrReturnCtx(e, n), u(n, {
638
+ validation: "cuid2",
639
+ code: d.invalid_string,
640
+ message: a.message
641
+ }), s.dirty());
642
+ else if (a.kind === "ulid")
643
+ Be.test(e.data) || (n = this._getOrReturnCtx(e, n), u(n, {
644
+ validation: "ulid",
645
+ code: d.invalid_string,
646
+ message: a.message
647
+ }), s.dirty());
648
+ else if (a.kind === "url")
649
+ try {
650
+ new URL(e.data);
651
+ } catch {
652
+ n = this._getOrReturnCtx(e, n), u(n, {
653
+ validation: "url",
654
+ code: d.invalid_string,
655
+ message: a.message
656
+ }), s.dirty();
657
+ }
658
+ else a.kind === "regex" ? (a.regex.lastIndex = 0, a.regex.test(e.data) || (n = this._getOrReturnCtx(e, n), u(n, {
659
+ validation: "regex",
660
+ code: d.invalid_string,
661
+ message: a.message
662
+ }), s.dirty())) : a.kind === "trim" ? e.data = e.data.trim() : a.kind === "includes" ? e.data.includes(a.value, a.position) || (n = this._getOrReturnCtx(e, n), u(n, {
663
+ code: d.invalid_string,
664
+ validation: { includes: a.value, position: a.position },
665
+ message: a.message
666
+ }), s.dirty()) : a.kind === "toLowerCase" ? e.data = e.data.toLowerCase() : a.kind === "toUpperCase" ? e.data = e.data.toUpperCase() : a.kind === "startsWith" ? e.data.startsWith(a.value) || (n = this._getOrReturnCtx(e, n), u(n, {
667
+ code: d.invalid_string,
668
+ validation: { startsWith: a.value },
669
+ message: a.message
670
+ }), s.dirty()) : a.kind === "endsWith" ? e.data.endsWith(a.value) || (n = this._getOrReturnCtx(e, n), u(n, {
671
+ code: d.invalid_string,
672
+ validation: { endsWith: a.value },
673
+ message: a.message
674
+ }), s.dirty()) : a.kind === "datetime" ? Ie(a).test(e.data) || (n = this._getOrReturnCtx(e, n), u(n, {
675
+ code: d.invalid_string,
676
+ validation: "datetime",
677
+ message: a.message
678
+ }), s.dirty()) : a.kind === "date" ? Ke.test(e.data) || (n = this._getOrReturnCtx(e, n), u(n, {
679
+ code: d.invalid_string,
680
+ validation: "date",
681
+ message: a.message
682
+ }), s.dirty()) : a.kind === "time" ? Fe(a).test(e.data) || (n = this._getOrReturnCtx(e, n), u(n, {
683
+ code: d.invalid_string,
684
+ validation: "time",
685
+ message: a.message
686
+ }), s.dirty()) : a.kind === "duration" ? Ye.test(e.data) || (n = this._getOrReturnCtx(e, n), u(n, {
687
+ validation: "duration",
688
+ code: d.invalid_string,
689
+ message: a.message
690
+ }), s.dirty()) : a.kind === "ip" ? et(e.data, a.version) || (n = this._getOrReturnCtx(e, n), u(n, {
691
+ validation: "ip",
692
+ code: d.invalid_string,
693
+ message: a.message
694
+ }), s.dirty()) : a.kind === "base64" ? Qe.test(e.data) || (n = this._getOrReturnCtx(e, n), u(n, {
695
+ validation: "base64",
696
+ code: d.invalid_string,
697
+ message: a.message
698
+ }), s.dirty()) : g.assertNever(a);
699
+ return { status: s.value, value: e.data };
700
+ }
701
+ _regex(e, t, s) {
702
+ return this.refinement((n) => e.test(n), {
703
+ validation: t,
704
+ code: d.invalid_string,
705
+ ...h.errToObj(s)
706
+ });
707
+ }
708
+ _addCheck(e) {
709
+ return new Z({
710
+ ...this._def,
711
+ checks: [...this._def.checks, e]
712
+ });
713
+ }
714
+ email(e) {
715
+ return this._addCheck({ kind: "email", ...h.errToObj(e) });
716
+ }
717
+ url(e) {
718
+ return this._addCheck({ kind: "url", ...h.errToObj(e) });
719
+ }
720
+ emoji(e) {
721
+ return this._addCheck({ kind: "emoji", ...h.errToObj(e) });
722
+ }
723
+ uuid(e) {
724
+ return this._addCheck({ kind: "uuid", ...h.errToObj(e) });
725
+ }
726
+ nanoid(e) {
727
+ return this._addCheck({ kind: "nanoid", ...h.errToObj(e) });
728
+ }
729
+ cuid(e) {
730
+ return this._addCheck({ kind: "cuid", ...h.errToObj(e) });
731
+ }
732
+ cuid2(e) {
733
+ return this._addCheck({ kind: "cuid2", ...h.errToObj(e) });
734
+ }
735
+ ulid(e) {
736
+ return this._addCheck({ kind: "ulid", ...h.errToObj(e) });
737
+ }
738
+ base64(e) {
739
+ return this._addCheck({ kind: "base64", ...h.errToObj(e) });
740
+ }
741
+ ip(e) {
742
+ return this._addCheck({ kind: "ip", ...h.errToObj(e) });
743
+ }
744
+ datetime(e) {
745
+ var t, s;
746
+ return typeof e == "string" ? this._addCheck({
747
+ kind: "datetime",
748
+ precision: null,
749
+ offset: !1,
750
+ local: !1,
751
+ message: e
752
+ }) : this._addCheck({
753
+ kind: "datetime",
754
+ precision: typeof (e == null ? void 0 : e.precision) > "u" ? null : e == null ? void 0 : e.precision,
755
+ offset: (t = e == null ? void 0 : e.offset) !== null && t !== void 0 ? t : !1,
756
+ local: (s = e == null ? void 0 : e.local) !== null && s !== void 0 ? s : !1,
757
+ ...h.errToObj(e == null ? void 0 : e.message)
758
+ });
759
+ }
760
+ date(e) {
761
+ return this._addCheck({ kind: "date", message: e });
762
+ }
763
+ time(e) {
764
+ return typeof e == "string" ? this._addCheck({
765
+ kind: "time",
766
+ precision: null,
767
+ message: e
768
+ }) : this._addCheck({
769
+ kind: "time",
770
+ precision: typeof (e == null ? void 0 : e.precision) > "u" ? null : e == null ? void 0 : e.precision,
771
+ ...h.errToObj(e == null ? void 0 : e.message)
772
+ });
773
+ }
774
+ duration(e) {
775
+ return this._addCheck({ kind: "duration", ...h.errToObj(e) });
776
+ }
777
+ regex(e, t) {
778
+ return this._addCheck({
779
+ kind: "regex",
780
+ regex: e,
781
+ ...h.errToObj(t)
782
+ });
783
+ }
784
+ includes(e, t) {
785
+ return this._addCheck({
786
+ kind: "includes",
787
+ value: e,
788
+ position: t == null ? void 0 : t.position,
789
+ ...h.errToObj(t == null ? void 0 : t.message)
790
+ });
791
+ }
792
+ startsWith(e, t) {
793
+ return this._addCheck({
794
+ kind: "startsWith",
795
+ value: e,
796
+ ...h.errToObj(t)
797
+ });
798
+ }
799
+ endsWith(e, t) {
800
+ return this._addCheck({
801
+ kind: "endsWith",
802
+ value: e,
803
+ ...h.errToObj(t)
804
+ });
805
+ }
806
+ min(e, t) {
807
+ return this._addCheck({
808
+ kind: "min",
809
+ value: e,
810
+ ...h.errToObj(t)
811
+ });
812
+ }
813
+ max(e, t) {
814
+ return this._addCheck({
815
+ kind: "max",
816
+ value: e,
817
+ ...h.errToObj(t)
818
+ });
819
+ }
820
+ length(e, t) {
821
+ return this._addCheck({
822
+ kind: "length",
823
+ value: e,
824
+ ...h.errToObj(t)
825
+ });
826
+ }
827
+ /**
828
+ * @deprecated Use z.string().min(1) instead.
829
+ * @see {@link ZodString.min}
830
+ */
831
+ nonempty(e) {
832
+ return this.min(1, h.errToObj(e));
833
+ }
834
+ trim() {
835
+ return new Z({
836
+ ...this._def,
837
+ checks: [...this._def.checks, { kind: "trim" }]
838
+ });
839
+ }
840
+ toLowerCase() {
841
+ return new Z({
842
+ ...this._def,
843
+ checks: [...this._def.checks, { kind: "toLowerCase" }]
844
+ });
845
+ }
846
+ toUpperCase() {
847
+ return new Z({
848
+ ...this._def,
849
+ checks: [...this._def.checks, { kind: "toUpperCase" }]
850
+ });
851
+ }
852
+ get isDatetime() {
853
+ return !!this._def.checks.find((e) => e.kind === "datetime");
854
+ }
855
+ get isDate() {
856
+ return !!this._def.checks.find((e) => e.kind === "date");
857
+ }
858
+ get isTime() {
859
+ return !!this._def.checks.find((e) => e.kind === "time");
860
+ }
861
+ get isDuration() {
862
+ return !!this._def.checks.find((e) => e.kind === "duration");
863
+ }
864
+ get isEmail() {
865
+ return !!this._def.checks.find((e) => e.kind === "email");
866
+ }
867
+ get isURL() {
868
+ return !!this._def.checks.find((e) => e.kind === "url");
869
+ }
870
+ get isEmoji() {
871
+ return !!this._def.checks.find((e) => e.kind === "emoji");
872
+ }
873
+ get isUUID() {
874
+ return !!this._def.checks.find((e) => e.kind === "uuid");
875
+ }
876
+ get isNANOID() {
877
+ return !!this._def.checks.find((e) => e.kind === "nanoid");
878
+ }
879
+ get isCUID() {
880
+ return !!this._def.checks.find((e) => e.kind === "cuid");
881
+ }
882
+ get isCUID2() {
883
+ return !!this._def.checks.find((e) => e.kind === "cuid2");
884
+ }
885
+ get isULID() {
886
+ return !!this._def.checks.find((e) => e.kind === "ulid");
887
+ }
888
+ get isIP() {
889
+ return !!this._def.checks.find((e) => e.kind === "ip");
890
+ }
891
+ get isBase64() {
892
+ return !!this._def.checks.find((e) => e.kind === "base64");
893
+ }
894
+ get minLength() {
895
+ let e = null;
896
+ for (const t of this._def.checks)
897
+ t.kind === "min" && (e === null || t.value > e) && (e = t.value);
898
+ return e;
899
+ }
900
+ get maxLength() {
901
+ let e = null;
902
+ for (const t of this._def.checks)
903
+ t.kind === "max" && (e === null || t.value < e) && (e = t.value);
904
+ return e;
905
+ }
906
+ }
907
+ Z.create = (r) => {
908
+ var e;
909
+ return new Z({
910
+ checks: [],
911
+ typeName: p.ZodString,
912
+ coerce: (e = r == null ? void 0 : r.coerce) !== null && e !== void 0 ? e : !1,
913
+ ...v(r)
914
+ });
915
+ };
916
+ function tt(r, e) {
917
+ const t = (r.toString().split(".")[1] || "").length, s = (e.toString().split(".")[1] || "").length, n = t > s ? t : s, a = parseInt(r.toFixed(n).replace(".", "")), i = parseInt(e.toFixed(n).replace(".", ""));
918
+ return a % i / Math.pow(10, n);
919
+ }
920
+ class A extends _ {
921
+ constructor() {
922
+ super(...arguments), this.min = this.gte, this.max = this.lte, this.step = this.multipleOf;
923
+ }
924
+ _parse(e) {
925
+ if (this._def.coerce && (e.data = Number(e.data)), this._getType(e) !== f.number) {
926
+ const a = this._getOrReturnCtx(e);
927
+ return u(a, {
928
+ code: d.invalid_type,
929
+ expected: f.number,
930
+ received: a.parsedType
931
+ }), m;
932
+ }
933
+ let s;
934
+ const n = new k();
935
+ for (const a of this._def.checks)
936
+ a.kind === "int" ? g.isInteger(e.data) || (s = this._getOrReturnCtx(e, s), u(s, {
937
+ code: d.invalid_type,
938
+ expected: "integer",
939
+ received: "float",
940
+ message: a.message
941
+ }), n.dirty()) : a.kind === "min" ? (a.inclusive ? e.data < a.value : e.data <= a.value) && (s = this._getOrReturnCtx(e, s), u(s, {
942
+ code: d.too_small,
943
+ minimum: a.value,
944
+ type: "number",
945
+ inclusive: a.inclusive,
946
+ exact: !1,
947
+ message: a.message
948
+ }), n.dirty()) : a.kind === "max" ? (a.inclusive ? e.data > a.value : e.data >= a.value) && (s = this._getOrReturnCtx(e, s), u(s, {
949
+ code: d.too_big,
950
+ maximum: a.value,
951
+ type: "number",
952
+ inclusive: a.inclusive,
953
+ exact: !1,
954
+ message: a.message
955
+ }), n.dirty()) : a.kind === "multipleOf" ? tt(e.data, a.value) !== 0 && (s = this._getOrReturnCtx(e, s), u(s, {
956
+ code: d.not_multiple_of,
957
+ multipleOf: a.value,
958
+ message: a.message
959
+ }), n.dirty()) : a.kind === "finite" ? Number.isFinite(e.data) || (s = this._getOrReturnCtx(e, s), u(s, {
960
+ code: d.not_finite,
961
+ message: a.message
962
+ }), n.dirty()) : g.assertNever(a);
963
+ return { status: n.value, value: e.data };
964
+ }
965
+ gte(e, t) {
966
+ return this.setLimit("min", e, !0, h.toString(t));
967
+ }
968
+ gt(e, t) {
969
+ return this.setLimit("min", e, !1, h.toString(t));
970
+ }
971
+ lte(e, t) {
972
+ return this.setLimit("max", e, !0, h.toString(t));
973
+ }
974
+ lt(e, t) {
975
+ return this.setLimit("max", e, !1, h.toString(t));
976
+ }
977
+ setLimit(e, t, s, n) {
978
+ return new A({
979
+ ...this._def,
980
+ checks: [
981
+ ...this._def.checks,
982
+ {
983
+ kind: e,
984
+ value: t,
985
+ inclusive: s,
986
+ message: h.toString(n)
987
+ }
988
+ ]
989
+ });
990
+ }
991
+ _addCheck(e) {
992
+ return new A({
993
+ ...this._def,
994
+ checks: [...this._def.checks, e]
995
+ });
996
+ }
997
+ int(e) {
998
+ return this._addCheck({
999
+ kind: "int",
1000
+ message: h.toString(e)
1001
+ });
1002
+ }
1003
+ positive(e) {
1004
+ return this._addCheck({
1005
+ kind: "min",
1006
+ value: 0,
1007
+ inclusive: !1,
1008
+ message: h.toString(e)
1009
+ });
1010
+ }
1011
+ negative(e) {
1012
+ return this._addCheck({
1013
+ kind: "max",
1014
+ value: 0,
1015
+ inclusive: !1,
1016
+ message: h.toString(e)
1017
+ });
1018
+ }
1019
+ nonpositive(e) {
1020
+ return this._addCheck({
1021
+ kind: "max",
1022
+ value: 0,
1023
+ inclusive: !0,
1024
+ message: h.toString(e)
1025
+ });
1026
+ }
1027
+ nonnegative(e) {
1028
+ return this._addCheck({
1029
+ kind: "min",
1030
+ value: 0,
1031
+ inclusive: !0,
1032
+ message: h.toString(e)
1033
+ });
1034
+ }
1035
+ multipleOf(e, t) {
1036
+ return this._addCheck({
1037
+ kind: "multipleOf",
1038
+ value: e,
1039
+ message: h.toString(t)
1040
+ });
1041
+ }
1042
+ finite(e) {
1043
+ return this._addCheck({
1044
+ kind: "finite",
1045
+ message: h.toString(e)
1046
+ });
1047
+ }
1048
+ safe(e) {
1049
+ return this._addCheck({
1050
+ kind: "min",
1051
+ inclusive: !0,
1052
+ value: Number.MIN_SAFE_INTEGER,
1053
+ message: h.toString(e)
1054
+ })._addCheck({
1055
+ kind: "max",
1056
+ inclusive: !0,
1057
+ value: Number.MAX_SAFE_INTEGER,
1058
+ message: h.toString(e)
1059
+ });
1060
+ }
1061
+ get minValue() {
1062
+ let e = null;
1063
+ for (const t of this._def.checks)
1064
+ t.kind === "min" && (e === null || t.value > e) && (e = t.value);
1065
+ return e;
1066
+ }
1067
+ get maxValue() {
1068
+ let e = null;
1069
+ for (const t of this._def.checks)
1070
+ t.kind === "max" && (e === null || t.value < e) && (e = t.value);
1071
+ return e;
1072
+ }
1073
+ get isInt() {
1074
+ return !!this._def.checks.find((e) => e.kind === "int" || e.kind === "multipleOf" && g.isInteger(e.value));
1075
+ }
1076
+ get isFinite() {
1077
+ let e = null, t = null;
1078
+ for (const s of this._def.checks) {
1079
+ if (s.kind === "finite" || s.kind === "int" || s.kind === "multipleOf")
1080
+ return !0;
1081
+ s.kind === "min" ? (t === null || s.value > t) && (t = s.value) : s.kind === "max" && (e === null || s.value < e) && (e = s.value);
1082
+ }
1083
+ return Number.isFinite(t) && Number.isFinite(e);
1084
+ }
1085
+ }
1086
+ A.create = (r) => new A({
1087
+ checks: [],
1088
+ typeName: p.ZodNumber,
1089
+ coerce: (r == null ? void 0 : r.coerce) || !1,
1090
+ ...v(r)
1091
+ });
1092
+ class M extends _ {
1093
+ constructor() {
1094
+ super(...arguments), this.min = this.gte, this.max = this.lte;
1095
+ }
1096
+ _parse(e) {
1097
+ if (this._def.coerce && (e.data = BigInt(e.data)), this._getType(e) !== f.bigint) {
1098
+ const a = this._getOrReturnCtx(e);
1099
+ return u(a, {
1100
+ code: d.invalid_type,
1101
+ expected: f.bigint,
1102
+ received: a.parsedType
1103
+ }), m;
1104
+ }
1105
+ let s;
1106
+ const n = new k();
1107
+ for (const a of this._def.checks)
1108
+ a.kind === "min" ? (a.inclusive ? e.data < a.value : e.data <= a.value) && (s = this._getOrReturnCtx(e, s), u(s, {
1109
+ code: d.too_small,
1110
+ type: "bigint",
1111
+ minimum: a.value,
1112
+ inclusive: a.inclusive,
1113
+ message: a.message
1114
+ }), n.dirty()) : a.kind === "max" ? (a.inclusive ? e.data > a.value : e.data >= a.value) && (s = this._getOrReturnCtx(e, s), u(s, {
1115
+ code: d.too_big,
1116
+ type: "bigint",
1117
+ maximum: a.value,
1118
+ inclusive: a.inclusive,
1119
+ message: a.message
1120
+ }), n.dirty()) : a.kind === "multipleOf" ? e.data % a.value !== BigInt(0) && (s = this._getOrReturnCtx(e, s), u(s, {
1121
+ code: d.not_multiple_of,
1122
+ multipleOf: a.value,
1123
+ message: a.message
1124
+ }), n.dirty()) : g.assertNever(a);
1125
+ return { status: n.value, value: e.data };
1126
+ }
1127
+ gte(e, t) {
1128
+ return this.setLimit("min", e, !0, h.toString(t));
1129
+ }
1130
+ gt(e, t) {
1131
+ return this.setLimit("min", e, !1, h.toString(t));
1132
+ }
1133
+ lte(e, t) {
1134
+ return this.setLimit("max", e, !0, h.toString(t));
1135
+ }
1136
+ lt(e, t) {
1137
+ return this.setLimit("max", e, !1, h.toString(t));
1138
+ }
1139
+ setLimit(e, t, s, n) {
1140
+ return new M({
1141
+ ...this._def,
1142
+ checks: [
1143
+ ...this._def.checks,
1144
+ {
1145
+ kind: e,
1146
+ value: t,
1147
+ inclusive: s,
1148
+ message: h.toString(n)
1149
+ }
1150
+ ]
1151
+ });
1152
+ }
1153
+ _addCheck(e) {
1154
+ return new M({
1155
+ ...this._def,
1156
+ checks: [...this._def.checks, e]
1157
+ });
1158
+ }
1159
+ positive(e) {
1160
+ return this._addCheck({
1161
+ kind: "min",
1162
+ value: BigInt(0),
1163
+ inclusive: !1,
1164
+ message: h.toString(e)
1165
+ });
1166
+ }
1167
+ negative(e) {
1168
+ return this._addCheck({
1169
+ kind: "max",
1170
+ value: BigInt(0),
1171
+ inclusive: !1,
1172
+ message: h.toString(e)
1173
+ });
1174
+ }
1175
+ nonpositive(e) {
1176
+ return this._addCheck({
1177
+ kind: "max",
1178
+ value: BigInt(0),
1179
+ inclusive: !0,
1180
+ message: h.toString(e)
1181
+ });
1182
+ }
1183
+ nonnegative(e) {
1184
+ return this._addCheck({
1185
+ kind: "min",
1186
+ value: BigInt(0),
1187
+ inclusive: !0,
1188
+ message: h.toString(e)
1189
+ });
1190
+ }
1191
+ multipleOf(e, t) {
1192
+ return this._addCheck({
1193
+ kind: "multipleOf",
1194
+ value: e,
1195
+ message: h.toString(t)
1196
+ });
1197
+ }
1198
+ get minValue() {
1199
+ let e = null;
1200
+ for (const t of this._def.checks)
1201
+ t.kind === "min" && (e === null || t.value > e) && (e = t.value);
1202
+ return e;
1203
+ }
1204
+ get maxValue() {
1205
+ let e = null;
1206
+ for (const t of this._def.checks)
1207
+ t.kind === "max" && (e === null || t.value < e) && (e = t.value);
1208
+ return e;
1209
+ }
1210
+ }
1211
+ M.create = (r) => {
1212
+ var e;
1213
+ return new M({
1214
+ checks: [],
1215
+ typeName: p.ZodBigInt,
1216
+ coerce: (e = r == null ? void 0 : r.coerce) !== null && e !== void 0 ? e : !1,
1217
+ ...v(r)
1218
+ });
1219
+ };
1220
+ class Q extends _ {
1221
+ _parse(e) {
1222
+ if (this._def.coerce && (e.data = !!e.data), this._getType(e) !== f.boolean) {
1223
+ const s = this._getOrReturnCtx(e);
1224
+ return u(s, {
1225
+ code: d.invalid_type,
1226
+ expected: f.boolean,
1227
+ received: s.parsedType
1228
+ }), m;
1229
+ }
1230
+ return b(e.data);
1231
+ }
1232
+ }
1233
+ Q.create = (r) => new Q({
1234
+ typeName: p.ZodBoolean,
1235
+ coerce: (r == null ? void 0 : r.coerce) || !1,
1236
+ ...v(r)
1237
+ });
1238
+ class D extends _ {
1239
+ _parse(e) {
1240
+ if (this._def.coerce && (e.data = new Date(e.data)), this._getType(e) !== f.date) {
1241
+ const a = this._getOrReturnCtx(e);
1242
+ return u(a, {
1243
+ code: d.invalid_type,
1244
+ expected: f.date,
1245
+ received: a.parsedType
1246
+ }), m;
1247
+ }
1248
+ if (isNaN(e.data.getTime())) {
1249
+ const a = this._getOrReturnCtx(e);
1250
+ return u(a, {
1251
+ code: d.invalid_date
1252
+ }), m;
1253
+ }
1254
+ const s = new k();
1255
+ let n;
1256
+ for (const a of this._def.checks)
1257
+ a.kind === "min" ? e.data.getTime() < a.value && (n = this._getOrReturnCtx(e, n), u(n, {
1258
+ code: d.too_small,
1259
+ message: a.message,
1260
+ inclusive: !0,
1261
+ exact: !1,
1262
+ minimum: a.value,
1263
+ type: "date"
1264
+ }), s.dirty()) : a.kind === "max" ? e.data.getTime() > a.value && (n = this._getOrReturnCtx(e, n), u(n, {
1265
+ code: d.too_big,
1266
+ message: a.message,
1267
+ inclusive: !0,
1268
+ exact: !1,
1269
+ maximum: a.value,
1270
+ type: "date"
1271
+ }), s.dirty()) : g.assertNever(a);
1272
+ return {
1273
+ status: s.value,
1274
+ value: new Date(e.data.getTime())
1275
+ };
1276
+ }
1277
+ _addCheck(e) {
1278
+ return new D({
1279
+ ...this._def,
1280
+ checks: [...this._def.checks, e]
1281
+ });
1282
+ }
1283
+ min(e, t) {
1284
+ return this._addCheck({
1285
+ kind: "min",
1286
+ value: e.getTime(),
1287
+ message: h.toString(t)
1288
+ });
1289
+ }
1290
+ max(e, t) {
1291
+ return this._addCheck({
1292
+ kind: "max",
1293
+ value: e.getTime(),
1294
+ message: h.toString(t)
1295
+ });
1296
+ }
1297
+ get minDate() {
1298
+ let e = null;
1299
+ for (const t of this._def.checks)
1300
+ t.kind === "min" && (e === null || t.value > e) && (e = t.value);
1301
+ return e != null ? new Date(e) : null;
1302
+ }
1303
+ get maxDate() {
1304
+ let e = null;
1305
+ for (const t of this._def.checks)
1306
+ t.kind === "max" && (e === null || t.value < e) && (e = t.value);
1307
+ return e != null ? new Date(e) : null;
1308
+ }
1309
+ }
1310
+ D.create = (r) => new D({
1311
+ checks: [],
1312
+ coerce: (r == null ? void 0 : r.coerce) || !1,
1313
+ typeName: p.ZodDate,
1314
+ ...v(r)
1315
+ });
1316
+ class he extends _ {
1317
+ _parse(e) {
1318
+ if (this._getType(e) !== f.symbol) {
1319
+ const s = this._getOrReturnCtx(e);
1320
+ return u(s, {
1321
+ code: d.invalid_type,
1322
+ expected: f.symbol,
1323
+ received: s.parsedType
1324
+ }), m;
1325
+ }
1326
+ return b(e.data);
1327
+ }
1328
+ }
1329
+ he.create = (r) => new he({
1330
+ typeName: p.ZodSymbol,
1331
+ ...v(r)
1332
+ });
1333
+ class K extends _ {
1334
+ _parse(e) {
1335
+ if (this._getType(e) !== f.undefined) {
1336
+ const s = this._getOrReturnCtx(e);
1337
+ return u(s, {
1338
+ code: d.invalid_type,
1339
+ expected: f.undefined,
1340
+ received: s.parsedType
1341
+ }), m;
1342
+ }
1343
+ return b(e.data);
1344
+ }
1345
+ }
1346
+ K.create = (r) => new K({
1347
+ typeName: p.ZodUndefined,
1348
+ ...v(r)
1349
+ });
1350
+ class F extends _ {
1351
+ _parse(e) {
1352
+ if (this._getType(e) !== f.null) {
1353
+ const s = this._getOrReturnCtx(e);
1354
+ return u(s, {
1355
+ code: d.invalid_type,
1356
+ expected: f.null,
1357
+ received: s.parsedType
1358
+ }), m;
1359
+ }
1360
+ return b(e.data);
1361
+ }
1362
+ }
1363
+ F.create = (r) => new F({
1364
+ typeName: p.ZodNull,
1365
+ ...v(r)
1366
+ });
1367
+ class q extends _ {
1368
+ constructor() {
1369
+ super(...arguments), this._any = !0;
1370
+ }
1371
+ _parse(e) {
1372
+ return b(e.data);
1373
+ }
1374
+ }
1375
+ q.create = (r) => new q({
1376
+ typeName: p.ZodAny,
1377
+ ...v(r)
1378
+ });
1379
+ class V extends _ {
1380
+ constructor() {
1381
+ super(...arguments), this._unknown = !0;
1382
+ }
1383
+ _parse(e) {
1384
+ return b(e.data);
1385
+ }
1386
+ }
1387
+ V.create = (r) => new V({
1388
+ typeName: p.ZodUnknown,
1389
+ ...v(r)
1390
+ });
1391
+ class I extends _ {
1392
+ _parse(e) {
1393
+ const t = this._getOrReturnCtx(e);
1394
+ return u(t, {
1395
+ code: d.invalid_type,
1396
+ expected: f.never,
1397
+ received: t.parsedType
1398
+ }), m;
1399
+ }
1400
+ }
1401
+ I.create = (r) => new I({
1402
+ typeName: p.ZodNever,
1403
+ ...v(r)
1404
+ });
1405
+ class pe extends _ {
1406
+ _parse(e) {
1407
+ if (this._getType(e) !== f.undefined) {
1408
+ const s = this._getOrReturnCtx(e);
1409
+ return u(s, {
1410
+ code: d.invalid_type,
1411
+ expected: f.void,
1412
+ received: s.parsedType
1413
+ }), m;
1414
+ }
1415
+ return b(e.data);
1416
+ }
1417
+ }
1418
+ pe.create = (r) => new pe({
1419
+ typeName: p.ZodVoid,
1420
+ ...v(r)
1421
+ });
1422
+ class S extends _ {
1423
+ _parse(e) {
1424
+ const { ctx: t, status: s } = this._processInputParams(e), n = this._def;
1425
+ if (t.parsedType !== f.array)
1426
+ return u(t, {
1427
+ code: d.invalid_type,
1428
+ expected: f.array,
1429
+ received: t.parsedType
1430
+ }), m;
1431
+ if (n.exactLength !== null) {
1432
+ const i = t.data.length > n.exactLength.value, o = t.data.length < n.exactLength.value;
1433
+ (i || o) && (u(t, {
1434
+ code: i ? d.too_big : d.too_small,
1435
+ minimum: o ? n.exactLength.value : void 0,
1436
+ maximum: i ? n.exactLength.value : void 0,
1437
+ type: "array",
1438
+ inclusive: !0,
1439
+ exact: !0,
1440
+ message: n.exactLength.message
1441
+ }), s.dirty());
1442
+ }
1443
+ if (n.minLength !== null && t.data.length < n.minLength.value && (u(t, {
1444
+ code: d.too_small,
1445
+ minimum: n.minLength.value,
1446
+ type: "array",
1447
+ inclusive: !0,
1448
+ exact: !1,
1449
+ message: n.minLength.message
1450
+ }), s.dirty()), n.maxLength !== null && t.data.length > n.maxLength.value && (u(t, {
1451
+ code: d.too_big,
1452
+ maximum: n.maxLength.value,
1453
+ type: "array",
1454
+ inclusive: !0,
1455
+ exact: !1,
1456
+ message: n.maxLength.message
1457
+ }), s.dirty()), t.common.async)
1458
+ return Promise.all([...t.data].map((i, o) => n.type._parseAsync(new O(t, i, t.path, o)))).then((i) => k.mergeArray(s, i));
1459
+ const a = [...t.data].map((i, o) => n.type._parseSync(new O(t, i, t.path, o)));
1460
+ return k.mergeArray(s, a);
1461
+ }
1462
+ get element() {
1463
+ return this._def.type;
1464
+ }
1465
+ min(e, t) {
1466
+ return new S({
1467
+ ...this._def,
1468
+ minLength: { value: e, message: h.toString(t) }
1469
+ });
1470
+ }
1471
+ max(e, t) {
1472
+ return new S({
1473
+ ...this._def,
1474
+ maxLength: { value: e, message: h.toString(t) }
1475
+ });
1476
+ }
1477
+ length(e, t) {
1478
+ return new S({
1479
+ ...this._def,
1480
+ exactLength: { value: e, message: h.toString(t) }
1481
+ });
1482
+ }
1483
+ nonempty(e) {
1484
+ return this.min(1, e);
1485
+ }
1486
+ }
1487
+ S.create = (r, e) => new S({
1488
+ type: r,
1489
+ minLength: null,
1490
+ maxLength: null,
1491
+ exactLength: null,
1492
+ typeName: p.ZodArray,
1493
+ ...v(e)
1494
+ });
1495
+ function z(r) {
1496
+ if (r instanceof x) {
1497
+ const e = {};
1498
+ for (const t in r.shape) {
1499
+ const s = r.shape[t];
1500
+ e[t] = N.create(z(s));
1501
+ }
1502
+ return new x({
1503
+ ...r._def,
1504
+ shape: () => e
1505
+ });
1506
+ } else return r instanceof S ? new S({
1507
+ ...r._def,
1508
+ type: z(r.element)
1509
+ }) : r instanceof N ? N.create(z(r.unwrap())) : r instanceof P ? P.create(z(r.unwrap())) : r instanceof E ? E.create(r.items.map((e) => z(e))) : r;
1510
+ }
1511
+ class x extends _ {
1512
+ constructor() {
1513
+ super(...arguments), this._cached = null, this.nonstrict = this.passthrough, this.augment = this.extend;
1514
+ }
1515
+ _getCached() {
1516
+ if (this._cached !== null)
1517
+ return this._cached;
1518
+ const e = this._def.shape(), t = g.objectKeys(e);
1519
+ return this._cached = { shape: e, keys: t };
1520
+ }
1521
+ _parse(e) {
1522
+ if (this._getType(e) !== f.object) {
1523
+ const c = this._getOrReturnCtx(e);
1524
+ return u(c, {
1525
+ code: d.invalid_type,
1526
+ expected: f.object,
1527
+ received: c.parsedType
1528
+ }), m;
1529
+ }
1530
+ const { status: s, ctx: n } = this._processInputParams(e), { shape: a, keys: i } = this._getCached(), o = [];
1531
+ if (!(this._def.catchall instanceof I && this._def.unknownKeys === "strip"))
1532
+ for (const c in n.data)
1533
+ i.includes(c) || o.push(c);
1534
+ const l = [];
1535
+ for (const c of i) {
1536
+ const y = a[c], T = n.data[c];
1537
+ l.push({
1538
+ key: { status: "valid", value: c },
1539
+ value: y._parse(new O(n, T, n.path, c)),
1540
+ alwaysSet: c in n.data
1541
+ });
1542
+ }
1543
+ if (this._def.catchall instanceof I) {
1544
+ const c = this._def.unknownKeys;
1545
+ if (c === "passthrough")
1546
+ for (const y of o)
1547
+ l.push({
1548
+ key: { status: "valid", value: y },
1549
+ value: { status: "valid", value: n.data[y] }
1550
+ });
1551
+ else if (c === "strict")
1552
+ o.length > 0 && (u(n, {
1553
+ code: d.unrecognized_keys,
1554
+ keys: o
1555
+ }), s.dirty());
1556
+ else if (c !== "strip") throw new Error("Internal ZodObject error: invalid unknownKeys value.");
1557
+ } else {
1558
+ const c = this._def.catchall;
1559
+ for (const y of o) {
1560
+ const T = n.data[y];
1561
+ l.push({
1562
+ key: { status: "valid", value: y },
1563
+ value: c._parse(
1564
+ new O(n, T, n.path, y)
1565
+ //, ctx.child(key), value, getParsedType(value)
1566
+ ),
1567
+ alwaysSet: y in n.data
1568
+ });
1569
+ }
1570
+ }
1571
+ return n.common.async ? Promise.resolve().then(async () => {
1572
+ const c = [];
1573
+ for (const y of l) {
1574
+ const T = await y.key, Ze = await y.value;
1575
+ c.push({
1576
+ key: T,
1577
+ value: Ze,
1578
+ alwaysSet: y.alwaysSet
1579
+ });
1580
+ }
1581
+ return c;
1582
+ }).then((c) => k.mergeObjectSync(s, c)) : k.mergeObjectSync(s, l);
1583
+ }
1584
+ get shape() {
1585
+ return this._def.shape();
1586
+ }
1587
+ strict(e) {
1588
+ return h.errToObj, new x({
1589
+ ...this._def,
1590
+ unknownKeys: "strict",
1591
+ ...e !== void 0 ? {
1592
+ errorMap: (t, s) => {
1593
+ var n, a, i, o;
1594
+ const l = (i = (a = (n = this._def).errorMap) === null || a === void 0 ? void 0 : a.call(n, t, s).message) !== null && i !== void 0 ? i : s.defaultError;
1595
+ return t.code === "unrecognized_keys" ? {
1596
+ message: (o = h.errToObj(e).message) !== null && o !== void 0 ? o : l
1597
+ } : {
1598
+ message: l
1599
+ };
1600
+ }
1601
+ } : {}
1602
+ });
1603
+ }
1604
+ strip() {
1605
+ return new x({
1606
+ ...this._def,
1607
+ unknownKeys: "strip"
1608
+ });
1609
+ }
1610
+ passthrough() {
1611
+ return new x({
1612
+ ...this._def,
1613
+ unknownKeys: "passthrough"
1614
+ });
1615
+ }
1616
+ // const AugmentFactory =
1617
+ // <Def extends ZodObjectDef>(def: Def) =>
1618
+ // <Augmentation extends ZodRawShape>(
1619
+ // augmentation: Augmentation
1620
+ // ): ZodObject<
1621
+ // extendShape<ReturnType<Def["shape"]>, Augmentation>,
1622
+ // Def["unknownKeys"],
1623
+ // Def["catchall"]
1624
+ // > => {
1625
+ // return new ZodObject({
1626
+ // ...def,
1627
+ // shape: () => ({
1628
+ // ...def.shape(),
1629
+ // ...augmentation,
1630
+ // }),
1631
+ // }) as any;
1632
+ // };
1633
+ extend(e) {
1634
+ return new x({
1635
+ ...this._def,
1636
+ shape: () => ({
1637
+ ...this._def.shape(),
1638
+ ...e
1639
+ })
1640
+ });
1641
+ }
1642
+ /**
1643
+ * Prior to zod@1.0.12 there was a bug in the
1644
+ * inferred type of merged objects. Please
1645
+ * upgrade if you are experiencing issues.
1646
+ */
1647
+ merge(e) {
1648
+ return new x({
1649
+ unknownKeys: e._def.unknownKeys,
1650
+ catchall: e._def.catchall,
1651
+ shape: () => ({
1652
+ ...this._def.shape(),
1653
+ ...e._def.shape()
1654
+ }),
1655
+ typeName: p.ZodObject
1656
+ });
1657
+ }
1658
+ // merge<
1659
+ // Incoming extends AnyZodObject,
1660
+ // Augmentation extends Incoming["shape"],
1661
+ // NewOutput extends {
1662
+ // [k in keyof Augmentation | keyof Output]: k extends keyof Augmentation
1663
+ // ? Augmentation[k]["_output"]
1664
+ // : k extends keyof Output
1665
+ // ? Output[k]
1666
+ // : never;
1667
+ // },
1668
+ // NewInput extends {
1669
+ // [k in keyof Augmentation | keyof Input]: k extends keyof Augmentation
1670
+ // ? Augmentation[k]["_input"]
1671
+ // : k extends keyof Input
1672
+ // ? Input[k]
1673
+ // : never;
1674
+ // }
1675
+ // >(
1676
+ // merging: Incoming
1677
+ // ): ZodObject<
1678
+ // extendShape<T, ReturnType<Incoming["_def"]["shape"]>>,
1679
+ // Incoming["_def"]["unknownKeys"],
1680
+ // Incoming["_def"]["catchall"],
1681
+ // NewOutput,
1682
+ // NewInput
1683
+ // > {
1684
+ // const merged: any = new ZodObject({
1685
+ // unknownKeys: merging._def.unknownKeys,
1686
+ // catchall: merging._def.catchall,
1687
+ // shape: () =>
1688
+ // objectUtil.mergeShapes(this._def.shape(), merging._def.shape()),
1689
+ // typeName: ZodFirstPartyTypeKind.ZodObject,
1690
+ // }) as any;
1691
+ // return merged;
1692
+ // }
1693
+ setKey(e, t) {
1694
+ return this.augment({ [e]: t });
1695
+ }
1696
+ // merge<Incoming extends AnyZodObject>(
1697
+ // merging: Incoming
1698
+ // ): //ZodObject<T & Incoming["_shape"], UnknownKeys, Catchall> = (merging) => {
1699
+ // ZodObject<
1700
+ // extendShape<T, ReturnType<Incoming["_def"]["shape"]>>,
1701
+ // Incoming["_def"]["unknownKeys"],
1702
+ // Incoming["_def"]["catchall"]
1703
+ // > {
1704
+ // // const mergedShape = objectUtil.mergeShapes(
1705
+ // // this._def.shape(),
1706
+ // // merging._def.shape()
1707
+ // // );
1708
+ // const merged: any = new ZodObject({
1709
+ // unknownKeys: merging._def.unknownKeys,
1710
+ // catchall: merging._def.catchall,
1711
+ // shape: () =>
1712
+ // objectUtil.mergeShapes(this._def.shape(), merging._def.shape()),
1713
+ // typeName: ZodFirstPartyTypeKind.ZodObject,
1714
+ // }) as any;
1715
+ // return merged;
1716
+ // }
1717
+ catchall(e) {
1718
+ return new x({
1719
+ ...this._def,
1720
+ catchall: e
1721
+ });
1722
+ }
1723
+ pick(e) {
1724
+ const t = {};
1725
+ return g.objectKeys(e).forEach((s) => {
1726
+ e[s] && this.shape[s] && (t[s] = this.shape[s]);
1727
+ }), new x({
1728
+ ...this._def,
1729
+ shape: () => t
1730
+ });
1731
+ }
1732
+ omit(e) {
1733
+ const t = {};
1734
+ return g.objectKeys(this.shape).forEach((s) => {
1735
+ e[s] || (t[s] = this.shape[s]);
1736
+ }), new x({
1737
+ ...this._def,
1738
+ shape: () => t
1739
+ });
1740
+ }
1741
+ /**
1742
+ * @deprecated
1743
+ */
1744
+ deepPartial() {
1745
+ return z(this);
1746
+ }
1747
+ partial(e) {
1748
+ const t = {};
1749
+ return g.objectKeys(this.shape).forEach((s) => {
1750
+ const n = this.shape[s];
1751
+ e && !e[s] ? t[s] = n : t[s] = n.optional();
1752
+ }), new x({
1753
+ ...this._def,
1754
+ shape: () => t
1755
+ });
1756
+ }
1757
+ required(e) {
1758
+ const t = {};
1759
+ return g.objectKeys(this.shape).forEach((s) => {
1760
+ if (e && !e[s])
1761
+ t[s] = this.shape[s];
1762
+ else {
1763
+ let a = this.shape[s];
1764
+ for (; a instanceof N; )
1765
+ a = a._def.innerType;
1766
+ t[s] = a;
1767
+ }
1768
+ }), new x({
1769
+ ...this._def,
1770
+ shape: () => t
1771
+ });
1772
+ }
1773
+ keyof() {
1774
+ return je(g.objectKeys(this.shape));
1775
+ }
1776
+ }
1777
+ x.create = (r, e) => new x({
1778
+ shape: () => r,
1779
+ unknownKeys: "strip",
1780
+ catchall: I.create(),
1781
+ typeName: p.ZodObject,
1782
+ ...v(e)
1783
+ });
1784
+ x.strictCreate = (r, e) => new x({
1785
+ shape: () => r,
1786
+ unknownKeys: "strict",
1787
+ catchall: I.create(),
1788
+ typeName: p.ZodObject,
1789
+ ...v(e)
1790
+ });
1791
+ x.lazycreate = (r, e) => new x({
1792
+ shape: r,
1793
+ unknownKeys: "strip",
1794
+ catchall: I.create(),
1795
+ typeName: p.ZodObject,
1796
+ ...v(e)
1797
+ });
1798
+ class ee extends _ {
1799
+ _parse(e) {
1800
+ const { ctx: t } = this._processInputParams(e), s = this._def.options;
1801
+ function n(a) {
1802
+ for (const o of a)
1803
+ if (o.result.status === "valid")
1804
+ return o.result;
1805
+ for (const o of a)
1806
+ if (o.result.status === "dirty")
1807
+ return t.common.issues.push(...o.ctx.common.issues), o.result;
1808
+ const i = a.map((o) => new w(o.ctx.common.issues));
1809
+ return u(t, {
1810
+ code: d.invalid_union,
1811
+ unionErrors: i
1812
+ }), m;
1813
+ }
1814
+ if (t.common.async)
1815
+ return Promise.all(s.map(async (a) => {
1816
+ const i = {
1817
+ ...t,
1818
+ common: {
1819
+ ...t.common,
1820
+ issues: []
1821
+ },
1822
+ parent: null
1823
+ };
1824
+ return {
1825
+ result: await a._parseAsync({
1826
+ data: t.data,
1827
+ path: t.path,
1828
+ parent: i
1829
+ }),
1830
+ ctx: i
1831
+ };
1832
+ })).then(n);
1833
+ {
1834
+ let a;
1835
+ const i = [];
1836
+ for (const l of s) {
1837
+ const c = {
1838
+ ...t,
1839
+ common: {
1840
+ ...t.common,
1841
+ issues: []
1842
+ },
1843
+ parent: null
1844
+ }, y = l._parseSync({
1845
+ data: t.data,
1846
+ path: t.path,
1847
+ parent: c
1848
+ });
1849
+ if (y.status === "valid")
1850
+ return y;
1851
+ y.status === "dirty" && !a && (a = { result: y, ctx: c }), c.common.issues.length && i.push(c.common.issues);
1852
+ }
1853
+ if (a)
1854
+ return t.common.issues.push(...a.ctx.common.issues), a.result;
1855
+ const o = i.map((l) => new w(l));
1856
+ return u(t, {
1857
+ code: d.invalid_union,
1858
+ unionErrors: o
1859
+ }), m;
1860
+ }
1861
+ }
1862
+ get options() {
1863
+ return this._def.options;
1864
+ }
1865
+ }
1866
+ ee.create = (r, e) => new ee({
1867
+ options: r,
1868
+ typeName: p.ZodUnion,
1869
+ ...v(e)
1870
+ });
1871
+ const R = (r) => r instanceof se ? R(r.schema) : r instanceof C ? R(r.innerType()) : r instanceof ne ? [r.value] : r instanceof $ ? r.options : r instanceof ae ? g.objectValues(r.enum) : r instanceof ie ? R(r._def.innerType) : r instanceof K ? [void 0] : r instanceof F ? [null] : r instanceof N ? [void 0, ...R(r.unwrap())] : r instanceof P ? [null, ...R(r.unwrap())] : r instanceof Te || r instanceof de ? R(r.unwrap()) : r instanceof oe ? R(r._def.innerType) : [];
1872
+ class ve extends _ {
1873
+ _parse(e) {
1874
+ const { ctx: t } = this._processInputParams(e);
1875
+ if (t.parsedType !== f.object)
1876
+ return u(t, {
1877
+ code: d.invalid_type,
1878
+ expected: f.object,
1879
+ received: t.parsedType
1880
+ }), m;
1881
+ const s = this.discriminator, n = t.data[s], a = this.optionsMap.get(n);
1882
+ return a ? t.common.async ? a._parseAsync({
1883
+ data: t.data,
1884
+ path: t.path,
1885
+ parent: t
1886
+ }) : a._parseSync({
1887
+ data: t.data,
1888
+ path: t.path,
1889
+ parent: t
1890
+ }) : (u(t, {
1891
+ code: d.invalid_union_discriminator,
1892
+ options: Array.from(this.optionsMap.keys()),
1893
+ path: [s]
1894
+ }), m);
1895
+ }
1896
+ get discriminator() {
1897
+ return this._def.discriminator;
1898
+ }
1899
+ get options() {
1900
+ return this._def.options;
1901
+ }
1902
+ get optionsMap() {
1903
+ return this._def.optionsMap;
1904
+ }
1905
+ /**
1906
+ * The constructor of the discriminated union schema. Its behaviour is very similar to that of the normal z.union() constructor.
1907
+ * However, it only allows a union of objects, all of which need to share a discriminator property. This property must
1908
+ * have a different value for each object in the union.
1909
+ * @param discriminator the name of the discriminator property
1910
+ * @param types an array of object schemas
1911
+ * @param params
1912
+ */
1913
+ static create(e, t, s) {
1914
+ const n = /* @__PURE__ */ new Map();
1915
+ for (const a of t) {
1916
+ const i = R(a.shape[e]);
1917
+ if (!i.length)
1918
+ throw new Error(`A discriminator value for key \`${e}\` could not be extracted from all schema options`);
1919
+ for (const o of i) {
1920
+ if (n.has(o))
1921
+ throw new Error(`Discriminator property ${String(e)} has duplicate value ${String(o)}`);
1922
+ n.set(o, a);
1923
+ }
1924
+ }
1925
+ return new ve({
1926
+ typeName: p.ZodDiscriminatedUnion,
1927
+ discriminator: e,
1928
+ options: t,
1929
+ optionsMap: n,
1930
+ ...v(s)
1931
+ });
1932
+ }
1933
+ }
1934
+ function we(r, e) {
1935
+ const t = j(r), s = j(e);
1936
+ if (r === e)
1937
+ return { valid: !0, data: r };
1938
+ if (t === f.object && s === f.object) {
1939
+ const n = g.objectKeys(e), a = g.objectKeys(r).filter((o) => n.indexOf(o) !== -1), i = { ...r, ...e };
1940
+ for (const o of a) {
1941
+ const l = we(r[o], e[o]);
1942
+ if (!l.valid)
1943
+ return { valid: !1 };
1944
+ i[o] = l.data;
1945
+ }
1946
+ return { valid: !0, data: i };
1947
+ } else if (t === f.array && s === f.array) {
1948
+ if (r.length !== e.length)
1949
+ return { valid: !1 };
1950
+ const n = [];
1951
+ for (let a = 0; a < r.length; a++) {
1952
+ const i = r[a], o = e[a], l = we(i, o);
1953
+ if (!l.valid)
1954
+ return { valid: !1 };
1955
+ n.push(l.data);
1956
+ }
1957
+ return { valid: !0, data: n };
1958
+ } else return t === f.date && s === f.date && +r == +e ? { valid: !0, data: r } : { valid: !1 };
1959
+ }
1960
+ class te extends _ {
1961
+ _parse(e) {
1962
+ const { status: t, ctx: s } = this._processInputParams(e), n = (a, i) => {
1963
+ if (ke(a) || ke(i))
1964
+ return m;
1965
+ const o = we(a.value, i.value);
1966
+ return o.valid ? ((be(a) || be(i)) && t.dirty(), { status: t.value, value: o.data }) : (u(s, {
1967
+ code: d.invalid_intersection_types
1968
+ }), m);
1969
+ };
1970
+ return s.common.async ? Promise.all([
1971
+ this._def.left._parseAsync({
1972
+ data: s.data,
1973
+ path: s.path,
1974
+ parent: s
1975
+ }),
1976
+ this._def.right._parseAsync({
1977
+ data: s.data,
1978
+ path: s.path,
1979
+ parent: s
1980
+ })
1981
+ ]).then(([a, i]) => n(a, i)) : n(this._def.left._parseSync({
1982
+ data: s.data,
1983
+ path: s.path,
1984
+ parent: s
1985
+ }), this._def.right._parseSync({
1986
+ data: s.data,
1987
+ path: s.path,
1988
+ parent: s
1989
+ }));
1990
+ }
1991
+ }
1992
+ te.create = (r, e, t) => new te({
1993
+ left: r,
1994
+ right: e,
1995
+ typeName: p.ZodIntersection,
1996
+ ...v(t)
1997
+ });
1998
+ class E extends _ {
1999
+ _parse(e) {
2000
+ const { status: t, ctx: s } = this._processInputParams(e);
2001
+ if (s.parsedType !== f.array)
2002
+ return u(s, {
2003
+ code: d.invalid_type,
2004
+ expected: f.array,
2005
+ received: s.parsedType
2006
+ }), m;
2007
+ if (s.data.length < this._def.items.length)
2008
+ return u(s, {
2009
+ code: d.too_small,
2010
+ minimum: this._def.items.length,
2011
+ inclusive: !0,
2012
+ exact: !1,
2013
+ type: "array"
2014
+ }), m;
2015
+ !this._def.rest && s.data.length > this._def.items.length && (u(s, {
2016
+ code: d.too_big,
2017
+ maximum: this._def.items.length,
2018
+ inclusive: !0,
2019
+ exact: !1,
2020
+ type: "array"
2021
+ }), t.dirty());
2022
+ const a = [...s.data].map((i, o) => {
2023
+ const l = this._def.items[o] || this._def.rest;
2024
+ return l ? l._parse(new O(s, i, s.path, o)) : null;
2025
+ }).filter((i) => !!i);
2026
+ return s.common.async ? Promise.all(a).then((i) => k.mergeArray(t, i)) : k.mergeArray(t, a);
2027
+ }
2028
+ get items() {
2029
+ return this._def.items;
2030
+ }
2031
+ rest(e) {
2032
+ return new E({
2033
+ ...this._def,
2034
+ rest: e
2035
+ });
2036
+ }
2037
+ }
2038
+ E.create = (r, e) => {
2039
+ if (!Array.isArray(r))
2040
+ throw new Error("You must pass an array of schemas to z.tuple([ ... ])");
2041
+ return new E({
2042
+ items: r,
2043
+ typeName: p.ZodTuple,
2044
+ rest: null,
2045
+ ...v(e)
2046
+ });
2047
+ };
2048
+ class re extends _ {
2049
+ get keySchema() {
2050
+ return this._def.keyType;
2051
+ }
2052
+ get valueSchema() {
2053
+ return this._def.valueType;
2054
+ }
2055
+ _parse(e) {
2056
+ const { status: t, ctx: s } = this._processInputParams(e);
2057
+ if (s.parsedType !== f.object)
2058
+ return u(s, {
2059
+ code: d.invalid_type,
2060
+ expected: f.object,
2061
+ received: s.parsedType
2062
+ }), m;
2063
+ const n = [], a = this._def.keyType, i = this._def.valueType;
2064
+ for (const o in s.data)
2065
+ n.push({
2066
+ key: a._parse(new O(s, o, s.path, o)),
2067
+ value: i._parse(new O(s, s.data[o], s.path, o)),
2068
+ alwaysSet: o in s.data
2069
+ });
2070
+ return s.common.async ? k.mergeObjectAsync(t, n) : k.mergeObjectSync(t, n);
2071
+ }
2072
+ get element() {
2073
+ return this._def.valueType;
2074
+ }
2075
+ static create(e, t, s) {
2076
+ return t instanceof _ ? new re({
2077
+ keyType: e,
2078
+ valueType: t,
2079
+ typeName: p.ZodRecord,
2080
+ ...v(s)
2081
+ }) : new re({
2082
+ keyType: Z.create(),
2083
+ valueType: e,
2084
+ typeName: p.ZodRecord,
2085
+ ...v(t)
2086
+ });
2087
+ }
2088
+ }
2089
+ class me extends _ {
2090
+ get keySchema() {
2091
+ return this._def.keyType;
2092
+ }
2093
+ get valueSchema() {
2094
+ return this._def.valueType;
2095
+ }
2096
+ _parse(e) {
2097
+ const { status: t, ctx: s } = this._processInputParams(e);
2098
+ if (s.parsedType !== f.map)
2099
+ return u(s, {
2100
+ code: d.invalid_type,
2101
+ expected: f.map,
2102
+ received: s.parsedType
2103
+ }), m;
2104
+ const n = this._def.keyType, a = this._def.valueType, i = [...s.data.entries()].map(([o, l], c) => ({
2105
+ key: n._parse(new O(s, o, s.path, [c, "key"])),
2106
+ value: a._parse(new O(s, l, s.path, [c, "value"]))
2107
+ }));
2108
+ if (s.common.async) {
2109
+ const o = /* @__PURE__ */ new Map();
2110
+ return Promise.resolve().then(async () => {
2111
+ for (const l of i) {
2112
+ const c = await l.key, y = await l.value;
2113
+ if (c.status === "aborted" || y.status === "aborted")
2114
+ return m;
2115
+ (c.status === "dirty" || y.status === "dirty") && t.dirty(), o.set(c.value, y.value);
2116
+ }
2117
+ return { status: t.value, value: o };
2118
+ });
2119
+ } else {
2120
+ const o = /* @__PURE__ */ new Map();
2121
+ for (const l of i) {
2122
+ const c = l.key, y = l.value;
2123
+ if (c.status === "aborted" || y.status === "aborted")
2124
+ return m;
2125
+ (c.status === "dirty" || y.status === "dirty") && t.dirty(), o.set(c.value, y.value);
2126
+ }
2127
+ return { status: t.value, value: o };
2128
+ }
2129
+ }
2130
+ }
2131
+ me.create = (r, e, t) => new me({
2132
+ valueType: e,
2133
+ keyType: r,
2134
+ typeName: p.ZodMap,
2135
+ ...v(t)
2136
+ });
2137
+ class L extends _ {
2138
+ _parse(e) {
2139
+ const { status: t, ctx: s } = this._processInputParams(e);
2140
+ if (s.parsedType !== f.set)
2141
+ return u(s, {
2142
+ code: d.invalid_type,
2143
+ expected: f.set,
2144
+ received: s.parsedType
2145
+ }), m;
2146
+ const n = this._def;
2147
+ n.minSize !== null && s.data.size < n.minSize.value && (u(s, {
2148
+ code: d.too_small,
2149
+ minimum: n.minSize.value,
2150
+ type: "set",
2151
+ inclusive: !0,
2152
+ exact: !1,
2153
+ message: n.minSize.message
2154
+ }), t.dirty()), n.maxSize !== null && s.data.size > n.maxSize.value && (u(s, {
2155
+ code: d.too_big,
2156
+ maximum: n.maxSize.value,
2157
+ type: "set",
2158
+ inclusive: !0,
2159
+ exact: !1,
2160
+ message: n.maxSize.message
2161
+ }), t.dirty());
2162
+ const a = this._def.valueType;
2163
+ function i(l) {
2164
+ const c = /* @__PURE__ */ new Set();
2165
+ for (const y of l) {
2166
+ if (y.status === "aborted")
2167
+ return m;
2168
+ y.status === "dirty" && t.dirty(), c.add(y.value);
2169
+ }
2170
+ return { status: t.value, value: c };
2171
+ }
2172
+ const o = [...s.data.values()].map((l, c) => a._parse(new O(s, l, s.path, c)));
2173
+ return s.common.async ? Promise.all(o).then((l) => i(l)) : i(o);
2174
+ }
2175
+ min(e, t) {
2176
+ return new L({
2177
+ ...this._def,
2178
+ minSize: { value: e, message: h.toString(t) }
2179
+ });
2180
+ }
2181
+ max(e, t) {
2182
+ return new L({
2183
+ ...this._def,
2184
+ maxSize: { value: e, message: h.toString(t) }
2185
+ });
2186
+ }
2187
+ size(e, t) {
2188
+ return this.min(e, t).max(e, t);
2189
+ }
2190
+ nonempty(e) {
2191
+ return this.min(1, e);
2192
+ }
2193
+ }
2194
+ L.create = (r, e) => new L({
2195
+ valueType: r,
2196
+ minSize: null,
2197
+ maxSize: null,
2198
+ typeName: p.ZodSet,
2199
+ ...v(e)
2200
+ });
2201
+ class B extends _ {
2202
+ constructor() {
2203
+ super(...arguments), this.validate = this.implement;
2204
+ }
2205
+ _parse(e) {
2206
+ const { ctx: t } = this._processInputParams(e);
2207
+ if (t.parsedType !== f.function)
2208
+ return u(t, {
2209
+ code: d.invalid_type,
2210
+ expected: f.function,
2211
+ received: t.parsedType
2212
+ }), m;
2213
+ function s(o, l) {
2214
+ return le({
2215
+ data: o,
2216
+ path: t.path,
2217
+ errorMaps: [
2218
+ t.common.contextualErrorMap,
2219
+ t.schemaErrorMap,
2220
+ ue(),
2221
+ W
2222
+ ].filter((c) => !!c),
2223
+ issueData: {
2224
+ code: d.invalid_arguments,
2225
+ argumentsError: l
2226
+ }
2227
+ });
2228
+ }
2229
+ function n(o, l) {
2230
+ return le({
2231
+ data: o,
2232
+ path: t.path,
2233
+ errorMaps: [
2234
+ t.common.contextualErrorMap,
2235
+ t.schemaErrorMap,
2236
+ ue(),
2237
+ W
2238
+ ].filter((c) => !!c),
2239
+ issueData: {
2240
+ code: d.invalid_return_type,
2241
+ returnTypeError: l
2242
+ }
2243
+ });
2244
+ }
2245
+ const a = { errorMap: t.common.contextualErrorMap }, i = t.data;
2246
+ if (this._def.returns instanceof Y) {
2247
+ const o = this;
2248
+ return b(async function(...l) {
2249
+ const c = new w([]), y = await o._def.args.parseAsync(l, a).catch((_e) => {
2250
+ throw c.addIssue(s(l, _e)), c;
2251
+ }), T = await Reflect.apply(i, this, y);
2252
+ return await o._def.returns._def.type.parseAsync(T, a).catch((_e) => {
2253
+ throw c.addIssue(n(T, _e)), c;
2254
+ });
2255
+ });
2256
+ } else {
2257
+ const o = this;
2258
+ return b(function(...l) {
2259
+ const c = o._def.args.safeParse(l, a);
2260
+ if (!c.success)
2261
+ throw new w([s(l, c.error)]);
2262
+ const y = Reflect.apply(i, this, c.data), T = o._def.returns.safeParse(y, a);
2263
+ if (!T.success)
2264
+ throw new w([n(y, T.error)]);
2265
+ return T.data;
2266
+ });
2267
+ }
2268
+ }
2269
+ parameters() {
2270
+ return this._def.args;
2271
+ }
2272
+ returnType() {
2273
+ return this._def.returns;
2274
+ }
2275
+ args(...e) {
2276
+ return new B({
2277
+ ...this._def,
2278
+ args: E.create(e).rest(V.create())
2279
+ });
2280
+ }
2281
+ returns(e) {
2282
+ return new B({
2283
+ ...this._def,
2284
+ returns: e
2285
+ });
2286
+ }
2287
+ implement(e) {
2288
+ return this.parse(e);
2289
+ }
2290
+ strictImplement(e) {
2291
+ return this.parse(e);
2292
+ }
2293
+ static create(e, t, s) {
2294
+ return new B({
2295
+ args: e || E.create([]).rest(V.create()),
2296
+ returns: t || V.create(),
2297
+ typeName: p.ZodFunction,
2298
+ ...v(s)
2299
+ });
2300
+ }
2301
+ }
2302
+ class se extends _ {
2303
+ get schema() {
2304
+ return this._def.getter();
2305
+ }
2306
+ _parse(e) {
2307
+ const { ctx: t } = this._processInputParams(e);
2308
+ return this._def.getter()._parse({ data: t.data, path: t.path, parent: t });
2309
+ }
2310
+ }
2311
+ se.create = (r, e) => new se({
2312
+ getter: r,
2313
+ typeName: p.ZodLazy,
2314
+ ...v(e)
2315
+ });
2316
+ class ne extends _ {
2317
+ _parse(e) {
2318
+ if (e.data !== this._def.value) {
2319
+ const t = this._getOrReturnCtx(e);
2320
+ return u(t, {
2321
+ received: t.data,
2322
+ code: d.invalid_literal,
2323
+ expected: this._def.value
2324
+ }), m;
2325
+ }
2326
+ return { status: "valid", value: e.data };
2327
+ }
2328
+ get value() {
2329
+ return this._def.value;
2330
+ }
2331
+ }
2332
+ ne.create = (r, e) => new ne({
2333
+ value: r,
2334
+ typeName: p.ZodLiteral,
2335
+ ...v(e)
2336
+ });
2337
+ function je(r, e) {
2338
+ return new $({
2339
+ values: r,
2340
+ typeName: p.ZodEnum,
2341
+ ...v(e)
2342
+ });
2343
+ }
2344
+ class $ extends _ {
2345
+ constructor() {
2346
+ super(...arguments), J.set(this, void 0);
2347
+ }
2348
+ _parse(e) {
2349
+ if (typeof e.data != "string") {
2350
+ const t = this._getOrReturnCtx(e), s = this._def.values;
2351
+ return u(t, {
2352
+ expected: g.joinValues(s),
2353
+ received: t.parsedType,
2354
+ code: d.invalid_type
2355
+ }), m;
2356
+ }
2357
+ if (fe(this, J) || Oe(this, J, new Set(this._def.values)), !fe(this, J).has(e.data)) {
2358
+ const t = this._getOrReturnCtx(e), s = this._def.values;
2359
+ return u(t, {
2360
+ received: t.data,
2361
+ code: d.invalid_enum_value,
2362
+ options: s
2363
+ }), m;
2364
+ }
2365
+ return b(e.data);
2366
+ }
2367
+ get options() {
2368
+ return this._def.values;
2369
+ }
2370
+ get enum() {
2371
+ const e = {};
2372
+ for (const t of this._def.values)
2373
+ e[t] = t;
2374
+ return e;
2375
+ }
2376
+ get Values() {
2377
+ const e = {};
2378
+ for (const t of this._def.values)
2379
+ e[t] = t;
2380
+ return e;
2381
+ }
2382
+ get Enum() {
2383
+ const e = {};
2384
+ for (const t of this._def.values)
2385
+ e[t] = t;
2386
+ return e;
2387
+ }
2388
+ extract(e, t = this._def) {
2389
+ return $.create(e, {
2390
+ ...this._def,
2391
+ ...t
2392
+ });
2393
+ }
2394
+ exclude(e, t = this._def) {
2395
+ return $.create(this.options.filter((s) => !e.includes(s)), {
2396
+ ...this._def,
2397
+ ...t
2398
+ });
2399
+ }
2400
+ }
2401
+ J = /* @__PURE__ */ new WeakMap();
2402
+ $.create = je;
2403
+ class ae extends _ {
2404
+ constructor() {
2405
+ super(...arguments), H.set(this, void 0);
2406
+ }
2407
+ _parse(e) {
2408
+ const t = g.getValidEnumValues(this._def.values), s = this._getOrReturnCtx(e);
2409
+ if (s.parsedType !== f.string && s.parsedType !== f.number) {
2410
+ const n = g.objectValues(t);
2411
+ return u(s, {
2412
+ expected: g.joinValues(n),
2413
+ received: s.parsedType,
2414
+ code: d.invalid_type
2415
+ }), m;
2416
+ }
2417
+ if (fe(this, H) || Oe(this, H, new Set(g.getValidEnumValues(this._def.values))), !fe(this, H).has(e.data)) {
2418
+ const n = g.objectValues(t);
2419
+ return u(s, {
2420
+ received: s.data,
2421
+ code: d.invalid_enum_value,
2422
+ options: n
2423
+ }), m;
2424
+ }
2425
+ return b(e.data);
2426
+ }
2427
+ get enum() {
2428
+ return this._def.values;
2429
+ }
2430
+ }
2431
+ H = /* @__PURE__ */ new WeakMap();
2432
+ ae.create = (r, e) => new ae({
2433
+ values: r,
2434
+ typeName: p.ZodNativeEnum,
2435
+ ...v(e)
2436
+ });
2437
+ class Y extends _ {
2438
+ unwrap() {
2439
+ return this._def.type;
2440
+ }
2441
+ _parse(e) {
2442
+ const { ctx: t } = this._processInputParams(e);
2443
+ if (t.parsedType !== f.promise && t.common.async === !1)
2444
+ return u(t, {
2445
+ code: d.invalid_type,
2446
+ expected: f.promise,
2447
+ received: t.parsedType
2448
+ }), m;
2449
+ const s = t.parsedType === f.promise ? t.data : Promise.resolve(t.data);
2450
+ return b(s.then((n) => this._def.type.parseAsync(n, {
2451
+ path: t.path,
2452
+ errorMap: t.common.contextualErrorMap
2453
+ })));
2454
+ }
2455
+ }
2456
+ Y.create = (r, e) => new Y({
2457
+ type: r,
2458
+ typeName: p.ZodPromise,
2459
+ ...v(e)
2460
+ });
2461
+ class C extends _ {
2462
+ innerType() {
2463
+ return this._def.schema;
2464
+ }
2465
+ sourceType() {
2466
+ return this._def.schema._def.typeName === p.ZodEffects ? this._def.schema.sourceType() : this._def.schema;
2467
+ }
2468
+ _parse(e) {
2469
+ const { status: t, ctx: s } = this._processInputParams(e), n = this._def.effect || null, a = {
2470
+ addIssue: (i) => {
2471
+ u(s, i), i.fatal ? t.abort() : t.dirty();
2472
+ },
2473
+ get path() {
2474
+ return s.path;
2475
+ }
2476
+ };
2477
+ if (a.addIssue = a.addIssue.bind(a), n.type === "preprocess") {
2478
+ const i = n.transform(s.data, a);
2479
+ if (s.common.async)
2480
+ return Promise.resolve(i).then(async (o) => {
2481
+ if (t.value === "aborted")
2482
+ return m;
2483
+ const l = await this._def.schema._parseAsync({
2484
+ data: o,
2485
+ path: s.path,
2486
+ parent: s
2487
+ });
2488
+ return l.status === "aborted" ? m : l.status === "dirty" || t.value === "dirty" ? U(l.value) : l;
2489
+ });
2490
+ {
2491
+ if (t.value === "aborted")
2492
+ return m;
2493
+ const o = this._def.schema._parseSync({
2494
+ data: i,
2495
+ path: s.path,
2496
+ parent: s
2497
+ });
2498
+ return o.status === "aborted" ? m : o.status === "dirty" || t.value === "dirty" ? U(o.value) : o;
2499
+ }
2500
+ }
2501
+ if (n.type === "refinement") {
2502
+ const i = (o) => {
2503
+ const l = n.refinement(o, a);
2504
+ if (s.common.async)
2505
+ return Promise.resolve(l);
2506
+ if (l instanceof Promise)
2507
+ throw new Error("Async refinement encountered during synchronous parse operation. Use .parseAsync instead.");
2508
+ return o;
2509
+ };
2510
+ if (s.common.async === !1) {
2511
+ const o = this._def.schema._parseSync({
2512
+ data: s.data,
2513
+ path: s.path,
2514
+ parent: s
2515
+ });
2516
+ return o.status === "aborted" ? m : (o.status === "dirty" && t.dirty(), i(o.value), { status: t.value, value: o.value });
2517
+ } else
2518
+ return this._def.schema._parseAsync({ data: s.data, path: s.path, parent: s }).then((o) => o.status === "aborted" ? m : (o.status === "dirty" && t.dirty(), i(o.value).then(() => ({ status: t.value, value: o.value }))));
2519
+ }
2520
+ if (n.type === "transform")
2521
+ if (s.common.async === !1) {
2522
+ const i = this._def.schema._parseSync({
2523
+ data: s.data,
2524
+ path: s.path,
2525
+ parent: s
2526
+ });
2527
+ if (!G(i))
2528
+ return i;
2529
+ const o = n.transform(i.value, a);
2530
+ if (o instanceof Promise)
2531
+ throw new Error("Asynchronous transform encountered during synchronous parse operation. Use .parseAsync instead.");
2532
+ return { status: t.value, value: o };
2533
+ } else
2534
+ return this._def.schema._parseAsync({ data: s.data, path: s.path, parent: s }).then((i) => G(i) ? Promise.resolve(n.transform(i.value, a)).then((o) => ({ status: t.value, value: o })) : i);
2535
+ g.assertNever(n);
2536
+ }
2537
+ }
2538
+ C.create = (r, e, t) => new C({
2539
+ schema: r,
2540
+ typeName: p.ZodEffects,
2541
+ effect: e,
2542
+ ...v(t)
2543
+ });
2544
+ C.createWithPreprocess = (r, e, t) => new C({
2545
+ schema: e,
2546
+ effect: { type: "preprocess", transform: r },
2547
+ typeName: p.ZodEffects,
2548
+ ...v(t)
2549
+ });
2550
+ class N extends _ {
2551
+ _parse(e) {
2552
+ return this._getType(e) === f.undefined ? b(void 0) : this._def.innerType._parse(e);
2553
+ }
2554
+ unwrap() {
2555
+ return this._def.innerType;
2556
+ }
2557
+ }
2558
+ N.create = (r, e) => new N({
2559
+ innerType: r,
2560
+ typeName: p.ZodOptional,
2561
+ ...v(e)
2562
+ });
2563
+ class P extends _ {
2564
+ _parse(e) {
2565
+ return this._getType(e) === f.null ? b(null) : this._def.innerType._parse(e);
2566
+ }
2567
+ unwrap() {
2568
+ return this._def.innerType;
2569
+ }
2570
+ }
2571
+ P.create = (r, e) => new P({
2572
+ innerType: r,
2573
+ typeName: p.ZodNullable,
2574
+ ...v(e)
2575
+ });
2576
+ class ie extends _ {
2577
+ _parse(e) {
2578
+ const { ctx: t } = this._processInputParams(e);
2579
+ let s = t.data;
2580
+ return t.parsedType === f.undefined && (s = this._def.defaultValue()), this._def.innerType._parse({
2581
+ data: s,
2582
+ path: t.path,
2583
+ parent: t
2584
+ });
2585
+ }
2586
+ removeDefault() {
2587
+ return this._def.innerType;
2588
+ }
2589
+ }
2590
+ ie.create = (r, e) => new ie({
2591
+ innerType: r,
2592
+ typeName: p.ZodDefault,
2593
+ defaultValue: typeof e.default == "function" ? e.default : () => e.default,
2594
+ ...v(e)
2595
+ });
2596
+ class oe extends _ {
2597
+ _parse(e) {
2598
+ const { ctx: t } = this._processInputParams(e), s = {
2599
+ ...t,
2600
+ common: {
2601
+ ...t.common,
2602
+ issues: []
2603
+ }
2604
+ }, n = this._def.innerType._parse({
2605
+ data: s.data,
2606
+ path: s.path,
2607
+ parent: {
2608
+ ...s
2609
+ }
2610
+ });
2611
+ return X(n) ? n.then((a) => ({
2612
+ status: "valid",
2613
+ value: a.status === "valid" ? a.value : this._def.catchValue({
2614
+ get error() {
2615
+ return new w(s.common.issues);
2616
+ },
2617
+ input: s.data
2618
+ })
2619
+ })) : {
2620
+ status: "valid",
2621
+ value: n.status === "valid" ? n.value : this._def.catchValue({
2622
+ get error() {
2623
+ return new w(s.common.issues);
2624
+ },
2625
+ input: s.data
2626
+ })
2627
+ };
2628
+ }
2629
+ removeCatch() {
2630
+ return this._def.innerType;
2631
+ }
2632
+ }
2633
+ oe.create = (r, e) => new oe({
2634
+ innerType: r,
2635
+ typeName: p.ZodCatch,
2636
+ catchValue: typeof e.catch == "function" ? e.catch : () => e.catch,
2637
+ ...v(e)
2638
+ });
2639
+ class ye extends _ {
2640
+ _parse(e) {
2641
+ if (this._getType(e) !== f.nan) {
2642
+ const s = this._getOrReturnCtx(e);
2643
+ return u(s, {
2644
+ code: d.invalid_type,
2645
+ expected: f.nan,
2646
+ received: s.parsedType
2647
+ }), m;
2648
+ }
2649
+ return { status: "valid", value: e.data };
2650
+ }
2651
+ }
2652
+ ye.create = (r) => new ye({
2653
+ typeName: p.ZodNaN,
2654
+ ...v(r)
2655
+ });
2656
+ const rt = Symbol("zod_brand");
2657
+ class Te extends _ {
2658
+ _parse(e) {
2659
+ const { ctx: t } = this._processInputParams(e), s = t.data;
2660
+ return this._def.type._parse({
2661
+ data: s,
2662
+ path: t.path,
2663
+ parent: t
2664
+ });
2665
+ }
2666
+ unwrap() {
2667
+ return this._def.type;
2668
+ }
2669
+ }
2670
+ class ce extends _ {
2671
+ _parse(e) {
2672
+ const { status: t, ctx: s } = this._processInputParams(e);
2673
+ if (s.common.async)
2674
+ return (async () => {
2675
+ const a = await this._def.in._parseAsync({
2676
+ data: s.data,
2677
+ path: s.path,
2678
+ parent: s
2679
+ });
2680
+ return a.status === "aborted" ? m : a.status === "dirty" ? (t.dirty(), U(a.value)) : this._def.out._parseAsync({
2681
+ data: a.value,
2682
+ path: s.path,
2683
+ parent: s
2684
+ });
2685
+ })();
2686
+ {
2687
+ const n = this._def.in._parseSync({
2688
+ data: s.data,
2689
+ path: s.path,
2690
+ parent: s
2691
+ });
2692
+ return n.status === "aborted" ? m : n.status === "dirty" ? (t.dirty(), {
2693
+ status: "dirty",
2694
+ value: n.value
2695
+ }) : this._def.out._parseSync({
2696
+ data: n.value,
2697
+ path: s.path,
2698
+ parent: s
2699
+ });
2700
+ }
2701
+ }
2702
+ static create(e, t) {
2703
+ return new ce({
2704
+ in: e,
2705
+ out: t,
2706
+ typeName: p.ZodPipeline
2707
+ });
2708
+ }
2709
+ }
2710
+ class de extends _ {
2711
+ _parse(e) {
2712
+ const t = this._def.innerType._parse(e), s = (n) => (G(n) && (n.value = Object.freeze(n.value)), n);
2713
+ return X(t) ? t.then((n) => s(n)) : s(t);
2714
+ }
2715
+ unwrap() {
2716
+ return this._def.innerType;
2717
+ }
2718
+ }
2719
+ de.create = (r, e) => new de({
2720
+ innerType: r,
2721
+ typeName: p.ZodReadonly,
2722
+ ...v(e)
2723
+ });
2724
+ function Ae(r, e = {}, t) {
2725
+ return r ? q.create().superRefine((s, n) => {
2726
+ var a, i;
2727
+ if (!r(s)) {
2728
+ const o = typeof e == "function" ? e(s) : typeof e == "string" ? { message: e } : e, l = (i = (a = o.fatal) !== null && a !== void 0 ? a : t) !== null && i !== void 0 ? i : !0, c = typeof o == "string" ? { message: o } : o;
2729
+ n.addIssue({ code: "custom", ...c, fatal: l });
2730
+ }
2731
+ }) : q.create();
2732
+ }
2733
+ const st = {
2734
+ object: x.lazycreate
2735
+ };
2736
+ var p;
2737
+ (function(r) {
2738
+ 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";
2739
+ })(p || (p = {}));
2740
+ const nt = (r, e = {
2741
+ message: `Input not instance of ${r.name}`
2742
+ }) => Ae((t) => t instanceof r, e), Me = Z.create, $e = A.create, at = ye.create, it = M.create, Pe = Q.create, ot = D.create, dt = he.create, ct = K.create, ut = F.create, lt = q.create, ft = V.create, ht = I.create, pt = pe.create, mt = S.create, yt = x.create, vt = x.strictCreate, _t = ee.create, gt = ve.create, xt = te.create, kt = E.create, bt = re.create, wt = me.create, Tt = L.create, Zt = B.create, St = se.create, Ct = ne.create, Nt = $.create, Ot = ae.create, Et = Y.create, Ce = C.create, Rt = N.create, It = P.create, jt = C.createWithPreprocess, At = ce.create, Mt = () => Me().optional(), $t = () => $e().optional(), Pt = () => Pe().optional(), Vt = {
2743
+ string: (r) => Z.create({ ...r, coerce: !0 }),
2744
+ number: (r) => A.create({ ...r, coerce: !0 }),
2745
+ boolean: (r) => Q.create({
2746
+ ...r,
2747
+ coerce: !0
2748
+ }),
2749
+ bigint: (r) => M.create({ ...r, coerce: !0 }),
2750
+ date: (r) => D.create({ ...r, coerce: !0 })
2751
+ }, Dt = m;
2752
+ var zt = /* @__PURE__ */ Object.freeze({
2753
+ __proto__: null,
2754
+ defaultErrorMap: W,
2755
+ setErrorMap: De,
2756
+ getErrorMap: ue,
2757
+ makeIssue: le,
2758
+ EMPTY_PATH: Le,
2759
+ addIssueToContext: u,
2760
+ ParseStatus: k,
2761
+ INVALID: m,
2762
+ DIRTY: U,
2763
+ OK: b,
2764
+ isAborted: ke,
2765
+ isDirty: be,
2766
+ isValid: G,
2767
+ isAsync: X,
2768
+ get util() {
2769
+ return g;
2770
+ },
2771
+ get objectUtil() {
2772
+ return xe;
2773
+ },
2774
+ ZodParsedType: f,
2775
+ getParsedType: j,
2776
+ ZodType: _,
2777
+ datetimeRegex: Ie,
2778
+ ZodString: Z,
2779
+ ZodNumber: A,
2780
+ ZodBigInt: M,
2781
+ ZodBoolean: Q,
2782
+ ZodDate: D,
2783
+ ZodSymbol: he,
2784
+ ZodUndefined: K,
2785
+ ZodNull: F,
2786
+ ZodAny: q,
2787
+ ZodUnknown: V,
2788
+ ZodNever: I,
2789
+ ZodVoid: pe,
2790
+ ZodArray: S,
2791
+ ZodObject: x,
2792
+ ZodUnion: ee,
2793
+ ZodDiscriminatedUnion: ve,
2794
+ ZodIntersection: te,
2795
+ ZodTuple: E,
2796
+ ZodRecord: re,
2797
+ ZodMap: me,
2798
+ ZodSet: L,
2799
+ ZodFunction: B,
2800
+ ZodLazy: se,
2801
+ ZodLiteral: ne,
2802
+ ZodEnum: $,
2803
+ ZodNativeEnum: ae,
2804
+ ZodPromise: Y,
2805
+ ZodEffects: C,
2806
+ ZodTransformer: C,
2807
+ ZodOptional: N,
2808
+ ZodNullable: P,
2809
+ ZodDefault: ie,
2810
+ ZodCatch: oe,
2811
+ ZodNaN: ye,
2812
+ BRAND: rt,
2813
+ ZodBranded: Te,
2814
+ ZodPipeline: ce,
2815
+ ZodReadonly: de,
2816
+ custom: Ae,
2817
+ Schema: _,
2818
+ ZodSchema: _,
2819
+ late: st,
2820
+ get ZodFirstPartyTypeKind() {
2821
+ return p;
2822
+ },
2823
+ coerce: Vt,
2824
+ any: lt,
2825
+ array: mt,
2826
+ bigint: it,
2827
+ boolean: Pe,
2828
+ date: ot,
2829
+ discriminatedUnion: gt,
2830
+ effect: Ce,
2831
+ enum: Nt,
2832
+ function: Zt,
2833
+ instanceof: nt,
2834
+ intersection: xt,
2835
+ lazy: St,
2836
+ literal: Ct,
2837
+ map: wt,
2838
+ nan: at,
2839
+ nativeEnum: Ot,
2840
+ never: ht,
2841
+ null: ut,
2842
+ nullable: It,
2843
+ number: $e,
2844
+ object: yt,
2845
+ oboolean: Pt,
2846
+ onumber: $t,
2847
+ optional: Rt,
2848
+ ostring: Mt,
2849
+ pipeline: At,
2850
+ preprocess: jt,
2851
+ promise: Et,
2852
+ record: bt,
2853
+ set: Tt,
2854
+ strictObject: vt,
2855
+ string: Me,
2856
+ symbol: dt,
2857
+ transformer: Ce,
2858
+ tuple: kt,
2859
+ undefined: ct,
2860
+ union: _t,
2861
+ unknown: ft,
2862
+ void: pt,
2863
+ NEVER: Dt,
2864
+ ZodIssueCode: d,
2865
+ quotelessJson: Ve,
2866
+ ZodError: w
2867
+ });
2868
+ function Ut(...r) {
2869
+ return r.map((e) => function(t) {
2870
+ const { success: s, error: n } = e.safeParse(t);
2871
+ return s ? !0 : n.flatten().formErrors[0];
2872
+ });
2873
+ }
2874
+ export {
2875
+ zt as a,
2876
+ Ut as z
2877
+ };