@myxtra/microservice 1.26.0 → 1.27.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.mjs CHANGED
@@ -14,6 +14,10 @@ var __require = /* @__PURE__ */ ((x) => typeof require !== "undefined" ? require
14
14
  var __commonJS = (cb, mod) => function __require2() {
15
15
  return mod || (0, cb[__getOwnPropNames(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports;
16
16
  };
17
+ var __export = (target, all) => {
18
+ for (var name in all)
19
+ __defProp(target, name, { get: all[name], enumerable: true });
20
+ };
17
21
  var __copyProps = (to, from, except, desc) => {
18
22
  if (from && typeof from === "object" || typeof from === "function") {
19
23
  for (let key of __getOwnPropNames(from))
@@ -35,7 +39,7 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
35
39
  var require_error = __commonJS({
36
40
  "../../node_modules/@fastify/error/index.js"(exports, module) {
37
41
  "use strict";
38
- var { format } = __require("node:util");
42
+ var { format } = __require("util");
39
43
  function toString() {
40
44
  return `${this.name} [${this.code}]: ${this.message}`;
41
45
  }
@@ -210,15 +214,16 @@ var require_errorMessages = __commonJS({
210
214
  }
211
215
  });
212
216
 
213
- // ../../node_modules/zod/lib/helpers/util.js
217
+ // ../../node_modules/zod/dist/cjs/v3/helpers/util.js
214
218
  var require_util = __commonJS({
215
- "../../node_modules/zod/lib/helpers/util.js"(exports) {
219
+ "../../node_modules/zod/dist/cjs/v3/helpers/util.js"(exports) {
216
220
  "use strict";
217
221
  Object.defineProperty(exports, "__esModule", { value: true });
218
222
  exports.getParsedType = exports.ZodParsedType = exports.objectUtil = exports.util = void 0;
219
223
  var util2;
220
224
  (function(util3) {
221
- util3.assertEqual = (val) => val;
225
+ util3.assertEqual = (_) => {
226
+ };
222
227
  function assertIs(_arg) {
223
228
  }
224
229
  util3.assertIs = assertIs;
@@ -262,7 +267,7 @@ var require_util = __commonJS({
262
267
  }
263
268
  return void 0;
264
269
  };
265
- util3.isInteger = typeof Number.isInteger === "function" ? (val) => Number.isInteger(val) : (val) => typeof val === "number" && isFinite(val) && Math.floor(val) === val;
270
+ util3.isInteger = typeof Number.isInteger === "function" ? (val) => Number.isInteger(val) : (val) => typeof val === "number" && Number.isFinite(val) && Math.floor(val) === val;
266
271
  function joinValues(array, separator = " | ") {
267
272
  return array.map((val) => typeof val === "string" ? `'${val}'` : val).join(separator);
268
273
  }
@@ -273,7 +278,7 @@ var require_util = __commonJS({
273
278
  }
274
279
  return value;
275
280
  };
276
- })(util2 = exports.util || (exports.util = {}));
281
+ })(util2 || (exports.util = util2 = {}));
277
282
  var objectUtil2;
278
283
  (function(objectUtil3) {
279
284
  objectUtil3.mergeShapes = (first, second) => {
@@ -283,7 +288,7 @@ var require_util = __commonJS({
283
288
  // second overwrites first
284
289
  };
285
290
  };
286
- })(objectUtil2 = exports.objectUtil || (exports.objectUtil = {}));
291
+ })(objectUtil2 || (exports.objectUtil = objectUtil2 = {}));
287
292
  exports.ZodParsedType = util2.arrayToEnum([
288
293
  "string",
289
294
  "nan",
@@ -314,7 +319,7 @@ var require_util = __commonJS({
314
319
  case "string":
315
320
  return exports.ZodParsedType.string;
316
321
  case "number":
317
- return isNaN(data) ? exports.ZodParsedType.nan : exports.ZodParsedType.number;
322
+ return Number.isNaN(data) ? exports.ZodParsedType.nan : exports.ZodParsedType.number;
318
323
  case "boolean":
319
324
  return exports.ZodParsedType.boolean;
320
325
  case "function":
@@ -351,14 +356,14 @@ var require_util = __commonJS({
351
356
  }
352
357
  });
353
358
 
354
- // ../../node_modules/zod/lib/ZodError.js
359
+ // ../../node_modules/zod/dist/cjs/v3/ZodError.js
355
360
  var require_ZodError = __commonJS({
356
- "../../node_modules/zod/lib/ZodError.js"(exports) {
361
+ "../../node_modules/zod/dist/cjs/v3/ZodError.js"(exports) {
357
362
  "use strict";
358
363
  Object.defineProperty(exports, "__esModule", { value: true });
359
364
  exports.ZodError = exports.quotelessJson = exports.ZodIssueCode = void 0;
360
- var util_1 = require_util();
361
- exports.ZodIssueCode = util_1.util.arrayToEnum([
365
+ var util_js_1 = require_util();
366
+ exports.ZodIssueCode = util_js_1.util.arrayToEnum([
362
367
  "invalid_type",
363
368
  "invalid_literal",
364
369
  "custom",
@@ -382,6 +387,9 @@ var require_ZodError = __commonJS({
382
387
  };
383
388
  exports.quotelessJson = quotelessJson2;
384
389
  var ZodError2 = class _ZodError extends Error {
390
+ get errors() {
391
+ return this.issues;
392
+ }
385
393
  constructor(issues) {
386
394
  super();
387
395
  this.issues = [];
@@ -400,9 +408,6 @@ var require_ZodError = __commonJS({
400
408
  this.name = "ZodError";
401
409
  this.issues = issues;
402
410
  }
403
- get errors() {
404
- return this.issues;
405
- }
406
411
  format(_mapper) {
407
412
  const mapper = _mapper || function(issue) {
408
413
  return issue.message;
@@ -448,7 +453,7 @@ var require_ZodError = __commonJS({
448
453
  return this.message;
449
454
  }
450
455
  get message() {
451
- return JSON.stringify(this.issues, util_1.util.jsonStringifyReplacer, 2);
456
+ return JSON.stringify(this.issues, util_js_1.util.jsonStringifyReplacer, 2);
452
457
  }
453
458
  get isEmpty() {
454
459
  return this.issues.length === 0;
@@ -478,48 +483,48 @@ var require_ZodError = __commonJS({
478
483
  }
479
484
  });
480
485
 
481
- // ../../node_modules/zod/lib/locales/en.js
486
+ // ../../node_modules/zod/dist/cjs/v3/locales/en.js
482
487
  var require_en = __commonJS({
483
- "../../node_modules/zod/lib/locales/en.js"(exports) {
488
+ "../../node_modules/zod/dist/cjs/v3/locales/en.js"(exports) {
484
489
  "use strict";
485
490
  Object.defineProperty(exports, "__esModule", { value: true });
486
- var util_1 = require_util();
487
- var ZodError_1 = require_ZodError();
491
+ var ZodError_js_1 = require_ZodError();
492
+ var util_js_1 = require_util();
488
493
  var errorMap2 = (issue, _ctx) => {
489
494
  let message;
490
495
  switch (issue.code) {
491
- case ZodError_1.ZodIssueCode.invalid_type:
492
- if (issue.received === util_1.ZodParsedType.undefined) {
496
+ case ZodError_js_1.ZodIssueCode.invalid_type:
497
+ if (issue.received === util_js_1.ZodParsedType.undefined) {
493
498
  message = "Required";
494
499
  } else {
495
500
  message = `Expected ${issue.expected}, received ${issue.received}`;
496
501
  }
497
502
  break;
498
- case ZodError_1.ZodIssueCode.invalid_literal:
499
- message = `Invalid literal value, expected ${JSON.stringify(issue.expected, util_1.util.jsonStringifyReplacer)}`;
503
+ case ZodError_js_1.ZodIssueCode.invalid_literal:
504
+ message = `Invalid literal value, expected ${JSON.stringify(issue.expected, util_js_1.util.jsonStringifyReplacer)}`;
500
505
  break;
501
- case ZodError_1.ZodIssueCode.unrecognized_keys:
502
- message = `Unrecognized key(s) in object: ${util_1.util.joinValues(issue.keys, ", ")}`;
506
+ case ZodError_js_1.ZodIssueCode.unrecognized_keys:
507
+ message = `Unrecognized key(s) in object: ${util_js_1.util.joinValues(issue.keys, ", ")}`;
503
508
  break;
504
- case ZodError_1.ZodIssueCode.invalid_union:
509
+ case ZodError_js_1.ZodIssueCode.invalid_union:
505
510
  message = `Invalid input`;
506
511
  break;
507
- case ZodError_1.ZodIssueCode.invalid_union_discriminator:
508
- message = `Invalid discriminator value. Expected ${util_1.util.joinValues(issue.options)}`;
512
+ case ZodError_js_1.ZodIssueCode.invalid_union_discriminator:
513
+ message = `Invalid discriminator value. Expected ${util_js_1.util.joinValues(issue.options)}`;
509
514
  break;
510
- case ZodError_1.ZodIssueCode.invalid_enum_value:
511
- message = `Invalid enum value. Expected ${util_1.util.joinValues(issue.options)}, received '${issue.received}'`;
515
+ case ZodError_js_1.ZodIssueCode.invalid_enum_value:
516
+ message = `Invalid enum value. Expected ${util_js_1.util.joinValues(issue.options)}, received '${issue.received}'`;
512
517
  break;
513
- case ZodError_1.ZodIssueCode.invalid_arguments:
518
+ case ZodError_js_1.ZodIssueCode.invalid_arguments:
514
519
  message = `Invalid function arguments`;
515
520
  break;
516
- case ZodError_1.ZodIssueCode.invalid_return_type:
521
+ case ZodError_js_1.ZodIssueCode.invalid_return_type:
517
522
  message = `Invalid function return type`;
518
523
  break;
519
- case ZodError_1.ZodIssueCode.invalid_date:
524
+ case ZodError_js_1.ZodIssueCode.invalid_date:
520
525
  message = `Invalid date`;
521
526
  break;
522
- case ZodError_1.ZodIssueCode.invalid_string:
527
+ case ZodError_js_1.ZodIssueCode.invalid_string:
523
528
  if (typeof issue.validation === "object") {
524
529
  if ("includes" in issue.validation) {
525
530
  message = `Invalid input: must include "${issue.validation.includes}"`;
@@ -531,7 +536,7 @@ var require_en = __commonJS({
531
536
  } else if ("endsWith" in issue.validation) {
532
537
  message = `Invalid input: must end with "${issue.validation.endsWith}"`;
533
538
  } else {
534
- util_1.util.assertNever(issue.validation);
539
+ util_js_1.util.assertNever(issue.validation);
535
540
  }
536
541
  } else if (issue.validation !== "regex") {
537
542
  message = `Invalid ${issue.validation}`;
@@ -539,7 +544,7 @@ var require_en = __commonJS({
539
544
  message = "Invalid";
540
545
  }
541
546
  break;
542
- case ZodError_1.ZodIssueCode.too_small:
547
+ case ZodError_js_1.ZodIssueCode.too_small:
543
548
  if (issue.type === "array")
544
549
  message = `Array must contain ${issue.exact ? "exactly" : issue.inclusive ? `at least` : `more than`} ${issue.minimum} element(s)`;
545
550
  else if (issue.type === "string")
@@ -551,7 +556,7 @@ var require_en = __commonJS({
551
556
  else
552
557
  message = "Invalid input";
553
558
  break;
554
- case ZodError_1.ZodIssueCode.too_big:
559
+ case ZodError_js_1.ZodIssueCode.too_big:
555
560
  if (issue.type === "array")
556
561
  message = `Array must contain ${issue.exact ? `exactly` : issue.inclusive ? `at most` : `less than`} ${issue.maximum} element(s)`;
557
562
  else if (issue.type === "string")
@@ -565,21 +570,21 @@ var require_en = __commonJS({
565
570
  else
566
571
  message = "Invalid input";
567
572
  break;
568
- case ZodError_1.ZodIssueCode.custom:
573
+ case ZodError_js_1.ZodIssueCode.custom:
569
574
  message = `Invalid input`;
570
575
  break;
571
- case ZodError_1.ZodIssueCode.invalid_intersection_types:
576
+ case ZodError_js_1.ZodIssueCode.invalid_intersection_types:
572
577
  message = `Intersection results could not be merged`;
573
578
  break;
574
- case ZodError_1.ZodIssueCode.not_multiple_of:
579
+ case ZodError_js_1.ZodIssueCode.not_multiple_of:
575
580
  message = `Number must be a multiple of ${issue.multipleOf}`;
576
581
  break;
577
- case ZodError_1.ZodIssueCode.not_finite:
582
+ case ZodError_js_1.ZodIssueCode.not_finite:
578
583
  message = "Number must be finite";
579
584
  break;
580
585
  default:
581
586
  message = _ctx.defaultError;
582
- util_1.util.assertNever(issue);
587
+ util_js_1.util.assertNever(issue);
583
588
  }
584
589
  return { message };
585
590
  };
@@ -587,40 +592,41 @@ var require_en = __commonJS({
587
592
  }
588
593
  });
589
594
 
590
- // ../../node_modules/zod/lib/errors.js
595
+ // ../../node_modules/zod/dist/cjs/v3/errors.js
591
596
  var require_errors2 = __commonJS({
592
- "../../node_modules/zod/lib/errors.js"(exports) {
597
+ "../../node_modules/zod/dist/cjs/v3/errors.js"(exports) {
593
598
  "use strict";
594
599
  var __importDefault = exports && exports.__importDefault || function(mod) {
595
600
  return mod && mod.__esModule ? mod : { "default": mod };
596
601
  };
597
602
  Object.defineProperty(exports, "__esModule", { value: true });
598
- exports.getErrorMap = exports.setErrorMap = exports.defaultErrorMap = void 0;
599
- var en_1 = __importDefault(require_en());
600
- exports.defaultErrorMap = en_1.default;
601
- var overrideErrorMap2 = en_1.default;
603
+ exports.defaultErrorMap = void 0;
604
+ exports.setErrorMap = setErrorMap2;
605
+ exports.getErrorMap = getErrorMap2;
606
+ var en_js_1 = __importDefault(require_en());
607
+ exports.defaultErrorMap = en_js_1.default;
608
+ var overrideErrorMap2 = en_js_1.default;
602
609
  function setErrorMap2(map) {
603
610
  overrideErrorMap2 = map;
604
611
  }
605
- exports.setErrorMap = setErrorMap2;
606
612
  function getErrorMap2() {
607
613
  return overrideErrorMap2;
608
614
  }
609
- exports.getErrorMap = getErrorMap2;
610
615
  }
611
616
  });
612
617
 
613
- // ../../node_modules/zod/lib/helpers/parseUtil.js
618
+ // ../../node_modules/zod/dist/cjs/v3/helpers/parseUtil.js
614
619
  var require_parseUtil = __commonJS({
615
- "../../node_modules/zod/lib/helpers/parseUtil.js"(exports) {
620
+ "../../node_modules/zod/dist/cjs/v3/helpers/parseUtil.js"(exports) {
616
621
  "use strict";
617
622
  var __importDefault = exports && exports.__importDefault || function(mod) {
618
623
  return mod && mod.__esModule ? mod : { "default": mod };
619
624
  };
620
625
  Object.defineProperty(exports, "__esModule", { value: true });
621
- 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;
622
- var errors_1 = require_errors2();
623
- var en_1 = __importDefault(require_en());
626
+ exports.isAsync = exports.isValid = exports.isDirty = exports.isAborted = exports.OK = exports.DIRTY = exports.INVALID = exports.ParseStatus = exports.EMPTY_PATH = exports.makeIssue = void 0;
627
+ exports.addIssueToContext = addIssueToContext2;
628
+ var errors_js_1 = require_errors2();
629
+ var en_js_1 = __importDefault(require_en());
624
630
  var makeIssue2 = (params) => {
625
631
  const { data, path, errorMaps, issueData } = params;
626
632
  const fullPath = [...path, ...issueData.path || []];
@@ -649,22 +655,24 @@ var require_parseUtil = __commonJS({
649
655
  exports.makeIssue = makeIssue2;
650
656
  exports.EMPTY_PATH = [];
651
657
  function addIssueToContext2(ctx, issueData) {
652
- const overrideMap = (0, errors_1.getErrorMap)();
658
+ const overrideMap = (0, errors_js_1.getErrorMap)();
653
659
  const issue = (0, exports.makeIssue)({
654
660
  issueData,
655
661
  data: ctx.data,
656
662
  path: ctx.path,
657
663
  errorMaps: [
658
664
  ctx.common.contextualErrorMap,
665
+ // contextual error map is first priority
659
666
  ctx.schemaErrorMap,
667
+ // then schema-bound map if available
660
668
  overrideMap,
661
- overrideMap === en_1.default ? void 0 : en_1.default
669
+ // then global override map
670
+ overrideMap === en_js_1.default ? void 0 : en_js_1.default
662
671
  // then global default map
663
672
  ].filter((x) => !!x)
664
673
  });
665
674
  ctx.common.issues.push(issue);
666
675
  }
667
- exports.addIssueToContext = addIssueToContext2;
668
676
  var ParseStatus2 = class _ParseStatus {
669
677
  constructor() {
670
678
  this.value = "valid";
@@ -738,53 +746,42 @@ var require_parseUtil = __commonJS({
738
746
  }
739
747
  });
740
748
 
741
- // ../../node_modules/zod/lib/helpers/typeAliases.js
749
+ // ../../node_modules/zod/dist/cjs/v3/helpers/typeAliases.js
742
750
  var require_typeAliases = __commonJS({
743
- "../../node_modules/zod/lib/helpers/typeAliases.js"(exports) {
751
+ "../../node_modules/zod/dist/cjs/v3/helpers/typeAliases.js"(exports) {
744
752
  "use strict";
745
753
  Object.defineProperty(exports, "__esModule", { value: true });
746
754
  }
747
755
  });
748
756
 
749
- // ../../node_modules/zod/lib/helpers/errorUtil.js
757
+ // ../../node_modules/zod/dist/cjs/v3/helpers/errorUtil.js
750
758
  var require_errorUtil = __commonJS({
751
- "../../node_modules/zod/lib/helpers/errorUtil.js"(exports) {
759
+ "../../node_modules/zod/dist/cjs/v3/helpers/errorUtil.js"(exports) {
752
760
  "use strict";
753
761
  Object.defineProperty(exports, "__esModule", { value: true });
754
762
  exports.errorUtil = void 0;
755
763
  var errorUtil2;
756
764
  (function(errorUtil3) {
757
765
  errorUtil3.errToObj = (message) => typeof message === "string" ? { message } : message || {};
758
- errorUtil3.toString = (message) => typeof message === "string" ? message : message === null || message === void 0 ? void 0 : message.message;
759
- })(errorUtil2 = exports.errorUtil || (exports.errorUtil = {}));
766
+ errorUtil3.toString = (message) => typeof message === "string" ? message : message?.message;
767
+ })(errorUtil2 || (exports.errorUtil = errorUtil2 = {}));
760
768
  }
761
769
  });
762
770
 
763
- // ../../node_modules/zod/lib/types.js
771
+ // ../../node_modules/zod/dist/cjs/v3/types.js
764
772
  var require_types = __commonJS({
765
- "../../node_modules/zod/lib/types.js"(exports) {
773
+ "../../node_modules/zod/dist/cjs/v3/types.js"(exports) {
766
774
  "use strict";
767
- var __classPrivateFieldGet2 = exports && exports.__classPrivateFieldGet || function(receiver, state, kind, f) {
768
- if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter");
769
- if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot read private member from an object whose class did not declare it");
770
- return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
771
- };
772
- var __classPrivateFieldSet2 = exports && exports.__classPrivateFieldSet || function(receiver, state, value, kind, f) {
773
- if (kind === "m") throw new TypeError("Private method is not writable");
774
- if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a setter");
775
- if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot write private member to an object whose class did not declare it");
776
- return kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value), value;
777
- };
778
- var _ZodEnum_cache2;
779
- var _ZodNativeEnum_cache2;
780
775
  Object.defineProperty(exports, "__esModule", { value: true });
781
- 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;
782
- 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;
783
- var errors_1 = require_errors2();
784
- var errorUtil_1 = require_errorUtil();
785
- var parseUtil_1 = require_parseUtil();
786
- var util_1 = require_util();
787
- var ZodError_1 = require_ZodError();
776
+ 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;
777
+ 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;
778
+ exports.datetimeRegex = datetimeRegex2;
779
+ exports.custom = custom2;
780
+ var ZodError_js_1 = require_ZodError();
781
+ var errors_js_1 = require_errors2();
782
+ var errorUtil_js_1 = require_errorUtil();
783
+ var parseUtil_js_1 = require_parseUtil();
784
+ var util_js_1 = require_util();
788
785
  var ParseInputLazyPath2 = class {
789
786
  constructor(parent, value, path, key) {
790
787
  this._cachedPath = [];
@@ -795,7 +792,7 @@ var require_types = __commonJS({
795
792
  }
796
793
  get path() {
797
794
  if (!this._cachedPath.length) {
798
- if (this._key instanceof Array) {
795
+ if (Array.isArray(this._key)) {
799
796
  this._cachedPath.push(...this._path, ...this._key);
800
797
  } else {
801
798
  this._cachedPath.push(...this._path, this._key);
@@ -805,7 +802,7 @@ var require_types = __commonJS({
805
802
  }
806
803
  };
807
804
  var handleResult2 = (ctx, result) => {
808
- if ((0, parseUtil_1.isValid)(result)) {
805
+ if ((0, parseUtil_js_1.isValid)(result)) {
809
806
  return { success: true, data: result.value };
810
807
  } else {
811
808
  if (!ctx.common.issues.length) {
@@ -816,7 +813,7 @@ var require_types = __commonJS({
816
813
  get error() {
817
814
  if (this._error)
818
815
  return this._error;
819
- const error = new ZodError_1.ZodError(ctx.common.issues);
816
+ const error = new ZodError_js_1.ZodError(ctx.common.issues);
820
817
  this._error = error;
821
818
  return this._error;
822
819
  }
@@ -833,60 +830,31 @@ var require_types = __commonJS({
833
830
  if (errorMap2)
834
831
  return { errorMap: errorMap2, description };
835
832
  const customMap = (iss, ctx) => {
836
- var _a, _b;
837
833
  const { message } = params;
838
834
  if (iss.code === "invalid_enum_value") {
839
- return { message: message !== null && message !== void 0 ? message : ctx.defaultError };
835
+ return { message: message ?? ctx.defaultError };
840
836
  }
841
837
  if (typeof ctx.data === "undefined") {
842
- return { message: (_a = message !== null && message !== void 0 ? message : required_error) !== null && _a !== void 0 ? _a : ctx.defaultError };
838
+ return { message: message ?? required_error ?? ctx.defaultError };
843
839
  }
844
840
  if (iss.code !== "invalid_type")
845
841
  return { message: ctx.defaultError };
846
- return { message: (_b = message !== null && message !== void 0 ? message : invalid_type_error) !== null && _b !== void 0 ? _b : ctx.defaultError };
842
+ return { message: message ?? invalid_type_error ?? ctx.defaultError };
847
843
  };
848
844
  return { errorMap: customMap, description };
849
845
  }
850
846
  var ZodType2 = class {
851
- constructor(def) {
852
- this.spa = this.safeParseAsync;
853
- this._def = def;
854
- this.parse = this.parse.bind(this);
855
- this.safeParse = this.safeParse.bind(this);
856
- this.parseAsync = this.parseAsync.bind(this);
857
- this.safeParseAsync = this.safeParseAsync.bind(this);
858
- this.spa = this.spa.bind(this);
859
- this.refine = this.refine.bind(this);
860
- this.refinement = this.refinement.bind(this);
861
- this.superRefine = this.superRefine.bind(this);
862
- this.optional = this.optional.bind(this);
863
- this.nullable = this.nullable.bind(this);
864
- this.nullish = this.nullish.bind(this);
865
- this.array = this.array.bind(this);
866
- this.promise = this.promise.bind(this);
867
- this.or = this.or.bind(this);
868
- this.and = this.and.bind(this);
869
- this.transform = this.transform.bind(this);
870
- this.brand = this.brand.bind(this);
871
- this.default = this.default.bind(this);
872
- this.catch = this.catch.bind(this);
873
- this.describe = this.describe.bind(this);
874
- this.pipe = this.pipe.bind(this);
875
- this.readonly = this.readonly.bind(this);
876
- this.isNullable = this.isNullable.bind(this);
877
- this.isOptional = this.isOptional.bind(this);
878
- }
879
847
  get description() {
880
848
  return this._def.description;
881
849
  }
882
850
  _getType(input) {
883
- return (0, util_1.getParsedType)(input.data);
851
+ return (0, util_js_1.getParsedType)(input.data);
884
852
  }
885
853
  _getOrReturnCtx(input, ctx) {
886
854
  return ctx || {
887
855
  common: input.parent.common,
888
856
  data: input.data,
889
- parsedType: (0, util_1.getParsedType)(input.data),
857
+ parsedType: (0, util_js_1.getParsedType)(input.data),
890
858
  schemaErrorMap: this._def.errorMap,
891
859
  path: input.path,
892
860
  parent: input.parent
@@ -894,11 +862,11 @@ var require_types = __commonJS({
894
862
  }
895
863
  _processInputParams(input) {
896
864
  return {
897
- status: new parseUtil_1.ParseStatus(),
865
+ status: new parseUtil_js_1.ParseStatus(),
898
866
  ctx: {
899
867
  common: input.parent.common,
900
868
  data: input.data,
901
- parsedType: (0, util_1.getParsedType)(input.data),
869
+ parsedType: (0, util_js_1.getParsedType)(input.data),
902
870
  schemaErrorMap: this._def.errorMap,
903
871
  path: input.path,
904
872
  parent: input.parent
@@ -907,7 +875,7 @@ var require_types = __commonJS({
907
875
  }
908
876
  _parseSync(input) {
909
877
  const result = this._parse(input);
910
- if ((0, parseUtil_1.isAsync)(result)) {
878
+ if ((0, parseUtil_js_1.isAsync)(result)) {
911
879
  throw new Error("Synchronous parse encountered promise.");
912
880
  }
913
881
  return result;
@@ -923,22 +891,57 @@ var require_types = __commonJS({
923
891
  throw result.error;
924
892
  }
925
893
  safeParse(data, params) {
926
- var _a;
927
894
  const ctx = {
928
895
  common: {
929
896
  issues: [],
930
- async: (_a = params === null || params === void 0 ? void 0 : params.async) !== null && _a !== void 0 ? _a : false,
931
- contextualErrorMap: params === null || params === void 0 ? void 0 : params.errorMap
897
+ async: params?.async ?? false,
898
+ contextualErrorMap: params?.errorMap
932
899
  },
933
- path: (params === null || params === void 0 ? void 0 : params.path) || [],
900
+ path: params?.path || [],
934
901
  schemaErrorMap: this._def.errorMap,
935
902
  parent: null,
936
903
  data,
937
- parsedType: (0, util_1.getParsedType)(data)
904
+ parsedType: (0, util_js_1.getParsedType)(data)
938
905
  };
939
906
  const result = this._parseSync({ data, path: ctx.path, parent: ctx });
940
907
  return handleResult2(ctx, result);
941
908
  }
909
+ "~validate"(data) {
910
+ const ctx = {
911
+ common: {
912
+ issues: [],
913
+ async: !!this["~standard"].async
914
+ },
915
+ path: [],
916
+ schemaErrorMap: this._def.errorMap,
917
+ parent: null,
918
+ data,
919
+ parsedType: (0, util_js_1.getParsedType)(data)
920
+ };
921
+ if (!this["~standard"].async) {
922
+ try {
923
+ const result = this._parseSync({ data, path: [], parent: ctx });
924
+ return (0, parseUtil_js_1.isValid)(result) ? {
925
+ value: result.value
926
+ } : {
927
+ issues: ctx.common.issues
928
+ };
929
+ } catch (err) {
930
+ if (err?.message?.toLowerCase()?.includes("encountered")) {
931
+ this["~standard"].async = true;
932
+ }
933
+ ctx.common = {
934
+ issues: [],
935
+ async: true
936
+ };
937
+ }
938
+ }
939
+ return this._parseAsync({ data, path: [], parent: ctx }).then((result) => (0, parseUtil_js_1.isValid)(result) ? {
940
+ value: result.value
941
+ } : {
942
+ issues: ctx.common.issues
943
+ });
944
+ }
942
945
  async parseAsync(data, params) {
943
946
  const result = await this.safeParseAsync(data, params);
944
947
  if (result.success)
@@ -949,17 +952,17 @@ var require_types = __commonJS({
949
952
  const ctx = {
950
953
  common: {
951
954
  issues: [],
952
- contextualErrorMap: params === null || params === void 0 ? void 0 : params.errorMap,
955
+ contextualErrorMap: params?.errorMap,
953
956
  async: true
954
957
  },
955
- path: (params === null || params === void 0 ? void 0 : params.path) || [],
958
+ path: params?.path || [],
956
959
  schemaErrorMap: this._def.errorMap,
957
960
  parent: null,
958
961
  data,
959
- parsedType: (0, util_1.getParsedType)(data)
962
+ parsedType: (0, util_js_1.getParsedType)(data)
960
963
  };
961
964
  const maybeAsyncResult = this._parse({ data, path: ctx.path, parent: ctx });
962
- const result = await ((0, parseUtil_1.isAsync)(maybeAsyncResult) ? maybeAsyncResult : Promise.resolve(maybeAsyncResult));
965
+ const result = await ((0, parseUtil_js_1.isAsync)(maybeAsyncResult) ? maybeAsyncResult : Promise.resolve(maybeAsyncResult));
963
966
  return handleResult2(ctx, result);
964
967
  }
965
968
  refine(check, message) {
@@ -975,7 +978,7 @@ var require_types = __commonJS({
975
978
  return this._refinement((val, ctx) => {
976
979
  const result = check(val);
977
980
  const setError = () => ctx.addIssue({
978
- code: ZodError_1.ZodIssueCode.custom,
981
+ code: ZodError_js_1.ZodIssueCode.custom,
979
982
  ...getIssueProperties(val)
980
983
  });
981
984
  if (typeof Promise !== "undefined" && result instanceof Promise) {
@@ -1016,6 +1019,39 @@ var require_types = __commonJS({
1016
1019
  superRefine(refinement) {
1017
1020
  return this._refinement(refinement);
1018
1021
  }
1022
+ constructor(def) {
1023
+ this.spa = this.safeParseAsync;
1024
+ this._def = def;
1025
+ this.parse = this.parse.bind(this);
1026
+ this.safeParse = this.safeParse.bind(this);
1027
+ this.parseAsync = this.parseAsync.bind(this);
1028
+ this.safeParseAsync = this.safeParseAsync.bind(this);
1029
+ this.spa = this.spa.bind(this);
1030
+ this.refine = this.refine.bind(this);
1031
+ this.refinement = this.refinement.bind(this);
1032
+ this.superRefine = this.superRefine.bind(this);
1033
+ this.optional = this.optional.bind(this);
1034
+ this.nullable = this.nullable.bind(this);
1035
+ this.nullish = this.nullish.bind(this);
1036
+ this.array = this.array.bind(this);
1037
+ this.promise = this.promise.bind(this);
1038
+ this.or = this.or.bind(this);
1039
+ this.and = this.and.bind(this);
1040
+ this.transform = this.transform.bind(this);
1041
+ this.brand = this.brand.bind(this);
1042
+ this.default = this.default.bind(this);
1043
+ this.catch = this.catch.bind(this);
1044
+ this.describe = this.describe.bind(this);
1045
+ this.pipe = this.pipe.bind(this);
1046
+ this.readonly = this.readonly.bind(this);
1047
+ this.isNullable = this.isNullable.bind(this);
1048
+ this.isOptional = this.isOptional.bind(this);
1049
+ this["~standard"] = {
1050
+ version: 1,
1051
+ vendor: "zod",
1052
+ validate: (data) => this["~validate"](data)
1053
+ };
1054
+ }
1019
1055
  optional() {
1020
1056
  return ZodOptional2.create(this, this._def);
1021
1057
  }
@@ -1026,7 +1062,7 @@ var require_types = __commonJS({
1026
1062
  return this.nullable().optional();
1027
1063
  }
1028
1064
  array() {
1029
- return ZodArray2.create(this, this._def);
1065
+ return ZodArray2.create(this);
1030
1066
  }
1031
1067
  promise() {
1032
1068
  return ZodPromise2.create(this, this._def);
@@ -1095,26 +1131,31 @@ var require_types = __commonJS({
1095
1131
  exports.ZodSchema = ZodType2;
1096
1132
  var cuidRegex2 = /^c[^\s-]{8,}$/i;
1097
1133
  var cuid2Regex2 = /^[0-9a-z]+$/;
1098
- var ulidRegex2 = /^[0-9A-HJKMNP-TV-Z]{26}$/;
1134
+ var ulidRegex2 = /^[0-9A-HJKMNP-TV-Z]{26}$/i;
1099
1135
  var uuidRegex2 = /^[0-9a-fA-F]{8}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{12}$/i;
1100
1136
  var nanoidRegex2 = /^[a-z0-9_-]{21}$/i;
1137
+ var jwtRegex2 = /^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/;
1101
1138
  var durationRegex2 = /^[-+]?P(?!$)(?:(?:[-+]?\d+Y)|(?:[-+]?\d+[.,]\d+Y$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:(?:[-+]?\d+W)|(?:[-+]?\d+[.,]\d+W$))?(?:(?:[-+]?\d+D)|(?:[-+]?\d+[.,]\d+D$))?(?:T(?=[\d+-])(?:(?:[-+]?\d+H)|(?:[-+]?\d+[.,]\d+H$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:[-+]?\d+(?:[.,]\d+)?S)?)??$/;
1102
1139
  var emailRegex2 = /^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i;
1103
1140
  var _emojiRegex2 = `^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$`;
1104
1141
  var emojiRegex2;
1105
1142
  var ipv4Regex2 = /^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])$/;
1106
- var ipv6Regex2 = /^(([a-f0-9]{1,4}:){7}|::([a-f0-9]{1,4}:){0,6}|([a-f0-9]{1,4}:){1}:([a-f0-9]{1,4}:){0,5}|([a-f0-9]{1,4}:){2}:([a-f0-9]{1,4}:){0,4}|([a-f0-9]{1,4}:){3}:([a-f0-9]{1,4}:){0,3}|([a-f0-9]{1,4}:){4}:([a-f0-9]{1,4}:){0,2}|([a-f0-9]{1,4}:){5}:([a-f0-9]{1,4}:){0,1})([a-f0-9]{1,4}|(((25[0-5])|(2[0-4][0-9])|(1[0-9]{2})|([0-9]{1,2}))\.){3}((25[0-5])|(2[0-4][0-9])|(1[0-9]{2})|([0-9]{1,2})))$/;
1143
+ var ipv4CidrRegex2 = /^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\/(3[0-2]|[12]?[0-9])$/;
1144
+ var ipv6Regex2 = /^(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))$/;
1145
+ var ipv6CidrRegex2 = /^(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/;
1107
1146
  var base64Regex2 = /^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/;
1147
+ var base64urlRegex2 = /^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/;
1108
1148
  var dateRegexSource2 = `((\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-((0[13578]|1[02])-(0[1-9]|[12]\\d|3[01])|(0[469]|11)-(0[1-9]|[12]\\d|30)|(02)-(0[1-9]|1\\d|2[0-8])))`;
1109
1149
  var dateRegex2 = new RegExp(`^${dateRegexSource2}$`);
1110
1150
  function timeRegexSource2(args) {
1111
- let regex = `([01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d`;
1151
+ let secondsRegexSource = `[0-5]\\d`;
1112
1152
  if (args.precision) {
1113
- regex = `${regex}\\.\\d{${args.precision}}`;
1153
+ secondsRegexSource = `${secondsRegexSource}\\.\\d{${args.precision}}`;
1114
1154
  } else if (args.precision == null) {
1115
- regex = `${regex}(\\.\\d+)?`;
1155
+ secondsRegexSource = `${secondsRegexSource}(\\.\\d+)?`;
1116
1156
  }
1117
- return regex;
1157
+ const secondsQuantifier = args.precision ? "+" : "?";
1158
+ return `([01]\\d|2[0-3]):[0-5]\\d(:${secondsRegexSource})${secondsQuantifier}`;
1118
1159
  }
1119
1160
  function timeRegex2(args) {
1120
1161
  return new RegExp(`^${timeRegexSource2(args)}$`);
@@ -1128,7 +1169,6 @@ var require_types = __commonJS({
1128
1169
  regex = `${regex}(${opts.join("|")})`;
1129
1170
  return new RegExp(`^${regex}$`);
1130
1171
  }
1131
- exports.datetimeRegex = datetimeRegex2;
1132
1172
  function isValidIP2(ip, version) {
1133
1173
  if ((version === "v4" || !version) && ipv4Regex2.test(ip)) {
1134
1174
  return true;
@@ -1138,29 +1178,58 @@ var require_types = __commonJS({
1138
1178
  }
1139
1179
  return false;
1140
1180
  }
1181
+ function isValidJWT2(jwt, alg) {
1182
+ if (!jwtRegex2.test(jwt))
1183
+ return false;
1184
+ try {
1185
+ const [header] = jwt.split(".");
1186
+ const base64 = header.replace(/-/g, "+").replace(/_/g, "/").padEnd(header.length + (4 - header.length % 4) % 4, "=");
1187
+ const decoded = JSON.parse(atob(base64));
1188
+ if (typeof decoded !== "object" || decoded === null)
1189
+ return false;
1190
+ if ("typ" in decoded && decoded?.typ !== "JWT")
1191
+ return false;
1192
+ if (!decoded.alg)
1193
+ return false;
1194
+ if (alg && decoded.alg !== alg)
1195
+ return false;
1196
+ return true;
1197
+ } catch {
1198
+ return false;
1199
+ }
1200
+ }
1201
+ function isValidCidr2(ip, version) {
1202
+ if ((version === "v4" || !version) && ipv4CidrRegex2.test(ip)) {
1203
+ return true;
1204
+ }
1205
+ if ((version === "v6" || !version) && ipv6CidrRegex2.test(ip)) {
1206
+ return true;
1207
+ }
1208
+ return false;
1209
+ }
1141
1210
  var ZodString2 = class _ZodString extends ZodType2 {
1142
1211
  _parse(input) {
1143
1212
  if (this._def.coerce) {
1144
1213
  input.data = String(input.data);
1145
1214
  }
1146
1215
  const parsedType = this._getType(input);
1147
- if (parsedType !== util_1.ZodParsedType.string) {
1216
+ if (parsedType !== util_js_1.ZodParsedType.string) {
1148
1217
  const ctx2 = this._getOrReturnCtx(input);
1149
- (0, parseUtil_1.addIssueToContext)(ctx2, {
1150
- code: ZodError_1.ZodIssueCode.invalid_type,
1151
- expected: util_1.ZodParsedType.string,
1218
+ (0, parseUtil_js_1.addIssueToContext)(ctx2, {
1219
+ code: ZodError_js_1.ZodIssueCode.invalid_type,
1220
+ expected: util_js_1.ZodParsedType.string,
1152
1221
  received: ctx2.parsedType
1153
1222
  });
1154
- return parseUtil_1.INVALID;
1223
+ return parseUtil_js_1.INVALID;
1155
1224
  }
1156
- const status = new parseUtil_1.ParseStatus();
1225
+ const status = new parseUtil_js_1.ParseStatus();
1157
1226
  let ctx = void 0;
1158
1227
  for (const check of this._def.checks) {
1159
1228
  if (check.kind === "min") {
1160
1229
  if (input.data.length < check.value) {
1161
1230
  ctx = this._getOrReturnCtx(input, ctx);
1162
- (0, parseUtil_1.addIssueToContext)(ctx, {
1163
- code: ZodError_1.ZodIssueCode.too_small,
1231
+ (0, parseUtil_js_1.addIssueToContext)(ctx, {
1232
+ code: ZodError_js_1.ZodIssueCode.too_small,
1164
1233
  minimum: check.value,
1165
1234
  type: "string",
1166
1235
  inclusive: true,
@@ -1172,8 +1241,8 @@ var require_types = __commonJS({
1172
1241
  } else if (check.kind === "max") {
1173
1242
  if (input.data.length > check.value) {
1174
1243
  ctx = this._getOrReturnCtx(input, ctx);
1175
- (0, parseUtil_1.addIssueToContext)(ctx, {
1176
- code: ZodError_1.ZodIssueCode.too_big,
1244
+ (0, parseUtil_js_1.addIssueToContext)(ctx, {
1245
+ code: ZodError_js_1.ZodIssueCode.too_big,
1177
1246
  maximum: check.value,
1178
1247
  type: "string",
1179
1248
  inclusive: true,
@@ -1188,8 +1257,8 @@ var require_types = __commonJS({
1188
1257
  if (tooBig || tooSmall) {
1189
1258
  ctx = this._getOrReturnCtx(input, ctx);
1190
1259
  if (tooBig) {
1191
- (0, parseUtil_1.addIssueToContext)(ctx, {
1192
- code: ZodError_1.ZodIssueCode.too_big,
1260
+ (0, parseUtil_js_1.addIssueToContext)(ctx, {
1261
+ code: ZodError_js_1.ZodIssueCode.too_big,
1193
1262
  maximum: check.value,
1194
1263
  type: "string",
1195
1264
  inclusive: true,
@@ -1197,8 +1266,8 @@ var require_types = __commonJS({
1197
1266
  message: check.message
1198
1267
  });
1199
1268
  } else if (tooSmall) {
1200
- (0, parseUtil_1.addIssueToContext)(ctx, {
1201
- code: ZodError_1.ZodIssueCode.too_small,
1269
+ (0, parseUtil_js_1.addIssueToContext)(ctx, {
1270
+ code: ZodError_js_1.ZodIssueCode.too_small,
1202
1271
  minimum: check.value,
1203
1272
  type: "string",
1204
1273
  inclusive: true,
@@ -1211,9 +1280,9 @@ var require_types = __commonJS({
1211
1280
  } else if (check.kind === "email") {
1212
1281
  if (!emailRegex2.test(input.data)) {
1213
1282
  ctx = this._getOrReturnCtx(input, ctx);
1214
- (0, parseUtil_1.addIssueToContext)(ctx, {
1283
+ (0, parseUtil_js_1.addIssueToContext)(ctx, {
1215
1284
  validation: "email",
1216
- code: ZodError_1.ZodIssueCode.invalid_string,
1285
+ code: ZodError_js_1.ZodIssueCode.invalid_string,
1217
1286
  message: check.message
1218
1287
  });
1219
1288
  status.dirty();
@@ -1224,9 +1293,9 @@ var require_types = __commonJS({
1224
1293
  }
1225
1294
  if (!emojiRegex2.test(input.data)) {
1226
1295
  ctx = this._getOrReturnCtx(input, ctx);
1227
- (0, parseUtil_1.addIssueToContext)(ctx, {
1296
+ (0, parseUtil_js_1.addIssueToContext)(ctx, {
1228
1297
  validation: "emoji",
1229
- code: ZodError_1.ZodIssueCode.invalid_string,
1298
+ code: ZodError_js_1.ZodIssueCode.invalid_string,
1230
1299
  message: check.message
1231
1300
  });
1232
1301
  status.dirty();
@@ -1234,9 +1303,9 @@ var require_types = __commonJS({
1234
1303
  } else if (check.kind === "uuid") {
1235
1304
  if (!uuidRegex2.test(input.data)) {
1236
1305
  ctx = this._getOrReturnCtx(input, ctx);
1237
- (0, parseUtil_1.addIssueToContext)(ctx, {
1306
+ (0, parseUtil_js_1.addIssueToContext)(ctx, {
1238
1307
  validation: "uuid",
1239
- code: ZodError_1.ZodIssueCode.invalid_string,
1308
+ code: ZodError_js_1.ZodIssueCode.invalid_string,
1240
1309
  message: check.message
1241
1310
  });
1242
1311
  status.dirty();
@@ -1244,9 +1313,9 @@ var require_types = __commonJS({
1244
1313
  } else if (check.kind === "nanoid") {
1245
1314
  if (!nanoidRegex2.test(input.data)) {
1246
1315
  ctx = this._getOrReturnCtx(input, ctx);
1247
- (0, parseUtil_1.addIssueToContext)(ctx, {
1316
+ (0, parseUtil_js_1.addIssueToContext)(ctx, {
1248
1317
  validation: "nanoid",
1249
- code: ZodError_1.ZodIssueCode.invalid_string,
1318
+ code: ZodError_js_1.ZodIssueCode.invalid_string,
1250
1319
  message: check.message
1251
1320
  });
1252
1321
  status.dirty();
@@ -1254,9 +1323,9 @@ var require_types = __commonJS({
1254
1323
  } else if (check.kind === "cuid") {
1255
1324
  if (!cuidRegex2.test(input.data)) {
1256
1325
  ctx = this._getOrReturnCtx(input, ctx);
1257
- (0, parseUtil_1.addIssueToContext)(ctx, {
1326
+ (0, parseUtil_js_1.addIssueToContext)(ctx, {
1258
1327
  validation: "cuid",
1259
- code: ZodError_1.ZodIssueCode.invalid_string,
1328
+ code: ZodError_js_1.ZodIssueCode.invalid_string,
1260
1329
  message: check.message
1261
1330
  });
1262
1331
  status.dirty();
@@ -1264,9 +1333,9 @@ var require_types = __commonJS({
1264
1333
  } else if (check.kind === "cuid2") {
1265
1334
  if (!cuid2Regex2.test(input.data)) {
1266
1335
  ctx = this._getOrReturnCtx(input, ctx);
1267
- (0, parseUtil_1.addIssueToContext)(ctx, {
1336
+ (0, parseUtil_js_1.addIssueToContext)(ctx, {
1268
1337
  validation: "cuid2",
1269
- code: ZodError_1.ZodIssueCode.invalid_string,
1338
+ code: ZodError_js_1.ZodIssueCode.invalid_string,
1270
1339
  message: check.message
1271
1340
  });
1272
1341
  status.dirty();
@@ -1274,9 +1343,9 @@ var require_types = __commonJS({
1274
1343
  } else if (check.kind === "ulid") {
1275
1344
  if (!ulidRegex2.test(input.data)) {
1276
1345
  ctx = this._getOrReturnCtx(input, ctx);
1277
- (0, parseUtil_1.addIssueToContext)(ctx, {
1346
+ (0, parseUtil_js_1.addIssueToContext)(ctx, {
1278
1347
  validation: "ulid",
1279
- code: ZodError_1.ZodIssueCode.invalid_string,
1348
+ code: ZodError_js_1.ZodIssueCode.invalid_string,
1280
1349
  message: check.message
1281
1350
  });
1282
1351
  status.dirty();
@@ -1284,11 +1353,11 @@ var require_types = __commonJS({
1284
1353
  } else if (check.kind === "url") {
1285
1354
  try {
1286
1355
  new URL(input.data);
1287
- } catch (_a) {
1356
+ } catch {
1288
1357
  ctx = this._getOrReturnCtx(input, ctx);
1289
- (0, parseUtil_1.addIssueToContext)(ctx, {
1358
+ (0, parseUtil_js_1.addIssueToContext)(ctx, {
1290
1359
  validation: "url",
1291
- code: ZodError_1.ZodIssueCode.invalid_string,
1360
+ code: ZodError_js_1.ZodIssueCode.invalid_string,
1292
1361
  message: check.message
1293
1362
  });
1294
1363
  status.dirty();
@@ -1298,9 +1367,9 @@ var require_types = __commonJS({
1298
1367
  const testResult = check.regex.test(input.data);
1299
1368
  if (!testResult) {
1300
1369
  ctx = this._getOrReturnCtx(input, ctx);
1301
- (0, parseUtil_1.addIssueToContext)(ctx, {
1370
+ (0, parseUtil_js_1.addIssueToContext)(ctx, {
1302
1371
  validation: "regex",
1303
- code: ZodError_1.ZodIssueCode.invalid_string,
1372
+ code: ZodError_js_1.ZodIssueCode.invalid_string,
1304
1373
  message: check.message
1305
1374
  });
1306
1375
  status.dirty();
@@ -1310,8 +1379,8 @@ var require_types = __commonJS({
1310
1379
  } else if (check.kind === "includes") {
1311
1380
  if (!input.data.includes(check.value, check.position)) {
1312
1381
  ctx = this._getOrReturnCtx(input, ctx);
1313
- (0, parseUtil_1.addIssueToContext)(ctx, {
1314
- code: ZodError_1.ZodIssueCode.invalid_string,
1382
+ (0, parseUtil_js_1.addIssueToContext)(ctx, {
1383
+ code: ZodError_js_1.ZodIssueCode.invalid_string,
1315
1384
  validation: { includes: check.value, position: check.position },
1316
1385
  message: check.message
1317
1386
  });
@@ -1324,8 +1393,8 @@ var require_types = __commonJS({
1324
1393
  } else if (check.kind === "startsWith") {
1325
1394
  if (!input.data.startsWith(check.value)) {
1326
1395
  ctx = this._getOrReturnCtx(input, ctx);
1327
- (0, parseUtil_1.addIssueToContext)(ctx, {
1328
- code: ZodError_1.ZodIssueCode.invalid_string,
1396
+ (0, parseUtil_js_1.addIssueToContext)(ctx, {
1397
+ code: ZodError_js_1.ZodIssueCode.invalid_string,
1329
1398
  validation: { startsWith: check.value },
1330
1399
  message: check.message
1331
1400
  });
@@ -1334,8 +1403,8 @@ var require_types = __commonJS({
1334
1403
  } else if (check.kind === "endsWith") {
1335
1404
  if (!input.data.endsWith(check.value)) {
1336
1405
  ctx = this._getOrReturnCtx(input, ctx);
1337
- (0, parseUtil_1.addIssueToContext)(ctx, {
1338
- code: ZodError_1.ZodIssueCode.invalid_string,
1406
+ (0, parseUtil_js_1.addIssueToContext)(ctx, {
1407
+ code: ZodError_js_1.ZodIssueCode.invalid_string,
1339
1408
  validation: { endsWith: check.value },
1340
1409
  message: check.message
1341
1410
  });
@@ -1345,8 +1414,8 @@ var require_types = __commonJS({
1345
1414
  const regex = datetimeRegex2(check);
1346
1415
  if (!regex.test(input.data)) {
1347
1416
  ctx = this._getOrReturnCtx(input, ctx);
1348
- (0, parseUtil_1.addIssueToContext)(ctx, {
1349
- code: ZodError_1.ZodIssueCode.invalid_string,
1417
+ (0, parseUtil_js_1.addIssueToContext)(ctx, {
1418
+ code: ZodError_js_1.ZodIssueCode.invalid_string,
1350
1419
  validation: "datetime",
1351
1420
  message: check.message
1352
1421
  });
@@ -1356,8 +1425,8 @@ var require_types = __commonJS({
1356
1425
  const regex = dateRegex2;
1357
1426
  if (!regex.test(input.data)) {
1358
1427
  ctx = this._getOrReturnCtx(input, ctx);
1359
- (0, parseUtil_1.addIssueToContext)(ctx, {
1360
- code: ZodError_1.ZodIssueCode.invalid_string,
1428
+ (0, parseUtil_js_1.addIssueToContext)(ctx, {
1429
+ code: ZodError_js_1.ZodIssueCode.invalid_string,
1361
1430
  validation: "date",
1362
1431
  message: check.message
1363
1432
  });
@@ -1367,8 +1436,8 @@ var require_types = __commonJS({
1367
1436
  const regex = timeRegex2(check);
1368
1437
  if (!regex.test(input.data)) {
1369
1438
  ctx = this._getOrReturnCtx(input, ctx);
1370
- (0, parseUtil_1.addIssueToContext)(ctx, {
1371
- code: ZodError_1.ZodIssueCode.invalid_string,
1439
+ (0, parseUtil_js_1.addIssueToContext)(ctx, {
1440
+ code: ZodError_js_1.ZodIssueCode.invalid_string,
1372
1441
  validation: "time",
1373
1442
  message: check.message
1374
1443
  });
@@ -1377,9 +1446,9 @@ var require_types = __commonJS({
1377
1446
  } else if (check.kind === "duration") {
1378
1447
  if (!durationRegex2.test(input.data)) {
1379
1448
  ctx = this._getOrReturnCtx(input, ctx);
1380
- (0, parseUtil_1.addIssueToContext)(ctx, {
1449
+ (0, parseUtil_js_1.addIssueToContext)(ctx, {
1381
1450
  validation: "duration",
1382
- code: ZodError_1.ZodIssueCode.invalid_string,
1451
+ code: ZodError_js_1.ZodIssueCode.invalid_string,
1383
1452
  message: check.message
1384
1453
  });
1385
1454
  status.dirty();
@@ -1387,9 +1456,29 @@ var require_types = __commonJS({
1387
1456
  } else if (check.kind === "ip") {
1388
1457
  if (!isValidIP2(input.data, check.version)) {
1389
1458
  ctx = this._getOrReturnCtx(input, ctx);
1390
- (0, parseUtil_1.addIssueToContext)(ctx, {
1459
+ (0, parseUtil_js_1.addIssueToContext)(ctx, {
1391
1460
  validation: "ip",
1392
- code: ZodError_1.ZodIssueCode.invalid_string,
1461
+ code: ZodError_js_1.ZodIssueCode.invalid_string,
1462
+ message: check.message
1463
+ });
1464
+ status.dirty();
1465
+ }
1466
+ } else if (check.kind === "jwt") {
1467
+ if (!isValidJWT2(input.data, check.alg)) {
1468
+ ctx = this._getOrReturnCtx(input, ctx);
1469
+ (0, parseUtil_js_1.addIssueToContext)(ctx, {
1470
+ validation: "jwt",
1471
+ code: ZodError_js_1.ZodIssueCode.invalid_string,
1472
+ message: check.message
1473
+ });
1474
+ status.dirty();
1475
+ }
1476
+ } else if (check.kind === "cidr") {
1477
+ if (!isValidCidr2(input.data, check.version)) {
1478
+ ctx = this._getOrReturnCtx(input, ctx);
1479
+ (0, parseUtil_js_1.addIssueToContext)(ctx, {
1480
+ validation: "cidr",
1481
+ code: ZodError_js_1.ZodIssueCode.invalid_string,
1393
1482
  message: check.message
1394
1483
  });
1395
1484
  status.dirty();
@@ -1397,15 +1486,25 @@ var require_types = __commonJS({
1397
1486
  } else if (check.kind === "base64") {
1398
1487
  if (!base64Regex2.test(input.data)) {
1399
1488
  ctx = this._getOrReturnCtx(input, ctx);
1400
- (0, parseUtil_1.addIssueToContext)(ctx, {
1489
+ (0, parseUtil_js_1.addIssueToContext)(ctx, {
1401
1490
  validation: "base64",
1402
- code: ZodError_1.ZodIssueCode.invalid_string,
1491
+ code: ZodError_js_1.ZodIssueCode.invalid_string,
1492
+ message: check.message
1493
+ });
1494
+ status.dirty();
1495
+ }
1496
+ } else if (check.kind === "base64url") {
1497
+ if (!base64urlRegex2.test(input.data)) {
1498
+ ctx = this._getOrReturnCtx(input, ctx);
1499
+ (0, parseUtil_js_1.addIssueToContext)(ctx, {
1500
+ validation: "base64url",
1501
+ code: ZodError_js_1.ZodIssueCode.invalid_string,
1403
1502
  message: check.message
1404
1503
  });
1405
1504
  status.dirty();
1406
1505
  }
1407
1506
  } else {
1408
- util_1.util.assertNever(check);
1507
+ util_js_1.util.assertNever(check);
1409
1508
  }
1410
1509
  }
1411
1510
  return { status: status.value, value: input.data };
@@ -1413,8 +1512,8 @@ var require_types = __commonJS({
1413
1512
  _regex(regex, validation, message) {
1414
1513
  return this.refinement((data) => regex.test(data), {
1415
1514
  validation,
1416
- code: ZodError_1.ZodIssueCode.invalid_string,
1417
- ...errorUtil_1.errorUtil.errToObj(message)
1515
+ code: ZodError_js_1.ZodIssueCode.invalid_string,
1516
+ ...errorUtil_js_1.errorUtil.errToObj(message)
1418
1517
  });
1419
1518
  }
1420
1519
  _addCheck(check) {
@@ -1424,37 +1523,48 @@ var require_types = __commonJS({
1424
1523
  });
1425
1524
  }
1426
1525
  email(message) {
1427
- return this._addCheck({ kind: "email", ...errorUtil_1.errorUtil.errToObj(message) });
1526
+ return this._addCheck({ kind: "email", ...errorUtil_js_1.errorUtil.errToObj(message) });
1428
1527
  }
1429
1528
  url(message) {
1430
- return this._addCheck({ kind: "url", ...errorUtil_1.errorUtil.errToObj(message) });
1529
+ return this._addCheck({ kind: "url", ...errorUtil_js_1.errorUtil.errToObj(message) });
1431
1530
  }
1432
1531
  emoji(message) {
1433
- return this._addCheck({ kind: "emoji", ...errorUtil_1.errorUtil.errToObj(message) });
1532
+ return this._addCheck({ kind: "emoji", ...errorUtil_js_1.errorUtil.errToObj(message) });
1434
1533
  }
1435
1534
  uuid(message) {
1436
- return this._addCheck({ kind: "uuid", ...errorUtil_1.errorUtil.errToObj(message) });
1535
+ return this._addCheck({ kind: "uuid", ...errorUtil_js_1.errorUtil.errToObj(message) });
1437
1536
  }
1438
1537
  nanoid(message) {
1439
- return this._addCheck({ kind: "nanoid", ...errorUtil_1.errorUtil.errToObj(message) });
1538
+ return this._addCheck({ kind: "nanoid", ...errorUtil_js_1.errorUtil.errToObj(message) });
1440
1539
  }
1441
1540
  cuid(message) {
1442
- return this._addCheck({ kind: "cuid", ...errorUtil_1.errorUtil.errToObj(message) });
1541
+ return this._addCheck({ kind: "cuid", ...errorUtil_js_1.errorUtil.errToObj(message) });
1443
1542
  }
1444
1543
  cuid2(message) {
1445
- return this._addCheck({ kind: "cuid2", ...errorUtil_1.errorUtil.errToObj(message) });
1544
+ return this._addCheck({ kind: "cuid2", ...errorUtil_js_1.errorUtil.errToObj(message) });
1446
1545
  }
1447
1546
  ulid(message) {
1448
- return this._addCheck({ kind: "ulid", ...errorUtil_1.errorUtil.errToObj(message) });
1547
+ return this._addCheck({ kind: "ulid", ...errorUtil_js_1.errorUtil.errToObj(message) });
1449
1548
  }
1450
1549
  base64(message) {
1451
- return this._addCheck({ kind: "base64", ...errorUtil_1.errorUtil.errToObj(message) });
1550
+ return this._addCheck({ kind: "base64", ...errorUtil_js_1.errorUtil.errToObj(message) });
1551
+ }
1552
+ base64url(message) {
1553
+ return this._addCheck({
1554
+ kind: "base64url",
1555
+ ...errorUtil_js_1.errorUtil.errToObj(message)
1556
+ });
1557
+ }
1558
+ jwt(options) {
1559
+ return this._addCheck({ kind: "jwt", ...errorUtil_js_1.errorUtil.errToObj(options) });
1452
1560
  }
1453
1561
  ip(options) {
1454
- return this._addCheck({ kind: "ip", ...errorUtil_1.errorUtil.errToObj(options) });
1562
+ return this._addCheck({ kind: "ip", ...errorUtil_js_1.errorUtil.errToObj(options) });
1563
+ }
1564
+ cidr(options) {
1565
+ return this._addCheck({ kind: "cidr", ...errorUtil_js_1.errorUtil.errToObj(options) });
1455
1566
  }
1456
1567
  datetime(options) {
1457
- var _a, _b;
1458
1568
  if (typeof options === "string") {
1459
1569
  return this._addCheck({
1460
1570
  kind: "datetime",
@@ -1466,10 +1576,10 @@ var require_types = __commonJS({
1466
1576
  }
1467
1577
  return this._addCheck({
1468
1578
  kind: "datetime",
1469
- precision: typeof (options === null || options === void 0 ? void 0 : options.precision) === "undefined" ? null : options === null || options === void 0 ? void 0 : options.precision,
1470
- offset: (_a = options === null || options === void 0 ? void 0 : options.offset) !== null && _a !== void 0 ? _a : false,
1471
- local: (_b = options === null || options === void 0 ? void 0 : options.local) !== null && _b !== void 0 ? _b : false,
1472
- ...errorUtil_1.errorUtil.errToObj(options === null || options === void 0 ? void 0 : options.message)
1579
+ precision: typeof options?.precision === "undefined" ? null : options?.precision,
1580
+ offset: options?.offset ?? false,
1581
+ local: options?.local ?? false,
1582
+ ...errorUtil_js_1.errorUtil.errToObj(options?.message)
1473
1583
  });
1474
1584
  }
1475
1585
  date(message) {
@@ -1485,69 +1595,68 @@ var require_types = __commonJS({
1485
1595
  }
1486
1596
  return this._addCheck({
1487
1597
  kind: "time",
1488
- precision: typeof (options === null || options === void 0 ? void 0 : options.precision) === "undefined" ? null : options === null || options === void 0 ? void 0 : options.precision,
1489
- ...errorUtil_1.errorUtil.errToObj(options === null || options === void 0 ? void 0 : options.message)
1598
+ precision: typeof options?.precision === "undefined" ? null : options?.precision,
1599
+ ...errorUtil_js_1.errorUtil.errToObj(options?.message)
1490
1600
  });
1491
1601
  }
1492
1602
  duration(message) {
1493
- return this._addCheck({ kind: "duration", ...errorUtil_1.errorUtil.errToObj(message) });
1603
+ return this._addCheck({ kind: "duration", ...errorUtil_js_1.errorUtil.errToObj(message) });
1494
1604
  }
1495
1605
  regex(regex, message) {
1496
1606
  return this._addCheck({
1497
1607
  kind: "regex",
1498
1608
  regex,
1499
- ...errorUtil_1.errorUtil.errToObj(message)
1609
+ ...errorUtil_js_1.errorUtil.errToObj(message)
1500
1610
  });
1501
1611
  }
1502
1612
  includes(value, options) {
1503
1613
  return this._addCheck({
1504
1614
  kind: "includes",
1505
1615
  value,
1506
- position: options === null || options === void 0 ? void 0 : options.position,
1507
- ...errorUtil_1.errorUtil.errToObj(options === null || options === void 0 ? void 0 : options.message)
1616
+ position: options?.position,
1617
+ ...errorUtil_js_1.errorUtil.errToObj(options?.message)
1508
1618
  });
1509
1619
  }
1510
1620
  startsWith(value, message) {
1511
1621
  return this._addCheck({
1512
1622
  kind: "startsWith",
1513
1623
  value,
1514
- ...errorUtil_1.errorUtil.errToObj(message)
1624
+ ...errorUtil_js_1.errorUtil.errToObj(message)
1515
1625
  });
1516
1626
  }
1517
1627
  endsWith(value, message) {
1518
1628
  return this._addCheck({
1519
1629
  kind: "endsWith",
1520
1630
  value,
1521
- ...errorUtil_1.errorUtil.errToObj(message)
1631
+ ...errorUtil_js_1.errorUtil.errToObj(message)
1522
1632
  });
1523
1633
  }
1524
1634
  min(minLength, message) {
1525
1635
  return this._addCheck({
1526
1636
  kind: "min",
1527
1637
  value: minLength,
1528
- ...errorUtil_1.errorUtil.errToObj(message)
1638
+ ...errorUtil_js_1.errorUtil.errToObj(message)
1529
1639
  });
1530
1640
  }
1531
1641
  max(maxLength, message) {
1532
1642
  return this._addCheck({
1533
1643
  kind: "max",
1534
1644
  value: maxLength,
1535
- ...errorUtil_1.errorUtil.errToObj(message)
1645
+ ...errorUtil_js_1.errorUtil.errToObj(message)
1536
1646
  });
1537
1647
  }
1538
1648
  length(len, message) {
1539
1649
  return this._addCheck({
1540
1650
  kind: "length",
1541
1651
  value: len,
1542
- ...errorUtil_1.errorUtil.errToObj(message)
1652
+ ...errorUtil_js_1.errorUtil.errToObj(message)
1543
1653
  });
1544
1654
  }
1545
1655
  /**
1546
- * @deprecated Use z.string().min(1) instead.
1547
- * @see {@link ZodString.min}
1656
+ * Equivalent to `.min(1)`
1548
1657
  */
1549
1658
  nonempty(message) {
1550
- return this.min(1, errorUtil_1.errorUtil.errToObj(message));
1659
+ return this.min(1, errorUtil_js_1.errorUtil.errToObj(message));
1551
1660
  }
1552
1661
  trim() {
1553
1662
  return new _ZodString({
@@ -1606,9 +1715,15 @@ var require_types = __commonJS({
1606
1715
  get isIP() {
1607
1716
  return !!this._def.checks.find((ch) => ch.kind === "ip");
1608
1717
  }
1718
+ get isCIDR() {
1719
+ return !!this._def.checks.find((ch) => ch.kind === "cidr");
1720
+ }
1609
1721
  get isBase64() {
1610
1722
  return !!this._def.checks.find((ch) => ch.kind === "base64");
1611
1723
  }
1724
+ get isBase64url() {
1725
+ return !!this._def.checks.find((ch) => ch.kind === "base64url");
1726
+ }
1612
1727
  get minLength() {
1613
1728
  let min = null;
1614
1729
  for (const ch of this._def.checks) {
@@ -1632,11 +1747,10 @@ var require_types = __commonJS({
1632
1747
  };
1633
1748
  exports.ZodString = ZodString2;
1634
1749
  ZodString2.create = (params) => {
1635
- var _a;
1636
1750
  return new ZodString2({
1637
1751
  checks: [],
1638
1752
  typeName: ZodFirstPartyTypeKind2.ZodString,
1639
- coerce: (_a = params === null || params === void 0 ? void 0 : params.coerce) !== null && _a !== void 0 ? _a : false,
1753
+ coerce: params?.coerce ?? false,
1640
1754
  ...processCreateParams2(params)
1641
1755
  });
1642
1756
  };
@@ -1644,9 +1758,9 @@ var require_types = __commonJS({
1644
1758
  const valDecCount = (val.toString().split(".")[1] || "").length;
1645
1759
  const stepDecCount = (step.toString().split(".")[1] || "").length;
1646
1760
  const decCount = valDecCount > stepDecCount ? valDecCount : stepDecCount;
1647
- const valInt = parseInt(val.toFixed(decCount).replace(".", ""));
1648
- const stepInt = parseInt(step.toFixed(decCount).replace(".", ""));
1649
- return valInt % stepInt / Math.pow(10, decCount);
1761
+ const valInt = Number.parseInt(val.toFixed(decCount).replace(".", ""));
1762
+ const stepInt = Number.parseInt(step.toFixed(decCount).replace(".", ""));
1763
+ return valInt % stepInt / 10 ** decCount;
1650
1764
  }
1651
1765
  var ZodNumber2 = class _ZodNumber extends ZodType2 {
1652
1766
  constructor() {
@@ -1660,23 +1774,23 @@ var require_types = __commonJS({
1660
1774
  input.data = Number(input.data);
1661
1775
  }
1662
1776
  const parsedType = this._getType(input);
1663
- if (parsedType !== util_1.ZodParsedType.number) {
1777
+ if (parsedType !== util_js_1.ZodParsedType.number) {
1664
1778
  const ctx2 = this._getOrReturnCtx(input);
1665
- (0, parseUtil_1.addIssueToContext)(ctx2, {
1666
- code: ZodError_1.ZodIssueCode.invalid_type,
1667
- expected: util_1.ZodParsedType.number,
1779
+ (0, parseUtil_js_1.addIssueToContext)(ctx2, {
1780
+ code: ZodError_js_1.ZodIssueCode.invalid_type,
1781
+ expected: util_js_1.ZodParsedType.number,
1668
1782
  received: ctx2.parsedType
1669
1783
  });
1670
- return parseUtil_1.INVALID;
1784
+ return parseUtil_js_1.INVALID;
1671
1785
  }
1672
1786
  let ctx = void 0;
1673
- const status = new parseUtil_1.ParseStatus();
1787
+ const status = new parseUtil_js_1.ParseStatus();
1674
1788
  for (const check of this._def.checks) {
1675
1789
  if (check.kind === "int") {
1676
- if (!util_1.util.isInteger(input.data)) {
1790
+ if (!util_js_1.util.isInteger(input.data)) {
1677
1791
  ctx = this._getOrReturnCtx(input, ctx);
1678
- (0, parseUtil_1.addIssueToContext)(ctx, {
1679
- code: ZodError_1.ZodIssueCode.invalid_type,
1792
+ (0, parseUtil_js_1.addIssueToContext)(ctx, {
1793
+ code: ZodError_js_1.ZodIssueCode.invalid_type,
1680
1794
  expected: "integer",
1681
1795
  received: "float",
1682
1796
  message: check.message
@@ -1687,8 +1801,8 @@ var require_types = __commonJS({
1687
1801
  const tooSmall = check.inclusive ? input.data < check.value : input.data <= check.value;
1688
1802
  if (tooSmall) {
1689
1803
  ctx = this._getOrReturnCtx(input, ctx);
1690
- (0, parseUtil_1.addIssueToContext)(ctx, {
1691
- code: ZodError_1.ZodIssueCode.too_small,
1804
+ (0, parseUtil_js_1.addIssueToContext)(ctx, {
1805
+ code: ZodError_js_1.ZodIssueCode.too_small,
1692
1806
  minimum: check.value,
1693
1807
  type: "number",
1694
1808
  inclusive: check.inclusive,
@@ -1701,8 +1815,8 @@ var require_types = __commonJS({
1701
1815
  const tooBig = check.inclusive ? input.data > check.value : input.data >= check.value;
1702
1816
  if (tooBig) {
1703
1817
  ctx = this._getOrReturnCtx(input, ctx);
1704
- (0, parseUtil_1.addIssueToContext)(ctx, {
1705
- code: ZodError_1.ZodIssueCode.too_big,
1818
+ (0, parseUtil_js_1.addIssueToContext)(ctx, {
1819
+ code: ZodError_js_1.ZodIssueCode.too_big,
1706
1820
  maximum: check.value,
1707
1821
  type: "number",
1708
1822
  inclusive: check.inclusive,
@@ -1714,8 +1828,8 @@ var require_types = __commonJS({
1714
1828
  } else if (check.kind === "multipleOf") {
1715
1829
  if (floatSafeRemainder2(input.data, check.value) !== 0) {
1716
1830
  ctx = this._getOrReturnCtx(input, ctx);
1717
- (0, parseUtil_1.addIssueToContext)(ctx, {
1718
- code: ZodError_1.ZodIssueCode.not_multiple_of,
1831
+ (0, parseUtil_js_1.addIssueToContext)(ctx, {
1832
+ code: ZodError_js_1.ZodIssueCode.not_multiple_of,
1719
1833
  multipleOf: check.value,
1720
1834
  message: check.message
1721
1835
  });
@@ -1724,29 +1838,29 @@ var require_types = __commonJS({
1724
1838
  } else if (check.kind === "finite") {
1725
1839
  if (!Number.isFinite(input.data)) {
1726
1840
  ctx = this._getOrReturnCtx(input, ctx);
1727
- (0, parseUtil_1.addIssueToContext)(ctx, {
1728
- code: ZodError_1.ZodIssueCode.not_finite,
1841
+ (0, parseUtil_js_1.addIssueToContext)(ctx, {
1842
+ code: ZodError_js_1.ZodIssueCode.not_finite,
1729
1843
  message: check.message
1730
1844
  });
1731
1845
  status.dirty();
1732
1846
  }
1733
1847
  } else {
1734
- util_1.util.assertNever(check);
1848
+ util_js_1.util.assertNever(check);
1735
1849
  }
1736
1850
  }
1737
1851
  return { status: status.value, value: input.data };
1738
1852
  }
1739
1853
  gte(value, message) {
1740
- return this.setLimit("min", value, true, errorUtil_1.errorUtil.toString(message));
1854
+ return this.setLimit("min", value, true, errorUtil_js_1.errorUtil.toString(message));
1741
1855
  }
1742
1856
  gt(value, message) {
1743
- return this.setLimit("min", value, false, errorUtil_1.errorUtil.toString(message));
1857
+ return this.setLimit("min", value, false, errorUtil_js_1.errorUtil.toString(message));
1744
1858
  }
1745
1859
  lte(value, message) {
1746
- return this.setLimit("max", value, true, errorUtil_1.errorUtil.toString(message));
1860
+ return this.setLimit("max", value, true, errorUtil_js_1.errorUtil.toString(message));
1747
1861
  }
1748
1862
  lt(value, message) {
1749
- return this.setLimit("max", value, false, errorUtil_1.errorUtil.toString(message));
1863
+ return this.setLimit("max", value, false, errorUtil_js_1.errorUtil.toString(message));
1750
1864
  }
1751
1865
  setLimit(kind, value, inclusive, message) {
1752
1866
  return new _ZodNumber({
@@ -1757,7 +1871,7 @@ var require_types = __commonJS({
1757
1871
  kind,
1758
1872
  value,
1759
1873
  inclusive,
1760
- message: errorUtil_1.errorUtil.toString(message)
1874
+ message: errorUtil_js_1.errorUtil.toString(message)
1761
1875
  }
1762
1876
  ]
1763
1877
  });
@@ -1771,7 +1885,7 @@ var require_types = __commonJS({
1771
1885
  int(message) {
1772
1886
  return this._addCheck({
1773
1887
  kind: "int",
1774
- message: errorUtil_1.errorUtil.toString(message)
1888
+ message: errorUtil_js_1.errorUtil.toString(message)
1775
1889
  });
1776
1890
  }
1777
1891
  positive(message) {
@@ -1779,7 +1893,7 @@ var require_types = __commonJS({
1779
1893
  kind: "min",
1780
1894
  value: 0,
1781
1895
  inclusive: false,
1782
- message: errorUtil_1.errorUtil.toString(message)
1896
+ message: errorUtil_js_1.errorUtil.toString(message)
1783
1897
  });
1784
1898
  }
1785
1899
  negative(message) {
@@ -1787,7 +1901,7 @@ var require_types = __commonJS({
1787
1901
  kind: "max",
1788
1902
  value: 0,
1789
1903
  inclusive: false,
1790
- message: errorUtil_1.errorUtil.toString(message)
1904
+ message: errorUtil_js_1.errorUtil.toString(message)
1791
1905
  });
1792
1906
  }
1793
1907
  nonpositive(message) {
@@ -1795,7 +1909,7 @@ var require_types = __commonJS({
1795
1909
  kind: "max",
1796
1910
  value: 0,
1797
1911
  inclusive: true,
1798
- message: errorUtil_1.errorUtil.toString(message)
1912
+ message: errorUtil_js_1.errorUtil.toString(message)
1799
1913
  });
1800
1914
  }
1801
1915
  nonnegative(message) {
@@ -1803,20 +1917,20 @@ var require_types = __commonJS({
1803
1917
  kind: "min",
1804
1918
  value: 0,
1805
1919
  inclusive: true,
1806
- message: errorUtil_1.errorUtil.toString(message)
1920
+ message: errorUtil_js_1.errorUtil.toString(message)
1807
1921
  });
1808
1922
  }
1809
1923
  multipleOf(value, message) {
1810
1924
  return this._addCheck({
1811
1925
  kind: "multipleOf",
1812
1926
  value,
1813
- message: errorUtil_1.errorUtil.toString(message)
1927
+ message: errorUtil_js_1.errorUtil.toString(message)
1814
1928
  });
1815
1929
  }
1816
1930
  finite(message) {
1817
1931
  return this._addCheck({
1818
1932
  kind: "finite",
1819
- message: errorUtil_1.errorUtil.toString(message)
1933
+ message: errorUtil_js_1.errorUtil.toString(message)
1820
1934
  });
1821
1935
  }
1822
1936
  safe(message) {
@@ -1824,12 +1938,12 @@ var require_types = __commonJS({
1824
1938
  kind: "min",
1825
1939
  inclusive: true,
1826
1940
  value: Number.MIN_SAFE_INTEGER,
1827
- message: errorUtil_1.errorUtil.toString(message)
1941
+ message: errorUtil_js_1.errorUtil.toString(message)
1828
1942
  })._addCheck({
1829
1943
  kind: "max",
1830
1944
  inclusive: true,
1831
1945
  value: Number.MAX_SAFE_INTEGER,
1832
- message: errorUtil_1.errorUtil.toString(message)
1946
+ message: errorUtil_js_1.errorUtil.toString(message)
1833
1947
  });
1834
1948
  }
1835
1949
  get minValue() {
@@ -1853,10 +1967,11 @@ var require_types = __commonJS({
1853
1967
  return max;
1854
1968
  }
1855
1969
  get isInt() {
1856
- return !!this._def.checks.find((ch) => ch.kind === "int" || ch.kind === "multipleOf" && util_1.util.isInteger(ch.value));
1970
+ return !!this._def.checks.find((ch) => ch.kind === "int" || ch.kind === "multipleOf" && util_js_1.util.isInteger(ch.value));
1857
1971
  }
1858
1972
  get isFinite() {
1859
- let max = null, min = null;
1973
+ let max = null;
1974
+ let min = null;
1860
1975
  for (const ch of this._def.checks) {
1861
1976
  if (ch.kind === "finite" || ch.kind === "int" || ch.kind === "multipleOf") {
1862
1977
  return true;
@@ -1876,7 +1991,7 @@ var require_types = __commonJS({
1876
1991
  return new ZodNumber2({
1877
1992
  checks: [],
1878
1993
  typeName: ZodFirstPartyTypeKind2.ZodNumber,
1879
- coerce: (params === null || params === void 0 ? void 0 : params.coerce) || false,
1994
+ coerce: params?.coerce || false,
1880
1995
  ...processCreateParams2(params)
1881
1996
  });
1882
1997
  };
@@ -1888,27 +2003,25 @@ var require_types = __commonJS({
1888
2003
  }
1889
2004
  _parse(input) {
1890
2005
  if (this._def.coerce) {
1891
- input.data = BigInt(input.data);
2006
+ try {
2007
+ input.data = BigInt(input.data);
2008
+ } catch {
2009
+ return this._getInvalidInput(input);
2010
+ }
1892
2011
  }
1893
2012
  const parsedType = this._getType(input);
1894
- if (parsedType !== util_1.ZodParsedType.bigint) {
1895
- const ctx2 = this._getOrReturnCtx(input);
1896
- (0, parseUtil_1.addIssueToContext)(ctx2, {
1897
- code: ZodError_1.ZodIssueCode.invalid_type,
1898
- expected: util_1.ZodParsedType.bigint,
1899
- received: ctx2.parsedType
1900
- });
1901
- return parseUtil_1.INVALID;
2013
+ if (parsedType !== util_js_1.ZodParsedType.bigint) {
2014
+ return this._getInvalidInput(input);
1902
2015
  }
1903
2016
  let ctx = void 0;
1904
- const status = new parseUtil_1.ParseStatus();
2017
+ const status = new parseUtil_js_1.ParseStatus();
1905
2018
  for (const check of this._def.checks) {
1906
2019
  if (check.kind === "min") {
1907
2020
  const tooSmall = check.inclusive ? input.data < check.value : input.data <= check.value;
1908
2021
  if (tooSmall) {
1909
2022
  ctx = this._getOrReturnCtx(input, ctx);
1910
- (0, parseUtil_1.addIssueToContext)(ctx, {
1911
- code: ZodError_1.ZodIssueCode.too_small,
2023
+ (0, parseUtil_js_1.addIssueToContext)(ctx, {
2024
+ code: ZodError_js_1.ZodIssueCode.too_small,
1912
2025
  type: "bigint",
1913
2026
  minimum: check.value,
1914
2027
  inclusive: check.inclusive,
@@ -1920,8 +2033,8 @@ var require_types = __commonJS({
1920
2033
  const tooBig = check.inclusive ? input.data > check.value : input.data >= check.value;
1921
2034
  if (tooBig) {
1922
2035
  ctx = this._getOrReturnCtx(input, ctx);
1923
- (0, parseUtil_1.addIssueToContext)(ctx, {
1924
- code: ZodError_1.ZodIssueCode.too_big,
2036
+ (0, parseUtil_js_1.addIssueToContext)(ctx, {
2037
+ code: ZodError_js_1.ZodIssueCode.too_big,
1925
2038
  type: "bigint",
1926
2039
  maximum: check.value,
1927
2040
  inclusive: check.inclusive,
@@ -1932,30 +2045,39 @@ var require_types = __commonJS({
1932
2045
  } else if (check.kind === "multipleOf") {
1933
2046
  if (input.data % check.value !== BigInt(0)) {
1934
2047
  ctx = this._getOrReturnCtx(input, ctx);
1935
- (0, parseUtil_1.addIssueToContext)(ctx, {
1936
- code: ZodError_1.ZodIssueCode.not_multiple_of,
2048
+ (0, parseUtil_js_1.addIssueToContext)(ctx, {
2049
+ code: ZodError_js_1.ZodIssueCode.not_multiple_of,
1937
2050
  multipleOf: check.value,
1938
2051
  message: check.message
1939
2052
  });
1940
2053
  status.dirty();
1941
2054
  }
1942
2055
  } else {
1943
- util_1.util.assertNever(check);
2056
+ util_js_1.util.assertNever(check);
1944
2057
  }
1945
2058
  }
1946
2059
  return { status: status.value, value: input.data };
1947
2060
  }
2061
+ _getInvalidInput(input) {
2062
+ const ctx = this._getOrReturnCtx(input);
2063
+ (0, parseUtil_js_1.addIssueToContext)(ctx, {
2064
+ code: ZodError_js_1.ZodIssueCode.invalid_type,
2065
+ expected: util_js_1.ZodParsedType.bigint,
2066
+ received: ctx.parsedType
2067
+ });
2068
+ return parseUtil_js_1.INVALID;
2069
+ }
1948
2070
  gte(value, message) {
1949
- return this.setLimit("min", value, true, errorUtil_1.errorUtil.toString(message));
2071
+ return this.setLimit("min", value, true, errorUtil_js_1.errorUtil.toString(message));
1950
2072
  }
1951
2073
  gt(value, message) {
1952
- return this.setLimit("min", value, false, errorUtil_1.errorUtil.toString(message));
2074
+ return this.setLimit("min", value, false, errorUtil_js_1.errorUtil.toString(message));
1953
2075
  }
1954
2076
  lte(value, message) {
1955
- return this.setLimit("max", value, true, errorUtil_1.errorUtil.toString(message));
2077
+ return this.setLimit("max", value, true, errorUtil_js_1.errorUtil.toString(message));
1956
2078
  }
1957
2079
  lt(value, message) {
1958
- return this.setLimit("max", value, false, errorUtil_1.errorUtil.toString(message));
2080
+ return this.setLimit("max", value, false, errorUtil_js_1.errorUtil.toString(message));
1959
2081
  }
1960
2082
  setLimit(kind, value, inclusive, message) {
1961
2083
  return new _ZodBigInt({
@@ -1966,7 +2088,7 @@ var require_types = __commonJS({
1966
2088
  kind,
1967
2089
  value,
1968
2090
  inclusive,
1969
- message: errorUtil_1.errorUtil.toString(message)
2091
+ message: errorUtil_js_1.errorUtil.toString(message)
1970
2092
  }
1971
2093
  ]
1972
2094
  });
@@ -1982,7 +2104,7 @@ var require_types = __commonJS({
1982
2104
  kind: "min",
1983
2105
  value: BigInt(0),
1984
2106
  inclusive: false,
1985
- message: errorUtil_1.errorUtil.toString(message)
2107
+ message: errorUtil_js_1.errorUtil.toString(message)
1986
2108
  });
1987
2109
  }
1988
2110
  negative(message) {
@@ -1990,7 +2112,7 @@ var require_types = __commonJS({
1990
2112
  kind: "max",
1991
2113
  value: BigInt(0),
1992
2114
  inclusive: false,
1993
- message: errorUtil_1.errorUtil.toString(message)
2115
+ message: errorUtil_js_1.errorUtil.toString(message)
1994
2116
  });
1995
2117
  }
1996
2118
  nonpositive(message) {
@@ -1998,7 +2120,7 @@ var require_types = __commonJS({
1998
2120
  kind: "max",
1999
2121
  value: BigInt(0),
2000
2122
  inclusive: true,
2001
- message: errorUtil_1.errorUtil.toString(message)
2123
+ message: errorUtil_js_1.errorUtil.toString(message)
2002
2124
  });
2003
2125
  }
2004
2126
  nonnegative(message) {
@@ -2006,14 +2128,14 @@ var require_types = __commonJS({
2006
2128
  kind: "min",
2007
2129
  value: BigInt(0),
2008
2130
  inclusive: true,
2009
- message: errorUtil_1.errorUtil.toString(message)
2131
+ message: errorUtil_js_1.errorUtil.toString(message)
2010
2132
  });
2011
2133
  }
2012
2134
  multipleOf(value, message) {
2013
2135
  return this._addCheck({
2014
2136
  kind: "multipleOf",
2015
2137
  value,
2016
- message: errorUtil_1.errorUtil.toString(message)
2138
+ message: errorUtil_js_1.errorUtil.toString(message)
2017
2139
  });
2018
2140
  }
2019
2141
  get minValue() {
@@ -2039,11 +2161,10 @@ var require_types = __commonJS({
2039
2161
  };
2040
2162
  exports.ZodBigInt = ZodBigInt2;
2041
2163
  ZodBigInt2.create = (params) => {
2042
- var _a;
2043
2164
  return new ZodBigInt2({
2044
2165
  checks: [],
2045
2166
  typeName: ZodFirstPartyTypeKind2.ZodBigInt,
2046
- coerce: (_a = params === null || params === void 0 ? void 0 : params.coerce) !== null && _a !== void 0 ? _a : false,
2167
+ coerce: params?.coerce ?? false,
2047
2168
  ...processCreateParams2(params)
2048
2169
  });
2049
2170
  };
@@ -2053,23 +2174,23 @@ var require_types = __commonJS({
2053
2174
  input.data = Boolean(input.data);
2054
2175
  }
2055
2176
  const parsedType = this._getType(input);
2056
- if (parsedType !== util_1.ZodParsedType.boolean) {
2177
+ if (parsedType !== util_js_1.ZodParsedType.boolean) {
2057
2178
  const ctx = this._getOrReturnCtx(input);
2058
- (0, parseUtil_1.addIssueToContext)(ctx, {
2059
- code: ZodError_1.ZodIssueCode.invalid_type,
2060
- expected: util_1.ZodParsedType.boolean,
2179
+ (0, parseUtil_js_1.addIssueToContext)(ctx, {
2180
+ code: ZodError_js_1.ZodIssueCode.invalid_type,
2181
+ expected: util_js_1.ZodParsedType.boolean,
2061
2182
  received: ctx.parsedType
2062
2183
  });
2063
- return parseUtil_1.INVALID;
2184
+ return parseUtil_js_1.INVALID;
2064
2185
  }
2065
- return (0, parseUtil_1.OK)(input.data);
2186
+ return (0, parseUtil_js_1.OK)(input.data);
2066
2187
  }
2067
2188
  };
2068
2189
  exports.ZodBoolean = ZodBoolean2;
2069
2190
  ZodBoolean2.create = (params) => {
2070
2191
  return new ZodBoolean2({
2071
2192
  typeName: ZodFirstPartyTypeKind2.ZodBoolean,
2072
- coerce: (params === null || params === void 0 ? void 0 : params.coerce) || false,
2193
+ coerce: params?.coerce || false,
2073
2194
  ...processCreateParams2(params)
2074
2195
  });
2075
2196
  };
@@ -2079,30 +2200,30 @@ var require_types = __commonJS({
2079
2200
  input.data = new Date(input.data);
2080
2201
  }
2081
2202
  const parsedType = this._getType(input);
2082
- if (parsedType !== util_1.ZodParsedType.date) {
2203
+ if (parsedType !== util_js_1.ZodParsedType.date) {
2083
2204
  const ctx2 = this._getOrReturnCtx(input);
2084
- (0, parseUtil_1.addIssueToContext)(ctx2, {
2085
- code: ZodError_1.ZodIssueCode.invalid_type,
2086
- expected: util_1.ZodParsedType.date,
2205
+ (0, parseUtil_js_1.addIssueToContext)(ctx2, {
2206
+ code: ZodError_js_1.ZodIssueCode.invalid_type,
2207
+ expected: util_js_1.ZodParsedType.date,
2087
2208
  received: ctx2.parsedType
2088
2209
  });
2089
- return parseUtil_1.INVALID;
2210
+ return parseUtil_js_1.INVALID;
2090
2211
  }
2091
- if (isNaN(input.data.getTime())) {
2212
+ if (Number.isNaN(input.data.getTime())) {
2092
2213
  const ctx2 = this._getOrReturnCtx(input);
2093
- (0, parseUtil_1.addIssueToContext)(ctx2, {
2094
- code: ZodError_1.ZodIssueCode.invalid_date
2214
+ (0, parseUtil_js_1.addIssueToContext)(ctx2, {
2215
+ code: ZodError_js_1.ZodIssueCode.invalid_date
2095
2216
  });
2096
- return parseUtil_1.INVALID;
2217
+ return parseUtil_js_1.INVALID;
2097
2218
  }
2098
- const status = new parseUtil_1.ParseStatus();
2219
+ const status = new parseUtil_js_1.ParseStatus();
2099
2220
  let ctx = void 0;
2100
2221
  for (const check of this._def.checks) {
2101
2222
  if (check.kind === "min") {
2102
2223
  if (input.data.getTime() < check.value) {
2103
2224
  ctx = this._getOrReturnCtx(input, ctx);
2104
- (0, parseUtil_1.addIssueToContext)(ctx, {
2105
- code: ZodError_1.ZodIssueCode.too_small,
2225
+ (0, parseUtil_js_1.addIssueToContext)(ctx, {
2226
+ code: ZodError_js_1.ZodIssueCode.too_small,
2106
2227
  message: check.message,
2107
2228
  inclusive: true,
2108
2229
  exact: false,
@@ -2114,8 +2235,8 @@ var require_types = __commonJS({
2114
2235
  } else if (check.kind === "max") {
2115
2236
  if (input.data.getTime() > check.value) {
2116
2237
  ctx = this._getOrReturnCtx(input, ctx);
2117
- (0, parseUtil_1.addIssueToContext)(ctx, {
2118
- code: ZodError_1.ZodIssueCode.too_big,
2238
+ (0, parseUtil_js_1.addIssueToContext)(ctx, {
2239
+ code: ZodError_js_1.ZodIssueCode.too_big,
2119
2240
  message: check.message,
2120
2241
  inclusive: true,
2121
2242
  exact: false,
@@ -2125,7 +2246,7 @@ var require_types = __commonJS({
2125
2246
  status.dirty();
2126
2247
  }
2127
2248
  } else {
2128
- util_1.util.assertNever(check);
2249
+ util_js_1.util.assertNever(check);
2129
2250
  }
2130
2251
  }
2131
2252
  return {
@@ -2143,14 +2264,14 @@ var require_types = __commonJS({
2143
2264
  return this._addCheck({
2144
2265
  kind: "min",
2145
2266
  value: minDate.getTime(),
2146
- message: errorUtil_1.errorUtil.toString(message)
2267
+ message: errorUtil_js_1.errorUtil.toString(message)
2147
2268
  });
2148
2269
  }
2149
2270
  max(maxDate, message) {
2150
2271
  return this._addCheck({
2151
2272
  kind: "max",
2152
2273
  value: maxDate.getTime(),
2153
- message: errorUtil_1.errorUtil.toString(message)
2274
+ message: errorUtil_js_1.errorUtil.toString(message)
2154
2275
  });
2155
2276
  }
2156
2277
  get minDate() {
@@ -2178,7 +2299,7 @@ var require_types = __commonJS({
2178
2299
  ZodDate2.create = (params) => {
2179
2300
  return new ZodDate2({
2180
2301
  checks: [],
2181
- coerce: (params === null || params === void 0 ? void 0 : params.coerce) || false,
2302
+ coerce: params?.coerce || false,
2182
2303
  typeName: ZodFirstPartyTypeKind2.ZodDate,
2183
2304
  ...processCreateParams2(params)
2184
2305
  });
@@ -2186,16 +2307,16 @@ var require_types = __commonJS({
2186
2307
  var ZodSymbol2 = class extends ZodType2 {
2187
2308
  _parse(input) {
2188
2309
  const parsedType = this._getType(input);
2189
- if (parsedType !== util_1.ZodParsedType.symbol) {
2310
+ if (parsedType !== util_js_1.ZodParsedType.symbol) {
2190
2311
  const ctx = this._getOrReturnCtx(input);
2191
- (0, parseUtil_1.addIssueToContext)(ctx, {
2192
- code: ZodError_1.ZodIssueCode.invalid_type,
2193
- expected: util_1.ZodParsedType.symbol,
2312
+ (0, parseUtil_js_1.addIssueToContext)(ctx, {
2313
+ code: ZodError_js_1.ZodIssueCode.invalid_type,
2314
+ expected: util_js_1.ZodParsedType.symbol,
2194
2315
  received: ctx.parsedType
2195
2316
  });
2196
- return parseUtil_1.INVALID;
2317
+ return parseUtil_js_1.INVALID;
2197
2318
  }
2198
- return (0, parseUtil_1.OK)(input.data);
2319
+ return (0, parseUtil_js_1.OK)(input.data);
2199
2320
  }
2200
2321
  };
2201
2322
  exports.ZodSymbol = ZodSymbol2;
@@ -2208,16 +2329,16 @@ var require_types = __commonJS({
2208
2329
  var ZodUndefined2 = class extends ZodType2 {
2209
2330
  _parse(input) {
2210
2331
  const parsedType = this._getType(input);
2211
- if (parsedType !== util_1.ZodParsedType.undefined) {
2332
+ if (parsedType !== util_js_1.ZodParsedType.undefined) {
2212
2333
  const ctx = this._getOrReturnCtx(input);
2213
- (0, parseUtil_1.addIssueToContext)(ctx, {
2214
- code: ZodError_1.ZodIssueCode.invalid_type,
2215
- expected: util_1.ZodParsedType.undefined,
2334
+ (0, parseUtil_js_1.addIssueToContext)(ctx, {
2335
+ code: ZodError_js_1.ZodIssueCode.invalid_type,
2336
+ expected: util_js_1.ZodParsedType.undefined,
2216
2337
  received: ctx.parsedType
2217
2338
  });
2218
- return parseUtil_1.INVALID;
2339
+ return parseUtil_js_1.INVALID;
2219
2340
  }
2220
- return (0, parseUtil_1.OK)(input.data);
2341
+ return (0, parseUtil_js_1.OK)(input.data);
2221
2342
  }
2222
2343
  };
2223
2344
  exports.ZodUndefined = ZodUndefined2;
@@ -2230,16 +2351,16 @@ var require_types = __commonJS({
2230
2351
  var ZodNull2 = class extends ZodType2 {
2231
2352
  _parse(input) {
2232
2353
  const parsedType = this._getType(input);
2233
- if (parsedType !== util_1.ZodParsedType.null) {
2354
+ if (parsedType !== util_js_1.ZodParsedType.null) {
2234
2355
  const ctx = this._getOrReturnCtx(input);
2235
- (0, parseUtil_1.addIssueToContext)(ctx, {
2236
- code: ZodError_1.ZodIssueCode.invalid_type,
2237
- expected: util_1.ZodParsedType.null,
2356
+ (0, parseUtil_js_1.addIssueToContext)(ctx, {
2357
+ code: ZodError_js_1.ZodIssueCode.invalid_type,
2358
+ expected: util_js_1.ZodParsedType.null,
2238
2359
  received: ctx.parsedType
2239
2360
  });
2240
- return parseUtil_1.INVALID;
2361
+ return parseUtil_js_1.INVALID;
2241
2362
  }
2242
- return (0, parseUtil_1.OK)(input.data);
2363
+ return (0, parseUtil_js_1.OK)(input.data);
2243
2364
  }
2244
2365
  };
2245
2366
  exports.ZodNull = ZodNull2;
@@ -2255,7 +2376,7 @@ var require_types = __commonJS({
2255
2376
  this._any = true;
2256
2377
  }
2257
2378
  _parse(input) {
2258
- return (0, parseUtil_1.OK)(input.data);
2379
+ return (0, parseUtil_js_1.OK)(input.data);
2259
2380
  }
2260
2381
  };
2261
2382
  exports.ZodAny = ZodAny2;
@@ -2271,7 +2392,7 @@ var require_types = __commonJS({
2271
2392
  this._unknown = true;
2272
2393
  }
2273
2394
  _parse(input) {
2274
- return (0, parseUtil_1.OK)(input.data);
2395
+ return (0, parseUtil_js_1.OK)(input.data);
2275
2396
  }
2276
2397
  };
2277
2398
  exports.ZodUnknown = ZodUnknown2;
@@ -2284,12 +2405,12 @@ var require_types = __commonJS({
2284
2405
  var ZodNever2 = class extends ZodType2 {
2285
2406
  _parse(input) {
2286
2407
  const ctx = this._getOrReturnCtx(input);
2287
- (0, parseUtil_1.addIssueToContext)(ctx, {
2288
- code: ZodError_1.ZodIssueCode.invalid_type,
2289
- expected: util_1.ZodParsedType.never,
2408
+ (0, parseUtil_js_1.addIssueToContext)(ctx, {
2409
+ code: ZodError_js_1.ZodIssueCode.invalid_type,
2410
+ expected: util_js_1.ZodParsedType.never,
2290
2411
  received: ctx.parsedType
2291
2412
  });
2292
- return parseUtil_1.INVALID;
2413
+ return parseUtil_js_1.INVALID;
2293
2414
  }
2294
2415
  };
2295
2416
  exports.ZodNever = ZodNever2;
@@ -2302,16 +2423,16 @@ var require_types = __commonJS({
2302
2423
  var ZodVoid2 = class extends ZodType2 {
2303
2424
  _parse(input) {
2304
2425
  const parsedType = this._getType(input);
2305
- if (parsedType !== util_1.ZodParsedType.undefined) {
2426
+ if (parsedType !== util_js_1.ZodParsedType.undefined) {
2306
2427
  const ctx = this._getOrReturnCtx(input);
2307
- (0, parseUtil_1.addIssueToContext)(ctx, {
2308
- code: ZodError_1.ZodIssueCode.invalid_type,
2309
- expected: util_1.ZodParsedType.void,
2428
+ (0, parseUtil_js_1.addIssueToContext)(ctx, {
2429
+ code: ZodError_js_1.ZodIssueCode.invalid_type,
2430
+ expected: util_js_1.ZodParsedType.void,
2310
2431
  received: ctx.parsedType
2311
2432
  });
2312
- return parseUtil_1.INVALID;
2433
+ return parseUtil_js_1.INVALID;
2313
2434
  }
2314
- return (0, parseUtil_1.OK)(input.data);
2435
+ return (0, parseUtil_js_1.OK)(input.data);
2315
2436
  }
2316
2437
  };
2317
2438
  exports.ZodVoid = ZodVoid2;
@@ -2325,20 +2446,20 @@ var require_types = __commonJS({
2325
2446
  _parse(input) {
2326
2447
  const { ctx, status } = this._processInputParams(input);
2327
2448
  const def = this._def;
2328
- if (ctx.parsedType !== util_1.ZodParsedType.array) {
2329
- (0, parseUtil_1.addIssueToContext)(ctx, {
2330
- code: ZodError_1.ZodIssueCode.invalid_type,
2331
- expected: util_1.ZodParsedType.array,
2449
+ if (ctx.parsedType !== util_js_1.ZodParsedType.array) {
2450
+ (0, parseUtil_js_1.addIssueToContext)(ctx, {
2451
+ code: ZodError_js_1.ZodIssueCode.invalid_type,
2452
+ expected: util_js_1.ZodParsedType.array,
2332
2453
  received: ctx.parsedType
2333
2454
  });
2334
- return parseUtil_1.INVALID;
2455
+ return parseUtil_js_1.INVALID;
2335
2456
  }
2336
2457
  if (def.exactLength !== null) {
2337
2458
  const tooBig = ctx.data.length > def.exactLength.value;
2338
2459
  const tooSmall = ctx.data.length < def.exactLength.value;
2339
2460
  if (tooBig || tooSmall) {
2340
- (0, parseUtil_1.addIssueToContext)(ctx, {
2341
- code: tooBig ? ZodError_1.ZodIssueCode.too_big : ZodError_1.ZodIssueCode.too_small,
2461
+ (0, parseUtil_js_1.addIssueToContext)(ctx, {
2462
+ code: tooBig ? ZodError_js_1.ZodIssueCode.too_big : ZodError_js_1.ZodIssueCode.too_small,
2342
2463
  minimum: tooSmall ? def.exactLength.value : void 0,
2343
2464
  maximum: tooBig ? def.exactLength.value : void 0,
2344
2465
  type: "array",
@@ -2351,8 +2472,8 @@ var require_types = __commonJS({
2351
2472
  }
2352
2473
  if (def.minLength !== null) {
2353
2474
  if (ctx.data.length < def.minLength.value) {
2354
- (0, parseUtil_1.addIssueToContext)(ctx, {
2355
- code: ZodError_1.ZodIssueCode.too_small,
2475
+ (0, parseUtil_js_1.addIssueToContext)(ctx, {
2476
+ code: ZodError_js_1.ZodIssueCode.too_small,
2356
2477
  minimum: def.minLength.value,
2357
2478
  type: "array",
2358
2479
  inclusive: true,
@@ -2364,8 +2485,8 @@ var require_types = __commonJS({
2364
2485
  }
2365
2486
  if (def.maxLength !== null) {
2366
2487
  if (ctx.data.length > def.maxLength.value) {
2367
- (0, parseUtil_1.addIssueToContext)(ctx, {
2368
- code: ZodError_1.ZodIssueCode.too_big,
2488
+ (0, parseUtil_js_1.addIssueToContext)(ctx, {
2489
+ code: ZodError_js_1.ZodIssueCode.too_big,
2369
2490
  maximum: def.maxLength.value,
2370
2491
  type: "array",
2371
2492
  inclusive: true,
@@ -2379,13 +2500,13 @@ var require_types = __commonJS({
2379
2500
  return Promise.all([...ctx.data].map((item, i) => {
2380
2501
  return def.type._parseAsync(new ParseInputLazyPath2(ctx, item, ctx.path, i));
2381
2502
  })).then((result2) => {
2382
- return parseUtil_1.ParseStatus.mergeArray(status, result2);
2503
+ return parseUtil_js_1.ParseStatus.mergeArray(status, result2);
2383
2504
  });
2384
2505
  }
2385
2506
  const result = [...ctx.data].map((item, i) => {
2386
2507
  return def.type._parseSync(new ParseInputLazyPath2(ctx, item, ctx.path, i));
2387
2508
  });
2388
- return parseUtil_1.ParseStatus.mergeArray(status, result);
2509
+ return parseUtil_js_1.ParseStatus.mergeArray(status, result);
2389
2510
  }
2390
2511
  get element() {
2391
2512
  return this._def.type;
@@ -2393,19 +2514,19 @@ var require_types = __commonJS({
2393
2514
  min(minLength, message) {
2394
2515
  return new _ZodArray({
2395
2516
  ...this._def,
2396
- minLength: { value: minLength, message: errorUtil_1.errorUtil.toString(message) }
2517
+ minLength: { value: minLength, message: errorUtil_js_1.errorUtil.toString(message) }
2397
2518
  });
2398
2519
  }
2399
2520
  max(maxLength, message) {
2400
2521
  return new _ZodArray({
2401
2522
  ...this._def,
2402
- maxLength: { value: maxLength, message: errorUtil_1.errorUtil.toString(message) }
2523
+ maxLength: { value: maxLength, message: errorUtil_js_1.errorUtil.toString(message) }
2403
2524
  });
2404
2525
  }
2405
2526
  length(len, message) {
2406
2527
  return new _ZodArray({
2407
2528
  ...this._def,
2408
- exactLength: { value: len, message: errorUtil_1.errorUtil.toString(message) }
2529
+ exactLength: { value: len, message: errorUtil_js_1.errorUtil.toString(message) }
2409
2530
  });
2410
2531
  }
2411
2532
  nonempty(message) {
@@ -2460,19 +2581,20 @@ var require_types = __commonJS({
2460
2581
  if (this._cached !== null)
2461
2582
  return this._cached;
2462
2583
  const shape = this._def.shape();
2463
- const keys = util_1.util.objectKeys(shape);
2464
- return this._cached = { shape, keys };
2584
+ const keys = util_js_1.util.objectKeys(shape);
2585
+ this._cached = { shape, keys };
2586
+ return this._cached;
2465
2587
  }
2466
2588
  _parse(input) {
2467
2589
  const parsedType = this._getType(input);
2468
- if (parsedType !== util_1.ZodParsedType.object) {
2590
+ if (parsedType !== util_js_1.ZodParsedType.object) {
2469
2591
  const ctx2 = this._getOrReturnCtx(input);
2470
- (0, parseUtil_1.addIssueToContext)(ctx2, {
2471
- code: ZodError_1.ZodIssueCode.invalid_type,
2472
- expected: util_1.ZodParsedType.object,
2592
+ (0, parseUtil_js_1.addIssueToContext)(ctx2, {
2593
+ code: ZodError_js_1.ZodIssueCode.invalid_type,
2594
+ expected: util_js_1.ZodParsedType.object,
2473
2595
  received: ctx2.parsedType
2474
2596
  });
2475
- return parseUtil_1.INVALID;
2597
+ return parseUtil_js_1.INVALID;
2476
2598
  }
2477
2599
  const { status, ctx } = this._processInputParams(input);
2478
2600
  const { shape, keys: shapeKeys } = this._getCached();
@@ -2505,8 +2627,8 @@ var require_types = __commonJS({
2505
2627
  }
2506
2628
  } else if (unknownKeys === "strict") {
2507
2629
  if (extraKeys.length > 0) {
2508
- (0, parseUtil_1.addIssueToContext)(ctx, {
2509
- code: ZodError_1.ZodIssueCode.unrecognized_keys,
2630
+ (0, parseUtil_js_1.addIssueToContext)(ctx, {
2631
+ code: ZodError_js_1.ZodIssueCode.unrecognized_keys,
2510
2632
  keys: extraKeys
2511
2633
  });
2512
2634
  status.dirty();
@@ -2543,27 +2665,26 @@ var require_types = __commonJS({
2543
2665
  }
2544
2666
  return syncPairs;
2545
2667
  }).then((syncPairs) => {
2546
- return parseUtil_1.ParseStatus.mergeObjectSync(status, syncPairs);
2668
+ return parseUtil_js_1.ParseStatus.mergeObjectSync(status, syncPairs);
2547
2669
  });
2548
2670
  } else {
2549
- return parseUtil_1.ParseStatus.mergeObjectSync(status, pairs);
2671
+ return parseUtil_js_1.ParseStatus.mergeObjectSync(status, pairs);
2550
2672
  }
2551
2673
  }
2552
2674
  get shape() {
2553
2675
  return this._def.shape();
2554
2676
  }
2555
2677
  strict(message) {
2556
- errorUtil_1.errorUtil.errToObj;
2678
+ errorUtil_js_1.errorUtil.errToObj;
2557
2679
  return new _ZodObject({
2558
2680
  ...this._def,
2559
2681
  unknownKeys: "strict",
2560
2682
  ...message !== void 0 ? {
2561
2683
  errorMap: (issue, ctx) => {
2562
- var _a, _b, _c, _d;
2563
- 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;
2684
+ const defaultError = this._def.errorMap?.(issue, ctx).message ?? ctx.defaultError;
2564
2685
  if (issue.code === "unrecognized_keys")
2565
2686
  return {
2566
- message: (_d = errorUtil_1.errorUtil.errToObj(message).message) !== null && _d !== void 0 ? _d : defaultError
2687
+ message: errorUtil_js_1.errorUtil.errToObj(message).message ?? defaultError
2567
2688
  };
2568
2689
  return {
2569
2690
  message: defaultError
@@ -2694,11 +2815,11 @@ var require_types = __commonJS({
2694
2815
  }
2695
2816
  pick(mask) {
2696
2817
  const shape = {};
2697
- util_1.util.objectKeys(mask).forEach((key) => {
2818
+ for (const key of util_js_1.util.objectKeys(mask)) {
2698
2819
  if (mask[key] && this.shape[key]) {
2699
2820
  shape[key] = this.shape[key];
2700
2821
  }
2701
- });
2822
+ }
2702
2823
  return new _ZodObject({
2703
2824
  ...this._def,
2704
2825
  shape: () => shape
@@ -2706,11 +2827,11 @@ var require_types = __commonJS({
2706
2827
  }
2707
2828
  omit(mask) {
2708
2829
  const shape = {};
2709
- util_1.util.objectKeys(this.shape).forEach((key) => {
2830
+ for (const key of util_js_1.util.objectKeys(this.shape)) {
2710
2831
  if (!mask[key]) {
2711
2832
  shape[key] = this.shape[key];
2712
2833
  }
2713
- });
2834
+ }
2714
2835
  return new _ZodObject({
2715
2836
  ...this._def,
2716
2837
  shape: () => shape
@@ -2724,14 +2845,14 @@ var require_types = __commonJS({
2724
2845
  }
2725
2846
  partial(mask) {
2726
2847
  const newShape = {};
2727
- util_1.util.objectKeys(this.shape).forEach((key) => {
2848
+ for (const key of util_js_1.util.objectKeys(this.shape)) {
2728
2849
  const fieldSchema = this.shape[key];
2729
2850
  if (mask && !mask[key]) {
2730
2851
  newShape[key] = fieldSchema;
2731
2852
  } else {
2732
2853
  newShape[key] = fieldSchema.optional();
2733
2854
  }
2734
- });
2855
+ }
2735
2856
  return new _ZodObject({
2736
2857
  ...this._def,
2737
2858
  shape: () => newShape
@@ -2739,7 +2860,7 @@ var require_types = __commonJS({
2739
2860
  }
2740
2861
  required(mask) {
2741
2862
  const newShape = {};
2742
- util_1.util.objectKeys(this.shape).forEach((key) => {
2863
+ for (const key of util_js_1.util.objectKeys(this.shape)) {
2743
2864
  if (mask && !mask[key]) {
2744
2865
  newShape[key] = this.shape[key];
2745
2866
  } else {
@@ -2750,14 +2871,14 @@ var require_types = __commonJS({
2750
2871
  }
2751
2872
  newShape[key] = newField;
2752
2873
  }
2753
- });
2874
+ }
2754
2875
  return new _ZodObject({
2755
2876
  ...this._def,
2756
2877
  shape: () => newShape
2757
2878
  });
2758
2879
  }
2759
2880
  keyof() {
2760
- return createZodEnum2(util_1.util.objectKeys(this.shape));
2881
+ return createZodEnum2(util_js_1.util.objectKeys(this.shape));
2761
2882
  }
2762
2883
  };
2763
2884
  exports.ZodObject = ZodObject2;
@@ -2804,12 +2925,12 @@ var require_types = __commonJS({
2804
2925
  return result.result;
2805
2926
  }
2806
2927
  }
2807
- const unionErrors = results.map((result) => new ZodError_1.ZodError(result.ctx.common.issues));
2808
- (0, parseUtil_1.addIssueToContext)(ctx, {
2809
- code: ZodError_1.ZodIssueCode.invalid_union,
2928
+ const unionErrors = results.map((result) => new ZodError_js_1.ZodError(result.ctx.common.issues));
2929
+ (0, parseUtil_js_1.addIssueToContext)(ctx, {
2930
+ code: ZodError_js_1.ZodIssueCode.invalid_union,
2810
2931
  unionErrors
2811
2932
  });
2812
- return parseUtil_1.INVALID;
2933
+ return parseUtil_js_1.INVALID;
2813
2934
  }
2814
2935
  if (ctx.common.async) {
2815
2936
  return Promise.all(options.map(async (option) => {
@@ -2860,12 +2981,12 @@ var require_types = __commonJS({
2860
2981
  ctx.common.issues.push(...dirty.ctx.common.issues);
2861
2982
  return dirty.result;
2862
2983
  }
2863
- const unionErrors = issues.map((issues2) => new ZodError_1.ZodError(issues2));
2864
- (0, parseUtil_1.addIssueToContext)(ctx, {
2865
- code: ZodError_1.ZodIssueCode.invalid_union,
2984
+ const unionErrors = issues.map((issues2) => new ZodError_js_1.ZodError(issues2));
2985
+ (0, parseUtil_js_1.addIssueToContext)(ctx, {
2986
+ code: ZodError_js_1.ZodIssueCode.invalid_union,
2866
2987
  unionErrors
2867
2988
  });
2868
- return parseUtil_1.INVALID;
2989
+ return parseUtil_js_1.INVALID;
2869
2990
  }
2870
2991
  }
2871
2992
  get options() {
@@ -2890,7 +3011,7 @@ var require_types = __commonJS({
2890
3011
  } else if (type instanceof ZodEnum2) {
2891
3012
  return type.options;
2892
3013
  } else if (type instanceof ZodNativeEnum2) {
2893
- return util_1.util.objectValues(type.enum);
3014
+ return util_js_1.util.objectValues(type.enum);
2894
3015
  } else if (type instanceof ZodDefault2) {
2895
3016
  return getDiscriminator2(type._def.innerType);
2896
3017
  } else if (type instanceof ZodUndefined2) {
@@ -2914,24 +3035,24 @@ var require_types = __commonJS({
2914
3035
  var ZodDiscriminatedUnion2 = class _ZodDiscriminatedUnion extends ZodType2 {
2915
3036
  _parse(input) {
2916
3037
  const { ctx } = this._processInputParams(input);
2917
- if (ctx.parsedType !== util_1.ZodParsedType.object) {
2918
- (0, parseUtil_1.addIssueToContext)(ctx, {
2919
- code: ZodError_1.ZodIssueCode.invalid_type,
2920
- expected: util_1.ZodParsedType.object,
3038
+ if (ctx.parsedType !== util_js_1.ZodParsedType.object) {
3039
+ (0, parseUtil_js_1.addIssueToContext)(ctx, {
3040
+ code: ZodError_js_1.ZodIssueCode.invalid_type,
3041
+ expected: util_js_1.ZodParsedType.object,
2921
3042
  received: ctx.parsedType
2922
3043
  });
2923
- return parseUtil_1.INVALID;
3044
+ return parseUtil_js_1.INVALID;
2924
3045
  }
2925
3046
  const discriminator = this.discriminator;
2926
3047
  const discriminatorValue = ctx.data[discriminator];
2927
3048
  const option = this.optionsMap.get(discriminatorValue);
2928
3049
  if (!option) {
2929
- (0, parseUtil_1.addIssueToContext)(ctx, {
2930
- code: ZodError_1.ZodIssueCode.invalid_union_discriminator,
3050
+ (0, parseUtil_js_1.addIssueToContext)(ctx, {
3051
+ code: ZodError_js_1.ZodIssueCode.invalid_union_discriminator,
2931
3052
  options: Array.from(this.optionsMap.keys()),
2932
3053
  path: [discriminator]
2933
3054
  });
2934
- return parseUtil_1.INVALID;
3055
+ return parseUtil_js_1.INVALID;
2935
3056
  }
2936
3057
  if (ctx.common.async) {
2937
3058
  return option._parseAsync({
@@ -2989,13 +3110,13 @@ var require_types = __commonJS({
2989
3110
  };
2990
3111
  exports.ZodDiscriminatedUnion = ZodDiscriminatedUnion2;
2991
3112
  function mergeValues2(a, b) {
2992
- const aType = (0, util_1.getParsedType)(a);
2993
- const bType = (0, util_1.getParsedType)(b);
3113
+ const aType = (0, util_js_1.getParsedType)(a);
3114
+ const bType = (0, util_js_1.getParsedType)(b);
2994
3115
  if (a === b) {
2995
3116
  return { valid: true, data: a };
2996
- } else if (aType === util_1.ZodParsedType.object && bType === util_1.ZodParsedType.object) {
2997
- const bKeys = util_1.util.objectKeys(b);
2998
- const sharedKeys = util_1.util.objectKeys(a).filter((key) => bKeys.indexOf(key) !== -1);
3117
+ } else if (aType === util_js_1.ZodParsedType.object && bType === util_js_1.ZodParsedType.object) {
3118
+ const bKeys = util_js_1.util.objectKeys(b);
3119
+ const sharedKeys = util_js_1.util.objectKeys(a).filter((key) => bKeys.indexOf(key) !== -1);
2999
3120
  const newObj = { ...a, ...b };
3000
3121
  for (const key of sharedKeys) {
3001
3122
  const sharedValue = mergeValues2(a[key], b[key]);
@@ -3005,7 +3126,7 @@ var require_types = __commonJS({
3005
3126
  newObj[key] = sharedValue.data;
3006
3127
  }
3007
3128
  return { valid: true, data: newObj };
3008
- } else if (aType === util_1.ZodParsedType.array && bType === util_1.ZodParsedType.array) {
3129
+ } else if (aType === util_js_1.ZodParsedType.array && bType === util_js_1.ZodParsedType.array) {
3009
3130
  if (a.length !== b.length) {
3010
3131
  return { valid: false };
3011
3132
  }
@@ -3020,7 +3141,7 @@ var require_types = __commonJS({
3020
3141
  newArray.push(sharedValue.data);
3021
3142
  }
3022
3143
  return { valid: true, data: newArray };
3023
- } else if (aType === util_1.ZodParsedType.date && bType === util_1.ZodParsedType.date && +a === +b) {
3144
+ } else if (aType === util_js_1.ZodParsedType.date && bType === util_js_1.ZodParsedType.date && +a === +b) {
3024
3145
  return { valid: true, data: a };
3025
3146
  } else {
3026
3147
  return { valid: false };
@@ -3030,17 +3151,17 @@ var require_types = __commonJS({
3030
3151
  _parse(input) {
3031
3152
  const { status, ctx } = this._processInputParams(input);
3032
3153
  const handleParsed = (parsedLeft, parsedRight) => {
3033
- if ((0, parseUtil_1.isAborted)(parsedLeft) || (0, parseUtil_1.isAborted)(parsedRight)) {
3034
- return parseUtil_1.INVALID;
3154
+ if ((0, parseUtil_js_1.isAborted)(parsedLeft) || (0, parseUtil_js_1.isAborted)(parsedRight)) {
3155
+ return parseUtil_js_1.INVALID;
3035
3156
  }
3036
3157
  const merged = mergeValues2(parsedLeft.value, parsedRight.value);
3037
3158
  if (!merged.valid) {
3038
- (0, parseUtil_1.addIssueToContext)(ctx, {
3039
- code: ZodError_1.ZodIssueCode.invalid_intersection_types
3159
+ (0, parseUtil_js_1.addIssueToContext)(ctx, {
3160
+ code: ZodError_js_1.ZodIssueCode.invalid_intersection_types
3040
3161
  });
3041
- return parseUtil_1.INVALID;
3162
+ return parseUtil_js_1.INVALID;
3042
3163
  }
3043
- if ((0, parseUtil_1.isDirty)(parsedLeft) || (0, parseUtil_1.isDirty)(parsedRight)) {
3164
+ if ((0, parseUtil_js_1.isDirty)(parsedLeft) || (0, parseUtil_js_1.isDirty)(parsedRight)) {
3044
3165
  status.dirty();
3045
3166
  }
3046
3167
  return { status: status.value, value: merged.data };
@@ -3083,28 +3204,28 @@ var require_types = __commonJS({
3083
3204
  var ZodTuple2 = class _ZodTuple extends ZodType2 {
3084
3205
  _parse(input) {
3085
3206
  const { status, ctx } = this._processInputParams(input);
3086
- if (ctx.parsedType !== util_1.ZodParsedType.array) {
3087
- (0, parseUtil_1.addIssueToContext)(ctx, {
3088
- code: ZodError_1.ZodIssueCode.invalid_type,
3089
- expected: util_1.ZodParsedType.array,
3207
+ if (ctx.parsedType !== util_js_1.ZodParsedType.array) {
3208
+ (0, parseUtil_js_1.addIssueToContext)(ctx, {
3209
+ code: ZodError_js_1.ZodIssueCode.invalid_type,
3210
+ expected: util_js_1.ZodParsedType.array,
3090
3211
  received: ctx.parsedType
3091
3212
  });
3092
- return parseUtil_1.INVALID;
3213
+ return parseUtil_js_1.INVALID;
3093
3214
  }
3094
3215
  if (ctx.data.length < this._def.items.length) {
3095
- (0, parseUtil_1.addIssueToContext)(ctx, {
3096
- code: ZodError_1.ZodIssueCode.too_small,
3216
+ (0, parseUtil_js_1.addIssueToContext)(ctx, {
3217
+ code: ZodError_js_1.ZodIssueCode.too_small,
3097
3218
  minimum: this._def.items.length,
3098
3219
  inclusive: true,
3099
3220
  exact: false,
3100
3221
  type: "array"
3101
3222
  });
3102
- return parseUtil_1.INVALID;
3223
+ return parseUtil_js_1.INVALID;
3103
3224
  }
3104
3225
  const rest = this._def.rest;
3105
3226
  if (!rest && ctx.data.length > this._def.items.length) {
3106
- (0, parseUtil_1.addIssueToContext)(ctx, {
3107
- code: ZodError_1.ZodIssueCode.too_big,
3227
+ (0, parseUtil_js_1.addIssueToContext)(ctx, {
3228
+ code: ZodError_js_1.ZodIssueCode.too_big,
3108
3229
  maximum: this._def.items.length,
3109
3230
  inclusive: true,
3110
3231
  exact: false,
@@ -3120,10 +3241,10 @@ var require_types = __commonJS({
3120
3241
  }).filter((x) => !!x);
3121
3242
  if (ctx.common.async) {
3122
3243
  return Promise.all(items).then((results) => {
3123
- return parseUtil_1.ParseStatus.mergeArray(status, results);
3244
+ return parseUtil_js_1.ParseStatus.mergeArray(status, results);
3124
3245
  });
3125
3246
  } else {
3126
- return parseUtil_1.ParseStatus.mergeArray(status, items);
3247
+ return parseUtil_js_1.ParseStatus.mergeArray(status, items);
3127
3248
  }
3128
3249
  }
3129
3250
  get items() {
@@ -3157,13 +3278,13 @@ var require_types = __commonJS({
3157
3278
  }
3158
3279
  _parse(input) {
3159
3280
  const { status, ctx } = this._processInputParams(input);
3160
- if (ctx.parsedType !== util_1.ZodParsedType.object) {
3161
- (0, parseUtil_1.addIssueToContext)(ctx, {
3162
- code: ZodError_1.ZodIssueCode.invalid_type,
3163
- expected: util_1.ZodParsedType.object,
3281
+ if (ctx.parsedType !== util_js_1.ZodParsedType.object) {
3282
+ (0, parseUtil_js_1.addIssueToContext)(ctx, {
3283
+ code: ZodError_js_1.ZodIssueCode.invalid_type,
3284
+ expected: util_js_1.ZodParsedType.object,
3164
3285
  received: ctx.parsedType
3165
3286
  });
3166
- return parseUtil_1.INVALID;
3287
+ return parseUtil_js_1.INVALID;
3167
3288
  }
3168
3289
  const pairs = [];
3169
3290
  const keyType = this._def.keyType;
@@ -3176,9 +3297,9 @@ var require_types = __commonJS({
3176
3297
  });
3177
3298
  }
3178
3299
  if (ctx.common.async) {
3179
- return parseUtil_1.ParseStatus.mergeObjectAsync(status, pairs);
3300
+ return parseUtil_js_1.ParseStatus.mergeObjectAsync(status, pairs);
3180
3301
  } else {
3181
- return parseUtil_1.ParseStatus.mergeObjectSync(status, pairs);
3302
+ return parseUtil_js_1.ParseStatus.mergeObjectSync(status, pairs);
3182
3303
  }
3183
3304
  }
3184
3305
  get element() {
@@ -3211,13 +3332,13 @@ var require_types = __commonJS({
3211
3332
  }
3212
3333
  _parse(input) {
3213
3334
  const { status, ctx } = this._processInputParams(input);
3214
- if (ctx.parsedType !== util_1.ZodParsedType.map) {
3215
- (0, parseUtil_1.addIssueToContext)(ctx, {
3216
- code: ZodError_1.ZodIssueCode.invalid_type,
3217
- expected: util_1.ZodParsedType.map,
3335
+ if (ctx.parsedType !== util_js_1.ZodParsedType.map) {
3336
+ (0, parseUtil_js_1.addIssueToContext)(ctx, {
3337
+ code: ZodError_js_1.ZodIssueCode.invalid_type,
3338
+ expected: util_js_1.ZodParsedType.map,
3218
3339
  received: ctx.parsedType
3219
3340
  });
3220
- return parseUtil_1.INVALID;
3341
+ return parseUtil_js_1.INVALID;
3221
3342
  }
3222
3343
  const keyType = this._def.keyType;
3223
3344
  const valueType = this._def.valueType;
@@ -3234,7 +3355,7 @@ var require_types = __commonJS({
3234
3355
  const key = await pair.key;
3235
3356
  const value = await pair.value;
3236
3357
  if (key.status === "aborted" || value.status === "aborted") {
3237
- return parseUtil_1.INVALID;
3358
+ return parseUtil_js_1.INVALID;
3238
3359
  }
3239
3360
  if (key.status === "dirty" || value.status === "dirty") {
3240
3361
  status.dirty();
@@ -3249,7 +3370,7 @@ var require_types = __commonJS({
3249
3370
  const key = pair.key;
3250
3371
  const value = pair.value;
3251
3372
  if (key.status === "aborted" || value.status === "aborted") {
3252
- return parseUtil_1.INVALID;
3373
+ return parseUtil_js_1.INVALID;
3253
3374
  }
3254
3375
  if (key.status === "dirty" || value.status === "dirty") {
3255
3376
  status.dirty();
@@ -3272,19 +3393,19 @@ var require_types = __commonJS({
3272
3393
  var ZodSet2 = class _ZodSet extends ZodType2 {
3273
3394
  _parse(input) {
3274
3395
  const { status, ctx } = this._processInputParams(input);
3275
- if (ctx.parsedType !== util_1.ZodParsedType.set) {
3276
- (0, parseUtil_1.addIssueToContext)(ctx, {
3277
- code: ZodError_1.ZodIssueCode.invalid_type,
3278
- expected: util_1.ZodParsedType.set,
3396
+ if (ctx.parsedType !== util_js_1.ZodParsedType.set) {
3397
+ (0, parseUtil_js_1.addIssueToContext)(ctx, {
3398
+ code: ZodError_js_1.ZodIssueCode.invalid_type,
3399
+ expected: util_js_1.ZodParsedType.set,
3279
3400
  received: ctx.parsedType
3280
3401
  });
3281
- return parseUtil_1.INVALID;
3402
+ return parseUtil_js_1.INVALID;
3282
3403
  }
3283
3404
  const def = this._def;
3284
3405
  if (def.minSize !== null) {
3285
3406
  if (ctx.data.size < def.minSize.value) {
3286
- (0, parseUtil_1.addIssueToContext)(ctx, {
3287
- code: ZodError_1.ZodIssueCode.too_small,
3407
+ (0, parseUtil_js_1.addIssueToContext)(ctx, {
3408
+ code: ZodError_js_1.ZodIssueCode.too_small,
3288
3409
  minimum: def.minSize.value,
3289
3410
  type: "set",
3290
3411
  inclusive: true,
@@ -3296,8 +3417,8 @@ var require_types = __commonJS({
3296
3417
  }
3297
3418
  if (def.maxSize !== null) {
3298
3419
  if (ctx.data.size > def.maxSize.value) {
3299
- (0, parseUtil_1.addIssueToContext)(ctx, {
3300
- code: ZodError_1.ZodIssueCode.too_big,
3420
+ (0, parseUtil_js_1.addIssueToContext)(ctx, {
3421
+ code: ZodError_js_1.ZodIssueCode.too_big,
3301
3422
  maximum: def.maxSize.value,
3302
3423
  type: "set",
3303
3424
  inclusive: true,
@@ -3312,7 +3433,7 @@ var require_types = __commonJS({
3312
3433
  const parsedSet = /* @__PURE__ */ new Set();
3313
3434
  for (const element of elements2) {
3314
3435
  if (element.status === "aborted")
3315
- return parseUtil_1.INVALID;
3436
+ return parseUtil_js_1.INVALID;
3316
3437
  if (element.status === "dirty")
3317
3438
  status.dirty();
3318
3439
  parsedSet.add(element.value);
@@ -3329,13 +3450,13 @@ var require_types = __commonJS({
3329
3450
  min(minSize, message) {
3330
3451
  return new _ZodSet({
3331
3452
  ...this._def,
3332
- minSize: { value: minSize, message: errorUtil_1.errorUtil.toString(message) }
3453
+ minSize: { value: minSize, message: errorUtil_js_1.errorUtil.toString(message) }
3333
3454
  });
3334
3455
  }
3335
3456
  max(maxSize, message) {
3336
3457
  return new _ZodSet({
3337
3458
  ...this._def,
3338
- maxSize: { value: maxSize, message: errorUtil_1.errorUtil.toString(message) }
3459
+ maxSize: { value: maxSize, message: errorUtil_js_1.errorUtil.toString(message) }
3339
3460
  });
3340
3461
  }
3341
3462
  size(size, message) {
@@ -3362,42 +3483,32 @@ var require_types = __commonJS({
3362
3483
  }
3363
3484
  _parse(input) {
3364
3485
  const { ctx } = this._processInputParams(input);
3365
- if (ctx.parsedType !== util_1.ZodParsedType.function) {
3366
- (0, parseUtil_1.addIssueToContext)(ctx, {
3367
- code: ZodError_1.ZodIssueCode.invalid_type,
3368
- expected: util_1.ZodParsedType.function,
3486
+ if (ctx.parsedType !== util_js_1.ZodParsedType.function) {
3487
+ (0, parseUtil_js_1.addIssueToContext)(ctx, {
3488
+ code: ZodError_js_1.ZodIssueCode.invalid_type,
3489
+ expected: util_js_1.ZodParsedType.function,
3369
3490
  received: ctx.parsedType
3370
3491
  });
3371
- return parseUtil_1.INVALID;
3492
+ return parseUtil_js_1.INVALID;
3372
3493
  }
3373
3494
  function makeArgsIssue(args, error) {
3374
- return (0, parseUtil_1.makeIssue)({
3495
+ return (0, parseUtil_js_1.makeIssue)({
3375
3496
  data: args,
3376
3497
  path: ctx.path,
3377
- errorMaps: [
3378
- ctx.common.contextualErrorMap,
3379
- ctx.schemaErrorMap,
3380
- (0, errors_1.getErrorMap)(),
3381
- errors_1.defaultErrorMap
3382
- ].filter((x) => !!x),
3498
+ errorMaps: [ctx.common.contextualErrorMap, ctx.schemaErrorMap, (0, errors_js_1.getErrorMap)(), errors_js_1.defaultErrorMap].filter((x) => !!x),
3383
3499
  issueData: {
3384
- code: ZodError_1.ZodIssueCode.invalid_arguments,
3500
+ code: ZodError_js_1.ZodIssueCode.invalid_arguments,
3385
3501
  argumentsError: error
3386
3502
  }
3387
3503
  });
3388
3504
  }
3389
3505
  function makeReturnsIssue(returns, error) {
3390
- return (0, parseUtil_1.makeIssue)({
3506
+ return (0, parseUtil_js_1.makeIssue)({
3391
3507
  data: returns,
3392
3508
  path: ctx.path,
3393
- errorMaps: [
3394
- ctx.common.contextualErrorMap,
3395
- ctx.schemaErrorMap,
3396
- (0, errors_1.getErrorMap)(),
3397
- errors_1.defaultErrorMap
3398
- ].filter((x) => !!x),
3509
+ errorMaps: [ctx.common.contextualErrorMap, ctx.schemaErrorMap, (0, errors_js_1.getErrorMap)(), errors_js_1.defaultErrorMap].filter((x) => !!x),
3399
3510
  issueData: {
3400
- code: ZodError_1.ZodIssueCode.invalid_return_type,
3511
+ code: ZodError_js_1.ZodIssueCode.invalid_return_type,
3401
3512
  returnTypeError: error
3402
3513
  }
3403
3514
  });
@@ -3406,8 +3517,8 @@ var require_types = __commonJS({
3406
3517
  const fn = ctx.data;
3407
3518
  if (this._def.returns instanceof ZodPromise2) {
3408
3519
  const me = this;
3409
- return (0, parseUtil_1.OK)(async function(...args) {
3410
- const error = new ZodError_1.ZodError([]);
3520
+ return (0, parseUtil_js_1.OK)(async function(...args) {
3521
+ const error = new ZodError_js_1.ZodError([]);
3411
3522
  const parsedArgs = await me._def.args.parseAsync(args, params).catch((e) => {
3412
3523
  error.addIssue(makeArgsIssue(args, e));
3413
3524
  throw error;
@@ -3421,15 +3532,15 @@ var require_types = __commonJS({
3421
3532
  });
3422
3533
  } else {
3423
3534
  const me = this;
3424
- return (0, parseUtil_1.OK)(function(...args) {
3535
+ return (0, parseUtil_js_1.OK)(function(...args) {
3425
3536
  const parsedArgs = me._def.args.safeParse(args, params);
3426
3537
  if (!parsedArgs.success) {
3427
- throw new ZodError_1.ZodError([makeArgsIssue(args, parsedArgs.error)]);
3538
+ throw new ZodError_js_1.ZodError([makeArgsIssue(args, parsedArgs.error)]);
3428
3539
  }
3429
3540
  const result = Reflect.apply(fn, this, parsedArgs.data);
3430
3541
  const parsedReturns = me._def.returns.safeParse(result, params);
3431
3542
  if (!parsedReturns.success) {
3432
- throw new ZodError_1.ZodError([makeReturnsIssue(result, parsedReturns.error)]);
3543
+ throw new ZodError_js_1.ZodError([makeReturnsIssue(result, parsedReturns.error)]);
3433
3544
  }
3434
3545
  return parsedReturns.data;
3435
3546
  });
@@ -3493,12 +3604,12 @@ var require_types = __commonJS({
3493
3604
  _parse(input) {
3494
3605
  if (input.data !== this._def.value) {
3495
3606
  const ctx = this._getOrReturnCtx(input);
3496
- (0, parseUtil_1.addIssueToContext)(ctx, {
3607
+ (0, parseUtil_js_1.addIssueToContext)(ctx, {
3497
3608
  received: ctx.data,
3498
- code: ZodError_1.ZodIssueCode.invalid_literal,
3609
+ code: ZodError_js_1.ZodIssueCode.invalid_literal,
3499
3610
  expected: this._def.value
3500
3611
  });
3501
- return parseUtil_1.INVALID;
3612
+ return parseUtil_js_1.INVALID;
3502
3613
  }
3503
3614
  return { status: "valid", value: input.data };
3504
3615
  }
@@ -3522,35 +3633,31 @@ var require_types = __commonJS({
3522
3633
  });
3523
3634
  }
3524
3635
  var ZodEnum2 = class _ZodEnum extends ZodType2 {
3525
- constructor() {
3526
- super(...arguments);
3527
- _ZodEnum_cache2.set(this, void 0);
3528
- }
3529
3636
  _parse(input) {
3530
3637
  if (typeof input.data !== "string") {
3531
3638
  const ctx = this._getOrReturnCtx(input);
3532
3639
  const expectedValues = this._def.values;
3533
- (0, parseUtil_1.addIssueToContext)(ctx, {
3534
- expected: util_1.util.joinValues(expectedValues),
3640
+ (0, parseUtil_js_1.addIssueToContext)(ctx, {
3641
+ expected: util_js_1.util.joinValues(expectedValues),
3535
3642
  received: ctx.parsedType,
3536
- code: ZodError_1.ZodIssueCode.invalid_type
3643
+ code: ZodError_js_1.ZodIssueCode.invalid_type
3537
3644
  });
3538
- return parseUtil_1.INVALID;
3645
+ return parseUtil_js_1.INVALID;
3539
3646
  }
3540
- if (!__classPrivateFieldGet2(this, _ZodEnum_cache2, "f")) {
3541
- __classPrivateFieldSet2(this, _ZodEnum_cache2, new Set(this._def.values), "f");
3647
+ if (!this._cache) {
3648
+ this._cache = new Set(this._def.values);
3542
3649
  }
3543
- if (!__classPrivateFieldGet2(this, _ZodEnum_cache2, "f").has(input.data)) {
3650
+ if (!this._cache.has(input.data)) {
3544
3651
  const ctx = this._getOrReturnCtx(input);
3545
3652
  const expectedValues = this._def.values;
3546
- (0, parseUtil_1.addIssueToContext)(ctx, {
3653
+ (0, parseUtil_js_1.addIssueToContext)(ctx, {
3547
3654
  received: ctx.data,
3548
- code: ZodError_1.ZodIssueCode.invalid_enum_value,
3655
+ code: ZodError_js_1.ZodIssueCode.invalid_enum_value,
3549
3656
  options: expectedValues
3550
3657
  });
3551
- return parseUtil_1.INVALID;
3658
+ return parseUtil_js_1.INVALID;
3552
3659
  }
3553
- return (0, parseUtil_1.OK)(input.data);
3660
+ return (0, parseUtil_js_1.OK)(input.data);
3554
3661
  }
3555
3662
  get options() {
3556
3663
  return this._def.values;
@@ -3590,45 +3697,39 @@ var require_types = __commonJS({
3590
3697
  }
3591
3698
  };
3592
3699
  exports.ZodEnum = ZodEnum2;
3593
- _ZodEnum_cache2 = /* @__PURE__ */ new WeakMap();
3594
3700
  ZodEnum2.create = createZodEnum2;
3595
3701
  var ZodNativeEnum2 = class extends ZodType2 {
3596
- constructor() {
3597
- super(...arguments);
3598
- _ZodNativeEnum_cache2.set(this, void 0);
3599
- }
3600
3702
  _parse(input) {
3601
- const nativeEnumValues = util_1.util.getValidEnumValues(this._def.values);
3703
+ const nativeEnumValues = util_js_1.util.getValidEnumValues(this._def.values);
3602
3704
  const ctx = this._getOrReturnCtx(input);
3603
- if (ctx.parsedType !== util_1.ZodParsedType.string && ctx.parsedType !== util_1.ZodParsedType.number) {
3604
- const expectedValues = util_1.util.objectValues(nativeEnumValues);
3605
- (0, parseUtil_1.addIssueToContext)(ctx, {
3606
- expected: util_1.util.joinValues(expectedValues),
3705
+ if (ctx.parsedType !== util_js_1.ZodParsedType.string && ctx.parsedType !== util_js_1.ZodParsedType.number) {
3706
+ const expectedValues = util_js_1.util.objectValues(nativeEnumValues);
3707
+ (0, parseUtil_js_1.addIssueToContext)(ctx, {
3708
+ expected: util_js_1.util.joinValues(expectedValues),
3607
3709
  received: ctx.parsedType,
3608
- code: ZodError_1.ZodIssueCode.invalid_type
3710
+ code: ZodError_js_1.ZodIssueCode.invalid_type
3609
3711
  });
3610
- return parseUtil_1.INVALID;
3712
+ return parseUtil_js_1.INVALID;
3611
3713
  }
3612
- if (!__classPrivateFieldGet2(this, _ZodNativeEnum_cache2, "f")) {
3613
- __classPrivateFieldSet2(this, _ZodNativeEnum_cache2, new Set(util_1.util.getValidEnumValues(this._def.values)), "f");
3714
+ if (!this._cache) {
3715
+ this._cache = new Set(util_js_1.util.getValidEnumValues(this._def.values));
3614
3716
  }
3615
- if (!__classPrivateFieldGet2(this, _ZodNativeEnum_cache2, "f").has(input.data)) {
3616
- const expectedValues = util_1.util.objectValues(nativeEnumValues);
3617
- (0, parseUtil_1.addIssueToContext)(ctx, {
3717
+ if (!this._cache.has(input.data)) {
3718
+ const expectedValues = util_js_1.util.objectValues(nativeEnumValues);
3719
+ (0, parseUtil_js_1.addIssueToContext)(ctx, {
3618
3720
  received: ctx.data,
3619
- code: ZodError_1.ZodIssueCode.invalid_enum_value,
3721
+ code: ZodError_js_1.ZodIssueCode.invalid_enum_value,
3620
3722
  options: expectedValues
3621
3723
  });
3622
- return parseUtil_1.INVALID;
3724
+ return parseUtil_js_1.INVALID;
3623
3725
  }
3624
- return (0, parseUtil_1.OK)(input.data);
3726
+ return (0, parseUtil_js_1.OK)(input.data);
3625
3727
  }
3626
3728
  get enum() {
3627
3729
  return this._def.values;
3628
3730
  }
3629
3731
  };
3630
3732
  exports.ZodNativeEnum = ZodNativeEnum2;
3631
- _ZodNativeEnum_cache2 = /* @__PURE__ */ new WeakMap();
3632
3733
  ZodNativeEnum2.create = (values, params) => {
3633
3734
  return new ZodNativeEnum2({
3634
3735
  values,
@@ -3642,16 +3743,16 @@ var require_types = __commonJS({
3642
3743
  }
3643
3744
  _parse(input) {
3644
3745
  const { ctx } = this._processInputParams(input);
3645
- if (ctx.parsedType !== util_1.ZodParsedType.promise && ctx.common.async === false) {
3646
- (0, parseUtil_1.addIssueToContext)(ctx, {
3647
- code: ZodError_1.ZodIssueCode.invalid_type,
3648
- expected: util_1.ZodParsedType.promise,
3746
+ if (ctx.parsedType !== util_js_1.ZodParsedType.promise && ctx.common.async === false) {
3747
+ (0, parseUtil_js_1.addIssueToContext)(ctx, {
3748
+ code: ZodError_js_1.ZodIssueCode.invalid_type,
3749
+ expected: util_js_1.ZodParsedType.promise,
3649
3750
  received: ctx.parsedType
3650
3751
  });
3651
- return parseUtil_1.INVALID;
3752
+ return parseUtil_js_1.INVALID;
3652
3753
  }
3653
- const promisified = ctx.parsedType === util_1.ZodParsedType.promise ? ctx.data : Promise.resolve(ctx.data);
3654
- return (0, parseUtil_1.OK)(promisified.then((data) => {
3754
+ const promisified = ctx.parsedType === util_js_1.ZodParsedType.promise ? ctx.data : Promise.resolve(ctx.data);
3755
+ return (0, parseUtil_js_1.OK)(promisified.then((data) => {
3655
3756
  return this._def.type.parseAsync(data, {
3656
3757
  path: ctx.path,
3657
3758
  errorMap: ctx.common.contextualErrorMap
@@ -3679,7 +3780,7 @@ var require_types = __commonJS({
3679
3780
  const effect = this._def.effect || null;
3680
3781
  const checkCtx = {
3681
3782
  addIssue: (arg) => {
3682
- (0, parseUtil_1.addIssueToContext)(ctx, arg);
3783
+ (0, parseUtil_js_1.addIssueToContext)(ctx, arg);
3683
3784
  if (arg.fatal) {
3684
3785
  status.abort();
3685
3786
  } else {
@@ -3696,34 +3797,34 @@ var require_types = __commonJS({
3696
3797
  if (ctx.common.async) {
3697
3798
  return Promise.resolve(processed).then(async (processed2) => {
3698
3799
  if (status.value === "aborted")
3699
- return parseUtil_1.INVALID;
3800
+ return parseUtil_js_1.INVALID;
3700
3801
  const result = await this._def.schema._parseAsync({
3701
3802
  data: processed2,
3702
3803
  path: ctx.path,
3703
3804
  parent: ctx
3704
3805
  });
3705
3806
  if (result.status === "aborted")
3706
- return parseUtil_1.INVALID;
3807
+ return parseUtil_js_1.INVALID;
3707
3808
  if (result.status === "dirty")
3708
- return (0, parseUtil_1.DIRTY)(result.value);
3809
+ return (0, parseUtil_js_1.DIRTY)(result.value);
3709
3810
  if (status.value === "dirty")
3710
- return (0, parseUtil_1.DIRTY)(result.value);
3811
+ return (0, parseUtil_js_1.DIRTY)(result.value);
3711
3812
  return result;
3712
3813
  });
3713
3814
  } else {
3714
3815
  if (status.value === "aborted")
3715
- return parseUtil_1.INVALID;
3816
+ return parseUtil_js_1.INVALID;
3716
3817
  const result = this._def.schema._parseSync({
3717
3818
  data: processed,
3718
3819
  path: ctx.path,
3719
3820
  parent: ctx
3720
3821
  });
3721
3822
  if (result.status === "aborted")
3722
- return parseUtil_1.INVALID;
3823
+ return parseUtil_js_1.INVALID;
3723
3824
  if (result.status === "dirty")
3724
- return (0, parseUtil_1.DIRTY)(result.value);
3825
+ return (0, parseUtil_js_1.DIRTY)(result.value);
3725
3826
  if (status.value === "dirty")
3726
- return (0, parseUtil_1.DIRTY)(result.value);
3827
+ return (0, parseUtil_js_1.DIRTY)(result.value);
3727
3828
  return result;
3728
3829
  }
3729
3830
  }
@@ -3745,7 +3846,7 @@ var require_types = __commonJS({
3745
3846
  parent: ctx
3746
3847
  });
3747
3848
  if (inner.status === "aborted")
3748
- return parseUtil_1.INVALID;
3849
+ return parseUtil_js_1.INVALID;
3749
3850
  if (inner.status === "dirty")
3750
3851
  status.dirty();
3751
3852
  executeRefinement(inner.value);
@@ -3753,7 +3854,7 @@ var require_types = __commonJS({
3753
3854
  } else {
3754
3855
  return this._def.schema._parseAsync({ data: ctx.data, path: ctx.path, parent: ctx }).then((inner) => {
3755
3856
  if (inner.status === "aborted")
3756
- return parseUtil_1.INVALID;
3857
+ return parseUtil_js_1.INVALID;
3757
3858
  if (inner.status === "dirty")
3758
3859
  status.dirty();
3759
3860
  return executeRefinement(inner.value).then(() => {
@@ -3769,8 +3870,8 @@ var require_types = __commonJS({
3769
3870
  path: ctx.path,
3770
3871
  parent: ctx
3771
3872
  });
3772
- if (!(0, parseUtil_1.isValid)(base))
3773
- return base;
3873
+ if (!(0, parseUtil_js_1.isValid)(base))
3874
+ return parseUtil_js_1.INVALID;
3774
3875
  const result = effect.transform(base.value, checkCtx);
3775
3876
  if (result instanceof Promise) {
3776
3877
  throw new Error(`Asynchronous transform encountered during synchronous parse operation. Use .parseAsync instead.`);
@@ -3778,13 +3879,16 @@ var require_types = __commonJS({
3778
3879
  return { status: status.value, value: result };
3779
3880
  } else {
3780
3881
  return this._def.schema._parseAsync({ data: ctx.data, path: ctx.path, parent: ctx }).then((base) => {
3781
- if (!(0, parseUtil_1.isValid)(base))
3782
- return base;
3783
- return Promise.resolve(effect.transform(base.value, checkCtx)).then((result) => ({ status: status.value, value: result }));
3882
+ if (!(0, parseUtil_js_1.isValid)(base))
3883
+ return parseUtil_js_1.INVALID;
3884
+ return Promise.resolve(effect.transform(base.value, checkCtx)).then((result) => ({
3885
+ status: status.value,
3886
+ value: result
3887
+ }));
3784
3888
  });
3785
3889
  }
3786
3890
  }
3787
- util_1.util.assertNever(effect);
3891
+ util_js_1.util.assertNever(effect);
3788
3892
  }
3789
3893
  };
3790
3894
  exports.ZodEffects = ZodEffects2;
@@ -3808,8 +3912,8 @@ var require_types = __commonJS({
3808
3912
  var ZodOptional2 = class extends ZodType2 {
3809
3913
  _parse(input) {
3810
3914
  const parsedType = this._getType(input);
3811
- if (parsedType === util_1.ZodParsedType.undefined) {
3812
- return (0, parseUtil_1.OK)(void 0);
3915
+ if (parsedType === util_js_1.ZodParsedType.undefined) {
3916
+ return (0, parseUtil_js_1.OK)(void 0);
3813
3917
  }
3814
3918
  return this._def.innerType._parse(input);
3815
3919
  }
@@ -3828,8 +3932,8 @@ var require_types = __commonJS({
3828
3932
  var ZodNullable2 = class extends ZodType2 {
3829
3933
  _parse(input) {
3830
3934
  const parsedType = this._getType(input);
3831
- if (parsedType === util_1.ZodParsedType.null) {
3832
- return (0, parseUtil_1.OK)(null);
3935
+ if (parsedType === util_js_1.ZodParsedType.null) {
3936
+ return (0, parseUtil_js_1.OK)(null);
3833
3937
  }
3834
3938
  return this._def.innerType._parse(input);
3835
3939
  }
@@ -3849,7 +3953,7 @@ var require_types = __commonJS({
3849
3953
  _parse(input) {
3850
3954
  const { ctx } = this._processInputParams(input);
3851
3955
  let data = ctx.data;
3852
- if (ctx.parsedType === util_1.ZodParsedType.undefined) {
3956
+ if (ctx.parsedType === util_js_1.ZodParsedType.undefined) {
3853
3957
  data = this._def.defaultValue();
3854
3958
  }
3855
3959
  return this._def.innerType._parse({
@@ -3888,13 +3992,13 @@ var require_types = __commonJS({
3888
3992
  ...newCtx
3889
3993
  }
3890
3994
  });
3891
- if ((0, parseUtil_1.isAsync)(result)) {
3995
+ if ((0, parseUtil_js_1.isAsync)(result)) {
3892
3996
  return result.then((result2) => {
3893
3997
  return {
3894
3998
  status: "valid",
3895
3999
  value: result2.status === "valid" ? result2.value : this._def.catchValue({
3896
4000
  get error() {
3897
- return new ZodError_1.ZodError(newCtx.common.issues);
4001
+ return new ZodError_js_1.ZodError(newCtx.common.issues);
3898
4002
  },
3899
4003
  input: newCtx.data
3900
4004
  })
@@ -3905,7 +4009,7 @@ var require_types = __commonJS({
3905
4009
  status: "valid",
3906
4010
  value: result.status === "valid" ? result.value : this._def.catchValue({
3907
4011
  get error() {
3908
- return new ZodError_1.ZodError(newCtx.common.issues);
4012
+ return new ZodError_js_1.ZodError(newCtx.common.issues);
3909
4013
  },
3910
4014
  input: newCtx.data
3911
4015
  })
@@ -3928,14 +4032,14 @@ var require_types = __commonJS({
3928
4032
  var ZodNaN2 = class extends ZodType2 {
3929
4033
  _parse(input) {
3930
4034
  const parsedType = this._getType(input);
3931
- if (parsedType !== util_1.ZodParsedType.nan) {
4035
+ if (parsedType !== util_js_1.ZodParsedType.nan) {
3932
4036
  const ctx = this._getOrReturnCtx(input);
3933
- (0, parseUtil_1.addIssueToContext)(ctx, {
3934
- code: ZodError_1.ZodIssueCode.invalid_type,
3935
- expected: util_1.ZodParsedType.nan,
4037
+ (0, parseUtil_js_1.addIssueToContext)(ctx, {
4038
+ code: ZodError_js_1.ZodIssueCode.invalid_type,
4039
+ expected: util_js_1.ZodParsedType.nan,
3936
4040
  received: ctx.parsedType
3937
4041
  });
3938
- return parseUtil_1.INVALID;
4042
+ return parseUtil_js_1.INVALID;
3939
4043
  }
3940
4044
  return { status: "valid", value: input.data };
3941
4045
  }
@@ -3974,10 +4078,10 @@ var require_types = __commonJS({
3974
4078
  parent: ctx
3975
4079
  });
3976
4080
  if (inResult.status === "aborted")
3977
- return parseUtil_1.INVALID;
4081
+ return parseUtil_js_1.INVALID;
3978
4082
  if (inResult.status === "dirty") {
3979
4083
  status.dirty();
3980
- return (0, parseUtil_1.DIRTY)(inResult.value);
4084
+ return (0, parseUtil_js_1.DIRTY)(inResult.value);
3981
4085
  } else {
3982
4086
  return this._def.out._parseAsync({
3983
4087
  data: inResult.value,
@@ -3994,7 +4098,7 @@ var require_types = __commonJS({
3994
4098
  parent: ctx
3995
4099
  });
3996
4100
  if (inResult.status === "aborted")
3997
- return parseUtil_1.INVALID;
4101
+ return parseUtil_js_1.INVALID;
3998
4102
  if (inResult.status === "dirty") {
3999
4103
  status.dirty();
4000
4104
  return {
@@ -4023,12 +4127,12 @@ var require_types = __commonJS({
4023
4127
  _parse(input) {
4024
4128
  const result = this._def.innerType._parse(input);
4025
4129
  const freeze = (data) => {
4026
- if ((0, parseUtil_1.isValid)(data)) {
4130
+ if ((0, parseUtil_js_1.isValid)(data)) {
4027
4131
  data.value = Object.freeze(data.value);
4028
4132
  }
4029
4133
  return data;
4030
4134
  };
4031
- return (0, parseUtil_1.isAsync)(result) ? result.then((data) => freeze(data)) : freeze(result);
4135
+ return (0, parseUtil_js_1.isAsync)(result) ? result.then((data) => freeze(data)) : freeze(result);
4032
4136
  }
4033
4137
  unwrap() {
4034
4138
  return this._def.innerType;
@@ -4042,20 +4146,33 @@ var require_types = __commonJS({
4042
4146
  ...processCreateParams2(params)
4043
4147
  });
4044
4148
  };
4045
- function custom2(check, params = {}, fatal) {
4149
+ function cleanParams2(params, data) {
4150
+ const p = typeof params === "function" ? params(data) : typeof params === "string" ? { message: params } : params;
4151
+ const p2 = typeof p === "string" ? { message: p } : p;
4152
+ return p2;
4153
+ }
4154
+ function custom2(check, _params = {}, fatal) {
4046
4155
  if (check)
4047
4156
  return ZodAny2.create().superRefine((data, ctx) => {
4048
- var _a, _b;
4049
- if (!check(data)) {
4050
- const p = typeof params === "function" ? params(data) : typeof params === "string" ? { message: params } : params;
4051
- const _fatal = (_b = (_a = p.fatal) !== null && _a !== void 0 ? _a : fatal) !== null && _b !== void 0 ? _b : true;
4052
- const p2 = typeof p === "string" ? { message: p } : p;
4053
- ctx.addIssue({ code: "custom", ...p2, fatal: _fatal });
4157
+ const r = check(data);
4158
+ if (r instanceof Promise) {
4159
+ return r.then((r2) => {
4160
+ if (!r2) {
4161
+ const params = cleanParams2(_params, data);
4162
+ const _fatal = params.fatal ?? fatal ?? true;
4163
+ ctx.addIssue({ code: "custom", ...params, fatal: _fatal });
4164
+ }
4165
+ });
4166
+ }
4167
+ if (!r) {
4168
+ const params = cleanParams2(_params, data);
4169
+ const _fatal = params.fatal ?? fatal ?? true;
4170
+ ctx.addIssue({ code: "custom", ...params, fatal: _fatal });
4054
4171
  }
4172
+ return;
4055
4173
  });
4056
4174
  return ZodAny2.create();
4057
4175
  }
4058
- exports.custom = custom2;
4059
4176
  exports.late = {
4060
4177
  object: ZodObject2.lazycreate
4061
4178
  };
@@ -4097,7 +4214,7 @@ var require_types = __commonJS({
4097
4214
  ZodFirstPartyTypeKind3["ZodBranded"] = "ZodBranded";
4098
4215
  ZodFirstPartyTypeKind3["ZodPipeline"] = "ZodPipeline";
4099
4216
  ZodFirstPartyTypeKind3["ZodReadonly"] = "ZodReadonly";
4100
- })(ZodFirstPartyTypeKind2 = exports.ZodFirstPartyTypeKind || (exports.ZodFirstPartyTypeKind = {}));
4217
+ })(ZodFirstPartyTypeKind2 || (exports.ZodFirstPartyTypeKind = ZodFirstPartyTypeKind2 = {}));
4101
4218
  var instanceOfType2 = (cls, params = {
4102
4219
  message: `Input not instance of ${cls.name}`
4103
4220
  }) => custom2((data) => data instanceof cls, params);
@@ -4187,19 +4304,23 @@ var require_types = __commonJS({
4187
4304
  bigint: (arg) => ZodBigInt2.create({ ...arg, coerce: true }),
4188
4305
  date: (arg) => ZodDate2.create({ ...arg, coerce: true })
4189
4306
  };
4190
- exports.NEVER = parseUtil_1.INVALID;
4307
+ exports.NEVER = parseUtil_js_1.INVALID;
4191
4308
  }
4192
4309
  });
4193
4310
 
4194
- // ../../node_modules/zod/lib/external.js
4311
+ // ../../node_modules/zod/dist/cjs/v3/external.js
4195
4312
  var require_external = __commonJS({
4196
- "../../node_modules/zod/lib/external.js"(exports) {
4313
+ "../../node_modules/zod/dist/cjs/v3/external.js"(exports) {
4197
4314
  "use strict";
4198
4315
  var __createBinding = exports && exports.__createBinding || (Object.create ? function(o, m, k, k2) {
4199
4316
  if (k2 === void 0) k2 = k;
4200
- Object.defineProperty(o, k2, { enumerable: true, get: function() {
4201
- return m[k];
4202
- } });
4317
+ var desc = Object.getOwnPropertyDescriptor(m, k);
4318
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
4319
+ desc = { enumerable: true, get: function() {
4320
+ return m[k];
4321
+ } };
4322
+ }
4323
+ Object.defineProperty(o, k2, desc);
4203
4324
  } : function(o, m, k, k2) {
4204
4325
  if (k2 === void 0) k2 = k;
4205
4326
  o[k2] = m[k];
@@ -4217,15 +4338,19 @@ var require_external = __commonJS({
4217
4338
  }
4218
4339
  });
4219
4340
 
4220
- // ../../node_modules/zod/lib/index.js
4221
- var require_lib = __commonJS({
4222
- "../../node_modules/zod/lib/index.js"(exports) {
4341
+ // ../../node_modules/zod/dist/cjs/v3/index.js
4342
+ var require_v3 = __commonJS({
4343
+ "../../node_modules/zod/dist/cjs/v3/index.js"(exports) {
4223
4344
  "use strict";
4224
4345
  var __createBinding = exports && exports.__createBinding || (Object.create ? function(o, m, k, k2) {
4225
4346
  if (k2 === void 0) k2 = k;
4226
- Object.defineProperty(o, k2, { enumerable: true, get: function() {
4227
- return m[k];
4228
- } });
4347
+ var desc = Object.getOwnPropertyDescriptor(m, k);
4348
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
4349
+ desc = { enumerable: true, get: function() {
4350
+ return m[k];
4351
+ } };
4352
+ }
4353
+ Object.defineProperty(o, k2, desc);
4229
4354
  } : function(o, m, k, k2) {
4230
4355
  if (k2 === void 0) k2 = k;
4231
4356
  o[k2] = m[k];
@@ -4249,10 +4374,40 @@ var require_lib = __commonJS({
4249
4374
  };
4250
4375
  Object.defineProperty(exports, "__esModule", { value: true });
4251
4376
  exports.z = void 0;
4252
- var z2 = __importStar(require_external());
4253
- exports.z = z2;
4377
+ var z = __importStar(require_external());
4378
+ exports.z = z;
4254
4379
  __exportStar(require_external(), exports);
4255
- exports.default = z2;
4380
+ exports.default = z;
4381
+ }
4382
+ });
4383
+
4384
+ // ../../node_modules/zod/dist/cjs/index.js
4385
+ var require_cjs = __commonJS({
4386
+ "../../node_modules/zod/dist/cjs/index.js"(exports) {
4387
+ "use strict";
4388
+ var __createBinding = exports && exports.__createBinding || (Object.create ? function(o, m, k, k2) {
4389
+ if (k2 === void 0) k2 = k;
4390
+ var desc = Object.getOwnPropertyDescriptor(m, k);
4391
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
4392
+ desc = { enumerable: true, get: function() {
4393
+ return m[k];
4394
+ } };
4395
+ }
4396
+ Object.defineProperty(o, k2, desc);
4397
+ } : function(o, m, k, k2) {
4398
+ if (k2 === void 0) k2 = k;
4399
+ o[k2] = m[k];
4400
+ });
4401
+ var __exportStar = exports && exports.__exportStar || function(m, exports2) {
4402
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports2, p)) __createBinding(exports2, m, p);
4403
+ };
4404
+ var __importDefault = exports && exports.__importDefault || function(mod) {
4405
+ return mod && mod.__esModule ? mod : { "default": mod };
4406
+ };
4407
+ Object.defineProperty(exports, "__esModule", { value: true });
4408
+ var index_js_1 = __importDefault(require_v3());
4409
+ __exportStar(require_v3(), exports);
4410
+ exports.default = index_js_1.default;
4256
4411
  }
4257
4412
  });
4258
4413
 
@@ -4275,7 +4430,7 @@ var require_array = __commonJS({
4275
4430
  "use strict";
4276
4431
  Object.defineProperty(exports, "__esModule", { value: true });
4277
4432
  exports.parseArrayDef = void 0;
4278
- var zod_1 = require_lib();
4433
+ var zod_1 = require_cjs();
4279
4434
  var errorMessages_js_1 = require_errorMessages();
4280
4435
  var parseDef_js_1 = require_parseDef();
4281
4436
  function parseArrayDef(def, refs) {
@@ -4907,7 +5062,7 @@ var require_record = __commonJS({
4907
5062
  "use strict";
4908
5063
  Object.defineProperty(exports, "__esModule", { value: true });
4909
5064
  exports.parseRecordDef = void 0;
4910
- var zod_1 = require_lib();
5065
+ var zod_1 = require_cjs();
4911
5066
  var parseDef_js_1 = require_parseDef();
4912
5067
  var string_js_1 = require_string();
4913
5068
  var branded_js_1 = require_branded();
@@ -5463,7 +5618,7 @@ var require_parseDef = __commonJS({
5463
5618
  "use strict";
5464
5619
  Object.defineProperty(exports, "__esModule", { value: true });
5465
5620
  exports.parseDef = void 0;
5466
- var zod_1 = require_lib();
5621
+ var zod_1 = require_cjs();
5467
5622
  var any_js_1 = require_any();
5468
5623
  var array_js_1 = require_array();
5469
5624
  var bigint_js_1 = require_bigint();
@@ -5681,7 +5836,7 @@ var require_zodToJsonSchema = __commonJS({
5681
5836
  });
5682
5837
 
5683
5838
  // ../../node_modules/zod-to-json-schema/dist/cjs/index.js
5684
- var require_cjs = __commonJS({
5839
+ var require_cjs2 = __commonJS({
5685
5840
  "../../node_modules/zod-to-json-schema/dist/cjs/index.js"(exports) {
5686
5841
  "use strict";
5687
5842
  var __createBinding = exports && exports.__createBinding || (Object.create ? function(o, m, k, k2) {
@@ -5747,7 +5902,7 @@ var require_zod_to_json = __commonJS({
5747
5902
  "use strict";
5748
5903
  Object.defineProperty(exports, "__esModule", { value: true });
5749
5904
  exports.convertZodToJsonSchema = void 0;
5750
- var zod_to_json_schema_1 = require_cjs();
5905
+ var zod_to_json_schema_1 = require_cjs2();
5751
5906
  var zodToJsonSchemaOptions = {
5752
5907
  target: "openApi3",
5753
5908
  $refStrategy: "none"
@@ -5961,7 +6116,7 @@ var require_dist = __commonJS({
5961
6116
  });
5962
6117
 
5963
6118
  // src/mocks/jwt.ts
5964
- import { createHmac } from "node:crypto";
6119
+ import { createHmac } from "crypto";
5965
6120
  var MOCKED_JWT_NAME = "toolkit@systemtest.dcs";
5966
6121
  var MOCKED_JWT_HEADER = btoa(JSON.stringify({ alg: "HS256" }));
5967
6122
  var MOCKED_JWT_PAYLOAD = btoa(JSON.stringify({ name: MOCKED_JWT_NAME }));
@@ -6000,10 +6155,123 @@ import { baseError } from "@myxtra/api";
6000
6155
  import "fastify";
6001
6156
  import fp2 from "fastify-plugin";
6002
6157
 
6003
- // ../../node_modules/zod/lib/index.mjs
6158
+ // ../../node_modules/zod/dist/esm/v3/external.js
6159
+ var external_exports = {};
6160
+ __export(external_exports, {
6161
+ BRAND: () => BRAND,
6162
+ DIRTY: () => DIRTY,
6163
+ EMPTY_PATH: () => EMPTY_PATH,
6164
+ INVALID: () => INVALID,
6165
+ NEVER: () => NEVER,
6166
+ OK: () => OK,
6167
+ ParseStatus: () => ParseStatus,
6168
+ Schema: () => ZodType,
6169
+ ZodAny: () => ZodAny,
6170
+ ZodArray: () => ZodArray,
6171
+ ZodBigInt: () => ZodBigInt,
6172
+ ZodBoolean: () => ZodBoolean,
6173
+ ZodBranded: () => ZodBranded,
6174
+ ZodCatch: () => ZodCatch,
6175
+ ZodDate: () => ZodDate,
6176
+ ZodDefault: () => ZodDefault,
6177
+ ZodDiscriminatedUnion: () => ZodDiscriminatedUnion,
6178
+ ZodEffects: () => ZodEffects,
6179
+ ZodEnum: () => ZodEnum,
6180
+ ZodError: () => ZodError,
6181
+ ZodFirstPartyTypeKind: () => ZodFirstPartyTypeKind,
6182
+ ZodFunction: () => ZodFunction,
6183
+ ZodIntersection: () => ZodIntersection,
6184
+ ZodIssueCode: () => ZodIssueCode,
6185
+ ZodLazy: () => ZodLazy,
6186
+ ZodLiteral: () => ZodLiteral,
6187
+ ZodMap: () => ZodMap,
6188
+ ZodNaN: () => ZodNaN,
6189
+ ZodNativeEnum: () => ZodNativeEnum,
6190
+ ZodNever: () => ZodNever,
6191
+ ZodNull: () => ZodNull,
6192
+ ZodNullable: () => ZodNullable,
6193
+ ZodNumber: () => ZodNumber,
6194
+ ZodObject: () => ZodObject,
6195
+ ZodOptional: () => ZodOptional,
6196
+ ZodParsedType: () => ZodParsedType,
6197
+ ZodPipeline: () => ZodPipeline,
6198
+ ZodPromise: () => ZodPromise,
6199
+ ZodReadonly: () => ZodReadonly,
6200
+ ZodRecord: () => ZodRecord,
6201
+ ZodSchema: () => ZodType,
6202
+ ZodSet: () => ZodSet,
6203
+ ZodString: () => ZodString,
6204
+ ZodSymbol: () => ZodSymbol,
6205
+ ZodTransformer: () => ZodEffects,
6206
+ ZodTuple: () => ZodTuple,
6207
+ ZodType: () => ZodType,
6208
+ ZodUndefined: () => ZodUndefined,
6209
+ ZodUnion: () => ZodUnion,
6210
+ ZodUnknown: () => ZodUnknown,
6211
+ ZodVoid: () => ZodVoid,
6212
+ addIssueToContext: () => addIssueToContext,
6213
+ any: () => anyType,
6214
+ array: () => arrayType,
6215
+ bigint: () => bigIntType,
6216
+ boolean: () => booleanType,
6217
+ coerce: () => coerce,
6218
+ custom: () => custom,
6219
+ date: () => dateType,
6220
+ datetimeRegex: () => datetimeRegex,
6221
+ defaultErrorMap: () => en_default,
6222
+ discriminatedUnion: () => discriminatedUnionType,
6223
+ effect: () => effectsType,
6224
+ enum: () => enumType,
6225
+ function: () => functionType,
6226
+ getErrorMap: () => getErrorMap,
6227
+ getParsedType: () => getParsedType,
6228
+ instanceof: () => instanceOfType,
6229
+ intersection: () => intersectionType,
6230
+ isAborted: () => isAborted,
6231
+ isAsync: () => isAsync,
6232
+ isDirty: () => isDirty,
6233
+ isValid: () => isValid,
6234
+ late: () => late,
6235
+ lazy: () => lazyType,
6236
+ literal: () => literalType,
6237
+ makeIssue: () => makeIssue,
6238
+ map: () => mapType,
6239
+ nan: () => nanType,
6240
+ nativeEnum: () => nativeEnumType,
6241
+ never: () => neverType,
6242
+ null: () => nullType,
6243
+ nullable: () => nullableType,
6244
+ number: () => numberType,
6245
+ object: () => objectType,
6246
+ objectUtil: () => objectUtil,
6247
+ oboolean: () => oboolean,
6248
+ onumber: () => onumber,
6249
+ optional: () => optionalType,
6250
+ ostring: () => ostring,
6251
+ pipeline: () => pipelineType,
6252
+ preprocess: () => preprocessType,
6253
+ promise: () => promiseType,
6254
+ quotelessJson: () => quotelessJson,
6255
+ record: () => recordType,
6256
+ set: () => setType,
6257
+ setErrorMap: () => setErrorMap,
6258
+ strictObject: () => strictObjectType,
6259
+ string: () => stringType,
6260
+ symbol: () => symbolType,
6261
+ transformer: () => effectsType,
6262
+ tuple: () => tupleType,
6263
+ undefined: () => undefinedType,
6264
+ union: () => unionType,
6265
+ unknown: () => unknownType,
6266
+ util: () => util,
6267
+ void: () => voidType
6268
+ });
6269
+
6270
+ // ../../node_modules/zod/dist/esm/v3/helpers/util.js
6004
6271
  var util;
6005
6272
  (function(util2) {
6006
- util2.assertEqual = (val) => val;
6273
+ util2.assertEqual = (_) => {
6274
+ };
6007
6275
  function assertIs(_arg) {
6008
6276
  }
6009
6277
  util2.assertIs = assertIs;
@@ -6047,7 +6315,7 @@ var util;
6047
6315
  }
6048
6316
  return void 0;
6049
6317
  };
6050
- util2.isInteger = typeof Number.isInteger === "function" ? (val) => Number.isInteger(val) : (val) => typeof val === "number" && isFinite(val) && Math.floor(val) === val;
6318
+ util2.isInteger = typeof Number.isInteger === "function" ? (val) => Number.isInteger(val) : (val) => typeof val === "number" && Number.isFinite(val) && Math.floor(val) === val;
6051
6319
  function joinValues(array, separator = " | ") {
6052
6320
  return array.map((val) => typeof val === "string" ? `'${val}'` : val).join(separator);
6053
6321
  }
@@ -6099,7 +6367,7 @@ var getParsedType = (data) => {
6099
6367
  case "string":
6100
6368
  return ZodParsedType.string;
6101
6369
  case "number":
6102
- return isNaN(data) ? ZodParsedType.nan : ZodParsedType.number;
6370
+ return Number.isNaN(data) ? ZodParsedType.nan : ZodParsedType.number;
6103
6371
  case "boolean":
6104
6372
  return ZodParsedType.boolean;
6105
6373
  case "function":
@@ -6132,6 +6400,8 @@ var getParsedType = (data) => {
6132
6400
  return ZodParsedType.unknown;
6133
6401
  }
6134
6402
  };
6403
+
6404
+ // ../../node_modules/zod/dist/esm/v3/ZodError.js
6135
6405
  var ZodIssueCode = util.arrayToEnum([
6136
6406
  "invalid_type",
6137
6407
  "invalid_literal",
@@ -6155,6 +6425,9 @@ var quotelessJson = (obj) => {
6155
6425
  return json.replace(/"([^"]+)":/g, "$1:");
6156
6426
  };
6157
6427
  var ZodError = class _ZodError extends Error {
6428
+ get errors() {
6429
+ return this.issues;
6430
+ }
6158
6431
  constructor(issues) {
6159
6432
  super();
6160
6433
  this.issues = [];
@@ -6173,9 +6446,6 @@ var ZodError = class _ZodError extends Error {
6173
6446
  this.name = "ZodError";
6174
6447
  this.issues = issues;
6175
6448
  }
6176
- get errors() {
6177
- return this.issues;
6178
- }
6179
6449
  format(_mapper) {
6180
6450
  const mapper = _mapper || function(issue) {
6181
6451
  return issue.message;
@@ -6247,6 +6517,8 @@ ZodError.create = (issues) => {
6247
6517
  const error = new ZodError(issues);
6248
6518
  return error;
6249
6519
  };
6520
+
6521
+ // ../../node_modules/zod/dist/esm/v3/locales/en.js
6250
6522
  var errorMap = (issue, _ctx) => {
6251
6523
  let message;
6252
6524
  switch (issue.code) {
@@ -6345,13 +6617,18 @@ var errorMap = (issue, _ctx) => {
6345
6617
  }
6346
6618
  return { message };
6347
6619
  };
6348
- var overrideErrorMap = errorMap;
6620
+ var en_default = errorMap;
6621
+
6622
+ // ../../node_modules/zod/dist/esm/v3/errors.js
6623
+ var overrideErrorMap = en_default;
6349
6624
  function setErrorMap(map) {
6350
6625
  overrideErrorMap = map;
6351
6626
  }
6352
6627
  function getErrorMap() {
6353
6628
  return overrideErrorMap;
6354
6629
  }
6630
+
6631
+ // ../../node_modules/zod/dist/esm/v3/helpers/parseUtil.js
6355
6632
  var makeIssue = (params) => {
6356
6633
  const { data, path, errorMaps, issueData } = params;
6357
6634
  const fullPath = [...path, ...issueData.path || []];
@@ -6386,9 +6663,12 @@ function addIssueToContext(ctx, issueData) {
6386
6663
  path: ctx.path,
6387
6664
  errorMaps: [
6388
6665
  ctx.common.contextualErrorMap,
6666
+ // contextual error map is first priority
6389
6667
  ctx.schemaErrorMap,
6668
+ // then schema-bound map if available
6390
6669
  overrideMap,
6391
- overrideMap === errorMap ? void 0 : errorMap
6670
+ // then global override map
6671
+ overrideMap === en_default ? void 0 : en_default
6392
6672
  // then global default map
6393
6673
  ].filter((x) => !!x)
6394
6674
  });
@@ -6457,24 +6737,15 @@ var isAborted = (x) => x.status === "aborted";
6457
6737
  var isDirty = (x) => x.status === "dirty";
6458
6738
  var isValid = (x) => x.status === "valid";
6459
6739
  var isAsync = (x) => typeof Promise !== "undefined" && x instanceof Promise;
6460
- function __classPrivateFieldGet(receiver, state, kind, f) {
6461
- if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter");
6462
- if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot read private member from an object whose class did not declare it");
6463
- return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
6464
- }
6465
- function __classPrivateFieldSet(receiver, state, value, kind, f) {
6466
- if (kind === "m") throw new TypeError("Private method is not writable");
6467
- if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a setter");
6468
- if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot write private member to an object whose class did not declare it");
6469
- return kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value), value;
6470
- }
6740
+
6741
+ // ../../node_modules/zod/dist/esm/v3/helpers/errorUtil.js
6471
6742
  var errorUtil;
6472
6743
  (function(errorUtil2) {
6473
6744
  errorUtil2.errToObj = (message) => typeof message === "string" ? { message } : message || {};
6474
- errorUtil2.toString = (message) => typeof message === "string" ? message : message === null || message === void 0 ? void 0 : message.message;
6745
+ errorUtil2.toString = (message) => typeof message === "string" ? message : message?.message;
6475
6746
  })(errorUtil || (errorUtil = {}));
6476
- var _ZodEnum_cache;
6477
- var _ZodNativeEnum_cache;
6747
+
6748
+ // ../../node_modules/zod/dist/esm/v3/types.js
6478
6749
  var ParseInputLazyPath = class {
6479
6750
  constructor(parent, value, path, key) {
6480
6751
  this._cachedPath = [];
@@ -6485,7 +6756,7 @@ var ParseInputLazyPath = class {
6485
6756
  }
6486
6757
  get path() {
6487
6758
  if (!this._cachedPath.length) {
6488
- if (this._key instanceof Array) {
6759
+ if (Array.isArray(this._key)) {
6489
6760
  this._cachedPath.push(...this._path, ...this._key);
6490
6761
  } else {
6491
6762
  this._cachedPath.push(...this._path, this._key);
@@ -6523,49 +6794,20 @@ function processCreateParams(params) {
6523
6794
  if (errorMap2)
6524
6795
  return { errorMap: errorMap2, description };
6525
6796
  const customMap = (iss, ctx) => {
6526
- var _a, _b;
6527
6797
  const { message } = params;
6528
6798
  if (iss.code === "invalid_enum_value") {
6529
- return { message: message !== null && message !== void 0 ? message : ctx.defaultError };
6799
+ return { message: message ?? ctx.defaultError };
6530
6800
  }
6531
6801
  if (typeof ctx.data === "undefined") {
6532
- return { message: (_a = message !== null && message !== void 0 ? message : required_error) !== null && _a !== void 0 ? _a : ctx.defaultError };
6802
+ return { message: message ?? required_error ?? ctx.defaultError };
6533
6803
  }
6534
6804
  if (iss.code !== "invalid_type")
6535
6805
  return { message: ctx.defaultError };
6536
- return { message: (_b = message !== null && message !== void 0 ? message : invalid_type_error) !== null && _b !== void 0 ? _b : ctx.defaultError };
6806
+ return { message: message ?? invalid_type_error ?? ctx.defaultError };
6537
6807
  };
6538
6808
  return { errorMap: customMap, description };
6539
6809
  }
6540
6810
  var ZodType = class {
6541
- constructor(def) {
6542
- this.spa = this.safeParseAsync;
6543
- this._def = def;
6544
- this.parse = this.parse.bind(this);
6545
- this.safeParse = this.safeParse.bind(this);
6546
- this.parseAsync = this.parseAsync.bind(this);
6547
- this.safeParseAsync = this.safeParseAsync.bind(this);
6548
- this.spa = this.spa.bind(this);
6549
- this.refine = this.refine.bind(this);
6550
- this.refinement = this.refinement.bind(this);
6551
- this.superRefine = this.superRefine.bind(this);
6552
- this.optional = this.optional.bind(this);
6553
- this.nullable = this.nullable.bind(this);
6554
- this.nullish = this.nullish.bind(this);
6555
- this.array = this.array.bind(this);
6556
- this.promise = this.promise.bind(this);
6557
- this.or = this.or.bind(this);
6558
- this.and = this.and.bind(this);
6559
- this.transform = this.transform.bind(this);
6560
- this.brand = this.brand.bind(this);
6561
- this.default = this.default.bind(this);
6562
- this.catch = this.catch.bind(this);
6563
- this.describe = this.describe.bind(this);
6564
- this.pipe = this.pipe.bind(this);
6565
- this.readonly = this.readonly.bind(this);
6566
- this.isNullable = this.isNullable.bind(this);
6567
- this.isOptional = this.isOptional.bind(this);
6568
- }
6569
6811
  get description() {
6570
6812
  return this._def.description;
6571
6813
  }
@@ -6613,14 +6855,13 @@ var ZodType = class {
6613
6855
  throw result.error;
6614
6856
  }
6615
6857
  safeParse(data, params) {
6616
- var _a;
6617
6858
  const ctx = {
6618
6859
  common: {
6619
6860
  issues: [],
6620
- async: (_a = params === null || params === void 0 ? void 0 : params.async) !== null && _a !== void 0 ? _a : false,
6621
- contextualErrorMap: params === null || params === void 0 ? void 0 : params.errorMap
6861
+ async: params?.async ?? false,
6862
+ contextualErrorMap: params?.errorMap
6622
6863
  },
6623
- path: (params === null || params === void 0 ? void 0 : params.path) || [],
6864
+ path: params?.path || [],
6624
6865
  schemaErrorMap: this._def.errorMap,
6625
6866
  parent: null,
6626
6867
  data,
@@ -6629,6 +6870,42 @@ var ZodType = class {
6629
6870
  const result = this._parseSync({ data, path: ctx.path, parent: ctx });
6630
6871
  return handleResult(ctx, result);
6631
6872
  }
6873
+ "~validate"(data) {
6874
+ const ctx = {
6875
+ common: {
6876
+ issues: [],
6877
+ async: !!this["~standard"].async
6878
+ },
6879
+ path: [],
6880
+ schemaErrorMap: this._def.errorMap,
6881
+ parent: null,
6882
+ data,
6883
+ parsedType: getParsedType(data)
6884
+ };
6885
+ if (!this["~standard"].async) {
6886
+ try {
6887
+ const result = this._parseSync({ data, path: [], parent: ctx });
6888
+ return isValid(result) ? {
6889
+ value: result.value
6890
+ } : {
6891
+ issues: ctx.common.issues
6892
+ };
6893
+ } catch (err) {
6894
+ if (err?.message?.toLowerCase()?.includes("encountered")) {
6895
+ this["~standard"].async = true;
6896
+ }
6897
+ ctx.common = {
6898
+ issues: [],
6899
+ async: true
6900
+ };
6901
+ }
6902
+ }
6903
+ return this._parseAsync({ data, path: [], parent: ctx }).then((result) => isValid(result) ? {
6904
+ value: result.value
6905
+ } : {
6906
+ issues: ctx.common.issues
6907
+ });
6908
+ }
6632
6909
  async parseAsync(data, params) {
6633
6910
  const result = await this.safeParseAsync(data, params);
6634
6911
  if (result.success)
@@ -6639,10 +6916,10 @@ var ZodType = class {
6639
6916
  const ctx = {
6640
6917
  common: {
6641
6918
  issues: [],
6642
- contextualErrorMap: params === null || params === void 0 ? void 0 : params.errorMap,
6919
+ contextualErrorMap: params?.errorMap,
6643
6920
  async: true
6644
6921
  },
6645
- path: (params === null || params === void 0 ? void 0 : params.path) || [],
6922
+ path: params?.path || [],
6646
6923
  schemaErrorMap: this._def.errorMap,
6647
6924
  parent: null,
6648
6925
  data,
@@ -6706,6 +6983,39 @@ var ZodType = class {
6706
6983
  superRefine(refinement) {
6707
6984
  return this._refinement(refinement);
6708
6985
  }
6986
+ constructor(def) {
6987
+ this.spa = this.safeParseAsync;
6988
+ this._def = def;
6989
+ this.parse = this.parse.bind(this);
6990
+ this.safeParse = this.safeParse.bind(this);
6991
+ this.parseAsync = this.parseAsync.bind(this);
6992
+ this.safeParseAsync = this.safeParseAsync.bind(this);
6993
+ this.spa = this.spa.bind(this);
6994
+ this.refine = this.refine.bind(this);
6995
+ this.refinement = this.refinement.bind(this);
6996
+ this.superRefine = this.superRefine.bind(this);
6997
+ this.optional = this.optional.bind(this);
6998
+ this.nullable = this.nullable.bind(this);
6999
+ this.nullish = this.nullish.bind(this);
7000
+ this.array = this.array.bind(this);
7001
+ this.promise = this.promise.bind(this);
7002
+ this.or = this.or.bind(this);
7003
+ this.and = this.and.bind(this);
7004
+ this.transform = this.transform.bind(this);
7005
+ this.brand = this.brand.bind(this);
7006
+ this.default = this.default.bind(this);
7007
+ this.catch = this.catch.bind(this);
7008
+ this.describe = this.describe.bind(this);
7009
+ this.pipe = this.pipe.bind(this);
7010
+ this.readonly = this.readonly.bind(this);
7011
+ this.isNullable = this.isNullable.bind(this);
7012
+ this.isOptional = this.isOptional.bind(this);
7013
+ this["~standard"] = {
7014
+ version: 1,
7015
+ vendor: "zod",
7016
+ validate: (data) => this["~validate"](data)
7017
+ };
7018
+ }
6709
7019
  optional() {
6710
7020
  return ZodOptional.create(this, this._def);
6711
7021
  }
@@ -6716,7 +7026,7 @@ var ZodType = class {
6716
7026
  return this.nullable().optional();
6717
7027
  }
6718
7028
  array() {
6719
- return ZodArray.create(this, this._def);
7029
+ return ZodArray.create(this);
6720
7030
  }
6721
7031
  promise() {
6722
7032
  return ZodPromise.create(this, this._def);
@@ -6782,26 +7092,31 @@ var ZodType = class {
6782
7092
  };
6783
7093
  var cuidRegex = /^c[^\s-]{8,}$/i;
6784
7094
  var cuid2Regex = /^[0-9a-z]+$/;
6785
- var ulidRegex = /^[0-9A-HJKMNP-TV-Z]{26}$/;
7095
+ var ulidRegex = /^[0-9A-HJKMNP-TV-Z]{26}$/i;
6786
7096
  var uuidRegex = /^[0-9a-fA-F]{8}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{12}$/i;
6787
7097
  var nanoidRegex = /^[a-z0-9_-]{21}$/i;
7098
+ var jwtRegex = /^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/;
6788
7099
  var durationRegex = /^[-+]?P(?!$)(?:(?:[-+]?\d+Y)|(?:[-+]?\d+[.,]\d+Y$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:(?:[-+]?\d+W)|(?:[-+]?\d+[.,]\d+W$))?(?:(?:[-+]?\d+D)|(?:[-+]?\d+[.,]\d+D$))?(?:T(?=[\d+-])(?:(?:[-+]?\d+H)|(?:[-+]?\d+[.,]\d+H$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:[-+]?\d+(?:[.,]\d+)?S)?)??$/;
6789
7100
  var emailRegex = /^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i;
6790
7101
  var _emojiRegex = `^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$`;
6791
7102
  var emojiRegex;
6792
7103
  var ipv4Regex = /^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])$/;
6793
- var ipv6Regex = /^(([a-f0-9]{1,4}:){7}|::([a-f0-9]{1,4}:){0,6}|([a-f0-9]{1,4}:){1}:([a-f0-9]{1,4}:){0,5}|([a-f0-9]{1,4}:){2}:([a-f0-9]{1,4}:){0,4}|([a-f0-9]{1,4}:){3}:([a-f0-9]{1,4}:){0,3}|([a-f0-9]{1,4}:){4}:([a-f0-9]{1,4}:){0,2}|([a-f0-9]{1,4}:){5}:([a-f0-9]{1,4}:){0,1})([a-f0-9]{1,4}|(((25[0-5])|(2[0-4][0-9])|(1[0-9]{2})|([0-9]{1,2}))\.){3}((25[0-5])|(2[0-4][0-9])|(1[0-9]{2})|([0-9]{1,2})))$/;
7104
+ var ipv4CidrRegex = /^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\/(3[0-2]|[12]?[0-9])$/;
7105
+ var ipv6Regex = /^(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))$/;
7106
+ var ipv6CidrRegex = /^(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/;
6794
7107
  var base64Regex = /^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/;
7108
+ var base64urlRegex = /^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/;
6795
7109
  var dateRegexSource = `((\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-((0[13578]|1[02])-(0[1-9]|[12]\\d|3[01])|(0[469]|11)-(0[1-9]|[12]\\d|30)|(02)-(0[1-9]|1\\d|2[0-8])))`;
6796
7110
  var dateRegex = new RegExp(`^${dateRegexSource}$`);
6797
7111
  function timeRegexSource(args) {
6798
- let regex = `([01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d`;
7112
+ let secondsRegexSource = `[0-5]\\d`;
6799
7113
  if (args.precision) {
6800
- regex = `${regex}\\.\\d{${args.precision}}`;
7114
+ secondsRegexSource = `${secondsRegexSource}\\.\\d{${args.precision}}`;
6801
7115
  } else if (args.precision == null) {
6802
- regex = `${regex}(\\.\\d+)?`;
7116
+ secondsRegexSource = `${secondsRegexSource}(\\.\\d+)?`;
6803
7117
  }
6804
- return regex;
7118
+ const secondsQuantifier = args.precision ? "+" : "?";
7119
+ return `([01]\\d|2[0-3]):[0-5]\\d(:${secondsRegexSource})${secondsQuantifier}`;
6805
7120
  }
6806
7121
  function timeRegex(args) {
6807
7122
  return new RegExp(`^${timeRegexSource(args)}$`);
@@ -6824,6 +7139,35 @@ function isValidIP(ip, version) {
6824
7139
  }
6825
7140
  return false;
6826
7141
  }
7142
+ function isValidJWT(jwt, alg) {
7143
+ if (!jwtRegex.test(jwt))
7144
+ return false;
7145
+ try {
7146
+ const [header] = jwt.split(".");
7147
+ const base64 = header.replace(/-/g, "+").replace(/_/g, "/").padEnd(header.length + (4 - header.length % 4) % 4, "=");
7148
+ const decoded = JSON.parse(atob(base64));
7149
+ if (typeof decoded !== "object" || decoded === null)
7150
+ return false;
7151
+ if ("typ" in decoded && decoded?.typ !== "JWT")
7152
+ return false;
7153
+ if (!decoded.alg)
7154
+ return false;
7155
+ if (alg && decoded.alg !== alg)
7156
+ return false;
7157
+ return true;
7158
+ } catch {
7159
+ return false;
7160
+ }
7161
+ }
7162
+ function isValidCidr(ip, version) {
7163
+ if ((version === "v4" || !version) && ipv4CidrRegex.test(ip)) {
7164
+ return true;
7165
+ }
7166
+ if ((version === "v6" || !version) && ipv6CidrRegex.test(ip)) {
7167
+ return true;
7168
+ }
7169
+ return false;
7170
+ }
6827
7171
  var ZodString = class _ZodString extends ZodType {
6828
7172
  _parse(input) {
6829
7173
  if (this._def.coerce) {
@@ -6970,7 +7314,7 @@ var ZodString = class _ZodString extends ZodType {
6970
7314
  } else if (check.kind === "url") {
6971
7315
  try {
6972
7316
  new URL(input.data);
6973
- } catch (_a) {
7317
+ } catch {
6974
7318
  ctx = this._getOrReturnCtx(input, ctx);
6975
7319
  addIssueToContext(ctx, {
6976
7320
  validation: "url",
@@ -7080,6 +7424,26 @@ var ZodString = class _ZodString extends ZodType {
7080
7424
  });
7081
7425
  status.dirty();
7082
7426
  }
7427
+ } else if (check.kind === "jwt") {
7428
+ if (!isValidJWT(input.data, check.alg)) {
7429
+ ctx = this._getOrReturnCtx(input, ctx);
7430
+ addIssueToContext(ctx, {
7431
+ validation: "jwt",
7432
+ code: ZodIssueCode.invalid_string,
7433
+ message: check.message
7434
+ });
7435
+ status.dirty();
7436
+ }
7437
+ } else if (check.kind === "cidr") {
7438
+ if (!isValidCidr(input.data, check.version)) {
7439
+ ctx = this._getOrReturnCtx(input, ctx);
7440
+ addIssueToContext(ctx, {
7441
+ validation: "cidr",
7442
+ code: ZodIssueCode.invalid_string,
7443
+ message: check.message
7444
+ });
7445
+ status.dirty();
7446
+ }
7083
7447
  } else if (check.kind === "base64") {
7084
7448
  if (!base64Regex.test(input.data)) {
7085
7449
  ctx = this._getOrReturnCtx(input, ctx);
@@ -7090,6 +7454,16 @@ var ZodString = class _ZodString extends ZodType {
7090
7454
  });
7091
7455
  status.dirty();
7092
7456
  }
7457
+ } else if (check.kind === "base64url") {
7458
+ if (!base64urlRegex.test(input.data)) {
7459
+ ctx = this._getOrReturnCtx(input, ctx);
7460
+ addIssueToContext(ctx, {
7461
+ validation: "base64url",
7462
+ code: ZodIssueCode.invalid_string,
7463
+ message: check.message
7464
+ });
7465
+ status.dirty();
7466
+ }
7093
7467
  } else {
7094
7468
  util.assertNever(check);
7095
7469
  }
@@ -7136,11 +7510,22 @@ var ZodString = class _ZodString extends ZodType {
7136
7510
  base64(message) {
7137
7511
  return this._addCheck({ kind: "base64", ...errorUtil.errToObj(message) });
7138
7512
  }
7513
+ base64url(message) {
7514
+ return this._addCheck({
7515
+ kind: "base64url",
7516
+ ...errorUtil.errToObj(message)
7517
+ });
7518
+ }
7519
+ jwt(options) {
7520
+ return this._addCheck({ kind: "jwt", ...errorUtil.errToObj(options) });
7521
+ }
7139
7522
  ip(options) {
7140
7523
  return this._addCheck({ kind: "ip", ...errorUtil.errToObj(options) });
7141
7524
  }
7525
+ cidr(options) {
7526
+ return this._addCheck({ kind: "cidr", ...errorUtil.errToObj(options) });
7527
+ }
7142
7528
  datetime(options) {
7143
- var _a, _b;
7144
7529
  if (typeof options === "string") {
7145
7530
  return this._addCheck({
7146
7531
  kind: "datetime",
@@ -7152,10 +7537,10 @@ var ZodString = class _ZodString extends ZodType {
7152
7537
  }
7153
7538
  return this._addCheck({
7154
7539
  kind: "datetime",
7155
- precision: typeof (options === null || options === void 0 ? void 0 : options.precision) === "undefined" ? null : options === null || options === void 0 ? void 0 : options.precision,
7156
- offset: (_a = options === null || options === void 0 ? void 0 : options.offset) !== null && _a !== void 0 ? _a : false,
7157
- local: (_b = options === null || options === void 0 ? void 0 : options.local) !== null && _b !== void 0 ? _b : false,
7158
- ...errorUtil.errToObj(options === null || options === void 0 ? void 0 : options.message)
7540
+ precision: typeof options?.precision === "undefined" ? null : options?.precision,
7541
+ offset: options?.offset ?? false,
7542
+ local: options?.local ?? false,
7543
+ ...errorUtil.errToObj(options?.message)
7159
7544
  });
7160
7545
  }
7161
7546
  date(message) {
@@ -7171,8 +7556,8 @@ var ZodString = class _ZodString extends ZodType {
7171
7556
  }
7172
7557
  return this._addCheck({
7173
7558
  kind: "time",
7174
- precision: typeof (options === null || options === void 0 ? void 0 : options.precision) === "undefined" ? null : options === null || options === void 0 ? void 0 : options.precision,
7175
- ...errorUtil.errToObj(options === null || options === void 0 ? void 0 : options.message)
7559
+ precision: typeof options?.precision === "undefined" ? null : options?.precision,
7560
+ ...errorUtil.errToObj(options?.message)
7176
7561
  });
7177
7562
  }
7178
7563
  duration(message) {
@@ -7189,8 +7574,8 @@ var ZodString = class _ZodString extends ZodType {
7189
7574
  return this._addCheck({
7190
7575
  kind: "includes",
7191
7576
  value,
7192
- position: options === null || options === void 0 ? void 0 : options.position,
7193
- ...errorUtil.errToObj(options === null || options === void 0 ? void 0 : options.message)
7577
+ position: options?.position,
7578
+ ...errorUtil.errToObj(options?.message)
7194
7579
  });
7195
7580
  }
7196
7581
  startsWith(value, message) {
@@ -7229,8 +7614,7 @@ var ZodString = class _ZodString extends ZodType {
7229
7614
  });
7230
7615
  }
7231
7616
  /**
7232
- * @deprecated Use z.string().min(1) instead.
7233
- * @see {@link ZodString.min}
7617
+ * Equivalent to `.min(1)`
7234
7618
  */
7235
7619
  nonempty(message) {
7236
7620
  return this.min(1, errorUtil.errToObj(message));
@@ -7292,9 +7676,15 @@ var ZodString = class _ZodString extends ZodType {
7292
7676
  get isIP() {
7293
7677
  return !!this._def.checks.find((ch) => ch.kind === "ip");
7294
7678
  }
7679
+ get isCIDR() {
7680
+ return !!this._def.checks.find((ch) => ch.kind === "cidr");
7681
+ }
7295
7682
  get isBase64() {
7296
7683
  return !!this._def.checks.find((ch) => ch.kind === "base64");
7297
7684
  }
7685
+ get isBase64url() {
7686
+ return !!this._def.checks.find((ch) => ch.kind === "base64url");
7687
+ }
7298
7688
  get minLength() {
7299
7689
  let min = null;
7300
7690
  for (const ch of this._def.checks) {
@@ -7317,11 +7707,10 @@ var ZodString = class _ZodString extends ZodType {
7317
7707
  }
7318
7708
  };
7319
7709
  ZodString.create = (params) => {
7320
- var _a;
7321
7710
  return new ZodString({
7322
7711
  checks: [],
7323
7712
  typeName: ZodFirstPartyTypeKind.ZodString,
7324
- coerce: (_a = params === null || params === void 0 ? void 0 : params.coerce) !== null && _a !== void 0 ? _a : false,
7713
+ coerce: params?.coerce ?? false,
7325
7714
  ...processCreateParams(params)
7326
7715
  });
7327
7716
  };
@@ -7329,9 +7718,9 @@ function floatSafeRemainder(val, step) {
7329
7718
  const valDecCount = (val.toString().split(".")[1] || "").length;
7330
7719
  const stepDecCount = (step.toString().split(".")[1] || "").length;
7331
7720
  const decCount = valDecCount > stepDecCount ? valDecCount : stepDecCount;
7332
- const valInt = parseInt(val.toFixed(decCount).replace(".", ""));
7333
- const stepInt = parseInt(step.toFixed(decCount).replace(".", ""));
7334
- return valInt % stepInt / Math.pow(10, decCount);
7721
+ const valInt = Number.parseInt(val.toFixed(decCount).replace(".", ""));
7722
+ const stepInt = Number.parseInt(step.toFixed(decCount).replace(".", ""));
7723
+ return valInt % stepInt / 10 ** decCount;
7335
7724
  }
7336
7725
  var ZodNumber = class _ZodNumber extends ZodType {
7337
7726
  constructor() {
@@ -7541,7 +7930,8 @@ var ZodNumber = class _ZodNumber extends ZodType {
7541
7930
  return !!this._def.checks.find((ch) => ch.kind === "int" || ch.kind === "multipleOf" && util.isInteger(ch.value));
7542
7931
  }
7543
7932
  get isFinite() {
7544
- let max = null, min = null;
7933
+ let max = null;
7934
+ let min = null;
7545
7935
  for (const ch of this._def.checks) {
7546
7936
  if (ch.kind === "finite" || ch.kind === "int" || ch.kind === "multipleOf") {
7547
7937
  return true;
@@ -7560,7 +7950,7 @@ ZodNumber.create = (params) => {
7560
7950
  return new ZodNumber({
7561
7951
  checks: [],
7562
7952
  typeName: ZodFirstPartyTypeKind.ZodNumber,
7563
- coerce: (params === null || params === void 0 ? void 0 : params.coerce) || false,
7953
+ coerce: params?.coerce || false,
7564
7954
  ...processCreateParams(params)
7565
7955
  });
7566
7956
  };
@@ -7572,17 +7962,15 @@ var ZodBigInt = class _ZodBigInt extends ZodType {
7572
7962
  }
7573
7963
  _parse(input) {
7574
7964
  if (this._def.coerce) {
7575
- input.data = BigInt(input.data);
7965
+ try {
7966
+ input.data = BigInt(input.data);
7967
+ } catch {
7968
+ return this._getInvalidInput(input);
7969
+ }
7576
7970
  }
7577
7971
  const parsedType = this._getType(input);
7578
7972
  if (parsedType !== ZodParsedType.bigint) {
7579
- const ctx2 = this._getOrReturnCtx(input);
7580
- addIssueToContext(ctx2, {
7581
- code: ZodIssueCode.invalid_type,
7582
- expected: ZodParsedType.bigint,
7583
- received: ctx2.parsedType
7584
- });
7585
- return INVALID;
7973
+ return this._getInvalidInput(input);
7586
7974
  }
7587
7975
  let ctx = void 0;
7588
7976
  const status = new ParseStatus();
@@ -7629,6 +8017,15 @@ var ZodBigInt = class _ZodBigInt extends ZodType {
7629
8017
  }
7630
8018
  return { status: status.value, value: input.data };
7631
8019
  }
8020
+ _getInvalidInput(input) {
8021
+ const ctx = this._getOrReturnCtx(input);
8022
+ addIssueToContext(ctx, {
8023
+ code: ZodIssueCode.invalid_type,
8024
+ expected: ZodParsedType.bigint,
8025
+ received: ctx.parsedType
8026
+ });
8027
+ return INVALID;
8028
+ }
7632
8029
  gte(value, message) {
7633
8030
  return this.setLimit("min", value, true, errorUtil.toString(message));
7634
8031
  }
@@ -7722,11 +8119,10 @@ var ZodBigInt = class _ZodBigInt extends ZodType {
7722
8119
  }
7723
8120
  };
7724
8121
  ZodBigInt.create = (params) => {
7725
- var _a;
7726
8122
  return new ZodBigInt({
7727
8123
  checks: [],
7728
8124
  typeName: ZodFirstPartyTypeKind.ZodBigInt,
7729
- coerce: (_a = params === null || params === void 0 ? void 0 : params.coerce) !== null && _a !== void 0 ? _a : false,
8125
+ coerce: params?.coerce ?? false,
7730
8126
  ...processCreateParams(params)
7731
8127
  });
7732
8128
  };
@@ -7751,7 +8147,7 @@ var ZodBoolean = class extends ZodType {
7751
8147
  ZodBoolean.create = (params) => {
7752
8148
  return new ZodBoolean({
7753
8149
  typeName: ZodFirstPartyTypeKind.ZodBoolean,
7754
- coerce: (params === null || params === void 0 ? void 0 : params.coerce) || false,
8150
+ coerce: params?.coerce || false,
7755
8151
  ...processCreateParams(params)
7756
8152
  });
7757
8153
  };
@@ -7770,7 +8166,7 @@ var ZodDate = class _ZodDate extends ZodType {
7770
8166
  });
7771
8167
  return INVALID;
7772
8168
  }
7773
- if (isNaN(input.data.getTime())) {
8169
+ if (Number.isNaN(input.data.getTime())) {
7774
8170
  const ctx2 = this._getOrReturnCtx(input);
7775
8171
  addIssueToContext(ctx2, {
7776
8172
  code: ZodIssueCode.invalid_date
@@ -7859,7 +8255,7 @@ var ZodDate = class _ZodDate extends ZodType {
7859
8255
  ZodDate.create = (params) => {
7860
8256
  return new ZodDate({
7861
8257
  checks: [],
7862
- coerce: (params === null || params === void 0 ? void 0 : params.coerce) || false,
8258
+ coerce: params?.coerce || false,
7863
8259
  typeName: ZodFirstPartyTypeKind.ZodDate,
7864
8260
  ...processCreateParams(params)
7865
8261
  });
@@ -8134,7 +8530,8 @@ var ZodObject = class _ZodObject extends ZodType {
8134
8530
  return this._cached;
8135
8531
  const shape = this._def.shape();
8136
8532
  const keys = util.objectKeys(shape);
8137
- return this._cached = { shape, keys };
8533
+ this._cached = { shape, keys };
8534
+ return this._cached;
8138
8535
  }
8139
8536
  _parse(input) {
8140
8537
  const parsedType = this._getType(input);
@@ -8184,8 +8581,8 @@ var ZodObject = class _ZodObject extends ZodType {
8184
8581
  });
8185
8582
  status.dirty();
8186
8583
  }
8187
- } else if (unknownKeys === "strip") ;
8188
- else {
8584
+ } else if (unknownKeys === "strip") {
8585
+ } else {
8189
8586
  throw new Error(`Internal ZodObject error: invalid unknownKeys value.`);
8190
8587
  }
8191
8588
  } else {
@@ -8232,11 +8629,10 @@ var ZodObject = class _ZodObject extends ZodType {
8232
8629
  unknownKeys: "strict",
8233
8630
  ...message !== void 0 ? {
8234
8631
  errorMap: (issue, ctx) => {
8235
- var _a, _b, _c, _d;
8236
- 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;
8632
+ const defaultError = this._def.errorMap?.(issue, ctx).message ?? ctx.defaultError;
8237
8633
  if (issue.code === "unrecognized_keys")
8238
8634
  return {
8239
- message: (_d = errorUtil.errToObj(message).message) !== null && _d !== void 0 ? _d : defaultError
8635
+ message: errorUtil.errToObj(message).message ?? defaultError
8240
8636
  };
8241
8637
  return {
8242
8638
  message: defaultError
@@ -8367,11 +8763,11 @@ var ZodObject = class _ZodObject extends ZodType {
8367
8763
  }
8368
8764
  pick(mask) {
8369
8765
  const shape = {};
8370
- util.objectKeys(mask).forEach((key) => {
8766
+ for (const key of util.objectKeys(mask)) {
8371
8767
  if (mask[key] && this.shape[key]) {
8372
8768
  shape[key] = this.shape[key];
8373
8769
  }
8374
- });
8770
+ }
8375
8771
  return new _ZodObject({
8376
8772
  ...this._def,
8377
8773
  shape: () => shape
@@ -8379,11 +8775,11 @@ var ZodObject = class _ZodObject extends ZodType {
8379
8775
  }
8380
8776
  omit(mask) {
8381
8777
  const shape = {};
8382
- util.objectKeys(this.shape).forEach((key) => {
8778
+ for (const key of util.objectKeys(this.shape)) {
8383
8779
  if (!mask[key]) {
8384
8780
  shape[key] = this.shape[key];
8385
8781
  }
8386
- });
8782
+ }
8387
8783
  return new _ZodObject({
8388
8784
  ...this._def,
8389
8785
  shape: () => shape
@@ -8397,14 +8793,14 @@ var ZodObject = class _ZodObject extends ZodType {
8397
8793
  }
8398
8794
  partial(mask) {
8399
8795
  const newShape = {};
8400
- util.objectKeys(this.shape).forEach((key) => {
8796
+ for (const key of util.objectKeys(this.shape)) {
8401
8797
  const fieldSchema = this.shape[key];
8402
8798
  if (mask && !mask[key]) {
8403
8799
  newShape[key] = fieldSchema;
8404
8800
  } else {
8405
8801
  newShape[key] = fieldSchema.optional();
8406
8802
  }
8407
- });
8803
+ }
8408
8804
  return new _ZodObject({
8409
8805
  ...this._def,
8410
8806
  shape: () => newShape
@@ -8412,7 +8808,7 @@ var ZodObject = class _ZodObject extends ZodType {
8412
8808
  }
8413
8809
  required(mask) {
8414
8810
  const newShape = {};
8415
- util.objectKeys(this.shape).forEach((key) => {
8811
+ for (const key of util.objectKeys(this.shape)) {
8416
8812
  if (mask && !mask[key]) {
8417
8813
  newShape[key] = this.shape[key];
8418
8814
  } else {
@@ -8423,7 +8819,7 @@ var ZodObject = class _ZodObject extends ZodType {
8423
8819
  }
8424
8820
  newShape[key] = newField;
8425
8821
  }
8426
- });
8822
+ }
8427
8823
  return new _ZodObject({
8428
8824
  ...this._def,
8429
8825
  shape: () => newShape
@@ -9039,12 +9435,7 @@ var ZodFunction = class _ZodFunction extends ZodType {
9039
9435
  return makeIssue({
9040
9436
  data: args,
9041
9437
  path: ctx.path,
9042
- errorMaps: [
9043
- ctx.common.contextualErrorMap,
9044
- ctx.schemaErrorMap,
9045
- getErrorMap(),
9046
- errorMap
9047
- ].filter((x) => !!x),
9438
+ errorMaps: [ctx.common.contextualErrorMap, ctx.schemaErrorMap, getErrorMap(), en_default].filter((x) => !!x),
9048
9439
  issueData: {
9049
9440
  code: ZodIssueCode.invalid_arguments,
9050
9441
  argumentsError: error
@@ -9055,12 +9446,7 @@ var ZodFunction = class _ZodFunction extends ZodType {
9055
9446
  return makeIssue({
9056
9447
  data: returns,
9057
9448
  path: ctx.path,
9058
- errorMaps: [
9059
- ctx.common.contextualErrorMap,
9060
- ctx.schemaErrorMap,
9061
- getErrorMap(),
9062
- errorMap
9063
- ].filter((x) => !!x),
9449
+ errorMaps: [ctx.common.contextualErrorMap, ctx.schemaErrorMap, getErrorMap(), en_default].filter((x) => !!x),
9064
9450
  issueData: {
9065
9451
  code: ZodIssueCode.invalid_return_type,
9066
9452
  returnTypeError: error
@@ -9184,10 +9570,6 @@ function createZodEnum(values, params) {
9184
9570
  });
9185
9571
  }
9186
9572
  var ZodEnum = class _ZodEnum extends ZodType {
9187
- constructor() {
9188
- super(...arguments);
9189
- _ZodEnum_cache.set(this, void 0);
9190
- }
9191
9573
  _parse(input) {
9192
9574
  if (typeof input.data !== "string") {
9193
9575
  const ctx = this._getOrReturnCtx(input);
@@ -9199,10 +9581,10 @@ var ZodEnum = class _ZodEnum extends ZodType {
9199
9581
  });
9200
9582
  return INVALID;
9201
9583
  }
9202
- if (!__classPrivateFieldGet(this, _ZodEnum_cache, "f")) {
9203
- __classPrivateFieldSet(this, _ZodEnum_cache, new Set(this._def.values), "f");
9584
+ if (!this._cache) {
9585
+ this._cache = new Set(this._def.values);
9204
9586
  }
9205
- if (!__classPrivateFieldGet(this, _ZodEnum_cache, "f").has(input.data)) {
9587
+ if (!this._cache.has(input.data)) {
9206
9588
  const ctx = this._getOrReturnCtx(input);
9207
9589
  const expectedValues = this._def.values;
9208
9590
  addIssueToContext(ctx, {
@@ -9251,13 +9633,8 @@ var ZodEnum = class _ZodEnum extends ZodType {
9251
9633
  });
9252
9634
  }
9253
9635
  };
9254
- _ZodEnum_cache = /* @__PURE__ */ new WeakMap();
9255
9636
  ZodEnum.create = createZodEnum;
9256
9637
  var ZodNativeEnum = class extends ZodType {
9257
- constructor() {
9258
- super(...arguments);
9259
- _ZodNativeEnum_cache.set(this, void 0);
9260
- }
9261
9638
  _parse(input) {
9262
9639
  const nativeEnumValues = util.getValidEnumValues(this._def.values);
9263
9640
  const ctx = this._getOrReturnCtx(input);
@@ -9270,10 +9647,10 @@ var ZodNativeEnum = class extends ZodType {
9270
9647
  });
9271
9648
  return INVALID;
9272
9649
  }
9273
- if (!__classPrivateFieldGet(this, _ZodNativeEnum_cache, "f")) {
9274
- __classPrivateFieldSet(this, _ZodNativeEnum_cache, new Set(util.getValidEnumValues(this._def.values)), "f");
9650
+ if (!this._cache) {
9651
+ this._cache = new Set(util.getValidEnumValues(this._def.values));
9275
9652
  }
9276
- if (!__classPrivateFieldGet(this, _ZodNativeEnum_cache, "f").has(input.data)) {
9653
+ if (!this._cache.has(input.data)) {
9277
9654
  const expectedValues = util.objectValues(nativeEnumValues);
9278
9655
  addIssueToContext(ctx, {
9279
9656
  received: ctx.data,
@@ -9288,7 +9665,6 @@ var ZodNativeEnum = class extends ZodType {
9288
9665
  return this._def.values;
9289
9666
  }
9290
9667
  };
9291
- _ZodNativeEnum_cache = /* @__PURE__ */ new WeakMap();
9292
9668
  ZodNativeEnum.create = (values, params) => {
9293
9669
  return new ZodNativeEnum({
9294
9670
  values,
@@ -9429,7 +9805,7 @@ var ZodEffects = class extends ZodType {
9429
9805
  parent: ctx
9430
9806
  });
9431
9807
  if (!isValid(base))
9432
- return base;
9808
+ return INVALID;
9433
9809
  const result = effect.transform(base.value, checkCtx);
9434
9810
  if (result instanceof Promise) {
9435
9811
  throw new Error(`Asynchronous transform encountered during synchronous parse operation. Use .parseAsync instead.`);
@@ -9438,8 +9814,11 @@ var ZodEffects = class extends ZodType {
9438
9814
  } else {
9439
9815
  return this._def.schema._parseAsync({ data: ctx.data, path: ctx.path, parent: ctx }).then((base) => {
9440
9816
  if (!isValid(base))
9441
- return base;
9442
- return Promise.resolve(effect.transform(base.value, checkCtx)).then((result) => ({ status: status.value, value: result }));
9817
+ return INVALID;
9818
+ return Promise.resolve(effect.transform(base.value, checkCtx)).then((result) => ({
9819
+ status: status.value,
9820
+ value: result
9821
+ }));
9443
9822
  });
9444
9823
  }
9445
9824
  }
@@ -9691,16 +10070,30 @@ ZodReadonly.create = (type, params) => {
9691
10070
  ...processCreateParams(params)
9692
10071
  });
9693
10072
  };
9694
- function custom(check, params = {}, fatal) {
10073
+ function cleanParams(params, data) {
10074
+ const p = typeof params === "function" ? params(data) : typeof params === "string" ? { message: params } : params;
10075
+ const p2 = typeof p === "string" ? { message: p } : p;
10076
+ return p2;
10077
+ }
10078
+ function custom(check, _params = {}, fatal) {
9695
10079
  if (check)
9696
10080
  return ZodAny.create().superRefine((data, ctx) => {
9697
- var _a, _b;
9698
- if (!check(data)) {
9699
- const p = typeof params === "function" ? params(data) : typeof params === "string" ? { message: params } : params;
9700
- const _fatal = (_b = (_a = p.fatal) !== null && _a !== void 0 ? _a : fatal) !== null && _b !== void 0 ? _b : true;
9701
- const p2 = typeof p === "string" ? { message: p } : p;
9702
- ctx.addIssue({ code: "custom", ...p2, fatal: _fatal });
10081
+ const r = check(data);
10082
+ if (r instanceof Promise) {
10083
+ return r.then((r2) => {
10084
+ if (!r2) {
10085
+ const params = cleanParams(_params, data);
10086
+ const _fatal = params.fatal ?? fatal ?? true;
10087
+ ctx.addIssue({ code: "custom", ...params, fatal: _fatal });
10088
+ }
10089
+ });
9703
10090
  }
10091
+ if (!r) {
10092
+ const params = cleanParams(_params, data);
10093
+ const _fatal = params.fatal ?? fatal ?? true;
10094
+ ctx.addIssue({ code: "custom", ...params, fatal: _fatal });
10095
+ }
10096
+ return;
9704
10097
  });
9705
10098
  return ZodAny.create();
9706
10099
  }
@@ -9797,128 +10190,12 @@ var coerce = {
9797
10190
  date: (arg) => ZodDate.create({ ...arg, coerce: true })
9798
10191
  };
9799
10192
  var NEVER = INVALID;
9800
- var z = /* @__PURE__ */ Object.freeze({
9801
- __proto__: null,
9802
- defaultErrorMap: errorMap,
9803
- setErrorMap,
9804
- getErrorMap,
9805
- makeIssue,
9806
- EMPTY_PATH,
9807
- addIssueToContext,
9808
- ParseStatus,
9809
- INVALID,
9810
- DIRTY,
9811
- OK,
9812
- isAborted,
9813
- isDirty,
9814
- isValid,
9815
- isAsync,
9816
- get util() {
9817
- return util;
9818
- },
9819
- get objectUtil() {
9820
- return objectUtil;
9821
- },
9822
- ZodParsedType,
9823
- getParsedType,
9824
- ZodType,
9825
- datetimeRegex,
9826
- ZodString,
9827
- ZodNumber,
9828
- ZodBigInt,
9829
- ZodBoolean,
9830
- ZodDate,
9831
- ZodSymbol,
9832
- ZodUndefined,
9833
- ZodNull,
9834
- ZodAny,
9835
- ZodUnknown,
9836
- ZodNever,
9837
- ZodVoid,
9838
- ZodArray,
9839
- ZodObject,
9840
- ZodUnion,
9841
- ZodDiscriminatedUnion,
9842
- ZodIntersection,
9843
- ZodTuple,
9844
- ZodRecord,
9845
- ZodMap,
9846
- ZodSet,
9847
- ZodFunction,
9848
- ZodLazy,
9849
- ZodLiteral,
9850
- ZodEnum,
9851
- ZodNativeEnum,
9852
- ZodPromise,
9853
- ZodEffects,
9854
- ZodTransformer: ZodEffects,
9855
- ZodOptional,
9856
- ZodNullable,
9857
- ZodDefault,
9858
- ZodCatch,
9859
- ZodNaN,
9860
- BRAND,
9861
- ZodBranded,
9862
- ZodPipeline,
9863
- ZodReadonly,
9864
- custom,
9865
- Schema: ZodType,
9866
- ZodSchema: ZodType,
9867
- late,
9868
- get ZodFirstPartyTypeKind() {
9869
- return ZodFirstPartyTypeKind;
9870
- },
9871
- coerce,
9872
- any: anyType,
9873
- array: arrayType,
9874
- bigint: bigIntType,
9875
- boolean: booleanType,
9876
- date: dateType,
9877
- discriminatedUnion: discriminatedUnionType,
9878
- effect: effectsType,
9879
- "enum": enumType,
9880
- "function": functionType,
9881
- "instanceof": instanceOfType,
9882
- intersection: intersectionType,
9883
- lazy: lazyType,
9884
- literal: literalType,
9885
- map: mapType,
9886
- nan: nanType,
9887
- nativeEnum: nativeEnumType,
9888
- never: neverType,
9889
- "null": nullType,
9890
- nullable: nullableType,
9891
- number: numberType,
9892
- object: objectType,
9893
- oboolean,
9894
- onumber,
9895
- optional: optionalType,
9896
- ostring,
9897
- pipeline: pipelineType,
9898
- preprocess: preprocessType,
9899
- promise: promiseType,
9900
- record: recordType,
9901
- set: setType,
9902
- strictObject: strictObjectType,
9903
- string: stringType,
9904
- symbol: symbolType,
9905
- transformer: effectsType,
9906
- tuple: tupleType,
9907
- "undefined": undefinedType,
9908
- union: unionType,
9909
- unknown: unknownType,
9910
- "void": voidType,
9911
- NEVER,
9912
- ZodIssueCode,
9913
- quotelessJson,
9914
- ZodError
9915
- });
9916
10193
 
9917
10194
  // src/plugins/zod.ts
9918
10195
  var validationError = baseError.extend({
9919
- problemJson: z.object({
9920
- formErrors: z.array(z.string()),
9921
- fieldErrors: z.record(z.array(z.string()))
10196
+ problemJson: external_exports.object({
10197
+ formErrors: external_exports.array(external_exports.string()),
10198
+ fieldErrors: external_exports.record(external_exports.array(external_exports.string()))
9922
10199
  })
9923
10200
  });
9924
10201
  var zod = (app, options, done) => {