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