@rspack/core 1.3.11 → 1.3.13

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 (136) hide show
  1. package/README.md +2 -2
  2. package/compiled/browserslist-load-config/index.d.ts +10 -0
  3. package/compiled/browserslist-load-config/index.js +266 -0
  4. package/compiled/browserslist-load-config/license +21 -0
  5. package/compiled/browserslist-load-config/package.json +1 -0
  6. package/compiled/watchpack/index.js +61 -19
  7. package/compiled/watchpack/package.json +1 -1
  8. package/compiled/webpack-sources/index.js +1539 -339
  9. package/compiled/webpack-sources/package.json +1 -1
  10. package/compiled/webpack-sources/types.d.ts +320 -0
  11. package/compiled/zod/dist/types/index.d.ts +3 -0
  12. package/compiled/zod/{lib → dist/types/v3}/ZodError.d.ts +7 -7
  13. package/compiled/zod/{lib → dist/types/v3}/errors.d.ts +2 -2
  14. package/compiled/zod/dist/types/v3/external.d.ts +6 -0
  15. package/compiled/zod/{lib → dist/types/v3}/helpers/errorUtil.d.ts +1 -1
  16. package/compiled/zod/{lib → dist/types/v3}/helpers/parseUtil.d.ts +4 -4
  17. package/compiled/zod/{lib → dist/types/v3}/helpers/partialUtil.d.ts +1 -1
  18. package/compiled/zod/{lib → dist/types/v3}/helpers/util.d.ts +12 -9
  19. package/compiled/zod/dist/types/v3/index.d.ts +4 -0
  20. package/compiled/zod/{lib → dist/types/v3}/locales/en.d.ts +1 -1
  21. package/compiled/zod/{lib/__tests__ → dist/types/v3/tests}/Mocker.d.ts +6 -6
  22. package/compiled/zod/{lib → dist/types/v3}/types.d.ts +118 -149
  23. package/compiled/zod/dist/types/v4/classic/checks.d.ts +1 -0
  24. package/compiled/zod/dist/types/v4/classic/coerce.d.ts +17 -0
  25. package/compiled/zod/dist/types/v4/classic/compat.d.ts +48 -0
  26. package/compiled/zod/dist/types/v4/classic/errors.d.ts +30 -0
  27. package/compiled/zod/dist/types/v4/classic/external.d.ts +8 -0
  28. package/compiled/zod/dist/types/v4/classic/index.d.ts +4 -0
  29. package/compiled/zod/dist/types/v4/classic/iso.d.ts +22 -0
  30. package/compiled/zod/dist/types/v4/classic/parse.d.ts +23 -0
  31. package/compiled/zod/dist/types/v4/classic/schemas.d.ts +661 -0
  32. package/compiled/zod/dist/types/v4/core/api.d.ts +273 -0
  33. package/compiled/zod/dist/types/v4/core/checks.d.ts +277 -0
  34. package/compiled/zod/dist/types/v4/core/config.d.ts +9 -0
  35. package/compiled/zod/dist/types/v4/core/core.d.ts +43 -0
  36. package/compiled/zod/dist/types/v4/core/doc.d.ts +14 -0
  37. package/compiled/zod/dist/types/v4/core/errors.d.ts +205 -0
  38. package/compiled/zod/dist/types/v4/core/function.d.ts +47 -0
  39. package/compiled/zod/dist/types/v4/core/index.d.ts +15 -0
  40. package/compiled/zod/dist/types/v4/core/json-schema.d.ts +100 -0
  41. package/compiled/zod/dist/types/v4/core/parse.d.ts +25 -0
  42. package/compiled/zod/dist/types/v4/core/regexes.d.ts +63 -0
  43. package/compiled/zod/dist/types/v4/core/registries.d.ts +32 -0
  44. package/compiled/zod/dist/types/v4/core/schemas.d.ts +983 -0
  45. package/compiled/zod/dist/types/v4/core/standard-schema.d.ts +55 -0
  46. package/compiled/zod/dist/types/v4/core/to-json-schema.d.ts +84 -0
  47. package/compiled/zod/dist/types/v4/core/util.d.ts +186 -0
  48. package/compiled/zod/dist/types/v4/core/versions.d.ts +5 -0
  49. package/compiled/zod/dist/types/v4/core/zsf.d.ts +91 -0
  50. package/compiled/zod/dist/types/v4/index.d.ts +3 -0
  51. package/compiled/zod/dist/types/v4/locales/ar.d.ts +7 -0
  52. package/compiled/zod/dist/types/v4/locales/az.d.ts +7 -0
  53. package/compiled/zod/dist/types/v4/locales/be.d.ts +7 -0
  54. package/compiled/zod/dist/types/v4/locales/ca.d.ts +7 -0
  55. package/compiled/zod/dist/types/v4/locales/cs.d.ts +7 -0
  56. package/compiled/zod/dist/types/v4/locales/de.d.ts +7 -0
  57. package/compiled/zod/dist/types/v4/locales/en.d.ts +7 -0
  58. package/compiled/zod/dist/types/v4/locales/es.d.ts +7 -0
  59. package/compiled/zod/dist/types/v4/locales/fa.d.ts +7 -0
  60. package/compiled/zod/dist/types/v4/locales/fi.d.ts +7 -0
  61. package/compiled/zod/dist/types/v4/locales/fr.d.ts +7 -0
  62. package/compiled/zod/dist/types/v4/locales/frCA.d.ts +7 -0
  63. package/compiled/zod/dist/types/v4/locales/he.d.ts +7 -0
  64. package/compiled/zod/dist/types/v4/locales/hu.d.ts +7 -0
  65. package/compiled/zod/dist/types/v4/locales/id.d.ts +7 -0
  66. package/compiled/zod/dist/types/v4/locales/index.d.ts +34 -0
  67. package/compiled/zod/dist/types/v4/locales/it.d.ts +7 -0
  68. package/compiled/zod/dist/types/v4/locales/ja.d.ts +7 -0
  69. package/compiled/zod/dist/types/v4/locales/ko.d.ts +7 -0
  70. package/compiled/zod/dist/types/v4/locales/mk.d.ts +7 -0
  71. package/compiled/zod/dist/types/v4/locales/ms.d.ts +7 -0
  72. package/compiled/zod/dist/types/v4/locales/no.d.ts +7 -0
  73. package/compiled/zod/dist/types/v4/locales/ota.d.ts +7 -0
  74. package/compiled/zod/dist/types/v4/locales/pl.d.ts +7 -0
  75. package/compiled/zod/dist/types/v4/locales/pt.d.ts +7 -0
  76. package/compiled/zod/dist/types/v4/locales/ru.d.ts +7 -0
  77. package/compiled/zod/dist/types/v4/locales/sl.d.ts +7 -0
  78. package/compiled/zod/dist/types/v4/locales/ta.d.ts +7 -0
  79. package/compiled/zod/dist/types/v4/locales/th.d.ts +7 -0
  80. package/compiled/zod/dist/types/v4/locales/tr.d.ts +7 -0
  81. package/compiled/zod/dist/types/v4/locales/ua.d.ts +7 -0
  82. package/compiled/zod/dist/types/v4/locales/ur.d.ts +7 -0
  83. package/compiled/zod/dist/types/v4/locales/vi.d.ts +7 -0
  84. package/compiled/zod/dist/types/v4/locales/zh-CN.d.ts +7 -0
  85. package/compiled/zod/dist/types/v4/locales/zh-tw.d.ts +7 -0
  86. package/compiled/zod/dist/types/v4/mini/checks.d.ts +1 -0
  87. package/compiled/zod/dist/types/v4/mini/coerce.d.ts +7 -0
  88. package/compiled/zod/dist/types/v4/mini/external.d.ts +7 -0
  89. package/compiled/zod/dist/types/v4/mini/index.d.ts +3 -0
  90. package/compiled/zod/dist/types/v4/mini/iso.d.ts +22 -0
  91. package/compiled/zod/dist/types/v4/mini/parse.d.ts +1 -0
  92. package/compiled/zod/dist/types/v4/mini/schemas.d.ts +407 -0
  93. package/compiled/zod/index.js +555 -602
  94. package/compiled/zod/license +1 -1
  95. package/compiled/zod/package.json +1 -1
  96. package/compiled/zod/v3/index.d.ts +1 -0
  97. package/compiled/zod/v4/core/index.d.ts +1 -0
  98. package/compiled/zod/v4/index.d.ts +1 -0
  99. package/compiled/zod/v4/locales/en.d.ts +2 -0
  100. package/compiled/zod/v4/locales/index.d.ts +1 -0
  101. package/compiled/zod/v4-mini/index.d.ts +1 -0
  102. package/dist/Compilation.d.ts +2 -2
  103. package/dist/Compiler.d.ts +1 -1
  104. package/dist/builtin-plugin/CopyRspackPlugin.d.ts +2 -3
  105. package/dist/builtin-plugin/RstestPlugin.d.ts +11 -0
  106. package/dist/builtin-plugin/index.d.ts +1 -0
  107. package/dist/config/browserslistTargetHandler.d.ts +0 -6
  108. package/dist/exports.d.ts +2 -0
  109. package/dist/index.d.ts +0 -1
  110. package/dist/index.js +187 -254
  111. package/dist/node/NodeWatchFileSystem.d.ts +2 -2
  112. package/dist/stats/statsFactoryUtils.d.ts +24 -0
  113. package/dist/trace/index.d.ts +5 -0
  114. package/module.d.ts +53 -21
  115. package/package.json +12 -14
  116. package/compiled/browserslist/index.d.ts +0 -1
  117. package/compiled/browserslist/index.js +0 -2123
  118. package/compiled/browserslist/license +0 -20
  119. package/compiled/browserslist/package.json +0 -1
  120. package/compiled/webpack-sources/index.d.ts +0 -130
  121. package/compiled/zod/index.d.ts +0 -2
  122. package/compiled/zod/lib/external.d.ts +0 -6
  123. package/compiled/zod/lib/index.d.ts +0 -4
  124. package/dist/setupEnv.d.ts +0 -1
  125. /package/compiled/zod/{lib → dist/types/v3}/benchmarks/datetime.d.ts +0 -0
  126. /package/compiled/zod/{lib → dist/types/v3}/benchmarks/discriminatedUnion.d.ts +0 -0
  127. /package/compiled/zod/{lib → dist/types/v3}/benchmarks/index.d.ts +0 -0
  128. /package/compiled/zod/{lib → dist/types/v3}/benchmarks/ipv4.d.ts +0 -0
  129. /package/compiled/zod/{lib → dist/types/v3}/benchmarks/object.d.ts +0 -0
  130. /package/compiled/zod/{lib → dist/types/v3}/benchmarks/primitives.d.ts +0 -0
  131. /package/compiled/zod/{lib → dist/types/v3}/benchmarks/realworld.d.ts +0 -0
  132. /package/compiled/zod/{lib → dist/types/v3}/benchmarks/string.d.ts +0 -0
  133. /package/compiled/zod/{lib → dist/types/v3}/benchmarks/union.d.ts +0 -0
  134. /package/compiled/zod/{lib → dist/types/v3}/helpers/enumUtil.d.ts +0 -0
  135. /package/compiled/zod/{lib → dist/types/v3}/helpers/typeAliases.d.ts +0 -0
  136. /package/compiled/zod/{lib → dist/types/v3}/standard-schema.d.ts +0 -0
@@ -2,14 +2,43 @@
2
2
  /******/ "use strict";
3
3
  /******/ var __webpack_modules__ = ({
4
4
 
5
- /***/ 36:
5
+ /***/ 45:
6
+ /***/ (function(__unused_webpack_module, exports, __nccwpck_require__) {
7
+
8
+
9
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ var desc = Object.getOwnPropertyDescriptor(m, k);
12
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
13
+ desc = { enumerable: true, get: function() { return m[k]; } };
14
+ }
15
+ Object.defineProperty(o, k2, desc);
16
+ }) : (function(o, m, k, k2) {
17
+ if (k2 === undefined) k2 = k;
18
+ o[k2] = m[k];
19
+ }));
20
+ var __exportStar = (this && this.__exportStar) || function(m, exports) {
21
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
22
+ };
23
+ var __importDefault = (this && this.__importDefault) || function (mod) {
24
+ return (mod && mod.__esModule) ? mod : { "default": mod };
25
+ };
26
+ Object.defineProperty(exports, "__esModule", ({ value: true }));
27
+ const index_js_1 = __importDefault(__nccwpck_require__(545));
28
+ __exportStar(__nccwpck_require__(545), exports);
29
+ exports["default"] = index_js_1.default;
30
+
31
+
32
+ /***/ }),
33
+
34
+ /***/ 184:
6
35
  /***/ ((__unused_webpack_module, exports, __nccwpck_require__) => {
7
36
 
8
37
 
9
38
  Object.defineProperty(exports, "__esModule", ({ value: true }));
10
39
  exports.ZodError = exports.quotelessJson = exports.ZodIssueCode = void 0;
11
- const util_1 = __nccwpck_require__(919);
12
- exports.ZodIssueCode = util_1.util.arrayToEnum([
40
+ const util_js_1 = __nccwpck_require__(595);
41
+ exports.ZodIssueCode = util_js_1.util.arrayToEnum([
13
42
  "invalid_type",
14
43
  "invalid_literal",
15
44
  "custom",
@@ -114,7 +143,7 @@ class ZodError extends Error {
114
143
  return this.message;
115
144
  }
116
145
  get message() {
117
- return JSON.stringify(this.issues, util_1.util.jsonStringifyReplacer, 2);
146
+ return JSON.stringify(this.issues, util_js_1.util.jsonStringifyReplacer, 2);
118
147
  }
119
148
  get isEmpty() {
120
149
  return this.issues.length === 0;
@@ -146,7 +175,7 @@ ZodError.create = (issues) => {
146
175
 
147
176
  /***/ }),
148
177
 
149
- /***/ 874:
178
+ /***/ 398:
150
179
  /***/ (function(__unused_webpack_module, exports, __nccwpck_require__) {
151
180
 
152
181
 
@@ -154,23 +183,23 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
154
183
  return (mod && mod.__esModule) ? mod : { "default": mod };
155
184
  };
156
185
  Object.defineProperty(exports, "__esModule", ({ value: true }));
157
- exports.getErrorMap = exports.setErrorMap = exports.defaultErrorMap = void 0;
158
- const en_1 = __importDefault(__nccwpck_require__(986));
159
- exports.defaultErrorMap = en_1.default;
160
- let overrideErrorMap = en_1.default;
186
+ exports.defaultErrorMap = void 0;
187
+ exports.setErrorMap = setErrorMap;
188
+ exports.getErrorMap = getErrorMap;
189
+ const en_js_1 = __importDefault(__nccwpck_require__(46));
190
+ exports.defaultErrorMap = en_js_1.default;
191
+ let overrideErrorMap = en_js_1.default;
161
192
  function setErrorMap(map) {
162
193
  overrideErrorMap = map;
163
194
  }
164
- exports.setErrorMap = setErrorMap;
165
195
  function getErrorMap() {
166
196
  return overrideErrorMap;
167
197
  }
168
- exports.getErrorMap = getErrorMap;
169
198
 
170
199
 
171
200
  /***/ }),
172
201
 
173
- /***/ 286:
202
+ /***/ 538:
174
203
  /***/ (function(__unused_webpack_module, exports, __nccwpck_require__) {
175
204
 
176
205
 
@@ -189,17 +218,17 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
189
218
  for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
190
219
  };
191
220
  Object.defineProperty(exports, "__esModule", ({ value: true }));
192
- __exportStar(__nccwpck_require__(874), exports);
193
- __exportStar(__nccwpck_require__(148), exports);
194
- __exportStar(__nccwpck_require__(163), exports);
195
- __exportStar(__nccwpck_require__(919), exports);
196
- __exportStar(__nccwpck_require__(796), exports);
197
- __exportStar(__nccwpck_require__(36), exports);
221
+ __exportStar(__nccwpck_require__(398), exports);
222
+ __exportStar(__nccwpck_require__(664), exports);
223
+ __exportStar(__nccwpck_require__(727), exports);
224
+ __exportStar(__nccwpck_require__(595), exports);
225
+ __exportStar(__nccwpck_require__(528), exports);
226
+ __exportStar(__nccwpck_require__(184), exports);
198
227
 
199
228
 
200
229
  /***/ }),
201
230
 
202
- /***/ 121:
231
+ /***/ 149:
203
232
  /***/ ((__unused_webpack_module, exports) => {
204
233
 
205
234
 
@@ -208,13 +237,14 @@ exports.errorUtil = void 0;
208
237
  var errorUtil;
209
238
  (function (errorUtil) {
210
239
  errorUtil.errToObj = (message) => typeof message === "string" ? { message } : message || {};
211
- errorUtil.toString = (message) => typeof message === "string" ? message : message === null || message === void 0 ? void 0 : message.message;
240
+ // biome-ignore lint:
241
+ errorUtil.toString = (message) => typeof message === "string" ? message : message?.message;
212
242
  })(errorUtil || (exports.errorUtil = errorUtil = {}));
213
243
 
214
244
 
215
245
  /***/ }),
216
246
 
217
- /***/ 148:
247
+ /***/ 664:
218
248
  /***/ (function(__unused_webpack_module, exports, __nccwpck_require__) {
219
249
 
220
250
 
@@ -222,9 +252,10 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
222
252
  return (mod && mod.__esModule) ? mod : { "default": mod };
223
253
  };
224
254
  Object.defineProperty(exports, "__esModule", ({ value: true }));
225
- exports.isAsync = exports.isValid = exports.isDirty = exports.isAborted = exports.OK = exports.DIRTY = exports.INVALID = exports.ParseStatus = exports.addIssueToContext = exports.EMPTY_PATH = exports.makeIssue = void 0;
226
- const errors_1 = __nccwpck_require__(874);
227
- const en_1 = __importDefault(__nccwpck_require__(986));
255
+ exports.isAsync = exports.isValid = exports.isDirty = exports.isAborted = exports.OK = exports.DIRTY = exports.INVALID = exports.ParseStatus = exports.EMPTY_PATH = exports.makeIssue = void 0;
256
+ exports.addIssueToContext = addIssueToContext;
257
+ const errors_js_1 = __nccwpck_require__(398);
258
+ const en_js_1 = __importDefault(__nccwpck_require__(46));
228
259
  const makeIssue = (params) => {
229
260
  const { data, path, errorMaps, issueData } = params;
230
261
  const fullPath = [...path, ...(issueData.path || [])];
@@ -256,7 +287,7 @@ const makeIssue = (params) => {
256
287
  exports.makeIssue = makeIssue;
257
288
  exports.EMPTY_PATH = [];
258
289
  function addIssueToContext(ctx, issueData) {
259
- const overrideMap = (0, errors_1.getErrorMap)();
290
+ const overrideMap = (0, errors_js_1.getErrorMap)();
260
291
  const issue = (0, exports.makeIssue)({
261
292
  issueData: issueData,
262
293
  data: ctx.data,
@@ -265,12 +296,11 @@ function addIssueToContext(ctx, issueData) {
265
296
  ctx.common.contextualErrorMap, // contextual error map is first priority
266
297
  ctx.schemaErrorMap, // then schema-bound map if available
267
298
  overrideMap, // then global override map
268
- overrideMap === en_1.default ? undefined : en_1.default, // then global default map
299
+ overrideMap === en_js_1.default ? undefined : en_js_1.default, // then global default map
269
300
  ].filter((x) => !!x),
270
301
  });
271
302
  ctx.common.issues.push(issue);
272
303
  }
273
- exports.addIssueToContext = addIssueToContext;
274
304
  class ParseStatus {
275
305
  constructor() {
276
306
  this.value = "valid";
@@ -318,8 +348,7 @@ class ParseStatus {
318
348
  status.dirty();
319
349
  if (value.status === "dirty")
320
350
  status.dirty();
321
- if (key.value !== "__proto__" &&
322
- (typeof value.value !== "undefined" || pair.alwaysSet)) {
351
+ if (key.value !== "__proto__" && (typeof value.value !== "undefined" || pair.alwaysSet)) {
323
352
  finalObject[key.value] = value.value;
324
353
  }
325
354
  }
@@ -346,7 +375,7 @@ exports.isAsync = isAsync;
346
375
 
347
376
  /***/ }),
348
377
 
349
- /***/ 163:
378
+ /***/ 727:
350
379
  /***/ ((__unused_webpack_module, exports) => {
351
380
 
352
381
 
@@ -355,7 +384,7 @@ Object.defineProperty(exports, "__esModule", ({ value: true }));
355
384
 
356
385
  /***/ }),
357
386
 
358
- /***/ 919:
387
+ /***/ 595:
359
388
  /***/ ((__unused_webpack_module, exports) => {
360
389
 
361
390
 
@@ -363,7 +392,7 @@ Object.defineProperty(exports, "__esModule", ({ value: true }));
363
392
  exports.getParsedType = exports.ZodParsedType = exports.objectUtil = exports.util = void 0;
364
393
  var util;
365
394
  (function (util) {
366
- util.assertEqual = (val) => val;
395
+ util.assertEqual = (_) => { };
367
396
  function assertIs(_arg) { }
368
397
  util.assertIs = assertIs;
369
398
  function assertNever(_x) {
@@ -410,11 +439,9 @@ var util;
410
439
  };
411
440
  util.isInteger = typeof Number.isInteger === "function"
412
441
  ? (val) => Number.isInteger(val) // eslint-disable-line ban/ban
413
- : (val) => typeof val === "number" && isFinite(val) && Math.floor(val) === val;
442
+ : (val) => typeof val === "number" && Number.isFinite(val) && Math.floor(val) === val;
414
443
  function joinValues(array, separator = " | ") {
415
- return array
416
- .map((val) => (typeof val === "string" ? `'${val}'` : val))
417
- .join(separator);
444
+ return array.map((val) => (typeof val === "string" ? `'${val}'` : val)).join(separator);
418
445
  }
419
446
  util.joinValues = joinValues;
420
447
  util.jsonStringifyReplacer = (_, value) => {
@@ -463,7 +490,7 @@ const getParsedType = (data) => {
463
490
  case "string":
464
491
  return exports.ZodParsedType.string;
465
492
  case "number":
466
- return isNaN(data) ? exports.ZodParsedType.nan : exports.ZodParsedType.number;
493
+ return Number.isNaN(data) ? exports.ZodParsedType.nan : exports.ZodParsedType.number;
467
494
  case "boolean":
468
495
  return exports.ZodParsedType.boolean;
469
496
  case "function":
@@ -479,10 +506,7 @@ const getParsedType = (data) => {
479
506
  if (data === null) {
480
507
  return exports.ZodParsedType.null;
481
508
  }
482
- if (data.then &&
483
- typeof data.then === "function" &&
484
- data.catch &&
485
- typeof data.catch === "function") {
509
+ if (data.then && typeof data.then === "function" && data.catch && typeof data.catch === "function") {
486
510
  return exports.ZodParsedType.promise;
487
511
  }
488
512
  if (typeof Map !== "undefined" && data instanceof Map) {
@@ -504,7 +528,7 @@ exports.getParsedType = getParsedType;
504
528
 
505
529
  /***/ }),
506
530
 
507
- /***/ 437:
531
+ /***/ 545:
508
532
  /***/ (function(__unused_webpack_module, exports, __nccwpck_require__) {
509
533
 
510
534
 
@@ -536,57 +560,57 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
536
560
  };
537
561
  Object.defineProperty(exports, "__esModule", ({ value: true }));
538
562
  exports.z = void 0;
539
- const z = __importStar(__nccwpck_require__(286));
563
+ const z = __importStar(__nccwpck_require__(538));
540
564
  exports.z = z;
541
- __exportStar(__nccwpck_require__(286), exports);
565
+ __exportStar(__nccwpck_require__(538), exports);
542
566
  exports["default"] = z;
543
567
 
544
568
 
545
569
  /***/ }),
546
570
 
547
- /***/ 986:
571
+ /***/ 46:
548
572
  /***/ ((__unused_webpack_module, exports, __nccwpck_require__) => {
549
573
 
550
574
 
551
575
  Object.defineProperty(exports, "__esModule", ({ value: true }));
552
- const util_1 = __nccwpck_require__(919);
553
- const ZodError_1 = __nccwpck_require__(36);
576
+ const ZodError_js_1 = __nccwpck_require__(184);
577
+ const util_js_1 = __nccwpck_require__(595);
554
578
  const errorMap = (issue, _ctx) => {
555
579
  let message;
556
580
  switch (issue.code) {
557
- case ZodError_1.ZodIssueCode.invalid_type:
558
- if (issue.received === util_1.ZodParsedType.undefined) {
581
+ case ZodError_js_1.ZodIssueCode.invalid_type:
582
+ if (issue.received === util_js_1.ZodParsedType.undefined) {
559
583
  message = "Required";
560
584
  }
561
585
  else {
562
586
  message = `Expected ${issue.expected}, received ${issue.received}`;
563
587
  }
564
588
  break;
565
- case ZodError_1.ZodIssueCode.invalid_literal:
566
- message = `Invalid literal value, expected ${JSON.stringify(issue.expected, util_1.util.jsonStringifyReplacer)}`;
589
+ case ZodError_js_1.ZodIssueCode.invalid_literal:
590
+ message = `Invalid literal value, expected ${JSON.stringify(issue.expected, util_js_1.util.jsonStringifyReplacer)}`;
567
591
  break;
568
- case ZodError_1.ZodIssueCode.unrecognized_keys:
569
- message = `Unrecognized key(s) in object: ${util_1.util.joinValues(issue.keys, ", ")}`;
592
+ case ZodError_js_1.ZodIssueCode.unrecognized_keys:
593
+ message = `Unrecognized key(s) in object: ${util_js_1.util.joinValues(issue.keys, ", ")}`;
570
594
  break;
571
- case ZodError_1.ZodIssueCode.invalid_union:
595
+ case ZodError_js_1.ZodIssueCode.invalid_union:
572
596
  message = `Invalid input`;
573
597
  break;
574
- case ZodError_1.ZodIssueCode.invalid_union_discriminator:
575
- message = `Invalid discriminator value. Expected ${util_1.util.joinValues(issue.options)}`;
598
+ case ZodError_js_1.ZodIssueCode.invalid_union_discriminator:
599
+ message = `Invalid discriminator value. Expected ${util_js_1.util.joinValues(issue.options)}`;
576
600
  break;
577
- case ZodError_1.ZodIssueCode.invalid_enum_value:
578
- message = `Invalid enum value. Expected ${util_1.util.joinValues(issue.options)}, received '${issue.received}'`;
601
+ case ZodError_js_1.ZodIssueCode.invalid_enum_value:
602
+ message = `Invalid enum value. Expected ${util_js_1.util.joinValues(issue.options)}, received '${issue.received}'`;
579
603
  break;
580
- case ZodError_1.ZodIssueCode.invalid_arguments:
604
+ case ZodError_js_1.ZodIssueCode.invalid_arguments:
581
605
  message = `Invalid function arguments`;
582
606
  break;
583
- case ZodError_1.ZodIssueCode.invalid_return_type:
607
+ case ZodError_js_1.ZodIssueCode.invalid_return_type:
584
608
  message = `Invalid function return type`;
585
609
  break;
586
- case ZodError_1.ZodIssueCode.invalid_date:
610
+ case ZodError_js_1.ZodIssueCode.invalid_date:
587
611
  message = `Invalid date`;
588
612
  break;
589
- case ZodError_1.ZodIssueCode.invalid_string:
613
+ case ZodError_js_1.ZodIssueCode.invalid_string:
590
614
  if (typeof issue.validation === "object") {
591
615
  if ("includes" in issue.validation) {
592
616
  message = `Invalid input: must include "${issue.validation.includes}"`;
@@ -601,7 +625,7 @@ const errorMap = (issue, _ctx) => {
601
625
  message = `Invalid input: must end with "${issue.validation.endsWith}"`;
602
626
  }
603
627
  else {
604
- util_1.util.assertNever(issue.validation);
628
+ util_js_1.util.assertNever(issue.validation);
605
629
  }
606
630
  }
607
631
  else if (issue.validation !== "regex") {
@@ -611,67 +635,47 @@ const errorMap = (issue, _ctx) => {
611
635
  message = "Invalid";
612
636
  }
613
637
  break;
614
- case ZodError_1.ZodIssueCode.too_small:
638
+ case ZodError_js_1.ZodIssueCode.too_small:
615
639
  if (issue.type === "array")
616
640
  message = `Array must contain ${issue.exact ? "exactly" : issue.inclusive ? `at least` : `more than`} ${issue.minimum} element(s)`;
617
641
  else if (issue.type === "string")
618
642
  message = `String must contain ${issue.exact ? "exactly" : issue.inclusive ? `at least` : `over`} ${issue.minimum} character(s)`;
619
643
  else if (issue.type === "number")
620
- message = `Number must be ${issue.exact
621
- ? `exactly equal to `
622
- : issue.inclusive
623
- ? `greater than or equal to `
624
- : `greater than `}${issue.minimum}`;
644
+ message = `Number must be ${issue.exact ? `exactly equal to ` : issue.inclusive ? `greater than or equal to ` : `greater than `}${issue.minimum}`;
625
645
  else if (issue.type === "date")
626
- message = `Date must be ${issue.exact
627
- ? `exactly equal to `
628
- : issue.inclusive
629
- ? `greater than or equal to `
630
- : `greater than `}${new Date(Number(issue.minimum))}`;
646
+ message = `Date must be ${issue.exact ? `exactly equal to ` : issue.inclusive ? `greater than or equal to ` : `greater than `}${new Date(Number(issue.minimum))}`;
631
647
  else
632
648
  message = "Invalid input";
633
649
  break;
634
- case ZodError_1.ZodIssueCode.too_big:
650
+ case ZodError_js_1.ZodIssueCode.too_big:
635
651
  if (issue.type === "array")
636
652
  message = `Array must contain ${issue.exact ? `exactly` : issue.inclusive ? `at most` : `less than`} ${issue.maximum} element(s)`;
637
653
  else if (issue.type === "string")
638
654
  message = `String must contain ${issue.exact ? `exactly` : issue.inclusive ? `at most` : `under`} ${issue.maximum} character(s)`;
639
655
  else if (issue.type === "number")
640
- message = `Number must be ${issue.exact
641
- ? `exactly`
642
- : issue.inclusive
643
- ? `less than or equal to`
644
- : `less than`} ${issue.maximum}`;
656
+ message = `Number must be ${issue.exact ? `exactly` : issue.inclusive ? `less than or equal to` : `less than`} ${issue.maximum}`;
645
657
  else if (issue.type === "bigint")
646
- message = `BigInt must be ${issue.exact
647
- ? `exactly`
648
- : issue.inclusive
649
- ? `less than or equal to`
650
- : `less than`} ${issue.maximum}`;
658
+ message = `BigInt must be ${issue.exact ? `exactly` : issue.inclusive ? `less than or equal to` : `less than`} ${issue.maximum}`;
651
659
  else if (issue.type === "date")
652
- message = `Date must be ${issue.exact
653
- ? `exactly`
654
- : issue.inclusive
655
- ? `smaller than or equal to`
656
- : `smaller than`} ${new Date(Number(issue.maximum))}`;
660
+ message = `Date must be ${issue.exact ? `exactly` : issue.inclusive ? `smaller than or equal to` : `smaller than`} ${new Date(Number(issue.maximum))}`;
657
661
  else
658
662
  message = "Invalid input";
659
663
  break;
660
- case ZodError_1.ZodIssueCode.custom:
664
+ case ZodError_js_1.ZodIssueCode.custom:
661
665
  message = `Invalid input`;
662
666
  break;
663
- case ZodError_1.ZodIssueCode.invalid_intersection_types:
667
+ case ZodError_js_1.ZodIssueCode.invalid_intersection_types:
664
668
  message = `Intersection results could not be merged`;
665
669
  break;
666
- case ZodError_1.ZodIssueCode.not_multiple_of:
670
+ case ZodError_js_1.ZodIssueCode.not_multiple_of:
667
671
  message = `Number must be a multiple of ${issue.multipleOf}`;
668
672
  break;
669
- case ZodError_1.ZodIssueCode.not_finite:
673
+ case ZodError_js_1.ZodIssueCode.not_finite:
670
674
  message = "Number must be finite";
671
675
  break;
672
676
  default:
673
677
  message = _ctx.defaultError;
674
- util_1.util.assertNever(issue);
678
+ util_js_1.util.assertNever(issue);
675
679
  }
676
680
  return { message };
677
681
  };
@@ -680,7 +684,7 @@ exports["default"] = errorMap;
680
684
 
681
685
  /***/ }),
682
686
 
683
- /***/ 796:
687
+ /***/ 528:
684
688
  /***/ (function(__unused_webpack_module, exports, __nccwpck_require__) {
685
689
 
686
690
 
@@ -697,13 +701,15 @@ var __classPrivateFieldSet = (this && this.__classPrivateFieldSet) || function (
697
701
  };
698
702
  var _ZodEnum_cache, _ZodNativeEnum_cache;
699
703
  Object.defineProperty(exports, "__esModule", ({ value: true }));
700
- exports.boolean = exports.bigint = exports.array = exports.any = exports.coerce = exports.ZodFirstPartyTypeKind = exports.late = exports.ZodSchema = exports.Schema = exports.custom = exports.ZodReadonly = exports.ZodPipeline = exports.ZodBranded = exports.BRAND = exports.ZodNaN = exports.ZodCatch = exports.ZodDefault = exports.ZodNullable = exports.ZodOptional = exports.ZodTransformer = exports.ZodEffects = exports.ZodPromise = exports.ZodNativeEnum = exports.ZodEnum = exports.ZodLiteral = exports.ZodLazy = exports.ZodFunction = exports.ZodSet = exports.ZodMap = exports.ZodRecord = exports.ZodTuple = exports.ZodIntersection = exports.ZodDiscriminatedUnion = exports.ZodUnion = exports.ZodObject = exports.ZodArray = exports.ZodVoid = exports.ZodNever = exports.ZodUnknown = exports.ZodAny = exports.ZodNull = exports.ZodUndefined = exports.ZodSymbol = exports.ZodDate = exports.ZodBoolean = exports.ZodBigInt = exports.ZodNumber = exports.ZodString = exports.datetimeRegex = exports.ZodType = void 0;
701
- exports.NEVER = exports["void"] = exports.unknown = exports.union = exports.undefined = exports.tuple = exports.transformer = exports.symbol = exports.string = exports.strictObject = exports.set = exports.record = exports.promise = exports.preprocess = exports.pipeline = exports.ostring = exports.optional = exports.onumber = exports.oboolean = exports.object = exports.number = exports.nullable = exports["null"] = exports.never = exports.nativeEnum = exports.nan = exports.map = exports.literal = exports.lazy = exports.intersection = exports["instanceof"] = exports["function"] = exports["enum"] = exports.effect = exports.discriminatedUnion = exports.date = void 0;
702
- const errors_1 = __nccwpck_require__(874);
703
- const errorUtil_1 = __nccwpck_require__(121);
704
- const parseUtil_1 = __nccwpck_require__(148);
705
- const util_1 = __nccwpck_require__(919);
706
- const ZodError_1 = __nccwpck_require__(36);
704
+ exports.discriminatedUnion = exports.date = exports.boolean = exports.bigint = exports.array = exports.any = exports.coerce = exports.ZodFirstPartyTypeKind = exports.late = exports.ZodSchema = exports.Schema = exports.ZodReadonly = exports.ZodPipeline = exports.ZodBranded = exports.BRAND = exports.ZodNaN = exports.ZodCatch = exports.ZodDefault = exports.ZodNullable = exports.ZodOptional = exports.ZodTransformer = exports.ZodEffects = exports.ZodPromise = exports.ZodNativeEnum = exports.ZodEnum = exports.ZodLiteral = exports.ZodLazy = exports.ZodFunction = exports.ZodSet = exports.ZodMap = exports.ZodRecord = exports.ZodTuple = exports.ZodIntersection = exports.ZodDiscriminatedUnion = exports.ZodUnion = exports.ZodObject = exports.ZodArray = exports.ZodVoid = exports.ZodNever = exports.ZodUnknown = exports.ZodAny = exports.ZodNull = exports.ZodUndefined = exports.ZodSymbol = exports.ZodDate = exports.ZodBoolean = exports.ZodBigInt = exports.ZodNumber = exports.ZodString = exports.ZodType = void 0;
705
+ exports.NEVER = exports["void"] = exports.unknown = exports.union = exports.undefined = exports.tuple = exports.transformer = exports.symbol = exports.string = exports.strictObject = exports.set = exports.record = exports.promise = exports.preprocess = exports.pipeline = exports.ostring = exports.optional = exports.onumber = exports.oboolean = exports.object = exports.number = exports.nullable = exports["null"] = exports.never = exports.nativeEnum = exports.nan = exports.map = exports.literal = exports.lazy = exports.intersection = exports["instanceof"] = exports["function"] = exports["enum"] = exports.effect = void 0;
706
+ exports.datetimeRegex = datetimeRegex;
707
+ exports.custom = custom;
708
+ const ZodError_js_1 = __nccwpck_require__(184);
709
+ const errors_js_1 = __nccwpck_require__(398);
710
+ const errorUtil_js_1 = __nccwpck_require__(149);
711
+ const parseUtil_js_1 = __nccwpck_require__(664);
712
+ const util_js_1 = __nccwpck_require__(595);
707
713
  class ParseInputLazyPath {
708
714
  constructor(parent, value, path, key) {
709
715
  this._cachedPath = [];
@@ -714,7 +720,7 @@ class ParseInputLazyPath {
714
720
  }
715
721
  get path() {
716
722
  if (!this._cachedPath.length) {
717
- if (this._key instanceof Array) {
723
+ if (Array.isArray(this._key)) {
718
724
  this._cachedPath.push(...this._path, ...this._key);
719
725
  }
720
726
  else {
@@ -725,7 +731,7 @@ class ParseInputLazyPath {
725
731
  }
726
732
  }
727
733
  const handleResult = (ctx, result) => {
728
- if ((0, parseUtil_1.isValid)(result)) {
734
+ if ((0, parseUtil_js_1.isValid)(result)) {
729
735
  return { success: true, data: result.value };
730
736
  }
731
737
  else {
@@ -737,7 +743,7 @@ const handleResult = (ctx, result) => {
737
743
  get error() {
738
744
  if (this._error)
739
745
  return this._error;
740
- const error = new ZodError_1.ZodError(ctx.common.issues);
746
+ const error = new ZodError_js_1.ZodError(ctx.common.issues);
741
747
  this._error = error;
742
748
  return this._error;
743
749
  },
@@ -754,17 +760,16 @@ function processCreateParams(params) {
754
760
  if (errorMap)
755
761
  return { errorMap: errorMap, description };
756
762
  const customMap = (iss, ctx) => {
757
- var _a, _b;
758
763
  const { message } = params;
759
764
  if (iss.code === "invalid_enum_value") {
760
- return { message: message !== null && message !== void 0 ? message : ctx.defaultError };
765
+ return { message: message ?? ctx.defaultError };
761
766
  }
762
767
  if (typeof ctx.data === "undefined") {
763
- return { message: (_a = message !== null && message !== void 0 ? message : required_error) !== null && _a !== void 0 ? _a : ctx.defaultError };
768
+ return { message: message ?? required_error ?? ctx.defaultError };
764
769
  }
765
770
  if (iss.code !== "invalid_type")
766
771
  return { message: ctx.defaultError };
767
- return { message: (_b = message !== null && message !== void 0 ? message : invalid_type_error) !== null && _b !== void 0 ? _b : ctx.defaultError };
772
+ return { message: message ?? invalid_type_error ?? ctx.defaultError };
768
773
  };
769
774
  return { errorMap: customMap, description };
770
775
  }
@@ -773,13 +778,13 @@ class ZodType {
773
778
  return this._def.description;
774
779
  }
775
780
  _getType(input) {
776
- return (0, util_1.getParsedType)(input.data);
781
+ return (0, util_js_1.getParsedType)(input.data);
777
782
  }
778
783
  _getOrReturnCtx(input, ctx) {
779
784
  return (ctx || {
780
785
  common: input.parent.common,
781
786
  data: input.data,
782
- parsedType: (0, util_1.getParsedType)(input.data),
787
+ parsedType: (0, util_js_1.getParsedType)(input.data),
783
788
  schemaErrorMap: this._def.errorMap,
784
789
  path: input.path,
785
790
  parent: input.parent,
@@ -787,11 +792,11 @@ class ZodType {
787
792
  }
788
793
  _processInputParams(input) {
789
794
  return {
790
- status: new parseUtil_1.ParseStatus(),
795
+ status: new parseUtil_js_1.ParseStatus(),
791
796
  ctx: {
792
797
  common: input.parent.common,
793
798
  data: input.data,
794
- parsedType: (0, util_1.getParsedType)(input.data),
799
+ parsedType: (0, util_js_1.getParsedType)(input.data),
795
800
  schemaErrorMap: this._def.errorMap,
796
801
  path: input.path,
797
802
  parent: input.parent,
@@ -800,7 +805,7 @@ class ZodType {
800
805
  }
801
806
  _parseSync(input) {
802
807
  const result = this._parse(input);
803
- if ((0, parseUtil_1.isAsync)(result)) {
808
+ if ((0, parseUtil_js_1.isAsync)(result)) {
804
809
  throw new Error("Synchronous parse encountered promise.");
805
810
  }
806
811
  return result;
@@ -816,24 +821,22 @@ class ZodType {
816
821
  throw result.error;
817
822
  }
818
823
  safeParse(data, params) {
819
- var _a;
820
824
  const ctx = {
821
825
  common: {
822
826
  issues: [],
823
- async: (_a = params === null || params === void 0 ? void 0 : params.async) !== null && _a !== void 0 ? _a : false,
824
- contextualErrorMap: params === null || params === void 0 ? void 0 : params.errorMap,
827
+ async: params?.async ?? false,
828
+ contextualErrorMap: params?.errorMap,
825
829
  },
826
- path: (params === null || params === void 0 ? void 0 : params.path) || [],
830
+ path: params?.path || [],
827
831
  schemaErrorMap: this._def.errorMap,
828
832
  parent: null,
829
833
  data,
830
- parsedType: (0, util_1.getParsedType)(data),
834
+ parsedType: (0, util_js_1.getParsedType)(data),
831
835
  };
832
836
  const result = this._parseSync({ data, path: ctx.path, parent: ctx });
833
837
  return handleResult(ctx, result);
834
838
  }
835
839
  "~validate"(data) {
836
- var _a, _b;
837
840
  const ctx = {
838
841
  common: {
839
842
  issues: [],
@@ -843,12 +846,12 @@ class ZodType {
843
846
  schemaErrorMap: this._def.errorMap,
844
847
  parent: null,
845
848
  data,
846
- parsedType: (0, util_1.getParsedType)(data),
849
+ parsedType: (0, util_js_1.getParsedType)(data),
847
850
  };
848
851
  if (!this["~standard"].async) {
849
852
  try {
850
853
  const result = this._parseSync({ data, path: [], parent: ctx });
851
- return (0, parseUtil_1.isValid)(result)
854
+ return (0, parseUtil_js_1.isValid)(result)
852
855
  ? {
853
856
  value: result.value,
854
857
  }
@@ -857,7 +860,7 @@ class ZodType {
857
860
  };
858
861
  }
859
862
  catch (err) {
860
- if ((_b = (_a = err === null || err === void 0 ? void 0 : err.message) === null || _a === void 0 ? void 0 : _a.toLowerCase()) === null || _b === void 0 ? void 0 : _b.includes("encountered")) {
863
+ if (err?.message?.toLowerCase()?.includes("encountered")) {
861
864
  this["~standard"].async = true;
862
865
  }
863
866
  ctx.common = {
@@ -866,7 +869,7 @@ class ZodType {
866
869
  };
867
870
  }
868
871
  }
869
- return this._parseAsync({ data, path: [], parent: ctx }).then((result) => (0, parseUtil_1.isValid)(result)
872
+ return this._parseAsync({ data, path: [], parent: ctx }).then((result) => (0, parseUtil_js_1.isValid)(result)
870
873
  ? {
871
874
  value: result.value,
872
875
  }
@@ -884,19 +887,17 @@ class ZodType {
884
887
  const ctx = {
885
888
  common: {
886
889
  issues: [],
887
- contextualErrorMap: params === null || params === void 0 ? void 0 : params.errorMap,
890
+ contextualErrorMap: params?.errorMap,
888
891
  async: true,
889
892
  },
890
- path: (params === null || params === void 0 ? void 0 : params.path) || [],
893
+ path: params?.path || [],
891
894
  schemaErrorMap: this._def.errorMap,
892
895
  parent: null,
893
896
  data,
894
- parsedType: (0, util_1.getParsedType)(data),
897
+ parsedType: (0, util_js_1.getParsedType)(data),
895
898
  };
896
899
  const maybeAsyncResult = this._parse({ data, path: ctx.path, parent: ctx });
897
- const result = await ((0, parseUtil_1.isAsync)(maybeAsyncResult)
898
- ? maybeAsyncResult
899
- : Promise.resolve(maybeAsyncResult));
900
+ const result = await ((0, parseUtil_js_1.isAsync)(maybeAsyncResult) ? maybeAsyncResult : Promise.resolve(maybeAsyncResult));
900
901
  return handleResult(ctx, result);
901
902
  }
902
903
  refine(check, message) {
@@ -914,7 +915,7 @@ class ZodType {
914
915
  return this._refinement((val, ctx) => {
915
916
  const result = check(val);
916
917
  const setError = () => ctx.addIssue({
917
- code: ZodError_1.ZodIssueCode.custom,
918
+ code: ZodError_js_1.ZodIssueCode.custom,
918
919
  ...getIssueProperties(val),
919
920
  });
920
921
  if (typeof Promise !== "undefined" && result instanceof Promise) {
@@ -940,9 +941,7 @@ class ZodType {
940
941
  refinement(check, refinementData) {
941
942
  return this._refinement((val, ctx) => {
942
943
  if (!check(val)) {
943
- ctx.addIssue(typeof refinementData === "function"
944
- ? refinementData(val, ctx)
945
- : refinementData);
944
+ ctx.addIssue(typeof refinementData === "function" ? refinementData(val, ctx) : refinementData);
946
945
  return false;
947
946
  }
948
947
  else {
@@ -1140,7 +1139,6 @@ function datetimeRegex(args) {
1140
1139
  regex = `${regex}(${opts.join("|")})`;
1141
1140
  return new RegExp(`^${regex}$`);
1142
1141
  }
1143
- exports.datetimeRegex = datetimeRegex;
1144
1142
  function isValidIP(ip, version) {
1145
1143
  if ((version === "v4" || !version) && ipv4Regex.test(ip)) {
1146
1144
  return true;
@@ -1163,13 +1161,15 @@ function isValidJWT(jwt, alg) {
1163
1161
  const decoded = JSON.parse(atob(base64));
1164
1162
  if (typeof decoded !== "object" || decoded === null)
1165
1163
  return false;
1166
- if (!decoded.typ || !decoded.alg)
1164
+ if ("typ" in decoded && decoded?.typ !== "JWT")
1165
+ return false;
1166
+ if (!decoded.alg)
1167
1167
  return false;
1168
1168
  if (alg && decoded.alg !== alg)
1169
1169
  return false;
1170
1170
  return true;
1171
1171
  }
1172
- catch (_a) {
1172
+ catch {
1173
1173
  return false;
1174
1174
  }
1175
1175
  }
@@ -1188,23 +1188,23 @@ class ZodString extends ZodType {
1188
1188
  input.data = String(input.data);
1189
1189
  }
1190
1190
  const parsedType = this._getType(input);
1191
- if (parsedType !== util_1.ZodParsedType.string) {
1191
+ if (parsedType !== util_js_1.ZodParsedType.string) {
1192
1192
  const ctx = this._getOrReturnCtx(input);
1193
- (0, parseUtil_1.addIssueToContext)(ctx, {
1194
- code: ZodError_1.ZodIssueCode.invalid_type,
1195
- expected: util_1.ZodParsedType.string,
1193
+ (0, parseUtil_js_1.addIssueToContext)(ctx, {
1194
+ code: ZodError_js_1.ZodIssueCode.invalid_type,
1195
+ expected: util_js_1.ZodParsedType.string,
1196
1196
  received: ctx.parsedType,
1197
1197
  });
1198
- return parseUtil_1.INVALID;
1198
+ return parseUtil_js_1.INVALID;
1199
1199
  }
1200
- const status = new parseUtil_1.ParseStatus();
1200
+ const status = new parseUtil_js_1.ParseStatus();
1201
1201
  let ctx = undefined;
1202
1202
  for (const check of this._def.checks) {
1203
1203
  if (check.kind === "min") {
1204
1204
  if (input.data.length < check.value) {
1205
1205
  ctx = this._getOrReturnCtx(input, ctx);
1206
- (0, parseUtil_1.addIssueToContext)(ctx, {
1207
- code: ZodError_1.ZodIssueCode.too_small,
1206
+ (0, parseUtil_js_1.addIssueToContext)(ctx, {
1207
+ code: ZodError_js_1.ZodIssueCode.too_small,
1208
1208
  minimum: check.value,
1209
1209
  type: "string",
1210
1210
  inclusive: true,
@@ -1217,8 +1217,8 @@ class ZodString extends ZodType {
1217
1217
  else if (check.kind === "max") {
1218
1218
  if (input.data.length > check.value) {
1219
1219
  ctx = this._getOrReturnCtx(input, ctx);
1220
- (0, parseUtil_1.addIssueToContext)(ctx, {
1221
- code: ZodError_1.ZodIssueCode.too_big,
1220
+ (0, parseUtil_js_1.addIssueToContext)(ctx, {
1221
+ code: ZodError_js_1.ZodIssueCode.too_big,
1222
1222
  maximum: check.value,
1223
1223
  type: "string",
1224
1224
  inclusive: true,
@@ -1234,8 +1234,8 @@ class ZodString extends ZodType {
1234
1234
  if (tooBig || tooSmall) {
1235
1235
  ctx = this._getOrReturnCtx(input, ctx);
1236
1236
  if (tooBig) {
1237
- (0, parseUtil_1.addIssueToContext)(ctx, {
1238
- code: ZodError_1.ZodIssueCode.too_big,
1237
+ (0, parseUtil_js_1.addIssueToContext)(ctx, {
1238
+ code: ZodError_js_1.ZodIssueCode.too_big,
1239
1239
  maximum: check.value,
1240
1240
  type: "string",
1241
1241
  inclusive: true,
@@ -1244,8 +1244,8 @@ class ZodString extends ZodType {
1244
1244
  });
1245
1245
  }
1246
1246
  else if (tooSmall) {
1247
- (0, parseUtil_1.addIssueToContext)(ctx, {
1248
- code: ZodError_1.ZodIssueCode.too_small,
1247
+ (0, parseUtil_js_1.addIssueToContext)(ctx, {
1248
+ code: ZodError_js_1.ZodIssueCode.too_small,
1249
1249
  minimum: check.value,
1250
1250
  type: "string",
1251
1251
  inclusive: true,
@@ -1259,9 +1259,9 @@ class ZodString extends ZodType {
1259
1259
  else if (check.kind === "email") {
1260
1260
  if (!emailRegex.test(input.data)) {
1261
1261
  ctx = this._getOrReturnCtx(input, ctx);
1262
- (0, parseUtil_1.addIssueToContext)(ctx, {
1262
+ (0, parseUtil_js_1.addIssueToContext)(ctx, {
1263
1263
  validation: "email",
1264
- code: ZodError_1.ZodIssueCode.invalid_string,
1264
+ code: ZodError_js_1.ZodIssueCode.invalid_string,
1265
1265
  message: check.message,
1266
1266
  });
1267
1267
  status.dirty();
@@ -1273,9 +1273,9 @@ class ZodString extends ZodType {
1273
1273
  }
1274
1274
  if (!emojiRegex.test(input.data)) {
1275
1275
  ctx = this._getOrReturnCtx(input, ctx);
1276
- (0, parseUtil_1.addIssueToContext)(ctx, {
1276
+ (0, parseUtil_js_1.addIssueToContext)(ctx, {
1277
1277
  validation: "emoji",
1278
- code: ZodError_1.ZodIssueCode.invalid_string,
1278
+ code: ZodError_js_1.ZodIssueCode.invalid_string,
1279
1279
  message: check.message,
1280
1280
  });
1281
1281
  status.dirty();
@@ -1284,9 +1284,9 @@ class ZodString extends ZodType {
1284
1284
  else if (check.kind === "uuid") {
1285
1285
  if (!uuidRegex.test(input.data)) {
1286
1286
  ctx = this._getOrReturnCtx(input, ctx);
1287
- (0, parseUtil_1.addIssueToContext)(ctx, {
1287
+ (0, parseUtil_js_1.addIssueToContext)(ctx, {
1288
1288
  validation: "uuid",
1289
- code: ZodError_1.ZodIssueCode.invalid_string,
1289
+ code: ZodError_js_1.ZodIssueCode.invalid_string,
1290
1290
  message: check.message,
1291
1291
  });
1292
1292
  status.dirty();
@@ -1295,9 +1295,9 @@ class ZodString extends ZodType {
1295
1295
  else if (check.kind === "nanoid") {
1296
1296
  if (!nanoidRegex.test(input.data)) {
1297
1297
  ctx = this._getOrReturnCtx(input, ctx);
1298
- (0, parseUtil_1.addIssueToContext)(ctx, {
1298
+ (0, parseUtil_js_1.addIssueToContext)(ctx, {
1299
1299
  validation: "nanoid",
1300
- code: ZodError_1.ZodIssueCode.invalid_string,
1300
+ code: ZodError_js_1.ZodIssueCode.invalid_string,
1301
1301
  message: check.message,
1302
1302
  });
1303
1303
  status.dirty();
@@ -1306,9 +1306,9 @@ class ZodString extends ZodType {
1306
1306
  else if (check.kind === "cuid") {
1307
1307
  if (!cuidRegex.test(input.data)) {
1308
1308
  ctx = this._getOrReturnCtx(input, ctx);
1309
- (0, parseUtil_1.addIssueToContext)(ctx, {
1309
+ (0, parseUtil_js_1.addIssueToContext)(ctx, {
1310
1310
  validation: "cuid",
1311
- code: ZodError_1.ZodIssueCode.invalid_string,
1311
+ code: ZodError_js_1.ZodIssueCode.invalid_string,
1312
1312
  message: check.message,
1313
1313
  });
1314
1314
  status.dirty();
@@ -1317,9 +1317,9 @@ class ZodString extends ZodType {
1317
1317
  else if (check.kind === "cuid2") {
1318
1318
  if (!cuid2Regex.test(input.data)) {
1319
1319
  ctx = this._getOrReturnCtx(input, ctx);
1320
- (0, parseUtil_1.addIssueToContext)(ctx, {
1320
+ (0, parseUtil_js_1.addIssueToContext)(ctx, {
1321
1321
  validation: "cuid2",
1322
- code: ZodError_1.ZodIssueCode.invalid_string,
1322
+ code: ZodError_js_1.ZodIssueCode.invalid_string,
1323
1323
  message: check.message,
1324
1324
  });
1325
1325
  status.dirty();
@@ -1328,9 +1328,9 @@ class ZodString extends ZodType {
1328
1328
  else if (check.kind === "ulid") {
1329
1329
  if (!ulidRegex.test(input.data)) {
1330
1330
  ctx = this._getOrReturnCtx(input, ctx);
1331
- (0, parseUtil_1.addIssueToContext)(ctx, {
1331
+ (0, parseUtil_js_1.addIssueToContext)(ctx, {
1332
1332
  validation: "ulid",
1333
- code: ZodError_1.ZodIssueCode.invalid_string,
1333
+ code: ZodError_js_1.ZodIssueCode.invalid_string,
1334
1334
  message: check.message,
1335
1335
  });
1336
1336
  status.dirty();
@@ -1340,11 +1340,11 @@ class ZodString extends ZodType {
1340
1340
  try {
1341
1341
  new URL(input.data);
1342
1342
  }
1343
- catch (_a) {
1343
+ catch {
1344
1344
  ctx = this._getOrReturnCtx(input, ctx);
1345
- (0, parseUtil_1.addIssueToContext)(ctx, {
1345
+ (0, parseUtil_js_1.addIssueToContext)(ctx, {
1346
1346
  validation: "url",
1347
- code: ZodError_1.ZodIssueCode.invalid_string,
1347
+ code: ZodError_js_1.ZodIssueCode.invalid_string,
1348
1348
  message: check.message,
1349
1349
  });
1350
1350
  status.dirty();
@@ -1355,9 +1355,9 @@ class ZodString extends ZodType {
1355
1355
  const testResult = check.regex.test(input.data);
1356
1356
  if (!testResult) {
1357
1357
  ctx = this._getOrReturnCtx(input, ctx);
1358
- (0, parseUtil_1.addIssueToContext)(ctx, {
1358
+ (0, parseUtil_js_1.addIssueToContext)(ctx, {
1359
1359
  validation: "regex",
1360
- code: ZodError_1.ZodIssueCode.invalid_string,
1360
+ code: ZodError_js_1.ZodIssueCode.invalid_string,
1361
1361
  message: check.message,
1362
1362
  });
1363
1363
  status.dirty();
@@ -1369,8 +1369,8 @@ class ZodString extends ZodType {
1369
1369
  else if (check.kind === "includes") {
1370
1370
  if (!input.data.includes(check.value, check.position)) {
1371
1371
  ctx = this._getOrReturnCtx(input, ctx);
1372
- (0, parseUtil_1.addIssueToContext)(ctx, {
1373
- code: ZodError_1.ZodIssueCode.invalid_string,
1372
+ (0, parseUtil_js_1.addIssueToContext)(ctx, {
1373
+ code: ZodError_js_1.ZodIssueCode.invalid_string,
1374
1374
  validation: { includes: check.value, position: check.position },
1375
1375
  message: check.message,
1376
1376
  });
@@ -1386,8 +1386,8 @@ class ZodString extends ZodType {
1386
1386
  else if (check.kind === "startsWith") {
1387
1387
  if (!input.data.startsWith(check.value)) {
1388
1388
  ctx = this._getOrReturnCtx(input, ctx);
1389
- (0, parseUtil_1.addIssueToContext)(ctx, {
1390
- code: ZodError_1.ZodIssueCode.invalid_string,
1389
+ (0, parseUtil_js_1.addIssueToContext)(ctx, {
1390
+ code: ZodError_js_1.ZodIssueCode.invalid_string,
1391
1391
  validation: { startsWith: check.value },
1392
1392
  message: check.message,
1393
1393
  });
@@ -1397,8 +1397,8 @@ class ZodString extends ZodType {
1397
1397
  else if (check.kind === "endsWith") {
1398
1398
  if (!input.data.endsWith(check.value)) {
1399
1399
  ctx = this._getOrReturnCtx(input, ctx);
1400
- (0, parseUtil_1.addIssueToContext)(ctx, {
1401
- code: ZodError_1.ZodIssueCode.invalid_string,
1400
+ (0, parseUtil_js_1.addIssueToContext)(ctx, {
1401
+ code: ZodError_js_1.ZodIssueCode.invalid_string,
1402
1402
  validation: { endsWith: check.value },
1403
1403
  message: check.message,
1404
1404
  });
@@ -1409,8 +1409,8 @@ class ZodString extends ZodType {
1409
1409
  const regex = datetimeRegex(check);
1410
1410
  if (!regex.test(input.data)) {
1411
1411
  ctx = this._getOrReturnCtx(input, ctx);
1412
- (0, parseUtil_1.addIssueToContext)(ctx, {
1413
- code: ZodError_1.ZodIssueCode.invalid_string,
1412
+ (0, parseUtil_js_1.addIssueToContext)(ctx, {
1413
+ code: ZodError_js_1.ZodIssueCode.invalid_string,
1414
1414
  validation: "datetime",
1415
1415
  message: check.message,
1416
1416
  });
@@ -1421,8 +1421,8 @@ class ZodString extends ZodType {
1421
1421
  const regex = dateRegex;
1422
1422
  if (!regex.test(input.data)) {
1423
1423
  ctx = this._getOrReturnCtx(input, ctx);
1424
- (0, parseUtil_1.addIssueToContext)(ctx, {
1425
- code: ZodError_1.ZodIssueCode.invalid_string,
1424
+ (0, parseUtil_js_1.addIssueToContext)(ctx, {
1425
+ code: ZodError_js_1.ZodIssueCode.invalid_string,
1426
1426
  validation: "date",
1427
1427
  message: check.message,
1428
1428
  });
@@ -1433,8 +1433,8 @@ class ZodString extends ZodType {
1433
1433
  const regex = timeRegex(check);
1434
1434
  if (!regex.test(input.data)) {
1435
1435
  ctx = this._getOrReturnCtx(input, ctx);
1436
- (0, parseUtil_1.addIssueToContext)(ctx, {
1437
- code: ZodError_1.ZodIssueCode.invalid_string,
1436
+ (0, parseUtil_js_1.addIssueToContext)(ctx, {
1437
+ code: ZodError_js_1.ZodIssueCode.invalid_string,
1438
1438
  validation: "time",
1439
1439
  message: check.message,
1440
1440
  });
@@ -1444,9 +1444,9 @@ class ZodString extends ZodType {
1444
1444
  else if (check.kind === "duration") {
1445
1445
  if (!durationRegex.test(input.data)) {
1446
1446
  ctx = this._getOrReturnCtx(input, ctx);
1447
- (0, parseUtil_1.addIssueToContext)(ctx, {
1447
+ (0, parseUtil_js_1.addIssueToContext)(ctx, {
1448
1448
  validation: "duration",
1449
- code: ZodError_1.ZodIssueCode.invalid_string,
1449
+ code: ZodError_js_1.ZodIssueCode.invalid_string,
1450
1450
  message: check.message,
1451
1451
  });
1452
1452
  status.dirty();
@@ -1455,9 +1455,9 @@ class ZodString extends ZodType {
1455
1455
  else if (check.kind === "ip") {
1456
1456
  if (!isValidIP(input.data, check.version)) {
1457
1457
  ctx = this._getOrReturnCtx(input, ctx);
1458
- (0, parseUtil_1.addIssueToContext)(ctx, {
1458
+ (0, parseUtil_js_1.addIssueToContext)(ctx, {
1459
1459
  validation: "ip",
1460
- code: ZodError_1.ZodIssueCode.invalid_string,
1460
+ code: ZodError_js_1.ZodIssueCode.invalid_string,
1461
1461
  message: check.message,
1462
1462
  });
1463
1463
  status.dirty();
@@ -1466,9 +1466,9 @@ class ZodString extends ZodType {
1466
1466
  else if (check.kind === "jwt") {
1467
1467
  if (!isValidJWT(input.data, check.alg)) {
1468
1468
  ctx = this._getOrReturnCtx(input, ctx);
1469
- (0, parseUtil_1.addIssueToContext)(ctx, {
1469
+ (0, parseUtil_js_1.addIssueToContext)(ctx, {
1470
1470
  validation: "jwt",
1471
- code: ZodError_1.ZodIssueCode.invalid_string,
1471
+ code: ZodError_js_1.ZodIssueCode.invalid_string,
1472
1472
  message: check.message,
1473
1473
  });
1474
1474
  status.dirty();
@@ -1477,9 +1477,9 @@ class ZodString extends ZodType {
1477
1477
  else if (check.kind === "cidr") {
1478
1478
  if (!isValidCidr(input.data, check.version)) {
1479
1479
  ctx = this._getOrReturnCtx(input, ctx);
1480
- (0, parseUtil_1.addIssueToContext)(ctx, {
1480
+ (0, parseUtil_js_1.addIssueToContext)(ctx, {
1481
1481
  validation: "cidr",
1482
- code: ZodError_1.ZodIssueCode.invalid_string,
1482
+ code: ZodError_js_1.ZodIssueCode.invalid_string,
1483
1483
  message: check.message,
1484
1484
  });
1485
1485
  status.dirty();
@@ -1488,9 +1488,9 @@ class ZodString extends ZodType {
1488
1488
  else if (check.kind === "base64") {
1489
1489
  if (!base64Regex.test(input.data)) {
1490
1490
  ctx = this._getOrReturnCtx(input, ctx);
1491
- (0, parseUtil_1.addIssueToContext)(ctx, {
1491
+ (0, parseUtil_js_1.addIssueToContext)(ctx, {
1492
1492
  validation: "base64",
1493
- code: ZodError_1.ZodIssueCode.invalid_string,
1493
+ code: ZodError_js_1.ZodIssueCode.invalid_string,
1494
1494
  message: check.message,
1495
1495
  });
1496
1496
  status.dirty();
@@ -1499,16 +1499,16 @@ class ZodString extends ZodType {
1499
1499
  else if (check.kind === "base64url") {
1500
1500
  if (!base64urlRegex.test(input.data)) {
1501
1501
  ctx = this._getOrReturnCtx(input, ctx);
1502
- (0, parseUtil_1.addIssueToContext)(ctx, {
1502
+ (0, parseUtil_js_1.addIssueToContext)(ctx, {
1503
1503
  validation: "base64url",
1504
- code: ZodError_1.ZodIssueCode.invalid_string,
1504
+ code: ZodError_js_1.ZodIssueCode.invalid_string,
1505
1505
  message: check.message,
1506
1506
  });
1507
1507
  status.dirty();
1508
1508
  }
1509
1509
  }
1510
1510
  else {
1511
- util_1.util.assertNever(check);
1511
+ util_js_1.util.assertNever(check);
1512
1512
  }
1513
1513
  }
1514
1514
  return { status: status.value, value: input.data };
@@ -1516,8 +1516,8 @@ class ZodString extends ZodType {
1516
1516
  _regex(regex, validation, message) {
1517
1517
  return this.refinement((data) => regex.test(data), {
1518
1518
  validation,
1519
- code: ZodError_1.ZodIssueCode.invalid_string,
1520
- ...errorUtil_1.errorUtil.errToObj(message),
1519
+ code: ZodError_js_1.ZodIssueCode.invalid_string,
1520
+ ...errorUtil_js_1.errorUtil.errToObj(message),
1521
1521
  });
1522
1522
  }
1523
1523
  _addCheck(check) {
@@ -1527,50 +1527,49 @@ class ZodString extends ZodType {
1527
1527
  });
1528
1528
  }
1529
1529
  email(message) {
1530
- return this._addCheck({ kind: "email", ...errorUtil_1.errorUtil.errToObj(message) });
1530
+ return this._addCheck({ kind: "email", ...errorUtil_js_1.errorUtil.errToObj(message) });
1531
1531
  }
1532
1532
  url(message) {
1533
- return this._addCheck({ kind: "url", ...errorUtil_1.errorUtil.errToObj(message) });
1533
+ return this._addCheck({ kind: "url", ...errorUtil_js_1.errorUtil.errToObj(message) });
1534
1534
  }
1535
1535
  emoji(message) {
1536
- return this._addCheck({ kind: "emoji", ...errorUtil_1.errorUtil.errToObj(message) });
1536
+ return this._addCheck({ kind: "emoji", ...errorUtil_js_1.errorUtil.errToObj(message) });
1537
1537
  }
1538
1538
  uuid(message) {
1539
- return this._addCheck({ kind: "uuid", ...errorUtil_1.errorUtil.errToObj(message) });
1539
+ return this._addCheck({ kind: "uuid", ...errorUtil_js_1.errorUtil.errToObj(message) });
1540
1540
  }
1541
1541
  nanoid(message) {
1542
- return this._addCheck({ kind: "nanoid", ...errorUtil_1.errorUtil.errToObj(message) });
1542
+ return this._addCheck({ kind: "nanoid", ...errorUtil_js_1.errorUtil.errToObj(message) });
1543
1543
  }
1544
1544
  cuid(message) {
1545
- return this._addCheck({ kind: "cuid", ...errorUtil_1.errorUtil.errToObj(message) });
1545
+ return this._addCheck({ kind: "cuid", ...errorUtil_js_1.errorUtil.errToObj(message) });
1546
1546
  }
1547
1547
  cuid2(message) {
1548
- return this._addCheck({ kind: "cuid2", ...errorUtil_1.errorUtil.errToObj(message) });
1548
+ return this._addCheck({ kind: "cuid2", ...errorUtil_js_1.errorUtil.errToObj(message) });
1549
1549
  }
1550
1550
  ulid(message) {
1551
- return this._addCheck({ kind: "ulid", ...errorUtil_1.errorUtil.errToObj(message) });
1551
+ return this._addCheck({ kind: "ulid", ...errorUtil_js_1.errorUtil.errToObj(message) });
1552
1552
  }
1553
1553
  base64(message) {
1554
- return this._addCheck({ kind: "base64", ...errorUtil_1.errorUtil.errToObj(message) });
1554
+ return this._addCheck({ kind: "base64", ...errorUtil_js_1.errorUtil.errToObj(message) });
1555
1555
  }
1556
1556
  base64url(message) {
1557
1557
  // base64url encoding is a modification of base64 that can safely be used in URLs and filenames
1558
1558
  return this._addCheck({
1559
1559
  kind: "base64url",
1560
- ...errorUtil_1.errorUtil.errToObj(message),
1560
+ ...errorUtil_js_1.errorUtil.errToObj(message),
1561
1561
  });
1562
1562
  }
1563
1563
  jwt(options) {
1564
- return this._addCheck({ kind: "jwt", ...errorUtil_1.errorUtil.errToObj(options) });
1564
+ return this._addCheck({ kind: "jwt", ...errorUtil_js_1.errorUtil.errToObj(options) });
1565
1565
  }
1566
1566
  ip(options) {
1567
- return this._addCheck({ kind: "ip", ...errorUtil_1.errorUtil.errToObj(options) });
1567
+ return this._addCheck({ kind: "ip", ...errorUtil_js_1.errorUtil.errToObj(options) });
1568
1568
  }
1569
1569
  cidr(options) {
1570
- return this._addCheck({ kind: "cidr", ...errorUtil_1.errorUtil.errToObj(options) });
1570
+ return this._addCheck({ kind: "cidr", ...errorUtil_js_1.errorUtil.errToObj(options) });
1571
1571
  }
1572
1572
  datetime(options) {
1573
- var _a, _b;
1574
1573
  if (typeof options === "string") {
1575
1574
  return this._addCheck({
1576
1575
  kind: "datetime",
@@ -1582,10 +1581,10 @@ class ZodString extends ZodType {
1582
1581
  }
1583
1582
  return this._addCheck({
1584
1583
  kind: "datetime",
1585
- precision: typeof (options === null || options === void 0 ? void 0 : options.precision) === "undefined" ? null : options === null || options === void 0 ? void 0 : options.precision,
1586
- offset: (_a = options === null || options === void 0 ? void 0 : options.offset) !== null && _a !== void 0 ? _a : false,
1587
- local: (_b = options === null || options === void 0 ? void 0 : options.local) !== null && _b !== void 0 ? _b : false,
1588
- ...errorUtil_1.errorUtil.errToObj(options === null || options === void 0 ? void 0 : options.message),
1584
+ precision: typeof options?.precision === "undefined" ? null : options?.precision,
1585
+ offset: options?.offset ?? false,
1586
+ local: options?.local ?? false,
1587
+ ...errorUtil_js_1.errorUtil.errToObj(options?.message),
1589
1588
  });
1590
1589
  }
1591
1590
  date(message) {
@@ -1601,68 +1600,68 @@ class ZodString extends ZodType {
1601
1600
  }
1602
1601
  return this._addCheck({
1603
1602
  kind: "time",
1604
- precision: typeof (options === null || options === void 0 ? void 0 : options.precision) === "undefined" ? null : options === null || options === void 0 ? void 0 : options.precision,
1605
- ...errorUtil_1.errorUtil.errToObj(options === null || options === void 0 ? void 0 : options.message),
1603
+ precision: typeof options?.precision === "undefined" ? null : options?.precision,
1604
+ ...errorUtil_js_1.errorUtil.errToObj(options?.message),
1606
1605
  });
1607
1606
  }
1608
1607
  duration(message) {
1609
- return this._addCheck({ kind: "duration", ...errorUtil_1.errorUtil.errToObj(message) });
1608
+ return this._addCheck({ kind: "duration", ...errorUtil_js_1.errorUtil.errToObj(message) });
1610
1609
  }
1611
1610
  regex(regex, message) {
1612
1611
  return this._addCheck({
1613
1612
  kind: "regex",
1614
1613
  regex: regex,
1615
- ...errorUtil_1.errorUtil.errToObj(message),
1614
+ ...errorUtil_js_1.errorUtil.errToObj(message),
1616
1615
  });
1617
1616
  }
1618
1617
  includes(value, options) {
1619
1618
  return this._addCheck({
1620
1619
  kind: "includes",
1621
1620
  value: value,
1622
- position: options === null || options === void 0 ? void 0 : options.position,
1623
- ...errorUtil_1.errorUtil.errToObj(options === null || options === void 0 ? void 0 : options.message),
1621
+ position: options?.position,
1622
+ ...errorUtil_js_1.errorUtil.errToObj(options?.message),
1624
1623
  });
1625
1624
  }
1626
1625
  startsWith(value, message) {
1627
1626
  return this._addCheck({
1628
1627
  kind: "startsWith",
1629
1628
  value: value,
1630
- ...errorUtil_1.errorUtil.errToObj(message),
1629
+ ...errorUtil_js_1.errorUtil.errToObj(message),
1631
1630
  });
1632
1631
  }
1633
1632
  endsWith(value, message) {
1634
1633
  return this._addCheck({
1635
1634
  kind: "endsWith",
1636
1635
  value: value,
1637
- ...errorUtil_1.errorUtil.errToObj(message),
1636
+ ...errorUtil_js_1.errorUtil.errToObj(message),
1638
1637
  });
1639
1638
  }
1640
1639
  min(minLength, message) {
1641
1640
  return this._addCheck({
1642
1641
  kind: "min",
1643
1642
  value: minLength,
1644
- ...errorUtil_1.errorUtil.errToObj(message),
1643
+ ...errorUtil_js_1.errorUtil.errToObj(message),
1645
1644
  });
1646
1645
  }
1647
1646
  max(maxLength, message) {
1648
1647
  return this._addCheck({
1649
1648
  kind: "max",
1650
1649
  value: maxLength,
1651
- ...errorUtil_1.errorUtil.errToObj(message),
1650
+ ...errorUtil_js_1.errorUtil.errToObj(message),
1652
1651
  });
1653
1652
  }
1654
1653
  length(len, message) {
1655
1654
  return this._addCheck({
1656
1655
  kind: "length",
1657
1656
  value: len,
1658
- ...errorUtil_1.errorUtil.errToObj(message),
1657
+ ...errorUtil_js_1.errorUtil.errToObj(message),
1659
1658
  });
1660
1659
  }
1661
1660
  /**
1662
1661
  * Equivalent to `.min(1)`
1663
1662
  */
1664
1663
  nonempty(message) {
1665
- return this.min(1, errorUtil_1.errorUtil.errToObj(message));
1664
+ return this.min(1, errorUtil_js_1.errorUtil.errToObj(message));
1666
1665
  }
1667
1666
  trim() {
1668
1667
  return new ZodString({
@@ -1754,11 +1753,10 @@ class ZodString extends ZodType {
1754
1753
  }
1755
1754
  exports.ZodString = ZodString;
1756
1755
  ZodString.create = (params) => {
1757
- var _a;
1758
1756
  return new ZodString({
1759
1757
  checks: [],
1760
1758
  typeName: ZodFirstPartyTypeKind.ZodString,
1761
- coerce: (_a = params === null || params === void 0 ? void 0 : params.coerce) !== null && _a !== void 0 ? _a : false,
1759
+ coerce: params?.coerce ?? false,
1762
1760
  ...processCreateParams(params),
1763
1761
  });
1764
1762
  };
@@ -1767,9 +1765,9 @@ function floatSafeRemainder(val, step) {
1767
1765
  const valDecCount = (val.toString().split(".")[1] || "").length;
1768
1766
  const stepDecCount = (step.toString().split(".")[1] || "").length;
1769
1767
  const decCount = valDecCount > stepDecCount ? valDecCount : stepDecCount;
1770
- const valInt = parseInt(val.toFixed(decCount).replace(".", ""));
1771
- const stepInt = parseInt(step.toFixed(decCount).replace(".", ""));
1772
- return (valInt % stepInt) / Math.pow(10, decCount);
1768
+ const valInt = Number.parseInt(val.toFixed(decCount).replace(".", ""));
1769
+ const stepInt = Number.parseInt(step.toFixed(decCount).replace(".", ""));
1770
+ return (valInt % stepInt) / 10 ** decCount;
1773
1771
  }
1774
1772
  class ZodNumber extends ZodType {
1775
1773
  constructor() {
@@ -1783,23 +1781,23 @@ class ZodNumber extends ZodType {
1783
1781
  input.data = Number(input.data);
1784
1782
  }
1785
1783
  const parsedType = this._getType(input);
1786
- if (parsedType !== util_1.ZodParsedType.number) {
1784
+ if (parsedType !== util_js_1.ZodParsedType.number) {
1787
1785
  const ctx = this._getOrReturnCtx(input);
1788
- (0, parseUtil_1.addIssueToContext)(ctx, {
1789
- code: ZodError_1.ZodIssueCode.invalid_type,
1790
- expected: util_1.ZodParsedType.number,
1786
+ (0, parseUtil_js_1.addIssueToContext)(ctx, {
1787
+ code: ZodError_js_1.ZodIssueCode.invalid_type,
1788
+ expected: util_js_1.ZodParsedType.number,
1791
1789
  received: ctx.parsedType,
1792
1790
  });
1793
- return parseUtil_1.INVALID;
1791
+ return parseUtil_js_1.INVALID;
1794
1792
  }
1795
1793
  let ctx = undefined;
1796
- const status = new parseUtil_1.ParseStatus();
1794
+ const status = new parseUtil_js_1.ParseStatus();
1797
1795
  for (const check of this._def.checks) {
1798
1796
  if (check.kind === "int") {
1799
- if (!util_1.util.isInteger(input.data)) {
1797
+ if (!util_js_1.util.isInteger(input.data)) {
1800
1798
  ctx = this._getOrReturnCtx(input, ctx);
1801
- (0, parseUtil_1.addIssueToContext)(ctx, {
1802
- code: ZodError_1.ZodIssueCode.invalid_type,
1799
+ (0, parseUtil_js_1.addIssueToContext)(ctx, {
1800
+ code: ZodError_js_1.ZodIssueCode.invalid_type,
1803
1801
  expected: "integer",
1804
1802
  received: "float",
1805
1803
  message: check.message,
@@ -1808,13 +1806,11 @@ class ZodNumber extends ZodType {
1808
1806
  }
1809
1807
  }
1810
1808
  else if (check.kind === "min") {
1811
- const tooSmall = check.inclusive
1812
- ? input.data < check.value
1813
- : input.data <= check.value;
1809
+ const tooSmall = check.inclusive ? input.data < check.value : input.data <= check.value;
1814
1810
  if (tooSmall) {
1815
1811
  ctx = this._getOrReturnCtx(input, ctx);
1816
- (0, parseUtil_1.addIssueToContext)(ctx, {
1817
- code: ZodError_1.ZodIssueCode.too_small,
1812
+ (0, parseUtil_js_1.addIssueToContext)(ctx, {
1813
+ code: ZodError_js_1.ZodIssueCode.too_small,
1818
1814
  minimum: check.value,
1819
1815
  type: "number",
1820
1816
  inclusive: check.inclusive,
@@ -1825,13 +1821,11 @@ class ZodNumber extends ZodType {
1825
1821
  }
1826
1822
  }
1827
1823
  else if (check.kind === "max") {
1828
- const tooBig = check.inclusive
1829
- ? input.data > check.value
1830
- : input.data >= check.value;
1824
+ const tooBig = check.inclusive ? input.data > check.value : input.data >= check.value;
1831
1825
  if (tooBig) {
1832
1826
  ctx = this._getOrReturnCtx(input, ctx);
1833
- (0, parseUtil_1.addIssueToContext)(ctx, {
1834
- code: ZodError_1.ZodIssueCode.too_big,
1827
+ (0, parseUtil_js_1.addIssueToContext)(ctx, {
1828
+ code: ZodError_js_1.ZodIssueCode.too_big,
1835
1829
  maximum: check.value,
1836
1830
  type: "number",
1837
1831
  inclusive: check.inclusive,
@@ -1844,8 +1838,8 @@ class ZodNumber extends ZodType {
1844
1838
  else if (check.kind === "multipleOf") {
1845
1839
  if (floatSafeRemainder(input.data, check.value) !== 0) {
1846
1840
  ctx = this._getOrReturnCtx(input, ctx);
1847
- (0, parseUtil_1.addIssueToContext)(ctx, {
1848
- code: ZodError_1.ZodIssueCode.not_multiple_of,
1841
+ (0, parseUtil_js_1.addIssueToContext)(ctx, {
1842
+ code: ZodError_js_1.ZodIssueCode.not_multiple_of,
1849
1843
  multipleOf: check.value,
1850
1844
  message: check.message,
1851
1845
  });
@@ -1855,30 +1849,30 @@ class ZodNumber extends ZodType {
1855
1849
  else if (check.kind === "finite") {
1856
1850
  if (!Number.isFinite(input.data)) {
1857
1851
  ctx = this._getOrReturnCtx(input, ctx);
1858
- (0, parseUtil_1.addIssueToContext)(ctx, {
1859
- code: ZodError_1.ZodIssueCode.not_finite,
1852
+ (0, parseUtil_js_1.addIssueToContext)(ctx, {
1853
+ code: ZodError_js_1.ZodIssueCode.not_finite,
1860
1854
  message: check.message,
1861
1855
  });
1862
1856
  status.dirty();
1863
1857
  }
1864
1858
  }
1865
1859
  else {
1866
- util_1.util.assertNever(check);
1860
+ util_js_1.util.assertNever(check);
1867
1861
  }
1868
1862
  }
1869
1863
  return { status: status.value, value: input.data };
1870
1864
  }
1871
1865
  gte(value, message) {
1872
- return this.setLimit("min", value, true, errorUtil_1.errorUtil.toString(message));
1866
+ return this.setLimit("min", value, true, errorUtil_js_1.errorUtil.toString(message));
1873
1867
  }
1874
1868
  gt(value, message) {
1875
- return this.setLimit("min", value, false, errorUtil_1.errorUtil.toString(message));
1869
+ return this.setLimit("min", value, false, errorUtil_js_1.errorUtil.toString(message));
1876
1870
  }
1877
1871
  lte(value, message) {
1878
- return this.setLimit("max", value, true, errorUtil_1.errorUtil.toString(message));
1872
+ return this.setLimit("max", value, true, errorUtil_js_1.errorUtil.toString(message));
1879
1873
  }
1880
1874
  lt(value, message) {
1881
- return this.setLimit("max", value, false, errorUtil_1.errorUtil.toString(message));
1875
+ return this.setLimit("max", value, false, errorUtil_js_1.errorUtil.toString(message));
1882
1876
  }
1883
1877
  setLimit(kind, value, inclusive, message) {
1884
1878
  return new ZodNumber({
@@ -1889,7 +1883,7 @@ class ZodNumber extends ZodType {
1889
1883
  kind,
1890
1884
  value,
1891
1885
  inclusive,
1892
- message: errorUtil_1.errorUtil.toString(message),
1886
+ message: errorUtil_js_1.errorUtil.toString(message),
1893
1887
  },
1894
1888
  ],
1895
1889
  });
@@ -1903,7 +1897,7 @@ class ZodNumber extends ZodType {
1903
1897
  int(message) {
1904
1898
  return this._addCheck({
1905
1899
  kind: "int",
1906
- message: errorUtil_1.errorUtil.toString(message),
1900
+ message: errorUtil_js_1.errorUtil.toString(message),
1907
1901
  });
1908
1902
  }
1909
1903
  positive(message) {
@@ -1911,7 +1905,7 @@ class ZodNumber extends ZodType {
1911
1905
  kind: "min",
1912
1906
  value: 0,
1913
1907
  inclusive: false,
1914
- message: errorUtil_1.errorUtil.toString(message),
1908
+ message: errorUtil_js_1.errorUtil.toString(message),
1915
1909
  });
1916
1910
  }
1917
1911
  negative(message) {
@@ -1919,7 +1913,7 @@ class ZodNumber extends ZodType {
1919
1913
  kind: "max",
1920
1914
  value: 0,
1921
1915
  inclusive: false,
1922
- message: errorUtil_1.errorUtil.toString(message),
1916
+ message: errorUtil_js_1.errorUtil.toString(message),
1923
1917
  });
1924
1918
  }
1925
1919
  nonpositive(message) {
@@ -1927,7 +1921,7 @@ class ZodNumber extends ZodType {
1927
1921
  kind: "max",
1928
1922
  value: 0,
1929
1923
  inclusive: true,
1930
- message: errorUtil_1.errorUtil.toString(message),
1924
+ message: errorUtil_js_1.errorUtil.toString(message),
1931
1925
  });
1932
1926
  }
1933
1927
  nonnegative(message) {
@@ -1935,20 +1929,20 @@ class ZodNumber extends ZodType {
1935
1929
  kind: "min",
1936
1930
  value: 0,
1937
1931
  inclusive: true,
1938
- message: errorUtil_1.errorUtil.toString(message),
1932
+ message: errorUtil_js_1.errorUtil.toString(message),
1939
1933
  });
1940
1934
  }
1941
1935
  multipleOf(value, message) {
1942
1936
  return this._addCheck({
1943
1937
  kind: "multipleOf",
1944
1938
  value: value,
1945
- message: errorUtil_1.errorUtil.toString(message),
1939
+ message: errorUtil_js_1.errorUtil.toString(message),
1946
1940
  });
1947
1941
  }
1948
1942
  finite(message) {
1949
1943
  return this._addCheck({
1950
1944
  kind: "finite",
1951
- message: errorUtil_1.errorUtil.toString(message),
1945
+ message: errorUtil_js_1.errorUtil.toString(message),
1952
1946
  });
1953
1947
  }
1954
1948
  safe(message) {
@@ -1956,12 +1950,12 @@ class ZodNumber extends ZodType {
1956
1950
  kind: "min",
1957
1951
  inclusive: true,
1958
1952
  value: Number.MIN_SAFE_INTEGER,
1959
- message: errorUtil_1.errorUtil.toString(message),
1953
+ message: errorUtil_js_1.errorUtil.toString(message),
1960
1954
  })._addCheck({
1961
1955
  kind: "max",
1962
1956
  inclusive: true,
1963
1957
  value: Number.MAX_SAFE_INTEGER,
1964
- message: errorUtil_1.errorUtil.toString(message),
1958
+ message: errorUtil_js_1.errorUtil.toString(message),
1965
1959
  });
1966
1960
  }
1967
1961
  get minValue() {
@@ -1985,15 +1979,13 @@ class ZodNumber extends ZodType {
1985
1979
  return max;
1986
1980
  }
1987
1981
  get isInt() {
1988
- return !!this._def.checks.find((ch) => ch.kind === "int" ||
1989
- (ch.kind === "multipleOf" && util_1.util.isInteger(ch.value)));
1982
+ return !!this._def.checks.find((ch) => ch.kind === "int" || (ch.kind === "multipleOf" && util_js_1.util.isInteger(ch.value)));
1990
1983
  }
1991
1984
  get isFinite() {
1992
- let max = null, min = null;
1985
+ let max = null;
1986
+ let min = null;
1993
1987
  for (const ch of this._def.checks) {
1994
- if (ch.kind === "finite" ||
1995
- ch.kind === "int" ||
1996
- ch.kind === "multipleOf") {
1988
+ if (ch.kind === "finite" || ch.kind === "int" || ch.kind === "multipleOf") {
1997
1989
  return true;
1998
1990
  }
1999
1991
  else if (ch.kind === "min") {
@@ -2013,7 +2005,7 @@ ZodNumber.create = (params) => {
2013
2005
  return new ZodNumber({
2014
2006
  checks: [],
2015
2007
  typeName: ZodFirstPartyTypeKind.ZodNumber,
2016
- coerce: (params === null || params === void 0 ? void 0 : params.coerce) || false,
2008
+ coerce: params?.coerce || false,
2017
2009
  ...processCreateParams(params),
2018
2010
  });
2019
2011
  };
@@ -2028,25 +2020,23 @@ class ZodBigInt extends ZodType {
2028
2020
  try {
2029
2021
  input.data = BigInt(input.data);
2030
2022
  }
2031
- catch (_a) {
2023
+ catch {
2032
2024
  return this._getInvalidInput(input);
2033
2025
  }
2034
2026
  }
2035
2027
  const parsedType = this._getType(input);
2036
- if (parsedType !== util_1.ZodParsedType.bigint) {
2028
+ if (parsedType !== util_js_1.ZodParsedType.bigint) {
2037
2029
  return this._getInvalidInput(input);
2038
2030
  }
2039
2031
  let ctx = undefined;
2040
- const status = new parseUtil_1.ParseStatus();
2032
+ const status = new parseUtil_js_1.ParseStatus();
2041
2033
  for (const check of this._def.checks) {
2042
2034
  if (check.kind === "min") {
2043
- const tooSmall = check.inclusive
2044
- ? input.data < check.value
2045
- : input.data <= check.value;
2035
+ const tooSmall = check.inclusive ? input.data < check.value : input.data <= check.value;
2046
2036
  if (tooSmall) {
2047
2037
  ctx = this._getOrReturnCtx(input, ctx);
2048
- (0, parseUtil_1.addIssueToContext)(ctx, {
2049
- code: ZodError_1.ZodIssueCode.too_small,
2038
+ (0, parseUtil_js_1.addIssueToContext)(ctx, {
2039
+ code: ZodError_js_1.ZodIssueCode.too_small,
2050
2040
  type: "bigint",
2051
2041
  minimum: check.value,
2052
2042
  inclusive: check.inclusive,
@@ -2056,13 +2046,11 @@ class ZodBigInt extends ZodType {
2056
2046
  }
2057
2047
  }
2058
2048
  else if (check.kind === "max") {
2059
- const tooBig = check.inclusive
2060
- ? input.data > check.value
2061
- : input.data >= check.value;
2049
+ const tooBig = check.inclusive ? input.data > check.value : input.data >= check.value;
2062
2050
  if (tooBig) {
2063
2051
  ctx = this._getOrReturnCtx(input, ctx);
2064
- (0, parseUtil_1.addIssueToContext)(ctx, {
2065
- code: ZodError_1.ZodIssueCode.too_big,
2052
+ (0, parseUtil_js_1.addIssueToContext)(ctx, {
2053
+ code: ZodError_js_1.ZodIssueCode.too_big,
2066
2054
  type: "bigint",
2067
2055
  maximum: check.value,
2068
2056
  inclusive: check.inclusive,
@@ -2074,8 +2062,8 @@ class ZodBigInt extends ZodType {
2074
2062
  else if (check.kind === "multipleOf") {
2075
2063
  if (input.data % check.value !== BigInt(0)) {
2076
2064
  ctx = this._getOrReturnCtx(input, ctx);
2077
- (0, parseUtil_1.addIssueToContext)(ctx, {
2078
- code: ZodError_1.ZodIssueCode.not_multiple_of,
2065
+ (0, parseUtil_js_1.addIssueToContext)(ctx, {
2066
+ code: ZodError_js_1.ZodIssueCode.not_multiple_of,
2079
2067
  multipleOf: check.value,
2080
2068
  message: check.message,
2081
2069
  });
@@ -2083,31 +2071,31 @@ class ZodBigInt extends ZodType {
2083
2071
  }
2084
2072
  }
2085
2073
  else {
2086
- util_1.util.assertNever(check);
2074
+ util_js_1.util.assertNever(check);
2087
2075
  }
2088
2076
  }
2089
2077
  return { status: status.value, value: input.data };
2090
2078
  }
2091
2079
  _getInvalidInput(input) {
2092
2080
  const ctx = this._getOrReturnCtx(input);
2093
- (0, parseUtil_1.addIssueToContext)(ctx, {
2094
- code: ZodError_1.ZodIssueCode.invalid_type,
2095
- expected: util_1.ZodParsedType.bigint,
2081
+ (0, parseUtil_js_1.addIssueToContext)(ctx, {
2082
+ code: ZodError_js_1.ZodIssueCode.invalid_type,
2083
+ expected: util_js_1.ZodParsedType.bigint,
2096
2084
  received: ctx.parsedType,
2097
2085
  });
2098
- return parseUtil_1.INVALID;
2086
+ return parseUtil_js_1.INVALID;
2099
2087
  }
2100
2088
  gte(value, message) {
2101
- return this.setLimit("min", value, true, errorUtil_1.errorUtil.toString(message));
2089
+ return this.setLimit("min", value, true, errorUtil_js_1.errorUtil.toString(message));
2102
2090
  }
2103
2091
  gt(value, message) {
2104
- return this.setLimit("min", value, false, errorUtil_1.errorUtil.toString(message));
2092
+ return this.setLimit("min", value, false, errorUtil_js_1.errorUtil.toString(message));
2105
2093
  }
2106
2094
  lte(value, message) {
2107
- return this.setLimit("max", value, true, errorUtil_1.errorUtil.toString(message));
2095
+ return this.setLimit("max", value, true, errorUtil_js_1.errorUtil.toString(message));
2108
2096
  }
2109
2097
  lt(value, message) {
2110
- return this.setLimit("max", value, false, errorUtil_1.errorUtil.toString(message));
2098
+ return this.setLimit("max", value, false, errorUtil_js_1.errorUtil.toString(message));
2111
2099
  }
2112
2100
  setLimit(kind, value, inclusive, message) {
2113
2101
  return new ZodBigInt({
@@ -2118,7 +2106,7 @@ class ZodBigInt extends ZodType {
2118
2106
  kind,
2119
2107
  value,
2120
2108
  inclusive,
2121
- message: errorUtil_1.errorUtil.toString(message),
2109
+ message: errorUtil_js_1.errorUtil.toString(message),
2122
2110
  },
2123
2111
  ],
2124
2112
  });
@@ -2134,7 +2122,7 @@ class ZodBigInt extends ZodType {
2134
2122
  kind: "min",
2135
2123
  value: BigInt(0),
2136
2124
  inclusive: false,
2137
- message: errorUtil_1.errorUtil.toString(message),
2125
+ message: errorUtil_js_1.errorUtil.toString(message),
2138
2126
  });
2139
2127
  }
2140
2128
  negative(message) {
@@ -2142,7 +2130,7 @@ class ZodBigInt extends ZodType {
2142
2130
  kind: "max",
2143
2131
  value: BigInt(0),
2144
2132
  inclusive: false,
2145
- message: errorUtil_1.errorUtil.toString(message),
2133
+ message: errorUtil_js_1.errorUtil.toString(message),
2146
2134
  });
2147
2135
  }
2148
2136
  nonpositive(message) {
@@ -2150,7 +2138,7 @@ class ZodBigInt extends ZodType {
2150
2138
  kind: "max",
2151
2139
  value: BigInt(0),
2152
2140
  inclusive: true,
2153
- message: errorUtil_1.errorUtil.toString(message),
2141
+ message: errorUtil_js_1.errorUtil.toString(message),
2154
2142
  });
2155
2143
  }
2156
2144
  nonnegative(message) {
@@ -2158,14 +2146,14 @@ class ZodBigInt extends ZodType {
2158
2146
  kind: "min",
2159
2147
  value: BigInt(0),
2160
2148
  inclusive: true,
2161
- message: errorUtil_1.errorUtil.toString(message),
2149
+ message: errorUtil_js_1.errorUtil.toString(message),
2162
2150
  });
2163
2151
  }
2164
2152
  multipleOf(value, message) {
2165
2153
  return this._addCheck({
2166
2154
  kind: "multipleOf",
2167
2155
  value,
2168
- message: errorUtil_1.errorUtil.toString(message),
2156
+ message: errorUtil_js_1.errorUtil.toString(message),
2169
2157
  });
2170
2158
  }
2171
2159
  get minValue() {
@@ -2191,11 +2179,10 @@ class ZodBigInt extends ZodType {
2191
2179
  }
2192
2180
  exports.ZodBigInt = ZodBigInt;
2193
2181
  ZodBigInt.create = (params) => {
2194
- var _a;
2195
2182
  return new ZodBigInt({
2196
2183
  checks: [],
2197
2184
  typeName: ZodFirstPartyTypeKind.ZodBigInt,
2198
- coerce: (_a = params === null || params === void 0 ? void 0 : params.coerce) !== null && _a !== void 0 ? _a : false,
2185
+ coerce: params?.coerce ?? false,
2199
2186
  ...processCreateParams(params),
2200
2187
  });
2201
2188
  };
@@ -2205,23 +2192,23 @@ class ZodBoolean extends ZodType {
2205
2192
  input.data = Boolean(input.data);
2206
2193
  }
2207
2194
  const parsedType = this._getType(input);
2208
- if (parsedType !== util_1.ZodParsedType.boolean) {
2195
+ if (parsedType !== util_js_1.ZodParsedType.boolean) {
2209
2196
  const ctx = this._getOrReturnCtx(input);
2210
- (0, parseUtil_1.addIssueToContext)(ctx, {
2211
- code: ZodError_1.ZodIssueCode.invalid_type,
2212
- expected: util_1.ZodParsedType.boolean,
2197
+ (0, parseUtil_js_1.addIssueToContext)(ctx, {
2198
+ code: ZodError_js_1.ZodIssueCode.invalid_type,
2199
+ expected: util_js_1.ZodParsedType.boolean,
2213
2200
  received: ctx.parsedType,
2214
2201
  });
2215
- return parseUtil_1.INVALID;
2202
+ return parseUtil_js_1.INVALID;
2216
2203
  }
2217
- return (0, parseUtil_1.OK)(input.data);
2204
+ return (0, parseUtil_js_1.OK)(input.data);
2218
2205
  }
2219
2206
  }
2220
2207
  exports.ZodBoolean = ZodBoolean;
2221
2208
  ZodBoolean.create = (params) => {
2222
2209
  return new ZodBoolean({
2223
2210
  typeName: ZodFirstPartyTypeKind.ZodBoolean,
2224
- coerce: (params === null || params === void 0 ? void 0 : params.coerce) || false,
2211
+ coerce: params?.coerce || false,
2225
2212
  ...processCreateParams(params),
2226
2213
  });
2227
2214
  };
@@ -2231,30 +2218,30 @@ class ZodDate extends ZodType {
2231
2218
  input.data = new Date(input.data);
2232
2219
  }
2233
2220
  const parsedType = this._getType(input);
2234
- if (parsedType !== util_1.ZodParsedType.date) {
2221
+ if (parsedType !== util_js_1.ZodParsedType.date) {
2235
2222
  const ctx = this._getOrReturnCtx(input);
2236
- (0, parseUtil_1.addIssueToContext)(ctx, {
2237
- code: ZodError_1.ZodIssueCode.invalid_type,
2238
- expected: util_1.ZodParsedType.date,
2223
+ (0, parseUtil_js_1.addIssueToContext)(ctx, {
2224
+ code: ZodError_js_1.ZodIssueCode.invalid_type,
2225
+ expected: util_js_1.ZodParsedType.date,
2239
2226
  received: ctx.parsedType,
2240
2227
  });
2241
- return parseUtil_1.INVALID;
2228
+ return parseUtil_js_1.INVALID;
2242
2229
  }
2243
- if (isNaN(input.data.getTime())) {
2230
+ if (Number.isNaN(input.data.getTime())) {
2244
2231
  const ctx = this._getOrReturnCtx(input);
2245
- (0, parseUtil_1.addIssueToContext)(ctx, {
2246
- code: ZodError_1.ZodIssueCode.invalid_date,
2232
+ (0, parseUtil_js_1.addIssueToContext)(ctx, {
2233
+ code: ZodError_js_1.ZodIssueCode.invalid_date,
2247
2234
  });
2248
- return parseUtil_1.INVALID;
2235
+ return parseUtil_js_1.INVALID;
2249
2236
  }
2250
- const status = new parseUtil_1.ParseStatus();
2237
+ const status = new parseUtil_js_1.ParseStatus();
2251
2238
  let ctx = undefined;
2252
2239
  for (const check of this._def.checks) {
2253
2240
  if (check.kind === "min") {
2254
2241
  if (input.data.getTime() < check.value) {
2255
2242
  ctx = this._getOrReturnCtx(input, ctx);
2256
- (0, parseUtil_1.addIssueToContext)(ctx, {
2257
- code: ZodError_1.ZodIssueCode.too_small,
2243
+ (0, parseUtil_js_1.addIssueToContext)(ctx, {
2244
+ code: ZodError_js_1.ZodIssueCode.too_small,
2258
2245
  message: check.message,
2259
2246
  inclusive: true,
2260
2247
  exact: false,
@@ -2267,8 +2254,8 @@ class ZodDate extends ZodType {
2267
2254
  else if (check.kind === "max") {
2268
2255
  if (input.data.getTime() > check.value) {
2269
2256
  ctx = this._getOrReturnCtx(input, ctx);
2270
- (0, parseUtil_1.addIssueToContext)(ctx, {
2271
- code: ZodError_1.ZodIssueCode.too_big,
2257
+ (0, parseUtil_js_1.addIssueToContext)(ctx, {
2258
+ code: ZodError_js_1.ZodIssueCode.too_big,
2272
2259
  message: check.message,
2273
2260
  inclusive: true,
2274
2261
  exact: false,
@@ -2279,7 +2266,7 @@ class ZodDate extends ZodType {
2279
2266
  }
2280
2267
  }
2281
2268
  else {
2282
- util_1.util.assertNever(check);
2269
+ util_js_1.util.assertNever(check);
2283
2270
  }
2284
2271
  }
2285
2272
  return {
@@ -2297,14 +2284,14 @@ class ZodDate extends ZodType {
2297
2284
  return this._addCheck({
2298
2285
  kind: "min",
2299
2286
  value: minDate.getTime(),
2300
- message: errorUtil_1.errorUtil.toString(message),
2287
+ message: errorUtil_js_1.errorUtil.toString(message),
2301
2288
  });
2302
2289
  }
2303
2290
  max(maxDate, message) {
2304
2291
  return this._addCheck({
2305
2292
  kind: "max",
2306
2293
  value: maxDate.getTime(),
2307
- message: errorUtil_1.errorUtil.toString(message),
2294
+ message: errorUtil_js_1.errorUtil.toString(message),
2308
2295
  });
2309
2296
  }
2310
2297
  get minDate() {
@@ -2332,7 +2319,7 @@ exports.ZodDate = ZodDate;
2332
2319
  ZodDate.create = (params) => {
2333
2320
  return new ZodDate({
2334
2321
  checks: [],
2335
- coerce: (params === null || params === void 0 ? void 0 : params.coerce) || false,
2322
+ coerce: params?.coerce || false,
2336
2323
  typeName: ZodFirstPartyTypeKind.ZodDate,
2337
2324
  ...processCreateParams(params),
2338
2325
  });
@@ -2340,16 +2327,16 @@ ZodDate.create = (params) => {
2340
2327
  class ZodSymbol extends ZodType {
2341
2328
  _parse(input) {
2342
2329
  const parsedType = this._getType(input);
2343
- if (parsedType !== util_1.ZodParsedType.symbol) {
2330
+ if (parsedType !== util_js_1.ZodParsedType.symbol) {
2344
2331
  const ctx = this._getOrReturnCtx(input);
2345
- (0, parseUtil_1.addIssueToContext)(ctx, {
2346
- code: ZodError_1.ZodIssueCode.invalid_type,
2347
- expected: util_1.ZodParsedType.symbol,
2332
+ (0, parseUtil_js_1.addIssueToContext)(ctx, {
2333
+ code: ZodError_js_1.ZodIssueCode.invalid_type,
2334
+ expected: util_js_1.ZodParsedType.symbol,
2348
2335
  received: ctx.parsedType,
2349
2336
  });
2350
- return parseUtil_1.INVALID;
2337
+ return parseUtil_js_1.INVALID;
2351
2338
  }
2352
- return (0, parseUtil_1.OK)(input.data);
2339
+ return (0, parseUtil_js_1.OK)(input.data);
2353
2340
  }
2354
2341
  }
2355
2342
  exports.ZodSymbol = ZodSymbol;
@@ -2362,16 +2349,16 @@ ZodSymbol.create = (params) => {
2362
2349
  class ZodUndefined extends ZodType {
2363
2350
  _parse(input) {
2364
2351
  const parsedType = this._getType(input);
2365
- if (parsedType !== util_1.ZodParsedType.undefined) {
2352
+ if (parsedType !== util_js_1.ZodParsedType.undefined) {
2366
2353
  const ctx = this._getOrReturnCtx(input);
2367
- (0, parseUtil_1.addIssueToContext)(ctx, {
2368
- code: ZodError_1.ZodIssueCode.invalid_type,
2369
- expected: util_1.ZodParsedType.undefined,
2354
+ (0, parseUtil_js_1.addIssueToContext)(ctx, {
2355
+ code: ZodError_js_1.ZodIssueCode.invalid_type,
2356
+ expected: util_js_1.ZodParsedType.undefined,
2370
2357
  received: ctx.parsedType,
2371
2358
  });
2372
- return parseUtil_1.INVALID;
2359
+ return parseUtil_js_1.INVALID;
2373
2360
  }
2374
- return (0, parseUtil_1.OK)(input.data);
2361
+ return (0, parseUtil_js_1.OK)(input.data);
2375
2362
  }
2376
2363
  }
2377
2364
  exports.ZodUndefined = ZodUndefined;
@@ -2384,16 +2371,16 @@ ZodUndefined.create = (params) => {
2384
2371
  class ZodNull extends ZodType {
2385
2372
  _parse(input) {
2386
2373
  const parsedType = this._getType(input);
2387
- if (parsedType !== util_1.ZodParsedType.null) {
2374
+ if (parsedType !== util_js_1.ZodParsedType.null) {
2388
2375
  const ctx = this._getOrReturnCtx(input);
2389
- (0, parseUtil_1.addIssueToContext)(ctx, {
2390
- code: ZodError_1.ZodIssueCode.invalid_type,
2391
- expected: util_1.ZodParsedType.null,
2376
+ (0, parseUtil_js_1.addIssueToContext)(ctx, {
2377
+ code: ZodError_js_1.ZodIssueCode.invalid_type,
2378
+ expected: util_js_1.ZodParsedType.null,
2392
2379
  received: ctx.parsedType,
2393
2380
  });
2394
- return parseUtil_1.INVALID;
2381
+ return parseUtil_js_1.INVALID;
2395
2382
  }
2396
- return (0, parseUtil_1.OK)(input.data);
2383
+ return (0, parseUtil_js_1.OK)(input.data);
2397
2384
  }
2398
2385
  }
2399
2386
  exports.ZodNull = ZodNull;
@@ -2410,7 +2397,7 @@ class ZodAny extends ZodType {
2410
2397
  this._any = true;
2411
2398
  }
2412
2399
  _parse(input) {
2413
- return (0, parseUtil_1.OK)(input.data);
2400
+ return (0, parseUtil_js_1.OK)(input.data);
2414
2401
  }
2415
2402
  }
2416
2403
  exports.ZodAny = ZodAny;
@@ -2427,7 +2414,7 @@ class ZodUnknown extends ZodType {
2427
2414
  this._unknown = true;
2428
2415
  }
2429
2416
  _parse(input) {
2430
- return (0, parseUtil_1.OK)(input.data);
2417
+ return (0, parseUtil_js_1.OK)(input.data);
2431
2418
  }
2432
2419
  }
2433
2420
  exports.ZodUnknown = ZodUnknown;
@@ -2440,12 +2427,12 @@ ZodUnknown.create = (params) => {
2440
2427
  class ZodNever extends ZodType {
2441
2428
  _parse(input) {
2442
2429
  const ctx = this._getOrReturnCtx(input);
2443
- (0, parseUtil_1.addIssueToContext)(ctx, {
2444
- code: ZodError_1.ZodIssueCode.invalid_type,
2445
- expected: util_1.ZodParsedType.never,
2430
+ (0, parseUtil_js_1.addIssueToContext)(ctx, {
2431
+ code: ZodError_js_1.ZodIssueCode.invalid_type,
2432
+ expected: util_js_1.ZodParsedType.never,
2446
2433
  received: ctx.parsedType,
2447
2434
  });
2448
- return parseUtil_1.INVALID;
2435
+ return parseUtil_js_1.INVALID;
2449
2436
  }
2450
2437
  }
2451
2438
  exports.ZodNever = ZodNever;
@@ -2458,16 +2445,16 @@ ZodNever.create = (params) => {
2458
2445
  class ZodVoid extends ZodType {
2459
2446
  _parse(input) {
2460
2447
  const parsedType = this._getType(input);
2461
- if (parsedType !== util_1.ZodParsedType.undefined) {
2448
+ if (parsedType !== util_js_1.ZodParsedType.undefined) {
2462
2449
  const ctx = this._getOrReturnCtx(input);
2463
- (0, parseUtil_1.addIssueToContext)(ctx, {
2464
- code: ZodError_1.ZodIssueCode.invalid_type,
2465
- expected: util_1.ZodParsedType.void,
2450
+ (0, parseUtil_js_1.addIssueToContext)(ctx, {
2451
+ code: ZodError_js_1.ZodIssueCode.invalid_type,
2452
+ expected: util_js_1.ZodParsedType.void,
2466
2453
  received: ctx.parsedType,
2467
2454
  });
2468
- return parseUtil_1.INVALID;
2455
+ return parseUtil_js_1.INVALID;
2469
2456
  }
2470
- return (0, parseUtil_1.OK)(input.data);
2457
+ return (0, parseUtil_js_1.OK)(input.data);
2471
2458
  }
2472
2459
  }
2473
2460
  exports.ZodVoid = ZodVoid;
@@ -2481,20 +2468,20 @@ class ZodArray extends ZodType {
2481
2468
  _parse(input) {
2482
2469
  const { ctx, status } = this._processInputParams(input);
2483
2470
  const def = this._def;
2484
- if (ctx.parsedType !== util_1.ZodParsedType.array) {
2485
- (0, parseUtil_1.addIssueToContext)(ctx, {
2486
- code: ZodError_1.ZodIssueCode.invalid_type,
2487
- expected: util_1.ZodParsedType.array,
2471
+ if (ctx.parsedType !== util_js_1.ZodParsedType.array) {
2472
+ (0, parseUtil_js_1.addIssueToContext)(ctx, {
2473
+ code: ZodError_js_1.ZodIssueCode.invalid_type,
2474
+ expected: util_js_1.ZodParsedType.array,
2488
2475
  received: ctx.parsedType,
2489
2476
  });
2490
- return parseUtil_1.INVALID;
2477
+ return parseUtil_js_1.INVALID;
2491
2478
  }
2492
2479
  if (def.exactLength !== null) {
2493
2480
  const tooBig = ctx.data.length > def.exactLength.value;
2494
2481
  const tooSmall = ctx.data.length < def.exactLength.value;
2495
2482
  if (tooBig || tooSmall) {
2496
- (0, parseUtil_1.addIssueToContext)(ctx, {
2497
- code: tooBig ? ZodError_1.ZodIssueCode.too_big : ZodError_1.ZodIssueCode.too_small,
2483
+ (0, parseUtil_js_1.addIssueToContext)(ctx, {
2484
+ code: tooBig ? ZodError_js_1.ZodIssueCode.too_big : ZodError_js_1.ZodIssueCode.too_small,
2498
2485
  minimum: (tooSmall ? def.exactLength.value : undefined),
2499
2486
  maximum: (tooBig ? def.exactLength.value : undefined),
2500
2487
  type: "array",
@@ -2507,8 +2494,8 @@ class ZodArray extends ZodType {
2507
2494
  }
2508
2495
  if (def.minLength !== null) {
2509
2496
  if (ctx.data.length < def.minLength.value) {
2510
- (0, parseUtil_1.addIssueToContext)(ctx, {
2511
- code: ZodError_1.ZodIssueCode.too_small,
2497
+ (0, parseUtil_js_1.addIssueToContext)(ctx, {
2498
+ code: ZodError_js_1.ZodIssueCode.too_small,
2512
2499
  minimum: def.minLength.value,
2513
2500
  type: "array",
2514
2501
  inclusive: true,
@@ -2520,8 +2507,8 @@ class ZodArray extends ZodType {
2520
2507
  }
2521
2508
  if (def.maxLength !== null) {
2522
2509
  if (ctx.data.length > def.maxLength.value) {
2523
- (0, parseUtil_1.addIssueToContext)(ctx, {
2524
- code: ZodError_1.ZodIssueCode.too_big,
2510
+ (0, parseUtil_js_1.addIssueToContext)(ctx, {
2511
+ code: ZodError_js_1.ZodIssueCode.too_big,
2525
2512
  maximum: def.maxLength.value,
2526
2513
  type: "array",
2527
2514
  inclusive: true,
@@ -2535,13 +2522,13 @@ class ZodArray extends ZodType {
2535
2522
  return Promise.all([...ctx.data].map((item, i) => {
2536
2523
  return def.type._parseAsync(new ParseInputLazyPath(ctx, item, ctx.path, i));
2537
2524
  })).then((result) => {
2538
- return parseUtil_1.ParseStatus.mergeArray(status, result);
2525
+ return parseUtil_js_1.ParseStatus.mergeArray(status, result);
2539
2526
  });
2540
2527
  }
2541
2528
  const result = [...ctx.data].map((item, i) => {
2542
2529
  return def.type._parseSync(new ParseInputLazyPath(ctx, item, ctx.path, i));
2543
2530
  });
2544
- return parseUtil_1.ParseStatus.mergeArray(status, result);
2531
+ return parseUtil_js_1.ParseStatus.mergeArray(status, result);
2545
2532
  }
2546
2533
  get element() {
2547
2534
  return this._def.type;
@@ -2549,19 +2536,19 @@ class ZodArray extends ZodType {
2549
2536
  min(minLength, message) {
2550
2537
  return new ZodArray({
2551
2538
  ...this._def,
2552
- minLength: { value: minLength, message: errorUtil_1.errorUtil.toString(message) },
2539
+ minLength: { value: minLength, message: errorUtil_js_1.errorUtil.toString(message) },
2553
2540
  });
2554
2541
  }
2555
2542
  max(maxLength, message) {
2556
2543
  return new ZodArray({
2557
2544
  ...this._def,
2558
- maxLength: { value: maxLength, message: errorUtil_1.errorUtil.toString(message) },
2545
+ maxLength: { value: maxLength, message: errorUtil_js_1.errorUtil.toString(message) },
2559
2546
  });
2560
2547
  }
2561
2548
  length(len, message) {
2562
2549
  return new ZodArray({
2563
2550
  ...this._def,
2564
- exactLength: { value: len, message: errorUtil_1.errorUtil.toString(message) },
2551
+ exactLength: { value: len, message: errorUtil_js_1.errorUtil.toString(message) },
2565
2552
  });
2566
2553
  }
2567
2554
  nonempty(message) {
@@ -2661,25 +2648,25 @@ class ZodObject extends ZodType {
2661
2648
  if (this._cached !== null)
2662
2649
  return this._cached;
2663
2650
  const shape = this._def.shape();
2664
- const keys = util_1.util.objectKeys(shape);
2665
- return (this._cached = { shape, keys });
2651
+ const keys = util_js_1.util.objectKeys(shape);
2652
+ this._cached = { shape, keys };
2653
+ return this._cached;
2666
2654
  }
2667
2655
  _parse(input) {
2668
2656
  const parsedType = this._getType(input);
2669
- if (parsedType !== util_1.ZodParsedType.object) {
2657
+ if (parsedType !== util_js_1.ZodParsedType.object) {
2670
2658
  const ctx = this._getOrReturnCtx(input);
2671
- (0, parseUtil_1.addIssueToContext)(ctx, {
2672
- code: ZodError_1.ZodIssueCode.invalid_type,
2673
- expected: util_1.ZodParsedType.object,
2659
+ (0, parseUtil_js_1.addIssueToContext)(ctx, {
2660
+ code: ZodError_js_1.ZodIssueCode.invalid_type,
2661
+ expected: util_js_1.ZodParsedType.object,
2674
2662
  received: ctx.parsedType,
2675
2663
  });
2676
- return parseUtil_1.INVALID;
2664
+ return parseUtil_js_1.INVALID;
2677
2665
  }
2678
2666
  const { status, ctx } = this._processInputParams(input);
2679
2667
  const { shape, keys: shapeKeys } = this._getCached();
2680
2668
  const extraKeys = [];
2681
- if (!(this._def.catchall instanceof ZodNever &&
2682
- this._def.unknownKeys === "strip")) {
2669
+ if (!(this._def.catchall instanceof ZodNever && this._def.unknownKeys === "strip")) {
2683
2670
  for (const key in ctx.data) {
2684
2671
  if (!shapeKeys.includes(key)) {
2685
2672
  extraKeys.push(key);
@@ -2708,8 +2695,8 @@ class ZodObject extends ZodType {
2708
2695
  }
2709
2696
  else if (unknownKeys === "strict") {
2710
2697
  if (extraKeys.length > 0) {
2711
- (0, parseUtil_1.addIssueToContext)(ctx, {
2712
- code: ZodError_1.ZodIssueCode.unrecognized_keys,
2698
+ (0, parseUtil_js_1.addIssueToContext)(ctx, {
2699
+ code: ZodError_js_1.ZodIssueCode.unrecognized_keys,
2713
2700
  keys: extraKeys,
2714
2701
  });
2715
2702
  status.dirty();
@@ -2750,29 +2737,28 @@ class ZodObject extends ZodType {
2750
2737
  return syncPairs;
2751
2738
  })
2752
2739
  .then((syncPairs) => {
2753
- return parseUtil_1.ParseStatus.mergeObjectSync(status, syncPairs);
2740
+ return parseUtil_js_1.ParseStatus.mergeObjectSync(status, syncPairs);
2754
2741
  });
2755
2742
  }
2756
2743
  else {
2757
- return parseUtil_1.ParseStatus.mergeObjectSync(status, pairs);
2744
+ return parseUtil_js_1.ParseStatus.mergeObjectSync(status, pairs);
2758
2745
  }
2759
2746
  }
2760
2747
  get shape() {
2761
2748
  return this._def.shape();
2762
2749
  }
2763
2750
  strict(message) {
2764
- errorUtil_1.errorUtil.errToObj;
2751
+ errorUtil_js_1.errorUtil.errToObj;
2765
2752
  return new ZodObject({
2766
2753
  ...this._def,
2767
2754
  unknownKeys: "strict",
2768
2755
  ...(message !== undefined
2769
2756
  ? {
2770
2757
  errorMap: (issue, ctx) => {
2771
- var _a, _b, _c, _d;
2772
- const defaultError = (_c = (_b = (_a = this._def).errorMap) === null || _b === void 0 ? void 0 : _b.call(_a, issue, ctx).message) !== null && _c !== void 0 ? _c : ctx.defaultError;
2758
+ const defaultError = this._def.errorMap?.(issue, ctx).message ?? ctx.defaultError;
2773
2759
  if (issue.code === "unrecognized_keys")
2774
2760
  return {
2775
- message: (_d = errorUtil_1.errorUtil.errToObj(message).message) !== null && _d !== void 0 ? _d : defaultError,
2761
+ message: errorUtil_js_1.errorUtil.errToObj(message).message ?? defaultError,
2776
2762
  };
2777
2763
  return {
2778
2764
  message: defaultError,
@@ -2904,11 +2890,11 @@ class ZodObject extends ZodType {
2904
2890
  }
2905
2891
  pick(mask) {
2906
2892
  const shape = {};
2907
- util_1.util.objectKeys(mask).forEach((key) => {
2893
+ for (const key of util_js_1.util.objectKeys(mask)) {
2908
2894
  if (mask[key] && this.shape[key]) {
2909
2895
  shape[key] = this.shape[key];
2910
2896
  }
2911
- });
2897
+ }
2912
2898
  return new ZodObject({
2913
2899
  ...this._def,
2914
2900
  shape: () => shape,
@@ -2916,11 +2902,11 @@ class ZodObject extends ZodType {
2916
2902
  }
2917
2903
  omit(mask) {
2918
2904
  const shape = {};
2919
- util_1.util.objectKeys(this.shape).forEach((key) => {
2905
+ for (const key of util_js_1.util.objectKeys(this.shape)) {
2920
2906
  if (!mask[key]) {
2921
2907
  shape[key] = this.shape[key];
2922
2908
  }
2923
- });
2909
+ }
2924
2910
  return new ZodObject({
2925
2911
  ...this._def,
2926
2912
  shape: () => shape,
@@ -2934,7 +2920,7 @@ class ZodObject extends ZodType {
2934
2920
  }
2935
2921
  partial(mask) {
2936
2922
  const newShape = {};
2937
- util_1.util.objectKeys(this.shape).forEach((key) => {
2923
+ for (const key of util_js_1.util.objectKeys(this.shape)) {
2938
2924
  const fieldSchema = this.shape[key];
2939
2925
  if (mask && !mask[key]) {
2940
2926
  newShape[key] = fieldSchema;
@@ -2942,7 +2928,7 @@ class ZodObject extends ZodType {
2942
2928
  else {
2943
2929
  newShape[key] = fieldSchema.optional();
2944
2930
  }
2945
- });
2931
+ }
2946
2932
  return new ZodObject({
2947
2933
  ...this._def,
2948
2934
  shape: () => newShape,
@@ -2950,7 +2936,7 @@ class ZodObject extends ZodType {
2950
2936
  }
2951
2937
  required(mask) {
2952
2938
  const newShape = {};
2953
- util_1.util.objectKeys(this.shape).forEach((key) => {
2939
+ for (const key of util_js_1.util.objectKeys(this.shape)) {
2954
2940
  if (mask && !mask[key]) {
2955
2941
  newShape[key] = this.shape[key];
2956
2942
  }
@@ -2962,14 +2948,14 @@ class ZodObject extends ZodType {
2962
2948
  }
2963
2949
  newShape[key] = newField;
2964
2950
  }
2965
- });
2951
+ }
2966
2952
  return new ZodObject({
2967
2953
  ...this._def,
2968
2954
  shape: () => newShape,
2969
2955
  });
2970
2956
  }
2971
2957
  keyof() {
2972
- return createZodEnum(util_1.util.objectKeys(this.shape));
2958
+ return createZodEnum(util_js_1.util.objectKeys(this.shape));
2973
2959
  }
2974
2960
  }
2975
2961
  exports.ZodObject = ZodObject;
@@ -3019,12 +3005,12 @@ class ZodUnion extends ZodType {
3019
3005
  }
3020
3006
  }
3021
3007
  // return invalid
3022
- const unionErrors = results.map((result) => new ZodError_1.ZodError(result.ctx.common.issues));
3023
- (0, parseUtil_1.addIssueToContext)(ctx, {
3024
- code: ZodError_1.ZodIssueCode.invalid_union,
3008
+ const unionErrors = results.map((result) => new ZodError_js_1.ZodError(result.ctx.common.issues));
3009
+ (0, parseUtil_js_1.addIssueToContext)(ctx, {
3010
+ code: ZodError_js_1.ZodIssueCode.invalid_union,
3025
3011
  unionErrors,
3026
3012
  });
3027
- return parseUtil_1.INVALID;
3013
+ return parseUtil_js_1.INVALID;
3028
3014
  }
3029
3015
  if (ctx.common.async) {
3030
3016
  return Promise.all(options.map(async (option) => {
@@ -3077,12 +3063,12 @@ class ZodUnion extends ZodType {
3077
3063
  ctx.common.issues.push(...dirty.ctx.common.issues);
3078
3064
  return dirty.result;
3079
3065
  }
3080
- const unionErrors = issues.map((issues) => new ZodError_1.ZodError(issues));
3081
- (0, parseUtil_1.addIssueToContext)(ctx, {
3082
- code: ZodError_1.ZodIssueCode.invalid_union,
3066
+ const unionErrors = issues.map((issues) => new ZodError_js_1.ZodError(issues));
3067
+ (0, parseUtil_js_1.addIssueToContext)(ctx, {
3068
+ code: ZodError_js_1.ZodIssueCode.invalid_union,
3083
3069
  unionErrors,
3084
3070
  });
3085
- return parseUtil_1.INVALID;
3071
+ return parseUtil_js_1.INVALID;
3086
3072
  }
3087
3073
  }
3088
3074
  get options() {
@@ -3119,7 +3105,7 @@ const getDiscriminator = (type) => {
3119
3105
  }
3120
3106
  else if (type instanceof ZodNativeEnum) {
3121
3107
  // eslint-disable-next-line ban/ban
3122
- return util_1.util.objectValues(type.enum);
3108
+ return util_js_1.util.objectValues(type.enum);
3123
3109
  }
3124
3110
  else if (type instanceof ZodDefault) {
3125
3111
  return getDiscriminator(type._def.innerType);
@@ -3152,24 +3138,24 @@ const getDiscriminator = (type) => {
3152
3138
  class ZodDiscriminatedUnion extends ZodType {
3153
3139
  _parse(input) {
3154
3140
  const { ctx } = this._processInputParams(input);
3155
- if (ctx.parsedType !== util_1.ZodParsedType.object) {
3156
- (0, parseUtil_1.addIssueToContext)(ctx, {
3157
- code: ZodError_1.ZodIssueCode.invalid_type,
3158
- expected: util_1.ZodParsedType.object,
3141
+ if (ctx.parsedType !== util_js_1.ZodParsedType.object) {
3142
+ (0, parseUtil_js_1.addIssueToContext)(ctx, {
3143
+ code: ZodError_js_1.ZodIssueCode.invalid_type,
3144
+ expected: util_js_1.ZodParsedType.object,
3159
3145
  received: ctx.parsedType,
3160
3146
  });
3161
- return parseUtil_1.INVALID;
3147
+ return parseUtil_js_1.INVALID;
3162
3148
  }
3163
3149
  const discriminator = this.discriminator;
3164
3150
  const discriminatorValue = ctx.data[discriminator];
3165
3151
  const option = this.optionsMap.get(discriminatorValue);
3166
3152
  if (!option) {
3167
- (0, parseUtil_1.addIssueToContext)(ctx, {
3168
- code: ZodError_1.ZodIssueCode.invalid_union_discriminator,
3153
+ (0, parseUtil_js_1.addIssueToContext)(ctx, {
3154
+ code: ZodError_js_1.ZodIssueCode.invalid_union_discriminator,
3169
3155
  options: Array.from(this.optionsMap.keys()),
3170
3156
  path: [discriminator],
3171
3157
  });
3172
- return parseUtil_1.INVALID;
3158
+ return parseUtil_js_1.INVALID;
3173
3159
  }
3174
3160
  if (ctx.common.async) {
3175
3161
  return option._parseAsync({
@@ -3230,16 +3216,14 @@ class ZodDiscriminatedUnion extends ZodType {
3230
3216
  }
3231
3217
  exports.ZodDiscriminatedUnion = ZodDiscriminatedUnion;
3232
3218
  function mergeValues(a, b) {
3233
- const aType = (0, util_1.getParsedType)(a);
3234
- const bType = (0, util_1.getParsedType)(b);
3219
+ const aType = (0, util_js_1.getParsedType)(a);
3220
+ const bType = (0, util_js_1.getParsedType)(b);
3235
3221
  if (a === b) {
3236
3222
  return { valid: true, data: a };
3237
3223
  }
3238
- else if (aType === util_1.ZodParsedType.object && bType === util_1.ZodParsedType.object) {
3239
- const bKeys = util_1.util.objectKeys(b);
3240
- const sharedKeys = util_1.util
3241
- .objectKeys(a)
3242
- .filter((key) => bKeys.indexOf(key) !== -1);
3224
+ else if (aType === util_js_1.ZodParsedType.object && bType === util_js_1.ZodParsedType.object) {
3225
+ const bKeys = util_js_1.util.objectKeys(b);
3226
+ const sharedKeys = util_js_1.util.objectKeys(a).filter((key) => bKeys.indexOf(key) !== -1);
3243
3227
  const newObj = { ...a, ...b };
3244
3228
  for (const key of sharedKeys) {
3245
3229
  const sharedValue = mergeValues(a[key], b[key]);
@@ -3250,7 +3234,7 @@ function mergeValues(a, b) {
3250
3234
  }
3251
3235
  return { valid: true, data: newObj };
3252
3236
  }
3253
- else if (aType === util_1.ZodParsedType.array && bType === util_1.ZodParsedType.array) {
3237
+ else if (aType === util_js_1.ZodParsedType.array && bType === util_js_1.ZodParsedType.array) {
3254
3238
  if (a.length !== b.length) {
3255
3239
  return { valid: false };
3256
3240
  }
@@ -3266,9 +3250,7 @@ function mergeValues(a, b) {
3266
3250
  }
3267
3251
  return { valid: true, data: newArray };
3268
3252
  }
3269
- else if (aType === util_1.ZodParsedType.date &&
3270
- bType === util_1.ZodParsedType.date &&
3271
- +a === +b) {
3253
+ else if (aType === util_js_1.ZodParsedType.date && bType === util_js_1.ZodParsedType.date && +a === +b) {
3272
3254
  return { valid: true, data: a };
3273
3255
  }
3274
3256
  else {
@@ -3279,17 +3261,17 @@ class ZodIntersection extends ZodType {
3279
3261
  _parse(input) {
3280
3262
  const { status, ctx } = this._processInputParams(input);
3281
3263
  const handleParsed = (parsedLeft, parsedRight) => {
3282
- if ((0, parseUtil_1.isAborted)(parsedLeft) || (0, parseUtil_1.isAborted)(parsedRight)) {
3283
- return parseUtil_1.INVALID;
3264
+ if ((0, parseUtil_js_1.isAborted)(parsedLeft) || (0, parseUtil_js_1.isAborted)(parsedRight)) {
3265
+ return parseUtil_js_1.INVALID;
3284
3266
  }
3285
3267
  const merged = mergeValues(parsedLeft.value, parsedRight.value);
3286
3268
  if (!merged.valid) {
3287
- (0, parseUtil_1.addIssueToContext)(ctx, {
3288
- code: ZodError_1.ZodIssueCode.invalid_intersection_types,
3269
+ (0, parseUtil_js_1.addIssueToContext)(ctx, {
3270
+ code: ZodError_js_1.ZodIssueCode.invalid_intersection_types,
3289
3271
  });
3290
- return parseUtil_1.INVALID;
3272
+ return parseUtil_js_1.INVALID;
3291
3273
  }
3292
- if ((0, parseUtil_1.isDirty)(parsedLeft) || (0, parseUtil_1.isDirty)(parsedRight)) {
3274
+ if ((0, parseUtil_js_1.isDirty)(parsedLeft) || (0, parseUtil_js_1.isDirty)(parsedRight)) {
3293
3275
  status.dirty();
3294
3276
  }
3295
3277
  return { status: status.value, value: merged.data };
@@ -3330,31 +3312,32 @@ ZodIntersection.create = (left, right, params) => {
3330
3312
  ...processCreateParams(params),
3331
3313
  });
3332
3314
  };
3315
+ // type ZodTupleItems = [ZodTypeAny, ...ZodTypeAny[]];
3333
3316
  class ZodTuple extends ZodType {
3334
3317
  _parse(input) {
3335
3318
  const { status, ctx } = this._processInputParams(input);
3336
- if (ctx.parsedType !== util_1.ZodParsedType.array) {
3337
- (0, parseUtil_1.addIssueToContext)(ctx, {
3338
- code: ZodError_1.ZodIssueCode.invalid_type,
3339
- expected: util_1.ZodParsedType.array,
3319
+ if (ctx.parsedType !== util_js_1.ZodParsedType.array) {
3320
+ (0, parseUtil_js_1.addIssueToContext)(ctx, {
3321
+ code: ZodError_js_1.ZodIssueCode.invalid_type,
3322
+ expected: util_js_1.ZodParsedType.array,
3340
3323
  received: ctx.parsedType,
3341
3324
  });
3342
- return parseUtil_1.INVALID;
3325
+ return parseUtil_js_1.INVALID;
3343
3326
  }
3344
3327
  if (ctx.data.length < this._def.items.length) {
3345
- (0, parseUtil_1.addIssueToContext)(ctx, {
3346
- code: ZodError_1.ZodIssueCode.too_small,
3328
+ (0, parseUtil_js_1.addIssueToContext)(ctx, {
3329
+ code: ZodError_js_1.ZodIssueCode.too_small,
3347
3330
  minimum: this._def.items.length,
3348
3331
  inclusive: true,
3349
3332
  exact: false,
3350
3333
  type: "array",
3351
3334
  });
3352
- return parseUtil_1.INVALID;
3335
+ return parseUtil_js_1.INVALID;
3353
3336
  }
3354
3337
  const rest = this._def.rest;
3355
3338
  if (!rest && ctx.data.length > this._def.items.length) {
3356
- (0, parseUtil_1.addIssueToContext)(ctx, {
3357
- code: ZodError_1.ZodIssueCode.too_big,
3339
+ (0, parseUtil_js_1.addIssueToContext)(ctx, {
3340
+ code: ZodError_js_1.ZodIssueCode.too_big,
3358
3341
  maximum: this._def.items.length,
3359
3342
  inclusive: true,
3360
3343
  exact: false,
@@ -3372,11 +3355,11 @@ class ZodTuple extends ZodType {
3372
3355
  .filter((x) => !!x); // filter nulls
3373
3356
  if (ctx.common.async) {
3374
3357
  return Promise.all(items).then((results) => {
3375
- return parseUtil_1.ParseStatus.mergeArray(status, results);
3358
+ return parseUtil_js_1.ParseStatus.mergeArray(status, results);
3376
3359
  });
3377
3360
  }
3378
3361
  else {
3379
- return parseUtil_1.ParseStatus.mergeArray(status, items);
3362
+ return parseUtil_js_1.ParseStatus.mergeArray(status, items);
3380
3363
  }
3381
3364
  }
3382
3365
  get items() {
@@ -3410,13 +3393,13 @@ class ZodRecord extends ZodType {
3410
3393
  }
3411
3394
  _parse(input) {
3412
3395
  const { status, ctx } = this._processInputParams(input);
3413
- if (ctx.parsedType !== util_1.ZodParsedType.object) {
3414
- (0, parseUtil_1.addIssueToContext)(ctx, {
3415
- code: ZodError_1.ZodIssueCode.invalid_type,
3416
- expected: util_1.ZodParsedType.object,
3396
+ if (ctx.parsedType !== util_js_1.ZodParsedType.object) {
3397
+ (0, parseUtil_js_1.addIssueToContext)(ctx, {
3398
+ code: ZodError_js_1.ZodIssueCode.invalid_type,
3399
+ expected: util_js_1.ZodParsedType.object,
3417
3400
  received: ctx.parsedType,
3418
3401
  });
3419
- return parseUtil_1.INVALID;
3402
+ return parseUtil_js_1.INVALID;
3420
3403
  }
3421
3404
  const pairs = [];
3422
3405
  const keyType = this._def.keyType;
@@ -3429,10 +3412,10 @@ class ZodRecord extends ZodType {
3429
3412
  });
3430
3413
  }
3431
3414
  if (ctx.common.async) {
3432
- return parseUtil_1.ParseStatus.mergeObjectAsync(status, pairs);
3415
+ return parseUtil_js_1.ParseStatus.mergeObjectAsync(status, pairs);
3433
3416
  }
3434
3417
  else {
3435
- return parseUtil_1.ParseStatus.mergeObjectSync(status, pairs);
3418
+ return parseUtil_js_1.ParseStatus.mergeObjectSync(status, pairs);
3436
3419
  }
3437
3420
  }
3438
3421
  get element() {
@@ -3465,13 +3448,13 @@ class ZodMap extends ZodType {
3465
3448
  }
3466
3449
  _parse(input) {
3467
3450
  const { status, ctx } = this._processInputParams(input);
3468
- if (ctx.parsedType !== util_1.ZodParsedType.map) {
3469
- (0, parseUtil_1.addIssueToContext)(ctx, {
3470
- code: ZodError_1.ZodIssueCode.invalid_type,
3471
- expected: util_1.ZodParsedType.map,
3451
+ if (ctx.parsedType !== util_js_1.ZodParsedType.map) {
3452
+ (0, parseUtil_js_1.addIssueToContext)(ctx, {
3453
+ code: ZodError_js_1.ZodIssueCode.invalid_type,
3454
+ expected: util_js_1.ZodParsedType.map,
3472
3455
  received: ctx.parsedType,
3473
3456
  });
3474
- return parseUtil_1.INVALID;
3457
+ return parseUtil_js_1.INVALID;
3475
3458
  }
3476
3459
  const keyType = this._def.keyType;
3477
3460
  const valueType = this._def.valueType;
@@ -3488,7 +3471,7 @@ class ZodMap extends ZodType {
3488
3471
  const key = await pair.key;
3489
3472
  const value = await pair.value;
3490
3473
  if (key.status === "aborted" || value.status === "aborted") {
3491
- return parseUtil_1.INVALID;
3474
+ return parseUtil_js_1.INVALID;
3492
3475
  }
3493
3476
  if (key.status === "dirty" || value.status === "dirty") {
3494
3477
  status.dirty();
@@ -3504,7 +3487,7 @@ class ZodMap extends ZodType {
3504
3487
  const key = pair.key;
3505
3488
  const value = pair.value;
3506
3489
  if (key.status === "aborted" || value.status === "aborted") {
3507
- return parseUtil_1.INVALID;
3490
+ return parseUtil_js_1.INVALID;
3508
3491
  }
3509
3492
  if (key.status === "dirty" || value.status === "dirty") {
3510
3493
  status.dirty();
@@ -3527,19 +3510,19 @@ ZodMap.create = (keyType, valueType, params) => {
3527
3510
  class ZodSet extends ZodType {
3528
3511
  _parse(input) {
3529
3512
  const { status, ctx } = this._processInputParams(input);
3530
- if (ctx.parsedType !== util_1.ZodParsedType.set) {
3531
- (0, parseUtil_1.addIssueToContext)(ctx, {
3532
- code: ZodError_1.ZodIssueCode.invalid_type,
3533
- expected: util_1.ZodParsedType.set,
3513
+ if (ctx.parsedType !== util_js_1.ZodParsedType.set) {
3514
+ (0, parseUtil_js_1.addIssueToContext)(ctx, {
3515
+ code: ZodError_js_1.ZodIssueCode.invalid_type,
3516
+ expected: util_js_1.ZodParsedType.set,
3534
3517
  received: ctx.parsedType,
3535
3518
  });
3536
- return parseUtil_1.INVALID;
3519
+ return parseUtil_js_1.INVALID;
3537
3520
  }
3538
3521
  const def = this._def;
3539
3522
  if (def.minSize !== null) {
3540
3523
  if (ctx.data.size < def.minSize.value) {
3541
- (0, parseUtil_1.addIssueToContext)(ctx, {
3542
- code: ZodError_1.ZodIssueCode.too_small,
3524
+ (0, parseUtil_js_1.addIssueToContext)(ctx, {
3525
+ code: ZodError_js_1.ZodIssueCode.too_small,
3543
3526
  minimum: def.minSize.value,
3544
3527
  type: "set",
3545
3528
  inclusive: true,
@@ -3551,8 +3534,8 @@ class ZodSet extends ZodType {
3551
3534
  }
3552
3535
  if (def.maxSize !== null) {
3553
3536
  if (ctx.data.size > def.maxSize.value) {
3554
- (0, parseUtil_1.addIssueToContext)(ctx, {
3555
- code: ZodError_1.ZodIssueCode.too_big,
3537
+ (0, parseUtil_js_1.addIssueToContext)(ctx, {
3538
+ code: ZodError_js_1.ZodIssueCode.too_big,
3556
3539
  maximum: def.maxSize.value,
3557
3540
  type: "set",
3558
3541
  inclusive: true,
@@ -3567,7 +3550,7 @@ class ZodSet extends ZodType {
3567
3550
  const parsedSet = new Set();
3568
3551
  for (const element of elements) {
3569
3552
  if (element.status === "aborted")
3570
- return parseUtil_1.INVALID;
3553
+ return parseUtil_js_1.INVALID;
3571
3554
  if (element.status === "dirty")
3572
3555
  status.dirty();
3573
3556
  parsedSet.add(element.value);
@@ -3585,13 +3568,13 @@ class ZodSet extends ZodType {
3585
3568
  min(minSize, message) {
3586
3569
  return new ZodSet({
3587
3570
  ...this._def,
3588
- minSize: { value: minSize, message: errorUtil_1.errorUtil.toString(message) },
3571
+ minSize: { value: minSize, message: errorUtil_js_1.errorUtil.toString(message) },
3589
3572
  });
3590
3573
  }
3591
3574
  max(maxSize, message) {
3592
3575
  return new ZodSet({
3593
3576
  ...this._def,
3594
- maxSize: { value: maxSize, message: errorUtil_1.errorUtil.toString(message) },
3577
+ maxSize: { value: maxSize, message: errorUtil_js_1.errorUtil.toString(message) },
3595
3578
  });
3596
3579
  }
3597
3580
  size(size, message) {
@@ -3618,42 +3601,32 @@ class ZodFunction extends ZodType {
3618
3601
  }
3619
3602
  _parse(input) {
3620
3603
  const { ctx } = this._processInputParams(input);
3621
- if (ctx.parsedType !== util_1.ZodParsedType.function) {
3622
- (0, parseUtil_1.addIssueToContext)(ctx, {
3623
- code: ZodError_1.ZodIssueCode.invalid_type,
3624
- expected: util_1.ZodParsedType.function,
3604
+ if (ctx.parsedType !== util_js_1.ZodParsedType.function) {
3605
+ (0, parseUtil_js_1.addIssueToContext)(ctx, {
3606
+ code: ZodError_js_1.ZodIssueCode.invalid_type,
3607
+ expected: util_js_1.ZodParsedType.function,
3625
3608
  received: ctx.parsedType,
3626
3609
  });
3627
- return parseUtil_1.INVALID;
3610
+ return parseUtil_js_1.INVALID;
3628
3611
  }
3629
3612
  function makeArgsIssue(args, error) {
3630
- return (0, parseUtil_1.makeIssue)({
3613
+ return (0, parseUtil_js_1.makeIssue)({
3631
3614
  data: args,
3632
3615
  path: ctx.path,
3633
- errorMaps: [
3634
- ctx.common.contextualErrorMap,
3635
- ctx.schemaErrorMap,
3636
- (0, errors_1.getErrorMap)(),
3637
- errors_1.defaultErrorMap,
3638
- ].filter((x) => !!x),
3616
+ errorMaps: [ctx.common.contextualErrorMap, ctx.schemaErrorMap, (0, errors_js_1.getErrorMap)(), errors_js_1.defaultErrorMap].filter((x) => !!x),
3639
3617
  issueData: {
3640
- code: ZodError_1.ZodIssueCode.invalid_arguments,
3618
+ code: ZodError_js_1.ZodIssueCode.invalid_arguments,
3641
3619
  argumentsError: error,
3642
3620
  },
3643
3621
  });
3644
3622
  }
3645
3623
  function makeReturnsIssue(returns, error) {
3646
- return (0, parseUtil_1.makeIssue)({
3624
+ return (0, parseUtil_js_1.makeIssue)({
3647
3625
  data: returns,
3648
3626
  path: ctx.path,
3649
- errorMaps: [
3650
- ctx.common.contextualErrorMap,
3651
- ctx.schemaErrorMap,
3652
- (0, errors_1.getErrorMap)(),
3653
- errors_1.defaultErrorMap,
3654
- ].filter((x) => !!x),
3627
+ errorMaps: [ctx.common.contextualErrorMap, ctx.schemaErrorMap, (0, errors_js_1.getErrorMap)(), errors_js_1.defaultErrorMap].filter((x) => !!x),
3655
3628
  issueData: {
3656
- code: ZodError_1.ZodIssueCode.invalid_return_type,
3629
+ code: ZodError_js_1.ZodIssueCode.invalid_return_type,
3657
3630
  returnTypeError: error,
3658
3631
  },
3659
3632
  });
@@ -3665,11 +3638,9 @@ class ZodFunction extends ZodType {
3665
3638
  // an alias (using an arrow function was what caused 2651).
3666
3639
  // eslint-disable-next-line @typescript-eslint/no-this-alias
3667
3640
  const me = this;
3668
- return (0, parseUtil_1.OK)(async function (...args) {
3669
- const error = new ZodError_1.ZodError([]);
3670
- const parsedArgs = await me._def.args
3671
- .parseAsync(args, params)
3672
- .catch((e) => {
3641
+ return (0, parseUtil_js_1.OK)(async function (...args) {
3642
+ const error = new ZodError_js_1.ZodError([]);
3643
+ const parsedArgs = await me._def.args.parseAsync(args, params).catch((e) => {
3673
3644
  error.addIssue(makeArgsIssue(args, e));
3674
3645
  throw error;
3675
3646
  });
@@ -3688,15 +3659,15 @@ class ZodFunction extends ZodType {
3688
3659
  // an alias (using an arrow function was what caused 2651).
3689
3660
  // eslint-disable-next-line @typescript-eslint/no-this-alias
3690
3661
  const me = this;
3691
- return (0, parseUtil_1.OK)(function (...args) {
3662
+ return (0, parseUtil_js_1.OK)(function (...args) {
3692
3663
  const parsedArgs = me._def.args.safeParse(args, params);
3693
3664
  if (!parsedArgs.success) {
3694
- throw new ZodError_1.ZodError([makeArgsIssue(args, parsedArgs.error)]);
3665
+ throw new ZodError_js_1.ZodError([makeArgsIssue(args, parsedArgs.error)]);
3695
3666
  }
3696
3667
  const result = Reflect.apply(fn, this, parsedArgs.data);
3697
3668
  const parsedReturns = me._def.returns.safeParse(result, params);
3698
3669
  if (!parsedReturns.success) {
3699
- throw new ZodError_1.ZodError([makeReturnsIssue(result, parsedReturns.error)]);
3670
+ throw new ZodError_js_1.ZodError([makeReturnsIssue(result, parsedReturns.error)]);
3700
3671
  }
3701
3672
  return parsedReturns.data;
3702
3673
  });
@@ -3730,9 +3701,7 @@ class ZodFunction extends ZodType {
3730
3701
  }
3731
3702
  static create(args, returns, params) {
3732
3703
  return new ZodFunction({
3733
- args: (args
3734
- ? args
3735
- : ZodTuple.create([]).rest(ZodUnknown.create())),
3704
+ args: (args ? args : ZodTuple.create([]).rest(ZodUnknown.create())),
3736
3705
  returns: returns || ZodUnknown.create(),
3737
3706
  typeName: ZodFirstPartyTypeKind.ZodFunction,
3738
3707
  ...processCreateParams(params),
@@ -3762,12 +3731,12 @@ class ZodLiteral extends ZodType {
3762
3731
  _parse(input) {
3763
3732
  if (input.data !== this._def.value) {
3764
3733
  const ctx = this._getOrReturnCtx(input);
3765
- (0, parseUtil_1.addIssueToContext)(ctx, {
3734
+ (0, parseUtil_js_1.addIssueToContext)(ctx, {
3766
3735
  received: ctx.data,
3767
- code: ZodError_1.ZodIssueCode.invalid_literal,
3736
+ code: ZodError_js_1.ZodIssueCode.invalid_literal,
3768
3737
  expected: this._def.value,
3769
3738
  });
3770
- return parseUtil_1.INVALID;
3739
+ return parseUtil_js_1.INVALID;
3771
3740
  }
3772
3741
  return { status: "valid", value: input.data };
3773
3742
  }
@@ -3799,12 +3768,12 @@ class ZodEnum extends ZodType {
3799
3768
  if (typeof input.data !== "string") {
3800
3769
  const ctx = this._getOrReturnCtx(input);
3801
3770
  const expectedValues = this._def.values;
3802
- (0, parseUtil_1.addIssueToContext)(ctx, {
3803
- expected: util_1.util.joinValues(expectedValues),
3771
+ (0, parseUtil_js_1.addIssueToContext)(ctx, {
3772
+ expected: util_js_1.util.joinValues(expectedValues),
3804
3773
  received: ctx.parsedType,
3805
- code: ZodError_1.ZodIssueCode.invalid_type,
3774
+ code: ZodError_js_1.ZodIssueCode.invalid_type,
3806
3775
  });
3807
- return parseUtil_1.INVALID;
3776
+ return parseUtil_js_1.INVALID;
3808
3777
  }
3809
3778
  if (!__classPrivateFieldGet(this, _ZodEnum_cache, "f")) {
3810
3779
  __classPrivateFieldSet(this, _ZodEnum_cache, new Set(this._def.values), "f");
@@ -3812,14 +3781,14 @@ class ZodEnum extends ZodType {
3812
3781
  if (!__classPrivateFieldGet(this, _ZodEnum_cache, "f").has(input.data)) {
3813
3782
  const ctx = this._getOrReturnCtx(input);
3814
3783
  const expectedValues = this._def.values;
3815
- (0, parseUtil_1.addIssueToContext)(ctx, {
3784
+ (0, parseUtil_js_1.addIssueToContext)(ctx, {
3816
3785
  received: ctx.data,
3817
- code: ZodError_1.ZodIssueCode.invalid_enum_value,
3786
+ code: ZodError_js_1.ZodIssueCode.invalid_enum_value,
3818
3787
  options: expectedValues,
3819
3788
  });
3820
- return parseUtil_1.INVALID;
3789
+ return parseUtil_js_1.INVALID;
3821
3790
  }
3822
- return (0, parseUtil_1.OK)(input.data);
3791
+ return (0, parseUtil_js_1.OK)(input.data);
3823
3792
  }
3824
3793
  get options() {
3825
3794
  return this._def.values;
@@ -3867,31 +3836,30 @@ class ZodNativeEnum extends ZodType {
3867
3836
  _ZodNativeEnum_cache.set(this, void 0);
3868
3837
  }
3869
3838
  _parse(input) {
3870
- const nativeEnumValues = util_1.util.getValidEnumValues(this._def.values);
3839
+ const nativeEnumValues = util_js_1.util.getValidEnumValues(this._def.values);
3871
3840
  const ctx = this._getOrReturnCtx(input);
3872
- if (ctx.parsedType !== util_1.ZodParsedType.string &&
3873
- ctx.parsedType !== util_1.ZodParsedType.number) {
3874
- const expectedValues = util_1.util.objectValues(nativeEnumValues);
3875
- (0, parseUtil_1.addIssueToContext)(ctx, {
3876
- expected: util_1.util.joinValues(expectedValues),
3841
+ if (ctx.parsedType !== util_js_1.ZodParsedType.string && ctx.parsedType !== util_js_1.ZodParsedType.number) {
3842
+ const expectedValues = util_js_1.util.objectValues(nativeEnumValues);
3843
+ (0, parseUtil_js_1.addIssueToContext)(ctx, {
3844
+ expected: util_js_1.util.joinValues(expectedValues),
3877
3845
  received: ctx.parsedType,
3878
- code: ZodError_1.ZodIssueCode.invalid_type,
3846
+ code: ZodError_js_1.ZodIssueCode.invalid_type,
3879
3847
  });
3880
- return parseUtil_1.INVALID;
3848
+ return parseUtil_js_1.INVALID;
3881
3849
  }
3882
3850
  if (!__classPrivateFieldGet(this, _ZodNativeEnum_cache, "f")) {
3883
- __classPrivateFieldSet(this, _ZodNativeEnum_cache, new Set(util_1.util.getValidEnumValues(this._def.values)), "f");
3851
+ __classPrivateFieldSet(this, _ZodNativeEnum_cache, new Set(util_js_1.util.getValidEnumValues(this._def.values)), "f");
3884
3852
  }
3885
3853
  if (!__classPrivateFieldGet(this, _ZodNativeEnum_cache, "f").has(input.data)) {
3886
- const expectedValues = util_1.util.objectValues(nativeEnumValues);
3887
- (0, parseUtil_1.addIssueToContext)(ctx, {
3854
+ const expectedValues = util_js_1.util.objectValues(nativeEnumValues);
3855
+ (0, parseUtil_js_1.addIssueToContext)(ctx, {
3888
3856
  received: ctx.data,
3889
- code: ZodError_1.ZodIssueCode.invalid_enum_value,
3857
+ code: ZodError_js_1.ZodIssueCode.invalid_enum_value,
3890
3858
  options: expectedValues,
3891
3859
  });
3892
- return parseUtil_1.INVALID;
3860
+ return parseUtil_js_1.INVALID;
3893
3861
  }
3894
- return (0, parseUtil_1.OK)(input.data);
3862
+ return (0, parseUtil_js_1.OK)(input.data);
3895
3863
  }
3896
3864
  get enum() {
3897
3865
  return this._def.values;
@@ -3912,19 +3880,16 @@ class ZodPromise extends ZodType {
3912
3880
  }
3913
3881
  _parse(input) {
3914
3882
  const { ctx } = this._processInputParams(input);
3915
- if (ctx.parsedType !== util_1.ZodParsedType.promise &&
3916
- ctx.common.async === false) {
3917
- (0, parseUtil_1.addIssueToContext)(ctx, {
3918
- code: ZodError_1.ZodIssueCode.invalid_type,
3919
- expected: util_1.ZodParsedType.promise,
3883
+ if (ctx.parsedType !== util_js_1.ZodParsedType.promise && ctx.common.async === false) {
3884
+ (0, parseUtil_js_1.addIssueToContext)(ctx, {
3885
+ code: ZodError_js_1.ZodIssueCode.invalid_type,
3886
+ expected: util_js_1.ZodParsedType.promise,
3920
3887
  received: ctx.parsedType,
3921
3888
  });
3922
- return parseUtil_1.INVALID;
3889
+ return parseUtil_js_1.INVALID;
3923
3890
  }
3924
- const promisified = ctx.parsedType === util_1.ZodParsedType.promise
3925
- ? ctx.data
3926
- : Promise.resolve(ctx.data);
3927
- return (0, parseUtil_1.OK)(promisified.then((data) => {
3891
+ const promisified = ctx.parsedType === util_js_1.ZodParsedType.promise ? ctx.data : Promise.resolve(ctx.data);
3892
+ return (0, parseUtil_js_1.OK)(promisified.then((data) => {
3928
3893
  return this._def.type.parseAsync(data, {
3929
3894
  path: ctx.path,
3930
3895
  errorMap: ctx.common.contextualErrorMap,
@@ -3954,7 +3919,7 @@ class ZodEffects extends ZodType {
3954
3919
  const effect = this._def.effect || null;
3955
3920
  const checkCtx = {
3956
3921
  addIssue: (arg) => {
3957
- (0, parseUtil_1.addIssueToContext)(ctx, arg);
3922
+ (0, parseUtil_js_1.addIssueToContext)(ctx, arg);
3958
3923
  if (arg.fatal) {
3959
3924
  status.abort();
3960
3925
  }
@@ -3972,35 +3937,35 @@ class ZodEffects extends ZodType {
3972
3937
  if (ctx.common.async) {
3973
3938
  return Promise.resolve(processed).then(async (processed) => {
3974
3939
  if (status.value === "aborted")
3975
- return parseUtil_1.INVALID;
3940
+ return parseUtil_js_1.INVALID;
3976
3941
  const result = await this._def.schema._parseAsync({
3977
3942
  data: processed,
3978
3943
  path: ctx.path,
3979
3944
  parent: ctx,
3980
3945
  });
3981
3946
  if (result.status === "aborted")
3982
- return parseUtil_1.INVALID;
3947
+ return parseUtil_js_1.INVALID;
3983
3948
  if (result.status === "dirty")
3984
- return (0, parseUtil_1.DIRTY)(result.value);
3949
+ return (0, parseUtil_js_1.DIRTY)(result.value);
3985
3950
  if (status.value === "dirty")
3986
- return (0, parseUtil_1.DIRTY)(result.value);
3951
+ return (0, parseUtil_js_1.DIRTY)(result.value);
3987
3952
  return result;
3988
3953
  });
3989
3954
  }
3990
3955
  else {
3991
3956
  if (status.value === "aborted")
3992
- return parseUtil_1.INVALID;
3957
+ return parseUtil_js_1.INVALID;
3993
3958
  const result = this._def.schema._parseSync({
3994
3959
  data: processed,
3995
3960
  path: ctx.path,
3996
3961
  parent: ctx,
3997
3962
  });
3998
3963
  if (result.status === "aborted")
3999
- return parseUtil_1.INVALID;
3964
+ return parseUtil_js_1.INVALID;
4000
3965
  if (result.status === "dirty")
4001
- return (0, parseUtil_1.DIRTY)(result.value);
3966
+ return (0, parseUtil_js_1.DIRTY)(result.value);
4002
3967
  if (status.value === "dirty")
4003
- return (0, parseUtil_1.DIRTY)(result.value);
3968
+ return (0, parseUtil_js_1.DIRTY)(result.value);
4004
3969
  return result;
4005
3970
  }
4006
3971
  }
@@ -4022,7 +3987,7 @@ class ZodEffects extends ZodType {
4022
3987
  parent: ctx,
4023
3988
  });
4024
3989
  if (inner.status === "aborted")
4025
- return parseUtil_1.INVALID;
3990
+ return parseUtil_js_1.INVALID;
4026
3991
  if (inner.status === "dirty")
4027
3992
  status.dirty();
4028
3993
  // return value is ignored
@@ -4030,11 +3995,9 @@ class ZodEffects extends ZodType {
4030
3995
  return { status: status.value, value: inner.value };
4031
3996
  }
4032
3997
  else {
4033
- return this._def.schema
4034
- ._parseAsync({ data: ctx.data, path: ctx.path, parent: ctx })
4035
- .then((inner) => {
3998
+ return this._def.schema._parseAsync({ data: ctx.data, path: ctx.path, parent: ctx }).then((inner) => {
4036
3999
  if (inner.status === "aborted")
4037
- return parseUtil_1.INVALID;
4000
+ return parseUtil_js_1.INVALID;
4038
4001
  if (inner.status === "dirty")
4039
4002
  status.dirty();
4040
4003
  return executeRefinement(inner.value).then(() => {
@@ -4050,7 +4013,7 @@ class ZodEffects extends ZodType {
4050
4013
  path: ctx.path,
4051
4014
  parent: ctx,
4052
4015
  });
4053
- if (!(0, parseUtil_1.isValid)(base))
4016
+ if (!(0, parseUtil_js_1.isValid)(base))
4054
4017
  return base;
4055
4018
  const result = effect.transform(base.value, checkCtx);
4056
4019
  if (result instanceof Promise) {
@@ -4059,16 +4022,17 @@ class ZodEffects extends ZodType {
4059
4022
  return { status: status.value, value: result };
4060
4023
  }
4061
4024
  else {
4062
- return this._def.schema
4063
- ._parseAsync({ data: ctx.data, path: ctx.path, parent: ctx })
4064
- .then((base) => {
4065
- if (!(0, parseUtil_1.isValid)(base))
4025
+ return this._def.schema._parseAsync({ data: ctx.data, path: ctx.path, parent: ctx }).then((base) => {
4026
+ if (!(0, parseUtil_js_1.isValid)(base))
4066
4027
  return base;
4067
- return Promise.resolve(effect.transform(base.value, checkCtx)).then((result) => ({ status: status.value, value: result }));
4028
+ return Promise.resolve(effect.transform(base.value, checkCtx)).then((result) => ({
4029
+ status: status.value,
4030
+ value: result,
4031
+ }));
4068
4032
  });
4069
4033
  }
4070
4034
  }
4071
- util_1.util.assertNever(effect);
4035
+ util_js_1.util.assertNever(effect);
4072
4036
  }
4073
4037
  }
4074
4038
  exports.ZodEffects = ZodEffects;
@@ -4092,8 +4056,8 @@ ZodEffects.createWithPreprocess = (preprocess, schema, params) => {
4092
4056
  class ZodOptional extends ZodType {
4093
4057
  _parse(input) {
4094
4058
  const parsedType = this._getType(input);
4095
- if (parsedType === util_1.ZodParsedType.undefined) {
4096
- return (0, parseUtil_1.OK)(undefined);
4059
+ if (parsedType === util_js_1.ZodParsedType.undefined) {
4060
+ return (0, parseUtil_js_1.OK)(undefined);
4097
4061
  }
4098
4062
  return this._def.innerType._parse(input);
4099
4063
  }
@@ -4112,8 +4076,8 @@ ZodOptional.create = (type, params) => {
4112
4076
  class ZodNullable extends ZodType {
4113
4077
  _parse(input) {
4114
4078
  const parsedType = this._getType(input);
4115
- if (parsedType === util_1.ZodParsedType.null) {
4116
- return (0, parseUtil_1.OK)(null);
4079
+ if (parsedType === util_js_1.ZodParsedType.null) {
4080
+ return (0, parseUtil_js_1.OK)(null);
4117
4081
  }
4118
4082
  return this._def.innerType._parse(input);
4119
4083
  }
@@ -4133,7 +4097,7 @@ class ZodDefault extends ZodType {
4133
4097
  _parse(input) {
4134
4098
  const { ctx } = this._processInputParams(input);
4135
4099
  let data = ctx.data;
4136
- if (ctx.parsedType === util_1.ZodParsedType.undefined) {
4100
+ if (ctx.parsedType === util_js_1.ZodParsedType.undefined) {
4137
4101
  data = this._def.defaultValue();
4138
4102
  }
4139
4103
  return this._def.innerType._parse({
@@ -4151,9 +4115,7 @@ ZodDefault.create = (type, params) => {
4151
4115
  return new ZodDefault({
4152
4116
  innerType: type,
4153
4117
  typeName: ZodFirstPartyTypeKind.ZodDefault,
4154
- defaultValue: typeof params.default === "function"
4155
- ? params.default
4156
- : () => params.default,
4118
+ defaultValue: typeof params.default === "function" ? params.default : () => params.default,
4157
4119
  ...processCreateParams(params),
4158
4120
  });
4159
4121
  };
@@ -4175,7 +4137,7 @@ class ZodCatch extends ZodType {
4175
4137
  ...newCtx,
4176
4138
  },
4177
4139
  });
4178
- if ((0, parseUtil_1.isAsync)(result)) {
4140
+ if ((0, parseUtil_js_1.isAsync)(result)) {
4179
4141
  return result.then((result) => {
4180
4142
  return {
4181
4143
  status: "valid",
@@ -4183,7 +4145,7 @@ class ZodCatch extends ZodType {
4183
4145
  ? result.value
4184
4146
  : this._def.catchValue({
4185
4147
  get error() {
4186
- return new ZodError_1.ZodError(newCtx.common.issues);
4148
+ return new ZodError_js_1.ZodError(newCtx.common.issues);
4187
4149
  },
4188
4150
  input: newCtx.data,
4189
4151
  }),
@@ -4197,7 +4159,7 @@ class ZodCatch extends ZodType {
4197
4159
  ? result.value
4198
4160
  : this._def.catchValue({
4199
4161
  get error() {
4200
- return new ZodError_1.ZodError(newCtx.common.issues);
4162
+ return new ZodError_js_1.ZodError(newCtx.common.issues);
4201
4163
  },
4202
4164
  input: newCtx.data,
4203
4165
  }),
@@ -4220,14 +4182,14 @@ ZodCatch.create = (type, params) => {
4220
4182
  class ZodNaN extends ZodType {
4221
4183
  _parse(input) {
4222
4184
  const parsedType = this._getType(input);
4223
- if (parsedType !== util_1.ZodParsedType.nan) {
4185
+ if (parsedType !== util_js_1.ZodParsedType.nan) {
4224
4186
  const ctx = this._getOrReturnCtx(input);
4225
- (0, parseUtil_1.addIssueToContext)(ctx, {
4226
- code: ZodError_1.ZodIssueCode.invalid_type,
4227
- expected: util_1.ZodParsedType.nan,
4187
+ (0, parseUtil_js_1.addIssueToContext)(ctx, {
4188
+ code: ZodError_js_1.ZodIssueCode.invalid_type,
4189
+ expected: util_js_1.ZodParsedType.nan,
4228
4190
  received: ctx.parsedType,
4229
4191
  });
4230
- return parseUtil_1.INVALID;
4192
+ return parseUtil_js_1.INVALID;
4231
4193
  }
4232
4194
  return { status: "valid", value: input.data };
4233
4195
  }
@@ -4266,10 +4228,10 @@ class ZodPipeline extends ZodType {
4266
4228
  parent: ctx,
4267
4229
  });
4268
4230
  if (inResult.status === "aborted")
4269
- return parseUtil_1.INVALID;
4231
+ return parseUtil_js_1.INVALID;
4270
4232
  if (inResult.status === "dirty") {
4271
4233
  status.dirty();
4272
- return (0, parseUtil_1.DIRTY)(inResult.value);
4234
+ return (0, parseUtil_js_1.DIRTY)(inResult.value);
4273
4235
  }
4274
4236
  else {
4275
4237
  return this._def.out._parseAsync({
@@ -4288,7 +4250,7 @@ class ZodPipeline extends ZodType {
4288
4250
  parent: ctx,
4289
4251
  });
4290
4252
  if (inResult.status === "aborted")
4291
- return parseUtil_1.INVALID;
4253
+ return parseUtil_js_1.INVALID;
4292
4254
  if (inResult.status === "dirty") {
4293
4255
  status.dirty();
4294
4256
  return {
@@ -4318,14 +4280,12 @@ class ZodReadonly extends ZodType {
4318
4280
  _parse(input) {
4319
4281
  const result = this._def.innerType._parse(input);
4320
4282
  const freeze = (data) => {
4321
- if ((0, parseUtil_1.isValid)(data)) {
4283
+ if ((0, parseUtil_js_1.isValid)(data)) {
4322
4284
  data.value = Object.freeze(data.value);
4323
4285
  }
4324
4286
  return data;
4325
4287
  };
4326
- return (0, parseUtil_1.isAsync)(result)
4327
- ? result.then((data) => freeze(data))
4328
- : freeze(result);
4288
+ return (0, parseUtil_js_1.isAsync)(result) ? result.then((data) => freeze(data)) : freeze(result);
4329
4289
  }
4330
4290
  unwrap() {
4331
4291
  return this._def.innerType;
@@ -4347,11 +4307,7 @@ ZodReadonly.create = (type, params) => {
4347
4307
  ////////////////////////////////////////
4348
4308
  ////////////////////////////////////////
4349
4309
  function cleanParams(params, data) {
4350
- const p = typeof params === "function"
4351
- ? params(data)
4352
- : typeof params === "string"
4353
- ? { message: params }
4354
- : params;
4310
+ const p = typeof params === "function" ? params(data) : typeof params === "string" ? { message: params } : params;
4355
4311
  const p2 = typeof p === "string" ? { message: p } : p;
4356
4312
  return p2;
4357
4313
  }
@@ -4369,28 +4325,25 @@ function custom(check, _params = {},
4369
4325
  fatal) {
4370
4326
  if (check)
4371
4327
  return ZodAny.create().superRefine((data, ctx) => {
4372
- var _a, _b;
4373
4328
  const r = check(data);
4374
4329
  if (r instanceof Promise) {
4375
4330
  return r.then((r) => {
4376
- var _a, _b;
4377
4331
  if (!r) {
4378
4332
  const params = cleanParams(_params, data);
4379
- const _fatal = (_b = (_a = params.fatal) !== null && _a !== void 0 ? _a : fatal) !== null && _b !== void 0 ? _b : true;
4333
+ const _fatal = params.fatal ?? fatal ?? true;
4380
4334
  ctx.addIssue({ code: "custom", ...params, fatal: _fatal });
4381
4335
  }
4382
4336
  });
4383
4337
  }
4384
4338
  if (!r) {
4385
4339
  const params = cleanParams(_params, data);
4386
- const _fatal = (_b = (_a = params.fatal) !== null && _a !== void 0 ? _a : fatal) !== null && _b !== void 0 ? _b : true;
4340
+ const _fatal = params.fatal ?? fatal ?? true;
4387
4341
  ctx.addIssue({ code: "custom", ...params, fatal: _fatal });
4388
4342
  }
4389
4343
  return;
4390
4344
  });
4391
4345
  return ZodAny.create();
4392
4346
  }
4393
- exports.custom = custom;
4394
4347
  exports.late = {
4395
4348
  object: ZodObject.lazycreate,
4396
4349
  };
@@ -4528,7 +4481,7 @@ exports.coerce = {
4528
4481
  bigint: ((arg) => ZodBigInt.create({ ...arg, coerce: true })),
4529
4482
  date: ((arg) => ZodDate.create({ ...arg, coerce: true })),
4530
4483
  };
4531
- exports.NEVER = parseUtil_1.INVALID;
4484
+ exports.NEVER = parseUtil_js_1.INVALID;
4532
4485
 
4533
4486
 
4534
4487
  /***/ })
@@ -4575,7 +4528,7 @@ exports.NEVER = parseUtil_1.INVALID;
4575
4528
  /******/ // startup
4576
4529
  /******/ // Load entry module and return exports
4577
4530
  /******/ // This entry module is referenced by other modules so it can't be inlined
4578
- /******/ var __webpack_exports__ = __nccwpck_require__(437);
4531
+ /******/ var __webpack_exports__ = __nccwpck_require__(45);
4579
4532
  /******/ module.exports = __webpack_exports__;
4580
4533
  /******/
4581
4534
  /******/ })()