limina 0.0.4 → 0.0.6

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