@pyreon/mcp 0.5.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,3392 @@
1
+ #!/usr/bin/env node
2
+ import { ZodOptional, z } from "zod";
3
+ import process$1 from "node:process";
4
+ import { detectReactPatterns, diagnoseError, migrateReactCode } from "@pyreon/compiler";
5
+ import * as fs from "node:fs";
6
+ import * as path from "node:path";
7
+
8
+ //#region \0rolldown/runtime.js
9
+
10
+ function getErrorMap() {
11
+ return overrideErrorMap;
12
+ }
13
+
14
+ //#endregion
15
+ //#region ../../node_modules/.bun/zod@4.3.6/node_modules/zod/v3/helpers/parseUtil.js
16
+
17
+ function addIssueToContext(ctx, issueData) {
18
+ const overrideMap = getErrorMap();
19
+ const issue = makeIssue({
20
+ issueData,
21
+ data: ctx.data,
22
+ path: ctx.path,
23
+ errorMaps: [ctx.common.contextualErrorMap, ctx.schemaErrorMap, overrideMap, overrideMap === errorMap ? void 0 : errorMap].filter(x => !!x)
24
+ });
25
+ ctx.common.issues.push(issue);
26
+ }
27
+ function processCreateParams(params) {
28
+ if (!params) return {};
29
+ const {
30
+ errorMap,
31
+ invalid_type_error,
32
+ required_error,
33
+ description
34
+ } = params;
35
+ if (errorMap && (invalid_type_error || required_error)) throw new Error(`Can't use "invalid_type_error" or "required_error" in conjunction with custom error map.`);
36
+ if (errorMap) return {
37
+ errorMap,
38
+ description
39
+ };
40
+ const customMap = (iss, ctx) => {
41
+ const {
42
+ message
43
+ } = params;
44
+ if (iss.code === "invalid_enum_value") return {
45
+ message: message ?? ctx.defaultError
46
+ };
47
+ if (typeof ctx.data === "undefined") return {
48
+ message: message ?? required_error ?? ctx.defaultError
49
+ };
50
+ if (iss.code !== "invalid_type") return {
51
+ message: ctx.defaultError
52
+ };
53
+ return {
54
+ message: message ?? invalid_type_error ?? ctx.defaultError
55
+ };
56
+ };
57
+ return {
58
+ errorMap: customMap,
59
+ description
60
+ };
61
+ }
62
+ function timeRegexSource(args) {
63
+ let secondsRegexSource = `[0-5]\\d`;
64
+ if (args.precision) secondsRegexSource = `${secondsRegexSource}\\.\\d{${args.precision}}`;else if (args.precision == null) secondsRegexSource = `${secondsRegexSource}(\\.\\d+)?`;
65
+ const secondsQuantifier = args.precision ? "+" : "?";
66
+ return `([01]\\d|2[0-3]):[0-5]\\d(:${secondsRegexSource})${secondsQuantifier}`;
67
+ }
68
+ function timeRegex(args) {
69
+ return new RegExp(`^${timeRegexSource(args)}$`);
70
+ }
71
+ function datetimeRegex(args) {
72
+ let regex = `${dateRegexSource}T${timeRegexSource(args)}`;
73
+ const opts = [];
74
+ opts.push(args.local ? `Z?` : `Z`);
75
+ if (args.offset) opts.push(`([+-]\\d{2}:?\\d{2})`);
76
+ regex = `${regex}(${opts.join("|")})`;
77
+ return new RegExp(`^${regex}$`);
78
+ }
79
+ function isValidIP(ip, version) {
80
+ if ((version === "v4" || !version) && ipv4Regex.test(ip)) return true;
81
+ if ((version === "v6" || !version) && ipv6Regex.test(ip)) return true;
82
+ return false;
83
+ }
84
+ function isValidJWT$1(jwt, alg) {
85
+ if (!jwtRegex.test(jwt)) return false;
86
+ try {
87
+ const [header] = jwt.split(".");
88
+ if (!header) return false;
89
+ const base64 = header.replace(/-/g, "+").replace(/_/g, "/").padEnd(header.length + (4 - header.length % 4) % 4, "=");
90
+ const decoded = JSON.parse(atob(base64));
91
+ if (typeof decoded !== "object" || decoded === null) return false;
92
+ if ("typ" in decoded && decoded?.typ !== "JWT") return false;
93
+ if (!decoded.alg) return false;
94
+ if (alg && decoded.alg !== alg) return false;
95
+ return true;
96
+ } catch {
97
+ return false;
98
+ }
99
+ }
100
+ function isValidCidr(ip, version) {
101
+ if ((version === "v4" || !version) && ipv4CidrRegex.test(ip)) return true;
102
+ if ((version === "v6" || !version) && ipv6CidrRegex.test(ip)) return true;
103
+ return false;
104
+ }
105
+ function floatSafeRemainder$1(val, step) {
106
+ const valDecCount = (val.toString().split(".")[1] || "").length;
107
+ const stepDecCount = (step.toString().split(".")[1] || "").length;
108
+ const decCount = valDecCount > stepDecCount ? valDecCount : stepDecCount;
109
+ return Number.parseInt(val.toFixed(decCount).replace(".", "")) % Number.parseInt(step.toFixed(decCount).replace(".", "")) / 10 ** decCount;
110
+ }
111
+ function deepPartialify(schema) {
112
+ if (schema instanceof ZodObject$1) {
113
+ const newShape = {};
114
+ for (const key in schema.shape) {
115
+ const fieldSchema = schema.shape[key];
116
+ newShape[key] = ZodOptional$2.create(deepPartialify(fieldSchema));
117
+ }
118
+ return new ZodObject$1({
119
+ ...schema._def,
120
+ shape: () => newShape
121
+ });
122
+ } else if (schema instanceof ZodArray$1) return new ZodArray$1({
123
+ ...schema._def,
124
+ type: deepPartialify(schema.element)
125
+ });else if (schema instanceof ZodOptional$2) return ZodOptional$2.create(deepPartialify(schema.unwrap()));else if (schema instanceof ZodNullable$1) return ZodNullable$1.create(deepPartialify(schema.unwrap()));else if (schema instanceof ZodTuple) return ZodTuple.create(schema.items.map(item => deepPartialify(item)));else return schema;
126
+ }
127
+ function mergeValues$1(a, b) {
128
+ const aType = getParsedType(a);
129
+ const bType = getParsedType(b);
130
+ if (a === b) return {
131
+ valid: true,
132
+ data: a
133
+ };else if (aType === ZodParsedType.object && bType === ZodParsedType.object) {
134
+ const bKeys = util.objectKeys(b);
135
+ const sharedKeys = util.objectKeys(a).filter(key => bKeys.indexOf(key) !== -1);
136
+ const newObj = {
137
+ ...a,
138
+ ...b
139
+ };
140
+ for (const key of sharedKeys) {
141
+ const sharedValue = mergeValues$1(a[key], b[key]);
142
+ if (!sharedValue.valid) return {
143
+ valid: false
144
+ };
145
+ newObj[key] = sharedValue.data;
146
+ }
147
+ return {
148
+ valid: true,
149
+ data: newObj
150
+ };
151
+ } else if (aType === ZodParsedType.array && bType === ZodParsedType.array) {
152
+ if (a.length !== b.length) return {
153
+ valid: false
154
+ };
155
+ const newArray = [];
156
+ for (let index = 0; index < a.length; index++) {
157
+ const itemA = a[index];
158
+ const itemB = b[index];
159
+ const sharedValue = mergeValues$1(itemA, itemB);
160
+ if (!sharedValue.valid) return {
161
+ valid: false
162
+ };
163
+ newArray.push(sharedValue.data);
164
+ }
165
+ return {
166
+ valid: true,
167
+ data: newArray
168
+ };
169
+ } else if (aType === ZodParsedType.date && bType === ZodParsedType.date && +a === +b) return {
170
+ valid: true,
171
+ data: a
172
+ };else return {
173
+ valid: false
174
+ };
175
+ }
176
+ function createZodEnum(values, params) {
177
+ return new ZodEnum$1({
178
+ values,
179
+ typeName: ZodFirstPartyTypeKind.ZodEnum,
180
+ ...processCreateParams(params)
181
+ });
182
+ }
183
+ function $constructor(name, initializer, params) {
184
+ function init(inst, def) {
185
+ if (!inst._zod) Object.defineProperty(inst, "_zod", {
186
+ value: {
187
+ def,
188
+ constr: _,
189
+ traits: /* @__PURE__ */new Set()
190
+ },
191
+ enumerable: false
192
+ });
193
+ if (inst._zod.traits.has(name)) return;
194
+ inst._zod.traits.add(name);
195
+ initializer(inst, def);
196
+ const proto = _.prototype;
197
+ const keys = Object.keys(proto);
198
+ for (let i = 0; i < keys.length; i++) {
199
+ const k = keys[i];
200
+ if (!(k in inst)) inst[k] = proto[k].bind(inst);
201
+ }
202
+ }
203
+ const Parent = params?.Parent ?? Object;
204
+ class Definition extends Parent {}
205
+ Object.defineProperty(Definition, "name", {
206
+ value: name
207
+ });
208
+ function _(def) {
209
+ var _a;
210
+ const inst = params?.Parent ? new Definition() : this;
211
+ init(inst, def);
212
+ (_a = inst._zod).deferred ?? (_a.deferred = []);
213
+ for (const fn of inst._zod.deferred) fn();
214
+ return inst;
215
+ }
216
+ Object.defineProperty(_, "init", {
217
+ value: init
218
+ });
219
+ Object.defineProperty(_, Symbol.hasInstance, {
220
+ value: inst => {
221
+ if (params?.Parent && inst instanceof params.Parent) return true;
222
+ return inst?._zod?.traits?.has(name);
223
+ }
224
+ });
225
+ Object.defineProperty(_, "name", {
226
+ value: name
227
+ });
228
+ return _;
229
+ }
230
+ function config(newConfig) {
231
+ if (newConfig) Object.assign(globalConfig, newConfig);
232
+ return globalConfig;
233
+ }
234
+
235
+ //#endregion
236
+ //#region ../../node_modules/.bun/zod@4.3.6/node_modules/zod/v4/core/util.js
237
+ function getEnumValues(entries) {
238
+ const numericValues = Object.values(entries).filter(v => typeof v === "number");
239
+ return Object.entries(entries).filter(([k, _]) => numericValues.indexOf(+k) === -1).map(([_, v]) => v);
240
+ }
241
+ function jsonStringifyReplacer(_, value) {
242
+ if (typeof value === "bigint") return value.toString();
243
+ return value;
244
+ }
245
+ function cached(getter) {
246
+ return {
247
+ get value() {
248
+ {
249
+ const value = getter();
250
+ Object.defineProperty(this, "value", {
251
+ value
252
+ });
253
+ return value;
254
+ }
255
+ throw new Error("cached value already set");
256
+ }
257
+ };
258
+ }
259
+ function nullish(input) {
260
+ return input === null || input === void 0;
261
+ }
262
+ function cleanRegex(source) {
263
+ const start = source.startsWith("^") ? 1 : 0;
264
+ const end = source.endsWith("$") ? source.length - 1 : source.length;
265
+ return source.slice(start, end);
266
+ }
267
+ function floatSafeRemainder(val, step) {
268
+ const valDecCount = (val.toString().split(".")[1] || "").length;
269
+ const stepString = step.toString();
270
+ let stepDecCount = (stepString.split(".")[1] || "").length;
271
+ if (stepDecCount === 0 && /\d?e-\d?/.test(stepString)) {
272
+ const match = stepString.match(/\d?e-(\d?)/);
273
+ if (match?.[1]) stepDecCount = Number.parseInt(match[1]);
274
+ }
275
+ const decCount = valDecCount > stepDecCount ? valDecCount : stepDecCount;
276
+ return Number.parseInt(val.toFixed(decCount).replace(".", "")) % Number.parseInt(step.toFixed(decCount).replace(".", "")) / 10 ** decCount;
277
+ }
278
+ function defineLazy(object, key, getter) {
279
+ let value = void 0;
280
+ Object.defineProperty(object, key, {
281
+ get() {
282
+ if (value === EVALUATING) return;
283
+ if (value === void 0) {
284
+ value = EVALUATING;
285
+ value = getter();
286
+ }
287
+ return value;
288
+ },
289
+ set(v) {
290
+ Object.defineProperty(object, key, {
291
+ value: v
292
+ });
293
+ },
294
+ configurable: true
295
+ });
296
+ }
297
+ function assignProp(target, prop, value) {
298
+ Object.defineProperty(target, prop, {
299
+ value,
300
+ writable: true,
301
+ enumerable: true,
302
+ configurable: true
303
+ });
304
+ }
305
+ function mergeDefs(...defs) {
306
+ const mergedDescriptors = {};
307
+ for (const def of defs) {
308
+ const descriptors = Object.getOwnPropertyDescriptors(def);
309
+ Object.assign(mergedDescriptors, descriptors);
310
+ }
311
+ return Object.defineProperties({}, mergedDescriptors);
312
+ }
313
+ function esc(str) {
314
+ return JSON.stringify(str);
315
+ }
316
+ function slugify(input) {
317
+ return input.toLowerCase().trim().replace(/[^\w\s-]/g, "").replace(/[\s_-]+/g, "-").replace(/^-+|-+$/g, "");
318
+ }
319
+ function isObject(data) {
320
+ return typeof data === "object" && data !== null && !Array.isArray(data);
321
+ }
322
+ function isPlainObject$1(o) {
323
+ if (isObject(o) === false) return false;
324
+ const ctor = o.constructor;
325
+ if (ctor === void 0) return true;
326
+ if (typeof ctor !== "function") return true;
327
+ const prot = ctor.prototype;
328
+ if (isObject(prot) === false) return false;
329
+ if (Object.prototype.hasOwnProperty.call(prot, "isPrototypeOf") === false) return false;
330
+ return true;
331
+ }
332
+ function shallowClone(o) {
333
+ if (isPlainObject$1(o)) return {
334
+ ...o
335
+ };
336
+ if (Array.isArray(o)) return [...o];
337
+ return o;
338
+ }
339
+ function escapeRegex(str) {
340
+ return str.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
341
+ }
342
+ function clone(inst, def, params) {
343
+ const cl = new inst._zod.constr(def ?? inst._zod.def);
344
+ if (!def || params?.parent) cl._zod.parent = inst;
345
+ return cl;
346
+ }
347
+ function normalizeParams(_params) {
348
+ const params = _params;
349
+ if (!params) return {};
350
+ if (typeof params === "string") return {
351
+ error: () => params
352
+ };
353
+ if (params?.message !== void 0) {
354
+ if (params?.error !== void 0) throw new Error("Cannot specify both `message` and `error` params");
355
+ params.error = params.message;
356
+ }
357
+ delete params.message;
358
+ if (typeof params.error === "string") return {
359
+ ...params,
360
+ error: () => params.error
361
+ };
362
+ return params;
363
+ }
364
+ function optionalKeys(shape) {
365
+ return Object.keys(shape).filter(k => {
366
+ return shape[k]._zod.optin === "optional" && shape[k]._zod.optout === "optional";
367
+ });
368
+ }
369
+ function pick(schema, mask) {
370
+ const currDef = schema._zod.def;
371
+ const checks = currDef.checks;
372
+ if (checks && checks.length > 0) throw new Error(".pick() cannot be used on object schemas containing refinements");
373
+ return clone(schema, mergeDefs(schema._zod.def, {
374
+ get shape() {
375
+ const newShape = {};
376
+ for (const key in mask) {
377
+ if (!(key in currDef.shape)) throw new Error(`Unrecognized key: "${key}"`);
378
+ if (!mask[key]) continue;
379
+ newShape[key] = currDef.shape[key];
380
+ }
381
+ assignProp(this, "shape", newShape);
382
+ return newShape;
383
+ },
384
+ checks: []
385
+ }));
386
+ }
387
+ function omit(schema, mask) {
388
+ const currDef = schema._zod.def;
389
+ const checks = currDef.checks;
390
+ if (checks && checks.length > 0) throw new Error(".omit() cannot be used on object schemas containing refinements");
391
+ return clone(schema, mergeDefs(schema._zod.def, {
392
+ get shape() {
393
+ const newShape = {
394
+ ...schema._zod.def.shape
395
+ };
396
+ for (const key in mask) {
397
+ if (!(key in currDef.shape)) throw new Error(`Unrecognized key: "${key}"`);
398
+ if (!mask[key]) continue;
399
+ delete newShape[key];
400
+ }
401
+ assignProp(this, "shape", newShape);
402
+ return newShape;
403
+ },
404
+ checks: []
405
+ }));
406
+ }
407
+ function extend(schema, shape) {
408
+ if (!isPlainObject$1(shape)) throw new Error("Invalid input to extend: expected a plain object");
409
+ const checks = schema._zod.def.checks;
410
+ if (checks && checks.length > 0) {
411
+ const existingShape = schema._zod.def.shape;
412
+ 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.");
413
+ }
414
+ return clone(schema, mergeDefs(schema._zod.def, {
415
+ get shape() {
416
+ const _shape = {
417
+ ...schema._zod.def.shape,
418
+ ...shape
419
+ };
420
+ assignProp(this, "shape", _shape);
421
+ return _shape;
422
+ }
423
+ }));
424
+ }
425
+ function safeExtend(schema, shape) {
426
+ if (!isPlainObject$1(shape)) throw new Error("Invalid input to safeExtend: expected a plain object");
427
+ return clone(schema, mergeDefs(schema._zod.def, {
428
+ get shape() {
429
+ const _shape = {
430
+ ...schema._zod.def.shape,
431
+ ...shape
432
+ };
433
+ assignProp(this, "shape", _shape);
434
+ return _shape;
435
+ }
436
+ }));
437
+ }
438
+ function merge(a, b) {
439
+ return clone(a, mergeDefs(a._zod.def, {
440
+ get shape() {
441
+ const _shape = {
442
+ ...a._zod.def.shape,
443
+ ...b._zod.def.shape
444
+ };
445
+ assignProp(this, "shape", _shape);
446
+ return _shape;
447
+ },
448
+ get catchall() {
449
+ return b._zod.def.catchall;
450
+ },
451
+ checks: []
452
+ }));
453
+ }
454
+ function partial(Class, schema, mask) {
455
+ const checks = schema._zod.def.checks;
456
+ if (checks && checks.length > 0) throw new Error(".partial() cannot be used on object schemas containing refinements");
457
+ return clone(schema, mergeDefs(schema._zod.def, {
458
+ get shape() {
459
+ const oldShape = schema._zod.def.shape;
460
+ const shape = {
461
+ ...oldShape
462
+ };
463
+ if (mask) for (const key in mask) {
464
+ if (!(key in oldShape)) throw new Error(`Unrecognized key: "${key}"`);
465
+ if (!mask[key]) continue;
466
+ shape[key] = Class ? new Class({
467
+ type: "optional",
468
+ innerType: oldShape[key]
469
+ }) : oldShape[key];
470
+ } else for (const key in oldShape) shape[key] = Class ? new Class({
471
+ type: "optional",
472
+ innerType: oldShape[key]
473
+ }) : oldShape[key];
474
+ assignProp(this, "shape", shape);
475
+ return shape;
476
+ },
477
+ checks: []
478
+ }));
479
+ }
480
+ function required(Class, schema, mask) {
481
+ return clone(schema, mergeDefs(schema._zod.def, {
482
+ get shape() {
483
+ const oldShape = schema._zod.def.shape;
484
+ const shape = {
485
+ ...oldShape
486
+ };
487
+ if (mask) for (const key in mask) {
488
+ if (!(key in shape)) throw new Error(`Unrecognized key: "${key}"`);
489
+ if (!mask[key]) continue;
490
+ shape[key] = new Class({
491
+ type: "nonoptional",
492
+ innerType: oldShape[key]
493
+ });
494
+ } else for (const key in oldShape) shape[key] = new Class({
495
+ type: "nonoptional",
496
+ innerType: oldShape[key]
497
+ });
498
+ assignProp(this, "shape", shape);
499
+ return shape;
500
+ }
501
+ }));
502
+ }
503
+ function aborted(x, startIndex = 0) {
504
+ if (x.aborted === true) return true;
505
+ for (let i = startIndex; i < x.issues.length; i++) if (x.issues[i]?.continue !== true) return true;
506
+ return false;
507
+ }
508
+ function prefixIssues(path, issues) {
509
+ return issues.map(iss => {
510
+ var _a;
511
+ (_a = iss).path ?? (_a.path = []);
512
+ iss.path.unshift(path);
513
+ return iss;
514
+ });
515
+ }
516
+ function unwrapMessage(message) {
517
+ return typeof message === "string" ? message : message?.message;
518
+ }
519
+ function finalizeIssue(iss, ctx, config) {
520
+ const full = {
521
+ ...iss,
522
+ path: iss.path ?? []
523
+ };
524
+ if (!iss.message) full.message = unwrapMessage(iss.inst?._zod.def?.error?.(iss)) ?? unwrapMessage(ctx?.error?.(iss)) ?? unwrapMessage(config.customError?.(iss)) ?? unwrapMessage(config.localeError?.(iss)) ?? "Invalid input";
525
+ delete full.inst;
526
+ delete full.continue;
527
+ if (!ctx?.reportInput) delete full.input;
528
+ return full;
529
+ }
530
+ function getLengthableOrigin(input) {
531
+ if (Array.isArray(input)) return "array";
532
+ if (typeof input === "string") return "string";
533
+ return "unknown";
534
+ }
535
+ function issue(...args) {
536
+ const [iss, input, inst] = args;
537
+ if (typeof iss === "string") return {
538
+ message: iss,
539
+ code: "custom",
540
+ input,
541
+ inst
542
+ };
543
+ return {
544
+ ...iss
545
+ };
546
+ }
547
+
548
+ //#endregion
549
+ //#region ../../node_modules/.bun/zod@4.3.6/node_modules/zod/v4/core/errors.js
550
+
551
+ function flattenError(error, mapper = issue => issue.message) {
552
+ const fieldErrors = {};
553
+ const formErrors = [];
554
+ for (const sub of error.issues) if (sub.path.length > 0) {
555
+ fieldErrors[sub.path[0]] = fieldErrors[sub.path[0]] || [];
556
+ fieldErrors[sub.path[0]].push(mapper(sub));
557
+ } else formErrors.push(mapper(sub));
558
+ return {
559
+ formErrors,
560
+ fieldErrors
561
+ };
562
+ }
563
+ function formatError(error, mapper = issue => issue.message) {
564
+ const fieldErrors = {
565
+ _errors: []
566
+ };
567
+ const processError = error => {
568
+ for (const issue of error.issues) if (issue.code === "invalid_union" && issue.errors.length) issue.errors.map(issues => processError({
569
+ issues
570
+ }));else if (issue.code === "invalid_key") processError({
571
+ issues: issue.issues
572
+ });else if (issue.code === "invalid_element") processError({
573
+ issues: issue.issues
574
+ });else if (issue.path.length === 0) fieldErrors._errors.push(mapper(issue));else {
575
+ let curr = fieldErrors;
576
+ let i = 0;
577
+ while (i < issue.path.length) {
578
+ const el = issue.path[i];
579
+ if (!(i === issue.path.length - 1)) curr[el] = curr[el] || {
580
+ _errors: []
581
+ };else {
582
+ curr[el] = curr[el] || {
583
+ _errors: []
584
+ };
585
+ curr[el]._errors.push(mapper(issue));
586
+ }
587
+ curr = curr[el];
588
+ i++;
589
+ }
590
+ }
591
+ };
592
+ processError(error);
593
+ return fieldErrors;
594
+ }
595
+
596
+ //#endregion
597
+ //#region ../../node_modules/.bun/zod@4.3.6/node_modules/zod/v4/core/parse.js
598
+
599
+ function emoji() {
600
+ return new RegExp(_emoji$1, "u");
601
+ }
602
+ function timeSource(args) {
603
+ const hhmm = `(?:[01]\\d|2[0-3]):[0-5]\\d`;
604
+ 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+)?)?`;
605
+ }
606
+ function time$1(args) {
607
+ return new RegExp(`^${timeSource(args)}$`);
608
+ }
609
+ function datetime$1(args) {
610
+ const time = timeSource({
611
+ precision: args.precision
612
+ });
613
+ const opts = ["Z"];
614
+ if (args.local) opts.push("");
615
+ if (args.offset) opts.push(`([+-](?:[01]\\d|2[0-3]):[0-5]\\d)`);
616
+ const timeRegex = `${time}(?:${opts.join("|")})`;
617
+ return new RegExp(`^${dateSource}T(?:${timeRegex})$`);
618
+ }
619
+ function isValidBase64(data) {
620
+ if (data === "") return true;
621
+ if (data.length % 4 !== 0) return false;
622
+ try {
623
+ atob(data);
624
+ return true;
625
+ } catch {
626
+ return false;
627
+ }
628
+ }
629
+ function isValidBase64URL(data) {
630
+ if (!base64url.test(data)) return false;
631
+ const base64 = data.replace(/[-_]/g, c => c === "-" ? "+" : "/");
632
+ return isValidBase64(base64.padEnd(Math.ceil(base64.length / 4) * 4, "="));
633
+ }
634
+ function isValidJWT(token, algorithm = null) {
635
+ try {
636
+ const tokensParts = token.split(".");
637
+ if (tokensParts.length !== 3) return false;
638
+ const [header] = tokensParts;
639
+ if (!header) return false;
640
+ const parsedHeader = JSON.parse(atob(header));
641
+ if ("typ" in parsedHeader && parsedHeader?.typ !== "JWT") return false;
642
+ if (!parsedHeader.alg) return false;
643
+ if (algorithm && (!("alg" in parsedHeader) || parsedHeader.alg !== algorithm)) return false;
644
+ return true;
645
+ } catch {
646
+ return false;
647
+ }
648
+ }
649
+ function handleArrayResult(result, final, index) {
650
+ if (result.issues.length) final.issues.push(...prefixIssues(index, result.issues));
651
+ final.value[index] = result.value;
652
+ }
653
+ function handlePropertyResult(result, final, key, input, isOptionalOut) {
654
+ if (result.issues.length) {
655
+ if (isOptionalOut && !(key in input)) return;
656
+ final.issues.push(...prefixIssues(key, result.issues));
657
+ }
658
+ if (result.value === void 0) {
659
+ if (key in input) final.value[key] = void 0;
660
+ } else final.value[key] = result.value;
661
+ }
662
+ function normalizeDef(def) {
663
+ const keys = Object.keys(def.shape);
664
+ 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`);
665
+ const okeys = optionalKeys(def.shape);
666
+ return {
667
+ ...def,
668
+ keys,
669
+ keySet: new Set(keys),
670
+ numKeys: keys.length,
671
+ optionalKeys: new Set(okeys)
672
+ };
673
+ }
674
+ function handleCatchall(proms, input, payload, ctx, def, inst) {
675
+ const unrecognized = [];
676
+ const keySet = def.keySet;
677
+ const _catchall = def.catchall._zod;
678
+ const t = _catchall.def.type;
679
+ const isOptionalOut = _catchall.optout === "optional";
680
+ for (const key in input) {
681
+ if (keySet.has(key)) continue;
682
+ if (t === "never") {
683
+ unrecognized.push(key);
684
+ continue;
685
+ }
686
+ const r = _catchall.run({
687
+ value: input[key],
688
+ issues: []
689
+ }, ctx);
690
+ if (r instanceof Promise) proms.push(r.then(r => handlePropertyResult(r, payload, key, input, isOptionalOut)));else handlePropertyResult(r, payload, key, input, isOptionalOut);
691
+ }
692
+ if (unrecognized.length) payload.issues.push({
693
+ code: "unrecognized_keys",
694
+ keys: unrecognized,
695
+ input,
696
+ inst
697
+ });
698
+ if (!proms.length) return payload;
699
+ return Promise.all(proms).then(() => {
700
+ return payload;
701
+ });
702
+ }
703
+ function handleUnionResults(results, final, inst, ctx) {
704
+ for (const result of results) if (result.issues.length === 0) {
705
+ final.value = result.value;
706
+ return final;
707
+ }
708
+ const nonaborted = results.filter(r => !aborted(r));
709
+ if (nonaborted.length === 1) {
710
+ final.value = nonaborted[0].value;
711
+ return nonaborted[0];
712
+ }
713
+ final.issues.push({
714
+ code: "invalid_union",
715
+ input: final.value,
716
+ inst,
717
+ errors: results.map(result => result.issues.map(iss => finalizeIssue(iss, ctx, config())))
718
+ });
719
+ return final;
720
+ }
721
+ function mergeValues(a, b) {
722
+ if (a === b) return {
723
+ valid: true,
724
+ data: a
725
+ };
726
+ if (a instanceof Date && b instanceof Date && +a === +b) return {
727
+ valid: true,
728
+ data: a
729
+ };
730
+ if (isPlainObject$1(a) && isPlainObject$1(b)) {
731
+ const bKeys = Object.keys(b);
732
+ const sharedKeys = Object.keys(a).filter(key => bKeys.indexOf(key) !== -1);
733
+ const newObj = {
734
+ ...a,
735
+ ...b
736
+ };
737
+ for (const key of sharedKeys) {
738
+ const sharedValue = mergeValues(a[key], b[key]);
739
+ if (!sharedValue.valid) return {
740
+ valid: false,
741
+ mergeErrorPath: [key, ...sharedValue.mergeErrorPath]
742
+ };
743
+ newObj[key] = sharedValue.data;
744
+ }
745
+ return {
746
+ valid: true,
747
+ data: newObj
748
+ };
749
+ }
750
+ if (Array.isArray(a) && Array.isArray(b)) {
751
+ if (a.length !== b.length) return {
752
+ valid: false,
753
+ mergeErrorPath: []
754
+ };
755
+ const newArray = [];
756
+ for (let index = 0; index < a.length; index++) {
757
+ const itemA = a[index];
758
+ const itemB = b[index];
759
+ const sharedValue = mergeValues(itemA, itemB);
760
+ if (!sharedValue.valid) return {
761
+ valid: false,
762
+ mergeErrorPath: [index, ...sharedValue.mergeErrorPath]
763
+ };
764
+ newArray.push(sharedValue.data);
765
+ }
766
+ return {
767
+ valid: true,
768
+ data: newArray
769
+ };
770
+ }
771
+ return {
772
+ valid: false,
773
+ mergeErrorPath: []
774
+ };
775
+ }
776
+ function handleIntersectionResults(result, left, right) {
777
+ const unrecKeys = /* @__PURE__ */new Map();
778
+ let unrecIssue;
779
+ for (const iss of left.issues) if (iss.code === "unrecognized_keys") {
780
+ unrecIssue ?? (unrecIssue = iss);
781
+ for (const k of iss.keys) {
782
+ if (!unrecKeys.has(k)) unrecKeys.set(k, {});
783
+ unrecKeys.get(k).l = true;
784
+ }
785
+ } else result.issues.push(iss);
786
+ for (const iss of right.issues) if (iss.code === "unrecognized_keys") for (const k of iss.keys) {
787
+ if (!unrecKeys.has(k)) unrecKeys.set(k, {});
788
+ unrecKeys.get(k).r = true;
789
+ } else result.issues.push(iss);
790
+ const bothKeys = [...unrecKeys].filter(([, f]) => f.l && f.r).map(([k]) => k);
791
+ if (bothKeys.length && unrecIssue) result.issues.push({
792
+ ...unrecIssue,
793
+ keys: bothKeys
794
+ });
795
+ if (aborted(result)) return result;
796
+ const merged = mergeValues(left.value, right.value);
797
+ if (!merged.valid) throw new Error(`Unmergable intersection. Error path: ${JSON.stringify(merged.mergeErrorPath)}`);
798
+ result.value = merged.data;
799
+ return result;
800
+ }
801
+ function handleOptionalResult(result, input) {
802
+ if (result.issues.length && input === void 0) return {
803
+ issues: [],
804
+ value: void 0
805
+ };
806
+ return result;
807
+ }
808
+ function handleDefaultResult(payload, def) {
809
+ if (payload.value === void 0) payload.value = def.defaultValue;
810
+ return payload;
811
+ }
812
+ function handleNonOptionalResult(payload, inst) {
813
+ if (!payload.issues.length && payload.value === void 0) payload.issues.push({
814
+ code: "invalid_type",
815
+ expected: "nonoptional",
816
+ input: payload.value,
817
+ inst
818
+ });
819
+ return payload;
820
+ }
821
+ function handlePipeResult(left, next, ctx) {
822
+ if (left.issues.length) {
823
+ left.aborted = true;
824
+ return left;
825
+ }
826
+ return next._zod.run({
827
+ value: left.value,
828
+ issues: left.issues
829
+ }, ctx);
830
+ }
831
+ function handleReadonlyResult(payload) {
832
+ payload.value = Object.freeze(payload.value);
833
+ return payload;
834
+ }
835
+ function handleRefineResult(result, payload, input, inst) {
836
+ if (!result) {
837
+ const _iss = {
838
+ code: "custom",
839
+ input,
840
+ inst,
841
+ path: [...(inst._zod.def.path ?? [])],
842
+ continue: !inst._zod.def.abort
843
+ };
844
+ if (inst._zod.def.params) _iss.params = inst._zod.def.params;
845
+ payload.issues.push(issue(_iss));
846
+ }
847
+ }
848
+
849
+ //#endregion
850
+ //#region ../../node_modules/.bun/zod@4.3.6/node_modules/zod/v4/core/registries.js
851
+
852
+ function registry() {
853
+ return new $ZodRegistry();
854
+ }
855
+ //#endregion
856
+ //#region ../../node_modules/.bun/zod@4.3.6/node_modules/zod/v4/core/api.js
857
+ /* @__NO_SIDE_EFFECTS__ */
858
+ function _string(Class, params) {
859
+ return new Class({
860
+ type: "string",
861
+ ...normalizeParams(params)
862
+ });
863
+ }
864
+ /* @__NO_SIDE_EFFECTS__ */
865
+ function _email(Class, params) {
866
+ return new Class({
867
+ type: "string",
868
+ format: "email",
869
+ check: "string_format",
870
+ abort: false,
871
+ ...normalizeParams(params)
872
+ });
873
+ }
874
+ /* @__NO_SIDE_EFFECTS__ */
875
+ function _guid(Class, params) {
876
+ return new Class({
877
+ type: "string",
878
+ format: "guid",
879
+ check: "string_format",
880
+ abort: false,
881
+ ...normalizeParams(params)
882
+ });
883
+ }
884
+ /* @__NO_SIDE_EFFECTS__ */
885
+ function _uuid(Class, params) {
886
+ return new Class({
887
+ type: "string",
888
+ format: "uuid",
889
+ check: "string_format",
890
+ abort: false,
891
+ ...normalizeParams(params)
892
+ });
893
+ }
894
+ /* @__NO_SIDE_EFFECTS__ */
895
+ function _uuidv4(Class, params) {
896
+ return new Class({
897
+ type: "string",
898
+ format: "uuid",
899
+ check: "string_format",
900
+ abort: false,
901
+ version: "v4",
902
+ ...normalizeParams(params)
903
+ });
904
+ }
905
+ /* @__NO_SIDE_EFFECTS__ */
906
+ function _uuidv6(Class, params) {
907
+ return new Class({
908
+ type: "string",
909
+ format: "uuid",
910
+ check: "string_format",
911
+ abort: false,
912
+ version: "v6",
913
+ ...normalizeParams(params)
914
+ });
915
+ }
916
+ /* @__NO_SIDE_EFFECTS__ */
917
+ function _uuidv7(Class, params) {
918
+ return new Class({
919
+ type: "string",
920
+ format: "uuid",
921
+ check: "string_format",
922
+ abort: false,
923
+ version: "v7",
924
+ ...normalizeParams(params)
925
+ });
926
+ }
927
+ /* @__NO_SIDE_EFFECTS__ */
928
+ function _url(Class, params) {
929
+ return new Class({
930
+ type: "string",
931
+ format: "url",
932
+ check: "string_format",
933
+ abort: false,
934
+ ...normalizeParams(params)
935
+ });
936
+ }
937
+ /* @__NO_SIDE_EFFECTS__ */
938
+ function _emoji(Class, params) {
939
+ return new Class({
940
+ type: "string",
941
+ format: "emoji",
942
+ check: "string_format",
943
+ abort: false,
944
+ ...normalizeParams(params)
945
+ });
946
+ }
947
+ /* @__NO_SIDE_EFFECTS__ */
948
+ function _nanoid(Class, params) {
949
+ return new Class({
950
+ type: "string",
951
+ format: "nanoid",
952
+ check: "string_format",
953
+ abort: false,
954
+ ...normalizeParams(params)
955
+ });
956
+ }
957
+ /* @__NO_SIDE_EFFECTS__ */
958
+ function _cuid(Class, params) {
959
+ return new Class({
960
+ type: "string",
961
+ format: "cuid",
962
+ check: "string_format",
963
+ abort: false,
964
+ ...normalizeParams(params)
965
+ });
966
+ }
967
+ /* @__NO_SIDE_EFFECTS__ */
968
+ function _cuid2(Class, params) {
969
+ return new Class({
970
+ type: "string",
971
+ format: "cuid2",
972
+ check: "string_format",
973
+ abort: false,
974
+ ...normalizeParams(params)
975
+ });
976
+ }
977
+ /* @__NO_SIDE_EFFECTS__ */
978
+ function _ulid(Class, params) {
979
+ return new Class({
980
+ type: "string",
981
+ format: "ulid",
982
+ check: "string_format",
983
+ abort: false,
984
+ ...normalizeParams(params)
985
+ });
986
+ }
987
+ /* @__NO_SIDE_EFFECTS__ */
988
+ function _xid(Class, params) {
989
+ return new Class({
990
+ type: "string",
991
+ format: "xid",
992
+ check: "string_format",
993
+ abort: false,
994
+ ...normalizeParams(params)
995
+ });
996
+ }
997
+ /* @__NO_SIDE_EFFECTS__ */
998
+ function _ksuid(Class, params) {
999
+ return new Class({
1000
+ type: "string",
1001
+ format: "ksuid",
1002
+ check: "string_format",
1003
+ abort: false,
1004
+ ...normalizeParams(params)
1005
+ });
1006
+ }
1007
+ /* @__NO_SIDE_EFFECTS__ */
1008
+ function _ipv4(Class, params) {
1009
+ return new Class({
1010
+ type: "string",
1011
+ format: "ipv4",
1012
+ check: "string_format",
1013
+ abort: false,
1014
+ ...normalizeParams(params)
1015
+ });
1016
+ }
1017
+ /* @__NO_SIDE_EFFECTS__ */
1018
+ function _ipv6(Class, params) {
1019
+ return new Class({
1020
+ type: "string",
1021
+ format: "ipv6",
1022
+ check: "string_format",
1023
+ abort: false,
1024
+ ...normalizeParams(params)
1025
+ });
1026
+ }
1027
+ /* @__NO_SIDE_EFFECTS__ */
1028
+ function _cidrv4(Class, params) {
1029
+ return new Class({
1030
+ type: "string",
1031
+ format: "cidrv4",
1032
+ check: "string_format",
1033
+ abort: false,
1034
+ ...normalizeParams(params)
1035
+ });
1036
+ }
1037
+ /* @__NO_SIDE_EFFECTS__ */
1038
+ function _cidrv6(Class, params) {
1039
+ return new Class({
1040
+ type: "string",
1041
+ format: "cidrv6",
1042
+ check: "string_format",
1043
+ abort: false,
1044
+ ...normalizeParams(params)
1045
+ });
1046
+ }
1047
+ /* @__NO_SIDE_EFFECTS__ */
1048
+ function _base64(Class, params) {
1049
+ return new Class({
1050
+ type: "string",
1051
+ format: "base64",
1052
+ check: "string_format",
1053
+ abort: false,
1054
+ ...normalizeParams(params)
1055
+ });
1056
+ }
1057
+ /* @__NO_SIDE_EFFECTS__ */
1058
+ function _base64url(Class, params) {
1059
+ return new Class({
1060
+ type: "string",
1061
+ format: "base64url",
1062
+ check: "string_format",
1063
+ abort: false,
1064
+ ...normalizeParams(params)
1065
+ });
1066
+ }
1067
+ /* @__NO_SIDE_EFFECTS__ */
1068
+ function _e164(Class, params) {
1069
+ return new Class({
1070
+ type: "string",
1071
+ format: "e164",
1072
+ check: "string_format",
1073
+ abort: false,
1074
+ ...normalizeParams(params)
1075
+ });
1076
+ }
1077
+ /* @__NO_SIDE_EFFECTS__ */
1078
+ function _jwt(Class, params) {
1079
+ return new Class({
1080
+ type: "string",
1081
+ format: "jwt",
1082
+ check: "string_format",
1083
+ abort: false,
1084
+ ...normalizeParams(params)
1085
+ });
1086
+ }
1087
+ /* @__NO_SIDE_EFFECTS__ */
1088
+ function _isoDateTime(Class, params) {
1089
+ return new Class({
1090
+ type: "string",
1091
+ format: "datetime",
1092
+ check: "string_format",
1093
+ offset: false,
1094
+ local: false,
1095
+ precision: null,
1096
+ ...normalizeParams(params)
1097
+ });
1098
+ }
1099
+ /* @__NO_SIDE_EFFECTS__ */
1100
+ function _isoDate(Class, params) {
1101
+ return new Class({
1102
+ type: "string",
1103
+ format: "date",
1104
+ check: "string_format",
1105
+ ...normalizeParams(params)
1106
+ });
1107
+ }
1108
+ /* @__NO_SIDE_EFFECTS__ */
1109
+ function _isoTime(Class, params) {
1110
+ return new Class({
1111
+ type: "string",
1112
+ format: "time",
1113
+ check: "string_format",
1114
+ precision: null,
1115
+ ...normalizeParams(params)
1116
+ });
1117
+ }
1118
+ /* @__NO_SIDE_EFFECTS__ */
1119
+ function _isoDuration(Class, params) {
1120
+ return new Class({
1121
+ type: "string",
1122
+ format: "duration",
1123
+ check: "string_format",
1124
+ ...normalizeParams(params)
1125
+ });
1126
+ }
1127
+ /* @__NO_SIDE_EFFECTS__ */
1128
+ function _number(Class, params) {
1129
+ return new Class({
1130
+ type: "number",
1131
+ checks: [],
1132
+ ...normalizeParams(params)
1133
+ });
1134
+ }
1135
+ /* @__NO_SIDE_EFFECTS__ */
1136
+ function _int(Class, params) {
1137
+ return new Class({
1138
+ type: "number",
1139
+ check: "number_format",
1140
+ abort: false,
1141
+ format: "safeint",
1142
+ ...normalizeParams(params)
1143
+ });
1144
+ }
1145
+ /* @__NO_SIDE_EFFECTS__ */
1146
+ function _boolean(Class, params) {
1147
+ return new Class({
1148
+ type: "boolean",
1149
+ ...normalizeParams(params)
1150
+ });
1151
+ }
1152
+ /* @__NO_SIDE_EFFECTS__ */
1153
+ function _null$1(Class, params) {
1154
+ return new Class({
1155
+ type: "null",
1156
+ ...normalizeParams(params)
1157
+ });
1158
+ }
1159
+ /* @__NO_SIDE_EFFECTS__ */
1160
+ function _unknown(Class) {
1161
+ return new Class({
1162
+ type: "unknown"
1163
+ });
1164
+ }
1165
+ /* @__NO_SIDE_EFFECTS__ */
1166
+ function _never(Class, params) {
1167
+ return new Class({
1168
+ type: "never",
1169
+ ...normalizeParams(params)
1170
+ });
1171
+ }
1172
+ /* @__NO_SIDE_EFFECTS__ */
1173
+ function _lt(value, params) {
1174
+ return new $ZodCheckLessThan({
1175
+ check: "less_than",
1176
+ ...normalizeParams(params),
1177
+ value,
1178
+ inclusive: false
1179
+ });
1180
+ }
1181
+ /* @__NO_SIDE_EFFECTS__ */
1182
+ function _lte(value, params) {
1183
+ return new $ZodCheckLessThan({
1184
+ check: "less_than",
1185
+ ...normalizeParams(params),
1186
+ value,
1187
+ inclusive: true
1188
+ });
1189
+ }
1190
+ /* @__NO_SIDE_EFFECTS__ */
1191
+ function _gt(value, params) {
1192
+ return new $ZodCheckGreaterThan({
1193
+ check: "greater_than",
1194
+ ...normalizeParams(params),
1195
+ value,
1196
+ inclusive: false
1197
+ });
1198
+ }
1199
+ /* @__NO_SIDE_EFFECTS__ */
1200
+ function _gte(value, params) {
1201
+ return new $ZodCheckGreaterThan({
1202
+ check: "greater_than",
1203
+ ...normalizeParams(params),
1204
+ value,
1205
+ inclusive: true
1206
+ });
1207
+ }
1208
+ /* @__NO_SIDE_EFFECTS__ */
1209
+ function _multipleOf(value, params) {
1210
+ return new $ZodCheckMultipleOf({
1211
+ check: "multiple_of",
1212
+ ...normalizeParams(params),
1213
+ value
1214
+ });
1215
+ }
1216
+ /* @__NO_SIDE_EFFECTS__ */
1217
+ function _maxLength(maximum, params) {
1218
+ return new $ZodCheckMaxLength({
1219
+ check: "max_length",
1220
+ ...normalizeParams(params),
1221
+ maximum
1222
+ });
1223
+ }
1224
+ /* @__NO_SIDE_EFFECTS__ */
1225
+ function _minLength(minimum, params) {
1226
+ return new $ZodCheckMinLength({
1227
+ check: "min_length",
1228
+ ...normalizeParams(params),
1229
+ minimum
1230
+ });
1231
+ }
1232
+ /* @__NO_SIDE_EFFECTS__ */
1233
+ function _length(length, params) {
1234
+ return new $ZodCheckLengthEquals({
1235
+ check: "length_equals",
1236
+ ...normalizeParams(params),
1237
+ length
1238
+ });
1239
+ }
1240
+ /* @__NO_SIDE_EFFECTS__ */
1241
+ function _regex(pattern, params) {
1242
+ return new $ZodCheckRegex({
1243
+ check: "string_format",
1244
+ format: "regex",
1245
+ ...normalizeParams(params),
1246
+ pattern
1247
+ });
1248
+ }
1249
+ /* @__NO_SIDE_EFFECTS__ */
1250
+ function _lowercase(params) {
1251
+ return new $ZodCheckLowerCase({
1252
+ check: "string_format",
1253
+ format: "lowercase",
1254
+ ...normalizeParams(params)
1255
+ });
1256
+ }
1257
+ /* @__NO_SIDE_EFFECTS__ */
1258
+ function _uppercase(params) {
1259
+ return new $ZodCheckUpperCase({
1260
+ check: "string_format",
1261
+ format: "uppercase",
1262
+ ...normalizeParams(params)
1263
+ });
1264
+ }
1265
+ /* @__NO_SIDE_EFFECTS__ */
1266
+ function _includes(includes, params) {
1267
+ return new $ZodCheckIncludes({
1268
+ check: "string_format",
1269
+ format: "includes",
1270
+ ...normalizeParams(params),
1271
+ includes
1272
+ });
1273
+ }
1274
+ /* @__NO_SIDE_EFFECTS__ */
1275
+ function _startsWith(prefix, params) {
1276
+ return new $ZodCheckStartsWith({
1277
+ check: "string_format",
1278
+ format: "starts_with",
1279
+ ...normalizeParams(params),
1280
+ prefix
1281
+ });
1282
+ }
1283
+ /* @__NO_SIDE_EFFECTS__ */
1284
+ function _endsWith(suffix, params) {
1285
+ return new $ZodCheckEndsWith({
1286
+ check: "string_format",
1287
+ format: "ends_with",
1288
+ ...normalizeParams(params),
1289
+ suffix
1290
+ });
1291
+ }
1292
+ /* @__NO_SIDE_EFFECTS__ */
1293
+ function _overwrite(tx) {
1294
+ return new $ZodCheckOverwrite({
1295
+ check: "overwrite",
1296
+ tx
1297
+ });
1298
+ }
1299
+ /* @__NO_SIDE_EFFECTS__ */
1300
+ function _normalize(form) {
1301
+ return /* @__PURE__ */_overwrite(input => input.normalize(form));
1302
+ }
1303
+ /* @__NO_SIDE_EFFECTS__ */
1304
+ function _trim() {
1305
+ return /* @__PURE__ */_overwrite(input => input.trim());
1306
+ }
1307
+ /* @__NO_SIDE_EFFECTS__ */
1308
+ function _toLowerCase() {
1309
+ return /* @__PURE__ */_overwrite(input => input.toLowerCase());
1310
+ }
1311
+ /* @__NO_SIDE_EFFECTS__ */
1312
+ function _toUpperCase() {
1313
+ return /* @__PURE__ */_overwrite(input => input.toUpperCase());
1314
+ }
1315
+ /* @__NO_SIDE_EFFECTS__ */
1316
+ function _slugify() {
1317
+ return /* @__PURE__ */_overwrite(input => slugify(input));
1318
+ }
1319
+ /* @__NO_SIDE_EFFECTS__ */
1320
+ function _array(Class, element, params) {
1321
+ return new Class({
1322
+ type: "array",
1323
+ element,
1324
+ ...normalizeParams(params)
1325
+ });
1326
+ }
1327
+ /* @__NO_SIDE_EFFECTS__ */
1328
+ function _custom(Class, fn, _params) {
1329
+ const norm = normalizeParams(_params);
1330
+ norm.abort ?? (norm.abort = true);
1331
+ return new Class({
1332
+ type: "custom",
1333
+ check: "custom",
1334
+ fn,
1335
+ ...norm
1336
+ });
1337
+ }
1338
+ /* @__NO_SIDE_EFFECTS__ */
1339
+ function _refine(Class, fn, _params) {
1340
+ return new Class({
1341
+ type: "custom",
1342
+ check: "custom",
1343
+ fn,
1344
+ ...normalizeParams(_params)
1345
+ });
1346
+ }
1347
+ /* @__NO_SIDE_EFFECTS__ */
1348
+ function _superRefine(fn) {
1349
+ const ch = /* @__PURE__ */_check(payload => {
1350
+ payload.addIssue = issue$2 => {
1351
+ if (typeof issue$2 === "string") payload.issues.push(issue(issue$2, payload.value, ch._zod.def));else {
1352
+ const _issue = issue$2;
1353
+ if (_issue.fatal) _issue.continue = false;
1354
+ _issue.code ?? (_issue.code = "custom");
1355
+ _issue.input ?? (_issue.input = payload.value);
1356
+ _issue.inst ?? (_issue.inst = ch);
1357
+ _issue.continue ?? (_issue.continue = !ch._zod.def.abort);
1358
+ payload.issues.push(issue(_issue));
1359
+ }
1360
+ };
1361
+ return fn(payload.value, payload);
1362
+ });
1363
+ return ch;
1364
+ }
1365
+ /* @__NO_SIDE_EFFECTS__ */
1366
+ function _check(fn, params) {
1367
+ const ch = new $ZodCheck({
1368
+ check: "custom",
1369
+ ...normalizeParams(params)
1370
+ });
1371
+ ch._zod.check = fn;
1372
+ return ch;
1373
+ }
1374
+ /* @__NO_SIDE_EFFECTS__ */
1375
+ function describe$2(description) {
1376
+ const ch = new $ZodCheck({
1377
+ check: "describe"
1378
+ });
1379
+ ch._zod.onattach = [inst => {
1380
+ const existing = globalRegistry.get(inst) ?? {};
1381
+ globalRegistry.add(inst, {
1382
+ ...existing,
1383
+ description
1384
+ });
1385
+ }];
1386
+ ch._zod.check = () => {};
1387
+ return ch;
1388
+ }
1389
+ /* @__NO_SIDE_EFFECTS__ */
1390
+ function meta$2(metadata) {
1391
+ const ch = new $ZodCheck({
1392
+ check: "meta"
1393
+ });
1394
+ ch._zod.onattach = [inst => {
1395
+ const existing = globalRegistry.get(inst) ?? {};
1396
+ globalRegistry.add(inst, {
1397
+ ...existing,
1398
+ ...metadata
1399
+ });
1400
+ }];
1401
+ ch._zod.check = () => {};
1402
+ return ch;
1403
+ }
1404
+
1405
+ //#endregion
1406
+ //#region ../../node_modules/.bun/zod@4.3.6/node_modules/zod/v4/core/to-json-schema.js
1407
+ function initializeContext(params) {
1408
+ let target = params?.target ?? "draft-2020-12";
1409
+ if (target === "draft-4") target = "draft-04";
1410
+ if (target === "draft-7") target = "draft-07";
1411
+ return {
1412
+ processors: params.processors ?? {},
1413
+ metadataRegistry: params?.metadata ?? globalRegistry,
1414
+ target,
1415
+ unrepresentable: params?.unrepresentable ?? "throw",
1416
+ override: params?.override ?? (() => {}),
1417
+ io: params?.io ?? "output",
1418
+ counter: 0,
1419
+ seen: /* @__PURE__ */new Map(),
1420
+ cycles: params?.cycles ?? "ref",
1421
+ reused: params?.reused ?? "inline",
1422
+ external: params?.external ?? void 0
1423
+ };
1424
+ }
1425
+ function process$2(schema, ctx, _params = {
1426
+ path: [],
1427
+ schemaPath: []
1428
+ }) {
1429
+ var _a;
1430
+ const def = schema._zod.def;
1431
+ const seen = ctx.seen.get(schema);
1432
+ if (seen) {
1433
+ seen.count++;
1434
+ if (_params.schemaPath.includes(schema)) seen.cycle = _params.path;
1435
+ return seen.schema;
1436
+ }
1437
+ const result = {
1438
+ schema: {},
1439
+ count: 1,
1440
+ cycle: void 0,
1441
+ path: _params.path
1442
+ };
1443
+ ctx.seen.set(schema, result);
1444
+ const overrideSchema = schema._zod.toJSONSchema?.();
1445
+ if (overrideSchema) result.schema = overrideSchema;else {
1446
+ const params = {
1447
+ ..._params,
1448
+ schemaPath: [..._params.schemaPath, schema],
1449
+ path: _params.path
1450
+ };
1451
+ if (schema._zod.processJSONSchema) schema._zod.processJSONSchema(ctx, result.schema, params);else {
1452
+ const _json = result.schema;
1453
+ const processor = ctx.processors[def.type];
1454
+ if (!processor) throw new Error(`[toJSONSchema]: Non-representable type encountered: ${def.type}`);
1455
+ processor(schema, ctx, _json, params);
1456
+ }
1457
+ const parent = schema._zod.parent;
1458
+ if (parent) {
1459
+ if (!result.ref) result.ref = parent;
1460
+ process$2(parent, ctx, params);
1461
+ ctx.seen.get(parent).isParent = true;
1462
+ }
1463
+ }
1464
+ const meta = ctx.metadataRegistry.get(schema);
1465
+ if (meta) Object.assign(result.schema, meta);
1466
+ if (ctx.io === "input" && isTransforming(schema)) {
1467
+ delete result.schema.examples;
1468
+ delete result.schema.default;
1469
+ }
1470
+ if (ctx.io === "input" && result.schema._prefault) (_a = result.schema).default ?? (_a.default = result.schema._prefault);
1471
+ delete result.schema._prefault;
1472
+ return ctx.seen.get(schema).schema;
1473
+ }
1474
+ function extractDefs(ctx, schema) {
1475
+ const root = ctx.seen.get(schema);
1476
+ if (!root) throw new Error("Unprocessed schema. This is a bug in Zod.");
1477
+ const idToSchema = /* @__PURE__ */new Map();
1478
+ for (const entry of ctx.seen.entries()) {
1479
+ const id = ctx.metadataRegistry.get(entry[0])?.id;
1480
+ if (id) {
1481
+ const existing = idToSchema.get(id);
1482
+ 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.`);
1483
+ idToSchema.set(id, entry[0]);
1484
+ }
1485
+ }
1486
+ const makeURI = entry => {
1487
+ const defsSegment = ctx.target === "draft-2020-12" ? "$defs" : "definitions";
1488
+ if (ctx.external) {
1489
+ const externalId = ctx.external.registry.get(entry[0])?.id;
1490
+ const uriGenerator = ctx.external.uri ?? (id => id);
1491
+ if (externalId) return {
1492
+ ref: uriGenerator(externalId)
1493
+ };
1494
+ const id = entry[1].defId ?? entry[1].schema.id ?? `schema${ctx.counter++}`;
1495
+ entry[1].defId = id;
1496
+ return {
1497
+ defId: id,
1498
+ ref: `${uriGenerator("__shared")}#/${defsSegment}/${id}`
1499
+ };
1500
+ }
1501
+ if (entry[1] === root) return {
1502
+ ref: "#"
1503
+ };
1504
+ const defUriPrefix = `#/${defsSegment}/`;
1505
+ const defId = entry[1].schema.id ?? `__schema${ctx.counter++}`;
1506
+ return {
1507
+ defId,
1508
+ ref: defUriPrefix + defId
1509
+ };
1510
+ };
1511
+ const extractToDef = entry => {
1512
+ if (entry[1].schema.$ref) return;
1513
+ const seen = entry[1];
1514
+ const {
1515
+ ref,
1516
+ defId
1517
+ } = makeURI(entry);
1518
+ seen.def = {
1519
+ ...seen.schema
1520
+ };
1521
+ if (defId) seen.defId = defId;
1522
+ const schema = seen.schema;
1523
+ for (const key in schema) delete schema[key];
1524
+ schema.$ref = ref;
1525
+ };
1526
+ if (ctx.cycles === "throw") for (const entry of ctx.seen.entries()) {
1527
+ const seen = entry[1];
1528
+ if (seen.cycle) throw new Error(`Cycle detected: #/${seen.cycle?.join("/")}/<root>
1529
+
1530
+ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.`);
1531
+ }
1532
+ for (const entry of ctx.seen.entries()) {
1533
+ const seen = entry[1];
1534
+ if (schema === entry[0]) {
1535
+ extractToDef(entry);
1536
+ continue;
1537
+ }
1538
+ if (ctx.external) {
1539
+ const ext = ctx.external.registry.get(entry[0])?.id;
1540
+ if (schema !== entry[0] && ext) {
1541
+ extractToDef(entry);
1542
+ continue;
1543
+ }
1544
+ }
1545
+ if (ctx.metadataRegistry.get(entry[0])?.id) {
1546
+ extractToDef(entry);
1547
+ continue;
1548
+ }
1549
+ if (seen.cycle) {
1550
+ extractToDef(entry);
1551
+ continue;
1552
+ }
1553
+ if (seen.count > 1) {
1554
+ if (ctx.reused === "ref") {
1555
+ extractToDef(entry);
1556
+ continue;
1557
+ }
1558
+ }
1559
+ }
1560
+ }
1561
+ function finalize(ctx, schema) {
1562
+ const root = ctx.seen.get(schema);
1563
+ if (!root) throw new Error("Unprocessed schema. This is a bug in Zod.");
1564
+ const flattenRef = zodSchema => {
1565
+ const seen = ctx.seen.get(zodSchema);
1566
+ if (seen.ref === null) return;
1567
+ const schema = seen.def ?? seen.schema;
1568
+ const _cached = {
1569
+ ...schema
1570
+ };
1571
+ const ref = seen.ref;
1572
+ seen.ref = null;
1573
+ if (ref) {
1574
+ flattenRef(ref);
1575
+ const refSeen = ctx.seen.get(ref);
1576
+ const refSchema = refSeen.schema;
1577
+ if (refSchema.$ref && (ctx.target === "draft-07" || ctx.target === "draft-04" || ctx.target === "openapi-3.0")) {
1578
+ schema.allOf = schema.allOf ?? [];
1579
+ schema.allOf.push(refSchema);
1580
+ } else Object.assign(schema, refSchema);
1581
+ Object.assign(schema, _cached);
1582
+ if (zodSchema._zod.parent === ref) for (const key in schema) {
1583
+ if (key === "$ref" || key === "allOf") continue;
1584
+ if (!(key in _cached)) delete schema[key];
1585
+ }
1586
+ if (refSchema.$ref && refSeen.def) for (const key in schema) {
1587
+ if (key === "$ref" || key === "allOf") continue;
1588
+ if (key in refSeen.def && JSON.stringify(schema[key]) === JSON.stringify(refSeen.def[key])) delete schema[key];
1589
+ }
1590
+ }
1591
+ const parent = zodSchema._zod.parent;
1592
+ if (parent && parent !== ref) {
1593
+ flattenRef(parent);
1594
+ const parentSeen = ctx.seen.get(parent);
1595
+ if (parentSeen?.schema.$ref) {
1596
+ schema.$ref = parentSeen.schema.$ref;
1597
+ if (parentSeen.def) for (const key in schema) {
1598
+ if (key === "$ref" || key === "allOf") continue;
1599
+ if (key in parentSeen.def && JSON.stringify(schema[key]) === JSON.stringify(parentSeen.def[key])) delete schema[key];
1600
+ }
1601
+ }
1602
+ }
1603
+ ctx.override({
1604
+ zodSchema,
1605
+ jsonSchema: schema,
1606
+ path: seen.path ?? []
1607
+ });
1608
+ };
1609
+ for (const entry of [...ctx.seen.entries()].reverse()) flattenRef(entry[0]);
1610
+ const result = {};
1611
+ if (ctx.target === "draft-2020-12") result.$schema = "https://json-schema.org/draft/2020-12/schema";else if (ctx.target === "draft-07") result.$schema = "http://json-schema.org/draft-07/schema#";else if (ctx.target === "draft-04") result.$schema = "http://json-schema.org/draft-04/schema#";else if (ctx.target === "openapi-3.0") {}
1612
+ if (ctx.external?.uri) {
1613
+ const id = ctx.external.registry.get(schema)?.id;
1614
+ if (!id) throw new Error("Schema is missing an `id` property");
1615
+ result.$id = ctx.external.uri(id);
1616
+ }
1617
+ Object.assign(result, root.def ?? root.schema);
1618
+ const defs = ctx.external?.defs ?? {};
1619
+ for (const entry of ctx.seen.entries()) {
1620
+ const seen = entry[1];
1621
+ if (seen.def && seen.defId) defs[seen.defId] = seen.def;
1622
+ }
1623
+ if (ctx.external) {} else if (Object.keys(defs).length > 0) if (ctx.target === "draft-2020-12") result.$defs = defs;else result.definitions = defs;
1624
+ try {
1625
+ const finalized = JSON.parse(JSON.stringify(result));
1626
+ Object.defineProperty(finalized, "~standard", {
1627
+ value: {
1628
+ ...schema["~standard"],
1629
+ jsonSchema: {
1630
+ input: createStandardJSONSchemaMethod(schema, "input", ctx.processors),
1631
+ output: createStandardJSONSchemaMethod(schema, "output", ctx.processors)
1632
+ }
1633
+ },
1634
+ enumerable: false,
1635
+ writable: false
1636
+ });
1637
+ return finalized;
1638
+ } catch (_err) {
1639
+ throw new Error("Error converting schema to JSON.");
1640
+ }
1641
+ }
1642
+ function isTransforming(_schema, _ctx) {
1643
+ const ctx = _ctx ?? {
1644
+ seen: /* @__PURE__ */new Set()
1645
+ };
1646
+ if (ctx.seen.has(_schema)) return false;
1647
+ ctx.seen.add(_schema);
1648
+ const def = _schema._zod.def;
1649
+ if (def.type === "transform") return true;
1650
+ if (def.type === "array") return isTransforming(def.element, ctx);
1651
+ if (def.type === "set") return isTransforming(def.valueType, ctx);
1652
+ if (def.type === "lazy") return isTransforming(def.getter(), ctx);
1653
+ if (def.type === "promise" || def.type === "optional" || def.type === "nonoptional" || def.type === "nullable" || def.type === "readonly" || def.type === "default" || def.type === "prefault") return isTransforming(def.innerType, ctx);
1654
+ if (def.type === "intersection") return isTransforming(def.left, ctx) || isTransforming(def.right, ctx);
1655
+ if (def.type === "record" || def.type === "map") return isTransforming(def.keyType, ctx) || isTransforming(def.valueType, ctx);
1656
+ if (def.type === "pipe") return isTransforming(def.in, ctx) || isTransforming(def.out, ctx);
1657
+ if (def.type === "object") {
1658
+ for (const key in def.shape) if (isTransforming(def.shape[key], ctx)) return true;
1659
+ return false;
1660
+ }
1661
+ if (def.type === "union") {
1662
+ for (const option of def.options) if (isTransforming(option, ctx)) return true;
1663
+ return false;
1664
+ }
1665
+ if (def.type === "tuple") {
1666
+ for (const item of def.items) if (isTransforming(item, ctx)) return true;
1667
+ if (def.rest && isTransforming(def.rest, ctx)) return true;
1668
+ return false;
1669
+ }
1670
+ return false;
1671
+ }
1672
+ /**
1673
+ * Creates a toJSONSchema method for a schema instance.
1674
+ * This encapsulates the logic of initializing context, processing, extracting defs, and finalizing.
1675
+ */
1676
+
1677
+ function toJSONSchema(input, params) {
1678
+ if ("_idmap" in input) {
1679
+ const registry = input;
1680
+ const ctx = initializeContext({
1681
+ ...params,
1682
+ processors: allProcessors
1683
+ });
1684
+ const defs = {};
1685
+ for (const entry of registry._idmap.entries()) {
1686
+ const [_, schema] = entry;
1687
+ process$2(schema, ctx);
1688
+ }
1689
+ const schemas = {};
1690
+ ctx.external = {
1691
+ registry,
1692
+ uri: params?.uri,
1693
+ defs
1694
+ };
1695
+ for (const entry of registry._idmap.entries()) {
1696
+ const [key, schema] = entry;
1697
+ extractDefs(ctx, schema);
1698
+ schemas[key] = finalize(ctx, schema);
1699
+ }
1700
+ if (Object.keys(defs).length > 0) schemas.__shared = {
1701
+ [ctx.target === "draft-2020-12" ? "$defs" : "definitions"]: defs
1702
+ };
1703
+ return {
1704
+ schemas
1705
+ };
1706
+ }
1707
+ const ctx = initializeContext({
1708
+ ...params,
1709
+ processors: allProcessors
1710
+ });
1711
+ process$2(input, ctx);
1712
+ extractDefs(ctx, input);
1713
+ return finalize(ctx, input);
1714
+ }
1715
+
1716
+ //#endregion
1717
+ //#region ../../node_modules/.bun/zod@4.3.6/node_modules/zod/v4/mini/schemas.js
1718
+
1719
+ /* @__NO_SIDE_EFFECTS__ */
1720
+ function object$1(shape, params) {
1721
+ return new ZodMiniObject({
1722
+ type: "object",
1723
+ shape: shape ?? {},
1724
+ ...normalizeParams(params)
1725
+ });
1726
+ }
1727
+ //#endregion
1728
+ //#region ../../node_modules/.bun/@modelcontextprotocol+sdk@1.27.1/node_modules/@modelcontextprotocol/sdk/dist/esm/server/zod-compat.js
1729
+ function isZ4Schema(s) {
1730
+ return !!s._zod;
1731
+ }
1732
+ function objectFromShape(shape) {
1733
+ const values = Object.values(shape);
1734
+ if (values.length === 0) return object$1({});
1735
+ const allV4 = values.every(isZ4Schema);
1736
+ const allV3 = values.every(s => !isZ4Schema(s));
1737
+ if (allV4) return object$1(shape);
1738
+ if (allV3) return objectType(shape);
1739
+ throw new Error("Mixed Zod versions detected in object shape.");
1740
+ }
1741
+ function safeParse$1(schema, data) {
1742
+ if (isZ4Schema(schema)) return safeParse$2(schema, data);
1743
+ return schema.safeParse(data);
1744
+ }
1745
+ async function safeParseAsync$1(schema, data) {
1746
+ if (isZ4Schema(schema)) return await safeParseAsync$2(schema, data);
1747
+ return await schema.safeParseAsync(data);
1748
+ }
1749
+ function getObjectShape(schema) {
1750
+ if (!schema) return void 0;
1751
+ let rawShape;
1752
+ if (isZ4Schema(schema)) rawShape = schema._zod?.def?.shape;else rawShape = schema.shape;
1753
+ if (!rawShape) return void 0;
1754
+ if (typeof rawShape === "function") try {
1755
+ return rawShape();
1756
+ } catch {
1757
+ return;
1758
+ }
1759
+ return rawShape;
1760
+ }
1761
+ /**
1762
+ * Normalizes a schema to an object schema. Handles both:
1763
+ * - Already-constructed object schemas (v3 or v4)
1764
+ * - Raw shapes that need to be wrapped into object schemas
1765
+ */
1766
+ function normalizeObjectSchema(schema) {
1767
+ if (!schema) return void 0;
1768
+ if (typeof schema === "object") {
1769
+ const asV3 = schema;
1770
+ const asV4 = schema;
1771
+ if (!asV3._def && !asV4._zod) {
1772
+ const values = Object.values(schema);
1773
+ if (values.length > 0 && values.every(v => typeof v === "object" && v !== null && (v._def !== void 0 || v._zod !== void 0 || typeof v.parse === "function"))) return objectFromShape(schema);
1774
+ }
1775
+ }
1776
+ if (isZ4Schema(schema)) {
1777
+ const def = schema._zod?.def;
1778
+ if (def && (def.type === "object" || def.shape !== void 0)) return schema;
1779
+ } else if (schema.shape !== void 0) return schema;
1780
+ }
1781
+ /**
1782
+ * Safely extracts an error message from a parse result error.
1783
+ * Zod errors can have different structures, so we handle various cases.
1784
+ */
1785
+ function getParseErrorMessage(error) {
1786
+ if (error && typeof error === "object") {
1787
+ if ("message" in error && typeof error.message === "string") return error.message;
1788
+ if ("issues" in error && Array.isArray(error.issues) && error.issues.length > 0) {
1789
+ const firstIssue = error.issues[0];
1790
+ if (firstIssue && typeof firstIssue === "object" && "message" in firstIssue) return String(firstIssue.message);
1791
+ }
1792
+ try {
1793
+ return JSON.stringify(error);
1794
+ } catch {
1795
+ return String(error);
1796
+ }
1797
+ }
1798
+ return String(error);
1799
+ }
1800
+ /**
1801
+ * Gets the description from a schema, if available.
1802
+ * Works with both Zod v3 and v4.
1803
+ *
1804
+ * Both versions expose a `.description` getter that returns the description
1805
+ * from their respective internal storage (v3: _def, v4: globalRegistry).
1806
+ */
1807
+ function getSchemaDescription(schema) {
1808
+ return schema.description;
1809
+ }
1810
+ /**
1811
+ * Checks if a schema is optional.
1812
+ * Works with both Zod v3 and v4.
1813
+ */
1814
+ function isSchemaOptional(schema) {
1815
+ if (isZ4Schema(schema)) return schema._zod?.def?.type === "optional";
1816
+ const v3Schema = schema;
1817
+ if (typeof schema.isOptional === "function") return schema.isOptional();
1818
+ return v3Schema._def?.typeName === "ZodOptional";
1819
+ }
1820
+ /**
1821
+ * Gets the literal value from a schema, if it's a literal schema.
1822
+ * Works with both Zod v3 and v4.
1823
+ * Returns undefined if the schema is not a literal or the value cannot be determined.
1824
+ */
1825
+ function getLiteralValue(schema) {
1826
+ if (isZ4Schema(schema)) {
1827
+ const def = schema._zod?.def;
1828
+ if (def) {
1829
+ if (def.value !== void 0) return def.value;
1830
+ if (Array.isArray(def.values) && def.values.length > 0) return def.values[0];
1831
+ }
1832
+ }
1833
+ const def = schema._def;
1834
+ if (def) {
1835
+ if (def.value !== void 0) return def.value;
1836
+ if (Array.isArray(def.values) && def.values.length > 0) return def.values[0];
1837
+ }
1838
+ const directValue = schema.value;
1839
+ if (directValue !== void 0) return directValue;
1840
+ }
1841
+
1842
+ //#endregion
1843
+ //#region ../../node_modules/.bun/zod@4.3.6/node_modules/zod/v4/classic/iso.js
1844
+
1845
+ function datetime(params) {
1846
+ return _isoDateTime(ZodISODateTime, params);
1847
+ }
1848
+ function date(params) {
1849
+ return _isoDate(ZodISODate, params);
1850
+ }
1851
+ function time(params) {
1852
+ return _isoTime(ZodISOTime, params);
1853
+ }
1854
+ function duration(params) {
1855
+ return _isoDuration(ZodISODuration, params);
1856
+ }
1857
+
1858
+ //#endregion
1859
+ //#region ../../node_modules/.bun/zod@4.3.6/node_modules/zod/v4/classic/errors.js
1860
+
1861
+ function string(params) {
1862
+ return _string(ZodString, params);
1863
+ }
1864
+ function number(params) {
1865
+ return _number(ZodNumber, params);
1866
+ }
1867
+ function int(params) {
1868
+ return _int(ZodNumberFormat, params);
1869
+ }
1870
+ function boolean(params) {
1871
+ return _boolean(ZodBoolean, params);
1872
+ }
1873
+ function _null(params) {
1874
+ return _null$1(ZodNull, params);
1875
+ }
1876
+ function unknown() {
1877
+ return _unknown(ZodUnknown);
1878
+ }
1879
+ function never(params) {
1880
+ return _never(ZodNever, params);
1881
+ }
1882
+ function array(element, params) {
1883
+ return _array(ZodArray, element, params);
1884
+ }
1885
+ function object(shape, params) {
1886
+ return new ZodObject({
1887
+ type: "object",
1888
+ shape: shape ?? {},
1889
+ ...normalizeParams(params)
1890
+ });
1891
+ }
1892
+ function looseObject(shape, params) {
1893
+ return new ZodObject({
1894
+ type: "object",
1895
+ shape,
1896
+ catchall: unknown(),
1897
+ ...normalizeParams(params)
1898
+ });
1899
+ }
1900
+ function union(options, params) {
1901
+ return new ZodUnion({
1902
+ type: "union",
1903
+ options,
1904
+ ...normalizeParams(params)
1905
+ });
1906
+ }
1907
+ function discriminatedUnion(discriminator, options, params) {
1908
+ return new ZodDiscriminatedUnion({
1909
+ type: "union",
1910
+ options,
1911
+ discriminator,
1912
+ ...normalizeParams(params)
1913
+ });
1914
+ }
1915
+ function intersection(left, right) {
1916
+ return new ZodIntersection({
1917
+ type: "intersection",
1918
+ left,
1919
+ right
1920
+ });
1921
+ }
1922
+ function record(keyType, valueType, params) {
1923
+ return new ZodRecord({
1924
+ type: "record",
1925
+ keyType,
1926
+ valueType,
1927
+ ...normalizeParams(params)
1928
+ });
1929
+ }
1930
+ function _enum(values, params) {
1931
+ return new ZodEnum({
1932
+ type: "enum",
1933
+ entries: Array.isArray(values) ? Object.fromEntries(values.map(v => [v, v])) : values,
1934
+ ...normalizeParams(params)
1935
+ });
1936
+ }
1937
+ function literal(value, params) {
1938
+ return new ZodLiteral({
1939
+ type: "literal",
1940
+ values: Array.isArray(value) ? value : [value],
1941
+ ...normalizeParams(params)
1942
+ });
1943
+ }
1944
+ function transform(fn) {
1945
+ return new ZodTransform({
1946
+ type: "transform",
1947
+ transform: fn
1948
+ });
1949
+ }
1950
+ function optional(innerType) {
1951
+ return new ZodOptional$1({
1952
+ type: "optional",
1953
+ innerType
1954
+ });
1955
+ }
1956
+ function exactOptional(innerType) {
1957
+ return new ZodExactOptional({
1958
+ type: "optional",
1959
+ innerType
1960
+ });
1961
+ }
1962
+ function nullable(innerType) {
1963
+ return new ZodNullable({
1964
+ type: "nullable",
1965
+ innerType
1966
+ });
1967
+ }
1968
+ function _default(innerType, defaultValue) {
1969
+ return new ZodDefault({
1970
+ type: "default",
1971
+ innerType,
1972
+ get defaultValue() {
1973
+ return typeof defaultValue === "function" ? defaultValue() : shallowClone(defaultValue);
1974
+ }
1975
+ });
1976
+ }
1977
+ function prefault(innerType, defaultValue) {
1978
+ return new ZodPrefault({
1979
+ type: "prefault",
1980
+ innerType,
1981
+ get defaultValue() {
1982
+ return typeof defaultValue === "function" ? defaultValue() : shallowClone(defaultValue);
1983
+ }
1984
+ });
1985
+ }
1986
+ function nonoptional(innerType, params) {
1987
+ return new ZodNonOptional({
1988
+ type: "nonoptional",
1989
+ innerType,
1990
+ ...normalizeParams(params)
1991
+ });
1992
+ }
1993
+ function _catch(innerType, catchValue) {
1994
+ return new ZodCatch({
1995
+ type: "catch",
1996
+ innerType,
1997
+ catchValue: typeof catchValue === "function" ? catchValue : () => catchValue
1998
+ });
1999
+ }
2000
+ function pipe(in_, out) {
2001
+ return new ZodPipe({
2002
+ type: "pipe",
2003
+ in: in_,
2004
+ out
2005
+ });
2006
+ }
2007
+ function readonly(innerType) {
2008
+ return new ZodReadonly({
2009
+ type: "readonly",
2010
+ innerType
2011
+ });
2012
+ }
2013
+ function custom(fn, _params) {
2014
+ return _custom(ZodCustom, fn ?? (() => true), _params);
2015
+ }
2016
+ function refine(fn, _params = {}) {
2017
+ return _refine(ZodCustom, fn, _params);
2018
+ }
2019
+ function superRefine(fn) {
2020
+ return _superRefine(fn);
2021
+ }
2022
+ function preprocess(fn, schema) {
2023
+ return pipe(transform(fn), schema);
2024
+ }
2025
+
2026
+ //#endregion
2027
+ //#region ../../node_modules/.bun/@modelcontextprotocol+sdk@1.27.1/node_modules/@modelcontextprotocol/sdk/dist/esm/types.js
2028
+
2029
+ function assertCompleteRequestPrompt(request) {
2030
+ if (request.params.ref.type !== "ref/prompt") throw new TypeError(`Expected CompleteRequestPrompt, but got ${request.params.ref.type}`);
2031
+ }
2032
+ function assertCompleteRequestResourceTemplate(request) {
2033
+ if (request.params.ref.type !== "ref/resource") throw new TypeError(`Expected CompleteRequestResourceTemplate, but got ${request.params.ref.type}`);
2034
+ }
2035
+ /**
2036
+ * The server's response to a completion/complete request
2037
+ */
2038
+
2039
+ //#endregion
2040
+ //#region ../../node_modules/.bun/@modelcontextprotocol+sdk@1.27.1/node_modules/@modelcontextprotocol/sdk/dist/esm/experimental/tasks/interfaces.js
2041
+ /**
2042
+ * Experimental task interfaces for MCP SDK.
2043
+ * WARNING: These APIs are experimental and may change without notice.
2044
+ */
2045
+ /**
2046
+ * Checks if a task status represents a terminal state.
2047
+ * Terminal states are those where the task has finished and will not change.
2048
+ *
2049
+ * @param status - The task status to check
2050
+ * @returns True if the status is terminal (completed, failed, or cancelled)
2051
+ * @experimental
2052
+ */
2053
+ function isTerminal(status) {
2054
+ return status === "completed" || status === "failed" || status === "cancelled";
2055
+ }
2056
+
2057
+ //#endregion
2058
+ //#region ../../node_modules/.bun/zod-to-json-schema@3.25.1+3c5d820c62823f0b/node_modules/zod-to-json-schema/dist/esm/Options.js
2059
+
2060
+ //#endregion
2061
+ //#region ../../node_modules/.bun/zod-to-json-schema@3.25.1+3c5d820c62823f0b/node_modules/zod-to-json-schema/dist/esm/errorMessages.js
2062
+ function addErrorMessage(res, key, errorMessage, refs) {
2063
+ if (!refs?.errorMessages) return;
2064
+ if (errorMessage) res.errorMessage = {
2065
+ ...res.errorMessage,
2066
+ [key]: errorMessage
2067
+ };
2068
+ }
2069
+ function setResponseValueAndErrors(res, key, value, errorMessage, refs) {
2070
+ res[key] = value;
2071
+ addErrorMessage(res, key, errorMessage, refs);
2072
+ }
2073
+
2074
+ //#endregion
2075
+ //#region ../../node_modules/.bun/zod-to-json-schema@3.25.1+3c5d820c62823f0b/node_modules/zod-to-json-schema/dist/esm/getRelativePath.js
2076
+
2077
+ //#endregion
2078
+ //#region ../../node_modules/.bun/zod-to-json-schema@3.25.1+3c5d820c62823f0b/node_modules/zod-to-json-schema/dist/esm/parsers/any.js
2079
+ function parseAnyDef(refs) {
2080
+ if (refs.target !== "openAi") return {};
2081
+ const anyDefinitionPath = [...refs.basePath, refs.definitionPath, refs.openAiAnyTypeName];
2082
+ refs.flags.hasReferencedOpenAiAnyType = true;
2083
+ return {
2084
+ $ref: refs.$refStrategy === "relative" ? getRelativePath(anyDefinitionPath, refs.currentPath) : anyDefinitionPath.join("/")
2085
+ };
2086
+ }
2087
+
2088
+ //#endregion
2089
+ //#region ../../node_modules/.bun/zod-to-json-schema@3.25.1+3c5d820c62823f0b/node_modules/zod-to-json-schema/dist/esm/parsers/array.js
2090
+ function parseArrayDef(def, refs) {
2091
+ const res = {
2092
+ type: "array"
2093
+ };
2094
+ if (def.type?._def && def.type?._def?.typeName !== ZodFirstPartyTypeKind.ZodAny) res.items = parseDef(def.type._def, {
2095
+ ...refs,
2096
+ currentPath: [...refs.currentPath, "items"]
2097
+ });
2098
+ if (def.minLength) setResponseValueAndErrors(res, "minItems", def.minLength.value, def.minLength.message, refs);
2099
+ if (def.maxLength) setResponseValueAndErrors(res, "maxItems", def.maxLength.value, def.maxLength.message, refs);
2100
+ if (def.exactLength) {
2101
+ setResponseValueAndErrors(res, "minItems", def.exactLength.value, def.exactLength.message, refs);
2102
+ setResponseValueAndErrors(res, "maxItems", def.exactLength.value, def.exactLength.message, refs);
2103
+ }
2104
+ return res;
2105
+ }
2106
+
2107
+ //#endregion
2108
+ //#region ../../node_modules/.bun/zod-to-json-schema@3.25.1+3c5d820c62823f0b/node_modules/zod-to-json-schema/dist/esm/parsers/bigint.js
2109
+ function parseBigintDef(def, refs) {
2110
+ const res = {
2111
+ type: "integer",
2112
+ format: "int64"
2113
+ };
2114
+ if (!def.checks) return res;
2115
+ for (const check of def.checks) switch (check.kind) {
2116
+ case "min":
2117
+ if (refs.target === "jsonSchema7") {
2118
+ if (check.inclusive) setResponseValueAndErrors(res, "minimum", check.value, check.message, refs);else setResponseValueAndErrors(res, "exclusiveMinimum", check.value, check.message, refs);
2119
+ } else {
2120
+ if (!check.inclusive) res.exclusiveMinimum = true;
2121
+ setResponseValueAndErrors(res, "minimum", check.value, check.message, refs);
2122
+ }
2123
+ break;
2124
+ case "max":
2125
+ if (refs.target === "jsonSchema7") {
2126
+ if (check.inclusive) setResponseValueAndErrors(res, "maximum", check.value, check.message, refs);else setResponseValueAndErrors(res, "exclusiveMaximum", check.value, check.message, refs);
2127
+ } else {
2128
+ if (!check.inclusive) res.exclusiveMaximum = true;
2129
+ setResponseValueAndErrors(res, "maximum", check.value, check.message, refs);
2130
+ }
2131
+ break;
2132
+ case "multipleOf":
2133
+ setResponseValueAndErrors(res, "multipleOf", check.value, check.message, refs);
2134
+ break;
2135
+ }
2136
+ return res;
2137
+ }
2138
+
2139
+ //#endregion
2140
+ //#region ../../node_modules/.bun/zod-to-json-schema@3.25.1+3c5d820c62823f0b/node_modules/zod-to-json-schema/dist/esm/parsers/boolean.js
2141
+ function parseBooleanDef() {
2142
+ return {
2143
+ type: "boolean"
2144
+ };
2145
+ }
2146
+
2147
+ //#endregion
2148
+ //#region ../../node_modules/.bun/zod-to-json-schema@3.25.1+3c5d820c62823f0b/node_modules/zod-to-json-schema/dist/esm/parsers/branded.js
2149
+ function parseBrandedDef(_def, refs) {
2150
+ return parseDef(_def.type._def, refs);
2151
+ }
2152
+
2153
+ //#endregion
2154
+ //#region ../../node_modules/.bun/zod-to-json-schema@3.25.1+3c5d820c62823f0b/node_modules/zod-to-json-schema/dist/esm/parsers/catch.js
2155
+
2156
+ //#endregion
2157
+ //#region ../../node_modules/.bun/zod-to-json-schema@3.25.1+3c5d820c62823f0b/node_modules/zod-to-json-schema/dist/esm/parsers/date.js
2158
+ function parseDateDef(def, refs, overrideDateStrategy) {
2159
+ const strategy = overrideDateStrategy ?? refs.dateStrategy;
2160
+ if (Array.isArray(strategy)) return {
2161
+ anyOf: strategy.map((item, i) => parseDateDef(def, refs, item))
2162
+ };
2163
+ switch (strategy) {
2164
+ case "string":
2165
+ case "format:date-time":
2166
+ return {
2167
+ type: "string",
2168
+ format: "date-time"
2169
+ };
2170
+ case "format:date":
2171
+ return {
2172
+ type: "string",
2173
+ format: "date"
2174
+ };
2175
+ case "integer":
2176
+ return integerDateParser(def, refs);
2177
+ }
2178
+ }
2179
+ //#endregion
2180
+ //#region ../../node_modules/.bun/zod-to-json-schema@3.25.1+3c5d820c62823f0b/node_modules/zod-to-json-schema/dist/esm/parsers/default.js
2181
+ function parseDefaultDef(_def, refs) {
2182
+ return {
2183
+ ...parseDef(_def.innerType._def, refs),
2184
+ default: _def.defaultValue()
2185
+ };
2186
+ }
2187
+
2188
+ //#endregion
2189
+ //#region ../../node_modules/.bun/zod-to-json-schema@3.25.1+3c5d820c62823f0b/node_modules/zod-to-json-schema/dist/esm/parsers/effects.js
2190
+ function parseEffectsDef(_def, refs) {
2191
+ return refs.effectStrategy === "input" ? parseDef(_def.schema._def, refs) : parseAnyDef(refs);
2192
+ }
2193
+
2194
+ //#endregion
2195
+ //#region ../../node_modules/.bun/zod-to-json-schema@3.25.1+3c5d820c62823f0b/node_modules/zod-to-json-schema/dist/esm/parsers/enum.js
2196
+ function parseEnumDef(def) {
2197
+ return {
2198
+ type: "string",
2199
+ enum: Array.from(def.values)
2200
+ };
2201
+ }
2202
+
2203
+ //#endregion
2204
+ //#region ../../node_modules/.bun/zod-to-json-schema@3.25.1+3c5d820c62823f0b/node_modules/zod-to-json-schema/dist/esm/parsers/intersection.js
2205
+
2206
+ function parseIntersectionDef(def, refs) {
2207
+ const allOf = [parseDef(def.left._def, {
2208
+ ...refs,
2209
+ currentPath: [...refs.currentPath, "allOf", "0"]
2210
+ }), parseDef(def.right._def, {
2211
+ ...refs,
2212
+ currentPath: [...refs.currentPath, "allOf", "1"]
2213
+ })].filter(x => !!x);
2214
+ let unevaluatedProperties = refs.target === "jsonSchema2019-09" ? {
2215
+ unevaluatedProperties: false
2216
+ } : void 0;
2217
+ const mergedAllOf = [];
2218
+ allOf.forEach(schema => {
2219
+ if (isJsonSchema7AllOfType(schema)) {
2220
+ mergedAllOf.push(...schema.allOf);
2221
+ if (schema.unevaluatedProperties === void 0) unevaluatedProperties = void 0;
2222
+ } else {
2223
+ let nestedSchema = schema;
2224
+ if ("additionalProperties" in schema && schema.additionalProperties === false) {
2225
+ const {
2226
+ additionalProperties,
2227
+ ...rest
2228
+ } = schema;
2229
+ nestedSchema = rest;
2230
+ } else unevaluatedProperties = void 0;
2231
+ mergedAllOf.push(nestedSchema);
2232
+ }
2233
+ });
2234
+ return mergedAllOf.length ? {
2235
+ allOf: mergedAllOf,
2236
+ ...unevaluatedProperties
2237
+ } : void 0;
2238
+ }
2239
+
2240
+ //#endregion
2241
+ //#region ../../node_modules/.bun/zod-to-json-schema@3.25.1+3c5d820c62823f0b/node_modules/zod-to-json-schema/dist/esm/parsers/literal.js
2242
+ function parseLiteralDef(def, refs) {
2243
+ const parsedType = typeof def.value;
2244
+ if (parsedType !== "bigint" && parsedType !== "number" && parsedType !== "boolean" && parsedType !== "string") return {
2245
+ type: Array.isArray(def.value) ? "array" : "object"
2246
+ };
2247
+ if (refs.target === "openApi3") return {
2248
+ type: parsedType === "bigint" ? "integer" : parsedType,
2249
+ enum: [def.value]
2250
+ };
2251
+ return {
2252
+ type: parsedType === "bigint" ? "integer" : parsedType,
2253
+ const: def.value
2254
+ };
2255
+ }
2256
+
2257
+ //#endregion
2258
+ //#region ../../node_modules/.bun/zod-to-json-schema@3.25.1+3c5d820c62823f0b/node_modules/zod-to-json-schema/dist/esm/parsers/string.js
2259
+
2260
+ function parseStringDef(def, refs) {
2261
+ const res = {
2262
+ type: "string"
2263
+ };
2264
+ if (def.checks) for (const check of def.checks) switch (check.kind) {
2265
+ case "min":
2266
+ setResponseValueAndErrors(res, "minLength", typeof res.minLength === "number" ? Math.max(res.minLength, check.value) : check.value, check.message, refs);
2267
+ break;
2268
+ case "max":
2269
+ setResponseValueAndErrors(res, "maxLength", typeof res.maxLength === "number" ? Math.min(res.maxLength, check.value) : check.value, check.message, refs);
2270
+ break;
2271
+ case "email":
2272
+ switch (refs.emailStrategy) {
2273
+ case "format:email":
2274
+ addFormat(res, "email", check.message, refs);
2275
+ break;
2276
+ case "format:idn-email":
2277
+ addFormat(res, "idn-email", check.message, refs);
2278
+ break;
2279
+ case "pattern:zod":
2280
+ addPattern(res, zodPatterns.email, check.message, refs);
2281
+ break;
2282
+ }
2283
+ break;
2284
+ case "url":
2285
+ addFormat(res, "uri", check.message, refs);
2286
+ break;
2287
+ case "uuid":
2288
+ addFormat(res, "uuid", check.message, refs);
2289
+ break;
2290
+ case "regex":
2291
+ addPattern(res, check.regex, check.message, refs);
2292
+ break;
2293
+ case "cuid":
2294
+ addPattern(res, zodPatterns.cuid, check.message, refs);
2295
+ break;
2296
+ case "cuid2":
2297
+ addPattern(res, zodPatterns.cuid2, check.message, refs);
2298
+ break;
2299
+ case "startsWith":
2300
+ addPattern(res, RegExp(`^${escapeLiteralCheckValue(check.value, refs)}`), check.message, refs);
2301
+ break;
2302
+ case "endsWith":
2303
+ addPattern(res, RegExp(`${escapeLiteralCheckValue(check.value, refs)}$`), check.message, refs);
2304
+ break;
2305
+ case "datetime":
2306
+ addFormat(res, "date-time", check.message, refs);
2307
+ break;
2308
+ case "date":
2309
+ addFormat(res, "date", check.message, refs);
2310
+ break;
2311
+ case "time":
2312
+ addFormat(res, "time", check.message, refs);
2313
+ break;
2314
+ case "duration":
2315
+ addFormat(res, "duration", check.message, refs);
2316
+ break;
2317
+ case "length":
2318
+ setResponseValueAndErrors(res, "minLength", typeof res.minLength === "number" ? Math.max(res.minLength, check.value) : check.value, check.message, refs);
2319
+ setResponseValueAndErrors(res, "maxLength", typeof res.maxLength === "number" ? Math.min(res.maxLength, check.value) : check.value, check.message, refs);
2320
+ break;
2321
+ case "includes":
2322
+ addPattern(res, RegExp(escapeLiteralCheckValue(check.value, refs)), check.message, refs);
2323
+ break;
2324
+ case "ip":
2325
+ if (check.version !== "v6") addFormat(res, "ipv4", check.message, refs);
2326
+ if (check.version !== "v4") addFormat(res, "ipv6", check.message, refs);
2327
+ break;
2328
+ case "base64url":
2329
+ addPattern(res, zodPatterns.base64url, check.message, refs);
2330
+ break;
2331
+ case "jwt":
2332
+ addPattern(res, zodPatterns.jwt, check.message, refs);
2333
+ break;
2334
+ case "cidr":
2335
+ if (check.version !== "v6") addPattern(res, zodPatterns.ipv4Cidr, check.message, refs);
2336
+ if (check.version !== "v4") addPattern(res, zodPatterns.ipv6Cidr, check.message, refs);
2337
+ break;
2338
+ case "emoji":
2339
+ addPattern(res, zodPatterns.emoji(), check.message, refs);
2340
+ break;
2341
+ case "ulid":
2342
+ addPattern(res, zodPatterns.ulid, check.message, refs);
2343
+ break;
2344
+ case "base64":
2345
+ switch (refs.base64Strategy) {
2346
+ case "format:binary":
2347
+ addFormat(res, "binary", check.message, refs);
2348
+ break;
2349
+ case "contentEncoding:base64":
2350
+ setResponseValueAndErrors(res, "contentEncoding", "base64", check.message, refs);
2351
+ break;
2352
+ case "pattern:zod":
2353
+ addPattern(res, zodPatterns.base64, check.message, refs);
2354
+ break;
2355
+ }
2356
+ break;
2357
+ case "nanoid":
2358
+ addPattern(res, zodPatterns.nanoid, check.message, refs);
2359
+ case "toLowerCase":
2360
+ case "toUpperCase":
2361
+ case "trim":
2362
+ break;
2363
+ default:
2364
+ (_ => {})(check);
2365
+ }
2366
+ return res;
2367
+ }
2368
+ function escapeLiteralCheckValue(literal, refs) {
2369
+ return refs.patternStrategy === "escape" ? escapeNonAlphaNumeric(literal) : literal;
2370
+ }
2371
+ function escapeNonAlphaNumeric(source) {
2372
+ let result = "";
2373
+ for (let i = 0; i < source.length; i++) {
2374
+ if (!ALPHA_NUMERIC.has(source[i])) result += "\\";
2375
+ result += source[i];
2376
+ }
2377
+ return result;
2378
+ }
2379
+ function addFormat(schema, value, message, refs) {
2380
+ if (schema.format || schema.anyOf?.some(x => x.format)) {
2381
+ if (!schema.anyOf) schema.anyOf = [];
2382
+ if (schema.format) {
2383
+ schema.anyOf.push({
2384
+ format: schema.format,
2385
+ ...(schema.errorMessage && refs.errorMessages && {
2386
+ errorMessage: {
2387
+ format: schema.errorMessage.format
2388
+ }
2389
+ })
2390
+ });
2391
+ delete schema.format;
2392
+ if (schema.errorMessage) {
2393
+ delete schema.errorMessage.format;
2394
+ if (Object.keys(schema.errorMessage).length === 0) delete schema.errorMessage;
2395
+ }
2396
+ }
2397
+ schema.anyOf.push({
2398
+ format: value,
2399
+ ...(message && refs.errorMessages && {
2400
+ errorMessage: {
2401
+ format: message
2402
+ }
2403
+ })
2404
+ });
2405
+ } else setResponseValueAndErrors(schema, "format", value, message, refs);
2406
+ }
2407
+ function addPattern(schema, regex, message, refs) {
2408
+ if (schema.pattern || schema.allOf?.some(x => x.pattern)) {
2409
+ if (!schema.allOf) schema.allOf = [];
2410
+ if (schema.pattern) {
2411
+ schema.allOf.push({
2412
+ pattern: schema.pattern,
2413
+ ...(schema.errorMessage && refs.errorMessages && {
2414
+ errorMessage: {
2415
+ pattern: schema.errorMessage.pattern
2416
+ }
2417
+ })
2418
+ });
2419
+ delete schema.pattern;
2420
+ if (schema.errorMessage) {
2421
+ delete schema.errorMessage.pattern;
2422
+ if (Object.keys(schema.errorMessage).length === 0) delete schema.errorMessage;
2423
+ }
2424
+ }
2425
+ schema.allOf.push({
2426
+ pattern: stringifyRegExpWithFlags(regex, refs),
2427
+ ...(message && refs.errorMessages && {
2428
+ errorMessage: {
2429
+ pattern: message
2430
+ }
2431
+ })
2432
+ });
2433
+ } else setResponseValueAndErrors(schema, "pattern", stringifyRegExpWithFlags(regex, refs), message, refs);
2434
+ }
2435
+ function stringifyRegExpWithFlags(regex, refs) {
2436
+ if (!refs.applyRegexFlags || !regex.flags) return regex.source;
2437
+ const flags = {
2438
+ i: regex.flags.includes("i"),
2439
+ m: regex.flags.includes("m"),
2440
+ s: regex.flags.includes("s")
2441
+ };
2442
+ const source = flags.i ? regex.source.toLowerCase() : regex.source;
2443
+ let pattern = "";
2444
+ let isEscaped = false;
2445
+ let inCharGroup = false;
2446
+ let inCharRange = false;
2447
+ for (let i = 0; i < source.length; i++) {
2448
+ if (isEscaped) {
2449
+ pattern += source[i];
2450
+ isEscaped = false;
2451
+ continue;
2452
+ }
2453
+ if (flags.i) {
2454
+ if (inCharGroup) {
2455
+ if (source[i].match(/[a-z]/)) {
2456
+ if (inCharRange) {
2457
+ pattern += source[i];
2458
+ pattern += `${source[i - 2]}-${source[i]}`.toUpperCase();
2459
+ inCharRange = false;
2460
+ } else if (source[i + 1] === "-" && source[i + 2]?.match(/[a-z]/)) {
2461
+ pattern += source[i];
2462
+ inCharRange = true;
2463
+ } else pattern += `${source[i]}${source[i].toUpperCase()}`;
2464
+ continue;
2465
+ }
2466
+ } else if (source[i].match(/[a-z]/)) {
2467
+ pattern += `[${source[i]}${source[i].toUpperCase()}]`;
2468
+ continue;
2469
+ }
2470
+ }
2471
+ if (flags.m) {
2472
+ if (source[i] === "^") {
2473
+ pattern += `(^|(?<=[\r\n]))`;
2474
+ continue;
2475
+ } else if (source[i] === "$") {
2476
+ pattern += `($|(?=[\r\n]))`;
2477
+ continue;
2478
+ }
2479
+ }
2480
+ if (flags.s && source[i] === ".") {
2481
+ pattern += inCharGroup ? `${source[i]}\r\n` : `[${source[i]}\r\n]`;
2482
+ continue;
2483
+ }
2484
+ pattern += source[i];
2485
+ if (source[i] === "\\") isEscaped = true;else if (inCharGroup && source[i] === "]") inCharGroup = false;else if (!inCharGroup && source[i] === "[") inCharGroup = true;
2486
+ }
2487
+ try {
2488
+ new RegExp(pattern);
2489
+ } catch {
2490
+ console.warn(`Could not convert regex pattern at ${refs.currentPath.join("/")} to a flag-independent form! Falling back to the flag-ignorant source`);
2491
+ return regex.source;
2492
+ }
2493
+ return pattern;
2494
+ }
2495
+
2496
+ //#endregion
2497
+ //#region ../../node_modules/.bun/zod-to-json-schema@3.25.1+3c5d820c62823f0b/node_modules/zod-to-json-schema/dist/esm/parsers/record.js
2498
+ function parseRecordDef(def, refs) {
2499
+ if (refs.target === "openAi") console.warn("Warning: OpenAI may not support records in schemas! Try an array of key-value pairs instead.");
2500
+ if (refs.target === "openApi3" && def.keyType?._def.typeName === ZodFirstPartyTypeKind.ZodEnum) return {
2501
+ type: "object",
2502
+ required: def.keyType._def.values,
2503
+ properties: def.keyType._def.values.reduce((acc, key) => ({
2504
+ ...acc,
2505
+ [key]: parseDef(def.valueType._def, {
2506
+ ...refs,
2507
+ currentPath: [...refs.currentPath, "properties", key]
2508
+ }) ?? parseAnyDef(refs)
2509
+ }), {}),
2510
+ additionalProperties: refs.rejectedAdditionalProperties
2511
+ };
2512
+ const schema = {
2513
+ type: "object",
2514
+ additionalProperties: parseDef(def.valueType._def, {
2515
+ ...refs,
2516
+ currentPath: [...refs.currentPath, "additionalProperties"]
2517
+ }) ?? refs.allowedAdditionalProperties
2518
+ };
2519
+ if (refs.target === "openApi3") return schema;
2520
+ if (def.keyType?._def.typeName === ZodFirstPartyTypeKind.ZodString && def.keyType._def.checks?.length) {
2521
+ const {
2522
+ type,
2523
+ ...keyType
2524
+ } = parseStringDef(def.keyType._def, refs);
2525
+ return {
2526
+ ...schema,
2527
+ propertyNames: keyType
2528
+ };
2529
+ } else if (def.keyType?._def.typeName === ZodFirstPartyTypeKind.ZodEnum) return {
2530
+ ...schema,
2531
+ propertyNames: {
2532
+ enum: def.keyType._def.values
2533
+ }
2534
+ };else if (def.keyType?._def.typeName === ZodFirstPartyTypeKind.ZodBranded && def.keyType._def.type._def.typeName === ZodFirstPartyTypeKind.ZodString && def.keyType._def.type._def.checks?.length) {
2535
+ const {
2536
+ type,
2537
+ ...keyType
2538
+ } = parseBrandedDef(def.keyType._def, refs);
2539
+ return {
2540
+ ...schema,
2541
+ propertyNames: keyType
2542
+ };
2543
+ }
2544
+ return schema;
2545
+ }
2546
+
2547
+ //#endregion
2548
+ //#region ../../node_modules/.bun/zod-to-json-schema@3.25.1+3c5d820c62823f0b/node_modules/zod-to-json-schema/dist/esm/parsers/map.js
2549
+ function parseMapDef(def, refs) {
2550
+ if (refs.mapStrategy === "record") return parseRecordDef(def, refs);
2551
+ return {
2552
+ type: "array",
2553
+ maxItems: 125,
2554
+ items: {
2555
+ type: "array",
2556
+ items: [parseDef(def.keyType._def, {
2557
+ ...refs,
2558
+ currentPath: [...refs.currentPath, "items", "items", "0"]
2559
+ }) || parseAnyDef(refs), parseDef(def.valueType._def, {
2560
+ ...refs,
2561
+ currentPath: [...refs.currentPath, "items", "items", "1"]
2562
+ }) || parseAnyDef(refs)],
2563
+ minItems: 2,
2564
+ maxItems: 2
2565
+ }
2566
+ };
2567
+ }
2568
+
2569
+ //#endregion
2570
+ //#region ../../node_modules/.bun/zod-to-json-schema@3.25.1+3c5d820c62823f0b/node_modules/zod-to-json-schema/dist/esm/parsers/nativeEnum.js
2571
+ function parseNativeEnumDef(def) {
2572
+ const object = def.values;
2573
+ const actualValues = Object.keys(def.values).filter(key => {
2574
+ return typeof object[object[key]] !== "number";
2575
+ }).map(key => object[key]);
2576
+ const parsedTypes = Array.from(new Set(actualValues.map(values => typeof values)));
2577
+ return {
2578
+ type: parsedTypes.length === 1 ? parsedTypes[0] === "string" ? "string" : "number" : ["string", "number"],
2579
+ enum: actualValues
2580
+ };
2581
+ }
2582
+
2583
+ //#endregion
2584
+ //#region ../../node_modules/.bun/zod-to-json-schema@3.25.1+3c5d820c62823f0b/node_modules/zod-to-json-schema/dist/esm/parsers/never.js
2585
+ function parseNeverDef(refs) {
2586
+ return refs.target === "openAi" ? void 0 : {
2587
+ not: parseAnyDef({
2588
+ ...refs,
2589
+ currentPath: [...refs.currentPath, "not"]
2590
+ })
2591
+ };
2592
+ }
2593
+
2594
+ //#endregion
2595
+ //#region ../../node_modules/.bun/zod-to-json-schema@3.25.1+3c5d820c62823f0b/node_modules/zod-to-json-schema/dist/esm/parsers/null.js
2596
+ function parseNullDef(refs) {
2597
+ return refs.target === "openApi3" ? {
2598
+ enum: ["null"],
2599
+ nullable: true
2600
+ } : {
2601
+ type: "null"
2602
+ };
2603
+ }
2604
+
2605
+ //#endregion
2606
+ //#region ../../node_modules/.bun/zod-to-json-schema@3.25.1+3c5d820c62823f0b/node_modules/zod-to-json-schema/dist/esm/parsers/union.js
2607
+
2608
+ function parseUnionDef(def, refs) {
2609
+ if (refs.target === "openApi3") return asAnyOf(def, refs);
2610
+ const options = def.options instanceof Map ? Array.from(def.options.values()) : def.options;
2611
+ if (options.every(x => x._def.typeName in primitiveMappings && (!x._def.checks || !x._def.checks.length))) {
2612
+ const types = options.reduce((types, x) => {
2613
+ const type = primitiveMappings[x._def.typeName];
2614
+ return type && !types.includes(type) ? [...types, type] : types;
2615
+ }, []);
2616
+ return {
2617
+ type: types.length > 1 ? types : types[0]
2618
+ };
2619
+ } else if (options.every(x => x._def.typeName === "ZodLiteral" && !x.description)) {
2620
+ const types = options.reduce((acc, x) => {
2621
+ const type = typeof x._def.value;
2622
+ switch (type) {
2623
+ case "string":
2624
+ case "number":
2625
+ case "boolean":
2626
+ return [...acc, type];
2627
+ case "bigint":
2628
+ return [...acc, "integer"];
2629
+ case "object":
2630
+ if (x._def.value === null) return [...acc, "null"];
2631
+ default:
2632
+ return acc;
2633
+ }
2634
+ }, []);
2635
+ if (types.length === options.length) {
2636
+ const uniqueTypes = types.filter((x, i, a) => a.indexOf(x) === i);
2637
+ return {
2638
+ type: uniqueTypes.length > 1 ? uniqueTypes : uniqueTypes[0],
2639
+ enum: options.reduce((acc, x) => {
2640
+ return acc.includes(x._def.value) ? acc : [...acc, x._def.value];
2641
+ }, [])
2642
+ };
2643
+ }
2644
+ } else if (options.every(x => x._def.typeName === "ZodEnum")) return {
2645
+ type: "string",
2646
+ enum: options.reduce((acc, x) => [...acc, ...x._def.values.filter(x => !acc.includes(x))], [])
2647
+ };
2648
+ return asAnyOf(def, refs);
2649
+ }
2650
+ //#endregion
2651
+ //#region ../../node_modules/.bun/zod-to-json-schema@3.25.1+3c5d820c62823f0b/node_modules/zod-to-json-schema/dist/esm/parsers/nullable.js
2652
+ function parseNullableDef(def, refs) {
2653
+ if (["ZodString", "ZodNumber", "ZodBigInt", "ZodBoolean", "ZodNull"].includes(def.innerType._def.typeName) && (!def.innerType._def.checks || !def.innerType._def.checks.length)) {
2654
+ if (refs.target === "openApi3") return {
2655
+ type: primitiveMappings[def.innerType._def.typeName],
2656
+ nullable: true
2657
+ };
2658
+ return {
2659
+ type: [primitiveMappings[def.innerType._def.typeName], "null"]
2660
+ };
2661
+ }
2662
+ if (refs.target === "openApi3") {
2663
+ const base = parseDef(def.innerType._def, {
2664
+ ...refs,
2665
+ currentPath: [...refs.currentPath]
2666
+ });
2667
+ if (base && "$ref" in base) return {
2668
+ allOf: [base],
2669
+ nullable: true
2670
+ };
2671
+ return base && {
2672
+ ...base,
2673
+ nullable: true
2674
+ };
2675
+ }
2676
+ const base = parseDef(def.innerType._def, {
2677
+ ...refs,
2678
+ currentPath: [...refs.currentPath, "anyOf", "0"]
2679
+ });
2680
+ return base && {
2681
+ anyOf: [base, {
2682
+ type: "null"
2683
+ }]
2684
+ };
2685
+ }
2686
+
2687
+ //#endregion
2688
+ //#region ../../node_modules/.bun/zod-to-json-schema@3.25.1+3c5d820c62823f0b/node_modules/zod-to-json-schema/dist/esm/parsers/number.js
2689
+ function parseNumberDef(def, refs) {
2690
+ const res = {
2691
+ type: "number"
2692
+ };
2693
+ if (!def.checks) return res;
2694
+ for (const check of def.checks) switch (check.kind) {
2695
+ case "int":
2696
+ res.type = "integer";
2697
+ addErrorMessage(res, "type", check.message, refs);
2698
+ break;
2699
+ case "min":
2700
+ if (refs.target === "jsonSchema7") {
2701
+ if (check.inclusive) setResponseValueAndErrors(res, "minimum", check.value, check.message, refs);else setResponseValueAndErrors(res, "exclusiveMinimum", check.value, check.message, refs);
2702
+ } else {
2703
+ if (!check.inclusive) res.exclusiveMinimum = true;
2704
+ setResponseValueAndErrors(res, "minimum", check.value, check.message, refs);
2705
+ }
2706
+ break;
2707
+ case "max":
2708
+ if (refs.target === "jsonSchema7") {
2709
+ if (check.inclusive) setResponseValueAndErrors(res, "maximum", check.value, check.message, refs);else setResponseValueAndErrors(res, "exclusiveMaximum", check.value, check.message, refs);
2710
+ } else {
2711
+ if (!check.inclusive) res.exclusiveMaximum = true;
2712
+ setResponseValueAndErrors(res, "maximum", check.value, check.message, refs);
2713
+ }
2714
+ break;
2715
+ case "multipleOf":
2716
+ setResponseValueAndErrors(res, "multipleOf", check.value, check.message, refs);
2717
+ break;
2718
+ }
2719
+ return res;
2720
+ }
2721
+
2722
+ //#endregion
2723
+ //#region ../../node_modules/.bun/zod-to-json-schema@3.25.1+3c5d820c62823f0b/node_modules/zod-to-json-schema/dist/esm/parsers/object.js
2724
+ function parseObjectDef(def, refs) {
2725
+ const forceOptionalIntoNullable = refs.target === "openAi";
2726
+ const result = {
2727
+ type: "object",
2728
+ properties: {}
2729
+ };
2730
+ const required = [];
2731
+ const shape = def.shape();
2732
+ for (const propName in shape) {
2733
+ let propDef = shape[propName];
2734
+ if (propDef === void 0 || propDef._def === void 0) continue;
2735
+ let propOptional = safeIsOptional(propDef);
2736
+ if (propOptional && forceOptionalIntoNullable) {
2737
+ if (propDef._def.typeName === "ZodOptional") propDef = propDef._def.innerType;
2738
+ if (!propDef.isNullable()) propDef = propDef.nullable();
2739
+ propOptional = false;
2740
+ }
2741
+ const parsedDef = parseDef(propDef._def, {
2742
+ ...refs,
2743
+ currentPath: [...refs.currentPath, "properties", propName],
2744
+ propertyPath: [...refs.currentPath, "properties", propName]
2745
+ });
2746
+ if (parsedDef === void 0) continue;
2747
+ result.properties[propName] = parsedDef;
2748
+ if (!propOptional) required.push(propName);
2749
+ }
2750
+ if (required.length) result.required = required;
2751
+ const additionalProperties = decideAdditionalProperties(def, refs);
2752
+ if (additionalProperties !== void 0) result.additionalProperties = additionalProperties;
2753
+ return result;
2754
+ }
2755
+ function decideAdditionalProperties(def, refs) {
2756
+ if (def.catchall._def.typeName !== "ZodNever") return parseDef(def.catchall._def, {
2757
+ ...refs,
2758
+ currentPath: [...refs.currentPath, "additionalProperties"]
2759
+ });
2760
+ switch (def.unknownKeys) {
2761
+ case "passthrough":
2762
+ return refs.allowedAdditionalProperties;
2763
+ case "strict":
2764
+ return refs.rejectedAdditionalProperties;
2765
+ case "strip":
2766
+ return refs.removeAdditionalStrategy === "strict" ? refs.allowedAdditionalProperties : refs.rejectedAdditionalProperties;
2767
+ }
2768
+ }
2769
+ function safeIsOptional(schema) {
2770
+ try {
2771
+ return schema.isOptional();
2772
+ } catch {
2773
+ return true;
2774
+ }
2775
+ }
2776
+
2777
+ //#endregion
2778
+ //#region ../../node_modules/.bun/zod-to-json-schema@3.25.1+3c5d820c62823f0b/node_modules/zod-to-json-schema/dist/esm/parsers/optional.js
2779
+
2780
+ //#endregion
2781
+ //#region ../../node_modules/.bun/zod-to-json-schema@3.25.1+3c5d820c62823f0b/node_modules/zod-to-json-schema/dist/esm/parsers/promise.js
2782
+ function parsePromiseDef(def, refs) {
2783
+ return parseDef(def.type._def, refs);
2784
+ }
2785
+
2786
+ //#endregion
2787
+ //#region ../../node_modules/.bun/zod-to-json-schema@3.25.1+3c5d820c62823f0b/node_modules/zod-to-json-schema/dist/esm/parsers/set.js
2788
+ function parseSetDef(def, refs) {
2789
+ const schema = {
2790
+ type: "array",
2791
+ uniqueItems: true,
2792
+ items: parseDef(def.valueType._def, {
2793
+ ...refs,
2794
+ currentPath: [...refs.currentPath, "items"]
2795
+ })
2796
+ };
2797
+ if (def.minSize) setResponseValueAndErrors(schema, "minItems", def.minSize.value, def.minSize.message, refs);
2798
+ if (def.maxSize) setResponseValueAndErrors(schema, "maxItems", def.maxSize.value, def.maxSize.message, refs);
2799
+ return schema;
2800
+ }
2801
+
2802
+ //#endregion
2803
+ //#region ../../node_modules/.bun/zod-to-json-schema@3.25.1+3c5d820c62823f0b/node_modules/zod-to-json-schema/dist/esm/parsers/tuple.js
2804
+ function parseTupleDef(def, refs) {
2805
+ if (def.rest) return {
2806
+ type: "array",
2807
+ minItems: def.items.length,
2808
+ items: def.items.map((x, i) => parseDef(x._def, {
2809
+ ...refs,
2810
+ currentPath: [...refs.currentPath, "items", `${i}`]
2811
+ })).reduce((acc, x) => x === void 0 ? acc : [...acc, x], []),
2812
+ additionalItems: parseDef(def.rest._def, {
2813
+ ...refs,
2814
+ currentPath: [...refs.currentPath, "additionalItems"]
2815
+ })
2816
+ };else return {
2817
+ type: "array",
2818
+ minItems: def.items.length,
2819
+ maxItems: def.items.length,
2820
+ items: def.items.map((x, i) => parseDef(x._def, {
2821
+ ...refs,
2822
+ currentPath: [...refs.currentPath, "items", `${i}`]
2823
+ })).reduce((acc, x) => x === void 0 ? acc : [...acc, x], [])
2824
+ };
2825
+ }
2826
+
2827
+ //#endregion
2828
+ //#region ../../node_modules/.bun/zod-to-json-schema@3.25.1+3c5d820c62823f0b/node_modules/zod-to-json-schema/dist/esm/parsers/undefined.js
2829
+ function parseUndefinedDef(refs) {
2830
+ return {
2831
+ not: parseAnyDef(refs)
2832
+ };
2833
+ }
2834
+
2835
+ //#endregion
2836
+ //#region ../../node_modules/.bun/zod-to-json-schema@3.25.1+3c5d820c62823f0b/node_modules/zod-to-json-schema/dist/esm/parsers/unknown.js
2837
+ function parseUnknownDef(refs) {
2838
+ return parseAnyDef(refs);
2839
+ }
2840
+
2841
+ //#endregion
2842
+ //#region ../../node_modules/.bun/zod-to-json-schema@3.25.1+3c5d820c62823f0b/node_modules/zod-to-json-schema/dist/esm/parsers/readonly.js
2843
+
2844
+ //#endregion
2845
+ //#region ../../node_modules/.bun/zod-to-json-schema@3.25.1+3c5d820c62823f0b/node_modules/zod-to-json-schema/dist/esm/parseDef.js
2846
+ function parseDef(def, refs, forceResolution = false) {
2847
+ const seenItem = refs.seen.get(def);
2848
+ if (refs.override) {
2849
+ const overrideResult = refs.override?.(def, refs, seenItem, forceResolution);
2850
+ if (overrideResult !== ignoreOverride) return overrideResult;
2851
+ }
2852
+ if (seenItem && !forceResolution) {
2853
+ const seenSchema = get$ref(seenItem, refs);
2854
+ if (seenSchema !== void 0) return seenSchema;
2855
+ }
2856
+ const newItem = {
2857
+ def,
2858
+ path: refs.currentPath,
2859
+ jsonSchema: void 0
2860
+ };
2861
+ refs.seen.set(def, newItem);
2862
+ const jsonSchemaOrGetter = selectParser(def, def.typeName, refs);
2863
+ const jsonSchema = typeof jsonSchemaOrGetter === "function" ? parseDef(jsonSchemaOrGetter(), refs) : jsonSchemaOrGetter;
2864
+ if (jsonSchema) addMeta(def, refs, jsonSchema);
2865
+ if (refs.postProcess) {
2866
+ const postProcessResult = refs.postProcess(jsonSchema, def, refs);
2867
+ newItem.jsonSchema = jsonSchema;
2868
+ return postProcessResult;
2869
+ }
2870
+ newItem.jsonSchema = jsonSchema;
2871
+ return jsonSchema;
2872
+ }
2873
+ //#endregion
2874
+ //#region ../../node_modules/.bun/@modelcontextprotocol+sdk@1.27.1/node_modules/@modelcontextprotocol/sdk/dist/esm/server/zod-json-schema-compat.js
2875
+ function mapMiniTarget(t) {
2876
+ if (!t) return "draft-7";
2877
+ if (t === "jsonSchema7" || t === "draft-7") return "draft-7";
2878
+ if (t === "jsonSchema2019-09" || t === "draft-2020-12") return "draft-2020-12";
2879
+ return "draft-7";
2880
+ }
2881
+ function toJsonSchemaCompat(schema, opts) {
2882
+ if (isZ4Schema(schema)) return toJSONSchema(schema, {
2883
+ target: mapMiniTarget(opts?.target),
2884
+ io: opts?.pipeStrategy ?? "input"
2885
+ });
2886
+ return zodToJsonSchema(schema, {
2887
+ strictUnions: opts?.strictUnions ?? true,
2888
+ pipeStrategy: opts?.pipeStrategy ?? "input"
2889
+ });
2890
+ }
2891
+ function getMethodLiteral(schema) {
2892
+ const methodSchema = getObjectShape(schema)?.method;
2893
+ if (!methodSchema) throw new Error("Schema is missing a method literal");
2894
+ const value = getLiteralValue(methodSchema);
2895
+ if (typeof value !== "string") throw new Error("Schema method literal must be a string");
2896
+ return value;
2897
+ }
2898
+ function parseWithCompat(schema, data) {
2899
+ const result = safeParse$1(schema, data);
2900
+ if (!result.success) throw result.error;
2901
+ return result.data;
2902
+ }
2903
+
2904
+ //#endregion
2905
+ //#region ../../node_modules/.bun/@modelcontextprotocol+sdk@1.27.1/node_modules/@modelcontextprotocol/sdk/dist/esm/shared/protocol.js
2906
+ /**
2907
+ * The default request timeout, in miliseconds.
2908
+ */
2909
+
2910
+ function isPlainObject(value) {
2911
+ return value !== null && typeof value === "object" && !Array.isArray(value);
2912
+ }
2913
+ function mergeCapabilities(base, additional) {
2914
+ const result = {
2915
+ ...base
2916
+ };
2917
+ for (const key in additional) {
2918
+ const k = key;
2919
+ const addValue = additional[k];
2920
+ if (addValue === void 0) continue;
2921
+ const baseValue = result[k];
2922
+ if (isPlainObject(baseValue) && isPlainObject(addValue)) result[k] = {
2923
+ ...baseValue,
2924
+ ...addValue
2925
+ };else result[k] = addValue;
2926
+ }
2927
+ return result;
2928
+ }
2929
+
2930
+ //#endregion
2931
+ //#region ../../node_modules/.bun/ajv@8.18.0/node_modules/ajv/dist/compile/codegen/code.js
2932
+
2933
+ function createDefaultAjvInstance() {
2934
+ const ajv = new import_ajv.default({
2935
+ strict: false,
2936
+ validateFormats: true,
2937
+ validateSchema: false,
2938
+ allErrors: true
2939
+ });
2940
+ (0, import_dist.default)(ajv);
2941
+ return ajv;
2942
+ }
2943
+ /**
2944
+ * @example
2945
+ * ```typescript
2946
+ * // Use with default AJV instance (recommended)
2947
+ * import { AjvJsonSchemaValidator } from '@modelcontextprotocol/sdk/validation/ajv';
2948
+ * const validator = new AjvJsonSchemaValidator();
2949
+ *
2950
+ * // Use with custom AJV instance
2951
+ * import { Ajv } from 'ajv';
2952
+ * const ajv = new Ajv({ strict: true, allErrors: true });
2953
+ * const validator = new AjvJsonSchemaValidator(ajv);
2954
+ * ```
2955
+ */
2956
+
2957
+ //#endregion
2958
+ //#region ../../node_modules/.bun/@modelcontextprotocol+sdk@1.27.1/node_modules/@modelcontextprotocol/sdk/dist/esm/experimental/tasks/helpers.js
2959
+ /**
2960
+ * Experimental task capability assertion helpers.
2961
+ * WARNING: These APIs are experimental and may change without notice.
2962
+ *
2963
+ * @experimental
2964
+ */
2965
+ /**
2966
+ * Asserts that task creation is supported for tools/call.
2967
+ * Used by Client.assertTaskCapability and Server.assertTaskHandlerCapability.
2968
+ *
2969
+ * @param requests - The task requests capability object
2970
+ * @param method - The method being checked
2971
+ * @param entityName - 'Server' or 'Client' for error messages
2972
+ * @throws Error if the capability is not supported
2973
+ *
2974
+ * @experimental
2975
+ */
2976
+ function assertToolsCallTaskCapability(requests, method, entityName) {
2977
+ if (!requests) throw new Error(`${entityName} does not support task creation (required for ${method})`);
2978
+ switch (method) {
2979
+ case "tools/call":
2980
+ if (!requests.tools?.call) throw new Error(`${entityName} does not support task creation for tools/call (required for ${method})`);
2981
+ break;
2982
+ default:
2983
+ break;
2984
+ }
2985
+ }
2986
+ /**
2987
+ * Asserts that task creation is supported for sampling/createMessage or elicitation/create.
2988
+ * Used by Server.assertTaskCapability and Client.assertTaskHandlerCapability.
2989
+ *
2990
+ * @param requests - The task requests capability object
2991
+ * @param method - The method being checked
2992
+ * @param entityName - 'Server' or 'Client' for error messages
2993
+ * @throws Error if the capability is not supported
2994
+ *
2995
+ * @experimental
2996
+ */
2997
+ function assertClientRequestTaskCapability(requests, method, entityName) {
2998
+ if (!requests) throw new Error(`${entityName} does not support task creation (required for ${method})`);
2999
+ switch (method) {
3000
+ case "sampling/createMessage":
3001
+ if (!requests.sampling?.createMessage) throw new Error(`${entityName} does not support task creation for sampling/createMessage (required for ${method})`);
3002
+ break;
3003
+ case "elicitation/create":
3004
+ if (!requests.elicitation?.create) throw new Error(`${entityName} does not support task creation for elicitation/create (required for ${method})`);
3005
+ break;
3006
+ default:
3007
+ break;
3008
+ }
3009
+ }
3010
+
3011
+ //#endregion
3012
+ //#region ../../node_modules/.bun/@modelcontextprotocol+sdk@1.27.1/node_modules/@modelcontextprotocol/sdk/dist/esm/server/index.js
3013
+ /**
3014
+ * An MCP server on top of a pluggable transport.
3015
+ *
3016
+ * This server will automatically respond to the initialization flow as initiated from the client.
3017
+ *
3018
+ * To use with custom types, extend the base Request/Notification/Result types and pass them as type parameters:
3019
+ *
3020
+ * ```typescript
3021
+ * // Custom schemas
3022
+ * const CustomRequestSchema = RequestSchema.extend({...})
3023
+ * const CustomNotificationSchema = NotificationSchema.extend({...})
3024
+ * const CustomResultSchema = ResultSchema.extend({...})
3025
+ *
3026
+ * // Type aliases
3027
+ * type CustomRequest = z.infer<typeof CustomRequestSchema>
3028
+ * type CustomNotification = z.infer<typeof CustomNotificationSchema>
3029
+ * type CustomResult = z.infer<typeof CustomResultSchema>
3030
+ *
3031
+ * // Create typed server
3032
+ * const server = new Server<CustomRequest, CustomNotification, CustomResult>({
3033
+ * name: "CustomServer",
3034
+ * version: "1.0.0"
3035
+ * })
3036
+ * ```
3037
+ * @deprecated Use `McpServer` instead for the high-level API. Only use `Server` for advanced use cases.
3038
+ */
3039
+
3040
+ /**
3041
+ * Checks if a schema is completable (has completion metadata).
3042
+ */
3043
+ function isCompletable(schema) {
3044
+ return !!schema && typeof schema === "object" && COMPLETABLE_SYMBOL in schema;
3045
+ }
3046
+ /**
3047
+ * Gets the completer callback from a completable schema, if it exists.
3048
+ */
3049
+ function getCompleter(schema) {
3050
+ return schema[COMPLETABLE_SYMBOL]?.complete;
3051
+ }
3052
+ /**
3053
+ * Validates a tool name according to the SEP specification
3054
+ * @param name - The tool name to validate
3055
+ * @returns An object containing validation result and any warnings
3056
+ */
3057
+ function validateToolName(name) {
3058
+ const warnings = [];
3059
+ if (name.length === 0) return {
3060
+ isValid: false,
3061
+ warnings: ["Tool name cannot be empty"]
3062
+ };
3063
+ if (name.length > 128) return {
3064
+ isValid: false,
3065
+ warnings: [`Tool name exceeds maximum length of 128 characters (current: ${name.length})`]
3066
+ };
3067
+ if (name.includes(" ")) warnings.push("Tool name contains spaces, which may cause parsing issues");
3068
+ if (name.includes(",")) warnings.push("Tool name contains commas, which may cause parsing issues");
3069
+ if (name.startsWith("-") || name.endsWith("-")) warnings.push("Tool name starts or ends with a dash, which may cause parsing issues in some contexts");
3070
+ if (name.startsWith(".") || name.endsWith(".")) warnings.push("Tool name starts or ends with a dot, which may cause parsing issues in some contexts");
3071
+ if (!TOOL_NAME_REGEX.test(name)) {
3072
+ const invalidChars = name.split("").filter(char => !/[A-Za-z0-9._-]/.test(char)).filter((char, index, arr) => arr.indexOf(char) === index);
3073
+ warnings.push(`Tool name contains invalid characters: ${invalidChars.map(c => `"${c}"`).join(", ")}`, "Allowed characters are: A-Z, a-z, 0-9, underscore (_), dash (-), and dot (.)");
3074
+ return {
3075
+ isValid: false,
3076
+ warnings
3077
+ };
3078
+ }
3079
+ return {
3080
+ isValid: true,
3081
+ warnings
3082
+ };
3083
+ }
3084
+ /**
3085
+ * Issues warnings for non-conforming tool names
3086
+ * @param name - The tool name that triggered the warnings
3087
+ * @param warnings - Array of warning messages
3088
+ */
3089
+ function issueToolNameWarning(name, warnings) {
3090
+ if (warnings.length > 0) {
3091
+ console.warn(`Tool name validation warning for "${name}":`);
3092
+ for (const warning of warnings) console.warn(` - ${warning}`);
3093
+ console.warn("Tool registration will proceed, but this may cause compatibility issues.");
3094
+ console.warn("Consider updating the tool name to conform to the MCP tool naming standard.");
3095
+ console.warn("See SEP: Specify Format for Tool Names (https://github.com/modelcontextprotocol/modelcontextprotocol/issues/986) for more details.");
3096
+ }
3097
+ }
3098
+ /**
3099
+ * Validates a tool name and issues warnings for non-conforming names
3100
+ * @param name - The tool name to validate
3101
+ * @returns true if the name is valid, false otherwise
3102
+ */
3103
+ function validateAndWarnToolName(name) {
3104
+ const result = validateToolName(name);
3105
+ issueToolNameWarning(name, result.warnings);
3106
+ return result.isValid;
3107
+ }
3108
+
3109
+ //#endregion
3110
+ //#region ../../node_modules/.bun/@modelcontextprotocol+sdk@1.27.1/node_modules/@modelcontextprotocol/sdk/dist/esm/experimental/tasks/mcp-server.js
3111
+ /**
3112
+ * Experimental McpServer task features for MCP SDK.
3113
+ * WARNING: These APIs are experimental and may change without notice.
3114
+ *
3115
+ * @experimental
3116
+ */
3117
+ /**
3118
+ * Experimental task features for McpServer.
3119
+ *
3120
+ * Access via `server.experimental.tasks`:
3121
+ * ```typescript
3122
+ * server.experimental.tasks.registerToolTask('long-running', config, handler);
3123
+ * ```
3124
+ *
3125
+ * @experimental
3126
+ */
3127
+
3128
+ /**
3129
+ * Checks if a value looks like a Zod schema by checking for parse/safeParse methods.
3130
+ */
3131
+ function isZodTypeLike(value) {
3132
+ return value !== null && typeof value === "object" && "parse" in value && typeof value.parse === "function" && "safeParse" in value && typeof value.safeParse === "function";
3133
+ }
3134
+ /**
3135
+ * Checks if an object is a Zod schema instance (v3 or v4).
3136
+ *
3137
+ * Zod schemas have internal markers:
3138
+ * - v3: `_def` property
3139
+ * - v4: `_zod` property
3140
+ *
3141
+ * This includes transformed schemas like z.preprocess(), z.transform(), z.pipe().
3142
+ */
3143
+ function isZodSchemaInstance(obj) {
3144
+ return "_def" in obj || "_zod" in obj || isZodTypeLike(obj);
3145
+ }
3146
+ /**
3147
+ * Checks if an object is a "raw shape" - a plain object where values are Zod schemas.
3148
+ *
3149
+ * Raw shapes are used as shorthand: `{ name: z.string() }` instead of `z.object({ name: z.string() })`.
3150
+ *
3151
+ * IMPORTANT: This must NOT match actual Zod schema instances (like z.preprocess, z.pipe),
3152
+ * which have internal properties that could be mistaken for schema values.
3153
+ */
3154
+ function isZodRawShapeCompat(obj) {
3155
+ if (typeof obj !== "object" || obj === null) return false;
3156
+ if (isZodSchemaInstance(obj)) return false;
3157
+ if (Object.keys(obj).length === 0) return true;
3158
+ return Object.values(obj).some(isZodTypeLike);
3159
+ }
3160
+ /**
3161
+ * Converts a provided Zod schema to a Zod object if it is a ZodRawShapeCompat,
3162
+ * otherwise returns the schema as is.
3163
+ */
3164
+ function getZodSchemaObject(schema) {
3165
+ if (!schema) return;
3166
+ if (isZodRawShapeCompat(schema)) return objectFromShape(schema);
3167
+ return schema;
3168
+ }
3169
+ function promptArgumentsFromSchema(schema) {
3170
+ const shape = getObjectShape(schema);
3171
+ if (!shape) return [];
3172
+ return Object.entries(shape).map(([name, field]) => {
3173
+ return {
3174
+ name,
3175
+ description: getSchemaDescription(field),
3176
+ required: !isSchemaOptional(field)
3177
+ };
3178
+ });
3179
+ }
3180
+ function getMethodValue(schema) {
3181
+ const methodSchema = getObjectShape(schema)?.method;
3182
+ if (!methodSchema) throw new Error("Schema is missing a method literal");
3183
+ const value = getLiteralValue(methodSchema);
3184
+ if (typeof value === "string") return value;
3185
+ throw new Error("Schema method literal must be a string");
3186
+ }
3187
+ function createCompletionResult(suggestions) {
3188
+ return {
3189
+ completion: {
3190
+ values: suggestions.slice(0, 100),
3191
+ total: suggestions.length,
3192
+ hasMore: suggestions.length > 100
3193
+ }
3194
+ };
3195
+ }
3196
+ function deserializeMessage(line) {
3197
+ return JSONRPCMessageSchema.parse(JSON.parse(line));
3198
+ }
3199
+ function serializeMessage(message) {
3200
+ return JSON.stringify(message) + "\n";
3201
+ }
3202
+
3203
+ //#endregion
3204
+ //#region ../../node_modules/.bun/@modelcontextprotocol+sdk@1.27.1/node_modules/@modelcontextprotocol/sdk/dist/esm/server/stdio.js
3205
+ /**
3206
+ * Server transport for stdio: this communicates with an MCP client by reading from the current process' stdin and writing to stdout.
3207
+ *
3208
+ * This transport is only available in Node.js environments.
3209
+ */
3210
+
3211
+ //#endregion
3212
+ //#region src/project-scanner.ts
3213
+ /**
3214
+ * Project scanner — extracts route, component, and island information from source files.
3215
+ */
3216
+ function generateContext(cwd) {
3217
+ const files = collectSourceFiles(cwd);
3218
+ return {
3219
+ framework: "pyreon",
3220
+ version: readVersion(cwd),
3221
+ generatedAt: (/* @__PURE__ */new Date()).toISOString(),
3222
+ routes: extractRoutes(files, cwd),
3223
+ components: extractComponents(files, cwd),
3224
+ islands: extractIslands(files, cwd)
3225
+ };
3226
+ }
3227
+ function collectSourceFiles(cwd) {
3228
+ const results = [];
3229
+ const extensions = new Set([".tsx", ".jsx", ".ts", ".js"]);
3230
+ const ignoreDirs = new Set(["node_modules", "dist", "lib", ".pyreon", ".git", "build"]);
3231
+ function walk(dir) {
3232
+ let entries;
3233
+ try {
3234
+ entries = fs.readdirSync(dir, {
3235
+ withFileTypes: true
3236
+ });
3237
+ } catch {
3238
+ return;
3239
+ }
3240
+ for (const entry of entries) {
3241
+ if (entry.name.startsWith(".") && entry.isDirectory()) continue;
3242
+ if (ignoreDirs.has(entry.name) && entry.isDirectory()) continue;
3243
+ const fullPath = path.join(dir, entry.name);
3244
+ if (entry.isDirectory()) walk(fullPath);else if (entry.isFile() && extensions.has(path.extname(entry.name))) results.push(fullPath);
3245
+ }
3246
+ }
3247
+ walk(cwd);
3248
+ return results;
3249
+ }
3250
+ function extractRoutes(files, _cwd) {
3251
+ const routes = [];
3252
+ for (const file of files) {
3253
+ let code;
3254
+ try {
3255
+ code = fs.readFileSync(file, "utf-8");
3256
+ } catch {
3257
+ continue;
3258
+ }
3259
+ const routeArrayRe = /(?:createRouter\s*\(\s*\[|(?:const|let)\s+routes\s*(?::\s*RouteRecord\[\])?\s*=\s*\[)([\s\S]*?)\]/g;
3260
+ let match;
3261
+ for (match = routeArrayRe.exec(code); match; match = routeArrayRe.exec(code)) {
3262
+ const block = match[1] ?? "";
3263
+ const routeObjRe = /path\s*:\s*["']([^"']+)["']/g;
3264
+ let routeMatch;
3265
+ for (routeMatch = routeObjRe.exec(block); routeMatch; routeMatch = routeObjRe.exec(block)) {
3266
+ const routePath = routeMatch[1] ?? "";
3267
+ const surroundingStart = Math.max(0, routeMatch.index - 50);
3268
+ const surroundingEnd = Math.min(block.length, routeMatch.index + 200);
3269
+ const surrounding = block.slice(surroundingStart, surroundingEnd);
3270
+ routes.push({
3271
+ path: routePath,
3272
+ name: surrounding.match(/name\s*:\s*["']([^"']+)["']/)?.[1],
3273
+ hasLoader: /loader\s*:/.test(surrounding),
3274
+ hasGuard: /beforeEnter\s*:|beforeLeave\s*:/.test(surrounding),
3275
+ params: extractParams(routePath)
3276
+ });
3277
+ }
3278
+ }
3279
+ }
3280
+ return routes;
3281
+ }
3282
+ function extractComponents(files, cwd) {
3283
+ const components = [];
3284
+ for (const file of files) {
3285
+ let code;
3286
+ try {
3287
+ code = fs.readFileSync(file, "utf-8");
3288
+ } catch {
3289
+ continue;
3290
+ }
3291
+ const componentRe = /(?:export\s+)?(?:const|function)\s+([A-Z]\w*)\s*(?::\s*ComponentFn<[^>]+>\s*)?=?\s*\(?(?:\s*\{?\s*([^)]*?)\s*\}?\s*)?\)?\s*(?:=>|{)/g;
3292
+ let match;
3293
+ for (match = componentRe.exec(code); match; match = componentRe.exec(code)) {
3294
+ const name = match[1] ?? "Unknown";
3295
+ const props = (match[2] ?? "").split(/[,;]/).map(p => p.trim().replace(/[{}]/g, "").trim().split(":")[0]?.split("=")[0]?.trim() ?? "").filter(p => p && p !== "props");
3296
+ const bodyStart = match.index + match[0].length;
3297
+ const body = code.slice(bodyStart, Math.min(code.length, bodyStart + 2e3));
3298
+ const signalNames = [];
3299
+ const signalRe = /(?:const|let)\s+(\w+)\s*=\s*signal\s*[<(]/g;
3300
+ let sigMatch;
3301
+ for (sigMatch = signalRe.exec(body); sigMatch; sigMatch = signalRe.exec(body)) if (sigMatch[1]) signalNames.push(sigMatch[1]);
3302
+ components.push({
3303
+ name,
3304
+ file: path.relative(cwd, file),
3305
+ hasSignals: signalNames.length > 0,
3306
+ signalNames,
3307
+ props
3308
+ });
3309
+ }
3310
+ }
3311
+ return components;
3312
+ }
3313
+ function extractIslands(files, cwd) {
3314
+ const islands = [];
3315
+ for (const file of files) {
3316
+ let code;
3317
+ try {
3318
+ code = fs.readFileSync(file, "utf-8");
3319
+ } catch {
3320
+ continue;
3321
+ }
3322
+ const islandRe = /island\s*\(\s*\(\)\s*=>\s*import\(.+?\)\s*,\s*\{[^}]*name\s*:\s*["']([^"']+)["'][^}]*?(?:hydrate\s*:\s*["']([^"']+)["'])?[^}]*\}/g;
3323
+ let match;
3324
+ for (match = islandRe.exec(code); match; match = islandRe.exec(code)) if (match[1]) islands.push({
3325
+ name: match[1],
3326
+ file: path.relative(cwd, file),
3327
+ hydrate: match[2] ?? "load"
3328
+ });
3329
+ }
3330
+ return islands;
3331
+ }
3332
+ function extractParams(routePath) {
3333
+ const params = [];
3334
+ const paramRe = /:(\w+)\??/g;
3335
+ let match;
3336
+ for (match = paramRe.exec(routePath); match; match = paramRe.exec(routePath)) if (match[1]) params.push(match[1]);
3337
+ return params;
3338
+ }
3339
+ function readVersion(cwd) {
3340
+ try {
3341
+ const pkg = JSON.parse(fs.readFileSync(path.join(cwd, "package.json"), "utf-8"));
3342
+ const deps = {
3343
+ ...pkg.dependencies,
3344
+ ...pkg.devDependencies
3345
+ };
3346
+ for (const [name, ver] of Object.entries(deps)) if (name.startsWith("@pyreon/") && typeof ver === "string") return ver.replace(/^[\^~]/, "");
3347
+ return pkg.version || "unknown";
3348
+ } catch {
3349
+ return "unknown";
3350
+ }
3351
+ }
3352
+
3353
+ //#endregion
3354
+ //#region src/index.ts
3355
+ /**
3356
+ * @pyreon/mcp — Model Context Protocol server for Pyreon
3357
+ *
3358
+ * Exposes tools that AI coding assistants (Claude Code, Cursor, etc.) can use
3359
+ * to generate, validate, and migrate Pyreon code.
3360
+ *
3361
+ * Tools:
3362
+ * get_api — Look up any Pyreon API: signature, usage, common mistakes
3363
+ * validate — Check a code snippet for Pyreon anti-patterns
3364
+ * migrate_react — Convert React code to idiomatic Pyreon
3365
+ * diagnose — Parse an error message into structured fix information
3366
+ * get_routes — List all routes in the current project
3367
+ * get_components — List all components with their props and signals
3368
+ *
3369
+ * Usage:
3370
+ * bunx @pyreon/mcp # stdio transport (for IDE integration)
3371
+ */
3372
+
3373
+ function getContext() {
3374
+ if (!cachedContext || contextCwd !== process.cwd()) {
3375
+ contextCwd = process.cwd();
3376
+ cachedContext = generateContext(contextCwd);
3377
+ }
3378
+ return cachedContext;
3379
+ }
3380
+ function textResult(text) {
3381
+ return {
3382
+ content: [{
3383
+ type: "text",
3384
+ text
3385
+ }]
3386
+ };
3387
+ }
3388
+ async function main() {
3389
+ const transport = new StdioServerTransport();
3390
+ await server.connect(transport);
3391
+ }
3392
+ //# sourceMappingURL=index.d.ts.map