@gengage/assistant-fe 0.4.4 → 0.4.6
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/README.md +1 -1
- package/dist/api-paths-C4GDpeTf.js +1214 -0
- package/dist/chat/index.d.ts +1 -374
- package/dist/chat/runtime.d.ts +374 -0
- package/dist/chat/types.d.ts +1 -1
- package/dist/chat-BRKK63lt.js +303 -0
- package/dist/chat-runtime.js +13 -0
- package/dist/chat.iife.js +7 -7
- package/dist/chat.js +11 -10
- package/dist/common/config-constants.d.ts +1 -0
- package/dist/common/config-schema.d.ts +0 -1
- package/dist/common/overlay.d.ts +4 -4
- package/dist/common-CEN5OW7E.js +491 -0
- package/dist/common.js +78 -76
- package/dist/{connection-warning-n88bjkqL.js → connection-warning-B6oIU-9s.js} +1 -1
- package/dist/context-VIG4SVcS.js +529 -0
- package/dist/index.js +70 -67
- package/dist/locale-CfqNifrU.js +7 -0
- package/dist/native-webview-DudQ7nHe.js +273 -0
- package/dist/native.iife.js +28 -91
- package/dist/native.js +1 -1
- package/dist/overlay-1EO41ZC7.js +212 -0
- package/dist/overlay.d.ts +4 -0
- package/dist/overlay.js +10 -0
- package/dist/pill-launcher-57nrdLRr.js +364 -0
- package/dist/qna/index.d.ts +1 -61
- package/dist/qna/runtime.d.ts +61 -0
- package/dist/qna-BNvttR6s.js +40 -0
- package/dist/qna-runtime.js +8 -0
- package/dist/qna.iife.js +4 -4
- package/dist/qna.js +6 -5
- package/dist/{simrel-K2TGFi1r.js → runtime-BdwZZIrO.js} +244 -293
- package/dist/{chat-DI7Vm0gh.js → runtime-C0qZk0y7.js} +1644 -2298
- package/dist/{qna-C5Ok3wd0.js → runtime-DDu8Wk0z.js} +87 -121
- package/dist/schemas-CLo8wCjs.js +3207 -0
- package/dist/{simbut-Cb5RfaAp.js → simbut-BMWC6x_t.js} +24 -22
- package/dist/simbut.js +1 -1
- package/dist/simrel/index.d.ts +1 -59
- package/dist/simrel/runtime.d.ts +59 -0
- package/dist/simrel-ohfkluhp.js +55 -0
- package/dist/simrel-runtime.js +8 -0
- package/dist/simrel.iife.js +4 -4
- package/dist/simrel.js +7 -6
- package/dist/widget-base-TgwiA8cD.js +578 -0
- package/package.json +17 -1
- package/dist/common-BxSi3UWt.js +0 -387
- package/dist/locale-MM0U5eeR.js +0 -1109
- package/dist/native-webview-DFqnyus6.js +0 -586
- package/dist/schemas-JpRGzRQT.js +0 -4419
- /package/dist/{price-formatter-CR6VT5z4.js → price-formatter-xI3g9Cd4.js} +0 -0
package/dist/schemas-JpRGzRQT.js
DELETED
|
@@ -1,4419 +0,0 @@
|
|
|
1
|
-
import { r as jt } from "./locale-MM0U5eeR.js";
|
|
2
|
-
var Ct = ({ element: e, renderElement: t }) => {
|
|
3
|
-
if (!e.children || e.children.length === 0) return null;
|
|
4
|
-
const r = document.createElement("div");
|
|
5
|
-
for (const n of e.children) {
|
|
6
|
-
const o = t(n);
|
|
7
|
-
o && r.appendChild(o);
|
|
8
|
-
}
|
|
9
|
-
return r;
|
|
10
|
-
};
|
|
11
|
-
function za(e) {
|
|
12
|
-
const t = document.createElement("div");
|
|
13
|
-
if (t.className = e.containerClassName, !e.spec.elements[e.spec.root]) return t;
|
|
14
|
-
const r = e.unknownRenderer ?? Ct, n = (i) => {
|
|
15
|
-
const s = e.spec.elements[i];
|
|
16
|
-
if (!s) return null;
|
|
17
|
-
const a = e.registry[s.type];
|
|
18
|
-
return a ? a({
|
|
19
|
-
elementId: i,
|
|
20
|
-
element: s,
|
|
21
|
-
spec: e.spec,
|
|
22
|
-
context: e.context,
|
|
23
|
-
renderElement: n
|
|
24
|
-
}) : r({
|
|
25
|
-
elementId: i,
|
|
26
|
-
element: s,
|
|
27
|
-
spec: e.spec,
|
|
28
|
-
context: e.context,
|
|
29
|
-
renderElement: n
|
|
30
|
-
});
|
|
31
|
-
}, o = n(e.spec.root);
|
|
32
|
-
return o && t.appendChild(o), t;
|
|
33
|
-
}
|
|
34
|
-
function $a(e, t) {
|
|
35
|
-
if (!t) return e;
|
|
36
|
-
const r = { ...e };
|
|
37
|
-
for (const [n, o] of Object.entries(t))
|
|
38
|
-
o && (r[n] = o);
|
|
39
|
-
return r;
|
|
40
|
-
}
|
|
41
|
-
function Ze(e) {
|
|
42
|
-
return typeof e == "object" && e !== null && typeof e.type == "string";
|
|
43
|
-
}
|
|
44
|
-
function xt(e) {
|
|
45
|
-
const t = [];
|
|
46
|
-
let r = 0, n = !1, o = !1, i = 0;
|
|
47
|
-
for (let s = 0; s < e.length; s++) {
|
|
48
|
-
const a = e[s];
|
|
49
|
-
if (o) {
|
|
50
|
-
o = !1;
|
|
51
|
-
continue;
|
|
52
|
-
}
|
|
53
|
-
if (a === "\\" && n) {
|
|
54
|
-
o = !0;
|
|
55
|
-
continue;
|
|
56
|
-
}
|
|
57
|
-
if (a === '"') {
|
|
58
|
-
n = !n;
|
|
59
|
-
continue;
|
|
60
|
-
}
|
|
61
|
-
n || (a === "{" && r++, a === "}" && (r--, r === 0 && (t.push(e.slice(i, s + 1)), i = s + 1)));
|
|
62
|
-
}
|
|
63
|
-
return t.length > 0 ? t : [e];
|
|
64
|
-
}
|
|
65
|
-
function Oe(e, t) {
|
|
66
|
-
const r = e.trim();
|
|
67
|
-
if (!r || r.startsWith(":")) return !1;
|
|
68
|
-
const n = r.startsWith("data: ") ? r.slice(6) : r;
|
|
69
|
-
if (n === "[DONE]")
|
|
70
|
-
return t.onDone?.(), !0;
|
|
71
|
-
try {
|
|
72
|
-
const o = JSON.parse(n);
|
|
73
|
-
return Ze(o) ? (jt("stream", `event: ${o.type}`, o), t.onEvent(o), o.type === "done" ? (t.onDone?.(), !0) : !1) : !1;
|
|
74
|
-
} catch {
|
|
75
|
-
const o = xt(n);
|
|
76
|
-
if (o.length > 1) {
|
|
77
|
-
for (const i of o) try {
|
|
78
|
-
const s = JSON.parse(i);
|
|
79
|
-
if (!Ze(s)) continue;
|
|
80
|
-
if (t.onEvent(s), s.type === "done")
|
|
81
|
-
return t.onDone?.(), !0;
|
|
82
|
-
} catch {
|
|
83
|
-
}
|
|
84
|
-
return !1;
|
|
85
|
-
}
|
|
86
|
-
return !1;
|
|
87
|
-
}
|
|
88
|
-
}
|
|
89
|
-
async function Dt(e, t) {
|
|
90
|
-
if (!e.ok) {
|
|
91
|
-
t.onError?.(/* @__PURE__ */ new Error(`HTTP ${e.status}: ${e.statusText}`));
|
|
92
|
-
return;
|
|
93
|
-
}
|
|
94
|
-
if (!e.body) {
|
|
95
|
-
t.onError?.(/* @__PURE__ */ new Error("Response body is null — streaming not supported"));
|
|
96
|
-
return;
|
|
97
|
-
}
|
|
98
|
-
const r = e.body.getReader(), n = new TextDecoder("utf-8");
|
|
99
|
-
let o = "";
|
|
100
|
-
const i = t.idleTimeoutMs ?? 6e4, s = /* @__PURE__ */ Symbol("idle-timeout");
|
|
101
|
-
let a = !1;
|
|
102
|
-
try {
|
|
103
|
-
for (; ; ) {
|
|
104
|
-
const u = r.read();
|
|
105
|
-
let c;
|
|
106
|
-
const d = await (i > 0 ? Promise.race([u.then((m) => (clearTimeout(c), m)), new Promise((m) => {
|
|
107
|
-
c = setTimeout(() => m(s), i);
|
|
108
|
-
})]) : u);
|
|
109
|
-
if (d === s) {
|
|
110
|
-
a = !0, await r.cancel();
|
|
111
|
-
break;
|
|
112
|
-
}
|
|
113
|
-
const { done: h, value: f } = d;
|
|
114
|
-
if (h) break;
|
|
115
|
-
o += n.decode(f, { stream: !0 });
|
|
116
|
-
const p = o.split(`
|
|
117
|
-
`);
|
|
118
|
-
o = p.pop() ?? "";
|
|
119
|
-
for (const m of p) if (Oe(m, t)) return;
|
|
120
|
-
}
|
|
121
|
-
if (o.trim() && Oe(o, t))
|
|
122
|
-
return;
|
|
123
|
-
} catch (u) {
|
|
124
|
-
if (u instanceof DOMException && u.name === "AbortError") return;
|
|
125
|
-
t.onError?.(u instanceof Error ? u : new Error(String(u)));
|
|
126
|
-
} finally {
|
|
127
|
-
a || r.releaseLock();
|
|
128
|
-
}
|
|
129
|
-
t.onDone?.();
|
|
130
|
-
}
|
|
131
|
-
function Sa(e, t, r) {
|
|
132
|
-
const n = new AbortController(), o = r.signal ? Ut([r.signal, n.signal]) : n.signal;
|
|
133
|
-
return fetch(e, {
|
|
134
|
-
method: "POST",
|
|
135
|
-
headers: {
|
|
136
|
-
"Content-Type": "application/json",
|
|
137
|
-
...r.headers
|
|
138
|
-
},
|
|
139
|
-
body: JSON.stringify(t),
|
|
140
|
-
signal: o
|
|
141
|
-
}).then((i) => Dt(i, {
|
|
142
|
-
...r,
|
|
143
|
-
signal: o
|
|
144
|
-
})).catch((i) => {
|
|
145
|
-
i instanceof DOMException && i.name === "AbortError" || r.onError?.(i instanceof Error ? i : new Error(String(i)));
|
|
146
|
-
}), n;
|
|
147
|
-
}
|
|
148
|
-
function Ut(e) {
|
|
149
|
-
const t = new AbortController(), r = [];
|
|
150
|
-
for (const n of e) {
|
|
151
|
-
if (n.aborted)
|
|
152
|
-
return t.abort(n.reason), t.signal;
|
|
153
|
-
const o = () => t.abort(n.reason);
|
|
154
|
-
n.addEventListener("abort", o, { once: !0 }), r.push(() => n.removeEventListener("abort", o));
|
|
155
|
-
}
|
|
156
|
-
return t.signal.addEventListener("abort", () => {
|
|
157
|
-
for (const n of r) n();
|
|
158
|
-
}, { once: !0 }), t.signal;
|
|
159
|
-
}
|
|
160
|
-
var Pe = 3, Lt = (e, t) => {
|
|
161
|
-
const r = e.replace(/\s+/g, " ").trim().replace(/^[,.;:!?•-]+|[,.;:!?•-]+$/g, "");
|
|
162
|
-
if (!r) return "";
|
|
163
|
-
const n = t?.stripLeadingStopWords ? r.replace(/^(?:daha|için)\s+/i, "").trim() : r;
|
|
164
|
-
return n ? n.split(/\s+/).slice(0, 3).join(" ").trim() : "";
|
|
165
|
-
}, ce = (e, t) => e ? e.split(/[•,;:/()]|(?:\sve\s)|(?:\sand\s)|(?:\sile\s)|(?:\sfor\s)|(?:\swith\s)/i).map((r) => Lt(r, t)).filter(Boolean) : [];
|
|
166
|
-
function Ft(e) {
|
|
167
|
-
const t = (e.display_keywords ?? []).flatMap((o) => ce(o, { stripLeadingStopWords: !0 })), r = t.filter((o, i) => t.indexOf(o) === i);
|
|
168
|
-
if (r.length > 0) return r.slice(0, Pe);
|
|
169
|
-
const n = [...ce(e.chosen_attribute, { stripLeadingStopWords: !0 }), ...ce(e.short_name)];
|
|
170
|
-
return n.filter((o, i) => n.indexOf(o) === i).slice(0, Pe);
|
|
171
|
-
}
|
|
172
|
-
function Mt(e) {
|
|
173
|
-
return Ft(e).join(" • ");
|
|
174
|
-
}
|
|
175
|
-
var Jt = ["beauty_consulting", "watch_expert"];
|
|
176
|
-
function Vt(e) {
|
|
177
|
-
return typeof e == "string" && Jt.includes(e);
|
|
178
|
-
}
|
|
179
|
-
function Za(e) {
|
|
180
|
-
if (typeof e.type != "string") return null;
|
|
181
|
-
if (qt(e)) return e;
|
|
182
|
-
const t = e;
|
|
183
|
-
switch (t.type) {
|
|
184
|
-
case "outputText":
|
|
185
|
-
return Gt(t);
|
|
186
|
-
case "suggestedActions":
|
|
187
|
-
return Wt(t);
|
|
188
|
-
case "productList":
|
|
189
|
-
return Bt(t);
|
|
190
|
-
case "productDetails":
|
|
191
|
-
return Kt(t);
|
|
192
|
-
case "productDetailsSimilars":
|
|
193
|
-
return Ht(t);
|
|
194
|
-
case "comparisonTable":
|
|
195
|
-
return Yt(t);
|
|
196
|
-
case "context":
|
|
197
|
-
return tr(t);
|
|
198
|
-
case "chatStreamEnd":
|
|
199
|
-
return rr();
|
|
200
|
-
case "loading":
|
|
201
|
-
return nr(t);
|
|
202
|
-
case "panelLoading":
|
|
203
|
-
return or(t);
|
|
204
|
-
case "similarLoading":
|
|
205
|
-
return ir(t);
|
|
206
|
-
case "redirect":
|
|
207
|
-
return sr(t);
|
|
208
|
-
case "error":
|
|
209
|
-
return ar(t);
|
|
210
|
-
case "dummy":
|
|
211
|
-
return ur(t);
|
|
212
|
-
case "launcherAction":
|
|
213
|
-
return cr(t);
|
|
214
|
-
case "text":
|
|
215
|
-
return me(t);
|
|
216
|
-
case "productItem":
|
|
217
|
-
return lr(t);
|
|
218
|
-
case "text_image":
|
|
219
|
-
return et(t);
|
|
220
|
-
case "quick_qna":
|
|
221
|
-
return tt(t);
|
|
222
|
-
case "reviewHighlights":
|
|
223
|
-
return dr(t);
|
|
224
|
-
case "aiProductSuggestions":
|
|
225
|
-
return hr(t);
|
|
226
|
-
case "aiProductGroupings":
|
|
227
|
-
return mr(t);
|
|
228
|
-
case "aiSuggestedSearches":
|
|
229
|
-
return gr(t);
|
|
230
|
-
case "prosAndCons":
|
|
231
|
-
return pr(t);
|
|
232
|
-
case "getGroundingReview":
|
|
233
|
-
return _r(t);
|
|
234
|
-
case "voice":
|
|
235
|
-
return yr(t);
|
|
236
|
-
case "visitorDataResponse":
|
|
237
|
-
return fr(t);
|
|
238
|
-
case "productListPreview":
|
|
239
|
-
return vr();
|
|
240
|
-
case "groupList":
|
|
241
|
-
return br(t);
|
|
242
|
-
case "formGetInfo":
|
|
243
|
-
case "formTestDrive":
|
|
244
|
-
case "formServiceRequest":
|
|
245
|
-
case "launchFormPage":
|
|
246
|
-
return wr(t);
|
|
247
|
-
case "launcherContent":
|
|
248
|
-
return zr(t);
|
|
249
|
-
case "handoff":
|
|
250
|
-
return kr(t);
|
|
251
|
-
case "uiSpec":
|
|
252
|
-
return Tr(t);
|
|
253
|
-
default:
|
|
254
|
-
return null;
|
|
255
|
-
}
|
|
256
|
-
}
|
|
257
|
-
function qt(e) {
|
|
258
|
-
const t = e.type;
|
|
259
|
-
if (typeof t != "string") return !1;
|
|
260
|
-
switch (t) {
|
|
261
|
-
case "metadata":
|
|
262
|
-
return typeof e.sessionId == "string" && typeof e.model == "string";
|
|
263
|
-
case "text_chunk":
|
|
264
|
-
return typeof e.content == "string";
|
|
265
|
-
case "ui_spec": {
|
|
266
|
-
const r = e.widget;
|
|
267
|
-
if (r !== "chat" && r !== "qna" && r !== "simrel") return !1;
|
|
268
|
-
const n = T(e.spec);
|
|
269
|
-
return n ? typeof n.root == "string" && T(n.elements) !== null : !1;
|
|
270
|
-
}
|
|
271
|
-
case "action": {
|
|
272
|
-
const r = T(e.action);
|
|
273
|
-
return r !== null && typeof r.kind == "string";
|
|
274
|
-
}
|
|
275
|
-
case "error":
|
|
276
|
-
return typeof e.code == "string" && typeof e.message == "string";
|
|
277
|
-
case "done":
|
|
278
|
-
return !0;
|
|
279
|
-
default:
|
|
280
|
-
return !1;
|
|
281
|
-
}
|
|
282
|
-
}
|
|
283
|
-
function Gt(e) {
|
|
284
|
-
const t = v(e.payload.text, e.payload.plain_text) ?? "", r = v(e.payload.plain_text, e.payload.text) ?? t;
|
|
285
|
-
if (e.payload.is_error) return {
|
|
286
|
-
type: "error",
|
|
287
|
-
code: "BACKEND_ERROR",
|
|
288
|
-
message: r || "Backend returned an error"
|
|
289
|
-
};
|
|
290
|
-
const n = {
|
|
291
|
-
type: "text_chunk",
|
|
292
|
-
content: t,
|
|
293
|
-
final: !0
|
|
294
|
-
}, o = e.payload.product_mentions;
|
|
295
|
-
Array.isArray(o) && o.length > 0 && (n.productMentions = o.filter((u) => typeof u == "object" && u !== null && typeof u.sku == "string" && typeof u.short_name == "string"));
|
|
296
|
-
const i = e.payload.sku_to_product_item;
|
|
297
|
-
i && typeof i == "object" && !Array.isArray(i) && (n.skuToProductItem = i);
|
|
298
|
-
const s = e.payload.conversation_mode;
|
|
299
|
-
typeof s == "string" && s && (n.conversationMode = s);
|
|
300
|
-
const a = e.payload.render_hint;
|
|
301
|
-
return typeof a == "string" && a && (n.renderHint = a), e.payload.kvkk === !0 && (n.kvkk = !0), n;
|
|
302
|
-
}
|
|
303
|
-
function Wt(e) {
|
|
304
|
-
return rt((e.payload.actions ?? []).map((t) => {
|
|
305
|
-
const r = v(t.title) ?? "", n = R(t.requestDetails, r), o = n ? {
|
|
306
|
-
label: r,
|
|
307
|
-
action: n
|
|
308
|
-
} : null;
|
|
309
|
-
return o ? (typeof t.icon == "string" && (o.icon = t.icon), typeof t.image == "string" && (o.image = t.image), o) : null;
|
|
310
|
-
}).filter(K), "chat");
|
|
311
|
-
}
|
|
312
|
-
function Bt(e) {
|
|
313
|
-
const t = (Array.isArray(e.payload.style_variations) ? e.payload.style_variations : []).map((s) => {
|
|
314
|
-
const a = v(s.style_label);
|
|
315
|
-
if (!a) return null;
|
|
316
|
-
const u = v(s.style_mood), c = v(s.image_url ?? void 0), d = (Array.isArray(s.product_list) ? s.product_list : []).map((f) => {
|
|
317
|
-
const p = T(f);
|
|
318
|
-
return p ? ge(T(p.product_detail) ?? T(p.product) ?? p) : null;
|
|
319
|
-
}).filter(K), h = Array.isArray(s.recommendation_groups) ? s.recommendation_groups.map((f) => ({
|
|
320
|
-
label: v(f.label) ?? "",
|
|
321
|
-
reason: v(f.reason) ?? "",
|
|
322
|
-
skus: Array.isArray(f.skus) ? f.skus.filter((p) => typeof p == "string" && p.trim().length > 0) : []
|
|
323
|
-
})) : [];
|
|
324
|
-
return {
|
|
325
|
-
style_label: a,
|
|
326
|
-
style_mood: u ?? "",
|
|
327
|
-
...c ? { image_url: c } : {},
|
|
328
|
-
...typeof s.status == "string" ? { status: s.status } : {},
|
|
329
|
-
product_list: d,
|
|
330
|
-
recommendation_groups: h
|
|
331
|
-
};
|
|
332
|
-
}).filter(K), r = e.payload.product_list ?? [], n = Vt(e.payload.source) && t.length > 0 ? t[0].product_list : null, o = n ? $r(n, "chat") : nt(r, "chat");
|
|
333
|
-
o.panelHint = "panel";
|
|
334
|
-
const i = o.spec.elements[o.spec.root];
|
|
335
|
-
if (i) {
|
|
336
|
-
const s = {};
|
|
337
|
-
typeof e.payload.offset == "number" && (s.offset = e.payload.offset), typeof e.payload.end_of_list == "boolean" && (s.endOfList = e.payload.end_of_list), typeof e.payload.title == "string" && (s.panelTitle = e.payload.title), typeof e.payload.source == "string" && (s.source = e.payload.source), t.length > 0 && (s.styleVariations = t), e.payload.replace_panel === !0 && (s.replacePanel = !0), (e.payload.ranking_state === "pending" || e.payload.ranking_state === "final") && (s.rankingState = e.payload.ranking_state);
|
|
338
|
-
const a = e.payload.sequence_id ?? e.payload.search_id;
|
|
339
|
-
typeof a == "string" && a.length > 0 && (s.sequenceId = a), Object.keys(s).length > 0 && (i.props = {
|
|
340
|
-
...i.props,
|
|
341
|
-
...s
|
|
342
|
-
});
|
|
343
|
-
}
|
|
344
|
-
return o;
|
|
345
|
-
}
|
|
346
|
-
function Kt(e) {
|
|
347
|
-
const t = e.payload.productDetails;
|
|
348
|
-
if (!t) return Zr("chat");
|
|
349
|
-
const r = x(t);
|
|
350
|
-
return {
|
|
351
|
-
type: "ui_spec",
|
|
352
|
-
widget: "chat",
|
|
353
|
-
spec: {
|
|
354
|
-
root: "root",
|
|
355
|
-
elements: { root: {
|
|
356
|
-
type: "ProductDetailsPanel",
|
|
357
|
-
props: { product: {
|
|
358
|
-
...t,
|
|
359
|
-
...r
|
|
360
|
-
} }
|
|
361
|
-
} }
|
|
362
|
-
},
|
|
363
|
-
panelHint: "panel"
|
|
364
|
-
};
|
|
365
|
-
}
|
|
366
|
-
function Ht(e) {
|
|
367
|
-
const t = nt(e.payload.similarProducts ?? [], "chat"), r = t.spec.elements[t.spec.root];
|
|
368
|
-
return r && (r.props = {
|
|
369
|
-
...r.props,
|
|
370
|
-
similarsAppend: !0
|
|
371
|
-
}), {
|
|
372
|
-
...t,
|
|
373
|
-
panelHint: "panel"
|
|
374
|
-
};
|
|
375
|
-
}
|
|
376
|
-
function Yt(e) {
|
|
377
|
-
const t = e.payload.multiple_product_details ?? [], r = e.payload, n = {
|
|
378
|
-
key_differences: r.key_differences,
|
|
379
|
-
recommended_choice: r.recommended_choice,
|
|
380
|
-
recommended_choice_sku: r.recommended_choice_sku,
|
|
381
|
-
special_considerations: r.special_considerations,
|
|
382
|
-
criteria_view: r.criteria_view,
|
|
383
|
-
criteria_view_short: r.criteria_view_short,
|
|
384
|
-
compared_field_names: r.compared_field_names,
|
|
385
|
-
winner_product: r.winner_product,
|
|
386
|
-
winner_hits: r.winner_hits,
|
|
387
|
-
...e.payload.product_comparison_framework ?? {}
|
|
388
|
-
}, o = e.payload.table, i = e.payload.features_list, s = [];
|
|
389
|
-
for (const w of t) {
|
|
390
|
-
const P = x(w);
|
|
391
|
-
s.push(P);
|
|
392
|
-
}
|
|
393
|
-
const a = Xt(o, s, n, i);
|
|
394
|
-
let u;
|
|
395
|
-
n?.recommended_choice_sku ? u = n.recommended_choice_sku : n?.winner_product && n.winner_product.length > 0 && (u = n.winner_product[0]?.product_detail?.sku ?? n.winner_product[0]?.sku);
|
|
396
|
-
const c = u ? s.find((w) => w.sku === u) ?? s[0] : s[0], d = [];
|
|
397
|
-
if (Array.isArray(n?.key_differences))
|
|
398
|
-
for (const w of n.key_differences) typeof w == "string" && d.push(w);
|
|
399
|
-
const h = Er(n?.special_considerations), f = n?.recommended_choice, p = n?.winner_hits, m = {};
|
|
400
|
-
for (const w of s) {
|
|
401
|
-
const P = w.sku;
|
|
402
|
-
P && (m[P] = {
|
|
403
|
-
title: w.name ?? P,
|
|
404
|
-
type: "launchSingleProduct",
|
|
405
|
-
payload: { sku: P }
|
|
406
|
-
});
|
|
407
|
-
}
|
|
408
|
-
const _ = {
|
|
409
|
-
products: s,
|
|
410
|
-
attributes: a,
|
|
411
|
-
highlights: d,
|
|
412
|
-
productActions: m
|
|
413
|
-
};
|
|
414
|
-
return c && (_.recommended = c), h.length > 0 && (_.specialCases = h), f && (_.recommendedText = f), p && (_.winnerHits = p), typeof n?.key_differences == "string" && (_.keyDifferencesHtml = n.key_differences), n?.special_considerations && (_.specialConsiderations = n.special_considerations), {
|
|
415
|
-
type: "ui_spec",
|
|
416
|
-
widget: "chat",
|
|
417
|
-
spec: {
|
|
418
|
-
root: "root",
|
|
419
|
-
elements: { root: {
|
|
420
|
-
type: "ComparisonTable",
|
|
421
|
-
props: _
|
|
422
|
-
} }
|
|
423
|
-
},
|
|
424
|
-
panelHint: "panel"
|
|
425
|
-
};
|
|
426
|
-
}
|
|
427
|
-
function Xt(e, t, r, n) {
|
|
428
|
-
if (!e) return [];
|
|
429
|
-
const o = Object.entries(e);
|
|
430
|
-
if (o.length === 0) return [];
|
|
431
|
-
const i = o[0]?.[1];
|
|
432
|
-
if (Array.isArray(i)) {
|
|
433
|
-
const h = r.criteria_view ?? r.criteria_view_short ?? {}, f = r.compared_field_names ?? Object.keys(e), p = [];
|
|
434
|
-
for (const m of f) {
|
|
435
|
-
const _ = e[m];
|
|
436
|
-
if (!_ || !Array.isArray(_)) continue;
|
|
437
|
-
const w = h[m] ?? m;
|
|
438
|
-
p.push({
|
|
439
|
-
label: w,
|
|
440
|
-
values: _.map((P) => typeof P == "string" ? P : String(P ?? ""))
|
|
441
|
-
});
|
|
442
|
-
}
|
|
443
|
-
return p;
|
|
444
|
-
}
|
|
445
|
-
const s = e, a = t.map((h) => String(h.sku ?? "")).filter((h) => h.length > 0), u = r.criteria_view ?? r.criteria_view_short ?? {}, c = (n && n.length > 0 ? n : r.compared_field_names && r.compared_field_names.length > 0 ? r.compared_field_names : Qt(s)).filter((h) => h !== "name" && h !== "name_short" && !h.endsWith("_short")), d = [];
|
|
446
|
-
for (const h of c) {
|
|
447
|
-
const f = a.map((m) => {
|
|
448
|
-
const _ = s[m];
|
|
449
|
-
if (!_ || typeof _ != "object") return "";
|
|
450
|
-
const w = _[`${h}_short`], P = _[h];
|
|
451
|
-
return er(w ?? P);
|
|
452
|
-
});
|
|
453
|
-
if (f.every((m) => m.length === 0)) continue;
|
|
454
|
-
const p = u[h] ?? h;
|
|
455
|
-
d.push({
|
|
456
|
-
label: p,
|
|
457
|
-
values: f
|
|
458
|
-
});
|
|
459
|
-
}
|
|
460
|
-
return d;
|
|
461
|
-
}
|
|
462
|
-
function Qt(e) {
|
|
463
|
-
const t = [], r = /* @__PURE__ */ new Set();
|
|
464
|
-
for (const n of Object.values(e))
|
|
465
|
-
if (!(!n || typeof n != "object"))
|
|
466
|
-
for (const o of Object.keys(n))
|
|
467
|
-
r.has(o) || (r.add(o), t.push(o));
|
|
468
|
-
return t;
|
|
469
|
-
}
|
|
470
|
-
function er(e) {
|
|
471
|
-
return typeof e == "string" ? e : typeof e == "number" || typeof e == "boolean" ? String(e) : "";
|
|
472
|
-
}
|
|
473
|
-
function tr(e) {
|
|
474
|
-
return {
|
|
475
|
-
type: "metadata",
|
|
476
|
-
sessionId: "",
|
|
477
|
-
model: "",
|
|
478
|
-
meta: {
|
|
479
|
-
panel: e.payload.panel,
|
|
480
|
-
messages: e.payload.messages,
|
|
481
|
-
message_id: e.payload.message_id
|
|
482
|
-
}
|
|
483
|
-
};
|
|
484
|
-
}
|
|
485
|
-
function rr() {
|
|
486
|
-
return { type: "done" };
|
|
487
|
-
}
|
|
488
|
-
function nr(e) {
|
|
489
|
-
return {
|
|
490
|
-
type: "metadata",
|
|
491
|
-
sessionId: "",
|
|
492
|
-
model: "",
|
|
493
|
-
meta: {
|
|
494
|
-
loading: !0,
|
|
495
|
-
loadingText: e.payload.text,
|
|
496
|
-
thinkingMessages: e.payload.thinking_messages,
|
|
497
|
-
dynamicLoading: e.payload.is_dynamic === !0
|
|
498
|
-
}
|
|
499
|
-
};
|
|
500
|
-
}
|
|
501
|
-
function or(e) {
|
|
502
|
-
return {
|
|
503
|
-
type: "metadata",
|
|
504
|
-
sessionId: "",
|
|
505
|
-
model: "",
|
|
506
|
-
meta: {
|
|
507
|
-
loading: !0,
|
|
508
|
-
panelLoading: !0,
|
|
509
|
-
panelPendingType: e.payload?.pending_type,
|
|
510
|
-
loadingText: e.payload?.text
|
|
511
|
-
}
|
|
512
|
-
};
|
|
513
|
-
}
|
|
514
|
-
function ir(e) {
|
|
515
|
-
return {
|
|
516
|
-
type: "metadata",
|
|
517
|
-
sessionId: "",
|
|
518
|
-
model: "",
|
|
519
|
-
meta: {
|
|
520
|
-
loading: !0,
|
|
521
|
-
similarPanelLoading: !0,
|
|
522
|
-
panelPendingType: e.payload?.pending_type,
|
|
523
|
-
loadingText: e.payload?.text
|
|
524
|
-
}
|
|
525
|
-
};
|
|
526
|
-
}
|
|
527
|
-
function sr(e) {
|
|
528
|
-
const t = v(e.payload.url);
|
|
529
|
-
return t ? {
|
|
530
|
-
type: "action",
|
|
531
|
-
action: {
|
|
532
|
-
kind: "navigate",
|
|
533
|
-
url: t,
|
|
534
|
-
newTab: e.payload.new_tab === !0
|
|
535
|
-
}
|
|
536
|
-
} : {
|
|
537
|
-
type: "metadata",
|
|
538
|
-
sessionId: "",
|
|
539
|
-
model: "",
|
|
540
|
-
meta: {
|
|
541
|
-
redirect: e.payload,
|
|
542
|
-
redirectTarget: v(e.payload.to)
|
|
543
|
-
}
|
|
544
|
-
};
|
|
545
|
-
}
|
|
546
|
-
function ar(e) {
|
|
547
|
-
return {
|
|
548
|
-
type: "error",
|
|
549
|
-
code: "BACKEND_ERROR",
|
|
550
|
-
message: v(e.payload?.text, e.payload?.message, e.payload?.error) ?? "Backend returned an error"
|
|
551
|
-
};
|
|
552
|
-
}
|
|
553
|
-
function ur(e) {
|
|
554
|
-
return {
|
|
555
|
-
type: "metadata",
|
|
556
|
-
sessionId: "",
|
|
557
|
-
model: "",
|
|
558
|
-
meta: { noop: !0 }
|
|
559
|
-
};
|
|
560
|
-
}
|
|
561
|
-
function cr(e) {
|
|
562
|
-
const t = e.payload ?? {};
|
|
563
|
-
if (Array.isArray(t.action_list)) {
|
|
564
|
-
const o = { action_list: t.action_list }, i = typeof t.type == "string" ? t.type : void 0, s = typeof t.theme == "string" ? t.theme : void 0;
|
|
565
|
-
return i !== void 0 && (o.type = i), s !== void 0 && (o.theme = s), tt({
|
|
566
|
-
type: "quick_qna",
|
|
567
|
-
payload: o
|
|
568
|
-
});
|
|
569
|
-
}
|
|
570
|
-
const r = T(t.action);
|
|
571
|
-
if (r) {
|
|
572
|
-
const o = { action: r }, i = typeof t.text == "string" ? t.text : void 0, s = typeof t.image_url == "string" ? t.image_url : void 0, a = typeof t.theme == "string" ? t.theme : void 0;
|
|
573
|
-
return i !== void 0 && (o.text = i), s !== void 0 && (o.image_url = s), a !== void 0 && (o.theme = a), et({
|
|
574
|
-
type: "text_image",
|
|
575
|
-
payload: o
|
|
576
|
-
});
|
|
577
|
-
}
|
|
578
|
-
const n = typeof t.text == "string" ? t.text : "";
|
|
579
|
-
if (n) {
|
|
580
|
-
const o = { text: n }, i = typeof t.type == "string" ? t.type : void 0, s = typeof t.theme == "string" ? t.theme : void 0, a = T(t.payload) ?? void 0;
|
|
581
|
-
return i !== void 0 && (o.type = i), a !== void 0 && (o.payload = a), s !== void 0 && (o.theme = s), me({
|
|
582
|
-
type: "text",
|
|
583
|
-
payload: o
|
|
584
|
-
});
|
|
585
|
-
}
|
|
586
|
-
return {
|
|
587
|
-
type: "metadata",
|
|
588
|
-
sessionId: "",
|
|
589
|
-
model: "",
|
|
590
|
-
meta: { launcherAction: t }
|
|
591
|
-
};
|
|
592
|
-
}
|
|
593
|
-
function me(e) {
|
|
594
|
-
const t = { text: v(e.payload.text) ?? "" };
|
|
595
|
-
return typeof e.payload.theme == "string" && (t.theme = e.payload.theme), e.payload.payload !== void 0 && (t.payload = e.payload.payload), {
|
|
596
|
-
type: "ui_spec",
|
|
597
|
-
widget: "qna",
|
|
598
|
-
spec: {
|
|
599
|
-
root: "root",
|
|
600
|
-
elements: { root: {
|
|
601
|
-
type: "QuestionHeading",
|
|
602
|
-
props: t
|
|
603
|
-
} }
|
|
604
|
-
}
|
|
605
|
-
};
|
|
606
|
-
}
|
|
607
|
-
function lr(e) {
|
|
608
|
-
return Sr(e.payload, "qna");
|
|
609
|
-
}
|
|
610
|
-
function et(e) {
|
|
611
|
-
const t = v(e.payload.text) ?? "", r = R(e.payload.action, t);
|
|
612
|
-
if (r) {
|
|
613
|
-
const o = {
|
|
614
|
-
label: t || r.title,
|
|
615
|
-
action: r
|
|
616
|
-
};
|
|
617
|
-
return typeof e.payload.image_url == "string" && (o.image = e.payload.image_url), typeof e.payload.theme == "string" && (o.theme = e.payload.theme), {
|
|
618
|
-
type: "ui_spec",
|
|
619
|
-
widget: "qna",
|
|
620
|
-
spec: {
|
|
621
|
-
root: "root",
|
|
622
|
-
elements: { root: {
|
|
623
|
-
type: "ActionButton",
|
|
624
|
-
props: o
|
|
625
|
-
} }
|
|
626
|
-
}
|
|
627
|
-
};
|
|
628
|
-
}
|
|
629
|
-
const n = { text: t };
|
|
630
|
-
return typeof e.payload.theme == "string" && (n.theme = e.payload.theme), me({
|
|
631
|
-
type: "text",
|
|
632
|
-
payload: n
|
|
633
|
-
});
|
|
634
|
-
}
|
|
635
|
-
function tt(e) {
|
|
636
|
-
return rt((e.payload.action_list ?? []).map((t) => {
|
|
637
|
-
const r = v(t.title) ?? "", n = R(t.requestDetails, r), o = n ? {
|
|
638
|
-
label: r,
|
|
639
|
-
action: n
|
|
640
|
-
} : null;
|
|
641
|
-
return o ? (typeof t.icon == "string" && (o.icon = t.icon), typeof t.image == "string" && (o.image = t.image), o) : null;
|
|
642
|
-
}).filter(K), "qna");
|
|
643
|
-
}
|
|
644
|
-
function dr(e) {
|
|
645
|
-
const t = { reviews: (e.payload.reviews ?? []).map((r) => {
|
|
646
|
-
const n = {};
|
|
647
|
-
return typeof r.review_class == "string" && (n.review_class = r.review_class), typeof r.review_text == "string" && (n.review_text = r.review_text), (typeof r.review_rating == "string" || typeof r.review_rating == "number") && (n.review_rating = r.review_rating), typeof r.review_tag == "string" && (n.review_tag = r.review_tag), n;
|
|
648
|
-
}) };
|
|
649
|
-
return typeof e.payload.sku == "string" && (t.sku = e.payload.sku), {
|
|
650
|
-
type: "ui_spec",
|
|
651
|
-
widget: "chat",
|
|
652
|
-
spec: {
|
|
653
|
-
root: "root",
|
|
654
|
-
elements: { root: {
|
|
655
|
-
type: "ReviewHighlights",
|
|
656
|
-
props: t
|
|
657
|
-
} }
|
|
658
|
-
}
|
|
659
|
-
};
|
|
660
|
-
}
|
|
661
|
-
function pr(e) {
|
|
662
|
-
const t = {};
|
|
663
|
-
return Array.isArray(e.payload.pros) && (t.pros = e.payload.pros), Array.isArray(e.payload.cons) && (t.cons = e.payload.cons), typeof e.payload.product_name == "string" && (t.productName = e.payload.product_name), {
|
|
664
|
-
type: "ui_spec",
|
|
665
|
-
widget: "chat",
|
|
666
|
-
spec: {
|
|
667
|
-
root: "root",
|
|
668
|
-
elements: { root: {
|
|
669
|
-
type: "ProsAndCons",
|
|
670
|
-
props: t
|
|
671
|
-
} }
|
|
672
|
-
}
|
|
673
|
-
};
|
|
674
|
-
}
|
|
675
|
-
function fr(e) {
|
|
676
|
-
return {
|
|
677
|
-
type: "metadata",
|
|
678
|
-
sessionId: "",
|
|
679
|
-
model: "",
|
|
680
|
-
meta: { visitorDataResponse: e.payload }
|
|
681
|
-
};
|
|
682
|
-
}
|
|
683
|
-
function hr(e) {
|
|
684
|
-
const t = e.payload.product_suggestions ?? [], r = [];
|
|
685
|
-
for (let n = 0; n < t.length; n++) {
|
|
686
|
-
const o = t[n];
|
|
687
|
-
if (!o) continue;
|
|
688
|
-
const i = Or(o);
|
|
689
|
-
if (!i) continue;
|
|
690
|
-
const s = { product: i }, a = R(o.requestDetails, i.name);
|
|
691
|
-
a && (s.action = a), typeof o.role == "string" && (s.role = o.role), typeof o.reason == "string" && (s.reason = o.reason), typeof o.review_highlight == "string" && (s.reviewHighlight = o.review_highlight), Array.isArray(o.labels) && (s.labels = o.labels), typeof o.expert_quality_score == "number" && (s.expertQualityScore = o.expert_quality_score), r.push(s);
|
|
692
|
-
}
|
|
693
|
-
return r.length === 0 ? {
|
|
694
|
-
type: "metadata",
|
|
695
|
-
sessionId: "",
|
|
696
|
-
model: "",
|
|
697
|
-
meta: { aiProductSuggestions: e.payload.product_suggestions ?? [] }
|
|
698
|
-
} : {
|
|
699
|
-
type: "ui_spec",
|
|
700
|
-
widget: "chat",
|
|
701
|
-
spec: {
|
|
702
|
-
root: "root",
|
|
703
|
-
elements: { root: {
|
|
704
|
-
type: "AITopPicks",
|
|
705
|
-
props: { suggestions: r }
|
|
706
|
-
} }
|
|
707
|
-
}
|
|
708
|
-
};
|
|
709
|
-
}
|
|
710
|
-
function mr(e) {
|
|
711
|
-
const t = e.payload.product_groupings ?? [], r = [], n = [];
|
|
712
|
-
for (let o = 0; o < t.length; o++) {
|
|
713
|
-
const i = t[o];
|
|
714
|
-
if (!i) continue;
|
|
715
|
-
const s = v(i.name) ?? "", a = v(i.sku, i.repr_sku), u = v(i.image, i.repr_image), c = a !== void 0 ? {
|
|
716
|
-
type: "findSimilar",
|
|
717
|
-
payload: { sku: a }
|
|
718
|
-
} : void 0, d = R(i.requestDetails ?? c, s), h = (Array.isArray(i.group_products) ? i.group_products : []).map((m) => {
|
|
719
|
-
const _ = T(m);
|
|
720
|
-
return _ ? ge(_) : null;
|
|
721
|
-
}).filter(K), f = u ?? v(...h.map((m) => m.imageUrl));
|
|
722
|
-
if (s && h.length > 0) {
|
|
723
|
-
const m = {
|
|
724
|
-
groupName: s,
|
|
725
|
-
products: h
|
|
726
|
-
};
|
|
727
|
-
f && (m.image = f), r.push(m);
|
|
728
|
-
}
|
|
729
|
-
if (!d) continue;
|
|
730
|
-
const p = {
|
|
731
|
-
name: s,
|
|
732
|
-
action: d
|
|
733
|
-
};
|
|
734
|
-
if (Array.isArray(i.labels)) {
|
|
735
|
-
const m = i.labels.filter((_) => typeof _ == "string");
|
|
736
|
-
m.length > 0 && (p.labels = m);
|
|
737
|
-
}
|
|
738
|
-
u !== void 0 && (p.image = u), n.push(p);
|
|
739
|
-
}
|
|
740
|
-
return r.length > 0 ? {
|
|
741
|
-
type: "ui_spec",
|
|
742
|
-
widget: "chat",
|
|
743
|
-
spec: {
|
|
744
|
-
root: "root",
|
|
745
|
-
elements: { root: {
|
|
746
|
-
type: "CategoriesContainer",
|
|
747
|
-
props: { groups: r }
|
|
748
|
-
} }
|
|
749
|
-
},
|
|
750
|
-
panelHint: "panel"
|
|
751
|
-
} : n.length === 0 ? {
|
|
752
|
-
type: "metadata",
|
|
753
|
-
sessionId: "",
|
|
754
|
-
model: "",
|
|
755
|
-
meta: { aiProductGroupings: e.payload.product_groupings ?? [] }
|
|
756
|
-
} : {
|
|
757
|
-
type: "ui_spec",
|
|
758
|
-
widget: "chat",
|
|
759
|
-
spec: {
|
|
760
|
-
root: "root",
|
|
761
|
-
elements: { root: {
|
|
762
|
-
type: "AIGroupingCards",
|
|
763
|
-
props: { entries: n }
|
|
764
|
-
} }
|
|
765
|
-
}
|
|
766
|
-
};
|
|
767
|
-
}
|
|
768
|
-
function gr(e) {
|
|
769
|
-
const t = e.payload.suggested_searches ?? [], r = [];
|
|
770
|
-
for (let n = 0; n < t.length; n++) {
|
|
771
|
-
const o = t[n];
|
|
772
|
-
if (!o) continue;
|
|
773
|
-
const i = v(o.short_name, o.chosen_attribute, o.detailed_user_message) ?? `Search ${n + 1}`, s = {}, a = v(o.detailed_user_message);
|
|
774
|
-
a && (s.text = a);
|
|
775
|
-
const u = T(T(o.requestDetails)?.payload), c = u?.group_skus;
|
|
776
|
-
o.group_skus && Array.isArray(o.group_skus) ? s.group_skus = o.group_skus : Array.isArray(c) && (s.group_skus = c.filter((P) => typeof P == "string"));
|
|
777
|
-
const d = v(o.sku, o.representative_product_sku, u?.sku);
|
|
778
|
-
d && (s.sku = d), s.is_suggested_text = 1;
|
|
779
|
-
const h = {
|
|
780
|
-
type: "inputText",
|
|
781
|
-
payload: s
|
|
782
|
-
}, f = R(o.requestDetails, i), p = f?.type === "findSimilar" && typeof s.text == "string" ? R(h, i) : f ?? R(h, i);
|
|
783
|
-
if (!p) continue;
|
|
784
|
-
const m = {
|
|
785
|
-
shortName: i,
|
|
786
|
-
action: p
|
|
787
|
-
}, _ = v(o.detailed_user_message);
|
|
788
|
-
_ && _ !== i && (m.detailedMessage = _);
|
|
789
|
-
const w = Mt(o);
|
|
790
|
-
w && w !== i && w !== (_ ?? "") && (m.whyDifferent = w), typeof o.image == "string" && (m.image = o.image), r.push(m);
|
|
791
|
-
}
|
|
792
|
-
return r.length === 0 ? {
|
|
793
|
-
type: "metadata",
|
|
794
|
-
sessionId: "",
|
|
795
|
-
model: "",
|
|
796
|
-
meta: { aiSuggestedSearches: e.payload.suggested_searches ?? [] }
|
|
797
|
-
} : {
|
|
798
|
-
type: "ui_spec",
|
|
799
|
-
widget: "chat",
|
|
800
|
-
spec: {
|
|
801
|
-
root: "root",
|
|
802
|
-
elements: { root: {
|
|
803
|
-
type: "AISuggestedSearchCards",
|
|
804
|
-
props: { entries: r }
|
|
805
|
-
} }
|
|
806
|
-
}
|
|
807
|
-
};
|
|
808
|
-
}
|
|
809
|
-
function _r(e) {
|
|
810
|
-
const t = e.payload, r = R(t.requestDetails ?? t.request_details, v(t.review_count, t.reviewCount, t.text, t.title) ?? "Show product reviews");
|
|
811
|
-
if (!r) return {
|
|
812
|
-
type: "metadata",
|
|
813
|
-
sessionId: "",
|
|
814
|
-
model: "",
|
|
815
|
-
meta: { groundingReview: t }
|
|
816
|
-
};
|
|
817
|
-
const n = { action: r };
|
|
818
|
-
return t.title && (n.title = t.title), t.text && (n.text = t.text), t.review_count ? n.reviewCount = t.review_count : typeof t.reviewCount == "string" && t.reviewCount.trim() && (n.reviewCount = t.reviewCount), {
|
|
819
|
-
type: "ui_spec",
|
|
820
|
-
widget: "chat",
|
|
821
|
-
spec: {
|
|
822
|
-
root: "root",
|
|
823
|
-
elements: { root: {
|
|
824
|
-
type: "GroundingReviewCard",
|
|
825
|
-
props: n
|
|
826
|
-
} }
|
|
827
|
-
}
|
|
828
|
-
};
|
|
829
|
-
}
|
|
830
|
-
function vr() {
|
|
831
|
-
return {
|
|
832
|
-
type: "metadata",
|
|
833
|
-
sessionId: "",
|
|
834
|
-
model: "",
|
|
835
|
-
meta: { analyzeAnimation: !0 }
|
|
836
|
-
};
|
|
837
|
-
}
|
|
838
|
-
function yr(e) {
|
|
839
|
-
return {
|
|
840
|
-
type: "metadata",
|
|
841
|
-
sessionId: "",
|
|
842
|
-
model: "",
|
|
843
|
-
meta: { voice: e.payload }
|
|
844
|
-
};
|
|
845
|
-
}
|
|
846
|
-
function br(e) {
|
|
847
|
-
const t = e.payload.group_list ?? [], r = [];
|
|
848
|
-
for (const o of t) {
|
|
849
|
-
const i = o.group_name ?? "", s = (o.product_list ?? []).map(x);
|
|
850
|
-
r.push({
|
|
851
|
-
groupName: i,
|
|
852
|
-
products: s
|
|
853
|
-
});
|
|
854
|
-
}
|
|
855
|
-
const n = [];
|
|
856
|
-
for (const o of e.payload.filter_tags ?? []) {
|
|
857
|
-
const i = o.title ?? "";
|
|
858
|
-
if (!i) continue;
|
|
859
|
-
const s = R(o.requestDetails, i), a = { title: i };
|
|
860
|
-
s && (a.action = s), n.push(a);
|
|
861
|
-
}
|
|
862
|
-
return {
|
|
863
|
-
type: "ui_spec",
|
|
864
|
-
widget: "chat",
|
|
865
|
-
spec: {
|
|
866
|
-
root: "root",
|
|
867
|
-
elements: { root: {
|
|
868
|
-
type: "CategoriesContainer",
|
|
869
|
-
props: {
|
|
870
|
-
groups: r,
|
|
871
|
-
filterTags: n
|
|
872
|
-
}
|
|
873
|
-
} }
|
|
874
|
-
},
|
|
875
|
-
panelHint: "panel"
|
|
876
|
-
};
|
|
877
|
-
}
|
|
878
|
-
function wr(e) {
|
|
879
|
-
return {
|
|
880
|
-
type: "metadata",
|
|
881
|
-
sessionId: "",
|
|
882
|
-
model: "",
|
|
883
|
-
meta: {
|
|
884
|
-
formType: e.type,
|
|
885
|
-
formPayload: e.payload ?? {}
|
|
886
|
-
}
|
|
887
|
-
};
|
|
888
|
-
}
|
|
889
|
-
function kr(e) {
|
|
890
|
-
const t = {};
|
|
891
|
-
return typeof e.payload?.summary == "string" && (t.summary = e.payload.summary), Array.isArray(e.payload?.products_discussed) && (t.products_discussed = e.payload.products_discussed), typeof e.payload?.user_sentiment == "string" && (t.user_sentiment = e.payload.user_sentiment), {
|
|
892
|
-
type: "ui_spec",
|
|
893
|
-
widget: "chat",
|
|
894
|
-
spec: {
|
|
895
|
-
root: "root",
|
|
896
|
-
elements: { root: {
|
|
897
|
-
type: "HandoffNotice",
|
|
898
|
-
props: t
|
|
899
|
-
} }
|
|
900
|
-
}
|
|
901
|
-
};
|
|
902
|
-
}
|
|
903
|
-
function zr(e) {
|
|
904
|
-
return {
|
|
905
|
-
type: "metadata",
|
|
906
|
-
sessionId: "",
|
|
907
|
-
model: "",
|
|
908
|
-
meta: { launcherContent: e.payload ?? {} }
|
|
909
|
-
};
|
|
910
|
-
}
|
|
911
|
-
function rt(e, t) {
|
|
912
|
-
const r = {}, n = [];
|
|
913
|
-
for (let o = 0; o < e.length; o++) {
|
|
914
|
-
const i = e[o];
|
|
915
|
-
if (!i) continue;
|
|
916
|
-
const s = `action-${o}`;
|
|
917
|
-
n.push(s);
|
|
918
|
-
const a = {
|
|
919
|
-
label: i.label,
|
|
920
|
-
action: i.action
|
|
921
|
-
};
|
|
922
|
-
i.icon !== void 0 && (a.icon = i.icon), i.image !== void 0 && (a.image = i.image), i.description !== void 0 && (a.description = i.description), r[s] = {
|
|
923
|
-
type: "ActionButton",
|
|
924
|
-
props: a
|
|
925
|
-
};
|
|
926
|
-
}
|
|
927
|
-
return r.root = {
|
|
928
|
-
type: "ActionButtons",
|
|
929
|
-
props: { buttons: e.map((o) => {
|
|
930
|
-
const i = {
|
|
931
|
-
label: o.label,
|
|
932
|
-
action: o.action
|
|
933
|
-
};
|
|
934
|
-
return o.image !== void 0 && (i.image = o.image), o.description !== void 0 && (i.description = o.description), o.icon !== void 0 && (i.icon = o.icon), i;
|
|
935
|
-
}) },
|
|
936
|
-
children: n
|
|
937
|
-
}, {
|
|
938
|
-
type: "ui_spec",
|
|
939
|
-
widget: t,
|
|
940
|
-
spec: {
|
|
941
|
-
root: "root",
|
|
942
|
-
elements: r
|
|
943
|
-
}
|
|
944
|
-
};
|
|
945
|
-
}
|
|
946
|
-
function nt(e, t) {
|
|
947
|
-
const r = {}, n = [];
|
|
948
|
-
for (let o = 0; o < e.length; o++) {
|
|
949
|
-
const i = e[o];
|
|
950
|
-
if (!i) continue;
|
|
951
|
-
const s = x(i), a = `product-${o}`;
|
|
952
|
-
n.push(a);
|
|
953
|
-
const u = {
|
|
954
|
-
product: s,
|
|
955
|
-
index: o
|
|
956
|
-
};
|
|
957
|
-
s.sku && (u.action = {
|
|
958
|
-
title: s.name,
|
|
959
|
-
type: "launchSingleProduct",
|
|
960
|
-
payload: { sku: s.sku }
|
|
961
|
-
}), r[a] = {
|
|
962
|
-
type: "ProductCard",
|
|
963
|
-
props: u
|
|
964
|
-
};
|
|
965
|
-
}
|
|
966
|
-
return r.root = {
|
|
967
|
-
type: "ProductGrid",
|
|
968
|
-
props: { layout: "grid" },
|
|
969
|
-
children: n
|
|
970
|
-
}, {
|
|
971
|
-
type: "ui_spec",
|
|
972
|
-
widget: t,
|
|
973
|
-
spec: {
|
|
974
|
-
root: "root",
|
|
975
|
-
elements: r
|
|
976
|
-
}
|
|
977
|
-
};
|
|
978
|
-
}
|
|
979
|
-
function $r(e, t) {
|
|
980
|
-
const r = {}, n = [];
|
|
981
|
-
for (let o = 0; o < e.length; o++) {
|
|
982
|
-
const i = e[o];
|
|
983
|
-
if (!i) continue;
|
|
984
|
-
const s = `product-${o}`;
|
|
985
|
-
n.push(s);
|
|
986
|
-
const a = {
|
|
987
|
-
product: i,
|
|
988
|
-
index: o
|
|
989
|
-
}, u = i.sku;
|
|
990
|
-
u && (a.action = {
|
|
991
|
-
title: i.name ?? "",
|
|
992
|
-
type: "launchSingleProduct",
|
|
993
|
-
payload: { sku: u }
|
|
994
|
-
}), r[s] = {
|
|
995
|
-
type: "ProductCard",
|
|
996
|
-
props: a
|
|
997
|
-
};
|
|
998
|
-
}
|
|
999
|
-
return r.root = {
|
|
1000
|
-
type: "ProductGrid",
|
|
1001
|
-
props: { layout: "grid" },
|
|
1002
|
-
children: n
|
|
1003
|
-
}, {
|
|
1004
|
-
type: "ui_spec",
|
|
1005
|
-
widget: t,
|
|
1006
|
-
spec: {
|
|
1007
|
-
root: "root",
|
|
1008
|
-
elements: r
|
|
1009
|
-
}
|
|
1010
|
-
};
|
|
1011
|
-
}
|
|
1012
|
-
function Sr(e, t) {
|
|
1013
|
-
return {
|
|
1014
|
-
type: "ui_spec",
|
|
1015
|
-
widget: t,
|
|
1016
|
-
spec: {
|
|
1017
|
-
root: "root",
|
|
1018
|
-
elements: { root: {
|
|
1019
|
-
type: "ProductCard",
|
|
1020
|
-
props: {
|
|
1021
|
-
product: x(e),
|
|
1022
|
-
index: 0
|
|
1023
|
-
}
|
|
1024
|
-
} }
|
|
1025
|
-
}
|
|
1026
|
-
};
|
|
1027
|
-
}
|
|
1028
|
-
function Zr(e) {
|
|
1029
|
-
return {
|
|
1030
|
-
type: "ui_spec",
|
|
1031
|
-
widget: e,
|
|
1032
|
-
spec: {
|
|
1033
|
-
root: "root",
|
|
1034
|
-
elements: { root: {
|
|
1035
|
-
type: "ActionButtons",
|
|
1036
|
-
props: { buttons: [] },
|
|
1037
|
-
children: []
|
|
1038
|
-
} }
|
|
1039
|
-
}
|
|
1040
|
-
};
|
|
1041
|
-
}
|
|
1042
|
-
function Or(e) {
|
|
1043
|
-
const t = v(e.sku), r = v(e.short_name), n = { ...T(e.product_item) ?? e }, o = v(e.discount_reason, e.discountReason);
|
|
1044
|
-
return o && !v(n.discount_reason, n.discountReason) && (n.discount_reason = o), ge(n, t, r);
|
|
1045
|
-
}
|
|
1046
|
-
function ge(e, t, r) {
|
|
1047
|
-
const n = v(e.sku, t), o = v(e.name, r);
|
|
1048
|
-
if (!n || !o) return null;
|
|
1049
|
-
const i = {
|
|
1050
|
-
sku: n,
|
|
1051
|
-
name: o
|
|
1052
|
-
}, s = v(e.brand);
|
|
1053
|
-
s && (i.brand = s);
|
|
1054
|
-
const a = v(e.url);
|
|
1055
|
-
a && (i.url = a);
|
|
1056
|
-
const u = Pr(e.images);
|
|
1057
|
-
if (u.length > 0) i.images = u;
|
|
1058
|
-
else {
|
|
1059
|
-
const _ = v(e.image, e.image_url, e.imageUrl);
|
|
1060
|
-
_ && (i.images = [_]);
|
|
1061
|
-
}
|
|
1062
|
-
const c = W(e.price_discounted);
|
|
1063
|
-
c !== void 0 && (i.price_discounted = c);
|
|
1064
|
-
const d = W(e.price);
|
|
1065
|
-
d !== void 0 && (i.price = d);
|
|
1066
|
-
const h = W(e.rating);
|
|
1067
|
-
h !== void 0 && (i.rating = h);
|
|
1068
|
-
const f = W(e.review_count) ?? W(e.reviewCount);
|
|
1069
|
-
f !== void 0 && (i.review_count = f);
|
|
1070
|
-
const p = v(e.cart_code, e.cartCode);
|
|
1071
|
-
p && (i.cart_code = p), typeof e.in_stock == "boolean" && (i.in_stock = e.in_stock), typeof e.inStock == "boolean" && (i.in_stock = e.inStock);
|
|
1072
|
-
const m = v(e.discount_reason, e.discountReason);
|
|
1073
|
-
return m && (i.discount_reason = m), x(i);
|
|
1074
|
-
}
|
|
1075
|
-
function R(e, t) {
|
|
1076
|
-
const r = T(e);
|
|
1077
|
-
if (!r) return null;
|
|
1078
|
-
const n = r.type;
|
|
1079
|
-
if (typeof n != "string" || n.length === 0) return null;
|
|
1080
|
-
const o = {
|
|
1081
|
-
title: t || n,
|
|
1082
|
-
type: n
|
|
1083
|
-
};
|
|
1084
|
-
return r.payload !== void 0 && (o.payload = r.payload), o;
|
|
1085
|
-
}
|
|
1086
|
-
function T(e) {
|
|
1087
|
-
return !e || typeof e != "object" || Array.isArray(e) ? null : e;
|
|
1088
|
-
}
|
|
1089
|
-
function v(...e) {
|
|
1090
|
-
for (const t of e) if (typeof t == "string") {
|
|
1091
|
-
const r = t.trim();
|
|
1092
|
-
if (r.length > 0) return r;
|
|
1093
|
-
}
|
|
1094
|
-
}
|
|
1095
|
-
function Pr(e) {
|
|
1096
|
-
return Array.isArray(e) ? e.filter((t) => typeof t == "string" && t.length > 0) : [];
|
|
1097
|
-
}
|
|
1098
|
-
function Er(e) {
|
|
1099
|
-
if (typeof e == "string") {
|
|
1100
|
-
const t = e.trim();
|
|
1101
|
-
return t ? [t] : [];
|
|
1102
|
-
}
|
|
1103
|
-
return Array.isArray(e) ? e.filter((t) => typeof t == "string").map((t) => t.trim()).filter((t) => t.length > 0) : [];
|
|
1104
|
-
}
|
|
1105
|
-
function W(e) {
|
|
1106
|
-
if (typeof e == "number" && Number.isFinite(e)) return e;
|
|
1107
|
-
if (typeof e == "string") {
|
|
1108
|
-
let t;
|
|
1109
|
-
e.includes(".") && e.includes(",") ? t = e.replace(/\./g, "").replace(",", ".") : t = e.replace(",", ".");
|
|
1110
|
-
const r = Number(t);
|
|
1111
|
-
if (Number.isFinite(r)) return r;
|
|
1112
|
-
}
|
|
1113
|
-
}
|
|
1114
|
-
function K(e) {
|
|
1115
|
-
return e != null;
|
|
1116
|
-
}
|
|
1117
|
-
var Ir = /* @__PURE__ */ new Set([
|
|
1118
|
-
"sku",
|
|
1119
|
-
"name",
|
|
1120
|
-
"brand",
|
|
1121
|
-
"images",
|
|
1122
|
-
"price",
|
|
1123
|
-
"price_discounted",
|
|
1124
|
-
"price_discount_rate",
|
|
1125
|
-
"price_currency",
|
|
1126
|
-
"discount_reason",
|
|
1127
|
-
"url",
|
|
1128
|
-
"rating",
|
|
1129
|
-
"review_count",
|
|
1130
|
-
"cart_code",
|
|
1131
|
-
"in_stock",
|
|
1132
|
-
"description",
|
|
1133
|
-
"description_html",
|
|
1134
|
-
"features",
|
|
1135
|
-
"specifications",
|
|
1136
|
-
"facet_tags",
|
|
1137
|
-
"short_name",
|
|
1138
|
-
"category_ids",
|
|
1139
|
-
"category_names",
|
|
1140
|
-
"variants",
|
|
1141
|
-
"facet_hits",
|
|
1142
|
-
"promotions"
|
|
1143
|
-
]);
|
|
1144
|
-
function x(e) {
|
|
1145
|
-
const t = e.price_discounted != null && e.price_discounted > 0, r = t ? e.price_discounted : e.price, n = t && e.price != null ? e.price : void 0;
|
|
1146
|
-
let o;
|
|
1147
|
-
n != null && r != null && n > 0 ? o = Math.round((n - r) / n * 100) : e.price_discount_rate != null && e.price_discount_rate > 0 && (o = e.price_discount_rate);
|
|
1148
|
-
const i = v(e.brand), s = v(e.name) ?? e.sku, a = i && !s.toLowerCase().startsWith(i.toLowerCase()) ? `${i} ${s}` : s, u = {
|
|
1149
|
-
sku: e.sku,
|
|
1150
|
-
name: a,
|
|
1151
|
-
url: v(e.url) ?? ""
|
|
1152
|
-
}, c = e.images?.[0];
|
|
1153
|
-
c && (u.imageUrl = c), e.images && e.images.length > 1 && (u.images = e.images), r != null && r > 0 && (u.price = String(r)), n != null && n > 0 && (u.originalPrice = String(n)), o !== void 0 && (u.discountPercent = o), i !== void 0 && (u.brand = i), e.rating !== void 0 && (u.rating = e.rating), e.review_count !== void 0 && (u.reviewCount = e.review_count), e.cart_code !== void 0 && (u.cartCode = e.cart_code), e.in_stock !== void 0 && (u.inStock = e.in_stock), e.variants && e.variants.length > 0 && (u.variants = e.variants), e.discount_reason !== void 0 && (u.discountReason = e.discount_reason), e.promotions && e.promotions.length > 0 && (u.promotions = e.promotions), e.description !== void 0 && (u.description = e.description), e.description_html !== void 0 && (u.descriptionHtml = e.description_html), e.features && e.features.length > 0 && (u.features = e.features), e.specifications !== void 0 && (u.specifications = e.specifications), e.facet_hits && (u.facetHits = e.facet_hits), e.short_name !== void 0 && (u.shortName = e.short_name);
|
|
1154
|
-
const d = e, h = {};
|
|
1155
|
-
let f = !1;
|
|
1156
|
-
for (const p of Object.keys(d)) Ir.has(p) || (h[p] = d[p], f = !0);
|
|
1157
|
-
return f && (u.extras = h), u;
|
|
1158
|
-
}
|
|
1159
|
-
function Oa(e) {
|
|
1160
|
-
return e.results.map(x);
|
|
1161
|
-
}
|
|
1162
|
-
function Pa(e) {
|
|
1163
|
-
return e.product_groupings.map((t) => {
|
|
1164
|
-
const r = {
|
|
1165
|
-
name: t.name,
|
|
1166
|
-
products: (t.group_products ?? []).map(x)
|
|
1167
|
-
};
|
|
1168
|
-
return t.highlight !== void 0 && (r.highlight = t.highlight), r;
|
|
1169
|
-
});
|
|
1170
|
-
}
|
|
1171
|
-
function Tr(e) {
|
|
1172
|
-
const t = e.payload.type, { type: r, ...n } = e.payload;
|
|
1173
|
-
return {
|
|
1174
|
-
type: "ui_spec",
|
|
1175
|
-
widget: "chat",
|
|
1176
|
-
spec: {
|
|
1177
|
-
root: "root",
|
|
1178
|
-
elements: { root: {
|
|
1179
|
-
type: t,
|
|
1180
|
-
props: n
|
|
1181
|
-
} }
|
|
1182
|
-
}
|
|
1183
|
-
};
|
|
1184
|
-
}
|
|
1185
|
-
var Ar = {
|
|
1186
|
-
process_action: "/process_action",
|
|
1187
|
-
launcher_action: "/launcher_action",
|
|
1188
|
-
similar_products: "/similar_products",
|
|
1189
|
-
product_groupings: "/product_groupings"
|
|
1190
|
-
};
|
|
1191
|
-
function Nr(e) {
|
|
1192
|
-
if (e === void 0) throw new Error("[gengage] middlewareUrl is required. Pass your Gengage backend URL in widget config.");
|
|
1193
|
-
const t = e.trim();
|
|
1194
|
-
return t === "" ? "" : t.replace(/\/+$/, "");
|
|
1195
|
-
}
|
|
1196
|
-
function Ea(e, t) {
|
|
1197
|
-
return `${Nr(t?.middlewareUrl)}/chat${Ar[e]}`;
|
|
1198
|
-
}
|
|
1199
|
-
var Ee;
|
|
1200
|
-
function l(e, t, r) {
|
|
1201
|
-
function n(a, u) {
|
|
1202
|
-
if (a._zod || Object.defineProperty(a, "_zod", {
|
|
1203
|
-
value: {
|
|
1204
|
-
def: u,
|
|
1205
|
-
constr: s,
|
|
1206
|
-
traits: /* @__PURE__ */ new Set()
|
|
1207
|
-
},
|
|
1208
|
-
enumerable: !1
|
|
1209
|
-
}), a._zod.traits.has(e)) return;
|
|
1210
|
-
a._zod.traits.add(e), t(a, u);
|
|
1211
|
-
const c = s.prototype, d = Object.keys(c);
|
|
1212
|
-
for (let h = 0; h < d.length; h++) {
|
|
1213
|
-
const f = d[h];
|
|
1214
|
-
f in a || (a[f] = c[f].bind(a));
|
|
1215
|
-
}
|
|
1216
|
-
}
|
|
1217
|
-
const o = r?.Parent ?? Object;
|
|
1218
|
-
class i extends o {
|
|
1219
|
-
}
|
|
1220
|
-
Object.defineProperty(i, "name", { value: e });
|
|
1221
|
-
function s(a) {
|
|
1222
|
-
var u;
|
|
1223
|
-
const c = r?.Parent ? new i() : this;
|
|
1224
|
-
n(c, a), (u = c._zod).deferred ?? (u.deferred = []);
|
|
1225
|
-
for (const d of c._zod.deferred) d();
|
|
1226
|
-
return c;
|
|
1227
|
-
}
|
|
1228
|
-
return Object.defineProperty(s, "init", { value: n }), Object.defineProperty(s, Symbol.hasInstance, { value: (a) => r?.Parent && a instanceof r.Parent ? !0 : a?._zod?.traits?.has(e) }), Object.defineProperty(s, "name", { value: e }), s;
|
|
1229
|
-
}
|
|
1230
|
-
var J = class extends Error {
|
|
1231
|
-
constructor() {
|
|
1232
|
-
super("Encountered Promise during synchronous parse. Use .parseAsync() instead.");
|
|
1233
|
-
}
|
|
1234
|
-
}, ot = class extends Error {
|
|
1235
|
-
constructor(e) {
|
|
1236
|
-
super(`Encountered unidirectional transform during encode: ${e}`), this.name = "ZodEncodeError";
|
|
1237
|
-
}
|
|
1238
|
-
};
|
|
1239
|
-
(Ee = globalThis).__zod_globalConfig ?? (Ee.__zod_globalConfig = {});
|
|
1240
|
-
var te = globalThis.__zod_globalConfig;
|
|
1241
|
-
function j(e) {
|
|
1242
|
-
return e && Object.assign(te, e), te;
|
|
1243
|
-
}
|
|
1244
|
-
function it(e) {
|
|
1245
|
-
const t = Object.values(e).filter((r) => typeof r == "number");
|
|
1246
|
-
return Object.entries(e).filter(([r, n]) => t.indexOf(+r) === -1).map(([r, n]) => n);
|
|
1247
|
-
}
|
|
1248
|
-
function pe(e, t) {
|
|
1249
|
-
return typeof t == "bigint" ? t.toString() : t;
|
|
1250
|
-
}
|
|
1251
|
-
function _e(e) {
|
|
1252
|
-
return { get value() {
|
|
1253
|
-
{
|
|
1254
|
-
const t = e();
|
|
1255
|
-
return Object.defineProperty(this, "value", { value: t }), t;
|
|
1256
|
-
}
|
|
1257
|
-
throw new Error("cached value already set");
|
|
1258
|
-
} };
|
|
1259
|
-
}
|
|
1260
|
-
function ve(e) {
|
|
1261
|
-
return e == null;
|
|
1262
|
-
}
|
|
1263
|
-
function ye(e) {
|
|
1264
|
-
const t = e.startsWith("^") ? 1 : 0, r = e.endsWith("$") ? e.length - 1 : e.length;
|
|
1265
|
-
return e.slice(t, r);
|
|
1266
|
-
}
|
|
1267
|
-
function Rr(e, t) {
|
|
1268
|
-
const r = e / t, n = Math.round(r), o = Number.EPSILON * Math.max(Math.abs(r), 1);
|
|
1269
|
-
return Math.abs(r - n) < o ? 0 : r - n;
|
|
1270
|
-
}
|
|
1271
|
-
var Ie = /* @__PURE__ */ Symbol("evaluating");
|
|
1272
|
-
function y(e, t, r) {
|
|
1273
|
-
let n;
|
|
1274
|
-
Object.defineProperty(e, t, {
|
|
1275
|
-
get() {
|
|
1276
|
-
if (n !== Ie)
|
|
1277
|
-
return n === void 0 && (n = Ie, n = r()), n;
|
|
1278
|
-
},
|
|
1279
|
-
set(o) {
|
|
1280
|
-
Object.defineProperty(e, t, { value: o });
|
|
1281
|
-
},
|
|
1282
|
-
configurable: !0
|
|
1283
|
-
});
|
|
1284
|
-
}
|
|
1285
|
-
function L(e, t, r) {
|
|
1286
|
-
Object.defineProperty(e, t, {
|
|
1287
|
-
value: r,
|
|
1288
|
-
writable: !0,
|
|
1289
|
-
enumerable: !0,
|
|
1290
|
-
configurable: !0
|
|
1291
|
-
});
|
|
1292
|
-
}
|
|
1293
|
-
function D(...e) {
|
|
1294
|
-
const t = {};
|
|
1295
|
-
for (const r of e) Object.assign(t, Object.getOwnPropertyDescriptors(r));
|
|
1296
|
-
return Object.defineProperties({}, t);
|
|
1297
|
-
}
|
|
1298
|
-
function Te(e) {
|
|
1299
|
-
return JSON.stringify(e);
|
|
1300
|
-
}
|
|
1301
|
-
function jr(e) {
|
|
1302
|
-
return e.toLowerCase().trim().replace(/[^\w\s-]/g, "").replace(/[\s_-]+/g, "-").replace(/^-+|-+$/g, "");
|
|
1303
|
-
}
|
|
1304
|
-
var st = "captureStackTrace" in Error ? Error.captureStackTrace : (...e) => {
|
|
1305
|
-
};
|
|
1306
|
-
function re(e) {
|
|
1307
|
-
return typeof e == "object" && e !== null && !Array.isArray(e);
|
|
1308
|
-
}
|
|
1309
|
-
var Cr = /* @__PURE__ */ _e(() => {
|
|
1310
|
-
if (te.jitless || typeof navigator < "u" && navigator?.userAgent?.includes("Cloudflare")) return !1;
|
|
1311
|
-
try {
|
|
1312
|
-
return new Function(""), !0;
|
|
1313
|
-
} catch {
|
|
1314
|
-
return !1;
|
|
1315
|
-
}
|
|
1316
|
-
});
|
|
1317
|
-
function V(e) {
|
|
1318
|
-
if (re(e) === !1) return !1;
|
|
1319
|
-
const t = e.constructor;
|
|
1320
|
-
if (t === void 0 || typeof t != "function") return !0;
|
|
1321
|
-
const r = t.prototype;
|
|
1322
|
-
return !(re(r) === !1 || Object.prototype.hasOwnProperty.call(r, "isPrototypeOf") === !1);
|
|
1323
|
-
}
|
|
1324
|
-
function at(e) {
|
|
1325
|
-
return V(e) ? { ...e } : Array.isArray(e) ? [...e] : e instanceof Map ? new Map(e) : e instanceof Set ? new Set(e) : e;
|
|
1326
|
-
}
|
|
1327
|
-
var xr = /* @__PURE__ */ new Set([
|
|
1328
|
-
"string",
|
|
1329
|
-
"number",
|
|
1330
|
-
"symbol"
|
|
1331
|
-
]);
|
|
1332
|
-
function q(e) {
|
|
1333
|
-
return e.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
|
|
1334
|
-
}
|
|
1335
|
-
function U(e, t, r) {
|
|
1336
|
-
const n = new e._zod.constr(t ?? e._zod.def);
|
|
1337
|
-
return (!t || r?.parent) && (n._zod.parent = e), n;
|
|
1338
|
-
}
|
|
1339
|
-
function g(e) {
|
|
1340
|
-
const t = e;
|
|
1341
|
-
if (!t) return {};
|
|
1342
|
-
if (typeof t == "string") return { error: () => t };
|
|
1343
|
-
if (t?.message !== void 0) {
|
|
1344
|
-
if (t?.error !== void 0) throw new Error("Cannot specify both `message` and `error` params");
|
|
1345
|
-
t.error = t.message;
|
|
1346
|
-
}
|
|
1347
|
-
return delete t.message, typeof t.error == "string" ? {
|
|
1348
|
-
...t,
|
|
1349
|
-
error: () => t.error
|
|
1350
|
-
} : t;
|
|
1351
|
-
}
|
|
1352
|
-
function Dr(e) {
|
|
1353
|
-
return Object.keys(e).filter((t) => e[t]._zod.optin === "optional" && e[t]._zod.optout === "optional");
|
|
1354
|
-
}
|
|
1355
|
-
var Ur = {
|
|
1356
|
-
safeint: [Number.MIN_SAFE_INTEGER, Number.MAX_SAFE_INTEGER],
|
|
1357
|
-
int32: [-2147483648, 2147483647],
|
|
1358
|
-
uint32: [0, 4294967295],
|
|
1359
|
-
float32: [-34028234663852886e22, 34028234663852886e22],
|
|
1360
|
-
float64: [-Number.MAX_VALUE, Number.MAX_VALUE]
|
|
1361
|
-
};
|
|
1362
|
-
function Lr(e, t) {
|
|
1363
|
-
const r = e._zod.def, n = r.checks;
|
|
1364
|
-
if (n && n.length > 0) throw new Error(".pick() cannot be used on object schemas containing refinements");
|
|
1365
|
-
return U(e, D(e._zod.def, {
|
|
1366
|
-
get shape() {
|
|
1367
|
-
const o = {};
|
|
1368
|
-
for (const i in t) {
|
|
1369
|
-
if (!(i in r.shape)) throw new Error(`Unrecognized key: "${i}"`);
|
|
1370
|
-
t[i] && (o[i] = r.shape[i]);
|
|
1371
|
-
}
|
|
1372
|
-
return L(this, "shape", o), o;
|
|
1373
|
-
},
|
|
1374
|
-
checks: []
|
|
1375
|
-
}));
|
|
1376
|
-
}
|
|
1377
|
-
function Fr(e, t) {
|
|
1378
|
-
const r = e._zod.def, n = r.checks;
|
|
1379
|
-
if (n && n.length > 0) throw new Error(".omit() cannot be used on object schemas containing refinements");
|
|
1380
|
-
return U(e, D(e._zod.def, {
|
|
1381
|
-
get shape() {
|
|
1382
|
-
const o = { ...e._zod.def.shape };
|
|
1383
|
-
for (const i in t) {
|
|
1384
|
-
if (!(i in r.shape)) throw new Error(`Unrecognized key: "${i}"`);
|
|
1385
|
-
t[i] && delete o[i];
|
|
1386
|
-
}
|
|
1387
|
-
return L(this, "shape", o), o;
|
|
1388
|
-
},
|
|
1389
|
-
checks: []
|
|
1390
|
-
}));
|
|
1391
|
-
}
|
|
1392
|
-
function Mr(e, t) {
|
|
1393
|
-
if (!V(t)) throw new Error("Invalid input to extend: expected a plain object");
|
|
1394
|
-
const r = e._zod.def.checks;
|
|
1395
|
-
if (r && r.length > 0) {
|
|
1396
|
-
const n = e._zod.def.shape;
|
|
1397
|
-
for (const o in t) if (Object.getOwnPropertyDescriptor(n, o) !== void 0) throw new Error("Cannot overwrite keys on object schemas containing refinements. Use `.safeExtend()` instead.");
|
|
1398
|
-
}
|
|
1399
|
-
return U(e, D(e._zod.def, { get shape() {
|
|
1400
|
-
const n = {
|
|
1401
|
-
...e._zod.def.shape,
|
|
1402
|
-
...t
|
|
1403
|
-
};
|
|
1404
|
-
return L(this, "shape", n), n;
|
|
1405
|
-
} }));
|
|
1406
|
-
}
|
|
1407
|
-
function Jr(e, t) {
|
|
1408
|
-
if (!V(t)) throw new Error("Invalid input to safeExtend: expected a plain object");
|
|
1409
|
-
return U(e, D(e._zod.def, { get shape() {
|
|
1410
|
-
const r = {
|
|
1411
|
-
...e._zod.def.shape,
|
|
1412
|
-
...t
|
|
1413
|
-
};
|
|
1414
|
-
return L(this, "shape", r), r;
|
|
1415
|
-
} }));
|
|
1416
|
-
}
|
|
1417
|
-
function Vr(e, t) {
|
|
1418
|
-
if (e._zod.def.checks?.length) throw new Error(".merge() cannot be used on object schemas containing refinements. Use .safeExtend() instead.");
|
|
1419
|
-
return U(e, D(e._zod.def, {
|
|
1420
|
-
get shape() {
|
|
1421
|
-
const r = {
|
|
1422
|
-
...e._zod.def.shape,
|
|
1423
|
-
...t._zod.def.shape
|
|
1424
|
-
};
|
|
1425
|
-
return L(this, "shape", r), r;
|
|
1426
|
-
},
|
|
1427
|
-
get catchall() {
|
|
1428
|
-
return t._zod.def.catchall;
|
|
1429
|
-
},
|
|
1430
|
-
checks: t._zod.def.checks ?? []
|
|
1431
|
-
}));
|
|
1432
|
-
}
|
|
1433
|
-
function qr(e, t, r) {
|
|
1434
|
-
const n = t._zod.def.checks;
|
|
1435
|
-
if (n && n.length > 0) throw new Error(".partial() cannot be used on object schemas containing refinements");
|
|
1436
|
-
return U(t, D(t._zod.def, {
|
|
1437
|
-
get shape() {
|
|
1438
|
-
const o = t._zod.def.shape, i = { ...o };
|
|
1439
|
-
if (r) for (const s in r) {
|
|
1440
|
-
if (!(s in o)) throw new Error(`Unrecognized key: "${s}"`);
|
|
1441
|
-
r[s] && (i[s] = e ? new e({
|
|
1442
|
-
type: "optional",
|
|
1443
|
-
innerType: o[s]
|
|
1444
|
-
}) : o[s]);
|
|
1445
|
-
}
|
|
1446
|
-
else for (const s in o) i[s] = e ? new e({
|
|
1447
|
-
type: "optional",
|
|
1448
|
-
innerType: o[s]
|
|
1449
|
-
}) : o[s];
|
|
1450
|
-
return L(this, "shape", i), i;
|
|
1451
|
-
},
|
|
1452
|
-
checks: []
|
|
1453
|
-
}));
|
|
1454
|
-
}
|
|
1455
|
-
function Gr(e, t, r) {
|
|
1456
|
-
return U(t, D(t._zod.def, { get shape() {
|
|
1457
|
-
const n = t._zod.def.shape, o = { ...n };
|
|
1458
|
-
if (r) for (const i in r) {
|
|
1459
|
-
if (!(i in o)) throw new Error(`Unrecognized key: "${i}"`);
|
|
1460
|
-
r[i] && (o[i] = new e({
|
|
1461
|
-
type: "nonoptional",
|
|
1462
|
-
innerType: n[i]
|
|
1463
|
-
}));
|
|
1464
|
-
}
|
|
1465
|
-
else for (const i in n) o[i] = new e({
|
|
1466
|
-
type: "nonoptional",
|
|
1467
|
-
innerType: n[i]
|
|
1468
|
-
});
|
|
1469
|
-
return L(this, "shape", o), o;
|
|
1470
|
-
} }));
|
|
1471
|
-
}
|
|
1472
|
-
function F(e, t = 0) {
|
|
1473
|
-
if (e.aborted === !0) return !0;
|
|
1474
|
-
for (let r = t; r < e.issues.length; r++) if (e.issues[r]?.continue !== !0) return !0;
|
|
1475
|
-
return !1;
|
|
1476
|
-
}
|
|
1477
|
-
function Wr(e, t = 0) {
|
|
1478
|
-
if (e.aborted === !0) return !0;
|
|
1479
|
-
for (let r = t; r < e.issues.length; r++) if (e.issues[r]?.continue === !1) return !0;
|
|
1480
|
-
return !1;
|
|
1481
|
-
}
|
|
1482
|
-
function M(e, t) {
|
|
1483
|
-
return t.map((r) => {
|
|
1484
|
-
var n;
|
|
1485
|
-
return (n = r).path ?? (n.path = []), r.path.unshift(e), r;
|
|
1486
|
-
});
|
|
1487
|
-
}
|
|
1488
|
-
function X(e) {
|
|
1489
|
-
return typeof e == "string" ? e : e?.message;
|
|
1490
|
-
}
|
|
1491
|
-
function C(e, t, r) {
|
|
1492
|
-
const n = e.message ? e.message : X(e.inst?._zod.def?.error?.(e)) ?? X(t?.error?.(e)) ?? X(r.customError?.(e)) ?? X(r.localeError?.(e)) ?? "Invalid input", { inst: o, continue: i, input: s, ...a } = e;
|
|
1493
|
-
return a.path ?? (a.path = []), a.message = n, t?.reportInput && (a.input = s), a;
|
|
1494
|
-
}
|
|
1495
|
-
function be(e) {
|
|
1496
|
-
return Array.isArray(e) ? "array" : typeof e == "string" ? "string" : "unknown";
|
|
1497
|
-
}
|
|
1498
|
-
function H(...e) {
|
|
1499
|
-
const [t, r, n] = e;
|
|
1500
|
-
return typeof t == "string" ? {
|
|
1501
|
-
message: t,
|
|
1502
|
-
code: "custom",
|
|
1503
|
-
input: r,
|
|
1504
|
-
inst: n
|
|
1505
|
-
} : { ...t };
|
|
1506
|
-
}
|
|
1507
|
-
var ut = (e, t) => {
|
|
1508
|
-
e.name = "$ZodError", Object.defineProperty(e, "_zod", {
|
|
1509
|
-
value: e._zod,
|
|
1510
|
-
enumerable: !1
|
|
1511
|
-
}), Object.defineProperty(e, "issues", {
|
|
1512
|
-
value: t,
|
|
1513
|
-
enumerable: !1
|
|
1514
|
-
}), e.message = JSON.stringify(t, pe, 2), Object.defineProperty(e, "toString", {
|
|
1515
|
-
value: () => e.message,
|
|
1516
|
-
enumerable: !1
|
|
1517
|
-
});
|
|
1518
|
-
}, ct = l("$ZodError", ut), lt = l("$ZodError", ut, { Parent: Error });
|
|
1519
|
-
function Br(e, t = (r) => r.message) {
|
|
1520
|
-
const r = {}, n = [];
|
|
1521
|
-
for (const o of e.issues) o.path.length > 0 ? (r[o.path[0]] = r[o.path[0]] || [], r[o.path[0]].push(t(o))) : n.push(t(o));
|
|
1522
|
-
return {
|
|
1523
|
-
formErrors: n,
|
|
1524
|
-
fieldErrors: r
|
|
1525
|
-
};
|
|
1526
|
-
}
|
|
1527
|
-
function Kr(e, t = (r) => r.message) {
|
|
1528
|
-
const r = { _errors: [] }, n = (o, i = []) => {
|
|
1529
|
-
for (const s of o.issues) if (s.code === "invalid_union" && s.errors.length) s.errors.map((a) => n({ issues: a }, [...i, ...s.path]));
|
|
1530
|
-
else if (s.code === "invalid_key") n({ issues: s.issues }, [...i, ...s.path]);
|
|
1531
|
-
else if (s.code === "invalid_element") n({ issues: s.issues }, [...i, ...s.path]);
|
|
1532
|
-
else {
|
|
1533
|
-
const a = [...i, ...s.path];
|
|
1534
|
-
if (a.length === 0) r._errors.push(t(s));
|
|
1535
|
-
else {
|
|
1536
|
-
let u = r, c = 0;
|
|
1537
|
-
for (; c < a.length; ) {
|
|
1538
|
-
const d = a[c];
|
|
1539
|
-
c !== a.length - 1 ? u[d] = u[d] || { _errors: [] } : (u[d] = u[d] || { _errors: [] }, u[d]._errors.push(t(s))), u = u[d], c++;
|
|
1540
|
-
}
|
|
1541
|
-
}
|
|
1542
|
-
}
|
|
1543
|
-
};
|
|
1544
|
-
return n(e), r;
|
|
1545
|
-
}
|
|
1546
|
-
var we = (e) => (t, r, n, o) => {
|
|
1547
|
-
const i = n ? {
|
|
1548
|
-
...n,
|
|
1549
|
-
async: !1
|
|
1550
|
-
} : { async: !1 }, s = t._zod.run({
|
|
1551
|
-
value: r,
|
|
1552
|
-
issues: []
|
|
1553
|
-
}, i);
|
|
1554
|
-
if (s instanceof Promise) throw new J();
|
|
1555
|
-
if (s.issues.length) {
|
|
1556
|
-
const a = new (o?.Err ?? e)(s.issues.map((u) => C(u, i, j())));
|
|
1557
|
-
throw st(a, o?.callee), a;
|
|
1558
|
-
}
|
|
1559
|
-
return s.value;
|
|
1560
|
-
}, ke = (e) => async (t, r, n, o) => {
|
|
1561
|
-
const i = n ? {
|
|
1562
|
-
...n,
|
|
1563
|
-
async: !0
|
|
1564
|
-
} : { async: !0 };
|
|
1565
|
-
let s = t._zod.run({
|
|
1566
|
-
value: r,
|
|
1567
|
-
issues: []
|
|
1568
|
-
}, i);
|
|
1569
|
-
if (s instanceof Promise && (s = await s), s.issues.length) {
|
|
1570
|
-
const a = new (o?.Err ?? e)(s.issues.map((u) => C(u, i, j())));
|
|
1571
|
-
throw st(a, o?.callee), a;
|
|
1572
|
-
}
|
|
1573
|
-
return s.value;
|
|
1574
|
-
}, se = (e) => (t, r, n) => {
|
|
1575
|
-
const o = n ? {
|
|
1576
|
-
...n,
|
|
1577
|
-
async: !1
|
|
1578
|
-
} : { async: !1 }, i = t._zod.run({
|
|
1579
|
-
value: r,
|
|
1580
|
-
issues: []
|
|
1581
|
-
}, o);
|
|
1582
|
-
if (i instanceof Promise) throw new J();
|
|
1583
|
-
return i.issues.length ? {
|
|
1584
|
-
success: !1,
|
|
1585
|
-
error: new (e ?? ct)(i.issues.map((s) => C(s, o, j())))
|
|
1586
|
-
} : {
|
|
1587
|
-
success: !0,
|
|
1588
|
-
data: i.value
|
|
1589
|
-
};
|
|
1590
|
-
}, Hr = /* @__PURE__ */ se(lt), ae = (e) => async (t, r, n) => {
|
|
1591
|
-
const o = n ? {
|
|
1592
|
-
...n,
|
|
1593
|
-
async: !0
|
|
1594
|
-
} : { async: !0 };
|
|
1595
|
-
let i = t._zod.run({
|
|
1596
|
-
value: r,
|
|
1597
|
-
issues: []
|
|
1598
|
-
}, o);
|
|
1599
|
-
return i instanceof Promise && (i = await i), i.issues.length ? {
|
|
1600
|
-
success: !1,
|
|
1601
|
-
error: new e(i.issues.map((s) => C(s, o, j())))
|
|
1602
|
-
} : {
|
|
1603
|
-
success: !0,
|
|
1604
|
-
data: i.value
|
|
1605
|
-
};
|
|
1606
|
-
}, Yr = /* @__PURE__ */ ae(lt), Xr = (e) => (t, r, n) => {
|
|
1607
|
-
const o = n ? {
|
|
1608
|
-
...n,
|
|
1609
|
-
direction: "backward"
|
|
1610
|
-
} : { direction: "backward" };
|
|
1611
|
-
return we(e)(t, r, o);
|
|
1612
|
-
}, Qr = (e) => (t, r, n) => we(e)(t, r, n), en = (e) => async (t, r, n) => {
|
|
1613
|
-
const o = n ? {
|
|
1614
|
-
...n,
|
|
1615
|
-
direction: "backward"
|
|
1616
|
-
} : { direction: "backward" };
|
|
1617
|
-
return ke(e)(t, r, o);
|
|
1618
|
-
}, tn = (e) => async (t, r, n) => ke(e)(t, r, n), rn = (e) => (t, r, n) => {
|
|
1619
|
-
const o = n ? {
|
|
1620
|
-
...n,
|
|
1621
|
-
direction: "backward"
|
|
1622
|
-
} : { direction: "backward" };
|
|
1623
|
-
return se(e)(t, r, o);
|
|
1624
|
-
}, nn = (e) => (t, r, n) => se(e)(t, r, n), on = (e) => async (t, r, n) => {
|
|
1625
|
-
const o = n ? {
|
|
1626
|
-
...n,
|
|
1627
|
-
direction: "backward"
|
|
1628
|
-
} : { direction: "backward" };
|
|
1629
|
-
return ae(e)(t, r, o);
|
|
1630
|
-
}, sn = (e) => async (t, r, n) => ae(e)(t, r, n), an = /^[cC][0-9a-z]{6,}$/, un = /^[0-9a-z]+$/, cn = /^[0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{26}$/, ln = /^[0-9a-vA-V]{20}$/, dn = /^[A-Za-z0-9]{27}$/, pn = /^[a-zA-Z0-9_-]{21}$/, fn = /^P(?:(\d+W)|(?!.*W)(?=\d|T\d)(\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+([.,]\d+)?S)?)?)$/, hn = /^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12})$/, Ae = (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)$/, mn = /^(?!\.)(?!.*\.\.)([A-Za-z0-9_'+\-\.]*)[A-Za-z0-9_+-]@([A-Za-z0-9][A-Za-z0-9\-]*\.)+[A-Za-z]{2,}$/, gn = "^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$";
|
|
1631
|
-
function _n() {
|
|
1632
|
-
return new RegExp(gn, "u");
|
|
1633
|
-
}
|
|
1634
|
-
var vn = /^(?:(?: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])$/, yn = /^(([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}|:))$/, bn = /^((25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\/([0-9]|[1-2][0-9]|3[0-2])$/, wn = /^(([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}|::|([0-9a-fA-F]{1,4})?::([0-9a-fA-F]{1,4}:?){0,6})\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/, kn = /^$|^(?:[0-9a-zA-Z+/]{4})*(?:(?:[0-9a-zA-Z+/]{2}==)|(?:[0-9a-zA-Z+/]{3}=))?$/, dt = /^[A-Za-z0-9_-]*$/, zn = /^https?$/, $n = /^\+[1-9]\d{6,14}$/, pt = "(?:(?:\\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])))", Sn = /* @__PURE__ */ new RegExp(`^${pt}$`);
|
|
1635
|
-
function ft(e) {
|
|
1636
|
-
const t = "(?:[01]\\d|2[0-3]):[0-5]\\d";
|
|
1637
|
-
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+)?)?`;
|
|
1638
|
-
}
|
|
1639
|
-
function Zn(e) {
|
|
1640
|
-
return new RegExp(`^${ft(e)}$`);
|
|
1641
|
-
}
|
|
1642
|
-
function On(e) {
|
|
1643
|
-
const t = ft({ precision: e.precision }), r = ["Z"];
|
|
1644
|
-
e.local && r.push(""), e.offset && r.push("([+-](?:[01]\\d|2[0-3]):[0-5]\\d)");
|
|
1645
|
-
const n = `${t}(?:${r.join("|")})`;
|
|
1646
|
-
return new RegExp(`^${pt}T(?:${n})$`);
|
|
1647
|
-
}
|
|
1648
|
-
var Pn = (e) => {
|
|
1649
|
-
const t = e ? `[\\s\\S]{${e?.minimum ?? 0},${e?.maximum ?? ""}}` : "[\\s\\S]*";
|
|
1650
|
-
return new RegExp(`^${t}$`);
|
|
1651
|
-
}, En = /^-?\d+$/, ht = /^-?\d+(?:\.\d+)?$/, In = /^(?:true|false)$/i, Tn = /^[^A-Z]*$/, An = /^[^a-z]*$/, I = /* @__PURE__ */ l("$ZodCheck", (e, t) => {
|
|
1652
|
-
var r;
|
|
1653
|
-
e._zod ?? (e._zod = {}), e._zod.def = t, (r = e._zod).onattach ?? (r.onattach = []);
|
|
1654
|
-
}), mt = {
|
|
1655
|
-
number: "number",
|
|
1656
|
-
bigint: "bigint",
|
|
1657
|
-
object: "date"
|
|
1658
|
-
}, gt = /* @__PURE__ */ l("$ZodCheckLessThan", (e, t) => {
|
|
1659
|
-
I.init(e, t);
|
|
1660
|
-
const r = mt[typeof t.value];
|
|
1661
|
-
e._zod.onattach.push((n) => {
|
|
1662
|
-
const o = n._zod.bag, i = (t.inclusive ? o.maximum : o.exclusiveMaximum) ?? Number.POSITIVE_INFINITY;
|
|
1663
|
-
t.value < i && (t.inclusive ? o.maximum = t.value : o.exclusiveMaximum = t.value);
|
|
1664
|
-
}), e._zod.check = (n) => {
|
|
1665
|
-
(t.inclusive ? n.value <= t.value : n.value < t.value) || n.issues.push({
|
|
1666
|
-
origin: r,
|
|
1667
|
-
code: "too_big",
|
|
1668
|
-
maximum: typeof t.value == "object" ? t.value.getTime() : t.value,
|
|
1669
|
-
input: n.value,
|
|
1670
|
-
inclusive: t.inclusive,
|
|
1671
|
-
inst: e,
|
|
1672
|
-
continue: !t.abort
|
|
1673
|
-
});
|
|
1674
|
-
};
|
|
1675
|
-
}), _t = /* @__PURE__ */ l("$ZodCheckGreaterThan", (e, t) => {
|
|
1676
|
-
I.init(e, t);
|
|
1677
|
-
const r = mt[typeof t.value];
|
|
1678
|
-
e._zod.onattach.push((n) => {
|
|
1679
|
-
const o = n._zod.bag, i = (t.inclusive ? o.minimum : o.exclusiveMinimum) ?? Number.NEGATIVE_INFINITY;
|
|
1680
|
-
t.value > i && (t.inclusive ? o.minimum = t.value : o.exclusiveMinimum = t.value);
|
|
1681
|
-
}), e._zod.check = (n) => {
|
|
1682
|
-
(t.inclusive ? n.value >= t.value : n.value > t.value) || n.issues.push({
|
|
1683
|
-
origin: r,
|
|
1684
|
-
code: "too_small",
|
|
1685
|
-
minimum: typeof t.value == "object" ? t.value.getTime() : t.value,
|
|
1686
|
-
input: n.value,
|
|
1687
|
-
inclusive: t.inclusive,
|
|
1688
|
-
inst: e,
|
|
1689
|
-
continue: !t.abort
|
|
1690
|
-
});
|
|
1691
|
-
};
|
|
1692
|
-
}), Nn = /* @__PURE__ */ l("$ZodCheckMultipleOf", (e, t) => {
|
|
1693
|
-
I.init(e, t), e._zod.onattach.push((r) => {
|
|
1694
|
-
var n;
|
|
1695
|
-
(n = r._zod.bag).multipleOf ?? (n.multipleOf = t.value);
|
|
1696
|
-
}), e._zod.check = (r) => {
|
|
1697
|
-
if (typeof r.value != typeof t.value) throw new Error("Cannot mix number and bigint in multiple_of check.");
|
|
1698
|
-
(typeof r.value == "bigint" ? r.value % t.value === BigInt(0) : Rr(r.value, t.value) === 0) || r.issues.push({
|
|
1699
|
-
origin: typeof r.value,
|
|
1700
|
-
code: "not_multiple_of",
|
|
1701
|
-
divisor: t.value,
|
|
1702
|
-
input: r.value,
|
|
1703
|
-
inst: e,
|
|
1704
|
-
continue: !t.abort
|
|
1705
|
-
});
|
|
1706
|
-
};
|
|
1707
|
-
}), Rn = /* @__PURE__ */ l("$ZodCheckNumberFormat", (e, t) => {
|
|
1708
|
-
I.init(e, t), t.format = t.format || "float64";
|
|
1709
|
-
const r = t.format?.includes("int"), n = r ? "int" : "number", [o, i] = Ur[t.format];
|
|
1710
|
-
e._zod.onattach.push((s) => {
|
|
1711
|
-
const a = s._zod.bag;
|
|
1712
|
-
a.format = t.format, a.minimum = o, a.maximum = i, r && (a.pattern = En);
|
|
1713
|
-
}), e._zod.check = (s) => {
|
|
1714
|
-
const a = s.value;
|
|
1715
|
-
if (r) {
|
|
1716
|
-
if (!Number.isInteger(a)) {
|
|
1717
|
-
s.issues.push({
|
|
1718
|
-
expected: n,
|
|
1719
|
-
format: t.format,
|
|
1720
|
-
code: "invalid_type",
|
|
1721
|
-
continue: !1,
|
|
1722
|
-
input: a,
|
|
1723
|
-
inst: e
|
|
1724
|
-
});
|
|
1725
|
-
return;
|
|
1726
|
-
}
|
|
1727
|
-
if (!Number.isSafeInteger(a)) {
|
|
1728
|
-
a > 0 ? s.issues.push({
|
|
1729
|
-
input: a,
|
|
1730
|
-
code: "too_big",
|
|
1731
|
-
maximum: Number.MAX_SAFE_INTEGER,
|
|
1732
|
-
note: "Integers must be within the safe integer range.",
|
|
1733
|
-
inst: e,
|
|
1734
|
-
origin: n,
|
|
1735
|
-
inclusive: !0,
|
|
1736
|
-
continue: !t.abort
|
|
1737
|
-
}) : s.issues.push({
|
|
1738
|
-
input: a,
|
|
1739
|
-
code: "too_small",
|
|
1740
|
-
minimum: Number.MIN_SAFE_INTEGER,
|
|
1741
|
-
note: "Integers must be within the safe integer range.",
|
|
1742
|
-
inst: e,
|
|
1743
|
-
origin: n,
|
|
1744
|
-
inclusive: !0,
|
|
1745
|
-
continue: !t.abort
|
|
1746
|
-
});
|
|
1747
|
-
return;
|
|
1748
|
-
}
|
|
1749
|
-
}
|
|
1750
|
-
a < o && s.issues.push({
|
|
1751
|
-
origin: "number",
|
|
1752
|
-
input: a,
|
|
1753
|
-
code: "too_small",
|
|
1754
|
-
minimum: o,
|
|
1755
|
-
inclusive: !0,
|
|
1756
|
-
inst: e,
|
|
1757
|
-
continue: !t.abort
|
|
1758
|
-
}), a > i && s.issues.push({
|
|
1759
|
-
origin: "number",
|
|
1760
|
-
input: a,
|
|
1761
|
-
code: "too_big",
|
|
1762
|
-
maximum: i,
|
|
1763
|
-
inclusive: !0,
|
|
1764
|
-
inst: e,
|
|
1765
|
-
continue: !t.abort
|
|
1766
|
-
});
|
|
1767
|
-
};
|
|
1768
|
-
}), jn = /* @__PURE__ */ l("$ZodCheckMaxLength", (e, t) => {
|
|
1769
|
-
var r;
|
|
1770
|
-
I.init(e, t), (r = e._zod.def).when ?? (r.when = (n) => {
|
|
1771
|
-
const o = n.value;
|
|
1772
|
-
return !ve(o) && o.length !== void 0;
|
|
1773
|
-
}), e._zod.onattach.push((n) => {
|
|
1774
|
-
const o = n._zod.bag.maximum ?? Number.POSITIVE_INFINITY;
|
|
1775
|
-
t.maximum < o && (n._zod.bag.maximum = t.maximum);
|
|
1776
|
-
}), e._zod.check = (n) => {
|
|
1777
|
-
const o = n.value;
|
|
1778
|
-
if (o.length <= t.maximum) return;
|
|
1779
|
-
const i = be(o);
|
|
1780
|
-
n.issues.push({
|
|
1781
|
-
origin: i,
|
|
1782
|
-
code: "too_big",
|
|
1783
|
-
maximum: t.maximum,
|
|
1784
|
-
inclusive: !0,
|
|
1785
|
-
input: o,
|
|
1786
|
-
inst: e,
|
|
1787
|
-
continue: !t.abort
|
|
1788
|
-
});
|
|
1789
|
-
};
|
|
1790
|
-
}), Cn = /* @__PURE__ */ l("$ZodCheckMinLength", (e, t) => {
|
|
1791
|
-
var r;
|
|
1792
|
-
I.init(e, t), (r = e._zod.def).when ?? (r.when = (n) => {
|
|
1793
|
-
const o = n.value;
|
|
1794
|
-
return !ve(o) && o.length !== void 0;
|
|
1795
|
-
}), e._zod.onattach.push((n) => {
|
|
1796
|
-
const o = n._zod.bag.minimum ?? Number.NEGATIVE_INFINITY;
|
|
1797
|
-
t.minimum > o && (n._zod.bag.minimum = t.minimum);
|
|
1798
|
-
}), e._zod.check = (n) => {
|
|
1799
|
-
const o = n.value;
|
|
1800
|
-
if (o.length >= t.minimum) return;
|
|
1801
|
-
const i = be(o);
|
|
1802
|
-
n.issues.push({
|
|
1803
|
-
origin: i,
|
|
1804
|
-
code: "too_small",
|
|
1805
|
-
minimum: t.minimum,
|
|
1806
|
-
inclusive: !0,
|
|
1807
|
-
input: o,
|
|
1808
|
-
inst: e,
|
|
1809
|
-
continue: !t.abort
|
|
1810
|
-
});
|
|
1811
|
-
};
|
|
1812
|
-
}), xn = /* @__PURE__ */ l("$ZodCheckLengthEquals", (e, t) => {
|
|
1813
|
-
var r;
|
|
1814
|
-
I.init(e, t), (r = e._zod.def).when ?? (r.when = (n) => {
|
|
1815
|
-
const o = n.value;
|
|
1816
|
-
return !ve(o) && o.length !== void 0;
|
|
1817
|
-
}), e._zod.onattach.push((n) => {
|
|
1818
|
-
const o = n._zod.bag;
|
|
1819
|
-
o.minimum = t.length, o.maximum = t.length, o.length = t.length;
|
|
1820
|
-
}), e._zod.check = (n) => {
|
|
1821
|
-
const o = n.value, i = o.length;
|
|
1822
|
-
if (i === t.length) return;
|
|
1823
|
-
const s = be(o), a = i > t.length;
|
|
1824
|
-
n.issues.push({
|
|
1825
|
-
origin: s,
|
|
1826
|
-
...a ? {
|
|
1827
|
-
code: "too_big",
|
|
1828
|
-
maximum: t.length
|
|
1829
|
-
} : {
|
|
1830
|
-
code: "too_small",
|
|
1831
|
-
minimum: t.length
|
|
1832
|
-
},
|
|
1833
|
-
inclusive: !0,
|
|
1834
|
-
exact: !0,
|
|
1835
|
-
input: n.value,
|
|
1836
|
-
inst: e,
|
|
1837
|
-
continue: !t.abort
|
|
1838
|
-
});
|
|
1839
|
-
};
|
|
1840
|
-
}), ue = /* @__PURE__ */ l("$ZodCheckStringFormat", (e, t) => {
|
|
1841
|
-
var r, n;
|
|
1842
|
-
I.init(e, t), e._zod.onattach.push((o) => {
|
|
1843
|
-
const i = o._zod.bag;
|
|
1844
|
-
i.format = t.format, t.pattern && (i.patterns ?? (i.patterns = /* @__PURE__ */ new Set()), i.patterns.add(t.pattern));
|
|
1845
|
-
}), t.pattern ? (r = e._zod).check ?? (r.check = (o) => {
|
|
1846
|
-
t.pattern.lastIndex = 0, !t.pattern.test(o.value) && o.issues.push({
|
|
1847
|
-
origin: "string",
|
|
1848
|
-
code: "invalid_format",
|
|
1849
|
-
format: t.format,
|
|
1850
|
-
input: o.value,
|
|
1851
|
-
...t.pattern ? { pattern: t.pattern.toString() } : {},
|
|
1852
|
-
inst: e,
|
|
1853
|
-
continue: !t.abort
|
|
1854
|
-
});
|
|
1855
|
-
}) : (n = e._zod).check ?? (n.check = () => {
|
|
1856
|
-
});
|
|
1857
|
-
}), Dn = /* @__PURE__ */ l("$ZodCheckRegex", (e, t) => {
|
|
1858
|
-
ue.init(e, t), e._zod.check = (r) => {
|
|
1859
|
-
t.pattern.lastIndex = 0, !t.pattern.test(r.value) && r.issues.push({
|
|
1860
|
-
origin: "string",
|
|
1861
|
-
code: "invalid_format",
|
|
1862
|
-
format: "regex",
|
|
1863
|
-
input: r.value,
|
|
1864
|
-
pattern: t.pattern.toString(),
|
|
1865
|
-
inst: e,
|
|
1866
|
-
continue: !t.abort
|
|
1867
|
-
});
|
|
1868
|
-
};
|
|
1869
|
-
}), Un = /* @__PURE__ */ l("$ZodCheckLowerCase", (e, t) => {
|
|
1870
|
-
t.pattern ?? (t.pattern = Tn), ue.init(e, t);
|
|
1871
|
-
}), Ln = /* @__PURE__ */ l("$ZodCheckUpperCase", (e, t) => {
|
|
1872
|
-
t.pattern ?? (t.pattern = An), ue.init(e, t);
|
|
1873
|
-
}), Fn = /* @__PURE__ */ l("$ZodCheckIncludes", (e, t) => {
|
|
1874
|
-
I.init(e, t);
|
|
1875
|
-
const r = q(t.includes), n = new RegExp(typeof t.position == "number" ? `^.{${t.position}}${r}` : r);
|
|
1876
|
-
t.pattern = n, e._zod.onattach.push((o) => {
|
|
1877
|
-
const i = o._zod.bag;
|
|
1878
|
-
i.patterns ?? (i.patterns = /* @__PURE__ */ new Set()), i.patterns.add(n);
|
|
1879
|
-
}), e._zod.check = (o) => {
|
|
1880
|
-
o.value.includes(t.includes, t.position) || o.issues.push({
|
|
1881
|
-
origin: "string",
|
|
1882
|
-
code: "invalid_format",
|
|
1883
|
-
format: "includes",
|
|
1884
|
-
includes: t.includes,
|
|
1885
|
-
input: o.value,
|
|
1886
|
-
inst: e,
|
|
1887
|
-
continue: !t.abort
|
|
1888
|
-
});
|
|
1889
|
-
};
|
|
1890
|
-
}), Mn = /* @__PURE__ */ l("$ZodCheckStartsWith", (e, t) => {
|
|
1891
|
-
I.init(e, t);
|
|
1892
|
-
const r = new RegExp(`^${q(t.prefix)}.*`);
|
|
1893
|
-
t.pattern ?? (t.pattern = r), e._zod.onattach.push((n) => {
|
|
1894
|
-
const o = n._zod.bag;
|
|
1895
|
-
o.patterns ?? (o.patterns = /* @__PURE__ */ new Set()), o.patterns.add(r);
|
|
1896
|
-
}), e._zod.check = (n) => {
|
|
1897
|
-
n.value.startsWith(t.prefix) || n.issues.push({
|
|
1898
|
-
origin: "string",
|
|
1899
|
-
code: "invalid_format",
|
|
1900
|
-
format: "starts_with",
|
|
1901
|
-
prefix: t.prefix,
|
|
1902
|
-
input: n.value,
|
|
1903
|
-
inst: e,
|
|
1904
|
-
continue: !t.abort
|
|
1905
|
-
});
|
|
1906
|
-
};
|
|
1907
|
-
}), Jn = /* @__PURE__ */ l("$ZodCheckEndsWith", (e, t) => {
|
|
1908
|
-
I.init(e, t);
|
|
1909
|
-
const r = new RegExp(`.*${q(t.suffix)}$`);
|
|
1910
|
-
t.pattern ?? (t.pattern = r), e._zod.onattach.push((n) => {
|
|
1911
|
-
const o = n._zod.bag;
|
|
1912
|
-
o.patterns ?? (o.patterns = /* @__PURE__ */ new Set()), o.patterns.add(r);
|
|
1913
|
-
}), e._zod.check = (n) => {
|
|
1914
|
-
n.value.endsWith(t.suffix) || n.issues.push({
|
|
1915
|
-
origin: "string",
|
|
1916
|
-
code: "invalid_format",
|
|
1917
|
-
format: "ends_with",
|
|
1918
|
-
suffix: t.suffix,
|
|
1919
|
-
input: n.value,
|
|
1920
|
-
inst: e,
|
|
1921
|
-
continue: !t.abort
|
|
1922
|
-
});
|
|
1923
|
-
};
|
|
1924
|
-
}), Vn = /* @__PURE__ */ l("$ZodCheckOverwrite", (e, t) => {
|
|
1925
|
-
I.init(e, t), e._zod.check = (r) => {
|
|
1926
|
-
r.value = t.tx(r.value);
|
|
1927
|
-
};
|
|
1928
|
-
}), qn = class {
|
|
1929
|
-
constructor(e = []) {
|
|
1930
|
-
this.content = [], this.indent = 0, this && (this.args = e);
|
|
1931
|
-
}
|
|
1932
|
-
indented(e) {
|
|
1933
|
-
this.indent += 1, e(this), this.indent -= 1;
|
|
1934
|
-
}
|
|
1935
|
-
write(e) {
|
|
1936
|
-
if (typeof e == "function") {
|
|
1937
|
-
e(this, { execution: "sync" }), e(this, { execution: "async" });
|
|
1938
|
-
return;
|
|
1939
|
-
}
|
|
1940
|
-
const t = e.split(`
|
|
1941
|
-
`).filter((o) => o), r = Math.min(...t.map((o) => o.length - o.trimStart().length)), n = t.map((o) => o.slice(r)).map((o) => " ".repeat(this.indent * 2) + o);
|
|
1942
|
-
for (const o of n) this.content.push(o);
|
|
1943
|
-
}
|
|
1944
|
-
compile() {
|
|
1945
|
-
const e = Function, t = this?.args, r = [...(this?.content ?? [""]).map((n) => ` ${n}`)];
|
|
1946
|
-
return new e(...t, r.join(`
|
|
1947
|
-
`));
|
|
1948
|
-
}
|
|
1949
|
-
}, Gn = {
|
|
1950
|
-
major: 4,
|
|
1951
|
-
minor: 4,
|
|
1952
|
-
patch: 3
|
|
1953
|
-
}, k = /* @__PURE__ */ l("$ZodType", (e, t) => {
|
|
1954
|
-
var r;
|
|
1955
|
-
e ?? (e = {}), e._zod.def = t, e._zod.bag = e._zod.bag || {}, e._zod.version = Gn;
|
|
1956
|
-
const n = [...e._zod.def.checks ?? []];
|
|
1957
|
-
e._zod.traits.has("$ZodCheck") && n.unshift(e);
|
|
1958
|
-
for (const o of n) for (const i of o._zod.onattach) i(e);
|
|
1959
|
-
if (n.length === 0)
|
|
1960
|
-
(r = e._zod).deferred ?? (r.deferred = []), e._zod.deferred?.push(() => {
|
|
1961
|
-
e._zod.run = e._zod.parse;
|
|
1962
|
-
});
|
|
1963
|
-
else {
|
|
1964
|
-
const o = (s, a, u) => {
|
|
1965
|
-
let c = F(s), d;
|
|
1966
|
-
for (const h of a) {
|
|
1967
|
-
if (h._zod.def.when) {
|
|
1968
|
-
if (Wr(s) || !h._zod.def.when(s)) continue;
|
|
1969
|
-
} else if (c) continue;
|
|
1970
|
-
const f = s.issues.length, p = h._zod.check(s);
|
|
1971
|
-
if (p instanceof Promise && u?.async === !1) throw new J();
|
|
1972
|
-
if (d || p instanceof Promise) d = (d ?? Promise.resolve()).then(async () => {
|
|
1973
|
-
await p, s.issues.length !== f && (c || (c = F(s, f)));
|
|
1974
|
-
});
|
|
1975
|
-
else {
|
|
1976
|
-
if (s.issues.length === f) continue;
|
|
1977
|
-
c || (c = F(s, f));
|
|
1978
|
-
}
|
|
1979
|
-
}
|
|
1980
|
-
return d ? d.then(() => s) : s;
|
|
1981
|
-
}, i = (s, a, u) => {
|
|
1982
|
-
if (F(s))
|
|
1983
|
-
return s.aborted = !0, s;
|
|
1984
|
-
const c = o(a, n, u);
|
|
1985
|
-
if (c instanceof Promise) {
|
|
1986
|
-
if (u.async === !1) throw new J();
|
|
1987
|
-
return c.then((d) => e._zod.parse(d, u));
|
|
1988
|
-
}
|
|
1989
|
-
return e._zod.parse(c, u);
|
|
1990
|
-
};
|
|
1991
|
-
e._zod.run = (s, a) => {
|
|
1992
|
-
if (a.skipChecks) return e._zod.parse(s, a);
|
|
1993
|
-
if (a.direction === "backward") {
|
|
1994
|
-
const c = e._zod.parse({
|
|
1995
|
-
value: s.value,
|
|
1996
|
-
issues: []
|
|
1997
|
-
}, {
|
|
1998
|
-
...a,
|
|
1999
|
-
skipChecks: !0
|
|
2000
|
-
});
|
|
2001
|
-
return c instanceof Promise ? c.then((d) => i(d, s, a)) : i(c, s, a);
|
|
2002
|
-
}
|
|
2003
|
-
const u = e._zod.parse(s, a);
|
|
2004
|
-
if (u instanceof Promise) {
|
|
2005
|
-
if (a.async === !1) throw new J();
|
|
2006
|
-
return u.then((c) => o(c, n, a));
|
|
2007
|
-
}
|
|
2008
|
-
return o(u, n, a);
|
|
2009
|
-
};
|
|
2010
|
-
}
|
|
2011
|
-
y(e, "~standard", () => ({
|
|
2012
|
-
validate: (o) => {
|
|
2013
|
-
try {
|
|
2014
|
-
const i = Hr(e, o);
|
|
2015
|
-
return i.success ? { value: i.data } : { issues: i.error?.issues };
|
|
2016
|
-
} catch {
|
|
2017
|
-
return Yr(e, o).then((s) => s.success ? { value: s.data } : { issues: s.error?.issues });
|
|
2018
|
-
}
|
|
2019
|
-
},
|
|
2020
|
-
vendor: "zod",
|
|
2021
|
-
version: 1
|
|
2022
|
-
}));
|
|
2023
|
-
}), ze = /* @__PURE__ */ l("$ZodString", (e, t) => {
|
|
2024
|
-
k.init(e, t), e._zod.pattern = [...e?._zod.bag?.patterns ?? []].pop() ?? Pn(e._zod.bag), e._zod.parse = (r, n) => {
|
|
2025
|
-
if (t.coerce) try {
|
|
2026
|
-
r.value = String(r.value);
|
|
2027
|
-
} catch {
|
|
2028
|
-
}
|
|
2029
|
-
return typeof r.value == "string" || r.issues.push({
|
|
2030
|
-
expected: "string",
|
|
2031
|
-
code: "invalid_type",
|
|
2032
|
-
input: r.value,
|
|
2033
|
-
inst: e
|
|
2034
|
-
}), r;
|
|
2035
|
-
};
|
|
2036
|
-
}), b = /* @__PURE__ */ l("$ZodStringFormat", (e, t) => {
|
|
2037
|
-
ue.init(e, t), ze.init(e, t);
|
|
2038
|
-
}), Wn = /* @__PURE__ */ l("$ZodGUID", (e, t) => {
|
|
2039
|
-
t.pattern ?? (t.pattern = hn), b.init(e, t);
|
|
2040
|
-
}), Bn = /* @__PURE__ */ l("$ZodUUID", (e, t) => {
|
|
2041
|
-
if (t.version) {
|
|
2042
|
-
const r = {
|
|
2043
|
-
v1: 1,
|
|
2044
|
-
v2: 2,
|
|
2045
|
-
v3: 3,
|
|
2046
|
-
v4: 4,
|
|
2047
|
-
v5: 5,
|
|
2048
|
-
v6: 6,
|
|
2049
|
-
v7: 7,
|
|
2050
|
-
v8: 8
|
|
2051
|
-
}[t.version];
|
|
2052
|
-
if (r === void 0) throw new Error(`Invalid UUID version: "${t.version}"`);
|
|
2053
|
-
t.pattern ?? (t.pattern = Ae(r));
|
|
2054
|
-
} else t.pattern ?? (t.pattern = Ae());
|
|
2055
|
-
b.init(e, t);
|
|
2056
|
-
}), Kn = /* @__PURE__ */ l("$ZodEmail", (e, t) => {
|
|
2057
|
-
t.pattern ?? (t.pattern = mn), b.init(e, t);
|
|
2058
|
-
}), Hn = /* @__PURE__ */ l("$ZodURL", (e, t) => {
|
|
2059
|
-
b.init(e, t), e._zod.check = (r) => {
|
|
2060
|
-
try {
|
|
2061
|
-
const n = r.value.trim();
|
|
2062
|
-
if (!t.normalize && t.protocol?.source === zn.source && !/^https?:\/\//i.test(n)) {
|
|
2063
|
-
r.issues.push({
|
|
2064
|
-
code: "invalid_format",
|
|
2065
|
-
format: "url",
|
|
2066
|
-
note: "Invalid URL format",
|
|
2067
|
-
input: r.value,
|
|
2068
|
-
inst: e,
|
|
2069
|
-
continue: !t.abort
|
|
2070
|
-
});
|
|
2071
|
-
return;
|
|
2072
|
-
}
|
|
2073
|
-
const o = new URL(n);
|
|
2074
|
-
t.hostname && (t.hostname.lastIndex = 0, t.hostname.test(o.hostname) || r.issues.push({
|
|
2075
|
-
code: "invalid_format",
|
|
2076
|
-
format: "url",
|
|
2077
|
-
note: "Invalid hostname",
|
|
2078
|
-
pattern: t.hostname.source,
|
|
2079
|
-
input: r.value,
|
|
2080
|
-
inst: e,
|
|
2081
|
-
continue: !t.abort
|
|
2082
|
-
})), t.protocol && (t.protocol.lastIndex = 0, t.protocol.test(o.protocol.endsWith(":") ? o.protocol.slice(0, -1) : o.protocol) || r.issues.push({
|
|
2083
|
-
code: "invalid_format",
|
|
2084
|
-
format: "url",
|
|
2085
|
-
note: "Invalid protocol",
|
|
2086
|
-
pattern: t.protocol.source,
|
|
2087
|
-
input: r.value,
|
|
2088
|
-
inst: e,
|
|
2089
|
-
continue: !t.abort
|
|
2090
|
-
})), t.normalize ? r.value = o.href : r.value = n;
|
|
2091
|
-
return;
|
|
2092
|
-
} catch {
|
|
2093
|
-
r.issues.push({
|
|
2094
|
-
code: "invalid_format",
|
|
2095
|
-
format: "url",
|
|
2096
|
-
input: r.value,
|
|
2097
|
-
inst: e,
|
|
2098
|
-
continue: !t.abort
|
|
2099
|
-
});
|
|
2100
|
-
}
|
|
2101
|
-
};
|
|
2102
|
-
}), Yn = /* @__PURE__ */ l("$ZodEmoji", (e, t) => {
|
|
2103
|
-
t.pattern ?? (t.pattern = _n()), b.init(e, t);
|
|
2104
|
-
}), Xn = /* @__PURE__ */ l("$ZodNanoID", (e, t) => {
|
|
2105
|
-
t.pattern ?? (t.pattern = pn), b.init(e, t);
|
|
2106
|
-
}), Qn = /* @__PURE__ */ l("$ZodCUID", (e, t) => {
|
|
2107
|
-
t.pattern ?? (t.pattern = an), b.init(e, t);
|
|
2108
|
-
}), eo = /* @__PURE__ */ l("$ZodCUID2", (e, t) => {
|
|
2109
|
-
t.pattern ?? (t.pattern = un), b.init(e, t);
|
|
2110
|
-
}), to = /* @__PURE__ */ l("$ZodULID", (e, t) => {
|
|
2111
|
-
t.pattern ?? (t.pattern = cn), b.init(e, t);
|
|
2112
|
-
}), ro = /* @__PURE__ */ l("$ZodXID", (e, t) => {
|
|
2113
|
-
t.pattern ?? (t.pattern = ln), b.init(e, t);
|
|
2114
|
-
}), no = /* @__PURE__ */ l("$ZodKSUID", (e, t) => {
|
|
2115
|
-
t.pattern ?? (t.pattern = dn), b.init(e, t);
|
|
2116
|
-
}), oo = /* @__PURE__ */ l("$ZodISODateTime", (e, t) => {
|
|
2117
|
-
t.pattern ?? (t.pattern = On(t)), b.init(e, t);
|
|
2118
|
-
}), io = /* @__PURE__ */ l("$ZodISODate", (e, t) => {
|
|
2119
|
-
t.pattern ?? (t.pattern = Sn), b.init(e, t);
|
|
2120
|
-
}), so = /* @__PURE__ */ l("$ZodISOTime", (e, t) => {
|
|
2121
|
-
t.pattern ?? (t.pattern = Zn(t)), b.init(e, t);
|
|
2122
|
-
}), ao = /* @__PURE__ */ l("$ZodISODuration", (e, t) => {
|
|
2123
|
-
t.pattern ?? (t.pattern = fn), b.init(e, t);
|
|
2124
|
-
}), uo = /* @__PURE__ */ l("$ZodIPv4", (e, t) => {
|
|
2125
|
-
t.pattern ?? (t.pattern = vn), b.init(e, t), e._zod.bag.format = "ipv4";
|
|
2126
|
-
}), co = /* @__PURE__ */ l("$ZodIPv6", (e, t) => {
|
|
2127
|
-
t.pattern ?? (t.pattern = yn), b.init(e, t), e._zod.bag.format = "ipv6", e._zod.check = (r) => {
|
|
2128
|
-
try {
|
|
2129
|
-
new URL(`http://[${r.value}]`);
|
|
2130
|
-
} catch {
|
|
2131
|
-
r.issues.push({
|
|
2132
|
-
code: "invalid_format",
|
|
2133
|
-
format: "ipv6",
|
|
2134
|
-
input: r.value,
|
|
2135
|
-
inst: e,
|
|
2136
|
-
continue: !t.abort
|
|
2137
|
-
});
|
|
2138
|
-
}
|
|
2139
|
-
};
|
|
2140
|
-
}), lo = /* @__PURE__ */ l("$ZodCIDRv4", (e, t) => {
|
|
2141
|
-
t.pattern ?? (t.pattern = bn), b.init(e, t);
|
|
2142
|
-
}), po = /* @__PURE__ */ l("$ZodCIDRv6", (e, t) => {
|
|
2143
|
-
t.pattern ?? (t.pattern = wn), b.init(e, t), e._zod.check = (r) => {
|
|
2144
|
-
const n = r.value.split("/");
|
|
2145
|
-
try {
|
|
2146
|
-
if (n.length !== 2) throw new Error();
|
|
2147
|
-
const [o, i] = n;
|
|
2148
|
-
if (!i) throw new Error();
|
|
2149
|
-
const s = Number(i);
|
|
2150
|
-
if (`${s}` !== i) throw new Error();
|
|
2151
|
-
if (s < 0 || s > 128) throw new Error();
|
|
2152
|
-
new URL(`http://[${o}]`);
|
|
2153
|
-
} catch {
|
|
2154
|
-
r.issues.push({
|
|
2155
|
-
code: "invalid_format",
|
|
2156
|
-
format: "cidrv6",
|
|
2157
|
-
input: r.value,
|
|
2158
|
-
inst: e,
|
|
2159
|
-
continue: !t.abort
|
|
2160
|
-
});
|
|
2161
|
-
}
|
|
2162
|
-
};
|
|
2163
|
-
});
|
|
2164
|
-
function vt(e) {
|
|
2165
|
-
if (e === "") return !0;
|
|
2166
|
-
if (/\s/.test(e) || e.length % 4 !== 0) return !1;
|
|
2167
|
-
try {
|
|
2168
|
-
return atob(e), !0;
|
|
2169
|
-
} catch {
|
|
2170
|
-
return !1;
|
|
2171
|
-
}
|
|
2172
|
-
}
|
|
2173
|
-
var fo = /* @__PURE__ */ l("$ZodBase64", (e, t) => {
|
|
2174
|
-
t.pattern ?? (t.pattern = kn), b.init(e, t), e._zod.bag.contentEncoding = "base64", e._zod.check = (r) => {
|
|
2175
|
-
vt(r.value) || r.issues.push({
|
|
2176
|
-
code: "invalid_format",
|
|
2177
|
-
format: "base64",
|
|
2178
|
-
input: r.value,
|
|
2179
|
-
inst: e,
|
|
2180
|
-
continue: !t.abort
|
|
2181
|
-
});
|
|
2182
|
-
};
|
|
2183
|
-
});
|
|
2184
|
-
function ho(e) {
|
|
2185
|
-
if (!dt.test(e)) return !1;
|
|
2186
|
-
const t = e.replace(/[-_]/g, (r) => r === "-" ? "+" : "/");
|
|
2187
|
-
return vt(t.padEnd(Math.ceil(t.length / 4) * 4, "="));
|
|
2188
|
-
}
|
|
2189
|
-
var mo = /* @__PURE__ */ l("$ZodBase64URL", (e, t) => {
|
|
2190
|
-
t.pattern ?? (t.pattern = dt), b.init(e, t), e._zod.bag.contentEncoding = "base64url", e._zod.check = (r) => {
|
|
2191
|
-
ho(r.value) || r.issues.push({
|
|
2192
|
-
code: "invalid_format",
|
|
2193
|
-
format: "base64url",
|
|
2194
|
-
input: r.value,
|
|
2195
|
-
inst: e,
|
|
2196
|
-
continue: !t.abort
|
|
2197
|
-
});
|
|
2198
|
-
};
|
|
2199
|
-
}), go = /* @__PURE__ */ l("$ZodE164", (e, t) => {
|
|
2200
|
-
t.pattern ?? (t.pattern = $n), b.init(e, t);
|
|
2201
|
-
});
|
|
2202
|
-
function _o(e, t = null) {
|
|
2203
|
-
try {
|
|
2204
|
-
const r = e.split(".");
|
|
2205
|
-
if (r.length !== 3) return !1;
|
|
2206
|
-
const [n] = r;
|
|
2207
|
-
if (!n) return !1;
|
|
2208
|
-
const o = JSON.parse(atob(n));
|
|
2209
|
-
return !("typ" in o && o?.typ !== "JWT" || !o.alg || t && (!("alg" in o) || o.alg !== t));
|
|
2210
|
-
} catch {
|
|
2211
|
-
return !1;
|
|
2212
|
-
}
|
|
2213
|
-
}
|
|
2214
|
-
var vo = /* @__PURE__ */ l("$ZodJWT", (e, t) => {
|
|
2215
|
-
b.init(e, t), e._zod.check = (r) => {
|
|
2216
|
-
_o(r.value, t.alg) || r.issues.push({
|
|
2217
|
-
code: "invalid_format",
|
|
2218
|
-
format: "jwt",
|
|
2219
|
-
input: r.value,
|
|
2220
|
-
inst: e,
|
|
2221
|
-
continue: !t.abort
|
|
2222
|
-
});
|
|
2223
|
-
};
|
|
2224
|
-
}), yt = /* @__PURE__ */ l("$ZodNumber", (e, t) => {
|
|
2225
|
-
k.init(e, t), e._zod.pattern = e._zod.bag.pattern ?? ht, e._zod.parse = (r, n) => {
|
|
2226
|
-
if (t.coerce) try {
|
|
2227
|
-
r.value = Number(r.value);
|
|
2228
|
-
} catch {
|
|
2229
|
-
}
|
|
2230
|
-
const o = r.value;
|
|
2231
|
-
if (typeof o == "number" && !Number.isNaN(o) && Number.isFinite(o)) return r;
|
|
2232
|
-
const i = typeof o == "number" ? Number.isNaN(o) ? "NaN" : Number.isFinite(o) ? void 0 : "Infinity" : void 0;
|
|
2233
|
-
return r.issues.push({
|
|
2234
|
-
expected: "number",
|
|
2235
|
-
code: "invalid_type",
|
|
2236
|
-
input: o,
|
|
2237
|
-
inst: e,
|
|
2238
|
-
...i ? { received: i } : {}
|
|
2239
|
-
}), r;
|
|
2240
|
-
};
|
|
2241
|
-
}), yo = /* @__PURE__ */ l("$ZodNumberFormat", (e, t) => {
|
|
2242
|
-
Rn.init(e, t), yt.init(e, t);
|
|
2243
|
-
}), bo = /* @__PURE__ */ l("$ZodBoolean", (e, t) => {
|
|
2244
|
-
k.init(e, t), e._zod.pattern = In, e._zod.parse = (r, n) => {
|
|
2245
|
-
if (t.coerce) try {
|
|
2246
|
-
r.value = !!r.value;
|
|
2247
|
-
} catch {
|
|
2248
|
-
}
|
|
2249
|
-
const o = r.value;
|
|
2250
|
-
return typeof o == "boolean" || r.issues.push({
|
|
2251
|
-
expected: "boolean",
|
|
2252
|
-
code: "invalid_type",
|
|
2253
|
-
input: o,
|
|
2254
|
-
inst: e
|
|
2255
|
-
}), r;
|
|
2256
|
-
};
|
|
2257
|
-
}), wo = /* @__PURE__ */ l("$ZodUnknown", (e, t) => {
|
|
2258
|
-
k.init(e, t), e._zod.parse = (r) => r;
|
|
2259
|
-
}), ko = /* @__PURE__ */ l("$ZodNever", (e, t) => {
|
|
2260
|
-
k.init(e, t), e._zod.parse = (r, n) => (r.issues.push({
|
|
2261
|
-
expected: "never",
|
|
2262
|
-
code: "invalid_type",
|
|
2263
|
-
input: r.value,
|
|
2264
|
-
inst: e
|
|
2265
|
-
}), r);
|
|
2266
|
-
});
|
|
2267
|
-
function Ne(e, t, r) {
|
|
2268
|
-
e.issues.length && t.issues.push(...M(r, e.issues)), t.value[r] = e.value;
|
|
2269
|
-
}
|
|
2270
|
-
var zo = /* @__PURE__ */ l("$ZodArray", (e, t) => {
|
|
2271
|
-
k.init(e, t), e._zod.parse = (r, n) => {
|
|
2272
|
-
const o = r.value;
|
|
2273
|
-
if (!Array.isArray(o))
|
|
2274
|
-
return r.issues.push({
|
|
2275
|
-
expected: "array",
|
|
2276
|
-
code: "invalid_type",
|
|
2277
|
-
input: o,
|
|
2278
|
-
inst: e
|
|
2279
|
-
}), r;
|
|
2280
|
-
r.value = Array(o.length);
|
|
2281
|
-
const i = [];
|
|
2282
|
-
for (let s = 0; s < o.length; s++) {
|
|
2283
|
-
const a = o[s], u = t.element._zod.run({
|
|
2284
|
-
value: a,
|
|
2285
|
-
issues: []
|
|
2286
|
-
}, n);
|
|
2287
|
-
u instanceof Promise ? i.push(u.then((c) => Ne(c, r, s))) : Ne(u, r, s);
|
|
2288
|
-
}
|
|
2289
|
-
return i.length ? Promise.all(i).then(() => r) : r;
|
|
2290
|
-
};
|
|
2291
|
-
});
|
|
2292
|
-
function ne(e, t, r, n, o, i) {
|
|
2293
|
-
const s = r in n;
|
|
2294
|
-
if (e.issues.length) {
|
|
2295
|
-
if (o && i && !s) return;
|
|
2296
|
-
t.issues.push(...M(r, e.issues));
|
|
2297
|
-
}
|
|
2298
|
-
if (!s && !o) {
|
|
2299
|
-
e.issues.length || t.issues.push({
|
|
2300
|
-
code: "invalid_type",
|
|
2301
|
-
expected: "nonoptional",
|
|
2302
|
-
input: void 0,
|
|
2303
|
-
path: [r]
|
|
2304
|
-
});
|
|
2305
|
-
return;
|
|
2306
|
-
}
|
|
2307
|
-
e.value === void 0 ? s && (t.value[r] = void 0) : t.value[r] = e.value;
|
|
2308
|
-
}
|
|
2309
|
-
function bt(e) {
|
|
2310
|
-
const t = Object.keys(e.shape);
|
|
2311
|
-
for (const n of t) if (!e.shape?.[n]?._zod?.traits?.has("$ZodType")) throw new Error(`Invalid element at key "${n}": expected a Zod schema`);
|
|
2312
|
-
const r = Dr(e.shape);
|
|
2313
|
-
return {
|
|
2314
|
-
...e,
|
|
2315
|
-
keys: t,
|
|
2316
|
-
keySet: new Set(t),
|
|
2317
|
-
numKeys: t.length,
|
|
2318
|
-
optionalKeys: new Set(r)
|
|
2319
|
-
};
|
|
2320
|
-
}
|
|
2321
|
-
function wt(e, t, r, n, o, i) {
|
|
2322
|
-
const s = [], a = o.keySet, u = o.catchall._zod, c = u.def.type, d = u.optin === "optional", h = u.optout === "optional";
|
|
2323
|
-
for (const f in t) {
|
|
2324
|
-
if (f === "__proto__" || a.has(f)) continue;
|
|
2325
|
-
if (c === "never") {
|
|
2326
|
-
s.push(f);
|
|
2327
|
-
continue;
|
|
2328
|
-
}
|
|
2329
|
-
const p = u.run({
|
|
2330
|
-
value: t[f],
|
|
2331
|
-
issues: []
|
|
2332
|
-
}, n);
|
|
2333
|
-
p instanceof Promise ? e.push(p.then((m) => ne(m, r, f, t, d, h))) : ne(p, r, f, t, d, h);
|
|
2334
|
-
}
|
|
2335
|
-
return s.length && r.issues.push({
|
|
2336
|
-
code: "unrecognized_keys",
|
|
2337
|
-
keys: s,
|
|
2338
|
-
input: t,
|
|
2339
|
-
inst: i
|
|
2340
|
-
}), e.length ? Promise.all(e).then(() => r) : r;
|
|
2341
|
-
}
|
|
2342
|
-
var $o = /* @__PURE__ */ l("$ZodObject", (e, t) => {
|
|
2343
|
-
if (k.init(e, t), !Object.getOwnPropertyDescriptor(t, "shape")?.get) {
|
|
2344
|
-
const s = t.shape;
|
|
2345
|
-
Object.defineProperty(t, "shape", { get: () => {
|
|
2346
|
-
const a = { ...s };
|
|
2347
|
-
return Object.defineProperty(t, "shape", { value: a }), a;
|
|
2348
|
-
} });
|
|
2349
|
-
}
|
|
2350
|
-
const r = _e(() => bt(t));
|
|
2351
|
-
y(e._zod, "propValues", () => {
|
|
2352
|
-
const s = t.shape, a = {};
|
|
2353
|
-
for (const u in s) {
|
|
2354
|
-
const c = s[u]._zod;
|
|
2355
|
-
if (c.values) {
|
|
2356
|
-
a[u] ?? (a[u] = /* @__PURE__ */ new Set());
|
|
2357
|
-
for (const d of c.values) a[u].add(d);
|
|
2358
|
-
}
|
|
2359
|
-
}
|
|
2360
|
-
return a;
|
|
2361
|
-
});
|
|
2362
|
-
const n = re, o = t.catchall;
|
|
2363
|
-
let i;
|
|
2364
|
-
e._zod.parse = (s, a) => {
|
|
2365
|
-
i ?? (i = r.value);
|
|
2366
|
-
const u = s.value;
|
|
2367
|
-
if (!n(u))
|
|
2368
|
-
return s.issues.push({
|
|
2369
|
-
expected: "object",
|
|
2370
|
-
code: "invalid_type",
|
|
2371
|
-
input: u,
|
|
2372
|
-
inst: e
|
|
2373
|
-
}), s;
|
|
2374
|
-
s.value = {};
|
|
2375
|
-
const c = [], d = i.shape;
|
|
2376
|
-
for (const h of i.keys) {
|
|
2377
|
-
const f = d[h], p = f._zod.optin === "optional", m = f._zod.optout === "optional", _ = f._zod.run({
|
|
2378
|
-
value: u[h],
|
|
2379
|
-
issues: []
|
|
2380
|
-
}, a);
|
|
2381
|
-
_ instanceof Promise ? c.push(_.then((w) => ne(w, s, h, u, p, m))) : ne(_, s, h, u, p, m);
|
|
2382
|
-
}
|
|
2383
|
-
return o ? wt(c, u, s, a, r.value, e) : c.length ? Promise.all(c).then(() => s) : s;
|
|
2384
|
-
};
|
|
2385
|
-
}), So = /* @__PURE__ */ l("$ZodObjectJIT", (e, t) => {
|
|
2386
|
-
$o.init(e, t);
|
|
2387
|
-
const r = e._zod.parse, n = _e(() => bt(t)), o = (f) => {
|
|
2388
|
-
const p = new qn([
|
|
2389
|
-
"shape",
|
|
2390
|
-
"payload",
|
|
2391
|
-
"ctx"
|
|
2392
|
-
]), m = n.value, _ = (N) => {
|
|
2393
|
-
const S = Te(N);
|
|
2394
|
-
return `shape[${S}]._zod.run({ value: input[${S}], issues: [] }, ctx)`;
|
|
2395
|
-
};
|
|
2396
|
-
p.write("const input = payload.value;");
|
|
2397
|
-
const w = /* @__PURE__ */ Object.create(null);
|
|
2398
|
-
let P = 0;
|
|
2399
|
-
for (const N of m.keys) w[N] = `key_${P++}`;
|
|
2400
|
-
p.write("const newResult = {};");
|
|
2401
|
-
for (const N of m.keys) {
|
|
2402
|
-
const S = w[N], O = Te(N), $e = f[N], Se = $e?._zod?.optin === "optional", Rt = $e?._zod?.optout === "optional";
|
|
2403
|
-
p.write(`const ${S} = ${_(N)};`), Se && Rt ? p.write(`
|
|
2404
|
-
if (${S}.issues.length) {
|
|
2405
|
-
if (${O} in input) {
|
|
2406
|
-
payload.issues = payload.issues.concat(${S}.issues.map(iss => ({
|
|
2407
|
-
...iss,
|
|
2408
|
-
path: iss.path ? [${O}, ...iss.path] : [${O}]
|
|
2409
|
-
})));
|
|
2410
|
-
}
|
|
2411
|
-
}
|
|
2412
|
-
|
|
2413
|
-
if (${S}.value === undefined) {
|
|
2414
|
-
if (${O} in input) {
|
|
2415
|
-
newResult[${O}] = undefined;
|
|
2416
|
-
}
|
|
2417
|
-
} else {
|
|
2418
|
-
newResult[${O}] = ${S}.value;
|
|
2419
|
-
}
|
|
2420
|
-
|
|
2421
|
-
`) : Se ? p.write(`
|
|
2422
|
-
if (${S}.issues.length) {
|
|
2423
|
-
payload.issues = payload.issues.concat(${S}.issues.map(iss => ({
|
|
2424
|
-
...iss,
|
|
2425
|
-
path: iss.path ? [${O}, ...iss.path] : [${O}]
|
|
2426
|
-
})));
|
|
2427
|
-
}
|
|
2428
|
-
|
|
2429
|
-
if (${S}.value === undefined) {
|
|
2430
|
-
if (${O} in input) {
|
|
2431
|
-
newResult[${O}] = undefined;
|
|
2432
|
-
}
|
|
2433
|
-
} else {
|
|
2434
|
-
newResult[${O}] = ${S}.value;
|
|
2435
|
-
}
|
|
2436
|
-
|
|
2437
|
-
`) : p.write(`
|
|
2438
|
-
const ${S}_present = ${O} in input;
|
|
2439
|
-
if (${S}.issues.length) {
|
|
2440
|
-
payload.issues = payload.issues.concat(${S}.issues.map(iss => ({
|
|
2441
|
-
...iss,
|
|
2442
|
-
path: iss.path ? [${O}, ...iss.path] : [${O}]
|
|
2443
|
-
})));
|
|
2444
|
-
}
|
|
2445
|
-
if (!${S}_present && !${S}.issues.length) {
|
|
2446
|
-
payload.issues.push({
|
|
2447
|
-
code: "invalid_type",
|
|
2448
|
-
expected: "nonoptional",
|
|
2449
|
-
input: undefined,
|
|
2450
|
-
path: [${O}]
|
|
2451
|
-
});
|
|
2452
|
-
}
|
|
2453
|
-
|
|
2454
|
-
if (${S}_present) {
|
|
2455
|
-
if (${S}.value === undefined) {
|
|
2456
|
-
newResult[${O}] = undefined;
|
|
2457
|
-
} else {
|
|
2458
|
-
newResult[${O}] = ${S}.value;
|
|
2459
|
-
}
|
|
2460
|
-
}
|
|
2461
|
-
|
|
2462
|
-
`);
|
|
2463
|
-
}
|
|
2464
|
-
p.write("payload.value = newResult;"), p.write("return payload;");
|
|
2465
|
-
const Nt = p.compile();
|
|
2466
|
-
return (N, S) => Nt(f, N, S);
|
|
2467
|
-
};
|
|
2468
|
-
let i;
|
|
2469
|
-
const s = re, a = !te.jitless, c = a && Cr.value, d = t.catchall;
|
|
2470
|
-
let h;
|
|
2471
|
-
e._zod.parse = (f, p) => {
|
|
2472
|
-
h ?? (h = n.value);
|
|
2473
|
-
const m = f.value;
|
|
2474
|
-
return s(m) ? a && c && p?.async === !1 && p.jitless !== !0 ? (i || (i = o(t.shape)), f = i(f, p), d ? wt([], m, f, p, h, e) : f) : r(f, p) : (f.issues.push({
|
|
2475
|
-
expected: "object",
|
|
2476
|
-
code: "invalid_type",
|
|
2477
|
-
input: m,
|
|
2478
|
-
inst: e
|
|
2479
|
-
}), f);
|
|
2480
|
-
};
|
|
2481
|
-
});
|
|
2482
|
-
function Re(e, t, r, n) {
|
|
2483
|
-
for (const i of e) if (i.issues.length === 0)
|
|
2484
|
-
return t.value = i.value, t;
|
|
2485
|
-
const o = e.filter((i) => !F(i));
|
|
2486
|
-
return o.length === 1 ? (t.value = o[0].value, o[0]) : (t.issues.push({
|
|
2487
|
-
code: "invalid_union",
|
|
2488
|
-
input: t.value,
|
|
2489
|
-
inst: r,
|
|
2490
|
-
errors: e.map((i) => i.issues.map((s) => C(s, n, j())))
|
|
2491
|
-
}), t);
|
|
2492
|
-
}
|
|
2493
|
-
var Zo = /* @__PURE__ */ l("$ZodUnion", (e, t) => {
|
|
2494
|
-
k.init(e, t), y(e._zod, "optin", () => t.options.some((n) => n._zod.optin === "optional") ? "optional" : void 0), y(e._zod, "optout", () => t.options.some((n) => n._zod.optout === "optional") ? "optional" : void 0), y(e._zod, "values", () => {
|
|
2495
|
-
if (t.options.every((n) => n._zod.values)) return new Set(t.options.flatMap((n) => Array.from(n._zod.values)));
|
|
2496
|
-
}), y(e._zod, "pattern", () => {
|
|
2497
|
-
if (t.options.every((n) => n._zod.pattern)) {
|
|
2498
|
-
const n = t.options.map((o) => o._zod.pattern);
|
|
2499
|
-
return new RegExp(`^(${n.map((o) => ye(o.source)).join("|")})$`);
|
|
2500
|
-
}
|
|
2501
|
-
});
|
|
2502
|
-
const r = t.options.length === 1 ? t.options[0]._zod.run : null;
|
|
2503
|
-
e._zod.parse = (n, o) => {
|
|
2504
|
-
if (r) return r(n, o);
|
|
2505
|
-
let i = !1;
|
|
2506
|
-
const s = [];
|
|
2507
|
-
for (const a of t.options) {
|
|
2508
|
-
const u = a._zod.run({
|
|
2509
|
-
value: n.value,
|
|
2510
|
-
issues: []
|
|
2511
|
-
}, o);
|
|
2512
|
-
if (u instanceof Promise)
|
|
2513
|
-
s.push(u), i = !0;
|
|
2514
|
-
else {
|
|
2515
|
-
if (u.issues.length === 0) return u;
|
|
2516
|
-
s.push(u);
|
|
2517
|
-
}
|
|
2518
|
-
}
|
|
2519
|
-
return i ? Promise.all(s).then((a) => Re(a, n, e, o)) : Re(s, n, e, o);
|
|
2520
|
-
};
|
|
2521
|
-
}), Oo = /* @__PURE__ */ l("$ZodIntersection", (e, t) => {
|
|
2522
|
-
k.init(e, t), e._zod.parse = (r, n) => {
|
|
2523
|
-
const o = r.value, i = t.left._zod.run({
|
|
2524
|
-
value: o,
|
|
2525
|
-
issues: []
|
|
2526
|
-
}, n), s = t.right._zod.run({
|
|
2527
|
-
value: o,
|
|
2528
|
-
issues: []
|
|
2529
|
-
}, n);
|
|
2530
|
-
return i instanceof Promise || s instanceof Promise ? Promise.all([i, s]).then(([a, u]) => je(r, a, u)) : je(r, i, s);
|
|
2531
|
-
};
|
|
2532
|
-
});
|
|
2533
|
-
function fe(e, t) {
|
|
2534
|
-
if (e === t) return {
|
|
2535
|
-
valid: !0,
|
|
2536
|
-
data: e
|
|
2537
|
-
};
|
|
2538
|
-
if (e instanceof Date && t instanceof Date && +e == +t) return {
|
|
2539
|
-
valid: !0,
|
|
2540
|
-
data: e
|
|
2541
|
-
};
|
|
2542
|
-
if (V(e) && V(t)) {
|
|
2543
|
-
const r = Object.keys(t), n = Object.keys(e).filter((i) => r.indexOf(i) !== -1), o = {
|
|
2544
|
-
...e,
|
|
2545
|
-
...t
|
|
2546
|
-
};
|
|
2547
|
-
for (const i of n) {
|
|
2548
|
-
const s = fe(e[i], t[i]);
|
|
2549
|
-
if (!s.valid) return {
|
|
2550
|
-
valid: !1,
|
|
2551
|
-
mergeErrorPath: [i, ...s.mergeErrorPath]
|
|
2552
|
-
};
|
|
2553
|
-
o[i] = s.data;
|
|
2554
|
-
}
|
|
2555
|
-
return {
|
|
2556
|
-
valid: !0,
|
|
2557
|
-
data: o
|
|
2558
|
-
};
|
|
2559
|
-
}
|
|
2560
|
-
if (Array.isArray(e) && Array.isArray(t)) {
|
|
2561
|
-
if (e.length !== t.length) return {
|
|
2562
|
-
valid: !1,
|
|
2563
|
-
mergeErrorPath: []
|
|
2564
|
-
};
|
|
2565
|
-
const r = [];
|
|
2566
|
-
for (let n = 0; n < e.length; n++) {
|
|
2567
|
-
const o = e[n], i = t[n], s = fe(o, i);
|
|
2568
|
-
if (!s.valid) return {
|
|
2569
|
-
valid: !1,
|
|
2570
|
-
mergeErrorPath: [n, ...s.mergeErrorPath]
|
|
2571
|
-
};
|
|
2572
|
-
r.push(s.data);
|
|
2573
|
-
}
|
|
2574
|
-
return {
|
|
2575
|
-
valid: !0,
|
|
2576
|
-
data: r
|
|
2577
|
-
};
|
|
2578
|
-
}
|
|
2579
|
-
return {
|
|
2580
|
-
valid: !1,
|
|
2581
|
-
mergeErrorPath: []
|
|
2582
|
-
};
|
|
2583
|
-
}
|
|
2584
|
-
function je(e, t, r) {
|
|
2585
|
-
const n = /* @__PURE__ */ new Map();
|
|
2586
|
-
let o;
|
|
2587
|
-
for (const a of t.issues) if (a.code === "unrecognized_keys") {
|
|
2588
|
-
o ?? (o = a);
|
|
2589
|
-
for (const u of a.keys)
|
|
2590
|
-
n.has(u) || n.set(u, {}), n.get(u).l = !0;
|
|
2591
|
-
} else e.issues.push(a);
|
|
2592
|
-
for (const a of r.issues) if (a.code === "unrecognized_keys") for (const u of a.keys)
|
|
2593
|
-
n.has(u) || n.set(u, {}), n.get(u).r = !0;
|
|
2594
|
-
else e.issues.push(a);
|
|
2595
|
-
const i = [...n].filter(([, a]) => a.l && a.r).map(([a]) => a);
|
|
2596
|
-
if (i.length && o && e.issues.push({
|
|
2597
|
-
...o,
|
|
2598
|
-
keys: i
|
|
2599
|
-
}), F(e)) return e;
|
|
2600
|
-
const s = fe(t.value, r.value);
|
|
2601
|
-
if (!s.valid) throw new Error(`Unmergable intersection. Error path: ${JSON.stringify(s.mergeErrorPath)}`);
|
|
2602
|
-
return e.value = s.data, e;
|
|
2603
|
-
}
|
|
2604
|
-
var Po = /* @__PURE__ */ l("$ZodRecord", (e, t) => {
|
|
2605
|
-
k.init(e, t), e._zod.parse = (r, n) => {
|
|
2606
|
-
const o = r.value;
|
|
2607
|
-
if (!V(o))
|
|
2608
|
-
return r.issues.push({
|
|
2609
|
-
expected: "record",
|
|
2610
|
-
code: "invalid_type",
|
|
2611
|
-
input: o,
|
|
2612
|
-
inst: e
|
|
2613
|
-
}), r;
|
|
2614
|
-
const i = [], s = t.keyType._zod.values;
|
|
2615
|
-
if (s) {
|
|
2616
|
-
r.value = {};
|
|
2617
|
-
const a = /* @__PURE__ */ new Set();
|
|
2618
|
-
for (const c of s) if (typeof c == "string" || typeof c == "number" || typeof c == "symbol") {
|
|
2619
|
-
a.add(typeof c == "number" ? c.toString() : c);
|
|
2620
|
-
const d = t.keyType._zod.run({
|
|
2621
|
-
value: c,
|
|
2622
|
-
issues: []
|
|
2623
|
-
}, n);
|
|
2624
|
-
if (d instanceof Promise) throw new Error("Async schemas not supported in object keys currently");
|
|
2625
|
-
if (d.issues.length) {
|
|
2626
|
-
r.issues.push({
|
|
2627
|
-
code: "invalid_key",
|
|
2628
|
-
origin: "record",
|
|
2629
|
-
issues: d.issues.map((p) => C(p, n, j())),
|
|
2630
|
-
input: c,
|
|
2631
|
-
path: [c],
|
|
2632
|
-
inst: e
|
|
2633
|
-
});
|
|
2634
|
-
continue;
|
|
2635
|
-
}
|
|
2636
|
-
const h = d.value, f = t.valueType._zod.run({
|
|
2637
|
-
value: o[c],
|
|
2638
|
-
issues: []
|
|
2639
|
-
}, n);
|
|
2640
|
-
f instanceof Promise ? i.push(f.then((p) => {
|
|
2641
|
-
p.issues.length && r.issues.push(...M(c, p.issues)), r.value[h] = p.value;
|
|
2642
|
-
})) : (f.issues.length && r.issues.push(...M(c, f.issues)), r.value[h] = f.value);
|
|
2643
|
-
}
|
|
2644
|
-
let u;
|
|
2645
|
-
for (const c in o) a.has(c) || (u = u ?? [], u.push(c));
|
|
2646
|
-
u && u.length > 0 && r.issues.push({
|
|
2647
|
-
code: "unrecognized_keys",
|
|
2648
|
-
input: o,
|
|
2649
|
-
inst: e,
|
|
2650
|
-
keys: u
|
|
2651
|
-
});
|
|
2652
|
-
} else {
|
|
2653
|
-
r.value = {};
|
|
2654
|
-
for (const a of Reflect.ownKeys(o)) {
|
|
2655
|
-
if (a === "__proto__" || !Object.prototype.propertyIsEnumerable.call(o, a)) continue;
|
|
2656
|
-
let u = t.keyType._zod.run({
|
|
2657
|
-
value: a,
|
|
2658
|
-
issues: []
|
|
2659
|
-
}, n);
|
|
2660
|
-
if (u instanceof Promise) throw new Error("Async schemas not supported in object keys currently");
|
|
2661
|
-
if (typeof a == "string" && ht.test(a) && u.issues.length) {
|
|
2662
|
-
const d = t.keyType._zod.run({
|
|
2663
|
-
value: Number(a),
|
|
2664
|
-
issues: []
|
|
2665
|
-
}, n);
|
|
2666
|
-
if (d instanceof Promise) throw new Error("Async schemas not supported in object keys currently");
|
|
2667
|
-
d.issues.length === 0 && (u = d);
|
|
2668
|
-
}
|
|
2669
|
-
if (u.issues.length) {
|
|
2670
|
-
t.mode === "loose" ? r.value[a] = o[a] : r.issues.push({
|
|
2671
|
-
code: "invalid_key",
|
|
2672
|
-
origin: "record",
|
|
2673
|
-
issues: u.issues.map((d) => C(d, n, j())),
|
|
2674
|
-
input: a,
|
|
2675
|
-
path: [a],
|
|
2676
|
-
inst: e
|
|
2677
|
-
});
|
|
2678
|
-
continue;
|
|
2679
|
-
}
|
|
2680
|
-
const c = t.valueType._zod.run({
|
|
2681
|
-
value: o[a],
|
|
2682
|
-
issues: []
|
|
2683
|
-
}, n);
|
|
2684
|
-
c instanceof Promise ? i.push(c.then((d) => {
|
|
2685
|
-
d.issues.length && r.issues.push(...M(a, d.issues)), r.value[u.value] = d.value;
|
|
2686
|
-
})) : (c.issues.length && r.issues.push(...M(a, c.issues)), r.value[u.value] = c.value);
|
|
2687
|
-
}
|
|
2688
|
-
}
|
|
2689
|
-
return i.length ? Promise.all(i).then(() => r) : r;
|
|
2690
|
-
};
|
|
2691
|
-
}), Eo = /* @__PURE__ */ l("$ZodEnum", (e, t) => {
|
|
2692
|
-
k.init(e, t);
|
|
2693
|
-
const r = it(t.entries), n = new Set(r);
|
|
2694
|
-
e._zod.values = n, e._zod.pattern = new RegExp(`^(${r.filter((o) => xr.has(typeof o)).map((o) => typeof o == "string" ? q(o) : o.toString()).join("|")})$`), e._zod.parse = (o, i) => {
|
|
2695
|
-
const s = o.value;
|
|
2696
|
-
return n.has(s) || o.issues.push({
|
|
2697
|
-
code: "invalid_value",
|
|
2698
|
-
values: r,
|
|
2699
|
-
input: s,
|
|
2700
|
-
inst: e
|
|
2701
|
-
}), o;
|
|
2702
|
-
};
|
|
2703
|
-
}), Io = /* @__PURE__ */ l("$ZodLiteral", (e, t) => {
|
|
2704
|
-
if (k.init(e, t), t.values.length === 0) throw new Error("Cannot create literal schema with no valid values");
|
|
2705
|
-
const r = new Set(t.values);
|
|
2706
|
-
e._zod.values = r, e._zod.pattern = new RegExp(`^(${t.values.map((n) => typeof n == "string" ? q(n) : n ? q(n.toString()) : String(n)).join("|")})$`), e._zod.parse = (n, o) => {
|
|
2707
|
-
const i = n.value;
|
|
2708
|
-
return r.has(i) || n.issues.push({
|
|
2709
|
-
code: "invalid_value",
|
|
2710
|
-
values: t.values,
|
|
2711
|
-
input: i,
|
|
2712
|
-
inst: e
|
|
2713
|
-
}), n;
|
|
2714
|
-
};
|
|
2715
|
-
}), To = /* @__PURE__ */ l("$ZodTransform", (e, t) => {
|
|
2716
|
-
k.init(e, t), e._zod.optin = "optional", e._zod.parse = (r, n) => {
|
|
2717
|
-
if (n.direction === "backward") throw new ot(e.constructor.name);
|
|
2718
|
-
const o = t.transform(r.value, r);
|
|
2719
|
-
if (n.async) return (o instanceof Promise ? o : Promise.resolve(o)).then((i) => (r.value = i, r.fallback = !0, r));
|
|
2720
|
-
if (o instanceof Promise) throw new J();
|
|
2721
|
-
return r.value = o, r.fallback = !0, r;
|
|
2722
|
-
};
|
|
2723
|
-
});
|
|
2724
|
-
function Ce(e, t) {
|
|
2725
|
-
return t === void 0 && (e.issues.length || e.fallback) ? {
|
|
2726
|
-
issues: [],
|
|
2727
|
-
value: void 0
|
|
2728
|
-
} : e;
|
|
2729
|
-
}
|
|
2730
|
-
var kt = /* @__PURE__ */ l("$ZodOptional", (e, t) => {
|
|
2731
|
-
k.init(e, t), e._zod.optin = "optional", e._zod.optout = "optional", y(e._zod, "values", () => t.innerType._zod.values ? /* @__PURE__ */ new Set([...t.innerType._zod.values, void 0]) : void 0), y(e._zod, "pattern", () => {
|
|
2732
|
-
const r = t.innerType._zod.pattern;
|
|
2733
|
-
return r ? new RegExp(`^(${ye(r.source)})?$`) : void 0;
|
|
2734
|
-
}), e._zod.parse = (r, n) => {
|
|
2735
|
-
if (t.innerType._zod.optin === "optional") {
|
|
2736
|
-
const o = r.value, i = t.innerType._zod.run(r, n);
|
|
2737
|
-
return i instanceof Promise ? i.then((s) => Ce(s, o)) : Ce(i, o);
|
|
2738
|
-
}
|
|
2739
|
-
return r.value === void 0 ? r : t.innerType._zod.run(r, n);
|
|
2740
|
-
};
|
|
2741
|
-
}), Ao = /* @__PURE__ */ l("$ZodExactOptional", (e, t) => {
|
|
2742
|
-
kt.init(e, t), y(e._zod, "values", () => t.innerType._zod.values), y(e._zod, "pattern", () => t.innerType._zod.pattern), e._zod.parse = (r, n) => t.innerType._zod.run(r, n);
|
|
2743
|
-
}), No = /* @__PURE__ */ l("$ZodNullable", (e, t) => {
|
|
2744
|
-
k.init(e, t), y(e._zod, "optin", () => t.innerType._zod.optin), y(e._zod, "optout", () => t.innerType._zod.optout), y(e._zod, "pattern", () => {
|
|
2745
|
-
const r = t.innerType._zod.pattern;
|
|
2746
|
-
return r ? new RegExp(`^(${ye(r.source)}|null)$`) : void 0;
|
|
2747
|
-
}), y(e._zod, "values", () => t.innerType._zod.values ? /* @__PURE__ */ new Set([...t.innerType._zod.values, null]) : void 0), e._zod.parse = (r, n) => r.value === null ? r : t.innerType._zod.run(r, n);
|
|
2748
|
-
}), Ro = /* @__PURE__ */ l("$ZodDefault", (e, t) => {
|
|
2749
|
-
k.init(e, t), e._zod.optin = "optional", y(e._zod, "values", () => t.innerType._zod.values), e._zod.parse = (r, n) => {
|
|
2750
|
-
if (n.direction === "backward") return t.innerType._zod.run(r, n);
|
|
2751
|
-
if (r.value === void 0)
|
|
2752
|
-
return r.value = t.defaultValue, r;
|
|
2753
|
-
const o = t.innerType._zod.run(r, n);
|
|
2754
|
-
return o instanceof Promise ? o.then((i) => xe(i, t)) : xe(o, t);
|
|
2755
|
-
};
|
|
2756
|
-
});
|
|
2757
|
-
function xe(e, t) {
|
|
2758
|
-
return e.value === void 0 && (e.value = t.defaultValue), e;
|
|
2759
|
-
}
|
|
2760
|
-
var jo = /* @__PURE__ */ l("$ZodPrefault", (e, t) => {
|
|
2761
|
-
k.init(e, t), e._zod.optin = "optional", y(e._zod, "values", () => t.innerType._zod.values), e._zod.parse = (r, n) => (n.direction === "backward" || r.value === void 0 && (r.value = t.defaultValue), t.innerType._zod.run(r, n));
|
|
2762
|
-
}), Co = /* @__PURE__ */ l("$ZodNonOptional", (e, t) => {
|
|
2763
|
-
k.init(e, t), y(e._zod, "values", () => {
|
|
2764
|
-
const r = t.innerType._zod.values;
|
|
2765
|
-
return r ? new Set([...r].filter((n) => n !== void 0)) : void 0;
|
|
2766
|
-
}), e._zod.parse = (r, n) => {
|
|
2767
|
-
const o = t.innerType._zod.run(r, n);
|
|
2768
|
-
return o instanceof Promise ? o.then((i) => De(i, e)) : De(o, e);
|
|
2769
|
-
};
|
|
2770
|
-
});
|
|
2771
|
-
function De(e, t) {
|
|
2772
|
-
return !e.issues.length && e.value === void 0 && e.issues.push({
|
|
2773
|
-
code: "invalid_type",
|
|
2774
|
-
expected: "nonoptional",
|
|
2775
|
-
input: e.value,
|
|
2776
|
-
inst: t
|
|
2777
|
-
}), e;
|
|
2778
|
-
}
|
|
2779
|
-
var xo = /* @__PURE__ */ l("$ZodCatch", (e, t) => {
|
|
2780
|
-
k.init(e, t), e._zod.optin = "optional", y(e._zod, "optout", () => t.innerType._zod.optout), y(e._zod, "values", () => t.innerType._zod.values), e._zod.parse = (r, n) => {
|
|
2781
|
-
if (n.direction === "backward") return t.innerType._zod.run(r, n);
|
|
2782
|
-
const o = t.innerType._zod.run(r, n);
|
|
2783
|
-
return o instanceof Promise ? o.then((i) => (r.value = i.value, i.issues.length && (r.value = t.catchValue({
|
|
2784
|
-
...r,
|
|
2785
|
-
error: { issues: i.issues.map((s) => C(s, n, j())) },
|
|
2786
|
-
input: r.value
|
|
2787
|
-
}), r.issues = [], r.fallback = !0), r)) : (r.value = o.value, o.issues.length && (r.value = t.catchValue({
|
|
2788
|
-
...r,
|
|
2789
|
-
error: { issues: o.issues.map((i) => C(i, n, j())) },
|
|
2790
|
-
input: r.value
|
|
2791
|
-
}), r.issues = [], r.fallback = !0), r);
|
|
2792
|
-
};
|
|
2793
|
-
}), Do = /* @__PURE__ */ l("$ZodPipe", (e, t) => {
|
|
2794
|
-
k.init(e, t), y(e._zod, "values", () => t.in._zod.values), y(e._zod, "optin", () => t.in._zod.optin), y(e._zod, "optout", () => t.out._zod.optout), y(e._zod, "propValues", () => t.in._zod.propValues), e._zod.parse = (r, n) => {
|
|
2795
|
-
if (n.direction === "backward") {
|
|
2796
|
-
const i = t.out._zod.run(r, n);
|
|
2797
|
-
return i instanceof Promise ? i.then((s) => Q(s, t.in, n)) : Q(i, t.in, n);
|
|
2798
|
-
}
|
|
2799
|
-
const o = t.in._zod.run(r, n);
|
|
2800
|
-
return o instanceof Promise ? o.then((i) => Q(i, t.out, n)) : Q(o, t.out, n);
|
|
2801
|
-
};
|
|
2802
|
-
});
|
|
2803
|
-
function Q(e, t, r) {
|
|
2804
|
-
return e.issues.length ? (e.aborted = !0, e) : t._zod.run({
|
|
2805
|
-
value: e.value,
|
|
2806
|
-
issues: e.issues,
|
|
2807
|
-
fallback: e.fallback
|
|
2808
|
-
}, r);
|
|
2809
|
-
}
|
|
2810
|
-
var Uo = /* @__PURE__ */ l("$ZodReadonly", (e, t) => {
|
|
2811
|
-
k.init(e, t), y(e._zod, "propValues", () => t.innerType._zod.propValues), y(e._zod, "values", () => t.innerType._zod.values), y(e._zod, "optin", () => t.innerType?._zod?.optin), y(e._zod, "optout", () => t.innerType?._zod?.optout), e._zod.parse = (r, n) => {
|
|
2812
|
-
if (n.direction === "backward") return t.innerType._zod.run(r, n);
|
|
2813
|
-
const o = t.innerType._zod.run(r, n);
|
|
2814
|
-
return o instanceof Promise ? o.then(Ue) : Ue(o);
|
|
2815
|
-
};
|
|
2816
|
-
});
|
|
2817
|
-
function Ue(e) {
|
|
2818
|
-
return e.value = Object.freeze(e.value), e;
|
|
2819
|
-
}
|
|
2820
|
-
var Lo = /* @__PURE__ */ l("$ZodCustom", (e, t) => {
|
|
2821
|
-
I.init(e, t), k.init(e, t), e._zod.parse = (r, n) => r, e._zod.check = (r) => {
|
|
2822
|
-
const n = r.value, o = t.fn(n);
|
|
2823
|
-
if (o instanceof Promise) return o.then((i) => Le(i, r, n, e));
|
|
2824
|
-
Le(o, r, n, e);
|
|
2825
|
-
};
|
|
2826
|
-
});
|
|
2827
|
-
function Le(e, t, r, n) {
|
|
2828
|
-
if (!e) {
|
|
2829
|
-
const o = {
|
|
2830
|
-
code: "custom",
|
|
2831
|
-
input: r,
|
|
2832
|
-
inst: n,
|
|
2833
|
-
path: [...n._zod.def.path ?? []],
|
|
2834
|
-
continue: !n._zod.def.abort
|
|
2835
|
-
};
|
|
2836
|
-
n._zod.def.params && (o.params = n._zod.def.params), t.issues.push(H(o));
|
|
2837
|
-
}
|
|
2838
|
-
}
|
|
2839
|
-
var Fe, Fo = class {
|
|
2840
|
-
constructor() {
|
|
2841
|
-
this._map = /* @__PURE__ */ new WeakMap(), this._idmap = /* @__PURE__ */ new Map();
|
|
2842
|
-
}
|
|
2843
|
-
add(e, ...t) {
|
|
2844
|
-
const r = t[0];
|
|
2845
|
-
return this._map.set(e, r), r && typeof r == "object" && "id" in r && this._idmap.set(r.id, e), this;
|
|
2846
|
-
}
|
|
2847
|
-
clear() {
|
|
2848
|
-
return this._map = /* @__PURE__ */ new WeakMap(), this._idmap = /* @__PURE__ */ new Map(), this;
|
|
2849
|
-
}
|
|
2850
|
-
remove(e) {
|
|
2851
|
-
const t = this._map.get(e);
|
|
2852
|
-
return t && typeof t == "object" && "id" in t && this._idmap.delete(t.id), this._map.delete(e), this;
|
|
2853
|
-
}
|
|
2854
|
-
get(e) {
|
|
2855
|
-
const t = e._zod.parent;
|
|
2856
|
-
if (t) {
|
|
2857
|
-
const r = { ...this.get(t) ?? {} };
|
|
2858
|
-
delete r.id;
|
|
2859
|
-
const n = {
|
|
2860
|
-
...r,
|
|
2861
|
-
...this._map.get(e)
|
|
2862
|
-
};
|
|
2863
|
-
return Object.keys(n).length ? n : void 0;
|
|
2864
|
-
}
|
|
2865
|
-
return this._map.get(e);
|
|
2866
|
-
}
|
|
2867
|
-
has(e) {
|
|
2868
|
-
return this._map.has(e);
|
|
2869
|
-
}
|
|
2870
|
-
};
|
|
2871
|
-
function Mo() {
|
|
2872
|
-
return new Fo();
|
|
2873
|
-
}
|
|
2874
|
-
(Fe = globalThis).__zod_globalRegistry ?? (Fe.__zod_globalRegistry = Mo());
|
|
2875
|
-
var B = globalThis.__zod_globalRegistry;
|
|
2876
|
-
// @__NO_SIDE_EFFECTS__
|
|
2877
|
-
function Jo(e, t) {
|
|
2878
|
-
return new e({
|
|
2879
|
-
type: "string",
|
|
2880
|
-
...g(t)
|
|
2881
|
-
});
|
|
2882
|
-
}
|
|
2883
|
-
// @__NO_SIDE_EFFECTS__
|
|
2884
|
-
function Vo(e, t) {
|
|
2885
|
-
return new e({
|
|
2886
|
-
type: "string",
|
|
2887
|
-
format: "email",
|
|
2888
|
-
check: "string_format",
|
|
2889
|
-
abort: !1,
|
|
2890
|
-
...g(t)
|
|
2891
|
-
});
|
|
2892
|
-
}
|
|
2893
|
-
// @__NO_SIDE_EFFECTS__
|
|
2894
|
-
function Me(e, t) {
|
|
2895
|
-
return new e({
|
|
2896
|
-
type: "string",
|
|
2897
|
-
format: "guid",
|
|
2898
|
-
check: "string_format",
|
|
2899
|
-
abort: !1,
|
|
2900
|
-
...g(t)
|
|
2901
|
-
});
|
|
2902
|
-
}
|
|
2903
|
-
// @__NO_SIDE_EFFECTS__
|
|
2904
|
-
function qo(e, t) {
|
|
2905
|
-
return new e({
|
|
2906
|
-
type: "string",
|
|
2907
|
-
format: "uuid",
|
|
2908
|
-
check: "string_format",
|
|
2909
|
-
abort: !1,
|
|
2910
|
-
...g(t)
|
|
2911
|
-
});
|
|
2912
|
-
}
|
|
2913
|
-
// @__NO_SIDE_EFFECTS__
|
|
2914
|
-
function Go(e, t) {
|
|
2915
|
-
return new e({
|
|
2916
|
-
type: "string",
|
|
2917
|
-
format: "uuid",
|
|
2918
|
-
check: "string_format",
|
|
2919
|
-
abort: !1,
|
|
2920
|
-
version: "v4",
|
|
2921
|
-
...g(t)
|
|
2922
|
-
});
|
|
2923
|
-
}
|
|
2924
|
-
// @__NO_SIDE_EFFECTS__
|
|
2925
|
-
function Wo(e, t) {
|
|
2926
|
-
return new e({
|
|
2927
|
-
type: "string",
|
|
2928
|
-
format: "uuid",
|
|
2929
|
-
check: "string_format",
|
|
2930
|
-
abort: !1,
|
|
2931
|
-
version: "v6",
|
|
2932
|
-
...g(t)
|
|
2933
|
-
});
|
|
2934
|
-
}
|
|
2935
|
-
// @__NO_SIDE_EFFECTS__
|
|
2936
|
-
function Bo(e, t) {
|
|
2937
|
-
return new e({
|
|
2938
|
-
type: "string",
|
|
2939
|
-
format: "uuid",
|
|
2940
|
-
check: "string_format",
|
|
2941
|
-
abort: !1,
|
|
2942
|
-
version: "v7",
|
|
2943
|
-
...g(t)
|
|
2944
|
-
});
|
|
2945
|
-
}
|
|
2946
|
-
// @__NO_SIDE_EFFECTS__
|
|
2947
|
-
function Ko(e, t) {
|
|
2948
|
-
return new e({
|
|
2949
|
-
type: "string",
|
|
2950
|
-
format: "url",
|
|
2951
|
-
check: "string_format",
|
|
2952
|
-
abort: !1,
|
|
2953
|
-
...g(t)
|
|
2954
|
-
});
|
|
2955
|
-
}
|
|
2956
|
-
// @__NO_SIDE_EFFECTS__
|
|
2957
|
-
function Ho(e, t) {
|
|
2958
|
-
return new e({
|
|
2959
|
-
type: "string",
|
|
2960
|
-
format: "emoji",
|
|
2961
|
-
check: "string_format",
|
|
2962
|
-
abort: !1,
|
|
2963
|
-
...g(t)
|
|
2964
|
-
});
|
|
2965
|
-
}
|
|
2966
|
-
// @__NO_SIDE_EFFECTS__
|
|
2967
|
-
function Yo(e, t) {
|
|
2968
|
-
return new e({
|
|
2969
|
-
type: "string",
|
|
2970
|
-
format: "nanoid",
|
|
2971
|
-
check: "string_format",
|
|
2972
|
-
abort: !1,
|
|
2973
|
-
...g(t)
|
|
2974
|
-
});
|
|
2975
|
-
}
|
|
2976
|
-
// @__NO_SIDE_EFFECTS__
|
|
2977
|
-
function Xo(e, t) {
|
|
2978
|
-
return new e({
|
|
2979
|
-
type: "string",
|
|
2980
|
-
format: "cuid",
|
|
2981
|
-
check: "string_format",
|
|
2982
|
-
abort: !1,
|
|
2983
|
-
...g(t)
|
|
2984
|
-
});
|
|
2985
|
-
}
|
|
2986
|
-
// @__NO_SIDE_EFFECTS__
|
|
2987
|
-
function Qo(e, t) {
|
|
2988
|
-
return new e({
|
|
2989
|
-
type: "string",
|
|
2990
|
-
format: "cuid2",
|
|
2991
|
-
check: "string_format",
|
|
2992
|
-
abort: !1,
|
|
2993
|
-
...g(t)
|
|
2994
|
-
});
|
|
2995
|
-
}
|
|
2996
|
-
// @__NO_SIDE_EFFECTS__
|
|
2997
|
-
function ei(e, t) {
|
|
2998
|
-
return new e({
|
|
2999
|
-
type: "string",
|
|
3000
|
-
format: "ulid",
|
|
3001
|
-
check: "string_format",
|
|
3002
|
-
abort: !1,
|
|
3003
|
-
...g(t)
|
|
3004
|
-
});
|
|
3005
|
-
}
|
|
3006
|
-
// @__NO_SIDE_EFFECTS__
|
|
3007
|
-
function ti(e, t) {
|
|
3008
|
-
return new e({
|
|
3009
|
-
type: "string",
|
|
3010
|
-
format: "xid",
|
|
3011
|
-
check: "string_format",
|
|
3012
|
-
abort: !1,
|
|
3013
|
-
...g(t)
|
|
3014
|
-
});
|
|
3015
|
-
}
|
|
3016
|
-
// @__NO_SIDE_EFFECTS__
|
|
3017
|
-
function ri(e, t) {
|
|
3018
|
-
return new e({
|
|
3019
|
-
type: "string",
|
|
3020
|
-
format: "ksuid",
|
|
3021
|
-
check: "string_format",
|
|
3022
|
-
abort: !1,
|
|
3023
|
-
...g(t)
|
|
3024
|
-
});
|
|
3025
|
-
}
|
|
3026
|
-
// @__NO_SIDE_EFFECTS__
|
|
3027
|
-
function ni(e, t) {
|
|
3028
|
-
return new e({
|
|
3029
|
-
type: "string",
|
|
3030
|
-
format: "ipv4",
|
|
3031
|
-
check: "string_format",
|
|
3032
|
-
abort: !1,
|
|
3033
|
-
...g(t)
|
|
3034
|
-
});
|
|
3035
|
-
}
|
|
3036
|
-
// @__NO_SIDE_EFFECTS__
|
|
3037
|
-
function oi(e, t) {
|
|
3038
|
-
return new e({
|
|
3039
|
-
type: "string",
|
|
3040
|
-
format: "ipv6",
|
|
3041
|
-
check: "string_format",
|
|
3042
|
-
abort: !1,
|
|
3043
|
-
...g(t)
|
|
3044
|
-
});
|
|
3045
|
-
}
|
|
3046
|
-
// @__NO_SIDE_EFFECTS__
|
|
3047
|
-
function ii(e, t) {
|
|
3048
|
-
return new e({
|
|
3049
|
-
type: "string",
|
|
3050
|
-
format: "cidrv4",
|
|
3051
|
-
check: "string_format",
|
|
3052
|
-
abort: !1,
|
|
3053
|
-
...g(t)
|
|
3054
|
-
});
|
|
3055
|
-
}
|
|
3056
|
-
// @__NO_SIDE_EFFECTS__
|
|
3057
|
-
function si(e, t) {
|
|
3058
|
-
return new e({
|
|
3059
|
-
type: "string",
|
|
3060
|
-
format: "cidrv6",
|
|
3061
|
-
check: "string_format",
|
|
3062
|
-
abort: !1,
|
|
3063
|
-
...g(t)
|
|
3064
|
-
});
|
|
3065
|
-
}
|
|
3066
|
-
// @__NO_SIDE_EFFECTS__
|
|
3067
|
-
function ai(e, t) {
|
|
3068
|
-
return new e({
|
|
3069
|
-
type: "string",
|
|
3070
|
-
format: "base64",
|
|
3071
|
-
check: "string_format",
|
|
3072
|
-
abort: !1,
|
|
3073
|
-
...g(t)
|
|
3074
|
-
});
|
|
3075
|
-
}
|
|
3076
|
-
// @__NO_SIDE_EFFECTS__
|
|
3077
|
-
function ui(e, t) {
|
|
3078
|
-
return new e({
|
|
3079
|
-
type: "string",
|
|
3080
|
-
format: "base64url",
|
|
3081
|
-
check: "string_format",
|
|
3082
|
-
abort: !1,
|
|
3083
|
-
...g(t)
|
|
3084
|
-
});
|
|
3085
|
-
}
|
|
3086
|
-
// @__NO_SIDE_EFFECTS__
|
|
3087
|
-
function ci(e, t) {
|
|
3088
|
-
return new e({
|
|
3089
|
-
type: "string",
|
|
3090
|
-
format: "e164",
|
|
3091
|
-
check: "string_format",
|
|
3092
|
-
abort: !1,
|
|
3093
|
-
...g(t)
|
|
3094
|
-
});
|
|
3095
|
-
}
|
|
3096
|
-
// @__NO_SIDE_EFFECTS__
|
|
3097
|
-
function li(e, t) {
|
|
3098
|
-
return new e({
|
|
3099
|
-
type: "string",
|
|
3100
|
-
format: "jwt",
|
|
3101
|
-
check: "string_format",
|
|
3102
|
-
abort: !1,
|
|
3103
|
-
...g(t)
|
|
3104
|
-
});
|
|
3105
|
-
}
|
|
3106
|
-
// @__NO_SIDE_EFFECTS__
|
|
3107
|
-
function di(e, t) {
|
|
3108
|
-
return new e({
|
|
3109
|
-
type: "string",
|
|
3110
|
-
format: "datetime",
|
|
3111
|
-
check: "string_format",
|
|
3112
|
-
offset: !1,
|
|
3113
|
-
local: !1,
|
|
3114
|
-
precision: null,
|
|
3115
|
-
...g(t)
|
|
3116
|
-
});
|
|
3117
|
-
}
|
|
3118
|
-
// @__NO_SIDE_EFFECTS__
|
|
3119
|
-
function pi(e, t) {
|
|
3120
|
-
return new e({
|
|
3121
|
-
type: "string",
|
|
3122
|
-
format: "date",
|
|
3123
|
-
check: "string_format",
|
|
3124
|
-
...g(t)
|
|
3125
|
-
});
|
|
3126
|
-
}
|
|
3127
|
-
// @__NO_SIDE_EFFECTS__
|
|
3128
|
-
function fi(e, t) {
|
|
3129
|
-
return new e({
|
|
3130
|
-
type: "string",
|
|
3131
|
-
format: "time",
|
|
3132
|
-
check: "string_format",
|
|
3133
|
-
precision: null,
|
|
3134
|
-
...g(t)
|
|
3135
|
-
});
|
|
3136
|
-
}
|
|
3137
|
-
// @__NO_SIDE_EFFECTS__
|
|
3138
|
-
function hi(e, t) {
|
|
3139
|
-
return new e({
|
|
3140
|
-
type: "string",
|
|
3141
|
-
format: "duration",
|
|
3142
|
-
check: "string_format",
|
|
3143
|
-
...g(t)
|
|
3144
|
-
});
|
|
3145
|
-
}
|
|
3146
|
-
// @__NO_SIDE_EFFECTS__
|
|
3147
|
-
function mi(e, t) {
|
|
3148
|
-
return new e({
|
|
3149
|
-
type: "number",
|
|
3150
|
-
checks: [],
|
|
3151
|
-
...g(t)
|
|
3152
|
-
});
|
|
3153
|
-
}
|
|
3154
|
-
// @__NO_SIDE_EFFECTS__
|
|
3155
|
-
function gi(e, t) {
|
|
3156
|
-
return new e({
|
|
3157
|
-
type: "number",
|
|
3158
|
-
check: "number_format",
|
|
3159
|
-
abort: !1,
|
|
3160
|
-
format: "safeint",
|
|
3161
|
-
...g(t)
|
|
3162
|
-
});
|
|
3163
|
-
}
|
|
3164
|
-
// @__NO_SIDE_EFFECTS__
|
|
3165
|
-
function _i(e, t) {
|
|
3166
|
-
return new e({
|
|
3167
|
-
type: "boolean",
|
|
3168
|
-
...g(t)
|
|
3169
|
-
});
|
|
3170
|
-
}
|
|
3171
|
-
// @__NO_SIDE_EFFECTS__
|
|
3172
|
-
function vi(e) {
|
|
3173
|
-
return new e({ type: "unknown" });
|
|
3174
|
-
}
|
|
3175
|
-
// @__NO_SIDE_EFFECTS__
|
|
3176
|
-
function yi(e, t) {
|
|
3177
|
-
return new e({
|
|
3178
|
-
type: "never",
|
|
3179
|
-
...g(t)
|
|
3180
|
-
});
|
|
3181
|
-
}
|
|
3182
|
-
// @__NO_SIDE_EFFECTS__
|
|
3183
|
-
function Je(e, t) {
|
|
3184
|
-
return new gt({
|
|
3185
|
-
check: "less_than",
|
|
3186
|
-
...g(t),
|
|
3187
|
-
value: e,
|
|
3188
|
-
inclusive: !1
|
|
3189
|
-
});
|
|
3190
|
-
}
|
|
3191
|
-
// @__NO_SIDE_EFFECTS__
|
|
3192
|
-
function le(e, t) {
|
|
3193
|
-
return new gt({
|
|
3194
|
-
check: "less_than",
|
|
3195
|
-
...g(t),
|
|
3196
|
-
value: e,
|
|
3197
|
-
inclusive: !0
|
|
3198
|
-
});
|
|
3199
|
-
}
|
|
3200
|
-
// @__NO_SIDE_EFFECTS__
|
|
3201
|
-
function Ve(e, t) {
|
|
3202
|
-
return new _t({
|
|
3203
|
-
check: "greater_than",
|
|
3204
|
-
...g(t),
|
|
3205
|
-
value: e,
|
|
3206
|
-
inclusive: !1
|
|
3207
|
-
});
|
|
3208
|
-
}
|
|
3209
|
-
// @__NO_SIDE_EFFECTS__
|
|
3210
|
-
function de(e, t) {
|
|
3211
|
-
return new _t({
|
|
3212
|
-
check: "greater_than",
|
|
3213
|
-
...g(t),
|
|
3214
|
-
value: e,
|
|
3215
|
-
inclusive: !0
|
|
3216
|
-
});
|
|
3217
|
-
}
|
|
3218
|
-
// @__NO_SIDE_EFFECTS__
|
|
3219
|
-
function qe(e, t) {
|
|
3220
|
-
return new Nn({
|
|
3221
|
-
check: "multiple_of",
|
|
3222
|
-
...g(t),
|
|
3223
|
-
value: e
|
|
3224
|
-
});
|
|
3225
|
-
}
|
|
3226
|
-
// @__NO_SIDE_EFFECTS__
|
|
3227
|
-
function zt(e, t) {
|
|
3228
|
-
return new jn({
|
|
3229
|
-
check: "max_length",
|
|
3230
|
-
...g(t),
|
|
3231
|
-
maximum: e
|
|
3232
|
-
});
|
|
3233
|
-
}
|
|
3234
|
-
// @__NO_SIDE_EFFECTS__
|
|
3235
|
-
function oe(e, t) {
|
|
3236
|
-
return new Cn({
|
|
3237
|
-
check: "min_length",
|
|
3238
|
-
...g(t),
|
|
3239
|
-
minimum: e
|
|
3240
|
-
});
|
|
3241
|
-
}
|
|
3242
|
-
// @__NO_SIDE_EFFECTS__
|
|
3243
|
-
function $t(e, t) {
|
|
3244
|
-
return new xn({
|
|
3245
|
-
check: "length_equals",
|
|
3246
|
-
...g(t),
|
|
3247
|
-
length: e
|
|
3248
|
-
});
|
|
3249
|
-
}
|
|
3250
|
-
// @__NO_SIDE_EFFECTS__
|
|
3251
|
-
function bi(e, t) {
|
|
3252
|
-
return new Dn({
|
|
3253
|
-
check: "string_format",
|
|
3254
|
-
format: "regex",
|
|
3255
|
-
...g(t),
|
|
3256
|
-
pattern: e
|
|
3257
|
-
});
|
|
3258
|
-
}
|
|
3259
|
-
// @__NO_SIDE_EFFECTS__
|
|
3260
|
-
function wi(e) {
|
|
3261
|
-
return new Un({
|
|
3262
|
-
check: "string_format",
|
|
3263
|
-
format: "lowercase",
|
|
3264
|
-
...g(e)
|
|
3265
|
-
});
|
|
3266
|
-
}
|
|
3267
|
-
// @__NO_SIDE_EFFECTS__
|
|
3268
|
-
function ki(e) {
|
|
3269
|
-
return new Ln({
|
|
3270
|
-
check: "string_format",
|
|
3271
|
-
format: "uppercase",
|
|
3272
|
-
...g(e)
|
|
3273
|
-
});
|
|
3274
|
-
}
|
|
3275
|
-
// @__NO_SIDE_EFFECTS__
|
|
3276
|
-
function zi(e, t) {
|
|
3277
|
-
return new Fn({
|
|
3278
|
-
check: "string_format",
|
|
3279
|
-
format: "includes",
|
|
3280
|
-
...g(t),
|
|
3281
|
-
includes: e
|
|
3282
|
-
});
|
|
3283
|
-
}
|
|
3284
|
-
// @__NO_SIDE_EFFECTS__
|
|
3285
|
-
function $i(e, t) {
|
|
3286
|
-
return new Mn({
|
|
3287
|
-
check: "string_format",
|
|
3288
|
-
format: "starts_with",
|
|
3289
|
-
...g(t),
|
|
3290
|
-
prefix: e
|
|
3291
|
-
});
|
|
3292
|
-
}
|
|
3293
|
-
// @__NO_SIDE_EFFECTS__
|
|
3294
|
-
function Si(e, t) {
|
|
3295
|
-
return new Jn({
|
|
3296
|
-
check: "string_format",
|
|
3297
|
-
format: "ends_with",
|
|
3298
|
-
...g(t),
|
|
3299
|
-
suffix: e
|
|
3300
|
-
});
|
|
3301
|
-
}
|
|
3302
|
-
// @__NO_SIDE_EFFECTS__
|
|
3303
|
-
function G(e) {
|
|
3304
|
-
return new Vn({
|
|
3305
|
-
check: "overwrite",
|
|
3306
|
-
tx: e
|
|
3307
|
-
});
|
|
3308
|
-
}
|
|
3309
|
-
// @__NO_SIDE_EFFECTS__
|
|
3310
|
-
function Zi(e) {
|
|
3311
|
-
return /* @__PURE__ */ G((t) => t.normalize(e));
|
|
3312
|
-
}
|
|
3313
|
-
// @__NO_SIDE_EFFECTS__
|
|
3314
|
-
function Oi() {
|
|
3315
|
-
return /* @__PURE__ */ G((e) => e.trim());
|
|
3316
|
-
}
|
|
3317
|
-
// @__NO_SIDE_EFFECTS__
|
|
3318
|
-
function Pi() {
|
|
3319
|
-
return /* @__PURE__ */ G((e) => e.toLowerCase());
|
|
3320
|
-
}
|
|
3321
|
-
// @__NO_SIDE_EFFECTS__
|
|
3322
|
-
function Ei() {
|
|
3323
|
-
return /* @__PURE__ */ G((e) => e.toUpperCase());
|
|
3324
|
-
}
|
|
3325
|
-
// @__NO_SIDE_EFFECTS__
|
|
3326
|
-
function Ii() {
|
|
3327
|
-
return /* @__PURE__ */ G((e) => jr(e));
|
|
3328
|
-
}
|
|
3329
|
-
// @__NO_SIDE_EFFECTS__
|
|
3330
|
-
function Ti(e, t, r) {
|
|
3331
|
-
return new e({
|
|
3332
|
-
type: "array",
|
|
3333
|
-
element: t,
|
|
3334
|
-
...g(r)
|
|
3335
|
-
});
|
|
3336
|
-
}
|
|
3337
|
-
// @__NO_SIDE_EFFECTS__
|
|
3338
|
-
function Ai(e, t, r) {
|
|
3339
|
-
return new e({
|
|
3340
|
-
type: "custom",
|
|
3341
|
-
check: "custom",
|
|
3342
|
-
fn: t,
|
|
3343
|
-
...g(r)
|
|
3344
|
-
});
|
|
3345
|
-
}
|
|
3346
|
-
// @__NO_SIDE_EFFECTS__
|
|
3347
|
-
function Ni(e, t) {
|
|
3348
|
-
const r = /* @__PURE__ */ Ri((n) => (n.addIssue = (o) => {
|
|
3349
|
-
if (typeof o == "string") n.issues.push(H(o, n.value, r._zod.def));
|
|
3350
|
-
else {
|
|
3351
|
-
const i = o;
|
|
3352
|
-
i.fatal && (i.continue = !1), i.code ?? (i.code = "custom"), i.input ?? (i.input = n.value), i.inst ?? (i.inst = r), i.continue ?? (i.continue = !r._zod.def.abort), n.issues.push(H(i));
|
|
3353
|
-
}
|
|
3354
|
-
}, e(n.value, n)), t);
|
|
3355
|
-
return r;
|
|
3356
|
-
}
|
|
3357
|
-
// @__NO_SIDE_EFFECTS__
|
|
3358
|
-
function Ri(e, t) {
|
|
3359
|
-
const r = new I({
|
|
3360
|
-
check: "custom",
|
|
3361
|
-
...g(t)
|
|
3362
|
-
});
|
|
3363
|
-
return r._zod.check = e, r;
|
|
3364
|
-
}
|
|
3365
|
-
function St(e) {
|
|
3366
|
-
let t = e?.target ?? "draft-2020-12";
|
|
3367
|
-
return t === "draft-4" && (t = "draft-04"), t === "draft-7" && (t = "draft-07"), {
|
|
3368
|
-
processors: e.processors ?? {},
|
|
3369
|
-
metadataRegistry: e?.metadata ?? B,
|
|
3370
|
-
target: t,
|
|
3371
|
-
unrepresentable: e?.unrepresentable ?? "throw",
|
|
3372
|
-
override: e?.override ?? (() => {
|
|
3373
|
-
}),
|
|
3374
|
-
io: e?.io ?? "output",
|
|
3375
|
-
counter: 0,
|
|
3376
|
-
seen: /* @__PURE__ */ new Map(),
|
|
3377
|
-
cycles: e?.cycles ?? "ref",
|
|
3378
|
-
reused: e?.reused ?? "inline",
|
|
3379
|
-
external: e?.external ?? void 0
|
|
3380
|
-
};
|
|
3381
|
-
}
|
|
3382
|
-
function Z(e, t, r = {
|
|
3383
|
-
path: [],
|
|
3384
|
-
schemaPath: []
|
|
3385
|
-
}) {
|
|
3386
|
-
var n;
|
|
3387
|
-
const o = e._zod.def, i = t.seen.get(e);
|
|
3388
|
-
if (i)
|
|
3389
|
-
return i.count++, r.schemaPath.includes(e) && (i.cycle = r.path), i.schema;
|
|
3390
|
-
const s = {
|
|
3391
|
-
schema: {},
|
|
3392
|
-
count: 1,
|
|
3393
|
-
cycle: void 0,
|
|
3394
|
-
path: r.path
|
|
3395
|
-
};
|
|
3396
|
-
t.seen.set(e, s);
|
|
3397
|
-
const a = e._zod.toJSONSchema?.();
|
|
3398
|
-
if (a) s.schema = a;
|
|
3399
|
-
else {
|
|
3400
|
-
const c = {
|
|
3401
|
-
...r,
|
|
3402
|
-
schemaPath: [...r.schemaPath, e],
|
|
3403
|
-
path: r.path
|
|
3404
|
-
};
|
|
3405
|
-
if (e._zod.processJSONSchema) e._zod.processJSONSchema(t, s.schema, c);
|
|
3406
|
-
else {
|
|
3407
|
-
const h = s.schema, f = t.processors[o.type];
|
|
3408
|
-
if (!f) throw new Error(`[toJSONSchema]: Non-representable type encountered: ${o.type}`);
|
|
3409
|
-
f(e, t, h, c);
|
|
3410
|
-
}
|
|
3411
|
-
const d = e._zod.parent;
|
|
3412
|
-
d && (s.ref || (s.ref = d), Z(d, t, c), t.seen.get(d).isParent = !0);
|
|
3413
|
-
}
|
|
3414
|
-
const u = t.metadataRegistry.get(e);
|
|
3415
|
-
return u && Object.assign(s.schema, u), t.io === "input" && E(e) && (delete s.schema.examples, delete s.schema.default), t.io === "input" && "_prefault" in s.schema && ((n = s.schema).default ?? (n.default = s.schema._prefault)), delete s.schema._prefault, t.seen.get(e).schema;
|
|
3416
|
-
}
|
|
3417
|
-
function Zt(e, t) {
|
|
3418
|
-
const r = e.seen.get(t);
|
|
3419
|
-
if (!r) throw new Error("Unprocessed schema. This is a bug in Zod.");
|
|
3420
|
-
const n = /* @__PURE__ */ new Map();
|
|
3421
|
-
for (const s of e.seen.entries()) {
|
|
3422
|
-
const a = e.metadataRegistry.get(s[0])?.id;
|
|
3423
|
-
if (a) {
|
|
3424
|
-
const u = n.get(a);
|
|
3425
|
-
if (u && u !== s[0]) throw new Error(`Duplicate schema id "${a}" detected during JSON Schema conversion. Two different schemas cannot share the same id when converted together.`);
|
|
3426
|
-
n.set(a, s[0]);
|
|
3427
|
-
}
|
|
3428
|
-
}
|
|
3429
|
-
const o = (s) => {
|
|
3430
|
-
const a = e.target === "draft-2020-12" ? "$defs" : "definitions";
|
|
3431
|
-
if (e.external) {
|
|
3432
|
-
const d = e.external.registry.get(s[0])?.id, h = e.external.uri ?? ((p) => p);
|
|
3433
|
-
if (d) return { ref: h(d) };
|
|
3434
|
-
const f = s[1].defId ?? s[1].schema.id ?? `schema${e.counter++}`;
|
|
3435
|
-
return s[1].defId = f, {
|
|
3436
|
-
defId: f,
|
|
3437
|
-
ref: `${h("__shared")}#/${a}/${f}`
|
|
3438
|
-
};
|
|
3439
|
-
}
|
|
3440
|
-
if (s[1] === r) return { ref: "#" };
|
|
3441
|
-
const u = `#/${a}/`, c = s[1].schema.id ?? `__schema${e.counter++}`;
|
|
3442
|
-
return {
|
|
3443
|
-
defId: c,
|
|
3444
|
-
ref: u + c
|
|
3445
|
-
};
|
|
3446
|
-
}, i = (s) => {
|
|
3447
|
-
if (s[1].schema.$ref) return;
|
|
3448
|
-
const a = s[1], { ref: u, defId: c } = o(s);
|
|
3449
|
-
a.def = { ...a.schema }, c && (a.defId = c);
|
|
3450
|
-
const d = a.schema;
|
|
3451
|
-
for (const h in d) delete d[h];
|
|
3452
|
-
d.$ref = u;
|
|
3453
|
-
};
|
|
3454
|
-
if (e.cycles === "throw") for (const s of e.seen.entries()) {
|
|
3455
|
-
const a = s[1];
|
|
3456
|
-
if (a.cycle) throw new Error(`Cycle detected: #/${a.cycle?.join("/")}/<root>
|
|
3457
|
-
|
|
3458
|
-
Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.`);
|
|
3459
|
-
}
|
|
3460
|
-
for (const s of e.seen.entries()) {
|
|
3461
|
-
const a = s[1];
|
|
3462
|
-
if (t === s[0]) {
|
|
3463
|
-
i(s);
|
|
3464
|
-
continue;
|
|
3465
|
-
}
|
|
3466
|
-
if (e.external) {
|
|
3467
|
-
const u = e.external.registry.get(s[0])?.id;
|
|
3468
|
-
if (t !== s[0] && u) {
|
|
3469
|
-
i(s);
|
|
3470
|
-
continue;
|
|
3471
|
-
}
|
|
3472
|
-
}
|
|
3473
|
-
if (e.metadataRegistry.get(s[0])?.id) {
|
|
3474
|
-
i(s);
|
|
3475
|
-
continue;
|
|
3476
|
-
}
|
|
3477
|
-
if (a.cycle) {
|
|
3478
|
-
i(s);
|
|
3479
|
-
continue;
|
|
3480
|
-
}
|
|
3481
|
-
if (a.count > 1 && e.reused === "ref") {
|
|
3482
|
-
i(s);
|
|
3483
|
-
continue;
|
|
3484
|
-
}
|
|
3485
|
-
}
|
|
3486
|
-
}
|
|
3487
|
-
function Ot(e, t) {
|
|
3488
|
-
const r = e.seen.get(t);
|
|
3489
|
-
if (!r) throw new Error("Unprocessed schema. This is a bug in Zod.");
|
|
3490
|
-
const n = (a) => {
|
|
3491
|
-
const u = e.seen.get(a);
|
|
3492
|
-
if (u.ref === null) return;
|
|
3493
|
-
const c = u.def ?? u.schema, d = { ...c }, h = u.ref;
|
|
3494
|
-
if (u.ref = null, h) {
|
|
3495
|
-
n(h);
|
|
3496
|
-
const p = e.seen.get(h), m = p.schema;
|
|
3497
|
-
if (m.$ref && (e.target === "draft-07" || e.target === "draft-04" || e.target === "openapi-3.0") ? (c.allOf = c.allOf ?? [], c.allOf.push(m)) : Object.assign(c, m), Object.assign(c, d), a._zod.parent === h) for (const _ in c)
|
|
3498
|
-
_ === "$ref" || _ === "allOf" || _ in d || delete c[_];
|
|
3499
|
-
if (m.$ref && p.def) for (const _ in c)
|
|
3500
|
-
_ === "$ref" || _ === "allOf" || _ in p.def && JSON.stringify(c[_]) === JSON.stringify(p.def[_]) && delete c[_];
|
|
3501
|
-
}
|
|
3502
|
-
const f = a._zod.parent;
|
|
3503
|
-
if (f && f !== h) {
|
|
3504
|
-
n(f);
|
|
3505
|
-
const p = e.seen.get(f);
|
|
3506
|
-
if (p?.schema.$ref && (c.$ref = p.schema.$ref, p.def))
|
|
3507
|
-
for (const m in c)
|
|
3508
|
-
m === "$ref" || m === "allOf" || m in p.def && JSON.stringify(c[m]) === JSON.stringify(p.def[m]) && delete c[m];
|
|
3509
|
-
}
|
|
3510
|
-
e.override({
|
|
3511
|
-
zodSchema: a,
|
|
3512
|
-
jsonSchema: c,
|
|
3513
|
-
path: u.path ?? []
|
|
3514
|
-
});
|
|
3515
|
-
};
|
|
3516
|
-
for (const a of [...e.seen.entries()].reverse()) n(a[0]);
|
|
3517
|
-
const o = {};
|
|
3518
|
-
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) {
|
|
3519
|
-
const a = e.external.registry.get(t)?.id;
|
|
3520
|
-
if (!a) throw new Error("Schema is missing an `id` property");
|
|
3521
|
-
o.$id = e.external.uri(a);
|
|
3522
|
-
}
|
|
3523
|
-
Object.assign(o, r.def ?? r.schema);
|
|
3524
|
-
const i = e.metadataRegistry.get(t)?.id;
|
|
3525
|
-
i !== void 0 && o.id === i && delete o.id;
|
|
3526
|
-
const s = e.external?.defs ?? {};
|
|
3527
|
-
for (const a of e.seen.entries()) {
|
|
3528
|
-
const u = a[1];
|
|
3529
|
-
u.def && u.defId && (u.def.id === u.defId && delete u.def.id, s[u.defId] = u.def);
|
|
3530
|
-
}
|
|
3531
|
-
e.external || Object.keys(s).length > 0 && (e.target === "draft-2020-12" ? o.$defs = s : o.definitions = s);
|
|
3532
|
-
try {
|
|
3533
|
-
const a = JSON.parse(JSON.stringify(o));
|
|
3534
|
-
return Object.defineProperty(a, "~standard", {
|
|
3535
|
-
value: {
|
|
3536
|
-
...t["~standard"],
|
|
3537
|
-
jsonSchema: {
|
|
3538
|
-
input: ie(t, "input", e.processors),
|
|
3539
|
-
output: ie(t, "output", e.processors)
|
|
3540
|
-
}
|
|
3541
|
-
},
|
|
3542
|
-
enumerable: !1,
|
|
3543
|
-
writable: !1
|
|
3544
|
-
}), a;
|
|
3545
|
-
} catch {
|
|
3546
|
-
throw new Error("Error converting schema to JSON.");
|
|
3547
|
-
}
|
|
3548
|
-
}
|
|
3549
|
-
function E(e, t) {
|
|
3550
|
-
const r = t ?? { seen: /* @__PURE__ */ new Set() };
|
|
3551
|
-
if (r.seen.has(e)) return !1;
|
|
3552
|
-
r.seen.add(e);
|
|
3553
|
-
const n = e._zod.def;
|
|
3554
|
-
if (n.type === "transform") return !0;
|
|
3555
|
-
if (n.type === "array") return E(n.element, r);
|
|
3556
|
-
if (n.type === "set") return E(n.valueType, r);
|
|
3557
|
-
if (n.type === "lazy") return E(n.getter(), r);
|
|
3558
|
-
if (n.type === "promise" || n.type === "optional" || n.type === "nonoptional" || n.type === "nullable" || n.type === "readonly" || n.type === "default" || n.type === "prefault") return E(n.innerType, r);
|
|
3559
|
-
if (n.type === "intersection") return E(n.left, r) || E(n.right, r);
|
|
3560
|
-
if (n.type === "record" || n.type === "map") return E(n.keyType, r) || E(n.valueType, r);
|
|
3561
|
-
if (n.type === "pipe")
|
|
3562
|
-
return e._zod.traits.has("$ZodCodec") ? !0 : E(n.in, r) || E(n.out, r);
|
|
3563
|
-
if (n.type === "object") {
|
|
3564
|
-
for (const o in n.shape) if (E(n.shape[o], r)) return !0;
|
|
3565
|
-
return !1;
|
|
3566
|
-
}
|
|
3567
|
-
if (n.type === "union") {
|
|
3568
|
-
for (const o of n.options) if (E(o, r)) return !0;
|
|
3569
|
-
return !1;
|
|
3570
|
-
}
|
|
3571
|
-
if (n.type === "tuple") {
|
|
3572
|
-
for (const o of n.items) if (E(o, r)) return !0;
|
|
3573
|
-
return !!(n.rest && E(n.rest, r));
|
|
3574
|
-
}
|
|
3575
|
-
return !1;
|
|
3576
|
-
}
|
|
3577
|
-
var ji = (e, t = {}) => (r) => {
|
|
3578
|
-
const n = St({
|
|
3579
|
-
...r,
|
|
3580
|
-
processors: t
|
|
3581
|
-
});
|
|
3582
|
-
return Z(e, n), Zt(n, e), Ot(n, e);
|
|
3583
|
-
}, ie = (e, t, r = {}) => (n) => {
|
|
3584
|
-
const { libraryOptions: o, target: i } = n ?? {}, s = St({
|
|
3585
|
-
...o ?? {},
|
|
3586
|
-
target: i,
|
|
3587
|
-
io: t,
|
|
3588
|
-
processors: r
|
|
3589
|
-
});
|
|
3590
|
-
return Z(e, s), Zt(s, e), Ot(s, e);
|
|
3591
|
-
}, Ci = {
|
|
3592
|
-
guid: "uuid",
|
|
3593
|
-
url: "uri",
|
|
3594
|
-
datetime: "date-time",
|
|
3595
|
-
json_string: "json-string",
|
|
3596
|
-
regex: ""
|
|
3597
|
-
}, xi = (e, t, r, n) => {
|
|
3598
|
-
const o = r;
|
|
3599
|
-
o.type = "string";
|
|
3600
|
-
const { minimum: i, maximum: s, format: a, patterns: u, contentEncoding: c } = e._zod.bag;
|
|
3601
|
-
if (typeof i == "number" && (o.minLength = i), typeof s == "number" && (o.maxLength = s), a && (o.format = Ci[a] ?? a, o.format === "" && delete o.format, a === "time" && delete o.format), c && (o.contentEncoding = c), u && u.size > 0) {
|
|
3602
|
-
const d = [...u];
|
|
3603
|
-
d.length === 1 ? o.pattern = d[0].source : d.length > 1 && (o.allOf = [...d.map((h) => ({
|
|
3604
|
-
...t.target === "draft-07" || t.target === "draft-04" || t.target === "openapi-3.0" ? { type: "string" } : {},
|
|
3605
|
-
pattern: h.source
|
|
3606
|
-
}))]);
|
|
3607
|
-
}
|
|
3608
|
-
}, Di = (e, t, r, n) => {
|
|
3609
|
-
const o = r, { minimum: i, maximum: s, format: a, multipleOf: u, exclusiveMaximum: c, exclusiveMinimum: d } = e._zod.bag;
|
|
3610
|
-
typeof a == "string" && a.includes("int") ? o.type = "integer" : o.type = "number";
|
|
3611
|
-
const h = typeof d == "number" && d >= (i ?? Number.NEGATIVE_INFINITY), f = typeof c == "number" && c <= (s ?? Number.POSITIVE_INFINITY), p = t.target === "draft-04" || t.target === "openapi-3.0";
|
|
3612
|
-
h ? p ? (o.minimum = d, o.exclusiveMinimum = !0) : o.exclusiveMinimum = d : typeof i == "number" && (o.minimum = i), f ? p ? (o.maximum = c, o.exclusiveMaximum = !0) : o.exclusiveMaximum = c : typeof s == "number" && (o.maximum = s), typeof u == "number" && (o.multipleOf = u);
|
|
3613
|
-
}, Ui = (e, t, r, n) => {
|
|
3614
|
-
r.type = "boolean";
|
|
3615
|
-
}, Li = (e, t, r, n) => {
|
|
3616
|
-
r.not = {};
|
|
3617
|
-
}, Fi = (e, t, r, n) => {
|
|
3618
|
-
}, Mi = (e, t, r, n) => {
|
|
3619
|
-
const o = e._zod.def, i = it(o.entries);
|
|
3620
|
-
i.every((s) => typeof s == "number") && (r.type = "number"), i.every((s) => typeof s == "string") && (r.type = "string"), r.enum = i;
|
|
3621
|
-
}, Ji = (e, t, r, n) => {
|
|
3622
|
-
const o = e._zod.def, i = [];
|
|
3623
|
-
for (const s of o.values) if (s === void 0) {
|
|
3624
|
-
if (t.unrepresentable === "throw") throw new Error("Literal `undefined` cannot be represented in JSON Schema");
|
|
3625
|
-
} else if (typeof s == "bigint") {
|
|
3626
|
-
if (t.unrepresentable === "throw") throw new Error("BigInt literals cannot be represented in JSON Schema");
|
|
3627
|
-
i.push(Number(s));
|
|
3628
|
-
} else i.push(s);
|
|
3629
|
-
if (i.length !== 0)
|
|
3630
|
-
if (i.length === 1) {
|
|
3631
|
-
const s = i[0];
|
|
3632
|
-
r.type = s === null ? "null" : typeof s, t.target === "draft-04" || t.target === "openapi-3.0" ? r.enum = [s] : r.const = s;
|
|
3633
|
-
} else
|
|
3634
|
-
i.every((s) => typeof s == "number") && (r.type = "number"), i.every((s) => typeof s == "string") && (r.type = "string"), i.every((s) => typeof s == "boolean") && (r.type = "boolean"), i.every((s) => s === null) && (r.type = "null"), r.enum = i;
|
|
3635
|
-
}, Vi = (e, t, r, n) => {
|
|
3636
|
-
if (t.unrepresentable === "throw") throw new Error("Custom types cannot be represented in JSON Schema");
|
|
3637
|
-
}, qi = (e, t, r, n) => {
|
|
3638
|
-
if (t.unrepresentable === "throw") throw new Error("Transforms cannot be represented in JSON Schema");
|
|
3639
|
-
}, Gi = (e, t, r, n) => {
|
|
3640
|
-
const o = r, i = e._zod.def, { minimum: s, maximum: a } = e._zod.bag;
|
|
3641
|
-
typeof s == "number" && (o.minItems = s), typeof a == "number" && (o.maxItems = a), o.type = "array", o.items = Z(i.element, t, {
|
|
3642
|
-
...n,
|
|
3643
|
-
path: [...n.path, "items"]
|
|
3644
|
-
});
|
|
3645
|
-
}, Wi = (e, t, r, n) => {
|
|
3646
|
-
const o = r, i = e._zod.def;
|
|
3647
|
-
o.type = "object", o.properties = {};
|
|
3648
|
-
const s = i.shape;
|
|
3649
|
-
for (const c in s) o.properties[c] = Z(s[c], t, {
|
|
3650
|
-
...n,
|
|
3651
|
-
path: [
|
|
3652
|
-
...n.path,
|
|
3653
|
-
"properties",
|
|
3654
|
-
c
|
|
3655
|
-
]
|
|
3656
|
-
});
|
|
3657
|
-
const a = new Set(Object.keys(s)), u = new Set([...a].filter((c) => {
|
|
3658
|
-
const d = i.shape[c]._zod;
|
|
3659
|
-
return t.io === "input" ? d.optin === void 0 : d.optout === void 0;
|
|
3660
|
-
}));
|
|
3661
|
-
u.size > 0 && (o.required = Array.from(u)), i.catchall?._zod.def.type === "never" ? o.additionalProperties = !1 : i.catchall ? i.catchall && (o.additionalProperties = Z(i.catchall, t, {
|
|
3662
|
-
...n,
|
|
3663
|
-
path: [...n.path, "additionalProperties"]
|
|
3664
|
-
})) : t.io === "output" && (o.additionalProperties = !1);
|
|
3665
|
-
}, Bi = (e, t, r, n) => {
|
|
3666
|
-
const o = e._zod.def, i = o.inclusive === !1, s = o.options.map((a, u) => Z(a, t, {
|
|
3667
|
-
...n,
|
|
3668
|
-
path: [
|
|
3669
|
-
...n.path,
|
|
3670
|
-
i ? "oneOf" : "anyOf",
|
|
3671
|
-
u
|
|
3672
|
-
]
|
|
3673
|
-
}));
|
|
3674
|
-
i ? r.oneOf = s : r.anyOf = s;
|
|
3675
|
-
}, Ki = (e, t, r, n) => {
|
|
3676
|
-
const o = e._zod.def, i = Z(o.left, t, {
|
|
3677
|
-
...n,
|
|
3678
|
-
path: [
|
|
3679
|
-
...n.path,
|
|
3680
|
-
"allOf",
|
|
3681
|
-
0
|
|
3682
|
-
]
|
|
3683
|
-
}), s = Z(o.right, t, {
|
|
3684
|
-
...n,
|
|
3685
|
-
path: [
|
|
3686
|
-
...n.path,
|
|
3687
|
-
"allOf",
|
|
3688
|
-
1
|
|
3689
|
-
]
|
|
3690
|
-
}), a = (u) => "allOf" in u && Object.keys(u).length === 1;
|
|
3691
|
-
r.allOf = [...a(i) ? i.allOf : [i], ...a(s) ? s.allOf : [s]];
|
|
3692
|
-
}, Hi = (e, t, r, n) => {
|
|
3693
|
-
const o = r, i = e._zod.def;
|
|
3694
|
-
o.type = "object";
|
|
3695
|
-
const s = i.keyType, a = s._zod.bag?.patterns;
|
|
3696
|
-
if (i.mode === "loose" && a && a.size > 0) {
|
|
3697
|
-
const c = Z(i.valueType, t, {
|
|
3698
|
-
...n,
|
|
3699
|
-
path: [
|
|
3700
|
-
...n.path,
|
|
3701
|
-
"patternProperties",
|
|
3702
|
-
"*"
|
|
3703
|
-
]
|
|
3704
|
-
});
|
|
3705
|
-
o.patternProperties = {};
|
|
3706
|
-
for (const d of a) o.patternProperties[d.source] = c;
|
|
3707
|
-
} else
|
|
3708
|
-
(t.target === "draft-07" || t.target === "draft-2020-12") && (o.propertyNames = Z(i.keyType, t, {
|
|
3709
|
-
...n,
|
|
3710
|
-
path: [...n.path, "propertyNames"]
|
|
3711
|
-
})), o.additionalProperties = Z(i.valueType, t, {
|
|
3712
|
-
...n,
|
|
3713
|
-
path: [...n.path, "additionalProperties"]
|
|
3714
|
-
});
|
|
3715
|
-
const u = s._zod.values;
|
|
3716
|
-
if (u) {
|
|
3717
|
-
const c = [...u].filter((d) => typeof d == "string" || typeof d == "number");
|
|
3718
|
-
c.length > 0 && (o.required = c);
|
|
3719
|
-
}
|
|
3720
|
-
}, Yi = (e, t, r, n) => {
|
|
3721
|
-
const o = e._zod.def, i = Z(o.innerType, t, n), s = t.seen.get(e);
|
|
3722
|
-
t.target === "openapi-3.0" ? (s.ref = o.innerType, r.nullable = !0) : r.anyOf = [i, { type: "null" }];
|
|
3723
|
-
}, Xi = (e, t, r, n) => {
|
|
3724
|
-
const o = e._zod.def;
|
|
3725
|
-
Z(o.innerType, t, n);
|
|
3726
|
-
const i = t.seen.get(e);
|
|
3727
|
-
i.ref = o.innerType;
|
|
3728
|
-
}, Qi = (e, t, r, n) => {
|
|
3729
|
-
const o = e._zod.def;
|
|
3730
|
-
Z(o.innerType, t, n);
|
|
3731
|
-
const i = t.seen.get(e);
|
|
3732
|
-
i.ref = o.innerType, r.default = JSON.parse(JSON.stringify(o.defaultValue));
|
|
3733
|
-
}, es = (e, t, r, n) => {
|
|
3734
|
-
const o = e._zod.def;
|
|
3735
|
-
Z(o.innerType, t, n);
|
|
3736
|
-
const i = t.seen.get(e);
|
|
3737
|
-
i.ref = o.innerType, t.io === "input" && (r._prefault = JSON.parse(JSON.stringify(o.defaultValue)));
|
|
3738
|
-
}, ts = (e, t, r, n) => {
|
|
3739
|
-
const o = e._zod.def;
|
|
3740
|
-
Z(o.innerType, t, n);
|
|
3741
|
-
const i = t.seen.get(e);
|
|
3742
|
-
i.ref = o.innerType;
|
|
3743
|
-
let s;
|
|
3744
|
-
try {
|
|
3745
|
-
s = o.catchValue(void 0);
|
|
3746
|
-
} catch {
|
|
3747
|
-
throw new Error("Dynamic catch values are not supported in JSON Schema");
|
|
3748
|
-
}
|
|
3749
|
-
r.default = s;
|
|
3750
|
-
}, rs = (e, t, r, n) => {
|
|
3751
|
-
const o = e._zod.def, i = o.in._zod.traits.has("$ZodTransform"), s = t.io === "input" ? i ? o.out : o.in : o.out;
|
|
3752
|
-
Z(s, t, n);
|
|
3753
|
-
const a = t.seen.get(e);
|
|
3754
|
-
a.ref = s;
|
|
3755
|
-
}, ns = (e, t, r, n) => {
|
|
3756
|
-
const o = e._zod.def;
|
|
3757
|
-
Z(o.innerType, t, n);
|
|
3758
|
-
const i = t.seen.get(e);
|
|
3759
|
-
i.ref = o.innerType, r.readOnly = !0;
|
|
3760
|
-
}, Pt = (e, t, r, n) => {
|
|
3761
|
-
const o = e._zod.def;
|
|
3762
|
-
Z(o.innerType, t, n);
|
|
3763
|
-
const i = t.seen.get(e);
|
|
3764
|
-
i.ref = o.innerType;
|
|
3765
|
-
}, os = /* @__PURE__ */ l("ZodISODateTime", (e, t) => {
|
|
3766
|
-
oo.init(e, t), $.init(e, t);
|
|
3767
|
-
});
|
|
3768
|
-
function is(e) {
|
|
3769
|
-
return /* @__PURE__ */ di(os, e);
|
|
3770
|
-
}
|
|
3771
|
-
var ss = /* @__PURE__ */ l("ZodISODate", (e, t) => {
|
|
3772
|
-
io.init(e, t), $.init(e, t);
|
|
3773
|
-
});
|
|
3774
|
-
function as(e) {
|
|
3775
|
-
return /* @__PURE__ */ pi(ss, e);
|
|
3776
|
-
}
|
|
3777
|
-
var us = /* @__PURE__ */ l("ZodISOTime", (e, t) => {
|
|
3778
|
-
so.init(e, t), $.init(e, t);
|
|
3779
|
-
});
|
|
3780
|
-
function cs(e) {
|
|
3781
|
-
return /* @__PURE__ */ fi(us, e);
|
|
3782
|
-
}
|
|
3783
|
-
var ls = /* @__PURE__ */ l("ZodISODuration", (e, t) => {
|
|
3784
|
-
ao.init(e, t), $.init(e, t);
|
|
3785
|
-
});
|
|
3786
|
-
function ds(e) {
|
|
3787
|
-
return /* @__PURE__ */ hi(ls, e);
|
|
3788
|
-
}
|
|
3789
|
-
var ps = (e, t) => {
|
|
3790
|
-
ct.init(e, t), e.name = "ZodError", Object.defineProperties(e, {
|
|
3791
|
-
format: { value: (r) => Kr(e, r) },
|
|
3792
|
-
flatten: { value: (r) => Br(e, r) },
|
|
3793
|
-
addIssue: { value: (r) => {
|
|
3794
|
-
e.issues.push(r), e.message = JSON.stringify(e.issues, pe, 2);
|
|
3795
|
-
} },
|
|
3796
|
-
addIssues: { value: (r) => {
|
|
3797
|
-
e.issues.push(...r), e.message = JSON.stringify(e.issues, pe, 2);
|
|
3798
|
-
} },
|
|
3799
|
-
isEmpty: { get() {
|
|
3800
|
-
return e.issues.length === 0;
|
|
3801
|
-
} }
|
|
3802
|
-
});
|
|
3803
|
-
}, A = /* @__PURE__ */ l("ZodError", ps, { Parent: Error }), fs = /* @__PURE__ */ we(A), hs = /* @__PURE__ */ ke(A), ms = /* @__PURE__ */ se(A), gs = /* @__PURE__ */ ae(A), _s = /* @__PURE__ */ Xr(A), vs = /* @__PURE__ */ Qr(A), ys = /* @__PURE__ */ en(A), bs = /* @__PURE__ */ tn(A), ws = /* @__PURE__ */ rn(A), ks = /* @__PURE__ */ nn(A), zs = /* @__PURE__ */ on(A), $s = /* @__PURE__ */ sn(A), Ge = /* @__PURE__ */ new WeakMap();
|
|
3804
|
-
function Y(e, t, r) {
|
|
3805
|
-
const n = Object.getPrototypeOf(e);
|
|
3806
|
-
let o = Ge.get(n);
|
|
3807
|
-
if (o || (o = /* @__PURE__ */ new Set(), Ge.set(n, o)), !o.has(t)) {
|
|
3808
|
-
o.add(t);
|
|
3809
|
-
for (const i in r) {
|
|
3810
|
-
const s = r[i];
|
|
3811
|
-
Object.defineProperty(n, i, {
|
|
3812
|
-
configurable: !0,
|
|
3813
|
-
enumerable: !1,
|
|
3814
|
-
get() {
|
|
3815
|
-
const a = s.bind(this);
|
|
3816
|
-
return Object.defineProperty(this, i, {
|
|
3817
|
-
configurable: !0,
|
|
3818
|
-
writable: !0,
|
|
3819
|
-
enumerable: !0,
|
|
3820
|
-
value: a
|
|
3821
|
-
}), a;
|
|
3822
|
-
},
|
|
3823
|
-
set(a) {
|
|
3824
|
-
Object.defineProperty(this, i, {
|
|
3825
|
-
configurable: !0,
|
|
3826
|
-
writable: !0,
|
|
3827
|
-
enumerable: !0,
|
|
3828
|
-
value: a
|
|
3829
|
-
});
|
|
3830
|
-
}
|
|
3831
|
-
});
|
|
3832
|
-
}
|
|
3833
|
-
}
|
|
3834
|
-
}
|
|
3835
|
-
var z = /* @__PURE__ */ l("ZodType", (e, t) => (k.init(e, t), Object.assign(e["~standard"], { jsonSchema: {
|
|
3836
|
-
input: ie(e, "input"),
|
|
3837
|
-
output: ie(e, "output")
|
|
3838
|
-
} }), e.toJSONSchema = ji(e, {}), e.def = t, e.type = t.type, Object.defineProperty(e, "_def", { value: t }), e.parse = (r, n) => fs(e, r, n, { callee: e.parse }), e.safeParse = (r, n) => ms(e, r, n), e.parseAsync = async (r, n) => hs(e, r, n, { callee: e.parseAsync }), e.safeParseAsync = async (r, n) => gs(e, r, n), e.spa = e.safeParseAsync, e.encode = (r, n) => _s(e, r, n), e.decode = (r, n) => vs(e, r, n), e.encodeAsync = async (r, n) => ys(e, r, n), e.decodeAsync = async (r, n) => bs(e, r, n), e.safeEncode = (r, n) => ws(e, r, n), e.safeDecode = (r, n) => ks(e, r, n), e.safeEncodeAsync = async (r, n) => zs(e, r, n), e.safeDecodeAsync = async (r, n) => $s(e, r, n), Y(e, "ZodType", {
|
|
3839
|
-
check(...r) {
|
|
3840
|
-
const n = this.def;
|
|
3841
|
-
return this.clone(D(n, { checks: [...n.checks ?? [], ...r.map((o) => typeof o == "function" ? { _zod: {
|
|
3842
|
-
check: o,
|
|
3843
|
-
def: { check: "custom" },
|
|
3844
|
-
onattach: []
|
|
3845
|
-
} } : o)] }), { parent: !0 });
|
|
3846
|
-
},
|
|
3847
|
-
with(...r) {
|
|
3848
|
-
return this.check(...r);
|
|
3849
|
-
},
|
|
3850
|
-
clone(r, n) {
|
|
3851
|
-
return U(this, r, n);
|
|
3852
|
-
},
|
|
3853
|
-
brand() {
|
|
3854
|
-
return this;
|
|
3855
|
-
},
|
|
3856
|
-
register(r, n) {
|
|
3857
|
-
return r.add(this, n), this;
|
|
3858
|
-
},
|
|
3859
|
-
refine(r, n) {
|
|
3860
|
-
return this.check(ba(r, n));
|
|
3861
|
-
},
|
|
3862
|
-
superRefine(r, n) {
|
|
3863
|
-
return this.check(wa(r, n));
|
|
3864
|
-
},
|
|
3865
|
-
overwrite(r) {
|
|
3866
|
-
return this.check(/* @__PURE__ */ G(r));
|
|
3867
|
-
},
|
|
3868
|
-
optional() {
|
|
3869
|
-
return Ye(this);
|
|
3870
|
-
},
|
|
3871
|
-
exactOptional() {
|
|
3872
|
-
return aa(this);
|
|
3873
|
-
},
|
|
3874
|
-
nullable() {
|
|
3875
|
-
return Xe(this);
|
|
3876
|
-
},
|
|
3877
|
-
nullish() {
|
|
3878
|
-
return Ye(Xe(this));
|
|
3879
|
-
},
|
|
3880
|
-
nonoptional(r) {
|
|
3881
|
-
return fa(this, r);
|
|
3882
|
-
},
|
|
3883
|
-
array() {
|
|
3884
|
-
return Hs(this);
|
|
3885
|
-
},
|
|
3886
|
-
or(r) {
|
|
3887
|
-
return Qs([this, r]);
|
|
3888
|
-
},
|
|
3889
|
-
and(r) {
|
|
3890
|
-
return ta(this, r);
|
|
3891
|
-
},
|
|
3892
|
-
transform(r) {
|
|
3893
|
-
return Qe(this, ia(r));
|
|
3894
|
-
},
|
|
3895
|
-
default(r) {
|
|
3896
|
-
return la(this, r);
|
|
3897
|
-
},
|
|
3898
|
-
prefault(r) {
|
|
3899
|
-
return pa(this, r);
|
|
3900
|
-
},
|
|
3901
|
-
catch(r) {
|
|
3902
|
-
return ma(this, r);
|
|
3903
|
-
},
|
|
3904
|
-
pipe(r) {
|
|
3905
|
-
return Qe(this, r);
|
|
3906
|
-
},
|
|
3907
|
-
readonly() {
|
|
3908
|
-
return va(this);
|
|
3909
|
-
},
|
|
3910
|
-
describe(r) {
|
|
3911
|
-
const n = this.clone();
|
|
3912
|
-
return B.add(n, { description: r }), n;
|
|
3913
|
-
},
|
|
3914
|
-
meta(...r) {
|
|
3915
|
-
if (r.length === 0) return B.get(this);
|
|
3916
|
-
const n = this.clone();
|
|
3917
|
-
return B.add(n, r[0]), n;
|
|
3918
|
-
},
|
|
3919
|
-
isOptional() {
|
|
3920
|
-
return this.safeParse(void 0).success;
|
|
3921
|
-
},
|
|
3922
|
-
isNullable() {
|
|
3923
|
-
return this.safeParse(null).success;
|
|
3924
|
-
},
|
|
3925
|
-
apply(r) {
|
|
3926
|
-
return r(this);
|
|
3927
|
-
}
|
|
3928
|
-
}), Object.defineProperty(e, "description", {
|
|
3929
|
-
get() {
|
|
3930
|
-
return B.get(e)?.description;
|
|
3931
|
-
},
|
|
3932
|
-
configurable: !0
|
|
3933
|
-
}), e)), Et = /* @__PURE__ */ l("_ZodString", (e, t) => {
|
|
3934
|
-
ze.init(e, t), z.init(e, t), e._zod.processJSONSchema = (n, o, i) => xi(e, n, o, i);
|
|
3935
|
-
const r = e._zod.bag;
|
|
3936
|
-
e.format = r.format ?? null, e.minLength = r.minimum ?? null, e.maxLength = r.maximum ?? null, Y(e, "_ZodString", {
|
|
3937
|
-
regex(...n) {
|
|
3938
|
-
return this.check(/* @__PURE__ */ bi(...n));
|
|
3939
|
-
},
|
|
3940
|
-
includes(...n) {
|
|
3941
|
-
return this.check(/* @__PURE__ */ zi(...n));
|
|
3942
|
-
},
|
|
3943
|
-
startsWith(...n) {
|
|
3944
|
-
return this.check(/* @__PURE__ */ $i(...n));
|
|
3945
|
-
},
|
|
3946
|
-
endsWith(...n) {
|
|
3947
|
-
return this.check(/* @__PURE__ */ Si(...n));
|
|
3948
|
-
},
|
|
3949
|
-
min(...n) {
|
|
3950
|
-
return this.check(/* @__PURE__ */ oe(...n));
|
|
3951
|
-
},
|
|
3952
|
-
max(...n) {
|
|
3953
|
-
return this.check(/* @__PURE__ */ zt(...n));
|
|
3954
|
-
},
|
|
3955
|
-
length(...n) {
|
|
3956
|
-
return this.check(/* @__PURE__ */ $t(...n));
|
|
3957
|
-
},
|
|
3958
|
-
nonempty(...n) {
|
|
3959
|
-
return this.check(/* @__PURE__ */ oe(1, ...n));
|
|
3960
|
-
},
|
|
3961
|
-
lowercase(n) {
|
|
3962
|
-
return this.check(/* @__PURE__ */ wi(n));
|
|
3963
|
-
},
|
|
3964
|
-
uppercase(n) {
|
|
3965
|
-
return this.check(/* @__PURE__ */ ki(n));
|
|
3966
|
-
},
|
|
3967
|
-
trim() {
|
|
3968
|
-
return this.check(/* @__PURE__ */ Oi());
|
|
3969
|
-
},
|
|
3970
|
-
normalize(...n) {
|
|
3971
|
-
return this.check(/* @__PURE__ */ Zi(...n));
|
|
3972
|
-
},
|
|
3973
|
-
toLowerCase() {
|
|
3974
|
-
return this.check(/* @__PURE__ */ Pi());
|
|
3975
|
-
},
|
|
3976
|
-
toUpperCase() {
|
|
3977
|
-
return this.check(/* @__PURE__ */ Ei());
|
|
3978
|
-
},
|
|
3979
|
-
slugify() {
|
|
3980
|
-
return this.check(/* @__PURE__ */ Ii());
|
|
3981
|
-
}
|
|
3982
|
-
});
|
|
3983
|
-
}), Ss = /* @__PURE__ */ l("ZodString", (e, t) => {
|
|
3984
|
-
ze.init(e, t), Et.init(e, t), e.email = (r) => e.check(/* @__PURE__ */ Vo(Os, r)), e.url = (r) => e.check(/* @__PURE__ */ Ko(Ps, r)), e.jwt = (r) => e.check(/* @__PURE__ */ li(Js, r)), e.emoji = (r) => e.check(/* @__PURE__ */ Ho(Es, r)), e.guid = (r) => e.check(/* @__PURE__ */ Me(We, r)), e.uuid = (r) => e.check(/* @__PURE__ */ qo(ee, r)), e.uuidv4 = (r) => e.check(/* @__PURE__ */ Go(ee, r)), e.uuidv6 = (r) => e.check(/* @__PURE__ */ Wo(ee, r)), e.uuidv7 = (r) => e.check(/* @__PURE__ */ Bo(ee, r)), e.nanoid = (r) => e.check(/* @__PURE__ */ Yo(Is, r)), e.guid = (r) => e.check(/* @__PURE__ */ Me(We, r)), e.cuid = (r) => e.check(/* @__PURE__ */ Xo(Ts, r)), e.cuid2 = (r) => e.check(/* @__PURE__ */ Qo(As, r)), e.ulid = (r) => e.check(/* @__PURE__ */ ei(Ns, r)), e.base64 = (r) => e.check(/* @__PURE__ */ ai(Ls, r)), e.base64url = (r) => e.check(/* @__PURE__ */ ui(Fs, r)), e.xid = (r) => e.check(/* @__PURE__ */ ti(Rs, r)), e.ksuid = (r) => e.check(/* @__PURE__ */ ri(js, r)), e.ipv4 = (r) => e.check(/* @__PURE__ */ ni(Cs, r)), e.ipv6 = (r) => e.check(/* @__PURE__ */ oi(xs, r)), e.cidrv4 = (r) => e.check(/* @__PURE__ */ ii(Ds, r)), e.cidrv6 = (r) => e.check(/* @__PURE__ */ si(Us, r)), e.e164 = (r) => e.check(/* @__PURE__ */ ci(Ms, r)), e.datetime = (r) => e.check(is(r)), e.date = (r) => e.check(as(r)), e.time = (r) => e.check(cs(r)), e.duration = (r) => e.check(ds(r));
|
|
3985
|
-
});
|
|
3986
|
-
function Zs(e) {
|
|
3987
|
-
return /* @__PURE__ */ Jo(Ss, e);
|
|
3988
|
-
}
|
|
3989
|
-
var $ = /* @__PURE__ */ l("ZodStringFormat", (e, t) => {
|
|
3990
|
-
b.init(e, t), Et.init(e, t);
|
|
3991
|
-
}), Os = /* @__PURE__ */ l("ZodEmail", (e, t) => {
|
|
3992
|
-
Kn.init(e, t), $.init(e, t);
|
|
3993
|
-
}), We = /* @__PURE__ */ l("ZodGUID", (e, t) => {
|
|
3994
|
-
Wn.init(e, t), $.init(e, t);
|
|
3995
|
-
}), ee = /* @__PURE__ */ l("ZodUUID", (e, t) => {
|
|
3996
|
-
Bn.init(e, t), $.init(e, t);
|
|
3997
|
-
}), Ps = /* @__PURE__ */ l("ZodURL", (e, t) => {
|
|
3998
|
-
Hn.init(e, t), $.init(e, t);
|
|
3999
|
-
}), Es = /* @__PURE__ */ l("ZodEmoji", (e, t) => {
|
|
4000
|
-
Yn.init(e, t), $.init(e, t);
|
|
4001
|
-
}), Is = /* @__PURE__ */ l("ZodNanoID", (e, t) => {
|
|
4002
|
-
Xn.init(e, t), $.init(e, t);
|
|
4003
|
-
}), Ts = /* @__PURE__ */ l("ZodCUID", (e, t) => {
|
|
4004
|
-
Qn.init(e, t), $.init(e, t);
|
|
4005
|
-
}), As = /* @__PURE__ */ l("ZodCUID2", (e, t) => {
|
|
4006
|
-
eo.init(e, t), $.init(e, t);
|
|
4007
|
-
}), Ns = /* @__PURE__ */ l("ZodULID", (e, t) => {
|
|
4008
|
-
to.init(e, t), $.init(e, t);
|
|
4009
|
-
}), Rs = /* @__PURE__ */ l("ZodXID", (e, t) => {
|
|
4010
|
-
ro.init(e, t), $.init(e, t);
|
|
4011
|
-
}), js = /* @__PURE__ */ l("ZodKSUID", (e, t) => {
|
|
4012
|
-
no.init(e, t), $.init(e, t);
|
|
4013
|
-
}), Cs = /* @__PURE__ */ l("ZodIPv4", (e, t) => {
|
|
4014
|
-
uo.init(e, t), $.init(e, t);
|
|
4015
|
-
}), xs = /* @__PURE__ */ l("ZodIPv6", (e, t) => {
|
|
4016
|
-
co.init(e, t), $.init(e, t);
|
|
4017
|
-
}), Ds = /* @__PURE__ */ l("ZodCIDRv4", (e, t) => {
|
|
4018
|
-
lo.init(e, t), $.init(e, t);
|
|
4019
|
-
}), Us = /* @__PURE__ */ l("ZodCIDRv6", (e, t) => {
|
|
4020
|
-
po.init(e, t), $.init(e, t);
|
|
4021
|
-
}), Ls = /* @__PURE__ */ l("ZodBase64", (e, t) => {
|
|
4022
|
-
fo.init(e, t), $.init(e, t);
|
|
4023
|
-
}), Fs = /* @__PURE__ */ l("ZodBase64URL", (e, t) => {
|
|
4024
|
-
mo.init(e, t), $.init(e, t);
|
|
4025
|
-
}), Ms = /* @__PURE__ */ l("ZodE164", (e, t) => {
|
|
4026
|
-
go.init(e, t), $.init(e, t);
|
|
4027
|
-
}), Js = /* @__PURE__ */ l("ZodJWT", (e, t) => {
|
|
4028
|
-
vo.init(e, t), $.init(e, t);
|
|
4029
|
-
}), It = /* @__PURE__ */ l("ZodNumber", (e, t) => {
|
|
4030
|
-
yt.init(e, t), z.init(e, t), e._zod.processJSONSchema = (n, o, i) => Di(e, n, o, i), Y(e, "ZodNumber", {
|
|
4031
|
-
gt(n, o) {
|
|
4032
|
-
return this.check(/* @__PURE__ */ Ve(n, o));
|
|
4033
|
-
},
|
|
4034
|
-
gte(n, o) {
|
|
4035
|
-
return this.check(/* @__PURE__ */ de(n, o));
|
|
4036
|
-
},
|
|
4037
|
-
min(n, o) {
|
|
4038
|
-
return this.check(/* @__PURE__ */ de(n, o));
|
|
4039
|
-
},
|
|
4040
|
-
lt(n, o) {
|
|
4041
|
-
return this.check(/* @__PURE__ */ Je(n, o));
|
|
4042
|
-
},
|
|
4043
|
-
lte(n, o) {
|
|
4044
|
-
return this.check(/* @__PURE__ */ le(n, o));
|
|
4045
|
-
},
|
|
4046
|
-
max(n, o) {
|
|
4047
|
-
return this.check(/* @__PURE__ */ le(n, o));
|
|
4048
|
-
},
|
|
4049
|
-
int(n) {
|
|
4050
|
-
return this.check(Be(n));
|
|
4051
|
-
},
|
|
4052
|
-
safe(n) {
|
|
4053
|
-
return this.check(Be(n));
|
|
4054
|
-
},
|
|
4055
|
-
positive(n) {
|
|
4056
|
-
return this.check(/* @__PURE__ */ Ve(0, n));
|
|
4057
|
-
},
|
|
4058
|
-
nonnegative(n) {
|
|
4059
|
-
return this.check(/* @__PURE__ */ de(0, n));
|
|
4060
|
-
},
|
|
4061
|
-
negative(n) {
|
|
4062
|
-
return this.check(/* @__PURE__ */ Je(0, n));
|
|
4063
|
-
},
|
|
4064
|
-
nonpositive(n) {
|
|
4065
|
-
return this.check(/* @__PURE__ */ le(0, n));
|
|
4066
|
-
},
|
|
4067
|
-
multipleOf(n, o) {
|
|
4068
|
-
return this.check(/* @__PURE__ */ qe(n, o));
|
|
4069
|
-
},
|
|
4070
|
-
step(n, o) {
|
|
4071
|
-
return this.check(/* @__PURE__ */ qe(n, o));
|
|
4072
|
-
},
|
|
4073
|
-
finite() {
|
|
4074
|
-
return this;
|
|
4075
|
-
}
|
|
4076
|
-
});
|
|
4077
|
-
const r = e._zod.bag;
|
|
4078
|
-
e.minValue = Math.max(r.minimum ?? Number.NEGATIVE_INFINITY, r.exclusiveMinimum ?? Number.NEGATIVE_INFINITY) ?? null, e.maxValue = Math.min(r.maximum ?? Number.POSITIVE_INFINITY, r.exclusiveMaximum ?? Number.POSITIVE_INFINITY) ?? null, e.isInt = (r.format ?? "").includes("int") || Number.isSafeInteger(r.multipleOf ?? 0.5), e.isFinite = !0, e.format = r.format ?? null;
|
|
4079
|
-
});
|
|
4080
|
-
function Ia(e) {
|
|
4081
|
-
return /* @__PURE__ */ mi(It, e);
|
|
4082
|
-
}
|
|
4083
|
-
var Vs = /* @__PURE__ */ l("ZodNumberFormat", (e, t) => {
|
|
4084
|
-
yo.init(e, t), It.init(e, t);
|
|
4085
|
-
});
|
|
4086
|
-
function Be(e) {
|
|
4087
|
-
return /* @__PURE__ */ gi(Vs, e);
|
|
4088
|
-
}
|
|
4089
|
-
var qs = /* @__PURE__ */ l("ZodBoolean", (e, t) => {
|
|
4090
|
-
bo.init(e, t), z.init(e, t), e._zod.processJSONSchema = (r, n, o) => Ui(e, r, n, o);
|
|
4091
|
-
});
|
|
4092
|
-
function Ta(e) {
|
|
4093
|
-
return /* @__PURE__ */ _i(qs, e);
|
|
4094
|
-
}
|
|
4095
|
-
var Gs = /* @__PURE__ */ l("ZodUnknown", (e, t) => {
|
|
4096
|
-
wo.init(e, t), z.init(e, t), e._zod.processJSONSchema = (r, n, o) => Fi(e, r, n, o);
|
|
4097
|
-
});
|
|
4098
|
-
function Ke() {
|
|
4099
|
-
return /* @__PURE__ */ vi(Gs);
|
|
4100
|
-
}
|
|
4101
|
-
var Ws = /* @__PURE__ */ l("ZodNever", (e, t) => {
|
|
4102
|
-
ko.init(e, t), z.init(e, t), e._zod.processJSONSchema = (r, n, o) => Li(e, r, n, o);
|
|
4103
|
-
});
|
|
4104
|
-
function Bs(e) {
|
|
4105
|
-
return /* @__PURE__ */ yi(Ws, e);
|
|
4106
|
-
}
|
|
4107
|
-
var Ks = /* @__PURE__ */ l("ZodArray", (e, t) => {
|
|
4108
|
-
zo.init(e, t), z.init(e, t), e._zod.processJSONSchema = (r, n, o) => Gi(e, r, n, o), e.element = t.element, Y(e, "ZodArray", {
|
|
4109
|
-
min(r, n) {
|
|
4110
|
-
return this.check(/* @__PURE__ */ oe(r, n));
|
|
4111
|
-
},
|
|
4112
|
-
nonempty(r) {
|
|
4113
|
-
return this.check(/* @__PURE__ */ oe(1, r));
|
|
4114
|
-
},
|
|
4115
|
-
max(r, n) {
|
|
4116
|
-
return this.check(/* @__PURE__ */ zt(r, n));
|
|
4117
|
-
},
|
|
4118
|
-
length(r, n) {
|
|
4119
|
-
return this.check(/* @__PURE__ */ $t(r, n));
|
|
4120
|
-
},
|
|
4121
|
-
unwrap() {
|
|
4122
|
-
return this.element;
|
|
4123
|
-
}
|
|
4124
|
-
});
|
|
4125
|
-
});
|
|
4126
|
-
function Hs(e, t) {
|
|
4127
|
-
return /* @__PURE__ */ Ti(Ks, e, t);
|
|
4128
|
-
}
|
|
4129
|
-
var Ys = /* @__PURE__ */ l("ZodObject", (e, t) => {
|
|
4130
|
-
So.init(e, t), z.init(e, t), e._zod.processJSONSchema = (r, n, o) => Wi(e, r, n, o), y(e, "shape", () => t.shape), Y(e, "ZodObject", {
|
|
4131
|
-
keyof() {
|
|
4132
|
-
return ra(Object.keys(this._zod.def.shape));
|
|
4133
|
-
},
|
|
4134
|
-
catchall(r) {
|
|
4135
|
-
return this.clone({
|
|
4136
|
-
...this._zod.def,
|
|
4137
|
-
catchall: r
|
|
4138
|
-
});
|
|
4139
|
-
},
|
|
4140
|
-
passthrough() {
|
|
4141
|
-
return this.clone({
|
|
4142
|
-
...this._zod.def,
|
|
4143
|
-
catchall: Ke()
|
|
4144
|
-
});
|
|
4145
|
-
},
|
|
4146
|
-
loose() {
|
|
4147
|
-
return this.clone({
|
|
4148
|
-
...this._zod.def,
|
|
4149
|
-
catchall: Ke()
|
|
4150
|
-
});
|
|
4151
|
-
},
|
|
4152
|
-
strict() {
|
|
4153
|
-
return this.clone({
|
|
4154
|
-
...this._zod.def,
|
|
4155
|
-
catchall: Bs()
|
|
4156
|
-
});
|
|
4157
|
-
},
|
|
4158
|
-
strip() {
|
|
4159
|
-
return this.clone({
|
|
4160
|
-
...this._zod.def,
|
|
4161
|
-
catchall: void 0
|
|
4162
|
-
});
|
|
4163
|
-
},
|
|
4164
|
-
extend(r) {
|
|
4165
|
-
return Mr(this, r);
|
|
4166
|
-
},
|
|
4167
|
-
safeExtend(r) {
|
|
4168
|
-
return Jr(this, r);
|
|
4169
|
-
},
|
|
4170
|
-
merge(r) {
|
|
4171
|
-
return Vr(this, r);
|
|
4172
|
-
},
|
|
4173
|
-
pick(r) {
|
|
4174
|
-
return Lr(this, r);
|
|
4175
|
-
},
|
|
4176
|
-
omit(r) {
|
|
4177
|
-
return Fr(this, r);
|
|
4178
|
-
},
|
|
4179
|
-
partial(...r) {
|
|
4180
|
-
return qr(Tt, this, r[0]);
|
|
4181
|
-
},
|
|
4182
|
-
required(...r) {
|
|
4183
|
-
return Gr(At, this, r[0]);
|
|
4184
|
-
}
|
|
4185
|
-
});
|
|
4186
|
-
});
|
|
4187
|
-
function Aa(e, t) {
|
|
4188
|
-
return new Ys({
|
|
4189
|
-
type: "object",
|
|
4190
|
-
shape: e ?? {},
|
|
4191
|
-
...g(t)
|
|
4192
|
-
});
|
|
4193
|
-
}
|
|
4194
|
-
var Xs = /* @__PURE__ */ l("ZodUnion", (e, t) => {
|
|
4195
|
-
Zo.init(e, t), z.init(e, t), e._zod.processJSONSchema = (r, n, o) => Bi(e, r, n, o), e.options = t.options;
|
|
4196
|
-
});
|
|
4197
|
-
function Qs(e, t) {
|
|
4198
|
-
return new Xs({
|
|
4199
|
-
type: "union",
|
|
4200
|
-
options: e,
|
|
4201
|
-
...g(t)
|
|
4202
|
-
});
|
|
4203
|
-
}
|
|
4204
|
-
var ea = /* @__PURE__ */ l("ZodIntersection", (e, t) => {
|
|
4205
|
-
Oo.init(e, t), z.init(e, t), e._zod.processJSONSchema = (r, n, o) => Ki(e, r, n, o);
|
|
4206
|
-
});
|
|
4207
|
-
function ta(e, t) {
|
|
4208
|
-
return new ea({
|
|
4209
|
-
type: "intersection",
|
|
4210
|
-
left: e,
|
|
4211
|
-
right: t
|
|
4212
|
-
});
|
|
4213
|
-
}
|
|
4214
|
-
var He = /* @__PURE__ */ l("ZodRecord", (e, t) => {
|
|
4215
|
-
Po.init(e, t), z.init(e, t), e._zod.processJSONSchema = (r, n, o) => Hi(e, r, n, o), e.keyType = t.keyType, e.valueType = t.valueType;
|
|
4216
|
-
});
|
|
4217
|
-
function Na(e, t, r) {
|
|
4218
|
-
return !t || !t._zod ? new He({
|
|
4219
|
-
type: "record",
|
|
4220
|
-
keyType: Zs(),
|
|
4221
|
-
valueType: e,
|
|
4222
|
-
...g(t)
|
|
4223
|
-
}) : new He({
|
|
4224
|
-
type: "record",
|
|
4225
|
-
keyType: e,
|
|
4226
|
-
valueType: t,
|
|
4227
|
-
...g(r)
|
|
4228
|
-
});
|
|
4229
|
-
}
|
|
4230
|
-
var he = /* @__PURE__ */ l("ZodEnum", (e, t) => {
|
|
4231
|
-
Eo.init(e, t), z.init(e, t), e._zod.processJSONSchema = (n, o, i) => Mi(e, n, o, i), e.enum = t.entries, e.options = Object.values(t.entries);
|
|
4232
|
-
const r = new Set(Object.keys(t.entries));
|
|
4233
|
-
e.extract = (n, o) => {
|
|
4234
|
-
const i = {};
|
|
4235
|
-
for (const s of n) if (r.has(s)) i[s] = t.entries[s];
|
|
4236
|
-
else throw new Error(`Key ${s} not found in enum`);
|
|
4237
|
-
return new he({
|
|
4238
|
-
...t,
|
|
4239
|
-
checks: [],
|
|
4240
|
-
...g(o),
|
|
4241
|
-
entries: i
|
|
4242
|
-
});
|
|
4243
|
-
}, e.exclude = (n, o) => {
|
|
4244
|
-
const i = { ...t.entries };
|
|
4245
|
-
for (const s of n) if (r.has(s)) delete i[s];
|
|
4246
|
-
else throw new Error(`Key ${s} not found in enum`);
|
|
4247
|
-
return new he({
|
|
4248
|
-
...t,
|
|
4249
|
-
checks: [],
|
|
4250
|
-
...g(o),
|
|
4251
|
-
entries: i
|
|
4252
|
-
});
|
|
4253
|
-
};
|
|
4254
|
-
});
|
|
4255
|
-
function ra(e, t) {
|
|
4256
|
-
return new he({
|
|
4257
|
-
type: "enum",
|
|
4258
|
-
entries: Array.isArray(e) ? Object.fromEntries(e.map((r) => [r, r])) : e,
|
|
4259
|
-
...g(t)
|
|
4260
|
-
});
|
|
4261
|
-
}
|
|
4262
|
-
var na = /* @__PURE__ */ l("ZodLiteral", (e, t) => {
|
|
4263
|
-
Io.init(e, t), z.init(e, t), e._zod.processJSONSchema = (r, n, o) => Ji(e, r, n, o), e.values = new Set(t.values), Object.defineProperty(e, "value", { get() {
|
|
4264
|
-
if (t.values.length > 1) throw new Error("This schema contains multiple valid literal values. Use `.values` instead.");
|
|
4265
|
-
return t.values[0];
|
|
4266
|
-
} });
|
|
4267
|
-
});
|
|
4268
|
-
function Ra(e, t) {
|
|
4269
|
-
return new na({
|
|
4270
|
-
type: "literal",
|
|
4271
|
-
values: Array.isArray(e) ? e : [e],
|
|
4272
|
-
...g(t)
|
|
4273
|
-
});
|
|
4274
|
-
}
|
|
4275
|
-
var oa = /* @__PURE__ */ l("ZodTransform", (e, t) => {
|
|
4276
|
-
To.init(e, t), z.init(e, t), e._zod.processJSONSchema = (r, n, o) => qi(e, r, n, o), e._zod.parse = (r, n) => {
|
|
4277
|
-
if (n.direction === "backward") throw new ot(e.constructor.name);
|
|
4278
|
-
r.addIssue = (i) => {
|
|
4279
|
-
if (typeof i == "string") r.issues.push(H(i, r.value, t));
|
|
4280
|
-
else {
|
|
4281
|
-
const s = i;
|
|
4282
|
-
s.fatal && (s.continue = !1), s.code ?? (s.code = "custom"), s.input ?? (s.input = r.value), s.inst ?? (s.inst = e), r.issues.push(H(s));
|
|
4283
|
-
}
|
|
4284
|
-
};
|
|
4285
|
-
const o = t.transform(r.value, r);
|
|
4286
|
-
return o instanceof Promise ? o.then((i) => (r.value = i, r.fallback = !0, r)) : (r.value = o, r.fallback = !0, r);
|
|
4287
|
-
};
|
|
4288
|
-
});
|
|
4289
|
-
function ia(e) {
|
|
4290
|
-
return new oa({
|
|
4291
|
-
type: "transform",
|
|
4292
|
-
transform: e
|
|
4293
|
-
});
|
|
4294
|
-
}
|
|
4295
|
-
var Tt = /* @__PURE__ */ l("ZodOptional", (e, t) => {
|
|
4296
|
-
kt.init(e, t), z.init(e, t), e._zod.processJSONSchema = (r, n, o) => Pt(e, r, n, o), e.unwrap = () => e._zod.def.innerType;
|
|
4297
|
-
});
|
|
4298
|
-
function Ye(e) {
|
|
4299
|
-
return new Tt({
|
|
4300
|
-
type: "optional",
|
|
4301
|
-
innerType: e
|
|
4302
|
-
});
|
|
4303
|
-
}
|
|
4304
|
-
var sa = /* @__PURE__ */ l("ZodExactOptional", (e, t) => {
|
|
4305
|
-
Ao.init(e, t), z.init(e, t), e._zod.processJSONSchema = (r, n, o) => Pt(e, r, n, o), e.unwrap = () => e._zod.def.innerType;
|
|
4306
|
-
});
|
|
4307
|
-
function aa(e) {
|
|
4308
|
-
return new sa({
|
|
4309
|
-
type: "optional",
|
|
4310
|
-
innerType: e
|
|
4311
|
-
});
|
|
4312
|
-
}
|
|
4313
|
-
var ua = /* @__PURE__ */ l("ZodNullable", (e, t) => {
|
|
4314
|
-
No.init(e, t), z.init(e, t), e._zod.processJSONSchema = (r, n, o) => Yi(e, r, n, o), e.unwrap = () => e._zod.def.innerType;
|
|
4315
|
-
});
|
|
4316
|
-
function Xe(e) {
|
|
4317
|
-
return new ua({
|
|
4318
|
-
type: "nullable",
|
|
4319
|
-
innerType: e
|
|
4320
|
-
});
|
|
4321
|
-
}
|
|
4322
|
-
var ca = /* @__PURE__ */ l("ZodDefault", (e, t) => {
|
|
4323
|
-
Ro.init(e, t), z.init(e, t), e._zod.processJSONSchema = (r, n, o) => Qi(e, r, n, o), e.unwrap = () => e._zod.def.innerType, e.removeDefault = e.unwrap;
|
|
4324
|
-
});
|
|
4325
|
-
function la(e, t) {
|
|
4326
|
-
return new ca({
|
|
4327
|
-
type: "default",
|
|
4328
|
-
innerType: e,
|
|
4329
|
-
get defaultValue() {
|
|
4330
|
-
return typeof t == "function" ? t() : at(t);
|
|
4331
|
-
}
|
|
4332
|
-
});
|
|
4333
|
-
}
|
|
4334
|
-
var da = /* @__PURE__ */ l("ZodPrefault", (e, t) => {
|
|
4335
|
-
jo.init(e, t), z.init(e, t), e._zod.processJSONSchema = (r, n, o) => es(e, r, n, o), e.unwrap = () => e._zod.def.innerType;
|
|
4336
|
-
});
|
|
4337
|
-
function pa(e, t) {
|
|
4338
|
-
return new da({
|
|
4339
|
-
type: "prefault",
|
|
4340
|
-
innerType: e,
|
|
4341
|
-
get defaultValue() {
|
|
4342
|
-
return typeof t == "function" ? t() : at(t);
|
|
4343
|
-
}
|
|
4344
|
-
});
|
|
4345
|
-
}
|
|
4346
|
-
var At = /* @__PURE__ */ l("ZodNonOptional", (e, t) => {
|
|
4347
|
-
Co.init(e, t), z.init(e, t), e._zod.processJSONSchema = (r, n, o) => Xi(e, r, n, o), e.unwrap = () => e._zod.def.innerType;
|
|
4348
|
-
});
|
|
4349
|
-
function fa(e, t) {
|
|
4350
|
-
return new At({
|
|
4351
|
-
type: "nonoptional",
|
|
4352
|
-
innerType: e,
|
|
4353
|
-
...g(t)
|
|
4354
|
-
});
|
|
4355
|
-
}
|
|
4356
|
-
var ha = /* @__PURE__ */ l("ZodCatch", (e, t) => {
|
|
4357
|
-
xo.init(e, t), z.init(e, t), e._zod.processJSONSchema = (r, n, o) => ts(e, r, n, o), e.unwrap = () => e._zod.def.innerType, e.removeCatch = e.unwrap;
|
|
4358
|
-
});
|
|
4359
|
-
function ma(e, t) {
|
|
4360
|
-
return new ha({
|
|
4361
|
-
type: "catch",
|
|
4362
|
-
innerType: e,
|
|
4363
|
-
catchValue: typeof t == "function" ? t : () => t
|
|
4364
|
-
});
|
|
4365
|
-
}
|
|
4366
|
-
var ga = /* @__PURE__ */ l("ZodPipe", (e, t) => {
|
|
4367
|
-
Do.init(e, t), z.init(e, t), e._zod.processJSONSchema = (r, n, o) => rs(e, r, n, o), e.in = t.in, e.out = t.out;
|
|
4368
|
-
});
|
|
4369
|
-
function Qe(e, t) {
|
|
4370
|
-
return new ga({
|
|
4371
|
-
type: "pipe",
|
|
4372
|
-
in: e,
|
|
4373
|
-
out: t
|
|
4374
|
-
});
|
|
4375
|
-
}
|
|
4376
|
-
var _a = /* @__PURE__ */ l("ZodReadonly", (e, t) => {
|
|
4377
|
-
Uo.init(e, t), z.init(e, t), e._zod.processJSONSchema = (r, n, o) => ns(e, r, n, o), e.unwrap = () => e._zod.def.innerType;
|
|
4378
|
-
});
|
|
4379
|
-
function va(e) {
|
|
4380
|
-
return new _a({
|
|
4381
|
-
type: "readonly",
|
|
4382
|
-
innerType: e
|
|
4383
|
-
});
|
|
4384
|
-
}
|
|
4385
|
-
var ya = /* @__PURE__ */ l("ZodCustom", (e, t) => {
|
|
4386
|
-
Lo.init(e, t), z.init(e, t), e._zod.processJSONSchema = (r, n, o) => Vi(e, r, n, o);
|
|
4387
|
-
});
|
|
4388
|
-
function ba(e, t = {}) {
|
|
4389
|
-
return /* @__PURE__ */ Ai(ya, e, t);
|
|
4390
|
-
}
|
|
4391
|
-
function wa(e, t) {
|
|
4392
|
-
return /* @__PURE__ */ Ni(e, t);
|
|
4393
|
-
}
|
|
4394
|
-
export {
|
|
4395
|
-
Ct as C,
|
|
4396
|
-
$a as S,
|
|
4397
|
-
Vt as _,
|
|
4398
|
-
Ia as a,
|
|
4399
|
-
Dt as b,
|
|
4400
|
-
Zs as c,
|
|
4401
|
-
Ea as d,
|
|
4402
|
-
Nr as f,
|
|
4403
|
-
x as g,
|
|
4404
|
-
Oa as h,
|
|
4405
|
-
Ra as i,
|
|
4406
|
-
Qs as l,
|
|
4407
|
-
Pa as m,
|
|
4408
|
-
Hs as n,
|
|
4409
|
-
Aa as o,
|
|
4410
|
-
Za as p,
|
|
4411
|
-
Ta as r,
|
|
4412
|
-
Na as s,
|
|
4413
|
-
ra as t,
|
|
4414
|
-
Ke as u,
|
|
4415
|
-
Ft as v,
|
|
4416
|
-
za as w,
|
|
4417
|
-
Sa as x,
|
|
4418
|
-
Mt as y
|
|
4419
|
-
};
|