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