@noxickon/onyx 0.1.0 → 1.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (68) hide show
  1. package/dist/animations.css +264 -0
  2. package/dist/chunks/hooks-DiKvsNs-.js +48 -0
  3. package/dist/chunks/hooks-bJFfbTks.js +8624 -0
  4. package/dist/chunks/query-BhvXa-m6.js +10 -0
  5. package/dist/chunks/query-iDn3qBGF.js +14 -0
  6. package/dist/chunks/ui-ChsTPgui.js +41 -0
  7. package/dist/chunks/ui-DxsSYHCv.js +20634 -0
  8. package/dist/chunks/useAuth-BFgXzu6Q.js +12 -0
  9. package/dist/chunks/useAuth-DxoDe3YA.js +1 -0
  10. package/dist/contexts/contexts.cjs.js +5 -0
  11. package/dist/contexts/contexts.es.js +156 -0
  12. package/dist/contexts.d.ts +117 -0
  13. package/dist/hooks/hooks.cjs.js +1 -6
  14. package/dist/hooks/hooks.es.js +11 -1916
  15. package/dist/hooks.d.ts +79 -21
  16. package/dist/index.d.ts +1782 -268
  17. package/dist/layouts/layouts.cjs.js +1 -0
  18. package/dist/layouts/layouts.es.js +688 -0
  19. package/dist/layouts.d.ts +430 -0
  20. package/dist/onyx.cjs.js +1 -1
  21. package/dist/onyx.es.js +53 -1395
  22. package/dist/pages/pages.cjs.js +2 -2
  23. package/dist/pages/pages.es.js +71 -69
  24. package/dist/pages.d.ts +4 -4
  25. package/dist/routes/routes.cjs.js +1 -0
  26. package/dist/routes/routes.es.js +31 -0
  27. package/dist/routes.d.ts +28 -0
  28. package/dist/shared.css +77 -48
  29. package/dist/ui.css +1 -0
  30. package/dist/utils/utils.cjs.js +1 -1
  31. package/dist/utils/utils.es.js +20 -6
  32. package/dist/utils.d.ts +109 -5
  33. package/package.json +39 -28
  34. package/dist/chunks/AuthContext-CaZKJMxQ.js +0 -2149
  35. package/dist/chunks/AuthContext-uU1aP9gj.js +0 -31
  36. package/dist/chunks/Button-D-v4l8ZE.js +0 -20
  37. package/dist/chunks/Button-bARrxYyo.js +0 -11053
  38. package/dist/chunks/Input-CLi1H63d.js +0 -1
  39. package/dist/chunks/Input-dfvmdIHi.js +0 -138
  40. package/dist/chunks/_commonjsHelpers-C6fGbg64.js +0 -6
  41. package/dist/chunks/_commonjsHelpers-DwGv2jUC.js +0 -1
  42. package/dist/chunks/constants-B1_n9ezb.js +0 -1
  43. package/dist/chunks/constants-CDXq37n6.js +0 -4
  44. package/dist/chunks/errorHelper-DbQKxxQA.js +0 -1
  45. package/dist/chunks/errorHelper-qN6iGI6f.js +0 -18
  46. package/dist/chunks/formatTimestamp-CMxOnPo1.js +0 -12
  47. package/dist/chunks/formatTimestamp-TTsNcy7u.js +0 -1
  48. package/dist/chunks/index-CPwC_oqh.js +0 -561
  49. package/dist/chunks/index-DY808_YF.js +0 -2
  50. package/dist/chunks/isObject-BDHKUJKN.js +0 -1
  51. package/dist/chunks/isObject-vmP43YLW.js +0 -6
  52. package/dist/chunks/jsx-runtime--oOP9f8K.js +0 -284
  53. package/dist/chunks/jsx-runtime-CITbqOLs.js +0 -22
  54. package/dist/chunks/tslib.es6-ci7D5hcx.js +0 -44
  55. package/dist/chunks/tslib.es6-nRfFZWHa.js +0 -1
  56. package/dist/chunks/useAuth-BsWbsZD5.js +0 -1
  57. package/dist/chunks/useAuth-CkaMowHd.js +0 -11
  58. package/dist/chunks/useForm-BuzPPZZE.js +0 -3070
  59. package/dist/chunks/useForm-F8doF8lW.js +0 -18
  60. package/dist/chunks/useQuery-Dh3SZN5S.js +0 -1482
  61. package/dist/chunks/useQuery-y4De9xeL.js +0 -2
  62. package/dist/context/context.cjs.js +0 -1
  63. package/dist/context/context.es.js +0 -39
  64. package/dist/context.d.ts +0 -47
  65. package/dist/index.css +0 -1
  66. package/dist/layout/layout.cjs.js +0 -1
  67. package/dist/layout/layout.es.js +0 -265
  68. package/dist/layout.d.ts +0 -90
@@ -1,3070 +0,0 @@
1
- import { useState as Ee, useMemo as Ae, useCallback as S, useRef as ln } from "react";
2
- import { i as xe } from "./isObject-vmP43YLW.js";
3
- import { _ as he } from "./tslib.es6-ci7D5hcx.js";
4
- import { h as N, l as pn, u as mn, v as hn, D as dn, m as gn, g as _n, e as Oe } from "./index-CPwC_oqh.js";
5
- function vn(e) {
6
- return Number.isSafeInteger(e) && e >= 0;
7
- }
8
- function bn(e) {
9
- return e != null && typeof e != "function" && vn(e.length);
10
- }
11
- function ce(e) {
12
- return e === "__proto__";
13
- }
14
- function nt(e) {
15
- switch (typeof e) {
16
- case "number":
17
- case "symbol":
18
- return !1;
19
- case "string":
20
- return e.includes(".") || e.includes("[") || e.includes("]");
21
- }
22
- }
23
- function rt(e) {
24
- return typeof e == "string" || typeof e == "symbol" ? e : Object.is(e?.valueOf?.(), -0) ? "-0" : String(e);
25
- }
26
- function we(e) {
27
- const t = [], n = e.length;
28
- if (n === 0)
29
- return t;
30
- let r = 0, o = "", i = "", s = !1;
31
- for (e.charCodeAt(0) === 46 && (t.push(""), r++); r < n; ) {
32
- const u = e[r];
33
- i ? u === "\\" && r + 1 < n ? (r++, o += e[r]) : u === i ? i = "" : o += u : s ? u === '"' || u === "'" ? i = u : u === "]" ? (s = !1, t.push(o), o = "") : o += u : u === "[" ? (s = !0, o && (t.push(o), o = "")) : u === "." ? o && (t.push(o), o = "") : o += u, r++;
34
- }
35
- return o && t.push(o), t;
36
- }
37
- function ot(e, t, n) {
38
- if (e == null)
39
- return n;
40
- switch (typeof t) {
41
- case "string": {
42
- if (ce(t))
43
- return n;
44
- const r = e[t];
45
- return r === void 0 ? nt(t) ? ot(e, we(t), n) : n : r;
46
- }
47
- case "number":
48
- case "symbol": {
49
- typeof t == "number" && (t = rt(t));
50
- const r = e[t];
51
- return r === void 0 ? n : r;
52
- }
53
- default: {
54
- if (Array.isArray(t))
55
- return yn(e, t, n);
56
- if (Object.is(t?.valueOf(), -0) ? t = "-0" : t = String(t), ce(t))
57
- return n;
58
- const r = e[t];
59
- return r === void 0 ? n : r;
60
- }
61
- }
62
- }
63
- function yn(e, t, n) {
64
- if (t.length === 0)
65
- return n;
66
- let r = e;
67
- for (let o = 0; o < t.length; o++) {
68
- if (r == null || ce(t[o]))
69
- return n;
70
- r = r[t[o]];
71
- }
72
- return r === void 0 ? n : r;
73
- }
74
- function zn(e) {
75
- return e == null || typeof e != "object" && typeof e != "function";
76
- }
77
- function it(e, t) {
78
- return e === t || Number.isNaN(e) && Number.isNaN(t);
79
- }
80
- function de(e) {
81
- return Object.getOwnPropertySymbols(e).filter((t) => Object.prototype.propertyIsEnumerable.call(e, t));
82
- }
83
- function ue(e) {
84
- return e == null ? e === void 0 ? "[object Undefined]" : "[object Null]" : Object.prototype.toString.call(e);
85
- }
86
- const st = "[object RegExp]", ct = "[object String]", ut = "[object Number]", at = "[object Boolean]", ge = "[object Arguments]", ft = "[object Symbol]", lt = "[object Date]", pt = "[object Map]", mt = "[object Set]", ht = "[object Array]", wn = "[object Function]", dt = "[object ArrayBuffer]", oe = "[object Object]", $n = "[object Error]", gt = "[object DataView]", _t = "[object Uint8Array]", vt = "[object Uint8ClampedArray]", bt = "[object Uint16Array]", yt = "[object Uint32Array]", Zn = "[object BigUint64Array]", zt = "[object Int8Array]", wt = "[object Int16Array]", $t = "[object Int32Array]", kn = "[object BigInt64Array]", Zt = "[object Float32Array]", kt = "[object Float64Array]";
87
- function It(e) {
88
- return ArrayBuffer.isView(e) && !(e instanceof DataView);
89
- }
90
- function B(e, t, n, r = /* @__PURE__ */ new Map(), o = void 0) {
91
- const i = o?.(e, t, n, r);
92
- if (i != null)
93
- return i;
94
- if (zn(e))
95
- return e;
96
- if (r.has(e))
97
- return r.get(e);
98
- if (Array.isArray(e)) {
99
- const s = new Array(e.length);
100
- r.set(e, s);
101
- for (let u = 0; u < e.length; u++)
102
- s[u] = B(e[u], u, n, r, o);
103
- return Object.hasOwn(e, "index") && (s.index = e.index), Object.hasOwn(e, "input") && (s.input = e.input), s;
104
- }
105
- if (e instanceof Date)
106
- return new Date(e.getTime());
107
- if (e instanceof RegExp) {
108
- const s = new RegExp(e.source, e.flags);
109
- return s.lastIndex = e.lastIndex, s;
110
- }
111
- if (e instanceof Map) {
112
- const s = /* @__PURE__ */ new Map();
113
- r.set(e, s);
114
- for (const [u, f] of e)
115
- s.set(u, B(f, u, n, r, o));
116
- return s;
117
- }
118
- if (e instanceof Set) {
119
- const s = /* @__PURE__ */ new Set();
120
- r.set(e, s);
121
- for (const u of e)
122
- s.add(B(u, void 0, n, r, o));
123
- return s;
124
- }
125
- if (typeof Buffer < "u" && Buffer.isBuffer(e))
126
- return e.subarray();
127
- if (It(e)) {
128
- const s = new (Object.getPrototypeOf(e)).constructor(e.length);
129
- r.set(e, s);
130
- for (let u = 0; u < e.length; u++)
131
- s[u] = B(e[u], u, n, r, o);
132
- return s;
133
- }
134
- if (e instanceof ArrayBuffer || typeof SharedArrayBuffer < "u" && e instanceof SharedArrayBuffer)
135
- return e.slice(0);
136
- if (e instanceof DataView) {
137
- const s = new DataView(e.buffer.slice(0), e.byteOffset, e.byteLength);
138
- return r.set(e, s), V(s, e, n, r, o), s;
139
- }
140
- if (typeof File < "u" && e instanceof File) {
141
- const s = new File([e], e.name, {
142
- type: e.type
143
- });
144
- return r.set(e, s), V(s, e, n, r, o), s;
145
- }
146
- if (e instanceof Blob) {
147
- const s = new Blob([e], { type: e.type });
148
- return r.set(e, s), V(s, e, n, r, o), s;
149
- }
150
- if (e instanceof Error) {
151
- const s = new e.constructor();
152
- return r.set(e, s), s.message = e.message, s.name = e.name, s.stack = e.stack, s.cause = e.cause, V(s, e, n, r, o), s;
153
- }
154
- if (typeof e == "object" && In(e)) {
155
- const s = Object.create(Object.getPrototypeOf(e));
156
- return r.set(e, s), V(s, e, n, r, o), s;
157
- }
158
- return e;
159
- }
160
- function V(e, t, n = e, r, o) {
161
- const i = [...Object.keys(t), ...de(t)];
162
- for (let s = 0; s < i.length; s++) {
163
- const u = i[s], f = Object.getOwnPropertyDescriptor(e, u);
164
- (f == null || f.writable) && (e[u] = B(t[u], u, n, r, o));
165
- }
166
- }
167
- function In(e) {
168
- switch (ue(e)) {
169
- case ge:
170
- case ht:
171
- case dt:
172
- case gt:
173
- case at:
174
- case lt:
175
- case Zt:
176
- case kt:
177
- case zt:
178
- case wt:
179
- case $t:
180
- case pt:
181
- case ut:
182
- case oe:
183
- case st:
184
- case mt:
185
- case ct:
186
- case ft:
187
- case _t:
188
- case vt:
189
- case bt:
190
- case yt:
191
- return !0;
192
- default:
193
- return !1;
194
- }
195
- }
196
- function En(e) {
197
- return B(e, void 0, e, /* @__PURE__ */ new Map(), void 0);
198
- }
199
- const An = /^(?:0|[1-9]\d*)$/;
200
- function Et(e, t = Number.MAX_SAFE_INTEGER) {
201
- switch (typeof e) {
202
- case "number":
203
- return Number.isInteger(e) && e >= 0 && e < t;
204
- case "symbol":
205
- return !1;
206
- case "string":
207
- return An.test(e);
208
- }
209
- }
210
- function At(e) {
211
- return e !== null && typeof e == "object" && ue(e) === "[object Arguments]";
212
- }
213
- function Q(e, t) {
214
- let n;
215
- if (Array.isArray(t) ? n = t : typeof t == "string" && nt(t) && e?.[t] == null ? n = we(t) : n = [t], n.length === 0)
216
- return !1;
217
- let r = e;
218
- for (let o = 0; o < n.length; o++) {
219
- const i = n[o];
220
- if ((r == null || !Object.hasOwn(r, i)) && !((Array.isArray(r) || At(r)) && Et(i) && i < r.length))
221
- return !1;
222
- r = r[i];
223
- }
224
- return !0;
225
- }
226
- function xn(e) {
227
- return typeof e == "symbol" || e instanceof Symbol;
228
- }
229
- const On = /\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/, Sn = /^\w*$/;
230
- function Pn(e, t) {
231
- return Array.isArray(e) ? !1 : typeof e == "number" || typeof e == "boolean" || e == null || xn(e) ? !0 : typeof e == "string" && (Sn.test(e) || !On.test(e)) || t != null && Object.hasOwn(t, e);
232
- }
233
- const jn = (e, t, n) => {
234
- const r = e[t];
235
- (!(Object.hasOwn(e, t) && it(r, n)) || n === void 0 && !(t in e)) && (e[t] = n);
236
- };
237
- function Nn(e, t, n, r) {
238
- if (e == null && !xe(e))
239
- return e;
240
- const o = Pn(t, e) ? [t] : Array.isArray(t) ? t : typeof t == "string" ? we(t) : [t];
241
- let i = e;
242
- for (let s = 0; s < o.length && i != null; s++) {
243
- const u = rt(o[s]);
244
- if (ce(u))
245
- continue;
246
- let f;
247
- if (s === o.length - 1)
248
- f = n(i[u]);
249
- else {
250
- const a = i[u], g = r?.(a, u, e);
251
- f = g !== void 0 ? g : xe(a) ? a : Et(o[s + 1]) ? [] : {};
252
- }
253
- jn(i, u, f), i = i[u];
254
- }
255
- return e;
256
- }
257
- function Dn(e, t, n) {
258
- return Nn(e, t, () => n, () => {
259
- });
260
- }
261
- function Se(e) {
262
- if (!e || typeof e != "object")
263
- return !1;
264
- const t = Object.getPrototypeOf(e);
265
- return t === null || t === Object.prototype || Object.getPrototypeOf(t) === null ? Object.prototype.toString.call(e) === "[object Object]" : !1;
266
- }
267
- function Rn(e, t, n) {
268
- return G(e, t, void 0, void 0, void 0, void 0, n);
269
- }
270
- function G(e, t, n, r, o, i, s) {
271
- const u = s(e, t, n, r, o, i);
272
- if (u !== void 0)
273
- return u;
274
- if (typeof e == typeof t)
275
- switch (typeof e) {
276
- case "bigint":
277
- case "string":
278
- case "boolean":
279
- case "symbol":
280
- case "undefined":
281
- return e === t;
282
- case "number":
283
- return e === t || Object.is(e, t);
284
- case "function":
285
- return e === t;
286
- case "object":
287
- return C(e, t, i, s);
288
- }
289
- return C(e, t, i, s);
290
- }
291
- function C(e, t, n, r) {
292
- if (Object.is(e, t))
293
- return !0;
294
- let o = ue(e), i = ue(t);
295
- if (o === ge && (o = oe), i === ge && (i = oe), o !== i)
296
- return !1;
297
- switch (o) {
298
- case ct:
299
- return e.toString() === t.toString();
300
- case ut: {
301
- const f = e.valueOf(), a = t.valueOf();
302
- return it(f, a);
303
- }
304
- case at:
305
- case lt:
306
- case ft:
307
- return Object.is(e.valueOf(), t.valueOf());
308
- case st:
309
- return e.source === t.source && e.flags === t.flags;
310
- case wn:
311
- return e === t;
312
- }
313
- n = n ?? /* @__PURE__ */ new Map();
314
- const s = n.get(e), u = n.get(t);
315
- if (s != null && u != null)
316
- return s === t;
317
- n.set(e, t), n.set(t, e);
318
- try {
319
- switch (o) {
320
- case pt: {
321
- if (e.size !== t.size)
322
- return !1;
323
- for (const [f, a] of e.entries())
324
- if (!t.has(f) || !G(a, t.get(f), f, e, t, n, r))
325
- return !1;
326
- return !0;
327
- }
328
- case mt: {
329
- if (e.size !== t.size)
330
- return !1;
331
- const f = Array.from(e.values()), a = Array.from(t.values());
332
- for (let g = 0; g < f.length; g++) {
333
- const p = f[g], m = a.findIndex((h) => G(p, h, void 0, e, t, n, r));
334
- if (m === -1)
335
- return !1;
336
- a.splice(m, 1);
337
- }
338
- return !0;
339
- }
340
- case ht:
341
- case _t:
342
- case vt:
343
- case bt:
344
- case yt:
345
- case Zn:
346
- case zt:
347
- case wt:
348
- case $t:
349
- case kn:
350
- case Zt:
351
- case kt: {
352
- if (typeof Buffer < "u" && Buffer.isBuffer(e) !== Buffer.isBuffer(t) || e.length !== t.length)
353
- return !1;
354
- for (let f = 0; f < e.length; f++)
355
- if (!G(e[f], t[f], f, e, t, n, r))
356
- return !1;
357
- return !0;
358
- }
359
- case dt:
360
- return e.byteLength !== t.byteLength ? !1 : C(new Uint8Array(e), new Uint8Array(t), n, r);
361
- case gt:
362
- return e.byteLength !== t.byteLength || e.byteOffset !== t.byteOffset ? !1 : C(new Uint8Array(e), new Uint8Array(t), n, r);
363
- case $n:
364
- return e.name === t.name && e.message === t.message;
365
- case oe: {
366
- if (!(C(e.constructor, t.constructor, n, r) || Se(e) && Se(t)))
367
- return !1;
368
- const a = [...Object.keys(e), ...de(e)], g = [...Object.keys(t), ...de(t)];
369
- if (a.length !== g.length)
370
- return !1;
371
- for (let p = 0; p < a.length; p++) {
372
- const m = a[p], h = e[m];
373
- if (!Object.hasOwn(t, m))
374
- return !1;
375
- const I = t[m];
376
- if (!G(h, I, m, e, t, n, r))
377
- return !1;
378
- }
379
- return !0;
380
- }
381
- default:
382
- return !1;
383
- }
384
- } finally {
385
- n.delete(e), n.delete(t);
386
- }
387
- }
388
- function Mn() {
389
- }
390
- function Un(e, t) {
391
- return Rn(e, t, Mn);
392
- }
393
- function Fn(e) {
394
- const t = e?.constructor, n = typeof t == "function" ? t.prototype : Object.prototype;
395
- return e === n;
396
- }
397
- function Tn(e) {
398
- return It(e);
399
- }
400
- function Ln(e, t) {
401
- const n = {}, r = Object.keys(e);
402
- for (let o = 0; o < r.length; o++) {
403
- const i = r[o], s = e[i];
404
- n[i] = t(s, i, e);
405
- }
406
- return n;
407
- }
408
- function xt(e) {
409
- if (e == null)
410
- return !0;
411
- if (bn(e))
412
- return typeof e.splice != "function" && typeof e != "string" && (typeof Buffer > "u" || !Buffer.isBuffer(e)) && !Tn(e) && !At(e) ? !1 : e.length === 0;
413
- if (typeof e == "object") {
414
- if (e instanceof Map || e instanceof Set)
415
- return e.size === 0;
416
- const t = Object.keys(e);
417
- return Fn(e) ? t.filter((n) => n !== "constructor").length === 0 : t.length === 0;
418
- }
419
- return !0;
420
- }
421
- var Bn = pn ? N.useLayoutEffect : N.useEffect;
422
- function Wn(e, t) {
423
- var n = mn(t?.client);
424
- hn(e, dn.Mutation);
425
- var r = N.useState({
426
- called: !1,
427
- loading: !1,
428
- client: n
429
- }), o = r[0], i = r[1], s = N.useRef({
430
- result: o,
431
- mutationId: 0,
432
- isMounted: !0,
433
- client: n,
434
- mutation: e,
435
- options: t
436
- });
437
- Bn(function() {
438
- Object.assign(s.current, { client: n, options: t, mutation: e });
439
- });
440
- var u = N.useCallback(function(a) {
441
- a === void 0 && (a = {});
442
- var g = s.current, p = g.options, m = g.mutation, h = he(he({}, p), { mutation: m }), I = a.client || s.current.client;
443
- !s.current.result.loading && !h.ignoreResults && s.current.isMounted && i(s.current.result = {
444
- loading: !0,
445
- error: void 0,
446
- data: void 0,
447
- called: !0,
448
- client: I
449
- });
450
- var d = ++s.current.mutationId, E = gn(h, a);
451
- return I.mutate(E).then(function(v) {
452
- var _, b, $ = v.data, P = v.errors, O = P && P.length > 0 ? new _n({ graphQLErrors: P }) : void 0, H = a.onError || ((_ = s.current.options) === null || _ === void 0 ? void 0 : _.onError);
453
- if (O && H && H(O, E), d === s.current.mutationId && !E.ignoreResults) {
454
- var Ie = {
455
- called: !0,
456
- loading: !1,
457
- data: $,
458
- error: O,
459
- client: I
460
- };
461
- s.current.isMounted && !Oe(s.current.result, Ie) && i(s.current.result = Ie);
462
- }
463
- var me = a.onCompleted || ((b = s.current.options) === null || b === void 0 ? void 0 : b.onCompleted);
464
- return O || me?.(v.data, E), v;
465
- }, function(v) {
466
- var _;
467
- if (d === s.current.mutationId && s.current.isMounted) {
468
- var b = {
469
- loading: !1,
470
- error: v,
471
- data: void 0,
472
- called: !0,
473
- client: I
474
- };
475
- Oe(s.current.result, b) || i(s.current.result = b);
476
- }
477
- var $ = a.onError || ((_ = s.current.options) === null || _ === void 0 ? void 0 : _.onError);
478
- if ($)
479
- return $(v, E), { data: void 0, errors: v };
480
- throw v;
481
- });
482
- }, []), f = N.useCallback(function() {
483
- if (s.current.isMounted) {
484
- var a = {
485
- called: !1,
486
- loading: !1,
487
- client: s.current.client
488
- };
489
- Object.assign(s.current, { mutationId: 0, result: a }), i(a);
490
- }
491
- }, []);
492
- return N.useEffect(function() {
493
- var a = s.current;
494
- return a.isMounted = !0, function() {
495
- a.isMounted = !1;
496
- };
497
- }, []), [u, he({ reset: f }, o)];
498
- }
499
- function Vn(e, t) {
500
- const n = [], r = [];
501
- for (let o = 0; o < e.length; o++) {
502
- const i = e[o];
503
- t(i) ? n.push(i) : r.push(i);
504
- }
505
- return [n, r];
506
- }
507
- function Gn(e, t) {
508
- const n = { ...e };
509
- for (let r = 0; r < t.length; r++) {
510
- const o = t[r];
511
- delete n[o];
512
- }
513
- return n;
514
- }
515
- function Cn(e) {
516
- return typeof e == "string";
517
- }
518
- function c(e, t, n) {
519
- function r(u, f) {
520
- var a;
521
- Object.defineProperty(u, "_zod", {
522
- value: u._zod ?? {},
523
- enumerable: !1
524
- }), (a = u._zod).traits ?? (a.traits = /* @__PURE__ */ new Set()), u._zod.traits.add(e), t(u, f);
525
- for (const g in s.prototype)
526
- g in u || Object.defineProperty(u, g, { value: s.prototype[g].bind(u) });
527
- u._zod.constr = s, u._zod.def = f;
528
- }
529
- const o = n?.Parent ?? Object;
530
- class i extends o {
531
- }
532
- Object.defineProperty(i, "name", { value: e });
533
- function s(u) {
534
- var f;
535
- const a = n?.Parent ? new i() : this;
536
- r(a, u), (f = a._zod).deferred ?? (f.deferred = []);
537
- for (const g of a._zod.deferred)
538
- g();
539
- return a;
540
- }
541
- return Object.defineProperty(s, "init", { value: r }), Object.defineProperty(s, Symbol.hasInstance, {
542
- value: (u) => n?.Parent && u instanceof n.Parent ? !0 : u?._zod?.traits?.has(e)
543
- }), Object.defineProperty(s, "name", { value: e }), s;
544
- }
545
- class J extends Error {
546
- constructor() {
547
- super("Encountered Promise during synchronous parse. Use .parseAsync() instead.");
548
- }
549
- }
550
- const Ot = {};
551
- function U(e) {
552
- return Ot;
553
- }
554
- function Kn(e) {
555
- const t = Object.values(e).filter((r) => typeof r == "number");
556
- return Object.entries(e).filter(([r, o]) => t.indexOf(+r) === -1).map(([r, o]) => o);
557
- }
558
- function _e(e, t) {
559
- return typeof t == "bigint" ? t.toString() : t;
560
- }
561
- function St(e) {
562
- return {
563
- get value() {
564
- {
565
- const t = e();
566
- return Object.defineProperty(this, "value", { value: t }), t;
567
- }
568
- }
569
- };
570
- }
571
- function q(e) {
572
- return e == null;
573
- }
574
- function $e(e) {
575
- const t = e.startsWith("^") ? 1 : 0, n = e.endsWith("$") ? e.length - 1 : e.length;
576
- return e.slice(t, n);
577
- }
578
- function Jn(e, t) {
579
- 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(".", "")), s = Number.parseInt(t.toFixed(o).replace(".", ""));
580
- return i % s / 10 ** o;
581
- }
582
- function y(e, t, n) {
583
- Object.defineProperty(e, t, {
584
- get() {
585
- {
586
- const r = n();
587
- return e[t] = r, r;
588
- }
589
- },
590
- set(r) {
591
- Object.defineProperty(e, t, {
592
- value: r
593
- // configurable: true,
594
- });
595
- },
596
- configurable: !0
597
- });
598
- }
599
- function T(e, t, n) {
600
- Object.defineProperty(e, t, {
601
- value: n,
602
- writable: !0,
603
- enumerable: !0,
604
- configurable: !0
605
- });
606
- }
607
- function W(...e) {
608
- const t = {};
609
- for (const n of e) {
610
- const r = Object.getOwnPropertyDescriptors(n);
611
- Object.assign(t, r);
612
- }
613
- return Object.defineProperties({}, t);
614
- }
615
- function Pe(e) {
616
- return JSON.stringify(e);
617
- }
618
- const Pt = "captureStackTrace" in Error ? Error.captureStackTrace : (...e) => {
619
- };
620
- function ve(e) {
621
- return typeof e == "object" && e !== null && !Array.isArray(e);
622
- }
623
- const Yn = St(() => {
624
- if (typeof navigator < "u" && navigator?.userAgent?.includes("Cloudflare"))
625
- return !1;
626
- try {
627
- const e = Function;
628
- return new e(""), !0;
629
- } catch {
630
- return !1;
631
- }
632
- });
633
- function be(e) {
634
- if (ve(e) === !1)
635
- return !1;
636
- const t = e.constructor;
637
- if (t === void 0)
638
- return !0;
639
- const n = t.prototype;
640
- return !(ve(n) === !1 || Object.prototype.hasOwnProperty.call(n, "isPrototypeOf") === !1);
641
- }
642
- const qn = /* @__PURE__ */ new Set(["string", "number", "symbol"]);
643
- function fe(e) {
644
- return e.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
645
- }
646
- function L(e, t, n) {
647
- const r = new e._zod.constr(t ?? e._zod.def);
648
- return (!t || n?.parent) && (r._zod.parent = e), r;
649
- }
650
- function l(e) {
651
- const t = e;
652
- if (!t)
653
- return {};
654
- if (typeof t == "string")
655
- return { error: () => t };
656
- if (t?.message !== void 0) {
657
- if (t?.error !== void 0)
658
- throw new Error("Cannot specify both `message` and `error` params");
659
- t.error = t.message;
660
- }
661
- return delete t.message, typeof t.error == "string" ? { ...t, error: () => t.error } : t;
662
- }
663
- function Xn(e) {
664
- return Object.keys(e).filter((t) => e[t]._zod.optin === "optional" && e[t]._zod.optout === "optional");
665
- }
666
- const Hn = {
667
- safeint: [Number.MIN_SAFE_INTEGER, Number.MAX_SAFE_INTEGER],
668
- int32: [-2147483648, 2147483647],
669
- uint32: [0, 4294967295],
670
- float32: [-34028234663852886e22, 34028234663852886e22],
671
- float64: [-Number.MAX_VALUE, Number.MAX_VALUE]
672
- };
673
- function Qn(e, t) {
674
- const n = e._zod.def, r = W(e._zod.def, {
675
- get shape() {
676
- const o = {};
677
- for (const i in t) {
678
- if (!(i in n.shape))
679
- throw new Error(`Unrecognized key: "${i}"`);
680
- t[i] && (o[i] = n.shape[i]);
681
- }
682
- return T(this, "shape", o), o;
683
- },
684
- checks: []
685
- });
686
- return L(e, r);
687
- }
688
- function er(e, t) {
689
- const n = e._zod.def, r = W(e._zod.def, {
690
- get shape() {
691
- const o = { ...e._zod.def.shape };
692
- for (const i in t) {
693
- if (!(i in n.shape))
694
- throw new Error(`Unrecognized key: "${i}"`);
695
- t[i] && delete o[i];
696
- }
697
- return T(this, "shape", o), o;
698
- },
699
- checks: []
700
- });
701
- return L(e, r);
702
- }
703
- function tr(e, t) {
704
- if (!be(t))
705
- throw new Error("Invalid input to extend: expected a plain object");
706
- const n = W(e._zod.def, {
707
- get shape() {
708
- const r = { ...e._zod.def.shape, ...t };
709
- return T(this, "shape", r), r;
710
- },
711
- checks: []
712
- });
713
- return L(e, n);
714
- }
715
- function nr(e, t) {
716
- const n = W(e._zod.def, {
717
- get shape() {
718
- const r = { ...e._zod.def.shape, ...t._zod.def.shape };
719
- return T(this, "shape", r), r;
720
- },
721
- get catchall() {
722
- return t._zod.def.catchall;
723
- },
724
- checks: []
725
- // delete existing checks
726
- });
727
- return L(e, n);
728
- }
729
- function rr(e, t, n) {
730
- const r = W(t._zod.def, {
731
- get shape() {
732
- const o = t._zod.def.shape, i = { ...o };
733
- if (n)
734
- for (const s in n) {
735
- if (!(s in o))
736
- throw new Error(`Unrecognized key: "${s}"`);
737
- n[s] && (i[s] = e ? new e({
738
- type: "optional",
739
- innerType: o[s]
740
- }) : o[s]);
741
- }
742
- else
743
- for (const s in o)
744
- i[s] = e ? new e({
745
- type: "optional",
746
- innerType: o[s]
747
- }) : o[s];
748
- return T(this, "shape", i), i;
749
- },
750
- checks: []
751
- });
752
- return L(t, r);
753
- }
754
- function or(e, t, n) {
755
- const r = W(t._zod.def, {
756
- get shape() {
757
- const o = t._zod.def.shape, i = { ...o };
758
- if (n)
759
- for (const s in n) {
760
- if (!(s in i))
761
- throw new Error(`Unrecognized key: "${s}"`);
762
- n[s] && (i[s] = new e({
763
- type: "nonoptional",
764
- innerType: o[s]
765
- }));
766
- }
767
- else
768
- for (const s in o)
769
- i[s] = new e({
770
- type: "nonoptional",
771
- innerType: o[s]
772
- });
773
- return T(this, "shape", i), i;
774
- },
775
- checks: []
776
- });
777
- return L(t, r);
778
- }
779
- function K(e, t = 0) {
780
- for (let n = t; n < e.issues.length; n++)
781
- if (e.issues[n]?.continue !== !0)
782
- return !0;
783
- return !1;
784
- }
785
- function jt(e, t) {
786
- return t.map((n) => {
787
- var r;
788
- return (r = n).path ?? (r.path = []), n.path.unshift(e), n;
789
- });
790
- }
791
- function ee(e) {
792
- return typeof e == "string" ? e : e?.message;
793
- }
794
- function F(e, t, n) {
795
- const r = { ...e, path: e.path ?? [] };
796
- if (!e.message) {
797
- const o = ee(e.inst?._zod.def?.error?.(e)) ?? ee(t?.error?.(e)) ?? ee(n.customError?.(e)) ?? ee(n.localeError?.(e)) ?? "Invalid input";
798
- r.message = o;
799
- }
800
- return delete r.inst, delete r.continue, t?.reportInput || delete r.input, r;
801
- }
802
- function Nt(e) {
803
- return e instanceof Set ? "set" : e instanceof Map ? "map" : e instanceof File ? "file" : "unknown";
804
- }
805
- function Ze(e) {
806
- return Array.isArray(e) ? "array" : typeof e == "string" ? "string" : "unknown";
807
- }
808
- function Y(...e) {
809
- const [t, n, r] = e;
810
- return typeof t == "string" ? {
811
- message: t,
812
- code: "custom",
813
- input: n,
814
- inst: r
815
- } : { ...t };
816
- }
817
- const Dt = (e, t) => {
818
- e.name = "$ZodError", Object.defineProperty(e, "_zod", {
819
- value: e._zod,
820
- enumerable: !1
821
- }), Object.defineProperty(e, "issues", {
822
- value: t,
823
- enumerable: !1
824
- }), e.message = JSON.stringify(t, _e, 2), Object.defineProperty(e, "toString", {
825
- value: () => e.message,
826
- enumerable: !1
827
- });
828
- }, Rt = c("$ZodError", Dt), Mt = c("$ZodError", Dt, { Parent: Error });
829
- function ir(e, t = (n) => n.message) {
830
- const n = {}, r = [];
831
- for (const o of e.issues)
832
- o.path.length > 0 ? (n[o.path[0]] = n[o.path[0]] || [], n[o.path[0]].push(t(o))) : r.push(t(o));
833
- return { formErrors: r, fieldErrors: n };
834
- }
835
- function sr(e, t) {
836
- const n = t || function(i) {
837
- return i.message;
838
- }, r = { _errors: [] }, o = (i) => {
839
- for (const s of i.issues)
840
- if (s.code === "invalid_union" && s.errors.length)
841
- s.errors.map((u) => o({ issues: u }));
842
- else if (s.code === "invalid_key")
843
- o({ issues: s.issues });
844
- else if (s.code === "invalid_element")
845
- o({ issues: s.issues });
846
- else if (s.path.length === 0)
847
- r._errors.push(n(s));
848
- else {
849
- let u = r, f = 0;
850
- for (; f < s.path.length; ) {
851
- const a = s.path[f];
852
- f === s.path.length - 1 ? (u[a] = u[a] || { _errors: [] }, u[a]._errors.push(n(s))) : u[a] = u[a] || { _errors: [] }, u = u[a], f++;
853
- }
854
- }
855
- };
856
- return o(e), r;
857
- }
858
- const cr = (e) => (t, n, r, o) => {
859
- const i = r ? Object.assign(r, { async: !1 }) : { async: !1 }, s = t._zod.run({ value: n, issues: [] }, i);
860
- if (s instanceof Promise)
861
- throw new J();
862
- if (s.issues.length) {
863
- const u = new (o?.Err ?? e)(s.issues.map((f) => F(f, i, U())));
864
- throw Pt(u, o?.callee), u;
865
- }
866
- return s.value;
867
- }, ur = (e) => async (t, n, r, o) => {
868
- const i = r ? Object.assign(r, { async: !0 }) : { async: !0 };
869
- let s = t._zod.run({ value: n, issues: [] }, i);
870
- if (s instanceof Promise && (s = await s), s.issues.length) {
871
- const u = new (o?.Err ?? e)(s.issues.map((f) => F(f, i, U())));
872
- throw Pt(u, o?.callee), u;
873
- }
874
- return s.value;
875
- }, Ut = (e) => (t, n, r) => {
876
- const o = r ? { ...r, async: !1 } : { async: !1 }, i = t._zod.run({ value: n, issues: [] }, o);
877
- if (i instanceof Promise)
878
- throw new J();
879
- return i.issues.length ? {
880
- success: !1,
881
- error: new (e ?? Rt)(i.issues.map((s) => F(s, o, U())))
882
- } : { success: !0, data: i.value };
883
- }, ar = /* @__PURE__ */ Ut(Mt), Ft = (e) => async (t, n, r) => {
884
- const o = r ? Object.assign(r, { async: !0 }) : { async: !0 };
885
- let i = t._zod.run({ value: n, issues: [] }, o);
886
- return i instanceof Promise && (i = await i), i.issues.length ? {
887
- success: !1,
888
- error: new e(i.issues.map((s) => F(s, o, U())))
889
- } : { success: !0, data: i.value };
890
- }, fr = /* @__PURE__ */ Ft(Mt), lr = /^[cC][^\s-]{8,}$/, pr = /^[0-9a-z]+$/, mr = /^[0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{26}$/, hr = /^[0-9a-vA-V]{20}$/, dr = /^[A-Za-z0-9]{27}$/, gr = /^[a-zA-Z0-9_-]{21}$/, _r = /^P(?:(\d+W)|(?!.*W)(?=\d|T\d)(\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+([.,]\d+)?S)?)?)$/, vr = /^([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})$/, je = (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)$/, br = /^(?!\.)(?!.*\.\.)([A-Za-z0-9_'+\-\.]*)[A-Za-z0-9_+-]@([A-Za-z0-9][A-Za-z0-9\-]*\.)+[A-Za-z]{2,}$/, yr = "^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$";
891
- function zr() {
892
- return new RegExp(yr, "u");
893
- }
894
- const wr = /^(?:(?: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])$/, $r = /^(([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})$/, Zr = /^((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])$/, kr = /^(([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])$/, Ir = /^$|^(?:[0-9a-zA-Z+/]{4})*(?:(?:[0-9a-zA-Z+/]{2}==)|(?:[0-9a-zA-Z+/]{3}=))?$/, Tt = /^[A-Za-z0-9_-]*$/, Er = /^([a-zA-Z0-9-]+\.)*[a-zA-Z0-9-]+$/, Ar = /^\+(?:[0-9]){6,14}[0-9]$/, Lt = "(?:(?:\\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])))", xr = /* @__PURE__ */ new RegExp(`^${Lt}$`);
895
- function Bt(e) {
896
- const t = "(?:[01]\\d|2[0-3]):[0-5]\\d";
897
- 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+)?)?`;
898
- }
899
- function Or(e) {
900
- return new RegExp(`^${Bt(e)}$`);
901
- }
902
- function Sr(e) {
903
- const t = Bt({ precision: e.precision }), n = ["Z"];
904
- e.local && n.push(""), e.offset && n.push("([+-]\\d{2}:\\d{2})");
905
- const r = `${t}(?:${n.join("|")})`;
906
- return new RegExp(`^${Lt}T(?:${r})$`);
907
- }
908
- const Pr = (e) => {
909
- const t = e ? `[\\s\\S]{${e?.minimum ?? 0},${e?.maximum ?? ""}}` : "[\\s\\S]*";
910
- return new RegExp(`^${t}$`);
911
- }, jr = /^\d+$/, Nr = /^-?\d+(?:\.\d+)?/i, Dr = /true|false/i, Rr = /^[^A-Z]*$/, Mr = /^[^a-z]*$/, A = /* @__PURE__ */ c("$ZodCheck", (e, t) => {
912
- var n;
913
- e._zod ?? (e._zod = {}), e._zod.def = t, (n = e._zod).onattach ?? (n.onattach = []);
914
- }), Wt = {
915
- number: "number",
916
- bigint: "bigint",
917
- object: "date"
918
- }, Vt = /* @__PURE__ */ c("$ZodCheckLessThan", (e, t) => {
919
- A.init(e, t);
920
- const n = Wt[typeof t.value];
921
- e._zod.onattach.push((r) => {
922
- const o = r._zod.bag, i = (t.inclusive ? o.maximum : o.exclusiveMaximum) ?? Number.POSITIVE_INFINITY;
923
- t.value < i && (t.inclusive ? o.maximum = t.value : o.exclusiveMaximum = t.value);
924
- }), e._zod.check = (r) => {
925
- (t.inclusive ? r.value <= t.value : r.value < t.value) || r.issues.push({
926
- origin: n,
927
- code: "too_big",
928
- maximum: t.value,
929
- input: r.value,
930
- inclusive: t.inclusive,
931
- inst: e,
932
- continue: !t.abort
933
- });
934
- };
935
- }), Gt = /* @__PURE__ */ c("$ZodCheckGreaterThan", (e, t) => {
936
- A.init(e, t);
937
- const n = Wt[typeof t.value];
938
- e._zod.onattach.push((r) => {
939
- const o = r._zod.bag, i = (t.inclusive ? o.minimum : o.exclusiveMinimum) ?? Number.NEGATIVE_INFINITY;
940
- t.value > i && (t.inclusive ? o.minimum = t.value : o.exclusiveMinimum = t.value);
941
- }), e._zod.check = (r) => {
942
- (t.inclusive ? r.value >= t.value : r.value > t.value) || r.issues.push({
943
- origin: n,
944
- code: "too_small",
945
- minimum: t.value,
946
- input: r.value,
947
- inclusive: t.inclusive,
948
- inst: e,
949
- continue: !t.abort
950
- });
951
- };
952
- }), Ur = /* @__PURE__ */ c("$ZodCheckMultipleOf", (e, t) => {
953
- A.init(e, t), e._zod.onattach.push((n) => {
954
- var r;
955
- (r = n._zod.bag).multipleOf ?? (r.multipleOf = t.value);
956
- }), e._zod.check = (n) => {
957
- if (typeof n.value != typeof t.value)
958
- throw new Error("Cannot mix number and bigint in multiple_of check.");
959
- (typeof n.value == "bigint" ? n.value % t.value === BigInt(0) : Jn(n.value, t.value) === 0) || n.issues.push({
960
- origin: typeof n.value,
961
- code: "not_multiple_of",
962
- divisor: t.value,
963
- input: n.value,
964
- inst: e,
965
- continue: !t.abort
966
- });
967
- };
968
- }), Fr = /* @__PURE__ */ c("$ZodCheckNumberFormat", (e, t) => {
969
- A.init(e, t), t.format = t.format || "float64";
970
- const n = t.format?.includes("int"), r = n ? "int" : "number", [o, i] = Hn[t.format];
971
- e._zod.onattach.push((s) => {
972
- const u = s._zod.bag;
973
- u.format = t.format, u.minimum = o, u.maximum = i, n && (u.pattern = jr);
974
- }), e._zod.check = (s) => {
975
- const u = s.value;
976
- if (n) {
977
- if (!Number.isInteger(u)) {
978
- s.issues.push({
979
- expected: r,
980
- format: t.format,
981
- code: "invalid_type",
982
- input: u,
983
- inst: e
984
- });
985
- return;
986
- }
987
- if (!Number.isSafeInteger(u)) {
988
- u > 0 ? s.issues.push({
989
- input: u,
990
- code: "too_big",
991
- maximum: Number.MAX_SAFE_INTEGER,
992
- note: "Integers must be within the safe integer range.",
993
- inst: e,
994
- origin: r,
995
- continue: !t.abort
996
- }) : s.issues.push({
997
- input: u,
998
- code: "too_small",
999
- minimum: Number.MIN_SAFE_INTEGER,
1000
- note: "Integers must be within the safe integer range.",
1001
- inst: e,
1002
- origin: r,
1003
- continue: !t.abort
1004
- });
1005
- return;
1006
- }
1007
- }
1008
- u < o && s.issues.push({
1009
- origin: "number",
1010
- input: u,
1011
- code: "too_small",
1012
- minimum: o,
1013
- inclusive: !0,
1014
- inst: e,
1015
- continue: !t.abort
1016
- }), u > i && s.issues.push({
1017
- origin: "number",
1018
- input: u,
1019
- code: "too_big",
1020
- maximum: i,
1021
- inst: e
1022
- });
1023
- };
1024
- }), Tr = /* @__PURE__ */ c("$ZodCheckMaxSize", (e, t) => {
1025
- var n;
1026
- A.init(e, t), (n = e._zod.def).when ?? (n.when = (r) => {
1027
- const o = r.value;
1028
- return !q(o) && o.size !== void 0;
1029
- }), e._zod.onattach.push((r) => {
1030
- const o = r._zod.bag.maximum ?? Number.POSITIVE_INFINITY;
1031
- t.maximum < o && (r._zod.bag.maximum = t.maximum);
1032
- }), e._zod.check = (r) => {
1033
- const o = r.value;
1034
- o.size <= t.maximum || r.issues.push({
1035
- origin: Nt(o),
1036
- code: "too_big",
1037
- maximum: t.maximum,
1038
- input: o,
1039
- inst: e,
1040
- continue: !t.abort
1041
- });
1042
- };
1043
- }), Lr = /* @__PURE__ */ c("$ZodCheckMinSize", (e, t) => {
1044
- var n;
1045
- A.init(e, t), (n = e._zod.def).when ?? (n.when = (r) => {
1046
- const o = r.value;
1047
- return !q(o) && o.size !== void 0;
1048
- }), e._zod.onattach.push((r) => {
1049
- const o = r._zod.bag.minimum ?? Number.NEGATIVE_INFINITY;
1050
- t.minimum > o && (r._zod.bag.minimum = t.minimum);
1051
- }), e._zod.check = (r) => {
1052
- const o = r.value;
1053
- o.size >= t.minimum || r.issues.push({
1054
- origin: Nt(o),
1055
- code: "too_small",
1056
- minimum: t.minimum,
1057
- input: o,
1058
- inst: e,
1059
- continue: !t.abort
1060
- });
1061
- };
1062
- }), Br = /* @__PURE__ */ c("$ZodCheckMaxLength", (e, t) => {
1063
- var n;
1064
- A.init(e, t), (n = e._zod.def).when ?? (n.when = (r) => {
1065
- const o = r.value;
1066
- return !q(o) && o.length !== void 0;
1067
- }), e._zod.onattach.push((r) => {
1068
- const o = r._zod.bag.maximum ?? Number.POSITIVE_INFINITY;
1069
- t.maximum < o && (r._zod.bag.maximum = t.maximum);
1070
- }), e._zod.check = (r) => {
1071
- const o = r.value;
1072
- if (o.length <= t.maximum)
1073
- return;
1074
- const s = Ze(o);
1075
- r.issues.push({
1076
- origin: s,
1077
- code: "too_big",
1078
- maximum: t.maximum,
1079
- inclusive: !0,
1080
- input: o,
1081
- inst: e,
1082
- continue: !t.abort
1083
- });
1084
- };
1085
- }), Wr = /* @__PURE__ */ c("$ZodCheckMinLength", (e, t) => {
1086
- var n;
1087
- A.init(e, t), (n = e._zod.def).when ?? (n.when = (r) => {
1088
- const o = r.value;
1089
- return !q(o) && o.length !== void 0;
1090
- }), e._zod.onattach.push((r) => {
1091
- const o = r._zod.bag.minimum ?? Number.NEGATIVE_INFINITY;
1092
- t.minimum > o && (r._zod.bag.minimum = t.minimum);
1093
- }), e._zod.check = (r) => {
1094
- const o = r.value;
1095
- if (o.length >= t.minimum)
1096
- return;
1097
- const s = Ze(o);
1098
- r.issues.push({
1099
- origin: s,
1100
- code: "too_small",
1101
- minimum: t.minimum,
1102
- inclusive: !0,
1103
- input: o,
1104
- inst: e,
1105
- continue: !t.abort
1106
- });
1107
- };
1108
- }), Vr = /* @__PURE__ */ c("$ZodCheckLengthEquals", (e, t) => {
1109
- var n;
1110
- A.init(e, t), (n = e._zod.def).when ?? (n.when = (r) => {
1111
- const o = r.value;
1112
- return !q(o) && o.length !== void 0;
1113
- }), e._zod.onattach.push((r) => {
1114
- const o = r._zod.bag;
1115
- o.minimum = t.length, o.maximum = t.length, o.length = t.length;
1116
- }), e._zod.check = (r) => {
1117
- const o = r.value, i = o.length;
1118
- if (i === t.length)
1119
- return;
1120
- const s = Ze(o), u = i > t.length;
1121
- r.issues.push({
1122
- origin: s,
1123
- ...u ? { code: "too_big", maximum: t.length } : { code: "too_small", minimum: t.length },
1124
- inclusive: !0,
1125
- exact: !0,
1126
- input: r.value,
1127
- inst: e,
1128
- continue: !t.abort
1129
- });
1130
- };
1131
- }), le = /* @__PURE__ */ c("$ZodCheckStringFormat", (e, t) => {
1132
- var n, r;
1133
- A.init(e, t), e._zod.onattach.push((o) => {
1134
- const i = o._zod.bag;
1135
- i.format = t.format, t.pattern && (i.patterns ?? (i.patterns = /* @__PURE__ */ new Set()), i.patterns.add(t.pattern));
1136
- }), t.pattern ? (n = e._zod).check ?? (n.check = (o) => {
1137
- t.pattern.lastIndex = 0, !t.pattern.test(o.value) && o.issues.push({
1138
- origin: "string",
1139
- code: "invalid_format",
1140
- format: t.format,
1141
- input: o.value,
1142
- ...t.pattern ? { pattern: t.pattern.toString() } : {},
1143
- inst: e,
1144
- continue: !t.abort
1145
- });
1146
- }) : (r = e._zod).check ?? (r.check = () => {
1147
- });
1148
- }), Gr = /* @__PURE__ */ c("$ZodCheckRegex", (e, t) => {
1149
- le.init(e, t), e._zod.check = (n) => {
1150
- t.pattern.lastIndex = 0, !t.pattern.test(n.value) && n.issues.push({
1151
- origin: "string",
1152
- code: "invalid_format",
1153
- format: "regex",
1154
- input: n.value,
1155
- pattern: t.pattern.toString(),
1156
- inst: e,
1157
- continue: !t.abort
1158
- });
1159
- };
1160
- }), Cr = /* @__PURE__ */ c("$ZodCheckLowerCase", (e, t) => {
1161
- t.pattern ?? (t.pattern = Rr), le.init(e, t);
1162
- }), Kr = /* @__PURE__ */ c("$ZodCheckUpperCase", (e, t) => {
1163
- t.pattern ?? (t.pattern = Mr), le.init(e, t);
1164
- }), Jr = /* @__PURE__ */ c("$ZodCheckIncludes", (e, t) => {
1165
- A.init(e, t);
1166
- const n = fe(t.includes), r = new RegExp(typeof t.position == "number" ? `^.{${t.position}}${n}` : n);
1167
- t.pattern = r, e._zod.onattach.push((o) => {
1168
- const i = o._zod.bag;
1169
- i.patterns ?? (i.patterns = /* @__PURE__ */ new Set()), i.patterns.add(r);
1170
- }), e._zod.check = (o) => {
1171
- o.value.includes(t.includes, t.position) || o.issues.push({
1172
- origin: "string",
1173
- code: "invalid_format",
1174
- format: "includes",
1175
- includes: t.includes,
1176
- input: o.value,
1177
- inst: e,
1178
- continue: !t.abort
1179
- });
1180
- };
1181
- }), Yr = /* @__PURE__ */ c("$ZodCheckStartsWith", (e, t) => {
1182
- A.init(e, t);
1183
- const n = new RegExp(`^${fe(t.prefix)}.*`);
1184
- t.pattern ?? (t.pattern = n), e._zod.onattach.push((r) => {
1185
- const o = r._zod.bag;
1186
- o.patterns ?? (o.patterns = /* @__PURE__ */ new Set()), o.patterns.add(n);
1187
- }), e._zod.check = (r) => {
1188
- r.value.startsWith(t.prefix) || r.issues.push({
1189
- origin: "string",
1190
- code: "invalid_format",
1191
- format: "starts_with",
1192
- prefix: t.prefix,
1193
- input: r.value,
1194
- inst: e,
1195
- continue: !t.abort
1196
- });
1197
- };
1198
- }), qr = /* @__PURE__ */ c("$ZodCheckEndsWith", (e, t) => {
1199
- A.init(e, t);
1200
- const n = new RegExp(`.*${fe(t.suffix)}$`);
1201
- t.pattern ?? (t.pattern = n), e._zod.onattach.push((r) => {
1202
- const o = r._zod.bag;
1203
- o.patterns ?? (o.patterns = /* @__PURE__ */ new Set()), o.patterns.add(n);
1204
- }), e._zod.check = (r) => {
1205
- r.value.endsWith(t.suffix) || r.issues.push({
1206
- origin: "string",
1207
- code: "invalid_format",
1208
- format: "ends_with",
1209
- suffix: t.suffix,
1210
- input: r.value,
1211
- inst: e,
1212
- continue: !t.abort
1213
- });
1214
- };
1215
- }), Xr = /* @__PURE__ */ c("$ZodCheckMimeType", (e, t) => {
1216
- A.init(e, t);
1217
- const n = new Set(t.mime);
1218
- e._zod.onattach.push((r) => {
1219
- r._zod.bag.mime = t.mime;
1220
- }), e._zod.check = (r) => {
1221
- n.has(r.value.type) || r.issues.push({
1222
- code: "invalid_value",
1223
- values: t.mime,
1224
- input: r.value.type,
1225
- inst: e
1226
- });
1227
- };
1228
- }), Hr = /* @__PURE__ */ c("$ZodCheckOverwrite", (e, t) => {
1229
- A.init(e, t), e._zod.check = (n) => {
1230
- n.value = t.tx(n.value);
1231
- };
1232
- });
1233
- class Qr {
1234
- constructor(t = []) {
1235
- this.content = [], this.indent = 0, this && (this.args = t);
1236
- }
1237
- indented(t) {
1238
- this.indent += 1, t(this), this.indent -= 1;
1239
- }
1240
- write(t) {
1241
- if (typeof t == "function") {
1242
- t(this, { execution: "sync" }), t(this, { execution: "async" });
1243
- return;
1244
- }
1245
- const r = t.split(`
1246
- `).filter((s) => s), o = Math.min(...r.map((s) => s.length - s.trimStart().length)), i = r.map((s) => s.slice(o)).map((s) => " ".repeat(this.indent * 2) + s);
1247
- for (const s of i)
1248
- this.content.push(s);
1249
- }
1250
- compile() {
1251
- const t = Function, n = this?.args, o = [...(this?.content ?? [""]).map((i) => ` ${i}`)];
1252
- return new t(...n, o.join(`
1253
- `));
1254
- }
1255
- }
1256
- const eo = {
1257
- major: 4,
1258
- minor: 0,
1259
- patch: 10
1260
- }, z = /* @__PURE__ */ c("$ZodType", (e, t) => {
1261
- var n;
1262
- e ?? (e = {}), e._zod.def = t, e._zod.bag = e._zod.bag || {}, e._zod.version = eo;
1263
- const r = [...e._zod.def.checks ?? []];
1264
- e._zod.traits.has("$ZodCheck") && r.unshift(e);
1265
- for (const o of r)
1266
- for (const i of o._zod.onattach)
1267
- i(e);
1268
- if (r.length === 0)
1269
- (n = e._zod).deferred ?? (n.deferred = []), e._zod.deferred?.push(() => {
1270
- e._zod.run = e._zod.parse;
1271
- });
1272
- else {
1273
- const o = (i, s, u) => {
1274
- let f = K(i), a;
1275
- for (const g of s) {
1276
- if (g._zod.def.when) {
1277
- if (!g._zod.def.when(i))
1278
- continue;
1279
- } else if (f)
1280
- continue;
1281
- const p = i.issues.length, m = g._zod.check(i);
1282
- if (m instanceof Promise && u?.async === !1)
1283
- throw new J();
1284
- if (a || m instanceof Promise)
1285
- a = (a ?? Promise.resolve()).then(async () => {
1286
- await m, i.issues.length !== p && (f || (f = K(i, p)));
1287
- });
1288
- else {
1289
- if (i.issues.length === p)
1290
- continue;
1291
- f || (f = K(i, p));
1292
- }
1293
- }
1294
- return a ? a.then(() => i) : i;
1295
- };
1296
- e._zod.run = (i, s) => {
1297
- const u = e._zod.parse(i, s);
1298
- if (u instanceof Promise) {
1299
- if (s.async === !1)
1300
- throw new J();
1301
- return u.then((f) => o(f, r, s));
1302
- }
1303
- return o(u, r, s);
1304
- };
1305
- }
1306
- e["~standard"] = {
1307
- validate: (o) => {
1308
- try {
1309
- const i = ar(e, o);
1310
- return i.success ? { value: i.data } : { issues: i.error?.issues };
1311
- } catch {
1312
- return fr(e, o).then((s) => s.success ? { value: s.data } : { issues: s.error?.issues });
1313
- }
1314
- },
1315
- vendor: "zod",
1316
- version: 1
1317
- };
1318
- }), ke = /* @__PURE__ */ c("$ZodString", (e, t) => {
1319
- z.init(e, t), e._zod.pattern = [...e?._zod.bag?.patterns ?? []].pop() ?? Pr(e._zod.bag), e._zod.parse = (n, r) => {
1320
- if (t.coerce)
1321
- try {
1322
- n.value = String(n.value);
1323
- } catch {
1324
- }
1325
- return typeof n.value == "string" || n.issues.push({
1326
- expected: "string",
1327
- code: "invalid_type",
1328
- input: n.value,
1329
- inst: e
1330
- }), n;
1331
- };
1332
- }), w = /* @__PURE__ */ c("$ZodStringFormat", (e, t) => {
1333
- le.init(e, t), ke.init(e, t);
1334
- }), to = /* @__PURE__ */ c("$ZodGUID", (e, t) => {
1335
- t.pattern ?? (t.pattern = vr), w.init(e, t);
1336
- }), no = /* @__PURE__ */ c("$ZodUUID", (e, t) => {
1337
- if (t.version) {
1338
- const r = {
1339
- v1: 1,
1340
- v2: 2,
1341
- v3: 3,
1342
- v4: 4,
1343
- v5: 5,
1344
- v6: 6,
1345
- v7: 7,
1346
- v8: 8
1347
- }[t.version];
1348
- if (r === void 0)
1349
- throw new Error(`Invalid UUID version: "${t.version}"`);
1350
- t.pattern ?? (t.pattern = je(r));
1351
- } else
1352
- t.pattern ?? (t.pattern = je());
1353
- w.init(e, t);
1354
- }), ro = /* @__PURE__ */ c("$ZodEmail", (e, t) => {
1355
- t.pattern ?? (t.pattern = br), w.init(e, t);
1356
- }), oo = /* @__PURE__ */ c("$ZodURL", (e, t) => {
1357
- w.init(e, t), e._zod.check = (n) => {
1358
- try {
1359
- const r = n.value.trim(), o = new URL(r);
1360
- t.hostname && (t.hostname.lastIndex = 0, t.hostname.test(o.hostname) || n.issues.push({
1361
- code: "invalid_format",
1362
- format: "url",
1363
- note: "Invalid hostname",
1364
- pattern: Er.source,
1365
- input: n.value,
1366
- inst: e,
1367
- continue: !t.abort
1368
- })), t.protocol && (t.protocol.lastIndex = 0, t.protocol.test(o.protocol.endsWith(":") ? o.protocol.slice(0, -1) : o.protocol) || n.issues.push({
1369
- code: "invalid_format",
1370
- format: "url",
1371
- note: "Invalid protocol",
1372
- pattern: t.protocol.source,
1373
- input: n.value,
1374
- inst: e,
1375
- continue: !t.abort
1376
- })), t.normalize ? n.value = o.href : n.value = r;
1377
- return;
1378
- } catch {
1379
- n.issues.push({
1380
- code: "invalid_format",
1381
- format: "url",
1382
- input: n.value,
1383
- inst: e,
1384
- continue: !t.abort
1385
- });
1386
- }
1387
- };
1388
- }), io = /* @__PURE__ */ c("$ZodEmoji", (e, t) => {
1389
- t.pattern ?? (t.pattern = zr()), w.init(e, t);
1390
- }), so = /* @__PURE__ */ c("$ZodNanoID", (e, t) => {
1391
- t.pattern ?? (t.pattern = gr), w.init(e, t);
1392
- }), co = /* @__PURE__ */ c("$ZodCUID", (e, t) => {
1393
- t.pattern ?? (t.pattern = lr), w.init(e, t);
1394
- }), uo = /* @__PURE__ */ c("$ZodCUID2", (e, t) => {
1395
- t.pattern ?? (t.pattern = pr), w.init(e, t);
1396
- }), ao = /* @__PURE__ */ c("$ZodULID", (e, t) => {
1397
- t.pattern ?? (t.pattern = mr), w.init(e, t);
1398
- }), fo = /* @__PURE__ */ c("$ZodXID", (e, t) => {
1399
- t.pattern ?? (t.pattern = hr), w.init(e, t);
1400
- }), lo = /* @__PURE__ */ c("$ZodKSUID", (e, t) => {
1401
- t.pattern ?? (t.pattern = dr), w.init(e, t);
1402
- }), po = /* @__PURE__ */ c("$ZodISODateTime", (e, t) => {
1403
- t.pattern ?? (t.pattern = Sr(t)), w.init(e, t);
1404
- }), mo = /* @__PURE__ */ c("$ZodISODate", (e, t) => {
1405
- t.pattern ?? (t.pattern = xr), w.init(e, t);
1406
- }), ho = /* @__PURE__ */ c("$ZodISOTime", (e, t) => {
1407
- t.pattern ?? (t.pattern = Or(t)), w.init(e, t);
1408
- }), go = /* @__PURE__ */ c("$ZodISODuration", (e, t) => {
1409
- t.pattern ?? (t.pattern = _r), w.init(e, t);
1410
- }), _o = /* @__PURE__ */ c("$ZodIPv4", (e, t) => {
1411
- t.pattern ?? (t.pattern = wr), w.init(e, t), e._zod.onattach.push((n) => {
1412
- const r = n._zod.bag;
1413
- r.format = "ipv4";
1414
- });
1415
- }), vo = /* @__PURE__ */ c("$ZodIPv6", (e, t) => {
1416
- t.pattern ?? (t.pattern = $r), w.init(e, t), e._zod.onattach.push((n) => {
1417
- const r = n._zod.bag;
1418
- r.format = "ipv6";
1419
- }), e._zod.check = (n) => {
1420
- try {
1421
- new URL(`http://[${n.value}]`);
1422
- } catch {
1423
- n.issues.push({
1424
- code: "invalid_format",
1425
- format: "ipv6",
1426
- input: n.value,
1427
- inst: e,
1428
- continue: !t.abort
1429
- });
1430
- }
1431
- };
1432
- }), bo = /* @__PURE__ */ c("$ZodCIDRv4", (e, t) => {
1433
- t.pattern ?? (t.pattern = Zr), w.init(e, t);
1434
- }), yo = /* @__PURE__ */ c("$ZodCIDRv6", (e, t) => {
1435
- t.pattern ?? (t.pattern = kr), w.init(e, t), e._zod.check = (n) => {
1436
- const [r, o] = n.value.split("/");
1437
- try {
1438
- if (!o)
1439
- throw new Error();
1440
- const i = Number(o);
1441
- if (`${i}` !== o)
1442
- throw new Error();
1443
- if (i < 0 || i > 128)
1444
- throw new Error();
1445
- new URL(`http://[${r}]`);
1446
- } catch {
1447
- n.issues.push({
1448
- code: "invalid_format",
1449
- format: "cidrv6",
1450
- input: n.value,
1451
- inst: e,
1452
- continue: !t.abort
1453
- });
1454
- }
1455
- };
1456
- });
1457
- function Ct(e) {
1458
- if (e === "")
1459
- return !0;
1460
- if (e.length % 4 !== 0)
1461
- return !1;
1462
- try {
1463
- return atob(e), !0;
1464
- } catch {
1465
- return !1;
1466
- }
1467
- }
1468
- const zo = /* @__PURE__ */ c("$ZodBase64", (e, t) => {
1469
- t.pattern ?? (t.pattern = Ir), w.init(e, t), e._zod.onattach.push((n) => {
1470
- n._zod.bag.contentEncoding = "base64";
1471
- }), e._zod.check = (n) => {
1472
- Ct(n.value) || n.issues.push({
1473
- code: "invalid_format",
1474
- format: "base64",
1475
- input: n.value,
1476
- inst: e,
1477
- continue: !t.abort
1478
- });
1479
- };
1480
- });
1481
- function wo(e) {
1482
- if (!Tt.test(e))
1483
- return !1;
1484
- const t = e.replace(/[-_]/g, (r) => r === "-" ? "+" : "/"), n = t.padEnd(Math.ceil(t.length / 4) * 4, "=");
1485
- return Ct(n);
1486
- }
1487
- const $o = /* @__PURE__ */ c("$ZodBase64URL", (e, t) => {
1488
- t.pattern ?? (t.pattern = Tt), w.init(e, t), e._zod.onattach.push((n) => {
1489
- n._zod.bag.contentEncoding = "base64url";
1490
- }), e._zod.check = (n) => {
1491
- wo(n.value) || n.issues.push({
1492
- code: "invalid_format",
1493
- format: "base64url",
1494
- input: n.value,
1495
- inst: e,
1496
- continue: !t.abort
1497
- });
1498
- };
1499
- }), Zo = /* @__PURE__ */ c("$ZodE164", (e, t) => {
1500
- t.pattern ?? (t.pattern = Ar), w.init(e, t);
1501
- });
1502
- function ko(e, t = null) {
1503
- try {
1504
- const n = e.split(".");
1505
- if (n.length !== 3)
1506
- return !1;
1507
- const [r] = n;
1508
- if (!r)
1509
- return !1;
1510
- const o = JSON.parse(atob(r));
1511
- return !("typ" in o && o?.typ !== "JWT" || !o.alg || t && (!("alg" in o) || o.alg !== t));
1512
- } catch {
1513
- return !1;
1514
- }
1515
- }
1516
- const Io = /* @__PURE__ */ c("$ZodJWT", (e, t) => {
1517
- w.init(e, t), e._zod.check = (n) => {
1518
- ko(n.value, t.alg) || n.issues.push({
1519
- code: "invalid_format",
1520
- format: "jwt",
1521
- input: n.value,
1522
- inst: e,
1523
- continue: !t.abort
1524
- });
1525
- };
1526
- }), Kt = /* @__PURE__ */ c("$ZodNumber", (e, t) => {
1527
- z.init(e, t), e._zod.pattern = e._zod.bag.pattern ?? Nr, e._zod.parse = (n, r) => {
1528
- if (t.coerce)
1529
- try {
1530
- n.value = Number(n.value);
1531
- } catch {
1532
- }
1533
- const o = n.value;
1534
- if (typeof o == "number" && !Number.isNaN(o) && Number.isFinite(o))
1535
- return n;
1536
- const i = typeof o == "number" ? Number.isNaN(o) ? "NaN" : Number.isFinite(o) ? void 0 : "Infinity" : void 0;
1537
- return n.issues.push({
1538
- expected: "number",
1539
- code: "invalid_type",
1540
- input: o,
1541
- inst: e,
1542
- ...i ? { received: i } : {}
1543
- }), n;
1544
- };
1545
- }), Eo = /* @__PURE__ */ c("$ZodNumber", (e, t) => {
1546
- Fr.init(e, t), Kt.init(e, t);
1547
- }), Ao = /* @__PURE__ */ c("$ZodBoolean", (e, t) => {
1548
- z.init(e, t), e._zod.pattern = Dr, e._zod.parse = (n, r) => {
1549
- if (t.coerce)
1550
- try {
1551
- n.value = !!n.value;
1552
- } catch {
1553
- }
1554
- const o = n.value;
1555
- return typeof o == "boolean" || n.issues.push({
1556
- expected: "boolean",
1557
- code: "invalid_type",
1558
- input: o,
1559
- inst: e
1560
- }), n;
1561
- };
1562
- }), xo = /* @__PURE__ */ c("$ZodAny", (e, t) => {
1563
- z.init(e, t), e._zod.parse = (n) => n;
1564
- }), Oo = /* @__PURE__ */ c("$ZodUnknown", (e, t) => {
1565
- z.init(e, t), e._zod.parse = (n) => n;
1566
- }), So = /* @__PURE__ */ c("$ZodNever", (e, t) => {
1567
- z.init(e, t), e._zod.parse = (n, r) => (n.issues.push({
1568
- expected: "never",
1569
- code: "invalid_type",
1570
- input: n.value,
1571
- inst: e
1572
- }), n);
1573
- }), Po = /* @__PURE__ */ c("$ZodDate", (e, t) => {
1574
- z.init(e, t), e._zod.parse = (n, r) => {
1575
- if (t.coerce)
1576
- try {
1577
- n.value = new Date(n.value);
1578
- } catch {
1579
- }
1580
- const o = n.value, i = o instanceof Date;
1581
- return i && !Number.isNaN(o.getTime()) || n.issues.push({
1582
- expected: "date",
1583
- code: "invalid_type",
1584
- input: o,
1585
- ...i ? { received: "Invalid Date" } : {},
1586
- inst: e
1587
- }), n;
1588
- };
1589
- });
1590
- function Ne(e, t, n) {
1591
- e.issues.length && t.issues.push(...jt(n, e.issues)), t.value[n] = e.value;
1592
- }
1593
- const jo = /* @__PURE__ */ c("$ZodArray", (e, t) => {
1594
- z.init(e, t), e._zod.parse = (n, r) => {
1595
- const o = n.value;
1596
- if (!Array.isArray(o))
1597
- return n.issues.push({
1598
- expected: "array",
1599
- code: "invalid_type",
1600
- input: o,
1601
- inst: e
1602
- }), n;
1603
- n.value = Array(o.length);
1604
- const i = [];
1605
- for (let s = 0; s < o.length; s++) {
1606
- const u = o[s], f = t.element._zod.run({
1607
- value: u,
1608
- issues: []
1609
- }, r);
1610
- f instanceof Promise ? i.push(f.then((a) => Ne(a, n, s))) : Ne(f, n, s);
1611
- }
1612
- return i.length ? Promise.all(i).then(() => n) : n;
1613
- };
1614
- });
1615
- function te(e, t, n, r) {
1616
- e.issues.length && t.issues.push(...jt(n, e.issues)), e.value === void 0 ? n in r && (t.value[n] = void 0) : t.value[n] = e.value;
1617
- }
1618
- const No = /* @__PURE__ */ c("$ZodObject", (e, t) => {
1619
- z.init(e, t);
1620
- const n = St(() => {
1621
- const p = Object.keys(t.shape);
1622
- for (const h of p)
1623
- if (!(t.shape[h] instanceof z))
1624
- throw new Error(`Invalid element at key "${h}": expected a Zod schema`);
1625
- const m = Xn(t.shape);
1626
- return {
1627
- shape: t.shape,
1628
- keys: p,
1629
- keySet: new Set(p),
1630
- numKeys: p.length,
1631
- optionalKeys: new Set(m)
1632
- };
1633
- });
1634
- y(e._zod, "propValues", () => {
1635
- const p = t.shape, m = {};
1636
- for (const h in p) {
1637
- const I = p[h]._zod;
1638
- if (I.values) {
1639
- m[h] ?? (m[h] = /* @__PURE__ */ new Set());
1640
- for (const d of I.values)
1641
- m[h].add(d);
1642
- }
1643
- }
1644
- return m;
1645
- });
1646
- const r = (p) => {
1647
- const m = new Qr(["shape", "payload", "ctx"]), h = n.value, I = (_) => {
1648
- const b = Pe(_);
1649
- return `shape[${b}]._zod.run({ value: input[${b}], issues: [] }, ctx)`;
1650
- };
1651
- m.write("const input = payload.value;");
1652
- const d = /* @__PURE__ */ Object.create(null);
1653
- let E = 0;
1654
- for (const _ of h.keys)
1655
- d[_] = `key_${E++}`;
1656
- m.write("const newResult = {}");
1657
- for (const _ of h.keys) {
1658
- const b = d[_], $ = Pe(_);
1659
- m.write(`const ${b} = ${I(_)};`), m.write(`
1660
- if (${b}.issues.length) {
1661
- payload.issues = payload.issues.concat(${b}.issues.map(iss => ({
1662
- ...iss,
1663
- path: iss.path ? [${$}, ...iss.path] : [${$}]
1664
- })));
1665
- }
1666
-
1667
- if (${b}.value === undefined) {
1668
- if (${$} in input) {
1669
- newResult[${$}] = undefined;
1670
- }
1671
- } else {
1672
- newResult[${$}] = ${b}.value;
1673
- }
1674
- `);
1675
- }
1676
- m.write("payload.value = newResult;"), m.write("return payload;");
1677
- const v = m.compile();
1678
- return (_, b) => v(p, _, b);
1679
- };
1680
- let o;
1681
- const i = ve, s = !Ot.jitless, f = s && Yn.value, a = t.catchall;
1682
- let g;
1683
- e._zod.parse = (p, m) => {
1684
- g ?? (g = n.value);
1685
- const h = p.value;
1686
- if (!i(h))
1687
- return p.issues.push({
1688
- expected: "object",
1689
- code: "invalid_type",
1690
- input: h,
1691
- inst: e
1692
- }), p;
1693
- const I = [];
1694
- if (s && f && m?.async === !1 && m.jitless !== !0)
1695
- o || (o = r(t.shape)), p = o(p, m);
1696
- else {
1697
- p.value = {};
1698
- const b = g.shape;
1699
- for (const $ of g.keys) {
1700
- const O = b[$]._zod.run({ value: h[$], issues: [] }, m);
1701
- O instanceof Promise ? I.push(O.then((H) => te(H, p, $, h))) : te(O, p, $, h);
1702
- }
1703
- }
1704
- if (!a)
1705
- return I.length ? Promise.all(I).then(() => p) : p;
1706
- const d = [], E = g.keySet, v = a._zod, _ = v.def.type;
1707
- for (const b of Object.keys(h)) {
1708
- if (E.has(b))
1709
- continue;
1710
- if (_ === "never") {
1711
- d.push(b);
1712
- continue;
1713
- }
1714
- const $ = v.run({ value: h[b], issues: [] }, m);
1715
- $ instanceof Promise ? I.push($.then((P) => te(P, p, b, h))) : te($, p, b, h);
1716
- }
1717
- return d.length && p.issues.push({
1718
- code: "unrecognized_keys",
1719
- keys: d,
1720
- input: h,
1721
- inst: e
1722
- }), I.length ? Promise.all(I).then(() => p) : p;
1723
- };
1724
- });
1725
- function De(e, t, n, r) {
1726
- for (const i of e)
1727
- if (i.issues.length === 0)
1728
- return t.value = i.value, t;
1729
- const o = e.filter((i) => !K(i));
1730
- return o.length === 1 ? (t.value = o[0].value, o[0]) : (t.issues.push({
1731
- code: "invalid_union",
1732
- input: t.value,
1733
- inst: n,
1734
- errors: e.map((i) => i.issues.map((s) => F(s, r, U())))
1735
- }), t);
1736
- }
1737
- const Do = /* @__PURE__ */ c("$ZodUnion", (e, t) => {
1738
- z.init(e, t), y(e._zod, "optin", () => t.options.some((n) => n._zod.optin === "optional") ? "optional" : void 0), y(e._zod, "optout", () => t.options.some((n) => n._zod.optout === "optional") ? "optional" : void 0), y(e._zod, "values", () => {
1739
- if (t.options.every((n) => n._zod.values))
1740
- return new Set(t.options.flatMap((n) => Array.from(n._zod.values)));
1741
- }), y(e._zod, "pattern", () => {
1742
- if (t.options.every((n) => n._zod.pattern)) {
1743
- const n = t.options.map((r) => r._zod.pattern);
1744
- return new RegExp(`^(${n.map((r) => $e(r.source)).join("|")})$`);
1745
- }
1746
- }), e._zod.parse = (n, r) => {
1747
- let o = !1;
1748
- const i = [];
1749
- for (const s of t.options) {
1750
- const u = s._zod.run({
1751
- value: n.value,
1752
- issues: []
1753
- }, r);
1754
- if (u instanceof Promise)
1755
- i.push(u), o = !0;
1756
- else {
1757
- if (u.issues.length === 0)
1758
- return u;
1759
- i.push(u);
1760
- }
1761
- }
1762
- return o ? Promise.all(i).then((s) => De(s, n, e, r)) : De(i, n, e, r);
1763
- };
1764
- }), Ro = /* @__PURE__ */ c("$ZodIntersection", (e, t) => {
1765
- z.init(e, t), e._zod.parse = (n, r) => {
1766
- const o = n.value, i = t.left._zod.run({ value: o, issues: [] }, r), s = t.right._zod.run({ value: o, issues: [] }, r);
1767
- return i instanceof Promise || s instanceof Promise ? Promise.all([i, s]).then(([f, a]) => Re(n, f, a)) : Re(n, i, s);
1768
- };
1769
- });
1770
- function ye(e, t) {
1771
- if (e === t)
1772
- return { valid: !0, data: e };
1773
- if (e instanceof Date && t instanceof Date && +e == +t)
1774
- return { valid: !0, data: e };
1775
- if (be(e) && be(t)) {
1776
- const n = Object.keys(t), r = Object.keys(e).filter((i) => n.indexOf(i) !== -1), o = { ...e, ...t };
1777
- for (const i of r) {
1778
- const s = ye(e[i], t[i]);
1779
- if (!s.valid)
1780
- return {
1781
- valid: !1,
1782
- mergeErrorPath: [i, ...s.mergeErrorPath]
1783
- };
1784
- o[i] = s.data;
1785
- }
1786
- return { valid: !0, data: o };
1787
- }
1788
- if (Array.isArray(e) && Array.isArray(t)) {
1789
- if (e.length !== t.length)
1790
- return { valid: !1, mergeErrorPath: [] };
1791
- const n = [];
1792
- for (let r = 0; r < e.length; r++) {
1793
- const o = e[r], i = t[r], s = ye(o, i);
1794
- if (!s.valid)
1795
- return {
1796
- valid: !1,
1797
- mergeErrorPath: [r, ...s.mergeErrorPath]
1798
- };
1799
- n.push(s.data);
1800
- }
1801
- return { valid: !0, data: n };
1802
- }
1803
- return { valid: !1, mergeErrorPath: [] };
1804
- }
1805
- function Re(e, t, n) {
1806
- if (t.issues.length && e.issues.push(...t.issues), n.issues.length && e.issues.push(...n.issues), K(e))
1807
- return e;
1808
- const r = ye(t.value, n.value);
1809
- if (!r.valid)
1810
- throw new Error(`Unmergable intersection. Error path: ${JSON.stringify(r.mergeErrorPath)}`);
1811
- return e.value = r.data, e;
1812
- }
1813
- const Mo = /* @__PURE__ */ c("$ZodEnum", (e, t) => {
1814
- z.init(e, t);
1815
- const n = Kn(t.entries), r = new Set(n);
1816
- e._zod.values = r, e._zod.pattern = new RegExp(`^(${n.filter((o) => qn.has(typeof o)).map((o) => typeof o == "string" ? fe(o) : o.toString()).join("|")})$`), e._zod.parse = (o, i) => {
1817
- const s = o.value;
1818
- return r.has(s) || o.issues.push({
1819
- code: "invalid_value",
1820
- values: n,
1821
- input: s,
1822
- inst: e
1823
- }), o;
1824
- };
1825
- }), Uo = /* @__PURE__ */ c("$ZodFile", (e, t) => {
1826
- z.init(e, t), e._zod.parse = (n, r) => {
1827
- const o = n.value;
1828
- return o instanceof File || n.issues.push({
1829
- expected: "file",
1830
- code: "invalid_type",
1831
- input: o,
1832
- inst: e
1833
- }), n;
1834
- };
1835
- }), Fo = /* @__PURE__ */ c("$ZodTransform", (e, t) => {
1836
- z.init(e, t), e._zod.parse = (n, r) => {
1837
- const o = t.transform(n.value, n);
1838
- if (r.async)
1839
- return (o instanceof Promise ? o : Promise.resolve(o)).then((s) => (n.value = s, n));
1840
- if (o instanceof Promise)
1841
- throw new J();
1842
- return n.value = o, n;
1843
- };
1844
- }), To = /* @__PURE__ */ c("$ZodOptional", (e, t) => {
1845
- z.init(e, t), e._zod.optin = "optional", e._zod.optout = "optional", y(e._zod, "values", () => t.innerType._zod.values ? /* @__PURE__ */ new Set([...t.innerType._zod.values, void 0]) : void 0), y(e._zod, "pattern", () => {
1846
- const n = t.innerType._zod.pattern;
1847
- return n ? new RegExp(`^(${$e(n.source)})?$`) : void 0;
1848
- }), 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);
1849
- }), Lo = /* @__PURE__ */ c("$ZodNullable", (e, t) => {
1850
- z.init(e, t), y(e._zod, "optin", () => t.innerType._zod.optin), y(e._zod, "optout", () => t.innerType._zod.optout), y(e._zod, "pattern", () => {
1851
- const n = t.innerType._zod.pattern;
1852
- return n ? new RegExp(`^(${$e(n.source)}|null)$`) : void 0;
1853
- }), y(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);
1854
- }), Bo = /* @__PURE__ */ c("$ZodDefault", (e, t) => {
1855
- z.init(e, t), e._zod.optin = "optional", y(e._zod, "values", () => t.innerType._zod.values), e._zod.parse = (n, r) => {
1856
- if (n.value === void 0)
1857
- return n.value = t.defaultValue, n;
1858
- const o = t.innerType._zod.run(n, r);
1859
- return o instanceof Promise ? o.then((i) => Me(i, t)) : Me(o, t);
1860
- };
1861
- });
1862
- function Me(e, t) {
1863
- return e.value === void 0 && (e.value = t.defaultValue), e;
1864
- }
1865
- const Wo = /* @__PURE__ */ c("$ZodPrefault", (e, t) => {
1866
- z.init(e, t), e._zod.optin = "optional", y(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));
1867
- }), Vo = /* @__PURE__ */ c("$ZodNonOptional", (e, t) => {
1868
- z.init(e, t), y(e._zod, "values", () => {
1869
- const n = t.innerType._zod.values;
1870
- return n ? new Set([...n].filter((r) => r !== void 0)) : void 0;
1871
- }), e._zod.parse = (n, r) => {
1872
- const o = t.innerType._zod.run(n, r);
1873
- return o instanceof Promise ? o.then((i) => Ue(i, e)) : Ue(o, e);
1874
- };
1875
- });
1876
- function Ue(e, t) {
1877
- return !e.issues.length && e.value === void 0 && e.issues.push({
1878
- code: "invalid_type",
1879
- expected: "nonoptional",
1880
- input: e.value,
1881
- inst: t
1882
- }), e;
1883
- }
1884
- const Go = /* @__PURE__ */ c("$ZodCatch", (e, t) => {
1885
- z.init(e, t), y(e._zod, "optin", () => t.innerType._zod.optin), y(e._zod, "optout", () => t.innerType._zod.optout), y(e._zod, "values", () => t.innerType._zod.values), e._zod.parse = (n, r) => {
1886
- const o = t.innerType._zod.run(n, r);
1887
- return o instanceof Promise ? o.then((i) => (n.value = i.value, i.issues.length && (n.value = t.catchValue({
1888
- ...n,
1889
- error: {
1890
- issues: i.issues.map((s) => F(s, r, U()))
1891
- },
1892
- input: n.value
1893
- }), n.issues = []), n)) : (n.value = o.value, o.issues.length && (n.value = t.catchValue({
1894
- ...n,
1895
- error: {
1896
- issues: o.issues.map((i) => F(i, r, U()))
1897
- },
1898
- input: n.value
1899
- }), n.issues = []), n);
1900
- };
1901
- }), Co = /* @__PURE__ */ c("$ZodPipe", (e, t) => {
1902
- z.init(e, t), y(e._zod, "values", () => t.in._zod.values), y(e._zod, "optin", () => t.in._zod.optin), y(e._zod, "optout", () => t.out._zod.optout), y(e._zod, "propValues", () => t.in._zod.propValues), e._zod.parse = (n, r) => {
1903
- const o = t.in._zod.run(n, r);
1904
- return o instanceof Promise ? o.then((i) => Fe(i, t, r)) : Fe(o, t, r);
1905
- };
1906
- });
1907
- function Fe(e, t, n) {
1908
- return e.issues.length ? e : t.out._zod.run({ value: e.value, issues: e.issues }, n);
1909
- }
1910
- const Ko = /* @__PURE__ */ c("$ZodReadonly", (e, t) => {
1911
- z.init(e, t), y(e._zod, "propValues", () => t.innerType._zod.propValues), y(e._zod, "values", () => t.innerType._zod.values), y(e._zod, "optin", () => t.innerType._zod.optin), y(e._zod, "optout", () => t.innerType._zod.optout), e._zod.parse = (n, r) => {
1912
- const o = t.innerType._zod.run(n, r);
1913
- return o instanceof Promise ? o.then(Te) : Te(o);
1914
- };
1915
- });
1916
- function Te(e) {
1917
- return e.value = Object.freeze(e.value), e;
1918
- }
1919
- const Jo = /* @__PURE__ */ c("$ZodCustom", (e, t) => {
1920
- A.init(e, t), z.init(e, t), e._zod.parse = (n, r) => n, e._zod.check = (n) => {
1921
- const r = n.value, o = t.fn(r);
1922
- if (o instanceof Promise)
1923
- return o.then((i) => Le(i, n, r, e));
1924
- Le(o, n, r, e);
1925
- };
1926
- });
1927
- function Le(e, t, n, r) {
1928
- if (!e) {
1929
- const o = {
1930
- code: "custom",
1931
- input: n,
1932
- inst: r,
1933
- // incorporates params.error into issue reporting
1934
- path: [...r._zod.def.path ?? []],
1935
- // incorporates params.error into issue reporting
1936
- continue: !r._zod.def.abort
1937
- // params: inst._zod.def.params,
1938
- };
1939
- r._zod.def.params && (o.params = r._zod.def.params), t.issues.push(Y(o));
1940
- }
1941
- }
1942
- class Yo {
1943
- constructor() {
1944
- this._map = /* @__PURE__ */ new Map(), this._idmap = /* @__PURE__ */ new Map();
1945
- }
1946
- add(t, ...n) {
1947
- const r = n[0];
1948
- if (this._map.set(t, r), r && typeof r == "object" && "id" in r) {
1949
- if (this._idmap.has(r.id))
1950
- throw new Error(`ID ${r.id} already exists in the registry`);
1951
- this._idmap.set(r.id, t);
1952
- }
1953
- return this;
1954
- }
1955
- clear() {
1956
- return this._map = /* @__PURE__ */ new Map(), this._idmap = /* @__PURE__ */ new Map(), this;
1957
- }
1958
- remove(t) {
1959
- const n = this._map.get(t);
1960
- return n && typeof n == "object" && "id" in n && this._idmap.delete(n.id), this._map.delete(t), this;
1961
- }
1962
- get(t) {
1963
- const n = t._zod.parent;
1964
- if (n) {
1965
- const r = { ...this.get(n) ?? {} };
1966
- delete r.id;
1967
- const o = { ...r, ...this._map.get(t) };
1968
- return Object.keys(o).length ? o : void 0;
1969
- }
1970
- return this._map.get(t);
1971
- }
1972
- has(t) {
1973
- return this._map.has(t);
1974
- }
1975
- }
1976
- function qo() {
1977
- return new Yo();
1978
- }
1979
- const ne = /* @__PURE__ */ qo();
1980
- function Xo(e, t) {
1981
- return new e({
1982
- type: "string",
1983
- ...l(t)
1984
- });
1985
- }
1986
- function Jt(e, t) {
1987
- return new e({
1988
- type: "string",
1989
- format: "email",
1990
- check: "string_format",
1991
- abort: !1,
1992
- ...l(t)
1993
- });
1994
- }
1995
- function Be(e, t) {
1996
- return new e({
1997
- type: "string",
1998
- format: "guid",
1999
- check: "string_format",
2000
- abort: !1,
2001
- ...l(t)
2002
- });
2003
- }
2004
- function Ho(e, t) {
2005
- return new e({
2006
- type: "string",
2007
- format: "uuid",
2008
- check: "string_format",
2009
- abort: !1,
2010
- ...l(t)
2011
- });
2012
- }
2013
- function Qo(e, t) {
2014
- return new e({
2015
- type: "string",
2016
- format: "uuid",
2017
- check: "string_format",
2018
- abort: !1,
2019
- version: "v4",
2020
- ...l(t)
2021
- });
2022
- }
2023
- function ei(e, t) {
2024
- return new e({
2025
- type: "string",
2026
- format: "uuid",
2027
- check: "string_format",
2028
- abort: !1,
2029
- version: "v6",
2030
- ...l(t)
2031
- });
2032
- }
2033
- function ti(e, t) {
2034
- return new e({
2035
- type: "string",
2036
- format: "uuid",
2037
- check: "string_format",
2038
- abort: !1,
2039
- version: "v7",
2040
- ...l(t)
2041
- });
2042
- }
2043
- function Yt(e, t) {
2044
- return new e({
2045
- type: "string",
2046
- format: "url",
2047
- check: "string_format",
2048
- abort: !1,
2049
- ...l(t)
2050
- });
2051
- }
2052
- function ni(e, t) {
2053
- return new e({
2054
- type: "string",
2055
- format: "emoji",
2056
- check: "string_format",
2057
- abort: !1,
2058
- ...l(t)
2059
- });
2060
- }
2061
- function ri(e, t) {
2062
- return new e({
2063
- type: "string",
2064
- format: "nanoid",
2065
- check: "string_format",
2066
- abort: !1,
2067
- ...l(t)
2068
- });
2069
- }
2070
- function oi(e, t) {
2071
- return new e({
2072
- type: "string",
2073
- format: "cuid",
2074
- check: "string_format",
2075
- abort: !1,
2076
- ...l(t)
2077
- });
2078
- }
2079
- function ii(e, t) {
2080
- return new e({
2081
- type: "string",
2082
- format: "cuid2",
2083
- check: "string_format",
2084
- abort: !1,
2085
- ...l(t)
2086
- });
2087
- }
2088
- function si(e, t) {
2089
- return new e({
2090
- type: "string",
2091
- format: "ulid",
2092
- check: "string_format",
2093
- abort: !1,
2094
- ...l(t)
2095
- });
2096
- }
2097
- function ci(e, t) {
2098
- return new e({
2099
- type: "string",
2100
- format: "xid",
2101
- check: "string_format",
2102
- abort: !1,
2103
- ...l(t)
2104
- });
2105
- }
2106
- function ui(e, t) {
2107
- return new e({
2108
- type: "string",
2109
- format: "ksuid",
2110
- check: "string_format",
2111
- abort: !1,
2112
- ...l(t)
2113
- });
2114
- }
2115
- function qt(e, t) {
2116
- return new e({
2117
- type: "string",
2118
- format: "ipv4",
2119
- check: "string_format",
2120
- abort: !1,
2121
- ...l(t)
2122
- });
2123
- }
2124
- function ai(e, t) {
2125
- return new e({
2126
- type: "string",
2127
- format: "ipv6",
2128
- check: "string_format",
2129
- abort: !1,
2130
- ...l(t)
2131
- });
2132
- }
2133
- function fi(e, t) {
2134
- return new e({
2135
- type: "string",
2136
- format: "cidrv4",
2137
- check: "string_format",
2138
- abort: !1,
2139
- ...l(t)
2140
- });
2141
- }
2142
- function li(e, t) {
2143
- return new e({
2144
- type: "string",
2145
- format: "cidrv6",
2146
- check: "string_format",
2147
- abort: !1,
2148
- ...l(t)
2149
- });
2150
- }
2151
- function pi(e, t) {
2152
- return new e({
2153
- type: "string",
2154
- format: "base64",
2155
- check: "string_format",
2156
- abort: !1,
2157
- ...l(t)
2158
- });
2159
- }
2160
- function mi(e, t) {
2161
- return new e({
2162
- type: "string",
2163
- format: "base64url",
2164
- check: "string_format",
2165
- abort: !1,
2166
- ...l(t)
2167
- });
2168
- }
2169
- function hi(e, t) {
2170
- return new e({
2171
- type: "string",
2172
- format: "e164",
2173
- check: "string_format",
2174
- abort: !1,
2175
- ...l(t)
2176
- });
2177
- }
2178
- function di(e, t) {
2179
- return new e({
2180
- type: "string",
2181
- format: "jwt",
2182
- check: "string_format",
2183
- abort: !1,
2184
- ...l(t)
2185
- });
2186
- }
2187
- function gi(e, t) {
2188
- return new e({
2189
- type: "string",
2190
- format: "datetime",
2191
- check: "string_format",
2192
- offset: !1,
2193
- local: !1,
2194
- precision: null,
2195
- ...l(t)
2196
- });
2197
- }
2198
- function _i(e, t) {
2199
- return new e({
2200
- type: "string",
2201
- format: "date",
2202
- check: "string_format",
2203
- ...l(t)
2204
- });
2205
- }
2206
- function vi(e, t) {
2207
- return new e({
2208
- type: "string",
2209
- format: "time",
2210
- check: "string_format",
2211
- precision: null,
2212
- ...l(t)
2213
- });
2214
- }
2215
- function bi(e, t) {
2216
- return new e({
2217
- type: "string",
2218
- format: "duration",
2219
- check: "string_format",
2220
- ...l(t)
2221
- });
2222
- }
2223
- function yi(e, t) {
2224
- return new e({
2225
- type: "number",
2226
- checks: [],
2227
- ...l(t)
2228
- });
2229
- }
2230
- function zi(e, t) {
2231
- return new e({
2232
- type: "number",
2233
- check: "number_format",
2234
- abort: !1,
2235
- format: "safeint",
2236
- ...l(t)
2237
- });
2238
- }
2239
- function wi(e, t) {
2240
- return new e({
2241
- type: "boolean",
2242
- ...l(t)
2243
- });
2244
- }
2245
- function $i(e) {
2246
- return new e({
2247
- type: "any"
2248
- });
2249
- }
2250
- function Zi(e) {
2251
- return new e({
2252
- type: "unknown"
2253
- });
2254
- }
2255
- function ki(e, t) {
2256
- return new e({
2257
- type: "never",
2258
- ...l(t)
2259
- });
2260
- }
2261
- function Ii(e, t) {
2262
- return new e({
2263
- type: "date",
2264
- ...l(t)
2265
- });
2266
- }
2267
- function We(e, t) {
2268
- return new Vt({
2269
- check: "less_than",
2270
- ...l(t),
2271
- value: e,
2272
- inclusive: !1
2273
- });
2274
- }
2275
- function ie(e, t) {
2276
- return new Vt({
2277
- check: "less_than",
2278
- ...l(t),
2279
- value: e,
2280
- inclusive: !0
2281
- });
2282
- }
2283
- function Ve(e, t) {
2284
- return new Gt({
2285
- check: "greater_than",
2286
- ...l(t),
2287
- value: e,
2288
- inclusive: !1
2289
- });
2290
- }
2291
- function se(e, t) {
2292
- return new Gt({
2293
- check: "greater_than",
2294
- ...l(t),
2295
- value: e,
2296
- inclusive: !0
2297
- });
2298
- }
2299
- function Ge(e, t) {
2300
- return new Ur({
2301
- check: "multiple_of",
2302
- ...l(t),
2303
- value: e
2304
- });
2305
- }
2306
- function Ei(e, t) {
2307
- return new Tr({
2308
- check: "max_size",
2309
- ...l(t),
2310
- maximum: e
2311
- });
2312
- }
2313
- function Ai(e, t) {
2314
- return new Lr({
2315
- check: "min_size",
2316
- ...l(t),
2317
- minimum: e
2318
- });
2319
- }
2320
- function Xt(e, t) {
2321
- return new Br({
2322
- check: "max_length",
2323
- ...l(t),
2324
- maximum: e
2325
- });
2326
- }
2327
- function ae(e, t) {
2328
- return new Wr({
2329
- check: "min_length",
2330
- ...l(t),
2331
- minimum: e
2332
- });
2333
- }
2334
- function Ht(e, t) {
2335
- return new Vr({
2336
- check: "length_equals",
2337
- ...l(t),
2338
- length: e
2339
- });
2340
- }
2341
- function xi(e, t) {
2342
- return new Gr({
2343
- check: "string_format",
2344
- format: "regex",
2345
- ...l(t),
2346
- pattern: e
2347
- });
2348
- }
2349
- function Oi(e) {
2350
- return new Cr({
2351
- check: "string_format",
2352
- format: "lowercase",
2353
- ...l(e)
2354
- });
2355
- }
2356
- function Si(e) {
2357
- return new Kr({
2358
- check: "string_format",
2359
- format: "uppercase",
2360
- ...l(e)
2361
- });
2362
- }
2363
- function Pi(e, t) {
2364
- return new Jr({
2365
- check: "string_format",
2366
- format: "includes",
2367
- ...l(t),
2368
- includes: e
2369
- });
2370
- }
2371
- function ji(e, t) {
2372
- return new Yr({
2373
- check: "string_format",
2374
- format: "starts_with",
2375
- ...l(t),
2376
- prefix: e
2377
- });
2378
- }
2379
- function Ni(e, t) {
2380
- return new qr({
2381
- check: "string_format",
2382
- format: "ends_with",
2383
- ...l(t),
2384
- suffix: e
2385
- });
2386
- }
2387
- function Di(e, t) {
2388
- return new Xr({
2389
- check: "mime_type",
2390
- mime: e,
2391
- ...l(t)
2392
- });
2393
- }
2394
- function X(e) {
2395
- return new Hr({
2396
- check: "overwrite",
2397
- tx: e
2398
- });
2399
- }
2400
- function Ri(e) {
2401
- return X((t) => t.normalize(e));
2402
- }
2403
- function Mi() {
2404
- return X((e) => e.trim());
2405
- }
2406
- function Ui() {
2407
- return X((e) => e.toLowerCase());
2408
- }
2409
- function Fi() {
2410
- return X((e) => e.toUpperCase());
2411
- }
2412
- function Ti(e, t, n) {
2413
- return new e({
2414
- type: "array",
2415
- element: t,
2416
- // get element() {
2417
- // return element;
2418
- // },
2419
- ...l(n)
2420
- });
2421
- }
2422
- function Li(e, t) {
2423
- return new e({
2424
- type: "file",
2425
- ...l(t)
2426
- });
2427
- }
2428
- function Bi(e, t, n) {
2429
- return new e({
2430
- type: "custom",
2431
- check: "custom",
2432
- fn: t,
2433
- ...l(n)
2434
- });
2435
- }
2436
- const Wi = /* @__PURE__ */ c("ZodISODateTime", (e, t) => {
2437
- po.init(e, t), k.init(e, t);
2438
- });
2439
- function Vi(e) {
2440
- return gi(Wi, e);
2441
- }
2442
- const Gi = /* @__PURE__ */ c("ZodISODate", (e, t) => {
2443
- mo.init(e, t), k.init(e, t);
2444
- });
2445
- function Ci(e) {
2446
- return _i(Gi, e);
2447
- }
2448
- const Ki = /* @__PURE__ */ c("ZodISOTime", (e, t) => {
2449
- ho.init(e, t), k.init(e, t);
2450
- });
2451
- function Ji(e) {
2452
- return vi(Ki, e);
2453
- }
2454
- const Yi = /* @__PURE__ */ c("ZodISODuration", (e, t) => {
2455
- go.init(e, t), k.init(e, t);
2456
- });
2457
- function qi(e) {
2458
- return bi(Yi, e);
2459
- }
2460
- const Xi = (e, t) => {
2461
- Rt.init(e, t), e.name = "ZodError", Object.defineProperties(e, {
2462
- format: {
2463
- value: (n) => sr(e, n)
2464
- // enumerable: false,
2465
- },
2466
- flatten: {
2467
- value: (n) => ir(e, n)
2468
- // enumerable: false,
2469
- },
2470
- addIssue: {
2471
- value: (n) => {
2472
- e.issues.push(n), e.message = JSON.stringify(e.issues, _e, 2);
2473
- }
2474
- // enumerable: false,
2475
- },
2476
- addIssues: {
2477
- value: (n) => {
2478
- e.issues.push(...n), e.message = JSON.stringify(e.issues, _e, 2);
2479
- }
2480
- // enumerable: false,
2481
- },
2482
- isEmpty: {
2483
- get() {
2484
- return e.issues.length === 0;
2485
- }
2486
- // enumerable: false,
2487
- }
2488
- });
2489
- }, pe = c("ZodError", Xi, {
2490
- Parent: Error
2491
- }), Hi = /* @__PURE__ */ cr(pe), Qi = /* @__PURE__ */ ur(pe), es = /* @__PURE__ */ Ut(pe), ts = /* @__PURE__ */ Ft(pe), Z = /* @__PURE__ */ c("ZodType", (e, t) => (z.init(e, t), e.def = t, Object.defineProperty(e, "_def", { value: t }), e.check = (...n) => e.clone(
2492
- {
2493
- ...t,
2494
- checks: [
2495
- ...t.checks ?? [],
2496
- ...n.map((r) => typeof r == "function" ? { _zod: { check: r, def: { check: "custom" }, onattach: [] } } : r)
2497
- ]
2498
- }
2499
- // { parent: true }
2500
- ), e.clone = (n, r) => L(e, n, r), e.brand = () => e, e.register = (n, r) => (n.add(e, r), e), e.parse = (n, r) => Hi(e, n, r, { callee: e.parse }), e.safeParse = (n, r) => es(e, n, r), e.parseAsync = async (n, r) => Qi(e, n, r, { callee: e.parseAsync }), e.safeParseAsync = async (n, r) => ts(e, n, r), e.spa = e.safeParseAsync, e.refine = (n, r) => e.check(Ys(n, r)), e.superRefine = (n) => e.check(qs(n)), e.overwrite = (n) => e.check(X(n)), e.optional = () => Ye(e), e.nullable = () => qe(e), e.nullish = () => Ye(qe(e)), e.nonoptional = (n) => Ls(e, n), e.array = () => x(e), e.or = (n) => cn([e, n]), e.and = (n) => un(e, n), e.transform = (n) => Xe(e, Ds(n)), e.default = (n) => Us(e, n), e.prefault = (n) => Ts(e, n), e.catch = (n) => Ws(e, n), e.pipe = (n) => Xe(e, n), e.readonly = () => Cs(e), e.describe = (n) => {
2501
- const r = e.clone();
2502
- return ne.add(r, { description: n }), r;
2503
- }, Object.defineProperty(e, "description", {
2504
- get() {
2505
- return ne.get(e)?.description;
2506
- },
2507
- configurable: !0
2508
- }), e.meta = (...n) => {
2509
- if (n.length === 0)
2510
- return ne.get(e);
2511
- const r = e.clone();
2512
- return ne.add(r, n[0]), r;
2513
- }, e.isOptional = () => e.safeParse(void 0).success, e.isNullable = () => e.safeParse(null).success, e)), Qt = /* @__PURE__ */ c("_ZodString", (e, t) => {
2514
- ke.init(e, t), Z.init(e, t);
2515
- const n = e._zod.bag;
2516
- e.format = n.format ?? null, e.minLength = n.minimum ?? null, e.maxLength = n.maximum ?? null, e.regex = (...r) => e.check(xi(...r)), e.includes = (...r) => e.check(Pi(...r)), e.startsWith = (...r) => e.check(ji(...r)), e.endsWith = (...r) => e.check(Ni(...r)), e.min = (...r) => e.check(ae(...r)), e.max = (...r) => e.check(Xt(...r)), e.length = (...r) => e.check(Ht(...r)), e.nonempty = (...r) => e.check(ae(1, ...r)), e.lowercase = (r) => e.check(Oi(r)), e.uppercase = (r) => e.check(Si(r)), e.trim = () => e.check(Mi()), e.normalize = (...r) => e.check(Ri(...r)), e.toLowerCase = () => e.check(Ui()), e.toUpperCase = () => e.check(Fi());
2517
- }), ns = /* @__PURE__ */ c("ZodString", (e, t) => {
2518
- ke.init(e, t), Qt.init(e, t), e.email = (n) => e.check(Jt(en, n)), e.url = (n) => e.check(Yt(nn, n)), e.jwt = (n) => e.check(di(_s, n)), e.emoji = (n) => e.check(ni(rs, n)), e.guid = (n) => e.check(Be(Ce, n)), e.uuid = (n) => e.check(Ho(re, n)), e.uuidv4 = (n) => e.check(Qo(re, n)), e.uuidv6 = (n) => e.check(ei(re, n)), e.uuidv7 = (n) => e.check(ti(re, n)), e.nanoid = (n) => e.check(ri(os, n)), e.guid = (n) => e.check(Be(Ce, n)), e.cuid = (n) => e.check(oi(is, n)), e.cuid2 = (n) => e.check(ii(ss, n)), e.ulid = (n) => e.check(si(cs, n)), e.base64 = (n) => e.check(pi(hs, n)), e.base64url = (n) => e.check(mi(ds, n)), e.xid = (n) => e.check(ci(us, n)), e.ksuid = (n) => e.check(ui(as, n)), e.ipv4 = (n) => e.check(qt(on, n)), e.ipv6 = (n) => e.check(ai(ls, n)), e.cidrv4 = (n) => e.check(fi(ps, n)), e.cidrv6 = (n) => e.check(li(ms, n)), e.e164 = (n) => e.check(hi(gs, n)), e.datetime = (n) => e.check(Vi(n)), e.date = (n) => e.check(Ci(n)), e.time = (n) => e.check(Ji(n)), e.duration = (n) => e.check(qi(n));
2519
- });
2520
- function M(e) {
2521
- return Xo(ns, e);
2522
- }
2523
- const k = /* @__PURE__ */ c("ZodStringFormat", (e, t) => {
2524
- w.init(e, t), Qt.init(e, t);
2525
- }), en = /* @__PURE__ */ c("ZodEmail", (e, t) => {
2526
- ro.init(e, t), k.init(e, t);
2527
- });
2528
- function tn(e) {
2529
- return Jt(en, e);
2530
- }
2531
- const Ce = /* @__PURE__ */ c("ZodGUID", (e, t) => {
2532
- to.init(e, t), k.init(e, t);
2533
- }), re = /* @__PURE__ */ c("ZodUUID", (e, t) => {
2534
- no.init(e, t), k.init(e, t);
2535
- }), nn = /* @__PURE__ */ c("ZodURL", (e, t) => {
2536
- oo.init(e, t), k.init(e, t);
2537
- });
2538
- function rn(e) {
2539
- return Yt(nn, e);
2540
- }
2541
- const rs = /* @__PURE__ */ c("ZodEmoji", (e, t) => {
2542
- io.init(e, t), k.init(e, t);
2543
- }), os = /* @__PURE__ */ c("ZodNanoID", (e, t) => {
2544
- so.init(e, t), k.init(e, t);
2545
- }), is = /* @__PURE__ */ c("ZodCUID", (e, t) => {
2546
- co.init(e, t), k.init(e, t);
2547
- }), ss = /* @__PURE__ */ c("ZodCUID2", (e, t) => {
2548
- uo.init(e, t), k.init(e, t);
2549
- }), cs = /* @__PURE__ */ c("ZodULID", (e, t) => {
2550
- ao.init(e, t), k.init(e, t);
2551
- }), us = /* @__PURE__ */ c("ZodXID", (e, t) => {
2552
- fo.init(e, t), k.init(e, t);
2553
- }), as = /* @__PURE__ */ c("ZodKSUID", (e, t) => {
2554
- lo.init(e, t), k.init(e, t);
2555
- }), on = /* @__PURE__ */ c("ZodIPv4", (e, t) => {
2556
- _o.init(e, t), k.init(e, t);
2557
- });
2558
- function fs(e) {
2559
- return qt(on, e);
2560
- }
2561
- const ls = /* @__PURE__ */ c("ZodIPv6", (e, t) => {
2562
- vo.init(e, t), k.init(e, t);
2563
- }), ps = /* @__PURE__ */ c("ZodCIDRv4", (e, t) => {
2564
- bo.init(e, t), k.init(e, t);
2565
- }), ms = /* @__PURE__ */ c("ZodCIDRv6", (e, t) => {
2566
- yo.init(e, t), k.init(e, t);
2567
- }), hs = /* @__PURE__ */ c("ZodBase64", (e, t) => {
2568
- zo.init(e, t), k.init(e, t);
2569
- }), ds = /* @__PURE__ */ c("ZodBase64URL", (e, t) => {
2570
- $o.init(e, t), k.init(e, t);
2571
- }), gs = /* @__PURE__ */ c("ZodE164", (e, t) => {
2572
- Zo.init(e, t), k.init(e, t);
2573
- }), _s = /* @__PURE__ */ c("ZodJWT", (e, t) => {
2574
- Io.init(e, t), k.init(e, t);
2575
- }), sn = /* @__PURE__ */ c("ZodNumber", (e, t) => {
2576
- Kt.init(e, t), Z.init(e, t), e.gt = (r, o) => e.check(Ve(r, o)), e.gte = (r, o) => e.check(se(r, o)), e.min = (r, o) => e.check(se(r, o)), e.lt = (r, o) => e.check(We(r, o)), e.lte = (r, o) => e.check(ie(r, o)), e.max = (r, o) => e.check(ie(r, o)), e.int = (r) => e.check(Ke(r)), e.safe = (r) => e.check(Ke(r)), e.positive = (r) => e.check(Ve(0, r)), e.nonnegative = (r) => e.check(se(0, r)), e.negative = (r) => e.check(We(0, r)), e.nonpositive = (r) => e.check(ie(0, r)), e.multipleOf = (r, o) => e.check(Ge(r, o)), e.step = (r, o) => e.check(Ge(r, o)), e.finite = () => e;
2577
- const n = e._zod.bag;
2578
- 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;
2579
- });
2580
- function R(e) {
2581
- return yi(sn, e);
2582
- }
2583
- const vs = /* @__PURE__ */ c("ZodNumberFormat", (e, t) => {
2584
- Eo.init(e, t), sn.init(e, t);
2585
- });
2586
- function Ke(e) {
2587
- return zi(vs, e);
2588
- }
2589
- const bs = /* @__PURE__ */ c("ZodBoolean", (e, t) => {
2590
- Ao.init(e, t), Z.init(e, t);
2591
- });
2592
- function ys(e) {
2593
- return wi(bs, e);
2594
- }
2595
- const zs = /* @__PURE__ */ c("ZodAny", (e, t) => {
2596
- xo.init(e, t), Z.init(e, t);
2597
- });
2598
- function D() {
2599
- return $i(zs);
2600
- }
2601
- const ws = /* @__PURE__ */ c("ZodUnknown", (e, t) => {
2602
- Oo.init(e, t), Z.init(e, t);
2603
- });
2604
- function Je() {
2605
- return Zi(ws);
2606
- }
2607
- const $s = /* @__PURE__ */ c("ZodNever", (e, t) => {
2608
- So.init(e, t), Z.init(e, t);
2609
- });
2610
- function Zs(e) {
2611
- return ki($s, e);
2612
- }
2613
- const ks = /* @__PURE__ */ c("ZodDate", (e, t) => {
2614
- Po.init(e, t), Z.init(e, t), e.min = (r, o) => e.check(se(r, o)), e.max = (r, o) => e.check(ie(r, o));
2615
- const n = e._zod.bag;
2616
- e.minDate = n.minimum ? new Date(n.minimum) : null, e.maxDate = n.maximum ? new Date(n.maximum) : null;
2617
- });
2618
- function Is(e) {
2619
- return Ii(ks, e);
2620
- }
2621
- const Es = /* @__PURE__ */ c("ZodArray", (e, t) => {
2622
- jo.init(e, t), Z.init(e, t), e.element = t.element, e.min = (n, r) => e.check(ae(n, r)), e.nonempty = (n) => e.check(ae(1, n)), e.max = (n, r) => e.check(Xt(n, r)), e.length = (n, r) => e.check(Ht(n, r)), e.unwrap = () => e.element;
2623
- });
2624
- function x(e, t) {
2625
- return Ti(Es, e, t);
2626
- }
2627
- const As = /* @__PURE__ */ c("ZodObject", (e, t) => {
2628
- No.init(e, t), Z.init(e, t), y(e, "shape", () => t.shape), e.keyof = () => Ps(Object.keys(e._zod.def.shape)), e.catchall = (n) => e.clone({ ...e._zod.def, catchall: n }), e.passthrough = () => e.clone({ ...e._zod.def, catchall: Je() }), e.loose = () => e.clone({ ...e._zod.def, catchall: Je() }), e.strict = () => e.clone({ ...e._zod.def, catchall: Zs() }), e.strip = () => e.clone({ ...e._zod.def, catchall: void 0 }), e.extend = (n) => tr(e, n), e.merge = (n) => nr(e, n), e.pick = (n) => Qn(e, n), e.omit = (n) => er(e, n), e.partial = (...n) => rr(an, e, n[0]), e.required = (...n) => or(fn, e, n[0]);
2629
- });
2630
- function xs(e, t) {
2631
- const n = {
2632
- type: "object",
2633
- get shape() {
2634
- return T(this, "shape", { ...e }), this.shape;
2635
- },
2636
- ...l(t)
2637
- };
2638
- return new As(n);
2639
- }
2640
- const Os = /* @__PURE__ */ c("ZodUnion", (e, t) => {
2641
- Do.init(e, t), Z.init(e, t), e.options = t.options;
2642
- });
2643
- function cn(e, t) {
2644
- return new Os({
2645
- type: "union",
2646
- options: e,
2647
- ...l(t)
2648
- });
2649
- }
2650
- const Ss = /* @__PURE__ */ c("ZodIntersection", (e, t) => {
2651
- Ro.init(e, t), Z.init(e, t);
2652
- });
2653
- function un(e, t) {
2654
- return new Ss({
2655
- type: "intersection",
2656
- left: e,
2657
- right: t
2658
- });
2659
- }
2660
- const ze = /* @__PURE__ */ c("ZodEnum", (e, t) => {
2661
- Mo.init(e, t), Z.init(e, t), e.enum = t.entries, e.options = Object.values(t.entries);
2662
- const n = new Set(Object.keys(t.entries));
2663
- e.extract = (r, o) => {
2664
- const i = {};
2665
- for (const s of r)
2666
- if (n.has(s))
2667
- i[s] = t.entries[s];
2668
- else
2669
- throw new Error(`Key ${s} not found in enum`);
2670
- return new ze({
2671
- ...t,
2672
- checks: [],
2673
- ...l(o),
2674
- entries: i
2675
- });
2676
- }, e.exclude = (r, o) => {
2677
- const i = { ...t.entries };
2678
- for (const s of r)
2679
- if (n.has(s))
2680
- delete i[s];
2681
- else
2682
- throw new Error(`Key ${s} not found in enum`);
2683
- return new ze({
2684
- ...t,
2685
- checks: [],
2686
- ...l(o),
2687
- entries: i
2688
- });
2689
- };
2690
- });
2691
- function Ps(e, t) {
2692
- const n = Array.isArray(e) ? Object.fromEntries(e.map((r) => [r, r])) : e;
2693
- return new ze({
2694
- type: "enum",
2695
- entries: n,
2696
- ...l(t)
2697
- });
2698
- }
2699
- const js = /* @__PURE__ */ c("ZodFile", (e, t) => {
2700
- Uo.init(e, t), Z.init(e, t), e.min = (n, r) => e.check(Ai(n, r)), e.max = (n, r) => e.check(Ei(n, r)), e.mime = (n, r) => e.check(Di(Array.isArray(n) ? n : [n], r));
2701
- });
2702
- function j(e) {
2703
- return Li(js, e);
2704
- }
2705
- const Ns = /* @__PURE__ */ c("ZodTransform", (e, t) => {
2706
- Fo.init(e, t), Z.init(e, t), e._zod.parse = (n, r) => {
2707
- n.addIssue = (i) => {
2708
- if (typeof i == "string")
2709
- n.issues.push(Y(i, n.value, t));
2710
- else {
2711
- const s = i;
2712
- s.fatal && (s.continue = !1), s.code ?? (s.code = "custom"), s.input ?? (s.input = n.value), s.inst ?? (s.inst = e), n.issues.push(Y(s));
2713
- }
2714
- };
2715
- const o = t.transform(n.value, n);
2716
- return o instanceof Promise ? o.then((i) => (n.value = i, n)) : (n.value = o, n);
2717
- };
2718
- });
2719
- function Ds(e) {
2720
- return new Ns({
2721
- type: "transform",
2722
- transform: e
2723
- });
2724
- }
2725
- const an = /* @__PURE__ */ c("ZodOptional", (e, t) => {
2726
- To.init(e, t), Z.init(e, t), e.unwrap = () => e._zod.def.innerType;
2727
- });
2728
- function Ye(e) {
2729
- return new an({
2730
- type: "optional",
2731
- innerType: e
2732
- });
2733
- }
2734
- const Rs = /* @__PURE__ */ c("ZodNullable", (e, t) => {
2735
- Lo.init(e, t), Z.init(e, t), e.unwrap = () => e._zod.def.innerType;
2736
- });
2737
- function qe(e) {
2738
- return new Rs({
2739
- type: "nullable",
2740
- innerType: e
2741
- });
2742
- }
2743
- const Ms = /* @__PURE__ */ c("ZodDefault", (e, t) => {
2744
- Bo.init(e, t), Z.init(e, t), e.unwrap = () => e._zod.def.innerType, e.removeDefault = e.unwrap;
2745
- });
2746
- function Us(e, t) {
2747
- return new Ms({
2748
- type: "default",
2749
- innerType: e,
2750
- get defaultValue() {
2751
- return typeof t == "function" ? t() : t;
2752
- }
2753
- });
2754
- }
2755
- const Fs = /* @__PURE__ */ c("ZodPrefault", (e, t) => {
2756
- Wo.init(e, t), Z.init(e, t), e.unwrap = () => e._zod.def.innerType;
2757
- });
2758
- function Ts(e, t) {
2759
- return new Fs({
2760
- type: "prefault",
2761
- innerType: e,
2762
- get defaultValue() {
2763
- return typeof t == "function" ? t() : t;
2764
- }
2765
- });
2766
- }
2767
- const fn = /* @__PURE__ */ c("ZodNonOptional", (e, t) => {
2768
- Vo.init(e, t), Z.init(e, t), e.unwrap = () => e._zod.def.innerType;
2769
- });
2770
- function Ls(e, t) {
2771
- return new fn({
2772
- type: "nonoptional",
2773
- innerType: e,
2774
- ...l(t)
2775
- });
2776
- }
2777
- const Bs = /* @__PURE__ */ c("ZodCatch", (e, t) => {
2778
- Go.init(e, t), Z.init(e, t), e.unwrap = () => e._zod.def.innerType, e.removeCatch = e.unwrap;
2779
- });
2780
- function Ws(e, t) {
2781
- return new Bs({
2782
- type: "catch",
2783
- innerType: e,
2784
- catchValue: typeof t == "function" ? t : () => t
2785
- });
2786
- }
2787
- const Vs = /* @__PURE__ */ c("ZodPipe", (e, t) => {
2788
- Co.init(e, t), Z.init(e, t), e.in = t.in, e.out = t.out;
2789
- });
2790
- function Xe(e, t) {
2791
- return new Vs({
2792
- type: "pipe",
2793
- in: e,
2794
- out: t
2795
- // ...util.normalizeParams(params),
2796
- });
2797
- }
2798
- const Gs = /* @__PURE__ */ c("ZodReadonly", (e, t) => {
2799
- Ko.init(e, t), Z.init(e, t), e.unwrap = () => e._zod.def.innerType;
2800
- });
2801
- function Cs(e) {
2802
- return new Gs({
2803
- type: "readonly",
2804
- innerType: e
2805
- });
2806
- }
2807
- const Ks = /* @__PURE__ */ c("ZodCustom", (e, t) => {
2808
- Jo.init(e, t), Z.init(e, t);
2809
- });
2810
- function Js(e) {
2811
- const t = new A({
2812
- check: "custom"
2813
- // ...util.normalizeParams(params),
2814
- });
2815
- return t._zod.check = e, t;
2816
- }
2817
- function Ys(e, t = {}) {
2818
- return Bi(Ks, e, t);
2819
- }
2820
- function qs(e) {
2821
- const t = Js((n) => (n.addIssue = (r) => {
2822
- if (typeof r == "string")
2823
- n.issues.push(Y(r, n.value, t._zod.def));
2824
- else {
2825
- const o = r;
2826
- 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(Y(o));
2827
- }
2828
- }, e(n.value, n)));
2829
- return t;
2830
- }
2831
- const He = {
2832
- "arrayEach:string": () => x(M({ error: "Each item must be a string" })),
2833
- "arrayEach:number": () => x(R({ error: "Each item must be a number" })),
2834
- "arrayEach:email": () => x(tn({ error: "Each item must be a valid email" })),
2835
- "arrayEach:url": () => x(rn({ error: "Each item must be a valid URL" })),
2836
- "arrayEach:file": () => x(j({ error: "Each item must be a file" }))
2837
- }, Qe = {
2838
- nullable: () => M().nullable().optional(),
2839
- required: () => cn([
2840
- M().min(1, { error: "This field is required" }),
2841
- j({ error: "This field is required" }),
2842
- x(D()).min(1, { error: "This field is required" })
2843
- ]),
2844
- string: () => M({ error: "Must be a string" }),
2845
- email: () => tn({ error: "Invalid email format" }),
2846
- url: () => rn({ error: "Invalid URL format" }),
2847
- number: () => R({ error: "Must be a number" }),
2848
- integer: () => R().int({ error: "Must be an integer" }),
2849
- positive: () => R().positive({ error: "Must be positive" }),
2850
- negative: () => R().negative({ error: "Must be negative" }),
2851
- ipv4: () => fs({ error: "Must be valid IPv4" }),
2852
- boolean: () => ys({ error: "Must be a boolean" }),
2853
- date: () => Is({ error: "Must be a valid date" }),
2854
- array: () => x(D(), { error: "Must be an array" }),
2855
- object: () => xs({}, { error: "Must be an object" }),
2856
- file: () => j({ error: "Must be a file" })
2857
- }, et = (e) => {
2858
- const t = { B: 1, KB: 1024, MB: 1048576, GB: 1073741824, TB: 1099511627776 }, n = e.match(/^(\d+(?:\.\d+)?)\s*(B|KB|MB|GB|TB)$/i);
2859
- if (!n) throw new Error(`Invalid size format: ${e}`);
2860
- const [, r, o] = n;
2861
- return Math.round(Number(r) * t[o.toUpperCase()]);
2862
- }, tt = (e) => {
2863
- if (e.includes(",")) {
2864
- const t = e.split(",").map((n) => n.trim());
2865
- return j().refine(
2866
- (n) => t.some(
2867
- (r) => r.endsWith("/*") ? n.type.startsWith(r.slice(0, -1)) : n.type === r
2868
- ),
2869
- { error: `Must be one of: ${t.join(", ")}` }
2870
- );
2871
- } else if (e.endsWith("/*")) {
2872
- const t = e.slice(0, -1);
2873
- return j().refine((n) => n.type.startsWith(t), {
2874
- error: `Must be ${e} file`
2875
- });
2876
- } else
2877
- return j().mime(e, {
2878
- error: `Must be ${e} file`
2879
- });
2880
- }, Xs = (e) => {
2881
- const [t, n] = Vn(
2882
- e,
2883
- (o) => typeof o == "function"
2884
- );
2885
- return [
2886
- ...t.map((o) => {
2887
- const i = o;
2888
- return D().refine(o, {
2889
- message: i.message || "Validation failed"
2890
- });
2891
- }),
2892
- ...n.map((o) => {
2893
- if (!Cn(o)) return D();
2894
- if (o in Qe)
2895
- return Qe[o]();
2896
- if (o in He)
2897
- return He[o]();
2898
- if (o.startsWith("min:")) {
2899
- const i = parseInt(o.split(":")[1]);
2900
- return R().min(i, { error: `Must be at least ${i}` });
2901
- }
2902
- if (o.startsWith("max:")) {
2903
- const i = parseInt(o.split(":")[1]);
2904
- return R().max(i, { error: `Must be at most ${i}` });
2905
- }
2906
- if (o.startsWith("minLength:")) {
2907
- const i = parseInt(o.split(":")[1]);
2908
- return M().min(i, { error: `Must be at least ${i} characters` });
2909
- }
2910
- if (o.startsWith("maxLength:")) {
2911
- const i = parseInt(o.split(":")[1]);
2912
- return M().max(i, { error: `Must be at most ${i} characters` });
2913
- }
2914
- if (o.startsWith("arrayMinLength:")) {
2915
- const i = parseInt(o.split(":")[1]);
2916
- return x(D()).min(i, { error: `Must have at least ${i} items` });
2917
- }
2918
- if (o.startsWith("arrayMaxLength:")) {
2919
- const i = parseInt(o.split(":")[1]);
2920
- return x(D()).max(i, { error: `Must have at most ${i} items` });
2921
- }
2922
- if (o.startsWith("pattern:")) {
2923
- const i = o.split(":")[1];
2924
- return M().regex(new RegExp(i), { error: "Invalid format" });
2925
- }
2926
- if (o.startsWith("fileSize:")) {
2927
- const i = o.split(":")[1], s = et(i);
2928
- return j().max(s, { error: `File too large (max ${i})` });
2929
- }
2930
- if (o.startsWith("arrayEach:fileSize:")) {
2931
- const i = o.split(":")[2], s = et(i);
2932
- return x(j().max(s, { error: `Each file must be smaller than ${i}` }));
2933
- }
2934
- if (o.startsWith("fileType:")) {
2935
- const i = o.split(":")[1];
2936
- return tt(i);
2937
- }
2938
- if (o.startsWith("arrayEach:fileType:")) {
2939
- const i = o.split(":")[2], s = tt(i);
2940
- return x(s);
2941
- }
2942
- return D();
2943
- })
2944
- ].reduce((o, i) => un(o, i));
2945
- }, Hs = ({
2946
- initialData: e,
2947
- validationRules: t
2948
- }) => {
2949
- const [n, r] = Ee(e), [o, i] = Ee({}), s = Ae(() => !xt(o), [o]), u = Ae(() => !Un(n, e), [n, e]), f = S(
2950
- (d, E) => {
2951
- if (typeof d == "string") {
2952
- if (!Q(e, d))
2953
- throw new Error(`Invalid path: '${d}'`);
2954
- r((v) => Dn(En(v), d, E));
2955
- } else
2956
- r((v) => ({ ...v, ...d }));
2957
- },
2958
- [e]
2959
- ), a = S(
2960
- (d, E) => {
2961
- if (d !== "root" && !Q(e, d))
2962
- throw new Error(`Invalid path: '${d}'`);
2963
- i((v) => ({
2964
- ...v,
2965
- [d]: E
2966
- }));
2967
- },
2968
- [e]
2969
- ), g = S(
2970
- (d) => {
2971
- if (!Q(e, d))
2972
- throw new Error(`Invalid path: '${d}'`);
2973
- return !!o[d];
2974
- },
2975
- [o, e]
2976
- ), p = S(
2977
- (d) => {
2978
- if (!Q(e, d))
2979
- throw new Error(`Invalid path: '${d}'`);
2980
- i((E) => Gn(E, [d]));
2981
- },
2982
- [e]
2983
- ), m = S(
2984
- () => {
2985
- i({});
2986
- },
2987
- []
2988
- ), h = S(
2989
- () => {
2990
- r(e), i({});
2991
- },
2992
- [e]
2993
- ), I = S(() => {
2994
- let d = !0;
2995
- return t && Ln(t, (E, v) => {
2996
- const _ = ot(n, v), $ = Xs(E).safeParse(_);
2997
- if ($.success)
2998
- p(v);
2999
- else {
3000
- const P = $.error.issues.map((O) => O.message);
3001
- a(v, P), d = $.success;
3002
- }
3003
- }), d;
3004
- }, [n, t, p, a]);
3005
- return {
3006
- data: n,
3007
- setData: f,
3008
- errors: o,
3009
- hasErrors: s,
3010
- clearErrors: m,
3011
- clearError: p,
3012
- setError: a,
3013
- hasError: g,
3014
- reset: h,
3015
- isDirty: u,
3016
- validate: I
3017
- };
3018
- }, rc = ({
3019
- headers: e = {},
3020
- initialData: t,
3021
- operation: n,
3022
- options: r = {},
3023
- validationRules: o
3024
- }) => {
3025
- const i = Hs({ initialData: t, validationRules: o }), s = ln(null), [u, { loading: f }] = Wn(n, { errorPolicy: "all", ...r }), a = S(
3026
- (p = {}) => {
3027
- const {
3028
- onBefore: m = () => {
3029
- },
3030
- onError: h = () => {
3031
- },
3032
- onFinish: I = () => {
3033
- },
3034
- onSuccess: d = () => {
3035
- },
3036
- skipValidation: E = !1
3037
- } = p;
3038
- if (!E && !i.validate())
3039
- return;
3040
- const v = s.current ? s.current(i.data) : i.data;
3041
- m?.(), u({
3042
- variables: { input: v },
3043
- ...!xt(e) && { context: { headers: e } }
3044
- }).then((_) => {
3045
- _.errors && _.errors.length > 0 ? h?.(_.errors) : d?.(_);
3046
- }).catch((_) => {
3047
- h?.(_);
3048
- }).finally(() => {
3049
- I?.();
3050
- });
3051
- },
3052
- [i, u, e]
3053
- ), g = S(
3054
- (p) => (s.current = p, { ...i, isLoading: f, submit: a }),
3055
- [f, i, a]
3056
- );
3057
- return {
3058
- ...i,
3059
- isLoading: f,
3060
- submit: a,
3061
- transform: g
3062
- };
3063
- };
3064
- export {
3065
- Bn as a,
3066
- Hs as b,
3067
- Xs as h,
3068
- xt as i,
3069
- rc as u
3070
- };