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