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