@mastra/server 2.0.3 → 2.0.4-alpha.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.
Files changed (69) hide show
  1. package/dist/_tsup-dts-rollup.d.cts +152 -10
  2. package/dist/_tsup-dts-rollup.d.ts +152 -10
  3. package/dist/{chunk-2FJURXCL.cjs → chunk-24EGIVT7.cjs} +34 -33
  4. package/dist/{chunk-3XTEV33Q.js → chunk-2KIW6AJK.js} +4 -3
  5. package/dist/{chunk-6Q7UXAYJ.cjs → chunk-3HQNCTZ2.cjs} +21 -20
  6. package/dist/{chunk-M56ECCHK.cjs → chunk-4YZ3U35L.cjs} +18 -17
  7. package/dist/{chunk-QN4KF3BH.cjs → chunk-57CJTIPW.cjs} +2 -2
  8. package/dist/chunk-5SN4U5AC.cjs +508 -0
  9. package/dist/{chunk-ZLBRQFDD.cjs → chunk-64U3UDTH.cjs} +2 -2
  10. package/dist/chunk-75ZPJI57.cjs +9 -0
  11. package/dist/{chunk-QJ3AHN64.js → chunk-C7564HUT.js} +4 -3
  12. package/dist/{chunk-L7XE5QTW.js → chunk-H5PTF3Y4.js} +1 -1
  13. package/dist/{chunk-Q6SHQECN.js → chunk-HFWCEP5S.js} +4 -3
  14. package/dist/{chunk-3EJZQ6TQ.js → chunk-HWZVAG3H.js} +3 -3
  15. package/dist/{chunk-4JINXASC.js → chunk-IU5VO2I2.js} +3 -2
  16. package/dist/chunk-LIVAK2DM.js +2001 -0
  17. package/dist/{chunk-3AHQ5RGN.js → chunk-M5ABIP7D.js} +1 -1
  18. package/dist/{chunk-AMVOS7YB.cjs → chunk-MHKNLNAN.cjs} +9 -8
  19. package/dist/chunk-MLKGABMK.js +7 -0
  20. package/dist/{chunk-TRDNDNGQ.js → chunk-NYN7KFXL.js} +1 -7
  21. package/dist/{chunk-FV45V6WC.cjs → chunk-OCWPVYNI.cjs} +0 -7
  22. package/dist/{chunk-SKBVVI24.cjs → chunk-OGCNNUHF.cjs} +9 -9
  23. package/dist/{chunk-M2RXDCPV.cjs → chunk-OHKAN72U.cjs} +76 -57
  24. package/dist/{chunk-BPL2CBLV.js → chunk-OR3CIE2H.js} +3 -2
  25. package/dist/chunk-P6SCPDYW.js +500 -0
  26. package/dist/{chunk-GVBJ5I2S.js → chunk-Q6KMBIAN.js} +5 -4
  27. package/dist/{chunk-CHFORQ7J.cjs → chunk-RYUN5DF4.cjs} +45 -44
  28. package/dist/{chunk-5JNVY6DU.js → chunk-TJKLBTFB.js} +20 -8
  29. package/dist/{chunk-5YGDYMRB.cjs → chunk-VPNDC2DI.cjs} +14 -13
  30. package/dist/{chunk-OWNA6I2H.js → chunk-WVDUW4GI.js} +28 -9
  31. package/dist/{chunk-RBQASTUP.js → chunk-X3ZDCS52.js} +4 -3
  32. package/dist/{chunk-55HTWX4C.cjs → chunk-YBVOQN4M.cjs} +20 -19
  33. package/dist/chunk-YWLUOY3D.cjs +2004 -0
  34. package/dist/{chunk-D3G23FP3.cjs → chunk-ZE5AAC4I.cjs} +37 -25
  35. package/dist/server/handlers/a2a.cjs +30 -0
  36. package/dist/server/handlers/a2a.d.cts +6 -0
  37. package/dist/server/handlers/a2a.d.ts +6 -0
  38. package/dist/server/handlers/a2a.js +1 -0
  39. package/dist/server/handlers/agents.cjs +7 -7
  40. package/dist/server/handlers/agents.js +1 -1
  41. package/dist/server/handlers/error.cjs +2 -2
  42. package/dist/server/handlers/error.js +1 -1
  43. package/dist/server/handlers/logs.cjs +4 -4
  44. package/dist/server/handlers/logs.js +1 -1
  45. package/dist/server/handlers/memory.cjs +9 -9
  46. package/dist/server/handlers/memory.js +1 -1
  47. package/dist/server/handlers/network.cjs +5 -5
  48. package/dist/server/handlers/network.js +1 -1
  49. package/dist/server/handlers/telemetry.cjs +3 -3
  50. package/dist/server/handlers/telemetry.js +1 -1
  51. package/dist/server/handlers/tools.cjs +5 -5
  52. package/dist/server/handlers/tools.js +1 -1
  53. package/dist/server/handlers/utils.cjs +2 -2
  54. package/dist/server/handlers/utils.js +1 -1
  55. package/dist/server/handlers/vNextWorkflows.cjs +11 -11
  56. package/dist/server/handlers/vNextWorkflows.js +1 -1
  57. package/dist/server/handlers/vector.cjs +7 -7
  58. package/dist/server/handlers/vector.js +1 -1
  59. package/dist/server/handlers/voice.cjs +4 -4
  60. package/dist/server/handlers/voice.js +1 -1
  61. package/dist/server/handlers/workflows.cjs +11 -11
  62. package/dist/server/handlers/workflows.js +1 -1
  63. package/dist/server/handlers.cjs +28 -23
  64. package/dist/server/handlers.d.cts +1 -0
  65. package/dist/server/handlers.d.ts +1 -0
  66. package/dist/server/handlers.js +11 -10
  67. package/package.json +6 -4
  68. package/dist/chunk-5SWCVTNL.cjs +0 -5579
  69. package/dist/chunk-OMN3UI6X.js +0 -5576
@@ -0,0 +1,2004 @@
1
+ 'use strict';
2
+
3
+ var zod = require('zod');
4
+
5
+ // ../../node_modules/.pnpm/superjson@2.2.2/node_modules/superjson/dist/double-indexed-kv.js
6
+ var DoubleIndexedKV = class {
7
+ constructor() {
8
+ this.keyToValue = /* @__PURE__ */ new Map();
9
+ this.valueToKey = /* @__PURE__ */ new Map();
10
+ }
11
+ set(key, value) {
12
+ this.keyToValue.set(key, value);
13
+ this.valueToKey.set(value, key);
14
+ }
15
+ getByKey(key) {
16
+ return this.keyToValue.get(key);
17
+ }
18
+ getByValue(value) {
19
+ return this.valueToKey.get(value);
20
+ }
21
+ clear() {
22
+ this.keyToValue.clear();
23
+ this.valueToKey.clear();
24
+ }
25
+ };
26
+
27
+ // ../../node_modules/.pnpm/superjson@2.2.2/node_modules/superjson/dist/registry.js
28
+ var Registry = class {
29
+ constructor(generateIdentifier) {
30
+ this.generateIdentifier = generateIdentifier;
31
+ this.kv = new DoubleIndexedKV();
32
+ }
33
+ register(value, identifier) {
34
+ if (this.kv.getByValue(value)) {
35
+ return;
36
+ }
37
+ if (!identifier) {
38
+ identifier = this.generateIdentifier(value);
39
+ }
40
+ this.kv.set(identifier, value);
41
+ }
42
+ clear() {
43
+ this.kv.clear();
44
+ }
45
+ getIdentifier(value) {
46
+ return this.kv.getByValue(value);
47
+ }
48
+ getValue(identifier) {
49
+ return this.kv.getByKey(identifier);
50
+ }
51
+ };
52
+
53
+ // ../../node_modules/.pnpm/superjson@2.2.2/node_modules/superjson/dist/class-registry.js
54
+ var ClassRegistry = class extends Registry {
55
+ constructor() {
56
+ super((c) => c.name);
57
+ this.classToAllowedProps = /* @__PURE__ */ new Map();
58
+ }
59
+ register(value, options) {
60
+ if (typeof options === "object") {
61
+ if (options.allowProps) {
62
+ this.classToAllowedProps.set(value, options.allowProps);
63
+ }
64
+ super.register(value, options.identifier);
65
+ } else {
66
+ super.register(value, options);
67
+ }
68
+ }
69
+ getAllowedProps(value) {
70
+ return this.classToAllowedProps.get(value);
71
+ }
72
+ };
73
+
74
+ // ../../node_modules/.pnpm/superjson@2.2.2/node_modules/superjson/dist/util.js
75
+ function valuesOfObj(record) {
76
+ if ("values" in Object) {
77
+ return Object.values(record);
78
+ }
79
+ const values = [];
80
+ for (const key in record) {
81
+ if (record.hasOwnProperty(key)) {
82
+ values.push(record[key]);
83
+ }
84
+ }
85
+ return values;
86
+ }
87
+ function find(record, predicate) {
88
+ const values = valuesOfObj(record);
89
+ if ("find" in values) {
90
+ return values.find(predicate);
91
+ }
92
+ const valuesNotNever = values;
93
+ for (let i = 0; i < valuesNotNever.length; i++) {
94
+ const value = valuesNotNever[i];
95
+ if (predicate(value)) {
96
+ return value;
97
+ }
98
+ }
99
+ return void 0;
100
+ }
101
+ function forEach(record, run) {
102
+ Object.entries(record).forEach(([key, value]) => run(value, key));
103
+ }
104
+ function includes(arr, value) {
105
+ return arr.indexOf(value) !== -1;
106
+ }
107
+ function findArr(record, predicate) {
108
+ for (let i = 0; i < record.length; i++) {
109
+ const value = record[i];
110
+ if (predicate(value)) {
111
+ return value;
112
+ }
113
+ }
114
+ return void 0;
115
+ }
116
+
117
+ // ../../node_modules/.pnpm/superjson@2.2.2/node_modules/superjson/dist/custom-transformer-registry.js
118
+ var CustomTransformerRegistry = class {
119
+ constructor() {
120
+ this.transfomers = {};
121
+ }
122
+ register(transformer) {
123
+ this.transfomers[transformer.name] = transformer;
124
+ }
125
+ findApplicable(v) {
126
+ return find(this.transfomers, (transformer) => transformer.isApplicable(v));
127
+ }
128
+ findByName(name) {
129
+ return this.transfomers[name];
130
+ }
131
+ };
132
+
133
+ // ../../node_modules/.pnpm/superjson@2.2.2/node_modules/superjson/dist/is.js
134
+ var getType = (payload) => Object.prototype.toString.call(payload).slice(8, -1);
135
+ var isUndefined = (payload) => typeof payload === "undefined";
136
+ var isNull = (payload) => payload === null;
137
+ var isPlainObject = (payload) => {
138
+ if (typeof payload !== "object" || payload === null)
139
+ return false;
140
+ if (payload === Object.prototype)
141
+ return false;
142
+ if (Object.getPrototypeOf(payload) === null)
143
+ return true;
144
+ return Object.getPrototypeOf(payload) === Object.prototype;
145
+ };
146
+ var isEmptyObject = (payload) => isPlainObject(payload) && Object.keys(payload).length === 0;
147
+ var isArray = (payload) => Array.isArray(payload);
148
+ var isString = (payload) => typeof payload === "string";
149
+ var isNumber = (payload) => typeof payload === "number" && !isNaN(payload);
150
+ var isBoolean = (payload) => typeof payload === "boolean";
151
+ var isRegExp = (payload) => payload instanceof RegExp;
152
+ var isMap = (payload) => payload instanceof Map;
153
+ var isSet = (payload) => payload instanceof Set;
154
+ var isSymbol = (payload) => getType(payload) === "Symbol";
155
+ var isDate = (payload) => payload instanceof Date && !isNaN(payload.valueOf());
156
+ var isError = (payload) => payload instanceof Error;
157
+ var isNaNValue = (payload) => typeof payload === "number" && isNaN(payload);
158
+ var isPrimitive = (payload) => isBoolean(payload) || isNull(payload) || isUndefined(payload) || isNumber(payload) || isString(payload) || isSymbol(payload);
159
+ var isBigint = (payload) => typeof payload === "bigint";
160
+ var isInfinite = (payload) => payload === Infinity || payload === -Infinity;
161
+ var isTypedArray = (payload) => ArrayBuffer.isView(payload) && !(payload instanceof DataView);
162
+ var isURL = (payload) => payload instanceof URL;
163
+
164
+ // ../../node_modules/.pnpm/superjson@2.2.2/node_modules/superjson/dist/pathstringifier.js
165
+ var escapeKey = (key) => key.replace(/\./g, "\\.");
166
+ var stringifyPath = (path) => path.map(String).map(escapeKey).join(".");
167
+ var parsePath = (string) => {
168
+ const result = [];
169
+ let segment = "";
170
+ for (let i = 0; i < string.length; i++) {
171
+ let char = string.charAt(i);
172
+ const isEscapedDot = char === "\\" && string.charAt(i + 1) === ".";
173
+ if (isEscapedDot) {
174
+ segment += ".";
175
+ i++;
176
+ continue;
177
+ }
178
+ const isEndOfSegment = char === ".";
179
+ if (isEndOfSegment) {
180
+ result.push(segment);
181
+ segment = "";
182
+ continue;
183
+ }
184
+ segment += char;
185
+ }
186
+ const lastSegment = segment;
187
+ result.push(lastSegment);
188
+ return result;
189
+ };
190
+
191
+ // ../../node_modules/.pnpm/superjson@2.2.2/node_modules/superjson/dist/transformer.js
192
+ function simpleTransformation(isApplicable, annotation, transform, untransform) {
193
+ return {
194
+ isApplicable,
195
+ annotation,
196
+ transform,
197
+ untransform
198
+ };
199
+ }
200
+ var simpleRules = [
201
+ simpleTransformation(isUndefined, "undefined", () => null, () => void 0),
202
+ simpleTransformation(isBigint, "bigint", (v) => v.toString(), (v) => {
203
+ if (typeof BigInt !== "undefined") {
204
+ return BigInt(v);
205
+ }
206
+ console.error("Please add a BigInt polyfill.");
207
+ return v;
208
+ }),
209
+ simpleTransformation(isDate, "Date", (v) => v.toISOString(), (v) => new Date(v)),
210
+ simpleTransformation(isError, "Error", (v, superJson) => {
211
+ const baseError = {
212
+ name: v.name,
213
+ message: v.message
214
+ };
215
+ superJson.allowedErrorProps.forEach((prop) => {
216
+ baseError[prop] = v[prop];
217
+ });
218
+ return baseError;
219
+ }, (v, superJson) => {
220
+ const e = new Error(v.message);
221
+ e.name = v.name;
222
+ e.stack = v.stack;
223
+ superJson.allowedErrorProps.forEach((prop) => {
224
+ e[prop] = v[prop];
225
+ });
226
+ return e;
227
+ }),
228
+ simpleTransformation(isRegExp, "regexp", (v) => "" + v, (regex) => {
229
+ const body = regex.slice(1, regex.lastIndexOf("/"));
230
+ const flags = regex.slice(regex.lastIndexOf("/") + 1);
231
+ return new RegExp(body, flags);
232
+ }),
233
+ simpleTransformation(
234
+ isSet,
235
+ "set",
236
+ // (sets only exist in es6+)
237
+ // eslint-disable-next-line es5/no-es6-methods
238
+ (v) => [...v.values()],
239
+ (v) => new Set(v)
240
+ ),
241
+ simpleTransformation(isMap, "map", (v) => [...v.entries()], (v) => new Map(v)),
242
+ simpleTransformation((v) => isNaNValue(v) || isInfinite(v), "number", (v) => {
243
+ if (isNaNValue(v)) {
244
+ return "NaN";
245
+ }
246
+ if (v > 0) {
247
+ return "Infinity";
248
+ } else {
249
+ return "-Infinity";
250
+ }
251
+ }, Number),
252
+ simpleTransformation((v) => v === 0 && 1 / v === -Infinity, "number", () => {
253
+ return "-0";
254
+ }, Number),
255
+ simpleTransformation(isURL, "URL", (v) => v.toString(), (v) => new URL(v))
256
+ ];
257
+ function compositeTransformation(isApplicable, annotation, transform, untransform) {
258
+ return {
259
+ isApplicable,
260
+ annotation,
261
+ transform,
262
+ untransform
263
+ };
264
+ }
265
+ var symbolRule = compositeTransformation((s, superJson) => {
266
+ if (isSymbol(s)) {
267
+ const isRegistered = !!superJson.symbolRegistry.getIdentifier(s);
268
+ return isRegistered;
269
+ }
270
+ return false;
271
+ }, (s, superJson) => {
272
+ const identifier = superJson.symbolRegistry.getIdentifier(s);
273
+ return ["symbol", identifier];
274
+ }, (v) => v.description, (_, a, superJson) => {
275
+ const value = superJson.symbolRegistry.getValue(a[1]);
276
+ if (!value) {
277
+ throw new Error("Trying to deserialize unknown symbol");
278
+ }
279
+ return value;
280
+ });
281
+ var constructorToName = [
282
+ Int8Array,
283
+ Uint8Array,
284
+ Int16Array,
285
+ Uint16Array,
286
+ Int32Array,
287
+ Uint32Array,
288
+ Float32Array,
289
+ Float64Array,
290
+ Uint8ClampedArray
291
+ ].reduce((obj, ctor) => {
292
+ obj[ctor.name] = ctor;
293
+ return obj;
294
+ }, {});
295
+ var typedArrayRule = compositeTransformation(isTypedArray, (v) => ["typed-array", v.constructor.name], (v) => [...v], (v, a) => {
296
+ const ctor = constructorToName[a[1]];
297
+ if (!ctor) {
298
+ throw new Error("Trying to deserialize unknown typed array");
299
+ }
300
+ return new ctor(v);
301
+ });
302
+ function isInstanceOfRegisteredClass(potentialClass, superJson) {
303
+ if (potentialClass?.constructor) {
304
+ const isRegistered = !!superJson.classRegistry.getIdentifier(potentialClass.constructor);
305
+ return isRegistered;
306
+ }
307
+ return false;
308
+ }
309
+ var classRule = compositeTransformation(isInstanceOfRegisteredClass, (clazz, superJson) => {
310
+ const identifier = superJson.classRegistry.getIdentifier(clazz.constructor);
311
+ return ["class", identifier];
312
+ }, (clazz, superJson) => {
313
+ const allowedProps = superJson.classRegistry.getAllowedProps(clazz.constructor);
314
+ if (!allowedProps) {
315
+ return { ...clazz };
316
+ }
317
+ const result = {};
318
+ allowedProps.forEach((prop) => {
319
+ result[prop] = clazz[prop];
320
+ });
321
+ return result;
322
+ }, (v, a, superJson) => {
323
+ const clazz = superJson.classRegistry.getValue(a[1]);
324
+ if (!clazz) {
325
+ throw new Error(`Trying to deserialize unknown class '${a[1]}' - check https://github.com/blitz-js/superjson/issues/116#issuecomment-773996564`);
326
+ }
327
+ return Object.assign(Object.create(clazz.prototype), v);
328
+ });
329
+ var customRule = compositeTransformation((value, superJson) => {
330
+ return !!superJson.customTransformerRegistry.findApplicable(value);
331
+ }, (value, superJson) => {
332
+ const transformer = superJson.customTransformerRegistry.findApplicable(value);
333
+ return ["custom", transformer.name];
334
+ }, (value, superJson) => {
335
+ const transformer = superJson.customTransformerRegistry.findApplicable(value);
336
+ return transformer.serialize(value);
337
+ }, (v, a, superJson) => {
338
+ const transformer = superJson.customTransformerRegistry.findByName(a[1]);
339
+ if (!transformer) {
340
+ throw new Error("Trying to deserialize unknown custom value");
341
+ }
342
+ return transformer.deserialize(v);
343
+ });
344
+ var compositeRules = [classRule, symbolRule, customRule, typedArrayRule];
345
+ var transformValue = (value, superJson) => {
346
+ const applicableCompositeRule = findArr(compositeRules, (rule) => rule.isApplicable(value, superJson));
347
+ if (applicableCompositeRule) {
348
+ return {
349
+ value: applicableCompositeRule.transform(value, superJson),
350
+ type: applicableCompositeRule.annotation(value, superJson)
351
+ };
352
+ }
353
+ const applicableSimpleRule = findArr(simpleRules, (rule) => rule.isApplicable(value, superJson));
354
+ if (applicableSimpleRule) {
355
+ return {
356
+ value: applicableSimpleRule.transform(value, superJson),
357
+ type: applicableSimpleRule.annotation
358
+ };
359
+ }
360
+ return void 0;
361
+ };
362
+ var simpleRulesByAnnotation = {};
363
+ simpleRules.forEach((rule) => {
364
+ simpleRulesByAnnotation[rule.annotation] = rule;
365
+ });
366
+ var untransformValue = (json, type, superJson) => {
367
+ if (isArray(type)) {
368
+ switch (type[0]) {
369
+ case "symbol":
370
+ return symbolRule.untransform(json, type, superJson);
371
+ case "class":
372
+ return classRule.untransform(json, type, superJson);
373
+ case "custom":
374
+ return customRule.untransform(json, type, superJson);
375
+ case "typed-array":
376
+ return typedArrayRule.untransform(json, type, superJson);
377
+ default:
378
+ throw new Error("Unknown transformation: " + type);
379
+ }
380
+ } else {
381
+ const transformation = simpleRulesByAnnotation[type];
382
+ if (!transformation) {
383
+ throw new Error("Unknown transformation: " + type);
384
+ }
385
+ return transformation.untransform(json, superJson);
386
+ }
387
+ };
388
+
389
+ // ../../node_modules/.pnpm/superjson@2.2.2/node_modules/superjson/dist/accessDeep.js
390
+ var getNthKey = (value, n) => {
391
+ if (n > value.size)
392
+ throw new Error("index out of bounds");
393
+ const keys = value.keys();
394
+ while (n > 0) {
395
+ keys.next();
396
+ n--;
397
+ }
398
+ return keys.next().value;
399
+ };
400
+ function validatePath(path) {
401
+ if (includes(path, "__proto__")) {
402
+ throw new Error("__proto__ is not allowed as a property");
403
+ }
404
+ if (includes(path, "prototype")) {
405
+ throw new Error("prototype is not allowed as a property");
406
+ }
407
+ if (includes(path, "constructor")) {
408
+ throw new Error("constructor is not allowed as a property");
409
+ }
410
+ }
411
+ var getDeep = (object, path) => {
412
+ validatePath(path);
413
+ for (let i = 0; i < path.length; i++) {
414
+ const key = path[i];
415
+ if (isSet(object)) {
416
+ object = getNthKey(object, +key);
417
+ } else if (isMap(object)) {
418
+ const row = +key;
419
+ const type = +path[++i] === 0 ? "key" : "value";
420
+ const keyOfRow = getNthKey(object, row);
421
+ switch (type) {
422
+ case "key":
423
+ object = keyOfRow;
424
+ break;
425
+ case "value":
426
+ object = object.get(keyOfRow);
427
+ break;
428
+ }
429
+ } else {
430
+ object = object[key];
431
+ }
432
+ }
433
+ return object;
434
+ };
435
+ var setDeep = (object, path, mapper) => {
436
+ validatePath(path);
437
+ if (path.length === 0) {
438
+ return mapper(object);
439
+ }
440
+ let parent = object;
441
+ for (let i = 0; i < path.length - 1; i++) {
442
+ const key = path[i];
443
+ if (isArray(parent)) {
444
+ const index = +key;
445
+ parent = parent[index];
446
+ } else if (isPlainObject(parent)) {
447
+ parent = parent[key];
448
+ } else if (isSet(parent)) {
449
+ const row = +key;
450
+ parent = getNthKey(parent, row);
451
+ } else if (isMap(parent)) {
452
+ const isEnd = i === path.length - 2;
453
+ if (isEnd) {
454
+ break;
455
+ }
456
+ const row = +key;
457
+ const type = +path[++i] === 0 ? "key" : "value";
458
+ const keyOfRow = getNthKey(parent, row);
459
+ switch (type) {
460
+ case "key":
461
+ parent = keyOfRow;
462
+ break;
463
+ case "value":
464
+ parent = parent.get(keyOfRow);
465
+ break;
466
+ }
467
+ }
468
+ }
469
+ const lastKey = path[path.length - 1];
470
+ if (isArray(parent)) {
471
+ parent[+lastKey] = mapper(parent[+lastKey]);
472
+ } else if (isPlainObject(parent)) {
473
+ parent[lastKey] = mapper(parent[lastKey]);
474
+ }
475
+ if (isSet(parent)) {
476
+ const oldValue = getNthKey(parent, +lastKey);
477
+ const newValue = mapper(oldValue);
478
+ if (oldValue !== newValue) {
479
+ parent.delete(oldValue);
480
+ parent.add(newValue);
481
+ }
482
+ }
483
+ if (isMap(parent)) {
484
+ const row = +path[path.length - 2];
485
+ const keyToRow = getNthKey(parent, row);
486
+ const type = +lastKey === 0 ? "key" : "value";
487
+ switch (type) {
488
+ case "key": {
489
+ const newKey = mapper(keyToRow);
490
+ parent.set(newKey, parent.get(keyToRow));
491
+ if (newKey !== keyToRow) {
492
+ parent.delete(keyToRow);
493
+ }
494
+ break;
495
+ }
496
+ case "value": {
497
+ parent.set(keyToRow, mapper(parent.get(keyToRow)));
498
+ break;
499
+ }
500
+ }
501
+ }
502
+ return object;
503
+ };
504
+
505
+ // ../../node_modules/.pnpm/superjson@2.2.2/node_modules/superjson/dist/plainer.js
506
+ function traverse(tree, walker2, origin = []) {
507
+ if (!tree) {
508
+ return;
509
+ }
510
+ if (!isArray(tree)) {
511
+ forEach(tree, (subtree, key) => traverse(subtree, walker2, [...origin, ...parsePath(key)]));
512
+ return;
513
+ }
514
+ const [nodeValue, children] = tree;
515
+ if (children) {
516
+ forEach(children, (child, key) => {
517
+ traverse(child, walker2, [...origin, ...parsePath(key)]);
518
+ });
519
+ }
520
+ walker2(nodeValue, origin);
521
+ }
522
+ function applyValueAnnotations(plain, annotations, superJson) {
523
+ traverse(annotations, (type, path) => {
524
+ plain = setDeep(plain, path, (v) => untransformValue(v, type, superJson));
525
+ });
526
+ return plain;
527
+ }
528
+ function applyReferentialEqualityAnnotations(plain, annotations) {
529
+ function apply(identicalPaths, path) {
530
+ const object = getDeep(plain, parsePath(path));
531
+ identicalPaths.map(parsePath).forEach((identicalObjectPath) => {
532
+ plain = setDeep(plain, identicalObjectPath, () => object);
533
+ });
534
+ }
535
+ if (isArray(annotations)) {
536
+ const [root, other] = annotations;
537
+ root.forEach((identicalPath) => {
538
+ plain = setDeep(plain, parsePath(identicalPath), () => plain);
539
+ });
540
+ if (other) {
541
+ forEach(other, apply);
542
+ }
543
+ } else {
544
+ forEach(annotations, apply);
545
+ }
546
+ return plain;
547
+ }
548
+ var isDeep = (object, superJson) => isPlainObject(object) || isArray(object) || isMap(object) || isSet(object) || isInstanceOfRegisteredClass(object, superJson);
549
+ function addIdentity(object, path, identities) {
550
+ const existingSet = identities.get(object);
551
+ if (existingSet) {
552
+ existingSet.push(path);
553
+ } else {
554
+ identities.set(object, [path]);
555
+ }
556
+ }
557
+ function generateReferentialEqualityAnnotations(identitites, dedupe) {
558
+ const result = {};
559
+ let rootEqualityPaths = void 0;
560
+ identitites.forEach((paths) => {
561
+ if (paths.length <= 1) {
562
+ return;
563
+ }
564
+ if (!dedupe) {
565
+ paths = paths.map((path) => path.map(String)).sort((a, b) => a.length - b.length);
566
+ }
567
+ const [representativePath, ...identicalPaths] = paths;
568
+ if (representativePath.length === 0) {
569
+ rootEqualityPaths = identicalPaths.map(stringifyPath);
570
+ } else {
571
+ result[stringifyPath(representativePath)] = identicalPaths.map(stringifyPath);
572
+ }
573
+ });
574
+ if (rootEqualityPaths) {
575
+ if (isEmptyObject(result)) {
576
+ return [rootEqualityPaths];
577
+ } else {
578
+ return [rootEqualityPaths, result];
579
+ }
580
+ } else {
581
+ return isEmptyObject(result) ? void 0 : result;
582
+ }
583
+ }
584
+ var walker = (object, identities, superJson, dedupe, path = [], objectsInThisPath = [], seenObjects = /* @__PURE__ */ new Map()) => {
585
+ const primitive = isPrimitive(object);
586
+ if (!primitive) {
587
+ addIdentity(object, path, identities);
588
+ const seen = seenObjects.get(object);
589
+ if (seen) {
590
+ return dedupe ? {
591
+ transformedValue: null
592
+ } : seen;
593
+ }
594
+ }
595
+ if (!isDeep(object, superJson)) {
596
+ const transformed2 = transformValue(object, superJson);
597
+ const result2 = transformed2 ? {
598
+ transformedValue: transformed2.value,
599
+ annotations: [transformed2.type]
600
+ } : {
601
+ transformedValue: object
602
+ };
603
+ if (!primitive) {
604
+ seenObjects.set(object, result2);
605
+ }
606
+ return result2;
607
+ }
608
+ if (includes(objectsInThisPath, object)) {
609
+ return {
610
+ transformedValue: null
611
+ };
612
+ }
613
+ const transformationResult = transformValue(object, superJson);
614
+ const transformed = transformationResult?.value ?? object;
615
+ const transformedValue = isArray(transformed) ? [] : {};
616
+ const innerAnnotations = {};
617
+ forEach(transformed, (value, index) => {
618
+ if (index === "__proto__" || index === "constructor" || index === "prototype") {
619
+ throw new Error(`Detected property ${index}. This is a prototype pollution risk, please remove it from your object.`);
620
+ }
621
+ const recursiveResult = walker(value, identities, superJson, dedupe, [...path, index], [...objectsInThisPath, object], seenObjects);
622
+ transformedValue[index] = recursiveResult.transformedValue;
623
+ if (isArray(recursiveResult.annotations)) {
624
+ innerAnnotations[index] = recursiveResult.annotations;
625
+ } else if (isPlainObject(recursiveResult.annotations)) {
626
+ forEach(recursiveResult.annotations, (tree, key) => {
627
+ innerAnnotations[escapeKey(index) + "." + key] = tree;
628
+ });
629
+ }
630
+ });
631
+ const result = isEmptyObject(innerAnnotations) ? {
632
+ transformedValue,
633
+ annotations: !!transformationResult ? [transformationResult.type] : void 0
634
+ } : {
635
+ transformedValue,
636
+ annotations: !!transformationResult ? [transformationResult.type, innerAnnotations] : innerAnnotations
637
+ };
638
+ if (!primitive) {
639
+ seenObjects.set(object, result);
640
+ }
641
+ return result;
642
+ };
643
+
644
+ // ../../node_modules/.pnpm/is-what@4.1.16/node_modules/is-what/dist/index.js
645
+ function getType2(payload) {
646
+ return Object.prototype.toString.call(payload).slice(8, -1);
647
+ }
648
+ function isArray2(payload) {
649
+ return getType2(payload) === "Array";
650
+ }
651
+ function isPlainObject2(payload) {
652
+ if (getType2(payload) !== "Object")
653
+ return false;
654
+ const prototype = Object.getPrototypeOf(payload);
655
+ return !!prototype && prototype.constructor === Object && prototype === Object.prototype;
656
+ }
657
+
658
+ // ../../node_modules/.pnpm/copy-anything@3.0.5/node_modules/copy-anything/dist/index.js
659
+ function assignProp(carry, key, newVal, originalObject, includeNonenumerable) {
660
+ const propType = {}.propertyIsEnumerable.call(originalObject, key) ? "enumerable" : "nonenumerable";
661
+ if (propType === "enumerable")
662
+ carry[key] = newVal;
663
+ if (includeNonenumerable && propType === "nonenumerable") {
664
+ Object.defineProperty(carry, key, {
665
+ value: newVal,
666
+ enumerable: false,
667
+ writable: true,
668
+ configurable: true
669
+ });
670
+ }
671
+ }
672
+ function copy(target, options = {}) {
673
+ if (isArray2(target)) {
674
+ return target.map((item) => copy(item, options));
675
+ }
676
+ if (!isPlainObject2(target)) {
677
+ return target;
678
+ }
679
+ const props = Object.getOwnPropertyNames(target);
680
+ const symbols = Object.getOwnPropertySymbols(target);
681
+ return [...props, ...symbols].reduce((carry, key) => {
682
+ if (isArray2(options.props) && !options.props.includes(key)) {
683
+ return carry;
684
+ }
685
+ const val = target[key];
686
+ const newVal = copy(val, options);
687
+ assignProp(carry, key, newVal, target, options.nonenumerable);
688
+ return carry;
689
+ }, {});
690
+ }
691
+
692
+ // ../../node_modules/.pnpm/superjson@2.2.2/node_modules/superjson/dist/index.js
693
+ var SuperJSON = class {
694
+ /**
695
+ * @param dedupeReferentialEqualities If true, SuperJSON will make sure only one instance of referentially equal objects are serialized and the rest are replaced with `null`.
696
+ */
697
+ constructor({ dedupe = false } = {}) {
698
+ this.classRegistry = new ClassRegistry();
699
+ this.symbolRegistry = new Registry((s) => s.description ?? "");
700
+ this.customTransformerRegistry = new CustomTransformerRegistry();
701
+ this.allowedErrorProps = [];
702
+ this.dedupe = dedupe;
703
+ }
704
+ serialize(object) {
705
+ const identities = /* @__PURE__ */ new Map();
706
+ const output = walker(object, identities, this, this.dedupe);
707
+ const res = {
708
+ json: output.transformedValue
709
+ };
710
+ if (output.annotations) {
711
+ res.meta = {
712
+ ...res.meta,
713
+ values: output.annotations
714
+ };
715
+ }
716
+ const equalityAnnotations = generateReferentialEqualityAnnotations(identities, this.dedupe);
717
+ if (equalityAnnotations) {
718
+ res.meta = {
719
+ ...res.meta,
720
+ referentialEqualities: equalityAnnotations
721
+ };
722
+ }
723
+ return res;
724
+ }
725
+ deserialize(payload) {
726
+ const { json, meta } = payload;
727
+ let result = copy(json);
728
+ if (meta?.values) {
729
+ result = applyValueAnnotations(result, meta.values, this);
730
+ }
731
+ if (meta?.referentialEqualities) {
732
+ result = applyReferentialEqualityAnnotations(result, meta.referentialEqualities);
733
+ }
734
+ return result;
735
+ }
736
+ stringify(object) {
737
+ return JSON.stringify(this.serialize(object));
738
+ }
739
+ parse(string) {
740
+ return this.deserialize(JSON.parse(string));
741
+ }
742
+ registerClass(v, options) {
743
+ this.classRegistry.register(v, options);
744
+ }
745
+ registerSymbol(v, identifier) {
746
+ this.symbolRegistry.register(v, identifier);
747
+ }
748
+ registerCustom(transformer, name) {
749
+ this.customTransformerRegistry.register({
750
+ name,
751
+ ...transformer
752
+ });
753
+ }
754
+ allowErrorProps(...props) {
755
+ this.allowedErrorProps.push(...props);
756
+ }
757
+ };
758
+ SuperJSON.defaultInstance = new SuperJSON();
759
+ SuperJSON.serialize = SuperJSON.defaultInstance.serialize.bind(SuperJSON.defaultInstance);
760
+ SuperJSON.deserialize = SuperJSON.defaultInstance.deserialize.bind(SuperJSON.defaultInstance);
761
+ SuperJSON.stringify = SuperJSON.defaultInstance.stringify.bind(SuperJSON.defaultInstance);
762
+ SuperJSON.parse = SuperJSON.defaultInstance.parse.bind(SuperJSON.defaultInstance);
763
+ SuperJSON.registerClass = SuperJSON.defaultInstance.registerClass.bind(SuperJSON.defaultInstance);
764
+ SuperJSON.registerSymbol = SuperJSON.defaultInstance.registerSymbol.bind(SuperJSON.defaultInstance);
765
+ SuperJSON.registerCustom = SuperJSON.defaultInstance.registerCustom.bind(SuperJSON.defaultInstance);
766
+ SuperJSON.allowErrorProps = SuperJSON.defaultInstance.allowErrorProps.bind(SuperJSON.defaultInstance);
767
+ var stringify = SuperJSON.stringify;
768
+
769
+ // ../../node_modules/.pnpm/zod-to-json-schema@3.24.5_zod@3.24.4/node_modules/zod-to-json-schema/dist/esm/Options.js
770
+ var ignoreOverride = Symbol("Let zodToJsonSchema decide on which parser to use");
771
+ var defaultOptions = {
772
+ name: void 0,
773
+ $refStrategy: "root",
774
+ basePath: ["#"],
775
+ effectStrategy: "input",
776
+ pipeStrategy: "all",
777
+ dateStrategy: "format:date-time",
778
+ mapStrategy: "entries",
779
+ removeAdditionalStrategy: "passthrough",
780
+ allowedAdditionalProperties: true,
781
+ rejectedAdditionalProperties: false,
782
+ definitionPath: "definitions",
783
+ target: "jsonSchema7",
784
+ strictUnions: false,
785
+ definitions: {},
786
+ errorMessages: false,
787
+ markdownDescription: false,
788
+ patternStrategy: "escape",
789
+ applyRegexFlags: false,
790
+ emailStrategy: "format:email",
791
+ base64Strategy: "contentEncoding:base64",
792
+ nameStrategy: "ref"
793
+ };
794
+ var getDefaultOptions = (options) => typeof options === "string" ? {
795
+ ...defaultOptions,
796
+ name: options
797
+ } : {
798
+ ...defaultOptions,
799
+ ...options
800
+ };
801
+
802
+ // ../../node_modules/.pnpm/zod-to-json-schema@3.24.5_zod@3.24.4/node_modules/zod-to-json-schema/dist/esm/Refs.js
803
+ var getRefs = (options) => {
804
+ const _options = getDefaultOptions(options);
805
+ const currentPath = _options.name !== void 0 ? [..._options.basePath, _options.definitionPath, _options.name] : _options.basePath;
806
+ return {
807
+ ..._options,
808
+ currentPath,
809
+ propertyPath: void 0,
810
+ seen: new Map(Object.entries(_options.definitions).map(([name, def]) => [
811
+ def._def,
812
+ {
813
+ def: def._def,
814
+ path: [..._options.basePath, _options.definitionPath, name],
815
+ // Resolution of references will be forced even though seen, so it's ok that the schema is undefined here for now.
816
+ jsonSchema: void 0
817
+ }
818
+ ]))
819
+ };
820
+ };
821
+
822
+ // ../../node_modules/.pnpm/zod-to-json-schema@3.24.5_zod@3.24.4/node_modules/zod-to-json-schema/dist/esm/errorMessages.js
823
+ function addErrorMessage(res, key, errorMessage, refs) {
824
+ if (!refs?.errorMessages)
825
+ return;
826
+ if (errorMessage) {
827
+ res.errorMessage = {
828
+ ...res.errorMessage,
829
+ [key]: errorMessage
830
+ };
831
+ }
832
+ }
833
+ function setResponseValueAndErrors(res, key, value, errorMessage, refs) {
834
+ res[key] = value;
835
+ addErrorMessage(res, key, errorMessage, refs);
836
+ }
837
+
838
+ // ../../node_modules/.pnpm/zod-to-json-schema@3.24.5_zod@3.24.4/node_modules/zod-to-json-schema/dist/esm/parsers/any.js
839
+ function parseAnyDef() {
840
+ return {};
841
+ }
842
+ function parseArrayDef(def, refs) {
843
+ const res = {
844
+ type: "array"
845
+ };
846
+ if (def.type?._def && def.type?._def?.typeName !== zod.ZodFirstPartyTypeKind.ZodAny) {
847
+ res.items = parseDef(def.type._def, {
848
+ ...refs,
849
+ currentPath: [...refs.currentPath, "items"]
850
+ });
851
+ }
852
+ if (def.minLength) {
853
+ setResponseValueAndErrors(res, "minItems", def.minLength.value, def.minLength.message, refs);
854
+ }
855
+ if (def.maxLength) {
856
+ setResponseValueAndErrors(res, "maxItems", def.maxLength.value, def.maxLength.message, refs);
857
+ }
858
+ if (def.exactLength) {
859
+ setResponseValueAndErrors(res, "minItems", def.exactLength.value, def.exactLength.message, refs);
860
+ setResponseValueAndErrors(res, "maxItems", def.exactLength.value, def.exactLength.message, refs);
861
+ }
862
+ return res;
863
+ }
864
+
865
+ // ../../node_modules/.pnpm/zod-to-json-schema@3.24.5_zod@3.24.4/node_modules/zod-to-json-schema/dist/esm/parsers/bigint.js
866
+ function parseBigintDef(def, refs) {
867
+ const res = {
868
+ type: "integer",
869
+ format: "int64"
870
+ };
871
+ if (!def.checks)
872
+ return res;
873
+ for (const check of def.checks) {
874
+ switch (check.kind) {
875
+ case "min":
876
+ if (refs.target === "jsonSchema7") {
877
+ if (check.inclusive) {
878
+ setResponseValueAndErrors(res, "minimum", check.value, check.message, refs);
879
+ } else {
880
+ setResponseValueAndErrors(res, "exclusiveMinimum", check.value, check.message, refs);
881
+ }
882
+ } else {
883
+ if (!check.inclusive) {
884
+ res.exclusiveMinimum = true;
885
+ }
886
+ setResponseValueAndErrors(res, "minimum", check.value, check.message, refs);
887
+ }
888
+ break;
889
+ case "max":
890
+ if (refs.target === "jsonSchema7") {
891
+ if (check.inclusive) {
892
+ setResponseValueAndErrors(res, "maximum", check.value, check.message, refs);
893
+ } else {
894
+ setResponseValueAndErrors(res, "exclusiveMaximum", check.value, check.message, refs);
895
+ }
896
+ } else {
897
+ if (!check.inclusive) {
898
+ res.exclusiveMaximum = true;
899
+ }
900
+ setResponseValueAndErrors(res, "maximum", check.value, check.message, refs);
901
+ }
902
+ break;
903
+ case "multipleOf":
904
+ setResponseValueAndErrors(res, "multipleOf", check.value, check.message, refs);
905
+ break;
906
+ }
907
+ }
908
+ return res;
909
+ }
910
+
911
+ // ../../node_modules/.pnpm/zod-to-json-schema@3.24.5_zod@3.24.4/node_modules/zod-to-json-schema/dist/esm/parsers/boolean.js
912
+ function parseBooleanDef() {
913
+ return {
914
+ type: "boolean"
915
+ };
916
+ }
917
+
918
+ // ../../node_modules/.pnpm/zod-to-json-schema@3.24.5_zod@3.24.4/node_modules/zod-to-json-schema/dist/esm/parsers/branded.js
919
+ function parseBrandedDef(_def, refs) {
920
+ return parseDef(_def.type._def, refs);
921
+ }
922
+
923
+ // ../../node_modules/.pnpm/zod-to-json-schema@3.24.5_zod@3.24.4/node_modules/zod-to-json-schema/dist/esm/parsers/catch.js
924
+ var parseCatchDef = (def, refs) => {
925
+ return parseDef(def.innerType._def, refs);
926
+ };
927
+
928
+ // ../../node_modules/.pnpm/zod-to-json-schema@3.24.5_zod@3.24.4/node_modules/zod-to-json-schema/dist/esm/parsers/date.js
929
+ function parseDateDef(def, refs, overrideDateStrategy) {
930
+ const strategy = overrideDateStrategy ?? refs.dateStrategy;
931
+ if (Array.isArray(strategy)) {
932
+ return {
933
+ anyOf: strategy.map((item, i) => parseDateDef(def, refs, item))
934
+ };
935
+ }
936
+ switch (strategy) {
937
+ case "string":
938
+ case "format:date-time":
939
+ return {
940
+ type: "string",
941
+ format: "date-time"
942
+ };
943
+ case "format:date":
944
+ return {
945
+ type: "string",
946
+ format: "date"
947
+ };
948
+ case "integer":
949
+ return integerDateParser(def, refs);
950
+ }
951
+ }
952
+ var integerDateParser = (def, refs) => {
953
+ const res = {
954
+ type: "integer",
955
+ format: "unix-time"
956
+ };
957
+ if (refs.target === "openApi3") {
958
+ return res;
959
+ }
960
+ for (const check of def.checks) {
961
+ switch (check.kind) {
962
+ case "min":
963
+ setResponseValueAndErrors(
964
+ res,
965
+ "minimum",
966
+ check.value,
967
+ // This is in milliseconds
968
+ check.message,
969
+ refs
970
+ );
971
+ break;
972
+ case "max":
973
+ setResponseValueAndErrors(
974
+ res,
975
+ "maximum",
976
+ check.value,
977
+ // This is in milliseconds
978
+ check.message,
979
+ refs
980
+ );
981
+ break;
982
+ }
983
+ }
984
+ return res;
985
+ };
986
+
987
+ // ../../node_modules/.pnpm/zod-to-json-schema@3.24.5_zod@3.24.4/node_modules/zod-to-json-schema/dist/esm/parsers/default.js
988
+ function parseDefaultDef(_def, refs) {
989
+ return {
990
+ ...parseDef(_def.innerType._def, refs),
991
+ default: _def.defaultValue()
992
+ };
993
+ }
994
+
995
+ // ../../node_modules/.pnpm/zod-to-json-schema@3.24.5_zod@3.24.4/node_modules/zod-to-json-schema/dist/esm/parsers/effects.js
996
+ function parseEffectsDef(_def, refs) {
997
+ return refs.effectStrategy === "input" ? parseDef(_def.schema._def, refs) : {};
998
+ }
999
+
1000
+ // ../../node_modules/.pnpm/zod-to-json-schema@3.24.5_zod@3.24.4/node_modules/zod-to-json-schema/dist/esm/parsers/enum.js
1001
+ function parseEnumDef(def) {
1002
+ return {
1003
+ type: "string",
1004
+ enum: Array.from(def.values)
1005
+ };
1006
+ }
1007
+
1008
+ // ../../node_modules/.pnpm/zod-to-json-schema@3.24.5_zod@3.24.4/node_modules/zod-to-json-schema/dist/esm/parsers/intersection.js
1009
+ var isJsonSchema7AllOfType = (type) => {
1010
+ if ("type" in type && type.type === "string")
1011
+ return false;
1012
+ return "allOf" in type;
1013
+ };
1014
+ function parseIntersectionDef(def, refs) {
1015
+ const allOf = [
1016
+ parseDef(def.left._def, {
1017
+ ...refs,
1018
+ currentPath: [...refs.currentPath, "allOf", "0"]
1019
+ }),
1020
+ parseDef(def.right._def, {
1021
+ ...refs,
1022
+ currentPath: [...refs.currentPath, "allOf", "1"]
1023
+ })
1024
+ ].filter((x) => !!x);
1025
+ let unevaluatedProperties = refs.target === "jsonSchema2019-09" ? { unevaluatedProperties: false } : void 0;
1026
+ const mergedAllOf = [];
1027
+ allOf.forEach((schema) => {
1028
+ if (isJsonSchema7AllOfType(schema)) {
1029
+ mergedAllOf.push(...schema.allOf);
1030
+ if (schema.unevaluatedProperties === void 0) {
1031
+ unevaluatedProperties = void 0;
1032
+ }
1033
+ } else {
1034
+ let nestedSchema = schema;
1035
+ if ("additionalProperties" in schema && schema.additionalProperties === false) {
1036
+ const { additionalProperties, ...rest } = schema;
1037
+ nestedSchema = rest;
1038
+ } else {
1039
+ unevaluatedProperties = void 0;
1040
+ }
1041
+ mergedAllOf.push(nestedSchema);
1042
+ }
1043
+ });
1044
+ return mergedAllOf.length ? {
1045
+ allOf: mergedAllOf,
1046
+ ...unevaluatedProperties
1047
+ } : void 0;
1048
+ }
1049
+
1050
+ // ../../node_modules/.pnpm/zod-to-json-schema@3.24.5_zod@3.24.4/node_modules/zod-to-json-schema/dist/esm/parsers/literal.js
1051
+ function parseLiteralDef(def, refs) {
1052
+ const parsedType = typeof def.value;
1053
+ if (parsedType !== "bigint" && parsedType !== "number" && parsedType !== "boolean" && parsedType !== "string") {
1054
+ return {
1055
+ type: Array.isArray(def.value) ? "array" : "object"
1056
+ };
1057
+ }
1058
+ if (refs.target === "openApi3") {
1059
+ return {
1060
+ type: parsedType === "bigint" ? "integer" : parsedType,
1061
+ enum: [def.value]
1062
+ };
1063
+ }
1064
+ return {
1065
+ type: parsedType === "bigint" ? "integer" : parsedType,
1066
+ const: def.value
1067
+ };
1068
+ }
1069
+
1070
+ // ../../node_modules/.pnpm/zod-to-json-schema@3.24.5_zod@3.24.4/node_modules/zod-to-json-schema/dist/esm/parsers/string.js
1071
+ var emojiRegex = void 0;
1072
+ var zodPatterns = {
1073
+ /**
1074
+ * `c` was changed to `[cC]` to replicate /i flag
1075
+ */
1076
+ cuid: /^[cC][^\s-]{8,}$/,
1077
+ cuid2: /^[0-9a-z]+$/,
1078
+ ulid: /^[0-9A-HJKMNP-TV-Z]{26}$/,
1079
+ /**
1080
+ * `a-z` was added to replicate /i flag
1081
+ */
1082
+ email: /^(?!\.)(?!.*\.\.)([a-zA-Z0-9_'+\-\.]*)[a-zA-Z0-9_+-]@([a-zA-Z0-9][a-zA-Z0-9\-]*\.)+[a-zA-Z]{2,}$/,
1083
+ /**
1084
+ * Constructed a valid Unicode RegExp
1085
+ *
1086
+ * Lazily instantiate since this type of regex isn't supported
1087
+ * in all envs (e.g. React Native).
1088
+ *
1089
+ * See:
1090
+ * https://github.com/colinhacks/zod/issues/2433
1091
+ * Fix in Zod:
1092
+ * https://github.com/colinhacks/zod/commit/9340fd51e48576a75adc919bff65dbc4a5d4c99b
1093
+ */
1094
+ emoji: () => {
1095
+ if (emojiRegex === void 0) {
1096
+ emojiRegex = RegExp("^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$", "u");
1097
+ }
1098
+ return emojiRegex;
1099
+ },
1100
+ /**
1101
+ * Unused
1102
+ */
1103
+ uuid: /^[0-9a-fA-F]{8}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{12}$/,
1104
+ /**
1105
+ * Unused
1106
+ */
1107
+ ipv4: /^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])$/,
1108
+ ipv4Cidr: /^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\/(3[0-2]|[12]?[0-9])$/,
1109
+ /**
1110
+ * Unused
1111
+ */
1112
+ ipv6: /^(([a-f0-9]{1,4}:){7}|::([a-f0-9]{1,4}:){0,6}|([a-f0-9]{1,4}:){1}:([a-f0-9]{1,4}:){0,5}|([a-f0-9]{1,4}:){2}:([a-f0-9]{1,4}:){0,4}|([a-f0-9]{1,4}:){3}:([a-f0-9]{1,4}:){0,3}|([a-f0-9]{1,4}:){4}:([a-f0-9]{1,4}:){0,2}|([a-f0-9]{1,4}:){5}:([a-f0-9]{1,4}:){0,1})([a-f0-9]{1,4}|(((25[0-5])|(2[0-4][0-9])|(1[0-9]{2})|([0-9]{1,2}))\.){3}((25[0-5])|(2[0-4][0-9])|(1[0-9]{2})|([0-9]{1,2})))$/,
1113
+ ipv6Cidr: /^(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/,
1114
+ base64: /^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,
1115
+ base64url: /^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/,
1116
+ nanoid: /^[a-zA-Z0-9_-]{21}$/,
1117
+ jwt: /^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/
1118
+ };
1119
+ function parseStringDef(def, refs) {
1120
+ const res = {
1121
+ type: "string"
1122
+ };
1123
+ if (def.checks) {
1124
+ for (const check of def.checks) {
1125
+ switch (check.kind) {
1126
+ case "min":
1127
+ setResponseValueAndErrors(res, "minLength", typeof res.minLength === "number" ? Math.max(res.minLength, check.value) : check.value, check.message, refs);
1128
+ break;
1129
+ case "max":
1130
+ setResponseValueAndErrors(res, "maxLength", typeof res.maxLength === "number" ? Math.min(res.maxLength, check.value) : check.value, check.message, refs);
1131
+ break;
1132
+ case "email":
1133
+ switch (refs.emailStrategy) {
1134
+ case "format:email":
1135
+ addFormat(res, "email", check.message, refs);
1136
+ break;
1137
+ case "format:idn-email":
1138
+ addFormat(res, "idn-email", check.message, refs);
1139
+ break;
1140
+ case "pattern:zod":
1141
+ addPattern(res, zodPatterns.email, check.message, refs);
1142
+ break;
1143
+ }
1144
+ break;
1145
+ case "url":
1146
+ addFormat(res, "uri", check.message, refs);
1147
+ break;
1148
+ case "uuid":
1149
+ addFormat(res, "uuid", check.message, refs);
1150
+ break;
1151
+ case "regex":
1152
+ addPattern(res, check.regex, check.message, refs);
1153
+ break;
1154
+ case "cuid":
1155
+ addPattern(res, zodPatterns.cuid, check.message, refs);
1156
+ break;
1157
+ case "cuid2":
1158
+ addPattern(res, zodPatterns.cuid2, check.message, refs);
1159
+ break;
1160
+ case "startsWith":
1161
+ addPattern(res, RegExp(`^${escapeLiteralCheckValue(check.value, refs)}`), check.message, refs);
1162
+ break;
1163
+ case "endsWith":
1164
+ addPattern(res, RegExp(`${escapeLiteralCheckValue(check.value, refs)}$`), check.message, refs);
1165
+ break;
1166
+ case "datetime":
1167
+ addFormat(res, "date-time", check.message, refs);
1168
+ break;
1169
+ case "date":
1170
+ addFormat(res, "date", check.message, refs);
1171
+ break;
1172
+ case "time":
1173
+ addFormat(res, "time", check.message, refs);
1174
+ break;
1175
+ case "duration":
1176
+ addFormat(res, "duration", check.message, refs);
1177
+ break;
1178
+ case "length":
1179
+ setResponseValueAndErrors(res, "minLength", typeof res.minLength === "number" ? Math.max(res.minLength, check.value) : check.value, check.message, refs);
1180
+ setResponseValueAndErrors(res, "maxLength", typeof res.maxLength === "number" ? Math.min(res.maxLength, check.value) : check.value, check.message, refs);
1181
+ break;
1182
+ case "includes": {
1183
+ addPattern(res, RegExp(escapeLiteralCheckValue(check.value, refs)), check.message, refs);
1184
+ break;
1185
+ }
1186
+ case "ip": {
1187
+ if (check.version !== "v6") {
1188
+ addFormat(res, "ipv4", check.message, refs);
1189
+ }
1190
+ if (check.version !== "v4") {
1191
+ addFormat(res, "ipv6", check.message, refs);
1192
+ }
1193
+ break;
1194
+ }
1195
+ case "base64url":
1196
+ addPattern(res, zodPatterns.base64url, check.message, refs);
1197
+ break;
1198
+ case "jwt":
1199
+ addPattern(res, zodPatterns.jwt, check.message, refs);
1200
+ break;
1201
+ case "cidr": {
1202
+ if (check.version !== "v6") {
1203
+ addPattern(res, zodPatterns.ipv4Cidr, check.message, refs);
1204
+ }
1205
+ if (check.version !== "v4") {
1206
+ addPattern(res, zodPatterns.ipv6Cidr, check.message, refs);
1207
+ }
1208
+ break;
1209
+ }
1210
+ case "emoji":
1211
+ addPattern(res, zodPatterns.emoji(), check.message, refs);
1212
+ break;
1213
+ case "ulid": {
1214
+ addPattern(res, zodPatterns.ulid, check.message, refs);
1215
+ break;
1216
+ }
1217
+ case "base64": {
1218
+ switch (refs.base64Strategy) {
1219
+ case "format:binary": {
1220
+ addFormat(res, "binary", check.message, refs);
1221
+ break;
1222
+ }
1223
+ case "contentEncoding:base64": {
1224
+ setResponseValueAndErrors(res, "contentEncoding", "base64", check.message, refs);
1225
+ break;
1226
+ }
1227
+ case "pattern:zod": {
1228
+ addPattern(res, zodPatterns.base64, check.message, refs);
1229
+ break;
1230
+ }
1231
+ }
1232
+ break;
1233
+ }
1234
+ case "nanoid": {
1235
+ addPattern(res, zodPatterns.nanoid, check.message, refs);
1236
+ }
1237
+ }
1238
+ }
1239
+ }
1240
+ return res;
1241
+ }
1242
+ function escapeLiteralCheckValue(literal, refs) {
1243
+ return refs.patternStrategy === "escape" ? escapeNonAlphaNumeric(literal) : literal;
1244
+ }
1245
+ var ALPHA_NUMERIC = new Set("ABCDEFGHIJKLMNOPQRSTUVXYZabcdefghijklmnopqrstuvxyz0123456789");
1246
+ function escapeNonAlphaNumeric(source) {
1247
+ let result = "";
1248
+ for (let i = 0; i < source.length; i++) {
1249
+ if (!ALPHA_NUMERIC.has(source[i])) {
1250
+ result += "\\";
1251
+ }
1252
+ result += source[i];
1253
+ }
1254
+ return result;
1255
+ }
1256
+ function addFormat(schema, value, message, refs) {
1257
+ if (schema.format || schema.anyOf?.some((x) => x.format)) {
1258
+ if (!schema.anyOf) {
1259
+ schema.anyOf = [];
1260
+ }
1261
+ if (schema.format) {
1262
+ schema.anyOf.push({
1263
+ format: schema.format,
1264
+ ...schema.errorMessage && refs.errorMessages && {
1265
+ errorMessage: { format: schema.errorMessage.format }
1266
+ }
1267
+ });
1268
+ delete schema.format;
1269
+ if (schema.errorMessage) {
1270
+ delete schema.errorMessage.format;
1271
+ if (Object.keys(schema.errorMessage).length === 0) {
1272
+ delete schema.errorMessage;
1273
+ }
1274
+ }
1275
+ }
1276
+ schema.anyOf.push({
1277
+ format: value,
1278
+ ...message && refs.errorMessages && { errorMessage: { format: message } }
1279
+ });
1280
+ } else {
1281
+ setResponseValueAndErrors(schema, "format", value, message, refs);
1282
+ }
1283
+ }
1284
+ function addPattern(schema, regex, message, refs) {
1285
+ if (schema.pattern || schema.allOf?.some((x) => x.pattern)) {
1286
+ if (!schema.allOf) {
1287
+ schema.allOf = [];
1288
+ }
1289
+ if (schema.pattern) {
1290
+ schema.allOf.push({
1291
+ pattern: schema.pattern,
1292
+ ...schema.errorMessage && refs.errorMessages && {
1293
+ errorMessage: { pattern: schema.errorMessage.pattern }
1294
+ }
1295
+ });
1296
+ delete schema.pattern;
1297
+ if (schema.errorMessage) {
1298
+ delete schema.errorMessage.pattern;
1299
+ if (Object.keys(schema.errorMessage).length === 0) {
1300
+ delete schema.errorMessage;
1301
+ }
1302
+ }
1303
+ }
1304
+ schema.allOf.push({
1305
+ pattern: stringifyRegExpWithFlags(regex, refs),
1306
+ ...message && refs.errorMessages && { errorMessage: { pattern: message } }
1307
+ });
1308
+ } else {
1309
+ setResponseValueAndErrors(schema, "pattern", stringifyRegExpWithFlags(regex, refs), message, refs);
1310
+ }
1311
+ }
1312
+ function stringifyRegExpWithFlags(regex, refs) {
1313
+ if (!refs.applyRegexFlags || !regex.flags) {
1314
+ return regex.source;
1315
+ }
1316
+ const flags = {
1317
+ i: regex.flags.includes("i"),
1318
+ m: regex.flags.includes("m"),
1319
+ s: regex.flags.includes("s")
1320
+ // `.` matches newlines
1321
+ };
1322
+ const source = flags.i ? regex.source.toLowerCase() : regex.source;
1323
+ let pattern = "";
1324
+ let isEscaped = false;
1325
+ let inCharGroup = false;
1326
+ let inCharRange = false;
1327
+ for (let i = 0; i < source.length; i++) {
1328
+ if (isEscaped) {
1329
+ pattern += source[i];
1330
+ isEscaped = false;
1331
+ continue;
1332
+ }
1333
+ if (flags.i) {
1334
+ if (inCharGroup) {
1335
+ if (source[i].match(/[a-z]/)) {
1336
+ if (inCharRange) {
1337
+ pattern += source[i];
1338
+ pattern += `${source[i - 2]}-${source[i]}`.toUpperCase();
1339
+ inCharRange = false;
1340
+ } else if (source[i + 1] === "-" && source[i + 2]?.match(/[a-z]/)) {
1341
+ pattern += source[i];
1342
+ inCharRange = true;
1343
+ } else {
1344
+ pattern += `${source[i]}${source[i].toUpperCase()}`;
1345
+ }
1346
+ continue;
1347
+ }
1348
+ } else if (source[i].match(/[a-z]/)) {
1349
+ pattern += `[${source[i]}${source[i].toUpperCase()}]`;
1350
+ continue;
1351
+ }
1352
+ }
1353
+ if (flags.m) {
1354
+ if (source[i] === "^") {
1355
+ pattern += `(^|(?<=[\r
1356
+ ]))`;
1357
+ continue;
1358
+ } else if (source[i] === "$") {
1359
+ pattern += `($|(?=[\r
1360
+ ]))`;
1361
+ continue;
1362
+ }
1363
+ }
1364
+ if (flags.s && source[i] === ".") {
1365
+ pattern += inCharGroup ? `${source[i]}\r
1366
+ ` : `[${source[i]}\r
1367
+ ]`;
1368
+ continue;
1369
+ }
1370
+ pattern += source[i];
1371
+ if (source[i] === "\\") {
1372
+ isEscaped = true;
1373
+ } else if (inCharGroup && source[i] === "]") {
1374
+ inCharGroup = false;
1375
+ } else if (!inCharGroup && source[i] === "[") {
1376
+ inCharGroup = true;
1377
+ }
1378
+ }
1379
+ return pattern;
1380
+ }
1381
+
1382
+ // ../../node_modules/.pnpm/zod-to-json-schema@3.24.5_zod@3.24.4/node_modules/zod-to-json-schema/dist/esm/parsers/record.js
1383
+ function parseRecordDef(def, refs) {
1384
+ if (refs.target === "openAi") {
1385
+ console.warn("Warning: OpenAI may not support records in schemas! Try an array of key-value pairs instead.");
1386
+ }
1387
+ if (refs.target === "openApi3" && def.keyType?._def.typeName === zod.ZodFirstPartyTypeKind.ZodEnum) {
1388
+ return {
1389
+ type: "object",
1390
+ required: def.keyType._def.values,
1391
+ properties: def.keyType._def.values.reduce((acc, key) => ({
1392
+ ...acc,
1393
+ [key]: parseDef(def.valueType._def, {
1394
+ ...refs,
1395
+ currentPath: [...refs.currentPath, "properties", key]
1396
+ }) ?? {}
1397
+ }), {}),
1398
+ additionalProperties: refs.rejectedAdditionalProperties
1399
+ };
1400
+ }
1401
+ const schema = {
1402
+ type: "object",
1403
+ additionalProperties: parseDef(def.valueType._def, {
1404
+ ...refs,
1405
+ currentPath: [...refs.currentPath, "additionalProperties"]
1406
+ }) ?? refs.allowedAdditionalProperties
1407
+ };
1408
+ if (refs.target === "openApi3") {
1409
+ return schema;
1410
+ }
1411
+ if (def.keyType?._def.typeName === zod.ZodFirstPartyTypeKind.ZodString && def.keyType._def.checks?.length) {
1412
+ const { type, ...keyType } = parseStringDef(def.keyType._def, refs);
1413
+ return {
1414
+ ...schema,
1415
+ propertyNames: keyType
1416
+ };
1417
+ } else if (def.keyType?._def.typeName === zod.ZodFirstPartyTypeKind.ZodEnum) {
1418
+ return {
1419
+ ...schema,
1420
+ propertyNames: {
1421
+ enum: def.keyType._def.values
1422
+ }
1423
+ };
1424
+ } else if (def.keyType?._def.typeName === zod.ZodFirstPartyTypeKind.ZodBranded && def.keyType._def.type._def.typeName === zod.ZodFirstPartyTypeKind.ZodString && def.keyType._def.type._def.checks?.length) {
1425
+ const { type, ...keyType } = parseBrandedDef(def.keyType._def, refs);
1426
+ return {
1427
+ ...schema,
1428
+ propertyNames: keyType
1429
+ };
1430
+ }
1431
+ return schema;
1432
+ }
1433
+
1434
+ // ../../node_modules/.pnpm/zod-to-json-schema@3.24.5_zod@3.24.4/node_modules/zod-to-json-schema/dist/esm/parsers/map.js
1435
+ function parseMapDef(def, refs) {
1436
+ if (refs.mapStrategy === "record") {
1437
+ return parseRecordDef(def, refs);
1438
+ }
1439
+ const keys = parseDef(def.keyType._def, {
1440
+ ...refs,
1441
+ currentPath: [...refs.currentPath, "items", "items", "0"]
1442
+ }) || {};
1443
+ const values = parseDef(def.valueType._def, {
1444
+ ...refs,
1445
+ currentPath: [...refs.currentPath, "items", "items", "1"]
1446
+ }) || {};
1447
+ return {
1448
+ type: "array",
1449
+ maxItems: 125,
1450
+ items: {
1451
+ type: "array",
1452
+ items: [keys, values],
1453
+ minItems: 2,
1454
+ maxItems: 2
1455
+ }
1456
+ };
1457
+ }
1458
+
1459
+ // ../../node_modules/.pnpm/zod-to-json-schema@3.24.5_zod@3.24.4/node_modules/zod-to-json-schema/dist/esm/parsers/nativeEnum.js
1460
+ function parseNativeEnumDef(def) {
1461
+ const object = def.values;
1462
+ const actualKeys = Object.keys(def.values).filter((key) => {
1463
+ return typeof object[object[key]] !== "number";
1464
+ });
1465
+ const actualValues = actualKeys.map((key) => object[key]);
1466
+ const parsedTypes = Array.from(new Set(actualValues.map((values) => typeof values)));
1467
+ return {
1468
+ type: parsedTypes.length === 1 ? parsedTypes[0] === "string" ? "string" : "number" : ["string", "number"],
1469
+ enum: actualValues
1470
+ };
1471
+ }
1472
+
1473
+ // ../../node_modules/.pnpm/zod-to-json-schema@3.24.5_zod@3.24.4/node_modules/zod-to-json-schema/dist/esm/parsers/never.js
1474
+ function parseNeverDef() {
1475
+ return {
1476
+ not: {}
1477
+ };
1478
+ }
1479
+
1480
+ // ../../node_modules/.pnpm/zod-to-json-schema@3.24.5_zod@3.24.4/node_modules/zod-to-json-schema/dist/esm/parsers/null.js
1481
+ function parseNullDef(refs) {
1482
+ return refs.target === "openApi3" ? {
1483
+ enum: ["null"],
1484
+ nullable: true
1485
+ } : {
1486
+ type: "null"
1487
+ };
1488
+ }
1489
+
1490
+ // ../../node_modules/.pnpm/zod-to-json-schema@3.24.5_zod@3.24.4/node_modules/zod-to-json-schema/dist/esm/parsers/union.js
1491
+ var primitiveMappings = {
1492
+ ZodString: "string",
1493
+ ZodNumber: "number",
1494
+ ZodBigInt: "integer",
1495
+ ZodBoolean: "boolean",
1496
+ ZodNull: "null"
1497
+ };
1498
+ function parseUnionDef(def, refs) {
1499
+ if (refs.target === "openApi3")
1500
+ return asAnyOf(def, refs);
1501
+ const options = def.options instanceof Map ? Array.from(def.options.values()) : def.options;
1502
+ if (options.every((x) => x._def.typeName in primitiveMappings && (!x._def.checks || !x._def.checks.length))) {
1503
+ const types = options.reduce((types2, x) => {
1504
+ const type = primitiveMappings[x._def.typeName];
1505
+ return type && !types2.includes(type) ? [...types2, type] : types2;
1506
+ }, []);
1507
+ return {
1508
+ type: types.length > 1 ? types : types[0]
1509
+ };
1510
+ } else if (options.every((x) => x._def.typeName === "ZodLiteral" && !x.description)) {
1511
+ const types = options.reduce((acc, x) => {
1512
+ const type = typeof x._def.value;
1513
+ switch (type) {
1514
+ case "string":
1515
+ case "number":
1516
+ case "boolean":
1517
+ return [...acc, type];
1518
+ case "bigint":
1519
+ return [...acc, "integer"];
1520
+ case "object":
1521
+ if (x._def.value === null)
1522
+ return [...acc, "null"];
1523
+ case "symbol":
1524
+ case "undefined":
1525
+ case "function":
1526
+ default:
1527
+ return acc;
1528
+ }
1529
+ }, []);
1530
+ if (types.length === options.length) {
1531
+ const uniqueTypes = types.filter((x, i, a) => a.indexOf(x) === i);
1532
+ return {
1533
+ type: uniqueTypes.length > 1 ? uniqueTypes : uniqueTypes[0],
1534
+ enum: options.reduce((acc, x) => {
1535
+ return acc.includes(x._def.value) ? acc : [...acc, x._def.value];
1536
+ }, [])
1537
+ };
1538
+ }
1539
+ } else if (options.every((x) => x._def.typeName === "ZodEnum")) {
1540
+ return {
1541
+ type: "string",
1542
+ enum: options.reduce((acc, x) => [
1543
+ ...acc,
1544
+ ...x._def.values.filter((x2) => !acc.includes(x2))
1545
+ ], [])
1546
+ };
1547
+ }
1548
+ return asAnyOf(def, refs);
1549
+ }
1550
+ var asAnyOf = (def, refs) => {
1551
+ const anyOf = (def.options instanceof Map ? Array.from(def.options.values()) : def.options).map((x, i) => parseDef(x._def, {
1552
+ ...refs,
1553
+ currentPath: [...refs.currentPath, "anyOf", `${i}`]
1554
+ })).filter((x) => !!x && (!refs.strictUnions || typeof x === "object" && Object.keys(x).length > 0));
1555
+ return anyOf.length ? { anyOf } : void 0;
1556
+ };
1557
+
1558
+ // ../../node_modules/.pnpm/zod-to-json-schema@3.24.5_zod@3.24.4/node_modules/zod-to-json-schema/dist/esm/parsers/nullable.js
1559
+ function parseNullableDef(def, refs) {
1560
+ if (["ZodString", "ZodNumber", "ZodBigInt", "ZodBoolean", "ZodNull"].includes(def.innerType._def.typeName) && (!def.innerType._def.checks || !def.innerType._def.checks.length)) {
1561
+ if (refs.target === "openApi3") {
1562
+ return {
1563
+ type: primitiveMappings[def.innerType._def.typeName],
1564
+ nullable: true
1565
+ };
1566
+ }
1567
+ return {
1568
+ type: [
1569
+ primitiveMappings[def.innerType._def.typeName],
1570
+ "null"
1571
+ ]
1572
+ };
1573
+ }
1574
+ if (refs.target === "openApi3") {
1575
+ const base2 = parseDef(def.innerType._def, {
1576
+ ...refs,
1577
+ currentPath: [...refs.currentPath]
1578
+ });
1579
+ if (base2 && "$ref" in base2)
1580
+ return { allOf: [base2], nullable: true };
1581
+ return base2 && { ...base2, nullable: true };
1582
+ }
1583
+ const base = parseDef(def.innerType._def, {
1584
+ ...refs,
1585
+ currentPath: [...refs.currentPath, "anyOf", "0"]
1586
+ });
1587
+ return base && { anyOf: [base, { type: "null" }] };
1588
+ }
1589
+
1590
+ // ../../node_modules/.pnpm/zod-to-json-schema@3.24.5_zod@3.24.4/node_modules/zod-to-json-schema/dist/esm/parsers/number.js
1591
+ function parseNumberDef(def, refs) {
1592
+ const res = {
1593
+ type: "number"
1594
+ };
1595
+ if (!def.checks)
1596
+ return res;
1597
+ for (const check of def.checks) {
1598
+ switch (check.kind) {
1599
+ case "int":
1600
+ res.type = "integer";
1601
+ addErrorMessage(res, "type", check.message, refs);
1602
+ break;
1603
+ case "min":
1604
+ if (refs.target === "jsonSchema7") {
1605
+ if (check.inclusive) {
1606
+ setResponseValueAndErrors(res, "minimum", check.value, check.message, refs);
1607
+ } else {
1608
+ setResponseValueAndErrors(res, "exclusiveMinimum", check.value, check.message, refs);
1609
+ }
1610
+ } else {
1611
+ if (!check.inclusive) {
1612
+ res.exclusiveMinimum = true;
1613
+ }
1614
+ setResponseValueAndErrors(res, "minimum", check.value, check.message, refs);
1615
+ }
1616
+ break;
1617
+ case "max":
1618
+ if (refs.target === "jsonSchema7") {
1619
+ if (check.inclusive) {
1620
+ setResponseValueAndErrors(res, "maximum", check.value, check.message, refs);
1621
+ } else {
1622
+ setResponseValueAndErrors(res, "exclusiveMaximum", check.value, check.message, refs);
1623
+ }
1624
+ } else {
1625
+ if (!check.inclusive) {
1626
+ res.exclusiveMaximum = true;
1627
+ }
1628
+ setResponseValueAndErrors(res, "maximum", check.value, check.message, refs);
1629
+ }
1630
+ break;
1631
+ case "multipleOf":
1632
+ setResponseValueAndErrors(res, "multipleOf", check.value, check.message, refs);
1633
+ break;
1634
+ }
1635
+ }
1636
+ return res;
1637
+ }
1638
+ function parseObjectDef(def, refs) {
1639
+ const forceOptionalIntoNullable = refs.target === "openAi";
1640
+ const result = {
1641
+ type: "object",
1642
+ properties: {}
1643
+ };
1644
+ const required = [];
1645
+ const shape = def.shape();
1646
+ for (const propName in shape) {
1647
+ let propDef = shape[propName];
1648
+ if (propDef === void 0 || propDef._def === void 0) {
1649
+ continue;
1650
+ }
1651
+ let propOptional = safeIsOptional(propDef);
1652
+ if (propOptional && forceOptionalIntoNullable) {
1653
+ if (propDef instanceof zod.ZodOptional) {
1654
+ propDef = propDef._def.innerType;
1655
+ }
1656
+ if (!propDef.isNullable()) {
1657
+ propDef = propDef.nullable();
1658
+ }
1659
+ propOptional = false;
1660
+ }
1661
+ const parsedDef = parseDef(propDef._def, {
1662
+ ...refs,
1663
+ currentPath: [...refs.currentPath, "properties", propName],
1664
+ propertyPath: [...refs.currentPath, "properties", propName]
1665
+ });
1666
+ if (parsedDef === void 0) {
1667
+ continue;
1668
+ }
1669
+ result.properties[propName] = parsedDef;
1670
+ if (!propOptional) {
1671
+ required.push(propName);
1672
+ }
1673
+ }
1674
+ if (required.length) {
1675
+ result.required = required;
1676
+ }
1677
+ const additionalProperties = decideAdditionalProperties(def, refs);
1678
+ if (additionalProperties !== void 0) {
1679
+ result.additionalProperties = additionalProperties;
1680
+ }
1681
+ return result;
1682
+ }
1683
+ function decideAdditionalProperties(def, refs) {
1684
+ if (def.catchall._def.typeName !== "ZodNever") {
1685
+ return parseDef(def.catchall._def, {
1686
+ ...refs,
1687
+ currentPath: [...refs.currentPath, "additionalProperties"]
1688
+ });
1689
+ }
1690
+ switch (def.unknownKeys) {
1691
+ case "passthrough":
1692
+ return refs.allowedAdditionalProperties;
1693
+ case "strict":
1694
+ return refs.rejectedAdditionalProperties;
1695
+ case "strip":
1696
+ return refs.removeAdditionalStrategy === "strict" ? refs.allowedAdditionalProperties : refs.rejectedAdditionalProperties;
1697
+ }
1698
+ }
1699
+ function safeIsOptional(schema) {
1700
+ try {
1701
+ return schema.isOptional();
1702
+ } catch {
1703
+ return true;
1704
+ }
1705
+ }
1706
+
1707
+ // ../../node_modules/.pnpm/zod-to-json-schema@3.24.5_zod@3.24.4/node_modules/zod-to-json-schema/dist/esm/parsers/optional.js
1708
+ var parseOptionalDef = (def, refs) => {
1709
+ if (refs.currentPath.toString() === refs.propertyPath?.toString()) {
1710
+ return parseDef(def.innerType._def, refs);
1711
+ }
1712
+ const innerSchema = parseDef(def.innerType._def, {
1713
+ ...refs,
1714
+ currentPath: [...refs.currentPath, "anyOf", "1"]
1715
+ });
1716
+ return innerSchema ? {
1717
+ anyOf: [
1718
+ {
1719
+ not: {}
1720
+ },
1721
+ innerSchema
1722
+ ]
1723
+ } : {};
1724
+ };
1725
+
1726
+ // ../../node_modules/.pnpm/zod-to-json-schema@3.24.5_zod@3.24.4/node_modules/zod-to-json-schema/dist/esm/parsers/pipeline.js
1727
+ var parsePipelineDef = (def, refs) => {
1728
+ if (refs.pipeStrategy === "input") {
1729
+ return parseDef(def.in._def, refs);
1730
+ } else if (refs.pipeStrategy === "output") {
1731
+ return parseDef(def.out._def, refs);
1732
+ }
1733
+ const a = parseDef(def.in._def, {
1734
+ ...refs,
1735
+ currentPath: [...refs.currentPath, "allOf", "0"]
1736
+ });
1737
+ const b = parseDef(def.out._def, {
1738
+ ...refs,
1739
+ currentPath: [...refs.currentPath, "allOf", a ? "1" : "0"]
1740
+ });
1741
+ return {
1742
+ allOf: [a, b].filter((x) => x !== void 0)
1743
+ };
1744
+ };
1745
+
1746
+ // ../../node_modules/.pnpm/zod-to-json-schema@3.24.5_zod@3.24.4/node_modules/zod-to-json-schema/dist/esm/parsers/promise.js
1747
+ function parsePromiseDef(def, refs) {
1748
+ return parseDef(def.type._def, refs);
1749
+ }
1750
+
1751
+ // ../../node_modules/.pnpm/zod-to-json-schema@3.24.5_zod@3.24.4/node_modules/zod-to-json-schema/dist/esm/parsers/set.js
1752
+ function parseSetDef(def, refs) {
1753
+ const items = parseDef(def.valueType._def, {
1754
+ ...refs,
1755
+ currentPath: [...refs.currentPath, "items"]
1756
+ });
1757
+ const schema = {
1758
+ type: "array",
1759
+ uniqueItems: true,
1760
+ items
1761
+ };
1762
+ if (def.minSize) {
1763
+ setResponseValueAndErrors(schema, "minItems", def.minSize.value, def.minSize.message, refs);
1764
+ }
1765
+ if (def.maxSize) {
1766
+ setResponseValueAndErrors(schema, "maxItems", def.maxSize.value, def.maxSize.message, refs);
1767
+ }
1768
+ return schema;
1769
+ }
1770
+
1771
+ // ../../node_modules/.pnpm/zod-to-json-schema@3.24.5_zod@3.24.4/node_modules/zod-to-json-schema/dist/esm/parsers/tuple.js
1772
+ function parseTupleDef(def, refs) {
1773
+ if (def.rest) {
1774
+ return {
1775
+ type: "array",
1776
+ minItems: def.items.length,
1777
+ items: def.items.map((x, i) => parseDef(x._def, {
1778
+ ...refs,
1779
+ currentPath: [...refs.currentPath, "items", `${i}`]
1780
+ })).reduce((acc, x) => x === void 0 ? acc : [...acc, x], []),
1781
+ additionalItems: parseDef(def.rest._def, {
1782
+ ...refs,
1783
+ currentPath: [...refs.currentPath, "additionalItems"]
1784
+ })
1785
+ };
1786
+ } else {
1787
+ return {
1788
+ type: "array",
1789
+ minItems: def.items.length,
1790
+ maxItems: def.items.length,
1791
+ items: def.items.map((x, i) => parseDef(x._def, {
1792
+ ...refs,
1793
+ currentPath: [...refs.currentPath, "items", `${i}`]
1794
+ })).reduce((acc, x) => x === void 0 ? acc : [...acc, x], [])
1795
+ };
1796
+ }
1797
+ }
1798
+
1799
+ // ../../node_modules/.pnpm/zod-to-json-schema@3.24.5_zod@3.24.4/node_modules/zod-to-json-schema/dist/esm/parsers/undefined.js
1800
+ function parseUndefinedDef() {
1801
+ return {
1802
+ not: {}
1803
+ };
1804
+ }
1805
+
1806
+ // ../../node_modules/.pnpm/zod-to-json-schema@3.24.5_zod@3.24.4/node_modules/zod-to-json-schema/dist/esm/parsers/unknown.js
1807
+ function parseUnknownDef() {
1808
+ return {};
1809
+ }
1810
+
1811
+ // ../../node_modules/.pnpm/zod-to-json-schema@3.24.5_zod@3.24.4/node_modules/zod-to-json-schema/dist/esm/parsers/readonly.js
1812
+ var parseReadonlyDef = (def, refs) => {
1813
+ return parseDef(def.innerType._def, refs);
1814
+ };
1815
+
1816
+ // ../../node_modules/.pnpm/zod-to-json-schema@3.24.5_zod@3.24.4/node_modules/zod-to-json-schema/dist/esm/selectParser.js
1817
+ var selectParser = (def, typeName, refs) => {
1818
+ switch (typeName) {
1819
+ case zod.ZodFirstPartyTypeKind.ZodString:
1820
+ return parseStringDef(def, refs);
1821
+ case zod.ZodFirstPartyTypeKind.ZodNumber:
1822
+ return parseNumberDef(def, refs);
1823
+ case zod.ZodFirstPartyTypeKind.ZodObject:
1824
+ return parseObjectDef(def, refs);
1825
+ case zod.ZodFirstPartyTypeKind.ZodBigInt:
1826
+ return parseBigintDef(def, refs);
1827
+ case zod.ZodFirstPartyTypeKind.ZodBoolean:
1828
+ return parseBooleanDef();
1829
+ case zod.ZodFirstPartyTypeKind.ZodDate:
1830
+ return parseDateDef(def, refs);
1831
+ case zod.ZodFirstPartyTypeKind.ZodUndefined:
1832
+ return parseUndefinedDef();
1833
+ case zod.ZodFirstPartyTypeKind.ZodNull:
1834
+ return parseNullDef(refs);
1835
+ case zod.ZodFirstPartyTypeKind.ZodArray:
1836
+ return parseArrayDef(def, refs);
1837
+ case zod.ZodFirstPartyTypeKind.ZodUnion:
1838
+ case zod.ZodFirstPartyTypeKind.ZodDiscriminatedUnion:
1839
+ return parseUnionDef(def, refs);
1840
+ case zod.ZodFirstPartyTypeKind.ZodIntersection:
1841
+ return parseIntersectionDef(def, refs);
1842
+ case zod.ZodFirstPartyTypeKind.ZodTuple:
1843
+ return parseTupleDef(def, refs);
1844
+ case zod.ZodFirstPartyTypeKind.ZodRecord:
1845
+ return parseRecordDef(def, refs);
1846
+ case zod.ZodFirstPartyTypeKind.ZodLiteral:
1847
+ return parseLiteralDef(def, refs);
1848
+ case zod.ZodFirstPartyTypeKind.ZodEnum:
1849
+ return parseEnumDef(def);
1850
+ case zod.ZodFirstPartyTypeKind.ZodNativeEnum:
1851
+ return parseNativeEnumDef(def);
1852
+ case zod.ZodFirstPartyTypeKind.ZodNullable:
1853
+ return parseNullableDef(def, refs);
1854
+ case zod.ZodFirstPartyTypeKind.ZodOptional:
1855
+ return parseOptionalDef(def, refs);
1856
+ case zod.ZodFirstPartyTypeKind.ZodMap:
1857
+ return parseMapDef(def, refs);
1858
+ case zod.ZodFirstPartyTypeKind.ZodSet:
1859
+ return parseSetDef(def, refs);
1860
+ case zod.ZodFirstPartyTypeKind.ZodLazy:
1861
+ return () => def.getter()._def;
1862
+ case zod.ZodFirstPartyTypeKind.ZodPromise:
1863
+ return parsePromiseDef(def, refs);
1864
+ case zod.ZodFirstPartyTypeKind.ZodNaN:
1865
+ case zod.ZodFirstPartyTypeKind.ZodNever:
1866
+ return parseNeverDef();
1867
+ case zod.ZodFirstPartyTypeKind.ZodEffects:
1868
+ return parseEffectsDef(def, refs);
1869
+ case zod.ZodFirstPartyTypeKind.ZodAny:
1870
+ return parseAnyDef();
1871
+ case zod.ZodFirstPartyTypeKind.ZodUnknown:
1872
+ return parseUnknownDef();
1873
+ case zod.ZodFirstPartyTypeKind.ZodDefault:
1874
+ return parseDefaultDef(def, refs);
1875
+ case zod.ZodFirstPartyTypeKind.ZodBranded:
1876
+ return parseBrandedDef(def, refs);
1877
+ case zod.ZodFirstPartyTypeKind.ZodReadonly:
1878
+ return parseReadonlyDef(def, refs);
1879
+ case zod.ZodFirstPartyTypeKind.ZodCatch:
1880
+ return parseCatchDef(def, refs);
1881
+ case zod.ZodFirstPartyTypeKind.ZodPipeline:
1882
+ return parsePipelineDef(def, refs);
1883
+ case zod.ZodFirstPartyTypeKind.ZodFunction:
1884
+ case zod.ZodFirstPartyTypeKind.ZodVoid:
1885
+ case zod.ZodFirstPartyTypeKind.ZodSymbol:
1886
+ return void 0;
1887
+ default:
1888
+ return /* @__PURE__ */ ((_) => void 0)();
1889
+ }
1890
+ };
1891
+
1892
+ // ../../node_modules/.pnpm/zod-to-json-schema@3.24.5_zod@3.24.4/node_modules/zod-to-json-schema/dist/esm/parseDef.js
1893
+ function parseDef(def, refs, forceResolution = false) {
1894
+ const seenItem = refs.seen.get(def);
1895
+ if (refs.override) {
1896
+ const overrideResult = refs.override?.(def, refs, seenItem, forceResolution);
1897
+ if (overrideResult !== ignoreOverride) {
1898
+ return overrideResult;
1899
+ }
1900
+ }
1901
+ if (seenItem && !forceResolution) {
1902
+ const seenSchema = get$ref(seenItem, refs);
1903
+ if (seenSchema !== void 0) {
1904
+ return seenSchema;
1905
+ }
1906
+ }
1907
+ const newItem = { def, path: refs.currentPath, jsonSchema: void 0 };
1908
+ refs.seen.set(def, newItem);
1909
+ const jsonSchemaOrGetter = selectParser(def, def.typeName, refs);
1910
+ const jsonSchema = typeof jsonSchemaOrGetter === "function" ? parseDef(jsonSchemaOrGetter(), refs) : jsonSchemaOrGetter;
1911
+ if (jsonSchema) {
1912
+ addMeta(def, refs, jsonSchema);
1913
+ }
1914
+ if (refs.postProcess) {
1915
+ const postProcessResult = refs.postProcess(jsonSchema, def, refs);
1916
+ newItem.jsonSchema = jsonSchema;
1917
+ return postProcessResult;
1918
+ }
1919
+ newItem.jsonSchema = jsonSchema;
1920
+ return jsonSchema;
1921
+ }
1922
+ var get$ref = (item, refs) => {
1923
+ switch (refs.$refStrategy) {
1924
+ case "root":
1925
+ return { $ref: item.path.join("/") };
1926
+ case "relative":
1927
+ return { $ref: getRelativePath(refs.currentPath, item.path) };
1928
+ case "none":
1929
+ case "seen": {
1930
+ if (item.path.length < refs.currentPath.length && item.path.every((value, index) => refs.currentPath[index] === value)) {
1931
+ console.warn(`Recursive reference detected at ${refs.currentPath.join("/")}! Defaulting to any`);
1932
+ return {};
1933
+ }
1934
+ return refs.$refStrategy === "seen" ? {} : void 0;
1935
+ }
1936
+ }
1937
+ };
1938
+ var getRelativePath = (pathA, pathB) => {
1939
+ let i = 0;
1940
+ for (; i < pathA.length && i < pathB.length; i++) {
1941
+ if (pathA[i] !== pathB[i])
1942
+ break;
1943
+ }
1944
+ return [(pathA.length - i).toString(), ...pathB.slice(i)].join("/");
1945
+ };
1946
+ var addMeta = (def, refs, jsonSchema) => {
1947
+ if (def.description) {
1948
+ jsonSchema.description = def.description;
1949
+ if (refs.markdownDescription) {
1950
+ jsonSchema.markdownDescription = def.description;
1951
+ }
1952
+ }
1953
+ return jsonSchema;
1954
+ };
1955
+
1956
+ // ../../node_modules/.pnpm/zod-to-json-schema@3.24.5_zod@3.24.4/node_modules/zod-to-json-schema/dist/esm/zodToJsonSchema.js
1957
+ var zodToJsonSchema = (schema, options) => {
1958
+ const refs = getRefs(options);
1959
+ const definitions = typeof options === "object" && options.definitions ? Object.entries(options.definitions).reduce((acc, [name2, schema2]) => ({
1960
+ ...acc,
1961
+ [name2]: parseDef(schema2._def, {
1962
+ ...refs,
1963
+ currentPath: [...refs.basePath, refs.definitionPath, name2]
1964
+ }, true) ?? {}
1965
+ }), {}) : void 0;
1966
+ const name = typeof options === "string" ? options : options?.nameStrategy === "title" ? void 0 : options?.name;
1967
+ const main = parseDef(schema._def, name === void 0 ? refs : {
1968
+ ...refs,
1969
+ currentPath: [...refs.basePath, refs.definitionPath, name]
1970
+ }, false) ?? {};
1971
+ const title = typeof options === "object" && options.name !== void 0 && options.nameStrategy === "title" ? options.name : void 0;
1972
+ if (title !== void 0) {
1973
+ main.title = title;
1974
+ }
1975
+ const combined = name === void 0 ? definitions ? {
1976
+ ...main,
1977
+ [refs.definitionPath]: definitions
1978
+ } : main : {
1979
+ $ref: [
1980
+ ...refs.$refStrategy === "relative" ? [] : refs.basePath,
1981
+ refs.definitionPath,
1982
+ name
1983
+ ].join("/"),
1984
+ [refs.definitionPath]: {
1985
+ ...definitions,
1986
+ [name]: main
1987
+ }
1988
+ };
1989
+ if (refs.target === "jsonSchema7") {
1990
+ combined.$schema = "http://json-schema.org/draft-07/schema#";
1991
+ } else if (refs.target === "jsonSchema2019-09" || refs.target === "openAi") {
1992
+ combined.$schema = "https://json-schema.org/draft/2019-09/schema#";
1993
+ }
1994
+ if (refs.target === "openAi" && ("anyOf" in combined || "oneOf" in combined || "allOf" in combined || "type" in combined && Array.isArray(combined.type))) {
1995
+ console.warn("Warning: OpenAI may not support schemas with unions as roots! Try wrapping it in an object property.");
1996
+ }
1997
+ return combined;
1998
+ };
1999
+
2000
+ // ../../node_modules/.pnpm/zod-to-json-schema@3.24.5_zod@3.24.4/node_modules/zod-to-json-schema/dist/esm/index.js
2001
+ var esm_default = zodToJsonSchema;
2002
+
2003
+ exports.esm_default = esm_default;
2004
+ exports.stringify = stringify;