mlform 0.1.2 → 0.1.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (30) hide show
  1. package/README.md +166 -85
  2. package/dist/FieldStrategy-CW2h8YyB.js +2427 -0
  3. package/dist/{ReportStrategy-DY3GC_mJ.js → ReportStrategy-CxPzs4b2.js} +1 -1
  4. package/dist/{boolean-field-Cd3uhIPj.js → boolean-field-Dwz0ejWl.js} +2 -2
  5. package/dist/{category-field-D_Ms1x9u.js → category-field-DIgX--Px.js} +2 -2
  6. package/dist/{classifier-prediction-C5QzorTo.js → classifier-prediction-DgiEREf_.js} +2 -2
  7. package/dist/{custom-element-ttkHUa8w.js → custom-element-DFxkZ1wU.js} +0 -5
  8. package/dist/{date-field-Cg_ja679.js → date-field-91U2Xe46.js} +2 -2
  9. package/dist/{error-card-BwjPChwf.js → error-card-DHdkE18B.js} +2 -2
  10. package/dist/{field-wrapper-DqIQl76d.js → field-wrapper-CBmpN5T_.js} +3 -3
  11. package/dist/{ml-layout-Dx63KKf7.js → ml-layout-BJax9HVW.js} +3 -3
  12. package/dist/mlform/extensions.mjs +4 -4
  13. package/dist/mlform/strategies.mjs +9 -9
  14. package/dist/mlform.mjs +210 -202
  15. package/dist/{number-field-CC2DrVEb.js → number-field-Bcp45dJb.js} +31 -32
  16. package/dist/{property-jKFNMQpR.js → property-B2UZ3Oii.js} +0 -25
  17. package/dist/{range-field-Cr7LEtsJ.js → range-field-CD0kkCt0.js} +2 -2
  18. package/dist/{regressor-prediction-C18dHlfK.js → regressor-prediction-CPzZXlmA.js} +2 -2
  19. package/dist/src/core/domain/index.d.ts +2 -1
  20. package/dist/state-Ba1Gr1cr.js +7 -0
  21. package/dist/test/integration/lifecycle.integration.test.d.ts +1 -0
  22. package/dist/test/integration/registration.integration.test.d.ts +1 -0
  23. package/dist/test/integration/state.integration.test.d.ts +1 -0
  24. package/dist/test/integration/validation.integration.test.d.ts +1 -0
  25. package/dist/test/unit/Strategies.extensions.test.d.ts +1 -0
  26. package/dist/test/unit/Strategies.test.d.ts +1 -0
  27. package/dist/{text-field-DwP-Fa1w.js → text-field-CSBBr4gN.js} +2 -2
  28. package/package.json +59 -15
  29. package/dist/FieldStrategy-pPekBtH-.js +0 -2318
  30. package/dist/state-CLlTRyl1.js +0 -12
@@ -1,2318 +0,0 @@
1
- function c(e, t, n) {
2
- function r(s, l) {
3
- var h;
4
- Object.defineProperty(s, "_zod", {
5
- value: s._zod ?? {},
6
- enumerable: !1
7
- }), (h = s._zod).traits ?? (h.traits = /* @__PURE__ */ new Set()), s._zod.traits.add(e), t(s, l);
8
- for (const _ in u.prototype)
9
- _ in s || Object.defineProperty(s, _, { value: u.prototype[_].bind(s) });
10
- s._zod.constr = u, s._zod.def = l;
11
- }
12
- const o = n?.Parent ?? Object;
13
- class i extends o {
14
- }
15
- Object.defineProperty(i, "name", { value: e });
16
- function u(s) {
17
- var l;
18
- const h = n?.Parent ? new i() : this;
19
- r(h, s), (l = h._zod).deferred ?? (l.deferred = []);
20
- for (const _ of h._zod.deferred)
21
- _();
22
- return h;
23
- }
24
- return Object.defineProperty(u, "init", { value: r }), Object.defineProperty(u, Symbol.hasInstance, {
25
- value: (s) => n?.Parent && s instanceof n.Parent ? !0 : s?._zod?.traits?.has(e)
26
- }), Object.defineProperty(u, "name", { value: e }), u;
27
- }
28
- class N extends Error {
29
- constructor() {
30
- super("Encountered Promise during synchronous parse. Use .parseAsync() instead.");
31
- }
32
- }
33
- const Te = {};
34
- function T(e) {
35
- return Te;
36
- }
37
- function Qe(e) {
38
- const t = Object.values(e).filter((r) => typeof r == "number");
39
- return Object.entries(e).filter(([r, o]) => t.indexOf(+r) === -1).map(([r, o]) => o);
40
- }
41
- function X(e, t) {
42
- return typeof t == "bigint" ? t.toString() : t;
43
- }
44
- function Pe(e) {
45
- return {
46
- get value() {
47
- {
48
- const t = e();
49
- return Object.defineProperty(this, "value", { value: t }), t;
50
- }
51
- }
52
- };
53
- }
54
- function re(e) {
55
- return e == null;
56
- }
57
- function oe(e) {
58
- const t = e.startsWith("^") ? 1 : 0, n = e.endsWith("$") ? e.length - 1 : e.length;
59
- return e.slice(t, n);
60
- }
61
- function et(e, t) {
62
- const n = (e.toString().split(".")[1] || "").length, r = (t.toString().split(".")[1] || "").length, o = n > r ? n : r, i = Number.parseInt(e.toFixed(o).replace(".", "")), u = Number.parseInt(t.toFixed(o).replace(".", ""));
63
- return i % u / 10 ** o;
64
- }
65
- function d(e, t, n) {
66
- Object.defineProperty(e, t, {
67
- get() {
68
- {
69
- const r = n();
70
- return e[t] = r, r;
71
- }
72
- },
73
- set(r) {
74
- Object.defineProperty(e, t, {
75
- value: r
76
- // configurable: true,
77
- });
78
- },
79
- configurable: !0
80
- });
81
- }
82
- function E(e, t, n) {
83
- Object.defineProperty(e, t, {
84
- value: n,
85
- writable: !0,
86
- enumerable: !0,
87
- configurable: !0
88
- });
89
- }
90
- function S(...e) {
91
- const t = {};
92
- for (const n of e) {
93
- const r = Object.getOwnPropertyDescriptors(n);
94
- Object.assign(t, r);
95
- }
96
- return Object.defineProperties({}, t);
97
- }
98
- function ae(e) {
99
- return JSON.stringify(e);
100
- }
101
- const xe = "captureStackTrace" in Error ? Error.captureStackTrace : (...e) => {
102
- };
103
- function q(e) {
104
- return typeof e == "object" && e !== null && !Array.isArray(e);
105
- }
106
- const tt = Pe(() => {
107
- if (typeof navigator < "u" && navigator?.userAgent?.includes("Cloudflare"))
108
- return !1;
109
- try {
110
- const e = Function;
111
- return new e(""), !0;
112
- } catch {
113
- return !1;
114
- }
115
- });
116
- function H(e) {
117
- if (q(e) === !1)
118
- return !1;
119
- const t = e.constructor;
120
- if (t === void 0)
121
- return !0;
122
- const n = t.prototype;
123
- return !(q(n) === !1 || Object.prototype.hasOwnProperty.call(n, "isPrototypeOf") === !1);
124
- }
125
- const nt = /* @__PURE__ */ new Set(["string", "number", "symbol"]);
126
- function O(e) {
127
- return e.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
128
- }
129
- function x(e, t, n) {
130
- const r = new e._zod.constr(t ?? e._zod.def);
131
- return (!t || n?.parent) && (r._zod.parent = e), r;
132
- }
133
- function a(e) {
134
- const t = e;
135
- if (!t)
136
- return {};
137
- if (typeof t == "string")
138
- return { error: () => t };
139
- if (t?.message !== void 0) {
140
- if (t?.error !== void 0)
141
- throw new Error("Cannot specify both `message` and `error` params");
142
- t.error = t.message;
143
- }
144
- return delete t.message, typeof t.error == "string" ? { ...t, error: () => t.error } : t;
145
- }
146
- function rt(e) {
147
- return Object.keys(e).filter((t) => e[t]._zod.optin === "optional" && e[t]._zod.optout === "optional");
148
- }
149
- const ot = {
150
- safeint: [Number.MIN_SAFE_INTEGER, Number.MAX_SAFE_INTEGER],
151
- int32: [-2147483648, 2147483647],
152
- uint32: [0, 4294967295],
153
- float32: [-34028234663852886e22, 34028234663852886e22],
154
- float64: [-Number.MAX_VALUE, Number.MAX_VALUE]
155
- };
156
- function it(e, t) {
157
- const n = e._zod.def, r = S(e._zod.def, {
158
- get shape() {
159
- const o = {};
160
- for (const i in t) {
161
- if (!(i in n.shape))
162
- throw new Error(`Unrecognized key: "${i}"`);
163
- t[i] && (o[i] = n.shape[i]);
164
- }
165
- return E(this, "shape", o), o;
166
- },
167
- checks: []
168
- });
169
- return x(e, r);
170
- }
171
- function ut(e, t) {
172
- const n = e._zod.def, r = S(e._zod.def, {
173
- get shape() {
174
- const o = { ...e._zod.def.shape };
175
- for (const i in t) {
176
- if (!(i in n.shape))
177
- throw new Error(`Unrecognized key: "${i}"`);
178
- t[i] && delete o[i];
179
- }
180
- return E(this, "shape", o), o;
181
- },
182
- checks: []
183
- });
184
- return x(e, r);
185
- }
186
- function ct(e, t) {
187
- if (!H(t))
188
- throw new Error("Invalid input to extend: expected a plain object");
189
- const n = S(e._zod.def, {
190
- get shape() {
191
- const r = { ...e._zod.def.shape, ...t };
192
- return E(this, "shape", r), r;
193
- },
194
- checks: []
195
- });
196
- return x(e, n);
197
- }
198
- function st(e, t) {
199
- const n = S(e._zod.def, {
200
- get shape() {
201
- const r = { ...e._zod.def.shape, ...t._zod.def.shape };
202
- return E(this, "shape", r), r;
203
- },
204
- get catchall() {
205
- return t._zod.def.catchall;
206
- },
207
- checks: []
208
- // delete existing checks
209
- });
210
- return x(e, n);
211
- }
212
- function at(e, t, n) {
213
- const r = S(t._zod.def, {
214
- get shape() {
215
- const o = t._zod.def.shape, i = { ...o };
216
- if (n)
217
- for (const u in n) {
218
- if (!(u in o))
219
- throw new Error(`Unrecognized key: "${u}"`);
220
- n[u] && (i[u] = e ? new e({
221
- type: "optional",
222
- innerType: o[u]
223
- }) : o[u]);
224
- }
225
- else
226
- for (const u in o)
227
- i[u] = e ? new e({
228
- type: "optional",
229
- innerType: o[u]
230
- }) : o[u];
231
- return E(this, "shape", i), i;
232
- },
233
- checks: []
234
- });
235
- return x(t, r);
236
- }
237
- function lt(e, t, n) {
238
- const r = S(t._zod.def, {
239
- get shape() {
240
- const o = t._zod.def.shape, i = { ...o };
241
- if (n)
242
- for (const u in n) {
243
- if (!(u in i))
244
- throw new Error(`Unrecognized key: "${u}"`);
245
- n[u] && (i[u] = new e({
246
- type: "nonoptional",
247
- innerType: o[u]
248
- }));
249
- }
250
- else
251
- for (const u in o)
252
- i[u] = new e({
253
- type: "nonoptional",
254
- innerType: o[u]
255
- });
256
- return E(this, "shape", i), i;
257
- },
258
- checks: []
259
- });
260
- return x(t, r);
261
- }
262
- function A(e, t = 0) {
263
- for (let n = t; n < e.issues.length; n++)
264
- if (e.issues[n]?.continue !== !0)
265
- return !0;
266
- return !1;
267
- }
268
- function ie(e, t) {
269
- return t.map((n) => {
270
- var r;
271
- return (r = n).path ?? (r.path = []), n.path.unshift(e), n;
272
- });
273
- }
274
- function C(e) {
275
- return typeof e == "string" ? e : e?.message;
276
- }
277
- function P(e, t, n) {
278
- const r = { ...e, path: e.path ?? [] };
279
- if (!e.message) {
280
- const o = C(e.inst?._zod.def?.error?.(e)) ?? C(t?.error?.(e)) ?? C(n.customError?.(e)) ?? C(n.localeError?.(e)) ?? "Invalid input";
281
- r.message = o;
282
- }
283
- return delete r.inst, delete r.continue, t?.reportInput || delete r.input, r;
284
- }
285
- function ue(e) {
286
- return Array.isArray(e) ? "array" : typeof e == "string" ? "string" : "unknown";
287
- }
288
- function D(...e) {
289
- const [t, n, r] = e;
290
- return typeof t == "string" ? {
291
- message: t,
292
- code: "custom",
293
- input: n,
294
- inst: r
295
- } : { ...t };
296
- }
297
- const Oe = (e, t) => {
298
- e.name = "$ZodError", Object.defineProperty(e, "_zod", {
299
- value: e._zod,
300
- enumerable: !1
301
- }), Object.defineProperty(e, "issues", {
302
- value: t,
303
- enumerable: !1
304
- }), e.message = JSON.stringify(t, X, 2), Object.defineProperty(e, "toString", {
305
- value: () => e.message,
306
- enumerable: !1
307
- });
308
- }, Se = c("$ZodError", Oe), Ae = c("$ZodError", Oe, { Parent: Error });
309
- function pt(e, t = (n) => n.message) {
310
- const n = {}, r = [];
311
- for (const o of e.issues)
312
- o.path.length > 0 ? (n[o.path[0]] = n[o.path[0]] || [], n[o.path[0]].push(t(o))) : r.push(t(o));
313
- return { formErrors: r, fieldErrors: n };
314
- }
315
- function ht(e, t) {
316
- const n = t || function(i) {
317
- return i.message;
318
- }, r = { _errors: [] }, o = (i) => {
319
- for (const u of i.issues)
320
- if (u.code === "invalid_union" && u.errors.length)
321
- u.errors.map((s) => o({ issues: s }));
322
- else if (u.code === "invalid_key")
323
- o({ issues: u.issues });
324
- else if (u.code === "invalid_element")
325
- o({ issues: u.issues });
326
- else if (u.path.length === 0)
327
- r._errors.push(n(u));
328
- else {
329
- let s = r, l = 0;
330
- for (; l < u.path.length; ) {
331
- const h = u.path[l];
332
- l === u.path.length - 1 ? (s[h] = s[h] || { _errors: [] }, s[h]._errors.push(n(u))) : s[h] = s[h] || { _errors: [] }, s = s[h], l++;
333
- }
334
- }
335
- };
336
- return o(e), r;
337
- }
338
- const ft = (e) => (t, n, r, o) => {
339
- const i = r ? Object.assign(r, { async: !1 }) : { async: !1 }, u = t._zod.run({ value: n, issues: [] }, i);
340
- if (u instanceof Promise)
341
- throw new N();
342
- if (u.issues.length) {
343
- const s = new (o?.Err ?? e)(u.issues.map((l) => P(l, i, T())));
344
- throw xe(s, o?.callee), s;
345
- }
346
- return u.value;
347
- }, dt = (e) => async (t, n, r, o) => {
348
- const i = r ? Object.assign(r, { async: !0 }) : { async: !0 };
349
- let u = t._zod.run({ value: n, issues: [] }, i);
350
- if (u instanceof Promise && (u = await u), u.issues.length) {
351
- const s = new (o?.Err ?? e)(u.issues.map((l) => P(l, i, T())));
352
- throw xe(s, o?.callee), s;
353
- }
354
- return u.value;
355
- }, Ne = (e) => (t, n, r) => {
356
- const o = r ? { ...r, async: !1 } : { async: !1 }, i = t._zod.run({ value: n, issues: [] }, o);
357
- if (i instanceof Promise)
358
- throw new N();
359
- return i.issues.length ? {
360
- success: !1,
361
- error: new (e ?? Se)(i.issues.map((u) => P(u, o, T())))
362
- } : { success: !0, data: i.value };
363
- }, mt = /* @__PURE__ */ Ne(Ae), De = (e) => async (t, n, r) => {
364
- const o = r ? Object.assign(r, { async: !0 }) : { async: !0 };
365
- let i = t._zod.run({ value: n, issues: [] }, o);
366
- return i instanceof Promise && (i = await i), i.issues.length ? {
367
- success: !1,
368
- error: new e(i.issues.map((u) => P(u, o, T())))
369
- } : { success: !0, data: i.value };
370
- }, _t = /* @__PURE__ */ De(Ae), vt = /^[cC][^\s-]{8,}$/, gt = /^[0-9a-z]+$/, zt = /^[0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{26}$/, bt = /^[0-9a-vA-V]{20}$/, Zt = /^[A-Za-z0-9]{27}$/, wt = /^[a-zA-Z0-9_-]{21}$/, $t = /^P(?:(\d+W)|(?!.*W)(?=\d|T\d)(\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+([.,]\d+)?S)?)?)$/, kt = /^([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})$/, le = (e) => e ? new RegExp(`^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-${e}[0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12})$`) : /^([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)$/, yt = /^(?!\.)(?!.*\.\.)([A-Za-z0-9_'+\-\.]*)[A-Za-z0-9_+-]@([A-Za-z0-9][A-Za-z0-9\-]*\.)+[A-Za-z]{2,}$/, It = "^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$";
371
- function Et() {
372
- return new RegExp(It, "u");
373
- }
374
- const Tt = /^(?:(?: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])$/, Pt = /^(([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})$/, xt = /^((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])$/, Ot = /^(([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])$/, St = /^$|^(?:[0-9a-zA-Z+/]{4})*(?:(?:[0-9a-zA-Z+/]{2}==)|(?:[0-9a-zA-Z+/]{3}=))?$/, je = /^[A-Za-z0-9_-]*$/, At = /^([a-zA-Z0-9-]+\.)*[a-zA-Z0-9-]+$/, Nt = /^\+(?:[0-9]){6,14}[0-9]$/, Re = "(?:(?:\\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])))", Dt = /* @__PURE__ */ new RegExp(`^${Re}$`);
375
- function Ce(e) {
376
- const t = "(?:[01]\\d|2[0-3]):[0-5]\\d";
377
- return typeof e.precision == "number" ? e.precision === -1 ? `${t}` : e.precision === 0 ? `${t}:[0-5]\\d` : `${t}:[0-5]\\d\\.\\d{${e.precision}}` : `${t}(?::[0-5]\\d(?:\\.\\d+)?)?`;
378
- }
379
- function jt(e) {
380
- return new RegExp(`^${Ce(e)}$`);
381
- }
382
- function Rt(e) {
383
- const t = Ce({ precision: e.precision }), n = ["Z"];
384
- e.local && n.push(""), e.offset && n.push("([+-]\\d{2}:\\d{2})");
385
- const r = `${t}(?:${n.join("|")})`;
386
- return new RegExp(`^${Re}T(?:${r})$`);
387
- }
388
- const Ct = (e) => {
389
- const t = e ? `[\\s\\S]{${e?.minimum ?? 0},${e?.maximum ?? ""}}` : "[\\s\\S]*";
390
- return new RegExp(`^${t}$`);
391
- }, Ut = /^\d+$/, Ft = /^-?\d+(?:\.\d+)?/i, Lt = /true|false/i, Mt = /^[^A-Z]*$/, Vt = /^[^a-z]*$/, $ = /* @__PURE__ */ c("$ZodCheck", (e, t) => {
392
- var n;
393
- e._zod ?? (e._zod = {}), e._zod.def = t, (n = e._zod).onattach ?? (n.onattach = []);
394
- }), Ue = {
395
- number: "number",
396
- bigint: "bigint",
397
- object: "date"
398
- }, Fe = /* @__PURE__ */ c("$ZodCheckLessThan", (e, t) => {
399
- $.init(e, t);
400
- const n = Ue[typeof t.value];
401
- e._zod.onattach.push((r) => {
402
- const o = r._zod.bag, i = (t.inclusive ? o.maximum : o.exclusiveMaximum) ?? Number.POSITIVE_INFINITY;
403
- t.value < i && (t.inclusive ? o.maximum = t.value : o.exclusiveMaximum = t.value);
404
- }), e._zod.check = (r) => {
405
- (t.inclusive ? r.value <= t.value : r.value < t.value) || r.issues.push({
406
- origin: n,
407
- code: "too_big",
408
- maximum: t.value,
409
- input: r.value,
410
- inclusive: t.inclusive,
411
- inst: e,
412
- continue: !t.abort
413
- });
414
- };
415
- }), Le = /* @__PURE__ */ c("$ZodCheckGreaterThan", (e, t) => {
416
- $.init(e, t);
417
- const n = Ue[typeof t.value];
418
- e._zod.onattach.push((r) => {
419
- const o = r._zod.bag, i = (t.inclusive ? o.minimum : o.exclusiveMinimum) ?? Number.NEGATIVE_INFINITY;
420
- t.value > i && (t.inclusive ? o.minimum = t.value : o.exclusiveMinimum = t.value);
421
- }), e._zod.check = (r) => {
422
- (t.inclusive ? r.value >= t.value : r.value > t.value) || r.issues.push({
423
- origin: n,
424
- code: "too_small",
425
- minimum: t.value,
426
- input: r.value,
427
- inclusive: t.inclusive,
428
- inst: e,
429
- continue: !t.abort
430
- });
431
- };
432
- }), Bt = /* @__PURE__ */ c("$ZodCheckMultipleOf", (e, t) => {
433
- $.init(e, t), e._zod.onattach.push((n) => {
434
- var r;
435
- (r = n._zod.bag).multipleOf ?? (r.multipleOf = t.value);
436
- }), e._zod.check = (n) => {
437
- if (typeof n.value != typeof t.value)
438
- throw new Error("Cannot mix number and bigint in multiple_of check.");
439
- (typeof n.value == "bigint" ? n.value % t.value === BigInt(0) : et(n.value, t.value) === 0) || n.issues.push({
440
- origin: typeof n.value,
441
- code: "not_multiple_of",
442
- divisor: t.value,
443
- input: n.value,
444
- inst: e,
445
- continue: !t.abort
446
- });
447
- };
448
- }), Wt = /* @__PURE__ */ c("$ZodCheckNumberFormat", (e, t) => {
449
- $.init(e, t), t.format = t.format || "float64";
450
- const n = t.format?.includes("int"), r = n ? "int" : "number", [o, i] = ot[t.format];
451
- e._zod.onattach.push((u) => {
452
- const s = u._zod.bag;
453
- s.format = t.format, s.minimum = o, s.maximum = i, n && (s.pattern = Ut);
454
- }), e._zod.check = (u) => {
455
- const s = u.value;
456
- if (n) {
457
- if (!Number.isInteger(s)) {
458
- u.issues.push({
459
- expected: r,
460
- format: t.format,
461
- code: "invalid_type",
462
- input: s,
463
- inst: e
464
- });
465
- return;
466
- }
467
- if (!Number.isSafeInteger(s)) {
468
- s > 0 ? u.issues.push({
469
- input: s,
470
- code: "too_big",
471
- maximum: Number.MAX_SAFE_INTEGER,
472
- note: "Integers must be within the safe integer range.",
473
- inst: e,
474
- origin: r,
475
- continue: !t.abort
476
- }) : u.issues.push({
477
- input: s,
478
- code: "too_small",
479
- minimum: Number.MIN_SAFE_INTEGER,
480
- note: "Integers must be within the safe integer range.",
481
- inst: e,
482
- origin: r,
483
- continue: !t.abort
484
- });
485
- return;
486
- }
487
- }
488
- s < o && u.issues.push({
489
- origin: "number",
490
- input: s,
491
- code: "too_small",
492
- minimum: o,
493
- inclusive: !0,
494
- inst: e,
495
- continue: !t.abort
496
- }), s > i && u.issues.push({
497
- origin: "number",
498
- input: s,
499
- code: "too_big",
500
- maximum: i,
501
- inst: e
502
- });
503
- };
504
- }), Gt = /* @__PURE__ */ c("$ZodCheckMaxLength", (e, t) => {
505
- var n;
506
- $.init(e, t), (n = e._zod.def).when ?? (n.when = (r) => {
507
- const o = r.value;
508
- return !re(o) && o.length !== void 0;
509
- }), e._zod.onattach.push((r) => {
510
- const o = r._zod.bag.maximum ?? Number.POSITIVE_INFINITY;
511
- t.maximum < o && (r._zod.bag.maximum = t.maximum);
512
- }), e._zod.check = (r) => {
513
- const o = r.value;
514
- if (o.length <= t.maximum)
515
- return;
516
- const u = ue(o);
517
- r.issues.push({
518
- origin: u,
519
- code: "too_big",
520
- maximum: t.maximum,
521
- inclusive: !0,
522
- input: o,
523
- inst: e,
524
- continue: !t.abort
525
- });
526
- };
527
- }), Jt = /* @__PURE__ */ c("$ZodCheckMinLength", (e, t) => {
528
- var n;
529
- $.init(e, t), (n = e._zod.def).when ?? (n.when = (r) => {
530
- const o = r.value;
531
- return !re(o) && o.length !== void 0;
532
- }), e._zod.onattach.push((r) => {
533
- const o = r._zod.bag.minimum ?? Number.NEGATIVE_INFINITY;
534
- t.minimum > o && (r._zod.bag.minimum = t.minimum);
535
- }), e._zod.check = (r) => {
536
- const o = r.value;
537
- if (o.length >= t.minimum)
538
- return;
539
- const u = ue(o);
540
- r.issues.push({
541
- origin: u,
542
- code: "too_small",
543
- minimum: t.minimum,
544
- inclusive: !0,
545
- input: o,
546
- inst: e,
547
- continue: !t.abort
548
- });
549
- };
550
- }), Kt = /* @__PURE__ */ c("$ZodCheckLengthEquals", (e, t) => {
551
- var n;
552
- $.init(e, t), (n = e._zod.def).when ?? (n.when = (r) => {
553
- const o = r.value;
554
- return !re(o) && o.length !== void 0;
555
- }), e._zod.onattach.push((r) => {
556
- const o = r._zod.bag;
557
- o.minimum = t.length, o.maximum = t.length, o.length = t.length;
558
- }), e._zod.check = (r) => {
559
- const o = r.value, i = o.length;
560
- if (i === t.length)
561
- return;
562
- const u = ue(o), s = i > t.length;
563
- r.issues.push({
564
- origin: u,
565
- ...s ? { code: "too_big", maximum: t.length } : { code: "too_small", minimum: t.length },
566
- inclusive: !0,
567
- exact: !0,
568
- input: r.value,
569
- inst: e,
570
- continue: !t.abort
571
- });
572
- };
573
- }), B = /* @__PURE__ */ c("$ZodCheckStringFormat", (e, t) => {
574
- var n, r;
575
- $.init(e, t), e._zod.onattach.push((o) => {
576
- const i = o._zod.bag;
577
- i.format = t.format, t.pattern && (i.patterns ?? (i.patterns = /* @__PURE__ */ new Set()), i.patterns.add(t.pattern));
578
- }), t.pattern ? (n = e._zod).check ?? (n.check = (o) => {
579
- t.pattern.lastIndex = 0, !t.pattern.test(o.value) && o.issues.push({
580
- origin: "string",
581
- code: "invalid_format",
582
- format: t.format,
583
- input: o.value,
584
- ...t.pattern ? { pattern: t.pattern.toString() } : {},
585
- inst: e,
586
- continue: !t.abort
587
- });
588
- }) : (r = e._zod).check ?? (r.check = () => {
589
- });
590
- }), Yt = /* @__PURE__ */ c("$ZodCheckRegex", (e, t) => {
591
- B.init(e, t), e._zod.check = (n) => {
592
- t.pattern.lastIndex = 0, !t.pattern.test(n.value) && n.issues.push({
593
- origin: "string",
594
- code: "invalid_format",
595
- format: "regex",
596
- input: n.value,
597
- pattern: t.pattern.toString(),
598
- inst: e,
599
- continue: !t.abort
600
- });
601
- };
602
- }), Xt = /* @__PURE__ */ c("$ZodCheckLowerCase", (e, t) => {
603
- t.pattern ?? (t.pattern = Mt), B.init(e, t);
604
- }), qt = /* @__PURE__ */ c("$ZodCheckUpperCase", (e, t) => {
605
- t.pattern ?? (t.pattern = Vt), B.init(e, t);
606
- }), Ht = /* @__PURE__ */ c("$ZodCheckIncludes", (e, t) => {
607
- $.init(e, t);
608
- const n = O(t.includes), r = new RegExp(typeof t.position == "number" ? `^.{${t.position}}${n}` : n);
609
- t.pattern = r, e._zod.onattach.push((o) => {
610
- const i = o._zod.bag;
611
- i.patterns ?? (i.patterns = /* @__PURE__ */ new Set()), i.patterns.add(r);
612
- }), e._zod.check = (o) => {
613
- o.value.includes(t.includes, t.position) || o.issues.push({
614
- origin: "string",
615
- code: "invalid_format",
616
- format: "includes",
617
- includes: t.includes,
618
- input: o.value,
619
- inst: e,
620
- continue: !t.abort
621
- });
622
- };
623
- }), Qt = /* @__PURE__ */ c("$ZodCheckStartsWith", (e, t) => {
624
- $.init(e, t);
625
- const n = new RegExp(`^${O(t.prefix)}.*`);
626
- t.pattern ?? (t.pattern = n), e._zod.onattach.push((r) => {
627
- const o = r._zod.bag;
628
- o.patterns ?? (o.patterns = /* @__PURE__ */ new Set()), o.patterns.add(n);
629
- }), e._zod.check = (r) => {
630
- r.value.startsWith(t.prefix) || r.issues.push({
631
- origin: "string",
632
- code: "invalid_format",
633
- format: "starts_with",
634
- prefix: t.prefix,
635
- input: r.value,
636
- inst: e,
637
- continue: !t.abort
638
- });
639
- };
640
- }), en = /* @__PURE__ */ c("$ZodCheckEndsWith", (e, t) => {
641
- $.init(e, t);
642
- const n = new RegExp(`.*${O(t.suffix)}$`);
643
- t.pattern ?? (t.pattern = n), e._zod.onattach.push((r) => {
644
- const o = r._zod.bag;
645
- o.patterns ?? (o.patterns = /* @__PURE__ */ new Set()), o.patterns.add(n);
646
- }), e._zod.check = (r) => {
647
- r.value.endsWith(t.suffix) || r.issues.push({
648
- origin: "string",
649
- code: "invalid_format",
650
- format: "ends_with",
651
- suffix: t.suffix,
652
- input: r.value,
653
- inst: e,
654
- continue: !t.abort
655
- });
656
- };
657
- }), tn = /* @__PURE__ */ c("$ZodCheckOverwrite", (e, t) => {
658
- $.init(e, t), e._zod.check = (n) => {
659
- n.value = t.tx(n.value);
660
- };
661
- });
662
- class nn {
663
- constructor(t = []) {
664
- this.content = [], this.indent = 0, this && (this.args = t);
665
- }
666
- indented(t) {
667
- this.indent += 1, t(this), this.indent -= 1;
668
- }
669
- write(t) {
670
- if (typeof t == "function") {
671
- t(this, { execution: "sync" }), t(this, { execution: "async" });
672
- return;
673
- }
674
- const r = t.split(`
675
- `).filter((u) => u), o = Math.min(...r.map((u) => u.length - u.trimStart().length)), i = r.map((u) => u.slice(o)).map((u) => " ".repeat(this.indent * 2) + u);
676
- for (const u of i)
677
- this.content.push(u);
678
- }
679
- compile() {
680
- const t = Function, n = this?.args, o = [...(this?.content ?? [""]).map((i) => ` ${i}`)];
681
- return new t(...n, o.join(`
682
- `));
683
- }
684
- }
685
- const rn = {
686
- major: 4,
687
- minor: 0,
688
- patch: 10
689
- }, m = /* @__PURE__ */ c("$ZodType", (e, t) => {
690
- var n;
691
- e ?? (e = {}), e._zod.def = t, e._zod.bag = e._zod.bag || {}, e._zod.version = rn;
692
- const r = [...e._zod.def.checks ?? []];
693
- e._zod.traits.has("$ZodCheck") && r.unshift(e);
694
- for (const o of r)
695
- for (const i of o._zod.onattach)
696
- i(e);
697
- if (r.length === 0)
698
- (n = e._zod).deferred ?? (n.deferred = []), e._zod.deferred?.push(() => {
699
- e._zod.run = e._zod.parse;
700
- });
701
- else {
702
- const o = (i, u, s) => {
703
- let l = A(i), h;
704
- for (const _ of u) {
705
- if (_._zod.def.when) {
706
- if (!_._zod.def.when(i))
707
- continue;
708
- } else if (l)
709
- continue;
710
- const p = i.issues.length, f = _._zod.check(i);
711
- if (f instanceof Promise && s?.async === !1)
712
- throw new N();
713
- if (h || f instanceof Promise)
714
- h = (h ?? Promise.resolve()).then(async () => {
715
- await f, i.issues.length !== p && (l || (l = A(i, p)));
716
- });
717
- else {
718
- if (i.issues.length === p)
719
- continue;
720
- l || (l = A(i, p));
721
- }
722
- }
723
- return h ? h.then(() => i) : i;
724
- };
725
- e._zod.run = (i, u) => {
726
- const s = e._zod.parse(i, u);
727
- if (s instanceof Promise) {
728
- if (u.async === !1)
729
- throw new N();
730
- return s.then((l) => o(l, r, u));
731
- }
732
- return o(s, r, u);
733
- };
734
- }
735
- e["~standard"] = {
736
- validate: (o) => {
737
- try {
738
- const i = mt(e, o);
739
- return i.success ? { value: i.data } : { issues: i.error?.issues };
740
- } catch {
741
- return _t(e, o).then((u) => u.success ? { value: u.data } : { issues: u.error?.issues });
742
- }
743
- },
744
- vendor: "zod",
745
- version: 1
746
- };
747
- }), ce = /* @__PURE__ */ c("$ZodString", (e, t) => {
748
- m.init(e, t), e._zod.pattern = [...e?._zod.bag?.patterns ?? []].pop() ?? Ct(e._zod.bag), e._zod.parse = (n, r) => {
749
- if (t.coerce)
750
- try {
751
- n.value = String(n.value);
752
- } catch {
753
- }
754
- return typeof n.value == "string" || n.issues.push({
755
- expected: "string",
756
- code: "invalid_type",
757
- input: n.value,
758
- inst: e
759
- }), n;
760
- };
761
- }), g = /* @__PURE__ */ c("$ZodStringFormat", (e, t) => {
762
- B.init(e, t), ce.init(e, t);
763
- }), on = /* @__PURE__ */ c("$ZodGUID", (e, t) => {
764
- t.pattern ?? (t.pattern = kt), g.init(e, t);
765
- }), un = /* @__PURE__ */ c("$ZodUUID", (e, t) => {
766
- if (t.version) {
767
- const r = {
768
- v1: 1,
769
- v2: 2,
770
- v3: 3,
771
- v4: 4,
772
- v5: 5,
773
- v6: 6,
774
- v7: 7,
775
- v8: 8
776
- }[t.version];
777
- if (r === void 0)
778
- throw new Error(`Invalid UUID version: "${t.version}"`);
779
- t.pattern ?? (t.pattern = le(r));
780
- } else
781
- t.pattern ?? (t.pattern = le());
782
- g.init(e, t);
783
- }), cn = /* @__PURE__ */ c("$ZodEmail", (e, t) => {
784
- t.pattern ?? (t.pattern = yt), g.init(e, t);
785
- }), sn = /* @__PURE__ */ c("$ZodURL", (e, t) => {
786
- g.init(e, t), e._zod.check = (n) => {
787
- try {
788
- const r = n.value.trim(), o = new URL(r);
789
- t.hostname && (t.hostname.lastIndex = 0, t.hostname.test(o.hostname) || n.issues.push({
790
- code: "invalid_format",
791
- format: "url",
792
- note: "Invalid hostname",
793
- pattern: At.source,
794
- input: n.value,
795
- inst: e,
796
- continue: !t.abort
797
- })), t.protocol && (t.protocol.lastIndex = 0, t.protocol.test(o.protocol.endsWith(":") ? o.protocol.slice(0, -1) : o.protocol) || n.issues.push({
798
- code: "invalid_format",
799
- format: "url",
800
- note: "Invalid protocol",
801
- pattern: t.protocol.source,
802
- input: n.value,
803
- inst: e,
804
- continue: !t.abort
805
- })), t.normalize ? n.value = o.href : n.value = r;
806
- return;
807
- } catch {
808
- n.issues.push({
809
- code: "invalid_format",
810
- format: "url",
811
- input: n.value,
812
- inst: e,
813
- continue: !t.abort
814
- });
815
- }
816
- };
817
- }), an = /* @__PURE__ */ c("$ZodEmoji", (e, t) => {
818
- t.pattern ?? (t.pattern = Et()), g.init(e, t);
819
- }), ln = /* @__PURE__ */ c("$ZodNanoID", (e, t) => {
820
- t.pattern ?? (t.pattern = wt), g.init(e, t);
821
- }), pn = /* @__PURE__ */ c("$ZodCUID", (e, t) => {
822
- t.pattern ?? (t.pattern = vt), g.init(e, t);
823
- }), hn = /* @__PURE__ */ c("$ZodCUID2", (e, t) => {
824
- t.pattern ?? (t.pattern = gt), g.init(e, t);
825
- }), fn = /* @__PURE__ */ c("$ZodULID", (e, t) => {
826
- t.pattern ?? (t.pattern = zt), g.init(e, t);
827
- }), dn = /* @__PURE__ */ c("$ZodXID", (e, t) => {
828
- t.pattern ?? (t.pattern = bt), g.init(e, t);
829
- }), mn = /* @__PURE__ */ c("$ZodKSUID", (e, t) => {
830
- t.pattern ?? (t.pattern = Zt), g.init(e, t);
831
- }), _n = /* @__PURE__ */ c("$ZodISODateTime", (e, t) => {
832
- t.pattern ?? (t.pattern = Rt(t)), g.init(e, t);
833
- }), vn = /* @__PURE__ */ c("$ZodISODate", (e, t) => {
834
- t.pattern ?? (t.pattern = Dt), g.init(e, t);
835
- }), gn = /* @__PURE__ */ c("$ZodISOTime", (e, t) => {
836
- t.pattern ?? (t.pattern = jt(t)), g.init(e, t);
837
- }), zn = /* @__PURE__ */ c("$ZodISODuration", (e, t) => {
838
- t.pattern ?? (t.pattern = $t), g.init(e, t);
839
- }), bn = /* @__PURE__ */ c("$ZodIPv4", (e, t) => {
840
- t.pattern ?? (t.pattern = Tt), g.init(e, t), e._zod.onattach.push((n) => {
841
- const r = n._zod.bag;
842
- r.format = "ipv4";
843
- });
844
- }), Zn = /* @__PURE__ */ c("$ZodIPv6", (e, t) => {
845
- t.pattern ?? (t.pattern = Pt), g.init(e, t), e._zod.onattach.push((n) => {
846
- const r = n._zod.bag;
847
- r.format = "ipv6";
848
- }), e._zod.check = (n) => {
849
- try {
850
- new URL(`http://[${n.value}]`);
851
- } catch {
852
- n.issues.push({
853
- code: "invalid_format",
854
- format: "ipv6",
855
- input: n.value,
856
- inst: e,
857
- continue: !t.abort
858
- });
859
- }
860
- };
861
- }), wn = /* @__PURE__ */ c("$ZodCIDRv4", (e, t) => {
862
- t.pattern ?? (t.pattern = xt), g.init(e, t);
863
- }), $n = /* @__PURE__ */ c("$ZodCIDRv6", (e, t) => {
864
- t.pattern ?? (t.pattern = Ot), g.init(e, t), e._zod.check = (n) => {
865
- const [r, o] = n.value.split("/");
866
- try {
867
- if (!o)
868
- throw new Error();
869
- const i = Number(o);
870
- if (`${i}` !== o)
871
- throw new Error();
872
- if (i < 0 || i > 128)
873
- throw new Error();
874
- new URL(`http://[${r}]`);
875
- } catch {
876
- n.issues.push({
877
- code: "invalid_format",
878
- format: "cidrv6",
879
- input: n.value,
880
- inst: e,
881
- continue: !t.abort
882
- });
883
- }
884
- };
885
- });
886
- function Me(e) {
887
- if (e === "")
888
- return !0;
889
- if (e.length % 4 !== 0)
890
- return !1;
891
- try {
892
- return atob(e), !0;
893
- } catch {
894
- return !1;
895
- }
896
- }
897
- const kn = /* @__PURE__ */ c("$ZodBase64", (e, t) => {
898
- t.pattern ?? (t.pattern = St), g.init(e, t), e._zod.onattach.push((n) => {
899
- n._zod.bag.contentEncoding = "base64";
900
- }), e._zod.check = (n) => {
901
- Me(n.value) || n.issues.push({
902
- code: "invalid_format",
903
- format: "base64",
904
- input: n.value,
905
- inst: e,
906
- continue: !t.abort
907
- });
908
- };
909
- });
910
- function yn(e) {
911
- if (!je.test(e))
912
- return !1;
913
- const t = e.replace(/[-_]/g, (r) => r === "-" ? "+" : "/"), n = t.padEnd(Math.ceil(t.length / 4) * 4, "=");
914
- return Me(n);
915
- }
916
- const In = /* @__PURE__ */ c("$ZodBase64URL", (e, t) => {
917
- t.pattern ?? (t.pattern = je), g.init(e, t), e._zod.onattach.push((n) => {
918
- n._zod.bag.contentEncoding = "base64url";
919
- }), e._zod.check = (n) => {
920
- yn(n.value) || n.issues.push({
921
- code: "invalid_format",
922
- format: "base64url",
923
- input: n.value,
924
- inst: e,
925
- continue: !t.abort
926
- });
927
- };
928
- }), En = /* @__PURE__ */ c("$ZodE164", (e, t) => {
929
- t.pattern ?? (t.pattern = Nt), g.init(e, t);
930
- });
931
- function Tn(e, t = null) {
932
- try {
933
- const n = e.split(".");
934
- if (n.length !== 3)
935
- return !1;
936
- const [r] = n;
937
- if (!r)
938
- return !1;
939
- const o = JSON.parse(atob(r));
940
- return !("typ" in o && o?.typ !== "JWT" || !o.alg || t && (!("alg" in o) || o.alg !== t));
941
- } catch {
942
- return !1;
943
- }
944
- }
945
- const Pn = /* @__PURE__ */ c("$ZodJWT", (e, t) => {
946
- g.init(e, t), e._zod.check = (n) => {
947
- Tn(n.value, t.alg) || n.issues.push({
948
- code: "invalid_format",
949
- format: "jwt",
950
- input: n.value,
951
- inst: e,
952
- continue: !t.abort
953
- });
954
- };
955
- }), Ve = /* @__PURE__ */ c("$ZodNumber", (e, t) => {
956
- m.init(e, t), e._zod.pattern = e._zod.bag.pattern ?? Ft, e._zod.parse = (n, r) => {
957
- if (t.coerce)
958
- try {
959
- n.value = Number(n.value);
960
- } catch {
961
- }
962
- const o = n.value;
963
- if (typeof o == "number" && !Number.isNaN(o) && Number.isFinite(o))
964
- return n;
965
- const i = typeof o == "number" ? Number.isNaN(o) ? "NaN" : Number.isFinite(o) ? void 0 : "Infinity" : void 0;
966
- return n.issues.push({
967
- expected: "number",
968
- code: "invalid_type",
969
- input: o,
970
- inst: e,
971
- ...i ? { received: i } : {}
972
- }), n;
973
- };
974
- }), xn = /* @__PURE__ */ c("$ZodNumber", (e, t) => {
975
- Wt.init(e, t), Ve.init(e, t);
976
- }), On = /* @__PURE__ */ c("$ZodBoolean", (e, t) => {
977
- m.init(e, t), e._zod.pattern = Lt, e._zod.parse = (n, r) => {
978
- if (t.coerce)
979
- try {
980
- n.value = !!n.value;
981
- } catch {
982
- }
983
- const o = n.value;
984
- return typeof o == "boolean" || n.issues.push({
985
- expected: "boolean",
986
- code: "invalid_type",
987
- input: o,
988
- inst: e
989
- }), n;
990
- };
991
- }), Sn = /* @__PURE__ */ c("$ZodUnknown", (e, t) => {
992
- m.init(e, t), e._zod.parse = (n) => n;
993
- }), An = /* @__PURE__ */ c("$ZodNever", (e, t) => {
994
- m.init(e, t), e._zod.parse = (n, r) => (n.issues.push({
995
- expected: "never",
996
- code: "invalid_type",
997
- input: n.value,
998
- inst: e
999
- }), n);
1000
- });
1001
- function pe(e, t, n) {
1002
- e.issues.length && t.issues.push(...ie(n, e.issues)), t.value[n] = e.value;
1003
- }
1004
- const Nn = /* @__PURE__ */ c("$ZodArray", (e, t) => {
1005
- m.init(e, t), e._zod.parse = (n, r) => {
1006
- const o = n.value;
1007
- if (!Array.isArray(o))
1008
- return n.issues.push({
1009
- expected: "array",
1010
- code: "invalid_type",
1011
- input: o,
1012
- inst: e
1013
- }), n;
1014
- n.value = Array(o.length);
1015
- const i = [];
1016
- for (let u = 0; u < o.length; u++) {
1017
- const s = o[u], l = t.element._zod.run({
1018
- value: s,
1019
- issues: []
1020
- }, r);
1021
- l instanceof Promise ? i.push(l.then((h) => pe(h, n, u))) : pe(l, n, u);
1022
- }
1023
- return i.length ? Promise.all(i).then(() => n) : n;
1024
- };
1025
- });
1026
- function U(e, t, n, r) {
1027
- e.issues.length && t.issues.push(...ie(n, e.issues)), e.value === void 0 ? n in r && (t.value[n] = void 0) : t.value[n] = e.value;
1028
- }
1029
- const Dn = /* @__PURE__ */ c("$ZodObject", (e, t) => {
1030
- m.init(e, t);
1031
- const n = Pe(() => {
1032
- const p = Object.keys(t.shape);
1033
- for (const v of p)
1034
- if (!(t.shape[v] instanceof m))
1035
- throw new Error(`Invalid element at key "${v}": expected a Zod schema`);
1036
- const f = rt(t.shape);
1037
- return {
1038
- shape: t.shape,
1039
- keys: p,
1040
- keySet: new Set(p),
1041
- numKeys: p.length,
1042
- optionalKeys: new Set(f)
1043
- };
1044
- });
1045
- d(e._zod, "propValues", () => {
1046
- const p = t.shape, f = {};
1047
- for (const v in p) {
1048
- const k = p[v]._zod;
1049
- if (k.values) {
1050
- f[v] ?? (f[v] = /* @__PURE__ */ new Set());
1051
- for (const I of k.values)
1052
- f[v].add(I);
1053
- }
1054
- }
1055
- return f;
1056
- });
1057
- const r = (p) => {
1058
- const f = new nn(["shape", "payload", "ctx"]), v = n.value, k = (y) => {
1059
- const Z = ae(y);
1060
- return `shape[${Z}]._zod.run({ value: input[${Z}], issues: [] }, ctx)`;
1061
- };
1062
- f.write("const input = payload.value;");
1063
- const I = /* @__PURE__ */ Object.create(null);
1064
- let G = 0;
1065
- for (const y of v.keys)
1066
- I[y] = `key_${G++}`;
1067
- f.write("const newResult = {}");
1068
- for (const y of v.keys) {
1069
- const Z = I[y], w = ae(y);
1070
- f.write(`const ${Z} = ${k(y)};`), f.write(`
1071
- if (${Z}.issues.length) {
1072
- payload.issues = payload.issues.concat(${Z}.issues.map(iss => ({
1073
- ...iss,
1074
- path: iss.path ? [${w}, ...iss.path] : [${w}]
1075
- })));
1076
- }
1077
-
1078
- if (${Z}.value === undefined) {
1079
- if (${w} in input) {
1080
- newResult[${w}] = undefined;
1081
- }
1082
- } else {
1083
- newResult[${w}] = ${Z}.value;
1084
- }
1085
- `);
1086
- }
1087
- f.write("payload.value = newResult;"), f.write("return payload;");
1088
- const R = f.compile();
1089
- return (y, Z) => R(p, y, Z);
1090
- };
1091
- let o;
1092
- const i = q, u = !Te.jitless, l = u && tt.value, h = t.catchall;
1093
- let _;
1094
- e._zod.parse = (p, f) => {
1095
- _ ?? (_ = n.value);
1096
- const v = p.value;
1097
- if (!i(v))
1098
- return p.issues.push({
1099
- expected: "object",
1100
- code: "invalid_type",
1101
- input: v,
1102
- inst: e
1103
- }), p;
1104
- const k = [];
1105
- if (u && l && f?.async === !1 && f.jitless !== !0)
1106
- o || (o = r(t.shape)), p = o(p, f);
1107
- else {
1108
- p.value = {};
1109
- const Z = _.shape;
1110
- for (const w of _.keys) {
1111
- const J = Z[w]._zod.run({ value: v[w], issues: [] }, f);
1112
- J instanceof Promise ? k.push(J.then((He) => U(He, p, w, v))) : U(J, p, w, v);
1113
- }
1114
- }
1115
- if (!h)
1116
- return k.length ? Promise.all(k).then(() => p) : p;
1117
- const I = [], G = _.keySet, R = h._zod, y = R.def.type;
1118
- for (const Z of Object.keys(v)) {
1119
- if (G.has(Z))
1120
- continue;
1121
- if (y === "never") {
1122
- I.push(Z);
1123
- continue;
1124
- }
1125
- const w = R.run({ value: v[Z], issues: [] }, f);
1126
- w instanceof Promise ? k.push(w.then((se) => U(se, p, Z, v))) : U(w, p, Z, v);
1127
- }
1128
- return I.length && p.issues.push({
1129
- code: "unrecognized_keys",
1130
- keys: I,
1131
- input: v,
1132
- inst: e
1133
- }), k.length ? Promise.all(k).then(() => p) : p;
1134
- };
1135
- });
1136
- function he(e, t, n, r) {
1137
- for (const i of e)
1138
- if (i.issues.length === 0)
1139
- return t.value = i.value, t;
1140
- const o = e.filter((i) => !A(i));
1141
- return o.length === 1 ? (t.value = o[0].value, o[0]) : (t.issues.push({
1142
- code: "invalid_union",
1143
- input: t.value,
1144
- inst: n,
1145
- errors: e.map((i) => i.issues.map((u) => P(u, r, T())))
1146
- }), t);
1147
- }
1148
- const jn = /* @__PURE__ */ c("$ZodUnion", (e, t) => {
1149
- m.init(e, t), d(e._zod, "optin", () => t.options.some((n) => n._zod.optin === "optional") ? "optional" : void 0), d(e._zod, "optout", () => t.options.some((n) => n._zod.optout === "optional") ? "optional" : void 0), d(e._zod, "values", () => {
1150
- if (t.options.every((n) => n._zod.values))
1151
- return new Set(t.options.flatMap((n) => Array.from(n._zod.values)));
1152
- }), d(e._zod, "pattern", () => {
1153
- if (t.options.every((n) => n._zod.pattern)) {
1154
- const n = t.options.map((r) => r._zod.pattern);
1155
- return new RegExp(`^(${n.map((r) => oe(r.source)).join("|")})$`);
1156
- }
1157
- }), e._zod.parse = (n, r) => {
1158
- let o = !1;
1159
- const i = [];
1160
- for (const u of t.options) {
1161
- const s = u._zod.run({
1162
- value: n.value,
1163
- issues: []
1164
- }, r);
1165
- if (s instanceof Promise)
1166
- i.push(s), o = !0;
1167
- else {
1168
- if (s.issues.length === 0)
1169
- return s;
1170
- i.push(s);
1171
- }
1172
- }
1173
- return o ? Promise.all(i).then((u) => he(u, n, e, r)) : he(i, n, e, r);
1174
- };
1175
- }), Rn = /* @__PURE__ */ c("$ZodIntersection", (e, t) => {
1176
- m.init(e, t), e._zod.parse = (n, r) => {
1177
- const o = n.value, i = t.left._zod.run({ value: o, issues: [] }, r), u = t.right._zod.run({ value: o, issues: [] }, r);
1178
- return i instanceof Promise || u instanceof Promise ? Promise.all([i, u]).then(([l, h]) => fe(n, l, h)) : fe(n, i, u);
1179
- };
1180
- });
1181
- function Q(e, t) {
1182
- if (e === t)
1183
- return { valid: !0, data: e };
1184
- if (e instanceof Date && t instanceof Date && +e == +t)
1185
- return { valid: !0, data: e };
1186
- if (H(e) && H(t)) {
1187
- const n = Object.keys(t), r = Object.keys(e).filter((i) => n.indexOf(i) !== -1), o = { ...e, ...t };
1188
- for (const i of r) {
1189
- const u = Q(e[i], t[i]);
1190
- if (!u.valid)
1191
- return {
1192
- valid: !1,
1193
- mergeErrorPath: [i, ...u.mergeErrorPath]
1194
- };
1195
- o[i] = u.data;
1196
- }
1197
- return { valid: !0, data: o };
1198
- }
1199
- if (Array.isArray(e) && Array.isArray(t)) {
1200
- if (e.length !== t.length)
1201
- return { valid: !1, mergeErrorPath: [] };
1202
- const n = [];
1203
- for (let r = 0; r < e.length; r++) {
1204
- const o = e[r], i = t[r], u = Q(o, i);
1205
- if (!u.valid)
1206
- return {
1207
- valid: !1,
1208
- mergeErrorPath: [r, ...u.mergeErrorPath]
1209
- };
1210
- n.push(u.data);
1211
- }
1212
- return { valid: !0, data: n };
1213
- }
1214
- return { valid: !1, mergeErrorPath: [] };
1215
- }
1216
- function fe(e, t, n) {
1217
- if (t.issues.length && e.issues.push(...t.issues), n.issues.length && e.issues.push(...n.issues), A(e))
1218
- return e;
1219
- const r = Q(t.value, n.value);
1220
- if (!r.valid)
1221
- throw new Error(`Unmergable intersection. Error path: ${JSON.stringify(r.mergeErrorPath)}`);
1222
- return e.value = r.data, e;
1223
- }
1224
- const Cn = /* @__PURE__ */ c("$ZodTuple", (e, t) => {
1225
- m.init(e, t);
1226
- const n = t.items, r = n.length - [...n].reverse().findIndex((o) => o._zod.optin !== "optional");
1227
- e._zod.parse = (o, i) => {
1228
- const u = o.value;
1229
- if (!Array.isArray(u))
1230
- return o.issues.push({
1231
- input: u,
1232
- inst: e,
1233
- expected: "tuple",
1234
- code: "invalid_type"
1235
- }), o;
1236
- o.value = [];
1237
- const s = [];
1238
- if (!t.rest) {
1239
- const h = u.length > n.length, _ = u.length < r - 1;
1240
- if (h || _)
1241
- return o.issues.push({
1242
- input: u,
1243
- inst: e,
1244
- origin: "array",
1245
- ...h ? { code: "too_big", maximum: n.length } : { code: "too_small", minimum: n.length }
1246
- }), o;
1247
- }
1248
- let l = -1;
1249
- for (const h of n) {
1250
- if (l++, l >= u.length && l >= r)
1251
- continue;
1252
- const _ = h._zod.run({
1253
- value: u[l],
1254
- issues: []
1255
- }, i);
1256
- _ instanceof Promise ? s.push(_.then((p) => F(p, o, l))) : F(_, o, l);
1257
- }
1258
- if (t.rest) {
1259
- const h = u.slice(n.length);
1260
- for (const _ of h) {
1261
- l++;
1262
- const p = t.rest._zod.run({
1263
- value: _,
1264
- issues: []
1265
- }, i);
1266
- p instanceof Promise ? s.push(p.then((f) => F(f, o, l))) : F(p, o, l);
1267
- }
1268
- }
1269
- return s.length ? Promise.all(s).then(() => o) : o;
1270
- };
1271
- });
1272
- function F(e, t, n) {
1273
- e.issues.length && t.issues.push(...ie(n, e.issues)), t.value[n] = e.value;
1274
- }
1275
- const Un = /* @__PURE__ */ c("$ZodEnum", (e, t) => {
1276
- m.init(e, t);
1277
- const n = Qe(t.entries), r = new Set(n);
1278
- e._zod.values = r, e._zod.pattern = new RegExp(`^(${n.filter((o) => nt.has(typeof o)).map((o) => typeof o == "string" ? O(o) : o.toString()).join("|")})$`), e._zod.parse = (o, i) => {
1279
- const u = o.value;
1280
- return r.has(u) || o.issues.push({
1281
- code: "invalid_value",
1282
- values: n,
1283
- input: u,
1284
- inst: e
1285
- }), o;
1286
- };
1287
- }), Fn = /* @__PURE__ */ c("$ZodLiteral", (e, t) => {
1288
- if (m.init(e, t), t.values.length === 0)
1289
- throw new Error("Cannot create literal schema with no valid values");
1290
- e._zod.values = new Set(t.values), e._zod.pattern = new RegExp(`^(${t.values.map((n) => typeof n == "string" ? O(n) : n ? O(n.toString()) : String(n)).join("|")})$`), e._zod.parse = (n, r) => {
1291
- const o = n.value;
1292
- return e._zod.values.has(o) || n.issues.push({
1293
- code: "invalid_value",
1294
- values: t.values,
1295
- input: o,
1296
- inst: e
1297
- }), n;
1298
- };
1299
- }), Ln = /* @__PURE__ */ c("$ZodTransform", (e, t) => {
1300
- m.init(e, t), e._zod.parse = (n, r) => {
1301
- const o = t.transform(n.value, n);
1302
- if (r.async)
1303
- return (o instanceof Promise ? o : Promise.resolve(o)).then((u) => (n.value = u, n));
1304
- if (o instanceof Promise)
1305
- throw new N();
1306
- return n.value = o, n;
1307
- };
1308
- }), Mn = /* @__PURE__ */ c("$ZodOptional", (e, t) => {
1309
- m.init(e, t), e._zod.optin = "optional", e._zod.optout = "optional", d(e._zod, "values", () => t.innerType._zod.values ? /* @__PURE__ */ new Set([...t.innerType._zod.values, void 0]) : void 0), d(e._zod, "pattern", () => {
1310
- const n = t.innerType._zod.pattern;
1311
- return n ? new RegExp(`^(${oe(n.source)})?$`) : void 0;
1312
- }), e._zod.parse = (n, r) => t.innerType._zod.optin === "optional" ? t.innerType._zod.run(n, r) : n.value === void 0 ? n : t.innerType._zod.run(n, r);
1313
- }), Vn = /* @__PURE__ */ c("$ZodNullable", (e, t) => {
1314
- m.init(e, t), d(e._zod, "optin", () => t.innerType._zod.optin), d(e._zod, "optout", () => t.innerType._zod.optout), d(e._zod, "pattern", () => {
1315
- const n = t.innerType._zod.pattern;
1316
- return n ? new RegExp(`^(${oe(n.source)}|null)$`) : void 0;
1317
- }), d(e._zod, "values", () => t.innerType._zod.values ? /* @__PURE__ */ new Set([...t.innerType._zod.values, null]) : void 0), e._zod.parse = (n, r) => n.value === null ? n : t.innerType._zod.run(n, r);
1318
- }), Bn = /* @__PURE__ */ c("$ZodDefault", (e, t) => {
1319
- m.init(e, t), e._zod.optin = "optional", d(e._zod, "values", () => t.innerType._zod.values), e._zod.parse = (n, r) => {
1320
- if (n.value === void 0)
1321
- return n.value = t.defaultValue, n;
1322
- const o = t.innerType._zod.run(n, r);
1323
- return o instanceof Promise ? o.then((i) => de(i, t)) : de(o, t);
1324
- };
1325
- });
1326
- function de(e, t) {
1327
- return e.value === void 0 && (e.value = t.defaultValue), e;
1328
- }
1329
- const Wn = /* @__PURE__ */ c("$ZodPrefault", (e, t) => {
1330
- m.init(e, t), e._zod.optin = "optional", d(e._zod, "values", () => t.innerType._zod.values), e._zod.parse = (n, r) => (n.value === void 0 && (n.value = t.defaultValue), t.innerType._zod.run(n, r));
1331
- }), Gn = /* @__PURE__ */ c("$ZodNonOptional", (e, t) => {
1332
- m.init(e, t), d(e._zod, "values", () => {
1333
- const n = t.innerType._zod.values;
1334
- return n ? new Set([...n].filter((r) => r !== void 0)) : void 0;
1335
- }), e._zod.parse = (n, r) => {
1336
- const o = t.innerType._zod.run(n, r);
1337
- return o instanceof Promise ? o.then((i) => me(i, e)) : me(o, e);
1338
- };
1339
- });
1340
- function me(e, t) {
1341
- return !e.issues.length && e.value === void 0 && e.issues.push({
1342
- code: "invalid_type",
1343
- expected: "nonoptional",
1344
- input: e.value,
1345
- inst: t
1346
- }), e;
1347
- }
1348
- const Jn = /* @__PURE__ */ c("$ZodCatch", (e, t) => {
1349
- m.init(e, t), d(e._zod, "optin", () => t.innerType._zod.optin), d(e._zod, "optout", () => t.innerType._zod.optout), d(e._zod, "values", () => t.innerType._zod.values), e._zod.parse = (n, r) => {
1350
- const o = t.innerType._zod.run(n, r);
1351
- return o instanceof Promise ? o.then((i) => (n.value = i.value, i.issues.length && (n.value = t.catchValue({
1352
- ...n,
1353
- error: {
1354
- issues: i.issues.map((u) => P(u, r, T()))
1355
- },
1356
- input: n.value
1357
- }), n.issues = []), n)) : (n.value = o.value, o.issues.length && (n.value = t.catchValue({
1358
- ...n,
1359
- error: {
1360
- issues: o.issues.map((i) => P(i, r, T()))
1361
- },
1362
- input: n.value
1363
- }), n.issues = []), n);
1364
- };
1365
- }), Kn = /* @__PURE__ */ c("$ZodPipe", (e, t) => {
1366
- m.init(e, t), d(e._zod, "values", () => t.in._zod.values), d(e._zod, "optin", () => t.in._zod.optin), d(e._zod, "optout", () => t.out._zod.optout), d(e._zod, "propValues", () => t.in._zod.propValues), e._zod.parse = (n, r) => {
1367
- const o = t.in._zod.run(n, r);
1368
- return o instanceof Promise ? o.then((i) => _e(i, t, r)) : _e(o, t, r);
1369
- };
1370
- });
1371
- function _e(e, t, n) {
1372
- return e.issues.length ? e : t.out._zod.run({ value: e.value, issues: e.issues }, n);
1373
- }
1374
- const Yn = /* @__PURE__ */ c("$ZodReadonly", (e, t) => {
1375
- m.init(e, t), d(e._zod, "propValues", () => t.innerType._zod.propValues), d(e._zod, "values", () => t.innerType._zod.values), d(e._zod, "optin", () => t.innerType._zod.optin), d(e._zod, "optout", () => t.innerType._zod.optout), e._zod.parse = (n, r) => {
1376
- const o = t.innerType._zod.run(n, r);
1377
- return o instanceof Promise ? o.then(ve) : ve(o);
1378
- };
1379
- });
1380
- function ve(e) {
1381
- return e.value = Object.freeze(e.value), e;
1382
- }
1383
- const Xn = /* @__PURE__ */ c("$ZodCustom", (e, t) => {
1384
- $.init(e, t), m.init(e, t), e._zod.parse = (n, r) => n, e._zod.check = (n) => {
1385
- const r = n.value, o = t.fn(r);
1386
- if (o instanceof Promise)
1387
- return o.then((i) => ge(i, n, r, e));
1388
- ge(o, n, r, e);
1389
- };
1390
- });
1391
- function ge(e, t, n, r) {
1392
- if (!e) {
1393
- const o = {
1394
- code: "custom",
1395
- input: n,
1396
- inst: r,
1397
- // incorporates params.error into issue reporting
1398
- path: [...r._zod.def.path ?? []],
1399
- // incorporates params.error into issue reporting
1400
- continue: !r._zod.def.abort
1401
- // params: inst._zod.def.params,
1402
- };
1403
- r._zod.def.params && (o.params = r._zod.def.params), t.issues.push(D(o));
1404
- }
1405
- }
1406
- class qn {
1407
- constructor() {
1408
- this._map = /* @__PURE__ */ new Map(), this._idmap = /* @__PURE__ */ new Map();
1409
- }
1410
- add(t, ...n) {
1411
- const r = n[0];
1412
- if (this._map.set(t, r), r && typeof r == "object" && "id" in r) {
1413
- if (this._idmap.has(r.id))
1414
- throw new Error(`ID ${r.id} already exists in the registry`);
1415
- this._idmap.set(r.id, t);
1416
- }
1417
- return this;
1418
- }
1419
- clear() {
1420
- return this._map = /* @__PURE__ */ new Map(), this._idmap = /* @__PURE__ */ new Map(), this;
1421
- }
1422
- remove(t) {
1423
- const n = this._map.get(t);
1424
- return n && typeof n == "object" && "id" in n && this._idmap.delete(n.id), this._map.delete(t), this;
1425
- }
1426
- get(t) {
1427
- const n = t._zod.parent;
1428
- if (n) {
1429
- const r = { ...this.get(n) ?? {} };
1430
- delete r.id;
1431
- const o = { ...r, ...this._map.get(t) };
1432
- return Object.keys(o).length ? o : void 0;
1433
- }
1434
- return this._map.get(t);
1435
- }
1436
- has(t) {
1437
- return this._map.has(t);
1438
- }
1439
- }
1440
- function Hn() {
1441
- return new qn();
1442
- }
1443
- const L = /* @__PURE__ */ Hn();
1444
- function Qn(e, t) {
1445
- return new e({
1446
- type: "string",
1447
- ...a(t)
1448
- });
1449
- }
1450
- function er(e, t) {
1451
- return new e({
1452
- type: "string",
1453
- format: "email",
1454
- check: "string_format",
1455
- abort: !1,
1456
- ...a(t)
1457
- });
1458
- }
1459
- function ze(e, t) {
1460
- return new e({
1461
- type: "string",
1462
- format: "guid",
1463
- check: "string_format",
1464
- abort: !1,
1465
- ...a(t)
1466
- });
1467
- }
1468
- function tr(e, t) {
1469
- return new e({
1470
- type: "string",
1471
- format: "uuid",
1472
- check: "string_format",
1473
- abort: !1,
1474
- ...a(t)
1475
- });
1476
- }
1477
- function nr(e, t) {
1478
- return new e({
1479
- type: "string",
1480
- format: "uuid",
1481
- check: "string_format",
1482
- abort: !1,
1483
- version: "v4",
1484
- ...a(t)
1485
- });
1486
- }
1487
- function rr(e, t) {
1488
- return new e({
1489
- type: "string",
1490
- format: "uuid",
1491
- check: "string_format",
1492
- abort: !1,
1493
- version: "v6",
1494
- ...a(t)
1495
- });
1496
- }
1497
- function or(e, t) {
1498
- return new e({
1499
- type: "string",
1500
- format: "uuid",
1501
- check: "string_format",
1502
- abort: !1,
1503
- version: "v7",
1504
- ...a(t)
1505
- });
1506
- }
1507
- function ir(e, t) {
1508
- return new e({
1509
- type: "string",
1510
- format: "url",
1511
- check: "string_format",
1512
- abort: !1,
1513
- ...a(t)
1514
- });
1515
- }
1516
- function ur(e, t) {
1517
- return new e({
1518
- type: "string",
1519
- format: "emoji",
1520
- check: "string_format",
1521
- abort: !1,
1522
- ...a(t)
1523
- });
1524
- }
1525
- function cr(e, t) {
1526
- return new e({
1527
- type: "string",
1528
- format: "nanoid",
1529
- check: "string_format",
1530
- abort: !1,
1531
- ...a(t)
1532
- });
1533
- }
1534
- function sr(e, t) {
1535
- return new e({
1536
- type: "string",
1537
- format: "cuid",
1538
- check: "string_format",
1539
- abort: !1,
1540
- ...a(t)
1541
- });
1542
- }
1543
- function ar(e, t) {
1544
- return new e({
1545
- type: "string",
1546
- format: "cuid2",
1547
- check: "string_format",
1548
- abort: !1,
1549
- ...a(t)
1550
- });
1551
- }
1552
- function lr(e, t) {
1553
- return new e({
1554
- type: "string",
1555
- format: "ulid",
1556
- check: "string_format",
1557
- abort: !1,
1558
- ...a(t)
1559
- });
1560
- }
1561
- function pr(e, t) {
1562
- return new e({
1563
- type: "string",
1564
- format: "xid",
1565
- check: "string_format",
1566
- abort: !1,
1567
- ...a(t)
1568
- });
1569
- }
1570
- function hr(e, t) {
1571
- return new e({
1572
- type: "string",
1573
- format: "ksuid",
1574
- check: "string_format",
1575
- abort: !1,
1576
- ...a(t)
1577
- });
1578
- }
1579
- function fr(e, t) {
1580
- return new e({
1581
- type: "string",
1582
- format: "ipv4",
1583
- check: "string_format",
1584
- abort: !1,
1585
- ...a(t)
1586
- });
1587
- }
1588
- function dr(e, t) {
1589
- return new e({
1590
- type: "string",
1591
- format: "ipv6",
1592
- check: "string_format",
1593
- abort: !1,
1594
- ...a(t)
1595
- });
1596
- }
1597
- function mr(e, t) {
1598
- return new e({
1599
- type: "string",
1600
- format: "cidrv4",
1601
- check: "string_format",
1602
- abort: !1,
1603
- ...a(t)
1604
- });
1605
- }
1606
- function _r(e, t) {
1607
- return new e({
1608
- type: "string",
1609
- format: "cidrv6",
1610
- check: "string_format",
1611
- abort: !1,
1612
- ...a(t)
1613
- });
1614
- }
1615
- function vr(e, t) {
1616
- return new e({
1617
- type: "string",
1618
- format: "base64",
1619
- check: "string_format",
1620
- abort: !1,
1621
- ...a(t)
1622
- });
1623
- }
1624
- function gr(e, t) {
1625
- return new e({
1626
- type: "string",
1627
- format: "base64url",
1628
- check: "string_format",
1629
- abort: !1,
1630
- ...a(t)
1631
- });
1632
- }
1633
- function zr(e, t) {
1634
- return new e({
1635
- type: "string",
1636
- format: "e164",
1637
- check: "string_format",
1638
- abort: !1,
1639
- ...a(t)
1640
- });
1641
- }
1642
- function br(e, t) {
1643
- return new e({
1644
- type: "string",
1645
- format: "jwt",
1646
- check: "string_format",
1647
- abort: !1,
1648
- ...a(t)
1649
- });
1650
- }
1651
- function Zr(e, t) {
1652
- return new e({
1653
- type: "string",
1654
- format: "datetime",
1655
- check: "string_format",
1656
- offset: !1,
1657
- local: !1,
1658
- precision: null,
1659
- ...a(t)
1660
- });
1661
- }
1662
- function wr(e, t) {
1663
- return new e({
1664
- type: "string",
1665
- format: "date",
1666
- check: "string_format",
1667
- ...a(t)
1668
- });
1669
- }
1670
- function $r(e, t) {
1671
- return new e({
1672
- type: "string",
1673
- format: "time",
1674
- check: "string_format",
1675
- precision: null,
1676
- ...a(t)
1677
- });
1678
- }
1679
- function kr(e, t) {
1680
- return new e({
1681
- type: "string",
1682
- format: "duration",
1683
- check: "string_format",
1684
- ...a(t)
1685
- });
1686
- }
1687
- function yr(e, t) {
1688
- return new e({
1689
- type: "number",
1690
- checks: [],
1691
- ...a(t)
1692
- });
1693
- }
1694
- function Ir(e, t) {
1695
- return new e({
1696
- type: "number",
1697
- check: "number_format",
1698
- abort: !1,
1699
- format: "safeint",
1700
- ...a(t)
1701
- });
1702
- }
1703
- function Er(e, t) {
1704
- return new e({
1705
- type: "boolean",
1706
- ...a(t)
1707
- });
1708
- }
1709
- function Tr(e) {
1710
- return new e({
1711
- type: "unknown"
1712
- });
1713
- }
1714
- function Pr(e, t) {
1715
- return new e({
1716
- type: "never",
1717
- ...a(t)
1718
- });
1719
- }
1720
- function be(e, t) {
1721
- return new Fe({
1722
- check: "less_than",
1723
- ...a(t),
1724
- value: e,
1725
- inclusive: !1
1726
- });
1727
- }
1728
- function K(e, t) {
1729
- return new Fe({
1730
- check: "less_than",
1731
- ...a(t),
1732
- value: e,
1733
- inclusive: !0
1734
- });
1735
- }
1736
- function Ze(e, t) {
1737
- return new Le({
1738
- check: "greater_than",
1739
- ...a(t),
1740
- value: e,
1741
- inclusive: !1
1742
- });
1743
- }
1744
- function Y(e, t) {
1745
- return new Le({
1746
- check: "greater_than",
1747
- ...a(t),
1748
- value: e,
1749
- inclusive: !0
1750
- });
1751
- }
1752
- function we(e, t) {
1753
- return new Bt({
1754
- check: "multiple_of",
1755
- ...a(t),
1756
- value: e
1757
- });
1758
- }
1759
- function Be(e, t) {
1760
- return new Gt({
1761
- check: "max_length",
1762
- ...a(t),
1763
- maximum: e
1764
- });
1765
- }
1766
- function V(e, t) {
1767
- return new Jt({
1768
- check: "min_length",
1769
- ...a(t),
1770
- minimum: e
1771
- });
1772
- }
1773
- function We(e, t) {
1774
- return new Kt({
1775
- check: "length_equals",
1776
- ...a(t),
1777
- length: e
1778
- });
1779
- }
1780
- function xr(e, t) {
1781
- return new Yt({
1782
- check: "string_format",
1783
- format: "regex",
1784
- ...a(t),
1785
- pattern: e
1786
- });
1787
- }
1788
- function Or(e) {
1789
- return new Xt({
1790
- check: "string_format",
1791
- format: "lowercase",
1792
- ...a(e)
1793
- });
1794
- }
1795
- function Sr(e) {
1796
- return new qt({
1797
- check: "string_format",
1798
- format: "uppercase",
1799
- ...a(e)
1800
- });
1801
- }
1802
- function Ar(e, t) {
1803
- return new Ht({
1804
- check: "string_format",
1805
- format: "includes",
1806
- ...a(t),
1807
- includes: e
1808
- });
1809
- }
1810
- function Nr(e, t) {
1811
- return new Qt({
1812
- check: "string_format",
1813
- format: "starts_with",
1814
- ...a(t),
1815
- prefix: e
1816
- });
1817
- }
1818
- function Dr(e, t) {
1819
- return new en({
1820
- check: "string_format",
1821
- format: "ends_with",
1822
- ...a(t),
1823
- suffix: e
1824
- });
1825
- }
1826
- function j(e) {
1827
- return new tn({
1828
- check: "overwrite",
1829
- tx: e
1830
- });
1831
- }
1832
- function jr(e) {
1833
- return j((t) => t.normalize(e));
1834
- }
1835
- function Rr() {
1836
- return j((e) => e.trim());
1837
- }
1838
- function Cr() {
1839
- return j((e) => e.toLowerCase());
1840
- }
1841
- function Ur() {
1842
- return j((e) => e.toUpperCase());
1843
- }
1844
- function Fr(e, t, n) {
1845
- return new e({
1846
- type: "array",
1847
- element: t,
1848
- // get element() {
1849
- // return element;
1850
- // },
1851
- ...a(n)
1852
- });
1853
- }
1854
- function Lr(e, t, n) {
1855
- return new e({
1856
- type: "custom",
1857
- check: "custom",
1858
- fn: t,
1859
- ...a(n)
1860
- });
1861
- }
1862
- const Mr = /* @__PURE__ */ c("ZodISODateTime", (e, t) => {
1863
- _n.init(e, t), z.init(e, t);
1864
- });
1865
- function Vr(e) {
1866
- return Zr(Mr, e);
1867
- }
1868
- const Br = /* @__PURE__ */ c("ZodISODate", (e, t) => {
1869
- vn.init(e, t), z.init(e, t);
1870
- });
1871
- function Wr(e) {
1872
- return wr(Br, e);
1873
- }
1874
- const Gr = /* @__PURE__ */ c("ZodISOTime", (e, t) => {
1875
- gn.init(e, t), z.init(e, t);
1876
- });
1877
- function Jr(e) {
1878
- return $r(Gr, e);
1879
- }
1880
- const Kr = /* @__PURE__ */ c("ZodISODuration", (e, t) => {
1881
- zn.init(e, t), z.init(e, t);
1882
- });
1883
- function Yr(e) {
1884
- return kr(Kr, e);
1885
- }
1886
- const Xr = (e, t) => {
1887
- Se.init(e, t), e.name = "ZodError", Object.defineProperties(e, {
1888
- format: {
1889
- value: (n) => ht(e, n)
1890
- // enumerable: false,
1891
- },
1892
- flatten: {
1893
- value: (n) => pt(e, n)
1894
- // enumerable: false,
1895
- },
1896
- addIssue: {
1897
- value: (n) => {
1898
- e.issues.push(n), e.message = JSON.stringify(e.issues, X, 2);
1899
- }
1900
- // enumerable: false,
1901
- },
1902
- addIssues: {
1903
- value: (n) => {
1904
- e.issues.push(...n), e.message = JSON.stringify(e.issues, X, 2);
1905
- }
1906
- // enumerable: false,
1907
- },
1908
- isEmpty: {
1909
- get() {
1910
- return e.issues.length === 0;
1911
- }
1912
- // enumerable: false,
1913
- }
1914
- });
1915
- }, W = c("ZodError", Xr, {
1916
- Parent: Error
1917
- }), qr = /* @__PURE__ */ ft(W), Hr = /* @__PURE__ */ dt(W), Qr = /* @__PURE__ */ Ne(W), eo = /* @__PURE__ */ De(W), b = /* @__PURE__ */ c("ZodType", (e, t) => (m.init(e, t), e.def = t, Object.defineProperty(e, "_def", { value: t }), e.check = (...n) => e.clone(
1918
- {
1919
- ...t,
1920
- checks: [
1921
- ...t.checks ?? [],
1922
- ...n.map((r) => typeof r == "function" ? { _zod: { check: r, def: { check: "custom" }, onattach: [] } } : r)
1923
- ]
1924
- }
1925
- // { parent: true }
1926
- ), e.clone = (n, r) => x(e, n, r), e.brand = () => e, e.register = (n, r) => (n.add(e, r), e), e.parse = (n, r) => qr(e, n, r, { callee: e.parse }), e.safeParse = (n, r) => Qr(e, n, r), e.parseAsync = async (n, r) => Hr(e, n, r, { callee: e.parseAsync }), e.safeParseAsync = async (n, r) => eo(e, n, r), e.spa = e.safeParseAsync, e.refine = (n, r) => e.check(Ko(n, r)), e.superRefine = (n) => e.check(Yo(n)), e.overwrite = (n) => e.check(j(n)), e.optional = () => ye(e), e.nullable = () => Ie(e), e.nullish = () => ye(Ie(e)), e.nonoptional = (n) => Fo(e, n), e.array = () => yo(e), e.or = (n) => Eo([e, n]), e.and = (n) => Po(e, n), e.transform = (n) => Ee(e, No(n)), e.default = (n) => Ro(e, n), e.prefault = (n) => Uo(e, n), e.catch = (n) => Mo(e, n), e.pipe = (n) => Ee(e, n), e.readonly = () => Wo(e), e.describe = (n) => {
1927
- const r = e.clone();
1928
- return L.add(r, { description: n }), r;
1929
- }, Object.defineProperty(e, "description", {
1930
- get() {
1931
- return L.get(e)?.description;
1932
- },
1933
- configurable: !0
1934
- }), e.meta = (...n) => {
1935
- if (n.length === 0)
1936
- return L.get(e);
1937
- const r = e.clone();
1938
- return L.add(r, n[0]), r;
1939
- }, e.isOptional = () => e.safeParse(void 0).success, e.isNullable = () => e.safeParse(null).success, e)), Ge = /* @__PURE__ */ c("_ZodString", (e, t) => {
1940
- ce.init(e, t), b.init(e, t);
1941
- const n = e._zod.bag;
1942
- e.format = n.format ?? null, e.minLength = n.minimum ?? null, e.maxLength = n.maximum ?? null, e.regex = (...r) => e.check(xr(...r)), e.includes = (...r) => e.check(Ar(...r)), e.startsWith = (...r) => e.check(Nr(...r)), e.endsWith = (...r) => e.check(Dr(...r)), e.min = (...r) => e.check(V(...r)), e.max = (...r) => e.check(Be(...r)), e.length = (...r) => e.check(We(...r)), e.nonempty = (...r) => e.check(V(1, ...r)), e.lowercase = (r) => e.check(Or(r)), e.uppercase = (r) => e.check(Sr(r)), e.trim = () => e.check(Rr()), e.normalize = (...r) => e.check(jr(...r)), e.toLowerCase = () => e.check(Cr()), e.toUpperCase = () => e.check(Ur());
1943
- }), to = /* @__PURE__ */ c("ZodString", (e, t) => {
1944
- ce.init(e, t), Ge.init(e, t), e.email = (n) => e.check(er(no, n)), e.url = (n) => e.check(ir(ro, n)), e.jwt = (n) => e.check(br(zo, n)), e.emoji = (n) => e.check(ur(oo, n)), e.guid = (n) => e.check(ze($e, n)), e.uuid = (n) => e.check(tr(M, n)), e.uuidv4 = (n) => e.check(nr(M, n)), e.uuidv6 = (n) => e.check(rr(M, n)), e.uuidv7 = (n) => e.check(or(M, n)), e.nanoid = (n) => e.check(cr(io, n)), e.guid = (n) => e.check(ze($e, n)), e.cuid = (n) => e.check(sr(uo, n)), e.cuid2 = (n) => e.check(ar(co, n)), e.ulid = (n) => e.check(lr(so, n)), e.base64 = (n) => e.check(vr(_o, n)), e.base64url = (n) => e.check(gr(vo, n)), e.xid = (n) => e.check(pr(ao, n)), e.ksuid = (n) => e.check(hr(lo, n)), e.ipv4 = (n) => e.check(fr(po, n)), e.ipv6 = (n) => e.check(dr(ho, n)), e.cidrv4 = (n) => e.check(mr(fo, n)), e.cidrv6 = (n) => e.check(_r(mo, n)), e.e164 = (n) => e.check(zr(go, n)), e.datetime = (n) => e.check(Vr(n)), e.date = (n) => e.check(Wr(n)), e.time = (n) => e.check(Jr(n)), e.duration = (n) => e.check(Yr(n));
1945
- });
1946
- function Ho(e) {
1947
- return Qn(to, e);
1948
- }
1949
- const z = /* @__PURE__ */ c("ZodStringFormat", (e, t) => {
1950
- g.init(e, t), Ge.init(e, t);
1951
- }), no = /* @__PURE__ */ c("ZodEmail", (e, t) => {
1952
- cn.init(e, t), z.init(e, t);
1953
- }), $e = /* @__PURE__ */ c("ZodGUID", (e, t) => {
1954
- on.init(e, t), z.init(e, t);
1955
- }), M = /* @__PURE__ */ c("ZodUUID", (e, t) => {
1956
- un.init(e, t), z.init(e, t);
1957
- }), ro = /* @__PURE__ */ c("ZodURL", (e, t) => {
1958
- sn.init(e, t), z.init(e, t);
1959
- }), oo = /* @__PURE__ */ c("ZodEmoji", (e, t) => {
1960
- an.init(e, t), z.init(e, t);
1961
- }), io = /* @__PURE__ */ c("ZodNanoID", (e, t) => {
1962
- ln.init(e, t), z.init(e, t);
1963
- }), uo = /* @__PURE__ */ c("ZodCUID", (e, t) => {
1964
- pn.init(e, t), z.init(e, t);
1965
- }), co = /* @__PURE__ */ c("ZodCUID2", (e, t) => {
1966
- hn.init(e, t), z.init(e, t);
1967
- }), so = /* @__PURE__ */ c("ZodULID", (e, t) => {
1968
- fn.init(e, t), z.init(e, t);
1969
- }), ao = /* @__PURE__ */ c("ZodXID", (e, t) => {
1970
- dn.init(e, t), z.init(e, t);
1971
- }), lo = /* @__PURE__ */ c("ZodKSUID", (e, t) => {
1972
- mn.init(e, t), z.init(e, t);
1973
- }), po = /* @__PURE__ */ c("ZodIPv4", (e, t) => {
1974
- bn.init(e, t), z.init(e, t);
1975
- }), ho = /* @__PURE__ */ c("ZodIPv6", (e, t) => {
1976
- Zn.init(e, t), z.init(e, t);
1977
- }), fo = /* @__PURE__ */ c("ZodCIDRv4", (e, t) => {
1978
- wn.init(e, t), z.init(e, t);
1979
- }), mo = /* @__PURE__ */ c("ZodCIDRv6", (e, t) => {
1980
- $n.init(e, t), z.init(e, t);
1981
- }), _o = /* @__PURE__ */ c("ZodBase64", (e, t) => {
1982
- kn.init(e, t), z.init(e, t);
1983
- }), vo = /* @__PURE__ */ c("ZodBase64URL", (e, t) => {
1984
- In.init(e, t), z.init(e, t);
1985
- }), go = /* @__PURE__ */ c("ZodE164", (e, t) => {
1986
- En.init(e, t), z.init(e, t);
1987
- }), zo = /* @__PURE__ */ c("ZodJWT", (e, t) => {
1988
- Pn.init(e, t), z.init(e, t);
1989
- }), Je = /* @__PURE__ */ c("ZodNumber", (e, t) => {
1990
- Ve.init(e, t), b.init(e, t), e.gt = (r, o) => e.check(Ze(r, o)), e.gte = (r, o) => e.check(Y(r, o)), e.min = (r, o) => e.check(Y(r, o)), e.lt = (r, o) => e.check(be(r, o)), e.lte = (r, o) => e.check(K(r, o)), e.max = (r, o) => e.check(K(r, o)), e.int = (r) => e.check(ke(r)), e.safe = (r) => e.check(ke(r)), e.positive = (r) => e.check(Ze(0, r)), e.nonnegative = (r) => e.check(Y(0, r)), e.negative = (r) => e.check(be(0, r)), e.nonpositive = (r) => e.check(K(0, r)), e.multipleOf = (r, o) => e.check(we(r, o)), e.step = (r, o) => e.check(we(r, o)), e.finite = () => e;
1991
- const n = e._zod.bag;
1992
- e.minValue = Math.max(n.minimum ?? Number.NEGATIVE_INFINITY, n.exclusiveMinimum ?? Number.NEGATIVE_INFINITY) ?? null, e.maxValue = Math.min(n.maximum ?? Number.POSITIVE_INFINITY, n.exclusiveMaximum ?? Number.POSITIVE_INFINITY) ?? null, e.isInt = (n.format ?? "").includes("int") || Number.isSafeInteger(n.multipleOf ?? 0.5), e.isFinite = !0, e.format = n.format ?? null;
1993
- });
1994
- function Qo(e) {
1995
- return yr(Je, e);
1996
- }
1997
- const bo = /* @__PURE__ */ c("ZodNumberFormat", (e, t) => {
1998
- xn.init(e, t), Je.init(e, t);
1999
- });
2000
- function ke(e) {
2001
- return Ir(bo, e);
2002
- }
2003
- const Zo = /* @__PURE__ */ c("ZodBoolean", (e, t) => {
2004
- On.init(e, t), b.init(e, t);
2005
- });
2006
- function ei(e) {
2007
- return Er(Zo, e);
2008
- }
2009
- const wo = /* @__PURE__ */ c("ZodUnknown", (e, t) => {
2010
- Sn.init(e, t), b.init(e, t);
2011
- });
2012
- function ee() {
2013
- return Tr(wo);
2014
- }
2015
- const $o = /* @__PURE__ */ c("ZodNever", (e, t) => {
2016
- An.init(e, t), b.init(e, t);
2017
- });
2018
- function Ke(e) {
2019
- return Pr($o, e);
2020
- }
2021
- const ko = /* @__PURE__ */ c("ZodArray", (e, t) => {
2022
- Nn.init(e, t), b.init(e, t), e.element = t.element, e.min = (n, r) => e.check(V(n, r)), e.nonempty = (n) => e.check(V(1, n)), e.max = (n, r) => e.check(Be(n, r)), e.length = (n, r) => e.check(We(n, r)), e.unwrap = () => e.element;
2023
- });
2024
- function yo(e, t) {
2025
- return Fr(ko, e, t);
2026
- }
2027
- const Ye = /* @__PURE__ */ c("ZodObject", (e, t) => {
2028
- Dn.init(e, t), b.init(e, t), d(e, "shape", () => t.shape), e.keyof = () => Oo(Object.keys(e._zod.def.shape)), e.catchall = (n) => e.clone({ ...e._zod.def, catchall: n }), e.passthrough = () => e.clone({ ...e._zod.def, catchall: ee() }), e.loose = () => e.clone({ ...e._zod.def, catchall: ee() }), e.strict = () => e.clone({ ...e._zod.def, catchall: Ke() }), e.strip = () => e.clone({ ...e._zod.def, catchall: void 0 }), e.extend = (n) => ct(e, n), e.merge = (n) => st(e, n), e.pick = (n) => it(e, n), e.omit = (n) => ut(e, n), e.partial = (...n) => at(Xe, e, n[0]), e.required = (...n) => lt(qe, e, n[0]);
2029
- });
2030
- function ti(e, t) {
2031
- return new Ye({
2032
- type: "object",
2033
- get shape() {
2034
- return E(this, "shape", { ...e }), this.shape;
2035
- },
2036
- catchall: Ke(),
2037
- ...a(t)
2038
- });
2039
- }
2040
- function ni(e, t) {
2041
- return new Ye({
2042
- type: "object",
2043
- get shape() {
2044
- return E(this, "shape", { ...e }), this.shape;
2045
- },
2046
- catchall: ee(),
2047
- ...a(t)
2048
- });
2049
- }
2050
- const Io = /* @__PURE__ */ c("ZodUnion", (e, t) => {
2051
- jn.init(e, t), b.init(e, t), e.options = t.options;
2052
- });
2053
- function Eo(e, t) {
2054
- return new Io({
2055
- type: "union",
2056
- options: e,
2057
- ...a(t)
2058
- });
2059
- }
2060
- const To = /* @__PURE__ */ c("ZodIntersection", (e, t) => {
2061
- Rn.init(e, t), b.init(e, t);
2062
- });
2063
- function Po(e, t) {
2064
- return new To({
2065
- type: "intersection",
2066
- left: e,
2067
- right: t
2068
- });
2069
- }
2070
- const xo = /* @__PURE__ */ c("ZodTuple", (e, t) => {
2071
- Cn.init(e, t), b.init(e, t), e.rest = (n) => e.clone({
2072
- ...e._zod.def,
2073
- rest: n
2074
- });
2075
- });
2076
- function ri(e, t, n) {
2077
- const r = t instanceof m, o = r ? n : t, i = r ? t : null;
2078
- return new xo({
2079
- type: "tuple",
2080
- items: e,
2081
- rest: i,
2082
- ...a(o)
2083
- });
2084
- }
2085
- const te = /* @__PURE__ */ c("ZodEnum", (e, t) => {
2086
- Un.init(e, t), b.init(e, t), e.enum = t.entries, e.options = Object.values(t.entries);
2087
- const n = new Set(Object.keys(t.entries));
2088
- e.extract = (r, o) => {
2089
- const i = {};
2090
- for (const u of r)
2091
- if (n.has(u))
2092
- i[u] = t.entries[u];
2093
- else
2094
- throw new Error(`Key ${u} not found in enum`);
2095
- return new te({
2096
- ...t,
2097
- checks: [],
2098
- ...a(o),
2099
- entries: i
2100
- });
2101
- }, e.exclude = (r, o) => {
2102
- const i = { ...t.entries };
2103
- for (const u of r)
2104
- if (n.has(u))
2105
- delete i[u];
2106
- else
2107
- throw new Error(`Key ${u} not found in enum`);
2108
- return new te({
2109
- ...t,
2110
- checks: [],
2111
- ...a(o),
2112
- entries: i
2113
- });
2114
- };
2115
- });
2116
- function Oo(e, t) {
2117
- const n = Array.isArray(e) ? Object.fromEntries(e.map((r) => [r, r])) : e;
2118
- return new te({
2119
- type: "enum",
2120
- entries: n,
2121
- ...a(t)
2122
- });
2123
- }
2124
- const So = /* @__PURE__ */ c("ZodLiteral", (e, t) => {
2125
- Fn.init(e, t), b.init(e, t), e.values = new Set(t.values), Object.defineProperty(e, "value", {
2126
- get() {
2127
- if (t.values.length > 1)
2128
- throw new Error("This schema contains multiple valid literal values. Use `.values` instead.");
2129
- return t.values[0];
2130
- }
2131
- });
2132
- });
2133
- function oi(e, t) {
2134
- return new So({
2135
- type: "literal",
2136
- values: Array.isArray(e) ? e : [e],
2137
- ...a(t)
2138
- });
2139
- }
2140
- const Ao = /* @__PURE__ */ c("ZodTransform", (e, t) => {
2141
- Ln.init(e, t), b.init(e, t), e._zod.parse = (n, r) => {
2142
- n.addIssue = (i) => {
2143
- if (typeof i == "string")
2144
- n.issues.push(D(i, n.value, t));
2145
- else {
2146
- const u = i;
2147
- u.fatal && (u.continue = !1), u.code ?? (u.code = "custom"), u.input ?? (u.input = n.value), u.inst ?? (u.inst = e), n.issues.push(D(u));
2148
- }
2149
- };
2150
- const o = t.transform(n.value, n);
2151
- return o instanceof Promise ? o.then((i) => (n.value = i, n)) : (n.value = o, n);
2152
- };
2153
- });
2154
- function No(e) {
2155
- return new Ao({
2156
- type: "transform",
2157
- transform: e
2158
- });
2159
- }
2160
- const Xe = /* @__PURE__ */ c("ZodOptional", (e, t) => {
2161
- Mn.init(e, t), b.init(e, t), e.unwrap = () => e._zod.def.innerType;
2162
- });
2163
- function ye(e) {
2164
- return new Xe({
2165
- type: "optional",
2166
- innerType: e
2167
- });
2168
- }
2169
- const Do = /* @__PURE__ */ c("ZodNullable", (e, t) => {
2170
- Vn.init(e, t), b.init(e, t), e.unwrap = () => e._zod.def.innerType;
2171
- });
2172
- function Ie(e) {
2173
- return new Do({
2174
- type: "nullable",
2175
- innerType: e
2176
- });
2177
- }
2178
- const jo = /* @__PURE__ */ c("ZodDefault", (e, t) => {
2179
- Bn.init(e, t), b.init(e, t), e.unwrap = () => e._zod.def.innerType, e.removeDefault = e.unwrap;
2180
- });
2181
- function Ro(e, t) {
2182
- return new jo({
2183
- type: "default",
2184
- innerType: e,
2185
- get defaultValue() {
2186
- return typeof t == "function" ? t() : t;
2187
- }
2188
- });
2189
- }
2190
- const Co = /* @__PURE__ */ c("ZodPrefault", (e, t) => {
2191
- Wn.init(e, t), b.init(e, t), e.unwrap = () => e._zod.def.innerType;
2192
- });
2193
- function Uo(e, t) {
2194
- return new Co({
2195
- type: "prefault",
2196
- innerType: e,
2197
- get defaultValue() {
2198
- return typeof t == "function" ? t() : t;
2199
- }
2200
- });
2201
- }
2202
- const qe = /* @__PURE__ */ c("ZodNonOptional", (e, t) => {
2203
- Gn.init(e, t), b.init(e, t), e.unwrap = () => e._zod.def.innerType;
2204
- });
2205
- function Fo(e, t) {
2206
- return new qe({
2207
- type: "nonoptional",
2208
- innerType: e,
2209
- ...a(t)
2210
- });
2211
- }
2212
- const Lo = /* @__PURE__ */ c("ZodCatch", (e, t) => {
2213
- Jn.init(e, t), b.init(e, t), e.unwrap = () => e._zod.def.innerType, e.removeCatch = e.unwrap;
2214
- });
2215
- function Mo(e, t) {
2216
- return new Lo({
2217
- type: "catch",
2218
- innerType: e,
2219
- catchValue: typeof t == "function" ? t : () => t
2220
- });
2221
- }
2222
- const Vo = /* @__PURE__ */ c("ZodPipe", (e, t) => {
2223
- Kn.init(e, t), b.init(e, t), e.in = t.in, e.out = t.out;
2224
- });
2225
- function Ee(e, t) {
2226
- return new Vo({
2227
- type: "pipe",
2228
- in: e,
2229
- out: t
2230
- // ...util.normalizeParams(params),
2231
- });
2232
- }
2233
- const Bo = /* @__PURE__ */ c("ZodReadonly", (e, t) => {
2234
- Yn.init(e, t), b.init(e, t), e.unwrap = () => e._zod.def.innerType;
2235
- });
2236
- function Wo(e) {
2237
- return new Bo({
2238
- type: "readonly",
2239
- innerType: e
2240
- });
2241
- }
2242
- const Go = /* @__PURE__ */ c("ZodCustom", (e, t) => {
2243
- Xn.init(e, t), b.init(e, t);
2244
- });
2245
- function Jo(e) {
2246
- const t = new $({
2247
- check: "custom"
2248
- // ...util.normalizeParams(params),
2249
- });
2250
- return t._zod.check = e, t;
2251
- }
2252
- function Ko(e, t = {}) {
2253
- return Lr(Go, e, t);
2254
- }
2255
- function Yo(e) {
2256
- const t = Jo((n) => (n.addIssue = (r) => {
2257
- if (typeof r == "string")
2258
- n.issues.push(D(r, n.value, t._zod.def));
2259
- else {
2260
- const o = r;
2261
- o.fatal && (o.continue = !1), o.code ?? (o.code = "custom"), o.input ?? (o.input = n.value), o.inst ?? (o.inst = t), o.continue ?? (o.continue = !t._zod.def.abort), n.issues.push(D(o));
2262
- }
2263
- }, e(n.value, n)));
2264
- return t;
2265
- }
2266
- const Xo = "[DescriptorStrategy] Type cannot be empty.";
2267
- class qo {
2268
- constructor(t, n, r) {
2269
- if (this.type = t, this.schema = n, this.loader = r, !t.trim()) throw new Error(Xo);
2270
- Object.freeze(this);
2271
- }
2272
- validate(t) {
2273
- return this.schema.safeParse(t).success;
2274
- }
2275
- parse(t) {
2276
- return this.schema.parse(t);
2277
- }
2278
- }
2279
- class ne extends qo {
2280
- static FIELD_SLOT = "inputs";
2281
- // @ts-ignore
2282
- buildDescriptor(t) {
2283
- const n = {
2284
- ...this.buildControl(t),
2285
- slot: ne.FIELD_SLOT
2286
- };
2287
- return {
2288
- tag: "field-wrapper",
2289
- props: {
2290
- // @ts-ignore
2291
- title: t.title,
2292
- // @ts-ignore
2293
- description: t.description ?? ""
2294
- },
2295
- child: n,
2296
- slot: ne.FIELD_SLOT
2297
- };
2298
- }
2299
- }
2300
- export {
2301
- qn as $,
2302
- qo as D,
2303
- ne as F,
2304
- Ho as a,
2305
- ei as b,
2306
- Qe as c,
2307
- yo as d,
2308
- oi as e,
2309
- Vr as f,
2310
- L as g,
2311
- ke as i,
2312
- ni as l,
2313
- Qo as n,
2314
- ye as o,
2315
- ti as s,
2316
- ri as t,
2317
- Eo as u
2318
- };