@majeanson/lac 3.0.3 → 3.0.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.mjs CHANGED
@@ -1,15 +1,3870 @@
1
1
  import { Command } from "commander";
2
2
  import { mkdir, readFile, readdir, writeFile } from "node:fs/promises";
3
3
  import process$1 from "node:process";
4
- import { FEATURE_KEY_PATTERN, generateFeatureKey, validateFeature } from "@life-as-code/feature-schema";
5
- import path, { dirname, join, resolve } from "node:path";
6
4
  import fs, { chmodSync, existsSync, mkdirSync, readFileSync, rmSync, statSync, writeFileSync } from "node:fs";
5
+ import path, { dirname, join, resolve } from "node:path";
7
6
  import readline from "node:readline";
8
7
  import Anthropic from "@anthropic-ai/sdk";
9
8
  import { execSync, spawn, spawnSync } from "node:child_process";
10
9
  import prompts from "prompts";
11
10
  import http from "node:http";
12
11
 
12
+ //#region ../../node_modules/.bun/zod@4.3.6/node_modules/zod/v4/core/core.js
13
+ /** A special constant with type `never` */
14
+ const NEVER = Object.freeze({ status: "aborted" });
15
+ function $constructor$1(name, initializer$4, params) {
16
+ function init(inst, def) {
17
+ if (!inst._zod) Object.defineProperty(inst, "_zod", {
18
+ value: {
19
+ def,
20
+ constr: _,
21
+ traits: /* @__PURE__ */ new Set()
22
+ },
23
+ enumerable: false
24
+ });
25
+ if (inst._zod.traits.has(name)) return;
26
+ inst._zod.traits.add(name);
27
+ initializer$4(inst, def);
28
+ const proto = _.prototype;
29
+ const keys = Object.keys(proto);
30
+ for (let i = 0; i < keys.length; i++) {
31
+ const k = keys[i];
32
+ if (!(k in inst)) inst[k] = proto[k].bind(inst);
33
+ }
34
+ }
35
+ const Parent = params?.Parent ?? Object;
36
+ class Definition extends Parent {}
37
+ Object.defineProperty(Definition, "name", { value: name });
38
+ function _(def) {
39
+ var _a$2;
40
+ const inst = params?.Parent ? new Definition() : this;
41
+ init(inst, def);
42
+ (_a$2 = inst._zod).deferred ?? (_a$2.deferred = []);
43
+ for (const fn of inst._zod.deferred) fn();
44
+ return inst;
45
+ }
46
+ Object.defineProperty(_, "init", { value: init });
47
+ Object.defineProperty(_, Symbol.hasInstance, { value: (inst) => {
48
+ if (params?.Parent && inst instanceof params.Parent) return true;
49
+ return inst?._zod?.traits?.has(name);
50
+ } });
51
+ Object.defineProperty(_, "name", { value: name });
52
+ return _;
53
+ }
54
+ var $ZodAsyncError$1 = class extends Error {
55
+ constructor() {
56
+ super(`Encountered Promise during synchronous parse. Use .parseAsync() instead.`);
57
+ }
58
+ };
59
+ var $ZodEncodeError$1 = class extends Error {
60
+ constructor(name) {
61
+ super(`Encountered unidirectional transform during encode: ${name}`);
62
+ this.name = "ZodEncodeError";
63
+ }
64
+ };
65
+ const globalConfig$1 = {};
66
+ function config$1(newConfig) {
67
+ if (newConfig) Object.assign(globalConfig$1, newConfig);
68
+ return globalConfig$1;
69
+ }
70
+
71
+ //#endregion
72
+ //#region ../../node_modules/.bun/zod@4.3.6/node_modules/zod/v4/core/util.js
73
+ function getEnumValues$1(entries) {
74
+ const numericValues = Object.values(entries).filter((v) => typeof v === "number");
75
+ return Object.entries(entries).filter(([k, _]) => numericValues.indexOf(+k) === -1).map(([_, v]) => v);
76
+ }
77
+ function jsonStringifyReplacer$1(_, value) {
78
+ if (typeof value === "bigint") return value.toString();
79
+ return value;
80
+ }
81
+ function cached$1(getter) {
82
+ return { get value() {
83
+ {
84
+ const value = getter();
85
+ Object.defineProperty(this, "value", { value });
86
+ return value;
87
+ }
88
+ throw new Error("cached value already set");
89
+ } };
90
+ }
91
+ function nullish$1(input) {
92
+ return input === null || input === void 0;
93
+ }
94
+ function cleanRegex$1(source) {
95
+ const start = source.startsWith("^") ? 1 : 0;
96
+ const end = source.endsWith("$") ? source.length - 1 : source.length;
97
+ return source.slice(start, end);
98
+ }
99
+ function floatSafeRemainder$1(val, step) {
100
+ const valDecCount = (val.toString().split(".")[1] || "").length;
101
+ const stepString = step.toString();
102
+ let stepDecCount = (stepString.split(".")[1] || "").length;
103
+ if (stepDecCount === 0 && /\d?e-\d?/.test(stepString)) {
104
+ const match = stepString.match(/\d?e-(\d?)/);
105
+ if (match?.[1]) stepDecCount = Number.parseInt(match[1]);
106
+ }
107
+ const decCount = valDecCount > stepDecCount ? valDecCount : stepDecCount;
108
+ return Number.parseInt(val.toFixed(decCount).replace(".", "")) % Number.parseInt(step.toFixed(decCount).replace(".", "")) / 10 ** decCount;
109
+ }
110
+ const EVALUATING$1 = Symbol("evaluating");
111
+ function defineLazy$1(object$2, key, getter) {
112
+ let value = void 0;
113
+ Object.defineProperty(object$2, key, {
114
+ get() {
115
+ if (value === EVALUATING$1) return;
116
+ if (value === void 0) {
117
+ value = EVALUATING$1;
118
+ value = getter();
119
+ }
120
+ return value;
121
+ },
122
+ set(v) {
123
+ Object.defineProperty(object$2, key, { value: v });
124
+ },
125
+ configurable: true
126
+ });
127
+ }
128
+ function assignProp$1(target, prop, value) {
129
+ Object.defineProperty(target, prop, {
130
+ value,
131
+ writable: true,
132
+ enumerable: true,
133
+ configurable: true
134
+ });
135
+ }
136
+ function mergeDefs$1(...defs) {
137
+ const mergedDescriptors = {};
138
+ for (const def of defs) {
139
+ const descriptors = Object.getOwnPropertyDescriptors(def);
140
+ Object.assign(mergedDescriptors, descriptors);
141
+ }
142
+ return Object.defineProperties({}, mergedDescriptors);
143
+ }
144
+ function esc$1(str) {
145
+ return JSON.stringify(str);
146
+ }
147
+ function slugify$1(input) {
148
+ return input.toLowerCase().trim().replace(/[^\w\s-]/g, "").replace(/[\s_-]+/g, "-").replace(/^-+|-+$/g, "");
149
+ }
150
+ const captureStackTrace$1 = "captureStackTrace" in Error ? Error.captureStackTrace : (..._args) => {};
151
+ function isObject$1(data) {
152
+ return typeof data === "object" && data !== null && !Array.isArray(data);
153
+ }
154
+ const allowsEval$1 = cached$1(() => {
155
+ if (typeof navigator !== "undefined" && navigator?.userAgent?.includes("Cloudflare")) return false;
156
+ try {
157
+ new Function("");
158
+ return true;
159
+ } catch (_) {
160
+ return false;
161
+ }
162
+ });
163
+ function isPlainObject$1(o) {
164
+ if (isObject$1(o) === false) return false;
165
+ const ctor = o.constructor;
166
+ if (ctor === void 0) return true;
167
+ if (typeof ctor !== "function") return true;
168
+ const prot = ctor.prototype;
169
+ if (isObject$1(prot) === false) return false;
170
+ if (Object.prototype.hasOwnProperty.call(prot, "isPrototypeOf") === false) return false;
171
+ return true;
172
+ }
173
+ function shallowClone$1(o) {
174
+ if (isPlainObject$1(o)) return { ...o };
175
+ if (Array.isArray(o)) return [...o];
176
+ return o;
177
+ }
178
+ const propertyKeyTypes$1 = new Set([
179
+ "string",
180
+ "number",
181
+ "symbol"
182
+ ]);
183
+ function escapeRegex$1(str) {
184
+ return str.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
185
+ }
186
+ function clone$1(inst, def, params) {
187
+ const cl = new inst._zod.constr(def ?? inst._zod.def);
188
+ if (!def || params?.parent) cl._zod.parent = inst;
189
+ return cl;
190
+ }
191
+ function normalizeParams$1(_params) {
192
+ const params = _params;
193
+ if (!params) return {};
194
+ if (typeof params === "string") return { error: () => params };
195
+ if (params?.message !== void 0) {
196
+ if (params?.error !== void 0) throw new Error("Cannot specify both `message` and `error` params");
197
+ params.error = params.message;
198
+ }
199
+ delete params.message;
200
+ if (typeof params.error === "string") return {
201
+ ...params,
202
+ error: () => params.error
203
+ };
204
+ return params;
205
+ }
206
+ function optionalKeys$1(shape) {
207
+ return Object.keys(shape).filter((k) => {
208
+ return shape[k]._zod.optin === "optional" && shape[k]._zod.optout === "optional";
209
+ });
210
+ }
211
+ const NUMBER_FORMAT_RANGES$1 = {
212
+ safeint: [Number.MIN_SAFE_INTEGER, Number.MAX_SAFE_INTEGER],
213
+ int32: [-2147483648, 2147483647],
214
+ uint32: [0, 4294967295],
215
+ float32: [-34028234663852886e22, 34028234663852886e22],
216
+ float64: [-Number.MAX_VALUE, Number.MAX_VALUE]
217
+ };
218
+ function pick$1(schema, mask) {
219
+ const currDef = schema._zod.def;
220
+ const checks = currDef.checks;
221
+ if (checks && checks.length > 0) throw new Error(".pick() cannot be used on object schemas containing refinements");
222
+ return clone$1(schema, mergeDefs$1(schema._zod.def, {
223
+ get shape() {
224
+ const newShape = {};
225
+ for (const key in mask) {
226
+ if (!(key in currDef.shape)) throw new Error(`Unrecognized key: "${key}"`);
227
+ if (!mask[key]) continue;
228
+ newShape[key] = currDef.shape[key];
229
+ }
230
+ assignProp$1(this, "shape", newShape);
231
+ return newShape;
232
+ },
233
+ checks: []
234
+ }));
235
+ }
236
+ function omit$1(schema, mask) {
237
+ const currDef = schema._zod.def;
238
+ const checks = currDef.checks;
239
+ if (checks && checks.length > 0) throw new Error(".omit() cannot be used on object schemas containing refinements");
240
+ return clone$1(schema, mergeDefs$1(schema._zod.def, {
241
+ get shape() {
242
+ const newShape = { ...schema._zod.def.shape };
243
+ for (const key in mask) {
244
+ if (!(key in currDef.shape)) throw new Error(`Unrecognized key: "${key}"`);
245
+ if (!mask[key]) continue;
246
+ delete newShape[key];
247
+ }
248
+ assignProp$1(this, "shape", newShape);
249
+ return newShape;
250
+ },
251
+ checks: []
252
+ }));
253
+ }
254
+ function extend$1(schema, shape) {
255
+ if (!isPlainObject$1(shape)) throw new Error("Invalid input to extend: expected a plain object");
256
+ const checks = schema._zod.def.checks;
257
+ if (checks && checks.length > 0) {
258
+ const existingShape = schema._zod.def.shape;
259
+ 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.");
260
+ }
261
+ return clone$1(schema, mergeDefs$1(schema._zod.def, { get shape() {
262
+ const _shape = {
263
+ ...schema._zod.def.shape,
264
+ ...shape
265
+ };
266
+ assignProp$1(this, "shape", _shape);
267
+ return _shape;
268
+ } }));
269
+ }
270
+ function safeExtend$1(schema, shape) {
271
+ if (!isPlainObject$1(shape)) throw new Error("Invalid input to safeExtend: expected a plain object");
272
+ return clone$1(schema, mergeDefs$1(schema._zod.def, { get shape() {
273
+ const _shape = {
274
+ ...schema._zod.def.shape,
275
+ ...shape
276
+ };
277
+ assignProp$1(this, "shape", _shape);
278
+ return _shape;
279
+ } }));
280
+ }
281
+ function merge$1(a, b) {
282
+ return clone$1(a, mergeDefs$1(a._zod.def, {
283
+ get shape() {
284
+ const _shape = {
285
+ ...a._zod.def.shape,
286
+ ...b._zod.def.shape
287
+ };
288
+ assignProp$1(this, "shape", _shape);
289
+ return _shape;
290
+ },
291
+ get catchall() {
292
+ return b._zod.def.catchall;
293
+ },
294
+ checks: []
295
+ }));
296
+ }
297
+ function partial$1(Class, schema, mask) {
298
+ const checks = schema._zod.def.checks;
299
+ if (checks && checks.length > 0) throw new Error(".partial() cannot be used on object schemas containing refinements");
300
+ return clone$1(schema, mergeDefs$1(schema._zod.def, {
301
+ get shape() {
302
+ const oldShape = schema._zod.def.shape;
303
+ const shape = { ...oldShape };
304
+ if (mask) for (const key in mask) {
305
+ if (!(key in oldShape)) throw new Error(`Unrecognized key: "${key}"`);
306
+ if (!mask[key]) continue;
307
+ shape[key] = Class ? new Class({
308
+ type: "optional",
309
+ innerType: oldShape[key]
310
+ }) : oldShape[key];
311
+ }
312
+ else for (const key in oldShape) shape[key] = Class ? new Class({
313
+ type: "optional",
314
+ innerType: oldShape[key]
315
+ }) : oldShape[key];
316
+ assignProp$1(this, "shape", shape);
317
+ return shape;
318
+ },
319
+ checks: []
320
+ }));
321
+ }
322
+ function required$1(Class, schema, mask) {
323
+ return clone$1(schema, mergeDefs$1(schema._zod.def, { get shape() {
324
+ const oldShape = schema._zod.def.shape;
325
+ const shape = { ...oldShape };
326
+ if (mask) for (const key in mask) {
327
+ if (!(key in shape)) throw new Error(`Unrecognized key: "${key}"`);
328
+ if (!mask[key]) continue;
329
+ shape[key] = new Class({
330
+ type: "nonoptional",
331
+ innerType: oldShape[key]
332
+ });
333
+ }
334
+ else for (const key in oldShape) shape[key] = new Class({
335
+ type: "nonoptional",
336
+ innerType: oldShape[key]
337
+ });
338
+ assignProp$1(this, "shape", shape);
339
+ return shape;
340
+ } }));
341
+ }
342
+ function aborted$1(x, startIndex = 0) {
343
+ if (x.aborted === true) return true;
344
+ for (let i = startIndex; i < x.issues.length; i++) if (x.issues[i]?.continue !== true) return true;
345
+ return false;
346
+ }
347
+ function prefixIssues$1(path$1, issues) {
348
+ return issues.map((iss) => {
349
+ var _a$2;
350
+ (_a$2 = iss).path ?? (_a$2.path = []);
351
+ iss.path.unshift(path$1);
352
+ return iss;
353
+ });
354
+ }
355
+ function unwrapMessage$1(message) {
356
+ return typeof message === "string" ? message : message?.message;
357
+ }
358
+ function finalizeIssue$1(iss, ctx, config$2) {
359
+ const full = {
360
+ ...iss,
361
+ path: iss.path ?? []
362
+ };
363
+ if (!iss.message) full.message = unwrapMessage$1(iss.inst?._zod.def?.error?.(iss)) ?? unwrapMessage$1(ctx?.error?.(iss)) ?? unwrapMessage$1(config$2.customError?.(iss)) ?? unwrapMessage$1(config$2.localeError?.(iss)) ?? "Invalid input";
364
+ delete full.inst;
365
+ delete full.continue;
366
+ if (!ctx?.reportInput) delete full.input;
367
+ return full;
368
+ }
369
+ function getLengthableOrigin$1(input) {
370
+ if (Array.isArray(input)) return "array";
371
+ if (typeof input === "string") return "string";
372
+ return "unknown";
373
+ }
374
+ function issue$1(...args) {
375
+ const [iss, input, inst] = args;
376
+ if (typeof iss === "string") return {
377
+ message: iss,
378
+ code: "custom",
379
+ input,
380
+ inst
381
+ };
382
+ return { ...iss };
383
+ }
384
+
385
+ //#endregion
386
+ //#region ../../node_modules/.bun/zod@4.3.6/node_modules/zod/v4/core/errors.js
387
+ const initializer$3 = (inst, def) => {
388
+ inst.name = "$ZodError";
389
+ Object.defineProperty(inst, "_zod", {
390
+ value: inst._zod,
391
+ enumerable: false
392
+ });
393
+ Object.defineProperty(inst, "issues", {
394
+ value: def,
395
+ enumerable: false
396
+ });
397
+ inst.message = JSON.stringify(def, jsonStringifyReplacer$1, 2);
398
+ Object.defineProperty(inst, "toString", {
399
+ value: () => inst.message,
400
+ enumerable: false
401
+ });
402
+ };
403
+ const $ZodError$1 = $constructor$1("$ZodError", initializer$3);
404
+ const $ZodRealError$1 = $constructor$1("$ZodError", initializer$3, { Parent: Error });
405
+ function flattenError$1(error, mapper = (issue$2) => issue$2.message) {
406
+ const fieldErrors = {};
407
+ const formErrors = [];
408
+ for (const sub of error.issues) if (sub.path.length > 0) {
409
+ fieldErrors[sub.path[0]] = fieldErrors[sub.path[0]] || [];
410
+ fieldErrors[sub.path[0]].push(mapper(sub));
411
+ } else formErrors.push(mapper(sub));
412
+ return {
413
+ formErrors,
414
+ fieldErrors
415
+ };
416
+ }
417
+ function formatError$1(error, mapper = (issue$2) => issue$2.message) {
418
+ const fieldErrors = { _errors: [] };
419
+ const processError = (error$1) => {
420
+ for (const issue$2 of error$1.issues) if (issue$2.code === "invalid_union" && issue$2.errors.length) issue$2.errors.map((issues) => processError({ issues }));
421
+ else if (issue$2.code === "invalid_key") processError({ issues: issue$2.issues });
422
+ else if (issue$2.code === "invalid_element") processError({ issues: issue$2.issues });
423
+ else if (issue$2.path.length === 0) fieldErrors._errors.push(mapper(issue$2));
424
+ else {
425
+ let curr = fieldErrors;
426
+ let i = 0;
427
+ while (i < issue$2.path.length) {
428
+ const el = issue$2.path[i];
429
+ if (!(i === issue$2.path.length - 1)) curr[el] = curr[el] || { _errors: [] };
430
+ else {
431
+ curr[el] = curr[el] || { _errors: [] };
432
+ curr[el]._errors.push(mapper(issue$2));
433
+ }
434
+ curr = curr[el];
435
+ i++;
436
+ }
437
+ }
438
+ };
439
+ processError(error);
440
+ return fieldErrors;
441
+ }
442
+
443
+ //#endregion
444
+ //#region ../../node_modules/.bun/zod@4.3.6/node_modules/zod/v4/core/parse.js
445
+ const _parse$1 = (_Err) => (schema, value, _ctx, _params) => {
446
+ const ctx = _ctx ? Object.assign(_ctx, { async: false }) : { async: false };
447
+ const result = schema._zod.run({
448
+ value,
449
+ issues: []
450
+ }, ctx);
451
+ if (result instanceof Promise) throw new $ZodAsyncError$1();
452
+ if (result.issues.length) {
453
+ const e = new (_params?.Err ?? _Err)(result.issues.map((iss) => finalizeIssue$1(iss, ctx, config$1())));
454
+ captureStackTrace$1(e, _params?.callee);
455
+ throw e;
456
+ }
457
+ return result.value;
458
+ };
459
+ const parse$2 = /* @__PURE__ */ _parse$1($ZodRealError$1);
460
+ const _parseAsync$1 = (_Err) => async (schema, value, _ctx, params) => {
461
+ const ctx = _ctx ? Object.assign(_ctx, { async: true }) : { async: true };
462
+ let result = schema._zod.run({
463
+ value,
464
+ issues: []
465
+ }, ctx);
466
+ if (result instanceof Promise) result = await result;
467
+ if (result.issues.length) {
468
+ const e = new (params?.Err ?? _Err)(result.issues.map((iss) => finalizeIssue$1(iss, ctx, config$1())));
469
+ captureStackTrace$1(e, params?.callee);
470
+ throw e;
471
+ }
472
+ return result.value;
473
+ };
474
+ const parseAsync$2 = /* @__PURE__ */ _parseAsync$1($ZodRealError$1);
475
+ const _safeParse$1 = (_Err) => (schema, value, _ctx) => {
476
+ const ctx = _ctx ? {
477
+ ..._ctx,
478
+ async: false
479
+ } : { async: false };
480
+ const result = schema._zod.run({
481
+ value,
482
+ issues: []
483
+ }, ctx);
484
+ if (result instanceof Promise) throw new $ZodAsyncError$1();
485
+ return result.issues.length ? {
486
+ success: false,
487
+ error: new (_Err ?? $ZodError$1)(result.issues.map((iss) => finalizeIssue$1(iss, ctx, config$1())))
488
+ } : {
489
+ success: true,
490
+ data: result.value
491
+ };
492
+ };
493
+ const safeParse$3 = /* @__PURE__ */ _safeParse$1($ZodRealError$1);
494
+ const _safeParseAsync$1 = (_Err) => async (schema, value, _ctx) => {
495
+ const ctx = _ctx ? Object.assign(_ctx, { async: true }) : { async: true };
496
+ let result = schema._zod.run({
497
+ value,
498
+ issues: []
499
+ }, ctx);
500
+ if (result instanceof Promise) result = await result;
501
+ return result.issues.length ? {
502
+ success: false,
503
+ error: new _Err(result.issues.map((iss) => finalizeIssue$1(iss, ctx, config$1())))
504
+ } : {
505
+ success: true,
506
+ data: result.value
507
+ };
508
+ };
509
+ const safeParseAsync$3 = /* @__PURE__ */ _safeParseAsync$1($ZodRealError$1);
510
+ const _encode$1 = (_Err) => (schema, value, _ctx) => {
511
+ const ctx = _ctx ? Object.assign(_ctx, { direction: "backward" }) : { direction: "backward" };
512
+ return _parse$1(_Err)(schema, value, ctx);
513
+ };
514
+ const encode$2 = /* @__PURE__ */ _encode$1($ZodRealError$1);
515
+ const _decode$1 = (_Err) => (schema, value, _ctx) => {
516
+ return _parse$1(_Err)(schema, value, _ctx);
517
+ };
518
+ const decode$2 = /* @__PURE__ */ _decode$1($ZodRealError$1);
519
+ const _encodeAsync$1 = (_Err) => async (schema, value, _ctx) => {
520
+ const ctx = _ctx ? Object.assign(_ctx, { direction: "backward" }) : { direction: "backward" };
521
+ return _parseAsync$1(_Err)(schema, value, ctx);
522
+ };
523
+ const encodeAsync$2 = /* @__PURE__ */ _encodeAsync$1($ZodRealError$1);
524
+ const _decodeAsync$1 = (_Err) => async (schema, value, _ctx) => {
525
+ return _parseAsync$1(_Err)(schema, value, _ctx);
526
+ };
527
+ const decodeAsync$2 = /* @__PURE__ */ _decodeAsync$1($ZodRealError$1);
528
+ const _safeEncode$1 = (_Err) => (schema, value, _ctx) => {
529
+ const ctx = _ctx ? Object.assign(_ctx, { direction: "backward" }) : { direction: "backward" };
530
+ return _safeParse$1(_Err)(schema, value, ctx);
531
+ };
532
+ const safeEncode$2 = /* @__PURE__ */ _safeEncode$1($ZodRealError$1);
533
+ const _safeDecode$1 = (_Err) => (schema, value, _ctx) => {
534
+ return _safeParse$1(_Err)(schema, value, _ctx);
535
+ };
536
+ const safeDecode$2 = /* @__PURE__ */ _safeDecode$1($ZodRealError$1);
537
+ const _safeEncodeAsync$1 = (_Err) => async (schema, value, _ctx) => {
538
+ const ctx = _ctx ? Object.assign(_ctx, { direction: "backward" }) : { direction: "backward" };
539
+ return _safeParseAsync$1(_Err)(schema, value, ctx);
540
+ };
541
+ const safeEncodeAsync$2 = /* @__PURE__ */ _safeEncodeAsync$1($ZodRealError$1);
542
+ const _safeDecodeAsync$1 = (_Err) => async (schema, value, _ctx) => {
543
+ return _safeParseAsync$1(_Err)(schema, value, _ctx);
544
+ };
545
+ const safeDecodeAsync$2 = /* @__PURE__ */ _safeDecodeAsync$1($ZodRealError$1);
546
+
547
+ //#endregion
548
+ //#region ../../node_modules/.bun/zod@4.3.6/node_modules/zod/v4/core/regexes.js
549
+ const cuid$1 = /^[cC][^\s-]{8,}$/;
550
+ const cuid2$1 = /^[0-9a-z]+$/;
551
+ const ulid$1 = /^[0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{26}$/;
552
+ const xid$1 = /^[0-9a-vA-V]{20}$/;
553
+ const ksuid$1 = /^[A-Za-z0-9]{27}$/;
554
+ const nanoid$1 = /^[a-zA-Z0-9_-]{21}$/;
555
+ /** ISO 8601-1 duration regex. Does not support the 8601-2 extensions like negative durations or fractional/negative components. */
556
+ const duration$3 = /^P(?:(\d+W)|(?!.*W)(?=\d|T\d)(\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+([.,]\d+)?S)?)?)$/;
557
+ /** A regex for any UUID-like identifier: 8-4-4-4-12 hex pattern */
558
+ const guid$1 = /^([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})$/;
559
+ /** Returns a regex for validating an RFC 9562/4122 UUID.
560
+ *
561
+ * @param version Optionally specify a version 1-8. If no version is specified, all versions are supported. */
562
+ const uuid$1 = (version$2) => {
563
+ if (!version$2) 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)$/;
564
+ return /* @__PURE__ */ new RegExp(`^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-${version$2}[0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12})$`);
565
+ };
566
+ /** Practical email validation */
567
+ const email$1 = /^(?!\.)(?!.*\.\.)([A-Za-z0-9_'+\-\.]*)[A-Za-z0-9_+-]@([A-Za-z0-9][A-Za-z0-9\-]*\.)+[A-Za-z]{2,}$/;
568
+ const _emoji$3 = `^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$`;
569
+ function emoji$1() {
570
+ return new RegExp(_emoji$3, "u");
571
+ }
572
+ const ipv4$1 = /^(?:(?: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])$/;
573
+ const ipv6$1 = /^(([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}|:))$/;
574
+ const cidrv4$1 = /^((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])$/;
575
+ const cidrv6$1 = /^(([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])$/;
576
+ const base64$1 = /^$|^(?:[0-9a-zA-Z+/]{4})*(?:(?:[0-9a-zA-Z+/]{2}==)|(?:[0-9a-zA-Z+/]{3}=))?$/;
577
+ const base64url$1 = /^[A-Za-z0-9_-]*$/;
578
+ const e164$1 = /^\+[1-9]\d{6,14}$/;
579
+ const dateSource$1 = `(?:(?:\\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])))`;
580
+ const date$3 = /* @__PURE__ */ new RegExp(`^${dateSource$1}$`);
581
+ function timeSource$1(args) {
582
+ const hhmm = `(?:[01]\\d|2[0-3]):[0-5]\\d`;
583
+ 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+)?)?`;
584
+ }
585
+ function time$3(args) {
586
+ return /* @__PURE__ */ new RegExp(`^${timeSource$1(args)}$`);
587
+ }
588
+ function datetime$3(args) {
589
+ const time$4 = timeSource$1({ precision: args.precision });
590
+ const opts = ["Z"];
591
+ if (args.local) opts.push("");
592
+ if (args.offset) opts.push(`([+-](?:[01]\\d|2[0-3]):[0-5]\\d)`);
593
+ const timeRegex = `${time$4}(?:${opts.join("|")})`;
594
+ return /* @__PURE__ */ new RegExp(`^${dateSource$1}T(?:${timeRegex})$`);
595
+ }
596
+ const string$3 = (params) => {
597
+ const regex = params ? `[\\s\\S]{${params?.minimum ?? 0},${params?.maximum ?? ""}}` : `[\\s\\S]*`;
598
+ return /* @__PURE__ */ new RegExp(`^${regex}$`);
599
+ };
600
+ const integer$1 = /^-?\d+$/;
601
+ const number$3 = /^-?\d+(?:\.\d+)?$/;
602
+ const lowercase$1 = /^[^A-Z]*$/;
603
+ const uppercase$1 = /^[^a-z]*$/;
604
+
605
+ //#endregion
606
+ //#region ../../node_modules/.bun/zod@4.3.6/node_modules/zod/v4/core/checks.js
607
+ const $ZodCheck$1 = /* @__PURE__ */ $constructor$1("$ZodCheck", (inst, def) => {
608
+ var _a$2;
609
+ inst._zod ?? (inst._zod = {});
610
+ inst._zod.def = def;
611
+ (_a$2 = inst._zod).onattach ?? (_a$2.onattach = []);
612
+ });
613
+ const numericOriginMap$1 = {
614
+ number: "number",
615
+ bigint: "bigint",
616
+ object: "date"
617
+ };
618
+ const $ZodCheckLessThan$1 = /* @__PURE__ */ $constructor$1("$ZodCheckLessThan", (inst, def) => {
619
+ $ZodCheck$1.init(inst, def);
620
+ const origin = numericOriginMap$1[typeof def.value];
621
+ inst._zod.onattach.push((inst$1) => {
622
+ const bag = inst$1._zod.bag;
623
+ const curr = (def.inclusive ? bag.maximum : bag.exclusiveMaximum) ?? Number.POSITIVE_INFINITY;
624
+ if (def.value < curr) if (def.inclusive) bag.maximum = def.value;
625
+ else bag.exclusiveMaximum = def.value;
626
+ });
627
+ inst._zod.check = (payload) => {
628
+ if (def.inclusive ? payload.value <= def.value : payload.value < def.value) return;
629
+ payload.issues.push({
630
+ origin,
631
+ code: "too_big",
632
+ maximum: typeof def.value === "object" ? def.value.getTime() : def.value,
633
+ input: payload.value,
634
+ inclusive: def.inclusive,
635
+ inst,
636
+ continue: !def.abort
637
+ });
638
+ };
639
+ });
640
+ const $ZodCheckGreaterThan$1 = /* @__PURE__ */ $constructor$1("$ZodCheckGreaterThan", (inst, def) => {
641
+ $ZodCheck$1.init(inst, def);
642
+ const origin = numericOriginMap$1[typeof def.value];
643
+ inst._zod.onattach.push((inst$1) => {
644
+ const bag = inst$1._zod.bag;
645
+ const curr = (def.inclusive ? bag.minimum : bag.exclusiveMinimum) ?? Number.NEGATIVE_INFINITY;
646
+ if (def.value > curr) if (def.inclusive) bag.minimum = def.value;
647
+ else bag.exclusiveMinimum = def.value;
648
+ });
649
+ inst._zod.check = (payload) => {
650
+ if (def.inclusive ? payload.value >= def.value : payload.value > def.value) return;
651
+ payload.issues.push({
652
+ origin,
653
+ code: "too_small",
654
+ minimum: typeof def.value === "object" ? def.value.getTime() : def.value,
655
+ input: payload.value,
656
+ inclusive: def.inclusive,
657
+ inst,
658
+ continue: !def.abort
659
+ });
660
+ };
661
+ });
662
+ const $ZodCheckMultipleOf$1 = /* @__PURE__ */ $constructor$1("$ZodCheckMultipleOf", (inst, def) => {
663
+ $ZodCheck$1.init(inst, def);
664
+ inst._zod.onattach.push((inst$1) => {
665
+ var _a$2;
666
+ (_a$2 = inst$1._zod.bag).multipleOf ?? (_a$2.multipleOf = def.value);
667
+ });
668
+ inst._zod.check = (payload) => {
669
+ if (typeof payload.value !== typeof def.value) throw new Error("Cannot mix number and bigint in multiple_of check.");
670
+ if (typeof payload.value === "bigint" ? payload.value % def.value === BigInt(0) : floatSafeRemainder$1(payload.value, def.value) === 0) return;
671
+ payload.issues.push({
672
+ origin: typeof payload.value,
673
+ code: "not_multiple_of",
674
+ divisor: def.value,
675
+ input: payload.value,
676
+ inst,
677
+ continue: !def.abort
678
+ });
679
+ };
680
+ });
681
+ const $ZodCheckNumberFormat$1 = /* @__PURE__ */ $constructor$1("$ZodCheckNumberFormat", (inst, def) => {
682
+ $ZodCheck$1.init(inst, def);
683
+ def.format = def.format || "float64";
684
+ const isInt = def.format?.includes("int");
685
+ const origin = isInt ? "int" : "number";
686
+ const [minimum, maximum] = NUMBER_FORMAT_RANGES$1[def.format];
687
+ inst._zod.onattach.push((inst$1) => {
688
+ const bag = inst$1._zod.bag;
689
+ bag.format = def.format;
690
+ bag.minimum = minimum;
691
+ bag.maximum = maximum;
692
+ if (isInt) bag.pattern = integer$1;
693
+ });
694
+ inst._zod.check = (payload) => {
695
+ const input = payload.value;
696
+ if (isInt) {
697
+ if (!Number.isInteger(input)) {
698
+ payload.issues.push({
699
+ expected: origin,
700
+ format: def.format,
701
+ code: "invalid_type",
702
+ continue: false,
703
+ input,
704
+ inst
705
+ });
706
+ return;
707
+ }
708
+ if (!Number.isSafeInteger(input)) {
709
+ if (input > 0) payload.issues.push({
710
+ input,
711
+ code: "too_big",
712
+ maximum: Number.MAX_SAFE_INTEGER,
713
+ note: "Integers must be within the safe integer range.",
714
+ inst,
715
+ origin,
716
+ inclusive: true,
717
+ continue: !def.abort
718
+ });
719
+ else payload.issues.push({
720
+ input,
721
+ code: "too_small",
722
+ minimum: Number.MIN_SAFE_INTEGER,
723
+ note: "Integers must be within the safe integer range.",
724
+ inst,
725
+ origin,
726
+ inclusive: true,
727
+ continue: !def.abort
728
+ });
729
+ return;
730
+ }
731
+ }
732
+ if (input < minimum) payload.issues.push({
733
+ origin: "number",
734
+ input,
735
+ code: "too_small",
736
+ minimum,
737
+ inclusive: true,
738
+ inst,
739
+ continue: !def.abort
740
+ });
741
+ if (input > maximum) payload.issues.push({
742
+ origin: "number",
743
+ input,
744
+ code: "too_big",
745
+ maximum,
746
+ inclusive: true,
747
+ inst,
748
+ continue: !def.abort
749
+ });
750
+ };
751
+ });
752
+ const $ZodCheckMaxLength$1 = /* @__PURE__ */ $constructor$1("$ZodCheckMaxLength", (inst, def) => {
753
+ var _a$2;
754
+ $ZodCheck$1.init(inst, def);
755
+ (_a$2 = inst._zod.def).when ?? (_a$2.when = (payload) => {
756
+ const val = payload.value;
757
+ return !nullish$1(val) && val.length !== void 0;
758
+ });
759
+ inst._zod.onattach.push((inst$1) => {
760
+ const curr = inst$1._zod.bag.maximum ?? Number.POSITIVE_INFINITY;
761
+ if (def.maximum < curr) inst$1._zod.bag.maximum = def.maximum;
762
+ });
763
+ inst._zod.check = (payload) => {
764
+ const input = payload.value;
765
+ if (input.length <= def.maximum) return;
766
+ const origin = getLengthableOrigin$1(input);
767
+ payload.issues.push({
768
+ origin,
769
+ code: "too_big",
770
+ maximum: def.maximum,
771
+ inclusive: true,
772
+ input,
773
+ inst,
774
+ continue: !def.abort
775
+ });
776
+ };
777
+ });
778
+ const $ZodCheckMinLength$1 = /* @__PURE__ */ $constructor$1("$ZodCheckMinLength", (inst, def) => {
779
+ var _a$2;
780
+ $ZodCheck$1.init(inst, def);
781
+ (_a$2 = inst._zod.def).when ?? (_a$2.when = (payload) => {
782
+ const val = payload.value;
783
+ return !nullish$1(val) && val.length !== void 0;
784
+ });
785
+ inst._zod.onattach.push((inst$1) => {
786
+ const curr = inst$1._zod.bag.minimum ?? Number.NEGATIVE_INFINITY;
787
+ if (def.minimum > curr) inst$1._zod.bag.minimum = def.minimum;
788
+ });
789
+ inst._zod.check = (payload) => {
790
+ const input = payload.value;
791
+ if (input.length >= def.minimum) return;
792
+ const origin = getLengthableOrigin$1(input);
793
+ payload.issues.push({
794
+ origin,
795
+ code: "too_small",
796
+ minimum: def.minimum,
797
+ inclusive: true,
798
+ input,
799
+ inst,
800
+ continue: !def.abort
801
+ });
802
+ };
803
+ });
804
+ const $ZodCheckLengthEquals$1 = /* @__PURE__ */ $constructor$1("$ZodCheckLengthEquals", (inst, def) => {
805
+ var _a$2;
806
+ $ZodCheck$1.init(inst, def);
807
+ (_a$2 = inst._zod.def).when ?? (_a$2.when = (payload) => {
808
+ const val = payload.value;
809
+ return !nullish$1(val) && val.length !== void 0;
810
+ });
811
+ inst._zod.onattach.push((inst$1) => {
812
+ const bag = inst$1._zod.bag;
813
+ bag.minimum = def.length;
814
+ bag.maximum = def.length;
815
+ bag.length = def.length;
816
+ });
817
+ inst._zod.check = (payload) => {
818
+ const input = payload.value;
819
+ const length = input.length;
820
+ if (length === def.length) return;
821
+ const origin = getLengthableOrigin$1(input);
822
+ const tooBig = length > def.length;
823
+ payload.issues.push({
824
+ origin,
825
+ ...tooBig ? {
826
+ code: "too_big",
827
+ maximum: def.length
828
+ } : {
829
+ code: "too_small",
830
+ minimum: def.length
831
+ },
832
+ inclusive: true,
833
+ exact: true,
834
+ input: payload.value,
835
+ inst,
836
+ continue: !def.abort
837
+ });
838
+ };
839
+ });
840
+ const $ZodCheckStringFormat$1 = /* @__PURE__ */ $constructor$1("$ZodCheckStringFormat", (inst, def) => {
841
+ var _a$2, _b;
842
+ $ZodCheck$1.init(inst, def);
843
+ inst._zod.onattach.push((inst$1) => {
844
+ const bag = inst$1._zod.bag;
845
+ bag.format = def.format;
846
+ if (def.pattern) {
847
+ bag.patterns ?? (bag.patterns = /* @__PURE__ */ new Set());
848
+ bag.patterns.add(def.pattern);
849
+ }
850
+ });
851
+ if (def.pattern) (_a$2 = inst._zod).check ?? (_a$2.check = (payload) => {
852
+ def.pattern.lastIndex = 0;
853
+ if (def.pattern.test(payload.value)) return;
854
+ payload.issues.push({
855
+ origin: "string",
856
+ code: "invalid_format",
857
+ format: def.format,
858
+ input: payload.value,
859
+ ...def.pattern ? { pattern: def.pattern.toString() } : {},
860
+ inst,
861
+ continue: !def.abort
862
+ });
863
+ });
864
+ else (_b = inst._zod).check ?? (_b.check = () => {});
865
+ });
866
+ const $ZodCheckRegex$1 = /* @__PURE__ */ $constructor$1("$ZodCheckRegex", (inst, def) => {
867
+ $ZodCheckStringFormat$1.init(inst, def);
868
+ inst._zod.check = (payload) => {
869
+ def.pattern.lastIndex = 0;
870
+ if (def.pattern.test(payload.value)) return;
871
+ payload.issues.push({
872
+ origin: "string",
873
+ code: "invalid_format",
874
+ format: "regex",
875
+ input: payload.value,
876
+ pattern: def.pattern.toString(),
877
+ inst,
878
+ continue: !def.abort
879
+ });
880
+ };
881
+ });
882
+ const $ZodCheckLowerCase$1 = /* @__PURE__ */ $constructor$1("$ZodCheckLowerCase", (inst, def) => {
883
+ def.pattern ?? (def.pattern = lowercase$1);
884
+ $ZodCheckStringFormat$1.init(inst, def);
885
+ });
886
+ const $ZodCheckUpperCase$1 = /* @__PURE__ */ $constructor$1("$ZodCheckUpperCase", (inst, def) => {
887
+ def.pattern ?? (def.pattern = uppercase$1);
888
+ $ZodCheckStringFormat$1.init(inst, def);
889
+ });
890
+ const $ZodCheckIncludes$1 = /* @__PURE__ */ $constructor$1("$ZodCheckIncludes", (inst, def) => {
891
+ $ZodCheck$1.init(inst, def);
892
+ const escapedRegex = escapeRegex$1(def.includes);
893
+ const pattern = new RegExp(typeof def.position === "number" ? `^.{${def.position}}${escapedRegex}` : escapedRegex);
894
+ def.pattern = pattern;
895
+ inst._zod.onattach.push((inst$1) => {
896
+ const bag = inst$1._zod.bag;
897
+ bag.patterns ?? (bag.patterns = /* @__PURE__ */ new Set());
898
+ bag.patterns.add(pattern);
899
+ });
900
+ inst._zod.check = (payload) => {
901
+ if (payload.value.includes(def.includes, def.position)) return;
902
+ payload.issues.push({
903
+ origin: "string",
904
+ code: "invalid_format",
905
+ format: "includes",
906
+ includes: def.includes,
907
+ input: payload.value,
908
+ inst,
909
+ continue: !def.abort
910
+ });
911
+ };
912
+ });
913
+ const $ZodCheckStartsWith$1 = /* @__PURE__ */ $constructor$1("$ZodCheckStartsWith", (inst, def) => {
914
+ $ZodCheck$1.init(inst, def);
915
+ const pattern = /* @__PURE__ */ new RegExp(`^${escapeRegex$1(def.prefix)}.*`);
916
+ def.pattern ?? (def.pattern = pattern);
917
+ inst._zod.onattach.push((inst$1) => {
918
+ const bag = inst$1._zod.bag;
919
+ bag.patterns ?? (bag.patterns = /* @__PURE__ */ new Set());
920
+ bag.patterns.add(pattern);
921
+ });
922
+ inst._zod.check = (payload) => {
923
+ if (payload.value.startsWith(def.prefix)) return;
924
+ payload.issues.push({
925
+ origin: "string",
926
+ code: "invalid_format",
927
+ format: "starts_with",
928
+ prefix: def.prefix,
929
+ input: payload.value,
930
+ inst,
931
+ continue: !def.abort
932
+ });
933
+ };
934
+ });
935
+ const $ZodCheckEndsWith$1 = /* @__PURE__ */ $constructor$1("$ZodCheckEndsWith", (inst, def) => {
936
+ $ZodCheck$1.init(inst, def);
937
+ const pattern = /* @__PURE__ */ new RegExp(`.*${escapeRegex$1(def.suffix)}$`);
938
+ def.pattern ?? (def.pattern = pattern);
939
+ inst._zod.onattach.push((inst$1) => {
940
+ const bag = inst$1._zod.bag;
941
+ bag.patterns ?? (bag.patterns = /* @__PURE__ */ new Set());
942
+ bag.patterns.add(pattern);
943
+ });
944
+ inst._zod.check = (payload) => {
945
+ if (payload.value.endsWith(def.suffix)) return;
946
+ payload.issues.push({
947
+ origin: "string",
948
+ code: "invalid_format",
949
+ format: "ends_with",
950
+ suffix: def.suffix,
951
+ input: payload.value,
952
+ inst,
953
+ continue: !def.abort
954
+ });
955
+ };
956
+ });
957
+ const $ZodCheckOverwrite$1 = /* @__PURE__ */ $constructor$1("$ZodCheckOverwrite", (inst, def) => {
958
+ $ZodCheck$1.init(inst, def);
959
+ inst._zod.check = (payload) => {
960
+ payload.value = def.tx(payload.value);
961
+ };
962
+ });
963
+
964
+ //#endregion
965
+ //#region ../../node_modules/.bun/zod@4.3.6/node_modules/zod/v4/core/doc.js
966
+ var Doc$1 = class {
967
+ constructor(args = []) {
968
+ this.content = [];
969
+ this.indent = 0;
970
+ if (this) this.args = args;
971
+ }
972
+ indented(fn) {
973
+ this.indent += 1;
974
+ fn(this);
975
+ this.indent -= 1;
976
+ }
977
+ write(arg) {
978
+ if (typeof arg === "function") {
979
+ arg(this, { execution: "sync" });
980
+ arg(this, { execution: "async" });
981
+ return;
982
+ }
983
+ const lines = arg.split("\n").filter((x) => x);
984
+ const minIndent = Math.min(...lines.map((x) => x.length - x.trimStart().length));
985
+ const dedented = lines.map((x) => x.slice(minIndent)).map((x) => " ".repeat(this.indent * 2) + x);
986
+ for (const line of dedented) this.content.push(line);
987
+ }
988
+ compile() {
989
+ const F = Function;
990
+ const args = this?.args;
991
+ const lines = [...(this?.content ?? [``]).map((x) => ` ${x}`)];
992
+ return new F(...args, lines.join("\n"));
993
+ }
994
+ };
995
+
996
+ //#endregion
997
+ //#region ../../node_modules/.bun/zod@4.3.6/node_modules/zod/v4/core/versions.js
998
+ const version$1 = {
999
+ major: 4,
1000
+ minor: 3,
1001
+ patch: 6
1002
+ };
1003
+
1004
+ //#endregion
1005
+ //#region ../../node_modules/.bun/zod@4.3.6/node_modules/zod/v4/core/schemas.js
1006
+ const $ZodType$1 = /* @__PURE__ */ $constructor$1("$ZodType", (inst, def) => {
1007
+ var _a$2;
1008
+ inst ?? (inst = {});
1009
+ inst._zod.def = def;
1010
+ inst._zod.bag = inst._zod.bag || {};
1011
+ inst._zod.version = version$1;
1012
+ const checks = [...inst._zod.def.checks ?? []];
1013
+ if (inst._zod.traits.has("$ZodCheck")) checks.unshift(inst);
1014
+ for (const ch of checks) for (const fn of ch._zod.onattach) fn(inst);
1015
+ if (checks.length === 0) {
1016
+ (_a$2 = inst._zod).deferred ?? (_a$2.deferred = []);
1017
+ inst._zod.deferred?.push(() => {
1018
+ inst._zod.run = inst._zod.parse;
1019
+ });
1020
+ } else {
1021
+ const runChecks = (payload, checks$1, ctx) => {
1022
+ let isAborted = aborted$1(payload);
1023
+ let asyncResult;
1024
+ for (const ch of checks$1) {
1025
+ if (ch._zod.def.when) {
1026
+ if (!ch._zod.def.when(payload)) continue;
1027
+ } else if (isAborted) continue;
1028
+ const currLen = payload.issues.length;
1029
+ const _ = ch._zod.check(payload);
1030
+ if (_ instanceof Promise && ctx?.async === false) throw new $ZodAsyncError$1();
1031
+ if (asyncResult || _ instanceof Promise) asyncResult = (asyncResult ?? Promise.resolve()).then(async () => {
1032
+ await _;
1033
+ if (payload.issues.length === currLen) return;
1034
+ if (!isAborted) isAborted = aborted$1(payload, currLen);
1035
+ });
1036
+ else {
1037
+ if (payload.issues.length === currLen) continue;
1038
+ if (!isAborted) isAborted = aborted$1(payload, currLen);
1039
+ }
1040
+ }
1041
+ if (asyncResult) return asyncResult.then(() => {
1042
+ return payload;
1043
+ });
1044
+ return payload;
1045
+ };
1046
+ const handleCanaryResult = (canary, payload, ctx) => {
1047
+ if (aborted$1(canary)) {
1048
+ canary.aborted = true;
1049
+ return canary;
1050
+ }
1051
+ const checkResult = runChecks(payload, checks, ctx);
1052
+ if (checkResult instanceof Promise) {
1053
+ if (ctx.async === false) throw new $ZodAsyncError$1();
1054
+ return checkResult.then((checkResult$1) => inst._zod.parse(checkResult$1, ctx));
1055
+ }
1056
+ return inst._zod.parse(checkResult, ctx);
1057
+ };
1058
+ inst._zod.run = (payload, ctx) => {
1059
+ if (ctx.skipChecks) return inst._zod.parse(payload, ctx);
1060
+ if (ctx.direction === "backward") {
1061
+ const canary = inst._zod.parse({
1062
+ value: payload.value,
1063
+ issues: []
1064
+ }, {
1065
+ ...ctx,
1066
+ skipChecks: true
1067
+ });
1068
+ if (canary instanceof Promise) return canary.then((canary$1) => {
1069
+ return handleCanaryResult(canary$1, payload, ctx);
1070
+ });
1071
+ return handleCanaryResult(canary, payload, ctx);
1072
+ }
1073
+ const result = inst._zod.parse(payload, ctx);
1074
+ if (result instanceof Promise) {
1075
+ if (ctx.async === false) throw new $ZodAsyncError$1();
1076
+ return result.then((result$1) => runChecks(result$1, checks, ctx));
1077
+ }
1078
+ return runChecks(result, checks, ctx);
1079
+ };
1080
+ }
1081
+ defineLazy$1(inst, "~standard", () => ({
1082
+ validate: (value) => {
1083
+ try {
1084
+ const r = safeParse$3(inst, value);
1085
+ return r.success ? { value: r.data } : { issues: r.error?.issues };
1086
+ } catch (_) {
1087
+ return safeParseAsync$3(inst, value).then((r) => r.success ? { value: r.data } : { issues: r.error?.issues });
1088
+ }
1089
+ },
1090
+ vendor: "zod",
1091
+ version: 1
1092
+ }));
1093
+ });
1094
+ const $ZodString$1 = /* @__PURE__ */ $constructor$1("$ZodString", (inst, def) => {
1095
+ $ZodType$1.init(inst, def);
1096
+ inst._zod.pattern = [...inst?._zod.bag?.patterns ?? []].pop() ?? string$3(inst._zod.bag);
1097
+ inst._zod.parse = (payload, _) => {
1098
+ if (def.coerce) try {
1099
+ payload.value = String(payload.value);
1100
+ } catch (_$1) {}
1101
+ if (typeof payload.value === "string") return payload;
1102
+ payload.issues.push({
1103
+ expected: "string",
1104
+ code: "invalid_type",
1105
+ input: payload.value,
1106
+ inst
1107
+ });
1108
+ return payload;
1109
+ };
1110
+ });
1111
+ const $ZodStringFormat$1 = /* @__PURE__ */ $constructor$1("$ZodStringFormat", (inst, def) => {
1112
+ $ZodCheckStringFormat$1.init(inst, def);
1113
+ $ZodString$1.init(inst, def);
1114
+ });
1115
+ const $ZodGUID$1 = /* @__PURE__ */ $constructor$1("$ZodGUID", (inst, def) => {
1116
+ def.pattern ?? (def.pattern = guid$1);
1117
+ $ZodStringFormat$1.init(inst, def);
1118
+ });
1119
+ const $ZodUUID$1 = /* @__PURE__ */ $constructor$1("$ZodUUID", (inst, def) => {
1120
+ if (def.version) {
1121
+ const v = {
1122
+ v1: 1,
1123
+ v2: 2,
1124
+ v3: 3,
1125
+ v4: 4,
1126
+ v5: 5,
1127
+ v6: 6,
1128
+ v7: 7,
1129
+ v8: 8
1130
+ }[def.version];
1131
+ if (v === void 0) throw new Error(`Invalid UUID version: "${def.version}"`);
1132
+ def.pattern ?? (def.pattern = uuid$1(v));
1133
+ } else def.pattern ?? (def.pattern = uuid$1());
1134
+ $ZodStringFormat$1.init(inst, def);
1135
+ });
1136
+ const $ZodEmail$1 = /* @__PURE__ */ $constructor$1("$ZodEmail", (inst, def) => {
1137
+ def.pattern ?? (def.pattern = email$1);
1138
+ $ZodStringFormat$1.init(inst, def);
1139
+ });
1140
+ const $ZodURL$1 = /* @__PURE__ */ $constructor$1("$ZodURL", (inst, def) => {
1141
+ $ZodStringFormat$1.init(inst, def);
1142
+ inst._zod.check = (payload) => {
1143
+ try {
1144
+ const trimmed = payload.value.trim();
1145
+ const url = new URL(trimmed);
1146
+ if (def.hostname) {
1147
+ def.hostname.lastIndex = 0;
1148
+ if (!def.hostname.test(url.hostname)) payload.issues.push({
1149
+ code: "invalid_format",
1150
+ format: "url",
1151
+ note: "Invalid hostname",
1152
+ pattern: def.hostname.source,
1153
+ input: payload.value,
1154
+ inst,
1155
+ continue: !def.abort
1156
+ });
1157
+ }
1158
+ if (def.protocol) {
1159
+ def.protocol.lastIndex = 0;
1160
+ if (!def.protocol.test(url.protocol.endsWith(":") ? url.protocol.slice(0, -1) : url.protocol)) payload.issues.push({
1161
+ code: "invalid_format",
1162
+ format: "url",
1163
+ note: "Invalid protocol",
1164
+ pattern: def.protocol.source,
1165
+ input: payload.value,
1166
+ inst,
1167
+ continue: !def.abort
1168
+ });
1169
+ }
1170
+ if (def.normalize) payload.value = url.href;
1171
+ else payload.value = trimmed;
1172
+ return;
1173
+ } catch (_) {
1174
+ payload.issues.push({
1175
+ code: "invalid_format",
1176
+ format: "url",
1177
+ input: payload.value,
1178
+ inst,
1179
+ continue: !def.abort
1180
+ });
1181
+ }
1182
+ };
1183
+ });
1184
+ const $ZodEmoji$1 = /* @__PURE__ */ $constructor$1("$ZodEmoji", (inst, def) => {
1185
+ def.pattern ?? (def.pattern = emoji$1());
1186
+ $ZodStringFormat$1.init(inst, def);
1187
+ });
1188
+ const $ZodNanoID$1 = /* @__PURE__ */ $constructor$1("$ZodNanoID", (inst, def) => {
1189
+ def.pattern ?? (def.pattern = nanoid$1);
1190
+ $ZodStringFormat$1.init(inst, def);
1191
+ });
1192
+ const $ZodCUID$1 = /* @__PURE__ */ $constructor$1("$ZodCUID", (inst, def) => {
1193
+ def.pattern ?? (def.pattern = cuid$1);
1194
+ $ZodStringFormat$1.init(inst, def);
1195
+ });
1196
+ const $ZodCUID2$1 = /* @__PURE__ */ $constructor$1("$ZodCUID2", (inst, def) => {
1197
+ def.pattern ?? (def.pattern = cuid2$1);
1198
+ $ZodStringFormat$1.init(inst, def);
1199
+ });
1200
+ const $ZodULID$1 = /* @__PURE__ */ $constructor$1("$ZodULID", (inst, def) => {
1201
+ def.pattern ?? (def.pattern = ulid$1);
1202
+ $ZodStringFormat$1.init(inst, def);
1203
+ });
1204
+ const $ZodXID$1 = /* @__PURE__ */ $constructor$1("$ZodXID", (inst, def) => {
1205
+ def.pattern ?? (def.pattern = xid$1);
1206
+ $ZodStringFormat$1.init(inst, def);
1207
+ });
1208
+ const $ZodKSUID$1 = /* @__PURE__ */ $constructor$1("$ZodKSUID", (inst, def) => {
1209
+ def.pattern ?? (def.pattern = ksuid$1);
1210
+ $ZodStringFormat$1.init(inst, def);
1211
+ });
1212
+ const $ZodISODateTime$1 = /* @__PURE__ */ $constructor$1("$ZodISODateTime", (inst, def) => {
1213
+ def.pattern ?? (def.pattern = datetime$3(def));
1214
+ $ZodStringFormat$1.init(inst, def);
1215
+ });
1216
+ const $ZodISODate$1 = /* @__PURE__ */ $constructor$1("$ZodISODate", (inst, def) => {
1217
+ def.pattern ?? (def.pattern = date$3);
1218
+ $ZodStringFormat$1.init(inst, def);
1219
+ });
1220
+ const $ZodISOTime$1 = /* @__PURE__ */ $constructor$1("$ZodISOTime", (inst, def) => {
1221
+ def.pattern ?? (def.pattern = time$3(def));
1222
+ $ZodStringFormat$1.init(inst, def);
1223
+ });
1224
+ const $ZodISODuration$1 = /* @__PURE__ */ $constructor$1("$ZodISODuration", (inst, def) => {
1225
+ def.pattern ?? (def.pattern = duration$3);
1226
+ $ZodStringFormat$1.init(inst, def);
1227
+ });
1228
+ const $ZodIPv4$1 = /* @__PURE__ */ $constructor$1("$ZodIPv4", (inst, def) => {
1229
+ def.pattern ?? (def.pattern = ipv4$1);
1230
+ $ZodStringFormat$1.init(inst, def);
1231
+ inst._zod.bag.format = `ipv4`;
1232
+ });
1233
+ const $ZodIPv6$1 = /* @__PURE__ */ $constructor$1("$ZodIPv6", (inst, def) => {
1234
+ def.pattern ?? (def.pattern = ipv6$1);
1235
+ $ZodStringFormat$1.init(inst, def);
1236
+ inst._zod.bag.format = `ipv6`;
1237
+ inst._zod.check = (payload) => {
1238
+ try {
1239
+ new URL(`http://[${payload.value}]`);
1240
+ } catch {
1241
+ payload.issues.push({
1242
+ code: "invalid_format",
1243
+ format: "ipv6",
1244
+ input: payload.value,
1245
+ inst,
1246
+ continue: !def.abort
1247
+ });
1248
+ }
1249
+ };
1250
+ });
1251
+ const $ZodCIDRv4$1 = /* @__PURE__ */ $constructor$1("$ZodCIDRv4", (inst, def) => {
1252
+ def.pattern ?? (def.pattern = cidrv4$1);
1253
+ $ZodStringFormat$1.init(inst, def);
1254
+ });
1255
+ const $ZodCIDRv6$1 = /* @__PURE__ */ $constructor$1("$ZodCIDRv6", (inst, def) => {
1256
+ def.pattern ?? (def.pattern = cidrv6$1);
1257
+ $ZodStringFormat$1.init(inst, def);
1258
+ inst._zod.check = (payload) => {
1259
+ const parts = payload.value.split("/");
1260
+ try {
1261
+ if (parts.length !== 2) throw new Error();
1262
+ const [address, prefix] = parts;
1263
+ if (!prefix) throw new Error();
1264
+ const prefixNum = Number(prefix);
1265
+ if (`${prefixNum}` !== prefix) throw new Error();
1266
+ if (prefixNum < 0 || prefixNum > 128) throw new Error();
1267
+ new URL(`http://[${address}]`);
1268
+ } catch {
1269
+ payload.issues.push({
1270
+ code: "invalid_format",
1271
+ format: "cidrv6",
1272
+ input: payload.value,
1273
+ inst,
1274
+ continue: !def.abort
1275
+ });
1276
+ }
1277
+ };
1278
+ });
1279
+ function isValidBase64$1(data) {
1280
+ if (data === "") return true;
1281
+ if (data.length % 4 !== 0) return false;
1282
+ try {
1283
+ atob(data);
1284
+ return true;
1285
+ } catch {
1286
+ return false;
1287
+ }
1288
+ }
1289
+ const $ZodBase64$1 = /* @__PURE__ */ $constructor$1("$ZodBase64", (inst, def) => {
1290
+ def.pattern ?? (def.pattern = base64$1);
1291
+ $ZodStringFormat$1.init(inst, def);
1292
+ inst._zod.bag.contentEncoding = "base64";
1293
+ inst._zod.check = (payload) => {
1294
+ if (isValidBase64$1(payload.value)) return;
1295
+ payload.issues.push({
1296
+ code: "invalid_format",
1297
+ format: "base64",
1298
+ input: payload.value,
1299
+ inst,
1300
+ continue: !def.abort
1301
+ });
1302
+ };
1303
+ });
1304
+ function isValidBase64URL$1(data) {
1305
+ if (!base64url$1.test(data)) return false;
1306
+ const base64$2 = data.replace(/[-_]/g, (c) => c === "-" ? "+" : "/");
1307
+ return isValidBase64$1(base64$2.padEnd(Math.ceil(base64$2.length / 4) * 4, "="));
1308
+ }
1309
+ const $ZodBase64URL$1 = /* @__PURE__ */ $constructor$1("$ZodBase64URL", (inst, def) => {
1310
+ def.pattern ?? (def.pattern = base64url$1);
1311
+ $ZodStringFormat$1.init(inst, def);
1312
+ inst._zod.bag.contentEncoding = "base64url";
1313
+ inst._zod.check = (payload) => {
1314
+ if (isValidBase64URL$1(payload.value)) return;
1315
+ payload.issues.push({
1316
+ code: "invalid_format",
1317
+ format: "base64url",
1318
+ input: payload.value,
1319
+ inst,
1320
+ continue: !def.abort
1321
+ });
1322
+ };
1323
+ });
1324
+ const $ZodE164$1 = /* @__PURE__ */ $constructor$1("$ZodE164", (inst, def) => {
1325
+ def.pattern ?? (def.pattern = e164$1);
1326
+ $ZodStringFormat$1.init(inst, def);
1327
+ });
1328
+ function isValidJWT$1(token, algorithm = null) {
1329
+ try {
1330
+ const tokensParts = token.split(".");
1331
+ if (tokensParts.length !== 3) return false;
1332
+ const [header] = tokensParts;
1333
+ if (!header) return false;
1334
+ const parsedHeader = JSON.parse(atob(header));
1335
+ if ("typ" in parsedHeader && parsedHeader?.typ !== "JWT") return false;
1336
+ if (!parsedHeader.alg) return false;
1337
+ if (algorithm && (!("alg" in parsedHeader) || parsedHeader.alg !== algorithm)) return false;
1338
+ return true;
1339
+ } catch {
1340
+ return false;
1341
+ }
1342
+ }
1343
+ const $ZodJWT$1 = /* @__PURE__ */ $constructor$1("$ZodJWT", (inst, def) => {
1344
+ $ZodStringFormat$1.init(inst, def);
1345
+ inst._zod.check = (payload) => {
1346
+ if (isValidJWT$1(payload.value, def.alg)) return;
1347
+ payload.issues.push({
1348
+ code: "invalid_format",
1349
+ format: "jwt",
1350
+ input: payload.value,
1351
+ inst,
1352
+ continue: !def.abort
1353
+ });
1354
+ };
1355
+ });
1356
+ const $ZodNumber$1 = /* @__PURE__ */ $constructor$1("$ZodNumber", (inst, def) => {
1357
+ $ZodType$1.init(inst, def);
1358
+ inst._zod.pattern = inst._zod.bag.pattern ?? number$3;
1359
+ inst._zod.parse = (payload, _ctx) => {
1360
+ if (def.coerce) try {
1361
+ payload.value = Number(payload.value);
1362
+ } catch (_) {}
1363
+ const input = payload.value;
1364
+ if (typeof input === "number" && !Number.isNaN(input) && Number.isFinite(input)) return payload;
1365
+ const received = typeof input === "number" ? Number.isNaN(input) ? "NaN" : !Number.isFinite(input) ? "Infinity" : void 0 : void 0;
1366
+ payload.issues.push({
1367
+ expected: "number",
1368
+ code: "invalid_type",
1369
+ input,
1370
+ inst,
1371
+ ...received ? { received } : {}
1372
+ });
1373
+ return payload;
1374
+ };
1375
+ });
1376
+ const $ZodNumberFormat$1 = /* @__PURE__ */ $constructor$1("$ZodNumberFormat", (inst, def) => {
1377
+ $ZodCheckNumberFormat$1.init(inst, def);
1378
+ $ZodNumber$1.init(inst, def);
1379
+ });
1380
+ const $ZodUnknown$1 = /* @__PURE__ */ $constructor$1("$ZodUnknown", (inst, def) => {
1381
+ $ZodType$1.init(inst, def);
1382
+ inst._zod.parse = (payload) => payload;
1383
+ });
1384
+ const $ZodNever$1 = /* @__PURE__ */ $constructor$1("$ZodNever", (inst, def) => {
1385
+ $ZodType$1.init(inst, def);
1386
+ inst._zod.parse = (payload, _ctx) => {
1387
+ payload.issues.push({
1388
+ expected: "never",
1389
+ code: "invalid_type",
1390
+ input: payload.value,
1391
+ inst
1392
+ });
1393
+ return payload;
1394
+ };
1395
+ });
1396
+ function handleArrayResult$1(result, final, index) {
1397
+ if (result.issues.length) final.issues.push(...prefixIssues$1(index, result.issues));
1398
+ final.value[index] = result.value;
1399
+ }
1400
+ const $ZodArray$1 = /* @__PURE__ */ $constructor$1("$ZodArray", (inst, def) => {
1401
+ $ZodType$1.init(inst, def);
1402
+ inst._zod.parse = (payload, ctx) => {
1403
+ const input = payload.value;
1404
+ if (!Array.isArray(input)) {
1405
+ payload.issues.push({
1406
+ expected: "array",
1407
+ code: "invalid_type",
1408
+ input,
1409
+ inst
1410
+ });
1411
+ return payload;
1412
+ }
1413
+ payload.value = Array(input.length);
1414
+ const proms = [];
1415
+ for (let i = 0; i < input.length; i++) {
1416
+ const item = input[i];
1417
+ const result = def.element._zod.run({
1418
+ value: item,
1419
+ issues: []
1420
+ }, ctx);
1421
+ if (result instanceof Promise) proms.push(result.then((result$1) => handleArrayResult$1(result$1, payload, i)));
1422
+ else handleArrayResult$1(result, payload, i);
1423
+ }
1424
+ if (proms.length) return Promise.all(proms).then(() => payload);
1425
+ return payload;
1426
+ };
1427
+ });
1428
+ function handlePropertyResult$1(result, final, key, input, isOptionalOut) {
1429
+ if (result.issues.length) {
1430
+ if (isOptionalOut && !(key in input)) return;
1431
+ final.issues.push(...prefixIssues$1(key, result.issues));
1432
+ }
1433
+ if (result.value === void 0) {
1434
+ if (key in input) final.value[key] = void 0;
1435
+ } else final.value[key] = result.value;
1436
+ }
1437
+ function normalizeDef$1(def) {
1438
+ const keys = Object.keys(def.shape);
1439
+ 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`);
1440
+ const okeys = optionalKeys$1(def.shape);
1441
+ return {
1442
+ ...def,
1443
+ keys,
1444
+ keySet: new Set(keys),
1445
+ numKeys: keys.length,
1446
+ optionalKeys: new Set(okeys)
1447
+ };
1448
+ }
1449
+ function handleCatchall$1(proms, input, payload, ctx, def, inst) {
1450
+ const unrecognized = [];
1451
+ const keySet = def.keySet;
1452
+ const _catchall = def.catchall._zod;
1453
+ const t = _catchall.def.type;
1454
+ const isOptionalOut = _catchall.optout === "optional";
1455
+ for (const key in input) {
1456
+ if (keySet.has(key)) continue;
1457
+ if (t === "never") {
1458
+ unrecognized.push(key);
1459
+ continue;
1460
+ }
1461
+ const r = _catchall.run({
1462
+ value: input[key],
1463
+ issues: []
1464
+ }, ctx);
1465
+ if (r instanceof Promise) proms.push(r.then((r$1) => handlePropertyResult$1(r$1, payload, key, input, isOptionalOut)));
1466
+ else handlePropertyResult$1(r, payload, key, input, isOptionalOut);
1467
+ }
1468
+ if (unrecognized.length) payload.issues.push({
1469
+ code: "unrecognized_keys",
1470
+ keys: unrecognized,
1471
+ input,
1472
+ inst
1473
+ });
1474
+ if (!proms.length) return payload;
1475
+ return Promise.all(proms).then(() => {
1476
+ return payload;
1477
+ });
1478
+ }
1479
+ const $ZodObject$1 = /* @__PURE__ */ $constructor$1("$ZodObject", (inst, def) => {
1480
+ $ZodType$1.init(inst, def);
1481
+ if (!Object.getOwnPropertyDescriptor(def, "shape")?.get) {
1482
+ const sh = def.shape;
1483
+ Object.defineProperty(def, "shape", { get: () => {
1484
+ const newSh = { ...sh };
1485
+ Object.defineProperty(def, "shape", { value: newSh });
1486
+ return newSh;
1487
+ } });
1488
+ }
1489
+ const _normalized = cached$1(() => normalizeDef$1(def));
1490
+ defineLazy$1(inst._zod, "propValues", () => {
1491
+ const shape = def.shape;
1492
+ const propValues = {};
1493
+ for (const key in shape) {
1494
+ const field = shape[key]._zod;
1495
+ if (field.values) {
1496
+ propValues[key] ?? (propValues[key] = /* @__PURE__ */ new Set());
1497
+ for (const v of field.values) propValues[key].add(v);
1498
+ }
1499
+ }
1500
+ return propValues;
1501
+ });
1502
+ const isObject$2 = isObject$1;
1503
+ const catchall = def.catchall;
1504
+ let value;
1505
+ inst._zod.parse = (payload, ctx) => {
1506
+ value ?? (value = _normalized.value);
1507
+ const input = payload.value;
1508
+ if (!isObject$2(input)) {
1509
+ payload.issues.push({
1510
+ expected: "object",
1511
+ code: "invalid_type",
1512
+ input,
1513
+ inst
1514
+ });
1515
+ return payload;
1516
+ }
1517
+ payload.value = {};
1518
+ const proms = [];
1519
+ const shape = value.shape;
1520
+ for (const key of value.keys) {
1521
+ const el = shape[key];
1522
+ const isOptionalOut = el._zod.optout === "optional";
1523
+ const r = el._zod.run({
1524
+ value: input[key],
1525
+ issues: []
1526
+ }, ctx);
1527
+ if (r instanceof Promise) proms.push(r.then((r$1) => handlePropertyResult$1(r$1, payload, key, input, isOptionalOut)));
1528
+ else handlePropertyResult$1(r, payload, key, input, isOptionalOut);
1529
+ }
1530
+ if (!catchall) return proms.length ? Promise.all(proms).then(() => payload) : payload;
1531
+ return handleCatchall$1(proms, input, payload, ctx, _normalized.value, inst);
1532
+ };
1533
+ });
1534
+ const $ZodObjectJIT$1 = /* @__PURE__ */ $constructor$1("$ZodObjectJIT", (inst, def) => {
1535
+ $ZodObject$1.init(inst, def);
1536
+ const superParse = inst._zod.parse;
1537
+ const _normalized = cached$1(() => normalizeDef$1(def));
1538
+ const generateFastpass = (shape) => {
1539
+ const doc = new Doc$1([
1540
+ "shape",
1541
+ "payload",
1542
+ "ctx"
1543
+ ]);
1544
+ const normalized = _normalized.value;
1545
+ const parseStr = (key) => {
1546
+ const k = esc$1(key);
1547
+ return `shape[${k}]._zod.run({ value: input[${k}], issues: [] }, ctx)`;
1548
+ };
1549
+ doc.write(`const input = payload.value;`);
1550
+ const ids = Object.create(null);
1551
+ let counter = 0;
1552
+ for (const key of normalized.keys) ids[key] = `key_${counter++}`;
1553
+ doc.write(`const newResult = {};`);
1554
+ for (const key of normalized.keys) {
1555
+ const id = ids[key];
1556
+ const k = esc$1(key);
1557
+ const isOptionalOut = shape[key]?._zod?.optout === "optional";
1558
+ doc.write(`const ${id} = ${parseStr(key)};`);
1559
+ if (isOptionalOut) doc.write(`
1560
+ if (${id}.issues.length) {
1561
+ if (${k} in input) {
1562
+ payload.issues = payload.issues.concat(${id}.issues.map(iss => ({
1563
+ ...iss,
1564
+ path: iss.path ? [${k}, ...iss.path] : [${k}]
1565
+ })));
1566
+ }
1567
+ }
1568
+
1569
+ if (${id}.value === undefined) {
1570
+ if (${k} in input) {
1571
+ newResult[${k}] = undefined;
1572
+ }
1573
+ } else {
1574
+ newResult[${k}] = ${id}.value;
1575
+ }
1576
+
1577
+ `);
1578
+ else doc.write(`
1579
+ if (${id}.issues.length) {
1580
+ payload.issues = payload.issues.concat(${id}.issues.map(iss => ({
1581
+ ...iss,
1582
+ path: iss.path ? [${k}, ...iss.path] : [${k}]
1583
+ })));
1584
+ }
1585
+
1586
+ if (${id}.value === undefined) {
1587
+ if (${k} in input) {
1588
+ newResult[${k}] = undefined;
1589
+ }
1590
+ } else {
1591
+ newResult[${k}] = ${id}.value;
1592
+ }
1593
+
1594
+ `);
1595
+ }
1596
+ doc.write(`payload.value = newResult;`);
1597
+ doc.write(`return payload;`);
1598
+ const fn = doc.compile();
1599
+ return (payload, ctx) => fn(shape, payload, ctx);
1600
+ };
1601
+ let fastpass;
1602
+ const isObject$2 = isObject$1;
1603
+ const jit = !globalConfig$1.jitless;
1604
+ const allowsEval$2 = allowsEval$1;
1605
+ const fastEnabled = jit && allowsEval$2.value;
1606
+ const catchall = def.catchall;
1607
+ let value;
1608
+ inst._zod.parse = (payload, ctx) => {
1609
+ value ?? (value = _normalized.value);
1610
+ const input = payload.value;
1611
+ if (!isObject$2(input)) {
1612
+ payload.issues.push({
1613
+ expected: "object",
1614
+ code: "invalid_type",
1615
+ input,
1616
+ inst
1617
+ });
1618
+ return payload;
1619
+ }
1620
+ if (jit && fastEnabled && ctx?.async === false && ctx.jitless !== true) {
1621
+ if (!fastpass) fastpass = generateFastpass(def.shape);
1622
+ payload = fastpass(payload, ctx);
1623
+ if (!catchall) return payload;
1624
+ return handleCatchall$1([], input, payload, ctx, value, inst);
1625
+ }
1626
+ return superParse(payload, ctx);
1627
+ };
1628
+ });
1629
+ function handleUnionResults$1(results, final, inst, ctx) {
1630
+ for (const result of results) if (result.issues.length === 0) {
1631
+ final.value = result.value;
1632
+ return final;
1633
+ }
1634
+ const nonaborted = results.filter((r) => !aborted$1(r));
1635
+ if (nonaborted.length === 1) {
1636
+ final.value = nonaborted[0].value;
1637
+ return nonaborted[0];
1638
+ }
1639
+ final.issues.push({
1640
+ code: "invalid_union",
1641
+ input: final.value,
1642
+ inst,
1643
+ errors: results.map((result) => result.issues.map((iss) => finalizeIssue$1(iss, ctx, config$1())))
1644
+ });
1645
+ return final;
1646
+ }
1647
+ const $ZodUnion$1 = /* @__PURE__ */ $constructor$1("$ZodUnion", (inst, def) => {
1648
+ $ZodType$1.init(inst, def);
1649
+ defineLazy$1(inst._zod, "optin", () => def.options.some((o) => o._zod.optin === "optional") ? "optional" : void 0);
1650
+ defineLazy$1(inst._zod, "optout", () => def.options.some((o) => o._zod.optout === "optional") ? "optional" : void 0);
1651
+ defineLazy$1(inst._zod, "values", () => {
1652
+ if (def.options.every((o) => o._zod.values)) return new Set(def.options.flatMap((option) => Array.from(option._zod.values)));
1653
+ });
1654
+ defineLazy$1(inst._zod, "pattern", () => {
1655
+ if (def.options.every((o) => o._zod.pattern)) {
1656
+ const patterns = def.options.map((o) => o._zod.pattern);
1657
+ return /* @__PURE__ */ new RegExp(`^(${patterns.map((p) => cleanRegex$1(p.source)).join("|")})$`);
1658
+ }
1659
+ });
1660
+ const single = def.options.length === 1;
1661
+ const first = def.options[0]._zod.run;
1662
+ inst._zod.parse = (payload, ctx) => {
1663
+ if (single) return first(payload, ctx);
1664
+ let async = false;
1665
+ const results = [];
1666
+ for (const option of def.options) {
1667
+ const result = option._zod.run({
1668
+ value: payload.value,
1669
+ issues: []
1670
+ }, ctx);
1671
+ if (result instanceof Promise) {
1672
+ results.push(result);
1673
+ async = true;
1674
+ } else {
1675
+ if (result.issues.length === 0) return result;
1676
+ results.push(result);
1677
+ }
1678
+ }
1679
+ if (!async) return handleUnionResults$1(results, payload, inst, ctx);
1680
+ return Promise.all(results).then((results$1) => {
1681
+ return handleUnionResults$1(results$1, payload, inst, ctx);
1682
+ });
1683
+ };
1684
+ });
1685
+ const $ZodIntersection$1 = /* @__PURE__ */ $constructor$1("$ZodIntersection", (inst, def) => {
1686
+ $ZodType$1.init(inst, def);
1687
+ inst._zod.parse = (payload, ctx) => {
1688
+ const input = payload.value;
1689
+ const left = def.left._zod.run({
1690
+ value: input,
1691
+ issues: []
1692
+ }, ctx);
1693
+ const right = def.right._zod.run({
1694
+ value: input,
1695
+ issues: []
1696
+ }, ctx);
1697
+ if (left instanceof Promise || right instanceof Promise) return Promise.all([left, right]).then(([left$1, right$1]) => {
1698
+ return handleIntersectionResults$1(payload, left$1, right$1);
1699
+ });
1700
+ return handleIntersectionResults$1(payload, left, right);
1701
+ };
1702
+ });
1703
+ function mergeValues$1(a, b) {
1704
+ if (a === b) return {
1705
+ valid: true,
1706
+ data: a
1707
+ };
1708
+ if (a instanceof Date && b instanceof Date && +a === +b) return {
1709
+ valid: true,
1710
+ data: a
1711
+ };
1712
+ if (isPlainObject$1(a) && isPlainObject$1(b)) {
1713
+ const bKeys = Object.keys(b);
1714
+ const sharedKeys = Object.keys(a).filter((key) => bKeys.indexOf(key) !== -1);
1715
+ const newObj = {
1716
+ ...a,
1717
+ ...b
1718
+ };
1719
+ for (const key of sharedKeys) {
1720
+ const sharedValue = mergeValues$1(a[key], b[key]);
1721
+ if (!sharedValue.valid) return {
1722
+ valid: false,
1723
+ mergeErrorPath: [key, ...sharedValue.mergeErrorPath]
1724
+ };
1725
+ newObj[key] = sharedValue.data;
1726
+ }
1727
+ return {
1728
+ valid: true,
1729
+ data: newObj
1730
+ };
1731
+ }
1732
+ if (Array.isArray(a) && Array.isArray(b)) {
1733
+ if (a.length !== b.length) return {
1734
+ valid: false,
1735
+ mergeErrorPath: []
1736
+ };
1737
+ const newArray = [];
1738
+ for (let index = 0; index < a.length; index++) {
1739
+ const itemA = a[index];
1740
+ const itemB = b[index];
1741
+ const sharedValue = mergeValues$1(itemA, itemB);
1742
+ if (!sharedValue.valid) return {
1743
+ valid: false,
1744
+ mergeErrorPath: [index, ...sharedValue.mergeErrorPath]
1745
+ };
1746
+ newArray.push(sharedValue.data);
1747
+ }
1748
+ return {
1749
+ valid: true,
1750
+ data: newArray
1751
+ };
1752
+ }
1753
+ return {
1754
+ valid: false,
1755
+ mergeErrorPath: []
1756
+ };
1757
+ }
1758
+ function handleIntersectionResults$1(result, left, right) {
1759
+ const unrecKeys = /* @__PURE__ */ new Map();
1760
+ let unrecIssue;
1761
+ for (const iss of left.issues) if (iss.code === "unrecognized_keys") {
1762
+ unrecIssue ?? (unrecIssue = iss);
1763
+ for (const k of iss.keys) {
1764
+ if (!unrecKeys.has(k)) unrecKeys.set(k, {});
1765
+ unrecKeys.get(k).l = true;
1766
+ }
1767
+ } else result.issues.push(iss);
1768
+ for (const iss of right.issues) if (iss.code === "unrecognized_keys") for (const k of iss.keys) {
1769
+ if (!unrecKeys.has(k)) unrecKeys.set(k, {});
1770
+ unrecKeys.get(k).r = true;
1771
+ }
1772
+ else result.issues.push(iss);
1773
+ const bothKeys = [...unrecKeys].filter(([, f]) => f.l && f.r).map(([k]) => k);
1774
+ if (bothKeys.length && unrecIssue) result.issues.push({
1775
+ ...unrecIssue,
1776
+ keys: bothKeys
1777
+ });
1778
+ if (aborted$1(result)) return result;
1779
+ const merged = mergeValues$1(left.value, right.value);
1780
+ if (!merged.valid) throw new Error(`Unmergable intersection. Error path: ${JSON.stringify(merged.mergeErrorPath)}`);
1781
+ result.value = merged.data;
1782
+ return result;
1783
+ }
1784
+ const $ZodEnum$1 = /* @__PURE__ */ $constructor$1("$ZodEnum", (inst, def) => {
1785
+ $ZodType$1.init(inst, def);
1786
+ const values = getEnumValues$1(def.entries);
1787
+ const valuesSet = new Set(values);
1788
+ inst._zod.values = valuesSet;
1789
+ inst._zod.pattern = /* @__PURE__ */ new RegExp(`^(${values.filter((k) => propertyKeyTypes$1.has(typeof k)).map((o) => typeof o === "string" ? escapeRegex$1(o) : o.toString()).join("|")})$`);
1790
+ inst._zod.parse = (payload, _ctx) => {
1791
+ const input = payload.value;
1792
+ if (valuesSet.has(input)) return payload;
1793
+ payload.issues.push({
1794
+ code: "invalid_value",
1795
+ values,
1796
+ input,
1797
+ inst
1798
+ });
1799
+ return payload;
1800
+ };
1801
+ });
1802
+ const $ZodTransform$1 = /* @__PURE__ */ $constructor$1("$ZodTransform", (inst, def) => {
1803
+ $ZodType$1.init(inst, def);
1804
+ inst._zod.parse = (payload, ctx) => {
1805
+ if (ctx.direction === "backward") throw new $ZodEncodeError$1(inst.constructor.name);
1806
+ const _out = def.transform(payload.value, payload);
1807
+ if (ctx.async) return (_out instanceof Promise ? _out : Promise.resolve(_out)).then((output) => {
1808
+ payload.value = output;
1809
+ return payload;
1810
+ });
1811
+ if (_out instanceof Promise) throw new $ZodAsyncError$1();
1812
+ payload.value = _out;
1813
+ return payload;
1814
+ };
1815
+ });
1816
+ function handleOptionalResult$1(result, input) {
1817
+ if (result.issues.length && input === void 0) return {
1818
+ issues: [],
1819
+ value: void 0
1820
+ };
1821
+ return result;
1822
+ }
1823
+ const $ZodOptional$1 = /* @__PURE__ */ $constructor$1("$ZodOptional", (inst, def) => {
1824
+ $ZodType$1.init(inst, def);
1825
+ inst._zod.optin = "optional";
1826
+ inst._zod.optout = "optional";
1827
+ defineLazy$1(inst._zod, "values", () => {
1828
+ return def.innerType._zod.values ? new Set([...def.innerType._zod.values, void 0]) : void 0;
1829
+ });
1830
+ defineLazy$1(inst._zod, "pattern", () => {
1831
+ const pattern = def.innerType._zod.pattern;
1832
+ return pattern ? /* @__PURE__ */ new RegExp(`^(${cleanRegex$1(pattern.source)})?$`) : void 0;
1833
+ });
1834
+ inst._zod.parse = (payload, ctx) => {
1835
+ if (def.innerType._zod.optin === "optional") {
1836
+ const result = def.innerType._zod.run(payload, ctx);
1837
+ if (result instanceof Promise) return result.then((r) => handleOptionalResult$1(r, payload.value));
1838
+ return handleOptionalResult$1(result, payload.value);
1839
+ }
1840
+ if (payload.value === void 0) return payload;
1841
+ return def.innerType._zod.run(payload, ctx);
1842
+ };
1843
+ });
1844
+ const $ZodExactOptional$1 = /* @__PURE__ */ $constructor$1("$ZodExactOptional", (inst, def) => {
1845
+ $ZodOptional$1.init(inst, def);
1846
+ defineLazy$1(inst._zod, "values", () => def.innerType._zod.values);
1847
+ defineLazy$1(inst._zod, "pattern", () => def.innerType._zod.pattern);
1848
+ inst._zod.parse = (payload, ctx) => {
1849
+ return def.innerType._zod.run(payload, ctx);
1850
+ };
1851
+ });
1852
+ const $ZodNullable$1 = /* @__PURE__ */ $constructor$1("$ZodNullable", (inst, def) => {
1853
+ $ZodType$1.init(inst, def);
1854
+ defineLazy$1(inst._zod, "optin", () => def.innerType._zod.optin);
1855
+ defineLazy$1(inst._zod, "optout", () => def.innerType._zod.optout);
1856
+ defineLazy$1(inst._zod, "pattern", () => {
1857
+ const pattern = def.innerType._zod.pattern;
1858
+ return pattern ? /* @__PURE__ */ new RegExp(`^(${cleanRegex$1(pattern.source)}|null)$`) : void 0;
1859
+ });
1860
+ defineLazy$1(inst._zod, "values", () => {
1861
+ return def.innerType._zod.values ? new Set([...def.innerType._zod.values, null]) : void 0;
1862
+ });
1863
+ inst._zod.parse = (payload, ctx) => {
1864
+ if (payload.value === null) return payload;
1865
+ return def.innerType._zod.run(payload, ctx);
1866
+ };
1867
+ });
1868
+ const $ZodDefault$1 = /* @__PURE__ */ $constructor$1("$ZodDefault", (inst, def) => {
1869
+ $ZodType$1.init(inst, def);
1870
+ inst._zod.optin = "optional";
1871
+ defineLazy$1(inst._zod, "values", () => def.innerType._zod.values);
1872
+ inst._zod.parse = (payload, ctx) => {
1873
+ if (ctx.direction === "backward") return def.innerType._zod.run(payload, ctx);
1874
+ if (payload.value === void 0) {
1875
+ payload.value = def.defaultValue;
1876
+ /**
1877
+ * $ZodDefault returns the default value immediately in forward direction.
1878
+ * 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. */
1879
+ return payload;
1880
+ }
1881
+ const result = def.innerType._zod.run(payload, ctx);
1882
+ if (result instanceof Promise) return result.then((result$1) => handleDefaultResult$1(result$1, def));
1883
+ return handleDefaultResult$1(result, def);
1884
+ };
1885
+ });
1886
+ function handleDefaultResult$1(payload, def) {
1887
+ if (payload.value === void 0) payload.value = def.defaultValue;
1888
+ return payload;
1889
+ }
1890
+ const $ZodPrefault$1 = /* @__PURE__ */ $constructor$1("$ZodPrefault", (inst, def) => {
1891
+ $ZodType$1.init(inst, def);
1892
+ inst._zod.optin = "optional";
1893
+ defineLazy$1(inst._zod, "values", () => def.innerType._zod.values);
1894
+ inst._zod.parse = (payload, ctx) => {
1895
+ if (ctx.direction === "backward") return def.innerType._zod.run(payload, ctx);
1896
+ if (payload.value === void 0) payload.value = def.defaultValue;
1897
+ return def.innerType._zod.run(payload, ctx);
1898
+ };
1899
+ });
1900
+ const $ZodNonOptional$1 = /* @__PURE__ */ $constructor$1("$ZodNonOptional", (inst, def) => {
1901
+ $ZodType$1.init(inst, def);
1902
+ defineLazy$1(inst._zod, "values", () => {
1903
+ const v = def.innerType._zod.values;
1904
+ return v ? new Set([...v].filter((x) => x !== void 0)) : void 0;
1905
+ });
1906
+ inst._zod.parse = (payload, ctx) => {
1907
+ const result = def.innerType._zod.run(payload, ctx);
1908
+ if (result instanceof Promise) return result.then((result$1) => handleNonOptionalResult$1(result$1, inst));
1909
+ return handleNonOptionalResult$1(result, inst);
1910
+ };
1911
+ });
1912
+ function handleNonOptionalResult$1(payload, inst) {
1913
+ if (!payload.issues.length && payload.value === void 0) payload.issues.push({
1914
+ code: "invalid_type",
1915
+ expected: "nonoptional",
1916
+ input: payload.value,
1917
+ inst
1918
+ });
1919
+ return payload;
1920
+ }
1921
+ const $ZodCatch$1 = /* @__PURE__ */ $constructor$1("$ZodCatch", (inst, def) => {
1922
+ $ZodType$1.init(inst, def);
1923
+ defineLazy$1(inst._zod, "optin", () => def.innerType._zod.optin);
1924
+ defineLazy$1(inst._zod, "optout", () => def.innerType._zod.optout);
1925
+ defineLazy$1(inst._zod, "values", () => def.innerType._zod.values);
1926
+ inst._zod.parse = (payload, ctx) => {
1927
+ if (ctx.direction === "backward") return def.innerType._zod.run(payload, ctx);
1928
+ const result = def.innerType._zod.run(payload, ctx);
1929
+ if (result instanceof Promise) return result.then((result$1) => {
1930
+ payload.value = result$1.value;
1931
+ if (result$1.issues.length) {
1932
+ payload.value = def.catchValue({
1933
+ ...payload,
1934
+ error: { issues: result$1.issues.map((iss) => finalizeIssue$1(iss, ctx, config$1())) },
1935
+ input: payload.value
1936
+ });
1937
+ payload.issues = [];
1938
+ }
1939
+ return payload;
1940
+ });
1941
+ payload.value = result.value;
1942
+ if (result.issues.length) {
1943
+ payload.value = def.catchValue({
1944
+ ...payload,
1945
+ error: { issues: result.issues.map((iss) => finalizeIssue$1(iss, ctx, config$1())) },
1946
+ input: payload.value
1947
+ });
1948
+ payload.issues = [];
1949
+ }
1950
+ return payload;
1951
+ };
1952
+ });
1953
+ const $ZodPipe$1 = /* @__PURE__ */ $constructor$1("$ZodPipe", (inst, def) => {
1954
+ $ZodType$1.init(inst, def);
1955
+ defineLazy$1(inst._zod, "values", () => def.in._zod.values);
1956
+ defineLazy$1(inst._zod, "optin", () => def.in._zod.optin);
1957
+ defineLazy$1(inst._zod, "optout", () => def.out._zod.optout);
1958
+ defineLazy$1(inst._zod, "propValues", () => def.in._zod.propValues);
1959
+ inst._zod.parse = (payload, ctx) => {
1960
+ if (ctx.direction === "backward") {
1961
+ const right = def.out._zod.run(payload, ctx);
1962
+ if (right instanceof Promise) return right.then((right$1) => handlePipeResult$1(right$1, def.in, ctx));
1963
+ return handlePipeResult$1(right, def.in, ctx);
1964
+ }
1965
+ const left = def.in._zod.run(payload, ctx);
1966
+ if (left instanceof Promise) return left.then((left$1) => handlePipeResult$1(left$1, def.out, ctx));
1967
+ return handlePipeResult$1(left, def.out, ctx);
1968
+ };
1969
+ });
1970
+ function handlePipeResult$1(left, next, ctx) {
1971
+ if (left.issues.length) {
1972
+ left.aborted = true;
1973
+ return left;
1974
+ }
1975
+ return next._zod.run({
1976
+ value: left.value,
1977
+ issues: left.issues
1978
+ }, ctx);
1979
+ }
1980
+ const $ZodReadonly$1 = /* @__PURE__ */ $constructor$1("$ZodReadonly", (inst, def) => {
1981
+ $ZodType$1.init(inst, def);
1982
+ defineLazy$1(inst._zod, "propValues", () => def.innerType._zod.propValues);
1983
+ defineLazy$1(inst._zod, "values", () => def.innerType._zod.values);
1984
+ defineLazy$1(inst._zod, "optin", () => def.innerType?._zod?.optin);
1985
+ defineLazy$1(inst._zod, "optout", () => def.innerType?._zod?.optout);
1986
+ inst._zod.parse = (payload, ctx) => {
1987
+ if (ctx.direction === "backward") return def.innerType._zod.run(payload, ctx);
1988
+ const result = def.innerType._zod.run(payload, ctx);
1989
+ if (result instanceof Promise) return result.then(handleReadonlyResult$1);
1990
+ return handleReadonlyResult$1(result);
1991
+ };
1992
+ });
1993
+ function handleReadonlyResult$1(payload) {
1994
+ payload.value = Object.freeze(payload.value);
1995
+ return payload;
1996
+ }
1997
+ const $ZodCustom$1 = /* @__PURE__ */ $constructor$1("$ZodCustom", (inst, def) => {
1998
+ $ZodCheck$1.init(inst, def);
1999
+ $ZodType$1.init(inst, def);
2000
+ inst._zod.parse = (payload, _) => {
2001
+ return payload;
2002
+ };
2003
+ inst._zod.check = (payload) => {
2004
+ const input = payload.value;
2005
+ const r = def.fn(input);
2006
+ if (r instanceof Promise) return r.then((r$1) => handleRefineResult$1(r$1, payload, input, inst));
2007
+ handleRefineResult$1(r, payload, input, inst);
2008
+ };
2009
+ });
2010
+ function handleRefineResult$1(result, payload, input, inst) {
2011
+ if (!result) {
2012
+ const _iss = {
2013
+ code: "custom",
2014
+ input,
2015
+ inst,
2016
+ path: [...inst._zod.def.path ?? []],
2017
+ continue: !inst._zod.def.abort
2018
+ };
2019
+ if (inst._zod.def.params) _iss.params = inst._zod.def.params;
2020
+ payload.issues.push(issue$1(_iss));
2021
+ }
2022
+ }
2023
+
2024
+ //#endregion
2025
+ //#region ../../node_modules/.bun/zod@4.3.6/node_modules/zod/v4/core/registries.js
2026
+ var _a$1;
2027
+ var $ZodRegistry$1 = class {
2028
+ constructor() {
2029
+ this._map = /* @__PURE__ */ new WeakMap();
2030
+ this._idmap = /* @__PURE__ */ new Map();
2031
+ }
2032
+ add(schema, ..._meta) {
2033
+ const meta$2 = _meta[0];
2034
+ this._map.set(schema, meta$2);
2035
+ if (meta$2 && typeof meta$2 === "object" && "id" in meta$2) this._idmap.set(meta$2.id, schema);
2036
+ return this;
2037
+ }
2038
+ clear() {
2039
+ this._map = /* @__PURE__ */ new WeakMap();
2040
+ this._idmap = /* @__PURE__ */ new Map();
2041
+ return this;
2042
+ }
2043
+ remove(schema) {
2044
+ const meta$2 = this._map.get(schema);
2045
+ if (meta$2 && typeof meta$2 === "object" && "id" in meta$2) this._idmap.delete(meta$2.id);
2046
+ this._map.delete(schema);
2047
+ return this;
2048
+ }
2049
+ get(schema) {
2050
+ const p = schema._zod.parent;
2051
+ if (p) {
2052
+ const pm = { ...this.get(p) ?? {} };
2053
+ delete pm.id;
2054
+ const f = {
2055
+ ...pm,
2056
+ ...this._map.get(schema)
2057
+ };
2058
+ return Object.keys(f).length ? f : void 0;
2059
+ }
2060
+ return this._map.get(schema);
2061
+ }
2062
+ has(schema) {
2063
+ return this._map.has(schema);
2064
+ }
2065
+ };
2066
+ function registry$1() {
2067
+ return new $ZodRegistry$1();
2068
+ }
2069
+ (_a$1 = globalThis).__zod_globalRegistry ?? (_a$1.__zod_globalRegistry = registry$1());
2070
+ const globalRegistry$1 = globalThis.__zod_globalRegistry;
2071
+
2072
+ //#endregion
2073
+ //#region ../../node_modules/.bun/zod@4.3.6/node_modules/zod/v4/core/api.js
2074
+ /* @__NO_SIDE_EFFECTS__ */
2075
+ function _string$1(Class, params) {
2076
+ return new Class({
2077
+ type: "string",
2078
+ ...normalizeParams$1(params)
2079
+ });
2080
+ }
2081
+ /* @__NO_SIDE_EFFECTS__ */
2082
+ function _email$1(Class, params) {
2083
+ return new Class({
2084
+ type: "string",
2085
+ format: "email",
2086
+ check: "string_format",
2087
+ abort: false,
2088
+ ...normalizeParams$1(params)
2089
+ });
2090
+ }
2091
+ /* @__NO_SIDE_EFFECTS__ */
2092
+ function _guid$1(Class, params) {
2093
+ return new Class({
2094
+ type: "string",
2095
+ format: "guid",
2096
+ check: "string_format",
2097
+ abort: false,
2098
+ ...normalizeParams$1(params)
2099
+ });
2100
+ }
2101
+ /* @__NO_SIDE_EFFECTS__ */
2102
+ function _uuid$1(Class, params) {
2103
+ return new Class({
2104
+ type: "string",
2105
+ format: "uuid",
2106
+ check: "string_format",
2107
+ abort: false,
2108
+ ...normalizeParams$1(params)
2109
+ });
2110
+ }
2111
+ /* @__NO_SIDE_EFFECTS__ */
2112
+ function _uuidv4$1(Class, params) {
2113
+ return new Class({
2114
+ type: "string",
2115
+ format: "uuid",
2116
+ check: "string_format",
2117
+ abort: false,
2118
+ version: "v4",
2119
+ ...normalizeParams$1(params)
2120
+ });
2121
+ }
2122
+ /* @__NO_SIDE_EFFECTS__ */
2123
+ function _uuidv6$1(Class, params) {
2124
+ return new Class({
2125
+ type: "string",
2126
+ format: "uuid",
2127
+ check: "string_format",
2128
+ abort: false,
2129
+ version: "v6",
2130
+ ...normalizeParams$1(params)
2131
+ });
2132
+ }
2133
+ /* @__NO_SIDE_EFFECTS__ */
2134
+ function _uuidv7$1(Class, params) {
2135
+ return new Class({
2136
+ type: "string",
2137
+ format: "uuid",
2138
+ check: "string_format",
2139
+ abort: false,
2140
+ version: "v7",
2141
+ ...normalizeParams$1(params)
2142
+ });
2143
+ }
2144
+ /* @__NO_SIDE_EFFECTS__ */
2145
+ function _url$1(Class, params) {
2146
+ return new Class({
2147
+ type: "string",
2148
+ format: "url",
2149
+ check: "string_format",
2150
+ abort: false,
2151
+ ...normalizeParams$1(params)
2152
+ });
2153
+ }
2154
+ /* @__NO_SIDE_EFFECTS__ */
2155
+ function _emoji$2(Class, params) {
2156
+ return new Class({
2157
+ type: "string",
2158
+ format: "emoji",
2159
+ check: "string_format",
2160
+ abort: false,
2161
+ ...normalizeParams$1(params)
2162
+ });
2163
+ }
2164
+ /* @__NO_SIDE_EFFECTS__ */
2165
+ function _nanoid$1(Class, params) {
2166
+ return new Class({
2167
+ type: "string",
2168
+ format: "nanoid",
2169
+ check: "string_format",
2170
+ abort: false,
2171
+ ...normalizeParams$1(params)
2172
+ });
2173
+ }
2174
+ /* @__NO_SIDE_EFFECTS__ */
2175
+ function _cuid$1(Class, params) {
2176
+ return new Class({
2177
+ type: "string",
2178
+ format: "cuid",
2179
+ check: "string_format",
2180
+ abort: false,
2181
+ ...normalizeParams$1(params)
2182
+ });
2183
+ }
2184
+ /* @__NO_SIDE_EFFECTS__ */
2185
+ function _cuid2$1(Class, params) {
2186
+ return new Class({
2187
+ type: "string",
2188
+ format: "cuid2",
2189
+ check: "string_format",
2190
+ abort: false,
2191
+ ...normalizeParams$1(params)
2192
+ });
2193
+ }
2194
+ /* @__NO_SIDE_EFFECTS__ */
2195
+ function _ulid$1(Class, params) {
2196
+ return new Class({
2197
+ type: "string",
2198
+ format: "ulid",
2199
+ check: "string_format",
2200
+ abort: false,
2201
+ ...normalizeParams$1(params)
2202
+ });
2203
+ }
2204
+ /* @__NO_SIDE_EFFECTS__ */
2205
+ function _xid$1(Class, params) {
2206
+ return new Class({
2207
+ type: "string",
2208
+ format: "xid",
2209
+ check: "string_format",
2210
+ abort: false,
2211
+ ...normalizeParams$1(params)
2212
+ });
2213
+ }
2214
+ /* @__NO_SIDE_EFFECTS__ */
2215
+ function _ksuid$1(Class, params) {
2216
+ return new Class({
2217
+ type: "string",
2218
+ format: "ksuid",
2219
+ check: "string_format",
2220
+ abort: false,
2221
+ ...normalizeParams$1(params)
2222
+ });
2223
+ }
2224
+ /* @__NO_SIDE_EFFECTS__ */
2225
+ function _ipv4$1(Class, params) {
2226
+ return new Class({
2227
+ type: "string",
2228
+ format: "ipv4",
2229
+ check: "string_format",
2230
+ abort: false,
2231
+ ...normalizeParams$1(params)
2232
+ });
2233
+ }
2234
+ /* @__NO_SIDE_EFFECTS__ */
2235
+ function _ipv6$1(Class, params) {
2236
+ return new Class({
2237
+ type: "string",
2238
+ format: "ipv6",
2239
+ check: "string_format",
2240
+ abort: false,
2241
+ ...normalizeParams$1(params)
2242
+ });
2243
+ }
2244
+ /* @__NO_SIDE_EFFECTS__ */
2245
+ function _cidrv4$1(Class, params) {
2246
+ return new Class({
2247
+ type: "string",
2248
+ format: "cidrv4",
2249
+ check: "string_format",
2250
+ abort: false,
2251
+ ...normalizeParams$1(params)
2252
+ });
2253
+ }
2254
+ /* @__NO_SIDE_EFFECTS__ */
2255
+ function _cidrv6$1(Class, params) {
2256
+ return new Class({
2257
+ type: "string",
2258
+ format: "cidrv6",
2259
+ check: "string_format",
2260
+ abort: false,
2261
+ ...normalizeParams$1(params)
2262
+ });
2263
+ }
2264
+ /* @__NO_SIDE_EFFECTS__ */
2265
+ function _base64$1(Class, params) {
2266
+ return new Class({
2267
+ type: "string",
2268
+ format: "base64",
2269
+ check: "string_format",
2270
+ abort: false,
2271
+ ...normalizeParams$1(params)
2272
+ });
2273
+ }
2274
+ /* @__NO_SIDE_EFFECTS__ */
2275
+ function _base64url$1(Class, params) {
2276
+ return new Class({
2277
+ type: "string",
2278
+ format: "base64url",
2279
+ check: "string_format",
2280
+ abort: false,
2281
+ ...normalizeParams$1(params)
2282
+ });
2283
+ }
2284
+ /* @__NO_SIDE_EFFECTS__ */
2285
+ function _e164$1(Class, params) {
2286
+ return new Class({
2287
+ type: "string",
2288
+ format: "e164",
2289
+ check: "string_format",
2290
+ abort: false,
2291
+ ...normalizeParams$1(params)
2292
+ });
2293
+ }
2294
+ /* @__NO_SIDE_EFFECTS__ */
2295
+ function _jwt$1(Class, params) {
2296
+ return new Class({
2297
+ type: "string",
2298
+ format: "jwt",
2299
+ check: "string_format",
2300
+ abort: false,
2301
+ ...normalizeParams$1(params)
2302
+ });
2303
+ }
2304
+ /* @__NO_SIDE_EFFECTS__ */
2305
+ function _isoDateTime$1(Class, params) {
2306
+ return new Class({
2307
+ type: "string",
2308
+ format: "datetime",
2309
+ check: "string_format",
2310
+ offset: false,
2311
+ local: false,
2312
+ precision: null,
2313
+ ...normalizeParams$1(params)
2314
+ });
2315
+ }
2316
+ /* @__NO_SIDE_EFFECTS__ */
2317
+ function _isoDate$1(Class, params) {
2318
+ return new Class({
2319
+ type: "string",
2320
+ format: "date",
2321
+ check: "string_format",
2322
+ ...normalizeParams$1(params)
2323
+ });
2324
+ }
2325
+ /* @__NO_SIDE_EFFECTS__ */
2326
+ function _isoTime$1(Class, params) {
2327
+ return new Class({
2328
+ type: "string",
2329
+ format: "time",
2330
+ check: "string_format",
2331
+ precision: null,
2332
+ ...normalizeParams$1(params)
2333
+ });
2334
+ }
2335
+ /* @__NO_SIDE_EFFECTS__ */
2336
+ function _isoDuration$1(Class, params) {
2337
+ return new Class({
2338
+ type: "string",
2339
+ format: "duration",
2340
+ check: "string_format",
2341
+ ...normalizeParams$1(params)
2342
+ });
2343
+ }
2344
+ /* @__NO_SIDE_EFFECTS__ */
2345
+ function _number$1(Class, params) {
2346
+ return new Class({
2347
+ type: "number",
2348
+ checks: [],
2349
+ ...normalizeParams$1(params)
2350
+ });
2351
+ }
2352
+ /* @__NO_SIDE_EFFECTS__ */
2353
+ function _int$1(Class, params) {
2354
+ return new Class({
2355
+ type: "number",
2356
+ check: "number_format",
2357
+ abort: false,
2358
+ format: "safeint",
2359
+ ...normalizeParams$1(params)
2360
+ });
2361
+ }
2362
+ /* @__NO_SIDE_EFFECTS__ */
2363
+ function _unknown$1(Class) {
2364
+ return new Class({ type: "unknown" });
2365
+ }
2366
+ /* @__NO_SIDE_EFFECTS__ */
2367
+ function _never$1(Class, params) {
2368
+ return new Class({
2369
+ type: "never",
2370
+ ...normalizeParams$1(params)
2371
+ });
2372
+ }
2373
+ /* @__NO_SIDE_EFFECTS__ */
2374
+ function _lt$1(value, params) {
2375
+ return new $ZodCheckLessThan$1({
2376
+ check: "less_than",
2377
+ ...normalizeParams$1(params),
2378
+ value,
2379
+ inclusive: false
2380
+ });
2381
+ }
2382
+ /* @__NO_SIDE_EFFECTS__ */
2383
+ function _lte$1(value, params) {
2384
+ return new $ZodCheckLessThan$1({
2385
+ check: "less_than",
2386
+ ...normalizeParams$1(params),
2387
+ value,
2388
+ inclusive: true
2389
+ });
2390
+ }
2391
+ /* @__NO_SIDE_EFFECTS__ */
2392
+ function _gt$1(value, params) {
2393
+ return new $ZodCheckGreaterThan$1({
2394
+ check: "greater_than",
2395
+ ...normalizeParams$1(params),
2396
+ value,
2397
+ inclusive: false
2398
+ });
2399
+ }
2400
+ /* @__NO_SIDE_EFFECTS__ */
2401
+ function _gte$1(value, params) {
2402
+ return new $ZodCheckGreaterThan$1({
2403
+ check: "greater_than",
2404
+ ...normalizeParams$1(params),
2405
+ value,
2406
+ inclusive: true
2407
+ });
2408
+ }
2409
+ /* @__NO_SIDE_EFFECTS__ */
2410
+ function _multipleOf$1(value, params) {
2411
+ return new $ZodCheckMultipleOf$1({
2412
+ check: "multiple_of",
2413
+ ...normalizeParams$1(params),
2414
+ value
2415
+ });
2416
+ }
2417
+ /* @__NO_SIDE_EFFECTS__ */
2418
+ function _maxLength$1(maximum, params) {
2419
+ return new $ZodCheckMaxLength$1({
2420
+ check: "max_length",
2421
+ ...normalizeParams$1(params),
2422
+ maximum
2423
+ });
2424
+ }
2425
+ /* @__NO_SIDE_EFFECTS__ */
2426
+ function _minLength$1(minimum, params) {
2427
+ return new $ZodCheckMinLength$1({
2428
+ check: "min_length",
2429
+ ...normalizeParams$1(params),
2430
+ minimum
2431
+ });
2432
+ }
2433
+ /* @__NO_SIDE_EFFECTS__ */
2434
+ function _length$1(length, params) {
2435
+ return new $ZodCheckLengthEquals$1({
2436
+ check: "length_equals",
2437
+ ...normalizeParams$1(params),
2438
+ length
2439
+ });
2440
+ }
2441
+ /* @__NO_SIDE_EFFECTS__ */
2442
+ function _regex$1(pattern, params) {
2443
+ return new $ZodCheckRegex$1({
2444
+ check: "string_format",
2445
+ format: "regex",
2446
+ ...normalizeParams$1(params),
2447
+ pattern
2448
+ });
2449
+ }
2450
+ /* @__NO_SIDE_EFFECTS__ */
2451
+ function _lowercase$1(params) {
2452
+ return new $ZodCheckLowerCase$1({
2453
+ check: "string_format",
2454
+ format: "lowercase",
2455
+ ...normalizeParams$1(params)
2456
+ });
2457
+ }
2458
+ /* @__NO_SIDE_EFFECTS__ */
2459
+ function _uppercase$1(params) {
2460
+ return new $ZodCheckUpperCase$1({
2461
+ check: "string_format",
2462
+ format: "uppercase",
2463
+ ...normalizeParams$1(params)
2464
+ });
2465
+ }
2466
+ /* @__NO_SIDE_EFFECTS__ */
2467
+ function _includes$1(includes, params) {
2468
+ return new $ZodCheckIncludes$1({
2469
+ check: "string_format",
2470
+ format: "includes",
2471
+ ...normalizeParams$1(params),
2472
+ includes
2473
+ });
2474
+ }
2475
+ /* @__NO_SIDE_EFFECTS__ */
2476
+ function _startsWith$1(prefix, params) {
2477
+ return new $ZodCheckStartsWith$1({
2478
+ check: "string_format",
2479
+ format: "starts_with",
2480
+ ...normalizeParams$1(params),
2481
+ prefix
2482
+ });
2483
+ }
2484
+ /* @__NO_SIDE_EFFECTS__ */
2485
+ function _endsWith$1(suffix, params) {
2486
+ return new $ZodCheckEndsWith$1({
2487
+ check: "string_format",
2488
+ format: "ends_with",
2489
+ ...normalizeParams$1(params),
2490
+ suffix
2491
+ });
2492
+ }
2493
+ /* @__NO_SIDE_EFFECTS__ */
2494
+ function _overwrite$1(tx) {
2495
+ return new $ZodCheckOverwrite$1({
2496
+ check: "overwrite",
2497
+ tx
2498
+ });
2499
+ }
2500
+ /* @__NO_SIDE_EFFECTS__ */
2501
+ function _normalize$1(form) {
2502
+ return /* @__PURE__ */ _overwrite$1((input) => input.normalize(form));
2503
+ }
2504
+ /* @__NO_SIDE_EFFECTS__ */
2505
+ function _trim$1() {
2506
+ return /* @__PURE__ */ _overwrite$1((input) => input.trim());
2507
+ }
2508
+ /* @__NO_SIDE_EFFECTS__ */
2509
+ function _toLowerCase$1() {
2510
+ return /* @__PURE__ */ _overwrite$1((input) => input.toLowerCase());
2511
+ }
2512
+ /* @__NO_SIDE_EFFECTS__ */
2513
+ function _toUpperCase$1() {
2514
+ return /* @__PURE__ */ _overwrite$1((input) => input.toUpperCase());
2515
+ }
2516
+ /* @__NO_SIDE_EFFECTS__ */
2517
+ function _slugify$1() {
2518
+ return /* @__PURE__ */ _overwrite$1((input) => slugify$1(input));
2519
+ }
2520
+ /* @__NO_SIDE_EFFECTS__ */
2521
+ function _array$1(Class, element, params) {
2522
+ return new Class({
2523
+ type: "array",
2524
+ element,
2525
+ ...normalizeParams$1(params)
2526
+ });
2527
+ }
2528
+ /* @__NO_SIDE_EFFECTS__ */
2529
+ function _refine$1(Class, fn, _params) {
2530
+ return new Class({
2531
+ type: "custom",
2532
+ check: "custom",
2533
+ fn,
2534
+ ...normalizeParams$1(_params)
2535
+ });
2536
+ }
2537
+ /* @__NO_SIDE_EFFECTS__ */
2538
+ function _superRefine$1(fn) {
2539
+ const ch = /* @__PURE__ */ _check$1((payload) => {
2540
+ payload.addIssue = (issue$2) => {
2541
+ if (typeof issue$2 === "string") payload.issues.push(issue$1(issue$2, payload.value, ch._zod.def));
2542
+ else {
2543
+ const _issue = issue$2;
2544
+ if (_issue.fatal) _issue.continue = false;
2545
+ _issue.code ?? (_issue.code = "custom");
2546
+ _issue.input ?? (_issue.input = payload.value);
2547
+ _issue.inst ?? (_issue.inst = ch);
2548
+ _issue.continue ?? (_issue.continue = !ch._zod.def.abort);
2549
+ payload.issues.push(issue$1(_issue));
2550
+ }
2551
+ };
2552
+ return fn(payload.value, payload);
2553
+ });
2554
+ return ch;
2555
+ }
2556
+ /* @__NO_SIDE_EFFECTS__ */
2557
+ function _check$1(fn, params) {
2558
+ const ch = new $ZodCheck$1({
2559
+ check: "custom",
2560
+ ...normalizeParams$1(params)
2561
+ });
2562
+ ch._zod.check = fn;
2563
+ return ch;
2564
+ }
2565
+ /* @__NO_SIDE_EFFECTS__ */
2566
+ function describe$1(description) {
2567
+ const ch = new $ZodCheck$1({ check: "describe" });
2568
+ ch._zod.onattach = [(inst) => {
2569
+ const existing = globalRegistry$1.get(inst) ?? {};
2570
+ globalRegistry$1.add(inst, {
2571
+ ...existing,
2572
+ description
2573
+ });
2574
+ }];
2575
+ ch._zod.check = () => {};
2576
+ return ch;
2577
+ }
2578
+ /* @__NO_SIDE_EFFECTS__ */
2579
+ function meta$1(metadata) {
2580
+ const ch = new $ZodCheck$1({ check: "meta" });
2581
+ ch._zod.onattach = [(inst) => {
2582
+ const existing = globalRegistry$1.get(inst) ?? {};
2583
+ globalRegistry$1.add(inst, {
2584
+ ...existing,
2585
+ ...metadata
2586
+ });
2587
+ }];
2588
+ ch._zod.check = () => {};
2589
+ return ch;
2590
+ }
2591
+
2592
+ //#endregion
2593
+ //#region ../../node_modules/.bun/zod@4.3.6/node_modules/zod/v4/core/to-json-schema.js
2594
+ function initializeContext$1(params) {
2595
+ let target = params?.target ?? "draft-2020-12";
2596
+ if (target === "draft-4") target = "draft-04";
2597
+ if (target === "draft-7") target = "draft-07";
2598
+ return {
2599
+ processors: params.processors ?? {},
2600
+ metadataRegistry: params?.metadata ?? globalRegistry$1,
2601
+ target,
2602
+ unrepresentable: params?.unrepresentable ?? "throw",
2603
+ override: params?.override ?? (() => {}),
2604
+ io: params?.io ?? "output",
2605
+ counter: 0,
2606
+ seen: /* @__PURE__ */ new Map(),
2607
+ cycles: params?.cycles ?? "ref",
2608
+ reused: params?.reused ?? "inline",
2609
+ external: params?.external ?? void 0
2610
+ };
2611
+ }
2612
+ function process$3(schema, ctx, _params = {
2613
+ path: [],
2614
+ schemaPath: []
2615
+ }) {
2616
+ var _a$2;
2617
+ const def = schema._zod.def;
2618
+ const seen = ctx.seen.get(schema);
2619
+ if (seen) {
2620
+ seen.count++;
2621
+ if (_params.schemaPath.includes(schema)) seen.cycle = _params.path;
2622
+ return seen.schema;
2623
+ }
2624
+ const result = {
2625
+ schema: {},
2626
+ count: 1,
2627
+ cycle: void 0,
2628
+ path: _params.path
2629
+ };
2630
+ ctx.seen.set(schema, result);
2631
+ const overrideSchema = schema._zod.toJSONSchema?.();
2632
+ if (overrideSchema) result.schema = overrideSchema;
2633
+ else {
2634
+ const params = {
2635
+ ..._params,
2636
+ schemaPath: [..._params.schemaPath, schema],
2637
+ path: _params.path
2638
+ };
2639
+ if (schema._zod.processJSONSchema) schema._zod.processJSONSchema(ctx, result.schema, params);
2640
+ else {
2641
+ const _json = result.schema;
2642
+ const processor = ctx.processors[def.type];
2643
+ if (!processor) throw new Error(`[toJSONSchema]: Non-representable type encountered: ${def.type}`);
2644
+ processor(schema, ctx, _json, params);
2645
+ }
2646
+ const parent = schema._zod.parent;
2647
+ if (parent) {
2648
+ if (!result.ref) result.ref = parent;
2649
+ process$3(parent, ctx, params);
2650
+ ctx.seen.get(parent).isParent = true;
2651
+ }
2652
+ }
2653
+ const meta$2 = ctx.metadataRegistry.get(schema);
2654
+ if (meta$2) Object.assign(result.schema, meta$2);
2655
+ if (ctx.io === "input" && isTransforming$1(schema)) {
2656
+ delete result.schema.examples;
2657
+ delete result.schema.default;
2658
+ }
2659
+ if (ctx.io === "input" && result.schema._prefault) (_a$2 = result.schema).default ?? (_a$2.default = result.schema._prefault);
2660
+ delete result.schema._prefault;
2661
+ return ctx.seen.get(schema).schema;
2662
+ }
2663
+ function extractDefs$1(ctx, schema) {
2664
+ const root = ctx.seen.get(schema);
2665
+ if (!root) throw new Error("Unprocessed schema. This is a bug in Zod.");
2666
+ const idToSchema = /* @__PURE__ */ new Map();
2667
+ for (const entry of ctx.seen.entries()) {
2668
+ const id = ctx.metadataRegistry.get(entry[0])?.id;
2669
+ if (id) {
2670
+ const existing = idToSchema.get(id);
2671
+ 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.`);
2672
+ idToSchema.set(id, entry[0]);
2673
+ }
2674
+ }
2675
+ const makeURI = (entry) => {
2676
+ const defsSegment = ctx.target === "draft-2020-12" ? "$defs" : "definitions";
2677
+ if (ctx.external) {
2678
+ const externalId = ctx.external.registry.get(entry[0])?.id;
2679
+ const uriGenerator = ctx.external.uri ?? ((id$1) => id$1);
2680
+ if (externalId) return { ref: uriGenerator(externalId) };
2681
+ const id = entry[1].defId ?? entry[1].schema.id ?? `schema${ctx.counter++}`;
2682
+ entry[1].defId = id;
2683
+ return {
2684
+ defId: id,
2685
+ ref: `${uriGenerator("__shared")}#/${defsSegment}/${id}`
2686
+ };
2687
+ }
2688
+ if (entry[1] === root) return { ref: "#" };
2689
+ const defUriPrefix = `#/${defsSegment}/`;
2690
+ const defId = entry[1].schema.id ?? `__schema${ctx.counter++}`;
2691
+ return {
2692
+ defId,
2693
+ ref: defUriPrefix + defId
2694
+ };
2695
+ };
2696
+ const extractToDef = (entry) => {
2697
+ if (entry[1].schema.$ref) return;
2698
+ const seen = entry[1];
2699
+ const { ref, defId } = makeURI(entry);
2700
+ seen.def = { ...seen.schema };
2701
+ if (defId) seen.defId = defId;
2702
+ const schema$1 = seen.schema;
2703
+ for (const key in schema$1) delete schema$1[key];
2704
+ schema$1.$ref = ref;
2705
+ };
2706
+ if (ctx.cycles === "throw") for (const entry of ctx.seen.entries()) {
2707
+ const seen = entry[1];
2708
+ if (seen.cycle) throw new Error(`Cycle detected: #/${seen.cycle?.join("/")}/<root>
2709
+
2710
+ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.`);
2711
+ }
2712
+ for (const entry of ctx.seen.entries()) {
2713
+ const seen = entry[1];
2714
+ if (schema === entry[0]) {
2715
+ extractToDef(entry);
2716
+ continue;
2717
+ }
2718
+ if (ctx.external) {
2719
+ const ext = ctx.external.registry.get(entry[0])?.id;
2720
+ if (schema !== entry[0] && ext) {
2721
+ extractToDef(entry);
2722
+ continue;
2723
+ }
2724
+ }
2725
+ if (ctx.metadataRegistry.get(entry[0])?.id) {
2726
+ extractToDef(entry);
2727
+ continue;
2728
+ }
2729
+ if (seen.cycle) {
2730
+ extractToDef(entry);
2731
+ continue;
2732
+ }
2733
+ if (seen.count > 1) {
2734
+ if (ctx.reused === "ref") {
2735
+ extractToDef(entry);
2736
+ continue;
2737
+ }
2738
+ }
2739
+ }
2740
+ }
2741
+ function finalize$1(ctx, schema) {
2742
+ const root = ctx.seen.get(schema);
2743
+ if (!root) throw new Error("Unprocessed schema. This is a bug in Zod.");
2744
+ const flattenRef = (zodSchema) => {
2745
+ const seen = ctx.seen.get(zodSchema);
2746
+ if (seen.ref === null) return;
2747
+ const schema$1 = seen.def ?? seen.schema;
2748
+ const _cached = { ...schema$1 };
2749
+ const ref = seen.ref;
2750
+ seen.ref = null;
2751
+ if (ref) {
2752
+ flattenRef(ref);
2753
+ const refSeen = ctx.seen.get(ref);
2754
+ const refSchema = refSeen.schema;
2755
+ if (refSchema.$ref && (ctx.target === "draft-07" || ctx.target === "draft-04" || ctx.target === "openapi-3.0")) {
2756
+ schema$1.allOf = schema$1.allOf ?? [];
2757
+ schema$1.allOf.push(refSchema);
2758
+ } else Object.assign(schema$1, refSchema);
2759
+ Object.assign(schema$1, _cached);
2760
+ if (zodSchema._zod.parent === ref) for (const key in schema$1) {
2761
+ if (key === "$ref" || key === "allOf") continue;
2762
+ if (!(key in _cached)) delete schema$1[key];
2763
+ }
2764
+ if (refSchema.$ref && refSeen.def) for (const key in schema$1) {
2765
+ if (key === "$ref" || key === "allOf") continue;
2766
+ if (key in refSeen.def && JSON.stringify(schema$1[key]) === JSON.stringify(refSeen.def[key])) delete schema$1[key];
2767
+ }
2768
+ }
2769
+ const parent = zodSchema._zod.parent;
2770
+ if (parent && parent !== ref) {
2771
+ flattenRef(parent);
2772
+ const parentSeen = ctx.seen.get(parent);
2773
+ if (parentSeen?.schema.$ref) {
2774
+ schema$1.$ref = parentSeen.schema.$ref;
2775
+ if (parentSeen.def) for (const key in schema$1) {
2776
+ if (key === "$ref" || key === "allOf") continue;
2777
+ if (key in parentSeen.def && JSON.stringify(schema$1[key]) === JSON.stringify(parentSeen.def[key])) delete schema$1[key];
2778
+ }
2779
+ }
2780
+ }
2781
+ ctx.override({
2782
+ zodSchema,
2783
+ jsonSchema: schema$1,
2784
+ path: seen.path ?? []
2785
+ });
2786
+ };
2787
+ for (const entry of [...ctx.seen.entries()].reverse()) flattenRef(entry[0]);
2788
+ const result = {};
2789
+ if (ctx.target === "draft-2020-12") result.$schema = "https://json-schema.org/draft/2020-12/schema";
2790
+ else if (ctx.target === "draft-07") result.$schema = "http://json-schema.org/draft-07/schema#";
2791
+ else if (ctx.target === "draft-04") result.$schema = "http://json-schema.org/draft-04/schema#";
2792
+ else if (ctx.target === "openapi-3.0") {}
2793
+ if (ctx.external?.uri) {
2794
+ const id = ctx.external.registry.get(schema)?.id;
2795
+ if (!id) throw new Error("Schema is missing an `id` property");
2796
+ result.$id = ctx.external.uri(id);
2797
+ }
2798
+ Object.assign(result, root.def ?? root.schema);
2799
+ const defs = ctx.external?.defs ?? {};
2800
+ for (const entry of ctx.seen.entries()) {
2801
+ const seen = entry[1];
2802
+ if (seen.def && seen.defId) defs[seen.defId] = seen.def;
2803
+ }
2804
+ if (ctx.external) {} else if (Object.keys(defs).length > 0) if (ctx.target === "draft-2020-12") result.$defs = defs;
2805
+ else result.definitions = defs;
2806
+ try {
2807
+ const finalized = JSON.parse(JSON.stringify(result));
2808
+ Object.defineProperty(finalized, "~standard", {
2809
+ value: {
2810
+ ...schema["~standard"],
2811
+ jsonSchema: {
2812
+ input: createStandardJSONSchemaMethod$1(schema, "input", ctx.processors),
2813
+ output: createStandardJSONSchemaMethod$1(schema, "output", ctx.processors)
2814
+ }
2815
+ },
2816
+ enumerable: false,
2817
+ writable: false
2818
+ });
2819
+ return finalized;
2820
+ } catch (_err) {
2821
+ throw new Error("Error converting schema to JSON.");
2822
+ }
2823
+ }
2824
+ function isTransforming$1(_schema, _ctx) {
2825
+ const ctx = _ctx ?? { seen: /* @__PURE__ */ new Set() };
2826
+ if (ctx.seen.has(_schema)) return false;
2827
+ ctx.seen.add(_schema);
2828
+ const def = _schema._zod.def;
2829
+ if (def.type === "transform") return true;
2830
+ if (def.type === "array") return isTransforming$1(def.element, ctx);
2831
+ if (def.type === "set") return isTransforming$1(def.valueType, ctx);
2832
+ if (def.type === "lazy") return isTransforming$1(def.getter(), ctx);
2833
+ if (def.type === "promise" || def.type === "optional" || def.type === "nonoptional" || def.type === "nullable" || def.type === "readonly" || def.type === "default" || def.type === "prefault") return isTransforming$1(def.innerType, ctx);
2834
+ if (def.type === "intersection") return isTransforming$1(def.left, ctx) || isTransforming$1(def.right, ctx);
2835
+ if (def.type === "record" || def.type === "map") return isTransforming$1(def.keyType, ctx) || isTransforming$1(def.valueType, ctx);
2836
+ if (def.type === "pipe") return isTransforming$1(def.in, ctx) || isTransforming$1(def.out, ctx);
2837
+ if (def.type === "object") {
2838
+ for (const key in def.shape) if (isTransforming$1(def.shape[key], ctx)) return true;
2839
+ return false;
2840
+ }
2841
+ if (def.type === "union") {
2842
+ for (const option of def.options) if (isTransforming$1(option, ctx)) return true;
2843
+ return false;
2844
+ }
2845
+ if (def.type === "tuple") {
2846
+ for (const item of def.items) if (isTransforming$1(item, ctx)) return true;
2847
+ if (def.rest && isTransforming$1(def.rest, ctx)) return true;
2848
+ return false;
2849
+ }
2850
+ return false;
2851
+ }
2852
+ /**
2853
+ * Creates a toJSONSchema method for a schema instance.
2854
+ * This encapsulates the logic of initializing context, processing, extracting defs, and finalizing.
2855
+ */
2856
+ const createToJSONSchemaMethod$1 = (schema, processors = {}) => (params) => {
2857
+ const ctx = initializeContext$1({
2858
+ ...params,
2859
+ processors
2860
+ });
2861
+ process$3(schema, ctx);
2862
+ extractDefs$1(ctx, schema);
2863
+ return finalize$1(ctx, schema);
2864
+ };
2865
+ const createStandardJSONSchemaMethod$1 = (schema, io, processors = {}) => (params) => {
2866
+ const { libraryOptions, target } = params ?? {};
2867
+ const ctx = initializeContext$1({
2868
+ ...libraryOptions ?? {},
2869
+ target,
2870
+ io,
2871
+ processors
2872
+ });
2873
+ process$3(schema, ctx);
2874
+ extractDefs$1(ctx, schema);
2875
+ return finalize$1(ctx, schema);
2876
+ };
2877
+
2878
+ //#endregion
2879
+ //#region ../../node_modules/.bun/zod@4.3.6/node_modules/zod/v4/core/json-schema-processors.js
2880
+ const formatMap$1 = {
2881
+ guid: "uuid",
2882
+ url: "uri",
2883
+ datetime: "date-time",
2884
+ json_string: "json-string",
2885
+ regex: ""
2886
+ };
2887
+ const stringProcessor$1 = (schema, ctx, _json, _params) => {
2888
+ const json = _json;
2889
+ json.type = "string";
2890
+ const { minimum, maximum, format, patterns, contentEncoding } = schema._zod.bag;
2891
+ if (typeof minimum === "number") json.minLength = minimum;
2892
+ if (typeof maximum === "number") json.maxLength = maximum;
2893
+ if (format) {
2894
+ json.format = formatMap$1[format] ?? format;
2895
+ if (json.format === "") delete json.format;
2896
+ if (format === "time") delete json.format;
2897
+ }
2898
+ if (contentEncoding) json.contentEncoding = contentEncoding;
2899
+ if (patterns && patterns.size > 0) {
2900
+ const regexes = [...patterns];
2901
+ if (regexes.length === 1) json.pattern = regexes[0].source;
2902
+ else if (regexes.length > 1) json.allOf = [...regexes.map((regex) => ({
2903
+ ...ctx.target === "draft-07" || ctx.target === "draft-04" || ctx.target === "openapi-3.0" ? { type: "string" } : {},
2904
+ pattern: regex.source
2905
+ }))];
2906
+ }
2907
+ };
2908
+ const numberProcessor$1 = (schema, ctx, _json, _params) => {
2909
+ const json = _json;
2910
+ const { minimum, maximum, format, multipleOf, exclusiveMaximum, exclusiveMinimum } = schema._zod.bag;
2911
+ if (typeof format === "string" && format.includes("int")) json.type = "integer";
2912
+ else json.type = "number";
2913
+ if (typeof exclusiveMinimum === "number") if (ctx.target === "draft-04" || ctx.target === "openapi-3.0") {
2914
+ json.minimum = exclusiveMinimum;
2915
+ json.exclusiveMinimum = true;
2916
+ } else json.exclusiveMinimum = exclusiveMinimum;
2917
+ if (typeof minimum === "number") {
2918
+ json.minimum = minimum;
2919
+ if (typeof exclusiveMinimum === "number" && ctx.target !== "draft-04") if (exclusiveMinimum >= minimum) delete json.minimum;
2920
+ else delete json.exclusiveMinimum;
2921
+ }
2922
+ if (typeof exclusiveMaximum === "number") if (ctx.target === "draft-04" || ctx.target === "openapi-3.0") {
2923
+ json.maximum = exclusiveMaximum;
2924
+ json.exclusiveMaximum = true;
2925
+ } else json.exclusiveMaximum = exclusiveMaximum;
2926
+ if (typeof maximum === "number") {
2927
+ json.maximum = maximum;
2928
+ if (typeof exclusiveMaximum === "number" && ctx.target !== "draft-04") if (exclusiveMaximum <= maximum) delete json.maximum;
2929
+ else delete json.exclusiveMaximum;
2930
+ }
2931
+ if (typeof multipleOf === "number") json.multipleOf = multipleOf;
2932
+ };
2933
+ const neverProcessor$1 = (_schema, _ctx, json, _params) => {
2934
+ json.not = {};
2935
+ };
2936
+ const unknownProcessor$1 = (_schema, _ctx, _json, _params) => {};
2937
+ const enumProcessor$1 = (schema, _ctx, json, _params) => {
2938
+ const def = schema._zod.def;
2939
+ const values = getEnumValues$1(def.entries);
2940
+ if (values.every((v) => typeof v === "number")) json.type = "number";
2941
+ if (values.every((v) => typeof v === "string")) json.type = "string";
2942
+ json.enum = values;
2943
+ };
2944
+ const customProcessor$1 = (_schema, ctx, _json, _params) => {
2945
+ if (ctx.unrepresentable === "throw") throw new Error("Custom types cannot be represented in JSON Schema");
2946
+ };
2947
+ const transformProcessor$1 = (_schema, ctx, _json, _params) => {
2948
+ if (ctx.unrepresentable === "throw") throw new Error("Transforms cannot be represented in JSON Schema");
2949
+ };
2950
+ const arrayProcessor$1 = (schema, ctx, _json, params) => {
2951
+ const json = _json;
2952
+ const def = schema._zod.def;
2953
+ const { minimum, maximum } = schema._zod.bag;
2954
+ if (typeof minimum === "number") json.minItems = minimum;
2955
+ if (typeof maximum === "number") json.maxItems = maximum;
2956
+ json.type = "array";
2957
+ json.items = process$3(def.element, ctx, {
2958
+ ...params,
2959
+ path: [...params.path, "items"]
2960
+ });
2961
+ };
2962
+ const objectProcessor$1 = (schema, ctx, _json, params) => {
2963
+ const json = _json;
2964
+ const def = schema._zod.def;
2965
+ json.type = "object";
2966
+ json.properties = {};
2967
+ const shape = def.shape;
2968
+ for (const key in shape) json.properties[key] = process$3(shape[key], ctx, {
2969
+ ...params,
2970
+ path: [
2971
+ ...params.path,
2972
+ "properties",
2973
+ key
2974
+ ]
2975
+ });
2976
+ const allKeys = new Set(Object.keys(shape));
2977
+ const requiredKeys = new Set([...allKeys].filter((key) => {
2978
+ const v = def.shape[key]._zod;
2979
+ if (ctx.io === "input") return v.optin === void 0;
2980
+ else return v.optout === void 0;
2981
+ }));
2982
+ if (requiredKeys.size > 0) json.required = Array.from(requiredKeys);
2983
+ if (def.catchall?._zod.def.type === "never") json.additionalProperties = false;
2984
+ else if (!def.catchall) {
2985
+ if (ctx.io === "output") json.additionalProperties = false;
2986
+ } else if (def.catchall) json.additionalProperties = process$3(def.catchall, ctx, {
2987
+ ...params,
2988
+ path: [...params.path, "additionalProperties"]
2989
+ });
2990
+ };
2991
+ const unionProcessor$1 = (schema, ctx, json, params) => {
2992
+ const def = schema._zod.def;
2993
+ const isExclusive = def.inclusive === false;
2994
+ const options = def.options.map((x, i) => process$3(x, ctx, {
2995
+ ...params,
2996
+ path: [
2997
+ ...params.path,
2998
+ isExclusive ? "oneOf" : "anyOf",
2999
+ i
3000
+ ]
3001
+ }));
3002
+ if (isExclusive) json.oneOf = options;
3003
+ else json.anyOf = options;
3004
+ };
3005
+ const intersectionProcessor$1 = (schema, ctx, json, params) => {
3006
+ const def = schema._zod.def;
3007
+ const a = process$3(def.left, ctx, {
3008
+ ...params,
3009
+ path: [
3010
+ ...params.path,
3011
+ "allOf",
3012
+ 0
3013
+ ]
3014
+ });
3015
+ const b = process$3(def.right, ctx, {
3016
+ ...params,
3017
+ path: [
3018
+ ...params.path,
3019
+ "allOf",
3020
+ 1
3021
+ ]
3022
+ });
3023
+ const isSimpleIntersection = (val) => "allOf" in val && Object.keys(val).length === 1;
3024
+ json.allOf = [...isSimpleIntersection(a) ? a.allOf : [a], ...isSimpleIntersection(b) ? b.allOf : [b]];
3025
+ };
3026
+ const nullableProcessor$1 = (schema, ctx, json, params) => {
3027
+ const def = schema._zod.def;
3028
+ const inner = process$3(def.innerType, ctx, params);
3029
+ const seen = ctx.seen.get(schema);
3030
+ if (ctx.target === "openapi-3.0") {
3031
+ seen.ref = def.innerType;
3032
+ json.nullable = true;
3033
+ } else json.anyOf = [inner, { type: "null" }];
3034
+ };
3035
+ const nonoptionalProcessor$1 = (schema, ctx, _json, params) => {
3036
+ const def = schema._zod.def;
3037
+ process$3(def.innerType, ctx, params);
3038
+ const seen = ctx.seen.get(schema);
3039
+ seen.ref = def.innerType;
3040
+ };
3041
+ const defaultProcessor$1 = (schema, ctx, json, params) => {
3042
+ const def = schema._zod.def;
3043
+ process$3(def.innerType, ctx, params);
3044
+ const seen = ctx.seen.get(schema);
3045
+ seen.ref = def.innerType;
3046
+ json.default = JSON.parse(JSON.stringify(def.defaultValue));
3047
+ };
3048
+ const prefaultProcessor$1 = (schema, ctx, json, params) => {
3049
+ const def = schema._zod.def;
3050
+ process$3(def.innerType, ctx, params);
3051
+ const seen = ctx.seen.get(schema);
3052
+ seen.ref = def.innerType;
3053
+ if (ctx.io === "input") json._prefault = JSON.parse(JSON.stringify(def.defaultValue));
3054
+ };
3055
+ const catchProcessor$1 = (schema, ctx, json, params) => {
3056
+ const def = schema._zod.def;
3057
+ process$3(def.innerType, ctx, params);
3058
+ const seen = ctx.seen.get(schema);
3059
+ seen.ref = def.innerType;
3060
+ let catchValue;
3061
+ try {
3062
+ catchValue = def.catchValue(void 0);
3063
+ } catch {
3064
+ throw new Error("Dynamic catch values are not supported in JSON Schema");
3065
+ }
3066
+ json.default = catchValue;
3067
+ };
3068
+ const pipeProcessor$1 = (schema, ctx, _json, params) => {
3069
+ const def = schema._zod.def;
3070
+ const innerType = ctx.io === "input" ? def.in._zod.def.type === "transform" ? def.out : def.in : def.out;
3071
+ process$3(innerType, ctx, params);
3072
+ const seen = ctx.seen.get(schema);
3073
+ seen.ref = innerType;
3074
+ };
3075
+ const readonlyProcessor$1 = (schema, ctx, json, params) => {
3076
+ const def = schema._zod.def;
3077
+ process$3(def.innerType, ctx, params);
3078
+ const seen = ctx.seen.get(schema);
3079
+ seen.ref = def.innerType;
3080
+ json.readOnly = true;
3081
+ };
3082
+ const optionalProcessor$1 = (schema, ctx, _json, params) => {
3083
+ const def = schema._zod.def;
3084
+ process$3(def.innerType, ctx, params);
3085
+ const seen = ctx.seen.get(schema);
3086
+ seen.ref = def.innerType;
3087
+ };
3088
+
3089
+ //#endregion
3090
+ //#region ../../node_modules/.bun/zod@4.3.6/node_modules/zod/v4/classic/iso.js
3091
+ const ZodISODateTime$1 = /* @__PURE__ */ $constructor$1("ZodISODateTime", (inst, def) => {
3092
+ $ZodISODateTime$1.init(inst, def);
3093
+ ZodStringFormat$1.init(inst, def);
3094
+ });
3095
+ function datetime$2(params) {
3096
+ return _isoDateTime$1(ZodISODateTime$1, params);
3097
+ }
3098
+ const ZodISODate$1 = /* @__PURE__ */ $constructor$1("ZodISODate", (inst, def) => {
3099
+ $ZodISODate$1.init(inst, def);
3100
+ ZodStringFormat$1.init(inst, def);
3101
+ });
3102
+ function date$2(params) {
3103
+ return _isoDate$1(ZodISODate$1, params);
3104
+ }
3105
+ const ZodISOTime$1 = /* @__PURE__ */ $constructor$1("ZodISOTime", (inst, def) => {
3106
+ $ZodISOTime$1.init(inst, def);
3107
+ ZodStringFormat$1.init(inst, def);
3108
+ });
3109
+ function time$2(params) {
3110
+ return _isoTime$1(ZodISOTime$1, params);
3111
+ }
3112
+ const ZodISODuration$1 = /* @__PURE__ */ $constructor$1("ZodISODuration", (inst, def) => {
3113
+ $ZodISODuration$1.init(inst, def);
3114
+ ZodStringFormat$1.init(inst, def);
3115
+ });
3116
+ function duration$2(params) {
3117
+ return _isoDuration$1(ZodISODuration$1, params);
3118
+ }
3119
+
3120
+ //#endregion
3121
+ //#region ../../node_modules/.bun/zod@4.3.6/node_modules/zod/v4/classic/errors.js
3122
+ const initializer$2 = (inst, issues) => {
3123
+ $ZodError$1.init(inst, issues);
3124
+ inst.name = "ZodError";
3125
+ Object.defineProperties(inst, {
3126
+ format: { value: (mapper) => formatError$1(inst, mapper) },
3127
+ flatten: { value: (mapper) => flattenError$1(inst, mapper) },
3128
+ addIssue: { value: (issue$2) => {
3129
+ inst.issues.push(issue$2);
3130
+ inst.message = JSON.stringify(inst.issues, jsonStringifyReplacer$1, 2);
3131
+ } },
3132
+ addIssues: { value: (issues$1) => {
3133
+ inst.issues.push(...issues$1);
3134
+ inst.message = JSON.stringify(inst.issues, jsonStringifyReplacer$1, 2);
3135
+ } },
3136
+ isEmpty: { get() {
3137
+ return inst.issues.length === 0;
3138
+ } }
3139
+ });
3140
+ };
3141
+ const ZodError = $constructor$1("ZodError", initializer$2);
3142
+ const ZodRealError$1 = $constructor$1("ZodError", initializer$2, { Parent: Error });
3143
+
3144
+ //#endregion
3145
+ //#region ../../node_modules/.bun/zod@4.3.6/node_modules/zod/v4/classic/parse.js
3146
+ const parse$1 = /* @__PURE__ */ _parse$1(ZodRealError$1);
3147
+ const parseAsync$1 = /* @__PURE__ */ _parseAsync$1(ZodRealError$1);
3148
+ const safeParse$2 = /* @__PURE__ */ _safeParse$1(ZodRealError$1);
3149
+ const safeParseAsync$2 = /* @__PURE__ */ _safeParseAsync$1(ZodRealError$1);
3150
+ const encode$1 = /* @__PURE__ */ _encode$1(ZodRealError$1);
3151
+ const decode$1 = /* @__PURE__ */ _decode$1(ZodRealError$1);
3152
+ const encodeAsync$1 = /* @__PURE__ */ _encodeAsync$1(ZodRealError$1);
3153
+ const decodeAsync$1 = /* @__PURE__ */ _decodeAsync$1(ZodRealError$1);
3154
+ const safeEncode$1 = /* @__PURE__ */ _safeEncode$1(ZodRealError$1);
3155
+ const safeDecode$1 = /* @__PURE__ */ _safeDecode$1(ZodRealError$1);
3156
+ const safeEncodeAsync$1 = /* @__PURE__ */ _safeEncodeAsync$1(ZodRealError$1);
3157
+ const safeDecodeAsync$1 = /* @__PURE__ */ _safeDecodeAsync$1(ZodRealError$1);
3158
+
3159
+ //#endregion
3160
+ //#region ../../node_modules/.bun/zod@4.3.6/node_modules/zod/v4/classic/schemas.js
3161
+ const ZodType$1 = /* @__PURE__ */ $constructor$1("ZodType", (inst, def) => {
3162
+ $ZodType$1.init(inst, def);
3163
+ Object.assign(inst["~standard"], { jsonSchema: {
3164
+ input: createStandardJSONSchemaMethod$1(inst, "input"),
3165
+ output: createStandardJSONSchemaMethod$1(inst, "output")
3166
+ } });
3167
+ inst.toJSONSchema = createToJSONSchemaMethod$1(inst, {});
3168
+ inst.def = def;
3169
+ inst.type = def.type;
3170
+ Object.defineProperty(inst, "_def", { value: def });
3171
+ inst.check = (...checks) => {
3172
+ return inst.clone(mergeDefs$1(def, { checks: [...def.checks ?? [], ...checks.map((ch) => typeof ch === "function" ? { _zod: {
3173
+ check: ch,
3174
+ def: { check: "custom" },
3175
+ onattach: []
3176
+ } } : ch)] }), { parent: true });
3177
+ };
3178
+ inst.with = inst.check;
3179
+ inst.clone = (def$1, params) => clone$1(inst, def$1, params);
3180
+ inst.brand = () => inst;
3181
+ inst.register = ((reg, meta$2) => {
3182
+ reg.add(inst, meta$2);
3183
+ return inst;
3184
+ });
3185
+ inst.parse = (data, params) => parse$1(inst, data, params, { callee: inst.parse });
3186
+ inst.safeParse = (data, params) => safeParse$2(inst, data, params);
3187
+ inst.parseAsync = async (data, params) => parseAsync$1(inst, data, params, { callee: inst.parseAsync });
3188
+ inst.safeParseAsync = async (data, params) => safeParseAsync$2(inst, data, params);
3189
+ inst.spa = inst.safeParseAsync;
3190
+ inst.encode = (data, params) => encode$1(inst, data, params);
3191
+ inst.decode = (data, params) => decode$1(inst, data, params);
3192
+ inst.encodeAsync = async (data, params) => encodeAsync$1(inst, data, params);
3193
+ inst.decodeAsync = async (data, params) => decodeAsync$1(inst, data, params);
3194
+ inst.safeEncode = (data, params) => safeEncode$1(inst, data, params);
3195
+ inst.safeDecode = (data, params) => safeDecode$1(inst, data, params);
3196
+ inst.safeEncodeAsync = async (data, params) => safeEncodeAsync$1(inst, data, params);
3197
+ inst.safeDecodeAsync = async (data, params) => safeDecodeAsync$1(inst, data, params);
3198
+ inst.refine = (check, params) => inst.check(refine$1(check, params));
3199
+ inst.superRefine = (refinement) => inst.check(superRefine$1(refinement));
3200
+ inst.overwrite = (fn) => inst.check(_overwrite$1(fn));
3201
+ inst.optional = () => optional$1(inst);
3202
+ inst.exactOptional = () => exactOptional$1(inst);
3203
+ inst.nullable = () => nullable$1(inst);
3204
+ inst.nullish = () => optional$1(nullable$1(inst));
3205
+ inst.nonoptional = (params) => nonoptional$1(inst, params);
3206
+ inst.array = () => array$1(inst);
3207
+ inst.or = (arg) => union$1([inst, arg]);
3208
+ inst.and = (arg) => intersection$1(inst, arg);
3209
+ inst.transform = (tx) => pipe$1(inst, transform$1(tx));
3210
+ inst.default = (def$1) => _default$1(inst, def$1);
3211
+ inst.prefault = (def$1) => prefault$1(inst, def$1);
3212
+ inst.catch = (params) => _catch$1(inst, params);
3213
+ inst.pipe = (target) => pipe$1(inst, target);
3214
+ inst.readonly = () => readonly$1(inst);
3215
+ inst.describe = (description) => {
3216
+ const cl = inst.clone();
3217
+ globalRegistry$1.add(cl, { description });
3218
+ return cl;
3219
+ };
3220
+ Object.defineProperty(inst, "description", {
3221
+ get() {
3222
+ return globalRegistry$1.get(inst)?.description;
3223
+ },
3224
+ configurable: true
3225
+ });
3226
+ inst.meta = (...args) => {
3227
+ if (args.length === 0) return globalRegistry$1.get(inst);
3228
+ const cl = inst.clone();
3229
+ globalRegistry$1.add(cl, args[0]);
3230
+ return cl;
3231
+ };
3232
+ inst.isOptional = () => inst.safeParse(void 0).success;
3233
+ inst.isNullable = () => inst.safeParse(null).success;
3234
+ inst.apply = (fn) => fn(inst);
3235
+ return inst;
3236
+ });
3237
+ /** @internal */
3238
+ const _ZodString$1 = /* @__PURE__ */ $constructor$1("_ZodString", (inst, def) => {
3239
+ $ZodString$1.init(inst, def);
3240
+ ZodType$1.init(inst, def);
3241
+ inst._zod.processJSONSchema = (ctx, json, params) => stringProcessor$1(inst, ctx, json, params);
3242
+ const bag = inst._zod.bag;
3243
+ inst.format = bag.format ?? null;
3244
+ inst.minLength = bag.minimum ?? null;
3245
+ inst.maxLength = bag.maximum ?? null;
3246
+ inst.regex = (...args) => inst.check(_regex$1(...args));
3247
+ inst.includes = (...args) => inst.check(_includes$1(...args));
3248
+ inst.startsWith = (...args) => inst.check(_startsWith$1(...args));
3249
+ inst.endsWith = (...args) => inst.check(_endsWith$1(...args));
3250
+ inst.min = (...args) => inst.check(_minLength$1(...args));
3251
+ inst.max = (...args) => inst.check(_maxLength$1(...args));
3252
+ inst.length = (...args) => inst.check(_length$1(...args));
3253
+ inst.nonempty = (...args) => inst.check(_minLength$1(1, ...args));
3254
+ inst.lowercase = (params) => inst.check(_lowercase$1(params));
3255
+ inst.uppercase = (params) => inst.check(_uppercase$1(params));
3256
+ inst.trim = () => inst.check(_trim$1());
3257
+ inst.normalize = (...args) => inst.check(_normalize$1(...args));
3258
+ inst.toLowerCase = () => inst.check(_toLowerCase$1());
3259
+ inst.toUpperCase = () => inst.check(_toUpperCase$1());
3260
+ inst.slugify = () => inst.check(_slugify$1());
3261
+ });
3262
+ const ZodString$1 = /* @__PURE__ */ $constructor$1("ZodString", (inst, def) => {
3263
+ $ZodString$1.init(inst, def);
3264
+ _ZodString$1.init(inst, def);
3265
+ inst.email = (params) => inst.check(_email$1(ZodEmail$1, params));
3266
+ inst.url = (params) => inst.check(_url$1(ZodURL$1, params));
3267
+ inst.jwt = (params) => inst.check(_jwt$1(ZodJWT$1, params));
3268
+ inst.emoji = (params) => inst.check(_emoji$2(ZodEmoji$1, params));
3269
+ inst.guid = (params) => inst.check(_guid$1(ZodGUID$1, params));
3270
+ inst.uuid = (params) => inst.check(_uuid$1(ZodUUID$1, params));
3271
+ inst.uuidv4 = (params) => inst.check(_uuidv4$1(ZodUUID$1, params));
3272
+ inst.uuidv6 = (params) => inst.check(_uuidv6$1(ZodUUID$1, params));
3273
+ inst.uuidv7 = (params) => inst.check(_uuidv7$1(ZodUUID$1, params));
3274
+ inst.nanoid = (params) => inst.check(_nanoid$1(ZodNanoID$1, params));
3275
+ inst.guid = (params) => inst.check(_guid$1(ZodGUID$1, params));
3276
+ inst.cuid = (params) => inst.check(_cuid$1(ZodCUID$1, params));
3277
+ inst.cuid2 = (params) => inst.check(_cuid2$1(ZodCUID2$1, params));
3278
+ inst.ulid = (params) => inst.check(_ulid$1(ZodULID$1, params));
3279
+ inst.base64 = (params) => inst.check(_base64$1(ZodBase64$1, params));
3280
+ inst.base64url = (params) => inst.check(_base64url$1(ZodBase64URL$1, params));
3281
+ inst.xid = (params) => inst.check(_xid$1(ZodXID$1, params));
3282
+ inst.ksuid = (params) => inst.check(_ksuid$1(ZodKSUID$1, params));
3283
+ inst.ipv4 = (params) => inst.check(_ipv4$1(ZodIPv4$1, params));
3284
+ inst.ipv6 = (params) => inst.check(_ipv6$1(ZodIPv6$1, params));
3285
+ inst.cidrv4 = (params) => inst.check(_cidrv4$1(ZodCIDRv4$1, params));
3286
+ inst.cidrv6 = (params) => inst.check(_cidrv6$1(ZodCIDRv6$1, params));
3287
+ inst.e164 = (params) => inst.check(_e164$1(ZodE164$1, params));
3288
+ inst.datetime = (params) => inst.check(datetime$2(params));
3289
+ inst.date = (params) => inst.check(date$2(params));
3290
+ inst.time = (params) => inst.check(time$2(params));
3291
+ inst.duration = (params) => inst.check(duration$2(params));
3292
+ });
3293
+ function string$2(params) {
3294
+ return _string$1(ZodString$1, params);
3295
+ }
3296
+ const ZodStringFormat$1 = /* @__PURE__ */ $constructor$1("ZodStringFormat", (inst, def) => {
3297
+ $ZodStringFormat$1.init(inst, def);
3298
+ _ZodString$1.init(inst, def);
3299
+ });
3300
+ const ZodEmail$1 = /* @__PURE__ */ $constructor$1("ZodEmail", (inst, def) => {
3301
+ $ZodEmail$1.init(inst, def);
3302
+ ZodStringFormat$1.init(inst, def);
3303
+ });
3304
+ const ZodGUID$1 = /* @__PURE__ */ $constructor$1("ZodGUID", (inst, def) => {
3305
+ $ZodGUID$1.init(inst, def);
3306
+ ZodStringFormat$1.init(inst, def);
3307
+ });
3308
+ const ZodUUID$1 = /* @__PURE__ */ $constructor$1("ZodUUID", (inst, def) => {
3309
+ $ZodUUID$1.init(inst, def);
3310
+ ZodStringFormat$1.init(inst, def);
3311
+ });
3312
+ const ZodURL$1 = /* @__PURE__ */ $constructor$1("ZodURL", (inst, def) => {
3313
+ $ZodURL$1.init(inst, def);
3314
+ ZodStringFormat$1.init(inst, def);
3315
+ });
3316
+ const ZodEmoji$1 = /* @__PURE__ */ $constructor$1("ZodEmoji", (inst, def) => {
3317
+ $ZodEmoji$1.init(inst, def);
3318
+ ZodStringFormat$1.init(inst, def);
3319
+ });
3320
+ const ZodNanoID$1 = /* @__PURE__ */ $constructor$1("ZodNanoID", (inst, def) => {
3321
+ $ZodNanoID$1.init(inst, def);
3322
+ ZodStringFormat$1.init(inst, def);
3323
+ });
3324
+ const ZodCUID$1 = /* @__PURE__ */ $constructor$1("ZodCUID", (inst, def) => {
3325
+ $ZodCUID$1.init(inst, def);
3326
+ ZodStringFormat$1.init(inst, def);
3327
+ });
3328
+ const ZodCUID2$1 = /* @__PURE__ */ $constructor$1("ZodCUID2", (inst, def) => {
3329
+ $ZodCUID2$1.init(inst, def);
3330
+ ZodStringFormat$1.init(inst, def);
3331
+ });
3332
+ const ZodULID$1 = /* @__PURE__ */ $constructor$1("ZodULID", (inst, def) => {
3333
+ $ZodULID$1.init(inst, def);
3334
+ ZodStringFormat$1.init(inst, def);
3335
+ });
3336
+ const ZodXID$1 = /* @__PURE__ */ $constructor$1("ZodXID", (inst, def) => {
3337
+ $ZodXID$1.init(inst, def);
3338
+ ZodStringFormat$1.init(inst, def);
3339
+ });
3340
+ const ZodKSUID$1 = /* @__PURE__ */ $constructor$1("ZodKSUID", (inst, def) => {
3341
+ $ZodKSUID$1.init(inst, def);
3342
+ ZodStringFormat$1.init(inst, def);
3343
+ });
3344
+ const ZodIPv4$1 = /* @__PURE__ */ $constructor$1("ZodIPv4", (inst, def) => {
3345
+ $ZodIPv4$1.init(inst, def);
3346
+ ZodStringFormat$1.init(inst, def);
3347
+ });
3348
+ const ZodIPv6$1 = /* @__PURE__ */ $constructor$1("ZodIPv6", (inst, def) => {
3349
+ $ZodIPv6$1.init(inst, def);
3350
+ ZodStringFormat$1.init(inst, def);
3351
+ });
3352
+ const ZodCIDRv4$1 = /* @__PURE__ */ $constructor$1("ZodCIDRv4", (inst, def) => {
3353
+ $ZodCIDRv4$1.init(inst, def);
3354
+ ZodStringFormat$1.init(inst, def);
3355
+ });
3356
+ const ZodCIDRv6$1 = /* @__PURE__ */ $constructor$1("ZodCIDRv6", (inst, def) => {
3357
+ $ZodCIDRv6$1.init(inst, def);
3358
+ ZodStringFormat$1.init(inst, def);
3359
+ });
3360
+ const ZodBase64$1 = /* @__PURE__ */ $constructor$1("ZodBase64", (inst, def) => {
3361
+ $ZodBase64$1.init(inst, def);
3362
+ ZodStringFormat$1.init(inst, def);
3363
+ });
3364
+ const ZodBase64URL$1 = /* @__PURE__ */ $constructor$1("ZodBase64URL", (inst, def) => {
3365
+ $ZodBase64URL$1.init(inst, def);
3366
+ ZodStringFormat$1.init(inst, def);
3367
+ });
3368
+ const ZodE164$1 = /* @__PURE__ */ $constructor$1("ZodE164", (inst, def) => {
3369
+ $ZodE164$1.init(inst, def);
3370
+ ZodStringFormat$1.init(inst, def);
3371
+ });
3372
+ const ZodJWT$1 = /* @__PURE__ */ $constructor$1("ZodJWT", (inst, def) => {
3373
+ $ZodJWT$1.init(inst, def);
3374
+ ZodStringFormat$1.init(inst, def);
3375
+ });
3376
+ const ZodNumber$1 = /* @__PURE__ */ $constructor$1("ZodNumber", (inst, def) => {
3377
+ $ZodNumber$1.init(inst, def);
3378
+ ZodType$1.init(inst, def);
3379
+ inst._zod.processJSONSchema = (ctx, json, params) => numberProcessor$1(inst, ctx, json, params);
3380
+ inst.gt = (value, params) => inst.check(_gt$1(value, params));
3381
+ inst.gte = (value, params) => inst.check(_gte$1(value, params));
3382
+ inst.min = (value, params) => inst.check(_gte$1(value, params));
3383
+ inst.lt = (value, params) => inst.check(_lt$1(value, params));
3384
+ inst.lte = (value, params) => inst.check(_lte$1(value, params));
3385
+ inst.max = (value, params) => inst.check(_lte$1(value, params));
3386
+ inst.int = (params) => inst.check(int$1(params));
3387
+ inst.safe = (params) => inst.check(int$1(params));
3388
+ inst.positive = (params) => inst.check(_gt$1(0, params));
3389
+ inst.nonnegative = (params) => inst.check(_gte$1(0, params));
3390
+ inst.negative = (params) => inst.check(_lt$1(0, params));
3391
+ inst.nonpositive = (params) => inst.check(_lte$1(0, params));
3392
+ inst.multipleOf = (value, params) => inst.check(_multipleOf$1(value, params));
3393
+ inst.step = (value, params) => inst.check(_multipleOf$1(value, params));
3394
+ inst.finite = () => inst;
3395
+ const bag = inst._zod.bag;
3396
+ inst.minValue = Math.max(bag.minimum ?? Number.NEGATIVE_INFINITY, bag.exclusiveMinimum ?? Number.NEGATIVE_INFINITY) ?? null;
3397
+ inst.maxValue = Math.min(bag.maximum ?? Number.POSITIVE_INFINITY, bag.exclusiveMaximum ?? Number.POSITIVE_INFINITY) ?? null;
3398
+ inst.isInt = (bag.format ?? "").includes("int") || Number.isSafeInteger(bag.multipleOf ?? .5);
3399
+ inst.isFinite = true;
3400
+ inst.format = bag.format ?? null;
3401
+ });
3402
+ function number$2(params) {
3403
+ return _number$1(ZodNumber$1, params);
3404
+ }
3405
+ const ZodNumberFormat$1 = /* @__PURE__ */ $constructor$1("ZodNumberFormat", (inst, def) => {
3406
+ $ZodNumberFormat$1.init(inst, def);
3407
+ ZodNumber$1.init(inst, def);
3408
+ });
3409
+ function int$1(params) {
3410
+ return _int$1(ZodNumberFormat$1, params);
3411
+ }
3412
+ const ZodUnknown$1 = /* @__PURE__ */ $constructor$1("ZodUnknown", (inst, def) => {
3413
+ $ZodUnknown$1.init(inst, def);
3414
+ ZodType$1.init(inst, def);
3415
+ inst._zod.processJSONSchema = (ctx, json, params) => unknownProcessor$1(inst, ctx, json, params);
3416
+ });
3417
+ function unknown$1() {
3418
+ return _unknown$1(ZodUnknown$1);
3419
+ }
3420
+ const ZodNever$1 = /* @__PURE__ */ $constructor$1("ZodNever", (inst, def) => {
3421
+ $ZodNever$1.init(inst, def);
3422
+ ZodType$1.init(inst, def);
3423
+ inst._zod.processJSONSchema = (ctx, json, params) => neverProcessor$1(inst, ctx, json, params);
3424
+ });
3425
+ function never$1(params) {
3426
+ return _never$1(ZodNever$1, params);
3427
+ }
3428
+ const ZodArray$1 = /* @__PURE__ */ $constructor$1("ZodArray", (inst, def) => {
3429
+ $ZodArray$1.init(inst, def);
3430
+ ZodType$1.init(inst, def);
3431
+ inst._zod.processJSONSchema = (ctx, json, params) => arrayProcessor$1(inst, ctx, json, params);
3432
+ inst.element = def.element;
3433
+ inst.min = (minLength, params) => inst.check(_minLength$1(minLength, params));
3434
+ inst.nonempty = (params) => inst.check(_minLength$1(1, params));
3435
+ inst.max = (maxLength, params) => inst.check(_maxLength$1(maxLength, params));
3436
+ inst.length = (len, params) => inst.check(_length$1(len, params));
3437
+ inst.unwrap = () => inst.element;
3438
+ });
3439
+ function array$1(element, params) {
3440
+ return _array$1(ZodArray$1, element, params);
3441
+ }
3442
+ const ZodObject$1 = /* @__PURE__ */ $constructor$1("ZodObject", (inst, def) => {
3443
+ $ZodObjectJIT$1.init(inst, def);
3444
+ ZodType$1.init(inst, def);
3445
+ inst._zod.processJSONSchema = (ctx, json, params) => objectProcessor$1(inst, ctx, json, params);
3446
+ defineLazy$1(inst, "shape", () => {
3447
+ return def.shape;
3448
+ });
3449
+ inst.keyof = () => _enum$1(Object.keys(inst._zod.def.shape));
3450
+ inst.catchall = (catchall) => inst.clone({
3451
+ ...inst._zod.def,
3452
+ catchall
3453
+ });
3454
+ inst.passthrough = () => inst.clone({
3455
+ ...inst._zod.def,
3456
+ catchall: unknown$1()
3457
+ });
3458
+ inst.loose = () => inst.clone({
3459
+ ...inst._zod.def,
3460
+ catchall: unknown$1()
3461
+ });
3462
+ inst.strict = () => inst.clone({
3463
+ ...inst._zod.def,
3464
+ catchall: never$1()
3465
+ });
3466
+ inst.strip = () => inst.clone({
3467
+ ...inst._zod.def,
3468
+ catchall: void 0
3469
+ });
3470
+ inst.extend = (incoming) => {
3471
+ return extend$1(inst, incoming);
3472
+ };
3473
+ inst.safeExtend = (incoming) => {
3474
+ return safeExtend$1(inst, incoming);
3475
+ };
3476
+ inst.merge = (other) => merge$1(inst, other);
3477
+ inst.pick = (mask) => pick$1(inst, mask);
3478
+ inst.omit = (mask) => omit$1(inst, mask);
3479
+ inst.partial = (...args) => partial$1(ZodOptional$1, inst, args[0]);
3480
+ inst.required = (...args) => required$1(ZodNonOptional$1, inst, args[0]);
3481
+ });
3482
+ function object$1(shape, params) {
3483
+ return new ZodObject$1({
3484
+ type: "object",
3485
+ shape: shape ?? {},
3486
+ ...normalizeParams$1(params)
3487
+ });
3488
+ }
3489
+ const ZodUnion$1 = /* @__PURE__ */ $constructor$1("ZodUnion", (inst, def) => {
3490
+ $ZodUnion$1.init(inst, def);
3491
+ ZodType$1.init(inst, def);
3492
+ inst._zod.processJSONSchema = (ctx, json, params) => unionProcessor$1(inst, ctx, json, params);
3493
+ inst.options = def.options;
3494
+ });
3495
+ function union$1(options, params) {
3496
+ return new ZodUnion$1({
3497
+ type: "union",
3498
+ options,
3499
+ ...normalizeParams$1(params)
3500
+ });
3501
+ }
3502
+ const ZodIntersection$1 = /* @__PURE__ */ $constructor$1("ZodIntersection", (inst, def) => {
3503
+ $ZodIntersection$1.init(inst, def);
3504
+ ZodType$1.init(inst, def);
3505
+ inst._zod.processJSONSchema = (ctx, json, params) => intersectionProcessor$1(inst, ctx, json, params);
3506
+ });
3507
+ function intersection$1(left, right) {
3508
+ return new ZodIntersection$1({
3509
+ type: "intersection",
3510
+ left,
3511
+ right
3512
+ });
3513
+ }
3514
+ const ZodEnum$1 = /* @__PURE__ */ $constructor$1("ZodEnum", (inst, def) => {
3515
+ $ZodEnum$1.init(inst, def);
3516
+ ZodType$1.init(inst, def);
3517
+ inst._zod.processJSONSchema = (ctx, json, params) => enumProcessor$1(inst, ctx, json, params);
3518
+ inst.enum = def.entries;
3519
+ inst.options = Object.values(def.entries);
3520
+ const keys = new Set(Object.keys(def.entries));
3521
+ inst.extract = (values, params) => {
3522
+ const newEntries = {};
3523
+ for (const value of values) if (keys.has(value)) newEntries[value] = def.entries[value];
3524
+ else throw new Error(`Key ${value} not found in enum`);
3525
+ return new ZodEnum$1({
3526
+ ...def,
3527
+ checks: [],
3528
+ ...normalizeParams$1(params),
3529
+ entries: newEntries
3530
+ });
3531
+ };
3532
+ inst.exclude = (values, params) => {
3533
+ const newEntries = { ...def.entries };
3534
+ for (const value of values) if (keys.has(value)) delete newEntries[value];
3535
+ else throw new Error(`Key ${value} not found in enum`);
3536
+ return new ZodEnum$1({
3537
+ ...def,
3538
+ checks: [],
3539
+ ...normalizeParams$1(params),
3540
+ entries: newEntries
3541
+ });
3542
+ };
3543
+ });
3544
+ function _enum$1(values, params) {
3545
+ return new ZodEnum$1({
3546
+ type: "enum",
3547
+ entries: Array.isArray(values) ? Object.fromEntries(values.map((v) => [v, v])) : values,
3548
+ ...normalizeParams$1(params)
3549
+ });
3550
+ }
3551
+ const ZodTransform$1 = /* @__PURE__ */ $constructor$1("ZodTransform", (inst, def) => {
3552
+ $ZodTransform$1.init(inst, def);
3553
+ ZodType$1.init(inst, def);
3554
+ inst._zod.processJSONSchema = (ctx, json, params) => transformProcessor$1(inst, ctx, json, params);
3555
+ inst._zod.parse = (payload, _ctx) => {
3556
+ if (_ctx.direction === "backward") throw new $ZodEncodeError$1(inst.constructor.name);
3557
+ payload.addIssue = (issue$2) => {
3558
+ if (typeof issue$2 === "string") payload.issues.push(issue$1(issue$2, payload.value, def));
3559
+ else {
3560
+ const _issue = issue$2;
3561
+ if (_issue.fatal) _issue.continue = false;
3562
+ _issue.code ?? (_issue.code = "custom");
3563
+ _issue.input ?? (_issue.input = payload.value);
3564
+ _issue.inst ?? (_issue.inst = inst);
3565
+ payload.issues.push(issue$1(_issue));
3566
+ }
3567
+ };
3568
+ const output = def.transform(payload.value, payload);
3569
+ if (output instanceof Promise) return output.then((output$1) => {
3570
+ payload.value = output$1;
3571
+ return payload;
3572
+ });
3573
+ payload.value = output;
3574
+ return payload;
3575
+ };
3576
+ });
3577
+ function transform$1(fn) {
3578
+ return new ZodTransform$1({
3579
+ type: "transform",
3580
+ transform: fn
3581
+ });
3582
+ }
3583
+ const ZodOptional$1 = /* @__PURE__ */ $constructor$1("ZodOptional", (inst, def) => {
3584
+ $ZodOptional$1.init(inst, def);
3585
+ ZodType$1.init(inst, def);
3586
+ inst._zod.processJSONSchema = (ctx, json, params) => optionalProcessor$1(inst, ctx, json, params);
3587
+ inst.unwrap = () => inst._zod.def.innerType;
3588
+ });
3589
+ function optional$1(innerType) {
3590
+ return new ZodOptional$1({
3591
+ type: "optional",
3592
+ innerType
3593
+ });
3594
+ }
3595
+ const ZodExactOptional$1 = /* @__PURE__ */ $constructor$1("ZodExactOptional", (inst, def) => {
3596
+ $ZodExactOptional$1.init(inst, def);
3597
+ ZodType$1.init(inst, def);
3598
+ inst._zod.processJSONSchema = (ctx, json, params) => optionalProcessor$1(inst, ctx, json, params);
3599
+ inst.unwrap = () => inst._zod.def.innerType;
3600
+ });
3601
+ function exactOptional$1(innerType) {
3602
+ return new ZodExactOptional$1({
3603
+ type: "optional",
3604
+ innerType
3605
+ });
3606
+ }
3607
+ const ZodNullable$1 = /* @__PURE__ */ $constructor$1("ZodNullable", (inst, def) => {
3608
+ $ZodNullable$1.init(inst, def);
3609
+ ZodType$1.init(inst, def);
3610
+ inst._zod.processJSONSchema = (ctx, json, params) => nullableProcessor$1(inst, ctx, json, params);
3611
+ inst.unwrap = () => inst._zod.def.innerType;
3612
+ });
3613
+ function nullable$1(innerType) {
3614
+ return new ZodNullable$1({
3615
+ type: "nullable",
3616
+ innerType
3617
+ });
3618
+ }
3619
+ const ZodDefault$1 = /* @__PURE__ */ $constructor$1("ZodDefault", (inst, def) => {
3620
+ $ZodDefault$1.init(inst, def);
3621
+ ZodType$1.init(inst, def);
3622
+ inst._zod.processJSONSchema = (ctx, json, params) => defaultProcessor$1(inst, ctx, json, params);
3623
+ inst.unwrap = () => inst._zod.def.innerType;
3624
+ inst.removeDefault = inst.unwrap;
3625
+ });
3626
+ function _default$1(innerType, defaultValue) {
3627
+ return new ZodDefault$1({
3628
+ type: "default",
3629
+ innerType,
3630
+ get defaultValue() {
3631
+ return typeof defaultValue === "function" ? defaultValue() : shallowClone$1(defaultValue);
3632
+ }
3633
+ });
3634
+ }
3635
+ const ZodPrefault$1 = /* @__PURE__ */ $constructor$1("ZodPrefault", (inst, def) => {
3636
+ $ZodPrefault$1.init(inst, def);
3637
+ ZodType$1.init(inst, def);
3638
+ inst._zod.processJSONSchema = (ctx, json, params) => prefaultProcessor$1(inst, ctx, json, params);
3639
+ inst.unwrap = () => inst._zod.def.innerType;
3640
+ });
3641
+ function prefault$1(innerType, defaultValue) {
3642
+ return new ZodPrefault$1({
3643
+ type: "prefault",
3644
+ innerType,
3645
+ get defaultValue() {
3646
+ return typeof defaultValue === "function" ? defaultValue() : shallowClone$1(defaultValue);
3647
+ }
3648
+ });
3649
+ }
3650
+ const ZodNonOptional$1 = /* @__PURE__ */ $constructor$1("ZodNonOptional", (inst, def) => {
3651
+ $ZodNonOptional$1.init(inst, def);
3652
+ ZodType$1.init(inst, def);
3653
+ inst._zod.processJSONSchema = (ctx, json, params) => nonoptionalProcessor$1(inst, ctx, json, params);
3654
+ inst.unwrap = () => inst._zod.def.innerType;
3655
+ });
3656
+ function nonoptional$1(innerType, params) {
3657
+ return new ZodNonOptional$1({
3658
+ type: "nonoptional",
3659
+ innerType,
3660
+ ...normalizeParams$1(params)
3661
+ });
3662
+ }
3663
+ const ZodCatch$1 = /* @__PURE__ */ $constructor$1("ZodCatch", (inst, def) => {
3664
+ $ZodCatch$1.init(inst, def);
3665
+ ZodType$1.init(inst, def);
3666
+ inst._zod.processJSONSchema = (ctx, json, params) => catchProcessor$1(inst, ctx, json, params);
3667
+ inst.unwrap = () => inst._zod.def.innerType;
3668
+ inst.removeCatch = inst.unwrap;
3669
+ });
3670
+ function _catch$1(innerType, catchValue) {
3671
+ return new ZodCatch$1({
3672
+ type: "catch",
3673
+ innerType,
3674
+ catchValue: typeof catchValue === "function" ? catchValue : () => catchValue
3675
+ });
3676
+ }
3677
+ const ZodPipe$1 = /* @__PURE__ */ $constructor$1("ZodPipe", (inst, def) => {
3678
+ $ZodPipe$1.init(inst, def);
3679
+ ZodType$1.init(inst, def);
3680
+ inst._zod.processJSONSchema = (ctx, json, params) => pipeProcessor$1(inst, ctx, json, params);
3681
+ inst.in = def.in;
3682
+ inst.out = def.out;
3683
+ });
3684
+ function pipe$1(in_, out) {
3685
+ return new ZodPipe$1({
3686
+ type: "pipe",
3687
+ in: in_,
3688
+ out
3689
+ });
3690
+ }
3691
+ const ZodReadonly$1 = /* @__PURE__ */ $constructor$1("ZodReadonly", (inst, def) => {
3692
+ $ZodReadonly$1.init(inst, def);
3693
+ ZodType$1.init(inst, def);
3694
+ inst._zod.processJSONSchema = (ctx, json, params) => readonlyProcessor$1(inst, ctx, json, params);
3695
+ inst.unwrap = () => inst._zod.def.innerType;
3696
+ });
3697
+ function readonly$1(innerType) {
3698
+ return new ZodReadonly$1({
3699
+ type: "readonly",
3700
+ innerType
3701
+ });
3702
+ }
3703
+ const ZodCustom$1 = /* @__PURE__ */ $constructor$1("ZodCustom", (inst, def) => {
3704
+ $ZodCustom$1.init(inst, def);
3705
+ ZodType$1.init(inst, def);
3706
+ inst._zod.processJSONSchema = (ctx, json, params) => customProcessor$1(inst, ctx, json, params);
3707
+ });
3708
+ function refine$1(fn, _params = {}) {
3709
+ return _refine$1(ZodCustom$1, fn, _params);
3710
+ }
3711
+ function superRefine$1(fn) {
3712
+ return _superRefine$1(fn);
3713
+ }
3714
+ const describe = describe$1;
3715
+ const meta = meta$1;
3716
+
3717
+ //#endregion
3718
+ //#region ../feature-schema/dist/schema.mjs
3719
+ /** Matches any domain prefix: feat-2026-001, proc-2026-001, goal-2026-001, etc. */
3720
+ const FEATURE_KEY_PATTERN$1 = /^[a-z][a-z0-9]*-\d{4}-\d{3}$/;
3721
+ const FeatureStatusSchema$1 = _enum$1([
3722
+ "draft",
3723
+ "active",
3724
+ "frozen",
3725
+ "deprecated"
3726
+ ]);
3727
+ const DecisionSchema$1 = object$1({
3728
+ decision: string$2().min(1),
3729
+ rationale: string$2().min(1),
3730
+ alternativesConsidered: array$1(string$2()).optional(),
3731
+ date: string$2().regex(/^\d{4}-\d{2}-\d{2}$/, "date must be YYYY-MM-DD").optional()
3732
+ });
3733
+ const AnnotationSchema$1 = object$1({
3734
+ id: string$2().min(1),
3735
+ author: string$2().min(1),
3736
+ date: string$2().min(1),
3737
+ type: string$2().min(1),
3738
+ body: string$2().min(1)
3739
+ });
3740
+ const LineageSchema$1 = object$1({
3741
+ parent: string$2().nullable().optional(),
3742
+ children: array$1(string$2()).optional(),
3743
+ spawnReason: string$2().nullable().optional()
3744
+ });
3745
+ const FeatureSchema$1 = object$1({
3746
+ featureKey: string$2().regex(FEATURE_KEY_PATTERN$1, "featureKey must match pattern <domain>-YYYY-NNN (e.g. feat-2026-001, proc-2026-001)"),
3747
+ title: string$2().min(1),
3748
+ status: FeatureStatusSchema$1,
3749
+ problem: string$2().min(1),
3750
+ schemaVersion: number$2().int().positive().optional(),
3751
+ owner: string$2().optional(),
3752
+ analysis: string$2().optional(),
3753
+ decisions: array$1(DecisionSchema$1).optional(),
3754
+ implementation: string$2().optional(),
3755
+ knownLimitations: array$1(string$2()).optional(),
3756
+ tags: array$1(string$2()).optional(),
3757
+ annotations: array$1(AnnotationSchema$1).optional(),
3758
+ lineage: LineageSchema$1.optional(),
3759
+ successCriteria: string$2().optional(),
3760
+ domain: string$2().optional()
3761
+ });
3762
+
3763
+ //#endregion
3764
+ //#region ../feature-schema/dist/validate.mjs
3765
+ function validateFeature$1(data) {
3766
+ const result = FeatureSchema$1.safeParse(data);
3767
+ if (result.success) return {
3768
+ success: true,
3769
+ data: result.data
3770
+ };
3771
+ return {
3772
+ success: false,
3773
+ errors: result.error.issues.map((issue$2) => {
3774
+ return `${issue$2.path.length > 0 ? `${issue$2.path.join(".")}: ` : ""}${issue$2.message}`;
3775
+ })
3776
+ };
3777
+ }
3778
+
3779
+ //#endregion
3780
+ //#region ../feature-schema/dist/keygen.mjs
3781
+ const LAC_DIR$2 = ".lac";
3782
+ const COUNTER_FILE$1 = "counter";
3783
+ const KEYS_FILE = "keys";
3784
+ /**
3785
+ * Returns the current year as a number.
3786
+ */
3787
+ function getCurrentYear() {
3788
+ return (/* @__PURE__ */ new Date()).getFullYear();
3789
+ }
3790
+ /**
3791
+ * Pads a counter number to a zero-padded 3-digit string (e.g. 1 → "001").
3792
+ */
3793
+ function padCounter(n) {
3794
+ return String(n).padStart(3, "0");
3795
+ }
3796
+ /**
3797
+ * Walks up the directory tree from `fromDir` to find the nearest `.lac/` directory.
3798
+ * Returns the path to the `.lac/` directory if found, otherwise null.
3799
+ */
3800
+ function findLacDir$2(fromDir) {
3801
+ let current = path.resolve(fromDir);
3802
+ while (true) {
3803
+ const candidate = path.join(current, LAC_DIR$2);
3804
+ if (fs.existsSync(candidate) && fs.statSync(candidate).isDirectory()) return candidate;
3805
+ const parent = path.dirname(current);
3806
+ if (parent === current) return null;
3807
+ current = parent;
3808
+ }
3809
+ }
3810
+ /**
3811
+ * Reads or initialises the `.lac/counter` file and returns the next
3812
+ * featureKey string like "feat-2026-001".
3813
+ *
3814
+ * The counter file stores a single integer representing the last-used counter
3815
+ * for the current year. When the year changes the counter resets to 1.
3816
+ *
3817
+ * Format of the counter file (two lines):
3818
+ * <year>
3819
+ * <last-used-counter>
3820
+ *
3821
+ * If the file does not exist it is created, and the first key (NNN=001) is
3822
+ * returned. The `.lac/` directory must already exist in a parent of
3823
+ * `fromDir`; if it cannot be found this function throws an Error.
3824
+ *
3825
+ * Duplicate detection: after generating the key, the `.lac/keys` file is
3826
+ * consulted. If the generated key already exists there, the counter is
3827
+ * incremented until a unique key is found.
3828
+ *
3829
+ * @param prefix Domain prefix for the key (default: "feat"). Set via `domain`
3830
+ * in `lac.config.json` to get keys like "proc-2026-001".
3831
+ */
3832
+ function generateFeatureKey(fromDir, prefix = "feat") {
3833
+ const lacDir = findLacDir$2(fromDir);
3834
+ if (!lacDir) throw new Error(`Could not find a .lac/ directory in "${fromDir}" or any of its parents. Run "lac workspace init" to initialise a life-as-code workspace.`);
3835
+ const counterPath = path.join(lacDir, COUNTER_FILE$1);
3836
+ const keysPath = path.join(lacDir, KEYS_FILE);
3837
+ const year = getCurrentYear();
3838
+ let counter = 1;
3839
+ if (fs.existsSync(counterPath)) try {
3840
+ const lines = fs.readFileSync(counterPath, "utf-8").trim().split("\n").map((l) => l.trim());
3841
+ const storedYear = parseInt(lines[0] ?? "", 10);
3842
+ const storedCounter = parseInt(lines[1] ?? "", 10);
3843
+ if (isNaN(storedYear) || isNaN(storedCounter)) {
3844
+ process.stderr.write("Warning: .lac/counter was corrupt — reset to 1\n");
3845
+ fs.writeFileSync(counterPath, `${year}\n1\n`, "utf-8");
3846
+ counter = 1;
3847
+ } else if (storedYear === year) counter = storedCounter + 1;
3848
+ } catch {
3849
+ process.stderr.write("Warning: .lac/counter was corrupt — reset to 1\n");
3850
+ fs.writeFileSync(counterPath, `${year}\n1\n`, "utf-8");
3851
+ counter = 1;
3852
+ }
3853
+ let existingKeys = /* @__PURE__ */ new Set();
3854
+ if (fs.existsSync(keysPath)) existingKeys = new Set(fs.readFileSync(keysPath, "utf-8").trim().split("\n").filter(Boolean));
3855
+ while (existingKeys.has(`${prefix}-${year}-${padCounter(counter)}`)) counter++;
3856
+ const featureKey = `${prefix}-${year}-${padCounter(counter)}`;
3857
+ existingKeys.add(featureKey);
3858
+ const counterTmp = counterPath + ".tmp";
3859
+ const keysTmp = keysPath + ".tmp";
3860
+ fs.writeFileSync(counterTmp, `${year}\n${counter}\n`, "utf-8");
3861
+ fs.writeFileSync(keysTmp, Array.from(existingKeys).join("\n") + "\n", "utf-8");
3862
+ fs.renameSync(counterTmp, counterPath);
3863
+ fs.renameSync(keysTmp, keysPath);
3864
+ return featureKey;
3865
+ }
3866
+
3867
+ //#endregion
13
3868
  //#region src/lib/scanner.ts
14
3869
  /**
15
3870
  * Recursively finds all feature.json files under a directory.
@@ -54,7 +3909,7 @@ async function scanFeatures(dir) {
54
3909
  process.stderr.write(`Warning: invalid JSON in "${fullPath}" — skipping\n`);
55
3910
  continue;
56
3911
  }
57
- const result = validateFeature(parsed);
3912
+ const result = validateFeature$1(parsed);
58
3913
  if (!result.success) {
59
3914
  process.stderr.write(`Warning: "${fullPath}" failed validation — skipping\n ${result.errors.join("\n ")}\n`);
60
3915
  continue;
@@ -86,7 +3941,7 @@ const archiveCommand = new Command("archive").description("Mark a feature as dep
86
3941
  const raw = await readFile(found.filePath, "utf-8");
87
3942
  const parsed = JSON.parse(raw);
88
3943
  parsed["status"] = "deprecated";
89
- const validation = validateFeature(parsed);
3944
+ const validation = validateFeature$1(parsed);
90
3945
  if (!validation.success) {
91
3946
  process$1.stderr.write(`Validation error: ${validation.errors.join(", ")}\n`);
92
3947
  process$1.exit(1);
@@ -96,10 +3951,9 @@ const archiveCommand = new Command("archive").description("Mark a feature as dep
96
3951
  });
97
3952
 
98
3953
  //#endregion
99
- //#region ../../node_modules/.bun/zod@4.3.6/node_modules/zod/v4/core/core.js
100
- /** A special constant with type `never` */
101
- const NEVER = Object.freeze({ status: "aborted" });
102
- function $constructor(name, initializer$2, params) {
3954
+ //#region ../lac-claude/dist/index.mjs
3955
+ Object.freeze({ status: "aborted" });
3956
+ function $constructor(name, initializer$2$1, params) {
103
3957
  function init(inst, def) {
104
3958
  if (!inst._zod) Object.defineProperty(inst, "_zod", {
105
3959
  value: {
@@ -111,7 +3965,7 @@ function $constructor(name, initializer$2, params) {
111
3965
  });
112
3966
  if (inst._zod.traits.has(name)) return;
113
3967
  inst._zod.traits.add(name);
114
- initializer$2(inst, def);
3968
+ initializer$2$1(inst, def);
115
3969
  const proto = _.prototype;
116
3970
  const keys = Object.keys(proto);
117
3971
  for (let i = 0; i < keys.length; i++) {
@@ -123,10 +3977,10 @@ function $constructor(name, initializer$2, params) {
123
3977
  class Definition extends Parent {}
124
3978
  Object.defineProperty(Definition, "name", { value: name });
125
3979
  function _(def) {
126
- var _a$1;
3980
+ var _a$1$1;
127
3981
  const inst = params?.Parent ? new Definition() : this;
128
3982
  init(inst, def);
129
- (_a$1 = inst._zod).deferred ?? (_a$1.deferred = []);
3983
+ (_a$1$1 = inst._zod).deferred ?? (_a$1$1.deferred = []);
130
3984
  for (const fn of inst._zod.deferred) fn();
131
3985
  return inst;
132
3986
  }
@@ -154,9 +4008,6 @@ function config(newConfig) {
154
4008
  if (newConfig) Object.assign(globalConfig, newConfig);
155
4009
  return globalConfig;
156
4010
  }
157
-
158
- //#endregion
159
- //#region ../../node_modules/.bun/zod@4.3.6/node_modules/zod/v4/core/util.js
160
4011
  function getEnumValues(entries) {
161
4012
  const numericValues = Object.values(entries).filter((v) => typeof v === "number");
162
4013
  return Object.entries(entries).filter(([k, _]) => numericValues.indexOf(+k) === -1).map(([_, v]) => v);
@@ -195,9 +4046,9 @@ function floatSafeRemainder(val, step) {
195
4046
  return Number.parseInt(val.toFixed(decCount).replace(".", "")) % Number.parseInt(step.toFixed(decCount).replace(".", "")) / 10 ** decCount;
196
4047
  }
197
4048
  const EVALUATING = Symbol("evaluating");
198
- function defineLazy(object$1, key, getter) {
4049
+ function defineLazy(object$1$1, key, getter) {
199
4050
  let value = void 0;
200
- Object.defineProperty(object$1, key, {
4051
+ Object.defineProperty(object$1$1, key, {
201
4052
  get() {
202
4053
  if (value === EVALUATING) return;
203
4054
  if (value === void 0) {
@@ -207,7 +4058,7 @@ function defineLazy(object$1, key, getter) {
207
4058
  return value;
208
4059
  },
209
4060
  set(v) {
210
- Object.defineProperty(object$1, key, { value: v });
4061
+ Object.defineProperty(object$1$1, key, { value: v });
211
4062
  },
212
4063
  configurable: true
213
4064
  });
@@ -433,8 +4284,8 @@ function aborted(x, startIndex = 0) {
433
4284
  }
434
4285
  function prefixIssues(path$1, issues) {
435
4286
  return issues.map((iss) => {
436
- var _a$1;
437
- (_a$1 = iss).path ?? (_a$1.path = []);
4287
+ var _a$1$1;
4288
+ (_a$1$1 = iss).path ?? (_a$1$1.path = []);
438
4289
  iss.path.unshift(path$1);
439
4290
  return iss;
440
4291
  });
@@ -442,12 +4293,12 @@ function prefixIssues(path$1, issues) {
442
4293
  function unwrapMessage(message) {
443
4294
  return typeof message === "string" ? message : message?.message;
444
4295
  }
445
- function finalizeIssue(iss, ctx, config$1) {
4296
+ function finalizeIssue(iss, ctx, config$1$1) {
446
4297
  const full = {
447
4298
  ...iss,
448
4299
  path: iss.path ?? []
449
4300
  };
450
- if (!iss.message) full.message = unwrapMessage(iss.inst?._zod.def?.error?.(iss)) ?? unwrapMessage(ctx?.error?.(iss)) ?? unwrapMessage(config$1.customError?.(iss)) ?? unwrapMessage(config$1.localeError?.(iss)) ?? "Invalid input";
4301
+ if (!iss.message) full.message = unwrapMessage(iss.inst?._zod.def?.error?.(iss)) ?? unwrapMessage(ctx?.error?.(iss)) ?? unwrapMessage(config$1$1.customError?.(iss)) ?? unwrapMessage(config$1$1.localeError?.(iss)) ?? "Invalid input";
451
4302
  delete full.inst;
452
4303
  delete full.continue;
453
4304
  if (!ctx?.reportInput) delete full.input;
@@ -468,9 +4319,6 @@ function issue(...args) {
468
4319
  };
469
4320
  return { ...iss };
470
4321
  }
471
-
472
- //#endregion
473
- //#region ../../node_modules/.bun/zod@4.3.6/node_modules/zod/v4/core/errors.js
474
4322
  const initializer$1 = (inst, def) => {
475
4323
  inst.name = "$ZodError";
476
4324
  Object.defineProperty(inst, "_zod", {
@@ -489,7 +4337,7 @@ const initializer$1 = (inst, def) => {
489
4337
  };
490
4338
  const $ZodError = $constructor("$ZodError", initializer$1);
491
4339
  const $ZodRealError = $constructor("$ZodError", initializer$1, { Parent: Error });
492
- function flattenError(error, mapper = (issue$1) => issue$1.message) {
4340
+ function flattenError(error, mapper = (issue$1$1) => issue$1$1.message) {
493
4341
  const fieldErrors = {};
494
4342
  const formErrors = [];
495
4343
  for (const sub of error.issues) if (sub.path.length > 0) {
@@ -501,22 +4349,22 @@ function flattenError(error, mapper = (issue$1) => issue$1.message) {
501
4349
  fieldErrors
502
4350
  };
503
4351
  }
504
- function formatError(error, mapper = (issue$1) => issue$1.message) {
4352
+ function formatError(error, mapper = (issue$1$1) => issue$1$1.message) {
505
4353
  const fieldErrors = { _errors: [] };
506
4354
  const processError = (error$1) => {
507
- for (const issue$1 of error$1.issues) if (issue$1.code === "invalid_union" && issue$1.errors.length) issue$1.errors.map((issues) => processError({ issues }));
508
- else if (issue$1.code === "invalid_key") processError({ issues: issue$1.issues });
509
- else if (issue$1.code === "invalid_element") processError({ issues: issue$1.issues });
510
- else if (issue$1.path.length === 0) fieldErrors._errors.push(mapper(issue$1));
4355
+ for (const issue$1$1 of error$1.issues) if (issue$1$1.code === "invalid_union" && issue$1$1.errors.length) issue$1$1.errors.map((issues) => processError({ issues }));
4356
+ else if (issue$1$1.code === "invalid_key") processError({ issues: issue$1$1.issues });
4357
+ else if (issue$1$1.code === "invalid_element") processError({ issues: issue$1$1.issues });
4358
+ else if (issue$1$1.path.length === 0) fieldErrors._errors.push(mapper(issue$1$1));
511
4359
  else {
512
4360
  let curr = fieldErrors;
513
4361
  let i = 0;
514
- while (i < issue$1.path.length) {
515
- const el = issue$1.path[i];
516
- if (!(i === issue$1.path.length - 1)) curr[el] = curr[el] || { _errors: [] };
4362
+ while (i < issue$1$1.path.length) {
4363
+ const el = issue$1$1.path[i];
4364
+ if (!(i === issue$1$1.path.length - 1)) curr[el] = curr[el] || { _errors: [] };
517
4365
  else {
518
4366
  curr[el] = curr[el] || { _errors: [] };
519
- curr[el]._errors.push(mapper(issue$1));
4367
+ curr[el]._errors.push(mapper(issue$1$1));
520
4368
  }
521
4369
  curr = curr[el];
522
4370
  i++;
@@ -526,9 +4374,6 @@ function formatError(error, mapper = (issue$1) => issue$1.message) {
526
4374
  processError(error);
527
4375
  return fieldErrors;
528
4376
  }
529
-
530
- //#endregion
531
- //#region ../../node_modules/.bun/zod@4.3.6/node_modules/zod/v4/core/parse.js
532
4377
  const _parse = (_Err) => (schema, value, _ctx, _params) => {
533
4378
  const ctx = _ctx ? Object.assign(_ctx, { async: false }) : { async: false };
534
4379
  const result = schema._zod.run({
@@ -543,7 +4388,6 @@ const _parse = (_Err) => (schema, value, _ctx, _params) => {
543
4388
  }
544
4389
  return result.value;
545
4390
  };
546
- const parse$1 = /* @__PURE__ */ _parse($ZodRealError);
547
4391
  const _parseAsync = (_Err) => async (schema, value, _ctx, params) => {
548
4392
  const ctx = _ctx ? Object.assign(_ctx, { async: true }) : { async: true };
549
4393
  let result = schema._zod.run({
@@ -558,7 +4402,6 @@ const _parseAsync = (_Err) => async (schema, value, _ctx, params) => {
558
4402
  }
559
4403
  return result.value;
560
4404
  };
561
- const parseAsync$1 = /* @__PURE__ */ _parseAsync($ZodRealError);
562
4405
  const _safeParse = (_Err) => (schema, value, _ctx) => {
563
4406
  const ctx = _ctx ? {
564
4407
  ..._ctx,
@@ -598,41 +4441,30 @@ const _encode = (_Err) => (schema, value, _ctx) => {
598
4441
  const ctx = _ctx ? Object.assign(_ctx, { direction: "backward" }) : { direction: "backward" };
599
4442
  return _parse(_Err)(schema, value, ctx);
600
4443
  };
601
- const encode$1 = /* @__PURE__ */ _encode($ZodRealError);
602
4444
  const _decode = (_Err) => (schema, value, _ctx) => {
603
4445
  return _parse(_Err)(schema, value, _ctx);
604
4446
  };
605
- const decode$1 = /* @__PURE__ */ _decode($ZodRealError);
606
4447
  const _encodeAsync = (_Err) => async (schema, value, _ctx) => {
607
4448
  const ctx = _ctx ? Object.assign(_ctx, { direction: "backward" }) : { direction: "backward" };
608
4449
  return _parseAsync(_Err)(schema, value, ctx);
609
4450
  };
610
- const encodeAsync$1 = /* @__PURE__ */ _encodeAsync($ZodRealError);
611
4451
  const _decodeAsync = (_Err) => async (schema, value, _ctx) => {
612
4452
  return _parseAsync(_Err)(schema, value, _ctx);
613
4453
  };
614
- const decodeAsync$1 = /* @__PURE__ */ _decodeAsync($ZodRealError);
615
4454
  const _safeEncode = (_Err) => (schema, value, _ctx) => {
616
4455
  const ctx = _ctx ? Object.assign(_ctx, { direction: "backward" }) : { direction: "backward" };
617
4456
  return _safeParse(_Err)(schema, value, ctx);
618
4457
  };
619
- const safeEncode$1 = /* @__PURE__ */ _safeEncode($ZodRealError);
620
4458
  const _safeDecode = (_Err) => (schema, value, _ctx) => {
621
4459
  return _safeParse(_Err)(schema, value, _ctx);
622
4460
  };
623
- const safeDecode$1 = /* @__PURE__ */ _safeDecode($ZodRealError);
624
4461
  const _safeEncodeAsync = (_Err) => async (schema, value, _ctx) => {
625
4462
  const ctx = _ctx ? Object.assign(_ctx, { direction: "backward" }) : { direction: "backward" };
626
4463
  return _safeParseAsync(_Err)(schema, value, ctx);
627
4464
  };
628
- const safeEncodeAsync$1 = /* @__PURE__ */ _safeEncodeAsync($ZodRealError);
629
4465
  const _safeDecodeAsync = (_Err) => async (schema, value, _ctx) => {
630
4466
  return _safeParseAsync(_Err)(schema, value, _ctx);
631
4467
  };
632
- const safeDecodeAsync$1 = /* @__PURE__ */ _safeDecodeAsync($ZodRealError);
633
-
634
- //#endregion
635
- //#region ../../node_modules/.bun/zod@4.3.6/node_modules/zod/v4/core/regexes.js
636
4468
  const cuid = /^[cC][^\s-]{8,}$/;
637
4469
  const cuid2 = /^[0-9a-z]+$/;
638
4470
  const ulid = /^[0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{26}$/;
@@ -646,9 +4478,9 @@ const guid = /^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9
646
4478
  /** Returns a regex for validating an RFC 9562/4122 UUID.
647
4479
  *
648
4480
  * @param version Optionally specify a version 1-8. If no version is specified, all versions are supported. */
649
- const uuid = (version$1) => {
650
- if (!version$1) return /^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$/;
651
- return /* @__PURE__ */ new RegExp(`^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-${version$1}[0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12})$`);
4481
+ const uuid = (version$1$1) => {
4482
+ if (!version$1$1) return /^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$/;
4483
+ return /* @__PURE__ */ new RegExp(`^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-${version$1$1}[0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12})$`);
652
4484
  };
653
4485
  /** Practical email validation */
654
4486
  const email = /^(?!\.)(?!.*\.\.)([A-Za-z0-9_'+\-\.]*)[A-Za-z0-9_+-]@([A-Za-z0-9][A-Za-z0-9\-]*\.)+[A-Za-z]{2,}$/;
@@ -673,11 +4505,11 @@ function time$1(args) {
673
4505
  return /* @__PURE__ */ new RegExp(`^${timeSource(args)}$`);
674
4506
  }
675
4507
  function datetime$1(args) {
676
- const time$2 = timeSource({ precision: args.precision });
4508
+ const time$2$1 = timeSource({ precision: args.precision });
677
4509
  const opts = ["Z"];
678
4510
  if (args.local) opts.push("");
679
4511
  if (args.offset) opts.push(`([+-](?:[01]\\d|2[0-3]):[0-5]\\d)`);
680
- const timeRegex = `${time$2}(?:${opts.join("|")})`;
4512
+ const timeRegex = `${time$2$1}(?:${opts.join("|")})`;
681
4513
  return /* @__PURE__ */ new RegExp(`^${dateSource}T(?:${timeRegex})$`);
682
4514
  }
683
4515
  const string$1 = (params) => {
@@ -688,14 +4520,11 @@ const integer = /^-?\d+$/;
688
4520
  const number$1 = /^-?\d+(?:\.\d+)?$/;
689
4521
  const lowercase = /^[^A-Z]*$/;
690
4522
  const uppercase = /^[^a-z]*$/;
691
-
692
- //#endregion
693
- //#region ../../node_modules/.bun/zod@4.3.6/node_modules/zod/v4/core/checks.js
694
4523
  const $ZodCheck = /* @__PURE__ */ $constructor("$ZodCheck", (inst, def) => {
695
- var _a$1;
4524
+ var _a$1$1;
696
4525
  inst._zod ?? (inst._zod = {});
697
4526
  inst._zod.def = def;
698
- (_a$1 = inst._zod).onattach ?? (_a$1.onattach = []);
4527
+ (_a$1$1 = inst._zod).onattach ?? (_a$1$1.onattach = []);
699
4528
  });
700
4529
  const numericOriginMap = {
701
4530
  number: "number",
@@ -749,8 +4578,8 @@ const $ZodCheckGreaterThan = /* @__PURE__ */ $constructor("$ZodCheckGreaterThan"
749
4578
  const $ZodCheckMultipleOf = /* @__PURE__ */ $constructor("$ZodCheckMultipleOf", (inst, def) => {
750
4579
  $ZodCheck.init(inst, def);
751
4580
  inst._zod.onattach.push((inst$1) => {
752
- var _a$1;
753
- (_a$1 = inst$1._zod.bag).multipleOf ?? (_a$1.multipleOf = def.value);
4581
+ var _a$1$1;
4582
+ (_a$1$1 = inst$1._zod.bag).multipleOf ?? (_a$1$1.multipleOf = def.value);
754
4583
  });
755
4584
  inst._zod.check = (payload) => {
756
4585
  if (typeof payload.value !== typeof def.value) throw new Error("Cannot mix number and bigint in multiple_of check.");
@@ -837,9 +4666,9 @@ const $ZodCheckNumberFormat = /* @__PURE__ */ $constructor("$ZodCheckNumberForma
837
4666
  };
838
4667
  });
839
4668
  const $ZodCheckMaxLength = /* @__PURE__ */ $constructor("$ZodCheckMaxLength", (inst, def) => {
840
- var _a$1;
4669
+ var _a$1$1;
841
4670
  $ZodCheck.init(inst, def);
842
- (_a$1 = inst._zod.def).when ?? (_a$1.when = (payload) => {
4671
+ (_a$1$1 = inst._zod.def).when ?? (_a$1$1.when = (payload) => {
843
4672
  const val = payload.value;
844
4673
  return !nullish(val) && val.length !== void 0;
845
4674
  });
@@ -863,9 +4692,9 @@ const $ZodCheckMaxLength = /* @__PURE__ */ $constructor("$ZodCheckMaxLength", (i
863
4692
  };
864
4693
  });
865
4694
  const $ZodCheckMinLength = /* @__PURE__ */ $constructor("$ZodCheckMinLength", (inst, def) => {
866
- var _a$1;
4695
+ var _a$1$1;
867
4696
  $ZodCheck.init(inst, def);
868
- (_a$1 = inst._zod.def).when ?? (_a$1.when = (payload) => {
4697
+ (_a$1$1 = inst._zod.def).when ?? (_a$1$1.when = (payload) => {
869
4698
  const val = payload.value;
870
4699
  return !nullish(val) && val.length !== void 0;
871
4700
  });
@@ -889,9 +4718,9 @@ const $ZodCheckMinLength = /* @__PURE__ */ $constructor("$ZodCheckMinLength", (i
889
4718
  };
890
4719
  });
891
4720
  const $ZodCheckLengthEquals = /* @__PURE__ */ $constructor("$ZodCheckLengthEquals", (inst, def) => {
892
- var _a$1;
4721
+ var _a$1$1;
893
4722
  $ZodCheck.init(inst, def);
894
- (_a$1 = inst._zod.def).when ?? (_a$1.when = (payload) => {
4723
+ (_a$1$1 = inst._zod.def).when ?? (_a$1$1.when = (payload) => {
895
4724
  const val = payload.value;
896
4725
  return !nullish(val) && val.length !== void 0;
897
4726
  });
@@ -925,7 +4754,7 @@ const $ZodCheckLengthEquals = /* @__PURE__ */ $constructor("$ZodCheckLengthEqual
925
4754
  };
926
4755
  });
927
4756
  const $ZodCheckStringFormat = /* @__PURE__ */ $constructor("$ZodCheckStringFormat", (inst, def) => {
928
- var _a$1, _b;
4757
+ var _a$1$1, _b;
929
4758
  $ZodCheck.init(inst, def);
930
4759
  inst._zod.onattach.push((inst$1) => {
931
4760
  const bag = inst$1._zod.bag;
@@ -935,7 +4764,7 @@ const $ZodCheckStringFormat = /* @__PURE__ */ $constructor("$ZodCheckStringForma
935
4764
  bag.patterns.add(def.pattern);
936
4765
  }
937
4766
  });
938
- if (def.pattern) (_a$1 = inst._zod).check ?? (_a$1.check = (payload) => {
4767
+ if (def.pattern) (_a$1$1 = inst._zod).check ?? (_a$1$1.check = (payload) => {
939
4768
  def.pattern.lastIndex = 0;
940
4769
  if (def.pattern.test(payload.value)) return;
941
4770
  payload.issues.push({
@@ -1047,9 +4876,6 @@ const $ZodCheckOverwrite = /* @__PURE__ */ $constructor("$ZodCheckOverwrite", (i
1047
4876
  payload.value = def.tx(payload.value);
1048
4877
  };
1049
4878
  });
1050
-
1051
- //#endregion
1052
- //#region ../../node_modules/.bun/zod@4.3.6/node_modules/zod/v4/core/doc.js
1053
4879
  var Doc = class {
1054
4880
  constructor(args = []) {
1055
4881
  this.content = [];
@@ -1079,19 +4905,13 @@ var Doc = class {
1079
4905
  return new F(...args, lines.join("\n"));
1080
4906
  }
1081
4907
  };
1082
-
1083
- //#endregion
1084
- //#region ../../node_modules/.bun/zod@4.3.6/node_modules/zod/v4/core/versions.js
1085
4908
  const version = {
1086
4909
  major: 4,
1087
4910
  minor: 3,
1088
4911
  patch: 6
1089
4912
  };
1090
-
1091
- //#endregion
1092
- //#region ../../node_modules/.bun/zod@4.3.6/node_modules/zod/v4/core/schemas.js
1093
4913
  const $ZodType = /* @__PURE__ */ $constructor("$ZodType", (inst, def) => {
1094
- var _a$1;
4914
+ var _a$1$1;
1095
4915
  inst ?? (inst = {});
1096
4916
  inst._zod.def = def;
1097
4917
  inst._zod.bag = inst._zod.bag || {};
@@ -1100,7 +4920,7 @@ const $ZodType = /* @__PURE__ */ $constructor("$ZodType", (inst, def) => {
1100
4920
  if (inst._zod.traits.has("$ZodCheck")) checks.unshift(inst);
1101
4921
  for (const ch of checks) for (const fn of ch._zod.onattach) fn(inst);
1102
4922
  if (checks.length === 0) {
1103
- (_a$1 = inst._zod).deferred ?? (_a$1.deferred = []);
4923
+ (_a$1$1 = inst._zod).deferred ?? (_a$1$1.deferred = []);
1104
4924
  inst._zod.deferred?.push(() => {
1105
4925
  inst._zod.run = inst._zod.parse;
1106
4926
  });
@@ -1390,8 +5210,8 @@ const $ZodBase64 = /* @__PURE__ */ $constructor("$ZodBase64", (inst, def) => {
1390
5210
  });
1391
5211
  function isValidBase64URL(data) {
1392
5212
  if (!base64url.test(data)) return false;
1393
- const base64$1 = data.replace(/[-_]/g, (c) => c === "-" ? "+" : "/");
1394
- return isValidBase64(base64$1.padEnd(Math.ceil(base64$1.length / 4) * 4, "="));
5213
+ const base64$1$1 = data.replace(/[-_]/g, (c) => c === "-" ? "+" : "/");
5214
+ return isValidBase64(base64$1$1.padEnd(Math.ceil(base64$1$1.length / 4) * 4, "="));
1395
5215
  }
1396
5216
  const $ZodBase64URL = /* @__PURE__ */ $constructor("$ZodBase64URL", (inst, def) => {
1397
5217
  def.pattern ?? (def.pattern = base64url);
@@ -1586,13 +5406,13 @@ const $ZodObject = /* @__PURE__ */ $constructor("$ZodObject", (inst, def) => {
1586
5406
  }
1587
5407
  return propValues;
1588
5408
  });
1589
- const isObject$1 = isObject;
5409
+ const isObject$1$1 = isObject;
1590
5410
  const catchall = def.catchall;
1591
5411
  let value;
1592
5412
  inst._zod.parse = (payload, ctx) => {
1593
5413
  value ?? (value = _normalized.value);
1594
5414
  const input = payload.value;
1595
- if (!isObject$1(input)) {
5415
+ if (!isObject$1$1(input)) {
1596
5416
  payload.issues.push({
1597
5417
  expected: "object",
1598
5418
  code: "invalid_type",
@@ -1686,16 +5506,15 @@ const $ZodObjectJIT = /* @__PURE__ */ $constructor("$ZodObjectJIT", (inst, def)
1686
5506
  return (payload, ctx) => fn(shape, payload, ctx);
1687
5507
  };
1688
5508
  let fastpass;
1689
- const isObject$1 = isObject;
5509
+ const isObject$1$1 = isObject;
1690
5510
  const jit = !globalConfig.jitless;
1691
- const allowsEval$1 = allowsEval;
1692
- const fastEnabled = jit && allowsEval$1.value;
5511
+ const fastEnabled = jit && allowsEval.value;
1693
5512
  const catchall = def.catchall;
1694
5513
  let value;
1695
5514
  inst._zod.parse = (payload, ctx) => {
1696
5515
  value ?? (value = _normalized.value);
1697
5516
  const input = payload.value;
1698
- if (!isObject$1(input)) {
5517
+ if (!isObject$1$1(input)) {
1699
5518
  payload.issues.push({
1700
5519
  expected: "object",
1701
5520
  code: "invalid_type",
@@ -2107,9 +5926,6 @@ function handleRefineResult(result, payload, input, inst) {
2107
5926
  payload.issues.push(issue(_iss));
2108
5927
  }
2109
5928
  }
2110
-
2111
- //#endregion
2112
- //#region ../../node_modules/.bun/zod@4.3.6/node_modules/zod/v4/core/registries.js
2113
5929
  var _a;
2114
5930
  var $ZodRegistry = class {
2115
5931
  constructor() {
@@ -2155,9 +5971,6 @@ function registry() {
2155
5971
  }
2156
5972
  (_a = globalThis).__zod_globalRegistry ?? (_a.__zod_globalRegistry = registry());
2157
5973
  const globalRegistry = globalThis.__zod_globalRegistry;
2158
-
2159
- //#endregion
2160
- //#region ../../node_modules/.bun/zod@4.3.6/node_modules/zod/v4/core/api.js
2161
5974
  /* @__NO_SIDE_EFFECTS__ */
2162
5975
  function _string(Class, params) {
2163
5976
  return new Class({
@@ -2624,10 +6437,10 @@ function _refine(Class, fn, _params) {
2624
6437
  /* @__NO_SIDE_EFFECTS__ */
2625
6438
  function _superRefine(fn) {
2626
6439
  const ch = /* @__PURE__ */ _check((payload) => {
2627
- payload.addIssue = (issue$1) => {
2628
- if (typeof issue$1 === "string") payload.issues.push(issue(issue$1, payload.value, ch._zod.def));
6440
+ payload.addIssue = (issue$1$1) => {
6441
+ if (typeof issue$1$1 === "string") payload.issues.push(issue(issue$1$1, payload.value, ch._zod.def));
2629
6442
  else {
2630
- const _issue = issue$1;
6443
+ const _issue = issue$1$1;
2631
6444
  if (_issue.fatal) _issue.continue = false;
2632
6445
  _issue.code ?? (_issue.code = "custom");
2633
6446
  _issue.input ?? (_issue.input = payload.value);
@@ -2649,35 +6462,6 @@ function _check(fn, params) {
2649
6462
  ch._zod.check = fn;
2650
6463
  return ch;
2651
6464
  }
2652
- /* @__NO_SIDE_EFFECTS__ */
2653
- function describe$1(description) {
2654
- const ch = new $ZodCheck({ check: "describe" });
2655
- ch._zod.onattach = [(inst) => {
2656
- const existing = globalRegistry.get(inst) ?? {};
2657
- globalRegistry.add(inst, {
2658
- ...existing,
2659
- description
2660
- });
2661
- }];
2662
- ch._zod.check = () => {};
2663
- return ch;
2664
- }
2665
- /* @__NO_SIDE_EFFECTS__ */
2666
- function meta$1(metadata) {
2667
- const ch = new $ZodCheck({ check: "meta" });
2668
- ch._zod.onattach = [(inst) => {
2669
- const existing = globalRegistry.get(inst) ?? {};
2670
- globalRegistry.add(inst, {
2671
- ...existing,
2672
- ...metadata
2673
- });
2674
- }];
2675
- ch._zod.check = () => {};
2676
- return ch;
2677
- }
2678
-
2679
- //#endregion
2680
- //#region ../../node_modules/.bun/zod@4.3.6/node_modules/zod/v4/core/to-json-schema.js
2681
6465
  function initializeContext(params) {
2682
6466
  let target = params?.target ?? "draft-2020-12";
2683
6467
  if (target === "draft-4") target = "draft-04";
@@ -2700,7 +6484,7 @@ function process$2(schema, ctx, _params = {
2700
6484
  path: [],
2701
6485
  schemaPath: []
2702
6486
  }) {
2703
- var _a$1;
6487
+ var _a$1$1;
2704
6488
  const def = schema._zod.def;
2705
6489
  const seen = ctx.seen.get(schema);
2706
6490
  if (seen) {
@@ -2743,7 +6527,7 @@ function process$2(schema, ctx, _params = {
2743
6527
  delete result.schema.examples;
2744
6528
  delete result.schema.default;
2745
6529
  }
2746
- if (ctx.io === "input" && result.schema._prefault) (_a$1 = result.schema).default ?? (_a$1.default = result.schema._prefault);
6530
+ if (ctx.io === "input" && result.schema._prefault) (_a$1$1 = result.schema).default ?? (_a$1$1.default = result.schema._prefault);
2747
6531
  delete result.schema._prefault;
2748
6532
  return ctx.seen.get(schema).schema;
2749
6533
  }
@@ -2961,9 +6745,6 @@ const createStandardJSONSchemaMethod = (schema, io, processors = {}) => (params)
2961
6745
  extractDefs(ctx, schema);
2962
6746
  return finalize(ctx, schema);
2963
6747
  };
2964
-
2965
- //#endregion
2966
- //#region ../../node_modules/.bun/zod@4.3.6/node_modules/zod/v4/core/json-schema-processors.js
2967
6748
  const formatMap = {
2968
6749
  guid: "uuid",
2969
6750
  url: "uri",
@@ -3172,48 +6953,42 @@ const optionalProcessor = (schema, ctx, _json, params) => {
3172
6953
  const seen = ctx.seen.get(schema);
3173
6954
  seen.ref = def.innerType;
3174
6955
  };
3175
-
3176
- //#endregion
3177
- //#region ../../node_modules/.bun/zod@4.3.6/node_modules/zod/v4/classic/iso.js
3178
6956
  const ZodISODateTime = /* @__PURE__ */ $constructor("ZodISODateTime", (inst, def) => {
3179
6957
  $ZodISODateTime.init(inst, def);
3180
6958
  ZodStringFormat.init(inst, def);
3181
6959
  });
3182
6960
  function datetime(params) {
3183
- return _isoDateTime(ZodISODateTime, params);
6961
+ return /* @__PURE__ */ _isoDateTime(ZodISODateTime, params);
3184
6962
  }
3185
6963
  const ZodISODate = /* @__PURE__ */ $constructor("ZodISODate", (inst, def) => {
3186
6964
  $ZodISODate.init(inst, def);
3187
6965
  ZodStringFormat.init(inst, def);
3188
6966
  });
3189
6967
  function date(params) {
3190
- return _isoDate(ZodISODate, params);
6968
+ return /* @__PURE__ */ _isoDate(ZodISODate, params);
3191
6969
  }
3192
6970
  const ZodISOTime = /* @__PURE__ */ $constructor("ZodISOTime", (inst, def) => {
3193
6971
  $ZodISOTime.init(inst, def);
3194
6972
  ZodStringFormat.init(inst, def);
3195
6973
  });
3196
6974
  function time(params) {
3197
- return _isoTime(ZodISOTime, params);
6975
+ return /* @__PURE__ */ _isoTime(ZodISOTime, params);
3198
6976
  }
3199
6977
  const ZodISODuration = /* @__PURE__ */ $constructor("ZodISODuration", (inst, def) => {
3200
6978
  $ZodISODuration.init(inst, def);
3201
6979
  ZodStringFormat.init(inst, def);
3202
6980
  });
3203
6981
  function duration(params) {
3204
- return _isoDuration(ZodISODuration, params);
6982
+ return /* @__PURE__ */ _isoDuration(ZodISODuration, params);
3205
6983
  }
3206
-
3207
- //#endregion
3208
- //#region ../../node_modules/.bun/zod@4.3.6/node_modules/zod/v4/classic/errors.js
3209
6984
  const initializer = (inst, issues) => {
3210
6985
  $ZodError.init(inst, issues);
3211
6986
  inst.name = "ZodError";
3212
6987
  Object.defineProperties(inst, {
3213
6988
  format: { value: (mapper) => formatError(inst, mapper) },
3214
6989
  flatten: { value: (mapper) => flattenError(inst, mapper) },
3215
- addIssue: { value: (issue$1) => {
3216
- inst.issues.push(issue$1);
6990
+ addIssue: { value: (issue$1$1) => {
6991
+ inst.issues.push(issue$1$1);
3217
6992
  inst.message = JSON.stringify(inst.issues, jsonStringifyReplacer, 2);
3218
6993
  } },
3219
6994
  addIssues: { value: (issues$1) => {
@@ -3225,11 +7000,8 @@ const initializer = (inst, issues) => {
3225
7000
  } }
3226
7001
  });
3227
7002
  };
3228
- const ZodError = $constructor("ZodError", initializer);
7003
+ $constructor("ZodError", initializer);
3229
7004
  const ZodRealError = $constructor("ZodError", initializer, { Parent: Error });
3230
-
3231
- //#endregion
3232
- //#region ../../node_modules/.bun/zod@4.3.6/node_modules/zod/v4/classic/parse.js
3233
7005
  const parse = /* @__PURE__ */ _parse(ZodRealError);
3234
7006
  const parseAsync = /* @__PURE__ */ _parseAsync(ZodRealError);
3235
7007
  const safeParse = /* @__PURE__ */ _safeParse(ZodRealError);
@@ -3242,9 +7014,6 @@ const safeEncode = /* @__PURE__ */ _safeEncode(ZodRealError);
3242
7014
  const safeDecode = /* @__PURE__ */ _safeDecode(ZodRealError);
3243
7015
  const safeEncodeAsync = /* @__PURE__ */ _safeEncodeAsync(ZodRealError);
3244
7016
  const safeDecodeAsync = /* @__PURE__ */ _safeDecodeAsync(ZodRealError);
3245
-
3246
- //#endregion
3247
- //#region ../../node_modules/.bun/zod@4.3.6/node_modules/zod/v4/classic/schemas.js
3248
7017
  const ZodType = /* @__PURE__ */ $constructor("ZodType", (inst, def) => {
3249
7018
  $ZodType.init(inst, def);
3250
7019
  Object.assign(inst["~standard"], { jsonSchema: {
@@ -3284,7 +7053,7 @@ const ZodType = /* @__PURE__ */ $constructor("ZodType", (inst, def) => {
3284
7053
  inst.safeDecodeAsync = async (data, params) => safeDecodeAsync(inst, data, params);
3285
7054
  inst.refine = (check, params) => inst.check(refine(check, params));
3286
7055
  inst.superRefine = (refinement) => inst.check(superRefine(refinement));
3287
- inst.overwrite = (fn) => inst.check(_overwrite(fn));
7056
+ inst.overwrite = (fn) => inst.check(/* @__PURE__ */ _overwrite(fn));
3288
7057
  inst.optional = () => optional(inst);
3289
7058
  inst.exactOptional = () => exactOptional(inst);
3290
7059
  inst.nullable = () => nullable(inst);
@@ -3330,55 +7099,55 @@ const _ZodString = /* @__PURE__ */ $constructor("_ZodString", (inst, def) => {
3330
7099
  inst.format = bag.format ?? null;
3331
7100
  inst.minLength = bag.minimum ?? null;
3332
7101
  inst.maxLength = bag.maximum ?? null;
3333
- inst.regex = (...args) => inst.check(_regex(...args));
3334
- inst.includes = (...args) => inst.check(_includes(...args));
3335
- inst.startsWith = (...args) => inst.check(_startsWith(...args));
3336
- inst.endsWith = (...args) => inst.check(_endsWith(...args));
3337
- inst.min = (...args) => inst.check(_minLength(...args));
3338
- inst.max = (...args) => inst.check(_maxLength(...args));
3339
- inst.length = (...args) => inst.check(_length(...args));
3340
- inst.nonempty = (...args) => inst.check(_minLength(1, ...args));
3341
- inst.lowercase = (params) => inst.check(_lowercase(params));
3342
- inst.uppercase = (params) => inst.check(_uppercase(params));
3343
- inst.trim = () => inst.check(_trim());
3344
- inst.normalize = (...args) => inst.check(_normalize(...args));
3345
- inst.toLowerCase = () => inst.check(_toLowerCase());
3346
- inst.toUpperCase = () => inst.check(_toUpperCase());
3347
- inst.slugify = () => inst.check(_slugify());
7102
+ inst.regex = (...args) => inst.check(/* @__PURE__ */ _regex(...args));
7103
+ inst.includes = (...args) => inst.check(/* @__PURE__ */ _includes(...args));
7104
+ inst.startsWith = (...args) => inst.check(/* @__PURE__ */ _startsWith(...args));
7105
+ inst.endsWith = (...args) => inst.check(/* @__PURE__ */ _endsWith(...args));
7106
+ inst.min = (...args) => inst.check(/* @__PURE__ */ _minLength(...args));
7107
+ inst.max = (...args) => inst.check(/* @__PURE__ */ _maxLength(...args));
7108
+ inst.length = (...args) => inst.check(/* @__PURE__ */ _length(...args));
7109
+ inst.nonempty = (...args) => inst.check(/* @__PURE__ */ _minLength(1, ...args));
7110
+ inst.lowercase = (params) => inst.check(/* @__PURE__ */ _lowercase(params));
7111
+ inst.uppercase = (params) => inst.check(/* @__PURE__ */ _uppercase(params));
7112
+ inst.trim = () => inst.check(/* @__PURE__ */ _trim());
7113
+ inst.normalize = (...args) => inst.check(/* @__PURE__ */ _normalize(...args));
7114
+ inst.toLowerCase = () => inst.check(/* @__PURE__ */ _toLowerCase());
7115
+ inst.toUpperCase = () => inst.check(/* @__PURE__ */ _toUpperCase());
7116
+ inst.slugify = () => inst.check(/* @__PURE__ */ _slugify());
3348
7117
  });
3349
7118
  const ZodString = /* @__PURE__ */ $constructor("ZodString", (inst, def) => {
3350
7119
  $ZodString.init(inst, def);
3351
7120
  _ZodString.init(inst, def);
3352
- inst.email = (params) => inst.check(_email(ZodEmail, params));
3353
- inst.url = (params) => inst.check(_url(ZodURL, params));
3354
- inst.jwt = (params) => inst.check(_jwt(ZodJWT, params));
3355
- inst.emoji = (params) => inst.check(_emoji(ZodEmoji, params));
3356
- inst.guid = (params) => inst.check(_guid(ZodGUID, params));
3357
- inst.uuid = (params) => inst.check(_uuid(ZodUUID, params));
3358
- inst.uuidv4 = (params) => inst.check(_uuidv4(ZodUUID, params));
3359
- inst.uuidv6 = (params) => inst.check(_uuidv6(ZodUUID, params));
3360
- inst.uuidv7 = (params) => inst.check(_uuidv7(ZodUUID, params));
3361
- inst.nanoid = (params) => inst.check(_nanoid(ZodNanoID, params));
3362
- inst.guid = (params) => inst.check(_guid(ZodGUID, params));
3363
- inst.cuid = (params) => inst.check(_cuid(ZodCUID, params));
3364
- inst.cuid2 = (params) => inst.check(_cuid2(ZodCUID2, params));
3365
- inst.ulid = (params) => inst.check(_ulid(ZodULID, params));
3366
- inst.base64 = (params) => inst.check(_base64(ZodBase64, params));
3367
- inst.base64url = (params) => inst.check(_base64url(ZodBase64URL, params));
3368
- inst.xid = (params) => inst.check(_xid(ZodXID, params));
3369
- inst.ksuid = (params) => inst.check(_ksuid(ZodKSUID, params));
3370
- inst.ipv4 = (params) => inst.check(_ipv4(ZodIPv4, params));
3371
- inst.ipv6 = (params) => inst.check(_ipv6(ZodIPv6, params));
3372
- inst.cidrv4 = (params) => inst.check(_cidrv4(ZodCIDRv4, params));
3373
- inst.cidrv6 = (params) => inst.check(_cidrv6(ZodCIDRv6, params));
3374
- inst.e164 = (params) => inst.check(_e164(ZodE164, params));
7121
+ inst.email = (params) => inst.check(/* @__PURE__ */ _email(ZodEmail, params));
7122
+ inst.url = (params) => inst.check(/* @__PURE__ */ _url(ZodURL, params));
7123
+ inst.jwt = (params) => inst.check(/* @__PURE__ */ _jwt(ZodJWT, params));
7124
+ inst.emoji = (params) => inst.check(/* @__PURE__ */ _emoji(ZodEmoji, params));
7125
+ inst.guid = (params) => inst.check(/* @__PURE__ */ _guid(ZodGUID, params));
7126
+ inst.uuid = (params) => inst.check(/* @__PURE__ */ _uuid(ZodUUID, params));
7127
+ inst.uuidv4 = (params) => inst.check(/* @__PURE__ */ _uuidv4(ZodUUID, params));
7128
+ inst.uuidv6 = (params) => inst.check(/* @__PURE__ */ _uuidv6(ZodUUID, params));
7129
+ inst.uuidv7 = (params) => inst.check(/* @__PURE__ */ _uuidv7(ZodUUID, params));
7130
+ inst.nanoid = (params) => inst.check(/* @__PURE__ */ _nanoid(ZodNanoID, params));
7131
+ inst.guid = (params) => inst.check(/* @__PURE__ */ _guid(ZodGUID, params));
7132
+ inst.cuid = (params) => inst.check(/* @__PURE__ */ _cuid(ZodCUID, params));
7133
+ inst.cuid2 = (params) => inst.check(/* @__PURE__ */ _cuid2(ZodCUID2, params));
7134
+ inst.ulid = (params) => inst.check(/* @__PURE__ */ _ulid(ZodULID, params));
7135
+ inst.base64 = (params) => inst.check(/* @__PURE__ */ _base64(ZodBase64, params));
7136
+ inst.base64url = (params) => inst.check(/* @__PURE__ */ _base64url(ZodBase64URL, params));
7137
+ inst.xid = (params) => inst.check(/* @__PURE__ */ _xid(ZodXID, params));
7138
+ inst.ksuid = (params) => inst.check(/* @__PURE__ */ _ksuid(ZodKSUID, params));
7139
+ inst.ipv4 = (params) => inst.check(/* @__PURE__ */ _ipv4(ZodIPv4, params));
7140
+ inst.ipv6 = (params) => inst.check(/* @__PURE__ */ _ipv6(ZodIPv6, params));
7141
+ inst.cidrv4 = (params) => inst.check(/* @__PURE__ */ _cidrv4(ZodCIDRv4, params));
7142
+ inst.cidrv6 = (params) => inst.check(/* @__PURE__ */ _cidrv6(ZodCIDRv6, params));
7143
+ inst.e164 = (params) => inst.check(/* @__PURE__ */ _e164(ZodE164, params));
3375
7144
  inst.datetime = (params) => inst.check(datetime(params));
3376
7145
  inst.date = (params) => inst.check(date(params));
3377
7146
  inst.time = (params) => inst.check(time(params));
3378
7147
  inst.duration = (params) => inst.check(duration(params));
3379
7148
  });
3380
7149
  function string(params) {
3381
- return _string(ZodString, params);
7150
+ return /* @__PURE__ */ _string(ZodString, params);
3382
7151
  }
3383
7152
  const ZodStringFormat = /* @__PURE__ */ $constructor("ZodStringFormat", (inst, def) => {
3384
7153
  $ZodStringFormat.init(inst, def);
@@ -3464,20 +7233,20 @@ const ZodNumber = /* @__PURE__ */ $constructor("ZodNumber", (inst, def) => {
3464
7233
  $ZodNumber.init(inst, def);
3465
7234
  ZodType.init(inst, def);
3466
7235
  inst._zod.processJSONSchema = (ctx, json, params) => numberProcessor(inst, ctx, json, params);
3467
- inst.gt = (value, params) => inst.check(_gt(value, params));
3468
- inst.gte = (value, params) => inst.check(_gte(value, params));
3469
- inst.min = (value, params) => inst.check(_gte(value, params));
3470
- inst.lt = (value, params) => inst.check(_lt(value, params));
3471
- inst.lte = (value, params) => inst.check(_lte(value, params));
3472
- inst.max = (value, params) => inst.check(_lte(value, params));
7236
+ inst.gt = (value, params) => inst.check(/* @__PURE__ */ _gt(value, params));
7237
+ inst.gte = (value, params) => inst.check(/* @__PURE__ */ _gte(value, params));
7238
+ inst.min = (value, params) => inst.check(/* @__PURE__ */ _gte(value, params));
7239
+ inst.lt = (value, params) => inst.check(/* @__PURE__ */ _lt(value, params));
7240
+ inst.lte = (value, params) => inst.check(/* @__PURE__ */ _lte(value, params));
7241
+ inst.max = (value, params) => inst.check(/* @__PURE__ */ _lte(value, params));
3473
7242
  inst.int = (params) => inst.check(int(params));
3474
7243
  inst.safe = (params) => inst.check(int(params));
3475
- inst.positive = (params) => inst.check(_gt(0, params));
3476
- inst.nonnegative = (params) => inst.check(_gte(0, params));
3477
- inst.negative = (params) => inst.check(_lt(0, params));
3478
- inst.nonpositive = (params) => inst.check(_lte(0, params));
3479
- inst.multipleOf = (value, params) => inst.check(_multipleOf(value, params));
3480
- inst.step = (value, params) => inst.check(_multipleOf(value, params));
7244
+ inst.positive = (params) => inst.check(/* @__PURE__ */ _gt(0, params));
7245
+ inst.nonnegative = (params) => inst.check(/* @__PURE__ */ _gte(0, params));
7246
+ inst.negative = (params) => inst.check(/* @__PURE__ */ _lt(0, params));
7247
+ inst.nonpositive = (params) => inst.check(/* @__PURE__ */ _lte(0, params));
7248
+ inst.multipleOf = (value, params) => inst.check(/* @__PURE__ */ _multipleOf(value, params));
7249
+ inst.step = (value, params) => inst.check(/* @__PURE__ */ _multipleOf(value, params));
3481
7250
  inst.finite = () => inst;
3482
7251
  const bag = inst._zod.bag;
3483
7252
  inst.minValue = Math.max(bag.minimum ?? Number.NEGATIVE_INFINITY, bag.exclusiveMinimum ?? Number.NEGATIVE_INFINITY) ?? null;
@@ -3487,14 +7256,14 @@ const ZodNumber = /* @__PURE__ */ $constructor("ZodNumber", (inst, def) => {
3487
7256
  inst.format = bag.format ?? null;
3488
7257
  });
3489
7258
  function number(params) {
3490
- return _number(ZodNumber, params);
7259
+ return /* @__PURE__ */ _number(ZodNumber, params);
3491
7260
  }
3492
7261
  const ZodNumberFormat = /* @__PURE__ */ $constructor("ZodNumberFormat", (inst, def) => {
3493
7262
  $ZodNumberFormat.init(inst, def);
3494
7263
  ZodNumber.init(inst, def);
3495
7264
  });
3496
7265
  function int(params) {
3497
- return _int(ZodNumberFormat, params);
7266
+ return /* @__PURE__ */ _int(ZodNumberFormat, params);
3498
7267
  }
3499
7268
  const ZodUnknown = /* @__PURE__ */ $constructor("ZodUnknown", (inst, def) => {
3500
7269
  $ZodUnknown.init(inst, def);
@@ -3502,7 +7271,7 @@ const ZodUnknown = /* @__PURE__ */ $constructor("ZodUnknown", (inst, def) => {
3502
7271
  inst._zod.processJSONSchema = (ctx, json, params) => unknownProcessor(inst, ctx, json, params);
3503
7272
  });
3504
7273
  function unknown() {
3505
- return _unknown(ZodUnknown);
7274
+ return /* @__PURE__ */ _unknown(ZodUnknown);
3506
7275
  }
3507
7276
  const ZodNever = /* @__PURE__ */ $constructor("ZodNever", (inst, def) => {
3508
7277
  $ZodNever.init(inst, def);
@@ -3510,21 +7279,21 @@ const ZodNever = /* @__PURE__ */ $constructor("ZodNever", (inst, def) => {
3510
7279
  inst._zod.processJSONSchema = (ctx, json, params) => neverProcessor(inst, ctx, json, params);
3511
7280
  });
3512
7281
  function never(params) {
3513
- return _never(ZodNever, params);
7282
+ return /* @__PURE__ */ _never(ZodNever, params);
3514
7283
  }
3515
7284
  const ZodArray = /* @__PURE__ */ $constructor("ZodArray", (inst, def) => {
3516
7285
  $ZodArray.init(inst, def);
3517
7286
  ZodType.init(inst, def);
3518
7287
  inst._zod.processJSONSchema = (ctx, json, params) => arrayProcessor(inst, ctx, json, params);
3519
7288
  inst.element = def.element;
3520
- inst.min = (minLength, params) => inst.check(_minLength(minLength, params));
3521
- inst.nonempty = (params) => inst.check(_minLength(1, params));
3522
- inst.max = (maxLength, params) => inst.check(_maxLength(maxLength, params));
3523
- inst.length = (len, params) => inst.check(_length(len, params));
7289
+ inst.min = (minLength, params) => inst.check(/* @__PURE__ */ _minLength(minLength, params));
7290
+ inst.nonempty = (params) => inst.check(/* @__PURE__ */ _minLength(1, params));
7291
+ inst.max = (maxLength, params) => inst.check(/* @__PURE__ */ _maxLength(maxLength, params));
7292
+ inst.length = (len, params) => inst.check(/* @__PURE__ */ _length(len, params));
3524
7293
  inst.unwrap = () => inst.element;
3525
7294
  });
3526
7295
  function array(element, params) {
3527
- return _array(ZodArray, element, params);
7296
+ return /* @__PURE__ */ _array(ZodArray, element, params);
3528
7297
  }
3529
7298
  const ZodObject = /* @__PURE__ */ $constructor("ZodObject", (inst, def) => {
3530
7299
  $ZodObjectJIT.init(inst, def);
@@ -3641,10 +7410,10 @@ const ZodTransform = /* @__PURE__ */ $constructor("ZodTransform", (inst, def) =>
3641
7410
  inst._zod.processJSONSchema = (ctx, json, params) => transformProcessor(inst, ctx, json, params);
3642
7411
  inst._zod.parse = (payload, _ctx) => {
3643
7412
  if (_ctx.direction === "backward") throw new $ZodEncodeError(inst.constructor.name);
3644
- payload.addIssue = (issue$1) => {
3645
- if (typeof issue$1 === "string") payload.issues.push(issue(issue$1, payload.value, def));
7413
+ payload.addIssue = (issue$1$1) => {
7414
+ if (typeof issue$1$1 === "string") payload.issues.push(issue(issue$1$1, payload.value, def));
3646
7415
  else {
3647
- const _issue = issue$1;
7416
+ const _issue = issue$1$1;
3648
7417
  if (_issue.fatal) _issue.continue = false;
3649
7418
  _issue.code ?? (_issue.code = "custom");
3650
7419
  _issue.input ?? (_issue.input = payload.value);
@@ -3793,18 +7562,13 @@ const ZodCustom = /* @__PURE__ */ $constructor("ZodCustom", (inst, def) => {
3793
7562
  inst._zod.processJSONSchema = (ctx, json, params) => customProcessor(inst, ctx, json, params);
3794
7563
  });
3795
7564
  function refine(fn, _params = {}) {
3796
- return _refine(ZodCustom, fn, _params);
7565
+ return /* @__PURE__ */ _refine(ZodCustom, fn, _params);
3797
7566
  }
3798
7567
  function superRefine(fn) {
3799
- return _superRefine(fn);
7568
+ return /* @__PURE__ */ _superRefine(fn);
3800
7569
  }
3801
- const describe = describe$1;
3802
- const meta = meta$1;
3803
-
3804
- //#endregion
3805
- //#region ../feature-schema/dist/schema.mjs
3806
7570
  /** Matches any domain prefix: feat-2026-001, proc-2026-001, goal-2026-001, etc. */
3807
- const FEATURE_KEY_PATTERN$1 = /^[a-z][a-z0-9]*-\d{4}-\d{3}$/;
7571
+ const FEATURE_KEY_PATTERN = /^[a-z][a-z0-9]*-\d{4}-\d{3}$/;
3808
7572
  const FeatureStatusSchema = _enum([
3809
7573
  "draft",
3810
7574
  "active",
@@ -3830,7 +7594,7 @@ const LineageSchema = object({
3830
7594
  spawnReason: string().nullable().optional()
3831
7595
  });
3832
7596
  const FeatureSchema = object({
3833
- featureKey: string().regex(FEATURE_KEY_PATTERN$1, "featureKey must match pattern <domain>-YYYY-NNN (e.g. feat-2026-001, proc-2026-001)"),
7597
+ featureKey: string().regex(FEATURE_KEY_PATTERN, "featureKey must match pattern <domain>-YYYY-NNN (e.g. feat-2026-001, proc-2026-001)"),
3834
7598
  title: string().min(1),
3835
7599
  status: FeatureStatusSchema,
3836
7600
  problem: string().min(1),
@@ -3846,10 +7610,7 @@ const FeatureSchema = object({
3846
7610
  successCriteria: string().optional(),
3847
7611
  domain: string().optional()
3848
7612
  });
3849
-
3850
- //#endregion
3851
- //#region ../feature-schema/dist/validate.mjs
3852
- function validateFeature$1(data) {
7613
+ function validateFeature(data) {
3853
7614
  const result = FeatureSchema.safeParse(data);
3854
7615
  if (result.success) return {
3855
7616
  success: true,
@@ -3857,14 +7618,11 @@ function validateFeature$1(data) {
3857
7618
  };
3858
7619
  return {
3859
7620
  success: false,
3860
- errors: result.error.issues.map((issue$1) => {
3861
- return `${issue$1.path.length > 0 ? `${issue$1.path.join(".")}: ` : ""}${issue$1.message}`;
7621
+ errors: result.error.issues.map((issue$1$1) => {
7622
+ return `${issue$1$1.path.length > 0 ? `${issue$1$1.path.join(".")}: ` : ""}${issue$1$1.message}`;
3862
7623
  })
3863
7624
  };
3864
7625
  }
3865
-
3866
- //#endregion
3867
- //#region ../lac-claude/dist/index.mjs
3868
7626
  function createClient() {
3869
7627
  let apiKey = process$1.env.ANTHROPIC_API_KEY;
3870
7628
  if (!apiKey) {
@@ -4150,7 +7908,7 @@ async function fillFeature(options) {
4150
7908
  } catch {
4151
7909
  throw new Error(`Invalid JSON in "${featurePath}"`);
4152
7910
  }
4153
- const result = validateFeature$1(parsed);
7911
+ const result = validateFeature(parsed);
4154
7912
  if (!result.success) throw new Error(`Invalid feature.json: ${result.errors.join(", ")}`);
4155
7913
  const feature = result.data;
4156
7914
  const client = createClient();
@@ -4250,7 +8008,7 @@ async function genFromFeature(options) {
4250
8008
  } catch {
4251
8009
  throw new Error(`No feature.json found at "${featurePath}"`);
4252
8010
  }
4253
- const result = validateFeature$1(JSON.parse(raw));
8011
+ const result = validateFeature(JSON.parse(raw));
4254
8012
  if (!result.success) throw new Error(`Invalid feature.json: ${result.errors.join(", ")}`);
4255
8013
  const feature = result.data;
4256
8014
  const promptConfig = GEN_PROMPTS[type];
@@ -4475,7 +8233,7 @@ const blameCommand = new Command("blame").description("Show which feature owns a
4475
8233
  process$1.stderr.write(`Error: "${featureJsonPath}" contains invalid JSON.\n`);
4476
8234
  process$1.exit(1);
4477
8235
  }
4478
- const result = validateFeature(parsed);
8236
+ const result = validateFeature$1(parsed);
4479
8237
  if (!result.success) {
4480
8238
  process$1.stderr.write(`Error: "${featureJsonPath}" failed validation:\n ${result.errors.join("\n ")}\n`);
4481
8239
  process$1.exit(1);
@@ -4630,7 +8388,7 @@ async function walkFeatureFiles(currentDir) {
4630
8388
  });
4631
8389
  continue;
4632
8390
  }
4633
- const result = validateFeature(parsed);
8391
+ const result = validateFeature$1(parsed);
4634
8392
  if (!result.success) invalidFiles.push({
4635
8393
  filePath: fullPath,
4636
8394
  errors: result.errors
@@ -4740,19 +8498,19 @@ const doctorCommand = new Command("doctor").description("Check workspace health
4740
8498
  failed++;
4741
8499
  }
4742
8500
  try {
4743
- const config$1 = loadConfig(checkDir);
4744
- const toCheck = (await scanFeatures(checkDir)).filter(({ feature }) => config$1.lintStatuses.includes(feature.status));
8501
+ const config$2 = loadConfig(checkDir);
8502
+ const toCheck = (await scanFeatures(checkDir)).filter(({ feature }) => config$2.lintStatuses.includes(feature.status));
4745
8503
  let lintWarnCount = 0;
4746
8504
  for (const { feature } of toCheck) {
4747
8505
  const raw = feature;
4748
8506
  const completeness = computeCompleteness(raw);
4749
- const missingRequired = config$1.requiredFields.filter((field) => {
8507
+ const missingRequired = config$2.requiredFields.filter((field) => {
4750
8508
  const val = raw[field];
4751
8509
  if (val === void 0 || val === null || val === "") return true;
4752
8510
  if (Array.isArray(val)) return val.length === 0;
4753
8511
  return typeof val === "string" && val.trim().length === 0;
4754
8512
  });
4755
- const belowThreshold = config$1.ciThreshold > 0 && completeness < config$1.ciThreshold;
8513
+ const belowThreshold = config$2.ciThreshold > 0 && completeness < config$2.ciThreshold;
4756
8514
  if (missingRequired.length > 0 || belowThreshold) lintWarnCount++;
4757
8515
  }
4758
8516
  if (lintWarnCount === 0) {
@@ -5332,11 +9090,11 @@ function renderDecisions(decisions) {
5332
9090
  <h2>Decisions</h2>
5333
9091
  <ol class="decisions">
5334
9092
  ${decisions.map((d) => {
5335
- const date$2 = d.date ? `<div class="decision-date">${escapeHtml$1(d.date)}</div>` : "";
9093
+ const date$4 = d.date ? `<div class="decision-date">${escapeHtml$1(d.date)}</div>` : "";
5336
9094
  const alts = d.alternativesConsidered && d.alternativesConsidered.length > 0 ? `<div class="alternatives"><span>Alternatives considered:</span> ${d.alternativesConsidered.map(escapeHtml$1).join(", ")}</div>` : "";
5337
9095
  return `
5338
9096
  <li>
5339
- ${date$2}
9097
+ ${date$4}
5340
9098
  <div class="decision-text">${escapeHtml$1(d.decision)}</div>
5341
9099
  <div class="decision-rationale">${escapeHtml$1(d.rationale)}</div>
5342
9100
  ${alts}
@@ -5647,7 +9405,7 @@ const exportCommand = new Command("export").description("Export feature.json as
5647
9405
  process$1.stderr.write(`Error: "${featureJsonPath}" contains invalid JSON.\n`);
5648
9406
  process$1.exit(1);
5649
9407
  }
5650
- const result = validateFeature(parsed);
9408
+ const result = validateFeature$1(parsed);
5651
9409
  if (!result.success) {
5652
9410
  process$1.stderr.write(`Error: "${featureJsonPath}" failed validation:\n ${result.errors.join("\n ")}\n`);
5653
9411
  process$1.exit(1);
@@ -5843,7 +9601,7 @@ const initCommand = new Command("init").description("Scaffold a feature.json in
5843
9601
  });
5844
9602
  if (titleAnswer.customTitle && titleAnswer.customTitle.trim().length > 0) finalTitle = titleAnswer.customTitle.trim();
5845
9603
  }
5846
- const validation = validateFeature({
9604
+ const validation = validateFeature$1({
5847
9605
  featureKey,
5848
9606
  title: finalTitle,
5849
9607
  status,
@@ -5983,16 +9741,16 @@ async function fixFeature(filePath, missingFields) {
5983
9741
  fixed++;
5984
9742
  }
5985
9743
  if (fixed === 0) return 0;
5986
- const validation = validateFeature(parsed);
9744
+ const validation = validateFeature$1(parsed);
5987
9745
  if (!validation.success) return 0;
5988
9746
  await writeFile(filePath, JSON.stringify(validation.data, null, 2) + "\n", "utf-8");
5989
9747
  return fixed;
5990
9748
  }
5991
9749
  const lintCommand = new Command("lint").description("Check feature.json files for completeness and required fields").argument("[dir]", "Directory to scan (default: current directory)").option("--require <fields>", "Comma-separated required fields (overrides lac.config.json)").option("--threshold <n>", "Minimum completeness % required (overrides lac.config.json)", parseInt).option("--quiet", "Only print failures, suppress passing results").option("--json", "Output results as JSON").option("--watch", "Re-run lint on every feature.json change").option("--fix", "Auto-insert default values for missing required fields").action(async (dir, options) => {
5992
9750
  const scanDir = resolve(dir ?? process$1.cwd());
5993
- const config$1 = loadConfig(scanDir);
5994
- const requiredFields = options.require ? options.require.split(",").map((f) => f.trim()).filter(Boolean) : config$1.requiredFields;
5995
- const threshold = options.threshold !== void 0 ? options.threshold : config$1.ciThreshold;
9751
+ const config$2 = loadConfig(scanDir);
9752
+ const requiredFields = options.require ? options.require.split(",").map((f) => f.trim()).filter(Boolean) : config$2.requiredFields;
9753
+ const threshold = options.threshold !== void 0 ? options.threshold : config$2.ciThreshold;
5996
9754
  async function runLint() {
5997
9755
  let scanned;
5998
9756
  try {
@@ -6006,7 +9764,7 @@ const lintCommand = new Command("lint").description("Check feature.json files fo
6006
9764
  process$1.stdout.write(`No feature.json files found in "${scanDir}".\n`);
6007
9765
  return 0;
6008
9766
  }
6009
- const results = scanned.filter(({ feature }) => config$1.lintStatuses.includes(feature.status)).map(({ feature, filePath }) => checkFeature(feature, filePath, requiredFields, threshold));
9767
+ const results = scanned.filter(({ feature }) => config$2.lintStatuses.includes(feature.status)).map(({ feature, filePath }) => checkFeature(feature, filePath, requiredFields, threshold));
6010
9768
  if (options.fix) {
6011
9769
  const toFix = results.filter((r) => !r.pass && r.missingRequired.length > 0);
6012
9770
  let totalFixed = 0;
@@ -6032,7 +9790,7 @@ const lintCommand = new Command("lint").description("Check feature.json files fo
6032
9790
  process$1.stdout.write(`\n✓ Fixed ${totalFixed} field${totalFixed === 1 ? "" : "s"}. Could not re-validate — run "lac lint" to confirm.\n`);
6033
9791
  return 0;
6034
9792
  }
6035
- const stillFailing = rescanned.filter(({ feature }) => config$1.lintStatuses.includes(feature.status)).map(({ feature, filePath }) => checkFeature(feature, filePath, requiredFields, threshold)).filter((r) => !r.pass);
9793
+ const stillFailing = rescanned.filter(({ feature }) => config$2.lintStatuses.includes(feature.status)).map(({ feature, filePath }) => checkFeature(feature, filePath, requiredFields, threshold)).filter((r) => !r.pass);
6036
9794
  if (stillFailing.length === 0) {
6037
9795
  process$1.stdout.write(`\n✓ Fixed ${totalFixed} field${totalFixed === 1 ? "" : "s"} — all features now pass lint.\n`);
6038
9796
  return 0;
@@ -6130,7 +9888,7 @@ const importCommand = new Command("import").description("Import features from a
6130
9888
  let imported = 0;
6131
9889
  let skipped = 0;
6132
9890
  for (const item of features) {
6133
- const result = validateFeature(item);
9891
+ const result = validateFeature$1(item);
6134
9892
  if (!result.success) {
6135
9893
  const key = item?.["featureKey"] ?? "(unknown)";
6136
9894
  if (skipInvalid) {
@@ -6202,7 +9960,7 @@ async function patchLineageRefs(features, oldKey, newKey) {
6202
9960
  }
6203
9961
  if (changed) {
6204
9962
  data["lineage"] = updatedLineage;
6205
- const validation = validateFeature(data);
9963
+ const validation = validateFeature$1(data);
6206
9964
  if (validation.success) {
6207
9965
  await writeFile(filePath, JSON.stringify(validation.data, null, 2) + "\n", "utf-8");
6208
9966
  patched++;
@@ -6212,7 +9970,7 @@ async function patchLineageRefs(features, oldKey, newKey) {
6212
9970
  return patched;
6213
9971
  }
6214
9972
  const renameCommand = new Command("rename").description("Rename a featureKey — updates the feature.json and patches all lineage references").argument("<old-key>", "Current featureKey (e.g. feat-2026-001)").argument("<new-key>", "New featureKey (e.g. feat-2026-099)").option("-d, --dir <path>", "Directory to scan for features (default: cwd)").option("--dry-run", "Preview changes without writing files").action(async (oldKey, newKey, options) => {
6215
- if (!FEATURE_KEY_PATTERN.test(newKey)) {
9973
+ if (!FEATURE_KEY_PATTERN$1.test(newKey)) {
6216
9974
  process$1.stderr.write(`Error: "${newKey}" is not a valid featureKey.\nKeys must match the pattern <domain>-YYYY-NNN (e.g. feat-2026-099).\n`);
6217
9975
  process$1.exit(1);
6218
9976
  }
@@ -6257,7 +10015,7 @@ const renameCommand = new Command("rename").description("Rename a featureKey —
6257
10015
  const raw = await readFile(target.filePath, "utf-8");
6258
10016
  const parsed = JSON.parse(raw);
6259
10017
  parsed["featureKey"] = newKey;
6260
- const validation = validateFeature(parsed);
10018
+ const validation = validateFeature$1(parsed);
6261
10019
  if (!validation.success) {
6262
10020
  process$1.stderr.write(`Internal error: renamed feature failed validation:\n ${validation.errors.join("\n ")}\n`);
6263
10021
  process$1.exit(1);
@@ -6540,7 +10298,7 @@ const spawnCommand = new Command("spawn").description("Spawn a child feature fro
6540
10298
  process$1.exit(1);
6541
10299
  }
6542
10300
  const title = titleFromProblem(problem);
6543
- const validation = validateFeature({
10301
+ const validation = validateFeature$1({
6544
10302
  featureKey,
6545
10303
  title,
6546
10304
  status,
@@ -6632,7 +10390,7 @@ const tagCommand = new Command("tag").description("Add or remove tags on a featu
6632
10390
  const raw = await readFile(found.filePath, "utf-8");
6633
10391
  const parsed = JSON.parse(raw);
6634
10392
  parsed["tags"] = updated;
6635
- const validation = validateFeature(parsed);
10393
+ const validation = validateFeature$1(parsed);
6636
10394
  if (!validation.success) {
6637
10395
  process$1.stderr.write(`Validation error: ${validation.errors.join(", ")}\n`);
6638
10396
  process$1.exit(1);