@agentconnect.md/daemon 1.0.0-rc.23 → 1.0.0-rc.231

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 (55) hide show
  1. package/dist/acp-host-CXUQ91Gh.js +10642 -0
  2. package/dist/acp-host-CXUQ91Gh.js.map +1 -0
  3. package/dist/agent-list-BAjZvFsO.js +21 -0
  4. package/dist/agent-list-BAjZvFsO.js.map +1 -0
  5. package/dist/bridge-DXIVgEzf.js +726 -0
  6. package/dist/bridge-DXIVgEzf.js.map +1 -0
  7. package/dist/chat-Di5QFvjw.js +79 -0
  8. package/dist/chat-Di5QFvjw.js.map +1 -0
  9. package/dist/commander-B5QVEFzH.js +2965 -0
  10. package/dist/commander-B5QVEFzH.js.map +1 -0
  11. package/dist/esm-DrGCKNjx.js +1516 -0
  12. package/dist/esm-DrGCKNjx.js.map +1 -0
  13. package/dist/execAsync-C-9b-eWN.js +12 -0
  14. package/dist/execAsync-C-9b-eWN.js.map +1 -0
  15. package/dist/getMachineId-bsd-CfqSzACM.js +29 -0
  16. package/dist/getMachineId-bsd-CfqSzACM.js.map +1 -0
  17. package/dist/getMachineId-darwin-CDKafrUs.js +26 -0
  18. package/dist/getMachineId-darwin-CDKafrUs.js.map +1 -0
  19. package/dist/getMachineId-linux-DG3AvXtg.js +22 -0
  20. package/dist/getMachineId-linux-DG3AvXtg.js.map +1 -0
  21. package/dist/getMachineId-unsupported-BIPpTXqb.js +17 -0
  22. package/dist/getMachineId-unsupported-BIPpTXqb.js.map +1 -0
  23. package/dist/getMachineId-win-DNO3uByP.js +28 -0
  24. package/dist/getMachineId-win-DNO3uByP.js.map +1 -0
  25. package/dist/git-credential-BfkyzKn2.js +99 -0
  26. package/dist/git-credential-BfkyzKn2.js.map +1 -0
  27. package/dist/gitcred-server-Dcsq6QJe.js +236 -0
  28. package/dist/gitcred-server-Dcsq6QJe.js.map +1 -0
  29. package/dist/index.js +67364 -79992
  30. package/dist/index.js.map +1 -1
  31. package/dist/load-agents-tb8Rcwan.js +356 -0
  32. package/dist/load-agents-tb8Rcwan.js.map +1 -0
  33. package/dist/lock-CA9Bm8_s.js +66 -0
  34. package/dist/lock-CA9Bm8_s.js.map +1 -0
  35. package/dist/login-8pfSiMc2.js +229 -0
  36. package/dist/login-8pfSiMc2.js.map +1 -0
  37. package/dist/paths-CcRUjFjy.js +2 -0
  38. package/dist/paths-DEcUO8lC.js +43 -0
  39. package/dist/paths-DEcUO8lC.js.map +1 -0
  40. package/dist/rolldown-runtime-CE-6LUnI.js +44 -0
  41. package/dist/run-foreground-Cg2ewYjn.js +138640 -0
  42. package/dist/run-foreground-Cg2ewYjn.js.map +1 -0
  43. package/dist/run-foreground-DxSBKNXU.js +2 -0
  44. package/dist/schemas-CQkO9hC5.js +4382 -0
  45. package/dist/schemas-CQkO9hC5.js.map +1 -0
  46. package/dist/service-6w0WKhdx.js +2 -0
  47. package/dist/service-BQVw7wbz.js +245 -0
  48. package/dist/service-BQVw7wbz.js.map +1 -0
  49. package/dist/src-DDtlVutj.js +811 -0
  50. package/dist/src-DDtlVutj.js.map +1 -0
  51. package/dist/stdio-CwrB9yrX.js +9218 -0
  52. package/dist/stdio-CwrB9yrX.js.map +1 -0
  53. package/dist/version-DGaRXjBK.js +7 -0
  54. package/dist/version-DGaRXjBK.js.map +1 -0
  55. package/package.json +2 -1
@@ -0,0 +1,4382 @@
1
+ //#region ../../node_modules/.pnpm/zod@4.4.3/node_modules/zod/v4/core/core.js
2
+ var _a$1;
3
+ /** A special constant with type `never` */
4
+ const NEVER = /*@__PURE__*/ Object.freeze({ status: "aborted" });
5
+ function $constructor(name, initializer, params) {
6
+ function init(inst, def) {
7
+ if (!inst._zod) Object.defineProperty(inst, "_zod", {
8
+ value: {
9
+ def,
10
+ constr: _,
11
+ traits: /* @__PURE__ */ new Set()
12
+ },
13
+ enumerable: false
14
+ });
15
+ if (inst._zod.traits.has(name)) return;
16
+ inst._zod.traits.add(name);
17
+ initializer(inst, def);
18
+ const proto = _.prototype;
19
+ const keys = Object.keys(proto);
20
+ for (let i = 0; i < keys.length; i++) {
21
+ const k = keys[i];
22
+ if (!(k in inst)) inst[k] = proto[k].bind(inst);
23
+ }
24
+ }
25
+ const Parent = params?.Parent ?? Object;
26
+ class Definition extends Parent {}
27
+ Object.defineProperty(Definition, "name", { value: name });
28
+ function _(def) {
29
+ var _a;
30
+ const inst = params?.Parent ? new Definition() : this;
31
+ init(inst, def);
32
+ (_a = inst._zod).deferred ?? (_a.deferred = []);
33
+ for (const fn of inst._zod.deferred) fn();
34
+ return inst;
35
+ }
36
+ Object.defineProperty(_, "init", { value: init });
37
+ Object.defineProperty(_, Symbol.hasInstance, { value: (inst) => {
38
+ if (params?.Parent && inst instanceof params.Parent) return true;
39
+ return inst?._zod?.traits?.has(name);
40
+ } });
41
+ Object.defineProperty(_, "name", { value: name });
42
+ return _;
43
+ }
44
+ var $ZodAsyncError = class extends Error {
45
+ constructor() {
46
+ super(`Encountered Promise during synchronous parse. Use .parseAsync() instead.`);
47
+ }
48
+ };
49
+ var $ZodEncodeError = class extends Error {
50
+ constructor(name) {
51
+ super(`Encountered unidirectional transform during encode: ${name}`);
52
+ this.name = "ZodEncodeError";
53
+ }
54
+ };
55
+ (_a$1 = globalThis).__zod_globalConfig ?? (_a$1.__zod_globalConfig = {});
56
+ const globalConfig = globalThis.__zod_globalConfig;
57
+ function config(newConfig) {
58
+ if (newConfig) Object.assign(globalConfig, newConfig);
59
+ return globalConfig;
60
+ }
61
+ //#endregion
62
+ //#region ../../node_modules/.pnpm/zod@4.4.3/node_modules/zod/v4/core/util.js
63
+ function getEnumValues(entries) {
64
+ const numericValues = Object.values(entries).filter((v) => typeof v === "number");
65
+ return Object.entries(entries).filter(([k, _]) => numericValues.indexOf(+k) === -1).map(([_, v]) => v);
66
+ }
67
+ function jsonStringifyReplacer(_, value) {
68
+ if (typeof value === "bigint") return value.toString();
69
+ return value;
70
+ }
71
+ function cached(getter) {
72
+ return { get value() {
73
+ {
74
+ const value = getter();
75
+ Object.defineProperty(this, "value", { value });
76
+ return value;
77
+ }
78
+ throw new Error("cached value already set");
79
+ } };
80
+ }
81
+ function nullish(input) {
82
+ return input === null || input === void 0;
83
+ }
84
+ function cleanRegex(source) {
85
+ const start = source.startsWith("^") ? 1 : 0;
86
+ const end = source.endsWith("$") ? source.length - 1 : source.length;
87
+ return source.slice(start, end);
88
+ }
89
+ function floatSafeRemainder(val, step) {
90
+ const ratio = val / step;
91
+ const roundedRatio = Math.round(ratio);
92
+ const tolerance = Number.EPSILON * Math.max(Math.abs(ratio), 1);
93
+ if (Math.abs(ratio - roundedRatio) < tolerance) return 0;
94
+ return ratio - roundedRatio;
95
+ }
96
+ const EVALUATING = /* @__PURE__*/ Symbol("evaluating");
97
+ function defineLazy(object, key, getter) {
98
+ let value = void 0;
99
+ Object.defineProperty(object, key, {
100
+ get() {
101
+ if (value === EVALUATING) return;
102
+ if (value === void 0) {
103
+ value = EVALUATING;
104
+ value = getter();
105
+ }
106
+ return value;
107
+ },
108
+ set(v) {
109
+ Object.defineProperty(object, key, { value: v });
110
+ },
111
+ configurable: true
112
+ });
113
+ }
114
+ function assignProp(target, prop, value) {
115
+ Object.defineProperty(target, prop, {
116
+ value,
117
+ writable: true,
118
+ enumerable: true,
119
+ configurable: true
120
+ });
121
+ }
122
+ function mergeDefs(...defs) {
123
+ const mergedDescriptors = {};
124
+ for (const def of defs) {
125
+ const descriptors = Object.getOwnPropertyDescriptors(def);
126
+ Object.assign(mergedDescriptors, descriptors);
127
+ }
128
+ return Object.defineProperties({}, mergedDescriptors);
129
+ }
130
+ function esc(str) {
131
+ return JSON.stringify(str);
132
+ }
133
+ function slugify(input) {
134
+ return input.toLowerCase().trim().replace(/[^\w\s-]/g, "").replace(/[\s_-]+/g, "-").replace(/^-+|-+$/g, "");
135
+ }
136
+ const captureStackTrace = "captureStackTrace" in Error ? Error.captureStackTrace : (..._args) => {};
137
+ function isObject(data) {
138
+ return typeof data === "object" && data !== null && !Array.isArray(data);
139
+ }
140
+ const allowsEval = /* @__PURE__*/ cached(() => {
141
+ if (globalConfig.jitless) return false;
142
+ if (typeof navigator !== "undefined" && navigator?.userAgent?.includes("Cloudflare")) return false;
143
+ try {
144
+ new Function("");
145
+ return true;
146
+ } catch (_) {
147
+ return false;
148
+ }
149
+ });
150
+ function isPlainObject(o) {
151
+ if (isObject(o) === false) return false;
152
+ const ctor = o.constructor;
153
+ if (ctor === void 0) return true;
154
+ if (typeof ctor !== "function") return true;
155
+ const prot = ctor.prototype;
156
+ if (isObject(prot) === false) return false;
157
+ if (Object.prototype.hasOwnProperty.call(prot, "isPrototypeOf") === false) return false;
158
+ return true;
159
+ }
160
+ function shallowClone(o) {
161
+ if (isPlainObject(o)) return { ...o };
162
+ if (Array.isArray(o)) return [...o];
163
+ if (o instanceof Map) return new Map(o);
164
+ if (o instanceof Set) return new Set(o);
165
+ return o;
166
+ }
167
+ const propertyKeyTypes = /* @__PURE__*/ new Set([
168
+ "string",
169
+ "number",
170
+ "symbol"
171
+ ]);
172
+ function escapeRegex(str) {
173
+ return str.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
174
+ }
175
+ function clone(inst, def, params) {
176
+ const cl = new inst._zod.constr(def ?? inst._zod.def);
177
+ if (!def || params?.parent) cl._zod.parent = inst;
178
+ return cl;
179
+ }
180
+ function normalizeParams(_params) {
181
+ const params = _params;
182
+ if (!params) return {};
183
+ if (typeof params === "string") return { error: () => params };
184
+ if (params?.message !== void 0) {
185
+ if (params?.error !== void 0) throw new Error("Cannot specify both `message` and `error` params");
186
+ params.error = params.message;
187
+ }
188
+ delete params.message;
189
+ if (typeof params.error === "string") return {
190
+ ...params,
191
+ error: () => params.error
192
+ };
193
+ return params;
194
+ }
195
+ function optionalKeys(shape) {
196
+ return Object.keys(shape).filter((k) => {
197
+ return shape[k]._zod.optin === "optional" && shape[k]._zod.optout === "optional";
198
+ });
199
+ }
200
+ const NUMBER_FORMAT_RANGES = {
201
+ safeint: [Number.MIN_SAFE_INTEGER, Number.MAX_SAFE_INTEGER],
202
+ int32: [-2147483648, 2147483647],
203
+ uint32: [0, 4294967295],
204
+ float32: [-34028234663852886e22, 34028234663852886e22],
205
+ float64: [-Number.MAX_VALUE, Number.MAX_VALUE]
206
+ };
207
+ function pick(schema, mask) {
208
+ const currDef = schema._zod.def;
209
+ const checks = currDef.checks;
210
+ if (checks && checks.length > 0) throw new Error(".pick() cannot be used on object schemas containing refinements");
211
+ return clone(schema, mergeDefs(schema._zod.def, {
212
+ get shape() {
213
+ const newShape = {};
214
+ for (const key in mask) {
215
+ if (!(key in currDef.shape)) throw new Error(`Unrecognized key: "${key}"`);
216
+ if (!mask[key]) continue;
217
+ newShape[key] = currDef.shape[key];
218
+ }
219
+ assignProp(this, "shape", newShape);
220
+ return newShape;
221
+ },
222
+ checks: []
223
+ }));
224
+ }
225
+ function omit(schema, mask) {
226
+ const currDef = schema._zod.def;
227
+ const checks = currDef.checks;
228
+ if (checks && checks.length > 0) throw new Error(".omit() cannot be used on object schemas containing refinements");
229
+ return clone(schema, mergeDefs(schema._zod.def, {
230
+ get shape() {
231
+ const newShape = { ...schema._zod.def.shape };
232
+ for (const key in mask) {
233
+ if (!(key in currDef.shape)) throw new Error(`Unrecognized key: "${key}"`);
234
+ if (!mask[key]) continue;
235
+ delete newShape[key];
236
+ }
237
+ assignProp(this, "shape", newShape);
238
+ return newShape;
239
+ },
240
+ checks: []
241
+ }));
242
+ }
243
+ function extend(schema, shape) {
244
+ if (!isPlainObject(shape)) throw new Error("Invalid input to extend: expected a plain object");
245
+ const checks = schema._zod.def.checks;
246
+ if (checks && checks.length > 0) {
247
+ const existingShape = schema._zod.def.shape;
248
+ 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.");
249
+ }
250
+ return clone(schema, mergeDefs(schema._zod.def, { get shape() {
251
+ const _shape = {
252
+ ...schema._zod.def.shape,
253
+ ...shape
254
+ };
255
+ assignProp(this, "shape", _shape);
256
+ return _shape;
257
+ } }));
258
+ }
259
+ function safeExtend(schema, shape) {
260
+ if (!isPlainObject(shape)) throw new Error("Invalid input to safeExtend: expected a plain object");
261
+ return clone(schema, mergeDefs(schema._zod.def, { get shape() {
262
+ const _shape = {
263
+ ...schema._zod.def.shape,
264
+ ...shape
265
+ };
266
+ assignProp(this, "shape", _shape);
267
+ return _shape;
268
+ } }));
269
+ }
270
+ function merge(a, b) {
271
+ if (a._zod.def.checks?.length) throw new Error(".merge() cannot be used on object schemas containing refinements. Use .safeExtend() instead.");
272
+ return clone(a, mergeDefs(a._zod.def, {
273
+ get shape() {
274
+ const _shape = {
275
+ ...a._zod.def.shape,
276
+ ...b._zod.def.shape
277
+ };
278
+ assignProp(this, "shape", _shape);
279
+ return _shape;
280
+ },
281
+ get catchall() {
282
+ return b._zod.def.catchall;
283
+ },
284
+ checks: b._zod.def.checks ?? []
285
+ }));
286
+ }
287
+ function partial(Class, schema, mask) {
288
+ const checks = schema._zod.def.checks;
289
+ if (checks && checks.length > 0) throw new Error(".partial() cannot be used on object schemas containing refinements");
290
+ return clone(schema, mergeDefs(schema._zod.def, {
291
+ get shape() {
292
+ const oldShape = schema._zod.def.shape;
293
+ const shape = { ...oldShape };
294
+ if (mask) for (const key in mask) {
295
+ if (!(key in oldShape)) throw new Error(`Unrecognized key: "${key}"`);
296
+ if (!mask[key]) continue;
297
+ shape[key] = Class ? new Class({
298
+ type: "optional",
299
+ innerType: oldShape[key]
300
+ }) : oldShape[key];
301
+ }
302
+ else for (const key in oldShape) shape[key] = Class ? new Class({
303
+ type: "optional",
304
+ innerType: oldShape[key]
305
+ }) : oldShape[key];
306
+ assignProp(this, "shape", shape);
307
+ return shape;
308
+ },
309
+ checks: []
310
+ }));
311
+ }
312
+ function required(Class, schema, mask) {
313
+ return clone(schema, mergeDefs(schema._zod.def, { get shape() {
314
+ const oldShape = schema._zod.def.shape;
315
+ const shape = { ...oldShape };
316
+ if (mask) for (const key in mask) {
317
+ if (!(key in shape)) throw new Error(`Unrecognized key: "${key}"`);
318
+ if (!mask[key]) continue;
319
+ shape[key] = new Class({
320
+ type: "nonoptional",
321
+ innerType: oldShape[key]
322
+ });
323
+ }
324
+ else for (const key in oldShape) shape[key] = new Class({
325
+ type: "nonoptional",
326
+ innerType: oldShape[key]
327
+ });
328
+ assignProp(this, "shape", shape);
329
+ return shape;
330
+ } }));
331
+ }
332
+ function aborted(x, startIndex = 0) {
333
+ if (x.aborted === true) return true;
334
+ for (let i = startIndex; i < x.issues.length; i++) if (x.issues[i]?.continue !== true) return true;
335
+ return false;
336
+ }
337
+ function explicitlyAborted(x, startIndex = 0) {
338
+ if (x.aborted === true) return true;
339
+ for (let i = startIndex; i < x.issues.length; i++) if (x.issues[i]?.continue === false) return true;
340
+ return false;
341
+ }
342
+ function prefixIssues(path, issues) {
343
+ return issues.map((iss) => {
344
+ var _a;
345
+ (_a = iss).path ?? (_a.path = []);
346
+ iss.path.unshift(path);
347
+ return iss;
348
+ });
349
+ }
350
+ function unwrapMessage(message) {
351
+ return typeof message === "string" ? message : message?.message;
352
+ }
353
+ function finalizeIssue(iss, ctx, config) {
354
+ 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";
355
+ const { inst: _inst, continue: _continue, input: _input, ...rest } = iss;
356
+ rest.path ?? (rest.path = []);
357
+ rest.message = message;
358
+ if (ctx?.reportInput) rest.input = _input;
359
+ return rest;
360
+ }
361
+ function getLengthableOrigin(input) {
362
+ if (Array.isArray(input)) return "array";
363
+ if (typeof input === "string") return "string";
364
+ return "unknown";
365
+ }
366
+ function issue(...args) {
367
+ const [iss, input, inst] = args;
368
+ if (typeof iss === "string") return {
369
+ message: iss,
370
+ code: "custom",
371
+ input,
372
+ inst
373
+ };
374
+ return { ...iss };
375
+ }
376
+ //#endregion
377
+ //#region ../../node_modules/.pnpm/zod@4.4.3/node_modules/zod/v4/core/errors.js
378
+ const initializer$1 = (inst, def) => {
379
+ inst.name = "$ZodError";
380
+ Object.defineProperty(inst, "_zod", {
381
+ value: inst._zod,
382
+ enumerable: false
383
+ });
384
+ Object.defineProperty(inst, "issues", {
385
+ value: def,
386
+ enumerable: false
387
+ });
388
+ inst.message = JSON.stringify(def, jsonStringifyReplacer, 2);
389
+ Object.defineProperty(inst, "toString", {
390
+ value: () => inst.message,
391
+ enumerable: false
392
+ });
393
+ };
394
+ const $ZodError = $constructor("$ZodError", initializer$1);
395
+ const $ZodRealError = $constructor("$ZodError", initializer$1, { Parent: Error });
396
+ function flattenError(error, mapper = (issue) => issue.message) {
397
+ const fieldErrors = {};
398
+ const formErrors = [];
399
+ for (const sub of error.issues) if (sub.path.length > 0) {
400
+ fieldErrors[sub.path[0]] = fieldErrors[sub.path[0]] || [];
401
+ fieldErrors[sub.path[0]].push(mapper(sub));
402
+ } else formErrors.push(mapper(sub));
403
+ return {
404
+ formErrors,
405
+ fieldErrors
406
+ };
407
+ }
408
+ function formatError(error, mapper = (issue) => issue.message) {
409
+ const fieldErrors = { _errors: [] };
410
+ const processError = (error, path = []) => {
411
+ for (const issue of error.issues) if (issue.code === "invalid_union" && issue.errors.length) issue.errors.map((issues) => processError({ issues }, [...path, ...issue.path]));
412
+ else if (issue.code === "invalid_key") processError({ issues: issue.issues }, [...path, ...issue.path]);
413
+ else if (issue.code === "invalid_element") processError({ issues: issue.issues }, [...path, ...issue.path]);
414
+ else {
415
+ const fullpath = [...path, ...issue.path];
416
+ if (fullpath.length === 0) fieldErrors._errors.push(mapper(issue));
417
+ else {
418
+ let curr = fieldErrors;
419
+ let i = 0;
420
+ while (i < fullpath.length) {
421
+ const el = fullpath[i];
422
+ if (!(i === fullpath.length - 1)) curr[el] = curr[el] || { _errors: [] };
423
+ else {
424
+ curr[el] = curr[el] || { _errors: [] };
425
+ curr[el]._errors.push(mapper(issue));
426
+ }
427
+ curr = curr[el];
428
+ i++;
429
+ }
430
+ }
431
+ }
432
+ };
433
+ processError(error);
434
+ return fieldErrors;
435
+ }
436
+ //#endregion
437
+ //#region ../../node_modules/.pnpm/zod@4.4.3/node_modules/zod/v4/core/parse.js
438
+ const _parse = (_Err) => (schema, value, _ctx, _params) => {
439
+ const ctx = _ctx ? {
440
+ ..._ctx,
441
+ async: false
442
+ } : { async: false };
443
+ const result = schema._zod.run({
444
+ value,
445
+ issues: []
446
+ }, ctx);
447
+ if (result instanceof Promise) throw new $ZodAsyncError();
448
+ if (result.issues.length) {
449
+ const e = new ((_params?.Err) ?? _Err)(result.issues.map((iss) => finalizeIssue(iss, ctx, config())));
450
+ captureStackTrace(e, _params?.callee);
451
+ throw e;
452
+ }
453
+ return result.value;
454
+ };
455
+ const _parseAsync = (_Err) => async (schema, value, _ctx, params) => {
456
+ const ctx = _ctx ? {
457
+ ..._ctx,
458
+ async: true
459
+ } : { async: true };
460
+ let result = schema._zod.run({
461
+ value,
462
+ issues: []
463
+ }, ctx);
464
+ if (result instanceof Promise) result = await result;
465
+ if (result.issues.length) {
466
+ const e = new ((params?.Err) ?? _Err)(result.issues.map((iss) => finalizeIssue(iss, ctx, config())));
467
+ captureStackTrace(e, params?.callee);
468
+ throw e;
469
+ }
470
+ return result.value;
471
+ };
472
+ const _safeParse = (_Err) => (schema, value, _ctx) => {
473
+ const ctx = _ctx ? {
474
+ ..._ctx,
475
+ async: false
476
+ } : { async: false };
477
+ const result = schema._zod.run({
478
+ value,
479
+ issues: []
480
+ }, ctx);
481
+ if (result instanceof Promise) throw new $ZodAsyncError();
482
+ return result.issues.length ? {
483
+ success: false,
484
+ error: new (_Err ?? $ZodError)(result.issues.map((iss) => finalizeIssue(iss, ctx, config())))
485
+ } : {
486
+ success: true,
487
+ data: result.value
488
+ };
489
+ };
490
+ const safeParse$1 = /* @__PURE__*/ _safeParse($ZodRealError);
491
+ const _safeParseAsync = (_Err) => async (schema, value, _ctx) => {
492
+ const ctx = _ctx ? {
493
+ ..._ctx,
494
+ async: true
495
+ } : { async: true };
496
+ let result = schema._zod.run({
497
+ value,
498
+ issues: []
499
+ }, ctx);
500
+ if (result instanceof Promise) result = await result;
501
+ return result.issues.length ? {
502
+ success: false,
503
+ error: new _Err(result.issues.map((iss) => finalizeIssue(iss, ctx, config())))
504
+ } : {
505
+ success: true,
506
+ data: result.value
507
+ };
508
+ };
509
+ const safeParseAsync$1 = /* @__PURE__*/ _safeParseAsync($ZodRealError);
510
+ const _encode = (_Err) => (schema, value, _ctx) => {
511
+ const ctx = _ctx ? {
512
+ ..._ctx,
513
+ direction: "backward"
514
+ } : { direction: "backward" };
515
+ return _parse(_Err)(schema, value, ctx);
516
+ };
517
+ const _decode = (_Err) => (schema, value, _ctx) => {
518
+ return _parse(_Err)(schema, value, _ctx);
519
+ };
520
+ const _encodeAsync = (_Err) => async (schema, value, _ctx) => {
521
+ const ctx = _ctx ? {
522
+ ..._ctx,
523
+ direction: "backward"
524
+ } : { direction: "backward" };
525
+ return _parseAsync(_Err)(schema, value, ctx);
526
+ };
527
+ const _decodeAsync = (_Err) => async (schema, value, _ctx) => {
528
+ return _parseAsync(_Err)(schema, value, _ctx);
529
+ };
530
+ const _safeEncode = (_Err) => (schema, value, _ctx) => {
531
+ const ctx = _ctx ? {
532
+ ..._ctx,
533
+ direction: "backward"
534
+ } : { direction: "backward" };
535
+ return _safeParse(_Err)(schema, value, ctx);
536
+ };
537
+ const _safeDecode = (_Err) => (schema, value, _ctx) => {
538
+ return _safeParse(_Err)(schema, value, _ctx);
539
+ };
540
+ const _safeEncodeAsync = (_Err) => async (schema, value, _ctx) => {
541
+ const ctx = _ctx ? {
542
+ ..._ctx,
543
+ direction: "backward"
544
+ } : { direction: "backward" };
545
+ return _safeParseAsync(_Err)(schema, value, ctx);
546
+ };
547
+ const _safeDecodeAsync = (_Err) => async (schema, value, _ctx) => {
548
+ return _safeParseAsync(_Err)(schema, value, _ctx);
549
+ };
550
+ //#endregion
551
+ //#region ../../node_modules/.pnpm/zod@4.4.3/node_modules/zod/v4/core/regexes.js
552
+ /**
553
+ * @deprecated CUID v1 is deprecated by its authors due to information leakage
554
+ * (timestamps embedded in the id). Use {@link cuid2} instead.
555
+ * See https://github.com/paralleldrive/cuid.
556
+ */
557
+ const cuid = /^[cC][0-9a-z]{6,}$/;
558
+ const cuid2 = /^[0-9a-z]+$/;
559
+ const ulid = /^[0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{26}$/;
560
+ const xid = /^[0-9a-vA-V]{20}$/;
561
+ const ksuid = /^[A-Za-z0-9]{27}$/;
562
+ const nanoid = /^[a-zA-Z0-9_-]{21}$/;
563
+ /** ISO 8601-1 duration regex. Does not support the 8601-2 extensions like negative durations or fractional/negative components. */
564
+ 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)?)?)$/;
565
+ /** A regex for any UUID-like identifier: 8-4-4-4-12 hex pattern */
566
+ 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})$/;
567
+ /** Returns a regex for validating an RFC 9562/4122 UUID.
568
+ *
569
+ * @param version Optionally specify a version 1-8. If no version is specified, all versions are supported. */
570
+ const uuid = (version) => {
571
+ if (!version) return /^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$/;
572
+ 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})$`);
573
+ };
574
+ /** Practical email validation */
575
+ const email = /^(?!\.)(?!.*\.\.)([A-Za-z0-9_'+\-\.]*)[A-Za-z0-9_+-]@([A-Za-z0-9][A-Za-z0-9\-]*\.)+[A-Za-z]{2,}$/;
576
+ const _emoji$1 = `^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$`;
577
+ function emoji() {
578
+ return new RegExp(_emoji$1, "u");
579
+ }
580
+ 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])$/;
581
+ 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}|:))$/;
582
+ 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])$/;
583
+ 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])$/;
584
+ const base64 = /^$|^(?:[0-9a-zA-Z+/]{4})*(?:(?:[0-9a-zA-Z+/]{2}==)|(?:[0-9a-zA-Z+/]{3}=))?$/;
585
+ const base64url = /^[A-Za-z0-9_-]*$/;
586
+ const httpProtocol = /^https?$/;
587
+ const e164 = /^\+[1-9]\d{6,14}$/;
588
+ 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])))`;
589
+ const date$1 = /*@__PURE__*/ new RegExp(`^${dateSource}$`);
590
+ function timeSource(args) {
591
+ const hhmm = `(?:[01]\\d|2[0-3]):[0-5]\\d`;
592
+ 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+)?)?`;
593
+ }
594
+ function time$1(args) {
595
+ return new RegExp(`^${timeSource(args)}$`);
596
+ }
597
+ function datetime$1(args) {
598
+ const time = timeSource({ precision: args.precision });
599
+ const opts = ["Z"];
600
+ if (args.local) opts.push("");
601
+ if (args.offset) opts.push(`([+-](?:[01]\\d|2[0-3]):[0-5]\\d)`);
602
+ const timeRegex = `${time}(?:${opts.join("|")})`;
603
+ return new RegExp(`^${dateSource}T(?:${timeRegex})$`);
604
+ }
605
+ const string$1 = (params) => {
606
+ const regex = params ? `[\\s\\S]{${params?.minimum ?? 0},${params?.maximum ?? ""}}` : `[\\s\\S]*`;
607
+ return new RegExp(`^${regex}$`);
608
+ };
609
+ const integer = /^-?\d+$/;
610
+ const number$1 = /^-?\d+(?:\.\d+)?$/;
611
+ const boolean$1 = /^(?:true|false)$/i;
612
+ const _null$2 = /^null$/i;
613
+ const lowercase = /^[^A-Z]*$/;
614
+ const uppercase = /^[^a-z]*$/;
615
+ //#endregion
616
+ //#region ../../node_modules/.pnpm/zod@4.4.3/node_modules/zod/v4/core/checks.js
617
+ const $ZodCheck = /*@__PURE__*/ $constructor("$ZodCheck", (inst, def) => {
618
+ var _a;
619
+ inst._zod ?? (inst._zod = {});
620
+ inst._zod.def = def;
621
+ (_a = inst._zod).onattach ?? (_a.onattach = []);
622
+ });
623
+ const numericOriginMap = {
624
+ number: "number",
625
+ bigint: "bigint",
626
+ object: "date"
627
+ };
628
+ const $ZodCheckLessThan = /*@__PURE__*/ $constructor("$ZodCheckLessThan", (inst, def) => {
629
+ $ZodCheck.init(inst, def);
630
+ const origin = numericOriginMap[typeof def.value];
631
+ inst._zod.onattach.push((inst) => {
632
+ const bag = inst._zod.bag;
633
+ const curr = (def.inclusive ? bag.maximum : bag.exclusiveMaximum) ?? Number.POSITIVE_INFINITY;
634
+ if (def.value < curr) if (def.inclusive) bag.maximum = def.value;
635
+ else bag.exclusiveMaximum = def.value;
636
+ });
637
+ inst._zod.check = (payload) => {
638
+ if (def.inclusive ? payload.value <= def.value : payload.value < def.value) return;
639
+ payload.issues.push({
640
+ origin,
641
+ code: "too_big",
642
+ maximum: typeof def.value === "object" ? def.value.getTime() : def.value,
643
+ input: payload.value,
644
+ inclusive: def.inclusive,
645
+ inst,
646
+ continue: !def.abort
647
+ });
648
+ };
649
+ });
650
+ const $ZodCheckGreaterThan = /*@__PURE__*/ $constructor("$ZodCheckGreaterThan", (inst, def) => {
651
+ $ZodCheck.init(inst, def);
652
+ const origin = numericOriginMap[typeof def.value];
653
+ inst._zod.onattach.push((inst) => {
654
+ const bag = inst._zod.bag;
655
+ const curr = (def.inclusive ? bag.minimum : bag.exclusiveMinimum) ?? Number.NEGATIVE_INFINITY;
656
+ if (def.value > curr) if (def.inclusive) bag.minimum = def.value;
657
+ else bag.exclusiveMinimum = def.value;
658
+ });
659
+ inst._zod.check = (payload) => {
660
+ if (def.inclusive ? payload.value >= def.value : payload.value > def.value) return;
661
+ payload.issues.push({
662
+ origin,
663
+ code: "too_small",
664
+ minimum: typeof def.value === "object" ? def.value.getTime() : def.value,
665
+ input: payload.value,
666
+ inclusive: def.inclusive,
667
+ inst,
668
+ continue: !def.abort
669
+ });
670
+ };
671
+ });
672
+ const $ZodCheckMultipleOf = /*@__PURE__*/ $constructor("$ZodCheckMultipleOf", (inst, def) => {
673
+ $ZodCheck.init(inst, def);
674
+ inst._zod.onattach.push((inst) => {
675
+ var _a;
676
+ (_a = inst._zod.bag).multipleOf ?? (_a.multipleOf = def.value);
677
+ });
678
+ inst._zod.check = (payload) => {
679
+ if (typeof payload.value !== typeof def.value) throw new Error("Cannot mix number and bigint in multiple_of check.");
680
+ if (typeof payload.value === "bigint" ? payload.value % def.value === BigInt(0) : floatSafeRemainder(payload.value, def.value) === 0) return;
681
+ payload.issues.push({
682
+ origin: typeof payload.value,
683
+ code: "not_multiple_of",
684
+ divisor: def.value,
685
+ input: payload.value,
686
+ inst,
687
+ continue: !def.abort
688
+ });
689
+ };
690
+ });
691
+ const $ZodCheckNumberFormat = /*@__PURE__*/ $constructor("$ZodCheckNumberFormat", (inst, def) => {
692
+ $ZodCheck.init(inst, def);
693
+ def.format = def.format || "float64";
694
+ const isInt = def.format?.includes("int");
695
+ const origin = isInt ? "int" : "number";
696
+ const [minimum, maximum] = NUMBER_FORMAT_RANGES[def.format];
697
+ inst._zod.onattach.push((inst) => {
698
+ const bag = inst._zod.bag;
699
+ bag.format = def.format;
700
+ bag.minimum = minimum;
701
+ bag.maximum = maximum;
702
+ if (isInt) bag.pattern = integer;
703
+ });
704
+ inst._zod.check = (payload) => {
705
+ const input = payload.value;
706
+ if (isInt) {
707
+ if (!Number.isInteger(input)) {
708
+ payload.issues.push({
709
+ expected: origin,
710
+ format: def.format,
711
+ code: "invalid_type",
712
+ continue: false,
713
+ input,
714
+ inst
715
+ });
716
+ return;
717
+ }
718
+ if (!Number.isSafeInteger(input)) {
719
+ if (input > 0) payload.issues.push({
720
+ input,
721
+ code: "too_big",
722
+ maximum: Number.MAX_SAFE_INTEGER,
723
+ note: "Integers must be within the safe integer range.",
724
+ inst,
725
+ origin,
726
+ inclusive: true,
727
+ continue: !def.abort
728
+ });
729
+ else payload.issues.push({
730
+ input,
731
+ code: "too_small",
732
+ minimum: Number.MIN_SAFE_INTEGER,
733
+ note: "Integers must be within the safe integer range.",
734
+ inst,
735
+ origin,
736
+ inclusive: true,
737
+ continue: !def.abort
738
+ });
739
+ return;
740
+ }
741
+ }
742
+ if (input < minimum) payload.issues.push({
743
+ origin: "number",
744
+ input,
745
+ code: "too_small",
746
+ minimum,
747
+ inclusive: true,
748
+ inst,
749
+ continue: !def.abort
750
+ });
751
+ if (input > maximum) payload.issues.push({
752
+ origin: "number",
753
+ input,
754
+ code: "too_big",
755
+ maximum,
756
+ inclusive: true,
757
+ inst,
758
+ continue: !def.abort
759
+ });
760
+ };
761
+ });
762
+ const $ZodCheckMaxLength = /*@__PURE__*/ $constructor("$ZodCheckMaxLength", (inst, def) => {
763
+ var _a;
764
+ $ZodCheck.init(inst, def);
765
+ (_a = inst._zod.def).when ?? (_a.when = (payload) => {
766
+ const val = payload.value;
767
+ return !nullish(val) && val.length !== void 0;
768
+ });
769
+ inst._zod.onattach.push((inst) => {
770
+ const curr = inst._zod.bag.maximum ?? Number.POSITIVE_INFINITY;
771
+ if (def.maximum < curr) inst._zod.bag.maximum = def.maximum;
772
+ });
773
+ inst._zod.check = (payload) => {
774
+ const input = payload.value;
775
+ if (input.length <= def.maximum) return;
776
+ const origin = getLengthableOrigin(input);
777
+ payload.issues.push({
778
+ origin,
779
+ code: "too_big",
780
+ maximum: def.maximum,
781
+ inclusive: true,
782
+ input,
783
+ inst,
784
+ continue: !def.abort
785
+ });
786
+ };
787
+ });
788
+ const $ZodCheckMinLength = /*@__PURE__*/ $constructor("$ZodCheckMinLength", (inst, def) => {
789
+ var _a;
790
+ $ZodCheck.init(inst, def);
791
+ (_a = inst._zod.def).when ?? (_a.when = (payload) => {
792
+ const val = payload.value;
793
+ return !nullish(val) && val.length !== void 0;
794
+ });
795
+ inst._zod.onattach.push((inst) => {
796
+ const curr = inst._zod.bag.minimum ?? Number.NEGATIVE_INFINITY;
797
+ if (def.minimum > curr) inst._zod.bag.minimum = def.minimum;
798
+ });
799
+ inst._zod.check = (payload) => {
800
+ const input = payload.value;
801
+ if (input.length >= def.minimum) return;
802
+ const origin = getLengthableOrigin(input);
803
+ payload.issues.push({
804
+ origin,
805
+ code: "too_small",
806
+ minimum: def.minimum,
807
+ inclusive: true,
808
+ input,
809
+ inst,
810
+ continue: !def.abort
811
+ });
812
+ };
813
+ });
814
+ const $ZodCheckLengthEquals = /*@__PURE__*/ $constructor("$ZodCheckLengthEquals", (inst, def) => {
815
+ var _a;
816
+ $ZodCheck.init(inst, def);
817
+ (_a = inst._zod.def).when ?? (_a.when = (payload) => {
818
+ const val = payload.value;
819
+ return !nullish(val) && val.length !== void 0;
820
+ });
821
+ inst._zod.onattach.push((inst) => {
822
+ const bag = inst._zod.bag;
823
+ bag.minimum = def.length;
824
+ bag.maximum = def.length;
825
+ bag.length = def.length;
826
+ });
827
+ inst._zod.check = (payload) => {
828
+ const input = payload.value;
829
+ const length = input.length;
830
+ if (length === def.length) return;
831
+ const origin = getLengthableOrigin(input);
832
+ const tooBig = length > def.length;
833
+ payload.issues.push({
834
+ origin,
835
+ ...tooBig ? {
836
+ code: "too_big",
837
+ maximum: def.length
838
+ } : {
839
+ code: "too_small",
840
+ minimum: def.length
841
+ },
842
+ inclusive: true,
843
+ exact: true,
844
+ input: payload.value,
845
+ inst,
846
+ continue: !def.abort
847
+ });
848
+ };
849
+ });
850
+ const $ZodCheckStringFormat = /*@__PURE__*/ $constructor("$ZodCheckStringFormat", (inst, def) => {
851
+ var _a, _b;
852
+ $ZodCheck.init(inst, def);
853
+ inst._zod.onattach.push((inst) => {
854
+ const bag = inst._zod.bag;
855
+ bag.format = def.format;
856
+ if (def.pattern) {
857
+ bag.patterns ?? (bag.patterns = /* @__PURE__ */ new Set());
858
+ bag.patterns.add(def.pattern);
859
+ }
860
+ });
861
+ if (def.pattern) (_a = inst._zod).check ?? (_a.check = (payload) => {
862
+ def.pattern.lastIndex = 0;
863
+ if (def.pattern.test(payload.value)) return;
864
+ payload.issues.push({
865
+ origin: "string",
866
+ code: "invalid_format",
867
+ format: def.format,
868
+ input: payload.value,
869
+ ...def.pattern ? { pattern: def.pattern.toString() } : {},
870
+ inst,
871
+ continue: !def.abort
872
+ });
873
+ });
874
+ else (_b = inst._zod).check ?? (_b.check = () => {});
875
+ });
876
+ const $ZodCheckRegex = /*@__PURE__*/ $constructor("$ZodCheckRegex", (inst, def) => {
877
+ $ZodCheckStringFormat.init(inst, def);
878
+ inst._zod.check = (payload) => {
879
+ def.pattern.lastIndex = 0;
880
+ if (def.pattern.test(payload.value)) return;
881
+ payload.issues.push({
882
+ origin: "string",
883
+ code: "invalid_format",
884
+ format: "regex",
885
+ input: payload.value,
886
+ pattern: def.pattern.toString(),
887
+ inst,
888
+ continue: !def.abort
889
+ });
890
+ };
891
+ });
892
+ const $ZodCheckLowerCase = /*@__PURE__*/ $constructor("$ZodCheckLowerCase", (inst, def) => {
893
+ def.pattern ?? (def.pattern = lowercase);
894
+ $ZodCheckStringFormat.init(inst, def);
895
+ });
896
+ const $ZodCheckUpperCase = /*@__PURE__*/ $constructor("$ZodCheckUpperCase", (inst, def) => {
897
+ def.pattern ?? (def.pattern = uppercase);
898
+ $ZodCheckStringFormat.init(inst, def);
899
+ });
900
+ const $ZodCheckIncludes = /*@__PURE__*/ $constructor("$ZodCheckIncludes", (inst, def) => {
901
+ $ZodCheck.init(inst, def);
902
+ const escapedRegex = escapeRegex(def.includes);
903
+ const pattern = new RegExp(typeof def.position === "number" ? `^.{${def.position}}${escapedRegex}` : escapedRegex);
904
+ def.pattern = pattern;
905
+ inst._zod.onattach.push((inst) => {
906
+ const bag = inst._zod.bag;
907
+ bag.patterns ?? (bag.patterns = /* @__PURE__ */ new Set());
908
+ bag.patterns.add(pattern);
909
+ });
910
+ inst._zod.check = (payload) => {
911
+ if (payload.value.includes(def.includes, def.position)) return;
912
+ payload.issues.push({
913
+ origin: "string",
914
+ code: "invalid_format",
915
+ format: "includes",
916
+ includes: def.includes,
917
+ input: payload.value,
918
+ inst,
919
+ continue: !def.abort
920
+ });
921
+ };
922
+ });
923
+ const $ZodCheckStartsWith = /*@__PURE__*/ $constructor("$ZodCheckStartsWith", (inst, def) => {
924
+ $ZodCheck.init(inst, def);
925
+ const pattern = new RegExp(`^${escapeRegex(def.prefix)}.*`);
926
+ def.pattern ?? (def.pattern = pattern);
927
+ inst._zod.onattach.push((inst) => {
928
+ const bag = inst._zod.bag;
929
+ bag.patterns ?? (bag.patterns = /* @__PURE__ */ new Set());
930
+ bag.patterns.add(pattern);
931
+ });
932
+ inst._zod.check = (payload) => {
933
+ if (payload.value.startsWith(def.prefix)) return;
934
+ payload.issues.push({
935
+ origin: "string",
936
+ code: "invalid_format",
937
+ format: "starts_with",
938
+ prefix: def.prefix,
939
+ input: payload.value,
940
+ inst,
941
+ continue: !def.abort
942
+ });
943
+ };
944
+ });
945
+ const $ZodCheckEndsWith = /*@__PURE__*/ $constructor("$ZodCheckEndsWith", (inst, def) => {
946
+ $ZodCheck.init(inst, def);
947
+ const pattern = new RegExp(`.*${escapeRegex(def.suffix)}$`);
948
+ def.pattern ?? (def.pattern = pattern);
949
+ inst._zod.onattach.push((inst) => {
950
+ const bag = inst._zod.bag;
951
+ bag.patterns ?? (bag.patterns = /* @__PURE__ */ new Set());
952
+ bag.patterns.add(pattern);
953
+ });
954
+ inst._zod.check = (payload) => {
955
+ if (payload.value.endsWith(def.suffix)) return;
956
+ payload.issues.push({
957
+ origin: "string",
958
+ code: "invalid_format",
959
+ format: "ends_with",
960
+ suffix: def.suffix,
961
+ input: payload.value,
962
+ inst,
963
+ continue: !def.abort
964
+ });
965
+ };
966
+ });
967
+ const $ZodCheckOverwrite = /*@__PURE__*/ $constructor("$ZodCheckOverwrite", (inst, def) => {
968
+ $ZodCheck.init(inst, def);
969
+ inst._zod.check = (payload) => {
970
+ payload.value = def.tx(payload.value);
971
+ };
972
+ });
973
+ //#endregion
974
+ //#region ../../node_modules/.pnpm/zod@4.4.3/node_modules/zod/v4/core/doc.js
975
+ var Doc = class {
976
+ constructor(args = []) {
977
+ this.content = [];
978
+ this.indent = 0;
979
+ if (this) this.args = args;
980
+ }
981
+ indented(fn) {
982
+ this.indent += 1;
983
+ fn(this);
984
+ this.indent -= 1;
985
+ }
986
+ write(arg) {
987
+ if (typeof arg === "function") {
988
+ arg(this, { execution: "sync" });
989
+ arg(this, { execution: "async" });
990
+ return;
991
+ }
992
+ const lines = arg.split("\n").filter((x) => x);
993
+ const minIndent = Math.min(...lines.map((x) => x.length - x.trimStart().length));
994
+ const dedented = lines.map((x) => x.slice(minIndent)).map((x) => " ".repeat(this.indent * 2) + x);
995
+ for (const line of dedented) this.content.push(line);
996
+ }
997
+ compile() {
998
+ const F = Function;
999
+ const args = this?.args;
1000
+ const lines = [...(this?.content ?? [``]).map((x) => ` ${x}`)];
1001
+ return new F(...args, lines.join("\n"));
1002
+ }
1003
+ };
1004
+ //#endregion
1005
+ //#region ../../node_modules/.pnpm/zod@4.4.3/node_modules/zod/v4/core/versions.js
1006
+ const version = {
1007
+ major: 4,
1008
+ minor: 4,
1009
+ patch: 3
1010
+ };
1011
+ //#endregion
1012
+ //#region ../../node_modules/.pnpm/zod@4.4.3/node_modules/zod/v4/core/schemas.js
1013
+ const $ZodType = /*@__PURE__*/ $constructor("$ZodType", (inst, def) => {
1014
+ var _a;
1015
+ inst ?? (inst = {});
1016
+ inst._zod.def = def;
1017
+ inst._zod.bag = inst._zod.bag || {};
1018
+ inst._zod.version = version;
1019
+ const checks = [...inst._zod.def.checks ?? []];
1020
+ if (inst._zod.traits.has("$ZodCheck")) checks.unshift(inst);
1021
+ for (const ch of checks) for (const fn of ch._zod.onattach) fn(inst);
1022
+ if (checks.length === 0) {
1023
+ (_a = inst._zod).deferred ?? (_a.deferred = []);
1024
+ inst._zod.deferred?.push(() => {
1025
+ inst._zod.run = inst._zod.parse;
1026
+ });
1027
+ } else {
1028
+ const runChecks = (payload, checks, ctx) => {
1029
+ let isAborted = aborted(payload);
1030
+ let asyncResult;
1031
+ for (const ch of checks) {
1032
+ if (ch._zod.def.when) {
1033
+ if (explicitlyAborted(payload)) continue;
1034
+ if (!ch._zod.def.when(payload)) continue;
1035
+ } else if (isAborted) continue;
1036
+ const currLen = payload.issues.length;
1037
+ const _ = ch._zod.check(payload);
1038
+ if (_ instanceof Promise && ctx?.async === false) throw new $ZodAsyncError();
1039
+ if (asyncResult || _ instanceof Promise) asyncResult = (asyncResult ?? Promise.resolve()).then(async () => {
1040
+ await _;
1041
+ if (payload.issues.length === currLen) return;
1042
+ if (!isAborted) isAborted = aborted(payload, currLen);
1043
+ });
1044
+ else {
1045
+ if (payload.issues.length === currLen) continue;
1046
+ if (!isAborted) isAborted = aborted(payload, currLen);
1047
+ }
1048
+ }
1049
+ if (asyncResult) return asyncResult.then(() => {
1050
+ return payload;
1051
+ });
1052
+ return payload;
1053
+ };
1054
+ const handleCanaryResult = (canary, payload, ctx) => {
1055
+ if (aborted(canary)) {
1056
+ canary.aborted = true;
1057
+ return canary;
1058
+ }
1059
+ const checkResult = runChecks(payload, checks, ctx);
1060
+ if (checkResult instanceof Promise) {
1061
+ if (ctx.async === false) throw new $ZodAsyncError();
1062
+ return checkResult.then((checkResult) => inst._zod.parse(checkResult, ctx));
1063
+ }
1064
+ return inst._zod.parse(checkResult, ctx);
1065
+ };
1066
+ inst._zod.run = (payload, ctx) => {
1067
+ if (ctx.skipChecks) return inst._zod.parse(payload, ctx);
1068
+ if (ctx.direction === "backward") {
1069
+ const canary = inst._zod.parse({
1070
+ value: payload.value,
1071
+ issues: []
1072
+ }, {
1073
+ ...ctx,
1074
+ skipChecks: true
1075
+ });
1076
+ if (canary instanceof Promise) return canary.then((canary) => {
1077
+ return handleCanaryResult(canary, payload, ctx);
1078
+ });
1079
+ return handleCanaryResult(canary, payload, ctx);
1080
+ }
1081
+ const result = inst._zod.parse(payload, ctx);
1082
+ if (result instanceof Promise) {
1083
+ if (ctx.async === false) throw new $ZodAsyncError();
1084
+ return result.then((result) => runChecks(result, checks, ctx));
1085
+ }
1086
+ return runChecks(result, checks, ctx);
1087
+ };
1088
+ }
1089
+ defineLazy(inst, "~standard", () => ({
1090
+ validate: (value) => {
1091
+ try {
1092
+ const r = safeParse$1(inst, value);
1093
+ return r.success ? { value: r.data } : { issues: r.error?.issues };
1094
+ } catch (_) {
1095
+ return safeParseAsync$1(inst, value).then((r) => r.success ? { value: r.data } : { issues: r.error?.issues });
1096
+ }
1097
+ },
1098
+ vendor: "zod",
1099
+ version: 1
1100
+ }));
1101
+ });
1102
+ const $ZodString = /*@__PURE__*/ $constructor("$ZodString", (inst, def) => {
1103
+ $ZodType.init(inst, def);
1104
+ inst._zod.pattern = [...inst?._zod.bag?.patterns ?? []].pop() ?? string$1(inst._zod.bag);
1105
+ inst._zod.parse = (payload, _) => {
1106
+ if (def.coerce) try {
1107
+ payload.value = String(payload.value);
1108
+ } catch (_) {}
1109
+ if (typeof payload.value === "string") return payload;
1110
+ payload.issues.push({
1111
+ expected: "string",
1112
+ code: "invalid_type",
1113
+ input: payload.value,
1114
+ inst
1115
+ });
1116
+ return payload;
1117
+ };
1118
+ });
1119
+ const $ZodStringFormat = /*@__PURE__*/ $constructor("$ZodStringFormat", (inst, def) => {
1120
+ $ZodCheckStringFormat.init(inst, def);
1121
+ $ZodString.init(inst, def);
1122
+ });
1123
+ const $ZodGUID = /*@__PURE__*/ $constructor("$ZodGUID", (inst, def) => {
1124
+ def.pattern ?? (def.pattern = guid);
1125
+ $ZodStringFormat.init(inst, def);
1126
+ });
1127
+ const $ZodUUID = /*@__PURE__*/ $constructor("$ZodUUID", (inst, def) => {
1128
+ if (def.version) {
1129
+ const v = {
1130
+ v1: 1,
1131
+ v2: 2,
1132
+ v3: 3,
1133
+ v4: 4,
1134
+ v5: 5,
1135
+ v6: 6,
1136
+ v7: 7,
1137
+ v8: 8
1138
+ }[def.version];
1139
+ if (v === void 0) throw new Error(`Invalid UUID version: "${def.version}"`);
1140
+ def.pattern ?? (def.pattern = uuid(v));
1141
+ } else def.pattern ?? (def.pattern = uuid());
1142
+ $ZodStringFormat.init(inst, def);
1143
+ });
1144
+ const $ZodEmail = /*@__PURE__*/ $constructor("$ZodEmail", (inst, def) => {
1145
+ def.pattern ?? (def.pattern = email);
1146
+ $ZodStringFormat.init(inst, def);
1147
+ });
1148
+ const $ZodURL = /*@__PURE__*/ $constructor("$ZodURL", (inst, def) => {
1149
+ $ZodStringFormat.init(inst, def);
1150
+ inst._zod.check = (payload) => {
1151
+ try {
1152
+ const trimmed = payload.value.trim();
1153
+ if (!def.normalize && def.protocol?.source === httpProtocol.source) {
1154
+ if (!/^https?:\/\//i.test(trimmed)) {
1155
+ payload.issues.push({
1156
+ code: "invalid_format",
1157
+ format: "url",
1158
+ note: "Invalid URL format",
1159
+ input: payload.value,
1160
+ inst,
1161
+ continue: !def.abort
1162
+ });
1163
+ return;
1164
+ }
1165
+ }
1166
+ const url = new URL(trimmed);
1167
+ if (def.hostname) {
1168
+ def.hostname.lastIndex = 0;
1169
+ if (!def.hostname.test(url.hostname)) payload.issues.push({
1170
+ code: "invalid_format",
1171
+ format: "url",
1172
+ note: "Invalid hostname",
1173
+ pattern: def.hostname.source,
1174
+ input: payload.value,
1175
+ inst,
1176
+ continue: !def.abort
1177
+ });
1178
+ }
1179
+ if (def.protocol) {
1180
+ def.protocol.lastIndex = 0;
1181
+ if (!def.protocol.test(url.protocol.endsWith(":") ? url.protocol.slice(0, -1) : url.protocol)) payload.issues.push({
1182
+ code: "invalid_format",
1183
+ format: "url",
1184
+ note: "Invalid protocol",
1185
+ pattern: def.protocol.source,
1186
+ input: payload.value,
1187
+ inst,
1188
+ continue: !def.abort
1189
+ });
1190
+ }
1191
+ if (def.normalize) payload.value = url.href;
1192
+ else payload.value = trimmed;
1193
+ return;
1194
+ } catch (_) {
1195
+ payload.issues.push({
1196
+ code: "invalid_format",
1197
+ format: "url",
1198
+ input: payload.value,
1199
+ inst,
1200
+ continue: !def.abort
1201
+ });
1202
+ }
1203
+ };
1204
+ });
1205
+ const $ZodEmoji = /*@__PURE__*/ $constructor("$ZodEmoji", (inst, def) => {
1206
+ def.pattern ?? (def.pattern = emoji());
1207
+ $ZodStringFormat.init(inst, def);
1208
+ });
1209
+ const $ZodNanoID = /*@__PURE__*/ $constructor("$ZodNanoID", (inst, def) => {
1210
+ def.pattern ?? (def.pattern = nanoid);
1211
+ $ZodStringFormat.init(inst, def);
1212
+ });
1213
+ /**
1214
+ * @deprecated CUID v1 is deprecated by its authors due to information leakage
1215
+ * (timestamps embedded in the id). Use {@link $ZodCUID2} instead.
1216
+ * See https://github.com/paralleldrive/cuid.
1217
+ */
1218
+ const $ZodCUID = /*@__PURE__*/ $constructor("$ZodCUID", (inst, def) => {
1219
+ def.pattern ?? (def.pattern = cuid);
1220
+ $ZodStringFormat.init(inst, def);
1221
+ });
1222
+ const $ZodCUID2 = /*@__PURE__*/ $constructor("$ZodCUID2", (inst, def) => {
1223
+ def.pattern ?? (def.pattern = cuid2);
1224
+ $ZodStringFormat.init(inst, def);
1225
+ });
1226
+ const $ZodULID = /*@__PURE__*/ $constructor("$ZodULID", (inst, def) => {
1227
+ def.pattern ?? (def.pattern = ulid);
1228
+ $ZodStringFormat.init(inst, def);
1229
+ });
1230
+ const $ZodXID = /*@__PURE__*/ $constructor("$ZodXID", (inst, def) => {
1231
+ def.pattern ?? (def.pattern = xid);
1232
+ $ZodStringFormat.init(inst, def);
1233
+ });
1234
+ const $ZodKSUID = /*@__PURE__*/ $constructor("$ZodKSUID", (inst, def) => {
1235
+ def.pattern ?? (def.pattern = ksuid);
1236
+ $ZodStringFormat.init(inst, def);
1237
+ });
1238
+ const $ZodISODateTime = /*@__PURE__*/ $constructor("$ZodISODateTime", (inst, def) => {
1239
+ def.pattern ?? (def.pattern = datetime$1(def));
1240
+ $ZodStringFormat.init(inst, def);
1241
+ });
1242
+ const $ZodISODate = /*@__PURE__*/ $constructor("$ZodISODate", (inst, def) => {
1243
+ def.pattern ?? (def.pattern = date$1);
1244
+ $ZodStringFormat.init(inst, def);
1245
+ });
1246
+ const $ZodISOTime = /*@__PURE__*/ $constructor("$ZodISOTime", (inst, def) => {
1247
+ def.pattern ?? (def.pattern = time$1(def));
1248
+ $ZodStringFormat.init(inst, def);
1249
+ });
1250
+ const $ZodISODuration = /*@__PURE__*/ $constructor("$ZodISODuration", (inst, def) => {
1251
+ def.pattern ?? (def.pattern = duration$1);
1252
+ $ZodStringFormat.init(inst, def);
1253
+ });
1254
+ const $ZodIPv4 = /*@__PURE__*/ $constructor("$ZodIPv4", (inst, def) => {
1255
+ def.pattern ?? (def.pattern = ipv4);
1256
+ $ZodStringFormat.init(inst, def);
1257
+ inst._zod.bag.format = `ipv4`;
1258
+ });
1259
+ const $ZodIPv6 = /*@__PURE__*/ $constructor("$ZodIPv6", (inst, def) => {
1260
+ def.pattern ?? (def.pattern = ipv6);
1261
+ $ZodStringFormat.init(inst, def);
1262
+ inst._zod.bag.format = `ipv6`;
1263
+ inst._zod.check = (payload) => {
1264
+ try {
1265
+ new URL(`http://[${payload.value}]`);
1266
+ } catch {
1267
+ payload.issues.push({
1268
+ code: "invalid_format",
1269
+ format: "ipv6",
1270
+ input: payload.value,
1271
+ inst,
1272
+ continue: !def.abort
1273
+ });
1274
+ }
1275
+ };
1276
+ });
1277
+ const $ZodCIDRv4 = /*@__PURE__*/ $constructor("$ZodCIDRv4", (inst, def) => {
1278
+ def.pattern ?? (def.pattern = cidrv4);
1279
+ $ZodStringFormat.init(inst, def);
1280
+ });
1281
+ const $ZodCIDRv6 = /*@__PURE__*/ $constructor("$ZodCIDRv6", (inst, def) => {
1282
+ def.pattern ?? (def.pattern = cidrv6);
1283
+ $ZodStringFormat.init(inst, def);
1284
+ inst._zod.check = (payload) => {
1285
+ const parts = payload.value.split("/");
1286
+ try {
1287
+ if (parts.length !== 2) throw new Error();
1288
+ const [address, prefix] = parts;
1289
+ if (!prefix) throw new Error();
1290
+ const prefixNum = Number(prefix);
1291
+ if (`${prefixNum}` !== prefix) throw new Error();
1292
+ if (prefixNum < 0 || prefixNum > 128) throw new Error();
1293
+ new URL(`http://[${address}]`);
1294
+ } catch {
1295
+ payload.issues.push({
1296
+ code: "invalid_format",
1297
+ format: "cidrv6",
1298
+ input: payload.value,
1299
+ inst,
1300
+ continue: !def.abort
1301
+ });
1302
+ }
1303
+ };
1304
+ });
1305
+ function isValidBase64(data) {
1306
+ if (data === "") return true;
1307
+ if (/\s/.test(data)) return false;
1308
+ if (data.length % 4 !== 0) return false;
1309
+ try {
1310
+ atob(data);
1311
+ return true;
1312
+ } catch {
1313
+ return false;
1314
+ }
1315
+ }
1316
+ const $ZodBase64 = /*@__PURE__*/ $constructor("$ZodBase64", (inst, def) => {
1317
+ def.pattern ?? (def.pattern = base64);
1318
+ $ZodStringFormat.init(inst, def);
1319
+ inst._zod.bag.contentEncoding = "base64";
1320
+ inst._zod.check = (payload) => {
1321
+ if (isValidBase64(payload.value)) return;
1322
+ payload.issues.push({
1323
+ code: "invalid_format",
1324
+ format: "base64",
1325
+ input: payload.value,
1326
+ inst,
1327
+ continue: !def.abort
1328
+ });
1329
+ };
1330
+ });
1331
+ function isValidBase64URL(data) {
1332
+ if (!base64url.test(data)) return false;
1333
+ const base64 = data.replace(/[-_]/g, (c) => c === "-" ? "+" : "/");
1334
+ return isValidBase64(base64.padEnd(Math.ceil(base64.length / 4) * 4, "="));
1335
+ }
1336
+ const $ZodBase64URL = /*@__PURE__*/ $constructor("$ZodBase64URL", (inst, def) => {
1337
+ def.pattern ?? (def.pattern = base64url);
1338
+ $ZodStringFormat.init(inst, def);
1339
+ inst._zod.bag.contentEncoding = "base64url";
1340
+ inst._zod.check = (payload) => {
1341
+ if (isValidBase64URL(payload.value)) return;
1342
+ payload.issues.push({
1343
+ code: "invalid_format",
1344
+ format: "base64url",
1345
+ input: payload.value,
1346
+ inst,
1347
+ continue: !def.abort
1348
+ });
1349
+ };
1350
+ });
1351
+ const $ZodE164 = /*@__PURE__*/ $constructor("$ZodE164", (inst, def) => {
1352
+ def.pattern ?? (def.pattern = e164);
1353
+ $ZodStringFormat.init(inst, def);
1354
+ });
1355
+ function isValidJWT(token, algorithm = null) {
1356
+ try {
1357
+ const tokensParts = token.split(".");
1358
+ if (tokensParts.length !== 3) return false;
1359
+ const [header] = tokensParts;
1360
+ if (!header) return false;
1361
+ const parsedHeader = JSON.parse(atob(header));
1362
+ if ("typ" in parsedHeader && parsedHeader?.typ !== "JWT") return false;
1363
+ if (!parsedHeader.alg) return false;
1364
+ if (algorithm && (!("alg" in parsedHeader) || parsedHeader.alg !== algorithm)) return false;
1365
+ return true;
1366
+ } catch {
1367
+ return false;
1368
+ }
1369
+ }
1370
+ const $ZodJWT = /*@__PURE__*/ $constructor("$ZodJWT", (inst, def) => {
1371
+ $ZodStringFormat.init(inst, def);
1372
+ inst._zod.check = (payload) => {
1373
+ if (isValidJWT(payload.value, def.alg)) return;
1374
+ payload.issues.push({
1375
+ code: "invalid_format",
1376
+ format: "jwt",
1377
+ input: payload.value,
1378
+ inst,
1379
+ continue: !def.abort
1380
+ });
1381
+ };
1382
+ });
1383
+ const $ZodNumber = /*@__PURE__*/ $constructor("$ZodNumber", (inst, def) => {
1384
+ $ZodType.init(inst, def);
1385
+ inst._zod.pattern = inst._zod.bag.pattern ?? number$1;
1386
+ inst._zod.parse = (payload, _ctx) => {
1387
+ if (def.coerce) try {
1388
+ payload.value = Number(payload.value);
1389
+ } catch (_) {}
1390
+ const input = payload.value;
1391
+ if (typeof input === "number" && !Number.isNaN(input) && Number.isFinite(input)) return payload;
1392
+ const received = typeof input === "number" ? Number.isNaN(input) ? "NaN" : !Number.isFinite(input) ? "Infinity" : void 0 : void 0;
1393
+ payload.issues.push({
1394
+ expected: "number",
1395
+ code: "invalid_type",
1396
+ input,
1397
+ inst,
1398
+ ...received ? { received } : {}
1399
+ });
1400
+ return payload;
1401
+ };
1402
+ });
1403
+ const $ZodNumberFormat = /*@__PURE__*/ $constructor("$ZodNumberFormat", (inst, def) => {
1404
+ $ZodCheckNumberFormat.init(inst, def);
1405
+ $ZodNumber.init(inst, def);
1406
+ });
1407
+ const $ZodBoolean = /*@__PURE__*/ $constructor("$ZodBoolean", (inst, def) => {
1408
+ $ZodType.init(inst, def);
1409
+ inst._zod.pattern = boolean$1;
1410
+ inst._zod.parse = (payload, _ctx) => {
1411
+ if (def.coerce) try {
1412
+ payload.value = Boolean(payload.value);
1413
+ } catch (_) {}
1414
+ const input = payload.value;
1415
+ if (typeof input === "boolean") return payload;
1416
+ payload.issues.push({
1417
+ expected: "boolean",
1418
+ code: "invalid_type",
1419
+ input,
1420
+ inst
1421
+ });
1422
+ return payload;
1423
+ };
1424
+ });
1425
+ const $ZodNull = /*@__PURE__*/ $constructor("$ZodNull", (inst, def) => {
1426
+ $ZodType.init(inst, def);
1427
+ inst._zod.pattern = _null$2;
1428
+ inst._zod.values = /* @__PURE__ */ new Set([null]);
1429
+ inst._zod.parse = (payload, _ctx) => {
1430
+ const input = payload.value;
1431
+ if (input === null) return payload;
1432
+ payload.issues.push({
1433
+ expected: "null",
1434
+ code: "invalid_type",
1435
+ input,
1436
+ inst
1437
+ });
1438
+ return payload;
1439
+ };
1440
+ });
1441
+ const $ZodAny = /*@__PURE__*/ $constructor("$ZodAny", (inst, def) => {
1442
+ $ZodType.init(inst, def);
1443
+ inst._zod.parse = (payload) => payload;
1444
+ });
1445
+ const $ZodUnknown = /*@__PURE__*/ $constructor("$ZodUnknown", (inst, def) => {
1446
+ $ZodType.init(inst, def);
1447
+ inst._zod.parse = (payload) => payload;
1448
+ });
1449
+ const $ZodNever = /*@__PURE__*/ $constructor("$ZodNever", (inst, def) => {
1450
+ $ZodType.init(inst, def);
1451
+ inst._zod.parse = (payload, _ctx) => {
1452
+ payload.issues.push({
1453
+ expected: "never",
1454
+ code: "invalid_type",
1455
+ input: payload.value,
1456
+ inst
1457
+ });
1458
+ return payload;
1459
+ };
1460
+ });
1461
+ function handleArrayResult(result, final, index) {
1462
+ if (result.issues.length) final.issues.push(...prefixIssues(index, result.issues));
1463
+ final.value[index] = result.value;
1464
+ }
1465
+ const $ZodArray = /*@__PURE__*/ $constructor("$ZodArray", (inst, def) => {
1466
+ $ZodType.init(inst, def);
1467
+ inst._zod.parse = (payload, ctx) => {
1468
+ const input = payload.value;
1469
+ if (!Array.isArray(input)) {
1470
+ payload.issues.push({
1471
+ expected: "array",
1472
+ code: "invalid_type",
1473
+ input,
1474
+ inst
1475
+ });
1476
+ return payload;
1477
+ }
1478
+ payload.value = Array(input.length);
1479
+ const proms = [];
1480
+ for (let i = 0; i < input.length; i++) {
1481
+ const item = input[i];
1482
+ const result = def.element._zod.run({
1483
+ value: item,
1484
+ issues: []
1485
+ }, ctx);
1486
+ if (result instanceof Promise) proms.push(result.then((result) => handleArrayResult(result, payload, i)));
1487
+ else handleArrayResult(result, payload, i);
1488
+ }
1489
+ if (proms.length) return Promise.all(proms).then(() => payload);
1490
+ return payload;
1491
+ };
1492
+ });
1493
+ function handlePropertyResult(result, final, key, input, isOptionalIn, isOptionalOut) {
1494
+ const isPresent = key in input;
1495
+ if (result.issues.length) {
1496
+ if (isOptionalIn && isOptionalOut && !isPresent) return;
1497
+ final.issues.push(...prefixIssues(key, result.issues));
1498
+ }
1499
+ if (!isPresent && !isOptionalIn) {
1500
+ if (!result.issues.length) final.issues.push({
1501
+ code: "invalid_type",
1502
+ expected: "nonoptional",
1503
+ input: void 0,
1504
+ path: [key]
1505
+ });
1506
+ return;
1507
+ }
1508
+ if (result.value === void 0) {
1509
+ if (isPresent) final.value[key] = void 0;
1510
+ } else final.value[key] = result.value;
1511
+ }
1512
+ function normalizeDef(def) {
1513
+ const keys = Object.keys(def.shape);
1514
+ 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`);
1515
+ const okeys = optionalKeys(def.shape);
1516
+ return {
1517
+ ...def,
1518
+ keys,
1519
+ keySet: new Set(keys),
1520
+ numKeys: keys.length,
1521
+ optionalKeys: new Set(okeys)
1522
+ };
1523
+ }
1524
+ function handleCatchall(proms, input, payload, ctx, def, inst) {
1525
+ const unrecognized = [];
1526
+ const keySet = def.keySet;
1527
+ const _catchall = def.catchall._zod;
1528
+ const t = _catchall.def.type;
1529
+ const isOptionalIn = _catchall.optin === "optional";
1530
+ const isOptionalOut = _catchall.optout === "optional";
1531
+ for (const key in input) {
1532
+ if (key === "__proto__") continue;
1533
+ if (keySet.has(key)) continue;
1534
+ if (t === "never") {
1535
+ unrecognized.push(key);
1536
+ continue;
1537
+ }
1538
+ const r = _catchall.run({
1539
+ value: input[key],
1540
+ issues: []
1541
+ }, ctx);
1542
+ if (r instanceof Promise) proms.push(r.then((r) => handlePropertyResult(r, payload, key, input, isOptionalIn, isOptionalOut)));
1543
+ else handlePropertyResult(r, payload, key, input, isOptionalIn, isOptionalOut);
1544
+ }
1545
+ if (unrecognized.length) payload.issues.push({
1546
+ code: "unrecognized_keys",
1547
+ keys: unrecognized,
1548
+ input,
1549
+ inst
1550
+ });
1551
+ if (!proms.length) return payload;
1552
+ return Promise.all(proms).then(() => {
1553
+ return payload;
1554
+ });
1555
+ }
1556
+ const $ZodObject = /*@__PURE__*/ $constructor("$ZodObject", (inst, def) => {
1557
+ $ZodType.init(inst, def);
1558
+ if (!Object.getOwnPropertyDescriptor(def, "shape")?.get) {
1559
+ const sh = def.shape;
1560
+ Object.defineProperty(def, "shape", { get: () => {
1561
+ const newSh = { ...sh };
1562
+ Object.defineProperty(def, "shape", { value: newSh });
1563
+ return newSh;
1564
+ } });
1565
+ }
1566
+ const _normalized = cached(() => normalizeDef(def));
1567
+ defineLazy(inst._zod, "propValues", () => {
1568
+ const shape = def.shape;
1569
+ const propValues = {};
1570
+ for (const key in shape) {
1571
+ const field = shape[key]._zod;
1572
+ if (field.values) {
1573
+ propValues[key] ?? (propValues[key] = /* @__PURE__ */ new Set());
1574
+ for (const v of field.values) propValues[key].add(v);
1575
+ }
1576
+ }
1577
+ return propValues;
1578
+ });
1579
+ const isObject$2 = isObject;
1580
+ const catchall = def.catchall;
1581
+ let value;
1582
+ inst._zod.parse = (payload, ctx) => {
1583
+ value ?? (value = _normalized.value);
1584
+ const input = payload.value;
1585
+ if (!isObject$2(input)) {
1586
+ payload.issues.push({
1587
+ expected: "object",
1588
+ code: "invalid_type",
1589
+ input,
1590
+ inst
1591
+ });
1592
+ return payload;
1593
+ }
1594
+ payload.value = {};
1595
+ const proms = [];
1596
+ const shape = value.shape;
1597
+ for (const key of value.keys) {
1598
+ const el = shape[key];
1599
+ const isOptionalIn = el._zod.optin === "optional";
1600
+ const isOptionalOut = el._zod.optout === "optional";
1601
+ const r = el._zod.run({
1602
+ value: input[key],
1603
+ issues: []
1604
+ }, ctx);
1605
+ if (r instanceof Promise) proms.push(r.then((r) => handlePropertyResult(r, payload, key, input, isOptionalIn, isOptionalOut)));
1606
+ else handlePropertyResult(r, payload, key, input, isOptionalIn, isOptionalOut);
1607
+ }
1608
+ if (!catchall) return proms.length ? Promise.all(proms).then(() => payload) : payload;
1609
+ return handleCatchall(proms, input, payload, ctx, _normalized.value, inst);
1610
+ };
1611
+ });
1612
+ const $ZodObjectJIT = /*@__PURE__*/ $constructor("$ZodObjectJIT", (inst, def) => {
1613
+ $ZodObject.init(inst, def);
1614
+ const superParse = inst._zod.parse;
1615
+ const _normalized = cached(() => normalizeDef(def));
1616
+ const generateFastpass = (shape) => {
1617
+ const doc = new Doc([
1618
+ "shape",
1619
+ "payload",
1620
+ "ctx"
1621
+ ]);
1622
+ const normalized = _normalized.value;
1623
+ const parseStr = (key) => {
1624
+ const k = esc(key);
1625
+ return `shape[${k}]._zod.run({ value: input[${k}], issues: [] }, ctx)`;
1626
+ };
1627
+ doc.write(`const input = payload.value;`);
1628
+ const ids = Object.create(null);
1629
+ let counter = 0;
1630
+ for (const key of normalized.keys) ids[key] = `key_${counter++}`;
1631
+ doc.write(`const newResult = {};`);
1632
+ for (const key of normalized.keys) {
1633
+ const id = ids[key];
1634
+ const k = esc(key);
1635
+ const schema = shape[key];
1636
+ const isOptionalIn = schema?._zod?.optin === "optional";
1637
+ const isOptionalOut = schema?._zod?.optout === "optional";
1638
+ doc.write(`const ${id} = ${parseStr(key)};`);
1639
+ if (isOptionalIn && isOptionalOut) doc.write(`
1640
+ if (${id}.issues.length) {
1641
+ if (${k} in input) {
1642
+ payload.issues = payload.issues.concat(${id}.issues.map(iss => ({
1643
+ ...iss,
1644
+ path: iss.path ? [${k}, ...iss.path] : [${k}]
1645
+ })));
1646
+ }
1647
+ }
1648
+
1649
+ if (${id}.value === undefined) {
1650
+ if (${k} in input) {
1651
+ newResult[${k}] = undefined;
1652
+ }
1653
+ } else {
1654
+ newResult[${k}] = ${id}.value;
1655
+ }
1656
+
1657
+ `);
1658
+ else if (!isOptionalIn) doc.write(`
1659
+ const ${id}_present = ${k} in input;
1660
+ if (${id}.issues.length) {
1661
+ payload.issues = payload.issues.concat(${id}.issues.map(iss => ({
1662
+ ...iss,
1663
+ path: iss.path ? [${k}, ...iss.path] : [${k}]
1664
+ })));
1665
+ }
1666
+ if (!${id}_present && !${id}.issues.length) {
1667
+ payload.issues.push({
1668
+ code: "invalid_type",
1669
+ expected: "nonoptional",
1670
+ input: undefined,
1671
+ path: [${k}]
1672
+ });
1673
+ }
1674
+
1675
+ if (${id}_present) {
1676
+ if (${id}.value === undefined) {
1677
+ newResult[${k}] = undefined;
1678
+ } else {
1679
+ newResult[${k}] = ${id}.value;
1680
+ }
1681
+ }
1682
+
1683
+ `);
1684
+ else doc.write(`
1685
+ if (${id}.issues.length) {
1686
+ payload.issues = payload.issues.concat(${id}.issues.map(iss => ({
1687
+ ...iss,
1688
+ path: iss.path ? [${k}, ...iss.path] : [${k}]
1689
+ })));
1690
+ }
1691
+
1692
+ if (${id}.value === undefined) {
1693
+ if (${k} in input) {
1694
+ newResult[${k}] = undefined;
1695
+ }
1696
+ } else {
1697
+ newResult[${k}] = ${id}.value;
1698
+ }
1699
+
1700
+ `);
1701
+ }
1702
+ doc.write(`payload.value = newResult;`);
1703
+ doc.write(`return payload;`);
1704
+ const fn = doc.compile();
1705
+ return (payload, ctx) => fn(shape, payload, ctx);
1706
+ };
1707
+ let fastpass;
1708
+ const isObject$1 = isObject;
1709
+ const jit = !globalConfig.jitless;
1710
+ const fastEnabled = jit && allowsEval.value;
1711
+ const catchall = def.catchall;
1712
+ let value;
1713
+ inst._zod.parse = (payload, ctx) => {
1714
+ value ?? (value = _normalized.value);
1715
+ const input = payload.value;
1716
+ if (!isObject$1(input)) {
1717
+ payload.issues.push({
1718
+ expected: "object",
1719
+ code: "invalid_type",
1720
+ input,
1721
+ inst
1722
+ });
1723
+ return payload;
1724
+ }
1725
+ if (jit && fastEnabled && ctx?.async === false && ctx.jitless !== true) {
1726
+ if (!fastpass) fastpass = generateFastpass(def.shape);
1727
+ payload = fastpass(payload, ctx);
1728
+ if (!catchall) return payload;
1729
+ return handleCatchall([], input, payload, ctx, value, inst);
1730
+ }
1731
+ return superParse(payload, ctx);
1732
+ };
1733
+ });
1734
+ function handleUnionResults(results, final, inst, ctx) {
1735
+ for (const result of results) if (result.issues.length === 0) {
1736
+ final.value = result.value;
1737
+ return final;
1738
+ }
1739
+ const nonaborted = results.filter((r) => !aborted(r));
1740
+ if (nonaborted.length === 1) {
1741
+ final.value = nonaborted[0].value;
1742
+ return nonaborted[0];
1743
+ }
1744
+ final.issues.push({
1745
+ code: "invalid_union",
1746
+ input: final.value,
1747
+ inst,
1748
+ errors: results.map((result) => result.issues.map((iss) => finalizeIssue(iss, ctx, config())))
1749
+ });
1750
+ return final;
1751
+ }
1752
+ const $ZodUnion = /*@__PURE__*/ $constructor("$ZodUnion", (inst, def) => {
1753
+ $ZodType.init(inst, def);
1754
+ defineLazy(inst._zod, "optin", () => def.options.some((o) => o._zod.optin === "optional") ? "optional" : void 0);
1755
+ defineLazy(inst._zod, "optout", () => def.options.some((o) => o._zod.optout === "optional") ? "optional" : void 0);
1756
+ defineLazy(inst._zod, "values", () => {
1757
+ if (def.options.every((o) => o._zod.values)) return new Set(def.options.flatMap((option) => Array.from(option._zod.values)));
1758
+ });
1759
+ defineLazy(inst._zod, "pattern", () => {
1760
+ if (def.options.every((o) => o._zod.pattern)) {
1761
+ const patterns = def.options.map((o) => o._zod.pattern);
1762
+ return new RegExp(`^(${patterns.map((p) => cleanRegex(p.source)).join("|")})$`);
1763
+ }
1764
+ });
1765
+ const first = def.options.length === 1 ? def.options[0]._zod.run : null;
1766
+ inst._zod.parse = (payload, ctx) => {
1767
+ if (first) return first(payload, ctx);
1768
+ let async = false;
1769
+ const results = [];
1770
+ for (const option of def.options) {
1771
+ const result = option._zod.run({
1772
+ value: payload.value,
1773
+ issues: []
1774
+ }, ctx);
1775
+ if (result instanceof Promise) {
1776
+ results.push(result);
1777
+ async = true;
1778
+ } else {
1779
+ if (result.issues.length === 0) return result;
1780
+ results.push(result);
1781
+ }
1782
+ }
1783
+ if (!async) return handleUnionResults(results, payload, inst, ctx);
1784
+ return Promise.all(results).then((results) => {
1785
+ return handleUnionResults(results, payload, inst, ctx);
1786
+ });
1787
+ };
1788
+ });
1789
+ const $ZodDiscriminatedUnion = /*@__PURE__*/ $constructor("$ZodDiscriminatedUnion", (inst, def) => {
1790
+ def.inclusive = false;
1791
+ $ZodUnion.init(inst, def);
1792
+ const _super = inst._zod.parse;
1793
+ defineLazy(inst._zod, "propValues", () => {
1794
+ const propValues = {};
1795
+ for (const option of def.options) {
1796
+ const pv = option._zod.propValues;
1797
+ if (!pv || Object.keys(pv).length === 0) throw new Error(`Invalid discriminated union option at index "${def.options.indexOf(option)}"`);
1798
+ for (const [k, v] of Object.entries(pv)) {
1799
+ if (!propValues[k]) propValues[k] = /* @__PURE__ */ new Set();
1800
+ for (const val of v) propValues[k].add(val);
1801
+ }
1802
+ }
1803
+ return propValues;
1804
+ });
1805
+ const disc = cached(() => {
1806
+ const opts = def.options;
1807
+ const map = /* @__PURE__ */ new Map();
1808
+ for (const o of opts) {
1809
+ const values = o._zod.propValues?.[def.discriminator];
1810
+ if (!values || values.size === 0) throw new Error(`Invalid discriminated union option at index "${def.options.indexOf(o)}"`);
1811
+ for (const v of values) {
1812
+ if (map.has(v)) throw new Error(`Duplicate discriminator value "${String(v)}"`);
1813
+ map.set(v, o);
1814
+ }
1815
+ }
1816
+ return map;
1817
+ });
1818
+ inst._zod.parse = (payload, ctx) => {
1819
+ const input = payload.value;
1820
+ if (!isObject(input)) {
1821
+ payload.issues.push({
1822
+ code: "invalid_type",
1823
+ expected: "object",
1824
+ input,
1825
+ inst
1826
+ });
1827
+ return payload;
1828
+ }
1829
+ const opt = disc.value.get(input?.[def.discriminator]);
1830
+ if (opt) return opt._zod.run(payload, ctx);
1831
+ if (def.unionFallback || ctx.direction === "backward") return _super(payload, ctx);
1832
+ payload.issues.push({
1833
+ code: "invalid_union",
1834
+ errors: [],
1835
+ note: "No matching discriminator",
1836
+ discriminator: def.discriminator,
1837
+ options: Array.from(disc.value.keys()),
1838
+ input,
1839
+ path: [def.discriminator],
1840
+ inst
1841
+ });
1842
+ return payload;
1843
+ };
1844
+ });
1845
+ const $ZodIntersection = /*@__PURE__*/ $constructor("$ZodIntersection", (inst, def) => {
1846
+ $ZodType.init(inst, def);
1847
+ inst._zod.parse = (payload, ctx) => {
1848
+ const input = payload.value;
1849
+ const left = def.left._zod.run({
1850
+ value: input,
1851
+ issues: []
1852
+ }, ctx);
1853
+ const right = def.right._zod.run({
1854
+ value: input,
1855
+ issues: []
1856
+ }, ctx);
1857
+ if (left instanceof Promise || right instanceof Promise) return Promise.all([left, right]).then(([left, right]) => {
1858
+ return handleIntersectionResults(payload, left, right);
1859
+ });
1860
+ return handleIntersectionResults(payload, left, right);
1861
+ };
1862
+ });
1863
+ function mergeValues(a, b) {
1864
+ if (a === b) return {
1865
+ valid: true,
1866
+ data: a
1867
+ };
1868
+ if (a instanceof Date && b instanceof Date && +a === +b) return {
1869
+ valid: true,
1870
+ data: a
1871
+ };
1872
+ if (isPlainObject(a) && isPlainObject(b)) {
1873
+ const bKeys = Object.keys(b);
1874
+ const sharedKeys = Object.keys(a).filter((key) => bKeys.indexOf(key) !== -1);
1875
+ const newObj = {
1876
+ ...a,
1877
+ ...b
1878
+ };
1879
+ for (const key of sharedKeys) {
1880
+ const sharedValue = mergeValues(a[key], b[key]);
1881
+ if (!sharedValue.valid) return {
1882
+ valid: false,
1883
+ mergeErrorPath: [key, ...sharedValue.mergeErrorPath]
1884
+ };
1885
+ newObj[key] = sharedValue.data;
1886
+ }
1887
+ return {
1888
+ valid: true,
1889
+ data: newObj
1890
+ };
1891
+ }
1892
+ if (Array.isArray(a) && Array.isArray(b)) {
1893
+ if (a.length !== b.length) return {
1894
+ valid: false,
1895
+ mergeErrorPath: []
1896
+ };
1897
+ const newArray = [];
1898
+ for (let index = 0; index < a.length; index++) {
1899
+ const itemA = a[index];
1900
+ const itemB = b[index];
1901
+ const sharedValue = mergeValues(itemA, itemB);
1902
+ if (!sharedValue.valid) return {
1903
+ valid: false,
1904
+ mergeErrorPath: [index, ...sharedValue.mergeErrorPath]
1905
+ };
1906
+ newArray.push(sharedValue.data);
1907
+ }
1908
+ return {
1909
+ valid: true,
1910
+ data: newArray
1911
+ };
1912
+ }
1913
+ return {
1914
+ valid: false,
1915
+ mergeErrorPath: []
1916
+ };
1917
+ }
1918
+ function handleIntersectionResults(result, left, right) {
1919
+ const unrecKeys = /* @__PURE__ */ new Map();
1920
+ let unrecIssue;
1921
+ for (const iss of left.issues) if (iss.code === "unrecognized_keys") {
1922
+ unrecIssue ?? (unrecIssue = iss);
1923
+ for (const k of iss.keys) {
1924
+ if (!unrecKeys.has(k)) unrecKeys.set(k, {});
1925
+ unrecKeys.get(k).l = true;
1926
+ }
1927
+ } else result.issues.push(iss);
1928
+ for (const iss of right.issues) if (iss.code === "unrecognized_keys") for (const k of iss.keys) {
1929
+ if (!unrecKeys.has(k)) unrecKeys.set(k, {});
1930
+ unrecKeys.get(k).r = true;
1931
+ }
1932
+ else result.issues.push(iss);
1933
+ const bothKeys = [...unrecKeys].filter(([, f]) => f.l && f.r).map(([k]) => k);
1934
+ if (bothKeys.length && unrecIssue) result.issues.push({
1935
+ ...unrecIssue,
1936
+ keys: bothKeys
1937
+ });
1938
+ if (aborted(result)) return result;
1939
+ const merged = mergeValues(left.value, right.value);
1940
+ if (!merged.valid) throw new Error(`Unmergable intersection. Error path: ${JSON.stringify(merged.mergeErrorPath)}`);
1941
+ result.value = merged.data;
1942
+ return result;
1943
+ }
1944
+ const $ZodRecord = /*@__PURE__*/ $constructor("$ZodRecord", (inst, def) => {
1945
+ $ZodType.init(inst, def);
1946
+ inst._zod.parse = (payload, ctx) => {
1947
+ const input = payload.value;
1948
+ if (!isPlainObject(input)) {
1949
+ payload.issues.push({
1950
+ expected: "record",
1951
+ code: "invalid_type",
1952
+ input,
1953
+ inst
1954
+ });
1955
+ return payload;
1956
+ }
1957
+ const proms = [];
1958
+ const values = def.keyType._zod.values;
1959
+ if (values) {
1960
+ payload.value = {};
1961
+ const recordKeys = /* @__PURE__ */ new Set();
1962
+ for (const key of values) if (typeof key === "string" || typeof key === "number" || typeof key === "symbol") {
1963
+ recordKeys.add(typeof key === "number" ? key.toString() : key);
1964
+ const keyResult = def.keyType._zod.run({
1965
+ value: key,
1966
+ issues: []
1967
+ }, ctx);
1968
+ if (keyResult instanceof Promise) throw new Error("Async schemas not supported in object keys currently");
1969
+ if (keyResult.issues.length) {
1970
+ payload.issues.push({
1971
+ code: "invalid_key",
1972
+ origin: "record",
1973
+ issues: keyResult.issues.map((iss) => finalizeIssue(iss, ctx, config())),
1974
+ input: key,
1975
+ path: [key],
1976
+ inst
1977
+ });
1978
+ continue;
1979
+ }
1980
+ const outKey = keyResult.value;
1981
+ const result = def.valueType._zod.run({
1982
+ value: input[key],
1983
+ issues: []
1984
+ }, ctx);
1985
+ if (result instanceof Promise) proms.push(result.then((result) => {
1986
+ if (result.issues.length) payload.issues.push(...prefixIssues(key, result.issues));
1987
+ payload.value[outKey] = result.value;
1988
+ }));
1989
+ else {
1990
+ if (result.issues.length) payload.issues.push(...prefixIssues(key, result.issues));
1991
+ payload.value[outKey] = result.value;
1992
+ }
1993
+ }
1994
+ let unrecognized;
1995
+ for (const key in input) if (!recordKeys.has(key)) {
1996
+ unrecognized = unrecognized ?? [];
1997
+ unrecognized.push(key);
1998
+ }
1999
+ if (unrecognized && unrecognized.length > 0) payload.issues.push({
2000
+ code: "unrecognized_keys",
2001
+ input,
2002
+ inst,
2003
+ keys: unrecognized
2004
+ });
2005
+ } else {
2006
+ payload.value = {};
2007
+ for (const key of Reflect.ownKeys(input)) {
2008
+ if (key === "__proto__") continue;
2009
+ if (!Object.prototype.propertyIsEnumerable.call(input, key)) continue;
2010
+ let keyResult = def.keyType._zod.run({
2011
+ value: key,
2012
+ issues: []
2013
+ }, ctx);
2014
+ if (keyResult instanceof Promise) throw new Error("Async schemas not supported in object keys currently");
2015
+ if (typeof key === "string" && number$1.test(key) && keyResult.issues.length) {
2016
+ const retryResult = def.keyType._zod.run({
2017
+ value: Number(key),
2018
+ issues: []
2019
+ }, ctx);
2020
+ if (retryResult instanceof Promise) throw new Error("Async schemas not supported in object keys currently");
2021
+ if (retryResult.issues.length === 0) keyResult = retryResult;
2022
+ }
2023
+ if (keyResult.issues.length) {
2024
+ if (def.mode === "loose") payload.value[key] = input[key];
2025
+ else payload.issues.push({
2026
+ code: "invalid_key",
2027
+ origin: "record",
2028
+ issues: keyResult.issues.map((iss) => finalizeIssue(iss, ctx, config())),
2029
+ input: key,
2030
+ path: [key],
2031
+ inst
2032
+ });
2033
+ continue;
2034
+ }
2035
+ const result = def.valueType._zod.run({
2036
+ value: input[key],
2037
+ issues: []
2038
+ }, ctx);
2039
+ if (result instanceof Promise) proms.push(result.then((result) => {
2040
+ if (result.issues.length) payload.issues.push(...prefixIssues(key, result.issues));
2041
+ payload.value[keyResult.value] = result.value;
2042
+ }));
2043
+ else {
2044
+ if (result.issues.length) payload.issues.push(...prefixIssues(key, result.issues));
2045
+ payload.value[keyResult.value] = result.value;
2046
+ }
2047
+ }
2048
+ }
2049
+ if (proms.length) return Promise.all(proms).then(() => payload);
2050
+ return payload;
2051
+ };
2052
+ });
2053
+ const $ZodEnum = /*@__PURE__*/ $constructor("$ZodEnum", (inst, def) => {
2054
+ $ZodType.init(inst, def);
2055
+ const values = getEnumValues(def.entries);
2056
+ const valuesSet = new Set(values);
2057
+ inst._zod.values = valuesSet;
2058
+ inst._zod.pattern = new RegExp(`^(${values.filter((k) => propertyKeyTypes.has(typeof k)).map((o) => typeof o === "string" ? escapeRegex(o) : o.toString()).join("|")})$`);
2059
+ inst._zod.parse = (payload, _ctx) => {
2060
+ const input = payload.value;
2061
+ if (valuesSet.has(input)) return payload;
2062
+ payload.issues.push({
2063
+ code: "invalid_value",
2064
+ values,
2065
+ input,
2066
+ inst
2067
+ });
2068
+ return payload;
2069
+ };
2070
+ });
2071
+ const $ZodLiteral = /*@__PURE__*/ $constructor("$ZodLiteral", (inst, def) => {
2072
+ $ZodType.init(inst, def);
2073
+ if (def.values.length === 0) throw new Error("Cannot create literal schema with no valid values");
2074
+ const values = new Set(def.values);
2075
+ inst._zod.values = values;
2076
+ inst._zod.pattern = new RegExp(`^(${def.values.map((o) => typeof o === "string" ? escapeRegex(o) : o ? escapeRegex(o.toString()) : String(o)).join("|")})$`);
2077
+ inst._zod.parse = (payload, _ctx) => {
2078
+ const input = payload.value;
2079
+ if (values.has(input)) return payload;
2080
+ payload.issues.push({
2081
+ code: "invalid_value",
2082
+ values: def.values,
2083
+ input,
2084
+ inst
2085
+ });
2086
+ return payload;
2087
+ };
2088
+ });
2089
+ const $ZodTransform = /*@__PURE__*/ $constructor("$ZodTransform", (inst, def) => {
2090
+ $ZodType.init(inst, def);
2091
+ inst._zod.optin = "optional";
2092
+ inst._zod.parse = (payload, ctx) => {
2093
+ if (ctx.direction === "backward") throw new $ZodEncodeError(inst.constructor.name);
2094
+ const _out = def.transform(payload.value, payload);
2095
+ if (ctx.async) return (_out instanceof Promise ? _out : Promise.resolve(_out)).then((output) => {
2096
+ payload.value = output;
2097
+ payload.fallback = true;
2098
+ return payload;
2099
+ });
2100
+ if (_out instanceof Promise) throw new $ZodAsyncError();
2101
+ payload.value = _out;
2102
+ payload.fallback = true;
2103
+ return payload;
2104
+ };
2105
+ });
2106
+ function handleOptionalResult(result, input) {
2107
+ if (input === void 0 && (result.issues.length || result.fallback)) return {
2108
+ issues: [],
2109
+ value: void 0
2110
+ };
2111
+ return result;
2112
+ }
2113
+ const $ZodOptional = /*@__PURE__*/ $constructor("$ZodOptional", (inst, def) => {
2114
+ $ZodType.init(inst, def);
2115
+ inst._zod.optin = "optional";
2116
+ inst._zod.optout = "optional";
2117
+ defineLazy(inst._zod, "values", () => {
2118
+ return def.innerType._zod.values ? /* @__PURE__ */ new Set([...def.innerType._zod.values, void 0]) : void 0;
2119
+ });
2120
+ defineLazy(inst._zod, "pattern", () => {
2121
+ const pattern = def.innerType._zod.pattern;
2122
+ return pattern ? new RegExp(`^(${cleanRegex(pattern.source)})?$`) : void 0;
2123
+ });
2124
+ inst._zod.parse = (payload, ctx) => {
2125
+ if (def.innerType._zod.optin === "optional") {
2126
+ const input = payload.value;
2127
+ const result = def.innerType._zod.run(payload, ctx);
2128
+ if (result instanceof Promise) return result.then((r) => handleOptionalResult(r, input));
2129
+ return handleOptionalResult(result, input);
2130
+ }
2131
+ if (payload.value === void 0) return payload;
2132
+ return def.innerType._zod.run(payload, ctx);
2133
+ };
2134
+ });
2135
+ const $ZodExactOptional = /*@__PURE__*/ $constructor("$ZodExactOptional", (inst, def) => {
2136
+ $ZodOptional.init(inst, def);
2137
+ defineLazy(inst._zod, "values", () => def.innerType._zod.values);
2138
+ defineLazy(inst._zod, "pattern", () => def.innerType._zod.pattern);
2139
+ inst._zod.parse = (payload, ctx) => {
2140
+ return def.innerType._zod.run(payload, ctx);
2141
+ };
2142
+ });
2143
+ const $ZodNullable = /*@__PURE__*/ $constructor("$ZodNullable", (inst, def) => {
2144
+ $ZodType.init(inst, def);
2145
+ defineLazy(inst._zod, "optin", () => def.innerType._zod.optin);
2146
+ defineLazy(inst._zod, "optout", () => def.innerType._zod.optout);
2147
+ defineLazy(inst._zod, "pattern", () => {
2148
+ const pattern = def.innerType._zod.pattern;
2149
+ return pattern ? new RegExp(`^(${cleanRegex(pattern.source)}|null)$`) : void 0;
2150
+ });
2151
+ defineLazy(inst._zod, "values", () => {
2152
+ return def.innerType._zod.values ? /* @__PURE__ */ new Set([...def.innerType._zod.values, null]) : void 0;
2153
+ });
2154
+ inst._zod.parse = (payload, ctx) => {
2155
+ if (payload.value === null) return payload;
2156
+ return def.innerType._zod.run(payload, ctx);
2157
+ };
2158
+ });
2159
+ const $ZodDefault = /*@__PURE__*/ $constructor("$ZodDefault", (inst, def) => {
2160
+ $ZodType.init(inst, def);
2161
+ inst._zod.optin = "optional";
2162
+ defineLazy(inst._zod, "values", () => def.innerType._zod.values);
2163
+ inst._zod.parse = (payload, ctx) => {
2164
+ if (ctx.direction === "backward") return def.innerType._zod.run(payload, ctx);
2165
+ if (payload.value === void 0) {
2166
+ payload.value = def.defaultValue;
2167
+ /**
2168
+ * $ZodDefault returns the default value immediately in forward direction.
2169
+ * It doesn't pass the default value into the validator ("prefault"). There's no reason to pass the default value through validation. The validity of the default is enforced by TypeScript statically. Otherwise, it's the responsibility of the user to ensure the default is valid. In the case of pipes with divergent in/out types, you can specify the default on the `in` schema of your ZodPipe to set a "prefault" for the pipe. */
2170
+ return payload;
2171
+ }
2172
+ const result = def.innerType._zod.run(payload, ctx);
2173
+ if (result instanceof Promise) return result.then((result) => handleDefaultResult(result, def));
2174
+ return handleDefaultResult(result, def);
2175
+ };
2176
+ });
2177
+ function handleDefaultResult(payload, def) {
2178
+ if (payload.value === void 0) payload.value = def.defaultValue;
2179
+ return payload;
2180
+ }
2181
+ const $ZodPrefault = /*@__PURE__*/ $constructor("$ZodPrefault", (inst, def) => {
2182
+ $ZodType.init(inst, def);
2183
+ inst._zod.optin = "optional";
2184
+ defineLazy(inst._zod, "values", () => def.innerType._zod.values);
2185
+ inst._zod.parse = (payload, ctx) => {
2186
+ if (ctx.direction === "backward") return def.innerType._zod.run(payload, ctx);
2187
+ if (payload.value === void 0) payload.value = def.defaultValue;
2188
+ return def.innerType._zod.run(payload, ctx);
2189
+ };
2190
+ });
2191
+ const $ZodNonOptional = /*@__PURE__*/ $constructor("$ZodNonOptional", (inst, def) => {
2192
+ $ZodType.init(inst, def);
2193
+ defineLazy(inst._zod, "values", () => {
2194
+ const v = def.innerType._zod.values;
2195
+ return v ? new Set([...v].filter((x) => x !== void 0)) : void 0;
2196
+ });
2197
+ inst._zod.parse = (payload, ctx) => {
2198
+ const result = def.innerType._zod.run(payload, ctx);
2199
+ if (result instanceof Promise) return result.then((result) => handleNonOptionalResult(result, inst));
2200
+ return handleNonOptionalResult(result, inst);
2201
+ };
2202
+ });
2203
+ function handleNonOptionalResult(payload, inst) {
2204
+ if (!payload.issues.length && payload.value === void 0) payload.issues.push({
2205
+ code: "invalid_type",
2206
+ expected: "nonoptional",
2207
+ input: payload.value,
2208
+ inst
2209
+ });
2210
+ return payload;
2211
+ }
2212
+ const $ZodCatch = /*@__PURE__*/ $constructor("$ZodCatch", (inst, def) => {
2213
+ $ZodType.init(inst, def);
2214
+ inst._zod.optin = "optional";
2215
+ defineLazy(inst._zod, "optout", () => def.innerType._zod.optout);
2216
+ defineLazy(inst._zod, "values", () => def.innerType._zod.values);
2217
+ inst._zod.parse = (payload, ctx) => {
2218
+ if (ctx.direction === "backward") return def.innerType._zod.run(payload, ctx);
2219
+ const result = def.innerType._zod.run(payload, ctx);
2220
+ if (result instanceof Promise) return result.then((result) => {
2221
+ payload.value = result.value;
2222
+ if (result.issues.length) {
2223
+ payload.value = def.catchValue({
2224
+ ...payload,
2225
+ error: { issues: result.issues.map((iss) => finalizeIssue(iss, ctx, config())) },
2226
+ input: payload.value
2227
+ });
2228
+ payload.issues = [];
2229
+ payload.fallback = true;
2230
+ }
2231
+ return payload;
2232
+ });
2233
+ payload.value = result.value;
2234
+ if (result.issues.length) {
2235
+ payload.value = def.catchValue({
2236
+ ...payload,
2237
+ error: { issues: result.issues.map((iss) => finalizeIssue(iss, ctx, config())) },
2238
+ input: payload.value
2239
+ });
2240
+ payload.issues = [];
2241
+ payload.fallback = true;
2242
+ }
2243
+ return payload;
2244
+ };
2245
+ });
2246
+ const $ZodPipe = /*@__PURE__*/ $constructor("$ZodPipe", (inst, def) => {
2247
+ $ZodType.init(inst, def);
2248
+ defineLazy(inst._zod, "values", () => def.in._zod.values);
2249
+ defineLazy(inst._zod, "optin", () => def.in._zod.optin);
2250
+ defineLazy(inst._zod, "optout", () => def.out._zod.optout);
2251
+ defineLazy(inst._zod, "propValues", () => def.in._zod.propValues);
2252
+ inst._zod.parse = (payload, ctx) => {
2253
+ if (ctx.direction === "backward") {
2254
+ const right = def.out._zod.run(payload, ctx);
2255
+ if (right instanceof Promise) return right.then((right) => handlePipeResult(right, def.in, ctx));
2256
+ return handlePipeResult(right, def.in, ctx);
2257
+ }
2258
+ const left = def.in._zod.run(payload, ctx);
2259
+ if (left instanceof Promise) return left.then((left) => handlePipeResult(left, def.out, ctx));
2260
+ return handlePipeResult(left, def.out, ctx);
2261
+ };
2262
+ });
2263
+ function handlePipeResult(left, next, ctx) {
2264
+ if (left.issues.length) {
2265
+ left.aborted = true;
2266
+ return left;
2267
+ }
2268
+ return next._zod.run({
2269
+ value: left.value,
2270
+ issues: left.issues,
2271
+ fallback: left.fallback
2272
+ }, ctx);
2273
+ }
2274
+ const $ZodPreprocess = /*@__PURE__*/ $constructor("$ZodPreprocess", (inst, def) => {
2275
+ $ZodPipe.init(inst, def);
2276
+ });
2277
+ const $ZodReadonly = /*@__PURE__*/ $constructor("$ZodReadonly", (inst, def) => {
2278
+ $ZodType.init(inst, def);
2279
+ defineLazy(inst._zod, "propValues", () => def.innerType._zod.propValues);
2280
+ defineLazy(inst._zod, "values", () => def.innerType._zod.values);
2281
+ defineLazy(inst._zod, "optin", () => def.innerType?._zod?.optin);
2282
+ defineLazy(inst._zod, "optout", () => def.innerType?._zod?.optout);
2283
+ inst._zod.parse = (payload, ctx) => {
2284
+ if (ctx.direction === "backward") return def.innerType._zod.run(payload, ctx);
2285
+ const result = def.innerType._zod.run(payload, ctx);
2286
+ if (result instanceof Promise) return result.then(handleReadonlyResult);
2287
+ return handleReadonlyResult(result);
2288
+ };
2289
+ });
2290
+ function handleReadonlyResult(payload) {
2291
+ payload.value = Object.freeze(payload.value);
2292
+ return payload;
2293
+ }
2294
+ const $ZodCustom = /*@__PURE__*/ $constructor("$ZodCustom", (inst, def) => {
2295
+ $ZodCheck.init(inst, def);
2296
+ $ZodType.init(inst, def);
2297
+ inst._zod.parse = (payload, _) => {
2298
+ return payload;
2299
+ };
2300
+ inst._zod.check = (payload) => {
2301
+ const input = payload.value;
2302
+ const r = def.fn(input);
2303
+ if (r instanceof Promise) return r.then((r) => handleRefineResult(r, payload, input, inst));
2304
+ handleRefineResult(r, payload, input, inst);
2305
+ };
2306
+ });
2307
+ function handleRefineResult(result, payload, input, inst) {
2308
+ if (!result) {
2309
+ const _iss = {
2310
+ code: "custom",
2311
+ input,
2312
+ inst,
2313
+ path: [...inst._zod.def.path ?? []],
2314
+ continue: !inst._zod.def.abort
2315
+ };
2316
+ if (inst._zod.def.params) _iss.params = inst._zod.def.params;
2317
+ payload.issues.push(issue(_iss));
2318
+ }
2319
+ }
2320
+ //#endregion
2321
+ //#region ../../node_modules/.pnpm/zod@4.4.3/node_modules/zod/v4/core/registries.js
2322
+ var _a;
2323
+ var $ZodRegistry = class {
2324
+ constructor() {
2325
+ this._map = /* @__PURE__ */ new WeakMap();
2326
+ this._idmap = /* @__PURE__ */ new Map();
2327
+ }
2328
+ add(schema, ..._meta) {
2329
+ const meta = _meta[0];
2330
+ this._map.set(schema, meta);
2331
+ if (meta && typeof meta === "object" && "id" in meta) this._idmap.set(meta.id, schema);
2332
+ return this;
2333
+ }
2334
+ clear() {
2335
+ this._map = /* @__PURE__ */ new WeakMap();
2336
+ this._idmap = /* @__PURE__ */ new Map();
2337
+ return this;
2338
+ }
2339
+ remove(schema) {
2340
+ const meta = this._map.get(schema);
2341
+ if (meta && typeof meta === "object" && "id" in meta) this._idmap.delete(meta.id);
2342
+ this._map.delete(schema);
2343
+ return this;
2344
+ }
2345
+ get(schema) {
2346
+ const p = schema._zod.parent;
2347
+ if (p) {
2348
+ const pm = { ...this.get(p) ?? {} };
2349
+ delete pm.id;
2350
+ const f = {
2351
+ ...pm,
2352
+ ...this._map.get(schema)
2353
+ };
2354
+ return Object.keys(f).length ? f : void 0;
2355
+ }
2356
+ return this._map.get(schema);
2357
+ }
2358
+ has(schema) {
2359
+ return this._map.has(schema);
2360
+ }
2361
+ };
2362
+ function registry() {
2363
+ return new $ZodRegistry();
2364
+ }
2365
+ (_a = globalThis).__zod_globalRegistry ?? (_a.__zod_globalRegistry = registry());
2366
+ const globalRegistry = globalThis.__zod_globalRegistry;
2367
+ //#endregion
2368
+ //#region ../../node_modules/.pnpm/zod@4.4.3/node_modules/zod/v4/core/api.js
2369
+ // @__NO_SIDE_EFFECTS__
2370
+ function _string(Class, params) {
2371
+ return new Class({
2372
+ type: "string",
2373
+ ...normalizeParams(params)
2374
+ });
2375
+ }
2376
+ // @__NO_SIDE_EFFECTS__
2377
+ function _email(Class, params) {
2378
+ return new Class({
2379
+ type: "string",
2380
+ format: "email",
2381
+ check: "string_format",
2382
+ abort: false,
2383
+ ...normalizeParams(params)
2384
+ });
2385
+ }
2386
+ // @__NO_SIDE_EFFECTS__
2387
+ function _guid(Class, params) {
2388
+ return new Class({
2389
+ type: "string",
2390
+ format: "guid",
2391
+ check: "string_format",
2392
+ abort: false,
2393
+ ...normalizeParams(params)
2394
+ });
2395
+ }
2396
+ // @__NO_SIDE_EFFECTS__
2397
+ function _uuid(Class, params) {
2398
+ return new Class({
2399
+ type: "string",
2400
+ format: "uuid",
2401
+ check: "string_format",
2402
+ abort: false,
2403
+ ...normalizeParams(params)
2404
+ });
2405
+ }
2406
+ // @__NO_SIDE_EFFECTS__
2407
+ function _uuidv4(Class, params) {
2408
+ return new Class({
2409
+ type: "string",
2410
+ format: "uuid",
2411
+ check: "string_format",
2412
+ abort: false,
2413
+ version: "v4",
2414
+ ...normalizeParams(params)
2415
+ });
2416
+ }
2417
+ // @__NO_SIDE_EFFECTS__
2418
+ function _uuidv6(Class, params) {
2419
+ return new Class({
2420
+ type: "string",
2421
+ format: "uuid",
2422
+ check: "string_format",
2423
+ abort: false,
2424
+ version: "v6",
2425
+ ...normalizeParams(params)
2426
+ });
2427
+ }
2428
+ // @__NO_SIDE_EFFECTS__
2429
+ function _uuidv7(Class, params) {
2430
+ return new Class({
2431
+ type: "string",
2432
+ format: "uuid",
2433
+ check: "string_format",
2434
+ abort: false,
2435
+ version: "v7",
2436
+ ...normalizeParams(params)
2437
+ });
2438
+ }
2439
+ // @__NO_SIDE_EFFECTS__
2440
+ function _url(Class, params) {
2441
+ return new Class({
2442
+ type: "string",
2443
+ format: "url",
2444
+ check: "string_format",
2445
+ abort: false,
2446
+ ...normalizeParams(params)
2447
+ });
2448
+ }
2449
+ // @__NO_SIDE_EFFECTS__
2450
+ function _emoji(Class, params) {
2451
+ return new Class({
2452
+ type: "string",
2453
+ format: "emoji",
2454
+ check: "string_format",
2455
+ abort: false,
2456
+ ...normalizeParams(params)
2457
+ });
2458
+ }
2459
+ // @__NO_SIDE_EFFECTS__
2460
+ function _nanoid(Class, params) {
2461
+ return new Class({
2462
+ type: "string",
2463
+ format: "nanoid",
2464
+ check: "string_format",
2465
+ abort: false,
2466
+ ...normalizeParams(params)
2467
+ });
2468
+ }
2469
+ /**
2470
+ * @deprecated CUID v1 is deprecated by its authors due to information leakage
2471
+ * (timestamps embedded in the id). Use {@link _cuid2} instead.
2472
+ * See https://github.com/paralleldrive/cuid.
2473
+ */
2474
+ // @__NO_SIDE_EFFECTS__
2475
+ function _cuid(Class, params) {
2476
+ return new Class({
2477
+ type: "string",
2478
+ format: "cuid",
2479
+ check: "string_format",
2480
+ abort: false,
2481
+ ...normalizeParams(params)
2482
+ });
2483
+ }
2484
+ // @__NO_SIDE_EFFECTS__
2485
+ function _cuid2(Class, params) {
2486
+ return new Class({
2487
+ type: "string",
2488
+ format: "cuid2",
2489
+ check: "string_format",
2490
+ abort: false,
2491
+ ...normalizeParams(params)
2492
+ });
2493
+ }
2494
+ // @__NO_SIDE_EFFECTS__
2495
+ function _ulid(Class, params) {
2496
+ return new Class({
2497
+ type: "string",
2498
+ format: "ulid",
2499
+ check: "string_format",
2500
+ abort: false,
2501
+ ...normalizeParams(params)
2502
+ });
2503
+ }
2504
+ // @__NO_SIDE_EFFECTS__
2505
+ function _xid(Class, params) {
2506
+ return new Class({
2507
+ type: "string",
2508
+ format: "xid",
2509
+ check: "string_format",
2510
+ abort: false,
2511
+ ...normalizeParams(params)
2512
+ });
2513
+ }
2514
+ // @__NO_SIDE_EFFECTS__
2515
+ function _ksuid(Class, params) {
2516
+ return new Class({
2517
+ type: "string",
2518
+ format: "ksuid",
2519
+ check: "string_format",
2520
+ abort: false,
2521
+ ...normalizeParams(params)
2522
+ });
2523
+ }
2524
+ // @__NO_SIDE_EFFECTS__
2525
+ function _ipv4(Class, params) {
2526
+ return new Class({
2527
+ type: "string",
2528
+ format: "ipv4",
2529
+ check: "string_format",
2530
+ abort: false,
2531
+ ...normalizeParams(params)
2532
+ });
2533
+ }
2534
+ // @__NO_SIDE_EFFECTS__
2535
+ function _ipv6(Class, params) {
2536
+ return new Class({
2537
+ type: "string",
2538
+ format: "ipv6",
2539
+ check: "string_format",
2540
+ abort: false,
2541
+ ...normalizeParams(params)
2542
+ });
2543
+ }
2544
+ // @__NO_SIDE_EFFECTS__
2545
+ function _cidrv4(Class, params) {
2546
+ return new Class({
2547
+ type: "string",
2548
+ format: "cidrv4",
2549
+ check: "string_format",
2550
+ abort: false,
2551
+ ...normalizeParams(params)
2552
+ });
2553
+ }
2554
+ // @__NO_SIDE_EFFECTS__
2555
+ function _cidrv6(Class, params) {
2556
+ return new Class({
2557
+ type: "string",
2558
+ format: "cidrv6",
2559
+ check: "string_format",
2560
+ abort: false,
2561
+ ...normalizeParams(params)
2562
+ });
2563
+ }
2564
+ // @__NO_SIDE_EFFECTS__
2565
+ function _base64(Class, params) {
2566
+ return new Class({
2567
+ type: "string",
2568
+ format: "base64",
2569
+ check: "string_format",
2570
+ abort: false,
2571
+ ...normalizeParams(params)
2572
+ });
2573
+ }
2574
+ // @__NO_SIDE_EFFECTS__
2575
+ function _base64url(Class, params) {
2576
+ return new Class({
2577
+ type: "string",
2578
+ format: "base64url",
2579
+ check: "string_format",
2580
+ abort: false,
2581
+ ...normalizeParams(params)
2582
+ });
2583
+ }
2584
+ // @__NO_SIDE_EFFECTS__
2585
+ function _e164(Class, params) {
2586
+ return new Class({
2587
+ type: "string",
2588
+ format: "e164",
2589
+ check: "string_format",
2590
+ abort: false,
2591
+ ...normalizeParams(params)
2592
+ });
2593
+ }
2594
+ // @__NO_SIDE_EFFECTS__
2595
+ function _jwt(Class, params) {
2596
+ return new Class({
2597
+ type: "string",
2598
+ format: "jwt",
2599
+ check: "string_format",
2600
+ abort: false,
2601
+ ...normalizeParams(params)
2602
+ });
2603
+ }
2604
+ // @__NO_SIDE_EFFECTS__
2605
+ function _isoDateTime(Class, params) {
2606
+ return new Class({
2607
+ type: "string",
2608
+ format: "datetime",
2609
+ check: "string_format",
2610
+ offset: false,
2611
+ local: false,
2612
+ precision: null,
2613
+ ...normalizeParams(params)
2614
+ });
2615
+ }
2616
+ // @__NO_SIDE_EFFECTS__
2617
+ function _isoDate(Class, params) {
2618
+ return new Class({
2619
+ type: "string",
2620
+ format: "date",
2621
+ check: "string_format",
2622
+ ...normalizeParams(params)
2623
+ });
2624
+ }
2625
+ // @__NO_SIDE_EFFECTS__
2626
+ function _isoTime(Class, params) {
2627
+ return new Class({
2628
+ type: "string",
2629
+ format: "time",
2630
+ check: "string_format",
2631
+ precision: null,
2632
+ ...normalizeParams(params)
2633
+ });
2634
+ }
2635
+ // @__NO_SIDE_EFFECTS__
2636
+ function _isoDuration(Class, params) {
2637
+ return new Class({
2638
+ type: "string",
2639
+ format: "duration",
2640
+ check: "string_format",
2641
+ ...normalizeParams(params)
2642
+ });
2643
+ }
2644
+ // @__NO_SIDE_EFFECTS__
2645
+ function _number(Class, params) {
2646
+ return new Class({
2647
+ type: "number",
2648
+ checks: [],
2649
+ ...normalizeParams(params)
2650
+ });
2651
+ }
2652
+ // @__NO_SIDE_EFFECTS__
2653
+ function _coercedNumber(Class, params) {
2654
+ return new Class({
2655
+ type: "number",
2656
+ coerce: true,
2657
+ checks: [],
2658
+ ...normalizeParams(params)
2659
+ });
2660
+ }
2661
+ // @__NO_SIDE_EFFECTS__
2662
+ function _int(Class, params) {
2663
+ return new Class({
2664
+ type: "number",
2665
+ check: "number_format",
2666
+ abort: false,
2667
+ format: "safeint",
2668
+ ...normalizeParams(params)
2669
+ });
2670
+ }
2671
+ // @__NO_SIDE_EFFECTS__
2672
+ function _boolean(Class, params) {
2673
+ return new Class({
2674
+ type: "boolean",
2675
+ ...normalizeParams(params)
2676
+ });
2677
+ }
2678
+ // @__NO_SIDE_EFFECTS__
2679
+ function _null$1(Class, params) {
2680
+ return new Class({
2681
+ type: "null",
2682
+ ...normalizeParams(params)
2683
+ });
2684
+ }
2685
+ // @__NO_SIDE_EFFECTS__
2686
+ function _any(Class) {
2687
+ return new Class({ type: "any" });
2688
+ }
2689
+ // @__NO_SIDE_EFFECTS__
2690
+ function _unknown(Class) {
2691
+ return new Class({ type: "unknown" });
2692
+ }
2693
+ // @__NO_SIDE_EFFECTS__
2694
+ function _never(Class, params) {
2695
+ return new Class({
2696
+ type: "never",
2697
+ ...normalizeParams(params)
2698
+ });
2699
+ }
2700
+ // @__NO_SIDE_EFFECTS__
2701
+ function _lt(value, params) {
2702
+ return new $ZodCheckLessThan({
2703
+ check: "less_than",
2704
+ ...normalizeParams(params),
2705
+ value,
2706
+ inclusive: false
2707
+ });
2708
+ }
2709
+ // @__NO_SIDE_EFFECTS__
2710
+ function _lte(value, params) {
2711
+ return new $ZodCheckLessThan({
2712
+ check: "less_than",
2713
+ ...normalizeParams(params),
2714
+ value,
2715
+ inclusive: true
2716
+ });
2717
+ }
2718
+ // @__NO_SIDE_EFFECTS__
2719
+ function _gt(value, params) {
2720
+ return new $ZodCheckGreaterThan({
2721
+ check: "greater_than",
2722
+ ...normalizeParams(params),
2723
+ value,
2724
+ inclusive: false
2725
+ });
2726
+ }
2727
+ // @__NO_SIDE_EFFECTS__
2728
+ function _gte(value, params) {
2729
+ return new $ZodCheckGreaterThan({
2730
+ check: "greater_than",
2731
+ ...normalizeParams(params),
2732
+ value,
2733
+ inclusive: true
2734
+ });
2735
+ }
2736
+ // @__NO_SIDE_EFFECTS__
2737
+ function _multipleOf(value, params) {
2738
+ return new $ZodCheckMultipleOf({
2739
+ check: "multiple_of",
2740
+ ...normalizeParams(params),
2741
+ value
2742
+ });
2743
+ }
2744
+ // @__NO_SIDE_EFFECTS__
2745
+ function _maxLength(maximum, params) {
2746
+ return new $ZodCheckMaxLength({
2747
+ check: "max_length",
2748
+ ...normalizeParams(params),
2749
+ maximum
2750
+ });
2751
+ }
2752
+ // @__NO_SIDE_EFFECTS__
2753
+ function _minLength(minimum, params) {
2754
+ return new $ZodCheckMinLength({
2755
+ check: "min_length",
2756
+ ...normalizeParams(params),
2757
+ minimum
2758
+ });
2759
+ }
2760
+ // @__NO_SIDE_EFFECTS__
2761
+ function _length(length, params) {
2762
+ return new $ZodCheckLengthEquals({
2763
+ check: "length_equals",
2764
+ ...normalizeParams(params),
2765
+ length
2766
+ });
2767
+ }
2768
+ // @__NO_SIDE_EFFECTS__
2769
+ function _regex(pattern, params) {
2770
+ return new $ZodCheckRegex({
2771
+ check: "string_format",
2772
+ format: "regex",
2773
+ ...normalizeParams(params),
2774
+ pattern
2775
+ });
2776
+ }
2777
+ // @__NO_SIDE_EFFECTS__
2778
+ function _lowercase(params) {
2779
+ return new $ZodCheckLowerCase({
2780
+ check: "string_format",
2781
+ format: "lowercase",
2782
+ ...normalizeParams(params)
2783
+ });
2784
+ }
2785
+ // @__NO_SIDE_EFFECTS__
2786
+ function _uppercase(params) {
2787
+ return new $ZodCheckUpperCase({
2788
+ check: "string_format",
2789
+ format: "uppercase",
2790
+ ...normalizeParams(params)
2791
+ });
2792
+ }
2793
+ // @__NO_SIDE_EFFECTS__
2794
+ function _includes(includes, params) {
2795
+ return new $ZodCheckIncludes({
2796
+ check: "string_format",
2797
+ format: "includes",
2798
+ ...normalizeParams(params),
2799
+ includes
2800
+ });
2801
+ }
2802
+ // @__NO_SIDE_EFFECTS__
2803
+ function _startsWith(prefix, params) {
2804
+ return new $ZodCheckStartsWith({
2805
+ check: "string_format",
2806
+ format: "starts_with",
2807
+ ...normalizeParams(params),
2808
+ prefix
2809
+ });
2810
+ }
2811
+ // @__NO_SIDE_EFFECTS__
2812
+ function _endsWith(suffix, params) {
2813
+ return new $ZodCheckEndsWith({
2814
+ check: "string_format",
2815
+ format: "ends_with",
2816
+ ...normalizeParams(params),
2817
+ suffix
2818
+ });
2819
+ }
2820
+ // @__NO_SIDE_EFFECTS__
2821
+ function _overwrite(tx) {
2822
+ return new $ZodCheckOverwrite({
2823
+ check: "overwrite",
2824
+ tx
2825
+ });
2826
+ }
2827
+ // @__NO_SIDE_EFFECTS__
2828
+ function _normalize(form) {
2829
+ return /* @__PURE__ */ _overwrite((input) => input.normalize(form));
2830
+ }
2831
+ // @__NO_SIDE_EFFECTS__
2832
+ function _trim() {
2833
+ return /* @__PURE__ */ _overwrite((input) => input.trim());
2834
+ }
2835
+ // @__NO_SIDE_EFFECTS__
2836
+ function _toLowerCase() {
2837
+ return /* @__PURE__ */ _overwrite((input) => input.toLowerCase());
2838
+ }
2839
+ // @__NO_SIDE_EFFECTS__
2840
+ function _toUpperCase() {
2841
+ return /* @__PURE__ */ _overwrite((input) => input.toUpperCase());
2842
+ }
2843
+ // @__NO_SIDE_EFFECTS__
2844
+ function _slugify() {
2845
+ return /* @__PURE__ */ _overwrite((input) => slugify(input));
2846
+ }
2847
+ // @__NO_SIDE_EFFECTS__
2848
+ function _array(Class, element, params) {
2849
+ return new Class({
2850
+ type: "array",
2851
+ element,
2852
+ ...normalizeParams(params)
2853
+ });
2854
+ }
2855
+ // @__NO_SIDE_EFFECTS__
2856
+ function _custom(Class, fn, _params) {
2857
+ const norm = normalizeParams(_params);
2858
+ norm.abort ?? (norm.abort = true);
2859
+ return new Class({
2860
+ type: "custom",
2861
+ check: "custom",
2862
+ fn,
2863
+ ...norm
2864
+ });
2865
+ }
2866
+ // @__NO_SIDE_EFFECTS__
2867
+ function _refine(Class, fn, _params) {
2868
+ return new Class({
2869
+ type: "custom",
2870
+ check: "custom",
2871
+ fn,
2872
+ ...normalizeParams(_params)
2873
+ });
2874
+ }
2875
+ // @__NO_SIDE_EFFECTS__
2876
+ function _superRefine(fn, params) {
2877
+ const ch = /* @__PURE__ */ _check((payload) => {
2878
+ payload.addIssue = (issue$2) => {
2879
+ if (typeof issue$2 === "string") payload.issues.push(issue(issue$2, payload.value, ch._zod.def));
2880
+ else {
2881
+ const _issue = issue$2;
2882
+ if (_issue.fatal) _issue.continue = false;
2883
+ _issue.code ?? (_issue.code = "custom");
2884
+ _issue.input ?? (_issue.input = payload.value);
2885
+ _issue.inst ?? (_issue.inst = ch);
2886
+ _issue.continue ?? (_issue.continue = !ch._zod.def.abort);
2887
+ payload.issues.push(issue(_issue));
2888
+ }
2889
+ };
2890
+ return fn(payload.value, payload);
2891
+ }, params);
2892
+ return ch;
2893
+ }
2894
+ // @__NO_SIDE_EFFECTS__
2895
+ function _check(fn, params) {
2896
+ const ch = new $ZodCheck({
2897
+ check: "custom",
2898
+ ...normalizeParams(params)
2899
+ });
2900
+ ch._zod.check = fn;
2901
+ return ch;
2902
+ }
2903
+ //#endregion
2904
+ //#region ../../node_modules/.pnpm/zod@4.4.3/node_modules/zod/v4/core/to-json-schema.js
2905
+ function initializeContext(params) {
2906
+ let target = params?.target ?? "draft-2020-12";
2907
+ if (target === "draft-4") target = "draft-04";
2908
+ if (target === "draft-7") target = "draft-07";
2909
+ return {
2910
+ processors: params.processors ?? {},
2911
+ metadataRegistry: params?.metadata ?? globalRegistry,
2912
+ target,
2913
+ unrepresentable: params?.unrepresentable ?? "throw",
2914
+ override: params?.override ?? (() => {}),
2915
+ io: params?.io ?? "output",
2916
+ counter: 0,
2917
+ seen: /* @__PURE__ */ new Map(),
2918
+ cycles: params?.cycles ?? "ref",
2919
+ reused: params?.reused ?? "inline",
2920
+ external: params?.external ?? void 0
2921
+ };
2922
+ }
2923
+ function process(schema, ctx, _params = {
2924
+ path: [],
2925
+ schemaPath: []
2926
+ }) {
2927
+ var _a;
2928
+ const def = schema._zod.def;
2929
+ const seen = ctx.seen.get(schema);
2930
+ if (seen) {
2931
+ seen.count++;
2932
+ if (_params.schemaPath.includes(schema)) seen.cycle = _params.path;
2933
+ return seen.schema;
2934
+ }
2935
+ const result = {
2936
+ schema: {},
2937
+ count: 1,
2938
+ cycle: void 0,
2939
+ path: _params.path
2940
+ };
2941
+ ctx.seen.set(schema, result);
2942
+ const overrideSchema = schema._zod.toJSONSchema?.();
2943
+ if (overrideSchema) result.schema = overrideSchema;
2944
+ else {
2945
+ const params = {
2946
+ ..._params,
2947
+ schemaPath: [..._params.schemaPath, schema],
2948
+ path: _params.path
2949
+ };
2950
+ if (schema._zod.processJSONSchema) schema._zod.processJSONSchema(ctx, result.schema, params);
2951
+ else {
2952
+ const _json = result.schema;
2953
+ const processor = ctx.processors[def.type];
2954
+ if (!processor) throw new Error(`[toJSONSchema]: Non-representable type encountered: ${def.type}`);
2955
+ processor(schema, ctx, _json, params);
2956
+ }
2957
+ const parent = schema._zod.parent;
2958
+ if (parent) {
2959
+ if (!result.ref) result.ref = parent;
2960
+ process(parent, ctx, params);
2961
+ ctx.seen.get(parent).isParent = true;
2962
+ }
2963
+ }
2964
+ const meta = ctx.metadataRegistry.get(schema);
2965
+ if (meta) Object.assign(result.schema, meta);
2966
+ if (ctx.io === "input" && isTransforming(schema)) {
2967
+ delete result.schema.examples;
2968
+ delete result.schema.default;
2969
+ }
2970
+ if (ctx.io === "input" && "_prefault" in result.schema) (_a = result.schema).default ?? (_a.default = result.schema._prefault);
2971
+ delete result.schema._prefault;
2972
+ return ctx.seen.get(schema).schema;
2973
+ }
2974
+ function extractDefs(ctx, schema) {
2975
+ const root = ctx.seen.get(schema);
2976
+ if (!root) throw new Error("Unprocessed schema. This is a bug in Zod.");
2977
+ const idToSchema = /* @__PURE__ */ new Map();
2978
+ for (const entry of ctx.seen.entries()) {
2979
+ const id = ctx.metadataRegistry.get(entry[0])?.id;
2980
+ if (id) {
2981
+ const existing = idToSchema.get(id);
2982
+ if (existing && existing !== entry[0]) throw new Error(`Duplicate schema id "${id}" detected during JSON Schema conversion. Two different schemas cannot share the same id when converted together.`);
2983
+ idToSchema.set(id, entry[0]);
2984
+ }
2985
+ }
2986
+ const makeURI = (entry) => {
2987
+ const defsSegment = ctx.target === "draft-2020-12" ? "$defs" : "definitions";
2988
+ if (ctx.external) {
2989
+ const externalId = ctx.external.registry.get(entry[0])?.id;
2990
+ const uriGenerator = ctx.external.uri ?? ((id) => id);
2991
+ if (externalId) return { ref: uriGenerator(externalId) };
2992
+ const id = entry[1].defId ?? entry[1].schema.id ?? `schema${ctx.counter++}`;
2993
+ entry[1].defId = id;
2994
+ return {
2995
+ defId: id,
2996
+ ref: `${uriGenerator("__shared")}#/${defsSegment}/${id}`
2997
+ };
2998
+ }
2999
+ if (entry[1] === root) return { ref: "#" };
3000
+ const defUriPrefix = `#/${defsSegment}/`;
3001
+ const defId = entry[1].schema.id ?? `__schema${ctx.counter++}`;
3002
+ return {
3003
+ defId,
3004
+ ref: defUriPrefix + defId
3005
+ };
3006
+ };
3007
+ const extractToDef = (entry) => {
3008
+ if (entry[1].schema.$ref) return;
3009
+ const seen = entry[1];
3010
+ const { ref, defId } = makeURI(entry);
3011
+ seen.def = { ...seen.schema };
3012
+ if (defId) seen.defId = defId;
3013
+ const schema = seen.schema;
3014
+ for (const key in schema) delete schema[key];
3015
+ schema.$ref = ref;
3016
+ };
3017
+ if (ctx.cycles === "throw") for (const entry of ctx.seen.entries()) {
3018
+ const seen = entry[1];
3019
+ if (seen.cycle) throw new Error(`Cycle detected: #/${seen.cycle?.join("/")}/<root>
3020
+
3021
+ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.`);
3022
+ }
3023
+ for (const entry of ctx.seen.entries()) {
3024
+ const seen = entry[1];
3025
+ if (schema === entry[0]) {
3026
+ extractToDef(entry);
3027
+ continue;
3028
+ }
3029
+ if (ctx.external) {
3030
+ const ext = ctx.external.registry.get(entry[0])?.id;
3031
+ if (schema !== entry[0] && ext) {
3032
+ extractToDef(entry);
3033
+ continue;
3034
+ }
3035
+ }
3036
+ if (ctx.metadataRegistry.get(entry[0])?.id) {
3037
+ extractToDef(entry);
3038
+ continue;
3039
+ }
3040
+ if (seen.cycle) {
3041
+ extractToDef(entry);
3042
+ continue;
3043
+ }
3044
+ if (seen.count > 1) {
3045
+ if (ctx.reused === "ref") {
3046
+ extractToDef(entry);
3047
+ continue;
3048
+ }
3049
+ }
3050
+ }
3051
+ }
3052
+ function finalize(ctx, schema) {
3053
+ const root = ctx.seen.get(schema);
3054
+ if (!root) throw new Error("Unprocessed schema. This is a bug in Zod.");
3055
+ const flattenRef = (zodSchema) => {
3056
+ const seen = ctx.seen.get(zodSchema);
3057
+ if (seen.ref === null) return;
3058
+ const schema = seen.def ?? seen.schema;
3059
+ const _cached = { ...schema };
3060
+ const ref = seen.ref;
3061
+ seen.ref = null;
3062
+ if (ref) {
3063
+ flattenRef(ref);
3064
+ const refSeen = ctx.seen.get(ref);
3065
+ const refSchema = refSeen.schema;
3066
+ if (refSchema.$ref && (ctx.target === "draft-07" || ctx.target === "draft-04" || ctx.target === "openapi-3.0")) {
3067
+ schema.allOf = schema.allOf ?? [];
3068
+ schema.allOf.push(refSchema);
3069
+ } else Object.assign(schema, refSchema);
3070
+ Object.assign(schema, _cached);
3071
+ if (zodSchema._zod.parent === ref) for (const key in schema) {
3072
+ if (key === "$ref" || key === "allOf") continue;
3073
+ if (!(key in _cached)) delete schema[key];
3074
+ }
3075
+ if (refSchema.$ref && refSeen.def) for (const key in schema) {
3076
+ if (key === "$ref" || key === "allOf") continue;
3077
+ if (key in refSeen.def && JSON.stringify(schema[key]) === JSON.stringify(refSeen.def[key])) delete schema[key];
3078
+ }
3079
+ }
3080
+ const parent = zodSchema._zod.parent;
3081
+ if (parent && parent !== ref) {
3082
+ flattenRef(parent);
3083
+ const parentSeen = ctx.seen.get(parent);
3084
+ if (parentSeen?.schema.$ref) {
3085
+ schema.$ref = parentSeen.schema.$ref;
3086
+ if (parentSeen.def) for (const key in schema) {
3087
+ if (key === "$ref" || key === "allOf") continue;
3088
+ if (key in parentSeen.def && JSON.stringify(schema[key]) === JSON.stringify(parentSeen.def[key])) delete schema[key];
3089
+ }
3090
+ }
3091
+ }
3092
+ ctx.override({
3093
+ zodSchema,
3094
+ jsonSchema: schema,
3095
+ path: seen.path ?? []
3096
+ });
3097
+ };
3098
+ for (const entry of [...ctx.seen.entries()].reverse()) flattenRef(entry[0]);
3099
+ const result = {};
3100
+ if (ctx.target === "draft-2020-12") result.$schema = "https://json-schema.org/draft/2020-12/schema";
3101
+ else if (ctx.target === "draft-07") result.$schema = "http://json-schema.org/draft-07/schema#";
3102
+ else if (ctx.target === "draft-04") result.$schema = "http://json-schema.org/draft-04/schema#";
3103
+ else if (ctx.target === "openapi-3.0") {}
3104
+ if (ctx.external?.uri) {
3105
+ const id = ctx.external.registry.get(schema)?.id;
3106
+ if (!id) throw new Error("Schema is missing an `id` property");
3107
+ result.$id = ctx.external.uri(id);
3108
+ }
3109
+ Object.assign(result, root.def ?? root.schema);
3110
+ const rootMetaId = ctx.metadataRegistry.get(schema)?.id;
3111
+ if (rootMetaId !== void 0 && result.id === rootMetaId) delete result.id;
3112
+ const defs = ctx.external?.defs ?? {};
3113
+ for (const entry of ctx.seen.entries()) {
3114
+ const seen = entry[1];
3115
+ if (seen.def && seen.defId) {
3116
+ if (seen.def.id === seen.defId) delete seen.def.id;
3117
+ defs[seen.defId] = seen.def;
3118
+ }
3119
+ }
3120
+ if (ctx.external) {} else if (Object.keys(defs).length > 0) if (ctx.target === "draft-2020-12") result.$defs = defs;
3121
+ else result.definitions = defs;
3122
+ try {
3123
+ const finalized = JSON.parse(JSON.stringify(result));
3124
+ Object.defineProperty(finalized, "~standard", {
3125
+ value: {
3126
+ ...schema["~standard"],
3127
+ jsonSchema: {
3128
+ input: createStandardJSONSchemaMethod(schema, "input", ctx.processors),
3129
+ output: createStandardJSONSchemaMethod(schema, "output", ctx.processors)
3130
+ }
3131
+ },
3132
+ enumerable: false,
3133
+ writable: false
3134
+ });
3135
+ return finalized;
3136
+ } catch (_err) {
3137
+ throw new Error("Error converting schema to JSON.");
3138
+ }
3139
+ }
3140
+ function isTransforming(_schema, _ctx) {
3141
+ const ctx = _ctx ?? { seen: /* @__PURE__ */ new Set() };
3142
+ if (ctx.seen.has(_schema)) return false;
3143
+ ctx.seen.add(_schema);
3144
+ const def = _schema._zod.def;
3145
+ if (def.type === "transform") return true;
3146
+ if (def.type === "array") return isTransforming(def.element, ctx);
3147
+ if (def.type === "set") return isTransforming(def.valueType, ctx);
3148
+ if (def.type === "lazy") return isTransforming(def.getter(), ctx);
3149
+ 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);
3150
+ if (def.type === "intersection") return isTransforming(def.left, ctx) || isTransforming(def.right, ctx);
3151
+ if (def.type === "record" || def.type === "map") return isTransforming(def.keyType, ctx) || isTransforming(def.valueType, ctx);
3152
+ if (def.type === "pipe") {
3153
+ if (_schema._zod.traits.has("$ZodCodec")) return true;
3154
+ return isTransforming(def.in, ctx) || isTransforming(def.out, ctx);
3155
+ }
3156
+ if (def.type === "object") {
3157
+ for (const key in def.shape) if (isTransforming(def.shape[key], ctx)) return true;
3158
+ return false;
3159
+ }
3160
+ if (def.type === "union") {
3161
+ for (const option of def.options) if (isTransforming(option, ctx)) return true;
3162
+ return false;
3163
+ }
3164
+ if (def.type === "tuple") {
3165
+ for (const item of def.items) if (isTransforming(item, ctx)) return true;
3166
+ if (def.rest && isTransforming(def.rest, ctx)) return true;
3167
+ return false;
3168
+ }
3169
+ return false;
3170
+ }
3171
+ /**
3172
+ * Creates a toJSONSchema method for a schema instance.
3173
+ * This encapsulates the logic of initializing context, processing, extracting defs, and finalizing.
3174
+ */
3175
+ const createToJSONSchemaMethod = (schema, processors = {}) => (params) => {
3176
+ const ctx = initializeContext({
3177
+ ...params,
3178
+ processors
3179
+ });
3180
+ process(schema, ctx);
3181
+ extractDefs(ctx, schema);
3182
+ return finalize(ctx, schema);
3183
+ };
3184
+ const createStandardJSONSchemaMethod = (schema, io, processors = {}) => (params) => {
3185
+ const { libraryOptions, target } = params ?? {};
3186
+ const ctx = initializeContext({
3187
+ ...libraryOptions ?? {},
3188
+ target,
3189
+ io,
3190
+ processors
3191
+ });
3192
+ process(schema, ctx);
3193
+ extractDefs(ctx, schema);
3194
+ return finalize(ctx, schema);
3195
+ };
3196
+ //#endregion
3197
+ //#region ../../node_modules/.pnpm/zod@4.4.3/node_modules/zod/v4/core/json-schema-processors.js
3198
+ const formatMap = {
3199
+ guid: "uuid",
3200
+ url: "uri",
3201
+ datetime: "date-time",
3202
+ json_string: "json-string",
3203
+ regex: ""
3204
+ };
3205
+ const stringProcessor = (schema, ctx, _json, _params) => {
3206
+ const json = _json;
3207
+ json.type = "string";
3208
+ const { minimum, maximum, format, patterns, contentEncoding } = schema._zod.bag;
3209
+ if (typeof minimum === "number") json.minLength = minimum;
3210
+ if (typeof maximum === "number") json.maxLength = maximum;
3211
+ if (format) {
3212
+ json.format = formatMap[format] ?? format;
3213
+ if (json.format === "") delete json.format;
3214
+ if (format === "time") delete json.format;
3215
+ }
3216
+ if (contentEncoding) json.contentEncoding = contentEncoding;
3217
+ if (patterns && patterns.size > 0) {
3218
+ const regexes = [...patterns];
3219
+ if (regexes.length === 1) json.pattern = regexes[0].source;
3220
+ else if (regexes.length > 1) json.allOf = [...regexes.map((regex) => ({
3221
+ ...ctx.target === "draft-07" || ctx.target === "draft-04" || ctx.target === "openapi-3.0" ? { type: "string" } : {},
3222
+ pattern: regex.source
3223
+ }))];
3224
+ }
3225
+ };
3226
+ const numberProcessor = (schema, ctx, _json, _params) => {
3227
+ const json = _json;
3228
+ const { minimum, maximum, format, multipleOf, exclusiveMaximum, exclusiveMinimum } = schema._zod.bag;
3229
+ if (typeof format === "string" && format.includes("int")) json.type = "integer";
3230
+ else json.type = "number";
3231
+ const exMin = typeof exclusiveMinimum === "number" && exclusiveMinimum >= (minimum ?? Number.NEGATIVE_INFINITY);
3232
+ const exMax = typeof exclusiveMaximum === "number" && exclusiveMaximum <= (maximum ?? Number.POSITIVE_INFINITY);
3233
+ const legacy = ctx.target === "draft-04" || ctx.target === "openapi-3.0";
3234
+ if (exMin) if (legacy) {
3235
+ json.minimum = exclusiveMinimum;
3236
+ json.exclusiveMinimum = true;
3237
+ } else json.exclusiveMinimum = exclusiveMinimum;
3238
+ else if (typeof minimum === "number") json.minimum = minimum;
3239
+ if (exMax) if (legacy) {
3240
+ json.maximum = exclusiveMaximum;
3241
+ json.exclusiveMaximum = true;
3242
+ } else json.exclusiveMaximum = exclusiveMaximum;
3243
+ else if (typeof maximum === "number") json.maximum = maximum;
3244
+ if (typeof multipleOf === "number") json.multipleOf = multipleOf;
3245
+ };
3246
+ const booleanProcessor = (_schema, _ctx, json, _params) => {
3247
+ json.type = "boolean";
3248
+ };
3249
+ const nullProcessor = (_schema, ctx, json, _params) => {
3250
+ if (ctx.target === "openapi-3.0") {
3251
+ json.type = "string";
3252
+ json.nullable = true;
3253
+ json.enum = [null];
3254
+ } else json.type = "null";
3255
+ };
3256
+ const neverProcessor = (_schema, _ctx, json, _params) => {
3257
+ json.not = {};
3258
+ };
3259
+ const enumProcessor = (schema, _ctx, json, _params) => {
3260
+ const def = schema._zod.def;
3261
+ const values = getEnumValues(def.entries);
3262
+ if (values.every((v) => typeof v === "number")) json.type = "number";
3263
+ if (values.every((v) => typeof v === "string")) json.type = "string";
3264
+ json.enum = values;
3265
+ };
3266
+ const literalProcessor = (schema, ctx, json, _params) => {
3267
+ const def = schema._zod.def;
3268
+ const vals = [];
3269
+ for (const val of def.values) if (val === void 0) {
3270
+ if (ctx.unrepresentable === "throw") throw new Error("Literal `undefined` cannot be represented in JSON Schema");
3271
+ } else if (typeof val === "bigint") if (ctx.unrepresentable === "throw") throw new Error("BigInt literals cannot be represented in JSON Schema");
3272
+ else vals.push(Number(val));
3273
+ else vals.push(val);
3274
+ if (vals.length === 0) {} else if (vals.length === 1) {
3275
+ const val = vals[0];
3276
+ json.type = val === null ? "null" : typeof val;
3277
+ if (ctx.target === "draft-04" || ctx.target === "openapi-3.0") json.enum = [val];
3278
+ else json.const = val;
3279
+ } else {
3280
+ if (vals.every((v) => typeof v === "number")) json.type = "number";
3281
+ if (vals.every((v) => typeof v === "string")) json.type = "string";
3282
+ if (vals.every((v) => typeof v === "boolean")) json.type = "boolean";
3283
+ if (vals.every((v) => v === null)) json.type = "null";
3284
+ json.enum = vals;
3285
+ }
3286
+ };
3287
+ const customProcessor = (_schema, ctx, _json, _params) => {
3288
+ if (ctx.unrepresentable === "throw") throw new Error("Custom types cannot be represented in JSON Schema");
3289
+ };
3290
+ const transformProcessor = (_schema, ctx, _json, _params) => {
3291
+ if (ctx.unrepresentable === "throw") throw new Error("Transforms cannot be represented in JSON Schema");
3292
+ };
3293
+ const arrayProcessor = (schema, ctx, _json, params) => {
3294
+ const json = _json;
3295
+ const def = schema._zod.def;
3296
+ const { minimum, maximum } = schema._zod.bag;
3297
+ if (typeof minimum === "number") json.minItems = minimum;
3298
+ if (typeof maximum === "number") json.maxItems = maximum;
3299
+ json.type = "array";
3300
+ json.items = process(def.element, ctx, {
3301
+ ...params,
3302
+ path: [...params.path, "items"]
3303
+ });
3304
+ };
3305
+ const objectProcessor = (schema, ctx, _json, params) => {
3306
+ const json = _json;
3307
+ const def = schema._zod.def;
3308
+ json.type = "object";
3309
+ json.properties = {};
3310
+ const shape = def.shape;
3311
+ for (const key in shape) json.properties[key] = process(shape[key], ctx, {
3312
+ ...params,
3313
+ path: [
3314
+ ...params.path,
3315
+ "properties",
3316
+ key
3317
+ ]
3318
+ });
3319
+ const allKeys = new Set(Object.keys(shape));
3320
+ const requiredKeys = new Set([...allKeys].filter((key) => {
3321
+ const v = def.shape[key]._zod;
3322
+ if (ctx.io === "input") return v.optin === void 0;
3323
+ else return v.optout === void 0;
3324
+ }));
3325
+ if (requiredKeys.size > 0) json.required = Array.from(requiredKeys);
3326
+ if (def.catchall?._zod.def.type === "never") json.additionalProperties = false;
3327
+ else if (!def.catchall) {
3328
+ if (ctx.io === "output") json.additionalProperties = false;
3329
+ } else if (def.catchall) json.additionalProperties = process(def.catchall, ctx, {
3330
+ ...params,
3331
+ path: [...params.path, "additionalProperties"]
3332
+ });
3333
+ };
3334
+ const unionProcessor = (schema, ctx, json, params) => {
3335
+ const def = schema._zod.def;
3336
+ const isExclusive = def.inclusive === false;
3337
+ const options = def.options.map((x, i) => process(x, ctx, {
3338
+ ...params,
3339
+ path: [
3340
+ ...params.path,
3341
+ isExclusive ? "oneOf" : "anyOf",
3342
+ i
3343
+ ]
3344
+ }));
3345
+ if (isExclusive) json.oneOf = options;
3346
+ else json.anyOf = options;
3347
+ };
3348
+ const intersectionProcessor = (schema, ctx, json, params) => {
3349
+ const def = schema._zod.def;
3350
+ const a = process(def.left, ctx, {
3351
+ ...params,
3352
+ path: [
3353
+ ...params.path,
3354
+ "allOf",
3355
+ 0
3356
+ ]
3357
+ });
3358
+ const b = process(def.right, ctx, {
3359
+ ...params,
3360
+ path: [
3361
+ ...params.path,
3362
+ "allOf",
3363
+ 1
3364
+ ]
3365
+ });
3366
+ const isSimpleIntersection = (val) => "allOf" in val && Object.keys(val).length === 1;
3367
+ json.allOf = [...isSimpleIntersection(a) ? a.allOf : [a], ...isSimpleIntersection(b) ? b.allOf : [b]];
3368
+ };
3369
+ const recordProcessor = (schema, ctx, _json, params) => {
3370
+ const json = _json;
3371
+ const def = schema._zod.def;
3372
+ json.type = "object";
3373
+ const keyType = def.keyType;
3374
+ const patterns = keyType._zod.bag?.patterns;
3375
+ if (def.mode === "loose" && patterns && patterns.size > 0) {
3376
+ const valueSchema = process(def.valueType, ctx, {
3377
+ ...params,
3378
+ path: [
3379
+ ...params.path,
3380
+ "patternProperties",
3381
+ "*"
3382
+ ]
3383
+ });
3384
+ json.patternProperties = {};
3385
+ for (const pattern of patterns) json.patternProperties[pattern.source] = valueSchema;
3386
+ } else {
3387
+ if (ctx.target === "draft-07" || ctx.target === "draft-2020-12") json.propertyNames = process(def.keyType, ctx, {
3388
+ ...params,
3389
+ path: [...params.path, "propertyNames"]
3390
+ });
3391
+ json.additionalProperties = process(def.valueType, ctx, {
3392
+ ...params,
3393
+ path: [...params.path, "additionalProperties"]
3394
+ });
3395
+ }
3396
+ const keyValues = keyType._zod.values;
3397
+ if (keyValues) {
3398
+ const validKeyValues = [...keyValues].filter((v) => typeof v === "string" || typeof v === "number");
3399
+ if (validKeyValues.length > 0) json.required = validKeyValues;
3400
+ }
3401
+ };
3402
+ const nullableProcessor = (schema, ctx, json, params) => {
3403
+ const def = schema._zod.def;
3404
+ const inner = process(def.innerType, ctx, params);
3405
+ const seen = ctx.seen.get(schema);
3406
+ if (ctx.target === "openapi-3.0") {
3407
+ seen.ref = def.innerType;
3408
+ json.nullable = true;
3409
+ } else json.anyOf = [inner, { type: "null" }];
3410
+ };
3411
+ const nonoptionalProcessor = (schema, ctx, _json, params) => {
3412
+ const def = schema._zod.def;
3413
+ process(def.innerType, ctx, params);
3414
+ const seen = ctx.seen.get(schema);
3415
+ seen.ref = def.innerType;
3416
+ };
3417
+ const defaultProcessor = (schema, ctx, json, params) => {
3418
+ const def = schema._zod.def;
3419
+ process(def.innerType, ctx, params);
3420
+ const seen = ctx.seen.get(schema);
3421
+ seen.ref = def.innerType;
3422
+ json.default = JSON.parse(JSON.stringify(def.defaultValue));
3423
+ };
3424
+ const prefaultProcessor = (schema, ctx, json, params) => {
3425
+ const def = schema._zod.def;
3426
+ process(def.innerType, ctx, params);
3427
+ const seen = ctx.seen.get(schema);
3428
+ seen.ref = def.innerType;
3429
+ if (ctx.io === "input") json._prefault = JSON.parse(JSON.stringify(def.defaultValue));
3430
+ };
3431
+ const catchProcessor = (schema, ctx, json, params) => {
3432
+ const def = schema._zod.def;
3433
+ process(def.innerType, ctx, params);
3434
+ const seen = ctx.seen.get(schema);
3435
+ seen.ref = def.innerType;
3436
+ let catchValue;
3437
+ try {
3438
+ catchValue = def.catchValue(void 0);
3439
+ } catch {
3440
+ throw new Error("Dynamic catch values are not supported in JSON Schema");
3441
+ }
3442
+ json.default = catchValue;
3443
+ };
3444
+ const pipeProcessor = (schema, ctx, _json, params) => {
3445
+ const def = schema._zod.def;
3446
+ const inIsTransform = def.in._zod.traits.has("$ZodTransform");
3447
+ const innerType = ctx.io === "input" ? inIsTransform ? def.out : def.in : def.out;
3448
+ process(innerType, ctx, params);
3449
+ const seen = ctx.seen.get(schema);
3450
+ seen.ref = innerType;
3451
+ };
3452
+ const readonlyProcessor = (schema, ctx, json, params) => {
3453
+ const def = schema._zod.def;
3454
+ process(def.innerType, ctx, params);
3455
+ const seen = ctx.seen.get(schema);
3456
+ seen.ref = def.innerType;
3457
+ json.readOnly = true;
3458
+ };
3459
+ const optionalProcessor = (schema, ctx, _json, params) => {
3460
+ const def = schema._zod.def;
3461
+ process(def.innerType, ctx, params);
3462
+ const seen = ctx.seen.get(schema);
3463
+ seen.ref = def.innerType;
3464
+ };
3465
+ //#endregion
3466
+ //#region ../../node_modules/.pnpm/zod@4.4.3/node_modules/zod/v4/classic/iso.js
3467
+ const ZodISODateTime = /*@__PURE__*/ $constructor("ZodISODateTime", (inst, def) => {
3468
+ $ZodISODateTime.init(inst, def);
3469
+ ZodStringFormat.init(inst, def);
3470
+ });
3471
+ function datetime(params) {
3472
+ return /* @__PURE__ */ _isoDateTime(ZodISODateTime, params);
3473
+ }
3474
+ const ZodISODate = /*@__PURE__*/ $constructor("ZodISODate", (inst, def) => {
3475
+ $ZodISODate.init(inst, def);
3476
+ ZodStringFormat.init(inst, def);
3477
+ });
3478
+ function date(params) {
3479
+ return /* @__PURE__ */ _isoDate(ZodISODate, params);
3480
+ }
3481
+ const ZodISOTime = /*@__PURE__*/ $constructor("ZodISOTime", (inst, def) => {
3482
+ $ZodISOTime.init(inst, def);
3483
+ ZodStringFormat.init(inst, def);
3484
+ });
3485
+ function time(params) {
3486
+ return /* @__PURE__ */ _isoTime(ZodISOTime, params);
3487
+ }
3488
+ const ZodISODuration = /*@__PURE__*/ $constructor("ZodISODuration", (inst, def) => {
3489
+ $ZodISODuration.init(inst, def);
3490
+ ZodStringFormat.init(inst, def);
3491
+ });
3492
+ function duration(params) {
3493
+ return /* @__PURE__ */ _isoDuration(ZodISODuration, params);
3494
+ }
3495
+ //#endregion
3496
+ //#region ../../node_modules/.pnpm/zod@4.4.3/node_modules/zod/v4/classic/errors.js
3497
+ const initializer = (inst, issues) => {
3498
+ $ZodError.init(inst, issues);
3499
+ inst.name = "ZodError";
3500
+ Object.defineProperties(inst, {
3501
+ format: { value: (mapper) => formatError(inst, mapper) },
3502
+ flatten: { value: (mapper) => flattenError(inst, mapper) },
3503
+ addIssue: { value: (issue) => {
3504
+ inst.issues.push(issue);
3505
+ inst.message = JSON.stringify(inst.issues, jsonStringifyReplacer, 2);
3506
+ } },
3507
+ addIssues: { value: (issues) => {
3508
+ inst.issues.push(...issues);
3509
+ inst.message = JSON.stringify(inst.issues, jsonStringifyReplacer, 2);
3510
+ } },
3511
+ isEmpty: { get() {
3512
+ return inst.issues.length === 0;
3513
+ } }
3514
+ });
3515
+ };
3516
+ const ZodRealError = /*@__PURE__*/ $constructor("ZodError", initializer, { Parent: Error });
3517
+ //#endregion
3518
+ //#region ../../node_modules/.pnpm/zod@4.4.3/node_modules/zod/v4/classic/parse.js
3519
+ const parse = /* @__PURE__ */ _parse(ZodRealError);
3520
+ const parseAsync = /* @__PURE__ */ _parseAsync(ZodRealError);
3521
+ const safeParse = /* @__PURE__ */ _safeParse(ZodRealError);
3522
+ const safeParseAsync = /* @__PURE__ */ _safeParseAsync(ZodRealError);
3523
+ const encode = /* @__PURE__ */ _encode(ZodRealError);
3524
+ const decode = /* @__PURE__ */ _decode(ZodRealError);
3525
+ const encodeAsync = /* @__PURE__ */ _encodeAsync(ZodRealError);
3526
+ const decodeAsync = /* @__PURE__ */ _decodeAsync(ZodRealError);
3527
+ const safeEncode = /* @__PURE__ */ _safeEncode(ZodRealError);
3528
+ const safeDecode = /* @__PURE__ */ _safeDecode(ZodRealError);
3529
+ const safeEncodeAsync = /* @__PURE__ */ _safeEncodeAsync(ZodRealError);
3530
+ const safeDecodeAsync = /* @__PURE__ */ _safeDecodeAsync(ZodRealError);
3531
+ //#endregion
3532
+ //#region ../../node_modules/.pnpm/zod@4.4.3/node_modules/zod/v4/classic/schemas.js
3533
+ const _installedGroups = /* @__PURE__ */ new WeakMap();
3534
+ function _installLazyMethods(inst, group, methods) {
3535
+ const proto = Object.getPrototypeOf(inst);
3536
+ let installed = _installedGroups.get(proto);
3537
+ if (!installed) {
3538
+ installed = /* @__PURE__ */ new Set();
3539
+ _installedGroups.set(proto, installed);
3540
+ }
3541
+ if (installed.has(group)) return;
3542
+ installed.add(group);
3543
+ for (const key in methods) {
3544
+ const fn = methods[key];
3545
+ Object.defineProperty(proto, key, {
3546
+ configurable: true,
3547
+ enumerable: false,
3548
+ get() {
3549
+ const bound = fn.bind(this);
3550
+ Object.defineProperty(this, key, {
3551
+ configurable: true,
3552
+ writable: true,
3553
+ enumerable: true,
3554
+ value: bound
3555
+ });
3556
+ return bound;
3557
+ },
3558
+ set(v) {
3559
+ Object.defineProperty(this, key, {
3560
+ configurable: true,
3561
+ writable: true,
3562
+ enumerable: true,
3563
+ value: v
3564
+ });
3565
+ }
3566
+ });
3567
+ }
3568
+ }
3569
+ const ZodType = /*@__PURE__*/ $constructor("ZodType", (inst, def) => {
3570
+ $ZodType.init(inst, def);
3571
+ Object.assign(inst["~standard"], { jsonSchema: {
3572
+ input: createStandardJSONSchemaMethod(inst, "input"),
3573
+ output: createStandardJSONSchemaMethod(inst, "output")
3574
+ } });
3575
+ inst.toJSONSchema = createToJSONSchemaMethod(inst, {});
3576
+ inst.def = def;
3577
+ inst.type = def.type;
3578
+ Object.defineProperty(inst, "_def", { value: def });
3579
+ inst.parse = (data, params) => parse(inst, data, params, { callee: inst.parse });
3580
+ inst.safeParse = (data, params) => safeParse(inst, data, params);
3581
+ inst.parseAsync = async (data, params) => parseAsync(inst, data, params, { callee: inst.parseAsync });
3582
+ inst.safeParseAsync = async (data, params) => safeParseAsync(inst, data, params);
3583
+ inst.spa = inst.safeParseAsync;
3584
+ inst.encode = (data, params) => encode(inst, data, params);
3585
+ inst.decode = (data, params) => decode(inst, data, params);
3586
+ inst.encodeAsync = async (data, params) => encodeAsync(inst, data, params);
3587
+ inst.decodeAsync = async (data, params) => decodeAsync(inst, data, params);
3588
+ inst.safeEncode = (data, params) => safeEncode(inst, data, params);
3589
+ inst.safeDecode = (data, params) => safeDecode(inst, data, params);
3590
+ inst.safeEncodeAsync = async (data, params) => safeEncodeAsync(inst, data, params);
3591
+ inst.safeDecodeAsync = async (data, params) => safeDecodeAsync(inst, data, params);
3592
+ _installLazyMethods(inst, "ZodType", {
3593
+ check(...chks) {
3594
+ const def = this.def;
3595
+ return this.clone(mergeDefs(def, { checks: [...def.checks ?? [], ...chks.map((ch) => typeof ch === "function" ? { _zod: {
3596
+ check: ch,
3597
+ def: { check: "custom" },
3598
+ onattach: []
3599
+ } } : ch)] }), { parent: true });
3600
+ },
3601
+ with(...chks) {
3602
+ return this.check(...chks);
3603
+ },
3604
+ clone(def, params) {
3605
+ return clone(this, def, params);
3606
+ },
3607
+ brand() {
3608
+ return this;
3609
+ },
3610
+ register(reg, meta) {
3611
+ reg.add(this, meta);
3612
+ return this;
3613
+ },
3614
+ refine(check, params) {
3615
+ return this.check(refine(check, params));
3616
+ },
3617
+ superRefine(refinement, params) {
3618
+ return this.check(superRefine(refinement, params));
3619
+ },
3620
+ overwrite(fn) {
3621
+ return this.check(/* @__PURE__ */ _overwrite(fn));
3622
+ },
3623
+ optional() {
3624
+ return optional(this);
3625
+ },
3626
+ exactOptional() {
3627
+ return exactOptional(this);
3628
+ },
3629
+ nullable() {
3630
+ return nullable(this);
3631
+ },
3632
+ nullish() {
3633
+ return optional(nullable(this));
3634
+ },
3635
+ nonoptional(params) {
3636
+ return nonoptional(this, params);
3637
+ },
3638
+ array() {
3639
+ return array(this);
3640
+ },
3641
+ or(arg) {
3642
+ return union([this, arg]);
3643
+ },
3644
+ and(arg) {
3645
+ return intersection(this, arg);
3646
+ },
3647
+ transform(tx) {
3648
+ return pipe(this, transform(tx));
3649
+ },
3650
+ default(d) {
3651
+ return _default(this, d);
3652
+ },
3653
+ prefault(d) {
3654
+ return prefault(this, d);
3655
+ },
3656
+ catch(params) {
3657
+ return _catch(this, params);
3658
+ },
3659
+ pipe(target) {
3660
+ return pipe(this, target);
3661
+ },
3662
+ readonly() {
3663
+ return readonly(this);
3664
+ },
3665
+ describe(description) {
3666
+ const cl = this.clone();
3667
+ globalRegistry.add(cl, { description });
3668
+ return cl;
3669
+ },
3670
+ meta(...args) {
3671
+ if (args.length === 0) return globalRegistry.get(this);
3672
+ const cl = this.clone();
3673
+ globalRegistry.add(cl, args[0]);
3674
+ return cl;
3675
+ },
3676
+ isOptional() {
3677
+ return this.safeParse(void 0).success;
3678
+ },
3679
+ isNullable() {
3680
+ return this.safeParse(null).success;
3681
+ },
3682
+ apply(fn) {
3683
+ return fn(this);
3684
+ }
3685
+ });
3686
+ Object.defineProperty(inst, "description", {
3687
+ get() {
3688
+ return globalRegistry.get(inst)?.description;
3689
+ },
3690
+ configurable: true
3691
+ });
3692
+ return inst;
3693
+ });
3694
+ /** @internal */
3695
+ const _ZodString = /*@__PURE__*/ $constructor("_ZodString", (inst, def) => {
3696
+ $ZodString.init(inst, def);
3697
+ ZodType.init(inst, def);
3698
+ inst._zod.processJSONSchema = (ctx, json, params) => stringProcessor(inst, ctx, json, params);
3699
+ const bag = inst._zod.bag;
3700
+ inst.format = bag.format ?? null;
3701
+ inst.minLength = bag.minimum ?? null;
3702
+ inst.maxLength = bag.maximum ?? null;
3703
+ _installLazyMethods(inst, "_ZodString", {
3704
+ regex(...args) {
3705
+ return this.check(/* @__PURE__ */ _regex(...args));
3706
+ },
3707
+ includes(...args) {
3708
+ return this.check(/* @__PURE__ */ _includes(...args));
3709
+ },
3710
+ startsWith(...args) {
3711
+ return this.check(/* @__PURE__ */ _startsWith(...args));
3712
+ },
3713
+ endsWith(...args) {
3714
+ return this.check(/* @__PURE__ */ _endsWith(...args));
3715
+ },
3716
+ min(...args) {
3717
+ return this.check(/* @__PURE__ */ _minLength(...args));
3718
+ },
3719
+ max(...args) {
3720
+ return this.check(/* @__PURE__ */ _maxLength(...args));
3721
+ },
3722
+ length(...args) {
3723
+ return this.check(/* @__PURE__ */ _length(...args));
3724
+ },
3725
+ nonempty(...args) {
3726
+ return this.check(/* @__PURE__ */ _minLength(1, ...args));
3727
+ },
3728
+ lowercase(params) {
3729
+ return this.check(/* @__PURE__ */ _lowercase(params));
3730
+ },
3731
+ uppercase(params) {
3732
+ return this.check(/* @__PURE__ */ _uppercase(params));
3733
+ },
3734
+ trim() {
3735
+ return this.check(/* @__PURE__ */ _trim());
3736
+ },
3737
+ normalize(...args) {
3738
+ return this.check(/* @__PURE__ */ _normalize(...args));
3739
+ },
3740
+ toLowerCase() {
3741
+ return this.check(/* @__PURE__ */ _toLowerCase());
3742
+ },
3743
+ toUpperCase() {
3744
+ return this.check(/* @__PURE__ */ _toUpperCase());
3745
+ },
3746
+ slugify() {
3747
+ return this.check(/* @__PURE__ */ _slugify());
3748
+ }
3749
+ });
3750
+ });
3751
+ const ZodString = /*@__PURE__*/ $constructor("ZodString", (inst, def) => {
3752
+ $ZodString.init(inst, def);
3753
+ _ZodString.init(inst, def);
3754
+ inst.email = (params) => inst.check(/* @__PURE__ */ _email(ZodEmail, params));
3755
+ inst.url = (params) => inst.check(/* @__PURE__ */ _url(ZodURL, params));
3756
+ inst.jwt = (params) => inst.check(/* @__PURE__ */ _jwt(ZodJWT, params));
3757
+ inst.emoji = (params) => inst.check(/* @__PURE__ */ _emoji(ZodEmoji, params));
3758
+ inst.guid = (params) => inst.check(/* @__PURE__ */ _guid(ZodGUID, params));
3759
+ inst.uuid = (params) => inst.check(/* @__PURE__ */ _uuid(ZodUUID, params));
3760
+ inst.uuidv4 = (params) => inst.check(/* @__PURE__ */ _uuidv4(ZodUUID, params));
3761
+ inst.uuidv6 = (params) => inst.check(/* @__PURE__ */ _uuidv6(ZodUUID, params));
3762
+ inst.uuidv7 = (params) => inst.check(/* @__PURE__ */ _uuidv7(ZodUUID, params));
3763
+ inst.nanoid = (params) => inst.check(/* @__PURE__ */ _nanoid(ZodNanoID, params));
3764
+ inst.guid = (params) => inst.check(/* @__PURE__ */ _guid(ZodGUID, params));
3765
+ inst.cuid = (params) => inst.check(/* @__PURE__ */ _cuid(ZodCUID, params));
3766
+ inst.cuid2 = (params) => inst.check(/* @__PURE__ */ _cuid2(ZodCUID2, params));
3767
+ inst.ulid = (params) => inst.check(/* @__PURE__ */ _ulid(ZodULID, params));
3768
+ inst.base64 = (params) => inst.check(/* @__PURE__ */ _base64(ZodBase64, params));
3769
+ inst.base64url = (params) => inst.check(/* @__PURE__ */ _base64url(ZodBase64URL, params));
3770
+ inst.xid = (params) => inst.check(/* @__PURE__ */ _xid(ZodXID, params));
3771
+ inst.ksuid = (params) => inst.check(/* @__PURE__ */ _ksuid(ZodKSUID, params));
3772
+ inst.ipv4 = (params) => inst.check(/* @__PURE__ */ _ipv4(ZodIPv4, params));
3773
+ inst.ipv6 = (params) => inst.check(/* @__PURE__ */ _ipv6(ZodIPv6, params));
3774
+ inst.cidrv4 = (params) => inst.check(/* @__PURE__ */ _cidrv4(ZodCIDRv4, params));
3775
+ inst.cidrv6 = (params) => inst.check(/* @__PURE__ */ _cidrv6(ZodCIDRv6, params));
3776
+ inst.e164 = (params) => inst.check(/* @__PURE__ */ _e164(ZodE164, params));
3777
+ inst.datetime = (params) => inst.check(datetime(params));
3778
+ inst.date = (params) => inst.check(date(params));
3779
+ inst.time = (params) => inst.check(time(params));
3780
+ inst.duration = (params) => inst.check(duration(params));
3781
+ });
3782
+ function string(params) {
3783
+ return /* @__PURE__ */ _string(ZodString, params);
3784
+ }
3785
+ const ZodStringFormat = /*@__PURE__*/ $constructor("ZodStringFormat", (inst, def) => {
3786
+ $ZodStringFormat.init(inst, def);
3787
+ _ZodString.init(inst, def);
3788
+ });
3789
+ const ZodEmail = /*@__PURE__*/ $constructor("ZodEmail", (inst, def) => {
3790
+ $ZodEmail.init(inst, def);
3791
+ ZodStringFormat.init(inst, def);
3792
+ });
3793
+ const ZodGUID = /*@__PURE__*/ $constructor("ZodGUID", (inst, def) => {
3794
+ $ZodGUID.init(inst, def);
3795
+ ZodStringFormat.init(inst, def);
3796
+ });
3797
+ const ZodUUID = /*@__PURE__*/ $constructor("ZodUUID", (inst, def) => {
3798
+ $ZodUUID.init(inst, def);
3799
+ ZodStringFormat.init(inst, def);
3800
+ });
3801
+ const ZodURL = /*@__PURE__*/ $constructor("ZodURL", (inst, def) => {
3802
+ $ZodURL.init(inst, def);
3803
+ ZodStringFormat.init(inst, def);
3804
+ });
3805
+ function url(params) {
3806
+ return /* @__PURE__ */ _url(ZodURL, params);
3807
+ }
3808
+ const ZodEmoji = /*@__PURE__*/ $constructor("ZodEmoji", (inst, def) => {
3809
+ $ZodEmoji.init(inst, def);
3810
+ ZodStringFormat.init(inst, def);
3811
+ });
3812
+ const ZodNanoID = /*@__PURE__*/ $constructor("ZodNanoID", (inst, def) => {
3813
+ $ZodNanoID.init(inst, def);
3814
+ ZodStringFormat.init(inst, def);
3815
+ });
3816
+ /**
3817
+ * @deprecated CUID v1 is deprecated by its authors due to information leakage
3818
+ * (timestamps embedded in the id). Use {@link ZodCUID2} instead.
3819
+ * See https://github.com/paralleldrive/cuid.
3820
+ */
3821
+ const ZodCUID = /*@__PURE__*/ $constructor("ZodCUID", (inst, def) => {
3822
+ $ZodCUID.init(inst, def);
3823
+ ZodStringFormat.init(inst, def);
3824
+ });
3825
+ const ZodCUID2 = /*@__PURE__*/ $constructor("ZodCUID2", (inst, def) => {
3826
+ $ZodCUID2.init(inst, def);
3827
+ ZodStringFormat.init(inst, def);
3828
+ });
3829
+ const ZodULID = /*@__PURE__*/ $constructor("ZodULID", (inst, def) => {
3830
+ $ZodULID.init(inst, def);
3831
+ ZodStringFormat.init(inst, def);
3832
+ });
3833
+ const ZodXID = /*@__PURE__*/ $constructor("ZodXID", (inst, def) => {
3834
+ $ZodXID.init(inst, def);
3835
+ ZodStringFormat.init(inst, def);
3836
+ });
3837
+ const ZodKSUID = /*@__PURE__*/ $constructor("ZodKSUID", (inst, def) => {
3838
+ $ZodKSUID.init(inst, def);
3839
+ ZodStringFormat.init(inst, def);
3840
+ });
3841
+ const ZodIPv4 = /*@__PURE__*/ $constructor("ZodIPv4", (inst, def) => {
3842
+ $ZodIPv4.init(inst, def);
3843
+ ZodStringFormat.init(inst, def);
3844
+ });
3845
+ const ZodIPv6 = /*@__PURE__*/ $constructor("ZodIPv6", (inst, def) => {
3846
+ $ZodIPv6.init(inst, def);
3847
+ ZodStringFormat.init(inst, def);
3848
+ });
3849
+ const ZodCIDRv4 = /*@__PURE__*/ $constructor("ZodCIDRv4", (inst, def) => {
3850
+ $ZodCIDRv4.init(inst, def);
3851
+ ZodStringFormat.init(inst, def);
3852
+ });
3853
+ const ZodCIDRv6 = /*@__PURE__*/ $constructor("ZodCIDRv6", (inst, def) => {
3854
+ $ZodCIDRv6.init(inst, def);
3855
+ ZodStringFormat.init(inst, def);
3856
+ });
3857
+ const ZodBase64 = /*@__PURE__*/ $constructor("ZodBase64", (inst, def) => {
3858
+ $ZodBase64.init(inst, def);
3859
+ ZodStringFormat.init(inst, def);
3860
+ });
3861
+ const ZodBase64URL = /*@__PURE__*/ $constructor("ZodBase64URL", (inst, def) => {
3862
+ $ZodBase64URL.init(inst, def);
3863
+ ZodStringFormat.init(inst, def);
3864
+ });
3865
+ const ZodE164 = /*@__PURE__*/ $constructor("ZodE164", (inst, def) => {
3866
+ $ZodE164.init(inst, def);
3867
+ ZodStringFormat.init(inst, def);
3868
+ });
3869
+ const ZodJWT = /*@__PURE__*/ $constructor("ZodJWT", (inst, def) => {
3870
+ $ZodJWT.init(inst, def);
3871
+ ZodStringFormat.init(inst, def);
3872
+ });
3873
+ const ZodNumber = /*@__PURE__*/ $constructor("ZodNumber", (inst, def) => {
3874
+ $ZodNumber.init(inst, def);
3875
+ ZodType.init(inst, def);
3876
+ inst._zod.processJSONSchema = (ctx, json, params) => numberProcessor(inst, ctx, json, params);
3877
+ _installLazyMethods(inst, "ZodNumber", {
3878
+ gt(value, params) {
3879
+ return this.check(/* @__PURE__ */ _gt(value, params));
3880
+ },
3881
+ gte(value, params) {
3882
+ return this.check(/* @__PURE__ */ _gte(value, params));
3883
+ },
3884
+ min(value, params) {
3885
+ return this.check(/* @__PURE__ */ _gte(value, params));
3886
+ },
3887
+ lt(value, params) {
3888
+ return this.check(/* @__PURE__ */ _lt(value, params));
3889
+ },
3890
+ lte(value, params) {
3891
+ return this.check(/* @__PURE__ */ _lte(value, params));
3892
+ },
3893
+ max(value, params) {
3894
+ return this.check(/* @__PURE__ */ _lte(value, params));
3895
+ },
3896
+ int(params) {
3897
+ return this.check(int(params));
3898
+ },
3899
+ safe(params) {
3900
+ return this.check(int(params));
3901
+ },
3902
+ positive(params) {
3903
+ return this.check(/* @__PURE__ */ _gt(0, params));
3904
+ },
3905
+ nonnegative(params) {
3906
+ return this.check(/* @__PURE__ */ _gte(0, params));
3907
+ },
3908
+ negative(params) {
3909
+ return this.check(/* @__PURE__ */ _lt(0, params));
3910
+ },
3911
+ nonpositive(params) {
3912
+ return this.check(/* @__PURE__ */ _lte(0, params));
3913
+ },
3914
+ multipleOf(value, params) {
3915
+ return this.check(/* @__PURE__ */ _multipleOf(value, params));
3916
+ },
3917
+ step(value, params) {
3918
+ return this.check(/* @__PURE__ */ _multipleOf(value, params));
3919
+ },
3920
+ finite() {
3921
+ return this;
3922
+ }
3923
+ });
3924
+ const bag = inst._zod.bag;
3925
+ inst.minValue = Math.max(bag.minimum ?? Number.NEGATIVE_INFINITY, bag.exclusiveMinimum ?? Number.NEGATIVE_INFINITY) ?? null;
3926
+ inst.maxValue = Math.min(bag.maximum ?? Number.POSITIVE_INFINITY, bag.exclusiveMaximum ?? Number.POSITIVE_INFINITY) ?? null;
3927
+ inst.isInt = (bag.format ?? "").includes("int") || Number.isSafeInteger(bag.multipleOf ?? .5);
3928
+ inst.isFinite = true;
3929
+ inst.format = bag.format ?? null;
3930
+ });
3931
+ function number(params) {
3932
+ return /* @__PURE__ */ _number(ZodNumber, params);
3933
+ }
3934
+ const ZodNumberFormat = /*@__PURE__*/ $constructor("ZodNumberFormat", (inst, def) => {
3935
+ $ZodNumberFormat.init(inst, def);
3936
+ ZodNumber.init(inst, def);
3937
+ });
3938
+ function int(params) {
3939
+ return /* @__PURE__ */ _int(ZodNumberFormat, params);
3940
+ }
3941
+ const ZodBoolean = /*@__PURE__*/ $constructor("ZodBoolean", (inst, def) => {
3942
+ $ZodBoolean.init(inst, def);
3943
+ ZodType.init(inst, def);
3944
+ inst._zod.processJSONSchema = (ctx, json, params) => booleanProcessor(inst, ctx, json, params);
3945
+ });
3946
+ function boolean(params) {
3947
+ return /* @__PURE__ */ _boolean(ZodBoolean, params);
3948
+ }
3949
+ const ZodNull = /*@__PURE__*/ $constructor("ZodNull", (inst, def) => {
3950
+ $ZodNull.init(inst, def);
3951
+ ZodType.init(inst, def);
3952
+ inst._zod.processJSONSchema = (ctx, json, params) => nullProcessor(inst, ctx, json, params);
3953
+ });
3954
+ function _null(params) {
3955
+ return /* @__PURE__ */ _null$1(ZodNull, params);
3956
+ }
3957
+ const ZodAny = /*@__PURE__*/ $constructor("ZodAny", (inst, def) => {
3958
+ $ZodAny.init(inst, def);
3959
+ ZodType.init(inst, def);
3960
+ inst._zod.processJSONSchema = (ctx, json, params) => void 0;
3961
+ });
3962
+ function any() {
3963
+ return /* @__PURE__ */ _any(ZodAny);
3964
+ }
3965
+ const ZodUnknown = /*@__PURE__*/ $constructor("ZodUnknown", (inst, def) => {
3966
+ $ZodUnknown.init(inst, def);
3967
+ ZodType.init(inst, def);
3968
+ inst._zod.processJSONSchema = (ctx, json, params) => void 0;
3969
+ });
3970
+ function unknown() {
3971
+ return /* @__PURE__ */ _unknown(ZodUnknown);
3972
+ }
3973
+ const ZodNever = /*@__PURE__*/ $constructor("ZodNever", (inst, def) => {
3974
+ $ZodNever.init(inst, def);
3975
+ ZodType.init(inst, def);
3976
+ inst._zod.processJSONSchema = (ctx, json, params) => neverProcessor(inst, ctx, json, params);
3977
+ });
3978
+ function never(params) {
3979
+ return /* @__PURE__ */ _never(ZodNever, params);
3980
+ }
3981
+ const ZodArray = /*@__PURE__*/ $constructor("ZodArray", (inst, def) => {
3982
+ $ZodArray.init(inst, def);
3983
+ ZodType.init(inst, def);
3984
+ inst._zod.processJSONSchema = (ctx, json, params) => arrayProcessor(inst, ctx, json, params);
3985
+ inst.element = def.element;
3986
+ _installLazyMethods(inst, "ZodArray", {
3987
+ min(n, params) {
3988
+ return this.check(/* @__PURE__ */ _minLength(n, params));
3989
+ },
3990
+ nonempty(params) {
3991
+ return this.check(/* @__PURE__ */ _minLength(1, params));
3992
+ },
3993
+ max(n, params) {
3994
+ return this.check(/* @__PURE__ */ _maxLength(n, params));
3995
+ },
3996
+ length(n, params) {
3997
+ return this.check(/* @__PURE__ */ _length(n, params));
3998
+ },
3999
+ unwrap() {
4000
+ return this.element;
4001
+ }
4002
+ });
4003
+ });
4004
+ function array(element, params) {
4005
+ return /* @__PURE__ */ _array(ZodArray, element, params);
4006
+ }
4007
+ const ZodObject = /*@__PURE__*/ $constructor("ZodObject", (inst, def) => {
4008
+ $ZodObjectJIT.init(inst, def);
4009
+ ZodType.init(inst, def);
4010
+ inst._zod.processJSONSchema = (ctx, json, params) => objectProcessor(inst, ctx, json, params);
4011
+ defineLazy(inst, "shape", () => {
4012
+ return def.shape;
4013
+ });
4014
+ _installLazyMethods(inst, "ZodObject", {
4015
+ keyof() {
4016
+ return _enum(Object.keys(this._zod.def.shape));
4017
+ },
4018
+ catchall(catchall) {
4019
+ return this.clone({
4020
+ ...this._zod.def,
4021
+ catchall
4022
+ });
4023
+ },
4024
+ passthrough() {
4025
+ return this.clone({
4026
+ ...this._zod.def,
4027
+ catchall: unknown()
4028
+ });
4029
+ },
4030
+ loose() {
4031
+ return this.clone({
4032
+ ...this._zod.def,
4033
+ catchall: unknown()
4034
+ });
4035
+ },
4036
+ strict() {
4037
+ return this.clone({
4038
+ ...this._zod.def,
4039
+ catchall: never()
4040
+ });
4041
+ },
4042
+ strip() {
4043
+ return this.clone({
4044
+ ...this._zod.def,
4045
+ catchall: void 0
4046
+ });
4047
+ },
4048
+ extend(incoming) {
4049
+ return extend(this, incoming);
4050
+ },
4051
+ safeExtend(incoming) {
4052
+ return safeExtend(this, incoming);
4053
+ },
4054
+ merge(other) {
4055
+ return merge(this, other);
4056
+ },
4057
+ pick(mask) {
4058
+ return pick(this, mask);
4059
+ },
4060
+ omit(mask) {
4061
+ return omit(this, mask);
4062
+ },
4063
+ partial(...args) {
4064
+ return partial(ZodOptional, this, args[0]);
4065
+ },
4066
+ required(...args) {
4067
+ return required(ZodNonOptional, this, args[0]);
4068
+ }
4069
+ });
4070
+ });
4071
+ function object(shape, params) {
4072
+ const def = {
4073
+ type: "object",
4074
+ shape: shape ?? {},
4075
+ ...normalizeParams(params)
4076
+ };
4077
+ return new ZodObject(def);
4078
+ }
4079
+ function looseObject(shape, params) {
4080
+ return new ZodObject({
4081
+ type: "object",
4082
+ shape,
4083
+ catchall: unknown(),
4084
+ ...normalizeParams(params)
4085
+ });
4086
+ }
4087
+ const ZodUnion = /*@__PURE__*/ $constructor("ZodUnion", (inst, def) => {
4088
+ $ZodUnion.init(inst, def);
4089
+ ZodType.init(inst, def);
4090
+ inst._zod.processJSONSchema = (ctx, json, params) => unionProcessor(inst, ctx, json, params);
4091
+ inst.options = def.options;
4092
+ });
4093
+ function union(options, params) {
4094
+ return new ZodUnion({
4095
+ type: "union",
4096
+ options,
4097
+ ...normalizeParams(params)
4098
+ });
4099
+ }
4100
+ const ZodDiscriminatedUnion = /*@__PURE__*/ $constructor("ZodDiscriminatedUnion", (inst, def) => {
4101
+ ZodUnion.init(inst, def);
4102
+ $ZodDiscriminatedUnion.init(inst, def);
4103
+ });
4104
+ function discriminatedUnion(discriminator, options, params) {
4105
+ return new ZodDiscriminatedUnion({
4106
+ type: "union",
4107
+ options,
4108
+ discriminator,
4109
+ ...normalizeParams(params)
4110
+ });
4111
+ }
4112
+ const ZodIntersection = /*@__PURE__*/ $constructor("ZodIntersection", (inst, def) => {
4113
+ $ZodIntersection.init(inst, def);
4114
+ ZodType.init(inst, def);
4115
+ inst._zod.processJSONSchema = (ctx, json, params) => intersectionProcessor(inst, ctx, json, params);
4116
+ });
4117
+ function intersection(left, right) {
4118
+ return new ZodIntersection({
4119
+ type: "intersection",
4120
+ left,
4121
+ right
4122
+ });
4123
+ }
4124
+ const ZodRecord = /*@__PURE__*/ $constructor("ZodRecord", (inst, def) => {
4125
+ $ZodRecord.init(inst, def);
4126
+ ZodType.init(inst, def);
4127
+ inst._zod.processJSONSchema = (ctx, json, params) => recordProcessor(inst, ctx, json, params);
4128
+ inst.keyType = def.keyType;
4129
+ inst.valueType = def.valueType;
4130
+ });
4131
+ function record(keyType, valueType, params) {
4132
+ if (!valueType || !valueType._zod) return new ZodRecord({
4133
+ type: "record",
4134
+ keyType: string(),
4135
+ valueType: keyType,
4136
+ ...normalizeParams(valueType)
4137
+ });
4138
+ return new ZodRecord({
4139
+ type: "record",
4140
+ keyType,
4141
+ valueType,
4142
+ ...normalizeParams(params)
4143
+ });
4144
+ }
4145
+ const ZodEnum = /*@__PURE__*/ $constructor("ZodEnum", (inst, def) => {
4146
+ $ZodEnum.init(inst, def);
4147
+ ZodType.init(inst, def);
4148
+ inst._zod.processJSONSchema = (ctx, json, params) => enumProcessor(inst, ctx, json, params);
4149
+ inst.enum = def.entries;
4150
+ inst.options = Object.values(def.entries);
4151
+ const keys = new Set(Object.keys(def.entries));
4152
+ inst.extract = (values, params) => {
4153
+ const newEntries = {};
4154
+ for (const value of values) if (keys.has(value)) newEntries[value] = def.entries[value];
4155
+ else throw new Error(`Key ${value} not found in enum`);
4156
+ return new ZodEnum({
4157
+ ...def,
4158
+ checks: [],
4159
+ ...normalizeParams(params),
4160
+ entries: newEntries
4161
+ });
4162
+ };
4163
+ inst.exclude = (values, params) => {
4164
+ const newEntries = { ...def.entries };
4165
+ for (const value of values) if (keys.has(value)) delete newEntries[value];
4166
+ else throw new Error(`Key ${value} not found in enum`);
4167
+ return new ZodEnum({
4168
+ ...def,
4169
+ checks: [],
4170
+ ...normalizeParams(params),
4171
+ entries: newEntries
4172
+ });
4173
+ };
4174
+ });
4175
+ function _enum(values, params) {
4176
+ const entries = Array.isArray(values) ? Object.fromEntries(values.map((v) => [v, v])) : values;
4177
+ return new ZodEnum({
4178
+ type: "enum",
4179
+ entries,
4180
+ ...normalizeParams(params)
4181
+ });
4182
+ }
4183
+ const ZodLiteral = /*@__PURE__*/ $constructor("ZodLiteral", (inst, def) => {
4184
+ $ZodLiteral.init(inst, def);
4185
+ ZodType.init(inst, def);
4186
+ inst._zod.processJSONSchema = (ctx, json, params) => literalProcessor(inst, ctx, json, params);
4187
+ inst.values = new Set(def.values);
4188
+ Object.defineProperty(inst, "value", { get() {
4189
+ if (def.values.length > 1) throw new Error("This schema contains multiple valid literal values. Use `.values` instead.");
4190
+ return def.values[0];
4191
+ } });
4192
+ });
4193
+ function literal(value, params) {
4194
+ return new ZodLiteral({
4195
+ type: "literal",
4196
+ values: Array.isArray(value) ? value : [value],
4197
+ ...normalizeParams(params)
4198
+ });
4199
+ }
4200
+ const ZodTransform = /*@__PURE__*/ $constructor("ZodTransform", (inst, def) => {
4201
+ $ZodTransform.init(inst, def);
4202
+ ZodType.init(inst, def);
4203
+ inst._zod.processJSONSchema = (ctx, json, params) => transformProcessor(inst, ctx, json, params);
4204
+ inst._zod.parse = (payload, _ctx) => {
4205
+ if (_ctx.direction === "backward") throw new $ZodEncodeError(inst.constructor.name);
4206
+ payload.addIssue = (issue$1) => {
4207
+ if (typeof issue$1 === "string") payload.issues.push(issue(issue$1, payload.value, def));
4208
+ else {
4209
+ const _issue = issue$1;
4210
+ if (_issue.fatal) _issue.continue = false;
4211
+ _issue.code ?? (_issue.code = "custom");
4212
+ _issue.input ?? (_issue.input = payload.value);
4213
+ _issue.inst ?? (_issue.inst = inst);
4214
+ payload.issues.push(issue(_issue));
4215
+ }
4216
+ };
4217
+ const output = def.transform(payload.value, payload);
4218
+ if (output instanceof Promise) return output.then((output) => {
4219
+ payload.value = output;
4220
+ payload.fallback = true;
4221
+ return payload;
4222
+ });
4223
+ payload.value = output;
4224
+ payload.fallback = true;
4225
+ return payload;
4226
+ };
4227
+ });
4228
+ function transform(fn) {
4229
+ return new ZodTransform({
4230
+ type: "transform",
4231
+ transform: fn
4232
+ });
4233
+ }
4234
+ const ZodOptional = /*@__PURE__*/ $constructor("ZodOptional", (inst, def) => {
4235
+ $ZodOptional.init(inst, def);
4236
+ ZodType.init(inst, def);
4237
+ inst._zod.processJSONSchema = (ctx, json, params) => optionalProcessor(inst, ctx, json, params);
4238
+ inst.unwrap = () => inst._zod.def.innerType;
4239
+ });
4240
+ function optional(innerType) {
4241
+ return new ZodOptional({
4242
+ type: "optional",
4243
+ innerType
4244
+ });
4245
+ }
4246
+ const ZodExactOptional = /*@__PURE__*/ $constructor("ZodExactOptional", (inst, def) => {
4247
+ $ZodExactOptional.init(inst, def);
4248
+ ZodType.init(inst, def);
4249
+ inst._zod.processJSONSchema = (ctx, json, params) => optionalProcessor(inst, ctx, json, params);
4250
+ inst.unwrap = () => inst._zod.def.innerType;
4251
+ });
4252
+ function exactOptional(innerType) {
4253
+ return new ZodExactOptional({
4254
+ type: "optional",
4255
+ innerType
4256
+ });
4257
+ }
4258
+ const ZodNullable = /*@__PURE__*/ $constructor("ZodNullable", (inst, def) => {
4259
+ $ZodNullable.init(inst, def);
4260
+ ZodType.init(inst, def);
4261
+ inst._zod.processJSONSchema = (ctx, json, params) => nullableProcessor(inst, ctx, json, params);
4262
+ inst.unwrap = () => inst._zod.def.innerType;
4263
+ });
4264
+ function nullable(innerType) {
4265
+ return new ZodNullable({
4266
+ type: "nullable",
4267
+ innerType
4268
+ });
4269
+ }
4270
+ const ZodDefault = /*@__PURE__*/ $constructor("ZodDefault", (inst, def) => {
4271
+ $ZodDefault.init(inst, def);
4272
+ ZodType.init(inst, def);
4273
+ inst._zod.processJSONSchema = (ctx, json, params) => defaultProcessor(inst, ctx, json, params);
4274
+ inst.unwrap = () => inst._zod.def.innerType;
4275
+ inst.removeDefault = inst.unwrap;
4276
+ });
4277
+ function _default(innerType, defaultValue) {
4278
+ return new ZodDefault({
4279
+ type: "default",
4280
+ innerType,
4281
+ get defaultValue() {
4282
+ return typeof defaultValue === "function" ? defaultValue() : shallowClone(defaultValue);
4283
+ }
4284
+ });
4285
+ }
4286
+ const ZodPrefault = /*@__PURE__*/ $constructor("ZodPrefault", (inst, def) => {
4287
+ $ZodPrefault.init(inst, def);
4288
+ ZodType.init(inst, def);
4289
+ inst._zod.processJSONSchema = (ctx, json, params) => prefaultProcessor(inst, ctx, json, params);
4290
+ inst.unwrap = () => inst._zod.def.innerType;
4291
+ });
4292
+ function prefault(innerType, defaultValue) {
4293
+ return new ZodPrefault({
4294
+ type: "prefault",
4295
+ innerType,
4296
+ get defaultValue() {
4297
+ return typeof defaultValue === "function" ? defaultValue() : shallowClone(defaultValue);
4298
+ }
4299
+ });
4300
+ }
4301
+ const ZodNonOptional = /*@__PURE__*/ $constructor("ZodNonOptional", (inst, def) => {
4302
+ $ZodNonOptional.init(inst, def);
4303
+ ZodType.init(inst, def);
4304
+ inst._zod.processJSONSchema = (ctx, json, params) => nonoptionalProcessor(inst, ctx, json, params);
4305
+ inst.unwrap = () => inst._zod.def.innerType;
4306
+ });
4307
+ function nonoptional(innerType, params) {
4308
+ return new ZodNonOptional({
4309
+ type: "nonoptional",
4310
+ innerType,
4311
+ ...normalizeParams(params)
4312
+ });
4313
+ }
4314
+ const ZodCatch = /*@__PURE__*/ $constructor("ZodCatch", (inst, def) => {
4315
+ $ZodCatch.init(inst, def);
4316
+ ZodType.init(inst, def);
4317
+ inst._zod.processJSONSchema = (ctx, json, params) => catchProcessor(inst, ctx, json, params);
4318
+ inst.unwrap = () => inst._zod.def.innerType;
4319
+ inst.removeCatch = inst.unwrap;
4320
+ });
4321
+ function _catch(innerType, catchValue) {
4322
+ return new ZodCatch({
4323
+ type: "catch",
4324
+ innerType,
4325
+ catchValue: typeof catchValue === "function" ? catchValue : () => catchValue
4326
+ });
4327
+ }
4328
+ const ZodPipe = /*@__PURE__*/ $constructor("ZodPipe", (inst, def) => {
4329
+ $ZodPipe.init(inst, def);
4330
+ ZodType.init(inst, def);
4331
+ inst._zod.processJSONSchema = (ctx, json, params) => pipeProcessor(inst, ctx, json, params);
4332
+ inst.in = def.in;
4333
+ inst.out = def.out;
4334
+ });
4335
+ function pipe(in_, out) {
4336
+ return new ZodPipe({
4337
+ type: "pipe",
4338
+ in: in_,
4339
+ out
4340
+ });
4341
+ }
4342
+ const ZodPreprocess = /*@__PURE__*/ $constructor("ZodPreprocess", (inst, def) => {
4343
+ ZodPipe.init(inst, def);
4344
+ $ZodPreprocess.init(inst, def);
4345
+ });
4346
+ const ZodReadonly = /*@__PURE__*/ $constructor("ZodReadonly", (inst, def) => {
4347
+ $ZodReadonly.init(inst, def);
4348
+ ZodType.init(inst, def);
4349
+ inst._zod.processJSONSchema = (ctx, json, params) => readonlyProcessor(inst, ctx, json, params);
4350
+ inst.unwrap = () => inst._zod.def.innerType;
4351
+ });
4352
+ function readonly(innerType) {
4353
+ return new ZodReadonly({
4354
+ type: "readonly",
4355
+ innerType
4356
+ });
4357
+ }
4358
+ const ZodCustom = /*@__PURE__*/ $constructor("ZodCustom", (inst, def) => {
4359
+ $ZodCustom.init(inst, def);
4360
+ ZodType.init(inst, def);
4361
+ inst._zod.processJSONSchema = (ctx, json, params) => customProcessor(inst, ctx, json, params);
4362
+ });
4363
+ function custom(fn, _params) {
4364
+ return /* @__PURE__ */ _custom(ZodCustom, fn ?? (() => true), _params);
4365
+ }
4366
+ function refine(fn, _params = {}) {
4367
+ return /* @__PURE__ */ _refine(ZodCustom, fn, _params);
4368
+ }
4369
+ function superRefine(fn, params) {
4370
+ return /* @__PURE__ */ _superRefine(fn, params);
4371
+ }
4372
+ function preprocess(fn, schema) {
4373
+ return new ZodPreprocess({
4374
+ type: "pipe",
4375
+ in: transform(fn),
4376
+ out: schema
4377
+ });
4378
+ }
4379
+ //#endregion
4380
+ export { _coercedNumber as C, datetime as S, NEVER as T, record as _, array as a, unknown as b, discriminatedUnion as c, literal as d, looseObject as f, preprocess as g, optional as h, any as i, int as l, object as m, _enum as n, boolean as o, number as p, _null as r, custom as s, ZodNumber as t, intersection as u, string as v, safeParse$1 as w, url as x, union as y };
4381
+
4382
+ //# sourceMappingURL=schemas-CQkO9hC5.js.map