@inploi/plugin-chatbot 14.9.0 → 14.10.1
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/cdn/index.js +7 -7
- package/cdn/style.css +1 -1
- package/dist/chatbot-body-b3e7212a.cjs +5 -0
- package/dist/chatbot-body-d3fd468f.js +4094 -0
- package/dist/chatbot.d.ts +6 -0
- package/dist/chatbot.idb.d.ts +2 -2
- package/dist/chatbot.resume.d.ts +15 -0
- package/dist/chatbot.resume.test.d.ts +1 -0
- package/dist/chatbot.state.d.ts +24 -406
- package/dist/chatbot.storage.test.d.ts +1 -0
- package/dist/chatbot.utils.d.ts +1 -255
- package/dist/components/chat-input/chat-input.address.d.ts +1 -14
- package/dist/components/chat-input/chat-input.boolean.d.ts +1 -13
- package/dist/components/chat-input/chat-input.d.ts +1 -12
- package/dist/components/chat-input/chat-input.file.d.ts +1 -12
- package/dist/components/chat-input/chat-input.multiple-choice.d.ts +1 -14
- package/dist/components/chat-input/chat-input.number.d.ts +1 -14
- package/dist/components/chat-input/chat-input.phone-number.d.ts +1 -17
- package/dist/components/chat-input/chat-input.submit.d.ts +1 -10
- package/dist/components/chat-input/chat-input.text.d.ts +1 -16
- package/dist/components/chatbot-body.lifecycle.test.d.ts +1 -0
- package/dist/components/message.link.d.ts +1 -1
- package/dist/components/useChatService.d.ts +1 -1
- package/dist/components/useChatService.test.d.ts +1 -0
- package/dist/i18n.d.ts +42 -0
- package/dist/index-4aad840b.cjs +5 -0
- package/dist/{index-75330fed.js → index-b8dab3ec.js} +1184 -1122
- package/dist/plugin-chatbot.cjs +1 -1
- package/dist/plugin-chatbot.js +1 -1
- package/dist/style/tokens.d.ts +4 -4
- package/dist/style.css +1 -1
- package/package.json +4 -4
- package/dist/chatbot-body-45ccac19.js +0 -4695
- package/dist/chatbot-body-b6a4eef8.cjs +0 -5
- package/dist/index-47f31542.cjs +0 -5
- package/dist/interpreter.d.ts +0 -67
|
@@ -1,4695 +0,0 @@
|
|
|
1
|
-
import { e as wr, o as ct, I as St, n as Be, s as _r, g as kr, a as Ft, A as is, Z as os, T as ls, b as Cr, B as us, q as cs, j as ds, Y as fs, i as hs, f as ps, N as zt, D as ms, d as ys, u as Kt, l as gs, p as bs, c as vs, h as xs, k as Q, m as u, r as Ke, t as dt, v as ge, _ as de, w as Ee, y as Se, x as ve, L as Vt, F as ws, z as B, C as Sr, E as Ir, G as _s, H as We, J as Wt, K as te, M as ne, O as ks, P as Cs, Q as Ss, S as Ar, R as Is } from "./index-75330fed.js";
|
|
2
|
-
import { isApiErrorWithData as As, ApiError as Fs } from "@inploi/sdk";
|
|
3
|
-
const Gt = (e, r, t) => {
|
|
4
|
-
var s;
|
|
5
|
-
return e.log({
|
|
6
|
-
event: t,
|
|
7
|
-
properties: {
|
|
8
|
-
flow_id: r.id,
|
|
9
|
-
flow_version: r.version,
|
|
10
|
-
flow_session_id: r.data.flowSessionId,
|
|
11
|
-
flow_build: r.build,
|
|
12
|
-
flow_type: "CHATBOT_DRAWER",
|
|
13
|
-
job: r.job
|
|
14
|
-
},
|
|
15
|
-
customProperties: (s = r.analytics) == null ? void 0 : s.customProperties
|
|
16
|
-
});
|
|
17
|
-
};
|
|
18
|
-
var Vs = "9.6.0", Fr = `https://sdk.inploi.com/@inploi/flows@${Vs}/cdn/captcha/index.html`, Es = new URL(Fr).origin, Ht = 3e4, Ms = 5 * 6e4, Ns = (e) => typeof e == "object" && e !== null && e.source === "inploi-captcha", vt = /* @__PURE__ */ new WeakMap(), Ls = (e) => {
|
|
19
|
-
let r = vt.get(e);
|
|
20
|
-
return r || (r = e.fetch("/flow/captcha").then((t) => {
|
|
21
|
-
let s = t == null ? void 0 : t.site_key;
|
|
22
|
-
return typeof s == "string" && s !== "" ? s : void 0;
|
|
23
|
-
}).catch((t) => {
|
|
24
|
-
throw vt.delete(e), t;
|
|
25
|
-
}), vt.set(e, r)), r;
|
|
26
|
-
}, Ts = (e, r = {}) => new Promise((t, s) => {
|
|
27
|
-
let { signal: n, container: i = null, theme: a, onInteractive: o } = r instanceof AbortSignal ? { signal: r } : r, c = !1, h = () => {
|
|
28
|
-
}, v = (F) => {
|
|
29
|
-
c || (c = !0, clearTimeout(m), n == null || n.removeEventListener("abort", p), h(), F());
|
|
30
|
-
}, g = (F) => v(() => s(new Error(F))), p = () => g("Captcha aborted"), m, w = (F) => {
|
|
31
|
-
clearTimeout(m), m = setTimeout(() => g("Captcha timed out"), F);
|
|
32
|
-
};
|
|
33
|
-
if (w(Ht), n == null ? void 0 : n.aborted)
|
|
34
|
-
return p();
|
|
35
|
-
n == null || n.addEventListener("abort", p), (async () => {
|
|
36
|
-
let F = await Ls(e);
|
|
37
|
-
if (F === void 0)
|
|
38
|
-
return v(() => t(void 0));
|
|
39
|
-
if (c)
|
|
40
|
-
return;
|
|
41
|
-
let _ = document.createElement("iframe");
|
|
42
|
-
_.src = `${Fr}?${new URLSearchParams({ sitekey: F, origin: window.location.origin, ...a && { theme: a } }).toString()}`, _.title = "Cloudflare security check", _.style.cssText = `display:block;border:0;width:${i ? "100%" : "300px"};height:0;color-scheme:normal`, i ? i.appendChild(_) : (_.style.cssText += ";position:fixed;bottom:16px;right:16px;z-index:2147483647", document.body.appendChild(_));
|
|
43
|
-
let S = !1, y = (C) => {
|
|
44
|
-
if (!_.contentWindow || C.source !== _.contentWindow || C.origin !== Es || !Ns(C.data))
|
|
45
|
-
return;
|
|
46
|
-
let A = C.data;
|
|
47
|
-
switch (A.type) {
|
|
48
|
-
case "token":
|
|
49
|
-
return v(() => t(A.token));
|
|
50
|
-
case "resize":
|
|
51
|
-
_.style.height = `${Math.max(0, Math.ceil(A.height))}px`;
|
|
52
|
-
return;
|
|
53
|
-
case "before-interactive":
|
|
54
|
-
return S = !0, w(Ms), o == null ? void 0 : o();
|
|
55
|
-
case "after-interactive":
|
|
56
|
-
return S = !1, w(Ht);
|
|
57
|
-
case "error":
|
|
58
|
-
!S && !A.interactive && g("Captcha failed");
|
|
59
|
-
return;
|
|
60
|
-
case "expired":
|
|
61
|
-
return g("Captcha expired");
|
|
62
|
-
case "timeout":
|
|
63
|
-
return g("Captcha timed out");
|
|
64
|
-
}
|
|
65
|
-
};
|
|
66
|
-
window.addEventListener("message", y), h = () => {
|
|
67
|
-
window.removeEventListener("message", y), _.remove();
|
|
68
|
-
};
|
|
69
|
-
})().catch((F) => v(() => s(F)));
|
|
70
|
-
}), Jt = ({ condition: e, context: r, submissions: t, ifBlock: s }) => {
|
|
71
|
-
let [n, ...i] = e.compareKey.split(".");
|
|
72
|
-
if (!n)
|
|
73
|
-
return !1;
|
|
74
|
-
let a = wr({ context: r, key: n, path: i, submissions: t });
|
|
75
|
-
if (!a)
|
|
76
|
-
return !1;
|
|
77
|
-
switch (a.type) {
|
|
78
|
-
case "address": {
|
|
79
|
-
let o = St(a.value, i);
|
|
80
|
-
switch (e.compare) {
|
|
81
|
-
case "equals":
|
|
82
|
-
return o === e.compareValue;
|
|
83
|
-
case "contains":
|
|
84
|
-
return typeof o != "string" ? !1 : o.includes(e.compareValue);
|
|
85
|
-
case "notEquals":
|
|
86
|
-
return o !== e.compareValue;
|
|
87
|
-
case "notContains":
|
|
88
|
-
return typeof o != "string" ? !0 : !o.includes(e.compareValue);
|
|
89
|
-
}
|
|
90
|
-
break;
|
|
91
|
-
}
|
|
92
|
-
case "integration": {
|
|
93
|
-
if (typeof a.value != "object" || Array.isArray(a.value))
|
|
94
|
-
return !1;
|
|
95
|
-
let o = St(a.value, i), c = { ...s, data: { compareKey: "_temp", compare: e.compare, compareValue: e.compareValue } };
|
|
96
|
-
switch (typeof o) {
|
|
97
|
-
case "boolean":
|
|
98
|
-
return Qe(c, { submissions: { _temp: { value: o, type: "boolean" } }, context: r });
|
|
99
|
-
case "string":
|
|
100
|
-
return Qe(c, { submissions: { _temp: { value: o, type: "string" } }, context: r });
|
|
101
|
-
case "number":
|
|
102
|
-
return Qe(c, { submissions: { _temp: { value: o, type: "number" } }, context: r });
|
|
103
|
-
case "object":
|
|
104
|
-
return Array.isArray(o) && o.every((h) => typeof h == "string") ? Qe(c, { submissions: { _temp: { value: o, type: "enum" } }, context: r }) : !1;
|
|
105
|
-
}
|
|
106
|
-
break;
|
|
107
|
-
}
|
|
108
|
-
case "boolean": {
|
|
109
|
-
let o = e.compareValue === "true";
|
|
110
|
-
switch (e.compare) {
|
|
111
|
-
case "equals":
|
|
112
|
-
return a.value === o;
|
|
113
|
-
case "notEquals":
|
|
114
|
-
return a.value !== o;
|
|
115
|
-
}
|
|
116
|
-
break;
|
|
117
|
-
}
|
|
118
|
-
case "phone":
|
|
119
|
-
case "string": {
|
|
120
|
-
let o = a.type === "phone" ? ct(a.value) : a.value;
|
|
121
|
-
switch (e.compare) {
|
|
122
|
-
case "equals":
|
|
123
|
-
return o === e.compareValue;
|
|
124
|
-
case "contains":
|
|
125
|
-
return o ? o.includes(e.compareValue) : !1;
|
|
126
|
-
case "notEquals":
|
|
127
|
-
return o !== e.compareValue;
|
|
128
|
-
case "notContains":
|
|
129
|
-
return o ? !o.includes(e.compareValue) : !0;
|
|
130
|
-
}
|
|
131
|
-
break;
|
|
132
|
-
}
|
|
133
|
-
case "number": {
|
|
134
|
-
try {
|
|
135
|
-
let o = Number(e.compareValue);
|
|
136
|
-
switch (e.compare) {
|
|
137
|
-
case "equals":
|
|
138
|
-
return a.value === o;
|
|
139
|
-
case "notEquals":
|
|
140
|
-
return a.value !== o;
|
|
141
|
-
case "greaterThan":
|
|
142
|
-
return a.value > o;
|
|
143
|
-
case "greaterThanOrEqualTo":
|
|
144
|
-
return a.value >= o;
|
|
145
|
-
case "lessThan":
|
|
146
|
-
return a.value < o;
|
|
147
|
-
case "lessThanOrEqualTo":
|
|
148
|
-
return a.value <= o;
|
|
149
|
-
}
|
|
150
|
-
} catch {
|
|
151
|
-
return console.error(`Failed to parse number in if-block ${s.id}`, a.value), !1;
|
|
152
|
-
}
|
|
153
|
-
break;
|
|
154
|
-
}
|
|
155
|
-
case "enum":
|
|
156
|
-
switch (e.compare) {
|
|
157
|
-
case "equals":
|
|
158
|
-
return a.value.length === 1 && a.value[0] === e.compareValue;
|
|
159
|
-
case "notEquals":
|
|
160
|
-
return a.value.length === 1 && a.value[0] !== e.compareValue;
|
|
161
|
-
case "contains":
|
|
162
|
-
return a.value.includes(e.compareValue);
|
|
163
|
-
case "notContains":
|
|
164
|
-
return !a.value.includes(e.compareValue);
|
|
165
|
-
}
|
|
166
|
-
break;
|
|
167
|
-
}
|
|
168
|
-
}, Qe = (e, { context: r, submissions: t }) => {
|
|
169
|
-
let s = "combinator" in e.data ? e.data.conditions : [e.data];
|
|
170
|
-
if (("combinator" in e.data ? e.data.combinator : "and") === "or") {
|
|
171
|
-
for (let n of s)
|
|
172
|
-
if (Jt({ condition: n, context: r, submissions: t, ifBlock: e }))
|
|
173
|
-
return !0;
|
|
174
|
-
return !1;
|
|
175
|
-
} else {
|
|
176
|
-
for (let n of s)
|
|
177
|
-
if (!Jt({ condition: n, context: r, submissions: t, ifBlock: e }))
|
|
178
|
-
return !1;
|
|
179
|
-
return !0;
|
|
180
|
-
}
|
|
181
|
-
}, Ds = /{{\s*([^}]+?)\s*(?:\|\s*([^}]+?)\s*)?}}/g, Os = (e, { context: r, submissions: t }) => e.replace(Ds, (s, n, i = "") => {
|
|
182
|
-
let [a, ...o] = n.trim().split("."), c = wr({ key: a, path: o, submissions: t, context: r });
|
|
183
|
-
if (!c)
|
|
184
|
-
return i;
|
|
185
|
-
switch (c.type) {
|
|
186
|
-
case "boolean":
|
|
187
|
-
return c.value === !0 ? "true" : "false";
|
|
188
|
-
case "file":
|
|
189
|
-
return c.value.map((h) => `${h.name} (${Be(h.sizeKb)})`).join(", ");
|
|
190
|
-
case "enum":
|
|
191
|
-
return c.value.join(", ");
|
|
192
|
-
case "address":
|
|
193
|
-
return Object.values(c.value).filter((h) => h && h.trim().length > 0).join(", ");
|
|
194
|
-
case "number":
|
|
195
|
-
case "string":
|
|
196
|
-
return c.value ? c.value.toString() : i;
|
|
197
|
-
case "phone":
|
|
198
|
-
return ct(c.value);
|
|
199
|
-
case "integration": {
|
|
200
|
-
if (typeof c.value != "object" || Array.isArray(c.value))
|
|
201
|
-
break;
|
|
202
|
-
let h = St(c.value, o);
|
|
203
|
-
switch (typeof h) {
|
|
204
|
-
case "boolean":
|
|
205
|
-
return h === !0 ? "true" : "false";
|
|
206
|
-
case "string":
|
|
207
|
-
return h;
|
|
208
|
-
case "number":
|
|
209
|
-
return h.toString();
|
|
210
|
-
case "object":
|
|
211
|
-
if (Array.isArray(h) && h.every((v) => typeof v == "string"))
|
|
212
|
-
return h.join(", ");
|
|
213
|
-
}
|
|
214
|
-
break;
|
|
215
|
-
}
|
|
216
|
-
}
|
|
217
|
-
return i;
|
|
218
|
-
});
|
|
219
|
-
const Vr = ({
|
|
220
|
-
context: e,
|
|
221
|
-
submissions: r
|
|
222
|
-
}) => ({
|
|
223
|
-
context: e,
|
|
224
|
-
submissions: r ?? {}
|
|
225
|
-
}), fe = (e, r) => Os(e, Vr(r)), Rs = (e, r) => Qe(e, Vr(r)), Er = ({
|
|
226
|
-
node: e,
|
|
227
|
-
nodes: r,
|
|
228
|
-
stopWhen: t
|
|
229
|
-
}) => {
|
|
230
|
-
if ((t == null ? void 0 : t(e)) === !0)
|
|
231
|
-
return e;
|
|
232
|
-
const s = e.nextId ? r.find((n) => n.id === e.nextId) : void 0;
|
|
233
|
-
if (s)
|
|
234
|
-
return Er({
|
|
235
|
-
node: s,
|
|
236
|
-
nodes: r,
|
|
237
|
-
stopWhen: t
|
|
238
|
-
});
|
|
239
|
-
}, $s = ({
|
|
240
|
-
childNode: e,
|
|
241
|
-
nodes: r
|
|
242
|
-
}) => {
|
|
243
|
-
const s = r.filter((n) => n.type === "if-block").find((n) => {
|
|
244
|
-
if (!n.branchId)
|
|
245
|
-
return !1;
|
|
246
|
-
const i = r.find((o) => o.id === n.branchId);
|
|
247
|
-
if (!i)
|
|
248
|
-
return !1;
|
|
249
|
-
const a = Er({
|
|
250
|
-
node: i,
|
|
251
|
-
nodes: r,
|
|
252
|
-
stopWhen: (o) => o.id === e.id
|
|
253
|
-
});
|
|
254
|
-
return !(!a || a.id !== e.id);
|
|
255
|
-
});
|
|
256
|
-
if (s != null && s.nextId)
|
|
257
|
-
return r.find((n) => n.id === s.nextId);
|
|
258
|
-
}, Ps = 3, js = ({
|
|
259
|
-
flow: e,
|
|
260
|
-
analytics: r,
|
|
261
|
-
logger: t,
|
|
262
|
-
talentBankClient: s,
|
|
263
|
-
context: n,
|
|
264
|
-
apiClient: i,
|
|
265
|
-
getSubmissions: a,
|
|
266
|
-
getApplicationRecovery: o,
|
|
267
|
-
setApplicationRecovery: c,
|
|
268
|
-
chatService: h,
|
|
269
|
-
persistWriteBarrier: v,
|
|
270
|
-
onFlowEnd: g,
|
|
271
|
-
onInterpret: p,
|
|
272
|
-
t: m
|
|
273
|
-
}) => {
|
|
274
|
-
var S;
|
|
275
|
-
let w = new AbortController();
|
|
276
|
-
(S = e.data).startedWriteNodeIds ?? (S.startedWriteNodeIds = e.nodes.flatMap((y) => {
|
|
277
|
-
var E, R;
|
|
278
|
-
if (y.type !== "integration-application-submit" || !e.data.nodeHistory.includes(y.id))
|
|
279
|
-
return [];
|
|
280
|
-
const C = y.data.key ? (E = a()) == null ? void 0 : E[y.data.key] : void 0;
|
|
281
|
-
return (C == null ? void 0 : C.type) === "integration" && ((R = _r(C.value)) == null ? void 0 : R.verdict) === "not_submitted" ? [] : [y.id];
|
|
282
|
-
}));
|
|
283
|
-
const F = {
|
|
284
|
-
...r.service,
|
|
285
|
-
log: (y) => r.service.log({
|
|
286
|
-
...y,
|
|
287
|
-
customProperties: {
|
|
288
|
-
...y.customProperties,
|
|
289
|
-
...r.customProperties
|
|
290
|
-
}
|
|
291
|
-
})
|
|
292
|
-
}, _ = async (y, C) => {
|
|
293
|
-
const A = w.signal;
|
|
294
|
-
if (A.aborted)
|
|
295
|
-
return;
|
|
296
|
-
const E = a(), R = o(), K = (R == null ? void 0 : R.submitNodeId) === y.id ? e.nodes.find((D) => {
|
|
297
|
-
var q;
|
|
298
|
-
return D.id === R.fileQuestionNodeId && D.type === "question-file" && ((q = E == null ? void 0 : E[D.data.key]) == null ? void 0 : q.type) !== "file";
|
|
299
|
-
}) : void 0;
|
|
300
|
-
if (K)
|
|
301
|
-
return _(K, C);
|
|
302
|
-
p == null || p(y, C);
|
|
303
|
-
try {
|
|
304
|
-
await Bs({
|
|
305
|
-
flow: e,
|
|
306
|
-
analytics: F,
|
|
307
|
-
logger: t,
|
|
308
|
-
talentBankClient: s,
|
|
309
|
-
apiClient: i,
|
|
310
|
-
context: n,
|
|
311
|
-
node: y,
|
|
312
|
-
submissions: E,
|
|
313
|
-
applicationRecovery: R,
|
|
314
|
-
setApplicationRecovery: async (D) => {
|
|
315
|
-
if (!A.aborted)
|
|
316
|
-
try {
|
|
317
|
-
await c(D);
|
|
318
|
-
} catch (q) {
|
|
319
|
-
t.error("Failed to persist application recovery", q);
|
|
320
|
-
}
|
|
321
|
-
},
|
|
322
|
-
forceSubmitConfirmation: (R == null ? void 0 : R.submitNodeId) === y.id,
|
|
323
|
-
persistWriteBarrier: v,
|
|
324
|
-
signal: A,
|
|
325
|
-
t: m,
|
|
326
|
-
chat: {
|
|
327
|
-
sendMessage: async (D) => h.send({
|
|
328
|
-
groupId: y.id,
|
|
329
|
-
message: D,
|
|
330
|
-
signal: A
|
|
331
|
-
}),
|
|
332
|
-
userInput: async (D) => h.input({
|
|
333
|
-
input: D,
|
|
334
|
-
signal: A
|
|
335
|
-
}),
|
|
336
|
-
setSubmission: (D, q) => {
|
|
337
|
-
A.aborted || h.setSubmission(D, q);
|
|
338
|
-
},
|
|
339
|
-
captcha: h.captcha
|
|
340
|
-
},
|
|
341
|
-
next: (D) => {
|
|
342
|
-
if (A.aborted)
|
|
343
|
-
return;
|
|
344
|
-
const q = (R == null ? void 0 : R.fileQuestionNodeId) === y.id ? R.submitNodeId : D, O = q ? e.nodes.find((J) => J.id === q) : $s({
|
|
345
|
-
childNode: y,
|
|
346
|
-
nodes: e.nodes
|
|
347
|
-
});
|
|
348
|
-
return O ? _(O, y) : g == null ? void 0 : g(y);
|
|
349
|
-
},
|
|
350
|
-
end: () => {
|
|
351
|
-
A.aborted || g == null || g(y);
|
|
352
|
-
}
|
|
353
|
-
});
|
|
354
|
-
} catch (D) {
|
|
355
|
-
if (D instanceof is)
|
|
356
|
-
return;
|
|
357
|
-
throw D;
|
|
358
|
-
}
|
|
359
|
-
};
|
|
360
|
-
return {
|
|
361
|
-
interpret: async (y) => {
|
|
362
|
-
const C = e.nodes.find((A) => A.id === y) ?? kr(e.nodes);
|
|
363
|
-
return _(C);
|
|
364
|
-
},
|
|
365
|
-
undo: (y) => {
|
|
366
|
-
var q;
|
|
367
|
-
if ((q = e.data.startedWriteNodeIds) != null && q.length || e.data.isFinished)
|
|
368
|
-
return {
|
|
369
|
-
removed: 0
|
|
370
|
-
};
|
|
371
|
-
const C = Ft(e), A = C ? y.lastIndexOf(C) : -1, E = e.nodes.find((O) => O.id === C);
|
|
372
|
-
if (A === -1 || !E)
|
|
373
|
-
return {
|
|
374
|
-
removed: 0
|
|
375
|
-
};
|
|
376
|
-
const R = e.nodes.find((O) => O.id === y[y.length - 1]);
|
|
377
|
-
w.abort();
|
|
378
|
-
const K = y.splice(A);
|
|
379
|
-
e.data.messages = e.data.messages.filter((O) => !O.groupId || !K.includes(O.groupId)), e.data.currentInput = null;
|
|
380
|
-
const D = a();
|
|
381
|
-
for (const O of K.slice(1)) {
|
|
382
|
-
const J = e.nodes.find((M) => M.id === O);
|
|
383
|
-
if (!(!J || !D || J.id === C) && ("key" in J.data && J.data.key && delete D[J.data.key], "keys" in J.data))
|
|
384
|
-
for (const M of Object.values(J.data.keys))
|
|
385
|
-
typeof M == "string" && delete D[M];
|
|
386
|
-
}
|
|
387
|
-
return w = new AbortController(), _(E, R), {
|
|
388
|
-
removed: K.length
|
|
389
|
-
};
|
|
390
|
-
},
|
|
391
|
-
abort: () => {
|
|
392
|
-
w.abort();
|
|
393
|
-
}
|
|
394
|
-
};
|
|
395
|
-
};
|
|
396
|
-
async function Bs(e) {
|
|
397
|
-
const r = e.node;
|
|
398
|
-
switch (r.type) {
|
|
399
|
-
case "flow-section":
|
|
400
|
-
return await e.chat.sendMessage({
|
|
401
|
-
type: "system",
|
|
402
|
-
variant: "info",
|
|
403
|
-
text: r.data.title
|
|
404
|
-
}), e.next(r.nextId);
|
|
405
|
-
case "pre-apply-result":
|
|
406
|
-
return ln({
|
|
407
|
-
...e,
|
|
408
|
-
node: r
|
|
409
|
-
});
|
|
410
|
-
case "text":
|
|
411
|
-
return Xs({
|
|
412
|
-
...e,
|
|
413
|
-
node: r
|
|
414
|
-
});
|
|
415
|
-
case "image":
|
|
416
|
-
return Ys({
|
|
417
|
-
...e,
|
|
418
|
-
node: r
|
|
419
|
-
});
|
|
420
|
-
case "question-text":
|
|
421
|
-
return Qs({
|
|
422
|
-
...e,
|
|
423
|
-
node: r
|
|
424
|
-
});
|
|
425
|
-
case "question-enum":
|
|
426
|
-
return rn({
|
|
427
|
-
...e,
|
|
428
|
-
node: r
|
|
429
|
-
});
|
|
430
|
-
case "question-number":
|
|
431
|
-
return en({
|
|
432
|
-
...e,
|
|
433
|
-
node: r
|
|
434
|
-
});
|
|
435
|
-
case "question-phone":
|
|
436
|
-
return tn({
|
|
437
|
-
...e,
|
|
438
|
-
node: r
|
|
439
|
-
});
|
|
440
|
-
case "question-boolean":
|
|
441
|
-
return sn({
|
|
442
|
-
...e,
|
|
443
|
-
node: r
|
|
444
|
-
});
|
|
445
|
-
case "question-file":
|
|
446
|
-
return an({
|
|
447
|
-
...e,
|
|
448
|
-
node: r
|
|
449
|
-
});
|
|
450
|
-
case "question-address":
|
|
451
|
-
return nn({
|
|
452
|
-
...e,
|
|
453
|
-
node: r
|
|
454
|
-
});
|
|
455
|
-
case "end-flow":
|
|
456
|
-
return on({
|
|
457
|
-
...e,
|
|
458
|
-
node: r
|
|
459
|
-
});
|
|
460
|
-
case "if-block":
|
|
461
|
-
return Zs({
|
|
462
|
-
...e,
|
|
463
|
-
node: r
|
|
464
|
-
});
|
|
465
|
-
case "jump":
|
|
466
|
-
return zs({
|
|
467
|
-
...e,
|
|
468
|
-
node: r
|
|
469
|
-
});
|
|
470
|
-
case "link":
|
|
471
|
-
return Js({
|
|
472
|
-
...e,
|
|
473
|
-
node: r
|
|
474
|
-
});
|
|
475
|
-
case "integration-application-submit":
|
|
476
|
-
return Hs({
|
|
477
|
-
...e,
|
|
478
|
-
node: r
|
|
479
|
-
});
|
|
480
|
-
case "add-submission":
|
|
481
|
-
return Ks({
|
|
482
|
-
...e,
|
|
483
|
-
node: r
|
|
484
|
-
});
|
|
485
|
-
case "integration-workflow-get":
|
|
486
|
-
throw Error("Workflow should be unreachable");
|
|
487
|
-
case "check-duplicate":
|
|
488
|
-
return Us({
|
|
489
|
-
...e,
|
|
490
|
-
node: r
|
|
491
|
-
});
|
|
492
|
-
case "feedback":
|
|
493
|
-
return qs({
|
|
494
|
-
...e,
|
|
495
|
-
node: r
|
|
496
|
-
});
|
|
497
|
-
default:
|
|
498
|
-
throw new Error(`Unknown node: ${JSON.stringify(r)}`);
|
|
499
|
-
}
|
|
500
|
-
}
|
|
501
|
-
async function qs({
|
|
502
|
-
next: e,
|
|
503
|
-
node: r
|
|
504
|
-
}) {
|
|
505
|
-
e(r.nextId);
|
|
506
|
-
}
|
|
507
|
-
async function Us({
|
|
508
|
-
next: e,
|
|
509
|
-
node: r,
|
|
510
|
-
talentBankClient: t,
|
|
511
|
-
submissions: s,
|
|
512
|
-
flow: n,
|
|
513
|
-
logger: i,
|
|
514
|
-
chat: a
|
|
515
|
-
}) {
|
|
516
|
-
var c;
|
|
517
|
-
let o = {
|
|
518
|
-
isDuplicate: !1
|
|
519
|
-
};
|
|
520
|
-
if (s && t) {
|
|
521
|
-
const h = r.data.scope === "job" ? (c = n.job) == null ? void 0 : c.id : void 0;
|
|
522
|
-
if (r.data.scope === "company" || h != null)
|
|
523
|
-
try {
|
|
524
|
-
o = await t.checkDuplicate({
|
|
525
|
-
email: os({
|
|
526
|
-
key: r.data.email,
|
|
527
|
-
submissions: s
|
|
528
|
-
}).toString(),
|
|
529
|
-
jobId: h,
|
|
530
|
-
scope: r.data.scope
|
|
531
|
-
});
|
|
532
|
-
} catch (v) {
|
|
533
|
-
i.error("[check-duplicate]", v);
|
|
534
|
-
}
|
|
535
|
-
}
|
|
536
|
-
a.setSubmission(r.data.key, {
|
|
537
|
-
type: "integration",
|
|
538
|
-
value: o
|
|
539
|
-
}), e(r.nextId);
|
|
540
|
-
}
|
|
541
|
-
async function zs({
|
|
542
|
-
next: e,
|
|
543
|
-
node: r
|
|
544
|
-
}) {
|
|
545
|
-
e(r.data.targetId);
|
|
546
|
-
}
|
|
547
|
-
async function Ks({
|
|
548
|
-
next: e,
|
|
549
|
-
node: r,
|
|
550
|
-
logger: t,
|
|
551
|
-
submissions: s,
|
|
552
|
-
context: n
|
|
553
|
-
}) {
|
|
554
|
-
if (!s) {
|
|
555
|
-
t.error("Submissions not found");
|
|
556
|
-
return;
|
|
557
|
-
}
|
|
558
|
-
s[r.data.key] = {
|
|
559
|
-
type: "string",
|
|
560
|
-
value: fe(r.data.value, {
|
|
561
|
-
submissions: s,
|
|
562
|
-
context: n
|
|
563
|
-
})
|
|
564
|
-
}, e(r.nextId);
|
|
565
|
-
}
|
|
566
|
-
const Ws = 5e3, Gs = (e, r, t) => {
|
|
567
|
-
const {
|
|
568
|
-
waitMs: s,
|
|
569
|
-
throttles: n
|
|
570
|
-
} = xs(r == null ? void 0 : r.throttles, t);
|
|
571
|
-
return {
|
|
572
|
-
key: e,
|
|
573
|
-
until: Date.now() + s,
|
|
574
|
-
...n !== void 0 && {
|
|
575
|
-
throttles: n
|
|
576
|
-
}
|
|
577
|
-
};
|
|
578
|
-
};
|
|
579
|
-
async function Hs({
|
|
580
|
-
chat: e,
|
|
581
|
-
next: r,
|
|
582
|
-
end: t,
|
|
583
|
-
node: s,
|
|
584
|
-
logger: n,
|
|
585
|
-
apiClient: i,
|
|
586
|
-
submissions: a,
|
|
587
|
-
analytics: o,
|
|
588
|
-
flow: c,
|
|
589
|
-
applicationRecovery: h,
|
|
590
|
-
setApplicationRecovery: v,
|
|
591
|
-
forceSubmitConfirmation: g,
|
|
592
|
-
persistWriteBarrier: p,
|
|
593
|
-
signal: m,
|
|
594
|
-
t: w
|
|
595
|
-
}) {
|
|
596
|
-
var y;
|
|
597
|
-
if ((y = c.data.startedWriteNodeIds) != null && y.includes(s.id) && (h == null ? void 0 : h.submitNodeId) !== s.id)
|
|
598
|
-
return await e.sendMessage({
|
|
599
|
-
type: "system",
|
|
600
|
-
variant: "warning",
|
|
601
|
-
text: w("submission_unknown")
|
|
602
|
-
}), t();
|
|
603
|
-
const F = c.job ? `${s.id}@${c.job.id_type}:${c.job.id}` : s.id;
|
|
604
|
-
let _ = 0;
|
|
605
|
-
const S = async (C) => {
|
|
606
|
-
var He, at, Je, it, De, Ze, Oe;
|
|
607
|
-
const A = ((He = c.data.submitCooldown) == null ? void 0 : He.key) === F ? c.data.submitCooldown : void 0;
|
|
608
|
-
A && (A.until = Math.min(A.until, Date.now() + (A.throttles ? us : cs)));
|
|
609
|
-
const E = A == null ? void 0 : A.until;
|
|
610
|
-
(C !== !0 || E !== void 0 && E > Date.now()) && await e.userInput({
|
|
611
|
-
type: "submit",
|
|
612
|
-
key: void 0,
|
|
613
|
-
config: {
|
|
614
|
-
label: s.data.submitLabel,
|
|
615
|
-
...E !== void 0 && {
|
|
616
|
-
availableAt: E
|
|
617
|
-
}
|
|
618
|
-
}
|
|
619
|
-
});
|
|
620
|
-
let R;
|
|
621
|
-
if (s.data.captcha) {
|
|
622
|
-
const T = e.captcha;
|
|
623
|
-
let Re = !0;
|
|
624
|
-
try {
|
|
625
|
-
R = await Ts(i, {
|
|
626
|
-
signal: m,
|
|
627
|
-
container: (T == null ? void 0 : T.container()) ?? null,
|
|
628
|
-
theme: T == null ? void 0 : T.theme,
|
|
629
|
-
// The line lands first, then the widget below it, so the instruction is never late.
|
|
630
|
-
onInteractive: () => {
|
|
631
|
-
e.sendMessage({
|
|
632
|
-
type: "text",
|
|
633
|
-
author: "bot",
|
|
634
|
-
text: w("captcha_check")
|
|
635
|
-
}).catch(() => {
|
|
636
|
-
}).then(() => {
|
|
637
|
-
Re && (T == null || T.reveal(!0));
|
|
638
|
-
});
|
|
639
|
-
}
|
|
640
|
-
});
|
|
641
|
-
} catch ($e) {
|
|
642
|
-
if (n.error("Captcha check failed", $e), m.aborted)
|
|
643
|
-
return;
|
|
644
|
-
} finally {
|
|
645
|
-
Re = !1, T == null || T.reveal(!1);
|
|
646
|
-
}
|
|
647
|
-
}
|
|
648
|
-
await e.sendMessage({
|
|
649
|
-
type: "loading",
|
|
650
|
-
text: w("submitting")
|
|
651
|
-
});
|
|
652
|
-
const {
|
|
653
|
-
anonymous_id: K,
|
|
654
|
-
session_id: D
|
|
655
|
-
} = o.getSessionInfo();
|
|
656
|
-
if (m.aborted)
|
|
657
|
-
return;
|
|
658
|
-
const q = ((at = c.data.startedWriteNodeIds) == null ? void 0 : at.includes(s.id)) === !0;
|
|
659
|
-
if ((h == null ? void 0 : h.submitNodeId) === s.id && await v(void 0), q || (c.data.startedWriteNodeIds = [...c.data.startedWriteNodeIds ?? [], s.id]), await p().catch((T) => n.error("Failed to persist application write barrier", T)), m.aborted)
|
|
660
|
-
return;
|
|
661
|
-
let O;
|
|
662
|
-
const J = setTimeout(() => {
|
|
663
|
-
O = (async () => {
|
|
664
|
-
await e.sendMessage({
|
|
665
|
-
type: "text",
|
|
666
|
-
author: "bot",
|
|
667
|
-
text: w("submission_still_working")
|
|
668
|
-
}), await e.sendMessage({
|
|
669
|
-
type: "loading",
|
|
670
|
-
text: w("submitting")
|
|
671
|
-
});
|
|
672
|
-
})().catch((T) => n.error("Failed to send submission progress message", T));
|
|
673
|
-
}, Ws);
|
|
674
|
-
let M;
|
|
675
|
-
const L = await i.fetch("/flow/submit", {
|
|
676
|
-
method: "POST",
|
|
677
|
-
body: JSON.stringify({
|
|
678
|
-
log_submit: !1,
|
|
679
|
-
integration_id: s.data.integrationId,
|
|
680
|
-
anonymous_id: K,
|
|
681
|
-
session_id: D,
|
|
682
|
-
job: c.job,
|
|
683
|
-
flow_build: c.build,
|
|
684
|
-
...R !== void 0 && {
|
|
685
|
-
captcha_token: R
|
|
686
|
-
},
|
|
687
|
-
submissions: ds(c.nodes, fs(a || {}, s.data.submitKeys)),
|
|
688
|
-
pre_apply: Cr(c.nodes, a || {}, c.data.flowSessionId)
|
|
689
|
-
})
|
|
690
|
-
}).catch((T) => (M = T, As(T) ? T.data : T));
|
|
691
|
-
if (clearTimeout(J), await O, m.aborted)
|
|
692
|
-
return;
|
|
693
|
-
s.data.key && e.setSubmission(s.data.key, {
|
|
694
|
-
type: "integration",
|
|
695
|
-
value: L
|
|
696
|
-
});
|
|
697
|
-
const N = _r(L, M instanceof Fs ? M.status : void 0), z = c.data.failedAttemptAt;
|
|
698
|
-
let Z = z == null ? void 0 : z[F];
|
|
699
|
-
z && Z !== void 0 && Z > Date.now() && (Z = z[F] = Date.now());
|
|
700
|
-
const X = Z !== void 0 && Date.now() - Z < hs || ((Je = c.data.unconfirmedAttemptKeys) == null ? void 0 : Je.includes(F)) === !0, oe = ps(L);
|
|
701
|
-
if (oe && o.log({
|
|
702
|
-
event: "FLOW_SUBMIT",
|
|
703
|
-
properties: {
|
|
704
|
-
flow_id: c.id,
|
|
705
|
-
flow_version: c.version,
|
|
706
|
-
flow_session_id: c.data.flowSessionId,
|
|
707
|
-
flow_build: c.build,
|
|
708
|
-
service: oe.service,
|
|
709
|
-
response: oe.response,
|
|
710
|
-
flow_type: "CHATBOT_DRAWER",
|
|
711
|
-
job: c.job,
|
|
712
|
-
// Measures how many duplicates follow the candidate's own recent failed attempt; set exactly when
|
|
713
|
-
// the earlier-attempt copy is shown.
|
|
714
|
-
...(N == null ? void 0 : N.outcome) === "duplicate" && {
|
|
715
|
-
outcome: X ? "duplicate_after_own_attempt" : "duplicate"
|
|
716
|
-
},
|
|
717
|
-
...oe.outcome && {
|
|
718
|
-
outcome: oe.outcome
|
|
719
|
-
}
|
|
720
|
-
}
|
|
721
|
-
}), (zt(L) || (L == null ? void 0 : L.success) === !0) && ((it = c.data.submitCooldown) == null ? void 0 : it.throttles) !== void 0 && (delete c.data.submitCooldown.throttles, await p().catch((T) => n.error("Failed to persist submit cooldown reset", T))), zt(L)) {
|
|
722
|
-
const {
|
|
723
|
-
redirect_url: T,
|
|
724
|
-
message: Re,
|
|
725
|
-
button_text: $e
|
|
726
|
-
} = L.integration_response.data;
|
|
727
|
-
await e.sendMessage({
|
|
728
|
-
type: "text",
|
|
729
|
-
author: "bot",
|
|
730
|
-
text: Re ?? w("submission_redirect_message")
|
|
731
|
-
});
|
|
732
|
-
try {
|
|
733
|
-
const we = new URL(T);
|
|
734
|
-
K && !we.searchParams.has("anonymous_id") && we.searchParams.set("anonymous_id", K), await e.sendMessage({
|
|
735
|
-
type: "link",
|
|
736
|
-
href: we.toString(),
|
|
737
|
-
text: $e ?? w("complete_submission"),
|
|
738
|
-
onClick: () => {
|
|
739
|
-
if (!D) {
|
|
740
|
-
n.error("session_id not set, cannot log FLOW_REDIRECT event");
|
|
741
|
-
return;
|
|
742
|
-
}
|
|
743
|
-
o.log({
|
|
744
|
-
event: "FLOW_REDIRECT",
|
|
745
|
-
properties: {
|
|
746
|
-
flow_build: c.build,
|
|
747
|
-
flow_id: c.id,
|
|
748
|
-
flow_session_id: D,
|
|
749
|
-
flow_version: c.version,
|
|
750
|
-
href: we.toString(),
|
|
751
|
-
job: c.job
|
|
752
|
-
}
|
|
753
|
-
});
|
|
754
|
-
}
|
|
755
|
-
});
|
|
756
|
-
} catch (we) {
|
|
757
|
-
n.error(`Invalid redirect URL: ${T}`, we), e.sendMessage({
|
|
758
|
-
type: "system",
|
|
759
|
-
variant: "error",
|
|
760
|
-
text: w("redirect_url_error")
|
|
761
|
-
});
|
|
762
|
-
}
|
|
763
|
-
return r(s.nextId);
|
|
764
|
-
}
|
|
765
|
-
const xe = ms(L);
|
|
766
|
-
if (xe)
|
|
767
|
-
return await e.sendMessage({
|
|
768
|
-
type: "system",
|
|
769
|
-
variant: "success",
|
|
770
|
-
text: xe.message ?? w("submission_pending")
|
|
771
|
-
}), r(s.nextId);
|
|
772
|
-
if ((L == null ? void 0 : L.success) === !0)
|
|
773
|
-
return s.data.skipConfirmation !== !0 && await e.sendMessage({
|
|
774
|
-
type: "system",
|
|
775
|
-
variant: "success",
|
|
776
|
-
text: w("submission_completed")
|
|
777
|
-
}), r(s.nextId);
|
|
778
|
-
const Le = ys(N), Ae = Le !== void 0 && ((De = a == null ? void 0 : a[Le]) == null ? void 0 : De.type) === "file" ? Le : void 0, Te = Ae === void 0 ? void 0 : c.nodes.find((T) => T.type === "question-file" && T.data.key === Ae);
|
|
779
|
-
return !Te && !Kt(N) && (c.data.submitCooldown = Gs(F, A, N)), (N == null ? void 0 : N.outcome) !== "duplicate" && (c.data.failedAttemptAt = {
|
|
780
|
-
...c.data.failedAttemptAt,
|
|
781
|
-
[F]: Date.now()
|
|
782
|
-
}, (Ze = c.data.unconfirmedAttemptKeys) != null && Ze.includes(F) && (c.data.unconfirmedAttemptKeys = c.data.unconfirmedAttemptKeys.filter((T) => T !== F))), (N == null ? void 0 : N.verdict) === "not_submitted" || (N == null ? void 0 : N.outcome) === "duplicate" || (N == null ? void 0 : N.outcome) === "closed" ? (q || (c.data.startedWriteNodeIds = (Oe = c.data.startedWriteNodeIds) == null ? void 0 : Oe.filter((T) => T !== s.id)), (h == null ? void 0 : h.submitNodeId) === s.id && await v(h), await p().catch((T) => n.error("Failed to persist application write barrier release", T))) : await p().catch((T) => n.error("Failed to persist submit cooldown", T)), N ? (n.error(M ?? N.message), Te && Ae !== void 0 ? (e.setSubmission(Ae, null), await v({
|
|
783
|
-
fileQuestionNodeId: Te.id,
|
|
784
|
-
submitNodeId: s.id
|
|
785
|
-
}), await e.sendMessage({
|
|
786
|
-
type: "system",
|
|
787
|
-
variant: "error",
|
|
788
|
-
text: w("submission_unreadable_document")
|
|
789
|
-
}), r(Te.id)) : N.outcome === "duplicate" ? (await e.sendMessage({
|
|
790
|
-
type: "system",
|
|
791
|
-
variant: "info",
|
|
792
|
-
text: w(X ? "submission_duplicate_earlier_attempt" : "submission_duplicate")
|
|
793
|
-
}), S(!1)) : N.outcome === "closed" ? (await e.sendMessage({
|
|
794
|
-
type: "system",
|
|
795
|
-
variant: "info",
|
|
796
|
-
text: w("submission_closed")
|
|
797
|
-
}), S(!1)) : N.outcome === "unknown" ? (await e.sendMessage({
|
|
798
|
-
type: "system",
|
|
799
|
-
variant: "warning",
|
|
800
|
-
text: w(gs(N) ? "submission_unknown_do_not_resubmit" : "submission_unknown")
|
|
801
|
-
}), S(!1)) : Kt(N) ? bs(L) ? (await e.sendMessage({
|
|
802
|
-
type: "text",
|
|
803
|
-
author: "bot",
|
|
804
|
-
text: N.message
|
|
805
|
-
}), S(!1)) : (_ === 0 && await e.sendMessage({
|
|
806
|
-
type: "system",
|
|
807
|
-
variant: "warning",
|
|
808
|
-
text: w("captcha_failed")
|
|
809
|
-
}), _++, S(_ <= Ps)) : vs(N) ? (await e.sendMessage({
|
|
810
|
-
type: "system",
|
|
811
|
-
variant: "error",
|
|
812
|
-
text: w("submission_retryable")
|
|
813
|
-
}), S(!1)) : (await e.sendMessage({
|
|
814
|
-
type: "system",
|
|
815
|
-
variant: "error",
|
|
816
|
-
text: w("submission_failed")
|
|
817
|
-
}), t())) : (n.error(M ?? L), await e.sendMessage({
|
|
818
|
-
type: "system",
|
|
819
|
-
variant: "error",
|
|
820
|
-
text: w("submission_failed")
|
|
821
|
-
}), t());
|
|
822
|
-
};
|
|
823
|
-
await S(g === !0 ? !1 : s.data.skipConfirmation);
|
|
824
|
-
}
|
|
825
|
-
async function Js({
|
|
826
|
-
chat: e,
|
|
827
|
-
next: r,
|
|
828
|
-
node: t,
|
|
829
|
-
submissions: s,
|
|
830
|
-
context: n
|
|
831
|
-
}) {
|
|
832
|
-
await e.sendMessage({
|
|
833
|
-
type: "link",
|
|
834
|
-
href: fe(t.data.href, {
|
|
835
|
-
submissions: s,
|
|
836
|
-
context: n
|
|
837
|
-
}),
|
|
838
|
-
text: fe(t.data.cta, {
|
|
839
|
-
submissions: s,
|
|
840
|
-
context: n
|
|
841
|
-
})
|
|
842
|
-
}), r(t.nextId);
|
|
843
|
-
}
|
|
844
|
-
async function Zs({
|
|
845
|
-
submissions: e,
|
|
846
|
-
next: r,
|
|
847
|
-
node: t,
|
|
848
|
-
context: s
|
|
849
|
-
}) {
|
|
850
|
-
r(Rs(t, {
|
|
851
|
-
submissions: e,
|
|
852
|
-
context: s
|
|
853
|
-
}) ? t.branchId : t.nextId);
|
|
854
|
-
}
|
|
855
|
-
async function Xs({
|
|
856
|
-
chat: e,
|
|
857
|
-
next: r,
|
|
858
|
-
node: t,
|
|
859
|
-
submissions: s,
|
|
860
|
-
context: n
|
|
861
|
-
}) {
|
|
862
|
-
await e.sendMessage({
|
|
863
|
-
author: "bot",
|
|
864
|
-
type: "text",
|
|
865
|
-
text: fe(t.data.text, {
|
|
866
|
-
submissions: s,
|
|
867
|
-
context: n
|
|
868
|
-
})
|
|
869
|
-
}), r(t.nextId);
|
|
870
|
-
}
|
|
871
|
-
async function Ys({
|
|
872
|
-
chat: e,
|
|
873
|
-
next: r,
|
|
874
|
-
node: t
|
|
875
|
-
}) {
|
|
876
|
-
await e.sendMessage({
|
|
877
|
-
author: "bot",
|
|
878
|
-
type: "image",
|
|
879
|
-
url: t.data.url,
|
|
880
|
-
height: t.data.height,
|
|
881
|
-
width: t.data.width
|
|
882
|
-
}), r(t.nextId);
|
|
883
|
-
}
|
|
884
|
-
async function Qs({
|
|
885
|
-
chat: e,
|
|
886
|
-
next: r,
|
|
887
|
-
node: t,
|
|
888
|
-
submissions: s,
|
|
889
|
-
context: n,
|
|
890
|
-
t: i
|
|
891
|
-
}) {
|
|
892
|
-
await e.sendMessage({
|
|
893
|
-
author: "bot",
|
|
894
|
-
type: "text",
|
|
895
|
-
text: fe(t.data.question, {
|
|
896
|
-
submissions: s,
|
|
897
|
-
context: n
|
|
898
|
-
})
|
|
899
|
-
});
|
|
900
|
-
const a = t.data.format === "phone" ? await e.userInput({
|
|
901
|
-
key: t.data.key,
|
|
902
|
-
type: "phone",
|
|
903
|
-
config: {
|
|
904
|
-
optional: t.data.optional,
|
|
905
|
-
placeholder: t.data.placeholder,
|
|
906
|
-
minChars: t.data.minChars,
|
|
907
|
-
maxChars: t.data.maxChars,
|
|
908
|
-
submissionFormat: "text",
|
|
909
|
-
defaultValue: {}
|
|
910
|
-
}
|
|
911
|
-
}) : await e.userInput({
|
|
912
|
-
key: t.data.key,
|
|
913
|
-
type: "text",
|
|
914
|
-
config: {
|
|
915
|
-
optional: t.data.optional,
|
|
916
|
-
placeholder: t.data.placeholder,
|
|
917
|
-
format: t.data.format,
|
|
918
|
-
maxChars: t.data.maxChars,
|
|
919
|
-
minChars: t.data.minChars,
|
|
920
|
-
multiline: t.data.format === "text" && t.data.multiline === !0
|
|
921
|
-
}
|
|
922
|
-
});
|
|
923
|
-
a === null ? await e.sendMessage({
|
|
924
|
-
type: "system",
|
|
925
|
-
variant: "info",
|
|
926
|
-
text: i("skipped")
|
|
927
|
-
}) : await e.sendMessage({
|
|
928
|
-
author: "user",
|
|
929
|
-
type: "text",
|
|
930
|
-
text: a.type === "phone" ? ct(a.value) : a.value
|
|
931
|
-
}), r(t.nextId);
|
|
932
|
-
}
|
|
933
|
-
async function en({
|
|
934
|
-
chat: e,
|
|
935
|
-
next: r,
|
|
936
|
-
node: t,
|
|
937
|
-
submissions: s,
|
|
938
|
-
context: n,
|
|
939
|
-
t: i
|
|
940
|
-
}) {
|
|
941
|
-
await e.sendMessage({
|
|
942
|
-
author: "bot",
|
|
943
|
-
type: "text",
|
|
944
|
-
text: fe(t.data.question, {
|
|
945
|
-
submissions: s,
|
|
946
|
-
context: n
|
|
947
|
-
})
|
|
948
|
-
});
|
|
949
|
-
const a = await e.userInput({
|
|
950
|
-
key: t.data.key,
|
|
951
|
-
type: "number",
|
|
952
|
-
config: {
|
|
953
|
-
max: t.data.max,
|
|
954
|
-
min: t.data.min,
|
|
955
|
-
optional: t.data.optional,
|
|
956
|
-
placeholder: t.data.placeholder,
|
|
957
|
-
decimalCases: t.data.decimalCases
|
|
958
|
-
}
|
|
959
|
-
});
|
|
960
|
-
a === null ? await e.sendMessage({
|
|
961
|
-
type: "system",
|
|
962
|
-
variant: "info",
|
|
963
|
-
text: i("skipped")
|
|
964
|
-
}) : await e.sendMessage({
|
|
965
|
-
author: "user",
|
|
966
|
-
type: "text",
|
|
967
|
-
text: a.value.toString()
|
|
968
|
-
}), r(t.nextId);
|
|
969
|
-
}
|
|
970
|
-
async function tn({
|
|
971
|
-
chat: e,
|
|
972
|
-
next: r,
|
|
973
|
-
node: t,
|
|
974
|
-
submissions: s,
|
|
975
|
-
context: n,
|
|
976
|
-
t: i
|
|
977
|
-
}) {
|
|
978
|
-
await e.sendMessage({
|
|
979
|
-
author: "bot",
|
|
980
|
-
type: "text",
|
|
981
|
-
text: fe(t.data.question, {
|
|
982
|
-
submissions: s,
|
|
983
|
-
context: n
|
|
984
|
-
})
|
|
985
|
-
});
|
|
986
|
-
const a = await e.userInput({
|
|
987
|
-
key: t.data.key,
|
|
988
|
-
type: "phone",
|
|
989
|
-
config: {
|
|
990
|
-
minChars: t.data.minChars,
|
|
991
|
-
defaultValue: {
|
|
992
|
-
countryCode: t.data.defaultCountryCode
|
|
993
|
-
},
|
|
994
|
-
placeholder: t.data.placeholder,
|
|
995
|
-
submissionFormat: "phone",
|
|
996
|
-
optional: t.data.optional
|
|
997
|
-
}
|
|
998
|
-
});
|
|
999
|
-
a === null ? await e.sendMessage({
|
|
1000
|
-
type: "system",
|
|
1001
|
-
variant: "info",
|
|
1002
|
-
text: i("skipped")
|
|
1003
|
-
}) : await e.sendMessage({
|
|
1004
|
-
author: "user",
|
|
1005
|
-
type: "text",
|
|
1006
|
-
text: a.type === "phone" ? ct(a.value) : a.value
|
|
1007
|
-
}), r(t.nextId);
|
|
1008
|
-
}
|
|
1009
|
-
async function rn({
|
|
1010
|
-
chat: e,
|
|
1011
|
-
next: r,
|
|
1012
|
-
node: t,
|
|
1013
|
-
submissions: s,
|
|
1014
|
-
context: n,
|
|
1015
|
-
t: i
|
|
1016
|
-
}) {
|
|
1017
|
-
await e.sendMessage({
|
|
1018
|
-
author: "bot",
|
|
1019
|
-
type: "text",
|
|
1020
|
-
text: fe(t.data.question, {
|
|
1021
|
-
submissions: s,
|
|
1022
|
-
context: n
|
|
1023
|
-
})
|
|
1024
|
-
});
|
|
1025
|
-
const a = await e.userInput({
|
|
1026
|
-
key: t.data.key,
|
|
1027
|
-
type: "multiple-choice",
|
|
1028
|
-
config: t.data
|
|
1029
|
-
});
|
|
1030
|
-
a.value.length === 0 ? await e.sendMessage({
|
|
1031
|
-
type: "system",
|
|
1032
|
-
variant: "info",
|
|
1033
|
-
text: i("skipped")
|
|
1034
|
-
}) : await e.sendMessage({
|
|
1035
|
-
author: "user",
|
|
1036
|
-
type: "text",
|
|
1037
|
-
text: t.data.options.filter((o) => a.value.includes(o.value)).map((o) => o.label).join(", ")
|
|
1038
|
-
}), r(t.nextId);
|
|
1039
|
-
}
|
|
1040
|
-
async function sn({
|
|
1041
|
-
chat: e,
|
|
1042
|
-
next: r,
|
|
1043
|
-
node: t,
|
|
1044
|
-
submissions: s,
|
|
1045
|
-
context: n,
|
|
1046
|
-
t: i
|
|
1047
|
-
}) {
|
|
1048
|
-
await e.sendMessage({
|
|
1049
|
-
author: "bot",
|
|
1050
|
-
type: "text",
|
|
1051
|
-
text: fe(t.data.question, {
|
|
1052
|
-
submissions: s,
|
|
1053
|
-
context: n
|
|
1054
|
-
})
|
|
1055
|
-
});
|
|
1056
|
-
const a = await e.userInput({
|
|
1057
|
-
key: t.data.key,
|
|
1058
|
-
type: "boolean",
|
|
1059
|
-
config: {
|
|
1060
|
-
optional: t.data.optional,
|
|
1061
|
-
labels: {
|
|
1062
|
-
true: t.data.trueLabel,
|
|
1063
|
-
false: t.data.falseLabel
|
|
1064
|
-
}
|
|
1065
|
-
}
|
|
1066
|
-
});
|
|
1067
|
-
a === null ? await e.sendMessage({
|
|
1068
|
-
type: "system",
|
|
1069
|
-
variant: "info",
|
|
1070
|
-
text: i("skipped")
|
|
1071
|
-
}) : await e.sendMessage({
|
|
1072
|
-
author: "user",
|
|
1073
|
-
type: "text",
|
|
1074
|
-
text: a.value === !0 ? t.data.trueLabel : t.data.falseLabel
|
|
1075
|
-
}), r(t.nextId);
|
|
1076
|
-
}
|
|
1077
|
-
async function nn({
|
|
1078
|
-
chat: e,
|
|
1079
|
-
next: r,
|
|
1080
|
-
node: t,
|
|
1081
|
-
t: s
|
|
1082
|
-
}) {
|
|
1083
|
-
await e.sendMessage({
|
|
1084
|
-
author: "bot",
|
|
1085
|
-
type: "text",
|
|
1086
|
-
text: t.data.question
|
|
1087
|
-
});
|
|
1088
|
-
const n = await e.userInput({
|
|
1089
|
-
type: "address",
|
|
1090
|
-
key: t.data.key,
|
|
1091
|
-
config: {
|
|
1092
|
-
optional: t.data.optional,
|
|
1093
|
-
keys: t.data.keys,
|
|
1094
|
-
line2Required: t.data.line2Required,
|
|
1095
|
-
placeholder: t.data.placeholder
|
|
1096
|
-
}
|
|
1097
|
-
});
|
|
1098
|
-
if (n === null)
|
|
1099
|
-
await e.sendMessage({
|
|
1100
|
-
type: "system",
|
|
1101
|
-
variant: "info",
|
|
1102
|
-
text: s("skipped")
|
|
1103
|
-
});
|
|
1104
|
-
else {
|
|
1105
|
-
const i = Object.values(n.value).filter((a) => a && a.trim().length > 0).join(", ");
|
|
1106
|
-
await e.sendMessage({
|
|
1107
|
-
author: "user",
|
|
1108
|
-
type: "text",
|
|
1109
|
-
text: i
|
|
1110
|
-
});
|
|
1111
|
-
}
|
|
1112
|
-
return r(t.nextId);
|
|
1113
|
-
}
|
|
1114
|
-
async function an({
|
|
1115
|
-
node: e,
|
|
1116
|
-
chat: r,
|
|
1117
|
-
next: t,
|
|
1118
|
-
submissions: s,
|
|
1119
|
-
context: n,
|
|
1120
|
-
t: i
|
|
1121
|
-
}) {
|
|
1122
|
-
await r.sendMessage({
|
|
1123
|
-
author: "bot",
|
|
1124
|
-
type: "text",
|
|
1125
|
-
text: fe(e.data.question, {
|
|
1126
|
-
submissions: s,
|
|
1127
|
-
context: n
|
|
1128
|
-
})
|
|
1129
|
-
});
|
|
1130
|
-
const a = await r.userInput({
|
|
1131
|
-
key: e.data.key,
|
|
1132
|
-
type: "file",
|
|
1133
|
-
config: {
|
|
1134
|
-
optional: e.data.optional,
|
|
1135
|
-
extensions: e.data.extensions,
|
|
1136
|
-
// default value for fileSizeLimitKib is 10MB
|
|
1137
|
-
fileSizeLimitKib: e.data.maxSizeKb ?? 10 * 1024,
|
|
1138
|
-
allowMultiple: e.data.multiple === !0
|
|
1139
|
-
}
|
|
1140
|
-
});
|
|
1141
|
-
if (a === null)
|
|
1142
|
-
await r.sendMessage({
|
|
1143
|
-
type: "system",
|
|
1144
|
-
variant: "info",
|
|
1145
|
-
text: i("skipped")
|
|
1146
|
-
});
|
|
1147
|
-
else
|
|
1148
|
-
for (const o of a.value)
|
|
1149
|
-
await r.sendMessage({
|
|
1150
|
-
author: "user",
|
|
1151
|
-
type: "file",
|
|
1152
|
-
fileName: o.name,
|
|
1153
|
-
fileSizeKb: o.sizeKb
|
|
1154
|
-
});
|
|
1155
|
-
return t(e.nextId);
|
|
1156
|
-
}
|
|
1157
|
-
async function on({
|
|
1158
|
-
chat: e,
|
|
1159
|
-
end: r,
|
|
1160
|
-
node: t
|
|
1161
|
-
}) {
|
|
1162
|
-
await e.sendMessage({
|
|
1163
|
-
type: "system",
|
|
1164
|
-
variant: "info",
|
|
1165
|
-
text: t.data.systemMessage
|
|
1166
|
-
}), r();
|
|
1167
|
-
}
|
|
1168
|
-
async function ln({
|
|
1169
|
-
node: e,
|
|
1170
|
-
flow: r,
|
|
1171
|
-
submissions: t,
|
|
1172
|
-
chat: s,
|
|
1173
|
-
next: n,
|
|
1174
|
-
apiClient: i,
|
|
1175
|
-
analytics: a
|
|
1176
|
-
}) {
|
|
1177
|
-
const o = ls(r.nodes, t || {}), {
|
|
1178
|
-
answers: c,
|
|
1179
|
-
...h
|
|
1180
|
-
} = o;
|
|
1181
|
-
s.setSubmission(e.data.key, {
|
|
1182
|
-
type: "integration",
|
|
1183
|
-
value: h
|
|
1184
|
-
});
|
|
1185
|
-
const v = new AbortController(), g = setTimeout(() => v.abort(), 5e3);
|
|
1186
|
-
if (i.fetch("/flow/pre-apply", {
|
|
1187
|
-
method: "POST",
|
|
1188
|
-
signal: v.signal,
|
|
1189
|
-
body: JSON.stringify({
|
|
1190
|
-
...a.getSessionInfo(),
|
|
1191
|
-
job: r.job,
|
|
1192
|
-
flow_build: r.build,
|
|
1193
|
-
pre_apply: Cr(r.nodes, t || {}, r.data.flowSessionId)
|
|
1194
|
-
})
|
|
1195
|
-
}).catch(() => {
|
|
1196
|
-
}).finally(() => clearTimeout(g)), o.status !== "skipped") {
|
|
1197
|
-
const m = [o.status === "unavailable" ? "We could not prepare your pre-apply summary. You can still continue to your application." : o.hasHardConcerns ? e.data.messages.hard : o.hasAdvisoryConcerns ? e.data.messages.advisory : e.data.messages.matched];
|
|
1198
|
-
for (const w of ["hard", "advisory"]) {
|
|
1199
|
-
const F = c.filter((_) => !_.matched && _.severity === w);
|
|
1200
|
-
F.length && m.push((w === "hard" ? "Role requirements" : "Other things to consider") + `
|
|
1201
|
-
` + F.map((_) => `• ${_.message}`).join(`
|
|
1202
|
-
`));
|
|
1203
|
-
}
|
|
1204
|
-
await s.sendMessage({
|
|
1205
|
-
type: "text",
|
|
1206
|
-
author: "bot",
|
|
1207
|
-
text: m.join(`
|
|
1208
|
-
|
|
1209
|
-
`)
|
|
1210
|
-
}), o.hasHardConcerns && e.data.alternativeLink && await s.sendMessage({
|
|
1211
|
-
type: "link",
|
|
1212
|
-
href: e.data.alternativeLink.href,
|
|
1213
|
-
text: e.data.alternativeLink.label
|
|
1214
|
-
}), await s.userInput({
|
|
1215
|
-
type: "submit",
|
|
1216
|
-
key: void 0,
|
|
1217
|
-
config: {
|
|
1218
|
-
label: e.data.continueLabel
|
|
1219
|
-
}
|
|
1220
|
-
});
|
|
1221
|
-
}
|
|
1222
|
-
return n(e.nextId);
|
|
1223
|
-
}
|
|
1224
|
-
const Me = ({
|
|
1225
|
-
class: e,
|
|
1226
|
-
...r
|
|
1227
|
-
}) => {
|
|
1228
|
-
const {
|
|
1229
|
-
t
|
|
1230
|
-
} = Q();
|
|
1231
|
-
return u("button", {
|
|
1232
|
-
class: Ke("bg-accent-9 active:bg-accent-10 pointer-coarse:touch-hitbox fr flex-shrink-0 rounded-full p-2 text-white transition-all disabled:cursor-not-allowed disabled:opacity-50", e),
|
|
1233
|
-
type: "submit",
|
|
1234
|
-
...r,
|
|
1235
|
-
children: u("svg", {
|
|
1236
|
-
class: "block",
|
|
1237
|
-
width: "16",
|
|
1238
|
-
height: "16",
|
|
1239
|
-
viewBox: "0 0 16 16",
|
|
1240
|
-
fill: "transparent",
|
|
1241
|
-
stroke: "currentColor",
|
|
1242
|
-
"stroke-linecap": "round",
|
|
1243
|
-
"stroke-width": "2",
|
|
1244
|
-
children: [u("title", {
|
|
1245
|
-
children: t("send")
|
|
1246
|
-
}), u("path", {
|
|
1247
|
-
d: "M3.5 7.5L8 3L12.5 7.5"
|
|
1248
|
-
}), u("path", {
|
|
1249
|
-
d: "M8 4V13"
|
|
1250
|
-
})]
|
|
1251
|
-
})
|
|
1252
|
-
});
|
|
1253
|
-
};
|
|
1254
|
-
var pe;
|
|
1255
|
-
// @__NO_SIDE_EFFECTS__
|
|
1256
|
-
function ft(e) {
|
|
1257
|
-
return {
|
|
1258
|
-
lang: (e == null ? void 0 : e.lang) ?? (pe == null ? void 0 : pe.lang),
|
|
1259
|
-
message: e == null ? void 0 : e.message,
|
|
1260
|
-
abortEarly: (e == null ? void 0 : e.abortEarly) ?? (pe == null ? void 0 : pe.abortEarly),
|
|
1261
|
-
abortPipeEarly: (e == null ? void 0 : e.abortPipeEarly) ?? (pe == null ? void 0 : pe.abortPipeEarly)
|
|
1262
|
-
};
|
|
1263
|
-
}
|
|
1264
|
-
var xt;
|
|
1265
|
-
// @__NO_SIDE_EFFECTS__
|
|
1266
|
-
function un(e) {
|
|
1267
|
-
return xt == null ? void 0 : xt.get(e);
|
|
1268
|
-
}
|
|
1269
|
-
var wt;
|
|
1270
|
-
// @__NO_SIDE_EFFECTS__
|
|
1271
|
-
function cn(e) {
|
|
1272
|
-
return wt == null ? void 0 : wt.get(e);
|
|
1273
|
-
}
|
|
1274
|
-
var _t;
|
|
1275
|
-
// @__NO_SIDE_EFFECTS__
|
|
1276
|
-
function dn(e, r) {
|
|
1277
|
-
var t;
|
|
1278
|
-
return (t = _t == null ? void 0 : _t.get(e)) == null ? void 0 : t.get(r);
|
|
1279
|
-
}
|
|
1280
|
-
// @__NO_SIDE_EFFECTS__
|
|
1281
|
-
function Ue(e) {
|
|
1282
|
-
var t, s;
|
|
1283
|
-
const r = typeof e;
|
|
1284
|
-
return r === "string" ? `"${e}"` : r === "number" || r === "bigint" || r === "boolean" ? `${e}` : r === "object" || r === "function" ? (e && ((s = (t = Object.getPrototypeOf(e)) == null ? void 0 : t.constructor) == null ? void 0 : s.name)) ?? "null" : r;
|
|
1285
|
-
}
|
|
1286
|
-
function Y(e, r, t, s, n) {
|
|
1287
|
-
const i = n && "input" in n ? n.input : t.value, a = (n == null ? void 0 : n.expected) ?? e.expects ?? null, o = (n == null ? void 0 : n.received) ?? /* @__PURE__ */ Ue(i), c = {
|
|
1288
|
-
kind: e.kind,
|
|
1289
|
-
type: e.type,
|
|
1290
|
-
input: i,
|
|
1291
|
-
expected: a,
|
|
1292
|
-
received: o,
|
|
1293
|
-
message: `Invalid ${r}: ${a ? `Expected ${a} but r` : "R"}eceived ${o}`,
|
|
1294
|
-
requirement: e.requirement,
|
|
1295
|
-
path: n == null ? void 0 : n.path,
|
|
1296
|
-
issues: n == null ? void 0 : n.issues,
|
|
1297
|
-
lang: s.lang,
|
|
1298
|
-
abortEarly: s.abortEarly,
|
|
1299
|
-
abortPipeEarly: s.abortPipeEarly
|
|
1300
|
-
}, h = e.kind === "schema", v = (n == null ? void 0 : n.message) ?? e.message ?? /* @__PURE__ */ dn(e.reference, c.lang) ?? (h ? /* @__PURE__ */ cn(c.lang) : null) ?? s.message ?? /* @__PURE__ */ un(c.lang);
|
|
1301
|
-
v !== void 0 && (c.message = typeof v == "function" ? (
|
|
1302
|
-
// @ts-expect-error
|
|
1303
|
-
v(c)
|
|
1304
|
-
) : v), h && (t.typed = !1), t.issues ? t.issues.push(c) : t.issues = [c];
|
|
1305
|
-
}
|
|
1306
|
-
// @__NO_SIDE_EFFECTS__
|
|
1307
|
-
function he(e) {
|
|
1308
|
-
return {
|
|
1309
|
-
version: 1,
|
|
1310
|
-
vendor: "valibot",
|
|
1311
|
-
validate(r) {
|
|
1312
|
-
return e["~run"]({ value: r }, /* @__PURE__ */ ft());
|
|
1313
|
-
}
|
|
1314
|
-
};
|
|
1315
|
-
}
|
|
1316
|
-
// @__NO_SIDE_EFFECTS__
|
|
1317
|
-
function fn(e, r) {
|
|
1318
|
-
return Object.hasOwn(e, r) && r !== "__proto__" && r !== "prototype" && r !== "constructor";
|
|
1319
|
-
}
|
|
1320
|
-
// @__NO_SIDE_EFFECTS__
|
|
1321
|
-
function hn(e, r) {
|
|
1322
|
-
const t = [...new Set(e)];
|
|
1323
|
-
return t.length > 1 ? `(${t.join(` ${r} `)})` : t[0] ?? "never";
|
|
1324
|
-
}
|
|
1325
|
-
// @__NO_SIDE_EFFECTS__
|
|
1326
|
-
function pn(e) {
|
|
1327
|
-
if (e.path) {
|
|
1328
|
-
let r = "";
|
|
1329
|
-
for (const t of e.path)
|
|
1330
|
-
if (typeof t.key == "string" || typeof t.key == "number")
|
|
1331
|
-
r ? r += `.${t.key}` : r += t.key;
|
|
1332
|
-
else
|
|
1333
|
-
return null;
|
|
1334
|
-
return r;
|
|
1335
|
-
}
|
|
1336
|
-
return null;
|
|
1337
|
-
}
|
|
1338
|
-
var mn = class extends Error {
|
|
1339
|
-
/**
|
|
1340
|
-
* Creates a Valibot error with useful information.
|
|
1341
|
-
*
|
|
1342
|
-
* @param issues The error issues.
|
|
1343
|
-
*/
|
|
1344
|
-
constructor(e) {
|
|
1345
|
-
super(e[0].message), this.name = "ValiError", this.issues = e;
|
|
1346
|
-
}
|
|
1347
|
-
}, yn = /^[\w+-]+(?:\.[\w+-]+)*@[\da-z]+(?:[.-][\da-z]+)*\.[a-z]{2,}$/iu;
|
|
1348
|
-
// @__NO_SIDE_EFFECTS__
|
|
1349
|
-
function Mr(e, r) {
|
|
1350
|
-
return {
|
|
1351
|
-
kind: "validation",
|
|
1352
|
-
type: "check",
|
|
1353
|
-
reference: Mr,
|
|
1354
|
-
async: !1,
|
|
1355
|
-
expects: null,
|
|
1356
|
-
requirement: e,
|
|
1357
|
-
message: r,
|
|
1358
|
-
"~run"(t, s) {
|
|
1359
|
-
return t.typed && !this.requirement(t.value) && Y(this, "input", t, s), t;
|
|
1360
|
-
}
|
|
1361
|
-
};
|
|
1362
|
-
}
|
|
1363
|
-
// @__NO_SIDE_EFFECTS__
|
|
1364
|
-
function Nr(e) {
|
|
1365
|
-
return {
|
|
1366
|
-
kind: "validation",
|
|
1367
|
-
type: "email",
|
|
1368
|
-
reference: Nr,
|
|
1369
|
-
expects: null,
|
|
1370
|
-
async: !1,
|
|
1371
|
-
requirement: yn,
|
|
1372
|
-
message: e,
|
|
1373
|
-
"~run"(r, t) {
|
|
1374
|
-
return r.typed && !this.requirement.test(r.value) && Y(this, "email", r, t), r;
|
|
1375
|
-
}
|
|
1376
|
-
};
|
|
1377
|
-
}
|
|
1378
|
-
// @__NO_SIDE_EFFECTS__
|
|
1379
|
-
function et(e, r) {
|
|
1380
|
-
return {
|
|
1381
|
-
kind: "validation",
|
|
1382
|
-
type: "max_length",
|
|
1383
|
-
reference: et,
|
|
1384
|
-
async: !1,
|
|
1385
|
-
expects: `<=${e}`,
|
|
1386
|
-
requirement: e,
|
|
1387
|
-
message: r,
|
|
1388
|
-
"~run"(t, s) {
|
|
1389
|
-
return t.typed && t.value.length > this.requirement && Y(this, "length", t, s, {
|
|
1390
|
-
received: `${t.value.length}`
|
|
1391
|
-
}), t;
|
|
1392
|
-
}
|
|
1393
|
-
};
|
|
1394
|
-
}
|
|
1395
|
-
// @__NO_SIDE_EFFECTS__
|
|
1396
|
-
function Lr(e, r) {
|
|
1397
|
-
return {
|
|
1398
|
-
kind: "validation",
|
|
1399
|
-
type: "max_value",
|
|
1400
|
-
reference: Lr,
|
|
1401
|
-
async: !1,
|
|
1402
|
-
expects: `<=${e instanceof Date ? e.toJSON() : /* @__PURE__ */ Ue(e)}`,
|
|
1403
|
-
requirement: e,
|
|
1404
|
-
message: r,
|
|
1405
|
-
"~run"(t, s) {
|
|
1406
|
-
return t.typed && !(t.value <= this.requirement) && Y(this, "value", t, s, {
|
|
1407
|
-
received: t.value instanceof Date ? t.value.toJSON() : /* @__PURE__ */ Ue(t.value)
|
|
1408
|
-
}), t;
|
|
1409
|
-
}
|
|
1410
|
-
};
|
|
1411
|
-
}
|
|
1412
|
-
// @__NO_SIDE_EFFECTS__
|
|
1413
|
-
function qe(e, r) {
|
|
1414
|
-
return {
|
|
1415
|
-
kind: "validation",
|
|
1416
|
-
type: "min_length",
|
|
1417
|
-
reference: qe,
|
|
1418
|
-
async: !1,
|
|
1419
|
-
expects: `>=${e}`,
|
|
1420
|
-
requirement: e,
|
|
1421
|
-
message: r,
|
|
1422
|
-
"~run"(t, s) {
|
|
1423
|
-
return t.typed && t.value.length < this.requirement && Y(this, "length", t, s, {
|
|
1424
|
-
received: `${t.value.length}`
|
|
1425
|
-
}), t;
|
|
1426
|
-
}
|
|
1427
|
-
};
|
|
1428
|
-
}
|
|
1429
|
-
// @__NO_SIDE_EFFECTS__
|
|
1430
|
-
function Tr(e, r) {
|
|
1431
|
-
return {
|
|
1432
|
-
kind: "validation",
|
|
1433
|
-
type: "min_value",
|
|
1434
|
-
reference: Tr,
|
|
1435
|
-
async: !1,
|
|
1436
|
-
expects: `>=${e instanceof Date ? e.toJSON() : /* @__PURE__ */ Ue(e)}`,
|
|
1437
|
-
requirement: e,
|
|
1438
|
-
message: r,
|
|
1439
|
-
"~run"(t, s) {
|
|
1440
|
-
return t.typed && !(t.value >= this.requirement) && Y(this, "value", t, s, {
|
|
1441
|
-
received: t.value instanceof Date ? t.value.toJSON() : /* @__PURE__ */ Ue(t.value)
|
|
1442
|
-
}), t;
|
|
1443
|
-
}
|
|
1444
|
-
};
|
|
1445
|
-
}
|
|
1446
|
-
// @__NO_SIDE_EFFECTS__
|
|
1447
|
-
function Et(e, r) {
|
|
1448
|
-
return {
|
|
1449
|
-
kind: "validation",
|
|
1450
|
-
type: "regex",
|
|
1451
|
-
reference: Et,
|
|
1452
|
-
async: !1,
|
|
1453
|
-
expects: `${e}`,
|
|
1454
|
-
requirement: e,
|
|
1455
|
-
message: r,
|
|
1456
|
-
"~run"(t, s) {
|
|
1457
|
-
return t.typed && !this.requirement.test(t.value) && Y(this, "format", t, s), t;
|
|
1458
|
-
}
|
|
1459
|
-
};
|
|
1460
|
-
}
|
|
1461
|
-
// @__NO_SIDE_EFFECTS__
|
|
1462
|
-
function Mt(e) {
|
|
1463
|
-
return {
|
|
1464
|
-
kind: "transformation",
|
|
1465
|
-
type: "transform",
|
|
1466
|
-
reference: Mt,
|
|
1467
|
-
async: !1,
|
|
1468
|
-
operation: e,
|
|
1469
|
-
"~run"(r) {
|
|
1470
|
-
return r.value = this.operation(r.value), r;
|
|
1471
|
-
}
|
|
1472
|
-
};
|
|
1473
|
-
}
|
|
1474
|
-
// @__NO_SIDE_EFFECTS__
|
|
1475
|
-
function Dr(e) {
|
|
1476
|
-
return {
|
|
1477
|
-
kind: "validation",
|
|
1478
|
-
type: "url",
|
|
1479
|
-
reference: Dr,
|
|
1480
|
-
async: !1,
|
|
1481
|
-
expects: null,
|
|
1482
|
-
requirement(r) {
|
|
1483
|
-
try {
|
|
1484
|
-
return new URL(r), !0;
|
|
1485
|
-
} catch {
|
|
1486
|
-
return !1;
|
|
1487
|
-
}
|
|
1488
|
-
},
|
|
1489
|
-
message: e,
|
|
1490
|
-
"~run"(r, t) {
|
|
1491
|
-
return r.typed && !this.requirement(r.value) && Y(this, "URL", r, t), r;
|
|
1492
|
-
}
|
|
1493
|
-
};
|
|
1494
|
-
}
|
|
1495
|
-
// @__NO_SIDE_EFFECTS__
|
|
1496
|
-
function gn(e, r, t) {
|
|
1497
|
-
return typeof e.fallback == "function" ? (
|
|
1498
|
-
// @ts-expect-error
|
|
1499
|
-
e.fallback(r, t)
|
|
1500
|
-
) : (
|
|
1501
|
-
// @ts-expect-error
|
|
1502
|
-
e.fallback
|
|
1503
|
-
);
|
|
1504
|
-
}
|
|
1505
|
-
// @__NO_SIDE_EFFECTS__
|
|
1506
|
-
function Or(e, r, t) {
|
|
1507
|
-
return typeof e.default == "function" ? (
|
|
1508
|
-
// @ts-expect-error
|
|
1509
|
-
e.default(r, t)
|
|
1510
|
-
) : (
|
|
1511
|
-
// @ts-expect-error
|
|
1512
|
-
e.default
|
|
1513
|
-
);
|
|
1514
|
-
}
|
|
1515
|
-
// @__NO_SIDE_EFFECTS__
|
|
1516
|
-
function Rr(e, r) {
|
|
1517
|
-
return {
|
|
1518
|
-
kind: "schema",
|
|
1519
|
-
type: "array",
|
|
1520
|
-
reference: Rr,
|
|
1521
|
-
expects: "Array",
|
|
1522
|
-
async: !1,
|
|
1523
|
-
item: e,
|
|
1524
|
-
message: r,
|
|
1525
|
-
get "~standard"() {
|
|
1526
|
-
return /* @__PURE__ */ he(this);
|
|
1527
|
-
},
|
|
1528
|
-
"~run"(t, s) {
|
|
1529
|
-
var i;
|
|
1530
|
-
const n = t.value;
|
|
1531
|
-
if (Array.isArray(n)) {
|
|
1532
|
-
t.typed = !0, t.value = [];
|
|
1533
|
-
for (let a = 0; a < n.length; a++) {
|
|
1534
|
-
const o = n[a], c = this.item["~run"]({ value: o }, s);
|
|
1535
|
-
if (c.issues) {
|
|
1536
|
-
const h = {
|
|
1537
|
-
type: "array",
|
|
1538
|
-
origin: "value",
|
|
1539
|
-
input: n,
|
|
1540
|
-
key: a,
|
|
1541
|
-
value: o
|
|
1542
|
-
};
|
|
1543
|
-
for (const v of c.issues)
|
|
1544
|
-
v.path ? v.path.unshift(h) : v.path = [h], (i = t.issues) == null || i.push(v);
|
|
1545
|
-
if (t.issues || (t.issues = c.issues), s.abortEarly) {
|
|
1546
|
-
t.typed = !1;
|
|
1547
|
-
break;
|
|
1548
|
-
}
|
|
1549
|
-
}
|
|
1550
|
-
c.typed || (t.typed = !1), t.value.push(c.value);
|
|
1551
|
-
}
|
|
1552
|
-
} else
|
|
1553
|
-
Y(this, "type", t, s);
|
|
1554
|
-
return t;
|
|
1555
|
-
}
|
|
1556
|
-
};
|
|
1557
|
-
}
|
|
1558
|
-
// @__NO_SIDE_EFFECTS__
|
|
1559
|
-
function $r(e) {
|
|
1560
|
-
return {
|
|
1561
|
-
kind: "schema",
|
|
1562
|
-
type: "boolean",
|
|
1563
|
-
reference: $r,
|
|
1564
|
-
expects: "boolean",
|
|
1565
|
-
async: !1,
|
|
1566
|
-
message: e,
|
|
1567
|
-
get "~standard"() {
|
|
1568
|
-
return /* @__PURE__ */ he(this);
|
|
1569
|
-
},
|
|
1570
|
-
"~run"(r, t) {
|
|
1571
|
-
return typeof r.value == "boolean" ? r.typed = !0 : Y(this, "type", r, t), r;
|
|
1572
|
-
}
|
|
1573
|
-
};
|
|
1574
|
-
}
|
|
1575
|
-
// @__NO_SIDE_EFFECTS__
|
|
1576
|
-
function Pr(e) {
|
|
1577
|
-
return {
|
|
1578
|
-
kind: "schema",
|
|
1579
|
-
type: "number",
|
|
1580
|
-
reference: Pr,
|
|
1581
|
-
expects: "number",
|
|
1582
|
-
async: !1,
|
|
1583
|
-
message: e,
|
|
1584
|
-
get "~standard"() {
|
|
1585
|
-
return /* @__PURE__ */ he(this);
|
|
1586
|
-
},
|
|
1587
|
-
"~run"(r, t) {
|
|
1588
|
-
return typeof r.value == "number" && !isNaN(r.value) ? r.typed = !0 : Y(this, "type", r, t), r;
|
|
1589
|
-
}
|
|
1590
|
-
};
|
|
1591
|
-
}
|
|
1592
|
-
// @__NO_SIDE_EFFECTS__
|
|
1593
|
-
function be(e, r) {
|
|
1594
|
-
return {
|
|
1595
|
-
kind: "schema",
|
|
1596
|
-
type: "object",
|
|
1597
|
-
reference: be,
|
|
1598
|
-
expects: "Object",
|
|
1599
|
-
async: !1,
|
|
1600
|
-
entries: e,
|
|
1601
|
-
message: r,
|
|
1602
|
-
get "~standard"() {
|
|
1603
|
-
return /* @__PURE__ */ he(this);
|
|
1604
|
-
},
|
|
1605
|
-
"~run"(t, s) {
|
|
1606
|
-
var i;
|
|
1607
|
-
const n = t.value;
|
|
1608
|
-
if (n && typeof n == "object") {
|
|
1609
|
-
t.typed = !0, t.value = {};
|
|
1610
|
-
for (const a in this.entries) {
|
|
1611
|
-
const o = this.entries[a];
|
|
1612
|
-
if (a in n || (o.type === "exact_optional" || o.type === "optional" || o.type === "nullish") && // @ts-expect-error
|
|
1613
|
-
o.default !== void 0) {
|
|
1614
|
-
const c = a in n ? (
|
|
1615
|
-
// @ts-expect-error
|
|
1616
|
-
n[a]
|
|
1617
|
-
) : /* @__PURE__ */ Or(o), h = o["~run"]({ value: c }, s);
|
|
1618
|
-
if (h.issues) {
|
|
1619
|
-
const v = {
|
|
1620
|
-
type: "object",
|
|
1621
|
-
origin: "value",
|
|
1622
|
-
input: n,
|
|
1623
|
-
key: a,
|
|
1624
|
-
value: c
|
|
1625
|
-
};
|
|
1626
|
-
for (const g of h.issues)
|
|
1627
|
-
g.path ? g.path.unshift(v) : g.path = [v], (i = t.issues) == null || i.push(g);
|
|
1628
|
-
if (t.issues || (t.issues = h.issues), s.abortEarly) {
|
|
1629
|
-
t.typed = !1;
|
|
1630
|
-
break;
|
|
1631
|
-
}
|
|
1632
|
-
}
|
|
1633
|
-
h.typed || (t.typed = !1), t.value[a] = h.value;
|
|
1634
|
-
} else if (o.fallback !== void 0)
|
|
1635
|
-
t.value[a] = /* @__PURE__ */ gn(o);
|
|
1636
|
-
else if (o.type !== "exact_optional" && o.type !== "optional" && o.type !== "nullish" && (Y(this, "key", t, s, {
|
|
1637
|
-
input: void 0,
|
|
1638
|
-
expected: `"${a}"`,
|
|
1639
|
-
path: [
|
|
1640
|
-
{
|
|
1641
|
-
type: "object",
|
|
1642
|
-
origin: "key",
|
|
1643
|
-
input: n,
|
|
1644
|
-
key: a,
|
|
1645
|
-
// @ts-expect-error
|
|
1646
|
-
value: n[a]
|
|
1647
|
-
}
|
|
1648
|
-
]
|
|
1649
|
-
}), s.abortEarly))
|
|
1650
|
-
break;
|
|
1651
|
-
}
|
|
1652
|
-
} else
|
|
1653
|
-
Y(this, "type", t, s);
|
|
1654
|
-
return t;
|
|
1655
|
-
}
|
|
1656
|
-
};
|
|
1657
|
-
}
|
|
1658
|
-
// @__NO_SIDE_EFFECTS__
|
|
1659
|
-
function tt(e, r) {
|
|
1660
|
-
return {
|
|
1661
|
-
kind: "schema",
|
|
1662
|
-
type: "optional",
|
|
1663
|
-
reference: tt,
|
|
1664
|
-
expects: `(${e.expects} | undefined)`,
|
|
1665
|
-
async: !1,
|
|
1666
|
-
wrapped: e,
|
|
1667
|
-
default: r,
|
|
1668
|
-
get "~standard"() {
|
|
1669
|
-
return /* @__PURE__ */ he(this);
|
|
1670
|
-
},
|
|
1671
|
-
"~run"(t, s) {
|
|
1672
|
-
return t.value === void 0 && (this.default !== void 0 && (t.value = /* @__PURE__ */ Or(this, t, s)), t.value === void 0) ? (t.typed = !0, t) : this.wrapped["~run"](t, s);
|
|
1673
|
-
}
|
|
1674
|
-
};
|
|
1675
|
-
}
|
|
1676
|
-
// @__NO_SIDE_EFFECTS__
|
|
1677
|
-
function jr(e, r) {
|
|
1678
|
-
return {
|
|
1679
|
-
kind: "schema",
|
|
1680
|
-
type: "picklist",
|
|
1681
|
-
reference: jr,
|
|
1682
|
-
expects: /* @__PURE__ */ hn(e.map(Ue), "|"),
|
|
1683
|
-
async: !1,
|
|
1684
|
-
options: e,
|
|
1685
|
-
message: r,
|
|
1686
|
-
get "~standard"() {
|
|
1687
|
-
return /* @__PURE__ */ he(this);
|
|
1688
|
-
},
|
|
1689
|
-
"~run"(t, s) {
|
|
1690
|
-
return this.options.includes(t.value) ? t.typed = !0 : Y(this, "type", t, s), t;
|
|
1691
|
-
}
|
|
1692
|
-
};
|
|
1693
|
-
}
|
|
1694
|
-
// @__NO_SIDE_EFFECTS__
|
|
1695
|
-
function Br(e, r, t) {
|
|
1696
|
-
return {
|
|
1697
|
-
kind: "schema",
|
|
1698
|
-
type: "record",
|
|
1699
|
-
reference: Br,
|
|
1700
|
-
expects: "Object",
|
|
1701
|
-
async: !1,
|
|
1702
|
-
key: e,
|
|
1703
|
-
value: r,
|
|
1704
|
-
message: t,
|
|
1705
|
-
get "~standard"() {
|
|
1706
|
-
return /* @__PURE__ */ he(this);
|
|
1707
|
-
},
|
|
1708
|
-
"~run"(s, n) {
|
|
1709
|
-
var a, o;
|
|
1710
|
-
const i = s.value;
|
|
1711
|
-
if (i && typeof i == "object") {
|
|
1712
|
-
s.typed = !0, s.value = {};
|
|
1713
|
-
for (const c in i)
|
|
1714
|
-
if (/* @__PURE__ */ fn(i, c)) {
|
|
1715
|
-
const h = i[c], v = this.key["~run"]({ value: c }, n);
|
|
1716
|
-
if (v.issues) {
|
|
1717
|
-
const p = {
|
|
1718
|
-
type: "object",
|
|
1719
|
-
origin: "key",
|
|
1720
|
-
input: i,
|
|
1721
|
-
key: c,
|
|
1722
|
-
value: h
|
|
1723
|
-
};
|
|
1724
|
-
for (const m of v.issues)
|
|
1725
|
-
m.path = [p], (a = s.issues) == null || a.push(m);
|
|
1726
|
-
if (s.issues || (s.issues = v.issues), n.abortEarly) {
|
|
1727
|
-
s.typed = !1;
|
|
1728
|
-
break;
|
|
1729
|
-
}
|
|
1730
|
-
}
|
|
1731
|
-
const g = this.value["~run"](
|
|
1732
|
-
{ value: h },
|
|
1733
|
-
n
|
|
1734
|
-
);
|
|
1735
|
-
if (g.issues) {
|
|
1736
|
-
const p = {
|
|
1737
|
-
type: "object",
|
|
1738
|
-
origin: "value",
|
|
1739
|
-
input: i,
|
|
1740
|
-
key: c,
|
|
1741
|
-
value: h
|
|
1742
|
-
};
|
|
1743
|
-
for (const m of g.issues)
|
|
1744
|
-
m.path ? m.path.unshift(p) : m.path = [p], (o = s.issues) == null || o.push(m);
|
|
1745
|
-
if (s.issues || (s.issues = g.issues), n.abortEarly) {
|
|
1746
|
-
s.typed = !1;
|
|
1747
|
-
break;
|
|
1748
|
-
}
|
|
1749
|
-
}
|
|
1750
|
-
(!v.typed || !g.typed) && (s.typed = !1), v.typed && (s.value[v.value] = g.value);
|
|
1751
|
-
}
|
|
1752
|
-
} else
|
|
1753
|
-
Y(this, "type", s, n);
|
|
1754
|
-
return s;
|
|
1755
|
-
}
|
|
1756
|
-
};
|
|
1757
|
-
}
|
|
1758
|
-
// @__NO_SIDE_EFFECTS__
|
|
1759
|
-
function ie(e) {
|
|
1760
|
-
return {
|
|
1761
|
-
kind: "schema",
|
|
1762
|
-
type: "string",
|
|
1763
|
-
reference: ie,
|
|
1764
|
-
expects: "string",
|
|
1765
|
-
async: !1,
|
|
1766
|
-
message: e,
|
|
1767
|
-
get "~standard"() {
|
|
1768
|
-
return /* @__PURE__ */ he(this);
|
|
1769
|
-
},
|
|
1770
|
-
"~run"(r, t) {
|
|
1771
|
-
return typeof r.value == "string" ? r.typed = !0 : Y(this, "type", r, t), r;
|
|
1772
|
-
}
|
|
1773
|
-
};
|
|
1774
|
-
}
|
|
1775
|
-
function bn(e, r, t) {
|
|
1776
|
-
const s = e["~run"]({ value: r }, /* @__PURE__ */ ft(t));
|
|
1777
|
-
if (s.issues)
|
|
1778
|
-
throw new mn(s.issues);
|
|
1779
|
-
return s.value;
|
|
1780
|
-
}
|
|
1781
|
-
// @__NO_SIDE_EFFECTS__
|
|
1782
|
-
function vn(e, r) {
|
|
1783
|
-
const t = {};
|
|
1784
|
-
for (const s in e.entries)
|
|
1785
|
-
t[s] = !r || r.includes(s) ? /* @__PURE__ */ tt(e.entries[s]) : e.entries[s];
|
|
1786
|
-
return {
|
|
1787
|
-
...e,
|
|
1788
|
-
entries: t,
|
|
1789
|
-
get "~standard"() {
|
|
1790
|
-
return /* @__PURE__ */ he(this);
|
|
1791
|
-
}
|
|
1792
|
-
};
|
|
1793
|
-
}
|
|
1794
|
-
// @__NO_SIDE_EFFECTS__
|
|
1795
|
-
function Ce(...e) {
|
|
1796
|
-
return {
|
|
1797
|
-
...e[0],
|
|
1798
|
-
pipe: e,
|
|
1799
|
-
get "~standard"() {
|
|
1800
|
-
return /* @__PURE__ */ he(this);
|
|
1801
|
-
},
|
|
1802
|
-
"~run"(r, t) {
|
|
1803
|
-
for (const s of e)
|
|
1804
|
-
if (s.kind !== "metadata") {
|
|
1805
|
-
if (r.issues && (s.kind === "schema" || s.kind === "transformation")) {
|
|
1806
|
-
r.typed = !1;
|
|
1807
|
-
break;
|
|
1808
|
-
}
|
|
1809
|
-
(!r.issues || !t.abortEarly && !t.abortPipeEarly) && (r = s["~run"](r, t));
|
|
1810
|
-
}
|
|
1811
|
-
return r;
|
|
1812
|
-
}
|
|
1813
|
-
};
|
|
1814
|
-
}
|
|
1815
|
-
// @__NO_SIDE_EFFECTS__
|
|
1816
|
-
function xn(e, r, t) {
|
|
1817
|
-
const s = e["~run"]({ value: r }, /* @__PURE__ */ ft(t));
|
|
1818
|
-
return {
|
|
1819
|
-
typed: s.typed,
|
|
1820
|
-
success: !s.issues,
|
|
1821
|
-
output: s.value,
|
|
1822
|
-
issues: s.issues
|
|
1823
|
-
};
|
|
1824
|
-
}
|
|
1825
|
-
// @__NO_SIDE_EFFECTS__
|
|
1826
|
-
async function wn(e, r, t) {
|
|
1827
|
-
const s = await e["~run"](
|
|
1828
|
-
{ value: r },
|
|
1829
|
-
/* @__PURE__ */ ft(t)
|
|
1830
|
-
);
|
|
1831
|
-
return {
|
|
1832
|
-
typed: s.typed,
|
|
1833
|
-
success: !s.issues,
|
|
1834
|
-
output: s.value,
|
|
1835
|
-
issues: s.issues
|
|
1836
|
-
};
|
|
1837
|
-
}
|
|
1838
|
-
const Ge = ({
|
|
1839
|
-
error: e
|
|
1840
|
-
}) => !e || !e.message ? null : u("div", {
|
|
1841
|
-
role: "alert",
|
|
1842
|
-
class: "text-error-11 flex max-w-full items-start gap-1 overflow-hidden rounded-2xl px-2 py-2",
|
|
1843
|
-
children: [u("svg", {
|
|
1844
|
-
class: "text-error-9 mt-0.5 h-4 w-4 shrink-0",
|
|
1845
|
-
viewBox: "0 0 16 16",
|
|
1846
|
-
fill: "none",
|
|
1847
|
-
xmlns: "http://www.w3.org/2000/svg",
|
|
1848
|
-
children: [u("circle", {
|
|
1849
|
-
cx: "8",
|
|
1850
|
-
cy: "8",
|
|
1851
|
-
r: "6.3",
|
|
1852
|
-
stroke: "currentColor",
|
|
1853
|
-
"stroke-width": "1.4"
|
|
1854
|
-
}), u("rect", {
|
|
1855
|
-
x: "7",
|
|
1856
|
-
y: "4",
|
|
1857
|
-
width: "2",
|
|
1858
|
-
height: "5",
|
|
1859
|
-
fill: "currentColor"
|
|
1860
|
-
}), u("rect", {
|
|
1861
|
-
x: "7",
|
|
1862
|
-
y: "10",
|
|
1863
|
-
width: "2",
|
|
1864
|
-
height: "2",
|
|
1865
|
-
fill: "currentColor"
|
|
1866
|
-
})]
|
|
1867
|
-
}), u("p", {
|
|
1868
|
-
class: "break-words pr-1 text-sm",
|
|
1869
|
-
children: e.message
|
|
1870
|
-
})]
|
|
1871
|
-
}), Ie = ({
|
|
1872
|
-
class: e,
|
|
1873
|
-
...r
|
|
1874
|
-
}) => {
|
|
1875
|
-
const {
|
|
1876
|
-
t
|
|
1877
|
-
} = Q();
|
|
1878
|
-
return u("button", {
|
|
1879
|
-
type: "button",
|
|
1880
|
-
class: Ke("fr touch-hitbox text-neutral-11 bg-neutral-1 ring-divider hover:ring-divider active:ring-interactive-bg-hover hover:text-neutral-12 active:text-neutral-12 hover:bg-divider active:bg-interactive-bg-hover flex flex-shrink-0 items-center justify-center gap-1 self-center rounded-full py-1 pl-2 pr-2.5 text-sm ring-1 transition-all", e),
|
|
1881
|
-
...r,
|
|
1882
|
-
children: [u("svg", {
|
|
1883
|
-
"aria-hidden": !0,
|
|
1884
|
-
class: "block",
|
|
1885
|
-
width: "16",
|
|
1886
|
-
height: "16",
|
|
1887
|
-
viewBox: "0 0 16 16",
|
|
1888
|
-
fill: "transparent",
|
|
1889
|
-
stroke: "currentColor",
|
|
1890
|
-
"stroke-linecap": "round",
|
|
1891
|
-
"stroke-width": "1.5",
|
|
1892
|
-
children: [u("title", {
|
|
1893
|
-
children: t("skip")
|
|
1894
|
-
}), u("path", {
|
|
1895
|
-
d: "M3.25 11.25A5 5 0 0 1 12 7"
|
|
1896
|
-
}), u("path", {
|
|
1897
|
-
d: "M13.25 4.5V8.25H9.5"
|
|
1898
|
-
})]
|
|
1899
|
-
}), t("skip")]
|
|
1900
|
-
});
|
|
1901
|
-
};
|
|
1902
|
-
var Nt = { Afghanistan: "93", Albania: "355", Algeria: "213", "American Samoa": "1 684", Andorra: "376", Angola: "244", Anguilla: "1 264", Antarctica: "672", "Antigua and Barbuda": "1 268", Argentina: "54", Armenia: "374", Aruba: "297", Australia: "61", Austria: "43", Azerbaijan: "994", Bahrain: "973", Bangladesh: "880", Barbados: "1 246", Belarus: "375", Belgium: "32", Belize: "501", Benin: "229", Bermuda: "1 441", Bhutan: "975", Bolivia: "591", "Bosnia and Herzegovina": "387", Botswana: "267", "Bouvet Island": "47", Brazil: "55", "British Indian Ocean Territory": "246", "British Virgin Islands": "1 284", Brunei: "673", Bulgaria: "359", "Burkina Faso": "226", Burundi: "257", "Cabo Verde": "238", Cambodia: "855", Cameroon: "237", Canada: "1", "Caribbean Netherlands": "599", "Cayman Islands": "1 345", "Central African Republic": "236", Chad: "235", Chile: "56", China: "86", "Christmas Island": "61", "Cocos (Keeling) Islands": "61", Colombia: "57", Comoros: "269", "Cook Islands": "682", "Costa Rica": "506", Croatia: "385", Cuba: "53", Curaçao: "599", Cyprus: "357", Czechia: "420", "Côte d'Ivoire": "225", "Democratic Republic of the Congo": "243", Denmark: "45", Djibouti: "253", "Dominican Republic": "1 809", Ecuador: "593", Egypt: "20", "El Salvador": "503", "Equatorial Guinea": "240", Eritrea: "291", Estonia: "372", Eswatini: "268", Ethiopia: "251", "Falkland Islands (Islas Malvinas)": "500", "Faroe Islands": "298", Fiji: "679", Finland: "358", France: "33", "French Guiana": "594", "French Polynesia": "689", "French Southern and Antarctic Lands": "262", Gabon: "241", Georgia: "995", Germany: "49", Ghana: "233", Gibraltar: "350", Greece: "30", Greenland: "299", Grenada: "1 473", Guadeloupe: "590", Guam: "1 671", Guatemala: "502", Guernsey: "44", Guinea: "224", "Guinea-Bissau": "245", Guyana: "592", Haiti: "509", Honduras: "504", "Hong Kong": "852", Hungary: "36", Iceland: "354", India: "91", Indonesia: "62", Iran: "98", Iraq: "964", Ireland: "353", "Isle of Man": "44", Israel: "972", Italy: "39", Jamaica: "1 876", Japan: "81", Jersey: "44", Jordan: "962", Kazakhstan: "7", Kenya: "254", Kiribati: "686", Kosovo: "383", Kuwait: "965", Kyrgyzstan: "996", Laos: "856", Latvia: "371", Lebanon: "961", Lesotho: "266", Liberia: "231", Libya: "218", Liechtenstein: "423", Lithuania: "370", Luxembourg: "352", Macao: "853", Madagascar: "261", Malawi: "265", Malaysia: "60", Maldives: "960", Mali: "223", Malta: "356", "Marshall Islands": "692", Martinique: "596", Mauritania: "222", Mauritius: "230", Mayotte: "262", Mexico: "52", Micronesia: "691", Moldova: "373", Monaco: "377", Mongolia: "976", Montenegro: "382", Montserrat: "1 664", Morocco: "212", Mozambique: "258", "Myanmar (Burma)": "95", Namibia: "264", Nauru: "674", Nepal: "977", Netherlands: "31", "New Caledonia": "687", "New Zealand": "64", Nicaragua: "505", Niger: "227", Nigeria: "234", Niue: "683", "Norfolk Island": "672", "North Korea": "850", "North Macedonia": "389", "Northern Mariana Islands": "1 670", Norway: "47", Oman: "968", Pakistan: "92", Palau: "680", Palestine: "970", Panama: "507", "Papua New Guinea": "675", Paraguay: "595", Peru: "51", Philippines: "63", "Pitcairn Islands": "64", Poland: "48", Portugal: "351", "Puerto Rico": "1 787", Qatar: "974", Romania: "40", Russia: "7", Rwanda: "250", Réunion: "262", "Saint Barthélemy": "590", "Saint Helena, Ascension and Tristan da Cunha": "290", "Saint Kitts and Nevis": "1 869", "Saint Lucia": "1 758", "Saint Martin": "590", "Saint Pierre and Miquelon": "508", "Saint Vincent and the Grenadines": "1 784", Samoa: "685", "San Marino": "378", "Saudi Arabia": "966", Senegal: "221", Serbia: "381", Seychelles: "248", "Sierra Leone": "232", Singapore: "65", "Sint Maarten": "1 721", Slovakia: "421", Slovenia: "386", "Solomon Islands": "677", Somalia: "252", "South Africa": "27", "South Georgia and the South Sandwich Islands": "500", "South Korea": "82", "South Sudan": "211", Spain: "34", "Sri Lanka": "94", Sudan: "249", Suriname: "597", "Svalbard and Jan Mayen": "47", Sweden: "46", Switzerland: "41", Syria: "963", "São Tomé and Príncipe": "239", Taiwan: "886", Tajikistan: "992", Tanzania: "255", Thailand: "66", "The Bahamas": "1 242", "The Gambia": "220", "Timor-Leste": "670", Togo: "228", Tokelau: "690", Tonga: "676", "Trinidad and Tobago": "1 868", Tunisia: "216", Turkmenistan: "993", "Turks and Caicos Islands": "1 649", Tuvalu: "688", Türkiye: "90", "U.S. Virgin Islands": "1 340", Uganda: "256", Ukraine: "380", "United Arab Emirates": "971", "United Kingdom": "44", "United States": "1", "United States Minor Outlying Islands": "1", Uruguay: "598", Uzbekistan: "998", Vanuatu: "678", "Vatican City": "379", Venezuela: "58", Vietnam: "84", "Wallis and Futuna": "681", "Western Sahara": "212", Yemen: "967", Zambia: "260", Zimbabwe: "263", "Åland Islands": "358" };
|
|
1903
|
-
const ze = dt("outline-divider ease-expo-out placeholder:text-neutral-10 text-neutral-12 focus-visible:outline-accent-7 caret-accent-9 bg-lowest py-1 text-base outline outline-2 transition-all", {
|
|
1904
|
-
variants: {
|
|
1905
|
-
optional: {
|
|
1906
|
-
true: "pr-16 pl-3",
|
|
1907
|
-
false: "pl-3 pr-3"
|
|
1908
|
-
}
|
|
1909
|
-
},
|
|
1910
|
-
defaultVariants: {
|
|
1911
|
-
optional: !1
|
|
1912
|
-
}
|
|
1913
|
-
}), _n = "https://api.mapbox.com/search/searchbox/v1/suggest", kn = "ZzRDWFU0dTZ3SF9aWk9RNGl6QzZaWS5RZmlFak13a0hPbGxXZXlNSGN5RUhObUJ6TXpSV08yUW5OdE5tSTZJU1lpd2lJb1JYYXRObmJ2Tm5iaGhHZWx4V1lpb2pJMUp5ZS5rcA==", Cn = (e) => atob(e).split("").reverse().join(""), me = /* @__PURE__ */ be({
|
|
1914
|
-
name: /* @__PURE__ */ ie()
|
|
1915
|
-
}), Sn = /* @__PURE__ */ be({
|
|
1916
|
-
suggestions: /* @__PURE__ */ Rr(/* @__PURE__ */ be({
|
|
1917
|
-
full_address: /* @__PURE__ */ tt(/* @__PURE__ */ ie()),
|
|
1918
|
-
place_formatted: /* @__PURE__ */ tt(/* @__PURE__ */ ie()),
|
|
1919
|
-
name: /* @__PURE__ */ tt(/* @__PURE__ */ ie()),
|
|
1920
|
-
mapbox_id: /* @__PURE__ */ ie(),
|
|
1921
|
-
context: /* @__PURE__ */ vn(/* @__PURE__ */ be({
|
|
1922
|
-
address: me,
|
|
1923
|
-
street: me,
|
|
1924
|
-
neighborhood: me,
|
|
1925
|
-
locality: me,
|
|
1926
|
-
district: me,
|
|
1927
|
-
place: me,
|
|
1928
|
-
region: me,
|
|
1929
|
-
postcode: me,
|
|
1930
|
-
country: me
|
|
1931
|
-
}))
|
|
1932
|
-
}))
|
|
1933
|
-
}), In = ({
|
|
1934
|
-
logger: e,
|
|
1935
|
-
t: r
|
|
1936
|
-
}) => ws(() => {
|
|
1937
|
-
var s;
|
|
1938
|
-
const t = (s = B.current$.peek().flow) == null ? void 0 : s.data.flowSessionId;
|
|
1939
|
-
return t ? {
|
|
1940
|
-
enabled: !0,
|
|
1941
|
-
getPredictions: async (n) => {
|
|
1942
|
-
var g;
|
|
1943
|
-
const i = new URL(_n);
|
|
1944
|
-
i.searchParams.set("q", n), i.searchParams.set("session_token", t);
|
|
1945
|
-
const a = (g = B.current$.peek().flow) == null ? void 0 : g.locationOrigin;
|
|
1946
|
-
a && a.lat !== void 0 && a.lng !== void 0 && a.lat >= -90 && a.lat <= 90 && a.lng >= -180 && a.lng <= 180 && i.searchParams.set("proximity", `${a.lng},${a.lat}`), i.searchParams.set("access_token", Cn(kn));
|
|
1947
|
-
const c = await fetch(i);
|
|
1948
|
-
if (!c.ok)
|
|
1949
|
-
return e.error("Failed to get address details", c), {
|
|
1950
|
-
ok: !1,
|
|
1951
|
-
error: r("address_error")
|
|
1952
|
-
};
|
|
1953
|
-
const h = /* @__PURE__ */ xn(Sn, await c.json());
|
|
1954
|
-
if (h.success === !1)
|
|
1955
|
-
return e.error("Failed to parse address details", h.issues), {
|
|
1956
|
-
ok: !1,
|
|
1957
|
-
error: r("address_error")
|
|
1958
|
-
};
|
|
1959
|
-
const {
|
|
1960
|
-
suggestions: v
|
|
1961
|
-
} = h.output;
|
|
1962
|
-
return {
|
|
1963
|
-
ok: !0,
|
|
1964
|
-
data: v.map((p) => {
|
|
1965
|
-
var m, w, F, _, S, y, C, A, E;
|
|
1966
|
-
return {
|
|
1967
|
-
label: p.full_address ?? p.place_formatted ?? p.name ?? p.mapbox_id,
|
|
1968
|
-
id: p.mapbox_id,
|
|
1969
|
-
address: {
|
|
1970
|
-
line1: ((m = p.context.address) == null ? void 0 : m.name) ?? ((w = p.context.street) == null ? void 0 : w.name),
|
|
1971
|
-
line2: void 0,
|
|
1972
|
-
line3: ((F = p.context.neighborhood) == null ? void 0 : F.name) ?? ((_ = p.context.locality) == null ? void 0 : _.name),
|
|
1973
|
-
city: ((S = p.context.place) == null ? void 0 : S.name) ?? ((y = p.context.district) == null ? void 0 : y.name),
|
|
1974
|
-
state: (C = p.context.region) == null ? void 0 : C.name,
|
|
1975
|
-
postcode: (A = p.context.postcode) == null ? void 0 : A.name,
|
|
1976
|
-
country: (E = p.context.country) == null ? void 0 : E.name
|
|
1977
|
-
}
|
|
1978
|
-
};
|
|
1979
|
-
})
|
|
1980
|
-
};
|
|
1981
|
-
}
|
|
1982
|
-
} : {
|
|
1983
|
-
enabled: !1
|
|
1984
|
-
};
|
|
1985
|
-
}, [e, r]), Zt = (e) => {
|
|
1986
|
-
const {
|
|
1987
|
-
t: r
|
|
1988
|
-
} = Q();
|
|
1989
|
-
return u("button", {
|
|
1990
|
-
type: "button",
|
|
1991
|
-
class: "touch-hitbox text-neutral-11 hover:bg-neutral-4 hover:text-neutral-12 hover:border-neutral-5 relative flex items-center gap-1 rounded-[18px] border border-solid border-transparent px-3 py-1 pl-1.5 text-sm transition-colors",
|
|
1992
|
-
...e,
|
|
1993
|
-
children: [u("svg", {
|
|
1994
|
-
width: "16",
|
|
1995
|
-
height: "16",
|
|
1996
|
-
viewBox: "0 0 16 16",
|
|
1997
|
-
stroke: "currentColor",
|
|
1998
|
-
"stroke-width": "1.5",
|
|
1999
|
-
fill: "none",
|
|
2000
|
-
xmlns: "http://www.w3.org/2000/svg",
|
|
2001
|
-
children: u("path", {
|
|
2002
|
-
d: "M10 3L5 8L10 13"
|
|
2003
|
-
})
|
|
2004
|
-
}), u("span", {
|
|
2005
|
-
children: r("back")
|
|
2006
|
-
})]
|
|
2007
|
-
});
|
|
2008
|
-
}, An = ({
|
|
2009
|
-
input: e,
|
|
2010
|
-
onSubmitSuccess: r,
|
|
2011
|
-
logger: t
|
|
2012
|
-
}) => {
|
|
2013
|
-
const {
|
|
2014
|
-
t: s
|
|
2015
|
-
} = Q(), [n, i] = ge(), {
|
|
2016
|
-
enabled: a,
|
|
2017
|
-
getPredictions: o
|
|
2018
|
-
} = In({
|
|
2019
|
-
logger: t,
|
|
2020
|
-
t: s
|
|
2021
|
-
}), [c, h] = ge(a ? "query" : "manual"), [v, g] = ge(""), [p, m] = ge(), w = de(), F = de(), _ = (y) => {
|
|
2022
|
-
var A;
|
|
2023
|
-
if (Ee(a, "Query state should not be enabled"), y = y.trim(), y === ((A = w.current) == null ? void 0 : A.query) || y === (p == null ? void 0 : p.query) && p.status === "done")
|
|
2024
|
-
return;
|
|
2025
|
-
if (g(y), y === "") {
|
|
2026
|
-
w.current = void 0, m(void 0);
|
|
2027
|
-
return;
|
|
2028
|
-
}
|
|
2029
|
-
const C = w.current = {
|
|
2030
|
-
query: y
|
|
2031
|
-
};
|
|
2032
|
-
m({
|
|
2033
|
-
query: y,
|
|
2034
|
-
status: "pending"
|
|
2035
|
-
}), o(y).then((E) => {
|
|
2036
|
-
w.current === C && (w.current = void 0, m(E.ok ? {
|
|
2037
|
-
query: y,
|
|
2038
|
-
status: "done",
|
|
2039
|
-
items: E.data
|
|
2040
|
-
} : {
|
|
2041
|
-
query: y,
|
|
2042
|
-
status: "failed",
|
|
2043
|
-
error: E.error
|
|
2044
|
-
}));
|
|
2045
|
-
}, (E) => {
|
|
2046
|
-
w.current === C && (w.current = void 0, t.error("Failed to get address details", E), m({
|
|
2047
|
-
query: y,
|
|
2048
|
-
status: "failed",
|
|
2049
|
-
error: s("address_error")
|
|
2050
|
-
}));
|
|
2051
|
-
});
|
|
2052
|
-
}, S = (y, C) => {
|
|
2053
|
-
i((A) => ({
|
|
2054
|
-
...A,
|
|
2055
|
-
[y]: C
|
|
2056
|
-
}));
|
|
2057
|
-
};
|
|
2058
|
-
switch (c) {
|
|
2059
|
-
case "query":
|
|
2060
|
-
return Ee(a, "Query state should not be enabled"), u(Fn, {
|
|
2061
|
-
input: e,
|
|
2062
|
-
onSkip: () => r(null),
|
|
2063
|
-
onAddressSelect: (y) => {
|
|
2064
|
-
if (y === "") {
|
|
2065
|
-
w.current && (w.current = void 0, m(void 0)), h("manual");
|
|
2066
|
-
return;
|
|
2067
|
-
}
|
|
2068
|
-
const C = (p == null ? void 0 : p.status) === "done" ? p.items.find((A) => A.id === y) : void 0;
|
|
2069
|
-
C && (F.current !== y && i(C.address), F.current = y, h("details"));
|
|
2070
|
-
},
|
|
2071
|
-
onAddressSearch: _,
|
|
2072
|
-
lookup: p,
|
|
2073
|
-
query: v
|
|
2074
|
-
});
|
|
2075
|
-
case "details":
|
|
2076
|
-
return Ee(n !== void 0), u(Xt, {
|
|
2077
|
-
input: e,
|
|
2078
|
-
logger: t,
|
|
2079
|
-
onSubmitSuccess: r,
|
|
2080
|
-
addressFields: n,
|
|
2081
|
-
onFieldChange: S,
|
|
2082
|
-
actions: u(Zt, {
|
|
2083
|
-
onClick: () => {
|
|
2084
|
-
h("query");
|
|
2085
|
-
}
|
|
2086
|
-
})
|
|
2087
|
-
});
|
|
2088
|
-
case "manual":
|
|
2089
|
-
return u(Xt, {
|
|
2090
|
-
logger: t,
|
|
2091
|
-
input: e,
|
|
2092
|
-
onSubmitSuccess: r,
|
|
2093
|
-
addressFields: n ?? {},
|
|
2094
|
-
onFieldChange: S,
|
|
2095
|
-
actions: a ? u(Zt, {
|
|
2096
|
-
onClick: () => {
|
|
2097
|
-
h("query");
|
|
2098
|
-
}
|
|
2099
|
-
}) : e.config.optional ? (
|
|
2100
|
-
// Without address search this is the only screen, so an optional question needs its own way past.
|
|
2101
|
-
u(Ie, {
|
|
2102
|
-
onClick: () => r(null)
|
|
2103
|
-
})
|
|
2104
|
-
) : void 0
|
|
2105
|
-
});
|
|
2106
|
-
}
|
|
2107
|
-
}, Fn = ({
|
|
2108
|
-
input: e,
|
|
2109
|
-
onSkip: r,
|
|
2110
|
-
lookup: t,
|
|
2111
|
-
onAddressSelect: s,
|
|
2112
|
-
query: n,
|
|
2113
|
-
onAddressSearch: i
|
|
2114
|
-
}) => {
|
|
2115
|
-
const {
|
|
2116
|
-
t: a
|
|
2117
|
-
} = Q(), o = de(null);
|
|
2118
|
-
return Se(() => {
|
|
2119
|
-
o.current && (o.current.focus(), o.current.select());
|
|
2120
|
-
}, []), u(ve, {
|
|
2121
|
-
children: [u("form", {
|
|
2122
|
-
noValidate: !0,
|
|
2123
|
-
onSubmit: (c) => {
|
|
2124
|
-
c.preventDefault();
|
|
2125
|
-
const v = new FormData(c.currentTarget).get("address");
|
|
2126
|
-
typeof v == "string" && i(v);
|
|
2127
|
-
},
|
|
2128
|
-
class: "flex gap-2 p-2.5",
|
|
2129
|
-
children: [u("div", {
|
|
2130
|
-
class: "group relative flex-1",
|
|
2131
|
-
children: [u("input", {
|
|
2132
|
-
ref: o,
|
|
2133
|
-
name: "address",
|
|
2134
|
-
id: "chat-address",
|
|
2135
|
-
autocomplete: "address-line1",
|
|
2136
|
-
autoFocus: !0,
|
|
2137
|
-
placeholder: e.config.placeholder || a("address_search"),
|
|
2138
|
-
defaultValue: n,
|
|
2139
|
-
class: ze({
|
|
2140
|
-
optional: !!e.config.optional,
|
|
2141
|
-
className: "w-full rounded-full"
|
|
2142
|
-
})
|
|
2143
|
-
}), u("button", {
|
|
2144
|
-
type: "submit",
|
|
2145
|
-
class: "touch-hitbox text-neutral-12 hover:bg-neutral-3 fr absolute bottom-0 right-0 top-0 flex cursor-pointer items-center gap-1 rounded-full px-3 transition-all",
|
|
2146
|
-
children: [u("svg", {
|
|
2147
|
-
"aria-hidden": "true",
|
|
2148
|
-
width: "16",
|
|
2149
|
-
height: "16",
|
|
2150
|
-
viewBox: "0 0 16 16",
|
|
2151
|
-
fill: "none",
|
|
2152
|
-
xmlns: "http://www.w3.org/2000/svg",
|
|
2153
|
-
children: u("g", {
|
|
2154
|
-
id: "inploi",
|
|
2155
|
-
stroke: "currentColor",
|
|
2156
|
-
"stroke-linecap": "round",
|
|
2157
|
-
"stroke-linejoin": "round",
|
|
2158
|
-
strokeWidth: "1.5",
|
|
2159
|
-
children: [u("circle", {
|
|
2160
|
-
cx: "7",
|
|
2161
|
-
cy: "7",
|
|
2162
|
-
r: "4"
|
|
2163
|
-
}), u("path", {
|
|
2164
|
-
d: "M10 10L13 13"
|
|
2165
|
-
})]
|
|
2166
|
-
})
|
|
2167
|
-
}), u("span", {
|
|
2168
|
-
class: "sr-only",
|
|
2169
|
-
children: a("search")
|
|
2170
|
-
})]
|
|
2171
|
-
})]
|
|
2172
|
-
}), e.config.optional && u(Ie, {
|
|
2173
|
-
class: "relative",
|
|
2174
|
-
onClick: r
|
|
2175
|
-
})]
|
|
2176
|
-
}), (t == null ? void 0 : t.status) === "failed" ? u(Ge, {
|
|
2177
|
-
error: {
|
|
2178
|
-
message: t.error
|
|
2179
|
-
}
|
|
2180
|
-
}) : null, u("p", {
|
|
2181
|
-
role: "status",
|
|
2182
|
-
class: (t == null ? void 0 : t.status) === "pending" || (t == null ? void 0 : t.status) === "done" && t.items.length === 0 ? "text-neutral-11 flex items-center gap-2 px-4 py-2 text-sm" : "sr-only",
|
|
2183
|
-
children: (t == null ? void 0 : t.status) === "pending" ? u(ve, {
|
|
2184
|
-
children: [u(Vt, {
|
|
2185
|
-
"aria-hidden": "true",
|
|
2186
|
-
class: "h-4 w-4 shrink-0"
|
|
2187
|
-
}), a("address_searching")]
|
|
2188
|
-
}) : (t == null ? void 0 : t.status) === "done" && t.items.length === 0 ? a("address_no_results") : null
|
|
2189
|
-
}), u("ul", {
|
|
2190
|
-
children: [((t == null ? void 0 : t.status) === "done" ? t.items : []).map((c) => u("li", {
|
|
2191
|
-
children: u("button", {
|
|
2192
|
-
class: "text-neutral-11 fr hover:bg-neutral-3 focus-visible:bg-neutral-3 hover:text-neutral-12 border-b-neutral-3 flex w-full items-center border border-b border-solid border-transparent px-4 py-3 text-sm transition-colors duration-100",
|
|
2193
|
-
onClick: () => {
|
|
2194
|
-
s(c.id);
|
|
2195
|
-
},
|
|
2196
|
-
children: [u("span", {
|
|
2197
|
-
class: "flex-grow",
|
|
2198
|
-
children: c.label
|
|
2199
|
-
}), u("svg", {
|
|
2200
|
-
class: "flex-none",
|
|
2201
|
-
width: "16",
|
|
2202
|
-
height: "16",
|
|
2203
|
-
viewBox: "0 0 16 16",
|
|
2204
|
-
stroke: "currentColor",
|
|
2205
|
-
"stroke-width": "1.5",
|
|
2206
|
-
fill: "none",
|
|
2207
|
-
xmlns: "http://www.w3.org/2000/svg",
|
|
2208
|
-
children: u("path", {
|
|
2209
|
-
d: "M6 3L11 8L6 13"
|
|
2210
|
-
})
|
|
2211
|
-
})]
|
|
2212
|
-
})
|
|
2213
|
-
}, c.id)), u("li", {
|
|
2214
|
-
children: u("button", {
|
|
2215
|
-
class: "text-neutral-11 fr hover:bg-neutral-3 focus-visible:bg-neutral-3 hover:text-neutral-12 border-b-neutral-3 flex w-full items-center border border-b border-solid border-transparent px-4 py-3 text-sm transition-colors duration-100",
|
|
2216
|
-
onClick: () => {
|
|
2217
|
-
s("");
|
|
2218
|
-
},
|
|
2219
|
-
children: u("span", {
|
|
2220
|
-
class: "flex-grow",
|
|
2221
|
-
children: a("address_manual")
|
|
2222
|
-
})
|
|
2223
|
-
})
|
|
2224
|
-
}, "")]
|
|
2225
|
-
})]
|
|
2226
|
-
});
|
|
2227
|
-
}, kt = ["line1", "line2", "line3", "city", "state", "postcode", "country"], Xt = ({
|
|
2228
|
-
addressFields: e,
|
|
2229
|
-
onFieldChange: r,
|
|
2230
|
-
onSubmitSuccess: t,
|
|
2231
|
-
actions: s,
|
|
2232
|
-
input: n
|
|
2233
|
-
}) => {
|
|
2234
|
-
const i = de(null);
|
|
2235
|
-
Se(() => {
|
|
2236
|
-
if (i.current) {
|
|
2237
|
-
const c = i.current.querySelector("input");
|
|
2238
|
-
c && (c.focus(), c.select());
|
|
2239
|
-
}
|
|
2240
|
-
}, []);
|
|
2241
|
-
const a = Object.keys(Nt), {
|
|
2242
|
-
t: o
|
|
2243
|
-
} = Q();
|
|
2244
|
-
return u("form", {
|
|
2245
|
-
class: "flex flex-col px-2 pt-2",
|
|
2246
|
-
onSubmit: (c) => {
|
|
2247
|
-
const h = c.currentTarget, v = [...h.querySelectorAll("input")].filter((m) => m.value !== "" && !m.value.trim());
|
|
2248
|
-
for (const m of v) {
|
|
2249
|
-
m.value = "";
|
|
2250
|
-
const w = kt.find((F) => n.config.keys[F] === m.name);
|
|
2251
|
-
w && r(w, "");
|
|
2252
|
-
}
|
|
2253
|
-
if (v.length > 0 && !h.checkValidity()) {
|
|
2254
|
-
c.preventDefault(), h.reportValidity();
|
|
2255
|
-
return;
|
|
2256
|
-
}
|
|
2257
|
-
const g = new FormData(h), p = Object.fromEntries(g.entries());
|
|
2258
|
-
t({
|
|
2259
|
-
type: "address",
|
|
2260
|
-
value: p
|
|
2261
|
-
});
|
|
2262
|
-
},
|
|
2263
|
-
children: [u("div", {
|
|
2264
|
-
class: "bg-neutral-3 border-neutral-5 grid items-center gap-1.5 rounded-2xl border pb-2 pl-4 pr-3 pt-3 [grid-template-columns:min-content_1fr]",
|
|
2265
|
-
ref: i,
|
|
2266
|
-
children: kt.map((c, h) => {
|
|
2267
|
-
const v = `isdk_${c}`, g = n.config.keys[c];
|
|
2268
|
-
return g ? u(ve, {
|
|
2269
|
-
children: [u("label", {
|
|
2270
|
-
for: v,
|
|
2271
|
-
class: "text-neutral-11 [&:has(+*>input:focus)]:text-neutral-12 w-24 pb-2 text-xs uppercase leading-3 tracking-widest transition-colors",
|
|
2272
|
-
children: o(c)
|
|
2273
|
-
}), u("div", {
|
|
2274
|
-
class: "flex flex-col items-stretch gap-1.5",
|
|
2275
|
-
children: [c === "country" ? u("div", {
|
|
2276
|
-
class: "relative",
|
|
2277
|
-
children: [u("select", {
|
|
2278
|
-
class: "text-neutral-12 hover:bg-neutral-4 placeholder:text-neutral-8 focus:bg-neutral-5 w-full flex-1 appearance-none rounded-lg border-solid bg-transparent bg-none px-3 py-1.5 text-base transition-colors focus:outline-none",
|
|
2279
|
-
name: g,
|
|
2280
|
-
id: v,
|
|
2281
|
-
defaultValue: e[c],
|
|
2282
|
-
onChange: (p) => r(c, p.currentTarget.value),
|
|
2283
|
-
required: !0,
|
|
2284
|
-
children: [e.country && !a.includes(e.country) ? u("option", {
|
|
2285
|
-
value: e[c],
|
|
2286
|
-
children: e[c]
|
|
2287
|
-
}) : u("option", {
|
|
2288
|
-
value: "",
|
|
2289
|
-
children: o("select_country")
|
|
2290
|
-
}), a.map((p) => u("option", {
|
|
2291
|
-
value: p,
|
|
2292
|
-
children: p
|
|
2293
|
-
}, p))]
|
|
2294
|
-
}), u("svg", {
|
|
2295
|
-
class: "text-neutral-12 absolute bottom-2.5 right-2 flex items-center justify-center",
|
|
2296
|
-
width: "16",
|
|
2297
|
-
height: "16",
|
|
2298
|
-
stroke: "currentColor",
|
|
2299
|
-
"stroke-width": "1.5",
|
|
2300
|
-
"stroke-linecap": "round",
|
|
2301
|
-
"stroke-linejoin": "round",
|
|
2302
|
-
viewBox: "0 0 16 16",
|
|
2303
|
-
fill: "none",
|
|
2304
|
-
xmlns: "http://www.w3.org/2000/svg",
|
|
2305
|
-
children: u("path", {
|
|
2306
|
-
d: "M4 6.5L8 10.5L12 6.5"
|
|
2307
|
-
})
|
|
2308
|
-
})]
|
|
2309
|
-
}) : u("input", {
|
|
2310
|
-
autoFocus: h === 0 ? !0 : void 0,
|
|
2311
|
-
class: "text-neutral-12 hover:bg-neutral-4 placeholder:text-neutral-8 focus:bg-neutral-5 flex-1 rounded-lg border-solid bg-transparent px-3 py-1.5 text-base transition-colors autofill:shadow-[inset_0_0_0_1000px_hsl(210_16.7%_97.6%)] focus:outline-none",
|
|
2312
|
-
name: g,
|
|
2313
|
-
id: v,
|
|
2314
|
-
defaultValue: e[c],
|
|
2315
|
-
onInput: (p) => r(c, p.currentTarget.value),
|
|
2316
|
-
required: c !== "line2" || n.config.line2Required === !0
|
|
2317
|
-
}), h === kt.length - 1 ? u("hr", {
|
|
2318
|
-
class: "m-0 w-full border-b border-b-transparent"
|
|
2319
|
-
}) : u("hr", {
|
|
2320
|
-
class: "border-b-neutral-5 m-0 w-full border-b border-solid"
|
|
2321
|
-
})]
|
|
2322
|
-
})]
|
|
2323
|
-
}) : null;
|
|
2324
|
-
})
|
|
2325
|
-
}), u("div", {
|
|
2326
|
-
class: "bg-neutral-1 sticky bottom-0 flex items-center py-2",
|
|
2327
|
-
children: [s, u(Me, {
|
|
2328
|
-
class: "ml-auto"
|
|
2329
|
-
})]
|
|
2330
|
-
})]
|
|
2331
|
-
});
|
|
2332
|
-
}, Lt = () => {
|
|
2333
|
-
const e = de(null);
|
|
2334
|
-
return Sr(() => {
|
|
2335
|
-
var r;
|
|
2336
|
-
(r = e.current) == null || r.focus();
|
|
2337
|
-
}, []), e;
|
|
2338
|
-
}, qr = ["true", "false"], Vn = /* @__PURE__ */ jr(qr), En = "answer", Ur = "flex items-center flex-wrap gap-2 p-2.5", zr = "min-w-0 max-w-full flex-auto", Kr = Ir(({
|
|
2339
|
-
label: e,
|
|
2340
|
-
...r
|
|
2341
|
-
}, t) => u("button", {
|
|
2342
|
-
class: "bg-lowest ease-expo-out ring-divider text-neutral-12 active:ring-accent-7 active:bg-accent-2 active:text-accent-11 fr block w-full overflow-hidden rounded-2xl px-2 py-2.5 ring-2 transition-all selection:bg-transparent",
|
|
2343
|
-
...r,
|
|
2344
|
-
ref: t,
|
|
2345
|
-
children: u("p", {
|
|
2346
|
-
class: "text-center text-base",
|
|
2347
|
-
children: e
|
|
2348
|
-
})
|
|
2349
|
-
})), Mn = ({
|
|
2350
|
-
input: e,
|
|
2351
|
-
onSubmitSuccess: r
|
|
2352
|
-
}) => {
|
|
2353
|
-
const t = Lt();
|
|
2354
|
-
return u("form", {
|
|
2355
|
-
noValidate: !0,
|
|
2356
|
-
class: "",
|
|
2357
|
-
onSubmit: (s) => {
|
|
2358
|
-
s.preventDefault();
|
|
2359
|
-
const n = _s(s).value, i = bn(Vn, n);
|
|
2360
|
-
r({
|
|
2361
|
-
type: "boolean",
|
|
2362
|
-
value: i === "true"
|
|
2363
|
-
});
|
|
2364
|
-
},
|
|
2365
|
-
children: [u("ul", {
|
|
2366
|
-
class: Ur,
|
|
2367
|
-
children: qr.map((s, n) => u("li", {
|
|
2368
|
-
class: zr,
|
|
2369
|
-
children: u(Kr, {
|
|
2370
|
-
ref: n === 0 ? t : null,
|
|
2371
|
-
type: "submit",
|
|
2372
|
-
name: En,
|
|
2373
|
-
value: s,
|
|
2374
|
-
label: e.config.labels[s]
|
|
2375
|
-
}, s)
|
|
2376
|
-
}))
|
|
2377
|
-
}), e.config.optional && u("div", {
|
|
2378
|
-
class: "px-2 pb-2",
|
|
2379
|
-
children: u(Ie, {
|
|
2380
|
-
class: "relative w-full",
|
|
2381
|
-
type: "button",
|
|
2382
|
-
onClick: () => r(null)
|
|
2383
|
-
})
|
|
2384
|
-
})]
|
|
2385
|
-
});
|
|
2386
|
-
}, Nn = (e) => new Promise((r, t) => {
|
|
2387
|
-
const s = new FileReader();
|
|
2388
|
-
s.onload = () => {
|
|
2389
|
-
if (typeof s.result != "string" || !s.result)
|
|
2390
|
-
return t(new Error("Invalid file"));
|
|
2391
|
-
r(s.result);
|
|
2392
|
-
}, s.onerror = t, s.readAsDataURL(e);
|
|
2393
|
-
}), Yt = (e) => e.reduce((r, t) => r + t.sizeKb, 0), Ln = We("file"), Qt = 3, ht = (e) => {
|
|
2394
|
-
const r = e.lastIndexOf(".");
|
|
2395
|
-
return r === -1 ? [e, ""] : [e.slice(0, r), e.slice(r)];
|
|
2396
|
-
}, Tn = ({
|
|
2397
|
-
file: e,
|
|
2398
|
-
class: r,
|
|
2399
|
-
...t
|
|
2400
|
-
}) => {
|
|
2401
|
-
const {
|
|
2402
|
-
t: s
|
|
2403
|
-
} = Q(), [n, i] = ht(e.name);
|
|
2404
|
-
return u("div", {
|
|
2405
|
-
class: Ke("bg-accent-1 outline-accent-4 flex max-w-full gap-2 overflow-hidden rounded-lg px-3 py-2 text-sm outline", r),
|
|
2406
|
-
...t,
|
|
2407
|
-
children: [u("p", {
|
|
2408
|
-
class: "text-accent-12 flex flex-grow overflow-hidden",
|
|
2409
|
-
children: [u("span", {
|
|
2410
|
-
class: "sr-only",
|
|
2411
|
-
children: [s("file_name"), ": "]
|
|
2412
|
-
}), u("span", {
|
|
2413
|
-
class: "block truncate",
|
|
2414
|
-
children: n
|
|
2415
|
-
}), u("span", {
|
|
2416
|
-
children: i
|
|
2417
|
-
})]
|
|
2418
|
-
}), u("p", {
|
|
2419
|
-
class: "text-accent-11",
|
|
2420
|
-
children: [u("span", {
|
|
2421
|
-
class: "sr-only",
|
|
2422
|
-
children: [s("file_size"), ": "]
|
|
2423
|
-
}), Be(e.sizeKb)]
|
|
2424
|
-
})]
|
|
2425
|
-
});
|
|
2426
|
-
}, er = ({
|
|
2427
|
-
class: e,
|
|
2428
|
-
...r
|
|
2429
|
-
}) => u("li", {
|
|
2430
|
-
class: Ke("outline-neutral-6 text-neutral-11 bg-neutral-1 block rounded-md px-1 py-0.5 text-xs outline outline-1", e),
|
|
2431
|
-
...r
|
|
2432
|
-
}), Dn = (e, r) => {
|
|
2433
|
-
const [t, s] = ht(e);
|
|
2434
|
-
return `${t.slice(0, r)}${s}`;
|
|
2435
|
-
}, tr = (e) => ({
|
|
2436
|
-
name: Dn(e.name, 42),
|
|
2437
|
-
sizeKb: e.size / 1e3
|
|
2438
|
-
}), On = [".heic", ".heif", ".jpg", ".jpeg", ".png", ".gif", ".webp", ".txt", ".rtf", ".odt", ".pages", ".zip"], Rn = (e, r, t) => {
|
|
2439
|
-
const s = ht(r.name)[1].toLowerCase(), n = [...t.map((a) => a.toLowerCase()), ...On], i = s === "" ? "none" : n.includes(s) ? s : "other";
|
|
2440
|
-
return `chatbot-file-refused:${e}:${i}`;
|
|
2441
|
-
}, $n = ({
|
|
2442
|
-
input: e,
|
|
2443
|
-
onSubmitSuccess: r,
|
|
2444
|
-
analytics: t
|
|
2445
|
-
}) => {
|
|
2446
|
-
var _;
|
|
2447
|
-
const s = (_ = B.current$.value.flow) == null ? void 0 : _.data.submissions[e.key], [n, i] = ge(Ln(s) && s.value.length ? {
|
|
2448
|
-
status: "ready",
|
|
2449
|
-
files: s.value
|
|
2450
|
-
} : {
|
|
2451
|
-
status: "empty"
|
|
2452
|
-
}), a = de(0), o = n.status === "ready" ? n.files : [], c = n.status === "ready" || n.status === "pending" ? n.files : [], h = n.status === "error" ? n.error : void 0, v = c.length - Qt, g = Yt(c), p = Lt(), {
|
|
2453
|
-
t: m
|
|
2454
|
-
} = Q(), w = (S) => {
|
|
2455
|
-
if (!S.length)
|
|
2456
|
-
return {
|
|
2457
|
-
reason: "required",
|
|
2458
|
-
error: {
|
|
2459
|
-
type: "required",
|
|
2460
|
-
message: m("validation_file")
|
|
2461
|
-
}
|
|
2462
|
-
};
|
|
2463
|
-
if (!Wt(S, e.config.extensions))
|
|
2464
|
-
return {
|
|
2465
|
-
reason: "type",
|
|
2466
|
-
file: S.find((y) => !Wt([y], e.config.extensions)),
|
|
2467
|
-
error: {
|
|
2468
|
-
type: "validate",
|
|
2469
|
-
message: m("validation_file_ext", {
|
|
2470
|
-
ext: e.config.extensions.join(", ")
|
|
2471
|
-
})
|
|
2472
|
-
}
|
|
2473
|
-
};
|
|
2474
|
-
if (e.config.fileSizeLimitKib && Yt(S) > e.config.fileSizeLimitKib)
|
|
2475
|
-
return {
|
|
2476
|
-
reason: "size",
|
|
2477
|
-
error: {
|
|
2478
|
-
type: "max",
|
|
2479
|
-
message: m("validation_file_size", {
|
|
2480
|
-
size: Be(e.config.fileSizeLimitKib)
|
|
2481
|
-
})
|
|
2482
|
-
}
|
|
2483
|
-
};
|
|
2484
|
-
if (!e.config.allowMultiple && S.length > 1)
|
|
2485
|
-
return {
|
|
2486
|
-
reason: "count",
|
|
2487
|
-
error: {
|
|
2488
|
-
type: "invalid",
|
|
2489
|
-
message: m("validation_file_max", {
|
|
2490
|
-
count: 1
|
|
2491
|
-
})
|
|
2492
|
-
}
|
|
2493
|
-
};
|
|
2494
|
-
}, F = (S, y) => {
|
|
2495
|
-
var C, A;
|
|
2496
|
-
return t.log({
|
|
2497
|
-
event: "INTERACTION",
|
|
2498
|
-
properties: {
|
|
2499
|
-
tag: Rn(S, y, e.config.extensions)
|
|
2500
|
-
},
|
|
2501
|
-
customProperties: (A = (C = B.current$.peek().flow) == null ? void 0 : C.analytics) == null ? void 0 : A.customProperties
|
|
2502
|
-
});
|
|
2503
|
-
};
|
|
2504
|
-
return u("form", {
|
|
2505
|
-
class: "flex flex-col gap-1 p-2.5",
|
|
2506
|
-
onSubmit: (S) => {
|
|
2507
|
-
if (S.preventDefault(), n.status === "pending" || n.status === "error")
|
|
2508
|
-
return;
|
|
2509
|
-
const y = w(o);
|
|
2510
|
-
y ? i({
|
|
2511
|
-
status: "error",
|
|
2512
|
-
error: y.error
|
|
2513
|
-
}) : r({
|
|
2514
|
-
type: "file",
|
|
2515
|
-
value: o
|
|
2516
|
-
});
|
|
2517
|
-
},
|
|
2518
|
-
children: [u("div", {
|
|
2519
|
-
class: "flex items-center gap-2",
|
|
2520
|
-
children: [u("label", {
|
|
2521
|
-
ref: p,
|
|
2522
|
-
for: "dropzone-file",
|
|
2523
|
-
class: "border-neutral-8 bg-neutral-2 flex h-48 w-full cursor-pointer flex-col items-center justify-center overflow-hidden rounded-2xl border border-dashed p-4",
|
|
2524
|
-
children: [c.length > 0 ? u("ul", {
|
|
2525
|
-
class: "flex max-w-full flex-wrap justify-center gap-1 overflow-hidden p-1",
|
|
2526
|
-
children: [c.slice(0, Qt).map((S) => {
|
|
2527
|
-
const [y, C] = ht(S.name);
|
|
2528
|
-
return u(er, {
|
|
2529
|
-
class: "flex overflow-hidden",
|
|
2530
|
-
children: [u("span", {
|
|
2531
|
-
class: "block truncate",
|
|
2532
|
-
children: y
|
|
2533
|
-
}), u("span", {
|
|
2534
|
-
children: C
|
|
2535
|
-
})]
|
|
2536
|
-
});
|
|
2537
|
-
}), v > 0 ? u(er, {
|
|
2538
|
-
children: m("file_more", {
|
|
2539
|
-
count: v
|
|
2540
|
-
})
|
|
2541
|
-
}) : null]
|
|
2542
|
-
}) : u("div", {
|
|
2543
|
-
class: "flex flex-col justify-center gap-4 pb-6 pt-5",
|
|
2544
|
-
children: [u("header", {
|
|
2545
|
-
class: "flex flex-col items-center gap-0",
|
|
2546
|
-
children: [u("svg", {
|
|
2547
|
-
class: "text-neutral-11 mb-1 h-8 w-8",
|
|
2548
|
-
"aria-hidden": "true",
|
|
2549
|
-
xmlns: "http://www.w3.org/2000/svg",
|
|
2550
|
-
fill: "none",
|
|
2551
|
-
viewBox: "0 0 20 16",
|
|
2552
|
-
children: u("path", {
|
|
2553
|
-
stroke: "currentColor",
|
|
2554
|
-
"stroke-linecap": "round",
|
|
2555
|
-
"stroke-linejoin": "round",
|
|
2556
|
-
"stroke-width": "1.5",
|
|
2557
|
-
d: "M13 13h3a3 3 0 0 0 0-6h-.025A5.56 5.56 0 0 0 16 6.5 5.5 5.5 0 0 0 5.207 5.021C5.137 5.017 5.071 5 5 5a4 4 0 0 0 0 8h2.167M10 15V6m0 0L8 8m2-2 2 2"
|
|
2558
|
-
})
|
|
2559
|
-
}), u("p", {
|
|
2560
|
-
class: "text-neutral-12 tracking-[-0.01em]",
|
|
2561
|
-
children: m("upload_file", {
|
|
2562
|
-
count: e.config.allowMultiple ? 2 : 1
|
|
2563
|
-
})
|
|
2564
|
-
}), e.config.fileSizeLimitKib ? u("p", {
|
|
2565
|
-
class: "text-neutral-11 text-xs",
|
|
2566
|
-
children: ["(", m("file_max_size", {
|
|
2567
|
-
size: Be(e.config.fileSizeLimitKib)
|
|
2568
|
-
}), ")"]
|
|
2569
|
-
}) : null]
|
|
2570
|
-
}), u("aside", {
|
|
2571
|
-
class: "flex flex-col items-center gap-2",
|
|
2572
|
-
children: [u("p", {
|
|
2573
|
-
id: "accepted-filetypes",
|
|
2574
|
-
class: "sr-only",
|
|
2575
|
-
children: m("file_extensions")
|
|
2576
|
-
}), u("ul", {
|
|
2577
|
-
"aria-describedby": "accepted-filetypes",
|
|
2578
|
-
class: "flex flex-wrap justify-center gap-2",
|
|
2579
|
-
children: e.config.extensions.map((S) => u("li", {
|
|
2580
|
-
class: "ring-lowest outline-neutral-6 text-neutral-11 bg-neutral-1 rounded-md px-1 py-0.5 text-[11px] uppercase tracking-wide outline outline-1 ring-2",
|
|
2581
|
-
children: S.replace(".", "")
|
|
2582
|
-
}))
|
|
2583
|
-
})]
|
|
2584
|
-
})]
|
|
2585
|
-
}), u("p", {
|
|
2586
|
-
role: "status",
|
|
2587
|
-
class: Ke("text-neutral-11 flex items-center gap-1.5 text-xs", c.length === 0 && "sr-only"),
|
|
2588
|
-
children: n.status === "pending" ? u(ve, {
|
|
2589
|
-
children: [u(Vt, {
|
|
2590
|
-
"aria-hidden": "true",
|
|
2591
|
-
class: "h-4 w-4"
|
|
2592
|
-
}), m("file_preparing", {
|
|
2593
|
-
count: c.length
|
|
2594
|
-
})]
|
|
2595
|
-
}) : n.status === "ready" ? u(ve, {
|
|
2596
|
-
children: [o.length > 1 ? m("file_total_size", {
|
|
2597
|
-
size: Be(g)
|
|
2598
|
-
}) : Be(g), u("span", {
|
|
2599
|
-
class: "sr-only",
|
|
2600
|
-
children: [". ", m("file_ready", {
|
|
2601
|
-
count: o.length
|
|
2602
|
-
})]
|
|
2603
|
-
})]
|
|
2604
|
-
}) : null
|
|
2605
|
-
}), u("input", {
|
|
2606
|
-
id: "dropzone-file",
|
|
2607
|
-
"aria-label": m("upload_file", {
|
|
2608
|
-
count: e.config.allowMultiple ? 2 : 1
|
|
2609
|
-
}),
|
|
2610
|
-
onInput: async (S) => {
|
|
2611
|
-
Ee(S.target instanceof HTMLInputElement);
|
|
2612
|
-
const y = S.target.files ? Array.from(S.target.files) : [];
|
|
2613
|
-
S.target.value = "";
|
|
2614
|
-
const [C] = y;
|
|
2615
|
-
if (!C)
|
|
2616
|
-
return;
|
|
2617
|
-
const A = ++a.current, E = n.status === "ready", R = y.map(tr), K = w(R);
|
|
2618
|
-
if (K)
|
|
2619
|
-
return F(K.reason, K.file ?? C), i({
|
|
2620
|
-
status: "error",
|
|
2621
|
-
error: K.error
|
|
2622
|
-
});
|
|
2623
|
-
i({
|
|
2624
|
-
status: "pending",
|
|
2625
|
-
files: R
|
|
2626
|
-
});
|
|
2627
|
-
let D;
|
|
2628
|
-
try {
|
|
2629
|
-
const q = await Promise.all(y.map(async (O) => {
|
|
2630
|
-
try {
|
|
2631
|
-
return {
|
|
2632
|
-
...tr(O),
|
|
2633
|
-
data: await Nn(O)
|
|
2634
|
-
};
|
|
2635
|
-
} catch (J) {
|
|
2636
|
-
throw D ?? (D = O), J;
|
|
2637
|
-
}
|
|
2638
|
-
}));
|
|
2639
|
-
a.current === A && i({
|
|
2640
|
-
status: "ready",
|
|
2641
|
-
files: q
|
|
2642
|
-
});
|
|
2643
|
-
} catch {
|
|
2644
|
-
if (a.current !== A)
|
|
2645
|
-
return;
|
|
2646
|
-
F("unreadable", D ?? C), i({
|
|
2647
|
-
status: "error",
|
|
2648
|
-
error: {
|
|
2649
|
-
type: "invalid",
|
|
2650
|
-
message: m(E ? "file_read_error_replacement" : "file_read_error")
|
|
2651
|
-
}
|
|
2652
|
-
});
|
|
2653
|
-
}
|
|
2654
|
-
},
|
|
2655
|
-
multiple: e.config.allowMultiple,
|
|
2656
|
-
accept: e.config.extensions.join(","),
|
|
2657
|
-
type: "file",
|
|
2658
|
-
class: "sr-only"
|
|
2659
|
-
})]
|
|
2660
|
-
}), u("div", {
|
|
2661
|
-
class: "flex h-full flex-col items-center gap-2",
|
|
2662
|
-
children: [u(Me, {
|
|
2663
|
-
disabled: o.length === 0
|
|
2664
|
-
}), e.config.optional && u(Ie, {
|
|
2665
|
-
class: "relative",
|
|
2666
|
-
onClick: () => r(null)
|
|
2667
|
-
})]
|
|
2668
|
-
})]
|
|
2669
|
-
}), u(Ge, {
|
|
2670
|
-
error: h
|
|
2671
|
-
})]
|
|
2672
|
-
});
|
|
2673
|
-
};
|
|
2674
|
-
var nt = (e) => e.type === "checkbox", Ve = (e) => e instanceof Date, se = (e) => e == null;
|
|
2675
|
-
const Wr = (e) => typeof e == "object";
|
|
2676
|
-
var G = (e) => !se(e) && !Array.isArray(e) && Wr(e) && !Ve(e), Pn = (e) => G(e) && e.target ? nt(e.target) ? e.target.checked : e.target.value : e, jn = (e) => e.substring(0, e.search(/\.\d+(\.|$)/)) || e, Bn = (e, r) => e.has(jn(r)), qn = (e) => {
|
|
2677
|
-
const r = e.constructor && e.constructor.prototype;
|
|
2678
|
-
return G(r) && r.hasOwnProperty("isPrototypeOf");
|
|
2679
|
-
}, Tt = typeof window < "u" && typeof window.HTMLElement < "u" && typeof document < "u";
|
|
2680
|
-
function H(e) {
|
|
2681
|
-
if (e instanceof Date)
|
|
2682
|
-
return new Date(e);
|
|
2683
|
-
const r = typeof FileList < "u" && e instanceof FileList;
|
|
2684
|
-
if (Tt && (e instanceof Blob || r))
|
|
2685
|
-
return e;
|
|
2686
|
-
const t = Array.isArray(e);
|
|
2687
|
-
if (!t && !(G(e) && qn(e)))
|
|
2688
|
-
return e;
|
|
2689
|
-
const s = t ? [] : Object.create(Object.getPrototypeOf(e));
|
|
2690
|
-
for (const n in e)
|
|
2691
|
-
Object.prototype.hasOwnProperty.call(e, n) && (s[n] = H(e[n]));
|
|
2692
|
-
return s;
|
|
2693
|
-
}
|
|
2694
|
-
var pt = (e) => /^\w*$/.test(e), U = (e) => e === void 0, Dt = (e) => Array.isArray(e) ? e.filter(Boolean) : [], Ot = (e) => Dt(e.replace(/["|']|\]/g, "").split(/\.|\[/)), I = (e, r, t) => {
|
|
2695
|
-
if (!r || !G(e))
|
|
2696
|
-
return t;
|
|
2697
|
-
const s = (pt(r) ? [r] : Ot(r)).reduce((n, i) => se(n) ? n : n[i], e);
|
|
2698
|
-
return U(s) || s === e ? U(e[r]) ? t : e[r] : s;
|
|
2699
|
-
}, ce = (e) => typeof e == "boolean", le = (e) => typeof e == "function", j = (e, r, t) => {
|
|
2700
|
-
let s = -1;
|
|
2701
|
-
const n = pt(r) ? [r] : Ot(r), i = n.length, a = i - 1;
|
|
2702
|
-
for (; ++s < i; ) {
|
|
2703
|
-
const o = n[s];
|
|
2704
|
-
let c = t;
|
|
2705
|
-
if (s !== a) {
|
|
2706
|
-
const h = e[o];
|
|
2707
|
-
c = G(h) || Array.isArray(h) ? h : isNaN(+n[s + 1]) ? {} : [];
|
|
2708
|
-
}
|
|
2709
|
-
if (o === "__proto__" || o === "constructor" || o === "prototype")
|
|
2710
|
-
return;
|
|
2711
|
-
e[o] = c, e = e[o];
|
|
2712
|
-
}
|
|
2713
|
-
};
|
|
2714
|
-
const rr = {
|
|
2715
|
-
BLUR: "blur",
|
|
2716
|
-
FOCUS_OUT: "focusout",
|
|
2717
|
-
CHANGE: "change"
|
|
2718
|
-
}, ue = {
|
|
2719
|
-
onBlur: "onBlur",
|
|
2720
|
-
onChange: "onChange",
|
|
2721
|
-
onSubmit: "onSubmit",
|
|
2722
|
-
onTouched: "onTouched",
|
|
2723
|
-
all: "all"
|
|
2724
|
-
}, ye = {
|
|
2725
|
-
max: "max",
|
|
2726
|
-
min: "min",
|
|
2727
|
-
maxLength: "maxLength",
|
|
2728
|
-
minLength: "minLength",
|
|
2729
|
-
pattern: "pattern",
|
|
2730
|
-
required: "required",
|
|
2731
|
-
validate: "validate"
|
|
2732
|
-
}, Un = te.createContext(null);
|
|
2733
|
-
Un.displayName = "HookFormControlContext";
|
|
2734
|
-
var zn = (e, r, t, s = !0) => {
|
|
2735
|
-
const n = {
|
|
2736
|
-
defaultValues: r._defaultValues
|
|
2737
|
-
};
|
|
2738
|
-
for (const i in e)
|
|
2739
|
-
Object.defineProperty(n, i, {
|
|
2740
|
-
get: () => {
|
|
2741
|
-
const a = i;
|
|
2742
|
-
return r._proxyFormState[a] !== ue.all && (r._proxyFormState[a] = !s || ue.all), t && (t[a] = !0), e[a];
|
|
2743
|
-
}
|
|
2744
|
-
});
|
|
2745
|
-
return n;
|
|
2746
|
-
};
|
|
2747
|
-
const Kn = typeof window < "u" ? te.useLayoutEffect : te.useEffect;
|
|
2748
|
-
var ae = (e) => typeof e == "string", Wn = (e, r, t, s, n) => ae(e) ? (s && r.watch.add(e), I(t, e, n)) : Array.isArray(e) ? e.map((i) => (s && r.watch.add(i), I(t, i))) : (s && (r.watchAll = !0), t), It = (e) => se(e) || !Wr(e);
|
|
2749
|
-
function ke(e, r, t = /* @__PURE__ */ new WeakSet()) {
|
|
2750
|
-
if (It(e) || It(r))
|
|
2751
|
-
return Object.is(e, r);
|
|
2752
|
-
if (Ve(e) && Ve(r))
|
|
2753
|
-
return Object.is(e.getTime(), r.getTime());
|
|
2754
|
-
const s = Object.keys(e), n = Object.keys(r);
|
|
2755
|
-
if (s.length !== n.length)
|
|
2756
|
-
return !1;
|
|
2757
|
-
if (t.has(e) || t.has(r))
|
|
2758
|
-
return !0;
|
|
2759
|
-
t.add(e), t.add(r);
|
|
2760
|
-
for (const i of s) {
|
|
2761
|
-
const a = e[i];
|
|
2762
|
-
if (!n.includes(i))
|
|
2763
|
-
return !1;
|
|
2764
|
-
if (i !== "ref") {
|
|
2765
|
-
const o = r[i];
|
|
2766
|
-
if (Ve(a) && Ve(o) || G(a) && G(o) || Array.isArray(a) && Array.isArray(o) ? !ke(a, o, t) : !Object.is(a, o))
|
|
2767
|
-
return !1;
|
|
2768
|
-
}
|
|
2769
|
-
}
|
|
2770
|
-
return !0;
|
|
2771
|
-
}
|
|
2772
|
-
const Gn = te.createContext(null);
|
|
2773
|
-
Gn.displayName = "HookFormContext";
|
|
2774
|
-
var Gr = (e, r, t, s, n) => r ? {
|
|
2775
|
-
...t[e],
|
|
2776
|
-
types: {
|
|
2777
|
-
...t[e] && t[e].types ? t[e].types : {},
|
|
2778
|
-
[s]: n || !0
|
|
2779
|
-
}
|
|
2780
|
-
} : {}, rt = (e) => Array.isArray(e) ? e : [e], sr = () => {
|
|
2781
|
-
let e = [];
|
|
2782
|
-
return {
|
|
2783
|
-
get observers() {
|
|
2784
|
-
return e;
|
|
2785
|
-
},
|
|
2786
|
-
next: (n) => {
|
|
2787
|
-
for (const i of e)
|
|
2788
|
-
i.next && i.next(n);
|
|
2789
|
-
},
|
|
2790
|
-
subscribe: (n) => (e.push(n), {
|
|
2791
|
-
unsubscribe: () => {
|
|
2792
|
-
e = e.filter((i) => i !== n);
|
|
2793
|
-
}
|
|
2794
|
-
}),
|
|
2795
|
-
unsubscribe: () => {
|
|
2796
|
-
e = [];
|
|
2797
|
-
}
|
|
2798
|
-
};
|
|
2799
|
-
};
|
|
2800
|
-
function Hr(e, r) {
|
|
2801
|
-
const t = {};
|
|
2802
|
-
for (const s in e)
|
|
2803
|
-
if (e.hasOwnProperty(s)) {
|
|
2804
|
-
const n = e[s], i = r[s];
|
|
2805
|
-
if (n && G(n) && i) {
|
|
2806
|
-
const a = Hr(n, i);
|
|
2807
|
-
G(a) && (t[s] = a);
|
|
2808
|
-
} else
|
|
2809
|
-
e[s] && (t[s] = i);
|
|
2810
|
-
}
|
|
2811
|
-
return t;
|
|
2812
|
-
}
|
|
2813
|
-
var re = (e) => G(e) && !Object.keys(e).length, Rt = (e) => e.type === "file", lt = (e) => {
|
|
2814
|
-
if (!Tt)
|
|
2815
|
-
return !1;
|
|
2816
|
-
const r = e ? e.ownerDocument : 0;
|
|
2817
|
-
return e instanceof (r && r.defaultView ? r.defaultView.HTMLElement : HTMLElement);
|
|
2818
|
-
}, Jr = (e) => e.type === "select-multiple", $t = (e) => e.type === "radio", Hn = (e) => $t(e) || nt(e), Ct = (e) => lt(e) && e.isConnected;
|
|
2819
|
-
function Jn(e, r) {
|
|
2820
|
-
const t = r.slice(0, -1).length;
|
|
2821
|
-
let s = 0;
|
|
2822
|
-
for (; s < t; )
|
|
2823
|
-
e = U(e) ? s++ : e[r[s++]];
|
|
2824
|
-
return e;
|
|
2825
|
-
}
|
|
2826
|
-
function Zn(e) {
|
|
2827
|
-
for (const r in e)
|
|
2828
|
-
if (e.hasOwnProperty(r) && !U(e[r]))
|
|
2829
|
-
return !1;
|
|
2830
|
-
return !0;
|
|
2831
|
-
}
|
|
2832
|
-
function W(e, r) {
|
|
2833
|
-
const t = Array.isArray(r) ? r : pt(r) ? [r] : Ot(r), s = t.length === 1 ? e : Jn(e, t), n = t.length - 1, i = t[n];
|
|
2834
|
-
return s && delete s[i], n !== 0 && (G(s) && re(s) || Array.isArray(s) && Zn(s)) && W(e, t.slice(0, -1)), e;
|
|
2835
|
-
}
|
|
2836
|
-
var Xn = (e) => {
|
|
2837
|
-
for (const r in e)
|
|
2838
|
-
if (le(e[r]))
|
|
2839
|
-
return !0;
|
|
2840
|
-
return !1;
|
|
2841
|
-
};
|
|
2842
|
-
function Zr(e) {
|
|
2843
|
-
return Array.isArray(e) || G(e) && !Xn(e);
|
|
2844
|
-
}
|
|
2845
|
-
function At(e, r = {}) {
|
|
2846
|
-
for (const t in e) {
|
|
2847
|
-
const s = e[t];
|
|
2848
|
-
Zr(s) ? (r[t] = Array.isArray(s) ? [] : {}, At(s, r[t])) : U(s) || (r[t] = !0);
|
|
2849
|
-
}
|
|
2850
|
-
return r;
|
|
2851
|
-
}
|
|
2852
|
-
function je(e, r, t) {
|
|
2853
|
-
t || (t = At(r));
|
|
2854
|
-
for (const s in e) {
|
|
2855
|
-
const n = e[s];
|
|
2856
|
-
if (Zr(n))
|
|
2857
|
-
U(r) || It(t[s]) ? t[s] = At(n, Array.isArray(n) ? [] : {}) : je(n, se(r) ? {} : r[s], t[s]);
|
|
2858
|
-
else {
|
|
2859
|
-
const i = r[s];
|
|
2860
|
-
t[s] = !ke(n, i);
|
|
2861
|
-
}
|
|
2862
|
-
}
|
|
2863
|
-
return t;
|
|
2864
|
-
}
|
|
2865
|
-
const nr = {
|
|
2866
|
-
value: !1,
|
|
2867
|
-
isValid: !1
|
|
2868
|
-
}, ar = { value: !0, isValid: !0 };
|
|
2869
|
-
var Xr = (e) => {
|
|
2870
|
-
if (Array.isArray(e)) {
|
|
2871
|
-
if (e.length > 1) {
|
|
2872
|
-
const r = e.filter((t) => t && t.checked && !t.disabled).map((t) => t.value);
|
|
2873
|
-
return { value: r, isValid: !!r.length };
|
|
2874
|
-
}
|
|
2875
|
-
return e[0].checked && !e[0].disabled ? (
|
|
2876
|
-
// @ts-expect-error expected to work in the browser
|
|
2877
|
-
e[0].attributes && !U(e[0].attributes.value) ? U(e[0].value) || e[0].value === "" ? ar : { value: e[0].value, isValid: !0 } : ar
|
|
2878
|
-
) : nr;
|
|
2879
|
-
}
|
|
2880
|
-
return nr;
|
|
2881
|
-
}, Yr = (e, { valueAsNumber: r, valueAsDate: t, setValueAs: s }) => U(e) ? e : r ? e === "" ? NaN : e && +e : t && ae(e) ? new Date(e) : s ? s(e) : e;
|
|
2882
|
-
const ir = {
|
|
2883
|
-
isValid: !1,
|
|
2884
|
-
value: null
|
|
2885
|
-
};
|
|
2886
|
-
var Qr = (e) => Array.isArray(e) ? e.reduce((r, t) => t && t.checked && !t.disabled ? {
|
|
2887
|
-
isValid: !0,
|
|
2888
|
-
value: t.value
|
|
2889
|
-
} : r, ir) : ir;
|
|
2890
|
-
function or(e) {
|
|
2891
|
-
const r = e.ref;
|
|
2892
|
-
return Rt(r) ? r.files : $t(r) ? Qr(e.refs).value : Jr(r) ? [...r.selectedOptions].map(({ value: t }) => t) : nt(r) ? Xr(e.refs).value : Yr(U(r.value) ? e.ref.value : r.value, e);
|
|
2893
|
-
}
|
|
2894
|
-
var Yn = (e, r, t, s) => {
|
|
2895
|
-
const n = {};
|
|
2896
|
-
for (const i of e) {
|
|
2897
|
-
const a = I(r, i);
|
|
2898
|
-
a && j(n, i, a._f);
|
|
2899
|
-
}
|
|
2900
|
-
return {
|
|
2901
|
-
criteriaMode: t,
|
|
2902
|
-
names: [...e],
|
|
2903
|
-
fields: n,
|
|
2904
|
-
shouldUseNativeValidation: s
|
|
2905
|
-
};
|
|
2906
|
-
}, ut = (e) => e instanceof RegExp, Xe = (e) => U(e) ? e : ut(e) ? e.source : G(e) ? ut(e.value) ? e.value.source : e.value : e, lr = (e) => ({
|
|
2907
|
-
isOnSubmit: !e || e === ue.onSubmit,
|
|
2908
|
-
isOnBlur: e === ue.onBlur,
|
|
2909
|
-
isOnChange: e === ue.onChange,
|
|
2910
|
-
isOnAll: e === ue.all,
|
|
2911
|
-
isOnTouch: e === ue.onTouched
|
|
2912
|
-
});
|
|
2913
|
-
const ur = "AsyncFunction";
|
|
2914
|
-
var Qn = (e) => !!e && !!e.validate && !!(le(e.validate) && e.validate.constructor.name === ur || G(e.validate) && Object.values(e.validate).find((r) => r.constructor.name === ur)), ea = (e) => e.mount && (e.required || e.min || e.max || e.maxLength || e.minLength || e.pattern || e.validate), cr = (e, r, t) => !t && (r.watchAll || r.watch.has(e) || [...r.watch].some((s) => e.startsWith(s) && /^\.\w+/.test(e.slice(s.length))));
|
|
2915
|
-
const st = (e, r, t, s) => {
|
|
2916
|
-
for (const n of t || Object.keys(e)) {
|
|
2917
|
-
const i = I(e, n);
|
|
2918
|
-
if (i) {
|
|
2919
|
-
const { _f: a, ...o } = i;
|
|
2920
|
-
if (a) {
|
|
2921
|
-
if (a.refs && a.refs[0] && r(a.refs[0], n) && !s)
|
|
2922
|
-
return !0;
|
|
2923
|
-
if (a.ref && r(a.ref, a.name) && !s)
|
|
2924
|
-
return !0;
|
|
2925
|
-
if (st(o, r))
|
|
2926
|
-
break;
|
|
2927
|
-
} else if (G(o) && st(o, r))
|
|
2928
|
-
break;
|
|
2929
|
-
}
|
|
2930
|
-
}
|
|
2931
|
-
};
|
|
2932
|
-
function dr(e, r, t) {
|
|
2933
|
-
const s = I(e, t);
|
|
2934
|
-
if (s || pt(t))
|
|
2935
|
-
return {
|
|
2936
|
-
error: s,
|
|
2937
|
-
name: t
|
|
2938
|
-
};
|
|
2939
|
-
const n = t.split(".");
|
|
2940
|
-
for (; n.length; ) {
|
|
2941
|
-
const i = n.join("."), a = I(r, i), o = I(e, i);
|
|
2942
|
-
if (a && !Array.isArray(a) && t !== i)
|
|
2943
|
-
return { name: t };
|
|
2944
|
-
if (o && o.type)
|
|
2945
|
-
return {
|
|
2946
|
-
name: i,
|
|
2947
|
-
error: o
|
|
2948
|
-
};
|
|
2949
|
-
if (o && o.root && o.root.type)
|
|
2950
|
-
return {
|
|
2951
|
-
name: `${i}.root`,
|
|
2952
|
-
error: o.root
|
|
2953
|
-
};
|
|
2954
|
-
n.pop();
|
|
2955
|
-
}
|
|
2956
|
-
return {
|
|
2957
|
-
name: t
|
|
2958
|
-
};
|
|
2959
|
-
}
|
|
2960
|
-
var ta = (e, r, t, s) => {
|
|
2961
|
-
t(e);
|
|
2962
|
-
const { name: n, ...i } = e;
|
|
2963
|
-
return re(i) || Object.keys(i).length >= Object.keys(r).length || Object.keys(i).find((a) => r[a] === (!s || ue.all));
|
|
2964
|
-
}, ra = (e, r, t) => !e || !r || e === r || rt(e).some((s) => s && (t ? s === r : s.startsWith(r) || r.startsWith(s))), sa = (e, r, t, s, n) => n.isOnAll ? !1 : !t && n.isOnTouch ? !(r || e) : (t ? s.isOnBlur : n.isOnBlur) ? !e : (t ? s.isOnChange : n.isOnChange) ? e : !0, na = (e, r) => !Dt(I(e, r)).length && W(e, r), aa = (e, r, t) => {
|
|
2965
|
-
const s = rt(I(e, t));
|
|
2966
|
-
return j(s, "root", r[t]), j(e, t, s), e;
|
|
2967
|
-
};
|
|
2968
|
-
function fr(e, r, t = "validate") {
|
|
2969
|
-
if (ae(e) || Array.isArray(e) && e.every(ae) || ce(e) && !e)
|
|
2970
|
-
return {
|
|
2971
|
-
type: t,
|
|
2972
|
-
message: ae(e) ? e : "",
|
|
2973
|
-
ref: r
|
|
2974
|
-
};
|
|
2975
|
-
}
|
|
2976
|
-
var Pe = (e) => G(e) && !ut(e) ? e : {
|
|
2977
|
-
value: e,
|
|
2978
|
-
message: ""
|
|
2979
|
-
}, hr = async (e, r, t, s, n, i) => {
|
|
2980
|
-
const { ref: a, refs: o, required: c, maxLength: h, minLength: v, min: g, max: p, pattern: m, validate: w, name: F, valueAsNumber: _, mount: S } = e._f, y = I(t, F);
|
|
2981
|
-
if (!S || r.has(F))
|
|
2982
|
-
return {};
|
|
2983
|
-
const C = o ? o[0] : a, A = (M) => {
|
|
2984
|
-
n && C.reportValidity && (C.setCustomValidity(ce(M) ? "" : M || ""), C.reportValidity());
|
|
2985
|
-
}, E = {}, R = $t(a), K = nt(a), D = R || K, q = (_ || Rt(a)) && U(a.value) && U(y) || lt(a) && a.value === "" || y === "" || Array.isArray(y) && !y.length, O = Gr.bind(null, F, s, E), J = (M, L, N, z = ye.maxLength, Z = ye.minLength) => {
|
|
2986
|
-
const X = M ? L : N;
|
|
2987
|
-
E[F] = {
|
|
2988
|
-
type: M ? z : Z,
|
|
2989
|
-
message: X,
|
|
2990
|
-
ref: a,
|
|
2991
|
-
...O(M ? z : Z, X)
|
|
2992
|
-
};
|
|
2993
|
-
};
|
|
2994
|
-
if (i ? !Array.isArray(y) || !y.length : c && (!D && (q || se(y)) || ce(y) && !y || K && !Xr(o).isValid || R && !Qr(o).isValid)) {
|
|
2995
|
-
const { value: M, message: L } = ae(c) ? { value: !!c, message: c } : Pe(c);
|
|
2996
|
-
if (M && (E[F] = {
|
|
2997
|
-
type: ye.required,
|
|
2998
|
-
message: L,
|
|
2999
|
-
ref: C,
|
|
3000
|
-
...O(ye.required, L)
|
|
3001
|
-
}, !s))
|
|
3002
|
-
return A(L), E;
|
|
3003
|
-
}
|
|
3004
|
-
if (!q && (!se(g) || !se(p))) {
|
|
3005
|
-
let M, L;
|
|
3006
|
-
const N = Pe(p), z = Pe(g);
|
|
3007
|
-
if (!se(y) && !isNaN(y)) {
|
|
3008
|
-
const Z = a.valueAsNumber || y && +y;
|
|
3009
|
-
se(N.value) || (M = Z > N.value), se(z.value) || (L = Z < z.value);
|
|
3010
|
-
} else {
|
|
3011
|
-
const Z = a.valueAsDate || new Date(y), X = (xe) => /* @__PURE__ */ new Date((/* @__PURE__ */ new Date()).toDateString() + " " + xe), oe = a.type == "time", Ne = a.type == "week";
|
|
3012
|
-
ae(N.value) && y && (M = oe ? X(y) > X(N.value) : Ne ? y > N.value : Z > new Date(N.value)), ae(z.value) && y && (L = oe ? X(y) < X(z.value) : Ne ? y < z.value : Z < new Date(z.value));
|
|
3013
|
-
}
|
|
3014
|
-
if ((M || L) && (J(!!M, N.message, z.message, ye.max, ye.min), !s))
|
|
3015
|
-
return A(E[F].message), E;
|
|
3016
|
-
}
|
|
3017
|
-
if ((h || v) && !q && (ae(y) || i && Array.isArray(y))) {
|
|
3018
|
-
const M = Pe(h), L = Pe(v), N = !se(M.value) && y.length > +M.value, z = !se(L.value) && y.length < +L.value;
|
|
3019
|
-
if ((N || z) && (J(N, M.message, L.message), !s))
|
|
3020
|
-
return A(E[F].message), E;
|
|
3021
|
-
}
|
|
3022
|
-
if (m && !q && ae(y)) {
|
|
3023
|
-
const { value: M, message: L } = Pe(m);
|
|
3024
|
-
if (ut(M) && !y.match(M) && (E[F] = {
|
|
3025
|
-
type: ye.pattern,
|
|
3026
|
-
message: L,
|
|
3027
|
-
ref: a,
|
|
3028
|
-
...O(ye.pattern, L)
|
|
3029
|
-
}, !s))
|
|
3030
|
-
return A(L), E;
|
|
3031
|
-
}
|
|
3032
|
-
if (w) {
|
|
3033
|
-
if (le(w)) {
|
|
3034
|
-
const M = await w(y, t), L = fr(M, C);
|
|
3035
|
-
if (L && (E[F] = {
|
|
3036
|
-
...L,
|
|
3037
|
-
...O(ye.validate, L.message)
|
|
3038
|
-
}, !s))
|
|
3039
|
-
return A(L.message), E;
|
|
3040
|
-
} else if (G(w)) {
|
|
3041
|
-
let M = {};
|
|
3042
|
-
for (const L in w) {
|
|
3043
|
-
if (!re(M) && !s)
|
|
3044
|
-
break;
|
|
3045
|
-
const N = fr(await w[L](y, t), C, L);
|
|
3046
|
-
N && (M = {
|
|
3047
|
-
...N,
|
|
3048
|
-
...O(L, N.message)
|
|
3049
|
-
}, A(N.message), s && (E[F] = M));
|
|
3050
|
-
}
|
|
3051
|
-
if (!re(M) && (E[F] = {
|
|
3052
|
-
ref: C,
|
|
3053
|
-
...M
|
|
3054
|
-
}, !s))
|
|
3055
|
-
return E;
|
|
3056
|
-
}
|
|
3057
|
-
}
|
|
3058
|
-
return A(!0), E;
|
|
3059
|
-
};
|
|
3060
|
-
const ia = {
|
|
3061
|
-
mode: ue.onSubmit,
|
|
3062
|
-
reValidateMode: ue.onChange,
|
|
3063
|
-
shouldFocusError: !0
|
|
3064
|
-
};
|
|
3065
|
-
function oa(e = {}) {
|
|
3066
|
-
let r = {
|
|
3067
|
-
...ia,
|
|
3068
|
-
...e
|
|
3069
|
-
}, t = {
|
|
3070
|
-
submitCount: 0,
|
|
3071
|
-
isDirty: !1,
|
|
3072
|
-
isReady: !1,
|
|
3073
|
-
isLoading: le(r.defaultValues),
|
|
3074
|
-
isValidating: !1,
|
|
3075
|
-
isSubmitted: !1,
|
|
3076
|
-
isSubmitting: !1,
|
|
3077
|
-
isSubmitSuccessful: !1,
|
|
3078
|
-
isValid: !1,
|
|
3079
|
-
touchedFields: {},
|
|
3080
|
-
dirtyFields: {},
|
|
3081
|
-
validatingFields: {},
|
|
3082
|
-
errors: r.errors || {},
|
|
3083
|
-
disabled: r.disabled || !1
|
|
3084
|
-
}, s = {}, n = G(r.defaultValues) || G(r.values) ? H(r.defaultValues || r.values) || {} : {}, i = r.shouldUnregister ? {} : H(n), a = {
|
|
3085
|
-
action: !1,
|
|
3086
|
-
mount: !1,
|
|
3087
|
-
watch: !1,
|
|
3088
|
-
keepIsValid: !1
|
|
3089
|
-
}, o = {
|
|
3090
|
-
mount: /* @__PURE__ */ new Set(),
|
|
3091
|
-
disabled: /* @__PURE__ */ new Set(),
|
|
3092
|
-
unMount: /* @__PURE__ */ new Set(),
|
|
3093
|
-
array: /* @__PURE__ */ new Set(),
|
|
3094
|
-
watch: /* @__PURE__ */ new Set()
|
|
3095
|
-
}, c, h = 0;
|
|
3096
|
-
const v = {
|
|
3097
|
-
isDirty: !1,
|
|
3098
|
-
dirtyFields: !1,
|
|
3099
|
-
validatingFields: !1,
|
|
3100
|
-
touchedFields: !1,
|
|
3101
|
-
isValidating: !1,
|
|
3102
|
-
isValid: !1,
|
|
3103
|
-
errors: !1
|
|
3104
|
-
}, g = {
|
|
3105
|
-
...v
|
|
3106
|
-
};
|
|
3107
|
-
let p = {
|
|
3108
|
-
...g
|
|
3109
|
-
};
|
|
3110
|
-
const m = {
|
|
3111
|
-
array: sr(),
|
|
3112
|
-
state: sr()
|
|
3113
|
-
}, w = r.criteriaMode === ue.all, F = (l) => (d) => {
|
|
3114
|
-
clearTimeout(h), h = setTimeout(l, d);
|
|
3115
|
-
}, _ = async (l) => {
|
|
3116
|
-
if (!a.keepIsValid && !r.disabled && (g.isValid || p.isValid || l)) {
|
|
3117
|
-
let d;
|
|
3118
|
-
r.resolver ? (d = re((await D()).errors), S()) : d = await O(s, !0), d !== t.isValid && m.state.next({
|
|
3119
|
-
isValid: d
|
|
3120
|
-
});
|
|
3121
|
-
}
|
|
3122
|
-
}, S = (l, d) => {
|
|
3123
|
-
!r.disabled && (g.isValidating || g.validatingFields || p.isValidating || p.validatingFields) && ((l || Array.from(o.mount)).forEach((f) => {
|
|
3124
|
-
f && (d ? j(t.validatingFields, f, d) : W(t.validatingFields, f));
|
|
3125
|
-
}), m.state.next({
|
|
3126
|
-
validatingFields: t.validatingFields,
|
|
3127
|
-
isValidating: !re(t.validatingFields)
|
|
3128
|
-
}));
|
|
3129
|
-
}, y = (l, d = [], f, k, x = !0, b = !0) => {
|
|
3130
|
-
if (k && f && !r.disabled) {
|
|
3131
|
-
if (a.action = !0, b && Array.isArray(I(s, l))) {
|
|
3132
|
-
const V = f(I(s, l), k.argA, k.argB);
|
|
3133
|
-
x && j(s, l, V);
|
|
3134
|
-
}
|
|
3135
|
-
if (b && Array.isArray(I(t.errors, l))) {
|
|
3136
|
-
const V = f(I(t.errors, l), k.argA, k.argB);
|
|
3137
|
-
x && j(t.errors, l, V), na(t.errors, l);
|
|
3138
|
-
}
|
|
3139
|
-
if ((g.touchedFields || p.touchedFields) && b && Array.isArray(I(t.touchedFields, l))) {
|
|
3140
|
-
const V = f(I(t.touchedFields, l), k.argA, k.argB);
|
|
3141
|
-
x && j(t.touchedFields, l, V);
|
|
3142
|
-
}
|
|
3143
|
-
(g.dirtyFields || p.dirtyFields) && (t.dirtyFields = je(n, i)), m.state.next({
|
|
3144
|
-
name: l,
|
|
3145
|
-
isDirty: M(l, d),
|
|
3146
|
-
dirtyFields: t.dirtyFields,
|
|
3147
|
-
errors: t.errors,
|
|
3148
|
-
isValid: t.isValid
|
|
3149
|
-
});
|
|
3150
|
-
} else
|
|
3151
|
-
j(i, l, d);
|
|
3152
|
-
}, C = (l, d) => {
|
|
3153
|
-
j(t.errors, l, d), m.state.next({
|
|
3154
|
-
errors: t.errors
|
|
3155
|
-
});
|
|
3156
|
-
}, A = (l) => {
|
|
3157
|
-
t.errors = l, m.state.next({
|
|
3158
|
-
errors: t.errors,
|
|
3159
|
-
isValid: !1
|
|
3160
|
-
});
|
|
3161
|
-
}, E = (l, d, f, k) => {
|
|
3162
|
-
const x = I(s, l);
|
|
3163
|
-
if (x) {
|
|
3164
|
-
const b = I(i, l, U(f) ? I(n, l) : f);
|
|
3165
|
-
U(b) || k && k.defaultChecked || d ? j(i, l, d ? b : or(x._f)) : z(l, b), a.mount && !a.action && _();
|
|
3166
|
-
}
|
|
3167
|
-
}, R = (l, d, f, k, x) => {
|
|
3168
|
-
let b = !1, V = !1;
|
|
3169
|
-
const $ = {
|
|
3170
|
-
name: l
|
|
3171
|
-
};
|
|
3172
|
-
if (!r.disabled) {
|
|
3173
|
-
if (!f || k) {
|
|
3174
|
-
(g.isDirty || p.isDirty) && (V = t.isDirty, t.isDirty = $.isDirty = M(), b = V !== $.isDirty);
|
|
3175
|
-
const P = ke(I(n, l), d);
|
|
3176
|
-
V = !!I(t.dirtyFields, l), P ? W(t.dirtyFields, l) : j(t.dirtyFields, l, !0), $.dirtyFields = t.dirtyFields, b = b || (g.dirtyFields || p.dirtyFields) && V !== !P;
|
|
3177
|
-
}
|
|
3178
|
-
if (f) {
|
|
3179
|
-
const P = I(t.touchedFields, l);
|
|
3180
|
-
P || (j(t.touchedFields, l, f), $.touchedFields = t.touchedFields, b = b || (g.touchedFields || p.touchedFields) && P !== f);
|
|
3181
|
-
}
|
|
3182
|
-
b && x && m.state.next($);
|
|
3183
|
-
}
|
|
3184
|
-
return b ? $ : {};
|
|
3185
|
-
}, K = (l, d, f, k) => {
|
|
3186
|
-
const x = I(t.errors, l), b = (g.isValid || p.isValid) && ce(d) && t.isValid !== d;
|
|
3187
|
-
if (r.delayError && f ? (c = F(() => C(l, f)), c(r.delayError)) : (clearTimeout(h), c = null, f ? j(t.errors, l, f) : W(t.errors, l)), (f ? !ke(x, f) : x) || !re(k) || b) {
|
|
3188
|
-
const V = {
|
|
3189
|
-
...k,
|
|
3190
|
-
...b && ce(d) ? { isValid: d } : {},
|
|
3191
|
-
errors: t.errors,
|
|
3192
|
-
name: l
|
|
3193
|
-
};
|
|
3194
|
-
t = {
|
|
3195
|
-
...t,
|
|
3196
|
-
...V
|
|
3197
|
-
}, m.state.next(V);
|
|
3198
|
-
}
|
|
3199
|
-
}, D = async (l) => (S(l, !0), await r.resolver(i, r.context, Yn(l || o.mount, s, r.criteriaMode, r.shouldUseNativeValidation))), q = async (l) => {
|
|
3200
|
-
const { errors: d } = await D(l);
|
|
3201
|
-
if (S(l), l)
|
|
3202
|
-
for (const f of l) {
|
|
3203
|
-
const k = I(d, f);
|
|
3204
|
-
k ? j(t.errors, f, k) : W(t.errors, f);
|
|
3205
|
-
}
|
|
3206
|
-
else
|
|
3207
|
-
t.errors = d;
|
|
3208
|
-
return d;
|
|
3209
|
-
}, O = async (l, d, f = {
|
|
3210
|
-
valid: !0
|
|
3211
|
-
}) => {
|
|
3212
|
-
for (const k in l) {
|
|
3213
|
-
const x = l[k];
|
|
3214
|
-
if (x) {
|
|
3215
|
-
const { _f: b, ...V } = x;
|
|
3216
|
-
if (b) {
|
|
3217
|
-
const $ = o.array.has(b.name), P = x._f && Qn(x._f);
|
|
3218
|
-
P && g.validatingFields && S([b.name], !0);
|
|
3219
|
-
const ee = await hr(x, o.disabled, i, w, r.shouldUseNativeValidation && !d, $);
|
|
3220
|
-
if (P && g.validatingFields && S([b.name]), ee[b.name] && (f.valid = !1, d || e.shouldUseNativeValidation))
|
|
3221
|
-
break;
|
|
3222
|
-
!d && (I(ee, b.name) ? $ ? aa(t.errors, ee, b.name) : j(t.errors, b.name, ee[b.name]) : W(t.errors, b.name));
|
|
3223
|
-
}
|
|
3224
|
-
!re(V) && await O(V, d, f);
|
|
3225
|
-
}
|
|
3226
|
-
}
|
|
3227
|
-
return f.valid;
|
|
3228
|
-
}, J = () => {
|
|
3229
|
-
for (const l of o.unMount) {
|
|
3230
|
-
const d = I(s, l);
|
|
3231
|
-
d && (d._f.refs ? d._f.refs.every((f) => !Ct(f)) : !Ct(d._f.ref)) && De(l);
|
|
3232
|
-
}
|
|
3233
|
-
o.unMount = /* @__PURE__ */ new Set();
|
|
3234
|
-
}, M = (l, d) => !r.disabled && (l && d && j(i, l, d), !ke(Le(), n)), L = (l, d, f) => Wn(l, o, {
|
|
3235
|
-
...a.mount ? i : U(d) ? n : ae(l) ? { [l]: d } : d
|
|
3236
|
-
}, f, d), N = (l) => Dt(I(a.mount ? i : n, l, r.shouldUnregister ? I(n, l, []) : [])), z = (l, d, f = {}) => {
|
|
3237
|
-
const k = I(s, l);
|
|
3238
|
-
let x = d;
|
|
3239
|
-
if (k) {
|
|
3240
|
-
const b = k._f;
|
|
3241
|
-
b && (!b.disabled && j(i, l, Yr(d, b)), x = lt(b.ref) && se(d) ? "" : d, Jr(b.ref) ? [...b.ref.options].forEach((V) => V.selected = x.includes(V.value)) : b.refs ? nt(b.ref) ? b.refs.forEach((V) => {
|
|
3242
|
-
(!V.defaultChecked || !V.disabled) && (Array.isArray(x) ? V.checked = !!x.find(($) => $ === V.value) : V.checked = x === V.value || !!x);
|
|
3243
|
-
}) : b.refs.forEach((V) => V.checked = V.value === x) : Rt(b.ref) ? b.ref.value = "" : (b.ref.value = x, b.ref.type || m.state.next({
|
|
3244
|
-
name: l,
|
|
3245
|
-
values: H(i)
|
|
3246
|
-
})));
|
|
3247
|
-
}
|
|
3248
|
-
(f.shouldDirty || f.shouldTouch) && R(l, x, f.shouldTouch, f.shouldDirty, !0), f.shouldValidate && xe(l);
|
|
3249
|
-
}, Z = (l, d, f) => {
|
|
3250
|
-
for (const k in d) {
|
|
3251
|
-
if (!d.hasOwnProperty(k))
|
|
3252
|
-
return;
|
|
3253
|
-
const x = d[k], b = l + "." + k, V = I(s, b);
|
|
3254
|
-
(o.array.has(l) || G(x) || V && !V._f) && !Ve(x) ? Z(b, x, f) : z(b, x, f);
|
|
3255
|
-
}
|
|
3256
|
-
}, X = (l, d, f = {}) => {
|
|
3257
|
-
const k = I(s, l), x = o.array.has(l), b = H(d);
|
|
3258
|
-
j(i, l, b), x ? (m.array.next({
|
|
3259
|
-
name: l,
|
|
3260
|
-
values: H(i)
|
|
3261
|
-
}), (g.isDirty || g.dirtyFields || p.isDirty || p.dirtyFields) && f.shouldDirty && m.state.next({
|
|
3262
|
-
name: l,
|
|
3263
|
-
dirtyFields: je(n, i),
|
|
3264
|
-
isDirty: M(l, b)
|
|
3265
|
-
})) : k && !k._f && !se(b) ? Z(l, b, f) : z(l, b, f), cr(l, o) ? m.state.next({
|
|
3266
|
-
...t,
|
|
3267
|
-
name: l,
|
|
3268
|
-
values: H(i)
|
|
3269
|
-
}) : m.state.next({
|
|
3270
|
-
name: a.mount ? l : void 0,
|
|
3271
|
-
values: H(i)
|
|
3272
|
-
});
|
|
3273
|
-
}, oe = async (l) => {
|
|
3274
|
-
a.mount = !0;
|
|
3275
|
-
const d = l.target;
|
|
3276
|
-
let f = d.name, k = !0;
|
|
3277
|
-
const x = I(s, f), b = (P) => {
|
|
3278
|
-
k = Number.isNaN(P) || Ve(P) && isNaN(P.getTime()) || ke(P, I(i, f, P));
|
|
3279
|
-
}, V = lr(r.mode), $ = lr(r.reValidateMode);
|
|
3280
|
-
if (x) {
|
|
3281
|
-
let P, ee;
|
|
3282
|
-
const Fe = d.type ? or(x._f) : Pn(l), _e = l.type === rr.BLUR || l.type === rr.FOCUS_OUT, ss = !ea(x._f) && !r.resolver && !I(t.errors, f) && !x._f.deps || sa(_e, I(t.touchedFields, f), t.isSubmitted, $, V), gt = cr(f, o, _e);
|
|
3283
|
-
j(i, f, Fe), _e ? (!d || !d.readOnly) && (x._f.onBlur && x._f.onBlur(l), c && c(0)) : x._f.onChange && x._f.onChange(l);
|
|
3284
|
-
const bt = R(f, Fe, _e), ns = !re(bt) || gt;
|
|
3285
|
-
if (!_e && m.state.next({
|
|
3286
|
-
name: f,
|
|
3287
|
-
type: l.type,
|
|
3288
|
-
values: H(i)
|
|
3289
|
-
}), ss)
|
|
3290
|
-
return (g.isValid || p.isValid) && (r.mode === "onBlur" ? _e && _() : _e || _()), ns && m.state.next({ name: f, ...gt ? {} : bt });
|
|
3291
|
-
if (!_e && gt && m.state.next({ ...t }), r.resolver) {
|
|
3292
|
-
const { errors: qt } = await D([f]);
|
|
3293
|
-
if (S([f]), b(Fe), k) {
|
|
3294
|
-
const as = dr(t.errors, s, f), Ut = dr(qt, s, as.name || f);
|
|
3295
|
-
P = Ut.error, f = Ut.name, ee = re(qt);
|
|
3296
|
-
}
|
|
3297
|
-
} else
|
|
3298
|
-
S([f], !0), P = (await hr(x, o.disabled, i, w, r.shouldUseNativeValidation))[f], S([f]), b(Fe), k && (P ? ee = !1 : (g.isValid || p.isValid) && (ee = await O(s, !0)));
|
|
3299
|
-
k && (x._f.deps && (!Array.isArray(x._f.deps) || x._f.deps.length > 0) && xe(x._f.deps), K(f, ee, P, bt));
|
|
3300
|
-
}
|
|
3301
|
-
}, Ne = (l, d) => {
|
|
3302
|
-
if (I(t.errors, d) && l.focus)
|
|
3303
|
-
return l.focus(), 1;
|
|
3304
|
-
}, xe = async (l, d = {}) => {
|
|
3305
|
-
let f, k;
|
|
3306
|
-
const x = rt(l);
|
|
3307
|
-
if (r.resolver) {
|
|
3308
|
-
const b = await q(U(l) ? l : x);
|
|
3309
|
-
f = re(b), k = l ? !x.some((V) => I(b, V)) : f;
|
|
3310
|
-
} else
|
|
3311
|
-
l ? (k = (await Promise.all(x.map(async (b) => {
|
|
3312
|
-
const V = I(s, b);
|
|
3313
|
-
return await O(V && V._f ? { [b]: V } : V);
|
|
3314
|
-
}))).every(Boolean), !(!k && !t.isValid) && _()) : k = f = await O(s);
|
|
3315
|
-
return m.state.next({
|
|
3316
|
-
...!ae(l) || (g.isValid || p.isValid) && f !== t.isValid ? {} : { name: l },
|
|
3317
|
-
...r.resolver || !l ? { isValid: f } : {},
|
|
3318
|
-
errors: t.errors
|
|
3319
|
-
}), d.shouldFocus && !k && st(s, Ne, l ? x : o.mount), k;
|
|
3320
|
-
}, Le = (l, d) => {
|
|
3321
|
-
let f = {
|
|
3322
|
-
...a.mount ? i : n
|
|
3323
|
-
};
|
|
3324
|
-
return d && (f = Hr(d.dirtyFields ? t.dirtyFields : t.touchedFields, f)), U(l) ? f : ae(l) ? I(f, l) : l.map((k) => I(f, k));
|
|
3325
|
-
}, Ae = (l, d) => ({
|
|
3326
|
-
invalid: !!I((d || t).errors, l),
|
|
3327
|
-
isDirty: !!I((d || t).dirtyFields, l),
|
|
3328
|
-
error: I((d || t).errors, l),
|
|
3329
|
-
isValidating: !!I(t.validatingFields, l),
|
|
3330
|
-
isTouched: !!I((d || t).touchedFields, l)
|
|
3331
|
-
}), Te = (l) => {
|
|
3332
|
-
const d = l ? rt(l) : void 0;
|
|
3333
|
-
d == null || d.forEach((f) => W(t.errors, f)), d ? d.forEach((f) => {
|
|
3334
|
-
m.state.next({
|
|
3335
|
-
name: f,
|
|
3336
|
-
errors: t.errors
|
|
3337
|
-
});
|
|
3338
|
-
}) : m.state.next({
|
|
3339
|
-
errors: {}
|
|
3340
|
-
});
|
|
3341
|
-
}, He = (l, d, f) => {
|
|
3342
|
-
const k = (I(s, l, { _f: {} })._f || {}).ref, x = I(t.errors, l) || {}, { ref: b, message: V, type: $, ...P } = x;
|
|
3343
|
-
j(t.errors, l, {
|
|
3344
|
-
...P,
|
|
3345
|
-
...d,
|
|
3346
|
-
ref: k
|
|
3347
|
-
}), m.state.next({
|
|
3348
|
-
name: l,
|
|
3349
|
-
errors: t.errors,
|
|
3350
|
-
isValid: !1
|
|
3351
|
-
}), f && f.shouldFocus && k && k.focus && k.focus();
|
|
3352
|
-
}, at = (l, d) => le(l) ? m.state.subscribe({
|
|
3353
|
-
next: (f) => "values" in f && l(L(void 0, d), f)
|
|
3354
|
-
}) : L(l, d, !0), Je = (l) => m.state.subscribe({
|
|
3355
|
-
next: (d) => {
|
|
3356
|
-
ra(l.name, d.name, l.exact) && ta(d, l.formState || g, rs, l.reRenderRoot) && l.callback({
|
|
3357
|
-
values: { ...i },
|
|
3358
|
-
...t,
|
|
3359
|
-
...d,
|
|
3360
|
-
defaultValues: n
|
|
3361
|
-
});
|
|
3362
|
-
}
|
|
3363
|
-
}).unsubscribe, it = (l) => (a.mount = !0, p = {
|
|
3364
|
-
...p,
|
|
3365
|
-
...l.formState
|
|
3366
|
-
}, Je({
|
|
3367
|
-
...l,
|
|
3368
|
-
formState: {
|
|
3369
|
-
...v,
|
|
3370
|
-
...l.formState
|
|
3371
|
-
}
|
|
3372
|
-
})), De = (l, d = {}) => {
|
|
3373
|
-
for (const f of l ? rt(l) : o.mount)
|
|
3374
|
-
o.mount.delete(f), o.array.delete(f), d.keepValue || (W(s, f), W(i, f)), !d.keepError && W(t.errors, f), !d.keepDirty && W(t.dirtyFields, f), !d.keepTouched && W(t.touchedFields, f), !d.keepIsValidating && W(t.validatingFields, f), !r.shouldUnregister && !d.keepDefaultValue && W(n, f);
|
|
3375
|
-
m.state.next({
|
|
3376
|
-
values: H(i)
|
|
3377
|
-
}), m.state.next({
|
|
3378
|
-
...t,
|
|
3379
|
-
...d.keepDirty ? { isDirty: M() } : {}
|
|
3380
|
-
}), !d.keepIsValid && _();
|
|
3381
|
-
}, Ze = ({ disabled: l, name: d }) => {
|
|
3382
|
-
if (ce(l) && a.mount || l || o.disabled.has(d)) {
|
|
3383
|
-
const x = o.disabled.has(d) !== !!l;
|
|
3384
|
-
l ? o.disabled.add(d) : o.disabled.delete(d), x && a.mount && !a.action && _();
|
|
3385
|
-
}
|
|
3386
|
-
}, Oe = (l, d = {}) => {
|
|
3387
|
-
let f = I(s, l);
|
|
3388
|
-
const k = ce(d.disabled) || ce(r.disabled);
|
|
3389
|
-
return j(s, l, {
|
|
3390
|
-
...f || {},
|
|
3391
|
-
_f: {
|
|
3392
|
-
...f && f._f ? f._f : { ref: { name: l } },
|
|
3393
|
-
name: l,
|
|
3394
|
-
mount: !0,
|
|
3395
|
-
...d
|
|
3396
|
-
}
|
|
3397
|
-
}), o.mount.add(l), f ? Ze({
|
|
3398
|
-
disabled: ce(d.disabled) ? d.disabled : r.disabled,
|
|
3399
|
-
name: l
|
|
3400
|
-
}) : E(l, !0, d.value), {
|
|
3401
|
-
...k ? { disabled: d.disabled || r.disabled } : {},
|
|
3402
|
-
...r.progressive ? {
|
|
3403
|
-
required: !!d.required,
|
|
3404
|
-
min: Xe(d.min),
|
|
3405
|
-
max: Xe(d.max),
|
|
3406
|
-
minLength: Xe(d.minLength),
|
|
3407
|
-
maxLength: Xe(d.maxLength),
|
|
3408
|
-
pattern: Xe(d.pattern)
|
|
3409
|
-
} : {},
|
|
3410
|
-
name: l,
|
|
3411
|
-
onChange: oe,
|
|
3412
|
-
onBlur: oe,
|
|
3413
|
-
ref: (x) => {
|
|
3414
|
-
if (x) {
|
|
3415
|
-
Oe(l, d), f = I(s, l);
|
|
3416
|
-
const b = U(x.value) && x.querySelectorAll && x.querySelectorAll("input,select,textarea")[0] || x, V = Hn(b), $ = f._f.refs || [];
|
|
3417
|
-
if (V ? $.find((P) => P === b) : b === f._f.ref)
|
|
3418
|
-
return;
|
|
3419
|
-
j(s, l, {
|
|
3420
|
-
_f: {
|
|
3421
|
-
...f._f,
|
|
3422
|
-
...V ? {
|
|
3423
|
-
refs: [
|
|
3424
|
-
...$.filter(Ct),
|
|
3425
|
-
b,
|
|
3426
|
-
...Array.isArray(I(n, l)) ? [{}] : []
|
|
3427
|
-
],
|
|
3428
|
-
ref: { type: b.type, name: l }
|
|
3429
|
-
} : { ref: b }
|
|
3430
|
-
}
|
|
3431
|
-
}), E(l, !1, void 0, b);
|
|
3432
|
-
} else
|
|
3433
|
-
f = I(s, l, {}), f._f && (f._f.mount = !1), (r.shouldUnregister || d.shouldUnregister) && !(Bn(o.array, l) && a.action) && o.unMount.add(l);
|
|
3434
|
-
}
|
|
3435
|
-
};
|
|
3436
|
-
}, T = () => r.shouldFocusError && st(s, Ne, o.mount), Re = (l) => {
|
|
3437
|
-
ce(l) && (m.state.next({ disabled: l }), st(s, (d, f) => {
|
|
3438
|
-
const k = I(s, f);
|
|
3439
|
-
k && (d.disabled = k._f.disabled || l, Array.isArray(k._f.refs) && k._f.refs.forEach((x) => {
|
|
3440
|
-
x.disabled = k._f.disabled || l;
|
|
3441
|
-
}));
|
|
3442
|
-
}, 0, !1));
|
|
3443
|
-
}, $e = (l, d) => async (f) => {
|
|
3444
|
-
let k;
|
|
3445
|
-
f && (f.preventDefault && f.preventDefault(), f.persist && f.persist());
|
|
3446
|
-
let x = H(i);
|
|
3447
|
-
if (m.state.next({
|
|
3448
|
-
isSubmitting: !0
|
|
3449
|
-
}), r.resolver) {
|
|
3450
|
-
const { errors: b, values: V } = await D();
|
|
3451
|
-
S(), t.errors = b, x = H(V);
|
|
3452
|
-
} else
|
|
3453
|
-
await O(s);
|
|
3454
|
-
if (o.disabled.size)
|
|
3455
|
-
for (const b of o.disabled)
|
|
3456
|
-
W(x, b);
|
|
3457
|
-
if (W(t.errors, "root"), re(t.errors)) {
|
|
3458
|
-
m.state.next({
|
|
3459
|
-
errors: {}
|
|
3460
|
-
});
|
|
3461
|
-
try {
|
|
3462
|
-
await l(x, f);
|
|
3463
|
-
} catch (b) {
|
|
3464
|
-
k = b;
|
|
3465
|
-
}
|
|
3466
|
-
} else
|
|
3467
|
-
d && await d({ ...t.errors }, f), T(), setTimeout(T);
|
|
3468
|
-
if (m.state.next({
|
|
3469
|
-
isSubmitted: !0,
|
|
3470
|
-
isSubmitting: !1,
|
|
3471
|
-
isSubmitSuccessful: re(t.errors) && !k,
|
|
3472
|
-
submitCount: t.submitCount + 1,
|
|
3473
|
-
errors: t.errors
|
|
3474
|
-
}), k)
|
|
3475
|
-
throw k;
|
|
3476
|
-
}, we = (l, d = {}) => {
|
|
3477
|
-
I(s, l) && (U(d.defaultValue) ? X(l, H(I(n, l))) : (X(l, d.defaultValue), j(n, l, H(d.defaultValue))), d.keepTouched || W(t.touchedFields, l), d.keepDirty || (W(t.dirtyFields, l), t.isDirty = d.defaultValue ? M(l, H(I(n, l))) : M()), d.keepError || (W(t.errors, l), g.isValid && _()), m.state.next({ ...t }));
|
|
3478
|
-
}, Pt = (l, d = {}) => {
|
|
3479
|
-
const f = l ? H(l) : n, k = H(f), x = re(l), b = x ? n : k;
|
|
3480
|
-
if (d.keepDefaultValues || (n = f), !d.keepValues) {
|
|
3481
|
-
if (d.keepDirtyValues) {
|
|
3482
|
-
const V = /* @__PURE__ */ new Set([
|
|
3483
|
-
...o.mount,
|
|
3484
|
-
...Object.keys(je(n, i))
|
|
3485
|
-
]);
|
|
3486
|
-
for (const $ of Array.from(V)) {
|
|
3487
|
-
const P = I(t.dirtyFields, $), ee = I(i, $), Fe = I(b, $);
|
|
3488
|
-
P && !U(ee) ? j(b, $, ee) : !P && !U(Fe) && X($, Fe);
|
|
3489
|
-
}
|
|
3490
|
-
} else {
|
|
3491
|
-
if (Tt && U(l))
|
|
3492
|
-
for (const V of o.mount) {
|
|
3493
|
-
const $ = I(s, V);
|
|
3494
|
-
if ($ && $._f) {
|
|
3495
|
-
const P = Array.isArray($._f.refs) ? $._f.refs[0] : $._f.ref;
|
|
3496
|
-
if (lt(P)) {
|
|
3497
|
-
const ee = P.closest("form");
|
|
3498
|
-
if (ee) {
|
|
3499
|
-
ee.reset();
|
|
3500
|
-
break;
|
|
3501
|
-
}
|
|
3502
|
-
}
|
|
3503
|
-
}
|
|
3504
|
-
}
|
|
3505
|
-
if (d.keepFieldsRef)
|
|
3506
|
-
for (const V of o.mount)
|
|
3507
|
-
X(V, I(b, V));
|
|
3508
|
-
else
|
|
3509
|
-
s = {};
|
|
3510
|
-
}
|
|
3511
|
-
i = r.shouldUnregister ? d.keepDefaultValues ? H(n) : {} : H(b), m.array.next({
|
|
3512
|
-
values: { ...b }
|
|
3513
|
-
}), m.state.next({
|
|
3514
|
-
values: { ...b }
|
|
3515
|
-
});
|
|
3516
|
-
}
|
|
3517
|
-
o = {
|
|
3518
|
-
mount: d.keepDirtyValues ? o.mount : /* @__PURE__ */ new Set(),
|
|
3519
|
-
unMount: /* @__PURE__ */ new Set(),
|
|
3520
|
-
array: /* @__PURE__ */ new Set(),
|
|
3521
|
-
disabled: /* @__PURE__ */ new Set(),
|
|
3522
|
-
watch: /* @__PURE__ */ new Set(),
|
|
3523
|
-
watchAll: !1,
|
|
3524
|
-
focus: ""
|
|
3525
|
-
}, a.mount = !g.isValid || !!d.keepIsValid || !!d.keepDirtyValues || !r.shouldUnregister && !re(b), a.watch = !!r.shouldUnregister, a.keepIsValid = !!d.keepIsValid, a.action = !1, d.keepErrors || (t.errors = {}), m.state.next({
|
|
3526
|
-
submitCount: d.keepSubmitCount ? t.submitCount : 0,
|
|
3527
|
-
isDirty: x ? !1 : d.keepDirty ? t.isDirty : !!(d.keepDefaultValues && !ke(l, n)),
|
|
3528
|
-
isSubmitted: d.keepIsSubmitted ? t.isSubmitted : !1,
|
|
3529
|
-
dirtyFields: x ? {} : d.keepDirtyValues ? d.keepDefaultValues && i ? je(n, i) : t.dirtyFields : d.keepDefaultValues && l ? je(n, l) : d.keepDirty ? t.dirtyFields : {},
|
|
3530
|
-
touchedFields: d.keepTouched ? t.touchedFields : {},
|
|
3531
|
-
errors: d.keepErrors ? t.errors : {},
|
|
3532
|
-
isSubmitSuccessful: d.keepIsSubmitSuccessful ? t.isSubmitSuccessful : !1,
|
|
3533
|
-
isSubmitting: !1,
|
|
3534
|
-
defaultValues: n
|
|
3535
|
-
});
|
|
3536
|
-
}, jt = (l, d) => Pt(le(l) ? l(i) : l, { ...r.resetOptions, ...d }), ts = (l, d = {}) => {
|
|
3537
|
-
const f = I(s, l), k = f && f._f;
|
|
3538
|
-
if (k) {
|
|
3539
|
-
const x = k.refs ? k.refs[0] : k.ref;
|
|
3540
|
-
x.focus && setTimeout(() => {
|
|
3541
|
-
x.focus(), d.shouldSelect && le(x.select) && x.select();
|
|
3542
|
-
});
|
|
3543
|
-
}
|
|
3544
|
-
}, rs = (l) => {
|
|
3545
|
-
t = {
|
|
3546
|
-
...t,
|
|
3547
|
-
...l
|
|
3548
|
-
};
|
|
3549
|
-
}, Bt = {
|
|
3550
|
-
control: {
|
|
3551
|
-
register: Oe,
|
|
3552
|
-
unregister: De,
|
|
3553
|
-
getFieldState: Ae,
|
|
3554
|
-
handleSubmit: $e,
|
|
3555
|
-
setError: He,
|
|
3556
|
-
_subscribe: Je,
|
|
3557
|
-
_runSchema: D,
|
|
3558
|
-
_updateIsValidating: S,
|
|
3559
|
-
_focusError: T,
|
|
3560
|
-
_getWatch: L,
|
|
3561
|
-
_getDirty: M,
|
|
3562
|
-
_setValid: _,
|
|
3563
|
-
_setFieldArray: y,
|
|
3564
|
-
_setDisabledField: Ze,
|
|
3565
|
-
_setErrors: A,
|
|
3566
|
-
_getFieldArray: N,
|
|
3567
|
-
_reset: Pt,
|
|
3568
|
-
_resetDefaultValues: () => le(r.defaultValues) && r.defaultValues().then((l) => {
|
|
3569
|
-
jt(l, r.resetOptions), m.state.next({
|
|
3570
|
-
isLoading: !1
|
|
3571
|
-
});
|
|
3572
|
-
}),
|
|
3573
|
-
_removeUnmounted: J,
|
|
3574
|
-
_disableForm: Re,
|
|
3575
|
-
_subjects: m,
|
|
3576
|
-
_proxyFormState: g,
|
|
3577
|
-
get _fields() {
|
|
3578
|
-
return s;
|
|
3579
|
-
},
|
|
3580
|
-
get _formValues() {
|
|
3581
|
-
return i;
|
|
3582
|
-
},
|
|
3583
|
-
get _state() {
|
|
3584
|
-
return a;
|
|
3585
|
-
},
|
|
3586
|
-
set _state(l) {
|
|
3587
|
-
a = l;
|
|
3588
|
-
},
|
|
3589
|
-
get _defaultValues() {
|
|
3590
|
-
return n;
|
|
3591
|
-
},
|
|
3592
|
-
get _names() {
|
|
3593
|
-
return o;
|
|
3594
|
-
},
|
|
3595
|
-
set _names(l) {
|
|
3596
|
-
o = l;
|
|
3597
|
-
},
|
|
3598
|
-
get _formState() {
|
|
3599
|
-
return t;
|
|
3600
|
-
},
|
|
3601
|
-
get _options() {
|
|
3602
|
-
return r;
|
|
3603
|
-
},
|
|
3604
|
-
set _options(l) {
|
|
3605
|
-
r = {
|
|
3606
|
-
...r,
|
|
3607
|
-
...l
|
|
3608
|
-
};
|
|
3609
|
-
}
|
|
3610
|
-
},
|
|
3611
|
-
subscribe: it,
|
|
3612
|
-
trigger: xe,
|
|
3613
|
-
register: Oe,
|
|
3614
|
-
handleSubmit: $e,
|
|
3615
|
-
watch: at,
|
|
3616
|
-
setValue: X,
|
|
3617
|
-
getValues: Le,
|
|
3618
|
-
reset: jt,
|
|
3619
|
-
resetField: we,
|
|
3620
|
-
clearErrors: Te,
|
|
3621
|
-
unregister: De,
|
|
3622
|
-
setError: He,
|
|
3623
|
-
setFocus: ts,
|
|
3624
|
-
getFieldState: Ae
|
|
3625
|
-
};
|
|
3626
|
-
return {
|
|
3627
|
-
...Bt,
|
|
3628
|
-
formControl: Bt
|
|
3629
|
-
};
|
|
3630
|
-
}
|
|
3631
|
-
function mt(e = {}) {
|
|
3632
|
-
const r = te.useRef(void 0), t = te.useRef(void 0), [s, n] = te.useState({
|
|
3633
|
-
isDirty: !1,
|
|
3634
|
-
isValidating: !1,
|
|
3635
|
-
isLoading: le(e.defaultValues),
|
|
3636
|
-
isSubmitted: !1,
|
|
3637
|
-
isSubmitting: !1,
|
|
3638
|
-
isSubmitSuccessful: !1,
|
|
3639
|
-
isValid: !1,
|
|
3640
|
-
submitCount: 0,
|
|
3641
|
-
dirtyFields: {},
|
|
3642
|
-
touchedFields: {},
|
|
3643
|
-
validatingFields: {},
|
|
3644
|
-
errors: e.errors || {},
|
|
3645
|
-
disabled: e.disabled || !1,
|
|
3646
|
-
isReady: !1,
|
|
3647
|
-
defaultValues: le(e.defaultValues) ? void 0 : e.defaultValues
|
|
3648
|
-
});
|
|
3649
|
-
if (!r.current)
|
|
3650
|
-
if (e.formControl)
|
|
3651
|
-
r.current = {
|
|
3652
|
-
...e.formControl,
|
|
3653
|
-
formState: s
|
|
3654
|
-
}, e.defaultValues && !le(e.defaultValues) && e.formControl.reset(e.defaultValues, e.resetOptions);
|
|
3655
|
-
else {
|
|
3656
|
-
const { formControl: a, ...o } = oa(e);
|
|
3657
|
-
r.current = {
|
|
3658
|
-
...o,
|
|
3659
|
-
formState: s
|
|
3660
|
-
};
|
|
3661
|
-
}
|
|
3662
|
-
const i = r.current.control;
|
|
3663
|
-
return i._options = e, Kn(() => {
|
|
3664
|
-
const a = i._subscribe({
|
|
3665
|
-
formState: i._proxyFormState,
|
|
3666
|
-
callback: () => n({ ...i._formState }),
|
|
3667
|
-
reRenderRoot: !0
|
|
3668
|
-
});
|
|
3669
|
-
return n((o) => ({
|
|
3670
|
-
...o,
|
|
3671
|
-
isReady: !0
|
|
3672
|
-
})), i._formState.isReady = !0, a;
|
|
3673
|
-
}, [i]), te.useEffect(() => i._disableForm(e.disabled), [i, e.disabled]), te.useEffect(() => {
|
|
3674
|
-
e.mode && (i._options.mode = e.mode), e.reValidateMode && (i._options.reValidateMode = e.reValidateMode);
|
|
3675
|
-
}, [i, e.mode, e.reValidateMode]), te.useEffect(() => {
|
|
3676
|
-
e.errors && (i._setErrors(e.errors), i._focusError());
|
|
3677
|
-
}, [i, e.errors]), te.useEffect(() => {
|
|
3678
|
-
e.shouldUnregister && i._subjects.state.next({
|
|
3679
|
-
values: i._getWatch()
|
|
3680
|
-
});
|
|
3681
|
-
}, [i, e.shouldUnregister]), te.useEffect(() => {
|
|
3682
|
-
if (i._proxyFormState.isDirty) {
|
|
3683
|
-
const a = i._getDirty();
|
|
3684
|
-
a !== s.isDirty && i._subjects.state.next({
|
|
3685
|
-
isDirty: a
|
|
3686
|
-
});
|
|
3687
|
-
}
|
|
3688
|
-
}, [i, s.isDirty]), te.useEffect(() => {
|
|
3689
|
-
var a;
|
|
3690
|
-
e.values && !ke(e.values, t.current) ? (i._reset(e.values, {
|
|
3691
|
-
keepFieldsRef: !0,
|
|
3692
|
-
...i._options.resetOptions
|
|
3693
|
-
}), !((a = i._options.resetOptions) === null || a === void 0) && a.keepIsValid || i._setValid(), t.current = e.values, n((o) => ({ ...o }))) : i._resetDefaultValues();
|
|
3694
|
-
}, [i, e.values]), te.useEffect(() => {
|
|
3695
|
-
i._state.mount || (i._setValid(), i._state.mount = !0), i._state.watch && (i._state.watch = !1, i._subjects.state.next({ ...i._formState })), i._removeUnmounted();
|
|
3696
|
-
}), r.current.formState = te.useMemo(() => zn(s, i), [i, s]), r.current;
|
|
3697
|
-
}
|
|
3698
|
-
const pr = (e, r, t) => {
|
|
3699
|
-
if (e && "reportValidity" in e) {
|
|
3700
|
-
const s = I(t, r);
|
|
3701
|
-
e.setCustomValidity(s && s.message || ""), e.reportValidity();
|
|
3702
|
-
}
|
|
3703
|
-
}, la = (e, r) => {
|
|
3704
|
-
for (const t in r.fields) {
|
|
3705
|
-
const s = r.fields[t];
|
|
3706
|
-
s && s.ref && "reportValidity" in s.ref ? pr(s.ref, t, e) : s.refs && s.refs.forEach((n) => pr(n, t, e));
|
|
3707
|
-
}
|
|
3708
|
-
}, ua = (e, r) => {
|
|
3709
|
-
r.shouldUseNativeValidation && la(e, r);
|
|
3710
|
-
const t = {};
|
|
3711
|
-
for (const s in e) {
|
|
3712
|
-
const n = I(r.fields, s), i = Object.assign(e[s] || {}, { ref: n && n.ref });
|
|
3713
|
-
if (ca(r.names || Object.keys(e), s)) {
|
|
3714
|
-
const a = Object.assign({}, I(t, s));
|
|
3715
|
-
j(a, "root", i), j(t, s, a);
|
|
3716
|
-
} else
|
|
3717
|
-
j(t, s, i);
|
|
3718
|
-
}
|
|
3719
|
-
return t;
|
|
3720
|
-
}, ca = (e, r) => e.some((t) => t.startsWith(r + "."));
|
|
3721
|
-
var yt = function(e, r, t) {
|
|
3722
|
-
return t === void 0 && (t = {}), function(s, n, i) {
|
|
3723
|
-
try {
|
|
3724
|
-
var a = !i.shouldUseNativeValidation && i.criteriaMode === "all";
|
|
3725
|
-
return Promise.resolve(/* @__PURE__ */ wn(e, s, Object.assign({}, r, { abortPipeEarly: !a }))).then(function(o) {
|
|
3726
|
-
if (o.issues) {
|
|
3727
|
-
for (var c = {}; o.issues.length; ) {
|
|
3728
|
-
var h = o.issues[0], v = /* @__PURE__ */ pn(h);
|
|
3729
|
-
if (v && (c[v] || (c[v] = { message: h.message, type: h.type }), a)) {
|
|
3730
|
-
var g = c[v].types, p = g && g[h.type];
|
|
3731
|
-
c[v] = Gr(v, a, c, h.type, p ? [].concat(p, h.message) : h.message);
|
|
3732
|
-
}
|
|
3733
|
-
o.issues.shift();
|
|
3734
|
-
}
|
|
3735
|
-
return { values: {}, errors: ua(c, i) };
|
|
3736
|
-
}
|
|
3737
|
-
return { values: t.raw ? s : o.output, errors: {} };
|
|
3738
|
-
});
|
|
3739
|
-
} catch (o) {
|
|
3740
|
-
return Promise.reject(o);
|
|
3741
|
-
}
|
|
3742
|
-
};
|
|
3743
|
-
};
|
|
3744
|
-
const mr = 27, yr = 12, gr = 10, da = We("enum"), fa = (e, r) => {
|
|
3745
|
-
const t = {
|
|
3746
|
-
min: e.minSelected ?? 0,
|
|
3747
|
-
max: e.maxSelected ?? e.options.length
|
|
3748
|
-
};
|
|
3749
|
-
return yt(/* @__PURE__ */ be({
|
|
3750
|
-
checked: /* @__PURE__ */ Ce(/* @__PURE__ */ Br(/* @__PURE__ */ ie(), /* @__PURE__ */ $r()), /* @__PURE__ */ Mt((s) => Object.entries(s).filter(([n, i]) => i).map(([n, i]) => n)), /* @__PURE__ */ et(t.max, r("validation_multiple_choice_max", {
|
|
3751
|
-
count: t.max
|
|
3752
|
-
})), /* @__PURE__ */ qe(t.min, r("validation_multiple_choice_min", {
|
|
3753
|
-
count: t.min
|
|
3754
|
-
})))
|
|
3755
|
-
}));
|
|
3756
|
-
}, ha = Ir(({
|
|
3757
|
-
option: e,
|
|
3758
|
-
...r
|
|
3759
|
-
}, t) => u(ve, {
|
|
3760
|
-
children: [u("input", {
|
|
3761
|
-
class: "peer sr-only h-full",
|
|
3762
|
-
type: "checkbox",
|
|
3763
|
-
...r,
|
|
3764
|
-
ref: t
|
|
3765
|
-
}), u("label", {
|
|
3766
|
-
class: "bg-lowest hover:bg-neutral-2 active:outline-neutral-8 ease-expo-out outline-divider text-neutral-11 peer-checked:outline-accent-7 peer-checked:bg-accent-2 peer-checked:text-accent-9 peer-focus-visible:ring-accent-9 peer-focus-visible:ring-offset-accent-7 block cursor-pointer select-none rounded-2xl px-3 py-1.5 outline outline-1 ring-0 ring-transparent transition-all selection:bg-transparent peer-focus-visible:ring-4",
|
|
3767
|
-
htmlFor: r.id,
|
|
3768
|
-
children: e.label
|
|
3769
|
-
})]
|
|
3770
|
-
})), br = dt("gutter-stable flex w-full flex-1 flex-wrap gap-2 overflow-y-auto rounded-xl p-2.5 pr-4", {
|
|
3771
|
-
variants: {
|
|
3772
|
-
variant: {
|
|
3773
|
-
// In cases where there is only one option, we want to center it
|
|
3774
|
-
singleOption: "justify-center",
|
|
3775
|
-
// Two choices with exactly 1 min 1 max
|
|
3776
|
-
booleanLike: Ur
|
|
3777
|
-
}
|
|
3778
|
-
}
|
|
3779
|
-
}), pa = ({
|
|
3780
|
-
input: e,
|
|
3781
|
-
onSubmitSuccess: r
|
|
3782
|
-
}) => {
|
|
3783
|
-
var v, g;
|
|
3784
|
-
const t = e.key ? (v = B.current$.value.flow) == null ? void 0 : v.data.submissions[e.key] : void 0, s = (e.config.minSelected === 1 || e.config.minSelected === void 0) && e.config.maxSelected === 1, n = s && e.config.options.length === 2, {
|
|
3785
|
-
t: i
|
|
3786
|
-
} = Q(), {
|
|
3787
|
-
register: a,
|
|
3788
|
-
handleSubmit: o,
|
|
3789
|
-
formState: {
|
|
3790
|
-
errors: c
|
|
3791
|
-
}
|
|
3792
|
-
} = mt({
|
|
3793
|
-
defaultValues: {
|
|
3794
|
-
checked: s ? {} : da(t) ? Object.fromEntries(t.value.map((p) => [p, !0])) : {}
|
|
3795
|
-
},
|
|
3796
|
-
resolver: fa(e.config, i)
|
|
3797
|
-
}), h = Lt();
|
|
3798
|
-
return n ? u("ul", {
|
|
3799
|
-
style: {
|
|
3800
|
-
maxHeight: 6.5 * mr + 5 * yr + 2 * gr
|
|
3801
|
-
},
|
|
3802
|
-
class: br({
|
|
3803
|
-
variant: "booleanLike"
|
|
3804
|
-
}),
|
|
3805
|
-
children: e.config.options.map((p, m) => u("li", {
|
|
3806
|
-
class: zr,
|
|
3807
|
-
children: u(Kr, {
|
|
3808
|
-
type: "submit",
|
|
3809
|
-
ref: (w) => {
|
|
3810
|
-
w && m === 0 && (h.current = w);
|
|
3811
|
-
},
|
|
3812
|
-
label: p.label,
|
|
3813
|
-
value: "true",
|
|
3814
|
-
onClick: () => r({
|
|
3815
|
-
type: "enum",
|
|
3816
|
-
value: [p.value]
|
|
3817
|
-
})
|
|
3818
|
-
})
|
|
3819
|
-
}, p.value))
|
|
3820
|
-
}) : u("form", {
|
|
3821
|
-
noValidate: !0,
|
|
3822
|
-
onSubmit: (p) => o((m) => {
|
|
3823
|
-
const w = m.checked;
|
|
3824
|
-
r({
|
|
3825
|
-
type: "enum",
|
|
3826
|
-
value: w
|
|
3827
|
-
});
|
|
3828
|
-
})(p),
|
|
3829
|
-
children: [u("div", {
|
|
3830
|
-
class: "flex items-center gap-1",
|
|
3831
|
-
children: [u("ul", {
|
|
3832
|
-
style: {
|
|
3833
|
-
maxHeight: 6.5 * mr + 5 * yr + 2 * gr
|
|
3834
|
-
},
|
|
3835
|
-
class: br({
|
|
3836
|
-
variant: e.config.options.length === 1 ? "singleOption" : void 0
|
|
3837
|
-
}),
|
|
3838
|
-
children: e.config.options.map((p, m) => {
|
|
3839
|
-
const w = `checked.${p.value}`, {
|
|
3840
|
-
ref: F,
|
|
3841
|
-
..._
|
|
3842
|
-
} = a(w);
|
|
3843
|
-
return u("li", {
|
|
3844
|
-
class: "relative",
|
|
3845
|
-
children: u(ha, {
|
|
3846
|
-
option: p,
|
|
3847
|
-
autoFocus: m === 0,
|
|
3848
|
-
ref: (S) => {
|
|
3849
|
-
S && m === 0 && (h.current = S), F(S);
|
|
3850
|
-
},
|
|
3851
|
-
id: w,
|
|
3852
|
-
..._,
|
|
3853
|
-
onClick: s ? () => r({
|
|
3854
|
-
type: "enum",
|
|
3855
|
-
value: [p.value]
|
|
3856
|
-
}) : void 0
|
|
3857
|
-
})
|
|
3858
|
-
}, p.value);
|
|
3859
|
-
})
|
|
3860
|
-
}), u("div", {
|
|
3861
|
-
class: "flex flex-col items-center gap-2 pr-2.5 pt-2.5",
|
|
3862
|
-
children: [s ? null : u(Me, {}), e.config.minSelected === 0 && u(Ie, {
|
|
3863
|
-
class: "relative",
|
|
3864
|
-
type: "button",
|
|
3865
|
-
onClick: () => r({
|
|
3866
|
-
type: "enum",
|
|
3867
|
-
value: []
|
|
3868
|
-
})
|
|
3869
|
-
})]
|
|
3870
|
-
})]
|
|
3871
|
-
}), u("div", {
|
|
3872
|
-
class: "px-1",
|
|
3873
|
-
children: u(Ge, {
|
|
3874
|
-
error: (g = c.checked) == null ? void 0 : g.root
|
|
3875
|
-
})
|
|
3876
|
-
})]
|
|
3877
|
-
});
|
|
3878
|
-
}, ma = We("number"), ya = (e, r) => {
|
|
3879
|
-
const t = e.min ?? Number.MIN_SAFE_INTEGER, s = e.max ?? Number.MAX_SAFE_INTEGER, n = e.decimalCases ?? 0;
|
|
3880
|
-
return yt(/* @__PURE__ */ be({
|
|
3881
|
-
number: /* @__PURE__ */ Ce(/* @__PURE__ */ Pr(r("validation_number")), /* @__PURE__ */ Tr(t, r("validation_number_min", {
|
|
3882
|
-
min: t
|
|
3883
|
-
})), /* @__PURE__ */ Lr(s, r("validation_number_max", {
|
|
3884
|
-
max: s
|
|
3885
|
-
})), /* @__PURE__ */ Mr((i) => i === Number(i.toFixed(n)), r("validation_number_decimal_cases", {
|
|
3886
|
-
count: n
|
|
3887
|
-
})))
|
|
3888
|
-
}));
|
|
3889
|
-
}, ga = ({
|
|
3890
|
-
input: e,
|
|
3891
|
-
onSubmitSuccess: r
|
|
3892
|
-
}) => {
|
|
3893
|
-
var g;
|
|
3894
|
-
const t = e.config.defaultValue, s = e.key ? (g = B.current$.value.flow) == null ? void 0 : g.data.submissions[e.key] : void 0, {
|
|
3895
|
-
t: n
|
|
3896
|
-
} = Q(), {
|
|
3897
|
-
register: i,
|
|
3898
|
-
handleSubmit: a,
|
|
3899
|
-
formState: {
|
|
3900
|
-
errors: o
|
|
3901
|
-
}
|
|
3902
|
-
} = mt({
|
|
3903
|
-
defaultValues: {
|
|
3904
|
-
number: ma(s) ? s.value : t ? Number(t) : void 0
|
|
3905
|
-
},
|
|
3906
|
-
resolver: ya(e.config, n)
|
|
3907
|
-
}), {
|
|
3908
|
-
ref: c,
|
|
3909
|
-
...h
|
|
3910
|
-
} = i("number", {
|
|
3911
|
-
required: !e.config.optional,
|
|
3912
|
-
valueAsNumber: !0
|
|
3913
|
-
}), v = de();
|
|
3914
|
-
return Se(() => {
|
|
3915
|
-
v.current && (v.current.focus(), v.current.select());
|
|
3916
|
-
}, []), u("form", {
|
|
3917
|
-
class: "flex flex-col gap-1 p-2.5",
|
|
3918
|
-
onSubmit: a((p) => {
|
|
3919
|
-
p.number !== void 0 && r({
|
|
3920
|
-
type: "number",
|
|
3921
|
-
value: p.number
|
|
3922
|
-
});
|
|
3923
|
-
}),
|
|
3924
|
-
children: [u("div", {
|
|
3925
|
-
class: "flex items-center gap-2",
|
|
3926
|
-
children: [u("div", {
|
|
3927
|
-
class: "relative min-w-0 flex-grow",
|
|
3928
|
-
children: [u("input", {
|
|
3929
|
-
...h,
|
|
3930
|
-
id: "chat-input",
|
|
3931
|
-
autocomplete: "off",
|
|
3932
|
-
autoCapitalize: "off",
|
|
3933
|
-
autoCorrect: "off",
|
|
3934
|
-
autoFocus: !0,
|
|
3935
|
-
ref: (p) => {
|
|
3936
|
-
p && (v.current = p), c(p);
|
|
3937
|
-
},
|
|
3938
|
-
type: "text",
|
|
3939
|
-
min: e.config.min,
|
|
3940
|
-
max: e.config.max,
|
|
3941
|
-
class: ze({
|
|
3942
|
-
optional: e.config.optional,
|
|
3943
|
-
className: "[type=number:-webkit-inner-spin-button] w-full rounded-full [-webkit-outer-spin-button:none]"
|
|
3944
|
-
}),
|
|
3945
|
-
placeholder: e.config.placeholder
|
|
3946
|
-
}), e.config.optional && u(Ie, {
|
|
3947
|
-
class: "absolute bottom-0 right-0.5 top-0",
|
|
3948
|
-
onClick: () => r(null)
|
|
3949
|
-
})]
|
|
3950
|
-
}), u(Me, {})]
|
|
3951
|
-
}), u(Ge, {
|
|
3952
|
-
error: o.number
|
|
3953
|
-
})]
|
|
3954
|
-
});
|
|
3955
|
-
}, ba = (e) => {
|
|
3956
|
-
if (e === "")
|
|
3957
|
-
return {
|
|
3958
|
-
countryCode: "",
|
|
3959
|
-
phoneNumber: ""
|
|
3960
|
-
};
|
|
3961
|
-
const r = Object.entries(Nt).find((n) => e.startsWith(n[1])), t = r ? r[1] : "", s = e.replace(t, "");
|
|
3962
|
-
return /^\d+$/.test(s) ? {
|
|
3963
|
-
countryCode: t,
|
|
3964
|
-
phoneNumber: s
|
|
3965
|
-
} : {
|
|
3966
|
-
countryCode: "",
|
|
3967
|
-
phoneNumber: ""
|
|
3968
|
-
};
|
|
3969
|
-
}, va = "44", xa = /^[0-9 ]+$/, wa = We("string"), _a = We("phone"), ka = (e) => {
|
|
3970
|
-
const r = /* @__PURE__ */ Ce(/* @__PURE__ */ ie(e("validation_country_code")), /* @__PURE__ */ Et(xa, e("validation_country_code"))), t = /* @__PURE__ */ Ce(/* @__PURE__ */ ie(e("validation_phone")), /* @__PURE__ */ qe(1, e("validation_phone")), /* @__PURE__ */ Mt((s) => s.replace(/[^0-9]/g, "")));
|
|
3971
|
-
return yt(/* @__PURE__ */ be({
|
|
3972
|
-
countryCode: r,
|
|
3973
|
-
phoneNumber: t
|
|
3974
|
-
}));
|
|
3975
|
-
}, Ca = ({
|
|
3976
|
-
input: e,
|
|
3977
|
-
onSubmitSuccess: r
|
|
3978
|
-
}) => {
|
|
3979
|
-
var F;
|
|
3980
|
-
const t = e.key ? (F = B.current$.value.flow) == null ? void 0 : F.data.submissions[e.key] : void 0, {
|
|
3981
|
-
t: s
|
|
3982
|
-
} = Q(), [n, i] = ge(), a = wa(t) ? ba(t.value) : _a(t) ? t.value : void 0, {
|
|
3983
|
-
register: o,
|
|
3984
|
-
handleSubmit: c,
|
|
3985
|
-
formState: {
|
|
3986
|
-
errors: h
|
|
3987
|
-
},
|
|
3988
|
-
watch: v
|
|
3989
|
-
} = mt({
|
|
3990
|
-
defaultValues: {
|
|
3991
|
-
countryCode: (a == null ? void 0 : a.countryCode) ?? e.config.defaultValue.countryCode ?? va,
|
|
3992
|
-
phoneNumber: (a == null ? void 0 : a.phoneNumber) ?? e.config.defaultValue.phoneNumber ?? ""
|
|
3993
|
-
},
|
|
3994
|
-
resolver: ka(s)
|
|
3995
|
-
}), {
|
|
3996
|
-
ref: g,
|
|
3997
|
-
...p
|
|
3998
|
-
} = o("phoneNumber", {
|
|
3999
|
-
required: !e.config.optional
|
|
4000
|
-
}), m = de(), w = v("countryCode");
|
|
4001
|
-
return Se(() => {
|
|
4002
|
-
m.current && (m.current.focus(), m.current.select());
|
|
4003
|
-
}, []), u("form", {
|
|
4004
|
-
noValidate: !0,
|
|
4005
|
-
class: "flex flex-col gap-1 p-2.5",
|
|
4006
|
-
onSubmit: c((_) => {
|
|
4007
|
-
const S = _.phoneNumber.replace(/[^0-9]/g, ""), y = _.countryCode.replace(/[^0-9]/g, "");
|
|
4008
|
-
i(void 0);
|
|
4009
|
-
const C = e.config.minChars ?? 7, A = S.length + y.length;
|
|
4010
|
-
if (A < C)
|
|
4011
|
-
return i(s("validation_phone_min_chars", {
|
|
4012
|
-
count: C
|
|
4013
|
-
}));
|
|
4014
|
-
const E = e.config.maxChars;
|
|
4015
|
-
if (E != null && A > E)
|
|
4016
|
-
return i(s("validation_max_chars", {
|
|
4017
|
-
count: E
|
|
4018
|
-
}));
|
|
4019
|
-
e.config.submissionFormat === "phone" ? r({
|
|
4020
|
-
type: "phone",
|
|
4021
|
-
value: {
|
|
4022
|
-
countryCode: y,
|
|
4023
|
-
phoneNumber: S
|
|
4024
|
-
}
|
|
4025
|
-
}) : r({
|
|
4026
|
-
type: "string",
|
|
4027
|
-
value: w + _.phoneNumber
|
|
4028
|
-
});
|
|
4029
|
-
}),
|
|
4030
|
-
children: [u("div", {
|
|
4031
|
-
class: "flex items-center gap-2",
|
|
4032
|
-
children: [u("div", {
|
|
4033
|
-
class: "relative flex min-w-0 flex-1 flex-grow gap-2",
|
|
4034
|
-
children: [u("label", {
|
|
4035
|
-
class: "text-neutral-12 bg-lowest hover:bg-neutral-5 placeholder:text-neutral-8 focus-visible:outline-accent-7 focus-within:bg-neutral-5 focus-within:outline-accent-7 outline-divider relative flex h-full cursor-pointer appearance-none items-center justify-center overflow-hidden text-ellipsis whitespace-nowrap rounded-l-full border-solid px-3 py-1.5 text-center text-base outline outline-2 transition-all focus-within:outline-none",
|
|
4036
|
-
htmlFor: `isdk_phone_${e.key}`,
|
|
4037
|
-
children: [u("span", {
|
|
4038
|
-
children: ["+", w]
|
|
4039
|
-
}), u("select", {
|
|
4040
|
-
...o("countryCode", {}),
|
|
4041
|
-
id: `isdk_phone_${e.key}`,
|
|
4042
|
-
class: "absolute inset-0 opacity-0",
|
|
4043
|
-
children: Object.entries(Nt).map(([_, S]) => u("option", {
|
|
4044
|
-
value: S,
|
|
4045
|
-
children: [_, " (+", S, ")"]
|
|
4046
|
-
}, _))
|
|
4047
|
-
})]
|
|
4048
|
-
}), u("input", {
|
|
4049
|
-
...p,
|
|
4050
|
-
id: "chat-input",
|
|
4051
|
-
type: "tel",
|
|
4052
|
-
inputMode: "tel",
|
|
4053
|
-
autocomplete: "off",
|
|
4054
|
-
autoCapitalize: "off",
|
|
4055
|
-
autoCorrect: "off",
|
|
4056
|
-
autoFocus: !0,
|
|
4057
|
-
ref: (_) => {
|
|
4058
|
-
_ && (m.current = _), g(_);
|
|
4059
|
-
},
|
|
4060
|
-
class: ze({
|
|
4061
|
-
optional: e.config.optional,
|
|
4062
|
-
className: "min-w-0 flex-1 rounded-r-full"
|
|
4063
|
-
}),
|
|
4064
|
-
placeholder: e.config.placeholder
|
|
4065
|
-
}), e.config.optional && u(Ie, {
|
|
4066
|
-
class: "absolute bottom-0 right-1 top-0",
|
|
4067
|
-
onClick: () => r(null)
|
|
4068
|
-
})]
|
|
4069
|
-
}), u(Me, {})]
|
|
4070
|
-
}), u(Ge, {
|
|
4071
|
-
error: h.countryCode || h.phoneNumber || {
|
|
4072
|
-
message: n
|
|
4073
|
-
}
|
|
4074
|
-
})]
|
|
4075
|
-
});
|
|
4076
|
-
}, ot = (e) => e === void 0 ? 0 : Math.max(0, Math.ceil((e - Date.now()) / 1e3)), Sa = ({
|
|
4077
|
-
input: e,
|
|
4078
|
-
onSubmitSuccess: r
|
|
4079
|
-
}) => {
|
|
4080
|
-
const {
|
|
4081
|
-
t
|
|
4082
|
-
} = Q(), {
|
|
4083
|
-
availableAt: s
|
|
4084
|
-
} = e.config, [n, i] = ge(() => ot(s)), [a, o] = ge("");
|
|
4085
|
-
Sr(() => {
|
|
4086
|
-
const h = ot(s);
|
|
4087
|
-
if (i(h), h === 0)
|
|
4088
|
-
return;
|
|
4089
|
-
o(t("submission_cooldown", {
|
|
4090
|
-
count: h
|
|
4091
|
-
}));
|
|
4092
|
-
const v = setInterval(() => {
|
|
4093
|
-
const g = ot(s);
|
|
4094
|
-
i(g), !(g > 0) && (clearInterval(v), o(t("submission_cooldown_ready")));
|
|
4095
|
-
}, 250);
|
|
4096
|
-
return () => clearInterval(v);
|
|
4097
|
-
}, [s, t]);
|
|
4098
|
-
const c = n > 0;
|
|
4099
|
-
return u("div", {
|
|
4100
|
-
class: "flex flex-col items-center gap-2 py-3",
|
|
4101
|
-
children: [u("button", {
|
|
4102
|
-
class: "bg-accent-9 hover:bg-accent-10 active:bg-submit-bg-active hover:border-accent-10 active:border-submit-bg-active border-accent-9 ring-accent-6 focus-visible:outline-accent-8 ring-offset-neutral-1 aria-disabled:hover:bg-accent-9 aria-disabled:hover:border-accent-9 flex cursor-pointer rounded-full border border-solid px-5 py-3 pr-4 text-white outline-none ring-1 ring-offset-[1.5px] transition-all duration-300 focus-visible:outline-2 active:ring-2 active:ring-offset-2 aria-disabled:cursor-not-allowed aria-disabled:opacity-50 aria-disabled:active:ring-1 aria-disabled:active:ring-offset-[1.5px]",
|
|
4103
|
-
name: e.key,
|
|
4104
|
-
"aria-disabled": c,
|
|
4105
|
-
"aria-describedby": c ? "submit-cooldown" : void 0,
|
|
4106
|
-
onClick: () => {
|
|
4107
|
-
ot(s) > 0 || r(null);
|
|
4108
|
-
},
|
|
4109
|
-
children: u("span", {
|
|
4110
|
-
class: "flex items-center gap-1.5",
|
|
4111
|
-
children: [u("span", {
|
|
4112
|
-
class: "inline-flex items-center text-sm font-medium",
|
|
4113
|
-
children: e.config.label || "Submit"
|
|
4114
|
-
}), u("svg", {
|
|
4115
|
-
stroke: "currentColor",
|
|
4116
|
-
"stroke-width": "1.5",
|
|
4117
|
-
width: "16",
|
|
4118
|
-
height: "16",
|
|
4119
|
-
viewBox: "0 0 16 16",
|
|
4120
|
-
fill: "none",
|
|
4121
|
-
xmlns: "http://www.w3.org/2000/svg",
|
|
4122
|
-
children: [u("path", {
|
|
4123
|
-
d: "M4 8L8 4L12 8"
|
|
4124
|
-
}), u("path", {
|
|
4125
|
-
d: "M8 4V13"
|
|
4126
|
-
})]
|
|
4127
|
-
})]
|
|
4128
|
-
})
|
|
4129
|
-
}), c && u("p", {
|
|
4130
|
-
id: "submit-cooldown",
|
|
4131
|
-
"aria-hidden": "true",
|
|
4132
|
-
class: "text-neutral-11 text-xs",
|
|
4133
|
-
children: t("submission_cooldown", {
|
|
4134
|
-
count: n
|
|
4135
|
-
})
|
|
4136
|
-
}), u("p", {
|
|
4137
|
-
role: "status",
|
|
4138
|
-
class: "sr-only",
|
|
4139
|
-
children: a
|
|
4140
|
-
})]
|
|
4141
|
-
});
|
|
4142
|
-
}, Ia = 160, vr = (e) => {
|
|
4143
|
-
e.style.height = "auto", e.style.height = `${Math.min(e.scrollHeight, Ia)}px`;
|
|
4144
|
-
}, Aa = {
|
|
4145
|
-
date: {
|
|
4146
|
-
type: "date",
|
|
4147
|
-
inputMode: "text"
|
|
4148
|
-
},
|
|
4149
|
-
email: {
|
|
4150
|
-
type: "email",
|
|
4151
|
-
inputMode: "email",
|
|
4152
|
-
formNoValidate: !0
|
|
4153
|
-
},
|
|
4154
|
-
text: {
|
|
4155
|
-
type: "text",
|
|
4156
|
-
inputMode: "text"
|
|
4157
|
-
},
|
|
4158
|
-
url: {
|
|
4159
|
-
type: "url",
|
|
4160
|
-
inputMode: "url",
|
|
4161
|
-
formNoValidate: !0
|
|
4162
|
-
}
|
|
4163
|
-
}, Fa = We("string"), Va = (e, r) => {
|
|
4164
|
-
const t = {
|
|
4165
|
-
maxLength: r("validation_max_chars", {
|
|
4166
|
-
count: e.maxChars ?? 999
|
|
4167
|
-
}),
|
|
4168
|
-
minLength: r("validation_min_chars", {
|
|
4169
|
-
count: e.minChars ?? 1
|
|
4170
|
-
})
|
|
4171
|
-
};
|
|
4172
|
-
return yt(/* @__PURE__ */ be({
|
|
4173
|
-
text: {
|
|
4174
|
-
date: /* @__PURE__ */ Ce(/* @__PURE__ */ ie(r("validation_date")), /* @__PURE__ */ Et(/^\d{4}-\d{2}-\d{2}$/, r("validation_date"))),
|
|
4175
|
-
email: /* @__PURE__ */ Ce(/* @__PURE__ */ ie(r("validation_email")), /* @__PURE__ */ Nr(r("validation_email")), /* @__PURE__ */ qe(e.minChars ?? 1, t.minLength), /* @__PURE__ */ et(e.maxChars ?? 1 / 0, t.maxLength)),
|
|
4176
|
-
text: /* @__PURE__ */ Ce(/* @__PURE__ */ ie(), /* @__PURE__ */ qe(e.minChars ?? 1, t.minLength), /* @__PURE__ */ et(e.maxChars ?? 1 / 0, t.maxLength)),
|
|
4177
|
-
url: /* @__PURE__ */ Ce(/* @__PURE__ */ ie(r("validation_url")), /* @__PURE__ */ Dr(r("validation_url")), /* @__PURE__ */ qe(e.minChars ?? 1, t.minLength), /* @__PURE__ */ et(e.maxChars ?? 1 / 0, t.maxLength))
|
|
4178
|
-
}[e.format]
|
|
4179
|
-
}));
|
|
4180
|
-
}, Ea = ({
|
|
4181
|
-
input: e,
|
|
4182
|
-
onSubmitSuccess: r
|
|
4183
|
-
}) => {
|
|
4184
|
-
var F;
|
|
4185
|
-
const {
|
|
4186
|
-
t
|
|
4187
|
-
} = Q(), s = e.key ? (F = B.current$.value.flow) == null ? void 0 : F.data.submissions[e.key] : void 0, n = e.config.defaultValue, i = e.config.multiline === !0 && e.config.format === "text", {
|
|
4188
|
-
register: a,
|
|
4189
|
-
handleSubmit: o,
|
|
4190
|
-
watch: c,
|
|
4191
|
-
formState: {
|
|
4192
|
-
errors: h
|
|
4193
|
-
}
|
|
4194
|
-
} = mt({
|
|
4195
|
-
defaultValues: {
|
|
4196
|
-
text: Fa(s) ? s.value : n ?? ""
|
|
4197
|
-
},
|
|
4198
|
-
resolver: Va(e.config, t)
|
|
4199
|
-
}), {
|
|
4200
|
-
ref: v,
|
|
4201
|
-
...g
|
|
4202
|
-
} = a("text", {
|
|
4203
|
-
required: !e.config.optional
|
|
4204
|
-
}), p = de();
|
|
4205
|
-
Se(() => {
|
|
4206
|
-
p.current && (p.current instanceof HTMLTextAreaElement && vr(p.current), p.current.focus(), p.current.select());
|
|
4207
|
-
}, []);
|
|
4208
|
-
const m = e.config.maxChars, w = i && m !== void 0 ? c("text").length : void 0;
|
|
4209
|
-
return u("form", {
|
|
4210
|
-
noValidate: !0,
|
|
4211
|
-
class: "flex flex-col gap-1 p-2.5",
|
|
4212
|
-
onSubmit: o((_) => {
|
|
4213
|
-
r({
|
|
4214
|
-
type: "string",
|
|
4215
|
-
value: _.text
|
|
4216
|
-
});
|
|
4217
|
-
}),
|
|
4218
|
-
children: [u("div", {
|
|
4219
|
-
class: i ? "flex items-end gap-2" : "flex items-center gap-2",
|
|
4220
|
-
children: [u("div", {
|
|
4221
|
-
class: "relative min-w-0 flex-1",
|
|
4222
|
-
children: [i ? u("textarea", {
|
|
4223
|
-
id: "chat-input",
|
|
4224
|
-
...g,
|
|
4225
|
-
rows: 2,
|
|
4226
|
-
maxLength: m,
|
|
4227
|
-
autoFocus: !0,
|
|
4228
|
-
"aria-describedby": w !== void 0 ? "chat-input-count" : void 0,
|
|
4229
|
-
onInput: (_) => vr(_.currentTarget),
|
|
4230
|
-
onKeyDown: (_) => {
|
|
4231
|
-
var S;
|
|
4232
|
-
_.key === "Enter" && (_.ctrlKey || _.metaKey) && (_.preventDefault(), (S = _.currentTarget.form) == null || S.requestSubmit());
|
|
4233
|
-
},
|
|
4234
|
-
ref: (_) => {
|
|
4235
|
-
_ && (p.current = _), v(_);
|
|
4236
|
-
},
|
|
4237
|
-
placeholder: e.config.placeholder,
|
|
4238
|
-
class: ze({
|
|
4239
|
-
optional: !!e.config.optional,
|
|
4240
|
-
className: "block w-full resize-none overflow-y-auto rounded-2xl"
|
|
4241
|
-
})
|
|
4242
|
-
}) : u("input", {
|
|
4243
|
-
id: "chat-input",
|
|
4244
|
-
...g,
|
|
4245
|
-
...Aa[e.config.format],
|
|
4246
|
-
autocomplete: "off",
|
|
4247
|
-
autoCapitalize: "off",
|
|
4248
|
-
autoCorrect: "off",
|
|
4249
|
-
autoFocus: !0,
|
|
4250
|
-
ref: (_) => {
|
|
4251
|
-
_ && (p.current = _), v(_);
|
|
4252
|
-
},
|
|
4253
|
-
placeholder: e.config.placeholder,
|
|
4254
|
-
class: ze({
|
|
4255
|
-
optional: !!e.config.optional,
|
|
4256
|
-
className: "w-full rounded-full"
|
|
4257
|
-
})
|
|
4258
|
-
}), e.config.optional && u(
|
|
4259
|
-
Ie,
|
|
4260
|
-
{
|
|
4261
|
-
class: i ? "absolute bottom-1 right-0.5" : "absolute bottom-0 right-0.5 top-0",
|
|
4262
|
-
onClick: () => r(null)
|
|
4263
|
-
}
|
|
4264
|
-
)]
|
|
4265
|
-
}), u(Me, {})]
|
|
4266
|
-
}), w !== void 0 && m !== void 0 && u("p", {
|
|
4267
|
-
id: "chat-input-count",
|
|
4268
|
-
class: "text-neutral-10 px-3 text-right text-xs",
|
|
4269
|
-
children: [w, "/", m]
|
|
4270
|
-
}), u(Ge, {
|
|
4271
|
-
error: h.text
|
|
4272
|
-
})]
|
|
4273
|
-
});
|
|
4274
|
-
}, Ma = {
|
|
4275
|
-
text: Ea,
|
|
4276
|
-
phone: Ca,
|
|
4277
|
-
"multiple-choice": pa,
|
|
4278
|
-
boolean: Mn,
|
|
4279
|
-
file: $n,
|
|
4280
|
-
submit: Sa,
|
|
4281
|
-
address: An,
|
|
4282
|
-
number: ga
|
|
4283
|
-
}, Na = ({
|
|
4284
|
-
logger: e,
|
|
4285
|
-
analytics: r
|
|
4286
|
-
}) => {
|
|
4287
|
-
var i;
|
|
4288
|
-
const t = (i = B.current$.value.flow) == null ? void 0 : i.data.currentInput, s = de(null), n = () => ne.onInteractionFn$.value();
|
|
4289
|
-
return Se(() => {
|
|
4290
|
-
var a;
|
|
4291
|
-
(a = s.current) == null || a.scrollTo({
|
|
4292
|
-
top: 0
|
|
4293
|
-
});
|
|
4294
|
-
}, [t]), u("div", {
|
|
4295
|
-
ref: s,
|
|
4296
|
-
class: "border-divider max-h-[calc(100%-var(--header-height)-4rem)] w-full shrink-0 scroll-pb-12 overflow-y-auto overscroll-contain border-t",
|
|
4297
|
-
children: u("div", {
|
|
4298
|
-
class: "flex flex-col",
|
|
4299
|
-
onPointerDownCapture: t ? n : void 0,
|
|
4300
|
-
onKeyDownCapture: t ? n : void 0,
|
|
4301
|
-
children: t ? (() => {
|
|
4302
|
-
const a = Ma[t.type];
|
|
4303
|
-
return u(a, {
|
|
4304
|
-
logger: e,
|
|
4305
|
-
analytics: r,
|
|
4306
|
-
onSubmitSuccess: ne.onSubmitSuccessFn$.value,
|
|
4307
|
-
input: t
|
|
4308
|
-
});
|
|
4309
|
-
})() : u("div", {
|
|
4310
|
-
class: "flex items-center gap-2 p-2.5",
|
|
4311
|
-
children: [u("input", {
|
|
4312
|
-
"aria-hidden": "true",
|
|
4313
|
-
id: "chat-input",
|
|
4314
|
-
class: ze({
|
|
4315
|
-
optional: !1,
|
|
4316
|
-
className: "flex-grow rounded-full"
|
|
4317
|
-
}),
|
|
4318
|
-
disabled: !0
|
|
4319
|
-
}), u(Me, {
|
|
4320
|
-
disabled: !0,
|
|
4321
|
-
"aria-hidden": "true",
|
|
4322
|
-
tabIndex: -1
|
|
4323
|
-
})]
|
|
4324
|
-
})
|
|
4325
|
-
})
|
|
4326
|
-
});
|
|
4327
|
-
};
|
|
4328
|
-
function La(e) {
|
|
4329
|
-
return e && e.__esModule && Object.prototype.hasOwnProperty.call(e, "default") ? e.default : e;
|
|
4330
|
-
}
|
|
4331
|
-
var Ta = function(e) {
|
|
4332
|
-
return e instanceof RegExp;
|
|
4333
|
-
}, Da = function(r) {
|
|
4334
|
-
var t = /[\\^$.*+?()[\]{}|]/g, s = RegExp(t.source);
|
|
4335
|
-
return r && s.test(r) ? r.replace(t, "\\$&") : r;
|
|
4336
|
-
}, es = function(e) {
|
|
4337
|
-
return typeof e == "string";
|
|
4338
|
-
}, Oa = function(e) {
|
|
4339
|
-
var r = [];
|
|
4340
|
-
return e.forEach(function(t) {
|
|
4341
|
-
Array.isArray(t) ? r = r.concat(t) : r.push(t);
|
|
4342
|
-
}), r;
|
|
4343
|
-
};
|
|
4344
|
-
function Ra(e, r, t) {
|
|
4345
|
-
var s = 0, n = 0;
|
|
4346
|
-
if (e === "")
|
|
4347
|
-
return e;
|
|
4348
|
-
if (!e || !es(e))
|
|
4349
|
-
throw new TypeError("First argument to react-string-replace#replaceString must be a string");
|
|
4350
|
-
var i = r;
|
|
4351
|
-
Ta(i) || (i = new RegExp("(" + Da(i) + ")", "gi"));
|
|
4352
|
-
for (var a = e.split(i), o = 1, c = a.length; o < c; o += 2) {
|
|
4353
|
-
if (a[o] === void 0 || a[o - 1] === void 0) {
|
|
4354
|
-
console.warn("reactStringReplace: Encountered undefined value during string replacement. Your RegExp may not be working the way you expect.");
|
|
4355
|
-
continue;
|
|
4356
|
-
}
|
|
4357
|
-
n = a[o].length, s += a[o - 1].length, a[o] = t(a[o], o, s), s += n;
|
|
4358
|
-
}
|
|
4359
|
-
return a;
|
|
4360
|
-
}
|
|
4361
|
-
var $a = function(r, t, s) {
|
|
4362
|
-
return Array.isArray(r) || (r = [r]), Oa(r.map(function(n) {
|
|
4363
|
-
return es(n) ? Ra(n, t, s) : n;
|
|
4364
|
-
}));
|
|
4365
|
-
};
|
|
4366
|
-
const Ye = /* @__PURE__ */ La($a), Pa = /(\[[^\]]+\]\([^)]+\))/g, ja = /\[([^\]]+)\]\(([^)]+)\)/, Ba = /(https?:\/\/[^\s]+)/g, qa = /_(.*?)_/g, Ua = /\*\*(.*?)\*\*/g, za = /\\n|\n/g, xr = "text-accent-10 hover:text-accent-11 no-underline underline-offset-2 hover:underline", Ka = (e) => {
|
|
4367
|
-
const r = Ye(e, Pa, (a, o) => {
|
|
4368
|
-
const [, c, h] = a.match(ja) ?? [];
|
|
4369
|
-
return h ? u("a", {
|
|
4370
|
-
class: xr,
|
|
4371
|
-
href: h,
|
|
4372
|
-
children: c ?? h
|
|
4373
|
-
}, h + o) : u("span", {
|
|
4374
|
-
children: "INVALID LINK"
|
|
4375
|
-
});
|
|
4376
|
-
}), t = Ye(r, Ba, (a, o) => u("a", {
|
|
4377
|
-
class: xr,
|
|
4378
|
-
href: a,
|
|
4379
|
-
children: a
|
|
4380
|
-
}, a + o)), s = Ye(t, qa, (a, o) => u("em", {
|
|
4381
|
-
children: a
|
|
4382
|
-
}, a + o)), n = Ye(s, Ua, (a, o) => u("strong", {
|
|
4383
|
-
children: a
|
|
4384
|
-
}, a + o));
|
|
4385
|
-
return Ye(n, za, (a, o) => u("br", {}, `br-${o}`));
|
|
4386
|
-
}, Wa = dt("select-text max-w-[min(100%,24rem)] [text-wrap:pretty] leading-snug flex-shrink min-w-[2rem] py-2 px-3 rounded-[18px] min-h-[36px] break-words relative", {
|
|
4387
|
-
variants: {
|
|
4388
|
-
side: {
|
|
4389
|
-
left: "bg-bubble-weak-bg text-neutral-12 shadow-surface-sm outline outline-1 outline-bubble-weak rounded-bl-md",
|
|
4390
|
-
right: "ml-auto bg-accent-9 text-white rounded-br-md shadow-surface-sm shadow-bubble-strong-shadow"
|
|
4391
|
-
},
|
|
4392
|
-
animate: {
|
|
4393
|
-
true: "animate-bubble-in",
|
|
4394
|
-
false: ""
|
|
4395
|
-
}
|
|
4396
|
-
},
|
|
4397
|
-
defaultVariants: {
|
|
4398
|
-
side: "left"
|
|
4399
|
-
}
|
|
4400
|
-
}), Ga = ({
|
|
4401
|
-
children: e,
|
|
4402
|
-
className: r,
|
|
4403
|
-
animate: t,
|
|
4404
|
-
side: s,
|
|
4405
|
-
...n
|
|
4406
|
-
}) => u("p", {
|
|
4407
|
-
style: {
|
|
4408
|
-
transformOrigin: s === "left" ? "0% 50%" : "100% 50%"
|
|
4409
|
-
},
|
|
4410
|
-
class: Wa({
|
|
4411
|
-
className: r,
|
|
4412
|
-
side: s,
|
|
4413
|
-
animate: t
|
|
4414
|
-
}),
|
|
4415
|
-
...n,
|
|
4416
|
-
children: e
|
|
4417
|
-
}), Ha = ({
|
|
4418
|
-
message: e
|
|
4419
|
-
}) => u("div", {
|
|
4420
|
-
class: "bg-accent-3 flex w-full items-center justify-center overflow-hidden rounded-xl px-2 py-2",
|
|
4421
|
-
children: u("a", {
|
|
4422
|
-
onClick: e.onClick,
|
|
4423
|
-
class: "bg-lowest shadow-surface-sm ring-accent-6 hover:ring-accent-8 active:bg-accent-2 active:text-accent-10 text-accent-9 focus-visible:ring-accent-7/50 text-wrap-balance flex items-center gap-1.5 rounded-full py-2 pl-4 pr-2.5 text-center no-underline ring-1 transition-all focus:outline-none focus-visible:ring-4 focus-visible:ring-offset-2",
|
|
4424
|
-
target: "_blank",
|
|
4425
|
-
href: e.href,
|
|
4426
|
-
children: [e.text, u("svg", {
|
|
4427
|
-
class: "flex-none",
|
|
4428
|
-
width: "15",
|
|
4429
|
-
height: "15",
|
|
4430
|
-
viewBox: "0 0 15 15",
|
|
4431
|
-
fill: "none",
|
|
4432
|
-
xmlns: "http://www.w3.org/2000/svg",
|
|
4433
|
-
children: u("path", {
|
|
4434
|
-
d: "M3.64645 11.3536C3.45118 11.1583 3.45118 10.8417 3.64645 10.6465L10.2929 4L6 4C5.72386 4 5.5 3.77614 5.5 3.5C5.5 3.22386 5.72386 3 6 3L11.5 3C11.6326 3 11.7598 3.05268 11.8536 3.14645C11.9473 3.24022 12 3.36739 12 3.5L12 9.00001C12 9.27615 11.7761 9.50001 11.5 9.50001C11.2239 9.50001 11 9.27615 11 9.00001V4.70711L4.35355 11.3536C4.15829 11.5488 3.84171 11.5488 3.64645 11.3536Z",
|
|
4435
|
-
fill: "currentColor",
|
|
4436
|
-
"fill-rule": "evenodd",
|
|
4437
|
-
"clip-rule": "evenodd"
|
|
4438
|
-
})
|
|
4439
|
-
})]
|
|
4440
|
-
})
|
|
4441
|
-
}), Ja = ({
|
|
4442
|
-
className: e,
|
|
4443
|
-
...r
|
|
4444
|
-
}) => u("div", {
|
|
4445
|
-
"aria-hidden": !0,
|
|
4446
|
-
children: ne.isBotTyping$.value === !0 ? u("div", {
|
|
4447
|
-
"data-testid": "typing-indicator",
|
|
4448
|
-
class: Ke("flex gap-1 p-4", e),
|
|
4449
|
-
...r,
|
|
4450
|
-
children: Array.from({
|
|
4451
|
-
length: 3
|
|
4452
|
-
}, (t, s) => u("div", {
|
|
4453
|
-
class: "bg-accent-9 h-1.5 w-1.5 animate-bounce rounded-full",
|
|
4454
|
-
style: {
|
|
4455
|
-
animationDelay: `${-s * 200}ms`
|
|
4456
|
-
}
|
|
4457
|
-
}))
|
|
4458
|
-
}) : void 0
|
|
4459
|
-
}), Za = {
|
|
4460
|
-
bot: "left",
|
|
4461
|
-
user: "right"
|
|
4462
|
-
}, Xa = dt("w-full select-none py-2 text-wrap-balance text-center text-[10px] uppercase tracking-widest drop-shadow-[0_1.5px_var(--i-color-n-1)]", {
|
|
4463
|
-
variants: {
|
|
4464
|
-
variant: {
|
|
4465
|
-
info: "text-neutral-11",
|
|
4466
|
-
warning: "text-system-warning",
|
|
4467
|
-
error: "text-error-11",
|
|
4468
|
-
success: "text-system-success"
|
|
4469
|
-
}
|
|
4470
|
-
}
|
|
4471
|
-
}), Ya = ({
|
|
4472
|
-
lastSentMessageFooter: e
|
|
4473
|
-
}) => {
|
|
4474
|
-
const {
|
|
4475
|
-
t: r
|
|
4476
|
-
} = Q(), t = B.current$.value.flow, s = (t == null ? void 0 : t.data.messages) ?? [], n = t ? Ft(t) : void 0;
|
|
4477
|
-
return u("ol", {
|
|
4478
|
-
"aria-label": r("chat_messages"),
|
|
4479
|
-
"aria-live": "polite",
|
|
4480
|
-
class: "mt-auto flex flex-col justify-end gap-2 p-2 pt-[calc(var(--header-height)+1rem)]",
|
|
4481
|
-
children: [s.map((i, a) => u(ve, {
|
|
4482
|
-
children: u("li", {
|
|
4483
|
-
class: "flex",
|
|
4484
|
-
tabIndex: a === s.length - 1 ? -1 : void 0,
|
|
4485
|
-
children: [n && i.groupId === n && !s.slice(a + 1).some((o) => o.groupId === n) ? e : null, ks(i).with({
|
|
4486
|
-
type: "system"
|
|
4487
|
-
}, (o) => u("p", {
|
|
4488
|
-
class: Xa({
|
|
4489
|
-
variant: o.variant
|
|
4490
|
-
}),
|
|
4491
|
-
children: o.text
|
|
4492
|
-
})).with({
|
|
4493
|
-
type: "text",
|
|
4494
|
-
author: Cs.union("bot", "user")
|
|
4495
|
-
}, (o) => {
|
|
4496
|
-
const c = a === s.length - 1, h = o.author === "bot" ? Ka(o.text) : o.text;
|
|
4497
|
-
return u(ve, {
|
|
4498
|
-
children: u(Ga, {
|
|
4499
|
-
animate: c,
|
|
4500
|
-
side: Za[o.author],
|
|
4501
|
-
children: h
|
|
4502
|
-
}, a)
|
|
4503
|
-
});
|
|
4504
|
-
}).with({
|
|
4505
|
-
type: "link"
|
|
4506
|
-
}, (o) => u(Ha, {
|
|
4507
|
-
message: o
|
|
4508
|
-
})).with({
|
|
4509
|
-
type: "image"
|
|
4510
|
-
}, (o) => u("img", {
|
|
4511
|
-
class: "shadow-surface-md w-full max-w-[min(100%,24rem)] rounded-2xl",
|
|
4512
|
-
src: o.url,
|
|
4513
|
-
style: {
|
|
4514
|
-
aspectRatio: o.width / o.height
|
|
4515
|
-
}
|
|
4516
|
-
})).with({
|
|
4517
|
-
type: "file"
|
|
4518
|
-
}, (o) => u(Tn, {
|
|
4519
|
-
class: o.author === "bot" ? void 0 : "ml-auto",
|
|
4520
|
-
file: {
|
|
4521
|
-
name: o.fileName,
|
|
4522
|
-
sizeKb: o.fileSizeKb
|
|
4523
|
-
}
|
|
4524
|
-
})).with({
|
|
4525
|
-
type: "loading"
|
|
4526
|
-
}, (o) => {
|
|
4527
|
-
const c = s[s.length - 1];
|
|
4528
|
-
return !(o === c) || ne.isBotTyping$.value ? null : u("div", {
|
|
4529
|
-
class: "flex flex-grow flex-col items-center justify-center gap-2",
|
|
4530
|
-
children: [u(Vt, {
|
|
4531
|
-
"aria-hidden": o.text ? "true" : void 0,
|
|
4532
|
-
class: "text-neutral-6 h-8 w-8"
|
|
4533
|
-
}), o.text ? u("p", {
|
|
4534
|
-
role: "status",
|
|
4535
|
-
class: "text-neutral-11 text-sm",
|
|
4536
|
-
children: o.text
|
|
4537
|
-
}) : null]
|
|
4538
|
-
});
|
|
4539
|
-
}).exhaustive()]
|
|
4540
|
-
})
|
|
4541
|
-
}, a)), u("li", {
|
|
4542
|
-
class: ne.captchaVisible$.value ? "flex" : "hidden",
|
|
4543
|
-
children: u("div", {
|
|
4544
|
-
"data-captcha-slot": !0,
|
|
4545
|
-
tabIndex: -1,
|
|
4546
|
-
role: "group",
|
|
4547
|
-
"aria-label": r("captcha_check"),
|
|
4548
|
-
class: "w-full max-w-[min(100%,24rem)] rounded-md"
|
|
4549
|
-
})
|
|
4550
|
-
}, "captcha"), u(Ja, {}, "typing")]
|
|
4551
|
-
});
|
|
4552
|
-
}, si = ({
|
|
4553
|
-
logger: e,
|
|
4554
|
-
apiClient: r,
|
|
4555
|
-
analytics: t,
|
|
4556
|
-
talentBankClient: s
|
|
4557
|
-
}) => {
|
|
4558
|
-
const {
|
|
4559
|
-
flow: n
|
|
4560
|
-
} = B.current$.value;
|
|
4561
|
-
Ee(n, "Flow is required to exist to show chatbot body");
|
|
4562
|
-
const i = B.viewState$.value, {
|
|
4563
|
-
chatRef: a,
|
|
4564
|
-
chatService: o
|
|
4565
|
-
} = Ss(), {
|
|
4566
|
-
t: c
|
|
4567
|
-
} = Q(), [h, v] = ge();
|
|
4568
|
-
return Se(() => {
|
|
4569
|
-
i === "maximised" && ne.scrollToEnd();
|
|
4570
|
-
}, [i]), Se(() => {
|
|
4571
|
-
var y;
|
|
4572
|
-
const {
|
|
4573
|
-
state: g,
|
|
4574
|
-
flow: p
|
|
4575
|
-
} = B.current$.peek();
|
|
4576
|
-
if (g !== "loaded")
|
|
4577
|
-
throw new Error(c("invalid_state"));
|
|
4578
|
-
let m = p.data.nodeHistory.at(-1);
|
|
4579
|
-
if (ne.scrollToEnd(), B.setInput(void 0), p.data.isFinished)
|
|
4580
|
-
return;
|
|
4581
|
-
const w = () => {
|
|
4582
|
-
const C = B.current$.peek().flow;
|
|
4583
|
-
!C || C.data.hasInteracted || (B.markAsInteracted(), Gt(t, C, "FLOW_INTERACT"));
|
|
4584
|
-
};
|
|
4585
|
-
ne.onInteractionFn$.value = w, m === void 0 ? (m = kr(n.nodes).id, B.setCurrentNodeId(m), Gt(t, p, "FLOW_START")) : B.removeMessagesSentByNodeIds([m]);
|
|
4586
|
-
const {
|
|
4587
|
-
interpret: F,
|
|
4588
|
-
abort: _,
|
|
4589
|
-
undo: S
|
|
4590
|
-
} = js({
|
|
4591
|
-
context: n.context,
|
|
4592
|
-
analytics: {
|
|
4593
|
-
service: t,
|
|
4594
|
-
customProperties: (y = n.analytics) == null ? void 0 : y.customProperties
|
|
4595
|
-
},
|
|
4596
|
-
apiClient: r,
|
|
4597
|
-
logger: e,
|
|
4598
|
-
talentBankClient: s,
|
|
4599
|
-
flow: n,
|
|
4600
|
-
chatService: o,
|
|
4601
|
-
t: c,
|
|
4602
|
-
getApplicationRecovery: () => {
|
|
4603
|
-
var C;
|
|
4604
|
-
return (C = B.current$.peek().flow) == null ? void 0 : C.data.applicationRecovery;
|
|
4605
|
-
},
|
|
4606
|
-
setApplicationRecovery: B.setApplicationRecovery,
|
|
4607
|
-
persistWriteBarrier: () => B.persistWriteBarrier(p),
|
|
4608
|
-
// We need to get fresh submissions, that’s why we call `peek` here.
|
|
4609
|
-
getSubmissions: () => {
|
|
4610
|
-
var C;
|
|
4611
|
-
return (C = B.current$.peek().flow) == null ? void 0 : C.data.submissions;
|
|
4612
|
-
},
|
|
4613
|
-
onInterpret: (C) => B.setCurrentNodeId(C.id),
|
|
4614
|
-
onFlowEnd: async () => {
|
|
4615
|
-
var A;
|
|
4616
|
-
B.markAsFinished();
|
|
4617
|
-
const C = B.current$.peek().flow;
|
|
4618
|
-
Ee(C), t.log({
|
|
4619
|
-
event: "FLOW_END",
|
|
4620
|
-
properties: {
|
|
4621
|
-
flow_id: n.id,
|
|
4622
|
-
flow_version: n.version,
|
|
4623
|
-
flow_session_id: C.data.flowSessionId,
|
|
4624
|
-
flow_build: n.build,
|
|
4625
|
-
job: n.job
|
|
4626
|
-
},
|
|
4627
|
-
customProperties: (A = n.analytics) == null ? void 0 : A.customProperties
|
|
4628
|
-
});
|
|
4629
|
-
}
|
|
4630
|
-
});
|
|
4631
|
-
return v(() => S), F(m), () => {
|
|
4632
|
-
ne.onInteractionFn$.value === w && (ne.onInteractionFn$.value = () => {
|
|
4633
|
-
}), _();
|
|
4634
|
-
};
|
|
4635
|
-
}, [t, r, o, e, n, s, c]), u(ve, {
|
|
4636
|
-
children: [u("div", {
|
|
4637
|
-
class: "relative flex min-h-0 w-full max-w-full flex-grow flex-col",
|
|
4638
|
-
children: [u("div", {
|
|
4639
|
-
ref: a,
|
|
4640
|
-
role: "region",
|
|
4641
|
-
"aria-label": c("conversation_history"),
|
|
4642
|
-
tabIndex: 0,
|
|
4643
|
-
className: "hide-scrollbars fr flex min-h-0 w-full max-w-full flex-grow flex-col overflow-y-auto ring-inset",
|
|
4644
|
-
style: {
|
|
4645
|
-
WebkitOverflowScrolling: "touch"
|
|
4646
|
-
},
|
|
4647
|
-
children: u(Ya, {
|
|
4648
|
-
lastSentMessageFooter: !Ft(n) || !h ? null : u(Qa, {
|
|
4649
|
-
undoFn: h
|
|
4650
|
-
})
|
|
4651
|
-
})
|
|
4652
|
-
}), ne.isReadingHistory$.value && !n.data.isFinished && !ne.isBotTyping$.value && u("div", {
|
|
4653
|
-
class: "absolute bottom-2 left-1/2 -translate-x-1/2",
|
|
4654
|
-
children: u(Ar, {
|
|
4655
|
-
class: "bg-neutral-1 ring-divider shadow-surface-md ring-1",
|
|
4656
|
-
"aria-label": c("jump_to_current"),
|
|
4657
|
-
onClick: () => {
|
|
4658
|
-
var p, m;
|
|
4659
|
-
ne.scrollToEnd(), (m = ((p = a.current) == null ? void 0 : p.querySelector('li[tabindex="-1"]')) ?? a.current) == null || m.focus({
|
|
4660
|
-
preventScroll: !0
|
|
4661
|
-
});
|
|
4662
|
-
},
|
|
4663
|
-
children: u(Is, {})
|
|
4664
|
-
})
|
|
4665
|
-
})]
|
|
4666
|
-
}), u(Na, {
|
|
4667
|
-
logger: e,
|
|
4668
|
-
analytics: t
|
|
4669
|
-
})]
|
|
4670
|
-
});
|
|
4671
|
-
}, Qa = ({
|
|
4672
|
-
undoFn: e
|
|
4673
|
-
}) => {
|
|
4674
|
-
const {
|
|
4675
|
-
t: r
|
|
4676
|
-
} = Q();
|
|
4677
|
-
return u("div", {
|
|
4678
|
-
class: "flex flex-1 items-center justify-end px-1",
|
|
4679
|
-
children: u(Ar, {
|
|
4680
|
-
"aria-label": r("undo"),
|
|
4681
|
-
onClick: async () => {
|
|
4682
|
-
const {
|
|
4683
|
-
flow: t
|
|
4684
|
-
} = B.current$.peek();
|
|
4685
|
-
Ee(t), e(t.data.nodeHistory);
|
|
4686
|
-
},
|
|
4687
|
-
children: u("path", {
|
|
4688
|
-
d: "M3 13h2.67l6.66-6.67a1.9 1.9 0 0 0 0-2.66 1.91 1.91 0 0 0-2.66 0L3 10.33V13Zm4.6-7.25 2.67 2.67"
|
|
4689
|
-
})
|
|
4690
|
-
})
|
|
4691
|
-
});
|
|
4692
|
-
};
|
|
4693
|
-
export {
|
|
4694
|
-
si as ChatbotBody
|
|
4695
|
-
};
|