@avantf/dsh-mem 0.1.1 → 0.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (40) hide show
  1. package/LICENSE +1 -1
  2. package/README.md +97 -87
  3. package/lib/client.js +2351 -1170
  4. package/lib/client.js.map +1 -1
  5. package/lib/index.js +1063 -639
  6. package/lib/interface-version.json +4 -0
  7. package/lib/types/client/index.d.ts.map +1 -1
  8. package/lib/types/client/index.js +21 -1
  9. package/lib/types/client/index.js.map +1 -1
  10. package/lib/types/data_home.d.ts +3 -0
  11. package/lib/types/data_home.d.ts.map +1 -0
  12. package/lib/types/data_home.js +26 -0
  13. package/lib/types/data_home.js.map +1 -0
  14. package/lib/types/envinit-bootstrap.d.ts +13 -3
  15. package/lib/types/envinit-bootstrap.js +14 -4
  16. package/lib/types/envinit.d.ts +11 -6
  17. package/lib/types/envinit.d.ts.map +1 -1
  18. package/lib/types/envinit.js +62 -155
  19. package/lib/types/envinit.js.map +1 -1
  20. package/lib/types/index.d.ts +33 -11
  21. package/lib/types/index.d.ts.map +1 -1
  22. package/lib/types/index.js +86 -39
  23. package/lib/types/index.js.map +1 -1
  24. package/lib/types/interface_gate.d.ts +51 -0
  25. package/lib/types/interface_gate.d.ts.map +1 -0
  26. package/lib/types/interface_gate.js +84 -0
  27. package/lib/types/interface_gate.js.map +1 -0
  28. package/lib/types/prompt.d.ts +74 -4
  29. package/lib/types/prompt.d.ts.map +1 -1
  30. package/lib/types/prompt.js +85 -2
  31. package/lib/types/prompt.js.map +1 -1
  32. package/lib/types/provision.d.ts +29 -24
  33. package/lib/types/provision.d.ts.map +1 -1
  34. package/lib/types/provision.js +3 -59
  35. package/lib/types/provision.js.map +1 -1
  36. package/lib/types/remote.d.ts +7 -3
  37. package/lib/types/remote.d.ts.map +1 -1
  38. package/lib/types/remote.js +14 -4
  39. package/lib/types/remote.js.map +1 -1
  40. package/package.json +17 -19
package/lib/client.js CHANGED
@@ -28,8 +28,8 @@ window.__ModuleLoader__.load({
28
28
  //#endregion
29
29
  let react = require("react");
30
30
  react = __toESM(react, 1);
31
- //#region \0dsh-css:/home/qunqi/opensource/avantf-mem-rc/packages/plugin/src/client/pages.module.css.mjs
32
- const css = "._7pPQfW_section{color:var(--dsw-alias-label-primary);width:100%;max-width:var(--dsh-chat-content-width);flex-direction:column;gap:12px;margin:0 auto;display:flex}._7pPQfW_headbar{z-index:4;border-bottom:.5px solid var(--dsw-alias-border-l2);background:var(--dsw-alias-bg-base);flex-wrap:wrap;align-items:flex-end;gap:8px;padding-bottom:8px;display:flex;position:sticky;top:0}._7pPQfW_warn{color:var(--dsw-alias-state-warn-label);background:color-mix(in srgb, var(--dsw-alias-state-warn-primary) 16%, transparent);border-radius:9px;margin-left:6px;padding:0 6px;font-size:11px;line-height:16px;display:inline-block}._7pPQfW_search{width:100%;color:var(--dsw-alias-label-tertiary);align-items:center;display:flex;position:relative}._7pPQfW_search>svg{pointer-events:none;position:absolute;left:12px}._7pPQfW_search input{border:.5px solid var(--dsw-alias-border-l4);background:var(--dsw-alias-bg-layer-1);width:100%;height:36px;color:var(--dsw-alias-label-primary);font:inherit;border-radius:10px;outline:none;padding:0 34px 0 36px;font-size:13px}._7pPQfW_search input::placeholder{color:var(--dsw-alias-label-tertiary)}._7pPQfW_search input:focus-visible{border-color:var(--dsw-alias-state-business-primary);box-shadow:0 0 0 2px color-mix(in srgb, var(--dsw-alias-state-business-primary) 18%, transparent)}._7pPQfW_status{color:var(--dsw-alias-label-tertiary);font-size:12px}._7pPQfW_error{color:var(--dsw-alias-label-error);white-space:pre-wrap;font-size:12px}._7pPQfW_list{flex-direction:column;gap:8px;margin:0;padding:0;list-style:none;display:flex}._7pPQfW_item{border:.5px solid var(--dsw-alias-border-l4);background:var(--dsw-alias-bg-layer-1);border-radius:10px;padding:8px 10px;font-size:13px;line-height:1.5}._7pPQfW_meta{color:var(--dsw-alias-label-tertiary);margin-top:2px;font-size:12px;display:block}._7pPQfW_detail{flex-direction:column;gap:4px;display:flex}._7pPQfW_more{border:.5px solid var(--dsw-alias-border-l3);height:28px;color:var(--dsw-alias-label-primary);font:inherit;cursor:pointer;background:0 0;border-radius:14px;justify-content:center;align-self:flex-start;align-items:center;gap:4px;padding:0 12px;font-size:12px;line-height:18px;display:inline-flex}._7pPQfW_more:hover:not(:disabled){background:var(--dsw-alias-interactive-bg-hover)}._7pPQfW_more:disabled{cursor:not-allowed;opacity:.4}._7pPQfW_toolbar{flex-wrap:wrap;align-items:flex-end;gap:8px;display:flex}._7pPQfW_form{flex-direction:column;gap:8px;display:flex}._7pPQfW_row{flex-wrap:wrap;align-items:center;gap:6px;margin-top:6px;display:flex}._7pPQfW_btn{border:.5px solid var(--dsw-alias-border-l3);height:24px;color:var(--dsw-alias-label-primary);font:inherit;cursor:pointer;background:0 0;border-radius:12px;justify-content:center;align-items:center;gap:4px;padding:0 10px;font-size:12px;line-height:16px;display:inline-flex}._7pPQfW_btn:hover:not(:disabled){background:var(--dsw-alias-interactive-bg-hover)}._7pPQfW_btn:disabled{cursor:not-allowed;opacity:.4}._7pPQfW_btnActive{border-color:var(--dsw-alias-state-business-primary);color:var(--dsw-alias-state-business-primary)}._7pPQfW_btnDanger{color:var(--dsw-alias-label-error)}._7pPQfW_fieldHead{justify-content:space-between;align-items:center;gap:8px;display:flex}._7pPQfW_fieldHead>*+*{flex:none}._7pPQfW_field{color:var(--dsw-alias-label-tertiary);flex-direction:column;flex:auto;gap:4px;min-width:120px;font-size:12px;display:flex}._7pPQfW_input{border:.5px solid var(--dsw-alias-border-l4);background:var(--dsw-alias-bg-layer-1);height:28px;color:var(--dsw-alias-label-primary);font:inherit;border-radius:8px;outline:none;min-width:0;padding:0 8px;font-size:12px}._7pPQfW_input:focus-visible{border-color:var(--dsw-alias-state-business-primary);box-shadow:0 0 0 2px color-mix(in srgb, var(--dsw-alias-state-business-primary) 18%, transparent)}._7pPQfW_textarea{border:.5px solid var(--dsw-alias-border-l4);background:var(--dsw-alias-bg-layer-1);width:100%;color:var(--dsw-alias-label-primary);font:inherit;resize:vertical;box-sizing:border-box;border-radius:8px;outline:none;margin-top:6px;padding:6px 8px;font-size:12px;line-height:1.5}._7pPQfW_textarea:focus-visible{border-color:var(--dsw-alias-state-business-primary);box-shadow:0 0 0 2px color-mix(in srgb, var(--dsw-alias-state-business-primary) 18%, transparent)}._7pPQfW_groupHead{color:var(--dsw-alias-label-secondary);margin:4px 0 2px;font-size:12px;font-weight:600}._7pPQfW_badge{color:var(--dsw-alias-label-tertiary);margin-bottom:2px;font-size:11px;display:inline-block}._7pPQfW_chunkBox{border:.5px solid var(--dsw-alias-border-l4);border-radius:8px;margin-top:6px;padding:6px 8px;font-size:12px;line-height:1.5}._7pPQfW_picker{border:.5px solid var(--dsw-alias-border-l4);background:var(--dsw-alias-bg-layer-1);border-radius:10px;flex-direction:column;gap:8px;padding:8px 10px;display:flex}._7pPQfW_pickerHead{flex-direction:column;gap:2px;display:flex}._7pPQfW_pickerPath{overflow-wrap:anywhere;font-family:ui-monospace,monospace;font-size:12px}._7pPQfW_pickerList{border:.5px solid var(--dsw-alias-border-l4);border-radius:8px;flex-direction:column;gap:1px;max-height:260px;margin:0;padding:0;list-style:none;display:flex;overflow:auto}._7pPQfW_pickerEntry{width:100%;color:inherit;font:inherit;text-align:left;cursor:pointer;background:0 0;border:0;padding:4px 8px;font-size:12px;display:block}._7pPQfW_pickerEntry:hover:not(:disabled){background:color-mix(in srgb, currentColor 8%, transparent)}._7pPQfW_pickerDisabled{opacity:.45;cursor:default}._7pPQfW_hintWarn{color:var(--dsw-alias-state-warn-label)}";
31
+ //#region \0dsh-css:src/client/pages.module.css.mjs
32
+ const css = ".HvfIsq_section{color:var(--dsw-alias-label-primary);width:100%;max-width:var(--dsh-chat-content-width);flex-direction:column;gap:12px;margin:0 auto;display:flex}.HvfIsq_headbar{z-index:4;border-bottom:.5px solid var(--dsw-alias-border-l2);background:var(--dsw-alias-bg-base);flex-wrap:wrap;align-items:flex-end;gap:8px;padding-bottom:8px;display:flex;position:sticky;top:0}.HvfIsq_warn{color:var(--dsw-alias-state-warn-label);background:color-mix(in srgb, var(--dsw-alias-state-warn-primary) 16%, transparent);border-radius:9px;margin-left:6px;padding:0 6px;font-size:11px;line-height:16px;display:inline-block}.HvfIsq_search{width:100%;color:var(--dsw-alias-label-tertiary);align-items:center;display:flex;position:relative}.HvfIsq_search>svg{pointer-events:none;position:absolute;left:12px}.HvfIsq_search input{border:.5px solid var(--dsw-alias-border-l4);background:var(--dsw-alias-bg-layer-1);width:100%;height:36px;color:var(--dsw-alias-label-primary);font:inherit;border-radius:10px;outline:none;padding:0 34px 0 36px;font-size:13px}.HvfIsq_search input::placeholder{color:var(--dsw-alias-label-tertiary)}.HvfIsq_search input:focus-visible{border-color:var(--dsw-alias-state-business-primary);box-shadow:0 0 0 2px color-mix(in srgb, var(--dsw-alias-state-business-primary) 18%, transparent)}.HvfIsq_status{color:var(--dsw-alias-label-tertiary);font-size:12px}.HvfIsq_error{color:var(--dsw-alias-label-error);white-space:pre-wrap;font-size:12px}.HvfIsq_list{flex-direction:column;gap:8px;margin:0;padding:0;list-style:none;display:flex}.HvfIsq_item{border:.5px solid var(--dsw-alias-border-l4);background:var(--dsw-alias-bg-layer-1);border-radius:10px;padding:8px 10px;font-size:13px;line-height:1.5}.HvfIsq_meta{color:var(--dsw-alias-label-tertiary);margin-top:2px;font-size:12px;display:block}.HvfIsq_detail{flex-direction:column;gap:4px;display:flex}.HvfIsq_more{border:.5px solid var(--dsw-alias-border-l3);height:28px;color:var(--dsw-alias-label-primary);font:inherit;cursor:pointer;background:0 0;border-radius:14px;justify-content:center;align-self:flex-start;align-items:center;gap:4px;padding:0 12px;font-size:12px;line-height:18px;display:inline-flex}.HvfIsq_more:hover:not(:disabled){background:var(--dsw-alias-interactive-bg-hover)}.HvfIsq_more:disabled{cursor:not-allowed;opacity:.4}.HvfIsq_toolbar{flex-wrap:wrap;align-items:flex-end;gap:8px;display:flex}.HvfIsq_form{flex-direction:column;gap:8px;display:flex}.HvfIsq_row{flex-wrap:wrap;align-items:center;gap:6px;margin-top:6px;display:flex}.HvfIsq_btn{border:.5px solid var(--dsw-alias-border-l3);height:24px;color:var(--dsw-alias-label-primary);font:inherit;cursor:pointer;background:0 0;border-radius:12px;justify-content:center;align-items:center;gap:4px;padding:0 10px;font-size:12px;line-height:16px;display:inline-flex}.HvfIsq_btn:hover:not(:disabled){background:var(--dsw-alias-interactive-bg-hover)}.HvfIsq_btn:disabled{cursor:not-allowed;opacity:.4}.HvfIsq_btnActive{border-color:var(--dsw-alias-state-business-primary);color:var(--dsw-alias-state-business-primary)}.HvfIsq_btnDanger{color:var(--dsw-alias-label-error)}.HvfIsq_fieldHead{justify-content:space-between;align-items:center;gap:8px;display:flex}.HvfIsq_fieldHead>*+*{flex:none}.HvfIsq_field{color:var(--dsw-alias-label-tertiary);flex-direction:column;flex:auto;gap:4px;min-width:120px;font-size:12px;display:flex}.HvfIsq_input{border:.5px solid var(--dsw-alias-border-l4);background:var(--dsw-alias-bg-layer-1);height:28px;color:var(--dsw-alias-label-primary);font:inherit;border-radius:8px;outline:none;min-width:0;padding:0 8px;font-size:12px}.HvfIsq_input:focus-visible{border-color:var(--dsw-alias-state-business-primary);box-shadow:0 0 0 2px color-mix(in srgb, var(--dsw-alias-state-business-primary) 18%, transparent)}.HvfIsq_textarea{border:.5px solid var(--dsw-alias-border-l4);background:var(--dsw-alias-bg-layer-1);width:100%;color:var(--dsw-alias-label-primary);font:inherit;resize:vertical;box-sizing:border-box;border-radius:8px;outline:none;margin-top:6px;padding:6px 8px;font-size:12px;line-height:1.5}.HvfIsq_textarea:focus-visible{border-color:var(--dsw-alias-state-business-primary);box-shadow:0 0 0 2px color-mix(in srgb, var(--dsw-alias-state-business-primary) 18%, transparent)}.HvfIsq_groupHead{color:var(--dsw-alias-label-secondary);margin:4px 0 2px;font-size:12px;font-weight:600}.HvfIsq_badge{color:var(--dsw-alias-label-tertiary);margin-bottom:2px;font-size:11px;display:inline-block}.HvfIsq_chunkBox{border:.5px solid var(--dsw-alias-border-l4);border-radius:8px;margin-top:6px;padding:6px 8px;font-size:12px;line-height:1.5}.HvfIsq_picker{border:.5px solid var(--dsw-alias-border-l4);background:var(--dsw-alias-bg-layer-1);border-radius:10px;flex-direction:column;gap:8px;padding:8px 10px;display:flex}.HvfIsq_pickerHead{flex-direction:column;gap:2px;display:flex}.HvfIsq_pickerPath{overflow-wrap:anywhere;font-family:ui-monospace,monospace;font-size:12px}.HvfIsq_pickerList{border:.5px solid var(--dsw-alias-border-l4);border-radius:8px;flex-direction:column;gap:1px;max-height:260px;margin:0;padding:0;list-style:none;display:flex;overflow:auto}.HvfIsq_pickerEntry{width:100%;color:inherit;font:inherit;text-align:left;cursor:pointer;background:0 0;border:0;padding:4px 8px;font-size:12px;display:block}.HvfIsq_pickerEntry:hover:not(:disabled){background:color-mix(in srgb, currentColor 8%, transparent)}.HvfIsq_pickerDisabled{opacity:.45;cursor:default}.HvfIsq_hintWarn{color:var(--dsw-alias-state-warn-label)}";
33
33
  const tagId = "@avantf/dsh-mem/pages.module.css";
34
34
  if (typeof document !== "undefined" && document.querySelector("style[data-plugin-css=" + JSON.stringify(tagId) + "]") === null) {
35
35
  const tag = document.createElement("style");
@@ -39,116 +39,67 @@ window.__ModuleLoader__.load({
39
39
  document.head.appendChild(tag);
40
40
  }
41
41
  var pages_module_css_default = {
42
- "badge": "_7pPQfW_badge",
43
- "btn": "_7pPQfW_btn",
44
- "btnActive": "_7pPQfW_btnActive",
45
- "btnDanger": "_7pPQfW_btnDanger",
46
- "chunkBox": "_7pPQfW_chunkBox",
47
- "detail": "_7pPQfW_detail",
48
- "error": "_7pPQfW_error",
49
- "field": "_7pPQfW_field",
50
- "fieldHead": "_7pPQfW_fieldHead",
51
- "form": "_7pPQfW_form",
52
- "groupHead": "_7pPQfW_groupHead",
53
- "headbar": "_7pPQfW_headbar",
54
- "hintWarn": "_7pPQfW_hintWarn",
55
- "input": "_7pPQfW_input",
56
- "item": "_7pPQfW_item",
57
- "list": "_7pPQfW_list",
58
- "meta": "_7pPQfW_meta",
59
- "more": "_7pPQfW_more",
60
- "picker": "_7pPQfW_picker",
61
- "pickerDisabled": "_7pPQfW_pickerDisabled",
62
- "pickerEntry": "_7pPQfW_pickerEntry",
63
- "pickerHead": "_7pPQfW_pickerHead",
64
- "pickerList": "_7pPQfW_pickerList",
65
- "pickerPath": "_7pPQfW_pickerPath",
66
- "row": "_7pPQfW_row",
67
- "search": "_7pPQfW_search",
68
- "section": "_7pPQfW_section",
69
- "status": "_7pPQfW_status",
70
- "textarea": "_7pPQfW_textarea",
71
- "toolbar": "_7pPQfW_toolbar",
72
- "warn": "_7pPQfW_warn"
42
+ "badge": "HvfIsq_badge",
43
+ "btn": "HvfIsq_btn",
44
+ "btnActive": "HvfIsq_btnActive",
45
+ "btnDanger": "HvfIsq_btnDanger",
46
+ "chunkBox": "HvfIsq_chunkBox",
47
+ "detail": "HvfIsq_detail",
48
+ "error": "HvfIsq_error",
49
+ "field": "HvfIsq_field",
50
+ "fieldHead": "HvfIsq_fieldHead",
51
+ "form": "HvfIsq_form",
52
+ "groupHead": "HvfIsq_groupHead",
53
+ "headbar": "HvfIsq_headbar",
54
+ "hintWarn": "HvfIsq_hintWarn",
55
+ "input": "HvfIsq_input",
56
+ "item": "HvfIsq_item",
57
+ "list": "HvfIsq_list",
58
+ "meta": "HvfIsq_meta",
59
+ "more": "HvfIsq_more",
60
+ "picker": "HvfIsq_picker",
61
+ "pickerDisabled": "HvfIsq_pickerDisabled",
62
+ "pickerEntry": "HvfIsq_pickerEntry",
63
+ "pickerHead": "HvfIsq_pickerHead",
64
+ "pickerList": "HvfIsq_pickerList",
65
+ "pickerPath": "HvfIsq_pickerPath",
66
+ "row": "HvfIsq_row",
67
+ "search": "HvfIsq_search",
68
+ "section": "HvfIsq_section",
69
+ "status": "HvfIsq_status",
70
+ "textarea": "HvfIsq_textarea",
71
+ "toolbar": "HvfIsq_toolbar",
72
+ "warn": "HvfIsq_warn"
73
73
  };
74
74
  //#endregion
75
- //#region ../../node_modules/.pnpm/zod@4.4.3/node_modules/zod/v4/core/core.js
76
- var _a$1;
77
- function $constructor(name, initializer, params) {
78
- function init(inst, def) {
79
- if (!inst._zod) Object.defineProperty(inst, "_zod", {
80
- value: {
81
- def,
82
- constr: _,
83
- traits: /* @__PURE__ */ new Set()
84
- },
85
- enumerable: false
86
- });
87
- if (inst._zod.traits.has(name)) return;
88
- inst._zod.traits.add(name);
89
- initializer(inst, def);
90
- const proto = _.prototype;
91
- const keys = Object.keys(proto);
92
- for (let i = 0; i < keys.length; i++) {
93
- const k = keys[i];
94
- if (!(k in inst)) inst[k] = proto[k].bind(inst);
95
- }
96
- }
97
- const Parent = params?.Parent ?? Object;
98
- class Definition extends Parent {}
99
- Object.defineProperty(Definition, "name", { value: name });
100
- function _(def) {
101
- var _a;
102
- const inst = params?.Parent ? new Definition() : this;
103
- init(inst, def);
104
- (_a = inst._zod).deferred ?? (_a.deferred = []);
105
- for (const fn of inst._zod.deferred) fn();
106
- return inst;
107
- }
108
- Object.defineProperty(_, "init", { value: init });
109
- Object.defineProperty(_, Symbol.hasInstance, { value: (inst) => {
110
- if (params?.Parent && inst instanceof params.Parent) return true;
111
- return inst?._zod?.traits?.has(name);
112
- } });
113
- Object.defineProperty(_, "name", { value: name });
114
- return _;
115
- }
116
- var $ZodAsyncError = class extends Error {
117
- constructor() {
118
- super(`Encountered Promise during synchronous parse. Use .parseAsync() instead.`);
119
- }
120
- };
121
- var $ZodEncodeError = class extends Error {
122
- constructor(name) {
123
- super(`Encountered unidirectional transform during encode: ${name}`);
124
- this.name = "ZodEncodeError";
125
- }
126
- };
127
- (_a$1 = globalThis).__zod_globalConfig ?? (_a$1.__zod_globalConfig = {});
128
- const globalConfig = globalThis.__zod_globalConfig;
129
- function config(newConfig) {
130
- if (newConfig) Object.assign(globalConfig, newConfig);
131
- return globalConfig;
132
- }
133
- //#endregion
134
- //#region ../../node_modules/.pnpm/zod@4.4.3/node_modules/zod/v4/core/util.js
75
+ //#region ../../../node_modules/.pnpm/zod@4.6.5/node_modules/zod/v4/core/util.js
135
76
  function getEnumValues(entries) {
136
77
  const numericValues = Object.values(entries).filter((v) => typeof v === "number");
137
78
  return Object.entries(entries).filter(([k, _]) => numericValues.indexOf(+k) === -1).map(([_, v]) => v);
138
79
  }
80
+ function joinValues(array, separator = "|") {
81
+ return array.map((val) => stringifyPrimitive(val)).join(separator);
82
+ }
139
83
  function jsonStringifyReplacer(_, value) {
140
84
  if (typeof value === "bigint") return value.toString();
141
85
  return value;
142
86
  }
143
- function cached(getter) {
144
- return { get value() {
145
- {
146
- const value = getter();
147
- Object.defineProperty(this, "value", { value });
148
- return value;
87
+ var Cached = class {
88
+ constructor(getter) {
89
+ this._getter = getter;
90
+ this._value = void 0;
91
+ }
92
+ get value() {
93
+ const getter = this._getter;
94
+ if (getter !== void 0) {
95
+ this._value = getter();
96
+ this._getter = void 0;
149
97
  }
150
- throw new Error("cached value already set");
151
- } };
98
+ return this._value;
99
+ }
100
+ };
101
+ function cached(getter) {
102
+ return new Cached(getter);
152
103
  }
153
104
  function nullish(input) {
154
105
  return input === null || input === void 0;
@@ -161,28 +112,10 @@ window.__ModuleLoader__.load({
161
112
  function floatSafeRemainder(val, step) {
162
113
  const ratio = val / step;
163
114
  const roundedRatio = Math.round(ratio);
164
- const tolerance = Number.EPSILON * Math.max(Math.abs(ratio), 1);
115
+ const tolerance = 4 * Number.EPSILON * Math.max(Math.abs(ratio), 1);
165
116
  if (Math.abs(ratio - roundedRatio) < tolerance) return 0;
166
117
  return ratio - roundedRatio;
167
118
  }
168
- const EVALUATING = /* @__PURE__*/ Symbol("evaluating");
169
- function defineLazy(object, key, getter) {
170
- let value = void 0;
171
- Object.defineProperty(object, key, {
172
- get() {
173
- if (value === EVALUATING) return;
174
- if (value === void 0) {
175
- value = EVALUATING;
176
- value = getter();
177
- }
178
- return value;
179
- },
180
- set(v) {
181
- Object.defineProperty(object, key, { value: v });
182
- },
183
- configurable: true
184
- });
185
- }
186
119
  function assignProp(target, prop, value) {
187
120
  Object.defineProperty(target, prop, {
188
121
  value,
@@ -191,6 +124,58 @@ window.__ModuleLoader__.load({
191
124
  configurable: true
192
125
  });
193
126
  }
127
+ /**
128
+ * Whichever object a def's `shape` currently answers from: the one the caller passed until the first read, the frozen copy after it.
129
+ *
130
+ * Its keys and descriptors read without invoking anything, which is what lets a discriminated union check its discriminator, and the cycle walk read a shape, without resolving a getter that references the schema being constructed. A def that answers `shape` from an accessor of its own has none.
131
+ */
132
+ function rawShape(def) {
133
+ const desc = Object.getOwnPropertyDescriptor(def, "shape");
134
+ return desc?.get ? desc.get.raw : desc?.value;
135
+ }
136
+ function sourceShape(schema) {
137
+ return rawShape(schema._zod.def) ?? schema._zod.def.shape;
138
+ }
139
+ function deferProp(target, key, getter) {
140
+ Object.defineProperty(target, key, {
141
+ get() {
142
+ const value = getter();
143
+ assignProp(this, key, value);
144
+ return value;
145
+ },
146
+ enumerable: true,
147
+ configurable: true
148
+ });
149
+ }
150
+ function putProp(target, key, value) {
151
+ if (key in target) assignProp(target, key, value);
152
+ else target[key] = value;
153
+ }
154
+ /**
155
+ * Copies `keys` of `source`'s shape onto `target`, each value passed through `wrap`.
156
+ *
157
+ * A key the source has resolved is copied through now, so the derived shape states it outright and nothing has to resolve it to learn what it holds. A key the source still defers stays deferred, and reads back through the source's own `shape`, so it resolves once and both shapes get that one schema.
158
+ */
159
+ function mirrorShape(target, source, keys, wrap) {
160
+ const raw = sourceShape(source);
161
+ for (const key of keys) {
162
+ const desc = Object.getOwnPropertyDescriptor(raw, key);
163
+ if (!desc.enumerable) continue;
164
+ if (desc.get) deferProp(target, key, () => {
165
+ const value = source._zod.def.shape[key];
166
+ return wrap ? wrap(value, key) : value;
167
+ });
168
+ else putProp(target, key, wrap ? wrap(desc.value, key) : desc.value);
169
+ }
170
+ }
171
+ function mirrorProps(target, source) {
172
+ for (const key of Reflect.ownKeys(source)) {
173
+ const desc = Object.getOwnPropertyDescriptor(source, key);
174
+ if (!desc.enumerable) continue;
175
+ if (desc.get) deferProp(target, key, () => source[key]);
176
+ else putProp(target, key, desc.value);
177
+ }
178
+ }
194
179
  function mergeDefs(...defs) {
195
180
  const mergedDescriptors = {};
196
181
  for (const def of defs) {
@@ -264,51 +249,56 @@ window.__ModuleLoader__.load({
264
249
  };
265
250
  return params;
266
251
  }
252
+ function stringifyPrimitive(value) {
253
+ if (typeof value === "bigint") return value.toString() + "n";
254
+ if (typeof value === "string") return `"${value}"`;
255
+ return `${value}`;
256
+ }
267
257
  function optionalKeys(shape) {
268
258
  return Object.keys(shape).filter((k) => {
269
- return shape[k]._zod.optin === "optional" && shape[k]._zod.optout === "optional";
259
+ return shape[k]._zod.optin !== void 0 && shape[k]._zod.optout === "optional";
270
260
  });
271
261
  }
272
- const NUMBER_FORMAT_RANGES = {
262
+ const NUMBER_FORMAT_RANGES = /*@__PURE__*/ (() => ({
273
263
  safeint: [Number.MIN_SAFE_INTEGER, Number.MAX_SAFE_INTEGER],
274
264
  int32: [-2147483648, 2147483647],
275
265
  uint32: [0, 4294967295],
276
266
  float32: [-34028234663852886e22, 34028234663852886e22],
277
267
  float64: [-Number.MAX_VALUE, Number.MAX_VALUE]
268
+ }))();
269
+ const BIGINT_FORMAT_RANGES = {
270
+ int64: [/* @__PURE__*/ BigInt("-9223372036854775808"), /* @__PURE__*/ BigInt("9223372036854775807")],
271
+ uint64: [/* @__PURE__*/ BigInt(0), /* @__PURE__*/ BigInt("18446744073709551615")]
278
272
  };
279
273
  function pick(schema, mask) {
280
274
  const currDef = schema._zod.def;
281
275
  const checks = currDef.checks;
282
276
  if (checks && checks.length > 0) throw new Error(".pick() cannot be used on object schemas containing refinements");
283
- return clone(schema, mergeDefs(schema._zod.def, {
284
- get shape() {
285
- const newShape = {};
286
- for (const key in mask) {
287
- if (!(key in currDef.shape)) throw new Error(`Unrecognized key: "${key}"`);
288
- if (!mask[key]) continue;
289
- newShape[key] = currDef.shape[key];
290
- }
291
- assignProp(this, "shape", newShape);
292
- return newShape;
293
- },
277
+ const newShape = {};
278
+ mirrorShape(newShape, schema, maskedKeys(schema, mask));
279
+ return clone(schema, mergeDefs(currDef, {
280
+ shape: newShape,
294
281
  checks: []
295
282
  }));
296
283
  }
284
+ function maskedKeys(schema, mask) {
285
+ const raw = sourceShape(schema);
286
+ const keys = [];
287
+ for (const key of Reflect.ownKeys(mask)) {
288
+ if (!Object.getOwnPropertyDescriptor(raw, key)?.enumerable) throw new Error(`Unrecognized key: "${String(key)}"`);
289
+ if (mask[key]) keys.push(key);
290
+ }
291
+ return keys;
292
+ }
297
293
  function omit(schema, mask) {
298
294
  const currDef = schema._zod.def;
299
295
  const checks = currDef.checks;
300
296
  if (checks && checks.length > 0) throw new Error(".omit() cannot be used on object schemas containing refinements");
301
- return clone(schema, mergeDefs(schema._zod.def, {
302
- get shape() {
303
- const newShape = { ...schema._zod.def.shape };
304
- for (const key in mask) {
305
- if (!(key in currDef.shape)) throw new Error(`Unrecognized key: "${key}"`);
306
- if (!mask[key]) continue;
307
- delete newShape[key];
308
- }
309
- assignProp(this, "shape", newShape);
310
- return newShape;
311
- },
297
+ const omitted = new Set(maskedKeys(schema, mask));
298
+ const newShape = {};
299
+ mirrorShape(newShape, schema, Reflect.ownKeys(sourceShape(schema)).filter((key) => !omitted.has(key)));
300
+ return clone(schema, mergeDefs(currDef, {
301
+ shape: newShape,
312
302
  checks: []
313
303
  }));
314
304
  }
@@ -316,90 +306,57 @@ window.__ModuleLoader__.load({
316
306
  if (!isPlainObject(shape)) throw new Error("Invalid input to extend: expected a plain object");
317
307
  const checks = schema._zod.def.checks;
318
308
  if (checks && checks.length > 0) {
319
- const existingShape = schema._zod.def.shape;
320
- 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.");
309
+ const existingShape = sourceShape(schema);
310
+ 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.");
321
311
  }
322
- return clone(schema, mergeDefs(schema._zod.def, { get shape() {
323
- const _shape = {
324
- ...schema._zod.def.shape,
325
- ...shape
326
- };
327
- assignProp(this, "shape", _shape);
328
- return _shape;
329
- } }));
312
+ return clone(schema, mergeDefs(schema._zod.def, { shape: extended(schema, shape) }));
313
+ }
314
+ function extended(schema, shape) {
315
+ const newShape = {};
316
+ mirrorShape(newShape, schema, Reflect.ownKeys(sourceShape(schema)));
317
+ mirrorProps(newShape, shape);
318
+ return newShape;
330
319
  }
331
320
  function safeExtend(schema, shape) {
332
321
  if (!isPlainObject(shape)) throw new Error("Invalid input to safeExtend: expected a plain object");
333
- return clone(schema, mergeDefs(schema._zod.def, { get shape() {
334
- const _shape = {
335
- ...schema._zod.def.shape,
336
- ...shape
337
- };
338
- assignProp(this, "shape", _shape);
339
- return _shape;
340
- } }));
322
+ return clone(schema, mergeDefs(schema._zod.def, { shape: extended(schema, shape) }));
341
323
  }
342
324
  function merge(a, b) {
325
+ if (!b?._zod?.def) throw new Error("Invalid input to merge: expected an object schema. To merge a plain shape, use `.extend()`.");
343
326
  if (a._zod.def.checks?.length) throw new Error(".merge() cannot be used on object schemas containing refinements. Use .safeExtend() instead.");
327
+ const newShape = {};
328
+ mirrorShape(newShape, a, Reflect.ownKeys(sourceShape(a)));
329
+ mirrorShape(newShape, b, Reflect.ownKeys(sourceShape(b)));
344
330
  return clone(a, mergeDefs(a._zod.def, {
345
- get shape() {
346
- const _shape = {
347
- ...a._zod.def.shape,
348
- ...b._zod.def.shape
349
- };
350
- assignProp(this, "shape", _shape);
351
- return _shape;
352
- },
331
+ shape: newShape,
353
332
  get catchall() {
354
333
  return b._zod.def.catchall;
355
334
  },
356
335
  checks: b._zod.def.checks ?? []
357
336
  }));
358
337
  }
359
- function partial(Class, schema, mask) {
338
+ function partial(Class, schema, mask, name = "partial") {
360
339
  const checks = schema._zod.def.checks;
361
- if (checks && checks.length > 0) throw new Error(".partial() cannot be used on object schemas containing refinements");
340
+ if (checks && checks.length > 0) throw new Error(`.${name}() cannot be used on object schemas containing refinements`);
341
+ const selected = mask ? new Set(maskedKeys(schema, mask)) : void 0;
342
+ const newShape = {};
343
+ mirrorShape(newShape, schema, Reflect.ownKeys(sourceShape(schema)), Class && ((value, key) => selected && !selected.has(key) ? value : new Class({
344
+ type: "optional",
345
+ innerType: value
346
+ })));
362
347
  return clone(schema, mergeDefs(schema._zod.def, {
363
- get shape() {
364
- const oldShape = schema._zod.def.shape;
365
- const shape = { ...oldShape };
366
- if (mask) for (const key in mask) {
367
- if (!(key in oldShape)) throw new Error(`Unrecognized key: "${key}"`);
368
- if (!mask[key]) continue;
369
- shape[key] = Class ? new Class({
370
- type: "optional",
371
- innerType: oldShape[key]
372
- }) : oldShape[key];
373
- }
374
- else for (const key in oldShape) shape[key] = Class ? new Class({
375
- type: "optional",
376
- innerType: oldShape[key]
377
- }) : oldShape[key];
378
- assignProp(this, "shape", shape);
379
- return shape;
380
- },
348
+ shape: newShape,
381
349
  checks: []
382
350
  }));
383
351
  }
384
352
  function required(Class, schema, mask) {
385
- return clone(schema, mergeDefs(schema._zod.def, { get shape() {
386
- const oldShape = schema._zod.def.shape;
387
- const shape = { ...oldShape };
388
- if (mask) for (const key in mask) {
389
- if (!(key in shape)) throw new Error(`Unrecognized key: "${key}"`);
390
- if (!mask[key]) continue;
391
- shape[key] = new Class({
392
- type: "nonoptional",
393
- innerType: oldShape[key]
394
- });
395
- }
396
- else for (const key in oldShape) shape[key] = new Class({
397
- type: "nonoptional",
398
- innerType: oldShape[key]
399
- });
400
- assignProp(this, "shape", shape);
401
- return shape;
402
- } }));
353
+ const selected = mask ? new Set(maskedKeys(schema, mask)) : void 0;
354
+ const newShape = {};
355
+ mirrorShape(newShape, schema, Reflect.ownKeys(sourceShape(schema)), (value, key) => selected && !selected.has(key) ? value : new Class({
356
+ type: "nonoptional",
357
+ innerType: value
358
+ }));
359
+ return clone(schema, mergeDefs(schema._zod.def, { shape: newShape }));
403
360
  }
404
361
  function aborted(x, startIndex = 0) {
405
362
  if (x.aborted === true) return true;
@@ -422,19 +379,56 @@ window.__ModuleLoader__.load({
422
379
  function unwrapMessage(message) {
423
380
  return typeof message === "string" ? message : message?.message;
424
381
  }
382
+ function attachSchema(issues, start, inst) {
383
+ var _a;
384
+ for (let i = start; i < issues.length; i++) (_a = issues[i]).schema ?? (_a.schema = inst);
385
+ }
425
386
  function finalizeIssue(iss, ctx, config) {
426
- 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";
427
- const { inst: _inst, continue: _continue, input: _input, ...rest } = iss;
428
- rest.path ?? (rest.path = []);
429
- rest.message = message;
430
- if (ctx?.reportInput) rest.input = _input;
431
- return rest;
387
+ var _a;
388
+ const traits = iss.inst?._zod?.traits;
389
+ if (traits?.has("$ZodType")) if (traits.has("$ZodCheck")) (_a = iss).schema ?? (_a.schema = iss.inst);
390
+ else iss.schema = iss.inst;
391
+ const schemaError = iss.schema !== iss.inst ? iss.schema?._zod.def?.error : void 0;
392
+ 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";
393
+ const full = {};
394
+ for (const k of Object.keys(iss)) {
395
+ if (k === "inst" || k === "schema" || k === "continue" || k === "input" || k === "__proto__") continue;
396
+ full[k] = iss[k];
397
+ }
398
+ full.path ?? (full.path = []);
399
+ full.message = message;
400
+ if (ctx?.reportInput) full.input = iss.input;
401
+ return full;
402
+ }
403
+ const highSurrogate = /[\uD800-\uDBFF]/;
404
+ function codePointLength(str) {
405
+ const units = str.length;
406
+ if (!highSurrogate.test(str)) return units;
407
+ let count = units;
408
+ for (let i = 0; i < units - 1; i++) if ((str.charCodeAt(i) & 64512) === 55296 && (str.charCodeAt(i + 1) & 64512) === 56320) {
409
+ count--;
410
+ i++;
411
+ }
412
+ return count;
432
413
  }
433
414
  function getLengthableOrigin(input) {
434
415
  if (Array.isArray(input)) return "array";
435
416
  if (typeof input === "string") return "string";
436
417
  return "unknown";
437
418
  }
419
+ function parsedType(data) {
420
+ const t = typeof data;
421
+ switch (t) {
422
+ case "number": return Number.isNaN(data) ? "nan" : "number";
423
+ case "object": {
424
+ if (data === null) return "null";
425
+ if (Array.isArray(data)) return "array";
426
+ const obj = data;
427
+ if (obj && Object.getPrototypeOf(obj) !== Object.prototype && "constructor" in obj && obj.constructor) return obj.constructor.name;
428
+ }
429
+ }
430
+ return t;
431
+ }
438
432
  function issue(...args) {
439
433
  const [iss, input, inst] = args;
440
434
  if (typeof iss === "string") return {
@@ -445,33 +439,337 @@ window.__ModuleLoader__.load({
445
439
  };
446
440
  return { ...iss };
447
441
  }
448
- //#endregion
449
- //#region ../../node_modules/.pnpm/zod@4.4.3/node_modules/zod/v4/core/errors.js
450
- const initializer$1 = (inst, def) => {
451
- inst.name = "$ZodError";
452
- Object.defineProperty(inst, "_zod", {
453
- value: inst._zod,
454
- enumerable: false
442
+ /**
443
+ * 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.
444
+ *
445
+ * Call this from a `proto` initializer, which runs once per prototype — never per instance.
446
+ */
447
+ function members(proto, table) {
448
+ for (const key in table) {
449
+ const desc = Object.getOwnPropertyDescriptor(table, key);
450
+ if (desc.get) Object.defineProperty(proto, key, {
451
+ ...desc,
452
+ enumerable: false
453
+ });
454
+ else defineBound(proto, key, desc.value);
455
+ }
456
+ }
457
+ /** Shadows a prototype member with an own value, so a getter that builds from the instance runs once. */
458
+ function own(inst, key, value, enumerable = true) {
459
+ Object.defineProperty(inst, key, {
460
+ configurable: true,
461
+ writable: true,
462
+ enumerable,
463
+ value
455
464
  });
456
- Object.defineProperty(inst, "issues", {
457
- value: def,
458
- enumerable: false
465
+ return value;
466
+ }
467
+ /** Like {@link own}, for a member that was never an own data property and has to stay out of `Object.keys`. */
468
+ function hide(inst, key, value) {
469
+ return own(inst, key, value, false);
470
+ }
471
+ /** Adds members a table derives from the instance: each builds on first read and shadows as own data, and assignment shadows the same way, as when these were own properties. */
472
+ function derived(computes, table) {
473
+ for (const key in computes) {
474
+ const compute = computes[key];
475
+ Object.defineProperty(table, key, {
476
+ configurable: true,
477
+ enumerable: true,
478
+ get() {
479
+ return own(this, key, compute(this));
480
+ },
481
+ set(value) {
482
+ own(this, key, value);
483
+ }
484
+ });
485
+ }
486
+ return table;
487
+ }
488
+ function defineBound(proto, key, fn) {
489
+ Object.defineProperty(proto, key, {
490
+ configurable: true,
491
+ get() {
492
+ return this == null ? fn : own(this, key, fn.bind(this));
493
+ },
494
+ set(value) {
495
+ own(this, key, value);
496
+ }
459
497
  });
460
- inst.message = JSON.stringify(def, jsonStringifyReplacer, 2);
461
- Object.defineProperty(inst, "toString", {
462
- value: () => inst.message,
463
- enumerable: false
498
+ }
499
+ /** Returns the prototype to install on, or `undefined` if this group is already installed on it. */
500
+ function claim(inst, sentinel) {
501
+ const proto = Object.getPrototypeOf(inst);
502
+ return sentinel in proto ? void 0 : proto;
503
+ }
504
+ let installing;
505
+ let broke = false;
506
+ const breaker = {
507
+ configurable: true,
508
+ get() {
509
+ broke = true;
510
+ }
511
+ };
512
+ /**
513
+ * Installs a lazily-derived internal on the `_zod` prototype of `inst`'s
514
+ * constructor, computed from the internals object itself and cached there on
515
+ * first read. One accessor per constructor rather than one per instance.
516
+ */
517
+ function defineLazyInternal(inst, key, compute) {
518
+ const proto = Object.getPrototypeOf(inst._zod);
519
+ if (key in proto && installing !== inst._zod) {
520
+ installing = void 0;
521
+ return;
522
+ }
523
+ installing = inst._zod;
524
+ Object.defineProperty(proto, key, {
525
+ configurable: true,
526
+ get() {
527
+ Object.defineProperty(this, key, breaker);
528
+ const outer = broke;
529
+ broke = false;
530
+ try {
531
+ const value = compute(this);
532
+ if (broke) delete this[key];
533
+ else Object.defineProperty(this, key, {
534
+ configurable: true,
535
+ writable: true,
536
+ value
537
+ });
538
+ broke = broke || outer;
539
+ return value;
540
+ } catch (err) {
541
+ delete this[key];
542
+ broke = broke || outer;
543
+ throw err;
544
+ }
545
+ },
546
+ set(value) {
547
+ Object.defineProperty(this, key, {
548
+ configurable: true,
549
+ writable: true,
550
+ value
551
+ });
552
+ }
553
+ });
554
+ }
555
+ /**
556
+ * Installs `key` on `inst`'s prototype, computed by `make` on first read and cached there as an own
557
+ * data property. One accessor per constructor rather than one per instance, because an own accessor
558
+ * puts every instance after the first into v8 dictionary mode. The key doubles as the sentinel.
559
+ */
560
+ function installLazyProp(inst, key, make, enumerable) {
561
+ const proto = claim(inst, key);
562
+ if (!proto) return;
563
+ Object.defineProperty(proto, key, {
564
+ configurable: true,
565
+ get() {
566
+ const desc = {
567
+ configurable: true,
568
+ writable: true,
569
+ enumerable,
570
+ value: void 0
571
+ };
572
+ Object.defineProperty(this, key, desc);
573
+ desc.value = make(this);
574
+ Object.defineProperty(this, key, desc);
575
+ return desc.value;
576
+ },
577
+ set(value) {
578
+ Object.defineProperty(this, key, {
579
+ configurable: true,
580
+ writable: true,
581
+ enumerable,
582
+ value
583
+ });
584
+ }
464
585
  });
586
+ }
587
+ /** 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. */
588
+ const CONSTANT_CATCH = "~constantCatch";
589
+ /** Wraps a constant catch value in a thunk tagged with {@link CONSTANT_CATCH}. */
590
+ function constantCatch(value) {
591
+ const fn = () => value;
592
+ fn[CONSTANT_CATCH] = true;
593
+ return fn;
594
+ }
595
+ //#endregion
596
+ //#region ../../../node_modules/.pnpm/zod@4.6.5/node_modules/zod/v4/core/core.js
597
+ var _a$1;
598
+ const _zodDesc = {
599
+ value: void 0,
600
+ enumerable: false
601
+ };
602
+ let _E = "captureStackTrace" in Error ? Error : null;
603
+ function newError(Definition) {
604
+ const E = _E;
605
+ if (E) {
606
+ const saved = E.stackTraceLimit;
607
+ if (typeof saved === "number") {
608
+ try {
609
+ E.stackTraceLimit = 0;
610
+ } catch {
611
+ _E = null;
612
+ return new Definition();
613
+ }
614
+ try {
615
+ return new Definition();
616
+ } finally {
617
+ E.stackTraceLimit = saved;
618
+ }
619
+ }
620
+ }
621
+ return new Definition();
622
+ }
623
+ function $constructor(name, initializer, proto, params) {
624
+ const zodProto = {};
625
+ function Internals(def) {
626
+ this.def = def;
627
+ this.constr = _;
628
+ this.traits = /* @__PURE__ */ new Set();
629
+ }
630
+ Internals.prototype = zodProto;
631
+ const protoMembers = proto;
632
+ const initialized = protoMembers && /* @__PURE__ */ new WeakSet();
633
+ function init(inst, def) {
634
+ if (!inst._zod) {
635
+ _zodDesc.value = new Internals(def);
636
+ try {
637
+ Object.defineProperty(inst, "_zod", _zodDesc);
638
+ } finally {
639
+ _zodDesc.value = void 0;
640
+ }
641
+ } else if (inst._zod.traits.has(name)) return;
642
+ inst._zod.traits.add(name);
643
+ initializer(inst, def);
644
+ if (initialized) {
645
+ const own = Object.getPrototypeOf(inst);
646
+ const ctorProto = inst._zod.constr.prototype;
647
+ let up = own;
648
+ while (up && up !== ctorProto) up = Object.getPrototypeOf(up);
649
+ const target = up ?? own;
650
+ if (!initialized.has(target)) {
651
+ initialized.add(target);
652
+ members(target, protoMembers);
653
+ }
654
+ }
655
+ const proto = _.prototype;
656
+ for (const k in proto) {
657
+ if (!Object.prototype.hasOwnProperty.call(proto, k)) continue;
658
+ if (!(k in inst)) inst[k] = proto[k].bind(inst);
659
+ }
660
+ }
661
+ const Parent = params?.Parent ?? Object;
662
+ class Definition extends Parent {}
663
+ Object.defineProperty(Definition, "name", { value: name });
664
+ function _(def) {
665
+ const inst = params?.Parent ? newError(Definition) : this;
666
+ init(inst, def);
667
+ const deferred = inst._zod.deferred;
668
+ if (deferred) {
669
+ for (const fn of deferred) fn();
670
+ inst._zod.deferred = void 0;
671
+ }
672
+ const pp = globalThis.__zod_globalConfig?.postProcessor;
673
+ if (pp) pp(inst);
674
+ return inst;
675
+ }
676
+ Object.defineProperty(_, "init", { value: init });
677
+ Object.defineProperty(_, Symbol.hasInstance, { value: (inst) => {
678
+ if (params?.Parent && inst instanceof params.Parent) return true;
679
+ return inst?._zod?.traits?.has(name);
680
+ } });
681
+ Object.defineProperty(_, "name", { value: name });
682
+ return _;
683
+ }
684
+ var $ZodAsyncError = class extends Error {
685
+ constructor() {
686
+ super(`Encountered Promise during synchronous parse. Use .parseAsync() instead.`);
687
+ }
688
+ };
689
+ var $ZodEncodeError = class extends Error {
690
+ constructor(name) {
691
+ super(`Encountered unidirectional transform during encode: ${name}`);
692
+ this.name = "ZodEncodeError";
693
+ }
694
+ };
695
+ (_a$1 = globalThis).__zod_globalConfig ?? (_a$1.__zod_globalConfig = {});
696
+ const globalConfig = globalThis.__zod_globalConfig;
697
+ function config(newConfig) {
698
+ if (newConfig) Object.assign(globalConfig, newConfig);
699
+ return globalConfig;
700
+ }
701
+ //#endregion
702
+ //#region ../../../node_modules/.pnpm/zod@4.6.5/node_modules/zod/v4/core/errors.js
703
+ function _getMessage() {
704
+ const internals = this._zod;
705
+ internals.message ?? (internals.message = JSON.stringify(internals.def, jsonStringifyReplacer, 2));
706
+ return internals.message;
707
+ }
708
+ function _setMessage(value) {
709
+ this._zod.message = value;
710
+ }
711
+ const _messageDesc = {
712
+ get: _getMessage,
713
+ set: _setMessage,
714
+ enumerable: true,
715
+ configurable: true
716
+ };
717
+ const _issuesDesc = {
718
+ value: void 0,
719
+ enumerable: false
720
+ };
721
+ const _installedToString = /* @__PURE__ */ new WeakSet([Object.prototype, Error.prototype]);
722
+ const initializer$1 = (inst, def) => {
723
+ inst.name = "$ZodError";
724
+ _issuesDesc.value = def;
725
+ Object.defineProperty(inst, "issues", _issuesDesc);
726
+ _issuesDesc.value = void 0;
727
+ Object.defineProperty(inst, "message", _messageDesc);
728
+ const proto = Object.getPrototypeOf(inst);
729
+ if (!_installedToString.has(proto)) {
730
+ _installedToString.add(proto);
731
+ Object.defineProperty(proto, "toString", {
732
+ configurable: true,
733
+ enumerable: false,
734
+ get() {
735
+ const value = () => this.message;
736
+ Object.defineProperty(this, "toString", {
737
+ value,
738
+ configurable: true,
739
+ writable: true
740
+ });
741
+ return value;
742
+ },
743
+ set(value) {
744
+ Object.defineProperty(this, "toString", {
745
+ value,
746
+ configurable: true,
747
+ writable: true
748
+ });
749
+ }
750
+ });
751
+ }
465
752
  };
466
753
  const $ZodError = $constructor("$ZodError", initializer$1);
467
- const $ZodRealError = $constructor("$ZodError", initializer$1, { Parent: Error });
754
+ $constructor("$ZodError", initializer$1, void 0, { Parent: Error });
755
+ /** Get-or-create `obj[key]` as an own data property. A path segment naming an inherited member
756
+ * ("toString", "constructor") would otherwise read through to the prototype, and assigning
757
+ * "__proto__" would hit the setter instead of creating a key. */
758
+ function node(obj, key, make) {
759
+ if (!Object.prototype.hasOwnProperty.call(obj, key)) if (key === "__proto__") Object.defineProperty(obj, key, {
760
+ value: make(),
761
+ writable: true,
762
+ enumerable: true,
763
+ configurable: true
764
+ });
765
+ else obj[key] = make();
766
+ return obj[key];
767
+ }
468
768
  function flattenError(error, mapper = (issue) => issue.message) {
469
769
  const fieldErrors = {};
470
770
  const formErrors = [];
471
- for (const sub of error.issues) if (sub.path.length > 0) {
472
- fieldErrors[sub.path[0]] = fieldErrors[sub.path[0]] || [];
473
- fieldErrors[sub.path[0]].push(mapper(sub));
474
- } else formErrors.push(mapper(sub));
771
+ for (const sub of error.issues) if (sub.path.length > 0) node(fieldErrors, sub.path[0], () => []).push(mapper(sub));
772
+ else formErrors.push(mapper(sub));
475
773
  return {
476
774
  formErrors,
477
775
  fieldErrors
@@ -491,12 +789,21 @@ window.__ModuleLoader__.load({
491
789
  let i = 0;
492
790
  while (i < fullpath.length) {
493
791
  const el = fullpath[i];
494
- if (!(i === fullpath.length - 1)) curr[el] = curr[el] || { _errors: [] };
495
- else {
496
- curr[el] = curr[el] || { _errors: [] };
497
- curr[el]._errors.push(mapper(issue));
792
+ const terminal = i === fullpath.length - 1;
793
+ if (el === "_errors") {
794
+ if (terminal) curr._errors.push(mapper(issue));
795
+ i++;
796
+ continue;
498
797
  }
499
- curr = curr[el];
798
+ if (!Object.prototype.hasOwnProperty.call(curr, el)) Object.defineProperty(curr, el, {
799
+ value: { _errors: [] },
800
+ enumerable: true,
801
+ writable: true,
802
+ configurable: true
803
+ });
804
+ const node = curr[el];
805
+ if (terminal) node._errors.push(mapper(issue));
806
+ curr = node;
500
807
  i++;
501
808
  }
502
809
  }
@@ -506,8 +813,54 @@ window.__ModuleLoader__.load({
506
813
  return fieldErrors;
507
814
  }
508
815
  //#endregion
509
- //#region ../../node_modules/.pnpm/zod@4.4.3/node_modules/zod/v4/core/parse.js
510
- const _parse = (_Err) => (schema, value, _ctx, _params) => {
816
+ //#region ../../../node_modules/.pnpm/zod@4.6.5/node_modules/zod/v4/core/parse.js
817
+ function finalizeParams(callee, params) {
818
+ return {
819
+ callee: params?.callee ?? callee,
820
+ Err: params?.Err
821
+ };
822
+ }
823
+ const _parse = (_Err) => {
824
+ const fn = (schema, value, _ctx, _params) => {
825
+ const ctx = _ctx ? {
826
+ ..._ctx,
827
+ async: false
828
+ } : { async: false };
829
+ const result = schema._zod.run({
830
+ value,
831
+ issues: []
832
+ }, ctx);
833
+ if (result instanceof Promise) throw new $ZodAsyncError();
834
+ if (result.issues.length) {
835
+ const e = new ((_params?.Err) ?? _Err)(result.issues.map((iss) => finalizeIssue(iss, ctx, config())));
836
+ captureStackTrace(e, _params?.callee ?? fn);
837
+ throw e;
838
+ }
839
+ return result.value;
840
+ };
841
+ return fn;
842
+ };
843
+ const _parseAsync = (_Err) => {
844
+ const fn = async (schema, value, _ctx, params) => {
845
+ const ctx = _ctx ? {
846
+ ..._ctx,
847
+ async: true
848
+ } : { async: true };
849
+ let result = schema._zod.run({
850
+ value,
851
+ issues: []
852
+ }, ctx);
853
+ if (result instanceof Promise) result = await result;
854
+ if (result.issues.length) {
855
+ const e = new ((params?.Err) ?? _Err)(result.issues.map((iss) => finalizeIssue(iss, ctx, config())));
856
+ captureStackTrace(e, params?.callee ?? fn);
857
+ throw e;
858
+ }
859
+ return result.value;
860
+ };
861
+ return fn;
862
+ };
863
+ const _safeParse = (_Err) => (schema, value, _ctx) => {
511
864
  const ctx = _ctx ? {
512
865
  ..._ctx,
513
866
  async: false
@@ -517,14 +870,31 @@ window.__ModuleLoader__.load({
517
870
  issues: []
518
871
  }, ctx);
519
872
  if (result instanceof Promise) throw new $ZodAsyncError();
520
- if (result.issues.length) {
521
- const e = new ((_params?.Err) ?? _Err)(result.issues.map((iss) => finalizeIssue(iss, ctx, config())));
522
- captureStackTrace(e, _params?.callee);
523
- throw e;
524
- }
525
- return result.value;
873
+ return result.issues.length ? failure(_Err, result.issues, ctx) : {
874
+ success: true,
875
+ data: result.value
876
+ };
526
877
  };
527
- const _parseAsync = (_Err) => async (schema, value, _ctx, params) => {
878
+ function failure(Err, issues, ctx) {
879
+ let error;
880
+ return {
881
+ success: false,
882
+ get error() {
883
+ if (!error) {
884
+ error = new Err(issues.map((iss) => finalizeIssue(iss, ctx, config())));
885
+ issues = void 0;
886
+ ctx = void 0;
887
+ }
888
+ return error;
889
+ },
890
+ set error(e) {
891
+ error = e;
892
+ issues = void 0;
893
+ ctx = void 0;
894
+ }
895
+ };
896
+ }
897
+ const _safeParseAsync = (_Err) => async (schema, value, _ctx) => {
528
898
  const ctx = _ctx ? {
529
899
  ..._ctx,
530
900
  async: true
@@ -534,70 +904,96 @@ window.__ModuleLoader__.load({
534
904
  issues: []
535
905
  }, ctx);
536
906
  if (result instanceof Promise) result = await result;
537
- if (result.issues.length) {
538
- const e = new ((params?.Err) ?? _Err)(result.issues.map((iss) => finalizeIssue(iss, ctx, config())));
539
- captureStackTrace(e, params?.callee);
540
- throw e;
541
- }
542
- return result.value;
907
+ return result.issues.length ? failure(_Err, result.issues, ctx) : {
908
+ success: true,
909
+ data: result.value
910
+ };
543
911
  };
544
- const _safeParse = (_Err) => (schema, value, _ctx) => {
912
+ const COMPILE_INVALID = /* @__PURE__ */ Symbol.for("zod.compile.invalid");
913
+ const COMPILE_FALLBACK = /* @__PURE__ */ Symbol.for("zod.compile.fallback");
914
+ const validate = ((schema, value, _ctx) => {
915
+ const validator = schema._zod.bag.validator;
916
+ if (validator !== void 0) {
917
+ if (validator(value) !== COMPILE_INVALID) return true;
918
+ if (validator.definite === true && _ctx === void 0) return false;
919
+ }
920
+ return validateFallback(schema, value, _ctx);
921
+ });
922
+ function validateFallback(schema, value, _ctx) {
545
923
  const ctx = _ctx ? {
546
924
  ..._ctx,
547
- async: false
548
- } : { async: false };
549
- const result = schema._zod.run({
925
+ async: false,
926
+ abortEarly: true
927
+ } : {
928
+ async: false,
929
+ abortEarly: true
930
+ };
931
+ const fallbackRun = schema._zod.bag.fallbackRun;
932
+ let result;
933
+ if (fallbackRun) {
934
+ ctx[COMPILE_FALLBACK] = true;
935
+ result = fallbackRun({
936
+ value,
937
+ issues: []
938
+ }, ctx);
939
+ } else result = schema._zod.run({
550
940
  value,
551
941
  issues: []
552
942
  }, ctx);
553
943
  if (result instanceof Promise) throw new $ZodAsyncError();
554
- return result.issues.length ? {
555
- success: false,
556
- error: new (_Err ?? $ZodError)(result.issues.map((iss) => finalizeIssue(iss, ctx, config())))
557
- } : {
558
- success: true,
559
- data: result.value
560
- };
561
- };
562
- const safeParse$1 = /* @__PURE__*/ _safeParse($ZodRealError);
563
- const _safeParseAsync = (_Err) => async (schema, value, _ctx) => {
944
+ return result.issues.length === 0;
945
+ }
946
+ const validateAsync$1 = async (schema, value, _ctx) => {
564
947
  const ctx = _ctx ? {
565
948
  ..._ctx,
566
- async: true
567
- } : { async: true };
949
+ async: true,
950
+ abortEarly: true
951
+ } : {
952
+ async: true,
953
+ abortEarly: true
954
+ };
568
955
  let result = schema._zod.run({
569
956
  value,
570
957
  issues: []
571
958
  }, ctx);
572
959
  if (result instanceof Promise) result = await result;
573
- return result.issues.length ? {
574
- success: false,
575
- error: new _Err(result.issues.map((iss) => finalizeIssue(iss, ctx, config())))
576
- } : {
577
- success: true,
578
- data: result.value
579
- };
960
+ return result.issues.length === 0;
580
961
  };
581
- const safeParseAsync$1 = /* @__PURE__*/ _safeParseAsync($ZodRealError);
582
- const _encode = (_Err) => (schema, value, _ctx) => {
583
- const ctx = _ctx ? {
584
- ..._ctx,
585
- direction: "backward"
586
- } : { direction: "backward" };
587
- return _parse(_Err)(schema, value, ctx);
962
+ const _encode = (_Err) => {
963
+ const parse = _parse(_Err);
964
+ const fn = (schema, value, _ctx, _params) => {
965
+ const ctx = _ctx ? {
966
+ ..._ctx,
967
+ direction: "backward"
968
+ } : { direction: "backward" };
969
+ return parse(schema, value, ctx, finalizeParams(fn, _params));
970
+ };
971
+ return fn;
588
972
  };
589
- const _decode = (_Err) => (schema, value, _ctx) => {
590
- return _parse(_Err)(schema, value, _ctx);
973
+ const _decode = (_Err) => {
974
+ const parse = _parse(_Err);
975
+ const fn = (schema, value, _ctx, _params) => {
976
+ return parse(schema, value, _ctx, finalizeParams(fn, _params));
977
+ };
978
+ return fn;
591
979
  };
592
- const _encodeAsync = (_Err) => async (schema, value, _ctx) => {
593
- const ctx = _ctx ? {
594
- ..._ctx,
595
- direction: "backward"
596
- } : { direction: "backward" };
597
- return _parseAsync(_Err)(schema, value, ctx);
980
+ const _encodeAsync = (_Err) => {
981
+ const parseAsync = _parseAsync(_Err);
982
+ const fn = async (schema, value, _ctx, _params) => {
983
+ const ctx = _ctx ? {
984
+ ..._ctx,
985
+ direction: "backward"
986
+ } : { direction: "backward" };
987
+ return await parseAsync(schema, value, ctx, finalizeParams(fn, _params));
988
+ };
989
+ return fn;
598
990
  };
599
- const _decodeAsync = (_Err) => async (schema, value, _ctx) => {
600
- return _parseAsync(_Err)(schema, value, _ctx);
991
+ const _decodeAsync = (_Err) => {
992
+ const parseAsync = _parseAsync(_Err);
993
+ const fn = async (schema, value, _ctx, _params) => {
994
+ return await parseAsync(schema, value, _ctx, finalizeParams(fn, _params));
995
+ };
996
+ return fn;
601
997
  };
602
998
  const _safeEncode = (_Err) => (schema, value, _ctx) => {
603
999
  const ctx = _ctx ? {
@@ -620,7 +1016,7 @@ window.__ModuleLoader__.load({
620
1016
  return _safeParseAsync(_Err)(schema, value, _ctx);
621
1017
  };
622
1018
  //#endregion
623
- //#region ../../node_modules/.pnpm/zod@4.4.3/node_modules/zod/v4/core/regexes.js
1019
+ //#region ../../../node_modules/.pnpm/zod@4.6.5/node_modules/zod/v4/core/regexes.js
624
1020
  /**
625
1021
  * @deprecated CUID v1 is deprecated by its authors due to information leakage
626
1022
  * (timestamps embedded in the id). Use {@link cuid2} instead.
@@ -628,12 +1024,15 @@ window.__ModuleLoader__.load({
628
1024
  */
629
1025
  const cuid = /^[cC][0-9a-z]{6,}$/;
630
1026
  const cuid2 = /^[0-9a-z]+$/;
631
- const ulid = /^[0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{26}$/;
1027
+ const ulid = /^[0-7][0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{25}$/;
632
1028
  const xid = /^[0-9a-vA-V]{20}$/;
633
1029
  const ksuid = /^[A-Za-z0-9]{27}$/;
634
1030
  const nanoid = /^[a-zA-Z0-9_-]{21}$/;
1031
+ function nanoidOfLength(length) {
1032
+ return new RegExp(`^[a-zA-Z0-9_-]{${length}}$`);
1033
+ }
635
1034
  /** ISO 8601-1 duration regex. Does not support the 8601-2 extensions like negative durations or fractional/negative components. */
636
- 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)?)?)$/;
1035
+ const duration = /^P(?:(\d+W)|(?!.*W)(?=\d|T\d)(\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+([.,]\d+)?S)?)?)$/;
637
1036
  /** A regex for any UUID-like identifier: 8-4-4-4-12 hex pattern */
638
1037
  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})$/;
639
1038
  /** Returns a regex for validating an RFC 9562/4122 UUID.
@@ -644,53 +1043,62 @@ window.__ModuleLoader__.load({
644
1043
  return new RegExp(`^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-${version}[0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12})$`);
645
1044
  };
646
1045
  /** Practical email validation */
647
- const email = /^(?!\.)(?!.*\.\.)([A-Za-z0-9_'+\-\.]*)[A-Za-z0-9_+-]@([A-Za-z0-9][A-Za-z0-9\-]*\.)+[A-Za-z]{2,}$/;
648
- const _emoji$1 = `^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$`;
1046
+ const email = /^(?:[A-Za-z0-9_'+\-]+\.)*[A-Za-z0-9_'+\-]*[A-Za-z0-9_+-]@(?:[A-Za-z0-9][A-Za-z0-9\-]*\.)+[A-Za-z]{2,}$/;
1047
+ const _emoji$1 = `^(?=[\\s\\S]*[\\p{Extended_Pictographic}\\p{Regional_Indicator}\\u20E3])[\\p{Extended_Pictographic}\\p{Emoji_Component}]+$`;
649
1048
  function emoji() {
650
1049
  return new RegExp(_emoji$1, "u");
651
1050
  }
652
1051
  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])$/;
653
1052
  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}|:))$/;
654
1053
  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])$/;
655
- 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])$/;
1054
+ 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])$/;
656
1055
  const base64 = /^$|^(?:[0-9a-zA-Z+/]{4})*(?:(?:[0-9a-zA-Z+/]{2}==)|(?:[0-9a-zA-Z+/]{3}=))?$/;
657
- const base64url = /^[A-Za-z0-9_-]*$/;
1056
+ const base64url = /^(?:[A-Za-z0-9_-]{4})*(?:[A-Za-z0-9_-]{2,3})?$/;
658
1057
  const httpProtocol = /^https?$/;
659
1058
  const e164 = /^\+[1-9]\d{6,14}$/;
660
1059
  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])))`;
661
- const date$1 = /*@__PURE__*/ new RegExp(`^${dateSource}$`);
1060
+ /** Anchors a pattern source. The interpolation lives here rather than at the call site because
1061
+ * esbuild will not drop a `@__PURE__` call whose own argument interpolates a variable, but it
1062
+ * will drop `anchor(dateSource)`. Keeping it inline pinned `date` into every bundle. */
1063
+ function anchor(source) {
1064
+ return new RegExp(`^${source}$`);
1065
+ }
1066
+ const date = /*@__PURE__*/ anchor(dateSource);
662
1067
  function timeSource(args) {
663
1068
  const hhmm = `(?:[01]\\d|2[0-3]):[0-5]\\d`;
664
- 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+)?)?`;
1069
+ 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+)?)?`;
665
1070
  }
666
- function time$1(args) {
1071
+ function time(args) {
667
1072
  return new RegExp(`^${timeSource(args)}$`);
668
1073
  }
669
- function datetime$1(args) {
670
- const time = timeSource({ precision: args.precision });
1074
+ function datetime(args) {
671
1075
  const opts = ["Z"];
672
- if (args.local) opts.push("");
673
1076
  if (args.offset) opts.push(`([+-](?:[01]\\d|2[0-3]):[0-5]\\d)`);
674
- const timeRegex = `${time}(?:${opts.join("|")})`;
1077
+ const qualified = `${timeSource({
1078
+ precision: args.precision,
1079
+ seconds: true
1080
+ })}(?:${opts.join("|")})`;
1081
+ const timeRegex = args.local ? `${qualified}|${timeSource({ precision: args.precision })}` : qualified;
675
1082
  return new RegExp(`^${dateSource}T(?:${timeRegex})$`);
676
1083
  }
677
- const string$1 = (params) => {
678
- const regex = params ? `[\\s\\S]{${params?.minimum ?? 0},${params?.maximum ?? ""}}` : `[\\s\\S]*`;
679
- return new RegExp(`^${regex}$`);
680
- };
681
- const integer = /^-?\d+$/;
1084
+ const anyString = /^[\s\S]{0,}$/;
682
1085
  const number$1 = /^-?\d+(?:\.\d+)?$/;
683
1086
  const boolean$1 = /^(?:true|false)$/i;
684
1087
  const lowercase = /^[^A-Z]*$/;
685
1088
  const uppercase = /^[^a-z]*$/;
686
1089
  //#endregion
687
- //#region ../../node_modules/.pnpm/zod@4.4.3/node_modules/zod/v4/core/checks.js
1090
+ //#region ../../../node_modules/.pnpm/zod@4.6.5/node_modules/zod/v4/core/checks.js
688
1091
  const $ZodCheck = /*@__PURE__*/ $constructor("$ZodCheck", (inst, def) => {
689
1092
  var _a;
690
1093
  inst._zod ?? (inst._zod = {});
691
1094
  inst._zod.def = def;
692
1095
  (_a = inst._zod).onattach ?? (_a.onattach = []);
693
1096
  });
1097
+ /** Default `when` for length-based checks: run only on non-nullish values with a `length`. */
1098
+ const _whenHasLength = (payload) => {
1099
+ const val = payload.value;
1100
+ return !nullish(val) && val.length !== void 0;
1101
+ };
694
1102
  const numericOriginMap = {
695
1103
  number: "number",
696
1104
  bigint: "bigint",
@@ -699,16 +1107,10 @@ window.__ModuleLoader__.load({
699
1107
  const $ZodCheckLessThan = /*@__PURE__*/ $constructor("$ZodCheckLessThan", (inst, def) => {
700
1108
  $ZodCheck.init(inst, def);
701
1109
  const origin = numericOriginMap[typeof def.value];
702
- inst._zod.onattach.push((inst) => {
703
- const bag = inst._zod.bag;
704
- const curr = (def.inclusive ? bag.maximum : bag.exclusiveMaximum) ?? Number.POSITIVE_INFINITY;
705
- if (def.value < curr) if (def.inclusive) bag.maximum = def.value;
706
- else bag.exclusiveMaximum = def.value;
707
- });
708
1110
  inst._zod.check = (payload) => {
709
1111
  if (def.inclusive ? payload.value <= def.value : payload.value < def.value) return;
710
1112
  payload.issues.push({
711
- origin,
1113
+ origin: numericOriginMap[typeof payload.value] ?? origin,
712
1114
  code: "too_big",
713
1115
  maximum: typeof def.value === "object" ? def.value.getTime() : def.value,
714
1116
  input: payload.value,
@@ -721,16 +1123,10 @@ window.__ModuleLoader__.load({
721
1123
  const $ZodCheckGreaterThan = /*@__PURE__*/ $constructor("$ZodCheckGreaterThan", (inst, def) => {
722
1124
  $ZodCheck.init(inst, def);
723
1125
  const origin = numericOriginMap[typeof def.value];
724
- inst._zod.onattach.push((inst) => {
725
- const bag = inst._zod.bag;
726
- const curr = (def.inclusive ? bag.minimum : bag.exclusiveMinimum) ?? Number.NEGATIVE_INFINITY;
727
- if (def.value > curr) if (def.inclusive) bag.minimum = def.value;
728
- else bag.exclusiveMinimum = def.value;
729
- });
730
1126
  inst._zod.check = (payload) => {
731
1127
  if (def.inclusive ? payload.value >= def.value : payload.value > def.value) return;
732
1128
  payload.issues.push({
733
- origin,
1129
+ origin: numericOriginMap[typeof payload.value] ?? origin,
734
1130
  code: "too_small",
735
1131
  minimum: typeof def.value === "object" ? def.value.getTime() : def.value,
736
1132
  input: payload.value,
@@ -742,13 +1138,9 @@ window.__ModuleLoader__.load({
742
1138
  });
743
1139
  const $ZodCheckMultipleOf = /*@__PURE__*/ $constructor("$ZodCheckMultipleOf", (inst, def) => {
744
1140
  $ZodCheck.init(inst, def);
745
- inst._zod.onattach.push((inst) => {
746
- var _a;
747
- (_a = inst._zod.bag).multipleOf ?? (_a.multipleOf = def.value);
748
- });
749
1141
  inst._zod.check = (payload) => {
750
1142
  if (typeof payload.value !== typeof def.value) throw new Error("Cannot mix number and bigint in multiple_of check.");
751
- if (typeof payload.value === "bigint" ? payload.value % def.value === BigInt(0) : floatSafeRemainder(payload.value, def.value) === 0) return;
1143
+ if (typeof payload.value === "bigint" ? def.value !== BigInt(0) && payload.value % def.value === BigInt(0) : floatSafeRemainder(payload.value, def.value) === 0) return;
752
1144
  payload.issues.push({
753
1145
  origin: typeof payload.value,
754
1146
  code: "not_multiple_of",
@@ -765,13 +1157,6 @@ window.__ModuleLoader__.load({
765
1157
  const isInt = def.format?.includes("int");
766
1158
  const origin = isInt ? "int" : "number";
767
1159
  const [minimum, maximum] = NUMBER_FORMAT_RANGES[def.format];
768
- inst._zod.onattach.push((inst) => {
769
- const bag = inst._zod.bag;
770
- bag.format = def.format;
771
- bag.minimum = minimum;
772
- bag.maximum = maximum;
773
- if (isInt) bag.pattern = integer;
774
- });
775
1160
  inst._zod.check = (payload) => {
776
1161
  const input = payload.value;
777
1162
  if (isInt) {
@@ -833,17 +1218,11 @@ window.__ModuleLoader__.load({
833
1218
  const $ZodCheckMaxLength = /*@__PURE__*/ $constructor("$ZodCheckMaxLength", (inst, def) => {
834
1219
  var _a;
835
1220
  $ZodCheck.init(inst, def);
836
- (_a = inst._zod.def).when ?? (_a.when = (payload) => {
837
- const val = payload.value;
838
- return !nullish(val) && val.length !== void 0;
839
- });
840
- inst._zod.onattach.push((inst) => {
841
- const curr = inst._zod.bag.maximum ?? Number.POSITIVE_INFINITY;
842
- if (def.maximum < curr) inst._zod.bag.maximum = def.maximum;
843
- });
1221
+ (_a = inst._zod.def).when ?? (_a.when = _whenHasLength);
844
1222
  inst._zod.check = (payload) => {
845
1223
  const input = payload.value;
846
- if (input.length <= def.maximum) return;
1224
+ const units = input.length;
1225
+ if ((typeof input === "string" && units > def.maximum ? codePointLength(input) : units) <= def.maximum) return;
847
1226
  const origin = getLengthableOrigin(input);
848
1227
  payload.issues.push({
849
1228
  origin,
@@ -859,17 +1238,11 @@ window.__ModuleLoader__.load({
859
1238
  const $ZodCheckMinLength = /*@__PURE__*/ $constructor("$ZodCheckMinLength", (inst, def) => {
860
1239
  var _a;
861
1240
  $ZodCheck.init(inst, def);
862
- (_a = inst._zod.def).when ?? (_a.when = (payload) => {
863
- const val = payload.value;
864
- return !nullish(val) && val.length !== void 0;
865
- });
866
- inst._zod.onattach.push((inst) => {
867
- const curr = inst._zod.bag.minimum ?? Number.NEGATIVE_INFINITY;
868
- if (def.minimum > curr) inst._zod.bag.minimum = def.minimum;
869
- });
1241
+ (_a = inst._zod.def).when ?? (_a.when = _whenHasLength);
870
1242
  inst._zod.check = (payload) => {
871
1243
  const input = payload.value;
872
- if (input.length >= def.minimum) return;
1244
+ const units = input.length;
1245
+ if ((typeof input === "string" && units >= def.minimum && units < def.minimum * 2 ? codePointLength(input) : units) >= def.minimum) return;
873
1246
  const origin = getLengthableOrigin(input);
874
1247
  payload.issues.push({
875
1248
  origin,
@@ -885,19 +1258,11 @@ window.__ModuleLoader__.load({
885
1258
  const $ZodCheckLengthEquals = /*@__PURE__*/ $constructor("$ZodCheckLengthEquals", (inst, def) => {
886
1259
  var _a;
887
1260
  $ZodCheck.init(inst, def);
888
- (_a = inst._zod.def).when ?? (_a.when = (payload) => {
889
- const val = payload.value;
890
- return !nullish(val) && val.length !== void 0;
891
- });
892
- inst._zod.onattach.push((inst) => {
893
- const bag = inst._zod.bag;
894
- bag.minimum = def.length;
895
- bag.maximum = def.length;
896
- bag.length = def.length;
897
- });
1261
+ (_a = inst._zod.def).when ?? (_a.when = _whenHasLength);
898
1262
  inst._zod.check = (payload) => {
899
1263
  const input = payload.value;
900
- const length = input.length;
1264
+ const units = input.length;
1265
+ const length = typeof input === "string" && units >= def.length && units <= def.length * 2 ? codePointLength(input) : units;
901
1266
  if (length === def.length) return;
902
1267
  const origin = getLengthableOrigin(input);
903
1268
  const tooBig = length > def.length;
@@ -921,14 +1286,6 @@ window.__ModuleLoader__.load({
921
1286
  const $ZodCheckStringFormat = /*@__PURE__*/ $constructor("$ZodCheckStringFormat", (inst, def) => {
922
1287
  var _a, _b;
923
1288
  $ZodCheck.init(inst, def);
924
- inst._zod.onattach.push((inst) => {
925
- const bag = inst._zod.bag;
926
- bag.format = def.format;
927
- if (def.pattern) {
928
- bag.patterns ?? (bag.patterns = /* @__PURE__ */ new Set());
929
- bag.patterns.add(def.pattern);
930
- }
931
- });
932
1289
  if (def.pattern) (_a = inst._zod).check ?? (_a.check = (payload) => {
933
1290
  def.pattern.lastIndex = 0;
934
1291
  if (def.pattern.test(payload.value)) return;
@@ -971,13 +1328,7 @@ window.__ModuleLoader__.load({
971
1328
  const $ZodCheckIncludes = /*@__PURE__*/ $constructor("$ZodCheckIncludes", (inst, def) => {
972
1329
  $ZodCheck.init(inst, def);
973
1330
  const escapedRegex = escapeRegex(def.includes);
974
- const pattern = new RegExp(typeof def.position === "number" ? `^.{${def.position}}${escapedRegex}` : escapedRegex);
975
- def.pattern = pattern;
976
- inst._zod.onattach.push((inst) => {
977
- const bag = inst._zod.bag;
978
- bag.patterns ?? (bag.patterns = /* @__PURE__ */ new Set());
979
- bag.patterns.add(pattern);
980
- });
1331
+ def.pattern = new RegExp(typeof def.position === "number" ? `^.{${def.position},}${escapedRegex}` : escapedRegex);
981
1332
  inst._zod.check = (payload) => {
982
1333
  if (payload.value.includes(def.includes, def.position)) return;
983
1334
  payload.issues.push({
@@ -995,11 +1346,6 @@ window.__ModuleLoader__.load({
995
1346
  $ZodCheck.init(inst, def);
996
1347
  const pattern = new RegExp(`^${escapeRegex(def.prefix)}.*`);
997
1348
  def.pattern ?? (def.pattern = pattern);
998
- inst._zod.onattach.push((inst) => {
999
- const bag = inst._zod.bag;
1000
- bag.patterns ?? (bag.patterns = /* @__PURE__ */ new Set());
1001
- bag.patterns.add(pattern);
1002
- });
1003
1349
  inst._zod.check = (payload) => {
1004
1350
  if (payload.value.startsWith(def.prefix)) return;
1005
1351
  payload.issues.push({
@@ -1017,11 +1363,6 @@ window.__ModuleLoader__.load({
1017
1363
  $ZodCheck.init(inst, def);
1018
1364
  const pattern = new RegExp(`.*${escapeRegex(def.suffix)}$`);
1019
1365
  def.pattern ?? (def.pattern = pattern);
1020
- inst._zod.onattach.push((inst) => {
1021
- const bag = inst._zod.bag;
1022
- bag.patterns ?? (bag.patterns = /* @__PURE__ */ new Set());
1023
- bag.patterns.add(pattern);
1024
- });
1025
1366
  inst._zod.check = (payload) => {
1026
1367
  if (payload.value.endsWith(def.suffix)) return;
1027
1368
  payload.issues.push({
@@ -1042,17 +1383,21 @@ window.__ModuleLoader__.load({
1042
1383
  };
1043
1384
  });
1044
1385
  //#endregion
1045
- //#region ../../node_modules/.pnpm/zod@4.4.3/node_modules/zod/v4/core/doc.js
1386
+ //#region ../../../node_modules/.pnpm/zod@4.6.5/node_modules/zod/v4/core/doc.js
1046
1387
  var Doc = class {
1047
- constructor(args = []) {
1388
+ constructor(args = [], closed = {}) {
1048
1389
  this.content = [];
1049
1390
  this.indent = 0;
1050
- if (this) this.args = args;
1391
+ this.args = args;
1392
+ this.closed = closed;
1051
1393
  }
1052
1394
  indented(fn) {
1053
1395
  this.indent += 1;
1054
- fn(this);
1055
- this.indent -= 1;
1396
+ try {
1397
+ fn(this);
1398
+ } finally {
1399
+ this.indent -= 1;
1400
+ }
1056
1401
  }
1057
1402
  write(arg) {
1058
1403
  if (typeof arg === "function") {
@@ -1067,28 +1412,27 @@ window.__ModuleLoader__.load({
1067
1412
  }
1068
1413
  compile() {
1069
1414
  const F = Function;
1070
- const args = this?.args;
1071
- const lines = [...(this?.content ?? [``]).map((x) => ` ${x}`)];
1072
- return new F(...args, lines.join("\n"));
1415
+ const content = this?.content ?? [``];
1416
+ return new F(...Object.keys(this.closed), `return function (${this.args.join(", ")}) {\n${content.join("\n")}\n};`)(...Object.values(this.closed));
1073
1417
  }
1074
1418
  };
1075
1419
  //#endregion
1076
- //#region ../../node_modules/.pnpm/zod@4.4.3/node_modules/zod/v4/core/versions.js
1420
+ //#region ../../../node_modules/.pnpm/zod@4.6.5/node_modules/zod/v4/core/versions.js
1077
1421
  const version = {
1078
1422
  major: 4,
1079
- minor: 4,
1080
- patch: 3
1423
+ minor: 6,
1424
+ patch: 5
1081
1425
  };
1082
1426
  //#endregion
1083
- //#region ../../node_modules/.pnpm/zod@4.4.3/node_modules/zod/v4/core/schemas.js
1427
+ //#region ../../../node_modules/.pnpm/zod@4.6.5/node_modules/zod/v4/core/schemas.js
1084
1428
  const $ZodType = /*@__PURE__*/ $constructor("$ZodType", (inst, def) => {
1085
1429
  var _a;
1086
1430
  inst ?? (inst = {});
1087
1431
  inst._zod.def = def;
1088
1432
  inst._zod.bag = inst._zod.bag || {};
1089
1433
  inst._zod.version = version;
1090
- const checks = [...inst._zod.def.checks ?? []];
1091
- if (inst._zod.traits.has("$ZodCheck")) checks.unshift(inst);
1434
+ const defChecks = inst._zod.def.checks;
1435
+ const checks = inst._zod.traits.has("$ZodCheck") ? [inst, ...defChecks ?? []] : defChecks?.length ? [...defChecks] : [];
1092
1436
  for (const ch of checks) for (const fn of ch._zod.onattach) fn(inst);
1093
1437
  if (checks.length === 0) {
1094
1438
  (_a = inst._zod).deferred ?? (_a.deferred = []);
@@ -1097,6 +1441,7 @@ window.__ModuleLoader__.load({
1097
1441
  });
1098
1442
  } else {
1099
1443
  const runChecks = (payload, checks, ctx) => {
1444
+ if (payload.memo) return payload;
1100
1445
  let isAborted = aborted(payload);
1101
1446
  let asyncResult;
1102
1447
  for (const ch of checks) {
@@ -1110,10 +1455,12 @@ window.__ModuleLoader__.load({
1110
1455
  if (asyncResult || _ instanceof Promise) asyncResult = (asyncResult ?? Promise.resolve()).then(async () => {
1111
1456
  await _;
1112
1457
  if (payload.issues.length === currLen) return;
1458
+ attachSchema(payload.issues, currLen, inst);
1113
1459
  if (!isAborted) isAborted = aborted(payload, currLen);
1114
1460
  });
1115
1461
  else {
1116
1462
  if (payload.issues.length === currLen) continue;
1463
+ attachSchema(payload.issues, currLen, inst);
1117
1464
  if (!isAborted) isAborted = aborted(payload, currLen);
1118
1465
  }
1119
1466
  }
@@ -1157,22 +1504,43 @@ window.__ModuleLoader__.load({
1157
1504
  return runChecks(result, checks, ctx);
1158
1505
  };
1159
1506
  }
1160
- defineLazy(inst, "~standard", () => ({
1507
+ }, {
1508
+ get "~standard"() {
1509
+ return hide(this, "~standard", standardProps(this));
1510
+ },
1511
+ set "~standard"(value) {
1512
+ own(this, "~standard", value);
1513
+ }
1514
+ });
1515
+ /** The Standard Schema surface for `inst`. Shared so wrappers can extend it without forcing it. */
1516
+ const toStandardResult = (r, ctx) => r.issues.length ? { issues: r.issues.map((iss) => finalizeIssue(iss, ctx, config())) } : { value: r.value };
1517
+ async function validateAsync(inst, value) {
1518
+ const ctx = { async: true };
1519
+ return toStandardResult(await inst._zod.run({
1520
+ value,
1521
+ issues: []
1522
+ }, ctx), ctx);
1523
+ }
1524
+ function standardProps(inst) {
1525
+ return {
1161
1526
  validate: (value) => {
1527
+ const ctx = { async: false };
1162
1528
  try {
1163
- const r = safeParse$1(inst, value);
1164
- return r.success ? { value: r.data } : { issues: r.error?.issues };
1165
- } catch (_) {
1166
- return safeParseAsync$1(inst, value).then((r) => r.success ? { value: r.data } : { issues: r.error?.issues });
1167
- }
1529
+ const r = inst._zod.run({
1530
+ value,
1531
+ issues: []
1532
+ }, ctx);
1533
+ if (!(r instanceof Promise)) return toStandardResult(r, ctx);
1534
+ } catch (_) {}
1535
+ return validateAsync(inst, value);
1168
1536
  },
1169
1537
  vendor: "zod",
1170
1538
  version: 1
1171
- }));
1172
- });
1539
+ };
1540
+ }
1173
1541
  const $ZodString = /*@__PURE__*/ $constructor("$ZodString", (inst, def) => {
1174
1542
  $ZodType.init(inst, def);
1175
- inst._zod.pattern = [...inst?._zod.bag?.patterns ?? []].pop() ?? string$1(inst._zod.bag);
1543
+ inst._zod.pattern = def.pattern ?? anyString;
1176
1544
  inst._zod.parse = (payload, _) => {
1177
1545
  if (def.coerce) try {
1178
1546
  payload.value = String(payload.value);
@@ -1216,51 +1584,95 @@ window.__ModuleLoader__.load({
1216
1584
  def.pattern ?? (def.pattern = email);
1217
1585
  $ZodStringFormat.init(inst, def);
1218
1586
  });
1587
+ function canParseURL(input) {
1588
+ try {
1589
+ if (typeof URL !== "undefined" && typeof URL.canParse === "function") return URL.canParse(input);
1590
+ new URL(input);
1591
+ return true;
1592
+ } catch {
1593
+ return false;
1594
+ }
1595
+ }
1596
+ function validateURL(trimmed, def) {
1597
+ if (!("normalize" in def) && !("hostname" in def) && !("protocol" in def)) return canParseURL(trimmed) || 2;
1598
+ return parseURLObject(trimmed, def);
1599
+ }
1600
+ /** Parses a URL while preserving the non-normalizing HTTP guard. */
1601
+ function parseURLObject(trimmed, def) {
1602
+ if (!def.normalize && def.protocol?.source === httpProtocol.source && !/^https?:\/\//i.test(trimmed)) return 1;
1603
+ try {
1604
+ if (typeof URL !== "undefined") {
1605
+ const URLStatic = URL;
1606
+ if (typeof URLStatic.parse === "function") return URLStatic.parse(trimmed) ?? 2;
1607
+ }
1608
+ return new URL(trimmed);
1609
+ } catch {
1610
+ return 2;
1611
+ }
1612
+ }
1613
+ const asciiTabOrNewline = /[\t\n\r]/g;
1614
+ /** 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. */
1615
+ function stripTabAndNewline(value) {
1616
+ return value.replace(asciiTabOrNewline, "");
1617
+ }
1618
+ function urlHostnameOk(url, hostname) {
1619
+ hostname.lastIndex = 0;
1620
+ return hostname.test(url.hostname);
1621
+ }
1622
+ function urlProtocolOk(url, protocol) {
1623
+ protocol.lastIndex = 0;
1624
+ return protocol.test(url.protocol.endsWith(":") ? url.protocol.slice(0, -1) : url.protocol);
1625
+ }
1219
1626
  const $ZodURL = /*@__PURE__*/ $constructor("$ZodURL", (inst, def) => {
1220
1627
  $ZodStringFormat.init(inst, def);
1221
1628
  inst._zod.check = (payload) => {
1222
1629
  try {
1223
1630
  const trimmed = payload.value.trim();
1224
- if (!def.normalize && def.protocol?.source === httpProtocol.source) {
1225
- if (!/^https?:\/\//i.test(trimmed)) {
1226
- payload.issues.push({
1227
- code: "invalid_format",
1228
- format: "url",
1229
- note: "Invalid URL format",
1230
- input: payload.value,
1231
- inst,
1232
- continue: !def.abort
1233
- });
1234
- return;
1235
- }
1236
- }
1237
- const url = new URL(trimmed);
1238
- if (def.hostname) {
1239
- def.hostname.lastIndex = 0;
1240
- if (!def.hostname.test(url.hostname)) payload.issues.push({
1631
+ const url = validateURL(trimmed, def);
1632
+ if (url === 1) {
1633
+ payload.issues.push({
1241
1634
  code: "invalid_format",
1242
1635
  format: "url",
1243
- note: "Invalid hostname",
1244
- pattern: def.hostname.source,
1636
+ note: "Invalid URL format",
1245
1637
  input: payload.value,
1246
1638
  inst,
1247
1639
  continue: !def.abort
1248
1640
  });
1641
+ return;
1249
1642
  }
1250
- if (def.protocol) {
1251
- def.protocol.lastIndex = 0;
1252
- if (!def.protocol.test(url.protocol.endsWith(":") ? url.protocol.slice(0, -1) : url.protocol)) payload.issues.push({
1643
+ if (url === 2) {
1644
+ payload.issues.push({
1253
1645
  code: "invalid_format",
1254
1646
  format: "url",
1255
- note: "Invalid protocol",
1256
- pattern: def.protocol.source,
1257
1647
  input: payload.value,
1258
1648
  inst,
1259
1649
  continue: !def.abort
1260
1650
  });
1651
+ return;
1261
1652
  }
1262
- if (def.normalize) payload.value = url.href;
1263
- else payload.value = trimmed;
1653
+ if (url === true) {
1654
+ payload.value = stripTabAndNewline(trimmed);
1655
+ return;
1656
+ }
1657
+ if (def.hostname && !urlHostnameOk(url, def.hostname)) payload.issues.push({
1658
+ code: "invalid_format",
1659
+ format: "url",
1660
+ note: "Invalid hostname",
1661
+ pattern: def.hostname.source,
1662
+ input: payload.value,
1663
+ inst,
1664
+ continue: !def.abort
1665
+ });
1666
+ if (def.protocol && !urlProtocolOk(url, def.protocol)) payload.issues.push({
1667
+ code: "invalid_format",
1668
+ format: "url",
1669
+ note: "Invalid protocol",
1670
+ pattern: def.protocol.source,
1671
+ input: payload.value,
1672
+ inst,
1673
+ continue: !def.abort
1674
+ });
1675
+ payload.value = def.normalize ? url.href : stripTabAndNewline(trimmed);
1264
1676
  return;
1265
1677
  } catch (_) {
1266
1678
  payload.issues.push({
@@ -1278,7 +1690,8 @@ window.__ModuleLoader__.load({
1278
1690
  $ZodStringFormat.init(inst, def);
1279
1691
  });
1280
1692
  const $ZodNanoID = /*@__PURE__*/ $constructor("$ZodNanoID", (inst, def) => {
1281
- def.pattern ?? (def.pattern = nanoid);
1693
+ if (def.length !== void 0 && (!Number.isInteger(def.length) || def.length < 1)) throw new Error(`Invalid nanoid length: ${def.length}`);
1694
+ def.pattern ?? (def.pattern = def.length === void 0 ? nanoid : nanoidOfLength(def.length));
1282
1695
  $ZodStringFormat.init(inst, def);
1283
1696
  });
1284
1697
  /**
@@ -1307,70 +1720,69 @@ window.__ModuleLoader__.load({
1307
1720
  $ZodStringFormat.init(inst, def);
1308
1721
  });
1309
1722
  const $ZodISODateTime = /*@__PURE__*/ $constructor("$ZodISODateTime", (inst, def) => {
1310
- def.pattern ?? (def.pattern = datetime$1(def));
1723
+ def.pattern ?? (def.pattern = datetime(def));
1311
1724
  $ZodStringFormat.init(inst, def);
1312
1725
  });
1313
1726
  const $ZodISODate = /*@__PURE__*/ $constructor("$ZodISODate", (inst, def) => {
1314
- def.pattern ?? (def.pattern = date$1);
1727
+ def.pattern ?? (def.pattern = date);
1315
1728
  $ZodStringFormat.init(inst, def);
1316
1729
  });
1317
1730
  const $ZodISOTime = /*@__PURE__*/ $constructor("$ZodISOTime", (inst, def) => {
1318
- def.pattern ?? (def.pattern = time$1(def));
1731
+ def.pattern ?? (def.pattern = time(def));
1319
1732
  $ZodStringFormat.init(inst, def);
1320
1733
  });
1321
1734
  const $ZodISODuration = /*@__PURE__*/ $constructor("$ZodISODuration", (inst, def) => {
1322
- def.pattern ?? (def.pattern = duration$1);
1735
+ def.pattern ?? (def.pattern = duration);
1323
1736
  $ZodStringFormat.init(inst, def);
1324
1737
  });
1325
1738
  const $ZodIPv4 = /*@__PURE__*/ $constructor("$ZodIPv4", (inst, def) => {
1326
1739
  def.pattern ?? (def.pattern = ipv4);
1327
1740
  $ZodStringFormat.init(inst, def);
1328
- inst._zod.bag.format = `ipv4`;
1329
1741
  });
1742
+ /** 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`. */
1743
+ const ipv6Alphabet = /^[0-9a-fA-F:.]+$/;
1744
+ function isValidIPv6(value) {
1745
+ if (!ipv6Alphabet.test(value)) return false;
1746
+ return canParseURL(`http://[${value}]`);
1747
+ }
1330
1748
  const $ZodIPv6 = /*@__PURE__*/ $constructor("$ZodIPv6", (inst, def) => {
1331
1749
  def.pattern ?? (def.pattern = ipv6);
1332
1750
  $ZodStringFormat.init(inst, def);
1333
- inst._zod.bag.format = `ipv6`;
1334
1751
  inst._zod.check = (payload) => {
1335
- try {
1336
- new URL(`http://[${payload.value}]`);
1337
- } catch {
1338
- payload.issues.push({
1339
- code: "invalid_format",
1340
- format: "ipv6",
1341
- input: payload.value,
1342
- inst,
1343
- continue: !def.abort
1344
- });
1345
- }
1752
+ if (!isValidIPv6(payload.value)) payload.issues.push({
1753
+ code: "invalid_format",
1754
+ format: "ipv6",
1755
+ input: payload.value,
1756
+ inst,
1757
+ continue: !def.abort
1758
+ });
1346
1759
  };
1347
1760
  });
1348
1761
  const $ZodCIDRv4 = /*@__PURE__*/ $constructor("$ZodCIDRv4", (inst, def) => {
1349
1762
  def.pattern ?? (def.pattern = cidrv4);
1350
1763
  $ZodStringFormat.init(inst, def);
1351
1764
  });
1765
+ function isValidCIDRv6(value) {
1766
+ const parts = value.split("/");
1767
+ if (parts.length !== 2) return false;
1768
+ const [address, prefix] = parts;
1769
+ if (!prefix) return false;
1770
+ const prefixNum = Number(prefix);
1771
+ if (`${prefixNum}` !== prefix) return false;
1772
+ if (prefixNum < 0 || prefixNum > 128) return false;
1773
+ return isValidIPv6(address);
1774
+ }
1352
1775
  const $ZodCIDRv6 = /*@__PURE__*/ $constructor("$ZodCIDRv6", (inst, def) => {
1353
1776
  def.pattern ?? (def.pattern = cidrv6);
1354
1777
  $ZodStringFormat.init(inst, def);
1355
1778
  inst._zod.check = (payload) => {
1356
- const parts = payload.value.split("/");
1357
- try {
1358
- if (parts.length !== 2) throw new Error();
1359
- const [address, prefix] = parts;
1360
- if (!prefix) throw new Error();
1361
- const prefixNum = Number(prefix);
1362
- if (`${prefixNum}` !== prefix) throw new Error();
1363
- if (prefixNum < 0 || prefixNum > 128) throw new Error();
1364
- new URL(`http://[${address}]`);
1365
- } catch {
1366
- payload.issues.push({
1367
- code: "invalid_format",
1368
- format: "cidrv6",
1369
- input: payload.value,
1370
- inst,
1371
- continue: !def.abort
1372
- });
1373
- }
1779
+ if (!isValidCIDRv6(payload.value)) payload.issues.push({
1780
+ code: "invalid_format",
1781
+ format: "cidrv6",
1782
+ input: payload.value,
1783
+ inst,
1784
+ continue: !def.abort
1785
+ });
1374
1786
  };
1375
1787
  });
1376
1788
  function isValidBase64(data) {
@@ -1384,10 +1796,10 @@ window.__ModuleLoader__.load({
1384
1796
  return false;
1385
1797
  }
1386
1798
  }
1799
+ const base64Charset = /^[0-9a-zA-Z+/]*={0,2}$/;
1387
1800
  const $ZodBase64 = /*@__PURE__*/ $constructor("$ZodBase64", (inst, def) => {
1388
- def.pattern ?? (def.pattern = base64);
1801
+ def.pattern ?? (def.pattern = base64Charset);
1389
1802
  $ZodStringFormat.init(inst, def);
1390
- inst._zod.bag.contentEncoding = "base64";
1391
1803
  inst._zod.check = (payload) => {
1392
1804
  if (isValidBase64(payload.value)) return;
1393
1805
  payload.issues.push({
@@ -1399,15 +1811,15 @@ window.__ModuleLoader__.load({
1399
1811
  });
1400
1812
  };
1401
1813
  });
1814
+ const base64urlCharset = /^[A-Za-z0-9_-]*$/;
1402
1815
  function isValidBase64URL(data) {
1403
- if (!base64url.test(data)) return false;
1816
+ if (!base64urlCharset.test(data)) return false;
1404
1817
  const base64 = data.replace(/[-_]/g, (c) => c === "-" ? "+" : "/");
1405
1818
  return isValidBase64(base64.padEnd(Math.ceil(base64.length / 4) * 4, "="));
1406
1819
  }
1407
1820
  const $ZodBase64URL = /*@__PURE__*/ $constructor("$ZodBase64URL", (inst, def) => {
1408
- def.pattern ?? (def.pattern = base64url);
1821
+ def.pattern ?? (def.pattern = base64urlCharset);
1409
1822
  $ZodStringFormat.init(inst, def);
1410
- inst._zod.bag.contentEncoding = "base64url";
1411
1823
  inst._zod.check = (payload) => {
1412
1824
  if (isValidBase64URL(payload.value)) return;
1413
1825
  payload.issues.push({
@@ -1453,14 +1865,14 @@ window.__ModuleLoader__.load({
1453
1865
  });
1454
1866
  const $ZodNumber = /*@__PURE__*/ $constructor("$ZodNumber", (inst, def) => {
1455
1867
  $ZodType.init(inst, def);
1456
- inst._zod.pattern = inst._zod.bag.pattern ?? number$1;
1868
+ inst._zod.pattern = number$1;
1457
1869
  inst._zod.parse = (payload, _ctx) => {
1458
1870
  if (def.coerce) try {
1459
1871
  payload.value = Number(payload.value);
1460
1872
  } catch (_) {}
1461
1873
  const input = payload.value;
1462
1874
  if (typeof input === "number" && !Number.isNaN(input) && Number.isFinite(input)) return payload;
1463
- const received = typeof input === "number" ? Number.isNaN(input) ? "NaN" : !Number.isFinite(input) ? "Infinity" : void 0 : void 0;
1875
+ const received = typeof input === "number" ? Number.isNaN(input) ? "NaN" : !Number.isFinite(input) ? String(input) : void 0 : void 0;
1464
1876
  payload.issues.push({
1465
1877
  expected: "number",
1466
1878
  code: "invalid_type",
@@ -1519,6 +1931,8 @@ window.__ModuleLoader__.load({
1519
1931
  }
1520
1932
  const $ZodArray = /*@__PURE__*/ $constructor("$ZodArray", (inst, def) => {
1521
1933
  $ZodType.init(inst, def);
1934
+ const memo = globalConfig.memoizer;
1935
+ memo?.attach(inst);
1522
1936
  inst._zod.parse = (payload, ctx) => {
1523
1937
  const input = payload.value;
1524
1938
  if (!Array.isArray(input)) {
@@ -1530,8 +1944,9 @@ window.__ModuleLoader__.load({
1530
1944
  });
1531
1945
  return payload;
1532
1946
  }
1533
- payload.value = Array(input.length);
1947
+ payload.value = memo ? memo.alloc(inst, payload, Array(input.length), ctx) : Array(input.length);
1534
1948
  const proms = [];
1949
+ const abortEarly = ctx?.abortEarly;
1535
1950
  for (let i = 0; i < input.length; i++) {
1536
1951
  const item = input[i];
1537
1952
  const result = def.element._zod.run({
@@ -1539,19 +1954,24 @@ window.__ModuleLoader__.load({
1539
1954
  issues: []
1540
1955
  }, ctx);
1541
1956
  if (result instanceof Promise) proms.push(result.then((result) => handleArrayResult(result, payload, i)));
1542
- else handleArrayResult(result, payload, i);
1957
+ else {
1958
+ handleArrayResult(result, payload, i);
1959
+ if (abortEarly && result.issues.length !== 0 && aborted(result)) break;
1960
+ }
1543
1961
  }
1544
1962
  if (proms.length) return Promise.all(proms).then(() => payload);
1545
1963
  return payload;
1546
1964
  };
1547
1965
  });
1548
- function handlePropertyResult(result, final, key, input, isOptionalIn, isOptionalOut) {
1966
+ function handlePropertyResult(result, final, key, input, optin, optout) {
1549
1967
  const isPresent = key in input;
1968
+ const isOptionalOut = optout === "optional";
1969
+ if (!isPresent && isOptionalOut && optin === "optional") return;
1550
1970
  if (result.issues.length) {
1551
- if (isOptionalIn && isOptionalOut && !isPresent) return;
1971
+ if (optin !== void 0 && isOptionalOut && !isPresent) return;
1552
1972
  final.issues.push(...prefixIssues(key, result.issues));
1553
1973
  }
1554
- if (!isPresent && !isOptionalIn) {
1974
+ if (!isPresent && optin === void 0) {
1555
1975
  if (!result.issues.length) final.issues.push({
1556
1976
  code: "invalid_type",
1557
1977
  expected: "nonoptional",
@@ -1561,31 +1981,44 @@ window.__ModuleLoader__.load({
1561
1981
  return;
1562
1982
  }
1563
1983
  if (result.value === void 0) {
1564
- if (isPresent) final.value[key] = void 0;
1984
+ if (isPresent || optin === "defaulted" && !isOptionalOut) final.value[key] = void 0;
1565
1985
  } else final.value[key] = result.value;
1566
1986
  }
1987
+ const NO_SYMBOL_KEYS = [];
1567
1988
  function normalizeDef(def) {
1568
1989
  const keys = Object.keys(def.shape);
1569
- 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`);
1990
+ const ownSymbols = Object.getOwnPropertySymbols(def.shape);
1991
+ const symbolKeys = ownSymbols.length ? ownSymbols : NO_SYMBOL_KEYS;
1992
+ const allKeys = symbolKeys.length ? [...keys, ...symbolKeys] : keys;
1993
+ 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`);
1570
1994
  const okeys = optionalKeys(def.shape);
1571
1995
  return {
1572
1996
  ...def,
1573
- keys,
1997
+ allKeys,
1998
+ symbolKeys,
1574
1999
  keySet: new Set(keys),
1575
2000
  numKeys: keys.length,
1576
2001
  optionalKeys: new Set(okeys)
1577
2002
  };
1578
2003
  }
1579
- function handleCatchall(proms, input, payload, ctx, def, inst) {
2004
+ function handleCatchall(proms, input, payload, ctx, def, inst, abortEarly) {
1580
2005
  const unrecognized = [];
1581
2006
  const keySet = def.keySet;
1582
2007
  const _catchall = def.catchall._zod;
1583
2008
  const t = _catchall.def.type;
1584
- const isOptionalIn = _catchall.optin === "optional";
1585
- const isOptionalOut = _catchall.optout === "optional";
2009
+ const optin = _catchall.optin;
2010
+ const optout = _catchall.optout;
2011
+ let seen = 0;
1586
2012
  for (const key in input) {
1587
- if (key === "__proto__") continue;
2013
+ if (abortEarly && payload.issues.length !== seen) {
2014
+ if (aborted(payload, seen)) break;
2015
+ seen = payload.issues.length;
2016
+ }
1588
2017
  if (keySet.has(key)) continue;
2018
+ if (key === "__proto__") {
2019
+ if (t === "never") unrecognized.push(key);
2020
+ continue;
2021
+ }
1589
2022
  if (t === "never") {
1590
2023
  unrecognized.push(key);
1591
2024
  continue;
@@ -1594,14 +2027,15 @@ window.__ModuleLoader__.load({
1594
2027
  value: input[key],
1595
2028
  issues: []
1596
2029
  }, ctx);
1597
- if (r instanceof Promise) proms.push(r.then((r) => handlePropertyResult(r, payload, key, input, isOptionalIn, isOptionalOut)));
1598
- else handlePropertyResult(r, payload, key, input, isOptionalIn, isOptionalOut);
2030
+ if (r instanceof Promise) proms.push(r.then((r) => handlePropertyResult(r, payload, key, input, optin, optout)));
2031
+ else handlePropertyResult(r, payload, key, input, optin, optout);
1599
2032
  }
1600
2033
  if (unrecognized.length) payload.issues.push({
1601
2034
  code: "unrecognized_keys",
1602
2035
  keys: unrecognized,
1603
2036
  input,
1604
- inst
2037
+ inst,
2038
+ continue: true
1605
2039
  });
1606
2040
  if (!proms.length) return payload;
1607
2041
  return Promise.all(proms).then(() => {
@@ -1610,34 +2044,41 @@ window.__ModuleLoader__.load({
1610
2044
  }
1611
2045
  const $ZodObject = /*@__PURE__*/ $constructor("$ZodObject", (inst, def) => {
1612
2046
  $ZodType.init(inst, def);
1613
- if (!Object.getOwnPropertyDescriptor(def, "shape")?.get) {
1614
- const sh = def.shape;
1615
- Object.defineProperty(def, "shape", { get: () => {
2047
+ const desc = Object.getOwnPropertyDescriptor(def, "shape");
2048
+ const sh = desc?.get ? desc.get.raw : def.shape ?? {};
2049
+ if (sh) {
2050
+ const get = () => {
1616
2051
  const newSh = { ...sh };
1617
2052
  Object.defineProperty(def, "shape", { value: newSh });
2053
+ get.raw = newSh;
1618
2054
  return newSh;
1619
- } });
2055
+ };
2056
+ get.raw = sh;
2057
+ Object.defineProperty(def, "shape", { get });
1620
2058
  }
1621
2059
  const _normalized = cached(() => normalizeDef(def));
1622
- defineLazy(inst._zod, "propValues", () => {
1623
- const shape = def.shape;
2060
+ defineLazyInternal(inst, "propValues", (zod) => {
2061
+ const shape = zod.def.shape;
1624
2062
  const propValues = {};
1625
2063
  for (const key in shape) {
1626
2064
  const field = shape[key]._zod;
1627
2065
  if (field.values) {
1628
- propValues[key] ?? (propValues[key] = /* @__PURE__ */ new Set());
2066
+ if (!Object.prototype.hasOwnProperty.call(propValues, key)) assignProp(propValues, key, /* @__PURE__ */ new Set());
1629
2067
  for (const v of field.values) propValues[key].add(v);
2068
+ if (field.optin !== void 0) propValues[key].add(void 0);
1630
2069
  }
1631
2070
  }
1632
2071
  return propValues;
1633
2072
  });
1634
- const isObject$2 = isObject;
2073
+ const isObject$1 = isObject;
1635
2074
  const catchall = def.catchall;
1636
2075
  let value;
2076
+ const memo = globalConfig.memoizer;
2077
+ memo?.attach(inst);
1637
2078
  inst._zod.parse = (payload, ctx) => {
1638
2079
  value ?? (value = _normalized.value);
1639
2080
  const input = payload.value;
1640
- if (!isObject$2(input)) {
2081
+ if (!isObject$1(input)) {
1641
2082
  payload.issues.push({
1642
2083
  expected: "object",
1643
2084
  code: "invalid_type",
@@ -1646,77 +2087,90 @@ window.__ModuleLoader__.load({
1646
2087
  });
1647
2088
  return payload;
1648
2089
  }
1649
- payload.value = {};
2090
+ payload.value = memo ? memo.alloc(inst, payload, {}, ctx) : {};
1650
2091
  const proms = [];
1651
2092
  const shape = value.shape;
1652
- for (const key of value.keys) {
2093
+ const abortEarly = ctx?.abortEarly;
2094
+ let seen = payload.issues.length;
2095
+ for (const key of value.allKeys) {
2096
+ if (abortEarly && payload.issues.length !== seen) {
2097
+ if (aborted(payload, seen)) break;
2098
+ seen = payload.issues.length;
2099
+ }
2100
+ if (key === "__proto__") continue;
1653
2101
  const el = shape[key];
1654
- const isOptionalIn = el._zod.optin === "optional";
1655
- const isOptionalOut = el._zod.optout === "optional";
2102
+ const optin = el._zod.optin;
2103
+ const optout = el._zod.optout;
1656
2104
  const r = el._zod.run({
1657
2105
  value: input[key],
1658
2106
  issues: []
1659
2107
  }, ctx);
1660
- if (r instanceof Promise) proms.push(r.then((r) => handlePropertyResult(r, payload, key, input, isOptionalIn, isOptionalOut)));
1661
- else handlePropertyResult(r, payload, key, input, isOptionalIn, isOptionalOut);
2108
+ if (r instanceof Promise) proms.push(r.then((r) => handlePropertyResult(r, payload, key, input, optin, optout)));
2109
+ else handlePropertyResult(r, payload, key, input, optin, optout);
1662
2110
  }
1663
2111
  if (!catchall) return proms.length ? Promise.all(proms).then(() => payload) : payload;
1664
- return handleCatchall(proms, input, payload, ctx, _normalized.value, inst);
2112
+ return handleCatchall(proms, input, payload, ctx, _normalized.value, inst, abortEarly === true);
1665
2113
  };
1666
2114
  });
1667
2115
  const $ZodObjectJIT = /*@__PURE__*/ $constructor("$ZodObjectJIT", (inst, def) => {
1668
2116
  $ZodObject.init(inst, def);
1669
2117
  const superParse = inst._zod.parse;
1670
2118
  const _normalized = cached(() => normalizeDef(def));
2119
+ const memo = globalConfig.memoizer;
1671
2120
  const generateFastpass = (shape) => {
1672
- const doc = new Doc([
1673
- "shape",
1674
- "payload",
1675
- "ctx"
1676
- ]);
1677
2121
  const normalized = _normalized.value;
1678
- const parseStr = (key) => {
1679
- const k = esc(key);
1680
- return `shape[${k}]._zod.run({ value: input[${k}], issues: [] }, ctx)`;
1681
- };
2122
+ const syms = normalized.symbolKeys;
2123
+ const doc = new Doc(["payload", "ctx"], {
2124
+ shape,
2125
+ inst,
2126
+ memo,
2127
+ syms
2128
+ });
2129
+ const parseStr = (k) => `shape[${k}]._zod.run({ value: input[${k}], issues: [] }, ctx)`;
2130
+ const prefixStr = (id, k) => `
2131
+ let ${id}_ab = false;
2132
+ for (let i = 0; i < ${id}.issues.length; i++) {
2133
+ const iss = ${id}.issues[i];
2134
+ iss.path = iss.path ? [${k}, ...iss.path] : [${k}];
2135
+ payload.issues.push(iss);
2136
+ if (iss.continue !== true) ${id}_ab = true;
2137
+ }
2138
+ if (${id}_ab && ctx && ctx.abortEarly) {
2139
+ payload.value = newResult;
2140
+ return payload;
2141
+ }`;
1682
2142
  doc.write(`const input = payload.value;`);
1683
2143
  const ids = Object.create(null);
1684
2144
  let counter = 0;
1685
- for (const key of normalized.keys) ids[key] = `key_${counter++}`;
1686
- doc.write(`const newResult = {};`);
1687
- for (const key of normalized.keys) {
2145
+ for (const key of normalized.allKeys) ids[key] = `key_${counter++}`;
2146
+ doc.write(memo ? `const newResult = memo.alloc(inst, payload, {}, ctx);` : `const newResult = {};`);
2147
+ for (const key of normalized.allKeys) {
2148
+ if (key === "__proto__") continue;
1688
2149
  const id = ids[key];
1689
- const k = esc(key);
2150
+ const k = typeof key === "symbol" ? `syms[${syms.indexOf(key)}]` : esc(key);
2151
+ const isPresent = `${k} in input`;
1690
2152
  const schema = shape[key];
1691
- const isOptionalIn = schema?._zod?.optin === "optional";
2153
+ const optin = schema?._zod?.optin;
2154
+ const isOptionalIn = optin !== void 0;
1692
2155
  const isOptionalOut = schema?._zod?.optout === "optional";
1693
- doc.write(`const ${id} = ${parseStr(key)};`);
1694
- if (isOptionalIn && isOptionalOut) doc.write(`
1695
- if (${id}.issues.length) {
1696
- if (${k} in input) {
1697
- payload.issues = payload.issues.concat(${id}.issues.map(iss => ({
1698
- ...iss,
1699
- path: iss.path ? [${k}, ...iss.path] : [${k}]
1700
- })));
2156
+ doc.write(`const ${id} = ${parseStr(k)};`);
2157
+ if (isOptionalIn && isOptionalOut) {
2158
+ const assign = optin === "optional" ? `${id}_present` : `${id}.value !== undefined || ${id}_present`;
2159
+ doc.write(`
2160
+ const ${id}_present = ${isPresent};
2161
+ if (!${id}.issues.length || ${id}_present) {
2162
+ if (${id}.issues.length) {${prefixStr(id, k)}
1701
2163
  }
1702
- }
1703
-
1704
- if (${id}.value === undefined) {
1705
- if (${k} in input) {
1706
- newResult[${k}] = undefined;
2164
+
2165
+ if (${assign}) {
2166
+ newResult[${k}] = ${id}.value;
1707
2167
  }
1708
- } else {
1709
- newResult[${k}] = ${id}.value;
1710
2168
  }
1711
-
2169
+
1712
2170
  `);
1713
- else if (!isOptionalIn) doc.write(`
1714
- const ${id}_present = ${k} in input;
1715
- if (${id}.issues.length) {
1716
- payload.issues = payload.issues.concat(${id}.issues.map(iss => ({
1717
- ...iss,
1718
- path: iss.path ? [${k}, ...iss.path] : [${k}]
1719
- })));
2171
+ } else if (!isOptionalIn) doc.write(`
2172
+ const ${id}_present = ${isPresent};
2173
+ if (${id}.issues.length) {${prefixStr(id, k)}
1720
2174
  }
1721
2175
  if (!${id}_present && !${id}.issues.length) {
1722
2176
  payload.issues.push({
@@ -1725,42 +2179,36 @@ window.__ModuleLoader__.load({
1725
2179
  input: undefined,
1726
2180
  path: [${k}]
1727
2181
  });
2182
+ if (ctx && ctx.abortEarly) {
2183
+ payload.value = newResult;
2184
+ return payload;
2185
+ }
1728
2186
  }
1729
2187
 
1730
2188
  if (${id}_present) {
1731
- if (${id}.value === undefined) {
1732
- newResult[${k}] = undefined;
1733
- } else {
1734
- newResult[${k}] = ${id}.value;
1735
- }
2189
+ newResult[${k}] = ${id}.value;
1736
2190
  }
1737
2191
 
1738
2192
  `);
1739
- else doc.write(`
1740
- if (${id}.issues.length) {
1741
- payload.issues = payload.issues.concat(${id}.issues.map(iss => ({
1742
- ...iss,
1743
- path: iss.path ? [${k}, ...iss.path] : [${k}]
1744
- })));
2193
+ else {
2194
+ doc.write(`
2195
+ if (${id}.issues.length) {${prefixStr(id, k)}
1745
2196
  }
1746
-
1747
- if (${id}.value === undefined) {
1748
- if (${k} in input) {
1749
- newResult[${k}] = undefined;
1750
- }
1751
- } else {
2197
+ `);
2198
+ if (optin === "defaulted") doc.write(`newResult[${k}] = ${id}.value;`);
2199
+ else doc.write(`
2200
+ if (${id}.value !== undefined || ${isPresent}) {
1752
2201
  newResult[${k}] = ${id}.value;
1753
2202
  }
1754
-
1755
2203
  `);
2204
+ }
1756
2205
  }
1757
2206
  doc.write(`payload.value = newResult;`);
1758
2207
  doc.write(`return payload;`);
1759
- const fn = doc.compile();
1760
- return (payload, ctx) => fn(shape, payload, ctx);
2208
+ return doc.compile();
1761
2209
  };
1762
2210
  let fastpass;
1763
- const isObject$1 = isObject;
2211
+ const isObject$2 = isObject;
1764
2212
  const jit = !globalConfig.jitless;
1765
2213
  const fastEnabled = jit && allowsEval.value;
1766
2214
  const catchall = def.catchall;
@@ -1768,7 +2216,7 @@ window.__ModuleLoader__.load({
1768
2216
  inst._zod.parse = (payload, ctx) => {
1769
2217
  value ?? (value = _normalized.value);
1770
2218
  const input = payload.value;
1771
- if (!isObject$1(input)) {
2219
+ if (!isObject$2(input)) {
1772
2220
  payload.issues.push({
1773
2221
  expected: "object",
1774
2222
  code: "invalid_type",
@@ -1781,7 +2229,7 @@ window.__ModuleLoader__.load({
1781
2229
  if (!fastpass) fastpass = generateFastpass(def.shape);
1782
2230
  payload = fastpass(payload, ctx);
1783
2231
  if (!catchall) return payload;
1784
- return handleCatchall([], input, payload, ctx, value, inst);
2232
+ return handleCatchall([], input, payload, ctx, value, inst, ctx?.abortEarly === true);
1785
2233
  }
1786
2234
  return superParse(payload, ctx);
1787
2235
  };
@@ -1806,14 +2254,14 @@ window.__ModuleLoader__.load({
1806
2254
  }
1807
2255
  const $ZodUnion = /*@__PURE__*/ $constructor("$ZodUnion", (inst, def) => {
1808
2256
  $ZodType.init(inst, def);
1809
- defineLazy(inst._zod, "optin", () => def.options.some((o) => o._zod.optin === "optional") ? "optional" : void 0);
1810
- defineLazy(inst._zod, "optout", () => def.options.some((o) => o._zod.optout === "optional") ? "optional" : void 0);
1811
- defineLazy(inst._zod, "values", () => {
1812
- if (def.options.every((o) => o._zod.values)) return new Set(def.options.flatMap((option) => Array.from(option._zod.values)));
2257
+ 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);
2258
+ defineLazyInternal(inst, "optout", (zod) => zod.def.options.some((o) => o._zod.optout === "optional") ? "optional" : void 0);
2259
+ defineLazyInternal(inst, "values", (zod) => {
2260
+ if (zod.def.options.every((o) => o._zod.values)) return new Set(zod.def.options.flatMap((option) => Array.from(option._zod.values)));
1813
2261
  });
1814
- defineLazy(inst._zod, "pattern", () => {
1815
- if (def.options.every((o) => o._zod.pattern)) {
1816
- const patterns = def.options.map((o) => o._zod.pattern);
2262
+ defineLazyInternal(inst, "pattern", (zod) => {
2263
+ if (zod.def.options.every((o) => o._zod.pattern)) {
2264
+ const patterns = zod.def.options.map((o) => o._zod.pattern);
1817
2265
  return new RegExp(`^(${patterns.map((p) => cleanRegex(p.source)).join("|")})$`);
1818
2266
  }
1819
2267
  });
@@ -1875,7 +2323,9 @@ window.__ModuleLoader__.load({
1875
2323
  ...a,
1876
2324
  ...b
1877
2325
  };
2326
+ if (Object.prototype.hasOwnProperty.call(newObj, "__proto__")) delete newObj.__proto__;
1878
2327
  for (const key of sharedKeys) {
2328
+ if (key === "__proto__") continue;
1879
2329
  const sharedValue = mergeValues(a[key], b[key]);
1880
2330
  if (!sharedValue.valid) return {
1881
2331
  valid: false,
@@ -1917,26 +2367,39 @@ window.__ModuleLoader__.load({
1917
2367
  function handleIntersectionResults(result, left, right) {
1918
2368
  const unrecKeys = /* @__PURE__ */ new Map();
1919
2369
  let unrecIssue;
1920
- for (const iss of left.issues) if (iss.code === "unrecognized_keys") {
1921
- unrecIssue ?? (unrecIssue = iss);
1922
- for (const k of iss.keys) {
2370
+ const keyIssues = /* @__PURE__ */ new Map();
2371
+ const collect = (iss, side) => {
2372
+ let keys;
2373
+ if (iss.code === "unrecognized_keys" && !iss.path?.length) {
2374
+ unrecIssue ?? (unrecIssue = iss);
2375
+ keys = iss.keys;
2376
+ } else if (iss.code === "invalid_key" && iss.origin === "record" && iss.path?.length === 1) {
2377
+ const k = String(iss.path[0]);
2378
+ if (!keyIssues.has(k)) keyIssues.set(k, iss);
2379
+ keys = [k];
2380
+ } else return false;
2381
+ for (const k of keys) {
1923
2382
  if (!unrecKeys.has(k)) unrecKeys.set(k, {});
1924
- unrecKeys.get(k).l = true;
2383
+ unrecKeys.get(k)[side] = true;
1925
2384
  }
1926
- } else result.issues.push(iss);
1927
- for (const iss of right.issues) if (iss.code === "unrecognized_keys") for (const k of iss.keys) {
1928
- if (!unrecKeys.has(k)) unrecKeys.set(k, {});
1929
- unrecKeys.get(k).r = true;
1930
- }
1931
- else result.issues.push(iss);
2385
+ return true;
2386
+ };
2387
+ for (const iss of left.issues) if (!collect(iss, "l")) result.issues.push(iss);
2388
+ for (const iss of right.issues) if (!collect(iss, "r")) result.issues.push(iss);
1932
2389
  const bothKeys = [...unrecKeys].filter(([, f]) => f.l && f.r).map(([k]) => k);
1933
- if (bothKeys.length && unrecIssue) result.issues.push({
1934
- ...unrecIssue,
1935
- keys: bothKeys
1936
- });
1937
- if (aborted(result)) return result;
2390
+ if (bothKeys.length) {
2391
+ const aggregated = unrecIssue ? bothKeys.filter((k) => unrecIssue.keys.includes(k)) : [];
2392
+ if (aggregated.length) result.issues.push({
2393
+ ...unrecIssue,
2394
+ keys: aggregated
2395
+ });
2396
+ for (const k of bothKeys) if (!aggregated.includes(k) && keyIssues.has(k)) result.issues.push(keyIssues.get(k));
2397
+ }
1938
2398
  const merged = mergeValues(left.value, right.value);
1939
- if (!merged.valid) throw new Error(`Unmergable intersection. Error path: ${JSON.stringify(merged.mergeErrorPath)}`);
2399
+ if (!merged.valid) {
2400
+ if (aborted(result)) return result;
2401
+ throw new Error(`Unmergable intersection. Error path: ${JSON.stringify(merged.mergeErrorPath)}`);
2402
+ }
1940
2403
  result.value = merged.data;
1941
2404
  return result;
1942
2405
  }
@@ -1945,7 +2408,10 @@ window.__ModuleLoader__.load({
1945
2408
  const values = getEnumValues(def.entries);
1946
2409
  const valuesSet = new Set(values);
1947
2410
  inst._zod.values = valuesSet;
1948
- inst._zod.pattern = new RegExp(`^(${values.filter((k) => propertyKeyTypes.has(typeof k)).map((o) => typeof o === "string" ? escapeRegex(o) : o.toString()).join("|")})$`);
2411
+ defineLazyInternal(inst, "pattern", (zod) => {
2412
+ const patternValues = getEnumValues(zod.def.entries).filter((k) => propertyKeyTypes.has(typeof k));
2413
+ return new RegExp(patternValues.length ? `^(${patternValues.map((o) => escapeRegex(o.toString())).join("|")})$` : "^[^\\s\\S]$");
2414
+ });
1949
2415
  inst._zod.parse = (payload, _ctx) => {
1950
2416
  const input = payload.value;
1951
2417
  if (valuesSet.has(input)) return payload;
@@ -1961,67 +2427,66 @@ window.__ModuleLoader__.load({
1961
2427
  const $ZodTransform = /*@__PURE__*/ $constructor("$ZodTransform", (inst, def) => {
1962
2428
  $ZodType.init(inst, def);
1963
2429
  inst._zod.optin = "optional";
2430
+ globalConfig.memoizer?.guard(inst);
1964
2431
  inst._zod.parse = (payload, ctx) => {
1965
2432
  if (ctx.direction === "backward") throw new $ZodEncodeError(inst.constructor.name);
1966
2433
  const _out = def.transform(payload.value, payload);
1967
2434
  if (ctx.async) return (_out instanceof Promise ? _out : Promise.resolve(_out)).then((output) => {
1968
2435
  payload.value = output;
1969
- payload.fallback = true;
1970
2436
  return payload;
1971
2437
  });
1972
2438
  if (_out instanceof Promise) throw new $ZodAsyncError();
1973
2439
  payload.value = _out;
1974
- payload.fallback = true;
1975
2440
  return payload;
1976
2441
  };
1977
2442
  });
1978
- function handleOptionalResult(result, input) {
1979
- if (input === void 0 && (result.issues.length || result.fallback)) return {
1980
- issues: [],
1981
- value: void 0
1982
- };
1983
- return result;
2443
+ function handleOptionalResult(payload, result) {
2444
+ payload.value = result.issues.length ? void 0 : result.value;
2445
+ return payload;
1984
2446
  }
1985
2447
  const $ZodOptional = /*@__PURE__*/ $constructor("$ZodOptional", (inst, def) => {
1986
2448
  $ZodType.init(inst, def);
1987
- inst._zod.optin = "optional";
2449
+ defineLazyInternal(inst, "optin", (zod) => zod.def.innerType._zod.optin === "defaulted" ? "defaulted" : "optional");
1988
2450
  inst._zod.optout = "optional";
1989
- defineLazy(inst._zod, "values", () => {
1990
- return def.innerType._zod.values ? /* @__PURE__ */ new Set([...def.innerType._zod.values, void 0]) : void 0;
2451
+ defineLazyInternal(inst, "values", (zod) => {
2452
+ const values = zod.def.innerType._zod.values;
2453
+ return values ? /* @__PURE__ */ new Set([...values, void 0]) : void 0;
1991
2454
  });
1992
- defineLazy(inst._zod, "pattern", () => {
1993
- const pattern = def.innerType._zod.pattern;
2455
+ defineLazyInternal(inst, "pattern", (zod) => {
2456
+ const pattern = zod.def.innerType._zod.pattern;
1994
2457
  return pattern ? new RegExp(`^(${cleanRegex(pattern.source)})?$`) : void 0;
1995
2458
  });
1996
2459
  inst._zod.parse = (payload, ctx) => {
1997
- if (def.innerType._zod.optin === "optional") {
1998
- const input = payload.value;
1999
- const result = def.innerType._zod.run(payload, ctx);
2000
- if (result instanceof Promise) return result.then((r) => handleOptionalResult(r, input));
2001
- return handleOptionalResult(result, input);
2460
+ if (payload.value === void 0) {
2461
+ if (def.innerType._zod.optin !== "defaulted") return payload;
2462
+ const result = def.innerType._zod.run({
2463
+ value: payload.value,
2464
+ issues: []
2465
+ }, ctx);
2466
+ if (result instanceof Promise) return result.then((result) => handleOptionalResult(payload, result));
2467
+ return handleOptionalResult(payload, result);
2002
2468
  }
2003
- if (payload.value === void 0) return payload;
2004
2469
  return def.innerType._zod.run(payload, ctx);
2005
2470
  };
2006
2471
  });
2007
2472
  const $ZodExactOptional = /*@__PURE__*/ $constructor("$ZodExactOptional", (inst, def) => {
2008
2473
  $ZodOptional.init(inst, def);
2009
- defineLazy(inst._zod, "values", () => def.innerType._zod.values);
2010
- defineLazy(inst._zod, "pattern", () => def.innerType._zod.pattern);
2474
+ defineLazyInternal(inst, "values", (zod) => zod.def.innerType._zod.values);
2475
+ defineLazyInternal(inst, "pattern", (zod) => zod.def.innerType._zod.pattern);
2011
2476
  inst._zod.parse = (payload, ctx) => {
2012
2477
  return def.innerType._zod.run(payload, ctx);
2013
2478
  };
2014
2479
  });
2015
2480
  const $ZodNullable = /*@__PURE__*/ $constructor("$ZodNullable", (inst, def) => {
2016
2481
  $ZodType.init(inst, def);
2017
- defineLazy(inst._zod, "optin", () => def.innerType._zod.optin);
2018
- defineLazy(inst._zod, "optout", () => def.innerType._zod.optout);
2019
- defineLazy(inst._zod, "pattern", () => {
2020
- const pattern = def.innerType._zod.pattern;
2482
+ defineLazyInternal(inst, "optin", (zod) => zod.def.innerType._zod.optin);
2483
+ defineLazyInternal(inst, "optout", (zod) => zod.def.innerType._zod.optout);
2484
+ defineLazyInternal(inst, "pattern", (zod) => {
2485
+ const pattern = zod.def.innerType._zod.pattern;
2021
2486
  return pattern ? new RegExp(`^(${cleanRegex(pattern.source)}|null)$`) : void 0;
2022
2487
  });
2023
- defineLazy(inst._zod, "values", () => {
2024
- return def.innerType._zod.values ? /* @__PURE__ */ new Set([...def.innerType._zod.values, null]) : void 0;
2488
+ defineLazyInternal(inst, "values", (zod) => {
2489
+ return zod.def.innerType._zod.values ? /* @__PURE__ */ new Set([...zod.def.innerType._zod.values, null]) : void 0;
2025
2490
  });
2026
2491
  inst._zod.parse = (payload, ctx) => {
2027
2492
  if (payload.value === null) return payload;
@@ -2030,8 +2495,8 @@ window.__ModuleLoader__.load({
2030
2495
  });
2031
2496
  const $ZodDefault = /*@__PURE__*/ $constructor("$ZodDefault", (inst, def) => {
2032
2497
  $ZodType.init(inst, def);
2033
- inst._zod.optin = "optional";
2034
- defineLazy(inst._zod, "values", () => def.innerType._zod.values);
2498
+ inst._zod.optin = "defaulted";
2499
+ defineLazyInternal(inst, "values", (zod) => zod.def.innerType._zod.values);
2035
2500
  inst._zod.parse = (payload, ctx) => {
2036
2501
  if (ctx.direction === "backward") return def.innerType._zod.run(payload, ctx);
2037
2502
  if (payload.value === void 0) {
@@ -2052,8 +2517,8 @@ window.__ModuleLoader__.load({
2052
2517
  }
2053
2518
  const $ZodPrefault = /*@__PURE__*/ $constructor("$ZodPrefault", (inst, def) => {
2054
2519
  $ZodType.init(inst, def);
2055
- inst._zod.optin = "optional";
2056
- defineLazy(inst._zod, "values", () => def.innerType._zod.values);
2520
+ inst._zod.optin = "defaulted";
2521
+ defineLazyInternal(inst, "values", (zod) => zod.def.innerType._zod.values);
2057
2522
  inst._zod.parse = (payload, ctx) => {
2058
2523
  if (ctx.direction === "backward") return def.innerType._zod.run(payload, ctx);
2059
2524
  if (payload.value === void 0) payload.value = def.defaultValue;
@@ -2062,8 +2527,8 @@ window.__ModuleLoader__.load({
2062
2527
  });
2063
2528
  const $ZodNonOptional = /*@__PURE__*/ $constructor("$ZodNonOptional", (inst, def) => {
2064
2529
  $ZodType.init(inst, def);
2065
- defineLazy(inst._zod, "values", () => {
2066
- const v = def.innerType._zod.values;
2530
+ defineLazyInternal(inst, "values", (zod) => {
2531
+ const v = zod.def.innerType._zod.values;
2067
2532
  return v ? new Set([...v].filter((x) => x !== void 0)) : void 0;
2068
2533
  });
2069
2534
  inst._zod.parse = (payload, ctx) => {
@@ -2081,46 +2546,41 @@ window.__ModuleLoader__.load({
2081
2546
  });
2082
2547
  return payload;
2083
2548
  }
2549
+ function handleCatchResult(payload, result, def, ctx) {
2550
+ if (!result.issues.length) {
2551
+ payload.value = result.value;
2552
+ if (result.memo) payload.memo = true;
2553
+ return payload;
2554
+ }
2555
+ payload.value = def.catchValue({
2556
+ ...result,
2557
+ value: payload.value,
2558
+ error: { issues: result.issues.map((iss) => finalizeIssue(iss, ctx, config())) },
2559
+ input: payload.value
2560
+ });
2561
+ return payload;
2562
+ }
2084
2563
  const $ZodCatch = /*@__PURE__*/ $constructor("$ZodCatch", (inst, def) => {
2085
2564
  $ZodType.init(inst, def);
2086
- inst._zod.optin = "optional";
2087
- defineLazy(inst._zod, "optout", () => def.innerType._zod.optout);
2088
- defineLazy(inst._zod, "values", () => def.innerType._zod.values);
2565
+ defineLazyInternal(inst, "optin", (zod) => zod.def.innerType._zod.optin === "defaulted" ? "defaulted" : "optional");
2566
+ defineLazyInternal(inst, "optout", (zod) => zod.def.innerType._zod.optout);
2567
+ defineLazyInternal(inst, "values", (zod) => zod.def.innerType._zod.values);
2089
2568
  inst._zod.parse = (payload, ctx) => {
2090
2569
  if (ctx.direction === "backward") return def.innerType._zod.run(payload, ctx);
2091
- const result = def.innerType._zod.run(payload, ctx);
2092
- if (result instanceof Promise) return result.then((result) => {
2093
- payload.value = result.value;
2094
- if (result.issues.length) {
2095
- payload.value = def.catchValue({
2096
- ...payload,
2097
- error: { issues: result.issues.map((iss) => finalizeIssue(iss, ctx, config())) },
2098
- input: payload.value
2099
- });
2100
- payload.issues = [];
2101
- payload.fallback = true;
2102
- }
2103
- return payload;
2104
- });
2105
- payload.value = result.value;
2106
- if (result.issues.length) {
2107
- payload.value = def.catchValue({
2108
- ...payload,
2109
- error: { issues: result.issues.map((iss) => finalizeIssue(iss, ctx, config())) },
2110
- input: payload.value
2111
- });
2112
- payload.issues = [];
2113
- payload.fallback = true;
2114
- }
2115
- return payload;
2570
+ const result = def.innerType._zod.run({
2571
+ value: payload.value,
2572
+ issues: []
2573
+ }, ctx);
2574
+ if (result instanceof Promise) return result.then((result) => handleCatchResult(payload, result, def, ctx));
2575
+ return handleCatchResult(payload, result, def, ctx);
2116
2576
  };
2117
2577
  });
2118
2578
  const $ZodPipe = /*@__PURE__*/ $constructor("$ZodPipe", (inst, def) => {
2119
2579
  $ZodType.init(inst, def);
2120
- defineLazy(inst._zod, "values", () => def.in._zod.values);
2121
- defineLazy(inst._zod, "optin", () => def.in._zod.optin);
2122
- defineLazy(inst._zod, "optout", () => def.out._zod.optout);
2123
- defineLazy(inst._zod, "propValues", () => def.in._zod.propValues);
2580
+ defineLazyInternal(inst, "values", (zod) => zod.def.in._zod.values);
2581
+ defineLazyInternal(inst, "optin", (zod) => zod.def.in._zod.optin);
2582
+ defineLazyInternal(inst, "optout", (zod) => zod.def.out._zod.optout);
2583
+ defineLazyInternal(inst, "propValues", (zod) => zod.def.in._zod.propValues);
2124
2584
  inst._zod.parse = (payload, ctx) => {
2125
2585
  if (ctx.direction === "backward") {
2126
2586
  const right = def.out._zod.run(payload, ctx);
@@ -2133,22 +2593,21 @@ window.__ModuleLoader__.load({
2133
2593
  };
2134
2594
  });
2135
2595
  function handlePipeResult(left, next, ctx) {
2136
- if (left.issues.length) {
2596
+ if (left.issues.some((iss) => iss.code !== "unrecognized_keys")) {
2137
2597
  left.aborted = true;
2138
2598
  return left;
2139
2599
  }
2140
2600
  return next._zod.run({
2141
2601
  value: left.value,
2142
- issues: left.issues,
2143
- fallback: left.fallback
2602
+ issues: left.issues
2144
2603
  }, ctx);
2145
2604
  }
2146
2605
  const $ZodReadonly = /*@__PURE__*/ $constructor("$ZodReadonly", (inst, def) => {
2147
2606
  $ZodType.init(inst, def);
2148
- defineLazy(inst._zod, "propValues", () => def.innerType._zod.propValues);
2149
- defineLazy(inst._zod, "values", () => def.innerType._zod.values);
2150
- defineLazy(inst._zod, "optin", () => def.innerType?._zod?.optin);
2151
- defineLazy(inst._zod, "optout", () => def.innerType?._zod?.optout);
2607
+ defineLazyInternal(inst, "propValues", (zod) => zod.def.innerType._zod.propValues);
2608
+ defineLazyInternal(inst, "values", (zod) => zod.def.innerType._zod.values);
2609
+ defineLazyInternal(inst, "optin", (zod) => zod.def.innerType?._zod?.optin);
2610
+ defineLazyInternal(inst, "optout", (zod) => zod.def.innerType?._zod?.optout);
2152
2611
  inst._zod.parse = (payload, ctx) => {
2153
2612
  if (ctx.direction === "backward") return def.innerType._zod.run(payload, ctx);
2154
2613
  const result = def.innerType._zod.run(payload, ctx);
@@ -2157,7 +2616,7 @@ window.__ModuleLoader__.load({
2157
2616
  };
2158
2617
  });
2159
2618
  function handleReadonlyResult(payload) {
2160
- payload.value = Object.freeze(payload.value);
2619
+ if (!payload.memo) payload.value = Object.freeze(payload.value);
2161
2620
  return payload;
2162
2621
  }
2163
2622
  const $ZodCustom = /*@__PURE__*/ $constructor("$ZodCustom", (inst, def) => {
@@ -2172,22 +2631,383 @@ window.__ModuleLoader__.load({
2172
2631
  if (r instanceof Promise) return r.then((r) => handleRefineResult(r, payload, input, inst));
2173
2632
  handleRefineResult(r, payload, input, inst);
2174
2633
  };
2175
- });
2176
- function handleRefineResult(result, payload, input, inst) {
2177
- if (!result) {
2178
- const _iss = {
2179
- code: "custom",
2180
- input,
2181
- inst,
2182
- path: [...inst._zod.def.path ?? []],
2183
- continue: !inst._zod.def.abort
2184
- };
2185
- if (inst._zod.def.params) _iss.params = inst._zod.def.params;
2186
- payload.issues.push(issue(_iss));
2634
+ });
2635
+ function handleRefineResult(result, payload, input, inst) {
2636
+ if (!result) {
2637
+ const _iss = {
2638
+ code: "custom",
2639
+ input,
2640
+ inst,
2641
+ path: [...inst._zod.def.path ?? []],
2642
+ continue: !inst._zod.def.abort
2643
+ };
2644
+ if (inst._zod.def.params) _iss.params = inst._zod.def.params;
2645
+ payload.issues.push(issue(_iss));
2646
+ }
2647
+ }
2648
+ //#endregion
2649
+ //#region ../../../node_modules/.pnpm/zod@4.6.5/node_modules/zod/v4/core/memoizer.js
2650
+ var $ZodCyclicError = class extends Error {
2651
+ constructor() {
2652
+ super(`Cannot parse a reference cycle that closes through a transform`);
2653
+ this.name = "ZodCyclicError";
2654
+ }
2655
+ };
2656
+ /** Keyed off the context object every schema in one parse call already shares. */
2657
+ const STATE = "~memo";
2658
+ const NO_ISSUES = [];
2659
+ function isRef(value) {
2660
+ return value !== null && typeof value === "object";
2661
+ }
2662
+ function cloneIssues(issues) {
2663
+ return issues.map((iss) => iss.path ? {
2664
+ ...iss,
2665
+ path: iss.path.slice()
2666
+ } : { ...iss });
2667
+ }
2668
+ const recursive = /*@__PURE__*/ new WeakMap();
2669
+ /** What the walk established, in order of certainty: ordered so the strongest answer among children wins. */
2670
+ const NONE = 0;
2671
+ const ASSUMED = 1;
2672
+ const PROVEN = 2;
2673
+ /** Whether this schema's subtree contains a cycle, so one parse can re-enter it. */
2674
+ function isRecursive(inst, stack, resolve) {
2675
+ const cached = recursive.get(inst);
2676
+ if (cached !== void 0) return cached ? PROVEN : NONE;
2677
+ if (stack.has(inst)) return PROVEN;
2678
+ stack.add(inst);
2679
+ let result = NONE;
2680
+ const check = (child) => {
2681
+ if (result !== PROVEN && child?._zod) {
2682
+ const answer = isRecursive(child, stack, resolve);
2683
+ if (answer > result) result = answer;
2684
+ }
2685
+ };
2686
+ const shape = (sh, spread) => {
2687
+ let answer = NONE;
2688
+ for (const key of Reflect.ownKeys(sh)) {
2689
+ const desc = Object.getOwnPropertyDescriptor(sh, key);
2690
+ if (spread && !desc.enumerable) continue;
2691
+ const child = desc.get ? ASSUMED : desc.value?._zod ? isRecursive(desc.value, stack, resolve) : NONE;
2692
+ if (child > answer) answer = child;
2693
+ }
2694
+ return answer;
2695
+ };
2696
+ const merge = (answer) => {
2697
+ if (answer > result) result = answer;
2698
+ };
2699
+ const def = inst._zod.def;
2700
+ switch (def.type) {
2701
+ case "object": {
2702
+ const raw = rawShape(def);
2703
+ merge(raw ? shape(raw, true) : ASSUMED);
2704
+ check(def.catchall);
2705
+ break;
2706
+ }
2707
+ case "array":
2708
+ check(def.element);
2709
+ break;
2710
+ case "tuple":
2711
+ for (const el of def.items) check(el);
2712
+ check(def.rest);
2713
+ break;
2714
+ case "record":
2715
+ case "map":
2716
+ check(def.keyType);
2717
+ check(def.valueType);
2718
+ break;
2719
+ case "set":
2720
+ check(def.valueType);
2721
+ break;
2722
+ case "union":
2723
+ for (const el of def.options) check(el);
2724
+ break;
2725
+ case "intersection":
2726
+ check(def.left);
2727
+ check(def.right);
2728
+ break;
2729
+ case "optional":
2730
+ case "nullable":
2731
+ case "default":
2732
+ case "prefault":
2733
+ case "catch":
2734
+ case "readonly":
2735
+ case "nonoptional":
2736
+ case "promise":
2737
+ case "success":
2738
+ check(def.innerType);
2739
+ break;
2740
+ case "pipe":
2741
+ check(def.in);
2742
+ check(def.out);
2743
+ break;
2744
+ case "function":
2745
+ check(def.input);
2746
+ check(def.output);
2747
+ break;
2748
+ case "lazy": {
2749
+ const inner = def._cachedInner ?? (resolve ? inst._zod.innerType : void 0);
2750
+ merge(inner ? isRecursive(inner, stack, false) : ASSUMED);
2751
+ break;
2752
+ }
2753
+ case "template_literal":
2754
+ case "string":
2755
+ case "number":
2756
+ case "int":
2757
+ case "boolean":
2758
+ case "bigint":
2759
+ case "symbol":
2760
+ case "undefined":
2761
+ case "null":
2762
+ case "void":
2763
+ case "never":
2764
+ case "any":
2765
+ case "unknown":
2766
+ case "date":
2767
+ case "nan":
2768
+ case "enum":
2769
+ case "literal":
2770
+ case "file":
2771
+ case "transform":
2772
+ case "custom": break;
2773
+ default: for (const key in def) {
2774
+ const desc = Object.getOwnPropertyDescriptor(def, key);
2775
+ if (!desc || desc.get) continue;
2776
+ const value = desc.value;
2777
+ if (!value || typeof value !== "object") continue;
2778
+ if (value._zod) check(value);
2779
+ else if (Array.isArray(value)) for (const el of value) check(el);
2780
+ }
2781
+ }
2782
+ stack.delete(inst);
2783
+ return settle(inst, result);
2784
+ }
2785
+ /** An assumed answer must not outlive the resolution that settles it, so only a certain one is cached. */
2786
+ function settle(inst, answer) {
2787
+ if (answer !== ASSUMED) recursive.set(inst, answer === PROVEN);
2788
+ return answer;
2789
+ }
2790
+ function bucketFor(state, inst) {
2791
+ let bucket = state.buckets.get(inst);
2792
+ if (!bucket) {
2793
+ bucket = /* @__PURE__ */ new WeakMap();
2794
+ state.buckets.set(inst, bucket);
2795
+ }
2796
+ return bucket;
2797
+ }
2798
+ let handoff;
2799
+ const open = [];
2800
+ const memo = {
2801
+ alloc(_inst, payload, empty) {
2802
+ const bucket = handoff;
2803
+ if (!bucket) return empty;
2804
+ handoff = void 0;
2805
+ const entry = {
2806
+ value: empty,
2807
+ issues: null
2808
+ };
2809
+ bucket.set(payload.value, entry);
2810
+ open.push(entry);
2811
+ return empty;
2812
+ },
2813
+ guard(inst) {
2814
+ var _a;
2815
+ (_a = inst._zod).deferred ?? (_a.deferred = []);
2816
+ inst._zod.deferred.push(() => {
2817
+ const base = inst._zod.parse;
2818
+ const wrapped = (payload, ctx) => {
2819
+ if (ctx.direction !== "backward" && isBackEdge(ctx, payload.value)) throw new $ZodCyclicError();
2820
+ return base(payload, ctx);
2821
+ };
2822
+ inst._zod.parse = wrapped;
2823
+ if (inst._zod.run === base) inst._zod.run = wrapped;
2824
+ });
2825
+ },
2826
+ attach(inst) {
2827
+ var _a;
2828
+ let isRecursiveInst;
2829
+ let rechecked = false;
2830
+ let lastCtx;
2831
+ let lastBucket;
2832
+ (_a = inst._zod).deferred ?? (_a.deferred = []);
2833
+ inst._zod.deferred.push(() => {
2834
+ const base = inst._zod.parse;
2835
+ const wrapped = (payload, ctx) => {
2836
+ if (isRecursiveInst === void 0) {
2837
+ const walked = isRecursive(inst, /* @__PURE__ */ new Set(), false);
2838
+ if (walked === NONE) {
2839
+ inst._zod.parse = base;
2840
+ if (inst._zod.run === wrapped) inst._zod.run = base;
2841
+ return base(payload, ctx);
2842
+ }
2843
+ if (walked === PROVEN || rechecked) isRecursiveInst = true;
2844
+ else rechecked = true;
2845
+ }
2846
+ const input = payload.value;
2847
+ if (!isRef(input)) return base(payload, ctx);
2848
+ let state = ctx[STATE];
2849
+ if (!state) {
2850
+ state = {
2851
+ buckets: /* @__PURE__ */ new WeakMap(),
2852
+ backEdges: void 0
2853
+ };
2854
+ ctx[STATE] = state;
2855
+ }
2856
+ let bucket;
2857
+ if (lastCtx === ctx) bucket = lastBucket;
2858
+ else {
2859
+ bucket = bucketFor(state, inst);
2860
+ lastCtx = ctx;
2861
+ lastBucket = bucket;
2862
+ }
2863
+ const hit = bucket.get(input);
2864
+ if (hit) {
2865
+ payload.value = hit.value;
2866
+ if (hit.issues) {
2867
+ if (hit.issues.length) payload.issues.push(...cloneIssues(hit.issues));
2868
+ } else {
2869
+ payload.memo = true;
2870
+ state.backEdges ?? (state.backEdges = /* @__PURE__ */ new WeakSet());
2871
+ state.backEdges.add(hit.value);
2872
+ }
2873
+ return payload;
2874
+ }
2875
+ handoff = bucket;
2876
+ const depth = open.length;
2877
+ const result = base(payload, ctx);
2878
+ handoff = void 0;
2879
+ const entry = open.length > depth ? open.pop() : void 0;
2880
+ if (result instanceof Promise) return result.then((r) => {
2881
+ if (entry) entry.issues = r.issues.length ? cloneIssues(r.issues) : NO_ISSUES;
2882
+ return r;
2883
+ });
2884
+ if (entry) entry.issues = result.issues.length ? cloneIssues(result.issues) : NO_ISSUES;
2885
+ return result;
2886
+ };
2887
+ inst._zod.parse = wrapped;
2888
+ if (inst._zod.run === base) inst._zod.run = wrapped;
2889
+ });
2890
+ }
2891
+ };
2892
+ /** The memoizer that gives containers cycle support. `zod` installs it by default; `zod/mini` opts in with `config({ memoizer: memoizer() })`. */
2893
+ function memoizer() {
2894
+ return memo;
2895
+ }
2896
+ /** Whether this value is a node a back-edge resolved to before it finished. */
2897
+ function isBackEdge(ctx, value) {
2898
+ const backEdges = ctx[STATE]?.backEdges;
2899
+ return backEdges !== void 0 && isRef(value) && backEdges.has(value);
2900
+ }
2901
+ //#endregion
2902
+ //#region ../../../node_modules/.pnpm/zod@4.6.5/node_modules/zod/v4/locales/en.js
2903
+ const error = () => {
2904
+ const Sizable = {
2905
+ string: {
2906
+ unit: "characters",
2907
+ verb: "to have"
2908
+ },
2909
+ file: {
2910
+ unit: "bytes",
2911
+ verb: "to have"
2912
+ },
2913
+ array: {
2914
+ unit: "items",
2915
+ verb: "to have"
2916
+ },
2917
+ set: {
2918
+ unit: "items",
2919
+ verb: "to have"
2920
+ },
2921
+ map: {
2922
+ unit: "entries",
2923
+ verb: "to have"
2924
+ }
2925
+ };
2926
+ function getSizing(origin) {
2927
+ return Sizable[origin] ?? null;
2928
+ }
2929
+ const FormatDictionary = {
2930
+ regex: "input",
2931
+ email: "email address",
2932
+ url: "URL",
2933
+ emoji: "emoji",
2934
+ uuid: "UUID",
2935
+ uuidv4: "UUIDv4",
2936
+ uuidv6: "UUIDv6",
2937
+ nanoid: "nanoid",
2938
+ guid: "GUID",
2939
+ cuid: "cuid",
2940
+ cuid2: "cuid2",
2941
+ ulid: "ULID",
2942
+ xid: "XID",
2943
+ ksuid: "KSUID",
2944
+ datetime: "ISO datetime",
2945
+ date: "ISO date",
2946
+ time: "ISO time",
2947
+ duration: "ISO duration",
2948
+ ipv4: "IPv4 address",
2949
+ ipv6: "IPv6 address",
2950
+ mac: "MAC address",
2951
+ cidrv4: "IPv4 range",
2952
+ cidrv6: "IPv6 range",
2953
+ base64: "base64-encoded string",
2954
+ base64url: "base64url-encoded string",
2955
+ json_string: "JSON string",
2956
+ e164: "E.164 number",
2957
+ currency_code: "currency code",
2958
+ credit_card: "credit card number",
2959
+ iban: "IBAN",
2960
+ jwt: "JWT",
2961
+ template_literal: "input"
2962
+ };
2963
+ const TypeDictionary = { nan: "NaN" };
2964
+ function getTypeName(type, input) {
2965
+ if (type === "number" && typeof input === "number" && !Number.isFinite(input)) return String(input);
2966
+ return TypeDictionary[type] ?? type;
2187
2967
  }
2968
+ return (issue) => {
2969
+ switch (issue.code) {
2970
+ case "invalid_type": return `Invalid input: expected ${getTypeName(issue.expected)}, received ${getTypeName(parsedType(issue.input), issue.input)}`;
2971
+ case "invalid_value":
2972
+ if (issue.values.length === 1) return `Invalid input: expected ${stringifyPrimitive(issue.values[0])}`;
2973
+ return `Invalid option: expected one of ${joinValues(issue.values, "|")}`;
2974
+ case "too_big": {
2975
+ const adj = issue.exact ? "exactly " : issue.inclusive ? "<=" : "<";
2976
+ const sizing = getSizing(issue.origin);
2977
+ if (sizing) return `Too big: expected ${issue.origin ?? "value"} to have ${adj}${issue.maximum.toString()} ${sizing.unit ?? "elements"}`;
2978
+ return `Too big: expected ${issue.origin ?? "value"} to be ${adj}${issue.maximum.toString()}`;
2979
+ }
2980
+ case "too_small": {
2981
+ const adj = issue.exact ? "exactly " : issue.inclusive ? ">=" : ">";
2982
+ const sizing = getSizing(issue.origin);
2983
+ if (sizing) return `Too small: expected ${issue.origin} to have ${adj}${issue.minimum.toString()} ${sizing.unit}`;
2984
+ return `Too small: expected ${issue.origin} to be ${adj}${issue.minimum.toString()}`;
2985
+ }
2986
+ case "invalid_format": {
2987
+ const _issue = issue;
2988
+ if (_issue.format === "starts_with") return `Invalid string: must start with "${_issue.prefix}"`;
2989
+ if (_issue.format === "ends_with") return `Invalid string: must end with "${_issue.suffix}"`;
2990
+ if (_issue.format === "includes") return `Invalid string: must include "${_issue.includes}"`;
2991
+ if (_issue.format === "regex") return `Invalid string: must match pattern ${_issue.pattern}`;
2992
+ return `Invalid ${FormatDictionary[_issue.format] ?? issue.format}`;
2993
+ }
2994
+ case "not_multiple_of": return `Invalid number: must be a multiple of ${issue.divisor}`;
2995
+ case "unrecognized_keys": return `Unrecognized key${issue.keys.length > 1 ? "s" : ""}: ${joinValues(issue.keys, ", ")}`;
2996
+ case "invalid_key": return `Invalid key in ${issue.origin}`;
2997
+ case "invalid_union":
2998
+ if (issue.options && Array.isArray(issue.options) && issue.options.length > 0) return `Invalid discriminator value. Expected ${issue.options.map((o) => `'${o}'`).join(" | ")}`;
2999
+ if (issue.inclusive === false) return "Invalid input: more than one option matched";
3000
+ return "Invalid input";
3001
+ case "invalid_element": return `Invalid value in ${issue.origin}`;
3002
+ default: return `Invalid input`;
3003
+ }
3004
+ };
3005
+ };
3006
+ function en_default() {
3007
+ return { localeError: error() };
2188
3008
  }
2189
3009
  //#endregion
2190
- //#region ../../node_modules/.pnpm/zod@4.4.3/node_modules/zod/v4/core/registries.js
3010
+ //#region ../../../node_modules/.pnpm/zod@4.6.5/node_modules/zod/v4/core/registries.js
2191
3011
  var _a;
2192
3012
  var $ZodRegistry = class {
2193
3013
  constructor() {
@@ -2234,13 +3054,17 @@ window.__ModuleLoader__.load({
2234
3054
  (_a = globalThis).__zod_globalRegistry ?? (_a.__zod_globalRegistry = registry());
2235
3055
  const globalRegistry = globalThis.__zod_globalRegistry;
2236
3056
  //#endregion
2237
- //#region ../../node_modules/.pnpm/zod@4.4.3/node_modules/zod/v4/core/api.js
3057
+ //#region ../../../node_modules/.pnpm/zod@4.6.5/node_modules/zod/v4/core/api.js
3058
+ function snapshotChecks(def) {
3059
+ if (def.checks) def.checks = [...def.checks];
3060
+ return def;
3061
+ }
2238
3062
  // @__NO_SIDE_EFFECTS__
2239
3063
  function _string(Class, params) {
2240
- return new Class({
3064
+ return new Class(snapshotChecks({
2241
3065
  type: "string",
2242
3066
  ...normalizeParams(params)
2243
- });
3067
+ }));
2244
3068
  }
2245
3069
  // @__NO_SIDE_EFFECTS__
2246
3070
  function _email(Class, params) {
@@ -2512,11 +3336,11 @@ window.__ModuleLoader__.load({
2512
3336
  }
2513
3337
  // @__NO_SIDE_EFFECTS__
2514
3338
  function _number(Class, params) {
2515
- return new Class({
3339
+ return new Class(snapshotChecks({
2516
3340
  type: "number",
2517
3341
  checks: [],
2518
3342
  ...normalizeParams(params)
2519
- });
3343
+ }));
2520
3344
  }
2521
3345
  // @__NO_SIDE_EFFECTS__
2522
3346
  function _int(Class, params) {
@@ -2723,7 +3547,7 @@ window.__ModuleLoader__.load({
2723
3547
  const _issue = issue$2;
2724
3548
  if (_issue.fatal) _issue.continue = false;
2725
3549
  _issue.code ?? (_issue.code = "custom");
2726
- _issue.input ?? (_issue.input = payload.value);
3550
+ if (!("input" in _issue)) _issue.input = payload.value;
2727
3551
  _issue.inst ?? (_issue.inst = ch);
2728
3552
  _issue.continue ?? (_issue.continue = !ch._zod.def.abort);
2729
3553
  payload.issues.push(issue(_issue));
@@ -2743,7 +3567,11 @@ window.__ModuleLoader__.load({
2743
3567
  return ch;
2744
3568
  }
2745
3569
  //#endregion
2746
- //#region ../../node_modules/.pnpm/zod@4.4.3/node_modules/zod/v4/core/to-json-schema.js
3570
+ //#region ../../../node_modules/.pnpm/zod@4.6.5/node_modules/zod/v4/core/to-json-schema.js
3571
+ function assignProps(target, ...sources) {
3572
+ for (const source of sources) for (const key of Reflect.ownKeys(source)) if (Object.prototype.propertyIsEnumerable.call(source, key)) assignProp(target, key, source[key]);
3573
+ return target;
3574
+ }
2747
3575
  function initializeContext(params) {
2748
3576
  let target = params?.target ?? "draft-2020-12";
2749
3577
  if (target === "draft-4") target = "draft-04";
@@ -2757,12 +3585,32 @@ window.__ModuleLoader__.load({
2757
3585
  io: params?.io ?? "output",
2758
3586
  counter: 0,
2759
3587
  seen: /* @__PURE__ */ new Map(),
3588
+ sharedDefsExtractedFor: void 0,
3589
+ sharedEmitDoneFor: void 0,
2760
3590
  cycles: params?.cycles ?? "ref",
2761
3591
  reused: params?.reused ?? "inline",
3592
+ intersections: [],
3593
+ deferred: [],
2762
3594
  external: params?.external ?? void 0
2763
3595
  };
2764
3596
  }
2765
- function process(schema, ctx, _params = {
3597
+ /**
3598
+ * Applies the `unrepresentable` setting at a site that has no JSON Schema equivalent. Throws
3599
+ * `message` unless the setting (or the handler's return value) says otherwise. Returns `true` if a
3600
+ * custom JSON Schema was written into `json`, in which case the caller must not write its own.
3601
+ */
3602
+ function handleUnrepresentable(schema, ctx, json, params, message) {
3603
+ const result = typeof ctx.unrepresentable === "function" ? ctx.unrepresentable({
3604
+ zodSchema: schema,
3605
+ path: params.path,
3606
+ message
3607
+ }) : ctx.unrepresentable;
3608
+ if (result === "any") return false;
3609
+ if (result === void 0 || result === "throw") throw new Error(message);
3610
+ Object.assign(json, result);
3611
+ return true;
3612
+ }
3613
+ function processSchema(schema, ctx, _params = {
2766
3614
  path: [],
2767
3615
  schemaPath: []
2768
3616
  }) {
@@ -2781,6 +3629,8 @@ window.__ModuleLoader__.load({
2781
3629
  path: _params.path
2782
3630
  };
2783
3631
  ctx.seen.set(schema, result);
3632
+ ctx.sharedDefsExtractedFor = void 0;
3633
+ ctx.sharedEmitDoneFor = void 0;
2784
3634
  const overrideSchema = schema._zod.toJSONSchema?.();
2785
3635
  if (overrideSchema) result.schema = overrideSchema;
2786
3636
  else {
@@ -2799,12 +3649,12 @@ window.__ModuleLoader__.load({
2799
3649
  const parent = schema._zod.parent;
2800
3650
  if (parent) {
2801
3651
  if (!result.ref) result.ref = parent;
2802
- process(parent, ctx, params);
3652
+ processSchema(parent, ctx, params);
2803
3653
  ctx.seen.get(parent).isParent = true;
2804
3654
  }
2805
3655
  }
2806
3656
  const meta = ctx.metadataRegistry.get(schema);
2807
- if (meta) Object.assign(result.schema, meta);
3657
+ if (meta) assignProps(result.schema, meta);
2808
3658
  if (ctx.io === "input" && isTransforming(schema)) {
2809
3659
  delete result.schema.examples;
2810
3660
  delete result.schema.default;
@@ -2813,9 +3663,13 @@ window.__ModuleLoader__.load({
2813
3663
  delete result.schema._prefault;
2814
3664
  return ctx.seen.get(schema).schema;
2815
3665
  }
3666
+ function encodeJSONPointerSegment(segment) {
3667
+ return segment.replace(/~/g, "~0").replace(/\//g, "~1");
3668
+ }
2816
3669
  function extractDefs(ctx, schema) {
2817
3670
  const root = ctx.seen.get(schema);
2818
3671
  if (!root) throw new Error("Unprocessed schema. This is a bug in Zod.");
3672
+ if (ctx.external && ctx.sharedDefsExtractedFor === ctx.external) return;
2819
3673
  const idToSchema = /* @__PURE__ */ new Map();
2820
3674
  for (const entry of ctx.seen.entries()) {
2821
3675
  const id = ctx.metadataRegistry.get(entry[0])?.id;
@@ -2835,15 +3689,16 @@ window.__ModuleLoader__.load({
2835
3689
  entry[1].defId = id;
2836
3690
  return {
2837
3691
  defId: id,
2838
- ref: `${uriGenerator("__shared")}#/${defsSegment}/${id}`
3692
+ ref: `${uriGenerator("__shared")}#/${defsSegment}/${encodeJSONPointerSegment(id)}`
2839
3693
  };
2840
3694
  }
2841
- if (entry[1] === root) return { ref: "#" };
2842
- const defUriPrefix = `#/${defsSegment}/`;
3695
+ const uriPrefix = `#`;
3696
+ const defUriPrefix = `${uriPrefix}/${defsSegment}/`;
3697
+ if (entry[1] === root && !entry[1].schema.id) return { ref: uriPrefix };
2843
3698
  const defId = entry[1].schema.id ?? `__schema${ctx.counter++}`;
2844
3699
  return {
2845
3700
  defId,
2846
- ref: defUriPrefix + defId
3701
+ ref: defUriPrefix + encodeJSONPointerSegment(defId)
2847
3702
  };
2848
3703
  };
2849
3704
  const extractToDef = (entry) => {
@@ -2884,12 +3739,114 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
2884
3739
  continue;
2885
3740
  }
2886
3741
  if (seen.count > 1) {
2887
- if (ctx.reused === "ref") {
2888
- extractToDef(entry);
2889
- continue;
3742
+ if (ctx.reused === "ref") extractToDef(entry);
3743
+ }
3744
+ }
3745
+ if (ctx.external) ctx.sharedDefsExtractedFor = ctx.external;
3746
+ }
3747
+ /** 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. */
3748
+ function compactTypeUnion(schema) {
3749
+ const options = schema.anyOf;
3750
+ if (!Array.isArray(options) || options.length === 0 || schema.type !== void 0) return;
3751
+ const types = [];
3752
+ for (const option of options) {
3753
+ if (!option || typeof option !== "object") return;
3754
+ compactTypeUnion(option);
3755
+ const keys = Object.keys(option);
3756
+ if (keys.length !== 1 || keys[0] !== "type") return;
3757
+ const type = option.type;
3758
+ for (const member of Array.isArray(type) ? type : [type]) {
3759
+ if (typeof member !== "string") return;
3760
+ if (!types.includes(member)) types.push(member);
3761
+ }
3762
+ }
3763
+ delete schema.anyOf;
3764
+ schema.type = types.length === 1 ? types[0] : types;
3765
+ }
3766
+ /** Keywords `foldIntersection` knows how to combine. Anything else — `$ref`, `patternProperties`,
3767
+ * an annotation like `description` — makes a member unfoldable, so a constraint this does not
3768
+ * understand leaves the `allOf` alone instead of being silently dropped or misattributed. */
3769
+ const FOLDABLE_KEYS = /* @__PURE__ */ new Set([
3770
+ "type",
3771
+ "properties",
3772
+ "required",
3773
+ "additionalProperties"
3774
+ ]);
3775
+ const UNION_KEYS = ["oneOf", "anyOf"];
3776
+ /** 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. */
3777
+ function undeclaredConstraint(member) {
3778
+ const extra = member.additionalProperties;
3779
+ if (extra === void 0 || extra === false || typeof extra !== "object" || extra === null) return null;
3780
+ return Object.keys(extra).length ? extra : null;
3781
+ }
3782
+ /** Combines object members into the single object they describe together, or returns `null` if any of them carries a keyword outside {@link FOLDABLE_KEYS}. */
3783
+ function foldObjects(members) {
3784
+ const objects = [];
3785
+ for (const member of members) {
3786
+ if (typeof member !== "object" || member.type !== "object") return null;
3787
+ for (const key in member) if (!FOLDABLE_KEYS.has(key)) return null;
3788
+ objects.push(member);
3789
+ }
3790
+ const properties = {};
3791
+ const required = /* @__PURE__ */ new Set();
3792
+ for (const object of objects) {
3793
+ for (const key in object.properties) {
3794
+ if (Object.prototype.hasOwnProperty.call(properties, key)) continue;
3795
+ const parts = [];
3796
+ for (const other of objects) {
3797
+ const part = other.properties?.[key] ?? undeclaredConstraint(other);
3798
+ if (part === null || part === void 0) continue;
3799
+ if (!parts.some((seen) => JSON.stringify(seen) === JSON.stringify(part))) parts.push(part);
2890
3800
  }
3801
+ assignProp(properties, key, parts.length === 1 ? parts[0] : foldObjects(parts) ?? { allOf: parts });
3802
+ }
3803
+ for (const key of object.required ?? []) required.add(key);
3804
+ }
3805
+ const folded = {
3806
+ type: "object",
3807
+ properties
3808
+ };
3809
+ if (required.size) folded.required = [...required];
3810
+ if (objects.every((object) => object.additionalProperties === false)) folded.additionalProperties = false;
3811
+ else {
3812
+ const constraints = [];
3813
+ for (const object of objects) {
3814
+ const constraint = undeclaredConstraint(object);
3815
+ if (constraint && !constraints.some((seen) => JSON.stringify(seen) === JSON.stringify(constraint))) constraints.push(constraint);
2891
3816
  }
3817
+ if (constraints.length === 1) folded.additionalProperties = constraints[0];
3818
+ else if (constraints.length > 1) folded.additionalProperties = { allOf: constraints };
3819
+ }
3820
+ return folded;
3821
+ }
3822
+ /** `additionalProperties` in an `allOf` member sees only that member's own `properties`, so two
3823
+ * closed object members reject each other's keys and the schema validates nothing. Zod's parser
3824
+ * pools the key sets instead — `handleIntersectionResults` reports a key as unrecognized only when
3825
+ * *every* side rejects it — so the emitted schema has to pool them too, and folding the members
3826
+ * into one object is the encoding that says so on every target.
3827
+ *
3828
+ * This runs from `finalize`, after `extractDefs`, which is what keeps it clear of the `$ref`
3829
+ * machinery: a member extracted into `$defs` is already a `$ref` by now and declines to fold, so it
3830
+ * keeps its reference and its own closedness rather than being inlined as a stale copy. */
3831
+ function foldIntersection(json) {
3832
+ const allOf = json.allOf;
3833
+ if (!Array.isArray(allOf) || allOf.length < 2) return;
3834
+ for (const key of FOLDABLE_KEYS) if (key in json) return;
3835
+ const unions = allOf.filter((m) => UNION_KEYS.some((k) => Array.isArray(m[k])));
3836
+ let folded = null;
3837
+ if (!unions.length) folded = foldObjects(allOf);
3838
+ else {
3839
+ const union = unions[0];
3840
+ const keyword = UNION_KEYS.find((k) => Array.isArray(union[k]));
3841
+ if (Object.keys(union).length !== 1) return;
3842
+ const rest = allOf.filter((m) => m !== union);
3843
+ const branches = union[keyword].map((branch) => foldObjects([...rest, branch]));
3844
+ if (branches.some((b) => !b)) return;
3845
+ folded = { [keyword]: branches };
2892
3846
  }
3847
+ if (!folded) return;
3848
+ delete json.allOf;
3849
+ assignProps(json, folded);
2893
3850
  }
2894
3851
  function finalize(ctx, schema) {
2895
3852
  const root = ctx.seen.get(schema);
@@ -2908,8 +3865,8 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
2908
3865
  if (refSchema.$ref && (ctx.target === "draft-07" || ctx.target === "draft-04" || ctx.target === "openapi-3.0")) {
2909
3866
  schema.allOf = schema.allOf ?? [];
2910
3867
  schema.allOf.push(refSchema);
2911
- } else Object.assign(schema, refSchema);
2912
- Object.assign(schema, _cached);
3868
+ } else assignProps(schema, refSchema);
3869
+ assignProps(schema, _cached);
2913
3870
  if (zodSchema._zod.parent === ref) for (const key in schema) {
2914
3871
  if (key === "$ref" || key === "allOf") continue;
2915
3872
  if (!(key in _cached)) delete schema[key];
@@ -2937,7 +3894,22 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
2937
3894
  path: seen.path ?? []
2938
3895
  });
2939
3896
  };
2940
- for (const entry of [...ctx.seen.entries()].reverse()) flattenRef(entry[0]);
3897
+ if (!ctx.external || ctx.sharedEmitDoneFor !== ctx.external) {
3898
+ for (const entry of [...ctx.seen.entries()].reverse()) flattenRef(entry[0]);
3899
+ if (ctx.target !== "openapi-3.0") for (const entry of ctx.seen.entries()) compactTypeUnion(entry[1].def ?? entry[1].schema);
3900
+ for (const rewrite of ctx.deferred) rewrite();
3901
+ if (ctx.intersections.length) {
3902
+ const carriers = /* @__PURE__ */ new Map();
3903
+ for (const seen of ctx.seen.values()) for (const json of [seen.schema, seen.def]) {
3904
+ const allOf = json?.allOf;
3905
+ if (!Array.isArray(allOf)) continue;
3906
+ const existing = carriers.get(allOf);
3907
+ if (existing) existing.push(json);
3908
+ else carriers.set(allOf, [json]);
3909
+ }
3910
+ for (const allOf of ctx.intersections) for (const json of carriers.get(allOf) ?? []) foldIntersection(json);
3911
+ }
3912
+ }
2941
3913
  const result = {};
2942
3914
  if (ctx.target === "draft-2020-12") result.$schema = "https://json-schema.org/draft/2020-12/schema";
2943
3915
  else if (ctx.target === "draft-07") result.$schema = "http://json-schema.org/draft-07/schema#";
@@ -2948,17 +3920,18 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
2948
3920
  if (!id) throw new Error("Schema is missing an `id` property");
2949
3921
  result.$id = ctx.external.uri(id);
2950
3922
  }
2951
- Object.assign(result, root.def ?? root.schema);
3923
+ assignProps(result, root.defId ? root.schema : root.def ?? root.schema);
2952
3924
  const rootMetaId = ctx.metadataRegistry.get(schema)?.id;
2953
3925
  if (rootMetaId !== void 0 && result.id === rootMetaId) delete result.id;
2954
3926
  const defs = ctx.external?.defs ?? {};
2955
- for (const entry of ctx.seen.entries()) {
3927
+ if (!ctx.external || ctx.sharedEmitDoneFor !== ctx.external) for (const entry of ctx.seen.entries()) {
2956
3928
  const seen = entry[1];
2957
3929
  if (seen.def && seen.defId) {
2958
3930
  if (seen.def.id === seen.defId) delete seen.def.id;
2959
- defs[seen.defId] = seen.def;
3931
+ assignProp(defs, seen.defId, seen.def);
2960
3932
  }
2961
3933
  }
3934
+ if (ctx.external) ctx.sharedEmitDoneFor = ctx.external;
2962
3935
  if (ctx.external) {} else if (Object.keys(defs).length > 0) if (ctx.target === "draft-2020-12") result.$defs = defs;
2963
3936
  else result.definitions = defs;
2964
3937
  try {
@@ -2988,7 +3961,7 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
2988
3961
  if (def.type === "array") return isTransforming(def.element, ctx);
2989
3962
  if (def.type === "set") return isTransforming(def.valueType, ctx);
2990
3963
  if (def.type === "lazy") return isTransforming(def.getter(), ctx);
2991
- 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);
3964
+ 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);
2992
3965
  if (def.type === "intersection") return isTransforming(def.left, ctx) || isTransforming(def.right, ctx);
2993
3966
  if (def.type === "record" || def.type === "map") return isTransforming(def.keyType, ctx) || isTransforming(def.valueType, ctx);
2994
3967
  if (def.type === "pipe") {
@@ -3019,7 +3992,7 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
3019
3992
  ...params,
3020
3993
  processors
3021
3994
  });
3022
- process(schema, ctx);
3995
+ processSchema(schema, ctx);
3023
3996
  extractDefs(ctx, schema);
3024
3997
  return finalize(ctx, schema);
3025
3998
  };
@@ -3031,12 +4004,84 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
3031
4004
  io,
3032
4005
  processors
3033
4006
  });
3034
- process(schema, ctx);
4007
+ processSchema(schema, ctx);
3035
4008
  extractDefs(ctx, schema);
3036
4009
  return finalize(ctx, schema);
3037
4010
  };
3038
4011
  //#endregion
3039
- //#region ../../node_modules/.pnpm/zod@4.4.3/node_modules/zod/v4/core/json-schema-processors.js
4012
+ //#region ../../../node_modules/.pnpm/zod@4.6.5/node_modules/zod/v4/core/json-schema-processors.js
4013
+ const narrowMin = (agg, key, value) => {
4014
+ if (agg[key] === void 0 || value > agg[key]) agg[key] = value;
4015
+ };
4016
+ const narrowMax = (agg, key, value) => {
4017
+ if (agg[key] === void 0 || value < agg[key]) agg[key] = value;
4018
+ };
4019
+ const narrowBoth = (agg, value) => {
4020
+ narrowMin(agg, "minimum", value);
4021
+ narrowMax(agg, "maximum", value);
4022
+ };
4023
+ const addDivisor = (agg, value) => {
4024
+ agg.multipleOf ?? (agg.multipleOf = []);
4025
+ if (!agg.multipleOf.includes(value)) agg.multipleOf.push(value);
4026
+ };
4027
+ const addPattern = (agg, pattern) => {
4028
+ agg.patterns ?? (agg.patterns = /* @__PURE__ */ new Set());
4029
+ agg.patterns.add(pattern);
4030
+ };
4031
+ const intersectMime = (agg, mime) => {
4032
+ agg.mime = agg.mime ? agg.mime.filter((m) => mime.includes(m)) : [...mime];
4033
+ };
4034
+ const setFormat = (agg, format) => {
4035
+ agg.format = format;
4036
+ if (format.includes("int")) agg.isInt = true;
4037
+ };
4038
+ const minContributor = (agg, def) => narrowMin(agg, "minimum", def.minimum);
4039
+ const maxContributor = (agg, def) => narrowMax(agg, "maximum", def.maximum);
4040
+ const formatContributor = (ranges) => (agg, def) => {
4041
+ setFormat(agg, def.format);
4042
+ const [minimum, maximum] = ranges[def.format];
4043
+ narrowMin(agg, "minimum", minimum);
4044
+ narrowMax(agg, "maximum", maximum);
4045
+ };
4046
+ const contributors = {
4047
+ greater_than: (agg, def) => narrowMin(agg, def.inclusive ? "minimum" : "exclusiveMinimum", def.value),
4048
+ less_than: (agg, def) => narrowMax(agg, def.inclusive ? "maximum" : "exclusiveMaximum", def.value),
4049
+ multiple_of: (agg, def) => addDivisor(agg, def.value),
4050
+ number_format: formatContributor(NUMBER_FORMAT_RANGES),
4051
+ bigint_format: formatContributor(BIGINT_FORMAT_RANGES),
4052
+ min_length: minContributor,
4053
+ max_length: maxContributor,
4054
+ length_equals: (agg, def) => narrowBoth(agg, def.length),
4055
+ min_size: minContributor,
4056
+ max_size: maxContributor,
4057
+ size_equals: (agg, def) => narrowBoth(agg, def.size),
4058
+ string_format: (agg, def) => {
4059
+ setFormat(agg, def.format);
4060
+ if (def.pattern) addPattern(agg, def.pattern);
4061
+ if (def.format === "base64" || def.format === "base64url") agg.contentEncoding = def.format;
4062
+ if (def.local || def.precision === -1) agg.laxFormat = true;
4063
+ },
4064
+ mime_type: (agg, def) => intersectMime(agg, def.mime)
4065
+ };
4066
+ function aggregateChecks(schema) {
4067
+ const agg = {};
4068
+ const def = schema._zod.def;
4069
+ const list = schema._zod.traits.has("$ZodCheck") ? [schema, ...def.checks ?? []] : def.checks ?? [];
4070
+ for (const ch of list) contributors[ch._zod.def.check]?.(agg, ch._zod.def);
4071
+ const bag = schema._zod.bag;
4072
+ if (bag.minimum !== void 0) narrowMin(agg, "minimum", bag.minimum);
4073
+ if (bag.exclusiveMinimum !== void 0) narrowMin(agg, "exclusiveMinimum", bag.exclusiveMinimum);
4074
+ if (bag.maximum !== void 0) narrowMax(agg, "maximum", bag.maximum);
4075
+ if (bag.exclusiveMaximum !== void 0) narrowMax(agg, "exclusiveMaximum", bag.exclusiveMaximum);
4076
+ if (bag.multipleOf !== void 0) addDivisor(agg, bag.multipleOf);
4077
+ if (bag.format !== void 0) {
4078
+ agg.format ?? (agg.format = bag.format);
4079
+ if (bag.format.includes("int")) agg.isInt = true;
4080
+ }
4081
+ if (bag.mime) intersectMime(agg, bag.mime);
4082
+ for (const pattern of bag.patterns ?? []) addPattern(agg, pattern);
4083
+ return agg;
4084
+ }
3040
4085
  const formatMap = {
3041
4086
  guid: "uuid",
3042
4087
  url: "uri",
@@ -3044,32 +4089,33 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
3044
4089
  json_string: "json-string",
3045
4090
  regex: ""
3046
4091
  };
4092
+ const exactPatterns = /* @__PURE__ */ new Map([[base64Charset, base64], [base64urlCharset, base64url]]);
4093
+ const exactPattern = (p) => exactPatterns.get(p) ?? p;
3047
4094
  const stringProcessor = (schema, ctx, _json, _params) => {
3048
4095
  const json = _json;
3049
4096
  json.type = "string";
3050
- const { minimum, maximum, format, patterns, contentEncoding } = schema._zod.bag;
4097
+ const { minimum, maximum, format, patterns, contentEncoding, laxFormat } = aggregateChecks(schema);
3051
4098
  if (typeof minimum === "number") json.minLength = minimum;
3052
4099
  if (typeof maximum === "number") json.maxLength = maximum;
3053
4100
  if (format) {
3054
4101
  json.format = formatMap[format] ?? format;
3055
4102
  if (json.format === "") delete json.format;
3056
- if (format === "time") delete json.format;
4103
+ if (format === "time" || laxFormat) delete json.format;
3057
4104
  }
3058
4105
  if (contentEncoding) json.contentEncoding = contentEncoding;
3059
4106
  if (patterns && patterns.size > 0) {
3060
- const regexes = [...patterns];
3061
- if (regexes.length === 1) json.pattern = regexes[0].source;
3062
- else if (regexes.length > 1) json.allOf = [...regexes.map((regex) => ({
4107
+ const patternList = [...patterns].map(exactPattern);
4108
+ if (patternList.length === 1) json.pattern = patternList[0].source;
4109
+ else if (patternList.length > 1) json.allOf = [...patternList.map((regex) => ({
3063
4110
  ...ctx.target === "draft-07" || ctx.target === "draft-04" || ctx.target === "openapi-3.0" ? { type: "string" } : {},
3064
4111
  pattern: regex.source
3065
4112
  }))];
3066
4113
  }
3067
4114
  };
3068
- const numberProcessor = (schema, ctx, _json, _params) => {
4115
+ const numberProcessor = (schema, ctx, _json, params) => {
3069
4116
  const json = _json;
3070
- const { minimum, maximum, format, multipleOf, exclusiveMaximum, exclusiveMinimum } = schema._zod.bag;
3071
- if (typeof format === "string" && format.includes("int")) json.type = "integer";
3072
- else json.type = "number";
4117
+ const { minimum, maximum, multipleOf, exclusiveMaximum, exclusiveMinimum, isInt } = aggregateChecks(schema);
4118
+ json.type = isInt ? "integer" : "number";
3073
4119
  const exMin = typeof exclusiveMinimum === "number" && exclusiveMinimum >= (minimum ?? Number.NEGATIVE_INFINITY);
3074
4120
  const exMax = typeof exclusiveMaximum === "number" && exclusiveMaximum <= (maximum ?? Number.POSITIVE_INFINITY);
3075
4121
  const legacy = ctx.target === "draft-04" || ctx.target === "openapi-3.0";
@@ -3083,7 +4129,14 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
3083
4129
  json.exclusiveMaximum = true;
3084
4130
  } else json.exclusiveMaximum = exclusiveMaximum;
3085
4131
  else if (typeof maximum === "number") json.maximum = maximum;
3086
- if (typeof multipleOf === "number") json.multipleOf = multipleOf;
4132
+ if (multipleOf) {
4133
+ const divisors = /* @__PURE__ */ new Set();
4134
+ for (const divisor of multipleOf) if (Number.isFinite(divisor) && divisor !== 0) divisors.add(Math.abs(divisor));
4135
+ else handleUnrepresentable(schema, ctx, json, params, `A multipleOf divisor of ${divisor} cannot be represented in JSON Schema`);
4136
+ const [first, ...rest] = divisors;
4137
+ if (first !== void 0) json.multipleOf = first;
4138
+ if (rest.length) json.allOf = [...json.allOf ?? [], ...rest.map((m) => ({ multipleOf: m }))];
4139
+ }
3087
4140
  };
3088
4141
  const booleanProcessor = (_schema, _ctx, json, _params) => {
3089
4142
  json.type = "boolean";
@@ -3094,53 +4147,63 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
3094
4147
  const enumProcessor = (schema, _ctx, json, _params) => {
3095
4148
  const def = schema._zod.def;
3096
4149
  const values = getEnumValues(def.entries);
4150
+ if (values.length === 0) {
4151
+ json.not = {};
4152
+ return;
4153
+ }
3097
4154
  if (values.every((v) => typeof v === "number")) json.type = "number";
3098
4155
  if (values.every((v) => typeof v === "string")) json.type = "string";
3099
4156
  json.enum = values;
3100
4157
  };
3101
- const customProcessor = (_schema, ctx, _json, _params) => {
3102
- if (ctx.unrepresentable === "throw") throw new Error("Custom types cannot be represented in JSON Schema");
4158
+ const customProcessor = (schema, ctx, json, params) => {
4159
+ handleUnrepresentable(schema, ctx, json, params, "Custom types cannot be represented in JSON Schema");
3103
4160
  };
3104
- const transformProcessor = (_schema, ctx, _json, _params) => {
3105
- if (ctx.unrepresentable === "throw") throw new Error("Transforms cannot be represented in JSON Schema");
4161
+ const transformProcessor = (schema, ctx, json, params) => {
4162
+ handleUnrepresentable(schema, ctx, json, params, "Transforms cannot be represented in JSON Schema");
3106
4163
  };
3107
4164
  const arrayProcessor = (schema, ctx, _json, params) => {
3108
4165
  const json = _json;
3109
4166
  const def = schema._zod.def;
3110
- const { minimum, maximum } = schema._zod.bag;
4167
+ const { minimum, maximum } = aggregateChecks(schema);
3111
4168
  if (typeof minimum === "number") json.minItems = minimum;
3112
4169
  if (typeof maximum === "number") json.maxItems = maximum;
3113
4170
  json.type = "array";
3114
- json.items = process(def.element, ctx, {
4171
+ json.items = processSchema(def.element, ctx, {
3115
4172
  ...params,
3116
4173
  path: [...params.path, "items"]
3117
4174
  });
3118
4175
  };
4176
+ function inputOptin(schema) {
4177
+ const def = schema._zod.def;
4178
+ if (def.type === "pipe" && def.in._zod.traits.has("$ZodTransform")) return inputOptin(def.out);
4179
+ if (def.type === "catch") return inputOptin(def.innerType);
4180
+ return schema._zod.optin;
4181
+ }
3119
4182
  const objectProcessor = (schema, ctx, _json, params) => {
3120
4183
  const json = _json;
3121
4184
  const def = schema._zod.def;
4185
+ const shape = def.shape;
4186
+ if (Object.getOwnPropertySymbols(shape).length && handleUnrepresentable(schema, ctx, json, params, "Symbol keys cannot be represented in JSON Schema")) return;
3122
4187
  json.type = "object";
3123
4188
  json.properties = {};
3124
- const shape = def.shape;
3125
- for (const key in shape) json.properties[key] = process(shape[key], ctx, {
4189
+ for (const key in shape) assignProp(json.properties, key, processSchema(shape[key], ctx, {
3126
4190
  ...params,
3127
4191
  path: [
3128
4192
  ...params.path,
3129
4193
  "properties",
3130
4194
  key
3131
4195
  ]
3132
- });
3133
- const allKeys = new Set(Object.keys(shape));
3134
- const requiredKeys = new Set([...allKeys].filter((key) => {
3135
- const v = def.shape[key]._zod;
3136
- if (ctx.io === "input") return v.optin === void 0;
3137
- else return v.optout === void 0;
3138
4196
  }));
3139
- if (requiredKeys.size > 0) json.required = Array.from(requiredKeys);
4197
+ const requiredKeys = [];
4198
+ for (const key of Object.keys(shape)) {
4199
+ const field = def.shape[key];
4200
+ if (ctx.io === "input" ? inputOptin(field) === void 0 : field._zod.optout === void 0) requiredKeys.push(key);
4201
+ }
4202
+ if (requiredKeys.length > 0) json.required = requiredKeys;
3140
4203
  if (def.catchall?._zod.def.type === "never") json.additionalProperties = false;
3141
4204
  else if (!def.catchall) {
3142
4205
  if (ctx.io === "output") json.additionalProperties = false;
3143
- } else if (def.catchall) json.additionalProperties = process(def.catchall, ctx, {
4206
+ } else if (def.catchall) json.additionalProperties = processSchema(def.catchall, ctx, {
3144
4207
  ...params,
3145
4208
  path: [...params.path, "additionalProperties"]
3146
4209
  });
@@ -3148,7 +4211,7 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
3148
4211
  const unionProcessor = (schema, ctx, json, params) => {
3149
4212
  const def = schema._zod.def;
3150
4213
  const isExclusive = def.inclusive === false;
3151
- const options = def.options.map((x, i) => process(x, ctx, {
4214
+ const options = def.options.map((x, i) => processSchema(x, ctx, {
3152
4215
  ...params,
3153
4216
  path: [
3154
4217
  ...params.path,
@@ -3161,7 +4224,7 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
3161
4224
  };
3162
4225
  const intersectionProcessor = (schema, ctx, json, params) => {
3163
4226
  const def = schema._zod.def;
3164
- const a = process(def.left, ctx, {
4227
+ const a = processSchema(def.left, ctx, {
3165
4228
  ...params,
3166
4229
  path: [
3167
4230
  ...params.path,
@@ -3169,7 +4232,7 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
3169
4232
  0
3170
4233
  ]
3171
4234
  });
3172
- const b = process(def.right, ctx, {
4235
+ const b = processSchema(def.right, ctx, {
3173
4236
  ...params,
3174
4237
  path: [
3175
4238
  ...params.path,
@@ -3178,11 +4241,13 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
3178
4241
  ]
3179
4242
  });
3180
4243
  const isSimpleIntersection = (val) => "allOf" in val && Object.keys(val).length === 1;
3181
- json.allOf = [...isSimpleIntersection(a) ? a.allOf : [a], ...isSimpleIntersection(b) ? b.allOf : [b]];
4244
+ const allOf = [...isSimpleIntersection(a) ? a.allOf : [a], ...isSimpleIntersection(b) ? b.allOf : [b]];
4245
+ json.allOf = allOf;
4246
+ ctx.intersections.push(allOf);
3182
4247
  };
3183
4248
  const nullableProcessor = (schema, ctx, json, params) => {
3184
4249
  const def = schema._zod.def;
3185
- const inner = process(def.innerType, ctx, params);
4250
+ const inner = processSchema(def.innerType, ctx, params);
3186
4251
  const seen = ctx.seen.get(schema);
3187
4252
  if (ctx.target === "openapi-3.0") {
3188
4253
  seen.ref = def.innerType;
@@ -3191,34 +4256,53 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
3191
4256
  };
3192
4257
  const nonoptionalProcessor = (schema, ctx, _json, params) => {
3193
4258
  const def = schema._zod.def;
3194
- process(def.innerType, ctx, params);
4259
+ processSchema(def.innerType, ctx, params);
3195
4260
  const seen = ctx.seen.get(schema);
3196
4261
  seen.ref = def.innerType;
3197
4262
  };
4263
+ /** Round-trips a default value through JSON so the emitted schema is guaranteed to be valid JSON.
4264
+ * A BigInt has no reliable encoding, so it goes through `unrepresentable` like any other
4265
+ * unrepresentable value. Returns a sentinel when the caller must not write a default of its own. */
4266
+ const UNREPRESENTABLE_DEFAULT = Symbol();
4267
+ function serializeDefaultValue(value, schema, ctx, json, params) {
4268
+ let unrepresentable = false;
4269
+ const serialized = JSON.stringify(value, (_, val) => {
4270
+ if (typeof val !== "bigint") return val;
4271
+ unrepresentable = true;
4272
+ return null;
4273
+ });
4274
+ if (!unrepresentable) return JSON.parse(serialized);
4275
+ handleUnrepresentable(schema, ctx, json, params, "BigInt defaults cannot be represented in JSON Schema");
4276
+ return UNREPRESENTABLE_DEFAULT;
4277
+ }
3198
4278
  const defaultProcessor = (schema, ctx, json, params) => {
3199
4279
  const def = schema._zod.def;
3200
- process(def.innerType, ctx, params);
4280
+ processSchema(def.innerType, ctx, params);
3201
4281
  const seen = ctx.seen.get(schema);
3202
4282
  seen.ref = def.innerType;
3203
- json.default = JSON.parse(JSON.stringify(def.defaultValue));
4283
+ const value = serializeDefaultValue(def.defaultValue, schema, ctx, json, params);
4284
+ if (value !== UNREPRESENTABLE_DEFAULT) json.default = value;
3204
4285
  };
3205
4286
  const prefaultProcessor = (schema, ctx, json, params) => {
3206
4287
  const def = schema._zod.def;
3207
- process(def.innerType, ctx, params);
4288
+ processSchema(def.innerType, ctx, params);
3208
4289
  const seen = ctx.seen.get(schema);
3209
4290
  seen.ref = def.innerType;
3210
- if (ctx.io === "input") json._prefault = JSON.parse(JSON.stringify(def.defaultValue));
4291
+ if (ctx.io !== "input") return;
4292
+ const value = serializeDefaultValue(def.defaultValue, schema, ctx, json, params);
4293
+ if (value !== UNREPRESENTABLE_DEFAULT) json._prefault = value;
3211
4294
  };
3212
4295
  const catchProcessor = (schema, ctx, json, params) => {
3213
4296
  const def = schema._zod.def;
3214
- process(def.innerType, ctx, params);
4297
+ processSchema(def.innerType, ctx, params);
3215
4298
  const seen = ctx.seen.get(schema);
3216
4299
  seen.ref = def.innerType;
3217
4300
  let catchValue;
3218
4301
  try {
3219
4302
  catchValue = def.catchValue(void 0);
3220
4303
  } catch {
3221
- throw new Error("Dynamic catch values are not supported in JSON Schema");
4304
+ handleUnrepresentable(schema, ctx, json, params, "Dynamic catch values are not supported in JSON Schema");
4305
+ return;
3222
4306
  }
3223
4307
  json.default = catchValue;
3224
4308
  };
@@ -3226,77 +4310,75 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
3226
4310
  const def = schema._zod.def;
3227
4311
  const inIsTransform = def.in._zod.traits.has("$ZodTransform");
3228
4312
  const innerType = ctx.io === "input" ? inIsTransform ? def.out : def.in : def.out;
3229
- process(innerType, ctx, params);
4313
+ processSchema(innerType, ctx, params);
3230
4314
  const seen = ctx.seen.get(schema);
3231
4315
  seen.ref = innerType;
3232
4316
  };
3233
4317
  const readonlyProcessor = (schema, ctx, json, params) => {
3234
4318
  const def = schema._zod.def;
3235
- process(def.innerType, ctx, params);
4319
+ processSchema(def.innerType, ctx, params);
3236
4320
  const seen = ctx.seen.get(schema);
3237
4321
  seen.ref = def.innerType;
3238
4322
  json.readOnly = true;
3239
4323
  };
3240
4324
  const optionalProcessor = (schema, ctx, _json, params) => {
3241
4325
  const def = schema._zod.def;
3242
- process(def.innerType, ctx, params);
4326
+ processSchema(def.innerType, ctx, params);
3243
4327
  const seen = ctx.seen.get(schema);
3244
4328
  seen.ref = def.innerType;
3245
4329
  };
3246
4330
  //#endregion
3247
- //#region ../../node_modules/.pnpm/zod@4.4.3/node_modules/zod/v4/classic/iso.js
3248
- const ZodISODateTime = /*@__PURE__*/ $constructor("ZodISODateTime", (inst, def) => {
3249
- $ZodISODateTime.init(inst, def);
3250
- ZodStringFormat.init(inst, def);
3251
- });
3252
- function datetime(params) {
3253
- return /* @__PURE__ */ _isoDateTime(ZodISODateTime, params);
3254
- }
3255
- const ZodISODate = /*@__PURE__*/ $constructor("ZodISODate", (inst, def) => {
3256
- $ZodISODate.init(inst, def);
3257
- ZodStringFormat.init(inst, def);
3258
- });
3259
- function date(params) {
3260
- return /* @__PURE__ */ _isoDate(ZodISODate, params);
3261
- }
3262
- const ZodISOTime = /*@__PURE__*/ $constructor("ZodISOTime", (inst, def) => {
3263
- $ZodISOTime.init(inst, def);
3264
- ZodStringFormat.init(inst, def);
3265
- });
3266
- function time(params) {
3267
- return /* @__PURE__ */ _isoTime(ZodISOTime, params);
3268
- }
3269
- const ZodISODuration = /*@__PURE__*/ $constructor("ZodISODuration", (inst, def) => {
3270
- $ZodISODuration.init(inst, def);
3271
- ZodStringFormat.init(inst, def);
3272
- });
3273
- function duration(params) {
3274
- return /* @__PURE__ */ _isoDuration(ZodISODuration, params);
4331
+ //#region ../../../node_modules/.pnpm/zod@4.6.5/node_modules/zod/v4/classic/errors.js
4332
+ const _installedErrorProtos = /* @__PURE__ */ new WeakSet([Object.prototype, Error.prototype]);
4333
+ function _lazyMethod(proto, key, make) {
4334
+ Object.defineProperty(proto, key, {
4335
+ configurable: true,
4336
+ enumerable: false,
4337
+ get() {
4338
+ const value = make(this);
4339
+ Object.defineProperty(this, key, {
4340
+ value,
4341
+ configurable: true,
4342
+ writable: true
4343
+ });
4344
+ return value;
4345
+ },
4346
+ set(value) {
4347
+ Object.defineProperty(this, key, {
4348
+ value,
4349
+ configurable: true,
4350
+ writable: true
4351
+ });
4352
+ }
4353
+ });
3275
4354
  }
3276
- //#endregion
3277
- //#region ../../node_modules/.pnpm/zod@4.4.3/node_modules/zod/v4/classic/errors.js
3278
4355
  const initializer = (inst, issues) => {
3279
4356
  $ZodError.init(inst, issues);
3280
4357
  inst.name = "ZodError";
3281
- Object.defineProperties(inst, {
3282
- format: { value: (mapper) => formatError(inst, mapper) },
3283
- flatten: { value: (mapper) => flattenError(inst, mapper) },
3284
- addIssue: { value: (issue) => {
3285
- inst.issues.push(issue);
3286
- inst.message = JSON.stringify(inst.issues, jsonStringifyReplacer, 2);
3287
- } },
3288
- addIssues: { value: (issues) => {
3289
- inst.issues.push(...issues);
3290
- inst.message = JSON.stringify(inst.issues, jsonStringifyReplacer, 2);
3291
- } },
3292
- isEmpty: { get() {
3293
- return inst.issues.length === 0;
3294
- } }
4358
+ const proto = Object.getPrototypeOf(inst);
4359
+ if (_installedErrorProtos.has(proto)) return;
4360
+ _installedErrorProtos.add(proto);
4361
+ _lazyMethod(proto, "format", (self) => (mapper) => formatError(self, mapper));
4362
+ _lazyMethod(proto, "flatten", (self) => (mapper) => flattenError(self, mapper));
4363
+ _lazyMethod(proto, "addIssue", (self) => (issue) => {
4364
+ self.issues.push(issue);
4365
+ self.message = JSON.stringify(self.issues, jsonStringifyReplacer, 2);
4366
+ });
4367
+ _lazyMethod(proto, "addIssues", (self) => (issues) => {
4368
+ self.issues.push(...issues);
4369
+ self.message = JSON.stringify(self.issues, jsonStringifyReplacer, 2);
4370
+ });
4371
+ Object.defineProperty(proto, "isEmpty", {
4372
+ configurable: true,
4373
+ enumerable: false,
4374
+ get() {
4375
+ return this.issues.length === 0;
4376
+ }
3295
4377
  });
3296
4378
  };
3297
- const ZodRealError = /*@__PURE__*/ $constructor("ZodError", initializer, { Parent: Error });
4379
+ const ZodRealError = /*@__PURE__*/ $constructor("ZodError", initializer, void 0, { Parent: Error });
3298
4380
  //#endregion
3299
- //#region ../../node_modules/.pnpm/zod@4.4.3/node_modules/zod/v4/classic/parse.js
4381
+ //#region ../../../node_modules/.pnpm/zod@4.6.5/node_modules/zod/v4/classic/parse.js
3300
4382
  const parse = /* @__PURE__ */ _parse(ZodRealError);
3301
4383
  const parseAsync = /* @__PURE__ */ _parseAsync(ZodRealError);
3302
4384
  const safeParse = /* @__PURE__ */ _safeParse(ZodRealError);
@@ -3310,255 +4392,320 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
3310
4392
  const safeEncodeAsync = /* @__PURE__ */ _safeEncodeAsync(ZodRealError);
3311
4393
  const safeDecodeAsync = /* @__PURE__ */ _safeDecodeAsync(ZodRealError);
3312
4394
  //#endregion
3313
- //#region ../../node_modules/.pnpm/zod@4.4.3/node_modules/zod/v4/classic/schemas.js
3314
- const _installedGroups = /* @__PURE__ */ new WeakMap();
3315
- function _installLazyMethods(inst, group, methods) {
3316
- const proto = Object.getPrototypeOf(inst);
3317
- let installed = _installedGroups.get(proto);
3318
- if (!installed) {
3319
- installed = /* @__PURE__ */ new Set();
3320
- _installedGroups.set(proto, installed);
3321
- }
3322
- if (installed.has(group)) return;
3323
- installed.add(group);
3324
- for (const key in methods) {
3325
- const fn = methods[key];
3326
- Object.defineProperty(proto, key, {
3327
- configurable: true,
3328
- enumerable: false,
3329
- get() {
3330
- const bound = fn.bind(this);
3331
- Object.defineProperty(this, key, {
3332
- configurable: true,
3333
- writable: true,
3334
- enumerable: true,
3335
- value: bound
3336
- });
3337
- return bound;
3338
- },
3339
- set(v) {
3340
- Object.defineProperty(this, key, {
3341
- configurable: true,
3342
- writable: true,
3343
- enumerable: true,
3344
- value: v
3345
- });
3346
- }
3347
- });
3348
- }
4395
+ //#region ../../../node_modules/.pnpm/zod@4.6.5/node_modules/zod/v4/classic/schemas.js
4396
+ function _ensureDefaultLocale() {
4397
+ if (!globalConfig.localeError) config(en_default());
4398
+ }
4399
+ function _ensureDefaultMemoizer() {
4400
+ if (!globalConfig.memoizer) config({ memoizer: memoizer() });
3349
4401
  }
3350
4402
  const ZodType = /*@__PURE__*/ $constructor("ZodType", (inst, def) => {
4403
+ _ensureDefaultLocale();
3351
4404
  $ZodType.init(inst, def);
3352
- Object.assign(inst["~standard"], { jsonSchema: {
3353
- input: createStandardJSONSchemaMethod(inst, "input"),
3354
- output: createStandardJSONSchemaMethod(inst, "output")
3355
- } });
3356
- inst.toJSONSchema = createToJSONSchemaMethod(inst, {});
3357
4405
  inst.def = def;
3358
4406
  inst.type = def.type;
3359
- Object.defineProperty(inst, "_def", { value: def });
3360
- inst.parse = (data, params) => parse(inst, data, params, { callee: inst.parse });
3361
- inst.safeParse = (data, params) => safeParse(inst, data, params);
3362
- inst.parseAsync = async (data, params) => parseAsync(inst, data, params, { callee: inst.parseAsync });
3363
- inst.safeParseAsync = async (data, params) => safeParseAsync(inst, data, params);
3364
- inst.spa = inst.safeParseAsync;
3365
- inst.encode = (data, params) => encode(inst, data, params);
3366
- inst.decode = (data, params) => decode(inst, data, params);
3367
- inst.encodeAsync = async (data, params) => encodeAsync(inst, data, params);
3368
- inst.decodeAsync = async (data, params) => decodeAsync(inst, data, params);
3369
- inst.safeEncode = (data, params) => safeEncode(inst, data, params);
3370
- inst.safeDecode = (data, params) => safeDecode(inst, data, params);
3371
- inst.safeEncodeAsync = async (data, params) => safeEncodeAsync(inst, data, params);
3372
- inst.safeDecodeAsync = async (data, params) => safeDecodeAsync(inst, data, params);
3373
- _installLazyMethods(inst, "ZodType", {
3374
- check(...chks) {
3375
- const def = this.def;
3376
- return this.clone(mergeDefs(def, { checks: [...def.checks ?? [], ...chks.map((ch) => typeof ch === "function" ? { _zod: {
3377
- check: ch,
3378
- def: { check: "custom" },
3379
- onattach: []
3380
- } } : ch)] }), { parent: true });
3381
- },
3382
- with(...chks) {
3383
- return this.check(...chks);
3384
- },
3385
- clone(def, params) {
3386
- return clone(this, def, params);
3387
- },
3388
- brand() {
3389
- return this;
3390
- },
3391
- register(reg, meta) {
3392
- reg.add(this, meta);
3393
- return this;
3394
- },
3395
- refine(check, params) {
3396
- return this.check(refine(check, params));
3397
- },
3398
- superRefine(refinement, params) {
3399
- return this.check(superRefine(refinement, params));
3400
- },
3401
- overwrite(fn) {
3402
- return this.check(/* @__PURE__ */ _overwrite(fn));
3403
- },
3404
- optional() {
3405
- return optional(this);
3406
- },
3407
- exactOptional() {
3408
- return exactOptional(this);
3409
- },
3410
- nullable() {
3411
- return nullable(this);
3412
- },
3413
- nullish() {
3414
- return optional(nullable(this));
3415
- },
3416
- nonoptional(params) {
3417
- return nonoptional(this, params);
3418
- },
3419
- array() {
3420
- return array(this);
3421
- },
3422
- or(arg) {
3423
- return union([this, arg]);
3424
- },
3425
- and(arg) {
3426
- return intersection(this, arg);
3427
- },
3428
- transform(tx) {
3429
- return pipe(this, transform(tx));
3430
- },
3431
- default(d) {
3432
- return _default(this, d);
3433
- },
3434
- prefault(d) {
3435
- return prefault(this, d);
3436
- },
3437
- catch(params) {
3438
- return _catch(this, params);
3439
- },
3440
- pipe(target) {
3441
- return pipe(this, target);
3442
- },
3443
- readonly() {
3444
- return readonly(this);
3445
- },
3446
- describe(description) {
3447
- const cl = this.clone();
3448
- globalRegistry.add(cl, { description });
3449
- return cl;
3450
- },
3451
- meta(...args) {
3452
- if (args.length === 0) return globalRegistry.get(this);
3453
- const cl = this.clone();
3454
- globalRegistry.add(cl, args[0]);
3455
- return cl;
3456
- },
3457
- isOptional() {
3458
- return this.safeParse(void 0).success;
3459
- },
3460
- isNullable() {
3461
- return this.safeParse(null).success;
3462
- },
3463
- apply(fn) {
3464
- return fn(this);
3465
- }
3466
- });
3467
- Object.defineProperty(inst, "description", {
3468
- get() {
3469
- return globalRegistry.get(inst)?.description;
3470
- },
3471
- configurable: true
3472
- });
3473
4407
  return inst;
4408
+ }, {
4409
+ check(...chks) {
4410
+ const def = this.def;
4411
+ return this.clone(mergeDefs(def, { checks: [...def.checks ?? [], ...chks.map((ch) => typeof ch === "function" ? { _zod: {
4412
+ check: ch,
4413
+ def: { check: "custom" },
4414
+ onattach: []
4415
+ } } : ch)] }), { parent: true });
4416
+ },
4417
+ with(...chks) {
4418
+ return this.check(...chks);
4419
+ },
4420
+ clone(def, params) {
4421
+ return clone(this, def, params);
4422
+ },
4423
+ brand() {
4424
+ return this;
4425
+ },
4426
+ register(reg, meta) {
4427
+ reg.add(this, meta);
4428
+ return this;
4429
+ },
4430
+ refine(check, params) {
4431
+ return this.check(refine(check, params));
4432
+ },
4433
+ superRefine(refinement, params) {
4434
+ return this.check(superRefine(refinement, params));
4435
+ },
4436
+ overwrite(fn) {
4437
+ return this.check(/* @__PURE__ */ _overwrite(fn));
4438
+ },
4439
+ optional() {
4440
+ return optional(this);
4441
+ },
4442
+ exactOptional() {
4443
+ return exactOptional(this);
4444
+ },
4445
+ nullable() {
4446
+ return nullable(this);
4447
+ },
4448
+ nullish() {
4449
+ return optional(nullable(this));
4450
+ },
4451
+ nonoptional(params) {
4452
+ return nonoptional(this, params);
4453
+ },
4454
+ array() {
4455
+ return array(this);
4456
+ },
4457
+ or(arg) {
4458
+ return union([this, arg]);
4459
+ },
4460
+ and(arg) {
4461
+ return intersection(this, arg);
4462
+ },
4463
+ transform(tx) {
4464
+ return pipe(this, transform(tx));
4465
+ },
4466
+ default(d) {
4467
+ return _default(this, d);
4468
+ },
4469
+ prefault(d) {
4470
+ return prefault(this, d);
4471
+ },
4472
+ catch(params) {
4473
+ return _catch(this, params);
4474
+ },
4475
+ pipe(target) {
4476
+ return pipe(this, target);
4477
+ },
4478
+ readonly() {
4479
+ return readonly(this);
4480
+ },
4481
+ describe(description) {
4482
+ const cl = this.clone();
4483
+ globalRegistry.add(cl, { description });
4484
+ return cl;
4485
+ },
4486
+ meta(...args) {
4487
+ if (args.length === 0) return globalRegistry.get(this);
4488
+ const cl = this.clone();
4489
+ globalRegistry.add(cl, args[0]);
4490
+ return cl;
4491
+ },
4492
+ isOptional() {
4493
+ return this.safeParse(void 0).success;
4494
+ },
4495
+ isNullable() {
4496
+ return this.safeParse(null).success;
4497
+ },
4498
+ apply(fn, ...args) {
4499
+ return args.length === 0 ? fn(this) : fn(this, ...args);
4500
+ },
4501
+ get "~standard"() {
4502
+ return hide(this, "~standard", {
4503
+ ...standardProps(this),
4504
+ jsonSchema: {
4505
+ input: createStandardJSONSchemaMethod(this, "input"),
4506
+ output: createStandardJSONSchemaMethod(this, "output")
4507
+ }
4508
+ });
4509
+ },
4510
+ set "~standard"(value) {
4511
+ own(this, "~standard", value);
4512
+ },
4513
+ parse: function _parse(data, params) {
4514
+ return parse(this, data, params, { callee: _parse });
4515
+ },
4516
+ parseAsync: async function _parseAsync(data, params) {
4517
+ return await parseAsync(this, data, params, { callee: _parseAsync });
4518
+ },
4519
+ safeParse(data, params) {
4520
+ return safeParse(this, data, params);
4521
+ },
4522
+ async safeParseAsync(data, params) {
4523
+ return safeParseAsync(this, data, params);
4524
+ },
4525
+ get spa() {
4526
+ return this?.safeParseAsync;
4527
+ },
4528
+ set spa(value) {
4529
+ own(this, "spa", value);
4530
+ },
4531
+ validate(data, params) {
4532
+ return validate(this, data, params);
4533
+ },
4534
+ validateAsync(data, params) {
4535
+ return validateAsync$1(this, data, params);
4536
+ },
4537
+ encode: function _encode(data, params) {
4538
+ return encode(this, data, params, { callee: _encode });
4539
+ },
4540
+ decode: function _decode(data, params) {
4541
+ return decode(this, data, params, { callee: _decode });
4542
+ },
4543
+ encodeAsync: async function _encodeAsync(data, params) {
4544
+ return await encodeAsync(this, data, params, { callee: _encodeAsync });
4545
+ },
4546
+ decodeAsync: async function _decodeAsync(data, params) {
4547
+ return await decodeAsync(this, data, params, { callee: _decodeAsync });
4548
+ },
4549
+ safeEncode(data, params) {
4550
+ return safeEncode(this, data, params);
4551
+ },
4552
+ safeDecode(data, params) {
4553
+ return safeDecode(this, data, params);
4554
+ },
4555
+ async safeEncodeAsync(data, params) {
4556
+ return safeEncodeAsync(this, data, params);
4557
+ },
4558
+ async safeDecodeAsync(data, params) {
4559
+ return safeDecodeAsync(this, data, params);
4560
+ },
4561
+ toJSONSchema(params) {
4562
+ return createToJSONSchemaMethod(this, {})(params);
4563
+ },
4564
+ get description() {
4565
+ return globalRegistry.get(this)?.description;
4566
+ },
4567
+ get _def() {
4568
+ return this._zod.def;
4569
+ }
3474
4570
  });
3475
4571
  /** @internal */
3476
4572
  const _ZodString = /*@__PURE__*/ $constructor("_ZodString", (inst, def) => {
3477
4573
  $ZodString.init(inst, def);
3478
4574
  ZodType.init(inst, def);
3479
4575
  inst._zod.processJSONSchema = (ctx, json, params) => stringProcessor(inst, ctx, json, params);
3480
- const bag = inst._zod.bag;
3481
- inst.format = bag.format ?? null;
3482
- inst.minLength = bag.minimum ?? null;
3483
- inst.maxLength = bag.maximum ?? null;
3484
- _installLazyMethods(inst, "_ZodString", {
3485
- regex(...args) {
3486
- return this.check(/* @__PURE__ */ _regex(...args));
3487
- },
3488
- includes(...args) {
3489
- return this.check(/* @__PURE__ */ _includes(...args));
3490
- },
3491
- startsWith(...args) {
3492
- return this.check(/* @__PURE__ */ _startsWith(...args));
3493
- },
3494
- endsWith(...args) {
3495
- return this.check(/* @__PURE__ */ _endsWith(...args));
3496
- },
3497
- min(...args) {
3498
- return this.check(/* @__PURE__ */ _minLength(...args));
3499
- },
3500
- max(...args) {
3501
- return this.check(/* @__PURE__ */ _maxLength(...args));
3502
- },
3503
- length(...args) {
3504
- return this.check(/* @__PURE__ */ _length(...args));
3505
- },
3506
- nonempty(...args) {
3507
- return this.check(/* @__PURE__ */ _minLength(1, ...args));
3508
- },
3509
- lowercase(params) {
3510
- return this.check(/* @__PURE__ */ _lowercase(params));
3511
- },
3512
- uppercase(params) {
3513
- return this.check(/* @__PURE__ */ _uppercase(params));
3514
- },
3515
- trim() {
3516
- return this.check(/* @__PURE__ */ _trim());
3517
- },
3518
- normalize(...args) {
3519
- return this.check(/* @__PURE__ */ _normalize(...args));
3520
- },
3521
- toLowerCase() {
3522
- return this.check(/* @__PURE__ */ _toLowerCase());
3523
- },
3524
- toUpperCase() {
3525
- return this.check(/* @__PURE__ */ _toUpperCase());
3526
- },
3527
- slugify() {
3528
- return this.check(/* @__PURE__ */ _slugify());
3529
- }
3530
- });
3531
- });
4576
+ }, /*@__PURE__*/ derived({
4577
+ format: (inst) => aggregateChecks(inst).format ?? null,
4578
+ minLength: (inst) => aggregateChecks(inst).minimum ?? null,
4579
+ maxLength: (inst) => aggregateChecks(inst).maximum ?? null
4580
+ }, {
4581
+ regex(...args) {
4582
+ return this.check(/* @__PURE__ */ _regex(...args));
4583
+ },
4584
+ includes(...args) {
4585
+ return this.check(/* @__PURE__ */ _includes(...args));
4586
+ },
4587
+ startsWith(...args) {
4588
+ return this.check(/* @__PURE__ */ _startsWith(...args));
4589
+ },
4590
+ endsWith(...args) {
4591
+ return this.check(/* @__PURE__ */ _endsWith(...args));
4592
+ },
4593
+ min(...args) {
4594
+ return this.check(/* @__PURE__ */ _minLength(...args));
4595
+ },
4596
+ max(...args) {
4597
+ return this.check(/* @__PURE__ */ _maxLength(...args));
4598
+ },
4599
+ length(...args) {
4600
+ return this.check(/* @__PURE__ */ _length(...args));
4601
+ },
4602
+ nonempty(...args) {
4603
+ return this.check(/* @__PURE__ */ _minLength(1, ...args));
4604
+ },
4605
+ lowercase(params) {
4606
+ return this.check(/* @__PURE__ */ _lowercase(params));
4607
+ },
4608
+ uppercase(params) {
4609
+ return this.check(/* @__PURE__ */ _uppercase(params));
4610
+ },
4611
+ trim() {
4612
+ return this.check(/* @__PURE__ */ _trim());
4613
+ },
4614
+ normalize(...args) {
4615
+ return this.check(/* @__PURE__ */ _normalize(...args));
4616
+ },
4617
+ toLowerCase() {
4618
+ return this.check(/* @__PURE__ */ _toLowerCase());
4619
+ },
4620
+ toUpperCase() {
4621
+ return this.check(/* @__PURE__ */ _toUpperCase());
4622
+ },
4623
+ slugify() {
4624
+ return this.check(/* @__PURE__ */ _slugify());
4625
+ }
4626
+ }));
3532
4627
  const ZodString = /*@__PURE__*/ $constructor("ZodString", (inst, def) => {
3533
4628
  $ZodString.init(inst, def);
3534
4629
  _ZodString.init(inst, def);
3535
- inst.email = (params) => inst.check(/* @__PURE__ */ _email(ZodEmail, params));
3536
- inst.url = (params) => inst.check(/* @__PURE__ */ _url(ZodURL, params));
3537
- inst.jwt = (params) => inst.check(/* @__PURE__ */ _jwt(ZodJWT, params));
3538
- inst.emoji = (params) => inst.check(/* @__PURE__ */ _emoji(ZodEmoji, params));
3539
- inst.guid = (params) => inst.check(/* @__PURE__ */ _guid(ZodGUID, params));
3540
- inst.uuid = (params) => inst.check(/* @__PURE__ */ _uuid(ZodUUID, params));
3541
- inst.uuidv4 = (params) => inst.check(/* @__PURE__ */ _uuidv4(ZodUUID, params));
3542
- inst.uuidv6 = (params) => inst.check(/* @__PURE__ */ _uuidv6(ZodUUID, params));
3543
- inst.uuidv7 = (params) => inst.check(/* @__PURE__ */ _uuidv7(ZodUUID, params));
3544
- inst.nanoid = (params) => inst.check(/* @__PURE__ */ _nanoid(ZodNanoID, params));
3545
- inst.guid = (params) => inst.check(/* @__PURE__ */ _guid(ZodGUID, params));
3546
- inst.cuid = (params) => inst.check(/* @__PURE__ */ _cuid(ZodCUID, params));
3547
- inst.cuid2 = (params) => inst.check(/* @__PURE__ */ _cuid2(ZodCUID2, params));
3548
- inst.ulid = (params) => inst.check(/* @__PURE__ */ _ulid(ZodULID, params));
3549
- inst.base64 = (params) => inst.check(/* @__PURE__ */ _base64(ZodBase64, params));
3550
- inst.base64url = (params) => inst.check(/* @__PURE__ */ _base64url(ZodBase64URL, params));
3551
- inst.xid = (params) => inst.check(/* @__PURE__ */ _xid(ZodXID, params));
3552
- inst.ksuid = (params) => inst.check(/* @__PURE__ */ _ksuid(ZodKSUID, params));
3553
- inst.ipv4 = (params) => inst.check(/* @__PURE__ */ _ipv4(ZodIPv4, params));
3554
- inst.ipv6 = (params) => inst.check(/* @__PURE__ */ _ipv6(ZodIPv6, params));
3555
- inst.cidrv4 = (params) => inst.check(/* @__PURE__ */ _cidrv4(ZodCIDRv4, params));
3556
- inst.cidrv6 = (params) => inst.check(/* @__PURE__ */ _cidrv6(ZodCIDRv6, params));
3557
- inst.e164 = (params) => inst.check(/* @__PURE__ */ _e164(ZodE164, params));
3558
- inst.datetime = (params) => inst.check(datetime(params));
3559
- inst.date = (params) => inst.check(date(params));
3560
- inst.time = (params) => inst.check(time(params));
3561
- inst.duration = (params) => inst.check(duration(params));
4630
+ }, {
4631
+ email(params) {
4632
+ return this.check(/* @__PURE__ */ _email(ZodEmail, params));
4633
+ },
4634
+ url(params) {
4635
+ return this.check(/* @__PURE__ */ _url(ZodURL, params));
4636
+ },
4637
+ jwt(params) {
4638
+ return this.check(/* @__PURE__ */ _jwt(ZodJWT, params));
4639
+ },
4640
+ emoji(params) {
4641
+ return this.check(/* @__PURE__ */ _emoji(ZodEmoji, params));
4642
+ },
4643
+ guid(params) {
4644
+ return this.check(/* @__PURE__ */ _guid(ZodGUID, params));
4645
+ },
4646
+ uuid(params) {
4647
+ return this.check(/* @__PURE__ */ _uuid(ZodUUID, params));
4648
+ },
4649
+ uuidv4(params) {
4650
+ return this.check(/* @__PURE__ */ _uuidv4(ZodUUID, params));
4651
+ },
4652
+ uuidv6(params) {
4653
+ return this.check(/* @__PURE__ */ _uuidv6(ZodUUID, params));
4654
+ },
4655
+ uuidv7(params) {
4656
+ return this.check(/* @__PURE__ */ _uuidv7(ZodUUID, params));
4657
+ },
4658
+ nanoid(params) {
4659
+ return this.check(/* @__PURE__ */ _nanoid(ZodNanoID, params));
4660
+ },
4661
+ cuid(params) {
4662
+ return this.check(/* @__PURE__ */ _cuid(ZodCUID, params));
4663
+ },
4664
+ cuid2(params) {
4665
+ return this.check(/* @__PURE__ */ _cuid2(ZodCUID2, params));
4666
+ },
4667
+ ulid(params) {
4668
+ return this.check(/* @__PURE__ */ _ulid(ZodULID, params));
4669
+ },
4670
+ base64(params) {
4671
+ return this.check(/* @__PURE__ */ _base64(ZodBase64, params));
4672
+ },
4673
+ base64url(params) {
4674
+ return this.check(/* @__PURE__ */ _base64url(ZodBase64URL, params));
4675
+ },
4676
+ xid(params) {
4677
+ return this.check(/* @__PURE__ */ _xid(ZodXID, params));
4678
+ },
4679
+ ksuid(params) {
4680
+ return this.check(/* @__PURE__ */ _ksuid(ZodKSUID, params));
4681
+ },
4682
+ ipv4(params) {
4683
+ return this.check(/* @__PURE__ */ _ipv4(ZodIPv4, params));
4684
+ },
4685
+ ipv6(params) {
4686
+ return this.check(/* @__PURE__ */ _ipv6(ZodIPv6, params));
4687
+ },
4688
+ cidrv4(params) {
4689
+ return this.check(/* @__PURE__ */ _cidrv4(ZodCIDRv4, params));
4690
+ },
4691
+ cidrv6(params) {
4692
+ return this.check(/* @__PURE__ */ _cidrv6(ZodCIDRv6, params));
4693
+ },
4694
+ e164(params) {
4695
+ return this.check(/* @__PURE__ */ _e164(ZodE164, params));
4696
+ },
4697
+ datetime(params) {
4698
+ return this.check(/* @__PURE__ */ _isoDateTime(ZodISODateTime, params));
4699
+ },
4700
+ date(params) {
4701
+ return this.check(/* @__PURE__ */ _isoDate(ZodISODate, params));
4702
+ },
4703
+ time(params) {
4704
+ return this.check(/* @__PURE__ */ _isoTime(ZodISOTime, params));
4705
+ },
4706
+ duration(params) {
4707
+ return this.check(/* @__PURE__ */ _isoDuration(ZodISODuration, params));
4708
+ }
3562
4709
  });
3563
4710
  function string(params) {
3564
4711
  return /* @__PURE__ */ _string(ZodString, params);
@@ -3567,6 +4714,22 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
3567
4714
  $ZodStringFormat.init(inst, def);
3568
4715
  _ZodString.init(inst, def);
3569
4716
  });
4717
+ const ZodISODateTime = /*@__PURE__*/ $constructor("ZodISODateTime", (inst, def) => {
4718
+ $ZodISODateTime.init(inst, def);
4719
+ ZodStringFormat.init(inst, def);
4720
+ });
4721
+ const ZodISODate = /*@__PURE__*/ $constructor("ZodISODate", (inst, def) => {
4722
+ $ZodISODate.init(inst, def);
4723
+ ZodStringFormat.init(inst, def);
4724
+ });
4725
+ const ZodISOTime = /*@__PURE__*/ $constructor("ZodISOTime", (inst, def) => {
4726
+ $ZodISOTime.init(inst, def);
4727
+ ZodStringFormat.init(inst, def);
4728
+ });
4729
+ const ZodISODuration = /*@__PURE__*/ $constructor("ZodISODuration", (inst, def) => {
4730
+ $ZodISODuration.init(inst, def);
4731
+ ZodStringFormat.init(inst, def);
4732
+ });
3570
4733
  const ZodEmail = /*@__PURE__*/ $constructor("ZodEmail", (inst, def) => {
3571
4734
  $ZodEmail.init(inst, def);
3572
4735
  ZodStringFormat.init(inst, def);
@@ -3652,60 +4815,68 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
3652
4815
  $ZodNumber.init(inst, def);
3653
4816
  ZodType.init(inst, def);
3654
4817
  inst._zod.processJSONSchema = (ctx, json, params) => numberProcessor(inst, ctx, json, params);
3655
- _installLazyMethods(inst, "ZodNumber", {
3656
- gt(value, params) {
3657
- return this.check(/* @__PURE__ */ _gt(value, params));
3658
- },
3659
- gte(value, params) {
3660
- return this.check(/* @__PURE__ */ _gte(value, params));
3661
- },
3662
- min(value, params) {
3663
- return this.check(/* @__PURE__ */ _gte(value, params));
3664
- },
3665
- lt(value, params) {
3666
- return this.check(/* @__PURE__ */ _lt(value, params));
3667
- },
3668
- lte(value, params) {
3669
- return this.check(/* @__PURE__ */ _lte(value, params));
3670
- },
3671
- max(value, params) {
3672
- return this.check(/* @__PURE__ */ _lte(value, params));
3673
- },
3674
- int(params) {
3675
- return this.check(int(params));
3676
- },
3677
- safe(params) {
3678
- return this.check(int(params));
3679
- },
3680
- positive(params) {
3681
- return this.check(/* @__PURE__ */ _gt(0, params));
3682
- },
3683
- nonnegative(params) {
3684
- return this.check(/* @__PURE__ */ _gte(0, params));
3685
- },
3686
- negative(params) {
3687
- return this.check(/* @__PURE__ */ _lt(0, params));
3688
- },
3689
- nonpositive(params) {
3690
- return this.check(/* @__PURE__ */ _lte(0, params));
3691
- },
3692
- multipleOf(value, params) {
3693
- return this.check(/* @__PURE__ */ _multipleOf(value, params));
3694
- },
3695
- step(value, params) {
3696
- return this.check(/* @__PURE__ */ _multipleOf(value, params));
3697
- },
3698
- finite() {
3699
- return this;
3700
- }
3701
- });
3702
- const bag = inst._zod.bag;
3703
- inst.minValue = Math.max(bag.minimum ?? Number.NEGATIVE_INFINITY, bag.exclusiveMinimum ?? Number.NEGATIVE_INFINITY) ?? null;
3704
- inst.maxValue = Math.min(bag.maximum ?? Number.POSITIVE_INFINITY, bag.exclusiveMaximum ?? Number.POSITIVE_INFINITY) ?? null;
3705
- inst.isInt = (bag.format ?? "").includes("int") || Number.isSafeInteger(bag.multipleOf ?? .5);
3706
4818
  inst.isFinite = true;
3707
- inst.format = bag.format ?? null;
3708
- });
4819
+ }, /*@__PURE__*/ derived({
4820
+ minValue: (inst) => {
4821
+ const { minimum, exclusiveMinimum } = aggregateChecks(inst);
4822
+ return Math.max(minimum ?? Number.NEGATIVE_INFINITY, exclusiveMinimum ?? Number.NEGATIVE_INFINITY);
4823
+ },
4824
+ maxValue: (inst) => {
4825
+ const { maximum, exclusiveMaximum } = aggregateChecks(inst);
4826
+ return Math.min(maximum ?? Number.POSITIVE_INFINITY, exclusiveMaximum ?? Number.POSITIVE_INFINITY);
4827
+ },
4828
+ isInt: (inst) => {
4829
+ const { isInt, multipleOf } = aggregateChecks(inst);
4830
+ return !!isInt || !!multipleOf?.some(Number.isSafeInteger);
4831
+ },
4832
+ format: (inst) => aggregateChecks(inst).format ?? null
4833
+ }, {
4834
+ gt(value, params) {
4835
+ return this.check(/* @__PURE__ */ _gt(value, params));
4836
+ },
4837
+ gte(value, params) {
4838
+ return this.check(/* @__PURE__ */ _gte(value, params));
4839
+ },
4840
+ min(value, params) {
4841
+ return this.check(/* @__PURE__ */ _gte(value, params));
4842
+ },
4843
+ lt(value, params) {
4844
+ return this.check(/* @__PURE__ */ _lt(value, params));
4845
+ },
4846
+ lte(value, params) {
4847
+ return this.check(/* @__PURE__ */ _lte(value, params));
4848
+ },
4849
+ max(value, params) {
4850
+ return this.check(/* @__PURE__ */ _lte(value, params));
4851
+ },
4852
+ int(params) {
4853
+ return this.check(int(params));
4854
+ },
4855
+ safe(params) {
4856
+ return this.check(int(params));
4857
+ },
4858
+ positive(params) {
4859
+ return this.check(/* @__PURE__ */ _gt(0, params));
4860
+ },
4861
+ nonnegative(params) {
4862
+ return this.check(/* @__PURE__ */ _gte(0, params));
4863
+ },
4864
+ negative(params) {
4865
+ return this.check(/* @__PURE__ */ _lt(0, params));
4866
+ },
4867
+ nonpositive(params) {
4868
+ return this.check(/* @__PURE__ */ _lte(0, params));
4869
+ },
4870
+ multipleOf(value, params) {
4871
+ return this.check(/* @__PURE__ */ _multipleOf(value, params));
4872
+ },
4873
+ step(value, params) {
4874
+ return this.check(/* @__PURE__ */ _multipleOf(value, params));
4875
+ },
4876
+ finite() {
4877
+ return this;
4878
+ }
4879
+ }));
3709
4880
  function number(params) {
3710
4881
  return /* @__PURE__ */ _number(ZodNumber, params);
3711
4882
  }
@@ -3749,94 +4920,80 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
3749
4920
  return /* @__PURE__ */ _never(ZodNever, params);
3750
4921
  }
3751
4922
  const ZodArray = /*@__PURE__*/ $constructor("ZodArray", (inst, def) => {
4923
+ _ensureDefaultMemoizer();
3752
4924
  $ZodArray.init(inst, def);
3753
4925
  ZodType.init(inst, def);
3754
4926
  inst._zod.processJSONSchema = (ctx, json, params) => arrayProcessor(inst, ctx, json, params);
3755
4927
  inst.element = def.element;
3756
- _installLazyMethods(inst, "ZodArray", {
3757
- min(n, params) {
3758
- return this.check(/* @__PURE__ */ _minLength(n, params));
3759
- },
3760
- nonempty(params) {
3761
- return this.check(/* @__PURE__ */ _minLength(1, params));
3762
- },
3763
- max(n, params) {
3764
- return this.check(/* @__PURE__ */ _maxLength(n, params));
3765
- },
3766
- length(n, params) {
3767
- return this.check(/* @__PURE__ */ _length(n, params));
3768
- },
3769
- unwrap() {
3770
- return this.element;
3771
- }
3772
- });
4928
+ }, {
4929
+ min(n, params) {
4930
+ return this.check(/* @__PURE__ */ _minLength(n, params));
4931
+ },
4932
+ nonempty(params) {
4933
+ return this.check(/* @__PURE__ */ _minLength(1, params));
4934
+ },
4935
+ max(n, params) {
4936
+ return this.check(/* @__PURE__ */ _maxLength(n, params));
4937
+ },
4938
+ length(n, params) {
4939
+ return this.check(/* @__PURE__ */ _length(n, params));
4940
+ },
4941
+ unwrap() {
4942
+ return this.element;
4943
+ }
3773
4944
  });
3774
4945
  function array(element, params) {
3775
4946
  return /* @__PURE__ */ _array(ZodArray, element, params);
3776
4947
  }
3777
4948
  const ZodObject = /*@__PURE__*/ $constructor("ZodObject", (inst, def) => {
4949
+ _ensureDefaultMemoizer();
3778
4950
  $ZodObjectJIT.init(inst, def);
3779
4951
  ZodType.init(inst, def);
3780
4952
  inst._zod.processJSONSchema = (ctx, json, params) => objectProcessor(inst, ctx, json, params);
3781
- defineLazy(inst, "shape", () => {
3782
- return def.shape;
3783
- });
3784
- _installLazyMethods(inst, "ZodObject", {
3785
- keyof() {
3786
- return _enum(Object.keys(this._zod.def.shape));
3787
- },
3788
- catchall(catchall) {
3789
- return this.clone({
3790
- ...this._zod.def,
3791
- catchall
3792
- });
3793
- },
3794
- passthrough() {
3795
- return this.clone({
3796
- ...this._zod.def,
3797
- catchall: unknown()
3798
- });
3799
- },
3800
- loose() {
3801
- return this.clone({
3802
- ...this._zod.def,
3803
- catchall: unknown()
3804
- });
3805
- },
3806
- strict() {
3807
- return this.clone({
3808
- ...this._zod.def,
3809
- catchall: never()
3810
- });
3811
- },
3812
- strip() {
3813
- return this.clone({
3814
- ...this._zod.def,
3815
- catchall: void 0
3816
- });
3817
- },
3818
- extend(incoming) {
3819
- return extend(this, incoming);
3820
- },
3821
- safeExtend(incoming) {
3822
- return safeExtend(this, incoming);
3823
- },
3824
- merge(other) {
3825
- return merge(this, other);
3826
- },
3827
- pick(mask) {
3828
- return pick(this, mask);
3829
- },
3830
- omit(mask) {
3831
- return omit(this, mask);
3832
- },
3833
- partial(...args) {
3834
- return partial(ZodOptional, this, args[0]);
3835
- },
3836
- required(...args) {
3837
- return required(ZodNonOptional, this, args[0]);
3838
- }
3839
- });
4953
+ installLazyProp(inst, "shape", (self) => self._zod.def.shape, false);
4954
+ }, {
4955
+ keyof() {
4956
+ return _enum(Object.keys(this._zod.def.shape));
4957
+ },
4958
+ catchall(catchall) {
4959
+ return this.clone(mergeDefs(this._zod.def, { catchall }));
4960
+ },
4961
+ passthrough() {
4962
+ return this.clone(mergeDefs(this._zod.def, { catchall: unknown() }));
4963
+ },
4964
+ loose() {
4965
+ return this.clone(mergeDefs(this._zod.def, { catchall: unknown() }));
4966
+ },
4967
+ strict() {
4968
+ return this.clone(mergeDefs(this._zod.def, { catchall: never() }));
4969
+ },
4970
+ strip() {
4971
+ return this.clone(mergeDefs(this._zod.def, { catchall: void 0 }));
4972
+ },
4973
+ extend(incoming) {
4974
+ return extend(this, incoming);
4975
+ },
4976
+ safeExtend(incoming) {
4977
+ return safeExtend(this, incoming);
4978
+ },
4979
+ merge(other) {
4980
+ return merge(this, other);
4981
+ },
4982
+ pick(mask) {
4983
+ return pick(this, mask);
4984
+ },
4985
+ omit(mask) {
4986
+ return omit(this, mask);
4987
+ },
4988
+ partial(...args) {
4989
+ return partial(ZodOptional, this, args[0]);
4990
+ },
4991
+ exactPartial(...args) {
4992
+ return partial(ZodExactOptional, this, args[0], "exactPartial");
4993
+ },
4994
+ required(...args) {
4995
+ return required(ZodNonOptional, this, args[0]);
4996
+ }
3840
4997
  });
3841
4998
  function object(shape, params) {
3842
4999
  const def = {
@@ -3876,7 +5033,7 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
3876
5033
  ZodType.init(inst, def);
3877
5034
  inst._zod.processJSONSchema = (ctx, json, params) => enumProcessor(inst, ctx, json, params);
3878
5035
  inst.enum = def.entries;
3879
- inst.options = Object.values(def.entries);
5036
+ inst.options = [...inst._zod.values];
3880
5037
  const keys = new Set(Object.keys(def.entries));
3881
5038
  inst.extract = (values, params) => {
3882
5039
  const newEntries = {};
@@ -3910,6 +5067,7 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
3910
5067
  });
3911
5068
  }
3912
5069
  const ZodTransform = /*@__PURE__*/ $constructor("ZodTransform", (inst, def) => {
5070
+ _ensureDefaultMemoizer();
3913
5071
  $ZodTransform.init(inst, def);
3914
5072
  ZodType.init(inst, def);
3915
5073
  inst._zod.processJSONSchema = (ctx, json, params) => transformProcessor(inst, ctx, json, params);
@@ -3921,7 +5079,7 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
3921
5079
  const _issue = issue$1;
3922
5080
  if (_issue.fatal) _issue.continue = false;
3923
5081
  _issue.code ?? (_issue.code = "custom");
3924
- _issue.input ?? (_issue.input = payload.value);
5082
+ if (!("input" in _issue)) _issue.input = payload.value;
3925
5083
  _issue.inst ?? (_issue.inst = inst);
3926
5084
  payload.issues.push(issue(_issue));
3927
5085
  }
@@ -3929,11 +5087,9 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
3929
5087
  const output = def.transform(payload.value, payload);
3930
5088
  if (output instanceof Promise) return output.then((output) => {
3931
5089
  payload.value = output;
3932
- payload.fallback = true;
3933
5090
  return payload;
3934
5091
  });
3935
5092
  payload.value = output;
3936
- payload.fallback = true;
3937
5093
  return payload;
3938
5094
  };
3939
5095
  });
@@ -4034,7 +5190,7 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
4034
5190
  return new ZodCatch({
4035
5191
  type: "catch",
4036
5192
  innerType,
4037
- catchValue: typeof catchValue === "function" ? catchValue : () => catchValue
5193
+ catchValue: typeof catchValue === "function" ? catchValue : constantCatch(catchValue)
4038
5194
  });
4039
5195
  }
4040
5196
  const ZodPipe = /*@__PURE__*/ $constructor("ZodPipe", (inst, def) => {
@@ -4109,7 +5265,13 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
4109
5265
  *
4110
5266
  * Carries BOTH members on purpose: the host's validator moved from `codec.schema.parse` (0.1.5) to
4111
5267
  * `codec.create()` (0.1.6), and each generation checks only its own. One shape therefore serves
4112
- * either host — the same "one shape satisfies two revisions" trick the job plugin's `strict()` uses.
5268
+ * either host.
5269
+ *
5270
+ * Kept LOCAL — a two-line mirror of the base kit's `strictCodec`, not a runtime call — on purpose:
5271
+ * the Remote face is built at module load and must exist even when the base cannot be loaded at all,
5272
+ * so its construction may not depend on a runtime `import()` of the base. This is the "mirrors a
5273
+ * convention, so changing it takes a plugin release" side of the rule in the root AGENTS.md; the
5274
+ * shared, fixable-by-a-base-release code lives in `@avantf/dsh-plugin-base`'s kit.
4113
5275
  */
4114
5276
  function strict(schema, typeSymbol) {
4115
5277
  return {
@@ -4495,6 +5657,25 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
4495
5657
  * resolved from the platform module table.
4496
5658
  */
4497
5659
  const h = react.createElement;
5660
+ /**
5661
+ * The host's answer for one source string, NORMALIZED at the boundary that receives it.
5662
+ *
5663
+ * The shape comes from the contract (no hand-mirror to drift), and the three list fields are read
5664
+ * through {@link normalizeClassification} rather than assumed: this object is dereferenced inside a
5665
+ * render body (`info.paths.length`, `info.missing.join`), and a field the host stopped sending would
5666
+ * throw there — which the shell renders as an empty panel with no retry for the session.
5667
+ */
5668
+ function normalizeClassification(value) {
5669
+ if (value === null || value === void 0) return null;
5670
+ const list = (candidate) => Array.isArray(candidate) ? candidate.filter((entry) => typeof entry === "string") : [];
5671
+ return {
5672
+ kind: value.kind,
5673
+ paths: list(value.paths),
5674
+ missing: list(value.missing),
5675
+ reasons: list(value.reasons),
5676
+ files: typeof value.files === "number" ? value.files : 0
5677
+ };
5678
+ }
4498
5679
  const NOT_MOUNTED = "avantfMem Remote 未挂载:本插件自带的 typert contribution 挂载失败(详见控制台错误),暂时无法读取数据。";
4499
5680
  /** One 记忆 tab; the host `admin` list default is the same. */
4500
5681
  const MEMORY_PAGE_SIZE = 50;
@@ -5478,7 +6659,7 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
5478
6659
  setSourceInfo(null);
5479
6660
  const timer = setTimeout(() => {
5480
6661
  callRemote("kb.classifySource", remote.classifySource({ text: sourceText })).then((outcome) => {
5481
- if (outcome.ok) setSourceInfo(outcome.value ?? null);
6662
+ if (outcome.ok) setSourceInfo(normalizeClassification(outcome.value));
5482
6663
  else {
5483
6664
  setSourceInfo(null);
5484
6665
  setError(outcome.error);