@danielng23/dsh-lockon-client-ui-edex 0.1.0 → 0.1.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/client.js +4502 -77
- package/package.json +2 -2
package/lib/client.js
CHANGED
|
@@ -4,32 +4,4457 @@ window.__ModuleLoader__.load({
|
|
|
4
4
|
var module = { exports: {} };
|
|
5
5
|
var exports = module.exports;
|
|
6
6
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
var
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
enumerable:
|
|
7
|
+
let react = require("react");
|
|
8
|
+
let react_jsx_runtime = require("react/jsx-runtime");
|
|
9
|
+
//#region ../../node_modules/zod/v4/core/core.js
|
|
10
|
+
var _a$2;
|
|
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
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.`);
|
|
21
53
|
}
|
|
22
|
-
return to;
|
|
23
54
|
};
|
|
24
|
-
var
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
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$2 = globalThis).__zod_globalConfig ?? (_a$2.__zod_globalConfig = {});
|
|
62
|
+
const globalConfig = globalThis.__zod_globalConfig;
|
|
63
|
+
function config$1(newConfig) {
|
|
64
|
+
if (newConfig) Object.assign(globalConfig, newConfig);
|
|
65
|
+
return globalConfig;
|
|
66
|
+
}
|
|
67
|
+
//#endregion
|
|
68
|
+
//#region ../../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$1(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$1(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$1(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$1(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$1(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$1(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$1(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$1(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$1(shape)) throw new Error("Invalid input to safeExtend: expected a plain object");
|
|
264
|
+
return clone$1(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$1(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$1(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$1(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$1(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/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/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$1())));
|
|
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$1())));
|
|
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$1())))
|
|
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$1())))
|
|
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/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$2 = (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$2 = /^-?\d+(?:\.\d+)?$/;
|
|
614
|
+
const boolean$1 = /^(?:true|false)$/i;
|
|
615
|
+
const lowercase = /^[^A-Z]*$/;
|
|
616
|
+
const uppercase = /^[^a-z]*$/;
|
|
617
|
+
//#endregion
|
|
618
|
+
//#region ../../node_modules/zod/v4/core/checks.js
|
|
619
|
+
const $ZodCheck = /*@__PURE__*/ $constructor("$ZodCheck", (inst, def) => {
|
|
620
|
+
var _a;
|
|
621
|
+
inst._zod ?? (inst._zod = {});
|
|
622
|
+
inst._zod.def = def;
|
|
623
|
+
(_a = inst._zod).onattach ?? (_a.onattach = []);
|
|
624
|
+
});
|
|
625
|
+
const numericOriginMap = {
|
|
626
|
+
number: "number",
|
|
627
|
+
bigint: "bigint",
|
|
628
|
+
object: "date"
|
|
629
|
+
};
|
|
630
|
+
const $ZodCheckLessThan = /*@__PURE__*/ $constructor("$ZodCheckLessThan", (inst, def) => {
|
|
631
|
+
$ZodCheck.init(inst, def);
|
|
632
|
+
const origin = numericOriginMap[typeof def.value];
|
|
633
|
+
inst._zod.onattach.push((inst) => {
|
|
634
|
+
const bag = inst._zod.bag;
|
|
635
|
+
const curr = (def.inclusive ? bag.maximum : bag.exclusiveMaximum) ?? Number.POSITIVE_INFINITY;
|
|
636
|
+
if (def.value < curr) if (def.inclusive) bag.maximum = def.value;
|
|
637
|
+
else bag.exclusiveMaximum = def.value;
|
|
638
|
+
});
|
|
639
|
+
inst._zod.check = (payload) => {
|
|
640
|
+
if (def.inclusive ? payload.value <= def.value : payload.value < def.value) return;
|
|
641
|
+
payload.issues.push({
|
|
642
|
+
origin,
|
|
643
|
+
code: "too_big",
|
|
644
|
+
maximum: typeof def.value === "object" ? def.value.getTime() : def.value,
|
|
645
|
+
input: payload.value,
|
|
646
|
+
inclusive: def.inclusive,
|
|
647
|
+
inst,
|
|
648
|
+
continue: !def.abort
|
|
649
|
+
});
|
|
650
|
+
};
|
|
651
|
+
});
|
|
652
|
+
const $ZodCheckGreaterThan = /*@__PURE__*/ $constructor("$ZodCheckGreaterThan", (inst, def) => {
|
|
653
|
+
$ZodCheck.init(inst, def);
|
|
654
|
+
const origin = numericOriginMap[typeof def.value];
|
|
655
|
+
inst._zod.onattach.push((inst) => {
|
|
656
|
+
const bag = inst._zod.bag;
|
|
657
|
+
const curr = (def.inclusive ? bag.minimum : bag.exclusiveMinimum) ?? Number.NEGATIVE_INFINITY;
|
|
658
|
+
if (def.value > curr) if (def.inclusive) bag.minimum = def.value;
|
|
659
|
+
else bag.exclusiveMinimum = def.value;
|
|
660
|
+
});
|
|
661
|
+
inst._zod.check = (payload) => {
|
|
662
|
+
if (def.inclusive ? payload.value >= def.value : payload.value > def.value) return;
|
|
663
|
+
payload.issues.push({
|
|
664
|
+
origin,
|
|
665
|
+
code: "too_small",
|
|
666
|
+
minimum: typeof def.value === "object" ? def.value.getTime() : def.value,
|
|
667
|
+
input: payload.value,
|
|
668
|
+
inclusive: def.inclusive,
|
|
669
|
+
inst,
|
|
670
|
+
continue: !def.abort
|
|
671
|
+
});
|
|
672
|
+
};
|
|
673
|
+
});
|
|
674
|
+
const $ZodCheckMultipleOf = /*@__PURE__*/ $constructor("$ZodCheckMultipleOf", (inst, def) => {
|
|
675
|
+
$ZodCheck.init(inst, def);
|
|
676
|
+
inst._zod.onattach.push((inst) => {
|
|
677
|
+
var _a;
|
|
678
|
+
(_a = inst._zod.bag).multipleOf ?? (_a.multipleOf = def.value);
|
|
679
|
+
});
|
|
680
|
+
inst._zod.check = (payload) => {
|
|
681
|
+
if (typeof payload.value !== typeof def.value) throw new Error("Cannot mix number and bigint in multiple_of check.");
|
|
682
|
+
if (typeof payload.value === "bigint" ? payload.value % def.value === BigInt(0) : floatSafeRemainder(payload.value, def.value) === 0) return;
|
|
683
|
+
payload.issues.push({
|
|
684
|
+
origin: typeof payload.value,
|
|
685
|
+
code: "not_multiple_of",
|
|
686
|
+
divisor: def.value,
|
|
687
|
+
input: payload.value,
|
|
688
|
+
inst,
|
|
689
|
+
continue: !def.abort
|
|
690
|
+
});
|
|
691
|
+
};
|
|
692
|
+
});
|
|
693
|
+
const $ZodCheckNumberFormat = /*@__PURE__*/ $constructor("$ZodCheckNumberFormat", (inst, def) => {
|
|
694
|
+
$ZodCheck.init(inst, def);
|
|
695
|
+
def.format = def.format || "float64";
|
|
696
|
+
const isInt = def.format?.includes("int");
|
|
697
|
+
const origin = isInt ? "int" : "number";
|
|
698
|
+
const [minimum, maximum] = NUMBER_FORMAT_RANGES[def.format];
|
|
699
|
+
inst._zod.onattach.push((inst) => {
|
|
700
|
+
const bag = inst._zod.bag;
|
|
701
|
+
bag.format = def.format;
|
|
702
|
+
bag.minimum = minimum;
|
|
703
|
+
bag.maximum = maximum;
|
|
704
|
+
if (isInt) bag.pattern = integer;
|
|
705
|
+
});
|
|
706
|
+
inst._zod.check = (payload) => {
|
|
707
|
+
const input = payload.value;
|
|
708
|
+
if (isInt) {
|
|
709
|
+
if (!Number.isInteger(input)) {
|
|
710
|
+
payload.issues.push({
|
|
711
|
+
expected: origin,
|
|
712
|
+
format: def.format,
|
|
713
|
+
code: "invalid_type",
|
|
714
|
+
continue: false,
|
|
715
|
+
input,
|
|
716
|
+
inst
|
|
717
|
+
});
|
|
718
|
+
return;
|
|
719
|
+
}
|
|
720
|
+
if (!Number.isSafeInteger(input)) {
|
|
721
|
+
if (input > 0) payload.issues.push({
|
|
722
|
+
input,
|
|
723
|
+
code: "too_big",
|
|
724
|
+
maximum: Number.MAX_SAFE_INTEGER,
|
|
725
|
+
note: "Integers must be within the safe integer range.",
|
|
726
|
+
inst,
|
|
727
|
+
origin,
|
|
728
|
+
inclusive: true,
|
|
729
|
+
continue: !def.abort
|
|
730
|
+
});
|
|
731
|
+
else payload.issues.push({
|
|
732
|
+
input,
|
|
733
|
+
code: "too_small",
|
|
734
|
+
minimum: Number.MIN_SAFE_INTEGER,
|
|
735
|
+
note: "Integers must be within the safe integer range.",
|
|
736
|
+
inst,
|
|
737
|
+
origin,
|
|
738
|
+
inclusive: true,
|
|
739
|
+
continue: !def.abort
|
|
740
|
+
});
|
|
741
|
+
return;
|
|
742
|
+
}
|
|
743
|
+
}
|
|
744
|
+
if (input < minimum) payload.issues.push({
|
|
745
|
+
origin: "number",
|
|
746
|
+
input,
|
|
747
|
+
code: "too_small",
|
|
748
|
+
minimum,
|
|
749
|
+
inclusive: true,
|
|
750
|
+
inst,
|
|
751
|
+
continue: !def.abort
|
|
752
|
+
});
|
|
753
|
+
if (input > maximum) payload.issues.push({
|
|
754
|
+
origin: "number",
|
|
755
|
+
input,
|
|
756
|
+
code: "too_big",
|
|
757
|
+
maximum,
|
|
758
|
+
inclusive: true,
|
|
759
|
+
inst,
|
|
760
|
+
continue: !def.abort
|
|
761
|
+
});
|
|
762
|
+
};
|
|
763
|
+
});
|
|
764
|
+
const $ZodCheckMaxLength = /*@__PURE__*/ $constructor("$ZodCheckMaxLength", (inst, def) => {
|
|
765
|
+
var _a;
|
|
766
|
+
$ZodCheck.init(inst, def);
|
|
767
|
+
(_a = inst._zod.def).when ?? (_a.when = (payload) => {
|
|
768
|
+
const val = payload.value;
|
|
769
|
+
return !nullish(val) && val.length !== void 0;
|
|
770
|
+
});
|
|
771
|
+
inst._zod.onattach.push((inst) => {
|
|
772
|
+
const curr = inst._zod.bag.maximum ?? Number.POSITIVE_INFINITY;
|
|
773
|
+
if (def.maximum < curr) inst._zod.bag.maximum = def.maximum;
|
|
774
|
+
});
|
|
775
|
+
inst._zod.check = (payload) => {
|
|
776
|
+
const input = payload.value;
|
|
777
|
+
if (input.length <= def.maximum) return;
|
|
778
|
+
const origin = getLengthableOrigin(input);
|
|
779
|
+
payload.issues.push({
|
|
780
|
+
origin,
|
|
781
|
+
code: "too_big",
|
|
782
|
+
maximum: def.maximum,
|
|
783
|
+
inclusive: true,
|
|
784
|
+
input,
|
|
785
|
+
inst,
|
|
786
|
+
continue: !def.abort
|
|
787
|
+
});
|
|
788
|
+
};
|
|
789
|
+
});
|
|
790
|
+
const $ZodCheckMinLength = /*@__PURE__*/ $constructor("$ZodCheckMinLength", (inst, def) => {
|
|
791
|
+
var _a;
|
|
792
|
+
$ZodCheck.init(inst, def);
|
|
793
|
+
(_a = inst._zod.def).when ?? (_a.when = (payload) => {
|
|
794
|
+
const val = payload.value;
|
|
795
|
+
return !nullish(val) && val.length !== void 0;
|
|
796
|
+
});
|
|
797
|
+
inst._zod.onattach.push((inst) => {
|
|
798
|
+
const curr = inst._zod.bag.minimum ?? Number.NEGATIVE_INFINITY;
|
|
799
|
+
if (def.minimum > curr) inst._zod.bag.minimum = def.minimum;
|
|
800
|
+
});
|
|
801
|
+
inst._zod.check = (payload) => {
|
|
802
|
+
const input = payload.value;
|
|
803
|
+
if (input.length >= def.minimum) return;
|
|
804
|
+
const origin = getLengthableOrigin(input);
|
|
805
|
+
payload.issues.push({
|
|
806
|
+
origin,
|
|
807
|
+
code: "too_small",
|
|
808
|
+
minimum: def.minimum,
|
|
809
|
+
inclusive: true,
|
|
810
|
+
input,
|
|
811
|
+
inst,
|
|
812
|
+
continue: !def.abort
|
|
813
|
+
});
|
|
814
|
+
};
|
|
815
|
+
});
|
|
816
|
+
const $ZodCheckLengthEquals = /*@__PURE__*/ $constructor("$ZodCheckLengthEquals", (inst, def) => {
|
|
817
|
+
var _a;
|
|
818
|
+
$ZodCheck.init(inst, def);
|
|
819
|
+
(_a = inst._zod.def).when ?? (_a.when = (payload) => {
|
|
820
|
+
const val = payload.value;
|
|
821
|
+
return !nullish(val) && val.length !== void 0;
|
|
822
|
+
});
|
|
823
|
+
inst._zod.onattach.push((inst) => {
|
|
824
|
+
const bag = inst._zod.bag;
|
|
825
|
+
bag.minimum = def.length;
|
|
826
|
+
bag.maximum = def.length;
|
|
827
|
+
bag.length = def.length;
|
|
828
|
+
});
|
|
829
|
+
inst._zod.check = (payload) => {
|
|
830
|
+
const input = payload.value;
|
|
831
|
+
const length = input.length;
|
|
832
|
+
if (length === def.length) return;
|
|
833
|
+
const origin = getLengthableOrigin(input);
|
|
834
|
+
const tooBig = length > def.length;
|
|
835
|
+
payload.issues.push({
|
|
836
|
+
origin,
|
|
837
|
+
...tooBig ? {
|
|
838
|
+
code: "too_big",
|
|
839
|
+
maximum: def.length
|
|
840
|
+
} : {
|
|
841
|
+
code: "too_small",
|
|
842
|
+
minimum: def.length
|
|
843
|
+
},
|
|
844
|
+
inclusive: true,
|
|
845
|
+
exact: true,
|
|
846
|
+
input: payload.value,
|
|
847
|
+
inst,
|
|
848
|
+
continue: !def.abort
|
|
849
|
+
});
|
|
850
|
+
};
|
|
851
|
+
});
|
|
852
|
+
const $ZodCheckStringFormat = /*@__PURE__*/ $constructor("$ZodCheckStringFormat", (inst, def) => {
|
|
853
|
+
var _a, _b;
|
|
854
|
+
$ZodCheck.init(inst, def);
|
|
855
|
+
inst._zod.onattach.push((inst) => {
|
|
856
|
+
const bag = inst._zod.bag;
|
|
857
|
+
bag.format = def.format;
|
|
858
|
+
if (def.pattern) {
|
|
859
|
+
bag.patterns ?? (bag.patterns = /* @__PURE__ */ new Set());
|
|
860
|
+
bag.patterns.add(def.pattern);
|
|
861
|
+
}
|
|
862
|
+
});
|
|
863
|
+
if (def.pattern) (_a = inst._zod).check ?? (_a.check = (payload) => {
|
|
864
|
+
def.pattern.lastIndex = 0;
|
|
865
|
+
if (def.pattern.test(payload.value)) return;
|
|
866
|
+
payload.issues.push({
|
|
867
|
+
origin: "string",
|
|
868
|
+
code: "invalid_format",
|
|
869
|
+
format: def.format,
|
|
870
|
+
input: payload.value,
|
|
871
|
+
...def.pattern ? { pattern: def.pattern.toString() } : {},
|
|
872
|
+
inst,
|
|
873
|
+
continue: !def.abort
|
|
874
|
+
});
|
|
875
|
+
});
|
|
876
|
+
else (_b = inst._zod).check ?? (_b.check = () => {});
|
|
877
|
+
});
|
|
878
|
+
const $ZodCheckRegex = /*@__PURE__*/ $constructor("$ZodCheckRegex", (inst, def) => {
|
|
879
|
+
$ZodCheckStringFormat.init(inst, def);
|
|
880
|
+
inst._zod.check = (payload) => {
|
|
881
|
+
def.pattern.lastIndex = 0;
|
|
882
|
+
if (def.pattern.test(payload.value)) return;
|
|
883
|
+
payload.issues.push({
|
|
884
|
+
origin: "string",
|
|
885
|
+
code: "invalid_format",
|
|
886
|
+
format: "regex",
|
|
887
|
+
input: payload.value,
|
|
888
|
+
pattern: def.pattern.toString(),
|
|
889
|
+
inst,
|
|
890
|
+
continue: !def.abort
|
|
891
|
+
});
|
|
892
|
+
};
|
|
893
|
+
});
|
|
894
|
+
const $ZodCheckLowerCase = /*@__PURE__*/ $constructor("$ZodCheckLowerCase", (inst, def) => {
|
|
895
|
+
def.pattern ?? (def.pattern = lowercase);
|
|
896
|
+
$ZodCheckStringFormat.init(inst, def);
|
|
897
|
+
});
|
|
898
|
+
const $ZodCheckUpperCase = /*@__PURE__*/ $constructor("$ZodCheckUpperCase", (inst, def) => {
|
|
899
|
+
def.pattern ?? (def.pattern = uppercase);
|
|
900
|
+
$ZodCheckStringFormat.init(inst, def);
|
|
901
|
+
});
|
|
902
|
+
const $ZodCheckIncludes = /*@__PURE__*/ $constructor("$ZodCheckIncludes", (inst, def) => {
|
|
903
|
+
$ZodCheck.init(inst, def);
|
|
904
|
+
const escapedRegex = escapeRegex(def.includes);
|
|
905
|
+
const pattern = new RegExp(typeof def.position === "number" ? `^.{${def.position}}${escapedRegex}` : escapedRegex);
|
|
906
|
+
def.pattern = pattern;
|
|
907
|
+
inst._zod.onattach.push((inst) => {
|
|
908
|
+
const bag = inst._zod.bag;
|
|
909
|
+
bag.patterns ?? (bag.patterns = /* @__PURE__ */ new Set());
|
|
910
|
+
bag.patterns.add(pattern);
|
|
911
|
+
});
|
|
912
|
+
inst._zod.check = (payload) => {
|
|
913
|
+
if (payload.value.includes(def.includes, def.position)) return;
|
|
914
|
+
payload.issues.push({
|
|
915
|
+
origin: "string",
|
|
916
|
+
code: "invalid_format",
|
|
917
|
+
format: "includes",
|
|
918
|
+
includes: def.includes,
|
|
919
|
+
input: payload.value,
|
|
920
|
+
inst,
|
|
921
|
+
continue: !def.abort
|
|
922
|
+
});
|
|
923
|
+
};
|
|
924
|
+
});
|
|
925
|
+
const $ZodCheckStartsWith = /*@__PURE__*/ $constructor("$ZodCheckStartsWith", (inst, def) => {
|
|
926
|
+
$ZodCheck.init(inst, def);
|
|
927
|
+
const pattern = new RegExp(`^${escapeRegex(def.prefix)}.*`);
|
|
928
|
+
def.pattern ?? (def.pattern = pattern);
|
|
929
|
+
inst._zod.onattach.push((inst) => {
|
|
930
|
+
const bag = inst._zod.bag;
|
|
931
|
+
bag.patterns ?? (bag.patterns = /* @__PURE__ */ new Set());
|
|
932
|
+
bag.patterns.add(pattern);
|
|
933
|
+
});
|
|
934
|
+
inst._zod.check = (payload) => {
|
|
935
|
+
if (payload.value.startsWith(def.prefix)) return;
|
|
936
|
+
payload.issues.push({
|
|
937
|
+
origin: "string",
|
|
938
|
+
code: "invalid_format",
|
|
939
|
+
format: "starts_with",
|
|
940
|
+
prefix: def.prefix,
|
|
941
|
+
input: payload.value,
|
|
942
|
+
inst,
|
|
943
|
+
continue: !def.abort
|
|
944
|
+
});
|
|
945
|
+
};
|
|
946
|
+
});
|
|
947
|
+
const $ZodCheckEndsWith = /*@__PURE__*/ $constructor("$ZodCheckEndsWith", (inst, def) => {
|
|
948
|
+
$ZodCheck.init(inst, def);
|
|
949
|
+
const pattern = new RegExp(`.*${escapeRegex(def.suffix)}$`);
|
|
950
|
+
def.pattern ?? (def.pattern = pattern);
|
|
951
|
+
inst._zod.onattach.push((inst) => {
|
|
952
|
+
const bag = inst._zod.bag;
|
|
953
|
+
bag.patterns ?? (bag.patterns = /* @__PURE__ */ new Set());
|
|
954
|
+
bag.patterns.add(pattern);
|
|
955
|
+
});
|
|
956
|
+
inst._zod.check = (payload) => {
|
|
957
|
+
if (payload.value.endsWith(def.suffix)) return;
|
|
958
|
+
payload.issues.push({
|
|
959
|
+
origin: "string",
|
|
960
|
+
code: "invalid_format",
|
|
961
|
+
format: "ends_with",
|
|
962
|
+
suffix: def.suffix,
|
|
963
|
+
input: payload.value,
|
|
964
|
+
inst,
|
|
965
|
+
continue: !def.abort
|
|
966
|
+
});
|
|
967
|
+
};
|
|
968
|
+
});
|
|
969
|
+
const $ZodCheckOverwrite = /*@__PURE__*/ $constructor("$ZodCheckOverwrite", (inst, def) => {
|
|
970
|
+
$ZodCheck.init(inst, def);
|
|
971
|
+
inst._zod.check = (payload) => {
|
|
972
|
+
payload.value = def.tx(payload.value);
|
|
973
|
+
};
|
|
974
|
+
});
|
|
975
|
+
//#endregion
|
|
976
|
+
//#region ../../node_modules/zod/v4/core/doc.js
|
|
977
|
+
var Doc = class {
|
|
978
|
+
constructor(args = []) {
|
|
979
|
+
this.content = [];
|
|
980
|
+
this.indent = 0;
|
|
981
|
+
if (this) this.args = args;
|
|
982
|
+
}
|
|
983
|
+
indented(fn) {
|
|
984
|
+
this.indent += 1;
|
|
985
|
+
fn(this);
|
|
986
|
+
this.indent -= 1;
|
|
987
|
+
}
|
|
988
|
+
write(arg) {
|
|
989
|
+
if (typeof arg === "function") {
|
|
990
|
+
arg(this, { execution: "sync" });
|
|
991
|
+
arg(this, { execution: "async" });
|
|
992
|
+
return;
|
|
993
|
+
}
|
|
994
|
+
const lines = arg.split("\n").filter((x) => x);
|
|
995
|
+
const minIndent = Math.min(...lines.map((x) => x.length - x.trimStart().length));
|
|
996
|
+
const dedented = lines.map((x) => x.slice(minIndent)).map((x) => " ".repeat(this.indent * 2) + x);
|
|
997
|
+
for (const line of dedented) this.content.push(line);
|
|
998
|
+
}
|
|
999
|
+
compile() {
|
|
1000
|
+
const F = Function;
|
|
1001
|
+
const args = this?.args;
|
|
1002
|
+
const lines = [...(this?.content ?? [``]).map((x) => ` ${x}`)];
|
|
1003
|
+
return new F(...args, lines.join("\n"));
|
|
1004
|
+
}
|
|
1005
|
+
};
|
|
1006
|
+
//#endregion
|
|
1007
|
+
//#region ../../node_modules/zod/v4/core/versions.js
|
|
1008
|
+
const version = {
|
|
1009
|
+
major: 4,
|
|
1010
|
+
minor: 4,
|
|
1011
|
+
patch: 3
|
|
1012
|
+
};
|
|
1013
|
+
//#endregion
|
|
1014
|
+
//#region ../../node_modules/zod/v4/core/schemas.js
|
|
1015
|
+
const $ZodType = /*@__PURE__*/ $constructor("$ZodType", (inst, def) => {
|
|
1016
|
+
var _a;
|
|
1017
|
+
inst ?? (inst = {});
|
|
1018
|
+
inst._zod.def = def;
|
|
1019
|
+
inst._zod.bag = inst._zod.bag || {};
|
|
1020
|
+
inst._zod.version = version;
|
|
1021
|
+
const checks = [...inst._zod.def.checks ?? []];
|
|
1022
|
+
if (inst._zod.traits.has("$ZodCheck")) checks.unshift(inst);
|
|
1023
|
+
for (const ch of checks) for (const fn of ch._zod.onattach) fn(inst);
|
|
1024
|
+
if (checks.length === 0) {
|
|
1025
|
+
(_a = inst._zod).deferred ?? (_a.deferred = []);
|
|
1026
|
+
inst._zod.deferred?.push(() => {
|
|
1027
|
+
inst._zod.run = inst._zod.parse;
|
|
1028
|
+
});
|
|
1029
|
+
} else {
|
|
1030
|
+
const runChecks = (payload, checks, ctx) => {
|
|
1031
|
+
let isAborted = aborted(payload);
|
|
1032
|
+
let asyncResult;
|
|
1033
|
+
for (const ch of checks) {
|
|
1034
|
+
if (ch._zod.def.when) {
|
|
1035
|
+
if (explicitlyAborted(payload)) continue;
|
|
1036
|
+
if (!ch._zod.def.when(payload)) continue;
|
|
1037
|
+
} else if (isAborted) continue;
|
|
1038
|
+
const currLen = payload.issues.length;
|
|
1039
|
+
const _ = ch._zod.check(payload);
|
|
1040
|
+
if (_ instanceof Promise && ctx?.async === false) throw new $ZodAsyncError();
|
|
1041
|
+
if (asyncResult || _ instanceof Promise) asyncResult = (asyncResult ?? Promise.resolve()).then(async () => {
|
|
1042
|
+
await _;
|
|
1043
|
+
if (payload.issues.length === currLen) return;
|
|
1044
|
+
if (!isAborted) isAborted = aborted(payload, currLen);
|
|
1045
|
+
});
|
|
1046
|
+
else {
|
|
1047
|
+
if (payload.issues.length === currLen) continue;
|
|
1048
|
+
if (!isAborted) isAborted = aborted(payload, currLen);
|
|
1049
|
+
}
|
|
1050
|
+
}
|
|
1051
|
+
if (asyncResult) return asyncResult.then(() => {
|
|
1052
|
+
return payload;
|
|
1053
|
+
});
|
|
1054
|
+
return payload;
|
|
1055
|
+
};
|
|
1056
|
+
const handleCanaryResult = (canary, payload, ctx) => {
|
|
1057
|
+
if (aborted(canary)) {
|
|
1058
|
+
canary.aborted = true;
|
|
1059
|
+
return canary;
|
|
1060
|
+
}
|
|
1061
|
+
const checkResult = runChecks(payload, checks, ctx);
|
|
1062
|
+
if (checkResult instanceof Promise) {
|
|
1063
|
+
if (ctx.async === false) throw new $ZodAsyncError();
|
|
1064
|
+
return checkResult.then((checkResult) => inst._zod.parse(checkResult, ctx));
|
|
1065
|
+
}
|
|
1066
|
+
return inst._zod.parse(checkResult, ctx);
|
|
1067
|
+
};
|
|
1068
|
+
inst._zod.run = (payload, ctx) => {
|
|
1069
|
+
if (ctx.skipChecks) return inst._zod.parse(payload, ctx);
|
|
1070
|
+
if (ctx.direction === "backward") {
|
|
1071
|
+
const canary = inst._zod.parse({
|
|
1072
|
+
value: payload.value,
|
|
1073
|
+
issues: []
|
|
1074
|
+
}, {
|
|
1075
|
+
...ctx,
|
|
1076
|
+
skipChecks: true
|
|
1077
|
+
});
|
|
1078
|
+
if (canary instanceof Promise) return canary.then((canary) => {
|
|
1079
|
+
return handleCanaryResult(canary, payload, ctx);
|
|
1080
|
+
});
|
|
1081
|
+
return handleCanaryResult(canary, payload, ctx);
|
|
1082
|
+
}
|
|
1083
|
+
const result = inst._zod.parse(payload, ctx);
|
|
1084
|
+
if (result instanceof Promise) {
|
|
1085
|
+
if (ctx.async === false) throw new $ZodAsyncError();
|
|
1086
|
+
return result.then((result) => runChecks(result, checks, ctx));
|
|
1087
|
+
}
|
|
1088
|
+
return runChecks(result, checks, ctx);
|
|
1089
|
+
};
|
|
1090
|
+
}
|
|
1091
|
+
defineLazy(inst, "~standard", () => ({
|
|
1092
|
+
validate: (value) => {
|
|
1093
|
+
try {
|
|
1094
|
+
const r = safeParse$1(inst, value);
|
|
1095
|
+
return r.success ? { value: r.data } : { issues: r.error?.issues };
|
|
1096
|
+
} catch (_) {
|
|
1097
|
+
return safeParseAsync$1(inst, value).then((r) => r.success ? { value: r.data } : { issues: r.error?.issues });
|
|
1098
|
+
}
|
|
1099
|
+
},
|
|
1100
|
+
vendor: "zod",
|
|
1101
|
+
version: 1
|
|
1102
|
+
}));
|
|
1103
|
+
});
|
|
1104
|
+
const $ZodString = /*@__PURE__*/ $constructor("$ZodString", (inst, def) => {
|
|
1105
|
+
$ZodType.init(inst, def);
|
|
1106
|
+
inst._zod.pattern = [...inst?._zod.bag?.patterns ?? []].pop() ?? string$2(inst._zod.bag);
|
|
1107
|
+
inst._zod.parse = (payload, _) => {
|
|
1108
|
+
if (def.coerce) try {
|
|
1109
|
+
payload.value = String(payload.value);
|
|
1110
|
+
} catch (_) {}
|
|
1111
|
+
if (typeof payload.value === "string") return payload;
|
|
1112
|
+
payload.issues.push({
|
|
1113
|
+
expected: "string",
|
|
1114
|
+
code: "invalid_type",
|
|
1115
|
+
input: payload.value,
|
|
1116
|
+
inst
|
|
1117
|
+
});
|
|
1118
|
+
return payload;
|
|
1119
|
+
};
|
|
1120
|
+
});
|
|
1121
|
+
const $ZodStringFormat = /*@__PURE__*/ $constructor("$ZodStringFormat", (inst, def) => {
|
|
1122
|
+
$ZodCheckStringFormat.init(inst, def);
|
|
1123
|
+
$ZodString.init(inst, def);
|
|
1124
|
+
});
|
|
1125
|
+
const $ZodGUID = /*@__PURE__*/ $constructor("$ZodGUID", (inst, def) => {
|
|
1126
|
+
def.pattern ?? (def.pattern = guid);
|
|
1127
|
+
$ZodStringFormat.init(inst, def);
|
|
1128
|
+
});
|
|
1129
|
+
const $ZodUUID = /*@__PURE__*/ $constructor("$ZodUUID", (inst, def) => {
|
|
1130
|
+
if (def.version) {
|
|
1131
|
+
const v = {
|
|
1132
|
+
v1: 1,
|
|
1133
|
+
v2: 2,
|
|
1134
|
+
v3: 3,
|
|
1135
|
+
v4: 4,
|
|
1136
|
+
v5: 5,
|
|
1137
|
+
v6: 6,
|
|
1138
|
+
v7: 7,
|
|
1139
|
+
v8: 8
|
|
1140
|
+
}[def.version];
|
|
1141
|
+
if (v === void 0) throw new Error(`Invalid UUID version: "${def.version}"`);
|
|
1142
|
+
def.pattern ?? (def.pattern = uuid(v));
|
|
1143
|
+
} else def.pattern ?? (def.pattern = uuid());
|
|
1144
|
+
$ZodStringFormat.init(inst, def);
|
|
1145
|
+
});
|
|
1146
|
+
const $ZodEmail = /*@__PURE__*/ $constructor("$ZodEmail", (inst, def) => {
|
|
1147
|
+
def.pattern ?? (def.pattern = email);
|
|
1148
|
+
$ZodStringFormat.init(inst, def);
|
|
1149
|
+
});
|
|
1150
|
+
const $ZodURL = /*@__PURE__*/ $constructor("$ZodURL", (inst, def) => {
|
|
1151
|
+
$ZodStringFormat.init(inst, def);
|
|
1152
|
+
inst._zod.check = (payload) => {
|
|
1153
|
+
try {
|
|
1154
|
+
const trimmed = payload.value.trim();
|
|
1155
|
+
if (!def.normalize && def.protocol?.source === httpProtocol.source) {
|
|
1156
|
+
if (!/^https?:\/\//i.test(trimmed)) {
|
|
1157
|
+
payload.issues.push({
|
|
1158
|
+
code: "invalid_format",
|
|
1159
|
+
format: "url",
|
|
1160
|
+
note: "Invalid URL format",
|
|
1161
|
+
input: payload.value,
|
|
1162
|
+
inst,
|
|
1163
|
+
continue: !def.abort
|
|
1164
|
+
});
|
|
1165
|
+
return;
|
|
1166
|
+
}
|
|
1167
|
+
}
|
|
1168
|
+
const url = new URL(trimmed);
|
|
1169
|
+
if (def.hostname) {
|
|
1170
|
+
def.hostname.lastIndex = 0;
|
|
1171
|
+
if (!def.hostname.test(url.hostname)) payload.issues.push({
|
|
1172
|
+
code: "invalid_format",
|
|
1173
|
+
format: "url",
|
|
1174
|
+
note: "Invalid hostname",
|
|
1175
|
+
pattern: def.hostname.source,
|
|
1176
|
+
input: payload.value,
|
|
1177
|
+
inst,
|
|
1178
|
+
continue: !def.abort
|
|
1179
|
+
});
|
|
1180
|
+
}
|
|
1181
|
+
if (def.protocol) {
|
|
1182
|
+
def.protocol.lastIndex = 0;
|
|
1183
|
+
if (!def.protocol.test(url.protocol.endsWith(":") ? url.protocol.slice(0, -1) : url.protocol)) payload.issues.push({
|
|
1184
|
+
code: "invalid_format",
|
|
1185
|
+
format: "url",
|
|
1186
|
+
note: "Invalid protocol",
|
|
1187
|
+
pattern: def.protocol.source,
|
|
1188
|
+
input: payload.value,
|
|
1189
|
+
inst,
|
|
1190
|
+
continue: !def.abort
|
|
1191
|
+
});
|
|
1192
|
+
}
|
|
1193
|
+
if (def.normalize) payload.value = url.href;
|
|
1194
|
+
else payload.value = trimmed;
|
|
1195
|
+
return;
|
|
1196
|
+
} catch (_) {
|
|
1197
|
+
payload.issues.push({
|
|
1198
|
+
code: "invalid_format",
|
|
1199
|
+
format: "url",
|
|
1200
|
+
input: payload.value,
|
|
1201
|
+
inst,
|
|
1202
|
+
continue: !def.abort
|
|
1203
|
+
});
|
|
1204
|
+
}
|
|
1205
|
+
};
|
|
1206
|
+
});
|
|
1207
|
+
const $ZodEmoji = /*@__PURE__*/ $constructor("$ZodEmoji", (inst, def) => {
|
|
1208
|
+
def.pattern ?? (def.pattern = emoji());
|
|
1209
|
+
$ZodStringFormat.init(inst, def);
|
|
1210
|
+
});
|
|
1211
|
+
const $ZodNanoID = /*@__PURE__*/ $constructor("$ZodNanoID", (inst, def) => {
|
|
1212
|
+
def.pattern ?? (def.pattern = nanoid);
|
|
1213
|
+
$ZodStringFormat.init(inst, def);
|
|
1214
|
+
});
|
|
1215
|
+
/**
|
|
1216
|
+
* @deprecated CUID v1 is deprecated by its authors due to information leakage
|
|
1217
|
+
* (timestamps embedded in the id). Use {@link $ZodCUID2} instead.
|
|
1218
|
+
* See https://github.com/paralleldrive/cuid.
|
|
1219
|
+
*/
|
|
1220
|
+
const $ZodCUID = /*@__PURE__*/ $constructor("$ZodCUID", (inst, def) => {
|
|
1221
|
+
def.pattern ?? (def.pattern = cuid);
|
|
1222
|
+
$ZodStringFormat.init(inst, def);
|
|
1223
|
+
});
|
|
1224
|
+
const $ZodCUID2 = /*@__PURE__*/ $constructor("$ZodCUID2", (inst, def) => {
|
|
1225
|
+
def.pattern ?? (def.pattern = cuid2);
|
|
1226
|
+
$ZodStringFormat.init(inst, def);
|
|
1227
|
+
});
|
|
1228
|
+
const $ZodULID = /*@__PURE__*/ $constructor("$ZodULID", (inst, def) => {
|
|
1229
|
+
def.pattern ?? (def.pattern = ulid);
|
|
1230
|
+
$ZodStringFormat.init(inst, def);
|
|
1231
|
+
});
|
|
1232
|
+
const $ZodXID = /*@__PURE__*/ $constructor("$ZodXID", (inst, def) => {
|
|
1233
|
+
def.pattern ?? (def.pattern = xid);
|
|
1234
|
+
$ZodStringFormat.init(inst, def);
|
|
1235
|
+
});
|
|
1236
|
+
const $ZodKSUID = /*@__PURE__*/ $constructor("$ZodKSUID", (inst, def) => {
|
|
1237
|
+
def.pattern ?? (def.pattern = ksuid);
|
|
1238
|
+
$ZodStringFormat.init(inst, def);
|
|
1239
|
+
});
|
|
1240
|
+
const $ZodISODateTime = /*@__PURE__*/ $constructor("$ZodISODateTime", (inst, def) => {
|
|
1241
|
+
def.pattern ?? (def.pattern = datetime$1(def));
|
|
1242
|
+
$ZodStringFormat.init(inst, def);
|
|
1243
|
+
});
|
|
1244
|
+
const $ZodISODate = /*@__PURE__*/ $constructor("$ZodISODate", (inst, def) => {
|
|
1245
|
+
def.pattern ?? (def.pattern = date$1);
|
|
1246
|
+
$ZodStringFormat.init(inst, def);
|
|
1247
|
+
});
|
|
1248
|
+
const $ZodISOTime = /*@__PURE__*/ $constructor("$ZodISOTime", (inst, def) => {
|
|
1249
|
+
def.pattern ?? (def.pattern = time$1(def));
|
|
1250
|
+
$ZodStringFormat.init(inst, def);
|
|
1251
|
+
});
|
|
1252
|
+
const $ZodISODuration = /*@__PURE__*/ $constructor("$ZodISODuration", (inst, def) => {
|
|
1253
|
+
def.pattern ?? (def.pattern = duration$1);
|
|
1254
|
+
$ZodStringFormat.init(inst, def);
|
|
1255
|
+
});
|
|
1256
|
+
const $ZodIPv4 = /*@__PURE__*/ $constructor("$ZodIPv4", (inst, def) => {
|
|
1257
|
+
def.pattern ?? (def.pattern = ipv4);
|
|
1258
|
+
$ZodStringFormat.init(inst, def);
|
|
1259
|
+
inst._zod.bag.format = `ipv4`;
|
|
1260
|
+
});
|
|
1261
|
+
const $ZodIPv6 = /*@__PURE__*/ $constructor("$ZodIPv6", (inst, def) => {
|
|
1262
|
+
def.pattern ?? (def.pattern = ipv6);
|
|
1263
|
+
$ZodStringFormat.init(inst, def);
|
|
1264
|
+
inst._zod.bag.format = `ipv6`;
|
|
1265
|
+
inst._zod.check = (payload) => {
|
|
1266
|
+
try {
|
|
1267
|
+
new URL(`http://[${payload.value}]`);
|
|
1268
|
+
} catch {
|
|
1269
|
+
payload.issues.push({
|
|
1270
|
+
code: "invalid_format",
|
|
1271
|
+
format: "ipv6",
|
|
1272
|
+
input: payload.value,
|
|
1273
|
+
inst,
|
|
1274
|
+
continue: !def.abort
|
|
1275
|
+
});
|
|
1276
|
+
}
|
|
1277
|
+
};
|
|
1278
|
+
});
|
|
1279
|
+
const $ZodCIDRv4 = /*@__PURE__*/ $constructor("$ZodCIDRv4", (inst, def) => {
|
|
1280
|
+
def.pattern ?? (def.pattern = cidrv4);
|
|
1281
|
+
$ZodStringFormat.init(inst, def);
|
|
1282
|
+
});
|
|
1283
|
+
const $ZodCIDRv6 = /*@__PURE__*/ $constructor("$ZodCIDRv6", (inst, def) => {
|
|
1284
|
+
def.pattern ?? (def.pattern = cidrv6);
|
|
1285
|
+
$ZodStringFormat.init(inst, def);
|
|
1286
|
+
inst._zod.check = (payload) => {
|
|
1287
|
+
const parts = payload.value.split("/");
|
|
1288
|
+
try {
|
|
1289
|
+
if (parts.length !== 2) throw new Error();
|
|
1290
|
+
const [address, prefix] = parts;
|
|
1291
|
+
if (!prefix) throw new Error();
|
|
1292
|
+
const prefixNum = Number(prefix);
|
|
1293
|
+
if (`${prefixNum}` !== prefix) throw new Error();
|
|
1294
|
+
if (prefixNum < 0 || prefixNum > 128) throw new Error();
|
|
1295
|
+
new URL(`http://[${address}]`);
|
|
1296
|
+
} catch {
|
|
1297
|
+
payload.issues.push({
|
|
1298
|
+
code: "invalid_format",
|
|
1299
|
+
format: "cidrv6",
|
|
1300
|
+
input: payload.value,
|
|
1301
|
+
inst,
|
|
1302
|
+
continue: !def.abort
|
|
1303
|
+
});
|
|
1304
|
+
}
|
|
1305
|
+
};
|
|
1306
|
+
});
|
|
1307
|
+
function isValidBase64(data) {
|
|
1308
|
+
if (data === "") return true;
|
|
1309
|
+
if (/\s/.test(data)) return false;
|
|
1310
|
+
if (data.length % 4 !== 0) return false;
|
|
1311
|
+
try {
|
|
1312
|
+
atob(data);
|
|
1313
|
+
return true;
|
|
1314
|
+
} catch {
|
|
1315
|
+
return false;
|
|
1316
|
+
}
|
|
1317
|
+
}
|
|
1318
|
+
const $ZodBase64 = /*@__PURE__*/ $constructor("$ZodBase64", (inst, def) => {
|
|
1319
|
+
def.pattern ?? (def.pattern = base64);
|
|
1320
|
+
$ZodStringFormat.init(inst, def);
|
|
1321
|
+
inst._zod.bag.contentEncoding = "base64";
|
|
1322
|
+
inst._zod.check = (payload) => {
|
|
1323
|
+
if (isValidBase64(payload.value)) return;
|
|
1324
|
+
payload.issues.push({
|
|
1325
|
+
code: "invalid_format",
|
|
1326
|
+
format: "base64",
|
|
1327
|
+
input: payload.value,
|
|
1328
|
+
inst,
|
|
1329
|
+
continue: !def.abort
|
|
1330
|
+
});
|
|
1331
|
+
};
|
|
1332
|
+
});
|
|
1333
|
+
function isValidBase64URL(data) {
|
|
1334
|
+
if (!base64url.test(data)) return false;
|
|
1335
|
+
const base64 = data.replace(/[-_]/g, (c) => c === "-" ? "+" : "/");
|
|
1336
|
+
return isValidBase64(base64.padEnd(Math.ceil(base64.length / 4) * 4, "="));
|
|
1337
|
+
}
|
|
1338
|
+
const $ZodBase64URL = /*@__PURE__*/ $constructor("$ZodBase64URL", (inst, def) => {
|
|
1339
|
+
def.pattern ?? (def.pattern = base64url);
|
|
1340
|
+
$ZodStringFormat.init(inst, def);
|
|
1341
|
+
inst._zod.bag.contentEncoding = "base64url";
|
|
1342
|
+
inst._zod.check = (payload) => {
|
|
1343
|
+
if (isValidBase64URL(payload.value)) return;
|
|
1344
|
+
payload.issues.push({
|
|
1345
|
+
code: "invalid_format",
|
|
1346
|
+
format: "base64url",
|
|
1347
|
+
input: payload.value,
|
|
1348
|
+
inst,
|
|
1349
|
+
continue: !def.abort
|
|
1350
|
+
});
|
|
1351
|
+
};
|
|
1352
|
+
});
|
|
1353
|
+
const $ZodE164 = /*@__PURE__*/ $constructor("$ZodE164", (inst, def) => {
|
|
1354
|
+
def.pattern ?? (def.pattern = e164);
|
|
1355
|
+
$ZodStringFormat.init(inst, def);
|
|
1356
|
+
});
|
|
1357
|
+
function isValidJWT(token, algorithm = null) {
|
|
1358
|
+
try {
|
|
1359
|
+
const tokensParts = token.split(".");
|
|
1360
|
+
if (tokensParts.length !== 3) return false;
|
|
1361
|
+
const [header] = tokensParts;
|
|
1362
|
+
if (!header) return false;
|
|
1363
|
+
const parsedHeader = JSON.parse(atob(header));
|
|
1364
|
+
if ("typ" in parsedHeader && parsedHeader?.typ !== "JWT") return false;
|
|
1365
|
+
if (!parsedHeader.alg) return false;
|
|
1366
|
+
if (algorithm && (!("alg" in parsedHeader) || parsedHeader.alg !== algorithm)) return false;
|
|
1367
|
+
return true;
|
|
1368
|
+
} catch {
|
|
1369
|
+
return false;
|
|
1370
|
+
}
|
|
1371
|
+
}
|
|
1372
|
+
const $ZodJWT = /*@__PURE__*/ $constructor("$ZodJWT", (inst, def) => {
|
|
1373
|
+
$ZodStringFormat.init(inst, def);
|
|
1374
|
+
inst._zod.check = (payload) => {
|
|
1375
|
+
if (isValidJWT(payload.value, def.alg)) return;
|
|
1376
|
+
payload.issues.push({
|
|
1377
|
+
code: "invalid_format",
|
|
1378
|
+
format: "jwt",
|
|
1379
|
+
input: payload.value,
|
|
1380
|
+
inst,
|
|
1381
|
+
continue: !def.abort
|
|
1382
|
+
});
|
|
1383
|
+
};
|
|
1384
|
+
});
|
|
1385
|
+
const $ZodNumber = /*@__PURE__*/ $constructor("$ZodNumber", (inst, def) => {
|
|
1386
|
+
$ZodType.init(inst, def);
|
|
1387
|
+
inst._zod.pattern = inst._zod.bag.pattern ?? number$2;
|
|
1388
|
+
inst._zod.parse = (payload, _ctx) => {
|
|
1389
|
+
if (def.coerce) try {
|
|
1390
|
+
payload.value = Number(payload.value);
|
|
1391
|
+
} catch (_) {}
|
|
1392
|
+
const input = payload.value;
|
|
1393
|
+
if (typeof input === "number" && !Number.isNaN(input) && Number.isFinite(input)) return payload;
|
|
1394
|
+
const received = typeof input === "number" ? Number.isNaN(input) ? "NaN" : !Number.isFinite(input) ? "Infinity" : void 0 : void 0;
|
|
1395
|
+
payload.issues.push({
|
|
1396
|
+
expected: "number",
|
|
1397
|
+
code: "invalid_type",
|
|
1398
|
+
input,
|
|
1399
|
+
inst,
|
|
1400
|
+
...received ? { received } : {}
|
|
1401
|
+
});
|
|
1402
|
+
return payload;
|
|
1403
|
+
};
|
|
1404
|
+
});
|
|
1405
|
+
const $ZodNumberFormat = /*@__PURE__*/ $constructor("$ZodNumberFormat", (inst, def) => {
|
|
1406
|
+
$ZodCheckNumberFormat.init(inst, def);
|
|
1407
|
+
$ZodNumber.init(inst, def);
|
|
1408
|
+
});
|
|
1409
|
+
const $ZodBoolean = /*@__PURE__*/ $constructor("$ZodBoolean", (inst, def) => {
|
|
1410
|
+
$ZodType.init(inst, def);
|
|
1411
|
+
inst._zod.pattern = boolean$1;
|
|
1412
|
+
inst._zod.parse = (payload, _ctx) => {
|
|
1413
|
+
if (def.coerce) try {
|
|
1414
|
+
payload.value = Boolean(payload.value);
|
|
1415
|
+
} catch (_) {}
|
|
1416
|
+
const input = payload.value;
|
|
1417
|
+
if (typeof input === "boolean") return payload;
|
|
1418
|
+
payload.issues.push({
|
|
1419
|
+
expected: "boolean",
|
|
1420
|
+
code: "invalid_type",
|
|
1421
|
+
input,
|
|
1422
|
+
inst
|
|
1423
|
+
});
|
|
1424
|
+
return payload;
|
|
1425
|
+
};
|
|
1426
|
+
});
|
|
1427
|
+
const $ZodUnknown = /*@__PURE__*/ $constructor("$ZodUnknown", (inst, def) => {
|
|
1428
|
+
$ZodType.init(inst, def);
|
|
1429
|
+
inst._zod.parse = (payload) => payload;
|
|
1430
|
+
});
|
|
1431
|
+
const $ZodNever = /*@__PURE__*/ $constructor("$ZodNever", (inst, def) => {
|
|
1432
|
+
$ZodType.init(inst, def);
|
|
1433
|
+
inst._zod.parse = (payload, _ctx) => {
|
|
1434
|
+
payload.issues.push({
|
|
1435
|
+
expected: "never",
|
|
1436
|
+
code: "invalid_type",
|
|
1437
|
+
input: payload.value,
|
|
1438
|
+
inst
|
|
1439
|
+
});
|
|
1440
|
+
return payload;
|
|
1441
|
+
};
|
|
1442
|
+
});
|
|
1443
|
+
function handleArrayResult(result, final, index) {
|
|
1444
|
+
if (result.issues.length) final.issues.push(...prefixIssues(index, result.issues));
|
|
1445
|
+
final.value[index] = result.value;
|
|
1446
|
+
}
|
|
1447
|
+
const $ZodArray = /*@__PURE__*/ $constructor("$ZodArray", (inst, def) => {
|
|
1448
|
+
$ZodType.init(inst, def);
|
|
1449
|
+
inst._zod.parse = (payload, ctx) => {
|
|
1450
|
+
const input = payload.value;
|
|
1451
|
+
if (!Array.isArray(input)) {
|
|
1452
|
+
payload.issues.push({
|
|
1453
|
+
expected: "array",
|
|
1454
|
+
code: "invalid_type",
|
|
1455
|
+
input,
|
|
1456
|
+
inst
|
|
1457
|
+
});
|
|
1458
|
+
return payload;
|
|
1459
|
+
}
|
|
1460
|
+
payload.value = Array(input.length);
|
|
1461
|
+
const proms = [];
|
|
1462
|
+
for (let i = 0; i < input.length; i++) {
|
|
1463
|
+
const item = input[i];
|
|
1464
|
+
const result = def.element._zod.run({
|
|
1465
|
+
value: item,
|
|
1466
|
+
issues: []
|
|
1467
|
+
}, ctx);
|
|
1468
|
+
if (result instanceof Promise) proms.push(result.then((result) => handleArrayResult(result, payload, i)));
|
|
1469
|
+
else handleArrayResult(result, payload, i);
|
|
1470
|
+
}
|
|
1471
|
+
if (proms.length) return Promise.all(proms).then(() => payload);
|
|
1472
|
+
return payload;
|
|
1473
|
+
};
|
|
1474
|
+
});
|
|
1475
|
+
function handlePropertyResult(result, final, key, input, isOptionalIn, isOptionalOut) {
|
|
1476
|
+
const isPresent = key in input;
|
|
1477
|
+
if (result.issues.length) {
|
|
1478
|
+
if (isOptionalIn && isOptionalOut && !isPresent) return;
|
|
1479
|
+
final.issues.push(...prefixIssues(key, result.issues));
|
|
1480
|
+
}
|
|
1481
|
+
if (!isPresent && !isOptionalIn) {
|
|
1482
|
+
if (!result.issues.length) final.issues.push({
|
|
1483
|
+
code: "invalid_type",
|
|
1484
|
+
expected: "nonoptional",
|
|
1485
|
+
input: void 0,
|
|
1486
|
+
path: [key]
|
|
1487
|
+
});
|
|
1488
|
+
return;
|
|
1489
|
+
}
|
|
1490
|
+
if (result.value === void 0) {
|
|
1491
|
+
if (isPresent) final.value[key] = void 0;
|
|
1492
|
+
} else final.value[key] = result.value;
|
|
1493
|
+
}
|
|
1494
|
+
function normalizeDef(def) {
|
|
1495
|
+
const keys = Object.keys(def.shape);
|
|
1496
|
+
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`);
|
|
1497
|
+
const okeys = optionalKeys(def.shape);
|
|
1498
|
+
return {
|
|
1499
|
+
...def,
|
|
1500
|
+
keys,
|
|
1501
|
+
keySet: new Set(keys),
|
|
1502
|
+
numKeys: keys.length,
|
|
1503
|
+
optionalKeys: new Set(okeys)
|
|
1504
|
+
};
|
|
1505
|
+
}
|
|
1506
|
+
function handleCatchall(proms, input, payload, ctx, def, inst) {
|
|
1507
|
+
const unrecognized = [];
|
|
1508
|
+
const keySet = def.keySet;
|
|
1509
|
+
const _catchall = def.catchall._zod;
|
|
1510
|
+
const t = _catchall.def.type;
|
|
1511
|
+
const isOptionalIn = _catchall.optin === "optional";
|
|
1512
|
+
const isOptionalOut = _catchall.optout === "optional";
|
|
1513
|
+
for (const key in input) {
|
|
1514
|
+
if (key === "__proto__") continue;
|
|
1515
|
+
if (keySet.has(key)) continue;
|
|
1516
|
+
if (t === "never") {
|
|
1517
|
+
unrecognized.push(key);
|
|
1518
|
+
continue;
|
|
1519
|
+
}
|
|
1520
|
+
const r = _catchall.run({
|
|
1521
|
+
value: input[key],
|
|
1522
|
+
issues: []
|
|
1523
|
+
}, ctx);
|
|
1524
|
+
if (r instanceof Promise) proms.push(r.then((r) => handlePropertyResult(r, payload, key, input, isOptionalIn, isOptionalOut)));
|
|
1525
|
+
else handlePropertyResult(r, payload, key, input, isOptionalIn, isOptionalOut);
|
|
1526
|
+
}
|
|
1527
|
+
if (unrecognized.length) payload.issues.push({
|
|
1528
|
+
code: "unrecognized_keys",
|
|
1529
|
+
keys: unrecognized,
|
|
1530
|
+
input,
|
|
1531
|
+
inst
|
|
1532
|
+
});
|
|
1533
|
+
if (!proms.length) return payload;
|
|
1534
|
+
return Promise.all(proms).then(() => {
|
|
1535
|
+
return payload;
|
|
1536
|
+
});
|
|
1537
|
+
}
|
|
1538
|
+
const $ZodObject = /*@__PURE__*/ $constructor("$ZodObject", (inst, def) => {
|
|
1539
|
+
$ZodType.init(inst, def);
|
|
1540
|
+
if (!Object.getOwnPropertyDescriptor(def, "shape")?.get) {
|
|
1541
|
+
const sh = def.shape;
|
|
1542
|
+
Object.defineProperty(def, "shape", { get: () => {
|
|
1543
|
+
const newSh = { ...sh };
|
|
1544
|
+
Object.defineProperty(def, "shape", { value: newSh });
|
|
1545
|
+
return newSh;
|
|
1546
|
+
} });
|
|
1547
|
+
}
|
|
1548
|
+
const _normalized = cached(() => normalizeDef(def));
|
|
1549
|
+
defineLazy(inst._zod, "propValues", () => {
|
|
1550
|
+
const shape = def.shape;
|
|
1551
|
+
const propValues = {};
|
|
1552
|
+
for (const key in shape) {
|
|
1553
|
+
const field = shape[key]._zod;
|
|
1554
|
+
if (field.values) {
|
|
1555
|
+
propValues[key] ?? (propValues[key] = /* @__PURE__ */ new Set());
|
|
1556
|
+
for (const v of field.values) propValues[key].add(v);
|
|
1557
|
+
}
|
|
1558
|
+
}
|
|
1559
|
+
return propValues;
|
|
1560
|
+
});
|
|
1561
|
+
const isObject$1 = isObject;
|
|
1562
|
+
const catchall = def.catchall;
|
|
1563
|
+
let value;
|
|
1564
|
+
inst._zod.parse = (payload, ctx) => {
|
|
1565
|
+
value ?? (value = _normalized.value);
|
|
1566
|
+
const input = payload.value;
|
|
1567
|
+
if (!isObject$1(input)) {
|
|
1568
|
+
payload.issues.push({
|
|
1569
|
+
expected: "object",
|
|
1570
|
+
code: "invalid_type",
|
|
1571
|
+
input,
|
|
1572
|
+
inst
|
|
1573
|
+
});
|
|
1574
|
+
return payload;
|
|
1575
|
+
}
|
|
1576
|
+
payload.value = {};
|
|
1577
|
+
const proms = [];
|
|
1578
|
+
const shape = value.shape;
|
|
1579
|
+
for (const key of value.keys) {
|
|
1580
|
+
const el = shape[key];
|
|
1581
|
+
const isOptionalIn = el._zod.optin === "optional";
|
|
1582
|
+
const isOptionalOut = el._zod.optout === "optional";
|
|
1583
|
+
const r = el._zod.run({
|
|
1584
|
+
value: input[key],
|
|
1585
|
+
issues: []
|
|
1586
|
+
}, ctx);
|
|
1587
|
+
if (r instanceof Promise) proms.push(r.then((r) => handlePropertyResult(r, payload, key, input, isOptionalIn, isOptionalOut)));
|
|
1588
|
+
else handlePropertyResult(r, payload, key, input, isOptionalIn, isOptionalOut);
|
|
1589
|
+
}
|
|
1590
|
+
if (!catchall) return proms.length ? Promise.all(proms).then(() => payload) : payload;
|
|
1591
|
+
return handleCatchall(proms, input, payload, ctx, _normalized.value, inst);
|
|
1592
|
+
};
|
|
1593
|
+
});
|
|
1594
|
+
const $ZodObjectJIT = /*@__PURE__*/ $constructor("$ZodObjectJIT", (inst, def) => {
|
|
1595
|
+
$ZodObject.init(inst, def);
|
|
1596
|
+
const superParse = inst._zod.parse;
|
|
1597
|
+
const _normalized = cached(() => normalizeDef(def));
|
|
1598
|
+
const generateFastpass = (shape) => {
|
|
1599
|
+
const doc = new Doc([
|
|
1600
|
+
"shape",
|
|
1601
|
+
"payload",
|
|
1602
|
+
"ctx"
|
|
1603
|
+
]);
|
|
1604
|
+
const normalized = _normalized.value;
|
|
1605
|
+
const parseStr = (key) => {
|
|
1606
|
+
const k = esc(key);
|
|
1607
|
+
return `shape[${k}]._zod.run({ value: input[${k}], issues: [] }, ctx)`;
|
|
1608
|
+
};
|
|
1609
|
+
doc.write(`const input = payload.value;`);
|
|
1610
|
+
const ids = Object.create(null);
|
|
1611
|
+
let counter = 0;
|
|
1612
|
+
for (const key of normalized.keys) ids[key] = `key_${counter++}`;
|
|
1613
|
+
doc.write(`const newResult = {};`);
|
|
1614
|
+
for (const key of normalized.keys) {
|
|
1615
|
+
const id = ids[key];
|
|
1616
|
+
const k = esc(key);
|
|
1617
|
+
const schema = shape[key];
|
|
1618
|
+
const isOptionalIn = schema?._zod?.optin === "optional";
|
|
1619
|
+
const isOptionalOut = schema?._zod?.optout === "optional";
|
|
1620
|
+
doc.write(`const ${id} = ${parseStr(key)};`);
|
|
1621
|
+
if (isOptionalIn && isOptionalOut) doc.write(`
|
|
1622
|
+
if (${id}.issues.length) {
|
|
1623
|
+
if (${k} in input) {
|
|
1624
|
+
payload.issues = payload.issues.concat(${id}.issues.map(iss => ({
|
|
1625
|
+
...iss,
|
|
1626
|
+
path: iss.path ? [${k}, ...iss.path] : [${k}]
|
|
1627
|
+
})));
|
|
1628
|
+
}
|
|
1629
|
+
}
|
|
1630
|
+
|
|
1631
|
+
if (${id}.value === undefined) {
|
|
1632
|
+
if (${k} in input) {
|
|
1633
|
+
newResult[${k}] = undefined;
|
|
1634
|
+
}
|
|
1635
|
+
} else {
|
|
1636
|
+
newResult[${k}] = ${id}.value;
|
|
1637
|
+
}
|
|
1638
|
+
|
|
1639
|
+
`);
|
|
1640
|
+
else if (!isOptionalIn) doc.write(`
|
|
1641
|
+
const ${id}_present = ${k} in input;
|
|
1642
|
+
if (${id}.issues.length) {
|
|
1643
|
+
payload.issues = payload.issues.concat(${id}.issues.map(iss => ({
|
|
1644
|
+
...iss,
|
|
1645
|
+
path: iss.path ? [${k}, ...iss.path] : [${k}]
|
|
1646
|
+
})));
|
|
1647
|
+
}
|
|
1648
|
+
if (!${id}_present && !${id}.issues.length) {
|
|
1649
|
+
payload.issues.push({
|
|
1650
|
+
code: "invalid_type",
|
|
1651
|
+
expected: "nonoptional",
|
|
1652
|
+
input: undefined,
|
|
1653
|
+
path: [${k}]
|
|
1654
|
+
});
|
|
1655
|
+
}
|
|
1656
|
+
|
|
1657
|
+
if (${id}_present) {
|
|
1658
|
+
if (${id}.value === undefined) {
|
|
1659
|
+
newResult[${k}] = undefined;
|
|
1660
|
+
} else {
|
|
1661
|
+
newResult[${k}] = ${id}.value;
|
|
1662
|
+
}
|
|
1663
|
+
}
|
|
1664
|
+
|
|
1665
|
+
`);
|
|
1666
|
+
else doc.write(`
|
|
1667
|
+
if (${id}.issues.length) {
|
|
1668
|
+
payload.issues = payload.issues.concat(${id}.issues.map(iss => ({
|
|
1669
|
+
...iss,
|
|
1670
|
+
path: iss.path ? [${k}, ...iss.path] : [${k}]
|
|
1671
|
+
})));
|
|
1672
|
+
}
|
|
1673
|
+
|
|
1674
|
+
if (${id}.value === undefined) {
|
|
1675
|
+
if (${k} in input) {
|
|
1676
|
+
newResult[${k}] = undefined;
|
|
1677
|
+
}
|
|
1678
|
+
} else {
|
|
1679
|
+
newResult[${k}] = ${id}.value;
|
|
1680
|
+
}
|
|
1681
|
+
|
|
1682
|
+
`);
|
|
1683
|
+
}
|
|
1684
|
+
doc.write(`payload.value = newResult;`);
|
|
1685
|
+
doc.write(`return payload;`);
|
|
1686
|
+
const fn = doc.compile();
|
|
1687
|
+
return (payload, ctx) => fn(shape, payload, ctx);
|
|
1688
|
+
};
|
|
1689
|
+
let fastpass;
|
|
1690
|
+
const isObject$2 = isObject;
|
|
1691
|
+
const jit = !globalConfig.jitless;
|
|
1692
|
+
const fastEnabled = jit && allowsEval.value;
|
|
1693
|
+
const catchall = def.catchall;
|
|
1694
|
+
let value;
|
|
1695
|
+
inst._zod.parse = (payload, ctx) => {
|
|
1696
|
+
value ?? (value = _normalized.value);
|
|
1697
|
+
const input = payload.value;
|
|
1698
|
+
if (!isObject$2(input)) {
|
|
1699
|
+
payload.issues.push({
|
|
1700
|
+
expected: "object",
|
|
1701
|
+
code: "invalid_type",
|
|
1702
|
+
input,
|
|
1703
|
+
inst
|
|
1704
|
+
});
|
|
1705
|
+
return payload;
|
|
1706
|
+
}
|
|
1707
|
+
if (jit && fastEnabled && ctx?.async === false && ctx.jitless !== true) {
|
|
1708
|
+
if (!fastpass) fastpass = generateFastpass(def.shape);
|
|
1709
|
+
payload = fastpass(payload, ctx);
|
|
1710
|
+
if (!catchall) return payload;
|
|
1711
|
+
return handleCatchall([], input, payload, ctx, value, inst);
|
|
1712
|
+
}
|
|
1713
|
+
return superParse(payload, ctx);
|
|
1714
|
+
};
|
|
1715
|
+
});
|
|
1716
|
+
function handleUnionResults(results, final, inst, ctx) {
|
|
1717
|
+
for (const result of results) if (result.issues.length === 0) {
|
|
1718
|
+
final.value = result.value;
|
|
1719
|
+
return final;
|
|
1720
|
+
}
|
|
1721
|
+
const nonaborted = results.filter((r) => !aborted(r));
|
|
1722
|
+
if (nonaborted.length === 1) {
|
|
1723
|
+
final.value = nonaborted[0].value;
|
|
1724
|
+
return nonaborted[0];
|
|
1725
|
+
}
|
|
1726
|
+
final.issues.push({
|
|
1727
|
+
code: "invalid_union",
|
|
1728
|
+
input: final.value,
|
|
1729
|
+
inst,
|
|
1730
|
+
errors: results.map((result) => result.issues.map((iss) => finalizeIssue(iss, ctx, config$1())))
|
|
1731
|
+
});
|
|
1732
|
+
return final;
|
|
1733
|
+
}
|
|
1734
|
+
const $ZodUnion = /*@__PURE__*/ $constructor("$ZodUnion", (inst, def) => {
|
|
1735
|
+
$ZodType.init(inst, def);
|
|
1736
|
+
defineLazy(inst._zod, "optin", () => def.options.some((o) => o._zod.optin === "optional") ? "optional" : void 0);
|
|
1737
|
+
defineLazy(inst._zod, "optout", () => def.options.some((o) => o._zod.optout === "optional") ? "optional" : void 0);
|
|
1738
|
+
defineLazy(inst._zod, "values", () => {
|
|
1739
|
+
if (def.options.every((o) => o._zod.values)) return new Set(def.options.flatMap((option) => Array.from(option._zod.values)));
|
|
1740
|
+
});
|
|
1741
|
+
defineLazy(inst._zod, "pattern", () => {
|
|
1742
|
+
if (def.options.every((o) => o._zod.pattern)) {
|
|
1743
|
+
const patterns = def.options.map((o) => o._zod.pattern);
|
|
1744
|
+
return new RegExp(`^(${patterns.map((p) => cleanRegex(p.source)).join("|")})$`);
|
|
1745
|
+
}
|
|
1746
|
+
});
|
|
1747
|
+
const first = def.options.length === 1 ? def.options[0]._zod.run : null;
|
|
1748
|
+
inst._zod.parse = (payload, ctx) => {
|
|
1749
|
+
if (first) return first(payload, ctx);
|
|
1750
|
+
let async = false;
|
|
1751
|
+
const results = [];
|
|
1752
|
+
for (const option of def.options) {
|
|
1753
|
+
const result = option._zod.run({
|
|
1754
|
+
value: payload.value,
|
|
1755
|
+
issues: []
|
|
1756
|
+
}, ctx);
|
|
1757
|
+
if (result instanceof Promise) {
|
|
1758
|
+
results.push(result);
|
|
1759
|
+
async = true;
|
|
1760
|
+
} else {
|
|
1761
|
+
if (result.issues.length === 0) return result;
|
|
1762
|
+
results.push(result);
|
|
1763
|
+
}
|
|
1764
|
+
}
|
|
1765
|
+
if (!async) return handleUnionResults(results, payload, inst, ctx);
|
|
1766
|
+
return Promise.all(results).then((results) => {
|
|
1767
|
+
return handleUnionResults(results, payload, inst, ctx);
|
|
1768
|
+
});
|
|
1769
|
+
};
|
|
1770
|
+
});
|
|
1771
|
+
const $ZodIntersection = /*@__PURE__*/ $constructor("$ZodIntersection", (inst, def) => {
|
|
1772
|
+
$ZodType.init(inst, def);
|
|
1773
|
+
inst._zod.parse = (payload, ctx) => {
|
|
1774
|
+
const input = payload.value;
|
|
1775
|
+
const left = def.left._zod.run({
|
|
1776
|
+
value: input,
|
|
1777
|
+
issues: []
|
|
1778
|
+
}, ctx);
|
|
1779
|
+
const right = def.right._zod.run({
|
|
1780
|
+
value: input,
|
|
1781
|
+
issues: []
|
|
1782
|
+
}, ctx);
|
|
1783
|
+
if (left instanceof Promise || right instanceof Promise) return Promise.all([left, right]).then(([left, right]) => {
|
|
1784
|
+
return handleIntersectionResults(payload, left, right);
|
|
1785
|
+
});
|
|
1786
|
+
return handleIntersectionResults(payload, left, right);
|
|
1787
|
+
};
|
|
1788
|
+
});
|
|
1789
|
+
function mergeValues(a, b) {
|
|
1790
|
+
if (a === b) return {
|
|
1791
|
+
valid: true,
|
|
1792
|
+
data: a
|
|
1793
|
+
};
|
|
1794
|
+
if (a instanceof Date && b instanceof Date && +a === +b) return {
|
|
1795
|
+
valid: true,
|
|
1796
|
+
data: a
|
|
1797
|
+
};
|
|
1798
|
+
if (isPlainObject$1(a) && isPlainObject$1(b)) {
|
|
1799
|
+
const bKeys = Object.keys(b);
|
|
1800
|
+
const sharedKeys = Object.keys(a).filter((key) => bKeys.indexOf(key) !== -1);
|
|
1801
|
+
const newObj = {
|
|
1802
|
+
...a,
|
|
1803
|
+
...b
|
|
1804
|
+
};
|
|
1805
|
+
for (const key of sharedKeys) {
|
|
1806
|
+
const sharedValue = mergeValues(a[key], b[key]);
|
|
1807
|
+
if (!sharedValue.valid) return {
|
|
1808
|
+
valid: false,
|
|
1809
|
+
mergeErrorPath: [key, ...sharedValue.mergeErrorPath]
|
|
1810
|
+
};
|
|
1811
|
+
newObj[key] = sharedValue.data;
|
|
1812
|
+
}
|
|
1813
|
+
return {
|
|
1814
|
+
valid: true,
|
|
1815
|
+
data: newObj
|
|
1816
|
+
};
|
|
1817
|
+
}
|
|
1818
|
+
if (Array.isArray(a) && Array.isArray(b)) {
|
|
1819
|
+
if (a.length !== b.length) return {
|
|
1820
|
+
valid: false,
|
|
1821
|
+
mergeErrorPath: []
|
|
1822
|
+
};
|
|
1823
|
+
const newArray = [];
|
|
1824
|
+
for (let index = 0; index < a.length; index++) {
|
|
1825
|
+
const itemA = a[index];
|
|
1826
|
+
const itemB = b[index];
|
|
1827
|
+
const sharedValue = mergeValues(itemA, itemB);
|
|
1828
|
+
if (!sharedValue.valid) return {
|
|
1829
|
+
valid: false,
|
|
1830
|
+
mergeErrorPath: [index, ...sharedValue.mergeErrorPath]
|
|
1831
|
+
};
|
|
1832
|
+
newArray.push(sharedValue.data);
|
|
1833
|
+
}
|
|
1834
|
+
return {
|
|
1835
|
+
valid: true,
|
|
1836
|
+
data: newArray
|
|
1837
|
+
};
|
|
1838
|
+
}
|
|
1839
|
+
return {
|
|
1840
|
+
valid: false,
|
|
1841
|
+
mergeErrorPath: []
|
|
1842
|
+
};
|
|
1843
|
+
}
|
|
1844
|
+
function handleIntersectionResults(result, left, right) {
|
|
1845
|
+
const unrecKeys = /* @__PURE__ */ new Map();
|
|
1846
|
+
let unrecIssue;
|
|
1847
|
+
for (const iss of left.issues) if (iss.code === "unrecognized_keys") {
|
|
1848
|
+
unrecIssue ?? (unrecIssue = iss);
|
|
1849
|
+
for (const k of iss.keys) {
|
|
1850
|
+
if (!unrecKeys.has(k)) unrecKeys.set(k, {});
|
|
1851
|
+
unrecKeys.get(k).l = true;
|
|
1852
|
+
}
|
|
1853
|
+
} else result.issues.push(iss);
|
|
1854
|
+
for (const iss of right.issues) if (iss.code === "unrecognized_keys") for (const k of iss.keys) {
|
|
1855
|
+
if (!unrecKeys.has(k)) unrecKeys.set(k, {});
|
|
1856
|
+
unrecKeys.get(k).r = true;
|
|
1857
|
+
}
|
|
1858
|
+
else result.issues.push(iss);
|
|
1859
|
+
const bothKeys = [...unrecKeys].filter(([, f]) => f.l && f.r).map(([k]) => k);
|
|
1860
|
+
if (bothKeys.length && unrecIssue) result.issues.push({
|
|
1861
|
+
...unrecIssue,
|
|
1862
|
+
keys: bothKeys
|
|
1863
|
+
});
|
|
1864
|
+
if (aborted(result)) return result;
|
|
1865
|
+
const merged = mergeValues(left.value, right.value);
|
|
1866
|
+
if (!merged.valid) throw new Error(`Unmergable intersection. Error path: ${JSON.stringify(merged.mergeErrorPath)}`);
|
|
1867
|
+
result.value = merged.data;
|
|
1868
|
+
return result;
|
|
1869
|
+
}
|
|
1870
|
+
const $ZodTuple = /*@__PURE__*/ $constructor("$ZodTuple", (inst, def) => {
|
|
1871
|
+
$ZodType.init(inst, def);
|
|
1872
|
+
const items = def.items;
|
|
1873
|
+
inst._zod.parse = (payload, ctx) => {
|
|
1874
|
+
const input = payload.value;
|
|
1875
|
+
if (!Array.isArray(input)) {
|
|
1876
|
+
payload.issues.push({
|
|
1877
|
+
input,
|
|
1878
|
+
inst,
|
|
1879
|
+
expected: "tuple",
|
|
1880
|
+
code: "invalid_type"
|
|
1881
|
+
});
|
|
1882
|
+
return payload;
|
|
1883
|
+
}
|
|
1884
|
+
payload.value = [];
|
|
1885
|
+
const proms = [];
|
|
1886
|
+
const optinStart = getTupleOptStart(items, "optin");
|
|
1887
|
+
const optoutStart = getTupleOptStart(items, "optout");
|
|
1888
|
+
if (!def.rest) {
|
|
1889
|
+
if (input.length < optinStart) {
|
|
1890
|
+
payload.issues.push({
|
|
1891
|
+
code: "too_small",
|
|
1892
|
+
minimum: optinStart,
|
|
1893
|
+
inclusive: true,
|
|
1894
|
+
input,
|
|
1895
|
+
inst,
|
|
1896
|
+
origin: "array"
|
|
1897
|
+
});
|
|
1898
|
+
return payload;
|
|
1899
|
+
}
|
|
1900
|
+
if (input.length > items.length) payload.issues.push({
|
|
1901
|
+
code: "too_big",
|
|
1902
|
+
maximum: items.length,
|
|
1903
|
+
inclusive: true,
|
|
1904
|
+
input,
|
|
1905
|
+
inst,
|
|
1906
|
+
origin: "array"
|
|
1907
|
+
});
|
|
1908
|
+
}
|
|
1909
|
+
const itemResults = new Array(items.length);
|
|
1910
|
+
for (let i = 0; i < items.length; i++) {
|
|
1911
|
+
const r = items[i]._zod.run({
|
|
1912
|
+
value: input[i],
|
|
1913
|
+
issues: []
|
|
1914
|
+
}, ctx);
|
|
1915
|
+
if (r instanceof Promise) proms.push(r.then((rr) => {
|
|
1916
|
+
itemResults[i] = rr;
|
|
1917
|
+
}));
|
|
1918
|
+
else itemResults[i] = r;
|
|
1919
|
+
}
|
|
1920
|
+
if (def.rest) {
|
|
1921
|
+
let i = items.length - 1;
|
|
1922
|
+
const rest = input.slice(items.length);
|
|
1923
|
+
for (const el of rest) {
|
|
1924
|
+
i++;
|
|
1925
|
+
const result = def.rest._zod.run({
|
|
1926
|
+
value: el,
|
|
1927
|
+
issues: []
|
|
1928
|
+
}, ctx);
|
|
1929
|
+
if (result instanceof Promise) proms.push(result.then((r) => handleTupleResult(r, payload, i)));
|
|
1930
|
+
else handleTupleResult(result, payload, i);
|
|
1931
|
+
}
|
|
1932
|
+
}
|
|
1933
|
+
if (proms.length) return Promise.all(proms).then(() => handleTupleResults(itemResults, payload, items, input, optoutStart));
|
|
1934
|
+
return handleTupleResults(itemResults, payload, items, input, optoutStart);
|
|
1935
|
+
};
|
|
1936
|
+
});
|
|
1937
|
+
function getTupleOptStart(items, key) {
|
|
1938
|
+
for (let i = items.length - 1; i >= 0; i--) if (items[i]._zod[key] !== "optional") return i + 1;
|
|
1939
|
+
return 0;
|
|
1940
|
+
}
|
|
1941
|
+
function handleTupleResult(result, final, index) {
|
|
1942
|
+
if (result.issues.length) final.issues.push(...prefixIssues(index, result.issues));
|
|
1943
|
+
final.value[index] = result.value;
|
|
1944
|
+
}
|
|
1945
|
+
function handleTupleResults(itemResults, final, items, input, optoutStart) {
|
|
1946
|
+
for (let i = 0; i < items.length; i++) {
|
|
1947
|
+
const r = itemResults[i];
|
|
1948
|
+
const isPresent = i < input.length;
|
|
1949
|
+
if (r.issues.length) {
|
|
1950
|
+
if (!isPresent && i >= optoutStart) {
|
|
1951
|
+
final.value.length = i;
|
|
1952
|
+
break;
|
|
1953
|
+
}
|
|
1954
|
+
final.issues.push(...prefixIssues(i, r.issues));
|
|
1955
|
+
}
|
|
1956
|
+
final.value[i] = r.value;
|
|
1957
|
+
}
|
|
1958
|
+
for (let i = final.value.length - 1; i >= input.length; i--) if (items[i]._zod.optout === "optional" && final.value[i] === void 0) final.value.length = i;
|
|
1959
|
+
else break;
|
|
1960
|
+
return final;
|
|
1961
|
+
}
|
|
1962
|
+
const $ZodEnum = /*@__PURE__*/ $constructor("$ZodEnum", (inst, def) => {
|
|
1963
|
+
$ZodType.init(inst, def);
|
|
1964
|
+
const values = getEnumValues(def.entries);
|
|
1965
|
+
const valuesSet = new Set(values);
|
|
1966
|
+
inst._zod.values = valuesSet;
|
|
1967
|
+
inst._zod.pattern = new RegExp(`^(${values.filter((k) => propertyKeyTypes.has(typeof k)).map((o) => typeof o === "string" ? escapeRegex(o) : o.toString()).join("|")})$`);
|
|
1968
|
+
inst._zod.parse = (payload, _ctx) => {
|
|
1969
|
+
const input = payload.value;
|
|
1970
|
+
if (valuesSet.has(input)) return payload;
|
|
1971
|
+
payload.issues.push({
|
|
1972
|
+
code: "invalid_value",
|
|
1973
|
+
values,
|
|
1974
|
+
input,
|
|
1975
|
+
inst
|
|
1976
|
+
});
|
|
1977
|
+
return payload;
|
|
1978
|
+
};
|
|
1979
|
+
});
|
|
1980
|
+
const $ZodLiteral = /*@__PURE__*/ $constructor("$ZodLiteral", (inst, def) => {
|
|
1981
|
+
$ZodType.init(inst, def);
|
|
1982
|
+
if (def.values.length === 0) throw new Error("Cannot create literal schema with no valid values");
|
|
1983
|
+
const values = new Set(def.values);
|
|
1984
|
+
inst._zod.values = values;
|
|
1985
|
+
inst._zod.pattern = new RegExp(`^(${def.values.map((o) => typeof o === "string" ? escapeRegex(o) : o ? escapeRegex(o.toString()) : String(o)).join("|")})$`);
|
|
1986
|
+
inst._zod.parse = (payload, _ctx) => {
|
|
1987
|
+
const input = payload.value;
|
|
1988
|
+
if (values.has(input)) return payload;
|
|
1989
|
+
payload.issues.push({
|
|
1990
|
+
code: "invalid_value",
|
|
1991
|
+
values: def.values,
|
|
1992
|
+
input,
|
|
1993
|
+
inst
|
|
1994
|
+
});
|
|
1995
|
+
return payload;
|
|
1996
|
+
};
|
|
1997
|
+
});
|
|
1998
|
+
const $ZodTransform = /*@__PURE__*/ $constructor("$ZodTransform", (inst, def) => {
|
|
1999
|
+
$ZodType.init(inst, def);
|
|
2000
|
+
inst._zod.optin = "optional";
|
|
2001
|
+
inst._zod.parse = (payload, ctx) => {
|
|
2002
|
+
if (ctx.direction === "backward") throw new $ZodEncodeError(inst.constructor.name);
|
|
2003
|
+
const _out = def.transform(payload.value, payload);
|
|
2004
|
+
if (ctx.async) return (_out instanceof Promise ? _out : Promise.resolve(_out)).then((output) => {
|
|
2005
|
+
payload.value = output;
|
|
2006
|
+
payload.fallback = true;
|
|
2007
|
+
return payload;
|
|
2008
|
+
});
|
|
2009
|
+
if (_out instanceof Promise) throw new $ZodAsyncError();
|
|
2010
|
+
payload.value = _out;
|
|
2011
|
+
payload.fallback = true;
|
|
2012
|
+
return payload;
|
|
2013
|
+
};
|
|
2014
|
+
});
|
|
2015
|
+
function handleOptionalResult(result, input) {
|
|
2016
|
+
if (input === void 0 && (result.issues.length || result.fallback)) return {
|
|
2017
|
+
issues: [],
|
|
2018
|
+
value: void 0
|
|
2019
|
+
};
|
|
2020
|
+
return result;
|
|
2021
|
+
}
|
|
2022
|
+
const $ZodOptional = /*@__PURE__*/ $constructor("$ZodOptional", (inst, def) => {
|
|
2023
|
+
$ZodType.init(inst, def);
|
|
2024
|
+
inst._zod.optin = "optional";
|
|
2025
|
+
inst._zod.optout = "optional";
|
|
2026
|
+
defineLazy(inst._zod, "values", () => {
|
|
2027
|
+
return def.innerType._zod.values ? new Set([...def.innerType._zod.values, void 0]) : void 0;
|
|
2028
|
+
});
|
|
2029
|
+
defineLazy(inst._zod, "pattern", () => {
|
|
2030
|
+
const pattern = def.innerType._zod.pattern;
|
|
2031
|
+
return pattern ? new RegExp(`^(${cleanRegex(pattern.source)})?$`) : void 0;
|
|
2032
|
+
});
|
|
2033
|
+
inst._zod.parse = (payload, ctx) => {
|
|
2034
|
+
if (def.innerType._zod.optin === "optional") {
|
|
2035
|
+
const input = payload.value;
|
|
2036
|
+
const result = def.innerType._zod.run(payload, ctx);
|
|
2037
|
+
if (result instanceof Promise) return result.then((r) => handleOptionalResult(r, input));
|
|
2038
|
+
return handleOptionalResult(result, input);
|
|
2039
|
+
}
|
|
2040
|
+
if (payload.value === void 0) return payload;
|
|
2041
|
+
return def.innerType._zod.run(payload, ctx);
|
|
2042
|
+
};
|
|
2043
|
+
});
|
|
2044
|
+
const $ZodExactOptional = /*@__PURE__*/ $constructor("$ZodExactOptional", (inst, def) => {
|
|
2045
|
+
$ZodOptional.init(inst, def);
|
|
2046
|
+
defineLazy(inst._zod, "values", () => def.innerType._zod.values);
|
|
2047
|
+
defineLazy(inst._zod, "pattern", () => def.innerType._zod.pattern);
|
|
2048
|
+
inst._zod.parse = (payload, ctx) => {
|
|
2049
|
+
return def.innerType._zod.run(payload, ctx);
|
|
2050
|
+
};
|
|
2051
|
+
});
|
|
2052
|
+
const $ZodNullable = /*@__PURE__*/ $constructor("$ZodNullable", (inst, def) => {
|
|
2053
|
+
$ZodType.init(inst, def);
|
|
2054
|
+
defineLazy(inst._zod, "optin", () => def.innerType._zod.optin);
|
|
2055
|
+
defineLazy(inst._zod, "optout", () => def.innerType._zod.optout);
|
|
2056
|
+
defineLazy(inst._zod, "pattern", () => {
|
|
2057
|
+
const pattern = def.innerType._zod.pattern;
|
|
2058
|
+
return pattern ? new RegExp(`^(${cleanRegex(pattern.source)}|null)$`) : void 0;
|
|
2059
|
+
});
|
|
2060
|
+
defineLazy(inst._zod, "values", () => {
|
|
2061
|
+
return def.innerType._zod.values ? new Set([...def.innerType._zod.values, null]) : void 0;
|
|
2062
|
+
});
|
|
2063
|
+
inst._zod.parse = (payload, ctx) => {
|
|
2064
|
+
if (payload.value === null) return payload;
|
|
2065
|
+
return def.innerType._zod.run(payload, ctx);
|
|
2066
|
+
};
|
|
2067
|
+
});
|
|
2068
|
+
const $ZodDefault = /*@__PURE__*/ $constructor("$ZodDefault", (inst, def) => {
|
|
2069
|
+
$ZodType.init(inst, def);
|
|
2070
|
+
inst._zod.optin = "optional";
|
|
2071
|
+
defineLazy(inst._zod, "values", () => def.innerType._zod.values);
|
|
2072
|
+
inst._zod.parse = (payload, ctx) => {
|
|
2073
|
+
if (ctx.direction === "backward") return def.innerType._zod.run(payload, ctx);
|
|
2074
|
+
if (payload.value === void 0) {
|
|
2075
|
+
payload.value = def.defaultValue;
|
|
2076
|
+
/**
|
|
2077
|
+
* $ZodDefault returns the default value immediately in forward direction.
|
|
2078
|
+
* 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. */
|
|
2079
|
+
return payload;
|
|
2080
|
+
}
|
|
2081
|
+
const result = def.innerType._zod.run(payload, ctx);
|
|
2082
|
+
if (result instanceof Promise) return result.then((result) => handleDefaultResult(result, def));
|
|
2083
|
+
return handleDefaultResult(result, def);
|
|
2084
|
+
};
|
|
2085
|
+
});
|
|
2086
|
+
function handleDefaultResult(payload, def) {
|
|
2087
|
+
if (payload.value === void 0) payload.value = def.defaultValue;
|
|
2088
|
+
return payload;
|
|
2089
|
+
}
|
|
2090
|
+
const $ZodPrefault = /*@__PURE__*/ $constructor("$ZodPrefault", (inst, def) => {
|
|
2091
|
+
$ZodType.init(inst, def);
|
|
2092
|
+
inst._zod.optin = "optional";
|
|
2093
|
+
defineLazy(inst._zod, "values", () => def.innerType._zod.values);
|
|
2094
|
+
inst._zod.parse = (payload, ctx) => {
|
|
2095
|
+
if (ctx.direction === "backward") return def.innerType._zod.run(payload, ctx);
|
|
2096
|
+
if (payload.value === void 0) payload.value = def.defaultValue;
|
|
2097
|
+
return def.innerType._zod.run(payload, ctx);
|
|
2098
|
+
};
|
|
2099
|
+
});
|
|
2100
|
+
const $ZodNonOptional = /*@__PURE__*/ $constructor("$ZodNonOptional", (inst, def) => {
|
|
2101
|
+
$ZodType.init(inst, def);
|
|
2102
|
+
defineLazy(inst._zod, "values", () => {
|
|
2103
|
+
const v = def.innerType._zod.values;
|
|
2104
|
+
return v ? new Set([...v].filter((x) => x !== void 0)) : void 0;
|
|
2105
|
+
});
|
|
2106
|
+
inst._zod.parse = (payload, ctx) => {
|
|
2107
|
+
const result = def.innerType._zod.run(payload, ctx);
|
|
2108
|
+
if (result instanceof Promise) return result.then((result) => handleNonOptionalResult(result, inst));
|
|
2109
|
+
return handleNonOptionalResult(result, inst);
|
|
2110
|
+
};
|
|
2111
|
+
});
|
|
2112
|
+
function handleNonOptionalResult(payload, inst) {
|
|
2113
|
+
if (!payload.issues.length && payload.value === void 0) payload.issues.push({
|
|
2114
|
+
code: "invalid_type",
|
|
2115
|
+
expected: "nonoptional",
|
|
2116
|
+
input: payload.value,
|
|
2117
|
+
inst
|
|
2118
|
+
});
|
|
2119
|
+
return payload;
|
|
2120
|
+
}
|
|
2121
|
+
const $ZodCatch = /*@__PURE__*/ $constructor("$ZodCatch", (inst, def) => {
|
|
2122
|
+
$ZodType.init(inst, def);
|
|
2123
|
+
inst._zod.optin = "optional";
|
|
2124
|
+
defineLazy(inst._zod, "optout", () => def.innerType._zod.optout);
|
|
2125
|
+
defineLazy(inst._zod, "values", () => def.innerType._zod.values);
|
|
2126
|
+
inst._zod.parse = (payload, ctx) => {
|
|
2127
|
+
if (ctx.direction === "backward") return def.innerType._zod.run(payload, ctx);
|
|
2128
|
+
const result = def.innerType._zod.run(payload, ctx);
|
|
2129
|
+
if (result instanceof Promise) return result.then((result) => {
|
|
2130
|
+
payload.value = result.value;
|
|
2131
|
+
if (result.issues.length) {
|
|
2132
|
+
payload.value = def.catchValue({
|
|
2133
|
+
...payload,
|
|
2134
|
+
error: { issues: result.issues.map((iss) => finalizeIssue(iss, ctx, config$1())) },
|
|
2135
|
+
input: payload.value
|
|
2136
|
+
});
|
|
2137
|
+
payload.issues = [];
|
|
2138
|
+
payload.fallback = true;
|
|
2139
|
+
}
|
|
2140
|
+
return payload;
|
|
2141
|
+
});
|
|
2142
|
+
payload.value = result.value;
|
|
2143
|
+
if (result.issues.length) {
|
|
2144
|
+
payload.value = def.catchValue({
|
|
2145
|
+
...payload,
|
|
2146
|
+
error: { issues: result.issues.map((iss) => finalizeIssue(iss, ctx, config$1())) },
|
|
2147
|
+
input: payload.value
|
|
2148
|
+
});
|
|
2149
|
+
payload.issues = [];
|
|
2150
|
+
payload.fallback = true;
|
|
2151
|
+
}
|
|
2152
|
+
return payload;
|
|
2153
|
+
};
|
|
2154
|
+
});
|
|
2155
|
+
const $ZodPipe = /*@__PURE__*/ $constructor("$ZodPipe", (inst, def) => {
|
|
2156
|
+
$ZodType.init(inst, def);
|
|
2157
|
+
defineLazy(inst._zod, "values", () => def.in._zod.values);
|
|
2158
|
+
defineLazy(inst._zod, "optin", () => def.in._zod.optin);
|
|
2159
|
+
defineLazy(inst._zod, "optout", () => def.out._zod.optout);
|
|
2160
|
+
defineLazy(inst._zod, "propValues", () => def.in._zod.propValues);
|
|
2161
|
+
inst._zod.parse = (payload, ctx) => {
|
|
2162
|
+
if (ctx.direction === "backward") {
|
|
2163
|
+
const right = def.out._zod.run(payload, ctx);
|
|
2164
|
+
if (right instanceof Promise) return right.then((right) => handlePipeResult(right, def.in, ctx));
|
|
2165
|
+
return handlePipeResult(right, def.in, ctx);
|
|
2166
|
+
}
|
|
2167
|
+
const left = def.in._zod.run(payload, ctx);
|
|
2168
|
+
if (left instanceof Promise) return left.then((left) => handlePipeResult(left, def.out, ctx));
|
|
2169
|
+
return handlePipeResult(left, def.out, ctx);
|
|
2170
|
+
};
|
|
2171
|
+
});
|
|
2172
|
+
function handlePipeResult(left, next, ctx) {
|
|
2173
|
+
if (left.issues.length) {
|
|
2174
|
+
left.aborted = true;
|
|
2175
|
+
return left;
|
|
2176
|
+
}
|
|
2177
|
+
return next._zod.run({
|
|
2178
|
+
value: left.value,
|
|
2179
|
+
issues: left.issues,
|
|
2180
|
+
fallback: left.fallback
|
|
2181
|
+
}, ctx);
|
|
2182
|
+
}
|
|
2183
|
+
const $ZodReadonly = /*@__PURE__*/ $constructor("$ZodReadonly", (inst, def) => {
|
|
2184
|
+
$ZodType.init(inst, def);
|
|
2185
|
+
defineLazy(inst._zod, "propValues", () => def.innerType._zod.propValues);
|
|
2186
|
+
defineLazy(inst._zod, "values", () => def.innerType._zod.values);
|
|
2187
|
+
defineLazy(inst._zod, "optin", () => def.innerType?._zod?.optin);
|
|
2188
|
+
defineLazy(inst._zod, "optout", () => def.innerType?._zod?.optout);
|
|
2189
|
+
inst._zod.parse = (payload, ctx) => {
|
|
2190
|
+
if (ctx.direction === "backward") return def.innerType._zod.run(payload, ctx);
|
|
2191
|
+
const result = def.innerType._zod.run(payload, ctx);
|
|
2192
|
+
if (result instanceof Promise) return result.then(handleReadonlyResult);
|
|
2193
|
+
return handleReadonlyResult(result);
|
|
2194
|
+
};
|
|
2195
|
+
});
|
|
2196
|
+
function handleReadonlyResult(payload) {
|
|
2197
|
+
payload.value = Object.freeze(payload.value);
|
|
2198
|
+
return payload;
|
|
2199
|
+
}
|
|
2200
|
+
const $ZodCustom = /*@__PURE__*/ $constructor("$ZodCustom", (inst, def) => {
|
|
2201
|
+
$ZodCheck.init(inst, def);
|
|
2202
|
+
$ZodType.init(inst, def);
|
|
2203
|
+
inst._zod.parse = (payload, _) => {
|
|
2204
|
+
return payload;
|
|
2205
|
+
};
|
|
2206
|
+
inst._zod.check = (payload) => {
|
|
2207
|
+
const input = payload.value;
|
|
2208
|
+
const r = def.fn(input);
|
|
2209
|
+
if (r instanceof Promise) return r.then((r) => handleRefineResult(r, payload, input, inst));
|
|
2210
|
+
handleRefineResult(r, payload, input, inst);
|
|
2211
|
+
};
|
|
2212
|
+
});
|
|
2213
|
+
function handleRefineResult(result, payload, input, inst) {
|
|
2214
|
+
if (!result) {
|
|
2215
|
+
const _iss = {
|
|
2216
|
+
code: "custom",
|
|
2217
|
+
input,
|
|
2218
|
+
inst,
|
|
2219
|
+
path: [...inst._zod.def.path ?? []],
|
|
2220
|
+
continue: !inst._zod.def.abort
|
|
2221
|
+
};
|
|
2222
|
+
if (inst._zod.def.params) _iss.params = inst._zod.def.params;
|
|
2223
|
+
payload.issues.push(issue(_iss));
|
|
2224
|
+
}
|
|
2225
|
+
}
|
|
2226
|
+
//#endregion
|
|
2227
|
+
//#region ../../node_modules/zod/v4/core/registries.js
|
|
2228
|
+
var _a$1;
|
|
2229
|
+
var $ZodRegistry = class {
|
|
2230
|
+
constructor() {
|
|
2231
|
+
this._map = /* @__PURE__ */ new WeakMap();
|
|
2232
|
+
this._idmap = /* @__PURE__ */ new Map();
|
|
2233
|
+
}
|
|
2234
|
+
add(schema, ..._meta) {
|
|
2235
|
+
const meta = _meta[0];
|
|
2236
|
+
this._map.set(schema, meta);
|
|
2237
|
+
if (meta && typeof meta === "object" && "id" in meta) this._idmap.set(meta.id, schema);
|
|
2238
|
+
return this;
|
|
2239
|
+
}
|
|
2240
|
+
clear() {
|
|
2241
|
+
this._map = /* @__PURE__ */ new WeakMap();
|
|
2242
|
+
this._idmap = /* @__PURE__ */ new Map();
|
|
2243
|
+
return this;
|
|
2244
|
+
}
|
|
2245
|
+
remove(schema) {
|
|
2246
|
+
const meta = this._map.get(schema);
|
|
2247
|
+
if (meta && typeof meta === "object" && "id" in meta) this._idmap.delete(meta.id);
|
|
2248
|
+
this._map.delete(schema);
|
|
2249
|
+
return this;
|
|
2250
|
+
}
|
|
2251
|
+
get(schema) {
|
|
2252
|
+
const p = schema._zod.parent;
|
|
2253
|
+
if (p) {
|
|
2254
|
+
const pm = { ...this.get(p) ?? {} };
|
|
2255
|
+
delete pm.id;
|
|
2256
|
+
const f = {
|
|
2257
|
+
...pm,
|
|
2258
|
+
...this._map.get(schema)
|
|
2259
|
+
};
|
|
2260
|
+
return Object.keys(f).length ? f : void 0;
|
|
2261
|
+
}
|
|
2262
|
+
return this._map.get(schema);
|
|
2263
|
+
}
|
|
2264
|
+
has(schema) {
|
|
2265
|
+
return this._map.has(schema);
|
|
2266
|
+
}
|
|
2267
|
+
};
|
|
2268
|
+
function registry() {
|
|
2269
|
+
return new $ZodRegistry();
|
|
2270
|
+
}
|
|
2271
|
+
(_a$1 = globalThis).__zod_globalRegistry ?? (_a$1.__zod_globalRegistry = registry());
|
|
2272
|
+
const globalRegistry = globalThis.__zod_globalRegistry;
|
|
2273
|
+
//#endregion
|
|
2274
|
+
//#region ../../node_modules/zod/v4/core/api.js
|
|
2275
|
+
// @__NO_SIDE_EFFECTS__
|
|
2276
|
+
function _string(Class, params) {
|
|
2277
|
+
return new Class({
|
|
2278
|
+
type: "string",
|
|
2279
|
+
...normalizeParams(params)
|
|
2280
|
+
});
|
|
2281
|
+
}
|
|
2282
|
+
// @__NO_SIDE_EFFECTS__
|
|
2283
|
+
function _email(Class, params) {
|
|
2284
|
+
return new Class({
|
|
2285
|
+
type: "string",
|
|
2286
|
+
format: "email",
|
|
2287
|
+
check: "string_format",
|
|
2288
|
+
abort: false,
|
|
2289
|
+
...normalizeParams(params)
|
|
2290
|
+
});
|
|
2291
|
+
}
|
|
2292
|
+
// @__NO_SIDE_EFFECTS__
|
|
2293
|
+
function _guid(Class, params) {
|
|
2294
|
+
return new Class({
|
|
2295
|
+
type: "string",
|
|
2296
|
+
format: "guid",
|
|
2297
|
+
check: "string_format",
|
|
2298
|
+
abort: false,
|
|
2299
|
+
...normalizeParams(params)
|
|
2300
|
+
});
|
|
2301
|
+
}
|
|
2302
|
+
// @__NO_SIDE_EFFECTS__
|
|
2303
|
+
function _uuid(Class, params) {
|
|
2304
|
+
return new Class({
|
|
2305
|
+
type: "string",
|
|
2306
|
+
format: "uuid",
|
|
2307
|
+
check: "string_format",
|
|
2308
|
+
abort: false,
|
|
2309
|
+
...normalizeParams(params)
|
|
2310
|
+
});
|
|
2311
|
+
}
|
|
2312
|
+
// @__NO_SIDE_EFFECTS__
|
|
2313
|
+
function _uuidv4(Class, params) {
|
|
2314
|
+
return new Class({
|
|
2315
|
+
type: "string",
|
|
2316
|
+
format: "uuid",
|
|
2317
|
+
check: "string_format",
|
|
2318
|
+
abort: false,
|
|
2319
|
+
version: "v4",
|
|
2320
|
+
...normalizeParams(params)
|
|
2321
|
+
});
|
|
2322
|
+
}
|
|
2323
|
+
// @__NO_SIDE_EFFECTS__
|
|
2324
|
+
function _uuidv6(Class, params) {
|
|
2325
|
+
return new Class({
|
|
2326
|
+
type: "string",
|
|
2327
|
+
format: "uuid",
|
|
2328
|
+
check: "string_format",
|
|
2329
|
+
abort: false,
|
|
2330
|
+
version: "v6",
|
|
2331
|
+
...normalizeParams(params)
|
|
2332
|
+
});
|
|
2333
|
+
}
|
|
2334
|
+
// @__NO_SIDE_EFFECTS__
|
|
2335
|
+
function _uuidv7(Class, params) {
|
|
2336
|
+
return new Class({
|
|
2337
|
+
type: "string",
|
|
2338
|
+
format: "uuid",
|
|
2339
|
+
check: "string_format",
|
|
2340
|
+
abort: false,
|
|
2341
|
+
version: "v7",
|
|
2342
|
+
...normalizeParams(params)
|
|
2343
|
+
});
|
|
2344
|
+
}
|
|
2345
|
+
// @__NO_SIDE_EFFECTS__
|
|
2346
|
+
function _url(Class, params) {
|
|
2347
|
+
return new Class({
|
|
2348
|
+
type: "string",
|
|
2349
|
+
format: "url",
|
|
2350
|
+
check: "string_format",
|
|
2351
|
+
abort: false,
|
|
2352
|
+
...normalizeParams(params)
|
|
2353
|
+
});
|
|
2354
|
+
}
|
|
2355
|
+
// @__NO_SIDE_EFFECTS__
|
|
2356
|
+
function _emoji(Class, params) {
|
|
2357
|
+
return new Class({
|
|
2358
|
+
type: "string",
|
|
2359
|
+
format: "emoji",
|
|
2360
|
+
check: "string_format",
|
|
2361
|
+
abort: false,
|
|
2362
|
+
...normalizeParams(params)
|
|
2363
|
+
});
|
|
2364
|
+
}
|
|
2365
|
+
// @__NO_SIDE_EFFECTS__
|
|
2366
|
+
function _nanoid(Class, params) {
|
|
2367
|
+
return new Class({
|
|
2368
|
+
type: "string",
|
|
2369
|
+
format: "nanoid",
|
|
2370
|
+
check: "string_format",
|
|
2371
|
+
abort: false,
|
|
2372
|
+
...normalizeParams(params)
|
|
2373
|
+
});
|
|
2374
|
+
}
|
|
2375
|
+
/**
|
|
2376
|
+
* @deprecated CUID v1 is deprecated by its authors due to information leakage
|
|
2377
|
+
* (timestamps embedded in the id). Use {@link _cuid2} instead.
|
|
2378
|
+
* See https://github.com/paralleldrive/cuid.
|
|
2379
|
+
*/
|
|
2380
|
+
// @__NO_SIDE_EFFECTS__
|
|
2381
|
+
function _cuid(Class, params) {
|
|
2382
|
+
return new Class({
|
|
2383
|
+
type: "string",
|
|
2384
|
+
format: "cuid",
|
|
2385
|
+
check: "string_format",
|
|
2386
|
+
abort: false,
|
|
2387
|
+
...normalizeParams(params)
|
|
2388
|
+
});
|
|
2389
|
+
}
|
|
2390
|
+
// @__NO_SIDE_EFFECTS__
|
|
2391
|
+
function _cuid2(Class, params) {
|
|
2392
|
+
return new Class({
|
|
2393
|
+
type: "string",
|
|
2394
|
+
format: "cuid2",
|
|
2395
|
+
check: "string_format",
|
|
2396
|
+
abort: false,
|
|
2397
|
+
...normalizeParams(params)
|
|
2398
|
+
});
|
|
2399
|
+
}
|
|
2400
|
+
// @__NO_SIDE_EFFECTS__
|
|
2401
|
+
function _ulid(Class, params) {
|
|
2402
|
+
return new Class({
|
|
2403
|
+
type: "string",
|
|
2404
|
+
format: "ulid",
|
|
2405
|
+
check: "string_format",
|
|
2406
|
+
abort: false,
|
|
2407
|
+
...normalizeParams(params)
|
|
2408
|
+
});
|
|
2409
|
+
}
|
|
2410
|
+
// @__NO_SIDE_EFFECTS__
|
|
2411
|
+
function _xid(Class, params) {
|
|
2412
|
+
return new Class({
|
|
2413
|
+
type: "string",
|
|
2414
|
+
format: "xid",
|
|
2415
|
+
check: "string_format",
|
|
2416
|
+
abort: false,
|
|
2417
|
+
...normalizeParams(params)
|
|
2418
|
+
});
|
|
2419
|
+
}
|
|
2420
|
+
// @__NO_SIDE_EFFECTS__
|
|
2421
|
+
function _ksuid(Class, params) {
|
|
2422
|
+
return new Class({
|
|
2423
|
+
type: "string",
|
|
2424
|
+
format: "ksuid",
|
|
2425
|
+
check: "string_format",
|
|
2426
|
+
abort: false,
|
|
2427
|
+
...normalizeParams(params)
|
|
2428
|
+
});
|
|
2429
|
+
}
|
|
2430
|
+
// @__NO_SIDE_EFFECTS__
|
|
2431
|
+
function _ipv4(Class, params) {
|
|
2432
|
+
return new Class({
|
|
2433
|
+
type: "string",
|
|
2434
|
+
format: "ipv4",
|
|
2435
|
+
check: "string_format",
|
|
2436
|
+
abort: false,
|
|
2437
|
+
...normalizeParams(params)
|
|
2438
|
+
});
|
|
2439
|
+
}
|
|
2440
|
+
// @__NO_SIDE_EFFECTS__
|
|
2441
|
+
function _ipv6(Class, params) {
|
|
2442
|
+
return new Class({
|
|
2443
|
+
type: "string",
|
|
2444
|
+
format: "ipv6",
|
|
2445
|
+
check: "string_format",
|
|
2446
|
+
abort: false,
|
|
2447
|
+
...normalizeParams(params)
|
|
2448
|
+
});
|
|
2449
|
+
}
|
|
2450
|
+
// @__NO_SIDE_EFFECTS__
|
|
2451
|
+
function _cidrv4(Class, params) {
|
|
2452
|
+
return new Class({
|
|
2453
|
+
type: "string",
|
|
2454
|
+
format: "cidrv4",
|
|
2455
|
+
check: "string_format",
|
|
2456
|
+
abort: false,
|
|
2457
|
+
...normalizeParams(params)
|
|
2458
|
+
});
|
|
2459
|
+
}
|
|
2460
|
+
// @__NO_SIDE_EFFECTS__
|
|
2461
|
+
function _cidrv6(Class, params) {
|
|
2462
|
+
return new Class({
|
|
2463
|
+
type: "string",
|
|
2464
|
+
format: "cidrv6",
|
|
2465
|
+
check: "string_format",
|
|
2466
|
+
abort: false,
|
|
2467
|
+
...normalizeParams(params)
|
|
2468
|
+
});
|
|
2469
|
+
}
|
|
2470
|
+
// @__NO_SIDE_EFFECTS__
|
|
2471
|
+
function _base64(Class, params) {
|
|
2472
|
+
return new Class({
|
|
2473
|
+
type: "string",
|
|
2474
|
+
format: "base64",
|
|
2475
|
+
check: "string_format",
|
|
2476
|
+
abort: false,
|
|
2477
|
+
...normalizeParams(params)
|
|
2478
|
+
});
|
|
2479
|
+
}
|
|
2480
|
+
// @__NO_SIDE_EFFECTS__
|
|
2481
|
+
function _base64url(Class, params) {
|
|
2482
|
+
return new Class({
|
|
2483
|
+
type: "string",
|
|
2484
|
+
format: "base64url",
|
|
2485
|
+
check: "string_format",
|
|
2486
|
+
abort: false,
|
|
2487
|
+
...normalizeParams(params)
|
|
2488
|
+
});
|
|
2489
|
+
}
|
|
2490
|
+
// @__NO_SIDE_EFFECTS__
|
|
2491
|
+
function _e164(Class, params) {
|
|
2492
|
+
return new Class({
|
|
2493
|
+
type: "string",
|
|
2494
|
+
format: "e164",
|
|
2495
|
+
check: "string_format",
|
|
2496
|
+
abort: false,
|
|
2497
|
+
...normalizeParams(params)
|
|
2498
|
+
});
|
|
2499
|
+
}
|
|
2500
|
+
// @__NO_SIDE_EFFECTS__
|
|
2501
|
+
function _jwt(Class, params) {
|
|
2502
|
+
return new Class({
|
|
2503
|
+
type: "string",
|
|
2504
|
+
format: "jwt",
|
|
2505
|
+
check: "string_format",
|
|
2506
|
+
abort: false,
|
|
2507
|
+
...normalizeParams(params)
|
|
2508
|
+
});
|
|
2509
|
+
}
|
|
2510
|
+
// @__NO_SIDE_EFFECTS__
|
|
2511
|
+
function _isoDateTime(Class, params) {
|
|
2512
|
+
return new Class({
|
|
2513
|
+
type: "string",
|
|
2514
|
+
format: "datetime",
|
|
2515
|
+
check: "string_format",
|
|
2516
|
+
offset: false,
|
|
2517
|
+
local: false,
|
|
2518
|
+
precision: null,
|
|
2519
|
+
...normalizeParams(params)
|
|
2520
|
+
});
|
|
2521
|
+
}
|
|
2522
|
+
// @__NO_SIDE_EFFECTS__
|
|
2523
|
+
function _isoDate(Class, params) {
|
|
2524
|
+
return new Class({
|
|
2525
|
+
type: "string",
|
|
2526
|
+
format: "date",
|
|
2527
|
+
check: "string_format",
|
|
2528
|
+
...normalizeParams(params)
|
|
2529
|
+
});
|
|
2530
|
+
}
|
|
2531
|
+
// @__NO_SIDE_EFFECTS__
|
|
2532
|
+
function _isoTime(Class, params) {
|
|
2533
|
+
return new Class({
|
|
2534
|
+
type: "string",
|
|
2535
|
+
format: "time",
|
|
2536
|
+
check: "string_format",
|
|
2537
|
+
precision: null,
|
|
2538
|
+
...normalizeParams(params)
|
|
2539
|
+
});
|
|
2540
|
+
}
|
|
2541
|
+
// @__NO_SIDE_EFFECTS__
|
|
2542
|
+
function _isoDuration(Class, params) {
|
|
2543
|
+
return new Class({
|
|
2544
|
+
type: "string",
|
|
2545
|
+
format: "duration",
|
|
2546
|
+
check: "string_format",
|
|
2547
|
+
...normalizeParams(params)
|
|
2548
|
+
});
|
|
2549
|
+
}
|
|
2550
|
+
// @__NO_SIDE_EFFECTS__
|
|
2551
|
+
function _number(Class, params) {
|
|
2552
|
+
return new Class({
|
|
2553
|
+
type: "number",
|
|
2554
|
+
checks: [],
|
|
2555
|
+
...normalizeParams(params)
|
|
2556
|
+
});
|
|
2557
|
+
}
|
|
2558
|
+
// @__NO_SIDE_EFFECTS__
|
|
2559
|
+
function _int(Class, params) {
|
|
2560
|
+
return new Class({
|
|
2561
|
+
type: "number",
|
|
2562
|
+
check: "number_format",
|
|
2563
|
+
abort: false,
|
|
2564
|
+
format: "safeint",
|
|
2565
|
+
...normalizeParams(params)
|
|
2566
|
+
});
|
|
2567
|
+
}
|
|
2568
|
+
// @__NO_SIDE_EFFECTS__
|
|
2569
|
+
function _boolean(Class, params) {
|
|
2570
|
+
return new Class({
|
|
2571
|
+
type: "boolean",
|
|
2572
|
+
...normalizeParams(params)
|
|
2573
|
+
});
|
|
2574
|
+
}
|
|
2575
|
+
// @__NO_SIDE_EFFECTS__
|
|
2576
|
+
function _unknown(Class) {
|
|
2577
|
+
return new Class({ type: "unknown" });
|
|
2578
|
+
}
|
|
2579
|
+
// @__NO_SIDE_EFFECTS__
|
|
2580
|
+
function _never(Class, params) {
|
|
2581
|
+
return new Class({
|
|
2582
|
+
type: "never",
|
|
2583
|
+
...normalizeParams(params)
|
|
2584
|
+
});
|
|
2585
|
+
}
|
|
2586
|
+
// @__NO_SIDE_EFFECTS__
|
|
2587
|
+
function _lt(value, params) {
|
|
2588
|
+
return new $ZodCheckLessThan({
|
|
2589
|
+
check: "less_than",
|
|
2590
|
+
...normalizeParams(params),
|
|
2591
|
+
value,
|
|
2592
|
+
inclusive: false
|
|
2593
|
+
});
|
|
2594
|
+
}
|
|
2595
|
+
// @__NO_SIDE_EFFECTS__
|
|
2596
|
+
function _lte(value, params) {
|
|
2597
|
+
return new $ZodCheckLessThan({
|
|
2598
|
+
check: "less_than",
|
|
2599
|
+
...normalizeParams(params),
|
|
2600
|
+
value,
|
|
2601
|
+
inclusive: true
|
|
2602
|
+
});
|
|
2603
|
+
}
|
|
2604
|
+
// @__NO_SIDE_EFFECTS__
|
|
2605
|
+
function _gt(value, params) {
|
|
2606
|
+
return new $ZodCheckGreaterThan({
|
|
2607
|
+
check: "greater_than",
|
|
2608
|
+
...normalizeParams(params),
|
|
2609
|
+
value,
|
|
2610
|
+
inclusive: false
|
|
2611
|
+
});
|
|
2612
|
+
}
|
|
2613
|
+
// @__NO_SIDE_EFFECTS__
|
|
2614
|
+
function _gte(value, params) {
|
|
2615
|
+
return new $ZodCheckGreaterThan({
|
|
2616
|
+
check: "greater_than",
|
|
2617
|
+
...normalizeParams(params),
|
|
2618
|
+
value,
|
|
2619
|
+
inclusive: true
|
|
2620
|
+
});
|
|
2621
|
+
}
|
|
2622
|
+
// @__NO_SIDE_EFFECTS__
|
|
2623
|
+
function _multipleOf(value, params) {
|
|
2624
|
+
return new $ZodCheckMultipleOf({
|
|
2625
|
+
check: "multiple_of",
|
|
2626
|
+
...normalizeParams(params),
|
|
2627
|
+
value
|
|
2628
|
+
});
|
|
2629
|
+
}
|
|
2630
|
+
// @__NO_SIDE_EFFECTS__
|
|
2631
|
+
function _maxLength(maximum, params) {
|
|
2632
|
+
return new $ZodCheckMaxLength({
|
|
2633
|
+
check: "max_length",
|
|
2634
|
+
...normalizeParams(params),
|
|
2635
|
+
maximum
|
|
2636
|
+
});
|
|
2637
|
+
}
|
|
2638
|
+
// @__NO_SIDE_EFFECTS__
|
|
2639
|
+
function _minLength(minimum, params) {
|
|
2640
|
+
return new $ZodCheckMinLength({
|
|
2641
|
+
check: "min_length",
|
|
2642
|
+
...normalizeParams(params),
|
|
2643
|
+
minimum
|
|
2644
|
+
});
|
|
2645
|
+
}
|
|
2646
|
+
// @__NO_SIDE_EFFECTS__
|
|
2647
|
+
function _length(length, params) {
|
|
2648
|
+
return new $ZodCheckLengthEquals({
|
|
2649
|
+
check: "length_equals",
|
|
2650
|
+
...normalizeParams(params),
|
|
2651
|
+
length
|
|
2652
|
+
});
|
|
2653
|
+
}
|
|
2654
|
+
// @__NO_SIDE_EFFECTS__
|
|
2655
|
+
function _regex(pattern, params) {
|
|
2656
|
+
return new $ZodCheckRegex({
|
|
2657
|
+
check: "string_format",
|
|
2658
|
+
format: "regex",
|
|
2659
|
+
...normalizeParams(params),
|
|
2660
|
+
pattern
|
|
2661
|
+
});
|
|
2662
|
+
}
|
|
2663
|
+
// @__NO_SIDE_EFFECTS__
|
|
2664
|
+
function _lowercase(params) {
|
|
2665
|
+
return new $ZodCheckLowerCase({
|
|
2666
|
+
check: "string_format",
|
|
2667
|
+
format: "lowercase",
|
|
2668
|
+
...normalizeParams(params)
|
|
2669
|
+
});
|
|
2670
|
+
}
|
|
2671
|
+
// @__NO_SIDE_EFFECTS__
|
|
2672
|
+
function _uppercase(params) {
|
|
2673
|
+
return new $ZodCheckUpperCase({
|
|
2674
|
+
check: "string_format",
|
|
2675
|
+
format: "uppercase",
|
|
2676
|
+
...normalizeParams(params)
|
|
2677
|
+
});
|
|
2678
|
+
}
|
|
2679
|
+
// @__NO_SIDE_EFFECTS__
|
|
2680
|
+
function _includes(includes, params) {
|
|
2681
|
+
return new $ZodCheckIncludes({
|
|
2682
|
+
check: "string_format",
|
|
2683
|
+
format: "includes",
|
|
2684
|
+
...normalizeParams(params),
|
|
2685
|
+
includes
|
|
2686
|
+
});
|
|
2687
|
+
}
|
|
2688
|
+
// @__NO_SIDE_EFFECTS__
|
|
2689
|
+
function _startsWith(prefix, params) {
|
|
2690
|
+
return new $ZodCheckStartsWith({
|
|
2691
|
+
check: "string_format",
|
|
2692
|
+
format: "starts_with",
|
|
2693
|
+
...normalizeParams(params),
|
|
2694
|
+
prefix
|
|
2695
|
+
});
|
|
2696
|
+
}
|
|
2697
|
+
// @__NO_SIDE_EFFECTS__
|
|
2698
|
+
function _endsWith(suffix, params) {
|
|
2699
|
+
return new $ZodCheckEndsWith({
|
|
2700
|
+
check: "string_format",
|
|
2701
|
+
format: "ends_with",
|
|
2702
|
+
...normalizeParams(params),
|
|
2703
|
+
suffix
|
|
2704
|
+
});
|
|
2705
|
+
}
|
|
2706
|
+
// @__NO_SIDE_EFFECTS__
|
|
2707
|
+
function _overwrite(tx) {
|
|
2708
|
+
return new $ZodCheckOverwrite({
|
|
2709
|
+
check: "overwrite",
|
|
2710
|
+
tx
|
|
2711
|
+
});
|
|
2712
|
+
}
|
|
2713
|
+
// @__NO_SIDE_EFFECTS__
|
|
2714
|
+
function _normalize(form) {
|
|
2715
|
+
return /* @__PURE__ */ _overwrite((input) => input.normalize(form));
|
|
2716
|
+
}
|
|
2717
|
+
// @__NO_SIDE_EFFECTS__
|
|
2718
|
+
function _trim() {
|
|
2719
|
+
return /* @__PURE__ */ _overwrite((input) => input.trim());
|
|
2720
|
+
}
|
|
2721
|
+
// @__NO_SIDE_EFFECTS__
|
|
2722
|
+
function _toLowerCase() {
|
|
2723
|
+
return /* @__PURE__ */ _overwrite((input) => input.toLowerCase());
|
|
2724
|
+
}
|
|
2725
|
+
// @__NO_SIDE_EFFECTS__
|
|
2726
|
+
function _toUpperCase() {
|
|
2727
|
+
return /* @__PURE__ */ _overwrite((input) => input.toUpperCase());
|
|
2728
|
+
}
|
|
2729
|
+
// @__NO_SIDE_EFFECTS__
|
|
2730
|
+
function _slugify() {
|
|
2731
|
+
return /* @__PURE__ */ _overwrite((input) => slugify(input));
|
|
2732
|
+
}
|
|
2733
|
+
// @__NO_SIDE_EFFECTS__
|
|
2734
|
+
function _array(Class, element, params) {
|
|
2735
|
+
return new Class({
|
|
2736
|
+
type: "array",
|
|
2737
|
+
element,
|
|
2738
|
+
...normalizeParams(params)
|
|
2739
|
+
});
|
|
2740
|
+
}
|
|
2741
|
+
// @__NO_SIDE_EFFECTS__
|
|
2742
|
+
function _refine(Class, fn, _params) {
|
|
2743
|
+
return new Class({
|
|
2744
|
+
type: "custom",
|
|
2745
|
+
check: "custom",
|
|
2746
|
+
fn,
|
|
2747
|
+
...normalizeParams(_params)
|
|
2748
|
+
});
|
|
2749
|
+
}
|
|
2750
|
+
// @__NO_SIDE_EFFECTS__
|
|
2751
|
+
function _superRefine(fn, params) {
|
|
2752
|
+
const ch = /* @__PURE__ */ _check((payload) => {
|
|
2753
|
+
payload.addIssue = (issue$2) => {
|
|
2754
|
+
if (typeof issue$2 === "string") payload.issues.push(issue(issue$2, payload.value, ch._zod.def));
|
|
2755
|
+
else {
|
|
2756
|
+
const _issue = issue$2;
|
|
2757
|
+
if (_issue.fatal) _issue.continue = false;
|
|
2758
|
+
_issue.code ?? (_issue.code = "custom");
|
|
2759
|
+
_issue.input ?? (_issue.input = payload.value);
|
|
2760
|
+
_issue.inst ?? (_issue.inst = ch);
|
|
2761
|
+
_issue.continue ?? (_issue.continue = !ch._zod.def.abort);
|
|
2762
|
+
payload.issues.push(issue(_issue));
|
|
2763
|
+
}
|
|
2764
|
+
};
|
|
2765
|
+
return fn(payload.value, payload);
|
|
2766
|
+
}, params);
|
|
2767
|
+
return ch;
|
|
2768
|
+
}
|
|
2769
|
+
// @__NO_SIDE_EFFECTS__
|
|
2770
|
+
function _check(fn, params) {
|
|
2771
|
+
const ch = new $ZodCheck({
|
|
2772
|
+
check: "custom",
|
|
2773
|
+
...normalizeParams(params)
|
|
2774
|
+
});
|
|
2775
|
+
ch._zod.check = fn;
|
|
2776
|
+
return ch;
|
|
2777
|
+
}
|
|
2778
|
+
//#endregion
|
|
2779
|
+
//#region ../../node_modules/zod/v4/core/to-json-schema.js
|
|
2780
|
+
function initializeContext(params) {
|
|
2781
|
+
let target = params?.target ?? "draft-2020-12";
|
|
2782
|
+
if (target === "draft-4") target = "draft-04";
|
|
2783
|
+
if (target === "draft-7") target = "draft-07";
|
|
2784
|
+
return {
|
|
2785
|
+
processors: params.processors ?? {},
|
|
2786
|
+
metadataRegistry: params?.metadata ?? globalRegistry,
|
|
2787
|
+
target,
|
|
2788
|
+
unrepresentable: params?.unrepresentable ?? "throw",
|
|
2789
|
+
override: params?.override ?? (() => {}),
|
|
2790
|
+
io: params?.io ?? "output",
|
|
2791
|
+
counter: 0,
|
|
2792
|
+
seen: /* @__PURE__ */ new Map(),
|
|
2793
|
+
cycles: params?.cycles ?? "ref",
|
|
2794
|
+
reused: params?.reused ?? "inline",
|
|
2795
|
+
external: params?.external ?? void 0
|
|
2796
|
+
};
|
|
2797
|
+
}
|
|
2798
|
+
function process$1(schema, ctx, _params = {
|
|
2799
|
+
path: [],
|
|
2800
|
+
schemaPath: []
|
|
2801
|
+
}) {
|
|
2802
|
+
var _a;
|
|
2803
|
+
const def = schema._zod.def;
|
|
2804
|
+
const seen = ctx.seen.get(schema);
|
|
2805
|
+
if (seen) {
|
|
2806
|
+
seen.count++;
|
|
2807
|
+
if (_params.schemaPath.includes(schema)) seen.cycle = _params.path;
|
|
2808
|
+
return seen.schema;
|
|
2809
|
+
}
|
|
2810
|
+
const result = {
|
|
2811
|
+
schema: {},
|
|
2812
|
+
count: 1,
|
|
2813
|
+
cycle: void 0,
|
|
2814
|
+
path: _params.path
|
|
2815
|
+
};
|
|
2816
|
+
ctx.seen.set(schema, result);
|
|
2817
|
+
const overrideSchema = schema._zod.toJSONSchema?.();
|
|
2818
|
+
if (overrideSchema) result.schema = overrideSchema;
|
|
2819
|
+
else {
|
|
2820
|
+
const params = {
|
|
2821
|
+
..._params,
|
|
2822
|
+
schemaPath: [..._params.schemaPath, schema],
|
|
2823
|
+
path: _params.path
|
|
2824
|
+
};
|
|
2825
|
+
if (schema._zod.processJSONSchema) schema._zod.processJSONSchema(ctx, result.schema, params);
|
|
2826
|
+
else {
|
|
2827
|
+
const _json = result.schema;
|
|
2828
|
+
const processor = ctx.processors[def.type];
|
|
2829
|
+
if (!processor) throw new Error(`[toJSONSchema]: Non-representable type encountered: ${def.type}`);
|
|
2830
|
+
processor(schema, ctx, _json, params);
|
|
2831
|
+
}
|
|
2832
|
+
const parent = schema._zod.parent;
|
|
2833
|
+
if (parent) {
|
|
2834
|
+
if (!result.ref) result.ref = parent;
|
|
2835
|
+
process$1(parent, ctx, params);
|
|
2836
|
+
ctx.seen.get(parent).isParent = true;
|
|
2837
|
+
}
|
|
2838
|
+
}
|
|
2839
|
+
const meta = ctx.metadataRegistry.get(schema);
|
|
2840
|
+
if (meta) Object.assign(result.schema, meta);
|
|
2841
|
+
if (ctx.io === "input" && isTransforming(schema)) {
|
|
2842
|
+
delete result.schema.examples;
|
|
2843
|
+
delete result.schema.default;
|
|
2844
|
+
}
|
|
2845
|
+
if (ctx.io === "input" && "_prefault" in result.schema) (_a = result.schema).default ?? (_a.default = result.schema._prefault);
|
|
2846
|
+
delete result.schema._prefault;
|
|
2847
|
+
return ctx.seen.get(schema).schema;
|
|
2848
|
+
}
|
|
2849
|
+
function extractDefs(ctx, schema) {
|
|
2850
|
+
const root = ctx.seen.get(schema);
|
|
2851
|
+
if (!root) throw new Error("Unprocessed schema. This is a bug in Zod.");
|
|
2852
|
+
const idToSchema = /* @__PURE__ */ new Map();
|
|
2853
|
+
for (const entry of ctx.seen.entries()) {
|
|
2854
|
+
const id = ctx.metadataRegistry.get(entry[0])?.id;
|
|
2855
|
+
if (id) {
|
|
2856
|
+
const existing = idToSchema.get(id);
|
|
2857
|
+
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.`);
|
|
2858
|
+
idToSchema.set(id, entry[0]);
|
|
2859
|
+
}
|
|
2860
|
+
}
|
|
2861
|
+
const makeURI = (entry) => {
|
|
2862
|
+
const defsSegment = ctx.target === "draft-2020-12" ? "$defs" : "definitions";
|
|
2863
|
+
if (ctx.external) {
|
|
2864
|
+
const externalId = ctx.external.registry.get(entry[0])?.id;
|
|
2865
|
+
const uriGenerator = ctx.external.uri ?? ((id) => id);
|
|
2866
|
+
if (externalId) return { ref: uriGenerator(externalId) };
|
|
2867
|
+
const id = entry[1].defId ?? entry[1].schema.id ?? `schema${ctx.counter++}`;
|
|
2868
|
+
entry[1].defId = id;
|
|
2869
|
+
return {
|
|
2870
|
+
defId: id,
|
|
2871
|
+
ref: `${uriGenerator("__shared")}#/${defsSegment}/${id}`
|
|
2872
|
+
};
|
|
2873
|
+
}
|
|
2874
|
+
if (entry[1] === root) return { ref: "#" };
|
|
2875
|
+
const defUriPrefix = `#/${defsSegment}/`;
|
|
2876
|
+
const defId = entry[1].schema.id ?? `__schema${ctx.counter++}`;
|
|
2877
|
+
return {
|
|
2878
|
+
defId,
|
|
2879
|
+
ref: defUriPrefix + defId
|
|
2880
|
+
};
|
|
2881
|
+
};
|
|
2882
|
+
const extractToDef = (entry) => {
|
|
2883
|
+
if (entry[1].schema.$ref) return;
|
|
2884
|
+
const seen = entry[1];
|
|
2885
|
+
const { ref, defId } = makeURI(entry);
|
|
2886
|
+
seen.def = { ...seen.schema };
|
|
2887
|
+
if (defId) seen.defId = defId;
|
|
2888
|
+
const schema = seen.schema;
|
|
2889
|
+
for (const key in schema) delete schema[key];
|
|
2890
|
+
schema.$ref = ref;
|
|
2891
|
+
};
|
|
2892
|
+
if (ctx.cycles === "throw") for (const entry of ctx.seen.entries()) {
|
|
2893
|
+
const seen = entry[1];
|
|
2894
|
+
if (seen.cycle) throw new Error(`Cycle detected: #/${seen.cycle?.join("/")}/<root>
|
|
2895
|
+
|
|
2896
|
+
Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.`);
|
|
2897
|
+
}
|
|
2898
|
+
for (const entry of ctx.seen.entries()) {
|
|
2899
|
+
const seen = entry[1];
|
|
2900
|
+
if (schema === entry[0]) {
|
|
2901
|
+
extractToDef(entry);
|
|
2902
|
+
continue;
|
|
2903
|
+
}
|
|
2904
|
+
if (ctx.external) {
|
|
2905
|
+
const ext = ctx.external.registry.get(entry[0])?.id;
|
|
2906
|
+
if (schema !== entry[0] && ext) {
|
|
2907
|
+
extractToDef(entry);
|
|
2908
|
+
continue;
|
|
2909
|
+
}
|
|
2910
|
+
}
|
|
2911
|
+
if (ctx.metadataRegistry.get(entry[0])?.id) {
|
|
2912
|
+
extractToDef(entry);
|
|
2913
|
+
continue;
|
|
2914
|
+
}
|
|
2915
|
+
if (seen.cycle) {
|
|
2916
|
+
extractToDef(entry);
|
|
2917
|
+
continue;
|
|
2918
|
+
}
|
|
2919
|
+
if (seen.count > 1) {
|
|
2920
|
+
if (ctx.reused === "ref") {
|
|
2921
|
+
extractToDef(entry);
|
|
2922
|
+
continue;
|
|
2923
|
+
}
|
|
2924
|
+
}
|
|
2925
|
+
}
|
|
2926
|
+
}
|
|
2927
|
+
function finalize(ctx, schema) {
|
|
2928
|
+
const root = ctx.seen.get(schema);
|
|
2929
|
+
if (!root) throw new Error("Unprocessed schema. This is a bug in Zod.");
|
|
2930
|
+
const flattenRef = (zodSchema) => {
|
|
2931
|
+
const seen = ctx.seen.get(zodSchema);
|
|
2932
|
+
if (seen.ref === null) return;
|
|
2933
|
+
const schema = seen.def ?? seen.schema;
|
|
2934
|
+
const _cached = { ...schema };
|
|
2935
|
+
const ref = seen.ref;
|
|
2936
|
+
seen.ref = null;
|
|
2937
|
+
if (ref) {
|
|
2938
|
+
flattenRef(ref);
|
|
2939
|
+
const refSeen = ctx.seen.get(ref);
|
|
2940
|
+
const refSchema = refSeen.schema;
|
|
2941
|
+
if (refSchema.$ref && (ctx.target === "draft-07" || ctx.target === "draft-04" || ctx.target === "openapi-3.0")) {
|
|
2942
|
+
schema.allOf = schema.allOf ?? [];
|
|
2943
|
+
schema.allOf.push(refSchema);
|
|
2944
|
+
} else Object.assign(schema, refSchema);
|
|
2945
|
+
Object.assign(schema, _cached);
|
|
2946
|
+
if (zodSchema._zod.parent === ref) for (const key in schema) {
|
|
2947
|
+
if (key === "$ref" || key === "allOf") continue;
|
|
2948
|
+
if (!(key in _cached)) delete schema[key];
|
|
2949
|
+
}
|
|
2950
|
+
if (refSchema.$ref && refSeen.def) for (const key in schema) {
|
|
2951
|
+
if (key === "$ref" || key === "allOf") continue;
|
|
2952
|
+
if (key in refSeen.def && JSON.stringify(schema[key]) === JSON.stringify(refSeen.def[key])) delete schema[key];
|
|
2953
|
+
}
|
|
2954
|
+
}
|
|
2955
|
+
const parent = zodSchema._zod.parent;
|
|
2956
|
+
if (parent && parent !== ref) {
|
|
2957
|
+
flattenRef(parent);
|
|
2958
|
+
const parentSeen = ctx.seen.get(parent);
|
|
2959
|
+
if (parentSeen?.schema.$ref) {
|
|
2960
|
+
schema.$ref = parentSeen.schema.$ref;
|
|
2961
|
+
if (parentSeen.def) for (const key in schema) {
|
|
2962
|
+
if (key === "$ref" || key === "allOf") continue;
|
|
2963
|
+
if (key in parentSeen.def && JSON.stringify(schema[key]) === JSON.stringify(parentSeen.def[key])) delete schema[key];
|
|
2964
|
+
}
|
|
2965
|
+
}
|
|
2966
|
+
}
|
|
2967
|
+
ctx.override({
|
|
2968
|
+
zodSchema,
|
|
2969
|
+
jsonSchema: schema,
|
|
2970
|
+
path: seen.path ?? []
|
|
2971
|
+
});
|
|
2972
|
+
};
|
|
2973
|
+
for (const entry of [...ctx.seen.entries()].reverse()) flattenRef(entry[0]);
|
|
2974
|
+
const result = {};
|
|
2975
|
+
if (ctx.target === "draft-2020-12") result.$schema = "https://json-schema.org/draft/2020-12/schema";
|
|
2976
|
+
else if (ctx.target === "draft-07") result.$schema = "http://json-schema.org/draft-07/schema#";
|
|
2977
|
+
else if (ctx.target === "draft-04") result.$schema = "http://json-schema.org/draft-04/schema#";
|
|
2978
|
+
else if (ctx.target === "openapi-3.0") {}
|
|
2979
|
+
if (ctx.external?.uri) {
|
|
2980
|
+
const id = ctx.external.registry.get(schema)?.id;
|
|
2981
|
+
if (!id) throw new Error("Schema is missing an `id` property");
|
|
2982
|
+
result.$id = ctx.external.uri(id);
|
|
2983
|
+
}
|
|
2984
|
+
Object.assign(result, root.def ?? root.schema);
|
|
2985
|
+
const rootMetaId = ctx.metadataRegistry.get(schema)?.id;
|
|
2986
|
+
if (rootMetaId !== void 0 && result.id === rootMetaId) delete result.id;
|
|
2987
|
+
const defs = ctx.external?.defs ?? {};
|
|
2988
|
+
for (const entry of ctx.seen.entries()) {
|
|
2989
|
+
const seen = entry[1];
|
|
2990
|
+
if (seen.def && seen.defId) {
|
|
2991
|
+
if (seen.def.id === seen.defId) delete seen.def.id;
|
|
2992
|
+
defs[seen.defId] = seen.def;
|
|
2993
|
+
}
|
|
2994
|
+
}
|
|
2995
|
+
if (ctx.external) {} else if (Object.keys(defs).length > 0) if (ctx.target === "draft-2020-12") result.$defs = defs;
|
|
2996
|
+
else result.definitions = defs;
|
|
2997
|
+
try {
|
|
2998
|
+
const finalized = JSON.parse(JSON.stringify(result));
|
|
2999
|
+
Object.defineProperty(finalized, "~standard", {
|
|
3000
|
+
value: {
|
|
3001
|
+
...schema["~standard"],
|
|
3002
|
+
jsonSchema: {
|
|
3003
|
+
input: createStandardJSONSchemaMethod(schema, "input", ctx.processors),
|
|
3004
|
+
output: createStandardJSONSchemaMethod(schema, "output", ctx.processors)
|
|
3005
|
+
}
|
|
3006
|
+
},
|
|
3007
|
+
enumerable: false,
|
|
3008
|
+
writable: false
|
|
3009
|
+
});
|
|
3010
|
+
return finalized;
|
|
3011
|
+
} catch (_err) {
|
|
3012
|
+
throw new Error("Error converting schema to JSON.");
|
|
3013
|
+
}
|
|
3014
|
+
}
|
|
3015
|
+
function isTransforming(_schema, _ctx) {
|
|
3016
|
+
const ctx = _ctx ?? { seen: /* @__PURE__ */ new Set() };
|
|
3017
|
+
if (ctx.seen.has(_schema)) return false;
|
|
3018
|
+
ctx.seen.add(_schema);
|
|
3019
|
+
const def = _schema._zod.def;
|
|
3020
|
+
if (def.type === "transform") return true;
|
|
3021
|
+
if (def.type === "array") return isTransforming(def.element, ctx);
|
|
3022
|
+
if (def.type === "set") return isTransforming(def.valueType, ctx);
|
|
3023
|
+
if (def.type === "lazy") return isTransforming(def.getter(), ctx);
|
|
3024
|
+
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);
|
|
3025
|
+
if (def.type === "intersection") return isTransforming(def.left, ctx) || isTransforming(def.right, ctx);
|
|
3026
|
+
if (def.type === "record" || def.type === "map") return isTransforming(def.keyType, ctx) || isTransforming(def.valueType, ctx);
|
|
3027
|
+
if (def.type === "pipe") {
|
|
3028
|
+
if (_schema._zod.traits.has("$ZodCodec")) return true;
|
|
3029
|
+
return isTransforming(def.in, ctx) || isTransforming(def.out, ctx);
|
|
3030
|
+
}
|
|
3031
|
+
if (def.type === "object") {
|
|
3032
|
+
for (const key in def.shape) if (isTransforming(def.shape[key], ctx)) return true;
|
|
3033
|
+
return false;
|
|
3034
|
+
}
|
|
3035
|
+
if (def.type === "union") {
|
|
3036
|
+
for (const option of def.options) if (isTransforming(option, ctx)) return true;
|
|
3037
|
+
return false;
|
|
3038
|
+
}
|
|
3039
|
+
if (def.type === "tuple") {
|
|
3040
|
+
for (const item of def.items) if (isTransforming(item, ctx)) return true;
|
|
3041
|
+
if (def.rest && isTransforming(def.rest, ctx)) return true;
|
|
3042
|
+
return false;
|
|
3043
|
+
}
|
|
3044
|
+
return false;
|
|
3045
|
+
}
|
|
3046
|
+
/**
|
|
3047
|
+
* Creates a toJSONSchema method for a schema instance.
|
|
3048
|
+
* This encapsulates the logic of initializing context, processing, extracting defs, and finalizing.
|
|
3049
|
+
*/
|
|
3050
|
+
const createToJSONSchemaMethod = (schema, processors = {}) => (params) => {
|
|
3051
|
+
const ctx = initializeContext({
|
|
3052
|
+
...params,
|
|
3053
|
+
processors
|
|
3054
|
+
});
|
|
3055
|
+
process$1(schema, ctx);
|
|
3056
|
+
extractDefs(ctx, schema);
|
|
3057
|
+
return finalize(ctx, schema);
|
|
3058
|
+
};
|
|
3059
|
+
const createStandardJSONSchemaMethod = (schema, io, processors = {}) => (params) => {
|
|
3060
|
+
const { libraryOptions, target } = params ?? {};
|
|
3061
|
+
const ctx = initializeContext({
|
|
3062
|
+
...libraryOptions ?? {},
|
|
3063
|
+
target,
|
|
3064
|
+
io,
|
|
3065
|
+
processors
|
|
3066
|
+
});
|
|
3067
|
+
process$1(schema, ctx);
|
|
3068
|
+
extractDefs(ctx, schema);
|
|
3069
|
+
return finalize(ctx, schema);
|
|
3070
|
+
};
|
|
3071
|
+
//#endregion
|
|
3072
|
+
//#region ../../node_modules/zod/v4/core/json-schema-processors.js
|
|
3073
|
+
const formatMap = {
|
|
3074
|
+
guid: "uuid",
|
|
3075
|
+
url: "uri",
|
|
3076
|
+
datetime: "date-time",
|
|
3077
|
+
json_string: "json-string",
|
|
3078
|
+
regex: ""
|
|
3079
|
+
};
|
|
3080
|
+
const stringProcessor = (schema, ctx, _json, _params) => {
|
|
3081
|
+
const json = _json;
|
|
3082
|
+
json.type = "string";
|
|
3083
|
+
const { minimum, maximum, format, patterns, contentEncoding } = schema._zod.bag;
|
|
3084
|
+
if (typeof minimum === "number") json.minLength = minimum;
|
|
3085
|
+
if (typeof maximum === "number") json.maxLength = maximum;
|
|
3086
|
+
if (format) {
|
|
3087
|
+
json.format = formatMap[format] ?? format;
|
|
3088
|
+
if (json.format === "") delete json.format;
|
|
3089
|
+
if (format === "time") delete json.format;
|
|
3090
|
+
}
|
|
3091
|
+
if (contentEncoding) json.contentEncoding = contentEncoding;
|
|
3092
|
+
if (patterns && patterns.size > 0) {
|
|
3093
|
+
const regexes = [...patterns];
|
|
3094
|
+
if (regexes.length === 1) json.pattern = regexes[0].source;
|
|
3095
|
+
else if (regexes.length > 1) json.allOf = [...regexes.map((regex) => ({
|
|
3096
|
+
...ctx.target === "draft-07" || ctx.target === "draft-04" || ctx.target === "openapi-3.0" ? { type: "string" } : {},
|
|
3097
|
+
pattern: regex.source
|
|
3098
|
+
}))];
|
|
3099
|
+
}
|
|
3100
|
+
};
|
|
3101
|
+
const numberProcessor = (schema, ctx, _json, _params) => {
|
|
3102
|
+
const json = _json;
|
|
3103
|
+
const { minimum, maximum, format, multipleOf, exclusiveMaximum, exclusiveMinimum } = schema._zod.bag;
|
|
3104
|
+
if (typeof format === "string" && format.includes("int")) json.type = "integer";
|
|
3105
|
+
else json.type = "number";
|
|
3106
|
+
const exMin = typeof exclusiveMinimum === "number" && exclusiveMinimum >= (minimum ?? Number.NEGATIVE_INFINITY);
|
|
3107
|
+
const exMax = typeof exclusiveMaximum === "number" && exclusiveMaximum <= (maximum ?? Number.POSITIVE_INFINITY);
|
|
3108
|
+
const legacy = ctx.target === "draft-04" || ctx.target === "openapi-3.0";
|
|
3109
|
+
if (exMin) if (legacy) {
|
|
3110
|
+
json.minimum = exclusiveMinimum;
|
|
3111
|
+
json.exclusiveMinimum = true;
|
|
3112
|
+
} else json.exclusiveMinimum = exclusiveMinimum;
|
|
3113
|
+
else if (typeof minimum === "number") json.minimum = minimum;
|
|
3114
|
+
if (exMax) if (legacy) {
|
|
3115
|
+
json.maximum = exclusiveMaximum;
|
|
3116
|
+
json.exclusiveMaximum = true;
|
|
3117
|
+
} else json.exclusiveMaximum = exclusiveMaximum;
|
|
3118
|
+
else if (typeof maximum === "number") json.maximum = maximum;
|
|
3119
|
+
if (typeof multipleOf === "number") json.multipleOf = multipleOf;
|
|
3120
|
+
};
|
|
3121
|
+
const booleanProcessor = (_schema, _ctx, json, _params) => {
|
|
3122
|
+
json.type = "boolean";
|
|
3123
|
+
};
|
|
3124
|
+
const neverProcessor = (_schema, _ctx, json, _params) => {
|
|
3125
|
+
json.not = {};
|
|
3126
|
+
};
|
|
3127
|
+
const enumProcessor = (schema, _ctx, json, _params) => {
|
|
3128
|
+
const def = schema._zod.def;
|
|
3129
|
+
const values = getEnumValues(def.entries);
|
|
3130
|
+
if (values.every((v) => typeof v === "number")) json.type = "number";
|
|
3131
|
+
if (values.every((v) => typeof v === "string")) json.type = "string";
|
|
3132
|
+
json.enum = values;
|
|
3133
|
+
};
|
|
3134
|
+
const literalProcessor = (schema, ctx, json, _params) => {
|
|
3135
|
+
const def = schema._zod.def;
|
|
3136
|
+
const vals = [];
|
|
3137
|
+
for (const val of def.values) if (val === void 0) {
|
|
3138
|
+
if (ctx.unrepresentable === "throw") throw new Error("Literal `undefined` cannot be represented in JSON Schema");
|
|
3139
|
+
} else if (typeof val === "bigint") if (ctx.unrepresentable === "throw") throw new Error("BigInt literals cannot be represented in JSON Schema");
|
|
3140
|
+
else vals.push(Number(val));
|
|
3141
|
+
else vals.push(val);
|
|
3142
|
+
if (vals.length === 0) {} else if (vals.length === 1) {
|
|
3143
|
+
const val = vals[0];
|
|
3144
|
+
json.type = val === null ? "null" : typeof val;
|
|
3145
|
+
if (ctx.target === "draft-04" || ctx.target === "openapi-3.0") json.enum = [val];
|
|
3146
|
+
else json.const = val;
|
|
3147
|
+
} else {
|
|
3148
|
+
if (vals.every((v) => typeof v === "number")) json.type = "number";
|
|
3149
|
+
if (vals.every((v) => typeof v === "string")) json.type = "string";
|
|
3150
|
+
if (vals.every((v) => typeof v === "boolean")) json.type = "boolean";
|
|
3151
|
+
if (vals.every((v) => v === null)) json.type = "null";
|
|
3152
|
+
json.enum = vals;
|
|
3153
|
+
}
|
|
3154
|
+
};
|
|
3155
|
+
const customProcessor = (_schema, ctx, _json, _params) => {
|
|
3156
|
+
if (ctx.unrepresentable === "throw") throw new Error("Custom types cannot be represented in JSON Schema");
|
|
3157
|
+
};
|
|
3158
|
+
const transformProcessor = (_schema, ctx, _json, _params) => {
|
|
3159
|
+
if (ctx.unrepresentable === "throw") throw new Error("Transforms cannot be represented in JSON Schema");
|
|
3160
|
+
};
|
|
3161
|
+
const arrayProcessor = (schema, ctx, _json, params) => {
|
|
3162
|
+
const json = _json;
|
|
3163
|
+
const def = schema._zod.def;
|
|
3164
|
+
const { minimum, maximum } = schema._zod.bag;
|
|
3165
|
+
if (typeof minimum === "number") json.minItems = minimum;
|
|
3166
|
+
if (typeof maximum === "number") json.maxItems = maximum;
|
|
3167
|
+
json.type = "array";
|
|
3168
|
+
json.items = process$1(def.element, ctx, {
|
|
3169
|
+
...params,
|
|
3170
|
+
path: [...params.path, "items"]
|
|
3171
|
+
});
|
|
3172
|
+
};
|
|
3173
|
+
const objectProcessor = (schema, ctx, _json, params) => {
|
|
3174
|
+
const json = _json;
|
|
3175
|
+
const def = schema._zod.def;
|
|
3176
|
+
json.type = "object";
|
|
3177
|
+
json.properties = {};
|
|
3178
|
+
const shape = def.shape;
|
|
3179
|
+
for (const key in shape) json.properties[key] = process$1(shape[key], ctx, {
|
|
3180
|
+
...params,
|
|
3181
|
+
path: [
|
|
3182
|
+
...params.path,
|
|
3183
|
+
"properties",
|
|
3184
|
+
key
|
|
3185
|
+
]
|
|
3186
|
+
});
|
|
3187
|
+
const allKeys = new Set(Object.keys(shape));
|
|
3188
|
+
const requiredKeys = new Set([...allKeys].filter((key) => {
|
|
3189
|
+
const v = def.shape[key]._zod;
|
|
3190
|
+
if (ctx.io === "input") return v.optin === void 0;
|
|
3191
|
+
else return v.optout === void 0;
|
|
3192
|
+
}));
|
|
3193
|
+
if (requiredKeys.size > 0) json.required = Array.from(requiredKeys);
|
|
3194
|
+
if (def.catchall?._zod.def.type === "never") json.additionalProperties = false;
|
|
3195
|
+
else if (!def.catchall) {
|
|
3196
|
+
if (ctx.io === "output") json.additionalProperties = false;
|
|
3197
|
+
} else if (def.catchall) json.additionalProperties = process$1(def.catchall, ctx, {
|
|
3198
|
+
...params,
|
|
3199
|
+
path: [...params.path, "additionalProperties"]
|
|
3200
|
+
});
|
|
3201
|
+
};
|
|
3202
|
+
const unionProcessor = (schema, ctx, json, params) => {
|
|
3203
|
+
const def = schema._zod.def;
|
|
3204
|
+
const isExclusive = def.inclusive === false;
|
|
3205
|
+
const options = def.options.map((x, i) => process$1(x, ctx, {
|
|
3206
|
+
...params,
|
|
3207
|
+
path: [
|
|
3208
|
+
...params.path,
|
|
3209
|
+
isExclusive ? "oneOf" : "anyOf",
|
|
3210
|
+
i
|
|
3211
|
+
]
|
|
3212
|
+
}));
|
|
3213
|
+
if (isExclusive) json.oneOf = options;
|
|
3214
|
+
else json.anyOf = options;
|
|
3215
|
+
};
|
|
3216
|
+
const intersectionProcessor = (schema, ctx, json, params) => {
|
|
3217
|
+
const def = schema._zod.def;
|
|
3218
|
+
const a = process$1(def.left, ctx, {
|
|
3219
|
+
...params,
|
|
3220
|
+
path: [
|
|
3221
|
+
...params.path,
|
|
3222
|
+
"allOf",
|
|
3223
|
+
0
|
|
3224
|
+
]
|
|
3225
|
+
});
|
|
3226
|
+
const b = process$1(def.right, ctx, {
|
|
3227
|
+
...params,
|
|
3228
|
+
path: [
|
|
3229
|
+
...params.path,
|
|
3230
|
+
"allOf",
|
|
3231
|
+
1
|
|
3232
|
+
]
|
|
3233
|
+
});
|
|
3234
|
+
const isSimpleIntersection = (val) => "allOf" in val && Object.keys(val).length === 1;
|
|
3235
|
+
json.allOf = [...isSimpleIntersection(a) ? a.allOf : [a], ...isSimpleIntersection(b) ? b.allOf : [b]];
|
|
3236
|
+
};
|
|
3237
|
+
const tupleProcessor = (schema, ctx, _json, params) => {
|
|
3238
|
+
const json = _json;
|
|
3239
|
+
const def = schema._zod.def;
|
|
3240
|
+
json.type = "array";
|
|
3241
|
+
const prefixPath = ctx.target === "draft-2020-12" ? "prefixItems" : "items";
|
|
3242
|
+
const restPath = ctx.target === "draft-2020-12" ? "items" : ctx.target === "openapi-3.0" ? "items" : "additionalItems";
|
|
3243
|
+
const prefixItems = def.items.map((x, i) => process$1(x, ctx, {
|
|
3244
|
+
...params,
|
|
3245
|
+
path: [
|
|
3246
|
+
...params.path,
|
|
3247
|
+
prefixPath,
|
|
3248
|
+
i
|
|
3249
|
+
]
|
|
3250
|
+
}));
|
|
3251
|
+
const rest = def.rest ? process$1(def.rest, ctx, {
|
|
3252
|
+
...params,
|
|
3253
|
+
path: [
|
|
3254
|
+
...params.path,
|
|
3255
|
+
restPath,
|
|
3256
|
+
...ctx.target === "openapi-3.0" ? [def.items.length] : []
|
|
3257
|
+
]
|
|
3258
|
+
}) : null;
|
|
3259
|
+
if (ctx.target === "draft-2020-12") {
|
|
3260
|
+
json.prefixItems = prefixItems;
|
|
3261
|
+
if (rest) json.items = rest;
|
|
3262
|
+
} else if (ctx.target === "openapi-3.0") {
|
|
3263
|
+
json.items = { anyOf: prefixItems };
|
|
3264
|
+
if (rest) json.items.anyOf.push(rest);
|
|
3265
|
+
json.minItems = prefixItems.length;
|
|
3266
|
+
if (!rest) json.maxItems = prefixItems.length;
|
|
3267
|
+
} else {
|
|
3268
|
+
json.items = prefixItems;
|
|
3269
|
+
if (rest) json.additionalItems = rest;
|
|
3270
|
+
}
|
|
3271
|
+
const { minimum, maximum } = schema._zod.bag;
|
|
3272
|
+
if (typeof minimum === "number") json.minItems = minimum;
|
|
3273
|
+
if (typeof maximum === "number") json.maxItems = maximum;
|
|
3274
|
+
};
|
|
3275
|
+
const nullableProcessor = (schema, ctx, json, params) => {
|
|
3276
|
+
const def = schema._zod.def;
|
|
3277
|
+
const inner = process$1(def.innerType, ctx, params);
|
|
3278
|
+
const seen = ctx.seen.get(schema);
|
|
3279
|
+
if (ctx.target === "openapi-3.0") {
|
|
3280
|
+
seen.ref = def.innerType;
|
|
3281
|
+
json.nullable = true;
|
|
3282
|
+
} else json.anyOf = [inner, { type: "null" }];
|
|
3283
|
+
};
|
|
3284
|
+
const nonoptionalProcessor = (schema, ctx, _json, params) => {
|
|
3285
|
+
const def = schema._zod.def;
|
|
3286
|
+
process$1(def.innerType, ctx, params);
|
|
3287
|
+
const seen = ctx.seen.get(schema);
|
|
3288
|
+
seen.ref = def.innerType;
|
|
3289
|
+
};
|
|
3290
|
+
const defaultProcessor = (schema, ctx, json, params) => {
|
|
3291
|
+
const def = schema._zod.def;
|
|
3292
|
+
process$1(def.innerType, ctx, params);
|
|
3293
|
+
const seen = ctx.seen.get(schema);
|
|
3294
|
+
seen.ref = def.innerType;
|
|
3295
|
+
json.default = JSON.parse(JSON.stringify(def.defaultValue));
|
|
3296
|
+
};
|
|
3297
|
+
const prefaultProcessor = (schema, ctx, json, params) => {
|
|
3298
|
+
const def = schema._zod.def;
|
|
3299
|
+
process$1(def.innerType, ctx, params);
|
|
3300
|
+
const seen = ctx.seen.get(schema);
|
|
3301
|
+
seen.ref = def.innerType;
|
|
3302
|
+
if (ctx.io === "input") json._prefault = JSON.parse(JSON.stringify(def.defaultValue));
|
|
3303
|
+
};
|
|
3304
|
+
const catchProcessor = (schema, ctx, json, params) => {
|
|
3305
|
+
const def = schema._zod.def;
|
|
3306
|
+
process$1(def.innerType, ctx, params);
|
|
3307
|
+
const seen = ctx.seen.get(schema);
|
|
3308
|
+
seen.ref = def.innerType;
|
|
3309
|
+
let catchValue;
|
|
3310
|
+
try {
|
|
3311
|
+
catchValue = def.catchValue(void 0);
|
|
3312
|
+
} catch {
|
|
3313
|
+
throw new Error("Dynamic catch values are not supported in JSON Schema");
|
|
3314
|
+
}
|
|
3315
|
+
json.default = catchValue;
|
|
3316
|
+
};
|
|
3317
|
+
const pipeProcessor = (schema, ctx, _json, params) => {
|
|
3318
|
+
const def = schema._zod.def;
|
|
3319
|
+
const inIsTransform = def.in._zod.traits.has("$ZodTransform");
|
|
3320
|
+
const innerType = ctx.io === "input" ? inIsTransform ? def.out : def.in : def.out;
|
|
3321
|
+
process$1(innerType, ctx, params);
|
|
3322
|
+
const seen = ctx.seen.get(schema);
|
|
3323
|
+
seen.ref = innerType;
|
|
3324
|
+
};
|
|
3325
|
+
const readonlyProcessor = (schema, ctx, json, params) => {
|
|
3326
|
+
const def = schema._zod.def;
|
|
3327
|
+
process$1(def.innerType, ctx, params);
|
|
3328
|
+
const seen = ctx.seen.get(schema);
|
|
3329
|
+
seen.ref = def.innerType;
|
|
3330
|
+
json.readOnly = true;
|
|
3331
|
+
};
|
|
3332
|
+
const optionalProcessor = (schema, ctx, _json, params) => {
|
|
3333
|
+
const def = schema._zod.def;
|
|
3334
|
+
process$1(def.innerType, ctx, params);
|
|
3335
|
+
const seen = ctx.seen.get(schema);
|
|
3336
|
+
seen.ref = def.innerType;
|
|
3337
|
+
};
|
|
3338
|
+
//#endregion
|
|
3339
|
+
//#region ../../node_modules/zod/v4/classic/iso.js
|
|
3340
|
+
const ZodISODateTime = /*@__PURE__*/ $constructor("ZodISODateTime", (inst, def) => {
|
|
3341
|
+
$ZodISODateTime.init(inst, def);
|
|
3342
|
+
ZodStringFormat.init(inst, def);
|
|
3343
|
+
});
|
|
3344
|
+
function datetime(params) {
|
|
3345
|
+
return /* @__PURE__ */ _isoDateTime(ZodISODateTime, params);
|
|
3346
|
+
}
|
|
3347
|
+
const ZodISODate = /*@__PURE__*/ $constructor("ZodISODate", (inst, def) => {
|
|
3348
|
+
$ZodISODate.init(inst, def);
|
|
3349
|
+
ZodStringFormat.init(inst, def);
|
|
3350
|
+
});
|
|
3351
|
+
function date(params) {
|
|
3352
|
+
return /* @__PURE__ */ _isoDate(ZodISODate, params);
|
|
3353
|
+
}
|
|
3354
|
+
const ZodISOTime = /*@__PURE__*/ $constructor("ZodISOTime", (inst, def) => {
|
|
3355
|
+
$ZodISOTime.init(inst, def);
|
|
3356
|
+
ZodStringFormat.init(inst, def);
|
|
3357
|
+
});
|
|
3358
|
+
function time(params) {
|
|
3359
|
+
return /* @__PURE__ */ _isoTime(ZodISOTime, params);
|
|
3360
|
+
}
|
|
3361
|
+
const ZodISODuration = /*@__PURE__*/ $constructor("ZodISODuration", (inst, def) => {
|
|
3362
|
+
$ZodISODuration.init(inst, def);
|
|
3363
|
+
ZodStringFormat.init(inst, def);
|
|
3364
|
+
});
|
|
3365
|
+
function duration(params) {
|
|
3366
|
+
return /* @__PURE__ */ _isoDuration(ZodISODuration, params);
|
|
3367
|
+
}
|
|
3368
|
+
//#endregion
|
|
3369
|
+
//#region ../../node_modules/zod/v4/classic/errors.js
|
|
3370
|
+
const initializer = (inst, issues) => {
|
|
3371
|
+
$ZodError.init(inst, issues);
|
|
3372
|
+
inst.name = "ZodError";
|
|
3373
|
+
Object.defineProperties(inst, {
|
|
3374
|
+
format: { value: (mapper) => formatError(inst, mapper) },
|
|
3375
|
+
flatten: { value: (mapper) => flattenError(inst, mapper) },
|
|
3376
|
+
addIssue: { value: (issue) => {
|
|
3377
|
+
inst.issues.push(issue);
|
|
3378
|
+
inst.message = JSON.stringify(inst.issues, jsonStringifyReplacer, 2);
|
|
3379
|
+
} },
|
|
3380
|
+
addIssues: { value: (issues) => {
|
|
3381
|
+
inst.issues.push(...issues);
|
|
3382
|
+
inst.message = JSON.stringify(inst.issues, jsonStringifyReplacer, 2);
|
|
3383
|
+
} },
|
|
3384
|
+
isEmpty: { get() {
|
|
3385
|
+
return inst.issues.length === 0;
|
|
3386
|
+
} }
|
|
3387
|
+
});
|
|
3388
|
+
};
|
|
3389
|
+
const ZodRealError = /*@__PURE__*/ $constructor("ZodError", initializer, { Parent: Error });
|
|
3390
|
+
//#endregion
|
|
3391
|
+
//#region ../../node_modules/zod/v4/classic/parse.js
|
|
3392
|
+
const parse = /* @__PURE__ */ _parse(ZodRealError);
|
|
3393
|
+
const parseAsync = /* @__PURE__ */ _parseAsync(ZodRealError);
|
|
3394
|
+
const safeParse = /* @__PURE__ */ _safeParse(ZodRealError);
|
|
3395
|
+
const safeParseAsync = /* @__PURE__ */ _safeParseAsync(ZodRealError);
|
|
3396
|
+
const encode = /* @__PURE__ */ _encode(ZodRealError);
|
|
3397
|
+
const decode = /* @__PURE__ */ _decode(ZodRealError);
|
|
3398
|
+
const encodeAsync = /* @__PURE__ */ _encodeAsync(ZodRealError);
|
|
3399
|
+
const decodeAsync = /* @__PURE__ */ _decodeAsync(ZodRealError);
|
|
3400
|
+
const safeEncode = /* @__PURE__ */ _safeEncode(ZodRealError);
|
|
3401
|
+
const safeDecode = /* @__PURE__ */ _safeDecode(ZodRealError);
|
|
3402
|
+
const safeEncodeAsync = /* @__PURE__ */ _safeEncodeAsync(ZodRealError);
|
|
3403
|
+
const safeDecodeAsync = /* @__PURE__ */ _safeDecodeAsync(ZodRealError);
|
|
3404
|
+
//#endregion
|
|
3405
|
+
//#region ../../node_modules/zod/v4/classic/schemas.js
|
|
3406
|
+
const _installedGroups = /* @__PURE__ */ new WeakMap();
|
|
3407
|
+
function _installLazyMethods(inst, group, methods) {
|
|
3408
|
+
const proto = Object.getPrototypeOf(inst);
|
|
3409
|
+
let installed = _installedGroups.get(proto);
|
|
3410
|
+
if (!installed) {
|
|
3411
|
+
installed = /* @__PURE__ */ new Set();
|
|
3412
|
+
_installedGroups.set(proto, installed);
|
|
3413
|
+
}
|
|
3414
|
+
if (installed.has(group)) return;
|
|
3415
|
+
installed.add(group);
|
|
3416
|
+
for (const key in methods) {
|
|
3417
|
+
const fn = methods[key];
|
|
3418
|
+
Object.defineProperty(proto, key, {
|
|
3419
|
+
configurable: true,
|
|
3420
|
+
enumerable: false,
|
|
3421
|
+
get() {
|
|
3422
|
+
const bound = fn.bind(this);
|
|
3423
|
+
Object.defineProperty(this, key, {
|
|
3424
|
+
configurable: true,
|
|
3425
|
+
writable: true,
|
|
3426
|
+
enumerable: true,
|
|
3427
|
+
value: bound
|
|
3428
|
+
});
|
|
3429
|
+
return bound;
|
|
3430
|
+
},
|
|
3431
|
+
set(v) {
|
|
3432
|
+
Object.defineProperty(this, key, {
|
|
3433
|
+
configurable: true,
|
|
3434
|
+
writable: true,
|
|
3435
|
+
enumerable: true,
|
|
3436
|
+
value: v
|
|
3437
|
+
});
|
|
3438
|
+
}
|
|
3439
|
+
});
|
|
3440
|
+
}
|
|
3441
|
+
}
|
|
3442
|
+
const ZodType = /*@__PURE__*/ $constructor("ZodType", (inst, def) => {
|
|
3443
|
+
$ZodType.init(inst, def);
|
|
3444
|
+
Object.assign(inst["~standard"], { jsonSchema: {
|
|
3445
|
+
input: createStandardJSONSchemaMethod(inst, "input"),
|
|
3446
|
+
output: createStandardJSONSchemaMethod(inst, "output")
|
|
3447
|
+
} });
|
|
3448
|
+
inst.toJSONSchema = createToJSONSchemaMethod(inst, {});
|
|
3449
|
+
inst.def = def;
|
|
3450
|
+
inst.type = def.type;
|
|
3451
|
+
Object.defineProperty(inst, "_def", { value: def });
|
|
3452
|
+
inst.parse = (data, params) => parse(inst, data, params, { callee: inst.parse });
|
|
3453
|
+
inst.safeParse = (data, params) => safeParse(inst, data, params);
|
|
3454
|
+
inst.parseAsync = async (data, params) => parseAsync(inst, data, params, { callee: inst.parseAsync });
|
|
3455
|
+
inst.safeParseAsync = async (data, params) => safeParseAsync(inst, data, params);
|
|
3456
|
+
inst.spa = inst.safeParseAsync;
|
|
3457
|
+
inst.encode = (data, params) => encode(inst, data, params);
|
|
3458
|
+
inst.decode = (data, params) => decode(inst, data, params);
|
|
3459
|
+
inst.encodeAsync = async (data, params) => encodeAsync(inst, data, params);
|
|
3460
|
+
inst.decodeAsync = async (data, params) => decodeAsync(inst, data, params);
|
|
3461
|
+
inst.safeEncode = (data, params) => safeEncode(inst, data, params);
|
|
3462
|
+
inst.safeDecode = (data, params) => safeDecode(inst, data, params);
|
|
3463
|
+
inst.safeEncodeAsync = async (data, params) => safeEncodeAsync(inst, data, params);
|
|
3464
|
+
inst.safeDecodeAsync = async (data, params) => safeDecodeAsync(inst, data, params);
|
|
3465
|
+
_installLazyMethods(inst, "ZodType", {
|
|
3466
|
+
check(...chks) {
|
|
3467
|
+
const def = this.def;
|
|
3468
|
+
return this.clone(mergeDefs(def, { checks: [...def.checks ?? [], ...chks.map((ch) => typeof ch === "function" ? { _zod: {
|
|
3469
|
+
check: ch,
|
|
3470
|
+
def: { check: "custom" },
|
|
3471
|
+
onattach: []
|
|
3472
|
+
} } : ch)] }), { parent: true });
|
|
3473
|
+
},
|
|
3474
|
+
with(...chks) {
|
|
3475
|
+
return this.check(...chks);
|
|
3476
|
+
},
|
|
3477
|
+
clone(def, params) {
|
|
3478
|
+
return clone$1(this, def, params);
|
|
3479
|
+
},
|
|
3480
|
+
brand() {
|
|
3481
|
+
return this;
|
|
3482
|
+
},
|
|
3483
|
+
register(reg, meta) {
|
|
3484
|
+
reg.add(this, meta);
|
|
3485
|
+
return this;
|
|
3486
|
+
},
|
|
3487
|
+
refine(check, params) {
|
|
3488
|
+
return this.check(refine(check, params));
|
|
3489
|
+
},
|
|
3490
|
+
superRefine(refinement, params) {
|
|
3491
|
+
return this.check(superRefine(refinement, params));
|
|
3492
|
+
},
|
|
3493
|
+
overwrite(fn) {
|
|
3494
|
+
return this.check(/* @__PURE__ */ _overwrite(fn));
|
|
3495
|
+
},
|
|
3496
|
+
optional() {
|
|
3497
|
+
return optional(this);
|
|
3498
|
+
},
|
|
3499
|
+
exactOptional() {
|
|
3500
|
+
return exactOptional(this);
|
|
3501
|
+
},
|
|
3502
|
+
nullable() {
|
|
3503
|
+
return nullable(this);
|
|
3504
|
+
},
|
|
3505
|
+
nullish() {
|
|
3506
|
+
return optional(nullable(this));
|
|
3507
|
+
},
|
|
3508
|
+
nonoptional(params) {
|
|
3509
|
+
return nonoptional(this, params);
|
|
3510
|
+
},
|
|
3511
|
+
array() {
|
|
3512
|
+
return array(this);
|
|
3513
|
+
},
|
|
3514
|
+
or(arg) {
|
|
3515
|
+
return union([this, arg]);
|
|
3516
|
+
},
|
|
3517
|
+
and(arg) {
|
|
3518
|
+
return intersection(this, arg);
|
|
3519
|
+
},
|
|
3520
|
+
transform(tx) {
|
|
3521
|
+
return pipe(this, transform(tx));
|
|
3522
|
+
},
|
|
3523
|
+
default(d) {
|
|
3524
|
+
return _default(this, d);
|
|
3525
|
+
},
|
|
3526
|
+
prefault(d) {
|
|
3527
|
+
return prefault(this, d);
|
|
3528
|
+
},
|
|
3529
|
+
catch(params) {
|
|
3530
|
+
return _catch(this, params);
|
|
3531
|
+
},
|
|
3532
|
+
pipe(target) {
|
|
3533
|
+
return pipe(this, target);
|
|
3534
|
+
},
|
|
3535
|
+
readonly() {
|
|
3536
|
+
return readonly(this);
|
|
3537
|
+
},
|
|
3538
|
+
describe(description) {
|
|
3539
|
+
const cl = this.clone();
|
|
3540
|
+
globalRegistry.add(cl, { description });
|
|
3541
|
+
return cl;
|
|
3542
|
+
},
|
|
3543
|
+
meta(...args) {
|
|
3544
|
+
if (args.length === 0) return globalRegistry.get(this);
|
|
3545
|
+
const cl = this.clone();
|
|
3546
|
+
globalRegistry.add(cl, args[0]);
|
|
3547
|
+
return cl;
|
|
3548
|
+
},
|
|
3549
|
+
isOptional() {
|
|
3550
|
+
return this.safeParse(void 0).success;
|
|
3551
|
+
},
|
|
3552
|
+
isNullable() {
|
|
3553
|
+
return this.safeParse(null).success;
|
|
3554
|
+
},
|
|
3555
|
+
apply(fn) {
|
|
3556
|
+
return fn(this);
|
|
3557
|
+
}
|
|
3558
|
+
});
|
|
3559
|
+
Object.defineProperty(inst, "description", {
|
|
3560
|
+
get() {
|
|
3561
|
+
return globalRegistry.get(inst)?.description;
|
|
3562
|
+
},
|
|
3563
|
+
configurable: true
|
|
3564
|
+
});
|
|
3565
|
+
return inst;
|
|
3566
|
+
});
|
|
3567
|
+
/** @internal */
|
|
3568
|
+
const _ZodString = /*@__PURE__*/ $constructor("_ZodString", (inst, def) => {
|
|
3569
|
+
$ZodString.init(inst, def);
|
|
3570
|
+
ZodType.init(inst, def);
|
|
3571
|
+
inst._zod.processJSONSchema = (ctx, json, params) => stringProcessor(inst, ctx, json, params);
|
|
3572
|
+
const bag = inst._zod.bag;
|
|
3573
|
+
inst.format = bag.format ?? null;
|
|
3574
|
+
inst.minLength = bag.minimum ?? null;
|
|
3575
|
+
inst.maxLength = bag.maximum ?? null;
|
|
3576
|
+
_installLazyMethods(inst, "_ZodString", {
|
|
3577
|
+
regex(...args) {
|
|
3578
|
+
return this.check(/* @__PURE__ */ _regex(...args));
|
|
3579
|
+
},
|
|
3580
|
+
includes(...args) {
|
|
3581
|
+
return this.check(/* @__PURE__ */ _includes(...args));
|
|
3582
|
+
},
|
|
3583
|
+
startsWith(...args) {
|
|
3584
|
+
return this.check(/* @__PURE__ */ _startsWith(...args));
|
|
3585
|
+
},
|
|
3586
|
+
endsWith(...args) {
|
|
3587
|
+
return this.check(/* @__PURE__ */ _endsWith(...args));
|
|
3588
|
+
},
|
|
3589
|
+
min(...args) {
|
|
3590
|
+
return this.check(/* @__PURE__ */ _minLength(...args));
|
|
3591
|
+
},
|
|
3592
|
+
max(...args) {
|
|
3593
|
+
return this.check(/* @__PURE__ */ _maxLength(...args));
|
|
3594
|
+
},
|
|
3595
|
+
length(...args) {
|
|
3596
|
+
return this.check(/* @__PURE__ */ _length(...args));
|
|
3597
|
+
},
|
|
3598
|
+
nonempty(...args) {
|
|
3599
|
+
return this.check(/* @__PURE__ */ _minLength(1, ...args));
|
|
3600
|
+
},
|
|
3601
|
+
lowercase(params) {
|
|
3602
|
+
return this.check(/* @__PURE__ */ _lowercase(params));
|
|
3603
|
+
},
|
|
3604
|
+
uppercase(params) {
|
|
3605
|
+
return this.check(/* @__PURE__ */ _uppercase(params));
|
|
3606
|
+
},
|
|
3607
|
+
trim() {
|
|
3608
|
+
return this.check(/* @__PURE__ */ _trim());
|
|
3609
|
+
},
|
|
3610
|
+
normalize(...args) {
|
|
3611
|
+
return this.check(/* @__PURE__ */ _normalize(...args));
|
|
3612
|
+
},
|
|
3613
|
+
toLowerCase() {
|
|
3614
|
+
return this.check(/* @__PURE__ */ _toLowerCase());
|
|
3615
|
+
},
|
|
3616
|
+
toUpperCase() {
|
|
3617
|
+
return this.check(/* @__PURE__ */ _toUpperCase());
|
|
3618
|
+
},
|
|
3619
|
+
slugify() {
|
|
3620
|
+
return this.check(/* @__PURE__ */ _slugify());
|
|
3621
|
+
}
|
|
3622
|
+
});
|
|
3623
|
+
});
|
|
3624
|
+
const ZodString = /*@__PURE__*/ $constructor("ZodString", (inst, def) => {
|
|
3625
|
+
$ZodString.init(inst, def);
|
|
3626
|
+
_ZodString.init(inst, def);
|
|
3627
|
+
inst.email = (params) => inst.check(/* @__PURE__ */ _email(ZodEmail, params));
|
|
3628
|
+
inst.url = (params) => inst.check(/* @__PURE__ */ _url(ZodURL, params));
|
|
3629
|
+
inst.jwt = (params) => inst.check(/* @__PURE__ */ _jwt(ZodJWT, params));
|
|
3630
|
+
inst.emoji = (params) => inst.check(/* @__PURE__ */ _emoji(ZodEmoji, params));
|
|
3631
|
+
inst.guid = (params) => inst.check(/* @__PURE__ */ _guid(ZodGUID, params));
|
|
3632
|
+
inst.uuid = (params) => inst.check(/* @__PURE__ */ _uuid(ZodUUID, params));
|
|
3633
|
+
inst.uuidv4 = (params) => inst.check(/* @__PURE__ */ _uuidv4(ZodUUID, params));
|
|
3634
|
+
inst.uuidv6 = (params) => inst.check(/* @__PURE__ */ _uuidv6(ZodUUID, params));
|
|
3635
|
+
inst.uuidv7 = (params) => inst.check(/* @__PURE__ */ _uuidv7(ZodUUID, params));
|
|
3636
|
+
inst.nanoid = (params) => inst.check(/* @__PURE__ */ _nanoid(ZodNanoID, params));
|
|
3637
|
+
inst.guid = (params) => inst.check(/* @__PURE__ */ _guid(ZodGUID, params));
|
|
3638
|
+
inst.cuid = (params) => inst.check(/* @__PURE__ */ _cuid(ZodCUID, params));
|
|
3639
|
+
inst.cuid2 = (params) => inst.check(/* @__PURE__ */ _cuid2(ZodCUID2, params));
|
|
3640
|
+
inst.ulid = (params) => inst.check(/* @__PURE__ */ _ulid(ZodULID, params));
|
|
3641
|
+
inst.base64 = (params) => inst.check(/* @__PURE__ */ _base64(ZodBase64, params));
|
|
3642
|
+
inst.base64url = (params) => inst.check(/* @__PURE__ */ _base64url(ZodBase64URL, params));
|
|
3643
|
+
inst.xid = (params) => inst.check(/* @__PURE__ */ _xid(ZodXID, params));
|
|
3644
|
+
inst.ksuid = (params) => inst.check(/* @__PURE__ */ _ksuid(ZodKSUID, params));
|
|
3645
|
+
inst.ipv4 = (params) => inst.check(/* @__PURE__ */ _ipv4(ZodIPv4, params));
|
|
3646
|
+
inst.ipv6 = (params) => inst.check(/* @__PURE__ */ _ipv6(ZodIPv6, params));
|
|
3647
|
+
inst.cidrv4 = (params) => inst.check(/* @__PURE__ */ _cidrv4(ZodCIDRv4, params));
|
|
3648
|
+
inst.cidrv6 = (params) => inst.check(/* @__PURE__ */ _cidrv6(ZodCIDRv6, params));
|
|
3649
|
+
inst.e164 = (params) => inst.check(/* @__PURE__ */ _e164(ZodE164, params));
|
|
3650
|
+
inst.datetime = (params) => inst.check(datetime(params));
|
|
3651
|
+
inst.date = (params) => inst.check(date(params));
|
|
3652
|
+
inst.time = (params) => inst.check(time(params));
|
|
3653
|
+
inst.duration = (params) => inst.check(duration(params));
|
|
3654
|
+
});
|
|
3655
|
+
function string$1(params) {
|
|
3656
|
+
return /* @__PURE__ */ _string(ZodString, params);
|
|
3657
|
+
}
|
|
3658
|
+
const ZodStringFormat = /*@__PURE__*/ $constructor("ZodStringFormat", (inst, def) => {
|
|
3659
|
+
$ZodStringFormat.init(inst, def);
|
|
3660
|
+
_ZodString.init(inst, def);
|
|
3661
|
+
});
|
|
3662
|
+
const ZodEmail = /*@__PURE__*/ $constructor("ZodEmail", (inst, def) => {
|
|
3663
|
+
$ZodEmail.init(inst, def);
|
|
3664
|
+
ZodStringFormat.init(inst, def);
|
|
3665
|
+
});
|
|
3666
|
+
const ZodGUID = /*@__PURE__*/ $constructor("ZodGUID", (inst, def) => {
|
|
3667
|
+
$ZodGUID.init(inst, def);
|
|
3668
|
+
ZodStringFormat.init(inst, def);
|
|
3669
|
+
});
|
|
3670
|
+
const ZodUUID = /*@__PURE__*/ $constructor("ZodUUID", (inst, def) => {
|
|
3671
|
+
$ZodUUID.init(inst, def);
|
|
3672
|
+
ZodStringFormat.init(inst, def);
|
|
3673
|
+
});
|
|
3674
|
+
const ZodURL = /*@__PURE__*/ $constructor("ZodURL", (inst, def) => {
|
|
3675
|
+
$ZodURL.init(inst, def);
|
|
3676
|
+
ZodStringFormat.init(inst, def);
|
|
3677
|
+
});
|
|
3678
|
+
const ZodEmoji = /*@__PURE__*/ $constructor("ZodEmoji", (inst, def) => {
|
|
3679
|
+
$ZodEmoji.init(inst, def);
|
|
3680
|
+
ZodStringFormat.init(inst, def);
|
|
3681
|
+
});
|
|
3682
|
+
const ZodNanoID = /*@__PURE__*/ $constructor("ZodNanoID", (inst, def) => {
|
|
3683
|
+
$ZodNanoID.init(inst, def);
|
|
3684
|
+
ZodStringFormat.init(inst, def);
|
|
3685
|
+
});
|
|
3686
|
+
/**
|
|
3687
|
+
* @deprecated CUID v1 is deprecated by its authors due to information leakage
|
|
3688
|
+
* (timestamps embedded in the id). Use {@link ZodCUID2} instead.
|
|
3689
|
+
* See https://github.com/paralleldrive/cuid.
|
|
3690
|
+
*/
|
|
3691
|
+
const ZodCUID = /*@__PURE__*/ $constructor("ZodCUID", (inst, def) => {
|
|
3692
|
+
$ZodCUID.init(inst, def);
|
|
3693
|
+
ZodStringFormat.init(inst, def);
|
|
3694
|
+
});
|
|
3695
|
+
const ZodCUID2 = /*@__PURE__*/ $constructor("ZodCUID2", (inst, def) => {
|
|
3696
|
+
$ZodCUID2.init(inst, def);
|
|
3697
|
+
ZodStringFormat.init(inst, def);
|
|
3698
|
+
});
|
|
3699
|
+
const ZodULID = /*@__PURE__*/ $constructor("ZodULID", (inst, def) => {
|
|
3700
|
+
$ZodULID.init(inst, def);
|
|
3701
|
+
ZodStringFormat.init(inst, def);
|
|
3702
|
+
});
|
|
3703
|
+
const ZodXID = /*@__PURE__*/ $constructor("ZodXID", (inst, def) => {
|
|
3704
|
+
$ZodXID.init(inst, def);
|
|
3705
|
+
ZodStringFormat.init(inst, def);
|
|
3706
|
+
});
|
|
3707
|
+
const ZodKSUID = /*@__PURE__*/ $constructor("ZodKSUID", (inst, def) => {
|
|
3708
|
+
$ZodKSUID.init(inst, def);
|
|
3709
|
+
ZodStringFormat.init(inst, def);
|
|
3710
|
+
});
|
|
3711
|
+
const ZodIPv4 = /*@__PURE__*/ $constructor("ZodIPv4", (inst, def) => {
|
|
3712
|
+
$ZodIPv4.init(inst, def);
|
|
3713
|
+
ZodStringFormat.init(inst, def);
|
|
3714
|
+
});
|
|
3715
|
+
const ZodIPv6 = /*@__PURE__*/ $constructor("ZodIPv6", (inst, def) => {
|
|
3716
|
+
$ZodIPv6.init(inst, def);
|
|
3717
|
+
ZodStringFormat.init(inst, def);
|
|
3718
|
+
});
|
|
3719
|
+
const ZodCIDRv4 = /*@__PURE__*/ $constructor("ZodCIDRv4", (inst, def) => {
|
|
3720
|
+
$ZodCIDRv4.init(inst, def);
|
|
3721
|
+
ZodStringFormat.init(inst, def);
|
|
3722
|
+
});
|
|
3723
|
+
const ZodCIDRv6 = /*@__PURE__*/ $constructor("ZodCIDRv6", (inst, def) => {
|
|
3724
|
+
$ZodCIDRv6.init(inst, def);
|
|
3725
|
+
ZodStringFormat.init(inst, def);
|
|
3726
|
+
});
|
|
3727
|
+
const ZodBase64 = /*@__PURE__*/ $constructor("ZodBase64", (inst, def) => {
|
|
3728
|
+
$ZodBase64.init(inst, def);
|
|
3729
|
+
ZodStringFormat.init(inst, def);
|
|
3730
|
+
});
|
|
3731
|
+
const ZodBase64URL = /*@__PURE__*/ $constructor("ZodBase64URL", (inst, def) => {
|
|
3732
|
+
$ZodBase64URL.init(inst, def);
|
|
3733
|
+
ZodStringFormat.init(inst, def);
|
|
3734
|
+
});
|
|
3735
|
+
const ZodE164 = /*@__PURE__*/ $constructor("ZodE164", (inst, def) => {
|
|
3736
|
+
$ZodE164.init(inst, def);
|
|
3737
|
+
ZodStringFormat.init(inst, def);
|
|
3738
|
+
});
|
|
3739
|
+
const ZodJWT = /*@__PURE__*/ $constructor("ZodJWT", (inst, def) => {
|
|
3740
|
+
$ZodJWT.init(inst, def);
|
|
3741
|
+
ZodStringFormat.init(inst, def);
|
|
3742
|
+
});
|
|
3743
|
+
const ZodNumber = /*@__PURE__*/ $constructor("ZodNumber", (inst, def) => {
|
|
3744
|
+
$ZodNumber.init(inst, def);
|
|
3745
|
+
ZodType.init(inst, def);
|
|
3746
|
+
inst._zod.processJSONSchema = (ctx, json, params) => numberProcessor(inst, ctx, json, params);
|
|
3747
|
+
_installLazyMethods(inst, "ZodNumber", {
|
|
3748
|
+
gt(value, params) {
|
|
3749
|
+
return this.check(/* @__PURE__ */ _gt(value, params));
|
|
3750
|
+
},
|
|
3751
|
+
gte(value, params) {
|
|
3752
|
+
return this.check(/* @__PURE__ */ _gte(value, params));
|
|
3753
|
+
},
|
|
3754
|
+
min(value, params) {
|
|
3755
|
+
return this.check(/* @__PURE__ */ _gte(value, params));
|
|
3756
|
+
},
|
|
3757
|
+
lt(value, params) {
|
|
3758
|
+
return this.check(/* @__PURE__ */ _lt(value, params));
|
|
3759
|
+
},
|
|
3760
|
+
lte(value, params) {
|
|
3761
|
+
return this.check(/* @__PURE__ */ _lte(value, params));
|
|
3762
|
+
},
|
|
3763
|
+
max(value, params) {
|
|
3764
|
+
return this.check(/* @__PURE__ */ _lte(value, params));
|
|
3765
|
+
},
|
|
3766
|
+
int(params) {
|
|
3767
|
+
return this.check(int(params));
|
|
3768
|
+
},
|
|
3769
|
+
safe(params) {
|
|
3770
|
+
return this.check(int(params));
|
|
3771
|
+
},
|
|
3772
|
+
positive(params) {
|
|
3773
|
+
return this.check(/* @__PURE__ */ _gt(0, params));
|
|
3774
|
+
},
|
|
3775
|
+
nonnegative(params) {
|
|
3776
|
+
return this.check(/* @__PURE__ */ _gte(0, params));
|
|
3777
|
+
},
|
|
3778
|
+
negative(params) {
|
|
3779
|
+
return this.check(/* @__PURE__ */ _lt(0, params));
|
|
3780
|
+
},
|
|
3781
|
+
nonpositive(params) {
|
|
3782
|
+
return this.check(/* @__PURE__ */ _lte(0, params));
|
|
3783
|
+
},
|
|
3784
|
+
multipleOf(value, params) {
|
|
3785
|
+
return this.check(/* @__PURE__ */ _multipleOf(value, params));
|
|
3786
|
+
},
|
|
3787
|
+
step(value, params) {
|
|
3788
|
+
return this.check(/* @__PURE__ */ _multipleOf(value, params));
|
|
3789
|
+
},
|
|
3790
|
+
finite() {
|
|
3791
|
+
return this;
|
|
3792
|
+
}
|
|
3793
|
+
});
|
|
3794
|
+
const bag = inst._zod.bag;
|
|
3795
|
+
inst.minValue = Math.max(bag.minimum ?? Number.NEGATIVE_INFINITY, bag.exclusiveMinimum ?? Number.NEGATIVE_INFINITY) ?? null;
|
|
3796
|
+
inst.maxValue = Math.min(bag.maximum ?? Number.POSITIVE_INFINITY, bag.exclusiveMaximum ?? Number.POSITIVE_INFINITY) ?? null;
|
|
3797
|
+
inst.isInt = (bag.format ?? "").includes("int") || Number.isSafeInteger(bag.multipleOf ?? .5);
|
|
3798
|
+
inst.isFinite = true;
|
|
3799
|
+
inst.format = bag.format ?? null;
|
|
3800
|
+
});
|
|
3801
|
+
function number$1(params) {
|
|
3802
|
+
return /* @__PURE__ */ _number(ZodNumber, params);
|
|
3803
|
+
}
|
|
3804
|
+
const ZodNumberFormat = /*@__PURE__*/ $constructor("ZodNumberFormat", (inst, def) => {
|
|
3805
|
+
$ZodNumberFormat.init(inst, def);
|
|
3806
|
+
ZodNumber.init(inst, def);
|
|
3807
|
+
});
|
|
3808
|
+
function int(params) {
|
|
3809
|
+
return /* @__PURE__ */ _int(ZodNumberFormat, params);
|
|
3810
|
+
}
|
|
3811
|
+
const ZodBoolean = /*@__PURE__*/ $constructor("ZodBoolean", (inst, def) => {
|
|
3812
|
+
$ZodBoolean.init(inst, def);
|
|
3813
|
+
ZodType.init(inst, def);
|
|
3814
|
+
inst._zod.processJSONSchema = (ctx, json, params) => booleanProcessor(inst, ctx, json, params);
|
|
3815
|
+
});
|
|
3816
|
+
function boolean(params) {
|
|
3817
|
+
return /* @__PURE__ */ _boolean(ZodBoolean, params);
|
|
3818
|
+
}
|
|
3819
|
+
const ZodUnknown = /*@__PURE__*/ $constructor("ZodUnknown", (inst, def) => {
|
|
3820
|
+
$ZodUnknown.init(inst, def);
|
|
3821
|
+
ZodType.init(inst, def);
|
|
3822
|
+
inst._zod.processJSONSchema = (ctx, json, params) => void 0;
|
|
3823
|
+
});
|
|
3824
|
+
function unknown() {
|
|
3825
|
+
return /* @__PURE__ */ _unknown(ZodUnknown);
|
|
3826
|
+
}
|
|
3827
|
+
const ZodNever = /*@__PURE__*/ $constructor("ZodNever", (inst, def) => {
|
|
3828
|
+
$ZodNever.init(inst, def);
|
|
3829
|
+
ZodType.init(inst, def);
|
|
3830
|
+
inst._zod.processJSONSchema = (ctx, json, params) => neverProcessor(inst, ctx, json, params);
|
|
3831
|
+
});
|
|
3832
|
+
function never(params) {
|
|
3833
|
+
return /* @__PURE__ */ _never(ZodNever, params);
|
|
3834
|
+
}
|
|
3835
|
+
const ZodArray = /*@__PURE__*/ $constructor("ZodArray", (inst, def) => {
|
|
3836
|
+
$ZodArray.init(inst, def);
|
|
3837
|
+
ZodType.init(inst, def);
|
|
3838
|
+
inst._zod.processJSONSchema = (ctx, json, params) => arrayProcessor(inst, ctx, json, params);
|
|
3839
|
+
inst.element = def.element;
|
|
3840
|
+
_installLazyMethods(inst, "ZodArray", {
|
|
3841
|
+
min(n, params) {
|
|
3842
|
+
return this.check(/* @__PURE__ */ _minLength(n, params));
|
|
3843
|
+
},
|
|
3844
|
+
nonempty(params) {
|
|
3845
|
+
return this.check(/* @__PURE__ */ _minLength(1, params));
|
|
3846
|
+
},
|
|
3847
|
+
max(n, params) {
|
|
3848
|
+
return this.check(/* @__PURE__ */ _maxLength(n, params));
|
|
3849
|
+
},
|
|
3850
|
+
length(n, params) {
|
|
3851
|
+
return this.check(/* @__PURE__ */ _length(n, params));
|
|
3852
|
+
},
|
|
3853
|
+
unwrap() {
|
|
3854
|
+
return this.element;
|
|
3855
|
+
}
|
|
3856
|
+
});
|
|
3857
|
+
});
|
|
3858
|
+
function array(element, params) {
|
|
3859
|
+
return /* @__PURE__ */ _array(ZodArray, element, params);
|
|
3860
|
+
}
|
|
3861
|
+
const ZodObject = /*@__PURE__*/ $constructor("ZodObject", (inst, def) => {
|
|
3862
|
+
$ZodObjectJIT.init(inst, def);
|
|
3863
|
+
ZodType.init(inst, def);
|
|
3864
|
+
inst._zod.processJSONSchema = (ctx, json, params) => objectProcessor(inst, ctx, json, params);
|
|
3865
|
+
defineLazy(inst, "shape", () => {
|
|
3866
|
+
return def.shape;
|
|
3867
|
+
});
|
|
3868
|
+
_installLazyMethods(inst, "ZodObject", {
|
|
3869
|
+
keyof() {
|
|
3870
|
+
return _enum(Object.keys(this._zod.def.shape));
|
|
3871
|
+
},
|
|
3872
|
+
catchall(catchall) {
|
|
3873
|
+
return this.clone({
|
|
3874
|
+
...this._zod.def,
|
|
3875
|
+
catchall
|
|
3876
|
+
});
|
|
3877
|
+
},
|
|
3878
|
+
passthrough() {
|
|
3879
|
+
return this.clone({
|
|
3880
|
+
...this._zod.def,
|
|
3881
|
+
catchall: unknown()
|
|
3882
|
+
});
|
|
3883
|
+
},
|
|
3884
|
+
loose() {
|
|
3885
|
+
return this.clone({
|
|
3886
|
+
...this._zod.def,
|
|
3887
|
+
catchall: unknown()
|
|
3888
|
+
});
|
|
3889
|
+
},
|
|
3890
|
+
strict() {
|
|
3891
|
+
return this.clone({
|
|
3892
|
+
...this._zod.def,
|
|
3893
|
+
catchall: never()
|
|
3894
|
+
});
|
|
3895
|
+
},
|
|
3896
|
+
strip() {
|
|
3897
|
+
return this.clone({
|
|
3898
|
+
...this._zod.def,
|
|
3899
|
+
catchall: void 0
|
|
3900
|
+
});
|
|
3901
|
+
},
|
|
3902
|
+
extend(incoming) {
|
|
3903
|
+
return extend(this, incoming);
|
|
3904
|
+
},
|
|
3905
|
+
safeExtend(incoming) {
|
|
3906
|
+
return safeExtend(this, incoming);
|
|
3907
|
+
},
|
|
3908
|
+
merge(other) {
|
|
3909
|
+
return merge$1(this, other);
|
|
3910
|
+
},
|
|
3911
|
+
pick(mask) {
|
|
3912
|
+
return pick$1(this, mask);
|
|
3913
|
+
},
|
|
3914
|
+
omit(mask) {
|
|
3915
|
+
return omit(this, mask);
|
|
3916
|
+
},
|
|
3917
|
+
partial(...args) {
|
|
3918
|
+
return partial(ZodOptional, this, args[0]);
|
|
3919
|
+
},
|
|
3920
|
+
required(...args) {
|
|
3921
|
+
return required(ZodNonOptional, this, args[0]);
|
|
3922
|
+
}
|
|
3923
|
+
});
|
|
3924
|
+
});
|
|
3925
|
+
function object(shape, params) {
|
|
3926
|
+
return new ZodObject({
|
|
3927
|
+
type: "object",
|
|
3928
|
+
shape: shape ?? {},
|
|
3929
|
+
...normalizeParams(params)
|
|
3930
|
+
});
|
|
3931
|
+
}
|
|
3932
|
+
const ZodUnion = /*@__PURE__*/ $constructor("ZodUnion", (inst, def) => {
|
|
3933
|
+
$ZodUnion.init(inst, def);
|
|
3934
|
+
ZodType.init(inst, def);
|
|
3935
|
+
inst._zod.processJSONSchema = (ctx, json, params) => unionProcessor(inst, ctx, json, params);
|
|
3936
|
+
inst.options = def.options;
|
|
3937
|
+
});
|
|
3938
|
+
function union(options, params) {
|
|
3939
|
+
return new ZodUnion({
|
|
3940
|
+
type: "union",
|
|
3941
|
+
options,
|
|
3942
|
+
...normalizeParams(params)
|
|
3943
|
+
});
|
|
3944
|
+
}
|
|
3945
|
+
const ZodIntersection = /*@__PURE__*/ $constructor("ZodIntersection", (inst, def) => {
|
|
3946
|
+
$ZodIntersection.init(inst, def);
|
|
3947
|
+
ZodType.init(inst, def);
|
|
3948
|
+
inst._zod.processJSONSchema = (ctx, json, params) => intersectionProcessor(inst, ctx, json, params);
|
|
3949
|
+
});
|
|
3950
|
+
function intersection(left, right) {
|
|
3951
|
+
return new ZodIntersection({
|
|
3952
|
+
type: "intersection",
|
|
3953
|
+
left,
|
|
3954
|
+
right
|
|
3955
|
+
});
|
|
3956
|
+
}
|
|
3957
|
+
const ZodTuple = /*@__PURE__*/ $constructor("ZodTuple", (inst, def) => {
|
|
3958
|
+
$ZodTuple.init(inst, def);
|
|
3959
|
+
ZodType.init(inst, def);
|
|
3960
|
+
inst._zod.processJSONSchema = (ctx, json, params) => tupleProcessor(inst, ctx, json, params);
|
|
3961
|
+
inst.rest = (rest) => inst.clone({
|
|
3962
|
+
...inst._zod.def,
|
|
3963
|
+
rest
|
|
3964
|
+
});
|
|
3965
|
+
});
|
|
3966
|
+
function tuple(items, _paramsOrRest, _params) {
|
|
3967
|
+
const hasRest = _paramsOrRest instanceof $ZodType;
|
|
3968
|
+
return new ZodTuple({
|
|
3969
|
+
type: "tuple",
|
|
3970
|
+
items,
|
|
3971
|
+
rest: hasRest ? _paramsOrRest : null,
|
|
3972
|
+
...normalizeParams(hasRest ? _params : _paramsOrRest)
|
|
3973
|
+
});
|
|
3974
|
+
}
|
|
3975
|
+
const ZodEnum = /*@__PURE__*/ $constructor("ZodEnum", (inst, def) => {
|
|
3976
|
+
$ZodEnum.init(inst, def);
|
|
3977
|
+
ZodType.init(inst, def);
|
|
3978
|
+
inst._zod.processJSONSchema = (ctx, json, params) => enumProcessor(inst, ctx, json, params);
|
|
3979
|
+
inst.enum = def.entries;
|
|
3980
|
+
inst.options = Object.values(def.entries);
|
|
3981
|
+
const keys = new Set(Object.keys(def.entries));
|
|
3982
|
+
inst.extract = (values, params) => {
|
|
3983
|
+
const newEntries = {};
|
|
3984
|
+
for (const value of values) if (keys.has(value)) newEntries[value] = def.entries[value];
|
|
3985
|
+
else throw new Error(`Key ${value} not found in enum`);
|
|
3986
|
+
return new ZodEnum({
|
|
3987
|
+
...def,
|
|
3988
|
+
checks: [],
|
|
3989
|
+
...normalizeParams(params),
|
|
3990
|
+
entries: newEntries
|
|
3991
|
+
});
|
|
3992
|
+
};
|
|
3993
|
+
inst.exclude = (values, params) => {
|
|
3994
|
+
const newEntries = { ...def.entries };
|
|
3995
|
+
for (const value of values) if (keys.has(value)) delete newEntries[value];
|
|
3996
|
+
else throw new Error(`Key ${value} not found in enum`);
|
|
3997
|
+
return new ZodEnum({
|
|
3998
|
+
...def,
|
|
3999
|
+
checks: [],
|
|
4000
|
+
...normalizeParams(params),
|
|
4001
|
+
entries: newEntries
|
|
4002
|
+
});
|
|
4003
|
+
};
|
|
4004
|
+
});
|
|
4005
|
+
function _enum(values, params) {
|
|
4006
|
+
return new ZodEnum({
|
|
4007
|
+
type: "enum",
|
|
4008
|
+
entries: Array.isArray(values) ? Object.fromEntries(values.map((v) => [v, v])) : values,
|
|
4009
|
+
...normalizeParams(params)
|
|
4010
|
+
});
|
|
4011
|
+
}
|
|
4012
|
+
const ZodLiteral = /*@__PURE__*/ $constructor("ZodLiteral", (inst, def) => {
|
|
4013
|
+
$ZodLiteral.init(inst, def);
|
|
4014
|
+
ZodType.init(inst, def);
|
|
4015
|
+
inst._zod.processJSONSchema = (ctx, json, params) => literalProcessor(inst, ctx, json, params);
|
|
4016
|
+
inst.values = new Set(def.values);
|
|
4017
|
+
Object.defineProperty(inst, "value", { get() {
|
|
4018
|
+
if (def.values.length > 1) throw new Error("This schema contains multiple valid literal values. Use `.values` instead.");
|
|
4019
|
+
return def.values[0];
|
|
4020
|
+
} });
|
|
4021
|
+
});
|
|
4022
|
+
function literal$1(value, params) {
|
|
4023
|
+
return new ZodLiteral({
|
|
4024
|
+
type: "literal",
|
|
4025
|
+
values: Array.isArray(value) ? value : [value],
|
|
4026
|
+
...normalizeParams(params)
|
|
4027
|
+
});
|
|
4028
|
+
}
|
|
4029
|
+
const ZodTransform = /*@__PURE__*/ $constructor("ZodTransform", (inst, def) => {
|
|
4030
|
+
$ZodTransform.init(inst, def);
|
|
4031
|
+
ZodType.init(inst, def);
|
|
4032
|
+
inst._zod.processJSONSchema = (ctx, json, params) => transformProcessor(inst, ctx, json, params);
|
|
4033
|
+
inst._zod.parse = (payload, _ctx) => {
|
|
4034
|
+
if (_ctx.direction === "backward") throw new $ZodEncodeError(inst.constructor.name);
|
|
4035
|
+
payload.addIssue = (issue$1) => {
|
|
4036
|
+
if (typeof issue$1 === "string") payload.issues.push(issue(issue$1, payload.value, def));
|
|
4037
|
+
else {
|
|
4038
|
+
const _issue = issue$1;
|
|
4039
|
+
if (_issue.fatal) _issue.continue = false;
|
|
4040
|
+
_issue.code ?? (_issue.code = "custom");
|
|
4041
|
+
_issue.input ?? (_issue.input = payload.value);
|
|
4042
|
+
_issue.inst ?? (_issue.inst = inst);
|
|
4043
|
+
payload.issues.push(issue(_issue));
|
|
4044
|
+
}
|
|
4045
|
+
};
|
|
4046
|
+
const output = def.transform(payload.value, payload);
|
|
4047
|
+
if (output instanceof Promise) return output.then((output) => {
|
|
4048
|
+
payload.value = output;
|
|
4049
|
+
payload.fallback = true;
|
|
4050
|
+
return payload;
|
|
4051
|
+
});
|
|
4052
|
+
payload.value = output;
|
|
4053
|
+
payload.fallback = true;
|
|
4054
|
+
return payload;
|
|
4055
|
+
};
|
|
4056
|
+
});
|
|
4057
|
+
function transform(fn) {
|
|
4058
|
+
return new ZodTransform({
|
|
4059
|
+
type: "transform",
|
|
4060
|
+
transform: fn
|
|
4061
|
+
});
|
|
4062
|
+
}
|
|
4063
|
+
const ZodOptional = /*@__PURE__*/ $constructor("ZodOptional", (inst, def) => {
|
|
4064
|
+
$ZodOptional.init(inst, def);
|
|
4065
|
+
ZodType.init(inst, def);
|
|
4066
|
+
inst._zod.processJSONSchema = (ctx, json, params) => optionalProcessor(inst, ctx, json, params);
|
|
4067
|
+
inst.unwrap = () => inst._zod.def.innerType;
|
|
4068
|
+
});
|
|
4069
|
+
function optional(innerType) {
|
|
4070
|
+
return new ZodOptional({
|
|
4071
|
+
type: "optional",
|
|
4072
|
+
innerType
|
|
4073
|
+
});
|
|
4074
|
+
}
|
|
4075
|
+
const ZodExactOptional = /*@__PURE__*/ $constructor("ZodExactOptional", (inst, def) => {
|
|
4076
|
+
$ZodExactOptional.init(inst, def);
|
|
4077
|
+
ZodType.init(inst, def);
|
|
4078
|
+
inst._zod.processJSONSchema = (ctx, json, params) => optionalProcessor(inst, ctx, json, params);
|
|
4079
|
+
inst.unwrap = () => inst._zod.def.innerType;
|
|
4080
|
+
});
|
|
4081
|
+
function exactOptional(innerType) {
|
|
4082
|
+
return new ZodExactOptional({
|
|
4083
|
+
type: "optional",
|
|
4084
|
+
innerType
|
|
4085
|
+
});
|
|
4086
|
+
}
|
|
4087
|
+
const ZodNullable = /*@__PURE__*/ $constructor("ZodNullable", (inst, def) => {
|
|
4088
|
+
$ZodNullable.init(inst, def);
|
|
4089
|
+
ZodType.init(inst, def);
|
|
4090
|
+
inst._zod.processJSONSchema = (ctx, json, params) => nullableProcessor(inst, ctx, json, params);
|
|
4091
|
+
inst.unwrap = () => inst._zod.def.innerType;
|
|
4092
|
+
});
|
|
4093
|
+
function nullable(innerType) {
|
|
4094
|
+
return new ZodNullable({
|
|
4095
|
+
type: "nullable",
|
|
4096
|
+
innerType
|
|
4097
|
+
});
|
|
4098
|
+
}
|
|
4099
|
+
const ZodDefault = /*@__PURE__*/ $constructor("ZodDefault", (inst, def) => {
|
|
4100
|
+
$ZodDefault.init(inst, def);
|
|
4101
|
+
ZodType.init(inst, def);
|
|
4102
|
+
inst._zod.processJSONSchema = (ctx, json, params) => defaultProcessor(inst, ctx, json, params);
|
|
4103
|
+
inst.unwrap = () => inst._zod.def.innerType;
|
|
4104
|
+
inst.removeDefault = inst.unwrap;
|
|
4105
|
+
});
|
|
4106
|
+
function _default(innerType, defaultValue) {
|
|
4107
|
+
return new ZodDefault({
|
|
4108
|
+
type: "default",
|
|
4109
|
+
innerType,
|
|
4110
|
+
get defaultValue() {
|
|
4111
|
+
return typeof defaultValue === "function" ? defaultValue() : shallowClone(defaultValue);
|
|
4112
|
+
}
|
|
4113
|
+
});
|
|
4114
|
+
}
|
|
4115
|
+
const ZodPrefault = /*@__PURE__*/ $constructor("ZodPrefault", (inst, def) => {
|
|
4116
|
+
$ZodPrefault.init(inst, def);
|
|
4117
|
+
ZodType.init(inst, def);
|
|
4118
|
+
inst._zod.processJSONSchema = (ctx, json, params) => prefaultProcessor(inst, ctx, json, params);
|
|
4119
|
+
inst.unwrap = () => inst._zod.def.innerType;
|
|
4120
|
+
});
|
|
4121
|
+
function prefault(innerType, defaultValue) {
|
|
4122
|
+
return new ZodPrefault({
|
|
4123
|
+
type: "prefault",
|
|
4124
|
+
innerType,
|
|
4125
|
+
get defaultValue() {
|
|
4126
|
+
return typeof defaultValue === "function" ? defaultValue() : shallowClone(defaultValue);
|
|
4127
|
+
}
|
|
4128
|
+
});
|
|
4129
|
+
}
|
|
4130
|
+
const ZodNonOptional = /*@__PURE__*/ $constructor("ZodNonOptional", (inst, def) => {
|
|
4131
|
+
$ZodNonOptional.init(inst, def);
|
|
4132
|
+
ZodType.init(inst, def);
|
|
4133
|
+
inst._zod.processJSONSchema = (ctx, json, params) => nonoptionalProcessor(inst, ctx, json, params);
|
|
4134
|
+
inst.unwrap = () => inst._zod.def.innerType;
|
|
4135
|
+
});
|
|
4136
|
+
function nonoptional(innerType, params) {
|
|
4137
|
+
return new ZodNonOptional({
|
|
4138
|
+
type: "nonoptional",
|
|
4139
|
+
innerType,
|
|
4140
|
+
...normalizeParams(params)
|
|
4141
|
+
});
|
|
4142
|
+
}
|
|
4143
|
+
const ZodCatch = /*@__PURE__*/ $constructor("ZodCatch", (inst, def) => {
|
|
4144
|
+
$ZodCatch.init(inst, def);
|
|
4145
|
+
ZodType.init(inst, def);
|
|
4146
|
+
inst._zod.processJSONSchema = (ctx, json, params) => catchProcessor(inst, ctx, json, params);
|
|
4147
|
+
inst.unwrap = () => inst._zod.def.innerType;
|
|
4148
|
+
inst.removeCatch = inst.unwrap;
|
|
4149
|
+
});
|
|
4150
|
+
function _catch(innerType, catchValue) {
|
|
4151
|
+
return new ZodCatch({
|
|
4152
|
+
type: "catch",
|
|
4153
|
+
innerType,
|
|
4154
|
+
catchValue: typeof catchValue === "function" ? catchValue : () => catchValue
|
|
4155
|
+
});
|
|
4156
|
+
}
|
|
4157
|
+
const ZodPipe = /*@__PURE__*/ $constructor("ZodPipe", (inst, def) => {
|
|
4158
|
+
$ZodPipe.init(inst, def);
|
|
4159
|
+
ZodType.init(inst, def);
|
|
4160
|
+
inst._zod.processJSONSchema = (ctx, json, params) => pipeProcessor(inst, ctx, json, params);
|
|
4161
|
+
inst.in = def.in;
|
|
4162
|
+
inst.out = def.out;
|
|
4163
|
+
});
|
|
4164
|
+
function pipe(in_, out) {
|
|
4165
|
+
return new ZodPipe({
|
|
4166
|
+
type: "pipe",
|
|
4167
|
+
in: in_,
|
|
4168
|
+
out
|
|
4169
|
+
});
|
|
4170
|
+
}
|
|
4171
|
+
const ZodReadonly = /*@__PURE__*/ $constructor("ZodReadonly", (inst, def) => {
|
|
4172
|
+
$ZodReadonly.init(inst, def);
|
|
4173
|
+
ZodType.init(inst, def);
|
|
4174
|
+
inst._zod.processJSONSchema = (ctx, json, params) => readonlyProcessor(inst, ctx, json, params);
|
|
4175
|
+
inst.unwrap = () => inst._zod.def.innerType;
|
|
4176
|
+
});
|
|
4177
|
+
function readonly(innerType) {
|
|
4178
|
+
return new ZodReadonly({
|
|
4179
|
+
type: "readonly",
|
|
4180
|
+
innerType
|
|
4181
|
+
});
|
|
4182
|
+
}
|
|
4183
|
+
const ZodCustom = /*@__PURE__*/ $constructor("ZodCustom", (inst, def) => {
|
|
4184
|
+
$ZodCustom.init(inst, def);
|
|
4185
|
+
ZodType.init(inst, def);
|
|
4186
|
+
inst._zod.processJSONSchema = (ctx, json, params) => customProcessor(inst, ctx, json, params);
|
|
4187
|
+
});
|
|
4188
|
+
function refine(fn, _params = {}) {
|
|
4189
|
+
return /* @__PURE__ */ _refine(ZodCustom, fn, _params);
|
|
4190
|
+
}
|
|
4191
|
+
function superRefine(fn, params) {
|
|
4192
|
+
return /* @__PURE__ */ _superRefine(fn, params);
|
|
4193
|
+
}
|
|
4194
|
+
//#endregion
|
|
4195
|
+
//#region ../host/system-metrics/lib/typert.remote-client.js
|
|
4196
|
+
const _danielng23_dsh_lockon_host_system_metrics_systemMetrics_listDirectory_parameter_0$schema = string$1();
|
|
4197
|
+
const _danielng23_dsh_lockon_host_system_metrics_systemMetrics_listDirectory_result$schema = object({
|
|
4198
|
+
"path": string$1().readonly(),
|
|
4199
|
+
"entries": array(object({
|
|
4200
|
+
"name": string$1().readonly(),
|
|
4201
|
+
"isDirectory": boolean().readonly()
|
|
4202
|
+
})).readonly(),
|
|
4203
|
+
"error": union([literal$1(null), string$1()]).readonly()
|
|
4204
|
+
});
|
|
4205
|
+
const _danielng23_dsh_lockon_host_system_metrics_systemMetrics_overview_result$schema = object({
|
|
4206
|
+
"timestamp": number$1().readonly(),
|
|
4207
|
+
"platform": string$1().readonly(),
|
|
4208
|
+
"uptimeSeconds": number$1().readonly(),
|
|
4209
|
+
"loadavg": tuple([
|
|
4210
|
+
number$1(),
|
|
4211
|
+
number$1(),
|
|
4212
|
+
number$1()
|
|
4213
|
+
]).readonly(),
|
|
4214
|
+
"memory": object({
|
|
4215
|
+
"totalBytes": number$1().readonly(),
|
|
4216
|
+
"usedBytes": number$1().readonly()
|
|
4217
|
+
}).readonly(),
|
|
4218
|
+
"swap": object({
|
|
4219
|
+
"totalBytes": number$1().readonly(),
|
|
4220
|
+
"usedBytes": number$1().readonly()
|
|
4221
|
+
}).readonly(),
|
|
4222
|
+
"cores": array(object({
|
|
4223
|
+
"user": number$1().readonly(),
|
|
4224
|
+
"nice": number$1().readonly(),
|
|
4225
|
+
"sys": number$1().readonly(),
|
|
4226
|
+
"idle": number$1().readonly(),
|
|
4227
|
+
"irq": number$1().readonly()
|
|
4228
|
+
})).readonly(),
|
|
4229
|
+
"thermalLevel": union([literal$1(null), number$1()]).readonly(),
|
|
4230
|
+
"powerState": union([literal$1(null), string$1()]).readonly(),
|
|
4231
|
+
"hardware": object({
|
|
4232
|
+
"manufacturer": string$1().readonly(),
|
|
4233
|
+
"model": string$1().readonly(),
|
|
4234
|
+
"chassis": string$1().readonly()
|
|
4235
|
+
}).readonly(),
|
|
4236
|
+
"tasks": number$1().readonly(),
|
|
4237
|
+
"processes": array(object({
|
|
4238
|
+
"pid": number$1().readonly(),
|
|
4239
|
+
"name": string$1().readonly(),
|
|
4240
|
+
"cpuPct": number$1().readonly(),
|
|
4241
|
+
"memPct": number$1().readonly()
|
|
4242
|
+
})).readonly(),
|
|
4243
|
+
"network": object({
|
|
4244
|
+
"interfaceName": string$1().readonly(),
|
|
4245
|
+
"state": string$1().readonly(),
|
|
4246
|
+
"ip": union([literal$1(null), string$1()]).readonly(),
|
|
4247
|
+
"pingMs": union([literal$1(null), number$1()]).readonly(),
|
|
4248
|
+
"rxBytes": number$1().readonly(),
|
|
4249
|
+
"txBytes": number$1().readonly()
|
|
4250
|
+
}).readonly(),
|
|
4251
|
+
"storage": object({
|
|
4252
|
+
"path": string$1().readonly(),
|
|
4253
|
+
"totalBytes": number$1().readonly(),
|
|
4254
|
+
"usedBytes": number$1().readonly(),
|
|
4255
|
+
"usedPct": number$1().readonly()
|
|
4256
|
+
}).readonly()
|
|
4257
|
+
});
|
|
4258
|
+
const _danielng23_dsh_lockon_host_system_metrics_systemMetrics_readFile_parameter_0$schema = string$1();
|
|
4259
|
+
const _danielng23_dsh_lockon_host_system_metrics_systemMetrics_readFile_result$schema = object({
|
|
4260
|
+
"path": string$1().readonly(),
|
|
4261
|
+
"kind": union([
|
|
4262
|
+
literal$1("text"),
|
|
4263
|
+
literal$1("image"),
|
|
4264
|
+
literal$1("video"),
|
|
4265
|
+
literal$1("unsupported")
|
|
4266
|
+
]).readonly(),
|
|
4267
|
+
"mime": string$1().readonly(),
|
|
4268
|
+
"sizeBytes": number$1().readonly(),
|
|
4269
|
+
"truncated": boolean().readonly(),
|
|
4270
|
+
"text": union([literal$1(null), string$1()]).readonly(),
|
|
4271
|
+
"dataUrl": union([literal$1(null), string$1()]).readonly(),
|
|
4272
|
+
"error": union([literal$1(null), string$1()]).readonly()
|
|
4273
|
+
});
|
|
4274
|
+
const _danielng23_dsh_lockon_host_system_metrics_systemMetrics_runCommand_parameter_0$schema = string$1();
|
|
4275
|
+
const _danielng23_dsh_lockon_host_system_metrics_systemMetrics_runCommand_result$schema = object({
|
|
4276
|
+
"stdout": string$1().readonly(),
|
|
4277
|
+
"stderr": string$1().readonly(),
|
|
4278
|
+
"exitCode": union([literal$1(null), number$1()]).readonly()
|
|
4279
|
+
});
|
|
4280
|
+
const _danielng23_dsh_lockon_host_system_metrics_systemMetrics_snapshot_result$schema = object({
|
|
4281
|
+
"loadavg": tuple([
|
|
4282
|
+
number$1(),
|
|
4283
|
+
number$1(),
|
|
4284
|
+
number$1()
|
|
4285
|
+
]).readonly(),
|
|
4286
|
+
"cpuBusyRatio": number$1().readonly(),
|
|
4287
|
+
"totalMemoryBytes": number$1().readonly(),
|
|
4288
|
+
"freeMemoryBytes": number$1().readonly(),
|
|
4289
|
+
"uptimeSeconds": number$1().readonly(),
|
|
4290
|
+
"timestamp": number$1().readonly()
|
|
4291
|
+
});
|
|
4292
|
+
const _danielng23_dsh_lockon_host_system_metrics_systemMetrics_writeFile_parameter_0$schema = string$1();
|
|
4293
|
+
const _danielng23_dsh_lockon_host_system_metrics_systemMetrics_writeFile_parameter_1$schema = string$1();
|
|
4294
|
+
const _danielng23_dsh_lockon_host_system_metrics_systemMetrics_writeFile_result$schema = object({
|
|
4295
|
+
"path": string$1().readonly(),
|
|
4296
|
+
"sizeBytes": number$1().readonly(),
|
|
4297
|
+
"error": union([literal$1(null), string$1()]).readonly()
|
|
4298
|
+
});
|
|
4299
|
+
const TYPERT_REMOTE = {
|
|
4300
|
+
package: "@danielng23/dsh-lockon-host-system-metrics",
|
|
4301
|
+
descriptors: [
|
|
4302
|
+
{
|
|
4303
|
+
id: "@danielng23/dsh-lockon-host-system-metrics#systemMetrics/listDirectory",
|
|
4304
|
+
service: "systemMetrics",
|
|
4305
|
+
namespace: "systemMetrics",
|
|
4306
|
+
method: "listDirectory",
|
|
4307
|
+
invocation: { kind: "direct" },
|
|
4308
|
+
parameters: [{
|
|
4309
|
+
name: "path",
|
|
4310
|
+
wire: "path",
|
|
4311
|
+
source: "json",
|
|
4312
|
+
codec: {
|
|
4313
|
+
mode: "strict",
|
|
4314
|
+
typeSymbol: "@danielng23/dsh-lockon-host-system-metrics#systemMetrics/listDirectory:path",
|
|
4315
|
+
schema: _danielng23_dsh_lockon_host_system_metrics_systemMetrics_listDirectory_parameter_0$schema
|
|
4316
|
+
}
|
|
4317
|
+
}],
|
|
4318
|
+
result: {
|
|
4319
|
+
mode: "strict",
|
|
4320
|
+
typeSymbol: "@danielng23/dsh-lockon-host-system-metrics/types#DirectoryListing",
|
|
4321
|
+
schema: _danielng23_dsh_lockon_host_system_metrics_systemMetrics_listDirectory_result$schema
|
|
4322
|
+
},
|
|
4323
|
+
sourceLocation: {
|
|
4324
|
+
"file": "packages/host/system-metrics/src/index.ts",
|
|
4325
|
+
"line": 293,
|
|
4326
|
+
"column": 9
|
|
4327
|
+
}
|
|
4328
|
+
},
|
|
4329
|
+
{
|
|
4330
|
+
id: "@danielng23/dsh-lockon-host-system-metrics#systemMetrics/overview",
|
|
4331
|
+
service: "systemMetrics",
|
|
4332
|
+
namespace: "systemMetrics",
|
|
4333
|
+
method: "overview",
|
|
4334
|
+
invocation: { kind: "direct" },
|
|
4335
|
+
parameters: [],
|
|
4336
|
+
result: {
|
|
4337
|
+
mode: "strict",
|
|
4338
|
+
typeSymbol: "@danielng23/dsh-lockon-host-system-metrics/types#SystemOverview",
|
|
4339
|
+
schema: _danielng23_dsh_lockon_host_system_metrics_systemMetrics_overview_result$schema
|
|
4340
|
+
},
|
|
4341
|
+
sourceLocation: {
|
|
4342
|
+
"file": "packages/host/system-metrics/src/index.ts",
|
|
4343
|
+
"line": 246,
|
|
4344
|
+
"column": 9
|
|
4345
|
+
}
|
|
4346
|
+
},
|
|
4347
|
+
{
|
|
4348
|
+
id: "@danielng23/dsh-lockon-host-system-metrics#systemMetrics/readFile",
|
|
4349
|
+
service: "systemMetrics",
|
|
4350
|
+
namespace: "systemMetrics",
|
|
4351
|
+
method: "readFile",
|
|
4352
|
+
invocation: { kind: "direct" },
|
|
4353
|
+
parameters: [{
|
|
4354
|
+
name: "path",
|
|
4355
|
+
wire: "path",
|
|
4356
|
+
source: "json",
|
|
4357
|
+
codec: {
|
|
4358
|
+
mode: "strict",
|
|
4359
|
+
typeSymbol: "@danielng23/dsh-lockon-host-system-metrics#systemMetrics/readFile:path",
|
|
4360
|
+
schema: _danielng23_dsh_lockon_host_system_metrics_systemMetrics_readFile_parameter_0$schema
|
|
4361
|
+
}
|
|
4362
|
+
}],
|
|
4363
|
+
result: {
|
|
4364
|
+
mode: "strict",
|
|
4365
|
+
typeSymbol: "@danielng23/dsh-lockon-host-system-metrics/types#FilePreview",
|
|
4366
|
+
schema: _danielng23_dsh_lockon_host_system_metrics_systemMetrics_readFile_result$schema
|
|
4367
|
+
},
|
|
4368
|
+
sourceLocation: {
|
|
4369
|
+
"file": "packages/host/system-metrics/src/index.ts",
|
|
4370
|
+
"line": 316,
|
|
4371
|
+
"column": 9
|
|
4372
|
+
}
|
|
4373
|
+
},
|
|
4374
|
+
{
|
|
4375
|
+
id: "@danielng23/dsh-lockon-host-system-metrics#systemMetrics/runCommand",
|
|
4376
|
+
service: "systemMetrics",
|
|
4377
|
+
namespace: "systemMetrics",
|
|
4378
|
+
method: "runCommand",
|
|
4379
|
+
invocation: { kind: "direct" },
|
|
4380
|
+
parameters: [{
|
|
4381
|
+
name: "command",
|
|
4382
|
+
wire: "command",
|
|
4383
|
+
source: "json",
|
|
4384
|
+
codec: {
|
|
4385
|
+
mode: "strict",
|
|
4386
|
+
typeSymbol: "@danielng23/dsh-lockon-host-system-metrics#systemMetrics/runCommand:command",
|
|
4387
|
+
schema: _danielng23_dsh_lockon_host_system_metrics_systemMetrics_runCommand_parameter_0$schema
|
|
4388
|
+
}
|
|
4389
|
+
}],
|
|
4390
|
+
result: {
|
|
4391
|
+
mode: "strict",
|
|
4392
|
+
typeSymbol: "@danielng23/dsh-lockon-host-system-metrics/types#CommandResult",
|
|
4393
|
+
schema: _danielng23_dsh_lockon_host_system_metrics_systemMetrics_runCommand_result$schema
|
|
4394
|
+
},
|
|
4395
|
+
sourceLocation: {
|
|
4396
|
+
"file": "packages/host/system-metrics/src/index.ts",
|
|
4397
|
+
"line": 402,
|
|
4398
|
+
"column": 9
|
|
4399
|
+
}
|
|
4400
|
+
},
|
|
4401
|
+
{
|
|
4402
|
+
id: "@danielng23/dsh-lockon-host-system-metrics#systemMetrics/snapshot",
|
|
4403
|
+
service: "systemMetrics",
|
|
4404
|
+
namespace: "systemMetrics",
|
|
4405
|
+
method: "snapshot",
|
|
4406
|
+
invocation: { kind: "direct" },
|
|
4407
|
+
parameters: [],
|
|
4408
|
+
result: {
|
|
4409
|
+
mode: "strict",
|
|
4410
|
+
typeSymbol: "@danielng23/dsh-lockon-host-system-metrics/types#SystemMetricsSnapshot",
|
|
4411
|
+
schema: _danielng23_dsh_lockon_host_system_metrics_systemMetrics_snapshot_result$schema
|
|
4412
|
+
},
|
|
4413
|
+
sourceLocation: {
|
|
4414
|
+
"file": "packages/host/system-metrics/src/index.ts",
|
|
4415
|
+
"line": 228,
|
|
4416
|
+
"column": 3
|
|
4417
|
+
}
|
|
4418
|
+
},
|
|
4419
|
+
{
|
|
4420
|
+
id: "@danielng23/dsh-lockon-host-system-metrics#systemMetrics/writeFile",
|
|
4421
|
+
service: "systemMetrics",
|
|
4422
|
+
namespace: "systemMetrics",
|
|
4423
|
+
method: "writeFile",
|
|
4424
|
+
invocation: { kind: "direct" },
|
|
4425
|
+
parameters: [{
|
|
4426
|
+
name: "path",
|
|
4427
|
+
wire: "path",
|
|
4428
|
+
source: "json",
|
|
4429
|
+
codec: {
|
|
4430
|
+
mode: "strict",
|
|
4431
|
+
typeSymbol: "@danielng23/dsh-lockon-host-system-metrics#systemMetrics/writeFile:path",
|
|
4432
|
+
schema: _danielng23_dsh_lockon_host_system_metrics_systemMetrics_writeFile_parameter_0$schema
|
|
4433
|
+
}
|
|
4434
|
+
}, {
|
|
4435
|
+
name: "content",
|
|
4436
|
+
wire: "content",
|
|
4437
|
+
source: "json",
|
|
4438
|
+
codec: {
|
|
4439
|
+
mode: "strict",
|
|
4440
|
+
typeSymbol: "@danielng23/dsh-lockon-host-system-metrics#systemMetrics/writeFile:content",
|
|
4441
|
+
schema: _danielng23_dsh_lockon_host_system_metrics_systemMetrics_writeFile_parameter_1$schema
|
|
4442
|
+
}
|
|
4443
|
+
}],
|
|
4444
|
+
result: {
|
|
4445
|
+
mode: "strict",
|
|
4446
|
+
typeSymbol: "@danielng23/dsh-lockon-host-system-metrics/types#WriteResult",
|
|
4447
|
+
schema: _danielng23_dsh_lockon_host_system_metrics_systemMetrics_writeFile_result$schema
|
|
4448
|
+
},
|
|
4449
|
+
sourceLocation: {
|
|
4450
|
+
"file": "packages/host/system-metrics/src/index.ts",
|
|
4451
|
+
"line": 381,
|
|
4452
|
+
"column": 9
|
|
4453
|
+
}
|
|
4454
|
+
}
|
|
4455
|
+
]
|
|
4456
|
+
};
|
|
28
4457
|
//#endregion
|
|
29
|
-
let _danielng23_dsh_lockon_host_system_metrics_remote = require("@danielng23/dsh-lockon-host-system-metrics/remote");
|
|
30
|
-
_danielng23_dsh_lockon_host_system_metrics_remote = __toESM(_danielng23_dsh_lockon_host_system_metrics_remote, 1);
|
|
31
|
-
let react = require("react");
|
|
32
|
-
let react_jsx_runtime = require("react/jsx-runtime");
|
|
33
4458
|
//#region ../../../../deepseek-harness/vendor/cosmokit/lib/index.js
|
|
34
4459
|
/** Return true when a value is `null` or `undefined`. */
|
|
35
4460
|
function isNullable(value) {
|
|
@@ -1020,10 +5445,10 @@ window.__ModuleLoader__.load({
|
|
|
1020
5445
|
}
|
|
1021
5446
|
var WidgetSection_module_css_default = {
|
|
1022
5447
|
"compact": "BpUGEa_compact",
|
|
1023
|
-
"title": "BpUGEa_title",
|
|
1024
5448
|
"fill": "BpUGEa_fill",
|
|
1025
|
-
"
|
|
1026
|
-
"
|
|
5449
|
+
"section": "BpUGEa_section",
|
|
5450
|
+
"title": "BpUGEa_title",
|
|
5451
|
+
"bleed": "BpUGEa_bleed"
|
|
1027
5452
|
};
|
|
1028
5453
|
//#endregion
|
|
1029
5454
|
//#region src/client/widgets/WidgetSection.tsx
|
|
@@ -1054,21 +5479,21 @@ window.__ModuleLoader__.load({
|
|
|
1054
5479
|
document.head.appendChild(tag);
|
|
1055
5480
|
}
|
|
1056
5481
|
var FilesWidget_module_css_default = {
|
|
5482
|
+
"icon": "iUS2sW_icon",
|
|
5483
|
+
"storageBar": "iUS2sW_storageBar",
|
|
5484
|
+
"storageRow": "iUS2sW_storageRow",
|
|
1057
5485
|
"root": "iUS2sW_root",
|
|
5486
|
+
"kind": "iUS2sW_kind",
|
|
5487
|
+
"hint": "iUS2sW_hint",
|
|
5488
|
+
"row": "iUS2sW_row",
|
|
1058
5489
|
"name": "iUS2sW_name",
|
|
1059
|
-
"icon": "iUS2sW_icon",
|
|
1060
|
-
"storageFill": "iUS2sW_storageFill",
|
|
1061
|
-
"actions": "iUS2sW_actions",
|
|
1062
5490
|
"storageText": "iUS2sW_storageText",
|
|
1063
|
-
"
|
|
1064
|
-
"storageBar": "iUS2sW_storageBar",
|
|
1065
|
-
"title": "iUS2sW_title",
|
|
1066
|
-
"upButton": "iUS2sW_upButton",
|
|
5491
|
+
"storageFill": "iUS2sW_storageFill",
|
|
1067
5492
|
"list": "iUS2sW_list",
|
|
1068
|
-
"kind": "iUS2sW_kind",
|
|
1069
5493
|
"error": "iUS2sW_error",
|
|
1070
|
-
"
|
|
1071
|
-
"
|
|
5494
|
+
"title": "iUS2sW_title",
|
|
5495
|
+
"actions": "iUS2sW_actions",
|
|
5496
|
+
"upButton": "iUS2sW_upButton"
|
|
1072
5497
|
};
|
|
1073
5498
|
//#endregion
|
|
1074
5499
|
//#region src/client/bottom-panel/widgets/FilesWidget.tsx
|
|
@@ -1251,15 +5676,15 @@ window.__ModuleLoader__.load({
|
|
|
1251
5676
|
document.head.appendChild(tag);
|
|
1252
5677
|
}
|
|
1253
5678
|
var PreviewWidget_module_css_default = {
|
|
1254
|
-
"error": "aDuV5W_error",
|
|
1255
5679
|
"header": "aDuV5W_header",
|
|
5680
|
+
"hint": "aDuV5W_hint",
|
|
1256
5681
|
"file": "aDuV5W_file",
|
|
1257
5682
|
"body": "aDuV5W_body",
|
|
1258
5683
|
"root": "aDuV5W_root",
|
|
5684
|
+
"error": "aDuV5W_error",
|
|
1259
5685
|
"media": "aDuV5W_media",
|
|
1260
5686
|
"truncated": "aDuV5W_truncated",
|
|
1261
|
-
"text": "aDuV5W_text"
|
|
1262
|
-
"hint": "aDuV5W_hint"
|
|
5687
|
+
"text": "aDuV5W_text"
|
|
1263
5688
|
};
|
|
1264
5689
|
//#endregion
|
|
1265
5690
|
//#region ../../node_modules/@marijn/find-cluster-break/src/index.js
|
|
@@ -41923,19 +46348,19 @@ window.__ModuleLoader__.load({
|
|
|
41923
46348
|
}
|
|
41924
46349
|
var EditorPane_module_css_default = {
|
|
41925
46350
|
"editorPane": "BKHrsG_editorPane",
|
|
46351
|
+
"statusBar": "BKHrsG_statusBar",
|
|
46352
|
+
"saving": "BKHrsG_saving",
|
|
41926
46353
|
"error": "BKHrsG_error",
|
|
46354
|
+
"ro": "BKHrsG_ro",
|
|
46355
|
+
"cmHost": "BKHrsG_cmHost",
|
|
46356
|
+
"pos": "BKHrsG_pos",
|
|
41927
46357
|
"dirty": "BKHrsG_dirty",
|
|
41928
|
-
"saving": "BKHrsG_saving",
|
|
41929
46358
|
"mode": "BKHrsG_mode",
|
|
46359
|
+
"sep": "BKHrsG_sep",
|
|
41930
46360
|
"discardBtn": "BKHrsG_discardBtn",
|
|
41931
46361
|
"keepBtn": "BKHrsG_keepBtn",
|
|
41932
|
-
"
|
|
41933
|
-
"discardPrompt": "BKHrsG_discardPrompt"
|
|
41934
|
-
"statusBar": "BKHrsG_statusBar",
|
|
41935
|
-
"pos": "BKHrsG_pos",
|
|
41936
|
-
"cmHost": "BKHrsG_cmHost",
|
|
41937
|
-
"sep": "BKHrsG_sep",
|
|
41938
|
-
"saved": "BKHrsG_saved"
|
|
46362
|
+
"saved": "BKHrsG_saved",
|
|
46363
|
+
"discardPrompt": "BKHrsG_discardPrompt"
|
|
41939
46364
|
};
|
|
41940
46365
|
//#endregion
|
|
41941
46366
|
//#region src/client/bottom-panel/widgets/EditorPane.tsx
|
|
@@ -42233,18 +46658,18 @@ window.__ModuleLoader__.load({
|
|
|
42233
46658
|
document.head.appendChild(tag);
|
|
42234
46659
|
}
|
|
42235
46660
|
var TerminalWidget_module_css_default = {
|
|
42236
|
-
"
|
|
42237
|
-
"root": "QqIyNW_root",
|
|
46661
|
+
"in": "QqIyNW_in",
|
|
42238
46662
|
"info": "QqIyNW_info",
|
|
42239
|
-
"
|
|
46663
|
+
"root": "QqIyNW_root",
|
|
42240
46664
|
"barBusy": "QqIyNW_barBusy",
|
|
42241
|
-
"
|
|
46665
|
+
"bar": "QqIyNW_bar",
|
|
46666
|
+
"cmd": "QqIyNW_cmd",
|
|
42242
46667
|
"scroll": "QqIyNW_scroll",
|
|
42243
46668
|
"prompt": "QqIyNW_prompt",
|
|
42244
|
-
"out": "QqIyNW_out",
|
|
42245
46669
|
"barCwd": "QqIyNW_barCwd",
|
|
42246
|
-
"
|
|
42247
|
-
"
|
|
46670
|
+
"input": "QqIyNW_input",
|
|
46671
|
+
"err": "QqIyNW_err",
|
|
46672
|
+
"out": "QqIyNW_out"
|
|
42248
46673
|
};
|
|
42249
46674
|
//#endregion
|
|
42250
46675
|
//#region src/client/bottom-panel/widgets/TerminalWidget.tsx
|
|
@@ -42484,9 +46909,9 @@ window.__ModuleLoader__.load({
|
|
|
42484
46909
|
}
|
|
42485
46910
|
var LineChartWidget_module_css_default = {
|
|
42486
46911
|
"frame": "KDHK-q_frame",
|
|
42487
|
-
"chart": "KDHK-q_chart",
|
|
42488
46912
|
"header": "KDHK-q_header",
|
|
42489
|
-
"key": "KDHK-q_key"
|
|
46913
|
+
"key": "KDHK-q_key",
|
|
46914
|
+
"chart": "KDHK-q_chart"
|
|
42490
46915
|
};
|
|
42491
46916
|
//#endregion
|
|
42492
46917
|
//#region src/client/right-bar/widgets/LineChartWidget.tsx
|
|
@@ -42576,8 +47001,8 @@ window.__ModuleLoader__.load({
|
|
|
42576
47001
|
document.head.appendChild(tag);
|
|
42577
47002
|
}
|
|
42578
47003
|
var NetworkStatusWidget_module_css_default = {
|
|
42579
|
-
"
|
|
42580
|
-
"
|
|
47004
|
+
"specLine": "OBzT2q_specLine",
|
|
47005
|
+
"key": "OBzT2q_key"
|
|
42581
47006
|
};
|
|
42582
47007
|
//#endregion
|
|
42583
47008
|
//#region src/client/right-bar/widgets/NetworkStatusWidget.tsx
|
|
@@ -42628,11 +47053,11 @@ window.__ModuleLoader__.load({
|
|
|
42628
47053
|
}
|
|
42629
47054
|
var TargetingRadarWidget_module_css_default = {
|
|
42630
47055
|
"marker": "DH8aUq_marker",
|
|
42631
|
-
"lockon-blink": "DH8aUq_lockon-blink",
|
|
42632
47056
|
"radar": "DH8aUq_radar",
|
|
42633
47057
|
"sweep": "DH8aUq_sweep",
|
|
42634
47058
|
"svg": "DH8aUq_svg",
|
|
42635
|
-
"lockon-sweep": "DH8aUq_lockon-sweep"
|
|
47059
|
+
"lockon-sweep": "DH8aUq_lockon-sweep",
|
|
47060
|
+
"lockon-blink": "DH8aUq_lockon-blink"
|
|
42636
47061
|
};
|
|
42637
47062
|
//#endregion
|
|
42638
47063
|
//#region src/client/right-bar/widgets/TargetingRadarWidget.tsx
|
|
@@ -42862,9 +47287,9 @@ window.__ModuleLoader__.load({
|
|
|
42862
47287
|
document.head.appendChild(tag);
|
|
42863
47288
|
}
|
|
42864
47289
|
var GaugeWidget_module_css_default = {
|
|
42865
|
-
"
|
|
47290
|
+
"svg": "vIa3Gq_svg",
|
|
42866
47291
|
"value": "vIa3Gq_value",
|
|
42867
|
-
"
|
|
47292
|
+
"gauge": "vIa3Gq_gauge"
|
|
42868
47293
|
};
|
|
42869
47294
|
//#endregion
|
|
42870
47295
|
//#region src/client/left-bar/widgets/GaugeWidget.tsx
|
|
@@ -42932,10 +47357,10 @@ window.__ModuleLoader__.load({
|
|
|
42932
47357
|
document.head.appendChild(tag);
|
|
42933
47358
|
}
|
|
42934
47359
|
var SelectorWidget_module_css_default = {
|
|
47360
|
+
"active": "ys3evq_active",
|
|
42935
47361
|
"block": "ys3evq_block",
|
|
42936
|
-
"label": "ys3evq_label",
|
|
42937
47362
|
"indicator": "ys3evq_indicator",
|
|
42938
|
-
"
|
|
47363
|
+
"label": "ys3evq_label",
|
|
42939
47364
|
"stack": "ys3evq_stack"
|
|
42940
47365
|
};
|
|
42941
47366
|
//#endregion
|
|
@@ -42982,15 +47407,15 @@ window.__ModuleLoader__.load({
|
|
|
42982
47407
|
document.head.appendChild(tag);
|
|
42983
47408
|
}
|
|
42984
47409
|
var ScanningWidget_module_css_default = {
|
|
42985
|
-
"
|
|
42986
|
-
"
|
|
47410
|
+
"highlight": "ZXwjmq_highlight",
|
|
47411
|
+
"content": "ZXwjmq_content",
|
|
42987
47412
|
"status": "ZXwjmq_status",
|
|
42988
47413
|
"progress": "ZXwjmq_progress",
|
|
47414
|
+
"meter": "ZXwjmq_meter",
|
|
42989
47415
|
"progressBar": "ZXwjmq_progressBar",
|
|
42990
47416
|
"scan": "ZXwjmq_scan",
|
|
42991
|
-
"
|
|
42992
|
-
"row": "ZXwjmq_row"
|
|
42993
|
-
"highlight": "ZXwjmq_highlight"
|
|
47417
|
+
"addr": "ZXwjmq_addr",
|
|
47418
|
+
"row": "ZXwjmq_row"
|
|
42994
47419
|
};
|
|
42995
47420
|
//#endregion
|
|
42996
47421
|
//#region src/client/left-bar/widgets/ScanningWidget.tsx
|
|
@@ -43124,16 +47549,16 @@ window.__ModuleLoader__.load({
|
|
|
43124
47549
|
document.head.appendChild(tag);
|
|
43125
47550
|
}
|
|
43126
47551
|
var EdexShell_module_css_default = {
|
|
43127
|
-
"
|
|
43128
|
-
"
|
|
47552
|
+
"leftBar": "jnyjiG_leftBar",
|
|
47553
|
+
"centerWidget": "jnyjiG_centerWidget",
|
|
43129
47554
|
"pathPrompt": "jnyjiG_pathPrompt",
|
|
43130
|
-
"bottomBar": "jnyjiG_bottomBar",
|
|
43131
47555
|
"centerScanline": "jnyjiG_centerScanline",
|
|
43132
|
-
"
|
|
43133
|
-
"
|
|
47556
|
+
"shell": "jnyjiG_shell",
|
|
47557
|
+
"bottomBar": "jnyjiG_bottomBar",
|
|
43134
47558
|
"rightBar": "jnyjiG_rightBar",
|
|
43135
47559
|
"topPanel": "jnyjiG_topPanel",
|
|
43136
|
-
"
|
|
47560
|
+
"centerTitle": "jnyjiG_centerTitle",
|
|
47561
|
+
"fullscreenBtn": "jnyjiG_fullscreenBtn"
|
|
43137
47562
|
};
|
|
43138
47563
|
//#endregion
|
|
43139
47564
|
//#region \0dsh-css:/Users/daniel/workspace/dsh-edex/dsh-edex-lockon-ui/packages/ui-edex/src/client/theme/TerminalComposer.module.css.mjs
|
|
@@ -43859,10 +48284,10 @@ window.__ModuleLoader__.load({
|
|
|
43859
48284
|
document.head.appendChild(tag);
|
|
43860
48285
|
}
|
|
43861
48286
|
var ThemeColorRow_module_css_default = {
|
|
43862
|
-
"label": "E-QdFG_label",
|
|
43863
|
-
"swatches": "E-QdFG_swatches",
|
|
43864
48287
|
"picker": "E-QdFG_picker",
|
|
48288
|
+
"label": "E-QdFG_label",
|
|
43865
48289
|
"row": "E-QdFG_row",
|
|
48290
|
+
"swatches": "E-QdFG_swatches",
|
|
43866
48291
|
"swatch": "E-QdFG_swatch"
|
|
43867
48292
|
};
|
|
43868
48293
|
//#endregion
|
|
@@ -43958,7 +48383,7 @@ window.__ModuleLoader__.load({
|
|
|
43958
48383
|
* @returns disposer that unmounts the Remote namespace on unload.
|
|
43959
48384
|
*/
|
|
43960
48385
|
async function apply(ctx) {
|
|
43961
|
-
const disposeRemote = await ctx.remote.$mount(
|
|
48386
|
+
const disposeRemote = await ctx.remote.$mount(TYPERT_REMOTE);
|
|
43962
48387
|
let disposed = false;
|
|
43963
48388
|
const dispose = async () => {
|
|
43964
48389
|
if (disposed) return;
|