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