@skuba-lib/api 2.0.0 → 2.0.1

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