@wix/astro 2.8.0 → 2.10.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (59) hide show
  1. package/build/dependencies/astro-auth/backend-runtime/chunk-BIARYLOZ.js +3267 -0
  2. package/build/dependencies/astro-auth/backend-runtime/chunk-HPW4ZAEJ.js +23 -0
  3. package/build/dependencies/astro-auth/backend-runtime/chunk-MLKGABMK.js +9 -0
  4. package/build/dependencies/astro-auth/backend-runtime/chunk-RTCWF7UX.js +90 -0
  5. package/build/dependencies/astro-auth/backend-runtime/chunk-YHKPE45V.js +13 -0
  6. package/build/dependencies/astro-auth/backend-runtime/middleware/auth.d.ts +5 -0
  7. package/build/dependencies/astro-auth/backend-runtime/middleware/auth.js +85 -0
  8. package/build/dependencies/astro-auth/backend-runtime/routes/callback.d.ts +5 -0
  9. package/build/dependencies/astro-auth/backend-runtime/routes/callback.js +52 -0
  10. package/build/dependencies/astro-auth/backend-runtime/routes/login.d.ts +5 -0
  11. package/build/dependencies/astro-auth/backend-runtime/routes/login.js +45 -0
  12. package/build/dependencies/astro-auth/backend-runtime/routes/logout-callback.d.ts +5 -0
  13. package/build/dependencies/astro-auth/backend-runtime/routes/logout-callback.js +23 -0
  14. package/build/dependencies/astro-auth/backend-runtime/routes/logout.d.ts +5 -0
  15. package/build/dependencies/astro-auth/backend-runtime/routes/logout.js +32 -0
  16. package/build/dependencies/astro-auth/backend-runtime/runtime/backend/setupContextualClient.d.ts +2 -0
  17. package/build/dependencies/astro-auth/backend-runtime/runtime/backend/setupContextualClient.js +2 -0
  18. package/build/dependencies/astro-auth/browser-runtime/setup.d.ts +5 -0
  19. package/build/dependencies/astro-auth/browser-runtime/setup.js +63 -0
  20. package/build/dependencies/astro-backend-extensions/backend-runtime/chunk-RHCMPH4V.js +24 -0
  21. package/build/dependencies/astro-backend-extensions/backend-runtime/routes/servicePlugins.d.ts +5 -0
  22. package/build/dependencies/astro-backend-extensions/backend-runtime/routes/servicePlugins.js +18 -0
  23. package/build/dependencies/astro-backend-extensions/backend-runtime/routes/webhooks.d.ts +5 -0
  24. package/build/dependencies/astro-backend-extensions/backend-runtime/routes/webhooks.js +18 -0
  25. package/build/dependencies/astro-backend-extensions/backend-runtime/runtime/setupServicePlugin.d.ts +5 -0
  26. package/build/dependencies/astro-backend-extensions/backend-runtime/runtime/setupServicePlugin.js +14 -0
  27. package/build/dependencies/astro-backend-extensions/backend-runtime/runtime/setupWebhook.d.ts +5 -0
  28. package/build/dependencies/astro-backend-extensions/backend-runtime/runtime/setupWebhook.js +15 -0
  29. package/build/dependencies/astro-backoffice-extensions/astro-runtime/entry.astro +30 -0
  30. package/build/dependencies/astro-backoffice-extensions/browser-runtime/wrapComponent.d.ts +5 -0
  31. package/build/dependencies/astro-backoffice-extensions/browser-runtime/wrapComponent.js +8 -0
  32. package/build/dependencies/astro-custom-elements-extensions/browser-runtime/index.d.ts +11 -0
  33. package/build/dependencies/astro-custom-elements-extensions/browser-runtime/index.js +77 -0
  34. package/build/dependencies/astro-embedded-scripts-extensions/browser-runtime/setupContext.d.ts +5 -0
  35. package/build/dependencies/astro-embedded-scripts-extensions/browser-runtime/setupContext.js +25 -0
  36. package/build/dependencies/astro-html-embeds/backend-runtime/html-embeds.d.ts +5 -0
  37. package/build/dependencies/astro-html-embeds/backend-runtime/html-embeds.js +64 -0
  38. package/build/dependencies/astro-payment-links/backend-runtime/chunk-656BVIJ3.js +9 -0
  39. package/build/dependencies/astro-payment-links/backend-runtime/payment-checkout.d.ts +5 -0
  40. package/build/dependencies/astro-payment-links/backend-runtime/payment-checkout.js +24 -0
  41. package/build/dependencies/astro-payment-links/backend-runtime/payment-link.d.ts +5 -0
  42. package/build/dependencies/astro-payment-links/backend-runtime/payment-link.js +20 -0
  43. package/build/dependencies/astro-robots/backend-runtime/robots.d.ts +5 -0
  44. package/build/dependencies/astro-robots/backend-runtime/robots.js +38 -0
  45. package/build/dependencies/astro-site-components-extensions/browser-runtime/hmr.js +26 -0
  46. package/build/dependencies/astro-viewer-api/backend-runtime/api.d.ts +5 -0
  47. package/build/dependencies/astro-viewer-api/backend-runtime/api.js +34 -0
  48. package/build/{builders.d.ts → integration/builders.d.ts} +1 -0
  49. package/build/{builders.js → integration/builders.js} +16 -13
  50. package/build/integration/builders.js.map +1 -0
  51. package/build/integration/chunk-JFJIM45R.js +29525 -0
  52. package/build/integration/chunk-JFJIM45R.js.map +1 -0
  53. package/build/integration/index.js +306 -0
  54. package/build/integration/index.js.map +1 -0
  55. package/package.json +26 -14
  56. package/build/builders.js.map +0 -1
  57. package/build/index.js +0 -54
  58. package/build/index.js.map +0 -1
  59. /package/build/{index.d.ts → integration/index.d.ts} +0 -0
@@ -0,0 +1,3267 @@
1
+ import {
2
+ __export
3
+ } from "./chunk-MLKGABMK.js";
4
+
5
+ // ../../node_modules/zod/v4/core/core.js
6
+ var NEVER = Object.freeze({
7
+ status: "aborted"
8
+ });
9
+ // @__NO_SIDE_EFFECTS__
10
+ function $constructor(name, initializer3, params) {
11
+ function init(inst, def) {
12
+ var _a;
13
+ Object.defineProperty(inst, "_zod", {
14
+ value: inst._zod ?? {},
15
+ enumerable: false
16
+ });
17
+ (_a = inst._zod).traits ?? (_a.traits = /* @__PURE__ */ new Set());
18
+ inst._zod.traits.add(name);
19
+ initializer3(inst, def);
20
+ for (const k in _.prototype) {
21
+ if (!(k in inst))
22
+ Object.defineProperty(inst, k, { value: _.prototype[k].bind(inst) });
23
+ }
24
+ inst._zod.constr = _;
25
+ inst._zod.def = def;
26
+ }
27
+ const Parent = params?.Parent ?? Object;
28
+ class Definition extends Parent {
29
+ }
30
+ Object.defineProperty(Definition, "name", { value: name });
31
+ function _(def) {
32
+ var _a;
33
+ const inst = params?.Parent ? new Definition() : this;
34
+ init(inst, def);
35
+ (_a = inst._zod).deferred ?? (_a.deferred = []);
36
+ for (const fn of inst._zod.deferred) {
37
+ fn();
38
+ }
39
+ return inst;
40
+ }
41
+ Object.defineProperty(_, "init", { value: init });
42
+ Object.defineProperty(_, Symbol.hasInstance, {
43
+ value: (inst) => {
44
+ if (params?.Parent && inst instanceof params.Parent)
45
+ return true;
46
+ return inst?._zod?.traits?.has(name);
47
+ }
48
+ });
49
+ Object.defineProperty(_, "name", { value: name });
50
+ return _;
51
+ }
52
+ var $brand = Symbol("zod_brand");
53
+ var $ZodAsyncError = class extends Error {
54
+ constructor() {
55
+ super(`Encountered Promise during synchronous parse. Use .parseAsync() instead.`);
56
+ }
57
+ };
58
+ var $ZodEncodeError = class extends Error {
59
+ constructor(name) {
60
+ super(`Encountered unidirectional transform during encode: ${name}`);
61
+ this.name = "ZodEncodeError";
62
+ }
63
+ };
64
+ var globalConfig = {};
65
+ function config(newConfig) {
66
+ if (newConfig)
67
+ Object.assign(globalConfig, newConfig);
68
+ return globalConfig;
69
+ }
70
+
71
+ // ../../node_modules/zod/v4/core/util.js
72
+ var util_exports = {};
73
+ __export(util_exports, {
74
+ BIGINT_FORMAT_RANGES: () => BIGINT_FORMAT_RANGES,
75
+ Class: () => Class,
76
+ NUMBER_FORMAT_RANGES: () => NUMBER_FORMAT_RANGES,
77
+ aborted: () => aborted,
78
+ allowsEval: () => allowsEval,
79
+ assert: () => assert,
80
+ assertEqual: () => assertEqual,
81
+ assertIs: () => assertIs,
82
+ assertNever: () => assertNever,
83
+ assertNotEqual: () => assertNotEqual,
84
+ assignProp: () => assignProp,
85
+ base64ToUint8Array: () => base64ToUint8Array,
86
+ base64urlToUint8Array: () => base64urlToUint8Array,
87
+ cached: () => cached,
88
+ captureStackTrace: () => captureStackTrace,
89
+ cleanEnum: () => cleanEnum,
90
+ cleanRegex: () => cleanRegex,
91
+ clone: () => clone,
92
+ cloneDef: () => cloneDef,
93
+ createTransparentProxy: () => createTransparentProxy,
94
+ defineLazy: () => defineLazy,
95
+ esc: () => esc,
96
+ escapeRegex: () => escapeRegex,
97
+ extend: () => extend,
98
+ finalizeIssue: () => finalizeIssue,
99
+ floatSafeRemainder: () => floatSafeRemainder,
100
+ getElementAtPath: () => getElementAtPath,
101
+ getEnumValues: () => getEnumValues,
102
+ getLengthableOrigin: () => getLengthableOrigin,
103
+ getParsedType: () => getParsedType,
104
+ getSizableOrigin: () => getSizableOrigin,
105
+ hexToUint8Array: () => hexToUint8Array,
106
+ isObject: () => isObject,
107
+ isPlainObject: () => isPlainObject,
108
+ issue: () => issue,
109
+ joinValues: () => joinValues,
110
+ jsonStringifyReplacer: () => jsonStringifyReplacer,
111
+ merge: () => merge,
112
+ mergeDefs: () => mergeDefs,
113
+ normalizeParams: () => normalizeParams,
114
+ nullish: () => nullish,
115
+ numKeys: () => numKeys,
116
+ objectClone: () => objectClone,
117
+ omit: () => omit,
118
+ optionalKeys: () => optionalKeys,
119
+ partial: () => partial,
120
+ pick: () => pick,
121
+ prefixIssues: () => prefixIssues,
122
+ primitiveTypes: () => primitiveTypes,
123
+ promiseAllObject: () => promiseAllObject,
124
+ propertyKeyTypes: () => propertyKeyTypes,
125
+ randomString: () => randomString,
126
+ required: () => required,
127
+ safeExtend: () => safeExtend,
128
+ shallowClone: () => shallowClone,
129
+ stringifyPrimitive: () => stringifyPrimitive,
130
+ uint8ArrayToBase64: () => uint8ArrayToBase64,
131
+ uint8ArrayToBase64url: () => uint8ArrayToBase64url,
132
+ uint8ArrayToHex: () => uint8ArrayToHex,
133
+ unwrapMessage: () => unwrapMessage
134
+ });
135
+ function assertEqual(val) {
136
+ return val;
137
+ }
138
+ function assertNotEqual(val) {
139
+ return val;
140
+ }
141
+ function assertIs(_arg) {
142
+ }
143
+ function assertNever(_x) {
144
+ throw new Error();
145
+ }
146
+ function assert(_) {
147
+ }
148
+ function getEnumValues(entries) {
149
+ const numericValues = Object.values(entries).filter((v) => typeof v === "number");
150
+ const values = Object.entries(entries).filter(([k, _]) => numericValues.indexOf(+k) === -1).map(([_, v]) => v);
151
+ return values;
152
+ }
153
+ function joinValues(array2, separator = "|") {
154
+ return array2.map((val) => stringifyPrimitive(val)).join(separator);
155
+ }
156
+ function jsonStringifyReplacer(_, value) {
157
+ if (typeof value === "bigint")
158
+ return value.toString();
159
+ return value;
160
+ }
161
+ function cached(getter) {
162
+ const set = false;
163
+ return {
164
+ get value() {
165
+ if (!set) {
166
+ const value = getter();
167
+ Object.defineProperty(this, "value", { value });
168
+ return value;
169
+ }
170
+ throw new Error("cached value already set");
171
+ }
172
+ };
173
+ }
174
+ function nullish(input) {
175
+ return input === null || input === void 0;
176
+ }
177
+ function cleanRegex(source) {
178
+ const start = source.startsWith("^") ? 1 : 0;
179
+ const end = source.endsWith("$") ? source.length - 1 : source.length;
180
+ return source.slice(start, end);
181
+ }
182
+ function floatSafeRemainder(val, step) {
183
+ const valDecCount = (val.toString().split(".")[1] || "").length;
184
+ const stepString = step.toString();
185
+ let stepDecCount = (stepString.split(".")[1] || "").length;
186
+ if (stepDecCount === 0 && /\d?e-\d?/.test(stepString)) {
187
+ const match = stepString.match(/\d?e-(\d?)/);
188
+ if (match?.[1]) {
189
+ stepDecCount = Number.parseInt(match[1]);
190
+ }
191
+ }
192
+ const decCount = valDecCount > stepDecCount ? valDecCount : stepDecCount;
193
+ const valInt = Number.parseInt(val.toFixed(decCount).replace(".", ""));
194
+ const stepInt = Number.parseInt(step.toFixed(decCount).replace(".", ""));
195
+ return valInt % stepInt / 10 ** decCount;
196
+ }
197
+ var EVALUATING = Symbol("evaluating");
198
+ function defineLazy(object2, key, getter) {
199
+ let value = void 0;
200
+ Object.defineProperty(object2, key, {
201
+ get() {
202
+ if (value === EVALUATING) {
203
+ return void 0;
204
+ }
205
+ if (value === void 0) {
206
+ value = EVALUATING;
207
+ value = getter();
208
+ }
209
+ return value;
210
+ },
211
+ set(v) {
212
+ Object.defineProperty(object2, key, {
213
+ value: v
214
+ // configurable: true,
215
+ });
216
+ },
217
+ configurable: true
218
+ });
219
+ }
220
+ function objectClone(obj) {
221
+ return Object.create(Object.getPrototypeOf(obj), Object.getOwnPropertyDescriptors(obj));
222
+ }
223
+ function assignProp(target, prop, value) {
224
+ Object.defineProperty(target, prop, {
225
+ value,
226
+ writable: true,
227
+ enumerable: true,
228
+ configurable: true
229
+ });
230
+ }
231
+ function mergeDefs(...defs) {
232
+ const mergedDescriptors = {};
233
+ for (const def of defs) {
234
+ const descriptors = Object.getOwnPropertyDescriptors(def);
235
+ Object.assign(mergedDescriptors, descriptors);
236
+ }
237
+ return Object.defineProperties({}, mergedDescriptors);
238
+ }
239
+ function cloneDef(schema) {
240
+ return mergeDefs(schema._zod.def);
241
+ }
242
+ function getElementAtPath(obj, path) {
243
+ if (!path)
244
+ return obj;
245
+ return path.reduce((acc, key) => acc?.[key], obj);
246
+ }
247
+ function promiseAllObject(promisesObj) {
248
+ const keys = Object.keys(promisesObj);
249
+ const promises = keys.map((key) => promisesObj[key]);
250
+ return Promise.all(promises).then((results) => {
251
+ const resolvedObj = {};
252
+ for (let i = 0; i < keys.length; i++) {
253
+ resolvedObj[keys[i]] = results[i];
254
+ }
255
+ return resolvedObj;
256
+ });
257
+ }
258
+ function randomString(length = 10) {
259
+ const chars = "abcdefghijklmnopqrstuvwxyz";
260
+ let str = "";
261
+ for (let i = 0; i < length; i++) {
262
+ str += chars[Math.floor(Math.random() * chars.length)];
263
+ }
264
+ return str;
265
+ }
266
+ function esc(str) {
267
+ return JSON.stringify(str);
268
+ }
269
+ var captureStackTrace = "captureStackTrace" in Error ? Error.captureStackTrace : (..._args) => {
270
+ };
271
+ function isObject(data) {
272
+ return typeof data === "object" && data !== null && !Array.isArray(data);
273
+ }
274
+ var allowsEval = cached(() => {
275
+ if (typeof navigator !== "undefined" && navigator?.userAgent?.includes("Cloudflare")) {
276
+ return false;
277
+ }
278
+ try {
279
+ const F = Function;
280
+ new F("");
281
+ return true;
282
+ } catch (_) {
283
+ return false;
284
+ }
285
+ });
286
+ function isPlainObject(o) {
287
+ if (isObject(o) === false)
288
+ return false;
289
+ const ctor = o.constructor;
290
+ if (ctor === void 0)
291
+ return true;
292
+ const prot = ctor.prototype;
293
+ if (isObject(prot) === false)
294
+ return false;
295
+ if (Object.prototype.hasOwnProperty.call(prot, "isPrototypeOf") === false) {
296
+ return false;
297
+ }
298
+ return true;
299
+ }
300
+ function shallowClone(o) {
301
+ if (isPlainObject(o))
302
+ return { ...o };
303
+ if (Array.isArray(o))
304
+ return [...o];
305
+ return o;
306
+ }
307
+ function numKeys(data) {
308
+ let keyCount = 0;
309
+ for (const key in data) {
310
+ if (Object.prototype.hasOwnProperty.call(data, key)) {
311
+ keyCount++;
312
+ }
313
+ }
314
+ return keyCount;
315
+ }
316
+ var getParsedType = (data) => {
317
+ const t = typeof data;
318
+ switch (t) {
319
+ case "undefined":
320
+ return "undefined";
321
+ case "string":
322
+ return "string";
323
+ case "number":
324
+ return Number.isNaN(data) ? "nan" : "number";
325
+ case "boolean":
326
+ return "boolean";
327
+ case "function":
328
+ return "function";
329
+ case "bigint":
330
+ return "bigint";
331
+ case "symbol":
332
+ return "symbol";
333
+ case "object":
334
+ if (Array.isArray(data)) {
335
+ return "array";
336
+ }
337
+ if (data === null) {
338
+ return "null";
339
+ }
340
+ if (data.then && typeof data.then === "function" && data.catch && typeof data.catch === "function") {
341
+ return "promise";
342
+ }
343
+ if (typeof Map !== "undefined" && data instanceof Map) {
344
+ return "map";
345
+ }
346
+ if (typeof Set !== "undefined" && data instanceof Set) {
347
+ return "set";
348
+ }
349
+ if (typeof Date !== "undefined" && data instanceof Date) {
350
+ return "date";
351
+ }
352
+ if (typeof File !== "undefined" && data instanceof File) {
353
+ return "file";
354
+ }
355
+ return "object";
356
+ default:
357
+ throw new Error(`Unknown data type: ${t}`);
358
+ }
359
+ };
360
+ var propertyKeyTypes = /* @__PURE__ */ new Set(["string", "number", "symbol"]);
361
+ var primitiveTypes = /* @__PURE__ */ new Set(["string", "number", "bigint", "boolean", "symbol", "undefined"]);
362
+ function escapeRegex(str) {
363
+ return str.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
364
+ }
365
+ function clone(inst, def, params) {
366
+ const cl = new inst._zod.constr(def ?? inst._zod.def);
367
+ if (!def || params?.parent)
368
+ cl._zod.parent = inst;
369
+ return cl;
370
+ }
371
+ function normalizeParams(_params) {
372
+ const params = _params;
373
+ if (!params)
374
+ return {};
375
+ if (typeof params === "string")
376
+ return { error: () => params };
377
+ if (params?.message !== void 0) {
378
+ if (params?.error !== void 0)
379
+ throw new Error("Cannot specify both `message` and `error` params");
380
+ params.error = params.message;
381
+ }
382
+ delete params.message;
383
+ if (typeof params.error === "string")
384
+ return { ...params, error: () => params.error };
385
+ return params;
386
+ }
387
+ function createTransparentProxy(getter) {
388
+ let target;
389
+ return new Proxy({}, {
390
+ get(_, prop, receiver) {
391
+ target ?? (target = getter());
392
+ return Reflect.get(target, prop, receiver);
393
+ },
394
+ set(_, prop, value, receiver) {
395
+ target ?? (target = getter());
396
+ return Reflect.set(target, prop, value, receiver);
397
+ },
398
+ has(_, prop) {
399
+ target ?? (target = getter());
400
+ return Reflect.has(target, prop);
401
+ },
402
+ deleteProperty(_, prop) {
403
+ target ?? (target = getter());
404
+ return Reflect.deleteProperty(target, prop);
405
+ },
406
+ ownKeys(_) {
407
+ target ?? (target = getter());
408
+ return Reflect.ownKeys(target);
409
+ },
410
+ getOwnPropertyDescriptor(_, prop) {
411
+ target ?? (target = getter());
412
+ return Reflect.getOwnPropertyDescriptor(target, prop);
413
+ },
414
+ defineProperty(_, prop, descriptor) {
415
+ target ?? (target = getter());
416
+ return Reflect.defineProperty(target, prop, descriptor);
417
+ }
418
+ });
419
+ }
420
+ function stringifyPrimitive(value) {
421
+ if (typeof value === "bigint")
422
+ return value.toString() + "n";
423
+ if (typeof value === "string")
424
+ return `"${value}"`;
425
+ return `${value}`;
426
+ }
427
+ function optionalKeys(shape) {
428
+ return Object.keys(shape).filter((k) => {
429
+ return shape[k]._zod.optin === "optional" && shape[k]._zod.optout === "optional";
430
+ });
431
+ }
432
+ var NUMBER_FORMAT_RANGES = {
433
+ safeint: [Number.MIN_SAFE_INTEGER, Number.MAX_SAFE_INTEGER],
434
+ int32: [-2147483648, 2147483647],
435
+ uint32: [0, 4294967295],
436
+ float32: [-34028234663852886e22, 34028234663852886e22],
437
+ float64: [-Number.MAX_VALUE, Number.MAX_VALUE]
438
+ };
439
+ var BIGINT_FORMAT_RANGES = {
440
+ int64: [/* @__PURE__ */ BigInt("-9223372036854775808"), /* @__PURE__ */ BigInt("9223372036854775807")],
441
+ uint64: [/* @__PURE__ */ BigInt(0), /* @__PURE__ */ BigInt("18446744073709551615")]
442
+ };
443
+ function pick(schema, mask) {
444
+ const currDef = schema._zod.def;
445
+ const def = mergeDefs(schema._zod.def, {
446
+ get shape() {
447
+ const newShape = {};
448
+ for (const key in mask) {
449
+ if (!(key in currDef.shape)) {
450
+ throw new Error(`Unrecognized key: "${key}"`);
451
+ }
452
+ if (!mask[key])
453
+ continue;
454
+ newShape[key] = currDef.shape[key];
455
+ }
456
+ assignProp(this, "shape", newShape);
457
+ return newShape;
458
+ },
459
+ checks: []
460
+ });
461
+ return clone(schema, def);
462
+ }
463
+ function omit(schema, mask) {
464
+ const currDef = schema._zod.def;
465
+ const def = mergeDefs(schema._zod.def, {
466
+ get shape() {
467
+ const newShape = { ...schema._zod.def.shape };
468
+ for (const key in mask) {
469
+ if (!(key in currDef.shape)) {
470
+ throw new Error(`Unrecognized key: "${key}"`);
471
+ }
472
+ if (!mask[key])
473
+ continue;
474
+ delete newShape[key];
475
+ }
476
+ assignProp(this, "shape", newShape);
477
+ return newShape;
478
+ },
479
+ checks: []
480
+ });
481
+ return clone(schema, def);
482
+ }
483
+ function extend(schema, shape) {
484
+ if (!isPlainObject(shape)) {
485
+ throw new Error("Invalid input to extend: expected a plain object");
486
+ }
487
+ const checks = schema._zod.def.checks;
488
+ const hasChecks = checks && checks.length > 0;
489
+ if (hasChecks) {
490
+ throw new Error("Object schemas containing refinements cannot be extended. Use `.safeExtend()` instead.");
491
+ }
492
+ const def = mergeDefs(schema._zod.def, {
493
+ get shape() {
494
+ const _shape = { ...schema._zod.def.shape, ...shape };
495
+ assignProp(this, "shape", _shape);
496
+ return _shape;
497
+ },
498
+ checks: []
499
+ });
500
+ return clone(schema, def);
501
+ }
502
+ function safeExtend(schema, shape) {
503
+ if (!isPlainObject(shape)) {
504
+ throw new Error("Invalid input to safeExtend: expected a plain object");
505
+ }
506
+ const def = {
507
+ ...schema._zod.def,
508
+ get shape() {
509
+ const _shape = { ...schema._zod.def.shape, ...shape };
510
+ assignProp(this, "shape", _shape);
511
+ return _shape;
512
+ },
513
+ checks: schema._zod.def.checks
514
+ };
515
+ return clone(schema, def);
516
+ }
517
+ function merge(a, b) {
518
+ const def = mergeDefs(a._zod.def, {
519
+ get shape() {
520
+ const _shape = { ...a._zod.def.shape, ...b._zod.def.shape };
521
+ assignProp(this, "shape", _shape);
522
+ return _shape;
523
+ },
524
+ get catchall() {
525
+ return b._zod.def.catchall;
526
+ },
527
+ checks: []
528
+ // delete existing checks
529
+ });
530
+ return clone(a, def);
531
+ }
532
+ function partial(Class2, schema, mask) {
533
+ const def = mergeDefs(schema._zod.def, {
534
+ get shape() {
535
+ const oldShape = schema._zod.def.shape;
536
+ const shape = { ...oldShape };
537
+ if (mask) {
538
+ for (const key in mask) {
539
+ if (!(key in oldShape)) {
540
+ throw new Error(`Unrecognized key: "${key}"`);
541
+ }
542
+ if (!mask[key])
543
+ continue;
544
+ shape[key] = Class2 ? new Class2({
545
+ type: "optional",
546
+ innerType: oldShape[key]
547
+ }) : oldShape[key];
548
+ }
549
+ } else {
550
+ for (const key in oldShape) {
551
+ shape[key] = Class2 ? new Class2({
552
+ type: "optional",
553
+ innerType: oldShape[key]
554
+ }) : oldShape[key];
555
+ }
556
+ }
557
+ assignProp(this, "shape", shape);
558
+ return shape;
559
+ },
560
+ checks: []
561
+ });
562
+ return clone(schema, def);
563
+ }
564
+ function required(Class2, schema, mask) {
565
+ const def = mergeDefs(schema._zod.def, {
566
+ get shape() {
567
+ const oldShape = schema._zod.def.shape;
568
+ const shape = { ...oldShape };
569
+ if (mask) {
570
+ for (const key in mask) {
571
+ if (!(key in shape)) {
572
+ throw new Error(`Unrecognized key: "${key}"`);
573
+ }
574
+ if (!mask[key])
575
+ continue;
576
+ shape[key] = new Class2({
577
+ type: "nonoptional",
578
+ innerType: oldShape[key]
579
+ });
580
+ }
581
+ } else {
582
+ for (const key in oldShape) {
583
+ shape[key] = new Class2({
584
+ type: "nonoptional",
585
+ innerType: oldShape[key]
586
+ });
587
+ }
588
+ }
589
+ assignProp(this, "shape", shape);
590
+ return shape;
591
+ },
592
+ checks: []
593
+ });
594
+ return clone(schema, def);
595
+ }
596
+ function aborted(x, startIndex = 0) {
597
+ if (x.aborted === true)
598
+ return true;
599
+ for (let i = startIndex; i < x.issues.length; i++) {
600
+ if (x.issues[i]?.continue !== true) {
601
+ return true;
602
+ }
603
+ }
604
+ return false;
605
+ }
606
+ function prefixIssues(path, issues) {
607
+ return issues.map((iss) => {
608
+ var _a;
609
+ (_a = iss).path ?? (_a.path = []);
610
+ iss.path.unshift(path);
611
+ return iss;
612
+ });
613
+ }
614
+ function unwrapMessage(message) {
615
+ return typeof message === "string" ? message : message?.message;
616
+ }
617
+ function finalizeIssue(iss, ctx, config2) {
618
+ const full = { ...iss, path: iss.path ?? [] };
619
+ if (!iss.message) {
620
+ const message = unwrapMessage(iss.inst?._zod.def?.error?.(iss)) ?? unwrapMessage(ctx?.error?.(iss)) ?? unwrapMessage(config2.customError?.(iss)) ?? unwrapMessage(config2.localeError?.(iss)) ?? "Invalid input";
621
+ full.message = message;
622
+ }
623
+ delete full.inst;
624
+ delete full.continue;
625
+ if (!ctx?.reportInput) {
626
+ delete full.input;
627
+ }
628
+ return full;
629
+ }
630
+ function getSizableOrigin(input) {
631
+ if (input instanceof Set)
632
+ return "set";
633
+ if (input instanceof Map)
634
+ return "map";
635
+ if (input instanceof File)
636
+ return "file";
637
+ return "unknown";
638
+ }
639
+ function getLengthableOrigin(input) {
640
+ if (Array.isArray(input))
641
+ return "array";
642
+ if (typeof input === "string")
643
+ return "string";
644
+ return "unknown";
645
+ }
646
+ function issue(...args) {
647
+ const [iss, input, inst] = args;
648
+ if (typeof iss === "string") {
649
+ return {
650
+ message: iss,
651
+ code: "custom",
652
+ input,
653
+ inst
654
+ };
655
+ }
656
+ return { ...iss };
657
+ }
658
+ function cleanEnum(obj) {
659
+ return Object.entries(obj).filter(([k, _]) => {
660
+ return Number.isNaN(Number.parseInt(k, 10));
661
+ }).map((el) => el[1]);
662
+ }
663
+ function base64ToUint8Array(base642) {
664
+ const binaryString = atob(base642);
665
+ const bytes = new Uint8Array(binaryString.length);
666
+ for (let i = 0; i < binaryString.length; i++) {
667
+ bytes[i] = binaryString.charCodeAt(i);
668
+ }
669
+ return bytes;
670
+ }
671
+ function uint8ArrayToBase64(bytes) {
672
+ let binaryString = "";
673
+ for (let i = 0; i < bytes.length; i++) {
674
+ binaryString += String.fromCharCode(bytes[i]);
675
+ }
676
+ return btoa(binaryString);
677
+ }
678
+ function base64urlToUint8Array(base64url2) {
679
+ const base642 = base64url2.replace(/-/g, "+").replace(/_/g, "/");
680
+ const padding = "=".repeat((4 - base642.length % 4) % 4);
681
+ return base64ToUint8Array(base642 + padding);
682
+ }
683
+ function uint8ArrayToBase64url(bytes) {
684
+ return uint8ArrayToBase64(bytes).replace(/\+/g, "-").replace(/\//g, "_").replace(/=/g, "");
685
+ }
686
+ function hexToUint8Array(hex) {
687
+ const cleanHex = hex.replace(/^0x/, "");
688
+ if (cleanHex.length % 2 !== 0) {
689
+ throw new Error("Invalid hex string length");
690
+ }
691
+ const bytes = new Uint8Array(cleanHex.length / 2);
692
+ for (let i = 0; i < cleanHex.length; i += 2) {
693
+ bytes[i / 2] = Number.parseInt(cleanHex.slice(i, i + 2), 16);
694
+ }
695
+ return bytes;
696
+ }
697
+ function uint8ArrayToHex(bytes) {
698
+ return Array.from(bytes).map((b) => b.toString(16).padStart(2, "0")).join("");
699
+ }
700
+ var Class = class {
701
+ constructor(..._args) {
702
+ }
703
+ };
704
+
705
+ // ../../node_modules/zod/v4/core/errors.js
706
+ var initializer = (inst, def) => {
707
+ inst.name = "$ZodError";
708
+ Object.defineProperty(inst, "_zod", {
709
+ value: inst._zod,
710
+ enumerable: false
711
+ });
712
+ Object.defineProperty(inst, "issues", {
713
+ value: def,
714
+ enumerable: false
715
+ });
716
+ inst.message = JSON.stringify(def, jsonStringifyReplacer, 2);
717
+ Object.defineProperty(inst, "toString", {
718
+ value: () => inst.message,
719
+ enumerable: false
720
+ });
721
+ };
722
+ var $ZodError = $constructor("$ZodError", initializer);
723
+ var $ZodRealError = $constructor("$ZodError", initializer, { Parent: Error });
724
+ function flattenError(error, mapper = (issue2) => issue2.message) {
725
+ const fieldErrors = {};
726
+ const formErrors = [];
727
+ for (const sub of error.issues) {
728
+ if (sub.path.length > 0) {
729
+ fieldErrors[sub.path[0]] = fieldErrors[sub.path[0]] || [];
730
+ fieldErrors[sub.path[0]].push(mapper(sub));
731
+ } else {
732
+ formErrors.push(mapper(sub));
733
+ }
734
+ }
735
+ return { formErrors, fieldErrors };
736
+ }
737
+ function formatError(error, mapper = (issue2) => issue2.message) {
738
+ const fieldErrors = { _errors: [] };
739
+ const processError = (error2) => {
740
+ for (const issue2 of error2.issues) {
741
+ if (issue2.code === "invalid_union" && issue2.errors.length) {
742
+ issue2.errors.map((issues) => processError({ issues }));
743
+ } else if (issue2.code === "invalid_key") {
744
+ processError({ issues: issue2.issues });
745
+ } else if (issue2.code === "invalid_element") {
746
+ processError({ issues: issue2.issues });
747
+ } else if (issue2.path.length === 0) {
748
+ fieldErrors._errors.push(mapper(issue2));
749
+ } else {
750
+ let curr = fieldErrors;
751
+ let i = 0;
752
+ while (i < issue2.path.length) {
753
+ const el = issue2.path[i];
754
+ const terminal = i === issue2.path.length - 1;
755
+ if (!terminal) {
756
+ curr[el] = curr[el] || { _errors: [] };
757
+ } else {
758
+ curr[el] = curr[el] || { _errors: [] };
759
+ curr[el]._errors.push(mapper(issue2));
760
+ }
761
+ curr = curr[el];
762
+ i++;
763
+ }
764
+ }
765
+ }
766
+ };
767
+ processError(error);
768
+ return fieldErrors;
769
+ }
770
+
771
+ // ../../node_modules/zod/v4/core/parse.js
772
+ var _parse = (_Err) => (schema, value, _ctx, _params) => {
773
+ const ctx = _ctx ? Object.assign(_ctx, { async: false }) : { async: false };
774
+ const result = schema._zod.run({ value, issues: [] }, ctx);
775
+ if (result instanceof Promise) {
776
+ throw new $ZodAsyncError();
777
+ }
778
+ if (result.issues.length) {
779
+ const e = new (_params?.Err ?? _Err)(result.issues.map((iss) => finalizeIssue(iss, ctx, config())));
780
+ captureStackTrace(e, _params?.callee);
781
+ throw e;
782
+ }
783
+ return result.value;
784
+ };
785
+ var _parseAsync = (_Err) => async (schema, value, _ctx, params) => {
786
+ const ctx = _ctx ? Object.assign(_ctx, { async: true }) : { async: true };
787
+ let result = schema._zod.run({ value, issues: [] }, ctx);
788
+ if (result instanceof Promise)
789
+ result = await result;
790
+ if (result.issues.length) {
791
+ const e = new (params?.Err ?? _Err)(result.issues.map((iss) => finalizeIssue(iss, ctx, config())));
792
+ captureStackTrace(e, params?.callee);
793
+ throw e;
794
+ }
795
+ return result.value;
796
+ };
797
+ var _safeParse = (_Err) => (schema, value, _ctx) => {
798
+ const ctx = _ctx ? { ..._ctx, async: false } : { async: false };
799
+ const result = schema._zod.run({ value, issues: [] }, ctx);
800
+ if (result instanceof Promise) {
801
+ throw new $ZodAsyncError();
802
+ }
803
+ return result.issues.length ? {
804
+ success: false,
805
+ error: new (_Err ?? $ZodError)(result.issues.map((iss) => finalizeIssue(iss, ctx, config())))
806
+ } : { success: true, data: result.value };
807
+ };
808
+ var safeParse = /* @__PURE__ */ _safeParse($ZodRealError);
809
+ var _safeParseAsync = (_Err) => async (schema, value, _ctx) => {
810
+ const ctx = _ctx ? Object.assign(_ctx, { async: true }) : { async: true };
811
+ let result = schema._zod.run({ value, issues: [] }, ctx);
812
+ if (result instanceof Promise)
813
+ result = await result;
814
+ return result.issues.length ? {
815
+ success: false,
816
+ error: new _Err(result.issues.map((iss) => finalizeIssue(iss, ctx, config())))
817
+ } : { success: true, data: result.value };
818
+ };
819
+ var safeParseAsync = /* @__PURE__ */ _safeParseAsync($ZodRealError);
820
+ var _encode = (_Err) => (schema, value, _ctx) => {
821
+ const ctx = _ctx ? Object.assign(_ctx, { direction: "backward" }) : { direction: "backward" };
822
+ return _parse(_Err)(schema, value, ctx);
823
+ };
824
+ var _decode = (_Err) => (schema, value, _ctx) => {
825
+ return _parse(_Err)(schema, value, _ctx);
826
+ };
827
+ var _encodeAsync = (_Err) => async (schema, value, _ctx) => {
828
+ const ctx = _ctx ? Object.assign(_ctx, { direction: "backward" }) : { direction: "backward" };
829
+ return _parseAsync(_Err)(schema, value, ctx);
830
+ };
831
+ var _decodeAsync = (_Err) => async (schema, value, _ctx) => {
832
+ return _parseAsync(_Err)(schema, value, _ctx);
833
+ };
834
+ var _safeEncode = (_Err) => (schema, value, _ctx) => {
835
+ const ctx = _ctx ? Object.assign(_ctx, { direction: "backward" }) : { direction: "backward" };
836
+ return _safeParse(_Err)(schema, value, ctx);
837
+ };
838
+ var _safeDecode = (_Err) => (schema, value, _ctx) => {
839
+ return _safeParse(_Err)(schema, value, _ctx);
840
+ };
841
+ var _safeEncodeAsync = (_Err) => async (schema, value, _ctx) => {
842
+ const ctx = _ctx ? Object.assign(_ctx, { direction: "backward" }) : { direction: "backward" };
843
+ return _safeParseAsync(_Err)(schema, value, ctx);
844
+ };
845
+ var _safeDecodeAsync = (_Err) => async (schema, value, _ctx) => {
846
+ return _safeParseAsync(_Err)(schema, value, _ctx);
847
+ };
848
+
849
+ // ../../node_modules/zod/v4/core/regexes.js
850
+ var cuid = /^[cC][^\s-]{8,}$/;
851
+ var cuid2 = /^[0-9a-z]+$/;
852
+ var ulid = /^[0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{26}$/;
853
+ var xid = /^[0-9a-vA-V]{20}$/;
854
+ var ksuid = /^[A-Za-z0-9]{27}$/;
855
+ var nanoid = /^[a-zA-Z0-9_-]{21}$/;
856
+ var duration = /^P(?:(\d+W)|(?!.*W)(?=\d|T\d)(\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+([.,]\d+)?S)?)?)$/;
857
+ 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})$/;
858
+ var uuid = (version2) => {
859
+ if (!version2)
860
+ 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)$/;
861
+ return new RegExp(`^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-${version2}[0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12})$`);
862
+ };
863
+ var email = /^(?!\.)(?!.*\.\.)([A-Za-z0-9_'+\-\.]*)[A-Za-z0-9_+-]@([A-Za-z0-9][A-Za-z0-9\-]*\.)+[A-Za-z]{2,}$/;
864
+ var _emoji = `^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$`;
865
+ function emoji() {
866
+ return new RegExp(_emoji, "u");
867
+ }
868
+ 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])$/;
869
+ 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}|:))$/;
870
+ 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])$/;
871
+ 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])$/;
872
+ var base64 = /^$|^(?:[0-9a-zA-Z+/]{4})*(?:(?:[0-9a-zA-Z+/]{2}==)|(?:[0-9a-zA-Z+/]{3}=))?$/;
873
+ var base64url = /^[A-Za-z0-9_-]*$/;
874
+ var hostname = /^(?=.{1,253}\.?$)[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[-0-9a-zA-Z]{0,61}[0-9a-zA-Z])?)*\.?$/;
875
+ var e164 = /^\+(?:[0-9]){6,14}[0-9]$/;
876
+ 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])))`;
877
+ var date = /* @__PURE__ */ new RegExp(`^${dateSource}$`);
878
+ function timeSource(args) {
879
+ const hhmm = `(?:[01]\\d|2[0-3]):[0-5]\\d`;
880
+ 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+)?)?`;
881
+ return regex;
882
+ }
883
+ function time(args) {
884
+ return new RegExp(`^${timeSource(args)}$`);
885
+ }
886
+ function datetime(args) {
887
+ const time3 = timeSource({ precision: args.precision });
888
+ const opts = ["Z"];
889
+ if (args.local)
890
+ opts.push("");
891
+ if (args.offset)
892
+ opts.push(`([+-](?:[01]\\d|2[0-3]):[0-5]\\d)`);
893
+ const timeRegex = `${time3}(?:${opts.join("|")})`;
894
+ return new RegExp(`^${dateSource}T(?:${timeRegex})$`);
895
+ }
896
+ var string = (params) => {
897
+ const regex = params ? `[\\s\\S]{${params?.minimum ?? 0},${params?.maximum ?? ""}}` : `[\\s\\S]*`;
898
+ return new RegExp(`^${regex}$`);
899
+ };
900
+ var lowercase = /^[^A-Z]*$/;
901
+ var uppercase = /^[^a-z]*$/;
902
+
903
+ // ../../node_modules/zod/v4/core/checks.js
904
+ var $ZodCheck = /* @__PURE__ */ $constructor("$ZodCheck", (inst, def) => {
905
+ var _a;
906
+ inst._zod ?? (inst._zod = {});
907
+ inst._zod.def = def;
908
+ (_a = inst._zod).onattach ?? (_a.onattach = []);
909
+ });
910
+ var $ZodCheckMaxLength = /* @__PURE__ */ $constructor("$ZodCheckMaxLength", (inst, def) => {
911
+ var _a;
912
+ $ZodCheck.init(inst, def);
913
+ (_a = inst._zod.def).when ?? (_a.when = (payload) => {
914
+ const val = payload.value;
915
+ return !nullish(val) && val.length !== void 0;
916
+ });
917
+ inst._zod.onattach.push((inst2) => {
918
+ const curr = inst2._zod.bag.maximum ?? Number.POSITIVE_INFINITY;
919
+ if (def.maximum < curr)
920
+ inst2._zod.bag.maximum = def.maximum;
921
+ });
922
+ inst._zod.check = (payload) => {
923
+ const input = payload.value;
924
+ const length = input.length;
925
+ if (length <= def.maximum)
926
+ return;
927
+ const origin = getLengthableOrigin(input);
928
+ payload.issues.push({
929
+ origin,
930
+ code: "too_big",
931
+ maximum: def.maximum,
932
+ inclusive: true,
933
+ input,
934
+ inst,
935
+ continue: !def.abort
936
+ });
937
+ };
938
+ });
939
+ var $ZodCheckMinLength = /* @__PURE__ */ $constructor("$ZodCheckMinLength", (inst, def) => {
940
+ var _a;
941
+ $ZodCheck.init(inst, def);
942
+ (_a = inst._zod.def).when ?? (_a.when = (payload) => {
943
+ const val = payload.value;
944
+ return !nullish(val) && val.length !== void 0;
945
+ });
946
+ inst._zod.onattach.push((inst2) => {
947
+ const curr = inst2._zod.bag.minimum ?? Number.NEGATIVE_INFINITY;
948
+ if (def.minimum > curr)
949
+ inst2._zod.bag.minimum = def.minimum;
950
+ });
951
+ inst._zod.check = (payload) => {
952
+ const input = payload.value;
953
+ const length = input.length;
954
+ if (length >= def.minimum)
955
+ return;
956
+ const origin = getLengthableOrigin(input);
957
+ payload.issues.push({
958
+ origin,
959
+ code: "too_small",
960
+ minimum: def.minimum,
961
+ inclusive: true,
962
+ input,
963
+ inst,
964
+ continue: !def.abort
965
+ });
966
+ };
967
+ });
968
+ var $ZodCheckLengthEquals = /* @__PURE__ */ $constructor("$ZodCheckLengthEquals", (inst, def) => {
969
+ var _a;
970
+ $ZodCheck.init(inst, def);
971
+ (_a = inst._zod.def).when ?? (_a.when = (payload) => {
972
+ const val = payload.value;
973
+ return !nullish(val) && val.length !== void 0;
974
+ });
975
+ inst._zod.onattach.push((inst2) => {
976
+ const bag = inst2._zod.bag;
977
+ bag.minimum = def.length;
978
+ bag.maximum = def.length;
979
+ bag.length = def.length;
980
+ });
981
+ inst._zod.check = (payload) => {
982
+ const input = payload.value;
983
+ const length = input.length;
984
+ if (length === def.length)
985
+ return;
986
+ const origin = getLengthableOrigin(input);
987
+ const tooBig = length > def.length;
988
+ payload.issues.push({
989
+ origin,
990
+ ...tooBig ? { code: "too_big", maximum: def.length } : { code: "too_small", minimum: def.length },
991
+ inclusive: true,
992
+ exact: true,
993
+ input: payload.value,
994
+ inst,
995
+ continue: !def.abort
996
+ });
997
+ };
998
+ });
999
+ var $ZodCheckStringFormat = /* @__PURE__ */ $constructor("$ZodCheckStringFormat", (inst, def) => {
1000
+ var _a, _b;
1001
+ $ZodCheck.init(inst, def);
1002
+ inst._zod.onattach.push((inst2) => {
1003
+ const bag = inst2._zod.bag;
1004
+ bag.format = def.format;
1005
+ if (def.pattern) {
1006
+ bag.patterns ?? (bag.patterns = /* @__PURE__ */ new Set());
1007
+ bag.patterns.add(def.pattern);
1008
+ }
1009
+ });
1010
+ if (def.pattern)
1011
+ (_a = inst._zod).check ?? (_a.check = (payload) => {
1012
+ def.pattern.lastIndex = 0;
1013
+ if (def.pattern.test(payload.value))
1014
+ return;
1015
+ payload.issues.push({
1016
+ origin: "string",
1017
+ code: "invalid_format",
1018
+ format: def.format,
1019
+ input: payload.value,
1020
+ ...def.pattern ? { pattern: def.pattern.toString() } : {},
1021
+ inst,
1022
+ continue: !def.abort
1023
+ });
1024
+ });
1025
+ else
1026
+ (_b = inst._zod).check ?? (_b.check = () => {
1027
+ });
1028
+ });
1029
+ var $ZodCheckRegex = /* @__PURE__ */ $constructor("$ZodCheckRegex", (inst, def) => {
1030
+ $ZodCheckStringFormat.init(inst, def);
1031
+ inst._zod.check = (payload) => {
1032
+ def.pattern.lastIndex = 0;
1033
+ if (def.pattern.test(payload.value))
1034
+ return;
1035
+ payload.issues.push({
1036
+ origin: "string",
1037
+ code: "invalid_format",
1038
+ format: "regex",
1039
+ input: payload.value,
1040
+ pattern: def.pattern.toString(),
1041
+ inst,
1042
+ continue: !def.abort
1043
+ });
1044
+ };
1045
+ });
1046
+ var $ZodCheckLowerCase = /* @__PURE__ */ $constructor("$ZodCheckLowerCase", (inst, def) => {
1047
+ def.pattern ?? (def.pattern = lowercase);
1048
+ $ZodCheckStringFormat.init(inst, def);
1049
+ });
1050
+ var $ZodCheckUpperCase = /* @__PURE__ */ $constructor("$ZodCheckUpperCase", (inst, def) => {
1051
+ def.pattern ?? (def.pattern = uppercase);
1052
+ $ZodCheckStringFormat.init(inst, def);
1053
+ });
1054
+ var $ZodCheckIncludes = /* @__PURE__ */ $constructor("$ZodCheckIncludes", (inst, def) => {
1055
+ $ZodCheck.init(inst, def);
1056
+ const escapedRegex = escapeRegex(def.includes);
1057
+ const pattern = new RegExp(typeof def.position === "number" ? `^.{${def.position}}${escapedRegex}` : escapedRegex);
1058
+ def.pattern = pattern;
1059
+ inst._zod.onattach.push((inst2) => {
1060
+ const bag = inst2._zod.bag;
1061
+ bag.patterns ?? (bag.patterns = /* @__PURE__ */ new Set());
1062
+ bag.patterns.add(pattern);
1063
+ });
1064
+ inst._zod.check = (payload) => {
1065
+ if (payload.value.includes(def.includes, def.position))
1066
+ return;
1067
+ payload.issues.push({
1068
+ origin: "string",
1069
+ code: "invalid_format",
1070
+ format: "includes",
1071
+ includes: def.includes,
1072
+ input: payload.value,
1073
+ inst,
1074
+ continue: !def.abort
1075
+ });
1076
+ };
1077
+ });
1078
+ var $ZodCheckStartsWith = /* @__PURE__ */ $constructor("$ZodCheckStartsWith", (inst, def) => {
1079
+ $ZodCheck.init(inst, def);
1080
+ const pattern = new RegExp(`^${escapeRegex(def.prefix)}.*`);
1081
+ def.pattern ?? (def.pattern = pattern);
1082
+ inst._zod.onattach.push((inst2) => {
1083
+ const bag = inst2._zod.bag;
1084
+ bag.patterns ?? (bag.patterns = /* @__PURE__ */ new Set());
1085
+ bag.patterns.add(pattern);
1086
+ });
1087
+ inst._zod.check = (payload) => {
1088
+ if (payload.value.startsWith(def.prefix))
1089
+ return;
1090
+ payload.issues.push({
1091
+ origin: "string",
1092
+ code: "invalid_format",
1093
+ format: "starts_with",
1094
+ prefix: def.prefix,
1095
+ input: payload.value,
1096
+ inst,
1097
+ continue: !def.abort
1098
+ });
1099
+ };
1100
+ });
1101
+ var $ZodCheckEndsWith = /* @__PURE__ */ $constructor("$ZodCheckEndsWith", (inst, def) => {
1102
+ $ZodCheck.init(inst, def);
1103
+ const pattern = new RegExp(`.*${escapeRegex(def.suffix)}$`);
1104
+ def.pattern ?? (def.pattern = pattern);
1105
+ inst._zod.onattach.push((inst2) => {
1106
+ const bag = inst2._zod.bag;
1107
+ bag.patterns ?? (bag.patterns = /* @__PURE__ */ new Set());
1108
+ bag.patterns.add(pattern);
1109
+ });
1110
+ inst._zod.check = (payload) => {
1111
+ if (payload.value.endsWith(def.suffix))
1112
+ return;
1113
+ payload.issues.push({
1114
+ origin: "string",
1115
+ code: "invalid_format",
1116
+ format: "ends_with",
1117
+ suffix: def.suffix,
1118
+ input: payload.value,
1119
+ inst,
1120
+ continue: !def.abort
1121
+ });
1122
+ };
1123
+ });
1124
+ var $ZodCheckOverwrite = /* @__PURE__ */ $constructor("$ZodCheckOverwrite", (inst, def) => {
1125
+ $ZodCheck.init(inst, def);
1126
+ inst._zod.check = (payload) => {
1127
+ payload.value = def.tx(payload.value);
1128
+ };
1129
+ });
1130
+
1131
+ // ../../node_modules/zod/v4/core/doc.js
1132
+ var Doc = class {
1133
+ constructor(args = []) {
1134
+ this.content = [];
1135
+ this.indent = 0;
1136
+ if (this)
1137
+ this.args = args;
1138
+ }
1139
+ indented(fn) {
1140
+ this.indent += 1;
1141
+ fn(this);
1142
+ this.indent -= 1;
1143
+ }
1144
+ write(arg) {
1145
+ if (typeof arg === "function") {
1146
+ arg(this, { execution: "sync" });
1147
+ arg(this, { execution: "async" });
1148
+ return;
1149
+ }
1150
+ const content = arg;
1151
+ const lines = content.split("\n").filter((x) => x);
1152
+ const minIndent = Math.min(...lines.map((x) => x.length - x.trimStart().length));
1153
+ const dedented = lines.map((x) => x.slice(minIndent)).map((x) => " ".repeat(this.indent * 2) + x);
1154
+ for (const line of dedented) {
1155
+ this.content.push(line);
1156
+ }
1157
+ }
1158
+ compile() {
1159
+ const F = Function;
1160
+ const args = this?.args;
1161
+ const content = this?.content ?? [``];
1162
+ const lines = [...content.map((x) => ` ${x}`)];
1163
+ return new F(...args, lines.join("\n"));
1164
+ }
1165
+ };
1166
+
1167
+ // ../../node_modules/zod/v4/core/versions.js
1168
+ var version = {
1169
+ major: 4,
1170
+ minor: 1,
1171
+ patch: 12
1172
+ };
1173
+
1174
+ // ../../node_modules/zod/v4/core/schemas.js
1175
+ var $ZodType = /* @__PURE__ */ $constructor("$ZodType", (inst, def) => {
1176
+ var _a;
1177
+ inst ?? (inst = {});
1178
+ inst._zod.def = def;
1179
+ inst._zod.bag = inst._zod.bag || {};
1180
+ inst._zod.version = version;
1181
+ const checks = [...inst._zod.def.checks ?? []];
1182
+ if (inst._zod.traits.has("$ZodCheck")) {
1183
+ checks.unshift(inst);
1184
+ }
1185
+ for (const ch of checks) {
1186
+ for (const fn of ch._zod.onattach) {
1187
+ fn(inst);
1188
+ }
1189
+ }
1190
+ if (checks.length === 0) {
1191
+ (_a = inst._zod).deferred ?? (_a.deferred = []);
1192
+ inst._zod.deferred?.push(() => {
1193
+ inst._zod.run = inst._zod.parse;
1194
+ });
1195
+ } else {
1196
+ const runChecks = (payload, checks2, ctx) => {
1197
+ let isAborted = aborted(payload);
1198
+ let asyncResult;
1199
+ for (const ch of checks2) {
1200
+ if (ch._zod.def.when) {
1201
+ const shouldRun = ch._zod.def.when(payload);
1202
+ if (!shouldRun)
1203
+ continue;
1204
+ } else if (isAborted) {
1205
+ continue;
1206
+ }
1207
+ const currLen = payload.issues.length;
1208
+ const _ = ch._zod.check(payload);
1209
+ if (_ instanceof Promise && ctx?.async === false) {
1210
+ throw new $ZodAsyncError();
1211
+ }
1212
+ if (asyncResult || _ instanceof Promise) {
1213
+ asyncResult = (asyncResult ?? Promise.resolve()).then(async () => {
1214
+ await _;
1215
+ const nextLen = payload.issues.length;
1216
+ if (nextLen === currLen)
1217
+ return;
1218
+ if (!isAborted)
1219
+ isAborted = aborted(payload, currLen);
1220
+ });
1221
+ } else {
1222
+ const nextLen = payload.issues.length;
1223
+ if (nextLen === currLen)
1224
+ continue;
1225
+ if (!isAborted)
1226
+ isAborted = aborted(payload, currLen);
1227
+ }
1228
+ }
1229
+ if (asyncResult) {
1230
+ return asyncResult.then(() => {
1231
+ return payload;
1232
+ });
1233
+ }
1234
+ return payload;
1235
+ };
1236
+ const handleCanaryResult = (canary, payload, ctx) => {
1237
+ if (aborted(canary)) {
1238
+ canary.aborted = true;
1239
+ return canary;
1240
+ }
1241
+ const checkResult = runChecks(payload, checks, ctx);
1242
+ if (checkResult instanceof Promise) {
1243
+ if (ctx.async === false)
1244
+ throw new $ZodAsyncError();
1245
+ return checkResult.then((checkResult2) => inst._zod.parse(checkResult2, ctx));
1246
+ }
1247
+ return inst._zod.parse(checkResult, ctx);
1248
+ };
1249
+ inst._zod.run = (payload, ctx) => {
1250
+ if (ctx.skipChecks) {
1251
+ return inst._zod.parse(payload, ctx);
1252
+ }
1253
+ if (ctx.direction === "backward") {
1254
+ const canary = inst._zod.parse({ value: payload.value, issues: [] }, { ...ctx, skipChecks: true });
1255
+ if (canary instanceof Promise) {
1256
+ return canary.then((canary2) => {
1257
+ return handleCanaryResult(canary2, payload, ctx);
1258
+ });
1259
+ }
1260
+ return handleCanaryResult(canary, payload, ctx);
1261
+ }
1262
+ const result = inst._zod.parse(payload, ctx);
1263
+ if (result instanceof Promise) {
1264
+ if (ctx.async === false)
1265
+ throw new $ZodAsyncError();
1266
+ return result.then((result2) => runChecks(result2, checks, ctx));
1267
+ }
1268
+ return runChecks(result, checks, ctx);
1269
+ };
1270
+ }
1271
+ inst["~standard"] = {
1272
+ validate: (value) => {
1273
+ try {
1274
+ const r = safeParse(inst, value);
1275
+ return r.success ? { value: r.data } : { issues: r.error?.issues };
1276
+ } catch (_) {
1277
+ return safeParseAsync(inst, value).then((r) => r.success ? { value: r.data } : { issues: r.error?.issues });
1278
+ }
1279
+ },
1280
+ vendor: "zod",
1281
+ version: 1
1282
+ };
1283
+ });
1284
+ var $ZodString = /* @__PURE__ */ $constructor("$ZodString", (inst, def) => {
1285
+ $ZodType.init(inst, def);
1286
+ inst._zod.pattern = [...inst?._zod.bag?.patterns ?? []].pop() ?? string(inst._zod.bag);
1287
+ inst._zod.parse = (payload, _) => {
1288
+ if (def.coerce)
1289
+ try {
1290
+ payload.value = String(payload.value);
1291
+ } catch (_2) {
1292
+ }
1293
+ if (typeof payload.value === "string")
1294
+ return payload;
1295
+ payload.issues.push({
1296
+ expected: "string",
1297
+ code: "invalid_type",
1298
+ input: payload.value,
1299
+ inst
1300
+ });
1301
+ return payload;
1302
+ };
1303
+ });
1304
+ var $ZodStringFormat = /* @__PURE__ */ $constructor("$ZodStringFormat", (inst, def) => {
1305
+ $ZodCheckStringFormat.init(inst, def);
1306
+ $ZodString.init(inst, def);
1307
+ });
1308
+ var $ZodGUID = /* @__PURE__ */ $constructor("$ZodGUID", (inst, def) => {
1309
+ def.pattern ?? (def.pattern = guid);
1310
+ $ZodStringFormat.init(inst, def);
1311
+ });
1312
+ var $ZodUUID = /* @__PURE__ */ $constructor("$ZodUUID", (inst, def) => {
1313
+ if (def.version) {
1314
+ const versionMap = {
1315
+ v1: 1,
1316
+ v2: 2,
1317
+ v3: 3,
1318
+ v4: 4,
1319
+ v5: 5,
1320
+ v6: 6,
1321
+ v7: 7,
1322
+ v8: 8
1323
+ };
1324
+ const v = versionMap[def.version];
1325
+ if (v === void 0)
1326
+ throw new Error(`Invalid UUID version: "${def.version}"`);
1327
+ def.pattern ?? (def.pattern = uuid(v));
1328
+ } else
1329
+ def.pattern ?? (def.pattern = uuid());
1330
+ $ZodStringFormat.init(inst, def);
1331
+ });
1332
+ var $ZodEmail = /* @__PURE__ */ $constructor("$ZodEmail", (inst, def) => {
1333
+ def.pattern ?? (def.pattern = email);
1334
+ $ZodStringFormat.init(inst, def);
1335
+ });
1336
+ var $ZodURL = /* @__PURE__ */ $constructor("$ZodURL", (inst, def) => {
1337
+ $ZodStringFormat.init(inst, def);
1338
+ inst._zod.check = (payload) => {
1339
+ try {
1340
+ const trimmed = payload.value.trim();
1341
+ const url = new URL(trimmed);
1342
+ if (def.hostname) {
1343
+ def.hostname.lastIndex = 0;
1344
+ if (!def.hostname.test(url.hostname)) {
1345
+ payload.issues.push({
1346
+ code: "invalid_format",
1347
+ format: "url",
1348
+ note: "Invalid hostname",
1349
+ pattern: hostname.source,
1350
+ input: payload.value,
1351
+ inst,
1352
+ continue: !def.abort
1353
+ });
1354
+ }
1355
+ }
1356
+ if (def.protocol) {
1357
+ def.protocol.lastIndex = 0;
1358
+ if (!def.protocol.test(url.protocol.endsWith(":") ? url.protocol.slice(0, -1) : url.protocol)) {
1359
+ payload.issues.push({
1360
+ code: "invalid_format",
1361
+ format: "url",
1362
+ note: "Invalid protocol",
1363
+ pattern: def.protocol.source,
1364
+ input: payload.value,
1365
+ inst,
1366
+ continue: !def.abort
1367
+ });
1368
+ }
1369
+ }
1370
+ if (def.normalize) {
1371
+ payload.value = url.href;
1372
+ } else {
1373
+ payload.value = trimmed;
1374
+ }
1375
+ return;
1376
+ } catch (_) {
1377
+ payload.issues.push({
1378
+ code: "invalid_format",
1379
+ format: "url",
1380
+ input: payload.value,
1381
+ inst,
1382
+ continue: !def.abort
1383
+ });
1384
+ }
1385
+ };
1386
+ });
1387
+ var $ZodEmoji = /* @__PURE__ */ $constructor("$ZodEmoji", (inst, def) => {
1388
+ def.pattern ?? (def.pattern = emoji());
1389
+ $ZodStringFormat.init(inst, def);
1390
+ });
1391
+ var $ZodNanoID = /* @__PURE__ */ $constructor("$ZodNanoID", (inst, def) => {
1392
+ def.pattern ?? (def.pattern = nanoid);
1393
+ $ZodStringFormat.init(inst, def);
1394
+ });
1395
+ var $ZodCUID = /* @__PURE__ */ $constructor("$ZodCUID", (inst, def) => {
1396
+ def.pattern ?? (def.pattern = cuid);
1397
+ $ZodStringFormat.init(inst, def);
1398
+ });
1399
+ var $ZodCUID2 = /* @__PURE__ */ $constructor("$ZodCUID2", (inst, def) => {
1400
+ def.pattern ?? (def.pattern = cuid2);
1401
+ $ZodStringFormat.init(inst, def);
1402
+ });
1403
+ var $ZodULID = /* @__PURE__ */ $constructor("$ZodULID", (inst, def) => {
1404
+ def.pattern ?? (def.pattern = ulid);
1405
+ $ZodStringFormat.init(inst, def);
1406
+ });
1407
+ var $ZodXID = /* @__PURE__ */ $constructor("$ZodXID", (inst, def) => {
1408
+ def.pattern ?? (def.pattern = xid);
1409
+ $ZodStringFormat.init(inst, def);
1410
+ });
1411
+ var $ZodKSUID = /* @__PURE__ */ $constructor("$ZodKSUID", (inst, def) => {
1412
+ def.pattern ?? (def.pattern = ksuid);
1413
+ $ZodStringFormat.init(inst, def);
1414
+ });
1415
+ var $ZodISODateTime = /* @__PURE__ */ $constructor("$ZodISODateTime", (inst, def) => {
1416
+ def.pattern ?? (def.pattern = datetime(def));
1417
+ $ZodStringFormat.init(inst, def);
1418
+ });
1419
+ var $ZodISODate = /* @__PURE__ */ $constructor("$ZodISODate", (inst, def) => {
1420
+ def.pattern ?? (def.pattern = date);
1421
+ $ZodStringFormat.init(inst, def);
1422
+ });
1423
+ var $ZodISOTime = /* @__PURE__ */ $constructor("$ZodISOTime", (inst, def) => {
1424
+ def.pattern ?? (def.pattern = time(def));
1425
+ $ZodStringFormat.init(inst, def);
1426
+ });
1427
+ var $ZodISODuration = /* @__PURE__ */ $constructor("$ZodISODuration", (inst, def) => {
1428
+ def.pattern ?? (def.pattern = duration);
1429
+ $ZodStringFormat.init(inst, def);
1430
+ });
1431
+ var $ZodIPv4 = /* @__PURE__ */ $constructor("$ZodIPv4", (inst, def) => {
1432
+ def.pattern ?? (def.pattern = ipv4);
1433
+ $ZodStringFormat.init(inst, def);
1434
+ inst._zod.onattach.push((inst2) => {
1435
+ const bag = inst2._zod.bag;
1436
+ bag.format = `ipv4`;
1437
+ });
1438
+ });
1439
+ var $ZodIPv6 = /* @__PURE__ */ $constructor("$ZodIPv6", (inst, def) => {
1440
+ def.pattern ?? (def.pattern = ipv6);
1441
+ $ZodStringFormat.init(inst, def);
1442
+ inst._zod.onattach.push((inst2) => {
1443
+ const bag = inst2._zod.bag;
1444
+ bag.format = `ipv6`;
1445
+ });
1446
+ inst._zod.check = (payload) => {
1447
+ try {
1448
+ new URL(`http://[${payload.value}]`);
1449
+ } catch {
1450
+ payload.issues.push({
1451
+ code: "invalid_format",
1452
+ format: "ipv6",
1453
+ input: payload.value,
1454
+ inst,
1455
+ continue: !def.abort
1456
+ });
1457
+ }
1458
+ };
1459
+ });
1460
+ var $ZodCIDRv4 = /* @__PURE__ */ $constructor("$ZodCIDRv4", (inst, def) => {
1461
+ def.pattern ?? (def.pattern = cidrv4);
1462
+ $ZodStringFormat.init(inst, def);
1463
+ });
1464
+ var $ZodCIDRv6 = /* @__PURE__ */ $constructor("$ZodCIDRv6", (inst, def) => {
1465
+ def.pattern ?? (def.pattern = cidrv6);
1466
+ $ZodStringFormat.init(inst, def);
1467
+ inst._zod.check = (payload) => {
1468
+ const parts = payload.value.split("/");
1469
+ try {
1470
+ if (parts.length !== 2)
1471
+ throw new Error();
1472
+ const [address, prefix] = parts;
1473
+ if (!prefix)
1474
+ throw new Error();
1475
+ const prefixNum = Number(prefix);
1476
+ if (`${prefixNum}` !== prefix)
1477
+ throw new Error();
1478
+ if (prefixNum < 0 || prefixNum > 128)
1479
+ throw new Error();
1480
+ new URL(`http://[${address}]`);
1481
+ } catch {
1482
+ payload.issues.push({
1483
+ code: "invalid_format",
1484
+ format: "cidrv6",
1485
+ input: payload.value,
1486
+ inst,
1487
+ continue: !def.abort
1488
+ });
1489
+ }
1490
+ };
1491
+ });
1492
+ function isValidBase64(data) {
1493
+ if (data === "")
1494
+ return true;
1495
+ if (data.length % 4 !== 0)
1496
+ return false;
1497
+ try {
1498
+ atob(data);
1499
+ return true;
1500
+ } catch {
1501
+ return false;
1502
+ }
1503
+ }
1504
+ var $ZodBase64 = /* @__PURE__ */ $constructor("$ZodBase64", (inst, def) => {
1505
+ def.pattern ?? (def.pattern = base64);
1506
+ $ZodStringFormat.init(inst, def);
1507
+ inst._zod.onattach.push((inst2) => {
1508
+ inst2._zod.bag.contentEncoding = "base64";
1509
+ });
1510
+ inst._zod.check = (payload) => {
1511
+ if (isValidBase64(payload.value))
1512
+ return;
1513
+ payload.issues.push({
1514
+ code: "invalid_format",
1515
+ format: "base64",
1516
+ input: payload.value,
1517
+ inst,
1518
+ continue: !def.abort
1519
+ });
1520
+ };
1521
+ });
1522
+ function isValidBase64URL(data) {
1523
+ if (!base64url.test(data))
1524
+ return false;
1525
+ const base642 = data.replace(/[-_]/g, (c) => c === "-" ? "+" : "/");
1526
+ const padded = base642.padEnd(Math.ceil(base642.length / 4) * 4, "=");
1527
+ return isValidBase64(padded);
1528
+ }
1529
+ var $ZodBase64URL = /* @__PURE__ */ $constructor("$ZodBase64URL", (inst, def) => {
1530
+ def.pattern ?? (def.pattern = base64url);
1531
+ $ZodStringFormat.init(inst, def);
1532
+ inst._zod.onattach.push((inst2) => {
1533
+ inst2._zod.bag.contentEncoding = "base64url";
1534
+ });
1535
+ inst._zod.check = (payload) => {
1536
+ if (isValidBase64URL(payload.value))
1537
+ return;
1538
+ payload.issues.push({
1539
+ code: "invalid_format",
1540
+ format: "base64url",
1541
+ input: payload.value,
1542
+ inst,
1543
+ continue: !def.abort
1544
+ });
1545
+ };
1546
+ });
1547
+ var $ZodE164 = /* @__PURE__ */ $constructor("$ZodE164", (inst, def) => {
1548
+ def.pattern ?? (def.pattern = e164);
1549
+ $ZodStringFormat.init(inst, def);
1550
+ });
1551
+ function isValidJWT(token, algorithm = null) {
1552
+ try {
1553
+ const tokensParts = token.split(".");
1554
+ if (tokensParts.length !== 3)
1555
+ return false;
1556
+ const [header] = tokensParts;
1557
+ if (!header)
1558
+ return false;
1559
+ const parsedHeader = JSON.parse(atob(header));
1560
+ if ("typ" in parsedHeader && parsedHeader?.typ !== "JWT")
1561
+ return false;
1562
+ if (!parsedHeader.alg)
1563
+ return false;
1564
+ if (algorithm && (!("alg" in parsedHeader) || parsedHeader.alg !== algorithm))
1565
+ return false;
1566
+ return true;
1567
+ } catch {
1568
+ return false;
1569
+ }
1570
+ }
1571
+ var $ZodJWT = /* @__PURE__ */ $constructor("$ZodJWT", (inst, def) => {
1572
+ $ZodStringFormat.init(inst, def);
1573
+ inst._zod.check = (payload) => {
1574
+ if (isValidJWT(payload.value, def.alg))
1575
+ return;
1576
+ payload.issues.push({
1577
+ code: "invalid_format",
1578
+ format: "jwt",
1579
+ input: payload.value,
1580
+ inst,
1581
+ continue: !def.abort
1582
+ });
1583
+ };
1584
+ });
1585
+ var $ZodUnknown = /* @__PURE__ */ $constructor("$ZodUnknown", (inst, def) => {
1586
+ $ZodType.init(inst, def);
1587
+ inst._zod.parse = (payload) => payload;
1588
+ });
1589
+ var $ZodNever = /* @__PURE__ */ $constructor("$ZodNever", (inst, def) => {
1590
+ $ZodType.init(inst, def);
1591
+ inst._zod.parse = (payload, _ctx) => {
1592
+ payload.issues.push({
1593
+ expected: "never",
1594
+ code: "invalid_type",
1595
+ input: payload.value,
1596
+ inst
1597
+ });
1598
+ return payload;
1599
+ };
1600
+ });
1601
+ function handleArrayResult(result, final, index) {
1602
+ if (result.issues.length) {
1603
+ final.issues.push(...prefixIssues(index, result.issues));
1604
+ }
1605
+ final.value[index] = result.value;
1606
+ }
1607
+ var $ZodArray = /* @__PURE__ */ $constructor("$ZodArray", (inst, def) => {
1608
+ $ZodType.init(inst, def);
1609
+ inst._zod.parse = (payload, ctx) => {
1610
+ const input = payload.value;
1611
+ if (!Array.isArray(input)) {
1612
+ payload.issues.push({
1613
+ expected: "array",
1614
+ code: "invalid_type",
1615
+ input,
1616
+ inst
1617
+ });
1618
+ return payload;
1619
+ }
1620
+ payload.value = Array(input.length);
1621
+ const proms = [];
1622
+ for (let i = 0; i < input.length; i++) {
1623
+ const item = input[i];
1624
+ const result = def.element._zod.run({
1625
+ value: item,
1626
+ issues: []
1627
+ }, ctx);
1628
+ if (result instanceof Promise) {
1629
+ proms.push(result.then((result2) => handleArrayResult(result2, payload, i)));
1630
+ } else {
1631
+ handleArrayResult(result, payload, i);
1632
+ }
1633
+ }
1634
+ if (proms.length) {
1635
+ return Promise.all(proms).then(() => payload);
1636
+ }
1637
+ return payload;
1638
+ };
1639
+ });
1640
+ function handlePropertyResult(result, final, key, input) {
1641
+ if (result.issues.length) {
1642
+ final.issues.push(...prefixIssues(key, result.issues));
1643
+ }
1644
+ if (result.value === void 0) {
1645
+ if (key in input) {
1646
+ final.value[key] = void 0;
1647
+ }
1648
+ } else {
1649
+ final.value[key] = result.value;
1650
+ }
1651
+ }
1652
+ function normalizeDef(def) {
1653
+ const keys = Object.keys(def.shape);
1654
+ for (const k of keys) {
1655
+ if (!def.shape?.[k]?._zod?.traits?.has("$ZodType")) {
1656
+ throw new Error(`Invalid element at key "${k}": expected a Zod schema`);
1657
+ }
1658
+ }
1659
+ const okeys = optionalKeys(def.shape);
1660
+ return {
1661
+ ...def,
1662
+ keys,
1663
+ keySet: new Set(keys),
1664
+ numKeys: keys.length,
1665
+ optionalKeys: new Set(okeys)
1666
+ };
1667
+ }
1668
+ function handleCatchall(proms, input, payload, ctx, def, inst) {
1669
+ const unrecognized = [];
1670
+ const keySet = def.keySet;
1671
+ const _catchall = def.catchall._zod;
1672
+ const t = _catchall.def.type;
1673
+ for (const key of Object.keys(input)) {
1674
+ if (keySet.has(key))
1675
+ continue;
1676
+ if (t === "never") {
1677
+ unrecognized.push(key);
1678
+ continue;
1679
+ }
1680
+ const r = _catchall.run({ value: input[key], issues: [] }, ctx);
1681
+ if (r instanceof Promise) {
1682
+ proms.push(r.then((r2) => handlePropertyResult(r2, payload, key, input)));
1683
+ } else {
1684
+ handlePropertyResult(r, payload, key, input);
1685
+ }
1686
+ }
1687
+ if (unrecognized.length) {
1688
+ payload.issues.push({
1689
+ code: "unrecognized_keys",
1690
+ keys: unrecognized,
1691
+ input,
1692
+ inst
1693
+ });
1694
+ }
1695
+ if (!proms.length)
1696
+ return payload;
1697
+ return Promise.all(proms).then(() => {
1698
+ return payload;
1699
+ });
1700
+ }
1701
+ var $ZodObject = /* @__PURE__ */ $constructor("$ZodObject", (inst, def) => {
1702
+ $ZodType.init(inst, def);
1703
+ const desc = Object.getOwnPropertyDescriptor(def, "shape");
1704
+ if (!desc?.get) {
1705
+ const sh = def.shape;
1706
+ Object.defineProperty(def, "shape", {
1707
+ get: () => {
1708
+ const newSh = { ...sh };
1709
+ Object.defineProperty(def, "shape", {
1710
+ value: newSh
1711
+ });
1712
+ return newSh;
1713
+ }
1714
+ });
1715
+ }
1716
+ const _normalized = cached(() => normalizeDef(def));
1717
+ defineLazy(inst._zod, "propValues", () => {
1718
+ const shape = def.shape;
1719
+ const propValues = {};
1720
+ for (const key in shape) {
1721
+ const field = shape[key]._zod;
1722
+ if (field.values) {
1723
+ propValues[key] ?? (propValues[key] = /* @__PURE__ */ new Set());
1724
+ for (const v of field.values)
1725
+ propValues[key].add(v);
1726
+ }
1727
+ }
1728
+ return propValues;
1729
+ });
1730
+ const isObject2 = isObject;
1731
+ const catchall = def.catchall;
1732
+ let value;
1733
+ inst._zod.parse = (payload, ctx) => {
1734
+ value ?? (value = _normalized.value);
1735
+ const input = payload.value;
1736
+ if (!isObject2(input)) {
1737
+ payload.issues.push({
1738
+ expected: "object",
1739
+ code: "invalid_type",
1740
+ input,
1741
+ inst
1742
+ });
1743
+ return payload;
1744
+ }
1745
+ payload.value = {};
1746
+ const proms = [];
1747
+ const shape = value.shape;
1748
+ for (const key of value.keys) {
1749
+ const el = shape[key];
1750
+ const r = el._zod.run({ value: input[key], issues: [] }, ctx);
1751
+ if (r instanceof Promise) {
1752
+ proms.push(r.then((r2) => handlePropertyResult(r2, payload, key, input)));
1753
+ } else {
1754
+ handlePropertyResult(r, payload, key, input);
1755
+ }
1756
+ }
1757
+ if (!catchall) {
1758
+ return proms.length ? Promise.all(proms).then(() => payload) : payload;
1759
+ }
1760
+ return handleCatchall(proms, input, payload, ctx, _normalized.value, inst);
1761
+ };
1762
+ });
1763
+ var $ZodObjectJIT = /* @__PURE__ */ $constructor("$ZodObjectJIT", (inst, def) => {
1764
+ $ZodObject.init(inst, def);
1765
+ const superParse = inst._zod.parse;
1766
+ const _normalized = cached(() => normalizeDef(def));
1767
+ const generateFastpass = (shape) => {
1768
+ const doc = new Doc(["shape", "payload", "ctx"]);
1769
+ const normalized = _normalized.value;
1770
+ const parseStr = (key) => {
1771
+ const k = esc(key);
1772
+ return `shape[${k}]._zod.run({ value: input[${k}], issues: [] }, ctx)`;
1773
+ };
1774
+ doc.write(`const input = payload.value;`);
1775
+ const ids = /* @__PURE__ */ Object.create(null);
1776
+ let counter = 0;
1777
+ for (const key of normalized.keys) {
1778
+ ids[key] = `key_${counter++}`;
1779
+ }
1780
+ doc.write(`const newResult = {};`);
1781
+ for (const key of normalized.keys) {
1782
+ const id = ids[key];
1783
+ const k = esc(key);
1784
+ doc.write(`const ${id} = ${parseStr(key)};`);
1785
+ doc.write(`
1786
+ if (${id}.issues.length) {
1787
+ payload.issues = payload.issues.concat(${id}.issues.map(iss => ({
1788
+ ...iss,
1789
+ path: iss.path ? [${k}, ...iss.path] : [${k}]
1790
+ })));
1791
+ }
1792
+
1793
+
1794
+ if (${id}.value === undefined) {
1795
+ if (${k} in input) {
1796
+ newResult[${k}] = undefined;
1797
+ }
1798
+ } else {
1799
+ newResult[${k}] = ${id}.value;
1800
+ }
1801
+
1802
+ `);
1803
+ }
1804
+ doc.write(`payload.value = newResult;`);
1805
+ doc.write(`return payload;`);
1806
+ const fn = doc.compile();
1807
+ return (payload, ctx) => fn(shape, payload, ctx);
1808
+ };
1809
+ let fastpass;
1810
+ const isObject2 = isObject;
1811
+ const jit = !globalConfig.jitless;
1812
+ const allowsEval2 = allowsEval;
1813
+ const fastEnabled = jit && allowsEval2.value;
1814
+ const catchall = def.catchall;
1815
+ let value;
1816
+ inst._zod.parse = (payload, ctx) => {
1817
+ value ?? (value = _normalized.value);
1818
+ const input = payload.value;
1819
+ if (!isObject2(input)) {
1820
+ payload.issues.push({
1821
+ expected: "object",
1822
+ code: "invalid_type",
1823
+ input,
1824
+ inst
1825
+ });
1826
+ return payload;
1827
+ }
1828
+ if (jit && fastEnabled && ctx?.async === false && ctx.jitless !== true) {
1829
+ if (!fastpass)
1830
+ fastpass = generateFastpass(def.shape);
1831
+ payload = fastpass(payload, ctx);
1832
+ if (!catchall)
1833
+ return payload;
1834
+ return handleCatchall([], input, payload, ctx, value, inst);
1835
+ }
1836
+ return superParse(payload, ctx);
1837
+ };
1838
+ });
1839
+ function handleUnionResults(results, final, inst, ctx) {
1840
+ for (const result of results) {
1841
+ if (result.issues.length === 0) {
1842
+ final.value = result.value;
1843
+ return final;
1844
+ }
1845
+ }
1846
+ const nonaborted = results.filter((r) => !aborted(r));
1847
+ if (nonaborted.length === 1) {
1848
+ final.value = nonaborted[0].value;
1849
+ return nonaborted[0];
1850
+ }
1851
+ final.issues.push({
1852
+ code: "invalid_union",
1853
+ input: final.value,
1854
+ inst,
1855
+ errors: results.map((result) => result.issues.map((iss) => finalizeIssue(iss, ctx, config())))
1856
+ });
1857
+ return final;
1858
+ }
1859
+ var $ZodUnion = /* @__PURE__ */ $constructor("$ZodUnion", (inst, def) => {
1860
+ $ZodType.init(inst, def);
1861
+ defineLazy(inst._zod, "optin", () => def.options.some((o) => o._zod.optin === "optional") ? "optional" : void 0);
1862
+ defineLazy(inst._zod, "optout", () => def.options.some((o) => o._zod.optout === "optional") ? "optional" : void 0);
1863
+ defineLazy(inst._zod, "values", () => {
1864
+ if (def.options.every((o) => o._zod.values)) {
1865
+ return new Set(def.options.flatMap((option) => Array.from(option._zod.values)));
1866
+ }
1867
+ return void 0;
1868
+ });
1869
+ defineLazy(inst._zod, "pattern", () => {
1870
+ if (def.options.every((o) => o._zod.pattern)) {
1871
+ const patterns = def.options.map((o) => o._zod.pattern);
1872
+ return new RegExp(`^(${patterns.map((p) => cleanRegex(p.source)).join("|")})$`);
1873
+ }
1874
+ return void 0;
1875
+ });
1876
+ const single = def.options.length === 1;
1877
+ const first = def.options[0]._zod.run;
1878
+ inst._zod.parse = (payload, ctx) => {
1879
+ if (single) {
1880
+ return first(payload, ctx);
1881
+ }
1882
+ let async = false;
1883
+ const results = [];
1884
+ for (const option of def.options) {
1885
+ const result = option._zod.run({
1886
+ value: payload.value,
1887
+ issues: []
1888
+ }, ctx);
1889
+ if (result instanceof Promise) {
1890
+ results.push(result);
1891
+ async = true;
1892
+ } else {
1893
+ if (result.issues.length === 0)
1894
+ return result;
1895
+ results.push(result);
1896
+ }
1897
+ }
1898
+ if (!async)
1899
+ return handleUnionResults(results, payload, inst, ctx);
1900
+ return Promise.all(results).then((results2) => {
1901
+ return handleUnionResults(results2, payload, inst, ctx);
1902
+ });
1903
+ };
1904
+ });
1905
+ var $ZodIntersection = /* @__PURE__ */ $constructor("$ZodIntersection", (inst, def) => {
1906
+ $ZodType.init(inst, def);
1907
+ inst._zod.parse = (payload, ctx) => {
1908
+ const input = payload.value;
1909
+ const left = def.left._zod.run({ value: input, issues: [] }, ctx);
1910
+ const right = def.right._zod.run({ value: input, issues: [] }, ctx);
1911
+ const async = left instanceof Promise || right instanceof Promise;
1912
+ if (async) {
1913
+ return Promise.all([left, right]).then(([left2, right2]) => {
1914
+ return handleIntersectionResults(payload, left2, right2);
1915
+ });
1916
+ }
1917
+ return handleIntersectionResults(payload, left, right);
1918
+ };
1919
+ });
1920
+ function mergeValues(a, b) {
1921
+ if (a === b) {
1922
+ return { valid: true, data: a };
1923
+ }
1924
+ if (a instanceof Date && b instanceof Date && +a === +b) {
1925
+ return { valid: true, data: a };
1926
+ }
1927
+ if (isPlainObject(a) && isPlainObject(b)) {
1928
+ const bKeys = Object.keys(b);
1929
+ const sharedKeys = Object.keys(a).filter((key) => bKeys.indexOf(key) !== -1);
1930
+ const newObj = { ...a, ...b };
1931
+ for (const key of sharedKeys) {
1932
+ const sharedValue = mergeValues(a[key], b[key]);
1933
+ if (!sharedValue.valid) {
1934
+ return {
1935
+ valid: false,
1936
+ mergeErrorPath: [key, ...sharedValue.mergeErrorPath]
1937
+ };
1938
+ }
1939
+ newObj[key] = sharedValue.data;
1940
+ }
1941
+ return { valid: true, data: newObj };
1942
+ }
1943
+ if (Array.isArray(a) && Array.isArray(b)) {
1944
+ if (a.length !== b.length) {
1945
+ return { valid: false, mergeErrorPath: [] };
1946
+ }
1947
+ const newArray = [];
1948
+ for (let index = 0; index < a.length; index++) {
1949
+ const itemA = a[index];
1950
+ const itemB = b[index];
1951
+ const sharedValue = mergeValues(itemA, itemB);
1952
+ if (!sharedValue.valid) {
1953
+ return {
1954
+ valid: false,
1955
+ mergeErrorPath: [index, ...sharedValue.mergeErrorPath]
1956
+ };
1957
+ }
1958
+ newArray.push(sharedValue.data);
1959
+ }
1960
+ return { valid: true, data: newArray };
1961
+ }
1962
+ return { valid: false, mergeErrorPath: [] };
1963
+ }
1964
+ function handleIntersectionResults(result, left, right) {
1965
+ if (left.issues.length) {
1966
+ result.issues.push(...left.issues);
1967
+ }
1968
+ if (right.issues.length) {
1969
+ result.issues.push(...right.issues);
1970
+ }
1971
+ if (aborted(result))
1972
+ return result;
1973
+ const merged = mergeValues(left.value, right.value);
1974
+ if (!merged.valid) {
1975
+ throw new Error(`Unmergable intersection. Error path: ${JSON.stringify(merged.mergeErrorPath)}`);
1976
+ }
1977
+ result.value = merged.data;
1978
+ return result;
1979
+ }
1980
+ var $ZodEnum = /* @__PURE__ */ $constructor("$ZodEnum", (inst, def) => {
1981
+ $ZodType.init(inst, def);
1982
+ const values = getEnumValues(def.entries);
1983
+ const valuesSet = new Set(values);
1984
+ inst._zod.values = valuesSet;
1985
+ inst._zod.pattern = new RegExp(`^(${values.filter((k) => propertyKeyTypes.has(typeof k)).map((o) => typeof o === "string" ? escapeRegex(o) : o.toString()).join("|")})$`);
1986
+ inst._zod.parse = (payload, _ctx) => {
1987
+ const input = payload.value;
1988
+ if (valuesSet.has(input)) {
1989
+ return payload;
1990
+ }
1991
+ payload.issues.push({
1992
+ code: "invalid_value",
1993
+ values,
1994
+ input,
1995
+ inst
1996
+ });
1997
+ return payload;
1998
+ };
1999
+ });
2000
+ var $ZodTransform = /* @__PURE__ */ $constructor("$ZodTransform", (inst, def) => {
2001
+ $ZodType.init(inst, def);
2002
+ inst._zod.parse = (payload, ctx) => {
2003
+ if (ctx.direction === "backward") {
2004
+ throw new $ZodEncodeError(inst.constructor.name);
2005
+ }
2006
+ const _out = def.transform(payload.value, payload);
2007
+ if (ctx.async) {
2008
+ const output = _out instanceof Promise ? _out : Promise.resolve(_out);
2009
+ return output.then((output2) => {
2010
+ payload.value = output2;
2011
+ return payload;
2012
+ });
2013
+ }
2014
+ if (_out instanceof Promise) {
2015
+ throw new $ZodAsyncError();
2016
+ }
2017
+ payload.value = _out;
2018
+ return payload;
2019
+ };
2020
+ });
2021
+ function handleOptionalResult(result, input) {
2022
+ if (result.issues.length && input === void 0) {
2023
+ return { issues: [], value: void 0 };
2024
+ }
2025
+ return result;
2026
+ }
2027
+ var $ZodOptional = /* @__PURE__ */ $constructor("$ZodOptional", (inst, def) => {
2028
+ $ZodType.init(inst, def);
2029
+ inst._zod.optin = "optional";
2030
+ inst._zod.optout = "optional";
2031
+ defineLazy(inst._zod, "values", () => {
2032
+ return def.innerType._zod.values ? /* @__PURE__ */ new Set([...def.innerType._zod.values, void 0]) : void 0;
2033
+ });
2034
+ defineLazy(inst._zod, "pattern", () => {
2035
+ const pattern = def.innerType._zod.pattern;
2036
+ return pattern ? new RegExp(`^(${cleanRegex(pattern.source)})?$`) : void 0;
2037
+ });
2038
+ inst._zod.parse = (payload, ctx) => {
2039
+ if (def.innerType._zod.optin === "optional") {
2040
+ const result = def.innerType._zod.run(payload, ctx);
2041
+ if (result instanceof Promise)
2042
+ return result.then((r) => handleOptionalResult(r, payload.value));
2043
+ return handleOptionalResult(result, payload.value);
2044
+ }
2045
+ if (payload.value === void 0) {
2046
+ return payload;
2047
+ }
2048
+ return def.innerType._zod.run(payload, ctx);
2049
+ };
2050
+ });
2051
+ var $ZodNullable = /* @__PURE__ */ $constructor("$ZodNullable", (inst, def) => {
2052
+ $ZodType.init(inst, def);
2053
+ defineLazy(inst._zod, "optin", () => def.innerType._zod.optin);
2054
+ defineLazy(inst._zod, "optout", () => def.innerType._zod.optout);
2055
+ defineLazy(inst._zod, "pattern", () => {
2056
+ const pattern = def.innerType._zod.pattern;
2057
+ return pattern ? new RegExp(`^(${cleanRegex(pattern.source)}|null)$`) : void 0;
2058
+ });
2059
+ defineLazy(inst._zod, "values", () => {
2060
+ return def.innerType._zod.values ? /* @__PURE__ */ new Set([...def.innerType._zod.values, null]) : void 0;
2061
+ });
2062
+ inst._zod.parse = (payload, ctx) => {
2063
+ if (payload.value === null)
2064
+ return payload;
2065
+ return def.innerType._zod.run(payload, ctx);
2066
+ };
2067
+ });
2068
+ var $ZodDefault = /* @__PURE__ */ $constructor("$ZodDefault", (inst, def) => {
2069
+ $ZodType.init(inst, def);
2070
+ inst._zod.optin = "optional";
2071
+ defineLazy(inst._zod, "values", () => def.innerType._zod.values);
2072
+ inst._zod.parse = (payload, ctx) => {
2073
+ if (ctx.direction === "backward") {
2074
+ return def.innerType._zod.run(payload, ctx);
2075
+ }
2076
+ if (payload.value === void 0) {
2077
+ payload.value = def.defaultValue;
2078
+ return payload;
2079
+ }
2080
+ const result = def.innerType._zod.run(payload, ctx);
2081
+ if (result instanceof Promise) {
2082
+ return result.then((result2) => handleDefaultResult(result2, def));
2083
+ }
2084
+ return handleDefaultResult(result, def);
2085
+ };
2086
+ });
2087
+ function handleDefaultResult(payload, def) {
2088
+ if (payload.value === void 0) {
2089
+ payload.value = def.defaultValue;
2090
+ }
2091
+ return payload;
2092
+ }
2093
+ var $ZodPrefault = /* @__PURE__ */ $constructor("$ZodPrefault", (inst, def) => {
2094
+ $ZodType.init(inst, def);
2095
+ inst._zod.optin = "optional";
2096
+ defineLazy(inst._zod, "values", () => def.innerType._zod.values);
2097
+ inst._zod.parse = (payload, ctx) => {
2098
+ if (ctx.direction === "backward") {
2099
+ return def.innerType._zod.run(payload, ctx);
2100
+ }
2101
+ if (payload.value === void 0) {
2102
+ payload.value = def.defaultValue;
2103
+ }
2104
+ return def.innerType._zod.run(payload, ctx);
2105
+ };
2106
+ });
2107
+ var $ZodNonOptional = /* @__PURE__ */ $constructor("$ZodNonOptional", (inst, def) => {
2108
+ $ZodType.init(inst, def);
2109
+ defineLazy(inst._zod, "values", () => {
2110
+ const v = def.innerType._zod.values;
2111
+ return v ? new Set([...v].filter((x) => x !== void 0)) : void 0;
2112
+ });
2113
+ inst._zod.parse = (payload, ctx) => {
2114
+ const result = def.innerType._zod.run(payload, ctx);
2115
+ if (result instanceof Promise) {
2116
+ return result.then((result2) => handleNonOptionalResult(result2, inst));
2117
+ }
2118
+ return handleNonOptionalResult(result, inst);
2119
+ };
2120
+ });
2121
+ function handleNonOptionalResult(payload, inst) {
2122
+ if (!payload.issues.length && payload.value === void 0) {
2123
+ payload.issues.push({
2124
+ code: "invalid_type",
2125
+ expected: "nonoptional",
2126
+ input: payload.value,
2127
+ inst
2128
+ });
2129
+ }
2130
+ return payload;
2131
+ }
2132
+ var $ZodCatch = /* @__PURE__ */ $constructor("$ZodCatch", (inst, def) => {
2133
+ $ZodType.init(inst, def);
2134
+ defineLazy(inst._zod, "optin", () => def.innerType._zod.optin);
2135
+ defineLazy(inst._zod, "optout", () => def.innerType._zod.optout);
2136
+ defineLazy(inst._zod, "values", () => def.innerType._zod.values);
2137
+ inst._zod.parse = (payload, ctx) => {
2138
+ if (ctx.direction === "backward") {
2139
+ return def.innerType._zod.run(payload, ctx);
2140
+ }
2141
+ const result = def.innerType._zod.run(payload, ctx);
2142
+ if (result instanceof Promise) {
2143
+ return result.then((result2) => {
2144
+ payload.value = result2.value;
2145
+ if (result2.issues.length) {
2146
+ payload.value = def.catchValue({
2147
+ ...payload,
2148
+ error: {
2149
+ issues: result2.issues.map((iss) => finalizeIssue(iss, ctx, config()))
2150
+ },
2151
+ input: payload.value
2152
+ });
2153
+ payload.issues = [];
2154
+ }
2155
+ return payload;
2156
+ });
2157
+ }
2158
+ payload.value = result.value;
2159
+ if (result.issues.length) {
2160
+ payload.value = def.catchValue({
2161
+ ...payload,
2162
+ error: {
2163
+ issues: result.issues.map((iss) => finalizeIssue(iss, ctx, config()))
2164
+ },
2165
+ input: payload.value
2166
+ });
2167
+ payload.issues = [];
2168
+ }
2169
+ return payload;
2170
+ };
2171
+ });
2172
+ var $ZodPipe = /* @__PURE__ */ $constructor("$ZodPipe", (inst, def) => {
2173
+ $ZodType.init(inst, def);
2174
+ defineLazy(inst._zod, "values", () => def.in._zod.values);
2175
+ defineLazy(inst._zod, "optin", () => def.in._zod.optin);
2176
+ defineLazy(inst._zod, "optout", () => def.out._zod.optout);
2177
+ defineLazy(inst._zod, "propValues", () => def.in._zod.propValues);
2178
+ inst._zod.parse = (payload, ctx) => {
2179
+ if (ctx.direction === "backward") {
2180
+ const right = def.out._zod.run(payload, ctx);
2181
+ if (right instanceof Promise) {
2182
+ return right.then((right2) => handlePipeResult(right2, def.in, ctx));
2183
+ }
2184
+ return handlePipeResult(right, def.in, ctx);
2185
+ }
2186
+ const left = def.in._zod.run(payload, ctx);
2187
+ if (left instanceof Promise) {
2188
+ return left.then((left2) => handlePipeResult(left2, def.out, ctx));
2189
+ }
2190
+ return handlePipeResult(left, def.out, ctx);
2191
+ };
2192
+ });
2193
+ function handlePipeResult(left, next, ctx) {
2194
+ if (left.issues.length) {
2195
+ left.aborted = true;
2196
+ return left;
2197
+ }
2198
+ return next._zod.run({ value: left.value, issues: left.issues }, ctx);
2199
+ }
2200
+ var $ZodReadonly = /* @__PURE__ */ $constructor("$ZodReadonly", (inst, def) => {
2201
+ $ZodType.init(inst, def);
2202
+ defineLazy(inst._zod, "propValues", () => def.innerType._zod.propValues);
2203
+ defineLazy(inst._zod, "values", () => def.innerType._zod.values);
2204
+ defineLazy(inst._zod, "optin", () => def.innerType._zod.optin);
2205
+ defineLazy(inst._zod, "optout", () => def.innerType._zod.optout);
2206
+ inst._zod.parse = (payload, ctx) => {
2207
+ if (ctx.direction === "backward") {
2208
+ return def.innerType._zod.run(payload, ctx);
2209
+ }
2210
+ const result = def.innerType._zod.run(payload, ctx);
2211
+ if (result instanceof Promise) {
2212
+ return result.then(handleReadonlyResult);
2213
+ }
2214
+ return handleReadonlyResult(result);
2215
+ };
2216
+ });
2217
+ function handleReadonlyResult(payload) {
2218
+ payload.value = Object.freeze(payload.value);
2219
+ return payload;
2220
+ }
2221
+ var $ZodCustom = /* @__PURE__ */ $constructor("$ZodCustom", (inst, def) => {
2222
+ $ZodCheck.init(inst, def);
2223
+ $ZodType.init(inst, def);
2224
+ inst._zod.parse = (payload, _) => {
2225
+ return payload;
2226
+ };
2227
+ inst._zod.check = (payload) => {
2228
+ const input = payload.value;
2229
+ const r = def.fn(input);
2230
+ if (r instanceof Promise) {
2231
+ return r.then((r2) => handleRefineResult(r2, payload, input, inst));
2232
+ }
2233
+ handleRefineResult(r, payload, input, inst);
2234
+ return;
2235
+ };
2236
+ });
2237
+ function handleRefineResult(result, payload, input, inst) {
2238
+ if (!result) {
2239
+ const _iss = {
2240
+ code: "custom",
2241
+ input,
2242
+ inst,
2243
+ // incorporates params.error into issue reporting
2244
+ path: [...inst._zod.def.path ?? []],
2245
+ // incorporates params.error into issue reporting
2246
+ continue: !inst._zod.def.abort
2247
+ // params: inst._zod.def.params,
2248
+ };
2249
+ if (inst._zod.def.params)
2250
+ _iss.params = inst._zod.def.params;
2251
+ payload.issues.push(issue(_iss));
2252
+ }
2253
+ }
2254
+
2255
+ // ../../node_modules/zod/v4/core/registries.js
2256
+ var $output = Symbol("ZodOutput");
2257
+ var $input = Symbol("ZodInput");
2258
+ var $ZodRegistry = class {
2259
+ constructor() {
2260
+ this._map = /* @__PURE__ */ new WeakMap();
2261
+ this._idmap = /* @__PURE__ */ new Map();
2262
+ }
2263
+ add(schema, ..._meta) {
2264
+ const meta = _meta[0];
2265
+ this._map.set(schema, meta);
2266
+ if (meta && typeof meta === "object" && "id" in meta) {
2267
+ if (this._idmap.has(meta.id)) {
2268
+ throw new Error(`ID ${meta.id} already exists in the registry`);
2269
+ }
2270
+ this._idmap.set(meta.id, schema);
2271
+ }
2272
+ return this;
2273
+ }
2274
+ clear() {
2275
+ this._map = /* @__PURE__ */ new WeakMap();
2276
+ this._idmap = /* @__PURE__ */ new Map();
2277
+ return this;
2278
+ }
2279
+ remove(schema) {
2280
+ const meta = this._map.get(schema);
2281
+ if (meta && typeof meta === "object" && "id" in meta) {
2282
+ this._idmap.delete(meta.id);
2283
+ }
2284
+ this._map.delete(schema);
2285
+ return this;
2286
+ }
2287
+ get(schema) {
2288
+ const p = schema._zod.parent;
2289
+ if (p) {
2290
+ const pm = { ...this.get(p) ?? {} };
2291
+ delete pm.id;
2292
+ const f = { ...pm, ...this._map.get(schema) };
2293
+ return Object.keys(f).length ? f : void 0;
2294
+ }
2295
+ return this._map.get(schema);
2296
+ }
2297
+ has(schema) {
2298
+ return this._map.has(schema);
2299
+ }
2300
+ };
2301
+ function registry() {
2302
+ return new $ZodRegistry();
2303
+ }
2304
+ var globalRegistry = /* @__PURE__ */ registry();
2305
+
2306
+ // ../../node_modules/zod/v4/core/api.js
2307
+ function _string(Class2, params) {
2308
+ return new Class2({
2309
+ type: "string",
2310
+ ...normalizeParams(params)
2311
+ });
2312
+ }
2313
+ function _email(Class2, params) {
2314
+ return new Class2({
2315
+ type: "string",
2316
+ format: "email",
2317
+ check: "string_format",
2318
+ abort: false,
2319
+ ...normalizeParams(params)
2320
+ });
2321
+ }
2322
+ function _guid(Class2, params) {
2323
+ return new Class2({
2324
+ type: "string",
2325
+ format: "guid",
2326
+ check: "string_format",
2327
+ abort: false,
2328
+ ...normalizeParams(params)
2329
+ });
2330
+ }
2331
+ function _uuid(Class2, params) {
2332
+ return new Class2({
2333
+ type: "string",
2334
+ format: "uuid",
2335
+ check: "string_format",
2336
+ abort: false,
2337
+ ...normalizeParams(params)
2338
+ });
2339
+ }
2340
+ function _uuidv4(Class2, params) {
2341
+ return new Class2({
2342
+ type: "string",
2343
+ format: "uuid",
2344
+ check: "string_format",
2345
+ abort: false,
2346
+ version: "v4",
2347
+ ...normalizeParams(params)
2348
+ });
2349
+ }
2350
+ function _uuidv6(Class2, params) {
2351
+ return new Class2({
2352
+ type: "string",
2353
+ format: "uuid",
2354
+ check: "string_format",
2355
+ abort: false,
2356
+ version: "v6",
2357
+ ...normalizeParams(params)
2358
+ });
2359
+ }
2360
+ function _uuidv7(Class2, params) {
2361
+ return new Class2({
2362
+ type: "string",
2363
+ format: "uuid",
2364
+ check: "string_format",
2365
+ abort: false,
2366
+ version: "v7",
2367
+ ...normalizeParams(params)
2368
+ });
2369
+ }
2370
+ function _url(Class2, params) {
2371
+ return new Class2({
2372
+ type: "string",
2373
+ format: "url",
2374
+ check: "string_format",
2375
+ abort: false,
2376
+ ...normalizeParams(params)
2377
+ });
2378
+ }
2379
+ function _emoji2(Class2, params) {
2380
+ return new Class2({
2381
+ type: "string",
2382
+ format: "emoji",
2383
+ check: "string_format",
2384
+ abort: false,
2385
+ ...normalizeParams(params)
2386
+ });
2387
+ }
2388
+ function _nanoid(Class2, params) {
2389
+ return new Class2({
2390
+ type: "string",
2391
+ format: "nanoid",
2392
+ check: "string_format",
2393
+ abort: false,
2394
+ ...normalizeParams(params)
2395
+ });
2396
+ }
2397
+ function _cuid(Class2, params) {
2398
+ return new Class2({
2399
+ type: "string",
2400
+ format: "cuid",
2401
+ check: "string_format",
2402
+ abort: false,
2403
+ ...normalizeParams(params)
2404
+ });
2405
+ }
2406
+ function _cuid2(Class2, params) {
2407
+ return new Class2({
2408
+ type: "string",
2409
+ format: "cuid2",
2410
+ check: "string_format",
2411
+ abort: false,
2412
+ ...normalizeParams(params)
2413
+ });
2414
+ }
2415
+ function _ulid(Class2, params) {
2416
+ return new Class2({
2417
+ type: "string",
2418
+ format: "ulid",
2419
+ check: "string_format",
2420
+ abort: false,
2421
+ ...normalizeParams(params)
2422
+ });
2423
+ }
2424
+ function _xid(Class2, params) {
2425
+ return new Class2({
2426
+ type: "string",
2427
+ format: "xid",
2428
+ check: "string_format",
2429
+ abort: false,
2430
+ ...normalizeParams(params)
2431
+ });
2432
+ }
2433
+ function _ksuid(Class2, params) {
2434
+ return new Class2({
2435
+ type: "string",
2436
+ format: "ksuid",
2437
+ check: "string_format",
2438
+ abort: false,
2439
+ ...normalizeParams(params)
2440
+ });
2441
+ }
2442
+ function _ipv4(Class2, params) {
2443
+ return new Class2({
2444
+ type: "string",
2445
+ format: "ipv4",
2446
+ check: "string_format",
2447
+ abort: false,
2448
+ ...normalizeParams(params)
2449
+ });
2450
+ }
2451
+ function _ipv6(Class2, params) {
2452
+ return new Class2({
2453
+ type: "string",
2454
+ format: "ipv6",
2455
+ check: "string_format",
2456
+ abort: false,
2457
+ ...normalizeParams(params)
2458
+ });
2459
+ }
2460
+ function _cidrv4(Class2, params) {
2461
+ return new Class2({
2462
+ type: "string",
2463
+ format: "cidrv4",
2464
+ check: "string_format",
2465
+ abort: false,
2466
+ ...normalizeParams(params)
2467
+ });
2468
+ }
2469
+ function _cidrv6(Class2, params) {
2470
+ return new Class2({
2471
+ type: "string",
2472
+ format: "cidrv6",
2473
+ check: "string_format",
2474
+ abort: false,
2475
+ ...normalizeParams(params)
2476
+ });
2477
+ }
2478
+ function _base64(Class2, params) {
2479
+ return new Class2({
2480
+ type: "string",
2481
+ format: "base64",
2482
+ check: "string_format",
2483
+ abort: false,
2484
+ ...normalizeParams(params)
2485
+ });
2486
+ }
2487
+ function _base64url(Class2, params) {
2488
+ return new Class2({
2489
+ type: "string",
2490
+ format: "base64url",
2491
+ check: "string_format",
2492
+ abort: false,
2493
+ ...normalizeParams(params)
2494
+ });
2495
+ }
2496
+ function _e164(Class2, params) {
2497
+ return new Class2({
2498
+ type: "string",
2499
+ format: "e164",
2500
+ check: "string_format",
2501
+ abort: false,
2502
+ ...normalizeParams(params)
2503
+ });
2504
+ }
2505
+ function _jwt(Class2, params) {
2506
+ return new Class2({
2507
+ type: "string",
2508
+ format: "jwt",
2509
+ check: "string_format",
2510
+ abort: false,
2511
+ ...normalizeParams(params)
2512
+ });
2513
+ }
2514
+ function _isoDateTime(Class2, params) {
2515
+ return new Class2({
2516
+ type: "string",
2517
+ format: "datetime",
2518
+ check: "string_format",
2519
+ offset: false,
2520
+ local: false,
2521
+ precision: null,
2522
+ ...normalizeParams(params)
2523
+ });
2524
+ }
2525
+ function _isoDate(Class2, params) {
2526
+ return new Class2({
2527
+ type: "string",
2528
+ format: "date",
2529
+ check: "string_format",
2530
+ ...normalizeParams(params)
2531
+ });
2532
+ }
2533
+ function _isoTime(Class2, params) {
2534
+ return new Class2({
2535
+ type: "string",
2536
+ format: "time",
2537
+ check: "string_format",
2538
+ precision: null,
2539
+ ...normalizeParams(params)
2540
+ });
2541
+ }
2542
+ function _isoDuration(Class2, params) {
2543
+ return new Class2({
2544
+ type: "string",
2545
+ format: "duration",
2546
+ check: "string_format",
2547
+ ...normalizeParams(params)
2548
+ });
2549
+ }
2550
+ function _unknown(Class2) {
2551
+ return new Class2({
2552
+ type: "unknown"
2553
+ });
2554
+ }
2555
+ function _never(Class2, params) {
2556
+ return new Class2({
2557
+ type: "never",
2558
+ ...normalizeParams(params)
2559
+ });
2560
+ }
2561
+ function _maxLength(maximum, params) {
2562
+ const ch = new $ZodCheckMaxLength({
2563
+ check: "max_length",
2564
+ ...normalizeParams(params),
2565
+ maximum
2566
+ });
2567
+ return ch;
2568
+ }
2569
+ function _minLength(minimum, params) {
2570
+ return new $ZodCheckMinLength({
2571
+ check: "min_length",
2572
+ ...normalizeParams(params),
2573
+ minimum
2574
+ });
2575
+ }
2576
+ function _length(length, params) {
2577
+ return new $ZodCheckLengthEquals({
2578
+ check: "length_equals",
2579
+ ...normalizeParams(params),
2580
+ length
2581
+ });
2582
+ }
2583
+ function _regex(pattern, params) {
2584
+ return new $ZodCheckRegex({
2585
+ check: "string_format",
2586
+ format: "regex",
2587
+ ...normalizeParams(params),
2588
+ pattern
2589
+ });
2590
+ }
2591
+ function _lowercase(params) {
2592
+ return new $ZodCheckLowerCase({
2593
+ check: "string_format",
2594
+ format: "lowercase",
2595
+ ...normalizeParams(params)
2596
+ });
2597
+ }
2598
+ function _uppercase(params) {
2599
+ return new $ZodCheckUpperCase({
2600
+ check: "string_format",
2601
+ format: "uppercase",
2602
+ ...normalizeParams(params)
2603
+ });
2604
+ }
2605
+ function _includes(includes, params) {
2606
+ return new $ZodCheckIncludes({
2607
+ check: "string_format",
2608
+ format: "includes",
2609
+ ...normalizeParams(params),
2610
+ includes
2611
+ });
2612
+ }
2613
+ function _startsWith(prefix, params) {
2614
+ return new $ZodCheckStartsWith({
2615
+ check: "string_format",
2616
+ format: "starts_with",
2617
+ ...normalizeParams(params),
2618
+ prefix
2619
+ });
2620
+ }
2621
+ function _endsWith(suffix, params) {
2622
+ return new $ZodCheckEndsWith({
2623
+ check: "string_format",
2624
+ format: "ends_with",
2625
+ ...normalizeParams(params),
2626
+ suffix
2627
+ });
2628
+ }
2629
+ function _overwrite(tx) {
2630
+ return new $ZodCheckOverwrite({
2631
+ check: "overwrite",
2632
+ tx
2633
+ });
2634
+ }
2635
+ function _normalize(form) {
2636
+ return _overwrite((input) => input.normalize(form));
2637
+ }
2638
+ function _trim() {
2639
+ return _overwrite((input) => input.trim());
2640
+ }
2641
+ function _toLowerCase() {
2642
+ return _overwrite((input) => input.toLowerCase());
2643
+ }
2644
+ function _toUpperCase() {
2645
+ return _overwrite((input) => input.toUpperCase());
2646
+ }
2647
+ function _array(Class2, element, params) {
2648
+ return new Class2({
2649
+ type: "array",
2650
+ element,
2651
+ // get element() {
2652
+ // return element;
2653
+ // },
2654
+ ...normalizeParams(params)
2655
+ });
2656
+ }
2657
+ function _refine(Class2, fn, _params) {
2658
+ const schema = new Class2({
2659
+ type: "custom",
2660
+ check: "custom",
2661
+ fn,
2662
+ ...normalizeParams(_params)
2663
+ });
2664
+ return schema;
2665
+ }
2666
+ function _superRefine(fn) {
2667
+ const ch = _check((payload) => {
2668
+ payload.addIssue = (issue2) => {
2669
+ if (typeof issue2 === "string") {
2670
+ payload.issues.push(issue(issue2, payload.value, ch._zod.def));
2671
+ } else {
2672
+ const _issue = issue2;
2673
+ if (_issue.fatal)
2674
+ _issue.continue = false;
2675
+ _issue.code ?? (_issue.code = "custom");
2676
+ _issue.input ?? (_issue.input = payload.value);
2677
+ _issue.inst ?? (_issue.inst = ch);
2678
+ _issue.continue ?? (_issue.continue = !ch._zod.def.abort);
2679
+ payload.issues.push(issue(_issue));
2680
+ }
2681
+ };
2682
+ return fn(payload.value, payload);
2683
+ });
2684
+ return ch;
2685
+ }
2686
+ function _check(fn, params) {
2687
+ const ch = new $ZodCheck({
2688
+ check: "custom",
2689
+ ...normalizeParams(params)
2690
+ });
2691
+ ch._zod.check = fn;
2692
+ return ch;
2693
+ }
2694
+
2695
+ // ../../node_modules/zod/v4/classic/iso.js
2696
+ var ZodISODateTime = /* @__PURE__ */ $constructor("ZodISODateTime", (inst, def) => {
2697
+ $ZodISODateTime.init(inst, def);
2698
+ ZodStringFormat.init(inst, def);
2699
+ });
2700
+ function datetime2(params) {
2701
+ return _isoDateTime(ZodISODateTime, params);
2702
+ }
2703
+ var ZodISODate = /* @__PURE__ */ $constructor("ZodISODate", (inst, def) => {
2704
+ $ZodISODate.init(inst, def);
2705
+ ZodStringFormat.init(inst, def);
2706
+ });
2707
+ function date2(params) {
2708
+ return _isoDate(ZodISODate, params);
2709
+ }
2710
+ var ZodISOTime = /* @__PURE__ */ $constructor("ZodISOTime", (inst, def) => {
2711
+ $ZodISOTime.init(inst, def);
2712
+ ZodStringFormat.init(inst, def);
2713
+ });
2714
+ function time2(params) {
2715
+ return _isoTime(ZodISOTime, params);
2716
+ }
2717
+ var ZodISODuration = /* @__PURE__ */ $constructor("ZodISODuration", (inst, def) => {
2718
+ $ZodISODuration.init(inst, def);
2719
+ ZodStringFormat.init(inst, def);
2720
+ });
2721
+ function duration2(params) {
2722
+ return _isoDuration(ZodISODuration, params);
2723
+ }
2724
+
2725
+ // ../../node_modules/zod/v4/classic/errors.js
2726
+ var initializer2 = (inst, issues) => {
2727
+ $ZodError.init(inst, issues);
2728
+ inst.name = "ZodError";
2729
+ Object.defineProperties(inst, {
2730
+ format: {
2731
+ value: (mapper) => formatError(inst, mapper)
2732
+ // enumerable: false,
2733
+ },
2734
+ flatten: {
2735
+ value: (mapper) => flattenError(inst, mapper)
2736
+ // enumerable: false,
2737
+ },
2738
+ addIssue: {
2739
+ value: (issue2) => {
2740
+ inst.issues.push(issue2);
2741
+ inst.message = JSON.stringify(inst.issues, jsonStringifyReplacer, 2);
2742
+ }
2743
+ // enumerable: false,
2744
+ },
2745
+ addIssues: {
2746
+ value: (issues2) => {
2747
+ inst.issues.push(...issues2);
2748
+ inst.message = JSON.stringify(inst.issues, jsonStringifyReplacer, 2);
2749
+ }
2750
+ // enumerable: false,
2751
+ },
2752
+ isEmpty: {
2753
+ get() {
2754
+ return inst.issues.length === 0;
2755
+ }
2756
+ // enumerable: false,
2757
+ }
2758
+ });
2759
+ };
2760
+ var ZodError = $constructor("ZodError", initializer2);
2761
+ var ZodRealError = $constructor("ZodError", initializer2, {
2762
+ Parent: Error
2763
+ });
2764
+
2765
+ // ../../node_modules/zod/v4/classic/parse.js
2766
+ var parse2 = /* @__PURE__ */ _parse(ZodRealError);
2767
+ var parseAsync2 = /* @__PURE__ */ _parseAsync(ZodRealError);
2768
+ var safeParse2 = /* @__PURE__ */ _safeParse(ZodRealError);
2769
+ var safeParseAsync2 = /* @__PURE__ */ _safeParseAsync(ZodRealError);
2770
+ var encode = /* @__PURE__ */ _encode(ZodRealError);
2771
+ var decode = /* @__PURE__ */ _decode(ZodRealError);
2772
+ var encodeAsync = /* @__PURE__ */ _encodeAsync(ZodRealError);
2773
+ var decodeAsync = /* @__PURE__ */ _decodeAsync(ZodRealError);
2774
+ var safeEncode = /* @__PURE__ */ _safeEncode(ZodRealError);
2775
+ var safeDecode = /* @__PURE__ */ _safeDecode(ZodRealError);
2776
+ var safeEncodeAsync = /* @__PURE__ */ _safeEncodeAsync(ZodRealError);
2777
+ var safeDecodeAsync = /* @__PURE__ */ _safeDecodeAsync(ZodRealError);
2778
+
2779
+ // ../../node_modules/zod/v4/classic/schemas.js
2780
+ var ZodType = /* @__PURE__ */ $constructor("ZodType", (inst, def) => {
2781
+ $ZodType.init(inst, def);
2782
+ inst.def = def;
2783
+ inst.type = def.type;
2784
+ Object.defineProperty(inst, "_def", { value: def });
2785
+ inst.check = (...checks) => {
2786
+ return inst.clone(util_exports.mergeDefs(def, {
2787
+ checks: [
2788
+ ...def.checks ?? [],
2789
+ ...checks.map((ch) => typeof ch === "function" ? { _zod: { check: ch, def: { check: "custom" }, onattach: [] } } : ch)
2790
+ ]
2791
+ }));
2792
+ };
2793
+ inst.clone = (def2, params) => clone(inst, def2, params);
2794
+ inst.brand = () => inst;
2795
+ inst.register = (reg, meta) => {
2796
+ reg.add(inst, meta);
2797
+ return inst;
2798
+ };
2799
+ inst.parse = (data, params) => parse2(inst, data, params, { callee: inst.parse });
2800
+ inst.safeParse = (data, params) => safeParse2(inst, data, params);
2801
+ inst.parseAsync = async (data, params) => parseAsync2(inst, data, params, { callee: inst.parseAsync });
2802
+ inst.safeParseAsync = async (data, params) => safeParseAsync2(inst, data, params);
2803
+ inst.spa = inst.safeParseAsync;
2804
+ inst.encode = (data, params) => encode(inst, data, params);
2805
+ inst.decode = (data, params) => decode(inst, data, params);
2806
+ inst.encodeAsync = async (data, params) => encodeAsync(inst, data, params);
2807
+ inst.decodeAsync = async (data, params) => decodeAsync(inst, data, params);
2808
+ inst.safeEncode = (data, params) => safeEncode(inst, data, params);
2809
+ inst.safeDecode = (data, params) => safeDecode(inst, data, params);
2810
+ inst.safeEncodeAsync = async (data, params) => safeEncodeAsync(inst, data, params);
2811
+ inst.safeDecodeAsync = async (data, params) => safeDecodeAsync(inst, data, params);
2812
+ inst.refine = (check, params) => inst.check(refine(check, params));
2813
+ inst.superRefine = (refinement) => inst.check(superRefine(refinement));
2814
+ inst.overwrite = (fn) => inst.check(_overwrite(fn));
2815
+ inst.optional = () => optional(inst);
2816
+ inst.nullable = () => nullable(inst);
2817
+ inst.nullish = () => optional(nullable(inst));
2818
+ inst.nonoptional = (params) => nonoptional(inst, params);
2819
+ inst.array = () => array(inst);
2820
+ inst.or = (arg) => union([inst, arg]);
2821
+ inst.and = (arg) => intersection(inst, arg);
2822
+ inst.transform = (tx) => pipe(inst, transform(tx));
2823
+ inst.default = (def2) => _default(inst, def2);
2824
+ inst.prefault = (def2) => prefault(inst, def2);
2825
+ inst.catch = (params) => _catch(inst, params);
2826
+ inst.pipe = (target) => pipe(inst, target);
2827
+ inst.readonly = () => readonly(inst);
2828
+ inst.describe = (description) => {
2829
+ const cl = inst.clone();
2830
+ globalRegistry.add(cl, { description });
2831
+ return cl;
2832
+ };
2833
+ Object.defineProperty(inst, "description", {
2834
+ get() {
2835
+ return globalRegistry.get(inst)?.description;
2836
+ },
2837
+ configurable: true
2838
+ });
2839
+ inst.meta = (...args) => {
2840
+ if (args.length === 0) {
2841
+ return globalRegistry.get(inst);
2842
+ }
2843
+ const cl = inst.clone();
2844
+ globalRegistry.add(cl, args[0]);
2845
+ return cl;
2846
+ };
2847
+ inst.isOptional = () => inst.safeParse(void 0).success;
2848
+ inst.isNullable = () => inst.safeParse(null).success;
2849
+ return inst;
2850
+ });
2851
+ var _ZodString = /* @__PURE__ */ $constructor("_ZodString", (inst, def) => {
2852
+ $ZodString.init(inst, def);
2853
+ ZodType.init(inst, def);
2854
+ const bag = inst._zod.bag;
2855
+ inst.format = bag.format ?? null;
2856
+ inst.minLength = bag.minimum ?? null;
2857
+ inst.maxLength = bag.maximum ?? null;
2858
+ inst.regex = (...args) => inst.check(_regex(...args));
2859
+ inst.includes = (...args) => inst.check(_includes(...args));
2860
+ inst.startsWith = (...args) => inst.check(_startsWith(...args));
2861
+ inst.endsWith = (...args) => inst.check(_endsWith(...args));
2862
+ inst.min = (...args) => inst.check(_minLength(...args));
2863
+ inst.max = (...args) => inst.check(_maxLength(...args));
2864
+ inst.length = (...args) => inst.check(_length(...args));
2865
+ inst.nonempty = (...args) => inst.check(_minLength(1, ...args));
2866
+ inst.lowercase = (params) => inst.check(_lowercase(params));
2867
+ inst.uppercase = (params) => inst.check(_uppercase(params));
2868
+ inst.trim = () => inst.check(_trim());
2869
+ inst.normalize = (...args) => inst.check(_normalize(...args));
2870
+ inst.toLowerCase = () => inst.check(_toLowerCase());
2871
+ inst.toUpperCase = () => inst.check(_toUpperCase());
2872
+ });
2873
+ var ZodString = /* @__PURE__ */ $constructor("ZodString", (inst, def) => {
2874
+ $ZodString.init(inst, def);
2875
+ _ZodString.init(inst, def);
2876
+ inst.email = (params) => inst.check(_email(ZodEmail, params));
2877
+ inst.url = (params) => inst.check(_url(ZodURL, params));
2878
+ inst.jwt = (params) => inst.check(_jwt(ZodJWT, params));
2879
+ inst.emoji = (params) => inst.check(_emoji2(ZodEmoji, params));
2880
+ inst.guid = (params) => inst.check(_guid(ZodGUID, params));
2881
+ inst.uuid = (params) => inst.check(_uuid(ZodUUID, params));
2882
+ inst.uuidv4 = (params) => inst.check(_uuidv4(ZodUUID, params));
2883
+ inst.uuidv6 = (params) => inst.check(_uuidv6(ZodUUID, params));
2884
+ inst.uuidv7 = (params) => inst.check(_uuidv7(ZodUUID, params));
2885
+ inst.nanoid = (params) => inst.check(_nanoid(ZodNanoID, params));
2886
+ inst.guid = (params) => inst.check(_guid(ZodGUID, params));
2887
+ inst.cuid = (params) => inst.check(_cuid(ZodCUID, params));
2888
+ inst.cuid2 = (params) => inst.check(_cuid2(ZodCUID2, params));
2889
+ inst.ulid = (params) => inst.check(_ulid(ZodULID, params));
2890
+ inst.base64 = (params) => inst.check(_base64(ZodBase64, params));
2891
+ inst.base64url = (params) => inst.check(_base64url(ZodBase64URL, params));
2892
+ inst.xid = (params) => inst.check(_xid(ZodXID, params));
2893
+ inst.ksuid = (params) => inst.check(_ksuid(ZodKSUID, params));
2894
+ inst.ipv4 = (params) => inst.check(_ipv4(ZodIPv4, params));
2895
+ inst.ipv6 = (params) => inst.check(_ipv6(ZodIPv6, params));
2896
+ inst.cidrv4 = (params) => inst.check(_cidrv4(ZodCIDRv4, params));
2897
+ inst.cidrv6 = (params) => inst.check(_cidrv6(ZodCIDRv6, params));
2898
+ inst.e164 = (params) => inst.check(_e164(ZodE164, params));
2899
+ inst.datetime = (params) => inst.check(datetime2(params));
2900
+ inst.date = (params) => inst.check(date2(params));
2901
+ inst.time = (params) => inst.check(time2(params));
2902
+ inst.duration = (params) => inst.check(duration2(params));
2903
+ });
2904
+ function string2(params) {
2905
+ return _string(ZodString, params);
2906
+ }
2907
+ var ZodStringFormat = /* @__PURE__ */ $constructor("ZodStringFormat", (inst, def) => {
2908
+ $ZodStringFormat.init(inst, def);
2909
+ _ZodString.init(inst, def);
2910
+ });
2911
+ var ZodEmail = /* @__PURE__ */ $constructor("ZodEmail", (inst, def) => {
2912
+ $ZodEmail.init(inst, def);
2913
+ ZodStringFormat.init(inst, def);
2914
+ });
2915
+ var ZodGUID = /* @__PURE__ */ $constructor("ZodGUID", (inst, def) => {
2916
+ $ZodGUID.init(inst, def);
2917
+ ZodStringFormat.init(inst, def);
2918
+ });
2919
+ var ZodUUID = /* @__PURE__ */ $constructor("ZodUUID", (inst, def) => {
2920
+ $ZodUUID.init(inst, def);
2921
+ ZodStringFormat.init(inst, def);
2922
+ });
2923
+ var ZodURL = /* @__PURE__ */ $constructor("ZodURL", (inst, def) => {
2924
+ $ZodURL.init(inst, def);
2925
+ ZodStringFormat.init(inst, def);
2926
+ });
2927
+ var ZodEmoji = /* @__PURE__ */ $constructor("ZodEmoji", (inst, def) => {
2928
+ $ZodEmoji.init(inst, def);
2929
+ ZodStringFormat.init(inst, def);
2930
+ });
2931
+ var ZodNanoID = /* @__PURE__ */ $constructor("ZodNanoID", (inst, def) => {
2932
+ $ZodNanoID.init(inst, def);
2933
+ ZodStringFormat.init(inst, def);
2934
+ });
2935
+ var ZodCUID = /* @__PURE__ */ $constructor("ZodCUID", (inst, def) => {
2936
+ $ZodCUID.init(inst, def);
2937
+ ZodStringFormat.init(inst, def);
2938
+ });
2939
+ var ZodCUID2 = /* @__PURE__ */ $constructor("ZodCUID2", (inst, def) => {
2940
+ $ZodCUID2.init(inst, def);
2941
+ ZodStringFormat.init(inst, def);
2942
+ });
2943
+ var ZodULID = /* @__PURE__ */ $constructor("ZodULID", (inst, def) => {
2944
+ $ZodULID.init(inst, def);
2945
+ ZodStringFormat.init(inst, def);
2946
+ });
2947
+ var ZodXID = /* @__PURE__ */ $constructor("ZodXID", (inst, def) => {
2948
+ $ZodXID.init(inst, def);
2949
+ ZodStringFormat.init(inst, def);
2950
+ });
2951
+ var ZodKSUID = /* @__PURE__ */ $constructor("ZodKSUID", (inst, def) => {
2952
+ $ZodKSUID.init(inst, def);
2953
+ ZodStringFormat.init(inst, def);
2954
+ });
2955
+ var ZodIPv4 = /* @__PURE__ */ $constructor("ZodIPv4", (inst, def) => {
2956
+ $ZodIPv4.init(inst, def);
2957
+ ZodStringFormat.init(inst, def);
2958
+ });
2959
+ var ZodIPv6 = /* @__PURE__ */ $constructor("ZodIPv6", (inst, def) => {
2960
+ $ZodIPv6.init(inst, def);
2961
+ ZodStringFormat.init(inst, def);
2962
+ });
2963
+ var ZodCIDRv4 = /* @__PURE__ */ $constructor("ZodCIDRv4", (inst, def) => {
2964
+ $ZodCIDRv4.init(inst, def);
2965
+ ZodStringFormat.init(inst, def);
2966
+ });
2967
+ var ZodCIDRv6 = /* @__PURE__ */ $constructor("ZodCIDRv6", (inst, def) => {
2968
+ $ZodCIDRv6.init(inst, def);
2969
+ ZodStringFormat.init(inst, def);
2970
+ });
2971
+ var ZodBase64 = /* @__PURE__ */ $constructor("ZodBase64", (inst, def) => {
2972
+ $ZodBase64.init(inst, def);
2973
+ ZodStringFormat.init(inst, def);
2974
+ });
2975
+ var ZodBase64URL = /* @__PURE__ */ $constructor("ZodBase64URL", (inst, def) => {
2976
+ $ZodBase64URL.init(inst, def);
2977
+ ZodStringFormat.init(inst, def);
2978
+ });
2979
+ var ZodE164 = /* @__PURE__ */ $constructor("ZodE164", (inst, def) => {
2980
+ $ZodE164.init(inst, def);
2981
+ ZodStringFormat.init(inst, def);
2982
+ });
2983
+ var ZodJWT = /* @__PURE__ */ $constructor("ZodJWT", (inst, def) => {
2984
+ $ZodJWT.init(inst, def);
2985
+ ZodStringFormat.init(inst, def);
2986
+ });
2987
+ var ZodUnknown = /* @__PURE__ */ $constructor("ZodUnknown", (inst, def) => {
2988
+ $ZodUnknown.init(inst, def);
2989
+ ZodType.init(inst, def);
2990
+ });
2991
+ function unknown() {
2992
+ return _unknown(ZodUnknown);
2993
+ }
2994
+ var ZodNever = /* @__PURE__ */ $constructor("ZodNever", (inst, def) => {
2995
+ $ZodNever.init(inst, def);
2996
+ ZodType.init(inst, def);
2997
+ });
2998
+ function never(params) {
2999
+ return _never(ZodNever, params);
3000
+ }
3001
+ var ZodArray = /* @__PURE__ */ $constructor("ZodArray", (inst, def) => {
3002
+ $ZodArray.init(inst, def);
3003
+ ZodType.init(inst, def);
3004
+ inst.element = def.element;
3005
+ inst.min = (minLength, params) => inst.check(_minLength(minLength, params));
3006
+ inst.nonempty = (params) => inst.check(_minLength(1, params));
3007
+ inst.max = (maxLength, params) => inst.check(_maxLength(maxLength, params));
3008
+ inst.length = (len, params) => inst.check(_length(len, params));
3009
+ inst.unwrap = () => inst.element;
3010
+ });
3011
+ function array(element, params) {
3012
+ return _array(ZodArray, element, params);
3013
+ }
3014
+ var ZodObject = /* @__PURE__ */ $constructor("ZodObject", (inst, def) => {
3015
+ $ZodObjectJIT.init(inst, def);
3016
+ ZodType.init(inst, def);
3017
+ util_exports.defineLazy(inst, "shape", () => {
3018
+ return def.shape;
3019
+ });
3020
+ inst.keyof = () => _enum(Object.keys(inst._zod.def.shape));
3021
+ inst.catchall = (catchall) => inst.clone({ ...inst._zod.def, catchall });
3022
+ inst.passthrough = () => inst.clone({ ...inst._zod.def, catchall: unknown() });
3023
+ inst.loose = () => inst.clone({ ...inst._zod.def, catchall: unknown() });
3024
+ inst.strict = () => inst.clone({ ...inst._zod.def, catchall: never() });
3025
+ inst.strip = () => inst.clone({ ...inst._zod.def, catchall: void 0 });
3026
+ inst.extend = (incoming) => {
3027
+ return util_exports.extend(inst, incoming);
3028
+ };
3029
+ inst.safeExtend = (incoming) => {
3030
+ return util_exports.safeExtend(inst, incoming);
3031
+ };
3032
+ inst.merge = (other) => util_exports.merge(inst, other);
3033
+ inst.pick = (mask) => util_exports.pick(inst, mask);
3034
+ inst.omit = (mask) => util_exports.omit(inst, mask);
3035
+ inst.partial = (...args) => util_exports.partial(ZodOptional, inst, args[0]);
3036
+ inst.required = (...args) => util_exports.required(ZodNonOptional, inst, args[0]);
3037
+ });
3038
+ function object(shape, params) {
3039
+ const def = {
3040
+ type: "object",
3041
+ shape: shape ?? {},
3042
+ ...util_exports.normalizeParams(params)
3043
+ };
3044
+ return new ZodObject(def);
3045
+ }
3046
+ var ZodUnion = /* @__PURE__ */ $constructor("ZodUnion", (inst, def) => {
3047
+ $ZodUnion.init(inst, def);
3048
+ ZodType.init(inst, def);
3049
+ inst.options = def.options;
3050
+ });
3051
+ function union(options, params) {
3052
+ return new ZodUnion({
3053
+ type: "union",
3054
+ options,
3055
+ ...util_exports.normalizeParams(params)
3056
+ });
3057
+ }
3058
+ var ZodIntersection = /* @__PURE__ */ $constructor("ZodIntersection", (inst, def) => {
3059
+ $ZodIntersection.init(inst, def);
3060
+ ZodType.init(inst, def);
3061
+ });
3062
+ function intersection(left, right) {
3063
+ return new ZodIntersection({
3064
+ type: "intersection",
3065
+ left,
3066
+ right
3067
+ });
3068
+ }
3069
+ var ZodEnum = /* @__PURE__ */ $constructor("ZodEnum", (inst, def) => {
3070
+ $ZodEnum.init(inst, def);
3071
+ ZodType.init(inst, def);
3072
+ inst.enum = def.entries;
3073
+ inst.options = Object.values(def.entries);
3074
+ const keys = new Set(Object.keys(def.entries));
3075
+ inst.extract = (values, params) => {
3076
+ const newEntries = {};
3077
+ for (const value of values) {
3078
+ if (keys.has(value)) {
3079
+ newEntries[value] = def.entries[value];
3080
+ } else
3081
+ throw new Error(`Key ${value} not found in enum`);
3082
+ }
3083
+ return new ZodEnum({
3084
+ ...def,
3085
+ checks: [],
3086
+ ...util_exports.normalizeParams(params),
3087
+ entries: newEntries
3088
+ });
3089
+ };
3090
+ inst.exclude = (values, params) => {
3091
+ const newEntries = { ...def.entries };
3092
+ for (const value of values) {
3093
+ if (keys.has(value)) {
3094
+ delete newEntries[value];
3095
+ } else
3096
+ throw new Error(`Key ${value} not found in enum`);
3097
+ }
3098
+ return new ZodEnum({
3099
+ ...def,
3100
+ checks: [],
3101
+ ...util_exports.normalizeParams(params),
3102
+ entries: newEntries
3103
+ });
3104
+ };
3105
+ });
3106
+ function _enum(values, params) {
3107
+ const entries = Array.isArray(values) ? Object.fromEntries(values.map((v) => [v, v])) : values;
3108
+ return new ZodEnum({
3109
+ type: "enum",
3110
+ entries,
3111
+ ...util_exports.normalizeParams(params)
3112
+ });
3113
+ }
3114
+ var ZodTransform = /* @__PURE__ */ $constructor("ZodTransform", (inst, def) => {
3115
+ $ZodTransform.init(inst, def);
3116
+ ZodType.init(inst, def);
3117
+ inst._zod.parse = (payload, _ctx) => {
3118
+ if (_ctx.direction === "backward") {
3119
+ throw new $ZodEncodeError(inst.constructor.name);
3120
+ }
3121
+ payload.addIssue = (issue2) => {
3122
+ if (typeof issue2 === "string") {
3123
+ payload.issues.push(util_exports.issue(issue2, payload.value, def));
3124
+ } else {
3125
+ const _issue = issue2;
3126
+ if (_issue.fatal)
3127
+ _issue.continue = false;
3128
+ _issue.code ?? (_issue.code = "custom");
3129
+ _issue.input ?? (_issue.input = payload.value);
3130
+ _issue.inst ?? (_issue.inst = inst);
3131
+ payload.issues.push(util_exports.issue(_issue));
3132
+ }
3133
+ };
3134
+ const output = def.transform(payload.value, payload);
3135
+ if (output instanceof Promise) {
3136
+ return output.then((output2) => {
3137
+ payload.value = output2;
3138
+ return payload;
3139
+ });
3140
+ }
3141
+ payload.value = output;
3142
+ return payload;
3143
+ };
3144
+ });
3145
+ function transform(fn) {
3146
+ return new ZodTransform({
3147
+ type: "transform",
3148
+ transform: fn
3149
+ });
3150
+ }
3151
+ var ZodOptional = /* @__PURE__ */ $constructor("ZodOptional", (inst, def) => {
3152
+ $ZodOptional.init(inst, def);
3153
+ ZodType.init(inst, def);
3154
+ inst.unwrap = () => inst._zod.def.innerType;
3155
+ });
3156
+ function optional(innerType) {
3157
+ return new ZodOptional({
3158
+ type: "optional",
3159
+ innerType
3160
+ });
3161
+ }
3162
+ var ZodNullable = /* @__PURE__ */ $constructor("ZodNullable", (inst, def) => {
3163
+ $ZodNullable.init(inst, def);
3164
+ ZodType.init(inst, def);
3165
+ inst.unwrap = () => inst._zod.def.innerType;
3166
+ });
3167
+ function nullable(innerType) {
3168
+ return new ZodNullable({
3169
+ type: "nullable",
3170
+ innerType
3171
+ });
3172
+ }
3173
+ var ZodDefault = /* @__PURE__ */ $constructor("ZodDefault", (inst, def) => {
3174
+ $ZodDefault.init(inst, def);
3175
+ ZodType.init(inst, def);
3176
+ inst.unwrap = () => inst._zod.def.innerType;
3177
+ inst.removeDefault = inst.unwrap;
3178
+ });
3179
+ function _default(innerType, defaultValue) {
3180
+ return new ZodDefault({
3181
+ type: "default",
3182
+ innerType,
3183
+ get defaultValue() {
3184
+ return typeof defaultValue === "function" ? defaultValue() : util_exports.shallowClone(defaultValue);
3185
+ }
3186
+ });
3187
+ }
3188
+ var ZodPrefault = /* @__PURE__ */ $constructor("ZodPrefault", (inst, def) => {
3189
+ $ZodPrefault.init(inst, def);
3190
+ ZodType.init(inst, def);
3191
+ inst.unwrap = () => inst._zod.def.innerType;
3192
+ });
3193
+ function prefault(innerType, defaultValue) {
3194
+ return new ZodPrefault({
3195
+ type: "prefault",
3196
+ innerType,
3197
+ get defaultValue() {
3198
+ return typeof defaultValue === "function" ? defaultValue() : util_exports.shallowClone(defaultValue);
3199
+ }
3200
+ });
3201
+ }
3202
+ var ZodNonOptional = /* @__PURE__ */ $constructor("ZodNonOptional", (inst, def) => {
3203
+ $ZodNonOptional.init(inst, def);
3204
+ ZodType.init(inst, def);
3205
+ inst.unwrap = () => inst._zod.def.innerType;
3206
+ });
3207
+ function nonoptional(innerType, params) {
3208
+ return new ZodNonOptional({
3209
+ type: "nonoptional",
3210
+ innerType,
3211
+ ...util_exports.normalizeParams(params)
3212
+ });
3213
+ }
3214
+ var ZodCatch = /* @__PURE__ */ $constructor("ZodCatch", (inst, def) => {
3215
+ $ZodCatch.init(inst, def);
3216
+ ZodType.init(inst, def);
3217
+ inst.unwrap = () => inst._zod.def.innerType;
3218
+ inst.removeCatch = inst.unwrap;
3219
+ });
3220
+ function _catch(innerType, catchValue) {
3221
+ return new ZodCatch({
3222
+ type: "catch",
3223
+ innerType,
3224
+ catchValue: typeof catchValue === "function" ? catchValue : () => catchValue
3225
+ });
3226
+ }
3227
+ var ZodPipe = /* @__PURE__ */ $constructor("ZodPipe", (inst, def) => {
3228
+ $ZodPipe.init(inst, def);
3229
+ ZodType.init(inst, def);
3230
+ inst.in = def.in;
3231
+ inst.out = def.out;
3232
+ });
3233
+ function pipe(in_, out) {
3234
+ return new ZodPipe({
3235
+ type: "pipe",
3236
+ in: in_,
3237
+ out
3238
+ // ...util.normalizeParams(params),
3239
+ });
3240
+ }
3241
+ var ZodReadonly = /* @__PURE__ */ $constructor("ZodReadonly", (inst, def) => {
3242
+ $ZodReadonly.init(inst, def);
3243
+ ZodType.init(inst, def);
3244
+ inst.unwrap = () => inst._zod.def.innerType;
3245
+ });
3246
+ function readonly(innerType) {
3247
+ return new ZodReadonly({
3248
+ type: "readonly",
3249
+ innerType
3250
+ });
3251
+ }
3252
+ var ZodCustom = /* @__PURE__ */ $constructor("ZodCustom", (inst, def) => {
3253
+ $ZodCustom.init(inst, def);
3254
+ ZodType.init(inst, def);
3255
+ });
3256
+ function refine(fn, _params = {}) {
3257
+ return _refine(ZodCustom, fn, _params);
3258
+ }
3259
+ function superRefine(fn) {
3260
+ return _superRefine(fn);
3261
+ }
3262
+
3263
+ export {
3264
+ string2 as string,
3265
+ object,
3266
+ _enum
3267
+ };