@getexception/browser 0.1.26 → 0.1.28

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.js CHANGED
@@ -8,7 +8,7 @@ var __export = (target, all) => {
8
8
  import * as Sentry from "@getexception/sentry-browser";
9
9
 
10
10
  // packages/browser/package.json
11
- var version = "0.1.26";
11
+ var version = "0.1.28";
12
12
 
13
13
  // packages/browser/src/browser-context.ts
14
14
  function browserContext(userAgent) {
@@ -59,6 +59,7 @@ __export(external_exports, {
59
59
  $brand: () => $brand,
60
60
  $input: () => $input,
61
61
  $output: () => $output,
62
+ INVALID: () => INVALID,
62
63
  NEVER: () => NEVER,
63
64
  TimePrecision: () => TimePrecision,
64
65
  ZodAny: () => ZodAny,
@@ -92,12 +93,14 @@ __export(external_exports, {
92
93
  ZodFirstPartyTypeKind: () => ZodFirstPartyTypeKind,
93
94
  ZodFunction: () => ZodFunction,
94
95
  ZodGUID: () => ZodGUID,
96
+ ZodIBAN: () => ZodIBAN,
95
97
  ZodIPv4: () => ZodIPv4,
96
98
  ZodIPv6: () => ZodIPv6,
97
99
  ZodISODate: () => ZodISODate,
98
100
  ZodISODateTime: () => ZodISODateTime,
99
101
  ZodISODuration: () => ZodISODuration,
100
102
  ZodISOTime: () => ZodISOTime,
103
+ ZodInstanceOf: () => ZodInstanceOf,
101
104
  ZodIntersection: () => ZodIntersection,
102
105
  ZodIssueCode: () => ZodIssueCode,
103
106
  ZodJWT: () => ZodJWT,
@@ -163,6 +166,7 @@ __export(external_exports, {
163
166
  creditCard: () => creditCard2,
164
167
  cuid: () => cuid3,
165
168
  cuid2: () => cuid22,
169
+ currencyCode: () => currencyCode2,
166
170
  custom: () => custom,
167
171
  date: () => date2,
168
172
  decode: () => decode2,
@@ -195,6 +199,7 @@ __export(external_exports, {
195
199
  hex: () => hex2,
196
200
  hostname: () => hostname2,
197
201
  httpUrl: () => httpUrl,
202
+ iban: () => iban2,
198
203
  includes: () => _includes,
199
204
  input: () => input,
200
205
  instanceof: () => _instanceof,
@@ -306,6 +311,7 @@ __export(external_exports, {
306
311
  validate: () => validate,
307
312
  validateAsync: () => validateAsync,
308
313
  void: () => _void2,
314
+ withParser: () => withParser,
309
315
  xid: () => xid2,
310
316
  xor: () => xor
311
317
  });
@@ -342,6 +348,7 @@ __export(core_exports2, {
342
348
  $ZodCheckMultipleOf: () => $ZodCheckMultipleOf,
343
349
  $ZodCheckNumberFormat: () => $ZodCheckNumberFormat,
344
350
  $ZodCheckOverwrite: () => $ZodCheckOverwrite,
351
+ $ZodCheckProperties: () => $ZodCheckProperties,
345
352
  $ZodCheckProperty: () => $ZodCheckProperty,
346
353
  $ZodCheckRegex: () => $ZodCheckRegex,
347
354
  $ZodCheckSizeEquals: () => $ZodCheckSizeEquals,
@@ -366,6 +373,7 @@ __export(core_exports2, {
366
373
  $ZodFile: () => $ZodFile,
367
374
  $ZodFunction: () => $ZodFunction,
368
375
  $ZodGUID: () => $ZodGUID,
376
+ $ZodIBAN: () => $ZodIBAN,
369
377
  $ZodIPv4: () => $ZodIPv4,
370
378
  $ZodIPv6: () => $ZodIPv6,
371
379
  $ZodISODate: () => $ZodISODate,
@@ -467,6 +475,7 @@ __export(core_exports2, {
467
475
  _gt: () => _gt,
468
476
  _gte: () => _gte,
469
477
  _guid: () => _guid,
478
+ _iban: () => _iban,
470
479
  _includes: () => _includes,
471
480
  _int: () => _int,
472
481
  _int32: () => _int32,
@@ -558,6 +567,9 @@ __export(core_exports2, {
558
567
  _void: () => _void,
559
568
  _xid: () => _xid,
560
569
  _xor: () => _xor,
570
+ base64Charset: () => base64Charset,
571
+ base64urlCharset: () => base64urlCharset,
572
+ canParseURL: () => canParseURL,
561
573
  clone: () => clone,
562
574
  compile: () => compile,
563
575
  compileFn: () => compileFn,
@@ -584,6 +596,7 @@ __export(core_exports2, {
584
596
  isValidBase64URL: () => isValidBase64URL,
585
597
  isValidCIDRv6: () => isValidCIDRv6,
586
598
  isValidCreditCard: () => isValidCreditCard,
599
+ isValidIBAN: () => isValidIBAN,
587
600
  isValidIPv6: () => isValidIPv6,
588
601
  isValidJWT: () => isValidJWT,
589
602
  locales: () => locales_exports,
@@ -594,7 +607,8 @@ __export(core_exports2, {
594
607
  parseAsync: () => parseAsync,
595
608
  parseURLObject: () => parseURLObject,
596
609
  prettifyError: () => prettifyError,
597
- process: () => process,
610
+ process: () => processSchema,
611
+ processSchema: () => processSchema,
598
612
  regexes: () => regexes_exports,
599
613
  registry: () => registry,
600
614
  safeDecode: () => safeDecode,
@@ -614,7 +628,9 @@ __export(core_exports2, {
614
628
  util: () => util_exports,
615
629
  validate: () => validate,
616
630
  validateAsync: () => validateAsync,
617
- version: () => version2
631
+ validateURL: () => validateURL,
632
+ version: () => version2,
633
+ withParser: () => withParser
618
634
  });
619
635
 
620
636
  // node_modules/zod/v4/core/util.js
@@ -646,6 +662,7 @@ __export(util_exports, {
646
662
  createTransparentProxy: () => createTransparentProxy,
647
663
  defineLazy: () => defineLazy,
648
664
  defineLazyInternal: () => defineLazyInternal,
665
+ derived: () => derived,
649
666
  esc: () => esc,
650
667
  escapeRegex: () => escapeRegex,
651
668
  explicitlyAborted: () => explicitlyAborted,
@@ -683,9 +700,11 @@ __export(util_exports, {
683
700
  promiseAllObject: () => promiseAllObject,
684
701
  propertyKeyTypes: () => propertyKeyTypes,
685
702
  randomString: () => randomString,
703
+ rawShape: () => rawShape,
686
704
  required: () => required,
687
705
  safeExtend: () => safeExtend,
688
706
  shallowClone: () => shallowClone,
707
+ sizeCaps: () => sizeCaps,
689
708
  slugify: () => slugify,
690
709
  stringifyPrimitive: () => stringifyPrimitive,
691
710
  toZod: () => toZod,
@@ -723,18 +742,22 @@ function jsonStringifyReplacer(_, value) {
723
742
  return value.toString();
724
743
  return value;
725
744
  }
726
- function cached(getter) {
727
- const set2 = false;
728
- return {
729
- get value() {
730
- if (!set2) {
731
- const value = getter();
732
- Object.defineProperty(this, "value", { value });
733
- return value;
734
- }
735
- throw new Error("cached value already set");
745
+ var Cached = class {
746
+ constructor(getter) {
747
+ this._getter = getter;
748
+ this._value = void 0;
749
+ }
750
+ get value() {
751
+ const getter = this._getter;
752
+ if (getter !== void 0) {
753
+ this._value = getter();
754
+ this._getter = void 0;
736
755
  }
737
- };
756
+ return this._value;
757
+ }
758
+ };
759
+ function cached(getter) {
760
+ return new Cached(getter);
738
761
  }
739
762
  function nullish(input2) {
740
763
  return input2 === null || input2 === void 0;
@@ -786,6 +809,56 @@ function assignProp(target, prop, value) {
786
809
  configurable: true
787
810
  });
788
811
  }
812
+ function rawShape(def) {
813
+ const desc = Object.getOwnPropertyDescriptor(def, "shape");
814
+ return desc?.get ? desc.get.raw : desc?.value;
815
+ }
816
+ function sourceShape(schema) {
817
+ return rawShape(schema._zod.def) ?? schema._zod.def.shape;
818
+ }
819
+ function deferProp(target, key, getter) {
820
+ Object.defineProperty(target, key, {
821
+ get() {
822
+ const value = getter();
823
+ assignProp(this, key, value);
824
+ return value;
825
+ },
826
+ enumerable: true,
827
+ configurable: true
828
+ });
829
+ }
830
+ function putProp(target, key, value) {
831
+ if (key in target)
832
+ assignProp(target, key, value);
833
+ else
834
+ target[key] = value;
835
+ }
836
+ function mirrorShape(target, source, keys, wrap) {
837
+ const raw = sourceShape(source);
838
+ for (const key of keys) {
839
+ const desc = Object.getOwnPropertyDescriptor(raw, key);
840
+ if (!desc.enumerable)
841
+ continue;
842
+ if (desc.get) {
843
+ deferProp(target, key, () => {
844
+ const value = source._zod.def.shape[key];
845
+ return wrap ? wrap(value, key) : value;
846
+ });
847
+ } else
848
+ putProp(target, key, wrap ? wrap(desc.value, key) : desc.value);
849
+ }
850
+ }
851
+ function mirrorProps(target, source) {
852
+ for (const key of Reflect.ownKeys(source)) {
853
+ const desc = Object.getOwnPropertyDescriptor(source, key);
854
+ if (!desc.enumerable)
855
+ continue;
856
+ if (desc.get)
857
+ deferProp(target, key, () => source[key]);
858
+ else
859
+ putProp(target, key, desc.value);
860
+ }
861
+ }
789
862
  function mergeDefs(...defs) {
790
863
  const mergedDescriptors = {};
791
864
  for (const def of defs) {
@@ -1024,23 +1097,21 @@ function pick(schema, mask) {
1024
1097
  if (hasChecks) {
1025
1098
  throw new Error(".pick() cannot be used on object schemas containing refinements");
1026
1099
  }
1027
- const def = mergeDefs(schema._zod.def, {
1028
- get shape() {
1029
- const newShape = {};
1030
- for (const key of Reflect.ownKeys(mask)) {
1031
- if (!Object.prototype.hasOwnProperty.call(currDef.shape, key)) {
1032
- throw new Error(`Unrecognized key: "${String(key)}"`);
1033
- }
1034
- if (!mask[key])
1035
- continue;
1036
- assignProp(newShape, key, currDef.shape[key]);
1037
- }
1038
- assignProp(this, "shape", newShape);
1039
- return newShape;
1040
- },
1041
- checks: []
1042
- });
1043
- return clone(schema, def);
1100
+ const newShape = {};
1101
+ mirrorShape(newShape, schema, maskedKeys(schema, mask));
1102
+ return clone(schema, mergeDefs(currDef, { shape: newShape, checks: [] }));
1103
+ }
1104
+ function maskedKeys(schema, mask) {
1105
+ const raw = sourceShape(schema);
1106
+ const keys = [];
1107
+ for (const key of Reflect.ownKeys(mask)) {
1108
+ if (!Object.getOwnPropertyDescriptor(raw, key)?.enumerable) {
1109
+ throw new Error(`Unrecognized key: "${String(key)}"`);
1110
+ }
1111
+ if (mask[key])
1112
+ keys.push(key);
1113
+ }
1114
+ return keys;
1044
1115
  }
1045
1116
  function omit(schema, mask) {
1046
1117
  const currDef = schema._zod.def;
@@ -1049,23 +1120,10 @@ function omit(schema, mask) {
1049
1120
  if (hasChecks) {
1050
1121
  throw new Error(".omit() cannot be used on object schemas containing refinements");
1051
1122
  }
1052
- const def = mergeDefs(schema._zod.def, {
1053
- get shape() {
1054
- const newShape = { ...schema._zod.def.shape };
1055
- for (const key of Reflect.ownKeys(mask)) {
1056
- if (!Object.prototype.hasOwnProperty.call(currDef.shape, key)) {
1057
- throw new Error(`Unrecognized key: "${String(key)}"`);
1058
- }
1059
- if (!mask[key])
1060
- continue;
1061
- delete newShape[key];
1062
- }
1063
- assignProp(this, "shape", newShape);
1064
- return newShape;
1065
- },
1066
- checks: []
1067
- });
1068
- return clone(schema, def);
1123
+ const omitted = new Set(maskedKeys(schema, mask));
1124
+ const newShape = {};
1125
+ mirrorShape(newShape, schema, Reflect.ownKeys(sourceShape(schema)).filter((key) => !omitted.has(key)));
1126
+ return clone(schema, mergeDefs(currDef, { shape: newShape, checks: [] }));
1069
1127
  }
1070
1128
  function extend(schema, shape) {
1071
1129
  if (!isPlainObject(shape)) {
@@ -1074,34 +1132,26 @@ function extend(schema, shape) {
1074
1132
  const checks = schema._zod.def.checks;
1075
1133
  const hasChecks = checks && checks.length > 0;
1076
1134
  if (hasChecks) {
1077
- const existingShape = schema._zod.def.shape;
1135
+ const existingShape = sourceShape(schema);
1078
1136
  for (const key of Reflect.ownKeys(shape)) {
1079
1137
  if (Object.getOwnPropertyDescriptor(existingShape, key) !== void 0) {
1080
1138
  throw new Error("Cannot overwrite keys on object schemas containing refinements. Use `.safeExtend()` instead.");
1081
1139
  }
1082
1140
  }
1083
1141
  }
1084
- const def = mergeDefs(schema._zod.def, {
1085
- get shape() {
1086
- const _shape = { ...schema._zod.def.shape, ...shape };
1087
- assignProp(this, "shape", _shape);
1088
- return _shape;
1089
- }
1090
- });
1091
- return clone(schema, def);
1142
+ return clone(schema, mergeDefs(schema._zod.def, { shape: extended(schema, shape) }));
1143
+ }
1144
+ function extended(schema, shape) {
1145
+ const newShape = {};
1146
+ mirrorShape(newShape, schema, Reflect.ownKeys(sourceShape(schema)));
1147
+ mirrorProps(newShape, shape);
1148
+ return newShape;
1092
1149
  }
1093
1150
  function safeExtend(schema, shape) {
1094
1151
  if (!isPlainObject(shape)) {
1095
1152
  throw new Error("Invalid input to safeExtend: expected a plain object");
1096
1153
  }
1097
- const def = mergeDefs(schema._zod.def, {
1098
- get shape() {
1099
- const _shape = { ...schema._zod.def.shape, ...shape };
1100
- assignProp(this, "shape", _shape);
1101
- return _shape;
1102
- }
1103
- });
1104
- return clone(schema, def);
1154
+ return clone(schema, mergeDefs(schema._zod.def, { shape: extended(schema, shape) }));
1105
1155
  }
1106
1156
  function merge(a, b) {
1107
1157
  if (!b?._zod?.def) {
@@ -1110,12 +1160,11 @@ function merge(a, b) {
1110
1160
  if (a._zod.def.checks?.length) {
1111
1161
  throw new Error(".merge() cannot be used on object schemas containing refinements. Use .safeExtend() instead.");
1112
1162
  }
1163
+ const newShape = {};
1164
+ mirrorShape(newShape, a, Reflect.ownKeys(sourceShape(a)));
1165
+ mirrorShape(newShape, b, Reflect.ownKeys(sourceShape(b)));
1113
1166
  const def = mergeDefs(a._zod.def, {
1114
- get shape() {
1115
- const _shape = { ...a._zod.def.shape, ...b._zod.def.shape };
1116
- assignProp(this, "shape", _shape);
1117
- return _shape;
1118
- },
1167
+ shape: newShape,
1119
1168
  get catchall() {
1120
1169
  return b._zod.def.catchall;
1121
1170
  },
@@ -1130,67 +1179,19 @@ function partial(Class2, schema, mask, name = "partial") {
1130
1179
  if (hasChecks) {
1131
1180
  throw new Error(`.${name}() cannot be used on object schemas containing refinements`);
1132
1181
  }
1133
- const def = mergeDefs(schema._zod.def, {
1134
- get shape() {
1135
- const oldShape = schema._zod.def.shape;
1136
- const shape = { ...oldShape };
1137
- if (mask) {
1138
- for (const key of Reflect.ownKeys(mask)) {
1139
- if (!Object.prototype.hasOwnProperty.call(oldShape, key)) {
1140
- throw new Error(`Unrecognized key: "${String(key)}"`);
1141
- }
1142
- if (!mask[key])
1143
- continue;
1144
- shape[key] = Class2 ? new Class2({
1145
- type: "optional",
1146
- innerType: oldShape[key]
1147
- }) : oldShape[key];
1148
- }
1149
- } else {
1150
- for (const key of Reflect.ownKeys(oldShape)) {
1151
- shape[key] = Class2 ? new Class2({
1152
- type: "optional",
1153
- innerType: oldShape[key]
1154
- }) : oldShape[key];
1155
- }
1156
- }
1157
- assignProp(this, "shape", shape);
1158
- return shape;
1159
- },
1160
- checks: []
1161
- });
1162
- return clone(schema, def);
1182
+ const selected = mask ? new Set(maskedKeys(schema, mask)) : void 0;
1183
+ const newShape = {};
1184
+ mirrorShape(newShape, schema, Reflect.ownKeys(sourceShape(schema)), Class2 && ((value, key) => selected && !selected.has(key) ? value : new Class2({ type: "optional", innerType: value })));
1185
+ return clone(schema, mergeDefs(schema._zod.def, { shape: newShape, checks: [] }));
1163
1186
  }
1164
1187
  function required(Class2, schema, mask) {
1165
- const def = mergeDefs(schema._zod.def, {
1166
- get shape() {
1167
- const oldShape = schema._zod.def.shape;
1168
- const shape = { ...oldShape };
1169
- if (mask) {
1170
- for (const key of Reflect.ownKeys(mask)) {
1171
- if (!Object.prototype.hasOwnProperty.call(shape, key)) {
1172
- throw new Error(`Unrecognized key: "${String(key)}"`);
1173
- }
1174
- if (!mask[key])
1175
- continue;
1176
- shape[key] = new Class2({
1177
- type: "nonoptional",
1178
- innerType: oldShape[key]
1179
- });
1180
- }
1181
- } else {
1182
- for (const key of Reflect.ownKeys(oldShape)) {
1183
- shape[key] = new Class2({
1184
- type: "nonoptional",
1185
- innerType: oldShape[key]
1186
- });
1187
- }
1188
- }
1189
- assignProp(this, "shape", shape);
1190
- return shape;
1191
- }
1192
- });
1193
- return clone(schema, def);
1188
+ const selected = mask ? new Set(maskedKeys(schema, mask)) : void 0;
1189
+ const newShape = {};
1190
+ mirrorShape(newShape, schema, Reflect.ownKeys(sourceShape(schema)), (value, key) => (
1191
+ // overwrite with non-optional
1192
+ selected && !selected.has(key) ? value : new Class2({ type: "nonoptional", innerType: value })
1193
+ ));
1194
+ return clone(schema, mergeDefs(schema._zod.def, { shape: newShape }));
1194
1195
  }
1195
1196
  function aborted(x, startIndex = 0) {
1196
1197
  if (x.aborted === true)
@@ -1223,6 +1224,18 @@ function prefixIssues(path, issues) {
1223
1224
  function unwrapMessage(message) {
1224
1225
  return typeof message === "string" ? message : message?.message;
1225
1226
  }
1227
+ function sizeCaps(defChecks) {
1228
+ const caps = [];
1229
+ for (const ch of defChecks ?? []) {
1230
+ const d = ch._zod.def;
1231
+ if (!/_(length|size)$|_equals$/.test(d.check))
1232
+ break;
1233
+ const max = d.maximum ?? d.length ?? d.size;
1234
+ if (max >= 0)
1235
+ caps.push([max, ch]);
1236
+ }
1237
+ return caps;
1238
+ }
1226
1239
  function attachSchema(issues, start, inst) {
1227
1240
  var _a3;
1228
1241
  for (let i = start; i < issues.length; i++) {
@@ -1240,13 +1253,18 @@ function finalizeIssue(iss, ctx, config2) {
1240
1253
  }
1241
1254
  const schemaError = iss.schema !== iss.inst ? iss.schema?._zod.def?.error : void 0;
1242
1255
  const message = iss.message ? iss.message : unwrapMessage(iss.inst?._zod.def?.error?.(iss)) ?? unwrapMessage(schemaError?.(iss)) ?? unwrapMessage(ctx?.error?.(iss)) ?? unwrapMessage(config2.customError?.(iss)) ?? unwrapMessage(config2.localeError?.(iss)) ?? "Invalid input";
1243
- const { inst: _inst, schema: _schema, continue: _continue, input: _input, ...rest } = iss;
1244
- rest.path ?? (rest.path = []);
1245
- rest.message = message;
1256
+ const full = {};
1257
+ for (const k of Object.keys(iss)) {
1258
+ if (k === "inst" || k === "schema" || k === "continue" || k === "input" || k === "__proto__")
1259
+ continue;
1260
+ full[k] = iss[k];
1261
+ }
1262
+ full.path ?? (full.path = []);
1263
+ full.message = message;
1246
1264
  if (ctx?.reportInput) {
1247
- rest.input = _input;
1265
+ full.input = iss.input;
1248
1266
  }
1249
- return rest;
1267
+ return full;
1250
1268
  }
1251
1269
  function getSizableOrigin(input2) {
1252
1270
  if (input2 instanceof Set)
@@ -1373,6 +1391,23 @@ function own(inst, key, value, enumerable = true) {
1373
1391
  function hide(inst, key, value) {
1374
1392
  return own(inst, key, value, false);
1375
1393
  }
1394
+ // @__NO_SIDE_EFFECTS__
1395
+ function derived(computes, table) {
1396
+ for (const key in computes) {
1397
+ const compute = computes[key];
1398
+ Object.defineProperty(table, key, {
1399
+ configurable: true,
1400
+ enumerable: true,
1401
+ get() {
1402
+ return own(this, key, compute(this));
1403
+ },
1404
+ set(value) {
1405
+ own(this, key, value);
1406
+ }
1407
+ });
1408
+ }
1409
+ return table;
1410
+ }
1376
1411
  function defineBound(proto, key, fn) {
1377
1412
  Object.defineProperty(proto, key, {
1378
1413
  configurable: true,
@@ -1500,8 +1535,7 @@ function $constructor(name, initializer3, proto, params) {
1500
1535
  } finally {
1501
1536
  _zodDesc.value = void 0;
1502
1537
  }
1503
- }
1504
- if (inst._zod.traits.has(name)) {
1538
+ } else if (inst._zod.traits.has(name)) {
1505
1539
  return;
1506
1540
  }
1507
1541
  inst._zod.traits.add(name);
@@ -1592,16 +1626,12 @@ var _messageDesc = {
1592
1626
  enumerable: true,
1593
1627
  configurable: true
1594
1628
  };
1595
- var _zodDesc2 = { value: void 0, enumerable: false };
1596
1629
  var _issuesDesc = { value: void 0, enumerable: false };
1597
1630
  var _installedToString = /* @__PURE__ */ new WeakSet([Object.prototype, Error.prototype]);
1598
1631
  var initializer = (inst, def) => {
1599
1632
  inst.name = "$ZodError";
1600
- _zodDesc2.value = inst._zod;
1601
- Object.defineProperty(inst, "_zod", _zodDesc2);
1602
1633
  _issuesDesc.value = def;
1603
1634
  Object.defineProperty(inst, "issues", _issuesDesc);
1604
- _zodDesc2.value = void 0;
1605
1635
  _issuesDesc.value = void 0;
1606
1636
  Object.defineProperty(inst, "message", _messageDesc);
1607
1637
  const proto = Object.getPrototypeOf(inst);
@@ -1635,10 +1665,10 @@ function node(obj, key, make) {
1635
1665
  }
1636
1666
  return obj[key];
1637
1667
  }
1638
- function flattenError(error61, mapper = (issue2) => issue2.message) {
1668
+ function flattenError(error62, mapper = (issue2) => issue2.message) {
1639
1669
  const fieldErrors = {};
1640
1670
  const formErrors = [];
1641
- for (const sub of error61.issues) {
1671
+ for (const sub of error62.issues) {
1642
1672
  if (sub.path.length > 0) {
1643
1673
  node(fieldErrors, sub.path[0], () => []).push(mapper(sub));
1644
1674
  } else {
@@ -1647,10 +1677,10 @@ function flattenError(error61, mapper = (issue2) => issue2.message) {
1647
1677
  }
1648
1678
  return { formErrors, fieldErrors };
1649
1679
  }
1650
- function formatError(error61, mapper = (issue2) => issue2.message) {
1680
+ function formatError(error62, mapper = (issue2) => issue2.message) {
1651
1681
  const fieldErrors = { _errors: [] };
1652
- const processError = (error62, path = []) => {
1653
- for (const issue2 of error62.issues) {
1682
+ const processError = (error63, path = []) => {
1683
+ for (const issue2 of error63.issues) {
1654
1684
  if (issue2.code === "invalid_union" && issue2.errors.length) {
1655
1685
  issue2.errors.map((issues) => processError({ issues }, [...path, ...issue2.path]));
1656
1686
  } else if (issue2.code === "invalid_key") {
@@ -1692,14 +1722,14 @@ function formatError(error61, mapper = (issue2) => issue2.message) {
1692
1722
  }
1693
1723
  }
1694
1724
  };
1695
- processError(error61);
1725
+ processError(error62);
1696
1726
  return fieldErrors;
1697
1727
  }
1698
- function treeifyError(error61, mapper = (issue2) => issue2.message) {
1728
+ function treeifyError(error62, mapper = (issue2) => issue2.message) {
1699
1729
  const result = { errors: [] };
1700
- const processError = (error62, path = []) => {
1730
+ const processError = (error63, path = []) => {
1701
1731
  var _a3;
1702
- for (const issue2 of error62.issues) {
1732
+ for (const issue2 of error63.issues) {
1703
1733
  if (issue2.code === "invalid_union" && issue2.errors.length) {
1704
1734
  issue2.errors.map((issues) => processError({ issues }, [...path, ...issue2.path]));
1705
1735
  } else if (issue2.code === "invalid_key") {
@@ -1741,7 +1771,7 @@ function treeifyError(error61, mapper = (issue2) => issue2.message) {
1741
1771
  }
1742
1772
  }
1743
1773
  };
1744
- processError(error61);
1774
+ processError(error62);
1745
1775
  return result;
1746
1776
  }
1747
1777
  function toDotPath(_path) {
@@ -1762,9 +1792,9 @@ function toDotPath(_path) {
1762
1792
  }
1763
1793
  return segs.join("");
1764
1794
  }
1765
- function prettifyError(error61) {
1795
+ function prettifyError(error62) {
1766
1796
  const lines = [];
1767
- const issues = [...error61.issues].sort((a, b) => (a.path ?? []).length - (b.path ?? []).length);
1797
+ const issues = [...error62.issues].sort((a, b) => (a.path ?? []).length - (b.path ?? []).length);
1768
1798
  for (const issue2 of issues) {
1769
1799
  lines.push(`\u2716 ${issue2.message}`);
1770
1800
  if (issue2.path?.length)
@@ -1816,33 +1846,50 @@ var _safeParse = (_Err) => (schema, value, _ctx) => {
1816
1846
  if (result instanceof Promise) {
1817
1847
  throw new $ZodAsyncError();
1818
1848
  }
1819
- return result.issues.length ? {
1820
- success: false,
1821
- error: new (_Err ?? $ZodError)(result.issues.map((iss) => finalizeIssue(iss, ctx, config())))
1822
- } : { success: true, data: result.value };
1849
+ return result.issues.length ? failure(_Err, result.issues, ctx) : { success: true, data: result.value };
1823
1850
  };
1824
1851
  var safeParse = /* @__PURE__ */ _safeParse($ZodRealError);
1852
+ function failure(Err, issues, ctx) {
1853
+ let error62;
1854
+ return {
1855
+ success: false,
1856
+ get error() {
1857
+ if (!error62) {
1858
+ error62 = new Err(issues.map((iss) => finalizeIssue(iss, ctx, config())));
1859
+ issues = void 0;
1860
+ ctx = void 0;
1861
+ }
1862
+ return error62;
1863
+ },
1864
+ set error(e) {
1865
+ error62 = e;
1866
+ issues = void 0;
1867
+ ctx = void 0;
1868
+ }
1869
+ };
1870
+ }
1825
1871
  var _safeParseAsync = (_Err) => async (schema, value, _ctx) => {
1826
1872
  const ctx = _ctx ? { ..._ctx, async: true } : { async: true };
1827
1873
  let result = schema._zod.run({ value, issues: [] }, ctx);
1828
1874
  if (result instanceof Promise)
1829
1875
  result = await result;
1830
- return result.issues.length ? {
1831
- success: false,
1832
- error: new _Err(result.issues.map((iss) => finalizeIssue(iss, ctx, config())))
1833
- } : { success: true, data: result.value };
1876
+ return result.issues.length ? failure(_Err, result.issues, ctx) : { success: true, data: result.value };
1834
1877
  };
1835
1878
  var safeParseAsync = /* @__PURE__ */ _safeParseAsync($ZodRealError);
1836
1879
  var COMPILE_INVALID = /* @__PURE__ */ Symbol.for("zod.compile.invalid");
1837
1880
  var COMPILE_FALLBACK = /* @__PURE__ */ Symbol.for("zod.compile.fallback");
1838
1881
  var validate = ((schema, value, _ctx) => {
1839
1882
  const validator = schema._zod.bag.validator;
1840
- if (validator !== void 0 && validator(value) !== COMPILE_INVALID)
1841
- return true;
1883
+ if (validator !== void 0) {
1884
+ if (validator(value) !== COMPILE_INVALID)
1885
+ return true;
1886
+ if (validator.definite === true && _ctx === void 0)
1887
+ return false;
1888
+ }
1842
1889
  return validateFallback(schema, value, _ctx);
1843
1890
  });
1844
1891
  function validateFallback(schema, value, _ctx) {
1845
- const ctx = _ctx ? { ..._ctx, async: false } : { async: false };
1892
+ const ctx = _ctx ? { ..._ctx, async: false, abortEarly: true } : { async: false, abortEarly: true };
1846
1893
  const fallbackRun = schema._zod.bag.fallbackRun;
1847
1894
  let result;
1848
1895
  if (fallbackRun) {
@@ -1857,7 +1904,7 @@ function validateFallback(schema, value, _ctx) {
1857
1904
  return result.issues.length === 0;
1858
1905
  }
1859
1906
  var validateAsync = async (schema, value, _ctx) => {
1860
- const ctx = _ctx ? { ..._ctx, async: true } : { async: true };
1907
+ const ctx = _ctx ? { ..._ctx, async: true, abortEarly: true } : { async: true, abortEarly: true };
1861
1908
  let result = schema._zod.run({ value, issues: [] }, ctx);
1862
1909
  if (result instanceof Promise)
1863
1910
  result = await result;
@@ -1919,6 +1966,7 @@ var safeDecodeAsync = /* @__PURE__ */ _safeDecodeAsync($ZodRealError);
1919
1966
  // node_modules/zod/v4/core/regexes.js
1920
1967
  var regexes_exports = {};
1921
1968
  __export(regexes_exports, {
1969
+ anyString: () => anyString,
1922
1970
  base64: () => base64,
1923
1971
  base64url: () => base64url,
1924
1972
  bigint: () => bigint,
@@ -1929,6 +1977,7 @@ __export(regexes_exports, {
1929
1977
  creditCard: () => creditCard,
1930
1978
  cuid: () => cuid,
1931
1979
  cuid2: () => cuid2,
1980
+ currencyCode: () => currencyCode,
1932
1981
  date: () => date,
1933
1982
  datetime: () => datetime,
1934
1983
  domain: () => domain,
@@ -1942,6 +1991,7 @@ __export(regexes_exports, {
1942
1991
  hostname: () => hostname,
1943
1992
  html5Email: () => html5Email,
1944
1993
  httpProtocol: () => httpProtocol,
1994
+ iban: () => iban,
1945
1995
  idnEmail: () => idnEmail,
1946
1996
  integer: () => integer,
1947
1997
  ipv4: () => ipv4,
@@ -2001,13 +2051,13 @@ var uuid = (version3) => {
2001
2051
  var uuid4 = /* @__PURE__ */ uuid(4);
2002
2052
  var uuid6 = /* @__PURE__ */ uuid(6);
2003
2053
  var uuid7 = /* @__PURE__ */ uuid(7);
2004
- var email = /^(?!\.)(?!.*\.\.)([A-Za-z0-9_'+\-\.]*)[A-Za-z0-9_+-]@([A-Za-z0-9][A-Za-z0-9\-]*\.)+[A-Za-z]{2,}$/;
2054
+ var email = /^(?:[A-Za-z0-9_'+\-]+\.)*[A-Za-z0-9_'+\-]*[A-Za-z0-9_+-]@(?:[A-Za-z0-9][A-Za-z0-9\-]*\.)+[A-Za-z]{2,}$/;
2005
2055
  var html5Email = /^[a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+@[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)*$/;
2006
2056
  var rfc5322Email = /^(([^<>()\[\]\\.,;:\s@"]+(\.[^<>()\[\]\\.,;:\s@"]+)*)|(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/;
2007
2057
  var unicodeEmail = /^[^\s@"]{1,64}@[^\s@]{1,255}$/u;
2008
2058
  var idnEmail = unicodeEmail;
2009
2059
  var browserEmail = /^[a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+@[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)*$/;
2010
- var _emoji = `^[\\p{Extended_Pictographic}\\p{Emoji_Component}]+$`;
2060
+ var _emoji = `^(?=[\\s\\S]*[\\p{Extended_Pictographic}\\p{Regional_Indicator}\\u20E3])[\\p{Extended_Pictographic}\\p{Emoji_Component}]+$`;
2011
2061
  function emoji() {
2012
2062
  return new RegExp(_emoji, "u");
2013
2063
  }
@@ -2020,12 +2070,14 @@ var mac = (delimiter) => {
2020
2070
  var 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])$/;
2021
2071
  var cidrv6 = /^(([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}|:))\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/;
2022
2072
  var base64 = /^$|^(?:[0-9a-zA-Z+/]{4})*(?:(?:[0-9a-zA-Z+/]{2}==)|(?:[0-9a-zA-Z+/]{3}=))?$/;
2023
- var base64url = /^[A-Za-z0-9_-]*$/;
2073
+ var base64url = /^(?:[A-Za-z0-9_-]{4})*(?:[A-Za-z0-9_-]{2,3})?$/;
2024
2074
  var hostname = /^(?=.{1,253}\.?$)[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[-0-9a-zA-Z]{0,61}[0-9a-zA-Z])?)*\.?$/;
2025
2075
  var domain = /^(?=.{1,253}$)([a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?\.)+[a-zA-Z]{2,63}$/;
2026
2076
  var httpProtocol = /^https?$/;
2027
2077
  var e164 = /^\+[1-9]\d{6,14}$/;
2028
2078
  var creditCard = /^\d(?:[ -]?\d){11,18}$/;
2079
+ var currencyCode = /^(?:AED|AFN|ALL|AMD|AOA|ARS|AUD|AWG|AZN|BAM|BBD|BDT|BHD|BIF|BMD|BND|BOB|BOV|BRL|BSD|BTN|BWP|BYN|BZD|CAD|CDF|CHE|CHF|CHW|CLF|CLP|CNY|COP|COU|CRC|CUP|CVE|CZK|DJF|DKK|DOP|DZD|EGP|ERN|ETB|EUR|FJD|FKP|GBP|GEL|GHS|GIP|GMD|GNF|GTQ|GYD|HKD|HNL|HTG|HUF|IDR|ILS|INR|IQD|IRR|ISK|JMD|JOD|JPY|KES|KGS|KHR|KMF|KPW|KRW|KWD|KYD|KZT|LAK|LBP|LKR|LRD|LSL|LYD|MAD|MDL|MGA|MKD|MMK|MNT|MOP|MRU|MUR|MVR|MWK|MXN|MXV|MYR|MZN|NAD|NGN|NIO|NOK|NPR|NZD|OMR|PAB|PEN|PGK|PHP|PKR|PLN|PYG|QAR|RON|RSD|RUB|RWF|SAR|SBD|SCR|SDG|SEK|SGD|SHP|SLE|SOS|SRD|SSP|STN|SVC|SYP|SZL|THB|TJS|TMT|TND|TOP|TRY|TTD|TWD|TZS|UAH|UGX|USD|USN|UYI|UYU|UYW|UZS|VED|VES|VND|VUV|WST|XAD|XAF|XAG|XAU|XBA|XBB|XBC|XBD|XCD|XCG|XDR|XOF|XPD|XPF|XPT|XSU|XTS|XUA|XXX|YER|ZAR|ZMW|ZWG)$/;
2080
+ var iban = /^[A-Z]{2}(?!00|01|99)\d{2}[A-Z0-9]{11,30}$/;
2029
2081
  var dateSource = `(?:(?:\\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])))`;
2030
2082
  function anchor(source) {
2031
2083
  return new RegExp(`^${source}$`);
@@ -2047,6 +2099,7 @@ function datetime(args) {
2047
2099
  const timeRegex = args.local ? `${qualified}|${timeSource({ precision: args.precision })}` : qualified;
2048
2100
  return new RegExp(`^${dateSource}T(?:${timeRegex})$`);
2049
2101
  }
2102
+ var anyString = /^[\s\S]{0,}$/;
2050
2103
  var string = (params) => {
2051
2104
  const regex = params ? `[\\s\\S]{${params?.minimum ?? 0},${params?.maximum ?? ""}}` : `[\\s\\S]*`;
2052
2105
  return new RegExp(`^${regex}$`);
@@ -2105,16 +2158,6 @@ var numericOriginMap = {
2105
2158
  var $ZodCheckLessThan = /* @__PURE__ */ $constructor("$ZodCheckLessThan", (inst, def) => {
2106
2159
  $ZodCheck.init(inst, def);
2107
2160
  const origin = numericOriginMap[typeof def.value];
2108
- inst._zod.onattach.push((inst2) => {
2109
- const bag = inst2._zod.bag;
2110
- const curr = (def.inclusive ? bag.maximum : bag.exclusiveMaximum) ?? Number.POSITIVE_INFINITY;
2111
- if (def.value < curr) {
2112
- if (def.inclusive)
2113
- bag.maximum = def.value;
2114
- else
2115
- bag.exclusiveMaximum = def.value;
2116
- }
2117
- });
2118
2161
  inst._zod.check = (payload) => {
2119
2162
  if (def.inclusive ? payload.value <= def.value : payload.value < def.value) {
2120
2163
  return;
@@ -2133,16 +2176,6 @@ var $ZodCheckLessThan = /* @__PURE__ */ $constructor("$ZodCheckLessThan", (inst,
2133
2176
  var $ZodCheckGreaterThan = /* @__PURE__ */ $constructor("$ZodCheckGreaterThan", (inst, def) => {
2134
2177
  $ZodCheck.init(inst, def);
2135
2178
  const origin = numericOriginMap[typeof def.value];
2136
- inst._zod.onattach.push((inst2) => {
2137
- const bag = inst2._zod.bag;
2138
- const curr = (def.inclusive ? bag.minimum : bag.exclusiveMinimum) ?? Number.NEGATIVE_INFINITY;
2139
- if (def.value > curr) {
2140
- if (def.inclusive)
2141
- bag.minimum = def.value;
2142
- else
2143
- bag.exclusiveMinimum = def.value;
2144
- }
2145
- });
2146
2179
  inst._zod.check = (payload) => {
2147
2180
  if (def.inclusive ? payload.value >= def.value : payload.value > def.value) {
2148
2181
  return;
@@ -2160,10 +2193,6 @@ var $ZodCheckGreaterThan = /* @__PURE__ */ $constructor("$ZodCheckGreaterThan",
2160
2193
  });
2161
2194
  var $ZodCheckMultipleOf = /* @__PURE__ */ $constructor("$ZodCheckMultipleOf", (inst, def) => {
2162
2195
  $ZodCheck.init(inst, def);
2163
- inst._zod.onattach.push((inst2) => {
2164
- var _a3;
2165
- (_a3 = inst2._zod.bag).multipleOf ?? (_a3.multipleOf = def.value);
2166
- });
2167
2196
  inst._zod.check = (payload) => {
2168
2197
  if (typeof payload.value !== typeof def.value)
2169
2198
  throw new Error("Cannot mix number and bigint in multiple_of check.");
@@ -2189,14 +2218,6 @@ var $ZodCheckNumberFormat = /* @__PURE__ */ $constructor("$ZodCheckNumberFormat"
2189
2218
  const isInt = def.format?.includes("int");
2190
2219
  const origin = isInt ? "int" : "number";
2191
2220
  const [minimum, maximum] = NUMBER_FORMAT_RANGES[def.format];
2192
- inst._zod.onattach.push((inst2) => {
2193
- const bag = inst2._zod.bag;
2194
- bag.format = def.format;
2195
- bag.minimum = minimum;
2196
- bag.maximum = maximum;
2197
- if (isInt)
2198
- bag.pattern = integer;
2199
- });
2200
2221
  inst._zod.check = (payload) => {
2201
2222
  const input2 = payload.value;
2202
2223
  if (isInt) {
@@ -2265,12 +2286,6 @@ var $ZodCheckNumberFormat = /* @__PURE__ */ $constructor("$ZodCheckNumberFormat"
2265
2286
  var $ZodCheckBigIntFormat = /* @__PURE__ */ $constructor("$ZodCheckBigIntFormat", (inst, def) => {
2266
2287
  $ZodCheck.init(inst, def);
2267
2288
  const [minimum, maximum] = BIGINT_FORMAT_RANGES[def.format];
2268
- inst._zod.onattach.push((inst2) => {
2269
- const bag = inst2._zod.bag;
2270
- bag.format = def.format;
2271
- bag.minimum = minimum;
2272
- bag.maximum = maximum;
2273
- });
2274
2289
  inst._zod.check = (payload) => {
2275
2290
  const input2 = payload.value;
2276
2291
  if (input2 < minimum) {
@@ -2301,11 +2316,6 @@ var $ZodCheckMaxSize = /* @__PURE__ */ $constructor("$ZodCheckMaxSize", (inst, d
2301
2316
  var _a3;
2302
2317
  $ZodCheck.init(inst, def);
2303
2318
  (_a3 = inst._zod.def).when ?? (_a3.when = _whenHasSize);
2304
- inst._zod.onattach.push((inst2) => {
2305
- const curr = inst2._zod.bag.maximum ?? Number.POSITIVE_INFINITY;
2306
- if (def.maximum < curr)
2307
- inst2._zod.bag.maximum = def.maximum;
2308
- });
2309
2319
  inst._zod.check = (payload) => {
2310
2320
  const input2 = payload.value;
2311
2321
  const size = input2.size;
@@ -2326,11 +2336,6 @@ var $ZodCheckMinSize = /* @__PURE__ */ $constructor("$ZodCheckMinSize", (inst, d
2326
2336
  var _a3;
2327
2337
  $ZodCheck.init(inst, def);
2328
2338
  (_a3 = inst._zod.def).when ?? (_a3.when = _whenHasSize);
2329
- inst._zod.onattach.push((inst2) => {
2330
- const curr = inst2._zod.bag.minimum ?? Number.NEGATIVE_INFINITY;
2331
- if (def.minimum > curr)
2332
- inst2._zod.bag.minimum = def.minimum;
2333
- });
2334
2339
  inst._zod.check = (payload) => {
2335
2340
  const input2 = payload.value;
2336
2341
  const size = input2.size;
@@ -2351,12 +2356,6 @@ var $ZodCheckSizeEquals = /* @__PURE__ */ $constructor("$ZodCheckSizeEquals", (i
2351
2356
  var _a3;
2352
2357
  $ZodCheck.init(inst, def);
2353
2358
  (_a3 = inst._zod.def).when ?? (_a3.when = _whenHasSize);
2354
- inst._zod.onattach.push((inst2) => {
2355
- const bag = inst2._zod.bag;
2356
- bag.minimum = def.size;
2357
- bag.maximum = def.size;
2358
- bag.size = def.size;
2359
- });
2360
2359
  inst._zod.check = (payload) => {
2361
2360
  const input2 = payload.value;
2362
2361
  const size = input2.size;
@@ -2378,11 +2377,6 @@ var $ZodCheckMaxLength = /* @__PURE__ */ $constructor("$ZodCheckMaxLength", (ins
2378
2377
  var _a3;
2379
2378
  $ZodCheck.init(inst, def);
2380
2379
  (_a3 = inst._zod.def).when ?? (_a3.when = _whenHasLength);
2381
- inst._zod.onattach.push((inst2) => {
2382
- const curr = inst2._zod.bag.maximum ?? Number.POSITIVE_INFINITY;
2383
- if (def.maximum < curr)
2384
- inst2._zod.bag.maximum = def.maximum;
2385
- });
2386
2380
  inst._zod.check = (payload) => {
2387
2381
  const input2 = payload.value;
2388
2382
  const units = input2.length;
@@ -2405,11 +2399,6 @@ var $ZodCheckMinLength = /* @__PURE__ */ $constructor("$ZodCheckMinLength", (ins
2405
2399
  var _a3;
2406
2400
  $ZodCheck.init(inst, def);
2407
2401
  (_a3 = inst._zod.def).when ?? (_a3.when = _whenHasLength);
2408
- inst._zod.onattach.push((inst2) => {
2409
- const curr = inst2._zod.bag.minimum ?? Number.NEGATIVE_INFINITY;
2410
- if (def.minimum > curr)
2411
- inst2._zod.bag.minimum = def.minimum;
2412
- });
2413
2402
  inst._zod.check = (payload) => {
2414
2403
  const input2 = payload.value;
2415
2404
  const units = input2.length;
@@ -2432,12 +2421,6 @@ var $ZodCheckLengthEquals = /* @__PURE__ */ $constructor("$ZodCheckLengthEquals"
2432
2421
  var _a3;
2433
2422
  $ZodCheck.init(inst, def);
2434
2423
  (_a3 = inst._zod.def).when ?? (_a3.when = _whenHasLength);
2435
- inst._zod.onattach.push((inst2) => {
2436
- const bag = inst2._zod.bag;
2437
- bag.minimum = def.length;
2438
- bag.maximum = def.length;
2439
- bag.length = def.length;
2440
- });
2441
2424
  inst._zod.check = (payload) => {
2442
2425
  const input2 = payload.value;
2443
2426
  const units = input2.length;
@@ -2460,14 +2443,6 @@ var $ZodCheckLengthEquals = /* @__PURE__ */ $constructor("$ZodCheckLengthEquals"
2460
2443
  var $ZodCheckStringFormat = /* @__PURE__ */ $constructor("$ZodCheckStringFormat", (inst, def) => {
2461
2444
  var _a3, _b;
2462
2445
  $ZodCheck.init(inst, def);
2463
- inst._zod.onattach.push((inst2) => {
2464
- const bag = inst2._zod.bag;
2465
- bag.format = def.format;
2466
- if (def.pattern) {
2467
- bag.patterns ?? (bag.patterns = /* @__PURE__ */ new Set());
2468
- bag.patterns.add(def.pattern);
2469
- }
2470
- });
2471
2446
  if (def.pattern)
2472
2447
  (_a3 = inst._zod).check ?? (_a3.check = (payload) => {
2473
2448
  def.pattern.lastIndex = 0;
@@ -2517,11 +2492,6 @@ var $ZodCheckIncludes = /* @__PURE__ */ $constructor("$ZodCheckIncludes", (inst,
2517
2492
  const escapedRegex = escapeRegex(def.includes);
2518
2493
  const pattern = new RegExp(typeof def.position === "number" ? `^.{${def.position},}${escapedRegex}` : escapedRegex);
2519
2494
  def.pattern = pattern;
2520
- inst._zod.onattach.push((inst2) => {
2521
- const bag = inst2._zod.bag;
2522
- bag.patterns ?? (bag.patterns = /* @__PURE__ */ new Set());
2523
- bag.patterns.add(pattern);
2524
- });
2525
2495
  inst._zod.check = (payload) => {
2526
2496
  if (payload.value.includes(def.includes, def.position))
2527
2497
  return;
@@ -2540,11 +2510,6 @@ var $ZodCheckStartsWith = /* @__PURE__ */ $constructor("$ZodCheckStartsWith", (i
2540
2510
  $ZodCheck.init(inst, def);
2541
2511
  const pattern = new RegExp(`^${escapeRegex(def.prefix)}.*`);
2542
2512
  def.pattern ?? (def.pattern = pattern);
2543
- inst._zod.onattach.push((inst2) => {
2544
- const bag = inst2._zod.bag;
2545
- bag.patterns ?? (bag.patterns = /* @__PURE__ */ new Set());
2546
- bag.patterns.add(pattern);
2547
- });
2548
2513
  inst._zod.check = (payload) => {
2549
2514
  if (payload.value.startsWith(def.prefix))
2550
2515
  return;
@@ -2563,11 +2528,6 @@ var $ZodCheckEndsWith = /* @__PURE__ */ $constructor("$ZodCheckEndsWith", (inst,
2563
2528
  $ZodCheck.init(inst, def);
2564
2529
  const pattern = new RegExp(`.*${escapeRegex(def.suffix)}$`);
2565
2530
  def.pattern ?? (def.pattern = pattern);
2566
- inst._zod.onattach.push((inst2) => {
2567
- const bag = inst2._zod.bag;
2568
- bag.patterns ?? (bag.patterns = /* @__PURE__ */ new Set());
2569
- bag.patterns.add(pattern);
2570
- });
2571
2531
  inst._zod.check = (payload) => {
2572
2532
  if (payload.value.endsWith(def.suffix))
2573
2533
  return;
@@ -2601,12 +2561,37 @@ var $ZodCheckProperty = /* @__PURE__ */ $constructor("$ZodCheckProperty", (inst,
2601
2561
  return;
2602
2562
  };
2603
2563
  });
2564
+ var $ZodCheckProperties = /* @__PURE__ */ $constructor("$ZodCheckProperties", (inst, def) => {
2565
+ $ZodCheck.init(inst, def);
2566
+ hide(inst, Symbol.iterator, function* () {
2567
+ yield inst;
2568
+ });
2569
+ let entries;
2570
+ inst._zod.check = (payload) => {
2571
+ if (payload.value == null) {
2572
+ payload.issues.push({ expected: "object", code: "invalid_type", input: payload.value, inst });
2573
+ return void 0;
2574
+ }
2575
+ entries ?? (entries = Reflect.ownKeys(def.shape).map((key) => [key, def.shape[key]]));
2576
+ const input2 = payload.value;
2577
+ let proms;
2578
+ for (const [key, schema] of entries) {
2579
+ const result = schema._zod.run({ value: input2[key], issues: [] }, {});
2580
+ if (result instanceof Promise) {
2581
+ proms ?? (proms = []);
2582
+ proms.push(result.then((result2) => handleCheckPropertyResult(result2, payload, key)));
2583
+ } else {
2584
+ handleCheckPropertyResult(result, payload, key);
2585
+ }
2586
+ }
2587
+ if (proms)
2588
+ return Promise.all(proms).then(() => void 0);
2589
+ return void 0;
2590
+ };
2591
+ });
2604
2592
  var $ZodCheckMimeType = /* @__PURE__ */ $constructor("$ZodCheckMimeType", (inst, def) => {
2605
2593
  $ZodCheck.init(inst, def);
2606
2594
  const mimeSet = new Set(def.mime);
2607
- inst._zod.onattach.push((inst2) => {
2608
- inst2._zod.bag.mime = def.mime;
2609
- });
2610
2595
  inst._zod.check = (payload) => {
2611
2596
  if (mimeSet.has(payload.value.type))
2612
2597
  return;
@@ -2634,10 +2619,14 @@ var Doc = class {
2634
2619
  this.args = args;
2635
2620
  this.closed = closed;
2636
2621
  }
2622
+ // the compiler catches a child's throw and keeps writing into this doc, so the indent has to unwind with it
2637
2623
  indented(fn) {
2638
2624
  this.indent += 1;
2639
- fn(this);
2640
- this.indent -= 1;
2625
+ try {
2626
+ fn(this);
2627
+ } finally {
2628
+ this.indent -= 1;
2629
+ }
2641
2630
  }
2642
2631
  write(arg) {
2643
2632
  if (typeof arg === "function") {
@@ -2666,8 +2655,8 @@ ${content.join("\n")}
2666
2655
  // node_modules/zod/v4/core/versions.js
2667
2656
  var version2 = {
2668
2657
  major: 4,
2669
- minor: 5,
2670
- patch: 4
2658
+ minor: 6,
2659
+ patch: 7
2671
2660
  };
2672
2661
 
2673
2662
  // node_modules/zod/v4/core/schemas.js
@@ -2780,15 +2769,22 @@ var $ZodType = /* @__PURE__ */ $constructor("$ZodType", (inst, def) => {
2780
2769
  own(this, "~standard", value);
2781
2770
  }
2782
2771
  });
2783
- var toStandardResult = (r) => r.success ? { value: r.data } : { issues: r.error?.issues };
2772
+ var toStandardResult = (r, ctx) => r.issues.length ? { issues: r.issues.map((iss) => finalizeIssue(iss, ctx, config())) } : { value: r.value };
2773
+ async function validateAsync2(inst, value) {
2774
+ const ctx = { async: true };
2775
+ return toStandardResult(await inst._zod.run({ value, issues: [] }, ctx), ctx);
2776
+ }
2784
2777
  function standardProps(inst) {
2785
2778
  return {
2786
2779
  validate: (value) => {
2780
+ const ctx = { async: false };
2787
2781
  try {
2788
- return toStandardResult(safeParse(inst, value));
2782
+ const r = inst._zod.run({ value, issues: [] }, ctx);
2783
+ if (!(r instanceof Promise))
2784
+ return toStandardResult(r, ctx);
2789
2785
  } catch (_) {
2790
- return safeParseAsync(inst, value).then(toStandardResult);
2791
2786
  }
2787
+ return validateAsync2(inst, value);
2792
2788
  },
2793
2789
  vendor: "zod",
2794
2790
  version: 1
@@ -2796,7 +2792,7 @@ function standardProps(inst) {
2796
2792
  }
2797
2793
  var $ZodString = /* @__PURE__ */ $constructor("$ZodString", (inst, def) => {
2798
2794
  $ZodType.init(inst, def);
2799
- inst._zod.pattern = [...inst?._zod.bag?.patterns ?? []].pop() ?? string(inst._zod.bag);
2795
+ inst._zod.pattern = def.pattern ?? anyString;
2800
2796
  inst._zod.parse = (payload, _) => {
2801
2797
  if (def.coerce)
2802
2798
  try {
@@ -2848,11 +2844,32 @@ var $ZodEmail = /* @__PURE__ */ $constructor("$ZodEmail", (inst, def) => {
2848
2844
  });
2849
2845
  var URL_BAD_FORMAT = 1;
2850
2846
  var URL_UNPARSEABLE = 2;
2847
+ function canParseURL(input2) {
2848
+ try {
2849
+ if (typeof URL !== "undefined" && typeof URL.canParse === "function")
2850
+ return URL.canParse(input2);
2851
+ new URL(input2);
2852
+ return true;
2853
+ } catch {
2854
+ return false;
2855
+ }
2856
+ }
2857
+ function validateURL(trimmed, def) {
2858
+ if (!("normalize" in def) && !("hostname" in def) && !("protocol" in def)) {
2859
+ return canParseURL(trimmed) || URL_UNPARSEABLE;
2860
+ }
2861
+ return parseURLObject(trimmed, def);
2862
+ }
2851
2863
  function parseURLObject(trimmed, def) {
2852
2864
  if (!def.normalize && def.protocol?.source === httpProtocol.source && !/^https?:\/\//i.test(trimmed)) {
2853
2865
  return URL_BAD_FORMAT;
2854
2866
  }
2855
2867
  try {
2868
+ if (typeof URL !== "undefined") {
2869
+ const URLStatic = URL;
2870
+ if (typeof URLStatic.parse === "function")
2871
+ return URLStatic.parse(trimmed) ?? URL_UNPARSEABLE;
2872
+ }
2856
2873
  return new URL(trimmed);
2857
2874
  } catch {
2858
2875
  return URL_UNPARSEABLE;
@@ -2875,7 +2892,7 @@ var $ZodURL = /* @__PURE__ */ $constructor("$ZodURL", (inst, def) => {
2875
2892
  inst._zod.check = (payload) => {
2876
2893
  try {
2877
2894
  const trimmed = payload.value.trim();
2878
- const url2 = parseURLObject(trimmed, def);
2895
+ const url2 = validateURL(trimmed, def);
2879
2896
  if (url2 === URL_BAD_FORMAT) {
2880
2897
  payload.issues.push({
2881
2898
  code: "invalid_format",
@@ -2897,6 +2914,10 @@ var $ZodURL = /* @__PURE__ */ $constructor("$ZodURL", (inst, def) => {
2897
2914
  });
2898
2915
  return;
2899
2916
  }
2917
+ if (url2 === true) {
2918
+ payload.value = stripTabAndNewline(trimmed);
2919
+ return;
2920
+ }
2900
2921
  if (def.hostname && !urlHostnameOk(url2, def.hostname)) {
2901
2922
  payload.issues.push({
2902
2923
  code: "invalid_format",
@@ -2965,12 +2986,6 @@ var $ZodKSUID = /* @__PURE__ */ $constructor("$ZodKSUID", (inst, def) => {
2965
2986
  var $ZodISODateTime = /* @__PURE__ */ $constructor("$ZodISODateTime", (inst, def) => {
2966
2987
  def.pattern ?? (def.pattern = datetime(def));
2967
2988
  $ZodStringFormat.init(inst, def);
2968
- if (def.local || def.precision === -1) {
2969
- inst._zod.bag.laxFormat = true;
2970
- inst._zod.onattach.push((s) => {
2971
- s._zod.bag.laxFormat = true;
2972
- });
2973
- }
2974
2989
  });
2975
2990
  var $ZodISODate = /* @__PURE__ */ $constructor("$ZodISODate", (inst, def) => {
2976
2991
  def.pattern ?? (def.pattern = date);
@@ -2987,23 +3002,16 @@ var $ZodISODuration = /* @__PURE__ */ $constructor("$ZodISODuration", (inst, def
2987
3002
  var $ZodIPv4 = /* @__PURE__ */ $constructor("$ZodIPv4", (inst, def) => {
2988
3003
  def.pattern ?? (def.pattern = ipv4);
2989
3004
  $ZodStringFormat.init(inst, def);
2990
- inst._zod.bag.format = `ipv4`;
2991
3005
  });
2992
3006
  var ipv6Alphabet = /^[0-9a-fA-F:.]+$/;
2993
3007
  function isValidIPv6(value) {
2994
3008
  if (!ipv6Alphabet.test(value))
2995
3009
  return false;
2996
- try {
2997
- new URL(`http://[${value}]`);
2998
- return true;
2999
- } catch {
3000
- return false;
3001
- }
3010
+ return canParseURL(`http://[${value}]`);
3002
3011
  }
3003
3012
  var $ZodIPv6 = /* @__PURE__ */ $constructor("$ZodIPv6", (inst, def) => {
3004
3013
  def.pattern ?? (def.pattern = ipv6);
3005
3014
  $ZodStringFormat.init(inst, def);
3006
- inst._zod.bag.format = `ipv6`;
3007
3015
  inst._zod.check = (payload) => {
3008
3016
  if (!isValidIPv6(payload.value)) {
3009
3017
  payload.issues.push({
@@ -3019,7 +3027,6 @@ var $ZodIPv6 = /* @__PURE__ */ $constructor("$ZodIPv6", (inst, def) => {
3019
3027
  var $ZodMAC = /* @__PURE__ */ $constructor("$ZodMAC", (inst, def) => {
3020
3028
  def.pattern ?? (def.pattern = mac(def.delimiter));
3021
3029
  $ZodStringFormat.init(inst, def);
3022
- inst._zod.bag.format = `mac`;
3023
3030
  });
3024
3031
  var $ZodCIDRv4 = /* @__PURE__ */ $constructor("$ZodCIDRv4", (inst, def) => {
3025
3032
  def.pattern ?? (def.pattern = cidrv4);
@@ -3068,10 +3075,10 @@ function isValidBase64(data) {
3068
3075
  return false;
3069
3076
  }
3070
3077
  }
3078
+ var base64Charset = /^[0-9a-zA-Z+/]*={0,2}$/;
3071
3079
  var $ZodBase64 = /* @__PURE__ */ $constructor("$ZodBase64", (inst, def) => {
3072
- def.pattern ?? (def.pattern = base64);
3080
+ def.pattern ?? (def.pattern = base64Charset);
3073
3081
  $ZodStringFormat.init(inst, def);
3074
- inst._zod.bag.contentEncoding = "base64";
3075
3082
  inst._zod.check = (payload) => {
3076
3083
  if (isValidBase64(payload.value))
3077
3084
  return;
@@ -3084,17 +3091,17 @@ var $ZodBase64 = /* @__PURE__ */ $constructor("$ZodBase64", (inst, def) => {
3084
3091
  });
3085
3092
  };
3086
3093
  });
3094
+ var base64urlCharset = /^[A-Za-z0-9_-]*$/;
3087
3095
  function isValidBase64URL(data) {
3088
- if (!base64url.test(data))
3096
+ if (!base64urlCharset.test(data))
3089
3097
  return false;
3090
3098
  const base643 = data.replace(/[-_]/g, (c) => c === "-" ? "+" : "/");
3091
3099
  const padded = base643.padEnd(Math.ceil(base643.length / 4) * 4, "=");
3092
3100
  return isValidBase64(padded);
3093
3101
  }
3094
3102
  var $ZodBase64URL = /* @__PURE__ */ $constructor("$ZodBase64URL", (inst, def) => {
3095
- def.pattern ?? (def.pattern = base64url);
3103
+ def.pattern ?? (def.pattern = base64urlCharset);
3096
3104
  $ZodStringFormat.init(inst, def);
3097
- inst._zod.bag.contentEncoding = "base64url";
3098
3105
  inst._zod.check = (payload) => {
3099
3106
  if (isValidBase64URL(payload.value))
3100
3107
  return;
@@ -3117,7 +3124,7 @@ function isLuhnAlgo(digits) {
3117
3124
  let bit = 1;
3118
3125
  let sum = 0;
3119
3126
  while (length) {
3120
- const value = +digits[--length];
3127
+ const value = digits.charCodeAt(--length) - 48;
3121
3128
  bit ^= 1;
3122
3129
  sum += bit ? [0, 2, 4, 6, 8, 1, 3, 5, 7, 9][value] : value;
3123
3130
  }
@@ -3143,6 +3150,39 @@ var $ZodCreditCard = /* @__PURE__ */ $constructor("$ZodCreditCard", (inst, def)
3143
3150
  });
3144
3151
  };
3145
3152
  });
3153
+ function isIso7064Mod97(iban3) {
3154
+ let remainder = 0;
3155
+ const len = iban3.length;
3156
+ for (let i = 4; i < len; i++) {
3157
+ const code = iban3.charCodeAt(i);
3158
+ remainder = (code >= 65 ? remainder * 100 + (code - 55) : remainder * 10 + (code - 48)) % 97;
3159
+ }
3160
+ for (let i = 0; i < 4; i++) {
3161
+ const code = iban3.charCodeAt(i);
3162
+ remainder = (code >= 65 ? remainder * 100 + (code - 55) : remainder * 10 + (code - 48)) % 97;
3163
+ }
3164
+ return remainder === 1;
3165
+ }
3166
+ function isValidIBAN(input2) {
3167
+ if (!iban.test(input2))
3168
+ return false;
3169
+ return isIso7064Mod97(input2);
3170
+ }
3171
+ var $ZodIBAN = /* @__PURE__ */ $constructor("$ZodIBAN", (inst, def) => {
3172
+ def.pattern ?? (def.pattern = iban);
3173
+ $ZodStringFormat.init(inst, def);
3174
+ inst._zod.check = (payload) => {
3175
+ if (isValidIBAN(payload.value))
3176
+ return;
3177
+ payload.issues.push({
3178
+ code: "invalid_format",
3179
+ format: "iban",
3180
+ input: payload.value,
3181
+ inst,
3182
+ continue: !def.abort
3183
+ });
3184
+ };
3185
+ });
3146
3186
  function isValidJWT(token, algorithm = null) {
3147
3187
  try {
3148
3188
  const tokensParts = token.split(".");
@@ -3193,7 +3233,7 @@ var $ZodCustomStringFormat = /* @__PURE__ */ $constructor("$ZodCustomStringForma
3193
3233
  });
3194
3234
  var $ZodNumber = /* @__PURE__ */ $constructor("$ZodNumber", (inst, def) => {
3195
3235
  $ZodType.init(inst, def);
3196
- inst._zod.pattern = inst._zod.bag.pattern ?? number;
3236
+ inst._zod.pattern = number;
3197
3237
  inst._zod.parse = (payload, _ctx) => {
3198
3238
  if (def.coerce)
3199
3239
  try {
@@ -3372,6 +3412,31 @@ var $ZodDate = /* @__PURE__ */ $constructor("$ZodDate", (inst, def) => {
3372
3412
  return payload;
3373
3413
  };
3374
3414
  });
3415
+ function capSize(inst, size) {
3416
+ const caps = sizeCaps(inst._zod.def.checks);
3417
+ if (!caps.length)
3418
+ return;
3419
+ const cap = Math.min(...caps.map((c) => c[0]));
3420
+ const parse3 = inst._zod.parse;
3421
+ inst._zod.parse = (payload, ctx) => {
3422
+ const n = size(payload.value);
3423
+ if (n > cap && !ctx?.skipChecks && ctx?.direction !== "backward") {
3424
+ for (const [max, ch] of sizeCaps(inst._zod.def.checks)) {
3425
+ if (n > max && ch._zod.def.when(payload)) {
3426
+ const start = payload.issues.length;
3427
+ ch._zod.check(payload);
3428
+ payload.issues[start].continue = false;
3429
+ attachSchema(payload.issues, start, inst);
3430
+ return payload;
3431
+ }
3432
+ }
3433
+ }
3434
+ return parse3(payload, ctx);
3435
+ };
3436
+ }
3437
+ var arraySize = (input2) => Array.isArray(input2) ? input2.length : -1;
3438
+ var mapSize = (input2) => input2 instanceof Map ? input2.size : -1;
3439
+ var setSize = (input2) => input2 instanceof Set ? input2.size : -1;
3375
3440
  function handleArrayResult(result, final, index) {
3376
3441
  if (result.issues.length) {
3377
3442
  final.issues.push(...prefixIssues(index, result.issues));
@@ -3395,6 +3460,7 @@ var $ZodArray = /* @__PURE__ */ $constructor("$ZodArray", (inst, def) => {
3395
3460
  }
3396
3461
  payload.value = memo2 ? memo2.alloc(inst, payload, Array(input2.length), ctx) : Array(input2.length);
3397
3462
  const proms = [];
3463
+ const abortEarly = ctx?.abortEarly;
3398
3464
  for (let i = 0; i < input2.length; i++) {
3399
3465
  const item = input2[i];
3400
3466
  const result = def.element._zod.run({
@@ -3405,6 +3471,8 @@ var $ZodArray = /* @__PURE__ */ $constructor("$ZodArray", (inst, def) => {
3405
3471
  proms.push(result.then((result2) => handleArrayResult(result2, payload, i)));
3406
3472
  } else {
3407
3473
  handleArrayResult(result, payload, i);
3474
+ if (abortEarly && result.issues.length !== 0 && aborted(result))
3475
+ break;
3408
3476
  }
3409
3477
  }
3410
3478
  if (proms.length) {
@@ -3412,6 +3480,7 @@ var $ZodArray = /* @__PURE__ */ $constructor("$ZodArray", (inst, def) => {
3412
3480
  }
3413
3481
  return payload;
3414
3482
  };
3483
+ capSize(inst, arraySize);
3415
3484
  });
3416
3485
  function handlePropertyResult(result, final, key, input2, optin, optout) {
3417
3486
  const isPresent = key in input2;
@@ -3437,7 +3506,7 @@ function handlePropertyResult(result, final, key, input2, optin, optout) {
3437
3506
  return;
3438
3507
  }
3439
3508
  if (result.value === void 0) {
3440
- if (isPresent) {
3509
+ if (isPresent || optin === "defaulted" && !isOptionalOut) {
3441
3510
  final.value[key] = void 0;
3442
3511
  }
3443
3512
  } else {
@@ -3466,14 +3535,20 @@ function normalizeDef(def) {
3466
3535
  optionalKeys: new Set(okeys)
3467
3536
  };
3468
3537
  }
3469
- function handleCatchall(proms, input2, payload, ctx, def, inst) {
3538
+ function handleCatchall(proms, input2, payload, ctx, def, inst, abortEarly) {
3470
3539
  const unrecognized = [];
3471
3540
  const keySet = def.keySet;
3472
3541
  const _catchall = def.catchall._zod;
3473
3542
  const t = _catchall.def.type;
3474
3543
  const optin = _catchall.optin;
3475
3544
  const optout = _catchall.optout;
3545
+ let seen = 0;
3476
3546
  for (const key in input2) {
3547
+ if (abortEarly && payload.issues.length !== seen) {
3548
+ if (aborted(payload, seen))
3549
+ break;
3550
+ seen = payload.issues.length;
3551
+ }
3477
3552
  if (keySet.has(key))
3478
3553
  continue;
3479
3554
  if (key === "__proto__") {
@@ -3508,23 +3583,19 @@ function handleCatchall(proms, input2, payload, ctx, def, inst) {
3508
3583
  return payload;
3509
3584
  });
3510
3585
  }
3511
- var propShapes = /* @__PURE__ */ new WeakMap();
3512
3586
  var $ZodObject = /* @__PURE__ */ $constructor("$ZodObject", (inst, def) => {
3513
3587
  $ZodType.init(inst, def);
3514
3588
  const desc = Object.getOwnPropertyDescriptor(def, "shape");
3515
- if (!desc?.get) {
3516
- const sh = def.shape;
3517
- propShapes.set(def, sh);
3518
- Object.defineProperty(def, "shape", {
3519
- get: () => {
3520
- const newSh = { ...sh };
3521
- Object.defineProperty(def, "shape", {
3522
- value: newSh
3523
- });
3524
- propShapes.set(def, newSh);
3525
- return newSh;
3526
- }
3527
- });
3589
+ const sh = desc?.get ? desc.get.raw : def.shape ?? {};
3590
+ if (sh) {
3591
+ const get = () => {
3592
+ const newSh = { ...sh };
3593
+ Object.defineProperty(def, "shape", { value: newSh });
3594
+ get.raw = newSh;
3595
+ return newSh;
3596
+ };
3597
+ get.raw = sh;
3598
+ Object.defineProperty(def, "shape", { get });
3528
3599
  }
3529
3600
  const _normalized = cached(() => normalizeDef(def));
3530
3601
  defineLazyInternal(inst, "propValues", (zod) => {
@@ -3564,7 +3635,14 @@ var $ZodObject = /* @__PURE__ */ $constructor("$ZodObject", (inst, def) => {
3564
3635
  payload.value = memo2 ? memo2.alloc(inst, payload, {}, ctx) : {};
3565
3636
  const proms = [];
3566
3637
  const shape = value.shape;
3638
+ const abortEarly = ctx?.abortEarly;
3639
+ let seen = payload.issues.length;
3567
3640
  for (const key of value.allKeys) {
3641
+ if (abortEarly && payload.issues.length !== seen) {
3642
+ if (aborted(payload, seen))
3643
+ break;
3644
+ seen = payload.issues.length;
3645
+ }
3568
3646
  if (key === "__proto__")
3569
3647
  continue;
3570
3648
  const el = shape[key];
@@ -3580,7 +3658,7 @@ var $ZodObject = /* @__PURE__ */ $constructor("$ZodObject", (inst, def) => {
3580
3658
  if (!catchall) {
3581
3659
  return proms.length ? Promise.all(proms).then(() => payload) : payload;
3582
3660
  }
3583
- return handleCatchall(proms, input2, payload, ctx, _normalized.value, inst);
3661
+ return handleCatchall(proms, input2, payload, ctx, _normalized.value, inst, abortEarly === true);
3584
3662
  };
3585
3663
  });
3586
3664
  var $ZodObjectJIT = /* @__PURE__ */ $constructor("$ZodObjectJIT", (inst, def) => {
@@ -3594,10 +3672,16 @@ var $ZodObjectJIT = /* @__PURE__ */ $constructor("$ZodObjectJIT", (inst, def) =>
3594
3672
  const doc = new Doc(["payload", "ctx"], { shape, inst, memo: memo2, syms });
3595
3673
  const parseStr = (k) => `shape[${k}]._zod.run({ value: input[${k}], issues: [] }, ctx)`;
3596
3674
  const prefixStr = (id, k) => `
3675
+ let ${id}_ab = false;
3597
3676
  for (let i = 0; i < ${id}.issues.length; i++) {
3598
3677
  const iss = ${id}.issues[i];
3599
3678
  iss.path = iss.path ? [${k}, ...iss.path] : [${k}];
3600
3679
  payload.issues.push(iss);
3680
+ if (iss.continue !== true) ${id}_ab = true;
3681
+ }
3682
+ if (${id}_ab && ctx && ctx.abortEarly) {
3683
+ payload.value = newResult;
3684
+ return payload;
3601
3685
  }`;
3602
3686
  doc.write(`const input = payload.value;`);
3603
3687
  const ids = /* @__PURE__ */ Object.create(null);
@@ -3643,6 +3727,10 @@ var $ZodObjectJIT = /* @__PURE__ */ $constructor("$ZodObjectJIT", (inst, def) =>
3643
3727
  input: undefined,
3644
3728
  path: [${k}]
3645
3729
  });
3730
+ if (ctx && ctx.abortEarly) {
3731
+ payload.value = newResult;
3732
+ return payload;
3733
+ }
3646
3734
  }
3647
3735
 
3648
3736
  if (${id}_present) {
@@ -3654,16 +3742,16 @@ var $ZodObjectJIT = /* @__PURE__ */ $constructor("$ZodObjectJIT", (inst, def) =>
3654
3742
  doc.write(`
3655
3743
  if (${id}.issues.length) {${prefixStr(id, k)}
3656
3744
  }
3657
-
3658
- if (${id}.value === undefined) {
3659
- if (${isPresent}) {
3660
- newResult[${k}] = undefined;
3661
- }
3745
+ `);
3746
+ if (optin === "defaulted") {
3747
+ doc.write(`newResult[${k}] = ${id}.value;`);
3662
3748
  } else {
3749
+ doc.write(`
3750
+ if (${id}.value !== undefined || ${isPresent}) {
3663
3751
  newResult[${k}] = ${id}.value;
3664
3752
  }
3665
-
3666
3753
  `);
3754
+ }
3667
3755
  }
3668
3756
  }
3669
3757
  doc.write(`payload.value = newResult;`);
@@ -3695,7 +3783,7 @@ var $ZodObjectJIT = /* @__PURE__ */ $constructor("$ZodObjectJIT", (inst, def) =>
3695
3783
  payload = fastpass(payload, ctx);
3696
3784
  if (!catchall)
3697
3785
  return payload;
3698
- return handleCatchall([], input2, payload, ctx, value, inst);
3786
+ return handleCatchall([], input2, payload, ctx, value, inst, ctx?.abortEarly === true);
3699
3787
  }
3700
3788
  return superParse(payload, ctx);
3701
3789
  };
@@ -3827,16 +3915,31 @@ function getDiscriminatedOption(union2, value) {
3827
3915
  const internals = union2._zod;
3828
3916
  let map2 = internals.bag.optionsMap;
3829
3917
  if (!map2) {
3830
- map2 = /* @__PURE__ */ new Map();
3831
- const { options, discriminator } = internals.def;
3832
- for (const option of options) {
3833
- for (const v of option._zod.propValues?.[discriminator] ?? [])
3834
- if (!map2.has(v))
3835
- map2.set(v, option);
3836
- }
3918
+ map2 = discriminatorMap(internals.def);
3837
3919
  internals.bag.optionsMap = map2;
3838
3920
  }
3839
- return map2.get(value);
3921
+ const option = map2.get(value);
3922
+ if (option === null)
3923
+ throw new Error(`Ambiguous discriminator value "${String(value)}"`);
3924
+ return option;
3925
+ }
3926
+ function discriminatorMap(def) {
3927
+ const map2 = /* @__PURE__ */ new Map();
3928
+ for (const option of def.options) {
3929
+ const values = option._zod.propValues?.[def.discriminator];
3930
+ if (!values || values.size === 0)
3931
+ throw new Error(`Invalid discriminated union option at index "${def.options.indexOf(option)}"`);
3932
+ for (const value of values) {
3933
+ if (map2.has(value)) {
3934
+ if (value !== void 0)
3935
+ throw new Error(`Duplicate discriminator value "${String(value)}"`);
3936
+ map2.set(value, null);
3937
+ } else {
3938
+ map2.set(value, option);
3939
+ }
3940
+ }
3941
+ }
3942
+ return map2;
3840
3943
  }
3841
3944
  var $ZodDiscriminatedUnion = /* @__PURE__ */ $constructor("$ZodDiscriminatedUnion", (inst, def) => {
3842
3945
  def.inclusive = false;
@@ -3844,10 +3947,13 @@ var $ZodDiscriminatedUnion = /* @__PURE__ */ $constructor("$ZodDiscriminatedUnio
3844
3947
  const _super = inst._zod.parse;
3845
3948
  defineLazyInternal(inst, "propValues", (zod) => {
3846
3949
  const propValues = {};
3950
+ let undefinedCount = 0;
3847
3951
  for (const option of zod.def.options) {
3848
3952
  const pv = option._zod.propValues;
3849
3953
  if (!pv || Object.keys(pv).length === 0)
3850
3954
  throw new Error(`Invalid discriminated union option at index "${zod.def.options.indexOf(option)}"`);
3955
+ if (pv[zod.def.discriminator]?.has(void 0))
3956
+ undefinedCount++;
3851
3957
  for (const [k, v] of Object.entries(pv)) {
3852
3958
  if (!Object.prototype.hasOwnProperty.call(propValues, k)) {
3853
3959
  assignProp(propValues, k, /* @__PURE__ */ new Set());
@@ -3857,30 +3963,17 @@ var $ZodDiscriminatedUnion = /* @__PURE__ */ $constructor("$ZodDiscriminatedUnio
3857
3963
  }
3858
3964
  }
3859
3965
  }
3966
+ if (!zod.def.unionFallback && undefinedCount > 1)
3967
+ propValues[zod.def.discriminator]?.delete(void 0);
3860
3968
  return propValues;
3861
3969
  });
3862
3970
  def.options.forEach((option, i) => {
3863
- const propShape = propShapes.get(option._zod.def);
3971
+ const propShape = rawShape(option._zod.def);
3864
3972
  if (propShape && !Object.prototype.hasOwnProperty.call(propShape, def.discriminator)) {
3865
3973
  throw new Error(`Invalid discriminated union option at index "${i}"`);
3866
3974
  }
3867
3975
  });
3868
- const disc = cached(() => {
3869
- const opts = def.options;
3870
- const map2 = /* @__PURE__ */ new Map();
3871
- for (const o of opts) {
3872
- const values = o._zod.propValues?.[def.discriminator];
3873
- if (!values || values.size === 0)
3874
- throw new Error(`Invalid discriminated union option at index "${def.options.indexOf(o)}"`);
3875
- for (const v of values) {
3876
- if (map2.has(v)) {
3877
- throw new Error(`Duplicate discriminator value "${String(v)}"`);
3878
- }
3879
- map2.set(v, o);
3880
- }
3881
- }
3882
- return map2;
3883
- });
3976
+ const disc = cached(() => discriminatorMap(def));
3884
3977
  inst._zod.parse = (payload, ctx) => {
3885
3978
  const input2 = payload.value;
3886
3979
  if (!isObject(input2)) {
@@ -3892,8 +3985,9 @@ var $ZodDiscriminatedUnion = /* @__PURE__ */ $constructor("$ZodDiscriminatedUnio
3892
3985
  });
3893
3986
  return payload;
3894
3987
  }
3895
- const opt = disc.value.get(input2?.[def.discriminator]);
3896
- if (opt) {
3988
+ const value = input2?.[def.discriminator];
3989
+ const opt = disc.value.get(value);
3990
+ if (opt && (value !== void 0 || ctx.direction !== "backward")) {
3897
3991
  return opt._zod.run(payload, ctx);
3898
3992
  }
3899
3993
  if (def.unionFallback || ctx.direction === "backward") {
@@ -3904,7 +3998,7 @@ var $ZodDiscriminatedUnion = /* @__PURE__ */ $constructor("$ZodDiscriminatedUnio
3904
3998
  errors: [],
3905
3999
  note: "No matching discriminator",
3906
4000
  discriminator: def.discriminator,
3907
- options: Array.from(disc.value.keys()),
4001
+ options: Array.from(disc.value.keys()).filter((value2) => disc.value.get(value2) !== null),
3908
4002
  input: input2,
3909
4003
  path: [def.discriminator],
3910
4004
  inst
@@ -4070,6 +4164,8 @@ var $ZodTuple = /* @__PURE__ */ $constructor("$ZodTuple", (inst, def) => {
4070
4164
  }
4071
4165
  }
4072
4166
  const itemResults = new Array(items.length);
4167
+ const abortEarly = def.rest ? ctx?.abortEarly : void 0;
4168
+ let itemAborted = false;
4073
4169
  for (let i = 0; i < items.length; i++) {
4074
4170
  const r = items[i]._zod.run({ value: input2[i], issues: [] }, ctx);
4075
4171
  if (r instanceof Promise) {
@@ -4078,12 +4174,20 @@ var $ZodTuple = /* @__PURE__ */ $constructor("$ZodTuple", (inst, def) => {
4078
4174
  }));
4079
4175
  } else {
4080
4176
  itemResults[i] = r;
4177
+ if (abortEarly && !itemAborted && r.issues.length)
4178
+ itemAborted = aborted(r);
4081
4179
  }
4082
4180
  }
4083
- if (def.rest) {
4181
+ if (def.rest && !itemAborted) {
4084
4182
  let i = items.length - 1;
4085
4183
  const rest = input2.slice(items.length);
4184
+ let seen = payload.issues.length;
4086
4185
  for (const el of rest) {
4186
+ if (abortEarly && payload.issues.length !== seen) {
4187
+ if (aborted(payload, seen))
4188
+ break;
4189
+ seen = payload.issues.length;
4190
+ }
4087
4191
  i++;
4088
4192
  const result = def.rest._zod.run({ value: el, issues: [] }, ctx);
4089
4193
  if (result instanceof Promise) {
@@ -4311,7 +4415,14 @@ var $ZodMap = /* @__PURE__ */ $constructor("$ZodMap", (inst, def) => {
4311
4415
  }
4312
4416
  const proms = [];
4313
4417
  payload.value = memo2 ? memo2.alloc(inst, payload, /* @__PURE__ */ new Map(), ctx) : /* @__PURE__ */ new Map();
4418
+ const abortEarly = ctx?.abortEarly;
4419
+ let seen = payload.issues.length;
4314
4420
  for (const [key, value] of input2) {
4421
+ if (abortEarly && payload.issues.length !== seen) {
4422
+ if (aborted(payload, seen))
4423
+ break;
4424
+ seen = payload.issues.length;
4425
+ }
4315
4426
  const keyResult = def.keyType._zod.run({ value: key, issues: [] }, ctx);
4316
4427
  const valueResult = def.valueType._zod.run({ value, issues: [] }, ctx);
4317
4428
  if (keyResult instanceof Promise || valueResult instanceof Promise) {
@@ -4326,6 +4437,7 @@ var $ZodMap = /* @__PURE__ */ $constructor("$ZodMap", (inst, def) => {
4326
4437
  return Promise.all(proms).then(() => payload);
4327
4438
  return payload;
4328
4439
  };
4440
+ capSize(inst, mapSize);
4329
4441
  });
4330
4442
  function handleMapResult(keyResult, valueResult, final, key, input2, inst, ctx) {
4331
4443
  if (keyResult.issues.length) {
@@ -4374,7 +4486,14 @@ var $ZodSet = /* @__PURE__ */ $constructor("$ZodSet", (inst, def) => {
4374
4486
  }
4375
4487
  const proms = [];
4376
4488
  payload.value = memo2 ? memo2.alloc(inst, payload, /* @__PURE__ */ new Set(), ctx) : /* @__PURE__ */ new Set();
4489
+ const abortEarly = ctx?.abortEarly;
4490
+ let seen = payload.issues.length;
4377
4491
  for (const item of input2) {
4492
+ if (abortEarly && payload.issues.length !== seen) {
4493
+ if (aborted(payload, seen))
4494
+ break;
4495
+ seen = payload.issues.length;
4496
+ }
4378
4497
  const result = def.valueType._zod.run({ value: item, issues: [] }, ctx);
4379
4498
  if (result instanceof Promise) {
4380
4499
  proms.push(result.then((result2) => handleSetResult(result2, payload)));
@@ -4385,6 +4504,7 @@ var $ZodSet = /* @__PURE__ */ $constructor("$ZodSet", (inst, def) => {
4385
4504
  return Promise.all(proms).then(() => payload);
4386
4505
  return payload;
4387
4506
  };
4507
+ capSize(inst, setSize);
4388
4508
  });
4389
4509
  function handleSetResult(result, final) {
4390
4510
  if (result.issues.length) {
@@ -4397,8 +4517,10 @@ var $ZodEnum = /* @__PURE__ */ $constructor("$ZodEnum", (inst, def) => {
4397
4517
  const values = getEnumValues(def.entries);
4398
4518
  const valuesSet = new Set(values);
4399
4519
  inst._zod.values = valuesSet;
4400
- const patternValues = values.filter((k) => propertyKeyTypes.has(typeof k));
4401
- inst._zod.pattern = new RegExp(patternValues.length ? `^(${patternValues.map((o) => escapeRegex(o.toString())).join("|")})$` : "^[^\\s\\S]$");
4520
+ defineLazyInternal(inst, "pattern", (zod) => {
4521
+ const patternValues = getEnumValues(zod.def.entries).filter((k) => propertyKeyTypes.has(typeof k));
4522
+ return new RegExp(patternValues.length ? `^(${patternValues.map((o) => escapeRegex(o.toString())).join("|")})$` : "^[^\\s\\S]$");
4523
+ });
4402
4524
  inst._zod.parse = (payload, _ctx) => {
4403
4525
  const input2 = payload.value;
4404
4526
  if (valuesSet.has(input2)) {
@@ -4417,7 +4539,10 @@ var $ZodLiteral = /* @__PURE__ */ $constructor("$ZodLiteral", (inst, def) => {
4417
4539
  $ZodType.init(inst, def);
4418
4540
  const values = new Set(def.values);
4419
4541
  inst._zod.values = values;
4420
- inst._zod.pattern = new RegExp(def.values.length ? `^(${def.values.map((o) => typeof o === "string" ? escapeRegex(o) : o ? escapeRegex(o.toString()) : String(o)).join("|")})$` : "^[^\\s\\S]$");
4542
+ defineLazyInternal(inst, "pattern", (zod) => {
4543
+ const vals = zod.def.values;
4544
+ return new RegExp(vals.length ? `^(${vals.map((o) => typeof o === "string" ? escapeRegex(o) : o ? escapeRegex(o.toString()) : String(o)).join("|")})$` : "^[^\\s\\S]$");
4545
+ });
4421
4546
  inst._zod.parse = (payload, _ctx) => {
4422
4547
  const input2 = payload.value;
4423
4548
  if (values.has(input2)) {
@@ -4755,20 +4880,62 @@ function handleReadonlyResult(payload) {
4755
4880
  payload.value = Object.freeze(payload.value);
4756
4881
  return payload;
4757
4882
  }
4883
+ function leafPattern(schema) {
4884
+ const def = schema._zod.def;
4885
+ let pattern = def.pattern;
4886
+ let isInt = !!def.format?.includes("int");
4887
+ let minimum;
4888
+ let maximum;
4889
+ for (const ch of def.checks ?? []) {
4890
+ const d = ch._zod.def;
4891
+ if (d.pattern)
4892
+ pattern = d.pattern;
4893
+ isInt || (isInt = !!d.format?.includes("int"));
4894
+ const lo = d.minimum ?? d.length;
4895
+ const hi = d.maximum ?? d.length;
4896
+ if (lo !== void 0 && (minimum === void 0 || lo > minimum))
4897
+ minimum = lo;
4898
+ if (hi !== void 0 && (maximum === void 0 || hi < maximum))
4899
+ maximum = hi;
4900
+ }
4901
+ if (pattern)
4902
+ return pattern.source;
4903
+ if (minimum !== void 0 && maximum !== void 0 && minimum > maximum)
4904
+ return "(?!)";
4905
+ if (minimum !== void 0 || maximum !== void 0)
4906
+ return string({ minimum, maximum }).source;
4907
+ const own2 = schema._zod.pattern;
4908
+ return (isInt && own2 === number ? integer : own2)?.source;
4909
+ }
4910
+ function partPattern(schema) {
4911
+ const def = schema._zod.def;
4912
+ const own2 = schema._zod.pattern?.source;
4913
+ const inner = def.innerType ?? schema._zod.innerType;
4914
+ if (inner) {
4915
+ const before = inner._zod.pattern?.source;
4916
+ const after = partPattern(inner);
4917
+ if (own2 && before && after && after !== before) {
4918
+ return own2.replace(cleanRegex(before), () => cleanRegex(after));
4919
+ }
4920
+ return own2;
4921
+ }
4922
+ if (def.options) {
4923
+ const sources = def.options.map(partPattern);
4924
+ if (sources.every(Boolean))
4925
+ return `^(${sources.map((s) => cleanRegex(s)).join("|")})$`;
4926
+ }
4927
+ return leafPattern(schema);
4928
+ }
4758
4929
  var $ZodTemplateLiteral = /* @__PURE__ */ $constructor("$ZodTemplateLiteral", (inst, def) => {
4759
4930
  $ZodType.init(inst, def);
4760
4931
  const regexParts = [];
4761
4932
  for (const part of def.parts) {
4762
4933
  if (typeof part === "object" && part !== null) {
4763
- if (!part._zod.pattern) {
4934
+ const source = partPattern(part);
4935
+ if (!source) {
4764
4936
  throw new Error(`Invalid template literal part, no pattern found: ${[...part._zod.traits].shift()}`);
4765
4937
  }
4766
- const source = part._zod.pattern instanceof RegExp ? part._zod.pattern.source : part._zod.pattern;
4767
- if (!source)
4768
- throw new Error(`Invalid template literal part: ${part._zod.traits}`);
4769
- const start = source.startsWith("^") ? 1 : 0;
4770
- const end = source.endsWith("$") ? source.length - 1 : source.length;
4771
- regexParts.push(source.slice(start, end));
4938
+ regexParts.push(cleanRegex(source));
4772
4939
  } else if (part === null || primitiveTypes.has(typeof part)) {
4773
4940
  regexParts.push(escapeRegex(`${part}`));
4774
4941
  } else {
@@ -4943,28 +5110,53 @@ var $ZodCyclicError = class extends Error {
4943
5110
  };
4944
5111
  var STATE = "~memo";
4945
5112
  var NO_ISSUES = [];
5113
+ function isRef(value) {
5114
+ return value !== null && typeof value === "object";
5115
+ }
4946
5116
  function cloneIssues(issues) {
4947
5117
  return issues.map((iss) => iss.path ? { ...iss, path: iss.path.slice() } : { ...iss });
4948
5118
  }
4949
5119
  var recursive = /* @__PURE__ */ new WeakMap();
4950
- function isRecursive(inst, stack) {
5120
+ var NONE = 0;
5121
+ var ASSUMED = 1;
5122
+ var PROVEN = 2;
5123
+ function isRecursive(inst, stack, resolve) {
4951
5124
  const cached2 = recursive.get(inst);
4952
5125
  if (cached2 !== void 0)
4953
- return cached2;
5126
+ return cached2 ? PROVEN : NONE;
4954
5127
  if (stack.has(inst))
4955
- return true;
5128
+ return PROVEN;
4956
5129
  stack.add(inst);
4957
- let result = false;
5130
+ let result = NONE;
4958
5131
  const check2 = (child) => {
4959
- if (!result && child?._zod && isRecursive(child, stack))
4960
- result = true;
5132
+ if (result !== PROVEN && child?._zod) {
5133
+ const answer = isRecursive(child, stack, resolve);
5134
+ if (answer > result)
5135
+ result = answer;
5136
+ }
5137
+ };
5138
+ const shape = (sh, spread) => {
5139
+ let answer = NONE;
5140
+ for (const key of Reflect.ownKeys(sh)) {
5141
+ const desc = Object.getOwnPropertyDescriptor(sh, key);
5142
+ if (spread && !desc.enumerable)
5143
+ continue;
5144
+ const child = desc.get ? ASSUMED : desc.value?._zod ? isRecursive(desc.value, stack, resolve) : NONE;
5145
+ if (child > answer)
5146
+ answer = child;
5147
+ }
5148
+ return answer;
5149
+ };
5150
+ const merge2 = (answer) => {
5151
+ if (answer > result)
5152
+ result = answer;
4961
5153
  };
4962
5154
  const def = inst._zod.def;
4963
5155
  const kind = def.type;
4964
5156
  switch (kind) {
4965
5157
  case "object": {
4966
- for (const key of Reflect.ownKeys(def.shape))
4967
- check2(def.shape[key]);
5158
+ const raw = rawShape(def);
5159
+ merge2(raw ? shape(raw, true) : ASSUMED);
4968
5160
  check2(def.catchall);
4969
5161
  break;
4970
5162
  }
@@ -5011,10 +5203,12 @@ function isRecursive(inst, stack) {
5011
5203
  check2(def.input);
5012
5204
  check2(def.output);
5013
5205
  break;
5014
- // reading `_zod.innerType` resolves the getter once and caches it
5015
- case "lazy":
5016
- check2(inst._zod.innerType);
5206
+ // `$ZodLazy` caches its inner on the def, so a resolved edge is followed exactly
5207
+ case "lazy": {
5208
+ const inner = def._cachedInner ?? (resolve ? inst._zod.innerType : void 0);
5209
+ merge2(inner ? isRecursive(inner, stack, false) : ASSUMED);
5017
5210
  break;
5211
+ }
5018
5212
  // a leaf by choice: `parts` are regex fragments, not data positions
5019
5213
  case "template_literal":
5020
5214
  // leaves
@@ -5056,16 +5250,20 @@ function isRecursive(inst, stack) {
5056
5250
  }
5057
5251
  }
5058
5252
  stack.delete(inst);
5059
- recursive.set(inst, result);
5060
- return result;
5253
+ return settle(inst, result);
5254
+ }
5255
+ function settle(inst, answer) {
5256
+ if (answer !== ASSUMED)
5257
+ recursive.set(inst, answer === PROVEN);
5258
+ return answer;
5061
5259
  }
5062
5260
  function isRecursiveSchema(inst) {
5063
- return isRecursive(inst, /* @__PURE__ */ new Set());
5261
+ return isRecursive(inst, /* @__PURE__ */ new Set(), true) !== NONE;
5064
5262
  }
5065
5263
  function bucketFor(state, inst) {
5066
5264
  let bucket = state.buckets.get(inst);
5067
5265
  if (!bucket) {
5068
- bucket = /* @__PURE__ */ new Map();
5266
+ bucket = /* @__PURE__ */ new WeakMap();
5069
5267
  state.buckets.set(inst, bucket);
5070
5268
  }
5071
5269
  return bucket;
@@ -5101,6 +5299,7 @@ var memo = {
5101
5299
  attach(inst) {
5102
5300
  var _a3;
5103
5301
  let isRecursiveInst;
5302
+ let rechecked = false;
5104
5303
  let lastCtx;
5105
5304
  let lastBucket;
5106
5305
  (_a3 = inst._zod).deferred ?? (_a3.deferred = []);
@@ -5108,20 +5307,24 @@ var memo = {
5108
5307
  const base = inst._zod.parse;
5109
5308
  const wrapped = (payload, ctx) => {
5110
5309
  if (isRecursiveInst === void 0) {
5111
- isRecursiveInst = isRecursive(inst, /* @__PURE__ */ new Set());
5112
- if (!isRecursiveInst) {
5310
+ const walked = isRecursive(inst, /* @__PURE__ */ new Set(), false);
5311
+ if (walked === NONE) {
5113
5312
  inst._zod.parse = base;
5114
5313
  if (inst._zod.run === wrapped)
5115
5314
  inst._zod.run = base;
5116
5315
  return base(payload, ctx);
5117
5316
  }
5317
+ if (walked === PROVEN || rechecked)
5318
+ isRecursiveInst = true;
5319
+ else
5320
+ rechecked = true;
5118
5321
  }
5119
5322
  const input2 = payload.value;
5120
- if (input2 === null || typeof input2 !== "object")
5323
+ if (!isRef(input2))
5121
5324
  return base(payload, ctx);
5122
5325
  let state = ctx[STATE];
5123
5326
  if (!state) {
5124
- state = { buckets: /* @__PURE__ */ new Map(), backEdges: void 0 };
5327
+ state = { buckets: /* @__PURE__ */ new WeakMap(), backEdges: void 0 };
5125
5328
  ctx[STATE] = state;
5126
5329
  }
5127
5330
  let bucket;
@@ -5140,7 +5343,7 @@ var memo = {
5140
5343
  payload.issues.push(...cloneIssues(hit.issues));
5141
5344
  } else {
5142
5345
  payload.memo = true;
5143
- state.backEdges ?? (state.backEdges = /* @__PURE__ */ new Set());
5346
+ state.backEdges ?? (state.backEdges = /* @__PURE__ */ new WeakSet());
5144
5347
  state.backEdges.add(hit.value);
5145
5348
  }
5146
5349
  return payload;
@@ -5172,7 +5375,7 @@ function memoizer() {
5172
5375
  }
5173
5376
  function isBackEdge(ctx, value) {
5174
5377
  const backEdges = ctx[STATE]?.backEdges;
5175
- return backEdges !== void 0 && value !== null && typeof value === "object" && backEdges.has(value);
5378
+ return backEdges !== void 0 && isRef(value) && backEdges.has(value);
5176
5379
  }
5177
5380
 
5178
5381
  // node_modules/zod/v4/locales/index.js
@@ -5229,6 +5432,7 @@ __export(locales_exports, {
5229
5432
  sl: () => sl_default,
5230
5433
  sv: () => sv_default,
5231
5434
  ta: () => ta_default,
5435
+ tg: () => tg_default,
5232
5436
  th: () => th_default,
5233
5437
  tk: () => tk_default,
5234
5438
  tr: () => tr_default,
@@ -5283,6 +5487,8 @@ var error = () => {
5283
5487
  json_string: "\u0646\u064E\u0635 \u0639\u0644\u0649 \u0647\u064A\u0626\u0629 JSON",
5284
5488
  e164: "\u0631\u0642\u0645 \u0647\u0627\u062A\u0641 \u0628\u0645\u0639\u064A\u0627\u0631 E.164",
5285
5489
  credit_card: "\u0631\u0642\u0645 \u0628\u0637\u0627\u0642\u0629 \u0627\u0644\u0627\u0626\u062A\u0645\u0627\u0646",
5490
+ currency_code: "\u0631\u0645\u0632 \u0627\u0644\u0639\u0645\u0644\u0629",
5491
+ iban: "IBAN",
5286
5492
  jwt: "JWT",
5287
5493
  template_literal: "\u0645\u062F\u062E\u0644"
5288
5494
  };
@@ -5393,6 +5599,8 @@ var error2 = () => {
5393
5599
  json_string: "JSON string",
5394
5600
  e164: "E.164 number",
5395
5601
  credit_card: "kredit kart\u0131 n\xF6mr\u0259si",
5602
+ currency_code: "valyuta kodu",
5603
+ iban: "IBAN",
5396
5604
  jwt: "JWT",
5397
5605
  template_literal: "input"
5398
5606
  };
@@ -5552,6 +5760,8 @@ var error3 = () => {
5552
5760
  json_string: "JSON \u0440\u0430\u0434\u043E\u043A",
5553
5761
  e164: "\u043D\u0443\u043C\u0430\u0440 E.164",
5554
5762
  credit_card: "\u043D\u0443\u043C\u0430\u0440 \u043A\u0440\u044D\u0434\u044B\u0442\u043D\u0430\u0439 \u043A\u0430\u0440\u0442\u044B",
5763
+ currency_code: "\u043A\u043E\u0434 \u0432\u0430\u043B\u044E\u0442\u044B",
5764
+ iban: "IBAN",
5555
5765
  jwt: "JWT",
5556
5766
  template_literal: "\u0443\u0432\u043E\u0434"
5557
5767
  };
@@ -5669,6 +5879,8 @@ var error4 = () => {
5669
5879
  json_string: "JSON \u043D\u0438\u0437",
5670
5880
  e164: "E.164 \u043D\u043E\u043C\u0435\u0440",
5671
5881
  credit_card: "\u043D\u043E\u043C\u0435\u0440 \u043D\u0430 \u043A\u0440\u0435\u0434\u0438\u0442\u043D\u0430 \u043A\u0430\u0440\u0442\u0430",
5882
+ currency_code: "\u043A\u043E\u0434 \u043D\u0430 \u0432\u0430\u043B\u0443\u0442\u0430",
5883
+ iban: "IBAN",
5672
5884
  jwt: "JWT",
5673
5885
  template_literal: "\u0432\u0445\u043E\u0434"
5674
5886
  };
@@ -5793,6 +6005,8 @@ var error5 = () => {
5793
6005
  json_string: "JSON \u09B8\u09CD\u099F\u09CD\u09B0\u09BF\u0982",
5794
6006
  e164: "E.164 \u09A8\u09AE\u09CD\u09AC\u09B0",
5795
6007
  credit_card: "\u0995\u09CD\u09B0\u09C7\u09A1\u09BF\u099F \u0995\u09BE\u09B0\u09CD\u09A1 \u09A8\u09AE\u09CD\u09AC\u09B0",
6008
+ currency_code: "\u09AE\u09C1\u09A6\u09CD\u09B0\u09BE \u0995\u09CB\u09A1",
6009
+ iban: "IBAN",
5796
6010
  jwt: "JWT",
5797
6011
  template_literal: "\u0987\u09A8\u09AA\u09C1\u099F"
5798
6012
  };
@@ -5905,6 +6119,8 @@ var error6 = () => {
5905
6119
  json_string: "cadena JSON",
5906
6120
  e164: "n\xFAmero E.164",
5907
6121
  credit_card: "n\xFAmero de targeta de cr\xE8dit",
6122
+ currency_code: "codi de moneda",
6123
+ iban: "IBAN",
5908
6124
  jwt: "JWT",
5909
6125
  template_literal: "entrada"
5910
6126
  };
@@ -6017,6 +6233,8 @@ var error7 = () => {
6017
6233
  json_string: "\u062F\u06D5\u0642\u06CC JSON",
6018
6234
  e164: "\u0698\u0645\u0627\u0631\u06D5\u06CC E.164",
6019
6235
  credit_card: "\u0698\u0645\u0627\u0631\u06D5\u06CC \u06A9\u0627\u0631\u062A\u06CC \u06A9\u0631\u06CE\u062F\u06CC\u062A",
6236
+ currency_code: "\u06A9\u06C6\u062F\u06CC \u062F\u0631\u0627\u0648",
6237
+ iban: "IBAN",
6020
6238
  jwt: "JWT",
6021
6239
  template_literal: "\u062A\u06CE\u06A9\u0631\u062F\u06D5"
6022
6240
  };
@@ -6148,6 +6366,8 @@ var error8 = () => {
6148
6366
  json_string: "\u0159et\u011Bzec ve form\xE1tu JSON",
6149
6367
  e164: "\u010D\xEDslo E.164",
6150
6368
  credit_card: "\u010D\xEDslo kreditn\xED karty",
6369
+ currency_code: "k\xF3d m\u011Bny",
6370
+ iban: "IBAN",
6151
6371
  jwt: "JWT",
6152
6372
  template_literal: "vstup"
6153
6373
  };
@@ -6263,6 +6483,8 @@ var error9 = () => {
6263
6483
  json_string: "JSON-streng",
6264
6484
  e164: "E.164-nummer",
6265
6485
  credit_card: "kreditkortnummer",
6486
+ currency_code: "valutakode",
6487
+ iban: "IBAN",
6266
6488
  jwt: "JWT",
6267
6489
  template_literal: "input"
6268
6490
  };
@@ -6382,6 +6604,8 @@ var error10 = () => {
6382
6604
  json_string: "JSON-String",
6383
6605
  e164: "E.164-Nummer",
6384
6606
  credit_card: "Kreditkartennummer",
6607
+ currency_code: "W\xE4hrungscode",
6608
+ iban: "IBAN",
6385
6609
  jwt: "JWT",
6386
6610
  template_literal: "Eingabe"
6387
6611
  };
@@ -6494,6 +6718,8 @@ var error11 = () => {
6494
6718
  json_string: "\u03C3\u03C5\u03BC\u03B2\u03BF\u03BB\u03BF\u03C3\u03B5\u03B9\u03C1\u03AC JSON",
6495
6719
  e164: "\u03B1\u03C1\u03B9\u03B8\u03BC\u03CC\u03C2 E.164",
6496
6720
  credit_card: "\u03B1\u03C1\u03B9\u03B8\u03BC\u03CC\u03C2 \u03C0\u03B9\u03C3\u03C4\u03C9\u03C4\u03B9\u03BA\u03AE\u03C2 \u03BA\u03AC\u03C1\u03C4\u03B1\u03C2",
6721
+ currency_code: "\u03BA\u03C9\u03B4\u03B9\u03BA\u03CC\u03C2 \u03BD\u03BF\u03BC\u03AF\u03C3\u03BC\u03B1\u03C4\u03BF\u03C2",
6722
+ iban: "IBAN",
6497
6723
  jwt: "JWT",
6498
6724
  template_literal: "\u03B5\u03AF\u03C3\u03BF\u03B4\u03BF\u03C2"
6499
6725
  };
@@ -6604,7 +6830,9 @@ var error12 = () => {
6604
6830
  base64url: "base64url-encoded string",
6605
6831
  json_string: "JSON string",
6606
6832
  e164: "E.164 number",
6833
+ currency_code: "currency code",
6607
6834
  credit_card: "credit card number",
6835
+ iban: "IBAN",
6608
6836
  jwt: "JWT",
6609
6837
  template_literal: "input"
6610
6838
  };
@@ -6728,6 +6956,8 @@ var error13 = () => {
6728
6956
  json_string: "JSON-karaktraro",
6729
6957
  e164: "E.164-nombro",
6730
6958
  credit_card: "kreditkarta numero",
6959
+ currency_code: "valuta kodo",
6960
+ iban: "IBAN",
6731
6961
  jwt: "JWT",
6732
6962
  template_literal: "enigo"
6733
6963
  };
@@ -6840,6 +7070,8 @@ var error14 = () => {
6840
7070
  json_string: "cadena JSON",
6841
7071
  e164: "n\xFAmero E.164",
6842
7072
  credit_card: "n\xFAmero de tarjeta de cr\xE9dito",
7073
+ currency_code: "c\xF3digo de moneda",
7074
+ iban: "IBAN",
6843
7075
  jwt: "JWT",
6844
7076
  template_literal: "entrada"
6845
7077
  };
@@ -6976,6 +7208,8 @@ var error15 = () => {
6976
7208
  json_string: "JSON \u0631\u0634\u062A\u0647",
6977
7209
  e164: "E.164 \u0639\u062F\u062F",
6978
7210
  credit_card: "\u0634\u0645\u0627\u0631\u0647 \u06A9\u0627\u0631\u062A \u0627\u0639\u062A\u0628\u0627\u0631\u06CC",
7211
+ currency_code: "\u06A9\u062F \u0627\u0631\u0632",
7212
+ iban: "IBAN",
6979
7213
  jwt: "JWT",
6980
7214
  template_literal: "\u0648\u0631\u0648\u062F\u06CC"
6981
7215
  };
@@ -7098,6 +7332,8 @@ var error16 = () => {
7098
7332
  json_string: "JSON-merkkijono",
7099
7333
  e164: "E.164-luku",
7100
7334
  credit_card: "luottokortin numero",
7335
+ currency_code: "valuuttakoodi",
7336
+ iban: "IBAN",
7101
7337
  jwt: "JWT",
7102
7338
  template_literal: "templaattimerkkijono"
7103
7339
  };
@@ -7209,6 +7445,8 @@ var error17 = () => {
7209
7445
  json_string: "cha\xEEne de caract\xE8res JSON",
7210
7446
  e164: "num\xE9ro au format E.164",
7211
7447
  credit_card: "num\xE9ro de carte de cr\xE9dit",
7448
+ currency_code: "code de devise",
7449
+ iban: "IBAN",
7212
7450
  jwt: "JWT",
7213
7451
  template_literal: "entr\xE9e"
7214
7452
  };
@@ -7338,6 +7576,8 @@ var error18 = () => {
7338
7576
  json_string: "cha\xEEne JSON",
7339
7577
  e164: "num\xE9ro E.164",
7340
7578
  credit_card: "num\xE9ro de carte de cr\xE9dit",
7579
+ currency_code: "code de devise",
7580
+ iban: "IBAN",
7341
7581
  jwt: "JWT",
7342
7582
  template_literal: "entr\xE9e"
7343
7583
  };
@@ -7449,6 +7689,8 @@ var error19 = () => {
7449
7689
  json_string: "JSON \u0AB8\u0ACD\u0A9F\u0ACD\u0AB0\u0ABF\u0A82\u0A97",
7450
7690
  e164: "E.164 \u0AA8\u0A82\u0AAC\u0AB0",
7451
7691
  credit_card: "\u0A95\u0ACD\u0AB0\u0AC7\u0AA1\u0ABF\u0A9F \u0A95\u0ABE\u0AB0\u0ACD\u0AA1 \u0AA8\u0A82\u0AAC\u0AB0",
7692
+ currency_code: "\u0A9A\u0AB2\u0AA3 \u0A95\u0ACB\u0AA1",
7693
+ iban: "IBAN",
7452
7694
  jwt: "JWT",
7453
7695
  template_literal: "\u0A87\u0AA8\u0AAA\u0AC1\u0A9F"
7454
7696
  };
@@ -7597,6 +7839,8 @@ var error20 = () => {
7597
7839
  json_string: { label: "\u05DE\u05D7\u05E8\u05D5\u05D6\u05EA JSON", gender: "f" },
7598
7840
  e164: { label: "\u05DE\u05E1\u05E4\u05E8 E.164", gender: "m" },
7599
7841
  credit_card: { label: "\u05DE\u05E1\u05E4\u05E8 \u05DB\u05E8\u05D8\u05D9\u05E1 \u05D0\u05E9\u05E8\u05D0\u05D9", gender: "m" },
7842
+ currency_code: { label: "\u05E7\u05D5\u05D3 \u05DE\u05D8\u05D1\u05E2", gender: "m" },
7843
+ iban: { label: "IBAN", gender: "m" },
7600
7844
  jwt: { label: "JWT", gender: "m" },
7601
7845
  template_literal: { label: "\u05E7\u05DC\u05D8", gender: "m" },
7602
7846
  ends_with: { label: "\u05E7\u05DC\u05D8", gender: "m" },
@@ -7761,6 +8005,8 @@ var error21 = () => {
7761
8005
  json_string: "JSON \u0938\u094D\u091F\u094D\u0930\u093F\u0902\u0917",
7762
8006
  e164: "E.164 \u0938\u0902\u0916\u094D\u092F\u093E",
7763
8007
  credit_card: "\u0915\u094D\u0930\u0947\u0921\u093F\u091F \u0915\u093E\u0930\u094D\u0921 \u0938\u0902\u0916\u094D\u092F\u093E",
8008
+ currency_code: "\u092E\u0941\u0926\u094D\u0930\u093E \u0915\u094B\u0921",
8009
+ iban: "IBAN",
7764
8010
  jwt: "JWT",
7765
8011
  template_literal: "\u0907\u0928\u092A\u0941\u091F"
7766
8012
  };
@@ -7870,6 +8116,8 @@ var error22 = () => {
7870
8116
  json_string: "JSON tekst",
7871
8117
  e164: "E.164 broj",
7872
8118
  credit_card: "broj kreditne kartice",
8119
+ currency_code: "kod valute",
8120
+ iban: "IBAN",
7873
8121
  jwt: "JWT",
7874
8122
  template_literal: "unos"
7875
8123
  };
@@ -7996,6 +8244,8 @@ var error23 = () => {
7996
8244
  json_string: "JSON string",
7997
8245
  e164: "E.164 sz\xE1m",
7998
8246
  credit_card: "hitelk\xE1rtyasz\xE1m",
8247
+ currency_code: "p\xE9nznemk\xF3d",
8248
+ iban: "IBAN",
7999
8249
  jwt: "JWT",
8000
8250
  template_literal: "bemenet"
8001
8251
  };
@@ -8148,6 +8398,8 @@ var error24 = () => {
8148
8398
  json_string: "JSON \u057F\u0578\u0572",
8149
8399
  e164: "E.164 \u0570\u0561\u0574\u0561\u0580",
8150
8400
  credit_card: "\u056F\u0580\u0565\u0564\u056B\u057F \u0584\u0561\u0580\u057F\u056B \u0570\u0561\u0574\u0561\u0580",
8401
+ currency_code: "\u0561\u0580\u056A\u0578\u0582\u0575\u0569\u056B \u056F\u0578\u0564",
8402
+ iban: "IBAN",
8151
8403
  jwt: "JWT",
8152
8404
  template_literal: "\u0574\u0578\u0582\u057F\u0584"
8153
8405
  };
@@ -8265,6 +8517,8 @@ var error25 = () => {
8265
8517
  json_string: "string JSON",
8266
8518
  e164: "angka E.164",
8267
8519
  credit_card: "nomor kartu kredit",
8520
+ currency_code: "kode mata uang",
8521
+ iban: "IBAN",
8268
8522
  jwt: "JWT",
8269
8523
  template_literal: "input"
8270
8524
  };
@@ -8375,6 +8629,8 @@ var error26 = () => {
8375
8629
  json_string: "JSON strengur",
8376
8630
  e164: "E.164 t\xF6lugildi",
8377
8631
  credit_card: "kreditkortan\xFAmer",
8632
+ currency_code: "gjaldmi\xF0ilsk\xF3\xF0i",
8633
+ iban: "IBAN",
8378
8634
  jwt: "JWT",
8379
8635
  template_literal: "gildi"
8380
8636
  };
@@ -8488,6 +8744,8 @@ var error27 = () => {
8488
8744
  json_string: "stringa JSON",
8489
8745
  e164: "numero E.164",
8490
8746
  credit_card: "numero di carta di credito",
8747
+ currency_code: "codice valuta",
8748
+ iban: "IBAN",
8491
8749
  jwt: "JWT",
8492
8750
  template_literal: "input"
8493
8751
  };
@@ -8600,6 +8858,8 @@ var error28 = () => {
8600
8858
  json_string: "JSON\u6587\u5B57\u5217",
8601
8859
  e164: "E.164\u756A\u53F7",
8602
8860
  credit_card: "\u30AF\u30EC\u30B8\u30C3\u30C8\u30AB\u30FC\u30C9\u756A\u53F7",
8861
+ currency_code: "\u901A\u8CA8\u30B3\u30FC\u30C9",
8862
+ iban: "IBAN",
8603
8863
  jwt: "JWT",
8604
8864
  template_literal: "\u5165\u529B\u5024"
8605
8865
  };
@@ -8711,6 +8971,8 @@ var error29 = () => {
8711
8971
  json_string: "JSON \u10D5\u10D4\u10DA\u10D8",
8712
8972
  e164: "E.164 \u10DC\u10DD\u10DB\u10D4\u10E0\u10D8",
8713
8973
  credit_card: "\u10E1\u10D0\u10D9\u10E0\u10D4\u10D3\u10D8\u10E2\u10DD \u10D1\u10D0\u10E0\u10D0\u10D7\u10D8\u10E1 \u10DC\u10DD\u10DB\u10D4\u10E0\u10D8",
8974
+ currency_code: "\u10D5\u10D0\u10DA\u10E3\u10E2\u10D8\u10E1 \u10D9\u10DD\u10D3\u10D8",
8975
+ iban: "IBAN",
8714
8976
  jwt: "JWT",
8715
8977
  template_literal: "\u10E8\u10D4\u10E7\u10D5\u10D0\u10DC\u10D0"
8716
8978
  };
@@ -8827,6 +9089,8 @@ var error30 = () => {
8827
9089
  json_string: "\u1781\u17D2\u179F\u17C2\u17A2\u1780\u17D2\u179F\u179A JSON",
8828
9090
  e164: "\u179B\u17C1\u1781 E.164",
8829
9091
  credit_card: "\u179B\u17C1\u1781\u1794\u17D0\u178E\u17D2\u178E\u17A5\u178E\u1791\u17B6\u1793",
9092
+ currency_code: "\u1780\u17BC\u178A\u179A\u17BC\u1794\u17B7\u1799\u1794\u17D0\u178E\u17D2\u178E",
9093
+ iban: "IBAN",
8830
9094
  jwt: "JWT",
8831
9095
  template_literal: "\u1791\u17B7\u1793\u17D2\u1793\u1793\u17D0\u1799\u1794\u1789\u17D2\u1785\u17BC\u179B"
8832
9096
  };
@@ -8946,6 +9210,8 @@ var error31 = () => {
8946
9210
  json_string: "JSON\u0CB8\u0CCD\u0C9F\u0CCD\u0CB0\u0CBF\u0C82\u0C97\u0CCD",
8947
9211
  e164: "E.164 \u0CB8\u0C82\u0C96\u0CCD\u0CAF\u0CC6",
8948
9212
  credit_card: "\u0C95\u0CCD\u0CB0\u0CC6\u0CA1\u0CBF\u0C9F\u0CCD \u0C95\u0CBE\u0CB0\u0CCD\u0CA1\u0CCD \u0CB8\u0C82\u0C96\u0CCD\u0CAF\u0CC6",
9213
+ currency_code: "\u0C95\u0CB0\u0CC6\u0CA8\u0CCD\u0CB8\u0CBF \u0C95\u0CCB\u0CA1\u0CCD",
9214
+ iban: "IBAN",
8949
9215
  jwt: "JWT",
8950
9216
  template_literal: "\u0C87\u0CA8\u0CCD\u0CAA\u0CC1\u0C9F\u0CCD"
8951
9217
  };
@@ -9060,6 +9326,8 @@ var error32 = () => {
9060
9326
  json_string: "JSON \uBB38\uC790\uC5F4",
9061
9327
  e164: "E.164 \uBC88\uD638",
9062
9328
  credit_card: "\uC2E0\uC6A9\uCE74\uB4DC \uBC88\uD638",
9329
+ currency_code: "\uD1B5\uD654 \uCF54\uB4DC",
9330
+ iban: "IBAN",
9063
9331
  jwt: "JWT",
9064
9332
  template_literal: "\uC785\uB825"
9065
9333
  };
@@ -9257,6 +9525,8 @@ var error33 = () => {
9257
9525
  json_string: "JSON eilut\u0117",
9258
9526
  e164: "E.164 numeris",
9259
9527
  credit_card: "kredito kortel\u0117s numeris",
9528
+ currency_code: "valiutos kodas",
9529
+ iban: "IBAN",
9260
9530
  jwt: "JWT",
9261
9531
  template_literal: "\u012Fvestis"
9262
9532
  };
@@ -9381,6 +9651,8 @@ var error34 = () => {
9381
9651
  json_string: "JSON \u043D\u0438\u0437\u0430",
9382
9652
  e164: "E.164 \u0431\u0440\u043E\u0458",
9383
9653
  credit_card: "\u0431\u0440\u043E\u0458 \u043D\u0430 \u043A\u0440\u0435\u0434\u0438\u0442\u043D\u0430 \u043A\u0430\u0440\u0442\u0438\u0447\u043A\u0430",
9654
+ currency_code: "\u043A\u043E\u0434 \u043D\u0430 \u0432\u0430\u043B\u0443\u0442\u0430",
9655
+ iban: "IBAN",
9384
9656
  jwt: "JWT",
9385
9657
  template_literal: "\u0432\u043D\u0435\u0441"
9386
9658
  };
@@ -9494,6 +9766,8 @@ var error35 = () => {
9494
9766
  json_string: "string JSON",
9495
9767
  e164: "nombor E.164",
9496
9768
  credit_card: "nombor kad kredit",
9769
+ currency_code: "kod mata wang",
9770
+ iban: "IBAN",
9497
9771
  jwt: "JWT",
9498
9772
  template_literal: "input"
9499
9773
  };
@@ -9605,6 +9879,8 @@ var error36 = () => {
9605
9879
  json_string: "JSON \u0938\u094D\u091F\u094D\u0930\u093F\u0919",
9606
9880
  e164: "E.164 \u0928\u092E\u094D\u092C\u0930",
9607
9881
  credit_card: "\u0915\u094D\u0930\u0947\u0921\u093F\u091F \u0915\u093E\u0930\u094D\u0921 \u0928\u092E\u094D\u092C\u0930",
9882
+ currency_code: "\u092E\u0941\u0926\u094D\u0930\u093E \u0915\u094B\u0921",
9883
+ iban: "IBAN",
9608
9884
  jwt: "JWT",
9609
9885
  template_literal: "\u0907\u0928\u092A\u0941\u091F"
9610
9886
  };
@@ -9715,6 +9991,8 @@ var error37 = () => {
9715
9991
  json_string: "JSON string",
9716
9992
  e164: "E.164-nummer",
9717
9993
  credit_card: "creditcardnummer",
9994
+ currency_code: "valutacode",
9995
+ iban: "IBAN",
9718
9996
  jwt: "JWT",
9719
9997
  template_literal: "invoer"
9720
9998
  };
@@ -9829,6 +10107,8 @@ var error38 = () => {
9829
10107
  json_string: "JSON-streng",
9830
10108
  e164: "E.164-nummer",
9831
10109
  credit_card: "kredittkortnummer",
10110
+ currency_code: "valutakode",
10111
+ iban: "IBAN",
9832
10112
  jwt: "JWT",
9833
10113
  template_literal: "input"
9834
10114
  };
@@ -9941,6 +10221,8 @@ var error39 = () => {
9941
10221
  json_string: "JSON-streng",
9942
10222
  e164: "E.164-nummer",
9943
10223
  credit_card: "kredittkortnummer",
10224
+ currency_code: "valutakode",
10225
+ iban: "IBAN",
9944
10226
  jwt: "JWT",
9945
10227
  template_literal: "input"
9946
10228
  };
@@ -10053,6 +10335,8 @@ var error40 = () => {
10053
10335
  json_string: "JSON metin",
10054
10336
  e164: "E.164 say\u0131s\u0131",
10055
10337
  credit_card: "i'tib\xE2r kart\u0131 numaras\u0131",
10338
+ currency_code: "para birimi kodu",
10339
+ iban: "IBAN",
10056
10340
  jwt: "JWT",
10057
10341
  template_literal: "giren"
10058
10342
  };
@@ -10166,6 +10450,8 @@ var error41 = () => {
10166
10450
  json_string: "JSON \u0645\u062A\u0646",
10167
10451
  e164: "\u062F E.164 \u0634\u0645\u06D0\u0631\u0647",
10168
10452
  credit_card: "\u062F \u06A9\u0631\u06CC\u0689\u06CC\u067C \u06A9\u0627\u0631\u062A \u0634\u0645\u06CC\u0631\u0647",
10453
+ currency_code: "\u062F \u0627\u0633\u0639\u0627\u0631\u0648 \u06A9\u0648\u0689",
10454
+ iban: "IBAN",
10169
10455
  jwt: "JWT",
10170
10456
  template_literal: "\u0648\u0631\u0648\u062F\u064A"
10171
10457
  };
@@ -10284,6 +10570,8 @@ var error42 = () => {
10284
10570
  json_string: "ci\u0105g znak\xF3w w formacie JSON",
10285
10571
  e164: "liczba E.164",
10286
10572
  credit_card: "numer karty kredytowej",
10573
+ currency_code: "kod waluty",
10574
+ iban: "IBAN",
10287
10575
  jwt: "JWT",
10288
10576
  template_literal: "wej\u015Bcie"
10289
10577
  };
@@ -10397,6 +10685,8 @@ var error43 = () => {
10397
10685
  json_string: "o texto JSON",
10398
10686
  e164: "o n\xFAmero E.164",
10399
10687
  credit_card: "o n\xFAmero de cart\xE3o de cr\xE9dito",
10688
+ currency_code: "o c\xF3digo de moeda",
10689
+ iban: "o IBAN",
10400
10690
  jwt: "o JWT",
10401
10691
  template_literal: "a entrada"
10402
10692
  };
@@ -10474,8 +10764,8 @@ var error43 = () => {
10474
10764
  case "not_multiple_of":
10475
10765
  return `N\xFAmero inv\xE1lido: deve ser m\xFAltiplo de ${issue2.divisor}`;
10476
10766
  case "unrecognized_keys": {
10477
- const plural = issue2.keys.length > 1 ? "s" : "";
10478
- return `Chave${plural} inv\xE1lida${plural}: ${joinValues(issue2.keys, ", ")}`;
10767
+ const plural2 = issue2.keys.length > 1 ? "s" : "";
10768
+ return `Chave${plural2} inv\xE1lida${plural2}: ${joinValues(issue2.keys, ", ")}`;
10479
10769
  }
10480
10770
  case "invalid_key":
10481
10771
  return `Entrada inv\xE1lida n${translateOriginWithArticle(issue2.origin, "definite")}`;
@@ -10539,6 +10829,8 @@ var error44 = () => {
10539
10829
  json_string: "o texto JSON",
10540
10830
  e164: "o n\xFAmero E.164",
10541
10831
  credit_card: "o n\xFAmero de cart\xE3o de cr\xE9dito",
10832
+ currency_code: "o c\xF3digo de moeda",
10833
+ iban: "o IBAN",
10542
10834
  jwt: "o JWT",
10543
10835
  template_literal: "a entrada"
10544
10836
  };
@@ -10617,8 +10909,8 @@ var error44 = () => {
10617
10909
  case "not_multiple_of":
10618
10910
  return `N\xFAmero inv\xE1lido: deve ser m\xFAltiplo de ${issue2.divisor}`;
10619
10911
  case "unrecognized_keys": {
10620
- const plural = issue2.keys.length > 1 ? "s" : "";
10621
- return `Chave${plural} inv\xE1lida${plural}: ${joinValues(issue2.keys, ", ")}`;
10912
+ const plural2 = issue2.keys.length > 1 ? "s" : "";
10913
+ return `Chave${plural2} inv\xE1lida${plural2}: ${joinValues(issue2.keys, ", ")}`;
10622
10914
  }
10623
10915
  case "invalid_key":
10624
10916
  return `Entrada inv\xE1lida n${translateOriginWithArticle(issue2.origin, "definite")}`;
@@ -10682,6 +10974,8 @@ var error45 = () => {
10682
10974
  json_string: "\u0219ir JSON",
10683
10975
  e164: "num\u0103r E.164",
10684
10976
  credit_card: "num\u0103r de card de credit",
10977
+ currency_code: "cod valutar",
10978
+ iban: "IBAN",
10685
10979
  jwt: "JWT",
10686
10980
  template_literal: "intrare"
10687
10981
  };
@@ -10853,6 +11147,8 @@ var error46 = () => {
10853
11147
  json_string: "JSON \u0441\u0442\u0440\u043E\u043A\u0430",
10854
11148
  e164: "\u043D\u043E\u043C\u0435\u0440 E.164",
10855
11149
  credit_card: "\u043D\u043E\u043C\u0435\u0440 \u043A\u0440\u0435\u0434\u0438\u0442\u043D\u043E\u0439 \u043A\u0430\u0440\u0442\u044B",
11150
+ currency_code: "\u043A\u043E\u0434 \u0432\u0430\u043B\u044E\u0442\u044B",
11151
+ iban: "IBAN",
10856
11152
  jwt: "JWT",
10857
11153
  template_literal: "\u0432\u0432\u043E\u0434"
10858
11154
  };
@@ -10970,6 +11266,8 @@ var error47 = () => {
10970
11266
  json_string: "re\u0165azec vo form\xE1te JSON",
10971
11267
  e164: "\u010D\xEDslo E.164",
10972
11268
  credit_card: "\u010D\xEDslo kreditnej karty",
11269
+ currency_code: "k\xF3d meny",
11270
+ iban: "IBAN",
10973
11271
  jwt: "JWT",
10974
11272
  template_literal: "vstup"
10975
11273
  };
@@ -11085,6 +11383,8 @@ var error48 = () => {
11085
11383
  json_string: "JSON niz",
11086
11384
  e164: "E.164 \u0161tevilka",
11087
11385
  credit_card: "\u0161tevilka kreditne kartice",
11386
+ currency_code: "koda valute",
11387
+ iban: "IBAN",
11088
11388
  jwt: "JWT",
11089
11389
  template_literal: "vnos"
11090
11390
  };
@@ -11198,6 +11498,8 @@ var error49 = () => {
11198
11498
  json_string: "JSON-str\xE4ng",
11199
11499
  e164: "E.164-nummer",
11200
11500
  credit_card: "kreditkortsnummer",
11501
+ currency_code: "valutakod",
11502
+ iban: "IBAN",
11201
11503
  jwt: "JWT",
11202
11504
  template_literal: "mall-literal"
11203
11505
  };
@@ -11312,6 +11614,8 @@ var error50 = () => {
11312
11614
  json_string: "JSON \u0B9A\u0BB0\u0BAE\u0BCD",
11313
11615
  e164: "E.164 \u0B8E\u0BA3\u0BCD",
11314
11616
  credit_card: "\u0B95\u0B9F\u0BA9\u0BCD \u0B85\u0B9F\u0BCD\u0B9F\u0BC8 \u0B8E\u0BA3\u0BCD",
11617
+ currency_code: "\u0BA8\u0BBE\u0BA3\u0BAF\u0B95\u0BCD \u0B95\u0BC1\u0BB1\u0BBF\u0BAF\u0BC0\u0B9F\u0BC1",
11618
+ iban: "IBAN",
11315
11619
  jwt: "JWT",
11316
11620
  template_literal: "input"
11317
11621
  };
@@ -11385,23 +11689,23 @@ function ta_default() {
11385
11689
  };
11386
11690
  }
11387
11691
 
11388
- // node_modules/zod/v4/locales/th.js
11692
+ // node_modules/zod/v4/locales/tg.js
11389
11693
  var error51 = () => {
11390
11694
  const Sizable = {
11391
- string: { unit: "\u0E15\u0E31\u0E27\u0E2D\u0E31\u0E01\u0E29\u0E23", verb: "\u0E04\u0E27\u0E23\u0E21\u0E35" },
11392
- file: { unit: "\u0E44\u0E1A\u0E15\u0E4C", verb: "\u0E04\u0E27\u0E23\u0E21\u0E35" },
11393
- array: { unit: "\u0E23\u0E32\u0E22\u0E01\u0E32\u0E23", verb: "\u0E04\u0E27\u0E23\u0E21\u0E35" },
11394
- set: { unit: "\u0E23\u0E32\u0E22\u0E01\u0E32\u0E23", verb: "\u0E04\u0E27\u0E23\u0E21\u0E35" },
11395
- map: { unit: "\u0E23\u0E32\u0E22\u0E01\u0E32\u0E23", verb: "\u0E04\u0E27\u0E23\u0E21\u0E35" }
11695
+ string: { unit: "\u0430\u043B\u043E\u043C\u0430\u0442", verb: "\u0434\u043E\u0448\u0442\u0430 \u0431\u043E\u0448\u0430\u0434" },
11696
+ file: { unit: "\u0431\u0430\u0439\u0442", verb: "\u0434\u043E\u0448\u0442\u0430 \u0431\u043E\u0448\u0430\u0434" },
11697
+ array: { unit: "\u0443\u043D\u0441\u0443\u0440", verb: "\u0434\u043E\u0448\u0442\u0430 \u0431\u043E\u0448\u0430\u0434" },
11698
+ set: { unit: "\u0443\u043D\u0441\u0443\u0440", verb: "\u0434\u043E\u0448\u0442\u0430 \u0431\u043E\u0448\u0430\u0434" },
11699
+ map: { unit: "\u0441\u0430\u0431\u0442", verb: "\u0434\u043E\u0448\u0442\u0430 \u0431\u043E\u0448\u0430\u0434" }
11396
11700
  };
11397
11701
  function getSizing(origin) {
11398
11702
  return Sizable[origin] ?? null;
11399
11703
  }
11400
11704
  const FormatDictionary = {
11401
- regex: "\u0E02\u0E49\u0E2D\u0E21\u0E39\u0E25\u0E17\u0E35\u0E48\u0E1B\u0E49\u0E2D\u0E19",
11402
- email: "\u0E17\u0E35\u0E48\u0E2D\u0E22\u0E39\u0E48\u0E2D\u0E35\u0E40\u0E21\u0E25",
11705
+ regex: "\u0432\u0443\u0440\u0443\u0434",
11706
+ email: "\u0441\u0443\u0440\u043E\u0493\u0430\u0438 email",
11403
11707
  url: "URL",
11404
- emoji: "\u0E2D\u0E34\u0E42\u0E21\u0E08\u0E34",
11708
+ emoji: "\u044D\u043C\u043E\u04B7\u0438",
11405
11709
  uuid: "UUID",
11406
11710
  uuidv4: "UUIDv4",
11407
11711
  uuidv6: "UUIDv6",
@@ -11412,22 +11716,141 @@ var error51 = () => {
11412
11716
  ulid: "ULID",
11413
11717
  xid: "XID",
11414
11718
  ksuid: "KSUID",
11415
- datetime: "\u0E27\u0E31\u0E19\u0E17\u0E35\u0E48\u0E40\u0E27\u0E25\u0E32\u0E41\u0E1A\u0E1A ISO",
11416
- date: "\u0E27\u0E31\u0E19\u0E17\u0E35\u0E48\u0E41\u0E1A\u0E1A ISO",
11417
- time: "\u0E40\u0E27\u0E25\u0E32\u0E41\u0E1A\u0E1A ISO",
11418
- duration: "\u0E0A\u0E48\u0E27\u0E07\u0E40\u0E27\u0E25\u0E32\u0E41\u0E1A\u0E1A ISO",
11419
- ipv4: "\u0E17\u0E35\u0E48\u0E2D\u0E22\u0E39\u0E48 IPv4",
11420
- ipv6: "\u0E17\u0E35\u0E48\u0E2D\u0E22\u0E39\u0E48 IPv6",
11421
- mac: "\u0E17\u0E35\u0E48\u0E2D\u0E22\u0E39\u0E48 MAC",
11422
- cidrv4: "\u0E0A\u0E48\u0E27\u0E07 IP \u0E41\u0E1A\u0E1A IPv4",
11423
- cidrv6: "\u0E0A\u0E48\u0E27\u0E07 IP \u0E41\u0E1A\u0E1A IPv6",
11424
- base64: "\u0E02\u0E49\u0E2D\u0E04\u0E27\u0E32\u0E21\u0E41\u0E1A\u0E1A Base64",
11425
- base64url: "\u0E02\u0E49\u0E2D\u0E04\u0E27\u0E32\u0E21\u0E41\u0E1A\u0E1A Base64 \u0E2A\u0E33\u0E2B\u0E23\u0E31\u0E1A URL",
11426
- json_string: "\u0E02\u0E49\u0E2D\u0E04\u0E27\u0E32\u0E21\u0E41\u0E1A\u0E1A JSON",
11427
- e164: "\u0E40\u0E1A\u0E2D\u0E23\u0E4C\u0E42\u0E17\u0E23\u0E28\u0E31\u0E1E\u0E17\u0E4C\u0E23\u0E30\u0E2B\u0E27\u0E48\u0E32\u0E07\u0E1B\u0E23\u0E30\u0E40\u0E17\u0E28 (E.164)",
11428
- credit_card: "\u0E2B\u0E21\u0E32\u0E22\u0E40\u0E25\u0E02\u0E1A\u0E31\u0E15\u0E23\u0E40\u0E04\u0E23\u0E14\u0E34\u0E15",
11429
- jwt: "\u0E42\u0E17\u0E40\u0E04\u0E19 JWT",
11430
- template_literal: "\u0E02\u0E49\u0E2D\u0E21\u0E39\u0E25\u0E17\u0E35\u0E48\u0E1B\u0E49\u0E2D\u0E19"
11719
+ datetime: "\u0441\u0430\u043D\u0430\u0432\u0443 \u0432\u0430\u049B\u0442\u0438 ISO",
11720
+ date: "\u0441\u0430\u043D\u0430\u0438 ISO",
11721
+ time: "\u0432\u0430\u049B\u0442\u0438 ISO",
11722
+ duration: "\u0434\u0430\u0432\u043E\u043C\u043D\u043E\u043A\u0438\u0438 ISO",
11723
+ ipv4: "\u0441\u0443\u0440\u043E\u0493\u0430\u0438 IPv4",
11724
+ ipv6: "\u0441\u0443\u0440\u043E\u0493\u0430\u0438 IPv6",
11725
+ mac: "\u0441\u0443\u0440\u043E\u0493\u0430\u0438 MAC",
11726
+ cidrv4: "\u043C\u0430\u04B3\u0434\u0443\u0434\u0430\u0438 IPv4",
11727
+ cidrv6: "\u043C\u0430\u04B3\u0434\u0443\u0434\u0430\u0438 IPv6",
11728
+ base64: "\u0441\u0430\u0442\u0440\u0438 \u0434\u0430\u0440 \u0444\u043E\u0440\u043C\u0430\u0442\u0438 base64",
11729
+ base64url: "\u0441\u0430\u0442\u0440\u0438 \u0434\u0430\u0440 \u0444\u043E\u0440\u043C\u0430\u0442\u0438 base64url",
11730
+ json_string: "\u0441\u0430\u0442\u0440\u0438 JSON",
11731
+ e164: "\u0440\u0430\u049B\u0430\u043C\u0438 E.164",
11732
+ credit_card: "\u0440\u0430\u049B\u0430\u043C\u0438 \u043A\u043E\u0440\u0442\u0438 \u043A\u0440\u0435\u0434\u0438\u0442\u04E3",
11733
+ currency_code: "\u0440\u0430\u043C\u0437\u0438 \u0430\u0441\u044A\u043E\u0440",
11734
+ iban: "IBAN",
11735
+ jwt: "JWT",
11736
+ template_literal: "\u0432\u0443\u0440\u0443\u0434"
11737
+ };
11738
+ const TypeDictionary = {
11739
+ nan: "NaN",
11740
+ number: "\u0440\u0430\u049B\u0430\u043C",
11741
+ string: "\u0441\u0430\u0442\u0440",
11742
+ array: "\u043C\u0430\u0441\u0441\u0438\u0432",
11743
+ object: "\u043E\u0431\u044A\u0435\u043A\u0442",
11744
+ date: "\u0441\u0430\u043D\u0430"
11745
+ };
11746
+ return (issue2) => {
11747
+ switch (issue2.code) {
11748
+ case "invalid_type": {
11749
+ const expected = TypeDictionary[issue2.expected] ?? issue2.expected;
11750
+ const receivedType = parsedType(issue2.input);
11751
+ const received = TypeDictionary[receivedType] ?? receivedType;
11752
+ return `\u0412\u0443\u0440\u0443\u0434\u0438 \u043D\u043E\u0434\u0443\u0440\u0443\u0441\u0442: ${expected} \u0438\u043D\u0442\u0438\u0437\u043E\u0440 \u043C\u0435\u0440\u0430\u0444\u0442, ${received} \u0433\u0438\u0440\u0438\u0444\u0442\u0430 \u0448\u0443\u0434`;
11753
+ }
11754
+ case "invalid_value":
11755
+ if (issue2.values.length === 1)
11756
+ return `\u0412\u0443\u0440\u0443\u0434\u0438 \u043D\u043E\u0434\u0443\u0440\u0443\u0441\u0442: ${stringifyPrimitive(issue2.values[0])} \u0438\u043D\u0442\u0438\u0437\u043E\u0440 \u043C\u0435\u0440\u0430\u0444\u0442`;
11757
+ return `\u0418\u043D\u0442\u0438\u0445\u043E\u0431\u0438 \u043D\u043E\u0434\u0443\u0440\u0443\u0441\u0442: \u044F\u043A\u0435 \u0430\u0437 ${joinValues(issue2.values, "|")} \u0438\u043D\u0442\u0438\u0437\u043E\u0440 \u043C\u0435\u0440\u0430\u0444\u0442`;
11758
+ case "too_big": {
11759
+ const adj = issue2.inclusive ? "<=" : "<";
11760
+ const sizing = getSizing(issue2.origin);
11761
+ if (sizing)
11762
+ return `\u0425\u0435\u043B\u0435 \u043A\u0430\u043B\u043E\u043D: ${issue2.origin ?? "\u049B\u0438\u043C\u0430\u0442"} \u0431\u043E\u044F\u0434 ${adj}${issue2.maximum.toString()} ${sizing.unit} ${sizing.verb}`;
11763
+ return `\u0425\u0435\u043B\u0435 \u043A\u0430\u043B\u043E\u043D: ${issue2.origin ?? "\u049B\u0438\u043C\u0430\u0442"} \u0431\u043E\u044F\u0434 ${adj}${issue2.maximum.toString()} \u0431\u043E\u0448\u0430\u0434`;
11764
+ }
11765
+ case "too_small": {
11766
+ const adj = issue2.inclusive ? ">=" : ">";
11767
+ const sizing = getSizing(issue2.origin);
11768
+ if (sizing)
11769
+ return `\u0425\u0435\u043B\u0435 \u0445\u0443\u0440\u0434: ${issue2.origin} \u0431\u043E\u044F\u0434 ${adj}${issue2.minimum.toString()} ${sizing.unit} ${sizing.verb}`;
11770
+ return `\u0425\u0435\u043B\u0435 \u0445\u0443\u0440\u0434: ${issue2.origin} \u0431\u043E\u044F\u0434 ${adj}${issue2.minimum.toString()} \u0431\u043E\u0448\u0430\u0434`;
11771
+ }
11772
+ case "invalid_format": {
11773
+ const _issue = issue2;
11774
+ if (_issue.format === "starts_with")
11775
+ return `\u0421\u0430\u0442\u0440\u0438 \u043D\u043E\u0434\u0443\u0440\u0443\u0441\u0442: \u0431\u043E\u044F\u0434 \u0431\u043E "${_issue.prefix}" \u043E\u0493\u043E\u0437 \u0448\u0430\u0432\u0430\u0434`;
11776
+ if (_issue.format === "ends_with")
11777
+ return `\u0421\u0430\u0442\u0440\u0438 \u043D\u043E\u0434\u0443\u0440\u0443\u0441\u0442: \u0431\u043E\u044F\u0434 \u0431\u043E "${_issue.suffix}" \u0430\u043D\u04B7\u043E\u043C \u0451\u0431\u0430\u0434`;
11778
+ if (_issue.format === "includes")
11779
+ return `\u0421\u0430\u0442\u0440\u0438 \u043D\u043E\u0434\u0443\u0440\u0443\u0441\u0442: \u0431\u043E\u044F\u0434 "${_issue.includes}"-\u0440\u043E \u0434\u0430\u0440 \u0431\u0430\u0440 \u0433\u0438\u0440\u0430\u0434`;
11780
+ if (_issue.format === "regex")
11781
+ return `\u0421\u0430\u0442\u0440\u0438 \u043D\u043E\u0434\u0443\u0440\u0443\u0441\u0442: \u0431\u043E\u044F\u0434 \u0431\u0430 \u043D\u0430\u043C\u0443\u043D\u0430\u0438 ${_issue.pattern} \u043C\u0443\u0432\u043E\u0444\u0438\u049B\u0430\u0442 \u043A\u0443\u043D\u0430\u0434`;
11782
+ return `${FormatDictionary[_issue.format] ?? issue2.format}-\u0438 \u043D\u043E\u0434\u0443\u0440\u0443\u0441\u0442`;
11783
+ }
11784
+ case "not_multiple_of":
11785
+ return `\u0420\u0430\u049B\u0430\u043C\u0438 \u043D\u043E\u0434\u0443\u0440\u0443\u0441\u0442: \u0431\u043E\u044F\u0434 \u0431\u0430 ${issue2.divisor} \u0431\u0435 \u0431\u0430\u049B\u0438\u044F \u0442\u0430\u049B\u0441\u0438\u043C \u0448\u0430\u0432\u0430\u0434`;
11786
+ case "unrecognized_keys":
11787
+ return `\u041A\u0430\u043B\u0438\u0434${issue2.keys.length > 1 ? "\u04B3\u043E\u0438" : "\u0438"} \u043D\u043E\u043C\u0430\u044A\u043B\u0443\u043C: ${joinValues(issue2.keys, ", ")}`;
11788
+ case "invalid_key":
11789
+ return `\u041A\u0430\u043B\u0438\u0434\u0438 \u043D\u043E\u0434\u0443\u0440\u0443\u0441\u0442 \u0434\u0430\u0440 ${issue2.origin}`;
11790
+ case "invalid_union":
11791
+ if (issue2.options && Array.isArray(issue2.options) && issue2.options.length > 0) {
11792
+ const opts = issue2.options.map((o) => `'${o}'`).join(" | ");
11793
+ return `\u049A\u0438\u043C\u0430\u0442\u0438 \u043D\u043E\u0434\u0443\u0440\u0443\u0441\u0442\u0438 \u0434\u0438\u0441\u043A\u0440\u0438\u043C\u0438\u043D\u0430\u0442\u043E\u0440: ${opts} \u0438\u043D\u0442\u0438\u0437\u043E\u0440 \u043C\u0435\u0440\u0430\u0444\u0442`;
11794
+ }
11795
+ return "\u0412\u0443\u0440\u0443\u0434\u0438 \u043D\u043E\u0434\u0443\u0440\u0443\u0441\u0442";
11796
+ case "invalid_element":
11797
+ return `\u049A\u0438\u043C\u0430\u0442\u0438 \u043D\u043E\u0434\u0443\u0440\u0443\u0441\u0442 \u0434\u0430\u0440 ${issue2.origin}`;
11798
+ default:
11799
+ return `\u0412\u0443\u0440\u0443\u0434\u0438 \u043D\u043E\u0434\u0443\u0440\u0443\u0441\u0442`;
11800
+ }
11801
+ };
11802
+ };
11803
+ function tg_default() {
11804
+ return {
11805
+ localeError: error51()
11806
+ };
11807
+ }
11808
+
11809
+ // node_modules/zod/v4/locales/th.js
11810
+ var error52 = () => {
11811
+ const Sizable = {
11812
+ string: { unit: "\u0E15\u0E31\u0E27\u0E2D\u0E31\u0E01\u0E29\u0E23", verb: "\u0E04\u0E27\u0E23\u0E21\u0E35" },
11813
+ file: { unit: "\u0E44\u0E1A\u0E15\u0E4C", verb: "\u0E04\u0E27\u0E23\u0E21\u0E35" },
11814
+ array: { unit: "\u0E23\u0E32\u0E22\u0E01\u0E32\u0E23", verb: "\u0E04\u0E27\u0E23\u0E21\u0E35" },
11815
+ set: { unit: "\u0E23\u0E32\u0E22\u0E01\u0E32\u0E23", verb: "\u0E04\u0E27\u0E23\u0E21\u0E35" },
11816
+ map: { unit: "\u0E23\u0E32\u0E22\u0E01\u0E32\u0E23", verb: "\u0E04\u0E27\u0E23\u0E21\u0E35" }
11817
+ };
11818
+ function getSizing(origin) {
11819
+ return Sizable[origin] ?? null;
11820
+ }
11821
+ const FormatDictionary = {
11822
+ regex: "\u0E02\u0E49\u0E2D\u0E21\u0E39\u0E25\u0E17\u0E35\u0E48\u0E1B\u0E49\u0E2D\u0E19",
11823
+ email: "\u0E17\u0E35\u0E48\u0E2D\u0E22\u0E39\u0E48\u0E2D\u0E35\u0E40\u0E21\u0E25",
11824
+ url: "URL",
11825
+ emoji: "\u0E2D\u0E34\u0E42\u0E21\u0E08\u0E34",
11826
+ uuid: "UUID",
11827
+ uuidv4: "UUIDv4",
11828
+ uuidv6: "UUIDv6",
11829
+ nanoid: "nanoid",
11830
+ guid: "GUID",
11831
+ cuid: "cuid",
11832
+ cuid2: "cuid2",
11833
+ ulid: "ULID",
11834
+ xid: "XID",
11835
+ ksuid: "KSUID",
11836
+ datetime: "\u0E27\u0E31\u0E19\u0E17\u0E35\u0E48\u0E40\u0E27\u0E25\u0E32\u0E41\u0E1A\u0E1A ISO",
11837
+ date: "\u0E27\u0E31\u0E19\u0E17\u0E35\u0E48\u0E41\u0E1A\u0E1A ISO",
11838
+ time: "\u0E40\u0E27\u0E25\u0E32\u0E41\u0E1A\u0E1A ISO",
11839
+ duration: "\u0E0A\u0E48\u0E27\u0E07\u0E40\u0E27\u0E25\u0E32\u0E41\u0E1A\u0E1A ISO",
11840
+ ipv4: "\u0E17\u0E35\u0E48\u0E2D\u0E22\u0E39\u0E48 IPv4",
11841
+ ipv6: "\u0E17\u0E35\u0E48\u0E2D\u0E22\u0E39\u0E48 IPv6",
11842
+ mac: "\u0E17\u0E35\u0E48\u0E2D\u0E22\u0E39\u0E48 MAC",
11843
+ cidrv4: "\u0E0A\u0E48\u0E27\u0E07 IP \u0E41\u0E1A\u0E1A IPv4",
11844
+ cidrv6: "\u0E0A\u0E48\u0E27\u0E07 IP \u0E41\u0E1A\u0E1A IPv6",
11845
+ base64: "\u0E02\u0E49\u0E2D\u0E04\u0E27\u0E32\u0E21\u0E41\u0E1A\u0E1A Base64",
11846
+ base64url: "\u0E02\u0E49\u0E2D\u0E04\u0E27\u0E32\u0E21\u0E41\u0E1A\u0E1A Base64 \u0E2A\u0E33\u0E2B\u0E23\u0E31\u0E1A URL",
11847
+ json_string: "\u0E02\u0E49\u0E2D\u0E04\u0E27\u0E32\u0E21\u0E41\u0E1A\u0E1A JSON",
11848
+ e164: "\u0E40\u0E1A\u0E2D\u0E23\u0E4C\u0E42\u0E17\u0E23\u0E28\u0E31\u0E1E\u0E17\u0E4C\u0E23\u0E30\u0E2B\u0E27\u0E48\u0E32\u0E07\u0E1B\u0E23\u0E30\u0E40\u0E17\u0E28 (E.164)",
11849
+ credit_card: "\u0E2B\u0E21\u0E32\u0E22\u0E40\u0E25\u0E02\u0E1A\u0E31\u0E15\u0E23\u0E40\u0E04\u0E23\u0E14\u0E34\u0E15",
11850
+ currency_code: "\u0E23\u0E2B\u0E31\u0E2A\u0E2A\u0E01\u0E38\u0E25\u0E40\u0E07\u0E34\u0E19",
11851
+ iban: "IBAN",
11852
+ jwt: "\u0E42\u0E17\u0E40\u0E04\u0E19 JWT",
11853
+ template_literal: "\u0E02\u0E49\u0E2D\u0E21\u0E39\u0E25\u0E17\u0E35\u0E48\u0E1B\u0E49\u0E2D\u0E19"
11431
11854
  };
11432
11855
  const TypeDictionary = {
11433
11856
  nan: "NaN",
@@ -11495,12 +11918,12 @@ var error51 = () => {
11495
11918
  };
11496
11919
  function th_default() {
11497
11920
  return {
11498
- localeError: error51()
11921
+ localeError: error52()
11499
11922
  };
11500
11923
  }
11501
11924
 
11502
11925
  // node_modules/zod/v4/locales/tk.js
11503
- var error52 = () => {
11926
+ var error53 = () => {
11504
11927
  const Sizable = {
11505
11928
  string: { unit: "simwol", verb: "bolmaly" },
11506
11929
  file: { unit: "ba\xFDt", verb: "bolmaly" },
@@ -11540,6 +11963,8 @@ var error52 = () => {
11540
11963
  json_string: "JSON setiri",
11541
11964
  e164: "E.164 nomeri",
11542
11965
  credit_card: "kredit kartyny\u0148 nomeri",
11966
+ currency_code: "wal\xFDuta kody",
11967
+ iban: "IBAN",
11543
11968
  jwt: "JWT",
11544
11969
  template_literal: "\u015Fablon"
11545
11970
  };
@@ -11601,12 +12026,12 @@ var error52 = () => {
11601
12026
  };
11602
12027
  function tk_default() {
11603
12028
  return {
11604
- localeError: error52()
12029
+ localeError: error53()
11605
12030
  };
11606
12031
  }
11607
12032
 
11608
12033
  // node_modules/zod/v4/locales/tr.js
11609
- var error53 = () => {
12034
+ var error54 = () => {
11610
12035
  const Sizable = {
11611
12036
  string: { unit: "karakter", verb: "olmal\u0131" },
11612
12037
  file: { unit: "bayt", verb: "olmal\u0131" },
@@ -11646,6 +12071,8 @@ var error53 = () => {
11646
12071
  json_string: "JSON dizesi",
11647
12072
  e164: "E.164 say\u0131s\u0131",
11648
12073
  credit_card: "kredi kart\u0131 numaras\u0131",
12074
+ currency_code: "para birimi kodu",
12075
+ iban: "IBAN",
11649
12076
  jwt: "JWT",
11650
12077
  template_literal: "\u015Eablon dizesi"
11651
12078
  };
@@ -11710,12 +12137,12 @@ var error53 = () => {
11710
12137
  };
11711
12138
  function tr_default() {
11712
12139
  return {
11713
- localeError: error53()
12140
+ localeError: error54()
11714
12141
  };
11715
12142
  }
11716
12143
 
11717
12144
  // node_modules/zod/v4/locales/uk.js
11718
- var error54 = () => {
12145
+ var error55 = () => {
11719
12146
  const Sizable = {
11720
12147
  string: { unit: "\u0441\u0438\u043C\u0432\u043E\u043B\u0456\u0432", verb: "\u043C\u0430\u0442\u0438\u043C\u0435" },
11721
12148
  file: { unit: "\u0431\u0430\u0439\u0442\u0456\u0432", verb: "\u043C\u0430\u0442\u0438\u043C\u0435" },
@@ -11755,6 +12182,8 @@ var error54 = () => {
11755
12182
  json_string: "\u0440\u044F\u0434\u043E\u043A JSON",
11756
12183
  e164: "\u043D\u043E\u043C\u0435\u0440 E.164",
11757
12184
  credit_card: "\u043D\u043E\u043C\u0435\u0440 \u043A\u0440\u0435\u0434\u0438\u0442\u043D\u043E\u0457 \u043A\u0430\u0440\u0442\u043A\u0438",
12185
+ currency_code: "\u043A\u043E\u0434 \u0432\u0430\u043B\u044E\u0442\u0438",
12186
+ iban: "IBAN",
11758
12187
  jwt: "JWT",
11759
12188
  template_literal: "\u0432\u0445\u0456\u0434\u043D\u0456 \u0434\u0430\u043D\u0456"
11760
12189
  };
@@ -11822,7 +12251,7 @@ var error54 = () => {
11822
12251
  };
11823
12252
  function uk_default() {
11824
12253
  return {
11825
- localeError: error54()
12254
+ localeError: error55()
11826
12255
  };
11827
12256
  }
11828
12257
 
@@ -11832,7 +12261,7 @@ function ua_default() {
11832
12261
  }
11833
12262
 
11834
12263
  // node_modules/zod/v4/locales/ur.js
11835
- var error55 = () => {
12264
+ var error56 = () => {
11836
12265
  const Sizable = {
11837
12266
  string: { unit: "\u062D\u0631\u0648\u0641", verb: "\u06C1\u0648\u0646\u0627" },
11838
12267
  file: { unit: "\u0628\u0627\u0626\u0679\u0633", verb: "\u06C1\u0648\u0646\u0627" },
@@ -11872,6 +12301,8 @@ var error55 = () => {
11872
12301
  json_string: "\u062C\u06D2 \u0627\u06CC\u0633 \u0627\u0648 \u0627\u06CC\u0646 \u0633\u0679\u0631\u0646\u06AF",
11873
12302
  e164: "\u0627\u06CC 164 \u0646\u0645\u0628\u0631",
11874
12303
  credit_card: "\u06A9\u0631\u06CC\u0688\u0679 \u06A9\u0627\u0631\u0688 \u0646\u0645\u0628\u0631",
12304
+ currency_code: "\u06A9\u0631\u0646\u0633\u06CC \u06A9\u0648\u0688",
12305
+ iban: "IBAN",
11875
12306
  jwt: "\u062C\u06D2 \u0688\u0628\u0644\u06CC\u0648 \u0679\u06CC",
11876
12307
  template_literal: "\u0627\u0646 \u067E\u0679"
11877
12308
  };
@@ -11941,12 +12372,12 @@ var error55 = () => {
11941
12372
  };
11942
12373
  function ur_default() {
11943
12374
  return {
11944
- localeError: error55()
12375
+ localeError: error56()
11945
12376
  };
11946
12377
  }
11947
12378
 
11948
12379
  // node_modules/zod/v4/locales/uz.js
11949
- var error56 = () => {
12380
+ var error57 = () => {
11950
12381
  const Sizable = {
11951
12382
  string: { unit: "belgi", verb: "bo\u2018lishi kerak" },
11952
12383
  file: { unit: "bayt", verb: "bo\u2018lishi kerak" },
@@ -11986,6 +12417,8 @@ var error56 = () => {
11986
12417
  json_string: "JSON satr",
11987
12418
  e164: "E.164 raqam",
11988
12419
  credit_card: "kredit karta raqami",
12420
+ currency_code: "valyuta kodi",
12421
+ iban: "IBAN",
11989
12422
  jwt: "JWT",
11990
12423
  template_literal: "kirish"
11991
12424
  };
@@ -12053,12 +12486,12 @@ var error56 = () => {
12053
12486
  };
12054
12487
  function uz_default() {
12055
12488
  return {
12056
- localeError: error56()
12489
+ localeError: error57()
12057
12490
  };
12058
12491
  }
12059
12492
 
12060
12493
  // node_modules/zod/v4/locales/vi.js
12061
- var error57 = () => {
12494
+ var error58 = () => {
12062
12495
  const Sizable = {
12063
12496
  string: { unit: "k\xFD t\u1EF1", verb: "c\xF3" },
12064
12497
  file: { unit: "byte", verb: "c\xF3" },
@@ -12098,6 +12531,8 @@ var error57 = () => {
12098
12531
  json_string: "chu\u1ED7i JSON",
12099
12532
  e164: "s\u1ED1 E.164",
12100
12533
  credit_card: "s\u1ED1 th\u1EBB t\xEDn d\u1EE5ng",
12534
+ currency_code: "m\xE3 ti\u1EC1n t\u1EC7",
12535
+ iban: "IBAN",
12101
12536
  jwt: "JWT",
12102
12537
  template_literal: "\u0111\u1EA7u v\xE0o"
12103
12538
  };
@@ -12165,12 +12600,12 @@ var error57 = () => {
12165
12600
  };
12166
12601
  function vi_default() {
12167
12602
  return {
12168
- localeError: error57()
12603
+ localeError: error58()
12169
12604
  };
12170
12605
  }
12171
12606
 
12172
12607
  // node_modules/zod/v4/locales/zh-CN.js
12173
- var error58 = () => {
12608
+ var error59 = () => {
12174
12609
  const Sizable = {
12175
12610
  string: { unit: "\u5B57\u7B26", verb: "\u5305\u542B" },
12176
12611
  file: { unit: "\u5B57\u8282", verb: "\u5305\u542B" },
@@ -12210,6 +12645,8 @@ var error58 = () => {
12210
12645
  json_string: "JSON\u5B57\u7B26\u4E32",
12211
12646
  e164: "E.164\u53F7\u7801",
12212
12647
  credit_card: "\u4FE1\u7528\u5361\u53F7",
12648
+ currency_code: "\u8D27\u5E01\u4EE3\u7801",
12649
+ iban: "IBAN",
12213
12650
  jwt: "JWT",
12214
12651
  template_literal: "\u8F93\u5165"
12215
12652
  };
@@ -12278,12 +12715,12 @@ var error58 = () => {
12278
12715
  };
12279
12716
  function zh_CN_default() {
12280
12717
  return {
12281
- localeError: error58()
12718
+ localeError: error59()
12282
12719
  };
12283
12720
  }
12284
12721
 
12285
12722
  // node_modules/zod/v4/locales/zh-TW.js
12286
- var error59 = () => {
12723
+ var error60 = () => {
12287
12724
  const Sizable = {
12288
12725
  string: { unit: "\u5B57\u5143", verb: "\u64C1\u6709" },
12289
12726
  file: { unit: "\u4F4D\u5143\u7D44", verb: "\u64C1\u6709" },
@@ -12323,6 +12760,8 @@ var error59 = () => {
12323
12760
  json_string: "JSON \u5B57\u4E32",
12324
12761
  e164: "E.164 \u6578\u503C",
12325
12762
  credit_card: "\u4FE1\u7528\u5361\u865F",
12763
+ currency_code: "\u8CA8\u5E63\u4EE3\u78BC",
12764
+ iban: "IBAN",
12326
12765
  jwt: "JWT",
12327
12766
  template_literal: "\u8F38\u5165"
12328
12767
  };
@@ -12389,12 +12828,12 @@ var error59 = () => {
12389
12828
  };
12390
12829
  function zh_TW_default() {
12391
12830
  return {
12392
- localeError: error59()
12831
+ localeError: error60()
12393
12832
  };
12394
12833
  }
12395
12834
 
12396
12835
  // node_modules/zod/v4/locales/yo.js
12397
- var error60 = () => {
12836
+ var error61 = () => {
12398
12837
  const Sizable = {
12399
12838
  string: { unit: "\xE0mi", verb: "n\xED" },
12400
12839
  file: { unit: "bytes", verb: "n\xED" },
@@ -12434,6 +12873,8 @@ var error60 = () => {
12434
12873
  json_string: "\u1ECD\u0300r\u1ECD\u0300 JSON",
12435
12874
  e164: "n\u1ECD\u0301mb\xE0 E.164",
12436
12875
  credit_card: "n\u1ECDmba kaadi gbese",
12876
+ currency_code: "koodu ow\xF3",
12877
+ iban: "IBAN",
12437
12878
  jwt: "JWT",
12438
12879
  template_literal: "\u1EB9\u0300r\u1ECD \xECb\xE1w\u1ECDl\xE9"
12439
12880
  };
@@ -12500,7 +12941,7 @@ var error60 = () => {
12500
12941
  };
12501
12942
  function yo_default() {
12502
12943
  return {
12503
- localeError: error60()
12944
+ localeError: error61()
12504
12945
  };
12505
12946
  }
12506
12947
 
@@ -12580,31 +13021,8 @@ function compileValidator(schema, parser) {
12580
13021
  function compile(schema, options) {
12581
13022
  try {
12582
13023
  const parser = compileFn(schema);
12583
- const clone2 = clone(schema);
12584
- const liveRun = schema._zod.run;
12585
- const originalRun = liveRun.__originalRun ?? liveRun;
12586
- const wrapped = (payload, ctx) => {
12587
- if (ctx?.async || ctx?.direction === "backward" || ctx?.skipChecks || ctx?.[FALLBACK_FLAG]) {
12588
- return originalRun(payload, ctx);
12589
- }
12590
- if (ctx && isBackEdge(ctx, payload.value)) {
12591
- return originalRun(payload, ctx);
12592
- }
12593
- const out = parser(payload.value);
12594
- if (out !== INVALID) {
12595
- payload.value = out;
12596
- return payload;
12597
- }
12598
- if (ctx)
12599
- ctx[FALLBACK_FLAG] = true;
12600
- return originalRun(payload, ctx);
12601
- };
12602
- wrapped.__originalRun = originalRun;
12603
- clone2._zod.bag.fallbackRun = originalRun;
13024
+ const clone2 = withParser(schema, parser);
12604
13025
  clone2._zod.bag.validator = compileValidator(schema, parser);
12605
- clone2._zod.run = wrapped;
12606
- if (!liveRun.__originalRun)
12607
- installCompiledUserMethods(clone2, schema, parser);
12608
13026
  return clone2;
12609
13027
  } catch (err) {
12610
13028
  if (options?.strict)
@@ -12612,6 +13030,37 @@ function compile(schema, options) {
12612
13030
  return schema;
12613
13031
  }
12614
13032
  }
13033
+ function withParser(schema, parser) {
13034
+ if (isRecursiveSchema(schema)) {
13035
+ throw new ZodCompileUnsupportedError("a schema whose subtree contains a reference cycle");
13036
+ }
13037
+ const clone2 = clone(schema);
13038
+ const liveRun = schema._zod.run;
13039
+ const originalRun = liveRun.__originalRun ?? liveRun;
13040
+ const wrapped = (payload, ctx) => {
13041
+ if (ctx?.async || ctx?.direction === "backward" || ctx?.skipChecks || ctx?.[FALLBACK_FLAG]) {
13042
+ return originalRun(payload, ctx);
13043
+ }
13044
+ if (ctx && isBackEdge(ctx, payload.value)) {
13045
+ return originalRun(payload, ctx);
13046
+ }
13047
+ const out = parser(payload.value);
13048
+ if (out !== INVALID) {
13049
+ payload.value = out;
13050
+ return payload;
13051
+ }
13052
+ if (ctx)
13053
+ ctx[FALLBACK_FLAG] = true;
13054
+ return originalRun(payload, ctx);
13055
+ };
13056
+ wrapped.__originalRun = originalRun;
13057
+ clone2._zod.bag.fallbackRun = originalRun;
13058
+ clone2._zod.bag.validator = parser;
13059
+ clone2._zod.run = wrapped;
13060
+ if (!liveRun.__originalRun)
13061
+ installCompiledUserMethods(clone2, schema, parser);
13062
+ return clone2;
13063
+ }
12615
13064
  function installCompiledUserMethods(target, source, parser) {
12616
13065
  const targetAny = target;
12617
13066
  const sourceAny = source;
@@ -12648,7 +13097,8 @@ function compileFn(schema, options) {
12648
13097
  const ctx = {
12649
13098
  constants: /* @__PURE__ */ new Map(),
12650
13099
  constantCounter: 0,
12651
- varCounter: 0
13100
+ varCounter: 0,
13101
+ definite: true
12652
13102
  };
12653
13103
  const doc = new Doc(["input"]);
12654
13104
  const outputAccessor = generateCheck(doc, ctx, schema, "input", !options?.assertOnly);
@@ -12672,6 +13122,7 @@ ${code}
12672
13122
  if (options?.debug) {
12673
13123
  fn.code = fullCode;
12674
13124
  }
13125
+ fn.definite = ctx.definite;
12675
13126
  return fn;
12676
13127
  }
12677
13128
  function addConstant(ctx, value) {
@@ -12683,6 +13134,10 @@ function addConstant(ctx, value) {
12683
13134
  ctx.constants.set(name, value);
12684
13135
  return name;
12685
13136
  }
13137
+ function addUserConstant(ctx, fn) {
13138
+ ctx.definite = false;
13139
+ return addConstant(ctx, fn);
13140
+ }
12686
13141
  function newVar(ctx) {
12687
13142
  return `v${ctx.varCounter++}`;
12688
13143
  }
@@ -12715,6 +13170,7 @@ function compileChild(doc, ctx, schema, accessor, needsValue = true) {
12715
13170
  }
12716
13171
  }
12717
13172
  function emitRuntimeIsland(doc, ctx, schema, accessor) {
13173
+ ctx.definite = false;
12718
13174
  const schemaConst = addConstant(ctx, schema);
12719
13175
  const runConst = addConstant(ctx, runtimeRun);
12720
13176
  const outVar = newVar(ctx);
@@ -12795,6 +13251,9 @@ function generateChecks(doc, ctx, schema, accessor) {
12795
13251
  case "property":
12796
13252
  generatePropertyCheck(doc, ctx, def, currentAccessor);
12797
13253
  break;
13254
+ case "properties":
13255
+ generatePropertiesChecks(doc, ctx, def, currentAccessor);
13256
+ break;
12798
13257
  case "overwrite": {
12799
13258
  const newAccessor = newVar(ctx);
12800
13259
  generateOverwriteCheck(doc, ctx, check2, currentAccessor, newAccessor);
@@ -12903,6 +13362,19 @@ function generateMimeTypeCheck(doc, ctx, def, accessor) {
12903
13362
  doc.write(`if (!${mimeSet}.has(${accessor}.type)) return INVALID;`);
12904
13363
  }
12905
13364
  }
13365
+ function generatePropertiesChecks(doc, ctx, def, accessor) {
13366
+ if (def.when) {
13367
+ throw new ZodCompileUnsupportedError(`check with a custom "when" condition`);
13368
+ }
13369
+ doc.write(`if (${accessor} == null) return INVALID;`);
13370
+ const shape = def.shape;
13371
+ for (const key of Reflect.ownKeys(shape)) {
13372
+ const keyExpr = typeof key === "symbol" ? addConstant(ctx, key) : esc(key);
13373
+ const inputVar = newVar(ctx);
13374
+ doc.write(`const ${inputVar} = ${accessor}[${keyExpr}];`);
13375
+ compileChild(doc, ctx, shape[key], inputVar, false);
13376
+ }
13377
+ }
12906
13378
  function generatePropertyCheck(doc, ctx, def, accessor) {
12907
13379
  const propAccessor = `${accessor}[${JSON.stringify(def.property)}]`;
12908
13380
  generateCheck(doc, ctx, def.schema, propAccessor);
@@ -12930,7 +13402,7 @@ function generateCustomRefineCheck(doc, ctx, check2, accessor) {
12930
13402
  if (isAsyncFunction(def.fn)) {
12931
13403
  throw new ZodCompileAsyncError("z.compile: async .refine() predicates are not supported");
12932
13404
  }
12933
- const fnConst = addConstant(ctx, def.fn);
13405
+ const fnConst = addUserConstant(ctx, def.fn);
12934
13406
  const throwAsyncConst = addConstant(ctx, throwAsync);
12935
13407
  const resVar = newVar(ctx);
12936
13408
  doc.write(`const ${resVar} = ${fnConst}(${accessor});`);
@@ -12950,7 +13422,7 @@ function generateCustomRefineCheck(doc, ctx, check2, accessor) {
12950
13422
  throwAsync();
12951
13423
  return fakePayload.issues.length === 0 ? fakePayload.value : INVALID;
12952
13424
  };
12953
- const helperConst = addConstant(ctx, helperFn);
13425
+ const helperConst = addUserConstant(ctx, helperFn);
12954
13426
  const outVar = newVar(ctx);
12955
13427
  doc.write(`const ${outVar} = ${helperConst}(${accessor});`);
12956
13428
  doc.write(`if (${outVar} === INVALID) return INVALID;`);
@@ -12984,7 +13456,7 @@ var PATTERN_IS_COMPLETE = /* @__PURE__ */ new Set([
12984
13456
  "uuid",
12985
13457
  "xid"
12986
13458
  ]);
12987
- function generateStringFormatCheck(doc, ctx, def, accessor) {
13459
+ function generateStringFormatCheck(doc, ctx, def, accessor, needsValue = true) {
12988
13460
  const fmt = def.format;
12989
13461
  if (fmt === "base64") {
12990
13462
  const validator = addConstant(ctx, isValidBase64);
@@ -13017,9 +13489,14 @@ function generateStringFormatCheck(doc, ctx, def, accessor) {
13017
13489
  doc.write(`if (!${validator}(${accessor})) return INVALID;`);
13018
13490
  return accessor;
13019
13491
  }
13492
+ if (fmt === "iban") {
13493
+ const validator = addConstant(ctx, isValidIBAN);
13494
+ doc.write(`if (!${validator}(${accessor})) return INVALID;`);
13495
+ return accessor;
13496
+ }
13020
13497
  const formatDef = def;
13021
13498
  if (fmt === "url" || fmt === "httpurl" || formatDef.normalize || formatDef.hostname !== void 0 || formatDef.protocol !== void 0) {
13022
- const parseConst = addConstant(ctx, parseURLObject);
13499
+ const parseConst = addConstant(ctx, validateURL);
13023
13500
  const defConst = addConstant(ctx, def);
13024
13501
  const trimVar = newVar(ctx);
13025
13502
  const urlVar = newVar(ctx);
@@ -13034,6 +13511,8 @@ function generateStringFormatCheck(doc, ctx, def, accessor) {
13034
13511
  const protocolConst = addConstant(ctx, urlProtocolOk);
13035
13512
  doc.write(`if (!${protocolConst}(${urlVar}, ${defConst}.protocol)) return INVALID;`);
13036
13513
  }
13514
+ if (!needsValue)
13515
+ return null;
13037
13516
  const outputVar = newVar(ctx);
13038
13517
  const outputExpr = formatDef.normalize ? `${urlVar}.href` : `${addConstant(ctx, stripTabAndNewline)}(${trimVar})`;
13039
13518
  doc.write(`const ${outputVar} = ${outputExpr};`);
@@ -13093,7 +13572,7 @@ function generateCheck(doc, ctx, schema, accessor, needsValue = true) {
13093
13572
  let typeAccessor;
13094
13573
  switch (type) {
13095
13574
  case "string":
13096
- typeAccessor = generateStringCheck(doc, ctx, schema, accessor);
13575
+ typeAccessor = generateStringCheck(doc, ctx, schema, accessor, buildsValue);
13097
13576
  break;
13098
13577
  case "number":
13099
13578
  typeAccessor = generateNumberCheck(doc, schema, accessor);
@@ -13214,12 +13693,12 @@ function generateCheck(doc, ctx, schema, accessor, needsValue = true) {
13214
13693
  return null;
13215
13694
  return generateChecks(doc, ctx, schema, typeAccessor);
13216
13695
  }
13217
- function generateStringCheck(doc, ctx, schema, accessor) {
13696
+ function generateStringCheck(doc, ctx, schema, accessor, needsValue = true) {
13218
13697
  doc.write(`if (typeof ${accessor} !== "string") return INVALID;`);
13219
13698
  const def = schema._zod.def;
13220
13699
  if (def.format === void 0)
13221
13700
  return accessor;
13222
- return generateStringFormatCheck(doc, ctx, def, accessor);
13701
+ return generateStringFormatCheck(doc, ctx, def, accessor, needsValue);
13223
13702
  }
13224
13703
  function generateNumberCheck(doc, schema, accessor) {
13225
13704
  doc.write(`if (typeof ${accessor} !== "number" || !Number.isFinite(${accessor})) return INVALID;`);
@@ -13337,7 +13816,7 @@ function generateObjectCheck(doc, ctx, schema, accessor, buildsValue = true) {
13337
13816
  }
13338
13817
  }
13339
13818
  const outputVar = newVar(ctx);
13340
- const hasConditionalKeys = allKeys.some((k) => mayOutputUndefined(propShape[k]) || dropsWhenAbsent(propShape[k]));
13819
+ const hasConditionalKeys = allKeys.some((k) => mayOmitUndefined(propShape[k]) || dropsWhenAbsent(propShape[k]));
13341
13820
  if (!buildsValue) {
13342
13821
  if (unknownKeysMode === "schema") {
13343
13822
  const knownSet = keys.length > 0 ? addConstant(ctx, new Set(keys)) : null;
@@ -13364,7 +13843,7 @@ function generateObjectCheck(doc, ctx, schema, accessor, buildsValue = true) {
13364
13843
  const out = propOutputs.get(k);
13365
13844
  if (dropsWhenAbsent(propShape[k])) {
13366
13845
  doc.write(`if (${kx} in ${accessor}) ${outputVar}[${kx}] = ${out};`);
13367
- } else if (mayOutputUndefined(propShape[k])) {
13846
+ } else if (mayOmitUndefined(propShape[k])) {
13368
13847
  doc.write(`if (${out} !== undefined || ${kx} in ${accessor}) ${outputVar}[${kx}] = ${out};`);
13369
13848
  } else {
13370
13849
  doc.write(`${outputVar}[${kx}] = ${out};`);
@@ -13497,6 +13976,9 @@ function fastPathAcceptsAbsence(schema) {
13497
13976
  function dropsWhenAbsent(schema) {
13498
13977
  return schema._zod.optin === "optional" && schema._zod.optout === "optional";
13499
13978
  }
13979
+ function mayOmitUndefined(schema) {
13980
+ return (schema._zod.optin !== "defaulted" || schema._zod.optout === "optional") && mayOutputUndefined(schema);
13981
+ }
13500
13982
  function mayOutputUndefined(schema) {
13501
13983
  const def = schema._zod.def;
13502
13984
  switch (def.type) {
@@ -13553,9 +14035,15 @@ function generateNullableCheck(doc, ctx, schema, accessor, buildsValue = true) {
13553
14035
  doc.write(`}`);
13554
14036
  return outputVar;
13555
14037
  }
14038
+ function generateSizeGate(doc, schema, size) {
14039
+ for (const [max, check2] of sizeCaps(schema._zod.def.checks)) {
14040
+ doc.write(`if (${size} > ${numericOperand(max, check2._zod.def.check)}) return INVALID;`);
14041
+ }
14042
+ }
13556
14043
  function generateArrayCheck(doc, ctx, schema, accessor, buildsValue = true) {
13557
14044
  const def = schema._zod.def;
13558
14045
  doc.write(`if (!Array.isArray(${accessor})) return INVALID;`);
14046
+ generateSizeGate(doc, schema, `${accessor}.length`);
13559
14047
  const outputVar = buildsValue ? newVar(ctx) : null;
13560
14048
  const iVar = newVar(ctx);
13561
14049
  const elemVar = newVar(ctx);
@@ -13839,6 +14327,7 @@ function literalEquality(ctx, accessor, value) {
13839
14327
  }
13840
14328
  function generateIntersectionCheck(doc, ctx, schema, accessor) {
13841
14329
  const def = schema._zod.def;
14330
+ ctx.definite = false;
13842
14331
  const leftOutput = compileChild(doc, ctx, def.left, accessor);
13843
14332
  const rightOutput = compileChild(doc, ctx, def.right, accessor);
13844
14333
  const mergeConst = addConstant(ctx, mergeValues);
@@ -13892,14 +14381,13 @@ function generateRecordCheck(doc, ctx, schema, accessor) {
13892
14381
  const keyIsBareString = keyDef.type === "string" && keyDef.format === void 0 && !keyDef.coerce && (keyDef.checks?.length ?? 0) === 0;
13893
14382
  if (!keyIsBareString) {
13894
14383
  const isLoose = def.mode === "loose";
13895
- const keyFast = addConstant(ctx, compileFn(def.keyType));
14384
+ const keyFn = compileFn(def.keyType);
14385
+ if (keyFn.definite === false)
14386
+ ctx.definite = false;
14387
+ const keyFast = addConstant(ctx, keyFn);
13896
14388
  const numericConst = addConstant(ctx, number);
13897
- const propIsEnumerableConst = addConstant(ctx, Object.prototype.propertyIsEnumerable);
13898
14389
  const outKeyVar = newVar(ctx);
13899
- doc.write(`for (const ${kVar} of Reflect.ownKeys(${accessor})) {`);
13900
- doc.indented((d) => {
13901
- d.write(`if (${kVar} === "__proto__") continue;`);
13902
- d.write(`if (!${propIsEnumerableConst}.call(${accessor}, ${kVar})) continue;`);
14390
+ emitOwnKeys(doc, ctx, accessor, kVar, (d) => {
13903
14391
  d.write(`let ${outKeyVar} = ${keyFast}(${kVar});`);
13904
14392
  d.write(`if (${outKeyVar} === INVALID && typeof ${kVar} === "string" && ${numericConst}.test(${kVar})) ${outKeyVar} = ${keyFast}(Number(${kVar}));`);
13905
14393
  if (isLoose) {
@@ -13913,21 +14401,39 @@ function generateRecordCheck(doc, ctx, schema, accessor) {
13913
14401
  const valOutput = compileChild(d, ctx, def.valueType, valueVar);
13914
14402
  d.write(`${outputVar}[${outKeyVar}] = ${valOutput};`);
13915
14403
  });
13916
- doc.write(`}`);
13917
14404
  return outputVar;
13918
14405
  }
13919
- const propIsEnumerable = addConstant(ctx, Object.prototype.propertyIsEnumerable);
13920
- doc.write(`for (const ${kVar} of Reflect.ownKeys(${accessor})) {`);
13921
- doc.indented((d) => {
13922
- d.write(`if (${kVar} === "__proto__") continue;`);
13923
- d.write(`if (!${propIsEnumerable}.call(${accessor}, ${kVar})) continue;`);
13924
- d.write(`if (typeof ${kVar} !== "string") return INVALID;`);
14406
+ emitOwnKeys(doc, ctx, accessor, kVar, (d) => {
13925
14407
  d.write(`const ${valVar} = ${accessor}[${kVar}];`);
13926
14408
  const valOutput = compileChild(d, ctx, def.valueType, valVar);
13927
14409
  d.write(`${outputVar}[${kVar}] = ${valOutput};`);
14410
+ }, `return INVALID;`);
14411
+ return outputVar;
14412
+ }
14413
+ function emitOwnKeys(doc, ctx, accessor, kVar, body, onSymbol) {
14414
+ const propIsEnumerableConst = addConstant(ctx, Object.prototype.propertyIsEnumerable);
14415
+ const symsVar = newVar(ctx);
14416
+ const keysVar = newVar(ctx);
14417
+ const iVar = newVar(ctx);
14418
+ doc.write(`const ${symsVar} = Object.getOwnPropertySymbols(${accessor});`);
14419
+ doc.write(`const ${keysVar} = Object.getOwnPropertyNames(${accessor});`);
14420
+ doc.write(`for (let ${iVar} = 0; ${iVar} < ${keysVar}.length; ${iVar}++) {`);
14421
+ doc.indented((d) => {
14422
+ d.write(`const ${kVar} = ${keysVar}[${iVar}];`);
14423
+ d.write(`if (${kVar} === "__proto__" || !${propIsEnumerableConst}.call(${accessor}, ${kVar})) continue;`);
14424
+ body(d);
14425
+ });
14426
+ doc.write(`}`);
14427
+ doc.write(`for (let ${iVar} = 0; ${iVar} < ${symsVar}.length; ${iVar}++) {`);
14428
+ doc.indented((d) => {
14429
+ d.write(`const ${kVar} = ${symsVar}[${iVar}];`);
14430
+ d.write(`if (!${propIsEnumerableConst}.call(${accessor}, ${kVar})) continue;`);
14431
+ if (onSymbol)
14432
+ d.write(onSymbol);
14433
+ else
14434
+ body(d);
13928
14435
  });
13929
14436
  doc.write(`}`);
13930
- return outputVar;
13931
14437
  }
13932
14438
  function literalPropertyKey(ctx, key) {
13933
14439
  if (typeof key === "string")
@@ -13937,6 +14443,7 @@ function literalPropertyKey(ctx, key) {
13937
14443
  function generateMapCheck(doc, ctx, schema, accessor) {
13938
14444
  const def = schema._zod.def;
13939
14445
  doc.write(`if (!(${accessor} instanceof Map)) return INVALID;`);
14446
+ generateSizeGate(doc, schema, `${accessor}.size`);
13940
14447
  const outputVar = newVar(ctx);
13941
14448
  const kVar = newVar(ctx);
13942
14449
  const valVar = newVar(ctx);
@@ -13953,6 +14460,7 @@ function generateMapCheck(doc, ctx, schema, accessor) {
13953
14460
  function generateSetCheck(doc, ctx, schema, accessor) {
13954
14461
  const def = schema._zod.def;
13955
14462
  doc.write(`if (!(${accessor} instanceof Set)) return INVALID;`);
14463
+ generateSizeGate(doc, schema, `${accessor}.size`);
13956
14464
  const outputVar = newVar(ctx);
13957
14465
  const valVar = newVar(ctx);
13958
14466
  doc.write(`const ${outputVar} = new Set();`);
@@ -13980,7 +14488,7 @@ function generateTemplateLiteralCheck(doc, ctx, schema, accessor) {
13980
14488
  }
13981
14489
  function generateLazyCheck(doc, ctx, schema, accessor) {
13982
14490
  const def = schema._zod.def;
13983
- const getterConst = addConstant(ctx, def.getter);
14491
+ const getterConst = addUserConstant(ctx, def.getter);
13984
14492
  const cacheConst = addConstant(ctx, { parser: null });
13985
14493
  doc.write(`if (!${cacheConst}.parser) {`);
13986
14494
  doc.indented((d) => {
@@ -14013,7 +14521,7 @@ function generatePipeCheck(doc, ctx, schema, accessor) {
14013
14521
  return INVALID;
14014
14522
  return fakePayload.issues.length === 0 ? result : INVALID;
14015
14523
  };
14016
- const helperConst = addConstant(ctx, helperFn);
14524
+ const helperConst = addUserConstant(ctx, helperFn);
14017
14525
  const transformedVar = newVar(ctx);
14018
14526
  doc.write(`const ${transformedVar} = ${helperConst}(${inputOutput});`);
14019
14527
  doc.write(`if (${transformedVar} === INVALID) return INVALID;`);
@@ -14031,7 +14539,7 @@ function generateCustomCheck(doc, ctx, schema, accessor) {
14031
14539
  if (isAsyncFunction(def.fn)) {
14032
14540
  throw new ZodCompileAsyncError("z.compile: async custom predicates are not supported");
14033
14541
  }
14034
- const fnConst = addConstant(ctx, def.fn);
14542
+ const fnConst = addUserConstant(ctx, def.fn);
14035
14543
  const throwAsyncConst = addConstant(ctx, throwAsync);
14036
14544
  const resVar = newVar(ctx);
14037
14545
  doc.write(`const ${resVar} = ${fnConst}(${accessor});`);
@@ -14064,7 +14572,7 @@ function generateCatchCheck(doc, ctx, schema, accessor) {
14064
14572
  });
14065
14573
  doc.write(`})();`);
14066
14574
  const innerConst = addConstant(ctx, def.innerType);
14067
- const catchConst = addConstant(ctx, def.catchValue);
14575
+ const catchConst = addUserConstant(ctx, def.catchValue);
14068
14576
  const catchHelperConst = addConstant(ctx, runtimeCatch);
14069
14577
  doc.write(`if (${outputVar} === INVALID) {`);
14070
14578
  doc.indented((d) => {
@@ -14088,7 +14596,7 @@ function generateTransformCheck(doc, ctx, schema, accessor) {
14088
14596
  return INVALID;
14089
14597
  return fakePayload.issues.length === 0 ? result : INVALID;
14090
14598
  };
14091
- const helperConst = addConstant(ctx, helperFn);
14599
+ const helperConst = addUserConstant(ctx, helperFn);
14092
14600
  const outputVar = newVar(ctx);
14093
14601
  doc.write(`const ${outputVar} = ${helperConst}(${accessor});`);
14094
14602
  doc.write(`if (${outputVar} === INVALID) return INVALID;`);
@@ -14098,20 +14606,18 @@ function generateTransformCheck(doc, ctx, schema, accessor) {
14098
14606
  }
14099
14607
 
14100
14608
  // node_modules/zod/v4/core/api.js
14609
+ function snapshotChecks(def) {
14610
+ if (def.checks)
14611
+ def.checks = [...def.checks];
14612
+ return def;
14613
+ }
14101
14614
  // @__NO_SIDE_EFFECTS__
14102
14615
  function _string(Class2, params) {
14103
- return new Class2({
14104
- type: "string",
14105
- ...normalizeParams(params)
14106
- });
14616
+ return new Class2(snapshotChecks({ type: "string", ...normalizeParams(params) }));
14107
14617
  }
14108
14618
  // @__NO_SIDE_EFFECTS__
14109
14619
  function _coercedString(Class2, params) {
14110
- return new Class2({
14111
- type: "string",
14112
- coerce: true,
14113
- ...normalizeParams(params)
14114
- });
14620
+ return new Class2(snapshotChecks({ type: "string", coerce: true, ...normalizeParams(params) }));
14115
14621
  }
14116
14622
  // @__NO_SIDE_EFFECTS__
14117
14623
  function _email(Class2, params) {
@@ -14347,6 +14853,16 @@ function _creditCard(Class2, params) {
14347
14853
  });
14348
14854
  }
14349
14855
  // @__NO_SIDE_EFFECTS__
14856
+ function _iban(Class2, params) {
14857
+ return new Class2({
14858
+ type: "string",
14859
+ format: "iban",
14860
+ check: "string_format",
14861
+ abort: false,
14862
+ ...normalizeParams(params)
14863
+ });
14864
+ }
14865
+ // @__NO_SIDE_EFFECTS__
14350
14866
  function _jwt(Class2, params) {
14351
14867
  return new Class2({
14352
14868
  type: "string",
@@ -14405,20 +14921,11 @@ function _isoDuration(Class2, params) {
14405
14921
  }
14406
14922
  // @__NO_SIDE_EFFECTS__
14407
14923
  function _number(Class2, params) {
14408
- return new Class2({
14409
- type: "number",
14410
- checks: [],
14411
- ...normalizeParams(params)
14412
- });
14924
+ return new Class2(snapshotChecks({ type: "number", checks: [], ...normalizeParams(params) }));
14413
14925
  }
14414
14926
  // @__NO_SIDE_EFFECTS__
14415
14927
  function _coercedNumber(Class2, params) {
14416
- return new Class2({
14417
- type: "number",
14418
- coerce: true,
14419
- checks: [],
14420
- ...normalizeParams(params)
14421
- });
14928
+ return new Class2(snapshotChecks({ type: "number", coerce: true, checks: [], ...normalizeParams(params) }));
14422
14929
  }
14423
14930
  // @__NO_SIDE_EFFECTS__
14424
14931
  function _int(Class2, params) {
@@ -14760,8 +15267,12 @@ function _property(property, schema, params) {
14760
15267
  });
14761
15268
  }
14762
15269
  // @__NO_SIDE_EFFECTS__
14763
- function _properties(shape) {
14764
- return Object.entries(shape).map(([property, schema]) => new $ZodCheckProperty({ check: "property", property, schema }));
15270
+ function _properties(shape, params) {
15271
+ return new $ZodCheckProperties({
15272
+ check: "properties",
15273
+ shape,
15274
+ ...normalizeParams(params)
15275
+ });
14765
15276
  }
14766
15277
  // @__NO_SIDE_EFFECTS__
14767
15278
  function _mime(types, params) {
@@ -15198,7 +15709,7 @@ function handleUnrepresentable(schema, ctx, json2, params, message) {
15198
15709
  Object.assign(json2, result);
15199
15710
  return true;
15200
15711
  }
15201
- function process(schema, ctx, _params = { path: [], schemaPath: [] }) {
15712
+ function processSchema(schema, ctx, _params = { path: [], schemaPath: [] }) {
15202
15713
  var _a3;
15203
15714
  const def = schema._zod.def;
15204
15715
  const seen = ctx.seen.get(schema);
@@ -15237,7 +15748,7 @@ function process(schema, ctx, _params = { path: [], schemaPath: [] }) {
15237
15748
  if (parent) {
15238
15749
  if (!result.ref)
15239
15750
  result.ref = parent;
15240
- process(parent, ctx, params);
15751
+ processSchema(parent, ctx, params);
15241
15752
  ctx.seen.get(parent).isParent = true;
15242
15753
  }
15243
15754
  }
@@ -15344,7 +15855,6 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
15344
15855
  if (seen.count > 1) {
15345
15856
  if (ctx.reused === "ref") {
15346
15857
  extractToDef(entry);
15347
- continue;
15348
15858
  }
15349
15859
  }
15350
15860
  }
@@ -15672,19 +16182,107 @@ function isTransforming(_schema, _ctx) {
15672
16182
  }
15673
16183
  var createToJSONSchemaMethod = (schema, processors = {}) => (params) => {
15674
16184
  const ctx = initializeContext({ ...params, processors });
15675
- process(schema, ctx);
16185
+ processSchema(schema, ctx);
15676
16186
  extractDefs(ctx, schema);
15677
16187
  return finalize(ctx, schema);
15678
16188
  };
15679
16189
  var createStandardJSONSchemaMethod = (schema, io, processors = {}) => (params) => {
15680
16190
  const { libraryOptions, target } = params ?? {};
15681
16191
  const ctx = initializeContext({ ...libraryOptions ?? {}, target, io, processors });
15682
- process(schema, ctx);
16192
+ processSchema(schema, ctx);
15683
16193
  extractDefs(ctx, schema);
15684
16194
  return finalize(ctx, schema);
15685
16195
  };
15686
16196
 
15687
16197
  // node_modules/zod/v4/core/json-schema-processors.js
16198
+ var narrowMin = (agg, key, value) => {
16199
+ if (agg[key] === void 0 || value > agg[key])
16200
+ agg[key] = value;
16201
+ };
16202
+ var narrowMax = (agg, key, value) => {
16203
+ if (agg[key] === void 0 || value < agg[key])
16204
+ agg[key] = value;
16205
+ };
16206
+ var narrowBoth = (agg, value) => {
16207
+ narrowMin(agg, "minimum", value);
16208
+ narrowMax(agg, "maximum", value);
16209
+ };
16210
+ var addDivisor = (agg, value) => {
16211
+ agg.multipleOf ?? (agg.multipleOf = []);
16212
+ if (!agg.multipleOf.includes(value))
16213
+ agg.multipleOf.push(value);
16214
+ };
16215
+ var addPattern = (agg, pattern) => {
16216
+ agg.patterns ?? (agg.patterns = /* @__PURE__ */ new Set());
16217
+ agg.patterns.add(pattern);
16218
+ };
16219
+ var intersectMime = (agg, mime) => {
16220
+ agg.mime = agg.mime ? agg.mime.filter((m) => mime.includes(m)) : [...mime];
16221
+ };
16222
+ var setFormat = (agg, format) => {
16223
+ agg.format = format;
16224
+ if (format.includes("int"))
16225
+ agg.isInt = true;
16226
+ };
16227
+ var minContributor = (agg, def) => narrowMin(agg, "minimum", def.minimum);
16228
+ var maxContributor = (agg, def) => narrowMax(agg, "maximum", def.maximum);
16229
+ var formatContributor = (ranges) => (agg, def) => {
16230
+ setFormat(agg, def.format);
16231
+ const [minimum, maximum] = ranges[def.format];
16232
+ narrowMin(agg, "minimum", minimum);
16233
+ narrowMax(agg, "maximum", maximum);
16234
+ };
16235
+ var contributors = {
16236
+ greater_than: (agg, def) => narrowMin(agg, def.inclusive ? "minimum" : "exclusiveMinimum", def.value),
16237
+ less_than: (agg, def) => narrowMax(agg, def.inclusive ? "maximum" : "exclusiveMaximum", def.value),
16238
+ multiple_of: (agg, def) => addDivisor(agg, def.value),
16239
+ number_format: formatContributor(NUMBER_FORMAT_RANGES),
16240
+ bigint_format: formatContributor(BIGINT_FORMAT_RANGES),
16241
+ min_length: minContributor,
16242
+ max_length: maxContributor,
16243
+ length_equals: (agg, def) => narrowBoth(agg, def.length),
16244
+ min_size: minContributor,
16245
+ max_size: maxContributor,
16246
+ size_equals: (agg, def) => narrowBoth(agg, def.size),
16247
+ string_format: (agg, def) => {
16248
+ setFormat(agg, def.format);
16249
+ if (def.pattern)
16250
+ addPattern(agg, def.pattern);
16251
+ if (def.format === "base64" || def.format === "base64url")
16252
+ agg.contentEncoding = def.format;
16253
+ if (def.local || def.precision === -1)
16254
+ agg.laxFormat = true;
16255
+ },
16256
+ mime_type: (agg, def) => intersectMime(agg, def.mime)
16257
+ };
16258
+ function aggregateChecks(schema) {
16259
+ const agg = {};
16260
+ const def = schema._zod.def;
16261
+ const list = schema._zod.traits.has("$ZodCheck") ? [schema, ...def.checks ?? []] : def.checks ?? [];
16262
+ for (const ch of list)
16263
+ contributors[ch._zod.def.check]?.(agg, ch._zod.def);
16264
+ const bag = schema._zod.bag;
16265
+ if (bag.minimum !== void 0)
16266
+ narrowMin(agg, "minimum", bag.minimum);
16267
+ if (bag.exclusiveMinimum !== void 0)
16268
+ narrowMin(agg, "exclusiveMinimum", bag.exclusiveMinimum);
16269
+ if (bag.maximum !== void 0)
16270
+ narrowMax(agg, "maximum", bag.maximum);
16271
+ if (bag.exclusiveMaximum !== void 0)
16272
+ narrowMax(agg, "exclusiveMaximum", bag.exclusiveMaximum);
16273
+ if (bag.multipleOf !== void 0)
16274
+ addDivisor(agg, bag.multipleOf);
16275
+ if (bag.format !== void 0) {
16276
+ agg.format ?? (agg.format = bag.format);
16277
+ if (bag.format.includes("int"))
16278
+ agg.isInt = true;
16279
+ }
16280
+ if (bag.mime)
16281
+ intersectMime(agg, bag.mime);
16282
+ for (const pattern of bag.patterns ?? [])
16283
+ addPattern(agg, pattern);
16284
+ return agg;
16285
+ }
15688
16286
  var formatMap = {
15689
16287
  guid: "uuid",
15690
16288
  url: "uri",
@@ -15693,10 +16291,15 @@ var formatMap = {
15693
16291
  regex: ""
15694
16292
  // do not set
15695
16293
  };
16294
+ var exactPatterns = /* @__PURE__ */ new Map([
16295
+ [base64Charset, base64],
16296
+ [base64urlCharset, base64url]
16297
+ ]);
16298
+ var exactPattern = (p) => exactPatterns.get(p) ?? p;
15696
16299
  var stringProcessor = (schema, ctx, _json, _params) => {
15697
16300
  const json2 = _json;
15698
16301
  json2.type = "string";
15699
- const { minimum, maximum, format, patterns, contentEncoding, laxFormat } = schema._zod.bag;
16302
+ const { minimum, maximum, format, patterns, contentEncoding, laxFormat } = aggregateChecks(schema);
15700
16303
  if (typeof minimum === "number")
15701
16304
  json2.minLength = minimum;
15702
16305
  if (typeof maximum === "number")
@@ -15712,7 +16315,7 @@ var stringProcessor = (schema, ctx, _json, _params) => {
15712
16315
  if (contentEncoding)
15713
16316
  json2.contentEncoding = contentEncoding;
15714
16317
  if (patterns && patterns.size > 0) {
15715
- const patternList = [...patterns];
16318
+ const patternList = [...patterns].map(exactPattern);
15716
16319
  if (patternList.length === 1)
15717
16320
  json2.pattern = patternList[0].source;
15718
16321
  else if (patternList.length > 1) {
@@ -15727,11 +16330,8 @@ var stringProcessor = (schema, ctx, _json, _params) => {
15727
16330
  };
15728
16331
  var numberProcessor = (schema, ctx, _json, params) => {
15729
16332
  const json2 = _json;
15730
- const { minimum, maximum, format, multipleOf, exclusiveMaximum, exclusiveMinimum } = schema._zod.bag;
15731
- if (typeof format === "string" && format.includes("int"))
15732
- json2.type = "integer";
15733
- else
15734
- json2.type = "number";
16333
+ const { minimum, maximum, multipleOf, exclusiveMaximum, exclusiveMinimum, isInt } = aggregateChecks(schema);
16334
+ json2.type = isInt ? "integer" : "number";
15735
16335
  const exMin = typeof exclusiveMinimum === "number" && exclusiveMinimum >= (minimum ?? Number.NEGATIVE_INFINITY);
15736
16336
  const exMax = typeof exclusiveMaximum === "number" && exclusiveMaximum <= (maximum ?? Number.POSITIVE_INFINITY);
15737
16337
  const legacy = ctx.target === "draft-04" || ctx.target === "openapi-3.0";
@@ -15755,11 +16355,19 @@ var numberProcessor = (schema, ctx, _json, params) => {
15755
16355
  } else if (typeof maximum === "number") {
15756
16356
  json2.maximum = maximum;
15757
16357
  }
15758
- if (typeof multipleOf === "number") {
15759
- if (Number.isFinite(multipleOf) && multipleOf !== 0)
15760
- json2.multipleOf = Math.abs(multipleOf);
15761
- else
15762
- handleUnrepresentable(schema, ctx, json2, params, `A multipleOf divisor of ${multipleOf} cannot be represented in JSON Schema`);
16358
+ if (multipleOf) {
16359
+ const divisors = /* @__PURE__ */ new Set();
16360
+ for (const divisor of multipleOf) {
16361
+ if (Number.isFinite(divisor) && divisor !== 0)
16362
+ divisors.add(Math.abs(divisor));
16363
+ else
16364
+ handleUnrepresentable(schema, ctx, json2, params, `A multipleOf divisor of ${divisor} cannot be represented in JSON Schema`);
16365
+ }
16366
+ const [first, ...rest] = divisors;
16367
+ if (first !== void 0)
16368
+ json2.multipleOf = first;
16369
+ if (rest.length)
16370
+ json2.allOf = [...json2.allOf ?? [], ...rest.map((m) => ({ multipleOf: m }))];
15763
16371
  }
15764
16372
  };
15765
16373
  var booleanProcessor = (_schema, _ctx, json2, _params) => {
@@ -15862,27 +16470,22 @@ var templateLiteralProcessor = (schema, _ctx, json2, _params) => {
15862
16470
  };
15863
16471
  var fileProcessor = (schema, _ctx, json2, _params) => {
15864
16472
  const _json = json2;
15865
- const file2 = {
15866
- type: "string",
15867
- format: "binary",
15868
- contentEncoding: "binary"
15869
- };
15870
- const { minimum, maximum, mime } = schema._zod.bag;
16473
+ _json.type = "string";
16474
+ _json.format = "binary";
16475
+ _json.contentEncoding = "binary";
16476
+ const { minimum, maximum, mime } = aggregateChecks(schema);
15871
16477
  if (minimum !== void 0)
15872
- file2.minLength = minimum;
16478
+ _json.minLength = minimum;
15873
16479
  if (maximum !== void 0)
15874
- file2.maxLength = maximum;
15875
- if (mime) {
15876
- if (mime.length === 1) {
15877
- file2.contentMediaType = mime[0];
15878
- Object.assign(_json, file2);
15879
- } else {
15880
- Object.assign(_json, file2);
15881
- _json.anyOf = mime.map((m) => ({ contentMediaType: m }));
15882
- }
15883
- } else {
15884
- Object.assign(_json, file2);
15885
- }
16480
+ _json.maxLength = maximum;
16481
+ if (!mime)
16482
+ return;
16483
+ if (mime.length === 0)
16484
+ _json.not = {};
16485
+ else if (mime.length === 1)
16486
+ _json.contentMediaType = mime[0];
16487
+ else
16488
+ _json.anyOf = mime.map((m) => ({ contentMediaType: m }));
15886
16489
  };
15887
16490
  var successProcessor = (_schema, _ctx, json2, _params) => {
15888
16491
  json2.type = "boolean";
@@ -15905,13 +16508,13 @@ var setProcessor = (schema, ctx, json2, params) => {
15905
16508
  var arrayProcessor = (schema, ctx, _json, params) => {
15906
16509
  const json2 = _json;
15907
16510
  const def = schema._zod.def;
15908
- const { minimum, maximum } = schema._zod.bag;
16511
+ const { minimum, maximum } = aggregateChecks(schema);
15909
16512
  if (typeof minimum === "number")
15910
16513
  json2.minItems = minimum;
15911
16514
  if (typeof maximum === "number")
15912
16515
  json2.maxItems = maximum;
15913
16516
  json2.type = "array";
15914
- json2.items = process(def.element, ctx, {
16517
+ json2.items = processSchema(def.element, ctx, {
15915
16518
  ...params,
15916
16519
  path: [...params.path, "items"]
15917
16520
  });
@@ -15937,22 +16540,20 @@ var objectProcessor = (schema, ctx, _json, params) => {
15937
16540
  json2.type = "object";
15938
16541
  json2.properties = {};
15939
16542
  for (const key in shape) {
15940
- assignProp(json2.properties, key, process(shape[key], ctx, {
16543
+ assignProp(json2.properties, key, processSchema(shape[key], ctx, {
15941
16544
  ...params,
15942
16545
  path: [...params.path, "properties", key]
15943
16546
  }));
15944
16547
  }
15945
- const allKeys = new Set(Object.keys(shape));
15946
- const requiredKeys = new Set([...allKeys].filter((key) => {
16548
+ const requiredKeys = [];
16549
+ for (const key of Object.keys(shape)) {
15947
16550
  const field = def.shape[key];
15948
- if (ctx.io === "input") {
15949
- return inputOptin(field) === void 0;
15950
- } else {
15951
- return field._zod.optout === void 0;
16551
+ if (ctx.io === "input" ? inputOptin(field) === void 0 : field._zod.optout === void 0) {
16552
+ requiredKeys.push(key);
15952
16553
  }
15953
- }));
15954
- if (requiredKeys.size > 0) {
15955
- json2.required = Array.from(requiredKeys);
16554
+ }
16555
+ if (requiredKeys.length > 0) {
16556
+ json2.required = requiredKeys;
15956
16557
  }
15957
16558
  if (def.catchall?._zod.def.type === "never") {
15958
16559
  json2.additionalProperties = false;
@@ -15960,7 +16561,7 @@ var objectProcessor = (schema, ctx, _json, params) => {
15960
16561
  if (ctx.io === "output")
15961
16562
  json2.additionalProperties = false;
15962
16563
  } else if (def.catchall) {
15963
- json2.additionalProperties = process(def.catchall, ctx, {
16564
+ json2.additionalProperties = processSchema(def.catchall, ctx, {
15964
16565
  ...params,
15965
16566
  path: [...params.path, "additionalProperties"]
15966
16567
  });
@@ -15969,7 +16570,7 @@ var objectProcessor = (schema, ctx, _json, params) => {
15969
16570
  var unionProcessor = (schema, ctx, json2, params) => {
15970
16571
  const def = schema._zod.def;
15971
16572
  const isExclusive = def.inclusive === false;
15972
- const options = def.options.map((x, i) => process(x, ctx, {
16573
+ const options = def.options.map((x, i) => processSchema(x, ctx, {
15973
16574
  ...params,
15974
16575
  path: [...params.path, isExclusive ? "oneOf" : "anyOf", i]
15975
16576
  }));
@@ -15981,11 +16582,11 @@ var unionProcessor = (schema, ctx, json2, params) => {
15981
16582
  };
15982
16583
  var intersectionProcessor = (schema, ctx, json2, params) => {
15983
16584
  const def = schema._zod.def;
15984
- const a = process(def.left, ctx, {
16585
+ const a = processSchema(def.left, ctx, {
15985
16586
  ...params,
15986
16587
  path: [...params.path, "allOf", 0]
15987
16588
  });
15988
- const b = process(def.right, ctx, {
16589
+ const b = processSchema(def.right, ctx, {
15989
16590
  ...params,
15990
16591
  path: [...params.path, "allOf", 1]
15991
16592
  });
@@ -16003,11 +16604,11 @@ var tupleProcessor = (schema, ctx, _json, params) => {
16003
16604
  json2.type = "array";
16004
16605
  const prefixPath = ctx.target === "draft-2020-12" ? "prefixItems" : "items";
16005
16606
  const restPath = ctx.target === "draft-2020-12" ? "items" : ctx.target === "openapi-3.0" ? "items" : "additionalItems";
16006
- const prefixItems = def.items.map((x, i) => process(x, ctx, {
16607
+ const prefixItems = def.items.map((x, i) => processSchema(x, ctx, {
16007
16608
  ...params,
16008
16609
  path: [...params.path, prefixPath, i]
16009
16610
  }));
16010
- const rest = def.rest ? process(def.rest, ctx, {
16611
+ const rest = def.rest ? processSchema(def.rest, ctx, {
16011
16612
  ...params,
16012
16613
  path: [...params.path, restPath, ...ctx.target === "openapi-3.0" ? [def.items.length] : []]
16013
16614
  }) : null;
@@ -16055,7 +16656,7 @@ var tupleProcessor = (schema, ctx, _json, params) => {
16055
16656
  if (isClosed)
16056
16657
  json2.maxItems = maxItems;
16057
16658
  }
16058
- const { minimum, maximum } = schema._zod.bag;
16659
+ const { minimum, maximum } = aggregateChecks(schema);
16059
16660
  if (typeof minimum === "number")
16060
16661
  json2.minItems = minimum;
16061
16662
  if (typeof maximum === "number")
@@ -16129,20 +16730,19 @@ var recordProcessor = (schema, ctx, _json, params) => {
16129
16730
  const def = schema._zod.def;
16130
16731
  json2.type = "object";
16131
16732
  const keyType = def.keyType;
16132
- const keyBag = keyType._zod.bag;
16133
- const patterns = keyBag?.patterns;
16733
+ const patterns = aggregateChecks(keyType).patterns;
16134
16734
  if (def.mode === "loose" && patterns && patterns.size > 0) {
16135
- const valueSchema = process(def.valueType, ctx, {
16735
+ const valueSchema = processSchema(def.valueType, ctx, {
16136
16736
  ...params,
16137
16737
  path: [...params.path, "patternProperties", "*"]
16138
16738
  });
16139
16739
  json2.patternProperties = {};
16140
16740
  for (const pattern of patterns) {
16141
- assignProp(json2.patternProperties, pattern.source, valueSchema);
16741
+ assignProp(json2.patternProperties, exactPattern(pattern).source, valueSchema);
16142
16742
  }
16143
16743
  } else {
16144
16744
  if (ctx.target === "draft-07" || ctx.target === "draft-2020-12") {
16145
- json2.propertyNames = process(def.keyType, ctx, {
16745
+ json2.propertyNames = processSchema(def.keyType, ctx, {
16146
16746
  ...params,
16147
16747
  path: [...params.path, "propertyNames"]
16148
16748
  });
@@ -16154,7 +16754,7 @@ var recordProcessor = (schema, ctx, _json, params) => {
16154
16754
  }
16155
16755
  pending2.push(schema);
16156
16756
  }
16157
- json2.additionalProperties = process(def.valueType, ctx, {
16757
+ json2.additionalProperties = processSchema(def.valueType, ctx, {
16158
16758
  ...params,
16159
16759
  path: [...params.path, "additionalProperties"]
16160
16760
  });
@@ -16170,7 +16770,7 @@ var recordProcessor = (schema, ctx, _json, params) => {
16170
16770
  };
16171
16771
  var nullableProcessor = (schema, ctx, json2, params) => {
16172
16772
  const def = schema._zod.def;
16173
- const inner = process(def.innerType, ctx, params);
16773
+ const inner = processSchema(def.innerType, ctx, params);
16174
16774
  const seen = ctx.seen.get(schema);
16175
16775
  if (ctx.target === "openapi-3.0") {
16176
16776
  seen.ref = def.innerType;
@@ -16181,7 +16781,7 @@ var nullableProcessor = (schema, ctx, json2, params) => {
16181
16781
  };
16182
16782
  var nonoptionalProcessor = (schema, ctx, _json, params) => {
16183
16783
  const def = schema._zod.def;
16184
- process(def.innerType, ctx, params);
16784
+ processSchema(def.innerType, ctx, params);
16185
16785
  const seen = ctx.seen.get(schema);
16186
16786
  seen.ref = def.innerType;
16187
16787
  };
@@ -16201,7 +16801,7 @@ function serializeDefaultValue(value, schema, ctx, json2, params) {
16201
16801
  }
16202
16802
  var defaultProcessor = (schema, ctx, json2, params) => {
16203
16803
  const def = schema._zod.def;
16204
- process(def.innerType, ctx, params);
16804
+ processSchema(def.innerType, ctx, params);
16205
16805
  const seen = ctx.seen.get(schema);
16206
16806
  seen.ref = def.innerType;
16207
16807
  const value = serializeDefaultValue(def.defaultValue, schema, ctx, json2, params);
@@ -16210,7 +16810,7 @@ var defaultProcessor = (schema, ctx, json2, params) => {
16210
16810
  };
16211
16811
  var prefaultProcessor = (schema, ctx, json2, params) => {
16212
16812
  const def = schema._zod.def;
16213
- process(def.innerType, ctx, params);
16813
+ processSchema(def.innerType, ctx, params);
16214
16814
  const seen = ctx.seen.get(schema);
16215
16815
  seen.ref = def.innerType;
16216
16816
  if (ctx.io !== "input")
@@ -16221,7 +16821,7 @@ var prefaultProcessor = (schema, ctx, json2, params) => {
16221
16821
  };
16222
16822
  var catchProcessor = (schema, ctx, json2, params) => {
16223
16823
  const def = schema._zod.def;
16224
- process(def.innerType, ctx, params);
16824
+ processSchema(def.innerType, ctx, params);
16225
16825
  const seen = ctx.seen.get(schema);
16226
16826
  seen.ref = def.innerType;
16227
16827
  let catchValue;
@@ -16237,32 +16837,32 @@ var pipeProcessor = (schema, ctx, _json, params) => {
16237
16837
  const def = schema._zod.def;
16238
16838
  const inIsTransform = def.in._zod.traits.has("$ZodTransform");
16239
16839
  const innerType = ctx.io === "input" ? inIsTransform ? def.out : def.in : def.out;
16240
- process(innerType, ctx, params);
16840
+ processSchema(innerType, ctx, params);
16241
16841
  const seen = ctx.seen.get(schema);
16242
16842
  seen.ref = innerType;
16243
16843
  };
16244
16844
  var readonlyProcessor = (schema, ctx, json2, params) => {
16245
16845
  const def = schema._zod.def;
16246
- process(def.innerType, ctx, params);
16846
+ processSchema(def.innerType, ctx, params);
16247
16847
  const seen = ctx.seen.get(schema);
16248
16848
  seen.ref = def.innerType;
16249
16849
  json2.readOnly = true;
16250
16850
  };
16251
16851
  var promiseProcessor = (schema, ctx, _json, params) => {
16252
16852
  const def = schema._zod.def;
16253
- process(def.innerType, ctx, params);
16853
+ processSchema(def.innerType, ctx, params);
16254
16854
  const seen = ctx.seen.get(schema);
16255
16855
  seen.ref = def.innerType;
16256
16856
  };
16257
16857
  var optionalProcessor = (schema, ctx, _json, params) => {
16258
16858
  const def = schema._zod.def;
16259
- process(def.innerType, ctx, params);
16859
+ processSchema(def.innerType, ctx, params);
16260
16860
  const seen = ctx.seen.get(schema);
16261
16861
  seen.ref = def.innerType;
16262
16862
  };
16263
16863
  var lazyProcessor = (schema, ctx, _json, params) => {
16264
16864
  const innerType = schema._zod.innerType;
16265
- process(innerType, ctx, params);
16865
+ processSchema(innerType, ctx, params);
16266
16866
  const seen = ctx.seen.get(schema);
16267
16867
  seen.ref = innerType;
16268
16868
  };
@@ -16314,7 +16914,7 @@ function toJSONSchema(input2, params) {
16314
16914
  const defs = {};
16315
16915
  for (const entry of registry2._idmap.entries()) {
16316
16916
  const [_, schema] = entry;
16317
- process(schema, ctx2);
16917
+ processSchema(schema, ctx2);
16318
16918
  }
16319
16919
  const schemas = {};
16320
16920
  const external = {
@@ -16337,7 +16937,7 @@ function toJSONSchema(input2, params) {
16337
16937
  return { schemas };
16338
16938
  }
16339
16939
  const ctx = initializeContext({ ...params, processors: allProcessors });
16340
- process(input2, ctx);
16940
+ processSchema(input2, ctx);
16341
16941
  extractDefs(ctx, input2);
16342
16942
  return finalize(ctx, input2);
16343
16943
  }
@@ -16396,7 +16996,7 @@ var JSONSchemaGenerator = class {
16396
16996
  * This must be called before emit().
16397
16997
  */
16398
16998
  process(schema, _params = { path: [], schemaPath: [] }) {
16399
- return process(schema, this.ctx, _params);
16999
+ return processSchema(schema, this.ctx, _params);
16400
17000
  }
16401
17001
  /**
16402
17002
  * Emit the final JSON Schema after processing.
@@ -16453,12 +17053,14 @@ __export(schemas_exports2, {
16453
17053
  ZodFile: () => ZodFile,
16454
17054
  ZodFunction: () => ZodFunction,
16455
17055
  ZodGUID: () => ZodGUID,
17056
+ ZodIBAN: () => ZodIBAN,
16456
17057
  ZodIPv4: () => ZodIPv4,
16457
17058
  ZodIPv6: () => ZodIPv6,
16458
17059
  ZodISODate: () => ZodISODate,
16459
17060
  ZodISODateTime: () => ZodISODateTime,
16460
17061
  ZodISODuration: () => ZodISODuration,
16461
17062
  ZodISOTime: () => ZodISOTime,
17063
+ ZodInstanceOf: () => ZodInstanceOf,
16462
17064
  ZodIntersection: () => ZodIntersection,
16463
17065
  ZodJWT: () => ZodJWT,
16464
17066
  ZodKSUID: () => ZodKSUID,
@@ -16517,6 +17119,7 @@ __export(schemas_exports2, {
16517
17119
  creditCard: () => creditCard2,
16518
17120
  cuid: () => cuid3,
16519
17121
  cuid2: () => cuid22,
17122
+ currencyCode: () => currencyCode2,
16520
17123
  custom: () => custom,
16521
17124
  date: () => date2,
16522
17125
  describe: () => describe2,
@@ -16535,6 +17138,7 @@ __export(schemas_exports2, {
16535
17138
  hex: () => hex2,
16536
17139
  hostname: () => hostname2,
16537
17140
  httpUrl: () => httpUrl,
17141
+ iban: () => iban2,
16538
17142
  instanceof: () => _instanceof,
16539
17143
  int: () => int,
16540
17144
  int32: () => int32,
@@ -16837,6 +17441,12 @@ var ZodType = /* @__PURE__ */ $constructor("ZodType", (inst, def) => {
16837
17441
  set spa(value) {
16838
17442
  util_exports.own(this, "spa", value);
16839
17443
  },
17444
+ validate(data, params) {
17445
+ return validate(this, data, params);
17446
+ },
17447
+ validateAsync(data, params) {
17448
+ return validateAsync(this, data, params);
17449
+ },
16840
17450
  encode: function _encode2(data, params) {
16841
17451
  return encode2(this, data, params, { callee: _encode2 });
16842
17452
  },
@@ -16873,61 +17483,65 @@ var ZodType = /* @__PURE__ */ $constructor("ZodType", (inst, def) => {
16873
17483
  return this._zod.def;
16874
17484
  }
16875
17485
  });
16876
- var _ZodString = /* @__PURE__ */ $constructor("_ZodString", (inst, def) => {
16877
- $ZodString.init(inst, def);
16878
- ZodType.init(inst, def);
16879
- inst._zod.processJSONSchema = (ctx, json2, params) => stringProcessor(inst, ctx, json2, params);
16880
- const bag = inst._zod.bag;
16881
- inst.format = bag.format ?? null;
16882
- inst.minLength = bag.minimum ?? null;
16883
- inst.maxLength = bag.maximum ?? null;
16884
- }, {
16885
- regex(...args) {
16886
- return this.check(_regex(...args));
16887
- },
16888
- includes(...args) {
16889
- return this.check(_includes(...args));
16890
- },
16891
- startsWith(...args) {
16892
- return this.check(_startsWith(...args));
16893
- },
16894
- endsWith(...args) {
16895
- return this.check(_endsWith(...args));
17486
+ var _ZodString = /* @__PURE__ */ $constructor(
17487
+ "_ZodString",
17488
+ (inst, def) => {
17489
+ $ZodString.init(inst, def);
17490
+ ZodType.init(inst, def);
17491
+ inst._zod.processJSONSchema = (ctx, json2, params) => stringProcessor(inst, ctx, json2, params);
16896
17492
  },
16897
- min(...args) {
16898
- return this.check(_minLength(...args));
16899
- },
16900
- max(...args) {
16901
- return this.check(_maxLength(...args));
16902
- },
16903
- length(...args) {
16904
- return this.check(_length(...args));
16905
- },
16906
- nonempty(...args) {
16907
- return this.check(_minLength(1, ...args));
16908
- },
16909
- lowercase(params) {
16910
- return this.check(_lowercase(params));
16911
- },
16912
- uppercase(params) {
16913
- return this.check(_uppercase(params));
16914
- },
16915
- trim() {
16916
- return this.check(_trim());
16917
- },
16918
- normalize(...args) {
16919
- return this.check(_normalize(...args));
16920
- },
16921
- toLowerCase() {
16922
- return this.check(_toLowerCase());
16923
- },
16924
- toUpperCase() {
16925
- return this.check(_toUpperCase());
16926
- },
16927
- slugify() {
16928
- return this.check(_slugify());
16929
- }
16930
- });
17493
+ /* @__PURE__ */ util_exports.derived({
17494
+ format: (inst) => aggregateChecks(inst).format ?? null,
17495
+ minLength: (inst) => aggregateChecks(inst).minimum ?? null,
17496
+ maxLength: (inst) => aggregateChecks(inst).maximum ?? null
17497
+ }, {
17498
+ regex(...args) {
17499
+ return this.check(_regex(...args));
17500
+ },
17501
+ includes(...args) {
17502
+ return this.check(_includes(...args));
17503
+ },
17504
+ startsWith(...args) {
17505
+ return this.check(_startsWith(...args));
17506
+ },
17507
+ endsWith(...args) {
17508
+ return this.check(_endsWith(...args));
17509
+ },
17510
+ min(...args) {
17511
+ return this.check(_minLength(...args));
17512
+ },
17513
+ max(...args) {
17514
+ return this.check(_maxLength(...args));
17515
+ },
17516
+ length(...args) {
17517
+ return this.check(_length(...args));
17518
+ },
17519
+ nonempty(...args) {
17520
+ return this.check(_minLength(1, ...args));
17521
+ },
17522
+ lowercase(params) {
17523
+ return this.check(_lowercase(params));
17524
+ },
17525
+ uppercase(params) {
17526
+ return this.check(_uppercase(params));
17527
+ },
17528
+ trim() {
17529
+ return this.check(_trim());
17530
+ },
17531
+ normalize(...args) {
17532
+ return this.check(_normalize(...args));
17533
+ },
17534
+ toLowerCase() {
17535
+ return this.check(_toLowerCase());
17536
+ },
17537
+ toUpperCase() {
17538
+ return this.check(_toUpperCase());
17539
+ },
17540
+ slugify() {
17541
+ return this.check(_slugify());
17542
+ }
17543
+ })
17544
+ );
16931
17545
  var ZodString = /* @__PURE__ */ $constructor("ZodString", (inst, def) => {
16932
17546
  $ZodString.init(inst, def);
16933
17547
  _ZodString.init(inst, def);
@@ -17073,8 +17687,8 @@ function url(params) {
17073
17687
  }
17074
17688
  function httpUrl(params) {
17075
17689
  return _url(ZodURL, {
17076
- protocol: regexes_exports.httpProtocol,
17077
- hostname: regexes_exports.domain,
17690
+ protocol: httpProtocol,
17691
+ hostname: domain,
17078
17692
  ...util_exports.normalizeParams(params)
17079
17693
  });
17080
17694
  }
@@ -17190,6 +17804,13 @@ var ZodCreditCard = /* @__PURE__ */ $constructor("ZodCreditCard", (inst, def) =>
17190
17804
  function creditCard2(params) {
17191
17805
  return _creditCard(ZodCreditCard, params);
17192
17806
  }
17807
+ var ZodIBAN = /* @__PURE__ */ $constructor("ZodIBAN", (inst, def) => {
17808
+ $ZodIBAN.init(inst, def);
17809
+ ZodStringFormat.init(inst, def);
17810
+ });
17811
+ function iban2(params) {
17812
+ return _iban(ZodIBAN, params);
17813
+ }
17193
17814
  var ZodJWT = /* @__PURE__ */ $constructor("ZodJWT", (inst, def) => {
17194
17815
  $ZodJWT.init(inst, def);
17195
17816
  ZodStringFormat.init(inst, def);
@@ -17205,10 +17826,13 @@ function stringFormat(format, fnOrRegex, _params = {}) {
17205
17826
  return _stringFormat(ZodCustomStringFormat, format, fnOrRegex, _params);
17206
17827
  }
17207
17828
  function hostname2(_params) {
17208
- return _stringFormat(ZodCustomStringFormat, "hostname", regexes_exports.hostname, _params);
17829
+ return _stringFormat(ZodCustomStringFormat, "hostname", hostname, _params);
17209
17830
  }
17210
17831
  function hex2(_params) {
17211
- return _stringFormat(ZodCustomStringFormat, "hex", regexes_exports.hex, _params);
17832
+ return _stringFormat(ZodCustomStringFormat, "hex", hex, _params);
17833
+ }
17834
+ function currencyCode2(_params) {
17835
+ return _stringFormat(ZodCustomStringFormat, "currency_code", currencyCode, _params);
17212
17836
  }
17213
17837
  function hash(alg, params) {
17214
17838
  const enc = params?.enc ?? "hex";
@@ -17218,63 +17842,76 @@ function hash(alg, params) {
17218
17842
  throw new Error(`Unrecognized hash format: ${format}`);
17219
17843
  return _stringFormat(ZodCustomStringFormat, format, regex, params);
17220
17844
  }
17221
- var ZodNumber = /* @__PURE__ */ $constructor("ZodNumber", (inst, def) => {
17222
- $ZodNumber.init(inst, def);
17223
- ZodType.init(inst, def);
17224
- inst._zod.processJSONSchema = (ctx, json2, params) => numberProcessor(inst, ctx, json2, params);
17225
- const bag = inst._zod.bag;
17226
- inst.minValue = Math.max(bag.minimum ?? Number.NEGATIVE_INFINITY, bag.exclusiveMinimum ?? Number.NEGATIVE_INFINITY) ?? null;
17227
- inst.maxValue = Math.min(bag.maximum ?? Number.POSITIVE_INFINITY, bag.exclusiveMaximum ?? Number.POSITIVE_INFINITY) ?? null;
17228
- inst.isInt = (bag.format ?? "").includes("int") || Number.isSafeInteger(bag.multipleOf ?? 0.5);
17229
- inst.isFinite = true;
17230
- inst.format = bag.format ?? null;
17231
- }, {
17232
- gt(value, params) {
17233
- return this.check(_gt(value, params));
17234
- },
17235
- gte(value, params) {
17236
- return this.check(_gte(value, params));
17237
- },
17238
- min(value, params) {
17239
- return this.check(_gte(value, params));
17240
- },
17241
- lt(value, params) {
17242
- return this.check(_lt(value, params));
17243
- },
17244
- lte(value, params) {
17245
- return this.check(_lte(value, params));
17246
- },
17247
- max(value, params) {
17248
- return this.check(_lte(value, params));
17249
- },
17250
- int(params) {
17251
- return this.check(int(params));
17252
- },
17253
- safe(params) {
17254
- return this.check(int(params));
17845
+ var ZodNumber = /* @__PURE__ */ $constructor(
17846
+ "ZodNumber",
17847
+ (inst, def) => {
17848
+ $ZodNumber.init(inst, def);
17849
+ ZodType.init(inst, def);
17850
+ inst._zod.processJSONSchema = (ctx, json2, params) => numberProcessor(inst, ctx, json2, params);
17851
+ inst.isFinite = true;
17255
17852
  },
17256
- positive(params) {
17257
- return this.check(_gt(0, params));
17258
- },
17259
- nonnegative(params) {
17260
- return this.check(_gte(0, params));
17261
- },
17262
- negative(params) {
17263
- return this.check(_lt(0, params));
17264
- },
17265
- nonpositive(params) {
17266
- return this.check(_lte(0, params));
17267
- },
17268
- multipleOf(value, params) {
17269
- return this.check(_multipleOf(value, params));
17270
- },
17271
- step(value, params) {
17272
- return this.check(_multipleOf(value, params));
17273
- },
17274
- finite() {
17275
- return this;
17276
- }
17277
- });
17853
+ /* @__PURE__ */ util_exports.derived({
17854
+ minValue: (inst) => {
17855
+ const { minimum, exclusiveMinimum } = aggregateChecks(inst);
17856
+ return Math.max(minimum ?? Number.NEGATIVE_INFINITY, exclusiveMinimum ?? Number.NEGATIVE_INFINITY);
17857
+ },
17858
+ maxValue: (inst) => {
17859
+ const { maximum, exclusiveMaximum } = aggregateChecks(inst);
17860
+ return Math.min(maximum ?? Number.POSITIVE_INFINITY, exclusiveMaximum ?? Number.POSITIVE_INFINITY);
17861
+ },
17862
+ isInt: (inst) => {
17863
+ const { isInt, multipleOf } = aggregateChecks(inst);
17864
+ return !!isInt || !!multipleOf?.some(Number.isSafeInteger);
17865
+ },
17866
+ format: (inst) => aggregateChecks(inst).format ?? null
17867
+ }, {
17868
+ gt(value, params) {
17869
+ return this.check(_gt(value, params));
17870
+ },
17871
+ gte(value, params) {
17872
+ return this.check(_gte(value, params));
17873
+ },
17874
+ min(value, params) {
17875
+ return this.check(_gte(value, params));
17876
+ },
17877
+ lt(value, params) {
17878
+ return this.check(_lt(value, params));
17879
+ },
17880
+ lte(value, params) {
17881
+ return this.check(_lte(value, params));
17882
+ },
17883
+ max(value, params) {
17884
+ return this.check(_lte(value, params));
17885
+ },
17886
+ int(params) {
17887
+ return this.check(int(params));
17888
+ },
17889
+ safe(params) {
17890
+ return this.check(int(params));
17891
+ },
17892
+ positive(params) {
17893
+ return this.check(_gt(0, params));
17894
+ },
17895
+ nonnegative(params) {
17896
+ return this.check(_gte(0, params));
17897
+ },
17898
+ negative(params) {
17899
+ return this.check(_lt(0, params));
17900
+ },
17901
+ nonpositive(params) {
17902
+ return this.check(_lte(0, params));
17903
+ },
17904
+ multipleOf(value, params) {
17905
+ return this.check(_multipleOf(value, params));
17906
+ },
17907
+ step(value, params) {
17908
+ return this.check(_multipleOf(value, params));
17909
+ },
17910
+ finite() {
17911
+ return this;
17912
+ }
17913
+ })
17914
+ );
17278
17915
  function number2(params) {
17279
17916
  return _number(ZodNumber, params);
17280
17917
  }
@@ -17305,49 +17942,53 @@ var ZodBoolean = /* @__PURE__ */ $constructor("ZodBoolean", (inst, def) => {
17305
17942
  function boolean2(params) {
17306
17943
  return _boolean(ZodBoolean, params);
17307
17944
  }
17308
- var ZodBigInt = /* @__PURE__ */ $constructor("ZodBigInt", (inst, def) => {
17309
- $ZodBigInt.init(inst, def);
17310
- ZodType.init(inst, def);
17311
- inst._zod.processJSONSchema = (ctx, json2, params) => bigintProcessor(inst, ctx, json2, params);
17312
- const bag = inst._zod.bag;
17313
- inst.minValue = bag.minimum ?? null;
17314
- inst.maxValue = bag.maximum ?? null;
17315
- inst.format = bag.format ?? null;
17316
- }, {
17317
- gte(value, params) {
17318
- return this.check(_gte(value, params));
17319
- },
17320
- min(value, params) {
17321
- return this.check(_gte(value, params));
17322
- },
17323
- gt(value, params) {
17324
- return this.check(_gt(value, params));
17325
- },
17326
- lt(value, params) {
17327
- return this.check(_lt(value, params));
17328
- },
17329
- lte(value, params) {
17330
- return this.check(_lte(value, params));
17945
+ var ZodBigInt = /* @__PURE__ */ $constructor(
17946
+ "ZodBigInt",
17947
+ (inst, def) => {
17948
+ $ZodBigInt.init(inst, def);
17949
+ ZodType.init(inst, def);
17950
+ inst._zod.processJSONSchema = (ctx, json2, params) => bigintProcessor(inst, ctx, json2, params);
17331
17951
  },
17332
- max(value, params) {
17333
- return this.check(_lte(value, params));
17334
- },
17335
- positive(params) {
17336
- return this.check(_gt(BigInt(0), params));
17337
- },
17338
- negative(params) {
17339
- return this.check(_lt(BigInt(0), params));
17340
- },
17341
- nonpositive(params) {
17342
- return this.check(_lte(BigInt(0), params));
17343
- },
17344
- nonnegative(params) {
17345
- return this.check(_gte(BigInt(0), params));
17346
- },
17347
- multipleOf(value, params) {
17348
- return this.check(_multipleOf(value, params));
17349
- }
17350
- });
17952
+ /* @__PURE__ */ util_exports.derived({
17953
+ minValue: (inst) => aggregateChecks(inst).minimum ?? null,
17954
+ maxValue: (inst) => aggregateChecks(inst).maximum ?? null,
17955
+ format: (inst) => aggregateChecks(inst).format ?? null
17956
+ }, {
17957
+ gte(value, params) {
17958
+ return this.check(_gte(value, params));
17959
+ },
17960
+ min(value, params) {
17961
+ return this.check(_gte(value, params));
17962
+ },
17963
+ gt(value, params) {
17964
+ return this.check(_gt(value, params));
17965
+ },
17966
+ lt(value, params) {
17967
+ return this.check(_lt(value, params));
17968
+ },
17969
+ lte(value, params) {
17970
+ return this.check(_lte(value, params));
17971
+ },
17972
+ max(value, params) {
17973
+ return this.check(_lte(value, params));
17974
+ },
17975
+ positive(params) {
17976
+ return this.check(_gt(BigInt(0), params));
17977
+ },
17978
+ negative(params) {
17979
+ return this.check(_lt(BigInt(0), params));
17980
+ },
17981
+ nonpositive(params) {
17982
+ return this.check(_lte(BigInt(0), params));
17983
+ },
17984
+ nonnegative(params) {
17985
+ return this.check(_gte(BigInt(0), params));
17986
+ },
17987
+ multipleOf(value, params) {
17988
+ return this.check(_multipleOf(value, params));
17989
+ }
17990
+ })
17991
+ );
17351
17992
  function bigint2(params) {
17352
17993
  return _bigint(ZodBigInt, params);
17353
17994
  }
@@ -17417,16 +18058,26 @@ var ZodVoid = /* @__PURE__ */ $constructor("ZodVoid", (inst, def) => {
17417
18058
  function _void2(params) {
17418
18059
  return _void(ZodVoid, params);
17419
18060
  }
17420
- var ZodDate = /* @__PURE__ */ $constructor("ZodDate", (inst, def) => {
17421
- $ZodDate.init(inst, def);
17422
- ZodType.init(inst, def);
17423
- inst._zod.processJSONSchema = (ctx, json2, params) => dateProcessor(inst, ctx, json2, params);
17424
- inst.min = (value, params) => inst.check(_gte(value, params));
17425
- inst.max = (value, params) => inst.check(_lte(value, params));
17426
- const c = inst._zod.bag;
17427
- inst.minDate = c.minimum ? new Date(c.minimum) : null;
17428
- inst.maxDate = c.maximum ? new Date(c.maximum) : null;
17429
- });
18061
+ var ZodDate = /* @__PURE__ */ $constructor(
18062
+ "ZodDate",
18063
+ (inst, def) => {
18064
+ $ZodDate.init(inst, def);
18065
+ ZodType.init(inst, def);
18066
+ inst._zod.processJSONSchema = (ctx, json2, params) => dateProcessor(inst, ctx, json2, params);
18067
+ inst.min = (value, params) => inst.check(_gte(value, params));
18068
+ inst.max = (value, params) => inst.check(_lte(value, params));
18069
+ },
18070
+ /* @__PURE__ */ util_exports.derived({
18071
+ minDate: (inst) => {
18072
+ const { minimum } = aggregateChecks(inst);
18073
+ return minimum ? new Date(minimum) : null;
18074
+ },
18075
+ maxDate: (inst) => {
18076
+ const { maximum } = aggregateChecks(inst);
18077
+ return maximum ? new Date(maximum) : null;
18078
+ }
18079
+ }, {})
18080
+ );
17430
18081
  function date2(params) {
17431
18082
  return _date(ZodDate, params);
17432
18083
  }
@@ -17471,19 +18122,19 @@ var ZodObject = /* @__PURE__ */ $constructor("ZodObject", (inst, def) => {
17471
18122
  return _enum2(Object.keys(this._zod.def.shape));
17472
18123
  },
17473
18124
  catchall(catchall) {
17474
- return this.clone({ ...this._zod.def, catchall });
18125
+ return this.clone(util_exports.mergeDefs(this._zod.def, { catchall }));
17475
18126
  },
17476
18127
  passthrough() {
17477
- return this.clone({ ...this._zod.def, catchall: unknown() });
18128
+ return this.clone(util_exports.mergeDefs(this._zod.def, { catchall: unknown() }));
17478
18129
  },
17479
18130
  loose() {
17480
- return this.clone({ ...this._zod.def, catchall: unknown() });
18131
+ return this.clone(util_exports.mergeDefs(this._zod.def, { catchall: unknown() }));
17481
18132
  },
17482
18133
  strict() {
17483
- return this.clone({ ...this._zod.def, catchall: never() });
18134
+ return this.clone(util_exports.mergeDefs(this._zod.def, { catchall: never() }));
17484
18135
  },
17485
18136
  strip() {
17486
- return this.clone({ ...this._zod.def, catchall: void 0 });
18137
+ return this.clone(util_exports.mergeDefs(this._zod.def, { catchall: void 0 }));
17487
18138
  },
17488
18139
  extend(incoming) {
17489
18140
  return util_exports.extend(this, incoming);
@@ -17702,7 +18353,7 @@ var ZodEnum = /* @__PURE__ */ $constructor("ZodEnum", (inst, def) => {
17702
18353
  ZodType.init(inst, def);
17703
18354
  inst._zod.processJSONSchema = (ctx, json2, params) => enumProcessor(inst, ctx, json2, params);
17704
18355
  inst.enum = def.entries;
17705
- inst.options = Object.values(def.entries);
18356
+ inst.options = [...inst._zod.values];
17706
18357
  const keys = new Set(Object.keys(def.entries));
17707
18358
  inst.extract = (values, params) => {
17708
18359
  const newEntries = {};
@@ -18065,8 +18716,15 @@ function superRefine(fn, params) {
18065
18716
  }
18066
18717
  var describe2 = describe;
18067
18718
  var meta2 = meta;
18719
+ var ZodInstanceOf = /* @__PURE__ */ $constructor("ZodInstanceOf", (inst, def) => {
18720
+ ZodCustom.init(inst, def);
18721
+ }, {
18722
+ properties(shape, params) {
18723
+ return this.check(_properties(shape, params));
18724
+ }
18725
+ });
18068
18726
  function _instanceof(cls, params = {}) {
18069
- const inst = new ZodCustom({
18727
+ const inst = new ZodInstanceOf({
18070
18728
  type: "custom",
18071
18729
  check: "custom",
18072
18730
  fn: (data) => data instanceof cls,
@@ -18271,27 +18929,188 @@ function resolveRef(ref, ctx) {
18271
18929
  }
18272
18930
  throw new Error(`Reference not found: ${ref}`);
18273
18931
  }
18274
- function checkPropertyNames(objectSchema, keySchema) {
18932
+ function checkObjectGuards(objectSchema, guards) {
18275
18933
  const guard = z.transform((value) => value).check((payload) => {
18276
18934
  const value = payload.value;
18277
18935
  if (typeof value !== "object" || value === null || Array.isArray(value))
18278
18936
  return;
18279
- for (const key of Object.getOwnPropertyNames(value)) {
18280
- const result = keySchema.safeParse(key);
18281
- if (result.success)
18282
- continue;
18937
+ const keys = Object.getOwnPropertyNames(value);
18938
+ if (guards.minProperties !== void 0 && keys.length < guards.minProperties) {
18283
18939
  payload.issues.push({
18284
- code: "invalid_key",
18285
- origin: "record",
18286
- issues: result.error.issues,
18287
- input: key,
18288
- path: [key],
18940
+ origin: "object",
18941
+ code: "too_small",
18942
+ minimum: guards.minProperties,
18943
+ inclusive: true,
18944
+ message: `Too small: expected object to have >=${guards.minProperties} properties`,
18945
+ input: value,
18946
+ inst: objectSchema,
18947
+ continue: true
18948
+ });
18949
+ }
18950
+ if (guards.maxProperties !== void 0 && keys.length > guards.maxProperties) {
18951
+ payload.issues.push({
18952
+ origin: "object",
18953
+ code: "too_big",
18954
+ maximum: guards.maxProperties,
18955
+ inclusive: true,
18956
+ message: `Too big: expected object to have <=${guards.maxProperties} properties`,
18957
+ input: value,
18958
+ inst: objectSchema,
18289
18959
  continue: true
18290
18960
  });
18291
18961
  }
18962
+ if (guards.keySchema) {
18963
+ for (const key of keys) {
18964
+ const result = guards.keySchema.safeParse(key);
18965
+ if (result.success)
18966
+ continue;
18967
+ payload.issues.push({
18968
+ code: "invalid_key",
18969
+ origin: "record",
18970
+ issues: result.error.issues,
18971
+ input: key,
18972
+ path: [key],
18973
+ continue: true
18974
+ });
18975
+ }
18976
+ }
18292
18977
  });
18293
18978
  return guard.pipe(objectSchema);
18294
18979
  }
18980
+ function canonicalKey(value, seen) {
18981
+ if (value === null)
18982
+ return "z";
18983
+ const type = typeof value;
18984
+ if (type !== "object") {
18985
+ if (type === "number" && Number.isNaN(value))
18986
+ return null;
18987
+ const raw = String(value);
18988
+ return `${type[0]}${raw.length}:${raw}`;
18989
+ }
18990
+ if (seen.has(value))
18991
+ return null;
18992
+ seen.add(value);
18993
+ try {
18994
+ if (Array.isArray(value)) {
18995
+ const parts2 = [];
18996
+ for (const item of value) {
18997
+ const key = canonicalKey(item, seen);
18998
+ if (key === null)
18999
+ return null;
19000
+ parts2.push(key);
19001
+ }
19002
+ return `a${parts2.length}:[${parts2.join(",")}]`;
19003
+ }
19004
+ const keys = Object.keys(value).sort();
19005
+ const parts = [];
19006
+ for (const k of keys) {
19007
+ const key = canonicalKey(value[k], seen);
19008
+ if (key === null)
19009
+ return null;
19010
+ parts.push(`${k.length}:${k}=${key}`);
19011
+ }
19012
+ return `o${parts.length}:{${parts.join(",")}}`;
19013
+ } finally {
19014
+ seen.delete(value);
19015
+ }
19016
+ }
19017
+ var SCHEMA_KEYWORDS = /* @__PURE__ */ new Set([
19018
+ "items",
19019
+ "prefixItems",
19020
+ "additionalItems",
19021
+ "additionalProperties",
19022
+ "contains",
19023
+ "propertyNames",
19024
+ "not",
19025
+ "if",
19026
+ "then",
19027
+ "else",
19028
+ "allOf",
19029
+ "anyOf",
19030
+ "oneOf",
19031
+ "unevaluatedItems",
19032
+ "unevaluatedProperties",
19033
+ "contentSchema"
19034
+ ]);
19035
+ var SCHEMA_MAP_KEYWORDS = /* @__PURE__ */ new Set([
19036
+ "properties",
19037
+ "patternProperties",
19038
+ "dependentSchemas",
19039
+ "dependencies",
19040
+ "$defs",
19041
+ "definitions"
19042
+ ]);
19043
+ function containsRef(value) {
19044
+ if (typeof value !== "object" || value === null)
19045
+ return false;
19046
+ if (Array.isArray(value))
19047
+ return value.some(containsRef);
19048
+ if (typeof value.$ref === "string")
19049
+ return true;
19050
+ return Object.entries(value).some(([key, sub]) => {
19051
+ if (SCHEMA_KEYWORDS.has(key))
19052
+ return containsRef(sub);
19053
+ if (!SCHEMA_MAP_KEYWORDS.has(key) || typeof sub !== "object" || sub === null)
19054
+ return false;
19055
+ return Object.values(sub).some(containsRef);
19056
+ });
19057
+ }
19058
+ function plural(n) {
19059
+ return n === 1 ? "element" : "elements";
19060
+ }
19061
+ function checkArrayGuards(arraySchema, guards) {
19062
+ const guard = z.transform((value) => value).check((payload) => {
19063
+ const items = payload.value;
19064
+ if (!Array.isArray(items))
19065
+ return;
19066
+ if (guards.uniqueItems === true) {
19067
+ const firstSeen = /* @__PURE__ */ new Map();
19068
+ for (let i = 0; i < items.length; i++) {
19069
+ const key = canonicalKey(items[i], /* @__PURE__ */ new Set());
19070
+ if (key === null)
19071
+ continue;
19072
+ const first = firstSeen.get(key);
19073
+ if (first === void 0) {
19074
+ firstSeen.set(key, i);
19075
+ continue;
19076
+ }
19077
+ payload.issues.push({
19078
+ code: "custom",
19079
+ message: `Array items must be unique: element at index ${i} duplicates the one at index ${first}`,
19080
+ input: items,
19081
+ path: [i],
19082
+ continue: true
19083
+ });
19084
+ }
19085
+ }
19086
+ if (guards.containsSchema) {
19087
+ const minContains = guards.minContains ?? 1;
19088
+ const ceiling = guards.maxContains !== void 0 ? guards.maxContains + 1 : Number.POSITIVE_INFINITY;
19089
+ let matches = 0;
19090
+ for (const item of items) {
19091
+ if (guards.containsSchema.safeParse(item).success && ++matches >= ceiling)
19092
+ break;
19093
+ }
19094
+ if (matches < minContains) {
19095
+ payload.issues.push({
19096
+ code: "custom",
19097
+ message: `Array must contain at least ${minContains} matching ${plural(minContains)}; found ${matches}`,
19098
+ input: items,
19099
+ continue: true
19100
+ });
19101
+ }
19102
+ if (guards.maxContains !== void 0 && matches > guards.maxContains) {
19103
+ payload.issues.push({
19104
+ code: "custom",
19105
+ message: `Array must contain at most ${guards.maxContains} matching ${plural(guards.maxContains)}`,
19106
+ input: items,
19107
+ continue: true
19108
+ });
19109
+ }
19110
+ }
19111
+ });
19112
+ return guard.pipe(arraySchema);
19113
+ }
18295
19114
  function getTupleRest(restSchema, ctx) {
18296
19115
  if (restSchema === false) {
18297
19116
  return void 0;
@@ -18421,6 +19240,8 @@ function convertBaseSchema(schema, ctx) {
18421
19240
  stringSchema = stringSchema.check(z.e164());
18422
19241
  } else if (format === "credit_card") {
18423
19242
  stringSchema = stringSchema.check(z.creditCard());
19243
+ } else if (format === "iban") {
19244
+ stringSchema = stringSchema.check(z.iban());
18424
19245
  } else if (format === "jwt") {
18425
19246
  stringSchema = stringSchema.check(z.jwt());
18426
19247
  } else if (format === "emoji") {
@@ -18553,9 +19374,16 @@ function convertBaseSchema(schema, ctx) {
18553
19374
  zodSchema = objectSchema.passthrough();
18554
19375
  }
18555
19376
  }
18556
- if (schema.propertyNames !== void 0 && schema.propertyNames !== true) {
18557
- const keyJSONSchema = typeof schema.propertyNames === "object" && schema.propertyNames.type === void 0 ? { type: "string", ...schema.propertyNames } : schema.propertyNames;
18558
- zodSchema = checkPropertyNames(zodSchema, convertSchema(keyJSONSchema, ctx));
19377
+ const hasKeyGuard = schema.propertyNames !== void 0 && schema.propertyNames !== true;
19378
+ const minProperties = typeof schema.minProperties === "number" ? schema.minProperties : void 0;
19379
+ const maxProperties = typeof schema.maxProperties === "number" ? schema.maxProperties : void 0;
19380
+ if (hasKeyGuard || minProperties !== void 0 || maxProperties !== void 0) {
19381
+ let keySchema;
19382
+ if (hasKeyGuard) {
19383
+ const keyJSONSchema = typeof schema.propertyNames === "object" && schema.propertyNames.type === void 0 ? { type: "string", ...schema.propertyNames } : schema.propertyNames;
19384
+ keySchema = convertSchema(keyJSONSchema, ctx);
19385
+ }
19386
+ zodSchema = checkObjectGuards(zodSchema, { keySchema, minProperties, maxProperties });
18559
19387
  }
18560
19388
  break;
18561
19389
  }
@@ -18601,6 +19429,14 @@ function convertBaseSchema(schema, ctx) {
18601
19429
  } else {
18602
19430
  zodSchema = z.array(z.any());
18603
19431
  }
19432
+ if (schema.uniqueItems === true || schema.contains !== void 0) {
19433
+ zodSchema = checkArrayGuards(zodSchema, {
19434
+ uniqueItems: schema.uniqueItems === true,
19435
+ containsSchema: schema.contains !== void 0 ? convertSchema(schema.contains, ctx) : void 0,
19436
+ minContains: typeof schema.minContains === "number" ? schema.minContains : void 0,
19437
+ maxContains: typeof schema.maxContains === "number" ? schema.maxContains : void 0
19438
+ });
19439
+ }
18604
19440
  break;
18605
19441
  }
18606
19442
  default:
@@ -18658,8 +19494,23 @@ function convertSchema(schema, ctx) {
18658
19494
  extraMeta[key] = schema[key];
18659
19495
  }
18660
19496
  }
18661
- if (schema.propertyNames !== void 0 && schema.type === "object" && schema.$ref === void 0) {
18662
- extraMeta.propertyNames = schema.propertyNames;
19497
+ if (schema.type === "object" && schema.$ref === void 0) {
19498
+ if (schema.propertyNames !== void 0 && !containsRef(schema.propertyNames)) {
19499
+ extraMeta.propertyNames = schema.propertyNames;
19500
+ }
19501
+ for (const key of ["minProperties", "maxProperties"]) {
19502
+ if (schema[key] !== void 0)
19503
+ extraMeta[key] = schema[key];
19504
+ }
19505
+ }
19506
+ if (schema.type === "array" && schema.$ref === void 0) {
19507
+ if (schema.contains !== void 0 && !containsRef(schema.contains)) {
19508
+ extraMeta.contains = schema.contains;
19509
+ }
19510
+ for (const key of ["uniqueItems", "minContains", "maxContains"]) {
19511
+ if (schema[key] !== void 0)
19512
+ extraMeta[key] = schema[key];
19513
+ }
18663
19514
  }
18664
19515
  for (const key of Object.keys(schema)) {
18665
19516
  if (!RECOGNIZED_KEYS.has(key)) {
@@ -19009,6 +19860,29 @@ var releaseRegistrationSchema = external_exports.object({
19009
19860
  deployment: deploymentSchema
19010
19861
  }).strict();
19011
19862
 
19863
+ // packages/protocol/src/event-metadata.ts
19864
+ var EVENT_METADATA_LIMITS = {
19865
+ userId: 128,
19866
+ tagName: 32,
19867
+ tagValue: 120,
19868
+ tags: 50,
19869
+ tagFilters: 5
19870
+ };
19871
+ var DEFAULT_TAGS = ["feature", "component", "operation"];
19872
+ var tagNameSchema = external_exports.string().regex(/^[a-zA-Z][a-zA-Z0-9_]{0,31}$/).refine(
19873
+ (value) => !["constructor", "prototype", "__proto__"].includes(value)
19874
+ );
19875
+ var allowedTagsSchema = external_exports.array(tagNameSchema).max(EVENT_METADATA_LIMITS.tags).transform((values) => [...new Set(values)]);
19876
+ var endUserIdSchema = external_exports.string().regex(/^[a-zA-Z0-9_-]{1,128}$/);
19877
+ function sanitizeEndUserId(value) {
19878
+ return endUserIdSchema.safeParse(value).data;
19879
+ }
19880
+ var tagFilterSchema = external_exports.object({
19881
+ name: tagNameSchema,
19882
+ value: external_exports.string().max(EVENT_METADATA_LIMITS.tagValue),
19883
+ operator: external_exports.enum(["eq", "neq"]).optional()
19884
+ }).strict();
19885
+
19012
19886
  // packages/protocol/src/diagnostics.ts
19013
19887
  var API_REASONS = [
19014
19888
  "network_error",
@@ -19144,6 +20018,7 @@ var safeEventSchema = external_exports.object({
19144
20018
  message: external_exports.string().max(1024),
19145
20019
  exceptionType: external_exports.string().max(120),
19146
20020
  handled: external_exports.boolean(),
20021
+ endUserId: endUserIdSchema.optional(),
19147
20022
  environment: environmentNameSchema,
19148
20023
  release: external_exports.string().max(160).optional(),
19149
20024
  appVersion: appVersionSchema.optional(),
@@ -19152,10 +20027,9 @@ var safeEventSchema = external_exports.object({
19152
20027
  api: apiContextSchema.optional(),
19153
20028
  browser: browserContextSchema.optional(),
19154
20029
  frames: external_exports.array(safeFrameSchema).max(100),
19155
- tags: external_exports.record(external_exports.string().max(32), external_exports.string().max(120)),
20030
+ tags: external_exports.record(tagNameSchema, external_exports.string().max(EVENT_METADATA_LIMITS.tagValue)).refine((tags) => Object.keys(tags).length <= EVENT_METADATA_LIMITS.tags),
19156
20031
  breadcrumbs: external_exports.array(safeBreadcrumbSchema).max(50)
19157
20032
  }).strict();
19158
- var DEFAULT_TAGS = ["feature", "component", "operation"];
19159
20033
  function scrub(value, max = 1024) {
19160
20034
  if (typeof value !== "string") {
19161
20035
  return "";
@@ -19195,12 +20069,17 @@ function boundedTime(value, now) {
19195
20069
  function sanitizeTags(value, allowed = DEFAULT_TAGS) {
19196
20070
  const out = /* @__PURE__ */ Object.create(null);
19197
20071
  const input2 = record2(value);
19198
- for (const key of allowed.slice(0, 50)) {
19199
- if (!/^[a-z][a-z0-9_]{0,31}$/.test(key) || ["constructor", "prototype", "__proto__"].includes(key)) {
20072
+ let count = 0;
20073
+ for (const key of allowed === "sdk" ? Object.keys(input2) : allowed) {
20074
+ if (count >= EVENT_METADATA_LIMITS.tags) {
20075
+ break;
20076
+ }
20077
+ if (!tagNameSchema.safeParse(key).success) {
19200
20078
  continue;
19201
20079
  }
19202
20080
  if (typeof input2[key] === "string" || typeof input2[key] === "number" || typeof input2[key] === "boolean") {
19203
- out[key] = scrub(String(input2[key]), 120);
20081
+ out[key] = scrub(String(input2[key]), EVENT_METADATA_LIMITS.tagValue);
20082
+ count++;
19204
20083
  }
19205
20084
  }
19206
20085
  return out;
@@ -19290,6 +20169,10 @@ function sanitizeEvent(value, eventId, now = Date.now() / 1e3, allowedTags = DEF
19290
20169
  const appVersion = sanitizeAppVersion(
19291
20170
  record2(record2(input2.contexts).app).version
19292
20171
  );
20172
+ const endUserId = sanitizeEndUserId(record2(input2.user).id);
20173
+ if (endUserId) {
20174
+ out.endUserId = endUserId;
20175
+ }
19293
20176
  if (appVersion) {
19294
20177
  out.appVersion = appVersion;
19295
20178
  }
@@ -19316,6 +20199,7 @@ function toSentryEvent(event, sdkVersion = "0.1.0") {
19316
20199
  environment: event.environment,
19317
20200
  release: event.release,
19318
20201
  dist: event.dist,
20202
+ ...event.endUserId ? { user: { id: event.endUserId } } : {},
19319
20203
  sdk: { name: "getexception.javascript.browser", version: sdkVersion },
19320
20204
  exception: {
19321
20205
  values: [
@@ -19350,6 +20234,7 @@ ${item}`;
19350
20234
 
19351
20235
  // packages/browser/src/index.ts
19352
20236
  var active = false;
20237
+ var generation = 0;
19353
20238
  var pending = /* @__PURE__ */ new Set();
19354
20239
  var controllers = /* @__PURE__ */ new Set();
19355
20240
  var maxTimeout = (timeout) => Math.min(2e3, Math.max(0, Number.isFinite(timeout) ? timeout : 1500));
@@ -19371,13 +20256,17 @@ function init2(options) {
19371
20256
  const browser = typeof navigator === "undefined" ? void 0 : browserContext(navigator.userAgent);
19372
20257
  const internalDsn = new URL(options.dsn);
19373
20258
  internalDsn.pathname = "/1";
20259
+ const clientGeneration = ++generation;
20260
+ Sentry.getIsolationScope().clear();
20261
+ Sentry.getCurrentScope().clear();
20262
+ backoffUntil = 0;
19374
20263
  Sentry.init({
19375
20264
  dsn: internalDsn.toString(),
19376
20265
  release: options.release,
19377
20266
  environment: options.environment,
19378
20267
  dist: options.buildId ?? options.dist,
19379
20268
  defaultIntegrations: false,
19380
- integrations: [
20269
+ integrations: options.autoCapture === false ? [] : [
19381
20270
  Sentry.globalHandlersIntegration(),
19382
20271
  Sentry.browserApiErrorsIntegration()
19383
20272
  ],
@@ -19386,6 +20275,11 @@ function init2(options) {
19386
20275
  beforeBreadcrumb: (breadcrumb) => sanitizeBreadcrumb(breadcrumb) ?? null,
19387
20276
  beforeSend: (event) => {
19388
20277
  try {
20278
+ if (clientGeneration !== generation || options.autoCapture === false && event.exception?.values?.some(
20279
+ (exception) => exception.mechanism?.type?.startsWith("auto.browser.")
20280
+ )) {
20281
+ return null;
20282
+ }
19389
20283
  for (const exception of event.exception?.values ?? []) {
19390
20284
  for (const frame of exception.stacktrace?.frames ?? []) {
19391
20285
  const debugId = scriptDebugId(frame.filename);
@@ -19405,7 +20299,9 @@ function init2(options) {
19405
20299
  ...browser ? { browser } : {}
19406
20300
  }
19407
20301
  },
19408
- event.event_id ?? ""
20302
+ event.event_id ?? "",
20303
+ Date.now() / 1e3,
20304
+ "sdk"
19409
20305
  ),
19410
20306
  version
19411
20307
  ),
@@ -19417,7 +20313,7 @@ function init2(options) {
19417
20313
  },
19418
20314
  transport: () => ({
19419
20315
  send: async (envelope) => {
19420
- if (!active || Date.now() < backoffUntil || pending.size >= 30) {
20316
+ if (!active || clientGeneration !== generation || Date.now() < backoffUntil || pending.size >= 30) {
19421
20317
  return { statusCode: 429 };
19422
20318
  }
19423
20319
  try {
@@ -19428,7 +20324,7 @@ function init2(options) {
19428
20324
  const payload = items[0][1];
19429
20325
  const eventId = typeof payload === "object" && payload !== null && "event_id" in payload ? String(payload.event_id) : "";
19430
20326
  const body = encodeEnvelope(
19431
- sanitizeEvent(payload, eventId),
20327
+ sanitizeEvent(payload, eventId, Date.now() / 1e3, "sdk"),
19432
20328
  version
19433
20329
  );
19434
20330
  const controller = new AbortController();
@@ -19488,11 +20384,30 @@ function captureException2(exception, context) {
19488
20384
  function captureMessage2(message, level = "error") {
19489
20385
  return ["error", "fatal"].includes(level) ? guarded(() => Sentry.captureMessage(message, level), "") : "";
19490
20386
  }
20387
+ function setUser2(user) {
20388
+ guarded(() => Sentry.setUser(safeUser(user)), void 0);
20389
+ }
20390
+ function safeUser(user) {
20391
+ const id = sanitizeEndUserId(user?.id);
20392
+ return id ? { id } : null;
20393
+ }
20394
+ function tagUpdates(tags) {
20395
+ const safe = sanitizeTags(tags, "sdk");
20396
+ for (const [key, value] of Object.entries(tags).slice(
20397
+ 0,
20398
+ EVENT_METADATA_LIMITS.tags
20399
+ )) {
20400
+ if (value === void 0 && tagNameSchema.safeParse(key).success) {
20401
+ safe[key] = void 0;
20402
+ }
20403
+ }
20404
+ return safe;
20405
+ }
19491
20406
  function setTag(key, value) {
19492
20407
  setTags2({ [key]: value });
19493
20408
  }
19494
20409
  function setTags2(tags) {
19495
- guarded(() => Sentry.setTags(sanitizeTags(tags)), void 0);
20410
+ guarded(() => Sentry.setTags(tagUpdates(tags)), void 0);
19496
20411
  }
19497
20412
  function setContext2(name, context) {
19498
20413
  if (name !== "app" && name !== "api") {
@@ -19517,15 +20432,18 @@ function addBreadcrumb2(breadcrumb) {
19517
20432
  }
19518
20433
  function withScope2(callback) {
19519
20434
  if (!active) {
19520
- return callback({ setTag, setTags: setTags2, setContext: setContext2, addBreadcrumb: addBreadcrumb2 });
20435
+ return callback({ setUser: setUser2, setTag, setTags: setTags2, setContext: setContext2, addBreadcrumb: addBreadcrumb2 });
19521
20436
  }
19522
20437
  return Sentry.withScope(
19523
20438
  (scope) => callback({
20439
+ setUser: (user) => {
20440
+ scope.setUser(safeUser(user));
20441
+ },
19524
20442
  setTag: (key, value) => {
19525
- scope.setTags(sanitizeTags({ [key]: value }));
20443
+ scope.setTags(tagUpdates({ [key]: value }));
19526
20444
  },
19527
20445
  setTags: (tags) => {
19528
- scope.setTags(sanitizeTags(tags));
20446
+ scope.setTags(tagUpdates(tags));
19529
20447
  },
19530
20448
  setContext: (name, context) => {
19531
20449
  if (name === "api") {
@@ -19578,6 +20496,9 @@ async function close2(timeout) {
19578
20496
  return false;
19579
20497
  } finally {
19580
20498
  active = false;
20499
+ generation++;
20500
+ Sentry.getIsolationScope().clear();
20501
+ Sentry.getCurrentScope().clear();
19581
20502
  for (const controller of controllers) {
19582
20503
  controller.abort();
19583
20504
  }
@@ -19594,5 +20515,6 @@ export {
19594
20515
  setContext2 as setContext,
19595
20516
  setTag,
19596
20517
  setTags2 as setTags,
20518
+ setUser2 as setUser,
19597
20519
  withScope2 as withScope
19598
20520
  };