dsh-draw 0.2.2 → 0.2.3

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.
@@ -1,67 +1,11 @@
1
- //#region node_modules/.pnpm/zod@4.4.3/node_modules/zod/v4/core/core.js
2
- var _a$1;
3
- function $constructor(name, initializer, params) {
4
- function init(inst, def) {
5
- if (!inst._zod) Object.defineProperty(inst, "_zod", {
6
- value: {
7
- def,
8
- constr: _,
9
- traits: /* @__PURE__ */ new Set()
10
- },
11
- enumerable: false
12
- });
13
- if (inst._zod.traits.has(name)) return;
14
- inst._zod.traits.add(name);
15
- initializer(inst, def);
16
- const proto = _.prototype;
17
- const keys = Object.keys(proto);
18
- for (let i = 0; i < keys.length; i++) {
19
- const k = keys[i];
20
- if (!(k in inst)) inst[k] = proto[k].bind(inst);
21
- }
22
- }
23
- const Parent = params?.Parent ?? Object;
24
- class Definition extends Parent {}
25
- Object.defineProperty(Definition, "name", { value: name });
26
- function _(def) {
27
- var _a;
28
- const inst = params?.Parent ? new Definition() : this;
29
- init(inst, def);
30
- (_a = inst._zod).deferred ?? (_a.deferred = []);
31
- for (const fn of inst._zod.deferred) fn();
32
- return inst;
33
- }
34
- Object.defineProperty(_, "init", { value: init });
35
- Object.defineProperty(_, Symbol.hasInstance, { value: (inst) => {
36
- if (params?.Parent && inst instanceof params.Parent) return true;
37
- return inst?._zod?.traits?.has(name);
38
- } });
39
- Object.defineProperty(_, "name", { value: name });
40
- return _;
41
- }
42
- var $ZodAsyncError = class extends Error {
43
- constructor() {
44
- super(`Encountered Promise during synchronous parse. Use .parseAsync() instead.`);
45
- }
46
- };
47
- var $ZodEncodeError = class extends Error {
48
- constructor(name) {
49
- super(`Encountered unidirectional transform during encode: ${name}`);
50
- this.name = "ZodEncodeError";
51
- }
52
- };
53
- (_a$1 = globalThis).__zod_globalConfig ?? (_a$1.__zod_globalConfig = {});
54
- const globalConfig = globalThis.__zod_globalConfig;
55
- function config(newConfig) {
56
- if (newConfig) Object.assign(globalConfig, newConfig);
57
- return globalConfig;
58
- }
59
- //#endregion
60
- //#region node_modules/.pnpm/zod@4.4.3/node_modules/zod/v4/core/util.js
1
+ //#region node_modules/.pnpm/zod@4.5.4/node_modules/zod/v4/core/util.js
61
2
  function getEnumValues(entries) {
62
3
  const numericValues = Object.values(entries).filter((v) => typeof v === "number");
63
4
  return Object.entries(entries).filter(([k, _]) => numericValues.indexOf(+k) === -1).map(([_, v]) => v);
64
5
  }
6
+ function joinValues(array, separator = "|") {
7
+ return array.map((val) => stringifyPrimitive(val)).join(separator);
8
+ }
65
9
  function jsonStringifyReplacer(_, value) {
66
10
  if (typeof value === "bigint") return value.toString();
67
11
  return value;
@@ -86,28 +30,10 @@ function cleanRegex(source) {
86
30
  function floatSafeRemainder(val, step) {
87
31
  const ratio = val / step;
88
32
  const roundedRatio = Math.round(ratio);
89
- const tolerance = Number.EPSILON * Math.max(Math.abs(ratio), 1);
33
+ const tolerance = 4 * Number.EPSILON * Math.max(Math.abs(ratio), 1);
90
34
  if (Math.abs(ratio - roundedRatio) < tolerance) return 0;
91
35
  return ratio - roundedRatio;
92
36
  }
93
- const EVALUATING = /* @__PURE__*/ Symbol("evaluating");
94
- function defineLazy(object, key, getter) {
95
- let value = void 0;
96
- Object.defineProperty(object, key, {
97
- get() {
98
- if (value === EVALUATING) return;
99
- if (value === void 0) {
100
- value = EVALUATING;
101
- value = getter();
102
- }
103
- return value;
104
- },
105
- set(v) {
106
- Object.defineProperty(object, key, { value: v });
107
- },
108
- configurable: true
109
- });
110
- }
111
37
  function assignProp(target, prop, value) {
112
38
  Object.defineProperty(target, prop, {
113
39
  value,
@@ -189,18 +115,23 @@ function normalizeParams(_params) {
189
115
  };
190
116
  return params;
191
117
  }
118
+ function stringifyPrimitive(value) {
119
+ if (typeof value === "bigint") return value.toString() + "n";
120
+ if (typeof value === "string") return `"${value}"`;
121
+ return `${value}`;
122
+ }
192
123
  function optionalKeys(shape) {
193
124
  return Object.keys(shape).filter((k) => {
194
- return shape[k]._zod.optin === "optional" && shape[k]._zod.optout === "optional";
125
+ return shape[k]._zod.optin !== void 0 && shape[k]._zod.optout === "optional";
195
126
  });
196
127
  }
197
- const NUMBER_FORMAT_RANGES = {
128
+ const NUMBER_FORMAT_RANGES = /*@__PURE__*/ (() => ({
198
129
  safeint: [Number.MIN_SAFE_INTEGER, Number.MAX_SAFE_INTEGER],
199
130
  int32: [-2147483648, 2147483647],
200
131
  uint32: [0, 4294967295],
201
132
  float32: [-34028234663852886e22, 34028234663852886e22],
202
133
  float64: [-Number.MAX_VALUE, Number.MAX_VALUE]
203
- };
134
+ }))();
204
135
  function pick(schema, mask) {
205
136
  const currDef = schema._zod.def;
206
137
  const checks = currDef.checks;
@@ -208,10 +139,10 @@ function pick(schema, mask) {
208
139
  return clone(schema, mergeDefs(schema._zod.def, {
209
140
  get shape() {
210
141
  const newShape = {};
211
- for (const key in mask) {
212
- if (!(key in currDef.shape)) throw new Error(`Unrecognized key: "${key}"`);
142
+ for (const key of Reflect.ownKeys(mask)) {
143
+ if (!Object.prototype.hasOwnProperty.call(currDef.shape, key)) throw new Error(`Unrecognized key: "${String(key)}"`);
213
144
  if (!mask[key]) continue;
214
- newShape[key] = currDef.shape[key];
145
+ assignProp(newShape, key, currDef.shape[key]);
215
146
  }
216
147
  assignProp(this, "shape", newShape);
217
148
  return newShape;
@@ -226,8 +157,8 @@ function omit(schema, mask) {
226
157
  return clone(schema, mergeDefs(schema._zod.def, {
227
158
  get shape() {
228
159
  const newShape = { ...schema._zod.def.shape };
229
- for (const key in mask) {
230
- if (!(key in currDef.shape)) throw new Error(`Unrecognized key: "${key}"`);
160
+ for (const key of Reflect.ownKeys(mask)) {
161
+ if (!Object.prototype.hasOwnProperty.call(currDef.shape, key)) throw new Error(`Unrecognized key: "${String(key)}"`);
231
162
  if (!mask[key]) continue;
232
163
  delete newShape[key];
233
164
  }
@@ -242,7 +173,7 @@ function extend(schema, shape) {
242
173
  const checks = schema._zod.def.checks;
243
174
  if (checks && checks.length > 0) {
244
175
  const existingShape = schema._zod.def.shape;
245
- for (const key in shape) if (Object.getOwnPropertyDescriptor(existingShape, key) !== void 0) throw new Error("Cannot overwrite keys on object schemas containing refinements. Use `.safeExtend()` instead.");
176
+ for (const key of Reflect.ownKeys(shape)) if (Object.getOwnPropertyDescriptor(existingShape, key) !== void 0) throw new Error("Cannot overwrite keys on object schemas containing refinements. Use `.safeExtend()` instead.");
246
177
  }
247
178
  return clone(schema, mergeDefs(schema._zod.def, { get shape() {
248
179
  const _shape = {
@@ -265,6 +196,7 @@ function safeExtend(schema, shape) {
265
196
  } }));
266
197
  }
267
198
  function merge(a, b) {
199
+ if (!b?._zod?.def) throw new Error("Invalid input to merge: expected an object schema. To merge a plain shape, use `.extend()`.");
268
200
  if (a._zod.def.checks?.length) throw new Error(".merge() cannot be used on object schemas containing refinements. Use .safeExtend() instead.");
269
201
  return clone(a, mergeDefs(a._zod.def, {
270
202
  get shape() {
@@ -281,22 +213,22 @@ function merge(a, b) {
281
213
  checks: b._zod.def.checks ?? []
282
214
  }));
283
215
  }
284
- function partial(Class, schema, mask) {
216
+ function partial(Class, schema, mask, name = "partial") {
285
217
  const checks = schema._zod.def.checks;
286
- if (checks && checks.length > 0) throw new Error(".partial() cannot be used on object schemas containing refinements");
218
+ if (checks && checks.length > 0) throw new Error(`.${name}() cannot be used on object schemas containing refinements`);
287
219
  return clone(schema, mergeDefs(schema._zod.def, {
288
220
  get shape() {
289
221
  const oldShape = schema._zod.def.shape;
290
222
  const shape = { ...oldShape };
291
- if (mask) for (const key in mask) {
292
- if (!(key in oldShape)) throw new Error(`Unrecognized key: "${key}"`);
223
+ if (mask) for (const key of Reflect.ownKeys(mask)) {
224
+ if (!Object.prototype.hasOwnProperty.call(oldShape, key)) throw new Error(`Unrecognized key: "${String(key)}"`);
293
225
  if (!mask[key]) continue;
294
226
  shape[key] = Class ? new Class({
295
227
  type: "optional",
296
228
  innerType: oldShape[key]
297
229
  }) : oldShape[key];
298
230
  }
299
- else for (const key in oldShape) shape[key] = Class ? new Class({
231
+ else for (const key of Reflect.ownKeys(oldShape)) shape[key] = Class ? new Class({
300
232
  type: "optional",
301
233
  innerType: oldShape[key]
302
234
  }) : oldShape[key];
@@ -310,15 +242,15 @@ function required(Class, schema, mask) {
310
242
  return clone(schema, mergeDefs(schema._zod.def, { get shape() {
311
243
  const oldShape = schema._zod.def.shape;
312
244
  const shape = { ...oldShape };
313
- if (mask) for (const key in mask) {
314
- if (!(key in shape)) throw new Error(`Unrecognized key: "${key}"`);
245
+ if (mask) for (const key of Reflect.ownKeys(mask)) {
246
+ if (!Object.prototype.hasOwnProperty.call(shape, key)) throw new Error(`Unrecognized key: "${String(key)}"`);
315
247
  if (!mask[key]) continue;
316
248
  shape[key] = new Class({
317
249
  type: "nonoptional",
318
250
  innerType: oldShape[key]
319
251
  });
320
252
  }
321
- else for (const key in oldShape) shape[key] = new Class({
253
+ else for (const key of Reflect.ownKeys(oldShape)) shape[key] = new Class({
322
254
  type: "nonoptional",
323
255
  innerType: oldShape[key]
324
256
  });
@@ -347,19 +279,54 @@ function prefixIssues(path, issues) {
347
279
  function unwrapMessage(message) {
348
280
  return typeof message === "string" ? message : message?.message;
349
281
  }
282
+ function attachSchema(issues, start, inst) {
283
+ var _a;
284
+ for (let i = start; i < issues.length; i++) (_a = issues[i]).schema ?? (_a.schema = inst);
285
+ }
350
286
  function finalizeIssue(iss, ctx, config) {
351
- const message = iss.message ? iss.message : unwrapMessage(iss.inst?._zod.def?.error?.(iss)) ?? unwrapMessage(ctx?.error?.(iss)) ?? unwrapMessage(config.customError?.(iss)) ?? unwrapMessage(config.localeError?.(iss)) ?? "Invalid input";
352
- const { inst: _inst, continue: _continue, input: _input, ...rest } = iss;
287
+ var _a;
288
+ const traits = iss.inst?._zod?.traits;
289
+ if (traits?.has("$ZodType")) {
290
+ if (traits.has("$ZodCheck")) (_a = iss).schema ?? (_a.schema = iss.inst);
291
+ else iss.schema = iss.inst;
292
+ }
293
+ const schemaError = iss.schema !== iss.inst ? iss.schema?._zod.def?.error : void 0;
294
+ const message = iss.message ? iss.message : unwrapMessage(iss.inst?._zod.def?.error?.(iss)) ?? unwrapMessage(schemaError?.(iss)) ?? unwrapMessage(ctx?.error?.(iss)) ?? unwrapMessage(config.customError?.(iss)) ?? unwrapMessage(config.localeError?.(iss)) ?? "Invalid input";
295
+ const { inst: _inst, schema: _schema, continue: _continue, input: _input, ...rest } = iss;
353
296
  rest.path ?? (rest.path = []);
354
297
  rest.message = message;
355
298
  if (ctx?.reportInput) rest.input = _input;
356
299
  return rest;
357
300
  }
301
+ const highSurrogate = /[\uD800-\uDBFF]/;
302
+ function codePointLength(str) {
303
+ const units = str.length;
304
+ if (!highSurrogate.test(str)) return units;
305
+ let count = units;
306
+ for (let i = 0; i < units - 1; i++) if ((str.charCodeAt(i) & 64512) === 55296 && (str.charCodeAt(i + 1) & 64512) === 56320) {
307
+ count--;
308
+ i++;
309
+ }
310
+ return count;
311
+ }
358
312
  function getLengthableOrigin(input) {
359
313
  if (Array.isArray(input)) return "array";
360
314
  if (typeof input === "string") return "string";
361
315
  return "unknown";
362
316
  }
317
+ function parsedType(data) {
318
+ const t = typeof data;
319
+ switch (t) {
320
+ case "number": return Number.isNaN(data) ? "nan" : "number";
321
+ case "object": {
322
+ if (data === null) return "null";
323
+ if (Array.isArray(data)) return "array";
324
+ const obj = data;
325
+ if (obj && Object.getPrototypeOf(obj) !== Object.prototype && "constructor" in obj && obj.constructor) return obj.constructor.name;
326
+ }
327
+ }
328
+ return t;
329
+ }
363
330
  function issue(...args) {
364
331
  const [iss, input, inst] = args;
365
332
  if (typeof iss === "string") return {
@@ -370,33 +337,330 @@ function issue(...args) {
370
337
  };
371
338
  return { ...iss };
372
339
  }
373
- //#endregion
374
- //#region node_modules/.pnpm/zod@4.4.3/node_modules/zod/v4/core/errors.js
375
- const initializer$1 = (inst, def) => {
376
- inst.name = "$ZodError";
377
- Object.defineProperty(inst, "_zod", {
378
- value: inst._zod,
379
- enumerable: false
340
+ /**
341
+ * Installs a trait's members on its prototype. Each value builds that member for the instance on first read; the built value shadows the accessor as an own property, so a detached `const { parse } = schema` keeps working.
342
+ *
343
+ * Call this from a `proto` initializer, which runs once per prototype — never per instance.
344
+ */
345
+ function members(proto, table) {
346
+ for (const key in table) {
347
+ const desc = Object.getOwnPropertyDescriptor(table, key);
348
+ if (desc.get) Object.defineProperty(proto, key, {
349
+ ...desc,
350
+ enumerable: false
351
+ });
352
+ else defineBound(proto, key, desc.value);
353
+ }
354
+ }
355
+ /** Shadows a prototype member with an own value, so a getter that builds from the instance runs once. */
356
+ function own(inst, key, value, enumerable = true) {
357
+ Object.defineProperty(inst, key, {
358
+ configurable: true,
359
+ writable: true,
360
+ enumerable,
361
+ value
380
362
  });
381
- Object.defineProperty(inst, "issues", {
382
- value: def,
383
- enumerable: false
363
+ return value;
364
+ }
365
+ /** Like {@link own}, for a member that was never an own data property and has to stay out of `Object.keys`. */
366
+ function hide(inst, key, value) {
367
+ return own(inst, key, value, false);
368
+ }
369
+ function defineBound(proto, key, fn) {
370
+ Object.defineProperty(proto, key, {
371
+ configurable: true,
372
+ get() {
373
+ return this == null ? fn : own(this, key, fn.bind(this));
374
+ },
375
+ set(value) {
376
+ own(this, key, value);
377
+ }
384
378
  });
385
- inst.message = JSON.stringify(def, jsonStringifyReplacer, 2);
386
- Object.defineProperty(inst, "toString", {
387
- value: () => inst.message,
388
- enumerable: false
379
+ }
380
+ /** Returns the prototype to install on, or `undefined` if this group is already installed on it. */
381
+ function claim(inst, sentinel) {
382
+ const proto = Object.getPrototypeOf(inst);
383
+ return sentinel in proto ? void 0 : proto;
384
+ }
385
+ let installing;
386
+ let broke = false;
387
+ const breaker = {
388
+ configurable: true,
389
+ get() {
390
+ broke = true;
391
+ }
392
+ };
393
+ /**
394
+ * Installs a lazily-derived internal on the `_zod` prototype of `inst`'s
395
+ * constructor, computed from the internals object itself and cached there on
396
+ * first read. One accessor per constructor rather than one per instance.
397
+ */
398
+ function defineLazyInternal(inst, key, compute) {
399
+ const proto = Object.getPrototypeOf(inst._zod);
400
+ if (key in proto && installing !== inst._zod) {
401
+ installing = void 0;
402
+ return;
403
+ }
404
+ installing = inst._zod;
405
+ Object.defineProperty(proto, key, {
406
+ configurable: true,
407
+ get() {
408
+ Object.defineProperty(this, key, breaker);
409
+ const outer = broke;
410
+ broke = false;
411
+ try {
412
+ const value = compute(this);
413
+ if (broke) delete this[key];
414
+ else Object.defineProperty(this, key, {
415
+ configurable: true,
416
+ writable: true,
417
+ value
418
+ });
419
+ broke = broke || outer;
420
+ return value;
421
+ } catch (err) {
422
+ delete this[key];
423
+ broke = broke || outer;
424
+ throw err;
425
+ }
426
+ },
427
+ set(value) {
428
+ Object.defineProperty(this, key, {
429
+ configurable: true,
430
+ writable: true,
431
+ value
432
+ });
433
+ }
389
434
  });
435
+ }
436
+ /**
437
+ * Installs `key` on `inst`'s prototype, computed by `make` on first read and cached there as an own
438
+ * data property. One accessor per constructor rather than one per instance, because an own accessor
439
+ * puts every instance after the first into v8 dictionary mode. The key doubles as the sentinel.
440
+ */
441
+ function installLazyProp(inst, key, make, enumerable) {
442
+ const proto = claim(inst, key);
443
+ if (!proto) return;
444
+ Object.defineProperty(proto, key, {
445
+ configurable: true,
446
+ get() {
447
+ const desc = {
448
+ configurable: true,
449
+ writable: true,
450
+ enumerable,
451
+ value: void 0
452
+ };
453
+ Object.defineProperty(this, key, desc);
454
+ desc.value = make(this);
455
+ Object.defineProperty(this, key, desc);
456
+ return desc.value;
457
+ },
458
+ set(value) {
459
+ Object.defineProperty(this, key, {
460
+ configurable: true,
461
+ writable: true,
462
+ enumerable,
463
+ value
464
+ });
465
+ }
466
+ });
467
+ }
468
+ /** Marks the thunk `_catch` synthesises for a constant catch value. `Function.length` cannot tell that thunk from a user callback — rest and defaulted parameters both report arity 0 — and a user callback reads `ctx.error`, whose issues only finalize correctly against the caller's per-parse error map. Provenance can say what arity cannot. A plain string key rather than `Symbol.for`, whose call at module scope no bundler can prove pure — the same shape that anchored `urlCanParse` into every build. */
469
+ const CONSTANT_CATCH = "~constantCatch";
470
+ /** Wraps a constant catch value in a thunk tagged with {@link CONSTANT_CATCH}. */
471
+ function constantCatch(value) {
472
+ const fn = () => value;
473
+ fn[CONSTANT_CATCH] = true;
474
+ return fn;
475
+ }
476
+ //#endregion
477
+ //#region node_modules/.pnpm/zod@4.5.4/node_modules/zod/v4/core/core.js
478
+ var _a$1;
479
+ const _zodDesc$1 = {
480
+ value: void 0,
481
+ enumerable: false
482
+ };
483
+ let _E = "captureStackTrace" in Error ? Error : null;
484
+ function newError(Definition) {
485
+ const E = _E;
486
+ if (E) {
487
+ const saved = E.stackTraceLimit;
488
+ if (typeof saved === "number") {
489
+ try {
490
+ E.stackTraceLimit = 0;
491
+ } catch {
492
+ _E = null;
493
+ return new Definition();
494
+ }
495
+ try {
496
+ return new Definition();
497
+ } finally {
498
+ E.stackTraceLimit = saved;
499
+ }
500
+ }
501
+ }
502
+ return new Definition();
503
+ }
504
+ function $constructor(name, initializer, proto, params) {
505
+ const zodProto = {};
506
+ function Internals(def) {
507
+ this.def = def;
508
+ this.constr = _;
509
+ this.traits = /* @__PURE__ */ new Set();
510
+ }
511
+ Internals.prototype = zodProto;
512
+ const protoMembers = proto;
513
+ const initialized = protoMembers && /* @__PURE__ */ new WeakSet();
514
+ function init(inst, def) {
515
+ if (!inst._zod) {
516
+ _zodDesc$1.value = new Internals(def);
517
+ try {
518
+ Object.defineProperty(inst, "_zod", _zodDesc$1);
519
+ } finally {
520
+ _zodDesc$1.value = void 0;
521
+ }
522
+ }
523
+ if (inst._zod.traits.has(name)) return;
524
+ inst._zod.traits.add(name);
525
+ initializer(inst, def);
526
+ if (initialized) {
527
+ const own = Object.getPrototypeOf(inst);
528
+ const ctorProto = inst._zod.constr.prototype;
529
+ let up = own;
530
+ while (up && up !== ctorProto) up = Object.getPrototypeOf(up);
531
+ const target = up ?? own;
532
+ if (!initialized.has(target)) {
533
+ initialized.add(target);
534
+ members(target, protoMembers);
535
+ }
536
+ }
537
+ const proto = _.prototype;
538
+ for (const k in proto) {
539
+ if (!Object.prototype.hasOwnProperty.call(proto, k)) continue;
540
+ if (!(k in inst)) inst[k] = proto[k].bind(inst);
541
+ }
542
+ }
543
+ const Parent = params?.Parent ?? Object;
544
+ class Definition extends Parent {}
545
+ Object.defineProperty(Definition, "name", { value: name });
546
+ function _(def) {
547
+ const inst = params?.Parent ? newError(Definition) : this;
548
+ init(inst, def);
549
+ const deferred = inst._zod.deferred;
550
+ if (deferred) {
551
+ for (const fn of deferred) fn();
552
+ inst._zod.deferred = void 0;
553
+ }
554
+ const pp = globalThis.__zod_globalConfig?.postProcessor;
555
+ if (pp) pp(inst);
556
+ return inst;
557
+ }
558
+ Object.defineProperty(_, "init", { value: init });
559
+ Object.defineProperty(_, Symbol.hasInstance, { value: (inst) => {
560
+ if (params?.Parent && inst instanceof params.Parent) return true;
561
+ return inst?._zod?.traits?.has(name);
562
+ } });
563
+ Object.defineProperty(_, "name", { value: name });
564
+ return _;
565
+ }
566
+ var $ZodAsyncError = class extends Error {
567
+ constructor() {
568
+ super(`Encountered Promise during synchronous parse. Use .parseAsync() instead.`);
569
+ }
570
+ };
571
+ var $ZodEncodeError = class extends Error {
572
+ constructor(name) {
573
+ super(`Encountered unidirectional transform during encode: ${name}`);
574
+ this.name = "ZodEncodeError";
575
+ }
576
+ };
577
+ (_a$1 = globalThis).__zod_globalConfig ?? (_a$1.__zod_globalConfig = {});
578
+ const globalConfig = globalThis.__zod_globalConfig;
579
+ function config(newConfig) {
580
+ if (newConfig) Object.assign(globalConfig, newConfig);
581
+ return globalConfig;
582
+ }
583
+ //#endregion
584
+ //#region node_modules/.pnpm/zod@4.5.4/node_modules/zod/v4/core/errors.js
585
+ function _getMessage() {
586
+ const internals = this._zod;
587
+ internals.message ?? (internals.message = JSON.stringify(internals.def, jsonStringifyReplacer, 2));
588
+ return internals.message;
589
+ }
590
+ function _setMessage(value) {
591
+ this._zod.message = value;
592
+ }
593
+ const _messageDesc = {
594
+ get: _getMessage,
595
+ set: _setMessage,
596
+ enumerable: true,
597
+ configurable: true
598
+ };
599
+ const _zodDesc = {
600
+ value: void 0,
601
+ enumerable: false
602
+ };
603
+ const _issuesDesc = {
604
+ value: void 0,
605
+ enumerable: false
606
+ };
607
+ const _installedToString = /* @__PURE__ */ new WeakSet([Object.prototype, Error.prototype]);
608
+ const initializer$1 = (inst, def) => {
609
+ inst.name = "$ZodError";
610
+ _zodDesc.value = inst._zod;
611
+ Object.defineProperty(inst, "_zod", _zodDesc);
612
+ _issuesDesc.value = def;
613
+ Object.defineProperty(inst, "issues", _issuesDesc);
614
+ _zodDesc.value = void 0;
615
+ _issuesDesc.value = void 0;
616
+ Object.defineProperty(inst, "message", _messageDesc);
617
+ const proto = Object.getPrototypeOf(inst);
618
+ if (!_installedToString.has(proto)) {
619
+ _installedToString.add(proto);
620
+ Object.defineProperty(proto, "toString", {
621
+ configurable: true,
622
+ enumerable: false,
623
+ get() {
624
+ const value = () => this.message;
625
+ Object.defineProperty(this, "toString", {
626
+ value,
627
+ configurable: true,
628
+ writable: true
629
+ });
630
+ return value;
631
+ },
632
+ set(value) {
633
+ Object.defineProperty(this, "toString", {
634
+ value,
635
+ configurable: true,
636
+ writable: true
637
+ });
638
+ }
639
+ });
640
+ }
390
641
  };
391
642
  const $ZodError = $constructor("$ZodError", initializer$1);
392
- const $ZodRealError = $constructor("$ZodError", initializer$1, { Parent: Error });
643
+ const $ZodRealError = $constructor("$ZodError", initializer$1, void 0, { Parent: Error });
644
+ /** Get-or-create `obj[key]` as an own data property. A path segment naming an inherited member
645
+ * ("toString", "constructor") would otherwise read through to the prototype, and assigning
646
+ * "__proto__" would hit the setter instead of creating a key. */
647
+ function node(obj, key, make) {
648
+ if (!Object.prototype.hasOwnProperty.call(obj, key)) {
649
+ if (key === "__proto__") Object.defineProperty(obj, key, {
650
+ value: make(),
651
+ writable: true,
652
+ enumerable: true,
653
+ configurable: true
654
+ });
655
+ else obj[key] = make();
656
+ }
657
+ return obj[key];
658
+ }
393
659
  function flattenError(error, mapper = (issue) => issue.message) {
394
660
  const fieldErrors = {};
395
661
  const formErrors = [];
396
- for (const sub of error.issues) if (sub.path.length > 0) {
397
- fieldErrors[sub.path[0]] = fieldErrors[sub.path[0]] || [];
398
- fieldErrors[sub.path[0]].push(mapper(sub));
399
- } else formErrors.push(mapper(sub));
662
+ for (const sub of error.issues) if (sub.path.length > 0) node(fieldErrors, sub.path[0], () => []).push(mapper(sub));
663
+ else formErrors.push(mapper(sub));
400
664
  return {
401
665
  formErrors,
402
666
  fieldErrors
@@ -416,12 +680,21 @@ function formatError(error, mapper = (issue) => issue.message) {
416
680
  let i = 0;
417
681
  while (i < fullpath.length) {
418
682
  const el = fullpath[i];
419
- if (!(i === fullpath.length - 1)) curr[el] = curr[el] || { _errors: [] };
420
- else {
421
- curr[el] = curr[el] || { _errors: [] };
422
- curr[el]._errors.push(mapper(issue));
683
+ const terminal = i === fullpath.length - 1;
684
+ if (el === "_errors") {
685
+ if (terminal) curr._errors.push(mapper(issue));
686
+ i++;
687
+ continue;
423
688
  }
424
- curr = curr[el];
689
+ if (!Object.prototype.hasOwnProperty.call(curr, el)) Object.defineProperty(curr, el, {
690
+ value: { _errors: [] },
691
+ enumerable: true,
692
+ writable: true,
693
+ configurable: true
694
+ });
695
+ const node = curr[el];
696
+ if (terminal) node._errors.push(mapper(issue));
697
+ curr = node;
425
698
  i++;
426
699
  }
427
700
  }
@@ -431,40 +704,52 @@ function formatError(error, mapper = (issue) => issue.message) {
431
704
  return fieldErrors;
432
705
  }
433
706
  //#endregion
434
- //#region node_modules/.pnpm/zod@4.4.3/node_modules/zod/v4/core/parse.js
435
- const _parse = (_Err) => (schema, value, _ctx, _params) => {
436
- const ctx = _ctx ? {
437
- ..._ctx,
438
- async: false
439
- } : { async: false };
440
- const result = schema._zod.run({
441
- value,
442
- issues: []
443
- }, ctx);
444
- if (result instanceof Promise) throw new $ZodAsyncError();
445
- if (result.issues.length) {
446
- const e = new ((_params?.Err) ?? _Err)(result.issues.map((iss) => finalizeIssue(iss, ctx, config())));
447
- captureStackTrace(e, _params?.callee);
448
- throw e;
449
- }
450
- return result.value;
707
+ //#region node_modules/.pnpm/zod@4.5.4/node_modules/zod/v4/core/parse.js
708
+ function finalizeParams(callee, params) {
709
+ return {
710
+ callee: params?.callee ?? callee,
711
+ Err: params?.Err
712
+ };
713
+ }
714
+ const _parse = (_Err) => {
715
+ const fn = (schema, value, _ctx, _params) => {
716
+ const ctx = _ctx ? {
717
+ ..._ctx,
718
+ async: false
719
+ } : { async: false };
720
+ const result = schema._zod.run({
721
+ value,
722
+ issues: []
723
+ }, ctx);
724
+ if (result instanceof Promise) throw new $ZodAsyncError();
725
+ if (result.issues.length) {
726
+ const e = new ((_params?.Err) ?? _Err)(result.issues.map((iss) => finalizeIssue(iss, ctx, config())));
727
+ captureStackTrace(e, _params?.callee ?? fn);
728
+ throw e;
729
+ }
730
+ return result.value;
731
+ };
732
+ return fn;
451
733
  };
452
- const _parseAsync = (_Err) => async (schema, value, _ctx, params) => {
453
- const ctx = _ctx ? {
454
- ..._ctx,
455
- async: true
456
- } : { async: true };
457
- let result = schema._zod.run({
458
- value,
459
- issues: []
460
- }, ctx);
461
- if (result instanceof Promise) result = await result;
462
- if (result.issues.length) {
463
- const e = new ((params?.Err) ?? _Err)(result.issues.map((iss) => finalizeIssue(iss, ctx, config())));
464
- captureStackTrace(e, params?.callee);
465
- throw e;
466
- }
467
- return result.value;
734
+ const _parseAsync = (_Err) => {
735
+ const fn = async (schema, value, _ctx, params) => {
736
+ const ctx = _ctx ? {
737
+ ..._ctx,
738
+ async: true
739
+ } : { async: true };
740
+ let result = schema._zod.run({
741
+ value,
742
+ issues: []
743
+ }, ctx);
744
+ if (result instanceof Promise) result = await result;
745
+ if (result.issues.length) {
746
+ const e = new ((params?.Err) ?? _Err)(result.issues.map((iss) => finalizeIssue(iss, ctx, config())));
747
+ captureStackTrace(e, params?.callee ?? fn);
748
+ throw e;
749
+ }
750
+ return result.value;
751
+ };
752
+ return fn;
468
753
  };
469
754
  const _safeParse = (_Err) => (schema, value, _ctx) => {
470
755
  const ctx = _ctx ? {
@@ -504,25 +789,41 @@ const _safeParseAsync = (_Err) => async (schema, value, _ctx) => {
504
789
  };
505
790
  };
506
791
  const safeParseAsync$1 = /* @__PURE__*/ _safeParseAsync($ZodRealError);
507
- const _encode = (_Err) => (schema, value, _ctx) => {
508
- const ctx = _ctx ? {
509
- ..._ctx,
510
- direction: "backward"
511
- } : { direction: "backward" };
512
- return _parse(_Err)(schema, value, ctx);
792
+ const _encode = (_Err) => {
793
+ const parse = _parse(_Err);
794
+ const fn = (schema, value, _ctx, _params) => {
795
+ const ctx = _ctx ? {
796
+ ..._ctx,
797
+ direction: "backward"
798
+ } : { direction: "backward" };
799
+ return parse(schema, value, ctx, finalizeParams(fn, _params));
800
+ };
801
+ return fn;
513
802
  };
514
- const _decode = (_Err) => (schema, value, _ctx) => {
515
- return _parse(_Err)(schema, value, _ctx);
803
+ const _decode = (_Err) => {
804
+ const parse = _parse(_Err);
805
+ const fn = (schema, value, _ctx, _params) => {
806
+ return parse(schema, value, _ctx, finalizeParams(fn, _params));
807
+ };
808
+ return fn;
516
809
  };
517
- const _encodeAsync = (_Err) => async (schema, value, _ctx) => {
518
- const ctx = _ctx ? {
519
- ..._ctx,
520
- direction: "backward"
521
- } : { direction: "backward" };
522
- return _parseAsync(_Err)(schema, value, ctx);
810
+ const _encodeAsync = (_Err) => {
811
+ const parseAsync = _parseAsync(_Err);
812
+ const fn = async (schema, value, _ctx, _params) => {
813
+ const ctx = _ctx ? {
814
+ ..._ctx,
815
+ direction: "backward"
816
+ } : { direction: "backward" };
817
+ return await parseAsync(schema, value, ctx, finalizeParams(fn, _params));
818
+ };
819
+ return fn;
523
820
  };
524
- const _decodeAsync = (_Err) => async (schema, value, _ctx) => {
525
- return _parseAsync(_Err)(schema, value, _ctx);
821
+ const _decodeAsync = (_Err) => {
822
+ const parseAsync = _parseAsync(_Err);
823
+ const fn = async (schema, value, _ctx, _params) => {
824
+ return await parseAsync(schema, value, _ctx, finalizeParams(fn, _params));
825
+ };
826
+ return fn;
526
827
  };
527
828
  const _safeEncode = (_Err) => (schema, value, _ctx) => {
528
829
  const ctx = _ctx ? {
@@ -545,7 +846,7 @@ const _safeDecodeAsync = (_Err) => async (schema, value, _ctx) => {
545
846
  return _safeParseAsync(_Err)(schema, value, _ctx);
546
847
  };
547
848
  //#endregion
548
- //#region node_modules/.pnpm/zod@4.4.3/node_modules/zod/v4/core/regexes.js
849
+ //#region node_modules/.pnpm/zod@4.5.4/node_modules/zod/v4/core/regexes.js
549
850
  /**
550
851
  * @deprecated CUID v1 is deprecated by its authors due to information leakage
551
852
  * (timestamps embedded in the id). Use {@link cuid2} instead.
@@ -553,12 +854,15 @@ const _safeDecodeAsync = (_Err) => async (schema, value, _ctx) => {
553
854
  */
554
855
  const cuid = /^[cC][0-9a-z]{6,}$/;
555
856
  const cuid2 = /^[0-9a-z]+$/;
556
- const ulid = /^[0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{26}$/;
857
+ const ulid = /^[0-7][0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{25}$/;
557
858
  const xid = /^[0-9a-vA-V]{20}$/;
558
859
  const ksuid = /^[A-Za-z0-9]{27}$/;
559
860
  const nanoid = /^[a-zA-Z0-9_-]{21}$/;
861
+ function nanoidOfLength(length) {
862
+ return new RegExp(`^[a-zA-Z0-9_-]{${length}}$`);
863
+ }
560
864
  /** ISO 8601-1 duration regex. Does not support the 8601-2 extensions like negative durations or fractional/negative components. */
561
- const duration$1 = /^P(?:(\d+W)|(?!.*W)(?=\d|T\d)(\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+([.,]\d+)?S)?)?)$/;
865
+ const duration = /^P(?:(\d+W)|(?!.*W)(?=\d|T\d)(\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+([.,]\d+)?S)?)?)$/;
562
866
  /** A regex for any UUID-like identifier: 8-4-4-4-12 hex pattern */
563
867
  const guid = /^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12})$/;
564
868
  /** Returns a regex for validating an RFC 9562/4122 UUID.
@@ -570,33 +874,41 @@ const uuid = (version) => {
570
874
  };
571
875
  /** Practical email validation */
572
876
  const email = /^(?!\.)(?!.*\.\.)([A-Za-z0-9_'+\-\.]*)[A-Za-z0-9_+-]@([A-Za-z0-9][A-Za-z0-9\-]*\.)+[A-Za-z]{2,}$/;
573
- const _emoji$1 = `^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$`;
877
+ const _emoji$1 = `^[\\p{Extended_Pictographic}\\p{Emoji_Component}]+$`;
574
878
  function emoji() {
575
879
  return new RegExp(_emoji$1, "u");
576
880
  }
577
881
  const ipv4 = /^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])$/;
578
882
  const ipv6 = /^(([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:))$/;
579
883
  const cidrv4 = /^((25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\/([0-9]|[1-2][0-9]|3[0-2])$/;
580
- const cidrv6 = /^(([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}|::|([0-9a-fA-F]{1,4})?::([0-9a-fA-F]{1,4}:?){0,6})\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/;
884
+ const 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])$/;
581
885
  const base64 = /^$|^(?:[0-9a-zA-Z+/]{4})*(?:(?:[0-9a-zA-Z+/]{2}==)|(?:[0-9a-zA-Z+/]{3}=))?$/;
582
886
  const base64url = /^[A-Za-z0-9_-]*$/;
583
887
  const httpProtocol = /^https?$/;
584
888
  const e164 = /^\+[1-9]\d{6,14}$/;
585
889
  const 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])))`;
586
- const date$1 = /*@__PURE__*/ new RegExp(`^${dateSource}$`);
890
+ /** Anchors a pattern source. The interpolation lives here rather than at the call site because
891
+ * esbuild will not drop a `@__PURE__` call whose own argument interpolates a variable, but it
892
+ * will drop `anchor(dateSource)`. Keeping it inline pinned `date` into every bundle. */
893
+ function anchor(source) {
894
+ return new RegExp(`^${source}$`);
895
+ }
896
+ const date = /*@__PURE__*/ anchor(dateSource);
587
897
  function timeSource(args) {
588
898
  const hhmm = `(?:[01]\\d|2[0-3]):[0-5]\\d`;
589
- return typeof args.precision === "number" ? args.precision === -1 ? `${hhmm}` : args.precision === 0 ? `${hhmm}:[0-5]\\d` : `${hhmm}:[0-5]\\d\\.\\d{${args.precision}}` : `${hhmm}(?::[0-5]\\d(?:\\.\\d+)?)?`;
899
+ return typeof args.precision === "number" ? args.precision === -1 ? `${hhmm}` : args.precision === 0 ? `${hhmm}:[0-5]\\d` : `${hhmm}:[0-5]\\d\\.\\d{${args.precision}}` : args.seconds ? `${hhmm}:[0-5]\\d(?:\\.\\d+)?` : `${hhmm}(?::[0-5]\\d(?:\\.\\d+)?)?`;
590
900
  }
591
- function time$1(args) {
901
+ function time(args) {
592
902
  return new RegExp(`^${timeSource(args)}$`);
593
903
  }
594
- function datetime$1(args) {
595
- const time = timeSource({ precision: args.precision });
904
+ function datetime(args) {
596
905
  const opts = ["Z"];
597
- if (args.local) opts.push("");
598
906
  if (args.offset) opts.push(`([+-](?:[01]\\d|2[0-3]):[0-5]\\d)`);
599
- const timeRegex = `${time}(?:${opts.join("|")})`;
907
+ const qualified = `${timeSource({
908
+ precision: args.precision,
909
+ seconds: true
910
+ })}(?:${opts.join("|")})`;
911
+ const timeRegex = args.local ? `${qualified}|${timeSource({ precision: args.precision })}` : qualified;
600
912
  return new RegExp(`^${dateSource}T(?:${timeRegex})$`);
601
913
  }
602
914
  const string$1 = (params) => {
@@ -609,13 +921,18 @@ const boolean$1 = /^(?:true|false)$/i;
609
921
  const lowercase = /^[^A-Z]*$/;
610
922
  const uppercase = /^[^a-z]*$/;
611
923
  //#endregion
612
- //#region node_modules/.pnpm/zod@4.4.3/node_modules/zod/v4/core/checks.js
924
+ //#region node_modules/.pnpm/zod@4.5.4/node_modules/zod/v4/core/checks.js
613
925
  const $ZodCheck = /*@__PURE__*/ $constructor("$ZodCheck", (inst, def) => {
614
926
  var _a;
615
927
  inst._zod ?? (inst._zod = {});
616
928
  inst._zod.def = def;
617
929
  (_a = inst._zod).onattach ?? (_a.onattach = []);
618
930
  });
931
+ /** Default `when` for length-based checks: run only on non-nullish values with a `length`. */
932
+ const _whenHasLength = (payload) => {
933
+ const val = payload.value;
934
+ return !nullish(val) && val.length !== void 0;
935
+ };
619
936
  const numericOriginMap = {
620
937
  number: "number",
621
938
  bigint: "bigint",
@@ -635,7 +952,7 @@ const $ZodCheckLessThan = /*@__PURE__*/ $constructor("$ZodCheckLessThan", (inst,
635
952
  inst._zod.check = (payload) => {
636
953
  if (def.inclusive ? payload.value <= def.value : payload.value < def.value) return;
637
954
  payload.issues.push({
638
- origin,
955
+ origin: numericOriginMap[typeof payload.value] ?? origin,
639
956
  code: "too_big",
640
957
  maximum: typeof def.value === "object" ? def.value.getTime() : def.value,
641
958
  input: payload.value,
@@ -659,7 +976,7 @@ const $ZodCheckGreaterThan = /*@__PURE__*/ $constructor("$ZodCheckGreaterThan",
659
976
  inst._zod.check = (payload) => {
660
977
  if (def.inclusive ? payload.value >= def.value : payload.value > def.value) return;
661
978
  payload.issues.push({
662
- origin,
979
+ origin: numericOriginMap[typeof payload.value] ?? origin,
663
980
  code: "too_small",
664
981
  minimum: typeof def.value === "object" ? def.value.getTime() : def.value,
665
982
  input: payload.value,
@@ -677,7 +994,7 @@ const $ZodCheckMultipleOf = /*@__PURE__*/ $constructor("$ZodCheckMultipleOf", (i
677
994
  });
678
995
  inst._zod.check = (payload) => {
679
996
  if (typeof payload.value !== typeof def.value) throw new Error("Cannot mix number and bigint in multiple_of check.");
680
- if (typeof payload.value === "bigint" ? payload.value % def.value === BigInt(0) : floatSafeRemainder(payload.value, def.value) === 0) return;
997
+ if (typeof payload.value === "bigint" ? def.value !== BigInt(0) && payload.value % def.value === BigInt(0) : floatSafeRemainder(payload.value, def.value) === 0) return;
681
998
  payload.issues.push({
682
999
  origin: typeof payload.value,
683
1000
  code: "not_multiple_of",
@@ -762,17 +1079,15 @@ const $ZodCheckNumberFormat = /*@__PURE__*/ $constructor("$ZodCheckNumberFormat"
762
1079
  const $ZodCheckMaxLength = /*@__PURE__*/ $constructor("$ZodCheckMaxLength", (inst, def) => {
763
1080
  var _a;
764
1081
  $ZodCheck.init(inst, def);
765
- (_a = inst._zod.def).when ?? (_a.when = (payload) => {
766
- const val = payload.value;
767
- return !nullish(val) && val.length !== void 0;
768
- });
1082
+ (_a = inst._zod.def).when ?? (_a.when = _whenHasLength);
769
1083
  inst._zod.onattach.push((inst) => {
770
1084
  const curr = inst._zod.bag.maximum ?? Number.POSITIVE_INFINITY;
771
1085
  if (def.maximum < curr) inst._zod.bag.maximum = def.maximum;
772
1086
  });
773
1087
  inst._zod.check = (payload) => {
774
1088
  const input = payload.value;
775
- if (input.length <= def.maximum) return;
1089
+ const units = input.length;
1090
+ if ((typeof input === "string" && units > def.maximum ? codePointLength(input) : units) <= def.maximum) return;
776
1091
  const origin = getLengthableOrigin(input);
777
1092
  payload.issues.push({
778
1093
  origin,
@@ -788,17 +1103,15 @@ const $ZodCheckMaxLength = /*@__PURE__*/ $constructor("$ZodCheckMaxLength", (ins
788
1103
  const $ZodCheckMinLength = /*@__PURE__*/ $constructor("$ZodCheckMinLength", (inst, def) => {
789
1104
  var _a;
790
1105
  $ZodCheck.init(inst, def);
791
- (_a = inst._zod.def).when ?? (_a.when = (payload) => {
792
- const val = payload.value;
793
- return !nullish(val) && val.length !== void 0;
794
- });
1106
+ (_a = inst._zod.def).when ?? (_a.when = _whenHasLength);
795
1107
  inst._zod.onattach.push((inst) => {
796
1108
  const curr = inst._zod.bag.minimum ?? Number.NEGATIVE_INFINITY;
797
1109
  if (def.minimum > curr) inst._zod.bag.minimum = def.minimum;
798
1110
  });
799
1111
  inst._zod.check = (payload) => {
800
1112
  const input = payload.value;
801
- if (input.length >= def.minimum) return;
1113
+ const units = input.length;
1114
+ if ((typeof input === "string" && units >= def.minimum && units < def.minimum * 2 ? codePointLength(input) : units) >= def.minimum) return;
802
1115
  const origin = getLengthableOrigin(input);
803
1116
  payload.issues.push({
804
1117
  origin,
@@ -814,10 +1127,7 @@ const $ZodCheckMinLength = /*@__PURE__*/ $constructor("$ZodCheckMinLength", (ins
814
1127
  const $ZodCheckLengthEquals = /*@__PURE__*/ $constructor("$ZodCheckLengthEquals", (inst, def) => {
815
1128
  var _a;
816
1129
  $ZodCheck.init(inst, def);
817
- (_a = inst._zod.def).when ?? (_a.when = (payload) => {
818
- const val = payload.value;
819
- return !nullish(val) && val.length !== void 0;
820
- });
1130
+ (_a = inst._zod.def).when ?? (_a.when = _whenHasLength);
821
1131
  inst._zod.onattach.push((inst) => {
822
1132
  const bag = inst._zod.bag;
823
1133
  bag.minimum = def.length;
@@ -826,7 +1136,8 @@ const $ZodCheckLengthEquals = /*@__PURE__*/ $constructor("$ZodCheckLengthEquals"
826
1136
  });
827
1137
  inst._zod.check = (payload) => {
828
1138
  const input = payload.value;
829
- const length = input.length;
1139
+ const units = input.length;
1140
+ const length = typeof input === "string" && units >= def.length && units <= def.length * 2 ? codePointLength(input) : units;
830
1141
  if (length === def.length) return;
831
1142
  const origin = getLengthableOrigin(input);
832
1143
  const tooBig = length > def.length;
@@ -900,7 +1211,7 @@ const $ZodCheckUpperCase = /*@__PURE__*/ $constructor("$ZodCheckUpperCase", (ins
900
1211
  const $ZodCheckIncludes = /*@__PURE__*/ $constructor("$ZodCheckIncludes", (inst, def) => {
901
1212
  $ZodCheck.init(inst, def);
902
1213
  const escapedRegex = escapeRegex(def.includes);
903
- const pattern = new RegExp(typeof def.position === "number" ? `^.{${def.position}}${escapedRegex}` : escapedRegex);
1214
+ const pattern = new RegExp(typeof def.position === "number" ? `^.{${def.position},}${escapedRegex}` : escapedRegex);
904
1215
  def.pattern = pattern;
905
1216
  inst._zod.onattach.push((inst) => {
906
1217
  const bag = inst._zod.bag;
@@ -971,12 +1282,13 @@ const $ZodCheckOverwrite = /*@__PURE__*/ $constructor("$ZodCheckOverwrite", (ins
971
1282
  };
972
1283
  });
973
1284
  //#endregion
974
- //#region node_modules/.pnpm/zod@4.4.3/node_modules/zod/v4/core/doc.js
1285
+ //#region node_modules/.pnpm/zod@4.5.4/node_modules/zod/v4/core/doc.js
975
1286
  var Doc = class {
976
- constructor(args = []) {
1287
+ constructor(args = [], closed = {}) {
977
1288
  this.content = [];
978
1289
  this.indent = 0;
979
- if (this) this.args = args;
1290
+ this.args = args;
1291
+ this.closed = closed;
980
1292
  }
981
1293
  indented(fn) {
982
1294
  this.indent += 1;
@@ -996,28 +1308,27 @@ var Doc = class {
996
1308
  }
997
1309
  compile() {
998
1310
  const F = Function;
999
- const args = this?.args;
1000
- const lines = [...(this?.content ?? [``]).map((x) => ` ${x}`)];
1001
- return new F(...args, lines.join("\n"));
1311
+ const content = this?.content ?? [``];
1312
+ return new F(...Object.keys(this.closed), `return function (${this.args.join(", ")}) {\n${content.join("\n")}\n};`)(...Object.values(this.closed));
1002
1313
  }
1003
1314
  };
1004
1315
  //#endregion
1005
- //#region node_modules/.pnpm/zod@4.4.3/node_modules/zod/v4/core/versions.js
1316
+ //#region node_modules/.pnpm/zod@4.5.4/node_modules/zod/v4/core/versions.js
1006
1317
  const version = {
1007
1318
  major: 4,
1008
- minor: 4,
1009
- patch: 3
1319
+ minor: 5,
1320
+ patch: 4
1010
1321
  };
1011
1322
  //#endregion
1012
- //#region node_modules/.pnpm/zod@4.4.3/node_modules/zod/v4/core/schemas.js
1323
+ //#region node_modules/.pnpm/zod@4.5.4/node_modules/zod/v4/core/schemas.js
1013
1324
  const $ZodType = /*@__PURE__*/ $constructor("$ZodType", (inst, def) => {
1014
1325
  var _a;
1015
1326
  inst ?? (inst = {});
1016
1327
  inst._zod.def = def;
1017
1328
  inst._zod.bag = inst._zod.bag || {};
1018
1329
  inst._zod.version = version;
1019
- const checks = [...inst._zod.def.checks ?? []];
1020
- if (inst._zod.traits.has("$ZodCheck")) checks.unshift(inst);
1330
+ const defChecks = inst._zod.def.checks;
1331
+ const checks = inst._zod.traits.has("$ZodCheck") ? [inst, ...defChecks ?? []] : defChecks?.length ? [...defChecks] : [];
1021
1332
  for (const ch of checks) for (const fn of ch._zod.onattach) fn(inst);
1022
1333
  if (checks.length === 0) {
1023
1334
  (_a = inst._zod).deferred ?? (_a.deferred = []);
@@ -1026,6 +1337,7 @@ const $ZodType = /*@__PURE__*/ $constructor("$ZodType", (inst, def) => {
1026
1337
  });
1027
1338
  } else {
1028
1339
  const runChecks = (payload, checks, ctx) => {
1340
+ if (payload.memo) return payload;
1029
1341
  let isAborted = aborted(payload);
1030
1342
  let asyncResult;
1031
1343
  for (const ch of checks) {
@@ -1039,10 +1351,12 @@ const $ZodType = /*@__PURE__*/ $constructor("$ZodType", (inst, def) => {
1039
1351
  if (asyncResult || _ instanceof Promise) asyncResult = (asyncResult ?? Promise.resolve()).then(async () => {
1040
1352
  await _;
1041
1353
  if (payload.issues.length === currLen) return;
1354
+ attachSchema(payload.issues, currLen, inst);
1042
1355
  if (!isAborted) isAborted = aborted(payload, currLen);
1043
1356
  });
1044
1357
  else {
1045
1358
  if (payload.issues.length === currLen) continue;
1359
+ attachSchema(payload.issues, currLen, inst);
1046
1360
  if (!isAborted) isAborted = aborted(payload, currLen);
1047
1361
  }
1048
1362
  }
@@ -1086,19 +1400,29 @@ const $ZodType = /*@__PURE__*/ $constructor("$ZodType", (inst, def) => {
1086
1400
  return runChecks(result, checks, ctx);
1087
1401
  };
1088
1402
  }
1089
- defineLazy(inst, "~standard", () => ({
1403
+ }, {
1404
+ get "~standard"() {
1405
+ return hide(this, "~standard", standardProps(this));
1406
+ },
1407
+ set "~standard"(value) {
1408
+ own(this, "~standard", value);
1409
+ }
1410
+ });
1411
+ /** The Standard Schema surface for `inst`. Shared so wrappers can extend it without forcing it. */
1412
+ const toStandardResult = (r) => r.success ? { value: r.data } : { issues: r.error?.issues };
1413
+ function standardProps(inst) {
1414
+ return {
1090
1415
  validate: (value) => {
1091
1416
  try {
1092
- const r = safeParse$1(inst, value);
1093
- return r.success ? { value: r.data } : { issues: r.error?.issues };
1417
+ return toStandardResult(safeParse$1(inst, value));
1094
1418
  } catch (_) {
1095
- return safeParseAsync$1(inst, value).then((r) => r.success ? { value: r.data } : { issues: r.error?.issues });
1419
+ return safeParseAsync$1(inst, value).then(toStandardResult);
1096
1420
  }
1097
1421
  },
1098
1422
  vendor: "zod",
1099
1423
  version: 1
1100
- }));
1101
- });
1424
+ };
1425
+ }
1102
1426
  const $ZodString = /*@__PURE__*/ $constructor("$ZodString", (inst, def) => {
1103
1427
  $ZodType.init(inst, def);
1104
1428
  inst._zod.pattern = [...inst?._zod.bag?.patterns ?? []].pop() ?? string$1(inst._zod.bag);
@@ -1145,51 +1469,74 @@ const $ZodEmail = /*@__PURE__*/ $constructor("$ZodEmail", (inst, def) => {
1145
1469
  def.pattern ?? (def.pattern = email);
1146
1470
  $ZodStringFormat.init(inst, def);
1147
1471
  });
1472
+ /** Parses a URL for `$ZodURL`, applying the one guard the URL constructor cannot express. Returns the parsed URL, or a code naming the stage that rejected it — the runtime needs that distinction to pick an issue note, and compiled code only needs to know it is not a URL. */
1473
+ function parseURLObject(trimmed, def) {
1474
+ if (!def.normalize && def.protocol?.source === httpProtocol.source && !/^https?:\/\//i.test(trimmed)) return 1;
1475
+ try {
1476
+ return new URL(trimmed);
1477
+ } catch {
1478
+ return 2;
1479
+ }
1480
+ }
1481
+ const asciiTabOrNewline = /[\t\n\r]/g;
1482
+ /** The URL parser deletes every ASCII tab, LF and CR from its input before it parses, so `new URL("https://exa\nmple.com")` reports on `example.com`. Applying the same deletion to the returned value closes the half of that divergence which can move the host; the parser's other rewrite, stripping C0 controls at the edges, cannot. */
1483
+ function stripTabAndNewline(value) {
1484
+ return value.replace(asciiTabOrNewline, "");
1485
+ }
1486
+ function urlHostnameOk(url, hostname) {
1487
+ hostname.lastIndex = 0;
1488
+ return hostname.test(url.hostname);
1489
+ }
1490
+ function urlProtocolOk(url, protocol) {
1491
+ protocol.lastIndex = 0;
1492
+ return protocol.test(url.protocol.endsWith(":") ? url.protocol.slice(0, -1) : url.protocol);
1493
+ }
1148
1494
  const $ZodURL = /*@__PURE__*/ $constructor("$ZodURL", (inst, def) => {
1149
1495
  $ZodStringFormat.init(inst, def);
1150
1496
  inst._zod.check = (payload) => {
1151
1497
  try {
1152
1498
  const trimmed = payload.value.trim();
1153
- if (!def.normalize && def.protocol?.source === httpProtocol.source) {
1154
- if (!/^https?:\/\//i.test(trimmed)) {
1155
- payload.issues.push({
1156
- code: "invalid_format",
1157
- format: "url",
1158
- note: "Invalid URL format",
1159
- input: payload.value,
1160
- inst,
1161
- continue: !def.abort
1162
- });
1163
- return;
1164
- }
1165
- }
1166
- const url = new URL(trimmed);
1167
- if (def.hostname) {
1168
- def.hostname.lastIndex = 0;
1169
- if (!def.hostname.test(url.hostname)) payload.issues.push({
1499
+ const url = parseURLObject(trimmed, def);
1500
+ if (url === 1) {
1501
+ payload.issues.push({
1170
1502
  code: "invalid_format",
1171
1503
  format: "url",
1172
- note: "Invalid hostname",
1173
- pattern: def.hostname.source,
1504
+ note: "Invalid URL format",
1174
1505
  input: payload.value,
1175
1506
  inst,
1176
1507
  continue: !def.abort
1177
1508
  });
1509
+ return;
1178
1510
  }
1179
- if (def.protocol) {
1180
- def.protocol.lastIndex = 0;
1181
- if (!def.protocol.test(url.protocol.endsWith(":") ? url.protocol.slice(0, -1) : url.protocol)) payload.issues.push({
1511
+ if (url === 2) {
1512
+ payload.issues.push({
1182
1513
  code: "invalid_format",
1183
1514
  format: "url",
1184
- note: "Invalid protocol",
1185
- pattern: def.protocol.source,
1186
1515
  input: payload.value,
1187
1516
  inst,
1188
1517
  continue: !def.abort
1189
1518
  });
1519
+ return;
1190
1520
  }
1191
- if (def.normalize) payload.value = url.href;
1192
- else payload.value = trimmed;
1521
+ if (def.hostname && !urlHostnameOk(url, def.hostname)) payload.issues.push({
1522
+ code: "invalid_format",
1523
+ format: "url",
1524
+ note: "Invalid hostname",
1525
+ pattern: def.hostname.source,
1526
+ input: payload.value,
1527
+ inst,
1528
+ continue: !def.abort
1529
+ });
1530
+ if (def.protocol && !urlProtocolOk(url, def.protocol)) payload.issues.push({
1531
+ code: "invalid_format",
1532
+ format: "url",
1533
+ note: "Invalid protocol",
1534
+ pattern: def.protocol.source,
1535
+ input: payload.value,
1536
+ inst,
1537
+ continue: !def.abort
1538
+ });
1539
+ payload.value = def.normalize ? url.href : stripTabAndNewline(trimmed);
1193
1540
  return;
1194
1541
  } catch (_) {
1195
1542
  payload.issues.push({
@@ -1207,7 +1554,8 @@ const $ZodEmoji = /*@__PURE__*/ $constructor("$ZodEmoji", (inst, def) => {
1207
1554
  $ZodStringFormat.init(inst, def);
1208
1555
  });
1209
1556
  const $ZodNanoID = /*@__PURE__*/ $constructor("$ZodNanoID", (inst, def) => {
1210
- def.pattern ?? (def.pattern = nanoid);
1557
+ if (def.length !== void 0 && (!Number.isInteger(def.length) || def.length < 1)) throw new Error(`Invalid nanoid length: ${def.length}`);
1558
+ def.pattern ?? (def.pattern = def.length === void 0 ? nanoid : nanoidOfLength(def.length));
1211
1559
  $ZodStringFormat.init(inst, def);
1212
1560
  });
1213
1561
  /**
@@ -1236,19 +1584,25 @@ const $ZodKSUID = /*@__PURE__*/ $constructor("$ZodKSUID", (inst, def) => {
1236
1584
  $ZodStringFormat.init(inst, def);
1237
1585
  });
1238
1586
  const $ZodISODateTime = /*@__PURE__*/ $constructor("$ZodISODateTime", (inst, def) => {
1239
- def.pattern ?? (def.pattern = datetime$1(def));
1587
+ def.pattern ?? (def.pattern = datetime(def));
1240
1588
  $ZodStringFormat.init(inst, def);
1589
+ if (def.local || def.precision === -1) {
1590
+ inst._zod.bag.laxFormat = true;
1591
+ inst._zod.onattach.push((s) => {
1592
+ s._zod.bag.laxFormat = true;
1593
+ });
1594
+ }
1241
1595
  });
1242
1596
  const $ZodISODate = /*@__PURE__*/ $constructor("$ZodISODate", (inst, def) => {
1243
- def.pattern ?? (def.pattern = date$1);
1597
+ def.pattern ?? (def.pattern = date);
1244
1598
  $ZodStringFormat.init(inst, def);
1245
1599
  });
1246
1600
  const $ZodISOTime = /*@__PURE__*/ $constructor("$ZodISOTime", (inst, def) => {
1247
- def.pattern ?? (def.pattern = time$1(def));
1601
+ def.pattern ?? (def.pattern = time(def));
1248
1602
  $ZodStringFormat.init(inst, def);
1249
1603
  });
1250
1604
  const $ZodISODuration = /*@__PURE__*/ $constructor("$ZodISODuration", (inst, def) => {
1251
- def.pattern ?? (def.pattern = duration$1);
1605
+ def.pattern ?? (def.pattern = duration);
1252
1606
  $ZodStringFormat.init(inst, def);
1253
1607
  });
1254
1608
  const $ZodIPv4 = /*@__PURE__*/ $constructor("$ZodIPv4", (inst, def) => {
@@ -1256,50 +1610,56 @@ const $ZodIPv4 = /*@__PURE__*/ $constructor("$ZodIPv4", (inst, def) => {
1256
1610
  $ZodStringFormat.init(inst, def);
1257
1611
  inst._zod.bag.format = `ipv4`;
1258
1612
  });
1613
+ /** An IPv6 address is written with hex digits, colons and dots, and nothing else. The guard is what makes the check below an IPv6 check: `new URL("http://[...]")` parses an authority, not an address, so `@` and `\` re-delimit it and `"::@1\\"` validates against the host `0.0.0.1`. The URL parser also deletes ASCII tab, LF and CR rather than failing, which is how `"::1\n"` validated as `::1`. */
1614
+ const ipv6Alphabet = /^[0-9a-fA-F:.]+$/;
1615
+ function isValidIPv6(value) {
1616
+ if (!ipv6Alphabet.test(value)) return false;
1617
+ try {
1618
+ new URL(`http://[${value}]`);
1619
+ return true;
1620
+ } catch {
1621
+ return false;
1622
+ }
1623
+ }
1259
1624
  const $ZodIPv6 = /*@__PURE__*/ $constructor("$ZodIPv6", (inst, def) => {
1260
1625
  def.pattern ?? (def.pattern = ipv6);
1261
1626
  $ZodStringFormat.init(inst, def);
1262
1627
  inst._zod.bag.format = `ipv6`;
1263
1628
  inst._zod.check = (payload) => {
1264
- try {
1265
- new URL(`http://[${payload.value}]`);
1266
- } catch {
1267
- payload.issues.push({
1268
- code: "invalid_format",
1269
- format: "ipv6",
1270
- input: payload.value,
1271
- inst,
1272
- continue: !def.abort
1273
- });
1274
- }
1629
+ if (!isValidIPv6(payload.value)) payload.issues.push({
1630
+ code: "invalid_format",
1631
+ format: "ipv6",
1632
+ input: payload.value,
1633
+ inst,
1634
+ continue: !def.abort
1635
+ });
1275
1636
  };
1276
1637
  });
1277
1638
  const $ZodCIDRv4 = /*@__PURE__*/ $constructor("$ZodCIDRv4", (inst, def) => {
1278
1639
  def.pattern ?? (def.pattern = cidrv4);
1279
1640
  $ZodStringFormat.init(inst, def);
1280
1641
  });
1642
+ function isValidCIDRv6(value) {
1643
+ const parts = value.split("/");
1644
+ if (parts.length !== 2) return false;
1645
+ const [address, prefix] = parts;
1646
+ if (!prefix) return false;
1647
+ const prefixNum = Number(prefix);
1648
+ if (`${prefixNum}` !== prefix) return false;
1649
+ if (prefixNum < 0 || prefixNum > 128) return false;
1650
+ return isValidIPv6(address);
1651
+ }
1281
1652
  const $ZodCIDRv6 = /*@__PURE__*/ $constructor("$ZodCIDRv6", (inst, def) => {
1282
1653
  def.pattern ?? (def.pattern = cidrv6);
1283
1654
  $ZodStringFormat.init(inst, def);
1284
1655
  inst._zod.check = (payload) => {
1285
- const parts = payload.value.split("/");
1286
- try {
1287
- if (parts.length !== 2) throw new Error();
1288
- const [address, prefix] = parts;
1289
- if (!prefix) throw new Error();
1290
- const prefixNum = Number(prefix);
1291
- if (`${prefixNum}` !== prefix) throw new Error();
1292
- if (prefixNum < 0 || prefixNum > 128) throw new Error();
1293
- new URL(`http://[${address}]`);
1294
- } catch {
1295
- payload.issues.push({
1296
- code: "invalid_format",
1297
- format: "cidrv6",
1298
- input: payload.value,
1299
- inst,
1300
- continue: !def.abort
1301
- });
1302
- }
1656
+ if (!isValidCIDRv6(payload.value)) payload.issues.push({
1657
+ code: "invalid_format",
1658
+ format: "cidrv6",
1659
+ input: payload.value,
1660
+ inst,
1661
+ continue: !def.abort
1662
+ });
1303
1663
  };
1304
1664
  });
1305
1665
  function isValidBase64(data) {
@@ -1389,7 +1749,7 @@ const $ZodNumber = /*@__PURE__*/ $constructor("$ZodNumber", (inst, def) => {
1389
1749
  } catch (_) {}
1390
1750
  const input = payload.value;
1391
1751
  if (typeof input === "number" && !Number.isNaN(input) && Number.isFinite(input)) return payload;
1392
- const received = typeof input === "number" ? Number.isNaN(input) ? "NaN" : !Number.isFinite(input) ? "Infinity" : void 0 : void 0;
1752
+ const received = typeof input === "number" ? Number.isNaN(input) ? "NaN" : !Number.isFinite(input) ? String(input) : void 0 : void 0;
1393
1753
  payload.issues.push({
1394
1754
  expected: "number",
1395
1755
  code: "invalid_type",
@@ -1444,6 +1804,8 @@ function handleArrayResult(result, final, index) {
1444
1804
  }
1445
1805
  const $ZodArray = /*@__PURE__*/ $constructor("$ZodArray", (inst, def) => {
1446
1806
  $ZodType.init(inst, def);
1807
+ const memo = globalConfig.memoizer;
1808
+ memo?.attach(inst);
1447
1809
  inst._zod.parse = (payload, ctx) => {
1448
1810
  const input = payload.value;
1449
1811
  if (!Array.isArray(input)) {
@@ -1455,7 +1817,7 @@ const $ZodArray = /*@__PURE__*/ $constructor("$ZodArray", (inst, def) => {
1455
1817
  });
1456
1818
  return payload;
1457
1819
  }
1458
- payload.value = Array(input.length);
1820
+ payload.value = memo ? memo.alloc(inst, payload, Array(input.length), ctx) : Array(input.length);
1459
1821
  const proms = [];
1460
1822
  for (let i = 0; i < input.length; i++) {
1461
1823
  const item = input[i];
@@ -1470,13 +1832,15 @@ const $ZodArray = /*@__PURE__*/ $constructor("$ZodArray", (inst, def) => {
1470
1832
  return payload;
1471
1833
  };
1472
1834
  });
1473
- function handlePropertyResult(result, final, key, input, isOptionalIn, isOptionalOut) {
1835
+ function handlePropertyResult(result, final, key, input, optin, optout) {
1474
1836
  const isPresent = key in input;
1837
+ const isOptionalOut = optout === "optional";
1838
+ if (!isPresent && isOptionalOut && optin === "optional") return;
1475
1839
  if (result.issues.length) {
1476
- if (isOptionalIn && isOptionalOut && !isPresent) return;
1840
+ if (optin !== void 0 && isOptionalOut && !isPresent) return;
1477
1841
  final.issues.push(...prefixIssues(key, result.issues));
1478
1842
  }
1479
- if (!isPresent && !isOptionalIn) {
1843
+ if (!isPresent && optin === void 0) {
1480
1844
  if (!result.issues.length) final.issues.push({
1481
1845
  code: "invalid_type",
1482
1846
  expected: "nonoptional",
@@ -1489,13 +1853,18 @@ function handlePropertyResult(result, final, key, input, isOptionalIn, isOptiona
1489
1853
  if (isPresent) final.value[key] = void 0;
1490
1854
  } else final.value[key] = result.value;
1491
1855
  }
1856
+ const NO_SYMBOL_KEYS = [];
1492
1857
  function normalizeDef(def) {
1493
1858
  const keys = Object.keys(def.shape);
1494
- for (const k of keys) if (!def.shape?.[k]?._zod?.traits?.has("$ZodType")) throw new Error(`Invalid element at key "${k}": expected a Zod schema`);
1859
+ const ownSymbols = Object.getOwnPropertySymbols(def.shape);
1860
+ const symbolKeys = ownSymbols.length ? ownSymbols : NO_SYMBOL_KEYS;
1861
+ const allKeys = symbolKeys.length ? [...keys, ...symbolKeys] : keys;
1862
+ for (const k of allKeys) if (!def.shape?.[k]?._zod?.traits?.has("$ZodType")) throw new Error(`Invalid element at key "${String(k)}": expected a Zod schema`);
1495
1863
  const okeys = optionalKeys(def.shape);
1496
1864
  return {
1497
1865
  ...def,
1498
- keys,
1866
+ allKeys,
1867
+ symbolKeys,
1499
1868
  keySet: new Set(keys),
1500
1869
  numKeys: keys.length,
1501
1870
  optionalKeys: new Set(okeys)
@@ -1506,11 +1875,14 @@ function handleCatchall(proms, input, payload, ctx, def, inst) {
1506
1875
  const keySet = def.keySet;
1507
1876
  const _catchall = def.catchall._zod;
1508
1877
  const t = _catchall.def.type;
1509
- const isOptionalIn = _catchall.optin === "optional";
1510
- const isOptionalOut = _catchall.optout === "optional";
1878
+ const optin = _catchall.optin;
1879
+ const optout = _catchall.optout;
1511
1880
  for (const key in input) {
1512
- if (key === "__proto__") continue;
1513
1881
  if (keySet.has(key)) continue;
1882
+ if (key === "__proto__") {
1883
+ if (t === "never") unrecognized.push(key);
1884
+ continue;
1885
+ }
1514
1886
  if (t === "never") {
1515
1887
  unrecognized.push(key);
1516
1888
  continue;
@@ -1519,39 +1891,44 @@ function handleCatchall(proms, input, payload, ctx, def, inst) {
1519
1891
  value: input[key],
1520
1892
  issues: []
1521
1893
  }, ctx);
1522
- if (r instanceof Promise) proms.push(r.then((r) => handlePropertyResult(r, payload, key, input, isOptionalIn, isOptionalOut)));
1523
- else handlePropertyResult(r, payload, key, input, isOptionalIn, isOptionalOut);
1894
+ if (r instanceof Promise) proms.push(r.then((r) => handlePropertyResult(r, payload, key, input, optin, optout)));
1895
+ else handlePropertyResult(r, payload, key, input, optin, optout);
1524
1896
  }
1525
1897
  if (unrecognized.length) payload.issues.push({
1526
1898
  code: "unrecognized_keys",
1527
1899
  keys: unrecognized,
1528
1900
  input,
1529
- inst
1901
+ inst,
1902
+ continue: true
1530
1903
  });
1531
1904
  if (!proms.length) return payload;
1532
1905
  return Promise.all(proms).then(() => {
1533
1906
  return payload;
1534
1907
  });
1535
1908
  }
1909
+ const propShapes = /* @__PURE__ */ new WeakMap();
1536
1910
  const $ZodObject = /*@__PURE__*/ $constructor("$ZodObject", (inst, def) => {
1537
1911
  $ZodType.init(inst, def);
1538
1912
  if (!Object.getOwnPropertyDescriptor(def, "shape")?.get) {
1539
1913
  const sh = def.shape;
1914
+ propShapes.set(def, sh);
1540
1915
  Object.defineProperty(def, "shape", { get: () => {
1541
1916
  const newSh = { ...sh };
1542
1917
  Object.defineProperty(def, "shape", { value: newSh });
1918
+ propShapes.set(def, newSh);
1543
1919
  return newSh;
1544
1920
  } });
1545
1921
  }
1546
1922
  const _normalized = cached(() => normalizeDef(def));
1547
- defineLazy(inst._zod, "propValues", () => {
1548
- const shape = def.shape;
1923
+ defineLazyInternal(inst, "propValues", (zod) => {
1924
+ const shape = zod.def.shape;
1549
1925
  const propValues = {};
1550
1926
  for (const key in shape) {
1551
1927
  const field = shape[key]._zod;
1552
1928
  if (field.values) {
1553
- propValues[key] ?? (propValues[key] = /* @__PURE__ */ new Set());
1929
+ if (!Object.prototype.hasOwnProperty.call(propValues, key)) assignProp(propValues, key, /* @__PURE__ */ new Set());
1554
1930
  for (const v of field.values) propValues[key].add(v);
1931
+ if (field.optin !== void 0) propValues[key].add(void 0);
1555
1932
  }
1556
1933
  }
1557
1934
  return propValues;
@@ -1559,6 +1936,8 @@ const $ZodObject = /*@__PURE__*/ $constructor("$ZodObject", (inst, def) => {
1559
1936
  const isObject$1 = isObject;
1560
1937
  const catchall = def.catchall;
1561
1938
  let value;
1939
+ const memo = globalConfig.memoizer;
1940
+ memo?.attach(inst);
1562
1941
  inst._zod.parse = (payload, ctx) => {
1563
1942
  value ?? (value = _normalized.value);
1564
1943
  const input = payload.value;
@@ -1571,19 +1950,20 @@ const $ZodObject = /*@__PURE__*/ $constructor("$ZodObject", (inst, def) => {
1571
1950
  });
1572
1951
  return payload;
1573
1952
  }
1574
- payload.value = {};
1953
+ payload.value = memo ? memo.alloc(inst, payload, {}, ctx) : {};
1575
1954
  const proms = [];
1576
1955
  const shape = value.shape;
1577
- for (const key of value.keys) {
1956
+ for (const key of value.allKeys) {
1957
+ if (key === "__proto__") continue;
1578
1958
  const el = shape[key];
1579
- const isOptionalIn = el._zod.optin === "optional";
1580
- const isOptionalOut = el._zod.optout === "optional";
1959
+ const optin = el._zod.optin;
1960
+ const optout = el._zod.optout;
1581
1961
  const r = el._zod.run({
1582
1962
  value: input[key],
1583
1963
  issues: []
1584
1964
  }, ctx);
1585
- if (r instanceof Promise) proms.push(r.then((r) => handlePropertyResult(r, payload, key, input, isOptionalIn, isOptionalOut)));
1586
- else handlePropertyResult(r, payload, key, input, isOptionalIn, isOptionalOut);
1965
+ if (r instanceof Promise) proms.push(r.then((r) => handlePropertyResult(r, payload, key, input, optin, optout)));
1966
+ else handlePropertyResult(r, payload, key, input, optin, optout);
1587
1967
  }
1588
1968
  if (!catchall) return proms.length ? Promise.all(proms).then(() => payload) : payload;
1589
1969
  return handleCatchall(proms, input, payload, ctx, _normalized.value, inst);
@@ -1593,55 +1973,55 @@ const $ZodObjectJIT = /*@__PURE__*/ $constructor("$ZodObjectJIT", (inst, def) =>
1593
1973
  $ZodObject.init(inst, def);
1594
1974
  const superParse = inst._zod.parse;
1595
1975
  const _normalized = cached(() => normalizeDef(def));
1976
+ const memo = globalConfig.memoizer;
1596
1977
  const generateFastpass = (shape) => {
1597
- const doc = new Doc([
1598
- "shape",
1599
- "payload",
1600
- "ctx"
1601
- ]);
1602
1978
  const normalized = _normalized.value;
1603
- const parseStr = (key) => {
1604
- const k = esc(key);
1605
- return `shape[${k}]._zod.run({ value: input[${k}], issues: [] }, ctx)`;
1606
- };
1979
+ const syms = normalized.symbolKeys;
1980
+ const doc = new Doc(["payload", "ctx"], {
1981
+ shape,
1982
+ inst,
1983
+ memo,
1984
+ syms
1985
+ });
1986
+ const parseStr = (k) => `shape[${k}]._zod.run({ value: input[${k}], issues: [] }, ctx)`;
1987
+ const prefixStr = (id, k) => `
1988
+ for (let i = 0; i < ${id}.issues.length; i++) {
1989
+ const iss = ${id}.issues[i];
1990
+ iss.path = iss.path ? [${k}, ...iss.path] : [${k}];
1991
+ payload.issues.push(iss);
1992
+ }`;
1607
1993
  doc.write(`const input = payload.value;`);
1608
1994
  const ids = Object.create(null);
1609
1995
  let counter = 0;
1610
- for (const key of normalized.keys) ids[key] = `key_${counter++}`;
1611
- doc.write(`const newResult = {};`);
1612
- for (const key of normalized.keys) {
1996
+ for (const key of normalized.allKeys) ids[key] = `key_${counter++}`;
1997
+ doc.write(memo ? `const newResult = memo.alloc(inst, payload, {}, ctx);` : `const newResult = {};`);
1998
+ for (const key of normalized.allKeys) {
1999
+ if (key === "__proto__") continue;
1613
2000
  const id = ids[key];
1614
- const k = esc(key);
2001
+ const k = typeof key === "symbol" ? `syms[${syms.indexOf(key)}]` : esc(key);
2002
+ const isPresent = `${k} in input`;
1615
2003
  const schema = shape[key];
1616
- const isOptionalIn = schema?._zod?.optin === "optional";
2004
+ const optin = schema?._zod?.optin;
2005
+ const isOptionalIn = optin !== void 0;
1617
2006
  const isOptionalOut = schema?._zod?.optout === "optional";
1618
- doc.write(`const ${id} = ${parseStr(key)};`);
1619
- if (isOptionalIn && isOptionalOut) doc.write(`
1620
- if (${id}.issues.length) {
1621
- if (${k} in input) {
1622
- payload.issues = payload.issues.concat(${id}.issues.map(iss => ({
1623
- ...iss,
1624
- path: iss.path ? [${k}, ...iss.path] : [${k}]
1625
- })));
2007
+ doc.write(`const ${id} = ${parseStr(k)};`);
2008
+ if (isOptionalIn && isOptionalOut) {
2009
+ const assign = optin === "optional" ? `${id}_present` : `${id}.value !== undefined || ${id}_present`;
2010
+ doc.write(`
2011
+ const ${id}_present = ${isPresent};
2012
+ if (!${id}.issues.length || ${id}_present) {
2013
+ if (${id}.issues.length) {${prefixStr(id, k)}
1626
2014
  }
1627
- }
1628
-
1629
- if (${id}.value === undefined) {
1630
- if (${k} in input) {
1631
- newResult[${k}] = undefined;
2015
+
2016
+ if (${assign}) {
2017
+ newResult[${k}] = ${id}.value;
1632
2018
  }
1633
- } else {
1634
- newResult[${k}] = ${id}.value;
1635
2019
  }
1636
-
2020
+
1637
2021
  `);
1638
- else if (!isOptionalIn) doc.write(`
1639
- const ${id}_present = ${k} in input;
1640
- if (${id}.issues.length) {
1641
- payload.issues = payload.issues.concat(${id}.issues.map(iss => ({
1642
- ...iss,
1643
- path: iss.path ? [${k}, ...iss.path] : [${k}]
1644
- })));
2022
+ } else if (!isOptionalIn) doc.write(`
2023
+ const ${id}_present = ${isPresent};
2024
+ if (${id}.issues.length) {${prefixStr(id, k)}
1645
2025
  }
1646
2026
  if (!${id}_present && !${id}.issues.length) {
1647
2027
  payload.issues.push({
@@ -1653,36 +2033,27 @@ const $ZodObjectJIT = /*@__PURE__*/ $constructor("$ZodObjectJIT", (inst, def) =>
1653
2033
  }
1654
2034
 
1655
2035
  if (${id}_present) {
1656
- if (${id}.value === undefined) {
1657
- newResult[${k}] = undefined;
1658
- } else {
1659
- newResult[${k}] = ${id}.value;
1660
- }
2036
+ newResult[${k}] = ${id}.value;
1661
2037
  }
1662
2038
 
1663
2039
  `);
1664
2040
  else doc.write(`
1665
- if (${id}.issues.length) {
1666
- payload.issues = payload.issues.concat(${id}.issues.map(iss => ({
1667
- ...iss,
1668
- path: iss.path ? [${k}, ...iss.path] : [${k}]
1669
- })));
2041
+ if (${id}.issues.length) {${prefixStr(id, k)}
1670
2042
  }
1671
2043
 
1672
2044
  if (${id}.value === undefined) {
1673
- if (${k} in input) {
2045
+ if (${isPresent}) {
1674
2046
  newResult[${k}] = undefined;
1675
2047
  }
1676
2048
  } else {
1677
2049
  newResult[${k}] = ${id}.value;
1678
2050
  }
1679
-
2051
+
1680
2052
  `);
1681
2053
  }
1682
2054
  doc.write(`payload.value = newResult;`);
1683
2055
  doc.write(`return payload;`);
1684
- const fn = doc.compile();
1685
- return (payload, ctx) => fn(shape, payload, ctx);
2056
+ return doc.compile();
1686
2057
  };
1687
2058
  let fastpass;
1688
2059
  const isObject$2 = isObject;
@@ -1731,14 +2102,14 @@ function handleUnionResults(results, final, inst, ctx) {
1731
2102
  }
1732
2103
  const $ZodUnion = /*@__PURE__*/ $constructor("$ZodUnion", (inst, def) => {
1733
2104
  $ZodType.init(inst, def);
1734
- defineLazy(inst._zod, "optin", () => def.options.some((o) => o._zod.optin === "optional") ? "optional" : void 0);
1735
- defineLazy(inst._zod, "optout", () => def.options.some((o) => o._zod.optout === "optional") ? "optional" : void 0);
1736
- defineLazy(inst._zod, "values", () => {
1737
- if (def.options.every((o) => o._zod.values)) return new Set(def.options.flatMap((option) => Array.from(option._zod.values)));
2105
+ defineLazyInternal(inst, "optin", (zod) => zod.def.options.some((o) => o._zod.optin === "defaulted") ? "defaulted" : zod.def.options.some((o) => o._zod.optin !== void 0) ? "optional" : void 0);
2106
+ defineLazyInternal(inst, "optout", (zod) => zod.def.options.some((o) => o._zod.optout === "optional") ? "optional" : void 0);
2107
+ defineLazyInternal(inst, "values", (zod) => {
2108
+ if (zod.def.options.every((o) => o._zod.values)) return new Set(zod.def.options.flatMap((option) => Array.from(option._zod.values)));
1738
2109
  });
1739
- defineLazy(inst._zod, "pattern", () => {
1740
- if (def.options.every((o) => o._zod.pattern)) {
1741
- const patterns = def.options.map((o) => o._zod.pattern);
2110
+ defineLazyInternal(inst, "pattern", (zod) => {
2111
+ if (zod.def.options.every((o) => o._zod.pattern)) {
2112
+ const patterns = zod.def.options.map((o) => o._zod.pattern);
1742
2113
  return new RegExp(`^(${patterns.map((p) => cleanRegex(p.source)).join("|")})$`);
1743
2114
  }
1744
2115
  });
@@ -1800,7 +2171,9 @@ function mergeValues(a, b) {
1800
2171
  ...a,
1801
2172
  ...b
1802
2173
  };
2174
+ if (Object.prototype.hasOwnProperty.call(newObj, "__proto__")) delete newObj.__proto__;
1803
2175
  for (const key of sharedKeys) {
2176
+ if (key === "__proto__") continue;
1804
2177
  const sharedValue = mergeValues(a[key], b[key]);
1805
2178
  if (!sharedValue.valid) return {
1806
2179
  valid: false,
@@ -1842,26 +2215,39 @@ function mergeValues(a, b) {
1842
2215
  function handleIntersectionResults(result, left, right) {
1843
2216
  const unrecKeys = /* @__PURE__ */ new Map();
1844
2217
  let unrecIssue;
1845
- for (const iss of left.issues) if (iss.code === "unrecognized_keys") {
1846
- unrecIssue ?? (unrecIssue = iss);
1847
- for (const k of iss.keys) {
2218
+ const keyIssues = /* @__PURE__ */ new Map();
2219
+ const collect = (iss, side) => {
2220
+ let keys;
2221
+ if (iss.code === "unrecognized_keys" && !iss.path?.length) {
2222
+ unrecIssue ?? (unrecIssue = iss);
2223
+ keys = iss.keys;
2224
+ } else if (iss.code === "invalid_key" && iss.origin === "record" && iss.path?.length === 1) {
2225
+ const k = String(iss.path[0]);
2226
+ if (!keyIssues.has(k)) keyIssues.set(k, iss);
2227
+ keys = [k];
2228
+ } else return false;
2229
+ for (const k of keys) {
1848
2230
  if (!unrecKeys.has(k)) unrecKeys.set(k, {});
1849
- unrecKeys.get(k).l = true;
2231
+ unrecKeys.get(k)[side] = true;
1850
2232
  }
1851
- } else result.issues.push(iss);
1852
- for (const iss of right.issues) if (iss.code === "unrecognized_keys") for (const k of iss.keys) {
1853
- if (!unrecKeys.has(k)) unrecKeys.set(k, {});
1854
- unrecKeys.get(k).r = true;
1855
- }
1856
- else result.issues.push(iss);
2233
+ return true;
2234
+ };
2235
+ for (const iss of left.issues) if (!collect(iss, "l")) result.issues.push(iss);
2236
+ for (const iss of right.issues) if (!collect(iss, "r")) result.issues.push(iss);
1857
2237
  const bothKeys = [...unrecKeys].filter(([, f]) => f.l && f.r).map(([k]) => k);
1858
- if (bothKeys.length && unrecIssue) result.issues.push({
1859
- ...unrecIssue,
1860
- keys: bothKeys
1861
- });
1862
- if (aborted(result)) return result;
2238
+ if (bothKeys.length) {
2239
+ const aggregated = unrecIssue ? bothKeys.filter((k) => unrecIssue.keys.includes(k)) : [];
2240
+ if (aggregated.length) result.issues.push({
2241
+ ...unrecIssue,
2242
+ keys: aggregated
2243
+ });
2244
+ for (const k of bothKeys) if (!aggregated.includes(k) && keyIssues.has(k)) result.issues.push(keyIssues.get(k));
2245
+ }
1863
2246
  const merged = mergeValues(left.value, right.value);
1864
- if (!merged.valid) throw new Error(`Unmergable intersection. Error path: ${JSON.stringify(merged.mergeErrorPath)}`);
2247
+ if (!merged.valid) {
2248
+ if (aborted(result)) return result;
2249
+ throw new Error(`Unmergable intersection. Error path: ${JSON.stringify(merged.mergeErrorPath)}`);
2250
+ }
1865
2251
  result.value = merged.data;
1866
2252
  return result;
1867
2253
  }
@@ -1870,7 +2256,8 @@ const $ZodEnum = /*@__PURE__*/ $constructor("$ZodEnum", (inst, def) => {
1870
2256
  const values = getEnumValues(def.entries);
1871
2257
  const valuesSet = new Set(values);
1872
2258
  inst._zod.values = valuesSet;
1873
- inst._zod.pattern = new RegExp(`^(${values.filter((k) => propertyKeyTypes.has(typeof k)).map((o) => typeof o === "string" ? escapeRegex(o) : o.toString()).join("|")})$`);
2259
+ const patternValues = values.filter((k) => propertyKeyTypes.has(typeof k));
2260
+ inst._zod.pattern = new RegExp(patternValues.length ? `^(${patternValues.map((o) => escapeRegex(o.toString())).join("|")})$` : "^[^\\s\\S]$");
1874
2261
  inst._zod.parse = (payload, _ctx) => {
1875
2262
  const input = payload.value;
1876
2263
  if (valuesSet.has(input)) return payload;
@@ -1885,10 +2272,9 @@ const $ZodEnum = /*@__PURE__*/ $constructor("$ZodEnum", (inst, def) => {
1885
2272
  });
1886
2273
  const $ZodLiteral = /*@__PURE__*/ $constructor("$ZodLiteral", (inst, def) => {
1887
2274
  $ZodType.init(inst, def);
1888
- if (def.values.length === 0) throw new Error("Cannot create literal schema with no valid values");
1889
2275
  const values = new Set(def.values);
1890
2276
  inst._zod.values = values;
1891
- inst._zod.pattern = new RegExp(`^(${def.values.map((o) => typeof o === "string" ? escapeRegex(o) : o ? escapeRegex(o.toString()) : String(o)).join("|")})$`);
2277
+ 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]$");
1892
2278
  inst._zod.parse = (payload, _ctx) => {
1893
2279
  const input = payload.value;
1894
2280
  if (values.has(input)) return payload;
@@ -1904,67 +2290,66 @@ const $ZodLiteral = /*@__PURE__*/ $constructor("$ZodLiteral", (inst, def) => {
1904
2290
  const $ZodTransform = /*@__PURE__*/ $constructor("$ZodTransform", (inst, def) => {
1905
2291
  $ZodType.init(inst, def);
1906
2292
  inst._zod.optin = "optional";
2293
+ globalConfig.memoizer?.guard(inst);
1907
2294
  inst._zod.parse = (payload, ctx) => {
1908
2295
  if (ctx.direction === "backward") throw new $ZodEncodeError(inst.constructor.name);
1909
2296
  const _out = def.transform(payload.value, payload);
1910
2297
  if (ctx.async) return (_out instanceof Promise ? _out : Promise.resolve(_out)).then((output) => {
1911
2298
  payload.value = output;
1912
- payload.fallback = true;
1913
2299
  return payload;
1914
2300
  });
1915
2301
  if (_out instanceof Promise) throw new $ZodAsyncError();
1916
2302
  payload.value = _out;
1917
- payload.fallback = true;
1918
2303
  return payload;
1919
2304
  };
1920
2305
  });
1921
- function handleOptionalResult(result, input) {
1922
- if (input === void 0 && (result.issues.length || result.fallback)) return {
1923
- issues: [],
1924
- value: void 0
1925
- };
1926
- return result;
2306
+ function handleOptionalResult(payload, result) {
2307
+ payload.value = result.issues.length ? void 0 : result.value;
2308
+ return payload;
1927
2309
  }
1928
2310
  const $ZodOptional = /*@__PURE__*/ $constructor("$ZodOptional", (inst, def) => {
1929
2311
  $ZodType.init(inst, def);
1930
- inst._zod.optin = "optional";
2312
+ defineLazyInternal(inst, "optin", (zod) => zod.def.innerType._zod.optin === "defaulted" ? "defaulted" : "optional");
1931
2313
  inst._zod.optout = "optional";
1932
- defineLazy(inst._zod, "values", () => {
1933
- return def.innerType._zod.values ? /* @__PURE__ */ new Set([...def.innerType._zod.values, void 0]) : void 0;
2314
+ defineLazyInternal(inst, "values", (zod) => {
2315
+ const values = zod.def.innerType._zod.values;
2316
+ return values ? /* @__PURE__ */ new Set([...values, void 0]) : void 0;
1934
2317
  });
1935
- defineLazy(inst._zod, "pattern", () => {
1936
- const pattern = def.innerType._zod.pattern;
2318
+ defineLazyInternal(inst, "pattern", (zod) => {
2319
+ const pattern = zod.def.innerType._zod.pattern;
1937
2320
  return pattern ? new RegExp(`^(${cleanRegex(pattern.source)})?$`) : void 0;
1938
2321
  });
1939
2322
  inst._zod.parse = (payload, ctx) => {
1940
- if (def.innerType._zod.optin === "optional") {
1941
- const input = payload.value;
1942
- const result = def.innerType._zod.run(payload, ctx);
1943
- if (result instanceof Promise) return result.then((r) => handleOptionalResult(r, input));
1944
- return handleOptionalResult(result, input);
2323
+ if (payload.value === void 0) {
2324
+ if (def.innerType._zod.optin !== "defaulted") return payload;
2325
+ const result = def.innerType._zod.run({
2326
+ value: payload.value,
2327
+ issues: []
2328
+ }, ctx);
2329
+ if (result instanceof Promise) return result.then((result) => handleOptionalResult(payload, result));
2330
+ return handleOptionalResult(payload, result);
1945
2331
  }
1946
- if (payload.value === void 0) return payload;
1947
2332
  return def.innerType._zod.run(payload, ctx);
1948
2333
  };
1949
2334
  });
1950
2335
  const $ZodExactOptional = /*@__PURE__*/ $constructor("$ZodExactOptional", (inst, def) => {
1951
2336
  $ZodOptional.init(inst, def);
1952
- defineLazy(inst._zod, "values", () => def.innerType._zod.values);
1953
- defineLazy(inst._zod, "pattern", () => def.innerType._zod.pattern);
2337
+ defineLazyInternal(inst, "values", (zod) => zod.def.innerType._zod.values);
2338
+ defineLazyInternal(inst, "pattern", (zod) => zod.def.innerType._zod.pattern);
1954
2339
  inst._zod.parse = (payload, ctx) => {
1955
2340
  return def.innerType._zod.run(payload, ctx);
1956
2341
  };
1957
2342
  });
1958
2343
  const $ZodNullable = /*@__PURE__*/ $constructor("$ZodNullable", (inst, def) => {
1959
2344
  $ZodType.init(inst, def);
1960
- defineLazy(inst._zod, "optin", () => def.innerType._zod.optin);
1961
- defineLazy(inst._zod, "optout", () => def.innerType._zod.optout);
1962
- defineLazy(inst._zod, "pattern", () => {
1963
- const pattern = def.innerType._zod.pattern;
2345
+ defineLazyInternal(inst, "optin", (zod) => zod.def.innerType._zod.optin);
2346
+ defineLazyInternal(inst, "optout", (zod) => zod.def.innerType._zod.optout);
2347
+ defineLazyInternal(inst, "pattern", (zod) => {
2348
+ const pattern = zod.def.innerType._zod.pattern;
1964
2349
  return pattern ? new RegExp(`^(${cleanRegex(pattern.source)}|null)$`) : void 0;
1965
2350
  });
1966
- defineLazy(inst._zod, "values", () => {
1967
- return def.innerType._zod.values ? /* @__PURE__ */ new Set([...def.innerType._zod.values, null]) : void 0;
2351
+ defineLazyInternal(inst, "values", (zod) => {
2352
+ return zod.def.innerType._zod.values ? /* @__PURE__ */ new Set([...zod.def.innerType._zod.values, null]) : void 0;
1968
2353
  });
1969
2354
  inst._zod.parse = (payload, ctx) => {
1970
2355
  if (payload.value === null) return payload;
@@ -1973,8 +2358,8 @@ const $ZodNullable = /*@__PURE__*/ $constructor("$ZodNullable", (inst, def) => {
1973
2358
  });
1974
2359
  const $ZodDefault = /*@__PURE__*/ $constructor("$ZodDefault", (inst, def) => {
1975
2360
  $ZodType.init(inst, def);
1976
- inst._zod.optin = "optional";
1977
- defineLazy(inst._zod, "values", () => def.innerType._zod.values);
2361
+ inst._zod.optin = "defaulted";
2362
+ defineLazyInternal(inst, "values", (zod) => zod.def.innerType._zod.values);
1978
2363
  inst._zod.parse = (payload, ctx) => {
1979
2364
  if (ctx.direction === "backward") return def.innerType._zod.run(payload, ctx);
1980
2365
  if (payload.value === void 0) {
@@ -1995,8 +2380,8 @@ function handleDefaultResult(payload, def) {
1995
2380
  }
1996
2381
  const $ZodPrefault = /*@__PURE__*/ $constructor("$ZodPrefault", (inst, def) => {
1997
2382
  $ZodType.init(inst, def);
1998
- inst._zod.optin = "optional";
1999
- defineLazy(inst._zod, "values", () => def.innerType._zod.values);
2383
+ inst._zod.optin = "defaulted";
2384
+ defineLazyInternal(inst, "values", (zod) => zod.def.innerType._zod.values);
2000
2385
  inst._zod.parse = (payload, ctx) => {
2001
2386
  if (ctx.direction === "backward") return def.innerType._zod.run(payload, ctx);
2002
2387
  if (payload.value === void 0) payload.value = def.defaultValue;
@@ -2005,8 +2390,8 @@ const $ZodPrefault = /*@__PURE__*/ $constructor("$ZodPrefault", (inst, def) => {
2005
2390
  });
2006
2391
  const $ZodNonOptional = /*@__PURE__*/ $constructor("$ZodNonOptional", (inst, def) => {
2007
2392
  $ZodType.init(inst, def);
2008
- defineLazy(inst._zod, "values", () => {
2009
- const v = def.innerType._zod.values;
2393
+ defineLazyInternal(inst, "values", (zod) => {
2394
+ const v = zod.def.innerType._zod.values;
2010
2395
  return v ? new Set([...v].filter((x) => x !== void 0)) : void 0;
2011
2396
  });
2012
2397
  inst._zod.parse = (payload, ctx) => {
@@ -2024,46 +2409,41 @@ function handleNonOptionalResult(payload, inst) {
2024
2409
  });
2025
2410
  return payload;
2026
2411
  }
2412
+ function handleCatchResult(payload, result, def, ctx) {
2413
+ if (!result.issues.length) {
2414
+ payload.value = result.value;
2415
+ if (result.memo) payload.memo = true;
2416
+ return payload;
2417
+ }
2418
+ payload.value = def.catchValue({
2419
+ ...result,
2420
+ value: payload.value,
2421
+ error: { issues: result.issues.map((iss) => finalizeIssue(iss, ctx, config())) },
2422
+ input: payload.value
2423
+ });
2424
+ return payload;
2425
+ }
2027
2426
  const $ZodCatch = /*@__PURE__*/ $constructor("$ZodCatch", (inst, def) => {
2028
2427
  $ZodType.init(inst, def);
2029
- inst._zod.optin = "optional";
2030
- defineLazy(inst._zod, "optout", () => def.innerType._zod.optout);
2031
- defineLazy(inst._zod, "values", () => def.innerType._zod.values);
2428
+ defineLazyInternal(inst, "optin", (zod) => zod.def.innerType._zod.optin === "defaulted" ? "defaulted" : "optional");
2429
+ defineLazyInternal(inst, "optout", (zod) => zod.def.innerType._zod.optout);
2430
+ defineLazyInternal(inst, "values", (zod) => zod.def.innerType._zod.values);
2032
2431
  inst._zod.parse = (payload, ctx) => {
2033
2432
  if (ctx.direction === "backward") return def.innerType._zod.run(payload, ctx);
2034
- const result = def.innerType._zod.run(payload, ctx);
2035
- if (result instanceof Promise) return result.then((result) => {
2036
- payload.value = result.value;
2037
- if (result.issues.length) {
2038
- payload.value = def.catchValue({
2039
- ...payload,
2040
- error: { issues: result.issues.map((iss) => finalizeIssue(iss, ctx, config())) },
2041
- input: payload.value
2042
- });
2043
- payload.issues = [];
2044
- payload.fallback = true;
2045
- }
2046
- return payload;
2047
- });
2048
- payload.value = result.value;
2049
- if (result.issues.length) {
2050
- payload.value = def.catchValue({
2051
- ...payload,
2052
- error: { issues: result.issues.map((iss) => finalizeIssue(iss, ctx, config())) },
2053
- input: payload.value
2054
- });
2055
- payload.issues = [];
2056
- payload.fallback = true;
2057
- }
2058
- return payload;
2433
+ const result = def.innerType._zod.run({
2434
+ value: payload.value,
2435
+ issues: []
2436
+ }, ctx);
2437
+ if (result instanceof Promise) return result.then((result) => handleCatchResult(payload, result, def, ctx));
2438
+ return handleCatchResult(payload, result, def, ctx);
2059
2439
  };
2060
2440
  });
2061
2441
  const $ZodPipe = /*@__PURE__*/ $constructor("$ZodPipe", (inst, def) => {
2062
2442
  $ZodType.init(inst, def);
2063
- defineLazy(inst._zod, "values", () => def.in._zod.values);
2064
- defineLazy(inst._zod, "optin", () => def.in._zod.optin);
2065
- defineLazy(inst._zod, "optout", () => def.out._zod.optout);
2066
- defineLazy(inst._zod, "propValues", () => def.in._zod.propValues);
2443
+ defineLazyInternal(inst, "values", (zod) => zod.def.in._zod.values);
2444
+ defineLazyInternal(inst, "optin", (zod) => zod.def.in._zod.optin);
2445
+ defineLazyInternal(inst, "optout", (zod) => zod.def.out._zod.optout);
2446
+ defineLazyInternal(inst, "propValues", (zod) => zod.def.in._zod.propValues);
2067
2447
  inst._zod.parse = (payload, ctx) => {
2068
2448
  if (ctx.direction === "backward") {
2069
2449
  const right = def.out._zod.run(payload, ctx);
@@ -2076,22 +2456,21 @@ const $ZodPipe = /*@__PURE__*/ $constructor("$ZodPipe", (inst, def) => {
2076
2456
  };
2077
2457
  });
2078
2458
  function handlePipeResult(left, next, ctx) {
2079
- if (left.issues.length) {
2459
+ if (left.issues.some((iss) => iss.code !== "unrecognized_keys")) {
2080
2460
  left.aborted = true;
2081
2461
  return left;
2082
2462
  }
2083
2463
  return next._zod.run({
2084
2464
  value: left.value,
2085
- issues: left.issues,
2086
- fallback: left.fallback
2465
+ issues: left.issues
2087
2466
  }, ctx);
2088
2467
  }
2089
2468
  const $ZodReadonly = /*@__PURE__*/ $constructor("$ZodReadonly", (inst, def) => {
2090
2469
  $ZodType.init(inst, def);
2091
- defineLazy(inst._zod, "propValues", () => def.innerType._zod.propValues);
2092
- defineLazy(inst._zod, "values", () => def.innerType._zod.values);
2093
- defineLazy(inst._zod, "optin", () => def.innerType?._zod?.optin);
2094
- defineLazy(inst._zod, "optout", () => def.innerType?._zod?.optout);
2470
+ defineLazyInternal(inst, "propValues", (zod) => zod.def.innerType._zod.propValues);
2471
+ defineLazyInternal(inst, "values", (zod) => zod.def.innerType._zod.values);
2472
+ defineLazyInternal(inst, "optin", (zod) => zod.def.innerType?._zod?.optin);
2473
+ defineLazyInternal(inst, "optout", (zod) => zod.def.innerType?._zod?.optout);
2095
2474
  inst._zod.parse = (payload, ctx) => {
2096
2475
  if (ctx.direction === "backward") return def.innerType._zod.run(payload, ctx);
2097
2476
  const result = def.innerType._zod.run(payload, ctx);
@@ -2100,37 +2479,362 @@ const $ZodReadonly = /*@__PURE__*/ $constructor("$ZodReadonly", (inst, def) => {
2100
2479
  };
2101
2480
  });
2102
2481
  function handleReadonlyResult(payload) {
2103
- payload.value = Object.freeze(payload.value);
2482
+ if (!payload.memo) payload.value = Object.freeze(payload.value);
2104
2483
  return payload;
2105
2484
  }
2106
- const $ZodCustom = /*@__PURE__*/ $constructor("$ZodCustom", (inst, def) => {
2107
- $ZodCheck.init(inst, def);
2108
- $ZodType.init(inst, def);
2109
- inst._zod.parse = (payload, _) => {
2110
- return payload;
2485
+ const $ZodCustom = /*@__PURE__*/ $constructor("$ZodCustom", (inst, def) => {
2486
+ $ZodCheck.init(inst, def);
2487
+ $ZodType.init(inst, def);
2488
+ inst._zod.parse = (payload, _) => {
2489
+ return payload;
2490
+ };
2491
+ inst._zod.check = (payload) => {
2492
+ const input = payload.value;
2493
+ const r = def.fn(input);
2494
+ if (r instanceof Promise) return r.then((r) => handleRefineResult(r, payload, input, inst));
2495
+ handleRefineResult(r, payload, input, inst);
2496
+ };
2497
+ });
2498
+ function handleRefineResult(result, payload, input, inst) {
2499
+ if (!result) {
2500
+ const _iss = {
2501
+ code: "custom",
2502
+ input,
2503
+ inst,
2504
+ path: [...inst._zod.def.path ?? []],
2505
+ continue: !inst._zod.def.abort
2506
+ };
2507
+ if (inst._zod.def.params) _iss.params = inst._zod.def.params;
2508
+ payload.issues.push(issue(_iss));
2509
+ }
2510
+ }
2511
+ //#endregion
2512
+ //#region node_modules/.pnpm/zod@4.5.4/node_modules/zod/v4/core/memoizer.js
2513
+ var $ZodCyclicError = class extends Error {
2514
+ constructor() {
2515
+ super(`Cannot parse a reference cycle that closes through a transform`);
2516
+ this.name = "ZodCyclicError";
2517
+ }
2518
+ };
2519
+ /** Keyed off the context object every schema in one parse call already shares. */
2520
+ const STATE = "~memo";
2521
+ const NO_ISSUES = [];
2522
+ function cloneIssues(issues) {
2523
+ return issues.map((iss) => iss.path ? {
2524
+ ...iss,
2525
+ path: iss.path.slice()
2526
+ } : { ...iss });
2527
+ }
2528
+ const recursive = /*@__PURE__*/ new WeakMap();
2529
+ /** Whether this schema's subtree contains a cycle, so one parse can re-enter it. */
2530
+ function isRecursive(inst, stack) {
2531
+ const cached = recursive.get(inst);
2532
+ if (cached !== void 0) return cached;
2533
+ if (stack.has(inst)) return true;
2534
+ stack.add(inst);
2535
+ let result = false;
2536
+ const check = (child) => {
2537
+ if (!result && child?._zod && isRecursive(child, stack)) result = true;
2538
+ };
2539
+ const def = inst._zod.def;
2540
+ switch (def.type) {
2541
+ case "object":
2542
+ for (const key of Reflect.ownKeys(def.shape)) check(def.shape[key]);
2543
+ check(def.catchall);
2544
+ break;
2545
+ case "array":
2546
+ check(def.element);
2547
+ break;
2548
+ case "tuple":
2549
+ for (const el of def.items) check(el);
2550
+ check(def.rest);
2551
+ break;
2552
+ case "record":
2553
+ case "map":
2554
+ check(def.keyType);
2555
+ check(def.valueType);
2556
+ break;
2557
+ case "set":
2558
+ check(def.valueType);
2559
+ break;
2560
+ case "union":
2561
+ for (const el of def.options) check(el);
2562
+ break;
2563
+ case "intersection":
2564
+ check(def.left);
2565
+ check(def.right);
2566
+ break;
2567
+ case "optional":
2568
+ case "nullable":
2569
+ case "default":
2570
+ case "prefault":
2571
+ case "catch":
2572
+ case "readonly":
2573
+ case "nonoptional":
2574
+ case "promise":
2575
+ case "success":
2576
+ check(def.innerType);
2577
+ break;
2578
+ case "pipe":
2579
+ check(def.in);
2580
+ check(def.out);
2581
+ break;
2582
+ case "function":
2583
+ check(def.input);
2584
+ check(def.output);
2585
+ break;
2586
+ case "lazy":
2587
+ check(inst._zod.innerType);
2588
+ break;
2589
+ case "template_literal":
2590
+ case "string":
2591
+ case "number":
2592
+ case "int":
2593
+ case "boolean":
2594
+ case "bigint":
2595
+ case "symbol":
2596
+ case "undefined":
2597
+ case "null":
2598
+ case "void":
2599
+ case "never":
2600
+ case "any":
2601
+ case "unknown":
2602
+ case "date":
2603
+ case "nan":
2604
+ case "enum":
2605
+ case "literal":
2606
+ case "file":
2607
+ case "transform":
2608
+ case "custom": break;
2609
+ default: for (const key in def) {
2610
+ const desc = Object.getOwnPropertyDescriptor(def, key);
2611
+ if (!desc || desc.get) continue;
2612
+ const value = desc.value;
2613
+ if (!value || typeof value !== "object") continue;
2614
+ if (value._zod) check(value);
2615
+ else if (Array.isArray(value)) for (const el of value) check(el);
2616
+ }
2617
+ }
2618
+ stack.delete(inst);
2619
+ recursive.set(inst, result);
2620
+ return result;
2621
+ }
2622
+ function bucketFor(state, inst) {
2623
+ let bucket = state.buckets.get(inst);
2624
+ if (!bucket) {
2625
+ bucket = /* @__PURE__ */ new Map();
2626
+ state.buckets.set(inst, bucket);
2627
+ }
2628
+ return bucket;
2629
+ }
2630
+ let handoff;
2631
+ const open = [];
2632
+ const memo = {
2633
+ alloc(_inst, payload, empty) {
2634
+ const bucket = handoff;
2635
+ if (!bucket) return empty;
2636
+ handoff = void 0;
2637
+ const entry = {
2638
+ value: empty,
2639
+ issues: null
2640
+ };
2641
+ bucket.set(payload.value, entry);
2642
+ open.push(entry);
2643
+ return empty;
2644
+ },
2645
+ guard(inst) {
2646
+ var _a;
2647
+ (_a = inst._zod).deferred ?? (_a.deferred = []);
2648
+ inst._zod.deferred.push(() => {
2649
+ const base = inst._zod.parse;
2650
+ const wrapped = (payload, ctx) => {
2651
+ if (ctx.direction !== "backward" && isBackEdge(ctx, payload.value)) throw new $ZodCyclicError();
2652
+ return base(payload, ctx);
2653
+ };
2654
+ inst._zod.parse = wrapped;
2655
+ if (inst._zod.run === base) inst._zod.run = wrapped;
2656
+ });
2657
+ },
2658
+ attach(inst) {
2659
+ var _a;
2660
+ let isRecursiveInst;
2661
+ let lastCtx;
2662
+ let lastBucket;
2663
+ (_a = inst._zod).deferred ?? (_a.deferred = []);
2664
+ inst._zod.deferred.push(() => {
2665
+ const base = inst._zod.parse;
2666
+ const wrapped = (payload, ctx) => {
2667
+ if (isRecursiveInst === void 0) {
2668
+ isRecursiveInst = isRecursive(inst, /* @__PURE__ */ new Set());
2669
+ if (!isRecursiveInst) {
2670
+ inst._zod.parse = base;
2671
+ if (inst._zod.run === wrapped) inst._zod.run = base;
2672
+ return base(payload, ctx);
2673
+ }
2674
+ }
2675
+ const input = payload.value;
2676
+ if (input === null || typeof input !== "object") return base(payload, ctx);
2677
+ let state = ctx[STATE];
2678
+ if (!state) {
2679
+ state = {
2680
+ buckets: /* @__PURE__ */ new Map(),
2681
+ backEdges: void 0
2682
+ };
2683
+ ctx[STATE] = state;
2684
+ }
2685
+ let bucket;
2686
+ if (lastCtx === ctx) bucket = lastBucket;
2687
+ else {
2688
+ bucket = bucketFor(state, inst);
2689
+ lastCtx = ctx;
2690
+ lastBucket = bucket;
2691
+ }
2692
+ const hit = bucket.get(input);
2693
+ if (hit) {
2694
+ payload.value = hit.value;
2695
+ if (hit.issues) {
2696
+ if (hit.issues.length) payload.issues.push(...cloneIssues(hit.issues));
2697
+ } else {
2698
+ payload.memo = true;
2699
+ state.backEdges ?? (state.backEdges = /* @__PURE__ */ new Set());
2700
+ state.backEdges.add(hit.value);
2701
+ }
2702
+ return payload;
2703
+ }
2704
+ handoff = bucket;
2705
+ const depth = open.length;
2706
+ const result = base(payload, ctx);
2707
+ handoff = void 0;
2708
+ const entry = open.length > depth ? open.pop() : void 0;
2709
+ if (result instanceof Promise) return result.then((r) => {
2710
+ if (entry) entry.issues = r.issues.length ? cloneIssues(r.issues) : NO_ISSUES;
2711
+ return r;
2712
+ });
2713
+ if (entry) entry.issues = result.issues.length ? cloneIssues(result.issues) : NO_ISSUES;
2714
+ return result;
2715
+ };
2716
+ inst._zod.parse = wrapped;
2717
+ if (inst._zod.run === base) inst._zod.run = wrapped;
2718
+ });
2719
+ }
2720
+ };
2721
+ /** The memoizer that gives containers cycle support. `zod` installs it by default; `zod/mini` opts in with `config({ memoizer: memoizer() })`. */
2722
+ function memoizer() {
2723
+ return memo;
2724
+ }
2725
+ /** Whether this value is a node a back-edge resolved to before it finished. */
2726
+ function isBackEdge(ctx, value) {
2727
+ const backEdges = ctx[STATE]?.backEdges;
2728
+ return backEdges !== void 0 && value !== null && typeof value === "object" && backEdges.has(value);
2729
+ }
2730
+ //#endregion
2731
+ //#region node_modules/.pnpm/zod@4.5.4/node_modules/zod/v4/locales/en.js
2732
+ const error = () => {
2733
+ const Sizable = {
2734
+ string: {
2735
+ unit: "characters",
2736
+ verb: "to have"
2737
+ },
2738
+ file: {
2739
+ unit: "bytes",
2740
+ verb: "to have"
2741
+ },
2742
+ array: {
2743
+ unit: "items",
2744
+ verb: "to have"
2745
+ },
2746
+ set: {
2747
+ unit: "items",
2748
+ verb: "to have"
2749
+ },
2750
+ map: {
2751
+ unit: "entries",
2752
+ verb: "to have"
2753
+ }
2111
2754
  };
2112
- inst._zod.check = (payload) => {
2113
- const input = payload.value;
2114
- const r = def.fn(input);
2115
- if (r instanceof Promise) return r.then((r) => handleRefineResult(r, payload, input, inst));
2116
- handleRefineResult(r, payload, input, inst);
2755
+ function getSizing(origin) {
2756
+ return Sizable[origin] ?? null;
2757
+ }
2758
+ const FormatDictionary = {
2759
+ regex: "input",
2760
+ email: "email address",
2761
+ url: "URL",
2762
+ emoji: "emoji",
2763
+ uuid: "UUID",
2764
+ uuidv4: "UUIDv4",
2765
+ uuidv6: "UUIDv6",
2766
+ nanoid: "nanoid",
2767
+ guid: "GUID",
2768
+ cuid: "cuid",
2769
+ cuid2: "cuid2",
2770
+ ulid: "ULID",
2771
+ xid: "XID",
2772
+ ksuid: "KSUID",
2773
+ datetime: "ISO datetime",
2774
+ date: "ISO date",
2775
+ time: "ISO time",
2776
+ duration: "ISO duration",
2777
+ ipv4: "IPv4 address",
2778
+ ipv6: "IPv6 address",
2779
+ mac: "MAC address",
2780
+ cidrv4: "IPv4 range",
2781
+ cidrv6: "IPv6 range",
2782
+ base64: "base64-encoded string",
2783
+ base64url: "base64url-encoded string",
2784
+ json_string: "JSON string",
2785
+ e164: "E.164 number",
2786
+ credit_card: "credit card number",
2787
+ jwt: "JWT",
2788
+ template_literal: "input"
2117
2789
  };
2118
- });
2119
- function handleRefineResult(result, payload, input, inst) {
2120
- if (!result) {
2121
- const _iss = {
2122
- code: "custom",
2123
- input,
2124
- inst,
2125
- path: [...inst._zod.def.path ?? []],
2126
- continue: !inst._zod.def.abort
2127
- };
2128
- if (inst._zod.def.params) _iss.params = inst._zod.def.params;
2129
- payload.issues.push(issue(_iss));
2790
+ const TypeDictionary = { nan: "NaN" };
2791
+ function getTypeName(type, input) {
2792
+ if (type === "number" && typeof input === "number" && !Number.isFinite(input)) return String(input);
2793
+ return TypeDictionary[type] ?? type;
2130
2794
  }
2795
+ return (issue) => {
2796
+ switch (issue.code) {
2797
+ case "invalid_type": return `Invalid input: expected ${getTypeName(issue.expected)}, received ${getTypeName(parsedType(issue.input), issue.input)}`;
2798
+ case "invalid_value":
2799
+ if (issue.values.length === 1) return `Invalid input: expected ${stringifyPrimitive(issue.values[0])}`;
2800
+ return `Invalid option: expected one of ${joinValues(issue.values, "|")}`;
2801
+ case "too_big": {
2802
+ const adj = issue.exact ? "exactly " : issue.inclusive ? "<=" : "<";
2803
+ const sizing = getSizing(issue.origin);
2804
+ if (sizing) return `Too big: expected ${issue.origin ?? "value"} to have ${adj}${issue.maximum.toString()} ${sizing.unit ?? "elements"}`;
2805
+ return `Too big: expected ${issue.origin ?? "value"} to be ${adj}${issue.maximum.toString()}`;
2806
+ }
2807
+ case "too_small": {
2808
+ const adj = issue.exact ? "exactly " : issue.inclusive ? ">=" : ">";
2809
+ const sizing = getSizing(issue.origin);
2810
+ if (sizing) return `Too small: expected ${issue.origin} to have ${adj}${issue.minimum.toString()} ${sizing.unit}`;
2811
+ return `Too small: expected ${issue.origin} to be ${adj}${issue.minimum.toString()}`;
2812
+ }
2813
+ case "invalid_format": {
2814
+ const _issue = issue;
2815
+ if (_issue.format === "starts_with") return `Invalid string: must start with "${_issue.prefix}"`;
2816
+ if (_issue.format === "ends_with") return `Invalid string: must end with "${_issue.suffix}"`;
2817
+ if (_issue.format === "includes") return `Invalid string: must include "${_issue.includes}"`;
2818
+ if (_issue.format === "regex") return `Invalid string: must match pattern ${_issue.pattern}`;
2819
+ return `Invalid ${FormatDictionary[_issue.format] ?? issue.format}`;
2820
+ }
2821
+ case "not_multiple_of": return `Invalid number: must be a multiple of ${issue.divisor}`;
2822
+ case "unrecognized_keys": return `Unrecognized key${issue.keys.length > 1 ? "s" : ""}: ${joinValues(issue.keys, ", ")}`;
2823
+ case "invalid_key": return `Invalid key in ${issue.origin}`;
2824
+ case "invalid_union":
2825
+ if (issue.options && Array.isArray(issue.options) && issue.options.length > 0) return `Invalid discriminator value. Expected ${issue.options.map((o) => `'${o}'`).join(" | ")}`;
2826
+ if (issue.inclusive === false) return "Invalid input: more than one option matched";
2827
+ return "Invalid input";
2828
+ case "invalid_element": return `Invalid value in ${issue.origin}`;
2829
+ default: return `Invalid input`;
2830
+ }
2831
+ };
2832
+ };
2833
+ function en_default() {
2834
+ return { localeError: error() };
2131
2835
  }
2132
2836
  //#endregion
2133
- //#region node_modules/.pnpm/zod@4.4.3/node_modules/zod/v4/core/registries.js
2837
+ //#region node_modules/.pnpm/zod@4.5.4/node_modules/zod/v4/core/registries.js
2134
2838
  var _a;
2135
2839
  var $ZodRegistry = class {
2136
2840
  constructor() {
@@ -2177,7 +2881,7 @@ function registry() {
2177
2881
  (_a = globalThis).__zod_globalRegistry ?? (_a.__zod_globalRegistry = registry());
2178
2882
  const globalRegistry = globalThis.__zod_globalRegistry;
2179
2883
  //#endregion
2180
- //#region node_modules/.pnpm/zod@4.4.3/node_modules/zod/v4/core/api.js
2884
+ //#region node_modules/.pnpm/zod@4.5.4/node_modules/zod/v4/core/api.js
2181
2885
  // @__NO_SIDE_EFFECTS__
2182
2886
  function _string(Class, params) {
2183
2887
  return new Class({
@@ -2662,7 +3366,7 @@ function _superRefine(fn, params) {
2662
3366
  const _issue = issue$2;
2663
3367
  if (_issue.fatal) _issue.continue = false;
2664
3368
  _issue.code ?? (_issue.code = "custom");
2665
- _issue.input ?? (_issue.input = payload.value);
3369
+ if (!("input" in _issue)) _issue.input = payload.value;
2666
3370
  _issue.inst ?? (_issue.inst = ch);
2667
3371
  _issue.continue ?? (_issue.continue = !ch._zod.def.abort);
2668
3372
  payload.issues.push(issue(_issue));
@@ -2682,7 +3386,11 @@ function _check(fn, params) {
2682
3386
  return ch;
2683
3387
  }
2684
3388
  //#endregion
2685
- //#region node_modules/.pnpm/zod@4.4.3/node_modules/zod/v4/core/to-json-schema.js
3389
+ //#region node_modules/.pnpm/zod@4.5.4/node_modules/zod/v4/core/to-json-schema.js
3390
+ function assignProps(target, ...sources) {
3391
+ for (const source of sources) for (const key of Reflect.ownKeys(source)) if (Object.prototype.propertyIsEnumerable.call(source, key)) assignProp(target, key, source[key]);
3392
+ return target;
3393
+ }
2686
3394
  function initializeContext(params) {
2687
3395
  let target = params?.target ?? "draft-2020-12";
2688
3396
  if (target === "draft-4") target = "draft-04";
@@ -2696,11 +3404,31 @@ function initializeContext(params) {
2696
3404
  io: params?.io ?? "output",
2697
3405
  counter: 0,
2698
3406
  seen: /* @__PURE__ */ new Map(),
3407
+ sharedDefsExtractedFor: void 0,
3408
+ sharedEmitDoneFor: void 0,
2699
3409
  cycles: params?.cycles ?? "ref",
2700
3410
  reused: params?.reused ?? "inline",
3411
+ intersections: [],
3412
+ deferred: [],
2701
3413
  external: params?.external ?? void 0
2702
3414
  };
2703
3415
  }
3416
+ /**
3417
+ * Applies the `unrepresentable` setting at a site that has no JSON Schema equivalent. Throws
3418
+ * `message` unless the setting (or the handler's return value) says otherwise. Returns `true` if a
3419
+ * custom JSON Schema was written into `json`, in which case the caller must not write its own.
3420
+ */
3421
+ function handleUnrepresentable(schema, ctx, json, params, message) {
3422
+ const result = typeof ctx.unrepresentable === "function" ? ctx.unrepresentable({
3423
+ zodSchema: schema,
3424
+ path: params.path,
3425
+ message
3426
+ }) : ctx.unrepresentable;
3427
+ if (result === "any") return false;
3428
+ if (result === void 0 || result === "throw") throw new Error(message);
3429
+ Object.assign(json, result);
3430
+ return true;
3431
+ }
2704
3432
  function process(schema, ctx, _params = {
2705
3433
  path: [],
2706
3434
  schemaPath: []
@@ -2720,6 +3448,8 @@ function process(schema, ctx, _params = {
2720
3448
  path: _params.path
2721
3449
  };
2722
3450
  ctx.seen.set(schema, result);
3451
+ ctx.sharedDefsExtractedFor = void 0;
3452
+ ctx.sharedEmitDoneFor = void 0;
2723
3453
  const overrideSchema = schema._zod.toJSONSchema?.();
2724
3454
  if (overrideSchema) result.schema = overrideSchema;
2725
3455
  else {
@@ -2743,7 +3473,7 @@ function process(schema, ctx, _params = {
2743
3473
  }
2744
3474
  }
2745
3475
  const meta = ctx.metadataRegistry.get(schema);
2746
- if (meta) Object.assign(result.schema, meta);
3476
+ if (meta) assignProps(result.schema, meta);
2747
3477
  if (ctx.io === "input" && isTransforming(schema)) {
2748
3478
  delete result.schema.examples;
2749
3479
  delete result.schema.default;
@@ -2752,9 +3482,13 @@ function process(schema, ctx, _params = {
2752
3482
  delete result.schema._prefault;
2753
3483
  return ctx.seen.get(schema).schema;
2754
3484
  }
3485
+ function encodeJSONPointerSegment(segment) {
3486
+ return segment.replace(/~/g, "~0").replace(/\//g, "~1");
3487
+ }
2755
3488
  function extractDefs(ctx, schema) {
2756
3489
  const root = ctx.seen.get(schema);
2757
3490
  if (!root) throw new Error("Unprocessed schema. This is a bug in Zod.");
3491
+ if (ctx.external && ctx.sharedDefsExtractedFor === ctx.external) return;
2758
3492
  const idToSchema = /* @__PURE__ */ new Map();
2759
3493
  for (const entry of ctx.seen.entries()) {
2760
3494
  const id = ctx.metadataRegistry.get(entry[0])?.id;
@@ -2774,15 +3508,16 @@ function extractDefs(ctx, schema) {
2774
3508
  entry[1].defId = id;
2775
3509
  return {
2776
3510
  defId: id,
2777
- ref: `${uriGenerator("__shared")}#/${defsSegment}/${id}`
3511
+ ref: `${uriGenerator("__shared")}#/${defsSegment}/${encodeJSONPointerSegment(id)}`
2778
3512
  };
2779
3513
  }
2780
- if (entry[1] === root) return { ref: "#" };
2781
- const defUriPrefix = `#/${defsSegment}/`;
3514
+ const uriPrefix = `#`;
3515
+ const defUriPrefix = `${uriPrefix}/${defsSegment}/`;
3516
+ if (entry[1] === root && !entry[1].schema.id) return { ref: uriPrefix };
2782
3517
  const defId = entry[1].schema.id ?? `__schema${ctx.counter++}`;
2783
3518
  return {
2784
3519
  defId,
2785
- ref: defUriPrefix + defId
3520
+ ref: defUriPrefix + encodeJSONPointerSegment(defId)
2786
3521
  };
2787
3522
  };
2788
3523
  const extractToDef = (entry) => {
@@ -2829,6 +3564,111 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
2829
3564
  }
2830
3565
  }
2831
3566
  }
3567
+ if (ctx.external) ctx.sharedDefsExtractedFor = ctx.external;
3568
+ }
3569
+ /** Rewrites `anyOf: [{type: "a"}, {type: "b"}]` to `type: ["a", "b"]`, which every JSON Schema draft treats as equivalent and most consumers render far better for the nullable case. Only branches that are a bare type assertion qualify — anything carrying a constraint, `$ref`, `const` or metadata is left alone. Runs after `flattenRef`, so a branch an override decorated or `$defs` extraction turned into a `$ref` is no longer bare and correctly stays in `anyOf`. `oneOf` is excluded: `integer` and `number` overlap, so "exactly one" and "at least one" are not the same there. OpenAPI 3.0 is excluded: its `type` must be a single string. */
3570
+ function compactTypeUnion(schema) {
3571
+ const options = schema.anyOf;
3572
+ if (!Array.isArray(options) || options.length === 0 || schema.type !== void 0) return;
3573
+ const types = [];
3574
+ for (const option of options) {
3575
+ if (!option || typeof option !== "object") return;
3576
+ compactTypeUnion(option);
3577
+ const keys = Object.keys(option);
3578
+ if (keys.length !== 1 || keys[0] !== "type") return;
3579
+ const type = option.type;
3580
+ for (const member of Array.isArray(type) ? type : [type]) {
3581
+ if (typeof member !== "string") return;
3582
+ if (!types.includes(member)) types.push(member);
3583
+ }
3584
+ }
3585
+ delete schema.anyOf;
3586
+ schema.type = types.length === 1 ? types[0] : types;
3587
+ }
3588
+ /** Keywords `foldIntersection` knows how to combine. Anything else — `$ref`, `patternProperties`,
3589
+ * an annotation like `description` — makes a member unfoldable, so a constraint this does not
3590
+ * understand leaves the `allOf` alone instead of being silently dropped or misattributed. */
3591
+ const FOLDABLE_KEYS = /* @__PURE__ */ new Set([
3592
+ "type",
3593
+ "properties",
3594
+ "required",
3595
+ "additionalProperties"
3596
+ ]);
3597
+ const UNION_KEYS = ["oneOf", "anyOf"];
3598
+ /** A member's constraint on a key it does not declare itself. A `catchall` states one; `false`, an absent `additionalProperties`, and the empty schema a loose object emits state nothing. */
3599
+ function undeclaredConstraint(member) {
3600
+ const extra = member.additionalProperties;
3601
+ if (extra === void 0 || extra === false || typeof extra !== "object" || extra === null) return null;
3602
+ return Object.keys(extra).length ? extra : null;
3603
+ }
3604
+ /** Combines object members into the single object they describe together, or returns `null` if any of them carries a keyword outside {@link FOLDABLE_KEYS}. */
3605
+ function foldObjects(members) {
3606
+ const objects = [];
3607
+ for (const member of members) {
3608
+ if (typeof member !== "object" || member.type !== "object") return null;
3609
+ for (const key in member) if (!FOLDABLE_KEYS.has(key)) return null;
3610
+ objects.push(member);
3611
+ }
3612
+ const properties = {};
3613
+ const required = /* @__PURE__ */ new Set();
3614
+ for (const object of objects) {
3615
+ for (const key in object.properties) {
3616
+ if (Object.prototype.hasOwnProperty.call(properties, key)) continue;
3617
+ const parts = [];
3618
+ for (const other of objects) {
3619
+ const part = other.properties?.[key] ?? undeclaredConstraint(other);
3620
+ if (part === null || part === void 0) continue;
3621
+ if (!parts.some((seen) => JSON.stringify(seen) === JSON.stringify(part))) parts.push(part);
3622
+ }
3623
+ assignProp(properties, key, parts.length === 1 ? parts[0] : foldObjects(parts) ?? { allOf: parts });
3624
+ }
3625
+ for (const key of object.required ?? []) required.add(key);
3626
+ }
3627
+ const folded = {
3628
+ type: "object",
3629
+ properties
3630
+ };
3631
+ if (required.size) folded.required = [...required];
3632
+ if (objects.every((object) => object.additionalProperties === false)) folded.additionalProperties = false;
3633
+ else {
3634
+ const constraints = [];
3635
+ for (const object of objects) {
3636
+ const constraint = undeclaredConstraint(object);
3637
+ if (constraint && !constraints.some((seen) => JSON.stringify(seen) === JSON.stringify(constraint))) constraints.push(constraint);
3638
+ }
3639
+ if (constraints.length === 1) folded.additionalProperties = constraints[0];
3640
+ else if (constraints.length > 1) folded.additionalProperties = { allOf: constraints };
3641
+ }
3642
+ return folded;
3643
+ }
3644
+ /** `additionalProperties` in an `allOf` member sees only that member's own `properties`, so two
3645
+ * closed object members reject each other's keys and the schema validates nothing. Zod's parser
3646
+ * pools the key sets instead — `handleIntersectionResults` reports a key as unrecognized only when
3647
+ * *every* side rejects it — so the emitted schema has to pool them too, and folding the members
3648
+ * into one object is the encoding that says so on every target.
3649
+ *
3650
+ * This runs from `finalize`, after `extractDefs`, which is what keeps it clear of the `$ref`
3651
+ * machinery: a member extracted into `$defs` is already a `$ref` by now and declines to fold, so it
3652
+ * keeps its reference and its own closedness rather than being inlined as a stale copy. */
3653
+ function foldIntersection(json) {
3654
+ const allOf = json.allOf;
3655
+ if (!Array.isArray(allOf) || allOf.length < 2) return;
3656
+ for (const key of FOLDABLE_KEYS) if (key in json) return;
3657
+ const unions = allOf.filter((m) => UNION_KEYS.some((k) => Array.isArray(m[k])));
3658
+ let folded = null;
3659
+ if (!unions.length) folded = foldObjects(allOf);
3660
+ else {
3661
+ const union = unions[0];
3662
+ const keyword = UNION_KEYS.find((k) => Array.isArray(union[k]));
3663
+ if (Object.keys(union).length !== 1) return;
3664
+ const rest = allOf.filter((m) => m !== union);
3665
+ const branches = union[keyword].map((branch) => foldObjects([...rest, branch]));
3666
+ if (branches.some((b) => !b)) return;
3667
+ folded = { [keyword]: branches };
3668
+ }
3669
+ if (!folded) return;
3670
+ delete json.allOf;
3671
+ assignProps(json, folded);
2832
3672
  }
2833
3673
  function finalize(ctx, schema) {
2834
3674
  const root = ctx.seen.get(schema);
@@ -2847,8 +3687,8 @@ function finalize(ctx, schema) {
2847
3687
  if (refSchema.$ref && (ctx.target === "draft-07" || ctx.target === "draft-04" || ctx.target === "openapi-3.0")) {
2848
3688
  schema.allOf = schema.allOf ?? [];
2849
3689
  schema.allOf.push(refSchema);
2850
- } else Object.assign(schema, refSchema);
2851
- Object.assign(schema, _cached);
3690
+ } else assignProps(schema, refSchema);
3691
+ assignProps(schema, _cached);
2852
3692
  if (zodSchema._zod.parent === ref) for (const key in schema) {
2853
3693
  if (key === "$ref" || key === "allOf") continue;
2854
3694
  if (!(key in _cached)) delete schema[key];
@@ -2876,7 +3716,22 @@ function finalize(ctx, schema) {
2876
3716
  path: seen.path ?? []
2877
3717
  });
2878
3718
  };
2879
- for (const entry of [...ctx.seen.entries()].reverse()) flattenRef(entry[0]);
3719
+ if (!ctx.external || ctx.sharedEmitDoneFor !== ctx.external) {
3720
+ for (const entry of [...ctx.seen.entries()].reverse()) flattenRef(entry[0]);
3721
+ if (ctx.target !== "openapi-3.0") for (const entry of ctx.seen.entries()) compactTypeUnion(entry[1].def ?? entry[1].schema);
3722
+ for (const rewrite of ctx.deferred) rewrite();
3723
+ if (ctx.intersections.length) {
3724
+ const carriers = /* @__PURE__ */ new Map();
3725
+ for (const seen of ctx.seen.values()) for (const json of [seen.schema, seen.def]) {
3726
+ const allOf = json?.allOf;
3727
+ if (!Array.isArray(allOf)) continue;
3728
+ const existing = carriers.get(allOf);
3729
+ if (existing) existing.push(json);
3730
+ else carriers.set(allOf, [json]);
3731
+ }
3732
+ for (const allOf of ctx.intersections) for (const json of carriers.get(allOf) ?? []) foldIntersection(json);
3733
+ }
3734
+ }
2880
3735
  const result = {};
2881
3736
  if (ctx.target === "draft-2020-12") result.$schema = "https://json-schema.org/draft/2020-12/schema";
2882
3737
  else if (ctx.target === "draft-07") result.$schema = "http://json-schema.org/draft-07/schema#";
@@ -2887,17 +3742,18 @@ function finalize(ctx, schema) {
2887
3742
  if (!id) throw new Error("Schema is missing an `id` property");
2888
3743
  result.$id = ctx.external.uri(id);
2889
3744
  }
2890
- Object.assign(result, root.def ?? root.schema);
3745
+ assignProps(result, root.defId ? root.schema : root.def ?? root.schema);
2891
3746
  const rootMetaId = ctx.metadataRegistry.get(schema)?.id;
2892
3747
  if (rootMetaId !== void 0 && result.id === rootMetaId) delete result.id;
2893
3748
  const defs = ctx.external?.defs ?? {};
2894
- for (const entry of ctx.seen.entries()) {
3749
+ if (!ctx.external || ctx.sharedEmitDoneFor !== ctx.external) for (const entry of ctx.seen.entries()) {
2895
3750
  const seen = entry[1];
2896
3751
  if (seen.def && seen.defId) {
2897
3752
  if (seen.def.id === seen.defId) delete seen.def.id;
2898
- defs[seen.defId] = seen.def;
3753
+ assignProp(defs, seen.defId, seen.def);
2899
3754
  }
2900
3755
  }
3756
+ if (ctx.external) ctx.sharedEmitDoneFor = ctx.external;
2901
3757
  if (ctx.external) {} else if (Object.keys(defs).length > 0) {
2902
3758
  if (ctx.target === "draft-2020-12") result.$defs = defs;
2903
3759
  else result.definitions = defs;
@@ -2929,7 +3785,7 @@ function isTransforming(_schema, _ctx) {
2929
3785
  if (def.type === "array") return isTransforming(def.element, ctx);
2930
3786
  if (def.type === "set") return isTransforming(def.valueType, ctx);
2931
3787
  if (def.type === "lazy") return isTransforming(def.getter(), ctx);
2932
- if (def.type === "promise" || def.type === "optional" || def.type === "nonoptional" || def.type === "nullable" || def.type === "readonly" || def.type === "default" || def.type === "prefault") return isTransforming(def.innerType, ctx);
3788
+ if (def.type === "promise" || def.type === "optional" || def.type === "nonoptional" || def.type === "nullable" || def.type === "readonly" || def.type === "default" || def.type === "prefault" || def.type === "catch") return isTransforming(def.innerType, ctx);
2933
3789
  if (def.type === "intersection") return isTransforming(def.left, ctx) || isTransforming(def.right, ctx);
2934
3790
  if (def.type === "record" || def.type === "map") return isTransforming(def.keyType, ctx) || isTransforming(def.valueType, ctx);
2935
3791
  if (def.type === "pipe") {
@@ -2977,7 +3833,7 @@ const createStandardJSONSchemaMethod = (schema, io, processors = {}) => (params)
2977
3833
  return finalize(ctx, schema);
2978
3834
  };
2979
3835
  //#endregion
2980
- //#region node_modules/.pnpm/zod@4.4.3/node_modules/zod/v4/core/json-schema-processors.js
3836
+ //#region node_modules/.pnpm/zod@4.5.4/node_modules/zod/v4/core/json-schema-processors.js
2981
3837
  const formatMap = {
2982
3838
  guid: "uuid",
2983
3839
  url: "uri",
@@ -2988,25 +3844,25 @@ const formatMap = {
2988
3844
  const stringProcessor = (schema, ctx, _json, _params) => {
2989
3845
  const json = _json;
2990
3846
  json.type = "string";
2991
- const { minimum, maximum, format, patterns, contentEncoding } = schema._zod.bag;
3847
+ const { minimum, maximum, format, patterns, contentEncoding, laxFormat } = schema._zod.bag;
2992
3848
  if (typeof minimum === "number") json.minLength = minimum;
2993
3849
  if (typeof maximum === "number") json.maxLength = maximum;
2994
3850
  if (format) {
2995
3851
  json.format = formatMap[format] ?? format;
2996
3852
  if (json.format === "") delete json.format;
2997
- if (format === "time") delete json.format;
3853
+ if (format === "time" || laxFormat) delete json.format;
2998
3854
  }
2999
3855
  if (contentEncoding) json.contentEncoding = contentEncoding;
3000
3856
  if (patterns && patterns.size > 0) {
3001
- const regexes = [...patterns];
3002
- if (regexes.length === 1) json.pattern = regexes[0].source;
3003
- else if (regexes.length > 1) json.allOf = [...regexes.map((regex) => ({
3857
+ const patternList = [...patterns];
3858
+ if (patternList.length === 1) json.pattern = patternList[0].source;
3859
+ else if (patternList.length > 1) json.allOf = [...patternList.map((regex) => ({
3004
3860
  ...ctx.target === "draft-07" || ctx.target === "draft-04" || ctx.target === "openapi-3.0" ? { type: "string" } : {},
3005
3861
  pattern: regex.source
3006
3862
  }))];
3007
3863
  }
3008
3864
  };
3009
- const numberProcessor = (schema, ctx, _json, _params) => {
3865
+ const numberProcessor = (schema, ctx, _json, params) => {
3010
3866
  const json = _json;
3011
3867
  const { minimum, maximum, format, multipleOf, exclusiveMaximum, exclusiveMinimum } = schema._zod.bag;
3012
3868
  if (typeof format === "string" && format.includes("int")) json.type = "integer";
@@ -3026,7 +3882,10 @@ const numberProcessor = (schema, ctx, _json, _params) => {
3026
3882
  json.exclusiveMaximum = true;
3027
3883
  } else json.exclusiveMaximum = exclusiveMaximum;
3028
3884
  } else if (typeof maximum === "number") json.maximum = maximum;
3029
- if (typeof multipleOf === "number") json.multipleOf = multipleOf;
3885
+ if (typeof multipleOf === "number") {
3886
+ if (Number.isFinite(multipleOf) && multipleOf !== 0) json.multipleOf = Math.abs(multipleOf);
3887
+ else handleUnrepresentable(schema, ctx, json, params, `A multipleOf divisor of ${multipleOf} cannot be represented in JSON Schema`);
3888
+ }
3030
3889
  };
3031
3890
  const booleanProcessor = (_schema, _ctx, json, _params) => {
3032
3891
  json.type = "boolean";
@@ -3037,18 +3896,26 @@ const neverProcessor = (_schema, _ctx, json, _params) => {
3037
3896
  const enumProcessor = (schema, _ctx, json, _params) => {
3038
3897
  const def = schema._zod.def;
3039
3898
  const values = getEnumValues(def.entries);
3899
+ if (values.length === 0) {
3900
+ json.not = {};
3901
+ return;
3902
+ }
3040
3903
  if (values.every((v) => typeof v === "number")) json.type = "number";
3041
3904
  if (values.every((v) => typeof v === "string")) json.type = "string";
3042
3905
  json.enum = values;
3043
3906
  };
3044
- const literalProcessor = (schema, ctx, json, _params) => {
3907
+ const literalProcessor = (schema, ctx, json, params) => {
3045
3908
  const def = schema._zod.def;
3909
+ if (def.values.length === 0) {
3910
+ json.not = {};
3911
+ return;
3912
+ }
3046
3913
  const vals = [];
3047
3914
  for (const val of def.values) if (val === void 0) {
3048
- if (ctx.unrepresentable === "throw") throw new Error("Literal `undefined` cannot be represented in JSON Schema");
3915
+ if (handleUnrepresentable(schema, ctx, json, params, "Literal `undefined` cannot be represented in JSON Schema")) return;
3049
3916
  } else if (typeof val === "bigint") {
3050
- if (ctx.unrepresentable === "throw") throw new Error("BigInt literals cannot be represented in JSON Schema");
3051
- else vals.push(Number(val));
3917
+ if (handleUnrepresentable(schema, ctx, json, params, "BigInt literals cannot be represented in JSON Schema")) return;
3918
+ vals.push(Number(val));
3052
3919
  } else vals.push(val);
3053
3920
  if (vals.length === 0) {} else if (vals.length === 1) {
3054
3921
  const val = vals[0];
@@ -3063,11 +3930,11 @@ const literalProcessor = (schema, ctx, json, _params) => {
3063
3930
  json.enum = vals;
3064
3931
  }
3065
3932
  };
3066
- const customProcessor = (_schema, ctx, _json, _params) => {
3067
- if (ctx.unrepresentable === "throw") throw new Error("Custom types cannot be represented in JSON Schema");
3933
+ const customProcessor = (schema, ctx, json, params) => {
3934
+ handleUnrepresentable(schema, ctx, json, params, "Custom types cannot be represented in JSON Schema");
3068
3935
  };
3069
- const transformProcessor = (_schema, ctx, _json, _params) => {
3070
- if (ctx.unrepresentable === "throw") throw new Error("Transforms cannot be represented in JSON Schema");
3936
+ const transformProcessor = (schema, ctx, json, params) => {
3937
+ handleUnrepresentable(schema, ctx, json, params, "Transforms cannot be represented in JSON Schema");
3071
3938
  };
3072
3939
  const arrayProcessor = (schema, ctx, _json, params) => {
3073
3940
  const json = _json;
@@ -3081,25 +3948,32 @@ const arrayProcessor = (schema, ctx, _json, params) => {
3081
3948
  path: [...params.path, "items"]
3082
3949
  });
3083
3950
  };
3951
+ function inputOptin(schema) {
3952
+ const def = schema._zod.def;
3953
+ if (def.type === "pipe" && def.in._zod.traits.has("$ZodTransform")) return inputOptin(def.out);
3954
+ if (def.type === "catch") return inputOptin(def.innerType);
3955
+ return schema._zod.optin;
3956
+ }
3084
3957
  const objectProcessor = (schema, ctx, _json, params) => {
3085
3958
  const json = _json;
3086
3959
  const def = schema._zod.def;
3960
+ const shape = def.shape;
3961
+ if (Object.getOwnPropertySymbols(shape).length && handleUnrepresentable(schema, ctx, json, params, "Symbol keys cannot be represented in JSON Schema")) return;
3087
3962
  json.type = "object";
3088
3963
  json.properties = {};
3089
- const shape = def.shape;
3090
- for (const key in shape) json.properties[key] = process(shape[key], ctx, {
3964
+ for (const key in shape) assignProp(json.properties, key, process(shape[key], ctx, {
3091
3965
  ...params,
3092
3966
  path: [
3093
3967
  ...params.path,
3094
3968
  "properties",
3095
3969
  key
3096
3970
  ]
3097
- });
3971
+ }));
3098
3972
  const allKeys = new Set(Object.keys(shape));
3099
3973
  const requiredKeys = new Set([...allKeys].filter((key) => {
3100
- const v = def.shape[key]._zod;
3101
- if (ctx.io === "input") return v.optin === void 0;
3102
- else return v.optout === void 0;
3974
+ const field = def.shape[key];
3975
+ if (ctx.io === "input") return inputOptin(field) === void 0;
3976
+ else return field._zod.optout === void 0;
3103
3977
  }));
3104
3978
  if (requiredKeys.size > 0) json.required = Array.from(requiredKeys);
3105
3979
  if (def.catchall?._zod.def.type === "never") json.additionalProperties = false;
@@ -3143,7 +4017,9 @@ const intersectionProcessor = (schema, ctx, json, params) => {
3143
4017
  ]
3144
4018
  });
3145
4019
  const isSimpleIntersection = (val) => "allOf" in val && Object.keys(val).length === 1;
3146
- json.allOf = [...isSimpleIntersection(a) ? a.allOf : [a], ...isSimpleIntersection(b) ? b.allOf : [b]];
4020
+ const allOf = [...isSimpleIntersection(a) ? a.allOf : [a], ...isSimpleIntersection(b) ? b.allOf : [b]];
4021
+ json.allOf = allOf;
4022
+ ctx.intersections.push(allOf);
3147
4023
  };
3148
4024
  const nullableProcessor = (schema, ctx, json, params) => {
3149
4025
  const def = schema._zod.def;
@@ -3160,19 +4036,37 @@ const nonoptionalProcessor = (schema, ctx, _json, params) => {
3160
4036
  const seen = ctx.seen.get(schema);
3161
4037
  seen.ref = def.innerType;
3162
4038
  };
4039
+ /** Round-trips a default value through JSON so the emitted schema is guaranteed to be valid JSON.
4040
+ * A BigInt has no reliable encoding, so it goes through `unrepresentable` like any other
4041
+ * unrepresentable value. Returns a sentinel when the caller must not write a default of its own. */
4042
+ const UNREPRESENTABLE_DEFAULT = Symbol();
4043
+ function serializeDefaultValue(value, schema, ctx, json, params) {
4044
+ let unrepresentable = false;
4045
+ const serialized = JSON.stringify(value, (_, val) => {
4046
+ if (typeof val !== "bigint") return val;
4047
+ unrepresentable = true;
4048
+ return null;
4049
+ });
4050
+ if (!unrepresentable) return JSON.parse(serialized);
4051
+ handleUnrepresentable(schema, ctx, json, params, "BigInt defaults cannot be represented in JSON Schema");
4052
+ return UNREPRESENTABLE_DEFAULT;
4053
+ }
3163
4054
  const defaultProcessor = (schema, ctx, json, params) => {
3164
4055
  const def = schema._zod.def;
3165
4056
  process(def.innerType, ctx, params);
3166
4057
  const seen = ctx.seen.get(schema);
3167
4058
  seen.ref = def.innerType;
3168
- json.default = JSON.parse(JSON.stringify(def.defaultValue));
4059
+ const value = serializeDefaultValue(def.defaultValue, schema, ctx, json, params);
4060
+ if (value !== UNREPRESENTABLE_DEFAULT) json.default = value;
3169
4061
  };
3170
4062
  const prefaultProcessor = (schema, ctx, json, params) => {
3171
4063
  const def = schema._zod.def;
3172
4064
  process(def.innerType, ctx, params);
3173
4065
  const seen = ctx.seen.get(schema);
3174
4066
  seen.ref = def.innerType;
3175
- if (ctx.io === "input") json._prefault = JSON.parse(JSON.stringify(def.defaultValue));
4067
+ if (ctx.io !== "input") return;
4068
+ const value = serializeDefaultValue(def.defaultValue, schema, ctx, json, params);
4069
+ if (value !== UNREPRESENTABLE_DEFAULT) json._prefault = value;
3176
4070
  };
3177
4071
  const catchProcessor = (schema, ctx, json, params) => {
3178
4072
  const def = schema._zod.def;
@@ -3183,7 +4077,8 @@ const catchProcessor = (schema, ctx, json, params) => {
3183
4077
  try {
3184
4078
  catchValue = def.catchValue(void 0);
3185
4079
  } catch {
3186
- throw new Error("Dynamic catch values are not supported in JSON Schema");
4080
+ handleUnrepresentable(schema, ctx, json, params, "Dynamic catch values are not supported in JSON Schema");
4081
+ return;
3187
4082
  }
3188
4083
  json.default = catchValue;
3189
4084
  };
@@ -3209,59 +4104,57 @@ const optionalProcessor = (schema, ctx, _json, params) => {
3209
4104
  seen.ref = def.innerType;
3210
4105
  };
3211
4106
  //#endregion
3212
- //#region node_modules/.pnpm/zod@4.4.3/node_modules/zod/v4/classic/iso.js
3213
- const ZodISODateTime = /*@__PURE__*/ $constructor("ZodISODateTime", (inst, def) => {
3214
- $ZodISODateTime.init(inst, def);
3215
- ZodStringFormat.init(inst, def);
3216
- });
3217
- function datetime(params) {
3218
- return /* @__PURE__ */ _isoDateTime(ZodISODateTime, params);
3219
- }
3220
- const ZodISODate = /*@__PURE__*/ $constructor("ZodISODate", (inst, def) => {
3221
- $ZodISODate.init(inst, def);
3222
- ZodStringFormat.init(inst, def);
3223
- });
3224
- function date(params) {
3225
- return /* @__PURE__ */ _isoDate(ZodISODate, params);
3226
- }
3227
- const ZodISOTime = /*@__PURE__*/ $constructor("ZodISOTime", (inst, def) => {
3228
- $ZodISOTime.init(inst, def);
3229
- ZodStringFormat.init(inst, def);
3230
- });
3231
- function time(params) {
3232
- return /* @__PURE__ */ _isoTime(ZodISOTime, params);
3233
- }
3234
- const ZodISODuration = /*@__PURE__*/ $constructor("ZodISODuration", (inst, def) => {
3235
- $ZodISODuration.init(inst, def);
3236
- ZodStringFormat.init(inst, def);
3237
- });
3238
- function duration(params) {
3239
- return /* @__PURE__ */ _isoDuration(ZodISODuration, params);
4107
+ //#region node_modules/.pnpm/zod@4.5.4/node_modules/zod/v4/classic/errors.js
4108
+ const _installedErrorProtos = /* @__PURE__ */ new WeakSet([Object.prototype, Error.prototype]);
4109
+ function _lazyMethod(proto, key, make) {
4110
+ Object.defineProperty(proto, key, {
4111
+ configurable: true,
4112
+ enumerable: false,
4113
+ get() {
4114
+ const value = make(this);
4115
+ Object.defineProperty(this, key, {
4116
+ value,
4117
+ configurable: true,
4118
+ writable: true
4119
+ });
4120
+ return value;
4121
+ },
4122
+ set(value) {
4123
+ Object.defineProperty(this, key, {
4124
+ value,
4125
+ configurable: true,
4126
+ writable: true
4127
+ });
4128
+ }
4129
+ });
3240
4130
  }
3241
- //#endregion
3242
- //#region node_modules/.pnpm/zod@4.4.3/node_modules/zod/v4/classic/errors.js
3243
4131
  const initializer = (inst, issues) => {
3244
4132
  $ZodError.init(inst, issues);
3245
4133
  inst.name = "ZodError";
3246
- Object.defineProperties(inst, {
3247
- format: { value: (mapper) => formatError(inst, mapper) },
3248
- flatten: { value: (mapper) => flattenError(inst, mapper) },
3249
- addIssue: { value: (issue) => {
3250
- inst.issues.push(issue);
3251
- inst.message = JSON.stringify(inst.issues, jsonStringifyReplacer, 2);
3252
- } },
3253
- addIssues: { value: (issues) => {
3254
- inst.issues.push(...issues);
3255
- inst.message = JSON.stringify(inst.issues, jsonStringifyReplacer, 2);
3256
- } },
3257
- isEmpty: { get() {
3258
- return inst.issues.length === 0;
3259
- } }
4134
+ const proto = Object.getPrototypeOf(inst);
4135
+ if (_installedErrorProtos.has(proto)) return;
4136
+ _installedErrorProtos.add(proto);
4137
+ _lazyMethod(proto, "format", (self) => (mapper) => formatError(self, mapper));
4138
+ _lazyMethod(proto, "flatten", (self) => (mapper) => flattenError(self, mapper));
4139
+ _lazyMethod(proto, "addIssue", (self) => (issue) => {
4140
+ self.issues.push(issue);
4141
+ self.message = JSON.stringify(self.issues, jsonStringifyReplacer, 2);
4142
+ });
4143
+ _lazyMethod(proto, "addIssues", (self) => (issues) => {
4144
+ self.issues.push(...issues);
4145
+ self.message = JSON.stringify(self.issues, jsonStringifyReplacer, 2);
4146
+ });
4147
+ Object.defineProperty(proto, "isEmpty", {
4148
+ configurable: true,
4149
+ enumerable: false,
4150
+ get() {
4151
+ return this.issues.length === 0;
4152
+ }
3260
4153
  });
3261
4154
  };
3262
- const ZodRealError = /*@__PURE__*/ $constructor("ZodError", initializer, { Parent: Error });
4155
+ const ZodRealError = /*@__PURE__*/ $constructor("ZodError", initializer, void 0, { Parent: Error });
3263
4156
  //#endregion
3264
- //#region node_modules/.pnpm/zod@4.4.3/node_modules/zod/v4/classic/parse.js
4157
+ //#region node_modules/.pnpm/zod@4.5.4/node_modules/zod/v4/classic/parse.js
3265
4158
  const parse = /* @__PURE__ */ _parse(ZodRealError);
3266
4159
  const parseAsync = /* @__PURE__ */ _parseAsync(ZodRealError);
3267
4160
  const safeParse = /* @__PURE__ */ _safeParse(ZodRealError);
@@ -3275,167 +4168,175 @@ const safeDecode = /* @__PURE__ */ _safeDecode(ZodRealError);
3275
4168
  const safeEncodeAsync = /* @__PURE__ */ _safeEncodeAsync(ZodRealError);
3276
4169
  const safeDecodeAsync = /* @__PURE__ */ _safeDecodeAsync(ZodRealError);
3277
4170
  //#endregion
3278
- //#region node_modules/.pnpm/zod@4.4.3/node_modules/zod/v4/classic/schemas.js
3279
- const _installedGroups = /* @__PURE__ */ new WeakMap();
3280
- function _installLazyMethods(inst, group, methods) {
3281
- const proto = Object.getPrototypeOf(inst);
3282
- let installed = _installedGroups.get(proto);
3283
- if (!installed) {
3284
- installed = /* @__PURE__ */ new Set();
3285
- _installedGroups.set(proto, installed);
3286
- }
3287
- if (installed.has(group)) return;
3288
- installed.add(group);
3289
- for (const key in methods) {
3290
- const fn = methods[key];
3291
- Object.defineProperty(proto, key, {
3292
- configurable: true,
3293
- enumerable: false,
3294
- get() {
3295
- const bound = fn.bind(this);
3296
- Object.defineProperty(this, key, {
3297
- configurable: true,
3298
- writable: true,
3299
- enumerable: true,
3300
- value: bound
3301
- });
3302
- return bound;
3303
- },
3304
- set(v) {
3305
- Object.defineProperty(this, key, {
3306
- configurable: true,
3307
- writable: true,
3308
- enumerable: true,
3309
- value: v
3310
- });
3311
- }
3312
- });
3313
- }
4171
+ //#region node_modules/.pnpm/zod@4.5.4/node_modules/zod/v4/classic/schemas.js
4172
+ function _ensureDefaultLocale() {
4173
+ if (!globalConfig.localeError) config(en_default());
4174
+ }
4175
+ function _ensureDefaultMemoizer() {
4176
+ if (!globalConfig.memoizer) config({ memoizer: memoizer() });
3314
4177
  }
3315
4178
  const ZodType = /*@__PURE__*/ $constructor("ZodType", (inst, def) => {
4179
+ _ensureDefaultLocale();
3316
4180
  $ZodType.init(inst, def);
3317
- Object.assign(inst["~standard"], { jsonSchema: {
3318
- input: createStandardJSONSchemaMethod(inst, "input"),
3319
- output: createStandardJSONSchemaMethod(inst, "output")
3320
- } });
3321
- inst.toJSONSchema = createToJSONSchemaMethod(inst, {});
3322
4181
  inst.def = def;
3323
4182
  inst.type = def.type;
3324
- Object.defineProperty(inst, "_def", { value: def });
3325
- inst.parse = (data, params) => parse(inst, data, params, { callee: inst.parse });
3326
- inst.safeParse = (data, params) => safeParse(inst, data, params);
3327
- inst.parseAsync = async (data, params) => parseAsync(inst, data, params, { callee: inst.parseAsync });
3328
- inst.safeParseAsync = async (data, params) => safeParseAsync(inst, data, params);
3329
- inst.spa = inst.safeParseAsync;
3330
- inst.encode = (data, params) => encode(inst, data, params);
3331
- inst.decode = (data, params) => decode(inst, data, params);
3332
- inst.encodeAsync = async (data, params) => encodeAsync(inst, data, params);
3333
- inst.decodeAsync = async (data, params) => decodeAsync(inst, data, params);
3334
- inst.safeEncode = (data, params) => safeEncode(inst, data, params);
3335
- inst.safeDecode = (data, params) => safeDecode(inst, data, params);
3336
- inst.safeEncodeAsync = async (data, params) => safeEncodeAsync(inst, data, params);
3337
- inst.safeDecodeAsync = async (data, params) => safeDecodeAsync(inst, data, params);
3338
- _installLazyMethods(inst, "ZodType", {
3339
- check(...chks) {
3340
- const def = this.def;
3341
- return this.clone(mergeDefs(def, { checks: [...def.checks ?? [], ...chks.map((ch) => typeof ch === "function" ? { _zod: {
3342
- check: ch,
3343
- def: { check: "custom" },
3344
- onattach: []
3345
- } } : ch)] }), { parent: true });
3346
- },
3347
- with(...chks) {
3348
- return this.check(...chks);
3349
- },
3350
- clone(def, params) {
3351
- return clone(this, def, params);
3352
- },
3353
- brand() {
3354
- return this;
3355
- },
3356
- register(reg, meta) {
3357
- reg.add(this, meta);
3358
- return this;
3359
- },
3360
- refine(check, params) {
3361
- return this.check(refine(check, params));
3362
- },
3363
- superRefine(refinement, params) {
3364
- return this.check(superRefine(refinement, params));
3365
- },
3366
- overwrite(fn) {
3367
- return this.check(/* @__PURE__ */ _overwrite(fn));
3368
- },
3369
- optional() {
3370
- return optional(this);
3371
- },
3372
- exactOptional() {
3373
- return exactOptional(this);
3374
- },
3375
- nullable() {
3376
- return nullable(this);
3377
- },
3378
- nullish() {
3379
- return optional(nullable(this));
3380
- },
3381
- nonoptional(params) {
3382
- return nonoptional(this, params);
3383
- },
3384
- array() {
3385
- return array(this);
3386
- },
3387
- or(arg) {
3388
- return union([this, arg]);
3389
- },
3390
- and(arg) {
3391
- return intersection(this, arg);
3392
- },
3393
- transform(tx) {
3394
- return pipe(this, transform(tx));
3395
- },
3396
- default(d) {
3397
- return _default(this, d);
3398
- },
3399
- prefault(d) {
3400
- return prefault(this, d);
3401
- },
3402
- catch(params) {
3403
- return _catch(this, params);
3404
- },
3405
- pipe(target) {
3406
- return pipe(this, target);
3407
- },
3408
- readonly() {
3409
- return readonly(this);
3410
- },
3411
- describe(description) {
3412
- const cl = this.clone();
3413
- globalRegistry.add(cl, { description });
3414
- return cl;
3415
- },
3416
- meta(...args) {
3417
- if (args.length === 0) return globalRegistry.get(this);
3418
- const cl = this.clone();
3419
- globalRegistry.add(cl, args[0]);
3420
- return cl;
3421
- },
3422
- isOptional() {
3423
- return this.safeParse(void 0).success;
3424
- },
3425
- isNullable() {
3426
- return this.safeParse(null).success;
3427
- },
3428
- apply(fn) {
3429
- return fn(this);
3430
- }
3431
- });
3432
- Object.defineProperty(inst, "description", {
3433
- get() {
3434
- return globalRegistry.get(inst)?.description;
3435
- },
3436
- configurable: true
3437
- });
3438
4183
  return inst;
4184
+ }, {
4185
+ check(...chks) {
4186
+ const def = this.def;
4187
+ return this.clone(mergeDefs(def, { checks: [...def.checks ?? [], ...chks.map((ch) => typeof ch === "function" ? { _zod: {
4188
+ check: ch,
4189
+ def: { check: "custom" },
4190
+ onattach: []
4191
+ } } : ch)] }), { parent: true });
4192
+ },
4193
+ with(...chks) {
4194
+ return this.check(...chks);
4195
+ },
4196
+ clone(def, params) {
4197
+ return clone(this, def, params);
4198
+ },
4199
+ brand() {
4200
+ return this;
4201
+ },
4202
+ register(reg, meta) {
4203
+ reg.add(this, meta);
4204
+ return this;
4205
+ },
4206
+ refine(check, params) {
4207
+ return this.check(refine(check, params));
4208
+ },
4209
+ superRefine(refinement, params) {
4210
+ return this.check(superRefine(refinement, params));
4211
+ },
4212
+ overwrite(fn) {
4213
+ return this.check(/* @__PURE__ */ _overwrite(fn));
4214
+ },
4215
+ optional() {
4216
+ return optional(this);
4217
+ },
4218
+ exactOptional() {
4219
+ return exactOptional(this);
4220
+ },
4221
+ nullable() {
4222
+ return nullable(this);
4223
+ },
4224
+ nullish() {
4225
+ return optional(nullable(this));
4226
+ },
4227
+ nonoptional(params) {
4228
+ return nonoptional(this, params);
4229
+ },
4230
+ array() {
4231
+ return array(this);
4232
+ },
4233
+ or(arg) {
4234
+ return union([this, arg]);
4235
+ },
4236
+ and(arg) {
4237
+ return intersection(this, arg);
4238
+ },
4239
+ transform(tx) {
4240
+ return pipe(this, transform(tx));
4241
+ },
4242
+ default(d) {
4243
+ return _default(this, d);
4244
+ },
4245
+ prefault(d) {
4246
+ return prefault(this, d);
4247
+ },
4248
+ catch(params) {
4249
+ return _catch(this, params);
4250
+ },
4251
+ pipe(target) {
4252
+ return pipe(this, target);
4253
+ },
4254
+ readonly() {
4255
+ return readonly(this);
4256
+ },
4257
+ describe(description) {
4258
+ const cl = this.clone();
4259
+ globalRegistry.add(cl, { description });
4260
+ return cl;
4261
+ },
4262
+ meta(...args) {
4263
+ if (args.length === 0) return globalRegistry.get(this);
4264
+ const cl = this.clone();
4265
+ globalRegistry.add(cl, args[0]);
4266
+ return cl;
4267
+ },
4268
+ isOptional() {
4269
+ return this.safeParse(void 0).success;
4270
+ },
4271
+ isNullable() {
4272
+ return this.safeParse(null).success;
4273
+ },
4274
+ apply(fn, ...args) {
4275
+ return args.length === 0 ? fn(this) : fn(this, ...args);
4276
+ },
4277
+ get "~standard"() {
4278
+ return hide(this, "~standard", {
4279
+ ...standardProps(this),
4280
+ jsonSchema: {
4281
+ input: createStandardJSONSchemaMethod(this, "input"),
4282
+ output: createStandardJSONSchemaMethod(this, "output")
4283
+ }
4284
+ });
4285
+ },
4286
+ set "~standard"(value) {
4287
+ own(this, "~standard", value);
4288
+ },
4289
+ parse: function _parse(data, params) {
4290
+ return parse(this, data, params, { callee: _parse });
4291
+ },
4292
+ parseAsync: async function _parseAsync(data, params) {
4293
+ return await parseAsync(this, data, params, { callee: _parseAsync });
4294
+ },
4295
+ safeParse(data, params) {
4296
+ return safeParse(this, data, params);
4297
+ },
4298
+ async safeParseAsync(data, params) {
4299
+ return safeParseAsync(this, data, params);
4300
+ },
4301
+ get spa() {
4302
+ return this?.safeParseAsync;
4303
+ },
4304
+ set spa(value) {
4305
+ own(this, "spa", value);
4306
+ },
4307
+ encode: function _encode(data, params) {
4308
+ return encode(this, data, params, { callee: _encode });
4309
+ },
4310
+ decode: function _decode(data, params) {
4311
+ return decode(this, data, params, { callee: _decode });
4312
+ },
4313
+ encodeAsync: async function _encodeAsync(data, params) {
4314
+ return await encodeAsync(this, data, params, { callee: _encodeAsync });
4315
+ },
4316
+ decodeAsync: async function _decodeAsync(data, params) {
4317
+ return await decodeAsync(this, data, params, { callee: _decodeAsync });
4318
+ },
4319
+ safeEncode(data, params) {
4320
+ return safeEncode(this, data, params);
4321
+ },
4322
+ safeDecode(data, params) {
4323
+ return safeDecode(this, data, params);
4324
+ },
4325
+ async safeEncodeAsync(data, params) {
4326
+ return safeEncodeAsync(this, data, params);
4327
+ },
4328
+ async safeDecodeAsync(data, params) {
4329
+ return safeDecodeAsync(this, data, params);
4330
+ },
4331
+ toJSONSchema(params) {
4332
+ return createToJSONSchemaMethod(this, {})(params);
4333
+ },
4334
+ get description() {
4335
+ return globalRegistry.get(this)?.description;
4336
+ },
4337
+ get _def() {
4338
+ return this._zod.def;
4339
+ }
3439
4340
  });
3440
4341
  /** @internal */
3441
4342
  const _ZodString = /*@__PURE__*/ $constructor("_ZodString", (inst, def) => {
@@ -3446,84 +4347,135 @@ const _ZodString = /*@__PURE__*/ $constructor("_ZodString", (inst, def) => {
3446
4347
  inst.format = bag.format ?? null;
3447
4348
  inst.minLength = bag.minimum ?? null;
3448
4349
  inst.maxLength = bag.maximum ?? null;
3449
- _installLazyMethods(inst, "_ZodString", {
3450
- regex(...args) {
3451
- return this.check(/* @__PURE__ */ _regex(...args));
3452
- },
3453
- includes(...args) {
3454
- return this.check(/* @__PURE__ */ _includes(...args));
3455
- },
3456
- startsWith(...args) {
3457
- return this.check(/* @__PURE__ */ _startsWith(...args));
3458
- },
3459
- endsWith(...args) {
3460
- return this.check(/* @__PURE__ */ _endsWith(...args));
3461
- },
3462
- min(...args) {
3463
- return this.check(/* @__PURE__ */ _minLength(...args));
3464
- },
3465
- max(...args) {
3466
- return this.check(/* @__PURE__ */ _maxLength(...args));
3467
- },
3468
- length(...args) {
3469
- return this.check(/* @__PURE__ */ _length(...args));
3470
- },
3471
- nonempty(...args) {
3472
- return this.check(/* @__PURE__ */ _minLength(1, ...args));
3473
- },
3474
- lowercase(params) {
3475
- return this.check(/* @__PURE__ */ _lowercase(params));
3476
- },
3477
- uppercase(params) {
3478
- return this.check(/* @__PURE__ */ _uppercase(params));
3479
- },
3480
- trim() {
3481
- return this.check(/* @__PURE__ */ _trim());
3482
- },
3483
- normalize(...args) {
3484
- return this.check(/* @__PURE__ */ _normalize(...args));
3485
- },
3486
- toLowerCase() {
3487
- return this.check(/* @__PURE__ */ _toLowerCase());
3488
- },
3489
- toUpperCase() {
3490
- return this.check(/* @__PURE__ */ _toUpperCase());
3491
- },
3492
- slugify() {
3493
- return this.check(/* @__PURE__ */ _slugify());
3494
- }
3495
- });
4350
+ }, {
4351
+ regex(...args) {
4352
+ return this.check(/* @__PURE__ */ _regex(...args));
4353
+ },
4354
+ includes(...args) {
4355
+ return this.check(/* @__PURE__ */ _includes(...args));
4356
+ },
4357
+ startsWith(...args) {
4358
+ return this.check(/* @__PURE__ */ _startsWith(...args));
4359
+ },
4360
+ endsWith(...args) {
4361
+ return this.check(/* @__PURE__ */ _endsWith(...args));
4362
+ },
4363
+ min(...args) {
4364
+ return this.check(/* @__PURE__ */ _minLength(...args));
4365
+ },
4366
+ max(...args) {
4367
+ return this.check(/* @__PURE__ */ _maxLength(...args));
4368
+ },
4369
+ length(...args) {
4370
+ return this.check(/* @__PURE__ */ _length(...args));
4371
+ },
4372
+ nonempty(...args) {
4373
+ return this.check(/* @__PURE__ */ _minLength(1, ...args));
4374
+ },
4375
+ lowercase(params) {
4376
+ return this.check(/* @__PURE__ */ _lowercase(params));
4377
+ },
4378
+ uppercase(params) {
4379
+ return this.check(/* @__PURE__ */ _uppercase(params));
4380
+ },
4381
+ trim() {
4382
+ return this.check(/* @__PURE__ */ _trim());
4383
+ },
4384
+ normalize(...args) {
4385
+ return this.check(/* @__PURE__ */ _normalize(...args));
4386
+ },
4387
+ toLowerCase() {
4388
+ return this.check(/* @__PURE__ */ _toLowerCase());
4389
+ },
4390
+ toUpperCase() {
4391
+ return this.check(/* @__PURE__ */ _toUpperCase());
4392
+ },
4393
+ slugify() {
4394
+ return this.check(/* @__PURE__ */ _slugify());
4395
+ }
3496
4396
  });
3497
4397
  const ZodString = /*@__PURE__*/ $constructor("ZodString", (inst, def) => {
3498
4398
  $ZodString.init(inst, def);
3499
4399
  _ZodString.init(inst, def);
3500
- inst.email = (params) => inst.check(/* @__PURE__ */ _email(ZodEmail, params));
3501
- inst.url = (params) => inst.check(/* @__PURE__ */ _url(ZodURL, params));
3502
- inst.jwt = (params) => inst.check(/* @__PURE__ */ _jwt(ZodJWT, params));
3503
- inst.emoji = (params) => inst.check(/* @__PURE__ */ _emoji(ZodEmoji, params));
3504
- inst.guid = (params) => inst.check(/* @__PURE__ */ _guid(ZodGUID, params));
3505
- inst.uuid = (params) => inst.check(/* @__PURE__ */ _uuid(ZodUUID, params));
3506
- inst.uuidv4 = (params) => inst.check(/* @__PURE__ */ _uuidv4(ZodUUID, params));
3507
- inst.uuidv6 = (params) => inst.check(/* @__PURE__ */ _uuidv6(ZodUUID, params));
3508
- inst.uuidv7 = (params) => inst.check(/* @__PURE__ */ _uuidv7(ZodUUID, params));
3509
- inst.nanoid = (params) => inst.check(/* @__PURE__ */ _nanoid(ZodNanoID, params));
3510
- inst.guid = (params) => inst.check(/* @__PURE__ */ _guid(ZodGUID, params));
3511
- inst.cuid = (params) => inst.check(/* @__PURE__ */ _cuid(ZodCUID, params));
3512
- inst.cuid2 = (params) => inst.check(/* @__PURE__ */ _cuid2(ZodCUID2, params));
3513
- inst.ulid = (params) => inst.check(/* @__PURE__ */ _ulid(ZodULID, params));
3514
- inst.base64 = (params) => inst.check(/* @__PURE__ */ _base64(ZodBase64, params));
3515
- inst.base64url = (params) => inst.check(/* @__PURE__ */ _base64url(ZodBase64URL, params));
3516
- inst.xid = (params) => inst.check(/* @__PURE__ */ _xid(ZodXID, params));
3517
- inst.ksuid = (params) => inst.check(/* @__PURE__ */ _ksuid(ZodKSUID, params));
3518
- inst.ipv4 = (params) => inst.check(/* @__PURE__ */ _ipv4(ZodIPv4, params));
3519
- inst.ipv6 = (params) => inst.check(/* @__PURE__ */ _ipv6(ZodIPv6, params));
3520
- inst.cidrv4 = (params) => inst.check(/* @__PURE__ */ _cidrv4(ZodCIDRv4, params));
3521
- inst.cidrv6 = (params) => inst.check(/* @__PURE__ */ _cidrv6(ZodCIDRv6, params));
3522
- inst.e164 = (params) => inst.check(/* @__PURE__ */ _e164(ZodE164, params));
3523
- inst.datetime = (params) => inst.check(datetime(params));
3524
- inst.date = (params) => inst.check(date(params));
3525
- inst.time = (params) => inst.check(time(params));
3526
- inst.duration = (params) => inst.check(duration(params));
4400
+ }, {
4401
+ email(params) {
4402
+ return this.check(/* @__PURE__ */ _email(ZodEmail, params));
4403
+ },
4404
+ url(params) {
4405
+ return this.check(/* @__PURE__ */ _url(ZodURL, params));
4406
+ },
4407
+ jwt(params) {
4408
+ return this.check(/* @__PURE__ */ _jwt(ZodJWT, params));
4409
+ },
4410
+ emoji(params) {
4411
+ return this.check(/* @__PURE__ */ _emoji(ZodEmoji, params));
4412
+ },
4413
+ guid(params) {
4414
+ return this.check(/* @__PURE__ */ _guid(ZodGUID, params));
4415
+ },
4416
+ uuid(params) {
4417
+ return this.check(/* @__PURE__ */ _uuid(ZodUUID, params));
4418
+ },
4419
+ uuidv4(params) {
4420
+ return this.check(/* @__PURE__ */ _uuidv4(ZodUUID, params));
4421
+ },
4422
+ uuidv6(params) {
4423
+ return this.check(/* @__PURE__ */ _uuidv6(ZodUUID, params));
4424
+ },
4425
+ uuidv7(params) {
4426
+ return this.check(/* @__PURE__ */ _uuidv7(ZodUUID, params));
4427
+ },
4428
+ nanoid(params) {
4429
+ return this.check(/* @__PURE__ */ _nanoid(ZodNanoID, params));
4430
+ },
4431
+ cuid(params) {
4432
+ return this.check(/* @__PURE__ */ _cuid(ZodCUID, params));
4433
+ },
4434
+ cuid2(params) {
4435
+ return this.check(/* @__PURE__ */ _cuid2(ZodCUID2, params));
4436
+ },
4437
+ ulid(params) {
4438
+ return this.check(/* @__PURE__ */ _ulid(ZodULID, params));
4439
+ },
4440
+ base64(params) {
4441
+ return this.check(/* @__PURE__ */ _base64(ZodBase64, params));
4442
+ },
4443
+ base64url(params) {
4444
+ return this.check(/* @__PURE__ */ _base64url(ZodBase64URL, params));
4445
+ },
4446
+ xid(params) {
4447
+ return this.check(/* @__PURE__ */ _xid(ZodXID, params));
4448
+ },
4449
+ ksuid(params) {
4450
+ return this.check(/* @__PURE__ */ _ksuid(ZodKSUID, params));
4451
+ },
4452
+ ipv4(params) {
4453
+ return this.check(/* @__PURE__ */ _ipv4(ZodIPv4, params));
4454
+ },
4455
+ ipv6(params) {
4456
+ return this.check(/* @__PURE__ */ _ipv6(ZodIPv6, params));
4457
+ },
4458
+ cidrv4(params) {
4459
+ return this.check(/* @__PURE__ */ _cidrv4(ZodCIDRv4, params));
4460
+ },
4461
+ cidrv6(params) {
4462
+ return this.check(/* @__PURE__ */ _cidrv6(ZodCIDRv6, params));
4463
+ },
4464
+ e164(params) {
4465
+ return this.check(/* @__PURE__ */ _e164(ZodE164, params));
4466
+ },
4467
+ datetime(params) {
4468
+ return this.check(/* @__PURE__ */ _isoDateTime(ZodISODateTime, params));
4469
+ },
4470
+ date(params) {
4471
+ return this.check(/* @__PURE__ */ _isoDate(ZodISODate, params));
4472
+ },
4473
+ time(params) {
4474
+ return this.check(/* @__PURE__ */ _isoTime(ZodISOTime, params));
4475
+ },
4476
+ duration(params) {
4477
+ return this.check(/* @__PURE__ */ _isoDuration(ZodISODuration, params));
4478
+ }
3527
4479
  });
3528
4480
  function string(params) {
3529
4481
  return /* @__PURE__ */ _string(ZodString, params);
@@ -3532,6 +4484,22 @@ const ZodStringFormat = /*@__PURE__*/ $constructor("ZodStringFormat", (inst, def
3532
4484
  $ZodStringFormat.init(inst, def);
3533
4485
  _ZodString.init(inst, def);
3534
4486
  });
4487
+ const ZodISODateTime = /*@__PURE__*/ $constructor("ZodISODateTime", (inst, def) => {
4488
+ $ZodISODateTime.init(inst, def);
4489
+ ZodStringFormat.init(inst, def);
4490
+ });
4491
+ const ZodISODate = /*@__PURE__*/ $constructor("ZodISODate", (inst, def) => {
4492
+ $ZodISODate.init(inst, def);
4493
+ ZodStringFormat.init(inst, def);
4494
+ });
4495
+ const ZodISOTime = /*@__PURE__*/ $constructor("ZodISOTime", (inst, def) => {
4496
+ $ZodISOTime.init(inst, def);
4497
+ ZodStringFormat.init(inst, def);
4498
+ });
4499
+ const ZodISODuration = /*@__PURE__*/ $constructor("ZodISODuration", (inst, def) => {
4500
+ $ZodISODuration.init(inst, def);
4501
+ ZodStringFormat.init(inst, def);
4502
+ });
3535
4503
  const ZodEmail = /*@__PURE__*/ $constructor("ZodEmail", (inst, def) => {
3536
4504
  $ZodEmail.init(inst, def);
3537
4505
  ZodStringFormat.init(inst, def);
@@ -3617,59 +4585,58 @@ const ZodNumber = /*@__PURE__*/ $constructor("ZodNumber", (inst, def) => {
3617
4585
  $ZodNumber.init(inst, def);
3618
4586
  ZodType.init(inst, def);
3619
4587
  inst._zod.processJSONSchema = (ctx, json, params) => numberProcessor(inst, ctx, json, params);
3620
- _installLazyMethods(inst, "ZodNumber", {
3621
- gt(value, params) {
3622
- return this.check(/* @__PURE__ */ _gt(value, params));
3623
- },
3624
- gte(value, params) {
3625
- return this.check(/* @__PURE__ */ _gte(value, params));
3626
- },
3627
- min(value, params) {
3628
- return this.check(/* @__PURE__ */ _gte(value, params));
3629
- },
3630
- lt(value, params) {
3631
- return this.check(/* @__PURE__ */ _lt(value, params));
3632
- },
3633
- lte(value, params) {
3634
- return this.check(/* @__PURE__ */ _lte(value, params));
3635
- },
3636
- max(value, params) {
3637
- return this.check(/* @__PURE__ */ _lte(value, params));
3638
- },
3639
- int(params) {
3640
- return this.check(int(params));
3641
- },
3642
- safe(params) {
3643
- return this.check(int(params));
3644
- },
3645
- positive(params) {
3646
- return this.check(/* @__PURE__ */ _gt(0, params));
3647
- },
3648
- nonnegative(params) {
3649
- return this.check(/* @__PURE__ */ _gte(0, params));
3650
- },
3651
- negative(params) {
3652
- return this.check(/* @__PURE__ */ _lt(0, params));
3653
- },
3654
- nonpositive(params) {
3655
- return this.check(/* @__PURE__ */ _lte(0, params));
3656
- },
3657
- multipleOf(value, params) {
3658
- return this.check(/* @__PURE__ */ _multipleOf(value, params));
3659
- },
3660
- step(value, params) {
3661
- return this.check(/* @__PURE__ */ _multipleOf(value, params));
3662
- },
3663
- finite() {
3664
- return this;
3665
- }
3666
- });
3667
4588
  const bag = inst._zod.bag;
3668
4589
  inst.minValue = Math.max(bag.minimum ?? Number.NEGATIVE_INFINITY, bag.exclusiveMinimum ?? Number.NEGATIVE_INFINITY) ?? null;
3669
4590
  inst.maxValue = Math.min(bag.maximum ?? Number.POSITIVE_INFINITY, bag.exclusiveMaximum ?? Number.POSITIVE_INFINITY) ?? null;
3670
4591
  inst.isInt = (bag.format ?? "").includes("int") || Number.isSafeInteger(bag.multipleOf ?? .5);
3671
4592
  inst.isFinite = true;
3672
4593
  inst.format = bag.format ?? null;
4594
+ }, {
4595
+ gt(value, params) {
4596
+ return this.check(/* @__PURE__ */ _gt(value, params));
4597
+ },
4598
+ gte(value, params) {
4599
+ return this.check(/* @__PURE__ */ _gte(value, params));
4600
+ },
4601
+ min(value, params) {
4602
+ return this.check(/* @__PURE__ */ _gte(value, params));
4603
+ },
4604
+ lt(value, params) {
4605
+ return this.check(/* @__PURE__ */ _lt(value, params));
4606
+ },
4607
+ lte(value, params) {
4608
+ return this.check(/* @__PURE__ */ _lte(value, params));
4609
+ },
4610
+ max(value, params) {
4611
+ return this.check(/* @__PURE__ */ _lte(value, params));
4612
+ },
4613
+ int(params) {
4614
+ return this.check(int(params));
4615
+ },
4616
+ safe(params) {
4617
+ return this.check(int(params));
4618
+ },
4619
+ positive(params) {
4620
+ return this.check(/* @__PURE__ */ _gt(0, params));
4621
+ },
4622
+ nonnegative(params) {
4623
+ return this.check(/* @__PURE__ */ _gte(0, params));
4624
+ },
4625
+ negative(params) {
4626
+ return this.check(/* @__PURE__ */ _lt(0, params));
4627
+ },
4628
+ nonpositive(params) {
4629
+ return this.check(/* @__PURE__ */ _lte(0, params));
4630
+ },
4631
+ multipleOf(value, params) {
4632
+ return this.check(/* @__PURE__ */ _multipleOf(value, params));
4633
+ },
4634
+ step(value, params) {
4635
+ return this.check(/* @__PURE__ */ _multipleOf(value, params));
4636
+ },
4637
+ finite() {
4638
+ return this;
4639
+ }
3673
4640
  });
3674
4641
  function number(params) {
3675
4642
  return /* @__PURE__ */ _number(ZodNumber, params);
@@ -3706,94 +4673,95 @@ function never(params) {
3706
4673
  return /* @__PURE__ */ _never(ZodNever, params);
3707
4674
  }
3708
4675
  const ZodArray = /*@__PURE__*/ $constructor("ZodArray", (inst, def) => {
4676
+ _ensureDefaultMemoizer();
3709
4677
  $ZodArray.init(inst, def);
3710
4678
  ZodType.init(inst, def);
3711
4679
  inst._zod.processJSONSchema = (ctx, json, params) => arrayProcessor(inst, ctx, json, params);
3712
4680
  inst.element = def.element;
3713
- _installLazyMethods(inst, "ZodArray", {
3714
- min(n, params) {
3715
- return this.check(/* @__PURE__ */ _minLength(n, params));
3716
- },
3717
- nonempty(params) {
3718
- return this.check(/* @__PURE__ */ _minLength(1, params));
3719
- },
3720
- max(n, params) {
3721
- return this.check(/* @__PURE__ */ _maxLength(n, params));
3722
- },
3723
- length(n, params) {
3724
- return this.check(/* @__PURE__ */ _length(n, params));
3725
- },
3726
- unwrap() {
3727
- return this.element;
3728
- }
3729
- });
4681
+ }, {
4682
+ min(n, params) {
4683
+ return this.check(/* @__PURE__ */ _minLength(n, params));
4684
+ },
4685
+ nonempty(params) {
4686
+ return this.check(/* @__PURE__ */ _minLength(1, params));
4687
+ },
4688
+ max(n, params) {
4689
+ return this.check(/* @__PURE__ */ _maxLength(n, params));
4690
+ },
4691
+ length(n, params) {
4692
+ return this.check(/* @__PURE__ */ _length(n, params));
4693
+ },
4694
+ unwrap() {
4695
+ return this.element;
4696
+ }
3730
4697
  });
3731
4698
  function array(element, params) {
3732
4699
  return /* @__PURE__ */ _array(ZodArray, element, params);
3733
4700
  }
3734
4701
  const ZodObject = /*@__PURE__*/ $constructor("ZodObject", (inst, def) => {
4702
+ _ensureDefaultMemoizer();
3735
4703
  $ZodObjectJIT.init(inst, def);
3736
4704
  ZodType.init(inst, def);
3737
4705
  inst._zod.processJSONSchema = (ctx, json, params) => objectProcessor(inst, ctx, json, params);
3738
- defineLazy(inst, "shape", () => {
3739
- return def.shape;
3740
- });
3741
- _installLazyMethods(inst, "ZodObject", {
3742
- keyof() {
3743
- return _enum(Object.keys(this._zod.def.shape));
3744
- },
3745
- catchall(catchall) {
3746
- return this.clone({
3747
- ...this._zod.def,
3748
- catchall
3749
- });
3750
- },
3751
- passthrough() {
3752
- return this.clone({
3753
- ...this._zod.def,
3754
- catchall: unknown()
3755
- });
3756
- },
3757
- loose() {
3758
- return this.clone({
3759
- ...this._zod.def,
3760
- catchall: unknown()
3761
- });
3762
- },
3763
- strict() {
3764
- return this.clone({
3765
- ...this._zod.def,
3766
- catchall: never()
3767
- });
3768
- },
3769
- strip() {
3770
- return this.clone({
3771
- ...this._zod.def,
3772
- catchall: void 0
3773
- });
3774
- },
3775
- extend(incoming) {
3776
- return extend(this, incoming);
3777
- },
3778
- safeExtend(incoming) {
3779
- return safeExtend(this, incoming);
3780
- },
3781
- merge(other) {
3782
- return merge(this, other);
3783
- },
3784
- pick(mask) {
3785
- return pick(this, mask);
3786
- },
3787
- omit(mask) {
3788
- return omit(this, mask);
3789
- },
3790
- partial(...args) {
3791
- return partial(ZodOptional, this, args[0]);
3792
- },
3793
- required(...args) {
3794
- return required(ZodNonOptional, this, args[0]);
3795
- }
3796
- });
4706
+ installLazyProp(inst, "shape", (self) => self._zod.def.shape, false);
4707
+ }, {
4708
+ keyof() {
4709
+ return _enum(Object.keys(this._zod.def.shape));
4710
+ },
4711
+ catchall(catchall) {
4712
+ return this.clone({
4713
+ ...this._zod.def,
4714
+ catchall
4715
+ });
4716
+ },
4717
+ passthrough() {
4718
+ return this.clone({
4719
+ ...this._zod.def,
4720
+ catchall: unknown()
4721
+ });
4722
+ },
4723
+ loose() {
4724
+ return this.clone({
4725
+ ...this._zod.def,
4726
+ catchall: unknown()
4727
+ });
4728
+ },
4729
+ strict() {
4730
+ return this.clone({
4731
+ ...this._zod.def,
4732
+ catchall: never()
4733
+ });
4734
+ },
4735
+ strip() {
4736
+ return this.clone({
4737
+ ...this._zod.def,
4738
+ catchall: void 0
4739
+ });
4740
+ },
4741
+ extend(incoming) {
4742
+ return extend(this, incoming);
4743
+ },
4744
+ safeExtend(incoming) {
4745
+ return safeExtend(this, incoming);
4746
+ },
4747
+ merge(other) {
4748
+ return merge(this, other);
4749
+ },
4750
+ pick(mask) {
4751
+ return pick(this, mask);
4752
+ },
4753
+ omit(mask) {
4754
+ return omit(this, mask);
4755
+ },
4756
+ partial(...args) {
4757
+ return partial(ZodOptional, this, args[0]);
4758
+ },
4759
+ exactPartial(...args) {
4760
+ return partial(ZodExactOptional, this, args[0], "exactPartial");
4761
+ },
4762
+ required(...args) {
4763
+ return required(ZodNonOptional, this, args[0]);
4764
+ }
3797
4765
  });
3798
4766
  function object(shape, params) {
3799
4767
  const def = {
@@ -3884,6 +4852,7 @@ function literal(value, params) {
3884
4852
  });
3885
4853
  }
3886
4854
  const ZodTransform = /*@__PURE__*/ $constructor("ZodTransform", (inst, def) => {
4855
+ _ensureDefaultMemoizer();
3887
4856
  $ZodTransform.init(inst, def);
3888
4857
  ZodType.init(inst, def);
3889
4858
  inst._zod.processJSONSchema = (ctx, json, params) => transformProcessor(inst, ctx, json, params);
@@ -3895,7 +4864,7 @@ const ZodTransform = /*@__PURE__*/ $constructor("ZodTransform", (inst, def) => {
3895
4864
  const _issue = issue$1;
3896
4865
  if (_issue.fatal) _issue.continue = false;
3897
4866
  _issue.code ?? (_issue.code = "custom");
3898
- _issue.input ?? (_issue.input = payload.value);
4867
+ if (!("input" in _issue)) _issue.input = payload.value;
3899
4868
  _issue.inst ?? (_issue.inst = inst);
3900
4869
  payload.issues.push(issue(_issue));
3901
4870
  }
@@ -3903,11 +4872,9 @@ const ZodTransform = /*@__PURE__*/ $constructor("ZodTransform", (inst, def) => {
3903
4872
  const output = def.transform(payload.value, payload);
3904
4873
  if (output instanceof Promise) return output.then((output) => {
3905
4874
  payload.value = output;
3906
- payload.fallback = true;
3907
4875
  return payload;
3908
4876
  });
3909
4877
  payload.value = output;
3910
- payload.fallback = true;
3911
4878
  return payload;
3912
4879
  };
3913
4880
  });
@@ -4008,7 +4975,7 @@ function _catch(innerType, catchValue) {
4008
4975
  return new ZodCatch({
4009
4976
  type: "catch",
4010
4977
  innerType,
4011
- catchValue: typeof catchValue === "function" ? catchValue : () => catchValue
4978
+ catchValue: typeof catchValue === "function" ? catchValue : constantCatch(catchValue)
4012
4979
  });
4013
4980
  }
4014
4981
  const ZodPipe = /*@__PURE__*/ $constructor("ZodPipe", (inst, def) => {