@doist/automations-cli 1.7.1 → 1.8.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js CHANGED
@@ -5,7 +5,7 @@ import {
5
5
  collectSkillStatus,
6
6
  getInstaller,
7
7
  updateAllInstalledSkills
8
- } from "./chunk-Y6UUYHLP.js";
8
+ } from "./chunk-IGMQQ4OT.js";
9
9
 
10
10
  // src/index.ts
11
11
  import { Command } from "commander";
@@ -15,7 +15,7 @@ import { fileURLToPath } from "node:url";
15
15
  // package.json
16
16
  var package_default = {
17
17
  name: "@doist/automations-cli",
18
- version: "1.7.1",
18
+ version: "1.8.0",
19
19
  description: "Command-line client for Todoist Automations",
20
20
  type: "module",
21
21
  bin: {
@@ -70,7 +70,7 @@ var package_default = {
70
70
  devDependencies: {
71
71
  "@doist/automations-core": "*",
72
72
  "@doist/automations-sdk": "*",
73
- "@types/node": "24.13.3",
73
+ "@types/node": "24.13.4",
74
74
  "conventional-changelog-conventionalcommits": "9.3.1",
75
75
  esbuild: "0.28.2",
76
76
  "semantic-release": "25.0.9",
@@ -233,6 +233,7 @@ __export(external_exports, {
233
233
  $brand: () => $brand,
234
234
  $input: () => $input,
235
235
  $output: () => $output,
236
+ INVALID: () => INVALID,
236
237
  NEVER: () => NEVER,
237
238
  TimePrecision: () => TimePrecision,
238
239
  ZodAny: () => ZodAny,
@@ -266,12 +267,14 @@ __export(external_exports, {
266
267
  ZodFirstPartyTypeKind: () => ZodFirstPartyTypeKind,
267
268
  ZodFunction: () => ZodFunction,
268
269
  ZodGUID: () => ZodGUID,
270
+ ZodIBAN: () => ZodIBAN,
269
271
  ZodIPv4: () => ZodIPv4,
270
272
  ZodIPv6: () => ZodIPv6,
271
273
  ZodISODate: () => ZodISODate,
272
274
  ZodISODateTime: () => ZodISODateTime,
273
275
  ZodISODuration: () => ZodISODuration,
274
276
  ZodISOTime: () => ZodISOTime,
277
+ ZodInstanceOf: () => ZodInstanceOf,
275
278
  ZodIntersection: () => ZodIntersection,
276
279
  ZodIssueCode: () => ZodIssueCode,
277
280
  ZodJWT: () => ZodJWT,
@@ -294,6 +297,7 @@ __export(external_exports, {
294
297
  ZodPrefault: () => ZodPrefault,
295
298
  ZodPreprocess: () => ZodPreprocess,
296
299
  ZodPromise: () => ZodPromise,
300
+ ZodProperties: () => ZodProperties,
297
301
  ZodReadonly: () => ZodReadonly,
298
302
  ZodRealError: () => ZodRealError,
299
303
  ZodRecord: () => ZodRecord,
@@ -369,6 +373,7 @@ __export(external_exports, {
369
373
  hex: () => hex2,
370
374
  hostname: () => hostname2,
371
375
  httpUrl: () => httpUrl,
376
+ iban: () => iban2,
372
377
  includes: () => _includes,
373
378
  input: () => input,
374
379
  instanceof: () => _instanceof,
@@ -429,7 +434,7 @@ __export(external_exports, {
429
434
  preprocess: () => preprocess,
430
435
  prettifyError: () => prettifyError,
431
436
  promise: () => promise,
432
- properties: () => _properties,
437
+ properties: () => properties,
433
438
  property: () => _property,
434
439
  readonly: () => readonly,
435
440
  record: () => record,
@@ -480,6 +485,7 @@ __export(external_exports, {
480
485
  validate: () => validate,
481
486
  validateAsync: () => validateAsync,
482
487
  void: () => _void2,
488
+ withParser: () => withParser,
483
489
  xid: () => xid2,
484
490
  xor: () => xor
485
491
  });
@@ -540,6 +546,7 @@ __export(core_exports2, {
540
546
  $ZodFile: () => $ZodFile,
541
547
  $ZodFunction: () => $ZodFunction,
542
548
  $ZodGUID: () => $ZodGUID,
549
+ $ZodIBAN: () => $ZodIBAN,
543
550
  $ZodIPv4: () => $ZodIPv4,
544
551
  $ZodIPv6: () => $ZodIPv6,
545
552
  $ZodISODate: () => $ZodISODate,
@@ -568,6 +575,7 @@ __export(core_exports2, {
568
575
  $ZodPrefault: () => $ZodPrefault,
569
576
  $ZodPreprocess: () => $ZodPreprocess,
570
577
  $ZodPromise: () => $ZodPromise,
578
+ $ZodProperties: () => $ZodProperties,
571
579
  $ZodReadonly: () => $ZodReadonly,
572
580
  $ZodRealError: () => $ZodRealError,
573
581
  $ZodRecord: () => $ZodRecord,
@@ -641,6 +649,7 @@ __export(core_exports2, {
641
649
  _gt: () => _gt,
642
650
  _gte: () => _gte,
643
651
  _guid: () => _guid,
652
+ _iban: () => _iban,
644
653
  _includes: () => _includes,
645
654
  _int: () => _int,
646
655
  _int32: () => _int32,
@@ -732,6 +741,8 @@ __export(core_exports2, {
732
741
  _void: () => _void,
733
742
  _xid: () => _xid,
734
743
  _xor: () => _xor,
744
+ base64Charset: () => base64Charset,
745
+ base64urlCharset: () => base64urlCharset,
735
746
  clone: () => clone,
736
747
  compile: () => compile,
737
748
  compileFn: () => compileFn,
@@ -754,10 +765,12 @@ __export(core_exports2, {
754
765
  initializeContext: () => initializeContext,
755
766
  isBackEdge: () => isBackEdge,
756
767
  isRecursiveSchema: () => isRecursiveSchema,
768
+ isTransforming: () => isTransforming,
757
769
  isValidBase64: () => isValidBase64,
758
770
  isValidBase64URL: () => isValidBase64URL,
759
771
  isValidCIDRv6: () => isValidCIDRv6,
760
772
  isValidCreditCard: () => isValidCreditCard,
773
+ isValidIBAN: () => isValidIBAN,
761
774
  isValidIPv6: () => isValidIPv6,
762
775
  isValidJWT: () => isValidJWT,
763
776
  locales: () => locales_exports,
@@ -768,7 +781,8 @@ __export(core_exports2, {
768
781
  parseAsync: () => parseAsync,
769
782
  parseURLObject: () => parseURLObject,
770
783
  prettifyError: () => prettifyError,
771
- process: () => process2,
784
+ process: () => processSchema,
785
+ processSchema: () => processSchema,
772
786
  regexes: () => regexes_exports,
773
787
  registry: () => registry,
774
788
  safeDecode: () => safeDecode,
@@ -788,7 +802,8 @@ __export(core_exports2, {
788
802
  util: () => util_exports,
789
803
  validate: () => validate,
790
804
  validateAsync: () => validateAsync,
791
- version: () => version
805
+ version: () => version,
806
+ withParser: () => withParser
792
807
  });
793
808
 
794
809
  // ../../node_modules/zod/v4/core/util.js
@@ -820,6 +835,7 @@ __export(util_exports, {
820
835
  createTransparentProxy: () => createTransparentProxy,
821
836
  defineLazy: () => defineLazy,
822
837
  defineLazyInternal: () => defineLazyInternal,
838
+ derived: () => derived,
823
839
  esc: () => esc,
824
840
  escapeRegex: () => escapeRegex,
825
841
  explicitlyAborted: () => explicitlyAborted,
@@ -857,6 +873,7 @@ __export(util_exports, {
857
873
  promiseAllObject: () => promiseAllObject,
858
874
  propertyKeyTypes: () => propertyKeyTypes,
859
875
  randomString: () => randomString,
876
+ rawShape: () => rawShape,
860
877
  required: () => required,
861
878
  safeExtend: () => safeExtend,
862
879
  shallowClone: () => shallowClone,
@@ -897,18 +914,22 @@ function jsonStringifyReplacer(_, value) {
897
914
  return value.toString();
898
915
  return value;
899
916
  }
900
- function cached(getter) {
901
- const set2 = false;
902
- return {
903
- get value() {
904
- if (!set2) {
905
- const value = getter();
906
- Object.defineProperty(this, "value", { value });
907
- return value;
908
- }
909
- throw new Error("cached value already set");
917
+ var Cached = class {
918
+ constructor(getter) {
919
+ this._getter = getter;
920
+ this._value = void 0;
921
+ }
922
+ get value() {
923
+ const getter = this._getter;
924
+ if (getter !== void 0) {
925
+ this._value = getter();
926
+ this._getter = void 0;
910
927
  }
911
- };
928
+ return this._value;
929
+ }
930
+ };
931
+ function cached(getter) {
932
+ return new Cached(getter);
912
933
  }
913
934
  function nullish(input2) {
914
935
  return input2 === null || input2 === void 0;
@@ -960,6 +981,56 @@ function assignProp(target, prop, value) {
960
981
  configurable: true
961
982
  });
962
983
  }
984
+ function rawShape(def) {
985
+ const desc = Object.getOwnPropertyDescriptor(def, "shape");
986
+ return desc?.get ? desc.get.raw : desc?.value;
987
+ }
988
+ function sourceShape(schema) {
989
+ return rawShape(schema._zod.def) ?? schema._zod.def.shape;
990
+ }
991
+ function deferProp(target, key, getter) {
992
+ Object.defineProperty(target, key, {
993
+ get() {
994
+ const value = getter();
995
+ assignProp(this, key, value);
996
+ return value;
997
+ },
998
+ enumerable: true,
999
+ configurable: true
1000
+ });
1001
+ }
1002
+ function putProp(target, key, value) {
1003
+ if (key in target)
1004
+ assignProp(target, key, value);
1005
+ else
1006
+ target[key] = value;
1007
+ }
1008
+ function mirrorShape(target, source, keys, wrap) {
1009
+ const raw = sourceShape(source);
1010
+ for (const key of keys) {
1011
+ const desc = Object.getOwnPropertyDescriptor(raw, key);
1012
+ if (!desc.enumerable)
1013
+ continue;
1014
+ if (desc.get) {
1015
+ deferProp(target, key, () => {
1016
+ const value = source._zod.def.shape[key];
1017
+ return wrap ? wrap(value, key) : value;
1018
+ });
1019
+ } else
1020
+ putProp(target, key, wrap ? wrap(desc.value, key) : desc.value);
1021
+ }
1022
+ }
1023
+ function mirrorProps(target, source) {
1024
+ for (const key of Reflect.ownKeys(source)) {
1025
+ const desc = Object.getOwnPropertyDescriptor(source, key);
1026
+ if (!desc.enumerable)
1027
+ continue;
1028
+ if (desc.get)
1029
+ deferProp(target, key, () => source[key]);
1030
+ else
1031
+ putProp(target, key, desc.value);
1032
+ }
1033
+ }
963
1034
  function mergeDefs(...defs) {
964
1035
  const mergedDescriptors = {};
965
1036
  for (const def of defs) {
@@ -1198,23 +1269,21 @@ function pick(schema, mask) {
1198
1269
  if (hasChecks) {
1199
1270
  throw new Error(".pick() cannot be used on object schemas containing refinements");
1200
1271
  }
1201
- const def = mergeDefs(schema._zod.def, {
1202
- get shape() {
1203
- const newShape = {};
1204
- for (const key of Reflect.ownKeys(mask)) {
1205
- if (!Object.prototype.hasOwnProperty.call(currDef.shape, key)) {
1206
- throw new Error(`Unrecognized key: "${String(key)}"`);
1207
- }
1208
- if (!mask[key])
1209
- continue;
1210
- assignProp(newShape, key, currDef.shape[key]);
1211
- }
1212
- assignProp(this, "shape", newShape);
1213
- return newShape;
1214
- },
1215
- checks: []
1216
- });
1217
- return clone(schema, def);
1272
+ const newShape = {};
1273
+ mirrorShape(newShape, schema, maskedKeys(schema, mask));
1274
+ return clone(schema, mergeDefs(currDef, { shape: newShape, checks: [] }));
1275
+ }
1276
+ function maskedKeys(schema, mask) {
1277
+ const raw = sourceShape(schema);
1278
+ const keys = [];
1279
+ for (const key of Reflect.ownKeys(mask)) {
1280
+ if (!Object.getOwnPropertyDescriptor(raw, key)?.enumerable) {
1281
+ throw new Error(`Unrecognized key: "${String(key)}"`);
1282
+ }
1283
+ if (mask[key])
1284
+ keys.push(key);
1285
+ }
1286
+ return keys;
1218
1287
  }
1219
1288
  function omit(schema, mask) {
1220
1289
  const currDef = schema._zod.def;
@@ -1223,23 +1292,10 @@ function omit(schema, mask) {
1223
1292
  if (hasChecks) {
1224
1293
  throw new Error(".omit() cannot be used on object schemas containing refinements");
1225
1294
  }
1226
- const def = mergeDefs(schema._zod.def, {
1227
- get shape() {
1228
- const newShape = { ...schema._zod.def.shape };
1229
- for (const key of Reflect.ownKeys(mask)) {
1230
- if (!Object.prototype.hasOwnProperty.call(currDef.shape, key)) {
1231
- throw new Error(`Unrecognized key: "${String(key)}"`);
1232
- }
1233
- if (!mask[key])
1234
- continue;
1235
- delete newShape[key];
1236
- }
1237
- assignProp(this, "shape", newShape);
1238
- return newShape;
1239
- },
1240
- checks: []
1241
- });
1242
- return clone(schema, def);
1295
+ const omitted = new Set(maskedKeys(schema, mask));
1296
+ const newShape = {};
1297
+ mirrorShape(newShape, schema, Reflect.ownKeys(sourceShape(schema)).filter((key) => !omitted.has(key)));
1298
+ return clone(schema, mergeDefs(currDef, { shape: newShape, checks: [] }));
1243
1299
  }
1244
1300
  function extend(schema, shape) {
1245
1301
  if (!isPlainObject(shape)) {
@@ -1248,34 +1304,26 @@ function extend(schema, shape) {
1248
1304
  const checks = schema._zod.def.checks;
1249
1305
  const hasChecks = checks && checks.length > 0;
1250
1306
  if (hasChecks) {
1251
- const existingShape = schema._zod.def.shape;
1307
+ const existingShape = sourceShape(schema);
1252
1308
  for (const key of Reflect.ownKeys(shape)) {
1253
1309
  if (Object.getOwnPropertyDescriptor(existingShape, key) !== void 0) {
1254
1310
  throw new Error("Cannot overwrite keys on object schemas containing refinements. Use `.safeExtend()` instead.");
1255
1311
  }
1256
1312
  }
1257
1313
  }
1258
- const def = mergeDefs(schema._zod.def, {
1259
- get shape() {
1260
- const _shape = { ...schema._zod.def.shape, ...shape };
1261
- assignProp(this, "shape", _shape);
1262
- return _shape;
1263
- }
1264
- });
1265
- return clone(schema, def);
1314
+ return clone(schema, mergeDefs(schema._zod.def, { shape: extended(schema, shape) }));
1315
+ }
1316
+ function extended(schema, shape) {
1317
+ const newShape = {};
1318
+ mirrorShape(newShape, schema, Reflect.ownKeys(sourceShape(schema)));
1319
+ mirrorProps(newShape, shape);
1320
+ return newShape;
1266
1321
  }
1267
1322
  function safeExtend(schema, shape) {
1268
1323
  if (!isPlainObject(shape)) {
1269
1324
  throw new Error("Invalid input to safeExtend: expected a plain object");
1270
1325
  }
1271
- const def = mergeDefs(schema._zod.def, {
1272
- get shape() {
1273
- const _shape = { ...schema._zod.def.shape, ...shape };
1274
- assignProp(this, "shape", _shape);
1275
- return _shape;
1276
- }
1277
- });
1278
- return clone(schema, def);
1326
+ return clone(schema, mergeDefs(schema._zod.def, { shape: extended(schema, shape) }));
1279
1327
  }
1280
1328
  function merge(a, b) {
1281
1329
  if (!b?._zod?.def) {
@@ -1284,12 +1332,11 @@ function merge(a, b) {
1284
1332
  if (a._zod.def.checks?.length) {
1285
1333
  throw new Error(".merge() cannot be used on object schemas containing refinements. Use .safeExtend() instead.");
1286
1334
  }
1335
+ const newShape = {};
1336
+ mirrorShape(newShape, a, Reflect.ownKeys(sourceShape(a)));
1337
+ mirrorShape(newShape, b, Reflect.ownKeys(sourceShape(b)));
1287
1338
  const def = mergeDefs(a._zod.def, {
1288
- get shape() {
1289
- const _shape = { ...a._zod.def.shape, ...b._zod.def.shape };
1290
- assignProp(this, "shape", _shape);
1291
- return _shape;
1292
- },
1339
+ shape: newShape,
1293
1340
  get catchall() {
1294
1341
  return b._zod.def.catchall;
1295
1342
  },
@@ -1304,67 +1351,19 @@ function partial(Class2, schema, mask, name = "partial") {
1304
1351
  if (hasChecks) {
1305
1352
  throw new Error(`.${name}() cannot be used on object schemas containing refinements`);
1306
1353
  }
1307
- const def = mergeDefs(schema._zod.def, {
1308
- get shape() {
1309
- const oldShape = schema._zod.def.shape;
1310
- const shape = { ...oldShape };
1311
- if (mask) {
1312
- for (const key of Reflect.ownKeys(mask)) {
1313
- if (!Object.prototype.hasOwnProperty.call(oldShape, key)) {
1314
- throw new Error(`Unrecognized key: "${String(key)}"`);
1315
- }
1316
- if (!mask[key])
1317
- continue;
1318
- shape[key] = Class2 ? new Class2({
1319
- type: "optional",
1320
- innerType: oldShape[key]
1321
- }) : oldShape[key];
1322
- }
1323
- } else {
1324
- for (const key of Reflect.ownKeys(oldShape)) {
1325
- shape[key] = Class2 ? new Class2({
1326
- type: "optional",
1327
- innerType: oldShape[key]
1328
- }) : oldShape[key];
1329
- }
1330
- }
1331
- assignProp(this, "shape", shape);
1332
- return shape;
1333
- },
1334
- checks: []
1335
- });
1336
- return clone(schema, def);
1354
+ const selected2 = mask ? new Set(maskedKeys(schema, mask)) : void 0;
1355
+ const newShape = {};
1356
+ mirrorShape(newShape, schema, Reflect.ownKeys(sourceShape(schema)), Class2 && ((value, key) => selected2 && !selected2.has(key) ? value : new Class2({ type: "optional", innerType: value })));
1357
+ return clone(schema, mergeDefs(schema._zod.def, { shape: newShape, checks: [] }));
1337
1358
  }
1338
1359
  function required(Class2, schema, mask) {
1339
- const def = mergeDefs(schema._zod.def, {
1340
- get shape() {
1341
- const oldShape = schema._zod.def.shape;
1342
- const shape = { ...oldShape };
1343
- if (mask) {
1344
- for (const key of Reflect.ownKeys(mask)) {
1345
- if (!Object.prototype.hasOwnProperty.call(shape, key)) {
1346
- throw new Error(`Unrecognized key: "${String(key)}"`);
1347
- }
1348
- if (!mask[key])
1349
- continue;
1350
- shape[key] = new Class2({
1351
- type: "nonoptional",
1352
- innerType: oldShape[key]
1353
- });
1354
- }
1355
- } else {
1356
- for (const key of Reflect.ownKeys(oldShape)) {
1357
- shape[key] = new Class2({
1358
- type: "nonoptional",
1359
- innerType: oldShape[key]
1360
- });
1361
- }
1362
- }
1363
- assignProp(this, "shape", shape);
1364
- return shape;
1365
- }
1366
- });
1367
- return clone(schema, def);
1360
+ const selected2 = mask ? new Set(maskedKeys(schema, mask)) : void 0;
1361
+ const newShape = {};
1362
+ mirrorShape(newShape, schema, Reflect.ownKeys(sourceShape(schema)), (value, key) => (
1363
+ // overwrite with non-optional
1364
+ selected2 && !selected2.has(key) ? value : new Class2({ type: "nonoptional", innerType: value })
1365
+ ));
1366
+ return clone(schema, mergeDefs(schema._zod.def, { shape: newShape }));
1368
1367
  }
1369
1368
  function aborted(x, startIndex = 0) {
1370
1369
  if (x.aborted === true)
@@ -1414,13 +1413,18 @@ function finalizeIssue(iss, ctx, config2) {
1414
1413
  }
1415
1414
  const schemaError = iss.schema !== iss.inst ? iss.schema?._zod.def?.error : void 0;
1416
1415
  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";
1417
- const { inst: _inst, schema: _schema, continue: _continue, input: _input, ...rest } = iss;
1418
- rest.path ?? (rest.path = []);
1419
- rest.message = message;
1416
+ const full = {};
1417
+ for (const k of Object.keys(iss)) {
1418
+ if (k === "inst" || k === "schema" || k === "continue" || k === "input" || k === "__proto__")
1419
+ continue;
1420
+ full[k] = iss[k];
1421
+ }
1422
+ full.path ?? (full.path = []);
1423
+ full.message = message;
1420
1424
  if (ctx?.reportInput) {
1421
- rest.input = _input;
1425
+ full.input = iss.input;
1422
1426
  }
1423
- return rest;
1427
+ return full;
1424
1428
  }
1425
1429
  function getSizableOrigin(input2) {
1426
1430
  if (input2 instanceof Set)
@@ -1539,6 +1543,9 @@ function members(proto, table) {
1539
1543
  else
1540
1544
  defineBound(proto, key, desc.value);
1541
1545
  }
1546
+ for (const sym of Object.getOwnPropertySymbols(table)) {
1547
+ defineBound(proto, sym, table[sym]);
1548
+ }
1542
1549
  }
1543
1550
  function own(inst, key, value, enumerable = true) {
1544
1551
  Object.defineProperty(inst, key, { configurable: true, writable: true, enumerable, value });
@@ -1547,6 +1554,23 @@ function own(inst, key, value, enumerable = true) {
1547
1554
  function hide(inst, key, value) {
1548
1555
  return own(inst, key, value, false);
1549
1556
  }
1557
+ // @__NO_SIDE_EFFECTS__
1558
+ function derived(computes, table) {
1559
+ for (const key in computes) {
1560
+ const compute = computes[key];
1561
+ Object.defineProperty(table, key, {
1562
+ configurable: true,
1563
+ enumerable: true,
1564
+ get() {
1565
+ return own(this, key, compute(this));
1566
+ },
1567
+ set(value) {
1568
+ own(this, key, value);
1569
+ }
1570
+ });
1571
+ }
1572
+ return table;
1573
+ }
1550
1574
  function defineBound(proto, key, fn) {
1551
1575
  Object.defineProperty(proto, key, {
1552
1576
  configurable: true,
@@ -1766,16 +1790,12 @@ var _messageDesc = {
1766
1790
  enumerable: true,
1767
1791
  configurable: true
1768
1792
  };
1769
- var _zodDesc2 = { value: void 0, enumerable: false };
1770
1793
  var _issuesDesc = { value: void 0, enumerable: false };
1771
1794
  var _installedToString = /* @__PURE__ */ new WeakSet([Object.prototype, Error.prototype]);
1772
1795
  var initializer = (inst, def) => {
1773
1796
  inst.name = "$ZodError";
1774
- _zodDesc2.value = inst._zod;
1775
- Object.defineProperty(inst, "_zod", _zodDesc2);
1776
1797
  _issuesDesc.value = def;
1777
1798
  Object.defineProperty(inst, "issues", _issuesDesc);
1778
- _zodDesc2.value = void 0;
1779
1799
  _issuesDesc.value = void 0;
1780
1800
  Object.defineProperty(inst, "message", _messageDesc);
1781
1801
  const proto = Object.getPrototypeOf(inst);
@@ -1990,33 +2010,50 @@ var _safeParse = (_Err) => (schema, value, _ctx) => {
1990
2010
  if (result instanceof Promise) {
1991
2011
  throw new $ZodAsyncError();
1992
2012
  }
1993
- return result.issues.length ? {
1994
- success: false,
1995
- error: new (_Err ?? $ZodError)(result.issues.map((iss) => finalizeIssue(iss, ctx, config())))
1996
- } : { success: true, data: result.value };
2013
+ return result.issues.length ? failure(_Err, result.issues, ctx) : { success: true, data: result.value };
1997
2014
  };
1998
2015
  var safeParse = /* @__PURE__ */ _safeParse($ZodRealError);
2016
+ function failure(Err, issues, ctx) {
2017
+ let error61;
2018
+ return {
2019
+ success: false,
2020
+ get error() {
2021
+ if (!error61) {
2022
+ error61 = new Err(issues.map((iss) => finalizeIssue(iss, ctx, config())));
2023
+ issues = void 0;
2024
+ ctx = void 0;
2025
+ }
2026
+ return error61;
2027
+ },
2028
+ set error(e) {
2029
+ error61 = e;
2030
+ issues = void 0;
2031
+ ctx = void 0;
2032
+ }
2033
+ };
2034
+ }
1999
2035
  var _safeParseAsync = (_Err) => async (schema, value, _ctx) => {
2000
2036
  const ctx = _ctx ? { ..._ctx, async: true } : { async: true };
2001
2037
  let result = schema._zod.run({ value, issues: [] }, ctx);
2002
2038
  if (result instanceof Promise)
2003
2039
  result = await result;
2004
- return result.issues.length ? {
2005
- success: false,
2006
- error: new _Err(result.issues.map((iss) => finalizeIssue(iss, ctx, config())))
2007
- } : { success: true, data: result.value };
2040
+ return result.issues.length ? failure(_Err, result.issues, ctx) : { success: true, data: result.value };
2008
2041
  };
2009
2042
  var safeParseAsync = /* @__PURE__ */ _safeParseAsync($ZodRealError);
2010
2043
  var COMPILE_INVALID = /* @__PURE__ */ Symbol.for("zod.compile.invalid");
2011
2044
  var COMPILE_FALLBACK = /* @__PURE__ */ Symbol.for("zod.compile.fallback");
2012
2045
  var validate = ((schema, value, _ctx) => {
2013
2046
  const validator = schema._zod.bag.validator;
2014
- if (validator !== void 0 && validator(value) !== COMPILE_INVALID)
2015
- return true;
2047
+ if (validator !== void 0) {
2048
+ if (validator(value) !== COMPILE_INVALID)
2049
+ return true;
2050
+ if (validator.definite === true && _ctx === void 0)
2051
+ return false;
2052
+ }
2016
2053
  return validateFallback(schema, value, _ctx);
2017
2054
  });
2018
2055
  function validateFallback(schema, value, _ctx) {
2019
- const ctx = _ctx ? { ..._ctx, async: false } : { async: false };
2056
+ const ctx = _ctx ? { ..._ctx, async: false, abortEarly: true } : { async: false, abortEarly: true };
2020
2057
  const fallbackRun = schema._zod.bag.fallbackRun;
2021
2058
  let result;
2022
2059
  if (fallbackRun) {
@@ -2031,7 +2068,7 @@ function validateFallback(schema, value, _ctx) {
2031
2068
  return result.issues.length === 0;
2032
2069
  }
2033
2070
  var validateAsync = async (schema, value, _ctx) => {
2034
- const ctx = _ctx ? { ..._ctx, async: true } : { async: true };
2071
+ const ctx = _ctx ? { ..._ctx, async: true, abortEarly: true } : { async: true, abortEarly: true };
2035
2072
  let result = schema._zod.run({ value, issues: [] }, ctx);
2036
2073
  if (result instanceof Promise)
2037
2074
  result = await result;
@@ -2093,6 +2130,7 @@ var safeDecodeAsync = /* @__PURE__ */ _safeDecodeAsync($ZodRealError);
2093
2130
  // ../../node_modules/zod/v4/core/regexes.js
2094
2131
  var regexes_exports = {};
2095
2132
  __export(regexes_exports, {
2133
+ anyString: () => anyString,
2096
2134
  base64: () => base64,
2097
2135
  base64url: () => base64url,
2098
2136
  bigint: () => bigint,
@@ -2116,6 +2154,7 @@ __export(regexes_exports, {
2116
2154
  hostname: () => hostname,
2117
2155
  html5Email: () => html5Email,
2118
2156
  httpProtocol: () => httpProtocol,
2157
+ iban: () => iban,
2119
2158
  idnEmail: () => idnEmail,
2120
2159
  integer: () => integer,
2121
2160
  ipv4: () => ipv4,
@@ -2175,13 +2214,13 @@ var uuid = (version2) => {
2175
2214
  var uuid4 = /* @__PURE__ */ uuid(4);
2176
2215
  var uuid6 = /* @__PURE__ */ uuid(6);
2177
2216
  var uuid7 = /* @__PURE__ */ uuid(7);
2178
- var email = /^(?!\.)(?!.*\.\.)([A-Za-z0-9_'+\-\.]*)[A-Za-z0-9_+-]@([A-Za-z0-9][A-Za-z0-9\-]*\.)+[A-Za-z]{2,}$/;
2217
+ 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,}$/;
2179
2218
  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])?)*$/;
2180
2219
  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,}))$/;
2181
2220
  var unicodeEmail = /^[^\s@"]{1,64}@[^\s@]{1,255}$/u;
2182
2221
  var idnEmail = unicodeEmail;
2183
2222
  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])?)*$/;
2184
- var _emoji = `^[\\p{Extended_Pictographic}\\p{Emoji_Component}]+$`;
2223
+ var _emoji = `^(?=[\\s\\S]*[\\p{Extended_Pictographic}\\p{Regional_Indicator}\\u20E3])[\\p{Extended_Pictographic}\\p{Emoji_Component}]+$`;
2185
2224
  function emoji() {
2186
2225
  return new RegExp(_emoji, "u");
2187
2226
  }
@@ -2194,12 +2233,13 @@ var mac = (delimiter) => {
2194
2233
  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])$/;
2195
2234
  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])$/;
2196
2235
  var base64 = /^$|^(?:[0-9a-zA-Z+/]{4})*(?:(?:[0-9a-zA-Z+/]{2}==)|(?:[0-9a-zA-Z+/]{3}=))?$/;
2197
- var base64url = /^[A-Za-z0-9_-]*$/;
2236
+ var base64url = /^(?:[A-Za-z0-9_-]{4})*(?:[A-Za-z0-9_-]{2,3})?$/;
2198
2237
  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])?)*\.?$/;
2199
2238
  var domain = /^(?=.{1,253}$)([a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?\.)+[a-zA-Z]{2,63}$/;
2200
2239
  var httpProtocol = /^https?$/;
2201
2240
  var e164 = /^\+[1-9]\d{6,14}$/;
2202
2241
  var creditCard = /^\d(?:[ -]?\d){11,18}$/;
2242
+ var iban = /^[A-Z]{2}(?!00|01|99)\d{2}[A-Z0-9]{11,30}$/;
2203
2243
  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])))`;
2204
2244
  function anchor(source) {
2205
2245
  return new RegExp(`^${source}$`);
@@ -2221,6 +2261,7 @@ function datetime(args) {
2221
2261
  const timeRegex = args.local ? `${qualified}|${timeSource({ precision: args.precision })}` : qualified;
2222
2262
  return new RegExp(`^${dateSource}T(?:${timeRegex})$`);
2223
2263
  }
2264
+ var anyString = /^[\s\S]{0,}$/;
2224
2265
  var string = (params) => {
2225
2266
  const regex = params ? `[\\s\\S]{${params?.minimum ?? 0},${params?.maximum ?? ""}}` : `[\\s\\S]*`;
2226
2267
  return new RegExp(`^${regex}$`);
@@ -2279,16 +2320,6 @@ var numericOriginMap = {
2279
2320
  var $ZodCheckLessThan = /* @__PURE__ */ $constructor("$ZodCheckLessThan", (inst, def) => {
2280
2321
  $ZodCheck.init(inst, def);
2281
2322
  const origin = numericOriginMap[typeof def.value];
2282
- inst._zod.onattach.push((inst2) => {
2283
- const bag = inst2._zod.bag;
2284
- const curr = (def.inclusive ? bag.maximum : bag.exclusiveMaximum) ?? Number.POSITIVE_INFINITY;
2285
- if (def.value < curr) {
2286
- if (def.inclusive)
2287
- bag.maximum = def.value;
2288
- else
2289
- bag.exclusiveMaximum = def.value;
2290
- }
2291
- });
2292
2323
  inst._zod.check = (payload) => {
2293
2324
  if (def.inclusive ? payload.value <= def.value : payload.value < def.value) {
2294
2325
  return;
@@ -2307,16 +2338,6 @@ var $ZodCheckLessThan = /* @__PURE__ */ $constructor("$ZodCheckLessThan", (inst,
2307
2338
  var $ZodCheckGreaterThan = /* @__PURE__ */ $constructor("$ZodCheckGreaterThan", (inst, def) => {
2308
2339
  $ZodCheck.init(inst, def);
2309
2340
  const origin = numericOriginMap[typeof def.value];
2310
- inst._zod.onattach.push((inst2) => {
2311
- const bag = inst2._zod.bag;
2312
- const curr = (def.inclusive ? bag.minimum : bag.exclusiveMinimum) ?? Number.NEGATIVE_INFINITY;
2313
- if (def.value > curr) {
2314
- if (def.inclusive)
2315
- bag.minimum = def.value;
2316
- else
2317
- bag.exclusiveMinimum = def.value;
2318
- }
2319
- });
2320
2341
  inst._zod.check = (payload) => {
2321
2342
  if (def.inclusive ? payload.value >= def.value : payload.value > def.value) {
2322
2343
  return;
@@ -2334,10 +2355,6 @@ var $ZodCheckGreaterThan = /* @__PURE__ */ $constructor("$ZodCheckGreaterThan",
2334
2355
  });
2335
2356
  var $ZodCheckMultipleOf = /* @__PURE__ */ $constructor("$ZodCheckMultipleOf", (inst, def) => {
2336
2357
  $ZodCheck.init(inst, def);
2337
- inst._zod.onattach.push((inst2) => {
2338
- var _a3;
2339
- (_a3 = inst2._zod.bag).multipleOf ?? (_a3.multipleOf = def.value);
2340
- });
2341
2358
  inst._zod.check = (payload) => {
2342
2359
  if (typeof payload.value !== typeof def.value)
2343
2360
  throw new Error("Cannot mix number and bigint in multiple_of check.");
@@ -2363,14 +2380,6 @@ var $ZodCheckNumberFormat = /* @__PURE__ */ $constructor("$ZodCheckNumberFormat"
2363
2380
  const isInt = def.format?.includes("int");
2364
2381
  const origin = isInt ? "int" : "number";
2365
2382
  const [minimum, maximum] = NUMBER_FORMAT_RANGES[def.format];
2366
- inst._zod.onattach.push((inst2) => {
2367
- const bag = inst2._zod.bag;
2368
- bag.format = def.format;
2369
- bag.minimum = minimum;
2370
- bag.maximum = maximum;
2371
- if (isInt)
2372
- bag.pattern = integer;
2373
- });
2374
2383
  inst._zod.check = (payload) => {
2375
2384
  const input2 = payload.value;
2376
2385
  if (isInt) {
@@ -2439,12 +2448,6 @@ var $ZodCheckNumberFormat = /* @__PURE__ */ $constructor("$ZodCheckNumberFormat"
2439
2448
  var $ZodCheckBigIntFormat = /* @__PURE__ */ $constructor("$ZodCheckBigIntFormat", (inst, def) => {
2440
2449
  $ZodCheck.init(inst, def);
2441
2450
  const [minimum, maximum] = BIGINT_FORMAT_RANGES[def.format];
2442
- inst._zod.onattach.push((inst2) => {
2443
- const bag = inst2._zod.bag;
2444
- bag.format = def.format;
2445
- bag.minimum = minimum;
2446
- bag.maximum = maximum;
2447
- });
2448
2451
  inst._zod.check = (payload) => {
2449
2452
  const input2 = payload.value;
2450
2453
  if (input2 < minimum) {
@@ -2475,11 +2478,6 @@ var $ZodCheckMaxSize = /* @__PURE__ */ $constructor("$ZodCheckMaxSize", (inst, d
2475
2478
  var _a3;
2476
2479
  $ZodCheck.init(inst, def);
2477
2480
  (_a3 = inst._zod.def).when ?? (_a3.when = _whenHasSize);
2478
- inst._zod.onattach.push((inst2) => {
2479
- const curr = inst2._zod.bag.maximum ?? Number.POSITIVE_INFINITY;
2480
- if (def.maximum < curr)
2481
- inst2._zod.bag.maximum = def.maximum;
2482
- });
2483
2481
  inst._zod.check = (payload) => {
2484
2482
  const input2 = payload.value;
2485
2483
  const size = input2.size;
@@ -2500,11 +2498,6 @@ var $ZodCheckMinSize = /* @__PURE__ */ $constructor("$ZodCheckMinSize", (inst, d
2500
2498
  var _a3;
2501
2499
  $ZodCheck.init(inst, def);
2502
2500
  (_a3 = inst._zod.def).when ?? (_a3.when = _whenHasSize);
2503
- inst._zod.onattach.push((inst2) => {
2504
- const curr = inst2._zod.bag.minimum ?? Number.NEGATIVE_INFINITY;
2505
- if (def.minimum > curr)
2506
- inst2._zod.bag.minimum = def.minimum;
2507
- });
2508
2501
  inst._zod.check = (payload) => {
2509
2502
  const input2 = payload.value;
2510
2503
  const size = input2.size;
@@ -2525,12 +2518,6 @@ var $ZodCheckSizeEquals = /* @__PURE__ */ $constructor("$ZodCheckSizeEquals", (i
2525
2518
  var _a3;
2526
2519
  $ZodCheck.init(inst, def);
2527
2520
  (_a3 = inst._zod.def).when ?? (_a3.when = _whenHasSize);
2528
- inst._zod.onattach.push((inst2) => {
2529
- const bag = inst2._zod.bag;
2530
- bag.minimum = def.size;
2531
- bag.maximum = def.size;
2532
- bag.size = def.size;
2533
- });
2534
2521
  inst._zod.check = (payload) => {
2535
2522
  const input2 = payload.value;
2536
2523
  const size = input2.size;
@@ -2552,11 +2539,6 @@ var $ZodCheckMaxLength = /* @__PURE__ */ $constructor("$ZodCheckMaxLength", (ins
2552
2539
  var _a3;
2553
2540
  $ZodCheck.init(inst, def);
2554
2541
  (_a3 = inst._zod.def).when ?? (_a3.when = _whenHasLength);
2555
- inst._zod.onattach.push((inst2) => {
2556
- const curr = inst2._zod.bag.maximum ?? Number.POSITIVE_INFINITY;
2557
- if (def.maximum < curr)
2558
- inst2._zod.bag.maximum = def.maximum;
2559
- });
2560
2542
  inst._zod.check = (payload) => {
2561
2543
  const input2 = payload.value;
2562
2544
  const units = input2.length;
@@ -2579,11 +2561,6 @@ var $ZodCheckMinLength = /* @__PURE__ */ $constructor("$ZodCheckMinLength", (ins
2579
2561
  var _a3;
2580
2562
  $ZodCheck.init(inst, def);
2581
2563
  (_a3 = inst._zod.def).when ?? (_a3.when = _whenHasLength);
2582
- inst._zod.onattach.push((inst2) => {
2583
- const curr = inst2._zod.bag.minimum ?? Number.NEGATIVE_INFINITY;
2584
- if (def.minimum > curr)
2585
- inst2._zod.bag.minimum = def.minimum;
2586
- });
2587
2564
  inst._zod.check = (payload) => {
2588
2565
  const input2 = payload.value;
2589
2566
  const units = input2.length;
@@ -2606,12 +2583,6 @@ var $ZodCheckLengthEquals = /* @__PURE__ */ $constructor("$ZodCheckLengthEquals"
2606
2583
  var _a3;
2607
2584
  $ZodCheck.init(inst, def);
2608
2585
  (_a3 = inst._zod.def).when ?? (_a3.when = _whenHasLength);
2609
- inst._zod.onattach.push((inst2) => {
2610
- const bag = inst2._zod.bag;
2611
- bag.minimum = def.length;
2612
- bag.maximum = def.length;
2613
- bag.length = def.length;
2614
- });
2615
2586
  inst._zod.check = (payload) => {
2616
2587
  const input2 = payload.value;
2617
2588
  const units = input2.length;
@@ -2634,14 +2605,6 @@ var $ZodCheckLengthEquals = /* @__PURE__ */ $constructor("$ZodCheckLengthEquals"
2634
2605
  var $ZodCheckStringFormat = /* @__PURE__ */ $constructor("$ZodCheckStringFormat", (inst, def) => {
2635
2606
  var _a3, _b;
2636
2607
  $ZodCheck.init(inst, def);
2637
- inst._zod.onattach.push((inst2) => {
2638
- const bag = inst2._zod.bag;
2639
- bag.format = def.format;
2640
- if (def.pattern) {
2641
- bag.patterns ?? (bag.patterns = /* @__PURE__ */ new Set());
2642
- bag.patterns.add(def.pattern);
2643
- }
2644
- });
2645
2608
  if (def.pattern)
2646
2609
  (_a3 = inst._zod).check ?? (_a3.check = (payload) => {
2647
2610
  def.pattern.lastIndex = 0;
@@ -2691,11 +2654,6 @@ var $ZodCheckIncludes = /* @__PURE__ */ $constructor("$ZodCheckIncludes", (inst,
2691
2654
  const escapedRegex = escapeRegex(def.includes);
2692
2655
  const pattern = new RegExp(typeof def.position === "number" ? `^.{${def.position},}${escapedRegex}` : escapedRegex);
2693
2656
  def.pattern = pattern;
2694
- inst._zod.onattach.push((inst2) => {
2695
- const bag = inst2._zod.bag;
2696
- bag.patterns ?? (bag.patterns = /* @__PURE__ */ new Set());
2697
- bag.patterns.add(pattern);
2698
- });
2699
2657
  inst._zod.check = (payload) => {
2700
2658
  if (payload.value.includes(def.includes, def.position))
2701
2659
  return;
@@ -2714,11 +2672,6 @@ var $ZodCheckStartsWith = /* @__PURE__ */ $constructor("$ZodCheckStartsWith", (i
2714
2672
  $ZodCheck.init(inst, def);
2715
2673
  const pattern = new RegExp(`^${escapeRegex(def.prefix)}.*`);
2716
2674
  def.pattern ?? (def.pattern = pattern);
2717
- inst._zod.onattach.push((inst2) => {
2718
- const bag = inst2._zod.bag;
2719
- bag.patterns ?? (bag.patterns = /* @__PURE__ */ new Set());
2720
- bag.patterns.add(pattern);
2721
- });
2722
2675
  inst._zod.check = (payload) => {
2723
2676
  if (payload.value.startsWith(def.prefix))
2724
2677
  return;
@@ -2737,11 +2690,6 @@ var $ZodCheckEndsWith = /* @__PURE__ */ $constructor("$ZodCheckEndsWith", (inst,
2737
2690
  $ZodCheck.init(inst, def);
2738
2691
  const pattern = new RegExp(`.*${escapeRegex(def.suffix)}$`);
2739
2692
  def.pattern ?? (def.pattern = pattern);
2740
- inst._zod.onattach.push((inst2) => {
2741
- const bag = inst2._zod.bag;
2742
- bag.patterns ?? (bag.patterns = /* @__PURE__ */ new Set());
2743
- bag.patterns.add(pattern);
2744
- });
2745
2693
  inst._zod.check = (payload) => {
2746
2694
  if (payload.value.endsWith(def.suffix))
2747
2695
  return;
@@ -2778,9 +2726,6 @@ var $ZodCheckProperty = /* @__PURE__ */ $constructor("$ZodCheckProperty", (inst,
2778
2726
  var $ZodCheckMimeType = /* @__PURE__ */ $constructor("$ZodCheckMimeType", (inst, def) => {
2779
2727
  $ZodCheck.init(inst, def);
2780
2728
  const mimeSet = new Set(def.mime);
2781
- inst._zod.onattach.push((inst2) => {
2782
- inst2._zod.bag.mime = def.mime;
2783
- });
2784
2729
  inst._zod.check = (payload) => {
2785
2730
  if (mimeSet.has(payload.value.type))
2786
2731
  return;
@@ -2808,10 +2753,14 @@ var Doc = class {
2808
2753
  this.args = args;
2809
2754
  this.closed = closed;
2810
2755
  }
2756
+ // the compiler catches a child's throw and keeps writing into this doc, so the indent has to unwind with it
2811
2757
  indented(fn) {
2812
2758
  this.indent += 1;
2813
- fn(this);
2814
- this.indent -= 1;
2759
+ try {
2760
+ fn(this);
2761
+ } finally {
2762
+ this.indent -= 1;
2763
+ }
2815
2764
  }
2816
2765
  write(arg) {
2817
2766
  if (typeof arg === "function") {
@@ -2840,8 +2789,8 @@ ${content.join("\n")}
2840
2789
  // ../../node_modules/zod/v4/core/versions.js
2841
2790
  var version = {
2842
2791
  major: 4,
2843
- minor: 5,
2844
- patch: 4
2792
+ minor: 6,
2793
+ patch: 0
2845
2794
  };
2846
2795
 
2847
2796
  // ../../node_modules/zod/v4/core/schemas.js
@@ -2954,15 +2903,22 @@ var $ZodType = /* @__PURE__ */ $constructor("$ZodType", (inst, def) => {
2954
2903
  own(this, "~standard", value);
2955
2904
  }
2956
2905
  });
2957
- var toStandardResult = (r) => r.success ? { value: r.data } : { issues: r.error?.issues };
2906
+ var toStandardResult = (r, ctx) => r.issues.length ? { issues: r.issues.map((iss) => finalizeIssue(iss, ctx, config())) } : { value: r.value };
2907
+ async function validateAsync2(inst, value) {
2908
+ const ctx = { async: true };
2909
+ return toStandardResult(await inst._zod.run({ value, issues: [] }, ctx), ctx);
2910
+ }
2958
2911
  function standardProps(inst) {
2959
2912
  return {
2960
2913
  validate: (value) => {
2914
+ const ctx = { async: false };
2961
2915
  try {
2962
- return toStandardResult(safeParse(inst, value));
2916
+ const r = inst._zod.run({ value, issues: [] }, ctx);
2917
+ if (!(r instanceof Promise))
2918
+ return toStandardResult(r, ctx);
2963
2919
  } catch (_) {
2964
- return safeParseAsync(inst, value).then(toStandardResult);
2965
2920
  }
2921
+ return validateAsync2(inst, value);
2966
2922
  },
2967
2923
  vendor: "zod",
2968
2924
  version: 1
@@ -2970,7 +2926,7 @@ function standardProps(inst) {
2970
2926
  }
2971
2927
  var $ZodString = /* @__PURE__ */ $constructor("$ZodString", (inst, def) => {
2972
2928
  $ZodType.init(inst, def);
2973
- inst._zod.pattern = [...inst?._zod.bag?.patterns ?? []].pop() ?? string(inst._zod.bag);
2929
+ inst._zod.pattern = def.pattern ?? anyString;
2974
2930
  inst._zod.parse = (payload, _) => {
2975
2931
  if (def.coerce)
2976
2932
  try {
@@ -3139,12 +3095,6 @@ var $ZodKSUID = /* @__PURE__ */ $constructor("$ZodKSUID", (inst, def) => {
3139
3095
  var $ZodISODateTime = /* @__PURE__ */ $constructor("$ZodISODateTime", (inst, def) => {
3140
3096
  def.pattern ?? (def.pattern = datetime(def));
3141
3097
  $ZodStringFormat.init(inst, def);
3142
- if (def.local || def.precision === -1) {
3143
- inst._zod.bag.laxFormat = true;
3144
- inst._zod.onattach.push((s) => {
3145
- s._zod.bag.laxFormat = true;
3146
- });
3147
- }
3148
3098
  });
3149
3099
  var $ZodISODate = /* @__PURE__ */ $constructor("$ZodISODate", (inst, def) => {
3150
3100
  def.pattern ?? (def.pattern = date);
@@ -3161,7 +3111,6 @@ var $ZodISODuration = /* @__PURE__ */ $constructor("$ZodISODuration", (inst, def
3161
3111
  var $ZodIPv4 = /* @__PURE__ */ $constructor("$ZodIPv4", (inst, def) => {
3162
3112
  def.pattern ?? (def.pattern = ipv4);
3163
3113
  $ZodStringFormat.init(inst, def);
3164
- inst._zod.bag.format = `ipv4`;
3165
3114
  });
3166
3115
  var ipv6Alphabet = /^[0-9a-fA-F:.]+$/;
3167
3116
  function isValidIPv6(value) {
@@ -3177,7 +3126,6 @@ function isValidIPv6(value) {
3177
3126
  var $ZodIPv6 = /* @__PURE__ */ $constructor("$ZodIPv6", (inst, def) => {
3178
3127
  def.pattern ?? (def.pattern = ipv6);
3179
3128
  $ZodStringFormat.init(inst, def);
3180
- inst._zod.bag.format = `ipv6`;
3181
3129
  inst._zod.check = (payload) => {
3182
3130
  if (!isValidIPv6(payload.value)) {
3183
3131
  payload.issues.push({
@@ -3193,7 +3141,6 @@ var $ZodIPv6 = /* @__PURE__ */ $constructor("$ZodIPv6", (inst, def) => {
3193
3141
  var $ZodMAC = /* @__PURE__ */ $constructor("$ZodMAC", (inst, def) => {
3194
3142
  def.pattern ?? (def.pattern = mac(def.delimiter));
3195
3143
  $ZodStringFormat.init(inst, def);
3196
- inst._zod.bag.format = `mac`;
3197
3144
  });
3198
3145
  var $ZodCIDRv4 = /* @__PURE__ */ $constructor("$ZodCIDRv4", (inst, def) => {
3199
3146
  def.pattern ?? (def.pattern = cidrv4);
@@ -3242,10 +3189,10 @@ function isValidBase64(data) {
3242
3189
  return false;
3243
3190
  }
3244
3191
  }
3192
+ var base64Charset = /^[0-9a-zA-Z+/]*={0,2}$/;
3245
3193
  var $ZodBase64 = /* @__PURE__ */ $constructor("$ZodBase64", (inst, def) => {
3246
- def.pattern ?? (def.pattern = base64);
3194
+ def.pattern ?? (def.pattern = base64Charset);
3247
3195
  $ZodStringFormat.init(inst, def);
3248
- inst._zod.bag.contentEncoding = "base64";
3249
3196
  inst._zod.check = (payload) => {
3250
3197
  if (isValidBase64(payload.value))
3251
3198
  return;
@@ -3258,17 +3205,17 @@ var $ZodBase64 = /* @__PURE__ */ $constructor("$ZodBase64", (inst, def) => {
3258
3205
  });
3259
3206
  };
3260
3207
  });
3208
+ var base64urlCharset = /^[A-Za-z0-9_-]*$/;
3261
3209
  function isValidBase64URL(data) {
3262
- if (!base64url.test(data))
3210
+ if (!base64urlCharset.test(data))
3263
3211
  return false;
3264
3212
  const base643 = data.replace(/[-_]/g, (c) => c === "-" ? "+" : "/");
3265
3213
  const padded = base643.padEnd(Math.ceil(base643.length / 4) * 4, "=");
3266
3214
  return isValidBase64(padded);
3267
3215
  }
3268
3216
  var $ZodBase64URL = /* @__PURE__ */ $constructor("$ZodBase64URL", (inst, def) => {
3269
- def.pattern ?? (def.pattern = base64url);
3217
+ def.pattern ?? (def.pattern = base64urlCharset);
3270
3218
  $ZodStringFormat.init(inst, def);
3271
- inst._zod.bag.contentEncoding = "base64url";
3272
3219
  inst._zod.check = (payload) => {
3273
3220
  if (isValidBase64URL(payload.value))
3274
3221
  return;
@@ -3291,7 +3238,7 @@ function isLuhnAlgo(digits) {
3291
3238
  let bit = 1;
3292
3239
  let sum = 0;
3293
3240
  while (length) {
3294
- const value = +digits[--length];
3241
+ const value = digits.charCodeAt(--length) - 48;
3295
3242
  bit ^= 1;
3296
3243
  sum += bit ? [0, 2, 4, 6, 8, 1, 3, 5, 7, 9][value] : value;
3297
3244
  }
@@ -3317,6 +3264,39 @@ var $ZodCreditCard = /* @__PURE__ */ $constructor("$ZodCreditCard", (inst, def)
3317
3264
  });
3318
3265
  };
3319
3266
  });
3267
+ function isIso7064Mod97(iban3) {
3268
+ let remainder = 0;
3269
+ const len = iban3.length;
3270
+ for (let i = 4; i < len; i++) {
3271
+ const code = iban3.charCodeAt(i);
3272
+ remainder = (code >= 65 ? remainder * 100 + (code - 55) : remainder * 10 + (code - 48)) % 97;
3273
+ }
3274
+ for (let i = 0; i < 4; i++) {
3275
+ const code = iban3.charCodeAt(i);
3276
+ remainder = (code >= 65 ? remainder * 100 + (code - 55) : remainder * 10 + (code - 48)) % 97;
3277
+ }
3278
+ return remainder === 1;
3279
+ }
3280
+ function isValidIBAN(input2) {
3281
+ if (!iban.test(input2))
3282
+ return false;
3283
+ return isIso7064Mod97(input2);
3284
+ }
3285
+ var $ZodIBAN = /* @__PURE__ */ $constructor("$ZodIBAN", (inst, def) => {
3286
+ def.pattern ?? (def.pattern = iban);
3287
+ $ZodStringFormat.init(inst, def);
3288
+ inst._zod.check = (payload) => {
3289
+ if (isValidIBAN(payload.value))
3290
+ return;
3291
+ payload.issues.push({
3292
+ code: "invalid_format",
3293
+ format: "iban",
3294
+ input: payload.value,
3295
+ inst,
3296
+ continue: !def.abort
3297
+ });
3298
+ };
3299
+ });
3320
3300
  function isValidJWT(token, algorithm = null) {
3321
3301
  try {
3322
3302
  const tokensParts = token.split(".");
@@ -3367,7 +3347,7 @@ var $ZodCustomStringFormat = /* @__PURE__ */ $constructor("$ZodCustomStringForma
3367
3347
  });
3368
3348
  var $ZodNumber = /* @__PURE__ */ $constructor("$ZodNumber", (inst, def) => {
3369
3349
  $ZodType.init(inst, def);
3370
- inst._zod.pattern = inst._zod.bag.pattern ?? number;
3350
+ inst._zod.pattern = number;
3371
3351
  inst._zod.parse = (payload, _ctx) => {
3372
3352
  if (def.coerce)
3373
3353
  try {
@@ -3569,6 +3549,7 @@ var $ZodArray = /* @__PURE__ */ $constructor("$ZodArray", (inst, def) => {
3569
3549
  }
3570
3550
  payload.value = memo2 ? memo2.alloc(inst, payload, Array(input2.length), ctx) : Array(input2.length);
3571
3551
  const proms = [];
3552
+ const abortEarly = ctx?.abortEarly;
3572
3553
  for (let i = 0; i < input2.length; i++) {
3573
3554
  const item = input2[i];
3574
3555
  const result = def.element._zod.run({
@@ -3579,6 +3560,8 @@ var $ZodArray = /* @__PURE__ */ $constructor("$ZodArray", (inst, def) => {
3579
3560
  proms.push(result.then((result2) => handleArrayResult(result2, payload, i)));
3580
3561
  } else {
3581
3562
  handleArrayResult(result, payload, i);
3563
+ if (abortEarly && result.issues.length !== 0 && aborted(result))
3564
+ break;
3582
3565
  }
3583
3566
  }
3584
3567
  if (proms.length) {
@@ -3640,14 +3623,20 @@ function normalizeDef(def) {
3640
3623
  optionalKeys: new Set(okeys)
3641
3624
  };
3642
3625
  }
3643
- function handleCatchall(proms, input2, payload, ctx, def, inst) {
3626
+ function handleCatchall(proms, input2, payload, ctx, def, inst, abortEarly) {
3644
3627
  const unrecognized = [];
3645
3628
  const keySet = def.keySet;
3646
3629
  const _catchall = def.catchall._zod;
3647
3630
  const t = _catchall.def.type;
3648
3631
  const optin = _catchall.optin;
3649
3632
  const optout = _catchall.optout;
3633
+ let seen = 0;
3650
3634
  for (const key in input2) {
3635
+ if (abortEarly && payload.issues.length !== seen) {
3636
+ if (aborted(payload, seen))
3637
+ break;
3638
+ seen = payload.issues.length;
3639
+ }
3651
3640
  if (keySet.has(key))
3652
3641
  continue;
3653
3642
  if (key === "__proto__") {
@@ -3682,23 +3671,19 @@ function handleCatchall(proms, input2, payload, ctx, def, inst) {
3682
3671
  return payload;
3683
3672
  });
3684
3673
  }
3685
- var propShapes = /* @__PURE__ */ new WeakMap();
3686
3674
  var $ZodObject = /* @__PURE__ */ $constructor("$ZodObject", (inst, def) => {
3687
3675
  $ZodType.init(inst, def);
3688
3676
  const desc = Object.getOwnPropertyDescriptor(def, "shape");
3689
- if (!desc?.get) {
3690
- const sh = def.shape;
3691
- propShapes.set(def, sh);
3692
- Object.defineProperty(def, "shape", {
3693
- get: () => {
3694
- const newSh = { ...sh };
3695
- Object.defineProperty(def, "shape", {
3696
- value: newSh
3697
- });
3698
- propShapes.set(def, newSh);
3699
- return newSh;
3700
- }
3701
- });
3677
+ const sh = desc?.get ? desc.get.raw : def.shape ?? {};
3678
+ if (sh) {
3679
+ const get = () => {
3680
+ const newSh = { ...sh };
3681
+ Object.defineProperty(def, "shape", { value: newSh });
3682
+ get.raw = newSh;
3683
+ return newSh;
3684
+ };
3685
+ get.raw = sh;
3686
+ Object.defineProperty(def, "shape", { get });
3702
3687
  }
3703
3688
  const _normalized = cached(() => normalizeDef(def));
3704
3689
  defineLazyInternal(inst, "propValues", (zod) => {
@@ -3738,7 +3723,14 @@ var $ZodObject = /* @__PURE__ */ $constructor("$ZodObject", (inst, def) => {
3738
3723
  payload.value = memo2 ? memo2.alloc(inst, payload, {}, ctx) : {};
3739
3724
  const proms = [];
3740
3725
  const shape = value.shape;
3726
+ const abortEarly = ctx?.abortEarly;
3727
+ let seen = payload.issues.length;
3741
3728
  for (const key of value.allKeys) {
3729
+ if (abortEarly && payload.issues.length !== seen) {
3730
+ if (aborted(payload, seen))
3731
+ break;
3732
+ seen = payload.issues.length;
3733
+ }
3742
3734
  if (key === "__proto__")
3743
3735
  continue;
3744
3736
  const el = shape[key];
@@ -3754,7 +3746,7 @@ var $ZodObject = /* @__PURE__ */ $constructor("$ZodObject", (inst, def) => {
3754
3746
  if (!catchall) {
3755
3747
  return proms.length ? Promise.all(proms).then(() => payload) : payload;
3756
3748
  }
3757
- return handleCatchall(proms, input2, payload, ctx, _normalized.value, inst);
3749
+ return handleCatchall(proms, input2, payload, ctx, _normalized.value, inst, abortEarly === true);
3758
3750
  };
3759
3751
  });
3760
3752
  var $ZodObjectJIT = /* @__PURE__ */ $constructor("$ZodObjectJIT", (inst, def) => {
@@ -3768,10 +3760,16 @@ var $ZodObjectJIT = /* @__PURE__ */ $constructor("$ZodObjectJIT", (inst, def) =>
3768
3760
  const doc = new Doc(["payload", "ctx"], { shape, inst, memo: memo2, syms });
3769
3761
  const parseStr = (k) => `shape[${k}]._zod.run({ value: input[${k}], issues: [] }, ctx)`;
3770
3762
  const prefixStr = (id, k) => `
3763
+ let ${id}_ab = false;
3771
3764
  for (let i = 0; i < ${id}.issues.length; i++) {
3772
3765
  const iss = ${id}.issues[i];
3773
3766
  iss.path = iss.path ? [${k}, ...iss.path] : [${k}];
3774
3767
  payload.issues.push(iss);
3768
+ if (iss.continue !== true) ${id}_ab = true;
3769
+ }
3770
+ if (${id}_ab && ctx && ctx.abortEarly) {
3771
+ payload.value = newResult;
3772
+ return payload;
3775
3773
  }`;
3776
3774
  doc.write(`const input = payload.value;`);
3777
3775
  const ids = /* @__PURE__ */ Object.create(null);
@@ -3817,6 +3815,10 @@ var $ZodObjectJIT = /* @__PURE__ */ $constructor("$ZodObjectJIT", (inst, def) =>
3817
3815
  input: undefined,
3818
3816
  path: [${k}]
3819
3817
  });
3818
+ if (ctx && ctx.abortEarly) {
3819
+ payload.value = newResult;
3820
+ return payload;
3821
+ }
3820
3822
  }
3821
3823
 
3822
3824
  if (${id}_present) {
@@ -3869,7 +3871,7 @@ var $ZodObjectJIT = /* @__PURE__ */ $constructor("$ZodObjectJIT", (inst, def) =>
3869
3871
  payload = fastpass(payload, ctx);
3870
3872
  if (!catchall)
3871
3873
  return payload;
3872
- return handleCatchall([], input2, payload, ctx, value, inst);
3874
+ return handleCatchall([], input2, payload, ctx, value, inst, ctx?.abortEarly === true);
3873
3875
  }
3874
3876
  return superParse(payload, ctx);
3875
3877
  };
@@ -4034,7 +4036,7 @@ var $ZodDiscriminatedUnion = /* @__PURE__ */ $constructor("$ZodDiscriminatedUnio
4034
4036
  return propValues;
4035
4037
  });
4036
4038
  def.options.forEach((option, i) => {
4037
- const propShape = propShapes.get(option._zod.def);
4039
+ const propShape = rawShape(option._zod.def);
4038
4040
  if (propShape && !Object.prototype.hasOwnProperty.call(propShape, def.discriminator)) {
4039
4041
  throw new Error(`Invalid discriminated union option at index "${i}"`);
4040
4042
  }
@@ -4244,6 +4246,8 @@ var $ZodTuple = /* @__PURE__ */ $constructor("$ZodTuple", (inst, def) => {
4244
4246
  }
4245
4247
  }
4246
4248
  const itemResults = new Array(items.length);
4249
+ const abortEarly = def.rest ? ctx?.abortEarly : void 0;
4250
+ let itemAborted = false;
4247
4251
  for (let i = 0; i < items.length; i++) {
4248
4252
  const r = items[i]._zod.run({ value: input2[i], issues: [] }, ctx);
4249
4253
  if (r instanceof Promise) {
@@ -4252,12 +4256,20 @@ var $ZodTuple = /* @__PURE__ */ $constructor("$ZodTuple", (inst, def) => {
4252
4256
  }));
4253
4257
  } else {
4254
4258
  itemResults[i] = r;
4259
+ if (abortEarly && !itemAborted && r.issues.length)
4260
+ itemAborted = aborted(r);
4255
4261
  }
4256
4262
  }
4257
- if (def.rest) {
4263
+ if (def.rest && !itemAborted) {
4258
4264
  let i = items.length - 1;
4259
4265
  const rest = input2.slice(items.length);
4266
+ let seen = payload.issues.length;
4260
4267
  for (const el of rest) {
4268
+ if (abortEarly && payload.issues.length !== seen) {
4269
+ if (aborted(payload, seen))
4270
+ break;
4271
+ seen = payload.issues.length;
4272
+ }
4261
4273
  i++;
4262
4274
  const result = def.rest._zod.run({ value: el, issues: [] }, ctx);
4263
4275
  if (result instanceof Promise) {
@@ -4485,7 +4497,14 @@ var $ZodMap = /* @__PURE__ */ $constructor("$ZodMap", (inst, def) => {
4485
4497
  }
4486
4498
  const proms = [];
4487
4499
  payload.value = memo2 ? memo2.alloc(inst, payload, /* @__PURE__ */ new Map(), ctx) : /* @__PURE__ */ new Map();
4500
+ const abortEarly = ctx?.abortEarly;
4501
+ let seen = payload.issues.length;
4488
4502
  for (const [key, value] of input2) {
4503
+ if (abortEarly && payload.issues.length !== seen) {
4504
+ if (aborted(payload, seen))
4505
+ break;
4506
+ seen = payload.issues.length;
4507
+ }
4489
4508
  const keyResult = def.keyType._zod.run({ value: key, issues: [] }, ctx);
4490
4509
  const valueResult = def.valueType._zod.run({ value, issues: [] }, ctx);
4491
4510
  if (keyResult instanceof Promise || valueResult instanceof Promise) {
@@ -4548,7 +4567,14 @@ var $ZodSet = /* @__PURE__ */ $constructor("$ZodSet", (inst, def) => {
4548
4567
  }
4549
4568
  const proms = [];
4550
4569
  payload.value = memo2 ? memo2.alloc(inst, payload, /* @__PURE__ */ new Set(), ctx) : /* @__PURE__ */ new Set();
4570
+ const abortEarly = ctx?.abortEarly;
4571
+ let seen = payload.issues.length;
4551
4572
  for (const item of input2) {
4573
+ if (abortEarly && payload.issues.length !== seen) {
4574
+ if (aborted(payload, seen))
4575
+ break;
4576
+ seen = payload.issues.length;
4577
+ }
4552
4578
  const result = def.valueType._zod.run({ value: item, issues: [] }, ctx);
4553
4579
  if (result instanceof Promise) {
4554
4580
  proms.push(result.then((result2) => handleSetResult(result2, payload)));
@@ -4571,8 +4597,10 @@ var $ZodEnum = /* @__PURE__ */ $constructor("$ZodEnum", (inst, def) => {
4571
4597
  const values = getEnumValues(def.entries);
4572
4598
  const valuesSet = new Set(values);
4573
4599
  inst._zod.values = valuesSet;
4574
- const patternValues = values.filter((k) => propertyKeyTypes.has(typeof k));
4575
- inst._zod.pattern = new RegExp(patternValues.length ? `^(${patternValues.map((o) => escapeRegex(o.toString())).join("|")})$` : "^[^\\s\\S]$");
4600
+ defineLazyInternal(inst, "pattern", (zod) => {
4601
+ const patternValues = getEnumValues(zod.def.entries).filter((k) => propertyKeyTypes.has(typeof k));
4602
+ return new RegExp(patternValues.length ? `^(${patternValues.map((o) => escapeRegex(o.toString())).join("|")})$` : "^[^\\s\\S]$");
4603
+ });
4576
4604
  inst._zod.parse = (payload, _ctx) => {
4577
4605
  const input2 = payload.value;
4578
4606
  if (valuesSet.has(input2)) {
@@ -4591,7 +4619,10 @@ var $ZodLiteral = /* @__PURE__ */ $constructor("$ZodLiteral", (inst, def) => {
4591
4619
  $ZodType.init(inst, def);
4592
4620
  const values = new Set(def.values);
4593
4621
  inst._zod.values = values;
4594
- 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]$");
4622
+ defineLazyInternal(inst, "pattern", (zod) => {
4623
+ const vals = zod.def.values;
4624
+ return new RegExp(vals.length ? `^(${vals.map((o) => typeof o === "string" ? escapeRegex(o) : o ? escapeRegex(o.toString()) : String(o)).join("|")})$` : "^[^\\s\\S]$");
4625
+ });
4595
4626
  inst._zod.parse = (payload, _ctx) => {
4596
4627
  const input2 = payload.value;
4597
4628
  if (values.has(input2)) {
@@ -4929,20 +4960,62 @@ function handleReadonlyResult(payload) {
4929
4960
  payload.value = Object.freeze(payload.value);
4930
4961
  return payload;
4931
4962
  }
4963
+ function leafPattern(schema) {
4964
+ const def = schema._zod.def;
4965
+ let pattern = def.pattern;
4966
+ let isInt = !!def.format?.includes("int");
4967
+ let minimum;
4968
+ let maximum;
4969
+ for (const ch of def.checks ?? []) {
4970
+ const d = ch._zod.def;
4971
+ if (d.pattern)
4972
+ pattern = d.pattern;
4973
+ isInt || (isInt = !!d.format?.includes("int"));
4974
+ const lo = d.minimum ?? d.length;
4975
+ const hi = d.maximum ?? d.length;
4976
+ if (lo !== void 0 && (minimum === void 0 || lo > minimum))
4977
+ minimum = lo;
4978
+ if (hi !== void 0 && (maximum === void 0 || hi < maximum))
4979
+ maximum = hi;
4980
+ }
4981
+ if (pattern)
4982
+ return pattern.source;
4983
+ if (minimum !== void 0 && maximum !== void 0 && minimum > maximum)
4984
+ return "(?!)";
4985
+ if (minimum !== void 0 || maximum !== void 0)
4986
+ return string({ minimum, maximum }).source;
4987
+ const own2 = schema._zod.pattern;
4988
+ return (isInt && own2 === number ? integer : own2)?.source;
4989
+ }
4990
+ function partPattern(schema) {
4991
+ const def = schema._zod.def;
4992
+ const own2 = schema._zod.pattern?.source;
4993
+ const inner = def.innerType ?? schema._zod.innerType;
4994
+ if (inner) {
4995
+ const before = inner._zod.pattern?.source;
4996
+ const after = partPattern(inner);
4997
+ if (own2 && before && after && after !== before) {
4998
+ return own2.replace(cleanRegex(before), () => cleanRegex(after));
4999
+ }
5000
+ return own2;
5001
+ }
5002
+ if (def.options) {
5003
+ const sources = def.options.map(partPattern);
5004
+ if (sources.every(Boolean))
5005
+ return `^(${sources.map((s) => cleanRegex(s)).join("|")})$`;
5006
+ }
5007
+ return leafPattern(schema);
5008
+ }
4932
5009
  var $ZodTemplateLiteral = /* @__PURE__ */ $constructor("$ZodTemplateLiteral", (inst, def) => {
4933
5010
  $ZodType.init(inst, def);
4934
5011
  const regexParts = [];
4935
5012
  for (const part of def.parts) {
4936
5013
  if (typeof part === "object" && part !== null) {
4937
- if (!part._zod.pattern) {
5014
+ const source = partPattern(part);
5015
+ if (!source) {
4938
5016
  throw new Error(`Invalid template literal part, no pattern found: ${[...part._zod.traits].shift()}`);
4939
5017
  }
4940
- const source = part._zod.pattern instanceof RegExp ? part._zod.pattern.source : part._zod.pattern;
4941
- if (!source)
4942
- throw new Error(`Invalid template literal part: ${part._zod.traits}`);
4943
- const start = source.startsWith("^") ? 1 : 0;
4944
- const end = source.endsWith("$") ? source.length - 1 : source.length;
4945
- regexParts.push(source.slice(start, end));
5018
+ regexParts.push(cleanRegex(source));
4946
5019
  } else if (part === null || primitiveTypes.has(typeof part)) {
4947
5020
  regexParts.push(escapeRegex(`${part}`));
4948
5021
  } else {
@@ -5107,6 +5180,59 @@ function handleRefineResult(result, payload, input2, inst) {
5107
5180
  payload.issues.push(issue(_iss));
5108
5181
  }
5109
5182
  }
5183
+ function handlePropertiesResult(result, payload, key) {
5184
+ if (result.issues.length) {
5185
+ payload.issues.push(...prefixIssues(key, result.issues));
5186
+ }
5187
+ }
5188
+ var $ZodProperties = /* @__PURE__ */ $constructor("$ZodProperties", (inst, def) => {
5189
+ $ZodType.init(inst, def);
5190
+ $ZodCheck.init(inst, def);
5191
+ const memo2 = globalConfig.memoizer;
5192
+ memo2?.attach(inst);
5193
+ let entries;
5194
+ const runShape = (payload, ctx) => {
5195
+ entries ?? (entries = Reflect.ownKeys(def.shape).map((key) => [key, def.shape[key]]));
5196
+ const input2 = payload.value;
5197
+ let proms;
5198
+ for (const [key, schema] of entries) {
5199
+ const result = schema._zod.run({ value: input2[key], issues: [] }, ctx);
5200
+ if (result instanceof Promise) {
5201
+ proms ?? (proms = []);
5202
+ proms.push(result.then((result2) => handlePropertiesResult(result2, payload, key)));
5203
+ } else {
5204
+ handlePropertiesResult(result, payload, key);
5205
+ }
5206
+ }
5207
+ if (proms)
5208
+ return Promise.all(proms).then(() => void 0);
5209
+ return void 0;
5210
+ };
5211
+ inst._zod.parse = (payload, ctx) => {
5212
+ const input2 = payload.value;
5213
+ if (input2 === null || typeof input2 !== "object" && typeof input2 !== "function") {
5214
+ payload.issues.push({ expected: "object", code: "invalid_type", input: input2, inst });
5215
+ return payload;
5216
+ }
5217
+ if (ctx.direction === "backward")
5218
+ ctx = { ...ctx, direction: "forward" };
5219
+ if (memo2)
5220
+ memo2.alloc(inst, payload, input2, ctx);
5221
+ const result = runShape(payload, ctx);
5222
+ return result instanceof Promise ? result.then(() => payload) : payload;
5223
+ };
5224
+ inst._zod.check = (payload) => {
5225
+ if (payload.value == null) {
5226
+ payload.issues.push({ expected: "object", code: "invalid_type", input: payload.value, inst });
5227
+ return void 0;
5228
+ }
5229
+ return runShape(payload, {});
5230
+ };
5231
+ }, {
5232
+ *[Symbol.iterator]() {
5233
+ yield this;
5234
+ }
5235
+ });
5110
5236
 
5111
5237
  // ../../node_modules/zod/v4/core/memoizer.js
5112
5238
  var $ZodCyclicError = class extends Error {
@@ -5117,31 +5243,59 @@ var $ZodCyclicError = class extends Error {
5117
5243
  };
5118
5244
  var STATE = "~memo";
5119
5245
  var NO_ISSUES = [];
5246
+ function isRef(value) {
5247
+ return value !== null && (typeof value === "object" || typeof value === "function");
5248
+ }
5120
5249
  function cloneIssues(issues) {
5121
5250
  return issues.map((iss) => iss.path ? { ...iss, path: iss.path.slice() } : { ...iss });
5122
5251
  }
5123
5252
  var recursive = /* @__PURE__ */ new WeakMap();
5124
- function isRecursive(inst, stack) {
5253
+ var NONE = 0;
5254
+ var ASSUMED = 1;
5255
+ var PROVEN = 2;
5256
+ function isRecursive(inst, stack, resolve) {
5125
5257
  const cached2 = recursive.get(inst);
5126
5258
  if (cached2 !== void 0)
5127
- return cached2;
5259
+ return cached2 ? PROVEN : NONE;
5128
5260
  if (stack.has(inst))
5129
- return true;
5261
+ return PROVEN;
5130
5262
  stack.add(inst);
5131
- let result = false;
5263
+ let result = NONE;
5132
5264
  const check2 = (child) => {
5133
- if (!result && child?._zod && isRecursive(child, stack))
5134
- result = true;
5265
+ if (result !== PROVEN && child?._zod) {
5266
+ const answer = isRecursive(child, stack, resolve);
5267
+ if (answer > result)
5268
+ result = answer;
5269
+ }
5270
+ };
5271
+ const shape = (sh, spread) => {
5272
+ let answer = NONE;
5273
+ for (const key of Reflect.ownKeys(sh)) {
5274
+ const desc = Object.getOwnPropertyDescriptor(sh, key);
5275
+ if (spread && !desc.enumerable)
5276
+ continue;
5277
+ const child = desc.get ? ASSUMED : desc.value?._zod ? isRecursive(desc.value, stack, resolve) : NONE;
5278
+ if (child > answer)
5279
+ answer = child;
5280
+ }
5281
+ return answer;
5282
+ };
5283
+ const merge2 = (answer) => {
5284
+ if (answer > result)
5285
+ result = answer;
5135
5286
  };
5136
5287
  const def = inst._zod.def;
5137
5288
  const kind = def.type;
5138
5289
  switch (kind) {
5139
5290
  case "object": {
5140
- for (const key of Reflect.ownKeys(def.shape))
5141
- check2(def.shape[key]);
5291
+ const raw = rawShape(def);
5292
+ merge2(raw ? shape(raw, true) : ASSUMED);
5142
5293
  check2(def.catchall);
5143
5294
  break;
5144
5295
  }
5296
+ case "properties":
5297
+ merge2(shape(def.shape, false));
5298
+ break;
5145
5299
  case "array":
5146
5300
  check2(def.element);
5147
5301
  break;
@@ -5185,10 +5339,12 @@ function isRecursive(inst, stack) {
5185
5339
  check2(def.input);
5186
5340
  check2(def.output);
5187
5341
  break;
5188
- // reading `_zod.innerType` resolves the getter once and caches it
5189
- case "lazy":
5190
- check2(inst._zod.innerType);
5342
+ // `$ZodLazy` caches its inner on the def, so a resolved edge is followed exactly
5343
+ case "lazy": {
5344
+ const inner = def._cachedInner ?? (resolve ? inst._zod.innerType : void 0);
5345
+ merge2(inner ? isRecursive(inner, stack, false) : ASSUMED);
5191
5346
  break;
5347
+ }
5192
5348
  // a leaf by choice: `parts` are regex fragments, not data positions
5193
5349
  case "template_literal":
5194
5350
  // leaves
@@ -5230,16 +5386,20 @@ function isRecursive(inst, stack) {
5230
5386
  }
5231
5387
  }
5232
5388
  stack.delete(inst);
5233
- recursive.set(inst, result);
5234
- return result;
5389
+ return settle(inst, result);
5390
+ }
5391
+ function settle(inst, answer) {
5392
+ if (answer !== ASSUMED)
5393
+ recursive.set(inst, answer === PROVEN);
5394
+ return answer;
5235
5395
  }
5236
5396
  function isRecursiveSchema(inst) {
5237
- return isRecursive(inst, /* @__PURE__ */ new Set());
5397
+ return isRecursive(inst, /* @__PURE__ */ new Set(), true) !== NONE;
5238
5398
  }
5239
5399
  function bucketFor(state, inst) {
5240
5400
  let bucket = state.buckets.get(inst);
5241
5401
  if (!bucket) {
5242
- bucket = /* @__PURE__ */ new Map();
5402
+ bucket = /* @__PURE__ */ new WeakMap();
5243
5403
  state.buckets.set(inst, bucket);
5244
5404
  }
5245
5405
  return bucket;
@@ -5275,6 +5435,7 @@ var memo = {
5275
5435
  attach(inst) {
5276
5436
  var _a3;
5277
5437
  let isRecursiveInst;
5438
+ let rechecked = false;
5278
5439
  let lastCtx;
5279
5440
  let lastBucket;
5280
5441
  (_a3 = inst._zod).deferred ?? (_a3.deferred = []);
@@ -5282,20 +5443,24 @@ var memo = {
5282
5443
  const base = inst._zod.parse;
5283
5444
  const wrapped = (payload, ctx) => {
5284
5445
  if (isRecursiveInst === void 0) {
5285
- isRecursiveInst = isRecursive(inst, /* @__PURE__ */ new Set());
5286
- if (!isRecursiveInst) {
5446
+ const walked = isRecursive(inst, /* @__PURE__ */ new Set(), false);
5447
+ if (walked === NONE) {
5287
5448
  inst._zod.parse = base;
5288
5449
  if (inst._zod.run === wrapped)
5289
5450
  inst._zod.run = base;
5290
5451
  return base(payload, ctx);
5291
5452
  }
5453
+ if (walked === PROVEN || rechecked)
5454
+ isRecursiveInst = true;
5455
+ else
5456
+ rechecked = true;
5292
5457
  }
5293
5458
  const input2 = payload.value;
5294
- if (input2 === null || typeof input2 !== "object")
5459
+ if (!isRef(input2))
5295
5460
  return base(payload, ctx);
5296
5461
  let state = ctx[STATE];
5297
5462
  if (!state) {
5298
- state = { buckets: /* @__PURE__ */ new Map(), backEdges: void 0 };
5463
+ state = { buckets: /* @__PURE__ */ new WeakMap(), backEdges: void 0 };
5299
5464
  ctx[STATE] = state;
5300
5465
  }
5301
5466
  let bucket;
@@ -5314,7 +5479,7 @@ var memo = {
5314
5479
  payload.issues.push(...cloneIssues(hit.issues));
5315
5480
  } else {
5316
5481
  payload.memo = true;
5317
- state.backEdges ?? (state.backEdges = /* @__PURE__ */ new Set());
5482
+ state.backEdges ?? (state.backEdges = /* @__PURE__ */ new WeakSet());
5318
5483
  state.backEdges.add(hit.value);
5319
5484
  }
5320
5485
  return payload;
@@ -5346,7 +5511,7 @@ function memoizer() {
5346
5511
  }
5347
5512
  function isBackEdge(ctx, value) {
5348
5513
  const backEdges = ctx[STATE]?.backEdges;
5349
- return backEdges !== void 0 && value !== null && typeof value === "object" && backEdges.has(value);
5514
+ return backEdges !== void 0 && isRef(value) && backEdges.has(value);
5350
5515
  }
5351
5516
 
5352
5517
  // ../../node_modules/zod/v4/locales/index.js
@@ -5457,6 +5622,7 @@ var error = () => {
5457
5622
  json_string: "\u0646\u064E\u0635 \u0639\u0644\u0649 \u0647\u064A\u0626\u0629 JSON",
5458
5623
  e164: "\u0631\u0642\u0645 \u0647\u0627\u062A\u0641 \u0628\u0645\u0639\u064A\u0627\u0631 E.164",
5459
5624
  credit_card: "\u0631\u0642\u0645 \u0628\u0637\u0627\u0642\u0629 \u0627\u0644\u0627\u0626\u062A\u0645\u0627\u0646",
5625
+ iban: "IBAN",
5460
5626
  jwt: "JWT",
5461
5627
  template_literal: "\u0645\u062F\u062E\u0644"
5462
5628
  };
@@ -5567,6 +5733,7 @@ var error2 = () => {
5567
5733
  json_string: "JSON string",
5568
5734
  e164: "E.164 number",
5569
5735
  credit_card: "kredit kart\u0131 n\xF6mr\u0259si",
5736
+ iban: "IBAN",
5570
5737
  jwt: "JWT",
5571
5738
  template_literal: "input"
5572
5739
  };
@@ -5726,6 +5893,7 @@ var error3 = () => {
5726
5893
  json_string: "JSON \u0440\u0430\u0434\u043E\u043A",
5727
5894
  e164: "\u043D\u0443\u043C\u0430\u0440 E.164",
5728
5895
  credit_card: "\u043D\u0443\u043C\u0430\u0440 \u043A\u0440\u044D\u0434\u044B\u0442\u043D\u0430\u0439 \u043A\u0430\u0440\u0442\u044B",
5896
+ iban: "IBAN",
5729
5897
  jwt: "JWT",
5730
5898
  template_literal: "\u0443\u0432\u043E\u0434"
5731
5899
  };
@@ -5843,6 +6011,7 @@ var error4 = () => {
5843
6011
  json_string: "JSON \u043D\u0438\u0437",
5844
6012
  e164: "E.164 \u043D\u043E\u043C\u0435\u0440",
5845
6013
  credit_card: "\u043D\u043E\u043C\u0435\u0440 \u043D\u0430 \u043A\u0440\u0435\u0434\u0438\u0442\u043D\u0430 \u043A\u0430\u0440\u0442\u0430",
6014
+ iban: "IBAN",
5846
6015
  jwt: "JWT",
5847
6016
  template_literal: "\u0432\u0445\u043E\u0434"
5848
6017
  };
@@ -5967,6 +6136,7 @@ var error5 = () => {
5967
6136
  json_string: "JSON \u09B8\u09CD\u099F\u09CD\u09B0\u09BF\u0982",
5968
6137
  e164: "E.164 \u09A8\u09AE\u09CD\u09AC\u09B0",
5969
6138
  credit_card: "\u0995\u09CD\u09B0\u09C7\u09A1\u09BF\u099F \u0995\u09BE\u09B0\u09CD\u09A1 \u09A8\u09AE\u09CD\u09AC\u09B0",
6139
+ iban: "IBAN",
5970
6140
  jwt: "JWT",
5971
6141
  template_literal: "\u0987\u09A8\u09AA\u09C1\u099F"
5972
6142
  };
@@ -6079,6 +6249,7 @@ var error6 = () => {
6079
6249
  json_string: "cadena JSON",
6080
6250
  e164: "n\xFAmero E.164",
6081
6251
  credit_card: "n\xFAmero de targeta de cr\xE8dit",
6252
+ iban: "IBAN",
6082
6253
  jwt: "JWT",
6083
6254
  template_literal: "entrada"
6084
6255
  };
@@ -6191,6 +6362,7 @@ var error7 = () => {
6191
6362
  json_string: "\u062F\u06D5\u0642\u06CC JSON",
6192
6363
  e164: "\u0698\u0645\u0627\u0631\u06D5\u06CC E.164",
6193
6364
  credit_card: "\u0698\u0645\u0627\u0631\u06D5\u06CC \u06A9\u0627\u0631\u062A\u06CC \u06A9\u0631\u06CE\u062F\u06CC\u062A",
6365
+ iban: "IBAN",
6194
6366
  jwt: "JWT",
6195
6367
  template_literal: "\u062A\u06CE\u06A9\u0631\u062F\u06D5"
6196
6368
  };
@@ -6322,6 +6494,7 @@ var error8 = () => {
6322
6494
  json_string: "\u0159et\u011Bzec ve form\xE1tu JSON",
6323
6495
  e164: "\u010D\xEDslo E.164",
6324
6496
  credit_card: "\u010D\xEDslo kreditn\xED karty",
6497
+ iban: "IBAN",
6325
6498
  jwt: "JWT",
6326
6499
  template_literal: "vstup"
6327
6500
  };
@@ -6437,6 +6610,7 @@ var error9 = () => {
6437
6610
  json_string: "JSON-streng",
6438
6611
  e164: "E.164-nummer",
6439
6612
  credit_card: "kreditkortnummer",
6613
+ iban: "IBAN",
6440
6614
  jwt: "JWT",
6441
6615
  template_literal: "input"
6442
6616
  };
@@ -6556,6 +6730,7 @@ var error10 = () => {
6556
6730
  json_string: "JSON-String",
6557
6731
  e164: "E.164-Nummer",
6558
6732
  credit_card: "Kreditkartennummer",
6733
+ iban: "IBAN",
6559
6734
  jwt: "JWT",
6560
6735
  template_literal: "Eingabe"
6561
6736
  };
@@ -6668,6 +6843,7 @@ var error11 = () => {
6668
6843
  json_string: "\u03C3\u03C5\u03BC\u03B2\u03BF\u03BB\u03BF\u03C3\u03B5\u03B9\u03C1\u03AC JSON",
6669
6844
  e164: "\u03B1\u03C1\u03B9\u03B8\u03BC\u03CC\u03C2 E.164",
6670
6845
  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",
6846
+ iban: "IBAN",
6671
6847
  jwt: "JWT",
6672
6848
  template_literal: "\u03B5\u03AF\u03C3\u03BF\u03B4\u03BF\u03C2"
6673
6849
  };
@@ -6779,6 +6955,7 @@ var error12 = () => {
6779
6955
  json_string: "JSON string",
6780
6956
  e164: "E.164 number",
6781
6957
  credit_card: "credit card number",
6958
+ iban: "IBAN",
6782
6959
  jwt: "JWT",
6783
6960
  template_literal: "input"
6784
6961
  };
@@ -6902,6 +7079,7 @@ var error13 = () => {
6902
7079
  json_string: "JSON-karaktraro",
6903
7080
  e164: "E.164-nombro",
6904
7081
  credit_card: "kreditkarta numero",
7082
+ iban: "IBAN",
6905
7083
  jwt: "JWT",
6906
7084
  template_literal: "enigo"
6907
7085
  };
@@ -7014,6 +7192,7 @@ var error14 = () => {
7014
7192
  json_string: "cadena JSON",
7015
7193
  e164: "n\xFAmero E.164",
7016
7194
  credit_card: "n\xFAmero de tarjeta de cr\xE9dito",
7195
+ iban: "IBAN",
7017
7196
  jwt: "JWT",
7018
7197
  template_literal: "entrada"
7019
7198
  };
@@ -7150,6 +7329,7 @@ var error15 = () => {
7150
7329
  json_string: "JSON \u0631\u0634\u062A\u0647",
7151
7330
  e164: "E.164 \u0639\u062F\u062F",
7152
7331
  credit_card: "\u0634\u0645\u0627\u0631\u0647 \u06A9\u0627\u0631\u062A \u0627\u0639\u062A\u0628\u0627\u0631\u06CC",
7332
+ iban: "IBAN",
7153
7333
  jwt: "JWT",
7154
7334
  template_literal: "\u0648\u0631\u0648\u062F\u06CC"
7155
7335
  };
@@ -7272,6 +7452,7 @@ var error16 = () => {
7272
7452
  json_string: "JSON-merkkijono",
7273
7453
  e164: "E.164-luku",
7274
7454
  credit_card: "luottokortin numero",
7455
+ iban: "IBAN",
7275
7456
  jwt: "JWT",
7276
7457
  template_literal: "templaattimerkkijono"
7277
7458
  };
@@ -7383,6 +7564,7 @@ var error17 = () => {
7383
7564
  json_string: "cha\xEEne de caract\xE8res JSON",
7384
7565
  e164: "num\xE9ro au format E.164",
7385
7566
  credit_card: "num\xE9ro de carte de cr\xE9dit",
7567
+ iban: "IBAN",
7386
7568
  jwt: "JWT",
7387
7569
  template_literal: "entr\xE9e"
7388
7570
  };
@@ -7512,6 +7694,7 @@ var error18 = () => {
7512
7694
  json_string: "cha\xEEne JSON",
7513
7695
  e164: "num\xE9ro E.164",
7514
7696
  credit_card: "num\xE9ro de carte de cr\xE9dit",
7697
+ iban: "IBAN",
7515
7698
  jwt: "JWT",
7516
7699
  template_literal: "entr\xE9e"
7517
7700
  };
@@ -7623,6 +7806,7 @@ var error19 = () => {
7623
7806
  json_string: "JSON \u0AB8\u0ACD\u0A9F\u0ACD\u0AB0\u0ABF\u0A82\u0A97",
7624
7807
  e164: "E.164 \u0AA8\u0A82\u0AAC\u0AB0",
7625
7808
  credit_card: "\u0A95\u0ACD\u0AB0\u0AC7\u0AA1\u0ABF\u0A9F \u0A95\u0ABE\u0AB0\u0ACD\u0AA1 \u0AA8\u0A82\u0AAC\u0AB0",
7809
+ iban: "IBAN",
7626
7810
  jwt: "JWT",
7627
7811
  template_literal: "\u0A87\u0AA8\u0AAA\u0AC1\u0A9F"
7628
7812
  };
@@ -7771,6 +7955,7 @@ var error20 = () => {
7771
7955
  json_string: { label: "\u05DE\u05D7\u05E8\u05D5\u05D6\u05EA JSON", gender: "f" },
7772
7956
  e164: { label: "\u05DE\u05E1\u05E4\u05E8 E.164", gender: "m" },
7773
7957
  credit_card: { label: "\u05DE\u05E1\u05E4\u05E8 \u05DB\u05E8\u05D8\u05D9\u05E1 \u05D0\u05E9\u05E8\u05D0\u05D9", gender: "m" },
7958
+ iban: { label: "IBAN", gender: "m" },
7774
7959
  jwt: { label: "JWT", gender: "m" },
7775
7960
  template_literal: { label: "\u05E7\u05DC\u05D8", gender: "m" },
7776
7961
  ends_with: { label: "\u05E7\u05DC\u05D8", gender: "m" },
@@ -7935,6 +8120,7 @@ var error21 = () => {
7935
8120
  json_string: "JSON \u0938\u094D\u091F\u094D\u0930\u093F\u0902\u0917",
7936
8121
  e164: "E.164 \u0938\u0902\u0916\u094D\u092F\u093E",
7937
8122
  credit_card: "\u0915\u094D\u0930\u0947\u0921\u093F\u091F \u0915\u093E\u0930\u094D\u0921 \u0938\u0902\u0916\u094D\u092F\u093E",
8123
+ iban: "IBAN",
7938
8124
  jwt: "JWT",
7939
8125
  template_literal: "\u0907\u0928\u092A\u0941\u091F"
7940
8126
  };
@@ -8044,6 +8230,7 @@ var error22 = () => {
8044
8230
  json_string: "JSON tekst",
8045
8231
  e164: "E.164 broj",
8046
8232
  credit_card: "broj kreditne kartice",
8233
+ iban: "IBAN",
8047
8234
  jwt: "JWT",
8048
8235
  template_literal: "unos"
8049
8236
  };
@@ -8170,6 +8357,7 @@ var error23 = () => {
8170
8357
  json_string: "JSON string",
8171
8358
  e164: "E.164 sz\xE1m",
8172
8359
  credit_card: "hitelk\xE1rtyasz\xE1m",
8360
+ iban: "IBAN",
8173
8361
  jwt: "JWT",
8174
8362
  template_literal: "bemenet"
8175
8363
  };
@@ -8322,6 +8510,7 @@ var error24 = () => {
8322
8510
  json_string: "JSON \u057F\u0578\u0572",
8323
8511
  e164: "E.164 \u0570\u0561\u0574\u0561\u0580",
8324
8512
  credit_card: "\u056F\u0580\u0565\u0564\u056B\u057F \u0584\u0561\u0580\u057F\u056B \u0570\u0561\u0574\u0561\u0580",
8513
+ iban: "IBAN",
8325
8514
  jwt: "JWT",
8326
8515
  template_literal: "\u0574\u0578\u0582\u057F\u0584"
8327
8516
  };
@@ -8439,6 +8628,7 @@ var error25 = () => {
8439
8628
  json_string: "string JSON",
8440
8629
  e164: "angka E.164",
8441
8630
  credit_card: "nomor kartu kredit",
8631
+ iban: "IBAN",
8442
8632
  jwt: "JWT",
8443
8633
  template_literal: "input"
8444
8634
  };
@@ -8549,6 +8739,7 @@ var error26 = () => {
8549
8739
  json_string: "JSON strengur",
8550
8740
  e164: "E.164 t\xF6lugildi",
8551
8741
  credit_card: "kreditkortan\xFAmer",
8742
+ iban: "IBAN",
8552
8743
  jwt: "JWT",
8553
8744
  template_literal: "gildi"
8554
8745
  };
@@ -8662,6 +8853,7 @@ var error27 = () => {
8662
8853
  json_string: "stringa JSON",
8663
8854
  e164: "numero E.164",
8664
8855
  credit_card: "numero di carta di credito",
8856
+ iban: "IBAN",
8665
8857
  jwt: "JWT",
8666
8858
  template_literal: "input"
8667
8859
  };
@@ -8774,6 +8966,7 @@ var error28 = () => {
8774
8966
  json_string: "JSON\u6587\u5B57\u5217",
8775
8967
  e164: "E.164\u756A\u53F7",
8776
8968
  credit_card: "\u30AF\u30EC\u30B8\u30C3\u30C8\u30AB\u30FC\u30C9\u756A\u53F7",
8969
+ iban: "IBAN",
8777
8970
  jwt: "JWT",
8778
8971
  template_literal: "\u5165\u529B\u5024"
8779
8972
  };
@@ -8885,6 +9078,7 @@ var error29 = () => {
8885
9078
  json_string: "JSON \u10D5\u10D4\u10DA\u10D8",
8886
9079
  e164: "E.164 \u10DC\u10DD\u10DB\u10D4\u10E0\u10D8",
8887
9080
  credit_card: "\u10E1\u10D0\u10D9\u10E0\u10D4\u10D3\u10D8\u10E2\u10DD \u10D1\u10D0\u10E0\u10D0\u10D7\u10D8\u10E1 \u10DC\u10DD\u10DB\u10D4\u10E0\u10D8",
9081
+ iban: "IBAN",
8888
9082
  jwt: "JWT",
8889
9083
  template_literal: "\u10E8\u10D4\u10E7\u10D5\u10D0\u10DC\u10D0"
8890
9084
  };
@@ -9001,6 +9195,7 @@ var error30 = () => {
9001
9195
  json_string: "\u1781\u17D2\u179F\u17C2\u17A2\u1780\u17D2\u179F\u179A JSON",
9002
9196
  e164: "\u179B\u17C1\u1781 E.164",
9003
9197
  credit_card: "\u179B\u17C1\u1781\u1794\u17D0\u178E\u17D2\u178E\u17A5\u178E\u1791\u17B6\u1793",
9198
+ iban: "IBAN",
9004
9199
  jwt: "JWT",
9005
9200
  template_literal: "\u1791\u17B7\u1793\u17D2\u1793\u1793\u17D0\u1799\u1794\u1789\u17D2\u1785\u17BC\u179B"
9006
9201
  };
@@ -9120,6 +9315,7 @@ var error31 = () => {
9120
9315
  json_string: "JSON\u0CB8\u0CCD\u0C9F\u0CCD\u0CB0\u0CBF\u0C82\u0C97\u0CCD",
9121
9316
  e164: "E.164 \u0CB8\u0C82\u0C96\u0CCD\u0CAF\u0CC6",
9122
9317
  credit_card: "\u0C95\u0CCD\u0CB0\u0CC6\u0CA1\u0CBF\u0C9F\u0CCD \u0C95\u0CBE\u0CB0\u0CCD\u0CA1\u0CCD \u0CB8\u0C82\u0C96\u0CCD\u0CAF\u0CC6",
9318
+ iban: "IBAN",
9123
9319
  jwt: "JWT",
9124
9320
  template_literal: "\u0C87\u0CA8\u0CCD\u0CAA\u0CC1\u0C9F\u0CCD"
9125
9321
  };
@@ -9234,6 +9430,7 @@ var error32 = () => {
9234
9430
  json_string: "JSON \uBB38\uC790\uC5F4",
9235
9431
  e164: "E.164 \uBC88\uD638",
9236
9432
  credit_card: "\uC2E0\uC6A9\uCE74\uB4DC \uBC88\uD638",
9433
+ iban: "IBAN",
9237
9434
  jwt: "JWT",
9238
9435
  template_literal: "\uC785\uB825"
9239
9436
  };
@@ -9431,6 +9628,7 @@ var error33 = () => {
9431
9628
  json_string: "JSON eilut\u0117",
9432
9629
  e164: "E.164 numeris",
9433
9630
  credit_card: "kredito kortel\u0117s numeris",
9631
+ iban: "IBAN",
9434
9632
  jwt: "JWT",
9435
9633
  template_literal: "\u012Fvestis"
9436
9634
  };
@@ -9555,6 +9753,7 @@ var error34 = () => {
9555
9753
  json_string: "JSON \u043D\u0438\u0437\u0430",
9556
9754
  e164: "E.164 \u0431\u0440\u043E\u0458",
9557
9755
  credit_card: "\u0431\u0440\u043E\u0458 \u043D\u0430 \u043A\u0440\u0435\u0434\u0438\u0442\u043D\u0430 \u043A\u0430\u0440\u0442\u0438\u0447\u043A\u0430",
9756
+ iban: "IBAN",
9558
9757
  jwt: "JWT",
9559
9758
  template_literal: "\u0432\u043D\u0435\u0441"
9560
9759
  };
@@ -9668,6 +9867,7 @@ var error35 = () => {
9668
9867
  json_string: "string JSON",
9669
9868
  e164: "nombor E.164",
9670
9869
  credit_card: "nombor kad kredit",
9870
+ iban: "IBAN",
9671
9871
  jwt: "JWT",
9672
9872
  template_literal: "input"
9673
9873
  };
@@ -9779,6 +9979,7 @@ var error36 = () => {
9779
9979
  json_string: "JSON \u0938\u094D\u091F\u094D\u0930\u093F\u0919",
9780
9980
  e164: "E.164 \u0928\u092E\u094D\u092C\u0930",
9781
9981
  credit_card: "\u0915\u094D\u0930\u0947\u0921\u093F\u091F \u0915\u093E\u0930\u094D\u0921 \u0928\u092E\u094D\u092C\u0930",
9982
+ iban: "IBAN",
9782
9983
  jwt: "JWT",
9783
9984
  template_literal: "\u0907\u0928\u092A\u0941\u091F"
9784
9985
  };
@@ -9889,6 +10090,7 @@ var error37 = () => {
9889
10090
  json_string: "JSON string",
9890
10091
  e164: "E.164-nummer",
9891
10092
  credit_card: "creditcardnummer",
10093
+ iban: "IBAN",
9892
10094
  jwt: "JWT",
9893
10095
  template_literal: "invoer"
9894
10096
  };
@@ -10003,6 +10205,7 @@ var error38 = () => {
10003
10205
  json_string: "JSON-streng",
10004
10206
  e164: "E.164-nummer",
10005
10207
  credit_card: "kredittkortnummer",
10208
+ iban: "IBAN",
10006
10209
  jwt: "JWT",
10007
10210
  template_literal: "input"
10008
10211
  };
@@ -10115,6 +10318,7 @@ var error39 = () => {
10115
10318
  json_string: "JSON-streng",
10116
10319
  e164: "E.164-nummer",
10117
10320
  credit_card: "kredittkortnummer",
10321
+ iban: "IBAN",
10118
10322
  jwt: "JWT",
10119
10323
  template_literal: "input"
10120
10324
  };
@@ -10227,6 +10431,7 @@ var error40 = () => {
10227
10431
  json_string: "JSON metin",
10228
10432
  e164: "E.164 say\u0131s\u0131",
10229
10433
  credit_card: "i'tib\xE2r kart\u0131 numaras\u0131",
10434
+ iban: "IBAN",
10230
10435
  jwt: "JWT",
10231
10436
  template_literal: "giren"
10232
10437
  };
@@ -10340,6 +10545,7 @@ var error41 = () => {
10340
10545
  json_string: "JSON \u0645\u062A\u0646",
10341
10546
  e164: "\u062F E.164 \u0634\u0645\u06D0\u0631\u0647",
10342
10547
  credit_card: "\u062F \u06A9\u0631\u06CC\u0689\u06CC\u067C \u06A9\u0627\u0631\u062A \u0634\u0645\u06CC\u0631\u0647",
10548
+ iban: "IBAN",
10343
10549
  jwt: "JWT",
10344
10550
  template_literal: "\u0648\u0631\u0648\u062F\u064A"
10345
10551
  };
@@ -10458,6 +10664,7 @@ var error42 = () => {
10458
10664
  json_string: "ci\u0105g znak\xF3w w formacie JSON",
10459
10665
  e164: "liczba E.164",
10460
10666
  credit_card: "numer karty kredytowej",
10667
+ iban: "IBAN",
10461
10668
  jwt: "JWT",
10462
10669
  template_literal: "wej\u015Bcie"
10463
10670
  };
@@ -10571,6 +10778,7 @@ var error43 = () => {
10571
10778
  json_string: "o texto JSON",
10572
10779
  e164: "o n\xFAmero E.164",
10573
10780
  credit_card: "o n\xFAmero de cart\xE3o de cr\xE9dito",
10781
+ iban: "o IBAN",
10574
10782
  jwt: "o JWT",
10575
10783
  template_literal: "a entrada"
10576
10784
  };
@@ -10648,8 +10856,8 @@ var error43 = () => {
10648
10856
  case "not_multiple_of":
10649
10857
  return `N\xFAmero inv\xE1lido: deve ser m\xFAltiplo de ${issue2.divisor}`;
10650
10858
  case "unrecognized_keys": {
10651
- const plural = issue2.keys.length > 1 ? "s" : "";
10652
- return `Chave${plural} inv\xE1lida${plural}: ${joinValues(issue2.keys, ", ")}`;
10859
+ const plural2 = issue2.keys.length > 1 ? "s" : "";
10860
+ return `Chave${plural2} inv\xE1lida${plural2}: ${joinValues(issue2.keys, ", ")}`;
10653
10861
  }
10654
10862
  case "invalid_key":
10655
10863
  return `Entrada inv\xE1lida n${translateOriginWithArticle(issue2.origin, "definite")}`;
@@ -10713,6 +10921,7 @@ var error44 = () => {
10713
10921
  json_string: "o texto JSON",
10714
10922
  e164: "o n\xFAmero E.164",
10715
10923
  credit_card: "o n\xFAmero de cart\xE3o de cr\xE9dito",
10924
+ iban: "o IBAN",
10716
10925
  jwt: "o JWT",
10717
10926
  template_literal: "a entrada"
10718
10927
  };
@@ -10791,8 +11000,8 @@ var error44 = () => {
10791
11000
  case "not_multiple_of":
10792
11001
  return `N\xFAmero inv\xE1lido: deve ser m\xFAltiplo de ${issue2.divisor}`;
10793
11002
  case "unrecognized_keys": {
10794
- const plural = issue2.keys.length > 1 ? "s" : "";
10795
- return `Chave${plural} inv\xE1lida${plural}: ${joinValues(issue2.keys, ", ")}`;
11003
+ const plural2 = issue2.keys.length > 1 ? "s" : "";
11004
+ return `Chave${plural2} inv\xE1lida${plural2}: ${joinValues(issue2.keys, ", ")}`;
10796
11005
  }
10797
11006
  case "invalid_key":
10798
11007
  return `Entrada inv\xE1lida n${translateOriginWithArticle(issue2.origin, "definite")}`;
@@ -10856,6 +11065,7 @@ var error45 = () => {
10856
11065
  json_string: "\u0219ir JSON",
10857
11066
  e164: "num\u0103r E.164",
10858
11067
  credit_card: "num\u0103r de card de credit",
11068
+ iban: "IBAN",
10859
11069
  jwt: "JWT",
10860
11070
  template_literal: "intrare"
10861
11071
  };
@@ -11027,6 +11237,7 @@ var error46 = () => {
11027
11237
  json_string: "JSON \u0441\u0442\u0440\u043E\u043A\u0430",
11028
11238
  e164: "\u043D\u043E\u043C\u0435\u0440 E.164",
11029
11239
  credit_card: "\u043D\u043E\u043C\u0435\u0440 \u043A\u0440\u0435\u0434\u0438\u0442\u043D\u043E\u0439 \u043A\u0430\u0440\u0442\u044B",
11240
+ iban: "IBAN",
11030
11241
  jwt: "JWT",
11031
11242
  template_literal: "\u0432\u0432\u043E\u0434"
11032
11243
  };
@@ -11144,6 +11355,7 @@ var error47 = () => {
11144
11355
  json_string: "re\u0165azec vo form\xE1te JSON",
11145
11356
  e164: "\u010D\xEDslo E.164",
11146
11357
  credit_card: "\u010D\xEDslo kreditnej karty",
11358
+ iban: "IBAN",
11147
11359
  jwt: "JWT",
11148
11360
  template_literal: "vstup"
11149
11361
  };
@@ -11259,6 +11471,7 @@ var error48 = () => {
11259
11471
  json_string: "JSON niz",
11260
11472
  e164: "E.164 \u0161tevilka",
11261
11473
  credit_card: "\u0161tevilka kreditne kartice",
11474
+ iban: "IBAN",
11262
11475
  jwt: "JWT",
11263
11476
  template_literal: "vnos"
11264
11477
  };
@@ -11372,6 +11585,7 @@ var error49 = () => {
11372
11585
  json_string: "JSON-str\xE4ng",
11373
11586
  e164: "E.164-nummer",
11374
11587
  credit_card: "kreditkortsnummer",
11588
+ iban: "IBAN",
11375
11589
  jwt: "JWT",
11376
11590
  template_literal: "mall-literal"
11377
11591
  };
@@ -11486,6 +11700,7 @@ var error50 = () => {
11486
11700
  json_string: "JSON \u0B9A\u0BB0\u0BAE\u0BCD",
11487
11701
  e164: "E.164 \u0B8E\u0BA3\u0BCD",
11488
11702
  credit_card: "\u0B95\u0B9F\u0BA9\u0BCD \u0B85\u0B9F\u0BCD\u0B9F\u0BC8 \u0B8E\u0BA3\u0BCD",
11703
+ iban: "IBAN",
11489
11704
  jwt: "JWT",
11490
11705
  template_literal: "input"
11491
11706
  };
@@ -11600,6 +11815,7 @@ var error51 = () => {
11600
11815
  json_string: "\u0E02\u0E49\u0E2D\u0E04\u0E27\u0E32\u0E21\u0E41\u0E1A\u0E1A JSON",
11601
11816
  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)",
11602
11817
  credit_card: "\u0E2B\u0E21\u0E32\u0E22\u0E40\u0E25\u0E02\u0E1A\u0E31\u0E15\u0E23\u0E40\u0E04\u0E23\u0E14\u0E34\u0E15",
11818
+ iban: "IBAN",
11603
11819
  jwt: "\u0E42\u0E17\u0E40\u0E04\u0E19 JWT",
11604
11820
  template_literal: "\u0E02\u0E49\u0E2D\u0E21\u0E39\u0E25\u0E17\u0E35\u0E48\u0E1B\u0E49\u0E2D\u0E19"
11605
11821
  };
@@ -11714,6 +11930,7 @@ var error52 = () => {
11714
11930
  json_string: "JSON setiri",
11715
11931
  e164: "E.164 nomeri",
11716
11932
  credit_card: "kredit kartyny\u0148 nomeri",
11933
+ iban: "IBAN",
11717
11934
  jwt: "JWT",
11718
11935
  template_literal: "\u015Fablon"
11719
11936
  };
@@ -11820,6 +12037,7 @@ var error53 = () => {
11820
12037
  json_string: "JSON dizesi",
11821
12038
  e164: "E.164 say\u0131s\u0131",
11822
12039
  credit_card: "kredi kart\u0131 numaras\u0131",
12040
+ iban: "IBAN",
11823
12041
  jwt: "JWT",
11824
12042
  template_literal: "\u015Eablon dizesi"
11825
12043
  };
@@ -11929,6 +12147,7 @@ var error54 = () => {
11929
12147
  json_string: "\u0440\u044F\u0434\u043E\u043A JSON",
11930
12148
  e164: "\u043D\u043E\u043C\u0435\u0440 E.164",
11931
12149
  credit_card: "\u043D\u043E\u043C\u0435\u0440 \u043A\u0440\u0435\u0434\u0438\u0442\u043D\u043E\u0457 \u043A\u0430\u0440\u0442\u043A\u0438",
12150
+ iban: "IBAN",
11932
12151
  jwt: "JWT",
11933
12152
  template_literal: "\u0432\u0445\u0456\u0434\u043D\u0456 \u0434\u0430\u043D\u0456"
11934
12153
  };
@@ -12046,6 +12265,7 @@ var error55 = () => {
12046
12265
  json_string: "\u062C\u06D2 \u0627\u06CC\u0633 \u0627\u0648 \u0627\u06CC\u0646 \u0633\u0679\u0631\u0646\u06AF",
12047
12266
  e164: "\u0627\u06CC 164 \u0646\u0645\u0628\u0631",
12048
12267
  credit_card: "\u06A9\u0631\u06CC\u0688\u0679 \u06A9\u0627\u0631\u0688 \u0646\u0645\u0628\u0631",
12268
+ iban: "IBAN",
12049
12269
  jwt: "\u062C\u06D2 \u0688\u0628\u0644\u06CC\u0648 \u0679\u06CC",
12050
12270
  template_literal: "\u0627\u0646 \u067E\u0679"
12051
12271
  };
@@ -12160,6 +12380,7 @@ var error56 = () => {
12160
12380
  json_string: "JSON satr",
12161
12381
  e164: "E.164 raqam",
12162
12382
  credit_card: "kredit karta raqami",
12383
+ iban: "IBAN",
12163
12384
  jwt: "JWT",
12164
12385
  template_literal: "kirish"
12165
12386
  };
@@ -12272,6 +12493,7 @@ var error57 = () => {
12272
12493
  json_string: "chu\u1ED7i JSON",
12273
12494
  e164: "s\u1ED1 E.164",
12274
12495
  credit_card: "s\u1ED1 th\u1EBB t\xEDn d\u1EE5ng",
12496
+ iban: "IBAN",
12275
12497
  jwt: "JWT",
12276
12498
  template_literal: "\u0111\u1EA7u v\xE0o"
12277
12499
  };
@@ -12384,6 +12606,7 @@ var error58 = () => {
12384
12606
  json_string: "JSON\u5B57\u7B26\u4E32",
12385
12607
  e164: "E.164\u53F7\u7801",
12386
12608
  credit_card: "\u4FE1\u7528\u5361\u53F7",
12609
+ iban: "IBAN",
12387
12610
  jwt: "JWT",
12388
12611
  template_literal: "\u8F93\u5165"
12389
12612
  };
@@ -12497,6 +12720,7 @@ var error59 = () => {
12497
12720
  json_string: "JSON \u5B57\u4E32",
12498
12721
  e164: "E.164 \u6578\u503C",
12499
12722
  credit_card: "\u4FE1\u7528\u5361\u865F",
12723
+ iban: "IBAN",
12500
12724
  jwt: "JWT",
12501
12725
  template_literal: "\u8F38\u5165"
12502
12726
  };
@@ -12608,6 +12832,7 @@ var error60 = () => {
12608
12832
  json_string: "\u1ECD\u0300r\u1ECD\u0300 JSON",
12609
12833
  e164: "n\u1ECD\u0301mb\xE0 E.164",
12610
12834
  credit_card: "n\u1ECDmba kaadi gbese",
12835
+ iban: "IBAN",
12611
12836
  jwt: "JWT",
12612
12837
  template_literal: "\u1EB9\u0300r\u1ECD \xECb\xE1w\u1ECDl\xE9"
12613
12838
  };
@@ -12754,31 +12979,8 @@ function compileValidator(schema, parser) {
12754
12979
  function compile(schema, options) {
12755
12980
  try {
12756
12981
  const parser = compileFn(schema);
12757
- const clone2 = clone(schema);
12758
- const liveRun = schema._zod.run;
12759
- const originalRun = liveRun.__originalRun ?? liveRun;
12760
- const wrapped = (payload, ctx) => {
12761
- if (ctx?.async || ctx?.direction === "backward" || ctx?.skipChecks || ctx?.[FALLBACK_FLAG]) {
12762
- return originalRun(payload, ctx);
12763
- }
12764
- if (ctx && isBackEdge(ctx, payload.value)) {
12765
- return originalRun(payload, ctx);
12766
- }
12767
- const out = parser(payload.value);
12768
- if (out !== INVALID) {
12769
- payload.value = out;
12770
- return payload;
12771
- }
12772
- if (ctx)
12773
- ctx[FALLBACK_FLAG] = true;
12774
- return originalRun(payload, ctx);
12775
- };
12776
- wrapped.__originalRun = originalRun;
12777
- clone2._zod.bag.fallbackRun = originalRun;
12982
+ const clone2 = withParser(schema, parser);
12778
12983
  clone2._zod.bag.validator = compileValidator(schema, parser);
12779
- clone2._zod.run = wrapped;
12780
- if (!liveRun.__originalRun)
12781
- installCompiledUserMethods(clone2, schema, parser);
12782
12984
  return clone2;
12783
12985
  } catch (err) {
12784
12986
  if (options?.strict)
@@ -12786,6 +12988,37 @@ function compile(schema, options) {
12786
12988
  return schema;
12787
12989
  }
12788
12990
  }
12991
+ function withParser(schema, parser) {
12992
+ if (isRecursiveSchema(schema)) {
12993
+ throw new ZodCompileUnsupportedError("a schema whose subtree contains a reference cycle");
12994
+ }
12995
+ const clone2 = clone(schema);
12996
+ const liveRun = schema._zod.run;
12997
+ const originalRun = liveRun.__originalRun ?? liveRun;
12998
+ const wrapped = (payload, ctx) => {
12999
+ if (ctx?.async || ctx?.direction === "backward" || ctx?.skipChecks || ctx?.[FALLBACK_FLAG]) {
13000
+ return originalRun(payload, ctx);
13001
+ }
13002
+ if (ctx && isBackEdge(ctx, payload.value)) {
13003
+ return originalRun(payload, ctx);
13004
+ }
13005
+ const out = parser(payload.value);
13006
+ if (out !== INVALID) {
13007
+ payload.value = out;
13008
+ return payload;
13009
+ }
13010
+ if (ctx)
13011
+ ctx[FALLBACK_FLAG] = true;
13012
+ return originalRun(payload, ctx);
13013
+ };
13014
+ wrapped.__originalRun = originalRun;
13015
+ clone2._zod.bag.fallbackRun = originalRun;
13016
+ clone2._zod.bag.validator = parser;
13017
+ clone2._zod.run = wrapped;
13018
+ if (!liveRun.__originalRun)
13019
+ installCompiledUserMethods(clone2, schema, parser);
13020
+ return clone2;
13021
+ }
12789
13022
  function installCompiledUserMethods(target, source, parser) {
12790
13023
  const targetAny = target;
12791
13024
  const sourceAny = source;
@@ -12822,7 +13055,8 @@ function compileFn(schema, options) {
12822
13055
  const ctx = {
12823
13056
  constants: /* @__PURE__ */ new Map(),
12824
13057
  constantCounter: 0,
12825
- varCounter: 0
13058
+ varCounter: 0,
13059
+ definite: true
12826
13060
  };
12827
13061
  const doc = new Doc(["input"]);
12828
13062
  const outputAccessor = generateCheck(doc, ctx, schema, "input", !options?.assertOnly);
@@ -12846,6 +13080,7 @@ ${code}
12846
13080
  if (options?.debug) {
12847
13081
  fn.code = fullCode;
12848
13082
  }
13083
+ fn.definite = ctx.definite;
12849
13084
  return fn;
12850
13085
  }
12851
13086
  function addConstant(ctx, value) {
@@ -12857,6 +13092,10 @@ function addConstant(ctx, value) {
12857
13092
  ctx.constants.set(name, value);
12858
13093
  return name;
12859
13094
  }
13095
+ function addUserConstant(ctx, fn) {
13096
+ ctx.definite = false;
13097
+ return addConstant(ctx, fn);
13098
+ }
12860
13099
  function newVar(ctx) {
12861
13100
  return `v${ctx.varCounter++}`;
12862
13101
  }
@@ -12889,6 +13128,7 @@ function compileChild(doc, ctx, schema, accessor, needsValue = true) {
12889
13128
  }
12890
13129
  }
12891
13130
  function emitRuntimeIsland(doc, ctx, schema, accessor) {
13131
+ ctx.definite = false;
12892
13132
  const schemaConst = addConstant(ctx, schema);
12893
13133
  const runConst = addConstant(ctx, runtimeRun);
12894
13134
  const outVar = newVar(ctx);
@@ -12969,6 +13209,9 @@ function generateChecks(doc, ctx, schema, accessor) {
12969
13209
  case "property":
12970
13210
  generatePropertyCheck(doc, ctx, def, currentAccessor);
12971
13211
  break;
13212
+ case "properties":
13213
+ generatePropertiesChecks(doc, ctx, def, currentAccessor, false);
13214
+ break;
12972
13215
  case "overwrite": {
12973
13216
  const newAccessor = newVar(ctx);
12974
13217
  generateOverwriteCheck(doc, ctx, check2, currentAccessor, newAccessor);
@@ -13077,6 +13320,19 @@ function generateMimeTypeCheck(doc, ctx, def, accessor) {
13077
13320
  doc.write(`if (!${mimeSet}.has(${accessor}.type)) return INVALID;`);
13078
13321
  }
13079
13322
  }
13323
+ function generatePropertiesChecks(doc, ctx, def, accessor, schemaRole) {
13324
+ if (def.when) {
13325
+ throw new ZodCompileUnsupportedError(`check with a custom "when" condition`);
13326
+ }
13327
+ doc.write(schemaRole ? `if (${accessor} === null || (typeof ${accessor} !== "object" && typeof ${accessor} !== "function")) return INVALID;` : `if (${accessor} == null) return INVALID;`);
13328
+ const shape = def.shape;
13329
+ for (const key of Reflect.ownKeys(shape)) {
13330
+ const keyExpr = typeof key === "symbol" ? addConstant(ctx, key) : esc(key);
13331
+ const inputVar = newVar(ctx);
13332
+ doc.write(`const ${inputVar} = ${accessor}[${keyExpr}];`);
13333
+ compileChild(doc, ctx, shape[key], inputVar, false);
13334
+ }
13335
+ }
13080
13336
  function generatePropertyCheck(doc, ctx, def, accessor) {
13081
13337
  const propAccessor = `${accessor}[${JSON.stringify(def.property)}]`;
13082
13338
  generateCheck(doc, ctx, def.schema, propAccessor);
@@ -13104,7 +13360,7 @@ function generateCustomRefineCheck(doc, ctx, check2, accessor) {
13104
13360
  if (isAsyncFunction(def.fn)) {
13105
13361
  throw new ZodCompileAsyncError("z.compile: async .refine() predicates are not supported");
13106
13362
  }
13107
- const fnConst = addConstant(ctx, def.fn);
13363
+ const fnConst = addUserConstant(ctx, def.fn);
13108
13364
  const throwAsyncConst = addConstant(ctx, throwAsync);
13109
13365
  const resVar = newVar(ctx);
13110
13366
  doc.write(`const ${resVar} = ${fnConst}(${accessor});`);
@@ -13124,7 +13380,7 @@ function generateCustomRefineCheck(doc, ctx, check2, accessor) {
13124
13380
  throwAsync();
13125
13381
  return fakePayload.issues.length === 0 ? fakePayload.value : INVALID;
13126
13382
  };
13127
- const helperConst = addConstant(ctx, helperFn);
13383
+ const helperConst = addUserConstant(ctx, helperFn);
13128
13384
  const outVar = newVar(ctx);
13129
13385
  doc.write(`const ${outVar} = ${helperConst}(${accessor});`);
13130
13386
  doc.write(`if (${outVar} === INVALID) return INVALID;`);
@@ -13191,6 +13447,11 @@ function generateStringFormatCheck(doc, ctx, def, accessor) {
13191
13447
  doc.write(`if (!${validator}(${accessor})) return INVALID;`);
13192
13448
  return accessor;
13193
13449
  }
13450
+ if (fmt === "iban") {
13451
+ const validator = addConstant(ctx, isValidIBAN);
13452
+ doc.write(`if (!${validator}(${accessor})) return INVALID;`);
13453
+ return accessor;
13454
+ }
13194
13455
  const formatDef = def;
13195
13456
  if (fmt === "url" || fmt === "httpurl" || formatDef.normalize || formatDef.hostname !== void 0 || formatDef.protocol !== void 0) {
13196
13457
  const parseConst = addConstant(ctx, parseURLObject);
@@ -13373,6 +13634,10 @@ function generateCheck(doc, ctx, schema, accessor, needsValue = true) {
13373
13634
  case "custom":
13374
13635
  typeAccessor = generateCustomCheck(doc, ctx, schema, accessor);
13375
13636
  break;
13637
+ case "properties":
13638
+ generatePropertiesChecks(doc, ctx, schema._zod.def, accessor, true);
13639
+ typeAccessor = accessor;
13640
+ break;
13376
13641
  case "transform":
13377
13642
  typeAccessor = generateTransformCheck(doc, ctx, schema, accessor);
13378
13643
  break;
@@ -14013,6 +14278,7 @@ function literalEquality(ctx, accessor, value) {
14013
14278
  }
14014
14279
  function generateIntersectionCheck(doc, ctx, schema, accessor) {
14015
14280
  const def = schema._zod.def;
14281
+ ctx.definite = false;
14016
14282
  const leftOutput = compileChild(doc, ctx, def.left, accessor);
14017
14283
  const rightOutput = compileChild(doc, ctx, def.right, accessor);
14018
14284
  const mergeConst = addConstant(ctx, mergeValues);
@@ -14066,14 +14332,13 @@ function generateRecordCheck(doc, ctx, schema, accessor) {
14066
14332
  const keyIsBareString = keyDef.type === "string" && keyDef.format === void 0 && !keyDef.coerce && (keyDef.checks?.length ?? 0) === 0;
14067
14333
  if (!keyIsBareString) {
14068
14334
  const isLoose = def.mode === "loose";
14069
- const keyFast = addConstant(ctx, compileFn(def.keyType));
14335
+ const keyFn = compileFn(def.keyType);
14336
+ if (keyFn.definite === false)
14337
+ ctx.definite = false;
14338
+ const keyFast = addConstant(ctx, keyFn);
14070
14339
  const numericConst = addConstant(ctx, number);
14071
- const propIsEnumerableConst = addConstant(ctx, Object.prototype.propertyIsEnumerable);
14072
14340
  const outKeyVar = newVar(ctx);
14073
- doc.write(`for (const ${kVar} of Reflect.ownKeys(${accessor})) {`);
14074
- doc.indented((d) => {
14075
- d.write(`if (${kVar} === "__proto__") continue;`);
14076
- d.write(`if (!${propIsEnumerableConst}.call(${accessor}, ${kVar})) continue;`);
14341
+ emitOwnKeys(doc, ctx, accessor, kVar, (d) => {
14077
14342
  d.write(`let ${outKeyVar} = ${keyFast}(${kVar});`);
14078
14343
  d.write(`if (${outKeyVar} === INVALID && typeof ${kVar} === "string" && ${numericConst}.test(${kVar})) ${outKeyVar} = ${keyFast}(Number(${kVar}));`);
14079
14344
  if (isLoose) {
@@ -14087,21 +14352,39 @@ function generateRecordCheck(doc, ctx, schema, accessor) {
14087
14352
  const valOutput = compileChild(d, ctx, def.valueType, valueVar);
14088
14353
  d.write(`${outputVar}[${outKeyVar}] = ${valOutput};`);
14089
14354
  });
14090
- doc.write(`}`);
14091
14355
  return outputVar;
14092
14356
  }
14093
- const propIsEnumerable = addConstant(ctx, Object.prototype.propertyIsEnumerable);
14094
- doc.write(`for (const ${kVar} of Reflect.ownKeys(${accessor})) {`);
14095
- doc.indented((d) => {
14096
- d.write(`if (${kVar} === "__proto__") continue;`);
14097
- d.write(`if (!${propIsEnumerable}.call(${accessor}, ${kVar})) continue;`);
14098
- d.write(`if (typeof ${kVar} !== "string") return INVALID;`);
14357
+ emitOwnKeys(doc, ctx, accessor, kVar, (d) => {
14099
14358
  d.write(`const ${valVar} = ${accessor}[${kVar}];`);
14100
14359
  const valOutput = compileChild(d, ctx, def.valueType, valVar);
14101
14360
  d.write(`${outputVar}[${kVar}] = ${valOutput};`);
14361
+ }, `return INVALID;`);
14362
+ return outputVar;
14363
+ }
14364
+ function emitOwnKeys(doc, ctx, accessor, kVar, body, onSymbol) {
14365
+ const propIsEnumerableConst = addConstant(ctx, Object.prototype.propertyIsEnumerable);
14366
+ const symsVar = newVar(ctx);
14367
+ const keysVar = newVar(ctx);
14368
+ const iVar = newVar(ctx);
14369
+ doc.write(`const ${symsVar} = Object.getOwnPropertySymbols(${accessor});`);
14370
+ doc.write(`const ${keysVar} = Object.getOwnPropertyNames(${accessor});`);
14371
+ doc.write(`for (let ${iVar} = 0; ${iVar} < ${keysVar}.length; ${iVar}++) {`);
14372
+ doc.indented((d) => {
14373
+ d.write(`const ${kVar} = ${keysVar}[${iVar}];`);
14374
+ d.write(`if (${kVar} === "__proto__" || !${propIsEnumerableConst}.call(${accessor}, ${kVar})) continue;`);
14375
+ body(d);
14376
+ });
14377
+ doc.write(`}`);
14378
+ doc.write(`for (let ${iVar} = 0; ${iVar} < ${symsVar}.length; ${iVar}++) {`);
14379
+ doc.indented((d) => {
14380
+ d.write(`const ${kVar} = ${symsVar}[${iVar}];`);
14381
+ d.write(`if (!${propIsEnumerableConst}.call(${accessor}, ${kVar})) continue;`);
14382
+ if (onSymbol)
14383
+ d.write(onSymbol);
14384
+ else
14385
+ body(d);
14102
14386
  });
14103
14387
  doc.write(`}`);
14104
- return outputVar;
14105
14388
  }
14106
14389
  function literalPropertyKey(ctx, key) {
14107
14390
  if (typeof key === "string")
@@ -14154,7 +14437,7 @@ function generateTemplateLiteralCheck(doc, ctx, schema, accessor) {
14154
14437
  }
14155
14438
  function generateLazyCheck(doc, ctx, schema, accessor) {
14156
14439
  const def = schema._zod.def;
14157
- const getterConst = addConstant(ctx, def.getter);
14440
+ const getterConst = addUserConstant(ctx, def.getter);
14158
14441
  const cacheConst = addConstant(ctx, { parser: null });
14159
14442
  doc.write(`if (!${cacheConst}.parser) {`);
14160
14443
  doc.indented((d) => {
@@ -14187,7 +14470,7 @@ function generatePipeCheck(doc, ctx, schema, accessor) {
14187
14470
  return INVALID;
14188
14471
  return fakePayload.issues.length === 0 ? result : INVALID;
14189
14472
  };
14190
- const helperConst = addConstant(ctx, helperFn);
14473
+ const helperConst = addUserConstant(ctx, helperFn);
14191
14474
  const transformedVar = newVar(ctx);
14192
14475
  doc.write(`const ${transformedVar} = ${helperConst}(${inputOutput});`);
14193
14476
  doc.write(`if (${transformedVar} === INVALID) return INVALID;`);
@@ -14205,7 +14488,7 @@ function generateCustomCheck(doc, ctx, schema, accessor) {
14205
14488
  if (isAsyncFunction(def.fn)) {
14206
14489
  throw new ZodCompileAsyncError("z.compile: async custom predicates are not supported");
14207
14490
  }
14208
- const fnConst = addConstant(ctx, def.fn);
14491
+ const fnConst = addUserConstant(ctx, def.fn);
14209
14492
  const throwAsyncConst = addConstant(ctx, throwAsync);
14210
14493
  const resVar = newVar(ctx);
14211
14494
  doc.write(`const ${resVar} = ${fnConst}(${accessor});`);
@@ -14238,7 +14521,7 @@ function generateCatchCheck(doc, ctx, schema, accessor) {
14238
14521
  });
14239
14522
  doc.write(`})();`);
14240
14523
  const innerConst = addConstant(ctx, def.innerType);
14241
- const catchConst = addConstant(ctx, def.catchValue);
14524
+ const catchConst = addUserConstant(ctx, def.catchValue);
14242
14525
  const catchHelperConst = addConstant(ctx, runtimeCatch);
14243
14526
  doc.write(`if (${outputVar} === INVALID) {`);
14244
14527
  doc.indented((d) => {
@@ -14262,7 +14545,7 @@ function generateTransformCheck(doc, ctx, schema, accessor) {
14262
14545
  return INVALID;
14263
14546
  return fakePayload.issues.length === 0 ? result : INVALID;
14264
14547
  };
14265
- const helperConst = addConstant(ctx, helperFn);
14548
+ const helperConst = addUserConstant(ctx, helperFn);
14266
14549
  const outputVar = newVar(ctx);
14267
14550
  doc.write(`const ${outputVar} = ${helperConst}(${accessor});`);
14268
14551
  doc.write(`if (${outputVar} === INVALID) return INVALID;`);
@@ -14521,6 +14804,16 @@ function _creditCard(Class2, params) {
14521
14804
  });
14522
14805
  }
14523
14806
  // @__NO_SIDE_EFFECTS__
14807
+ function _iban(Class2, params) {
14808
+ return new Class2({
14809
+ type: "string",
14810
+ format: "iban",
14811
+ check: "string_format",
14812
+ abort: false,
14813
+ ...normalizeParams(params)
14814
+ });
14815
+ }
14816
+ // @__NO_SIDE_EFFECTS__
14524
14817
  function _jwt(Class2, params) {
14525
14818
  return new Class2({
14526
14819
  type: "string",
@@ -14934,8 +15227,13 @@ function _property(property, schema, params) {
14934
15227
  });
14935
15228
  }
14936
15229
  // @__NO_SIDE_EFFECTS__
14937
- function _properties(shape) {
14938
- return Object.entries(shape).map(([property, schema]) => new $ZodCheckProperty({ check: "property", property, schema }));
15230
+ function _properties(Class2, shape, params) {
15231
+ return new Class2({
15232
+ type: "properties",
15233
+ check: "properties",
15234
+ shape,
15235
+ ...normalizeParams(params)
15236
+ });
14939
15237
  }
14940
15238
  // @__NO_SIDE_EFFECTS__
14941
15239
  function _mime(types, params) {
@@ -15372,7 +15670,7 @@ function handleUnrepresentable(schema, ctx, json2, params, message) {
15372
15670
  Object.assign(json2, result);
15373
15671
  return true;
15374
15672
  }
15375
- function process2(schema, ctx, _params = { path: [], schemaPath: [] }) {
15673
+ function processSchema(schema, ctx, _params = { path: [], schemaPath: [] }) {
15376
15674
  var _a3;
15377
15675
  const def = schema._zod.def;
15378
15676
  const seen = ctx.seen.get(schema);
@@ -15411,7 +15709,7 @@ function process2(schema, ctx, _params = { path: [], schemaPath: [] }) {
15411
15709
  if (parent) {
15412
15710
  if (!result.ref)
15413
15711
  result.ref = parent;
15414
- process2(parent, ctx, params);
15712
+ processSchema(parent, ctx, params);
15415
15713
  ctx.seen.get(parent).isParent = true;
15416
15714
  }
15417
15715
  }
@@ -15432,8 +15730,8 @@ function encodeJSONPointerSegment(segment) {
15432
15730
  return segment.replace(/~/g, "~0").replace(/\//g, "~1");
15433
15731
  }
15434
15732
  function extractDefs(ctx, schema) {
15435
- const root14 = ctx.seen.get(schema);
15436
- if (!root14)
15733
+ const root15 = ctx.seen.get(schema);
15734
+ if (!root15)
15437
15735
  throw new Error("Unprocessed schema. This is a bug in Zod.");
15438
15736
  if (ctx.external && ctx.sharedDefsExtractedFor === ctx.external)
15439
15737
  return;
@@ -15462,7 +15760,7 @@ function extractDefs(ctx, schema) {
15462
15760
  }
15463
15761
  const uriPrefix = `#`;
15464
15762
  const defUriPrefix = `${uriPrefix}/${defsSegment}/`;
15465
- if (entry[1] === root14 && !entry[1].schema.id) {
15763
+ if (entry[1] === root15 && !entry[1].schema.id) {
15466
15764
  return { ref: uriPrefix };
15467
15765
  }
15468
15766
  const defId = entry[1].schema.id ?? `__schema${ctx.counter++}`;
@@ -15518,7 +15816,6 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
15518
15816
  if (seen.count > 1) {
15519
15817
  if (ctx.reused === "ref") {
15520
15818
  extractToDef(entry);
15521
- continue;
15522
15819
  }
15523
15820
  }
15524
15821
  }
@@ -15567,11 +15864,11 @@ function foldObjects(members2) {
15567
15864
  }
15568
15865
  objects.push(member);
15569
15866
  }
15570
- const properties = {};
15867
+ const properties2 = {};
15571
15868
  const required2 = /* @__PURE__ */ new Set();
15572
15869
  for (const object2 of objects) {
15573
15870
  for (const key in object2.properties) {
15574
- if (Object.prototype.hasOwnProperty.call(properties, key))
15871
+ if (Object.prototype.hasOwnProperty.call(properties2, key))
15575
15872
  continue;
15576
15873
  const parts = [];
15577
15874
  for (const other of objects) {
@@ -15582,12 +15879,12 @@ function foldObjects(members2) {
15582
15879
  parts.push(part);
15583
15880
  }
15584
15881
  const merged = parts.length === 1 ? parts[0] : foldObjects(parts) ?? { allOf: parts };
15585
- assignProp(properties, key, merged);
15882
+ assignProp(properties2, key, merged);
15586
15883
  }
15587
15884
  for (const key of object2.required ?? [])
15588
15885
  required2.add(key);
15589
15886
  }
15590
- const folded = { type: "object", properties };
15887
+ const folded = { type: "object", properties: properties2 };
15591
15888
  if (required2.size)
15592
15889
  folded.required = [...required2];
15593
15890
  if (objects.every((object2) => object2.additionalProperties === false)) {
@@ -15634,8 +15931,8 @@ function foldIntersection(json2) {
15634
15931
  assignProps(json2, folded);
15635
15932
  }
15636
15933
  function finalize(ctx, schema) {
15637
- const root14 = ctx.seen.get(schema);
15638
- if (!root14)
15934
+ const root15 = ctx.seen.get(schema);
15935
+ if (!root15)
15639
15936
  throw new Error("Unprocessed schema. This is a bug in Zod.");
15640
15937
  const flattenRef = (zodSchema) => {
15641
15938
  const seen = ctx.seen.get(zodSchema);
@@ -15746,7 +16043,7 @@ function finalize(ctx, schema) {
15746
16043
  throw new Error("Schema is missing an `id` property");
15747
16044
  result.$id = ctx.external.uri(id);
15748
16045
  }
15749
- assignProps(result, root14.defId ? root14.schema : root14.def ?? root14.schema);
16046
+ assignProps(result, root15.defId ? root15.schema : root15.def ?? root15.schema);
15750
16047
  const rootMetaId = ctx.metadataRegistry.get(schema)?.id;
15751
16048
  if (rootMetaId !== void 0 && result.id === rootMetaId)
15752
16049
  delete result.id;
@@ -15846,31 +16143,124 @@ function isTransforming(_schema, _ctx) {
15846
16143
  }
15847
16144
  var createToJSONSchemaMethod = (schema, processors = {}) => (params) => {
15848
16145
  const ctx = initializeContext({ ...params, processors });
15849
- process2(schema, ctx);
16146
+ processSchema(schema, ctx);
15850
16147
  extractDefs(ctx, schema);
15851
16148
  return finalize(ctx, schema);
15852
16149
  };
15853
16150
  var createStandardJSONSchemaMethod = (schema, io, processors = {}) => (params) => {
15854
16151
  const { libraryOptions, target } = params ?? {};
15855
16152
  const ctx = initializeContext({ ...libraryOptions ?? {}, target, io, processors });
15856
- process2(schema, ctx);
16153
+ processSchema(schema, ctx);
15857
16154
  extractDefs(ctx, schema);
15858
16155
  return finalize(ctx, schema);
15859
16156
  };
15860
16157
 
15861
16158
  // ../../node_modules/zod/v4/core/json-schema-processors.js
15862
- var formatMap = {
15863
- guid: "uuid",
16159
+ var narrowMin = (agg, key, value) => {
16160
+ if (agg[key] === void 0 || value > agg[key])
16161
+ agg[key] = value;
16162
+ };
16163
+ var narrowMax = (agg, key, value) => {
16164
+ if (agg[key] === void 0 || value < agg[key])
16165
+ agg[key] = value;
16166
+ };
16167
+ var narrowBoth = (agg, value) => {
16168
+ narrowMin(agg, "minimum", value);
16169
+ narrowMax(agg, "maximum", value);
16170
+ };
16171
+ var addDivisor = (agg, value) => {
16172
+ agg.multipleOf ?? (agg.multipleOf = []);
16173
+ if (!agg.multipleOf.includes(value))
16174
+ agg.multipleOf.push(value);
16175
+ };
16176
+ var addPattern = (agg, pattern) => {
16177
+ agg.patterns ?? (agg.patterns = /* @__PURE__ */ new Set());
16178
+ agg.patterns.add(pattern);
16179
+ };
16180
+ var intersectMime = (agg, mime) => {
16181
+ agg.mime = agg.mime ? agg.mime.filter((m) => mime.includes(m)) : [...mime];
16182
+ };
16183
+ var setFormat = (agg, format) => {
16184
+ agg.format = format;
16185
+ if (format.includes("int"))
16186
+ agg.isInt = true;
16187
+ };
16188
+ var minContributor = (agg, def) => narrowMin(agg, "minimum", def.minimum);
16189
+ var maxContributor = (agg, def) => narrowMax(agg, "maximum", def.maximum);
16190
+ var formatContributor = (ranges) => (agg, def) => {
16191
+ setFormat(agg, def.format);
16192
+ const [minimum, maximum] = ranges[def.format];
16193
+ narrowMin(agg, "minimum", minimum);
16194
+ narrowMax(agg, "maximum", maximum);
16195
+ };
16196
+ var contributors = {
16197
+ greater_than: (agg, def) => narrowMin(agg, def.inclusive ? "minimum" : "exclusiveMinimum", def.value),
16198
+ less_than: (agg, def) => narrowMax(agg, def.inclusive ? "maximum" : "exclusiveMaximum", def.value),
16199
+ multiple_of: (agg, def) => addDivisor(agg, def.value),
16200
+ number_format: formatContributor(NUMBER_FORMAT_RANGES),
16201
+ bigint_format: formatContributor(BIGINT_FORMAT_RANGES),
16202
+ min_length: minContributor,
16203
+ max_length: maxContributor,
16204
+ length_equals: (agg, def) => narrowBoth(agg, def.length),
16205
+ min_size: minContributor,
16206
+ max_size: maxContributor,
16207
+ size_equals: (agg, def) => narrowBoth(agg, def.size),
16208
+ string_format: (agg, def) => {
16209
+ setFormat(agg, def.format);
16210
+ if (def.pattern)
16211
+ addPattern(agg, def.pattern);
16212
+ if (def.format === "base64" || def.format === "base64url")
16213
+ agg.contentEncoding = def.format;
16214
+ if (def.local || def.precision === -1)
16215
+ agg.laxFormat = true;
16216
+ },
16217
+ mime_type: (agg, def) => intersectMime(agg, def.mime)
16218
+ };
16219
+ function aggregateChecks(schema) {
16220
+ const agg = {};
16221
+ const def = schema._zod.def;
16222
+ const list = schema._zod.traits.has("$ZodCheck") ? [schema, ...def.checks ?? []] : def.checks ?? [];
16223
+ for (const ch of list)
16224
+ contributors[ch._zod.def.check]?.(agg, ch._zod.def);
16225
+ const bag = schema._zod.bag;
16226
+ if (bag.minimum !== void 0)
16227
+ narrowMin(agg, "minimum", bag.minimum);
16228
+ if (bag.exclusiveMinimum !== void 0)
16229
+ narrowMin(agg, "exclusiveMinimum", bag.exclusiveMinimum);
16230
+ if (bag.maximum !== void 0)
16231
+ narrowMax(agg, "maximum", bag.maximum);
16232
+ if (bag.exclusiveMaximum !== void 0)
16233
+ narrowMax(agg, "exclusiveMaximum", bag.exclusiveMaximum);
16234
+ if (bag.multipleOf !== void 0)
16235
+ addDivisor(agg, bag.multipleOf);
16236
+ if (bag.format !== void 0) {
16237
+ agg.format ?? (agg.format = bag.format);
16238
+ if (bag.format.includes("int"))
16239
+ agg.isInt = true;
16240
+ }
16241
+ if (bag.mime)
16242
+ intersectMime(agg, bag.mime);
16243
+ for (const pattern of bag.patterns ?? [])
16244
+ addPattern(agg, pattern);
16245
+ return agg;
16246
+ }
16247
+ var formatMap = {
16248
+ guid: "uuid",
15864
16249
  url: "uri",
15865
16250
  datetime: "date-time",
15866
16251
  json_string: "json-string",
15867
16252
  regex: ""
15868
16253
  // do not set
15869
16254
  };
16255
+ var exactPatterns = /* @__PURE__ */ new Map([
16256
+ [base64Charset, base64],
16257
+ [base64urlCharset, base64url]
16258
+ ]);
16259
+ var exactPattern = (p) => exactPatterns.get(p) ?? p;
15870
16260
  var stringProcessor = (schema, ctx, _json, _params) => {
15871
16261
  const json2 = _json;
15872
16262
  json2.type = "string";
15873
- const { minimum, maximum, format, patterns, contentEncoding, laxFormat } = schema._zod.bag;
16263
+ const { minimum, maximum, format, patterns, contentEncoding, laxFormat } = aggregateChecks(schema);
15874
16264
  if (typeof minimum === "number")
15875
16265
  json2.minLength = minimum;
15876
16266
  if (typeof maximum === "number")
@@ -15886,7 +16276,7 @@ var stringProcessor = (schema, ctx, _json, _params) => {
15886
16276
  if (contentEncoding)
15887
16277
  json2.contentEncoding = contentEncoding;
15888
16278
  if (patterns && patterns.size > 0) {
15889
- const patternList = [...patterns];
16279
+ const patternList = [...patterns].map(exactPattern);
15890
16280
  if (patternList.length === 1)
15891
16281
  json2.pattern = patternList[0].source;
15892
16282
  else if (patternList.length > 1) {
@@ -15901,11 +16291,8 @@ var stringProcessor = (schema, ctx, _json, _params) => {
15901
16291
  };
15902
16292
  var numberProcessor = (schema, ctx, _json, params) => {
15903
16293
  const json2 = _json;
15904
- const { minimum, maximum, format, multipleOf, exclusiveMaximum, exclusiveMinimum } = schema._zod.bag;
15905
- if (typeof format === "string" && format.includes("int"))
15906
- json2.type = "integer";
15907
- else
15908
- json2.type = "number";
16294
+ const { minimum, maximum, multipleOf, exclusiveMaximum, exclusiveMinimum, isInt } = aggregateChecks(schema);
16295
+ json2.type = isInt ? "integer" : "number";
15909
16296
  const exMin = typeof exclusiveMinimum === "number" && exclusiveMinimum >= (minimum ?? Number.NEGATIVE_INFINITY);
15910
16297
  const exMax = typeof exclusiveMaximum === "number" && exclusiveMaximum <= (maximum ?? Number.POSITIVE_INFINITY);
15911
16298
  const legacy = ctx.target === "draft-04" || ctx.target === "openapi-3.0";
@@ -15929,11 +16316,19 @@ var numberProcessor = (schema, ctx, _json, params) => {
15929
16316
  } else if (typeof maximum === "number") {
15930
16317
  json2.maximum = maximum;
15931
16318
  }
15932
- if (typeof multipleOf === "number") {
15933
- if (Number.isFinite(multipleOf) && multipleOf !== 0)
15934
- json2.multipleOf = Math.abs(multipleOf);
15935
- else
15936
- handleUnrepresentable(schema, ctx, json2, params, `A multipleOf divisor of ${multipleOf} cannot be represented in JSON Schema`);
16319
+ if (multipleOf) {
16320
+ const divisors = /* @__PURE__ */ new Set();
16321
+ for (const divisor of multipleOf) {
16322
+ if (Number.isFinite(divisor) && divisor !== 0)
16323
+ divisors.add(Math.abs(divisor));
16324
+ else
16325
+ handleUnrepresentable(schema, ctx, json2, params, `A multipleOf divisor of ${divisor} cannot be represented in JSON Schema`);
16326
+ }
16327
+ const [first, ...rest] = divisors;
16328
+ if (first !== void 0)
16329
+ json2.multipleOf = first;
16330
+ if (rest.length)
16331
+ json2.allOf = [...json2.allOf ?? [], ...rest.map((m) => ({ multipleOf: m }))];
15937
16332
  }
15938
16333
  };
15939
16334
  var booleanProcessor = (_schema, _ctx, json2, _params) => {
@@ -16036,27 +16431,22 @@ var templateLiteralProcessor = (schema, _ctx, json2, _params) => {
16036
16431
  };
16037
16432
  var fileProcessor = (schema, _ctx, json2, _params) => {
16038
16433
  const _json = json2;
16039
- const file2 = {
16040
- type: "string",
16041
- format: "binary",
16042
- contentEncoding: "binary"
16043
- };
16044
- const { minimum, maximum, mime } = schema._zod.bag;
16434
+ _json.type = "string";
16435
+ _json.format = "binary";
16436
+ _json.contentEncoding = "binary";
16437
+ const { minimum, maximum, mime } = aggregateChecks(schema);
16045
16438
  if (minimum !== void 0)
16046
- file2.minLength = minimum;
16439
+ _json.minLength = minimum;
16047
16440
  if (maximum !== void 0)
16048
- file2.maxLength = maximum;
16049
- if (mime) {
16050
- if (mime.length === 1) {
16051
- file2.contentMediaType = mime[0];
16052
- Object.assign(_json, file2);
16053
- } else {
16054
- Object.assign(_json, file2);
16055
- _json.anyOf = mime.map((m) => ({ contentMediaType: m }));
16056
- }
16057
- } else {
16058
- Object.assign(_json, file2);
16059
- }
16441
+ _json.maxLength = maximum;
16442
+ if (!mime)
16443
+ return;
16444
+ if (mime.length === 0)
16445
+ _json.not = {};
16446
+ else if (mime.length === 1)
16447
+ _json.contentMediaType = mime[0];
16448
+ else
16449
+ _json.anyOf = mime.map((m) => ({ contentMediaType: m }));
16060
16450
  };
16061
16451
  var successProcessor = (_schema, _ctx, json2, _params) => {
16062
16452
  json2.type = "boolean";
@@ -16079,13 +16469,13 @@ var setProcessor = (schema, ctx, json2, params) => {
16079
16469
  var arrayProcessor = (schema, ctx, _json, params) => {
16080
16470
  const json2 = _json;
16081
16471
  const def = schema._zod.def;
16082
- const { minimum, maximum } = schema._zod.bag;
16472
+ const { minimum, maximum } = aggregateChecks(schema);
16083
16473
  if (typeof minimum === "number")
16084
16474
  json2.minItems = minimum;
16085
16475
  if (typeof maximum === "number")
16086
16476
  json2.maxItems = maximum;
16087
16477
  json2.type = "array";
16088
- json2.items = process2(def.element, ctx, {
16478
+ json2.items = processSchema(def.element, ctx, {
16089
16479
  ...params,
16090
16480
  path: [...params.path, "items"]
16091
16481
  });
@@ -16111,7 +16501,7 @@ var objectProcessor = (schema, ctx, _json, params) => {
16111
16501
  json2.type = "object";
16112
16502
  json2.properties = {};
16113
16503
  for (const key in shape) {
16114
- assignProp(json2.properties, key, process2(shape[key], ctx, {
16504
+ assignProp(json2.properties, key, processSchema(shape[key], ctx, {
16115
16505
  ...params,
16116
16506
  path: [...params.path, "properties", key]
16117
16507
  }));
@@ -16134,16 +16524,41 @@ var objectProcessor = (schema, ctx, _json, params) => {
16134
16524
  if (ctx.io === "output")
16135
16525
  json2.additionalProperties = false;
16136
16526
  } else if (def.catchall) {
16137
- json2.additionalProperties = process2(def.catchall, ctx, {
16527
+ json2.additionalProperties = processSchema(def.catchall, ctx, {
16138
16528
  ...params,
16139
16529
  path: [...params.path, "additionalProperties"]
16140
16530
  });
16141
16531
  }
16142
16532
  };
16533
+ var propertiesProcessor = (schema, ctx, _json, params) => {
16534
+ const json2 = _json;
16535
+ const def = schema._zod.def;
16536
+ if (Object.getOwnPropertySymbols(def.shape).length && handleUnrepresentable(schema, ctx, json2, params, "Symbol keys cannot be represented in JSON Schema")) {
16537
+ return;
16538
+ }
16539
+ if (ctx.io === "output") {
16540
+ for (const key in def.shape) {
16541
+ if (isTransforming(def.shape[key]) && handleUnrepresentable(schema, ctx, json2, params, `z.properties() returns its input, so the output of a transforming schema at key "${key}" cannot be represented in JSON Schema`)) {
16542
+ return;
16543
+ }
16544
+ }
16545
+ }
16546
+ json2.type = "object";
16547
+ json2.properties = {};
16548
+ for (const key in def.shape) {
16549
+ assignProp(json2.properties, key, processSchema(def.shape[key], ctx, {
16550
+ ...params,
16551
+ path: [...params.path, "properties", key]
16552
+ }));
16553
+ }
16554
+ const required2 = Object.keys(def.shape).filter((key) => inputOptin(def.shape[key]) === void 0);
16555
+ if (required2.length > 0)
16556
+ json2.required = required2;
16557
+ };
16143
16558
  var unionProcessor = (schema, ctx, json2, params) => {
16144
16559
  const def = schema._zod.def;
16145
16560
  const isExclusive = def.inclusive === false;
16146
- const options = def.options.map((x, i) => process2(x, ctx, {
16561
+ const options = def.options.map((x, i) => processSchema(x, ctx, {
16147
16562
  ...params,
16148
16563
  path: [...params.path, isExclusive ? "oneOf" : "anyOf", i]
16149
16564
  }));
@@ -16155,11 +16570,11 @@ var unionProcessor = (schema, ctx, json2, params) => {
16155
16570
  };
16156
16571
  var intersectionProcessor = (schema, ctx, json2, params) => {
16157
16572
  const def = schema._zod.def;
16158
- const a = process2(def.left, ctx, {
16573
+ const a = processSchema(def.left, ctx, {
16159
16574
  ...params,
16160
16575
  path: [...params.path, "allOf", 0]
16161
16576
  });
16162
- const b = process2(def.right, ctx, {
16577
+ const b = processSchema(def.right, ctx, {
16163
16578
  ...params,
16164
16579
  path: [...params.path, "allOf", 1]
16165
16580
  });
@@ -16177,11 +16592,11 @@ var tupleProcessor = (schema, ctx, _json, params) => {
16177
16592
  json2.type = "array";
16178
16593
  const prefixPath = ctx.target === "draft-2020-12" ? "prefixItems" : "items";
16179
16594
  const restPath = ctx.target === "draft-2020-12" ? "items" : ctx.target === "openapi-3.0" ? "items" : "additionalItems";
16180
- const prefixItems = def.items.map((x, i) => process2(x, ctx, {
16595
+ const prefixItems = def.items.map((x, i) => processSchema(x, ctx, {
16181
16596
  ...params,
16182
16597
  path: [...params.path, prefixPath, i]
16183
16598
  }));
16184
- const rest = def.rest ? process2(def.rest, ctx, {
16599
+ const rest = def.rest ? processSchema(def.rest, ctx, {
16185
16600
  ...params,
16186
16601
  path: [...params.path, restPath, ...ctx.target === "openapi-3.0" ? [def.items.length] : []]
16187
16602
  }) : null;
@@ -16229,7 +16644,7 @@ var tupleProcessor = (schema, ctx, _json, params) => {
16229
16644
  if (isClosed)
16230
16645
  json2.maxItems = maxItems;
16231
16646
  }
16232
- const { minimum, maximum } = schema._zod.bag;
16647
+ const { minimum, maximum } = aggregateChecks(schema);
16233
16648
  if (typeof minimum === "number")
16234
16649
  json2.minItems = minimum;
16235
16650
  if (typeof maximum === "number")
@@ -16303,20 +16718,19 @@ var recordProcessor = (schema, ctx, _json, params) => {
16303
16718
  const def = schema._zod.def;
16304
16719
  json2.type = "object";
16305
16720
  const keyType = def.keyType;
16306
- const keyBag = keyType._zod.bag;
16307
- const patterns = keyBag?.patterns;
16721
+ const patterns = aggregateChecks(keyType).patterns;
16308
16722
  if (def.mode === "loose" && patterns && patterns.size > 0) {
16309
- const valueSchema = process2(def.valueType, ctx, {
16723
+ const valueSchema = processSchema(def.valueType, ctx, {
16310
16724
  ...params,
16311
16725
  path: [...params.path, "patternProperties", "*"]
16312
16726
  });
16313
16727
  json2.patternProperties = {};
16314
16728
  for (const pattern of patterns) {
16315
- assignProp(json2.patternProperties, pattern.source, valueSchema);
16729
+ assignProp(json2.patternProperties, exactPattern(pattern).source, valueSchema);
16316
16730
  }
16317
16731
  } else {
16318
16732
  if (ctx.target === "draft-07" || ctx.target === "draft-2020-12") {
16319
- json2.propertyNames = process2(def.keyType, ctx, {
16733
+ json2.propertyNames = processSchema(def.keyType, ctx, {
16320
16734
  ...params,
16321
16735
  path: [...params.path, "propertyNames"]
16322
16736
  });
@@ -16328,7 +16742,7 @@ var recordProcessor = (schema, ctx, _json, params) => {
16328
16742
  }
16329
16743
  pending.push(schema);
16330
16744
  }
16331
- json2.additionalProperties = process2(def.valueType, ctx, {
16745
+ json2.additionalProperties = processSchema(def.valueType, ctx, {
16332
16746
  ...params,
16333
16747
  path: [...params.path, "additionalProperties"]
16334
16748
  });
@@ -16344,7 +16758,7 @@ var recordProcessor = (schema, ctx, _json, params) => {
16344
16758
  };
16345
16759
  var nullableProcessor = (schema, ctx, json2, params) => {
16346
16760
  const def = schema._zod.def;
16347
- const inner = process2(def.innerType, ctx, params);
16761
+ const inner = processSchema(def.innerType, ctx, params);
16348
16762
  const seen = ctx.seen.get(schema);
16349
16763
  if (ctx.target === "openapi-3.0") {
16350
16764
  seen.ref = def.innerType;
@@ -16355,7 +16769,7 @@ var nullableProcessor = (schema, ctx, json2, params) => {
16355
16769
  };
16356
16770
  var nonoptionalProcessor = (schema, ctx, _json, params) => {
16357
16771
  const def = schema._zod.def;
16358
- process2(def.innerType, ctx, params);
16772
+ processSchema(def.innerType, ctx, params);
16359
16773
  const seen = ctx.seen.get(schema);
16360
16774
  seen.ref = def.innerType;
16361
16775
  };
@@ -16375,7 +16789,7 @@ function serializeDefaultValue(value, schema, ctx, json2, params) {
16375
16789
  }
16376
16790
  var defaultProcessor = (schema, ctx, json2, params) => {
16377
16791
  const def = schema._zod.def;
16378
- process2(def.innerType, ctx, params);
16792
+ processSchema(def.innerType, ctx, params);
16379
16793
  const seen = ctx.seen.get(schema);
16380
16794
  seen.ref = def.innerType;
16381
16795
  const value = serializeDefaultValue(def.defaultValue, schema, ctx, json2, params);
@@ -16384,7 +16798,7 @@ var defaultProcessor = (schema, ctx, json2, params) => {
16384
16798
  };
16385
16799
  var prefaultProcessor = (schema, ctx, json2, params) => {
16386
16800
  const def = schema._zod.def;
16387
- process2(def.innerType, ctx, params);
16801
+ processSchema(def.innerType, ctx, params);
16388
16802
  const seen = ctx.seen.get(schema);
16389
16803
  seen.ref = def.innerType;
16390
16804
  if (ctx.io !== "input")
@@ -16395,7 +16809,7 @@ var prefaultProcessor = (schema, ctx, json2, params) => {
16395
16809
  };
16396
16810
  var catchProcessor = (schema, ctx, json2, params) => {
16397
16811
  const def = schema._zod.def;
16398
- process2(def.innerType, ctx, params);
16812
+ processSchema(def.innerType, ctx, params);
16399
16813
  const seen = ctx.seen.get(schema);
16400
16814
  seen.ref = def.innerType;
16401
16815
  let catchValue;
@@ -16411,32 +16825,32 @@ var pipeProcessor = (schema, ctx, _json, params) => {
16411
16825
  const def = schema._zod.def;
16412
16826
  const inIsTransform = def.in._zod.traits.has("$ZodTransform");
16413
16827
  const innerType = ctx.io === "input" ? inIsTransform ? def.out : def.in : def.out;
16414
- process2(innerType, ctx, params);
16828
+ processSchema(innerType, ctx, params);
16415
16829
  const seen = ctx.seen.get(schema);
16416
16830
  seen.ref = innerType;
16417
16831
  };
16418
16832
  var readonlyProcessor = (schema, ctx, json2, params) => {
16419
16833
  const def = schema._zod.def;
16420
- process2(def.innerType, ctx, params);
16834
+ processSchema(def.innerType, ctx, params);
16421
16835
  const seen = ctx.seen.get(schema);
16422
16836
  seen.ref = def.innerType;
16423
16837
  json2.readOnly = true;
16424
16838
  };
16425
16839
  var promiseProcessor = (schema, ctx, _json, params) => {
16426
16840
  const def = schema._zod.def;
16427
- process2(def.innerType, ctx, params);
16841
+ processSchema(def.innerType, ctx, params);
16428
16842
  const seen = ctx.seen.get(schema);
16429
16843
  seen.ref = def.innerType;
16430
16844
  };
16431
16845
  var optionalProcessor = (schema, ctx, _json, params) => {
16432
16846
  const def = schema._zod.def;
16433
- process2(def.innerType, ctx, params);
16847
+ processSchema(def.innerType, ctx, params);
16434
16848
  const seen = ctx.seen.get(schema);
16435
16849
  seen.ref = def.innerType;
16436
16850
  };
16437
16851
  var lazyProcessor = (schema, ctx, _json, params) => {
16438
16852
  const innerType = schema._zod.innerType;
16439
- process2(innerType, ctx, params);
16853
+ processSchema(innerType, ctx, params);
16440
16854
  const seen = ctx.seen.get(schema);
16441
16855
  seen.ref = innerType;
16442
16856
  };
@@ -16460,6 +16874,7 @@ var allProcessors = {
16460
16874
  file: fileProcessor,
16461
16875
  success: successProcessor,
16462
16876
  custom: customProcessor,
16877
+ properties: propertiesProcessor,
16463
16878
  function: functionProcessor,
16464
16879
  transform: transformProcessor,
16465
16880
  map: mapProcessor,
@@ -16488,7 +16903,7 @@ function toJSONSchema(input2, params) {
16488
16903
  const defs = {};
16489
16904
  for (const entry of registry2._idmap.entries()) {
16490
16905
  const [_, schema] = entry;
16491
- process2(schema, ctx2);
16906
+ processSchema(schema, ctx2);
16492
16907
  }
16493
16908
  const schemas = {};
16494
16909
  const external = {
@@ -16511,7 +16926,7 @@ function toJSONSchema(input2, params) {
16511
16926
  return { schemas };
16512
16927
  }
16513
16928
  const ctx = initializeContext({ ...params, processors: allProcessors });
16514
- process2(input2, ctx);
16929
+ processSchema(input2, ctx);
16515
16930
  extractDefs(ctx, input2);
16516
16931
  return finalize(ctx, input2);
16517
16932
  }
@@ -16570,7 +16985,7 @@ var JSONSchemaGenerator = class {
16570
16985
  * This must be called before emit().
16571
16986
  */
16572
16987
  process(schema, _params = { path: [], schemaPath: [] }) {
16573
- return process2(schema, this.ctx, _params);
16988
+ return processSchema(schema, this.ctx, _params);
16574
16989
  }
16575
16990
  /**
16576
16991
  * Emit the final JSON Schema after processing.
@@ -16627,12 +17042,14 @@ __export(schemas_exports2, {
16627
17042
  ZodFile: () => ZodFile,
16628
17043
  ZodFunction: () => ZodFunction,
16629
17044
  ZodGUID: () => ZodGUID,
17045
+ ZodIBAN: () => ZodIBAN,
16630
17046
  ZodIPv4: () => ZodIPv4,
16631
17047
  ZodIPv6: () => ZodIPv6,
16632
17048
  ZodISODate: () => ZodISODate,
16633
17049
  ZodISODateTime: () => ZodISODateTime,
16634
17050
  ZodISODuration: () => ZodISODuration,
16635
17051
  ZodISOTime: () => ZodISOTime,
17052
+ ZodInstanceOf: () => ZodInstanceOf,
16636
17053
  ZodIntersection: () => ZodIntersection,
16637
17054
  ZodJWT: () => ZodJWT,
16638
17055
  ZodKSUID: () => ZodKSUID,
@@ -16654,6 +17071,7 @@ __export(schemas_exports2, {
16654
17071
  ZodPrefault: () => ZodPrefault,
16655
17072
  ZodPreprocess: () => ZodPreprocess,
16656
17073
  ZodPromise: () => ZodPromise,
17074
+ ZodProperties: () => ZodProperties,
16657
17075
  ZodReadonly: () => ZodReadonly,
16658
17076
  ZodRecord: () => ZodRecord,
16659
17077
  ZodSet: () => ZodSet,
@@ -16709,6 +17127,7 @@ __export(schemas_exports2, {
16709
17127
  hex: () => hex2,
16710
17128
  hostname: () => hostname2,
16711
17129
  httpUrl: () => httpUrl,
17130
+ iban: () => iban2,
16712
17131
  instanceof: () => _instanceof,
16713
17132
  int: () => int,
16714
17133
  int32: () => int32,
@@ -16744,6 +17163,7 @@ __export(schemas_exports2, {
16744
17163
  prefault: () => prefault,
16745
17164
  preprocess: () => preprocess,
16746
17165
  promise: () => promise,
17166
+ properties: () => properties,
16747
17167
  readonly: () => readonly,
16748
17168
  record: () => record,
16749
17169
  refine: () => refine,
@@ -16797,7 +17217,6 @@ __export(checks_exports2, {
16797
17217
  normalize: () => _normalize,
16798
17218
  overwrite: () => _overwrite,
16799
17219
  positive: () => _positive,
16800
- properties: () => _properties,
16801
17220
  property: () => _property,
16802
17221
  regex: () => _regex,
16803
17222
  size: () => _size,
@@ -17011,6 +17430,12 @@ var ZodType = /* @__PURE__ */ $constructor("ZodType", (inst, def) => {
17011
17430
  set spa(value) {
17012
17431
  util_exports.own(this, "spa", value);
17013
17432
  },
17433
+ validate(data, params) {
17434
+ return validate(this, data, params);
17435
+ },
17436
+ validateAsync(data, params) {
17437
+ return validateAsync(this, data, params);
17438
+ },
17014
17439
  encode: function _encode2(data, params) {
17015
17440
  return encode2(this, data, params, { callee: _encode2 });
17016
17441
  },
@@ -17047,61 +17472,65 @@ var ZodType = /* @__PURE__ */ $constructor("ZodType", (inst, def) => {
17047
17472
  return this._zod.def;
17048
17473
  }
17049
17474
  });
17050
- var _ZodString = /* @__PURE__ */ $constructor("_ZodString", (inst, def) => {
17051
- $ZodString.init(inst, def);
17052
- ZodType.init(inst, def);
17053
- inst._zod.processJSONSchema = (ctx, json2, params) => stringProcessor(inst, ctx, json2, params);
17054
- const bag = inst._zod.bag;
17055
- inst.format = bag.format ?? null;
17056
- inst.minLength = bag.minimum ?? null;
17057
- inst.maxLength = bag.maximum ?? null;
17058
- }, {
17059
- regex(...args) {
17060
- return this.check(_regex(...args));
17061
- },
17062
- includes(...args) {
17063
- return this.check(_includes(...args));
17064
- },
17065
- startsWith(...args) {
17066
- return this.check(_startsWith(...args));
17067
- },
17068
- endsWith(...args) {
17069
- return this.check(_endsWith(...args));
17070
- },
17071
- min(...args) {
17072
- return this.check(_minLength(...args));
17073
- },
17074
- max(...args) {
17075
- return this.check(_maxLength(...args));
17076
- },
17077
- length(...args) {
17078
- return this.check(_length(...args));
17079
- },
17080
- nonempty(...args) {
17081
- return this.check(_minLength(1, ...args));
17082
- },
17083
- lowercase(params) {
17084
- return this.check(_lowercase(params));
17085
- },
17086
- uppercase(params) {
17087
- return this.check(_uppercase(params));
17088
- },
17089
- trim() {
17090
- return this.check(_trim());
17475
+ var _ZodString = /* @__PURE__ */ $constructor(
17476
+ "_ZodString",
17477
+ (inst, def) => {
17478
+ $ZodString.init(inst, def);
17479
+ ZodType.init(inst, def);
17480
+ inst._zod.processJSONSchema = (ctx, json2, params) => stringProcessor(inst, ctx, json2, params);
17091
17481
  },
17092
- normalize(...args) {
17093
- return this.check(_normalize(...args));
17094
- },
17095
- toLowerCase() {
17096
- return this.check(_toLowerCase());
17097
- },
17098
- toUpperCase() {
17099
- return this.check(_toUpperCase());
17100
- },
17101
- slugify() {
17102
- return this.check(_slugify());
17103
- }
17104
- });
17482
+ /* @__PURE__ */ util_exports.derived({
17483
+ format: (inst) => aggregateChecks(inst).format ?? null,
17484
+ minLength: (inst) => aggregateChecks(inst).minimum ?? null,
17485
+ maxLength: (inst) => aggregateChecks(inst).maximum ?? null
17486
+ }, {
17487
+ regex(...args) {
17488
+ return this.check(_regex(...args));
17489
+ },
17490
+ includes(...args) {
17491
+ return this.check(_includes(...args));
17492
+ },
17493
+ startsWith(...args) {
17494
+ return this.check(_startsWith(...args));
17495
+ },
17496
+ endsWith(...args) {
17497
+ return this.check(_endsWith(...args));
17498
+ },
17499
+ min(...args) {
17500
+ return this.check(_minLength(...args));
17501
+ },
17502
+ max(...args) {
17503
+ return this.check(_maxLength(...args));
17504
+ },
17505
+ length(...args) {
17506
+ return this.check(_length(...args));
17507
+ },
17508
+ nonempty(...args) {
17509
+ return this.check(_minLength(1, ...args));
17510
+ },
17511
+ lowercase(params) {
17512
+ return this.check(_lowercase(params));
17513
+ },
17514
+ uppercase(params) {
17515
+ return this.check(_uppercase(params));
17516
+ },
17517
+ trim() {
17518
+ return this.check(_trim());
17519
+ },
17520
+ normalize(...args) {
17521
+ return this.check(_normalize(...args));
17522
+ },
17523
+ toLowerCase() {
17524
+ return this.check(_toLowerCase());
17525
+ },
17526
+ toUpperCase() {
17527
+ return this.check(_toUpperCase());
17528
+ },
17529
+ slugify() {
17530
+ return this.check(_slugify());
17531
+ }
17532
+ })
17533
+ );
17105
17534
  var ZodString = /* @__PURE__ */ $constructor("ZodString", (inst, def) => {
17106
17535
  $ZodString.init(inst, def);
17107
17536
  _ZodString.init(inst, def);
@@ -17364,6 +17793,13 @@ var ZodCreditCard = /* @__PURE__ */ $constructor("ZodCreditCard", (inst, def) =>
17364
17793
  function creditCard2(params) {
17365
17794
  return _creditCard(ZodCreditCard, params);
17366
17795
  }
17796
+ var ZodIBAN = /* @__PURE__ */ $constructor("ZodIBAN", (inst, def) => {
17797
+ $ZodIBAN.init(inst, def);
17798
+ ZodStringFormat.init(inst, def);
17799
+ });
17800
+ function iban2(params) {
17801
+ return _iban(ZodIBAN, params);
17802
+ }
17367
17803
  var ZodJWT = /* @__PURE__ */ $constructor("ZodJWT", (inst, def) => {
17368
17804
  $ZodJWT.init(inst, def);
17369
17805
  ZodStringFormat.init(inst, def);
@@ -17392,63 +17828,76 @@ function hash(alg, params) {
17392
17828
  throw new Error(`Unrecognized hash format: ${format}`);
17393
17829
  return _stringFormat(ZodCustomStringFormat, format, regex, params);
17394
17830
  }
17395
- var ZodNumber = /* @__PURE__ */ $constructor("ZodNumber", (inst, def) => {
17396
- $ZodNumber.init(inst, def);
17397
- ZodType.init(inst, def);
17398
- inst._zod.processJSONSchema = (ctx, json2, params) => numberProcessor(inst, ctx, json2, params);
17399
- const bag = inst._zod.bag;
17400
- inst.minValue = Math.max(bag.minimum ?? Number.NEGATIVE_INFINITY, bag.exclusiveMinimum ?? Number.NEGATIVE_INFINITY) ?? null;
17401
- inst.maxValue = Math.min(bag.maximum ?? Number.POSITIVE_INFINITY, bag.exclusiveMaximum ?? Number.POSITIVE_INFINITY) ?? null;
17402
- inst.isInt = (bag.format ?? "").includes("int") || Number.isSafeInteger(bag.multipleOf ?? 0.5);
17403
- inst.isFinite = true;
17404
- inst.format = bag.format ?? null;
17405
- }, {
17406
- gt(value, params) {
17407
- return this.check(_gt(value, params));
17408
- },
17409
- gte(value, params) {
17410
- return this.check(_gte(value, params));
17411
- },
17412
- min(value, params) {
17413
- return this.check(_gte(value, params));
17414
- },
17415
- lt(value, params) {
17416
- return this.check(_lt(value, params));
17417
- },
17418
- lte(value, params) {
17419
- return this.check(_lte(value, params));
17420
- },
17421
- max(value, params) {
17422
- return this.check(_lte(value, params));
17423
- },
17424
- int(params) {
17425
- return this.check(int(params));
17831
+ var ZodNumber = /* @__PURE__ */ $constructor(
17832
+ "ZodNumber",
17833
+ (inst, def) => {
17834
+ $ZodNumber.init(inst, def);
17835
+ ZodType.init(inst, def);
17836
+ inst._zod.processJSONSchema = (ctx, json2, params) => numberProcessor(inst, ctx, json2, params);
17837
+ inst.isFinite = true;
17426
17838
  },
17427
- safe(params) {
17428
- return this.check(int(params));
17429
- },
17430
- positive(params) {
17431
- return this.check(_gt(0, params));
17432
- },
17433
- nonnegative(params) {
17434
- return this.check(_gte(0, params));
17435
- },
17436
- negative(params) {
17437
- return this.check(_lt(0, params));
17438
- },
17439
- nonpositive(params) {
17440
- return this.check(_lte(0, params));
17441
- },
17442
- multipleOf(value, params) {
17443
- return this.check(_multipleOf(value, params));
17444
- },
17445
- step(value, params) {
17446
- return this.check(_multipleOf(value, params));
17447
- },
17448
- finite() {
17449
- return this;
17450
- }
17451
- });
17839
+ /* @__PURE__ */ util_exports.derived({
17840
+ minValue: (inst) => {
17841
+ const { minimum, exclusiveMinimum } = aggregateChecks(inst);
17842
+ return Math.max(minimum ?? Number.NEGATIVE_INFINITY, exclusiveMinimum ?? Number.NEGATIVE_INFINITY);
17843
+ },
17844
+ maxValue: (inst) => {
17845
+ const { maximum, exclusiveMaximum } = aggregateChecks(inst);
17846
+ return Math.min(maximum ?? Number.POSITIVE_INFINITY, exclusiveMaximum ?? Number.POSITIVE_INFINITY);
17847
+ },
17848
+ isInt: (inst) => {
17849
+ const { isInt, multipleOf } = aggregateChecks(inst);
17850
+ return !!isInt || !!multipleOf?.some(Number.isSafeInteger);
17851
+ },
17852
+ format: (inst) => aggregateChecks(inst).format ?? null
17853
+ }, {
17854
+ gt(value, params) {
17855
+ return this.check(_gt(value, params));
17856
+ },
17857
+ gte(value, params) {
17858
+ return this.check(_gte(value, params));
17859
+ },
17860
+ min(value, params) {
17861
+ return this.check(_gte(value, params));
17862
+ },
17863
+ lt(value, params) {
17864
+ return this.check(_lt(value, params));
17865
+ },
17866
+ lte(value, params) {
17867
+ return this.check(_lte(value, params));
17868
+ },
17869
+ max(value, params) {
17870
+ return this.check(_lte(value, params));
17871
+ },
17872
+ int(params) {
17873
+ return this.check(int(params));
17874
+ },
17875
+ safe(params) {
17876
+ return this.check(int(params));
17877
+ },
17878
+ positive(params) {
17879
+ return this.check(_gt(0, params));
17880
+ },
17881
+ nonnegative(params) {
17882
+ return this.check(_gte(0, params));
17883
+ },
17884
+ negative(params) {
17885
+ return this.check(_lt(0, params));
17886
+ },
17887
+ nonpositive(params) {
17888
+ return this.check(_lte(0, params));
17889
+ },
17890
+ multipleOf(value, params) {
17891
+ return this.check(_multipleOf(value, params));
17892
+ },
17893
+ step(value, params) {
17894
+ return this.check(_multipleOf(value, params));
17895
+ },
17896
+ finite() {
17897
+ return this;
17898
+ }
17899
+ })
17900
+ );
17452
17901
  function number2(params) {
17453
17902
  return _number(ZodNumber, params);
17454
17903
  }
@@ -17479,49 +17928,53 @@ var ZodBoolean = /* @__PURE__ */ $constructor("ZodBoolean", (inst, def) => {
17479
17928
  function boolean2(params) {
17480
17929
  return _boolean(ZodBoolean, params);
17481
17930
  }
17482
- var ZodBigInt = /* @__PURE__ */ $constructor("ZodBigInt", (inst, def) => {
17483
- $ZodBigInt.init(inst, def);
17484
- ZodType.init(inst, def);
17485
- inst._zod.processJSONSchema = (ctx, json2, params) => bigintProcessor(inst, ctx, json2, params);
17486
- const bag = inst._zod.bag;
17487
- inst.minValue = bag.minimum ?? null;
17488
- inst.maxValue = bag.maximum ?? null;
17489
- inst.format = bag.format ?? null;
17490
- }, {
17491
- gte(value, params) {
17492
- return this.check(_gte(value, params));
17493
- },
17494
- min(value, params) {
17495
- return this.check(_gte(value, params));
17496
- },
17497
- gt(value, params) {
17498
- return this.check(_gt(value, params));
17931
+ var ZodBigInt = /* @__PURE__ */ $constructor(
17932
+ "ZodBigInt",
17933
+ (inst, def) => {
17934
+ $ZodBigInt.init(inst, def);
17935
+ ZodType.init(inst, def);
17936
+ inst._zod.processJSONSchema = (ctx, json2, params) => bigintProcessor(inst, ctx, json2, params);
17499
17937
  },
17500
- lt(value, params) {
17501
- return this.check(_lt(value, params));
17502
- },
17503
- lte(value, params) {
17504
- return this.check(_lte(value, params));
17505
- },
17506
- max(value, params) {
17507
- return this.check(_lte(value, params));
17508
- },
17509
- positive(params) {
17510
- return this.check(_gt(BigInt(0), params));
17511
- },
17512
- negative(params) {
17513
- return this.check(_lt(BigInt(0), params));
17514
- },
17515
- nonpositive(params) {
17516
- return this.check(_lte(BigInt(0), params));
17517
- },
17518
- nonnegative(params) {
17519
- return this.check(_gte(BigInt(0), params));
17520
- },
17521
- multipleOf(value, params) {
17522
- return this.check(_multipleOf(value, params));
17523
- }
17524
- });
17938
+ /* @__PURE__ */ util_exports.derived({
17939
+ minValue: (inst) => aggregateChecks(inst).minimum ?? null,
17940
+ maxValue: (inst) => aggregateChecks(inst).maximum ?? null,
17941
+ format: (inst) => aggregateChecks(inst).format ?? null
17942
+ }, {
17943
+ gte(value, params) {
17944
+ return this.check(_gte(value, params));
17945
+ },
17946
+ min(value, params) {
17947
+ return this.check(_gte(value, params));
17948
+ },
17949
+ gt(value, params) {
17950
+ return this.check(_gt(value, params));
17951
+ },
17952
+ lt(value, params) {
17953
+ return this.check(_lt(value, params));
17954
+ },
17955
+ lte(value, params) {
17956
+ return this.check(_lte(value, params));
17957
+ },
17958
+ max(value, params) {
17959
+ return this.check(_lte(value, params));
17960
+ },
17961
+ positive(params) {
17962
+ return this.check(_gt(BigInt(0), params));
17963
+ },
17964
+ negative(params) {
17965
+ return this.check(_lt(BigInt(0), params));
17966
+ },
17967
+ nonpositive(params) {
17968
+ return this.check(_lte(BigInt(0), params));
17969
+ },
17970
+ nonnegative(params) {
17971
+ return this.check(_gte(BigInt(0), params));
17972
+ },
17973
+ multipleOf(value, params) {
17974
+ return this.check(_multipleOf(value, params));
17975
+ }
17976
+ })
17977
+ );
17525
17978
  function bigint2(params) {
17526
17979
  return _bigint(ZodBigInt, params);
17527
17980
  }
@@ -17591,16 +18044,26 @@ var ZodVoid = /* @__PURE__ */ $constructor("ZodVoid", (inst, def) => {
17591
18044
  function _void2(params) {
17592
18045
  return _void(ZodVoid, params);
17593
18046
  }
17594
- var ZodDate = /* @__PURE__ */ $constructor("ZodDate", (inst, def) => {
17595
- $ZodDate.init(inst, def);
17596
- ZodType.init(inst, def);
17597
- inst._zod.processJSONSchema = (ctx, json2, params) => dateProcessor(inst, ctx, json2, params);
17598
- inst.min = (value, params) => inst.check(_gte(value, params));
17599
- inst.max = (value, params) => inst.check(_lte(value, params));
17600
- const c = inst._zod.bag;
17601
- inst.minDate = c.minimum ? new Date(c.minimum) : null;
17602
- inst.maxDate = c.maximum ? new Date(c.maximum) : null;
17603
- });
18047
+ var ZodDate = /* @__PURE__ */ $constructor(
18048
+ "ZodDate",
18049
+ (inst, def) => {
18050
+ $ZodDate.init(inst, def);
18051
+ ZodType.init(inst, def);
18052
+ inst._zod.processJSONSchema = (ctx, json2, params) => dateProcessor(inst, ctx, json2, params);
18053
+ inst.min = (value, params) => inst.check(_gte(value, params));
18054
+ inst.max = (value, params) => inst.check(_lte(value, params));
18055
+ },
18056
+ /* @__PURE__ */ util_exports.derived({
18057
+ minDate: (inst) => {
18058
+ const { minimum } = aggregateChecks(inst);
18059
+ return minimum ? new Date(minimum) : null;
18060
+ },
18061
+ maxDate: (inst) => {
18062
+ const { maximum } = aggregateChecks(inst);
18063
+ return maximum ? new Date(maximum) : null;
18064
+ }
18065
+ }, {})
18066
+ );
17604
18067
  function date2(params) {
17605
18068
  return _date(ZodDate, params);
17606
18069
  }
@@ -17645,19 +18108,19 @@ var ZodObject = /* @__PURE__ */ $constructor("ZodObject", (inst, def) => {
17645
18108
  return _enum2(Object.keys(this._zod.def.shape));
17646
18109
  },
17647
18110
  catchall(catchall) {
17648
- return this.clone({ ...this._zod.def, catchall });
18111
+ return this.clone(util_exports.mergeDefs(this._zod.def, { catchall }));
17649
18112
  },
17650
18113
  passthrough() {
17651
- return this.clone({ ...this._zod.def, catchall: unknown() });
18114
+ return this.clone(util_exports.mergeDefs(this._zod.def, { catchall: unknown() }));
17652
18115
  },
17653
18116
  loose() {
17654
- return this.clone({ ...this._zod.def, catchall: unknown() });
18117
+ return this.clone(util_exports.mergeDefs(this._zod.def, { catchall: unknown() }));
17655
18118
  },
17656
18119
  strict() {
17657
- return this.clone({ ...this._zod.def, catchall: never() });
18120
+ return this.clone(util_exports.mergeDefs(this._zod.def, { catchall: never() }));
17658
18121
  },
17659
18122
  strip() {
17660
- return this.clone({ ...this._zod.def, catchall: void 0 });
18123
+ return this.clone(util_exports.mergeDefs(this._zod.def, { catchall: void 0 }));
17661
18124
  },
17662
18125
  extend(incoming) {
17663
18126
  return util_exports.extend(this, incoming);
@@ -17876,7 +18339,7 @@ var ZodEnum = /* @__PURE__ */ $constructor("ZodEnum", (inst, def) => {
17876
18339
  ZodType.init(inst, def);
17877
18340
  inst._zod.processJSONSchema = (ctx, json2, params) => enumProcessor(inst, ctx, json2, params);
17878
18341
  inst.enum = def.entries;
17879
- inst.options = Object.values(def.entries);
18342
+ inst.options = [...inst._zod.values];
17880
18343
  const keys = new Set(Object.keys(def.entries));
17881
18344
  inst.extract = (values, params) => {
17882
18345
  const newEntries = {};
@@ -18220,6 +18683,14 @@ var ZodCustom = /* @__PURE__ */ $constructor("ZodCustom", (inst, def) => {
18220
18683
  ZodType.init(inst, def);
18221
18684
  inst._zod.processJSONSchema = (ctx, json2, params) => customProcessor(inst, ctx, json2, params);
18222
18685
  });
18686
+ var ZodProperties = /* @__PURE__ */ $constructor("ZodProperties", (inst, def) => {
18687
+ _ensureDefaultMemoizer();
18688
+ $ZodProperties.init(inst, def);
18689
+ ZodType.init(inst, def);
18690
+ });
18691
+ function properties(shape, params) {
18692
+ return _properties(ZodProperties, shape, params);
18693
+ }
18223
18694
  function check(fn) {
18224
18695
  const ch = new $ZodCheck({
18225
18696
  check: "custom"
@@ -18239,8 +18710,15 @@ function superRefine(fn, params) {
18239
18710
  }
18240
18711
  var describe2 = describe;
18241
18712
  var meta2 = meta;
18713
+ var ZodInstanceOf = /* @__PURE__ */ $constructor("ZodInstanceOf", (inst, def) => {
18714
+ ZodCustom.init(inst, def);
18715
+ }, {
18716
+ properties(shape, params) {
18717
+ return this.check(properties(shape, params));
18718
+ }
18719
+ });
18242
18720
  function _instanceof(cls, params = {}) {
18243
- const inst = new ZodCustom({
18721
+ const inst = new ZodInstanceOf({
18244
18722
  type: "custom",
18245
18723
  check: "custom",
18246
18724
  fn: (data) => data instanceof cls,
@@ -18445,27 +18923,188 @@ function resolveRef(ref, ctx) {
18445
18923
  }
18446
18924
  throw new Error(`Reference not found: ${ref}`);
18447
18925
  }
18448
- function checkPropertyNames(objectSchema, keySchema) {
18926
+ function checkObjectGuards(objectSchema, guards) {
18449
18927
  const guard = z.transform((value) => value).check((payload) => {
18450
18928
  const value = payload.value;
18451
18929
  if (typeof value !== "object" || value === null || Array.isArray(value))
18452
18930
  return;
18453
- for (const key of Object.getOwnPropertyNames(value)) {
18454
- const result = keySchema.safeParse(key);
18455
- if (result.success)
18456
- continue;
18931
+ const keys = Object.getOwnPropertyNames(value);
18932
+ if (guards.minProperties !== void 0 && keys.length < guards.minProperties) {
18457
18933
  payload.issues.push({
18458
- code: "invalid_key",
18459
- origin: "record",
18460
- issues: result.error.issues,
18461
- input: key,
18462
- path: [key],
18934
+ origin: "object",
18935
+ code: "too_small",
18936
+ minimum: guards.minProperties,
18937
+ inclusive: true,
18938
+ message: `Too small: expected object to have >=${guards.minProperties} properties`,
18939
+ input: value,
18940
+ inst: objectSchema,
18941
+ continue: true
18942
+ });
18943
+ }
18944
+ if (guards.maxProperties !== void 0 && keys.length > guards.maxProperties) {
18945
+ payload.issues.push({
18946
+ origin: "object",
18947
+ code: "too_big",
18948
+ maximum: guards.maxProperties,
18949
+ inclusive: true,
18950
+ message: `Too big: expected object to have <=${guards.maxProperties} properties`,
18951
+ input: value,
18952
+ inst: objectSchema,
18463
18953
  continue: true
18464
18954
  });
18465
18955
  }
18956
+ if (guards.keySchema) {
18957
+ for (const key of keys) {
18958
+ const result = guards.keySchema.safeParse(key);
18959
+ if (result.success)
18960
+ continue;
18961
+ payload.issues.push({
18962
+ code: "invalid_key",
18963
+ origin: "record",
18964
+ issues: result.error.issues,
18965
+ input: key,
18966
+ path: [key],
18967
+ continue: true
18968
+ });
18969
+ }
18970
+ }
18466
18971
  });
18467
18972
  return guard.pipe(objectSchema);
18468
18973
  }
18974
+ function canonicalKey(value, seen) {
18975
+ if (value === null)
18976
+ return "z";
18977
+ const type = typeof value;
18978
+ if (type !== "object") {
18979
+ if (type === "number" && Number.isNaN(value))
18980
+ return null;
18981
+ const raw = String(value);
18982
+ return `${type[0]}${raw.length}:${raw}`;
18983
+ }
18984
+ if (seen.has(value))
18985
+ return null;
18986
+ seen.add(value);
18987
+ try {
18988
+ if (Array.isArray(value)) {
18989
+ const parts2 = [];
18990
+ for (const item of value) {
18991
+ const key = canonicalKey(item, seen);
18992
+ if (key === null)
18993
+ return null;
18994
+ parts2.push(key);
18995
+ }
18996
+ return `a${parts2.length}:[${parts2.join(",")}]`;
18997
+ }
18998
+ const keys = Object.keys(value).sort();
18999
+ const parts = [];
19000
+ for (const k of keys) {
19001
+ const key = canonicalKey(value[k], seen);
19002
+ if (key === null)
19003
+ return null;
19004
+ parts.push(`${k.length}:${k}=${key}`);
19005
+ }
19006
+ return `o${parts.length}:{${parts.join(",")}}`;
19007
+ } finally {
19008
+ seen.delete(value);
19009
+ }
19010
+ }
19011
+ var SCHEMA_KEYWORDS = /* @__PURE__ */ new Set([
19012
+ "items",
19013
+ "prefixItems",
19014
+ "additionalItems",
19015
+ "additionalProperties",
19016
+ "contains",
19017
+ "propertyNames",
19018
+ "not",
19019
+ "if",
19020
+ "then",
19021
+ "else",
19022
+ "allOf",
19023
+ "anyOf",
19024
+ "oneOf",
19025
+ "unevaluatedItems",
19026
+ "unevaluatedProperties",
19027
+ "contentSchema"
19028
+ ]);
19029
+ var SCHEMA_MAP_KEYWORDS = /* @__PURE__ */ new Set([
19030
+ "properties",
19031
+ "patternProperties",
19032
+ "dependentSchemas",
19033
+ "dependencies",
19034
+ "$defs",
19035
+ "definitions"
19036
+ ]);
19037
+ function containsRef(value) {
19038
+ if (typeof value !== "object" || value === null)
19039
+ return false;
19040
+ if (Array.isArray(value))
19041
+ return value.some(containsRef);
19042
+ if (typeof value.$ref === "string")
19043
+ return true;
19044
+ return Object.entries(value).some(([key, sub]) => {
19045
+ if (SCHEMA_KEYWORDS.has(key))
19046
+ return containsRef(sub);
19047
+ if (!SCHEMA_MAP_KEYWORDS.has(key) || typeof sub !== "object" || sub === null)
19048
+ return false;
19049
+ return Object.values(sub).some(containsRef);
19050
+ });
19051
+ }
19052
+ function plural(n) {
19053
+ return n === 1 ? "element" : "elements";
19054
+ }
19055
+ function checkArrayGuards(arraySchema, guards) {
19056
+ const guard = z.transform((value) => value).check((payload) => {
19057
+ const items = payload.value;
19058
+ if (!Array.isArray(items))
19059
+ return;
19060
+ if (guards.uniqueItems === true) {
19061
+ const firstSeen = /* @__PURE__ */ new Map();
19062
+ for (let i = 0; i < items.length; i++) {
19063
+ const key = canonicalKey(items[i], /* @__PURE__ */ new Set());
19064
+ if (key === null)
19065
+ continue;
19066
+ const first = firstSeen.get(key);
19067
+ if (first === void 0) {
19068
+ firstSeen.set(key, i);
19069
+ continue;
19070
+ }
19071
+ payload.issues.push({
19072
+ code: "custom",
19073
+ message: `Array items must be unique: element at index ${i} duplicates the one at index ${first}`,
19074
+ input: items,
19075
+ path: [i],
19076
+ continue: true
19077
+ });
19078
+ }
19079
+ }
19080
+ if (guards.containsSchema) {
19081
+ const minContains = guards.minContains ?? 1;
19082
+ const ceiling = guards.maxContains !== void 0 ? guards.maxContains + 1 : Number.POSITIVE_INFINITY;
19083
+ let matches = 0;
19084
+ for (const item of items) {
19085
+ if (guards.containsSchema.safeParse(item).success && ++matches >= ceiling)
19086
+ break;
19087
+ }
19088
+ if (matches < minContains) {
19089
+ payload.issues.push({
19090
+ code: "custom",
19091
+ message: `Array must contain at least ${minContains} matching ${plural(minContains)}; found ${matches}`,
19092
+ input: items,
19093
+ continue: true
19094
+ });
19095
+ }
19096
+ if (guards.maxContains !== void 0 && matches > guards.maxContains) {
19097
+ payload.issues.push({
19098
+ code: "custom",
19099
+ message: `Array must contain at most ${guards.maxContains} matching ${plural(guards.maxContains)}`,
19100
+ input: items,
19101
+ continue: true
19102
+ });
19103
+ }
19104
+ }
19105
+ });
19106
+ return guard.pipe(arraySchema);
19107
+ }
18469
19108
  function getTupleRest(restSchema, ctx) {
18470
19109
  if (restSchema === false) {
18471
19110
  return void 0;
@@ -18595,6 +19234,8 @@ function convertBaseSchema(schema, ctx) {
18595
19234
  stringSchema = stringSchema.check(z.e164());
18596
19235
  } else if (format === "credit_card") {
18597
19236
  stringSchema = stringSchema.check(z.creditCard());
19237
+ } else if (format === "iban") {
19238
+ stringSchema = stringSchema.check(z.iban());
18598
19239
  } else if (format === "jwt") {
18599
19240
  stringSchema = stringSchema.check(z.jwt());
18600
19241
  } else if (format === "emoji") {
@@ -18660,10 +19301,10 @@ function convertBaseSchema(schema, ctx) {
18660
19301
  }
18661
19302
  case "object": {
18662
19303
  const shape = {};
18663
- const properties = schema.properties || {};
19304
+ const properties2 = schema.properties || {};
18664
19305
  const requiredSet = new Set(schema.required || []);
18665
19306
  const additionalSchema = typeof schema.additionalProperties === "object" ? convertSchema(schema.additionalProperties, ctx) : void 0;
18666
- for (const [key, propSchema] of Object.entries(properties)) {
19307
+ for (const [key, propSchema] of Object.entries(properties2)) {
18667
19308
  const propZodSchema = convertSchema(propSchema, ctx);
18668
19309
  assignProp(shape, key, requiredSet.has(key) ? propZodSchema : propZodSchema.optional());
18669
19310
  }
@@ -18727,9 +19368,16 @@ function convertBaseSchema(schema, ctx) {
18727
19368
  zodSchema = objectSchema.passthrough();
18728
19369
  }
18729
19370
  }
18730
- if (schema.propertyNames !== void 0 && schema.propertyNames !== true) {
18731
- const keyJSONSchema = typeof schema.propertyNames === "object" && schema.propertyNames.type === void 0 ? { type: "string", ...schema.propertyNames } : schema.propertyNames;
18732
- zodSchema = checkPropertyNames(zodSchema, convertSchema(keyJSONSchema, ctx));
19371
+ const hasKeyGuard = schema.propertyNames !== void 0 && schema.propertyNames !== true;
19372
+ const minProperties = typeof schema.minProperties === "number" ? schema.minProperties : void 0;
19373
+ const maxProperties = typeof schema.maxProperties === "number" ? schema.maxProperties : void 0;
19374
+ if (hasKeyGuard || minProperties !== void 0 || maxProperties !== void 0) {
19375
+ let keySchema;
19376
+ if (hasKeyGuard) {
19377
+ const keyJSONSchema = typeof schema.propertyNames === "object" && schema.propertyNames.type === void 0 ? { type: "string", ...schema.propertyNames } : schema.propertyNames;
19378
+ keySchema = convertSchema(keyJSONSchema, ctx);
19379
+ }
19380
+ zodSchema = checkObjectGuards(zodSchema, { keySchema, minProperties, maxProperties });
18733
19381
  }
18734
19382
  break;
18735
19383
  }
@@ -18775,6 +19423,14 @@ function convertBaseSchema(schema, ctx) {
18775
19423
  } else {
18776
19424
  zodSchema = z.array(z.any());
18777
19425
  }
19426
+ if (schema.uniqueItems === true || schema.contains !== void 0) {
19427
+ zodSchema = checkArrayGuards(zodSchema, {
19428
+ uniqueItems: schema.uniqueItems === true,
19429
+ containsSchema: schema.contains !== void 0 ? convertSchema(schema.contains, ctx) : void 0,
19430
+ minContains: typeof schema.minContains === "number" ? schema.minContains : void 0,
19431
+ maxContains: typeof schema.maxContains === "number" ? schema.maxContains : void 0
19432
+ });
19433
+ }
18778
19434
  break;
18779
19435
  }
18780
19436
  default:
@@ -18832,8 +19488,23 @@ function convertSchema(schema, ctx) {
18832
19488
  extraMeta[key] = schema[key];
18833
19489
  }
18834
19490
  }
18835
- if (schema.propertyNames !== void 0 && schema.type === "object" && schema.$ref === void 0) {
18836
- extraMeta.propertyNames = schema.propertyNames;
19491
+ if (schema.type === "object" && schema.$ref === void 0) {
19492
+ if (schema.propertyNames !== void 0 && !containsRef(schema.propertyNames)) {
19493
+ extraMeta.propertyNames = schema.propertyNames;
19494
+ }
19495
+ for (const key of ["minProperties", "maxProperties"]) {
19496
+ if (schema[key] !== void 0)
19497
+ extraMeta[key] = schema[key];
19498
+ }
19499
+ }
19500
+ if (schema.type === "array" && schema.$ref === void 0) {
19501
+ if (schema.contains !== void 0 && !containsRef(schema.contains)) {
19502
+ extraMeta.contains = schema.contains;
19503
+ }
19504
+ for (const key of ["uniqueItems", "minContains", "maxContains"]) {
19505
+ if (schema[key] !== void 0)
19506
+ extraMeta[key] = schema[key];
19507
+ }
18837
19508
  }
18838
19509
  for (const key of Object.keys(schema)) {
18839
19510
  if (!RECOGNIZED_KEYS.has(key)) {
@@ -18994,6 +19665,18 @@ function visit(schema, fnOrHandlers) {
18994
19665
  const { _cachedInner, ...rest } = def;
18995
19666
  return clone(s, { ...rest, getter: () => run(original()) });
18996
19667
  }
19668
+ case "properties": {
19669
+ const oldShape = def.shape;
19670
+ let changed = false;
19671
+ const newShape = {};
19672
+ for (const k of Reflect.ownKeys(oldShape)) {
19673
+ const mapped = run(oldShape[k]);
19674
+ if (mapped !== oldShape[k])
19675
+ changed = true;
19676
+ newShape[k] = mapped;
19677
+ }
19678
+ return changed ? clone(s, { ...def, shape: newShape }) : s;
19679
+ }
18997
19680
  // A leaf by choice: `parts` are regex fragments, not data positions.
18998
19681
  case "template_literal":
18999
19682
  // Leaves.
@@ -19109,6 +19792,15 @@ var sendAdminTestEmailRequestSchema = external_exports.object({
19109
19792
  var sendAdminTestEmailResponseSchema = external_exports.object({
19110
19793
  messageId: external_exports.string()
19111
19794
  });
19795
+ var MAX_ADMIT_USERS_PER_REQUEST = 5e3;
19796
+ var MAX_TODOIST_USER_ID_LENGTH = 255;
19797
+ var admitUsersRequestSchema = external_exports.object({
19798
+ userIds: external_exports.array(external_exports.string().regex(/^\d+$/).max(MAX_TODOIST_USER_ID_LENGTH)).min(1).max(MAX_ADMIT_USERS_PER_REQUEST)
19799
+ });
19800
+ var admitUsersResponseSchema = external_exports.object({
19801
+ admitted: external_exports.number().int().nonnegative(),
19802
+ alreadyAllowed: external_exports.number().int().nonnegative()
19803
+ });
19112
19804
 
19113
19805
  // ../../packages/core/dist/esm/types/failure-category.types.js
19114
19806
  var FAILURE_CATEGORIES = [
@@ -19885,13 +20577,13 @@ function validatePropertyPathInSchema(schema, propertyPath) {
19885
20577
  if (!schema.type || schema.type !== "object") {
19886
20578
  return false;
19887
20579
  }
19888
- const properties = schema.properties;
19889
- if (!properties)
20580
+ const properties2 = schema.properties;
20581
+ if (!properties2)
19890
20582
  return true;
19891
20583
  const [currentProperty, ...remainingPath] = propertyPath;
19892
20584
  if (!currentProperty)
19893
20585
  return false;
19894
- const propertySchema = properties[currentProperty];
20586
+ const propertySchema = properties2[currentProperty];
19895
20587
  if (!propertySchema || typeof propertySchema !== "object") {
19896
20588
  return false;
19897
20589
  }
@@ -19905,13 +20597,13 @@ function resolvePropertySchemaInSchema(schema, propertyPath) {
19905
20597
  return schema;
19906
20598
  if (!schema.type || schema.type !== "object")
19907
20599
  return null;
19908
- const properties = schema.properties;
19909
- if (!properties)
20600
+ const properties2 = schema.properties;
20601
+ if (!properties2)
19910
20602
  return null;
19911
20603
  const [currentProperty, ...remainingPath] = propertyPath;
19912
20604
  if (!currentProperty)
19913
20605
  return null;
19914
- const propertySchema = properties[currentProperty];
20606
+ const propertySchema = properties2[currentProperty];
19915
20607
  if (!propertySchema || typeof propertySchema !== "object")
19916
20608
  return null;
19917
20609
  return resolvePropertySchemaInSchema(propertySchema, remainingPath);
@@ -20225,8 +20917,8 @@ var askOptionsSchema = external_exports.array(askOptionSchema).min(2, "An ask st
20225
20917
  }
20226
20918
  }).meta({ description: "Two or more options the user chooses between." });
20227
20919
  var askStepOutputSchema = stepOutputSchema.refine((schema) => {
20228
- const properties = schema.properties;
20229
- return schema.type === "object" && typeof properties === "object" && properties !== null && "choice" in properties;
20920
+ const properties2 = schema.properties;
20921
+ return schema.type === "object" && typeof properties2 === "object" && properties2 !== null && "choice" in properties2;
20230
20922
  }, {
20231
20923
  message: 'Ask steps must declare an outputSchema of type "object" with a "choice" property.'
20232
20924
  }).meta({
@@ -20346,8 +21038,8 @@ function validateTemplateVariable({ variable, context, stepId, currentStepGuard,
20346
21038
  if (parts.length === 0) {
20347
21039
  return null;
20348
21040
  }
20349
- const [root14, ...rest] = parts;
20350
- if (root14 === "trigger") {
21041
+ const [root15, ...rest] = parts;
21042
+ if (root15 === "trigger") {
20351
21043
  if (rest.length === 0) {
20352
21044
  return `Step "${stepId}" ${sourceType} references "{{trigger}}" without a property. Use {{trigger.<property>}} syntax (e.g., {{trigger.payload}}, {{trigger.metadata}}).`;
20353
21045
  }
@@ -20370,7 +21062,7 @@ function validateTemplateVariable({ variable, context, stepId, currentStepGuard,
20370
21062
  }
20371
21063
  return null;
20372
21064
  }
20373
- if (root14 === "steps") {
21065
+ if (root15 === "steps") {
20374
21066
  const referencedStepId = rest[0];
20375
21067
  if (!referencedStepId) {
20376
21068
  return `Step "${stepId}" ${sourceType} references "steps" but is missing the step identifier in template variable "{{${variable}}}". Use {{steps.<stepId>}} syntax.`;
@@ -21102,6 +21794,8 @@ var automationDraftSchema = external_exports.object({
21102
21794
  isComplete: external_exports.boolean(),
21103
21795
  automationId: external_exports.string().nullable(),
21104
21796
  conversationId: external_exports.string().nullish().transform((value) => value ?? null),
21797
+ // null means the draft was authored in the creator's personal space
21798
+ workspaceId: external_exports.string().nullable(),
21105
21799
  createdAt: external_exports.string(),
21106
21800
  updatedAt: external_exports.string(),
21107
21801
  connectorDetails: external_exports.array(connectorDetailsSchema).optional()
@@ -21183,6 +21877,8 @@ var chatConversationSchema = external_exports.object({
21183
21877
  archivedAt: external_exports.string().nullable(),
21184
21878
  isArchived: external_exports.boolean(),
21185
21879
  todoistUserId: external_exports.string(),
21880
+ // null means the conversation was authored in the user's personal space
21881
+ workspaceId: external_exports.string().nullable(),
21186
21882
  createdAt: external_exports.string(),
21187
21883
  updatedAt: external_exports.string()
21188
21884
  });
@@ -22105,7 +22801,13 @@ var UserOnboardingStateSchema = external_exports.object({
22105
22801
  // sending accessState yet. Older responses should behave like the pre-gate
22106
22802
  // world and default to allowed.
22107
22803
  accessState: UserAccessStateSchema.default("allowed"),
22108
- welcomeConversationId: external_exports.string().nullable().optional()
22804
+ welcomeConversationId: external_exports.string().nullable().optional(),
22805
+ // Latest version the user accepted, null before the first. Optional so a
22806
+ // frontend deployed ahead of the backend sees undefined and skips the gate.
22807
+ acceptedTermsVersion: external_exports.string().nullable().optional()
22808
+ });
22809
+ var AcceptTermsSchema = external_exports.object({
22810
+ version: external_exports.string().trim().min(1).max(64)
22109
22811
  });
22110
22812
  var ConnectorIdSchema = external_exports.string().trim().min(1);
22111
22813
  var InterestedConnectorIdsSchema = external_exports.array(ConnectorIdSchema).max(100);
@@ -23137,15 +23839,84 @@ var WorkspaceAutomationRunsClient = class extends BaseClient {
23137
23839
  }
23138
23840
  };
23139
23841
 
23140
- // ../../packages/sdk/dist/esm/clients/workspace-automations/endpoints.js
23141
- var workspaceAutomationsEndpoints = {
23842
+ // ../../packages/sdk/dist/esm/clients/workspace-automation-draft-connections/endpoints.js
23843
+ var workspaceAutomationDraftConnectionsEndpoints = {
23844
+ list: (workspaceId, draftId) => `/workspaces/${encodeURIComponent(workspaceId)}/automation-drafts/${encodeURIComponent(draftId)}/connections`
23845
+ };
23846
+
23847
+ // ../../packages/sdk/dist/esm/clients/workspace-automation-draft-connections/workspace-automation-draft-connections-client.js
23848
+ var WorkspaceAutomationDraftConnectionsClient = class extends BaseClient {
23849
+ async upsert(workspaceId, draftId, body, options) {
23850
+ const parsedBody = CreateAutomationDraftConnectionSchema.parse(body);
23851
+ const data = await this.request({
23852
+ method: "POST",
23853
+ path: workspaceAutomationDraftConnectionsEndpoints.list(IdSchema.parse(workspaceId), IdSchema.parse(draftId)),
23854
+ body: parsedBody,
23855
+ options
23856
+ });
23857
+ return AutomationDraftConnectionSchema.parse(data);
23858
+ }
23859
+ };
23860
+
23861
+ // ../../packages/sdk/dist/esm/clients/workspace-automation-drafts/endpoints.js
23862
+ var workspaceAutomationDraftsEndpoints = {
23142
23863
  list: (workspaceId) => `${root6(workspaceId)}`,
23143
- detail: (workspaceId, id) => `${root6(workspaceId)}/${encodeURIComponent(id)}`,
23144
- metadata: (workspaceId, id) => `${root6(workspaceId)}/${encodeURIComponent(id)}/metadata`,
23145
- schedule: (workspaceId, id) => `${root6(workspaceId)}/${encodeURIComponent(id)}/schedule`,
23146
- trigger: (workspaceId, id) => `${root6(workspaceId)}/${encodeURIComponent(id)}/trigger`
23864
+ detail: (workspaceId, id) => `${root6(workspaceId)}/${encodeURIComponent(id)}`
23147
23865
  };
23148
23866
  function root6(workspaceId) {
23867
+ return `/workspaces/${encodeURIComponent(workspaceId)}/automation-drafts`;
23868
+ }
23869
+
23870
+ // ../../packages/sdk/dist/esm/clients/workspace-automation-drafts/workspace-automation-drafts-client.js
23871
+ var WorkspaceAutomationDraftsClient = class extends BaseClient {
23872
+ async list(workspaceId, args = {}, options) {
23873
+ const { cursor, limit } = CursorPaginationSchema.parse(args);
23874
+ const data = await this.request({
23875
+ method: "GET",
23876
+ path: workspaceAutomationDraftsEndpoints.list(IdSchema.parse(workspaceId)),
23877
+ query: { cursor, limit },
23878
+ options
23879
+ });
23880
+ return automationDraftListResponseSchema.parse(data);
23881
+ }
23882
+ async get(workspaceId, draftId, options) {
23883
+ const data = await this.request({
23884
+ method: "GET",
23885
+ path: workspaceAutomationDraftsEndpoints.detail(IdSchema.parse(workspaceId), IdSchema.parse(draftId)),
23886
+ options
23887
+ });
23888
+ return automationDraftWithValidationSchema.parse(data);
23889
+ }
23890
+ };
23891
+
23892
+ // ../../packages/sdk/dist/esm/clients/workspace-chat/endpoints.js
23893
+ var workspaceChatEndpoints = {
23894
+ conversations: (workspaceId) => `/workspaces/${encodeURIComponent(workspaceId)}/chat/conversations`
23895
+ };
23896
+
23897
+ // ../../packages/sdk/dist/esm/clients/workspace-chat/workspace-chat-client.js
23898
+ var WorkspaceChatClient = class extends BaseClient {
23899
+ async createConversation(workspaceId, body = {}, options) {
23900
+ const parsedBody = createChatConversationSchema.parse(body);
23901
+ const data = await this.request({
23902
+ method: "POST",
23903
+ path: workspaceChatEndpoints.conversations(IdSchema.parse(workspaceId)),
23904
+ body: parsedBody,
23905
+ options
23906
+ });
23907
+ return chatConversationSchema.parse(data);
23908
+ }
23909
+ };
23910
+
23911
+ // ../../packages/sdk/dist/esm/clients/workspace-automations/endpoints.js
23912
+ var workspaceAutomationsEndpoints = {
23913
+ list: (workspaceId) => `${root7(workspaceId)}`,
23914
+ detail: (workspaceId, id) => `${root7(workspaceId)}/${encodeURIComponent(id)}`,
23915
+ metadata: (workspaceId, id) => `${root7(workspaceId)}/${encodeURIComponent(id)}/metadata`,
23916
+ schedule: (workspaceId, id) => `${root7(workspaceId)}/${encodeURIComponent(id)}/schedule`,
23917
+ trigger: (workspaceId, id) => `${root7(workspaceId)}/${encodeURIComponent(id)}/trigger`
23918
+ };
23919
+ function root7(workspaceId) {
23149
23920
  return `/workspaces/${encodeURIComponent(workspaceId)}/automations`;
23150
23921
  }
23151
23922
 
@@ -23207,9 +23978,9 @@ var WorkspaceAutomationsClient = class extends BaseClient {
23207
23978
  };
23208
23979
 
23209
23980
  // ../../packages/sdk/dist/esm/clients/workspaces/endpoints.js
23210
- var root7 = "/workspaces";
23981
+ var root8 = "/workspaces";
23211
23982
  var workspacesEndpoints = {
23212
- list: root7
23983
+ list: root8
23213
23984
  };
23214
23985
 
23215
23986
  // ../../packages/sdk/dist/esm/clients/workspaces/workspaces-client.js
@@ -23231,12 +24002,12 @@ var WorkspacesClient = class extends BaseClient {
23231
24002
  };
23232
24003
 
23233
24004
  // ../../packages/sdk/dist/esm/clients/chat/endpoints.js
23234
- var root8 = "/chat/conversations";
24005
+ var root9 = "/chat/conversations";
23235
24006
  var chatEndpoints = {
23236
- conversations: root8,
23237
- conversation: (id) => `${root8}/${encodeURIComponent(id)}`,
23238
- messages: (id) => `${root8}/${encodeURIComponent(id)}/messages`,
23239
- usagePreview: (id) => `${root8}/${encodeURIComponent(id)}/usage-preview`
24007
+ conversations: root9,
24008
+ conversation: (id) => `${root9}/${encodeURIComponent(id)}`,
24009
+ messages: (id) => `${root9}/${encodeURIComponent(id)}/messages`,
24010
+ usagePreview: (id) => `${root9}/${encodeURIComponent(id)}/usage-preview`
23240
24011
  };
23241
24012
 
23242
24013
  // ../../packages/sdk/dist/esm/clients/chat/chat-client.js
@@ -23310,14 +24081,14 @@ var ChatClient = class extends BaseClient {
23310
24081
  };
23311
24082
 
23312
24083
  // ../../packages/sdk/dist/esm/clients/connections/endpoints.js
23313
- var root9 = "/connections";
24084
+ var root10 = "/connections";
23314
24085
  var connectionsEndpoints = {
23315
- list: root9,
23316
- detail: (id) => `${root9}/${encodeURIComponent(id)}`,
23317
- token: (id) => `${root9}/${encodeURIComponent(id)}/token`,
23318
- dependentAutomations: (connectorId) => `${root9}/${encodeURIComponent(connectorId)}/automations`,
23319
- create: (connectorId, capability) => `${root9}/${encodeURIComponent(connectorId)}/${encodeURIComponent(capability)}`,
23320
- checkManifest: `${root9}/check-manifest`
24086
+ list: root10,
24087
+ detail: (id) => `${root10}/${encodeURIComponent(id)}`,
24088
+ token: (id) => `${root10}/${encodeURIComponent(id)}/token`,
24089
+ dependentAutomations: (connectorId) => `${root10}/${encodeURIComponent(connectorId)}/automations`,
24090
+ create: (connectorId, capability) => `${root10}/${encodeURIComponent(connectorId)}/${encodeURIComponent(capability)}`,
24091
+ checkManifest: `${root10}/check-manifest`
23321
24092
  };
23322
24093
 
23323
24094
  // ../../packages/sdk/dist/esm/clients/connections/connections-client.js
@@ -23458,12 +24229,12 @@ function createClientContext(authToken, options = {}, apiOrigin = "automations")
23458
24229
  }
23459
24230
 
23460
24231
  // ../../packages/sdk/dist/esm/clients/notifications/endpoints.js
23461
- var root10 = "/notifications";
24232
+ var root11 = "/notifications";
23462
24233
  var notificationsEndpoints = {
23463
- list: root10,
23464
- pendingPromptAutomations: `${root10}/pending-prompt-automations`,
23465
- detail: (id) => `${root10}/${encodeURIComponent(id)}`,
23466
- respond: (id) => `${root10}/${encodeURIComponent(id)}/respond`
24234
+ list: root11,
24235
+ pendingPromptAutomations: `${root11}/pending-prompt-automations`,
24236
+ detail: (id) => `${root11}/${encodeURIComponent(id)}`,
24237
+ respond: (id) => `${root11}/${encodeURIComponent(id)}/respond`
23467
24238
  };
23468
24239
  var pushRoot = "/push-subscriptions";
23469
24240
  var pushSubscriptionsEndpoints = {
@@ -23587,10 +24358,11 @@ var NotificationsClient = class extends BaseClient {
23587
24358
  };
23588
24359
 
23589
24360
  // ../../packages/sdk/dist/esm/clients/user-settings/endpoints.js
23590
- var root11 = "/settings";
24361
+ var root12 = "/settings";
23591
24362
  var userSettingsEndpoints = {
23592
- onboarding: `${root11}/onboarding`,
23593
- preferences: `${root11}/preferences`
24363
+ onboarding: `${root12}/onboarding`,
24364
+ preferences: `${root12}/preferences`,
24365
+ terms: `${root12}/terms`
23594
24366
  };
23595
24367
 
23596
24368
  // ../../packages/sdk/dist/esm/clients/user-settings/user-settings-client.js
@@ -23639,6 +24411,16 @@ var UserSettingsClient = class extends BaseClient {
23639
24411
  });
23640
24412
  return UserPreferencesSchema.parse(data);
23641
24413
  }
24414
+ async acceptTerms(body, options) {
24415
+ const parsedBody = AcceptTermsSchema.parse(body);
24416
+ const data = await this.request({
24417
+ method: "PUT",
24418
+ path: userSettingsEndpoints.terms,
24419
+ body: parsedBody,
24420
+ options
24421
+ });
24422
+ return UserOnboardingStateSchema.parse(data);
24423
+ }
23642
24424
  };
23643
24425
 
23644
24426
  // ../../packages/sdk/dist/esm/clients/usage-billing/endpoints.js
@@ -23742,11 +24524,11 @@ var UsageBillingClient = class extends BaseClient {
23742
24524
  };
23743
24525
 
23744
24526
  // ../../packages/sdk/dist/esm/clients/webhook-event-subscriptions/endpoints.js
23745
- var root12 = "/webhook-event-subscriptions";
24527
+ var root13 = "/webhook-event-subscriptions";
23746
24528
  var webhookEventSubscriptionsEndpoints = {
23747
- list: root12,
23748
- detail: (id) => `${root12}/${encodeURIComponent(id)}`,
23749
- deliveries: (id) => `${root12}/${encodeURIComponent(id)}/deliveries`
24529
+ list: root13,
24530
+ detail: (id) => `${root13}/${encodeURIComponent(id)}`,
24531
+ deliveries: (id) => `${root13}/${encodeURIComponent(id)}/deliveries`
23750
24532
  };
23751
24533
 
23752
24534
  // ../../packages/sdk/dist/esm/clients/webhook-event-subscriptions/webhook-event-subscriptions-client.js
@@ -23819,12 +24601,12 @@ var WebhookEventSubscriptionsClient = class extends BaseClient {
23819
24601
  };
23820
24602
 
23821
24603
  // ../../packages/sdk/dist/esm/clients/webhook-subscriptions/endpoints.js
23822
- function root13(automationId) {
24604
+ function root14(automationId) {
23823
24605
  return `/automations/${encodeURIComponent(automationId)}/subscriptions`;
23824
24606
  }
23825
24607
  var webhookSubscriptionsEndpoints = {
23826
- list: (automationId) => root13(automationId),
23827
- detail: (automationId, subscriptionId) => `${root13(automationId)}/${encodeURIComponent(subscriptionId)}`
24608
+ list: (automationId) => root14(automationId),
24609
+ detail: (automationId, subscriptionId) => `${root14(automationId)}/${encodeURIComponent(subscriptionId)}`
23828
24610
  };
23829
24611
 
23830
24612
  // ../../packages/sdk/dist/esm/clients/webhook-subscriptions/webhook-subscriptions-client.js
@@ -23879,6 +24661,9 @@ var AutomationsApi = class {
23879
24661
  workspaces;
23880
24662
  workspaceAutomations;
23881
24663
  workspaceAutomationRuns;
24664
+ workspaceAutomationDrafts;
24665
+ workspaceAutomationDraftConnections;
24666
+ workspaceChat;
23882
24667
  constructor(authToken, options = {}) {
23883
24668
  const context = createClientContext(authToken, options);
23884
24669
  const todoistContext = createClientContext(authToken, options, "todoist");
@@ -23886,6 +24671,9 @@ var AutomationsApi = class {
23886
24671
  this.workspaces = new WorkspacesClient(context);
23887
24672
  this.workspaceAutomations = new WorkspaceAutomationsClient(context);
23888
24673
  this.workspaceAutomationRuns = new WorkspaceAutomationRunsClient(context);
24674
+ this.workspaceAutomationDrafts = new WorkspaceAutomationDraftsClient(context);
24675
+ this.workspaceAutomationDraftConnections = new WorkspaceAutomationDraftConnectionsClient(context);
24676
+ this.workspaceChat = new WorkspaceChatClient(context);
23889
24677
  this.automationRuns = new AutomationRunsClient(context);
23890
24678
  this.connectors = new ConnectorsClient(context);
23891
24679
  this.connections = new ConnectionsClient(context);
@@ -25278,8 +26066,8 @@ function renderFailure(error61, context = {}) {
25278
26066
  ...code ? { code } : {}
25279
26067
  };
25280
26068
  }
25281
- function writeFailure(mode, status, failure) {
25282
- const { message, code } = failure;
26069
+ function writeFailure(mode, status, failure2) {
26070
+ const { message, code } = failure2;
25283
26071
  const result = { status, message, ...code ? { code } : {} };
25284
26072
  if (mode === "json") {
25285
26073
  process.stdout.write(`${formatJson4(result)}
@@ -25289,7 +26077,7 @@ function writeFailure(mode, status, failure) {
25289
26077
  `);
25290
26078
  } else {
25291
26079
  const prefix = status === "error" ? "Error: " : "";
25292
- process.stdout.write(`${prefix}${sanitizeTerminalText(failure.humanMessage)}
26080
+ process.stdout.write(`${prefix}${sanitizeTerminalText(failure2.humanMessage)}
25293
26081
  `);
25294
26082
  }
25295
26083
  }
@@ -25337,10 +26125,8 @@ async function runApiCommand(command, operation, presentation, execution = {}) {
25337
26125
  }
25338
26126
 
25339
26127
  // src/lib/workspace-scope.ts
26128
+ import { Option } from "commander";
25340
26129
  async function resolveWorkspaceScope(options) {
25341
- if (options.workspace !== void 0 && options.personal) {
25342
- throw new Error("Use either --workspace or --personal, not both.");
25343
- }
25344
26130
  if (options.workspace !== void 0) {
25345
26131
  return options.workspace;
25346
26132
  }
@@ -25350,9 +26136,11 @@ async function resolveWorkspaceScope(options) {
25350
26136
  return getDefaultWorkspaceId();
25351
26137
  }
25352
26138
  function addWorkspaceScopeOptions(command) {
25353
- return command.option(
25354
- "--workspace <workspace-id>",
25355
- "Act on this workspace instead of your personal space"
26139
+ return command.addOption(
26140
+ new Option(
26141
+ "--workspace <workspace-id>",
26142
+ "Act on this workspace instead of your personal space"
26143
+ ).conflicts("personal")
25356
26144
  ).option("--personal", "Act on your personal space, ignoring any pinned workspace");
25357
26145
  }
25358
26146
 
@@ -25467,8 +26255,8 @@ function formatRunList(page) {
25467
26255
  `Runs (${page.data.length})`,
25468
26256
  ...page.data.map((run) => {
25469
26257
  const reason = getRunOutcomeReason(run);
25470
- const failure = reason ? ` ${reason}` : "";
25471
- return `${run.id} ${run.status} ${run.createdAt}${failure}`;
26258
+ const failure2 = reason ? ` ${reason}` : "";
26259
+ return `${run.id} ${run.status} ${run.createdAt}${failure2}`;
25472
26260
  })
25473
26261
  ],
25474
26262
  page.nextCursor
@@ -25902,18 +26690,21 @@ import { DefaultChatTransport, readUIMessageStream } from "ai";
25902
26690
  var ChatTurnTransport = class {
25903
26691
  transport;
25904
26692
  constructor({ token, baseUrl, headers, fetch: fetch2 }) {
26693
+ const apiRoot = `${baseUrl.replace(/\/+$/, "")}/v1`;
25905
26694
  this.transport = new DefaultChatTransport({
25906
- api: `${baseUrl.replace(/\/+$/, "")}/v1/chat`,
26695
+ api: `${apiRoot}/chat`,
25907
26696
  headers: {
25908
26697
  Authorization: `Bearer ${token}`,
25909
26698
  ...headers
25910
26699
  },
25911
26700
  credentials: "include",
25912
26701
  fetch: fetch2,
25913
- prepareSendMessagesRequest({ messages, body }) {
26702
+ prepareSendMessagesRequest({ messages, body, api }) {
26703
+ const { workspaceId, ...rest } = body ?? {};
25914
26704
  return {
26705
+ api: workspaceId ? `${apiRoot}/workspaces/${encodeURIComponent(workspaceId)}/chat` : api,
25915
26706
  body: {
25916
- ...body,
26707
+ ...rest,
25917
26708
  message: messages.at(-1)
25918
26709
  }
25919
26710
  };
@@ -25923,6 +26714,7 @@ var ChatTurnTransport = class {
25923
26714
  /** Streams one server turn, reporting incremental text and deduplicated tool state changes. */
25924
26715
  async streamTurn({
25925
26716
  conversationId,
26717
+ workspaceId = null,
25926
26718
  message,
25927
26719
  signal,
25928
26720
  onText,
@@ -25934,7 +26726,7 @@ var ChatTurnTransport = class {
25934
26726
  messageId: void 0,
25935
26727
  messages: [message],
25936
26728
  abortSignal: signal,
25937
- body: { conversationId }
26729
+ body: { conversationId, workspaceId }
25938
26730
  });
25939
26731
  let finalMessage;
25940
26732
  let emittedText = "";
@@ -26549,14 +27341,19 @@ var ChatService = class {
26549
27341
  this.turnLock = turnLock ?? new ConversationTurnLock();
26550
27342
  this.heartbeatIntervalMs = heartbeatIntervalMs ?? TURN_HEARTBEAT_INTERVAL_MS;
26551
27343
  }
26552
- /** Creates a conversation and runs it until the current CLI turn reaches a terminal state. */
26553
- async startConversation(message, signal) {
26554
- const conversation = await this.api.chat.createConversation({}, { signal });
27344
+ /**
27345
+ * Creates a conversation and runs it until the current CLI turn reaches a terminal state.
27346
+ * A workspace conversation is created through the workspace route, which stamps it; every
27347
+ * later turn follows that stamp.
27348
+ */
27349
+ async startConversation(message, signal, workspaceId = null) {
27350
+ const conversation = workspaceId === null ? await this.api.chat.createConversation({}, { signal }) : await this.api.workspaceChat.createConversation(workspaceId, {}, { signal });
26555
27351
  this.output.emit({ type: "session_started", conversationId: conversation.id });
26556
27352
  return this.withActiveTurn(
26557
27353
  conversation.id,
26558
27354
  () => this.runConversationUntilTerminal({
26559
27355
  conversationId: conversation.id,
27356
+ workspaceId: conversation.workspaceId,
26560
27357
  incomingMessage: createUserMessage(message),
26561
27358
  signal
26562
27359
  })
@@ -26569,7 +27366,8 @@ var ChatService = class {
26569
27366
  selections,
26570
27367
  signal
26571
27368
  }) {
26572
- await this.api.chat.getConversation(conversationId, { signal });
27369
+ const conversation = await this.api.chat.getConversation(conversationId, { signal });
27370
+ const { workspaceId } = conversation;
26573
27371
  return this.withActiveTurn(
26574
27372
  conversationId,
26575
27373
  async () => {
@@ -26582,7 +27380,7 @@ var ChatService = class {
26582
27380
  );
26583
27381
  }
26584
27382
  const resolution = await this.resolveSelectConnections(
26585
- conversationId,
27383
+ { conversationId, workspaceId },
26586
27384
  pendingAction,
26587
27385
  selections,
26588
27386
  this.interactive,
@@ -26618,6 +27416,7 @@ var ChatService = class {
26618
27416
  }
26619
27417
  return this.runConversationUntilTerminal({
26620
27418
  conversationId,
27419
+ workspaceId,
26621
27420
  incomingMessage,
26622
27421
  signal
26623
27422
  });
@@ -26654,6 +27453,7 @@ var ChatService = class {
26654
27453
  }
26655
27454
  async runConversationUntilTerminal({
26656
27455
  conversationId,
27456
+ workspaceId,
26657
27457
  incomingMessage,
26658
27458
  signal
26659
27459
  }) {
@@ -26680,6 +27480,7 @@ var ChatService = class {
26680
27480
  while (true) {
26681
27481
  const response = await this.transport.streamTurn({
26682
27482
  conversationId,
27483
+ workspaceId,
26683
27484
  message: nextIncomingMessage,
26684
27485
  signal,
26685
27486
  onText: (text) => {
@@ -26710,7 +27511,7 @@ var ChatService = class {
26710
27511
  const pendingAction = getPendingClientAction(response);
26711
27512
  if (pendingAction?.kind === "select_connections") {
26712
27513
  const resolution = await this.resolveSelectConnections(
26713
- conversationId,
27514
+ { conversationId, workspaceId },
26714
27515
  pendingAction,
26715
27516
  [],
26716
27517
  this.interactive,
@@ -26849,7 +27650,7 @@ var ChatService = class {
26849
27650
  const messages = await this.api.chat.getMessages(conversationId, { signal });
26850
27651
  return getPendingActionFromMessages(messages);
26851
27652
  }
26852
- async resolveSelectConnections(conversationId, action, selections, allowPrompt, signal) {
27653
+ async resolveSelectConnections({ conversationId, workspaceId }, action, selections, allowPrompt, signal) {
26853
27654
  const uniqueConnections = deduplicateConnectionRequirements(action.connections);
26854
27655
  const limitConnectionLookup = pLimit(CONNECTION_LOOKUP_CONCURRENCY);
26855
27656
  const requirements = await Promise.all(
@@ -26924,15 +27725,21 @@ var ChatService = class {
26924
27725
  }
26925
27726
  const output2 = [];
26926
27727
  for (const item of resolved) {
26927
- await this.api.automationDraftConnections.upsert(
26928
- action.draftId,
26929
- {
26930
- connectorId: item.requirement.connectorId,
26931
- connectionType: item.requirement.connectionType,
26932
- connectionId: item.connectionId
26933
- },
26934
- { signal }
26935
- );
27728
+ const body = {
27729
+ connectorId: item.requirement.connectorId,
27730
+ connectionType: item.requirement.connectionType,
27731
+ connectionId: item.connectionId
27732
+ };
27733
+ if (workspaceId === null) {
27734
+ await this.api.automationDraftConnections.upsert(action.draftId, body, { signal });
27735
+ } else {
27736
+ await this.api.workspaceAutomationDraftConnections.upsert(
27737
+ workspaceId,
27738
+ action.draftId,
27739
+ body,
27740
+ { signal }
27741
+ );
27742
+ }
26936
27743
  output2.push({
26937
27744
  type: "success",
26938
27745
  connectionId: item.connectionId,
@@ -27034,11 +27841,13 @@ function parseConnectionSelectionOption(value) {
27034
27841
  // src/commands/chat/index.ts
27035
27842
  function registerChatCommand(program) {
27036
27843
  const chat = program.command("chat").description("Talk to the Todoist Automations agent");
27037
- chat.command("start").description("Start a new conversation").argument("<message...>", "Initial message").action(async (messageParts, _options, command) => {
27038
- await runCommand(
27039
- command,
27040
- async ({ service, signal }) => service.startConversation(messageParts.join(" "), signal)
27041
- );
27844
+ addWorkspaceScopeOptions(
27845
+ chat.command("start").description("Start a new conversation").argument("<message...>", "Initial message")
27846
+ ).action(async (messageParts, options, command) => {
27847
+ await runCommand(command, async ({ service, signal }) => {
27848
+ const workspaceId = await resolveWorkspaceScope(options);
27849
+ return service.startConversation(messageParts.join(" "), signal, workspaceId);
27850
+ });
27042
27851
  });
27043
27852
  chat.command("continue").description("Continue a persisted conversation").argument("<conversation-id>", "Conversation ID emitted by start").argument("[message...]", "Answer or follow-up message").option(
27044
27853
  "--connection <connector[:type]=connection-id>",
@@ -27109,11 +27918,11 @@ async function runCommand(command, operation) {
27109
27918
  });
27110
27919
  },
27111
27920
  onError: (error61, { mode, output: output2 }) => {
27112
- const failure = renderFailure(error61, { mode, source });
27113
- const message = mode === "human" ? failure.humanMessage : failure.message;
27921
+ const failure2 = renderFailure(error61, { mode, source });
27922
+ const message = mode === "human" ? failure2.humanMessage : failure2.message;
27114
27923
  output2.emit({
27115
27924
  type: "error",
27116
- code: failure.code ?? "TDA_COMMAND_FAILED",
27925
+ code: failure2.code ?? "TDA_COMMAND_FAILED",
27117
27926
  message,
27118
27927
  state: "failed",
27119
27928
  terminal: true
@@ -27131,11 +27940,11 @@ function collect(value, previous) {
27131
27940
  }
27132
27941
 
27133
27942
  // src/commands/conversation/index.ts
27134
- import { Option } from "commander";
27943
+ import { Option as Option2 } from "commander";
27135
27944
  function registerConversationCommand(program) {
27136
27945
  const conversation = program.command("conversation").description("Inspect persisted agent conversations");
27137
27946
  conversation.command("list").description("List conversations").addOption(
27138
- new Option("--status <status>", "Filter by conversation status").choices(["active", "archived", "all"]).default("active")
27947
+ new Option2("--status <status>", "Filter by conversation status").choices(["active", "archived", "all"]).default("active")
27139
27948
  ).option("--limit <number>", "Maximum conversations to return", parsePositiveInteger).action(async (options, command) => {
27140
27949
  await runApiCommand(
27141
27950
  command,
@@ -27161,7 +27970,7 @@ function registerConversationCommand(program) {
27161
27970
  }
27162
27971
 
27163
27972
  // src/commands/connector/mutation-commands.ts
27164
- import { Option as Option2 } from "commander";
27973
+ import { Option as Option3 } from "commander";
27165
27974
 
27166
27975
  // src/commands/connector/format.ts
27167
27976
  function formatConnectorList(result) {
@@ -27371,13 +28180,13 @@ async function runAuthorizationCommand(command, operation) {
27371
28180
  output2.finish({ status: "interrupted", message: "Interrupted." });
27372
28181
  },
27373
28182
  onError: (error61, { mode, output: output2 }) => {
27374
- const failure = renderFailure(error61, { mode, source });
27375
- const message = mode === "human" ? failure.humanMessage : failure.message;
28183
+ const failure2 = renderFailure(error61, { mode, source });
28184
+ const message = mode === "human" ? failure2.humanMessage : failure2.message;
27376
28185
  output2.emit({
27377
28186
  type: "error",
27378
28187
  status: "error",
27379
28188
  message,
27380
- ...failure.code ? { code: failure.code } : {},
28189
+ ...failure2.code ? { code: failure2.code } : {},
27381
28190
  terminal: true
27382
28191
  });
27383
28192
  output2.finish({ status: "error", message });
@@ -27451,7 +28260,7 @@ function summarizeAffectedAutomation(automation) {
27451
28260
  // src/commands/connector/mutation-commands.ts
27452
28261
  function registerConnectorMutationCommands(connector) {
27453
28262
  connector.command("connect").description("Create a service connection and wait for authorization").argument("<connector-id>", "Connector ID").addOption(
27454
- new Option2("--capability <capability>", "Capability to authorize").choices(["mcp", "trigger"]).makeOptionMandatory()
28263
+ new Option3("--capability <capability>", "Capability to authorize").choices(["mcp", "trigger"]).makeOptionMandatory()
27455
28264
  ).action(async (connectorId, options, command) => {
27456
28265
  await runAuthorizationCommand(command, async ({ api, authorizer, signal }) => {
27457
28266
  const selected2 = await findConnector(api, connectorId, signal);
@@ -27540,15 +28349,15 @@ function registerConnectorMutationCommands(connector) {
27540
28349
  }
27541
28350
 
27542
28351
  // src/commands/connector/read-commands.ts
27543
- import { Option as Option3 } from "commander";
28352
+ import { Option as Option4 } from "commander";
27544
28353
  function registerConnectorReadCommands(connector) {
27545
28354
  connector.command("list").description("List available connectors and the current user connections").option("--query <text>", "Search connector names and descriptions").addOption(
27546
- new Option3("--capability <capability>", "Filter by supported capability").choices([
28355
+ new Option4("--capability <capability>", "Filter by supported capability").choices([
27547
28356
  "mcp",
27548
28357
  "trigger"
27549
28358
  ])
27550
28359
  ).addOption(
27551
- new Option3("--connection-status <status>", "Filter by connection status").choices([
28360
+ new Option4("--connection-status <status>", "Filter by connection status").choices([
27552
28361
  ...CONNECTION_STATUSES
27553
28362
  ])
27554
28363
  ).option("--without-connections", "Only include connectors with no connection records").option("--no-connections", "Do not fetch or include user connections").action(async (options, command) => {
@@ -27601,29 +28410,40 @@ function registerConnectorCommand(program) {
27601
28410
  // src/commands/draft/index.ts
27602
28411
  function registerDraftCommand(program) {
27603
28412
  const draft = program.command("draft").description("Inspect automation drafts");
27604
- addCursorPaginationOptions(draft.command("list").description("List drafts")).action(
27605
- async (options, command) => {
27606
- await runApiCommand(
27607
- command,
27608
- ({ api, signal }) => collectCursorPages(
28413
+ addWorkspaceScopeOptions(
28414
+ addCursorPaginationOptions(draft.command("list").description("List drafts"))
28415
+ ).action(async (options, command) => {
28416
+ await runApiCommand(
28417
+ command,
28418
+ async ({ api, signal }) => {
28419
+ const workspaceId = await resolveWorkspaceScope(options);
28420
+ return collectCursorPages(
27609
28421
  options,
27610
- (args) => api.automationDrafts.list(args, { signal })
27611
- ),
27612
- { human: formatDraftList },
27613
- {
27614
- spinner: "Loading drafts...",
27615
- streamNdjson: ({ api, signal }) => streamCursorNdjsonItems(
28422
+ (args) => workspaceId === null ? api.automationDrafts.list(args, { signal }) : api.workspaceAutomationDrafts.list(workspaceId, args, { signal })
28423
+ );
28424
+ },
28425
+ { human: formatDraftList },
28426
+ {
28427
+ spinner: "Loading drafts...",
28428
+ streamNdjson: async function* ({ api, signal }) {
28429
+ const workspaceId = await resolveWorkspaceScope(options);
28430
+ yield* streamCursorNdjsonItems(
27616
28431
  options,
27617
- (args) => api.automationDrafts.list(args, { signal })
27618
- )
28432
+ (args) => workspaceId === null ? api.automationDrafts.list(args, { signal }) : api.workspaceAutomationDrafts.list(workspaceId, args, { signal })
28433
+ );
27619
28434
  }
27620
- );
27621
- }
27622
- );
27623
- draft.command("view").description("Show a draft and its validation state").argument("<draft-id>", "Draft ID").action(async (draftId, _options, command) => {
28435
+ }
28436
+ );
28437
+ });
28438
+ addWorkspaceScopeOptions(
28439
+ draft.command("view").description("Show a draft and its validation state").argument("<draft-id>", "Draft ID")
28440
+ ).action(async (draftId, options, command) => {
27624
28441
  await runApiCommand(
27625
28442
  command,
27626
- ({ api, signal }) => api.automationDrafts.get(draftId, { signal }),
28443
+ async ({ api, signal }) => {
28444
+ const workspaceId = await resolveWorkspaceScope(options);
28445
+ return workspaceId === null ? api.automationDrafts.get(draftId, { signal }) : api.workspaceAutomationDrafts.get(workspaceId, draftId, { signal });
28446
+ },
27627
28447
  { human: formatDraft },
27628
28448
  { spinner: "Loading draft..." }
27629
28449
  );
@@ -27631,7 +28451,7 @@ function registerDraftCommand(program) {
27631
28451
  }
27632
28452
 
27633
28453
  // src/commands/run/index.ts
27634
- import { Option as Option4 } from "commander";
28454
+ import { Option as Option5 } from "commander";
27635
28455
  function registerRunCommand(program) {
27636
28456
  const run = program.command("run").description("Inspect automation runs");
27637
28457
  addWorkspaceScopeOptions(
@@ -27639,7 +28459,7 @@ function registerRunCommand(program) {
27639
28459
  run.command("list").description("List runs for an automation").argument("<automation-id>", "Automation ID")
27640
28460
  )
27641
28461
  ).addOption(
27642
- new Option4("--status <status>", "Only show runs with this status").choices([
28462
+ new Option5("--status <status>", "Only show runs with this status").choices([
27643
28463
  ...AUTOMATION_RUN_STATUSES
27644
28464
  ])
27645
28465
  ).option(
@@ -27930,7 +28750,7 @@ function formatCurrentWorkspace(result) {
27930
28750
  return `Workspace ${result.workspace.name} (${result.workspaceId})${lockedNote(result.workspace)}`;
27931
28751
  }
27932
28752
  function formatWorkspaceSelection(result) {
27933
- return result.action === "cleared" ? "Cleared. Commands now act on your personal space." : `Pinned ${result.name ?? result.workspaceId}. \`automation\` and \`run\` commands now act on this workspace; drafts, chat and connections stay personal. Use --personal for a one-off.`;
28753
+ return result.action === "cleared" ? "Cleared. Commands now act on your personal space." : `Pinned ${result.name ?? result.workspaceId}. \`automation\`, \`run\`, \`draft\` and \`chat start\` now act on this workspace; connections stay personal. Use --personal for a one-off.`;
27934
28754
  }
27935
28755
 
27936
28756
  // src/commands/workspace/index.ts