x402-proxy 0.10.7 → 0.10.9
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/CHANGELOG.md +23 -1
- package/README.md +7 -1
- package/dist/Credential-COZQnr1-.js +2055 -0
- package/dist/Mcp-CrCEqLqO.js +10 -0
- package/dist/Sse-ChldYgU7.js +9742 -0
- package/dist/Sse-kCB38G56.js +16482 -0
- package/dist/accounts-DsuvWwph.js +232 -0
- package/dist/accounts-DzvAlQRn.js +5 -0
- package/dist/accounts-IG-Cmrwy.js +229 -0
- package/dist/api-CUzmQvTQ.js +2802 -0
- package/dist/auth-DTzQmnZ_.js +1196 -0
- package/dist/bin/cli.js +585 -242
- package/dist/ccip-Bx-zoUCJ.js +240 -0
- package/dist/ccip-C2k1DD1T.js +153 -0
- package/dist/ccip-C6CQOJYv.js +152 -0
- package/dist/ccip-RZzsZ5Mv.js +156 -0
- package/dist/chain-CafcHffR.js +1997 -0
- package/dist/chain-DwfP5RGZ.js +1968 -0
- package/dist/chunk-DBEY4PJZ.js +16 -0
- package/dist/chunk-DjEMn6fM.js +36 -0
- package/dist/client-Blw2V7LF.js +657 -0
- package/dist/client-C37gWJOZ.js +102 -0
- package/dist/client-CEc4NYAA.js +6388 -0
- package/dist/client-CVDTUY0l.js +5152 -0
- package/dist/config-BUQsit4s.js +3 -0
- package/dist/config-DR1Fs_wL.js +6600 -0
- package/dist/{config-D9wIR3xc.js → config-rvKA3SYT.js} +10 -5
- package/dist/decodeFunctionData-DuFcwhC_.js +4510 -0
- package/dist/decodeFunctionData-JPOUdvil.js +4394 -0
- package/dist/derive-DNUl8LU9.js +9109 -0
- package/dist/dist-C2YO6HSQ.js +6581 -0
- package/dist/dist-DM5_F3r5.js +4 -0
- package/dist/dist-DxJCYyL5.js +1388 -0
- package/dist/hashTypedData-BHmP9dBd.js +859 -0
- package/dist/hashTypedData-CtEdfx4y.js +846 -0
- package/dist/helpers-CuUSw-tH.js +7125 -0
- package/dist/hmac-59IlS_by.js +648 -0
- package/dist/http-BAtucMbS.js +2060 -0
- package/dist/index.d.ts +1903 -9
- package/dist/index.js +18006 -50
- package/dist/index.node-CxkL0OFh.js +3592 -0
- package/dist/index.node-DvmeuZBj.js +3 -0
- package/dist/isAddressEqual-BLrd1Hg1.js +9 -0
- package/dist/isAddressEqual-DsAqfQOD.js +10 -0
- package/dist/localBatchGatewayRequest-C-RPJyDO.js +6260 -0
- package/dist/localBatchGatewayRequest-DOdQ9bR7.js +93 -0
- package/dist/localBatchGatewayRequest-DQkbZaSy.js +6261 -0
- package/dist/parseUnits-CApwcKSD.js +49 -0
- package/dist/parseUnits-cMO2udMe.js +48 -0
- package/dist/schemas-BxMFYNbH.js +1270 -0
- package/dist/secp256k1-BZpiyffY.js +2525 -0
- package/dist/secp256k1-BjenrLl5.js +1877 -0
- package/dist/secp256k1-CLPUX17u.js +3 -0
- package/dist/sendRawTransactionSync-DvSkhZtW.js +3612 -0
- package/dist/server-CSq0IuUq.js +565 -0
- package/dist/setup-BY4J49Lv.js +1110 -0
- package/dist/setup-wMOAgrsN.js +3 -0
- package/dist/sha256-FAs0qeni.js +17 -0
- package/dist/sha3-CYkWM8Xa.js +195 -0
- package/dist/sha3-DbMJRJ3C.js +194 -0
- package/dist/sse-B4LLqBQm.js +408 -0
- package/dist/status-Bu23RjW6.js +3 -0
- package/dist/{status-DihAcUSC.js → status-X21VnGUO.js} +16 -15
- package/dist/stdio-BADqxZdZ.js +85 -0
- package/dist/streamableHttp-BHkJypcI.js +358 -0
- package/dist/tempo-3nttrxgQ.js +17 -0
- package/dist/tempo-DER0P-ul.js +18 -0
- package/dist/types-BEKUz-Mf.js +1240 -0
- package/dist/types-DatK5vR5.js +3 -0
- package/dist/utils-BYjkXZDF.js +444 -0
- package/dist/utils-SeGHMW9O.js +445 -0
- package/dist/wallet-DKVlrR1S.js +3 -0
- package/dist/wallet-DSyht15_.js +17759 -0
- package/package.json +18 -71
- package/dist/config-B_upkJeK.js +0 -66
- package/dist/config-Be35NM5s.js +0 -3
- package/dist/config-J1m-CWXT.js +0 -27
- package/dist/derive-CL6e8K0Z.js +0 -81
- package/dist/openclaw/plugin.d.ts +0 -15
- package/dist/openclaw/plugin.js +0 -2067
- package/dist/openclaw.plugin.json +0 -93
- package/dist/setup-CNyMLnM-.js +0 -197
- package/dist/setup-DTIxPe58.js +0 -3
- package/dist/status-DZlJ4pS7.js +0 -3
- package/dist/wallet-B0S-rma9.js +0 -544
- package/dist/wallet-DBrVZJqe.js +0 -3
- package/openclaw.plugin.json +0 -93
- package/skills/SKILL.md +0 -183
- package/skills/references/library.md +0 -85
- package/skills/references/openclaw-plugin.md +0 -145
|
@@ -0,0 +1,2802 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
//#region node_modules/.pnpm/zod@4.3.6/node_modules/zod/v4/core/core.js
|
|
3
|
+
/** A special constant with type `never` */
|
|
4
|
+
const NEVER = Object.freeze({ status: "aborted" });
|
|
5
|
+
function $constructor(name, initializer, params) {
|
|
6
|
+
function init(inst, def) {
|
|
7
|
+
if (!inst._zod) Object.defineProperty(inst, "_zod", {
|
|
8
|
+
value: {
|
|
9
|
+
def,
|
|
10
|
+
constr: _,
|
|
11
|
+
traits: /* @__PURE__ */ new Set()
|
|
12
|
+
},
|
|
13
|
+
enumerable: false
|
|
14
|
+
});
|
|
15
|
+
if (inst._zod.traits.has(name)) return;
|
|
16
|
+
inst._zod.traits.add(name);
|
|
17
|
+
initializer(inst, def);
|
|
18
|
+
const proto = _.prototype;
|
|
19
|
+
const keys = Object.keys(proto);
|
|
20
|
+
for (let i = 0; i < keys.length; i++) {
|
|
21
|
+
const k = keys[i];
|
|
22
|
+
if (!(k in inst)) inst[k] = proto[k].bind(inst);
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
const Parent = params?.Parent ?? Object;
|
|
26
|
+
class Definition extends Parent {}
|
|
27
|
+
Object.defineProperty(Definition, "name", { value: name });
|
|
28
|
+
function _(def) {
|
|
29
|
+
var _a;
|
|
30
|
+
const inst = params?.Parent ? new Definition() : this;
|
|
31
|
+
init(inst, def);
|
|
32
|
+
(_a = inst._zod).deferred ?? (_a.deferred = []);
|
|
33
|
+
for (const fn of inst._zod.deferred) fn();
|
|
34
|
+
return inst;
|
|
35
|
+
}
|
|
36
|
+
Object.defineProperty(_, "init", { value: init });
|
|
37
|
+
Object.defineProperty(_, Symbol.hasInstance, { value: (inst) => {
|
|
38
|
+
if (params?.Parent && inst instanceof params.Parent) return true;
|
|
39
|
+
return inst?._zod?.traits?.has(name);
|
|
40
|
+
} });
|
|
41
|
+
Object.defineProperty(_, "name", { value: name });
|
|
42
|
+
return _;
|
|
43
|
+
}
|
|
44
|
+
var $ZodAsyncError = class extends Error {
|
|
45
|
+
constructor() {
|
|
46
|
+
super(`Encountered Promise during synchronous parse. Use .parseAsync() instead.`);
|
|
47
|
+
}
|
|
48
|
+
};
|
|
49
|
+
var $ZodEncodeError = class extends Error {
|
|
50
|
+
constructor(name) {
|
|
51
|
+
super(`Encountered unidirectional transform during encode: ${name}`);
|
|
52
|
+
this.name = "ZodEncodeError";
|
|
53
|
+
}
|
|
54
|
+
};
|
|
55
|
+
const globalConfig = {};
|
|
56
|
+
function config(newConfig) {
|
|
57
|
+
if (newConfig) Object.assign(globalConfig, newConfig);
|
|
58
|
+
return globalConfig;
|
|
59
|
+
}
|
|
60
|
+
//#endregion
|
|
61
|
+
//#region node_modules/.pnpm/zod@4.3.6/node_modules/zod/v4/core/util.js
|
|
62
|
+
function getEnumValues(entries) {
|
|
63
|
+
const numericValues = Object.values(entries).filter((v) => typeof v === "number");
|
|
64
|
+
return Object.entries(entries).filter(([k, _]) => numericValues.indexOf(+k) === -1).map(([_, v]) => v);
|
|
65
|
+
}
|
|
66
|
+
function jsonStringifyReplacer(_, value) {
|
|
67
|
+
if (typeof value === "bigint") return value.toString();
|
|
68
|
+
return value;
|
|
69
|
+
}
|
|
70
|
+
function cached(getter) {
|
|
71
|
+
return { get value() {
|
|
72
|
+
{
|
|
73
|
+
const value = getter();
|
|
74
|
+
Object.defineProperty(this, "value", { value });
|
|
75
|
+
return value;
|
|
76
|
+
}
|
|
77
|
+
throw new Error("cached value already set");
|
|
78
|
+
} };
|
|
79
|
+
}
|
|
80
|
+
function nullish(input) {
|
|
81
|
+
return input === null || input === void 0;
|
|
82
|
+
}
|
|
83
|
+
function cleanRegex(source) {
|
|
84
|
+
const start = source.startsWith("^") ? 1 : 0;
|
|
85
|
+
const end = source.endsWith("$") ? source.length - 1 : source.length;
|
|
86
|
+
return source.slice(start, end);
|
|
87
|
+
}
|
|
88
|
+
function floatSafeRemainder(val, step) {
|
|
89
|
+
const valDecCount = (val.toString().split(".")[1] || "").length;
|
|
90
|
+
const stepString = step.toString();
|
|
91
|
+
let stepDecCount = (stepString.split(".")[1] || "").length;
|
|
92
|
+
if (stepDecCount === 0 && /\d?e-\d?/.test(stepString)) {
|
|
93
|
+
const match = stepString.match(/\d?e-(\d?)/);
|
|
94
|
+
if (match?.[1]) stepDecCount = Number.parseInt(match[1]);
|
|
95
|
+
}
|
|
96
|
+
const decCount = valDecCount > stepDecCount ? valDecCount : stepDecCount;
|
|
97
|
+
return Number.parseInt(val.toFixed(decCount).replace(".", "")) % Number.parseInt(step.toFixed(decCount).replace(".", "")) / 10 ** decCount;
|
|
98
|
+
}
|
|
99
|
+
const EVALUATING = Symbol("evaluating");
|
|
100
|
+
function defineLazy(object, key, getter) {
|
|
101
|
+
let value = void 0;
|
|
102
|
+
Object.defineProperty(object, key, {
|
|
103
|
+
get() {
|
|
104
|
+
if (value === EVALUATING) return;
|
|
105
|
+
if (value === void 0) {
|
|
106
|
+
value = EVALUATING;
|
|
107
|
+
value = getter();
|
|
108
|
+
}
|
|
109
|
+
return value;
|
|
110
|
+
},
|
|
111
|
+
set(v) {
|
|
112
|
+
Object.defineProperty(object, key, { value: v });
|
|
113
|
+
},
|
|
114
|
+
configurable: true
|
|
115
|
+
});
|
|
116
|
+
}
|
|
117
|
+
function assignProp(target, prop, value) {
|
|
118
|
+
Object.defineProperty(target, prop, {
|
|
119
|
+
value,
|
|
120
|
+
writable: true,
|
|
121
|
+
enumerable: true,
|
|
122
|
+
configurable: true
|
|
123
|
+
});
|
|
124
|
+
}
|
|
125
|
+
function mergeDefs(...defs) {
|
|
126
|
+
const mergedDescriptors = {};
|
|
127
|
+
for (const def of defs) Object.assign(mergedDescriptors, Object.getOwnPropertyDescriptors(def));
|
|
128
|
+
return Object.defineProperties({}, mergedDescriptors);
|
|
129
|
+
}
|
|
130
|
+
function esc(str) {
|
|
131
|
+
return JSON.stringify(str);
|
|
132
|
+
}
|
|
133
|
+
function slugify(input) {
|
|
134
|
+
return input.toLowerCase().trim().replace(/[^\w\s-]/g, "").replace(/[\s_-]+/g, "-").replace(/^-+|-+$/g, "");
|
|
135
|
+
}
|
|
136
|
+
const captureStackTrace = "captureStackTrace" in Error ? Error.captureStackTrace : (..._args) => {};
|
|
137
|
+
function isObject(data) {
|
|
138
|
+
return typeof data === "object" && data !== null && !Array.isArray(data);
|
|
139
|
+
}
|
|
140
|
+
const allowsEval = cached(() => {
|
|
141
|
+
if (typeof navigator !== "undefined" && navigator?.userAgent?.includes("Cloudflare")) return false;
|
|
142
|
+
try {
|
|
143
|
+
new Function("");
|
|
144
|
+
return true;
|
|
145
|
+
} catch (_) {
|
|
146
|
+
return false;
|
|
147
|
+
}
|
|
148
|
+
});
|
|
149
|
+
function isPlainObject(o) {
|
|
150
|
+
if (isObject(o) === false) return false;
|
|
151
|
+
const ctor = o.constructor;
|
|
152
|
+
if (ctor === void 0) return true;
|
|
153
|
+
if (typeof ctor !== "function") return true;
|
|
154
|
+
const prot = ctor.prototype;
|
|
155
|
+
if (isObject(prot) === false) return false;
|
|
156
|
+
if (Object.prototype.hasOwnProperty.call(prot, "isPrototypeOf") === false) return false;
|
|
157
|
+
return true;
|
|
158
|
+
}
|
|
159
|
+
function shallowClone(o) {
|
|
160
|
+
if (isPlainObject(o)) return { ...o };
|
|
161
|
+
if (Array.isArray(o)) return [...o];
|
|
162
|
+
return o;
|
|
163
|
+
}
|
|
164
|
+
const propertyKeyTypes = new Set([
|
|
165
|
+
"string",
|
|
166
|
+
"number",
|
|
167
|
+
"symbol"
|
|
168
|
+
]);
|
|
169
|
+
function escapeRegex(str) {
|
|
170
|
+
return str.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
|
|
171
|
+
}
|
|
172
|
+
function clone(inst, def, params) {
|
|
173
|
+
const cl = new inst._zod.constr(def ?? inst._zod.def);
|
|
174
|
+
if (!def || params?.parent) cl._zod.parent = inst;
|
|
175
|
+
return cl;
|
|
176
|
+
}
|
|
177
|
+
function normalizeParams(_params) {
|
|
178
|
+
const params = _params;
|
|
179
|
+
if (!params) return {};
|
|
180
|
+
if (typeof params === "string") return { error: () => params };
|
|
181
|
+
if (params?.message !== void 0) {
|
|
182
|
+
if (params?.error !== void 0) throw new Error("Cannot specify both `message` and `error` params");
|
|
183
|
+
params.error = params.message;
|
|
184
|
+
}
|
|
185
|
+
delete params.message;
|
|
186
|
+
if (typeof params.error === "string") return {
|
|
187
|
+
...params,
|
|
188
|
+
error: () => params.error
|
|
189
|
+
};
|
|
190
|
+
return params;
|
|
191
|
+
}
|
|
192
|
+
function optionalKeys(shape) {
|
|
193
|
+
return Object.keys(shape).filter((k) => {
|
|
194
|
+
return shape[k]._zod.optin === "optional" && shape[k]._zod.optout === "optional";
|
|
195
|
+
});
|
|
196
|
+
}
|
|
197
|
+
const NUMBER_FORMAT_RANGES = {
|
|
198
|
+
safeint: [Number.MIN_SAFE_INTEGER, Number.MAX_SAFE_INTEGER],
|
|
199
|
+
int32: [-2147483648, 2147483647],
|
|
200
|
+
uint32: [0, 4294967295],
|
|
201
|
+
float32: [-34028234663852886e22, 34028234663852886e22],
|
|
202
|
+
float64: [-Number.MAX_VALUE, Number.MAX_VALUE]
|
|
203
|
+
};
|
|
204
|
+
function pick(schema, mask) {
|
|
205
|
+
const currDef = schema._zod.def;
|
|
206
|
+
const checks = currDef.checks;
|
|
207
|
+
if (checks && checks.length > 0) throw new Error(".pick() cannot be used on object schemas containing refinements");
|
|
208
|
+
return clone(schema, mergeDefs(schema._zod.def, {
|
|
209
|
+
get shape() {
|
|
210
|
+
const newShape = {};
|
|
211
|
+
for (const key in mask) {
|
|
212
|
+
if (!(key in currDef.shape)) throw new Error(`Unrecognized key: "${key}"`);
|
|
213
|
+
if (!mask[key]) continue;
|
|
214
|
+
newShape[key] = currDef.shape[key];
|
|
215
|
+
}
|
|
216
|
+
assignProp(this, "shape", newShape);
|
|
217
|
+
return newShape;
|
|
218
|
+
},
|
|
219
|
+
checks: []
|
|
220
|
+
}));
|
|
221
|
+
}
|
|
222
|
+
function omit(schema, mask) {
|
|
223
|
+
const currDef = schema._zod.def;
|
|
224
|
+
const checks = currDef.checks;
|
|
225
|
+
if (checks && checks.length > 0) throw new Error(".omit() cannot be used on object schemas containing refinements");
|
|
226
|
+
return clone(schema, mergeDefs(schema._zod.def, {
|
|
227
|
+
get shape() {
|
|
228
|
+
const newShape = { ...schema._zod.def.shape };
|
|
229
|
+
for (const key in mask) {
|
|
230
|
+
if (!(key in currDef.shape)) throw new Error(`Unrecognized key: "${key}"`);
|
|
231
|
+
if (!mask[key]) continue;
|
|
232
|
+
delete newShape[key];
|
|
233
|
+
}
|
|
234
|
+
assignProp(this, "shape", newShape);
|
|
235
|
+
return newShape;
|
|
236
|
+
},
|
|
237
|
+
checks: []
|
|
238
|
+
}));
|
|
239
|
+
}
|
|
240
|
+
function extend(schema, shape) {
|
|
241
|
+
if (!isPlainObject(shape)) throw new Error("Invalid input to extend: expected a plain object");
|
|
242
|
+
const checks = schema._zod.def.checks;
|
|
243
|
+
if (checks && checks.length > 0) {
|
|
244
|
+
const existingShape = schema._zod.def.shape;
|
|
245
|
+
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.");
|
|
246
|
+
}
|
|
247
|
+
return clone(schema, mergeDefs(schema._zod.def, { get shape() {
|
|
248
|
+
const _shape = {
|
|
249
|
+
...schema._zod.def.shape,
|
|
250
|
+
...shape
|
|
251
|
+
};
|
|
252
|
+
assignProp(this, "shape", _shape);
|
|
253
|
+
return _shape;
|
|
254
|
+
} }));
|
|
255
|
+
}
|
|
256
|
+
function safeExtend(schema, shape) {
|
|
257
|
+
if (!isPlainObject(shape)) throw new Error("Invalid input to safeExtend: expected a plain object");
|
|
258
|
+
return clone(schema, mergeDefs(schema._zod.def, { get shape() {
|
|
259
|
+
const _shape = {
|
|
260
|
+
...schema._zod.def.shape,
|
|
261
|
+
...shape
|
|
262
|
+
};
|
|
263
|
+
assignProp(this, "shape", _shape);
|
|
264
|
+
return _shape;
|
|
265
|
+
} }));
|
|
266
|
+
}
|
|
267
|
+
function merge(a, b) {
|
|
268
|
+
return clone(a, mergeDefs(a._zod.def, {
|
|
269
|
+
get shape() {
|
|
270
|
+
const _shape = {
|
|
271
|
+
...a._zod.def.shape,
|
|
272
|
+
...b._zod.def.shape
|
|
273
|
+
};
|
|
274
|
+
assignProp(this, "shape", _shape);
|
|
275
|
+
return _shape;
|
|
276
|
+
},
|
|
277
|
+
get catchall() {
|
|
278
|
+
return b._zod.def.catchall;
|
|
279
|
+
},
|
|
280
|
+
checks: []
|
|
281
|
+
}));
|
|
282
|
+
}
|
|
283
|
+
function partial(Class, schema, mask) {
|
|
284
|
+
const checks = schema._zod.def.checks;
|
|
285
|
+
if (checks && checks.length > 0) throw new Error(".partial() cannot be used on object schemas containing refinements");
|
|
286
|
+
return clone(schema, mergeDefs(schema._zod.def, {
|
|
287
|
+
get shape() {
|
|
288
|
+
const oldShape = schema._zod.def.shape;
|
|
289
|
+
const shape = { ...oldShape };
|
|
290
|
+
if (mask) for (const key in mask) {
|
|
291
|
+
if (!(key in oldShape)) throw new Error(`Unrecognized key: "${key}"`);
|
|
292
|
+
if (!mask[key]) continue;
|
|
293
|
+
shape[key] = Class ? new Class({
|
|
294
|
+
type: "optional",
|
|
295
|
+
innerType: oldShape[key]
|
|
296
|
+
}) : oldShape[key];
|
|
297
|
+
}
|
|
298
|
+
else for (const key in oldShape) shape[key] = Class ? new Class({
|
|
299
|
+
type: "optional",
|
|
300
|
+
innerType: oldShape[key]
|
|
301
|
+
}) : oldShape[key];
|
|
302
|
+
assignProp(this, "shape", shape);
|
|
303
|
+
return shape;
|
|
304
|
+
},
|
|
305
|
+
checks: []
|
|
306
|
+
}));
|
|
307
|
+
}
|
|
308
|
+
function required(Class, schema, mask) {
|
|
309
|
+
return clone(schema, mergeDefs(schema._zod.def, { get shape() {
|
|
310
|
+
const oldShape = schema._zod.def.shape;
|
|
311
|
+
const shape = { ...oldShape };
|
|
312
|
+
if (mask) for (const key in mask) {
|
|
313
|
+
if (!(key in shape)) throw new Error(`Unrecognized key: "${key}"`);
|
|
314
|
+
if (!mask[key]) continue;
|
|
315
|
+
shape[key] = new Class({
|
|
316
|
+
type: "nonoptional",
|
|
317
|
+
innerType: oldShape[key]
|
|
318
|
+
});
|
|
319
|
+
}
|
|
320
|
+
else for (const key in oldShape) shape[key] = new Class({
|
|
321
|
+
type: "nonoptional",
|
|
322
|
+
innerType: oldShape[key]
|
|
323
|
+
});
|
|
324
|
+
assignProp(this, "shape", shape);
|
|
325
|
+
return shape;
|
|
326
|
+
} }));
|
|
327
|
+
}
|
|
328
|
+
function aborted(x, startIndex = 0) {
|
|
329
|
+
if (x.aborted === true) return true;
|
|
330
|
+
for (let i = startIndex; i < x.issues.length; i++) if (x.issues[i]?.continue !== true) return true;
|
|
331
|
+
return false;
|
|
332
|
+
}
|
|
333
|
+
function prefixIssues(path, issues) {
|
|
334
|
+
return issues.map((iss) => {
|
|
335
|
+
var _a;
|
|
336
|
+
(_a = iss).path ?? (_a.path = []);
|
|
337
|
+
iss.path.unshift(path);
|
|
338
|
+
return iss;
|
|
339
|
+
});
|
|
340
|
+
}
|
|
341
|
+
function unwrapMessage(message) {
|
|
342
|
+
return typeof message === "string" ? message : message?.message;
|
|
343
|
+
}
|
|
344
|
+
function finalizeIssue(iss, ctx, config) {
|
|
345
|
+
const full = {
|
|
346
|
+
...iss,
|
|
347
|
+
path: iss.path ?? []
|
|
348
|
+
};
|
|
349
|
+
if (!iss.message) full.message = unwrapMessage(iss.inst?._zod.def?.error?.(iss)) ?? unwrapMessage(ctx?.error?.(iss)) ?? unwrapMessage(config.customError?.(iss)) ?? unwrapMessage(config.localeError?.(iss)) ?? "Invalid input";
|
|
350
|
+
delete full.inst;
|
|
351
|
+
delete full.continue;
|
|
352
|
+
if (!ctx?.reportInput) delete full.input;
|
|
353
|
+
return full;
|
|
354
|
+
}
|
|
355
|
+
function getLengthableOrigin(input) {
|
|
356
|
+
if (Array.isArray(input)) return "array";
|
|
357
|
+
if (typeof input === "string") return "string";
|
|
358
|
+
return "unknown";
|
|
359
|
+
}
|
|
360
|
+
function issue(...args) {
|
|
361
|
+
const [iss, input, inst] = args;
|
|
362
|
+
if (typeof iss === "string") return {
|
|
363
|
+
message: iss,
|
|
364
|
+
code: "custom",
|
|
365
|
+
input,
|
|
366
|
+
inst
|
|
367
|
+
};
|
|
368
|
+
return { ...iss };
|
|
369
|
+
}
|
|
370
|
+
//#endregion
|
|
371
|
+
//#region node_modules/.pnpm/zod@4.3.6/node_modules/zod/v4/core/errors.js
|
|
372
|
+
const initializer = (inst, def) => {
|
|
373
|
+
inst.name = "$ZodError";
|
|
374
|
+
Object.defineProperty(inst, "_zod", {
|
|
375
|
+
value: inst._zod,
|
|
376
|
+
enumerable: false
|
|
377
|
+
});
|
|
378
|
+
Object.defineProperty(inst, "issues", {
|
|
379
|
+
value: def,
|
|
380
|
+
enumerable: false
|
|
381
|
+
});
|
|
382
|
+
inst.message = JSON.stringify(def, jsonStringifyReplacer, 2);
|
|
383
|
+
Object.defineProperty(inst, "toString", {
|
|
384
|
+
value: () => inst.message,
|
|
385
|
+
enumerable: false
|
|
386
|
+
});
|
|
387
|
+
};
|
|
388
|
+
const $ZodError = $constructor("$ZodError", initializer);
|
|
389
|
+
const $ZodRealError = $constructor("$ZodError", initializer, { Parent: Error });
|
|
390
|
+
function flattenError(error, mapper = (issue) => issue.message) {
|
|
391
|
+
const fieldErrors = {};
|
|
392
|
+
const formErrors = [];
|
|
393
|
+
for (const sub of error.issues) if (sub.path.length > 0) {
|
|
394
|
+
fieldErrors[sub.path[0]] = fieldErrors[sub.path[0]] || [];
|
|
395
|
+
fieldErrors[sub.path[0]].push(mapper(sub));
|
|
396
|
+
} else formErrors.push(mapper(sub));
|
|
397
|
+
return {
|
|
398
|
+
formErrors,
|
|
399
|
+
fieldErrors
|
|
400
|
+
};
|
|
401
|
+
}
|
|
402
|
+
function formatError(error, mapper = (issue) => issue.message) {
|
|
403
|
+
const fieldErrors = { _errors: [] };
|
|
404
|
+
const processError = (error) => {
|
|
405
|
+
for (const issue of error.issues) if (issue.code === "invalid_union" && issue.errors.length) issue.errors.map((issues) => processError({ issues }));
|
|
406
|
+
else if (issue.code === "invalid_key") processError({ issues: issue.issues });
|
|
407
|
+
else if (issue.code === "invalid_element") processError({ issues: issue.issues });
|
|
408
|
+
else if (issue.path.length === 0) fieldErrors._errors.push(mapper(issue));
|
|
409
|
+
else {
|
|
410
|
+
let curr = fieldErrors;
|
|
411
|
+
let i = 0;
|
|
412
|
+
while (i < issue.path.length) {
|
|
413
|
+
const el = issue.path[i];
|
|
414
|
+
if (!(i === issue.path.length - 1)) curr[el] = curr[el] || { _errors: [] };
|
|
415
|
+
else {
|
|
416
|
+
curr[el] = curr[el] || { _errors: [] };
|
|
417
|
+
curr[el]._errors.push(mapper(issue));
|
|
418
|
+
}
|
|
419
|
+
curr = curr[el];
|
|
420
|
+
i++;
|
|
421
|
+
}
|
|
422
|
+
}
|
|
423
|
+
};
|
|
424
|
+
processError(error);
|
|
425
|
+
return fieldErrors;
|
|
426
|
+
}
|
|
427
|
+
//#endregion
|
|
428
|
+
//#region node_modules/.pnpm/zod@4.3.6/node_modules/zod/v4/core/parse.js
|
|
429
|
+
const _parse = (_Err) => (schema, value, _ctx, _params) => {
|
|
430
|
+
const ctx = _ctx ? Object.assign(_ctx, { async: false }) : { async: false };
|
|
431
|
+
const result = schema._zod.run({
|
|
432
|
+
value,
|
|
433
|
+
issues: []
|
|
434
|
+
}, ctx);
|
|
435
|
+
if (result instanceof Promise) throw new $ZodAsyncError();
|
|
436
|
+
if (result.issues.length) {
|
|
437
|
+
const e = new (_params?.Err ?? _Err)(result.issues.map((iss) => finalizeIssue(iss, ctx, config())));
|
|
438
|
+
captureStackTrace(e, _params?.callee);
|
|
439
|
+
throw e;
|
|
440
|
+
}
|
|
441
|
+
return result.value;
|
|
442
|
+
};
|
|
443
|
+
const parse = /* @__PURE__ */ _parse($ZodRealError);
|
|
444
|
+
const _parseAsync = (_Err) => async (schema, value, _ctx, params) => {
|
|
445
|
+
const ctx = _ctx ? Object.assign(_ctx, { async: true }) : { async: true };
|
|
446
|
+
let result = schema._zod.run({
|
|
447
|
+
value,
|
|
448
|
+
issues: []
|
|
449
|
+
}, ctx);
|
|
450
|
+
if (result instanceof Promise) result = await result;
|
|
451
|
+
if (result.issues.length) {
|
|
452
|
+
const e = new (params?.Err ?? _Err)(result.issues.map((iss) => finalizeIssue(iss, ctx, config())));
|
|
453
|
+
captureStackTrace(e, params?.callee);
|
|
454
|
+
throw e;
|
|
455
|
+
}
|
|
456
|
+
return result.value;
|
|
457
|
+
};
|
|
458
|
+
const parseAsync = /* @__PURE__ */ _parseAsync($ZodRealError);
|
|
459
|
+
const _safeParse = (_Err) => (schema, value, _ctx) => {
|
|
460
|
+
const ctx = _ctx ? {
|
|
461
|
+
..._ctx,
|
|
462
|
+
async: false
|
|
463
|
+
} : { async: false };
|
|
464
|
+
const result = schema._zod.run({
|
|
465
|
+
value,
|
|
466
|
+
issues: []
|
|
467
|
+
}, ctx);
|
|
468
|
+
if (result instanceof Promise) throw new $ZodAsyncError();
|
|
469
|
+
return result.issues.length ? {
|
|
470
|
+
success: false,
|
|
471
|
+
error: new (_Err ?? $ZodError)(result.issues.map((iss) => finalizeIssue(iss, ctx, config())))
|
|
472
|
+
} : {
|
|
473
|
+
success: true,
|
|
474
|
+
data: result.value
|
|
475
|
+
};
|
|
476
|
+
};
|
|
477
|
+
const safeParse = /* @__PURE__ */ _safeParse($ZodRealError);
|
|
478
|
+
const _safeParseAsync = (_Err) => async (schema, value, _ctx) => {
|
|
479
|
+
const ctx = _ctx ? Object.assign(_ctx, { async: true }) : { async: true };
|
|
480
|
+
let result = schema._zod.run({
|
|
481
|
+
value,
|
|
482
|
+
issues: []
|
|
483
|
+
}, ctx);
|
|
484
|
+
if (result instanceof Promise) result = await result;
|
|
485
|
+
return result.issues.length ? {
|
|
486
|
+
success: false,
|
|
487
|
+
error: new _Err(result.issues.map((iss) => finalizeIssue(iss, ctx, config())))
|
|
488
|
+
} : {
|
|
489
|
+
success: true,
|
|
490
|
+
data: result.value
|
|
491
|
+
};
|
|
492
|
+
};
|
|
493
|
+
const safeParseAsync = /* @__PURE__ */ _safeParseAsync($ZodRealError);
|
|
494
|
+
const _encode = (_Err) => (schema, value, _ctx) => {
|
|
495
|
+
const ctx = _ctx ? Object.assign(_ctx, { direction: "backward" }) : { direction: "backward" };
|
|
496
|
+
return _parse(_Err)(schema, value, ctx);
|
|
497
|
+
};
|
|
498
|
+
const _decode = (_Err) => (schema, value, _ctx) => {
|
|
499
|
+
return _parse(_Err)(schema, value, _ctx);
|
|
500
|
+
};
|
|
501
|
+
const _encodeAsync = (_Err) => async (schema, value, _ctx) => {
|
|
502
|
+
const ctx = _ctx ? Object.assign(_ctx, { direction: "backward" }) : { direction: "backward" };
|
|
503
|
+
return _parseAsync(_Err)(schema, value, ctx);
|
|
504
|
+
};
|
|
505
|
+
const _decodeAsync = (_Err) => async (schema, value, _ctx) => {
|
|
506
|
+
return _parseAsync(_Err)(schema, value, _ctx);
|
|
507
|
+
};
|
|
508
|
+
const _safeEncode = (_Err) => (schema, value, _ctx) => {
|
|
509
|
+
const ctx = _ctx ? Object.assign(_ctx, { direction: "backward" }) : { direction: "backward" };
|
|
510
|
+
return _safeParse(_Err)(schema, value, ctx);
|
|
511
|
+
};
|
|
512
|
+
const _safeDecode = (_Err) => (schema, value, _ctx) => {
|
|
513
|
+
return _safeParse(_Err)(schema, value, _ctx);
|
|
514
|
+
};
|
|
515
|
+
const _safeEncodeAsync = (_Err) => async (schema, value, _ctx) => {
|
|
516
|
+
const ctx = _ctx ? Object.assign(_ctx, { direction: "backward" }) : { direction: "backward" };
|
|
517
|
+
return _safeParseAsync(_Err)(schema, value, ctx);
|
|
518
|
+
};
|
|
519
|
+
const _safeDecodeAsync = (_Err) => async (schema, value, _ctx) => {
|
|
520
|
+
return _safeParseAsync(_Err)(schema, value, _ctx);
|
|
521
|
+
};
|
|
522
|
+
//#endregion
|
|
523
|
+
//#region node_modules/.pnpm/zod@4.3.6/node_modules/zod/v4/core/regexes.js
|
|
524
|
+
const cuid = /^[cC][^\s-]{8,}$/;
|
|
525
|
+
const cuid2 = /^[0-9a-z]+$/;
|
|
526
|
+
const ulid = /^[0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{26}$/;
|
|
527
|
+
const xid = /^[0-9a-vA-V]{20}$/;
|
|
528
|
+
const ksuid = /^[A-Za-z0-9]{27}$/;
|
|
529
|
+
const nanoid = /^[a-zA-Z0-9_-]{21}$/;
|
|
530
|
+
/** ISO 8601-1 duration regex. Does not support the 8601-2 extensions like negative durations or fractional/negative components. */
|
|
531
|
+
const duration = /^P(?:(\d+W)|(?!.*W)(?=\d|T\d)(\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+([.,]\d+)?S)?)?)$/;
|
|
532
|
+
/** A regex for any UUID-like identifier: 8-4-4-4-12 hex pattern */
|
|
533
|
+
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})$/;
|
|
534
|
+
/** Returns a regex for validating an RFC 9562/4122 UUID.
|
|
535
|
+
*
|
|
536
|
+
* @param version Optionally specify a version 1-8. If no version is specified, all versions are supported. */
|
|
537
|
+
const uuid = (version) => {
|
|
538
|
+
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)$/;
|
|
539
|
+
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})$`);
|
|
540
|
+
};
|
|
541
|
+
/** Practical email validation */
|
|
542
|
+
const email = /^(?!\.)(?!.*\.\.)([A-Za-z0-9_'+\-\.]*)[A-Za-z0-9_+-]@([A-Za-z0-9][A-Za-z0-9\-]*\.)+[A-Za-z]{2,}$/;
|
|
543
|
+
const _emoji$1 = `^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$`;
|
|
544
|
+
function emoji() {
|
|
545
|
+
return new RegExp(_emoji$1, "u");
|
|
546
|
+
}
|
|
547
|
+
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])$/;
|
|
548
|
+
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}|:))$/;
|
|
549
|
+
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])$/;
|
|
550
|
+
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])$/;
|
|
551
|
+
const base64 = /^$|^(?:[0-9a-zA-Z+/]{4})*(?:(?:[0-9a-zA-Z+/]{2}==)|(?:[0-9a-zA-Z+/]{3}=))?$/;
|
|
552
|
+
const base64url = /^[A-Za-z0-9_-]*$/;
|
|
553
|
+
const e164 = /^\+[1-9]\d{6,14}$/;
|
|
554
|
+
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])))`;
|
|
555
|
+
const date = /* @__PURE__ */ new RegExp(`^${dateSource}$`);
|
|
556
|
+
function timeSource(args) {
|
|
557
|
+
const hhmm = `(?:[01]\\d|2[0-3]):[0-5]\\d`;
|
|
558
|
+
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+)?)?`;
|
|
559
|
+
}
|
|
560
|
+
function time(args) {
|
|
561
|
+
return new RegExp(`^${timeSource(args)}$`);
|
|
562
|
+
}
|
|
563
|
+
function datetime(args) {
|
|
564
|
+
const time = timeSource({ precision: args.precision });
|
|
565
|
+
const opts = ["Z"];
|
|
566
|
+
if (args.local) opts.push("");
|
|
567
|
+
if (args.offset) opts.push(`([+-](?:[01]\\d|2[0-3]):[0-5]\\d)`);
|
|
568
|
+
const timeRegex = `${time}(?:${opts.join("|")})`;
|
|
569
|
+
return new RegExp(`^${dateSource}T(?:${timeRegex})$`);
|
|
570
|
+
}
|
|
571
|
+
const string = (params) => {
|
|
572
|
+
const regex = params ? `[\\s\\S]{${params?.minimum ?? 0},${params?.maximum ?? ""}}` : `[\\s\\S]*`;
|
|
573
|
+
return new RegExp(`^${regex}$`);
|
|
574
|
+
};
|
|
575
|
+
const integer = /^-?\d+$/;
|
|
576
|
+
const number = /^-?\d+(?:\.\d+)?$/;
|
|
577
|
+
const boolean = /^(?:true|false)$/i;
|
|
578
|
+
const _null$1 = /^null$/i;
|
|
579
|
+
const lowercase = /^[^A-Z]*$/;
|
|
580
|
+
const uppercase = /^[^a-z]*$/;
|
|
581
|
+
//#endregion
|
|
582
|
+
//#region node_modules/.pnpm/zod@4.3.6/node_modules/zod/v4/core/checks.js
|
|
583
|
+
const $ZodCheck = /* @__PURE__ */ $constructor("$ZodCheck", (inst, def) => {
|
|
584
|
+
var _a;
|
|
585
|
+
inst._zod ?? (inst._zod = {});
|
|
586
|
+
inst._zod.def = def;
|
|
587
|
+
(_a = inst._zod).onattach ?? (_a.onattach = []);
|
|
588
|
+
});
|
|
589
|
+
const numericOriginMap = {
|
|
590
|
+
number: "number",
|
|
591
|
+
bigint: "bigint",
|
|
592
|
+
object: "date"
|
|
593
|
+
};
|
|
594
|
+
const $ZodCheckLessThan = /* @__PURE__ */ $constructor("$ZodCheckLessThan", (inst, def) => {
|
|
595
|
+
$ZodCheck.init(inst, def);
|
|
596
|
+
const origin = numericOriginMap[typeof def.value];
|
|
597
|
+
inst._zod.onattach.push((inst) => {
|
|
598
|
+
const bag = inst._zod.bag;
|
|
599
|
+
const curr = (def.inclusive ? bag.maximum : bag.exclusiveMaximum) ?? Number.POSITIVE_INFINITY;
|
|
600
|
+
if (def.value < curr) if (def.inclusive) bag.maximum = def.value;
|
|
601
|
+
else bag.exclusiveMaximum = def.value;
|
|
602
|
+
});
|
|
603
|
+
inst._zod.check = (payload) => {
|
|
604
|
+
if (def.inclusive ? payload.value <= def.value : payload.value < def.value) return;
|
|
605
|
+
payload.issues.push({
|
|
606
|
+
origin,
|
|
607
|
+
code: "too_big",
|
|
608
|
+
maximum: typeof def.value === "object" ? def.value.getTime() : def.value,
|
|
609
|
+
input: payload.value,
|
|
610
|
+
inclusive: def.inclusive,
|
|
611
|
+
inst,
|
|
612
|
+
continue: !def.abort
|
|
613
|
+
});
|
|
614
|
+
};
|
|
615
|
+
});
|
|
616
|
+
const $ZodCheckGreaterThan = /* @__PURE__ */ $constructor("$ZodCheckGreaterThan", (inst, def) => {
|
|
617
|
+
$ZodCheck.init(inst, def);
|
|
618
|
+
const origin = numericOriginMap[typeof def.value];
|
|
619
|
+
inst._zod.onattach.push((inst) => {
|
|
620
|
+
const bag = inst._zod.bag;
|
|
621
|
+
const curr = (def.inclusive ? bag.minimum : bag.exclusiveMinimum) ?? Number.NEGATIVE_INFINITY;
|
|
622
|
+
if (def.value > curr) if (def.inclusive) bag.minimum = def.value;
|
|
623
|
+
else bag.exclusiveMinimum = def.value;
|
|
624
|
+
});
|
|
625
|
+
inst._zod.check = (payload) => {
|
|
626
|
+
if (def.inclusive ? payload.value >= def.value : payload.value > def.value) return;
|
|
627
|
+
payload.issues.push({
|
|
628
|
+
origin,
|
|
629
|
+
code: "too_small",
|
|
630
|
+
minimum: typeof def.value === "object" ? def.value.getTime() : def.value,
|
|
631
|
+
input: payload.value,
|
|
632
|
+
inclusive: def.inclusive,
|
|
633
|
+
inst,
|
|
634
|
+
continue: !def.abort
|
|
635
|
+
});
|
|
636
|
+
};
|
|
637
|
+
});
|
|
638
|
+
const $ZodCheckMultipleOf = /* @__PURE__ */ $constructor("$ZodCheckMultipleOf", (inst, def) => {
|
|
639
|
+
$ZodCheck.init(inst, def);
|
|
640
|
+
inst._zod.onattach.push((inst) => {
|
|
641
|
+
var _a;
|
|
642
|
+
(_a = inst._zod.bag).multipleOf ?? (_a.multipleOf = def.value);
|
|
643
|
+
});
|
|
644
|
+
inst._zod.check = (payload) => {
|
|
645
|
+
if (typeof payload.value !== typeof def.value) throw new Error("Cannot mix number and bigint in multiple_of check.");
|
|
646
|
+
if (typeof payload.value === "bigint" ? payload.value % def.value === BigInt(0) : floatSafeRemainder(payload.value, def.value) === 0) return;
|
|
647
|
+
payload.issues.push({
|
|
648
|
+
origin: typeof payload.value,
|
|
649
|
+
code: "not_multiple_of",
|
|
650
|
+
divisor: def.value,
|
|
651
|
+
input: payload.value,
|
|
652
|
+
inst,
|
|
653
|
+
continue: !def.abort
|
|
654
|
+
});
|
|
655
|
+
};
|
|
656
|
+
});
|
|
657
|
+
const $ZodCheckNumberFormat = /* @__PURE__ */ $constructor("$ZodCheckNumberFormat", (inst, def) => {
|
|
658
|
+
$ZodCheck.init(inst, def);
|
|
659
|
+
def.format = def.format || "float64";
|
|
660
|
+
const isInt = def.format?.includes("int");
|
|
661
|
+
const origin = isInt ? "int" : "number";
|
|
662
|
+
const [minimum, maximum] = NUMBER_FORMAT_RANGES[def.format];
|
|
663
|
+
inst._zod.onattach.push((inst) => {
|
|
664
|
+
const bag = inst._zod.bag;
|
|
665
|
+
bag.format = def.format;
|
|
666
|
+
bag.minimum = minimum;
|
|
667
|
+
bag.maximum = maximum;
|
|
668
|
+
if (isInt) bag.pattern = integer;
|
|
669
|
+
});
|
|
670
|
+
inst._zod.check = (payload) => {
|
|
671
|
+
const input = payload.value;
|
|
672
|
+
if (isInt) {
|
|
673
|
+
if (!Number.isInteger(input)) {
|
|
674
|
+
payload.issues.push({
|
|
675
|
+
expected: origin,
|
|
676
|
+
format: def.format,
|
|
677
|
+
code: "invalid_type",
|
|
678
|
+
continue: false,
|
|
679
|
+
input,
|
|
680
|
+
inst
|
|
681
|
+
});
|
|
682
|
+
return;
|
|
683
|
+
}
|
|
684
|
+
if (!Number.isSafeInteger(input)) {
|
|
685
|
+
if (input > 0) payload.issues.push({
|
|
686
|
+
input,
|
|
687
|
+
code: "too_big",
|
|
688
|
+
maximum: Number.MAX_SAFE_INTEGER,
|
|
689
|
+
note: "Integers must be within the safe integer range.",
|
|
690
|
+
inst,
|
|
691
|
+
origin,
|
|
692
|
+
inclusive: true,
|
|
693
|
+
continue: !def.abort
|
|
694
|
+
});
|
|
695
|
+
else payload.issues.push({
|
|
696
|
+
input,
|
|
697
|
+
code: "too_small",
|
|
698
|
+
minimum: Number.MIN_SAFE_INTEGER,
|
|
699
|
+
note: "Integers must be within the safe integer range.",
|
|
700
|
+
inst,
|
|
701
|
+
origin,
|
|
702
|
+
inclusive: true,
|
|
703
|
+
continue: !def.abort
|
|
704
|
+
});
|
|
705
|
+
return;
|
|
706
|
+
}
|
|
707
|
+
}
|
|
708
|
+
if (input < minimum) payload.issues.push({
|
|
709
|
+
origin: "number",
|
|
710
|
+
input,
|
|
711
|
+
code: "too_small",
|
|
712
|
+
minimum,
|
|
713
|
+
inclusive: true,
|
|
714
|
+
inst,
|
|
715
|
+
continue: !def.abort
|
|
716
|
+
});
|
|
717
|
+
if (input > maximum) payload.issues.push({
|
|
718
|
+
origin: "number",
|
|
719
|
+
input,
|
|
720
|
+
code: "too_big",
|
|
721
|
+
maximum,
|
|
722
|
+
inclusive: true,
|
|
723
|
+
inst,
|
|
724
|
+
continue: !def.abort
|
|
725
|
+
});
|
|
726
|
+
};
|
|
727
|
+
});
|
|
728
|
+
const $ZodCheckMaxLength = /* @__PURE__ */ $constructor("$ZodCheckMaxLength", (inst, def) => {
|
|
729
|
+
var _a;
|
|
730
|
+
$ZodCheck.init(inst, def);
|
|
731
|
+
(_a = inst._zod.def).when ?? (_a.when = (payload) => {
|
|
732
|
+
const val = payload.value;
|
|
733
|
+
return !nullish(val) && val.length !== void 0;
|
|
734
|
+
});
|
|
735
|
+
inst._zod.onattach.push((inst) => {
|
|
736
|
+
const curr = inst._zod.bag.maximum ?? Number.POSITIVE_INFINITY;
|
|
737
|
+
if (def.maximum < curr) inst._zod.bag.maximum = def.maximum;
|
|
738
|
+
});
|
|
739
|
+
inst._zod.check = (payload) => {
|
|
740
|
+
const input = payload.value;
|
|
741
|
+
if (input.length <= def.maximum) return;
|
|
742
|
+
const origin = getLengthableOrigin(input);
|
|
743
|
+
payload.issues.push({
|
|
744
|
+
origin,
|
|
745
|
+
code: "too_big",
|
|
746
|
+
maximum: def.maximum,
|
|
747
|
+
inclusive: true,
|
|
748
|
+
input,
|
|
749
|
+
inst,
|
|
750
|
+
continue: !def.abort
|
|
751
|
+
});
|
|
752
|
+
};
|
|
753
|
+
});
|
|
754
|
+
const $ZodCheckMinLength = /* @__PURE__ */ $constructor("$ZodCheckMinLength", (inst, def) => {
|
|
755
|
+
var _a;
|
|
756
|
+
$ZodCheck.init(inst, def);
|
|
757
|
+
(_a = inst._zod.def).when ?? (_a.when = (payload) => {
|
|
758
|
+
const val = payload.value;
|
|
759
|
+
return !nullish(val) && val.length !== void 0;
|
|
760
|
+
});
|
|
761
|
+
inst._zod.onattach.push((inst) => {
|
|
762
|
+
const curr = inst._zod.bag.minimum ?? Number.NEGATIVE_INFINITY;
|
|
763
|
+
if (def.minimum > curr) inst._zod.bag.minimum = def.minimum;
|
|
764
|
+
});
|
|
765
|
+
inst._zod.check = (payload) => {
|
|
766
|
+
const input = payload.value;
|
|
767
|
+
if (input.length >= def.minimum) return;
|
|
768
|
+
const origin = getLengthableOrigin(input);
|
|
769
|
+
payload.issues.push({
|
|
770
|
+
origin,
|
|
771
|
+
code: "too_small",
|
|
772
|
+
minimum: def.minimum,
|
|
773
|
+
inclusive: true,
|
|
774
|
+
input,
|
|
775
|
+
inst,
|
|
776
|
+
continue: !def.abort
|
|
777
|
+
});
|
|
778
|
+
};
|
|
779
|
+
});
|
|
780
|
+
const $ZodCheckLengthEquals = /* @__PURE__ */ $constructor("$ZodCheckLengthEquals", (inst, def) => {
|
|
781
|
+
var _a;
|
|
782
|
+
$ZodCheck.init(inst, def);
|
|
783
|
+
(_a = inst._zod.def).when ?? (_a.when = (payload) => {
|
|
784
|
+
const val = payload.value;
|
|
785
|
+
return !nullish(val) && val.length !== void 0;
|
|
786
|
+
});
|
|
787
|
+
inst._zod.onattach.push((inst) => {
|
|
788
|
+
const bag = inst._zod.bag;
|
|
789
|
+
bag.minimum = def.length;
|
|
790
|
+
bag.maximum = def.length;
|
|
791
|
+
bag.length = def.length;
|
|
792
|
+
});
|
|
793
|
+
inst._zod.check = (payload) => {
|
|
794
|
+
const input = payload.value;
|
|
795
|
+
const length = input.length;
|
|
796
|
+
if (length === def.length) return;
|
|
797
|
+
const origin = getLengthableOrigin(input);
|
|
798
|
+
const tooBig = length > def.length;
|
|
799
|
+
payload.issues.push({
|
|
800
|
+
origin,
|
|
801
|
+
...tooBig ? {
|
|
802
|
+
code: "too_big",
|
|
803
|
+
maximum: def.length
|
|
804
|
+
} : {
|
|
805
|
+
code: "too_small",
|
|
806
|
+
minimum: def.length
|
|
807
|
+
},
|
|
808
|
+
inclusive: true,
|
|
809
|
+
exact: true,
|
|
810
|
+
input: payload.value,
|
|
811
|
+
inst,
|
|
812
|
+
continue: !def.abort
|
|
813
|
+
});
|
|
814
|
+
};
|
|
815
|
+
});
|
|
816
|
+
const $ZodCheckStringFormat = /* @__PURE__ */ $constructor("$ZodCheckStringFormat", (inst, def) => {
|
|
817
|
+
var _a, _b;
|
|
818
|
+
$ZodCheck.init(inst, def);
|
|
819
|
+
inst._zod.onattach.push((inst) => {
|
|
820
|
+
const bag = inst._zod.bag;
|
|
821
|
+
bag.format = def.format;
|
|
822
|
+
if (def.pattern) {
|
|
823
|
+
bag.patterns ?? (bag.patterns = /* @__PURE__ */ new Set());
|
|
824
|
+
bag.patterns.add(def.pattern);
|
|
825
|
+
}
|
|
826
|
+
});
|
|
827
|
+
if (def.pattern) (_a = inst._zod).check ?? (_a.check = (payload) => {
|
|
828
|
+
def.pattern.lastIndex = 0;
|
|
829
|
+
if (def.pattern.test(payload.value)) return;
|
|
830
|
+
payload.issues.push({
|
|
831
|
+
origin: "string",
|
|
832
|
+
code: "invalid_format",
|
|
833
|
+
format: def.format,
|
|
834
|
+
input: payload.value,
|
|
835
|
+
...def.pattern ? { pattern: def.pattern.toString() } : {},
|
|
836
|
+
inst,
|
|
837
|
+
continue: !def.abort
|
|
838
|
+
});
|
|
839
|
+
});
|
|
840
|
+
else (_b = inst._zod).check ?? (_b.check = () => {});
|
|
841
|
+
});
|
|
842
|
+
const $ZodCheckRegex = /* @__PURE__ */ $constructor("$ZodCheckRegex", (inst, def) => {
|
|
843
|
+
$ZodCheckStringFormat.init(inst, def);
|
|
844
|
+
inst._zod.check = (payload) => {
|
|
845
|
+
def.pattern.lastIndex = 0;
|
|
846
|
+
if (def.pattern.test(payload.value)) return;
|
|
847
|
+
payload.issues.push({
|
|
848
|
+
origin: "string",
|
|
849
|
+
code: "invalid_format",
|
|
850
|
+
format: "regex",
|
|
851
|
+
input: payload.value,
|
|
852
|
+
pattern: def.pattern.toString(),
|
|
853
|
+
inst,
|
|
854
|
+
continue: !def.abort
|
|
855
|
+
});
|
|
856
|
+
};
|
|
857
|
+
});
|
|
858
|
+
const $ZodCheckLowerCase = /* @__PURE__ */ $constructor("$ZodCheckLowerCase", (inst, def) => {
|
|
859
|
+
def.pattern ?? (def.pattern = lowercase);
|
|
860
|
+
$ZodCheckStringFormat.init(inst, def);
|
|
861
|
+
});
|
|
862
|
+
const $ZodCheckUpperCase = /* @__PURE__ */ $constructor("$ZodCheckUpperCase", (inst, def) => {
|
|
863
|
+
def.pattern ?? (def.pattern = uppercase);
|
|
864
|
+
$ZodCheckStringFormat.init(inst, def);
|
|
865
|
+
});
|
|
866
|
+
const $ZodCheckIncludes = /* @__PURE__ */ $constructor("$ZodCheckIncludes", (inst, def) => {
|
|
867
|
+
$ZodCheck.init(inst, def);
|
|
868
|
+
const escapedRegex = escapeRegex(def.includes);
|
|
869
|
+
const pattern = new RegExp(typeof def.position === "number" ? `^.{${def.position}}${escapedRegex}` : escapedRegex);
|
|
870
|
+
def.pattern = pattern;
|
|
871
|
+
inst._zod.onattach.push((inst) => {
|
|
872
|
+
const bag = inst._zod.bag;
|
|
873
|
+
bag.patterns ?? (bag.patterns = /* @__PURE__ */ new Set());
|
|
874
|
+
bag.patterns.add(pattern);
|
|
875
|
+
});
|
|
876
|
+
inst._zod.check = (payload) => {
|
|
877
|
+
if (payload.value.includes(def.includes, def.position)) return;
|
|
878
|
+
payload.issues.push({
|
|
879
|
+
origin: "string",
|
|
880
|
+
code: "invalid_format",
|
|
881
|
+
format: "includes",
|
|
882
|
+
includes: def.includes,
|
|
883
|
+
input: payload.value,
|
|
884
|
+
inst,
|
|
885
|
+
continue: !def.abort
|
|
886
|
+
});
|
|
887
|
+
};
|
|
888
|
+
});
|
|
889
|
+
const $ZodCheckStartsWith = /* @__PURE__ */ $constructor("$ZodCheckStartsWith", (inst, def) => {
|
|
890
|
+
$ZodCheck.init(inst, def);
|
|
891
|
+
const pattern = new RegExp(`^${escapeRegex(def.prefix)}.*`);
|
|
892
|
+
def.pattern ?? (def.pattern = pattern);
|
|
893
|
+
inst._zod.onattach.push((inst) => {
|
|
894
|
+
const bag = inst._zod.bag;
|
|
895
|
+
bag.patterns ?? (bag.patterns = /* @__PURE__ */ new Set());
|
|
896
|
+
bag.patterns.add(pattern);
|
|
897
|
+
});
|
|
898
|
+
inst._zod.check = (payload) => {
|
|
899
|
+
if (payload.value.startsWith(def.prefix)) return;
|
|
900
|
+
payload.issues.push({
|
|
901
|
+
origin: "string",
|
|
902
|
+
code: "invalid_format",
|
|
903
|
+
format: "starts_with",
|
|
904
|
+
prefix: def.prefix,
|
|
905
|
+
input: payload.value,
|
|
906
|
+
inst,
|
|
907
|
+
continue: !def.abort
|
|
908
|
+
});
|
|
909
|
+
};
|
|
910
|
+
});
|
|
911
|
+
const $ZodCheckEndsWith = /* @__PURE__ */ $constructor("$ZodCheckEndsWith", (inst, def) => {
|
|
912
|
+
$ZodCheck.init(inst, def);
|
|
913
|
+
const pattern = new RegExp(`.*${escapeRegex(def.suffix)}$`);
|
|
914
|
+
def.pattern ?? (def.pattern = pattern);
|
|
915
|
+
inst._zod.onattach.push((inst) => {
|
|
916
|
+
const bag = inst._zod.bag;
|
|
917
|
+
bag.patterns ?? (bag.patterns = /* @__PURE__ */ new Set());
|
|
918
|
+
bag.patterns.add(pattern);
|
|
919
|
+
});
|
|
920
|
+
inst._zod.check = (payload) => {
|
|
921
|
+
if (payload.value.endsWith(def.suffix)) return;
|
|
922
|
+
payload.issues.push({
|
|
923
|
+
origin: "string",
|
|
924
|
+
code: "invalid_format",
|
|
925
|
+
format: "ends_with",
|
|
926
|
+
suffix: def.suffix,
|
|
927
|
+
input: payload.value,
|
|
928
|
+
inst,
|
|
929
|
+
continue: !def.abort
|
|
930
|
+
});
|
|
931
|
+
};
|
|
932
|
+
});
|
|
933
|
+
const $ZodCheckOverwrite = /* @__PURE__ */ $constructor("$ZodCheckOverwrite", (inst, def) => {
|
|
934
|
+
$ZodCheck.init(inst, def);
|
|
935
|
+
inst._zod.check = (payload) => {
|
|
936
|
+
payload.value = def.tx(payload.value);
|
|
937
|
+
};
|
|
938
|
+
});
|
|
939
|
+
//#endregion
|
|
940
|
+
//#region node_modules/.pnpm/zod@4.3.6/node_modules/zod/v4/core/doc.js
|
|
941
|
+
var Doc = class {
|
|
942
|
+
constructor(args = []) {
|
|
943
|
+
this.content = [];
|
|
944
|
+
this.indent = 0;
|
|
945
|
+
if (this) this.args = args;
|
|
946
|
+
}
|
|
947
|
+
indented(fn) {
|
|
948
|
+
this.indent += 1;
|
|
949
|
+
fn(this);
|
|
950
|
+
this.indent -= 1;
|
|
951
|
+
}
|
|
952
|
+
write(arg) {
|
|
953
|
+
if (typeof arg === "function") {
|
|
954
|
+
arg(this, { execution: "sync" });
|
|
955
|
+
arg(this, { execution: "async" });
|
|
956
|
+
return;
|
|
957
|
+
}
|
|
958
|
+
const lines = arg.split("\n").filter((x) => x);
|
|
959
|
+
const minIndent = Math.min(...lines.map((x) => x.length - x.trimStart().length));
|
|
960
|
+
const dedented = lines.map((x) => x.slice(minIndent)).map((x) => " ".repeat(this.indent * 2) + x);
|
|
961
|
+
for (const line of dedented) this.content.push(line);
|
|
962
|
+
}
|
|
963
|
+
compile() {
|
|
964
|
+
const F = Function;
|
|
965
|
+
const args = this?.args;
|
|
966
|
+
const lines = [...(this?.content ?? [``]).map((x) => ` ${x}`)];
|
|
967
|
+
return new F(...args, lines.join("\n"));
|
|
968
|
+
}
|
|
969
|
+
};
|
|
970
|
+
//#endregion
|
|
971
|
+
//#region node_modules/.pnpm/zod@4.3.6/node_modules/zod/v4/core/versions.js
|
|
972
|
+
const version = {
|
|
973
|
+
major: 4,
|
|
974
|
+
minor: 3,
|
|
975
|
+
patch: 6
|
|
976
|
+
};
|
|
977
|
+
//#endregion
|
|
978
|
+
//#region node_modules/.pnpm/zod@4.3.6/node_modules/zod/v4/core/schemas.js
|
|
979
|
+
const $ZodType = /* @__PURE__ */ $constructor("$ZodType", (inst, def) => {
|
|
980
|
+
var _a;
|
|
981
|
+
inst ?? (inst = {});
|
|
982
|
+
inst._zod.def = def;
|
|
983
|
+
inst._zod.bag = inst._zod.bag || {};
|
|
984
|
+
inst._zod.version = version;
|
|
985
|
+
const checks = [...inst._zod.def.checks ?? []];
|
|
986
|
+
if (inst._zod.traits.has("$ZodCheck")) checks.unshift(inst);
|
|
987
|
+
for (const ch of checks) for (const fn of ch._zod.onattach) fn(inst);
|
|
988
|
+
if (checks.length === 0) {
|
|
989
|
+
(_a = inst._zod).deferred ?? (_a.deferred = []);
|
|
990
|
+
inst._zod.deferred?.push(() => {
|
|
991
|
+
inst._zod.run = inst._zod.parse;
|
|
992
|
+
});
|
|
993
|
+
} else {
|
|
994
|
+
const runChecks = (payload, checks, ctx) => {
|
|
995
|
+
let isAborted = aborted(payload);
|
|
996
|
+
let asyncResult;
|
|
997
|
+
for (const ch of checks) {
|
|
998
|
+
if (ch._zod.def.when) {
|
|
999
|
+
if (!ch._zod.def.when(payload)) continue;
|
|
1000
|
+
} else if (isAborted) continue;
|
|
1001
|
+
const currLen = payload.issues.length;
|
|
1002
|
+
const _ = ch._zod.check(payload);
|
|
1003
|
+
if (_ instanceof Promise && ctx?.async === false) throw new $ZodAsyncError();
|
|
1004
|
+
if (asyncResult || _ instanceof Promise) asyncResult = (asyncResult ?? Promise.resolve()).then(async () => {
|
|
1005
|
+
await _;
|
|
1006
|
+
if (payload.issues.length === currLen) return;
|
|
1007
|
+
if (!isAborted) isAborted = aborted(payload, currLen);
|
|
1008
|
+
});
|
|
1009
|
+
else {
|
|
1010
|
+
if (payload.issues.length === currLen) continue;
|
|
1011
|
+
if (!isAborted) isAborted = aborted(payload, currLen);
|
|
1012
|
+
}
|
|
1013
|
+
}
|
|
1014
|
+
if (asyncResult) return asyncResult.then(() => {
|
|
1015
|
+
return payload;
|
|
1016
|
+
});
|
|
1017
|
+
return payload;
|
|
1018
|
+
};
|
|
1019
|
+
const handleCanaryResult = (canary, payload, ctx) => {
|
|
1020
|
+
if (aborted(canary)) {
|
|
1021
|
+
canary.aborted = true;
|
|
1022
|
+
return canary;
|
|
1023
|
+
}
|
|
1024
|
+
const checkResult = runChecks(payload, checks, ctx);
|
|
1025
|
+
if (checkResult instanceof Promise) {
|
|
1026
|
+
if (ctx.async === false) throw new $ZodAsyncError();
|
|
1027
|
+
return checkResult.then((checkResult) => inst._zod.parse(checkResult, ctx));
|
|
1028
|
+
}
|
|
1029
|
+
return inst._zod.parse(checkResult, ctx);
|
|
1030
|
+
};
|
|
1031
|
+
inst._zod.run = (payload, ctx) => {
|
|
1032
|
+
if (ctx.skipChecks) return inst._zod.parse(payload, ctx);
|
|
1033
|
+
if (ctx.direction === "backward") {
|
|
1034
|
+
const canary = inst._zod.parse({
|
|
1035
|
+
value: payload.value,
|
|
1036
|
+
issues: []
|
|
1037
|
+
}, {
|
|
1038
|
+
...ctx,
|
|
1039
|
+
skipChecks: true
|
|
1040
|
+
});
|
|
1041
|
+
if (canary instanceof Promise) return canary.then((canary) => {
|
|
1042
|
+
return handleCanaryResult(canary, payload, ctx);
|
|
1043
|
+
});
|
|
1044
|
+
return handleCanaryResult(canary, payload, ctx);
|
|
1045
|
+
}
|
|
1046
|
+
const result = inst._zod.parse(payload, ctx);
|
|
1047
|
+
if (result instanceof Promise) {
|
|
1048
|
+
if (ctx.async === false) throw new $ZodAsyncError();
|
|
1049
|
+
return result.then((result) => runChecks(result, checks, ctx));
|
|
1050
|
+
}
|
|
1051
|
+
return runChecks(result, checks, ctx);
|
|
1052
|
+
};
|
|
1053
|
+
}
|
|
1054
|
+
defineLazy(inst, "~standard", () => ({
|
|
1055
|
+
validate: (value) => {
|
|
1056
|
+
try {
|
|
1057
|
+
const r = safeParse(inst, value);
|
|
1058
|
+
return r.success ? { value: r.data } : { issues: r.error?.issues };
|
|
1059
|
+
} catch (_) {
|
|
1060
|
+
return safeParseAsync(inst, value).then((r) => r.success ? { value: r.data } : { issues: r.error?.issues });
|
|
1061
|
+
}
|
|
1062
|
+
},
|
|
1063
|
+
vendor: "zod",
|
|
1064
|
+
version: 1
|
|
1065
|
+
}));
|
|
1066
|
+
});
|
|
1067
|
+
const $ZodString = /* @__PURE__ */ $constructor("$ZodString", (inst, def) => {
|
|
1068
|
+
$ZodType.init(inst, def);
|
|
1069
|
+
inst._zod.pattern = [...inst?._zod.bag?.patterns ?? []].pop() ?? string(inst._zod.bag);
|
|
1070
|
+
inst._zod.parse = (payload, _) => {
|
|
1071
|
+
if (def.coerce) try {
|
|
1072
|
+
payload.value = String(payload.value);
|
|
1073
|
+
} catch (_) {}
|
|
1074
|
+
if (typeof payload.value === "string") return payload;
|
|
1075
|
+
payload.issues.push({
|
|
1076
|
+
expected: "string",
|
|
1077
|
+
code: "invalid_type",
|
|
1078
|
+
input: payload.value,
|
|
1079
|
+
inst
|
|
1080
|
+
});
|
|
1081
|
+
return payload;
|
|
1082
|
+
};
|
|
1083
|
+
});
|
|
1084
|
+
const $ZodStringFormat = /* @__PURE__ */ $constructor("$ZodStringFormat", (inst, def) => {
|
|
1085
|
+
$ZodCheckStringFormat.init(inst, def);
|
|
1086
|
+
$ZodString.init(inst, def);
|
|
1087
|
+
});
|
|
1088
|
+
const $ZodGUID = /* @__PURE__ */ $constructor("$ZodGUID", (inst, def) => {
|
|
1089
|
+
def.pattern ?? (def.pattern = guid);
|
|
1090
|
+
$ZodStringFormat.init(inst, def);
|
|
1091
|
+
});
|
|
1092
|
+
const $ZodUUID = /* @__PURE__ */ $constructor("$ZodUUID", (inst, def) => {
|
|
1093
|
+
if (def.version) {
|
|
1094
|
+
const v = {
|
|
1095
|
+
v1: 1,
|
|
1096
|
+
v2: 2,
|
|
1097
|
+
v3: 3,
|
|
1098
|
+
v4: 4,
|
|
1099
|
+
v5: 5,
|
|
1100
|
+
v6: 6,
|
|
1101
|
+
v7: 7,
|
|
1102
|
+
v8: 8
|
|
1103
|
+
}[def.version];
|
|
1104
|
+
if (v === void 0) throw new Error(`Invalid UUID version: "${def.version}"`);
|
|
1105
|
+
def.pattern ?? (def.pattern = uuid(v));
|
|
1106
|
+
} else def.pattern ?? (def.pattern = uuid());
|
|
1107
|
+
$ZodStringFormat.init(inst, def);
|
|
1108
|
+
});
|
|
1109
|
+
const $ZodEmail = /* @__PURE__ */ $constructor("$ZodEmail", (inst, def) => {
|
|
1110
|
+
def.pattern ?? (def.pattern = email);
|
|
1111
|
+
$ZodStringFormat.init(inst, def);
|
|
1112
|
+
});
|
|
1113
|
+
const $ZodURL = /* @__PURE__ */ $constructor("$ZodURL", (inst, def) => {
|
|
1114
|
+
$ZodStringFormat.init(inst, def);
|
|
1115
|
+
inst._zod.check = (payload) => {
|
|
1116
|
+
try {
|
|
1117
|
+
const trimmed = payload.value.trim();
|
|
1118
|
+
const url = new URL(trimmed);
|
|
1119
|
+
if (def.hostname) {
|
|
1120
|
+
def.hostname.lastIndex = 0;
|
|
1121
|
+
if (!def.hostname.test(url.hostname)) payload.issues.push({
|
|
1122
|
+
code: "invalid_format",
|
|
1123
|
+
format: "url",
|
|
1124
|
+
note: "Invalid hostname",
|
|
1125
|
+
pattern: def.hostname.source,
|
|
1126
|
+
input: payload.value,
|
|
1127
|
+
inst,
|
|
1128
|
+
continue: !def.abort
|
|
1129
|
+
});
|
|
1130
|
+
}
|
|
1131
|
+
if (def.protocol) {
|
|
1132
|
+
def.protocol.lastIndex = 0;
|
|
1133
|
+
if (!def.protocol.test(url.protocol.endsWith(":") ? url.protocol.slice(0, -1) : url.protocol)) payload.issues.push({
|
|
1134
|
+
code: "invalid_format",
|
|
1135
|
+
format: "url",
|
|
1136
|
+
note: "Invalid protocol",
|
|
1137
|
+
pattern: def.protocol.source,
|
|
1138
|
+
input: payload.value,
|
|
1139
|
+
inst,
|
|
1140
|
+
continue: !def.abort
|
|
1141
|
+
});
|
|
1142
|
+
}
|
|
1143
|
+
if (def.normalize) payload.value = url.href;
|
|
1144
|
+
else payload.value = trimmed;
|
|
1145
|
+
return;
|
|
1146
|
+
} catch (_) {
|
|
1147
|
+
payload.issues.push({
|
|
1148
|
+
code: "invalid_format",
|
|
1149
|
+
format: "url",
|
|
1150
|
+
input: payload.value,
|
|
1151
|
+
inst,
|
|
1152
|
+
continue: !def.abort
|
|
1153
|
+
});
|
|
1154
|
+
}
|
|
1155
|
+
};
|
|
1156
|
+
});
|
|
1157
|
+
const $ZodEmoji = /* @__PURE__ */ $constructor("$ZodEmoji", (inst, def) => {
|
|
1158
|
+
def.pattern ?? (def.pattern = emoji());
|
|
1159
|
+
$ZodStringFormat.init(inst, def);
|
|
1160
|
+
});
|
|
1161
|
+
const $ZodNanoID = /* @__PURE__ */ $constructor("$ZodNanoID", (inst, def) => {
|
|
1162
|
+
def.pattern ?? (def.pattern = nanoid);
|
|
1163
|
+
$ZodStringFormat.init(inst, def);
|
|
1164
|
+
});
|
|
1165
|
+
const $ZodCUID = /* @__PURE__ */ $constructor("$ZodCUID", (inst, def) => {
|
|
1166
|
+
def.pattern ?? (def.pattern = cuid);
|
|
1167
|
+
$ZodStringFormat.init(inst, def);
|
|
1168
|
+
});
|
|
1169
|
+
const $ZodCUID2 = /* @__PURE__ */ $constructor("$ZodCUID2", (inst, def) => {
|
|
1170
|
+
def.pattern ?? (def.pattern = cuid2);
|
|
1171
|
+
$ZodStringFormat.init(inst, def);
|
|
1172
|
+
});
|
|
1173
|
+
const $ZodULID = /* @__PURE__ */ $constructor("$ZodULID", (inst, def) => {
|
|
1174
|
+
def.pattern ?? (def.pattern = ulid);
|
|
1175
|
+
$ZodStringFormat.init(inst, def);
|
|
1176
|
+
});
|
|
1177
|
+
const $ZodXID = /* @__PURE__ */ $constructor("$ZodXID", (inst, def) => {
|
|
1178
|
+
def.pattern ?? (def.pattern = xid);
|
|
1179
|
+
$ZodStringFormat.init(inst, def);
|
|
1180
|
+
});
|
|
1181
|
+
const $ZodKSUID = /* @__PURE__ */ $constructor("$ZodKSUID", (inst, def) => {
|
|
1182
|
+
def.pattern ?? (def.pattern = ksuid);
|
|
1183
|
+
$ZodStringFormat.init(inst, def);
|
|
1184
|
+
});
|
|
1185
|
+
const $ZodISODateTime = /* @__PURE__ */ $constructor("$ZodISODateTime", (inst, def) => {
|
|
1186
|
+
def.pattern ?? (def.pattern = datetime(def));
|
|
1187
|
+
$ZodStringFormat.init(inst, def);
|
|
1188
|
+
});
|
|
1189
|
+
const $ZodISODate = /* @__PURE__ */ $constructor("$ZodISODate", (inst, def) => {
|
|
1190
|
+
def.pattern ?? (def.pattern = date);
|
|
1191
|
+
$ZodStringFormat.init(inst, def);
|
|
1192
|
+
});
|
|
1193
|
+
const $ZodISOTime = /* @__PURE__ */ $constructor("$ZodISOTime", (inst, def) => {
|
|
1194
|
+
def.pattern ?? (def.pattern = time(def));
|
|
1195
|
+
$ZodStringFormat.init(inst, def);
|
|
1196
|
+
});
|
|
1197
|
+
const $ZodISODuration = /* @__PURE__ */ $constructor("$ZodISODuration", (inst, def) => {
|
|
1198
|
+
def.pattern ?? (def.pattern = duration);
|
|
1199
|
+
$ZodStringFormat.init(inst, def);
|
|
1200
|
+
});
|
|
1201
|
+
const $ZodIPv4 = /* @__PURE__ */ $constructor("$ZodIPv4", (inst, def) => {
|
|
1202
|
+
def.pattern ?? (def.pattern = ipv4);
|
|
1203
|
+
$ZodStringFormat.init(inst, def);
|
|
1204
|
+
inst._zod.bag.format = `ipv4`;
|
|
1205
|
+
});
|
|
1206
|
+
const $ZodIPv6 = /* @__PURE__ */ $constructor("$ZodIPv6", (inst, def) => {
|
|
1207
|
+
def.pattern ?? (def.pattern = ipv6);
|
|
1208
|
+
$ZodStringFormat.init(inst, def);
|
|
1209
|
+
inst._zod.bag.format = `ipv6`;
|
|
1210
|
+
inst._zod.check = (payload) => {
|
|
1211
|
+
try {
|
|
1212
|
+
new URL(`http://[${payload.value}]`);
|
|
1213
|
+
} catch {
|
|
1214
|
+
payload.issues.push({
|
|
1215
|
+
code: "invalid_format",
|
|
1216
|
+
format: "ipv6",
|
|
1217
|
+
input: payload.value,
|
|
1218
|
+
inst,
|
|
1219
|
+
continue: !def.abort
|
|
1220
|
+
});
|
|
1221
|
+
}
|
|
1222
|
+
};
|
|
1223
|
+
});
|
|
1224
|
+
const $ZodCIDRv4 = /* @__PURE__ */ $constructor("$ZodCIDRv4", (inst, def) => {
|
|
1225
|
+
def.pattern ?? (def.pattern = cidrv4);
|
|
1226
|
+
$ZodStringFormat.init(inst, def);
|
|
1227
|
+
});
|
|
1228
|
+
const $ZodCIDRv6 = /* @__PURE__ */ $constructor("$ZodCIDRv6", (inst, def) => {
|
|
1229
|
+
def.pattern ?? (def.pattern = cidrv6);
|
|
1230
|
+
$ZodStringFormat.init(inst, def);
|
|
1231
|
+
inst._zod.check = (payload) => {
|
|
1232
|
+
const parts = payload.value.split("/");
|
|
1233
|
+
try {
|
|
1234
|
+
if (parts.length !== 2) throw new Error();
|
|
1235
|
+
const [address, prefix] = parts;
|
|
1236
|
+
if (!prefix) throw new Error();
|
|
1237
|
+
const prefixNum = Number(prefix);
|
|
1238
|
+
if (`${prefixNum}` !== prefix) throw new Error();
|
|
1239
|
+
if (prefixNum < 0 || prefixNum > 128) throw new Error();
|
|
1240
|
+
new URL(`http://[${address}]`);
|
|
1241
|
+
} catch {
|
|
1242
|
+
payload.issues.push({
|
|
1243
|
+
code: "invalid_format",
|
|
1244
|
+
format: "cidrv6",
|
|
1245
|
+
input: payload.value,
|
|
1246
|
+
inst,
|
|
1247
|
+
continue: !def.abort
|
|
1248
|
+
});
|
|
1249
|
+
}
|
|
1250
|
+
};
|
|
1251
|
+
});
|
|
1252
|
+
function isValidBase64(data) {
|
|
1253
|
+
if (data === "") return true;
|
|
1254
|
+
if (data.length % 4 !== 0) return false;
|
|
1255
|
+
try {
|
|
1256
|
+
atob(data);
|
|
1257
|
+
return true;
|
|
1258
|
+
} catch {
|
|
1259
|
+
return false;
|
|
1260
|
+
}
|
|
1261
|
+
}
|
|
1262
|
+
const $ZodBase64 = /* @__PURE__ */ $constructor("$ZodBase64", (inst, def) => {
|
|
1263
|
+
def.pattern ?? (def.pattern = base64);
|
|
1264
|
+
$ZodStringFormat.init(inst, def);
|
|
1265
|
+
inst._zod.bag.contentEncoding = "base64";
|
|
1266
|
+
inst._zod.check = (payload) => {
|
|
1267
|
+
if (isValidBase64(payload.value)) return;
|
|
1268
|
+
payload.issues.push({
|
|
1269
|
+
code: "invalid_format",
|
|
1270
|
+
format: "base64",
|
|
1271
|
+
input: payload.value,
|
|
1272
|
+
inst,
|
|
1273
|
+
continue: !def.abort
|
|
1274
|
+
});
|
|
1275
|
+
};
|
|
1276
|
+
});
|
|
1277
|
+
function isValidBase64URL(data) {
|
|
1278
|
+
if (!base64url.test(data)) return false;
|
|
1279
|
+
const base64 = data.replace(/[-_]/g, (c) => c === "-" ? "+" : "/");
|
|
1280
|
+
return isValidBase64(base64.padEnd(Math.ceil(base64.length / 4) * 4, "="));
|
|
1281
|
+
}
|
|
1282
|
+
const $ZodBase64URL = /* @__PURE__ */ $constructor("$ZodBase64URL", (inst, def) => {
|
|
1283
|
+
def.pattern ?? (def.pattern = base64url);
|
|
1284
|
+
$ZodStringFormat.init(inst, def);
|
|
1285
|
+
inst._zod.bag.contentEncoding = "base64url";
|
|
1286
|
+
inst._zod.check = (payload) => {
|
|
1287
|
+
if (isValidBase64URL(payload.value)) return;
|
|
1288
|
+
payload.issues.push({
|
|
1289
|
+
code: "invalid_format",
|
|
1290
|
+
format: "base64url",
|
|
1291
|
+
input: payload.value,
|
|
1292
|
+
inst,
|
|
1293
|
+
continue: !def.abort
|
|
1294
|
+
});
|
|
1295
|
+
};
|
|
1296
|
+
});
|
|
1297
|
+
const $ZodE164 = /* @__PURE__ */ $constructor("$ZodE164", (inst, def) => {
|
|
1298
|
+
def.pattern ?? (def.pattern = e164);
|
|
1299
|
+
$ZodStringFormat.init(inst, def);
|
|
1300
|
+
});
|
|
1301
|
+
function isValidJWT(token, algorithm = null) {
|
|
1302
|
+
try {
|
|
1303
|
+
const tokensParts = token.split(".");
|
|
1304
|
+
if (tokensParts.length !== 3) return false;
|
|
1305
|
+
const [header] = tokensParts;
|
|
1306
|
+
if (!header) return false;
|
|
1307
|
+
const parsedHeader = JSON.parse(atob(header));
|
|
1308
|
+
if ("typ" in parsedHeader && parsedHeader?.typ !== "JWT") return false;
|
|
1309
|
+
if (!parsedHeader.alg) return false;
|
|
1310
|
+
if (algorithm && (!("alg" in parsedHeader) || parsedHeader.alg !== algorithm)) return false;
|
|
1311
|
+
return true;
|
|
1312
|
+
} catch {
|
|
1313
|
+
return false;
|
|
1314
|
+
}
|
|
1315
|
+
}
|
|
1316
|
+
const $ZodJWT = /* @__PURE__ */ $constructor("$ZodJWT", (inst, def) => {
|
|
1317
|
+
$ZodStringFormat.init(inst, def);
|
|
1318
|
+
inst._zod.check = (payload) => {
|
|
1319
|
+
if (isValidJWT(payload.value, def.alg)) return;
|
|
1320
|
+
payload.issues.push({
|
|
1321
|
+
code: "invalid_format",
|
|
1322
|
+
format: "jwt",
|
|
1323
|
+
input: payload.value,
|
|
1324
|
+
inst,
|
|
1325
|
+
continue: !def.abort
|
|
1326
|
+
});
|
|
1327
|
+
};
|
|
1328
|
+
});
|
|
1329
|
+
const $ZodNumber = /* @__PURE__ */ $constructor("$ZodNumber", (inst, def) => {
|
|
1330
|
+
$ZodType.init(inst, def);
|
|
1331
|
+
inst._zod.pattern = inst._zod.bag.pattern ?? number;
|
|
1332
|
+
inst._zod.parse = (payload, _ctx) => {
|
|
1333
|
+
if (def.coerce) try {
|
|
1334
|
+
payload.value = Number(payload.value);
|
|
1335
|
+
} catch (_) {}
|
|
1336
|
+
const input = payload.value;
|
|
1337
|
+
if (typeof input === "number" && !Number.isNaN(input) && Number.isFinite(input)) return payload;
|
|
1338
|
+
const received = typeof input === "number" ? Number.isNaN(input) ? "NaN" : !Number.isFinite(input) ? "Infinity" : void 0 : void 0;
|
|
1339
|
+
payload.issues.push({
|
|
1340
|
+
expected: "number",
|
|
1341
|
+
code: "invalid_type",
|
|
1342
|
+
input,
|
|
1343
|
+
inst,
|
|
1344
|
+
...received ? { received } : {}
|
|
1345
|
+
});
|
|
1346
|
+
return payload;
|
|
1347
|
+
};
|
|
1348
|
+
});
|
|
1349
|
+
const $ZodNumberFormat = /* @__PURE__ */ $constructor("$ZodNumberFormat", (inst, def) => {
|
|
1350
|
+
$ZodCheckNumberFormat.init(inst, def);
|
|
1351
|
+
$ZodNumber.init(inst, def);
|
|
1352
|
+
});
|
|
1353
|
+
const $ZodBoolean = /* @__PURE__ */ $constructor("$ZodBoolean", (inst, def) => {
|
|
1354
|
+
$ZodType.init(inst, def);
|
|
1355
|
+
inst._zod.pattern = boolean;
|
|
1356
|
+
inst._zod.parse = (payload, _ctx) => {
|
|
1357
|
+
if (def.coerce) try {
|
|
1358
|
+
payload.value = Boolean(payload.value);
|
|
1359
|
+
} catch (_) {}
|
|
1360
|
+
const input = payload.value;
|
|
1361
|
+
if (typeof input === "boolean") return payload;
|
|
1362
|
+
payload.issues.push({
|
|
1363
|
+
expected: "boolean",
|
|
1364
|
+
code: "invalid_type",
|
|
1365
|
+
input,
|
|
1366
|
+
inst
|
|
1367
|
+
});
|
|
1368
|
+
return payload;
|
|
1369
|
+
};
|
|
1370
|
+
});
|
|
1371
|
+
const $ZodNull = /* @__PURE__ */ $constructor("$ZodNull", (inst, def) => {
|
|
1372
|
+
$ZodType.init(inst, def);
|
|
1373
|
+
inst._zod.pattern = _null$1;
|
|
1374
|
+
inst._zod.values = new Set([null]);
|
|
1375
|
+
inst._zod.parse = (payload, _ctx) => {
|
|
1376
|
+
const input = payload.value;
|
|
1377
|
+
if (input === null) return payload;
|
|
1378
|
+
payload.issues.push({
|
|
1379
|
+
expected: "null",
|
|
1380
|
+
code: "invalid_type",
|
|
1381
|
+
input,
|
|
1382
|
+
inst
|
|
1383
|
+
});
|
|
1384
|
+
return payload;
|
|
1385
|
+
};
|
|
1386
|
+
});
|
|
1387
|
+
const $ZodAny = /* @__PURE__ */ $constructor("$ZodAny", (inst, def) => {
|
|
1388
|
+
$ZodType.init(inst, def);
|
|
1389
|
+
inst._zod.parse = (payload) => payload;
|
|
1390
|
+
});
|
|
1391
|
+
const $ZodUnknown = /* @__PURE__ */ $constructor("$ZodUnknown", (inst, def) => {
|
|
1392
|
+
$ZodType.init(inst, def);
|
|
1393
|
+
inst._zod.parse = (payload) => payload;
|
|
1394
|
+
});
|
|
1395
|
+
const $ZodNever = /* @__PURE__ */ $constructor("$ZodNever", (inst, def) => {
|
|
1396
|
+
$ZodType.init(inst, def);
|
|
1397
|
+
inst._zod.parse = (payload, _ctx) => {
|
|
1398
|
+
payload.issues.push({
|
|
1399
|
+
expected: "never",
|
|
1400
|
+
code: "invalid_type",
|
|
1401
|
+
input: payload.value,
|
|
1402
|
+
inst
|
|
1403
|
+
});
|
|
1404
|
+
return payload;
|
|
1405
|
+
};
|
|
1406
|
+
});
|
|
1407
|
+
function handleArrayResult(result, final, index) {
|
|
1408
|
+
if (result.issues.length) final.issues.push(...prefixIssues(index, result.issues));
|
|
1409
|
+
final.value[index] = result.value;
|
|
1410
|
+
}
|
|
1411
|
+
const $ZodArray = /* @__PURE__ */ $constructor("$ZodArray", (inst, def) => {
|
|
1412
|
+
$ZodType.init(inst, def);
|
|
1413
|
+
inst._zod.parse = (payload, ctx) => {
|
|
1414
|
+
const input = payload.value;
|
|
1415
|
+
if (!Array.isArray(input)) {
|
|
1416
|
+
payload.issues.push({
|
|
1417
|
+
expected: "array",
|
|
1418
|
+
code: "invalid_type",
|
|
1419
|
+
input,
|
|
1420
|
+
inst
|
|
1421
|
+
});
|
|
1422
|
+
return payload;
|
|
1423
|
+
}
|
|
1424
|
+
payload.value = Array(input.length);
|
|
1425
|
+
const proms = [];
|
|
1426
|
+
for (let i = 0; i < input.length; i++) {
|
|
1427
|
+
const item = input[i];
|
|
1428
|
+
const result = def.element._zod.run({
|
|
1429
|
+
value: item,
|
|
1430
|
+
issues: []
|
|
1431
|
+
}, ctx);
|
|
1432
|
+
if (result instanceof Promise) proms.push(result.then((result) => handleArrayResult(result, payload, i)));
|
|
1433
|
+
else handleArrayResult(result, payload, i);
|
|
1434
|
+
}
|
|
1435
|
+
if (proms.length) return Promise.all(proms).then(() => payload);
|
|
1436
|
+
return payload;
|
|
1437
|
+
};
|
|
1438
|
+
});
|
|
1439
|
+
function handlePropertyResult(result, final, key, input, isOptionalOut) {
|
|
1440
|
+
if (result.issues.length) {
|
|
1441
|
+
if (isOptionalOut && !(key in input)) return;
|
|
1442
|
+
final.issues.push(...prefixIssues(key, result.issues));
|
|
1443
|
+
}
|
|
1444
|
+
if (result.value === void 0) {
|
|
1445
|
+
if (key in input) final.value[key] = void 0;
|
|
1446
|
+
} else final.value[key] = result.value;
|
|
1447
|
+
}
|
|
1448
|
+
function normalizeDef(def) {
|
|
1449
|
+
const keys = Object.keys(def.shape);
|
|
1450
|
+
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`);
|
|
1451
|
+
const okeys = optionalKeys(def.shape);
|
|
1452
|
+
return {
|
|
1453
|
+
...def,
|
|
1454
|
+
keys,
|
|
1455
|
+
keySet: new Set(keys),
|
|
1456
|
+
numKeys: keys.length,
|
|
1457
|
+
optionalKeys: new Set(okeys)
|
|
1458
|
+
};
|
|
1459
|
+
}
|
|
1460
|
+
function handleCatchall(proms, input, payload, ctx, def, inst) {
|
|
1461
|
+
const unrecognized = [];
|
|
1462
|
+
const keySet = def.keySet;
|
|
1463
|
+
const _catchall = def.catchall._zod;
|
|
1464
|
+
const t = _catchall.def.type;
|
|
1465
|
+
const isOptionalOut = _catchall.optout === "optional";
|
|
1466
|
+
for (const key in input) {
|
|
1467
|
+
if (keySet.has(key)) continue;
|
|
1468
|
+
if (t === "never") {
|
|
1469
|
+
unrecognized.push(key);
|
|
1470
|
+
continue;
|
|
1471
|
+
}
|
|
1472
|
+
const r = _catchall.run({
|
|
1473
|
+
value: input[key],
|
|
1474
|
+
issues: []
|
|
1475
|
+
}, ctx);
|
|
1476
|
+
if (r instanceof Promise) proms.push(r.then((r) => handlePropertyResult(r, payload, key, input, isOptionalOut)));
|
|
1477
|
+
else handlePropertyResult(r, payload, key, input, isOptionalOut);
|
|
1478
|
+
}
|
|
1479
|
+
if (unrecognized.length) payload.issues.push({
|
|
1480
|
+
code: "unrecognized_keys",
|
|
1481
|
+
keys: unrecognized,
|
|
1482
|
+
input,
|
|
1483
|
+
inst
|
|
1484
|
+
});
|
|
1485
|
+
if (!proms.length) return payload;
|
|
1486
|
+
return Promise.all(proms).then(() => {
|
|
1487
|
+
return payload;
|
|
1488
|
+
});
|
|
1489
|
+
}
|
|
1490
|
+
const $ZodObject = /* @__PURE__ */ $constructor("$ZodObject", (inst, def) => {
|
|
1491
|
+
$ZodType.init(inst, def);
|
|
1492
|
+
if (!Object.getOwnPropertyDescriptor(def, "shape")?.get) {
|
|
1493
|
+
const sh = def.shape;
|
|
1494
|
+
Object.defineProperty(def, "shape", { get: () => {
|
|
1495
|
+
const newSh = { ...sh };
|
|
1496
|
+
Object.defineProperty(def, "shape", { value: newSh });
|
|
1497
|
+
return newSh;
|
|
1498
|
+
} });
|
|
1499
|
+
}
|
|
1500
|
+
const _normalized = cached(() => normalizeDef(def));
|
|
1501
|
+
defineLazy(inst._zod, "propValues", () => {
|
|
1502
|
+
const shape = def.shape;
|
|
1503
|
+
const propValues = {};
|
|
1504
|
+
for (const key in shape) {
|
|
1505
|
+
const field = shape[key]._zod;
|
|
1506
|
+
if (field.values) {
|
|
1507
|
+
propValues[key] ?? (propValues[key] = /* @__PURE__ */ new Set());
|
|
1508
|
+
for (const v of field.values) propValues[key].add(v);
|
|
1509
|
+
}
|
|
1510
|
+
}
|
|
1511
|
+
return propValues;
|
|
1512
|
+
});
|
|
1513
|
+
const isObject$2 = isObject;
|
|
1514
|
+
const catchall = def.catchall;
|
|
1515
|
+
let value;
|
|
1516
|
+
inst._zod.parse = (payload, ctx) => {
|
|
1517
|
+
value ?? (value = _normalized.value);
|
|
1518
|
+
const input = payload.value;
|
|
1519
|
+
if (!isObject$2(input)) {
|
|
1520
|
+
payload.issues.push({
|
|
1521
|
+
expected: "object",
|
|
1522
|
+
code: "invalid_type",
|
|
1523
|
+
input,
|
|
1524
|
+
inst
|
|
1525
|
+
});
|
|
1526
|
+
return payload;
|
|
1527
|
+
}
|
|
1528
|
+
payload.value = {};
|
|
1529
|
+
const proms = [];
|
|
1530
|
+
const shape = value.shape;
|
|
1531
|
+
for (const key of value.keys) {
|
|
1532
|
+
const el = shape[key];
|
|
1533
|
+
const isOptionalOut = el._zod.optout === "optional";
|
|
1534
|
+
const r = el._zod.run({
|
|
1535
|
+
value: input[key],
|
|
1536
|
+
issues: []
|
|
1537
|
+
}, ctx);
|
|
1538
|
+
if (r instanceof Promise) proms.push(r.then((r) => handlePropertyResult(r, payload, key, input, isOptionalOut)));
|
|
1539
|
+
else handlePropertyResult(r, payload, key, input, isOptionalOut);
|
|
1540
|
+
}
|
|
1541
|
+
if (!catchall) return proms.length ? Promise.all(proms).then(() => payload) : payload;
|
|
1542
|
+
return handleCatchall(proms, input, payload, ctx, _normalized.value, inst);
|
|
1543
|
+
};
|
|
1544
|
+
});
|
|
1545
|
+
const $ZodObjectJIT = /* @__PURE__ */ $constructor("$ZodObjectJIT", (inst, def) => {
|
|
1546
|
+
$ZodObject.init(inst, def);
|
|
1547
|
+
const superParse = inst._zod.parse;
|
|
1548
|
+
const _normalized = cached(() => normalizeDef(def));
|
|
1549
|
+
const generateFastpass = (shape) => {
|
|
1550
|
+
const doc = new Doc([
|
|
1551
|
+
"shape",
|
|
1552
|
+
"payload",
|
|
1553
|
+
"ctx"
|
|
1554
|
+
]);
|
|
1555
|
+
const normalized = _normalized.value;
|
|
1556
|
+
const parseStr = (key) => {
|
|
1557
|
+
const k = esc(key);
|
|
1558
|
+
return `shape[${k}]._zod.run({ value: input[${k}], issues: [] }, ctx)`;
|
|
1559
|
+
};
|
|
1560
|
+
doc.write(`const input = payload.value;`);
|
|
1561
|
+
const ids = Object.create(null);
|
|
1562
|
+
let counter = 0;
|
|
1563
|
+
for (const key of normalized.keys) ids[key] = `key_${counter++}`;
|
|
1564
|
+
doc.write(`const newResult = {};`);
|
|
1565
|
+
for (const key of normalized.keys) {
|
|
1566
|
+
const id = ids[key];
|
|
1567
|
+
const k = esc(key);
|
|
1568
|
+
const isOptionalOut = shape[key]?._zod?.optout === "optional";
|
|
1569
|
+
doc.write(`const ${id} = ${parseStr(key)};`);
|
|
1570
|
+
if (isOptionalOut) doc.write(`
|
|
1571
|
+
if (${id}.issues.length) {
|
|
1572
|
+
if (${k} in input) {
|
|
1573
|
+
payload.issues = payload.issues.concat(${id}.issues.map(iss => ({
|
|
1574
|
+
...iss,
|
|
1575
|
+
path: iss.path ? [${k}, ...iss.path] : [${k}]
|
|
1576
|
+
})));
|
|
1577
|
+
}
|
|
1578
|
+
}
|
|
1579
|
+
|
|
1580
|
+
if (${id}.value === undefined) {
|
|
1581
|
+
if (${k} in input) {
|
|
1582
|
+
newResult[${k}] = undefined;
|
|
1583
|
+
}
|
|
1584
|
+
} else {
|
|
1585
|
+
newResult[${k}] = ${id}.value;
|
|
1586
|
+
}
|
|
1587
|
+
|
|
1588
|
+
`);
|
|
1589
|
+
else doc.write(`
|
|
1590
|
+
if (${id}.issues.length) {
|
|
1591
|
+
payload.issues = payload.issues.concat(${id}.issues.map(iss => ({
|
|
1592
|
+
...iss,
|
|
1593
|
+
path: iss.path ? [${k}, ...iss.path] : [${k}]
|
|
1594
|
+
})));
|
|
1595
|
+
}
|
|
1596
|
+
|
|
1597
|
+
if (${id}.value === undefined) {
|
|
1598
|
+
if (${k} in input) {
|
|
1599
|
+
newResult[${k}] = undefined;
|
|
1600
|
+
}
|
|
1601
|
+
} else {
|
|
1602
|
+
newResult[${k}] = ${id}.value;
|
|
1603
|
+
}
|
|
1604
|
+
|
|
1605
|
+
`);
|
|
1606
|
+
}
|
|
1607
|
+
doc.write(`payload.value = newResult;`);
|
|
1608
|
+
doc.write(`return payload;`);
|
|
1609
|
+
const fn = doc.compile();
|
|
1610
|
+
return (payload, ctx) => fn(shape, payload, ctx);
|
|
1611
|
+
};
|
|
1612
|
+
let fastpass;
|
|
1613
|
+
const isObject$1 = isObject;
|
|
1614
|
+
const jit = !globalConfig.jitless;
|
|
1615
|
+
const fastEnabled = jit && allowsEval.value;
|
|
1616
|
+
const catchall = def.catchall;
|
|
1617
|
+
let value;
|
|
1618
|
+
inst._zod.parse = (payload, ctx) => {
|
|
1619
|
+
value ?? (value = _normalized.value);
|
|
1620
|
+
const input = payload.value;
|
|
1621
|
+
if (!isObject$1(input)) {
|
|
1622
|
+
payload.issues.push({
|
|
1623
|
+
expected: "object",
|
|
1624
|
+
code: "invalid_type",
|
|
1625
|
+
input,
|
|
1626
|
+
inst
|
|
1627
|
+
});
|
|
1628
|
+
return payload;
|
|
1629
|
+
}
|
|
1630
|
+
if (jit && fastEnabled && ctx?.async === false && ctx.jitless !== true) {
|
|
1631
|
+
if (!fastpass) fastpass = generateFastpass(def.shape);
|
|
1632
|
+
payload = fastpass(payload, ctx);
|
|
1633
|
+
if (!catchall) return payload;
|
|
1634
|
+
return handleCatchall([], input, payload, ctx, value, inst);
|
|
1635
|
+
}
|
|
1636
|
+
return superParse(payload, ctx);
|
|
1637
|
+
};
|
|
1638
|
+
});
|
|
1639
|
+
function handleUnionResults(results, final, inst, ctx) {
|
|
1640
|
+
for (const result of results) if (result.issues.length === 0) {
|
|
1641
|
+
final.value = result.value;
|
|
1642
|
+
return final;
|
|
1643
|
+
}
|
|
1644
|
+
const nonaborted = results.filter((r) => !aborted(r));
|
|
1645
|
+
if (nonaborted.length === 1) {
|
|
1646
|
+
final.value = nonaborted[0].value;
|
|
1647
|
+
return nonaborted[0];
|
|
1648
|
+
}
|
|
1649
|
+
final.issues.push({
|
|
1650
|
+
code: "invalid_union",
|
|
1651
|
+
input: final.value,
|
|
1652
|
+
inst,
|
|
1653
|
+
errors: results.map((result) => result.issues.map((iss) => finalizeIssue(iss, ctx, config())))
|
|
1654
|
+
});
|
|
1655
|
+
return final;
|
|
1656
|
+
}
|
|
1657
|
+
const $ZodUnion = /* @__PURE__ */ $constructor("$ZodUnion", (inst, def) => {
|
|
1658
|
+
$ZodType.init(inst, def);
|
|
1659
|
+
defineLazy(inst._zod, "optin", () => def.options.some((o) => o._zod.optin === "optional") ? "optional" : void 0);
|
|
1660
|
+
defineLazy(inst._zod, "optout", () => def.options.some((o) => o._zod.optout === "optional") ? "optional" : void 0);
|
|
1661
|
+
defineLazy(inst._zod, "values", () => {
|
|
1662
|
+
if (def.options.every((o) => o._zod.values)) return new Set(def.options.flatMap((option) => Array.from(option._zod.values)));
|
|
1663
|
+
});
|
|
1664
|
+
defineLazy(inst._zod, "pattern", () => {
|
|
1665
|
+
if (def.options.every((o) => o._zod.pattern)) {
|
|
1666
|
+
const patterns = def.options.map((o) => o._zod.pattern);
|
|
1667
|
+
return new RegExp(`^(${patterns.map((p) => cleanRegex(p.source)).join("|")})$`);
|
|
1668
|
+
}
|
|
1669
|
+
});
|
|
1670
|
+
const single = def.options.length === 1;
|
|
1671
|
+
const first = def.options[0]._zod.run;
|
|
1672
|
+
inst._zod.parse = (payload, ctx) => {
|
|
1673
|
+
if (single) return first(payload, ctx);
|
|
1674
|
+
let async = false;
|
|
1675
|
+
const results = [];
|
|
1676
|
+
for (const option of def.options) {
|
|
1677
|
+
const result = option._zod.run({
|
|
1678
|
+
value: payload.value,
|
|
1679
|
+
issues: []
|
|
1680
|
+
}, ctx);
|
|
1681
|
+
if (result instanceof Promise) {
|
|
1682
|
+
results.push(result);
|
|
1683
|
+
async = true;
|
|
1684
|
+
} else {
|
|
1685
|
+
if (result.issues.length === 0) return result;
|
|
1686
|
+
results.push(result);
|
|
1687
|
+
}
|
|
1688
|
+
}
|
|
1689
|
+
if (!async) return handleUnionResults(results, payload, inst, ctx);
|
|
1690
|
+
return Promise.all(results).then((results) => {
|
|
1691
|
+
return handleUnionResults(results, payload, inst, ctx);
|
|
1692
|
+
});
|
|
1693
|
+
};
|
|
1694
|
+
});
|
|
1695
|
+
const $ZodDiscriminatedUnion = /* @__PURE__ */ $constructor("$ZodDiscriminatedUnion", (inst, def) => {
|
|
1696
|
+
def.inclusive = false;
|
|
1697
|
+
$ZodUnion.init(inst, def);
|
|
1698
|
+
const _super = inst._zod.parse;
|
|
1699
|
+
defineLazy(inst._zod, "propValues", () => {
|
|
1700
|
+
const propValues = {};
|
|
1701
|
+
for (const option of def.options) {
|
|
1702
|
+
const pv = option._zod.propValues;
|
|
1703
|
+
if (!pv || Object.keys(pv).length === 0) throw new Error(`Invalid discriminated union option at index "${def.options.indexOf(option)}"`);
|
|
1704
|
+
for (const [k, v] of Object.entries(pv)) {
|
|
1705
|
+
if (!propValues[k]) propValues[k] = /* @__PURE__ */ new Set();
|
|
1706
|
+
for (const val of v) propValues[k].add(val);
|
|
1707
|
+
}
|
|
1708
|
+
}
|
|
1709
|
+
return propValues;
|
|
1710
|
+
});
|
|
1711
|
+
const disc = cached(() => {
|
|
1712
|
+
const opts = def.options;
|
|
1713
|
+
const map = /* @__PURE__ */ new Map();
|
|
1714
|
+
for (const o of opts) {
|
|
1715
|
+
const values = o._zod.propValues?.[def.discriminator];
|
|
1716
|
+
if (!values || values.size === 0) throw new Error(`Invalid discriminated union option at index "${def.options.indexOf(o)}"`);
|
|
1717
|
+
for (const v of values) {
|
|
1718
|
+
if (map.has(v)) throw new Error(`Duplicate discriminator value "${String(v)}"`);
|
|
1719
|
+
map.set(v, o);
|
|
1720
|
+
}
|
|
1721
|
+
}
|
|
1722
|
+
return map;
|
|
1723
|
+
});
|
|
1724
|
+
inst._zod.parse = (payload, ctx) => {
|
|
1725
|
+
const input = payload.value;
|
|
1726
|
+
if (!isObject(input)) {
|
|
1727
|
+
payload.issues.push({
|
|
1728
|
+
code: "invalid_type",
|
|
1729
|
+
expected: "object",
|
|
1730
|
+
input,
|
|
1731
|
+
inst
|
|
1732
|
+
});
|
|
1733
|
+
return payload;
|
|
1734
|
+
}
|
|
1735
|
+
const opt = disc.value.get(input?.[def.discriminator]);
|
|
1736
|
+
if (opt) return opt._zod.run(payload, ctx);
|
|
1737
|
+
if (def.unionFallback) return _super(payload, ctx);
|
|
1738
|
+
payload.issues.push({
|
|
1739
|
+
code: "invalid_union",
|
|
1740
|
+
errors: [],
|
|
1741
|
+
note: "No matching discriminator",
|
|
1742
|
+
discriminator: def.discriminator,
|
|
1743
|
+
input,
|
|
1744
|
+
path: [def.discriminator],
|
|
1745
|
+
inst
|
|
1746
|
+
});
|
|
1747
|
+
return payload;
|
|
1748
|
+
};
|
|
1749
|
+
});
|
|
1750
|
+
const $ZodIntersection = /* @__PURE__ */ $constructor("$ZodIntersection", (inst, def) => {
|
|
1751
|
+
$ZodType.init(inst, def);
|
|
1752
|
+
inst._zod.parse = (payload, ctx) => {
|
|
1753
|
+
const input = payload.value;
|
|
1754
|
+
const left = def.left._zod.run({
|
|
1755
|
+
value: input,
|
|
1756
|
+
issues: []
|
|
1757
|
+
}, ctx);
|
|
1758
|
+
const right = def.right._zod.run({
|
|
1759
|
+
value: input,
|
|
1760
|
+
issues: []
|
|
1761
|
+
}, ctx);
|
|
1762
|
+
if (left instanceof Promise || right instanceof Promise) return Promise.all([left, right]).then(([left, right]) => {
|
|
1763
|
+
return handleIntersectionResults(payload, left, right);
|
|
1764
|
+
});
|
|
1765
|
+
return handleIntersectionResults(payload, left, right);
|
|
1766
|
+
};
|
|
1767
|
+
});
|
|
1768
|
+
function mergeValues(a, b) {
|
|
1769
|
+
if (a === b) return {
|
|
1770
|
+
valid: true,
|
|
1771
|
+
data: a
|
|
1772
|
+
};
|
|
1773
|
+
if (a instanceof Date && b instanceof Date && +a === +b) return {
|
|
1774
|
+
valid: true,
|
|
1775
|
+
data: a
|
|
1776
|
+
};
|
|
1777
|
+
if (isPlainObject(a) && isPlainObject(b)) {
|
|
1778
|
+
const bKeys = Object.keys(b);
|
|
1779
|
+
const sharedKeys = Object.keys(a).filter((key) => bKeys.indexOf(key) !== -1);
|
|
1780
|
+
const newObj = {
|
|
1781
|
+
...a,
|
|
1782
|
+
...b
|
|
1783
|
+
};
|
|
1784
|
+
for (const key of sharedKeys) {
|
|
1785
|
+
const sharedValue = mergeValues(a[key], b[key]);
|
|
1786
|
+
if (!sharedValue.valid) return {
|
|
1787
|
+
valid: false,
|
|
1788
|
+
mergeErrorPath: [key, ...sharedValue.mergeErrorPath]
|
|
1789
|
+
};
|
|
1790
|
+
newObj[key] = sharedValue.data;
|
|
1791
|
+
}
|
|
1792
|
+
return {
|
|
1793
|
+
valid: true,
|
|
1794
|
+
data: newObj
|
|
1795
|
+
};
|
|
1796
|
+
}
|
|
1797
|
+
if (Array.isArray(a) && Array.isArray(b)) {
|
|
1798
|
+
if (a.length !== b.length) return {
|
|
1799
|
+
valid: false,
|
|
1800
|
+
mergeErrorPath: []
|
|
1801
|
+
};
|
|
1802
|
+
const newArray = [];
|
|
1803
|
+
for (let index = 0; index < a.length; index++) {
|
|
1804
|
+
const itemA = a[index];
|
|
1805
|
+
const itemB = b[index];
|
|
1806
|
+
const sharedValue = mergeValues(itemA, itemB);
|
|
1807
|
+
if (!sharedValue.valid) return {
|
|
1808
|
+
valid: false,
|
|
1809
|
+
mergeErrorPath: [index, ...sharedValue.mergeErrorPath]
|
|
1810
|
+
};
|
|
1811
|
+
newArray.push(sharedValue.data);
|
|
1812
|
+
}
|
|
1813
|
+
return {
|
|
1814
|
+
valid: true,
|
|
1815
|
+
data: newArray
|
|
1816
|
+
};
|
|
1817
|
+
}
|
|
1818
|
+
return {
|
|
1819
|
+
valid: false,
|
|
1820
|
+
mergeErrorPath: []
|
|
1821
|
+
};
|
|
1822
|
+
}
|
|
1823
|
+
function handleIntersectionResults(result, left, right) {
|
|
1824
|
+
const unrecKeys = /* @__PURE__ */ new Map();
|
|
1825
|
+
let unrecIssue;
|
|
1826
|
+
for (const iss of left.issues) if (iss.code === "unrecognized_keys") {
|
|
1827
|
+
unrecIssue ?? (unrecIssue = iss);
|
|
1828
|
+
for (const k of iss.keys) {
|
|
1829
|
+
if (!unrecKeys.has(k)) unrecKeys.set(k, {});
|
|
1830
|
+
unrecKeys.get(k).l = true;
|
|
1831
|
+
}
|
|
1832
|
+
} else result.issues.push(iss);
|
|
1833
|
+
for (const iss of right.issues) if (iss.code === "unrecognized_keys") for (const k of iss.keys) {
|
|
1834
|
+
if (!unrecKeys.has(k)) unrecKeys.set(k, {});
|
|
1835
|
+
unrecKeys.get(k).r = true;
|
|
1836
|
+
}
|
|
1837
|
+
else result.issues.push(iss);
|
|
1838
|
+
const bothKeys = [...unrecKeys].filter(([, f]) => f.l && f.r).map(([k]) => k);
|
|
1839
|
+
if (bothKeys.length && unrecIssue) result.issues.push({
|
|
1840
|
+
...unrecIssue,
|
|
1841
|
+
keys: bothKeys
|
|
1842
|
+
});
|
|
1843
|
+
if (aborted(result)) return result;
|
|
1844
|
+
const merged = mergeValues(left.value, right.value);
|
|
1845
|
+
if (!merged.valid) throw new Error(`Unmergable intersection. Error path: ${JSON.stringify(merged.mergeErrorPath)}`);
|
|
1846
|
+
result.value = merged.data;
|
|
1847
|
+
return result;
|
|
1848
|
+
}
|
|
1849
|
+
const $ZodRecord = /* @__PURE__ */ $constructor("$ZodRecord", (inst, def) => {
|
|
1850
|
+
$ZodType.init(inst, def);
|
|
1851
|
+
inst._zod.parse = (payload, ctx) => {
|
|
1852
|
+
const input = payload.value;
|
|
1853
|
+
if (!isPlainObject(input)) {
|
|
1854
|
+
payload.issues.push({
|
|
1855
|
+
expected: "record",
|
|
1856
|
+
code: "invalid_type",
|
|
1857
|
+
input,
|
|
1858
|
+
inst
|
|
1859
|
+
});
|
|
1860
|
+
return payload;
|
|
1861
|
+
}
|
|
1862
|
+
const proms = [];
|
|
1863
|
+
const values = def.keyType._zod.values;
|
|
1864
|
+
if (values) {
|
|
1865
|
+
payload.value = {};
|
|
1866
|
+
const recordKeys = /* @__PURE__ */ new Set();
|
|
1867
|
+
for (const key of values) if (typeof key === "string" || typeof key === "number" || typeof key === "symbol") {
|
|
1868
|
+
recordKeys.add(typeof key === "number" ? key.toString() : key);
|
|
1869
|
+
const result = def.valueType._zod.run({
|
|
1870
|
+
value: input[key],
|
|
1871
|
+
issues: []
|
|
1872
|
+
}, ctx);
|
|
1873
|
+
if (result instanceof Promise) proms.push(result.then((result) => {
|
|
1874
|
+
if (result.issues.length) payload.issues.push(...prefixIssues(key, result.issues));
|
|
1875
|
+
payload.value[key] = result.value;
|
|
1876
|
+
}));
|
|
1877
|
+
else {
|
|
1878
|
+
if (result.issues.length) payload.issues.push(...prefixIssues(key, result.issues));
|
|
1879
|
+
payload.value[key] = result.value;
|
|
1880
|
+
}
|
|
1881
|
+
}
|
|
1882
|
+
let unrecognized;
|
|
1883
|
+
for (const key in input) if (!recordKeys.has(key)) {
|
|
1884
|
+
unrecognized = unrecognized ?? [];
|
|
1885
|
+
unrecognized.push(key);
|
|
1886
|
+
}
|
|
1887
|
+
if (unrecognized && unrecognized.length > 0) payload.issues.push({
|
|
1888
|
+
code: "unrecognized_keys",
|
|
1889
|
+
input,
|
|
1890
|
+
inst,
|
|
1891
|
+
keys: unrecognized
|
|
1892
|
+
});
|
|
1893
|
+
} else {
|
|
1894
|
+
payload.value = {};
|
|
1895
|
+
for (const key of Reflect.ownKeys(input)) {
|
|
1896
|
+
if (key === "__proto__") continue;
|
|
1897
|
+
let keyResult = def.keyType._zod.run({
|
|
1898
|
+
value: key,
|
|
1899
|
+
issues: []
|
|
1900
|
+
}, ctx);
|
|
1901
|
+
if (keyResult instanceof Promise) throw new Error("Async schemas not supported in object keys currently");
|
|
1902
|
+
if (typeof key === "string" && number.test(key) && keyResult.issues.length) {
|
|
1903
|
+
const retryResult = def.keyType._zod.run({
|
|
1904
|
+
value: Number(key),
|
|
1905
|
+
issues: []
|
|
1906
|
+
}, ctx);
|
|
1907
|
+
if (retryResult instanceof Promise) throw new Error("Async schemas not supported in object keys currently");
|
|
1908
|
+
if (retryResult.issues.length === 0) keyResult = retryResult;
|
|
1909
|
+
}
|
|
1910
|
+
if (keyResult.issues.length) {
|
|
1911
|
+
if (def.mode === "loose") payload.value[key] = input[key];
|
|
1912
|
+
else payload.issues.push({
|
|
1913
|
+
code: "invalid_key",
|
|
1914
|
+
origin: "record",
|
|
1915
|
+
issues: keyResult.issues.map((iss) => finalizeIssue(iss, ctx, config())),
|
|
1916
|
+
input: key,
|
|
1917
|
+
path: [key],
|
|
1918
|
+
inst
|
|
1919
|
+
});
|
|
1920
|
+
continue;
|
|
1921
|
+
}
|
|
1922
|
+
const result = def.valueType._zod.run({
|
|
1923
|
+
value: input[key],
|
|
1924
|
+
issues: []
|
|
1925
|
+
}, ctx);
|
|
1926
|
+
if (result instanceof Promise) proms.push(result.then((result) => {
|
|
1927
|
+
if (result.issues.length) payload.issues.push(...prefixIssues(key, result.issues));
|
|
1928
|
+
payload.value[keyResult.value] = result.value;
|
|
1929
|
+
}));
|
|
1930
|
+
else {
|
|
1931
|
+
if (result.issues.length) payload.issues.push(...prefixIssues(key, result.issues));
|
|
1932
|
+
payload.value[keyResult.value] = result.value;
|
|
1933
|
+
}
|
|
1934
|
+
}
|
|
1935
|
+
}
|
|
1936
|
+
if (proms.length) return Promise.all(proms).then(() => payload);
|
|
1937
|
+
return payload;
|
|
1938
|
+
};
|
|
1939
|
+
});
|
|
1940
|
+
const $ZodEnum = /* @__PURE__ */ $constructor("$ZodEnum", (inst, def) => {
|
|
1941
|
+
$ZodType.init(inst, def);
|
|
1942
|
+
const values = getEnumValues(def.entries);
|
|
1943
|
+
const valuesSet = new Set(values);
|
|
1944
|
+
inst._zod.values = valuesSet;
|
|
1945
|
+
inst._zod.pattern = new RegExp(`^(${values.filter((k) => propertyKeyTypes.has(typeof k)).map((o) => typeof o === "string" ? escapeRegex(o) : o.toString()).join("|")})$`);
|
|
1946
|
+
inst._zod.parse = (payload, _ctx) => {
|
|
1947
|
+
const input = payload.value;
|
|
1948
|
+
if (valuesSet.has(input)) return payload;
|
|
1949
|
+
payload.issues.push({
|
|
1950
|
+
code: "invalid_value",
|
|
1951
|
+
values,
|
|
1952
|
+
input,
|
|
1953
|
+
inst
|
|
1954
|
+
});
|
|
1955
|
+
return payload;
|
|
1956
|
+
};
|
|
1957
|
+
});
|
|
1958
|
+
const $ZodLiteral = /* @__PURE__ */ $constructor("$ZodLiteral", (inst, def) => {
|
|
1959
|
+
$ZodType.init(inst, def);
|
|
1960
|
+
if (def.values.length === 0) throw new Error("Cannot create literal schema with no valid values");
|
|
1961
|
+
const values = new Set(def.values);
|
|
1962
|
+
inst._zod.values = values;
|
|
1963
|
+
inst._zod.pattern = new RegExp(`^(${def.values.map((o) => typeof o === "string" ? escapeRegex(o) : o ? escapeRegex(o.toString()) : String(o)).join("|")})$`);
|
|
1964
|
+
inst._zod.parse = (payload, _ctx) => {
|
|
1965
|
+
const input = payload.value;
|
|
1966
|
+
if (values.has(input)) return payload;
|
|
1967
|
+
payload.issues.push({
|
|
1968
|
+
code: "invalid_value",
|
|
1969
|
+
values: def.values,
|
|
1970
|
+
input,
|
|
1971
|
+
inst
|
|
1972
|
+
});
|
|
1973
|
+
return payload;
|
|
1974
|
+
};
|
|
1975
|
+
});
|
|
1976
|
+
const $ZodTransform = /* @__PURE__ */ $constructor("$ZodTransform", (inst, def) => {
|
|
1977
|
+
$ZodType.init(inst, def);
|
|
1978
|
+
inst._zod.parse = (payload, ctx) => {
|
|
1979
|
+
if (ctx.direction === "backward") throw new $ZodEncodeError(inst.constructor.name);
|
|
1980
|
+
const _out = def.transform(payload.value, payload);
|
|
1981
|
+
if (ctx.async) return (_out instanceof Promise ? _out : Promise.resolve(_out)).then((output) => {
|
|
1982
|
+
payload.value = output;
|
|
1983
|
+
return payload;
|
|
1984
|
+
});
|
|
1985
|
+
if (_out instanceof Promise) throw new $ZodAsyncError();
|
|
1986
|
+
payload.value = _out;
|
|
1987
|
+
return payload;
|
|
1988
|
+
};
|
|
1989
|
+
});
|
|
1990
|
+
function handleOptionalResult(result, input) {
|
|
1991
|
+
if (result.issues.length && input === void 0) return {
|
|
1992
|
+
issues: [],
|
|
1993
|
+
value: void 0
|
|
1994
|
+
};
|
|
1995
|
+
return result;
|
|
1996
|
+
}
|
|
1997
|
+
const $ZodOptional = /* @__PURE__ */ $constructor("$ZodOptional", (inst, def) => {
|
|
1998
|
+
$ZodType.init(inst, def);
|
|
1999
|
+
inst._zod.optin = "optional";
|
|
2000
|
+
inst._zod.optout = "optional";
|
|
2001
|
+
defineLazy(inst._zod, "values", () => {
|
|
2002
|
+
return def.innerType._zod.values ? new Set([...def.innerType._zod.values, void 0]) : void 0;
|
|
2003
|
+
});
|
|
2004
|
+
defineLazy(inst._zod, "pattern", () => {
|
|
2005
|
+
const pattern = def.innerType._zod.pattern;
|
|
2006
|
+
return pattern ? new RegExp(`^(${cleanRegex(pattern.source)})?$`) : void 0;
|
|
2007
|
+
});
|
|
2008
|
+
inst._zod.parse = (payload, ctx) => {
|
|
2009
|
+
if (def.innerType._zod.optin === "optional") {
|
|
2010
|
+
const result = def.innerType._zod.run(payload, ctx);
|
|
2011
|
+
if (result instanceof Promise) return result.then((r) => handleOptionalResult(r, payload.value));
|
|
2012
|
+
return handleOptionalResult(result, payload.value);
|
|
2013
|
+
}
|
|
2014
|
+
if (payload.value === void 0) return payload;
|
|
2015
|
+
return def.innerType._zod.run(payload, ctx);
|
|
2016
|
+
};
|
|
2017
|
+
});
|
|
2018
|
+
const $ZodExactOptional = /* @__PURE__ */ $constructor("$ZodExactOptional", (inst, def) => {
|
|
2019
|
+
$ZodOptional.init(inst, def);
|
|
2020
|
+
defineLazy(inst._zod, "values", () => def.innerType._zod.values);
|
|
2021
|
+
defineLazy(inst._zod, "pattern", () => def.innerType._zod.pattern);
|
|
2022
|
+
inst._zod.parse = (payload, ctx) => {
|
|
2023
|
+
return def.innerType._zod.run(payload, ctx);
|
|
2024
|
+
};
|
|
2025
|
+
});
|
|
2026
|
+
const $ZodNullable = /* @__PURE__ */ $constructor("$ZodNullable", (inst, def) => {
|
|
2027
|
+
$ZodType.init(inst, def);
|
|
2028
|
+
defineLazy(inst._zod, "optin", () => def.innerType._zod.optin);
|
|
2029
|
+
defineLazy(inst._zod, "optout", () => def.innerType._zod.optout);
|
|
2030
|
+
defineLazy(inst._zod, "pattern", () => {
|
|
2031
|
+
const pattern = def.innerType._zod.pattern;
|
|
2032
|
+
return pattern ? new RegExp(`^(${cleanRegex(pattern.source)}|null)$`) : void 0;
|
|
2033
|
+
});
|
|
2034
|
+
defineLazy(inst._zod, "values", () => {
|
|
2035
|
+
return def.innerType._zod.values ? new Set([...def.innerType._zod.values, null]) : void 0;
|
|
2036
|
+
});
|
|
2037
|
+
inst._zod.parse = (payload, ctx) => {
|
|
2038
|
+
if (payload.value === null) return payload;
|
|
2039
|
+
return def.innerType._zod.run(payload, ctx);
|
|
2040
|
+
};
|
|
2041
|
+
});
|
|
2042
|
+
const $ZodDefault = /* @__PURE__ */ $constructor("$ZodDefault", (inst, def) => {
|
|
2043
|
+
$ZodType.init(inst, def);
|
|
2044
|
+
inst._zod.optin = "optional";
|
|
2045
|
+
defineLazy(inst._zod, "values", () => def.innerType._zod.values);
|
|
2046
|
+
inst._zod.parse = (payload, ctx) => {
|
|
2047
|
+
if (ctx.direction === "backward") return def.innerType._zod.run(payload, ctx);
|
|
2048
|
+
if (payload.value === void 0) {
|
|
2049
|
+
payload.value = def.defaultValue;
|
|
2050
|
+
/**
|
|
2051
|
+
* $ZodDefault returns the default value immediately in forward direction.
|
|
2052
|
+
* 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. */
|
|
2053
|
+
return payload;
|
|
2054
|
+
}
|
|
2055
|
+
const result = def.innerType._zod.run(payload, ctx);
|
|
2056
|
+
if (result instanceof Promise) return result.then((result) => handleDefaultResult(result, def));
|
|
2057
|
+
return handleDefaultResult(result, def);
|
|
2058
|
+
};
|
|
2059
|
+
});
|
|
2060
|
+
function handleDefaultResult(payload, def) {
|
|
2061
|
+
if (payload.value === void 0) payload.value = def.defaultValue;
|
|
2062
|
+
return payload;
|
|
2063
|
+
}
|
|
2064
|
+
const $ZodPrefault = /* @__PURE__ */ $constructor("$ZodPrefault", (inst, def) => {
|
|
2065
|
+
$ZodType.init(inst, def);
|
|
2066
|
+
inst._zod.optin = "optional";
|
|
2067
|
+
defineLazy(inst._zod, "values", () => def.innerType._zod.values);
|
|
2068
|
+
inst._zod.parse = (payload, ctx) => {
|
|
2069
|
+
if (ctx.direction === "backward") return def.innerType._zod.run(payload, ctx);
|
|
2070
|
+
if (payload.value === void 0) payload.value = def.defaultValue;
|
|
2071
|
+
return def.innerType._zod.run(payload, ctx);
|
|
2072
|
+
};
|
|
2073
|
+
});
|
|
2074
|
+
const $ZodNonOptional = /* @__PURE__ */ $constructor("$ZodNonOptional", (inst, def) => {
|
|
2075
|
+
$ZodType.init(inst, def);
|
|
2076
|
+
defineLazy(inst._zod, "values", () => {
|
|
2077
|
+
const v = def.innerType._zod.values;
|
|
2078
|
+
return v ? new Set([...v].filter((x) => x !== void 0)) : void 0;
|
|
2079
|
+
});
|
|
2080
|
+
inst._zod.parse = (payload, ctx) => {
|
|
2081
|
+
const result = def.innerType._zod.run(payload, ctx);
|
|
2082
|
+
if (result instanceof Promise) return result.then((result) => handleNonOptionalResult(result, inst));
|
|
2083
|
+
return handleNonOptionalResult(result, inst);
|
|
2084
|
+
};
|
|
2085
|
+
});
|
|
2086
|
+
function handleNonOptionalResult(payload, inst) {
|
|
2087
|
+
if (!payload.issues.length && payload.value === void 0) payload.issues.push({
|
|
2088
|
+
code: "invalid_type",
|
|
2089
|
+
expected: "nonoptional",
|
|
2090
|
+
input: payload.value,
|
|
2091
|
+
inst
|
|
2092
|
+
});
|
|
2093
|
+
return payload;
|
|
2094
|
+
}
|
|
2095
|
+
const $ZodCatch = /* @__PURE__ */ $constructor("$ZodCatch", (inst, def) => {
|
|
2096
|
+
$ZodType.init(inst, def);
|
|
2097
|
+
defineLazy(inst._zod, "optin", () => def.innerType._zod.optin);
|
|
2098
|
+
defineLazy(inst._zod, "optout", () => def.innerType._zod.optout);
|
|
2099
|
+
defineLazy(inst._zod, "values", () => def.innerType._zod.values);
|
|
2100
|
+
inst._zod.parse = (payload, ctx) => {
|
|
2101
|
+
if (ctx.direction === "backward") return def.innerType._zod.run(payload, ctx);
|
|
2102
|
+
const result = def.innerType._zod.run(payload, ctx);
|
|
2103
|
+
if (result instanceof Promise) return result.then((result) => {
|
|
2104
|
+
payload.value = result.value;
|
|
2105
|
+
if (result.issues.length) {
|
|
2106
|
+
payload.value = def.catchValue({
|
|
2107
|
+
...payload,
|
|
2108
|
+
error: { issues: result.issues.map((iss) => finalizeIssue(iss, ctx, config())) },
|
|
2109
|
+
input: payload.value
|
|
2110
|
+
});
|
|
2111
|
+
payload.issues = [];
|
|
2112
|
+
}
|
|
2113
|
+
return payload;
|
|
2114
|
+
});
|
|
2115
|
+
payload.value = result.value;
|
|
2116
|
+
if (result.issues.length) {
|
|
2117
|
+
payload.value = def.catchValue({
|
|
2118
|
+
...payload,
|
|
2119
|
+
error: { issues: result.issues.map((iss) => finalizeIssue(iss, ctx, config())) },
|
|
2120
|
+
input: payload.value
|
|
2121
|
+
});
|
|
2122
|
+
payload.issues = [];
|
|
2123
|
+
}
|
|
2124
|
+
return payload;
|
|
2125
|
+
};
|
|
2126
|
+
});
|
|
2127
|
+
const $ZodPipe = /* @__PURE__ */ $constructor("$ZodPipe", (inst, def) => {
|
|
2128
|
+
$ZodType.init(inst, def);
|
|
2129
|
+
defineLazy(inst._zod, "values", () => def.in._zod.values);
|
|
2130
|
+
defineLazy(inst._zod, "optin", () => def.in._zod.optin);
|
|
2131
|
+
defineLazy(inst._zod, "optout", () => def.out._zod.optout);
|
|
2132
|
+
defineLazy(inst._zod, "propValues", () => def.in._zod.propValues);
|
|
2133
|
+
inst._zod.parse = (payload, ctx) => {
|
|
2134
|
+
if (ctx.direction === "backward") {
|
|
2135
|
+
const right = def.out._zod.run(payload, ctx);
|
|
2136
|
+
if (right instanceof Promise) return right.then((right) => handlePipeResult(right, def.in, ctx));
|
|
2137
|
+
return handlePipeResult(right, def.in, ctx);
|
|
2138
|
+
}
|
|
2139
|
+
const left = def.in._zod.run(payload, ctx);
|
|
2140
|
+
if (left instanceof Promise) return left.then((left) => handlePipeResult(left, def.out, ctx));
|
|
2141
|
+
return handlePipeResult(left, def.out, ctx);
|
|
2142
|
+
};
|
|
2143
|
+
});
|
|
2144
|
+
function handlePipeResult(left, next, ctx) {
|
|
2145
|
+
if (left.issues.length) {
|
|
2146
|
+
left.aborted = true;
|
|
2147
|
+
return left;
|
|
2148
|
+
}
|
|
2149
|
+
return next._zod.run({
|
|
2150
|
+
value: left.value,
|
|
2151
|
+
issues: left.issues
|
|
2152
|
+
}, ctx);
|
|
2153
|
+
}
|
|
2154
|
+
const $ZodReadonly = /* @__PURE__ */ $constructor("$ZodReadonly", (inst, def) => {
|
|
2155
|
+
$ZodType.init(inst, def);
|
|
2156
|
+
defineLazy(inst._zod, "propValues", () => def.innerType._zod.propValues);
|
|
2157
|
+
defineLazy(inst._zod, "values", () => def.innerType._zod.values);
|
|
2158
|
+
defineLazy(inst._zod, "optin", () => def.innerType?._zod?.optin);
|
|
2159
|
+
defineLazy(inst._zod, "optout", () => def.innerType?._zod?.optout);
|
|
2160
|
+
inst._zod.parse = (payload, ctx) => {
|
|
2161
|
+
if (ctx.direction === "backward") return def.innerType._zod.run(payload, ctx);
|
|
2162
|
+
const result = def.innerType._zod.run(payload, ctx);
|
|
2163
|
+
if (result instanceof Promise) return result.then(handleReadonlyResult);
|
|
2164
|
+
return handleReadonlyResult(result);
|
|
2165
|
+
};
|
|
2166
|
+
});
|
|
2167
|
+
function handleReadonlyResult(payload) {
|
|
2168
|
+
payload.value = Object.freeze(payload.value);
|
|
2169
|
+
return payload;
|
|
2170
|
+
}
|
|
2171
|
+
const $ZodCustom = /* @__PURE__ */ $constructor("$ZodCustom", (inst, def) => {
|
|
2172
|
+
$ZodCheck.init(inst, def);
|
|
2173
|
+
$ZodType.init(inst, def);
|
|
2174
|
+
inst._zod.parse = (payload, _) => {
|
|
2175
|
+
return payload;
|
|
2176
|
+
};
|
|
2177
|
+
inst._zod.check = (payload) => {
|
|
2178
|
+
const input = payload.value;
|
|
2179
|
+
const r = def.fn(input);
|
|
2180
|
+
if (r instanceof Promise) return r.then((r) => handleRefineResult(r, payload, input, inst));
|
|
2181
|
+
handleRefineResult(r, payload, input, inst);
|
|
2182
|
+
};
|
|
2183
|
+
});
|
|
2184
|
+
function handleRefineResult(result, payload, input, inst) {
|
|
2185
|
+
if (!result) {
|
|
2186
|
+
const _iss = {
|
|
2187
|
+
code: "custom",
|
|
2188
|
+
input,
|
|
2189
|
+
inst,
|
|
2190
|
+
path: [...inst._zod.def.path ?? []],
|
|
2191
|
+
continue: !inst._zod.def.abort
|
|
2192
|
+
};
|
|
2193
|
+
if (inst._zod.def.params) _iss.params = inst._zod.def.params;
|
|
2194
|
+
payload.issues.push(issue(_iss));
|
|
2195
|
+
}
|
|
2196
|
+
}
|
|
2197
|
+
//#endregion
|
|
2198
|
+
//#region node_modules/.pnpm/zod@4.3.6/node_modules/zod/v4/core/registries.js
|
|
2199
|
+
var _a;
|
|
2200
|
+
var $ZodRegistry = class {
|
|
2201
|
+
constructor() {
|
|
2202
|
+
this._map = /* @__PURE__ */ new WeakMap();
|
|
2203
|
+
this._idmap = /* @__PURE__ */ new Map();
|
|
2204
|
+
}
|
|
2205
|
+
add(schema, ..._meta) {
|
|
2206
|
+
const meta = _meta[0];
|
|
2207
|
+
this._map.set(schema, meta);
|
|
2208
|
+
if (meta && typeof meta === "object" && "id" in meta) this._idmap.set(meta.id, schema);
|
|
2209
|
+
return this;
|
|
2210
|
+
}
|
|
2211
|
+
clear() {
|
|
2212
|
+
this._map = /* @__PURE__ */ new WeakMap();
|
|
2213
|
+
this._idmap = /* @__PURE__ */ new Map();
|
|
2214
|
+
return this;
|
|
2215
|
+
}
|
|
2216
|
+
remove(schema) {
|
|
2217
|
+
const meta = this._map.get(schema);
|
|
2218
|
+
if (meta && typeof meta === "object" && "id" in meta) this._idmap.delete(meta.id);
|
|
2219
|
+
this._map.delete(schema);
|
|
2220
|
+
return this;
|
|
2221
|
+
}
|
|
2222
|
+
get(schema) {
|
|
2223
|
+
const p = schema._zod.parent;
|
|
2224
|
+
if (p) {
|
|
2225
|
+
const pm = { ...this.get(p) ?? {} };
|
|
2226
|
+
delete pm.id;
|
|
2227
|
+
const f = {
|
|
2228
|
+
...pm,
|
|
2229
|
+
...this._map.get(schema)
|
|
2230
|
+
};
|
|
2231
|
+
return Object.keys(f).length ? f : void 0;
|
|
2232
|
+
}
|
|
2233
|
+
return this._map.get(schema);
|
|
2234
|
+
}
|
|
2235
|
+
has(schema) {
|
|
2236
|
+
return this._map.has(schema);
|
|
2237
|
+
}
|
|
2238
|
+
};
|
|
2239
|
+
function registry() {
|
|
2240
|
+
return new $ZodRegistry();
|
|
2241
|
+
}
|
|
2242
|
+
(_a = globalThis).__zod_globalRegistry ?? (_a.__zod_globalRegistry = registry());
|
|
2243
|
+
const globalRegistry = globalThis.__zod_globalRegistry;
|
|
2244
|
+
//#endregion
|
|
2245
|
+
//#region node_modules/.pnpm/zod@4.3.6/node_modules/zod/v4/core/api.js
|
|
2246
|
+
/* @__NO_SIDE_EFFECTS__ */
|
|
2247
|
+
function _string(Class, params) {
|
|
2248
|
+
return new Class({
|
|
2249
|
+
type: "string",
|
|
2250
|
+
...normalizeParams(params)
|
|
2251
|
+
});
|
|
2252
|
+
}
|
|
2253
|
+
/* @__NO_SIDE_EFFECTS__ */
|
|
2254
|
+
function _email(Class, params) {
|
|
2255
|
+
return new Class({
|
|
2256
|
+
type: "string",
|
|
2257
|
+
format: "email",
|
|
2258
|
+
check: "string_format",
|
|
2259
|
+
abort: false,
|
|
2260
|
+
...normalizeParams(params)
|
|
2261
|
+
});
|
|
2262
|
+
}
|
|
2263
|
+
/* @__NO_SIDE_EFFECTS__ */
|
|
2264
|
+
function _guid(Class, params) {
|
|
2265
|
+
return new Class({
|
|
2266
|
+
type: "string",
|
|
2267
|
+
format: "guid",
|
|
2268
|
+
check: "string_format",
|
|
2269
|
+
abort: false,
|
|
2270
|
+
...normalizeParams(params)
|
|
2271
|
+
});
|
|
2272
|
+
}
|
|
2273
|
+
/* @__NO_SIDE_EFFECTS__ */
|
|
2274
|
+
function _uuid(Class, params) {
|
|
2275
|
+
return new Class({
|
|
2276
|
+
type: "string",
|
|
2277
|
+
format: "uuid",
|
|
2278
|
+
check: "string_format",
|
|
2279
|
+
abort: false,
|
|
2280
|
+
...normalizeParams(params)
|
|
2281
|
+
});
|
|
2282
|
+
}
|
|
2283
|
+
/* @__NO_SIDE_EFFECTS__ */
|
|
2284
|
+
function _uuidv4(Class, params) {
|
|
2285
|
+
return new Class({
|
|
2286
|
+
type: "string",
|
|
2287
|
+
format: "uuid",
|
|
2288
|
+
check: "string_format",
|
|
2289
|
+
abort: false,
|
|
2290
|
+
version: "v4",
|
|
2291
|
+
...normalizeParams(params)
|
|
2292
|
+
});
|
|
2293
|
+
}
|
|
2294
|
+
/* @__NO_SIDE_EFFECTS__ */
|
|
2295
|
+
function _uuidv6(Class, params) {
|
|
2296
|
+
return new Class({
|
|
2297
|
+
type: "string",
|
|
2298
|
+
format: "uuid",
|
|
2299
|
+
check: "string_format",
|
|
2300
|
+
abort: false,
|
|
2301
|
+
version: "v6",
|
|
2302
|
+
...normalizeParams(params)
|
|
2303
|
+
});
|
|
2304
|
+
}
|
|
2305
|
+
/* @__NO_SIDE_EFFECTS__ */
|
|
2306
|
+
function _uuidv7(Class, params) {
|
|
2307
|
+
return new Class({
|
|
2308
|
+
type: "string",
|
|
2309
|
+
format: "uuid",
|
|
2310
|
+
check: "string_format",
|
|
2311
|
+
abort: false,
|
|
2312
|
+
version: "v7",
|
|
2313
|
+
...normalizeParams(params)
|
|
2314
|
+
});
|
|
2315
|
+
}
|
|
2316
|
+
/* @__NO_SIDE_EFFECTS__ */
|
|
2317
|
+
function _url(Class, params) {
|
|
2318
|
+
return new Class({
|
|
2319
|
+
type: "string",
|
|
2320
|
+
format: "url",
|
|
2321
|
+
check: "string_format",
|
|
2322
|
+
abort: false,
|
|
2323
|
+
...normalizeParams(params)
|
|
2324
|
+
});
|
|
2325
|
+
}
|
|
2326
|
+
/* @__NO_SIDE_EFFECTS__ */
|
|
2327
|
+
function _emoji(Class, params) {
|
|
2328
|
+
return new Class({
|
|
2329
|
+
type: "string",
|
|
2330
|
+
format: "emoji",
|
|
2331
|
+
check: "string_format",
|
|
2332
|
+
abort: false,
|
|
2333
|
+
...normalizeParams(params)
|
|
2334
|
+
});
|
|
2335
|
+
}
|
|
2336
|
+
/* @__NO_SIDE_EFFECTS__ */
|
|
2337
|
+
function _nanoid(Class, params) {
|
|
2338
|
+
return new Class({
|
|
2339
|
+
type: "string",
|
|
2340
|
+
format: "nanoid",
|
|
2341
|
+
check: "string_format",
|
|
2342
|
+
abort: false,
|
|
2343
|
+
...normalizeParams(params)
|
|
2344
|
+
});
|
|
2345
|
+
}
|
|
2346
|
+
/* @__NO_SIDE_EFFECTS__ */
|
|
2347
|
+
function _cuid(Class, params) {
|
|
2348
|
+
return new Class({
|
|
2349
|
+
type: "string",
|
|
2350
|
+
format: "cuid",
|
|
2351
|
+
check: "string_format",
|
|
2352
|
+
abort: false,
|
|
2353
|
+
...normalizeParams(params)
|
|
2354
|
+
});
|
|
2355
|
+
}
|
|
2356
|
+
/* @__NO_SIDE_EFFECTS__ */
|
|
2357
|
+
function _cuid2(Class, params) {
|
|
2358
|
+
return new Class({
|
|
2359
|
+
type: "string",
|
|
2360
|
+
format: "cuid2",
|
|
2361
|
+
check: "string_format",
|
|
2362
|
+
abort: false,
|
|
2363
|
+
...normalizeParams(params)
|
|
2364
|
+
});
|
|
2365
|
+
}
|
|
2366
|
+
/* @__NO_SIDE_EFFECTS__ */
|
|
2367
|
+
function _ulid(Class, params) {
|
|
2368
|
+
return new Class({
|
|
2369
|
+
type: "string",
|
|
2370
|
+
format: "ulid",
|
|
2371
|
+
check: "string_format",
|
|
2372
|
+
abort: false,
|
|
2373
|
+
...normalizeParams(params)
|
|
2374
|
+
});
|
|
2375
|
+
}
|
|
2376
|
+
/* @__NO_SIDE_EFFECTS__ */
|
|
2377
|
+
function _xid(Class, params) {
|
|
2378
|
+
return new Class({
|
|
2379
|
+
type: "string",
|
|
2380
|
+
format: "xid",
|
|
2381
|
+
check: "string_format",
|
|
2382
|
+
abort: false,
|
|
2383
|
+
...normalizeParams(params)
|
|
2384
|
+
});
|
|
2385
|
+
}
|
|
2386
|
+
/* @__NO_SIDE_EFFECTS__ */
|
|
2387
|
+
function _ksuid(Class, params) {
|
|
2388
|
+
return new Class({
|
|
2389
|
+
type: "string",
|
|
2390
|
+
format: "ksuid",
|
|
2391
|
+
check: "string_format",
|
|
2392
|
+
abort: false,
|
|
2393
|
+
...normalizeParams(params)
|
|
2394
|
+
});
|
|
2395
|
+
}
|
|
2396
|
+
/* @__NO_SIDE_EFFECTS__ */
|
|
2397
|
+
function _ipv4(Class, params) {
|
|
2398
|
+
return new Class({
|
|
2399
|
+
type: "string",
|
|
2400
|
+
format: "ipv4",
|
|
2401
|
+
check: "string_format",
|
|
2402
|
+
abort: false,
|
|
2403
|
+
...normalizeParams(params)
|
|
2404
|
+
});
|
|
2405
|
+
}
|
|
2406
|
+
/* @__NO_SIDE_EFFECTS__ */
|
|
2407
|
+
function _ipv6(Class, params) {
|
|
2408
|
+
return new Class({
|
|
2409
|
+
type: "string",
|
|
2410
|
+
format: "ipv6",
|
|
2411
|
+
check: "string_format",
|
|
2412
|
+
abort: false,
|
|
2413
|
+
...normalizeParams(params)
|
|
2414
|
+
});
|
|
2415
|
+
}
|
|
2416
|
+
/* @__NO_SIDE_EFFECTS__ */
|
|
2417
|
+
function _cidrv4(Class, params) {
|
|
2418
|
+
return new Class({
|
|
2419
|
+
type: "string",
|
|
2420
|
+
format: "cidrv4",
|
|
2421
|
+
check: "string_format",
|
|
2422
|
+
abort: false,
|
|
2423
|
+
...normalizeParams(params)
|
|
2424
|
+
});
|
|
2425
|
+
}
|
|
2426
|
+
/* @__NO_SIDE_EFFECTS__ */
|
|
2427
|
+
function _cidrv6(Class, params) {
|
|
2428
|
+
return new Class({
|
|
2429
|
+
type: "string",
|
|
2430
|
+
format: "cidrv6",
|
|
2431
|
+
check: "string_format",
|
|
2432
|
+
abort: false,
|
|
2433
|
+
...normalizeParams(params)
|
|
2434
|
+
});
|
|
2435
|
+
}
|
|
2436
|
+
/* @__NO_SIDE_EFFECTS__ */
|
|
2437
|
+
function _base64(Class, params) {
|
|
2438
|
+
return new Class({
|
|
2439
|
+
type: "string",
|
|
2440
|
+
format: "base64",
|
|
2441
|
+
check: "string_format",
|
|
2442
|
+
abort: false,
|
|
2443
|
+
...normalizeParams(params)
|
|
2444
|
+
});
|
|
2445
|
+
}
|
|
2446
|
+
/* @__NO_SIDE_EFFECTS__ */
|
|
2447
|
+
function _base64url(Class, params) {
|
|
2448
|
+
return new Class({
|
|
2449
|
+
type: "string",
|
|
2450
|
+
format: "base64url",
|
|
2451
|
+
check: "string_format",
|
|
2452
|
+
abort: false,
|
|
2453
|
+
...normalizeParams(params)
|
|
2454
|
+
});
|
|
2455
|
+
}
|
|
2456
|
+
/* @__NO_SIDE_EFFECTS__ */
|
|
2457
|
+
function _e164(Class, params) {
|
|
2458
|
+
return new Class({
|
|
2459
|
+
type: "string",
|
|
2460
|
+
format: "e164",
|
|
2461
|
+
check: "string_format",
|
|
2462
|
+
abort: false,
|
|
2463
|
+
...normalizeParams(params)
|
|
2464
|
+
});
|
|
2465
|
+
}
|
|
2466
|
+
/* @__NO_SIDE_EFFECTS__ */
|
|
2467
|
+
function _jwt(Class, params) {
|
|
2468
|
+
return new Class({
|
|
2469
|
+
type: "string",
|
|
2470
|
+
format: "jwt",
|
|
2471
|
+
check: "string_format",
|
|
2472
|
+
abort: false,
|
|
2473
|
+
...normalizeParams(params)
|
|
2474
|
+
});
|
|
2475
|
+
}
|
|
2476
|
+
/* @__NO_SIDE_EFFECTS__ */
|
|
2477
|
+
function _isoDateTime(Class, params) {
|
|
2478
|
+
return new Class({
|
|
2479
|
+
type: "string",
|
|
2480
|
+
format: "datetime",
|
|
2481
|
+
check: "string_format",
|
|
2482
|
+
offset: false,
|
|
2483
|
+
local: false,
|
|
2484
|
+
precision: null,
|
|
2485
|
+
...normalizeParams(params)
|
|
2486
|
+
});
|
|
2487
|
+
}
|
|
2488
|
+
/* @__NO_SIDE_EFFECTS__ */
|
|
2489
|
+
function _isoDate(Class, params) {
|
|
2490
|
+
return new Class({
|
|
2491
|
+
type: "string",
|
|
2492
|
+
format: "date",
|
|
2493
|
+
check: "string_format",
|
|
2494
|
+
...normalizeParams(params)
|
|
2495
|
+
});
|
|
2496
|
+
}
|
|
2497
|
+
/* @__NO_SIDE_EFFECTS__ */
|
|
2498
|
+
function _isoTime(Class, params) {
|
|
2499
|
+
return new Class({
|
|
2500
|
+
type: "string",
|
|
2501
|
+
format: "time",
|
|
2502
|
+
check: "string_format",
|
|
2503
|
+
precision: null,
|
|
2504
|
+
...normalizeParams(params)
|
|
2505
|
+
});
|
|
2506
|
+
}
|
|
2507
|
+
/* @__NO_SIDE_EFFECTS__ */
|
|
2508
|
+
function _isoDuration(Class, params) {
|
|
2509
|
+
return new Class({
|
|
2510
|
+
type: "string",
|
|
2511
|
+
format: "duration",
|
|
2512
|
+
check: "string_format",
|
|
2513
|
+
...normalizeParams(params)
|
|
2514
|
+
});
|
|
2515
|
+
}
|
|
2516
|
+
/* @__NO_SIDE_EFFECTS__ */
|
|
2517
|
+
function _number(Class, params) {
|
|
2518
|
+
return new Class({
|
|
2519
|
+
type: "number",
|
|
2520
|
+
checks: [],
|
|
2521
|
+
...normalizeParams(params)
|
|
2522
|
+
});
|
|
2523
|
+
}
|
|
2524
|
+
/* @__NO_SIDE_EFFECTS__ */
|
|
2525
|
+
function _coercedNumber(Class, params) {
|
|
2526
|
+
return new Class({
|
|
2527
|
+
type: "number",
|
|
2528
|
+
coerce: true,
|
|
2529
|
+
checks: [],
|
|
2530
|
+
...normalizeParams(params)
|
|
2531
|
+
});
|
|
2532
|
+
}
|
|
2533
|
+
/* @__NO_SIDE_EFFECTS__ */
|
|
2534
|
+
function _int(Class, params) {
|
|
2535
|
+
return new Class({
|
|
2536
|
+
type: "number",
|
|
2537
|
+
check: "number_format",
|
|
2538
|
+
abort: false,
|
|
2539
|
+
format: "safeint",
|
|
2540
|
+
...normalizeParams(params)
|
|
2541
|
+
});
|
|
2542
|
+
}
|
|
2543
|
+
/* @__NO_SIDE_EFFECTS__ */
|
|
2544
|
+
function _boolean(Class, params) {
|
|
2545
|
+
return new Class({
|
|
2546
|
+
type: "boolean",
|
|
2547
|
+
...normalizeParams(params)
|
|
2548
|
+
});
|
|
2549
|
+
}
|
|
2550
|
+
/* @__NO_SIDE_EFFECTS__ */
|
|
2551
|
+
function _null(Class, params) {
|
|
2552
|
+
return new Class({
|
|
2553
|
+
type: "null",
|
|
2554
|
+
...normalizeParams(params)
|
|
2555
|
+
});
|
|
2556
|
+
}
|
|
2557
|
+
/* @__NO_SIDE_EFFECTS__ */
|
|
2558
|
+
function _any(Class) {
|
|
2559
|
+
return new Class({ type: "any" });
|
|
2560
|
+
}
|
|
2561
|
+
/* @__NO_SIDE_EFFECTS__ */
|
|
2562
|
+
function _unknown(Class) {
|
|
2563
|
+
return new Class({ type: "unknown" });
|
|
2564
|
+
}
|
|
2565
|
+
/* @__NO_SIDE_EFFECTS__ */
|
|
2566
|
+
function _never(Class, params) {
|
|
2567
|
+
return new Class({
|
|
2568
|
+
type: "never",
|
|
2569
|
+
...normalizeParams(params)
|
|
2570
|
+
});
|
|
2571
|
+
}
|
|
2572
|
+
/* @__NO_SIDE_EFFECTS__ */
|
|
2573
|
+
function _lt(value, params) {
|
|
2574
|
+
return new $ZodCheckLessThan({
|
|
2575
|
+
check: "less_than",
|
|
2576
|
+
...normalizeParams(params),
|
|
2577
|
+
value,
|
|
2578
|
+
inclusive: false
|
|
2579
|
+
});
|
|
2580
|
+
}
|
|
2581
|
+
/* @__NO_SIDE_EFFECTS__ */
|
|
2582
|
+
function _lte(value, params) {
|
|
2583
|
+
return new $ZodCheckLessThan({
|
|
2584
|
+
check: "less_than",
|
|
2585
|
+
...normalizeParams(params),
|
|
2586
|
+
value,
|
|
2587
|
+
inclusive: true
|
|
2588
|
+
});
|
|
2589
|
+
}
|
|
2590
|
+
/* @__NO_SIDE_EFFECTS__ */
|
|
2591
|
+
function _gt(value, params) {
|
|
2592
|
+
return new $ZodCheckGreaterThan({
|
|
2593
|
+
check: "greater_than",
|
|
2594
|
+
...normalizeParams(params),
|
|
2595
|
+
value,
|
|
2596
|
+
inclusive: false
|
|
2597
|
+
});
|
|
2598
|
+
}
|
|
2599
|
+
/* @__NO_SIDE_EFFECTS__ */
|
|
2600
|
+
function _gte(value, params) {
|
|
2601
|
+
return new $ZodCheckGreaterThan({
|
|
2602
|
+
check: "greater_than",
|
|
2603
|
+
...normalizeParams(params),
|
|
2604
|
+
value,
|
|
2605
|
+
inclusive: true
|
|
2606
|
+
});
|
|
2607
|
+
}
|
|
2608
|
+
/* @__NO_SIDE_EFFECTS__ */
|
|
2609
|
+
function _multipleOf(value, params) {
|
|
2610
|
+
return new $ZodCheckMultipleOf({
|
|
2611
|
+
check: "multiple_of",
|
|
2612
|
+
...normalizeParams(params),
|
|
2613
|
+
value
|
|
2614
|
+
});
|
|
2615
|
+
}
|
|
2616
|
+
/* @__NO_SIDE_EFFECTS__ */
|
|
2617
|
+
function _maxLength(maximum, params) {
|
|
2618
|
+
return new $ZodCheckMaxLength({
|
|
2619
|
+
check: "max_length",
|
|
2620
|
+
...normalizeParams(params),
|
|
2621
|
+
maximum
|
|
2622
|
+
});
|
|
2623
|
+
}
|
|
2624
|
+
/* @__NO_SIDE_EFFECTS__ */
|
|
2625
|
+
function _minLength(minimum, params) {
|
|
2626
|
+
return new $ZodCheckMinLength({
|
|
2627
|
+
check: "min_length",
|
|
2628
|
+
...normalizeParams(params),
|
|
2629
|
+
minimum
|
|
2630
|
+
});
|
|
2631
|
+
}
|
|
2632
|
+
/* @__NO_SIDE_EFFECTS__ */
|
|
2633
|
+
function _length(length, params) {
|
|
2634
|
+
return new $ZodCheckLengthEquals({
|
|
2635
|
+
check: "length_equals",
|
|
2636
|
+
...normalizeParams(params),
|
|
2637
|
+
length
|
|
2638
|
+
});
|
|
2639
|
+
}
|
|
2640
|
+
/* @__NO_SIDE_EFFECTS__ */
|
|
2641
|
+
function _regex(pattern, params) {
|
|
2642
|
+
return new $ZodCheckRegex({
|
|
2643
|
+
check: "string_format",
|
|
2644
|
+
format: "regex",
|
|
2645
|
+
...normalizeParams(params),
|
|
2646
|
+
pattern
|
|
2647
|
+
});
|
|
2648
|
+
}
|
|
2649
|
+
/* @__NO_SIDE_EFFECTS__ */
|
|
2650
|
+
function _lowercase(params) {
|
|
2651
|
+
return new $ZodCheckLowerCase({
|
|
2652
|
+
check: "string_format",
|
|
2653
|
+
format: "lowercase",
|
|
2654
|
+
...normalizeParams(params)
|
|
2655
|
+
});
|
|
2656
|
+
}
|
|
2657
|
+
/* @__NO_SIDE_EFFECTS__ */
|
|
2658
|
+
function _uppercase(params) {
|
|
2659
|
+
return new $ZodCheckUpperCase({
|
|
2660
|
+
check: "string_format",
|
|
2661
|
+
format: "uppercase",
|
|
2662
|
+
...normalizeParams(params)
|
|
2663
|
+
});
|
|
2664
|
+
}
|
|
2665
|
+
/* @__NO_SIDE_EFFECTS__ */
|
|
2666
|
+
function _includes(includes, params) {
|
|
2667
|
+
return new $ZodCheckIncludes({
|
|
2668
|
+
check: "string_format",
|
|
2669
|
+
format: "includes",
|
|
2670
|
+
...normalizeParams(params),
|
|
2671
|
+
includes
|
|
2672
|
+
});
|
|
2673
|
+
}
|
|
2674
|
+
/* @__NO_SIDE_EFFECTS__ */
|
|
2675
|
+
function _startsWith(prefix, params) {
|
|
2676
|
+
return new $ZodCheckStartsWith({
|
|
2677
|
+
check: "string_format",
|
|
2678
|
+
format: "starts_with",
|
|
2679
|
+
...normalizeParams(params),
|
|
2680
|
+
prefix
|
|
2681
|
+
});
|
|
2682
|
+
}
|
|
2683
|
+
/* @__NO_SIDE_EFFECTS__ */
|
|
2684
|
+
function _endsWith(suffix, params) {
|
|
2685
|
+
return new $ZodCheckEndsWith({
|
|
2686
|
+
check: "string_format",
|
|
2687
|
+
format: "ends_with",
|
|
2688
|
+
...normalizeParams(params),
|
|
2689
|
+
suffix
|
|
2690
|
+
});
|
|
2691
|
+
}
|
|
2692
|
+
/* @__NO_SIDE_EFFECTS__ */
|
|
2693
|
+
function _overwrite(tx) {
|
|
2694
|
+
return new $ZodCheckOverwrite({
|
|
2695
|
+
check: "overwrite",
|
|
2696
|
+
tx
|
|
2697
|
+
});
|
|
2698
|
+
}
|
|
2699
|
+
/* @__NO_SIDE_EFFECTS__ */
|
|
2700
|
+
function _normalize(form) {
|
|
2701
|
+
return /* @__PURE__ */ _overwrite((input) => input.normalize(form));
|
|
2702
|
+
}
|
|
2703
|
+
/* @__NO_SIDE_EFFECTS__ */
|
|
2704
|
+
function _trim() {
|
|
2705
|
+
return /* @__PURE__ */ _overwrite((input) => input.trim());
|
|
2706
|
+
}
|
|
2707
|
+
/* @__NO_SIDE_EFFECTS__ */
|
|
2708
|
+
function _toLowerCase() {
|
|
2709
|
+
return /* @__PURE__ */ _overwrite((input) => input.toLowerCase());
|
|
2710
|
+
}
|
|
2711
|
+
/* @__NO_SIDE_EFFECTS__ */
|
|
2712
|
+
function _toUpperCase() {
|
|
2713
|
+
return /* @__PURE__ */ _overwrite((input) => input.toUpperCase());
|
|
2714
|
+
}
|
|
2715
|
+
/* @__NO_SIDE_EFFECTS__ */
|
|
2716
|
+
function _slugify() {
|
|
2717
|
+
return /* @__PURE__ */ _overwrite((input) => slugify(input));
|
|
2718
|
+
}
|
|
2719
|
+
/* @__NO_SIDE_EFFECTS__ */
|
|
2720
|
+
function _array(Class, element, params) {
|
|
2721
|
+
return new Class({
|
|
2722
|
+
type: "array",
|
|
2723
|
+
element,
|
|
2724
|
+
...normalizeParams(params)
|
|
2725
|
+
});
|
|
2726
|
+
}
|
|
2727
|
+
/* @__NO_SIDE_EFFECTS__ */
|
|
2728
|
+
function _custom(Class, fn, _params) {
|
|
2729
|
+
const norm = normalizeParams(_params);
|
|
2730
|
+
norm.abort ?? (norm.abort = true);
|
|
2731
|
+
return new Class({
|
|
2732
|
+
type: "custom",
|
|
2733
|
+
check: "custom",
|
|
2734
|
+
fn,
|
|
2735
|
+
...norm
|
|
2736
|
+
});
|
|
2737
|
+
}
|
|
2738
|
+
/* @__NO_SIDE_EFFECTS__ */
|
|
2739
|
+
function _refine(Class, fn, _params) {
|
|
2740
|
+
return new Class({
|
|
2741
|
+
type: "custom",
|
|
2742
|
+
check: "custom",
|
|
2743
|
+
fn,
|
|
2744
|
+
...normalizeParams(_params)
|
|
2745
|
+
});
|
|
2746
|
+
}
|
|
2747
|
+
/* @__NO_SIDE_EFFECTS__ */
|
|
2748
|
+
function _superRefine(fn) {
|
|
2749
|
+
const ch = /* @__PURE__ */ _check((payload) => {
|
|
2750
|
+
payload.addIssue = (issue$1) => {
|
|
2751
|
+
if (typeof issue$1 === "string") payload.issues.push(issue(issue$1, payload.value, ch._zod.def));
|
|
2752
|
+
else {
|
|
2753
|
+
const _issue = issue$1;
|
|
2754
|
+
if (_issue.fatal) _issue.continue = false;
|
|
2755
|
+
_issue.code ?? (_issue.code = "custom");
|
|
2756
|
+
_issue.input ?? (_issue.input = payload.value);
|
|
2757
|
+
_issue.inst ?? (_issue.inst = ch);
|
|
2758
|
+
_issue.continue ?? (_issue.continue = !ch._zod.def.abort);
|
|
2759
|
+
payload.issues.push(issue(_issue));
|
|
2760
|
+
}
|
|
2761
|
+
};
|
|
2762
|
+
return fn(payload.value, payload);
|
|
2763
|
+
});
|
|
2764
|
+
return ch;
|
|
2765
|
+
}
|
|
2766
|
+
/* @__NO_SIDE_EFFECTS__ */
|
|
2767
|
+
function _check(fn, params) {
|
|
2768
|
+
const ch = new $ZodCheck({
|
|
2769
|
+
check: "custom",
|
|
2770
|
+
...normalizeParams(params)
|
|
2771
|
+
});
|
|
2772
|
+
ch._zod.check = fn;
|
|
2773
|
+
return ch;
|
|
2774
|
+
}
|
|
2775
|
+
/* @__NO_SIDE_EFFECTS__ */
|
|
2776
|
+
function describe(description) {
|
|
2777
|
+
const ch = new $ZodCheck({ check: "describe" });
|
|
2778
|
+
ch._zod.onattach = [(inst) => {
|
|
2779
|
+
const existing = globalRegistry.get(inst) ?? {};
|
|
2780
|
+
globalRegistry.add(inst, {
|
|
2781
|
+
...existing,
|
|
2782
|
+
description
|
|
2783
|
+
});
|
|
2784
|
+
}];
|
|
2785
|
+
ch._zod.check = () => {};
|
|
2786
|
+
return ch;
|
|
2787
|
+
}
|
|
2788
|
+
/* @__NO_SIDE_EFFECTS__ */
|
|
2789
|
+
function meta(metadata) {
|
|
2790
|
+
const ch = new $ZodCheck({ check: "meta" });
|
|
2791
|
+
ch._zod.onattach = [(inst) => {
|
|
2792
|
+
const existing = globalRegistry.get(inst) ?? {};
|
|
2793
|
+
globalRegistry.add(inst, {
|
|
2794
|
+
...existing,
|
|
2795
|
+
...metadata
|
|
2796
|
+
});
|
|
2797
|
+
}];
|
|
2798
|
+
ch._zod.check = () => {};
|
|
2799
|
+
return ch;
|
|
2800
|
+
}
|
|
2801
|
+
//#endregion
|
|
2802
|
+
export { _uppercase as $, $ZodStringFormat as $t, _lowercase as A, getEnumValues as An, $ZodISODate as At, _number as B, safeExtend as Bn, $ZodNonOptional as Bt, _isoDate as C, safeParseAsync as Cn, $ZodEmail as Ct, _jwt as D, clone as Dn, $ZodGUID as Dt, _isoTime as E, formatError as En, $ZodExactOptional as Et, _multipleOf as F, normalizeParams as Fn, $ZodJWT as Ft, _startsWith as G, $ZodObject as Gt, _refine as H, $ZodEncodeError as Hn, $ZodNullable as Ht, _nanoid as I, omit as In, $ZodKSUID as It, _toLowerCase as J, $ZodPipe as Jt, _string as K, $ZodObjectJIT as Kt, _never as L, partial as Ln, $ZodLiteral as Lt, _lte as M, jsonStringifyReplacer as Mn, $ZodISODuration as Mt, _maxLength as N, merge as Nn, $ZodISOTime as Nt, _ksuid as O, defineLazy as On, $ZodIPv4 as Ot, _minLength as P, mergeDefs as Pn, $ZodIntersection as Pt, _unknown as Q, $ZodString as Qt, _normalize as R, pick as Rn, $ZodNanoID as Rt, _ipv6 as S, safeParse as Sn, $ZodE164 as St, _isoDuration as T, flattenError as Tn, $ZodEnum as Tt, _regex as U, $constructor as Un, $ZodNumber as Ut, _overwrite as V, shallowClone as Vn, $ZodNull as Vt, _slugify as W, NEVER as Wn, $ZodNumberFormat as Wt, _trim as X, $ZodReadonly as Xt, _toUpperCase as Y, $ZodPrefault as Yt, _ulid as Z, $ZodRecord as Zt, _gte as _, _safeEncodeAsync as _n, $ZodCUID2 as _t, _boolean as a, $ZodUnion as an, _xid as at, _int as b, parse as bn, $ZodDefault as bt, _coercedNumber as c, _decode as cn, globalRegistry as ct, _custom as d, _encodeAsync as dn, $ZodBase64 as dt, $ZodTransform as en, _url as et, _e164 as f, _parse as fn, $ZodBase64URL as ft, _gt as g, _safeEncode as gn, $ZodCUID as gt, _endsWith as h, _safeDecodeAsync as hn, $ZodCIDRv6 as ht, _base64url as i, $ZodUUID as in, _uuidv7 as it, _lt as j, issue as jn, $ZodISODateTime as jt, _length as k, extend as kn, $ZodIPv6 as kt, _cuid as l, _decodeAsync as ln, $ZodAny as lt, _emoji as m, _safeDecode as mn, $ZodCIDRv4 as mt, _array as n, $ZodULID as nn, _uuidv4 as nt, _cidrv4 as o, $ZodUnknown as on, describe as ot, _email as p, _parseAsync as pn, $ZodBoolean as pt, _superRefine as q, $ZodOptional as qt, _base64 as r, $ZodURL as rn, _uuidv6 as rt, _cidrv6 as s, $ZodXID as sn, meta as st, _any as t, $ZodType as tn, _uuid as tt, _cuid2 as u, _encode as un, $ZodArray as ut, _guid as v, _safeParse as vn, $ZodCatch as vt, _isoDateTime as w, $ZodError as wn, $ZodEmoji as wt, _ipv4 as x, parseAsync as xn, $ZodDiscriminatedUnion as xt, _includes as y, _safeParseAsync as yn, $ZodCustom as yt, _null as z, required as zn, $ZodNever as zt };
|