@depup/miniflare 4.20260317.0-depup.0

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