ev-interactivity-core 0.1.0

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