@rpcbase/auth 0.165.0 → 0.167.0

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