dsh-draw 0.2.1 → 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.
package/lib/client.js CHANGED
@@ -317,70 +317,14 @@ window.__ModuleLoader__.load({
317
317
  "tab.healthError": "最近错误"
318
318
  };
319
319
  //#endregion
320
- //#region node_modules/.pnpm/zod@4.4.3/node_modules/zod/v4/core/core.js
321
- var _a$1;
322
- function $constructor(name, initializer, params) {
323
- function init(inst, def) {
324
- if (!inst._zod) Object.defineProperty(inst, "_zod", {
325
- value: {
326
- def,
327
- constr: _,
328
- traits: /* @__PURE__ */ new Set()
329
- },
330
- enumerable: false
331
- });
332
- if (inst._zod.traits.has(name)) return;
333
- inst._zod.traits.add(name);
334
- initializer(inst, def);
335
- const proto = _.prototype;
336
- const keys = Object.keys(proto);
337
- for (let i = 0; i < keys.length; i++) {
338
- const k = keys[i];
339
- if (!(k in inst)) inst[k] = proto[k].bind(inst);
340
- }
341
- }
342
- const Parent = params?.Parent ?? Object;
343
- class Definition extends Parent {}
344
- Object.defineProperty(Definition, "name", { value: name });
345
- function _(def) {
346
- var _a;
347
- const inst = params?.Parent ? new Definition() : this;
348
- init(inst, def);
349
- (_a = inst._zod).deferred ?? (_a.deferred = []);
350
- for (const fn of inst._zod.deferred) fn();
351
- return inst;
352
- }
353
- Object.defineProperty(_, "init", { value: init });
354
- Object.defineProperty(_, Symbol.hasInstance, { value: (inst) => {
355
- if (params?.Parent && inst instanceof params.Parent) return true;
356
- return inst?._zod?.traits?.has(name);
357
- } });
358
- Object.defineProperty(_, "name", { value: name });
359
- return _;
360
- }
361
- var $ZodAsyncError = class extends Error {
362
- constructor() {
363
- super(`Encountered Promise during synchronous parse. Use .parseAsync() instead.`);
364
- }
365
- };
366
- var $ZodEncodeError = class extends Error {
367
- constructor(name) {
368
- super(`Encountered unidirectional transform during encode: ${name}`);
369
- this.name = "ZodEncodeError";
370
- }
371
- };
372
- (_a$1 = globalThis).__zod_globalConfig ?? (_a$1.__zod_globalConfig = {});
373
- const globalConfig = globalThis.__zod_globalConfig;
374
- function config(newConfig) {
375
- if (newConfig) Object.assign(globalConfig, newConfig);
376
- return globalConfig;
377
- }
378
- //#endregion
379
- //#region node_modules/.pnpm/zod@4.4.3/node_modules/zod/v4/core/util.js
320
+ //#region node_modules/.pnpm/zod@4.5.4/node_modules/zod/v4/core/util.js
380
321
  function getEnumValues(entries) {
381
322
  const numericValues = Object.values(entries).filter((v) => typeof v === "number");
382
323
  return Object.entries(entries).filter(([k, _]) => numericValues.indexOf(+k) === -1).map(([_, v]) => v);
383
324
  }
325
+ function joinValues(array, separator = "|") {
326
+ return array.map((val) => stringifyPrimitive(val)).join(separator);
327
+ }
384
328
  function jsonStringifyReplacer(_, value) {
385
329
  if (typeof value === "bigint") return value.toString();
386
330
  return value;
@@ -405,28 +349,10 @@ window.__ModuleLoader__.load({
405
349
  function floatSafeRemainder(val, step) {
406
350
  const ratio = val / step;
407
351
  const roundedRatio = Math.round(ratio);
408
- const tolerance = Number.EPSILON * Math.max(Math.abs(ratio), 1);
352
+ const tolerance = 4 * Number.EPSILON * Math.max(Math.abs(ratio), 1);
409
353
  if (Math.abs(ratio - roundedRatio) < tolerance) return 0;
410
354
  return ratio - roundedRatio;
411
355
  }
412
- const EVALUATING = /* @__PURE__*/ Symbol("evaluating");
413
- function defineLazy(object, key, getter) {
414
- let value = void 0;
415
- Object.defineProperty(object, key, {
416
- get() {
417
- if (value === EVALUATING) return;
418
- if (value === void 0) {
419
- value = EVALUATING;
420
- value = getter();
421
- }
422
- return value;
423
- },
424
- set(v) {
425
- Object.defineProperty(object, key, { value: v });
426
- },
427
- configurable: true
428
- });
429
- }
430
356
  function assignProp(target, prop, value) {
431
357
  Object.defineProperty(target, prop, {
432
358
  value,
@@ -508,18 +434,23 @@ window.__ModuleLoader__.load({
508
434
  };
509
435
  return params;
510
436
  }
437
+ function stringifyPrimitive(value) {
438
+ if (typeof value === "bigint") return value.toString() + "n";
439
+ if (typeof value === "string") return `"${value}"`;
440
+ return `${value}`;
441
+ }
511
442
  function optionalKeys(shape) {
512
443
  return Object.keys(shape).filter((k) => {
513
- return shape[k]._zod.optin === "optional" && shape[k]._zod.optout === "optional";
444
+ return shape[k]._zod.optin !== void 0 && shape[k]._zod.optout === "optional";
514
445
  });
515
446
  }
516
- const NUMBER_FORMAT_RANGES = {
447
+ const NUMBER_FORMAT_RANGES = /*@__PURE__*/ (() => ({
517
448
  safeint: [Number.MIN_SAFE_INTEGER, Number.MAX_SAFE_INTEGER],
518
449
  int32: [-2147483648, 2147483647],
519
450
  uint32: [0, 4294967295],
520
451
  float32: [-34028234663852886e22, 34028234663852886e22],
521
452
  float64: [-Number.MAX_VALUE, Number.MAX_VALUE]
522
- };
453
+ }))();
523
454
  function pick(schema, mask) {
524
455
  const currDef = schema._zod.def;
525
456
  const checks = currDef.checks;
@@ -527,10 +458,10 @@ window.__ModuleLoader__.load({
527
458
  return clone(schema, mergeDefs(schema._zod.def, {
528
459
  get shape() {
529
460
  const newShape = {};
530
- for (const key in mask) {
531
- if (!(key in currDef.shape)) throw new Error(`Unrecognized key: "${key}"`);
461
+ for (const key of Reflect.ownKeys(mask)) {
462
+ if (!Object.prototype.hasOwnProperty.call(currDef.shape, key)) throw new Error(`Unrecognized key: "${String(key)}"`);
532
463
  if (!mask[key]) continue;
533
- newShape[key] = currDef.shape[key];
464
+ assignProp(newShape, key, currDef.shape[key]);
534
465
  }
535
466
  assignProp(this, "shape", newShape);
536
467
  return newShape;
@@ -545,8 +476,8 @@ window.__ModuleLoader__.load({
545
476
  return clone(schema, mergeDefs(schema._zod.def, {
546
477
  get shape() {
547
478
  const newShape = { ...schema._zod.def.shape };
548
- for (const key in mask) {
549
- if (!(key in currDef.shape)) throw new Error(`Unrecognized key: "${key}"`);
479
+ for (const key of Reflect.ownKeys(mask)) {
480
+ if (!Object.prototype.hasOwnProperty.call(currDef.shape, key)) throw new Error(`Unrecognized key: "${String(key)}"`);
550
481
  if (!mask[key]) continue;
551
482
  delete newShape[key];
552
483
  }
@@ -561,7 +492,7 @@ window.__ModuleLoader__.load({
561
492
  const checks = schema._zod.def.checks;
562
493
  if (checks && checks.length > 0) {
563
494
  const existingShape = schema._zod.def.shape;
564
- 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.");
495
+ 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.");
565
496
  }
566
497
  return clone(schema, mergeDefs(schema._zod.def, { get shape() {
567
498
  const _shape = {
@@ -584,6 +515,7 @@ window.__ModuleLoader__.load({
584
515
  } }));
585
516
  }
586
517
  function merge(a, b) {
518
+ if (!b?._zod?.def) throw new Error("Invalid input to merge: expected an object schema. To merge a plain shape, use `.extend()`.");
587
519
  if (a._zod.def.checks?.length) throw new Error(".merge() cannot be used on object schemas containing refinements. Use .safeExtend() instead.");
588
520
  return clone(a, mergeDefs(a._zod.def, {
589
521
  get shape() {
@@ -600,22 +532,22 @@ window.__ModuleLoader__.load({
600
532
  checks: b._zod.def.checks ?? []
601
533
  }));
602
534
  }
603
- function partial(Class, schema, mask) {
535
+ function partial(Class, schema, mask, name = "partial") {
604
536
  const checks = schema._zod.def.checks;
605
- if (checks && checks.length > 0) throw new Error(".partial() cannot be used on object schemas containing refinements");
537
+ if (checks && checks.length > 0) throw new Error(`.${name}() cannot be used on object schemas containing refinements`);
606
538
  return clone(schema, mergeDefs(schema._zod.def, {
607
539
  get shape() {
608
540
  const oldShape = schema._zod.def.shape;
609
541
  const shape = { ...oldShape };
610
- if (mask) for (const key in mask) {
611
- if (!(key in oldShape)) throw new Error(`Unrecognized key: "${key}"`);
542
+ if (mask) for (const key of Reflect.ownKeys(mask)) {
543
+ if (!Object.prototype.hasOwnProperty.call(oldShape, key)) throw new Error(`Unrecognized key: "${String(key)}"`);
612
544
  if (!mask[key]) continue;
613
545
  shape[key] = Class ? new Class({
614
546
  type: "optional",
615
547
  innerType: oldShape[key]
616
548
  }) : oldShape[key];
617
549
  }
618
- else for (const key in oldShape) shape[key] = Class ? new Class({
550
+ else for (const key of Reflect.ownKeys(oldShape)) shape[key] = Class ? new Class({
619
551
  type: "optional",
620
552
  innerType: oldShape[key]
621
553
  }) : oldShape[key];
@@ -629,15 +561,15 @@ window.__ModuleLoader__.load({
629
561
  return clone(schema, mergeDefs(schema._zod.def, { get shape() {
630
562
  const oldShape = schema._zod.def.shape;
631
563
  const shape = { ...oldShape };
632
- if (mask) for (const key in mask) {
633
- if (!(key in shape)) throw new Error(`Unrecognized key: "${key}"`);
564
+ if (mask) for (const key of Reflect.ownKeys(mask)) {
565
+ if (!Object.prototype.hasOwnProperty.call(shape, key)) throw new Error(`Unrecognized key: "${String(key)}"`);
634
566
  if (!mask[key]) continue;
635
567
  shape[key] = new Class({
636
568
  type: "nonoptional",
637
569
  innerType: oldShape[key]
638
570
  });
639
571
  }
640
- else for (const key in oldShape) shape[key] = new Class({
572
+ else for (const key of Reflect.ownKeys(oldShape)) shape[key] = new Class({
641
573
  type: "nonoptional",
642
574
  innerType: oldShape[key]
643
575
  });
@@ -666,19 +598,54 @@ window.__ModuleLoader__.load({
666
598
  function unwrapMessage(message) {
667
599
  return typeof message === "string" ? message : message?.message;
668
600
  }
601
+ function attachSchema(issues, start, inst) {
602
+ var _a;
603
+ for (let i = start; i < issues.length; i++) (_a = issues[i]).schema ?? (_a.schema = inst);
604
+ }
669
605
  function finalizeIssue(iss, ctx, config) {
670
- 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";
671
- const { inst: _inst, continue: _continue, input: _input, ...rest } = iss;
606
+ var _a;
607
+ const traits = iss.inst?._zod?.traits;
608
+ if (traits?.has("$ZodType")) {
609
+ if (traits.has("$ZodCheck")) (_a = iss).schema ?? (_a.schema = iss.inst);
610
+ else iss.schema = iss.inst;
611
+ }
612
+ const schemaError = iss.schema !== iss.inst ? iss.schema?._zod.def?.error : void 0;
613
+ 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";
614
+ const { inst: _inst, schema: _schema, continue: _continue, input: _input, ...rest } = iss;
672
615
  rest.path ?? (rest.path = []);
673
616
  rest.message = message;
674
617
  if (ctx?.reportInput) rest.input = _input;
675
618
  return rest;
676
619
  }
620
+ const highSurrogate = /[\uD800-\uDBFF]/;
621
+ function codePointLength(str) {
622
+ const units = str.length;
623
+ if (!highSurrogate.test(str)) return units;
624
+ let count = units;
625
+ for (let i = 0; i < units - 1; i++) if ((str.charCodeAt(i) & 64512) === 55296 && (str.charCodeAt(i + 1) & 64512) === 56320) {
626
+ count--;
627
+ i++;
628
+ }
629
+ return count;
630
+ }
677
631
  function getLengthableOrigin(input) {
678
632
  if (Array.isArray(input)) return "array";
679
633
  if (typeof input === "string") return "string";
680
634
  return "unknown";
681
635
  }
636
+ function parsedType(data) {
637
+ const t = typeof data;
638
+ switch (t) {
639
+ case "number": return Number.isNaN(data) ? "nan" : "number";
640
+ case "object": {
641
+ if (data === null) return "null";
642
+ if (Array.isArray(data)) return "array";
643
+ const obj = data;
644
+ if (obj && Object.getPrototypeOf(obj) !== Object.prototype && "constructor" in obj && obj.constructor) return obj.constructor.name;
645
+ }
646
+ }
647
+ return t;
648
+ }
682
649
  function issue(...args) {
683
650
  const [iss, input, inst] = args;
684
651
  if (typeof iss === "string") return {
@@ -689,33 +656,330 @@ window.__ModuleLoader__.load({
689
656
  };
690
657
  return { ...iss };
691
658
  }
692
- //#endregion
693
- //#region node_modules/.pnpm/zod@4.4.3/node_modules/zod/v4/core/errors.js
694
- const initializer$1 = (inst, def) => {
695
- inst.name = "$ZodError";
696
- Object.defineProperty(inst, "_zod", {
697
- value: inst._zod,
698
- enumerable: false
659
+ /**
660
+ * 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.
661
+ *
662
+ * Call this from a `proto` initializer, which runs once per prototype — never per instance.
663
+ */
664
+ function members(proto, table) {
665
+ for (const key in table) {
666
+ const desc = Object.getOwnPropertyDescriptor(table, key);
667
+ if (desc.get) Object.defineProperty(proto, key, {
668
+ ...desc,
669
+ enumerable: false
670
+ });
671
+ else defineBound(proto, key, desc.value);
672
+ }
673
+ }
674
+ /** Shadows a prototype member with an own value, so a getter that builds from the instance runs once. */
675
+ function own(inst, key, value, enumerable = true) {
676
+ Object.defineProperty(inst, key, {
677
+ configurable: true,
678
+ writable: true,
679
+ enumerable,
680
+ value
699
681
  });
700
- Object.defineProperty(inst, "issues", {
701
- value: def,
702
- enumerable: false
682
+ return value;
683
+ }
684
+ /** Like {@link own}, for a member that was never an own data property and has to stay out of `Object.keys`. */
685
+ function hide(inst, key, value) {
686
+ return own(inst, key, value, false);
687
+ }
688
+ function defineBound(proto, key, fn) {
689
+ Object.defineProperty(proto, key, {
690
+ configurable: true,
691
+ get() {
692
+ return this == null ? fn : own(this, key, fn.bind(this));
693
+ },
694
+ set(value) {
695
+ own(this, key, value);
696
+ }
697
+ });
698
+ }
699
+ /** Returns the prototype to install on, or `undefined` if this group is already installed on it. */
700
+ function claim(inst, sentinel) {
701
+ const proto = Object.getPrototypeOf(inst);
702
+ return sentinel in proto ? void 0 : proto;
703
+ }
704
+ let installing;
705
+ let broke = false;
706
+ const breaker = {
707
+ configurable: true,
708
+ get() {
709
+ broke = true;
710
+ }
711
+ };
712
+ /**
713
+ * Installs a lazily-derived internal on the `_zod` prototype of `inst`'s
714
+ * constructor, computed from the internals object itself and cached there on
715
+ * first read. One accessor per constructor rather than one per instance.
716
+ */
717
+ function defineLazyInternal(inst, key, compute) {
718
+ const proto = Object.getPrototypeOf(inst._zod);
719
+ if (key in proto && installing !== inst._zod) {
720
+ installing = void 0;
721
+ return;
722
+ }
723
+ installing = inst._zod;
724
+ Object.defineProperty(proto, key, {
725
+ configurable: true,
726
+ get() {
727
+ Object.defineProperty(this, key, breaker);
728
+ const outer = broke;
729
+ broke = false;
730
+ try {
731
+ const value = compute(this);
732
+ if (broke) delete this[key];
733
+ else Object.defineProperty(this, key, {
734
+ configurable: true,
735
+ writable: true,
736
+ value
737
+ });
738
+ broke = broke || outer;
739
+ return value;
740
+ } catch (err) {
741
+ delete this[key];
742
+ broke = broke || outer;
743
+ throw err;
744
+ }
745
+ },
746
+ set(value) {
747
+ Object.defineProperty(this, key, {
748
+ configurable: true,
749
+ writable: true,
750
+ value
751
+ });
752
+ }
703
753
  });
704
- inst.message = JSON.stringify(def, jsonStringifyReplacer, 2);
705
- Object.defineProperty(inst, "toString", {
706
- value: () => inst.message,
707
- enumerable: false
754
+ }
755
+ /**
756
+ * Installs `key` on `inst`'s prototype, computed by `make` on first read and cached there as an own
757
+ * data property. One accessor per constructor rather than one per instance, because an own accessor
758
+ * puts every instance after the first into v8 dictionary mode. The key doubles as the sentinel.
759
+ */
760
+ function installLazyProp(inst, key, make, enumerable) {
761
+ const proto = claim(inst, key);
762
+ if (!proto) return;
763
+ Object.defineProperty(proto, key, {
764
+ configurable: true,
765
+ get() {
766
+ const desc = {
767
+ configurable: true,
768
+ writable: true,
769
+ enumerable,
770
+ value: void 0
771
+ };
772
+ Object.defineProperty(this, key, desc);
773
+ desc.value = make(this);
774
+ Object.defineProperty(this, key, desc);
775
+ return desc.value;
776
+ },
777
+ set(value) {
778
+ Object.defineProperty(this, key, {
779
+ configurable: true,
780
+ writable: true,
781
+ enumerable,
782
+ value
783
+ });
784
+ }
708
785
  });
786
+ }
787
+ /** 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. */
788
+ const CONSTANT_CATCH = "~constantCatch";
789
+ /** Wraps a constant catch value in a thunk tagged with {@link CONSTANT_CATCH}. */
790
+ function constantCatch(value) {
791
+ const fn = () => value;
792
+ fn[CONSTANT_CATCH] = true;
793
+ return fn;
794
+ }
795
+ //#endregion
796
+ //#region node_modules/.pnpm/zod@4.5.4/node_modules/zod/v4/core/core.js
797
+ var _a$1;
798
+ const _zodDesc$1 = {
799
+ value: void 0,
800
+ enumerable: false
801
+ };
802
+ let _E = "captureStackTrace" in Error ? Error : null;
803
+ function newError(Definition) {
804
+ const E = _E;
805
+ if (E) {
806
+ const saved = E.stackTraceLimit;
807
+ if (typeof saved === "number") {
808
+ try {
809
+ E.stackTraceLimit = 0;
810
+ } catch {
811
+ _E = null;
812
+ return new Definition();
813
+ }
814
+ try {
815
+ return new Definition();
816
+ } finally {
817
+ E.stackTraceLimit = saved;
818
+ }
819
+ }
820
+ }
821
+ return new Definition();
822
+ }
823
+ function $constructor(name, initializer, proto, params) {
824
+ const zodProto = {};
825
+ function Internals(def) {
826
+ this.def = def;
827
+ this.constr = _;
828
+ this.traits = /* @__PURE__ */ new Set();
829
+ }
830
+ Internals.prototype = zodProto;
831
+ const protoMembers = proto;
832
+ const initialized = protoMembers && /* @__PURE__ */ new WeakSet();
833
+ function init(inst, def) {
834
+ if (!inst._zod) {
835
+ _zodDesc$1.value = new Internals(def);
836
+ try {
837
+ Object.defineProperty(inst, "_zod", _zodDesc$1);
838
+ } finally {
839
+ _zodDesc$1.value = void 0;
840
+ }
841
+ }
842
+ if (inst._zod.traits.has(name)) return;
843
+ inst._zod.traits.add(name);
844
+ initializer(inst, def);
845
+ if (initialized) {
846
+ const own = Object.getPrototypeOf(inst);
847
+ const ctorProto = inst._zod.constr.prototype;
848
+ let up = own;
849
+ while (up && up !== ctorProto) up = Object.getPrototypeOf(up);
850
+ const target = up ?? own;
851
+ if (!initialized.has(target)) {
852
+ initialized.add(target);
853
+ members(target, protoMembers);
854
+ }
855
+ }
856
+ const proto = _.prototype;
857
+ for (const k in proto) {
858
+ if (!Object.prototype.hasOwnProperty.call(proto, k)) continue;
859
+ if (!(k in inst)) inst[k] = proto[k].bind(inst);
860
+ }
861
+ }
862
+ const Parent = params?.Parent ?? Object;
863
+ class Definition extends Parent {}
864
+ Object.defineProperty(Definition, "name", { value: name });
865
+ function _(def) {
866
+ const inst = params?.Parent ? newError(Definition) : this;
867
+ init(inst, def);
868
+ const deferred = inst._zod.deferred;
869
+ if (deferred) {
870
+ for (const fn of deferred) fn();
871
+ inst._zod.deferred = void 0;
872
+ }
873
+ const pp = globalThis.__zod_globalConfig?.postProcessor;
874
+ if (pp) pp(inst);
875
+ return inst;
876
+ }
877
+ Object.defineProperty(_, "init", { value: init });
878
+ Object.defineProperty(_, Symbol.hasInstance, { value: (inst) => {
879
+ if (params?.Parent && inst instanceof params.Parent) return true;
880
+ return inst?._zod?.traits?.has(name);
881
+ } });
882
+ Object.defineProperty(_, "name", { value: name });
883
+ return _;
884
+ }
885
+ var $ZodAsyncError = class extends Error {
886
+ constructor() {
887
+ super(`Encountered Promise during synchronous parse. Use .parseAsync() instead.`);
888
+ }
889
+ };
890
+ var $ZodEncodeError = class extends Error {
891
+ constructor(name) {
892
+ super(`Encountered unidirectional transform during encode: ${name}`);
893
+ this.name = "ZodEncodeError";
894
+ }
895
+ };
896
+ (_a$1 = globalThis).__zod_globalConfig ?? (_a$1.__zod_globalConfig = {});
897
+ const globalConfig = globalThis.__zod_globalConfig;
898
+ function config(newConfig) {
899
+ if (newConfig) Object.assign(globalConfig, newConfig);
900
+ return globalConfig;
901
+ }
902
+ //#endregion
903
+ //#region node_modules/.pnpm/zod@4.5.4/node_modules/zod/v4/core/errors.js
904
+ function _getMessage() {
905
+ const internals = this._zod;
906
+ internals.message ?? (internals.message = JSON.stringify(internals.def, jsonStringifyReplacer, 2));
907
+ return internals.message;
908
+ }
909
+ function _setMessage(value) {
910
+ this._zod.message = value;
911
+ }
912
+ const _messageDesc = {
913
+ get: _getMessage,
914
+ set: _setMessage,
915
+ enumerable: true,
916
+ configurable: true
917
+ };
918
+ const _zodDesc = {
919
+ value: void 0,
920
+ enumerable: false
921
+ };
922
+ const _issuesDesc = {
923
+ value: void 0,
924
+ enumerable: false
925
+ };
926
+ const _installedToString = /* @__PURE__ */ new WeakSet([Object.prototype, Error.prototype]);
927
+ const initializer$1 = (inst, def) => {
928
+ inst.name = "$ZodError";
929
+ _zodDesc.value = inst._zod;
930
+ Object.defineProperty(inst, "_zod", _zodDesc);
931
+ _issuesDesc.value = def;
932
+ Object.defineProperty(inst, "issues", _issuesDesc);
933
+ _zodDesc.value = void 0;
934
+ _issuesDesc.value = void 0;
935
+ Object.defineProperty(inst, "message", _messageDesc);
936
+ const proto = Object.getPrototypeOf(inst);
937
+ if (!_installedToString.has(proto)) {
938
+ _installedToString.add(proto);
939
+ Object.defineProperty(proto, "toString", {
940
+ configurable: true,
941
+ enumerable: false,
942
+ get() {
943
+ const value = () => this.message;
944
+ Object.defineProperty(this, "toString", {
945
+ value,
946
+ configurable: true,
947
+ writable: true
948
+ });
949
+ return value;
950
+ },
951
+ set(value) {
952
+ Object.defineProperty(this, "toString", {
953
+ value,
954
+ configurable: true,
955
+ writable: true
956
+ });
957
+ }
958
+ });
959
+ }
709
960
  };
710
961
  const $ZodError = $constructor("$ZodError", initializer$1);
711
- const $ZodRealError = $constructor("$ZodError", initializer$1, { Parent: Error });
962
+ const $ZodRealError = $constructor("$ZodError", initializer$1, void 0, { Parent: Error });
963
+ /** Get-or-create `obj[key]` as an own data property. A path segment naming an inherited member
964
+ * ("toString", "constructor") would otherwise read through to the prototype, and assigning
965
+ * "__proto__" would hit the setter instead of creating a key. */
966
+ function node(obj, key, make) {
967
+ if (!Object.prototype.hasOwnProperty.call(obj, key)) {
968
+ if (key === "__proto__") Object.defineProperty(obj, key, {
969
+ value: make(),
970
+ writable: true,
971
+ enumerable: true,
972
+ configurable: true
973
+ });
974
+ else obj[key] = make();
975
+ }
976
+ return obj[key];
977
+ }
712
978
  function flattenError(error, mapper = (issue) => issue.message) {
713
979
  const fieldErrors = {};
714
980
  const formErrors = [];
715
- for (const sub of error.issues) if (sub.path.length > 0) {
716
- fieldErrors[sub.path[0]] = fieldErrors[sub.path[0]] || [];
717
- fieldErrors[sub.path[0]].push(mapper(sub));
718
- } else formErrors.push(mapper(sub));
981
+ for (const sub of error.issues) if (sub.path.length > 0) node(fieldErrors, sub.path[0], () => []).push(mapper(sub));
982
+ else formErrors.push(mapper(sub));
719
983
  return {
720
984
  formErrors,
721
985
  fieldErrors
@@ -735,12 +999,21 @@ window.__ModuleLoader__.load({
735
999
  let i = 0;
736
1000
  while (i < fullpath.length) {
737
1001
  const el = fullpath[i];
738
- if (!(i === fullpath.length - 1)) curr[el] = curr[el] || { _errors: [] };
739
- else {
740
- curr[el] = curr[el] || { _errors: [] };
741
- curr[el]._errors.push(mapper(issue));
1002
+ const terminal = i === fullpath.length - 1;
1003
+ if (el === "_errors") {
1004
+ if (terminal) curr._errors.push(mapper(issue));
1005
+ i++;
1006
+ continue;
742
1007
  }
743
- curr = curr[el];
1008
+ if (!Object.prototype.hasOwnProperty.call(curr, el)) Object.defineProperty(curr, el, {
1009
+ value: { _errors: [] },
1010
+ enumerable: true,
1011
+ writable: true,
1012
+ configurable: true
1013
+ });
1014
+ const node = curr[el];
1015
+ if (terminal) node._errors.push(mapper(issue));
1016
+ curr = node;
744
1017
  i++;
745
1018
  }
746
1019
  }
@@ -750,40 +1023,52 @@ window.__ModuleLoader__.load({
750
1023
  return fieldErrors;
751
1024
  }
752
1025
  //#endregion
753
- //#region node_modules/.pnpm/zod@4.4.3/node_modules/zod/v4/core/parse.js
754
- const _parse = (_Err) => (schema, value, _ctx, _params) => {
755
- const ctx = _ctx ? {
756
- ..._ctx,
757
- async: false
758
- } : { async: false };
759
- const result = schema._zod.run({
760
- value,
761
- issues: []
762
- }, ctx);
763
- if (result instanceof Promise) throw new $ZodAsyncError();
764
- if (result.issues.length) {
765
- const e = new ((_params?.Err) ?? _Err)(result.issues.map((iss) => finalizeIssue(iss, ctx, config())));
766
- captureStackTrace(e, _params?.callee);
767
- throw e;
768
- }
769
- return result.value;
1026
+ //#region node_modules/.pnpm/zod@4.5.4/node_modules/zod/v4/core/parse.js
1027
+ function finalizeParams(callee, params) {
1028
+ return {
1029
+ callee: params?.callee ?? callee,
1030
+ Err: params?.Err
1031
+ };
1032
+ }
1033
+ const _parse = (_Err) => {
1034
+ const fn = (schema, value, _ctx, _params) => {
1035
+ const ctx = _ctx ? {
1036
+ ..._ctx,
1037
+ async: false
1038
+ } : { async: false };
1039
+ const result = schema._zod.run({
1040
+ value,
1041
+ issues: []
1042
+ }, ctx);
1043
+ if (result instanceof Promise) throw new $ZodAsyncError();
1044
+ if (result.issues.length) {
1045
+ const e = new ((_params?.Err) ?? _Err)(result.issues.map((iss) => finalizeIssue(iss, ctx, config())));
1046
+ captureStackTrace(e, _params?.callee ?? fn);
1047
+ throw e;
1048
+ }
1049
+ return result.value;
1050
+ };
1051
+ return fn;
770
1052
  };
771
- const _parseAsync = (_Err) => async (schema, value, _ctx, params) => {
772
- const ctx = _ctx ? {
773
- ..._ctx,
774
- async: true
775
- } : { async: true };
776
- let result = schema._zod.run({
777
- value,
778
- issues: []
779
- }, ctx);
780
- if (result instanceof Promise) result = await result;
781
- if (result.issues.length) {
782
- const e = new ((params?.Err) ?? _Err)(result.issues.map((iss) => finalizeIssue(iss, ctx, config())));
783
- captureStackTrace(e, params?.callee);
784
- throw e;
785
- }
786
- return result.value;
1053
+ const _parseAsync = (_Err) => {
1054
+ const fn = async (schema, value, _ctx, params) => {
1055
+ const ctx = _ctx ? {
1056
+ ..._ctx,
1057
+ async: true
1058
+ } : { async: true };
1059
+ let result = schema._zod.run({
1060
+ value,
1061
+ issues: []
1062
+ }, ctx);
1063
+ if (result instanceof Promise) result = await result;
1064
+ if (result.issues.length) {
1065
+ const e = new ((params?.Err) ?? _Err)(result.issues.map((iss) => finalizeIssue(iss, ctx, config())));
1066
+ captureStackTrace(e, params?.callee ?? fn);
1067
+ throw e;
1068
+ }
1069
+ return result.value;
1070
+ };
1071
+ return fn;
787
1072
  };
788
1073
  const _safeParse = (_Err) => (schema, value, _ctx) => {
789
1074
  const ctx = _ctx ? {
@@ -823,25 +1108,41 @@ window.__ModuleLoader__.load({
823
1108
  };
824
1109
  };
825
1110
  const safeParseAsync$1 = /* @__PURE__*/ _safeParseAsync($ZodRealError);
826
- const _encode = (_Err) => (schema, value, _ctx) => {
827
- const ctx = _ctx ? {
828
- ..._ctx,
829
- direction: "backward"
830
- } : { direction: "backward" };
831
- return _parse(_Err)(schema, value, ctx);
1111
+ const _encode = (_Err) => {
1112
+ const parse = _parse(_Err);
1113
+ const fn = (schema, value, _ctx, _params) => {
1114
+ const ctx = _ctx ? {
1115
+ ..._ctx,
1116
+ direction: "backward"
1117
+ } : { direction: "backward" };
1118
+ return parse(schema, value, ctx, finalizeParams(fn, _params));
1119
+ };
1120
+ return fn;
832
1121
  };
833
- const _decode = (_Err) => (schema, value, _ctx) => {
834
- return _parse(_Err)(schema, value, _ctx);
1122
+ const _decode = (_Err) => {
1123
+ const parse = _parse(_Err);
1124
+ const fn = (schema, value, _ctx, _params) => {
1125
+ return parse(schema, value, _ctx, finalizeParams(fn, _params));
1126
+ };
1127
+ return fn;
835
1128
  };
836
- const _encodeAsync = (_Err) => async (schema, value, _ctx) => {
837
- const ctx = _ctx ? {
838
- ..._ctx,
839
- direction: "backward"
840
- } : { direction: "backward" };
841
- return _parseAsync(_Err)(schema, value, ctx);
1129
+ const _encodeAsync = (_Err) => {
1130
+ const parseAsync = _parseAsync(_Err);
1131
+ const fn = async (schema, value, _ctx, _params) => {
1132
+ const ctx = _ctx ? {
1133
+ ..._ctx,
1134
+ direction: "backward"
1135
+ } : { direction: "backward" };
1136
+ return await parseAsync(schema, value, ctx, finalizeParams(fn, _params));
1137
+ };
1138
+ return fn;
842
1139
  };
843
- const _decodeAsync = (_Err) => async (schema, value, _ctx) => {
844
- return _parseAsync(_Err)(schema, value, _ctx);
1140
+ const _decodeAsync = (_Err) => {
1141
+ const parseAsync = _parseAsync(_Err);
1142
+ const fn = async (schema, value, _ctx, _params) => {
1143
+ return await parseAsync(schema, value, _ctx, finalizeParams(fn, _params));
1144
+ };
1145
+ return fn;
845
1146
  };
846
1147
  const _safeEncode = (_Err) => (schema, value, _ctx) => {
847
1148
  const ctx = _ctx ? {
@@ -864,7 +1165,7 @@ window.__ModuleLoader__.load({
864
1165
  return _safeParseAsync(_Err)(schema, value, _ctx);
865
1166
  };
866
1167
  //#endregion
867
- //#region node_modules/.pnpm/zod@4.4.3/node_modules/zod/v4/core/regexes.js
1168
+ //#region node_modules/.pnpm/zod@4.5.4/node_modules/zod/v4/core/regexes.js
868
1169
  /**
869
1170
  * @deprecated CUID v1 is deprecated by its authors due to information leakage
870
1171
  * (timestamps embedded in the id). Use {@link cuid2} instead.
@@ -872,12 +1173,15 @@ window.__ModuleLoader__.load({
872
1173
  */
873
1174
  const cuid = /^[cC][0-9a-z]{6,}$/;
874
1175
  const cuid2 = /^[0-9a-z]+$/;
875
- const ulid = /^[0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{26}$/;
1176
+ const ulid = /^[0-7][0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{25}$/;
876
1177
  const xid = /^[0-9a-vA-V]{20}$/;
877
1178
  const ksuid = /^[A-Za-z0-9]{27}$/;
878
1179
  const nanoid = /^[a-zA-Z0-9_-]{21}$/;
1180
+ function nanoidOfLength(length) {
1181
+ return new RegExp(`^[a-zA-Z0-9_-]{${length}}$`);
1182
+ }
879
1183
  /** ISO 8601-1 duration regex. Does not support the 8601-2 extensions like negative durations or fractional/negative components. */
880
- 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)?)?)$/;
1184
+ const duration = /^P(?:(\d+W)|(?!.*W)(?=\d|T\d)(\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+([.,]\d+)?S)?)?)$/;
881
1185
  /** A regex for any UUID-like identifier: 8-4-4-4-12 hex pattern */
882
1186
  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})$/;
883
1187
  /** Returns a regex for validating an RFC 9562/4122 UUID.
@@ -889,33 +1193,41 @@ window.__ModuleLoader__.load({
889
1193
  };
890
1194
  /** Practical email validation */
891
1195
  const email = /^(?!\.)(?!.*\.\.)([A-Za-z0-9_'+\-\.]*)[A-Za-z0-9_+-]@([A-Za-z0-9][A-Za-z0-9\-]*\.)+[A-Za-z]{2,}$/;
892
- const _emoji$1 = `^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$`;
1196
+ const _emoji$1 = `^[\\p{Extended_Pictographic}\\p{Emoji_Component}]+$`;
893
1197
  function emoji() {
894
1198
  return new RegExp(_emoji$1, "u");
895
1199
  }
896
1200
  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])$/;
897
1201
  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}|:))$/;
898
1202
  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])$/;
899
- 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])$/;
1203
+ 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])$/;
900
1204
  const base64 = /^$|^(?:[0-9a-zA-Z+/]{4})*(?:(?:[0-9a-zA-Z+/]{2}==)|(?:[0-9a-zA-Z+/]{3}=))?$/;
901
1205
  const base64url = /^[A-Za-z0-9_-]*$/;
902
1206
  const httpProtocol = /^https?$/;
903
1207
  const e164 = /^\+[1-9]\d{6,14}$/;
904
1208
  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])))`;
905
- const date$1 = /*@__PURE__*/ new RegExp(`^${dateSource}$`);
1209
+ /** Anchors a pattern source. The interpolation lives here rather than at the call site because
1210
+ * esbuild will not drop a `@__PURE__` call whose own argument interpolates a variable, but it
1211
+ * will drop `anchor(dateSource)`. Keeping it inline pinned `date` into every bundle. */
1212
+ function anchor(source) {
1213
+ return new RegExp(`^${source}$`);
1214
+ }
1215
+ const date = /*@__PURE__*/ anchor(dateSource);
906
1216
  function timeSource(args) {
907
1217
  const hhmm = `(?:[01]\\d|2[0-3]):[0-5]\\d`;
908
- 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+)?)?`;
1218
+ 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+)?)?`;
909
1219
  }
910
- function time$1(args) {
1220
+ function time(args) {
911
1221
  return new RegExp(`^${timeSource(args)}$`);
912
1222
  }
913
- function datetime$1(args) {
914
- const time = timeSource({ precision: args.precision });
1223
+ function datetime(args) {
915
1224
  const opts = ["Z"];
916
- if (args.local) opts.push("");
917
1225
  if (args.offset) opts.push(`([+-](?:[01]\\d|2[0-3]):[0-5]\\d)`);
918
- const timeRegex = `${time}(?:${opts.join("|")})`;
1226
+ const qualified = `${timeSource({
1227
+ precision: args.precision,
1228
+ seconds: true
1229
+ })}(?:${opts.join("|")})`;
1230
+ const timeRegex = args.local ? `${qualified}|${timeSource({ precision: args.precision })}` : qualified;
919
1231
  return new RegExp(`^${dateSource}T(?:${timeRegex})$`);
920
1232
  }
921
1233
  const string$1 = (params) => {
@@ -928,13 +1240,18 @@ window.__ModuleLoader__.load({
928
1240
  const lowercase = /^[^A-Z]*$/;
929
1241
  const uppercase = /^[^a-z]*$/;
930
1242
  //#endregion
931
- //#region node_modules/.pnpm/zod@4.4.3/node_modules/zod/v4/core/checks.js
1243
+ //#region node_modules/.pnpm/zod@4.5.4/node_modules/zod/v4/core/checks.js
932
1244
  const $ZodCheck = /*@__PURE__*/ $constructor("$ZodCheck", (inst, def) => {
933
1245
  var _a;
934
1246
  inst._zod ?? (inst._zod = {});
935
1247
  inst._zod.def = def;
936
1248
  (_a = inst._zod).onattach ?? (_a.onattach = []);
937
1249
  });
1250
+ /** Default `when` for length-based checks: run only on non-nullish values with a `length`. */
1251
+ const _whenHasLength = (payload) => {
1252
+ const val = payload.value;
1253
+ return !nullish(val) && val.length !== void 0;
1254
+ };
938
1255
  const numericOriginMap = {
939
1256
  number: "number",
940
1257
  bigint: "bigint",
@@ -954,7 +1271,7 @@ window.__ModuleLoader__.load({
954
1271
  inst._zod.check = (payload) => {
955
1272
  if (def.inclusive ? payload.value <= def.value : payload.value < def.value) return;
956
1273
  payload.issues.push({
957
- origin,
1274
+ origin: numericOriginMap[typeof payload.value] ?? origin,
958
1275
  code: "too_big",
959
1276
  maximum: typeof def.value === "object" ? def.value.getTime() : def.value,
960
1277
  input: payload.value,
@@ -978,7 +1295,7 @@ window.__ModuleLoader__.load({
978
1295
  inst._zod.check = (payload) => {
979
1296
  if (def.inclusive ? payload.value >= def.value : payload.value > def.value) return;
980
1297
  payload.issues.push({
981
- origin,
1298
+ origin: numericOriginMap[typeof payload.value] ?? origin,
982
1299
  code: "too_small",
983
1300
  minimum: typeof def.value === "object" ? def.value.getTime() : def.value,
984
1301
  input: payload.value,
@@ -996,7 +1313,7 @@ window.__ModuleLoader__.load({
996
1313
  });
997
1314
  inst._zod.check = (payload) => {
998
1315
  if (typeof payload.value !== typeof def.value) throw new Error("Cannot mix number and bigint in multiple_of check.");
999
- if (typeof payload.value === "bigint" ? payload.value % def.value === BigInt(0) : floatSafeRemainder(payload.value, def.value) === 0) return;
1316
+ if (typeof payload.value === "bigint" ? def.value !== BigInt(0) && payload.value % def.value === BigInt(0) : floatSafeRemainder(payload.value, def.value) === 0) return;
1000
1317
  payload.issues.push({
1001
1318
  origin: typeof payload.value,
1002
1319
  code: "not_multiple_of",
@@ -1081,17 +1398,15 @@ window.__ModuleLoader__.load({
1081
1398
  const $ZodCheckMaxLength = /*@__PURE__*/ $constructor("$ZodCheckMaxLength", (inst, def) => {
1082
1399
  var _a;
1083
1400
  $ZodCheck.init(inst, def);
1084
- (_a = inst._zod.def).when ?? (_a.when = (payload) => {
1085
- const val = payload.value;
1086
- return !nullish(val) && val.length !== void 0;
1087
- });
1401
+ (_a = inst._zod.def).when ?? (_a.when = _whenHasLength);
1088
1402
  inst._zod.onattach.push((inst) => {
1089
1403
  const curr = inst._zod.bag.maximum ?? Number.POSITIVE_INFINITY;
1090
1404
  if (def.maximum < curr) inst._zod.bag.maximum = def.maximum;
1091
1405
  });
1092
1406
  inst._zod.check = (payload) => {
1093
1407
  const input = payload.value;
1094
- if (input.length <= def.maximum) return;
1408
+ const units = input.length;
1409
+ if ((typeof input === "string" && units > def.maximum ? codePointLength(input) : units) <= def.maximum) return;
1095
1410
  const origin = getLengthableOrigin(input);
1096
1411
  payload.issues.push({
1097
1412
  origin,
@@ -1107,17 +1422,15 @@ window.__ModuleLoader__.load({
1107
1422
  const $ZodCheckMinLength = /*@__PURE__*/ $constructor("$ZodCheckMinLength", (inst, def) => {
1108
1423
  var _a;
1109
1424
  $ZodCheck.init(inst, def);
1110
- (_a = inst._zod.def).when ?? (_a.when = (payload) => {
1111
- const val = payload.value;
1112
- return !nullish(val) && val.length !== void 0;
1113
- });
1425
+ (_a = inst._zod.def).when ?? (_a.when = _whenHasLength);
1114
1426
  inst._zod.onattach.push((inst) => {
1115
1427
  const curr = inst._zod.bag.minimum ?? Number.NEGATIVE_INFINITY;
1116
1428
  if (def.minimum > curr) inst._zod.bag.minimum = def.minimum;
1117
1429
  });
1118
1430
  inst._zod.check = (payload) => {
1119
1431
  const input = payload.value;
1120
- if (input.length >= def.minimum) return;
1432
+ const units = input.length;
1433
+ if ((typeof input === "string" && units >= def.minimum && units < def.minimum * 2 ? codePointLength(input) : units) >= def.minimum) return;
1121
1434
  const origin = getLengthableOrigin(input);
1122
1435
  payload.issues.push({
1123
1436
  origin,
@@ -1133,10 +1446,7 @@ window.__ModuleLoader__.load({
1133
1446
  const $ZodCheckLengthEquals = /*@__PURE__*/ $constructor("$ZodCheckLengthEquals", (inst, def) => {
1134
1447
  var _a;
1135
1448
  $ZodCheck.init(inst, def);
1136
- (_a = inst._zod.def).when ?? (_a.when = (payload) => {
1137
- const val = payload.value;
1138
- return !nullish(val) && val.length !== void 0;
1139
- });
1449
+ (_a = inst._zod.def).when ?? (_a.when = _whenHasLength);
1140
1450
  inst._zod.onattach.push((inst) => {
1141
1451
  const bag = inst._zod.bag;
1142
1452
  bag.minimum = def.length;
@@ -1145,7 +1455,8 @@ window.__ModuleLoader__.load({
1145
1455
  });
1146
1456
  inst._zod.check = (payload) => {
1147
1457
  const input = payload.value;
1148
- const length = input.length;
1458
+ const units = input.length;
1459
+ const length = typeof input === "string" && units >= def.length && units <= def.length * 2 ? codePointLength(input) : units;
1149
1460
  if (length === def.length) return;
1150
1461
  const origin = getLengthableOrigin(input);
1151
1462
  const tooBig = length > def.length;
@@ -1219,7 +1530,7 @@ window.__ModuleLoader__.load({
1219
1530
  const $ZodCheckIncludes = /*@__PURE__*/ $constructor("$ZodCheckIncludes", (inst, def) => {
1220
1531
  $ZodCheck.init(inst, def);
1221
1532
  const escapedRegex = escapeRegex(def.includes);
1222
- const pattern = new RegExp(typeof def.position === "number" ? `^.{${def.position}}${escapedRegex}` : escapedRegex);
1533
+ const pattern = new RegExp(typeof def.position === "number" ? `^.{${def.position},}${escapedRegex}` : escapedRegex);
1223
1534
  def.pattern = pattern;
1224
1535
  inst._zod.onattach.push((inst) => {
1225
1536
  const bag = inst._zod.bag;
@@ -1290,12 +1601,13 @@ window.__ModuleLoader__.load({
1290
1601
  };
1291
1602
  });
1292
1603
  //#endregion
1293
- //#region node_modules/.pnpm/zod@4.4.3/node_modules/zod/v4/core/doc.js
1604
+ //#region node_modules/.pnpm/zod@4.5.4/node_modules/zod/v4/core/doc.js
1294
1605
  var Doc = class {
1295
- constructor(args = []) {
1606
+ constructor(args = [], closed = {}) {
1296
1607
  this.content = [];
1297
1608
  this.indent = 0;
1298
- if (this) this.args = args;
1609
+ this.args = args;
1610
+ this.closed = closed;
1299
1611
  }
1300
1612
  indented(fn) {
1301
1613
  this.indent += 1;
@@ -1315,28 +1627,27 @@ window.__ModuleLoader__.load({
1315
1627
  }
1316
1628
  compile() {
1317
1629
  const F = Function;
1318
- const args = this?.args;
1319
- const lines = [...(this?.content ?? [``]).map((x) => ` ${x}`)];
1320
- return new F(...args, lines.join("\n"));
1630
+ const content = this?.content ?? [``];
1631
+ return new F(...Object.keys(this.closed), `return function (${this.args.join(", ")}) {\n${content.join("\n")}\n};`)(...Object.values(this.closed));
1321
1632
  }
1322
1633
  };
1323
1634
  //#endregion
1324
- //#region node_modules/.pnpm/zod@4.4.3/node_modules/zod/v4/core/versions.js
1635
+ //#region node_modules/.pnpm/zod@4.5.4/node_modules/zod/v4/core/versions.js
1325
1636
  const version = {
1326
1637
  major: 4,
1327
- minor: 4,
1328
- patch: 3
1638
+ minor: 5,
1639
+ patch: 4
1329
1640
  };
1330
1641
  //#endregion
1331
- //#region node_modules/.pnpm/zod@4.4.3/node_modules/zod/v4/core/schemas.js
1642
+ //#region node_modules/.pnpm/zod@4.5.4/node_modules/zod/v4/core/schemas.js
1332
1643
  const $ZodType = /*@__PURE__*/ $constructor("$ZodType", (inst, def) => {
1333
1644
  var _a;
1334
1645
  inst ?? (inst = {});
1335
1646
  inst._zod.def = def;
1336
1647
  inst._zod.bag = inst._zod.bag || {};
1337
1648
  inst._zod.version = version;
1338
- const checks = [...inst._zod.def.checks ?? []];
1339
- if (inst._zod.traits.has("$ZodCheck")) checks.unshift(inst);
1649
+ const defChecks = inst._zod.def.checks;
1650
+ const checks = inst._zod.traits.has("$ZodCheck") ? [inst, ...defChecks ?? []] : defChecks?.length ? [...defChecks] : [];
1340
1651
  for (const ch of checks) for (const fn of ch._zod.onattach) fn(inst);
1341
1652
  if (checks.length === 0) {
1342
1653
  (_a = inst._zod).deferred ?? (_a.deferred = []);
@@ -1345,6 +1656,7 @@ window.__ModuleLoader__.load({
1345
1656
  });
1346
1657
  } else {
1347
1658
  const runChecks = (payload, checks, ctx) => {
1659
+ if (payload.memo) return payload;
1348
1660
  let isAborted = aborted(payload);
1349
1661
  let asyncResult;
1350
1662
  for (const ch of checks) {
@@ -1358,10 +1670,12 @@ window.__ModuleLoader__.load({
1358
1670
  if (asyncResult || _ instanceof Promise) asyncResult = (asyncResult ?? Promise.resolve()).then(async () => {
1359
1671
  await _;
1360
1672
  if (payload.issues.length === currLen) return;
1673
+ attachSchema(payload.issues, currLen, inst);
1361
1674
  if (!isAborted) isAborted = aborted(payload, currLen);
1362
1675
  });
1363
1676
  else {
1364
1677
  if (payload.issues.length === currLen) continue;
1678
+ attachSchema(payload.issues, currLen, inst);
1365
1679
  if (!isAborted) isAborted = aborted(payload, currLen);
1366
1680
  }
1367
1681
  }
@@ -1405,19 +1719,29 @@ window.__ModuleLoader__.load({
1405
1719
  return runChecks(result, checks, ctx);
1406
1720
  };
1407
1721
  }
1408
- defineLazy(inst, "~standard", () => ({
1722
+ }, {
1723
+ get "~standard"() {
1724
+ return hide(this, "~standard", standardProps(this));
1725
+ },
1726
+ set "~standard"(value) {
1727
+ own(this, "~standard", value);
1728
+ }
1729
+ });
1730
+ /** The Standard Schema surface for `inst`. Shared so wrappers can extend it without forcing it. */
1731
+ const toStandardResult = (r) => r.success ? { value: r.data } : { issues: r.error?.issues };
1732
+ function standardProps(inst) {
1733
+ return {
1409
1734
  validate: (value) => {
1410
1735
  try {
1411
- const r = safeParse$1(inst, value);
1412
- return r.success ? { value: r.data } : { issues: r.error?.issues };
1736
+ return toStandardResult(safeParse$1(inst, value));
1413
1737
  } catch (_) {
1414
- return safeParseAsync$1(inst, value).then((r) => r.success ? { value: r.data } : { issues: r.error?.issues });
1738
+ return safeParseAsync$1(inst, value).then(toStandardResult);
1415
1739
  }
1416
1740
  },
1417
1741
  vendor: "zod",
1418
1742
  version: 1
1419
- }));
1420
- });
1743
+ };
1744
+ }
1421
1745
  const $ZodString = /*@__PURE__*/ $constructor("$ZodString", (inst, def) => {
1422
1746
  $ZodType.init(inst, def);
1423
1747
  inst._zod.pattern = [...inst?._zod.bag?.patterns ?? []].pop() ?? string$1(inst._zod.bag);
@@ -1464,51 +1788,74 @@ window.__ModuleLoader__.load({
1464
1788
  def.pattern ?? (def.pattern = email);
1465
1789
  $ZodStringFormat.init(inst, def);
1466
1790
  });
1791
+ /** 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. */
1792
+ function parseURLObject(trimmed, def) {
1793
+ if (!def.normalize && def.protocol?.source === httpProtocol.source && !/^https?:\/\//i.test(trimmed)) return 1;
1794
+ try {
1795
+ return new URL(trimmed);
1796
+ } catch {
1797
+ return 2;
1798
+ }
1799
+ }
1800
+ const asciiTabOrNewline = /[\t\n\r]/g;
1801
+ /** 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. */
1802
+ function stripTabAndNewline(value) {
1803
+ return value.replace(asciiTabOrNewline, "");
1804
+ }
1805
+ function urlHostnameOk(url, hostname) {
1806
+ hostname.lastIndex = 0;
1807
+ return hostname.test(url.hostname);
1808
+ }
1809
+ function urlProtocolOk(url, protocol) {
1810
+ protocol.lastIndex = 0;
1811
+ return protocol.test(url.protocol.endsWith(":") ? url.protocol.slice(0, -1) : url.protocol);
1812
+ }
1467
1813
  const $ZodURL = /*@__PURE__*/ $constructor("$ZodURL", (inst, def) => {
1468
1814
  $ZodStringFormat.init(inst, def);
1469
1815
  inst._zod.check = (payload) => {
1470
1816
  try {
1471
1817
  const trimmed = payload.value.trim();
1472
- if (!def.normalize && def.protocol?.source === httpProtocol.source) {
1473
- if (!/^https?:\/\//i.test(trimmed)) {
1474
- payload.issues.push({
1475
- code: "invalid_format",
1476
- format: "url",
1477
- note: "Invalid URL format",
1478
- input: payload.value,
1479
- inst,
1480
- continue: !def.abort
1481
- });
1482
- return;
1483
- }
1484
- }
1485
- const url = new URL(trimmed);
1486
- if (def.hostname) {
1487
- def.hostname.lastIndex = 0;
1488
- if (!def.hostname.test(url.hostname)) payload.issues.push({
1818
+ const url = parseURLObject(trimmed, def);
1819
+ if (url === 1) {
1820
+ payload.issues.push({
1489
1821
  code: "invalid_format",
1490
1822
  format: "url",
1491
- note: "Invalid hostname",
1492
- pattern: def.hostname.source,
1823
+ note: "Invalid URL format",
1493
1824
  input: payload.value,
1494
1825
  inst,
1495
1826
  continue: !def.abort
1496
1827
  });
1828
+ return;
1497
1829
  }
1498
- if (def.protocol) {
1499
- def.protocol.lastIndex = 0;
1500
- if (!def.protocol.test(url.protocol.endsWith(":") ? url.protocol.slice(0, -1) : url.protocol)) payload.issues.push({
1830
+ if (url === 2) {
1831
+ payload.issues.push({
1501
1832
  code: "invalid_format",
1502
1833
  format: "url",
1503
- note: "Invalid protocol",
1504
- pattern: def.protocol.source,
1505
1834
  input: payload.value,
1506
1835
  inst,
1507
1836
  continue: !def.abort
1508
1837
  });
1838
+ return;
1509
1839
  }
1510
- if (def.normalize) payload.value = url.href;
1511
- else payload.value = trimmed;
1840
+ if (def.hostname && !urlHostnameOk(url, def.hostname)) payload.issues.push({
1841
+ code: "invalid_format",
1842
+ format: "url",
1843
+ note: "Invalid hostname",
1844
+ pattern: def.hostname.source,
1845
+ input: payload.value,
1846
+ inst,
1847
+ continue: !def.abort
1848
+ });
1849
+ if (def.protocol && !urlProtocolOk(url, def.protocol)) payload.issues.push({
1850
+ code: "invalid_format",
1851
+ format: "url",
1852
+ note: "Invalid protocol",
1853
+ pattern: def.protocol.source,
1854
+ input: payload.value,
1855
+ inst,
1856
+ continue: !def.abort
1857
+ });
1858
+ payload.value = def.normalize ? url.href : stripTabAndNewline(trimmed);
1512
1859
  return;
1513
1860
  } catch (_) {
1514
1861
  payload.issues.push({
@@ -1526,7 +1873,8 @@ window.__ModuleLoader__.load({
1526
1873
  $ZodStringFormat.init(inst, def);
1527
1874
  });
1528
1875
  const $ZodNanoID = /*@__PURE__*/ $constructor("$ZodNanoID", (inst, def) => {
1529
- def.pattern ?? (def.pattern = nanoid);
1876
+ if (def.length !== void 0 && (!Number.isInteger(def.length) || def.length < 1)) throw new Error(`Invalid nanoid length: ${def.length}`);
1877
+ def.pattern ?? (def.pattern = def.length === void 0 ? nanoid : nanoidOfLength(def.length));
1530
1878
  $ZodStringFormat.init(inst, def);
1531
1879
  });
1532
1880
  /**
@@ -1555,19 +1903,25 @@ window.__ModuleLoader__.load({
1555
1903
  $ZodStringFormat.init(inst, def);
1556
1904
  });
1557
1905
  const $ZodISODateTime = /*@__PURE__*/ $constructor("$ZodISODateTime", (inst, def) => {
1558
- def.pattern ?? (def.pattern = datetime$1(def));
1906
+ def.pattern ?? (def.pattern = datetime(def));
1559
1907
  $ZodStringFormat.init(inst, def);
1908
+ if (def.local || def.precision === -1) {
1909
+ inst._zod.bag.laxFormat = true;
1910
+ inst._zod.onattach.push((s) => {
1911
+ s._zod.bag.laxFormat = true;
1912
+ });
1913
+ }
1560
1914
  });
1561
1915
  const $ZodISODate = /*@__PURE__*/ $constructor("$ZodISODate", (inst, def) => {
1562
- def.pattern ?? (def.pattern = date$1);
1916
+ def.pattern ?? (def.pattern = date);
1563
1917
  $ZodStringFormat.init(inst, def);
1564
1918
  });
1565
1919
  const $ZodISOTime = /*@__PURE__*/ $constructor("$ZodISOTime", (inst, def) => {
1566
- def.pattern ?? (def.pattern = time$1(def));
1920
+ def.pattern ?? (def.pattern = time(def));
1567
1921
  $ZodStringFormat.init(inst, def);
1568
1922
  });
1569
1923
  const $ZodISODuration = /*@__PURE__*/ $constructor("$ZodISODuration", (inst, def) => {
1570
- def.pattern ?? (def.pattern = duration$1);
1924
+ def.pattern ?? (def.pattern = duration);
1571
1925
  $ZodStringFormat.init(inst, def);
1572
1926
  });
1573
1927
  const $ZodIPv4 = /*@__PURE__*/ $constructor("$ZodIPv4", (inst, def) => {
@@ -1575,50 +1929,56 @@ window.__ModuleLoader__.load({
1575
1929
  $ZodStringFormat.init(inst, def);
1576
1930
  inst._zod.bag.format = `ipv4`;
1577
1931
  });
1932
+ /** 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`. */
1933
+ const ipv6Alphabet = /^[0-9a-fA-F:.]+$/;
1934
+ function isValidIPv6(value) {
1935
+ if (!ipv6Alphabet.test(value)) return false;
1936
+ try {
1937
+ new URL(`http://[${value}]`);
1938
+ return true;
1939
+ } catch {
1940
+ return false;
1941
+ }
1942
+ }
1578
1943
  const $ZodIPv6 = /*@__PURE__*/ $constructor("$ZodIPv6", (inst, def) => {
1579
1944
  def.pattern ?? (def.pattern = ipv6);
1580
1945
  $ZodStringFormat.init(inst, def);
1581
1946
  inst._zod.bag.format = `ipv6`;
1582
1947
  inst._zod.check = (payload) => {
1583
- try {
1584
- new URL(`http://[${payload.value}]`);
1585
- } catch {
1586
- payload.issues.push({
1587
- code: "invalid_format",
1588
- format: "ipv6",
1589
- input: payload.value,
1590
- inst,
1591
- continue: !def.abort
1592
- });
1593
- }
1948
+ if (!isValidIPv6(payload.value)) payload.issues.push({
1949
+ code: "invalid_format",
1950
+ format: "ipv6",
1951
+ input: payload.value,
1952
+ inst,
1953
+ continue: !def.abort
1954
+ });
1594
1955
  };
1595
1956
  });
1596
1957
  const $ZodCIDRv4 = /*@__PURE__*/ $constructor("$ZodCIDRv4", (inst, def) => {
1597
1958
  def.pattern ?? (def.pattern = cidrv4);
1598
1959
  $ZodStringFormat.init(inst, def);
1599
1960
  });
1961
+ function isValidCIDRv6(value) {
1962
+ const parts = value.split("/");
1963
+ if (parts.length !== 2) return false;
1964
+ const [address, prefix] = parts;
1965
+ if (!prefix) return false;
1966
+ const prefixNum = Number(prefix);
1967
+ if (`${prefixNum}` !== prefix) return false;
1968
+ if (prefixNum < 0 || prefixNum > 128) return false;
1969
+ return isValidIPv6(address);
1970
+ }
1600
1971
  const $ZodCIDRv6 = /*@__PURE__*/ $constructor("$ZodCIDRv6", (inst, def) => {
1601
1972
  def.pattern ?? (def.pattern = cidrv6);
1602
1973
  $ZodStringFormat.init(inst, def);
1603
1974
  inst._zod.check = (payload) => {
1604
- const parts = payload.value.split("/");
1605
- try {
1606
- if (parts.length !== 2) throw new Error();
1607
- const [address, prefix] = parts;
1608
- if (!prefix) throw new Error();
1609
- const prefixNum = Number(prefix);
1610
- if (`${prefixNum}` !== prefix) throw new Error();
1611
- if (prefixNum < 0 || prefixNum > 128) throw new Error();
1612
- new URL(`http://[${address}]`);
1613
- } catch {
1614
- payload.issues.push({
1615
- code: "invalid_format",
1616
- format: "cidrv6",
1617
- input: payload.value,
1618
- inst,
1619
- continue: !def.abort
1620
- });
1621
- }
1975
+ if (!isValidCIDRv6(payload.value)) payload.issues.push({
1976
+ code: "invalid_format",
1977
+ format: "cidrv6",
1978
+ input: payload.value,
1979
+ inst,
1980
+ continue: !def.abort
1981
+ });
1622
1982
  };
1623
1983
  });
1624
1984
  function isValidBase64(data) {
@@ -1708,7 +2068,7 @@ window.__ModuleLoader__.load({
1708
2068
  } catch (_) {}
1709
2069
  const input = payload.value;
1710
2070
  if (typeof input === "number" && !Number.isNaN(input) && Number.isFinite(input)) return payload;
1711
- const received = typeof input === "number" ? Number.isNaN(input) ? "NaN" : !Number.isFinite(input) ? "Infinity" : void 0 : void 0;
2071
+ const received = typeof input === "number" ? Number.isNaN(input) ? "NaN" : !Number.isFinite(input) ? String(input) : void 0 : void 0;
1712
2072
  payload.issues.push({
1713
2073
  expected: "number",
1714
2074
  code: "invalid_type",
@@ -1763,6 +2123,8 @@ window.__ModuleLoader__.load({
1763
2123
  }
1764
2124
  const $ZodArray = /*@__PURE__*/ $constructor("$ZodArray", (inst, def) => {
1765
2125
  $ZodType.init(inst, def);
2126
+ const memo = globalConfig.memoizer;
2127
+ memo?.attach(inst);
1766
2128
  inst._zod.parse = (payload, ctx) => {
1767
2129
  const input = payload.value;
1768
2130
  if (!Array.isArray(input)) {
@@ -1774,7 +2136,7 @@ window.__ModuleLoader__.load({
1774
2136
  });
1775
2137
  return payload;
1776
2138
  }
1777
- payload.value = Array(input.length);
2139
+ payload.value = memo ? memo.alloc(inst, payload, Array(input.length), ctx) : Array(input.length);
1778
2140
  const proms = [];
1779
2141
  for (let i = 0; i < input.length; i++) {
1780
2142
  const item = input[i];
@@ -1789,13 +2151,15 @@ window.__ModuleLoader__.load({
1789
2151
  return payload;
1790
2152
  };
1791
2153
  });
1792
- function handlePropertyResult(result, final, key, input, isOptionalIn, isOptionalOut) {
2154
+ function handlePropertyResult(result, final, key, input, optin, optout) {
1793
2155
  const isPresent = key in input;
2156
+ const isOptionalOut = optout === "optional";
2157
+ if (!isPresent && isOptionalOut && optin === "optional") return;
1794
2158
  if (result.issues.length) {
1795
- if (isOptionalIn && isOptionalOut && !isPresent) return;
2159
+ if (optin !== void 0 && isOptionalOut && !isPresent) return;
1796
2160
  final.issues.push(...prefixIssues(key, result.issues));
1797
2161
  }
1798
- if (!isPresent && !isOptionalIn) {
2162
+ if (!isPresent && optin === void 0) {
1799
2163
  if (!result.issues.length) final.issues.push({
1800
2164
  code: "invalid_type",
1801
2165
  expected: "nonoptional",
@@ -1808,13 +2172,18 @@ window.__ModuleLoader__.load({
1808
2172
  if (isPresent) final.value[key] = void 0;
1809
2173
  } else final.value[key] = result.value;
1810
2174
  }
2175
+ const NO_SYMBOL_KEYS = [];
1811
2176
  function normalizeDef(def) {
1812
2177
  const keys = Object.keys(def.shape);
1813
- 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`);
2178
+ const ownSymbols = Object.getOwnPropertySymbols(def.shape);
2179
+ const symbolKeys = ownSymbols.length ? ownSymbols : NO_SYMBOL_KEYS;
2180
+ const allKeys = symbolKeys.length ? [...keys, ...symbolKeys] : keys;
2181
+ 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`);
1814
2182
  const okeys = optionalKeys(def.shape);
1815
2183
  return {
1816
2184
  ...def,
1817
- keys,
2185
+ allKeys,
2186
+ symbolKeys,
1818
2187
  keySet: new Set(keys),
1819
2188
  numKeys: keys.length,
1820
2189
  optionalKeys: new Set(okeys)
@@ -1825,11 +2194,14 @@ window.__ModuleLoader__.load({
1825
2194
  const keySet = def.keySet;
1826
2195
  const _catchall = def.catchall._zod;
1827
2196
  const t = _catchall.def.type;
1828
- const isOptionalIn = _catchall.optin === "optional";
1829
- const isOptionalOut = _catchall.optout === "optional";
2197
+ const optin = _catchall.optin;
2198
+ const optout = _catchall.optout;
1830
2199
  for (const key in input) {
1831
- if (key === "__proto__") continue;
1832
2200
  if (keySet.has(key)) continue;
2201
+ if (key === "__proto__") {
2202
+ if (t === "never") unrecognized.push(key);
2203
+ continue;
2204
+ }
1833
2205
  if (t === "never") {
1834
2206
  unrecognized.push(key);
1835
2207
  continue;
@@ -1838,39 +2210,44 @@ window.__ModuleLoader__.load({
1838
2210
  value: input[key],
1839
2211
  issues: []
1840
2212
  }, ctx);
1841
- if (r instanceof Promise) proms.push(r.then((r) => handlePropertyResult(r, payload, key, input, isOptionalIn, isOptionalOut)));
1842
- else handlePropertyResult(r, payload, key, input, isOptionalIn, isOptionalOut);
2213
+ if (r instanceof Promise) proms.push(r.then((r) => handlePropertyResult(r, payload, key, input, optin, optout)));
2214
+ else handlePropertyResult(r, payload, key, input, optin, optout);
1843
2215
  }
1844
2216
  if (unrecognized.length) payload.issues.push({
1845
2217
  code: "unrecognized_keys",
1846
2218
  keys: unrecognized,
1847
2219
  input,
1848
- inst
2220
+ inst,
2221
+ continue: true
1849
2222
  });
1850
2223
  if (!proms.length) return payload;
1851
2224
  return Promise.all(proms).then(() => {
1852
2225
  return payload;
1853
2226
  });
1854
2227
  }
2228
+ const propShapes = /* @__PURE__ */ new WeakMap();
1855
2229
  const $ZodObject = /*@__PURE__*/ $constructor("$ZodObject", (inst, def) => {
1856
2230
  $ZodType.init(inst, def);
1857
2231
  if (!Object.getOwnPropertyDescriptor(def, "shape")?.get) {
1858
2232
  const sh = def.shape;
2233
+ propShapes.set(def, sh);
1859
2234
  Object.defineProperty(def, "shape", { get: () => {
1860
2235
  const newSh = { ...sh };
1861
2236
  Object.defineProperty(def, "shape", { value: newSh });
2237
+ propShapes.set(def, newSh);
1862
2238
  return newSh;
1863
2239
  } });
1864
2240
  }
1865
2241
  const _normalized = cached(() => normalizeDef(def));
1866
- defineLazy(inst._zod, "propValues", () => {
1867
- const shape = def.shape;
2242
+ defineLazyInternal(inst, "propValues", (zod) => {
2243
+ const shape = zod.def.shape;
1868
2244
  const propValues = {};
1869
2245
  for (const key in shape) {
1870
2246
  const field = shape[key]._zod;
1871
2247
  if (field.values) {
1872
- propValues[key] ?? (propValues[key] = /* @__PURE__ */ new Set());
2248
+ if (!Object.prototype.hasOwnProperty.call(propValues, key)) assignProp(propValues, key, /* @__PURE__ */ new Set());
1873
2249
  for (const v of field.values) propValues[key].add(v);
2250
+ if (field.optin !== void 0) propValues[key].add(void 0);
1874
2251
  }
1875
2252
  }
1876
2253
  return propValues;
@@ -1878,6 +2255,8 @@ window.__ModuleLoader__.load({
1878
2255
  const isObject$1 = isObject;
1879
2256
  const catchall = def.catchall;
1880
2257
  let value;
2258
+ const memo = globalConfig.memoizer;
2259
+ memo?.attach(inst);
1881
2260
  inst._zod.parse = (payload, ctx) => {
1882
2261
  value ?? (value = _normalized.value);
1883
2262
  const input = payload.value;
@@ -1890,19 +2269,20 @@ window.__ModuleLoader__.load({
1890
2269
  });
1891
2270
  return payload;
1892
2271
  }
1893
- payload.value = {};
2272
+ payload.value = memo ? memo.alloc(inst, payload, {}, ctx) : {};
1894
2273
  const proms = [];
1895
2274
  const shape = value.shape;
1896
- for (const key of value.keys) {
2275
+ for (const key of value.allKeys) {
2276
+ if (key === "__proto__") continue;
1897
2277
  const el = shape[key];
1898
- const isOptionalIn = el._zod.optin === "optional";
1899
- const isOptionalOut = el._zod.optout === "optional";
2278
+ const optin = el._zod.optin;
2279
+ const optout = el._zod.optout;
1900
2280
  const r = el._zod.run({
1901
2281
  value: input[key],
1902
2282
  issues: []
1903
2283
  }, ctx);
1904
- if (r instanceof Promise) proms.push(r.then((r) => handlePropertyResult(r, payload, key, input, isOptionalIn, isOptionalOut)));
1905
- else handlePropertyResult(r, payload, key, input, isOptionalIn, isOptionalOut);
2284
+ if (r instanceof Promise) proms.push(r.then((r) => handlePropertyResult(r, payload, key, input, optin, optout)));
2285
+ else handlePropertyResult(r, payload, key, input, optin, optout);
1906
2286
  }
1907
2287
  if (!catchall) return proms.length ? Promise.all(proms).then(() => payload) : payload;
1908
2288
  return handleCatchall(proms, input, payload, ctx, _normalized.value, inst);
@@ -1912,55 +2292,55 @@ window.__ModuleLoader__.load({
1912
2292
  $ZodObject.init(inst, def);
1913
2293
  const superParse = inst._zod.parse;
1914
2294
  const _normalized = cached(() => normalizeDef(def));
2295
+ const memo = globalConfig.memoizer;
1915
2296
  const generateFastpass = (shape) => {
1916
- const doc = new Doc([
1917
- "shape",
1918
- "payload",
1919
- "ctx"
1920
- ]);
1921
2297
  const normalized = _normalized.value;
1922
- const parseStr = (key) => {
1923
- const k = esc(key);
1924
- return `shape[${k}]._zod.run({ value: input[${k}], issues: [] }, ctx)`;
1925
- };
2298
+ const syms = normalized.symbolKeys;
2299
+ const doc = new Doc(["payload", "ctx"], {
2300
+ shape,
2301
+ inst,
2302
+ memo,
2303
+ syms
2304
+ });
2305
+ const parseStr = (k) => `shape[${k}]._zod.run({ value: input[${k}], issues: [] }, ctx)`;
2306
+ const prefixStr = (id, k) => `
2307
+ for (let i = 0; i < ${id}.issues.length; i++) {
2308
+ const iss = ${id}.issues[i];
2309
+ iss.path = iss.path ? [${k}, ...iss.path] : [${k}];
2310
+ payload.issues.push(iss);
2311
+ }`;
1926
2312
  doc.write(`const input = payload.value;`);
1927
2313
  const ids = Object.create(null);
1928
2314
  let counter = 0;
1929
- for (const key of normalized.keys) ids[key] = `key_${counter++}`;
1930
- doc.write(`const newResult = {};`);
1931
- for (const key of normalized.keys) {
2315
+ for (const key of normalized.allKeys) ids[key] = `key_${counter++}`;
2316
+ doc.write(memo ? `const newResult = memo.alloc(inst, payload, {}, ctx);` : `const newResult = {};`);
2317
+ for (const key of normalized.allKeys) {
2318
+ if (key === "__proto__") continue;
1932
2319
  const id = ids[key];
1933
- const k = esc(key);
2320
+ const k = typeof key === "symbol" ? `syms[${syms.indexOf(key)}]` : esc(key);
2321
+ const isPresent = `${k} in input`;
1934
2322
  const schema = shape[key];
1935
- const isOptionalIn = schema?._zod?.optin === "optional";
2323
+ const optin = schema?._zod?.optin;
2324
+ const isOptionalIn = optin !== void 0;
1936
2325
  const isOptionalOut = schema?._zod?.optout === "optional";
1937
- doc.write(`const ${id} = ${parseStr(key)};`);
1938
- if (isOptionalIn && isOptionalOut) doc.write(`
1939
- if (${id}.issues.length) {
1940
- if (${k} in input) {
1941
- payload.issues = payload.issues.concat(${id}.issues.map(iss => ({
1942
- ...iss,
1943
- path: iss.path ? [${k}, ...iss.path] : [${k}]
1944
- })));
2326
+ doc.write(`const ${id} = ${parseStr(k)};`);
2327
+ if (isOptionalIn && isOptionalOut) {
2328
+ const assign = optin === "optional" ? `${id}_present` : `${id}.value !== undefined || ${id}_present`;
2329
+ doc.write(`
2330
+ const ${id}_present = ${isPresent};
2331
+ if (!${id}.issues.length || ${id}_present) {
2332
+ if (${id}.issues.length) {${prefixStr(id, k)}
1945
2333
  }
1946
- }
1947
-
1948
- if (${id}.value === undefined) {
1949
- if (${k} in input) {
1950
- newResult[${k}] = undefined;
2334
+
2335
+ if (${assign}) {
2336
+ newResult[${k}] = ${id}.value;
1951
2337
  }
1952
- } else {
1953
- newResult[${k}] = ${id}.value;
1954
2338
  }
1955
-
2339
+
1956
2340
  `);
1957
- else if (!isOptionalIn) doc.write(`
1958
- const ${id}_present = ${k} in input;
1959
- if (${id}.issues.length) {
1960
- payload.issues = payload.issues.concat(${id}.issues.map(iss => ({
1961
- ...iss,
1962
- path: iss.path ? [${k}, ...iss.path] : [${k}]
1963
- })));
2341
+ } else if (!isOptionalIn) doc.write(`
2342
+ const ${id}_present = ${isPresent};
2343
+ if (${id}.issues.length) {${prefixStr(id, k)}
1964
2344
  }
1965
2345
  if (!${id}_present && !${id}.issues.length) {
1966
2346
  payload.issues.push({
@@ -1972,36 +2352,27 @@ window.__ModuleLoader__.load({
1972
2352
  }
1973
2353
 
1974
2354
  if (${id}_present) {
1975
- if (${id}.value === undefined) {
1976
- newResult[${k}] = undefined;
1977
- } else {
1978
- newResult[${k}] = ${id}.value;
1979
- }
2355
+ newResult[${k}] = ${id}.value;
1980
2356
  }
1981
2357
 
1982
2358
  `);
1983
2359
  else doc.write(`
1984
- if (${id}.issues.length) {
1985
- payload.issues = payload.issues.concat(${id}.issues.map(iss => ({
1986
- ...iss,
1987
- path: iss.path ? [${k}, ...iss.path] : [${k}]
1988
- })));
2360
+ if (${id}.issues.length) {${prefixStr(id, k)}
1989
2361
  }
1990
2362
 
1991
2363
  if (${id}.value === undefined) {
1992
- if (${k} in input) {
2364
+ if (${isPresent}) {
1993
2365
  newResult[${k}] = undefined;
1994
2366
  }
1995
2367
  } else {
1996
2368
  newResult[${k}] = ${id}.value;
1997
2369
  }
1998
-
2370
+
1999
2371
  `);
2000
2372
  }
2001
2373
  doc.write(`payload.value = newResult;`);
2002
2374
  doc.write(`return payload;`);
2003
- const fn = doc.compile();
2004
- return (payload, ctx) => fn(shape, payload, ctx);
2375
+ return doc.compile();
2005
2376
  };
2006
2377
  let fastpass;
2007
2378
  const isObject$2 = isObject;
@@ -2050,14 +2421,14 @@ window.__ModuleLoader__.load({
2050
2421
  }
2051
2422
  const $ZodUnion = /*@__PURE__*/ $constructor("$ZodUnion", (inst, def) => {
2052
2423
  $ZodType.init(inst, def);
2053
- defineLazy(inst._zod, "optin", () => def.options.some((o) => o._zod.optin === "optional") ? "optional" : void 0);
2054
- defineLazy(inst._zod, "optout", () => def.options.some((o) => o._zod.optout === "optional") ? "optional" : void 0);
2055
- defineLazy(inst._zod, "values", () => {
2056
- if (def.options.every((o) => o._zod.values)) return new Set(def.options.flatMap((option) => Array.from(option._zod.values)));
2424
+ 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);
2425
+ defineLazyInternal(inst, "optout", (zod) => zod.def.options.some((o) => o._zod.optout === "optional") ? "optional" : void 0);
2426
+ defineLazyInternal(inst, "values", (zod) => {
2427
+ if (zod.def.options.every((o) => o._zod.values)) return new Set(zod.def.options.flatMap((option) => Array.from(option._zod.values)));
2057
2428
  });
2058
- defineLazy(inst._zod, "pattern", () => {
2059
- if (def.options.every((o) => o._zod.pattern)) {
2060
- const patterns = def.options.map((o) => o._zod.pattern);
2429
+ defineLazyInternal(inst, "pattern", (zod) => {
2430
+ if (zod.def.options.every((o) => o._zod.pattern)) {
2431
+ const patterns = zod.def.options.map((o) => o._zod.pattern);
2061
2432
  return new RegExp(`^(${patterns.map((p) => cleanRegex(p.source)).join("|")})$`);
2062
2433
  }
2063
2434
  });
@@ -2119,7 +2490,9 @@ window.__ModuleLoader__.load({
2119
2490
  ...a,
2120
2491
  ...b
2121
2492
  };
2493
+ if (Object.prototype.hasOwnProperty.call(newObj, "__proto__")) delete newObj.__proto__;
2122
2494
  for (const key of sharedKeys) {
2495
+ if (key === "__proto__") continue;
2123
2496
  const sharedValue = mergeValues(a[key], b[key]);
2124
2497
  if (!sharedValue.valid) return {
2125
2498
  valid: false,
@@ -2161,26 +2534,39 @@ window.__ModuleLoader__.load({
2161
2534
  function handleIntersectionResults(result, left, right) {
2162
2535
  const unrecKeys = /* @__PURE__ */ new Map();
2163
2536
  let unrecIssue;
2164
- for (const iss of left.issues) if (iss.code === "unrecognized_keys") {
2165
- unrecIssue ?? (unrecIssue = iss);
2166
- for (const k of iss.keys) {
2537
+ const keyIssues = /* @__PURE__ */ new Map();
2538
+ const collect = (iss, side) => {
2539
+ let keys;
2540
+ if (iss.code === "unrecognized_keys" && !iss.path?.length) {
2541
+ unrecIssue ?? (unrecIssue = iss);
2542
+ keys = iss.keys;
2543
+ } else if (iss.code === "invalid_key" && iss.origin === "record" && iss.path?.length === 1) {
2544
+ const k = String(iss.path[0]);
2545
+ if (!keyIssues.has(k)) keyIssues.set(k, iss);
2546
+ keys = [k];
2547
+ } else return false;
2548
+ for (const k of keys) {
2167
2549
  if (!unrecKeys.has(k)) unrecKeys.set(k, {});
2168
- unrecKeys.get(k).l = true;
2550
+ unrecKeys.get(k)[side] = true;
2169
2551
  }
2170
- } else result.issues.push(iss);
2171
- for (const iss of right.issues) if (iss.code === "unrecognized_keys") for (const k of iss.keys) {
2172
- if (!unrecKeys.has(k)) unrecKeys.set(k, {});
2173
- unrecKeys.get(k).r = true;
2174
- }
2175
- else result.issues.push(iss);
2552
+ return true;
2553
+ };
2554
+ for (const iss of left.issues) if (!collect(iss, "l")) result.issues.push(iss);
2555
+ for (const iss of right.issues) if (!collect(iss, "r")) result.issues.push(iss);
2176
2556
  const bothKeys = [...unrecKeys].filter(([, f]) => f.l && f.r).map(([k]) => k);
2177
- if (bothKeys.length && unrecIssue) result.issues.push({
2178
- ...unrecIssue,
2179
- keys: bothKeys
2180
- });
2181
- if (aborted(result)) return result;
2557
+ if (bothKeys.length) {
2558
+ const aggregated = unrecIssue ? bothKeys.filter((k) => unrecIssue.keys.includes(k)) : [];
2559
+ if (aggregated.length) result.issues.push({
2560
+ ...unrecIssue,
2561
+ keys: aggregated
2562
+ });
2563
+ for (const k of bothKeys) if (!aggregated.includes(k) && keyIssues.has(k)) result.issues.push(keyIssues.get(k));
2564
+ }
2182
2565
  const merged = mergeValues(left.value, right.value);
2183
- if (!merged.valid) throw new Error(`Unmergable intersection. Error path: ${JSON.stringify(merged.mergeErrorPath)}`);
2566
+ if (!merged.valid) {
2567
+ if (aborted(result)) return result;
2568
+ throw new Error(`Unmergable intersection. Error path: ${JSON.stringify(merged.mergeErrorPath)}`);
2569
+ }
2184
2570
  result.value = merged.data;
2185
2571
  return result;
2186
2572
  }
@@ -2189,7 +2575,8 @@ window.__ModuleLoader__.load({
2189
2575
  const values = getEnumValues(def.entries);
2190
2576
  const valuesSet = new Set(values);
2191
2577
  inst._zod.values = valuesSet;
2192
- inst._zod.pattern = new RegExp(`^(${values.filter((k) => propertyKeyTypes.has(typeof k)).map((o) => typeof o === "string" ? escapeRegex(o) : o.toString()).join("|")})$`);
2578
+ const patternValues = values.filter((k) => propertyKeyTypes.has(typeof k));
2579
+ inst._zod.pattern = new RegExp(patternValues.length ? `^(${patternValues.map((o) => escapeRegex(o.toString())).join("|")})$` : "^[^\\s\\S]$");
2193
2580
  inst._zod.parse = (payload, _ctx) => {
2194
2581
  const input = payload.value;
2195
2582
  if (valuesSet.has(input)) return payload;
@@ -2204,10 +2591,9 @@ window.__ModuleLoader__.load({
2204
2591
  });
2205
2592
  const $ZodLiteral = /*@__PURE__*/ $constructor("$ZodLiteral", (inst, def) => {
2206
2593
  $ZodType.init(inst, def);
2207
- if (def.values.length === 0) throw new Error("Cannot create literal schema with no valid values");
2208
2594
  const values = new Set(def.values);
2209
2595
  inst._zod.values = values;
2210
- inst._zod.pattern = new RegExp(`^(${def.values.map((o) => typeof o === "string" ? escapeRegex(o) : o ? escapeRegex(o.toString()) : String(o)).join("|")})$`);
2596
+ 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]$");
2211
2597
  inst._zod.parse = (payload, _ctx) => {
2212
2598
  const input = payload.value;
2213
2599
  if (values.has(input)) return payload;
@@ -2223,67 +2609,66 @@ window.__ModuleLoader__.load({
2223
2609
  const $ZodTransform = /*@__PURE__*/ $constructor("$ZodTransform", (inst, def) => {
2224
2610
  $ZodType.init(inst, def);
2225
2611
  inst._zod.optin = "optional";
2612
+ globalConfig.memoizer?.guard(inst);
2226
2613
  inst._zod.parse = (payload, ctx) => {
2227
2614
  if (ctx.direction === "backward") throw new $ZodEncodeError(inst.constructor.name);
2228
2615
  const _out = def.transform(payload.value, payload);
2229
2616
  if (ctx.async) return (_out instanceof Promise ? _out : Promise.resolve(_out)).then((output) => {
2230
2617
  payload.value = output;
2231
- payload.fallback = true;
2232
2618
  return payload;
2233
2619
  });
2234
2620
  if (_out instanceof Promise) throw new $ZodAsyncError();
2235
2621
  payload.value = _out;
2236
- payload.fallback = true;
2237
2622
  return payload;
2238
2623
  };
2239
2624
  });
2240
- function handleOptionalResult(result, input) {
2241
- if (input === void 0 && (result.issues.length || result.fallback)) return {
2242
- issues: [],
2243
- value: void 0
2244
- };
2245
- return result;
2625
+ function handleOptionalResult(payload, result) {
2626
+ payload.value = result.issues.length ? void 0 : result.value;
2627
+ return payload;
2246
2628
  }
2247
2629
  const $ZodOptional = /*@__PURE__*/ $constructor("$ZodOptional", (inst, def) => {
2248
2630
  $ZodType.init(inst, def);
2249
- inst._zod.optin = "optional";
2631
+ defineLazyInternal(inst, "optin", (zod) => zod.def.innerType._zod.optin === "defaulted" ? "defaulted" : "optional");
2250
2632
  inst._zod.optout = "optional";
2251
- defineLazy(inst._zod, "values", () => {
2252
- return def.innerType._zod.values ? /* @__PURE__ */ new Set([...def.innerType._zod.values, void 0]) : void 0;
2633
+ defineLazyInternal(inst, "values", (zod) => {
2634
+ const values = zod.def.innerType._zod.values;
2635
+ return values ? /* @__PURE__ */ new Set([...values, void 0]) : void 0;
2253
2636
  });
2254
- defineLazy(inst._zod, "pattern", () => {
2255
- const pattern = def.innerType._zod.pattern;
2637
+ defineLazyInternal(inst, "pattern", (zod) => {
2638
+ const pattern = zod.def.innerType._zod.pattern;
2256
2639
  return pattern ? new RegExp(`^(${cleanRegex(pattern.source)})?$`) : void 0;
2257
2640
  });
2258
2641
  inst._zod.parse = (payload, ctx) => {
2259
- if (def.innerType._zod.optin === "optional") {
2260
- const input = payload.value;
2261
- const result = def.innerType._zod.run(payload, ctx);
2262
- if (result instanceof Promise) return result.then((r) => handleOptionalResult(r, input));
2263
- return handleOptionalResult(result, input);
2642
+ if (payload.value === void 0) {
2643
+ if (def.innerType._zod.optin !== "defaulted") return payload;
2644
+ const result = def.innerType._zod.run({
2645
+ value: payload.value,
2646
+ issues: []
2647
+ }, ctx);
2648
+ if (result instanceof Promise) return result.then((result) => handleOptionalResult(payload, result));
2649
+ return handleOptionalResult(payload, result);
2264
2650
  }
2265
- if (payload.value === void 0) return payload;
2266
2651
  return def.innerType._zod.run(payload, ctx);
2267
2652
  };
2268
2653
  });
2269
2654
  const $ZodExactOptional = /*@__PURE__*/ $constructor("$ZodExactOptional", (inst, def) => {
2270
2655
  $ZodOptional.init(inst, def);
2271
- defineLazy(inst._zod, "values", () => def.innerType._zod.values);
2272
- defineLazy(inst._zod, "pattern", () => def.innerType._zod.pattern);
2656
+ defineLazyInternal(inst, "values", (zod) => zod.def.innerType._zod.values);
2657
+ defineLazyInternal(inst, "pattern", (zod) => zod.def.innerType._zod.pattern);
2273
2658
  inst._zod.parse = (payload, ctx) => {
2274
2659
  return def.innerType._zod.run(payload, ctx);
2275
2660
  };
2276
2661
  });
2277
2662
  const $ZodNullable = /*@__PURE__*/ $constructor("$ZodNullable", (inst, def) => {
2278
2663
  $ZodType.init(inst, def);
2279
- defineLazy(inst._zod, "optin", () => def.innerType._zod.optin);
2280
- defineLazy(inst._zod, "optout", () => def.innerType._zod.optout);
2281
- defineLazy(inst._zod, "pattern", () => {
2282
- const pattern = def.innerType._zod.pattern;
2664
+ defineLazyInternal(inst, "optin", (zod) => zod.def.innerType._zod.optin);
2665
+ defineLazyInternal(inst, "optout", (zod) => zod.def.innerType._zod.optout);
2666
+ defineLazyInternal(inst, "pattern", (zod) => {
2667
+ const pattern = zod.def.innerType._zod.pattern;
2283
2668
  return pattern ? new RegExp(`^(${cleanRegex(pattern.source)}|null)$`) : void 0;
2284
2669
  });
2285
- defineLazy(inst._zod, "values", () => {
2286
- return def.innerType._zod.values ? /* @__PURE__ */ new Set([...def.innerType._zod.values, null]) : void 0;
2670
+ defineLazyInternal(inst, "values", (zod) => {
2671
+ return zod.def.innerType._zod.values ? /* @__PURE__ */ new Set([...zod.def.innerType._zod.values, null]) : void 0;
2287
2672
  });
2288
2673
  inst._zod.parse = (payload, ctx) => {
2289
2674
  if (payload.value === null) return payload;
@@ -2292,8 +2677,8 @@ window.__ModuleLoader__.load({
2292
2677
  });
2293
2678
  const $ZodDefault = /*@__PURE__*/ $constructor("$ZodDefault", (inst, def) => {
2294
2679
  $ZodType.init(inst, def);
2295
- inst._zod.optin = "optional";
2296
- defineLazy(inst._zod, "values", () => def.innerType._zod.values);
2680
+ inst._zod.optin = "defaulted";
2681
+ defineLazyInternal(inst, "values", (zod) => zod.def.innerType._zod.values);
2297
2682
  inst._zod.parse = (payload, ctx) => {
2298
2683
  if (ctx.direction === "backward") return def.innerType._zod.run(payload, ctx);
2299
2684
  if (payload.value === void 0) {
@@ -2314,8 +2699,8 @@ window.__ModuleLoader__.load({
2314
2699
  }
2315
2700
  const $ZodPrefault = /*@__PURE__*/ $constructor("$ZodPrefault", (inst, def) => {
2316
2701
  $ZodType.init(inst, def);
2317
- inst._zod.optin = "optional";
2318
- defineLazy(inst._zod, "values", () => def.innerType._zod.values);
2702
+ inst._zod.optin = "defaulted";
2703
+ defineLazyInternal(inst, "values", (zod) => zod.def.innerType._zod.values);
2319
2704
  inst._zod.parse = (payload, ctx) => {
2320
2705
  if (ctx.direction === "backward") return def.innerType._zod.run(payload, ctx);
2321
2706
  if (payload.value === void 0) payload.value = def.defaultValue;
@@ -2324,8 +2709,8 @@ window.__ModuleLoader__.load({
2324
2709
  });
2325
2710
  const $ZodNonOptional = /*@__PURE__*/ $constructor("$ZodNonOptional", (inst, def) => {
2326
2711
  $ZodType.init(inst, def);
2327
- defineLazy(inst._zod, "values", () => {
2328
- const v = def.innerType._zod.values;
2712
+ defineLazyInternal(inst, "values", (zod) => {
2713
+ const v = zod.def.innerType._zod.values;
2329
2714
  return v ? new Set([...v].filter((x) => x !== void 0)) : void 0;
2330
2715
  });
2331
2716
  inst._zod.parse = (payload, ctx) => {
@@ -2343,46 +2728,41 @@ window.__ModuleLoader__.load({
2343
2728
  });
2344
2729
  return payload;
2345
2730
  }
2731
+ function handleCatchResult(payload, result, def, ctx) {
2732
+ if (!result.issues.length) {
2733
+ payload.value = result.value;
2734
+ if (result.memo) payload.memo = true;
2735
+ return payload;
2736
+ }
2737
+ payload.value = def.catchValue({
2738
+ ...result,
2739
+ value: payload.value,
2740
+ error: { issues: result.issues.map((iss) => finalizeIssue(iss, ctx, config())) },
2741
+ input: payload.value
2742
+ });
2743
+ return payload;
2744
+ }
2346
2745
  const $ZodCatch = /*@__PURE__*/ $constructor("$ZodCatch", (inst, def) => {
2347
2746
  $ZodType.init(inst, def);
2348
- inst._zod.optin = "optional";
2349
- defineLazy(inst._zod, "optout", () => def.innerType._zod.optout);
2350
- defineLazy(inst._zod, "values", () => def.innerType._zod.values);
2747
+ defineLazyInternal(inst, "optin", (zod) => zod.def.innerType._zod.optin === "defaulted" ? "defaulted" : "optional");
2748
+ defineLazyInternal(inst, "optout", (zod) => zod.def.innerType._zod.optout);
2749
+ defineLazyInternal(inst, "values", (zod) => zod.def.innerType._zod.values);
2351
2750
  inst._zod.parse = (payload, ctx) => {
2352
2751
  if (ctx.direction === "backward") return def.innerType._zod.run(payload, ctx);
2353
- const result = def.innerType._zod.run(payload, ctx);
2354
- if (result instanceof Promise) return result.then((result) => {
2355
- payload.value = result.value;
2356
- if (result.issues.length) {
2357
- payload.value = def.catchValue({
2358
- ...payload,
2359
- error: { issues: result.issues.map((iss) => finalizeIssue(iss, ctx, config())) },
2360
- input: payload.value
2361
- });
2362
- payload.issues = [];
2363
- payload.fallback = true;
2364
- }
2365
- return payload;
2366
- });
2367
- payload.value = result.value;
2368
- if (result.issues.length) {
2369
- payload.value = def.catchValue({
2370
- ...payload,
2371
- error: { issues: result.issues.map((iss) => finalizeIssue(iss, ctx, config())) },
2372
- input: payload.value
2373
- });
2374
- payload.issues = [];
2375
- payload.fallback = true;
2376
- }
2377
- return payload;
2752
+ const result = def.innerType._zod.run({
2753
+ value: payload.value,
2754
+ issues: []
2755
+ }, ctx);
2756
+ if (result instanceof Promise) return result.then((result) => handleCatchResult(payload, result, def, ctx));
2757
+ return handleCatchResult(payload, result, def, ctx);
2378
2758
  };
2379
2759
  });
2380
2760
  const $ZodPipe = /*@__PURE__*/ $constructor("$ZodPipe", (inst, def) => {
2381
2761
  $ZodType.init(inst, def);
2382
- defineLazy(inst._zod, "values", () => def.in._zod.values);
2383
- defineLazy(inst._zod, "optin", () => def.in._zod.optin);
2384
- defineLazy(inst._zod, "optout", () => def.out._zod.optout);
2385
- defineLazy(inst._zod, "propValues", () => def.in._zod.propValues);
2762
+ defineLazyInternal(inst, "values", (zod) => zod.def.in._zod.values);
2763
+ defineLazyInternal(inst, "optin", (zod) => zod.def.in._zod.optin);
2764
+ defineLazyInternal(inst, "optout", (zod) => zod.def.out._zod.optout);
2765
+ defineLazyInternal(inst, "propValues", (zod) => zod.def.in._zod.propValues);
2386
2766
  inst._zod.parse = (payload, ctx) => {
2387
2767
  if (ctx.direction === "backward") {
2388
2768
  const right = def.out._zod.run(payload, ctx);
@@ -2395,22 +2775,21 @@ window.__ModuleLoader__.load({
2395
2775
  };
2396
2776
  });
2397
2777
  function handlePipeResult(left, next, ctx) {
2398
- if (left.issues.length) {
2778
+ if (left.issues.some((iss) => iss.code !== "unrecognized_keys")) {
2399
2779
  left.aborted = true;
2400
2780
  return left;
2401
2781
  }
2402
2782
  return next._zod.run({
2403
2783
  value: left.value,
2404
- issues: left.issues,
2405
- fallback: left.fallback
2784
+ issues: left.issues
2406
2785
  }, ctx);
2407
2786
  }
2408
2787
  const $ZodReadonly = /*@__PURE__*/ $constructor("$ZodReadonly", (inst, def) => {
2409
2788
  $ZodType.init(inst, def);
2410
- defineLazy(inst._zod, "propValues", () => def.innerType._zod.propValues);
2411
- defineLazy(inst._zod, "values", () => def.innerType._zod.values);
2412
- defineLazy(inst._zod, "optin", () => def.innerType?._zod?.optin);
2413
- defineLazy(inst._zod, "optout", () => def.innerType?._zod?.optout);
2789
+ defineLazyInternal(inst, "propValues", (zod) => zod.def.innerType._zod.propValues);
2790
+ defineLazyInternal(inst, "values", (zod) => zod.def.innerType._zod.values);
2791
+ defineLazyInternal(inst, "optin", (zod) => zod.def.innerType?._zod?.optin);
2792
+ defineLazyInternal(inst, "optout", (zod) => zod.def.innerType?._zod?.optout);
2414
2793
  inst._zod.parse = (payload, ctx) => {
2415
2794
  if (ctx.direction === "backward") return def.innerType._zod.run(payload, ctx);
2416
2795
  const result = def.innerType._zod.run(payload, ctx);
@@ -2419,37 +2798,362 @@ window.__ModuleLoader__.load({
2419
2798
  };
2420
2799
  });
2421
2800
  function handleReadonlyResult(payload) {
2422
- payload.value = Object.freeze(payload.value);
2801
+ if (!payload.memo) payload.value = Object.freeze(payload.value);
2423
2802
  return payload;
2424
2803
  }
2425
- const $ZodCustom = /*@__PURE__*/ $constructor("$ZodCustom", (inst, def) => {
2426
- $ZodCheck.init(inst, def);
2427
- $ZodType.init(inst, def);
2428
- inst._zod.parse = (payload, _) => {
2429
- return payload;
2804
+ const $ZodCustom = /*@__PURE__*/ $constructor("$ZodCustom", (inst, def) => {
2805
+ $ZodCheck.init(inst, def);
2806
+ $ZodType.init(inst, def);
2807
+ inst._zod.parse = (payload, _) => {
2808
+ return payload;
2809
+ };
2810
+ inst._zod.check = (payload) => {
2811
+ const input = payload.value;
2812
+ const r = def.fn(input);
2813
+ if (r instanceof Promise) return r.then((r) => handleRefineResult(r, payload, input, inst));
2814
+ handleRefineResult(r, payload, input, inst);
2815
+ };
2816
+ });
2817
+ function handleRefineResult(result, payload, input, inst) {
2818
+ if (!result) {
2819
+ const _iss = {
2820
+ code: "custom",
2821
+ input,
2822
+ inst,
2823
+ path: [...inst._zod.def.path ?? []],
2824
+ continue: !inst._zod.def.abort
2825
+ };
2826
+ if (inst._zod.def.params) _iss.params = inst._zod.def.params;
2827
+ payload.issues.push(issue(_iss));
2828
+ }
2829
+ }
2830
+ //#endregion
2831
+ //#region node_modules/.pnpm/zod@4.5.4/node_modules/zod/v4/core/memoizer.js
2832
+ var $ZodCyclicError = class extends Error {
2833
+ constructor() {
2834
+ super(`Cannot parse a reference cycle that closes through a transform`);
2835
+ this.name = "ZodCyclicError";
2836
+ }
2837
+ };
2838
+ /** Keyed off the context object every schema in one parse call already shares. */
2839
+ const STATE = "~memo";
2840
+ const NO_ISSUES = [];
2841
+ function cloneIssues(issues) {
2842
+ return issues.map((iss) => iss.path ? {
2843
+ ...iss,
2844
+ path: iss.path.slice()
2845
+ } : { ...iss });
2846
+ }
2847
+ const recursive = /*@__PURE__*/ new WeakMap();
2848
+ /** Whether this schema's subtree contains a cycle, so one parse can re-enter it. */
2849
+ function isRecursive(inst, stack) {
2850
+ const cached = recursive.get(inst);
2851
+ if (cached !== void 0) return cached;
2852
+ if (stack.has(inst)) return true;
2853
+ stack.add(inst);
2854
+ let result = false;
2855
+ const check = (child) => {
2856
+ if (!result && child?._zod && isRecursive(child, stack)) result = true;
2857
+ };
2858
+ const def = inst._zod.def;
2859
+ switch (def.type) {
2860
+ case "object":
2861
+ for (const key of Reflect.ownKeys(def.shape)) check(def.shape[key]);
2862
+ check(def.catchall);
2863
+ break;
2864
+ case "array":
2865
+ check(def.element);
2866
+ break;
2867
+ case "tuple":
2868
+ for (const el of def.items) check(el);
2869
+ check(def.rest);
2870
+ break;
2871
+ case "record":
2872
+ case "map":
2873
+ check(def.keyType);
2874
+ check(def.valueType);
2875
+ break;
2876
+ case "set":
2877
+ check(def.valueType);
2878
+ break;
2879
+ case "union":
2880
+ for (const el of def.options) check(el);
2881
+ break;
2882
+ case "intersection":
2883
+ check(def.left);
2884
+ check(def.right);
2885
+ break;
2886
+ case "optional":
2887
+ case "nullable":
2888
+ case "default":
2889
+ case "prefault":
2890
+ case "catch":
2891
+ case "readonly":
2892
+ case "nonoptional":
2893
+ case "promise":
2894
+ case "success":
2895
+ check(def.innerType);
2896
+ break;
2897
+ case "pipe":
2898
+ check(def.in);
2899
+ check(def.out);
2900
+ break;
2901
+ case "function":
2902
+ check(def.input);
2903
+ check(def.output);
2904
+ break;
2905
+ case "lazy":
2906
+ check(inst._zod.innerType);
2907
+ break;
2908
+ case "template_literal":
2909
+ case "string":
2910
+ case "number":
2911
+ case "int":
2912
+ case "boolean":
2913
+ case "bigint":
2914
+ case "symbol":
2915
+ case "undefined":
2916
+ case "null":
2917
+ case "void":
2918
+ case "never":
2919
+ case "any":
2920
+ case "unknown":
2921
+ case "date":
2922
+ case "nan":
2923
+ case "enum":
2924
+ case "literal":
2925
+ case "file":
2926
+ case "transform":
2927
+ case "custom": break;
2928
+ default: for (const key in def) {
2929
+ const desc = Object.getOwnPropertyDescriptor(def, key);
2930
+ if (!desc || desc.get) continue;
2931
+ const value = desc.value;
2932
+ if (!value || typeof value !== "object") continue;
2933
+ if (value._zod) check(value);
2934
+ else if (Array.isArray(value)) for (const el of value) check(el);
2935
+ }
2936
+ }
2937
+ stack.delete(inst);
2938
+ recursive.set(inst, result);
2939
+ return result;
2940
+ }
2941
+ function bucketFor(state, inst) {
2942
+ let bucket = state.buckets.get(inst);
2943
+ if (!bucket) {
2944
+ bucket = /* @__PURE__ */ new Map();
2945
+ state.buckets.set(inst, bucket);
2946
+ }
2947
+ return bucket;
2948
+ }
2949
+ let handoff;
2950
+ const open = [];
2951
+ const memo = {
2952
+ alloc(_inst, payload, empty) {
2953
+ const bucket = handoff;
2954
+ if (!bucket) return empty;
2955
+ handoff = void 0;
2956
+ const entry = {
2957
+ value: empty,
2958
+ issues: null
2959
+ };
2960
+ bucket.set(payload.value, entry);
2961
+ open.push(entry);
2962
+ return empty;
2963
+ },
2964
+ guard(inst) {
2965
+ var _a;
2966
+ (_a = inst._zod).deferred ?? (_a.deferred = []);
2967
+ inst._zod.deferred.push(() => {
2968
+ const base = inst._zod.parse;
2969
+ const wrapped = (payload, ctx) => {
2970
+ if (ctx.direction !== "backward" && isBackEdge(ctx, payload.value)) throw new $ZodCyclicError();
2971
+ return base(payload, ctx);
2972
+ };
2973
+ inst._zod.parse = wrapped;
2974
+ if (inst._zod.run === base) inst._zod.run = wrapped;
2975
+ });
2976
+ },
2977
+ attach(inst) {
2978
+ var _a;
2979
+ let isRecursiveInst;
2980
+ let lastCtx;
2981
+ let lastBucket;
2982
+ (_a = inst._zod).deferred ?? (_a.deferred = []);
2983
+ inst._zod.deferred.push(() => {
2984
+ const base = inst._zod.parse;
2985
+ const wrapped = (payload, ctx) => {
2986
+ if (isRecursiveInst === void 0) {
2987
+ isRecursiveInst = isRecursive(inst, /* @__PURE__ */ new Set());
2988
+ if (!isRecursiveInst) {
2989
+ inst._zod.parse = base;
2990
+ if (inst._zod.run === wrapped) inst._zod.run = base;
2991
+ return base(payload, ctx);
2992
+ }
2993
+ }
2994
+ const input = payload.value;
2995
+ if (input === null || typeof input !== "object") return base(payload, ctx);
2996
+ let state = ctx[STATE];
2997
+ if (!state) {
2998
+ state = {
2999
+ buckets: /* @__PURE__ */ new Map(),
3000
+ backEdges: void 0
3001
+ };
3002
+ ctx[STATE] = state;
3003
+ }
3004
+ let bucket;
3005
+ if (lastCtx === ctx) bucket = lastBucket;
3006
+ else {
3007
+ bucket = bucketFor(state, inst);
3008
+ lastCtx = ctx;
3009
+ lastBucket = bucket;
3010
+ }
3011
+ const hit = bucket.get(input);
3012
+ if (hit) {
3013
+ payload.value = hit.value;
3014
+ if (hit.issues) {
3015
+ if (hit.issues.length) payload.issues.push(...cloneIssues(hit.issues));
3016
+ } else {
3017
+ payload.memo = true;
3018
+ state.backEdges ?? (state.backEdges = /* @__PURE__ */ new Set());
3019
+ state.backEdges.add(hit.value);
3020
+ }
3021
+ return payload;
3022
+ }
3023
+ handoff = bucket;
3024
+ const depth = open.length;
3025
+ const result = base(payload, ctx);
3026
+ handoff = void 0;
3027
+ const entry = open.length > depth ? open.pop() : void 0;
3028
+ if (result instanceof Promise) return result.then((r) => {
3029
+ if (entry) entry.issues = r.issues.length ? cloneIssues(r.issues) : NO_ISSUES;
3030
+ return r;
3031
+ });
3032
+ if (entry) entry.issues = result.issues.length ? cloneIssues(result.issues) : NO_ISSUES;
3033
+ return result;
3034
+ };
3035
+ inst._zod.parse = wrapped;
3036
+ if (inst._zod.run === base) inst._zod.run = wrapped;
3037
+ });
3038
+ }
3039
+ };
3040
+ /** The memoizer that gives containers cycle support. `zod` installs it by default; `zod/mini` opts in with `config({ memoizer: memoizer() })`. */
3041
+ function memoizer() {
3042
+ return memo;
3043
+ }
3044
+ /** Whether this value is a node a back-edge resolved to before it finished. */
3045
+ function isBackEdge(ctx, value) {
3046
+ const backEdges = ctx[STATE]?.backEdges;
3047
+ return backEdges !== void 0 && value !== null && typeof value === "object" && backEdges.has(value);
3048
+ }
3049
+ //#endregion
3050
+ //#region node_modules/.pnpm/zod@4.5.4/node_modules/zod/v4/locales/en.js
3051
+ const error = () => {
3052
+ const Sizable = {
3053
+ string: {
3054
+ unit: "characters",
3055
+ verb: "to have"
3056
+ },
3057
+ file: {
3058
+ unit: "bytes",
3059
+ verb: "to have"
3060
+ },
3061
+ array: {
3062
+ unit: "items",
3063
+ verb: "to have"
3064
+ },
3065
+ set: {
3066
+ unit: "items",
3067
+ verb: "to have"
3068
+ },
3069
+ map: {
3070
+ unit: "entries",
3071
+ verb: "to have"
3072
+ }
2430
3073
  };
2431
- inst._zod.check = (payload) => {
2432
- const input = payload.value;
2433
- const r = def.fn(input);
2434
- if (r instanceof Promise) return r.then((r) => handleRefineResult(r, payload, input, inst));
2435
- handleRefineResult(r, payload, input, inst);
3074
+ function getSizing(origin) {
3075
+ return Sizable[origin] ?? null;
3076
+ }
3077
+ const FormatDictionary = {
3078
+ regex: "input",
3079
+ email: "email address",
3080
+ url: "URL",
3081
+ emoji: "emoji",
3082
+ uuid: "UUID",
3083
+ uuidv4: "UUIDv4",
3084
+ uuidv6: "UUIDv6",
3085
+ nanoid: "nanoid",
3086
+ guid: "GUID",
3087
+ cuid: "cuid",
3088
+ cuid2: "cuid2",
3089
+ ulid: "ULID",
3090
+ xid: "XID",
3091
+ ksuid: "KSUID",
3092
+ datetime: "ISO datetime",
3093
+ date: "ISO date",
3094
+ time: "ISO time",
3095
+ duration: "ISO duration",
3096
+ ipv4: "IPv4 address",
3097
+ ipv6: "IPv6 address",
3098
+ mac: "MAC address",
3099
+ cidrv4: "IPv4 range",
3100
+ cidrv6: "IPv6 range",
3101
+ base64: "base64-encoded string",
3102
+ base64url: "base64url-encoded string",
3103
+ json_string: "JSON string",
3104
+ e164: "E.164 number",
3105
+ credit_card: "credit card number",
3106
+ jwt: "JWT",
3107
+ template_literal: "input"
2436
3108
  };
2437
- });
2438
- function handleRefineResult(result, payload, input, inst) {
2439
- if (!result) {
2440
- const _iss = {
2441
- code: "custom",
2442
- input,
2443
- inst,
2444
- path: [...inst._zod.def.path ?? []],
2445
- continue: !inst._zod.def.abort
2446
- };
2447
- if (inst._zod.def.params) _iss.params = inst._zod.def.params;
2448
- payload.issues.push(issue(_iss));
3109
+ const TypeDictionary = { nan: "NaN" };
3110
+ function getTypeName(type, input) {
3111
+ if (type === "number" && typeof input === "number" && !Number.isFinite(input)) return String(input);
3112
+ return TypeDictionary[type] ?? type;
2449
3113
  }
3114
+ return (issue) => {
3115
+ switch (issue.code) {
3116
+ case "invalid_type": return `Invalid input: expected ${getTypeName(issue.expected)}, received ${getTypeName(parsedType(issue.input), issue.input)}`;
3117
+ case "invalid_value":
3118
+ if (issue.values.length === 1) return `Invalid input: expected ${stringifyPrimitive(issue.values[0])}`;
3119
+ return `Invalid option: expected one of ${joinValues(issue.values, "|")}`;
3120
+ case "too_big": {
3121
+ const adj = issue.exact ? "exactly " : issue.inclusive ? "<=" : "<";
3122
+ const sizing = getSizing(issue.origin);
3123
+ if (sizing) return `Too big: expected ${issue.origin ?? "value"} to have ${adj}${issue.maximum.toString()} ${sizing.unit ?? "elements"}`;
3124
+ return `Too big: expected ${issue.origin ?? "value"} to be ${adj}${issue.maximum.toString()}`;
3125
+ }
3126
+ case "too_small": {
3127
+ const adj = issue.exact ? "exactly " : issue.inclusive ? ">=" : ">";
3128
+ const sizing = getSizing(issue.origin);
3129
+ if (sizing) return `Too small: expected ${issue.origin} to have ${adj}${issue.minimum.toString()} ${sizing.unit}`;
3130
+ return `Too small: expected ${issue.origin} to be ${adj}${issue.minimum.toString()}`;
3131
+ }
3132
+ case "invalid_format": {
3133
+ const _issue = issue;
3134
+ if (_issue.format === "starts_with") return `Invalid string: must start with "${_issue.prefix}"`;
3135
+ if (_issue.format === "ends_with") return `Invalid string: must end with "${_issue.suffix}"`;
3136
+ if (_issue.format === "includes") return `Invalid string: must include "${_issue.includes}"`;
3137
+ if (_issue.format === "regex") return `Invalid string: must match pattern ${_issue.pattern}`;
3138
+ return `Invalid ${FormatDictionary[_issue.format] ?? issue.format}`;
3139
+ }
3140
+ case "not_multiple_of": return `Invalid number: must be a multiple of ${issue.divisor}`;
3141
+ case "unrecognized_keys": return `Unrecognized key${issue.keys.length > 1 ? "s" : ""}: ${joinValues(issue.keys, ", ")}`;
3142
+ case "invalid_key": return `Invalid key in ${issue.origin}`;
3143
+ case "invalid_union":
3144
+ if (issue.options && Array.isArray(issue.options) && issue.options.length > 0) return `Invalid discriminator value. Expected ${issue.options.map((o) => `'${o}'`).join(" | ")}`;
3145
+ if (issue.inclusive === false) return "Invalid input: more than one option matched";
3146
+ return "Invalid input";
3147
+ case "invalid_element": return `Invalid value in ${issue.origin}`;
3148
+ default: return `Invalid input`;
3149
+ }
3150
+ };
3151
+ };
3152
+ function en_default() {
3153
+ return { localeError: error() };
2450
3154
  }
2451
3155
  //#endregion
2452
- //#region node_modules/.pnpm/zod@4.4.3/node_modules/zod/v4/core/registries.js
3156
+ //#region node_modules/.pnpm/zod@4.5.4/node_modules/zod/v4/core/registries.js
2453
3157
  var _a;
2454
3158
  var $ZodRegistry = class {
2455
3159
  constructor() {
@@ -2496,7 +3200,7 @@ window.__ModuleLoader__.load({
2496
3200
  (_a = globalThis).__zod_globalRegistry ?? (_a.__zod_globalRegistry = registry());
2497
3201
  const globalRegistry = globalThis.__zod_globalRegistry;
2498
3202
  //#endregion
2499
- //#region node_modules/.pnpm/zod@4.4.3/node_modules/zod/v4/core/api.js
3203
+ //#region node_modules/.pnpm/zod@4.5.4/node_modules/zod/v4/core/api.js
2500
3204
  // @__NO_SIDE_EFFECTS__
2501
3205
  function _string(Class, params) {
2502
3206
  return new Class({
@@ -2981,7 +3685,7 @@ window.__ModuleLoader__.load({
2981
3685
  const _issue = issue$2;
2982
3686
  if (_issue.fatal) _issue.continue = false;
2983
3687
  _issue.code ?? (_issue.code = "custom");
2984
- _issue.input ?? (_issue.input = payload.value);
3688
+ if (!("input" in _issue)) _issue.input = payload.value;
2985
3689
  _issue.inst ?? (_issue.inst = ch);
2986
3690
  _issue.continue ?? (_issue.continue = !ch._zod.def.abort);
2987
3691
  payload.issues.push(issue(_issue));
@@ -3001,7 +3705,11 @@ window.__ModuleLoader__.load({
3001
3705
  return ch;
3002
3706
  }
3003
3707
  //#endregion
3004
- //#region node_modules/.pnpm/zod@4.4.3/node_modules/zod/v4/core/to-json-schema.js
3708
+ //#region node_modules/.pnpm/zod@4.5.4/node_modules/zod/v4/core/to-json-schema.js
3709
+ function assignProps(target, ...sources) {
3710
+ for (const source of sources) for (const key of Reflect.ownKeys(source)) if (Object.prototype.propertyIsEnumerable.call(source, key)) assignProp(target, key, source[key]);
3711
+ return target;
3712
+ }
3005
3713
  function initializeContext(params) {
3006
3714
  let target = params?.target ?? "draft-2020-12";
3007
3715
  if (target === "draft-4") target = "draft-04";
@@ -3015,11 +3723,31 @@ window.__ModuleLoader__.load({
3015
3723
  io: params?.io ?? "output",
3016
3724
  counter: 0,
3017
3725
  seen: /* @__PURE__ */ new Map(),
3726
+ sharedDefsExtractedFor: void 0,
3727
+ sharedEmitDoneFor: void 0,
3018
3728
  cycles: params?.cycles ?? "ref",
3019
3729
  reused: params?.reused ?? "inline",
3730
+ intersections: [],
3731
+ deferred: [],
3020
3732
  external: params?.external ?? void 0
3021
3733
  };
3022
3734
  }
3735
+ /**
3736
+ * Applies the `unrepresentable` setting at a site that has no JSON Schema equivalent. Throws
3737
+ * `message` unless the setting (or the handler's return value) says otherwise. Returns `true` if a
3738
+ * custom JSON Schema was written into `json`, in which case the caller must not write its own.
3739
+ */
3740
+ function handleUnrepresentable(schema, ctx, json, params, message) {
3741
+ const result = typeof ctx.unrepresentable === "function" ? ctx.unrepresentable({
3742
+ zodSchema: schema,
3743
+ path: params.path,
3744
+ message
3745
+ }) : ctx.unrepresentable;
3746
+ if (result === "any") return false;
3747
+ if (result === void 0 || result === "throw") throw new Error(message);
3748
+ Object.assign(json, result);
3749
+ return true;
3750
+ }
3023
3751
  function process(schema, ctx, _params = {
3024
3752
  path: [],
3025
3753
  schemaPath: []
@@ -3039,6 +3767,8 @@ window.__ModuleLoader__.load({
3039
3767
  path: _params.path
3040
3768
  };
3041
3769
  ctx.seen.set(schema, result);
3770
+ ctx.sharedDefsExtractedFor = void 0;
3771
+ ctx.sharedEmitDoneFor = void 0;
3042
3772
  const overrideSchema = schema._zod.toJSONSchema?.();
3043
3773
  if (overrideSchema) result.schema = overrideSchema;
3044
3774
  else {
@@ -3062,7 +3792,7 @@ window.__ModuleLoader__.load({
3062
3792
  }
3063
3793
  }
3064
3794
  const meta = ctx.metadataRegistry.get(schema);
3065
- if (meta) Object.assign(result.schema, meta);
3795
+ if (meta) assignProps(result.schema, meta);
3066
3796
  if (ctx.io === "input" && isTransforming(schema)) {
3067
3797
  delete result.schema.examples;
3068
3798
  delete result.schema.default;
@@ -3071,9 +3801,13 @@ window.__ModuleLoader__.load({
3071
3801
  delete result.schema._prefault;
3072
3802
  return ctx.seen.get(schema).schema;
3073
3803
  }
3804
+ function encodeJSONPointerSegment(segment) {
3805
+ return segment.replace(/~/g, "~0").replace(/\//g, "~1");
3806
+ }
3074
3807
  function extractDefs(ctx, schema) {
3075
3808
  const root = ctx.seen.get(schema);
3076
3809
  if (!root) throw new Error("Unprocessed schema. This is a bug in Zod.");
3810
+ if (ctx.external && ctx.sharedDefsExtractedFor === ctx.external) return;
3077
3811
  const idToSchema = /* @__PURE__ */ new Map();
3078
3812
  for (const entry of ctx.seen.entries()) {
3079
3813
  const id = ctx.metadataRegistry.get(entry[0])?.id;
@@ -3093,15 +3827,16 @@ window.__ModuleLoader__.load({
3093
3827
  entry[1].defId = id;
3094
3828
  return {
3095
3829
  defId: id,
3096
- ref: `${uriGenerator("__shared")}#/${defsSegment}/${id}`
3830
+ ref: `${uriGenerator("__shared")}#/${defsSegment}/${encodeJSONPointerSegment(id)}`
3097
3831
  };
3098
3832
  }
3099
- if (entry[1] === root) return { ref: "#" };
3100
- const defUriPrefix = `#/${defsSegment}/`;
3833
+ const uriPrefix = `#`;
3834
+ const defUriPrefix = `${uriPrefix}/${defsSegment}/`;
3835
+ if (entry[1] === root && !entry[1].schema.id) return { ref: uriPrefix };
3101
3836
  const defId = entry[1].schema.id ?? `__schema${ctx.counter++}`;
3102
3837
  return {
3103
3838
  defId,
3104
- ref: defUriPrefix + defId
3839
+ ref: defUriPrefix + encodeJSONPointerSegment(defId)
3105
3840
  };
3106
3841
  };
3107
3842
  const extractToDef = (entry) => {
@@ -3148,6 +3883,111 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
3148
3883
  }
3149
3884
  }
3150
3885
  }
3886
+ if (ctx.external) ctx.sharedDefsExtractedFor = ctx.external;
3887
+ }
3888
+ /** 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. */
3889
+ function compactTypeUnion(schema) {
3890
+ const options = schema.anyOf;
3891
+ if (!Array.isArray(options) || options.length === 0 || schema.type !== void 0) return;
3892
+ const types = [];
3893
+ for (const option of options) {
3894
+ if (!option || typeof option !== "object") return;
3895
+ compactTypeUnion(option);
3896
+ const keys = Object.keys(option);
3897
+ if (keys.length !== 1 || keys[0] !== "type") return;
3898
+ const type = option.type;
3899
+ for (const member of Array.isArray(type) ? type : [type]) {
3900
+ if (typeof member !== "string") return;
3901
+ if (!types.includes(member)) types.push(member);
3902
+ }
3903
+ }
3904
+ delete schema.anyOf;
3905
+ schema.type = types.length === 1 ? types[0] : types;
3906
+ }
3907
+ /** Keywords `foldIntersection` knows how to combine. Anything else — `$ref`, `patternProperties`,
3908
+ * an annotation like `description` — makes a member unfoldable, so a constraint this does not
3909
+ * understand leaves the `allOf` alone instead of being silently dropped or misattributed. */
3910
+ const FOLDABLE_KEYS = /* @__PURE__ */ new Set([
3911
+ "type",
3912
+ "properties",
3913
+ "required",
3914
+ "additionalProperties"
3915
+ ]);
3916
+ const UNION_KEYS = ["oneOf", "anyOf"];
3917
+ /** 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. */
3918
+ function undeclaredConstraint(member) {
3919
+ const extra = member.additionalProperties;
3920
+ if (extra === void 0 || extra === false || typeof extra !== "object" || extra === null) return null;
3921
+ return Object.keys(extra).length ? extra : null;
3922
+ }
3923
+ /** Combines object members into the single object they describe together, or returns `null` if any of them carries a keyword outside {@link FOLDABLE_KEYS}. */
3924
+ function foldObjects(members) {
3925
+ const objects = [];
3926
+ for (const member of members) {
3927
+ if (typeof member !== "object" || member.type !== "object") return null;
3928
+ for (const key in member) if (!FOLDABLE_KEYS.has(key)) return null;
3929
+ objects.push(member);
3930
+ }
3931
+ const properties = {};
3932
+ const required = /* @__PURE__ */ new Set();
3933
+ for (const object of objects) {
3934
+ for (const key in object.properties) {
3935
+ if (Object.prototype.hasOwnProperty.call(properties, key)) continue;
3936
+ const parts = [];
3937
+ for (const other of objects) {
3938
+ const part = other.properties?.[key] ?? undeclaredConstraint(other);
3939
+ if (part === null || part === void 0) continue;
3940
+ if (!parts.some((seen) => JSON.stringify(seen) === JSON.stringify(part))) parts.push(part);
3941
+ }
3942
+ assignProp(properties, key, parts.length === 1 ? parts[0] : foldObjects(parts) ?? { allOf: parts });
3943
+ }
3944
+ for (const key of object.required ?? []) required.add(key);
3945
+ }
3946
+ const folded = {
3947
+ type: "object",
3948
+ properties
3949
+ };
3950
+ if (required.size) folded.required = [...required];
3951
+ if (objects.every((object) => object.additionalProperties === false)) folded.additionalProperties = false;
3952
+ else {
3953
+ const constraints = [];
3954
+ for (const object of objects) {
3955
+ const constraint = undeclaredConstraint(object);
3956
+ if (constraint && !constraints.some((seen) => JSON.stringify(seen) === JSON.stringify(constraint))) constraints.push(constraint);
3957
+ }
3958
+ if (constraints.length === 1) folded.additionalProperties = constraints[0];
3959
+ else if (constraints.length > 1) folded.additionalProperties = { allOf: constraints };
3960
+ }
3961
+ return folded;
3962
+ }
3963
+ /** `additionalProperties` in an `allOf` member sees only that member's own `properties`, so two
3964
+ * closed object members reject each other's keys and the schema validates nothing. Zod's parser
3965
+ * pools the key sets instead — `handleIntersectionResults` reports a key as unrecognized only when
3966
+ * *every* side rejects it — so the emitted schema has to pool them too, and folding the members
3967
+ * into one object is the encoding that says so on every target.
3968
+ *
3969
+ * This runs from `finalize`, after `extractDefs`, which is what keeps it clear of the `$ref`
3970
+ * machinery: a member extracted into `$defs` is already a `$ref` by now and declines to fold, so it
3971
+ * keeps its reference and its own closedness rather than being inlined as a stale copy. */
3972
+ function foldIntersection(json) {
3973
+ const allOf = json.allOf;
3974
+ if (!Array.isArray(allOf) || allOf.length < 2) return;
3975
+ for (const key of FOLDABLE_KEYS) if (key in json) return;
3976
+ const unions = allOf.filter((m) => UNION_KEYS.some((k) => Array.isArray(m[k])));
3977
+ let folded = null;
3978
+ if (!unions.length) folded = foldObjects(allOf);
3979
+ else {
3980
+ const union = unions[0];
3981
+ const keyword = UNION_KEYS.find((k) => Array.isArray(union[k]));
3982
+ if (Object.keys(union).length !== 1) return;
3983
+ const rest = allOf.filter((m) => m !== union);
3984
+ const branches = union[keyword].map((branch) => foldObjects([...rest, branch]));
3985
+ if (branches.some((b) => !b)) return;
3986
+ folded = { [keyword]: branches };
3987
+ }
3988
+ if (!folded) return;
3989
+ delete json.allOf;
3990
+ assignProps(json, folded);
3151
3991
  }
3152
3992
  function finalize(ctx, schema) {
3153
3993
  const root = ctx.seen.get(schema);
@@ -3166,8 +4006,8 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
3166
4006
  if (refSchema.$ref && (ctx.target === "draft-07" || ctx.target === "draft-04" || ctx.target === "openapi-3.0")) {
3167
4007
  schema.allOf = schema.allOf ?? [];
3168
4008
  schema.allOf.push(refSchema);
3169
- } else Object.assign(schema, refSchema);
3170
- Object.assign(schema, _cached);
4009
+ } else assignProps(schema, refSchema);
4010
+ assignProps(schema, _cached);
3171
4011
  if (zodSchema._zod.parent === ref) for (const key in schema) {
3172
4012
  if (key === "$ref" || key === "allOf") continue;
3173
4013
  if (!(key in _cached)) delete schema[key];
@@ -3195,7 +4035,22 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
3195
4035
  path: seen.path ?? []
3196
4036
  });
3197
4037
  };
3198
- for (const entry of [...ctx.seen.entries()].reverse()) flattenRef(entry[0]);
4038
+ if (!ctx.external || ctx.sharedEmitDoneFor !== ctx.external) {
4039
+ for (const entry of [...ctx.seen.entries()].reverse()) flattenRef(entry[0]);
4040
+ if (ctx.target !== "openapi-3.0") for (const entry of ctx.seen.entries()) compactTypeUnion(entry[1].def ?? entry[1].schema);
4041
+ for (const rewrite of ctx.deferred) rewrite();
4042
+ if (ctx.intersections.length) {
4043
+ const carriers = /* @__PURE__ */ new Map();
4044
+ for (const seen of ctx.seen.values()) for (const json of [seen.schema, seen.def]) {
4045
+ const allOf = json?.allOf;
4046
+ if (!Array.isArray(allOf)) continue;
4047
+ const existing = carriers.get(allOf);
4048
+ if (existing) existing.push(json);
4049
+ else carriers.set(allOf, [json]);
4050
+ }
4051
+ for (const allOf of ctx.intersections) for (const json of carriers.get(allOf) ?? []) foldIntersection(json);
4052
+ }
4053
+ }
3199
4054
  const result = {};
3200
4055
  if (ctx.target === "draft-2020-12") result.$schema = "https://json-schema.org/draft/2020-12/schema";
3201
4056
  else if (ctx.target === "draft-07") result.$schema = "http://json-schema.org/draft-07/schema#";
@@ -3206,17 +4061,18 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
3206
4061
  if (!id) throw new Error("Schema is missing an `id` property");
3207
4062
  result.$id = ctx.external.uri(id);
3208
4063
  }
3209
- Object.assign(result, root.def ?? root.schema);
4064
+ assignProps(result, root.defId ? root.schema : root.def ?? root.schema);
3210
4065
  const rootMetaId = ctx.metadataRegistry.get(schema)?.id;
3211
4066
  if (rootMetaId !== void 0 && result.id === rootMetaId) delete result.id;
3212
4067
  const defs = ctx.external?.defs ?? {};
3213
- for (const entry of ctx.seen.entries()) {
4068
+ if (!ctx.external || ctx.sharedEmitDoneFor !== ctx.external) for (const entry of ctx.seen.entries()) {
3214
4069
  const seen = entry[1];
3215
4070
  if (seen.def && seen.defId) {
3216
4071
  if (seen.def.id === seen.defId) delete seen.def.id;
3217
- defs[seen.defId] = seen.def;
4072
+ assignProp(defs, seen.defId, seen.def);
3218
4073
  }
3219
4074
  }
4075
+ if (ctx.external) ctx.sharedEmitDoneFor = ctx.external;
3220
4076
  if (ctx.external) {} else if (Object.keys(defs).length > 0) {
3221
4077
  if (ctx.target === "draft-2020-12") result.$defs = defs;
3222
4078
  else result.definitions = defs;
@@ -3248,7 +4104,7 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
3248
4104
  if (def.type === "array") return isTransforming(def.element, ctx);
3249
4105
  if (def.type === "set") return isTransforming(def.valueType, ctx);
3250
4106
  if (def.type === "lazy") return isTransforming(def.getter(), ctx);
3251
- 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);
4107
+ 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);
3252
4108
  if (def.type === "intersection") return isTransforming(def.left, ctx) || isTransforming(def.right, ctx);
3253
4109
  if (def.type === "record" || def.type === "map") return isTransforming(def.keyType, ctx) || isTransforming(def.valueType, ctx);
3254
4110
  if (def.type === "pipe") {
@@ -3296,7 +4152,7 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
3296
4152
  return finalize(ctx, schema);
3297
4153
  };
3298
4154
  //#endregion
3299
- //#region node_modules/.pnpm/zod@4.4.3/node_modules/zod/v4/core/json-schema-processors.js
4155
+ //#region node_modules/.pnpm/zod@4.5.4/node_modules/zod/v4/core/json-schema-processors.js
3300
4156
  const formatMap = {
3301
4157
  guid: "uuid",
3302
4158
  url: "uri",
@@ -3307,25 +4163,25 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
3307
4163
  const stringProcessor = (schema, ctx, _json, _params) => {
3308
4164
  const json = _json;
3309
4165
  json.type = "string";
3310
- const { minimum, maximum, format, patterns, contentEncoding } = schema._zod.bag;
4166
+ const { minimum, maximum, format, patterns, contentEncoding, laxFormat } = schema._zod.bag;
3311
4167
  if (typeof minimum === "number") json.minLength = minimum;
3312
4168
  if (typeof maximum === "number") json.maxLength = maximum;
3313
4169
  if (format) {
3314
4170
  json.format = formatMap[format] ?? format;
3315
4171
  if (json.format === "") delete json.format;
3316
- if (format === "time") delete json.format;
4172
+ if (format === "time" || laxFormat) delete json.format;
3317
4173
  }
3318
4174
  if (contentEncoding) json.contentEncoding = contentEncoding;
3319
4175
  if (patterns && patterns.size > 0) {
3320
- const regexes = [...patterns];
3321
- if (regexes.length === 1) json.pattern = regexes[0].source;
3322
- else if (regexes.length > 1) json.allOf = [...regexes.map((regex) => ({
4176
+ const patternList = [...patterns];
4177
+ if (patternList.length === 1) json.pattern = patternList[0].source;
4178
+ else if (patternList.length > 1) json.allOf = [...patternList.map((regex) => ({
3323
4179
  ...ctx.target === "draft-07" || ctx.target === "draft-04" || ctx.target === "openapi-3.0" ? { type: "string" } : {},
3324
4180
  pattern: regex.source
3325
4181
  }))];
3326
4182
  }
3327
4183
  };
3328
- const numberProcessor = (schema, ctx, _json, _params) => {
4184
+ const numberProcessor = (schema, ctx, _json, params) => {
3329
4185
  const json = _json;
3330
4186
  const { minimum, maximum, format, multipleOf, exclusiveMaximum, exclusiveMinimum } = schema._zod.bag;
3331
4187
  if (typeof format === "string" && format.includes("int")) json.type = "integer";
@@ -3345,7 +4201,10 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
3345
4201
  json.exclusiveMaximum = true;
3346
4202
  } else json.exclusiveMaximum = exclusiveMaximum;
3347
4203
  } else if (typeof maximum === "number") json.maximum = maximum;
3348
- if (typeof multipleOf === "number") json.multipleOf = multipleOf;
4204
+ if (typeof multipleOf === "number") {
4205
+ if (Number.isFinite(multipleOf) && multipleOf !== 0) json.multipleOf = Math.abs(multipleOf);
4206
+ else handleUnrepresentable(schema, ctx, json, params, `A multipleOf divisor of ${multipleOf} cannot be represented in JSON Schema`);
4207
+ }
3349
4208
  };
3350
4209
  const booleanProcessor = (_schema, _ctx, json, _params) => {
3351
4210
  json.type = "boolean";
@@ -3356,18 +4215,26 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
3356
4215
  const enumProcessor = (schema, _ctx, json, _params) => {
3357
4216
  const def = schema._zod.def;
3358
4217
  const values = getEnumValues(def.entries);
4218
+ if (values.length === 0) {
4219
+ json.not = {};
4220
+ return;
4221
+ }
3359
4222
  if (values.every((v) => typeof v === "number")) json.type = "number";
3360
4223
  if (values.every((v) => typeof v === "string")) json.type = "string";
3361
4224
  json.enum = values;
3362
4225
  };
3363
- const literalProcessor = (schema, ctx, json, _params) => {
4226
+ const literalProcessor = (schema, ctx, json, params) => {
3364
4227
  const def = schema._zod.def;
4228
+ if (def.values.length === 0) {
4229
+ json.not = {};
4230
+ return;
4231
+ }
3365
4232
  const vals = [];
3366
4233
  for (const val of def.values) if (val === void 0) {
3367
- if (ctx.unrepresentable === "throw") throw new Error("Literal `undefined` cannot be represented in JSON Schema");
4234
+ if (handleUnrepresentable(schema, ctx, json, params, "Literal `undefined` cannot be represented in JSON Schema")) return;
3368
4235
  } else if (typeof val === "bigint") {
3369
- if (ctx.unrepresentable === "throw") throw new Error("BigInt literals cannot be represented in JSON Schema");
3370
- else vals.push(Number(val));
4236
+ if (handleUnrepresentable(schema, ctx, json, params, "BigInt literals cannot be represented in JSON Schema")) return;
4237
+ vals.push(Number(val));
3371
4238
  } else vals.push(val);
3372
4239
  if (vals.length === 0) {} else if (vals.length === 1) {
3373
4240
  const val = vals[0];
@@ -3382,11 +4249,11 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
3382
4249
  json.enum = vals;
3383
4250
  }
3384
4251
  };
3385
- const customProcessor = (_schema, ctx, _json, _params) => {
3386
- if (ctx.unrepresentable === "throw") throw new Error("Custom types cannot be represented in JSON Schema");
4252
+ const customProcessor = (schema, ctx, json, params) => {
4253
+ handleUnrepresentable(schema, ctx, json, params, "Custom types cannot be represented in JSON Schema");
3387
4254
  };
3388
- const transformProcessor = (_schema, ctx, _json, _params) => {
3389
- if (ctx.unrepresentable === "throw") throw new Error("Transforms cannot be represented in JSON Schema");
4255
+ const transformProcessor = (schema, ctx, json, params) => {
4256
+ handleUnrepresentable(schema, ctx, json, params, "Transforms cannot be represented in JSON Schema");
3390
4257
  };
3391
4258
  const arrayProcessor = (schema, ctx, _json, params) => {
3392
4259
  const json = _json;
@@ -3400,25 +4267,32 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
3400
4267
  path: [...params.path, "items"]
3401
4268
  });
3402
4269
  };
4270
+ function inputOptin(schema) {
4271
+ const def = schema._zod.def;
4272
+ if (def.type === "pipe" && def.in._zod.traits.has("$ZodTransform")) return inputOptin(def.out);
4273
+ if (def.type === "catch") return inputOptin(def.innerType);
4274
+ return schema._zod.optin;
4275
+ }
3403
4276
  const objectProcessor = (schema, ctx, _json, params) => {
3404
4277
  const json = _json;
3405
4278
  const def = schema._zod.def;
4279
+ const shape = def.shape;
4280
+ if (Object.getOwnPropertySymbols(shape).length && handleUnrepresentable(schema, ctx, json, params, "Symbol keys cannot be represented in JSON Schema")) return;
3406
4281
  json.type = "object";
3407
4282
  json.properties = {};
3408
- const shape = def.shape;
3409
- for (const key in shape) json.properties[key] = process(shape[key], ctx, {
4283
+ for (const key in shape) assignProp(json.properties, key, process(shape[key], ctx, {
3410
4284
  ...params,
3411
4285
  path: [
3412
4286
  ...params.path,
3413
4287
  "properties",
3414
4288
  key
3415
4289
  ]
3416
- });
4290
+ }));
3417
4291
  const allKeys = new Set(Object.keys(shape));
3418
4292
  const requiredKeys = new Set([...allKeys].filter((key) => {
3419
- const v = def.shape[key]._zod;
3420
- if (ctx.io === "input") return v.optin === void 0;
3421
- else return v.optout === void 0;
4293
+ const field = def.shape[key];
4294
+ if (ctx.io === "input") return inputOptin(field) === void 0;
4295
+ else return field._zod.optout === void 0;
3422
4296
  }));
3423
4297
  if (requiredKeys.size > 0) json.required = Array.from(requiredKeys);
3424
4298
  if (def.catchall?._zod.def.type === "never") json.additionalProperties = false;
@@ -3462,7 +4336,9 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
3462
4336
  ]
3463
4337
  });
3464
4338
  const isSimpleIntersection = (val) => "allOf" in val && Object.keys(val).length === 1;
3465
- json.allOf = [...isSimpleIntersection(a) ? a.allOf : [a], ...isSimpleIntersection(b) ? b.allOf : [b]];
4339
+ const allOf = [...isSimpleIntersection(a) ? a.allOf : [a], ...isSimpleIntersection(b) ? b.allOf : [b]];
4340
+ json.allOf = allOf;
4341
+ ctx.intersections.push(allOf);
3466
4342
  };
3467
4343
  const nullableProcessor = (schema, ctx, json, params) => {
3468
4344
  const def = schema._zod.def;
@@ -3479,19 +4355,37 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
3479
4355
  const seen = ctx.seen.get(schema);
3480
4356
  seen.ref = def.innerType;
3481
4357
  };
4358
+ /** Round-trips a default value through JSON so the emitted schema is guaranteed to be valid JSON.
4359
+ * A BigInt has no reliable encoding, so it goes through `unrepresentable` like any other
4360
+ * unrepresentable value. Returns a sentinel when the caller must not write a default of its own. */
4361
+ const UNREPRESENTABLE_DEFAULT = Symbol();
4362
+ function serializeDefaultValue(value, schema, ctx, json, params) {
4363
+ let unrepresentable = false;
4364
+ const serialized = JSON.stringify(value, (_, val) => {
4365
+ if (typeof val !== "bigint") return val;
4366
+ unrepresentable = true;
4367
+ return null;
4368
+ });
4369
+ if (!unrepresentable) return JSON.parse(serialized);
4370
+ handleUnrepresentable(schema, ctx, json, params, "BigInt defaults cannot be represented in JSON Schema");
4371
+ return UNREPRESENTABLE_DEFAULT;
4372
+ }
3482
4373
  const defaultProcessor = (schema, ctx, json, params) => {
3483
4374
  const def = schema._zod.def;
3484
4375
  process(def.innerType, ctx, params);
3485
4376
  const seen = ctx.seen.get(schema);
3486
4377
  seen.ref = def.innerType;
3487
- json.default = JSON.parse(JSON.stringify(def.defaultValue));
4378
+ const value = serializeDefaultValue(def.defaultValue, schema, ctx, json, params);
4379
+ if (value !== UNREPRESENTABLE_DEFAULT) json.default = value;
3488
4380
  };
3489
4381
  const prefaultProcessor = (schema, ctx, json, params) => {
3490
4382
  const def = schema._zod.def;
3491
4383
  process(def.innerType, ctx, params);
3492
4384
  const seen = ctx.seen.get(schema);
3493
4385
  seen.ref = def.innerType;
3494
- if (ctx.io === "input") json._prefault = JSON.parse(JSON.stringify(def.defaultValue));
4386
+ if (ctx.io !== "input") return;
4387
+ const value = serializeDefaultValue(def.defaultValue, schema, ctx, json, params);
4388
+ if (value !== UNREPRESENTABLE_DEFAULT) json._prefault = value;
3495
4389
  };
3496
4390
  const catchProcessor = (schema, ctx, json, params) => {
3497
4391
  const def = schema._zod.def;
@@ -3502,7 +4396,8 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
3502
4396
  try {
3503
4397
  catchValue = def.catchValue(void 0);
3504
4398
  } catch {
3505
- throw new Error("Dynamic catch values are not supported in JSON Schema");
4399
+ handleUnrepresentable(schema, ctx, json, params, "Dynamic catch values are not supported in JSON Schema");
4400
+ return;
3506
4401
  }
3507
4402
  json.default = catchValue;
3508
4403
  };
@@ -3528,59 +4423,57 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
3528
4423
  seen.ref = def.innerType;
3529
4424
  };
3530
4425
  //#endregion
3531
- //#region node_modules/.pnpm/zod@4.4.3/node_modules/zod/v4/classic/iso.js
3532
- const ZodISODateTime = /*@__PURE__*/ $constructor("ZodISODateTime", (inst, def) => {
3533
- $ZodISODateTime.init(inst, def);
3534
- ZodStringFormat.init(inst, def);
3535
- });
3536
- function datetime(params) {
3537
- return /* @__PURE__ */ _isoDateTime(ZodISODateTime, params);
3538
- }
3539
- const ZodISODate = /*@__PURE__*/ $constructor("ZodISODate", (inst, def) => {
3540
- $ZodISODate.init(inst, def);
3541
- ZodStringFormat.init(inst, def);
3542
- });
3543
- function date(params) {
3544
- return /* @__PURE__ */ _isoDate(ZodISODate, params);
3545
- }
3546
- const ZodISOTime = /*@__PURE__*/ $constructor("ZodISOTime", (inst, def) => {
3547
- $ZodISOTime.init(inst, def);
3548
- ZodStringFormat.init(inst, def);
3549
- });
3550
- function time(params) {
3551
- return /* @__PURE__ */ _isoTime(ZodISOTime, params);
3552
- }
3553
- const ZodISODuration = /*@__PURE__*/ $constructor("ZodISODuration", (inst, def) => {
3554
- $ZodISODuration.init(inst, def);
3555
- ZodStringFormat.init(inst, def);
3556
- });
3557
- function duration(params) {
3558
- return /* @__PURE__ */ _isoDuration(ZodISODuration, params);
4426
+ //#region node_modules/.pnpm/zod@4.5.4/node_modules/zod/v4/classic/errors.js
4427
+ const _installedErrorProtos = /* @__PURE__ */ new WeakSet([Object.prototype, Error.prototype]);
4428
+ function _lazyMethod(proto, key, make) {
4429
+ Object.defineProperty(proto, key, {
4430
+ configurable: true,
4431
+ enumerable: false,
4432
+ get() {
4433
+ const value = make(this);
4434
+ Object.defineProperty(this, key, {
4435
+ value,
4436
+ configurable: true,
4437
+ writable: true
4438
+ });
4439
+ return value;
4440
+ },
4441
+ set(value) {
4442
+ Object.defineProperty(this, key, {
4443
+ value,
4444
+ configurable: true,
4445
+ writable: true
4446
+ });
4447
+ }
4448
+ });
3559
4449
  }
3560
- //#endregion
3561
- //#region node_modules/.pnpm/zod@4.4.3/node_modules/zod/v4/classic/errors.js
3562
4450
  const initializer = (inst, issues) => {
3563
4451
  $ZodError.init(inst, issues);
3564
4452
  inst.name = "ZodError";
3565
- Object.defineProperties(inst, {
3566
- format: { value: (mapper) => formatError(inst, mapper) },
3567
- flatten: { value: (mapper) => flattenError(inst, mapper) },
3568
- addIssue: { value: (issue) => {
3569
- inst.issues.push(issue);
3570
- inst.message = JSON.stringify(inst.issues, jsonStringifyReplacer, 2);
3571
- } },
3572
- addIssues: { value: (issues) => {
3573
- inst.issues.push(...issues);
3574
- inst.message = JSON.stringify(inst.issues, jsonStringifyReplacer, 2);
3575
- } },
3576
- isEmpty: { get() {
3577
- return inst.issues.length === 0;
3578
- } }
4453
+ const proto = Object.getPrototypeOf(inst);
4454
+ if (_installedErrorProtos.has(proto)) return;
4455
+ _installedErrorProtos.add(proto);
4456
+ _lazyMethod(proto, "format", (self) => (mapper) => formatError(self, mapper));
4457
+ _lazyMethod(proto, "flatten", (self) => (mapper) => flattenError(self, mapper));
4458
+ _lazyMethod(proto, "addIssue", (self) => (issue) => {
4459
+ self.issues.push(issue);
4460
+ self.message = JSON.stringify(self.issues, jsonStringifyReplacer, 2);
4461
+ });
4462
+ _lazyMethod(proto, "addIssues", (self) => (issues) => {
4463
+ self.issues.push(...issues);
4464
+ self.message = JSON.stringify(self.issues, jsonStringifyReplacer, 2);
4465
+ });
4466
+ Object.defineProperty(proto, "isEmpty", {
4467
+ configurable: true,
4468
+ enumerable: false,
4469
+ get() {
4470
+ return this.issues.length === 0;
4471
+ }
3579
4472
  });
3580
4473
  };
3581
- const ZodRealError = /*@__PURE__*/ $constructor("ZodError", initializer, { Parent: Error });
4474
+ const ZodRealError = /*@__PURE__*/ $constructor("ZodError", initializer, void 0, { Parent: Error });
3582
4475
  //#endregion
3583
- //#region node_modules/.pnpm/zod@4.4.3/node_modules/zod/v4/classic/parse.js
4476
+ //#region node_modules/.pnpm/zod@4.5.4/node_modules/zod/v4/classic/parse.js
3584
4477
  const parse = /* @__PURE__ */ _parse(ZodRealError);
3585
4478
  const parseAsync = /* @__PURE__ */ _parseAsync(ZodRealError);
3586
4479
  const safeParse = /* @__PURE__ */ _safeParse(ZodRealError);
@@ -3594,167 +4487,175 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
3594
4487
  const safeEncodeAsync = /* @__PURE__ */ _safeEncodeAsync(ZodRealError);
3595
4488
  const safeDecodeAsync = /* @__PURE__ */ _safeDecodeAsync(ZodRealError);
3596
4489
  //#endregion
3597
- //#region node_modules/.pnpm/zod@4.4.3/node_modules/zod/v4/classic/schemas.js
3598
- const _installedGroups = /* @__PURE__ */ new WeakMap();
3599
- function _installLazyMethods(inst, group, methods) {
3600
- const proto = Object.getPrototypeOf(inst);
3601
- let installed = _installedGroups.get(proto);
3602
- if (!installed) {
3603
- installed = /* @__PURE__ */ new Set();
3604
- _installedGroups.set(proto, installed);
3605
- }
3606
- if (installed.has(group)) return;
3607
- installed.add(group);
3608
- for (const key in methods) {
3609
- const fn = methods[key];
3610
- Object.defineProperty(proto, key, {
3611
- configurable: true,
3612
- enumerable: false,
3613
- get() {
3614
- const bound = fn.bind(this);
3615
- Object.defineProperty(this, key, {
3616
- configurable: true,
3617
- writable: true,
3618
- enumerable: true,
3619
- value: bound
3620
- });
3621
- return bound;
3622
- },
3623
- set(v) {
3624
- Object.defineProperty(this, key, {
3625
- configurable: true,
3626
- writable: true,
3627
- enumerable: true,
3628
- value: v
3629
- });
3630
- }
3631
- });
3632
- }
4490
+ //#region node_modules/.pnpm/zod@4.5.4/node_modules/zod/v4/classic/schemas.js
4491
+ function _ensureDefaultLocale() {
4492
+ if (!globalConfig.localeError) config(en_default());
4493
+ }
4494
+ function _ensureDefaultMemoizer() {
4495
+ if (!globalConfig.memoizer) config({ memoizer: memoizer() });
3633
4496
  }
3634
4497
  const ZodType = /*@__PURE__*/ $constructor("ZodType", (inst, def) => {
4498
+ _ensureDefaultLocale();
3635
4499
  $ZodType.init(inst, def);
3636
- Object.assign(inst["~standard"], { jsonSchema: {
3637
- input: createStandardJSONSchemaMethod(inst, "input"),
3638
- output: createStandardJSONSchemaMethod(inst, "output")
3639
- } });
3640
- inst.toJSONSchema = createToJSONSchemaMethod(inst, {});
3641
4500
  inst.def = def;
3642
4501
  inst.type = def.type;
3643
- Object.defineProperty(inst, "_def", { value: def });
3644
- inst.parse = (data, params) => parse(inst, data, params, { callee: inst.parse });
3645
- inst.safeParse = (data, params) => safeParse(inst, data, params);
3646
- inst.parseAsync = async (data, params) => parseAsync(inst, data, params, { callee: inst.parseAsync });
3647
- inst.safeParseAsync = async (data, params) => safeParseAsync(inst, data, params);
3648
- inst.spa = inst.safeParseAsync;
3649
- inst.encode = (data, params) => encode(inst, data, params);
3650
- inst.decode = (data, params) => decode(inst, data, params);
3651
- inst.encodeAsync = async (data, params) => encodeAsync(inst, data, params);
3652
- inst.decodeAsync = async (data, params) => decodeAsync(inst, data, params);
3653
- inst.safeEncode = (data, params) => safeEncode(inst, data, params);
3654
- inst.safeDecode = (data, params) => safeDecode(inst, data, params);
3655
- inst.safeEncodeAsync = async (data, params) => safeEncodeAsync(inst, data, params);
3656
- inst.safeDecodeAsync = async (data, params) => safeDecodeAsync(inst, data, params);
3657
- _installLazyMethods(inst, "ZodType", {
3658
- check(...chks) {
3659
- const def = this.def;
3660
- return this.clone(mergeDefs(def, { checks: [...def.checks ?? [], ...chks.map((ch) => typeof ch === "function" ? { _zod: {
3661
- check: ch,
3662
- def: { check: "custom" },
3663
- onattach: []
3664
- } } : ch)] }), { parent: true });
3665
- },
3666
- with(...chks) {
3667
- return this.check(...chks);
3668
- },
3669
- clone(def, params) {
3670
- return clone(this, def, params);
3671
- },
3672
- brand() {
3673
- return this;
3674
- },
3675
- register(reg, meta) {
3676
- reg.add(this, meta);
3677
- return this;
3678
- },
3679
- refine(check, params) {
3680
- return this.check(refine(check, params));
3681
- },
3682
- superRefine(refinement, params) {
3683
- return this.check(superRefine(refinement, params));
3684
- },
3685
- overwrite(fn) {
3686
- return this.check(/* @__PURE__ */ _overwrite(fn));
3687
- },
3688
- optional() {
3689
- return optional(this);
3690
- },
3691
- exactOptional() {
3692
- return exactOptional(this);
3693
- },
3694
- nullable() {
3695
- return nullable(this);
3696
- },
3697
- nullish() {
3698
- return optional(nullable(this));
3699
- },
3700
- nonoptional(params) {
3701
- return nonoptional(this, params);
3702
- },
3703
- array() {
3704
- return array(this);
3705
- },
3706
- or(arg) {
3707
- return union([this, arg]);
3708
- },
3709
- and(arg) {
3710
- return intersection(this, arg);
3711
- },
3712
- transform(tx) {
3713
- return pipe(this, transform(tx));
3714
- },
3715
- default(d) {
3716
- return _default(this, d);
3717
- },
3718
- prefault(d) {
3719
- return prefault(this, d);
3720
- },
3721
- catch(params) {
3722
- return _catch(this, params);
3723
- },
3724
- pipe(target) {
3725
- return pipe(this, target);
3726
- },
3727
- readonly() {
3728
- return readonly(this);
3729
- },
3730
- describe(description) {
3731
- const cl = this.clone();
3732
- globalRegistry.add(cl, { description });
3733
- return cl;
3734
- },
3735
- meta(...args) {
3736
- if (args.length === 0) return globalRegistry.get(this);
3737
- const cl = this.clone();
3738
- globalRegistry.add(cl, args[0]);
3739
- return cl;
3740
- },
3741
- isOptional() {
3742
- return this.safeParse(void 0).success;
3743
- },
3744
- isNullable() {
3745
- return this.safeParse(null).success;
3746
- },
3747
- apply(fn) {
3748
- return fn(this);
3749
- }
3750
- });
3751
- Object.defineProperty(inst, "description", {
3752
- get() {
3753
- return globalRegistry.get(inst)?.description;
3754
- },
3755
- configurable: true
3756
- });
3757
4502
  return inst;
4503
+ }, {
4504
+ check(...chks) {
4505
+ const def = this.def;
4506
+ return this.clone(mergeDefs(def, { checks: [...def.checks ?? [], ...chks.map((ch) => typeof ch === "function" ? { _zod: {
4507
+ check: ch,
4508
+ def: { check: "custom" },
4509
+ onattach: []
4510
+ } } : ch)] }), { parent: true });
4511
+ },
4512
+ with(...chks) {
4513
+ return this.check(...chks);
4514
+ },
4515
+ clone(def, params) {
4516
+ return clone(this, def, params);
4517
+ },
4518
+ brand() {
4519
+ return this;
4520
+ },
4521
+ register(reg, meta) {
4522
+ reg.add(this, meta);
4523
+ return this;
4524
+ },
4525
+ refine(check, params) {
4526
+ return this.check(refine(check, params));
4527
+ },
4528
+ superRefine(refinement, params) {
4529
+ return this.check(superRefine(refinement, params));
4530
+ },
4531
+ overwrite(fn) {
4532
+ return this.check(/* @__PURE__ */ _overwrite(fn));
4533
+ },
4534
+ optional() {
4535
+ return optional(this);
4536
+ },
4537
+ exactOptional() {
4538
+ return exactOptional(this);
4539
+ },
4540
+ nullable() {
4541
+ return nullable(this);
4542
+ },
4543
+ nullish() {
4544
+ return optional(nullable(this));
4545
+ },
4546
+ nonoptional(params) {
4547
+ return nonoptional(this, params);
4548
+ },
4549
+ array() {
4550
+ return array(this);
4551
+ },
4552
+ or(arg) {
4553
+ return union([this, arg]);
4554
+ },
4555
+ and(arg) {
4556
+ return intersection(this, arg);
4557
+ },
4558
+ transform(tx) {
4559
+ return pipe(this, transform(tx));
4560
+ },
4561
+ default(d) {
4562
+ return _default(this, d);
4563
+ },
4564
+ prefault(d) {
4565
+ return prefault(this, d);
4566
+ },
4567
+ catch(params) {
4568
+ return _catch(this, params);
4569
+ },
4570
+ pipe(target) {
4571
+ return pipe(this, target);
4572
+ },
4573
+ readonly() {
4574
+ return readonly(this);
4575
+ },
4576
+ describe(description) {
4577
+ const cl = this.clone();
4578
+ globalRegistry.add(cl, { description });
4579
+ return cl;
4580
+ },
4581
+ meta(...args) {
4582
+ if (args.length === 0) return globalRegistry.get(this);
4583
+ const cl = this.clone();
4584
+ globalRegistry.add(cl, args[0]);
4585
+ return cl;
4586
+ },
4587
+ isOptional() {
4588
+ return this.safeParse(void 0).success;
4589
+ },
4590
+ isNullable() {
4591
+ return this.safeParse(null).success;
4592
+ },
4593
+ apply(fn, ...args) {
4594
+ return args.length === 0 ? fn(this) : fn(this, ...args);
4595
+ },
4596
+ get "~standard"() {
4597
+ return hide(this, "~standard", {
4598
+ ...standardProps(this),
4599
+ jsonSchema: {
4600
+ input: createStandardJSONSchemaMethod(this, "input"),
4601
+ output: createStandardJSONSchemaMethod(this, "output")
4602
+ }
4603
+ });
4604
+ },
4605
+ set "~standard"(value) {
4606
+ own(this, "~standard", value);
4607
+ },
4608
+ parse: function _parse(data, params) {
4609
+ return parse(this, data, params, { callee: _parse });
4610
+ },
4611
+ parseAsync: async function _parseAsync(data, params) {
4612
+ return await parseAsync(this, data, params, { callee: _parseAsync });
4613
+ },
4614
+ safeParse(data, params) {
4615
+ return safeParse(this, data, params);
4616
+ },
4617
+ async safeParseAsync(data, params) {
4618
+ return safeParseAsync(this, data, params);
4619
+ },
4620
+ get spa() {
4621
+ return this?.safeParseAsync;
4622
+ },
4623
+ set spa(value) {
4624
+ own(this, "spa", value);
4625
+ },
4626
+ encode: function _encode(data, params) {
4627
+ return encode(this, data, params, { callee: _encode });
4628
+ },
4629
+ decode: function _decode(data, params) {
4630
+ return decode(this, data, params, { callee: _decode });
4631
+ },
4632
+ encodeAsync: async function _encodeAsync(data, params) {
4633
+ return await encodeAsync(this, data, params, { callee: _encodeAsync });
4634
+ },
4635
+ decodeAsync: async function _decodeAsync(data, params) {
4636
+ return await decodeAsync(this, data, params, { callee: _decodeAsync });
4637
+ },
4638
+ safeEncode(data, params) {
4639
+ return safeEncode(this, data, params);
4640
+ },
4641
+ safeDecode(data, params) {
4642
+ return safeDecode(this, data, params);
4643
+ },
4644
+ async safeEncodeAsync(data, params) {
4645
+ return safeEncodeAsync(this, data, params);
4646
+ },
4647
+ async safeDecodeAsync(data, params) {
4648
+ return safeDecodeAsync(this, data, params);
4649
+ },
4650
+ toJSONSchema(params) {
4651
+ return createToJSONSchemaMethod(this, {})(params);
4652
+ },
4653
+ get description() {
4654
+ return globalRegistry.get(this)?.description;
4655
+ },
4656
+ get _def() {
4657
+ return this._zod.def;
4658
+ }
3758
4659
  });
3759
4660
  /** @internal */
3760
4661
  const _ZodString = /*@__PURE__*/ $constructor("_ZodString", (inst, def) => {
@@ -3765,84 +4666,135 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
3765
4666
  inst.format = bag.format ?? null;
3766
4667
  inst.minLength = bag.minimum ?? null;
3767
4668
  inst.maxLength = bag.maximum ?? null;
3768
- _installLazyMethods(inst, "_ZodString", {
3769
- regex(...args) {
3770
- return this.check(/* @__PURE__ */ _regex(...args));
3771
- },
3772
- includes(...args) {
3773
- return this.check(/* @__PURE__ */ _includes(...args));
3774
- },
3775
- startsWith(...args) {
3776
- return this.check(/* @__PURE__ */ _startsWith(...args));
3777
- },
3778
- endsWith(...args) {
3779
- return this.check(/* @__PURE__ */ _endsWith(...args));
3780
- },
3781
- min(...args) {
3782
- return this.check(/* @__PURE__ */ _minLength(...args));
3783
- },
3784
- max(...args) {
3785
- return this.check(/* @__PURE__ */ _maxLength(...args));
3786
- },
3787
- length(...args) {
3788
- return this.check(/* @__PURE__ */ _length(...args));
3789
- },
3790
- nonempty(...args) {
3791
- return this.check(/* @__PURE__ */ _minLength(1, ...args));
3792
- },
3793
- lowercase(params) {
3794
- return this.check(/* @__PURE__ */ _lowercase(params));
3795
- },
3796
- uppercase(params) {
3797
- return this.check(/* @__PURE__ */ _uppercase(params));
3798
- },
3799
- trim() {
3800
- return this.check(/* @__PURE__ */ _trim());
3801
- },
3802
- normalize(...args) {
3803
- return this.check(/* @__PURE__ */ _normalize(...args));
3804
- },
3805
- toLowerCase() {
3806
- return this.check(/* @__PURE__ */ _toLowerCase());
3807
- },
3808
- toUpperCase() {
3809
- return this.check(/* @__PURE__ */ _toUpperCase());
3810
- },
3811
- slugify() {
3812
- return this.check(/* @__PURE__ */ _slugify());
3813
- }
3814
- });
4669
+ }, {
4670
+ regex(...args) {
4671
+ return this.check(/* @__PURE__ */ _regex(...args));
4672
+ },
4673
+ includes(...args) {
4674
+ return this.check(/* @__PURE__ */ _includes(...args));
4675
+ },
4676
+ startsWith(...args) {
4677
+ return this.check(/* @__PURE__ */ _startsWith(...args));
4678
+ },
4679
+ endsWith(...args) {
4680
+ return this.check(/* @__PURE__ */ _endsWith(...args));
4681
+ },
4682
+ min(...args) {
4683
+ return this.check(/* @__PURE__ */ _minLength(...args));
4684
+ },
4685
+ max(...args) {
4686
+ return this.check(/* @__PURE__ */ _maxLength(...args));
4687
+ },
4688
+ length(...args) {
4689
+ return this.check(/* @__PURE__ */ _length(...args));
4690
+ },
4691
+ nonempty(...args) {
4692
+ return this.check(/* @__PURE__ */ _minLength(1, ...args));
4693
+ },
4694
+ lowercase(params) {
4695
+ return this.check(/* @__PURE__ */ _lowercase(params));
4696
+ },
4697
+ uppercase(params) {
4698
+ return this.check(/* @__PURE__ */ _uppercase(params));
4699
+ },
4700
+ trim() {
4701
+ return this.check(/* @__PURE__ */ _trim());
4702
+ },
4703
+ normalize(...args) {
4704
+ return this.check(/* @__PURE__ */ _normalize(...args));
4705
+ },
4706
+ toLowerCase() {
4707
+ return this.check(/* @__PURE__ */ _toLowerCase());
4708
+ },
4709
+ toUpperCase() {
4710
+ return this.check(/* @__PURE__ */ _toUpperCase());
4711
+ },
4712
+ slugify() {
4713
+ return this.check(/* @__PURE__ */ _slugify());
4714
+ }
3815
4715
  });
3816
4716
  const ZodString = /*@__PURE__*/ $constructor("ZodString", (inst, def) => {
3817
4717
  $ZodString.init(inst, def);
3818
4718
  _ZodString.init(inst, def);
3819
- inst.email = (params) => inst.check(/* @__PURE__ */ _email(ZodEmail, params));
3820
- inst.url = (params) => inst.check(/* @__PURE__ */ _url(ZodURL, params));
3821
- inst.jwt = (params) => inst.check(/* @__PURE__ */ _jwt(ZodJWT, params));
3822
- inst.emoji = (params) => inst.check(/* @__PURE__ */ _emoji(ZodEmoji, params));
3823
- inst.guid = (params) => inst.check(/* @__PURE__ */ _guid(ZodGUID, params));
3824
- inst.uuid = (params) => inst.check(/* @__PURE__ */ _uuid(ZodUUID, params));
3825
- inst.uuidv4 = (params) => inst.check(/* @__PURE__ */ _uuidv4(ZodUUID, params));
3826
- inst.uuidv6 = (params) => inst.check(/* @__PURE__ */ _uuidv6(ZodUUID, params));
3827
- inst.uuidv7 = (params) => inst.check(/* @__PURE__ */ _uuidv7(ZodUUID, params));
3828
- inst.nanoid = (params) => inst.check(/* @__PURE__ */ _nanoid(ZodNanoID, params));
3829
- inst.guid = (params) => inst.check(/* @__PURE__ */ _guid(ZodGUID, params));
3830
- inst.cuid = (params) => inst.check(/* @__PURE__ */ _cuid(ZodCUID, params));
3831
- inst.cuid2 = (params) => inst.check(/* @__PURE__ */ _cuid2(ZodCUID2, params));
3832
- inst.ulid = (params) => inst.check(/* @__PURE__ */ _ulid(ZodULID, params));
3833
- inst.base64 = (params) => inst.check(/* @__PURE__ */ _base64(ZodBase64, params));
3834
- inst.base64url = (params) => inst.check(/* @__PURE__ */ _base64url(ZodBase64URL, params));
3835
- inst.xid = (params) => inst.check(/* @__PURE__ */ _xid(ZodXID, params));
3836
- inst.ksuid = (params) => inst.check(/* @__PURE__ */ _ksuid(ZodKSUID, params));
3837
- inst.ipv4 = (params) => inst.check(/* @__PURE__ */ _ipv4(ZodIPv4, params));
3838
- inst.ipv6 = (params) => inst.check(/* @__PURE__ */ _ipv6(ZodIPv6, params));
3839
- inst.cidrv4 = (params) => inst.check(/* @__PURE__ */ _cidrv4(ZodCIDRv4, params));
3840
- inst.cidrv6 = (params) => inst.check(/* @__PURE__ */ _cidrv6(ZodCIDRv6, params));
3841
- inst.e164 = (params) => inst.check(/* @__PURE__ */ _e164(ZodE164, params));
3842
- inst.datetime = (params) => inst.check(datetime(params));
3843
- inst.date = (params) => inst.check(date(params));
3844
- inst.time = (params) => inst.check(time(params));
3845
- inst.duration = (params) => inst.check(duration(params));
4719
+ }, {
4720
+ email(params) {
4721
+ return this.check(/* @__PURE__ */ _email(ZodEmail, params));
4722
+ },
4723
+ url(params) {
4724
+ return this.check(/* @__PURE__ */ _url(ZodURL, params));
4725
+ },
4726
+ jwt(params) {
4727
+ return this.check(/* @__PURE__ */ _jwt(ZodJWT, params));
4728
+ },
4729
+ emoji(params) {
4730
+ return this.check(/* @__PURE__ */ _emoji(ZodEmoji, params));
4731
+ },
4732
+ guid(params) {
4733
+ return this.check(/* @__PURE__ */ _guid(ZodGUID, params));
4734
+ },
4735
+ uuid(params) {
4736
+ return this.check(/* @__PURE__ */ _uuid(ZodUUID, params));
4737
+ },
4738
+ uuidv4(params) {
4739
+ return this.check(/* @__PURE__ */ _uuidv4(ZodUUID, params));
4740
+ },
4741
+ uuidv6(params) {
4742
+ return this.check(/* @__PURE__ */ _uuidv6(ZodUUID, params));
4743
+ },
4744
+ uuidv7(params) {
4745
+ return this.check(/* @__PURE__ */ _uuidv7(ZodUUID, params));
4746
+ },
4747
+ nanoid(params) {
4748
+ return this.check(/* @__PURE__ */ _nanoid(ZodNanoID, params));
4749
+ },
4750
+ cuid(params) {
4751
+ return this.check(/* @__PURE__ */ _cuid(ZodCUID, params));
4752
+ },
4753
+ cuid2(params) {
4754
+ return this.check(/* @__PURE__ */ _cuid2(ZodCUID2, params));
4755
+ },
4756
+ ulid(params) {
4757
+ return this.check(/* @__PURE__ */ _ulid(ZodULID, params));
4758
+ },
4759
+ base64(params) {
4760
+ return this.check(/* @__PURE__ */ _base64(ZodBase64, params));
4761
+ },
4762
+ base64url(params) {
4763
+ return this.check(/* @__PURE__ */ _base64url(ZodBase64URL, params));
4764
+ },
4765
+ xid(params) {
4766
+ return this.check(/* @__PURE__ */ _xid(ZodXID, params));
4767
+ },
4768
+ ksuid(params) {
4769
+ return this.check(/* @__PURE__ */ _ksuid(ZodKSUID, params));
4770
+ },
4771
+ ipv4(params) {
4772
+ return this.check(/* @__PURE__ */ _ipv4(ZodIPv4, params));
4773
+ },
4774
+ ipv6(params) {
4775
+ return this.check(/* @__PURE__ */ _ipv6(ZodIPv6, params));
4776
+ },
4777
+ cidrv4(params) {
4778
+ return this.check(/* @__PURE__ */ _cidrv4(ZodCIDRv4, params));
4779
+ },
4780
+ cidrv6(params) {
4781
+ return this.check(/* @__PURE__ */ _cidrv6(ZodCIDRv6, params));
4782
+ },
4783
+ e164(params) {
4784
+ return this.check(/* @__PURE__ */ _e164(ZodE164, params));
4785
+ },
4786
+ datetime(params) {
4787
+ return this.check(/* @__PURE__ */ _isoDateTime(ZodISODateTime, params));
4788
+ },
4789
+ date(params) {
4790
+ return this.check(/* @__PURE__ */ _isoDate(ZodISODate, params));
4791
+ },
4792
+ time(params) {
4793
+ return this.check(/* @__PURE__ */ _isoTime(ZodISOTime, params));
4794
+ },
4795
+ duration(params) {
4796
+ return this.check(/* @__PURE__ */ _isoDuration(ZodISODuration, params));
4797
+ }
3846
4798
  });
3847
4799
  function string(params) {
3848
4800
  return /* @__PURE__ */ _string(ZodString, params);
@@ -3851,6 +4803,22 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
3851
4803
  $ZodStringFormat.init(inst, def);
3852
4804
  _ZodString.init(inst, def);
3853
4805
  });
4806
+ const ZodISODateTime = /*@__PURE__*/ $constructor("ZodISODateTime", (inst, def) => {
4807
+ $ZodISODateTime.init(inst, def);
4808
+ ZodStringFormat.init(inst, def);
4809
+ });
4810
+ const ZodISODate = /*@__PURE__*/ $constructor("ZodISODate", (inst, def) => {
4811
+ $ZodISODate.init(inst, def);
4812
+ ZodStringFormat.init(inst, def);
4813
+ });
4814
+ const ZodISOTime = /*@__PURE__*/ $constructor("ZodISOTime", (inst, def) => {
4815
+ $ZodISOTime.init(inst, def);
4816
+ ZodStringFormat.init(inst, def);
4817
+ });
4818
+ const ZodISODuration = /*@__PURE__*/ $constructor("ZodISODuration", (inst, def) => {
4819
+ $ZodISODuration.init(inst, def);
4820
+ ZodStringFormat.init(inst, def);
4821
+ });
3854
4822
  const ZodEmail = /*@__PURE__*/ $constructor("ZodEmail", (inst, def) => {
3855
4823
  $ZodEmail.init(inst, def);
3856
4824
  ZodStringFormat.init(inst, def);
@@ -3936,59 +4904,58 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
3936
4904
  $ZodNumber.init(inst, def);
3937
4905
  ZodType.init(inst, def);
3938
4906
  inst._zod.processJSONSchema = (ctx, json, params) => numberProcessor(inst, ctx, json, params);
3939
- _installLazyMethods(inst, "ZodNumber", {
3940
- gt(value, params) {
3941
- return this.check(/* @__PURE__ */ _gt(value, params));
3942
- },
3943
- gte(value, params) {
3944
- return this.check(/* @__PURE__ */ _gte(value, params));
3945
- },
3946
- min(value, params) {
3947
- return this.check(/* @__PURE__ */ _gte(value, params));
3948
- },
3949
- lt(value, params) {
3950
- return this.check(/* @__PURE__ */ _lt(value, params));
3951
- },
3952
- lte(value, params) {
3953
- return this.check(/* @__PURE__ */ _lte(value, params));
3954
- },
3955
- max(value, params) {
3956
- return this.check(/* @__PURE__ */ _lte(value, params));
3957
- },
3958
- int(params) {
3959
- return this.check(int(params));
3960
- },
3961
- safe(params) {
3962
- return this.check(int(params));
3963
- },
3964
- positive(params) {
3965
- return this.check(/* @__PURE__ */ _gt(0, params));
3966
- },
3967
- nonnegative(params) {
3968
- return this.check(/* @__PURE__ */ _gte(0, params));
3969
- },
3970
- negative(params) {
3971
- return this.check(/* @__PURE__ */ _lt(0, params));
3972
- },
3973
- nonpositive(params) {
3974
- return this.check(/* @__PURE__ */ _lte(0, params));
3975
- },
3976
- multipleOf(value, params) {
3977
- return this.check(/* @__PURE__ */ _multipleOf(value, params));
3978
- },
3979
- step(value, params) {
3980
- return this.check(/* @__PURE__ */ _multipleOf(value, params));
3981
- },
3982
- finite() {
3983
- return this;
3984
- }
3985
- });
3986
4907
  const bag = inst._zod.bag;
3987
4908
  inst.minValue = Math.max(bag.minimum ?? Number.NEGATIVE_INFINITY, bag.exclusiveMinimum ?? Number.NEGATIVE_INFINITY) ?? null;
3988
4909
  inst.maxValue = Math.min(bag.maximum ?? Number.POSITIVE_INFINITY, bag.exclusiveMaximum ?? Number.POSITIVE_INFINITY) ?? null;
3989
4910
  inst.isInt = (bag.format ?? "").includes("int") || Number.isSafeInteger(bag.multipleOf ?? .5);
3990
4911
  inst.isFinite = true;
3991
4912
  inst.format = bag.format ?? null;
4913
+ }, {
4914
+ gt(value, params) {
4915
+ return this.check(/* @__PURE__ */ _gt(value, params));
4916
+ },
4917
+ gte(value, params) {
4918
+ return this.check(/* @__PURE__ */ _gte(value, params));
4919
+ },
4920
+ min(value, params) {
4921
+ return this.check(/* @__PURE__ */ _gte(value, params));
4922
+ },
4923
+ lt(value, params) {
4924
+ return this.check(/* @__PURE__ */ _lt(value, params));
4925
+ },
4926
+ lte(value, params) {
4927
+ return this.check(/* @__PURE__ */ _lte(value, params));
4928
+ },
4929
+ max(value, params) {
4930
+ return this.check(/* @__PURE__ */ _lte(value, params));
4931
+ },
4932
+ int(params) {
4933
+ return this.check(int(params));
4934
+ },
4935
+ safe(params) {
4936
+ return this.check(int(params));
4937
+ },
4938
+ positive(params) {
4939
+ return this.check(/* @__PURE__ */ _gt(0, params));
4940
+ },
4941
+ nonnegative(params) {
4942
+ return this.check(/* @__PURE__ */ _gte(0, params));
4943
+ },
4944
+ negative(params) {
4945
+ return this.check(/* @__PURE__ */ _lt(0, params));
4946
+ },
4947
+ nonpositive(params) {
4948
+ return this.check(/* @__PURE__ */ _lte(0, params));
4949
+ },
4950
+ multipleOf(value, params) {
4951
+ return this.check(/* @__PURE__ */ _multipleOf(value, params));
4952
+ },
4953
+ step(value, params) {
4954
+ return this.check(/* @__PURE__ */ _multipleOf(value, params));
4955
+ },
4956
+ finite() {
4957
+ return this;
4958
+ }
3992
4959
  });
3993
4960
  function number(params) {
3994
4961
  return /* @__PURE__ */ _number(ZodNumber, params);
@@ -4025,94 +4992,95 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
4025
4992
  return /* @__PURE__ */ _never(ZodNever, params);
4026
4993
  }
4027
4994
  const ZodArray = /*@__PURE__*/ $constructor("ZodArray", (inst, def) => {
4995
+ _ensureDefaultMemoizer();
4028
4996
  $ZodArray.init(inst, def);
4029
4997
  ZodType.init(inst, def);
4030
4998
  inst._zod.processJSONSchema = (ctx, json, params) => arrayProcessor(inst, ctx, json, params);
4031
4999
  inst.element = def.element;
4032
- _installLazyMethods(inst, "ZodArray", {
4033
- min(n, params) {
4034
- return this.check(/* @__PURE__ */ _minLength(n, params));
4035
- },
4036
- nonempty(params) {
4037
- return this.check(/* @__PURE__ */ _minLength(1, params));
4038
- },
4039
- max(n, params) {
4040
- return this.check(/* @__PURE__ */ _maxLength(n, params));
4041
- },
4042
- length(n, params) {
4043
- return this.check(/* @__PURE__ */ _length(n, params));
4044
- },
4045
- unwrap() {
4046
- return this.element;
4047
- }
4048
- });
5000
+ }, {
5001
+ min(n, params) {
5002
+ return this.check(/* @__PURE__ */ _minLength(n, params));
5003
+ },
5004
+ nonempty(params) {
5005
+ return this.check(/* @__PURE__ */ _minLength(1, params));
5006
+ },
5007
+ max(n, params) {
5008
+ return this.check(/* @__PURE__ */ _maxLength(n, params));
5009
+ },
5010
+ length(n, params) {
5011
+ return this.check(/* @__PURE__ */ _length(n, params));
5012
+ },
5013
+ unwrap() {
5014
+ return this.element;
5015
+ }
4049
5016
  });
4050
5017
  function array(element, params) {
4051
5018
  return /* @__PURE__ */ _array(ZodArray, element, params);
4052
5019
  }
4053
5020
  const ZodObject = /*@__PURE__*/ $constructor("ZodObject", (inst, def) => {
5021
+ _ensureDefaultMemoizer();
4054
5022
  $ZodObjectJIT.init(inst, def);
4055
5023
  ZodType.init(inst, def);
4056
5024
  inst._zod.processJSONSchema = (ctx, json, params) => objectProcessor(inst, ctx, json, params);
4057
- defineLazy(inst, "shape", () => {
4058
- return def.shape;
4059
- });
4060
- _installLazyMethods(inst, "ZodObject", {
4061
- keyof() {
4062
- return _enum(Object.keys(this._zod.def.shape));
4063
- },
4064
- catchall(catchall) {
4065
- return this.clone({
4066
- ...this._zod.def,
4067
- catchall
4068
- });
4069
- },
4070
- passthrough() {
4071
- return this.clone({
4072
- ...this._zod.def,
4073
- catchall: unknown()
4074
- });
4075
- },
4076
- loose() {
4077
- return this.clone({
4078
- ...this._zod.def,
4079
- catchall: unknown()
4080
- });
4081
- },
4082
- strict() {
4083
- return this.clone({
4084
- ...this._zod.def,
4085
- catchall: never()
4086
- });
4087
- },
4088
- strip() {
4089
- return this.clone({
4090
- ...this._zod.def,
4091
- catchall: void 0
4092
- });
4093
- },
4094
- extend(incoming) {
4095
- return extend(this, incoming);
4096
- },
4097
- safeExtend(incoming) {
4098
- return safeExtend(this, incoming);
4099
- },
4100
- merge(other) {
4101
- return merge(this, other);
4102
- },
4103
- pick(mask) {
4104
- return pick(this, mask);
4105
- },
4106
- omit(mask) {
4107
- return omit(this, mask);
4108
- },
4109
- partial(...args) {
4110
- return partial(ZodOptional, this, args[0]);
4111
- },
4112
- required(...args) {
4113
- return required(ZodNonOptional, this, args[0]);
4114
- }
4115
- });
5025
+ installLazyProp(inst, "shape", (self) => self._zod.def.shape, false);
5026
+ }, {
5027
+ keyof() {
5028
+ return _enum(Object.keys(this._zod.def.shape));
5029
+ },
5030
+ catchall(catchall) {
5031
+ return this.clone({
5032
+ ...this._zod.def,
5033
+ catchall
5034
+ });
5035
+ },
5036
+ passthrough() {
5037
+ return this.clone({
5038
+ ...this._zod.def,
5039
+ catchall: unknown()
5040
+ });
5041
+ },
5042
+ loose() {
5043
+ return this.clone({
5044
+ ...this._zod.def,
5045
+ catchall: unknown()
5046
+ });
5047
+ },
5048
+ strict() {
5049
+ return this.clone({
5050
+ ...this._zod.def,
5051
+ catchall: never()
5052
+ });
5053
+ },
5054
+ strip() {
5055
+ return this.clone({
5056
+ ...this._zod.def,
5057
+ catchall: void 0
5058
+ });
5059
+ },
5060
+ extend(incoming) {
5061
+ return extend(this, incoming);
5062
+ },
5063
+ safeExtend(incoming) {
5064
+ return safeExtend(this, incoming);
5065
+ },
5066
+ merge(other) {
5067
+ return merge(this, other);
5068
+ },
5069
+ pick(mask) {
5070
+ return pick(this, mask);
5071
+ },
5072
+ omit(mask) {
5073
+ return omit(this, mask);
5074
+ },
5075
+ partial(...args) {
5076
+ return partial(ZodOptional, this, args[0]);
5077
+ },
5078
+ exactPartial(...args) {
5079
+ return partial(ZodExactOptional, this, args[0], "exactPartial");
5080
+ },
5081
+ required(...args) {
5082
+ return required(ZodNonOptional, this, args[0]);
5083
+ }
4116
5084
  });
4117
5085
  function object(shape, params) {
4118
5086
  const def = {
@@ -4203,6 +5171,7 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
4203
5171
  });
4204
5172
  }
4205
5173
  const ZodTransform = /*@__PURE__*/ $constructor("ZodTransform", (inst, def) => {
5174
+ _ensureDefaultMemoizer();
4206
5175
  $ZodTransform.init(inst, def);
4207
5176
  ZodType.init(inst, def);
4208
5177
  inst._zod.processJSONSchema = (ctx, json, params) => transformProcessor(inst, ctx, json, params);
@@ -4214,7 +5183,7 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
4214
5183
  const _issue = issue$1;
4215
5184
  if (_issue.fatal) _issue.continue = false;
4216
5185
  _issue.code ?? (_issue.code = "custom");
4217
- _issue.input ?? (_issue.input = payload.value);
5186
+ if (!("input" in _issue)) _issue.input = payload.value;
4218
5187
  _issue.inst ?? (_issue.inst = inst);
4219
5188
  payload.issues.push(issue(_issue));
4220
5189
  }
@@ -4222,11 +5191,9 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
4222
5191
  const output = def.transform(payload.value, payload);
4223
5192
  if (output instanceof Promise) return output.then((output) => {
4224
5193
  payload.value = output;
4225
- payload.fallback = true;
4226
5194
  return payload;
4227
5195
  });
4228
5196
  payload.value = output;
4229
- payload.fallback = true;
4230
5197
  return payload;
4231
5198
  };
4232
5199
  });
@@ -4327,7 +5294,7 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
4327
5294
  return new ZodCatch({
4328
5295
  type: "catch",
4329
5296
  innerType,
4330
- catchValue: typeof catchValue === "function" ? catchValue : () => catchValue
5297
+ catchValue: typeof catchValue === "function" ? catchValue : constantCatch(catchValue)
4331
5298
  });
4332
5299
  }
4333
5300
  const ZodPipe = /*@__PURE__*/ $constructor("ZodPipe", (inst, def) => {
@@ -4724,11 +5691,12 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
4724
5691
  await ctx.remote.$mount(DRAW_REMOTE);
4725
5692
  ctx.inject(["remote.draw"], (scope) => {
4726
5693
  const t = scope.locale.bind(NS);
5694
+ const slots = scope.get("slots");
4727
5695
  const unwrap = (result, method) => {
4728
5696
  if (!result.ok) throw new Error(`draw.${method} failed: ${result.error.code}: ${result.error.message}`);
4729
5697
  return result.value;
4730
5698
  };
4731
- scope.slots.inject("tool.call.toolview", () => scope.slots.register({
5699
+ slots.inject("tool.call.toolview", () => slots.register({
4732
5700
  name: "tool.call.toolview",
4733
5701
  key: "image_generate",
4734
5702
  locale: NS,
@@ -4738,7 +5706,7 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
4738
5706
  unwrap(await scope.remote.draw.regenerate(sessionId, args), "regenerate");
4739
5707
  } })
4740
5708
  }, DrawResultCard));
4741
- scope.slots.inject("settings.plugins.tab", () => scope.slots.register({
5709
+ slots.inject("settings.plugins.tab", () => slots.register({
4742
5710
  name: "settings.plugins.tab",
4743
5711
  id: "draw",
4744
5712
  order: 40,