zod 4.1.12 → 4.1.13

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (82) hide show
  1. package/package.json +1 -1
  2. package/src/v4/classic/checks.ts +1 -0
  3. package/src/v4/classic/schemas.ts +20 -0
  4. package/src/v4/classic/tests/continuability.test.ts +22 -0
  5. package/src/v4/classic/tests/describe-meta-checks.test.ts +27 -0
  6. package/src/v4/classic/tests/index.test.ts +55 -1
  7. package/src/v4/classic/tests/promise.test.ts +1 -1
  8. package/src/v4/classic/tests/readonly.test.ts +1 -1
  9. package/src/v4/classic/tests/record.test.ts +141 -9
  10. package/src/v4/classic/tests/registries.test.ts +5 -1
  11. package/src/v4/classic/tests/string.test.ts +72 -0
  12. package/src/v4/classic/tests/template-literal.test.ts +8 -0
  13. package/src/v4/classic/tests/to-json-schema.test.ts +97 -0
  14. package/src/v4/classic/tests/tuple.test.ts +18 -0
  15. package/src/v4/classic/tests/url.test.ts +13 -0
  16. package/src/v4/core/api.ts +45 -0
  17. package/src/v4/core/core.ts +22 -9
  18. package/src/v4/core/regexes.ts +6 -1
  19. package/src/v4/core/registries.ts +12 -1
  20. package/src/v4/core/schemas.ts +50 -33
  21. package/src/v4/core/tests/extend.test.ts +42 -1
  22. package/src/v4/core/tests/locales/he.test.ts +379 -0
  23. package/src/v4/core/tests/locales/nl.test.ts +46 -0
  24. package/src/v4/core/tests/record-constructor.test.ts +67 -0
  25. package/src/v4/core/tests/recursive-tuples.test.ts +45 -0
  26. package/src/v4/core/to-json-schema.ts +55 -91
  27. package/src/v4/core/util.ts +11 -0
  28. package/src/v4/core/versions.ts +1 -1
  29. package/src/v4/locales/en.ts +1 -0
  30. package/src/v4/locales/he.ts +202 -71
  31. package/src/v4/locales/nl.ts +10 -10
  32. package/src/v4/mini/iso.ts +4 -4
  33. package/src/v4/mini/schemas.ts +17 -0
  34. package/src/v4/mini/tests/functions.test.ts +0 -38
  35. package/src/v4/mini/tests/index.test.ts +24 -1
  36. package/src/v4/mini/tests/string.test.ts +32 -0
  37. package/v3/ZodError.d.cts +1 -1
  38. package/v3/ZodError.d.ts +1 -1
  39. package/v4/classic/checks.cjs +2 -1
  40. package/v4/classic/checks.d.cts +1 -1
  41. package/v4/classic/checks.d.ts +1 -1
  42. package/v4/classic/checks.js +1 -1
  43. package/v4/classic/schemas.cjs +15 -2
  44. package/v4/classic/schemas.d.cts +8 -0
  45. package/v4/classic/schemas.d.ts +8 -0
  46. package/v4/classic/schemas.js +12 -0
  47. package/v4/core/api.cjs +40 -0
  48. package/v4/core/api.d.cts +7 -0
  49. package/v4/core/api.d.ts +7 -0
  50. package/v4/core/api.js +36 -0
  51. package/v4/core/core.cjs +20 -11
  52. package/v4/core/core.js +20 -11
  53. package/v4/core/regexes.cjs +31 -2
  54. package/v4/core/regexes.d.cts +1 -0
  55. package/v4/core/regexes.d.ts +1 -0
  56. package/v4/core/regexes.js +5 -0
  57. package/v4/core/registries.cjs +3 -1
  58. package/v4/core/registries.js +3 -1
  59. package/v4/core/schemas.cjs +32 -33
  60. package/v4/core/schemas.d.cts +12 -2
  61. package/v4/core/schemas.d.ts +12 -2
  62. package/v4/core/schemas.js +30 -31
  63. package/v4/core/to-json-schema.cjs +55 -92
  64. package/v4/core/to-json-schema.js +55 -92
  65. package/v4/core/util.cjs +11 -0
  66. package/v4/core/util.d.cts +1 -0
  67. package/v4/core/util.d.ts +1 -0
  68. package/v4/core/util.js +10 -0
  69. package/v4/core/versions.cjs +1 -1
  70. package/v4/core/versions.js +1 -1
  71. package/v4/locales/en.cjs +1 -0
  72. package/v4/locales/en.js +1 -0
  73. package/v4/locales/he.cjs +177 -66
  74. package/v4/locales/he.js +177 -66
  75. package/v4/locales/nl.cjs +8 -8
  76. package/v4/locales/nl.js +8 -8
  77. package/v4/mini/iso.cjs +4 -4
  78. package/v4/mini/iso.js +4 -4
  79. package/v4/mini/schemas.cjs +13 -2
  80. package/v4/mini/schemas.d.cts +6 -0
  81. package/v4/mini/schemas.d.ts +6 -0
  82. package/v4/mini/schemas.js +10 -0
@@ -1,10 +1,34 @@
1
1
  "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
15
+ }) : function(o, v) {
16
+ o["default"] = v;
17
+ });
18
+ var __importStar = (this && this.__importStar) || function (mod) {
19
+ if (mod && mod.__esModule) return mod;
20
+ var result = {};
21
+ if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
22
+ __setModuleDefault(result, mod);
23
+ return result;
24
+ };
2
25
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.sha384_base64 = exports.sha384_hex = exports.sha256_base64url = exports.sha256_base64 = exports.sha256_hex = exports.sha1_base64url = exports.sha1_base64 = exports.sha1_hex = exports.md5_base64url = exports.md5_base64 = exports.md5_hex = exports.hex = exports.uppercase = exports.lowercase = exports.undefined = exports.null = exports.boolean = exports.number = exports.integer = exports.bigint = exports.string = exports.date = exports.e164 = exports.domain = exports.hostname = exports.base64url = exports.base64 = exports.cidrv6 = exports.cidrv4 = exports.ipv6 = exports.ipv4 = exports.browserEmail = exports.idnEmail = exports.unicodeEmail = exports.rfc5322Email = exports.html5Email = exports.email = exports.uuid7 = exports.uuid6 = exports.uuid4 = exports.uuid = exports.guid = exports.extendedDuration = exports.duration = exports.nanoid = exports.ksuid = exports.xid = exports.ulid = exports.cuid2 = exports.cuid = void 0;
4
- exports.sha512_base64url = exports.sha512_base64 = exports.sha512_hex = exports.sha384_base64url = void 0;
26
+ exports.sha384_hex = exports.sha256_base64url = exports.sha256_base64 = exports.sha256_hex = exports.sha1_base64url = exports.sha1_base64 = exports.sha1_hex = exports.md5_base64url = exports.md5_base64 = exports.md5_hex = exports.hex = exports.uppercase = exports.lowercase = exports.undefined = exports.null = exports.boolean = exports.number = exports.integer = exports.bigint = exports.string = exports.date = exports.e164 = exports.domain = exports.hostname = exports.base64url = exports.base64 = exports.cidrv6 = exports.cidrv4 = exports.mac = exports.ipv6 = exports.ipv4 = exports.browserEmail = exports.idnEmail = exports.unicodeEmail = exports.rfc5322Email = exports.html5Email = exports.email = exports.uuid7 = exports.uuid6 = exports.uuid4 = exports.uuid = exports.guid = exports.extendedDuration = exports.duration = exports.nanoid = exports.ksuid = exports.xid = exports.ulid = exports.cuid2 = exports.cuid = void 0;
27
+ exports.sha512_base64url = exports.sha512_base64 = exports.sha512_hex = exports.sha384_base64url = exports.sha384_base64 = void 0;
5
28
  exports.emoji = emoji;
6
29
  exports.time = time;
7
30
  exports.datetime = datetime;
31
+ const util = __importStar(require("./util.cjs"));
8
32
  exports.cuid = /^[cC][^\s-]{8,}$/;
9
33
  exports.cuid2 = /^[0-9a-z]+$/;
10
34
  exports.ulid = /^[0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{26}$/;
@@ -46,6 +70,11 @@ function emoji() {
46
70
  }
47
71
  exports.ipv4 = /^(?:(?: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])$/;
48
72
  exports.ipv6 = /^(([0-9a-fA-F]{1,4}:){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}|:))$/;
73
+ const mac = (delimiter) => {
74
+ const escapedDelim = util.escapeRegex(delimiter ?? ":");
75
+ return new RegExp(`^(?:[0-9A-F]{2}${escapedDelim}){5}[0-9A-F]{2}$|^(?:[0-9a-f]{2}${escapedDelim}){5}[0-9a-f]{2}$`);
76
+ };
77
+ exports.mac = mac;
49
78
  exports.cidrv4 = /^((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])\/([0-9]|[1-2][0-9]|3[0-2])$/;
50
79
  exports.cidrv6 = /^(([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}|::|([0-9a-fA-F]{1,4})?::([0-9a-fA-F]{1,4}:?){0,6})\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/;
51
80
  // https://stackoverflow.com/questions/7860392/determine-if-string-is-in-base64-using-javascript
@@ -30,6 +30,7 @@ export declare const browserEmail: RegExp;
30
30
  export declare function emoji(): RegExp;
31
31
  export declare const ipv4: RegExp;
32
32
  export declare const ipv6: RegExp;
33
+ export declare const mac: (delimiter?: string) => RegExp;
33
34
  export declare const cidrv4: RegExp;
34
35
  export declare const cidrv6: RegExp;
35
36
  export declare const base64: RegExp;
@@ -30,6 +30,7 @@ export declare const browserEmail: RegExp;
30
30
  export declare function emoji(): RegExp;
31
31
  export declare const ipv4: RegExp;
32
32
  export declare const ipv6: RegExp;
33
+ export declare const mac: (delimiter?: string) => RegExp;
33
34
  export declare const cidrv4: RegExp;
34
35
  export declare const cidrv6: RegExp;
35
36
  export declare const base64: RegExp;
@@ -1,3 +1,4 @@
1
+ import * as util from "./util.js";
1
2
  export const cuid = /^[cC][^\s-]{8,}$/;
2
3
  export const cuid2 = /^[0-9a-z]+$/;
3
4
  export const ulid = /^[0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{26}$/;
@@ -38,6 +39,10 @@ export function emoji() {
38
39
  }
39
40
  export const ipv4 = /^(?:(?: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])$/;
40
41
  export const ipv6 = /^(([0-9a-fA-F]{1,4}:){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}|:))$/;
42
+ export const mac = (delimiter) => {
43
+ const escapedDelim = util.escapeRegex(delimiter ?? ":");
44
+ return new RegExp(`^(?:[0-9A-F]{2}${escapedDelim}){5}[0-9A-F]{2}$|^(?:[0-9a-f]{2}${escapedDelim}){5}[0-9a-f]{2}$`);
45
+ };
41
46
  export const cidrv4 = /^((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])\/([0-9]|[1-2][0-9]|3[0-2])$/;
42
47
  export const cidrv6 = /^(([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}|::|([0-9a-fA-F]{1,4})?::([0-9a-fA-F]{1,4}:?){0,6})\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/;
43
48
  // https://stackoverflow.com/questions/7860392/determine-if-string-is-in-base64-using-javascript
@@ -1,4 +1,5 @@
1
1
  "use strict";
2
+ var _a;
2
3
  Object.defineProperty(exports, "__esModule", { value: true });
3
4
  exports.globalRegistry = exports.$ZodRegistry = exports.$input = exports.$output = void 0;
4
5
  exports.registry = registry;
@@ -54,4 +55,5 @@ exports.$ZodRegistry = $ZodRegistry;
54
55
  function registry() {
55
56
  return new $ZodRegistry();
56
57
  }
57
- exports.globalRegistry = registry();
58
+ (_a = globalThis).__zod_globalRegistry ?? (_a.__zod_globalRegistry = registry());
59
+ exports.globalRegistry = globalThis.__zod_globalRegistry;
@@ -1,3 +1,4 @@
1
+ var _a;
1
2
  export const $output = Symbol("ZodOutput");
2
3
  export const $input = Symbol("ZodInput");
3
4
  export class $ZodRegistry {
@@ -49,4 +50,5 @@ export class $ZodRegistry {
49
50
  export function registry() {
50
51
  return new $ZodRegistry();
51
52
  }
52
- export const globalRegistry = /*@__PURE__*/ registry();
53
+ (_a = globalThis).__zod_globalRegistry ?? (_a.__zod_globalRegistry = registry());
54
+ export const globalRegistry = globalThis.__zod_globalRegistry;
@@ -23,8 +23,8 @@ var __importStar = (this && this.__importStar) || function (mod) {
23
23
  return result;
24
24
  };
25
25
  Object.defineProperty(exports, "__esModule", { value: true });
26
- exports.$ZodMap = exports.$ZodRecord = exports.$ZodTuple = exports.$ZodIntersection = exports.$ZodDiscriminatedUnion = exports.$ZodUnion = exports.$ZodObjectJIT = exports.$ZodObject = exports.$ZodArray = exports.$ZodDate = exports.$ZodVoid = exports.$ZodNever = exports.$ZodUnknown = exports.$ZodAny = exports.$ZodNull = exports.$ZodUndefined = exports.$ZodSymbol = exports.$ZodBigIntFormat = exports.$ZodBigInt = exports.$ZodBoolean = exports.$ZodNumberFormat = exports.$ZodNumber = exports.$ZodCustomStringFormat = exports.$ZodJWT = exports.$ZodE164 = exports.$ZodBase64URL = exports.$ZodBase64 = exports.$ZodCIDRv6 = exports.$ZodCIDRv4 = exports.$ZodIPv6 = exports.$ZodIPv4 = exports.$ZodISODuration = exports.$ZodISOTime = exports.$ZodISODate = exports.$ZodISODateTime = exports.$ZodKSUID = exports.$ZodXID = exports.$ZodULID = exports.$ZodCUID2 = exports.$ZodCUID = exports.$ZodNanoID = exports.$ZodEmoji = exports.$ZodURL = exports.$ZodEmail = exports.$ZodUUID = exports.$ZodGUID = exports.$ZodStringFormat = exports.$ZodString = exports.clone = exports.$ZodType = void 0;
27
- exports.$ZodCustom = exports.$ZodLazy = exports.$ZodPromise = exports.$ZodFunction = exports.$ZodTemplateLiteral = exports.$ZodReadonly = exports.$ZodCodec = exports.$ZodPipe = exports.$ZodNaN = exports.$ZodCatch = exports.$ZodSuccess = exports.$ZodNonOptional = exports.$ZodPrefault = exports.$ZodDefault = exports.$ZodNullable = exports.$ZodOptional = exports.$ZodTransform = exports.$ZodFile = exports.$ZodLiteral = exports.$ZodEnum = exports.$ZodSet = void 0;
26
+ exports.$ZodRecord = exports.$ZodTuple = exports.$ZodIntersection = exports.$ZodDiscriminatedUnion = exports.$ZodUnion = exports.$ZodObjectJIT = exports.$ZodObject = exports.$ZodArray = exports.$ZodDate = exports.$ZodVoid = exports.$ZodNever = exports.$ZodUnknown = exports.$ZodAny = exports.$ZodNull = exports.$ZodUndefined = exports.$ZodSymbol = exports.$ZodBigIntFormat = exports.$ZodBigInt = exports.$ZodBoolean = exports.$ZodNumberFormat = exports.$ZodNumber = exports.$ZodCustomStringFormat = exports.$ZodJWT = exports.$ZodE164 = exports.$ZodBase64URL = exports.$ZodBase64 = exports.$ZodCIDRv6 = exports.$ZodCIDRv4 = exports.$ZodMAC = exports.$ZodIPv6 = exports.$ZodIPv4 = exports.$ZodISODuration = exports.$ZodISOTime = exports.$ZodISODate = exports.$ZodISODateTime = exports.$ZodKSUID = exports.$ZodXID = exports.$ZodULID = exports.$ZodCUID2 = exports.$ZodCUID = exports.$ZodNanoID = exports.$ZodEmoji = exports.$ZodURL = exports.$ZodEmail = exports.$ZodUUID = exports.$ZodGUID = exports.$ZodStringFormat = exports.$ZodString = exports.clone = exports.$ZodType = void 0;
27
+ exports.$ZodCustom = exports.$ZodLazy = exports.$ZodPromise = exports.$ZodFunction = exports.$ZodTemplateLiteral = exports.$ZodReadonly = exports.$ZodCodec = exports.$ZodPipe = exports.$ZodNaN = exports.$ZodCatch = exports.$ZodSuccess = exports.$ZodNonOptional = exports.$ZodPrefault = exports.$ZodDefault = exports.$ZodNullable = exports.$ZodOptional = exports.$ZodTransform = exports.$ZodFile = exports.$ZodLiteral = exports.$ZodEnum = exports.$ZodSet = exports.$ZodMap = void 0;
28
28
  exports.isValidBase64 = isValidBase64;
29
29
  exports.isValidBase64URL = isValidBase64URL;
30
30
  exports.isValidJWT = isValidJWT;
@@ -237,7 +237,7 @@ exports.$ZodURL = core.$constructor("$ZodURL", (inst, def) => {
237
237
  code: "invalid_format",
238
238
  format: "url",
239
239
  note: "Invalid hostname",
240
- pattern: regexes.hostname.source,
240
+ pattern: def.hostname.source,
241
241
  input: payload.value,
242
242
  inst,
243
243
  continue: !def.abort,
@@ -327,18 +327,12 @@ exports.$ZodISODuration = core.$constructor("$ZodISODuration", (inst, def) => {
327
327
  exports.$ZodIPv4 = core.$constructor("$ZodIPv4", (inst, def) => {
328
328
  def.pattern ?? (def.pattern = regexes.ipv4);
329
329
  exports.$ZodStringFormat.init(inst, def);
330
- inst._zod.onattach.push((inst) => {
331
- const bag = inst._zod.bag;
332
- bag.format = `ipv4`;
333
- });
330
+ inst._zod.bag.format = `ipv4`;
334
331
  });
335
332
  exports.$ZodIPv6 = core.$constructor("$ZodIPv6", (inst, def) => {
336
333
  def.pattern ?? (def.pattern = regexes.ipv6);
337
334
  exports.$ZodStringFormat.init(inst, def);
338
- inst._zod.onattach.push((inst) => {
339
- const bag = inst._zod.bag;
340
- bag.format = `ipv6`;
341
- });
335
+ inst._zod.bag.format = `ipv6`;
342
336
  inst._zod.check = (payload) => {
343
337
  try {
344
338
  // @ts-ignore
@@ -356,6 +350,11 @@ exports.$ZodIPv6 = core.$constructor("$ZodIPv6", (inst, def) => {
356
350
  }
357
351
  };
358
352
  });
353
+ exports.$ZodMAC = core.$constructor("$ZodMAC", (inst, def) => {
354
+ def.pattern ?? (def.pattern = regexes.mac(def.delimiter));
355
+ exports.$ZodStringFormat.init(inst, def);
356
+ inst._zod.bag.format = `mac`;
357
+ });
359
358
  exports.$ZodCIDRv4 = core.$constructor("$ZodCIDRv4", (inst, def) => {
360
359
  def.pattern ?? (def.pattern = regexes.cidrv4);
361
360
  exports.$ZodStringFormat.init(inst, def);
@@ -408,9 +407,7 @@ function isValidBase64(data) {
408
407
  exports.$ZodBase64 = core.$constructor("$ZodBase64", (inst, def) => {
409
408
  def.pattern ?? (def.pattern = regexes.base64);
410
409
  exports.$ZodStringFormat.init(inst, def);
411
- inst._zod.onattach.push((inst) => {
412
- inst._zod.bag.contentEncoding = "base64";
413
- });
410
+ inst._zod.bag.contentEncoding = "base64";
414
411
  inst._zod.check = (payload) => {
415
412
  if (isValidBase64(payload.value))
416
413
  return;
@@ -434,9 +431,7 @@ function isValidBase64URL(data) {
434
431
  exports.$ZodBase64URL = core.$constructor("$ZodBase64URL", (inst, def) => {
435
432
  def.pattern ?? (def.pattern = regexes.base64url);
436
433
  exports.$ZodStringFormat.init(inst, def);
437
- inst._zod.onattach.push((inst) => {
438
- inst._zod.bag.contentEncoding = "base64url";
439
- });
434
+ inst._zod.bag.contentEncoding = "base64url";
440
435
  inst._zod.check = (payload) => {
441
436
  if (isValidBase64URL(payload.value))
442
437
  return;
@@ -534,9 +529,9 @@ exports.$ZodNumber = core.$constructor("$ZodNumber", (inst, def) => {
534
529
  return payload;
535
530
  };
536
531
  });
537
- exports.$ZodNumberFormat = core.$constructor("$ZodNumber", (inst, def) => {
532
+ exports.$ZodNumberFormat = core.$constructor("$ZodNumberFormat", (inst, def) => {
538
533
  checks.$ZodCheckNumberFormat.init(inst, def);
539
- exports.$ZodNumber.init(inst, def); // no format checksp
534
+ exports.$ZodNumber.init(inst, def); // no format checks
540
535
  });
541
536
  exports.$ZodBoolean = core.$constructor("$ZodBoolean", (inst, def) => {
542
537
  exports.$ZodType.init(inst, def);
@@ -579,7 +574,7 @@ exports.$ZodBigInt = core.$constructor("$ZodBigInt", (inst, def) => {
579
574
  return payload;
580
575
  };
581
576
  });
582
- exports.$ZodBigIntFormat = core.$constructor("$ZodBigInt", (inst, def) => {
577
+ exports.$ZodBigIntFormat = core.$constructor("$ZodBigIntFormat", (inst, def) => {
583
578
  checks.$ZodCheckBigIntFormat.init(inst, def);
584
579
  exports.$ZodBigInt.init(inst, def); // no format checks
585
580
  });
@@ -768,7 +763,7 @@ function handleCatchall(proms, input, payload, ctx, def, inst) {
768
763
  const keySet = def.keySet;
769
764
  const _catchall = def.catchall._zod;
770
765
  const t = _catchall.def.type;
771
- for (const key of Object.keys(input)) {
766
+ for (const key in input) {
772
767
  if (keySet.has(key))
773
768
  continue;
774
769
  if (t === "never") {
@@ -1156,7 +1151,6 @@ function handleIntersectionResults(result, left, right) {
1156
1151
  exports.$ZodTuple = core.$constructor("$ZodTuple", (inst, def) => {
1157
1152
  exports.$ZodType.init(inst, def);
1158
1153
  const items = def.items;
1159
- const optStart = items.length - [...items].reverse().findIndex((item) => item._zod.optin !== "optional");
1160
1154
  inst._zod.parse = (payload, ctx) => {
1161
1155
  const input = payload.value;
1162
1156
  if (!Array.isArray(input)) {
@@ -1170,6 +1164,8 @@ exports.$ZodTuple = core.$constructor("$ZodTuple", (inst, def) => {
1170
1164
  }
1171
1165
  payload.value = [];
1172
1166
  const proms = [];
1167
+ const reversedIndex = [...items].reverse().findIndex((item) => item._zod.optin !== "optional");
1168
+ const optStart = reversedIndex === -1 ? 0 : items.length - reversedIndex;
1173
1169
  if (!def.rest) {
1174
1170
  const tooBig = input.length > items.length;
1175
1171
  const tooSmall = input.length < optStart - 1;
@@ -1241,11 +1237,13 @@ exports.$ZodRecord = core.$constructor("$ZodRecord", (inst, def) => {
1241
1237
  return payload;
1242
1238
  }
1243
1239
  const proms = [];
1244
- if (def.keyType._zod.values) {
1245
- const values = def.keyType._zod.values;
1240
+ const values = def.keyType._zod.values;
1241
+ if (values) {
1246
1242
  payload.value = {};
1243
+ const recordKeys = new Set();
1247
1244
  for (const key of values) {
1248
1245
  if (typeof key === "string" || typeof key === "number" || typeof key === "symbol") {
1246
+ recordKeys.add(typeof key === "number" ? key.toString() : key);
1249
1247
  const result = def.valueType._zod.run({ value: input[key], issues: [] }, ctx);
1250
1248
  if (result instanceof Promise) {
1251
1249
  proms.push(result.then((result) => {
@@ -1265,7 +1263,7 @@ exports.$ZodRecord = core.$constructor("$ZodRecord", (inst, def) => {
1265
1263
  }
1266
1264
  let unrecognized;
1267
1265
  for (const key in input) {
1268
- if (!values.has(key)) {
1266
+ if (!recordKeys.has(key)) {
1269
1267
  unrecognized = unrecognized ?? [];
1270
1268
  unrecognized.push(key);
1271
1269
  }
@@ -1449,13 +1447,14 @@ exports.$ZodLiteral = core.$constructor("$ZodLiteral", (inst, def) => {
1449
1447
  if (def.values.length === 0) {
1450
1448
  throw new Error("Cannot create literal schema with no valid values");
1451
1449
  }
1452
- inst._zod.values = new Set(def.values);
1450
+ const values = new Set(def.values);
1451
+ inst._zod.values = values;
1453
1452
  inst._zod.pattern = new RegExp(`^(${def.values
1454
1453
  .map((o) => (typeof o === "string" ? util.escapeRegex(o) : o ? util.escapeRegex(o.toString()) : String(o)))
1455
1454
  .join("|")})$`);
1456
1455
  inst._zod.parse = (payload, _ctx) => {
1457
1456
  const input = payload.value;
1458
- if (inst._zod.values.has(input)) {
1457
+ if (values.has(input)) {
1459
1458
  return payload;
1460
1459
  }
1461
1460
  payload.issues.push({
@@ -1783,8 +1782,8 @@ exports.$ZodReadonly = core.$constructor("$ZodReadonly", (inst, def) => {
1783
1782
  exports.$ZodType.init(inst, def);
1784
1783
  util.defineLazy(inst._zod, "propValues", () => def.innerType._zod.propValues);
1785
1784
  util.defineLazy(inst._zod, "values", () => def.innerType._zod.values);
1786
- util.defineLazy(inst._zod, "optin", () => def.innerType._zod.optin);
1787
- util.defineLazy(inst._zod, "optout", () => def.innerType._zod.optout);
1785
+ util.defineLazy(inst._zod, "optin", () => def.innerType?._zod?.optin);
1786
+ util.defineLazy(inst._zod, "optout", () => def.innerType?._zod?.optout);
1788
1787
  inst._zod.parse = (payload, ctx) => {
1789
1788
  if (ctx.direction === "backward") {
1790
1789
  return def.innerType._zod.run(payload, ctx);
@@ -1944,10 +1943,10 @@ exports.$ZodLazy = core.$constructor("$ZodLazy", (inst, def) => {
1944
1943
  // return () => _innerType;
1945
1944
  // });
1946
1945
  util.defineLazy(inst._zod, "innerType", () => def.getter());
1947
- util.defineLazy(inst._zod, "pattern", () => inst._zod.innerType._zod.pattern);
1948
- util.defineLazy(inst._zod, "propValues", () => inst._zod.innerType._zod.propValues);
1949
- util.defineLazy(inst._zod, "optin", () => inst._zod.innerType._zod.optin ?? undefined);
1950
- util.defineLazy(inst._zod, "optout", () => inst._zod.innerType._zod.optout ?? undefined);
1946
+ util.defineLazy(inst._zod, "pattern", () => inst._zod.innerType?._zod?.pattern);
1947
+ util.defineLazy(inst._zod, "propValues", () => inst._zod.innerType?._zod?.propValues);
1948
+ util.defineLazy(inst._zod, "optin", () => inst._zod.innerType?._zod?.optin ?? undefined);
1949
+ util.defineLazy(inst._zod, "optout", () => inst._zod.innerType?._zod?.optout ?? undefined);
1951
1950
  inst._zod.parse = (payload, ctx) => {
1952
1951
  const inner = inst._zod.innerType;
1953
1952
  return inner._zod.run(payload, ctx);
@@ -276,6 +276,16 @@ export interface $ZodIPv6 extends $ZodType {
276
276
  _zod: $ZodIPv6Internals;
277
277
  }
278
278
  export declare const $ZodIPv6: core.$constructor<$ZodIPv6>;
279
+ export interface $ZodMACDef extends $ZodStringFormatDef<"mac"> {
280
+ delimiter?: string;
281
+ }
282
+ export interface $ZodMACInternals extends $ZodStringFormatInternals<"mac"> {
283
+ def: $ZodMACDef;
284
+ }
285
+ export interface $ZodMAC extends $ZodType {
286
+ _zod: $ZodMACInternals;
287
+ }
288
+ export declare const $ZodMAC: core.$constructor<$ZodMAC>;
279
289
  export interface $ZodCIDRv4Def extends $ZodStringFormatDef<"cidrv4"> {
280
290
  version?: "v4";
281
291
  }
@@ -1063,7 +1073,7 @@ export interface $ZodPromiseDef<T extends SomeType = $ZodType> extends $ZodTypeD
1063
1073
  type: "promise";
1064
1074
  innerType: T;
1065
1075
  }
1066
- export interface $ZodPromiseInternals<T extends SomeType = $ZodType> extends $ZodTypeInternals<core.output<T>, util.MaybeAsync<core.input<T>>> {
1076
+ export interface $ZodPromiseInternals<T extends SomeType = $ZodType> extends $ZodTypeInternals<Promise<core.output<T>>, util.MaybeAsync<core.input<T>>> {
1067
1077
  def: $ZodPromiseDef<T>;
1068
1078
  isst: never;
1069
1079
  }
@@ -1110,4 +1120,4 @@ export interface $ZodCustom<O = unknown, I = unknown> extends $ZodType {
1110
1120
  }
1111
1121
  export declare const $ZodCustom: core.$constructor<$ZodCustom>;
1112
1122
  export type $ZodTypes = $ZodString | $ZodNumber | $ZodBigInt | $ZodBoolean | $ZodDate | $ZodSymbol | $ZodUndefined | $ZodNullable | $ZodNull | $ZodAny | $ZodUnknown | $ZodNever | $ZodVoid | $ZodArray | $ZodObject | $ZodUnion | $ZodIntersection | $ZodTuple | $ZodRecord | $ZodMap | $ZodSet | $ZodLiteral | $ZodEnum | $ZodFunction | $ZodPromise | $ZodLazy | $ZodOptional | $ZodDefault | $ZodPrefault | $ZodTemplateLiteral | $ZodCustom | $ZodTransform | $ZodNonOptional | $ZodReadonly | $ZodNaN | $ZodPipe | $ZodSuccess | $ZodCatch | $ZodFile;
1113
- export type $ZodStringFormatTypes = $ZodGUID | $ZodUUID | $ZodEmail | $ZodURL | $ZodEmoji | $ZodNanoID | $ZodCUID | $ZodCUID2 | $ZodULID | $ZodXID | $ZodKSUID | $ZodISODateTime | $ZodISODate | $ZodISOTime | $ZodISODuration | $ZodIPv4 | $ZodIPv6 | $ZodCIDRv4 | $ZodCIDRv6 | $ZodBase64 | $ZodBase64URL | $ZodE164 | $ZodJWT | $ZodCustomStringFormat<"hex"> | $ZodCustomStringFormat<util.HashFormat> | $ZodCustomStringFormat<"hostname">;
1123
+ export type $ZodStringFormatTypes = $ZodGUID | $ZodUUID | $ZodEmail | $ZodURL | $ZodEmoji | $ZodNanoID | $ZodCUID | $ZodCUID2 | $ZodULID | $ZodXID | $ZodKSUID | $ZodISODateTime | $ZodISODate | $ZodISOTime | $ZodISODuration | $ZodIPv4 | $ZodIPv6 | $ZodMAC | $ZodCIDRv4 | $ZodCIDRv6 | $ZodBase64 | $ZodBase64URL | $ZodE164 | $ZodJWT | $ZodCustomStringFormat<"hex"> | $ZodCustomStringFormat<util.HashFormat> | $ZodCustomStringFormat<"hostname">;
@@ -276,6 +276,16 @@ export interface $ZodIPv6 extends $ZodType {
276
276
  _zod: $ZodIPv6Internals;
277
277
  }
278
278
  export declare const $ZodIPv6: core.$constructor<$ZodIPv6>;
279
+ export interface $ZodMACDef extends $ZodStringFormatDef<"mac"> {
280
+ delimiter?: string;
281
+ }
282
+ export interface $ZodMACInternals extends $ZodStringFormatInternals<"mac"> {
283
+ def: $ZodMACDef;
284
+ }
285
+ export interface $ZodMAC extends $ZodType {
286
+ _zod: $ZodMACInternals;
287
+ }
288
+ export declare const $ZodMAC: core.$constructor<$ZodMAC>;
279
289
  export interface $ZodCIDRv4Def extends $ZodStringFormatDef<"cidrv4"> {
280
290
  version?: "v4";
281
291
  }
@@ -1063,7 +1073,7 @@ export interface $ZodPromiseDef<T extends SomeType = $ZodType> extends $ZodTypeD
1063
1073
  type: "promise";
1064
1074
  innerType: T;
1065
1075
  }
1066
- export interface $ZodPromiseInternals<T extends SomeType = $ZodType> extends $ZodTypeInternals<core.output<T>, util.MaybeAsync<core.input<T>>> {
1076
+ export interface $ZodPromiseInternals<T extends SomeType = $ZodType> extends $ZodTypeInternals<Promise<core.output<T>>, util.MaybeAsync<core.input<T>>> {
1067
1077
  def: $ZodPromiseDef<T>;
1068
1078
  isst: never;
1069
1079
  }
@@ -1110,4 +1120,4 @@ export interface $ZodCustom<O = unknown, I = unknown> extends $ZodType {
1110
1120
  }
1111
1121
  export declare const $ZodCustom: core.$constructor<$ZodCustom>;
1112
1122
  export type $ZodTypes = $ZodString | $ZodNumber | $ZodBigInt | $ZodBoolean | $ZodDate | $ZodSymbol | $ZodUndefined | $ZodNullable | $ZodNull | $ZodAny | $ZodUnknown | $ZodNever | $ZodVoid | $ZodArray | $ZodObject | $ZodUnion | $ZodIntersection | $ZodTuple | $ZodRecord | $ZodMap | $ZodSet | $ZodLiteral | $ZodEnum | $ZodFunction | $ZodPromise | $ZodLazy | $ZodOptional | $ZodDefault | $ZodPrefault | $ZodTemplateLiteral | $ZodCustom | $ZodTransform | $ZodNonOptional | $ZodReadonly | $ZodNaN | $ZodPipe | $ZodSuccess | $ZodCatch | $ZodFile;
1113
- export type $ZodStringFormatTypes = $ZodGUID | $ZodUUID | $ZodEmail | $ZodURL | $ZodEmoji | $ZodNanoID | $ZodCUID | $ZodCUID2 | $ZodULID | $ZodXID | $ZodKSUID | $ZodISODateTime | $ZodISODate | $ZodISOTime | $ZodISODuration | $ZodIPv4 | $ZodIPv6 | $ZodCIDRv4 | $ZodCIDRv6 | $ZodBase64 | $ZodBase64URL | $ZodE164 | $ZodJWT | $ZodCustomStringFormat<"hex"> | $ZodCustomStringFormat<util.HashFormat> | $ZodCustomStringFormat<"hostname">;
1123
+ export type $ZodStringFormatTypes = $ZodGUID | $ZodUUID | $ZodEmail | $ZodURL | $ZodEmoji | $ZodNanoID | $ZodCUID | $ZodCUID2 | $ZodULID | $ZodXID | $ZodKSUID | $ZodISODateTime | $ZodISODate | $ZodISOTime | $ZodISODuration | $ZodIPv4 | $ZodIPv6 | $ZodMAC | $ZodCIDRv4 | $ZodCIDRv6 | $ZodBase64 | $ZodBase64URL | $ZodE164 | $ZodJWT | $ZodCustomStringFormat<"hex"> | $ZodCustomStringFormat<util.HashFormat> | $ZodCustomStringFormat<"hostname">;
@@ -206,7 +206,7 @@ export const $ZodURL = /*@__PURE__*/ core.$constructor("$ZodURL", (inst, def) =>
206
206
  code: "invalid_format",
207
207
  format: "url",
208
208
  note: "Invalid hostname",
209
- pattern: regexes.hostname.source,
209
+ pattern: def.hostname.source,
210
210
  input: payload.value,
211
211
  inst,
212
212
  continue: !def.abort,
@@ -296,18 +296,12 @@ export const $ZodISODuration = /*@__PURE__*/ core.$constructor("$ZodISODuration"
296
296
  export const $ZodIPv4 = /*@__PURE__*/ core.$constructor("$ZodIPv4", (inst, def) => {
297
297
  def.pattern ?? (def.pattern = regexes.ipv4);
298
298
  $ZodStringFormat.init(inst, def);
299
- inst._zod.onattach.push((inst) => {
300
- const bag = inst._zod.bag;
301
- bag.format = `ipv4`;
302
- });
299
+ inst._zod.bag.format = `ipv4`;
303
300
  });
304
301
  export const $ZodIPv6 = /*@__PURE__*/ core.$constructor("$ZodIPv6", (inst, def) => {
305
302
  def.pattern ?? (def.pattern = regexes.ipv6);
306
303
  $ZodStringFormat.init(inst, def);
307
- inst._zod.onattach.push((inst) => {
308
- const bag = inst._zod.bag;
309
- bag.format = `ipv6`;
310
- });
304
+ inst._zod.bag.format = `ipv6`;
311
305
  inst._zod.check = (payload) => {
312
306
  try {
313
307
  // @ts-ignore
@@ -325,6 +319,11 @@ export const $ZodIPv6 = /*@__PURE__*/ core.$constructor("$ZodIPv6", (inst, def)
325
319
  }
326
320
  };
327
321
  });
322
+ export const $ZodMAC = /*@__PURE__*/ core.$constructor("$ZodMAC", (inst, def) => {
323
+ def.pattern ?? (def.pattern = regexes.mac(def.delimiter));
324
+ $ZodStringFormat.init(inst, def);
325
+ inst._zod.bag.format = `mac`;
326
+ });
328
327
  export const $ZodCIDRv4 = /*@__PURE__*/ core.$constructor("$ZodCIDRv4", (inst, def) => {
329
328
  def.pattern ?? (def.pattern = regexes.cidrv4);
330
329
  $ZodStringFormat.init(inst, def);
@@ -377,9 +376,7 @@ export function isValidBase64(data) {
377
376
  export const $ZodBase64 = /*@__PURE__*/ core.$constructor("$ZodBase64", (inst, def) => {
378
377
  def.pattern ?? (def.pattern = regexes.base64);
379
378
  $ZodStringFormat.init(inst, def);
380
- inst._zod.onattach.push((inst) => {
381
- inst._zod.bag.contentEncoding = "base64";
382
- });
379
+ inst._zod.bag.contentEncoding = "base64";
383
380
  inst._zod.check = (payload) => {
384
381
  if (isValidBase64(payload.value))
385
382
  return;
@@ -403,9 +400,7 @@ export function isValidBase64URL(data) {
403
400
  export const $ZodBase64URL = /*@__PURE__*/ core.$constructor("$ZodBase64URL", (inst, def) => {
404
401
  def.pattern ?? (def.pattern = regexes.base64url);
405
402
  $ZodStringFormat.init(inst, def);
406
- inst._zod.onattach.push((inst) => {
407
- inst._zod.bag.contentEncoding = "base64url";
408
- });
403
+ inst._zod.bag.contentEncoding = "base64url";
409
404
  inst._zod.check = (payload) => {
410
405
  if (isValidBase64URL(payload.value))
411
406
  return;
@@ -503,9 +498,9 @@ export const $ZodNumber = /*@__PURE__*/ core.$constructor("$ZodNumber", (inst, d
503
498
  return payload;
504
499
  };
505
500
  });
506
- export const $ZodNumberFormat = /*@__PURE__*/ core.$constructor("$ZodNumber", (inst, def) => {
501
+ export const $ZodNumberFormat = /*@__PURE__*/ core.$constructor("$ZodNumberFormat", (inst, def) => {
507
502
  checks.$ZodCheckNumberFormat.init(inst, def);
508
- $ZodNumber.init(inst, def); // no format checksp
503
+ $ZodNumber.init(inst, def); // no format checks
509
504
  });
510
505
  export const $ZodBoolean = /*@__PURE__*/ core.$constructor("$ZodBoolean", (inst, def) => {
511
506
  $ZodType.init(inst, def);
@@ -548,7 +543,7 @@ export const $ZodBigInt = /*@__PURE__*/ core.$constructor("$ZodBigInt", (inst, d
548
543
  return payload;
549
544
  };
550
545
  });
551
- export const $ZodBigIntFormat = /*@__PURE__*/ core.$constructor("$ZodBigInt", (inst, def) => {
546
+ export const $ZodBigIntFormat = /*@__PURE__*/ core.$constructor("$ZodBigIntFormat", (inst, def) => {
552
547
  checks.$ZodCheckBigIntFormat.init(inst, def);
553
548
  $ZodBigInt.init(inst, def); // no format checks
554
549
  });
@@ -737,7 +732,7 @@ function handleCatchall(proms, input, payload, ctx, def, inst) {
737
732
  const keySet = def.keySet;
738
733
  const _catchall = def.catchall._zod;
739
734
  const t = _catchall.def.type;
740
- for (const key of Object.keys(input)) {
735
+ for (const key in input) {
741
736
  if (keySet.has(key))
742
737
  continue;
743
738
  if (t === "never") {
@@ -1125,7 +1120,6 @@ function handleIntersectionResults(result, left, right) {
1125
1120
  export const $ZodTuple = /*@__PURE__*/ core.$constructor("$ZodTuple", (inst, def) => {
1126
1121
  $ZodType.init(inst, def);
1127
1122
  const items = def.items;
1128
- const optStart = items.length - [...items].reverse().findIndex((item) => item._zod.optin !== "optional");
1129
1123
  inst._zod.parse = (payload, ctx) => {
1130
1124
  const input = payload.value;
1131
1125
  if (!Array.isArray(input)) {
@@ -1139,6 +1133,8 @@ export const $ZodTuple = /*@__PURE__*/ core.$constructor("$ZodTuple", (inst, def
1139
1133
  }
1140
1134
  payload.value = [];
1141
1135
  const proms = [];
1136
+ const reversedIndex = [...items].reverse().findIndex((item) => item._zod.optin !== "optional");
1137
+ const optStart = reversedIndex === -1 ? 0 : items.length - reversedIndex;
1142
1138
  if (!def.rest) {
1143
1139
  const tooBig = input.length > items.length;
1144
1140
  const tooSmall = input.length < optStart - 1;
@@ -1210,11 +1206,13 @@ export const $ZodRecord = /*@__PURE__*/ core.$constructor("$ZodRecord", (inst, d
1210
1206
  return payload;
1211
1207
  }
1212
1208
  const proms = [];
1213
- if (def.keyType._zod.values) {
1214
- const values = def.keyType._zod.values;
1209
+ const values = def.keyType._zod.values;
1210
+ if (values) {
1215
1211
  payload.value = {};
1212
+ const recordKeys = new Set();
1216
1213
  for (const key of values) {
1217
1214
  if (typeof key === "string" || typeof key === "number" || typeof key === "symbol") {
1215
+ recordKeys.add(typeof key === "number" ? key.toString() : key);
1218
1216
  const result = def.valueType._zod.run({ value: input[key], issues: [] }, ctx);
1219
1217
  if (result instanceof Promise) {
1220
1218
  proms.push(result.then((result) => {
@@ -1234,7 +1232,7 @@ export const $ZodRecord = /*@__PURE__*/ core.$constructor("$ZodRecord", (inst, d
1234
1232
  }
1235
1233
  let unrecognized;
1236
1234
  for (const key in input) {
1237
- if (!values.has(key)) {
1235
+ if (!recordKeys.has(key)) {
1238
1236
  unrecognized = unrecognized ?? [];
1239
1237
  unrecognized.push(key);
1240
1238
  }
@@ -1418,13 +1416,14 @@ export const $ZodLiteral = /*@__PURE__*/ core.$constructor("$ZodLiteral", (inst,
1418
1416
  if (def.values.length === 0) {
1419
1417
  throw new Error("Cannot create literal schema with no valid values");
1420
1418
  }
1421
- inst._zod.values = new Set(def.values);
1419
+ const values = new Set(def.values);
1420
+ inst._zod.values = values;
1422
1421
  inst._zod.pattern = new RegExp(`^(${def.values
1423
1422
  .map((o) => (typeof o === "string" ? util.escapeRegex(o) : o ? util.escapeRegex(o.toString()) : String(o)))
1424
1423
  .join("|")})$`);
1425
1424
  inst._zod.parse = (payload, _ctx) => {
1426
1425
  const input = payload.value;
1427
- if (inst._zod.values.has(input)) {
1426
+ if (values.has(input)) {
1428
1427
  return payload;
1429
1428
  }
1430
1429
  payload.issues.push({
@@ -1752,8 +1751,8 @@ export const $ZodReadonly = /*@__PURE__*/ core.$constructor("$ZodReadonly", (ins
1752
1751
  $ZodType.init(inst, def);
1753
1752
  util.defineLazy(inst._zod, "propValues", () => def.innerType._zod.propValues);
1754
1753
  util.defineLazy(inst._zod, "values", () => def.innerType._zod.values);
1755
- util.defineLazy(inst._zod, "optin", () => def.innerType._zod.optin);
1756
- util.defineLazy(inst._zod, "optout", () => def.innerType._zod.optout);
1754
+ util.defineLazy(inst._zod, "optin", () => def.innerType?._zod?.optin);
1755
+ util.defineLazy(inst._zod, "optout", () => def.innerType?._zod?.optout);
1757
1756
  inst._zod.parse = (payload, ctx) => {
1758
1757
  if (ctx.direction === "backward") {
1759
1758
  return def.innerType._zod.run(payload, ctx);
@@ -1913,10 +1912,10 @@ export const $ZodLazy = /*@__PURE__*/ core.$constructor("$ZodLazy", (inst, def)
1913
1912
  // return () => _innerType;
1914
1913
  // });
1915
1914
  util.defineLazy(inst._zod, "innerType", () => def.getter());
1916
- util.defineLazy(inst._zod, "pattern", () => inst._zod.innerType._zod.pattern);
1917
- util.defineLazy(inst._zod, "propValues", () => inst._zod.innerType._zod.propValues);
1918
- util.defineLazy(inst._zod, "optin", () => inst._zod.innerType._zod.optin ?? undefined);
1919
- util.defineLazy(inst._zod, "optout", () => inst._zod.innerType._zod.optout ?? undefined);
1915
+ util.defineLazy(inst._zod, "pattern", () => inst._zod.innerType?._zod?.pattern);
1916
+ util.defineLazy(inst._zod, "propValues", () => inst._zod.innerType?._zod?.propValues);
1917
+ util.defineLazy(inst._zod, "optin", () => inst._zod.innerType?._zod?.optin ?? undefined);
1918
+ util.defineLazy(inst._zod, "optout", () => inst._zod.innerType?._zod?.optout ?? undefined);
1920
1919
  inst._zod.parse = (payload, ctx) => {
1921
1920
  const inner = inst._zod.innerType;
1922
1921
  return inner._zod.run(payload, ctx);