@deepseek-ai/dsh-experimental-client-ui-claude-code-mods 0.2.1-alpha.2 → 0.2.1-alpha.3

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