@twintag/twintag-form 1.6.0 → 1.6.2-beta.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +12 -0
- package/README.md +59 -22
- package/dev/index.css +32 -32
- package/dev/main.tsx +1 -0
- package/lib/common/button.tsx +6 -6
- package/lib/common/calendar.tsx +10 -9
- package/lib/common/checkbox.tsx +3 -3
- package/lib/common/form.tsx +3 -3
- package/lib/common/icon.tsx +1 -1
- package/lib/common/input.tsx +4 -4
- package/lib/common/label.tsx +1 -1
- package/lib/common/popover.tsx +1 -1
- package/lib/common/radiogroup.tsx +2 -2
- package/lib/common/slider.tsx +3 -3
- package/lib/common/switch.tsx +3 -3
- package/lib/common/textarea.tsx +3 -3
- package/lib/components/containers/category.tsx +1 -1
- package/lib/components/fields/checkbox.tsx +1 -1
- package/lib/components/fields/date-picker.tsx +5 -5
- package/lib/components/fields/file.tsx +4 -3
- package/lib/components/fields/input.tsx +2 -2
- package/lib/components/fields/radiogroup.tsx +1 -1
- package/lib/components/fields/textarea.tsx +6 -2
- package/lib/components/fields/toggle.tsx +1 -1
- package/lib/components/fields/tri-toggle.tsx +4 -4
- package/lib/components/provider.tsx +4 -5
- package/lib/index.tsx +7 -3
- package/lib/types/index.ts +26 -6
- package/package.json +1 -1
- package/tailwind.config.ts +21 -26
- package/.turbo/turbo-build.log +0 -22
- package/dist/common/accordion.d.ts +0 -7
- package/dist/common/button.d.ts +0 -71
- package/dist/common/calendar.d.ts +0 -139
- package/dist/common/checkbox.d.ts +0 -4
- package/dist/common/form.d.ts +0 -86
- package/dist/common/icon.d.ts +0 -8
- package/dist/common/input.d.ts +0 -133
- package/dist/common/label.d.ts +0 -21
- package/dist/common/popover.d.ts +0 -6
- package/dist/common/radiogroup.d.ts +0 -5
- package/dist/common/slider.d.ts +0 -4
- package/dist/common/switch.d.ts +0 -4
- package/dist/common/textarea.d.ts +0 -68
- package/dist/components/config.d.ts +0 -6
- package/dist/components/containers/accordion.d.ts +0 -7
- package/dist/components/containers/category.d.ts +0 -8
- package/dist/components/fields/checkbox.d.ts +0 -5
- package/dist/components/fields/date-picker.d.ts +0 -4
- package/dist/components/fields/file.d.ts +0 -5
- package/dist/components/fields/input.d.ts +0 -5
- package/dist/components/fields/radiogroup.d.ts +0 -7
- package/dist/components/fields/submit.d.ts +0 -4
- package/dist/components/fields/textarea.d.ts +0 -5
- package/dist/components/fields/toggle.d.ts +0 -5
- package/dist/components/fields/tri-toggle.d.ts +0 -5
- package/dist/components/form.d.ts +0 -9
- package/dist/components/input.d.ts +0 -4
- package/dist/components/label.d.ts +0 -4
- package/dist/components/provider.d.ts +0 -19
- package/dist/components/renderer.d.ts +0 -1
- package/dist/index.cjs +0 -1
- package/dist/index.d.ts +0 -16
- package/dist/index.js +0 -4456
- package/dist/types/index.d.ts +0 -58
- package/dist/utils/data.d.ts +0 -7
- package/dist/utils/string.d.ts +0 -3
- package/dist/utils/style.d.ts +0 -3
- package/dist/webcomponent.cjs +0 -1
- package/dist/webcomponent.d.ts +0 -1
- package/dist/webcomponent.js +0 -1170
package/dist/index.js
DELETED
|
@@ -1,4456 +0,0 @@
|
|
|
1
|
-
import { jsx as c, jsxs as T, Fragment as Z } from "react/jsx-runtime";
|
|
2
|
-
import * as O from "react";
|
|
3
|
-
import { useMemo as lt, createContext as zr, useContext as Lr, forwardRef as Ft, useRef as Fr, useImperativeHandle as Dr, useEffect as Et } from "react";
|
|
4
|
-
import { twMerge as Ur, extendTailwindMerge as Br } from "tailwind-merge";
|
|
5
|
-
import * as pe from "@radix-ui/react-accordion";
|
|
6
|
-
import { ChevronDown as Wr, AsteriskIcon as _e, ChevronRight as qr, ChevronLeft as Gr, Calendar as Jr, Circle as Hr } from "lucide-react";
|
|
7
|
-
import * as Yr from "@heroicons/react/24/outline";
|
|
8
|
-
import { v4 as Kr } from "uuid";
|
|
9
|
-
import { useFormContext as ie, Controller as Qr, FormProvider as Xr, useForm as ea } from "react-hook-form";
|
|
10
|
-
import * as ut from "@radix-ui/react-checkbox";
|
|
11
|
-
import { CheckIcon as ta } from "@radix-ui/react-icons";
|
|
12
|
-
import { Slot as Dt } from "@radix-ui/react-slot";
|
|
13
|
-
import * as Ut from "@radix-ui/react-label";
|
|
14
|
-
import { format as ra } from "date-fns";
|
|
15
|
-
import { DayPicker as aa } from "react-day-picker";
|
|
16
|
-
import * as at from "@radix-ui/react-popover";
|
|
17
|
-
import * as Ve from "@radix-ui/react-radio-group";
|
|
18
|
-
import * as ft from "@radix-ui/react-switch";
|
|
19
|
-
import * as Ee from "@radix-ui/react-slider";
|
|
20
|
-
var Ot = (r) => typeof r == "boolean" ? `${r}` : r === 0 ? "0" : r, D = (r) => !r || typeof r != "object" || Object.keys(r).length === 0, na = (r, e) => JSON.stringify(r) === JSON.stringify(e);
|
|
21
|
-
function Bt(r, e) {
|
|
22
|
-
r.forEach(function(t) {
|
|
23
|
-
Array.isArray(t) ? Bt(t, e) : e.push(t);
|
|
24
|
-
});
|
|
25
|
-
}
|
|
26
|
-
function Wt(r) {
|
|
27
|
-
let e = [];
|
|
28
|
-
return Bt(r, e), e;
|
|
29
|
-
}
|
|
30
|
-
var qt = (...r) => Wt(r).filter(Boolean), Gt = (r, e) => {
|
|
31
|
-
let t = {}, a = Object.keys(r), s = Object.keys(e);
|
|
32
|
-
for (let n of a) if (s.includes(n)) {
|
|
33
|
-
let i = r[n], o = e[n];
|
|
34
|
-
Array.isArray(i) || Array.isArray(o) ? t[n] = qt(o, i) : typeof i == "object" && typeof o == "object" ? t[n] = Gt(i, o) : t[n] = o + " " + i;
|
|
35
|
-
} else t[n] = r[n];
|
|
36
|
-
for (let n of s) a.includes(n) || (t[n] = e[n]);
|
|
37
|
-
return t;
|
|
38
|
-
}, It = (r) => !r || typeof r != "string" ? r : r.replace(/\s+/g, " ").trim(), sa = { twMerge: !0, twMergeConfig: {}, responsiveVariants: !1 }, Jt = (r) => r || void 0, Ze = (...r) => Jt(Wt(r).filter(Boolean).join(" ")), ct = null, ae = {}, ht = !1, Se = (...r) => (e) => e.twMerge ? ((!ct || ht) && (ht = !1, ct = D(ae) ? Ur : Br({ ...ae, extend: { theme: ae.theme, classGroups: ae.classGroups, conflictingClassGroupModifiers: ae.conflictingClassGroupModifiers, conflictingClassGroups: ae.conflictingClassGroups, ...ae.extend } })), Jt(ct(Ze(r)))) : Ze(r), Vt = (r, e) => {
|
|
39
|
-
for (let t in e) r.hasOwnProperty(t) ? r[t] = Ze(r[t], e[t]) : r[t] = e[t];
|
|
40
|
-
return r;
|
|
41
|
-
}, I = (r, e) => {
|
|
42
|
-
let { extend: t = null, slots: a = {}, variants: s = {}, compoundVariants: n = [], compoundSlots: i = [], defaultVariants: o = {} } = r, d = { ...sa, ...e }, l = t != null && t.base ? Ze(t.base, r == null ? void 0 : r.base) : r == null ? void 0 : r.base, h = t != null && t.variants && !D(t.variants) ? Gt(s, t.variants) : s, x = t != null && t.defaultVariants && !D(t.defaultVariants) ? { ...t.defaultVariants, ...o } : o;
|
|
43
|
-
!D(d.twMergeConfig) && !na(d.twMergeConfig, ae) && (ht = !0, ae = d.twMergeConfig);
|
|
44
|
-
let M = D(t == null ? void 0 : t.slots), P = D(a) ? {} : { base: Ze(r == null ? void 0 : r.base, M && (t == null ? void 0 : t.base)), ...a }, Re = M ? P : Vt({ ...t == null ? void 0 : t.slots }, D(P) ? { base: r == null ? void 0 : r.base } : P), be = D(t == null ? void 0 : t.compoundVariants) ? n : qt(t == null ? void 0 : t.compoundVariants, n), te = ($) => {
|
|
45
|
-
if (D(h) && D(a) && M) return Se(l, $ == null ? void 0 : $.class, $ == null ? void 0 : $.className)(d);
|
|
46
|
-
if (be && !Array.isArray(be)) throw new TypeError(`The "compoundVariants" prop must be an array. Received: ${typeof be}`);
|
|
47
|
-
if (i && !Array.isArray(i)) throw new TypeError(`The "compoundSlots" prop must be an array. Received: ${typeof i}`);
|
|
48
|
-
let Vr = (k, C, N = [], R) => {
|
|
49
|
-
let A = N;
|
|
50
|
-
if (typeof C == "string") A = A.concat(It(C).split(" ").map((S) => `${k}:${S}`));
|
|
51
|
-
else if (Array.isArray(C)) A = A.concat(C.reduce((S, V) => S.concat(`${k}:${V}`), []));
|
|
52
|
-
else if (typeof C == "object" && typeof R == "string") {
|
|
53
|
-
for (let S in C) if (C.hasOwnProperty(S) && S === R) {
|
|
54
|
-
let V = C[S];
|
|
55
|
-
if (V && typeof V == "string") {
|
|
56
|
-
let j = It(V);
|
|
57
|
-
A[R] ? A[R] = A[R].concat(j.split(" ").map((z) => `${k}:${z}`)) : A[R] = j.split(" ").map((z) => `${k}:${z}`);
|
|
58
|
-
} else Array.isArray(V) && V.length > 0 && (A[R] = V.reduce((j, z) => j.concat(`${k}:${z}`), []));
|
|
59
|
-
}
|
|
60
|
-
}
|
|
61
|
-
return A;
|
|
62
|
-
}, Tt = (k, C = h, N = null, R = null) => {
|
|
63
|
-
var A;
|
|
64
|
-
let S = C[k];
|
|
65
|
-
if (!S || D(S)) return null;
|
|
66
|
-
let V = (A = R == null ? void 0 : R[k]) != null ? A : $ == null ? void 0 : $[k];
|
|
67
|
-
if (V === null) return null;
|
|
68
|
-
let j = Ot(V), z = Array.isArray(d.responsiveVariants) && d.responsiveVariants.length > 0 || d.responsiveVariants === !0, xe = x == null ? void 0 : x[k], W = [];
|
|
69
|
-
if (typeof j == "object" && z) for (let [ot, St] of Object.entries(j)) {
|
|
70
|
-
let $r = S[St];
|
|
71
|
-
if (ot === "initial") {
|
|
72
|
-
xe = St;
|
|
73
|
-
continue;
|
|
74
|
-
}
|
|
75
|
-
Array.isArray(d.responsiveVariants) && !d.responsiveVariants.includes(ot) || (W = Vr(ot, $r, W, N));
|
|
76
|
-
}
|
|
77
|
-
let He = j != null && typeof j != "object" ? j : Ot(xe), it = S[He || "false"];
|
|
78
|
-
return typeof W == "object" && typeof N == "string" && W[N] ? Vt(W, it) : W.length > 0 ? (W.push(it), N === "base" ? W.join(" ") : W) : it;
|
|
79
|
-
}, Zr = () => h ? Object.keys(h).map((k) => Tt(k, h)) : null, jr = (k, C) => {
|
|
80
|
-
if (!h || typeof h != "object") return null;
|
|
81
|
-
let N = new Array();
|
|
82
|
-
for (let R in h) {
|
|
83
|
-
let A = Tt(R, h, k, C), S = k === "base" && typeof A == "string" ? A : A && A[k];
|
|
84
|
-
S && (N[N.length] = S);
|
|
85
|
-
}
|
|
86
|
-
return N;
|
|
87
|
-
}, Ct = {};
|
|
88
|
-
for (let k in $) $[k] !== void 0 && (Ct[k] = $[k]);
|
|
89
|
-
let At = (k, C) => {
|
|
90
|
-
var N;
|
|
91
|
-
let R = typeof ($ == null ? void 0 : $[k]) == "object" ? { [k]: (N = $[k]) == null ? void 0 : N.initial } : {};
|
|
92
|
-
return { ...x, ...Ct, ...R, ...C };
|
|
93
|
-
}, Rt = (k = [], C) => {
|
|
94
|
-
let N = [];
|
|
95
|
-
for (let { class: R, className: A, ...S } of k) {
|
|
96
|
-
let V = !0;
|
|
97
|
-
for (let [j, z] of Object.entries(S)) {
|
|
98
|
-
let xe = At(j, C)[j];
|
|
99
|
-
if (Array.isArray(z)) {
|
|
100
|
-
if (!z.includes(xe)) {
|
|
101
|
-
V = !1;
|
|
102
|
-
break;
|
|
103
|
-
}
|
|
104
|
-
} else {
|
|
105
|
-
let W = (He) => He == null || He === !1;
|
|
106
|
-
if (W(z) && W(xe)) continue;
|
|
107
|
-
if (xe !== z) {
|
|
108
|
-
V = !1;
|
|
109
|
-
break;
|
|
110
|
-
}
|
|
111
|
-
}
|
|
112
|
-
}
|
|
113
|
-
V && (R && N.push(R), A && N.push(A));
|
|
114
|
-
}
|
|
115
|
-
return N;
|
|
116
|
-
}, Mr = (k) => {
|
|
117
|
-
let C = Rt(be, k);
|
|
118
|
-
if (!Array.isArray(C)) return C;
|
|
119
|
-
let N = {};
|
|
120
|
-
for (let R of C) if (typeof R == "string" && (N.base = Se(N.base, R)(d)), typeof R == "object") for (let [A, S] of Object.entries(R)) N[A] = Se(N[A], S)(d);
|
|
121
|
-
return N;
|
|
122
|
-
}, Pr = (k) => {
|
|
123
|
-
if (i.length < 1) return null;
|
|
124
|
-
let C = {};
|
|
125
|
-
for (let { slots: N = [], class: R, className: A, ...S } of i) {
|
|
126
|
-
if (!D(S)) {
|
|
127
|
-
let V = !0;
|
|
128
|
-
for (let j of Object.keys(S)) {
|
|
129
|
-
let z = At(j, k)[j];
|
|
130
|
-
if (z === void 0 || (Array.isArray(S[j]) ? !S[j].includes(z) : S[j] !== z)) {
|
|
131
|
-
V = !1;
|
|
132
|
-
break;
|
|
133
|
-
}
|
|
134
|
-
}
|
|
135
|
-
if (!V) continue;
|
|
136
|
-
}
|
|
137
|
-
for (let V of N) C[V] = C[V] || [], C[V].push([R, A]);
|
|
138
|
-
}
|
|
139
|
-
return C;
|
|
140
|
-
};
|
|
141
|
-
if (!D(a) || !M) {
|
|
142
|
-
let k = {};
|
|
143
|
-
if (typeof Re == "object" && !D(Re)) for (let C of Object.keys(Re)) k[C] = (N) => {
|
|
144
|
-
var R, A;
|
|
145
|
-
return Se(Re[C], jr(C, N), ((R = Mr(N)) != null ? R : [])[C], ((A = Pr(N)) != null ? A : [])[C], N == null ? void 0 : N.class, N == null ? void 0 : N.className)(d);
|
|
146
|
-
};
|
|
147
|
-
return k;
|
|
148
|
-
}
|
|
149
|
-
return Se(l, Zr(), Rt(be), $ == null ? void 0 : $.class, $ == null ? void 0 : $.className)(d);
|
|
150
|
-
}, Ir = () => {
|
|
151
|
-
if (!(!h || typeof h != "object")) return Object.keys(h);
|
|
152
|
-
};
|
|
153
|
-
return te.variantKeys = Ir(), te.extend = t, te.base = l, te.slots = Re, te.variants = h, te.defaultVariants = x, te.compoundSlots = i, te.compoundVariants = be, te;
|
|
154
|
-
};
|
|
155
|
-
const Zt = pe.Root, ia = I({
|
|
156
|
-
base: "border-b"
|
|
157
|
-
}), Ht = O.forwardRef(({ className: r, ...e }, t) => /* @__PURE__ */ c(
|
|
158
|
-
pe.Item,
|
|
159
|
-
{
|
|
160
|
-
ref: t,
|
|
161
|
-
className: ia({ className: r }),
|
|
162
|
-
...e
|
|
163
|
-
}
|
|
164
|
-
));
|
|
165
|
-
Ht.displayName = "AccordionItem";
|
|
166
|
-
const oa = I({
|
|
167
|
-
slots: {
|
|
168
|
-
header: "flex",
|
|
169
|
-
trigger: "flex flex-1 items-center justify-between py-4 font-medium hover:underline [&[data-state=open]>svg]:rotate-180",
|
|
170
|
-
icon: "h-4 w-4 shrink-0 text-current transition-transform duration-200"
|
|
171
|
-
}
|
|
172
|
-
}), Yt = O.forwardRef(({ className: r, children: e, ...t }, a) => {
|
|
173
|
-
const { header: s, trigger: n, icon: i } = oa();
|
|
174
|
-
return /* @__PURE__ */ c(pe.Header, { className: s(), asChild: !0, children: /* @__PURE__ */ c("div", { children: /* @__PURE__ */ T(
|
|
175
|
-
pe.Trigger,
|
|
176
|
-
{
|
|
177
|
-
ref: a,
|
|
178
|
-
className: n({
|
|
179
|
-
className: r
|
|
180
|
-
}),
|
|
181
|
-
...t,
|
|
182
|
-
children: [
|
|
183
|
-
e,
|
|
184
|
-
/* @__PURE__ */ c(Wr, { className: i() })
|
|
185
|
-
]
|
|
186
|
-
}
|
|
187
|
-
) }) });
|
|
188
|
-
});
|
|
189
|
-
Yt.displayName = pe.Trigger.displayName;
|
|
190
|
-
const ca = I({
|
|
191
|
-
slots: {
|
|
192
|
-
content: "overflow-hidden text-sm transition-all data-[state=closed]:animate-accordion-up data-[state=open]:animate-accordion-down",
|
|
193
|
-
wrapper: "pb-4 pt-0"
|
|
194
|
-
}
|
|
195
|
-
}), Kt = O.forwardRef(({ className: r, children: e, ...t }, a) => {
|
|
196
|
-
const { content: s, wrapper: n } = ca();
|
|
197
|
-
return /* @__PURE__ */ c(pe.Content, { ref: a, className: s(), ...t, children: /* @__PURE__ */ c("div", { className: n({ className: r }), children: e }) });
|
|
198
|
-
});
|
|
199
|
-
Kt.displayName = pe.Content.displayName;
|
|
200
|
-
const da = (r) => r.replace(
|
|
201
|
-
/(?:^\w|[A-Z]|\b\w)/g,
|
|
202
|
-
(e, t) => t === 0 ? e.toLowerCase() : e.toUpperCase()
|
|
203
|
-
).replace(/\s+/g, ""), la = (r) => r.replace(/-./g, (e) => e[1].toUpperCase()), ua = (r) => r && r[0].toUpperCase() + r.slice(1), fa = I({
|
|
204
|
-
base: "h-5 w-5"
|
|
205
|
-
}), ha = ({ name: r, className: e, ...t }) => {
|
|
206
|
-
const a = lt(
|
|
207
|
-
() => `${ua(la(r))}Icon`,
|
|
208
|
-
[r]
|
|
209
|
-
), s = Yr[a];
|
|
210
|
-
return s ? /* @__PURE__ */ c(
|
|
211
|
-
s,
|
|
212
|
-
{
|
|
213
|
-
"aria-hidden": "true",
|
|
214
|
-
className: fa({
|
|
215
|
-
className: e
|
|
216
|
-
}),
|
|
217
|
-
...t
|
|
218
|
-
}
|
|
219
|
-
) : /* @__PURE__ */ c(Z, {});
|
|
220
|
-
};
|
|
221
|
-
var w;
|
|
222
|
-
(function(r) {
|
|
223
|
-
r.assertEqual = (s) => s;
|
|
224
|
-
function e(s) {
|
|
225
|
-
}
|
|
226
|
-
r.assertIs = e;
|
|
227
|
-
function t(s) {
|
|
228
|
-
throw new Error();
|
|
229
|
-
}
|
|
230
|
-
r.assertNever = t, r.arrayToEnum = (s) => {
|
|
231
|
-
const n = {};
|
|
232
|
-
for (const i of s)
|
|
233
|
-
n[i] = i;
|
|
234
|
-
return n;
|
|
235
|
-
}, r.getValidEnumValues = (s) => {
|
|
236
|
-
const n = r.objectKeys(s).filter((o) => typeof s[s[o]] != "number"), i = {};
|
|
237
|
-
for (const o of n)
|
|
238
|
-
i[o] = s[o];
|
|
239
|
-
return r.objectValues(i);
|
|
240
|
-
}, r.objectValues = (s) => r.objectKeys(s).map(function(n) {
|
|
241
|
-
return s[n];
|
|
242
|
-
}), r.objectKeys = typeof Object.keys == "function" ? (s) => Object.keys(s) : (s) => {
|
|
243
|
-
const n = [];
|
|
244
|
-
for (const i in s)
|
|
245
|
-
Object.prototype.hasOwnProperty.call(s, i) && n.push(i);
|
|
246
|
-
return n;
|
|
247
|
-
}, r.find = (s, n) => {
|
|
248
|
-
for (const i of s)
|
|
249
|
-
if (n(i))
|
|
250
|
-
return i;
|
|
251
|
-
}, r.isInteger = typeof Number.isInteger == "function" ? (s) => Number.isInteger(s) : (s) => typeof s == "number" && isFinite(s) && Math.floor(s) === s;
|
|
252
|
-
function a(s, n = " | ") {
|
|
253
|
-
return s.map((i) => typeof i == "string" ? `'${i}'` : i).join(n);
|
|
254
|
-
}
|
|
255
|
-
r.joinValues = a, r.jsonStringifyReplacer = (s, n) => typeof n == "bigint" ? n.toString() : n;
|
|
256
|
-
})(w || (w = {}));
|
|
257
|
-
var mt;
|
|
258
|
-
(function(r) {
|
|
259
|
-
r.mergeShapes = (e, t) => ({
|
|
260
|
-
...e,
|
|
261
|
-
...t
|
|
262
|
-
// second overwrites first
|
|
263
|
-
});
|
|
264
|
-
})(mt || (mt = {}));
|
|
265
|
-
const m = w.arrayToEnum([
|
|
266
|
-
"string",
|
|
267
|
-
"nan",
|
|
268
|
-
"number",
|
|
269
|
-
"integer",
|
|
270
|
-
"float",
|
|
271
|
-
"boolean",
|
|
272
|
-
"date",
|
|
273
|
-
"bigint",
|
|
274
|
-
"symbol",
|
|
275
|
-
"function",
|
|
276
|
-
"undefined",
|
|
277
|
-
"null",
|
|
278
|
-
"array",
|
|
279
|
-
"object",
|
|
280
|
-
"unknown",
|
|
281
|
-
"promise",
|
|
282
|
-
"void",
|
|
283
|
-
"never",
|
|
284
|
-
"map",
|
|
285
|
-
"set"
|
|
286
|
-
]), ne = (r) => {
|
|
287
|
-
switch (typeof r) {
|
|
288
|
-
case "undefined":
|
|
289
|
-
return m.undefined;
|
|
290
|
-
case "string":
|
|
291
|
-
return m.string;
|
|
292
|
-
case "number":
|
|
293
|
-
return isNaN(r) ? m.nan : m.number;
|
|
294
|
-
case "boolean":
|
|
295
|
-
return m.boolean;
|
|
296
|
-
case "function":
|
|
297
|
-
return m.function;
|
|
298
|
-
case "bigint":
|
|
299
|
-
return m.bigint;
|
|
300
|
-
case "symbol":
|
|
301
|
-
return m.symbol;
|
|
302
|
-
case "object":
|
|
303
|
-
return Array.isArray(r) ? m.array : r === null ? m.null : r.then && typeof r.then == "function" && r.catch && typeof r.catch == "function" ? m.promise : typeof Map < "u" && r instanceof Map ? m.map : typeof Set < "u" && r instanceof Set ? m.set : typeof Date < "u" && r instanceof Date ? m.date : m.object;
|
|
304
|
-
default:
|
|
305
|
-
return m.unknown;
|
|
306
|
-
}
|
|
307
|
-
}, u = w.arrayToEnum([
|
|
308
|
-
"invalid_type",
|
|
309
|
-
"invalid_literal",
|
|
310
|
-
"custom",
|
|
311
|
-
"invalid_union",
|
|
312
|
-
"invalid_union_discriminator",
|
|
313
|
-
"invalid_enum_value",
|
|
314
|
-
"unrecognized_keys",
|
|
315
|
-
"invalid_arguments",
|
|
316
|
-
"invalid_return_type",
|
|
317
|
-
"invalid_date",
|
|
318
|
-
"invalid_string",
|
|
319
|
-
"too_small",
|
|
320
|
-
"too_big",
|
|
321
|
-
"invalid_intersection_types",
|
|
322
|
-
"not_multiple_of",
|
|
323
|
-
"not_finite"
|
|
324
|
-
]), ma = (r) => JSON.stringify(r, null, 2).replace(/"([^"]+)":/g, "$1:");
|
|
325
|
-
class B extends Error {
|
|
326
|
-
get errors() {
|
|
327
|
-
return this.issues;
|
|
328
|
-
}
|
|
329
|
-
constructor(e) {
|
|
330
|
-
super(), this.issues = [], this.addIssue = (a) => {
|
|
331
|
-
this.issues = [...this.issues, a];
|
|
332
|
-
}, this.addIssues = (a = []) => {
|
|
333
|
-
this.issues = [...this.issues, ...a];
|
|
334
|
-
};
|
|
335
|
-
const t = new.target.prototype;
|
|
336
|
-
Object.setPrototypeOf ? Object.setPrototypeOf(this, t) : this.__proto__ = t, this.name = "ZodError", this.issues = e;
|
|
337
|
-
}
|
|
338
|
-
format(e) {
|
|
339
|
-
const t = e || function(n) {
|
|
340
|
-
return n.message;
|
|
341
|
-
}, a = { _errors: [] }, s = (n) => {
|
|
342
|
-
for (const i of n.issues)
|
|
343
|
-
if (i.code === "invalid_union")
|
|
344
|
-
i.unionErrors.map(s);
|
|
345
|
-
else if (i.code === "invalid_return_type")
|
|
346
|
-
s(i.returnTypeError);
|
|
347
|
-
else if (i.code === "invalid_arguments")
|
|
348
|
-
s(i.argumentsError);
|
|
349
|
-
else if (i.path.length === 0)
|
|
350
|
-
a._errors.push(t(i));
|
|
351
|
-
else {
|
|
352
|
-
let o = a, d = 0;
|
|
353
|
-
for (; d < i.path.length; ) {
|
|
354
|
-
const l = i.path[d];
|
|
355
|
-
d === i.path.length - 1 ? (o[l] = o[l] || { _errors: [] }, o[l]._errors.push(t(i))) : o[l] = o[l] || { _errors: [] }, o = o[l], d++;
|
|
356
|
-
}
|
|
357
|
-
}
|
|
358
|
-
};
|
|
359
|
-
return s(this), a;
|
|
360
|
-
}
|
|
361
|
-
static assert(e) {
|
|
362
|
-
if (!(e instanceof B))
|
|
363
|
-
throw new Error(`Not a ZodError: ${e}`);
|
|
364
|
-
}
|
|
365
|
-
toString() {
|
|
366
|
-
return this.message;
|
|
367
|
-
}
|
|
368
|
-
get message() {
|
|
369
|
-
return JSON.stringify(this.issues, w.jsonStringifyReplacer, 2);
|
|
370
|
-
}
|
|
371
|
-
get isEmpty() {
|
|
372
|
-
return this.issues.length === 0;
|
|
373
|
-
}
|
|
374
|
-
flatten(e = (t) => t.message) {
|
|
375
|
-
const t = {}, a = [];
|
|
376
|
-
for (const s of this.issues)
|
|
377
|
-
s.path.length > 0 ? (t[s.path[0]] = t[s.path[0]] || [], t[s.path[0]].push(e(s))) : a.push(e(s));
|
|
378
|
-
return { formErrors: a, fieldErrors: t };
|
|
379
|
-
}
|
|
380
|
-
get formErrors() {
|
|
381
|
-
return this.flatten();
|
|
382
|
-
}
|
|
383
|
-
}
|
|
384
|
-
B.create = (r) => new B(r);
|
|
385
|
-
const Te = (r, e) => {
|
|
386
|
-
let t;
|
|
387
|
-
switch (r.code) {
|
|
388
|
-
case u.invalid_type:
|
|
389
|
-
r.received === m.undefined ? t = "Required" : t = `Expected ${r.expected}, received ${r.received}`;
|
|
390
|
-
break;
|
|
391
|
-
case u.invalid_literal:
|
|
392
|
-
t = `Invalid literal value, expected ${JSON.stringify(r.expected, w.jsonStringifyReplacer)}`;
|
|
393
|
-
break;
|
|
394
|
-
case u.unrecognized_keys:
|
|
395
|
-
t = `Unrecognized key(s) in object: ${w.joinValues(r.keys, ", ")}`;
|
|
396
|
-
break;
|
|
397
|
-
case u.invalid_union:
|
|
398
|
-
t = "Invalid input";
|
|
399
|
-
break;
|
|
400
|
-
case u.invalid_union_discriminator:
|
|
401
|
-
t = `Invalid discriminator value. Expected ${w.joinValues(r.options)}`;
|
|
402
|
-
break;
|
|
403
|
-
case u.invalid_enum_value:
|
|
404
|
-
t = `Invalid enum value. Expected ${w.joinValues(r.options)}, received '${r.received}'`;
|
|
405
|
-
break;
|
|
406
|
-
case u.invalid_arguments:
|
|
407
|
-
t = "Invalid function arguments";
|
|
408
|
-
break;
|
|
409
|
-
case u.invalid_return_type:
|
|
410
|
-
t = "Invalid function return type";
|
|
411
|
-
break;
|
|
412
|
-
case u.invalid_date:
|
|
413
|
-
t = "Invalid date";
|
|
414
|
-
break;
|
|
415
|
-
case u.invalid_string:
|
|
416
|
-
typeof r.validation == "object" ? "includes" in r.validation ? (t = `Invalid input: must include "${r.validation.includes}"`, typeof r.validation.position == "number" && (t = `${t} at one or more positions greater than or equal to ${r.validation.position}`)) : "startsWith" in r.validation ? t = `Invalid input: must start with "${r.validation.startsWith}"` : "endsWith" in r.validation ? t = `Invalid input: must end with "${r.validation.endsWith}"` : w.assertNever(r.validation) : r.validation !== "regex" ? t = `Invalid ${r.validation}` : t = "Invalid";
|
|
417
|
-
break;
|
|
418
|
-
case u.too_small:
|
|
419
|
-
r.type === "array" ? t = `Array must contain ${r.exact ? "exactly" : r.inclusive ? "at least" : "more than"} ${r.minimum} element(s)` : r.type === "string" ? t = `String must contain ${r.exact ? "exactly" : r.inclusive ? "at least" : "over"} ${r.minimum} character(s)` : r.type === "number" ? t = `Number must be ${r.exact ? "exactly equal to " : r.inclusive ? "greater than or equal to " : "greater than "}${r.minimum}` : r.type === "date" ? t = `Date must be ${r.exact ? "exactly equal to " : r.inclusive ? "greater than or equal to " : "greater than "}${new Date(Number(r.minimum))}` : t = "Invalid input";
|
|
420
|
-
break;
|
|
421
|
-
case u.too_big:
|
|
422
|
-
r.type === "array" ? t = `Array must contain ${r.exact ? "exactly" : r.inclusive ? "at most" : "less than"} ${r.maximum} element(s)` : r.type === "string" ? t = `String must contain ${r.exact ? "exactly" : r.inclusive ? "at most" : "under"} ${r.maximum} character(s)` : r.type === "number" ? t = `Number must be ${r.exact ? "exactly" : r.inclusive ? "less than or equal to" : "less than"} ${r.maximum}` : r.type === "bigint" ? t = `BigInt must be ${r.exact ? "exactly" : r.inclusive ? "less than or equal to" : "less than"} ${r.maximum}` : r.type === "date" ? t = `Date must be ${r.exact ? "exactly" : r.inclusive ? "smaller than or equal to" : "smaller than"} ${new Date(Number(r.maximum))}` : t = "Invalid input";
|
|
423
|
-
break;
|
|
424
|
-
case u.custom:
|
|
425
|
-
t = "Invalid input";
|
|
426
|
-
break;
|
|
427
|
-
case u.invalid_intersection_types:
|
|
428
|
-
t = "Intersection results could not be merged";
|
|
429
|
-
break;
|
|
430
|
-
case u.not_multiple_of:
|
|
431
|
-
t = `Number must be a multiple of ${r.multipleOf}`;
|
|
432
|
-
break;
|
|
433
|
-
case u.not_finite:
|
|
434
|
-
t = "Number must be finite";
|
|
435
|
-
break;
|
|
436
|
-
default:
|
|
437
|
-
t = e.defaultError, w.assertNever(r);
|
|
438
|
-
}
|
|
439
|
-
return { message: t };
|
|
440
|
-
};
|
|
441
|
-
let Qt = Te;
|
|
442
|
-
function pa(r) {
|
|
443
|
-
Qt = r;
|
|
444
|
-
}
|
|
445
|
-
function Ye() {
|
|
446
|
-
return Qt;
|
|
447
|
-
}
|
|
448
|
-
const Ke = (r) => {
|
|
449
|
-
const { data: e, path: t, errorMaps: a, issueData: s } = r, n = [...t, ...s.path || []], i = {
|
|
450
|
-
...s,
|
|
451
|
-
path: n
|
|
452
|
-
};
|
|
453
|
-
if (s.message !== void 0)
|
|
454
|
-
return {
|
|
455
|
-
...s,
|
|
456
|
-
path: n,
|
|
457
|
-
message: s.message
|
|
458
|
-
};
|
|
459
|
-
let o = "";
|
|
460
|
-
const d = a.filter((l) => !!l).slice().reverse();
|
|
461
|
-
for (const l of d)
|
|
462
|
-
o = l(i, { data: e, defaultError: o }).message;
|
|
463
|
-
return {
|
|
464
|
-
...s,
|
|
465
|
-
path: n,
|
|
466
|
-
message: o
|
|
467
|
-
};
|
|
468
|
-
}, va = [];
|
|
469
|
-
function f(r, e) {
|
|
470
|
-
const t = Ye(), a = Ke({
|
|
471
|
-
issueData: e,
|
|
472
|
-
data: r.data,
|
|
473
|
-
path: r.path,
|
|
474
|
-
errorMaps: [
|
|
475
|
-
r.common.contextualErrorMap,
|
|
476
|
-
// contextual error map is first priority
|
|
477
|
-
r.schemaErrorMap,
|
|
478
|
-
// then schema-bound map if available
|
|
479
|
-
t,
|
|
480
|
-
// then global override map
|
|
481
|
-
t === Te ? void 0 : Te
|
|
482
|
-
// then global default map
|
|
483
|
-
].filter((s) => !!s)
|
|
484
|
-
});
|
|
485
|
-
r.common.issues.push(a);
|
|
486
|
-
}
|
|
487
|
-
class L {
|
|
488
|
-
constructor() {
|
|
489
|
-
this.value = "valid";
|
|
490
|
-
}
|
|
491
|
-
dirty() {
|
|
492
|
-
this.value === "valid" && (this.value = "dirty");
|
|
493
|
-
}
|
|
494
|
-
abort() {
|
|
495
|
-
this.value !== "aborted" && (this.value = "aborted");
|
|
496
|
-
}
|
|
497
|
-
static mergeArray(e, t) {
|
|
498
|
-
const a = [];
|
|
499
|
-
for (const s of t) {
|
|
500
|
-
if (s.status === "aborted")
|
|
501
|
-
return g;
|
|
502
|
-
s.status === "dirty" && e.dirty(), a.push(s.value);
|
|
503
|
-
}
|
|
504
|
-
return { status: e.value, value: a };
|
|
505
|
-
}
|
|
506
|
-
static async mergeObjectAsync(e, t) {
|
|
507
|
-
const a = [];
|
|
508
|
-
for (const s of t) {
|
|
509
|
-
const n = await s.key, i = await s.value;
|
|
510
|
-
a.push({
|
|
511
|
-
key: n,
|
|
512
|
-
value: i
|
|
513
|
-
});
|
|
514
|
-
}
|
|
515
|
-
return L.mergeObjectSync(e, a);
|
|
516
|
-
}
|
|
517
|
-
static mergeObjectSync(e, t) {
|
|
518
|
-
const a = {};
|
|
519
|
-
for (const s of t) {
|
|
520
|
-
const { key: n, value: i } = s;
|
|
521
|
-
if (n.status === "aborted" || i.status === "aborted")
|
|
522
|
-
return g;
|
|
523
|
-
n.status === "dirty" && e.dirty(), i.status === "dirty" && e.dirty(), n.value !== "__proto__" && (typeof i.value < "u" || s.alwaysSet) && (a[n.value] = i.value);
|
|
524
|
-
}
|
|
525
|
-
return { status: e.value, value: a };
|
|
526
|
-
}
|
|
527
|
-
}
|
|
528
|
-
const g = Object.freeze({
|
|
529
|
-
status: "aborted"
|
|
530
|
-
}), ke = (r) => ({ status: "dirty", value: r }), F = (r) => ({ status: "valid", value: r }), pt = (r) => r.status === "aborted", vt = (r) => r.status === "dirty", ve = (r) => r.status === "valid", je = (r) => typeof Promise < "u" && r instanceof Promise;
|
|
531
|
-
function Qe(r, e, t, a) {
|
|
532
|
-
if (typeof e == "function" ? r !== e || !0 : !e.has(r)) throw new TypeError("Cannot read private member from an object whose class did not declare it");
|
|
533
|
-
return e.get(r);
|
|
534
|
-
}
|
|
535
|
-
function Xt(r, e, t, a, s) {
|
|
536
|
-
if (typeof e == "function" ? r !== e || !0 : !e.has(r)) throw new TypeError("Cannot write private member to an object whose class did not declare it");
|
|
537
|
-
return e.set(r, t), t;
|
|
538
|
-
}
|
|
539
|
-
var p;
|
|
540
|
-
(function(r) {
|
|
541
|
-
r.errToObj = (e) => typeof e == "string" ? { message: e } : e || {}, r.toString = (e) => typeof e == "string" ? e : e == null ? void 0 : e.message;
|
|
542
|
-
})(p || (p = {}));
|
|
543
|
-
var Oe, Ie;
|
|
544
|
-
class Y {
|
|
545
|
-
constructor(e, t, a, s) {
|
|
546
|
-
this._cachedPath = [], this.parent = e, this.data = t, this._path = a, this._key = s;
|
|
547
|
-
}
|
|
548
|
-
get path() {
|
|
549
|
-
return this._cachedPath.length || (this._key instanceof Array ? this._cachedPath.push(...this._path, ...this._key) : this._cachedPath.push(...this._path, this._key)), this._cachedPath;
|
|
550
|
-
}
|
|
551
|
-
}
|
|
552
|
-
const jt = (r, e) => {
|
|
553
|
-
if (ve(e))
|
|
554
|
-
return { success: !0, data: e.value };
|
|
555
|
-
if (!r.common.issues.length)
|
|
556
|
-
throw new Error("Validation failed but no issues detected.");
|
|
557
|
-
return {
|
|
558
|
-
success: !1,
|
|
559
|
-
get error() {
|
|
560
|
-
if (this._error)
|
|
561
|
-
return this._error;
|
|
562
|
-
const t = new B(r.common.issues);
|
|
563
|
-
return this._error = t, this._error;
|
|
564
|
-
}
|
|
565
|
-
};
|
|
566
|
-
};
|
|
567
|
-
function _(r) {
|
|
568
|
-
if (!r)
|
|
569
|
-
return {};
|
|
570
|
-
const { errorMap: e, invalid_type_error: t, required_error: a, description: s } = r;
|
|
571
|
-
if (e && (t || a))
|
|
572
|
-
throw new Error(`Can't use "invalid_type_error" or "required_error" in conjunction with custom error map.`);
|
|
573
|
-
return e ? { errorMap: e, description: s } : { errorMap: (i, o) => {
|
|
574
|
-
var d, l;
|
|
575
|
-
const { message: h } = r;
|
|
576
|
-
return i.code === "invalid_enum_value" ? { message: h ?? o.defaultError } : typeof o.data > "u" ? { message: (d = h ?? a) !== null && d !== void 0 ? d : o.defaultError } : i.code !== "invalid_type" ? { message: o.defaultError } : { message: (l = h ?? t) !== null && l !== void 0 ? l : o.defaultError };
|
|
577
|
-
}, description: s };
|
|
578
|
-
}
|
|
579
|
-
class b {
|
|
580
|
-
get description() {
|
|
581
|
-
return this._def.description;
|
|
582
|
-
}
|
|
583
|
-
_getType(e) {
|
|
584
|
-
return ne(e.data);
|
|
585
|
-
}
|
|
586
|
-
_getOrReturnCtx(e, t) {
|
|
587
|
-
return t || {
|
|
588
|
-
common: e.parent.common,
|
|
589
|
-
data: e.data,
|
|
590
|
-
parsedType: ne(e.data),
|
|
591
|
-
schemaErrorMap: this._def.errorMap,
|
|
592
|
-
path: e.path,
|
|
593
|
-
parent: e.parent
|
|
594
|
-
};
|
|
595
|
-
}
|
|
596
|
-
_processInputParams(e) {
|
|
597
|
-
return {
|
|
598
|
-
status: new L(),
|
|
599
|
-
ctx: {
|
|
600
|
-
common: e.parent.common,
|
|
601
|
-
data: e.data,
|
|
602
|
-
parsedType: ne(e.data),
|
|
603
|
-
schemaErrorMap: this._def.errorMap,
|
|
604
|
-
path: e.path,
|
|
605
|
-
parent: e.parent
|
|
606
|
-
}
|
|
607
|
-
};
|
|
608
|
-
}
|
|
609
|
-
_parseSync(e) {
|
|
610
|
-
const t = this._parse(e);
|
|
611
|
-
if (je(t))
|
|
612
|
-
throw new Error("Synchronous parse encountered promise.");
|
|
613
|
-
return t;
|
|
614
|
-
}
|
|
615
|
-
_parseAsync(e) {
|
|
616
|
-
const t = this._parse(e);
|
|
617
|
-
return Promise.resolve(t);
|
|
618
|
-
}
|
|
619
|
-
parse(e, t) {
|
|
620
|
-
const a = this.safeParse(e, t);
|
|
621
|
-
if (a.success)
|
|
622
|
-
return a.data;
|
|
623
|
-
throw a.error;
|
|
624
|
-
}
|
|
625
|
-
safeParse(e, t) {
|
|
626
|
-
var a;
|
|
627
|
-
const s = {
|
|
628
|
-
common: {
|
|
629
|
-
issues: [],
|
|
630
|
-
async: (a = t == null ? void 0 : t.async) !== null && a !== void 0 ? a : !1,
|
|
631
|
-
contextualErrorMap: t == null ? void 0 : t.errorMap
|
|
632
|
-
},
|
|
633
|
-
path: (t == null ? void 0 : t.path) || [],
|
|
634
|
-
schemaErrorMap: this._def.errorMap,
|
|
635
|
-
parent: null,
|
|
636
|
-
data: e,
|
|
637
|
-
parsedType: ne(e)
|
|
638
|
-
}, n = this._parseSync({ data: e, path: s.path, parent: s });
|
|
639
|
-
return jt(s, n);
|
|
640
|
-
}
|
|
641
|
-
"~validate"(e) {
|
|
642
|
-
var t, a;
|
|
643
|
-
const s = {
|
|
644
|
-
common: {
|
|
645
|
-
issues: [],
|
|
646
|
-
async: !!this["~standard"].async
|
|
647
|
-
},
|
|
648
|
-
path: [],
|
|
649
|
-
schemaErrorMap: this._def.errorMap,
|
|
650
|
-
parent: null,
|
|
651
|
-
data: e,
|
|
652
|
-
parsedType: ne(e)
|
|
653
|
-
};
|
|
654
|
-
if (!this["~standard"].async)
|
|
655
|
-
try {
|
|
656
|
-
const n = this._parseSync({ data: e, path: [], parent: s });
|
|
657
|
-
return ve(n) ? {
|
|
658
|
-
value: n.value
|
|
659
|
-
} : {
|
|
660
|
-
issues: s.common.issues
|
|
661
|
-
};
|
|
662
|
-
} catch (n) {
|
|
663
|
-
!((a = (t = n == null ? void 0 : n.message) === null || t === void 0 ? void 0 : t.toLowerCase()) === null || a === void 0) && a.includes("encountered") && (this["~standard"].async = !0), s.common = {
|
|
664
|
-
issues: [],
|
|
665
|
-
async: !0
|
|
666
|
-
};
|
|
667
|
-
}
|
|
668
|
-
return this._parseAsync({ data: e, path: [], parent: s }).then((n) => ve(n) ? {
|
|
669
|
-
value: n.value
|
|
670
|
-
} : {
|
|
671
|
-
issues: s.common.issues
|
|
672
|
-
});
|
|
673
|
-
}
|
|
674
|
-
async parseAsync(e, t) {
|
|
675
|
-
const a = await this.safeParseAsync(e, t);
|
|
676
|
-
if (a.success)
|
|
677
|
-
return a.data;
|
|
678
|
-
throw a.error;
|
|
679
|
-
}
|
|
680
|
-
async safeParseAsync(e, t) {
|
|
681
|
-
const a = {
|
|
682
|
-
common: {
|
|
683
|
-
issues: [],
|
|
684
|
-
contextualErrorMap: t == null ? void 0 : t.errorMap,
|
|
685
|
-
async: !0
|
|
686
|
-
},
|
|
687
|
-
path: (t == null ? void 0 : t.path) || [],
|
|
688
|
-
schemaErrorMap: this._def.errorMap,
|
|
689
|
-
parent: null,
|
|
690
|
-
data: e,
|
|
691
|
-
parsedType: ne(e)
|
|
692
|
-
}, s = this._parse({ data: e, path: a.path, parent: a }), n = await (je(s) ? s : Promise.resolve(s));
|
|
693
|
-
return jt(a, n);
|
|
694
|
-
}
|
|
695
|
-
refine(e, t) {
|
|
696
|
-
const a = (s) => typeof t == "string" || typeof t > "u" ? { message: t } : typeof t == "function" ? t(s) : t;
|
|
697
|
-
return this._refinement((s, n) => {
|
|
698
|
-
const i = e(s), o = () => n.addIssue({
|
|
699
|
-
code: u.custom,
|
|
700
|
-
...a(s)
|
|
701
|
-
});
|
|
702
|
-
return typeof Promise < "u" && i instanceof Promise ? i.then((d) => d ? !0 : (o(), !1)) : i ? !0 : (o(), !1);
|
|
703
|
-
});
|
|
704
|
-
}
|
|
705
|
-
refinement(e, t) {
|
|
706
|
-
return this._refinement((a, s) => e(a) ? !0 : (s.addIssue(typeof t == "function" ? t(a, s) : t), !1));
|
|
707
|
-
}
|
|
708
|
-
_refinement(e) {
|
|
709
|
-
return new J({
|
|
710
|
-
schema: this,
|
|
711
|
-
typeName: v.ZodEffects,
|
|
712
|
-
effect: { type: "refinement", refinement: e }
|
|
713
|
-
});
|
|
714
|
-
}
|
|
715
|
-
superRefine(e) {
|
|
716
|
-
return this._refinement(e);
|
|
717
|
-
}
|
|
718
|
-
constructor(e) {
|
|
719
|
-
this.spa = this.safeParseAsync, this._def = e, this.parse = this.parse.bind(this), this.safeParse = this.safeParse.bind(this), this.parseAsync = this.parseAsync.bind(this), this.safeParseAsync = this.safeParseAsync.bind(this), this.spa = this.spa.bind(this), this.refine = this.refine.bind(this), this.refinement = this.refinement.bind(this), this.superRefine = this.superRefine.bind(this), this.optional = this.optional.bind(this), this.nullable = this.nullable.bind(this), this.nullish = this.nullish.bind(this), this.array = this.array.bind(this), this.promise = this.promise.bind(this), this.or = this.or.bind(this), this.and = this.and.bind(this), this.transform = this.transform.bind(this), this.brand = this.brand.bind(this), this.default = this.default.bind(this), this.catch = this.catch.bind(this), this.describe = this.describe.bind(this), this.pipe = this.pipe.bind(this), this.readonly = this.readonly.bind(this), this.isNullable = this.isNullable.bind(this), this.isOptional = this.isOptional.bind(this), this["~standard"] = {
|
|
720
|
-
version: 1,
|
|
721
|
-
vendor: "zod",
|
|
722
|
-
validate: (t) => this["~validate"](t)
|
|
723
|
-
};
|
|
724
|
-
}
|
|
725
|
-
optional() {
|
|
726
|
-
return H.create(this, this._def);
|
|
727
|
-
}
|
|
728
|
-
nullable() {
|
|
729
|
-
return fe.create(this, this._def);
|
|
730
|
-
}
|
|
731
|
-
nullish() {
|
|
732
|
-
return this.nullable().optional();
|
|
733
|
-
}
|
|
734
|
-
array() {
|
|
735
|
-
return G.create(this);
|
|
736
|
-
}
|
|
737
|
-
promise() {
|
|
738
|
-
return Ae.create(this, this._def);
|
|
739
|
-
}
|
|
740
|
-
or(e) {
|
|
741
|
-
return ze.create([this, e], this._def);
|
|
742
|
-
}
|
|
743
|
-
and(e) {
|
|
744
|
-
return Le.create(this, e, this._def);
|
|
745
|
-
}
|
|
746
|
-
transform(e) {
|
|
747
|
-
return new J({
|
|
748
|
-
..._(this._def),
|
|
749
|
-
schema: this,
|
|
750
|
-
typeName: v.ZodEffects,
|
|
751
|
-
effect: { type: "transform", transform: e }
|
|
752
|
-
});
|
|
753
|
-
}
|
|
754
|
-
default(e) {
|
|
755
|
-
const t = typeof e == "function" ? e : () => e;
|
|
756
|
-
return new We({
|
|
757
|
-
..._(this._def),
|
|
758
|
-
innerType: this,
|
|
759
|
-
defaultValue: t,
|
|
760
|
-
typeName: v.ZodDefault
|
|
761
|
-
});
|
|
762
|
-
}
|
|
763
|
-
brand() {
|
|
764
|
-
return new xt({
|
|
765
|
-
typeName: v.ZodBranded,
|
|
766
|
-
type: this,
|
|
767
|
-
..._(this._def)
|
|
768
|
-
});
|
|
769
|
-
}
|
|
770
|
-
catch(e) {
|
|
771
|
-
const t = typeof e == "function" ? e : () => e;
|
|
772
|
-
return new qe({
|
|
773
|
-
..._(this._def),
|
|
774
|
-
innerType: this,
|
|
775
|
-
catchValue: t,
|
|
776
|
-
typeName: v.ZodCatch
|
|
777
|
-
});
|
|
778
|
-
}
|
|
779
|
-
describe(e) {
|
|
780
|
-
const t = this.constructor;
|
|
781
|
-
return new t({
|
|
782
|
-
...this._def,
|
|
783
|
-
description: e
|
|
784
|
-
});
|
|
785
|
-
}
|
|
786
|
-
pipe(e) {
|
|
787
|
-
return Je.create(this, e);
|
|
788
|
-
}
|
|
789
|
-
readonly() {
|
|
790
|
-
return Ge.create(this);
|
|
791
|
-
}
|
|
792
|
-
isOptional() {
|
|
793
|
-
return this.safeParse(void 0).success;
|
|
794
|
-
}
|
|
795
|
-
isNullable() {
|
|
796
|
-
return this.safeParse(null).success;
|
|
797
|
-
}
|
|
798
|
-
}
|
|
799
|
-
const ga = /^c[^\s-]{8,}$/i, ya = /^[0-9a-z]+$/, _a = /^[0-9A-HJKMNP-TV-Z]{26}$/i, ba = /^[0-9a-fA-F]{8}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{12}$/i, xa = /^[a-z0-9_-]{21}$/i, wa = /^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/, ka = /^[-+]?P(?!$)(?:(?:[-+]?\d+Y)|(?:[-+]?\d+[.,]\d+Y$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:(?:[-+]?\d+W)|(?:[-+]?\d+[.,]\d+W$))?(?:(?:[-+]?\d+D)|(?:[-+]?\d+[.,]\d+D$))?(?:T(?=[\d+-])(?:(?:[-+]?\d+H)|(?:[-+]?\d+[.,]\d+H$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:[-+]?\d+(?:[.,]\d+)?S)?)??$/, Na = /^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i, Ta = "^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$";
|
|
800
|
-
let dt;
|
|
801
|
-
const Ca = /^(?:(?: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])$/, Aa = /^(?:(?: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])\/(3[0-2]|[12]?[0-9])$/, Ra = /^(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))$/, Sa = /^(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/, Ea = /^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/, Oa = /^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/, er = "((\\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])))", Ia = new RegExp(`^${er}$`);
|
|
802
|
-
function tr(r) {
|
|
803
|
-
let e = "([01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d";
|
|
804
|
-
return r.precision ? e = `${e}\\.\\d{${r.precision}}` : r.precision == null && (e = `${e}(\\.\\d+)?`), e;
|
|
805
|
-
}
|
|
806
|
-
function Va(r) {
|
|
807
|
-
return new RegExp(`^${tr(r)}$`);
|
|
808
|
-
}
|
|
809
|
-
function rr(r) {
|
|
810
|
-
let e = `${er}T${tr(r)}`;
|
|
811
|
-
const t = [];
|
|
812
|
-
return t.push(r.local ? "Z?" : "Z"), r.offset && t.push("([+-]\\d{2}:?\\d{2})"), e = `${e}(${t.join("|")})`, new RegExp(`^${e}$`);
|
|
813
|
-
}
|
|
814
|
-
function Za(r, e) {
|
|
815
|
-
return !!((e === "v4" || !e) && Ca.test(r) || (e === "v6" || !e) && Ra.test(r));
|
|
816
|
-
}
|
|
817
|
-
function ja(r, e) {
|
|
818
|
-
if (!wa.test(r))
|
|
819
|
-
return !1;
|
|
820
|
-
try {
|
|
821
|
-
const [t] = r.split("."), a = t.replace(/-/g, "+").replace(/_/g, "/").padEnd(t.length + (4 - t.length % 4) % 4, "="), s = JSON.parse(atob(a));
|
|
822
|
-
return !(typeof s != "object" || s === null || !s.typ || !s.alg || e && s.alg !== e);
|
|
823
|
-
} catch {
|
|
824
|
-
return !1;
|
|
825
|
-
}
|
|
826
|
-
}
|
|
827
|
-
function Ma(r, e) {
|
|
828
|
-
return !!((e === "v4" || !e) && Aa.test(r) || (e === "v6" || !e) && Sa.test(r));
|
|
829
|
-
}
|
|
830
|
-
class q extends b {
|
|
831
|
-
_parse(e) {
|
|
832
|
-
if (this._def.coerce && (e.data = String(e.data)), this._getType(e) !== m.string) {
|
|
833
|
-
const n = this._getOrReturnCtx(e);
|
|
834
|
-
return f(n, {
|
|
835
|
-
code: u.invalid_type,
|
|
836
|
-
expected: m.string,
|
|
837
|
-
received: n.parsedType
|
|
838
|
-
}), g;
|
|
839
|
-
}
|
|
840
|
-
const a = new L();
|
|
841
|
-
let s;
|
|
842
|
-
for (const n of this._def.checks)
|
|
843
|
-
if (n.kind === "min")
|
|
844
|
-
e.data.length < n.value && (s = this._getOrReturnCtx(e, s), f(s, {
|
|
845
|
-
code: u.too_small,
|
|
846
|
-
minimum: n.value,
|
|
847
|
-
type: "string",
|
|
848
|
-
inclusive: !0,
|
|
849
|
-
exact: !1,
|
|
850
|
-
message: n.message
|
|
851
|
-
}), a.dirty());
|
|
852
|
-
else if (n.kind === "max")
|
|
853
|
-
e.data.length > n.value && (s = this._getOrReturnCtx(e, s), f(s, {
|
|
854
|
-
code: u.too_big,
|
|
855
|
-
maximum: n.value,
|
|
856
|
-
type: "string",
|
|
857
|
-
inclusive: !0,
|
|
858
|
-
exact: !1,
|
|
859
|
-
message: n.message
|
|
860
|
-
}), a.dirty());
|
|
861
|
-
else if (n.kind === "length") {
|
|
862
|
-
const i = e.data.length > n.value, o = e.data.length < n.value;
|
|
863
|
-
(i || o) && (s = this._getOrReturnCtx(e, s), i ? f(s, {
|
|
864
|
-
code: u.too_big,
|
|
865
|
-
maximum: n.value,
|
|
866
|
-
type: "string",
|
|
867
|
-
inclusive: !0,
|
|
868
|
-
exact: !0,
|
|
869
|
-
message: n.message
|
|
870
|
-
}) : o && f(s, {
|
|
871
|
-
code: u.too_small,
|
|
872
|
-
minimum: n.value,
|
|
873
|
-
type: "string",
|
|
874
|
-
inclusive: !0,
|
|
875
|
-
exact: !0,
|
|
876
|
-
message: n.message
|
|
877
|
-
}), a.dirty());
|
|
878
|
-
} else if (n.kind === "email")
|
|
879
|
-
Na.test(e.data) || (s = this._getOrReturnCtx(e, s), f(s, {
|
|
880
|
-
validation: "email",
|
|
881
|
-
code: u.invalid_string,
|
|
882
|
-
message: n.message
|
|
883
|
-
}), a.dirty());
|
|
884
|
-
else if (n.kind === "emoji")
|
|
885
|
-
dt || (dt = new RegExp(Ta, "u")), dt.test(e.data) || (s = this._getOrReturnCtx(e, s), f(s, {
|
|
886
|
-
validation: "emoji",
|
|
887
|
-
code: u.invalid_string,
|
|
888
|
-
message: n.message
|
|
889
|
-
}), a.dirty());
|
|
890
|
-
else if (n.kind === "uuid")
|
|
891
|
-
ba.test(e.data) || (s = this._getOrReturnCtx(e, s), f(s, {
|
|
892
|
-
validation: "uuid",
|
|
893
|
-
code: u.invalid_string,
|
|
894
|
-
message: n.message
|
|
895
|
-
}), a.dirty());
|
|
896
|
-
else if (n.kind === "nanoid")
|
|
897
|
-
xa.test(e.data) || (s = this._getOrReturnCtx(e, s), f(s, {
|
|
898
|
-
validation: "nanoid",
|
|
899
|
-
code: u.invalid_string,
|
|
900
|
-
message: n.message
|
|
901
|
-
}), a.dirty());
|
|
902
|
-
else if (n.kind === "cuid")
|
|
903
|
-
ga.test(e.data) || (s = this._getOrReturnCtx(e, s), f(s, {
|
|
904
|
-
validation: "cuid",
|
|
905
|
-
code: u.invalid_string,
|
|
906
|
-
message: n.message
|
|
907
|
-
}), a.dirty());
|
|
908
|
-
else if (n.kind === "cuid2")
|
|
909
|
-
ya.test(e.data) || (s = this._getOrReturnCtx(e, s), f(s, {
|
|
910
|
-
validation: "cuid2",
|
|
911
|
-
code: u.invalid_string,
|
|
912
|
-
message: n.message
|
|
913
|
-
}), a.dirty());
|
|
914
|
-
else if (n.kind === "ulid")
|
|
915
|
-
_a.test(e.data) || (s = this._getOrReturnCtx(e, s), f(s, {
|
|
916
|
-
validation: "ulid",
|
|
917
|
-
code: u.invalid_string,
|
|
918
|
-
message: n.message
|
|
919
|
-
}), a.dirty());
|
|
920
|
-
else if (n.kind === "url")
|
|
921
|
-
try {
|
|
922
|
-
new URL(e.data);
|
|
923
|
-
} catch {
|
|
924
|
-
s = this._getOrReturnCtx(e, s), f(s, {
|
|
925
|
-
validation: "url",
|
|
926
|
-
code: u.invalid_string,
|
|
927
|
-
message: n.message
|
|
928
|
-
}), a.dirty();
|
|
929
|
-
}
|
|
930
|
-
else n.kind === "regex" ? (n.regex.lastIndex = 0, n.regex.test(e.data) || (s = this._getOrReturnCtx(e, s), f(s, {
|
|
931
|
-
validation: "regex",
|
|
932
|
-
code: u.invalid_string,
|
|
933
|
-
message: n.message
|
|
934
|
-
}), a.dirty())) : n.kind === "trim" ? e.data = e.data.trim() : n.kind === "includes" ? e.data.includes(n.value, n.position) || (s = this._getOrReturnCtx(e, s), f(s, {
|
|
935
|
-
code: u.invalid_string,
|
|
936
|
-
validation: { includes: n.value, position: n.position },
|
|
937
|
-
message: n.message
|
|
938
|
-
}), a.dirty()) : n.kind === "toLowerCase" ? e.data = e.data.toLowerCase() : n.kind === "toUpperCase" ? e.data = e.data.toUpperCase() : n.kind === "startsWith" ? e.data.startsWith(n.value) || (s = this._getOrReturnCtx(e, s), f(s, {
|
|
939
|
-
code: u.invalid_string,
|
|
940
|
-
validation: { startsWith: n.value },
|
|
941
|
-
message: n.message
|
|
942
|
-
}), a.dirty()) : n.kind === "endsWith" ? e.data.endsWith(n.value) || (s = this._getOrReturnCtx(e, s), f(s, {
|
|
943
|
-
code: u.invalid_string,
|
|
944
|
-
validation: { endsWith: n.value },
|
|
945
|
-
message: n.message
|
|
946
|
-
}), a.dirty()) : n.kind === "datetime" ? rr(n).test(e.data) || (s = this._getOrReturnCtx(e, s), f(s, {
|
|
947
|
-
code: u.invalid_string,
|
|
948
|
-
validation: "datetime",
|
|
949
|
-
message: n.message
|
|
950
|
-
}), a.dirty()) : n.kind === "date" ? Ia.test(e.data) || (s = this._getOrReturnCtx(e, s), f(s, {
|
|
951
|
-
code: u.invalid_string,
|
|
952
|
-
validation: "date",
|
|
953
|
-
message: n.message
|
|
954
|
-
}), a.dirty()) : n.kind === "time" ? Va(n).test(e.data) || (s = this._getOrReturnCtx(e, s), f(s, {
|
|
955
|
-
code: u.invalid_string,
|
|
956
|
-
validation: "time",
|
|
957
|
-
message: n.message
|
|
958
|
-
}), a.dirty()) : n.kind === "duration" ? ka.test(e.data) || (s = this._getOrReturnCtx(e, s), f(s, {
|
|
959
|
-
validation: "duration",
|
|
960
|
-
code: u.invalid_string,
|
|
961
|
-
message: n.message
|
|
962
|
-
}), a.dirty()) : n.kind === "ip" ? Za(e.data, n.version) || (s = this._getOrReturnCtx(e, s), f(s, {
|
|
963
|
-
validation: "ip",
|
|
964
|
-
code: u.invalid_string,
|
|
965
|
-
message: n.message
|
|
966
|
-
}), a.dirty()) : n.kind === "jwt" ? ja(e.data, n.alg) || (s = this._getOrReturnCtx(e, s), f(s, {
|
|
967
|
-
validation: "jwt",
|
|
968
|
-
code: u.invalid_string,
|
|
969
|
-
message: n.message
|
|
970
|
-
}), a.dirty()) : n.kind === "cidr" ? Ma(e.data, n.version) || (s = this._getOrReturnCtx(e, s), f(s, {
|
|
971
|
-
validation: "cidr",
|
|
972
|
-
code: u.invalid_string,
|
|
973
|
-
message: n.message
|
|
974
|
-
}), a.dirty()) : n.kind === "base64" ? Ea.test(e.data) || (s = this._getOrReturnCtx(e, s), f(s, {
|
|
975
|
-
validation: "base64",
|
|
976
|
-
code: u.invalid_string,
|
|
977
|
-
message: n.message
|
|
978
|
-
}), a.dirty()) : n.kind === "base64url" ? Oa.test(e.data) || (s = this._getOrReturnCtx(e, s), f(s, {
|
|
979
|
-
validation: "base64url",
|
|
980
|
-
code: u.invalid_string,
|
|
981
|
-
message: n.message
|
|
982
|
-
}), a.dirty()) : w.assertNever(n);
|
|
983
|
-
return { status: a.value, value: e.data };
|
|
984
|
-
}
|
|
985
|
-
_regex(e, t, a) {
|
|
986
|
-
return this.refinement((s) => e.test(s), {
|
|
987
|
-
validation: t,
|
|
988
|
-
code: u.invalid_string,
|
|
989
|
-
...p.errToObj(a)
|
|
990
|
-
});
|
|
991
|
-
}
|
|
992
|
-
_addCheck(e) {
|
|
993
|
-
return new q({
|
|
994
|
-
...this._def,
|
|
995
|
-
checks: [...this._def.checks, e]
|
|
996
|
-
});
|
|
997
|
-
}
|
|
998
|
-
email(e) {
|
|
999
|
-
return this._addCheck({ kind: "email", ...p.errToObj(e) });
|
|
1000
|
-
}
|
|
1001
|
-
url(e) {
|
|
1002
|
-
return this._addCheck({ kind: "url", ...p.errToObj(e) });
|
|
1003
|
-
}
|
|
1004
|
-
emoji(e) {
|
|
1005
|
-
return this._addCheck({ kind: "emoji", ...p.errToObj(e) });
|
|
1006
|
-
}
|
|
1007
|
-
uuid(e) {
|
|
1008
|
-
return this._addCheck({ kind: "uuid", ...p.errToObj(e) });
|
|
1009
|
-
}
|
|
1010
|
-
nanoid(e) {
|
|
1011
|
-
return this._addCheck({ kind: "nanoid", ...p.errToObj(e) });
|
|
1012
|
-
}
|
|
1013
|
-
cuid(e) {
|
|
1014
|
-
return this._addCheck({ kind: "cuid", ...p.errToObj(e) });
|
|
1015
|
-
}
|
|
1016
|
-
cuid2(e) {
|
|
1017
|
-
return this._addCheck({ kind: "cuid2", ...p.errToObj(e) });
|
|
1018
|
-
}
|
|
1019
|
-
ulid(e) {
|
|
1020
|
-
return this._addCheck({ kind: "ulid", ...p.errToObj(e) });
|
|
1021
|
-
}
|
|
1022
|
-
base64(e) {
|
|
1023
|
-
return this._addCheck({ kind: "base64", ...p.errToObj(e) });
|
|
1024
|
-
}
|
|
1025
|
-
base64url(e) {
|
|
1026
|
-
return this._addCheck({
|
|
1027
|
-
kind: "base64url",
|
|
1028
|
-
...p.errToObj(e)
|
|
1029
|
-
});
|
|
1030
|
-
}
|
|
1031
|
-
jwt(e) {
|
|
1032
|
-
return this._addCheck({ kind: "jwt", ...p.errToObj(e) });
|
|
1033
|
-
}
|
|
1034
|
-
ip(e) {
|
|
1035
|
-
return this._addCheck({ kind: "ip", ...p.errToObj(e) });
|
|
1036
|
-
}
|
|
1037
|
-
cidr(e) {
|
|
1038
|
-
return this._addCheck({ kind: "cidr", ...p.errToObj(e) });
|
|
1039
|
-
}
|
|
1040
|
-
datetime(e) {
|
|
1041
|
-
var t, a;
|
|
1042
|
-
return typeof e == "string" ? this._addCheck({
|
|
1043
|
-
kind: "datetime",
|
|
1044
|
-
precision: null,
|
|
1045
|
-
offset: !1,
|
|
1046
|
-
local: !1,
|
|
1047
|
-
message: e
|
|
1048
|
-
}) : this._addCheck({
|
|
1049
|
-
kind: "datetime",
|
|
1050
|
-
precision: typeof (e == null ? void 0 : e.precision) > "u" ? null : e == null ? void 0 : e.precision,
|
|
1051
|
-
offset: (t = e == null ? void 0 : e.offset) !== null && t !== void 0 ? t : !1,
|
|
1052
|
-
local: (a = e == null ? void 0 : e.local) !== null && a !== void 0 ? a : !1,
|
|
1053
|
-
...p.errToObj(e == null ? void 0 : e.message)
|
|
1054
|
-
});
|
|
1055
|
-
}
|
|
1056
|
-
date(e) {
|
|
1057
|
-
return this._addCheck({ kind: "date", message: e });
|
|
1058
|
-
}
|
|
1059
|
-
time(e) {
|
|
1060
|
-
return typeof e == "string" ? this._addCheck({
|
|
1061
|
-
kind: "time",
|
|
1062
|
-
precision: null,
|
|
1063
|
-
message: e
|
|
1064
|
-
}) : this._addCheck({
|
|
1065
|
-
kind: "time",
|
|
1066
|
-
precision: typeof (e == null ? void 0 : e.precision) > "u" ? null : e == null ? void 0 : e.precision,
|
|
1067
|
-
...p.errToObj(e == null ? void 0 : e.message)
|
|
1068
|
-
});
|
|
1069
|
-
}
|
|
1070
|
-
duration(e) {
|
|
1071
|
-
return this._addCheck({ kind: "duration", ...p.errToObj(e) });
|
|
1072
|
-
}
|
|
1073
|
-
regex(e, t) {
|
|
1074
|
-
return this._addCheck({
|
|
1075
|
-
kind: "regex",
|
|
1076
|
-
regex: e,
|
|
1077
|
-
...p.errToObj(t)
|
|
1078
|
-
});
|
|
1079
|
-
}
|
|
1080
|
-
includes(e, t) {
|
|
1081
|
-
return this._addCheck({
|
|
1082
|
-
kind: "includes",
|
|
1083
|
-
value: e,
|
|
1084
|
-
position: t == null ? void 0 : t.position,
|
|
1085
|
-
...p.errToObj(t == null ? void 0 : t.message)
|
|
1086
|
-
});
|
|
1087
|
-
}
|
|
1088
|
-
startsWith(e, t) {
|
|
1089
|
-
return this._addCheck({
|
|
1090
|
-
kind: "startsWith",
|
|
1091
|
-
value: e,
|
|
1092
|
-
...p.errToObj(t)
|
|
1093
|
-
});
|
|
1094
|
-
}
|
|
1095
|
-
endsWith(e, t) {
|
|
1096
|
-
return this._addCheck({
|
|
1097
|
-
kind: "endsWith",
|
|
1098
|
-
value: e,
|
|
1099
|
-
...p.errToObj(t)
|
|
1100
|
-
});
|
|
1101
|
-
}
|
|
1102
|
-
min(e, t) {
|
|
1103
|
-
return this._addCheck({
|
|
1104
|
-
kind: "min",
|
|
1105
|
-
value: e,
|
|
1106
|
-
...p.errToObj(t)
|
|
1107
|
-
});
|
|
1108
|
-
}
|
|
1109
|
-
max(e, t) {
|
|
1110
|
-
return this._addCheck({
|
|
1111
|
-
kind: "max",
|
|
1112
|
-
value: e,
|
|
1113
|
-
...p.errToObj(t)
|
|
1114
|
-
});
|
|
1115
|
-
}
|
|
1116
|
-
length(e, t) {
|
|
1117
|
-
return this._addCheck({
|
|
1118
|
-
kind: "length",
|
|
1119
|
-
value: e,
|
|
1120
|
-
...p.errToObj(t)
|
|
1121
|
-
});
|
|
1122
|
-
}
|
|
1123
|
-
/**
|
|
1124
|
-
* Equivalent to `.min(1)`
|
|
1125
|
-
*/
|
|
1126
|
-
nonempty(e) {
|
|
1127
|
-
return this.min(1, p.errToObj(e));
|
|
1128
|
-
}
|
|
1129
|
-
trim() {
|
|
1130
|
-
return new q({
|
|
1131
|
-
...this._def,
|
|
1132
|
-
checks: [...this._def.checks, { kind: "trim" }]
|
|
1133
|
-
});
|
|
1134
|
-
}
|
|
1135
|
-
toLowerCase() {
|
|
1136
|
-
return new q({
|
|
1137
|
-
...this._def,
|
|
1138
|
-
checks: [...this._def.checks, { kind: "toLowerCase" }]
|
|
1139
|
-
});
|
|
1140
|
-
}
|
|
1141
|
-
toUpperCase() {
|
|
1142
|
-
return new q({
|
|
1143
|
-
...this._def,
|
|
1144
|
-
checks: [...this._def.checks, { kind: "toUpperCase" }]
|
|
1145
|
-
});
|
|
1146
|
-
}
|
|
1147
|
-
get isDatetime() {
|
|
1148
|
-
return !!this._def.checks.find((e) => e.kind === "datetime");
|
|
1149
|
-
}
|
|
1150
|
-
get isDate() {
|
|
1151
|
-
return !!this._def.checks.find((e) => e.kind === "date");
|
|
1152
|
-
}
|
|
1153
|
-
get isTime() {
|
|
1154
|
-
return !!this._def.checks.find((e) => e.kind === "time");
|
|
1155
|
-
}
|
|
1156
|
-
get isDuration() {
|
|
1157
|
-
return !!this._def.checks.find((e) => e.kind === "duration");
|
|
1158
|
-
}
|
|
1159
|
-
get isEmail() {
|
|
1160
|
-
return !!this._def.checks.find((e) => e.kind === "email");
|
|
1161
|
-
}
|
|
1162
|
-
get isURL() {
|
|
1163
|
-
return !!this._def.checks.find((e) => e.kind === "url");
|
|
1164
|
-
}
|
|
1165
|
-
get isEmoji() {
|
|
1166
|
-
return !!this._def.checks.find((e) => e.kind === "emoji");
|
|
1167
|
-
}
|
|
1168
|
-
get isUUID() {
|
|
1169
|
-
return !!this._def.checks.find((e) => e.kind === "uuid");
|
|
1170
|
-
}
|
|
1171
|
-
get isNANOID() {
|
|
1172
|
-
return !!this._def.checks.find((e) => e.kind === "nanoid");
|
|
1173
|
-
}
|
|
1174
|
-
get isCUID() {
|
|
1175
|
-
return !!this._def.checks.find((e) => e.kind === "cuid");
|
|
1176
|
-
}
|
|
1177
|
-
get isCUID2() {
|
|
1178
|
-
return !!this._def.checks.find((e) => e.kind === "cuid2");
|
|
1179
|
-
}
|
|
1180
|
-
get isULID() {
|
|
1181
|
-
return !!this._def.checks.find((e) => e.kind === "ulid");
|
|
1182
|
-
}
|
|
1183
|
-
get isIP() {
|
|
1184
|
-
return !!this._def.checks.find((e) => e.kind === "ip");
|
|
1185
|
-
}
|
|
1186
|
-
get isCIDR() {
|
|
1187
|
-
return !!this._def.checks.find((e) => e.kind === "cidr");
|
|
1188
|
-
}
|
|
1189
|
-
get isBase64() {
|
|
1190
|
-
return !!this._def.checks.find((e) => e.kind === "base64");
|
|
1191
|
-
}
|
|
1192
|
-
get isBase64url() {
|
|
1193
|
-
return !!this._def.checks.find((e) => e.kind === "base64url");
|
|
1194
|
-
}
|
|
1195
|
-
get minLength() {
|
|
1196
|
-
let e = null;
|
|
1197
|
-
for (const t of this._def.checks)
|
|
1198
|
-
t.kind === "min" && (e === null || t.value > e) && (e = t.value);
|
|
1199
|
-
return e;
|
|
1200
|
-
}
|
|
1201
|
-
get maxLength() {
|
|
1202
|
-
let e = null;
|
|
1203
|
-
for (const t of this._def.checks)
|
|
1204
|
-
t.kind === "max" && (e === null || t.value < e) && (e = t.value);
|
|
1205
|
-
return e;
|
|
1206
|
-
}
|
|
1207
|
-
}
|
|
1208
|
-
q.create = (r) => {
|
|
1209
|
-
var e;
|
|
1210
|
-
return new q({
|
|
1211
|
-
checks: [],
|
|
1212
|
-
typeName: v.ZodString,
|
|
1213
|
-
coerce: (e = r == null ? void 0 : r.coerce) !== null && e !== void 0 ? e : !1,
|
|
1214
|
-
..._(r)
|
|
1215
|
-
});
|
|
1216
|
-
};
|
|
1217
|
-
function Pa(r, e) {
|
|
1218
|
-
const t = (r.toString().split(".")[1] || "").length, a = (e.toString().split(".")[1] || "").length, s = t > a ? t : a, n = parseInt(r.toFixed(s).replace(".", "")), i = parseInt(e.toFixed(s).replace(".", ""));
|
|
1219
|
-
return n % i / Math.pow(10, s);
|
|
1220
|
-
}
|
|
1221
|
-
class de extends b {
|
|
1222
|
-
constructor() {
|
|
1223
|
-
super(...arguments), this.min = this.gte, this.max = this.lte, this.step = this.multipleOf;
|
|
1224
|
-
}
|
|
1225
|
-
_parse(e) {
|
|
1226
|
-
if (this._def.coerce && (e.data = Number(e.data)), this._getType(e) !== m.number) {
|
|
1227
|
-
const n = this._getOrReturnCtx(e);
|
|
1228
|
-
return f(n, {
|
|
1229
|
-
code: u.invalid_type,
|
|
1230
|
-
expected: m.number,
|
|
1231
|
-
received: n.parsedType
|
|
1232
|
-
}), g;
|
|
1233
|
-
}
|
|
1234
|
-
let a;
|
|
1235
|
-
const s = new L();
|
|
1236
|
-
for (const n of this._def.checks)
|
|
1237
|
-
n.kind === "int" ? w.isInteger(e.data) || (a = this._getOrReturnCtx(e, a), f(a, {
|
|
1238
|
-
code: u.invalid_type,
|
|
1239
|
-
expected: "integer",
|
|
1240
|
-
received: "float",
|
|
1241
|
-
message: n.message
|
|
1242
|
-
}), s.dirty()) : n.kind === "min" ? (n.inclusive ? e.data < n.value : e.data <= n.value) && (a = this._getOrReturnCtx(e, a), f(a, {
|
|
1243
|
-
code: u.too_small,
|
|
1244
|
-
minimum: n.value,
|
|
1245
|
-
type: "number",
|
|
1246
|
-
inclusive: n.inclusive,
|
|
1247
|
-
exact: !1,
|
|
1248
|
-
message: n.message
|
|
1249
|
-
}), s.dirty()) : n.kind === "max" ? (n.inclusive ? e.data > n.value : e.data >= n.value) && (a = this._getOrReturnCtx(e, a), f(a, {
|
|
1250
|
-
code: u.too_big,
|
|
1251
|
-
maximum: n.value,
|
|
1252
|
-
type: "number",
|
|
1253
|
-
inclusive: n.inclusive,
|
|
1254
|
-
exact: !1,
|
|
1255
|
-
message: n.message
|
|
1256
|
-
}), s.dirty()) : n.kind === "multipleOf" ? Pa(e.data, n.value) !== 0 && (a = this._getOrReturnCtx(e, a), f(a, {
|
|
1257
|
-
code: u.not_multiple_of,
|
|
1258
|
-
multipleOf: n.value,
|
|
1259
|
-
message: n.message
|
|
1260
|
-
}), s.dirty()) : n.kind === "finite" ? Number.isFinite(e.data) || (a = this._getOrReturnCtx(e, a), f(a, {
|
|
1261
|
-
code: u.not_finite,
|
|
1262
|
-
message: n.message
|
|
1263
|
-
}), s.dirty()) : w.assertNever(n);
|
|
1264
|
-
return { status: s.value, value: e.data };
|
|
1265
|
-
}
|
|
1266
|
-
gte(e, t) {
|
|
1267
|
-
return this.setLimit("min", e, !0, p.toString(t));
|
|
1268
|
-
}
|
|
1269
|
-
gt(e, t) {
|
|
1270
|
-
return this.setLimit("min", e, !1, p.toString(t));
|
|
1271
|
-
}
|
|
1272
|
-
lte(e, t) {
|
|
1273
|
-
return this.setLimit("max", e, !0, p.toString(t));
|
|
1274
|
-
}
|
|
1275
|
-
lt(e, t) {
|
|
1276
|
-
return this.setLimit("max", e, !1, p.toString(t));
|
|
1277
|
-
}
|
|
1278
|
-
setLimit(e, t, a, s) {
|
|
1279
|
-
return new de({
|
|
1280
|
-
...this._def,
|
|
1281
|
-
checks: [
|
|
1282
|
-
...this._def.checks,
|
|
1283
|
-
{
|
|
1284
|
-
kind: e,
|
|
1285
|
-
value: t,
|
|
1286
|
-
inclusive: a,
|
|
1287
|
-
message: p.toString(s)
|
|
1288
|
-
}
|
|
1289
|
-
]
|
|
1290
|
-
});
|
|
1291
|
-
}
|
|
1292
|
-
_addCheck(e) {
|
|
1293
|
-
return new de({
|
|
1294
|
-
...this._def,
|
|
1295
|
-
checks: [...this._def.checks, e]
|
|
1296
|
-
});
|
|
1297
|
-
}
|
|
1298
|
-
int(e) {
|
|
1299
|
-
return this._addCheck({
|
|
1300
|
-
kind: "int",
|
|
1301
|
-
message: p.toString(e)
|
|
1302
|
-
});
|
|
1303
|
-
}
|
|
1304
|
-
positive(e) {
|
|
1305
|
-
return this._addCheck({
|
|
1306
|
-
kind: "min",
|
|
1307
|
-
value: 0,
|
|
1308
|
-
inclusive: !1,
|
|
1309
|
-
message: p.toString(e)
|
|
1310
|
-
});
|
|
1311
|
-
}
|
|
1312
|
-
negative(e) {
|
|
1313
|
-
return this._addCheck({
|
|
1314
|
-
kind: "max",
|
|
1315
|
-
value: 0,
|
|
1316
|
-
inclusive: !1,
|
|
1317
|
-
message: p.toString(e)
|
|
1318
|
-
});
|
|
1319
|
-
}
|
|
1320
|
-
nonpositive(e) {
|
|
1321
|
-
return this._addCheck({
|
|
1322
|
-
kind: "max",
|
|
1323
|
-
value: 0,
|
|
1324
|
-
inclusive: !0,
|
|
1325
|
-
message: p.toString(e)
|
|
1326
|
-
});
|
|
1327
|
-
}
|
|
1328
|
-
nonnegative(e) {
|
|
1329
|
-
return this._addCheck({
|
|
1330
|
-
kind: "min",
|
|
1331
|
-
value: 0,
|
|
1332
|
-
inclusive: !0,
|
|
1333
|
-
message: p.toString(e)
|
|
1334
|
-
});
|
|
1335
|
-
}
|
|
1336
|
-
multipleOf(e, t) {
|
|
1337
|
-
return this._addCheck({
|
|
1338
|
-
kind: "multipleOf",
|
|
1339
|
-
value: e,
|
|
1340
|
-
message: p.toString(t)
|
|
1341
|
-
});
|
|
1342
|
-
}
|
|
1343
|
-
finite(e) {
|
|
1344
|
-
return this._addCheck({
|
|
1345
|
-
kind: "finite",
|
|
1346
|
-
message: p.toString(e)
|
|
1347
|
-
});
|
|
1348
|
-
}
|
|
1349
|
-
safe(e) {
|
|
1350
|
-
return this._addCheck({
|
|
1351
|
-
kind: "min",
|
|
1352
|
-
inclusive: !0,
|
|
1353
|
-
value: Number.MIN_SAFE_INTEGER,
|
|
1354
|
-
message: p.toString(e)
|
|
1355
|
-
})._addCheck({
|
|
1356
|
-
kind: "max",
|
|
1357
|
-
inclusive: !0,
|
|
1358
|
-
value: Number.MAX_SAFE_INTEGER,
|
|
1359
|
-
message: p.toString(e)
|
|
1360
|
-
});
|
|
1361
|
-
}
|
|
1362
|
-
get minValue() {
|
|
1363
|
-
let e = null;
|
|
1364
|
-
for (const t of this._def.checks)
|
|
1365
|
-
t.kind === "min" && (e === null || t.value > e) && (e = t.value);
|
|
1366
|
-
return e;
|
|
1367
|
-
}
|
|
1368
|
-
get maxValue() {
|
|
1369
|
-
let e = null;
|
|
1370
|
-
for (const t of this._def.checks)
|
|
1371
|
-
t.kind === "max" && (e === null || t.value < e) && (e = t.value);
|
|
1372
|
-
return e;
|
|
1373
|
-
}
|
|
1374
|
-
get isInt() {
|
|
1375
|
-
return !!this._def.checks.find((e) => e.kind === "int" || e.kind === "multipleOf" && w.isInteger(e.value));
|
|
1376
|
-
}
|
|
1377
|
-
get isFinite() {
|
|
1378
|
-
let e = null, t = null;
|
|
1379
|
-
for (const a of this._def.checks) {
|
|
1380
|
-
if (a.kind === "finite" || a.kind === "int" || a.kind === "multipleOf")
|
|
1381
|
-
return !0;
|
|
1382
|
-
a.kind === "min" ? (t === null || a.value > t) && (t = a.value) : a.kind === "max" && (e === null || a.value < e) && (e = a.value);
|
|
1383
|
-
}
|
|
1384
|
-
return Number.isFinite(t) && Number.isFinite(e);
|
|
1385
|
-
}
|
|
1386
|
-
}
|
|
1387
|
-
de.create = (r) => new de({
|
|
1388
|
-
checks: [],
|
|
1389
|
-
typeName: v.ZodNumber,
|
|
1390
|
-
coerce: (r == null ? void 0 : r.coerce) || !1,
|
|
1391
|
-
..._(r)
|
|
1392
|
-
});
|
|
1393
|
-
class le extends b {
|
|
1394
|
-
constructor() {
|
|
1395
|
-
super(...arguments), this.min = this.gte, this.max = this.lte;
|
|
1396
|
-
}
|
|
1397
|
-
_parse(e) {
|
|
1398
|
-
if (this._def.coerce)
|
|
1399
|
-
try {
|
|
1400
|
-
e.data = BigInt(e.data);
|
|
1401
|
-
} catch {
|
|
1402
|
-
return this._getInvalidInput(e);
|
|
1403
|
-
}
|
|
1404
|
-
if (this._getType(e) !== m.bigint)
|
|
1405
|
-
return this._getInvalidInput(e);
|
|
1406
|
-
let a;
|
|
1407
|
-
const s = new L();
|
|
1408
|
-
for (const n of this._def.checks)
|
|
1409
|
-
n.kind === "min" ? (n.inclusive ? e.data < n.value : e.data <= n.value) && (a = this._getOrReturnCtx(e, a), f(a, {
|
|
1410
|
-
code: u.too_small,
|
|
1411
|
-
type: "bigint",
|
|
1412
|
-
minimum: n.value,
|
|
1413
|
-
inclusive: n.inclusive,
|
|
1414
|
-
message: n.message
|
|
1415
|
-
}), s.dirty()) : n.kind === "max" ? (n.inclusive ? e.data > n.value : e.data >= n.value) && (a = this._getOrReturnCtx(e, a), f(a, {
|
|
1416
|
-
code: u.too_big,
|
|
1417
|
-
type: "bigint",
|
|
1418
|
-
maximum: n.value,
|
|
1419
|
-
inclusive: n.inclusive,
|
|
1420
|
-
message: n.message
|
|
1421
|
-
}), s.dirty()) : n.kind === "multipleOf" ? e.data % n.value !== BigInt(0) && (a = this._getOrReturnCtx(e, a), f(a, {
|
|
1422
|
-
code: u.not_multiple_of,
|
|
1423
|
-
multipleOf: n.value,
|
|
1424
|
-
message: n.message
|
|
1425
|
-
}), s.dirty()) : w.assertNever(n);
|
|
1426
|
-
return { status: s.value, value: e.data };
|
|
1427
|
-
}
|
|
1428
|
-
_getInvalidInput(e) {
|
|
1429
|
-
const t = this._getOrReturnCtx(e);
|
|
1430
|
-
return f(t, {
|
|
1431
|
-
code: u.invalid_type,
|
|
1432
|
-
expected: m.bigint,
|
|
1433
|
-
received: t.parsedType
|
|
1434
|
-
}), g;
|
|
1435
|
-
}
|
|
1436
|
-
gte(e, t) {
|
|
1437
|
-
return this.setLimit("min", e, !0, p.toString(t));
|
|
1438
|
-
}
|
|
1439
|
-
gt(e, t) {
|
|
1440
|
-
return this.setLimit("min", e, !1, p.toString(t));
|
|
1441
|
-
}
|
|
1442
|
-
lte(e, t) {
|
|
1443
|
-
return this.setLimit("max", e, !0, p.toString(t));
|
|
1444
|
-
}
|
|
1445
|
-
lt(e, t) {
|
|
1446
|
-
return this.setLimit("max", e, !1, p.toString(t));
|
|
1447
|
-
}
|
|
1448
|
-
setLimit(e, t, a, s) {
|
|
1449
|
-
return new le({
|
|
1450
|
-
...this._def,
|
|
1451
|
-
checks: [
|
|
1452
|
-
...this._def.checks,
|
|
1453
|
-
{
|
|
1454
|
-
kind: e,
|
|
1455
|
-
value: t,
|
|
1456
|
-
inclusive: a,
|
|
1457
|
-
message: p.toString(s)
|
|
1458
|
-
}
|
|
1459
|
-
]
|
|
1460
|
-
});
|
|
1461
|
-
}
|
|
1462
|
-
_addCheck(e) {
|
|
1463
|
-
return new le({
|
|
1464
|
-
...this._def,
|
|
1465
|
-
checks: [...this._def.checks, e]
|
|
1466
|
-
});
|
|
1467
|
-
}
|
|
1468
|
-
positive(e) {
|
|
1469
|
-
return this._addCheck({
|
|
1470
|
-
kind: "min",
|
|
1471
|
-
value: BigInt(0),
|
|
1472
|
-
inclusive: !1,
|
|
1473
|
-
message: p.toString(e)
|
|
1474
|
-
});
|
|
1475
|
-
}
|
|
1476
|
-
negative(e) {
|
|
1477
|
-
return this._addCheck({
|
|
1478
|
-
kind: "max",
|
|
1479
|
-
value: BigInt(0),
|
|
1480
|
-
inclusive: !1,
|
|
1481
|
-
message: p.toString(e)
|
|
1482
|
-
});
|
|
1483
|
-
}
|
|
1484
|
-
nonpositive(e) {
|
|
1485
|
-
return this._addCheck({
|
|
1486
|
-
kind: "max",
|
|
1487
|
-
value: BigInt(0),
|
|
1488
|
-
inclusive: !0,
|
|
1489
|
-
message: p.toString(e)
|
|
1490
|
-
});
|
|
1491
|
-
}
|
|
1492
|
-
nonnegative(e) {
|
|
1493
|
-
return this._addCheck({
|
|
1494
|
-
kind: "min",
|
|
1495
|
-
value: BigInt(0),
|
|
1496
|
-
inclusive: !0,
|
|
1497
|
-
message: p.toString(e)
|
|
1498
|
-
});
|
|
1499
|
-
}
|
|
1500
|
-
multipleOf(e, t) {
|
|
1501
|
-
return this._addCheck({
|
|
1502
|
-
kind: "multipleOf",
|
|
1503
|
-
value: e,
|
|
1504
|
-
message: p.toString(t)
|
|
1505
|
-
});
|
|
1506
|
-
}
|
|
1507
|
-
get minValue() {
|
|
1508
|
-
let e = null;
|
|
1509
|
-
for (const t of this._def.checks)
|
|
1510
|
-
t.kind === "min" && (e === null || t.value > e) && (e = t.value);
|
|
1511
|
-
return e;
|
|
1512
|
-
}
|
|
1513
|
-
get maxValue() {
|
|
1514
|
-
let e = null;
|
|
1515
|
-
for (const t of this._def.checks)
|
|
1516
|
-
t.kind === "max" && (e === null || t.value < e) && (e = t.value);
|
|
1517
|
-
return e;
|
|
1518
|
-
}
|
|
1519
|
-
}
|
|
1520
|
-
le.create = (r) => {
|
|
1521
|
-
var e;
|
|
1522
|
-
return new le({
|
|
1523
|
-
checks: [],
|
|
1524
|
-
typeName: v.ZodBigInt,
|
|
1525
|
-
coerce: (e = r == null ? void 0 : r.coerce) !== null && e !== void 0 ? e : !1,
|
|
1526
|
-
..._(r)
|
|
1527
|
-
});
|
|
1528
|
-
};
|
|
1529
|
-
class Me extends b {
|
|
1530
|
-
_parse(e) {
|
|
1531
|
-
if (this._def.coerce && (e.data = !!e.data), this._getType(e) !== m.boolean) {
|
|
1532
|
-
const a = this._getOrReturnCtx(e);
|
|
1533
|
-
return f(a, {
|
|
1534
|
-
code: u.invalid_type,
|
|
1535
|
-
expected: m.boolean,
|
|
1536
|
-
received: a.parsedType
|
|
1537
|
-
}), g;
|
|
1538
|
-
}
|
|
1539
|
-
return F(e.data);
|
|
1540
|
-
}
|
|
1541
|
-
}
|
|
1542
|
-
Me.create = (r) => new Me({
|
|
1543
|
-
typeName: v.ZodBoolean,
|
|
1544
|
-
coerce: (r == null ? void 0 : r.coerce) || !1,
|
|
1545
|
-
..._(r)
|
|
1546
|
-
});
|
|
1547
|
-
class ge extends b {
|
|
1548
|
-
_parse(e) {
|
|
1549
|
-
if (this._def.coerce && (e.data = new Date(e.data)), this._getType(e) !== m.date) {
|
|
1550
|
-
const n = this._getOrReturnCtx(e);
|
|
1551
|
-
return f(n, {
|
|
1552
|
-
code: u.invalid_type,
|
|
1553
|
-
expected: m.date,
|
|
1554
|
-
received: n.parsedType
|
|
1555
|
-
}), g;
|
|
1556
|
-
}
|
|
1557
|
-
if (isNaN(e.data.getTime())) {
|
|
1558
|
-
const n = this._getOrReturnCtx(e);
|
|
1559
|
-
return f(n, {
|
|
1560
|
-
code: u.invalid_date
|
|
1561
|
-
}), g;
|
|
1562
|
-
}
|
|
1563
|
-
const a = new L();
|
|
1564
|
-
let s;
|
|
1565
|
-
for (const n of this._def.checks)
|
|
1566
|
-
n.kind === "min" ? e.data.getTime() < n.value && (s = this._getOrReturnCtx(e, s), f(s, {
|
|
1567
|
-
code: u.too_small,
|
|
1568
|
-
message: n.message,
|
|
1569
|
-
inclusive: !0,
|
|
1570
|
-
exact: !1,
|
|
1571
|
-
minimum: n.value,
|
|
1572
|
-
type: "date"
|
|
1573
|
-
}), a.dirty()) : n.kind === "max" ? e.data.getTime() > n.value && (s = this._getOrReturnCtx(e, s), f(s, {
|
|
1574
|
-
code: u.too_big,
|
|
1575
|
-
message: n.message,
|
|
1576
|
-
inclusive: !0,
|
|
1577
|
-
exact: !1,
|
|
1578
|
-
maximum: n.value,
|
|
1579
|
-
type: "date"
|
|
1580
|
-
}), a.dirty()) : w.assertNever(n);
|
|
1581
|
-
return {
|
|
1582
|
-
status: a.value,
|
|
1583
|
-
value: new Date(e.data.getTime())
|
|
1584
|
-
};
|
|
1585
|
-
}
|
|
1586
|
-
_addCheck(e) {
|
|
1587
|
-
return new ge({
|
|
1588
|
-
...this._def,
|
|
1589
|
-
checks: [...this._def.checks, e]
|
|
1590
|
-
});
|
|
1591
|
-
}
|
|
1592
|
-
min(e, t) {
|
|
1593
|
-
return this._addCheck({
|
|
1594
|
-
kind: "min",
|
|
1595
|
-
value: e.getTime(),
|
|
1596
|
-
message: p.toString(t)
|
|
1597
|
-
});
|
|
1598
|
-
}
|
|
1599
|
-
max(e, t) {
|
|
1600
|
-
return this._addCheck({
|
|
1601
|
-
kind: "max",
|
|
1602
|
-
value: e.getTime(),
|
|
1603
|
-
message: p.toString(t)
|
|
1604
|
-
});
|
|
1605
|
-
}
|
|
1606
|
-
get minDate() {
|
|
1607
|
-
let e = null;
|
|
1608
|
-
for (const t of this._def.checks)
|
|
1609
|
-
t.kind === "min" && (e === null || t.value > e) && (e = t.value);
|
|
1610
|
-
return e != null ? new Date(e) : null;
|
|
1611
|
-
}
|
|
1612
|
-
get maxDate() {
|
|
1613
|
-
let e = null;
|
|
1614
|
-
for (const t of this._def.checks)
|
|
1615
|
-
t.kind === "max" && (e === null || t.value < e) && (e = t.value);
|
|
1616
|
-
return e != null ? new Date(e) : null;
|
|
1617
|
-
}
|
|
1618
|
-
}
|
|
1619
|
-
ge.create = (r) => new ge({
|
|
1620
|
-
checks: [],
|
|
1621
|
-
coerce: (r == null ? void 0 : r.coerce) || !1,
|
|
1622
|
-
typeName: v.ZodDate,
|
|
1623
|
-
..._(r)
|
|
1624
|
-
});
|
|
1625
|
-
class Xe extends b {
|
|
1626
|
-
_parse(e) {
|
|
1627
|
-
if (this._getType(e) !== m.symbol) {
|
|
1628
|
-
const a = this._getOrReturnCtx(e);
|
|
1629
|
-
return f(a, {
|
|
1630
|
-
code: u.invalid_type,
|
|
1631
|
-
expected: m.symbol,
|
|
1632
|
-
received: a.parsedType
|
|
1633
|
-
}), g;
|
|
1634
|
-
}
|
|
1635
|
-
return F(e.data);
|
|
1636
|
-
}
|
|
1637
|
-
}
|
|
1638
|
-
Xe.create = (r) => new Xe({
|
|
1639
|
-
typeName: v.ZodSymbol,
|
|
1640
|
-
..._(r)
|
|
1641
|
-
});
|
|
1642
|
-
class Pe extends b {
|
|
1643
|
-
_parse(e) {
|
|
1644
|
-
if (this._getType(e) !== m.undefined) {
|
|
1645
|
-
const a = this._getOrReturnCtx(e);
|
|
1646
|
-
return f(a, {
|
|
1647
|
-
code: u.invalid_type,
|
|
1648
|
-
expected: m.undefined,
|
|
1649
|
-
received: a.parsedType
|
|
1650
|
-
}), g;
|
|
1651
|
-
}
|
|
1652
|
-
return F(e.data);
|
|
1653
|
-
}
|
|
1654
|
-
}
|
|
1655
|
-
Pe.create = (r) => new Pe({
|
|
1656
|
-
typeName: v.ZodUndefined,
|
|
1657
|
-
..._(r)
|
|
1658
|
-
});
|
|
1659
|
-
class $e extends b {
|
|
1660
|
-
_parse(e) {
|
|
1661
|
-
if (this._getType(e) !== m.null) {
|
|
1662
|
-
const a = this._getOrReturnCtx(e);
|
|
1663
|
-
return f(a, {
|
|
1664
|
-
code: u.invalid_type,
|
|
1665
|
-
expected: m.null,
|
|
1666
|
-
received: a.parsedType
|
|
1667
|
-
}), g;
|
|
1668
|
-
}
|
|
1669
|
-
return F(e.data);
|
|
1670
|
-
}
|
|
1671
|
-
}
|
|
1672
|
-
$e.create = (r) => new $e({
|
|
1673
|
-
typeName: v.ZodNull,
|
|
1674
|
-
..._(r)
|
|
1675
|
-
});
|
|
1676
|
-
class Ce extends b {
|
|
1677
|
-
constructor() {
|
|
1678
|
-
super(...arguments), this._any = !0;
|
|
1679
|
-
}
|
|
1680
|
-
_parse(e) {
|
|
1681
|
-
return F(e.data);
|
|
1682
|
-
}
|
|
1683
|
-
}
|
|
1684
|
-
Ce.create = (r) => new Ce({
|
|
1685
|
-
typeName: v.ZodAny,
|
|
1686
|
-
..._(r)
|
|
1687
|
-
});
|
|
1688
|
-
class me extends b {
|
|
1689
|
-
constructor() {
|
|
1690
|
-
super(...arguments), this._unknown = !0;
|
|
1691
|
-
}
|
|
1692
|
-
_parse(e) {
|
|
1693
|
-
return F(e.data);
|
|
1694
|
-
}
|
|
1695
|
-
}
|
|
1696
|
-
me.create = (r) => new me({
|
|
1697
|
-
typeName: v.ZodUnknown,
|
|
1698
|
-
..._(r)
|
|
1699
|
-
});
|
|
1700
|
-
class se extends b {
|
|
1701
|
-
_parse(e) {
|
|
1702
|
-
const t = this._getOrReturnCtx(e);
|
|
1703
|
-
return f(t, {
|
|
1704
|
-
code: u.invalid_type,
|
|
1705
|
-
expected: m.never,
|
|
1706
|
-
received: t.parsedType
|
|
1707
|
-
}), g;
|
|
1708
|
-
}
|
|
1709
|
-
}
|
|
1710
|
-
se.create = (r) => new se({
|
|
1711
|
-
typeName: v.ZodNever,
|
|
1712
|
-
..._(r)
|
|
1713
|
-
});
|
|
1714
|
-
class et extends b {
|
|
1715
|
-
_parse(e) {
|
|
1716
|
-
if (this._getType(e) !== m.undefined) {
|
|
1717
|
-
const a = this._getOrReturnCtx(e);
|
|
1718
|
-
return f(a, {
|
|
1719
|
-
code: u.invalid_type,
|
|
1720
|
-
expected: m.void,
|
|
1721
|
-
received: a.parsedType
|
|
1722
|
-
}), g;
|
|
1723
|
-
}
|
|
1724
|
-
return F(e.data);
|
|
1725
|
-
}
|
|
1726
|
-
}
|
|
1727
|
-
et.create = (r) => new et({
|
|
1728
|
-
typeName: v.ZodVoid,
|
|
1729
|
-
..._(r)
|
|
1730
|
-
});
|
|
1731
|
-
class G extends b {
|
|
1732
|
-
_parse(e) {
|
|
1733
|
-
const { ctx: t, status: a } = this._processInputParams(e), s = this._def;
|
|
1734
|
-
if (t.parsedType !== m.array)
|
|
1735
|
-
return f(t, {
|
|
1736
|
-
code: u.invalid_type,
|
|
1737
|
-
expected: m.array,
|
|
1738
|
-
received: t.parsedType
|
|
1739
|
-
}), g;
|
|
1740
|
-
if (s.exactLength !== null) {
|
|
1741
|
-
const i = t.data.length > s.exactLength.value, o = t.data.length < s.exactLength.value;
|
|
1742
|
-
(i || o) && (f(t, {
|
|
1743
|
-
code: i ? u.too_big : u.too_small,
|
|
1744
|
-
minimum: o ? s.exactLength.value : void 0,
|
|
1745
|
-
maximum: i ? s.exactLength.value : void 0,
|
|
1746
|
-
type: "array",
|
|
1747
|
-
inclusive: !0,
|
|
1748
|
-
exact: !0,
|
|
1749
|
-
message: s.exactLength.message
|
|
1750
|
-
}), a.dirty());
|
|
1751
|
-
}
|
|
1752
|
-
if (s.minLength !== null && t.data.length < s.minLength.value && (f(t, {
|
|
1753
|
-
code: u.too_small,
|
|
1754
|
-
minimum: s.minLength.value,
|
|
1755
|
-
type: "array",
|
|
1756
|
-
inclusive: !0,
|
|
1757
|
-
exact: !1,
|
|
1758
|
-
message: s.minLength.message
|
|
1759
|
-
}), a.dirty()), s.maxLength !== null && t.data.length > s.maxLength.value && (f(t, {
|
|
1760
|
-
code: u.too_big,
|
|
1761
|
-
maximum: s.maxLength.value,
|
|
1762
|
-
type: "array",
|
|
1763
|
-
inclusive: !0,
|
|
1764
|
-
exact: !1,
|
|
1765
|
-
message: s.maxLength.message
|
|
1766
|
-
}), a.dirty()), t.common.async)
|
|
1767
|
-
return Promise.all([...t.data].map((i, o) => s.type._parseAsync(new Y(t, i, t.path, o)))).then((i) => L.mergeArray(a, i));
|
|
1768
|
-
const n = [...t.data].map((i, o) => s.type._parseSync(new Y(t, i, t.path, o)));
|
|
1769
|
-
return L.mergeArray(a, n);
|
|
1770
|
-
}
|
|
1771
|
-
get element() {
|
|
1772
|
-
return this._def.type;
|
|
1773
|
-
}
|
|
1774
|
-
min(e, t) {
|
|
1775
|
-
return new G({
|
|
1776
|
-
...this._def,
|
|
1777
|
-
minLength: { value: e, message: p.toString(t) }
|
|
1778
|
-
});
|
|
1779
|
-
}
|
|
1780
|
-
max(e, t) {
|
|
1781
|
-
return new G({
|
|
1782
|
-
...this._def,
|
|
1783
|
-
maxLength: { value: e, message: p.toString(t) }
|
|
1784
|
-
});
|
|
1785
|
-
}
|
|
1786
|
-
length(e, t) {
|
|
1787
|
-
return new G({
|
|
1788
|
-
...this._def,
|
|
1789
|
-
exactLength: { value: e, message: p.toString(t) }
|
|
1790
|
-
});
|
|
1791
|
-
}
|
|
1792
|
-
nonempty(e) {
|
|
1793
|
-
return this.min(1, e);
|
|
1794
|
-
}
|
|
1795
|
-
}
|
|
1796
|
-
G.create = (r, e) => new G({
|
|
1797
|
-
type: r,
|
|
1798
|
-
minLength: null,
|
|
1799
|
-
maxLength: null,
|
|
1800
|
-
exactLength: null,
|
|
1801
|
-
typeName: v.ZodArray,
|
|
1802
|
-
..._(e)
|
|
1803
|
-
});
|
|
1804
|
-
function we(r) {
|
|
1805
|
-
if (r instanceof E) {
|
|
1806
|
-
const e = {};
|
|
1807
|
-
for (const t in r.shape) {
|
|
1808
|
-
const a = r.shape[t];
|
|
1809
|
-
e[t] = H.create(we(a));
|
|
1810
|
-
}
|
|
1811
|
-
return new E({
|
|
1812
|
-
...r._def,
|
|
1813
|
-
shape: () => e
|
|
1814
|
-
});
|
|
1815
|
-
} else return r instanceof G ? new G({
|
|
1816
|
-
...r._def,
|
|
1817
|
-
type: we(r.element)
|
|
1818
|
-
}) : r instanceof H ? H.create(we(r.unwrap())) : r instanceof fe ? fe.create(we(r.unwrap())) : r instanceof K ? K.create(r.items.map((e) => we(e))) : r;
|
|
1819
|
-
}
|
|
1820
|
-
class E extends b {
|
|
1821
|
-
constructor() {
|
|
1822
|
-
super(...arguments), this._cached = null, this.nonstrict = this.passthrough, this.augment = this.extend;
|
|
1823
|
-
}
|
|
1824
|
-
_getCached() {
|
|
1825
|
-
if (this._cached !== null)
|
|
1826
|
-
return this._cached;
|
|
1827
|
-
const e = this._def.shape(), t = w.objectKeys(e);
|
|
1828
|
-
return this._cached = { shape: e, keys: t };
|
|
1829
|
-
}
|
|
1830
|
-
_parse(e) {
|
|
1831
|
-
if (this._getType(e) !== m.object) {
|
|
1832
|
-
const l = this._getOrReturnCtx(e);
|
|
1833
|
-
return f(l, {
|
|
1834
|
-
code: u.invalid_type,
|
|
1835
|
-
expected: m.object,
|
|
1836
|
-
received: l.parsedType
|
|
1837
|
-
}), g;
|
|
1838
|
-
}
|
|
1839
|
-
const { status: a, ctx: s } = this._processInputParams(e), { shape: n, keys: i } = this._getCached(), o = [];
|
|
1840
|
-
if (!(this._def.catchall instanceof se && this._def.unknownKeys === "strip"))
|
|
1841
|
-
for (const l in s.data)
|
|
1842
|
-
i.includes(l) || o.push(l);
|
|
1843
|
-
const d = [];
|
|
1844
|
-
for (const l of i) {
|
|
1845
|
-
const h = n[l], x = s.data[l];
|
|
1846
|
-
d.push({
|
|
1847
|
-
key: { status: "valid", value: l },
|
|
1848
|
-
value: h._parse(new Y(s, x, s.path, l)),
|
|
1849
|
-
alwaysSet: l in s.data
|
|
1850
|
-
});
|
|
1851
|
-
}
|
|
1852
|
-
if (this._def.catchall instanceof se) {
|
|
1853
|
-
const l = this._def.unknownKeys;
|
|
1854
|
-
if (l === "passthrough")
|
|
1855
|
-
for (const h of o)
|
|
1856
|
-
d.push({
|
|
1857
|
-
key: { status: "valid", value: h },
|
|
1858
|
-
value: { status: "valid", value: s.data[h] }
|
|
1859
|
-
});
|
|
1860
|
-
else if (l === "strict")
|
|
1861
|
-
o.length > 0 && (f(s, {
|
|
1862
|
-
code: u.unrecognized_keys,
|
|
1863
|
-
keys: o
|
|
1864
|
-
}), a.dirty());
|
|
1865
|
-
else if (l !== "strip") throw new Error("Internal ZodObject error: invalid unknownKeys value.");
|
|
1866
|
-
} else {
|
|
1867
|
-
const l = this._def.catchall;
|
|
1868
|
-
for (const h of o) {
|
|
1869
|
-
const x = s.data[h];
|
|
1870
|
-
d.push({
|
|
1871
|
-
key: { status: "valid", value: h },
|
|
1872
|
-
value: l._parse(
|
|
1873
|
-
new Y(s, x, s.path, h)
|
|
1874
|
-
//, ctx.child(key), value, getParsedType(value)
|
|
1875
|
-
),
|
|
1876
|
-
alwaysSet: h in s.data
|
|
1877
|
-
});
|
|
1878
|
-
}
|
|
1879
|
-
}
|
|
1880
|
-
return s.common.async ? Promise.resolve().then(async () => {
|
|
1881
|
-
const l = [];
|
|
1882
|
-
for (const h of d) {
|
|
1883
|
-
const x = await h.key, M = await h.value;
|
|
1884
|
-
l.push({
|
|
1885
|
-
key: x,
|
|
1886
|
-
value: M,
|
|
1887
|
-
alwaysSet: h.alwaysSet
|
|
1888
|
-
});
|
|
1889
|
-
}
|
|
1890
|
-
return l;
|
|
1891
|
-
}).then((l) => L.mergeObjectSync(a, l)) : L.mergeObjectSync(a, d);
|
|
1892
|
-
}
|
|
1893
|
-
get shape() {
|
|
1894
|
-
return this._def.shape();
|
|
1895
|
-
}
|
|
1896
|
-
strict(e) {
|
|
1897
|
-
return p.errToObj, new E({
|
|
1898
|
-
...this._def,
|
|
1899
|
-
unknownKeys: "strict",
|
|
1900
|
-
...e !== void 0 ? {
|
|
1901
|
-
errorMap: (t, a) => {
|
|
1902
|
-
var s, n, i, o;
|
|
1903
|
-
const d = (i = (n = (s = this._def).errorMap) === null || n === void 0 ? void 0 : n.call(s, t, a).message) !== null && i !== void 0 ? i : a.defaultError;
|
|
1904
|
-
return t.code === "unrecognized_keys" ? {
|
|
1905
|
-
message: (o = p.errToObj(e).message) !== null && o !== void 0 ? o : d
|
|
1906
|
-
} : {
|
|
1907
|
-
message: d
|
|
1908
|
-
};
|
|
1909
|
-
}
|
|
1910
|
-
} : {}
|
|
1911
|
-
});
|
|
1912
|
-
}
|
|
1913
|
-
strip() {
|
|
1914
|
-
return new E({
|
|
1915
|
-
...this._def,
|
|
1916
|
-
unknownKeys: "strip"
|
|
1917
|
-
});
|
|
1918
|
-
}
|
|
1919
|
-
passthrough() {
|
|
1920
|
-
return new E({
|
|
1921
|
-
...this._def,
|
|
1922
|
-
unknownKeys: "passthrough"
|
|
1923
|
-
});
|
|
1924
|
-
}
|
|
1925
|
-
// const AugmentFactory =
|
|
1926
|
-
// <Def extends ZodObjectDef>(def: Def) =>
|
|
1927
|
-
// <Augmentation extends ZodRawShape>(
|
|
1928
|
-
// augmentation: Augmentation
|
|
1929
|
-
// ): ZodObject<
|
|
1930
|
-
// extendShape<ReturnType<Def["shape"]>, Augmentation>,
|
|
1931
|
-
// Def["unknownKeys"],
|
|
1932
|
-
// Def["catchall"]
|
|
1933
|
-
// > => {
|
|
1934
|
-
// return new ZodObject({
|
|
1935
|
-
// ...def,
|
|
1936
|
-
// shape: () => ({
|
|
1937
|
-
// ...def.shape(),
|
|
1938
|
-
// ...augmentation,
|
|
1939
|
-
// }),
|
|
1940
|
-
// }) as any;
|
|
1941
|
-
// };
|
|
1942
|
-
extend(e) {
|
|
1943
|
-
return new E({
|
|
1944
|
-
...this._def,
|
|
1945
|
-
shape: () => ({
|
|
1946
|
-
...this._def.shape(),
|
|
1947
|
-
...e
|
|
1948
|
-
})
|
|
1949
|
-
});
|
|
1950
|
-
}
|
|
1951
|
-
/**
|
|
1952
|
-
* Prior to zod@1.0.12 there was a bug in the
|
|
1953
|
-
* inferred type of merged objects. Please
|
|
1954
|
-
* upgrade if you are experiencing issues.
|
|
1955
|
-
*/
|
|
1956
|
-
merge(e) {
|
|
1957
|
-
return new E({
|
|
1958
|
-
unknownKeys: e._def.unknownKeys,
|
|
1959
|
-
catchall: e._def.catchall,
|
|
1960
|
-
shape: () => ({
|
|
1961
|
-
...this._def.shape(),
|
|
1962
|
-
...e._def.shape()
|
|
1963
|
-
}),
|
|
1964
|
-
typeName: v.ZodObject
|
|
1965
|
-
});
|
|
1966
|
-
}
|
|
1967
|
-
// merge<
|
|
1968
|
-
// Incoming extends AnyZodObject,
|
|
1969
|
-
// Augmentation extends Incoming["shape"],
|
|
1970
|
-
// NewOutput extends {
|
|
1971
|
-
// [k in keyof Augmentation | keyof Output]: k extends keyof Augmentation
|
|
1972
|
-
// ? Augmentation[k]["_output"]
|
|
1973
|
-
// : k extends keyof Output
|
|
1974
|
-
// ? Output[k]
|
|
1975
|
-
// : never;
|
|
1976
|
-
// },
|
|
1977
|
-
// NewInput extends {
|
|
1978
|
-
// [k in keyof Augmentation | keyof Input]: k extends keyof Augmentation
|
|
1979
|
-
// ? Augmentation[k]["_input"]
|
|
1980
|
-
// : k extends keyof Input
|
|
1981
|
-
// ? Input[k]
|
|
1982
|
-
// : never;
|
|
1983
|
-
// }
|
|
1984
|
-
// >(
|
|
1985
|
-
// merging: Incoming
|
|
1986
|
-
// ): ZodObject<
|
|
1987
|
-
// extendShape<T, ReturnType<Incoming["_def"]["shape"]>>,
|
|
1988
|
-
// Incoming["_def"]["unknownKeys"],
|
|
1989
|
-
// Incoming["_def"]["catchall"],
|
|
1990
|
-
// NewOutput,
|
|
1991
|
-
// NewInput
|
|
1992
|
-
// > {
|
|
1993
|
-
// const merged: any = new ZodObject({
|
|
1994
|
-
// unknownKeys: merging._def.unknownKeys,
|
|
1995
|
-
// catchall: merging._def.catchall,
|
|
1996
|
-
// shape: () =>
|
|
1997
|
-
// objectUtil.mergeShapes(this._def.shape(), merging._def.shape()),
|
|
1998
|
-
// typeName: ZodFirstPartyTypeKind.ZodObject,
|
|
1999
|
-
// }) as any;
|
|
2000
|
-
// return merged;
|
|
2001
|
-
// }
|
|
2002
|
-
setKey(e, t) {
|
|
2003
|
-
return this.augment({ [e]: t });
|
|
2004
|
-
}
|
|
2005
|
-
// merge<Incoming extends AnyZodObject>(
|
|
2006
|
-
// merging: Incoming
|
|
2007
|
-
// ): //ZodObject<T & Incoming["_shape"], UnknownKeys, Catchall> = (merging) => {
|
|
2008
|
-
// ZodObject<
|
|
2009
|
-
// extendShape<T, ReturnType<Incoming["_def"]["shape"]>>,
|
|
2010
|
-
// Incoming["_def"]["unknownKeys"],
|
|
2011
|
-
// Incoming["_def"]["catchall"]
|
|
2012
|
-
// > {
|
|
2013
|
-
// // const mergedShape = objectUtil.mergeShapes(
|
|
2014
|
-
// // this._def.shape(),
|
|
2015
|
-
// // merging._def.shape()
|
|
2016
|
-
// // );
|
|
2017
|
-
// const merged: any = new ZodObject({
|
|
2018
|
-
// unknownKeys: merging._def.unknownKeys,
|
|
2019
|
-
// catchall: merging._def.catchall,
|
|
2020
|
-
// shape: () =>
|
|
2021
|
-
// objectUtil.mergeShapes(this._def.shape(), merging._def.shape()),
|
|
2022
|
-
// typeName: ZodFirstPartyTypeKind.ZodObject,
|
|
2023
|
-
// }) as any;
|
|
2024
|
-
// return merged;
|
|
2025
|
-
// }
|
|
2026
|
-
catchall(e) {
|
|
2027
|
-
return new E({
|
|
2028
|
-
...this._def,
|
|
2029
|
-
catchall: e
|
|
2030
|
-
});
|
|
2031
|
-
}
|
|
2032
|
-
pick(e) {
|
|
2033
|
-
const t = {};
|
|
2034
|
-
return w.objectKeys(e).forEach((a) => {
|
|
2035
|
-
e[a] && this.shape[a] && (t[a] = this.shape[a]);
|
|
2036
|
-
}), new E({
|
|
2037
|
-
...this._def,
|
|
2038
|
-
shape: () => t
|
|
2039
|
-
});
|
|
2040
|
-
}
|
|
2041
|
-
omit(e) {
|
|
2042
|
-
const t = {};
|
|
2043
|
-
return w.objectKeys(this.shape).forEach((a) => {
|
|
2044
|
-
e[a] || (t[a] = this.shape[a]);
|
|
2045
|
-
}), new E({
|
|
2046
|
-
...this._def,
|
|
2047
|
-
shape: () => t
|
|
2048
|
-
});
|
|
2049
|
-
}
|
|
2050
|
-
/**
|
|
2051
|
-
* @deprecated
|
|
2052
|
-
*/
|
|
2053
|
-
deepPartial() {
|
|
2054
|
-
return we(this);
|
|
2055
|
-
}
|
|
2056
|
-
partial(e) {
|
|
2057
|
-
const t = {};
|
|
2058
|
-
return w.objectKeys(this.shape).forEach((a) => {
|
|
2059
|
-
const s = this.shape[a];
|
|
2060
|
-
e && !e[a] ? t[a] = s : t[a] = s.optional();
|
|
2061
|
-
}), new E({
|
|
2062
|
-
...this._def,
|
|
2063
|
-
shape: () => t
|
|
2064
|
-
});
|
|
2065
|
-
}
|
|
2066
|
-
required(e) {
|
|
2067
|
-
const t = {};
|
|
2068
|
-
return w.objectKeys(this.shape).forEach((a) => {
|
|
2069
|
-
if (e && !e[a])
|
|
2070
|
-
t[a] = this.shape[a];
|
|
2071
|
-
else {
|
|
2072
|
-
let n = this.shape[a];
|
|
2073
|
-
for (; n instanceof H; )
|
|
2074
|
-
n = n._def.innerType;
|
|
2075
|
-
t[a] = n;
|
|
2076
|
-
}
|
|
2077
|
-
}), new E({
|
|
2078
|
-
...this._def,
|
|
2079
|
-
shape: () => t
|
|
2080
|
-
});
|
|
2081
|
-
}
|
|
2082
|
-
keyof() {
|
|
2083
|
-
return ar(w.objectKeys(this.shape));
|
|
2084
|
-
}
|
|
2085
|
-
}
|
|
2086
|
-
E.create = (r, e) => new E({
|
|
2087
|
-
shape: () => r,
|
|
2088
|
-
unknownKeys: "strip",
|
|
2089
|
-
catchall: se.create(),
|
|
2090
|
-
typeName: v.ZodObject,
|
|
2091
|
-
..._(e)
|
|
2092
|
-
});
|
|
2093
|
-
E.strictCreate = (r, e) => new E({
|
|
2094
|
-
shape: () => r,
|
|
2095
|
-
unknownKeys: "strict",
|
|
2096
|
-
catchall: se.create(),
|
|
2097
|
-
typeName: v.ZodObject,
|
|
2098
|
-
..._(e)
|
|
2099
|
-
});
|
|
2100
|
-
E.lazycreate = (r, e) => new E({
|
|
2101
|
-
shape: r,
|
|
2102
|
-
unknownKeys: "strip",
|
|
2103
|
-
catchall: se.create(),
|
|
2104
|
-
typeName: v.ZodObject,
|
|
2105
|
-
..._(e)
|
|
2106
|
-
});
|
|
2107
|
-
class ze extends b {
|
|
2108
|
-
_parse(e) {
|
|
2109
|
-
const { ctx: t } = this._processInputParams(e), a = this._def.options;
|
|
2110
|
-
function s(n) {
|
|
2111
|
-
for (const o of n)
|
|
2112
|
-
if (o.result.status === "valid")
|
|
2113
|
-
return o.result;
|
|
2114
|
-
for (const o of n)
|
|
2115
|
-
if (o.result.status === "dirty")
|
|
2116
|
-
return t.common.issues.push(...o.ctx.common.issues), o.result;
|
|
2117
|
-
const i = n.map((o) => new B(o.ctx.common.issues));
|
|
2118
|
-
return f(t, {
|
|
2119
|
-
code: u.invalid_union,
|
|
2120
|
-
unionErrors: i
|
|
2121
|
-
}), g;
|
|
2122
|
-
}
|
|
2123
|
-
if (t.common.async)
|
|
2124
|
-
return Promise.all(a.map(async (n) => {
|
|
2125
|
-
const i = {
|
|
2126
|
-
...t,
|
|
2127
|
-
common: {
|
|
2128
|
-
...t.common,
|
|
2129
|
-
issues: []
|
|
2130
|
-
},
|
|
2131
|
-
parent: null
|
|
2132
|
-
};
|
|
2133
|
-
return {
|
|
2134
|
-
result: await n._parseAsync({
|
|
2135
|
-
data: t.data,
|
|
2136
|
-
path: t.path,
|
|
2137
|
-
parent: i
|
|
2138
|
-
}),
|
|
2139
|
-
ctx: i
|
|
2140
|
-
};
|
|
2141
|
-
})).then(s);
|
|
2142
|
-
{
|
|
2143
|
-
let n;
|
|
2144
|
-
const i = [];
|
|
2145
|
-
for (const d of a) {
|
|
2146
|
-
const l = {
|
|
2147
|
-
...t,
|
|
2148
|
-
common: {
|
|
2149
|
-
...t.common,
|
|
2150
|
-
issues: []
|
|
2151
|
-
},
|
|
2152
|
-
parent: null
|
|
2153
|
-
}, h = d._parseSync({
|
|
2154
|
-
data: t.data,
|
|
2155
|
-
path: t.path,
|
|
2156
|
-
parent: l
|
|
2157
|
-
});
|
|
2158
|
-
if (h.status === "valid")
|
|
2159
|
-
return h;
|
|
2160
|
-
h.status === "dirty" && !n && (n = { result: h, ctx: l }), l.common.issues.length && i.push(l.common.issues);
|
|
2161
|
-
}
|
|
2162
|
-
if (n)
|
|
2163
|
-
return t.common.issues.push(...n.ctx.common.issues), n.result;
|
|
2164
|
-
const o = i.map((d) => new B(d));
|
|
2165
|
-
return f(t, {
|
|
2166
|
-
code: u.invalid_union,
|
|
2167
|
-
unionErrors: o
|
|
2168
|
-
}), g;
|
|
2169
|
-
}
|
|
2170
|
-
}
|
|
2171
|
-
get options() {
|
|
2172
|
-
return this._def.options;
|
|
2173
|
-
}
|
|
2174
|
-
}
|
|
2175
|
-
ze.create = (r, e) => new ze({
|
|
2176
|
-
options: r,
|
|
2177
|
-
typeName: v.ZodUnion,
|
|
2178
|
-
..._(e)
|
|
2179
|
-
});
|
|
2180
|
-
const re = (r) => r instanceof De ? re(r.schema) : r instanceof J ? re(r.innerType()) : r instanceof Ue ? [r.value] : r instanceof ue ? r.options : r instanceof Be ? w.objectValues(r.enum) : r instanceof We ? re(r._def.innerType) : r instanceof Pe ? [void 0] : r instanceof $e ? [null] : r instanceof H ? [void 0, ...re(r.unwrap())] : r instanceof fe ? [null, ...re(r.unwrap())] : r instanceof xt || r instanceof Ge ? re(r.unwrap()) : r instanceof qe ? re(r._def.innerType) : [];
|
|
2181
|
-
class nt extends b {
|
|
2182
|
-
_parse(e) {
|
|
2183
|
-
const { ctx: t } = this._processInputParams(e);
|
|
2184
|
-
if (t.parsedType !== m.object)
|
|
2185
|
-
return f(t, {
|
|
2186
|
-
code: u.invalid_type,
|
|
2187
|
-
expected: m.object,
|
|
2188
|
-
received: t.parsedType
|
|
2189
|
-
}), g;
|
|
2190
|
-
const a = this.discriminator, s = t.data[a], n = this.optionsMap.get(s);
|
|
2191
|
-
return n ? t.common.async ? n._parseAsync({
|
|
2192
|
-
data: t.data,
|
|
2193
|
-
path: t.path,
|
|
2194
|
-
parent: t
|
|
2195
|
-
}) : n._parseSync({
|
|
2196
|
-
data: t.data,
|
|
2197
|
-
path: t.path,
|
|
2198
|
-
parent: t
|
|
2199
|
-
}) : (f(t, {
|
|
2200
|
-
code: u.invalid_union_discriminator,
|
|
2201
|
-
options: Array.from(this.optionsMap.keys()),
|
|
2202
|
-
path: [a]
|
|
2203
|
-
}), g);
|
|
2204
|
-
}
|
|
2205
|
-
get discriminator() {
|
|
2206
|
-
return this._def.discriminator;
|
|
2207
|
-
}
|
|
2208
|
-
get options() {
|
|
2209
|
-
return this._def.options;
|
|
2210
|
-
}
|
|
2211
|
-
get optionsMap() {
|
|
2212
|
-
return this._def.optionsMap;
|
|
2213
|
-
}
|
|
2214
|
-
/**
|
|
2215
|
-
* The constructor of the discriminated union schema. Its behaviour is very similar to that of the normal z.union() constructor.
|
|
2216
|
-
* However, it only allows a union of objects, all of which need to share a discriminator property. This property must
|
|
2217
|
-
* have a different value for each object in the union.
|
|
2218
|
-
* @param discriminator the name of the discriminator property
|
|
2219
|
-
* @param types an array of object schemas
|
|
2220
|
-
* @param params
|
|
2221
|
-
*/
|
|
2222
|
-
static create(e, t, a) {
|
|
2223
|
-
const s = /* @__PURE__ */ new Map();
|
|
2224
|
-
for (const n of t) {
|
|
2225
|
-
const i = re(n.shape[e]);
|
|
2226
|
-
if (!i.length)
|
|
2227
|
-
throw new Error(`A discriminator value for key \`${e}\` could not be extracted from all schema options`);
|
|
2228
|
-
for (const o of i) {
|
|
2229
|
-
if (s.has(o))
|
|
2230
|
-
throw new Error(`Discriminator property ${String(e)} has duplicate value ${String(o)}`);
|
|
2231
|
-
s.set(o, n);
|
|
2232
|
-
}
|
|
2233
|
-
}
|
|
2234
|
-
return new nt({
|
|
2235
|
-
typeName: v.ZodDiscriminatedUnion,
|
|
2236
|
-
discriminator: e,
|
|
2237
|
-
options: t,
|
|
2238
|
-
optionsMap: s,
|
|
2239
|
-
..._(a)
|
|
2240
|
-
});
|
|
2241
|
-
}
|
|
2242
|
-
}
|
|
2243
|
-
function gt(r, e) {
|
|
2244
|
-
const t = ne(r), a = ne(e);
|
|
2245
|
-
if (r === e)
|
|
2246
|
-
return { valid: !0, data: r };
|
|
2247
|
-
if (t === m.object && a === m.object) {
|
|
2248
|
-
const s = w.objectKeys(e), n = w.objectKeys(r).filter((o) => s.indexOf(o) !== -1), i = { ...r, ...e };
|
|
2249
|
-
for (const o of n) {
|
|
2250
|
-
const d = gt(r[o], e[o]);
|
|
2251
|
-
if (!d.valid)
|
|
2252
|
-
return { valid: !1 };
|
|
2253
|
-
i[o] = d.data;
|
|
2254
|
-
}
|
|
2255
|
-
return { valid: !0, data: i };
|
|
2256
|
-
} else if (t === m.array && a === m.array) {
|
|
2257
|
-
if (r.length !== e.length)
|
|
2258
|
-
return { valid: !1 };
|
|
2259
|
-
const s = [];
|
|
2260
|
-
for (let n = 0; n < r.length; n++) {
|
|
2261
|
-
const i = r[n], o = e[n], d = gt(i, o);
|
|
2262
|
-
if (!d.valid)
|
|
2263
|
-
return { valid: !1 };
|
|
2264
|
-
s.push(d.data);
|
|
2265
|
-
}
|
|
2266
|
-
return { valid: !0, data: s };
|
|
2267
|
-
} else return t === m.date && a === m.date && +r == +e ? { valid: !0, data: r } : { valid: !1 };
|
|
2268
|
-
}
|
|
2269
|
-
class Le extends b {
|
|
2270
|
-
_parse(e) {
|
|
2271
|
-
const { status: t, ctx: a } = this._processInputParams(e), s = (n, i) => {
|
|
2272
|
-
if (pt(n) || pt(i))
|
|
2273
|
-
return g;
|
|
2274
|
-
const o = gt(n.value, i.value);
|
|
2275
|
-
return o.valid ? ((vt(n) || vt(i)) && t.dirty(), { status: t.value, value: o.data }) : (f(a, {
|
|
2276
|
-
code: u.invalid_intersection_types
|
|
2277
|
-
}), g);
|
|
2278
|
-
};
|
|
2279
|
-
return a.common.async ? Promise.all([
|
|
2280
|
-
this._def.left._parseAsync({
|
|
2281
|
-
data: a.data,
|
|
2282
|
-
path: a.path,
|
|
2283
|
-
parent: a
|
|
2284
|
-
}),
|
|
2285
|
-
this._def.right._parseAsync({
|
|
2286
|
-
data: a.data,
|
|
2287
|
-
path: a.path,
|
|
2288
|
-
parent: a
|
|
2289
|
-
})
|
|
2290
|
-
]).then(([n, i]) => s(n, i)) : s(this._def.left._parseSync({
|
|
2291
|
-
data: a.data,
|
|
2292
|
-
path: a.path,
|
|
2293
|
-
parent: a
|
|
2294
|
-
}), this._def.right._parseSync({
|
|
2295
|
-
data: a.data,
|
|
2296
|
-
path: a.path,
|
|
2297
|
-
parent: a
|
|
2298
|
-
}));
|
|
2299
|
-
}
|
|
2300
|
-
}
|
|
2301
|
-
Le.create = (r, e, t) => new Le({
|
|
2302
|
-
left: r,
|
|
2303
|
-
right: e,
|
|
2304
|
-
typeName: v.ZodIntersection,
|
|
2305
|
-
..._(t)
|
|
2306
|
-
});
|
|
2307
|
-
class K extends b {
|
|
2308
|
-
_parse(e) {
|
|
2309
|
-
const { status: t, ctx: a } = this._processInputParams(e);
|
|
2310
|
-
if (a.parsedType !== m.array)
|
|
2311
|
-
return f(a, {
|
|
2312
|
-
code: u.invalid_type,
|
|
2313
|
-
expected: m.array,
|
|
2314
|
-
received: a.parsedType
|
|
2315
|
-
}), g;
|
|
2316
|
-
if (a.data.length < this._def.items.length)
|
|
2317
|
-
return f(a, {
|
|
2318
|
-
code: u.too_small,
|
|
2319
|
-
minimum: this._def.items.length,
|
|
2320
|
-
inclusive: !0,
|
|
2321
|
-
exact: !1,
|
|
2322
|
-
type: "array"
|
|
2323
|
-
}), g;
|
|
2324
|
-
!this._def.rest && a.data.length > this._def.items.length && (f(a, {
|
|
2325
|
-
code: u.too_big,
|
|
2326
|
-
maximum: this._def.items.length,
|
|
2327
|
-
inclusive: !0,
|
|
2328
|
-
exact: !1,
|
|
2329
|
-
type: "array"
|
|
2330
|
-
}), t.dirty());
|
|
2331
|
-
const n = [...a.data].map((i, o) => {
|
|
2332
|
-
const d = this._def.items[o] || this._def.rest;
|
|
2333
|
-
return d ? d._parse(new Y(a, i, a.path, o)) : null;
|
|
2334
|
-
}).filter((i) => !!i);
|
|
2335
|
-
return a.common.async ? Promise.all(n).then((i) => L.mergeArray(t, i)) : L.mergeArray(t, n);
|
|
2336
|
-
}
|
|
2337
|
-
get items() {
|
|
2338
|
-
return this._def.items;
|
|
2339
|
-
}
|
|
2340
|
-
rest(e) {
|
|
2341
|
-
return new K({
|
|
2342
|
-
...this._def,
|
|
2343
|
-
rest: e
|
|
2344
|
-
});
|
|
2345
|
-
}
|
|
2346
|
-
}
|
|
2347
|
-
K.create = (r, e) => {
|
|
2348
|
-
if (!Array.isArray(r))
|
|
2349
|
-
throw new Error("You must pass an array of schemas to z.tuple([ ... ])");
|
|
2350
|
-
return new K({
|
|
2351
|
-
items: r,
|
|
2352
|
-
typeName: v.ZodTuple,
|
|
2353
|
-
rest: null,
|
|
2354
|
-
..._(e)
|
|
2355
|
-
});
|
|
2356
|
-
};
|
|
2357
|
-
class Fe extends b {
|
|
2358
|
-
get keySchema() {
|
|
2359
|
-
return this._def.keyType;
|
|
2360
|
-
}
|
|
2361
|
-
get valueSchema() {
|
|
2362
|
-
return this._def.valueType;
|
|
2363
|
-
}
|
|
2364
|
-
_parse(e) {
|
|
2365
|
-
const { status: t, ctx: a } = this._processInputParams(e);
|
|
2366
|
-
if (a.parsedType !== m.object)
|
|
2367
|
-
return f(a, {
|
|
2368
|
-
code: u.invalid_type,
|
|
2369
|
-
expected: m.object,
|
|
2370
|
-
received: a.parsedType
|
|
2371
|
-
}), g;
|
|
2372
|
-
const s = [], n = this._def.keyType, i = this._def.valueType;
|
|
2373
|
-
for (const o in a.data)
|
|
2374
|
-
s.push({
|
|
2375
|
-
key: n._parse(new Y(a, o, a.path, o)),
|
|
2376
|
-
value: i._parse(new Y(a, a.data[o], a.path, o)),
|
|
2377
|
-
alwaysSet: o in a.data
|
|
2378
|
-
});
|
|
2379
|
-
return a.common.async ? L.mergeObjectAsync(t, s) : L.mergeObjectSync(t, s);
|
|
2380
|
-
}
|
|
2381
|
-
get element() {
|
|
2382
|
-
return this._def.valueType;
|
|
2383
|
-
}
|
|
2384
|
-
static create(e, t, a) {
|
|
2385
|
-
return t instanceof b ? new Fe({
|
|
2386
|
-
keyType: e,
|
|
2387
|
-
valueType: t,
|
|
2388
|
-
typeName: v.ZodRecord,
|
|
2389
|
-
..._(a)
|
|
2390
|
-
}) : new Fe({
|
|
2391
|
-
keyType: q.create(),
|
|
2392
|
-
valueType: e,
|
|
2393
|
-
typeName: v.ZodRecord,
|
|
2394
|
-
..._(t)
|
|
2395
|
-
});
|
|
2396
|
-
}
|
|
2397
|
-
}
|
|
2398
|
-
class tt extends b {
|
|
2399
|
-
get keySchema() {
|
|
2400
|
-
return this._def.keyType;
|
|
2401
|
-
}
|
|
2402
|
-
get valueSchema() {
|
|
2403
|
-
return this._def.valueType;
|
|
2404
|
-
}
|
|
2405
|
-
_parse(e) {
|
|
2406
|
-
const { status: t, ctx: a } = this._processInputParams(e);
|
|
2407
|
-
if (a.parsedType !== m.map)
|
|
2408
|
-
return f(a, {
|
|
2409
|
-
code: u.invalid_type,
|
|
2410
|
-
expected: m.map,
|
|
2411
|
-
received: a.parsedType
|
|
2412
|
-
}), g;
|
|
2413
|
-
const s = this._def.keyType, n = this._def.valueType, i = [...a.data.entries()].map(([o, d], l) => ({
|
|
2414
|
-
key: s._parse(new Y(a, o, a.path, [l, "key"])),
|
|
2415
|
-
value: n._parse(new Y(a, d, a.path, [l, "value"]))
|
|
2416
|
-
}));
|
|
2417
|
-
if (a.common.async) {
|
|
2418
|
-
const o = /* @__PURE__ */ new Map();
|
|
2419
|
-
return Promise.resolve().then(async () => {
|
|
2420
|
-
for (const d of i) {
|
|
2421
|
-
const l = await d.key, h = await d.value;
|
|
2422
|
-
if (l.status === "aborted" || h.status === "aborted")
|
|
2423
|
-
return g;
|
|
2424
|
-
(l.status === "dirty" || h.status === "dirty") && t.dirty(), o.set(l.value, h.value);
|
|
2425
|
-
}
|
|
2426
|
-
return { status: t.value, value: o };
|
|
2427
|
-
});
|
|
2428
|
-
} else {
|
|
2429
|
-
const o = /* @__PURE__ */ new Map();
|
|
2430
|
-
for (const d of i) {
|
|
2431
|
-
const l = d.key, h = d.value;
|
|
2432
|
-
if (l.status === "aborted" || h.status === "aborted")
|
|
2433
|
-
return g;
|
|
2434
|
-
(l.status === "dirty" || h.status === "dirty") && t.dirty(), o.set(l.value, h.value);
|
|
2435
|
-
}
|
|
2436
|
-
return { status: t.value, value: o };
|
|
2437
|
-
}
|
|
2438
|
-
}
|
|
2439
|
-
}
|
|
2440
|
-
tt.create = (r, e, t) => new tt({
|
|
2441
|
-
valueType: e,
|
|
2442
|
-
keyType: r,
|
|
2443
|
-
typeName: v.ZodMap,
|
|
2444
|
-
..._(t)
|
|
2445
|
-
});
|
|
2446
|
-
class ye extends b {
|
|
2447
|
-
_parse(e) {
|
|
2448
|
-
const { status: t, ctx: a } = this._processInputParams(e);
|
|
2449
|
-
if (a.parsedType !== m.set)
|
|
2450
|
-
return f(a, {
|
|
2451
|
-
code: u.invalid_type,
|
|
2452
|
-
expected: m.set,
|
|
2453
|
-
received: a.parsedType
|
|
2454
|
-
}), g;
|
|
2455
|
-
const s = this._def;
|
|
2456
|
-
s.minSize !== null && a.data.size < s.minSize.value && (f(a, {
|
|
2457
|
-
code: u.too_small,
|
|
2458
|
-
minimum: s.minSize.value,
|
|
2459
|
-
type: "set",
|
|
2460
|
-
inclusive: !0,
|
|
2461
|
-
exact: !1,
|
|
2462
|
-
message: s.minSize.message
|
|
2463
|
-
}), t.dirty()), s.maxSize !== null && a.data.size > s.maxSize.value && (f(a, {
|
|
2464
|
-
code: u.too_big,
|
|
2465
|
-
maximum: s.maxSize.value,
|
|
2466
|
-
type: "set",
|
|
2467
|
-
inclusive: !0,
|
|
2468
|
-
exact: !1,
|
|
2469
|
-
message: s.maxSize.message
|
|
2470
|
-
}), t.dirty());
|
|
2471
|
-
const n = this._def.valueType;
|
|
2472
|
-
function i(d) {
|
|
2473
|
-
const l = /* @__PURE__ */ new Set();
|
|
2474
|
-
for (const h of d) {
|
|
2475
|
-
if (h.status === "aborted")
|
|
2476
|
-
return g;
|
|
2477
|
-
h.status === "dirty" && t.dirty(), l.add(h.value);
|
|
2478
|
-
}
|
|
2479
|
-
return { status: t.value, value: l };
|
|
2480
|
-
}
|
|
2481
|
-
const o = [...a.data.values()].map((d, l) => n._parse(new Y(a, d, a.path, l)));
|
|
2482
|
-
return a.common.async ? Promise.all(o).then((d) => i(d)) : i(o);
|
|
2483
|
-
}
|
|
2484
|
-
min(e, t) {
|
|
2485
|
-
return new ye({
|
|
2486
|
-
...this._def,
|
|
2487
|
-
minSize: { value: e, message: p.toString(t) }
|
|
2488
|
-
});
|
|
2489
|
-
}
|
|
2490
|
-
max(e, t) {
|
|
2491
|
-
return new ye({
|
|
2492
|
-
...this._def,
|
|
2493
|
-
maxSize: { value: e, message: p.toString(t) }
|
|
2494
|
-
});
|
|
2495
|
-
}
|
|
2496
|
-
size(e, t) {
|
|
2497
|
-
return this.min(e, t).max(e, t);
|
|
2498
|
-
}
|
|
2499
|
-
nonempty(e) {
|
|
2500
|
-
return this.min(1, e);
|
|
2501
|
-
}
|
|
2502
|
-
}
|
|
2503
|
-
ye.create = (r, e) => new ye({
|
|
2504
|
-
valueType: r,
|
|
2505
|
-
minSize: null,
|
|
2506
|
-
maxSize: null,
|
|
2507
|
-
typeName: v.ZodSet,
|
|
2508
|
-
..._(e)
|
|
2509
|
-
});
|
|
2510
|
-
class Ne extends b {
|
|
2511
|
-
constructor() {
|
|
2512
|
-
super(...arguments), this.validate = this.implement;
|
|
2513
|
-
}
|
|
2514
|
-
_parse(e) {
|
|
2515
|
-
const { ctx: t } = this._processInputParams(e);
|
|
2516
|
-
if (t.parsedType !== m.function)
|
|
2517
|
-
return f(t, {
|
|
2518
|
-
code: u.invalid_type,
|
|
2519
|
-
expected: m.function,
|
|
2520
|
-
received: t.parsedType
|
|
2521
|
-
}), g;
|
|
2522
|
-
function a(o, d) {
|
|
2523
|
-
return Ke({
|
|
2524
|
-
data: o,
|
|
2525
|
-
path: t.path,
|
|
2526
|
-
errorMaps: [
|
|
2527
|
-
t.common.contextualErrorMap,
|
|
2528
|
-
t.schemaErrorMap,
|
|
2529
|
-
Ye(),
|
|
2530
|
-
Te
|
|
2531
|
-
].filter((l) => !!l),
|
|
2532
|
-
issueData: {
|
|
2533
|
-
code: u.invalid_arguments,
|
|
2534
|
-
argumentsError: d
|
|
2535
|
-
}
|
|
2536
|
-
});
|
|
2537
|
-
}
|
|
2538
|
-
function s(o, d) {
|
|
2539
|
-
return Ke({
|
|
2540
|
-
data: o,
|
|
2541
|
-
path: t.path,
|
|
2542
|
-
errorMaps: [
|
|
2543
|
-
t.common.contextualErrorMap,
|
|
2544
|
-
t.schemaErrorMap,
|
|
2545
|
-
Ye(),
|
|
2546
|
-
Te
|
|
2547
|
-
].filter((l) => !!l),
|
|
2548
|
-
issueData: {
|
|
2549
|
-
code: u.invalid_return_type,
|
|
2550
|
-
returnTypeError: d
|
|
2551
|
-
}
|
|
2552
|
-
});
|
|
2553
|
-
}
|
|
2554
|
-
const n = { errorMap: t.common.contextualErrorMap }, i = t.data;
|
|
2555
|
-
if (this._def.returns instanceof Ae) {
|
|
2556
|
-
const o = this;
|
|
2557
|
-
return F(async function(...d) {
|
|
2558
|
-
const l = new B([]), h = await o._def.args.parseAsync(d, n).catch((P) => {
|
|
2559
|
-
throw l.addIssue(a(d, P)), l;
|
|
2560
|
-
}), x = await Reflect.apply(i, this, h);
|
|
2561
|
-
return await o._def.returns._def.type.parseAsync(x, n).catch((P) => {
|
|
2562
|
-
throw l.addIssue(s(x, P)), l;
|
|
2563
|
-
});
|
|
2564
|
-
});
|
|
2565
|
-
} else {
|
|
2566
|
-
const o = this;
|
|
2567
|
-
return F(function(...d) {
|
|
2568
|
-
const l = o._def.args.safeParse(d, n);
|
|
2569
|
-
if (!l.success)
|
|
2570
|
-
throw new B([a(d, l.error)]);
|
|
2571
|
-
const h = Reflect.apply(i, this, l.data), x = o._def.returns.safeParse(h, n);
|
|
2572
|
-
if (!x.success)
|
|
2573
|
-
throw new B([s(h, x.error)]);
|
|
2574
|
-
return x.data;
|
|
2575
|
-
});
|
|
2576
|
-
}
|
|
2577
|
-
}
|
|
2578
|
-
parameters() {
|
|
2579
|
-
return this._def.args;
|
|
2580
|
-
}
|
|
2581
|
-
returnType() {
|
|
2582
|
-
return this._def.returns;
|
|
2583
|
-
}
|
|
2584
|
-
args(...e) {
|
|
2585
|
-
return new Ne({
|
|
2586
|
-
...this._def,
|
|
2587
|
-
args: K.create(e).rest(me.create())
|
|
2588
|
-
});
|
|
2589
|
-
}
|
|
2590
|
-
returns(e) {
|
|
2591
|
-
return new Ne({
|
|
2592
|
-
...this._def,
|
|
2593
|
-
returns: e
|
|
2594
|
-
});
|
|
2595
|
-
}
|
|
2596
|
-
implement(e) {
|
|
2597
|
-
return this.parse(e);
|
|
2598
|
-
}
|
|
2599
|
-
strictImplement(e) {
|
|
2600
|
-
return this.parse(e);
|
|
2601
|
-
}
|
|
2602
|
-
static create(e, t, a) {
|
|
2603
|
-
return new Ne({
|
|
2604
|
-
args: e || K.create([]).rest(me.create()),
|
|
2605
|
-
returns: t || me.create(),
|
|
2606
|
-
typeName: v.ZodFunction,
|
|
2607
|
-
..._(a)
|
|
2608
|
-
});
|
|
2609
|
-
}
|
|
2610
|
-
}
|
|
2611
|
-
class De extends b {
|
|
2612
|
-
get schema() {
|
|
2613
|
-
return this._def.getter();
|
|
2614
|
-
}
|
|
2615
|
-
_parse(e) {
|
|
2616
|
-
const { ctx: t } = this._processInputParams(e);
|
|
2617
|
-
return this._def.getter()._parse({ data: t.data, path: t.path, parent: t });
|
|
2618
|
-
}
|
|
2619
|
-
}
|
|
2620
|
-
De.create = (r, e) => new De({
|
|
2621
|
-
getter: r,
|
|
2622
|
-
typeName: v.ZodLazy,
|
|
2623
|
-
..._(e)
|
|
2624
|
-
});
|
|
2625
|
-
class Ue extends b {
|
|
2626
|
-
_parse(e) {
|
|
2627
|
-
if (e.data !== this._def.value) {
|
|
2628
|
-
const t = this._getOrReturnCtx(e);
|
|
2629
|
-
return f(t, {
|
|
2630
|
-
received: t.data,
|
|
2631
|
-
code: u.invalid_literal,
|
|
2632
|
-
expected: this._def.value
|
|
2633
|
-
}), g;
|
|
2634
|
-
}
|
|
2635
|
-
return { status: "valid", value: e.data };
|
|
2636
|
-
}
|
|
2637
|
-
get value() {
|
|
2638
|
-
return this._def.value;
|
|
2639
|
-
}
|
|
2640
|
-
}
|
|
2641
|
-
Ue.create = (r, e) => new Ue({
|
|
2642
|
-
value: r,
|
|
2643
|
-
typeName: v.ZodLiteral,
|
|
2644
|
-
..._(e)
|
|
2645
|
-
});
|
|
2646
|
-
function ar(r, e) {
|
|
2647
|
-
return new ue({
|
|
2648
|
-
values: r,
|
|
2649
|
-
typeName: v.ZodEnum,
|
|
2650
|
-
..._(e)
|
|
2651
|
-
});
|
|
2652
|
-
}
|
|
2653
|
-
class ue extends b {
|
|
2654
|
-
constructor() {
|
|
2655
|
-
super(...arguments), Oe.set(this, void 0);
|
|
2656
|
-
}
|
|
2657
|
-
_parse(e) {
|
|
2658
|
-
if (typeof e.data != "string") {
|
|
2659
|
-
const t = this._getOrReturnCtx(e), a = this._def.values;
|
|
2660
|
-
return f(t, {
|
|
2661
|
-
expected: w.joinValues(a),
|
|
2662
|
-
received: t.parsedType,
|
|
2663
|
-
code: u.invalid_type
|
|
2664
|
-
}), g;
|
|
2665
|
-
}
|
|
2666
|
-
if (Qe(this, Oe) || Xt(this, Oe, new Set(this._def.values)), !Qe(this, Oe).has(e.data)) {
|
|
2667
|
-
const t = this._getOrReturnCtx(e), a = this._def.values;
|
|
2668
|
-
return f(t, {
|
|
2669
|
-
received: t.data,
|
|
2670
|
-
code: u.invalid_enum_value,
|
|
2671
|
-
options: a
|
|
2672
|
-
}), g;
|
|
2673
|
-
}
|
|
2674
|
-
return F(e.data);
|
|
2675
|
-
}
|
|
2676
|
-
get options() {
|
|
2677
|
-
return this._def.values;
|
|
2678
|
-
}
|
|
2679
|
-
get enum() {
|
|
2680
|
-
const e = {};
|
|
2681
|
-
for (const t of this._def.values)
|
|
2682
|
-
e[t] = t;
|
|
2683
|
-
return e;
|
|
2684
|
-
}
|
|
2685
|
-
get Values() {
|
|
2686
|
-
const e = {};
|
|
2687
|
-
for (const t of this._def.values)
|
|
2688
|
-
e[t] = t;
|
|
2689
|
-
return e;
|
|
2690
|
-
}
|
|
2691
|
-
get Enum() {
|
|
2692
|
-
const e = {};
|
|
2693
|
-
for (const t of this._def.values)
|
|
2694
|
-
e[t] = t;
|
|
2695
|
-
return e;
|
|
2696
|
-
}
|
|
2697
|
-
extract(e, t = this._def) {
|
|
2698
|
-
return ue.create(e, {
|
|
2699
|
-
...this._def,
|
|
2700
|
-
...t
|
|
2701
|
-
});
|
|
2702
|
-
}
|
|
2703
|
-
exclude(e, t = this._def) {
|
|
2704
|
-
return ue.create(this.options.filter((a) => !e.includes(a)), {
|
|
2705
|
-
...this._def,
|
|
2706
|
-
...t
|
|
2707
|
-
});
|
|
2708
|
-
}
|
|
2709
|
-
}
|
|
2710
|
-
Oe = /* @__PURE__ */ new WeakMap();
|
|
2711
|
-
ue.create = ar;
|
|
2712
|
-
class Be extends b {
|
|
2713
|
-
constructor() {
|
|
2714
|
-
super(...arguments), Ie.set(this, void 0);
|
|
2715
|
-
}
|
|
2716
|
-
_parse(e) {
|
|
2717
|
-
const t = w.getValidEnumValues(this._def.values), a = this._getOrReturnCtx(e);
|
|
2718
|
-
if (a.parsedType !== m.string && a.parsedType !== m.number) {
|
|
2719
|
-
const s = w.objectValues(t);
|
|
2720
|
-
return f(a, {
|
|
2721
|
-
expected: w.joinValues(s),
|
|
2722
|
-
received: a.parsedType,
|
|
2723
|
-
code: u.invalid_type
|
|
2724
|
-
}), g;
|
|
2725
|
-
}
|
|
2726
|
-
if (Qe(this, Ie) || Xt(this, Ie, new Set(w.getValidEnumValues(this._def.values))), !Qe(this, Ie).has(e.data)) {
|
|
2727
|
-
const s = w.objectValues(t);
|
|
2728
|
-
return f(a, {
|
|
2729
|
-
received: a.data,
|
|
2730
|
-
code: u.invalid_enum_value,
|
|
2731
|
-
options: s
|
|
2732
|
-
}), g;
|
|
2733
|
-
}
|
|
2734
|
-
return F(e.data);
|
|
2735
|
-
}
|
|
2736
|
-
get enum() {
|
|
2737
|
-
return this._def.values;
|
|
2738
|
-
}
|
|
2739
|
-
}
|
|
2740
|
-
Ie = /* @__PURE__ */ new WeakMap();
|
|
2741
|
-
Be.create = (r, e) => new Be({
|
|
2742
|
-
values: r,
|
|
2743
|
-
typeName: v.ZodNativeEnum,
|
|
2744
|
-
..._(e)
|
|
2745
|
-
});
|
|
2746
|
-
class Ae extends b {
|
|
2747
|
-
unwrap() {
|
|
2748
|
-
return this._def.type;
|
|
2749
|
-
}
|
|
2750
|
-
_parse(e) {
|
|
2751
|
-
const { ctx: t } = this._processInputParams(e);
|
|
2752
|
-
if (t.parsedType !== m.promise && t.common.async === !1)
|
|
2753
|
-
return f(t, {
|
|
2754
|
-
code: u.invalid_type,
|
|
2755
|
-
expected: m.promise,
|
|
2756
|
-
received: t.parsedType
|
|
2757
|
-
}), g;
|
|
2758
|
-
const a = t.parsedType === m.promise ? t.data : Promise.resolve(t.data);
|
|
2759
|
-
return F(a.then((s) => this._def.type.parseAsync(s, {
|
|
2760
|
-
path: t.path,
|
|
2761
|
-
errorMap: t.common.contextualErrorMap
|
|
2762
|
-
})));
|
|
2763
|
-
}
|
|
2764
|
-
}
|
|
2765
|
-
Ae.create = (r, e) => new Ae({
|
|
2766
|
-
type: r,
|
|
2767
|
-
typeName: v.ZodPromise,
|
|
2768
|
-
..._(e)
|
|
2769
|
-
});
|
|
2770
|
-
class J extends b {
|
|
2771
|
-
innerType() {
|
|
2772
|
-
return this._def.schema;
|
|
2773
|
-
}
|
|
2774
|
-
sourceType() {
|
|
2775
|
-
return this._def.schema._def.typeName === v.ZodEffects ? this._def.schema.sourceType() : this._def.schema;
|
|
2776
|
-
}
|
|
2777
|
-
_parse(e) {
|
|
2778
|
-
const { status: t, ctx: a } = this._processInputParams(e), s = this._def.effect || null, n = {
|
|
2779
|
-
addIssue: (i) => {
|
|
2780
|
-
f(a, i), i.fatal ? t.abort() : t.dirty();
|
|
2781
|
-
},
|
|
2782
|
-
get path() {
|
|
2783
|
-
return a.path;
|
|
2784
|
-
}
|
|
2785
|
-
};
|
|
2786
|
-
if (n.addIssue = n.addIssue.bind(n), s.type === "preprocess") {
|
|
2787
|
-
const i = s.transform(a.data, n);
|
|
2788
|
-
if (a.common.async)
|
|
2789
|
-
return Promise.resolve(i).then(async (o) => {
|
|
2790
|
-
if (t.value === "aborted")
|
|
2791
|
-
return g;
|
|
2792
|
-
const d = await this._def.schema._parseAsync({
|
|
2793
|
-
data: o,
|
|
2794
|
-
path: a.path,
|
|
2795
|
-
parent: a
|
|
2796
|
-
});
|
|
2797
|
-
return d.status === "aborted" ? g : d.status === "dirty" || t.value === "dirty" ? ke(d.value) : d;
|
|
2798
|
-
});
|
|
2799
|
-
{
|
|
2800
|
-
if (t.value === "aborted")
|
|
2801
|
-
return g;
|
|
2802
|
-
const o = this._def.schema._parseSync({
|
|
2803
|
-
data: i,
|
|
2804
|
-
path: a.path,
|
|
2805
|
-
parent: a
|
|
2806
|
-
});
|
|
2807
|
-
return o.status === "aborted" ? g : o.status === "dirty" || t.value === "dirty" ? ke(o.value) : o;
|
|
2808
|
-
}
|
|
2809
|
-
}
|
|
2810
|
-
if (s.type === "refinement") {
|
|
2811
|
-
const i = (o) => {
|
|
2812
|
-
const d = s.refinement(o, n);
|
|
2813
|
-
if (a.common.async)
|
|
2814
|
-
return Promise.resolve(d);
|
|
2815
|
-
if (d instanceof Promise)
|
|
2816
|
-
throw new Error("Async refinement encountered during synchronous parse operation. Use .parseAsync instead.");
|
|
2817
|
-
return o;
|
|
2818
|
-
};
|
|
2819
|
-
if (a.common.async === !1) {
|
|
2820
|
-
const o = this._def.schema._parseSync({
|
|
2821
|
-
data: a.data,
|
|
2822
|
-
path: a.path,
|
|
2823
|
-
parent: a
|
|
2824
|
-
});
|
|
2825
|
-
return o.status === "aborted" ? g : (o.status === "dirty" && t.dirty(), i(o.value), { status: t.value, value: o.value });
|
|
2826
|
-
} else
|
|
2827
|
-
return this._def.schema._parseAsync({ data: a.data, path: a.path, parent: a }).then((o) => o.status === "aborted" ? g : (o.status === "dirty" && t.dirty(), i(o.value).then(() => ({ status: t.value, value: o.value }))));
|
|
2828
|
-
}
|
|
2829
|
-
if (s.type === "transform")
|
|
2830
|
-
if (a.common.async === !1) {
|
|
2831
|
-
const i = this._def.schema._parseSync({
|
|
2832
|
-
data: a.data,
|
|
2833
|
-
path: a.path,
|
|
2834
|
-
parent: a
|
|
2835
|
-
});
|
|
2836
|
-
if (!ve(i))
|
|
2837
|
-
return i;
|
|
2838
|
-
const o = s.transform(i.value, n);
|
|
2839
|
-
if (o instanceof Promise)
|
|
2840
|
-
throw new Error("Asynchronous transform encountered during synchronous parse operation. Use .parseAsync instead.");
|
|
2841
|
-
return { status: t.value, value: o };
|
|
2842
|
-
} else
|
|
2843
|
-
return this._def.schema._parseAsync({ data: a.data, path: a.path, parent: a }).then((i) => ve(i) ? Promise.resolve(s.transform(i.value, n)).then((o) => ({ status: t.value, value: o })) : i);
|
|
2844
|
-
w.assertNever(s);
|
|
2845
|
-
}
|
|
2846
|
-
}
|
|
2847
|
-
J.create = (r, e, t) => new J({
|
|
2848
|
-
schema: r,
|
|
2849
|
-
typeName: v.ZodEffects,
|
|
2850
|
-
effect: e,
|
|
2851
|
-
..._(t)
|
|
2852
|
-
});
|
|
2853
|
-
J.createWithPreprocess = (r, e, t) => new J({
|
|
2854
|
-
schema: e,
|
|
2855
|
-
effect: { type: "preprocess", transform: r },
|
|
2856
|
-
typeName: v.ZodEffects,
|
|
2857
|
-
..._(t)
|
|
2858
|
-
});
|
|
2859
|
-
class H extends b {
|
|
2860
|
-
_parse(e) {
|
|
2861
|
-
return this._getType(e) === m.undefined ? F(void 0) : this._def.innerType._parse(e);
|
|
2862
|
-
}
|
|
2863
|
-
unwrap() {
|
|
2864
|
-
return this._def.innerType;
|
|
2865
|
-
}
|
|
2866
|
-
}
|
|
2867
|
-
H.create = (r, e) => new H({
|
|
2868
|
-
innerType: r,
|
|
2869
|
-
typeName: v.ZodOptional,
|
|
2870
|
-
..._(e)
|
|
2871
|
-
});
|
|
2872
|
-
class fe extends b {
|
|
2873
|
-
_parse(e) {
|
|
2874
|
-
return this._getType(e) === m.null ? F(null) : this._def.innerType._parse(e);
|
|
2875
|
-
}
|
|
2876
|
-
unwrap() {
|
|
2877
|
-
return this._def.innerType;
|
|
2878
|
-
}
|
|
2879
|
-
}
|
|
2880
|
-
fe.create = (r, e) => new fe({
|
|
2881
|
-
innerType: r,
|
|
2882
|
-
typeName: v.ZodNullable,
|
|
2883
|
-
..._(e)
|
|
2884
|
-
});
|
|
2885
|
-
class We extends b {
|
|
2886
|
-
_parse(e) {
|
|
2887
|
-
const { ctx: t } = this._processInputParams(e);
|
|
2888
|
-
let a = t.data;
|
|
2889
|
-
return t.parsedType === m.undefined && (a = this._def.defaultValue()), this._def.innerType._parse({
|
|
2890
|
-
data: a,
|
|
2891
|
-
path: t.path,
|
|
2892
|
-
parent: t
|
|
2893
|
-
});
|
|
2894
|
-
}
|
|
2895
|
-
removeDefault() {
|
|
2896
|
-
return this._def.innerType;
|
|
2897
|
-
}
|
|
2898
|
-
}
|
|
2899
|
-
We.create = (r, e) => new We({
|
|
2900
|
-
innerType: r,
|
|
2901
|
-
typeName: v.ZodDefault,
|
|
2902
|
-
defaultValue: typeof e.default == "function" ? e.default : () => e.default,
|
|
2903
|
-
..._(e)
|
|
2904
|
-
});
|
|
2905
|
-
class qe extends b {
|
|
2906
|
-
_parse(e) {
|
|
2907
|
-
const { ctx: t } = this._processInputParams(e), a = {
|
|
2908
|
-
...t,
|
|
2909
|
-
common: {
|
|
2910
|
-
...t.common,
|
|
2911
|
-
issues: []
|
|
2912
|
-
}
|
|
2913
|
-
}, s = this._def.innerType._parse({
|
|
2914
|
-
data: a.data,
|
|
2915
|
-
path: a.path,
|
|
2916
|
-
parent: {
|
|
2917
|
-
...a
|
|
2918
|
-
}
|
|
2919
|
-
});
|
|
2920
|
-
return je(s) ? s.then((n) => ({
|
|
2921
|
-
status: "valid",
|
|
2922
|
-
value: n.status === "valid" ? n.value : this._def.catchValue({
|
|
2923
|
-
get error() {
|
|
2924
|
-
return new B(a.common.issues);
|
|
2925
|
-
},
|
|
2926
|
-
input: a.data
|
|
2927
|
-
})
|
|
2928
|
-
})) : {
|
|
2929
|
-
status: "valid",
|
|
2930
|
-
value: s.status === "valid" ? s.value : this._def.catchValue({
|
|
2931
|
-
get error() {
|
|
2932
|
-
return new B(a.common.issues);
|
|
2933
|
-
},
|
|
2934
|
-
input: a.data
|
|
2935
|
-
})
|
|
2936
|
-
};
|
|
2937
|
-
}
|
|
2938
|
-
removeCatch() {
|
|
2939
|
-
return this._def.innerType;
|
|
2940
|
-
}
|
|
2941
|
-
}
|
|
2942
|
-
qe.create = (r, e) => new qe({
|
|
2943
|
-
innerType: r,
|
|
2944
|
-
typeName: v.ZodCatch,
|
|
2945
|
-
catchValue: typeof e.catch == "function" ? e.catch : () => e.catch,
|
|
2946
|
-
..._(e)
|
|
2947
|
-
});
|
|
2948
|
-
class rt extends b {
|
|
2949
|
-
_parse(e) {
|
|
2950
|
-
if (this._getType(e) !== m.nan) {
|
|
2951
|
-
const a = this._getOrReturnCtx(e);
|
|
2952
|
-
return f(a, {
|
|
2953
|
-
code: u.invalid_type,
|
|
2954
|
-
expected: m.nan,
|
|
2955
|
-
received: a.parsedType
|
|
2956
|
-
}), g;
|
|
2957
|
-
}
|
|
2958
|
-
return { status: "valid", value: e.data };
|
|
2959
|
-
}
|
|
2960
|
-
}
|
|
2961
|
-
rt.create = (r) => new rt({
|
|
2962
|
-
typeName: v.ZodNaN,
|
|
2963
|
-
..._(r)
|
|
2964
|
-
});
|
|
2965
|
-
const $a = Symbol("zod_brand");
|
|
2966
|
-
class xt extends b {
|
|
2967
|
-
_parse(e) {
|
|
2968
|
-
const { ctx: t } = this._processInputParams(e), a = t.data;
|
|
2969
|
-
return this._def.type._parse({
|
|
2970
|
-
data: a,
|
|
2971
|
-
path: t.path,
|
|
2972
|
-
parent: t
|
|
2973
|
-
});
|
|
2974
|
-
}
|
|
2975
|
-
unwrap() {
|
|
2976
|
-
return this._def.type;
|
|
2977
|
-
}
|
|
2978
|
-
}
|
|
2979
|
-
class Je extends b {
|
|
2980
|
-
_parse(e) {
|
|
2981
|
-
const { status: t, ctx: a } = this._processInputParams(e);
|
|
2982
|
-
if (a.common.async)
|
|
2983
|
-
return (async () => {
|
|
2984
|
-
const n = await this._def.in._parseAsync({
|
|
2985
|
-
data: a.data,
|
|
2986
|
-
path: a.path,
|
|
2987
|
-
parent: a
|
|
2988
|
-
});
|
|
2989
|
-
return n.status === "aborted" ? g : n.status === "dirty" ? (t.dirty(), ke(n.value)) : this._def.out._parseAsync({
|
|
2990
|
-
data: n.value,
|
|
2991
|
-
path: a.path,
|
|
2992
|
-
parent: a
|
|
2993
|
-
});
|
|
2994
|
-
})();
|
|
2995
|
-
{
|
|
2996
|
-
const s = this._def.in._parseSync({
|
|
2997
|
-
data: a.data,
|
|
2998
|
-
path: a.path,
|
|
2999
|
-
parent: a
|
|
3000
|
-
});
|
|
3001
|
-
return s.status === "aborted" ? g : s.status === "dirty" ? (t.dirty(), {
|
|
3002
|
-
status: "dirty",
|
|
3003
|
-
value: s.value
|
|
3004
|
-
}) : this._def.out._parseSync({
|
|
3005
|
-
data: s.value,
|
|
3006
|
-
path: a.path,
|
|
3007
|
-
parent: a
|
|
3008
|
-
});
|
|
3009
|
-
}
|
|
3010
|
-
}
|
|
3011
|
-
static create(e, t) {
|
|
3012
|
-
return new Je({
|
|
3013
|
-
in: e,
|
|
3014
|
-
out: t,
|
|
3015
|
-
typeName: v.ZodPipeline
|
|
3016
|
-
});
|
|
3017
|
-
}
|
|
3018
|
-
}
|
|
3019
|
-
class Ge extends b {
|
|
3020
|
-
_parse(e) {
|
|
3021
|
-
const t = this._def.innerType._parse(e), a = (s) => (ve(s) && (s.value = Object.freeze(s.value)), s);
|
|
3022
|
-
return je(t) ? t.then((s) => a(s)) : a(t);
|
|
3023
|
-
}
|
|
3024
|
-
unwrap() {
|
|
3025
|
-
return this._def.innerType;
|
|
3026
|
-
}
|
|
3027
|
-
}
|
|
3028
|
-
Ge.create = (r, e) => new Ge({
|
|
3029
|
-
innerType: r,
|
|
3030
|
-
typeName: v.ZodReadonly,
|
|
3031
|
-
..._(e)
|
|
3032
|
-
});
|
|
3033
|
-
function Mt(r, e) {
|
|
3034
|
-
const t = typeof r == "function" ? r(e) : typeof r == "string" ? { message: r } : r;
|
|
3035
|
-
return typeof t == "string" ? { message: t } : t;
|
|
3036
|
-
}
|
|
3037
|
-
function nr(r, e = {}, t) {
|
|
3038
|
-
return r ? Ce.create().superRefine((a, s) => {
|
|
3039
|
-
var n, i;
|
|
3040
|
-
const o = r(a);
|
|
3041
|
-
if (o instanceof Promise)
|
|
3042
|
-
return o.then((d) => {
|
|
3043
|
-
var l, h;
|
|
3044
|
-
if (!d) {
|
|
3045
|
-
const x = Mt(e, a), M = (h = (l = x.fatal) !== null && l !== void 0 ? l : t) !== null && h !== void 0 ? h : !0;
|
|
3046
|
-
s.addIssue({ code: "custom", ...x, fatal: M });
|
|
3047
|
-
}
|
|
3048
|
-
});
|
|
3049
|
-
if (!o) {
|
|
3050
|
-
const d = Mt(e, a), l = (i = (n = d.fatal) !== null && n !== void 0 ? n : t) !== null && i !== void 0 ? i : !0;
|
|
3051
|
-
s.addIssue({ code: "custom", ...d, fatal: l });
|
|
3052
|
-
}
|
|
3053
|
-
}) : Ce.create();
|
|
3054
|
-
}
|
|
3055
|
-
const za = {
|
|
3056
|
-
object: E.lazycreate
|
|
3057
|
-
};
|
|
3058
|
-
var v;
|
|
3059
|
-
(function(r) {
|
|
3060
|
-
r.ZodString = "ZodString", r.ZodNumber = "ZodNumber", r.ZodNaN = "ZodNaN", r.ZodBigInt = "ZodBigInt", r.ZodBoolean = "ZodBoolean", r.ZodDate = "ZodDate", r.ZodSymbol = "ZodSymbol", r.ZodUndefined = "ZodUndefined", r.ZodNull = "ZodNull", r.ZodAny = "ZodAny", r.ZodUnknown = "ZodUnknown", r.ZodNever = "ZodNever", r.ZodVoid = "ZodVoid", r.ZodArray = "ZodArray", r.ZodObject = "ZodObject", r.ZodUnion = "ZodUnion", r.ZodDiscriminatedUnion = "ZodDiscriminatedUnion", r.ZodIntersection = "ZodIntersection", r.ZodTuple = "ZodTuple", r.ZodRecord = "ZodRecord", r.ZodMap = "ZodMap", r.ZodSet = "ZodSet", r.ZodFunction = "ZodFunction", r.ZodLazy = "ZodLazy", r.ZodLiteral = "ZodLiteral", r.ZodEnum = "ZodEnum", r.ZodEffects = "ZodEffects", r.ZodNativeEnum = "ZodNativeEnum", r.ZodOptional = "ZodOptional", r.ZodNullable = "ZodNullable", r.ZodDefault = "ZodDefault", r.ZodCatch = "ZodCatch", r.ZodPromise = "ZodPromise", r.ZodBranded = "ZodBranded", r.ZodPipeline = "ZodPipeline", r.ZodReadonly = "ZodReadonly";
|
|
3061
|
-
})(v || (v = {}));
|
|
3062
|
-
const La = (r, e = {
|
|
3063
|
-
message: `Input not instance of ${r.name}`
|
|
3064
|
-
}) => nr((t) => t instanceof r, e), sr = q.create, ir = de.create, Fa = rt.create, Da = le.create, or = Me.create, Ua = ge.create, Ba = Xe.create, Wa = Pe.create, qa = $e.create, Ga = Ce.create, Ja = me.create, Ha = se.create, Ya = et.create, Ka = G.create, Qa = E.create, Xa = E.strictCreate, en = ze.create, tn = nt.create, rn = Le.create, an = K.create, nn = Fe.create, sn = tt.create, on = ye.create, cn = Ne.create, dn = De.create, ln = Ue.create, un = ue.create, fn = Be.create, hn = Ae.create, Pt = J.create, mn = H.create, pn = fe.create, vn = J.createWithPreprocess, gn = Je.create, yn = () => sr().optional(), _n = () => ir().optional(), bn = () => or().optional(), xn = {
|
|
3065
|
-
string: (r) => q.create({ ...r, coerce: !0 }),
|
|
3066
|
-
number: (r) => de.create({ ...r, coerce: !0 }),
|
|
3067
|
-
boolean: (r) => Me.create({
|
|
3068
|
-
...r,
|
|
3069
|
-
coerce: !0
|
|
3070
|
-
}),
|
|
3071
|
-
bigint: (r) => le.create({ ...r, coerce: !0 }),
|
|
3072
|
-
date: (r) => ge.create({ ...r, coerce: !0 })
|
|
3073
|
-
}, wn = g;
|
|
3074
|
-
var y = /* @__PURE__ */ Object.freeze({
|
|
3075
|
-
__proto__: null,
|
|
3076
|
-
defaultErrorMap: Te,
|
|
3077
|
-
setErrorMap: pa,
|
|
3078
|
-
getErrorMap: Ye,
|
|
3079
|
-
makeIssue: Ke,
|
|
3080
|
-
EMPTY_PATH: va,
|
|
3081
|
-
addIssueToContext: f,
|
|
3082
|
-
ParseStatus: L,
|
|
3083
|
-
INVALID: g,
|
|
3084
|
-
DIRTY: ke,
|
|
3085
|
-
OK: F,
|
|
3086
|
-
isAborted: pt,
|
|
3087
|
-
isDirty: vt,
|
|
3088
|
-
isValid: ve,
|
|
3089
|
-
isAsync: je,
|
|
3090
|
-
get util() {
|
|
3091
|
-
return w;
|
|
3092
|
-
},
|
|
3093
|
-
get objectUtil() {
|
|
3094
|
-
return mt;
|
|
3095
|
-
},
|
|
3096
|
-
ZodParsedType: m,
|
|
3097
|
-
getParsedType: ne,
|
|
3098
|
-
ZodType: b,
|
|
3099
|
-
datetimeRegex: rr,
|
|
3100
|
-
ZodString: q,
|
|
3101
|
-
ZodNumber: de,
|
|
3102
|
-
ZodBigInt: le,
|
|
3103
|
-
ZodBoolean: Me,
|
|
3104
|
-
ZodDate: ge,
|
|
3105
|
-
ZodSymbol: Xe,
|
|
3106
|
-
ZodUndefined: Pe,
|
|
3107
|
-
ZodNull: $e,
|
|
3108
|
-
ZodAny: Ce,
|
|
3109
|
-
ZodUnknown: me,
|
|
3110
|
-
ZodNever: se,
|
|
3111
|
-
ZodVoid: et,
|
|
3112
|
-
ZodArray: G,
|
|
3113
|
-
ZodObject: E,
|
|
3114
|
-
ZodUnion: ze,
|
|
3115
|
-
ZodDiscriminatedUnion: nt,
|
|
3116
|
-
ZodIntersection: Le,
|
|
3117
|
-
ZodTuple: K,
|
|
3118
|
-
ZodRecord: Fe,
|
|
3119
|
-
ZodMap: tt,
|
|
3120
|
-
ZodSet: ye,
|
|
3121
|
-
ZodFunction: Ne,
|
|
3122
|
-
ZodLazy: De,
|
|
3123
|
-
ZodLiteral: Ue,
|
|
3124
|
-
ZodEnum: ue,
|
|
3125
|
-
ZodNativeEnum: Be,
|
|
3126
|
-
ZodPromise: Ae,
|
|
3127
|
-
ZodEffects: J,
|
|
3128
|
-
ZodTransformer: J,
|
|
3129
|
-
ZodOptional: H,
|
|
3130
|
-
ZodNullable: fe,
|
|
3131
|
-
ZodDefault: We,
|
|
3132
|
-
ZodCatch: qe,
|
|
3133
|
-
ZodNaN: rt,
|
|
3134
|
-
BRAND: $a,
|
|
3135
|
-
ZodBranded: xt,
|
|
3136
|
-
ZodPipeline: Je,
|
|
3137
|
-
ZodReadonly: Ge,
|
|
3138
|
-
custom: nr,
|
|
3139
|
-
Schema: b,
|
|
3140
|
-
ZodSchema: b,
|
|
3141
|
-
late: za,
|
|
3142
|
-
get ZodFirstPartyTypeKind() {
|
|
3143
|
-
return v;
|
|
3144
|
-
},
|
|
3145
|
-
coerce: xn,
|
|
3146
|
-
any: Ga,
|
|
3147
|
-
array: Ka,
|
|
3148
|
-
bigint: Da,
|
|
3149
|
-
boolean: or,
|
|
3150
|
-
date: Ua,
|
|
3151
|
-
discriminatedUnion: tn,
|
|
3152
|
-
effect: Pt,
|
|
3153
|
-
enum: un,
|
|
3154
|
-
function: cn,
|
|
3155
|
-
instanceof: La,
|
|
3156
|
-
intersection: rn,
|
|
3157
|
-
lazy: dn,
|
|
3158
|
-
literal: ln,
|
|
3159
|
-
map: sn,
|
|
3160
|
-
nan: Fa,
|
|
3161
|
-
nativeEnum: fn,
|
|
3162
|
-
never: Ha,
|
|
3163
|
-
null: qa,
|
|
3164
|
-
nullable: pn,
|
|
3165
|
-
number: ir,
|
|
3166
|
-
object: Qa,
|
|
3167
|
-
oboolean: bn,
|
|
3168
|
-
onumber: _n,
|
|
3169
|
-
optional: mn,
|
|
3170
|
-
ostring: yn,
|
|
3171
|
-
pipeline: gn,
|
|
3172
|
-
preprocess: vn,
|
|
3173
|
-
promise: hn,
|
|
3174
|
-
record: nn,
|
|
3175
|
-
set: on,
|
|
3176
|
-
strictObject: Xa,
|
|
3177
|
-
string: sr,
|
|
3178
|
-
symbol: Ba,
|
|
3179
|
-
transformer: Pt,
|
|
3180
|
-
tuple: an,
|
|
3181
|
-
undefined: Wa,
|
|
3182
|
-
union: en,
|
|
3183
|
-
unknown: Ja,
|
|
3184
|
-
void: Ya,
|
|
3185
|
-
NEVER: wn,
|
|
3186
|
-
ZodIssueCode: u,
|
|
3187
|
-
quotelessJson: ma,
|
|
3188
|
-
ZodError: B
|
|
3189
|
-
});
|
|
3190
|
-
const kn = y.object({
|
|
3191
|
-
fileName: y.string(),
|
|
3192
|
-
extension: y.string(),
|
|
3193
|
-
downloadUrl: y.string().url()
|
|
3194
|
-
});
|
|
3195
|
-
y.object({
|
|
3196
|
-
fileQid: y.string(),
|
|
3197
|
-
instanceQid: y.string(),
|
|
3198
|
-
signedUrl: y.string().url()
|
|
3199
|
-
});
|
|
3200
|
-
const Nn = y.union([y.string(), y.number(), y.boolean(), y.null()]), $t = y.lazy(
|
|
3201
|
-
() => y.union([Nn, y.array($t), y.record($t)])
|
|
3202
|
-
);
|
|
3203
|
-
y.string().transform((r, e) => {
|
|
3204
|
-
try {
|
|
3205
|
-
return JSON.parse(r);
|
|
3206
|
-
} catch {
|
|
3207
|
-
return e.addIssue({ code: "custom", message: "Invalid JSON" }), y.NEVER;
|
|
3208
|
-
}
|
|
3209
|
-
});
|
|
3210
|
-
const Tn = y.union([
|
|
3211
|
-
y.string().min(1),
|
|
3212
|
-
y.string().datetime(),
|
|
3213
|
-
y.number(),
|
|
3214
|
-
y.date()
|
|
3215
|
-
]), Cn = Tn.transform((r) => typeof r == "object" && typeof r.getMonth == "function" ? r.toLocaleDateString("en-US", {
|
|
3216
|
-
year: "numeric",
|
|
3217
|
-
month: "long",
|
|
3218
|
-
day: "numeric",
|
|
3219
|
-
hour: "numeric",
|
|
3220
|
-
minute: "numeric"
|
|
3221
|
-
}) : r.toString()), An = y.any();
|
|
3222
|
-
y.object({
|
|
3223
|
-
children: An
|
|
3224
|
-
});
|
|
3225
|
-
y.record(
|
|
3226
|
-
y.string(),
|
|
3227
|
-
y.record(
|
|
3228
|
-
y.string(),
|
|
3229
|
-
y.union([y.string(), y.number(), y.boolean(), y.null(), kn])
|
|
3230
|
-
).nullable()
|
|
3231
|
-
).nullish();
|
|
3232
|
-
y.union([
|
|
3233
|
-
y.literal("RICH_TEXT"),
|
|
3234
|
-
y.literal("STRING"),
|
|
3235
|
-
y.literal("FILE"),
|
|
3236
|
-
y.literal("DATETIME"),
|
|
3237
|
-
y.literal("BOOLEAN"),
|
|
3238
|
-
y.literal("NUMBER")
|
|
3239
|
-
]);
|
|
3240
|
-
const cr = zr({
|
|
3241
|
-
variant: "default",
|
|
3242
|
-
size: "base",
|
|
3243
|
-
inputs: /* @__PURE__ */ new Map(),
|
|
3244
|
-
components: /* @__PURE__ */ new Map(),
|
|
3245
|
-
config: [],
|
|
3246
|
-
resetValues: {}
|
|
3247
|
-
}), U = () => {
|
|
3248
|
-
const r = Lr(cr);
|
|
3249
|
-
if (!r)
|
|
3250
|
-
throw new Error("useTwintagForm must be used within a TwintagFormProvider");
|
|
3251
|
-
return r;
|
|
3252
|
-
}, yt = (r, e) => {
|
|
3253
|
-
const t = { ...r };
|
|
3254
|
-
let a;
|
|
3255
|
-
if (t.props ? a = { ...t.props } : a = { ...t }, !t.type) return /* @__PURE__ */ Object.create(null);
|
|
3256
|
-
const [s, n = void 0] = t.type.split(":");
|
|
3257
|
-
a.id = `${s}-${Kr()}`;
|
|
3258
|
-
const i = e.get(s);
|
|
3259
|
-
if (i && (a.comp = i), a.type = s, n && (a.subtype = n), t.props && (t.props.subtype && (a.subtype = t.props.subtype), t.props.label)) {
|
|
3260
|
-
const o = Cn.safeParse(t.props.label);
|
|
3261
|
-
a.label = o.success ? o.data : void 0;
|
|
3262
|
-
}
|
|
3263
|
-
return t.children && Array.isArray(t.children) && (a.items = t.children.map(
|
|
3264
|
-
(o) => yt(o, e)
|
|
3265
|
-
)), a;
|
|
3266
|
-
}, Rn = (r, e) => {
|
|
3267
|
-
var s;
|
|
3268
|
-
const t = Array.isArray(r) ? [...r] : [r], a = /* @__PURE__ */ new Map();
|
|
3269
|
-
for (; t.length > 0; ) {
|
|
3270
|
-
const n = t.pop();
|
|
3271
|
-
if (n)
|
|
3272
|
-
for (const [i, o] of Object.entries(n)) {
|
|
3273
|
-
if (Array.isArray(o))
|
|
3274
|
-
for (const d of o)
|
|
3275
|
-
t.push(d);
|
|
3276
|
-
typeof o == "object" && o !== null && t.push(o), i === "subtype" && "bind" in n && typeof n.bind == "string" && a.set(
|
|
3277
|
-
n.bind,
|
|
3278
|
-
(s = e.get(o)) == null ? void 0 : s.defaultValue
|
|
3279
|
-
);
|
|
3280
|
-
}
|
|
3281
|
-
}
|
|
3282
|
-
return Object.fromEntries(a);
|
|
3283
|
-
}, Sn = ({
|
|
3284
|
-
variant: r,
|
|
3285
|
-
size: e,
|
|
3286
|
-
inputs: t,
|
|
3287
|
-
components: a,
|
|
3288
|
-
config: s,
|
|
3289
|
-
children: n
|
|
3290
|
-
}) => {
|
|
3291
|
-
const i = lt(() => Array.isArray(s) ? s.map((d) => yt(d, a)) : yt(s, a), [s, a]), o = lt(() => Rn(i, t), [i, t]);
|
|
3292
|
-
return /* @__PURE__ */ c(
|
|
3293
|
-
cr.Provider,
|
|
3294
|
-
{
|
|
3295
|
-
value: {
|
|
3296
|
-
config: i,
|
|
3297
|
-
variant: r,
|
|
3298
|
-
size: e,
|
|
3299
|
-
inputs: t,
|
|
3300
|
-
components: a,
|
|
3301
|
-
resetValues: o
|
|
3302
|
-
},
|
|
3303
|
-
children: n
|
|
3304
|
-
}
|
|
3305
|
-
);
|
|
3306
|
-
}, zt = I({
|
|
3307
|
-
base: "border",
|
|
3308
|
-
variants: {
|
|
3309
|
-
variant: {
|
|
3310
|
-
default: "rounded-md",
|
|
3311
|
-
outline: "rounded-none"
|
|
3312
|
-
}
|
|
3313
|
-
},
|
|
3314
|
-
defaultVariants: {
|
|
3315
|
-
variant: "default"
|
|
3316
|
-
}
|
|
3317
|
-
}), dr = ({
|
|
3318
|
-
type: r,
|
|
3319
|
-
defaultValue: e,
|
|
3320
|
-
children: t
|
|
3321
|
-
}) => {
|
|
3322
|
-
const { variant: a } = U();
|
|
3323
|
-
return r === "single" ? /* @__PURE__ */ c(Zt, { type: "single", defaultValue: e, collapsible: !0, children: /* @__PURE__ */ c("div", { className: zt({ variant: a }), children: t }) }) : /* @__PURE__ */ c(Zt, { type: "multiple", children: /* @__PURE__ */ c("div", { className: zt({ variant: a }), children: t }) });
|
|
3324
|
-
};
|
|
3325
|
-
dr.displayName = "AccordionRoot";
|
|
3326
|
-
const En = I({
|
|
3327
|
-
slots: {
|
|
3328
|
-
item: "px-5 last:border-none",
|
|
3329
|
-
trigger: "flex flex-1 items-center gap-2.5 font-tf-font",
|
|
3330
|
-
icon: "shrink-0",
|
|
3331
|
-
content: "space-y-3"
|
|
3332
|
-
},
|
|
3333
|
-
variants: {
|
|
3334
|
-
variant: {
|
|
3335
|
-
default: {
|
|
3336
|
-
trigger: "font-medium"
|
|
3337
|
-
},
|
|
3338
|
-
outline: {
|
|
3339
|
-
trigger: ""
|
|
3340
|
-
}
|
|
3341
|
-
},
|
|
3342
|
-
size: {
|
|
3343
|
-
sm: {
|
|
3344
|
-
item: "text-sm",
|
|
3345
|
-
icon: "h-4 w-4"
|
|
3346
|
-
},
|
|
3347
|
-
base: {
|
|
3348
|
-
item: "text-base",
|
|
3349
|
-
icon: "h-5 w-5"
|
|
3350
|
-
}
|
|
3351
|
-
}
|
|
3352
|
-
},
|
|
3353
|
-
defaultVariants: {
|
|
3354
|
-
variant: "default",
|
|
3355
|
-
size: "base"
|
|
3356
|
-
}
|
|
3357
|
-
}), lr = ({
|
|
3358
|
-
label: r = "",
|
|
3359
|
-
value: e = "",
|
|
3360
|
-
icon: t,
|
|
3361
|
-
children: a,
|
|
3362
|
-
...s
|
|
3363
|
-
}) => {
|
|
3364
|
-
const { variant: n, size: i } = U(), {
|
|
3365
|
-
item: o,
|
|
3366
|
-
trigger: d,
|
|
3367
|
-
icon: l,
|
|
3368
|
-
content: h
|
|
3369
|
-
} = En({ size: i, variant: n });
|
|
3370
|
-
return /* @__PURE__ */ T(
|
|
3371
|
-
Ht,
|
|
3372
|
-
{
|
|
3373
|
-
value: e || da(r),
|
|
3374
|
-
className: o(),
|
|
3375
|
-
...s,
|
|
3376
|
-
children: [
|
|
3377
|
-
/* @__PURE__ */ c(Yt, { className: "text-category", children: /* @__PURE__ */ T("span", { className: d(), children: [
|
|
3378
|
-
t ? /* @__PURE__ */ c(ha, { name: t, className: l() }) : /* @__PURE__ */ c(Z, {}),
|
|
3379
|
-
r
|
|
3380
|
-
] }) }),
|
|
3381
|
-
/* @__PURE__ */ c(Kt, { className: h(), children: a })
|
|
3382
|
-
]
|
|
3383
|
-
}
|
|
3384
|
-
);
|
|
3385
|
-
};
|
|
3386
|
-
lr.displayName = "AccordionItem";
|
|
3387
|
-
const On = ({ subtype: r = "single", ...e }) => r === "item" ? /* @__PURE__ */ c(
|
|
3388
|
-
lr,
|
|
3389
|
-
{
|
|
3390
|
-
...e
|
|
3391
|
-
}
|
|
3392
|
-
) : /* @__PURE__ */ c(dr, { type: r, ...e }), In = I({
|
|
3393
|
-
slots: {
|
|
3394
|
-
container: "relative w-full space-y-3",
|
|
3395
|
-
heading: "font-tf-font text-category",
|
|
3396
|
-
content: "grid gap-3"
|
|
3397
|
-
},
|
|
3398
|
-
variants: {
|
|
3399
|
-
variant: {
|
|
3400
|
-
default: {
|
|
3401
|
-
heading: "font-medium"
|
|
3402
|
-
},
|
|
3403
|
-
outline: {
|
|
3404
|
-
heading: "font-normal"
|
|
3405
|
-
}
|
|
3406
|
-
},
|
|
3407
|
-
size: {
|
|
3408
|
-
sm: {
|
|
3409
|
-
heading: "text-sm"
|
|
3410
|
-
},
|
|
3411
|
-
base: {
|
|
3412
|
-
heading: "text-base"
|
|
3413
|
-
}
|
|
3414
|
-
}
|
|
3415
|
-
},
|
|
3416
|
-
defaultVariants: {
|
|
3417
|
-
variant: "default",
|
|
3418
|
-
size: "base"
|
|
3419
|
-
}
|
|
3420
|
-
}), ur = ({ label: r, children: e }) => {
|
|
3421
|
-
const { variant: t, size: a } = U(), { container: s, heading: n, content: i } = In({ size: a, variant: t });
|
|
3422
|
-
return /* @__PURE__ */ T("section", { className: s(), children: [
|
|
3423
|
-
r ? /* @__PURE__ */ c("h3", { className: n(), children: r }) : /* @__PURE__ */ c(Z, {}),
|
|
3424
|
-
/* @__PURE__ */ c("div", { className: i(), children: e })
|
|
3425
|
-
] });
|
|
3426
|
-
};
|
|
3427
|
-
ur.displayName = "Category";
|
|
3428
|
-
const Vn = I({
|
|
3429
|
-
slots: {
|
|
3430
|
-
root: [
|
|
3431
|
-
"peer h-4 w-4 shrink-0 rounded-sm border border-accent shadow",
|
|
3432
|
-
"focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring focus-visible:ring-offset-1",
|
|
3433
|
-
"disabled:cursor-not-allowed disabled:opacity-50",
|
|
3434
|
-
"data-[state=checked]:bg-accent data-[state=checked]:text-accent-foreground"
|
|
3435
|
-
],
|
|
3436
|
-
indicator: "flex items-center justify-center text-current",
|
|
3437
|
-
icon: "h-4 w-4"
|
|
3438
|
-
}
|
|
3439
|
-
}), fr = O.forwardRef(({ className: r, ...e }, t) => {
|
|
3440
|
-
const { root: a, indicator: s, icon: n } = Vn();
|
|
3441
|
-
return /* @__PURE__ */ c(
|
|
3442
|
-
ut.Root,
|
|
3443
|
-
{
|
|
3444
|
-
ref: t,
|
|
3445
|
-
className: a({
|
|
3446
|
-
className: r
|
|
3447
|
-
}),
|
|
3448
|
-
...e,
|
|
3449
|
-
children: /* @__PURE__ */ c(ut.Indicator, { className: s(), children: /* @__PURE__ */ c(ta, { className: n() }) })
|
|
3450
|
-
}
|
|
3451
|
-
);
|
|
3452
|
-
});
|
|
3453
|
-
fr.displayName = ut.Root.displayName;
|
|
3454
|
-
const Zn = I({
|
|
3455
|
-
base: [
|
|
3456
|
-
"text-label",
|
|
3457
|
-
"peer-disabled:cursor-not-allowed peer-disabled:opacity-70"
|
|
3458
|
-
],
|
|
3459
|
-
variants: {
|
|
3460
|
-
size: {
|
|
3461
|
-
sm: "text-sm leading-none",
|
|
3462
|
-
base: "text-base leading-none"
|
|
3463
|
-
}
|
|
3464
|
-
},
|
|
3465
|
-
defaultVariants: {
|
|
3466
|
-
size: "base"
|
|
3467
|
-
}
|
|
3468
|
-
}), wt = O.forwardRef(({ size: r, className: e, ...t }, a) => /* @__PURE__ */ c(
|
|
3469
|
-
Ut.Root,
|
|
3470
|
-
{
|
|
3471
|
-
ref: a,
|
|
3472
|
-
className: Zn({
|
|
3473
|
-
size: r,
|
|
3474
|
-
className: e
|
|
3475
|
-
}),
|
|
3476
|
-
...t
|
|
3477
|
-
}
|
|
3478
|
-
));
|
|
3479
|
-
wt.displayName = Ut.Root.displayName;
|
|
3480
|
-
const jn = Xr, hr = O.createContext(
|
|
3481
|
-
{}
|
|
3482
|
-
), he = ({
|
|
3483
|
-
...r
|
|
3484
|
-
}) => /* @__PURE__ */ c(hr.Provider, { value: { name: r.name }, children: /* @__PURE__ */ c(Qr, { ...r }) }), st = () => {
|
|
3485
|
-
const r = O.useContext(hr), e = O.useContext(mr), { getFieldState: t, formState: a } = ie(), s = t(r.name, a);
|
|
3486
|
-
if (!r)
|
|
3487
|
-
throw new Error("useFormField should be used within <FormField>");
|
|
3488
|
-
const { id: n } = e;
|
|
3489
|
-
return {
|
|
3490
|
-
id: n,
|
|
3491
|
-
name: r.name,
|
|
3492
|
-
formItemId: `${n}-form-item`,
|
|
3493
|
-
formDescriptionId: `${n}-form-item-description`,
|
|
3494
|
-
formMessageId: `${n}-form-item-message`,
|
|
3495
|
-
...s
|
|
3496
|
-
};
|
|
3497
|
-
}, mr = O.createContext(
|
|
3498
|
-
{}
|
|
3499
|
-
), Mn = I({
|
|
3500
|
-
base: "",
|
|
3501
|
-
variants: {
|
|
3502
|
-
variant: {
|
|
3503
|
-
default: "space-y-2",
|
|
3504
|
-
outline: "space-y-1"
|
|
3505
|
-
}
|
|
3506
|
-
},
|
|
3507
|
-
defaultVariants: {
|
|
3508
|
-
variant: "default"
|
|
3509
|
-
}
|
|
3510
|
-
}), Q = O.forwardRef(({ variant: r, className: e, ...t }, a) => {
|
|
3511
|
-
const s = O.useId();
|
|
3512
|
-
return /* @__PURE__ */ c(mr.Provider, { value: { id: s }, children: /* @__PURE__ */ c(
|
|
3513
|
-
"div",
|
|
3514
|
-
{
|
|
3515
|
-
ref: a,
|
|
3516
|
-
className: Mn({ variant: r, className: e }),
|
|
3517
|
-
...t
|
|
3518
|
-
}
|
|
3519
|
-
) });
|
|
3520
|
-
});
|
|
3521
|
-
Q.displayName = "FormItem";
|
|
3522
|
-
const Pn = I({
|
|
3523
|
-
base: "",
|
|
3524
|
-
variants: {
|
|
3525
|
-
error: {
|
|
3526
|
-
true: "text-destructive"
|
|
3527
|
-
}
|
|
3528
|
-
}
|
|
3529
|
-
}), X = O.forwardRef(({ size: r, className: e, ...t }, a) => {
|
|
3530
|
-
const { error: s, formItemId: n } = st();
|
|
3531
|
-
return /* @__PURE__ */ c(
|
|
3532
|
-
wt,
|
|
3533
|
-
{
|
|
3534
|
-
ref: a,
|
|
3535
|
-
size: r,
|
|
3536
|
-
className: Pn({
|
|
3537
|
-
error: !!s,
|
|
3538
|
-
className: e
|
|
3539
|
-
}),
|
|
3540
|
-
htmlFor: n,
|
|
3541
|
-
...t
|
|
3542
|
-
}
|
|
3543
|
-
);
|
|
3544
|
-
});
|
|
3545
|
-
X.displayName = "FormLabel";
|
|
3546
|
-
const ee = O.forwardRef(({ ...r }, e) => {
|
|
3547
|
-
const { error: t, formItemId: a, formDescriptionId: s, formMessageId: n } = st();
|
|
3548
|
-
return /* @__PURE__ */ c(
|
|
3549
|
-
Dt,
|
|
3550
|
-
{
|
|
3551
|
-
ref: e,
|
|
3552
|
-
id: a,
|
|
3553
|
-
"aria-describedby": t ? `${s} ${n}` : `${s}`,
|
|
3554
|
-
"aria-invalid": !!t,
|
|
3555
|
-
...r
|
|
3556
|
-
}
|
|
3557
|
-
);
|
|
3558
|
-
});
|
|
3559
|
-
ee.displayName = "FormControl";
|
|
3560
|
-
const $n = I({
|
|
3561
|
-
base: "text-muted-foreground",
|
|
3562
|
-
variants: {
|
|
3563
|
-
size: {
|
|
3564
|
-
sm: "text-[0.8rem] leading-none",
|
|
3565
|
-
base: "text-[0.9rem] leading-none"
|
|
3566
|
-
}
|
|
3567
|
-
},
|
|
3568
|
-
defaultVariants: {
|
|
3569
|
-
size: "base"
|
|
3570
|
-
}
|
|
3571
|
-
}), oe = O.forwardRef(({ size: r, className: e, ...t }, a) => {
|
|
3572
|
-
const { formDescriptionId: s } = st();
|
|
3573
|
-
return /* @__PURE__ */ c(
|
|
3574
|
-
"p",
|
|
3575
|
-
{
|
|
3576
|
-
ref: a,
|
|
3577
|
-
id: s,
|
|
3578
|
-
className: $n({ size: r, className: e }),
|
|
3579
|
-
...t
|
|
3580
|
-
}
|
|
3581
|
-
);
|
|
3582
|
-
});
|
|
3583
|
-
oe.displayName = "FormDescription";
|
|
3584
|
-
const zn = I({
|
|
3585
|
-
base: "font-medium text-destructive",
|
|
3586
|
-
variants: {
|
|
3587
|
-
size: {
|
|
3588
|
-
sm: "text-[0.8rem]",
|
|
3589
|
-
base: "text-[0.9rem]"
|
|
3590
|
-
}
|
|
3591
|
-
},
|
|
3592
|
-
defaultVariants: {
|
|
3593
|
-
size: "base"
|
|
3594
|
-
}
|
|
3595
|
-
}), ce = O.forwardRef(({ size: r, className: e, children: t, ...a }, s) => {
|
|
3596
|
-
const { error: n, formMessageId: i } = st(), o = n ? String(n == null ? void 0 : n.message) : t;
|
|
3597
|
-
return o ? /* @__PURE__ */ c(
|
|
3598
|
-
"p",
|
|
3599
|
-
{
|
|
3600
|
-
ref: s,
|
|
3601
|
-
id: i,
|
|
3602
|
-
className: zn({ size: r, className: e }),
|
|
3603
|
-
...a,
|
|
3604
|
-
children: o
|
|
3605
|
-
}
|
|
3606
|
-
) : null;
|
|
3607
|
-
});
|
|
3608
|
-
ce.displayName = "FormMessage";
|
|
3609
|
-
const pr = !1, Ln = ({ label: r, bind: e, options: t }) => {
|
|
3610
|
-
const { control: a } = ie(), { variant: s, size: n } = U(), i = t == null ? void 0 : t.optionalField;
|
|
3611
|
-
return /* @__PURE__ */ c(
|
|
3612
|
-
he,
|
|
3613
|
-
{
|
|
3614
|
-
defaultValue: pr,
|
|
3615
|
-
control: a,
|
|
3616
|
-
name: e,
|
|
3617
|
-
rules: {
|
|
3618
|
-
required: i ? !1 : (t == null ? void 0 : t.error) ?? !0
|
|
3619
|
-
},
|
|
3620
|
-
render: ({ field: o }) => /* @__PURE__ */ c(Q, { variant: s, className: "pt-1.5", children: /* @__PURE__ */ T("div", { className: "flex space-x-2", children: [
|
|
3621
|
-
/* @__PURE__ */ c(ee, { children: /* @__PURE__ */ c(
|
|
3622
|
-
fr,
|
|
3623
|
-
{
|
|
3624
|
-
...o,
|
|
3625
|
-
checked: o.value,
|
|
3626
|
-
onCheckedChange: (d) => {
|
|
3627
|
-
o.onChange(d);
|
|
3628
|
-
}
|
|
3629
|
-
}
|
|
3630
|
-
) }),
|
|
3631
|
-
/* @__PURE__ */ T("div", { className: "grid gap-1", children: [
|
|
3632
|
-
/* @__PURE__ */ T(X, { size: n, children: [
|
|
3633
|
-
r,
|
|
3634
|
-
i ? /* @__PURE__ */ c(Z, {}) : /* @__PURE__ */ c("span", { className: "ml-0.5 inline-block", children: /* @__PURE__ */ c(_e, { className: "h-3 w-3 text-destructive" }) })
|
|
3635
|
-
] }),
|
|
3636
|
-
t != null && t.description ? /* @__PURE__ */ c(oe, { size: n, children: t.description }) : /* @__PURE__ */ c(Z, {}),
|
|
3637
|
-
/* @__PURE__ */ c(ce, { size: n })
|
|
3638
|
-
] })
|
|
3639
|
-
] }) })
|
|
3640
|
-
}
|
|
3641
|
-
);
|
|
3642
|
-
}, _t = I({
|
|
3643
|
-
base: [
|
|
3644
|
-
"inline-flex items-center justify-center whitespace-nowrap rounded-md font-medium transition-colors",
|
|
3645
|
-
"ring-offset-background focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring focus-visible:ring-offset-2",
|
|
3646
|
-
"disabled:pointer-events-none disabled:opacity-50"
|
|
3647
|
-
],
|
|
3648
|
-
variants: {
|
|
3649
|
-
variant: {
|
|
3650
|
-
default: "bg-primary-foreground text-primary shadow hover:bg-primary-foreground/90",
|
|
3651
|
-
outline: "border border-input bg-background hover:bg-accent hover:text-accent-foreground",
|
|
3652
|
-
ghost: "hover:bg-accent hover:text-accent-foreground"
|
|
3653
|
-
},
|
|
3654
|
-
size: {
|
|
3655
|
-
sm: "h-9 rounded-md px-3 text-sm",
|
|
3656
|
-
base: "h-10 px-3 py-2 text-base"
|
|
3657
|
-
}
|
|
3658
|
-
},
|
|
3659
|
-
defaultVariants: {
|
|
3660
|
-
variant: "default",
|
|
3661
|
-
size: "base"
|
|
3662
|
-
}
|
|
3663
|
-
}), kt = O.forwardRef(
|
|
3664
|
-
({ className: r, variant: e, size: t, asChild: a = !1, ...s }, n) => /* @__PURE__ */ c(
|
|
3665
|
-
a ? Dt : "button",
|
|
3666
|
-
{
|
|
3667
|
-
className: _t({ variant: e, size: t, className: r }),
|
|
3668
|
-
ref: n,
|
|
3669
|
-
...s
|
|
3670
|
-
}
|
|
3671
|
-
)
|
|
3672
|
-
);
|
|
3673
|
-
kt.displayName = "Button";
|
|
3674
|
-
const Fn = I({
|
|
3675
|
-
slots: {
|
|
3676
|
-
picker: "p-3",
|
|
3677
|
-
months: "flex flex-col space-y-4 sm:flex-row sm:space-x-4 sm:space-y-0",
|
|
3678
|
-
month: "space-y-4",
|
|
3679
|
-
caption: "relative flex items-center justify-center pt-1",
|
|
3680
|
-
caption_dropdowns: "",
|
|
3681
|
-
caption_label: "font-semibold",
|
|
3682
|
-
nav: "flex items-center space-x-1",
|
|
3683
|
-
nav_button: _t({
|
|
3684
|
-
variant: "outline",
|
|
3685
|
-
className: "h-7 w-7 bg-transparent p-0 opacity-50 hover:opacity-100"
|
|
3686
|
-
}),
|
|
3687
|
-
nav_button_previous: "absolute left-1",
|
|
3688
|
-
nav_button_next: "absolute right-1",
|
|
3689
|
-
table: "w-full border-collapse space-y-1",
|
|
3690
|
-
head_row: "flex",
|
|
3691
|
-
head_cell: "w-9 rounded-md text-[0.8rem] font-normal text-muted-foreground",
|
|
3692
|
-
row: "mt-2 flex w-full",
|
|
3693
|
-
cell: "relative h-9 w-9 p-0 text-center focus-within:relative focus-within:z-20 [&:has([aria-selected])]:bg-transparent first:[&:has([aria-selected])]:rounded-l-md last:[&:has([aria-selected])]:rounded-r-md [&:has([aria-selected].day-outside)]:bg-muted/50 [&:has([aria-selected].day-range-end)]:rounded-r-md",
|
|
3694
|
-
day: _t({
|
|
3695
|
-
variant: "ghost",
|
|
3696
|
-
className: "h-9 w-9 p-0 font-normal aria-selected:opacity-100"
|
|
3697
|
-
}),
|
|
3698
|
-
day_range_end: "day-range-end",
|
|
3699
|
-
day_selected: "bg-accent text-accent-foreground hover:bg-accent hover:text-accent-foreground focus:bg-accent focus:text-accent-foreground",
|
|
3700
|
-
day_today: "bg-muted text-muted-foreground",
|
|
3701
|
-
day_outside: "day-outside text-muted-foreground opacity-50 aria-selected:bg-accent/30 aria-selected:text-accent-foreground",
|
|
3702
|
-
day_disabled: "text-muted-foreground opacity-50",
|
|
3703
|
-
day_range_middle: "aria-selected:bg-accent aria-selected:text-accent-foreground",
|
|
3704
|
-
day_hidden: "invisible"
|
|
3705
|
-
},
|
|
3706
|
-
variants: {
|
|
3707
|
-
variant: {
|
|
3708
|
-
dropdown: {
|
|
3709
|
-
caption_label: "hidden",
|
|
3710
|
-
caption_dropdowns: [
|
|
3711
|
-
"flex w-4/6 justify-center gap-1",
|
|
3712
|
-
"[&>*>span]:hidden [&>*]:flex-1 [&>.rdp-vhidden]:hidden ",
|
|
3713
|
-
"[&>*>select]:h-7 [&>*>select]:min-w-[3.6rem] [&>*>select]:rounded-md [&>*>select]:border [&>*>select]:border-input [&>*>select]:bg-background [&>*>select]:px-1",
|
|
3714
|
-
"[&>*>select]:ring-offset-background [&>*>select]:focus-visible:outline-none [&>*>select]:focus-visible:ring-1 [&>*>select]:focus-visible:ring-ring"
|
|
3715
|
-
]
|
|
3716
|
-
}
|
|
3717
|
-
},
|
|
3718
|
-
size: {
|
|
3719
|
-
sm: {
|
|
3720
|
-
caption_label: "text-sm",
|
|
3721
|
-
caption_dropdowns: "[&>*>select]:text-sm",
|
|
3722
|
-
cell: "text-sm"
|
|
3723
|
-
},
|
|
3724
|
-
base: {
|
|
3725
|
-
caption_label: "text-base",
|
|
3726
|
-
caption_dropdowns: "[&>*>select]:text-base",
|
|
3727
|
-
cell: "text-base"
|
|
3728
|
-
}
|
|
3729
|
-
}
|
|
3730
|
-
},
|
|
3731
|
-
defaultVariants: {
|
|
3732
|
-
size: "base"
|
|
3733
|
-
}
|
|
3734
|
-
});
|
|
3735
|
-
function vr({
|
|
3736
|
-
size: r,
|
|
3737
|
-
className: e,
|
|
3738
|
-
classNames: t,
|
|
3739
|
-
showOutsideDays: a = !0,
|
|
3740
|
-
...s
|
|
3741
|
-
}) {
|
|
3742
|
-
const n = Fn({
|
|
3743
|
-
size: r,
|
|
3744
|
-
variant: s.captionLayout === "dropdown-buttons" ? "dropdown" : void 0
|
|
3745
|
-
});
|
|
3746
|
-
return /* @__PURE__ */ c(
|
|
3747
|
-
aa,
|
|
3748
|
-
{
|
|
3749
|
-
showOutsideDays: a,
|
|
3750
|
-
className: n.picker({ className: e }),
|
|
3751
|
-
classNames: {
|
|
3752
|
-
months: n.months(),
|
|
3753
|
-
month: n.month(),
|
|
3754
|
-
caption: n.caption(),
|
|
3755
|
-
caption_label: n.caption_label(),
|
|
3756
|
-
caption_dropdowns: n.caption_dropdowns(),
|
|
3757
|
-
nav: n.nav(),
|
|
3758
|
-
nav_button: n.nav_button(),
|
|
3759
|
-
nav_button_previous: n.nav_button_previous(),
|
|
3760
|
-
nav_button_next: n.nav_button_next(),
|
|
3761
|
-
table: n.table(),
|
|
3762
|
-
head_row: n.head_row(),
|
|
3763
|
-
head_cell: n.head_cell(),
|
|
3764
|
-
row: n.row(),
|
|
3765
|
-
cell: n.cell(),
|
|
3766
|
-
day: n.day(),
|
|
3767
|
-
day_range_end: n.day_range_end(),
|
|
3768
|
-
day_selected: n.day_selected(),
|
|
3769
|
-
day_today: n.day_today(),
|
|
3770
|
-
day_outside: n.day_outside(),
|
|
3771
|
-
day_disabled: n.day_disabled(),
|
|
3772
|
-
day_range_middle: n.day_range_middle(),
|
|
3773
|
-
day_hidden: n.day_hidden(),
|
|
3774
|
-
...t
|
|
3775
|
-
},
|
|
3776
|
-
components: {
|
|
3777
|
-
IconLeft: () => /* @__PURE__ */ c(Gr, { className: "h-4 w-4" }),
|
|
3778
|
-
IconRight: () => /* @__PURE__ */ c(qr, { className: "h-4 w-4" })
|
|
3779
|
-
},
|
|
3780
|
-
...s
|
|
3781
|
-
}
|
|
3782
|
-
);
|
|
3783
|
-
}
|
|
3784
|
-
vr.displayName = "Calendar";
|
|
3785
|
-
const Dn = at.Root, Un = at.Trigger, Bn = I({
|
|
3786
|
-
base: "z-50 w-72 rounded-md border bg-background p-4 text-foreground shadow-md outline-none"
|
|
3787
|
-
}), gr = O.forwardRef(({ className: r, align: e = "center", sideOffset: t = 2, ...a }, s) => /* @__PURE__ */ c(
|
|
3788
|
-
at.Content,
|
|
3789
|
-
{
|
|
3790
|
-
ref: s,
|
|
3791
|
-
align: e,
|
|
3792
|
-
sideOffset: t,
|
|
3793
|
-
className: Bn({
|
|
3794
|
-
className: r
|
|
3795
|
-
}),
|
|
3796
|
-
...a
|
|
3797
|
-
}
|
|
3798
|
-
));
|
|
3799
|
-
gr.displayName = at.Content.displayName;
|
|
3800
|
-
const Wn = I({
|
|
3801
|
-
slots: {
|
|
3802
|
-
button: "w-full justify-start text-left font-normal",
|
|
3803
|
-
icon: "ml-auto text-muted-foreground opacity-70"
|
|
3804
|
-
},
|
|
3805
|
-
variants: {
|
|
3806
|
-
variant: {
|
|
3807
|
-
default: {
|
|
3808
|
-
button: "px-3"
|
|
3809
|
-
},
|
|
3810
|
-
outline: {
|
|
3811
|
-
button: "rounded-none border-x-transparent border-t-transparent px-1 transition-none hover:bg-white hover:text-muted-foreground"
|
|
3812
|
-
}
|
|
3813
|
-
},
|
|
3814
|
-
withValue: {
|
|
3815
|
-
true: {
|
|
3816
|
-
button: "text-muted-foreground"
|
|
3817
|
-
},
|
|
3818
|
-
false: {
|
|
3819
|
-
button: ""
|
|
3820
|
-
}
|
|
3821
|
-
},
|
|
3822
|
-
size: {
|
|
3823
|
-
sm: {
|
|
3824
|
-
button: "text-sm",
|
|
3825
|
-
icon: "h-4 w-4"
|
|
3826
|
-
},
|
|
3827
|
-
base: {
|
|
3828
|
-
button: "text-base",
|
|
3829
|
-
icon: "h-5 w-5"
|
|
3830
|
-
}
|
|
3831
|
-
}
|
|
3832
|
-
},
|
|
3833
|
-
defaultVariants: {
|
|
3834
|
-
variant: "default",
|
|
3835
|
-
size: "base"
|
|
3836
|
-
}
|
|
3837
|
-
}), yr = null, qn = ({
|
|
3838
|
-
label: r,
|
|
3839
|
-
bind: e,
|
|
3840
|
-
options: t
|
|
3841
|
-
}) => {
|
|
3842
|
-
const { variant: a, size: s } = U(), { control: n } = ie(), { button: i, icon: o } = Wn({ variant: a, size: s }), d = t == null ? void 0 : t.optionalField;
|
|
3843
|
-
return /* @__PURE__ */ c(
|
|
3844
|
-
he,
|
|
3845
|
-
{
|
|
3846
|
-
defaultValue: yr,
|
|
3847
|
-
control: n,
|
|
3848
|
-
name: e,
|
|
3849
|
-
rules: {
|
|
3850
|
-
required: d ? !1 : (t == null ? void 0 : t.error) ?? !0
|
|
3851
|
-
},
|
|
3852
|
-
render: ({ field: l }) => /* @__PURE__ */ T(
|
|
3853
|
-
Q,
|
|
3854
|
-
{
|
|
3855
|
-
variant: a,
|
|
3856
|
-
className: "flex flex-col [&>div[data-radix-popper-content-wrapper]]:!z-50",
|
|
3857
|
-
children: [
|
|
3858
|
-
/* @__PURE__ */ T("div", { className: "space-y-1", children: [
|
|
3859
|
-
/* @__PURE__ */ T(X, { size: s, children: [
|
|
3860
|
-
r,
|
|
3861
|
-
d ? /* @__PURE__ */ c(Z, {}) : /* @__PURE__ */ c("span", { className: "ml-0.5 inline-block", children: /* @__PURE__ */ c(_e, { className: "h-3 w-3 text-destructive" }) })
|
|
3862
|
-
] }),
|
|
3863
|
-
t != null && t.description ? /* @__PURE__ */ c(oe, { size: s, children: t.description }) : /* @__PURE__ */ c(Z, {})
|
|
3864
|
-
] }),
|
|
3865
|
-
/* @__PURE__ */ T(Dn, { children: [
|
|
3866
|
-
/* @__PURE__ */ c(Un, { asChild: !0, children: /* @__PURE__ */ c(ee, { children: /* @__PURE__ */ T(
|
|
3867
|
-
kt,
|
|
3868
|
-
{
|
|
3869
|
-
variant: "outline",
|
|
3870
|
-
size: s,
|
|
3871
|
-
className: i({
|
|
3872
|
-
withValue: !l.value,
|
|
3873
|
-
className: "h-10 gap-2"
|
|
3874
|
-
}),
|
|
3875
|
-
children: [
|
|
3876
|
-
l.value ? ra(l.value, "PPP") : /* @__PURE__ */ c("span", { children: (t == null ? void 0 : t.placeholder) ?? "Select a date" }),
|
|
3877
|
-
/* @__PURE__ */ c(Jr, { className: o() })
|
|
3878
|
-
]
|
|
3879
|
-
}
|
|
3880
|
-
) }) }),
|
|
3881
|
-
/* @__PURE__ */ c(gr, { className: "w-auto p-0", align: "start", children: /* @__PURE__ */ c(
|
|
3882
|
-
vr,
|
|
3883
|
-
{
|
|
3884
|
-
fromYear: 1970,
|
|
3885
|
-
toYear: 2050,
|
|
3886
|
-
captionLayout: "dropdown-buttons",
|
|
3887
|
-
mode: "single",
|
|
3888
|
-
size: s,
|
|
3889
|
-
selected: Number.isNaN(new Date(l.value).getTime()) ? void 0 : new Date(l.value),
|
|
3890
|
-
onSelect: l.onChange,
|
|
3891
|
-
initialFocus: !0
|
|
3892
|
-
}
|
|
3893
|
-
) })
|
|
3894
|
-
] }),
|
|
3895
|
-
/* @__PURE__ */ c(ce, { size: s, className: "pt-1" })
|
|
3896
|
-
]
|
|
3897
|
-
}
|
|
3898
|
-
)
|
|
3899
|
-
}
|
|
3900
|
-
);
|
|
3901
|
-
}, Gn = I({
|
|
3902
|
-
slots: {
|
|
3903
|
-
root: "relative",
|
|
3904
|
-
input: [
|
|
3905
|
-
"flex h-10 w-full border-input bg-background py-2 text-primary-foreground placeholder:text-muted-foreground focus-visible:outline-none",
|
|
3906
|
-
"file:border-0 file:bg-transparent file:px-0 file:font-medium file:text-primary-foreground",
|
|
3907
|
-
"disabled:cursor-not-allowed disabled:opacity-50"
|
|
3908
|
-
]
|
|
3909
|
-
},
|
|
3910
|
-
variants: {
|
|
3911
|
-
variant: {
|
|
3912
|
-
default: {
|
|
3913
|
-
input: "rounded-md border px-3 ring-offset-background focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2"
|
|
3914
|
-
},
|
|
3915
|
-
outline: {
|
|
3916
|
-
root: 'after:absolute after:left-0 after:top-[calc(100%_+_1px)] after:w-full after:rounded-full after:content-[""] focus-within:after:h-0.5 focus-within:after:bg-ring',
|
|
3917
|
-
input: "border-b px-1"
|
|
3918
|
-
}
|
|
3919
|
-
},
|
|
3920
|
-
size: {
|
|
3921
|
-
sm: {
|
|
3922
|
-
input: "text-sm file:text-sm"
|
|
3923
|
-
},
|
|
3924
|
-
base: {
|
|
3925
|
-
input: "text-base file:text-base"
|
|
3926
|
-
}
|
|
3927
|
-
}
|
|
3928
|
-
},
|
|
3929
|
-
defaultVariants: {
|
|
3930
|
-
variant: "default",
|
|
3931
|
-
size: "base"
|
|
3932
|
-
}
|
|
3933
|
-
}), Nt = O.forwardRef(
|
|
3934
|
-
({ variant: r, size: e, className: t, type: a, ...s }, n) => {
|
|
3935
|
-
const { root: i, input: o } = Gn({ variant: r, size: e });
|
|
3936
|
-
return /* @__PURE__ */ c("div", { className: i(), children: /* @__PURE__ */ c(
|
|
3937
|
-
"input",
|
|
3938
|
-
{
|
|
3939
|
-
type: a,
|
|
3940
|
-
className: o({
|
|
3941
|
-
className: t
|
|
3942
|
-
}),
|
|
3943
|
-
ref: n,
|
|
3944
|
-
...s
|
|
3945
|
-
}
|
|
3946
|
-
) });
|
|
3947
|
-
}
|
|
3948
|
-
);
|
|
3949
|
-
Nt.displayName = "Input";
|
|
3950
|
-
const _r = "", Jn = ({ label: r, bind: e, options: t }) => {
|
|
3951
|
-
const { control: a } = ie(), { variant: s, size: n } = U(), i = t == null ? void 0 : t.optionalField;
|
|
3952
|
-
return /* @__PURE__ */ c(
|
|
3953
|
-
he,
|
|
3954
|
-
{
|
|
3955
|
-
defaultValue: _r,
|
|
3956
|
-
control: a,
|
|
3957
|
-
name: e,
|
|
3958
|
-
rules: {
|
|
3959
|
-
required: i ? !1 : (t == null ? void 0 : t.error) ?? !0
|
|
3960
|
-
},
|
|
3961
|
-
render: ({ field: o, formState: d }) => /* @__PURE__ */ T(Q, { variant: s, children: [
|
|
3962
|
-
/* @__PURE__ */ T("div", { className: "space-y-1", children: [
|
|
3963
|
-
/* @__PURE__ */ T(X, { htmlFor: e, size: n, children: [
|
|
3964
|
-
r,
|
|
3965
|
-
i ? /* @__PURE__ */ c(Z, {}) : /* @__PURE__ */ c("span", { className: "ml-0.5 inline-block", children: /* @__PURE__ */ c(_e, { className: "h-3 w-3 text-destructive" }) })
|
|
3966
|
-
] }),
|
|
3967
|
-
t != null && t.description ? /* @__PURE__ */ c(oe, { size: n, children: t.description }) : /* @__PURE__ */ c(Z, {})
|
|
3968
|
-
] }),
|
|
3969
|
-
/* @__PURE__ */ c(ee, { children: /* @__PURE__ */ c(
|
|
3970
|
-
Nt,
|
|
3971
|
-
{
|
|
3972
|
-
ref: (l) => {
|
|
3973
|
-
o.ref(l), l && d.isSubmitSuccessful && (l.value = "");
|
|
3974
|
-
},
|
|
3975
|
-
id: e,
|
|
3976
|
-
type: "file",
|
|
3977
|
-
name: o.name,
|
|
3978
|
-
size: n,
|
|
3979
|
-
variant: s,
|
|
3980
|
-
multiple: !0,
|
|
3981
|
-
onBlur: o.onBlur,
|
|
3982
|
-
onChange: (l) => {
|
|
3983
|
-
l.target.files && o.onChange(l.target.files);
|
|
3984
|
-
}
|
|
3985
|
-
}
|
|
3986
|
-
) }),
|
|
3987
|
-
/* @__PURE__ */ c(ce, { size: n, className: "pt-1.5" })
|
|
3988
|
-
] })
|
|
3989
|
-
}
|
|
3990
|
-
);
|
|
3991
|
-
}, br = "", Hn = ({ label: r, bind: e, options: t }) => {
|
|
3992
|
-
const { control: a } = ie(), { variant: s, size: n } = U(), i = t == null ? void 0 : t.optionalField;
|
|
3993
|
-
return /* @__PURE__ */ c(
|
|
3994
|
-
he,
|
|
3995
|
-
{
|
|
3996
|
-
defaultValue: br,
|
|
3997
|
-
control: a,
|
|
3998
|
-
name: e,
|
|
3999
|
-
rules: {
|
|
4000
|
-
required: i ? !1 : (t == null ? void 0 : t.error) ?? !0
|
|
4001
|
-
},
|
|
4002
|
-
render: ({ field: o }) => /* @__PURE__ */ T(Q, { variant: s, children: [
|
|
4003
|
-
/* @__PURE__ */ T("div", { className: "space-y-1", children: [
|
|
4004
|
-
/* @__PURE__ */ T(X, { size: n, children: [
|
|
4005
|
-
r,
|
|
4006
|
-
i ? /* @__PURE__ */ c(Z, {}) : /* @__PURE__ */ c("span", { className: "ml-0.5 inline-block", children: /* @__PURE__ */ c(_e, { className: "h-3 w-3 text-destructive" }) })
|
|
4007
|
-
] }),
|
|
4008
|
-
t != null && t.description ? /* @__PURE__ */ c(oe, { size: n, children: t.description }) : /* @__PURE__ */ c(Z, {})
|
|
4009
|
-
] }),
|
|
4010
|
-
/* @__PURE__ */ c(ee, { children: /* @__PURE__ */ c(
|
|
4011
|
-
Nt,
|
|
4012
|
-
{
|
|
4013
|
-
type: "text",
|
|
4014
|
-
size: n,
|
|
4015
|
-
variant: s,
|
|
4016
|
-
placeholder: (t == null ? void 0 : t.placeholder) ?? "Write here...",
|
|
4017
|
-
...o
|
|
4018
|
-
}
|
|
4019
|
-
) }),
|
|
4020
|
-
/* @__PURE__ */ c(ce, { size: n, className: "pt-1" })
|
|
4021
|
-
] })
|
|
4022
|
-
}
|
|
4023
|
-
);
|
|
4024
|
-
}, Yn = I({
|
|
4025
|
-
base: "grid gap-2"
|
|
4026
|
-
}), xr = O.forwardRef(({ className: r, ...e }, t) => /* @__PURE__ */ c(
|
|
4027
|
-
Ve.Root,
|
|
4028
|
-
{
|
|
4029
|
-
className: Yn({ className: r }),
|
|
4030
|
-
...e,
|
|
4031
|
-
ref: t
|
|
4032
|
-
}
|
|
4033
|
-
));
|
|
4034
|
-
xr.displayName = Ve.Root.displayName;
|
|
4035
|
-
const Kn = I({
|
|
4036
|
-
slots: {
|
|
4037
|
-
item: [
|
|
4038
|
-
"aspect-square h-4 w-4 items-center rounded-full border border-accent text-accent ring-offset-background",
|
|
4039
|
-
"focus:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2",
|
|
4040
|
-
"disabled:cursor-not-allowed disabled:opacity-50"
|
|
4041
|
-
],
|
|
4042
|
-
indicator: "relative block h-full w-full",
|
|
4043
|
-
icon: "absolute left-1/2 top-1/2 h-2.5 w-2.5 -translate-x-1/2 -translate-y-1/2 transform fill-current text-current"
|
|
4044
|
-
}
|
|
4045
|
-
}), wr = O.forwardRef(({ className: r, ...e }, t) => {
|
|
4046
|
-
const { item: a, indicator: s, icon: n } = Kn();
|
|
4047
|
-
return /* @__PURE__ */ c(
|
|
4048
|
-
Ve.Item,
|
|
4049
|
-
{
|
|
4050
|
-
ref: t,
|
|
4051
|
-
className: a({
|
|
4052
|
-
className: r
|
|
4053
|
-
}),
|
|
4054
|
-
...e,
|
|
4055
|
-
children: /* @__PURE__ */ c(Ve.Indicator, { className: s(), children: /* @__PURE__ */ c(Hr, { className: n() }) })
|
|
4056
|
-
}
|
|
4057
|
-
);
|
|
4058
|
-
});
|
|
4059
|
-
wr.displayName = Ve.Item.displayName;
|
|
4060
|
-
const kr = "", Qn = ({ label: r, bind: e, items: t, options: a }) => {
|
|
4061
|
-
const { control: s } = ie(), { size: n } = U(), i = a == null ? void 0 : a.optionalField;
|
|
4062
|
-
return /* @__PURE__ */ c(
|
|
4063
|
-
he,
|
|
4064
|
-
{
|
|
4065
|
-
defaultValue: kr,
|
|
4066
|
-
control: s,
|
|
4067
|
-
name: e,
|
|
4068
|
-
rules: {
|
|
4069
|
-
required: i ? !1 : (a == null ? void 0 : a.error) ?? !0
|
|
4070
|
-
},
|
|
4071
|
-
render: ({ field: o }) => /* @__PURE__ */ T(Q, { className: "space-y-3", children: [
|
|
4072
|
-
/* @__PURE__ */ T("div", { className: "space-y-1", children: [
|
|
4073
|
-
/* @__PURE__ */ T(X, { size: n, children: [
|
|
4074
|
-
r,
|
|
4075
|
-
i ? /* @__PURE__ */ c(Z, {}) : /* @__PURE__ */ c("span", { className: "ml-0.5 inline-block", children: /* @__PURE__ */ c(_e, { className: "h-3 w-3 text-destructive" }) })
|
|
4076
|
-
] }),
|
|
4077
|
-
a != null && a.description ? /* @__PURE__ */ c(oe, { size: n, children: a.description }) : /* @__PURE__ */ c(Z, {})
|
|
4078
|
-
] }),
|
|
4079
|
-
/* @__PURE__ */ c(ee, { children: /* @__PURE__ */ c(
|
|
4080
|
-
xr,
|
|
4081
|
-
{
|
|
4082
|
-
ref: o.ref,
|
|
4083
|
-
value: o.value,
|
|
4084
|
-
onValueChange: o.onChange,
|
|
4085
|
-
children: t == null ? void 0 : t.map((d) => d.type === "item" ? /* @__PURE__ */ T(
|
|
4086
|
-
Q,
|
|
4087
|
-
{
|
|
4088
|
-
className: "flex items-center space-x-2 space-y-0",
|
|
4089
|
-
children: [
|
|
4090
|
-
/* @__PURE__ */ c(ee, { children: /* @__PURE__ */ c(wr, { value: d.bind }) }),
|
|
4091
|
-
/* @__PURE__ */ c(X, { size: n, className: "font-normal", children: d.label })
|
|
4092
|
-
]
|
|
4093
|
-
},
|
|
4094
|
-
d.id
|
|
4095
|
-
) : null)
|
|
4096
|
-
}
|
|
4097
|
-
) }),
|
|
4098
|
-
/* @__PURE__ */ c(ce, { size: n })
|
|
4099
|
-
] })
|
|
4100
|
-
}
|
|
4101
|
-
);
|
|
4102
|
-
}, Xn = ({ label: r }) => {
|
|
4103
|
-
const { size: e } = U();
|
|
4104
|
-
return /* @__PURE__ */ c("div", { className: "flex w-full justify-center pt-2", children: /* @__PURE__ */ c(kt, { size: e, children: r }) });
|
|
4105
|
-
}, es = I({
|
|
4106
|
-
slots: {
|
|
4107
|
-
root: "relative",
|
|
4108
|
-
textarea: [
|
|
4109
|
-
"flex min-h-[60px] w-full border-input bg-background py-2 text-primary-foreground shadow-sm placeholder:text-muted-foreground focus-visible:outline-none",
|
|
4110
|
-
"disabled:cursor-not-allowed disabled:opacity-50"
|
|
4111
|
-
]
|
|
4112
|
-
},
|
|
4113
|
-
variants: {
|
|
4114
|
-
variant: {
|
|
4115
|
-
default: {
|
|
4116
|
-
textarea: "rounded-md border px-3 ring-offset-background focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2"
|
|
4117
|
-
},
|
|
4118
|
-
outline: {
|
|
4119
|
-
root: 'after:absolute after:left-0 after:top-[calc(100%_+_1px)] after:w-full after:rounded-full after:content-[""] focus-within:after:h-0.5 focus-within:after:bg-ring',
|
|
4120
|
-
textarea: "border-b px-1"
|
|
4121
|
-
}
|
|
4122
|
-
},
|
|
4123
|
-
size: {
|
|
4124
|
-
sm: {
|
|
4125
|
-
textarea: "text-sm"
|
|
4126
|
-
},
|
|
4127
|
-
base: {
|
|
4128
|
-
textarea: "text-base"
|
|
4129
|
-
}
|
|
4130
|
-
}
|
|
4131
|
-
},
|
|
4132
|
-
defaultVariants: {
|
|
4133
|
-
variant: "default",
|
|
4134
|
-
size: "base"
|
|
4135
|
-
}
|
|
4136
|
-
}), Nr = O.forwardRef(
|
|
4137
|
-
({ variant: r, size: e, className: t, ...a }, s) => {
|
|
4138
|
-
const { root: n, textarea: i } = es({ size: e, variant: r });
|
|
4139
|
-
return /* @__PURE__ */ c("div", { className: n(), children: /* @__PURE__ */ c(
|
|
4140
|
-
"textarea",
|
|
4141
|
-
{
|
|
4142
|
-
className: i({
|
|
4143
|
-
className: t
|
|
4144
|
-
}),
|
|
4145
|
-
ref: s,
|
|
4146
|
-
...a
|
|
4147
|
-
}
|
|
4148
|
-
) });
|
|
4149
|
-
}
|
|
4150
|
-
);
|
|
4151
|
-
Nr.displayName = "Textarea";
|
|
4152
|
-
const Tr = "", ts = ({ label: r, bind: e, options: t }) => {
|
|
4153
|
-
const { control: a } = ie(), { variant: s, size: n } = U(), i = t == null ? void 0 : t.optionalField;
|
|
4154
|
-
return /* @__PURE__ */ c(
|
|
4155
|
-
he,
|
|
4156
|
-
{
|
|
4157
|
-
defaultValue: Tr,
|
|
4158
|
-
control: a,
|
|
4159
|
-
name: e,
|
|
4160
|
-
rules: {
|
|
4161
|
-
required: i ? !1 : (t == null ? void 0 : t.error) ?? !0
|
|
4162
|
-
},
|
|
4163
|
-
render: ({ field: o }) => /* @__PURE__ */ T(Q, { variant: s, children: [
|
|
4164
|
-
/* @__PURE__ */ T("div", { className: "space-y-1", children: [
|
|
4165
|
-
/* @__PURE__ */ T(X, { size: n, children: [
|
|
4166
|
-
r,
|
|
4167
|
-
i ? /* @__PURE__ */ c(Z, {}) : /* @__PURE__ */ c("span", { className: "ml-0.5 inline-block", children: /* @__PURE__ */ c(_e, { className: "h-3 w-3 text-destructive" }) })
|
|
4168
|
-
] }),
|
|
4169
|
-
t != null && t.description ? /* @__PURE__ */ c(oe, { size: n, children: t.description }) : /* @__PURE__ */ c(Z, {})
|
|
4170
|
-
] }),
|
|
4171
|
-
/* @__PURE__ */ c(ee, { children: /* @__PURE__ */ c(
|
|
4172
|
-
Nr,
|
|
4173
|
-
{
|
|
4174
|
-
...o,
|
|
4175
|
-
size: n,
|
|
4176
|
-
variant: s,
|
|
4177
|
-
placeholder: (t == null ? void 0 : t.placeholder) ?? "Write here..."
|
|
4178
|
-
}
|
|
4179
|
-
) }),
|
|
4180
|
-
/* @__PURE__ */ c(ce, { size: n, className: "pt-1" })
|
|
4181
|
-
] })
|
|
4182
|
-
}
|
|
4183
|
-
);
|
|
4184
|
-
}, rs = I({
|
|
4185
|
-
slots: {
|
|
4186
|
-
root: [
|
|
4187
|
-
"peer inline-flex h-5 w-9 shrink-0 cursor-pointer items-center rounded-full border-2 border-transparent shadow-sm transition-colors",
|
|
4188
|
-
"focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 focus-visible:ring-offset-background",
|
|
4189
|
-
"disabled:cursor-not-allowed disabled:opacity-50",
|
|
4190
|
-
"data-[state=checked]:bg-accent data-[state=unchecked]:bg-muted"
|
|
4191
|
-
],
|
|
4192
|
-
thumb: [
|
|
4193
|
-
"pointer-events-none block h-4 w-4 rounded-full bg-background shadow-lg ring-0 transition-transform",
|
|
4194
|
-
"data-[state=checked]:translate-x-4 data-[state=unchecked]:translate-x-0"
|
|
4195
|
-
]
|
|
4196
|
-
}
|
|
4197
|
-
}), Cr = O.forwardRef(({ className: r, ...e }, t) => {
|
|
4198
|
-
const { root: a, thumb: s } = rs();
|
|
4199
|
-
return /* @__PURE__ */ c(
|
|
4200
|
-
ft.Root,
|
|
4201
|
-
{
|
|
4202
|
-
className: a({
|
|
4203
|
-
className: r
|
|
4204
|
-
}),
|
|
4205
|
-
...e,
|
|
4206
|
-
ref: t,
|
|
4207
|
-
children: /* @__PURE__ */ c(ft.Thumb, { className: s() })
|
|
4208
|
-
}
|
|
4209
|
-
);
|
|
4210
|
-
});
|
|
4211
|
-
Cr.displayName = ft.Root.displayName;
|
|
4212
|
-
const Ar = !1, as = ({ label: r, bind: e, options: t }) => {
|
|
4213
|
-
const { control: a } = ie(), { variant: s, size: n } = U(), i = t == null ? void 0 : t.optionalField;
|
|
4214
|
-
return /* @__PURE__ */ c(
|
|
4215
|
-
he,
|
|
4216
|
-
{
|
|
4217
|
-
defaultValue: Ar,
|
|
4218
|
-
control: a,
|
|
4219
|
-
name: e,
|
|
4220
|
-
rules: {
|
|
4221
|
-
required: i ? !1 : (t == null ? void 0 : t.error) ?? !0
|
|
4222
|
-
},
|
|
4223
|
-
render: ({ field: o }) => /* @__PURE__ */ T(Q, { variant: s, children: [
|
|
4224
|
-
/* @__PURE__ */ T("div", { className: "flex flex-row items-center justify-between", children: [
|
|
4225
|
-
/* @__PURE__ */ T("div", { className: "space-y-1", children: [
|
|
4226
|
-
/* @__PURE__ */ T(X, { htmlFor: e, size: n, children: [
|
|
4227
|
-
r,
|
|
4228
|
-
i ? /* @__PURE__ */ c(Z, {}) : /* @__PURE__ */ c("span", { className: "ml-0.5 inline-block", children: /* @__PURE__ */ c(_e, { className: "h-3 w-3 text-destructive" }) })
|
|
4229
|
-
] }),
|
|
4230
|
-
t != null && t.description ? /* @__PURE__ */ c(oe, { size: n, children: t.description }) : /* @__PURE__ */ c(Z, {})
|
|
4231
|
-
] }),
|
|
4232
|
-
/* @__PURE__ */ c(ee, { children: /* @__PURE__ */ c(
|
|
4233
|
-
Cr,
|
|
4234
|
-
{
|
|
4235
|
-
id: e,
|
|
4236
|
-
ref: o.ref,
|
|
4237
|
-
checked: o.value,
|
|
4238
|
-
onCheckedChange: o.onChange,
|
|
4239
|
-
className: "!my-0"
|
|
4240
|
-
}
|
|
4241
|
-
) })
|
|
4242
|
-
] }),
|
|
4243
|
-
/* @__PURE__ */ c(ce, { size: n })
|
|
4244
|
-
] })
|
|
4245
|
-
}
|
|
4246
|
-
);
|
|
4247
|
-
}, Lt = I({
|
|
4248
|
-
slots: {
|
|
4249
|
-
root: "relative flex w-11 touch-none select-none items-center",
|
|
4250
|
-
track: "relative h-5 w-full grow overflow-hidden rounded-full bg-muted",
|
|
4251
|
-
range: "absolute h-full bg-accent",
|
|
4252
|
-
thumb: "relative block h-4 w-4 rounded-full border-2 border-transparent bg-background shadow-lg focus-visible:outline-none focus-visible:ring-0 disabled:pointer-events-none disabled:opacity-50"
|
|
4253
|
-
},
|
|
4254
|
-
variants: {
|
|
4255
|
-
state: {
|
|
4256
|
-
// false
|
|
4257
|
-
0: {
|
|
4258
|
-
thumb: "left-0.5"
|
|
4259
|
-
},
|
|
4260
|
-
// null
|
|
4261
|
-
1: {
|
|
4262
|
-
thumb: "h-5 w-5 border-accent"
|
|
4263
|
-
},
|
|
4264
|
-
// true
|
|
4265
|
-
2: {
|
|
4266
|
-
thumb: "right-0.5"
|
|
4267
|
-
}
|
|
4268
|
-
}
|
|
4269
|
-
},
|
|
4270
|
-
defaultVariants: {
|
|
4271
|
-
state: 1
|
|
4272
|
-
}
|
|
4273
|
-
}), Rr = O.forwardRef(({ className: r, ...e }, t) => {
|
|
4274
|
-
var d;
|
|
4275
|
-
const a = (d = e.value) == null ? void 0 : d[0], { root: s, track: n, range: i, thumb: o } = Lt({
|
|
4276
|
-
state: a
|
|
4277
|
-
});
|
|
4278
|
-
return /* @__PURE__ */ T(
|
|
4279
|
-
Ee.Root,
|
|
4280
|
-
{
|
|
4281
|
-
disabled: !0,
|
|
4282
|
-
ref: t,
|
|
4283
|
-
className: s({
|
|
4284
|
-
className: r
|
|
4285
|
-
}),
|
|
4286
|
-
onClick: (l) => {
|
|
4287
|
-
var h;
|
|
4288
|
-
if (l.preventDefault(), a !== void 0) {
|
|
4289
|
-
const x = Object.keys(Lt.variants.state), M = x.indexOf(a.toString()), P = M === x.length - 1 ? 0 : M + 1;
|
|
4290
|
-
(h = e.onValueChange) == null || h.call(e, [P]);
|
|
4291
|
-
}
|
|
4292
|
-
},
|
|
4293
|
-
...e,
|
|
4294
|
-
children: [
|
|
4295
|
-
/* @__PURE__ */ c(Ee.Track, { className: n(), children: /* @__PURE__ */ c(Ee.Range, { className: i() }) }),
|
|
4296
|
-
/* @__PURE__ */ c(Ee.Thumb, { className: o() })
|
|
4297
|
-
]
|
|
4298
|
-
}
|
|
4299
|
-
);
|
|
4300
|
-
});
|
|
4301
|
-
Rr.displayName = Ee.Root.displayName;
|
|
4302
|
-
const Sr = null, ns = ({ label: r, bind: e, options: t }) => {
|
|
4303
|
-
const { control: a } = ie(), { variant: s, size: n } = U();
|
|
4304
|
-
return /* @__PURE__ */ c(
|
|
4305
|
-
he,
|
|
4306
|
-
{
|
|
4307
|
-
defaultValue: Sr,
|
|
4308
|
-
control: a,
|
|
4309
|
-
name: e,
|
|
4310
|
-
rules: {
|
|
4311
|
-
required: !1
|
|
4312
|
-
},
|
|
4313
|
-
render: ({ field: i }) => /* @__PURE__ */ T(Q, { variant: s, children: [
|
|
4314
|
-
/* @__PURE__ */ T("div", { className: "flex flex-row items-center justify-between", children: [
|
|
4315
|
-
/* @__PURE__ */ T("div", { className: "space-y-1", children: [
|
|
4316
|
-
/* @__PURE__ */ c(X, { htmlFor: e, size: n, children: r }),
|
|
4317
|
-
t != null && t.description ? /* @__PURE__ */ c(oe, { size: n, children: t.description }) : /* @__PURE__ */ c(Z, {})
|
|
4318
|
-
] }),
|
|
4319
|
-
/* @__PURE__ */ c(ee, { children: /* @__PURE__ */ c(
|
|
4320
|
-
Rr,
|
|
4321
|
-
{
|
|
4322
|
-
id: e,
|
|
4323
|
-
ref: i.ref,
|
|
4324
|
-
min: 0,
|
|
4325
|
-
max: 2,
|
|
4326
|
-
step: 1,
|
|
4327
|
-
value: [
|
|
4328
|
-
i.value === !0 ? 2 : i.value === null ? 1 : 0
|
|
4329
|
-
],
|
|
4330
|
-
onValueChange: (o) => {
|
|
4331
|
-
i.onChange(
|
|
4332
|
-
o[0] === 2 ? !0 : o[0] === 1 ? null : !1
|
|
4333
|
-
);
|
|
4334
|
-
}
|
|
4335
|
-
}
|
|
4336
|
-
) })
|
|
4337
|
-
] }),
|
|
4338
|
-
/* @__PURE__ */ c(ce, { size: n })
|
|
4339
|
-
] })
|
|
4340
|
-
}
|
|
4341
|
-
);
|
|
4342
|
-
}, ss = ({ subtype: r, ...e }) => {
|
|
4343
|
-
var a;
|
|
4344
|
-
const t = (a = Or.get(r)) == null ? void 0 : a.component;
|
|
4345
|
-
return t ? /* @__PURE__ */ c(t, { ...e }) : /* @__PURE__ */ c(Z, {});
|
|
4346
|
-
}, is = ({ label: r }) => /* @__PURE__ */ c(wt, { children: r }), Er = (/* @__PURE__ */ new Map()).set("category", ur).set("accordion", On), Or = (/* @__PURE__ */ new Map()).set("simple", {
|
|
4347
|
-
defaultValue: br,
|
|
4348
|
-
component: Hn
|
|
4349
|
-
}).set("textarea", {
|
|
4350
|
-
defaultValue: Tr,
|
|
4351
|
-
component: ts
|
|
4352
|
-
}).set("toggle", {
|
|
4353
|
-
defaultValue: Ar,
|
|
4354
|
-
component: as
|
|
4355
|
-
}).set("file", {
|
|
4356
|
-
defaultValue: _r,
|
|
4357
|
-
component: Jn
|
|
4358
|
-
}).set("submit", {
|
|
4359
|
-
component: Xn
|
|
4360
|
-
}).set("checkbox", {
|
|
4361
|
-
defaultValue: pr,
|
|
4362
|
-
component: Ln
|
|
4363
|
-
}).set("radiogroup", {
|
|
4364
|
-
defaultValue: kr,
|
|
4365
|
-
component: Qn
|
|
4366
|
-
}).set("datepicker", {
|
|
4367
|
-
defaultValue: yr,
|
|
4368
|
-
component: qn
|
|
4369
|
-
}).set("tri-toggle", {
|
|
4370
|
-
defaultValue: Sr,
|
|
4371
|
-
component: ns
|
|
4372
|
-
}), os = new Map(Er).set("input", ss).set("label", is), cs = Ft(
|
|
4373
|
-
({ defaultValues: r, resetOnSubmit: e, children: t }, a) => {
|
|
4374
|
-
const { resetValues: s } = U(), n = Fr(null), i = ea({
|
|
4375
|
-
defaultValues: r
|
|
4376
|
-
});
|
|
4377
|
-
Dr(a, () => n.current), Et(() => {
|
|
4378
|
-
i.formState.isSubmitSuccessful && e && r && i.reset(s || r);
|
|
4379
|
-
}, [i.formState, r]);
|
|
4380
|
-
const o = (x) => {
|
|
4381
|
-
var P;
|
|
4382
|
-
const M = new CustomEvent("twintag-form-valid", {
|
|
4383
|
-
detail: x,
|
|
4384
|
-
bubbles: !0,
|
|
4385
|
-
cancelable: !1,
|
|
4386
|
-
composed: !0
|
|
4387
|
-
});
|
|
4388
|
-
(P = n.current) == null || P.dispatchEvent(M);
|
|
4389
|
-
}, d = (x) => {
|
|
4390
|
-
var P;
|
|
4391
|
-
const M = new CustomEvent("twintag-form-invalid", {
|
|
4392
|
-
detail: x,
|
|
4393
|
-
bubbles: !0,
|
|
4394
|
-
cancelable: !1,
|
|
4395
|
-
composed: !0
|
|
4396
|
-
});
|
|
4397
|
-
(P = n.current) == null || P.dispatchEvent(M);
|
|
4398
|
-
}, l = () => {
|
|
4399
|
-
i.handleSubmit(o, d)();
|
|
4400
|
-
}, h = () => {
|
|
4401
|
-
var P;
|
|
4402
|
-
const x = i.getValues(), M = new CustomEvent("twintag-form-values", {
|
|
4403
|
-
detail: x,
|
|
4404
|
-
bubbles: !0,
|
|
4405
|
-
cancelable: !1,
|
|
4406
|
-
composed: !0
|
|
4407
|
-
});
|
|
4408
|
-
(P = n.current) == null || P.dispatchEvent(M);
|
|
4409
|
-
};
|
|
4410
|
-
return Et(() => {
|
|
4411
|
-
const x = n.current;
|
|
4412
|
-
return x && (x.addEventListener("twintag-form-validate", l), x.addEventListener("twintag-form-get_values", h)), () => {
|
|
4413
|
-
x && (x.removeEventListener("twintag-form-validate", l), x.removeEventListener("twintag-form-get_values", h));
|
|
4414
|
-
};
|
|
4415
|
-
}, []), /* @__PURE__ */ c(jn, { ...i, children: /* @__PURE__ */ c(
|
|
4416
|
-
"form",
|
|
4417
|
-
{
|
|
4418
|
-
ref: n,
|
|
4419
|
-
className: "relative flex w-full flex-col gap-4 font-tf-font",
|
|
4420
|
-
onSubmit: i.handleSubmit(o, d),
|
|
4421
|
-
children: t
|
|
4422
|
-
}
|
|
4423
|
-
) });
|
|
4424
|
-
}
|
|
4425
|
-
), bt = ({ config: r }) => {
|
|
4426
|
-
const { id: e, type: t, items: a, comp: s, ...n } = r;
|
|
4427
|
-
if (!t || !s) return /* @__PURE__ */ c(Z, {});
|
|
4428
|
-
const i = s;
|
|
4429
|
-
return a && Array.isArray(a) && a.length > 0 ? Er.has(t) ? /* @__PURE__ */ c(i, { items: a, ...n, children: a.map((o) => /* @__PURE__ */ c(bt, { config: { ...o } }, o.id)) }, e) : /* @__PURE__ */ c(i, { items: a, ...n }, e) : /* @__PURE__ */ c(i, { ...n }, e);
|
|
4430
|
-
}, ds = () => {
|
|
4431
|
-
const { config: r } = U();
|
|
4432
|
-
return Array.isArray(r) ? /* @__PURE__ */ c(Z, { children: r.map((e) => /* @__PURE__ */ c(bt, { config: { ...e } }, e.id)) }) : /* @__PURE__ */ c(bt, { config: r });
|
|
4433
|
-
}, bs = Ft(
|
|
4434
|
-
({ config: r, options: e }, t) => /* @__PURE__ */ c(
|
|
4435
|
-
Sn,
|
|
4436
|
-
{
|
|
4437
|
-
inputs: Or,
|
|
4438
|
-
components: os,
|
|
4439
|
-
variant: e == null ? void 0 : e.variant,
|
|
4440
|
-
size: e == null ? void 0 : e.size,
|
|
4441
|
-
config: r,
|
|
4442
|
-
children: /* @__PURE__ */ c(
|
|
4443
|
-
cs,
|
|
4444
|
-
{
|
|
4445
|
-
ref: t,
|
|
4446
|
-
defaultValues: e == null ? void 0 : e.defaultValues,
|
|
4447
|
-
resetOnSubmit: e == null ? void 0 : e.resetOnSubmit,
|
|
4448
|
-
children: /* @__PURE__ */ c(ds, {})
|
|
4449
|
-
}
|
|
4450
|
-
)
|
|
4451
|
-
}
|
|
4452
|
-
)
|
|
4453
|
-
);
|
|
4454
|
-
export {
|
|
4455
|
-
bs as Form
|
|
4456
|
-
};
|