@inploi/plugin-chatbot 14.10.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-3e08ab1b.js → chatbot-body-d3fd468f.js} +1235 -1214
- package/dist/index-4aad840b.cjs +5 -0
- package/dist/{index-5de8da64.js → index-b8dab3ec.js} +555 -539
- package/dist/plugin-chatbot.cjs +1 -1
- package/dist/plugin-chatbot.js +1 -1
- package/dist/style.css +1 -1
- package/package.json +4 -4
- package/dist/chatbot-body-d0635102.cjs +0 -5
- package/dist/index-d28fa66d.cjs +0 -5
|
@@ -1,46 +1,46 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { isApiErrorWithData as
|
|
3
|
-
var
|
|
4
|
-
let r =
|
|
1
|
+
import { a as Ar, p as ht, D as Ft, c as qe, d as Er, I as Fr, i as hn, S as mn, N as yn, T as Vr, Z as gn, X as Mr, W as bn, C as vn, r as xn, m as wn, k as _n, U as Ht, V as Jt, h as kn, b as Zt, f as Cn, g as Lr, x as Sn, v as In, w as An, y as En, s as K, u as ee, o as u, e as Ke, j as mt, l as ve, _ as he, n as Ne, q as Ae, t as we, L as Rt, F as Fn, z as Nr, A as Rr, B as Vn, E as Ge, G as Xt, H as re, J as ie, M as Mn, K as Ln, O as Nn, P as Rn, Q as Dr, R as Dn } from "./index-b8dab3ec.js";
|
|
2
|
+
import { isApiErrorWithData as Tn, isSdkError as On, ApiError as Bn } from "@inploi/sdk";
|
|
3
|
+
var jn = "9.8.0", Tr = `https://sdk.inploi.com/@inploi/flows@${jn}/cdn/captcha/index.html`, Pn = new URL(Tr).origin, Yt = 3e4, qn = 5 * 6e4, $n = (e) => typeof e == "object" && e !== null && e.source === "inploi-captcha", kt = /* @__PURE__ */ new WeakMap(), Un = (e) => {
|
|
4
|
+
let r = kt.get(e);
|
|
5
5
|
return r || (r = e.fetch("/flow/captcha").then((t) => {
|
|
6
6
|
let n = t == null ? void 0 : t.site_key;
|
|
7
7
|
return typeof n == "string" && n !== "" ? n : void 0;
|
|
8
8
|
}).catch((t) => {
|
|
9
|
-
throw
|
|
10
|
-
}),
|
|
11
|
-
},
|
|
12
|
-
let { signal: s, container: i = null, theme: a, onInteractive: o } = r instanceof AbortSignal ? { signal: r } : r, c = !1,
|
|
13
|
-
}, g = (
|
|
14
|
-
c || (c = !0, clearTimeout(m), s == null || s.removeEventListener("abort", h),
|
|
15
|
-
}, b = (
|
|
16
|
-
clearTimeout(m), m = setTimeout(() => b("Captcha timed out"),
|
|
9
|
+
throw kt.delete(e), t;
|
|
10
|
+
}), kt.set(e, r)), r;
|
|
11
|
+
}, Wn = (e, r = {}) => new Promise((t, n) => {
|
|
12
|
+
let { signal: s, container: i = null, theme: a, onInteractive: o } = r instanceof AbortSignal ? { signal: r } : r, c = !1, f = () => {
|
|
13
|
+
}, g = (I) => {
|
|
14
|
+
c || (c = !0, clearTimeout(m), s == null || s.removeEventListener("abort", h), f(), I());
|
|
15
|
+
}, b = (I) => g(() => n(new Error(I))), h = () => b("Captcha aborted"), m, k = (I) => {
|
|
16
|
+
clearTimeout(m), m = setTimeout(() => b("Captcha timed out"), I);
|
|
17
17
|
};
|
|
18
|
-
if (
|
|
18
|
+
if (k(Yt), s == null ? void 0 : s.aborted)
|
|
19
19
|
return h();
|
|
20
20
|
s == null || s.addEventListener("abort", h), (async () => {
|
|
21
|
-
let
|
|
22
|
-
if (
|
|
21
|
+
let I = await Un(e);
|
|
22
|
+
if (I === void 0)
|
|
23
23
|
return g(() => t(void 0));
|
|
24
24
|
if (c)
|
|
25
25
|
return;
|
|
26
26
|
let C = document.createElement("iframe");
|
|
27
|
-
C.src = `${
|
|
28
|
-
let
|
|
29
|
-
if (!C.contentWindow ||
|
|
27
|
+
C.src = `${Tr}?${new URLSearchParams({ sitekey: I, origin: window.location.origin, ...a && { theme: a } }).toString()}`, C.title = "Cloudflare security check", C.style.cssText = `display:block;border:0;width:${i ? "100%" : "300px"};height:0;color-scheme:normal`, i ? i.appendChild(C) : (C.style.cssText += ";position:fixed;bottom:16px;right:16px;z-index:2147483647", document.body.appendChild(C));
|
|
28
|
+
let x = !1, y = (F) => {
|
|
29
|
+
if (!C.contentWindow || F.source !== C.contentWindow || F.origin !== Pn || !$n(F.data))
|
|
30
30
|
return;
|
|
31
|
-
let
|
|
32
|
-
switch (
|
|
31
|
+
let N = F.data;
|
|
32
|
+
switch (N.type) {
|
|
33
33
|
case "token":
|
|
34
|
-
return g(() => t(
|
|
34
|
+
return g(() => t(N.token));
|
|
35
35
|
case "resize":
|
|
36
|
-
C.style.height = `${Math.max(0, Math.ceil(
|
|
36
|
+
C.style.height = `${Math.max(0, Math.ceil(N.height))}px`;
|
|
37
37
|
return;
|
|
38
38
|
case "before-interactive":
|
|
39
|
-
return
|
|
39
|
+
return x = !0, k(qn), o == null ? void 0 : o();
|
|
40
40
|
case "after-interactive":
|
|
41
|
-
return
|
|
41
|
+
return x = !1, k(Yt);
|
|
42
42
|
case "error":
|
|
43
|
-
!
|
|
43
|
+
!x && !N.interactive && b("Captcha failed");
|
|
44
44
|
return;
|
|
45
45
|
case "expired":
|
|
46
46
|
return b("Captcha expired");
|
|
@@ -48,20 +48,20 @@ var Tn = "9.7.0", Mr = `https://sdk.inploi.com/@inploi/flows@${Tn}/cdn/captcha/i
|
|
|
48
48
|
return b("Captcha timed out");
|
|
49
49
|
}
|
|
50
50
|
};
|
|
51
|
-
window.addEventListener("message", y),
|
|
51
|
+
window.addEventListener("message", y), f = () => {
|
|
52
52
|
window.removeEventListener("message", y), C.remove();
|
|
53
53
|
};
|
|
54
|
-
})().catch((
|
|
55
|
-
}),
|
|
54
|
+
})().catch((I) => g(() => n(I)));
|
|
55
|
+
}), Qt = ({ condition: e, context: r, submissions: t, ifBlock: n }) => {
|
|
56
56
|
let [s, ...i] = e.compareKey.split(".");
|
|
57
57
|
if (!s)
|
|
58
58
|
return !1;
|
|
59
|
-
let a =
|
|
59
|
+
let a = Ar({ context: r, key: s, path: i, submissions: t });
|
|
60
60
|
if (!a)
|
|
61
61
|
return !1;
|
|
62
62
|
switch (a.type) {
|
|
63
63
|
case "address": {
|
|
64
|
-
let o =
|
|
64
|
+
let o = Ft(a.value, i);
|
|
65
65
|
switch (e.compare) {
|
|
66
66
|
case "equals":
|
|
67
67
|
return o === e.compareValue;
|
|
@@ -77,16 +77,16 @@ var Tn = "9.7.0", Mr = `https://sdk.inploi.com/@inploi/flows@${Tn}/cdn/captcha/i
|
|
|
77
77
|
case "integration": {
|
|
78
78
|
if (typeof a.value != "object" || Array.isArray(a.value))
|
|
79
79
|
return !1;
|
|
80
|
-
let o =
|
|
80
|
+
let o = Ft(a.value, i), c = { ...n, data: { compareKey: "_temp", compare: e.compare, compareValue: e.compareValue } };
|
|
81
81
|
switch (typeof o) {
|
|
82
82
|
case "boolean":
|
|
83
|
-
return
|
|
83
|
+
return nt(c, { submissions: { _temp: { value: o, type: "boolean" } }, context: r });
|
|
84
84
|
case "string":
|
|
85
|
-
return
|
|
85
|
+
return nt(c, { submissions: { _temp: { value: o, type: "string" } }, context: r });
|
|
86
86
|
case "number":
|
|
87
|
-
return
|
|
87
|
+
return nt(c, { submissions: { _temp: { value: o, type: "number" } }, context: r });
|
|
88
88
|
case "object":
|
|
89
|
-
return Array.isArray(o) && o.every((
|
|
89
|
+
return Array.isArray(o) && o.every((f) => typeof f == "string") ? nt(c, { submissions: { _temp: { value: o, type: "enum" } }, context: r }) : !1;
|
|
90
90
|
}
|
|
91
91
|
break;
|
|
92
92
|
}
|
|
@@ -102,7 +102,7 @@ var Tn = "9.7.0", Mr = `https://sdk.inploi.com/@inploi/flows@${Tn}/cdn/captcha/i
|
|
|
102
102
|
}
|
|
103
103
|
case "phone":
|
|
104
104
|
case "string": {
|
|
105
|
-
let o = a.type === "phone" ?
|
|
105
|
+
let o = a.type === "phone" ? ht(a.value) : a.value;
|
|
106
106
|
switch (e.compare) {
|
|
107
107
|
case "equals":
|
|
108
108
|
return o === e.compareValue;
|
|
@@ -150,395 +150,414 @@ var Tn = "9.7.0", Mr = `https://sdk.inploi.com/@inploi/flows@${Tn}/cdn/captcha/i
|
|
|
150
150
|
}
|
|
151
151
|
break;
|
|
152
152
|
}
|
|
153
|
-
},
|
|
153
|
+
}, nt = (e, { context: r, submissions: t }) => {
|
|
154
154
|
let n = "combinator" in e.data ? e.data.conditions : [e.data];
|
|
155
155
|
if (("combinator" in e.data ? e.data.combinator : "and") === "or") {
|
|
156
156
|
for (let s of n)
|
|
157
|
-
if (
|
|
157
|
+
if (Qt({ condition: s, context: r, submissions: t, ifBlock: e }))
|
|
158
158
|
return !0;
|
|
159
159
|
return !1;
|
|
160
160
|
} else {
|
|
161
161
|
for (let s of n)
|
|
162
|
-
if (!
|
|
162
|
+
if (!Qt({ condition: s, context: r, submissions: t, ifBlock: e }))
|
|
163
163
|
return !1;
|
|
164
164
|
return !0;
|
|
165
165
|
}
|
|
166
|
-
},
|
|
167
|
-
let [a, ...o] = s.trim().split("."), c =
|
|
166
|
+
}, zn = /{{\s*([^}]+?)\s*(?:\|\s*([^}]+?)\s*)?}}/g, Kn = (e, { context: r, submissions: t }) => e.replace(zn, (n, s, i = "") => {
|
|
167
|
+
let [a, ...o] = s.trim().split("."), c = Ar({ key: a, path: o, submissions: t, context: r });
|
|
168
168
|
if (!c)
|
|
169
169
|
return i;
|
|
170
170
|
switch (c.type) {
|
|
171
171
|
case "boolean":
|
|
172
172
|
return c.value === !0 ? "true" : "false";
|
|
173
173
|
case "file":
|
|
174
|
-
return c.value.map((
|
|
174
|
+
return c.value.map((f) => `${f.name} (${qe(f.sizeKb)})`).join(", ");
|
|
175
175
|
case "enum":
|
|
176
176
|
return c.value.join(", ");
|
|
177
177
|
case "address":
|
|
178
|
-
return Object.values(c.value).filter((
|
|
178
|
+
return Object.values(c.value).filter((f) => f && f.trim().length > 0).join(", ");
|
|
179
179
|
case "number":
|
|
180
180
|
case "string":
|
|
181
181
|
return c.value ? c.value.toString() : i;
|
|
182
182
|
case "phone":
|
|
183
|
-
return
|
|
183
|
+
return ht(c.value);
|
|
184
184
|
case "integration": {
|
|
185
185
|
if (typeof c.value != "object" || Array.isArray(c.value))
|
|
186
186
|
break;
|
|
187
|
-
let
|
|
188
|
-
switch (typeof
|
|
187
|
+
let f = Ft(c.value, o);
|
|
188
|
+
switch (typeof f) {
|
|
189
189
|
case "boolean":
|
|
190
|
-
return
|
|
190
|
+
return f === !0 ? "true" : "false";
|
|
191
191
|
case "string":
|
|
192
|
-
return
|
|
192
|
+
return f;
|
|
193
193
|
case "number":
|
|
194
|
-
return
|
|
194
|
+
return f.toString();
|
|
195
195
|
case "object":
|
|
196
|
-
if (Array.isArray(
|
|
197
|
-
return
|
|
196
|
+
if (Array.isArray(f) && f.every((g) => typeof g == "string"))
|
|
197
|
+
return f.join(", ");
|
|
198
198
|
}
|
|
199
199
|
break;
|
|
200
200
|
}
|
|
201
201
|
}
|
|
202
202
|
return i;
|
|
203
|
-
}),
|
|
203
|
+
}), Or = (e) => {
|
|
204
204
|
let r = e.find((t) => t.isHead);
|
|
205
205
|
if (!r)
|
|
206
206
|
throw new Error("No head node found");
|
|
207
207
|
return r;
|
|
208
|
-
},
|
|
208
|
+
}, Dt = (e) => {
|
|
209
209
|
var r, t;
|
|
210
210
|
if (!(e.data.isFinished || (r = e.data.startedWriteNodeIds) != null && r.length))
|
|
211
211
|
return (t = [...e.data.messages].reverse().find((n) => n.groupId && e.nodes.some((s) => s.id === n.groupId && s.type.startsWith("question-")) && (n.type === "system" || "author" in n && n.author === "user"))) == null ? void 0 : t.groupId;
|
|
212
|
-
},
|
|
212
|
+
}, Vt = (e) => Array.isArray(e) ? e.map(Vt) : e !== null && typeof e == "object" ? Object.fromEntries(Object.entries(e).sort(([r], [t]) => r.localeCompare(t)).map(([r, t]) => [r, Vt(t)])) : typeof e == "function" ? void 0 : e;
|
|
213
|
+
async function Gn(e, r, t, n) {
|
|
214
|
+
var s;
|
|
215
|
+
let i = new TextEncoder().encode(JSON.stringify(Vt(t))), a = await crypto.subtle.digest("SHA-256", i);
|
|
216
|
+
if (n != null && n.aborted)
|
|
217
|
+
return;
|
|
218
|
+
let o = Array.from(new Uint8Array(a), (b) => b.toString(16).padStart(2, "0")).join(""), c = (s = e.data).preApplyFingerprints ?? (s.preApplyFingerprints = []);
|
|
219
|
+
if (c.includes(o))
|
|
220
|
+
return;
|
|
221
|
+
c.push(o);
|
|
222
|
+
let f = new AbortController(), g = setTimeout(() => f.abort(), 5e3);
|
|
223
|
+
r.fetch("/flow/pre-apply", { method: "POST", signal: f.signal, body: JSON.stringify(t) }).catch(() => {
|
|
224
|
+
let b = c.indexOf(o);
|
|
225
|
+
b !== -1 && c.splice(b, 1);
|
|
226
|
+
}).finally(() => {
|
|
227
|
+
clearTimeout(g);
|
|
228
|
+
});
|
|
229
|
+
}
|
|
230
|
+
var Br = ({ context: e, submissions: r }) => ({ context: e, submissions: r ?? {} }), fe = (e, r) => Kn(e, Br(r)), Hn = (e, r) => nt(e, Br(r)), jr = ({ node: e, nodes: r, stopWhen: t }) => {
|
|
213
231
|
if ((t == null ? void 0 : t(e)) === !0)
|
|
214
232
|
return e;
|
|
215
233
|
let n = e.nextId ? r.find((s) => s.id === e.nextId) : void 0;
|
|
216
234
|
if (n)
|
|
217
|
-
return
|
|
218
|
-
},
|
|
235
|
+
return jr({ node: n, nodes: r, stopWhen: t });
|
|
236
|
+
}, Jn = ({ childNode: e, nodes: r }) => {
|
|
219
237
|
let t = r.filter((n) => n.type === "if-block").find((n) => {
|
|
220
238
|
if (!n.branchId)
|
|
221
239
|
return !1;
|
|
222
240
|
let s = r.find((a) => a.id === n.branchId);
|
|
223
241
|
if (!s)
|
|
224
242
|
return !1;
|
|
225
|
-
let i =
|
|
243
|
+
let i = jr({ node: s, nodes: r, stopWhen: (a) => a.id === e.id });
|
|
226
244
|
return !(!i || i.id !== e.id);
|
|
227
245
|
});
|
|
228
246
|
if (t != null && t.nextId)
|
|
229
247
|
return r.find((n) => n.id === t.nextId);
|
|
230
|
-
},
|
|
231
|
-
var
|
|
232
|
-
let
|
|
233
|
-
(
|
|
234
|
-
var
|
|
235
|
-
if (
|
|
248
|
+
}, Zn = 3, Xn = ({ flow: e, analytics: r, logger: t, talentBankClient: n, context: s, apiClient: i, getSubmissions: a, getApplicationRecovery: o, setApplicationRecovery: c, chatService: f, persistWriteBarrier: g, onSubmitNetworkError: b, closedRoleBehaviour: h, dateEchoLocale: m, onFlowEnd: k, onInterpret: I, forceSubmitConfirmation: C, t: x }) => {
|
|
249
|
+
var y;
|
|
250
|
+
let F = new AbortController(), N = { submitAccepted: !1 };
|
|
251
|
+
(y = e.data).startedWriteNodeIds ?? (y.startedWriteNodeIds = e.nodes.flatMap((R) => {
|
|
252
|
+
var q, P;
|
|
253
|
+
if (R.type !== "integration-application-submit" || !e.data.nodeHistory.includes(R.id))
|
|
236
254
|
return [];
|
|
237
|
-
let
|
|
238
|
-
return (
|
|
255
|
+
let O = R.data.key ? (q = a()) == null ? void 0 : q[R.data.key] : void 0;
|
|
256
|
+
return (O == null ? void 0 : O.type) === "integration" && ((P = Er(O.value)) == null ? void 0 : P.verdict) === "not_submitted" ? [] : [R.id];
|
|
239
257
|
}));
|
|
240
|
-
let
|
|
241
|
-
let
|
|
242
|
-
if (
|
|
258
|
+
let V = { ...r.service, log: (R) => r.service.log({ ...R, customProperties: { ...R.customProperties, ...r.customProperties } }) }, T = async (R, O) => {
|
|
259
|
+
let q = F.signal;
|
|
260
|
+
if (q.aborted)
|
|
243
261
|
return;
|
|
244
|
-
let
|
|
245
|
-
var
|
|
246
|
-
return
|
|
262
|
+
let P = a(), H = o(), M = (H == null ? void 0 : H.submitNodeId) === R.id ? e.nodes.find((A) => {
|
|
263
|
+
var B;
|
|
264
|
+
return A.id === H.fileQuestionNodeId && A.type === "question-file" && ((B = P == null ? void 0 : P[A.data.key]) == null ? void 0 : B.type) !== "file";
|
|
247
265
|
}) : void 0;
|
|
248
|
-
if (
|
|
249
|
-
return
|
|
250
|
-
|
|
266
|
+
if (M)
|
|
267
|
+
return T(M, O);
|
|
268
|
+
I == null || I(R, O);
|
|
251
269
|
try {
|
|
252
|
-
await
|
|
253
|
-
if (!
|
|
270
|
+
await Yn({ flow: e, analytics: V, logger: t, talentBankClient: n, apiClient: i, context: s, node: R, submissions: P, applicationRecovery: H, setApplicationRecovery: async (A) => {
|
|
271
|
+
if (!q.aborted)
|
|
254
272
|
try {
|
|
255
|
-
await c(
|
|
256
|
-
} catch (
|
|
257
|
-
t.error("Failed to persist application recovery",
|
|
273
|
+
await c(A);
|
|
274
|
+
} catch (B) {
|
|
275
|
+
t.error("Failed to persist application recovery", B);
|
|
258
276
|
}
|
|
259
|
-
}, forceSubmitConfirmation: (
|
|
260
|
-
|
|
261
|
-
}, captcha:
|
|
262
|
-
if (
|
|
277
|
+
}, forceSubmitConfirmation: C || (H == null ? void 0 : H.submitNodeId) === R.id, run: N, persistWriteBarrier: g, onSubmitNetworkError: b, closedRoleBehaviour: h, dateEchoLocale: m, signal: q, t: x, chat: { sendMessage: async (A) => f.send({ groupId: R.id, message: A, signal: q }), userInput: async (A) => f.input({ input: A, signal: q }), setSubmission: (A, B) => {
|
|
278
|
+
q.aborted || f.setSubmission(A, B);
|
|
279
|
+
}, captcha: f.captcha }, next: (A) => {
|
|
280
|
+
if (q.aborted)
|
|
263
281
|
return;
|
|
264
|
-
let
|
|
265
|
-
return
|
|
282
|
+
let B = (H == null ? void 0 : H.fileQuestionNodeId) === R.id ? H.submitNodeId : A, $ = B ? e.nodes.find((U) => U.id === B) : Jn({ childNode: R, nodes: e.nodes });
|
|
283
|
+
return $ ? T($, R) : k == null ? void 0 : k(R);
|
|
266
284
|
}, end: () => {
|
|
267
|
-
|
|
285
|
+
q.aborted || (k == null || k(R));
|
|
268
286
|
} });
|
|
269
|
-
} catch (
|
|
270
|
-
if (
|
|
287
|
+
} catch (A) {
|
|
288
|
+
if (A instanceof Fr)
|
|
271
289
|
return;
|
|
272
|
-
throw
|
|
290
|
+
throw A;
|
|
273
291
|
}
|
|
274
292
|
};
|
|
275
|
-
return { interpret: async (
|
|
276
|
-
let
|
|
277
|
-
return
|
|
278
|
-
}, undo: (
|
|
279
|
-
var
|
|
280
|
-
if ((
|
|
293
|
+
return { interpret: async (R) => {
|
|
294
|
+
let O = e.nodes.find((q) => q.id === R) ?? Or(e.nodes);
|
|
295
|
+
return T(O);
|
|
296
|
+
}, undo: (R) => {
|
|
297
|
+
var B;
|
|
298
|
+
if (delete e.data.reviewReplay, ((B = e.data.startedWriteNodeIds) == null ? void 0 : B.length) || e.data.isFinished)
|
|
281
299
|
return { removed: 0 };
|
|
282
|
-
let
|
|
283
|
-
if (
|
|
300
|
+
let O = Dt(e), q = O ? R.lastIndexOf(O) : -1, P = e.nodes.find(($) => $.id === O);
|
|
301
|
+
if (q === -1 || !P)
|
|
284
302
|
return { removed: 0 };
|
|
285
|
-
let
|
|
286
|
-
|
|
287
|
-
let
|
|
288
|
-
e.data.messages = e.data.messages.filter((
|
|
289
|
-
let
|
|
290
|
-
for (let
|
|
291
|
-
let
|
|
292
|
-
if (!(!
|
|
293
|
-
for (let
|
|
294
|
-
typeof
|
|
295
|
-
}
|
|
296
|
-
return
|
|
303
|
+
let H = e.nodes.find(($) => $.id === R[R.length - 1]);
|
|
304
|
+
F.abort();
|
|
305
|
+
let M = R.splice(q);
|
|
306
|
+
e.data.messages = e.data.messages.filter(($) => !$.groupId || !M.includes($.groupId)), e.data.currentInput = null;
|
|
307
|
+
let A = a();
|
|
308
|
+
for (let $ of M.slice(1)) {
|
|
309
|
+
let U = e.nodes.find((j) => j.id === $);
|
|
310
|
+
if (!(!U || !A || U.id === O) && ("key" in U.data && U.data.key && delete A[U.data.key], "keys" in U.data))
|
|
311
|
+
for (let j of Object.values(U.data.keys))
|
|
312
|
+
typeof j == "string" && delete A[j];
|
|
313
|
+
}
|
|
314
|
+
return F = new AbortController(), T(P, H), { removed: M.length };
|
|
297
315
|
}, abort: () => {
|
|
298
|
-
|
|
316
|
+
F.abort();
|
|
299
317
|
} };
|
|
300
318
|
};
|
|
301
|
-
async function
|
|
319
|
+
async function Yn(e) {
|
|
302
320
|
let r = e.node;
|
|
303
321
|
switch (r.type) {
|
|
304
322
|
case "flow-section":
|
|
305
323
|
return await e.chat.sendMessage({ type: "system", variant: "info", text: r.data.title }), e.next(r.nextId);
|
|
306
324
|
case "pre-apply-result":
|
|
307
|
-
return
|
|
325
|
+
return bs({ ...e, node: r });
|
|
308
326
|
case "text":
|
|
309
|
-
return
|
|
327
|
+
return ls({ ...e, node: r });
|
|
310
328
|
case "image":
|
|
311
|
-
return
|
|
329
|
+
return us({ ...e, node: r });
|
|
312
330
|
case "question-text":
|
|
313
|
-
return
|
|
331
|
+
return cs({ ...e, node: r });
|
|
314
332
|
case "question-enum":
|
|
315
|
-
return
|
|
333
|
+
return ps({ ...e, node: r });
|
|
316
334
|
case "question-number":
|
|
317
|
-
return
|
|
335
|
+
return ds({ ...e, node: r });
|
|
318
336
|
case "question-phone":
|
|
319
|
-
return
|
|
337
|
+
return fs({ ...e, node: r });
|
|
320
338
|
case "question-boolean":
|
|
321
|
-
return
|
|
339
|
+
return hs({ ...e, node: r });
|
|
322
340
|
case "question-file":
|
|
323
|
-
return
|
|
341
|
+
return ys({ ...e, node: r });
|
|
324
342
|
case "question-address":
|
|
325
|
-
return
|
|
343
|
+
return ms({ ...e, node: r });
|
|
326
344
|
case "end-flow":
|
|
327
|
-
return
|
|
345
|
+
return gs({ ...e, node: r });
|
|
328
346
|
case "if-block":
|
|
329
|
-
return
|
|
347
|
+
return os({ ...e, node: r });
|
|
330
348
|
case "jump":
|
|
331
|
-
return
|
|
349
|
+
return ts({ ...e, node: r });
|
|
332
350
|
case "link":
|
|
333
|
-
return
|
|
351
|
+
return is({ ...e, node: r });
|
|
334
352
|
case "integration-application-submit":
|
|
335
|
-
return
|
|
353
|
+
return as({ ...e, node: r });
|
|
336
354
|
case "add-submission":
|
|
337
|
-
return
|
|
355
|
+
return rs({ ...e, node: r });
|
|
338
356
|
case "integration-workflow-get":
|
|
339
357
|
throw Error("Workflow should be unreachable");
|
|
340
358
|
case "check-duplicate":
|
|
341
|
-
return
|
|
359
|
+
return es({ ...e, node: r });
|
|
342
360
|
case "feedback":
|
|
343
|
-
return
|
|
361
|
+
return Qn({ ...e, node: r });
|
|
344
362
|
default:
|
|
345
363
|
throw new Error(`Unknown node: ${JSON.stringify(r)}`);
|
|
346
364
|
}
|
|
347
365
|
}
|
|
348
|
-
async function
|
|
366
|
+
async function Qn({ next: e, node: r }) {
|
|
349
367
|
e(r.nextId);
|
|
350
368
|
}
|
|
351
|
-
async function
|
|
369
|
+
async function es({ next: e, node: r, talentBankClient: t, submissions: n, flow: s, logger: i, chat: a }) {
|
|
352
370
|
var c;
|
|
353
371
|
let o = { isDuplicate: !1 };
|
|
354
372
|
if (n && t) {
|
|
355
|
-
let
|
|
356
|
-
if (r.data.scope === "company" ||
|
|
373
|
+
let f = r.data.scope === "job" ? (c = s.job) == null ? void 0 : c.id : void 0;
|
|
374
|
+
if (r.data.scope === "company" || f != null)
|
|
357
375
|
try {
|
|
358
|
-
o = await t.checkDuplicate({ email:
|
|
376
|
+
o = await t.checkDuplicate({ email: hn({ key: r.data.email, submissions: n }).toString(), jobId: f, scope: r.data.scope });
|
|
359
377
|
} catch (g) {
|
|
360
378
|
i.error("[check-duplicate]", g);
|
|
361
379
|
}
|
|
362
380
|
}
|
|
363
381
|
a.setSubmission(r.data.key, { type: "integration", value: o }), e(r.nextId);
|
|
364
382
|
}
|
|
365
|
-
async function
|
|
383
|
+
async function ts({ next: e, node: r }) {
|
|
366
384
|
e(r.data.targetId);
|
|
367
385
|
}
|
|
368
|
-
async function
|
|
386
|
+
async function rs({ next: e, node: r, logger: t, submissions: n, context: s }) {
|
|
369
387
|
if (!n) {
|
|
370
388
|
t.error("Submissions not found");
|
|
371
389
|
return;
|
|
372
390
|
}
|
|
373
391
|
n[r.data.key] = { type: "string", value: fe(r.data.value, { submissions: n, context: s }) }, e(r.nextId);
|
|
374
392
|
}
|
|
375
|
-
var
|
|
376
|
-
let { waitMs: n, throttles: s, maintenance: i } =
|
|
393
|
+
var ns = 5e3, ss = (e, r, t) => {
|
|
394
|
+
let { waitMs: n, throttles: s, maintenance: i } = En(r == null ? void 0 : r.throttles, t);
|
|
377
395
|
return { key: e, until: Date.now() + n, ...s !== void 0 && { throttles: s }, ...i && { maintenance: i } };
|
|
378
396
|
};
|
|
379
|
-
async function
|
|
380
|
-
var
|
|
381
|
-
if ((
|
|
382
|
-
return await e.sendMessage({ type: "system", variant: "warning", text:
|
|
383
|
-
let
|
|
384
|
-
var
|
|
385
|
-
let
|
|
386
|
-
|
|
387
|
-
let
|
|
388
|
-
(
|
|
389
|
-
let
|
|
397
|
+
async function as({ chat: e, next: r, end: t, node: n, logger: s, apiClient: i, submissions: a, analytics: o, flow: c, applicationRecovery: f, setApplicationRecovery: g, forceSubmitConfirmation: b, run: h, persistWriteBarrier: m, signal: k, onSubmitNetworkError: I, closedRoleBehaviour: C, t: x }) {
|
|
398
|
+
var T;
|
|
399
|
+
if ((T = c.data.startedWriteNodeIds) != null && T.includes(n.id) && (f == null ? void 0 : f.submitNodeId) !== n.id)
|
|
400
|
+
return await e.sendMessage({ type: "system", variant: "warning", text: x("submission_unknown") }), t();
|
|
401
|
+
let y = c.job ? `${n.id}@${c.job.id_type}:${c.job.id}` : n.id, F = 0, N = h.submitAccepted && n.data.skipConfirmation === !0 && (f == null ? void 0 : f.submitNodeId) !== n.id, V = async (R) => {
|
|
402
|
+
var Te, Ye, Oe, Be, ut, Qe, ct;
|
|
403
|
+
let O = ((Te = c.data.submitCooldown) == null ? void 0 : Te.key) === y ? c.data.submitCooldown : void 0;
|
|
404
|
+
O && (O.until = Math.min(O.until, Date.now() + (O.maintenance ? gn : O.throttles ? Mr : bn)));
|
|
405
|
+
let q = O == null ? void 0 : O.until;
|
|
406
|
+
(c.data.reviewRequiresSend === !0 && !N || R !== !0 || q !== void 0 && q > Date.now()) && await e.userInput({ type: "submit", key: void 0, config: { label: n.data.submitLabel, ...q !== void 0 && { availableAt: q } } }), N = !1;
|
|
407
|
+
let P;
|
|
390
408
|
if (n.data.captcha) {
|
|
391
|
-
let
|
|
409
|
+
let L = e.captcha, Ve = !0;
|
|
392
410
|
try {
|
|
393
|
-
|
|
394
|
-
e.sendMessage({ type: "text", author: "bot", text:
|
|
411
|
+
P = await Wn(i, { signal: k, container: (L == null ? void 0 : L.container()) ?? null, theme: L == null ? void 0 : L.theme, onInteractive: () => {
|
|
412
|
+
e.sendMessage({ type: "text", author: "bot", text: x("captcha_check") }).catch(() => {
|
|
395
413
|
}).then(() => {
|
|
396
|
-
|
|
414
|
+
Ve && (L == null || L.reveal(!0));
|
|
397
415
|
});
|
|
398
416
|
} });
|
|
399
|
-
} catch (
|
|
400
|
-
if (s.error("Captcha check failed",
|
|
417
|
+
} catch (et) {
|
|
418
|
+
if (s.error("Captcha check failed", et), k.aborted)
|
|
401
419
|
return;
|
|
402
420
|
} finally {
|
|
403
|
-
|
|
421
|
+
Ve = !1, L == null || L.reveal(!1);
|
|
404
422
|
}
|
|
405
423
|
}
|
|
406
|
-
await e.sendMessage({ type: "loading", text:
|
|
407
|
-
let { anonymous_id:
|
|
408
|
-
if (
|
|
424
|
+
await e.sendMessage({ type: "loading", text: x("submitting") });
|
|
425
|
+
let { anonymous_id: H, session_id: M } = o.getSessionInfo();
|
|
426
|
+
if (k.aborted)
|
|
409
427
|
return;
|
|
410
|
-
let
|
|
411
|
-
if ((
|
|
428
|
+
let A = ((Ye = c.data.startedWriteNodeIds) == null ? void 0 : Ye.includes(n.id)) === !0;
|
|
429
|
+
if ((f == null ? void 0 : f.submitNodeId) === n.id && await g(void 0), A || (c.data.startedWriteNodeIds = [...c.data.startedWriteNodeIds ?? [], n.id]), await m().catch((L) => s.error("Failed to persist application write barrier", L)), k.aborted)
|
|
412
430
|
return;
|
|
413
|
-
let
|
|
414
|
-
|
|
415
|
-
await e.sendMessage({ type: "text", author: "bot", text:
|
|
416
|
-
})().catch((
|
|
417
|
-
},
|
|
418
|
-
if (clearTimeout(
|
|
431
|
+
let B, $ = setTimeout(() => {
|
|
432
|
+
B = (async () => {
|
|
433
|
+
await e.sendMessage({ type: "text", author: "bot", text: x("submission_still_working") }), await e.sendMessage({ type: "loading", text: x("submitting") });
|
|
434
|
+
})().catch((L) => s.error("Failed to send submission progress message", L));
|
|
435
|
+
}, ns), U, j = await i.fetch("/flow/submit", { method: "POST", body: JSON.stringify({ log_submit: !1, integration_id: n.data.integrationId, anonymous_id: H, session_id: M, job: c.job, flow_build: c.build, ...P !== void 0 && { captcha_token: P }, submissions: vn(c.nodes, xn(a || {}, n.data.submitKeys)), pre_apply: Vr(c.nodes, a || {}, c.data.flowSessionId) }) }).catch((L) => (U = L, Tn(L) ? L.data : L));
|
|
436
|
+
if (clearTimeout($), await B, k.aborted)
|
|
419
437
|
return;
|
|
420
|
-
|
|
421
|
-
|
|
422
|
-
|
|
423
|
-
let
|
|
424
|
-
|
|
425
|
-
|
|
426
|
-
|
|
438
|
+
if (U !== void 0 && !On(U) && I)
|
|
439
|
+
return await I(U, k), V(!0);
|
|
440
|
+
n.data.key && e.setSubmission(n.data.key, { type: "integration", value: j });
|
|
441
|
+
let D = Er(j, U instanceof Bn ? U.status : void 0), le = c.data.failedAttemptAt, ue = le == null ? void 0 : le[y];
|
|
442
|
+
le && ue !== void 0 && ue > Date.now() && (ue = le[y] = Date.now());
|
|
443
|
+
let Je = ue !== void 0 && Date.now() - ue < wn || ((Oe = c.data.unconfirmedAttemptKeys) == null ? void 0 : Oe.includes(y)) === !0, _e = _n(j);
|
|
444
|
+
_e && o.log({ event: "FLOW_SUBMIT", properties: { flow_id: c.id, flow_version: c.version, flow_session_id: c.data.flowSessionId, flow_build: c.build, service: _e.service, response: _e.response, flow_type: "CHATBOT_DRAWER", job: c.job, ...(D == null ? void 0 : D.outcome) === "duplicate" && { outcome: Je ? "duplicate_after_own_attempt" : "duplicate" }, ..._e.outcome && { outcome: _e.outcome } } });
|
|
445
|
+
let lt = Ht(j) || (j == null ? void 0 : j.success) === !0;
|
|
446
|
+
if ((lt || Jt(j)) && (h.submitAccepted = !0), lt && ((Be = c.data.submitCooldown) == null ? void 0 : Be.throttles) !== void 0 && (delete c.data.submitCooldown.throttles, await m().catch((L) => s.error("Failed to persist submit cooldown reset", L))), Ht(j)) {
|
|
447
|
+
let { redirect_url: L, message: Ve, button_text: et } = j.integration_response.data;
|
|
448
|
+
await e.sendMessage({ type: "text", author: "bot", text: Ve ?? x("submission_redirect_message") });
|
|
427
449
|
try {
|
|
428
|
-
let
|
|
429
|
-
|
|
430
|
-
if (!
|
|
450
|
+
let ke = new URL(L);
|
|
451
|
+
H && !ke.searchParams.has("anonymous_id") && ke.searchParams.set("anonymous_id", H), await e.sendMessage({ type: "link", href: ke.toString(), text: et ?? x("complete_submission"), onClick: () => {
|
|
452
|
+
if (!M) {
|
|
431
453
|
s.error("session_id not set, cannot log FLOW_REDIRECT event");
|
|
432
454
|
return;
|
|
433
455
|
}
|
|
434
|
-
o.log({ event: "FLOW_REDIRECT", properties: { flow_build: c.build, flow_id: c.id, flow_session_id:
|
|
456
|
+
o.log({ event: "FLOW_REDIRECT", properties: { flow_build: c.build, flow_id: c.id, flow_session_id: M, flow_version: c.version, href: ke.toString(), job: c.job } });
|
|
435
457
|
} });
|
|
436
|
-
} catch (
|
|
437
|
-
s.error(`Invalid redirect URL: ${
|
|
458
|
+
} catch (ke) {
|
|
459
|
+
s.error(`Invalid redirect URL: ${L}`, ke), e.sendMessage({ type: "system", variant: "error", text: x("redirect_url_error") });
|
|
438
460
|
}
|
|
439
461
|
return r(n.nextId);
|
|
440
462
|
}
|
|
441
|
-
let
|
|
442
|
-
if (
|
|
443
|
-
return await e.sendMessage({ type: "system", variant: "success", text:
|
|
444
|
-
if ((
|
|
445
|
-
return n.data.skipConfirmation !== !0 && await e.sendMessage({ type: "system", variant: "success", text:
|
|
446
|
-
let
|
|
447
|
-
if (!
|
|
448
|
-
if (s.error(
|
|
449
|
-
return e.setSubmission(Fe, null), await g({ fileQuestionNodeId:
|
|
450
|
-
if (
|
|
451
|
-
return await e.sendMessage({ type: "system", variant: "info", text:
|
|
452
|
-
if (
|
|
453
|
-
return await e.sendMessage({ type: "system", variant: "info", text:
|
|
454
|
-
let
|
|
455
|
-
return
|
|
456
|
-
}
|
|
457
|
-
return s.error(
|
|
463
|
+
let Ze = Jt(j);
|
|
464
|
+
if (Ze)
|
|
465
|
+
return await e.sendMessage({ type: "system", variant: "success", text: Ze.message ?? x("submission_pending") }), r(n.nextId);
|
|
466
|
+
if ((j == null ? void 0 : j.success) === !0)
|
|
467
|
+
return n.data.skipConfirmation !== !0 && await e.sendMessage({ type: "system", variant: "success", text: x("submission_completed") }), r(n.nextId);
|
|
468
|
+
let Xe = kn(D), Fe = Xe !== void 0 && ((ut = a == null ? void 0 : a[Xe]) == null ? void 0 : ut.type) === "file" ? Xe : void 0, De = Fe === void 0 ? void 0 : c.nodes.find((L) => L.type === "question-file" && L.data.key === Fe);
|
|
469
|
+
if (!De && !(C === "terminal" && (D == null ? void 0 : D.outcome) === "closed") && !Zt(D) && (c.data.submitCooldown = ss(y, O, D)), (D == null ? void 0 : D.outcome) !== "duplicate" && (c.data.failedAttemptAt = { ...c.data.failedAttemptAt, [y]: Date.now() }, (Qe = c.data.unconfirmedAttemptKeys) != null && Qe.includes(y) && (c.data.unconfirmedAttemptKeys = c.data.unconfirmedAttemptKeys.filter((L) => L !== y))), (D == null ? void 0 : D.verdict) === "not_submitted" || (D == null ? void 0 : D.outcome) === "duplicate" || (D == null ? void 0 : D.outcome) === "closed" ? (A || (c.data.startedWriteNodeIds = (ct = c.data.startedWriteNodeIds) == null ? void 0 : ct.filter((L) => L !== n.id)), (f == null ? void 0 : f.submitNodeId) === n.id && await g(f), await m().catch((L) => s.error("Failed to persist application write barrier release", L))) : await m().catch((L) => s.error("Failed to persist submit cooldown", L)), D) {
|
|
470
|
+
if (s.error(U ?? D.message), De && Fe !== void 0)
|
|
471
|
+
return e.setSubmission(Fe, null), await g({ fileQuestionNodeId: De.id, submitNodeId: n.id }), await e.sendMessage({ type: "system", variant: "error", text: x("submission_unreadable_document") }), r(De.id);
|
|
472
|
+
if (D.outcome === "duplicate")
|
|
473
|
+
return await e.sendMessage({ type: "system", variant: "info", text: x(Je ? "submission_duplicate_earlier_attempt" : "submission_duplicate") }), V(!1);
|
|
474
|
+
if (D.outcome === "closed")
|
|
475
|
+
return await e.sendMessage({ type: "system", variant: "info", text: x("submission_closed") }), C === "terminal" ? (delete c.data.submitCooldown, t()) : V(!1);
|
|
476
|
+
let L = Cn(D);
|
|
477
|
+
return L ? (await e.sendMessage({ type: "system", variant: "warning", text: L.until === void 0 ? x("submission_provider_maintenance_later") : x("submission_provider_maintenance", { time: Lr(L.until, void 0) }) }), V(!1)) : D.outcome === "unknown" ? (await e.sendMessage({ type: "system", variant: "warning", text: x(Sn(D) ? "submission_unknown_do_not_resubmit" : "submission_unknown") }), V(!1)) : Zt(D) ? In(j) ? (await e.sendMessage({ type: "text", author: "bot", text: D.message }), V(!1)) : (F === 0 && await e.sendMessage({ type: "system", variant: "warning", text: x("captcha_failed") }), F++, V(F <= Zn)) : An(D) ? (await e.sendMessage({ type: "system", variant: "error", text: x("submission_retryable") }), V(!1)) : (await e.sendMessage({ type: "system", variant: "error", text: x("submission_failed") }), t());
|
|
478
|
+
}
|
|
479
|
+
return s.error(U ?? j), await e.sendMessage({ type: "system", variant: "error", text: x("submission_failed") }), t();
|
|
458
480
|
};
|
|
459
|
-
await
|
|
481
|
+
await V(b === !0 && !N ? !1 : n.data.skipConfirmation);
|
|
460
482
|
}
|
|
461
|
-
async function
|
|
483
|
+
async function is({ chat: e, next: r, node: t, submissions: n, context: s }) {
|
|
462
484
|
await e.sendMessage({ type: "link", href: fe(t.data.href, { submissions: n, context: s }), text: fe(t.data.cta, { submissions: n, context: s }) }), r(t.nextId);
|
|
463
485
|
}
|
|
464
|
-
async function
|
|
465
|
-
r(
|
|
486
|
+
async function os({ submissions: e, next: r, node: t, context: n }) {
|
|
487
|
+
r(Hn(t, { submissions: e, context: n }) ? t.branchId : t.nextId);
|
|
466
488
|
}
|
|
467
|
-
async function
|
|
489
|
+
async function ls({ chat: e, next: r, node: t, submissions: n, context: s }) {
|
|
468
490
|
await e.sendMessage({ author: "bot", type: "text", text: fe(t.data.text, { submissions: n, context: s }) }), r(t.nextId);
|
|
469
491
|
}
|
|
470
|
-
async function
|
|
492
|
+
async function us({ chat: e, next: r, node: t }) {
|
|
471
493
|
await e.sendMessage({ author: "bot", type: "image", url: t.data.url, height: t.data.height, width: t.data.width }), r(t.nextId);
|
|
472
494
|
}
|
|
473
|
-
async function
|
|
495
|
+
async function cs({ chat: e, next: r, node: t, submissions: n, context: s, t: i, dateEchoLocale: a }) {
|
|
474
496
|
await e.sendMessage({ author: "bot", type: "text", text: fe(t.data.question, { submissions: n, context: s }) });
|
|
475
|
-
let
|
|
476
|
-
|
|
497
|
+
let o = t.data.format === "phone" ? await e.userInput({ key: t.data.key, type: "phone", config: { optional: t.data.optional, placeholder: t.data.placeholder, minChars: t.data.minChars, maxChars: t.data.maxChars, submissionFormat: "text", defaultValue: {} } }) : await e.userInput({ key: t.data.key, type: "text", config: { optional: t.data.optional, placeholder: t.data.placeholder, format: t.data.format, maxChars: t.data.maxChars, minChars: t.data.minChars, multiline: t.data.format === "text" && t.data.multiline === !0 } });
|
|
498
|
+
o === null ? await e.sendMessage({ type: "system", variant: "info", semantic: "question-skipped", text: i("skipped") }) : await e.sendMessage({ author: "user", type: "text", text: o.type === "phone" ? ht(o.value) : t.data.format === "date" && a !== void 0 ? mn(o.value, a) : o.value }), r(t.nextId);
|
|
477
499
|
}
|
|
478
|
-
async function
|
|
500
|
+
async function ds({ chat: e, next: r, node: t, submissions: n, context: s, t: i }) {
|
|
479
501
|
await e.sendMessage({ author: "bot", type: "text", text: fe(t.data.question, { submissions: n, context: s }) });
|
|
480
502
|
let a = await e.userInput({ key: t.data.key, type: "number", config: { max: t.data.max, min: t.data.min, optional: t.data.optional, placeholder: t.data.placeholder, decimalCases: t.data.decimalCases } });
|
|
481
|
-
a === null ? await e.sendMessage({ type: "system", variant: "info", text: i("skipped") }) : await e.sendMessage({ author: "user", type: "text", text: a.value.toString() }), r(t.nextId);
|
|
503
|
+
a === null ? await e.sendMessage({ type: "system", variant: "info", semantic: "question-skipped", text: i("skipped") }) : await e.sendMessage({ author: "user", type: "text", text: a.value.toString() }), r(t.nextId);
|
|
482
504
|
}
|
|
483
|
-
async function
|
|
505
|
+
async function fs({ chat: e, next: r, node: t, submissions: n, context: s, t: i }) {
|
|
484
506
|
await e.sendMessage({ author: "bot", type: "text", text: fe(t.data.question, { submissions: n, context: s }) });
|
|
485
507
|
let a = await e.userInput({ key: t.data.key, type: "phone", config: { minChars: t.data.minChars, defaultValue: { countryCode: t.data.defaultCountryCode }, placeholder: t.data.placeholder, submissionFormat: "phone", optional: t.data.optional } });
|
|
486
|
-
a === null ? await e.sendMessage({ type: "system", variant: "info", text: i("skipped") }) : await e.sendMessage({ author: "user", type: "text", text: a.type === "phone" ?
|
|
508
|
+
a === null ? await e.sendMessage({ type: "system", variant: "info", semantic: "question-skipped", text: i("skipped") }) : await e.sendMessage({ author: "user", type: "text", text: a.type === "phone" ? ht(a.value) : a.value }), r(t.nextId);
|
|
487
509
|
}
|
|
488
|
-
async function
|
|
510
|
+
async function ps({ chat: e, next: r, node: t, submissions: n, context: s, t: i }) {
|
|
489
511
|
await e.sendMessage({ author: "bot", type: "text", text: fe(t.data.question, { submissions: n, context: s }) });
|
|
490
512
|
let a = await e.userInput({ key: t.data.key, type: "multiple-choice", config: t.data });
|
|
491
|
-
a.value.length === 0 ? await e.sendMessage({ type: "system", variant: "info", text: i("skipped") }) : await e.sendMessage({ author: "user", type: "text", text: t.data.options.filter((o) => a.value.includes(o.value)).map((o) => o.label).join(", ") }), r(t.nextId);
|
|
513
|
+
a.value.length === 0 ? await e.sendMessage({ type: "system", variant: "info", semantic: "question-skipped", text: i("skipped") }) : await e.sendMessage({ author: "user", type: "text", text: t.data.options.filter((o) => a.value.includes(o.value)).map((o) => o.label).join(", ") }), r(t.nextId);
|
|
492
514
|
}
|
|
493
|
-
async function
|
|
515
|
+
async function hs({ chat: e, next: r, node: t, submissions: n, context: s, t: i }) {
|
|
494
516
|
await e.sendMessage({ author: "bot", type: "text", text: fe(t.data.question, { submissions: n, context: s }) });
|
|
495
517
|
let a = await e.userInput({ key: t.data.key, type: "boolean", config: { optional: t.data.optional, labels: { true: t.data.trueLabel, false: t.data.falseLabel } } });
|
|
496
|
-
a === null ? await e.sendMessage({ type: "system", variant: "info", text: i("skipped") }) : await e.sendMessage({ author: "user", type: "text", text: a.value === !0 ? t.data.trueLabel : t.data.falseLabel }), r(t.nextId);
|
|
518
|
+
a === null ? await e.sendMessage({ type: "system", variant: "info", semantic: "question-skipped", text: i("skipped") }) : await e.sendMessage({ author: "user", type: "text", text: a.value === !0 ? t.data.trueLabel : t.data.falseLabel }), r(t.nextId);
|
|
497
519
|
}
|
|
498
|
-
async function
|
|
520
|
+
async function ms({ chat: e, next: r, node: t, t: n }) {
|
|
499
521
|
await e.sendMessage({ author: "bot", type: "text", text: t.data.question });
|
|
500
522
|
let s = await e.userInput({ type: "address", key: t.data.key, config: { optional: t.data.optional, keys: t.data.keys, line2Required: t.data.line2Required, placeholder: t.data.placeholder } });
|
|
501
523
|
if (s === null)
|
|
502
|
-
await e.sendMessage({ type: "system", variant: "info", text: n("skipped") });
|
|
524
|
+
await e.sendMessage({ type: "system", variant: "info", semantic: "question-skipped", text: n("skipped") });
|
|
503
525
|
else {
|
|
504
526
|
let i = Object.values(s.value).filter((a) => a && a.trim().length > 0).join(", ");
|
|
505
527
|
await e.sendMessage({ author: "user", type: "text", text: i });
|
|
506
528
|
}
|
|
507
529
|
return r(t.nextId);
|
|
508
530
|
}
|
|
509
|
-
async function
|
|
531
|
+
async function ys({ node: e, chat: r, next: t, submissions: n, context: s, t: i }) {
|
|
510
532
|
await r.sendMessage({ author: "bot", type: "text", text: fe(e.data.question, { submissions: n, context: s }) });
|
|
511
533
|
let a = await r.userInput({ key: e.data.key, type: "file", config: { optional: e.data.optional, extensions: e.data.extensions, fileSizeLimitKib: e.data.maxSizeKb ?? 10 * 1024, allowMultiple: e.data.multiple === !0 } });
|
|
512
534
|
if (a === null)
|
|
513
|
-
await r.sendMessage({ type: "system", variant: "info", text: i("skipped") });
|
|
535
|
+
await r.sendMessage({ type: "system", variant: "info", semantic: "question-skipped", text: i("skipped") });
|
|
514
536
|
else
|
|
515
537
|
for (let o of a.value)
|
|
516
538
|
await r.sendMessage({ author: "user", type: "file", fileName: o.name, fileSizeKb: o.sizeKb });
|
|
517
539
|
return t(e.nextId);
|
|
518
540
|
}
|
|
519
|
-
async function
|
|
541
|
+
async function gs({ chat: e, end: r, node: t }) {
|
|
520
542
|
await e.sendMessage({ type: "system", variant: "info", text: t.data.systemMessage }), r();
|
|
521
543
|
}
|
|
522
|
-
async function
|
|
523
|
-
let
|
|
524
|
-
n.setSubmission(e.data.key, { type: "integration", value:
|
|
525
|
-
|
|
526
|
-
if (i.fetch("/flow/pre-apply", { method: "POST", signal: g.signal, body: JSON.stringify({ ...a.getSessionInfo(), job: r.job, flow_build: r.build, pre_apply: Sr(r.nodes, t || {}, r.data.flowSessionId) }) }).catch(() => {
|
|
527
|
-
}).finally(() => clearTimeout(b)), o.status !== "skipped") {
|
|
528
|
-
let h = [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];
|
|
544
|
+
async function bs({ node: e, flow: r, submissions: t, chat: n, next: s, apiClient: i, analytics: a, signal: o, context: c }) {
|
|
545
|
+
let f = yn(r.nodes, t || {}), { answers: g, ...b } = f;
|
|
546
|
+
if (n.setSubmission(e.data.key, { type: "integration", value: b }), await Gn(r, i, { ...a.getSessionInfo(), job: r.job, flow_build: r.build, pre_apply: Vr(r.nodes, t || {}, r.data.flowSessionId) }, o), f.status !== "skipped") {
|
|
547
|
+
let h = [f.status === "unavailable" ? "We could not prepare your pre-apply summary. You can still continue to your application." : f.hasHardConcerns ? e.data.messages.hard : f.hasAdvisoryConcerns ? e.data.messages.advisory : e.data.messages.matched];
|
|
529
548
|
for (let m of ["hard", "advisory"]) {
|
|
530
|
-
let
|
|
531
|
-
|
|
532
|
-
` +
|
|
549
|
+
let k = g.filter((I) => !I.matched && I.severity === m);
|
|
550
|
+
k.length && h.push((m === "hard" ? "Role requirements" : "Other things to consider") + `
|
|
551
|
+
` + k.map((I) => `• ${I.message}`).join(`
|
|
533
552
|
`));
|
|
534
553
|
}
|
|
535
554
|
await n.sendMessage({ type: "text", author: "bot", text: h.join(`
|
|
536
555
|
|
|
537
|
-
`) }),
|
|
556
|
+
`) }), f.hasHardConcerns && e.data.alternativeLink && await n.sendMessage({ type: "link", href: e.data.alternativeLink.href, text: e.data.alternativeLink.label }), await n.userInput({ type: "submit", key: void 0, config: { label: fe(e.data.continueLabel, { submissions: t, context: c }) } });
|
|
538
557
|
}
|
|
539
558
|
return s(e.nextId);
|
|
540
559
|
}
|
|
541
|
-
const
|
|
560
|
+
const er = (e, r, t) => {
|
|
542
561
|
var n;
|
|
543
562
|
return e.log({
|
|
544
563
|
event: t,
|
|
@@ -552,7 +571,7 @@ const Jt = (e, r, t) => {
|
|
|
552
571
|
},
|
|
553
572
|
customProperties: (n = r.analytics) == null ? void 0 : n.customProperties
|
|
554
573
|
});
|
|
555
|
-
},
|
|
574
|
+
}, Mt = "resume-prompt", vs = async ({
|
|
556
575
|
chatService: e,
|
|
557
576
|
t: r,
|
|
558
577
|
signal: t
|
|
@@ -563,7 +582,7 @@ const Jt = (e, r, t) => {
|
|
|
563
582
|
author: "bot",
|
|
564
583
|
text: r("resume_prompt")
|
|
565
584
|
},
|
|
566
|
-
groupId:
|
|
585
|
+
groupId: Mt,
|
|
567
586
|
signal: t
|
|
568
587
|
});
|
|
569
588
|
const n = await e.input({
|
|
@@ -580,16 +599,16 @@ const Jt = (e, r, t) => {
|
|
|
580
599
|
},
|
|
581
600
|
signal: t
|
|
582
601
|
});
|
|
583
|
-
return
|
|
602
|
+
return K.removeMessagesSentByNodeIds([Mt]), (n == null ? void 0 : n.value) !== !1;
|
|
584
603
|
}, Re = ({
|
|
585
604
|
class: e,
|
|
586
605
|
...r
|
|
587
606
|
}) => {
|
|
588
607
|
const {
|
|
589
608
|
t
|
|
590
|
-
} =
|
|
609
|
+
} = ee();
|
|
591
610
|
return u("button", {
|
|
592
|
-
class:
|
|
611
|
+
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),
|
|
593
612
|
type: "submit",
|
|
594
613
|
...r,
|
|
595
614
|
children: u("svg", {
|
|
@@ -613,7 +632,7 @@ const Jt = (e, r, t) => {
|
|
|
613
632
|
};
|
|
614
633
|
var ye;
|
|
615
634
|
// @__NO_SIDE_EFFECTS__
|
|
616
|
-
function
|
|
635
|
+
function yt(e) {
|
|
617
636
|
return {
|
|
618
637
|
lang: (e == null ? void 0 : e.lang) ?? (ye == null ? void 0 : ye.lang),
|
|
619
638
|
message: e == null ? void 0 : e.message,
|
|
@@ -621,30 +640,30 @@ function dt(e) {
|
|
|
621
640
|
abortPipeEarly: (e == null ? void 0 : e.abortPipeEarly) ?? (ye == null ? void 0 : ye.abortPipeEarly)
|
|
622
641
|
};
|
|
623
642
|
}
|
|
624
|
-
var
|
|
643
|
+
var Ct;
|
|
625
644
|
// @__NO_SIDE_EFFECTS__
|
|
626
|
-
function
|
|
627
|
-
return
|
|
645
|
+
function xs(e) {
|
|
646
|
+
return Ct == null ? void 0 : Ct.get(e);
|
|
628
647
|
}
|
|
629
|
-
var
|
|
648
|
+
var St;
|
|
630
649
|
// @__NO_SIDE_EFFECTS__
|
|
631
|
-
function
|
|
632
|
-
return
|
|
650
|
+
function ws(e) {
|
|
651
|
+
return St == null ? void 0 : St.get(e);
|
|
633
652
|
}
|
|
634
|
-
var
|
|
653
|
+
var It;
|
|
635
654
|
// @__NO_SIDE_EFFECTS__
|
|
636
|
-
function
|
|
655
|
+
function _s(e, r) {
|
|
637
656
|
var t;
|
|
638
|
-
return (t =
|
|
657
|
+
return (t = It == null ? void 0 : It.get(e)) == null ? void 0 : t.get(r);
|
|
639
658
|
}
|
|
640
659
|
// @__NO_SIDE_EFFECTS__
|
|
641
|
-
function
|
|
660
|
+
function We(e) {
|
|
642
661
|
var t, n;
|
|
643
662
|
const r = typeof e;
|
|
644
663
|
return r === "string" ? `"${e}"` : r === "number" || r === "bigint" || r === "boolean" ? `${e}` : r === "object" || r === "function" ? (e && ((n = (t = Object.getPrototypeOf(e)) == null ? void 0 : t.constructor) == null ? void 0 : n.name)) ?? "null" : r;
|
|
645
664
|
}
|
|
646
|
-
function
|
|
647
|
-
const i = s && "input" in s ? s.input : t.value, a = (s == null ? void 0 : s.expected) ?? e.expects ?? null, o = (s == null ? void 0 : s.received) ?? /* @__PURE__ */
|
|
665
|
+
function Q(e, r, t, n, s) {
|
|
666
|
+
const i = s && "input" in s ? s.input : t.value, a = (s == null ? void 0 : s.expected) ?? e.expects ?? null, o = (s == null ? void 0 : s.received) ?? /* @__PURE__ */ We(i), c = {
|
|
648
667
|
kind: e.kind,
|
|
649
668
|
type: e.type,
|
|
650
669
|
input: i,
|
|
@@ -657,33 +676,33 @@ function Y(e, r, t, n, s) {
|
|
|
657
676
|
lang: n.lang,
|
|
658
677
|
abortEarly: n.abortEarly,
|
|
659
678
|
abortPipeEarly: n.abortPipeEarly
|
|
660
|
-
},
|
|
679
|
+
}, f = e.kind === "schema", g = (s == null ? void 0 : s.message) ?? e.message ?? /* @__PURE__ */ _s(e.reference, c.lang) ?? (f ? /* @__PURE__ */ ws(c.lang) : null) ?? n.message ?? /* @__PURE__ */ xs(c.lang);
|
|
661
680
|
g !== void 0 && (c.message = typeof g == "function" ? (
|
|
662
681
|
// @ts-expect-error
|
|
663
682
|
g(c)
|
|
664
|
-
) : g),
|
|
683
|
+
) : g), f && (t.typed = !1), t.issues ? t.issues.push(c) : t.issues = [c];
|
|
665
684
|
}
|
|
666
685
|
// @__NO_SIDE_EFFECTS__
|
|
667
|
-
function
|
|
686
|
+
function me(e) {
|
|
668
687
|
return {
|
|
669
688
|
version: 1,
|
|
670
689
|
vendor: "valibot",
|
|
671
690
|
validate(r) {
|
|
672
|
-
return e["~run"]({ value: r }, /* @__PURE__ */
|
|
691
|
+
return e["~run"]({ value: r }, /* @__PURE__ */ yt());
|
|
673
692
|
}
|
|
674
693
|
};
|
|
675
694
|
}
|
|
676
695
|
// @__NO_SIDE_EFFECTS__
|
|
677
|
-
function
|
|
696
|
+
function ks(e, r) {
|
|
678
697
|
return Object.hasOwn(e, r) && r !== "__proto__" && r !== "prototype" && r !== "constructor";
|
|
679
698
|
}
|
|
680
699
|
// @__NO_SIDE_EFFECTS__
|
|
681
|
-
function
|
|
700
|
+
function Cs(e, r) {
|
|
682
701
|
const t = [...new Set(e)];
|
|
683
702
|
return t.length > 1 ? `(${t.join(` ${r} `)})` : t[0] ?? "never";
|
|
684
703
|
}
|
|
685
704
|
// @__NO_SIDE_EFFECTS__
|
|
686
|
-
function
|
|
705
|
+
function Ss(e) {
|
|
687
706
|
if (e.path) {
|
|
688
707
|
let r = "";
|
|
689
708
|
for (const t of e.path)
|
|
@@ -695,7 +714,7 @@ function ws(e) {
|
|
|
695
714
|
}
|
|
696
715
|
return null;
|
|
697
716
|
}
|
|
698
|
-
var
|
|
717
|
+
var Is = class extends Error {
|
|
699
718
|
/**
|
|
700
719
|
* Creates a Valibot error with useful information.
|
|
701
720
|
*
|
|
@@ -704,126 +723,126 @@ var _s = class extends Error {
|
|
|
704
723
|
constructor(e) {
|
|
705
724
|
super(e[0].message), this.name = "ValiError", this.issues = e;
|
|
706
725
|
}
|
|
707
|
-
},
|
|
726
|
+
}, As = /^[\w+-]+(?:\.[\w+-]+)*@[\da-z]+(?:[.-][\da-z]+)*\.[a-z]{2,}$/iu;
|
|
708
727
|
// @__NO_SIDE_EFFECTS__
|
|
709
|
-
function
|
|
728
|
+
function Pr(e, r) {
|
|
710
729
|
return {
|
|
711
730
|
kind: "validation",
|
|
712
731
|
type: "check",
|
|
713
|
-
reference:
|
|
732
|
+
reference: Pr,
|
|
714
733
|
async: !1,
|
|
715
734
|
expects: null,
|
|
716
735
|
requirement: e,
|
|
717
736
|
message: r,
|
|
718
737
|
"~run"(t, n) {
|
|
719
|
-
return t.typed && !this.requirement(t.value) &&
|
|
738
|
+
return t.typed && !this.requirement(t.value) && Q(this, "input", t, n), t;
|
|
720
739
|
}
|
|
721
740
|
};
|
|
722
741
|
}
|
|
723
742
|
// @__NO_SIDE_EFFECTS__
|
|
724
|
-
function
|
|
743
|
+
function qr(e) {
|
|
725
744
|
return {
|
|
726
745
|
kind: "validation",
|
|
727
746
|
type: "email",
|
|
728
|
-
reference:
|
|
747
|
+
reference: qr,
|
|
729
748
|
expects: null,
|
|
730
749
|
async: !1,
|
|
731
|
-
requirement:
|
|
750
|
+
requirement: As,
|
|
732
751
|
message: e,
|
|
733
752
|
"~run"(r, t) {
|
|
734
|
-
return r.typed && !this.requirement.test(r.value) &&
|
|
753
|
+
return r.typed && !this.requirement.test(r.value) && Q(this, "email", r, t), r;
|
|
735
754
|
}
|
|
736
755
|
};
|
|
737
756
|
}
|
|
738
757
|
// @__NO_SIDE_EFFECTS__
|
|
739
|
-
function
|
|
758
|
+
function st(e, r) {
|
|
740
759
|
return {
|
|
741
760
|
kind: "validation",
|
|
742
761
|
type: "max_length",
|
|
743
|
-
reference:
|
|
762
|
+
reference: st,
|
|
744
763
|
async: !1,
|
|
745
764
|
expects: `<=${e}`,
|
|
746
765
|
requirement: e,
|
|
747
766
|
message: r,
|
|
748
767
|
"~run"(t, n) {
|
|
749
|
-
return t.typed && t.value.length > this.requirement &&
|
|
768
|
+
return t.typed && t.value.length > this.requirement && Q(this, "length", t, n, {
|
|
750
769
|
received: `${t.value.length}`
|
|
751
770
|
}), t;
|
|
752
771
|
}
|
|
753
772
|
};
|
|
754
773
|
}
|
|
755
774
|
// @__NO_SIDE_EFFECTS__
|
|
756
|
-
function
|
|
775
|
+
function $r(e, r) {
|
|
757
776
|
return {
|
|
758
777
|
kind: "validation",
|
|
759
778
|
type: "max_value",
|
|
760
|
-
reference:
|
|
779
|
+
reference: $r,
|
|
761
780
|
async: !1,
|
|
762
|
-
expects: `<=${e instanceof Date ? e.toJSON() : /* @__PURE__ */
|
|
781
|
+
expects: `<=${e instanceof Date ? e.toJSON() : /* @__PURE__ */ We(e)}`,
|
|
763
782
|
requirement: e,
|
|
764
783
|
message: r,
|
|
765
784
|
"~run"(t, n) {
|
|
766
|
-
return t.typed && !(t.value <= this.requirement) &&
|
|
767
|
-
received: t.value instanceof Date ? t.value.toJSON() : /* @__PURE__ */
|
|
785
|
+
return t.typed && !(t.value <= this.requirement) && Q(this, "value", t, n, {
|
|
786
|
+
received: t.value instanceof Date ? t.value.toJSON() : /* @__PURE__ */ We(t.value)
|
|
768
787
|
}), t;
|
|
769
788
|
}
|
|
770
789
|
};
|
|
771
790
|
}
|
|
772
791
|
// @__NO_SIDE_EFFECTS__
|
|
773
|
-
function
|
|
792
|
+
function Ue(e, r) {
|
|
774
793
|
return {
|
|
775
794
|
kind: "validation",
|
|
776
795
|
type: "min_length",
|
|
777
|
-
reference:
|
|
796
|
+
reference: Ue,
|
|
778
797
|
async: !1,
|
|
779
798
|
expects: `>=${e}`,
|
|
780
799
|
requirement: e,
|
|
781
800
|
message: r,
|
|
782
801
|
"~run"(t, n) {
|
|
783
|
-
return t.typed && t.value.length < this.requirement &&
|
|
802
|
+
return t.typed && t.value.length < this.requirement && Q(this, "length", t, n, {
|
|
784
803
|
received: `${t.value.length}`
|
|
785
804
|
}), t;
|
|
786
805
|
}
|
|
787
806
|
};
|
|
788
807
|
}
|
|
789
808
|
// @__NO_SIDE_EFFECTS__
|
|
790
|
-
function
|
|
809
|
+
function Ur(e, r) {
|
|
791
810
|
return {
|
|
792
811
|
kind: "validation",
|
|
793
812
|
type: "min_value",
|
|
794
|
-
reference:
|
|
813
|
+
reference: Ur,
|
|
795
814
|
async: !1,
|
|
796
|
-
expects: `>=${e instanceof Date ? e.toJSON() : /* @__PURE__ */
|
|
815
|
+
expects: `>=${e instanceof Date ? e.toJSON() : /* @__PURE__ */ We(e)}`,
|
|
797
816
|
requirement: e,
|
|
798
817
|
message: r,
|
|
799
818
|
"~run"(t, n) {
|
|
800
|
-
return t.typed && !(t.value >= this.requirement) &&
|
|
801
|
-
received: t.value instanceof Date ? t.value.toJSON() : /* @__PURE__ */
|
|
819
|
+
return t.typed && !(t.value >= this.requirement) && Q(this, "value", t, n, {
|
|
820
|
+
received: t.value instanceof Date ? t.value.toJSON() : /* @__PURE__ */ We(t.value)
|
|
802
821
|
}), t;
|
|
803
822
|
}
|
|
804
823
|
};
|
|
805
824
|
}
|
|
806
825
|
// @__NO_SIDE_EFFECTS__
|
|
807
|
-
function
|
|
826
|
+
function Tt(e, r) {
|
|
808
827
|
return {
|
|
809
828
|
kind: "validation",
|
|
810
829
|
type: "regex",
|
|
811
|
-
reference:
|
|
830
|
+
reference: Tt,
|
|
812
831
|
async: !1,
|
|
813
832
|
expects: `${e}`,
|
|
814
833
|
requirement: e,
|
|
815
834
|
message: r,
|
|
816
835
|
"~run"(t, n) {
|
|
817
|
-
return t.typed && !this.requirement.test(t.value) &&
|
|
836
|
+
return t.typed && !this.requirement.test(t.value) && Q(this, "format", t, n), t;
|
|
818
837
|
}
|
|
819
838
|
};
|
|
820
839
|
}
|
|
821
840
|
// @__NO_SIDE_EFFECTS__
|
|
822
|
-
function
|
|
841
|
+
function Ot(e) {
|
|
823
842
|
return {
|
|
824
843
|
kind: "transformation",
|
|
825
844
|
type: "transform",
|
|
826
|
-
reference:
|
|
845
|
+
reference: Ot,
|
|
827
846
|
async: !1,
|
|
828
847
|
operation: e,
|
|
829
848
|
"~run"(r) {
|
|
@@ -832,11 +851,11 @@ function Mt(e) {
|
|
|
832
851
|
};
|
|
833
852
|
}
|
|
834
853
|
// @__NO_SIDE_EFFECTS__
|
|
835
|
-
function
|
|
854
|
+
function Wr(e) {
|
|
836
855
|
return {
|
|
837
856
|
kind: "validation",
|
|
838
857
|
type: "url",
|
|
839
|
-
reference:
|
|
858
|
+
reference: Wr,
|
|
840
859
|
async: !1,
|
|
841
860
|
expects: null,
|
|
842
861
|
requirement(r) {
|
|
@@ -848,12 +867,12 @@ function Br(e) {
|
|
|
848
867
|
},
|
|
849
868
|
message: e,
|
|
850
869
|
"~run"(r, t) {
|
|
851
|
-
return r.typed && !this.requirement(r.value) &&
|
|
870
|
+
return r.typed && !this.requirement(r.value) && Q(this, "URL", r, t), r;
|
|
852
871
|
}
|
|
853
872
|
};
|
|
854
873
|
}
|
|
855
874
|
// @__NO_SIDE_EFFECTS__
|
|
856
|
-
function
|
|
875
|
+
function Es(e, r, t) {
|
|
857
876
|
return typeof e.fallback == "function" ? (
|
|
858
877
|
// @ts-expect-error
|
|
859
878
|
e.fallback(r, t)
|
|
@@ -863,7 +882,7 @@ function Cs(e, r, t) {
|
|
|
863
882
|
);
|
|
864
883
|
}
|
|
865
884
|
// @__NO_SIDE_EFFECTS__
|
|
866
|
-
function
|
|
885
|
+
function zr(e, r, t) {
|
|
867
886
|
return typeof e.default == "function" ? (
|
|
868
887
|
// @ts-expect-error
|
|
869
888
|
e.default(r, t)
|
|
@@ -873,17 +892,17 @@ function jr(e, r, t) {
|
|
|
873
892
|
);
|
|
874
893
|
}
|
|
875
894
|
// @__NO_SIDE_EFFECTS__
|
|
876
|
-
function
|
|
895
|
+
function Kr(e, r) {
|
|
877
896
|
return {
|
|
878
897
|
kind: "schema",
|
|
879
898
|
type: "array",
|
|
880
|
-
reference:
|
|
899
|
+
reference: Kr,
|
|
881
900
|
expects: "Array",
|
|
882
901
|
async: !1,
|
|
883
902
|
item: e,
|
|
884
903
|
message: r,
|
|
885
904
|
get "~standard"() {
|
|
886
|
-
return /* @__PURE__ */
|
|
905
|
+
return /* @__PURE__ */ me(this);
|
|
887
906
|
},
|
|
888
907
|
"~run"(t, n) {
|
|
889
908
|
var i;
|
|
@@ -893,7 +912,7 @@ function Pr(e, r) {
|
|
|
893
912
|
for (let a = 0; a < s.length; a++) {
|
|
894
913
|
const o = s[a], c = this.item["~run"]({ value: o }, n);
|
|
895
914
|
if (c.issues) {
|
|
896
|
-
const
|
|
915
|
+
const f = {
|
|
897
916
|
type: "array",
|
|
898
917
|
origin: "value",
|
|
899
918
|
input: s,
|
|
@@ -901,7 +920,7 @@ function Pr(e, r) {
|
|
|
901
920
|
value: o
|
|
902
921
|
};
|
|
903
922
|
for (const g of c.issues)
|
|
904
|
-
g.path ? g.path.unshift(
|
|
923
|
+
g.path ? g.path.unshift(f) : g.path = [f], (i = t.issues) == null || i.push(g);
|
|
905
924
|
if (t.issues || (t.issues = c.issues), n.abortEarly) {
|
|
906
925
|
t.typed = !1;
|
|
907
926
|
break;
|
|
@@ -910,42 +929,42 @@ function Pr(e, r) {
|
|
|
910
929
|
c.typed || (t.typed = !1), t.value.push(c.value);
|
|
911
930
|
}
|
|
912
931
|
} else
|
|
913
|
-
|
|
932
|
+
Q(this, "type", t, n);
|
|
914
933
|
return t;
|
|
915
934
|
}
|
|
916
935
|
};
|
|
917
936
|
}
|
|
918
937
|
// @__NO_SIDE_EFFECTS__
|
|
919
|
-
function
|
|
938
|
+
function Gr(e) {
|
|
920
939
|
return {
|
|
921
940
|
kind: "schema",
|
|
922
941
|
type: "boolean",
|
|
923
|
-
reference:
|
|
942
|
+
reference: Gr,
|
|
924
943
|
expects: "boolean",
|
|
925
944
|
async: !1,
|
|
926
945
|
message: e,
|
|
927
946
|
get "~standard"() {
|
|
928
|
-
return /* @__PURE__ */
|
|
947
|
+
return /* @__PURE__ */ me(this);
|
|
929
948
|
},
|
|
930
949
|
"~run"(r, t) {
|
|
931
|
-
return typeof r.value == "boolean" ? r.typed = !0 :
|
|
950
|
+
return typeof r.value == "boolean" ? r.typed = !0 : Q(this, "type", r, t), r;
|
|
932
951
|
}
|
|
933
952
|
};
|
|
934
953
|
}
|
|
935
954
|
// @__NO_SIDE_EFFECTS__
|
|
936
|
-
function
|
|
955
|
+
function Hr(e) {
|
|
937
956
|
return {
|
|
938
957
|
kind: "schema",
|
|
939
958
|
type: "number",
|
|
940
|
-
reference:
|
|
959
|
+
reference: Hr,
|
|
941
960
|
expects: "number",
|
|
942
961
|
async: !1,
|
|
943
962
|
message: e,
|
|
944
963
|
get "~standard"() {
|
|
945
|
-
return /* @__PURE__ */
|
|
964
|
+
return /* @__PURE__ */ me(this);
|
|
946
965
|
},
|
|
947
966
|
"~run"(r, t) {
|
|
948
|
-
return typeof r.value == "number" && !isNaN(r.value) ? r.typed = !0 :
|
|
967
|
+
return typeof r.value == "number" && !isNaN(r.value) ? r.typed = !0 : Q(this, "type", r, t), r;
|
|
949
968
|
}
|
|
950
969
|
};
|
|
951
970
|
}
|
|
@@ -960,7 +979,7 @@ function xe(e, r) {
|
|
|
960
979
|
entries: e,
|
|
961
980
|
message: r,
|
|
962
981
|
get "~standard"() {
|
|
963
|
-
return /* @__PURE__ */
|
|
982
|
+
return /* @__PURE__ */ me(this);
|
|
964
983
|
},
|
|
965
984
|
"~run"(t, n) {
|
|
966
985
|
var i;
|
|
@@ -974,8 +993,8 @@ function xe(e, r) {
|
|
|
974
993
|
const c = a in s ? (
|
|
975
994
|
// @ts-expect-error
|
|
976
995
|
s[a]
|
|
977
|
-
) : /* @__PURE__ */
|
|
978
|
-
if (
|
|
996
|
+
) : /* @__PURE__ */ zr(o), f = o["~run"]({ value: c }, n);
|
|
997
|
+
if (f.issues) {
|
|
979
998
|
const g = {
|
|
980
999
|
type: "object",
|
|
981
1000
|
origin: "value",
|
|
@@ -983,17 +1002,17 @@ function xe(e, r) {
|
|
|
983
1002
|
key: a,
|
|
984
1003
|
value: c
|
|
985
1004
|
};
|
|
986
|
-
for (const b of
|
|
1005
|
+
for (const b of f.issues)
|
|
987
1006
|
b.path ? b.path.unshift(g) : b.path = [g], (i = t.issues) == null || i.push(b);
|
|
988
|
-
if (t.issues || (t.issues =
|
|
1007
|
+
if (t.issues || (t.issues = f.issues), n.abortEarly) {
|
|
989
1008
|
t.typed = !1;
|
|
990
1009
|
break;
|
|
991
1010
|
}
|
|
992
1011
|
}
|
|
993
|
-
|
|
1012
|
+
f.typed || (t.typed = !1), t.value[a] = f.value;
|
|
994
1013
|
} else if (o.fallback !== void 0)
|
|
995
|
-
t.value[a] = /* @__PURE__ */
|
|
996
|
-
else if (o.type !== "exact_optional" && o.type !== "optional" && o.type !== "nullish" && (
|
|
1014
|
+
t.value[a] = /* @__PURE__ */ Es(o);
|
|
1015
|
+
else if (o.type !== "exact_optional" && o.type !== "optional" && o.type !== "nullish" && (Q(this, "key", t, n, {
|
|
997
1016
|
input: void 0,
|
|
998
1017
|
expected: `"${a}"`,
|
|
999
1018
|
path: [
|
|
@@ -1010,60 +1029,60 @@ function xe(e, r) {
|
|
|
1010
1029
|
break;
|
|
1011
1030
|
}
|
|
1012
1031
|
} else
|
|
1013
|
-
|
|
1032
|
+
Q(this, "type", t, n);
|
|
1014
1033
|
return t;
|
|
1015
1034
|
}
|
|
1016
1035
|
};
|
|
1017
1036
|
}
|
|
1018
1037
|
// @__NO_SIDE_EFFECTS__
|
|
1019
|
-
function
|
|
1038
|
+
function $e(e, r) {
|
|
1020
1039
|
return {
|
|
1021
1040
|
kind: "schema",
|
|
1022
1041
|
type: "optional",
|
|
1023
|
-
reference:
|
|
1042
|
+
reference: $e,
|
|
1024
1043
|
expects: `(${e.expects} | undefined)`,
|
|
1025
1044
|
async: !1,
|
|
1026
1045
|
wrapped: e,
|
|
1027
1046
|
default: r,
|
|
1028
1047
|
get "~standard"() {
|
|
1029
|
-
return /* @__PURE__ */
|
|
1048
|
+
return /* @__PURE__ */ me(this);
|
|
1030
1049
|
},
|
|
1031
1050
|
"~run"(t, n) {
|
|
1032
|
-
return t.value === void 0 && (this.default !== void 0 && (t.value = /* @__PURE__ */
|
|
1051
|
+
return t.value === void 0 && (this.default !== void 0 && (t.value = /* @__PURE__ */ zr(this, t, n)), t.value === void 0) ? (t.typed = !0, t) : this.wrapped["~run"](t, n);
|
|
1033
1052
|
}
|
|
1034
1053
|
};
|
|
1035
1054
|
}
|
|
1036
1055
|
// @__NO_SIDE_EFFECTS__
|
|
1037
|
-
function
|
|
1056
|
+
function Jr(e, r) {
|
|
1038
1057
|
return {
|
|
1039
1058
|
kind: "schema",
|
|
1040
1059
|
type: "picklist",
|
|
1041
|
-
reference:
|
|
1042
|
-
expects: /* @__PURE__ */
|
|
1060
|
+
reference: Jr,
|
|
1061
|
+
expects: /* @__PURE__ */ Cs(e.map(We), "|"),
|
|
1043
1062
|
async: !1,
|
|
1044
1063
|
options: e,
|
|
1045
1064
|
message: r,
|
|
1046
1065
|
get "~standard"() {
|
|
1047
|
-
return /* @__PURE__ */
|
|
1066
|
+
return /* @__PURE__ */ me(this);
|
|
1048
1067
|
},
|
|
1049
1068
|
"~run"(t, n) {
|
|
1050
|
-
return this.options.includes(t.value) ? t.typed = !0 :
|
|
1069
|
+
return this.options.includes(t.value) ? t.typed = !0 : Q(this, "type", t, n), t;
|
|
1051
1070
|
}
|
|
1052
1071
|
};
|
|
1053
1072
|
}
|
|
1054
1073
|
// @__NO_SIDE_EFFECTS__
|
|
1055
|
-
function
|
|
1074
|
+
function Zr(e, r, t) {
|
|
1056
1075
|
return {
|
|
1057
1076
|
kind: "schema",
|
|
1058
1077
|
type: "record",
|
|
1059
|
-
reference:
|
|
1078
|
+
reference: Zr,
|
|
1060
1079
|
expects: "Object",
|
|
1061
1080
|
async: !1,
|
|
1062
1081
|
key: e,
|
|
1063
1082
|
value: r,
|
|
1064
1083
|
message: t,
|
|
1065
1084
|
get "~standard"() {
|
|
1066
|
-
return /* @__PURE__ */
|
|
1085
|
+
return /* @__PURE__ */ me(this);
|
|
1067
1086
|
},
|
|
1068
1087
|
"~run"(n, s) {
|
|
1069
1088
|
var a, o;
|
|
@@ -1071,15 +1090,15 @@ function zr(e, r, t) {
|
|
|
1071
1090
|
if (i && typeof i == "object") {
|
|
1072
1091
|
n.typed = !0, n.value = {};
|
|
1073
1092
|
for (const c in i)
|
|
1074
|
-
if (/* @__PURE__ */
|
|
1075
|
-
const
|
|
1093
|
+
if (/* @__PURE__ */ ks(i, c)) {
|
|
1094
|
+
const f = i[c], g = this.key["~run"]({ value: c }, s);
|
|
1076
1095
|
if (g.issues) {
|
|
1077
1096
|
const h = {
|
|
1078
1097
|
type: "object",
|
|
1079
1098
|
origin: "key",
|
|
1080
1099
|
input: i,
|
|
1081
1100
|
key: c,
|
|
1082
|
-
value:
|
|
1101
|
+
value: f
|
|
1083
1102
|
};
|
|
1084
1103
|
for (const m of g.issues)
|
|
1085
1104
|
m.path = [h], (a = n.issues) == null || a.push(m);
|
|
@@ -1089,7 +1108,7 @@ function zr(e, r, t) {
|
|
|
1089
1108
|
}
|
|
1090
1109
|
}
|
|
1091
1110
|
const b = this.value["~run"](
|
|
1092
|
-
{ value:
|
|
1111
|
+
{ value: f },
|
|
1093
1112
|
s
|
|
1094
1113
|
);
|
|
1095
1114
|
if (b.issues) {
|
|
@@ -1098,7 +1117,7 @@ function zr(e, r, t) {
|
|
|
1098
1117
|
origin: "value",
|
|
1099
1118
|
input: i,
|
|
1100
1119
|
key: c,
|
|
1101
|
-
value:
|
|
1120
|
+
value: f
|
|
1102
1121
|
};
|
|
1103
1122
|
for (const m of b.issues)
|
|
1104
1123
|
m.path ? m.path.unshift(h) : m.path = [h], (o = n.issues) == null || o.push(m);
|
|
@@ -1110,44 +1129,44 @@ function zr(e, r, t) {
|
|
|
1110
1129
|
(!g.typed || !b.typed) && (n.typed = !1), g.typed && (n.value[g.value] = b.value);
|
|
1111
1130
|
}
|
|
1112
1131
|
} else
|
|
1113
|
-
|
|
1132
|
+
Q(this, "type", n, s);
|
|
1114
1133
|
return n;
|
|
1115
1134
|
}
|
|
1116
1135
|
};
|
|
1117
1136
|
}
|
|
1118
1137
|
// @__NO_SIDE_EFFECTS__
|
|
1119
|
-
function
|
|
1138
|
+
function ae(e) {
|
|
1120
1139
|
return {
|
|
1121
1140
|
kind: "schema",
|
|
1122
1141
|
type: "string",
|
|
1123
|
-
reference:
|
|
1142
|
+
reference: ae,
|
|
1124
1143
|
expects: "string",
|
|
1125
1144
|
async: !1,
|
|
1126
1145
|
message: e,
|
|
1127
1146
|
get "~standard"() {
|
|
1128
|
-
return /* @__PURE__ */
|
|
1147
|
+
return /* @__PURE__ */ me(this);
|
|
1129
1148
|
},
|
|
1130
1149
|
"~run"(r, t) {
|
|
1131
|
-
return typeof r.value == "string" ? r.typed = !0 :
|
|
1150
|
+
return typeof r.value == "string" ? r.typed = !0 : Q(this, "type", r, t), r;
|
|
1132
1151
|
}
|
|
1133
1152
|
};
|
|
1134
1153
|
}
|
|
1135
|
-
function
|
|
1136
|
-
const n = e["~run"]({ value: r }, /* @__PURE__ */
|
|
1154
|
+
function Fs(e, r, t) {
|
|
1155
|
+
const n = e["~run"]({ value: r }, /* @__PURE__ */ yt(t));
|
|
1137
1156
|
if (n.issues)
|
|
1138
|
-
throw new
|
|
1157
|
+
throw new Is(n.issues);
|
|
1139
1158
|
return n.value;
|
|
1140
1159
|
}
|
|
1141
1160
|
// @__NO_SIDE_EFFECTS__
|
|
1142
|
-
function
|
|
1161
|
+
function Vs(e, r) {
|
|
1143
1162
|
const t = {};
|
|
1144
1163
|
for (const n in e.entries)
|
|
1145
|
-
t[n] = !r || r.includes(n) ? /* @__PURE__ */
|
|
1164
|
+
t[n] = !r || r.includes(n) ? /* @__PURE__ */ $e(e.entries[n]) : e.entries[n];
|
|
1146
1165
|
return {
|
|
1147
1166
|
...e,
|
|
1148
1167
|
entries: t,
|
|
1149
1168
|
get "~standard"() {
|
|
1150
|
-
return /* @__PURE__ */
|
|
1169
|
+
return /* @__PURE__ */ me(this);
|
|
1151
1170
|
}
|
|
1152
1171
|
};
|
|
1153
1172
|
}
|
|
@@ -1157,7 +1176,7 @@ function Ie(...e) {
|
|
|
1157
1176
|
...e[0],
|
|
1158
1177
|
pipe: e,
|
|
1159
1178
|
get "~standard"() {
|
|
1160
|
-
return /* @__PURE__ */
|
|
1179
|
+
return /* @__PURE__ */ me(this);
|
|
1161
1180
|
},
|
|
1162
1181
|
"~run"(r, t) {
|
|
1163
1182
|
for (const n of e)
|
|
@@ -1173,8 +1192,8 @@ function Ie(...e) {
|
|
|
1173
1192
|
};
|
|
1174
1193
|
}
|
|
1175
1194
|
// @__NO_SIDE_EFFECTS__
|
|
1176
|
-
function
|
|
1177
|
-
const n = e["~run"]({ value: r }, /* @__PURE__ */
|
|
1195
|
+
function Ms(e, r, t) {
|
|
1196
|
+
const n = e["~run"]({ value: r }, /* @__PURE__ */ yt(t));
|
|
1178
1197
|
return {
|
|
1179
1198
|
typed: n.typed,
|
|
1180
1199
|
success: !n.issues,
|
|
@@ -1183,10 +1202,10 @@ function As(e, r, t) {
|
|
|
1183
1202
|
};
|
|
1184
1203
|
}
|
|
1185
1204
|
// @__NO_SIDE_EFFECTS__
|
|
1186
|
-
async function
|
|
1205
|
+
async function Ls(e, r, t) {
|
|
1187
1206
|
const n = await e["~run"](
|
|
1188
1207
|
{ value: r },
|
|
1189
|
-
/* @__PURE__ */
|
|
1208
|
+
/* @__PURE__ */ yt(t)
|
|
1190
1209
|
);
|
|
1191
1210
|
return {
|
|
1192
1211
|
typed: n.typed,
|
|
@@ -1195,7 +1214,7 @@ async function Es(e, r, t) {
|
|
|
1195
1214
|
issues: n.issues
|
|
1196
1215
|
};
|
|
1197
1216
|
}
|
|
1198
|
-
const
|
|
1217
|
+
const He = ({
|
|
1199
1218
|
error: e
|
|
1200
1219
|
}) => !e || !e.message ? null : u("div", {
|
|
1201
1220
|
role: "alert",
|
|
@@ -1234,10 +1253,10 @@ const We = ({
|
|
|
1234
1253
|
}) => {
|
|
1235
1254
|
const {
|
|
1236
1255
|
t
|
|
1237
|
-
} =
|
|
1256
|
+
} = ee();
|
|
1238
1257
|
return u("button", {
|
|
1239
1258
|
type: "button",
|
|
1240
|
-
class:
|
|
1259
|
+
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),
|
|
1241
1260
|
...r,
|
|
1242
1261
|
children: [u("svg", {
|
|
1243
1262
|
"aria-hidden": !0,
|
|
@@ -1259,8 +1278,8 @@ const We = ({
|
|
|
1259
1278
|
}), t("skip")]
|
|
1260
1279
|
});
|
|
1261
1280
|
};
|
|
1262
|
-
var
|
|
1263
|
-
const
|
|
1281
|
+
var Bt = { 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" };
|
|
1282
|
+
const ze = mt("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", {
|
|
1264
1283
|
variants: {
|
|
1265
1284
|
optional: {
|
|
1266
1285
|
true: "pr-16 pl-3",
|
|
@@ -1270,15 +1289,16 @@ const Pe = ct("outline-divider ease-expo-out placeholder:text-neutral-10 text-ne
|
|
|
1270
1289
|
defaultVariants: {
|
|
1271
1290
|
optional: !1
|
|
1272
1291
|
}
|
|
1273
|
-
}),
|
|
1274
|
-
name: /* @__PURE__ */
|
|
1275
|
-
}),
|
|
1276
|
-
suggestions: /* @__PURE__ */
|
|
1277
|
-
|
|
1278
|
-
|
|
1279
|
-
|
|
1280
|
-
|
|
1281
|
-
|
|
1292
|
+
}), Ns = "https://api.mapbox.com/search/searchbox/v1/suggest", Rs = "ZzRDWFU0dTZ3SF9aWk9RNGl6QzZaWS5RZmlFak13a0hPbGxXZXlNSGN5RUhObUJ6TXpSV08yUW5OdE5tSTZJU1lpd2lJb1JYYXRObmJ2Tm5iaGhHZWx4V1lpb2pJMUp5ZS5rcA==", Ds = (e) => atob(e).split("").reverse().join(""), ge = /* @__PURE__ */ xe({
|
|
1293
|
+
name: /* @__PURE__ */ ae()
|
|
1294
|
+
}), Ts = /* @__PURE__ */ xe({
|
|
1295
|
+
suggestions: /* @__PURE__ */ Kr(/* @__PURE__ */ xe({
|
|
1296
|
+
feature_type: /* @__PURE__ */ $e(/* @__PURE__ */ ae()),
|
|
1297
|
+
full_address: /* @__PURE__ */ $e(/* @__PURE__ */ ae()),
|
|
1298
|
+
place_formatted: /* @__PURE__ */ $e(/* @__PURE__ */ ae()),
|
|
1299
|
+
name: /* @__PURE__ */ $e(/* @__PURE__ */ ae()),
|
|
1300
|
+
mapbox_id: /* @__PURE__ */ ae(),
|
|
1301
|
+
context: /* @__PURE__ */ Vs(/* @__PURE__ */ xe({
|
|
1282
1302
|
address: ge,
|
|
1283
1303
|
street: ge,
|
|
1284
1304
|
neighborhood: ge,
|
|
@@ -1290,49 +1310,50 @@ const Pe = ct("outline-divider ease-expo-out placeholder:text-neutral-10 text-ne
|
|
|
1290
1310
|
country: ge
|
|
1291
1311
|
}))
|
|
1292
1312
|
}))
|
|
1293
|
-
}),
|
|
1313
|
+
}), Os = ({
|
|
1294
1314
|
logger: e,
|
|
1295
1315
|
t: r
|
|
1296
|
-
}) =>
|
|
1316
|
+
}) => Fn(() => {
|
|
1297
1317
|
var n;
|
|
1298
|
-
const t = (n =
|
|
1318
|
+
const t = (n = K.current$.peek().flow) == null ? void 0 : n.data.flowSessionId;
|
|
1299
1319
|
return t ? {
|
|
1300
1320
|
enabled: !0,
|
|
1301
1321
|
getPredictions: async (s) => {
|
|
1302
1322
|
var b;
|
|
1303
|
-
const i = new URL(
|
|
1323
|
+
const i = new URL(Ns);
|
|
1304
1324
|
i.searchParams.set("q", s), i.searchParams.set("session_token", t);
|
|
1305
|
-
const a = (b =
|
|
1306
|
-
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",
|
|
1325
|
+
const a = (b = K.current$.peek().flow) == null ? void 0 : b.locationOrigin;
|
|
1326
|
+
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", Ds(Rs));
|
|
1307
1327
|
const c = await fetch(i);
|
|
1308
1328
|
if (!c.ok)
|
|
1309
1329
|
return e.error("Failed to get address details", c), {
|
|
1310
1330
|
ok: !1,
|
|
1311
1331
|
error: r("address_error")
|
|
1312
1332
|
};
|
|
1313
|
-
const
|
|
1314
|
-
if (
|
|
1315
|
-
return e.error("Failed to parse address details",
|
|
1333
|
+
const f = /* @__PURE__ */ Ms(Ts, await c.json());
|
|
1334
|
+
if (f.success === !1)
|
|
1335
|
+
return e.error("Failed to parse address details", f.issues), {
|
|
1316
1336
|
ok: !1,
|
|
1317
1337
|
error: r("address_error")
|
|
1318
1338
|
};
|
|
1319
1339
|
const {
|
|
1320
1340
|
suggestions: g
|
|
1321
|
-
} =
|
|
1341
|
+
} = f.output;
|
|
1322
1342
|
return {
|
|
1323
1343
|
ok: !0,
|
|
1324
1344
|
data: g.map((h) => {
|
|
1325
|
-
var m,
|
|
1345
|
+
var m, k, I, C, x, y, F, N, V;
|
|
1326
1346
|
return {
|
|
1327
|
-
|
|
1347
|
+
// A postcode result has no full address and is named by the postcode itself (PROD-7311).
|
|
1348
|
+
label: h.full_address ?? ([h.name, h.place_formatted].filter(Boolean).join(", ") || h.mapbox_id),
|
|
1328
1349
|
id: h.mapbox_id,
|
|
1329
1350
|
address: {
|
|
1330
|
-
line1: ((m = h.context.address) == null ? void 0 : m.name) ?? ((
|
|
1351
|
+
line1: ((m = h.context.address) == null ? void 0 : m.name) ?? ((k = h.context.street) == null ? void 0 : k.name),
|
|
1331
1352
|
line2: void 0,
|
|
1332
|
-
line3: ((
|
|
1333
|
-
city: ((
|
|
1334
|
-
state: (
|
|
1335
|
-
postcode: (
|
|
1353
|
+
line3: ((I = h.context.neighborhood) == null ? void 0 : I.name) ?? ((C = h.context.locality) == null ? void 0 : C.name),
|
|
1354
|
+
city: ((x = h.context.place) == null ? void 0 : x.name) ?? ((y = h.context.district) == null ? void 0 : y.name),
|
|
1355
|
+
state: (F = h.context.region) == null ? void 0 : F.name,
|
|
1356
|
+
postcode: ((N = h.context.postcode) == null ? void 0 : N.name) ?? (h.feature_type === "postcode" ? h.name : void 0),
|
|
1336
1357
|
country: (V = h.context.country) == null ? void 0 : V.name
|
|
1337
1358
|
}
|
|
1338
1359
|
};
|
|
@@ -1342,10 +1363,10 @@ const Pe = ct("outline-divider ease-expo-out placeholder:text-neutral-10 text-ne
|
|
|
1342
1363
|
} : {
|
|
1343
1364
|
enabled: !1
|
|
1344
1365
|
};
|
|
1345
|
-
}, [e, r]),
|
|
1366
|
+
}, [e, r]), tr = (e) => {
|
|
1346
1367
|
const {
|
|
1347
1368
|
t: r
|
|
1348
|
-
} =
|
|
1369
|
+
} = ee();
|
|
1349
1370
|
return u("button", {
|
|
1350
1371
|
type: "button",
|
|
1351
1372
|
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",
|
|
@@ -1365,35 +1386,35 @@ const Pe = ct("outline-divider ease-expo-out placeholder:text-neutral-10 text-ne
|
|
|
1365
1386
|
children: r("back")
|
|
1366
1387
|
})]
|
|
1367
1388
|
});
|
|
1368
|
-
},
|
|
1389
|
+
}, Bs = ({
|
|
1369
1390
|
input: e,
|
|
1370
1391
|
onSubmitSuccess: r,
|
|
1371
1392
|
logger: t
|
|
1372
1393
|
}) => {
|
|
1373
1394
|
const {
|
|
1374
1395
|
t: n
|
|
1375
|
-
} =
|
|
1396
|
+
} = ee(), [s, i] = ve(), {
|
|
1376
1397
|
enabled: a,
|
|
1377
1398
|
getPredictions: o
|
|
1378
|
-
} =
|
|
1399
|
+
} = Os({
|
|
1379
1400
|
logger: t,
|
|
1380
1401
|
t: n
|
|
1381
|
-
}), [c,
|
|
1382
|
-
var
|
|
1383
|
-
if (Ne(a, "Query state should not be enabled"), y = y.trim(), y === ((
|
|
1402
|
+
}), [c, f] = ve(a ? "query" : "manual"), [g, b] = ve(""), [h, m] = ve(), k = he(), I = he(), C = (y) => {
|
|
1403
|
+
var N;
|
|
1404
|
+
if (Ne(a, "Query state should not be enabled"), y = y.trim(), y === ((N = k.current) == null ? void 0 : N.query) || y === (h == null ? void 0 : h.query) && h.status === "done")
|
|
1384
1405
|
return;
|
|
1385
1406
|
if (b(y), y === "") {
|
|
1386
|
-
|
|
1407
|
+
k.current = void 0, m(void 0);
|
|
1387
1408
|
return;
|
|
1388
1409
|
}
|
|
1389
|
-
const
|
|
1410
|
+
const F = k.current = {
|
|
1390
1411
|
query: y
|
|
1391
1412
|
};
|
|
1392
1413
|
m({
|
|
1393
1414
|
query: y,
|
|
1394
1415
|
status: "pending"
|
|
1395
1416
|
}), o(y).then((V) => {
|
|
1396
|
-
|
|
1417
|
+
k.current === F && (k.current = void 0, m(V.ok ? {
|
|
1397
1418
|
query: y,
|
|
1398
1419
|
status: "done",
|
|
1399
1420
|
items: V.data
|
|
@@ -1403,58 +1424,58 @@ const Pe = ct("outline-divider ease-expo-out placeholder:text-neutral-10 text-ne
|
|
|
1403
1424
|
error: V.error
|
|
1404
1425
|
}));
|
|
1405
1426
|
}, (V) => {
|
|
1406
|
-
|
|
1427
|
+
k.current === F && (k.current = void 0, t.error("Failed to get address details", V), m({
|
|
1407
1428
|
query: y,
|
|
1408
1429
|
status: "failed",
|
|
1409
1430
|
error: n("address_error")
|
|
1410
1431
|
}));
|
|
1411
1432
|
});
|
|
1412
|
-
},
|
|
1413
|
-
i((
|
|
1414
|
-
...
|
|
1415
|
-
[y]:
|
|
1433
|
+
}, x = (y, F) => {
|
|
1434
|
+
i((N) => ({
|
|
1435
|
+
...N,
|
|
1436
|
+
[y]: F
|
|
1416
1437
|
}));
|
|
1417
1438
|
};
|
|
1418
1439
|
switch (c) {
|
|
1419
1440
|
case "query":
|
|
1420
|
-
return Ne(a, "Query state should not be enabled"), u(
|
|
1441
|
+
return Ne(a, "Query state should not be enabled"), u(js, {
|
|
1421
1442
|
input: e,
|
|
1422
1443
|
onSkip: () => r(null),
|
|
1423
1444
|
onAddressSelect: (y) => {
|
|
1424
1445
|
if (y === "") {
|
|
1425
|
-
|
|
1446
|
+
k.current && (k.current = void 0, m(void 0)), f("manual");
|
|
1426
1447
|
return;
|
|
1427
1448
|
}
|
|
1428
|
-
const
|
|
1429
|
-
|
|
1449
|
+
const F = (h == null ? void 0 : h.status) === "done" ? h.items.find((N) => N.id === y) : void 0;
|
|
1450
|
+
F && (I.current !== y && i(F.address), I.current = y, f("details"));
|
|
1430
1451
|
},
|
|
1431
1452
|
onAddressSearch: C,
|
|
1432
1453
|
lookup: h,
|
|
1433
1454
|
query: g
|
|
1434
1455
|
});
|
|
1435
1456
|
case "details":
|
|
1436
|
-
return Ne(s !== void 0), u(
|
|
1457
|
+
return Ne(s !== void 0), u(rr, {
|
|
1437
1458
|
input: e,
|
|
1438
1459
|
logger: t,
|
|
1439
1460
|
onSubmitSuccess: r,
|
|
1440
1461
|
addressFields: s,
|
|
1441
|
-
onFieldChange:
|
|
1442
|
-
actions: u(
|
|
1462
|
+
onFieldChange: x,
|
|
1463
|
+
actions: u(tr, {
|
|
1443
1464
|
onClick: () => {
|
|
1444
|
-
|
|
1465
|
+
f("query");
|
|
1445
1466
|
}
|
|
1446
1467
|
})
|
|
1447
1468
|
});
|
|
1448
1469
|
case "manual":
|
|
1449
|
-
return u(
|
|
1470
|
+
return u(rr, {
|
|
1450
1471
|
logger: t,
|
|
1451
1472
|
input: e,
|
|
1452
1473
|
onSubmitSuccess: r,
|
|
1453
1474
|
addressFields: s ?? {},
|
|
1454
|
-
onFieldChange:
|
|
1455
|
-
actions: a ? u(
|
|
1475
|
+
onFieldChange: x,
|
|
1476
|
+
actions: a ? u(tr, {
|
|
1456
1477
|
onClick: () => {
|
|
1457
|
-
|
|
1478
|
+
f("query");
|
|
1458
1479
|
}
|
|
1459
1480
|
}) : e.config.optional ? (
|
|
1460
1481
|
// Without address search this is the only screen, so an optional question needs its own way past.
|
|
@@ -1464,7 +1485,7 @@ const Pe = ct("outline-divider ease-expo-out placeholder:text-neutral-10 text-ne
|
|
|
1464
1485
|
) : void 0
|
|
1465
1486
|
});
|
|
1466
1487
|
}
|
|
1467
|
-
},
|
|
1488
|
+
}, js = ({
|
|
1468
1489
|
input: e,
|
|
1469
1490
|
onSkip: r,
|
|
1470
1491
|
lookup: t,
|
|
@@ -1474,7 +1495,7 @@ const Pe = ct("outline-divider ease-expo-out placeholder:text-neutral-10 text-ne
|
|
|
1474
1495
|
}) => {
|
|
1475
1496
|
const {
|
|
1476
1497
|
t: a
|
|
1477
|
-
} =
|
|
1498
|
+
} = ee(), o = he(null);
|
|
1478
1499
|
return Ae(() => {
|
|
1479
1500
|
o.current && (o.current.focus(), o.current.select());
|
|
1480
1501
|
}, []), u(we, {
|
|
@@ -1496,7 +1517,7 @@ const Pe = ct("outline-divider ease-expo-out placeholder:text-neutral-10 text-ne
|
|
|
1496
1517
|
autoFocus: !0,
|
|
1497
1518
|
placeholder: e.config.placeholder || a("address_search"),
|
|
1498
1519
|
defaultValue: s,
|
|
1499
|
-
class:
|
|
1520
|
+
class: ze({
|
|
1500
1521
|
optional: !!e.config.optional,
|
|
1501
1522
|
className: "w-full rounded-full"
|
|
1502
1523
|
})
|
|
@@ -1533,7 +1554,7 @@ const Pe = ct("outline-divider ease-expo-out placeholder:text-neutral-10 text-ne
|
|
|
1533
1554
|
class: "relative",
|
|
1534
1555
|
onClick: r
|
|
1535
1556
|
})]
|
|
1536
|
-
}), (t == null ? void 0 : t.status) === "failed" ? u(
|
|
1557
|
+
}), (t == null ? void 0 : t.status) === "failed" ? u(He, {
|
|
1537
1558
|
error: {
|
|
1538
1559
|
message: t.error
|
|
1539
1560
|
}
|
|
@@ -1541,7 +1562,7 @@ const Pe = ct("outline-divider ease-expo-out placeholder:text-neutral-10 text-ne
|
|
|
1541
1562
|
role: "status",
|
|
1542
1563
|
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",
|
|
1543
1564
|
children: (t == null ? void 0 : t.status) === "pending" ? u(we, {
|
|
1544
|
-
children: [u(
|
|
1565
|
+
children: [u(Rt, {
|
|
1545
1566
|
"aria-hidden": "true",
|
|
1546
1567
|
class: "h-4 w-4 shrink-0"
|
|
1547
1568
|
}), a("address_searching")]
|
|
@@ -1584,37 +1605,37 @@ const Pe = ct("outline-divider ease-expo-out placeholder:text-neutral-10 text-ne
|
|
|
1584
1605
|
}, "")]
|
|
1585
1606
|
})]
|
|
1586
1607
|
});
|
|
1587
|
-
},
|
|
1608
|
+
}, At = ["line1", "line2", "line3", "city", "state", "postcode", "country"], rr = ({
|
|
1588
1609
|
addressFields: e,
|
|
1589
1610
|
onFieldChange: r,
|
|
1590
1611
|
onSubmitSuccess: t,
|
|
1591
1612
|
actions: n,
|
|
1592
1613
|
input: s
|
|
1593
1614
|
}) => {
|
|
1594
|
-
const i =
|
|
1615
|
+
const i = he(null);
|
|
1595
1616
|
Ae(() => {
|
|
1596
1617
|
if (i.current) {
|
|
1597
1618
|
const c = i.current.querySelector("input");
|
|
1598
1619
|
c && (c.focus(), c.select());
|
|
1599
1620
|
}
|
|
1600
1621
|
}, []);
|
|
1601
|
-
const a = Object.keys(
|
|
1622
|
+
const a = Object.keys(Bt), {
|
|
1602
1623
|
t: o
|
|
1603
|
-
} =
|
|
1624
|
+
} = ee();
|
|
1604
1625
|
return u("form", {
|
|
1605
1626
|
class: "flex flex-col px-2 pt-2",
|
|
1606
1627
|
onSubmit: (c) => {
|
|
1607
|
-
const
|
|
1628
|
+
const f = c.currentTarget, g = [...f.querySelectorAll("input")].filter((m) => m.value !== "" && !m.value.trim());
|
|
1608
1629
|
for (const m of g) {
|
|
1609
1630
|
m.value = "";
|
|
1610
|
-
const
|
|
1611
|
-
|
|
1631
|
+
const k = At.find((I) => s.config.keys[I] === m.name);
|
|
1632
|
+
k && r(k, "");
|
|
1612
1633
|
}
|
|
1613
|
-
if (g.length > 0 && !
|
|
1614
|
-
c.preventDefault(),
|
|
1634
|
+
if (g.length > 0 && !f.checkValidity()) {
|
|
1635
|
+
c.preventDefault(), f.reportValidity();
|
|
1615
1636
|
return;
|
|
1616
1637
|
}
|
|
1617
|
-
const b = new FormData(
|
|
1638
|
+
const b = new FormData(f), h = Object.fromEntries(b.entries());
|
|
1618
1639
|
t({
|
|
1619
1640
|
type: "address",
|
|
1620
1641
|
value: h
|
|
@@ -1623,7 +1644,7 @@ const Pe = ct("outline-divider ease-expo-out placeholder:text-neutral-10 text-ne
|
|
|
1623
1644
|
children: [u("div", {
|
|
1624
1645
|
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]",
|
|
1625
1646
|
ref: i,
|
|
1626
|
-
children:
|
|
1647
|
+
children: At.map((c, f) => {
|
|
1627
1648
|
const g = `isdk_${c}`, b = s.config.keys[c];
|
|
1628
1649
|
return b ? u(we, {
|
|
1629
1650
|
children: [u("label", {
|
|
@@ -1667,14 +1688,14 @@ const Pe = ct("outline-divider ease-expo-out placeholder:text-neutral-10 text-ne
|
|
|
1667
1688
|
})
|
|
1668
1689
|
})]
|
|
1669
1690
|
}) : u("input", {
|
|
1670
|
-
autoFocus:
|
|
1691
|
+
autoFocus: f === 0 ? !0 : void 0,
|
|
1671
1692
|
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",
|
|
1672
1693
|
name: b,
|
|
1673
1694
|
id: g,
|
|
1674
1695
|
defaultValue: e[c],
|
|
1675
1696
|
onInput: (h) => r(c, h.currentTarget.value),
|
|
1676
|
-
required: c
|
|
1677
|
-
}),
|
|
1697
|
+
required: c === "line2" ? s.config.line2Required === !0 : c !== "line3"
|
|
1698
|
+
}), f === At.length - 1 ? u("hr", {
|
|
1678
1699
|
class: "m-0 w-full border-b border-b-transparent"
|
|
1679
1700
|
}) : u("hr", {
|
|
1680
1701
|
class: "border-b-neutral-5 m-0 w-full border-b border-solid"
|
|
@@ -1689,13 +1710,13 @@ const Pe = ct("outline-divider ease-expo-out placeholder:text-neutral-10 text-ne
|
|
|
1689
1710
|
})]
|
|
1690
1711
|
})]
|
|
1691
1712
|
});
|
|
1692
|
-
},
|
|
1693
|
-
const e =
|
|
1694
|
-
return
|
|
1713
|
+
}, jt = () => {
|
|
1714
|
+
const e = he(null);
|
|
1715
|
+
return Nr(() => {
|
|
1695
1716
|
var r;
|
|
1696
1717
|
(r = e.current) == null || r.focus();
|
|
1697
1718
|
}, []), e;
|
|
1698
|
-
},
|
|
1719
|
+
}, Xr = ["true", "false"], Ps = /* @__PURE__ */ Jr(Xr), qs = "answer", Yr = "flex items-center flex-wrap gap-2 p-2.5", Qr = "min-w-0 max-w-full flex-auto", en = Rr(({
|
|
1699
1720
|
label: e,
|
|
1700
1721
|
...r
|
|
1701
1722
|
}, t) => u("button", {
|
|
@@ -1710,26 +1731,26 @@ const Pe = ct("outline-divider ease-expo-out placeholder:text-neutral-10 text-ne
|
|
|
1710
1731
|
input: e,
|
|
1711
1732
|
onSubmitSuccess: r
|
|
1712
1733
|
}) => {
|
|
1713
|
-
const t =
|
|
1734
|
+
const t = jt();
|
|
1714
1735
|
return u("form", {
|
|
1715
1736
|
noValidate: !0,
|
|
1716
1737
|
class: "",
|
|
1717
1738
|
onSubmit: (n) => {
|
|
1718
1739
|
n.preventDefault();
|
|
1719
|
-
const s =
|
|
1740
|
+
const s = Vn(n).value, i = Fs(Ps, s);
|
|
1720
1741
|
r({
|
|
1721
1742
|
type: "boolean",
|
|
1722
1743
|
value: i === "true"
|
|
1723
1744
|
});
|
|
1724
1745
|
},
|
|
1725
1746
|
children: [u("ul", {
|
|
1726
|
-
class:
|
|
1727
|
-
children:
|
|
1728
|
-
class:
|
|
1729
|
-
children: u(
|
|
1747
|
+
class: Yr,
|
|
1748
|
+
children: Xr.map((n, s) => u("li", {
|
|
1749
|
+
class: Qr,
|
|
1750
|
+
children: u(en, {
|
|
1730
1751
|
ref: s === 0 ? t : null,
|
|
1731
1752
|
type: "submit",
|
|
1732
|
-
name:
|
|
1753
|
+
name: qs,
|
|
1733
1754
|
value: n,
|
|
1734
1755
|
label: e.config.labels[n]
|
|
1735
1756
|
}, n)
|
|
@@ -1743,26 +1764,26 @@ const Pe = ct("outline-divider ease-expo-out placeholder:text-neutral-10 text-ne
|
|
|
1743
1764
|
})
|
|
1744
1765
|
})]
|
|
1745
1766
|
});
|
|
1746
|
-
},
|
|
1767
|
+
}, Us = (e) => new Promise((r, t) => {
|
|
1747
1768
|
const n = new FileReader();
|
|
1748
1769
|
n.onload = () => {
|
|
1749
1770
|
if (typeof n.result != "string" || !n.result)
|
|
1750
1771
|
return t(new Error("Invalid file"));
|
|
1751
1772
|
r(n.result);
|
|
1752
1773
|
}, n.onerror = t, n.readAsDataURL(e);
|
|
1753
|
-
}),
|
|
1774
|
+
}), nr = (e) => e.reduce((r, t) => r + t.sizeKb, 0), Ws = Ge("file"), sr = 3, gt = (e) => {
|
|
1754
1775
|
const r = e.lastIndexOf(".");
|
|
1755
1776
|
return r === -1 ? [e, ""] : [e.slice(0, r), e.slice(r)];
|
|
1756
|
-
},
|
|
1777
|
+
}, zs = ({
|
|
1757
1778
|
file: e,
|
|
1758
1779
|
class: r,
|
|
1759
1780
|
...t
|
|
1760
1781
|
}) => {
|
|
1761
1782
|
const {
|
|
1762
1783
|
t: n
|
|
1763
|
-
} =
|
|
1784
|
+
} = ee(), [s, i] = gt(e.name);
|
|
1764
1785
|
return u("div", {
|
|
1765
|
-
class:
|
|
1786
|
+
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),
|
|
1766
1787
|
...t,
|
|
1767
1788
|
children: [u("p", {
|
|
1768
1789
|
class: "text-accent-12 flex flex-grow overflow-hidden",
|
|
@@ -1780,39 +1801,39 @@ const Pe = ct("outline-divider ease-expo-out placeholder:text-neutral-10 text-ne
|
|
|
1780
1801
|
children: [u("span", {
|
|
1781
1802
|
class: "sr-only",
|
|
1782
1803
|
children: [n("file_size"), ": "]
|
|
1783
|
-
}),
|
|
1804
|
+
}), qe(e.sizeKb)]
|
|
1784
1805
|
})]
|
|
1785
1806
|
});
|
|
1786
|
-
},
|
|
1807
|
+
}, ar = ({
|
|
1787
1808
|
class: e,
|
|
1788
1809
|
...r
|
|
1789
1810
|
}) => u("li", {
|
|
1790
|
-
class:
|
|
1811
|
+
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),
|
|
1791
1812
|
...r
|
|
1792
|
-
}),
|
|
1793
|
-
const [t, n] =
|
|
1813
|
+
}), Ks = (e, r) => {
|
|
1814
|
+
const [t, n] = gt(e);
|
|
1794
1815
|
return `${t.slice(0, r)}${n}`;
|
|
1795
|
-
},
|
|
1796
|
-
name:
|
|
1816
|
+
}, ir = (e) => ({
|
|
1817
|
+
name: Ks(e.name, 42),
|
|
1797
1818
|
sizeKb: e.size / 1e3
|
|
1798
|
-
}),
|
|
1799
|
-
const n =
|
|
1819
|
+
}), Gs = [".heic", ".heif", ".jpg", ".jpeg", ".png", ".gif", ".webp", ".txt", ".rtf", ".odt", ".pages", ".zip"], Hs = (e, r, t) => {
|
|
1820
|
+
const n = gt(r.name)[1].toLowerCase(), s = [...t.map((a) => a.toLowerCase()), ...Gs], i = n === "" ? "none" : s.includes(n) ? n : "other";
|
|
1800
1821
|
return `chatbot-file-refused:${e}:${i}`;
|
|
1801
|
-
},
|
|
1822
|
+
}, Js = ({
|
|
1802
1823
|
input: e,
|
|
1803
1824
|
onSubmitSuccess: r,
|
|
1804
1825
|
analytics: t
|
|
1805
1826
|
}) => {
|
|
1806
1827
|
var C;
|
|
1807
|
-
const n = (C =
|
|
1828
|
+
const n = (C = K.current$.value.flow) == null ? void 0 : C.data.submissions[e.key], [s, i] = ve(Ws(n) && n.value.length ? {
|
|
1808
1829
|
status: "ready",
|
|
1809
1830
|
files: n.value
|
|
1810
1831
|
} : {
|
|
1811
1832
|
status: "empty"
|
|
1812
|
-
}), a =
|
|
1833
|
+
}), a = he(0), o = s.status === "ready" ? s.files : [], c = s.status === "ready" || s.status === "pending" ? s.files : [], f = s.status === "error" ? s.error : void 0, g = c.length - sr, b = nr(c), h = jt(), {
|
|
1813
1834
|
t: m
|
|
1814
|
-
} =
|
|
1815
|
-
if (!
|
|
1835
|
+
} = ee(), k = (x) => {
|
|
1836
|
+
if (!x.length)
|
|
1816
1837
|
return {
|
|
1817
1838
|
reason: "required",
|
|
1818
1839
|
error: {
|
|
@@ -1820,10 +1841,10 @@ const Pe = ct("outline-divider ease-expo-out placeholder:text-neutral-10 text-ne
|
|
|
1820
1841
|
message: m("validation_file")
|
|
1821
1842
|
}
|
|
1822
1843
|
};
|
|
1823
|
-
if (!
|
|
1844
|
+
if (!Xt(x, e.config.extensions))
|
|
1824
1845
|
return {
|
|
1825
1846
|
reason: "type",
|
|
1826
|
-
file:
|
|
1847
|
+
file: x.find((y) => !Xt([y], e.config.extensions)),
|
|
1827
1848
|
error: {
|
|
1828
1849
|
type: "validate",
|
|
1829
1850
|
message: m("validation_file_ext", {
|
|
@@ -1831,26 +1852,26 @@ const Pe = ct("outline-divider ease-expo-out placeholder:text-neutral-10 text-ne
|
|
|
1831
1852
|
})
|
|
1832
1853
|
}
|
|
1833
1854
|
};
|
|
1834
|
-
if (
|
|
1855
|
+
if (x.some((y) => y.sizeKb === 0))
|
|
1835
1856
|
return {
|
|
1836
1857
|
reason: "empty",
|
|
1837
|
-
file:
|
|
1858
|
+
file: x.find((y) => y.sizeKb === 0),
|
|
1838
1859
|
error: {
|
|
1839
1860
|
type: "validate",
|
|
1840
1861
|
message: m("validation_file_empty")
|
|
1841
1862
|
}
|
|
1842
1863
|
};
|
|
1843
|
-
if (e.config.fileSizeLimitKib &&
|
|
1864
|
+
if (e.config.fileSizeLimitKib && nr(x) > e.config.fileSizeLimitKib)
|
|
1844
1865
|
return {
|
|
1845
1866
|
reason: "size",
|
|
1846
1867
|
error: {
|
|
1847
1868
|
type: "max",
|
|
1848
1869
|
message: m("validation_file_size", {
|
|
1849
|
-
size:
|
|
1870
|
+
size: qe(e.config.fileSizeLimitKib)
|
|
1850
1871
|
})
|
|
1851
1872
|
}
|
|
1852
1873
|
};
|
|
1853
|
-
if (!e.config.allowMultiple &&
|
|
1874
|
+
if (!e.config.allowMultiple && x.length > 1)
|
|
1854
1875
|
return {
|
|
1855
1876
|
reason: "count",
|
|
1856
1877
|
error: {
|
|
@@ -1860,22 +1881,22 @@ const Pe = ct("outline-divider ease-expo-out placeholder:text-neutral-10 text-ne
|
|
|
1860
1881
|
})
|
|
1861
1882
|
}
|
|
1862
1883
|
};
|
|
1863
|
-
},
|
|
1864
|
-
var
|
|
1884
|
+
}, I = (x, y) => {
|
|
1885
|
+
var F, N;
|
|
1865
1886
|
return t.log({
|
|
1866
1887
|
event: "INTERACTION",
|
|
1867
1888
|
properties: {
|
|
1868
|
-
tag:
|
|
1889
|
+
tag: Hs(x, y, e.config.extensions)
|
|
1869
1890
|
},
|
|
1870
|
-
customProperties: (
|
|
1891
|
+
customProperties: (N = (F = K.current$.peek().flow) == null ? void 0 : F.analytics) == null ? void 0 : N.customProperties
|
|
1871
1892
|
});
|
|
1872
1893
|
};
|
|
1873
1894
|
return u("form", {
|
|
1874
1895
|
class: "flex flex-col gap-1 p-2.5",
|
|
1875
|
-
onSubmit: (
|
|
1876
|
-
if (
|
|
1896
|
+
onSubmit: (x) => {
|
|
1897
|
+
if (x.preventDefault(), s.status === "pending" || s.status === "error")
|
|
1877
1898
|
return;
|
|
1878
|
-
const y =
|
|
1899
|
+
const y = k(o);
|
|
1879
1900
|
y ? i({
|
|
1880
1901
|
status: "error",
|
|
1881
1902
|
error: y.error
|
|
@@ -1892,18 +1913,18 @@ const Pe = ct("outline-divider ease-expo-out placeholder:text-neutral-10 text-ne
|
|
|
1892
1913
|
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",
|
|
1893
1914
|
children: [c.length > 0 ? u("ul", {
|
|
1894
1915
|
class: "flex max-w-full flex-wrap justify-center gap-1 overflow-hidden p-1",
|
|
1895
|
-
children: [c.slice(0,
|
|
1896
|
-
const [y,
|
|
1897
|
-
return u(
|
|
1916
|
+
children: [c.slice(0, sr).map((x) => {
|
|
1917
|
+
const [y, F] = gt(x.name);
|
|
1918
|
+
return u(ar, {
|
|
1898
1919
|
class: "flex overflow-hidden",
|
|
1899
1920
|
children: [u("span", {
|
|
1900
1921
|
class: "block truncate",
|
|
1901
1922
|
children: y
|
|
1902
1923
|
}), u("span", {
|
|
1903
|
-
children:
|
|
1924
|
+
children: F
|
|
1904
1925
|
})]
|
|
1905
1926
|
});
|
|
1906
|
-
}), g > 0 ? u(
|
|
1927
|
+
}), g > 0 ? u(ar, {
|
|
1907
1928
|
children: m("file_more", {
|
|
1908
1929
|
count: g
|
|
1909
1930
|
})
|
|
@@ -1933,7 +1954,7 @@ const Pe = ct("outline-divider ease-expo-out placeholder:text-neutral-10 text-ne
|
|
|
1933
1954
|
}), e.config.fileSizeLimitKib ? u("p", {
|
|
1934
1955
|
class: "text-neutral-11 text-xs",
|
|
1935
1956
|
children: ["(", m("file_max_size", {
|
|
1936
|
-
size:
|
|
1957
|
+
size: qe(e.config.fileSizeLimitKib)
|
|
1937
1958
|
}), ")"]
|
|
1938
1959
|
}) : null]
|
|
1939
1960
|
}), u("aside", {
|
|
@@ -1945,17 +1966,17 @@ const Pe = ct("outline-divider ease-expo-out placeholder:text-neutral-10 text-ne
|
|
|
1945
1966
|
}), u("ul", {
|
|
1946
1967
|
"aria-describedby": "accepted-filetypes",
|
|
1947
1968
|
class: "flex flex-wrap justify-center gap-2",
|
|
1948
|
-
children: e.config.extensions.map((
|
|
1969
|
+
children: e.config.extensions.map((x) => u("li", {
|
|
1949
1970
|
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",
|
|
1950
|
-
children:
|
|
1971
|
+
children: x.replace(".", "")
|
|
1951
1972
|
}))
|
|
1952
1973
|
})]
|
|
1953
1974
|
})]
|
|
1954
1975
|
}), u("p", {
|
|
1955
1976
|
role: "status",
|
|
1956
|
-
class:
|
|
1977
|
+
class: Ke("text-neutral-11 flex items-center gap-1.5 text-xs", c.length === 0 && "sr-only"),
|
|
1957
1978
|
children: s.status === "pending" ? u(we, {
|
|
1958
|
-
children: [u(
|
|
1979
|
+
children: [u(Rt, {
|
|
1959
1980
|
"aria-hidden": "true",
|
|
1960
1981
|
class: "h-4 w-4"
|
|
1961
1982
|
}), m("file_preparing", {
|
|
@@ -1963,8 +1984,8 @@ const Pe = ct("outline-divider ease-expo-out placeholder:text-neutral-10 text-ne
|
|
|
1963
1984
|
})]
|
|
1964
1985
|
}) : s.status === "ready" ? u(we, {
|
|
1965
1986
|
children: [o.length > 1 ? m("file_total_size", {
|
|
1966
|
-
size:
|
|
1967
|
-
}) :
|
|
1987
|
+
size: qe(b)
|
|
1988
|
+
}) : qe(b), u("span", {
|
|
1968
1989
|
class: "sr-only",
|
|
1969
1990
|
children: [". ", m("file_ready", {
|
|
1970
1991
|
count: o.length
|
|
@@ -1976,43 +1997,43 @@ const Pe = ct("outline-divider ease-expo-out placeholder:text-neutral-10 text-ne
|
|
|
1976
1997
|
"aria-label": m("upload_file", {
|
|
1977
1998
|
count: e.config.allowMultiple ? 2 : 1
|
|
1978
1999
|
}),
|
|
1979
|
-
onInput: async (
|
|
1980
|
-
Ne(
|
|
1981
|
-
const y =
|
|
1982
|
-
|
|
1983
|
-
const [
|
|
1984
|
-
if (!
|
|
2000
|
+
onInput: async (x) => {
|
|
2001
|
+
Ne(x.target instanceof HTMLInputElement);
|
|
2002
|
+
const y = x.target.files ? Array.from(x.target.files) : [];
|
|
2003
|
+
x.target.value = "";
|
|
2004
|
+
const [F] = y;
|
|
2005
|
+
if (!F)
|
|
1985
2006
|
return;
|
|
1986
|
-
const
|
|
1987
|
-
if (
|
|
1988
|
-
return
|
|
2007
|
+
const N = ++a.current, V = s.status === "ready", T = y.map(ir), R = k(T);
|
|
2008
|
+
if (R)
|
|
2009
|
+
return I(R.reason, R.file ?? F), i({
|
|
1989
2010
|
status: "error",
|
|
1990
|
-
error:
|
|
2011
|
+
error: R.error
|
|
1991
2012
|
});
|
|
1992
2013
|
i({
|
|
1993
2014
|
status: "pending",
|
|
1994
|
-
files:
|
|
2015
|
+
files: T
|
|
1995
2016
|
});
|
|
1996
|
-
let
|
|
2017
|
+
let O;
|
|
1997
2018
|
try {
|
|
1998
|
-
const q = await Promise.all(y.map(async (
|
|
2019
|
+
const q = await Promise.all(y.map(async (P) => {
|
|
1999
2020
|
try {
|
|
2000
2021
|
return {
|
|
2001
|
-
...
|
|
2002
|
-
data: await
|
|
2022
|
+
...ir(P),
|
|
2023
|
+
data: await Us(P)
|
|
2003
2024
|
};
|
|
2004
|
-
} catch (
|
|
2005
|
-
throw
|
|
2025
|
+
} catch (H) {
|
|
2026
|
+
throw O ?? (O = P), H;
|
|
2006
2027
|
}
|
|
2007
2028
|
}));
|
|
2008
|
-
a.current ===
|
|
2029
|
+
a.current === N && i({
|
|
2009
2030
|
status: "ready",
|
|
2010
2031
|
files: q
|
|
2011
2032
|
});
|
|
2012
2033
|
} catch {
|
|
2013
|
-
if (a.current !==
|
|
2034
|
+
if (a.current !== N)
|
|
2014
2035
|
return;
|
|
2015
|
-
|
|
2036
|
+
I("unreadable", O ?? F), i({
|
|
2016
2037
|
status: "error",
|
|
2017
2038
|
error: {
|
|
2018
2039
|
type: "invalid",
|
|
@@ -2035,56 +2056,56 @@ const Pe = ct("outline-divider ease-expo-out placeholder:text-neutral-10 text-ne
|
|
|
2035
2056
|
onClick: () => r(null)
|
|
2036
2057
|
})]
|
|
2037
2058
|
})]
|
|
2038
|
-
}), u(
|
|
2039
|
-
error:
|
|
2059
|
+
}), u(He, {
|
|
2060
|
+
error: f
|
|
2040
2061
|
})]
|
|
2041
2062
|
});
|
|
2042
2063
|
};
|
|
2043
|
-
var
|
|
2044
|
-
const
|
|
2045
|
-
var
|
|
2064
|
+
var ot = (e) => e.type === "checkbox", Le = (e) => e instanceof Date, se = (e) => e == null;
|
|
2065
|
+
const tn = (e) => typeof e == "object";
|
|
2066
|
+
var X = (e) => !se(e) && !Array.isArray(e) && tn(e) && !Le(e), Zs = (e) => X(e) && e.target ? ot(e.target) ? e.target.checked : e.target.value : e, Xs = (e) => e.substring(0, e.search(/\.\d+(\.|$)/)) || e, Ys = (e, r) => e.has(Xs(r)), Qs = (e) => {
|
|
2046
2067
|
const r = e.constructor && e.constructor.prototype;
|
|
2047
|
-
return
|
|
2048
|
-
},
|
|
2049
|
-
function
|
|
2068
|
+
return X(r) && r.hasOwnProperty("isPrototypeOf");
|
|
2069
|
+
}, Pt = typeof window < "u" && typeof window.HTMLElement < "u" && typeof document < "u";
|
|
2070
|
+
function Y(e) {
|
|
2050
2071
|
if (e instanceof Date)
|
|
2051
2072
|
return new Date(e);
|
|
2052
2073
|
const r = typeof FileList < "u" && e instanceof FileList;
|
|
2053
|
-
if (
|
|
2074
|
+
if (Pt && (e instanceof Blob || r))
|
|
2054
2075
|
return e;
|
|
2055
2076
|
const t = Array.isArray(e);
|
|
2056
|
-
if (!t && !(
|
|
2077
|
+
if (!t && !(X(e) && Qs(e)))
|
|
2057
2078
|
return e;
|
|
2058
2079
|
const n = t ? [] : Object.create(Object.getPrototypeOf(e));
|
|
2059
2080
|
for (const s in e)
|
|
2060
|
-
Object.prototype.hasOwnProperty.call(e, s) && (n[s] =
|
|
2081
|
+
Object.prototype.hasOwnProperty.call(e, s) && (n[s] = Y(e[s]));
|
|
2061
2082
|
return n;
|
|
2062
2083
|
}
|
|
2063
|
-
var
|
|
2064
|
-
if (!r || !
|
|
2084
|
+
var bt = (e) => /^\w*$/.test(e), J = (e) => e === void 0, qt = (e) => Array.isArray(e) ? e.filter(Boolean) : [], $t = (e) => qt(e.replace(/["|']|\]/g, "").split(/\.|\[/)), S = (e, r, t) => {
|
|
2085
|
+
if (!r || !X(e))
|
|
2065
2086
|
return t;
|
|
2066
|
-
const n = (
|
|
2067
|
-
return
|
|
2068
|
-
},
|
|
2087
|
+
const n = (bt(r) ? [r] : $t(r)).reduce((s, i) => se(s) ? s : s[i], e);
|
|
2088
|
+
return J(n) || n === e ? J(e[r]) ? t : e[r] : n;
|
|
2089
|
+
}, pe = (e) => typeof e == "boolean", ce = (e) => typeof e == "function", G = (e, r, t) => {
|
|
2069
2090
|
let n = -1;
|
|
2070
|
-
const s =
|
|
2091
|
+
const s = bt(r) ? [r] : $t(r), i = s.length, a = i - 1;
|
|
2071
2092
|
for (; ++n < i; ) {
|
|
2072
2093
|
const o = s[n];
|
|
2073
2094
|
let c = t;
|
|
2074
2095
|
if (n !== a) {
|
|
2075
|
-
const
|
|
2076
|
-
c =
|
|
2096
|
+
const f = e[o];
|
|
2097
|
+
c = X(f) || Array.isArray(f) ? f : isNaN(+s[n + 1]) ? {} : [];
|
|
2077
2098
|
}
|
|
2078
2099
|
if (o === "__proto__" || o === "constructor" || o === "prototype")
|
|
2079
2100
|
return;
|
|
2080
2101
|
e[o] = c, e = e[o];
|
|
2081
2102
|
}
|
|
2082
2103
|
};
|
|
2083
|
-
const
|
|
2104
|
+
const or = {
|
|
2084
2105
|
BLUR: "blur",
|
|
2085
2106
|
FOCUS_OUT: "focusout",
|
|
2086
2107
|
CHANGE: "change"
|
|
2087
|
-
},
|
|
2108
|
+
}, de = {
|
|
2088
2109
|
onBlur: "onBlur",
|
|
2089
2110
|
onChange: "onChange",
|
|
2090
2111
|
onSubmit: "onSubmit",
|
|
@@ -2098,9 +2119,9 @@ const rr = {
|
|
|
2098
2119
|
pattern: "pattern",
|
|
2099
2120
|
required: "required",
|
|
2100
2121
|
validate: "validate"
|
|
2101
|
-
},
|
|
2102
|
-
|
|
2103
|
-
var
|
|
2122
|
+
}, ea = re.createContext(null);
|
|
2123
|
+
ea.displayName = "HookFormControlContext";
|
|
2124
|
+
var ta = (e, r, t, n = !0) => {
|
|
2104
2125
|
const s = {
|
|
2105
2126
|
defaultValues: r._defaultValues
|
|
2106
2127
|
};
|
|
@@ -2108,15 +2129,15 @@ var Zs = (e, r, t, n = !0) => {
|
|
|
2108
2129
|
Object.defineProperty(s, i, {
|
|
2109
2130
|
get: () => {
|
|
2110
2131
|
const a = i;
|
|
2111
|
-
return r._proxyFormState[a] !==
|
|
2132
|
+
return r._proxyFormState[a] !== de.all && (r._proxyFormState[a] = !n || de.all), t && (t[a] = !0), e[a];
|
|
2112
2133
|
}
|
|
2113
2134
|
});
|
|
2114
2135
|
return s;
|
|
2115
2136
|
};
|
|
2116
|
-
const
|
|
2117
|
-
var
|
|
2137
|
+
const ra = typeof window < "u" ? re.useLayoutEffect : re.useEffect;
|
|
2138
|
+
var oe = (e) => typeof e == "string", na = (e, r, t, n, s) => oe(e) ? (n && r.watch.add(e), S(t, e, s)) : Array.isArray(e) ? e.map((i) => (n && r.watch.add(i), S(t, i))) : (n && (r.watchAll = !0), t), Lt = (e) => se(e) || !tn(e);
|
|
2118
2139
|
function Se(e, r, t = /* @__PURE__ */ new WeakSet()) {
|
|
2119
|
-
if (
|
|
2140
|
+
if (Lt(e) || Lt(r))
|
|
2120
2141
|
return Object.is(e, r);
|
|
2121
2142
|
if (Le(e) && Le(r))
|
|
2122
2143
|
return Object.is(e.getTime(), r.getTime());
|
|
@@ -2132,21 +2153,21 @@ function Se(e, r, t = /* @__PURE__ */ new WeakSet()) {
|
|
|
2132
2153
|
return !1;
|
|
2133
2154
|
if (i !== "ref") {
|
|
2134
2155
|
const o = r[i];
|
|
2135
|
-
if (Le(a) && Le(o) ||
|
|
2156
|
+
if (Le(a) && Le(o) || X(a) && X(o) || Array.isArray(a) && Array.isArray(o) ? !Se(a, o, t) : !Object.is(a, o))
|
|
2136
2157
|
return !1;
|
|
2137
2158
|
}
|
|
2138
2159
|
}
|
|
2139
2160
|
return !0;
|
|
2140
2161
|
}
|
|
2141
|
-
const
|
|
2142
|
-
|
|
2143
|
-
var
|
|
2162
|
+
const sa = re.createContext(null);
|
|
2163
|
+
sa.displayName = "HookFormContext";
|
|
2164
|
+
var rn = (e, r, t, n, s) => r ? {
|
|
2144
2165
|
...t[e],
|
|
2145
2166
|
types: {
|
|
2146
2167
|
...t[e] && t[e].types ? t[e].types : {},
|
|
2147
2168
|
[n]: s || !0
|
|
2148
2169
|
}
|
|
2149
|
-
} : {},
|
|
2170
|
+
} : {}, at = (e) => Array.isArray(e) ? e : [e], lr = () => {
|
|
2150
2171
|
let e = [];
|
|
2151
2172
|
return {
|
|
2152
2173
|
get observers() {
|
|
@@ -2166,64 +2187,64 @@ var Zr = (e, r, t, n, s) => r ? {
|
|
|
2166
2187
|
}
|
|
2167
2188
|
};
|
|
2168
2189
|
};
|
|
2169
|
-
function
|
|
2190
|
+
function nn(e, r) {
|
|
2170
2191
|
const t = {};
|
|
2171
2192
|
for (const n in e)
|
|
2172
2193
|
if (e.hasOwnProperty(n)) {
|
|
2173
2194
|
const s = e[n], i = r[n];
|
|
2174
|
-
if (s &&
|
|
2175
|
-
const a =
|
|
2176
|
-
|
|
2195
|
+
if (s && X(s) && i) {
|
|
2196
|
+
const a = nn(s, i);
|
|
2197
|
+
X(a) && (t[n] = a);
|
|
2177
2198
|
} else
|
|
2178
2199
|
e[n] && (t[n] = i);
|
|
2179
2200
|
}
|
|
2180
2201
|
return t;
|
|
2181
2202
|
}
|
|
2182
|
-
var
|
|
2183
|
-
if (!
|
|
2203
|
+
var ne = (e) => X(e) && !Object.keys(e).length, Ut = (e) => e.type === "file", ft = (e) => {
|
|
2204
|
+
if (!Pt)
|
|
2184
2205
|
return !1;
|
|
2185
2206
|
const r = e ? e.ownerDocument : 0;
|
|
2186
2207
|
return e instanceof (r && r.defaultView ? r.defaultView.HTMLElement : HTMLElement);
|
|
2187
|
-
},
|
|
2188
|
-
function
|
|
2208
|
+
}, sn = (e) => e.type === "select-multiple", Wt = (e) => e.type === "radio", aa = (e) => Wt(e) || ot(e), Et = (e) => ft(e) && e.isConnected;
|
|
2209
|
+
function ia(e, r) {
|
|
2189
2210
|
const t = r.slice(0, -1).length;
|
|
2190
2211
|
let n = 0;
|
|
2191
2212
|
for (; n < t; )
|
|
2192
|
-
e =
|
|
2213
|
+
e = J(e) ? n++ : e[r[n++]];
|
|
2193
2214
|
return e;
|
|
2194
2215
|
}
|
|
2195
|
-
function
|
|
2216
|
+
function oa(e) {
|
|
2196
2217
|
for (const r in e)
|
|
2197
|
-
if (e.hasOwnProperty(r) && !
|
|
2218
|
+
if (e.hasOwnProperty(r) && !J(e[r]))
|
|
2198
2219
|
return !1;
|
|
2199
2220
|
return !0;
|
|
2200
2221
|
}
|
|
2201
|
-
function
|
|
2202
|
-
const t = Array.isArray(r) ? r :
|
|
2203
|
-
return n && delete n[i], s !== 0 && (
|
|
2222
|
+
function Z(e, r) {
|
|
2223
|
+
const t = Array.isArray(r) ? r : bt(r) ? [r] : $t(r), n = t.length === 1 ? e : ia(e, t), s = t.length - 1, i = t[s];
|
|
2224
|
+
return n && delete n[i], s !== 0 && (X(n) && ne(n) || Array.isArray(n) && oa(n)) && Z(e, t.slice(0, -1)), e;
|
|
2204
2225
|
}
|
|
2205
|
-
var
|
|
2226
|
+
var la = (e) => {
|
|
2206
2227
|
for (const r in e)
|
|
2207
|
-
if (
|
|
2228
|
+
if (ce(e[r]))
|
|
2208
2229
|
return !0;
|
|
2209
2230
|
return !1;
|
|
2210
2231
|
};
|
|
2211
|
-
function
|
|
2212
|
-
return Array.isArray(e) ||
|
|
2232
|
+
function an(e) {
|
|
2233
|
+
return Array.isArray(e) || X(e) && !la(e);
|
|
2213
2234
|
}
|
|
2214
|
-
function
|
|
2235
|
+
function Nt(e, r = {}) {
|
|
2215
2236
|
for (const t in e) {
|
|
2216
2237
|
const n = e[t];
|
|
2217
|
-
|
|
2238
|
+
an(n) ? (r[t] = Array.isArray(n) ? [] : {}, Nt(n, r[t])) : J(n) || (r[t] = !0);
|
|
2218
2239
|
}
|
|
2219
2240
|
return r;
|
|
2220
2241
|
}
|
|
2221
|
-
function
|
|
2222
|
-
t || (t =
|
|
2242
|
+
function Pe(e, r, t) {
|
|
2243
|
+
t || (t = Nt(r));
|
|
2223
2244
|
for (const n in e) {
|
|
2224
2245
|
const s = e[n];
|
|
2225
|
-
if (
|
|
2226
|
-
|
|
2246
|
+
if (an(s))
|
|
2247
|
+
J(r) || Lt(t[n]) ? t[n] = Nt(s, Array.isArray(s) ? [] : {}) : Pe(s, se(r) ? {} : r[n], t[n]);
|
|
2227
2248
|
else {
|
|
2228
2249
|
const i = r[n];
|
|
2229
2250
|
t[n] = !Se(s, i);
|
|
@@ -2231,11 +2252,11 @@ function Oe(e, r, t) {
|
|
|
2231
2252
|
}
|
|
2232
2253
|
return t;
|
|
2233
2254
|
}
|
|
2234
|
-
const
|
|
2255
|
+
const ur = {
|
|
2235
2256
|
value: !1,
|
|
2236
2257
|
isValid: !1
|
|
2237
|
-
},
|
|
2238
|
-
var
|
|
2258
|
+
}, cr = { value: !0, isValid: !0 };
|
|
2259
|
+
var on = (e) => {
|
|
2239
2260
|
if (Array.isArray(e)) {
|
|
2240
2261
|
if (e.length > 1) {
|
|
2241
2262
|
const r = e.filter((t) => t && t.checked && !t.disabled).map((t) => t.value);
|
|
@@ -2243,28 +2264,28 @@ var tn = (e) => {
|
|
|
2243
2264
|
}
|
|
2244
2265
|
return e[0].checked && !e[0].disabled ? (
|
|
2245
2266
|
// @ts-expect-error expected to work in the browser
|
|
2246
|
-
e[0].attributes && !
|
|
2247
|
-
) :
|
|
2267
|
+
e[0].attributes && !J(e[0].attributes.value) ? J(e[0].value) || e[0].value === "" ? cr : { value: e[0].value, isValid: !0 } : cr
|
|
2268
|
+
) : ur;
|
|
2248
2269
|
}
|
|
2249
|
-
return
|
|
2250
|
-
},
|
|
2251
|
-
const
|
|
2270
|
+
return ur;
|
|
2271
|
+
}, ln = (e, { valueAsNumber: r, valueAsDate: t, setValueAs: n }) => J(e) ? e : r ? e === "" ? NaN : e && +e : t && oe(e) ? new Date(e) : n ? n(e) : e;
|
|
2272
|
+
const dr = {
|
|
2252
2273
|
isValid: !1,
|
|
2253
2274
|
value: null
|
|
2254
2275
|
};
|
|
2255
|
-
var
|
|
2276
|
+
var un = (e) => Array.isArray(e) ? e.reduce((r, t) => t && t.checked && !t.disabled ? {
|
|
2256
2277
|
isValid: !0,
|
|
2257
2278
|
value: t.value
|
|
2258
|
-
} : r,
|
|
2259
|
-
function
|
|
2279
|
+
} : r, dr) : dr;
|
|
2280
|
+
function fr(e) {
|
|
2260
2281
|
const r = e.ref;
|
|
2261
|
-
return
|
|
2282
|
+
return Ut(r) ? r.files : Wt(r) ? un(e.refs).value : sn(r) ? [...r.selectedOptions].map(({ value: t }) => t) : ot(r) ? on(e.refs).value : ln(J(r.value) ? e.ref.value : r.value, e);
|
|
2262
2283
|
}
|
|
2263
|
-
var
|
|
2284
|
+
var ua = (e, r, t, n) => {
|
|
2264
2285
|
const s = {};
|
|
2265
2286
|
for (const i of e) {
|
|
2266
|
-
const a =
|
|
2267
|
-
a &&
|
|
2287
|
+
const a = S(r, i);
|
|
2288
|
+
a && G(s, i, a._f);
|
|
2268
2289
|
}
|
|
2269
2290
|
return {
|
|
2270
2291
|
criteriaMode: t,
|
|
@@ -2272,18 +2293,18 @@ var aa = (e, r, t, n) => {
|
|
|
2272
2293
|
fields: s,
|
|
2273
2294
|
shouldUseNativeValidation: n
|
|
2274
2295
|
};
|
|
2275
|
-
},
|
|
2276
|
-
isOnSubmit: !e || e ===
|
|
2277
|
-
isOnBlur: e ===
|
|
2278
|
-
isOnChange: e ===
|
|
2279
|
-
isOnAll: e ===
|
|
2280
|
-
isOnTouch: e ===
|
|
2296
|
+
}, pt = (e) => e instanceof RegExp, tt = (e) => J(e) ? e : pt(e) ? e.source : X(e) ? pt(e.value) ? e.value.source : e.value : e, pr = (e) => ({
|
|
2297
|
+
isOnSubmit: !e || e === de.onSubmit,
|
|
2298
|
+
isOnBlur: e === de.onBlur,
|
|
2299
|
+
isOnChange: e === de.onChange,
|
|
2300
|
+
isOnAll: e === de.all,
|
|
2301
|
+
isOnTouch: e === de.onTouched
|
|
2281
2302
|
});
|
|
2282
|
-
const
|
|
2283
|
-
var
|
|
2284
|
-
const
|
|
2303
|
+
const hr = "AsyncFunction";
|
|
2304
|
+
var ca = (e) => !!e && !!e.validate && !!(ce(e.validate) && e.validate.constructor.name === hr || X(e.validate) && Object.values(e.validate).find((r) => r.constructor.name === hr)), da = (e) => e.mount && (e.required || e.min || e.max || e.maxLength || e.minLength || e.pattern || e.validate), mr = (e, r, t) => !t && (r.watchAll || r.watch.has(e) || [...r.watch].some((n) => e.startsWith(n) && /^\.\w+/.test(e.slice(n.length))));
|
|
2305
|
+
const it = (e, r, t, n) => {
|
|
2285
2306
|
for (const s of t || Object.keys(e)) {
|
|
2286
|
-
const i =
|
|
2307
|
+
const i = S(e, s);
|
|
2287
2308
|
if (i) {
|
|
2288
2309
|
const { _f: a, ...o } = i;
|
|
2289
2310
|
if (a) {
|
|
@@ -2291,23 +2312,23 @@ const tt = (e, r, t, n) => {
|
|
|
2291
2312
|
return !0;
|
|
2292
2313
|
if (a.ref && r(a.ref, a.name) && !n)
|
|
2293
2314
|
return !0;
|
|
2294
|
-
if (
|
|
2315
|
+
if (it(o, r))
|
|
2295
2316
|
break;
|
|
2296
|
-
} else if (
|
|
2317
|
+
} else if (X(o) && it(o, r))
|
|
2297
2318
|
break;
|
|
2298
2319
|
}
|
|
2299
2320
|
}
|
|
2300
2321
|
};
|
|
2301
|
-
function
|
|
2302
|
-
const n =
|
|
2303
|
-
if (n ||
|
|
2322
|
+
function yr(e, r, t) {
|
|
2323
|
+
const n = S(e, t);
|
|
2324
|
+
if (n || bt(t))
|
|
2304
2325
|
return {
|
|
2305
2326
|
error: n,
|
|
2306
2327
|
name: t
|
|
2307
2328
|
};
|
|
2308
2329
|
const s = t.split(".");
|
|
2309
2330
|
for (; s.length; ) {
|
|
2310
|
-
const i = s.join("."), a =
|
|
2331
|
+
const i = s.join("."), a = S(r, i), o = S(e, i);
|
|
2311
2332
|
if (a && !Array.isArray(a) && t !== i)
|
|
2312
2333
|
return { name: t };
|
|
2313
2334
|
if (o && o.type)
|
|
@@ -2326,120 +2347,120 @@ function dr(e, r, t) {
|
|
|
2326
2347
|
name: t
|
|
2327
2348
|
};
|
|
2328
2349
|
}
|
|
2329
|
-
var
|
|
2350
|
+
var fa = (e, r, t, n) => {
|
|
2330
2351
|
t(e);
|
|
2331
2352
|
const { name: s, ...i } = e;
|
|
2332
|
-
return
|
|
2333
|
-
},
|
|
2334
|
-
const n =
|
|
2335
|
-
return
|
|
2353
|
+
return ne(i) || Object.keys(i).length >= Object.keys(r).length || Object.keys(i).find((a) => r[a] === (!n || de.all));
|
|
2354
|
+
}, pa = (e, r, t) => !e || !r || e === r || at(e).some((n) => n && (t ? n === r : n.startsWith(r) || r.startsWith(n))), ha = (e, r, t, n, s) => s.isOnAll ? !1 : !t && s.isOnTouch ? !(r || e) : (t ? n.isOnBlur : s.isOnBlur) ? !e : (t ? n.isOnChange : s.isOnChange) ? e : !0, ma = (e, r) => !qt(S(e, r)).length && Z(e, r), ya = (e, r, t) => {
|
|
2355
|
+
const n = at(S(e, t));
|
|
2356
|
+
return G(n, "root", r[t]), G(e, t, n), e;
|
|
2336
2357
|
};
|
|
2337
|
-
function
|
|
2338
|
-
if (
|
|
2358
|
+
function gr(e, r, t = "validate") {
|
|
2359
|
+
if (oe(e) || Array.isArray(e) && e.every(oe) || pe(e) && !e)
|
|
2339
2360
|
return {
|
|
2340
2361
|
type: t,
|
|
2341
|
-
message:
|
|
2362
|
+
message: oe(e) ? e : "",
|
|
2342
2363
|
ref: r
|
|
2343
2364
|
};
|
|
2344
2365
|
}
|
|
2345
|
-
var
|
|
2366
|
+
var je = (e) => X(e) && !pt(e) ? e : {
|
|
2346
2367
|
value: e,
|
|
2347
2368
|
message: ""
|
|
2348
|
-
},
|
|
2349
|
-
const { ref: a, refs: o, required: c, maxLength:
|
|
2350
|
-
if (!
|
|
2369
|
+
}, br = async (e, r, t, n, s, i) => {
|
|
2370
|
+
const { ref: a, refs: o, required: c, maxLength: f, minLength: g, min: b, max: h, pattern: m, validate: k, name: I, valueAsNumber: C, mount: x } = e._f, y = S(t, I);
|
|
2371
|
+
if (!x || r.has(I))
|
|
2351
2372
|
return {};
|
|
2352
|
-
const
|
|
2353
|
-
s &&
|
|
2354
|
-
}, V = {},
|
|
2355
|
-
const
|
|
2356
|
-
V[
|
|
2357
|
-
type:
|
|
2358
|
-
message:
|
|
2373
|
+
const F = o ? o[0] : a, N = (M) => {
|
|
2374
|
+
s && F.reportValidity && (F.setCustomValidity(pe(M) ? "" : M || ""), F.reportValidity());
|
|
2375
|
+
}, V = {}, T = Wt(a), R = ot(a), O = T || R, q = (C || Ut(a)) && J(a.value) && J(y) || ft(a) && a.value === "" || y === "" || Array.isArray(y) && !y.length, P = rn.bind(null, I, n, V), H = (M, A, B, $ = be.maxLength, U = be.minLength) => {
|
|
2376
|
+
const j = M ? A : B;
|
|
2377
|
+
V[I] = {
|
|
2378
|
+
type: M ? $ : U,
|
|
2379
|
+
message: j,
|
|
2359
2380
|
ref: a,
|
|
2360
|
-
...
|
|
2381
|
+
...P(M ? $ : U, j)
|
|
2361
2382
|
};
|
|
2362
2383
|
};
|
|
2363
|
-
if (i ? !Array.isArray(y) || !y.length : c && (!
|
|
2364
|
-
const { value:
|
|
2365
|
-
if (
|
|
2384
|
+
if (i ? !Array.isArray(y) || !y.length : c && (!O && (q || se(y)) || pe(y) && !y || R && !on(o).isValid || T && !un(o).isValid)) {
|
|
2385
|
+
const { value: M, message: A } = oe(c) ? { value: !!c, message: c } : je(c);
|
|
2386
|
+
if (M && (V[I] = {
|
|
2366
2387
|
type: be.required,
|
|
2367
|
-
message:
|
|
2368
|
-
ref:
|
|
2369
|
-
...
|
|
2388
|
+
message: A,
|
|
2389
|
+
ref: F,
|
|
2390
|
+
...P(be.required, A)
|
|
2370
2391
|
}, !n))
|
|
2371
|
-
return A
|
|
2392
|
+
return N(A), V;
|
|
2372
2393
|
}
|
|
2373
|
-
if (!q && (!
|
|
2374
|
-
let
|
|
2375
|
-
const
|
|
2376
|
-
if (!
|
|
2377
|
-
const
|
|
2378
|
-
|
|
2394
|
+
if (!q && (!se(b) || !se(h))) {
|
|
2395
|
+
let M, A;
|
|
2396
|
+
const B = je(h), $ = je(b);
|
|
2397
|
+
if (!se(y) && !isNaN(y)) {
|
|
2398
|
+
const U = a.valueAsNumber || y && +y;
|
|
2399
|
+
se(B.value) || (M = U > B.value), se($.value) || (A = U < $.value);
|
|
2379
2400
|
} else {
|
|
2380
|
-
const
|
|
2381
|
-
|
|
2401
|
+
const U = a.valueAsDate || new Date(y), j = (ue) => /* @__PURE__ */ new Date((/* @__PURE__ */ new Date()).toDateString() + " " + ue), D = a.type == "time", le = a.type == "week";
|
|
2402
|
+
oe(B.value) && y && (M = D ? j(y) > j(B.value) : le ? y > B.value : U > new Date(B.value)), oe($.value) && y && (A = D ? j(y) < j($.value) : le ? y < $.value : U < new Date($.value));
|
|
2382
2403
|
}
|
|
2383
|
-
if ((
|
|
2384
|
-
return
|
|
2404
|
+
if ((M || A) && (H(!!M, B.message, $.message, be.max, be.min), !n))
|
|
2405
|
+
return N(V[I].message), V;
|
|
2385
2406
|
}
|
|
2386
|
-
if ((
|
|
2387
|
-
const
|
|
2388
|
-
if ((
|
|
2389
|
-
return
|
|
2407
|
+
if ((f || g) && !q && (oe(y) || i && Array.isArray(y))) {
|
|
2408
|
+
const M = je(f), A = je(g), B = !se(M.value) && y.length > +M.value, $ = !se(A.value) && y.length < +A.value;
|
|
2409
|
+
if ((B || $) && (H(B, M.message, A.message), !n))
|
|
2410
|
+
return N(V[I].message), V;
|
|
2390
2411
|
}
|
|
2391
|
-
if (m && !q &&
|
|
2392
|
-
const { value:
|
|
2393
|
-
if (
|
|
2412
|
+
if (m && !q && oe(y)) {
|
|
2413
|
+
const { value: M, message: A } = je(m);
|
|
2414
|
+
if (pt(M) && !y.match(M) && (V[I] = {
|
|
2394
2415
|
type: be.pattern,
|
|
2395
|
-
message:
|
|
2416
|
+
message: A,
|
|
2396
2417
|
ref: a,
|
|
2397
|
-
...
|
|
2418
|
+
...P(be.pattern, A)
|
|
2398
2419
|
}, !n))
|
|
2399
|
-
return A
|
|
2420
|
+
return N(A), V;
|
|
2400
2421
|
}
|
|
2401
|
-
if (
|
|
2402
|
-
if (
|
|
2403
|
-
const
|
|
2404
|
-
if (
|
|
2405
|
-
...
|
|
2406
|
-
...
|
|
2422
|
+
if (k) {
|
|
2423
|
+
if (ce(k)) {
|
|
2424
|
+
const M = await k(y, t), A = gr(M, F);
|
|
2425
|
+
if (A && (V[I] = {
|
|
2426
|
+
...A,
|
|
2427
|
+
...P(be.validate, A.message)
|
|
2407
2428
|
}, !n))
|
|
2408
|
-
return A
|
|
2409
|
-
} else if (
|
|
2410
|
-
let
|
|
2411
|
-
for (const
|
|
2412
|
-
if (!
|
|
2429
|
+
return N(A.message), V;
|
|
2430
|
+
} else if (X(k)) {
|
|
2431
|
+
let M = {};
|
|
2432
|
+
for (const A in k) {
|
|
2433
|
+
if (!ne(M) && !n)
|
|
2413
2434
|
break;
|
|
2414
|
-
const
|
|
2415
|
-
|
|
2416
|
-
...
|
|
2417
|
-
...
|
|
2418
|
-
},
|
|
2435
|
+
const B = gr(await k[A](y, t), F, A);
|
|
2436
|
+
B && (M = {
|
|
2437
|
+
...B,
|
|
2438
|
+
...P(A, B.message)
|
|
2439
|
+
}, N(B.message), n && (V[I] = M));
|
|
2419
2440
|
}
|
|
2420
|
-
if (!
|
|
2421
|
-
ref:
|
|
2422
|
-
...
|
|
2441
|
+
if (!ne(M) && (V[I] = {
|
|
2442
|
+
ref: F,
|
|
2443
|
+
...M
|
|
2423
2444
|
}, !n))
|
|
2424
2445
|
return V;
|
|
2425
2446
|
}
|
|
2426
2447
|
}
|
|
2427
|
-
return
|
|
2448
|
+
return N(!0), V;
|
|
2428
2449
|
};
|
|
2429
|
-
const
|
|
2430
|
-
mode:
|
|
2431
|
-
reValidateMode:
|
|
2450
|
+
const ga = {
|
|
2451
|
+
mode: de.onSubmit,
|
|
2452
|
+
reValidateMode: de.onChange,
|
|
2432
2453
|
shouldFocusError: !0
|
|
2433
2454
|
};
|
|
2434
|
-
function
|
|
2455
|
+
function ba(e = {}) {
|
|
2435
2456
|
let r = {
|
|
2436
|
-
...
|
|
2457
|
+
...ga,
|
|
2437
2458
|
...e
|
|
2438
2459
|
}, t = {
|
|
2439
2460
|
submitCount: 0,
|
|
2440
2461
|
isDirty: !1,
|
|
2441
2462
|
isReady: !1,
|
|
2442
|
-
isLoading:
|
|
2463
|
+
isLoading: ce(r.defaultValues),
|
|
2443
2464
|
isValidating: !1,
|
|
2444
2465
|
isSubmitted: !1,
|
|
2445
2466
|
isSubmitting: !1,
|
|
@@ -2450,7 +2471,7 @@ function pa(e = {}) {
|
|
|
2450
2471
|
validatingFields: {},
|
|
2451
2472
|
errors: r.errors || {},
|
|
2452
2473
|
disabled: r.disabled || !1
|
|
2453
|
-
}, n = {}, s =
|
|
2474
|
+
}, n = {}, s = X(r.defaultValues) || X(r.values) ? Y(r.defaultValues || r.values) || {} : {}, i = r.shouldUnregister ? {} : Y(s), a = {
|
|
2454
2475
|
action: !1,
|
|
2455
2476
|
mount: !1,
|
|
2456
2477
|
watch: !1,
|
|
@@ -2461,7 +2482,7 @@ function pa(e = {}) {
|
|
|
2461
2482
|
unMount: /* @__PURE__ */ new Set(),
|
|
2462
2483
|
array: /* @__PURE__ */ new Set(),
|
|
2463
2484
|
watch: /* @__PURE__ */ new Set()
|
|
2464
|
-
}, c,
|
|
2485
|
+
}, c, f = 0;
|
|
2465
2486
|
const g = {
|
|
2466
2487
|
isDirty: !1,
|
|
2467
2488
|
dirtyFields: !1,
|
|
@@ -2477,407 +2498,407 @@ function pa(e = {}) {
|
|
|
2477
2498
|
...b
|
|
2478
2499
|
};
|
|
2479
2500
|
const m = {
|
|
2480
|
-
array:
|
|
2481
|
-
state:
|
|
2482
|
-
},
|
|
2483
|
-
clearTimeout(
|
|
2501
|
+
array: lr(),
|
|
2502
|
+
state: lr()
|
|
2503
|
+
}, k = r.criteriaMode === de.all, I = (l) => (d) => {
|
|
2504
|
+
clearTimeout(f), f = setTimeout(l, d);
|
|
2484
2505
|
}, C = async (l) => {
|
|
2485
2506
|
if (!a.keepIsValid && !r.disabled && (b.isValid || h.isValid || l)) {
|
|
2486
2507
|
let d;
|
|
2487
|
-
r.resolver ? (d =
|
|
2508
|
+
r.resolver ? (d = ne((await O()).errors), x()) : d = await P(n, !0), d !== t.isValid && m.state.next({
|
|
2488
2509
|
isValid: d
|
|
2489
2510
|
});
|
|
2490
2511
|
}
|
|
2491
|
-
},
|
|
2492
|
-
!r.disabled && (b.isValidating || b.validatingFields || h.isValidating || h.validatingFields) && ((l || Array.from(o.mount)).forEach((
|
|
2493
|
-
|
|
2512
|
+
}, x = (l, d) => {
|
|
2513
|
+
!r.disabled && (b.isValidating || b.validatingFields || h.isValidating || h.validatingFields) && ((l || Array.from(o.mount)).forEach((p) => {
|
|
2514
|
+
p && (d ? G(t.validatingFields, p, d) : Z(t.validatingFields, p));
|
|
2494
2515
|
}), m.state.next({
|
|
2495
2516
|
validatingFields: t.validatingFields,
|
|
2496
|
-
isValidating: !
|
|
2517
|
+
isValidating: !ne(t.validatingFields)
|
|
2497
2518
|
}));
|
|
2498
|
-
}, y = (l, d = [],
|
|
2499
|
-
if (
|
|
2500
|
-
if (a.action = !0, v && Array.isArray(
|
|
2501
|
-
const
|
|
2502
|
-
|
|
2519
|
+
}, y = (l, d = [], p, _, w = !0, v = !0) => {
|
|
2520
|
+
if (_ && p && !r.disabled) {
|
|
2521
|
+
if (a.action = !0, v && Array.isArray(S(n, l))) {
|
|
2522
|
+
const E = p(S(n, l), _.argA, _.argB);
|
|
2523
|
+
w && G(n, l, E);
|
|
2503
2524
|
}
|
|
2504
|
-
if (v && Array.isArray(
|
|
2505
|
-
const
|
|
2506
|
-
|
|
2525
|
+
if (v && Array.isArray(S(t.errors, l))) {
|
|
2526
|
+
const E = p(S(t.errors, l), _.argA, _.argB);
|
|
2527
|
+
w && G(t.errors, l, E), ma(t.errors, l);
|
|
2507
2528
|
}
|
|
2508
|
-
if ((b.touchedFields || h.touchedFields) && v && Array.isArray(
|
|
2509
|
-
const
|
|
2510
|
-
|
|
2529
|
+
if ((b.touchedFields || h.touchedFields) && v && Array.isArray(S(t.touchedFields, l))) {
|
|
2530
|
+
const E = p(S(t.touchedFields, l), _.argA, _.argB);
|
|
2531
|
+
w && G(t.touchedFields, l, E);
|
|
2511
2532
|
}
|
|
2512
|
-
(b.dirtyFields || h.dirtyFields) && (t.dirtyFields =
|
|
2533
|
+
(b.dirtyFields || h.dirtyFields) && (t.dirtyFields = Pe(s, i)), m.state.next({
|
|
2513
2534
|
name: l,
|
|
2514
|
-
isDirty:
|
|
2535
|
+
isDirty: M(l, d),
|
|
2515
2536
|
dirtyFields: t.dirtyFields,
|
|
2516
2537
|
errors: t.errors,
|
|
2517
2538
|
isValid: t.isValid
|
|
2518
2539
|
});
|
|
2519
2540
|
} else
|
|
2520
|
-
|
|
2521
|
-
},
|
|
2522
|
-
|
|
2541
|
+
G(i, l, d);
|
|
2542
|
+
}, F = (l, d) => {
|
|
2543
|
+
G(t.errors, l, d), m.state.next({
|
|
2523
2544
|
errors: t.errors
|
|
2524
2545
|
});
|
|
2525
|
-
},
|
|
2546
|
+
}, N = (l) => {
|
|
2526
2547
|
t.errors = l, m.state.next({
|
|
2527
2548
|
errors: t.errors,
|
|
2528
2549
|
isValid: !1
|
|
2529
2550
|
});
|
|
2530
|
-
}, V = (l, d,
|
|
2531
|
-
const
|
|
2532
|
-
if (
|
|
2533
|
-
const v =
|
|
2534
|
-
|
|
2535
|
-
}
|
|
2536
|
-
},
|
|
2537
|
-
let v = !1,
|
|
2538
|
-
const
|
|
2551
|
+
}, V = (l, d, p, _) => {
|
|
2552
|
+
const w = S(n, l);
|
|
2553
|
+
if (w) {
|
|
2554
|
+
const v = S(i, l, J(p) ? S(s, l) : p);
|
|
2555
|
+
J(v) || _ && _.defaultChecked || d ? G(i, l, d ? v : fr(w._f)) : $(l, v), a.mount && !a.action && C();
|
|
2556
|
+
}
|
|
2557
|
+
}, T = (l, d, p, _, w) => {
|
|
2558
|
+
let v = !1, E = !1;
|
|
2559
|
+
const W = {
|
|
2539
2560
|
name: l
|
|
2540
2561
|
};
|
|
2541
2562
|
if (!r.disabled) {
|
|
2542
|
-
if (!
|
|
2543
|
-
(b.isDirty || h.isDirty) && (
|
|
2544
|
-
const
|
|
2545
|
-
|
|
2563
|
+
if (!p || _) {
|
|
2564
|
+
(b.isDirty || h.isDirty) && (E = t.isDirty, t.isDirty = W.isDirty = M(), v = E !== W.isDirty);
|
|
2565
|
+
const z = Se(S(s, l), d);
|
|
2566
|
+
E = !!S(t.dirtyFields, l), z ? Z(t.dirtyFields, l) : G(t.dirtyFields, l, !0), W.dirtyFields = t.dirtyFields, v = v || (b.dirtyFields || h.dirtyFields) && E !== !z;
|
|
2546
2567
|
}
|
|
2547
|
-
if (
|
|
2548
|
-
const
|
|
2549
|
-
|
|
2568
|
+
if (p) {
|
|
2569
|
+
const z = S(t.touchedFields, l);
|
|
2570
|
+
z || (G(t.touchedFields, l, p), W.touchedFields = t.touchedFields, v = v || (b.touchedFields || h.touchedFields) && z !== p);
|
|
2550
2571
|
}
|
|
2551
|
-
v &&
|
|
2552
|
-
}
|
|
2553
|
-
return v ?
|
|
2554
|
-
},
|
|
2555
|
-
const
|
|
2556
|
-
if (r.delayError &&
|
|
2557
|
-
const
|
|
2558
|
-
...
|
|
2559
|
-
...v &&
|
|
2572
|
+
v && w && m.state.next(W);
|
|
2573
|
+
}
|
|
2574
|
+
return v ? W : {};
|
|
2575
|
+
}, R = (l, d, p, _) => {
|
|
2576
|
+
const w = S(t.errors, l), v = (b.isValid || h.isValid) && pe(d) && t.isValid !== d;
|
|
2577
|
+
if (r.delayError && p ? (c = I(() => F(l, p)), c(r.delayError)) : (clearTimeout(f), c = null, p ? G(t.errors, l, p) : Z(t.errors, l)), (p ? !Se(w, p) : w) || !ne(_) || v) {
|
|
2578
|
+
const E = {
|
|
2579
|
+
..._,
|
|
2580
|
+
...v && pe(d) ? { isValid: d } : {},
|
|
2560
2581
|
errors: t.errors,
|
|
2561
2582
|
name: l
|
|
2562
2583
|
};
|
|
2563
2584
|
t = {
|
|
2564
2585
|
...t,
|
|
2565
|
-
...
|
|
2566
|
-
}, m.state.next(
|
|
2567
|
-
}
|
|
2568
|
-
},
|
|
2569
|
-
const { errors: d } = await
|
|
2570
|
-
if (
|
|
2571
|
-
for (const
|
|
2572
|
-
const
|
|
2573
|
-
|
|
2586
|
+
...E
|
|
2587
|
+
}, m.state.next(E);
|
|
2588
|
+
}
|
|
2589
|
+
}, O = async (l) => (x(l, !0), await r.resolver(i, r.context, ua(l || o.mount, n, r.criteriaMode, r.shouldUseNativeValidation))), q = async (l) => {
|
|
2590
|
+
const { errors: d } = await O(l);
|
|
2591
|
+
if (x(l), l)
|
|
2592
|
+
for (const p of l) {
|
|
2593
|
+
const _ = S(d, p);
|
|
2594
|
+
_ ? G(t.errors, p, _) : Z(t.errors, p);
|
|
2574
2595
|
}
|
|
2575
2596
|
else
|
|
2576
2597
|
t.errors = d;
|
|
2577
2598
|
return d;
|
|
2578
|
-
},
|
|
2599
|
+
}, P = async (l, d, p = {
|
|
2579
2600
|
valid: !0
|
|
2580
2601
|
}) => {
|
|
2581
|
-
for (const
|
|
2582
|
-
const
|
|
2583
|
-
if (
|
|
2584
|
-
const { _f: v, ...
|
|
2602
|
+
for (const _ in l) {
|
|
2603
|
+
const w = l[_];
|
|
2604
|
+
if (w) {
|
|
2605
|
+
const { _f: v, ...E } = w;
|
|
2585
2606
|
if (v) {
|
|
2586
|
-
const
|
|
2587
|
-
|
|
2588
|
-
const
|
|
2589
|
-
if (
|
|
2607
|
+
const W = o.array.has(v.name), z = w._f && ca(w._f);
|
|
2608
|
+
z && b.validatingFields && x([v.name], !0);
|
|
2609
|
+
const te = await br(w, o.disabled, i, k, r.shouldUseNativeValidation && !d, W);
|
|
2610
|
+
if (z && b.validatingFields && x([v.name]), te[v.name] && (p.valid = !1, d || e.shouldUseNativeValidation))
|
|
2590
2611
|
break;
|
|
2591
|
-
!d && (
|
|
2612
|
+
!d && (S(te, v.name) ? W ? ya(t.errors, te, v.name) : G(t.errors, v.name, te[v.name]) : Z(t.errors, v.name));
|
|
2592
2613
|
}
|
|
2593
|
-
!
|
|
2614
|
+
!ne(E) && await P(E, d, p);
|
|
2594
2615
|
}
|
|
2595
2616
|
}
|
|
2596
|
-
return
|
|
2597
|
-
},
|
|
2617
|
+
return p.valid;
|
|
2618
|
+
}, H = () => {
|
|
2598
2619
|
for (const l of o.unMount) {
|
|
2599
|
-
const d =
|
|
2600
|
-
d && (d._f.refs ? d._f.refs.every((
|
|
2620
|
+
const d = S(n, l);
|
|
2621
|
+
d && (d._f.refs ? d._f.refs.every((p) => !Et(p)) : !Et(d._f.ref)) && Te(l);
|
|
2601
2622
|
}
|
|
2602
2623
|
o.unMount = /* @__PURE__ */ new Set();
|
|
2603
|
-
},
|
|
2604
|
-
...a.mount ? i :
|
|
2605
|
-
},
|
|
2606
|
-
const
|
|
2607
|
-
let
|
|
2608
|
-
if (
|
|
2609
|
-
const v =
|
|
2610
|
-
v && (!v.disabled &&
|
|
2611
|
-
(!
|
|
2612
|
-
}) : v.refs.forEach((
|
|
2624
|
+
}, M = (l, d) => !r.disabled && (l && d && G(i, l, d), !Se(Je(), s)), A = (l, d, p) => na(l, o, {
|
|
2625
|
+
...a.mount ? i : J(d) ? s : oe(l) ? { [l]: d } : d
|
|
2626
|
+
}, p, d), B = (l) => qt(S(a.mount ? i : s, l, r.shouldUnregister ? S(s, l, []) : [])), $ = (l, d, p = {}) => {
|
|
2627
|
+
const _ = S(n, l);
|
|
2628
|
+
let w = d;
|
|
2629
|
+
if (_) {
|
|
2630
|
+
const v = _._f;
|
|
2631
|
+
v && (!v.disabled && G(i, l, ln(d, v)), w = ft(v.ref) && se(d) ? "" : d, sn(v.ref) ? [...v.ref.options].forEach((E) => E.selected = w.includes(E.value)) : v.refs ? ot(v.ref) ? v.refs.forEach((E) => {
|
|
2632
|
+
(!E.defaultChecked || !E.disabled) && (Array.isArray(w) ? E.checked = !!w.find((W) => W === E.value) : E.checked = w === E.value || !!w);
|
|
2633
|
+
}) : v.refs.forEach((E) => E.checked = E.value === w) : Ut(v.ref) ? v.ref.value = "" : (v.ref.value = w, v.ref.type || m.state.next({
|
|
2613
2634
|
name: l,
|
|
2614
|
-
values:
|
|
2635
|
+
values: Y(i)
|
|
2615
2636
|
})));
|
|
2616
2637
|
}
|
|
2617
|
-
(
|
|
2618
|
-
},
|
|
2619
|
-
for (const
|
|
2620
|
-
if (!d.hasOwnProperty(
|
|
2638
|
+
(p.shouldDirty || p.shouldTouch) && T(l, w, p.shouldTouch, p.shouldDirty, !0), p.shouldValidate && ue(l);
|
|
2639
|
+
}, U = (l, d, p) => {
|
|
2640
|
+
for (const _ in d) {
|
|
2641
|
+
if (!d.hasOwnProperty(_))
|
|
2621
2642
|
return;
|
|
2622
|
-
const
|
|
2623
|
-
(o.array.has(l) ||
|
|
2643
|
+
const w = d[_], v = l + "." + _, E = S(n, v);
|
|
2644
|
+
(o.array.has(l) || X(w) || E && !E._f) && !Le(w) ? U(v, w, p) : $(v, w, p);
|
|
2624
2645
|
}
|
|
2625
|
-
},
|
|
2626
|
-
const
|
|
2627
|
-
|
|
2646
|
+
}, j = (l, d, p = {}) => {
|
|
2647
|
+
const _ = S(n, l), w = o.array.has(l), v = Y(d);
|
|
2648
|
+
G(i, l, v), w ? (m.array.next({
|
|
2628
2649
|
name: l,
|
|
2629
|
-
values:
|
|
2630
|
-
}), (b.isDirty || b.dirtyFields || h.isDirty || h.dirtyFields) &&
|
|
2650
|
+
values: Y(i)
|
|
2651
|
+
}), (b.isDirty || b.dirtyFields || h.isDirty || h.dirtyFields) && p.shouldDirty && m.state.next({
|
|
2631
2652
|
name: l,
|
|
2632
|
-
dirtyFields:
|
|
2633
|
-
isDirty:
|
|
2634
|
-
})) :
|
|
2653
|
+
dirtyFields: Pe(s, i),
|
|
2654
|
+
isDirty: M(l, v)
|
|
2655
|
+
})) : _ && !_._f && !se(v) ? U(l, v, p) : $(l, v, p), mr(l, o) ? m.state.next({
|
|
2635
2656
|
...t,
|
|
2636
2657
|
name: l,
|
|
2637
|
-
values:
|
|
2658
|
+
values: Y(i)
|
|
2638
2659
|
}) : m.state.next({
|
|
2639
2660
|
name: a.mount ? l : void 0,
|
|
2640
|
-
values:
|
|
2661
|
+
values: Y(i)
|
|
2641
2662
|
});
|
|
2642
|
-
},
|
|
2663
|
+
}, D = async (l) => {
|
|
2643
2664
|
a.mount = !0;
|
|
2644
2665
|
const d = l.target;
|
|
2645
|
-
let
|
|
2646
|
-
const
|
|
2647
|
-
|
|
2648
|
-
},
|
|
2649
|
-
if (
|
|
2650
|
-
let
|
|
2651
|
-
const Me = d.type ?
|
|
2652
|
-
|
|
2653
|
-
const
|
|
2666
|
+
let p = d.name, _ = !0;
|
|
2667
|
+
const w = S(n, p), v = (z) => {
|
|
2668
|
+
_ = Number.isNaN(z) || Le(z) && isNaN(z.getTime()) || Se(z, S(i, p, z));
|
|
2669
|
+
}, E = pr(r.mode), W = pr(r.reValidateMode);
|
|
2670
|
+
if (w) {
|
|
2671
|
+
let z, te;
|
|
2672
|
+
const Me = d.type ? fr(w._f) : Zs(l), Ce = l.type === or.BLUR || l.type === or.FOCUS_OUT, dn = !da(w._f) && !r.resolver && !S(t.errors, p) && !w._f.deps || ha(Ce, S(t.touchedFields, p), t.isSubmitted, W, E), wt = mr(p, o, Ce);
|
|
2673
|
+
G(i, p, Me), Ce ? (!d || !d.readOnly) && (w._f.onBlur && w._f.onBlur(l), c && c(0)) : w._f.onChange && w._f.onChange(l);
|
|
2674
|
+
const _t = T(p, Me, Ce), fn = !ne(_t) || wt;
|
|
2654
2675
|
if (!Ce && m.state.next({
|
|
2655
|
-
name:
|
|
2676
|
+
name: p,
|
|
2656
2677
|
type: l.type,
|
|
2657
|
-
values:
|
|
2658
|
-
}),
|
|
2659
|
-
return (b.isValid || h.isValid) && (r.mode === "onBlur" ? Ce && C() : Ce || C()),
|
|
2660
|
-
if (!Ce &&
|
|
2661
|
-
const { errors:
|
|
2662
|
-
if (
|
|
2663
|
-
const
|
|
2664
|
-
|
|
2678
|
+
values: Y(i)
|
|
2679
|
+
}), dn)
|
|
2680
|
+
return (b.isValid || h.isValid) && (r.mode === "onBlur" ? Ce && C() : Ce || C()), fn && m.state.next({ name: p, ...wt ? {} : _t });
|
|
2681
|
+
if (!Ce && wt && m.state.next({ ...t }), r.resolver) {
|
|
2682
|
+
const { errors: Kt } = await O([p]);
|
|
2683
|
+
if (x([p]), v(Me), _) {
|
|
2684
|
+
const pn = yr(t.errors, n, p), Gt = yr(Kt, n, pn.name || p);
|
|
2685
|
+
z = Gt.error, p = Gt.name, te = ne(Kt);
|
|
2665
2686
|
}
|
|
2666
2687
|
} else
|
|
2667
|
-
|
|
2668
|
-
|
|
2688
|
+
x([p], !0), z = (await br(w, o.disabled, i, k, r.shouldUseNativeValidation))[p], x([p]), v(Me), _ && (z ? te = !1 : (b.isValid || h.isValid) && (te = await P(n, !0)));
|
|
2689
|
+
_ && (w._f.deps && (!Array.isArray(w._f.deps) || w._f.deps.length > 0) && ue(w._f.deps), R(p, te, z, _t));
|
|
2669
2690
|
}
|
|
2670
|
-
},
|
|
2671
|
-
if (
|
|
2691
|
+
}, le = (l, d) => {
|
|
2692
|
+
if (S(t.errors, d) && l.focus)
|
|
2672
2693
|
return l.focus(), 1;
|
|
2673
|
-
},
|
|
2674
|
-
let
|
|
2675
|
-
const
|
|
2694
|
+
}, ue = async (l, d = {}) => {
|
|
2695
|
+
let p, _;
|
|
2696
|
+
const w = at(l);
|
|
2676
2697
|
if (r.resolver) {
|
|
2677
|
-
const v = await q(
|
|
2678
|
-
|
|
2698
|
+
const v = await q(J(l) ? l : w);
|
|
2699
|
+
p = ne(v), _ = l ? !w.some((E) => S(v, E)) : p;
|
|
2679
2700
|
} else
|
|
2680
|
-
l ? (
|
|
2681
|
-
const
|
|
2682
|
-
return await
|
|
2683
|
-
}))).every(Boolean), !(!
|
|
2701
|
+
l ? (_ = (await Promise.all(w.map(async (v) => {
|
|
2702
|
+
const E = S(n, v);
|
|
2703
|
+
return await P(E && E._f ? { [v]: E } : E);
|
|
2704
|
+
}))).every(Boolean), !(!_ && !t.isValid) && C()) : _ = p = await P(n);
|
|
2684
2705
|
return m.state.next({
|
|
2685
|
-
...!
|
|
2686
|
-
...r.resolver || !l ? { isValid:
|
|
2706
|
+
...!oe(l) || (b.isValid || h.isValid) && p !== t.isValid ? {} : { name: l },
|
|
2707
|
+
...r.resolver || !l ? { isValid: p } : {},
|
|
2687
2708
|
errors: t.errors
|
|
2688
|
-
}), d.shouldFocus && !
|
|
2689
|
-
},
|
|
2690
|
-
let
|
|
2709
|
+
}), d.shouldFocus && !_ && it(n, le, l ? w : o.mount), _;
|
|
2710
|
+
}, Je = (l, d) => {
|
|
2711
|
+
let p = {
|
|
2691
2712
|
...a.mount ? i : s
|
|
2692
2713
|
};
|
|
2693
|
-
return d && (
|
|
2694
|
-
},
|
|
2695
|
-
invalid: !!
|
|
2696
|
-
isDirty: !!
|
|
2697
|
-
error:
|
|
2698
|
-
isValidating: !!
|
|
2699
|
-
isTouched: !!
|
|
2700
|
-
}),
|
|
2701
|
-
const d = l ?
|
|
2702
|
-
d == null || d.forEach((
|
|
2714
|
+
return d && (p = nn(d.dirtyFields ? t.dirtyFields : t.touchedFields, p)), J(l) ? p : oe(l) ? S(p, l) : l.map((_) => S(p, _));
|
|
2715
|
+
}, _e = (l, d) => ({
|
|
2716
|
+
invalid: !!S((d || t).errors, l),
|
|
2717
|
+
isDirty: !!S((d || t).dirtyFields, l),
|
|
2718
|
+
error: S((d || t).errors, l),
|
|
2719
|
+
isValidating: !!S(t.validatingFields, l),
|
|
2720
|
+
isTouched: !!S((d || t).touchedFields, l)
|
|
2721
|
+
}), lt = (l) => {
|
|
2722
|
+
const d = l ? at(l) : void 0;
|
|
2723
|
+
d == null || d.forEach((p) => Z(t.errors, p)), d ? d.forEach((p) => {
|
|
2703
2724
|
m.state.next({
|
|
2704
|
-
name:
|
|
2725
|
+
name: p,
|
|
2705
2726
|
errors: t.errors
|
|
2706
2727
|
});
|
|
2707
2728
|
}) : m.state.next({
|
|
2708
2729
|
errors: {}
|
|
2709
2730
|
});
|
|
2710
|
-
},
|
|
2711
|
-
const
|
|
2712
|
-
|
|
2713
|
-
...
|
|
2731
|
+
}, Ze = (l, d, p) => {
|
|
2732
|
+
const _ = (S(n, l, { _f: {} })._f || {}).ref, w = S(t.errors, l) || {}, { ref: v, message: E, type: W, ...z } = w;
|
|
2733
|
+
G(t.errors, l, {
|
|
2734
|
+
...z,
|
|
2714
2735
|
...d,
|
|
2715
|
-
ref:
|
|
2736
|
+
ref: _
|
|
2716
2737
|
}), m.state.next({
|
|
2717
2738
|
name: l,
|
|
2718
2739
|
errors: t.errors,
|
|
2719
2740
|
isValid: !1
|
|
2720
|
-
}),
|
|
2721
|
-
},
|
|
2722
|
-
next: (
|
|
2723
|
-
}) :
|
|
2741
|
+
}), p && p.shouldFocus && _ && _.focus && _.focus();
|
|
2742
|
+
}, Xe = (l, d) => ce(l) ? m.state.subscribe({
|
|
2743
|
+
next: (p) => "values" in p && l(A(void 0, d), p)
|
|
2744
|
+
}) : A(l, d, !0), Fe = (l) => m.state.subscribe({
|
|
2724
2745
|
next: (d) => {
|
|
2725
|
-
|
|
2746
|
+
pa(l.name, d.name, l.exact) && fa(d, l.formState || b, ke, l.reRenderRoot) && l.callback({
|
|
2726
2747
|
values: { ...i },
|
|
2727
2748
|
...t,
|
|
2728
2749
|
...d,
|
|
2729
2750
|
defaultValues: s
|
|
2730
2751
|
});
|
|
2731
2752
|
}
|
|
2732
|
-
}).unsubscribe,
|
|
2753
|
+
}).unsubscribe, De = (l) => (a.mount = !0, h = {
|
|
2733
2754
|
...h,
|
|
2734
2755
|
...l.formState
|
|
2735
|
-
},
|
|
2756
|
+
}, Fe({
|
|
2736
2757
|
...l,
|
|
2737
2758
|
formState: {
|
|
2738
2759
|
...g,
|
|
2739
2760
|
...l.formState
|
|
2740
2761
|
}
|
|
2741
|
-
})),
|
|
2742
|
-
for (const
|
|
2743
|
-
o.mount.delete(
|
|
2762
|
+
})), Te = (l, d = {}) => {
|
|
2763
|
+
for (const p of l ? at(l) : o.mount)
|
|
2764
|
+
o.mount.delete(p), o.array.delete(p), d.keepValue || (Z(n, p), Z(i, p)), !d.keepError && Z(t.errors, p), !d.keepDirty && Z(t.dirtyFields, p), !d.keepTouched && Z(t.touchedFields, p), !d.keepIsValidating && Z(t.validatingFields, p), !r.shouldUnregister && !d.keepDefaultValue && Z(s, p);
|
|
2744
2765
|
m.state.next({
|
|
2745
|
-
values:
|
|
2766
|
+
values: Y(i)
|
|
2746
2767
|
}), m.state.next({
|
|
2747
2768
|
...t,
|
|
2748
|
-
...d.keepDirty ? { isDirty:
|
|
2769
|
+
...d.keepDirty ? { isDirty: M() } : {}
|
|
2749
2770
|
}), !d.keepIsValid && C();
|
|
2750
|
-
},
|
|
2751
|
-
if (
|
|
2752
|
-
const
|
|
2753
|
-
l ? o.disabled.add(d) : o.disabled.delete(d),
|
|
2754
|
-
}
|
|
2755
|
-
},
|
|
2756
|
-
let
|
|
2757
|
-
const
|
|
2758
|
-
return
|
|
2759
|
-
...
|
|
2771
|
+
}, Ye = ({ disabled: l, name: d }) => {
|
|
2772
|
+
if (pe(l) && a.mount || l || o.disabled.has(d)) {
|
|
2773
|
+
const w = o.disabled.has(d) !== !!l;
|
|
2774
|
+
l ? o.disabled.add(d) : o.disabled.delete(d), w && a.mount && !a.action && C();
|
|
2775
|
+
}
|
|
2776
|
+
}, Oe = (l, d = {}) => {
|
|
2777
|
+
let p = S(n, l);
|
|
2778
|
+
const _ = pe(d.disabled) || pe(r.disabled);
|
|
2779
|
+
return G(n, l, {
|
|
2780
|
+
...p || {},
|
|
2760
2781
|
_f: {
|
|
2761
|
-
...
|
|
2782
|
+
...p && p._f ? p._f : { ref: { name: l } },
|
|
2762
2783
|
name: l,
|
|
2763
2784
|
mount: !0,
|
|
2764
2785
|
...d
|
|
2765
2786
|
}
|
|
2766
|
-
}), o.mount.add(l),
|
|
2767
|
-
disabled:
|
|
2787
|
+
}), o.mount.add(l), p ? Ye({
|
|
2788
|
+
disabled: pe(d.disabled) ? d.disabled : r.disabled,
|
|
2768
2789
|
name: l
|
|
2769
2790
|
}) : V(l, !0, d.value), {
|
|
2770
|
-
...
|
|
2791
|
+
..._ ? { disabled: d.disabled || r.disabled } : {},
|
|
2771
2792
|
...r.progressive ? {
|
|
2772
2793
|
required: !!d.required,
|
|
2773
|
-
min:
|
|
2774
|
-
max:
|
|
2775
|
-
minLength:
|
|
2776
|
-
maxLength:
|
|
2777
|
-
pattern:
|
|
2794
|
+
min: tt(d.min),
|
|
2795
|
+
max: tt(d.max),
|
|
2796
|
+
minLength: tt(d.minLength),
|
|
2797
|
+
maxLength: tt(d.maxLength),
|
|
2798
|
+
pattern: tt(d.pattern)
|
|
2778
2799
|
} : {},
|
|
2779
2800
|
name: l,
|
|
2780
|
-
onChange:
|
|
2781
|
-
onBlur:
|
|
2782
|
-
ref: (
|
|
2783
|
-
if (
|
|
2784
|
-
|
|
2785
|
-
const v =
|
|
2786
|
-
if (
|
|
2801
|
+
onChange: D,
|
|
2802
|
+
onBlur: D,
|
|
2803
|
+
ref: (w) => {
|
|
2804
|
+
if (w) {
|
|
2805
|
+
Oe(l, d), p = S(n, l);
|
|
2806
|
+
const v = J(w.value) && w.querySelectorAll && w.querySelectorAll("input,select,textarea")[0] || w, E = aa(v), W = p._f.refs || [];
|
|
2807
|
+
if (E ? W.find((z) => z === v) : v === p._f.ref)
|
|
2787
2808
|
return;
|
|
2788
|
-
|
|
2809
|
+
G(n, l, {
|
|
2789
2810
|
_f: {
|
|
2790
|
-
...
|
|
2791
|
-
...
|
|
2811
|
+
...p._f,
|
|
2812
|
+
...E ? {
|
|
2792
2813
|
refs: [
|
|
2793
|
-
|
|
2814
|
+
...W.filter(Et),
|
|
2794
2815
|
v,
|
|
2795
|
-
...Array.isArray(
|
|
2816
|
+
...Array.isArray(S(s, l)) ? [{}] : []
|
|
2796
2817
|
],
|
|
2797
2818
|
ref: { type: v.type, name: l }
|
|
2798
2819
|
} : { ref: v }
|
|
2799
2820
|
}
|
|
2800
2821
|
}), V(l, !1, void 0, v);
|
|
2801
2822
|
} else
|
|
2802
|
-
|
|
2823
|
+
p = S(n, l, {}), p._f && (p._f.mount = !1), (r.shouldUnregister || d.shouldUnregister) && !(Ys(o.array, l) && a.action) && o.unMount.add(l);
|
|
2803
2824
|
}
|
|
2804
2825
|
};
|
|
2805
|
-
},
|
|
2806
|
-
|
|
2807
|
-
const
|
|
2808
|
-
|
|
2809
|
-
|
|
2826
|
+
}, Be = () => r.shouldFocusError && it(n, le, o.mount), ut = (l) => {
|
|
2827
|
+
pe(l) && (m.state.next({ disabled: l }), it(n, (d, p) => {
|
|
2828
|
+
const _ = S(n, p);
|
|
2829
|
+
_ && (d.disabled = _._f.disabled || l, Array.isArray(_._f.refs) && _._f.refs.forEach((w) => {
|
|
2830
|
+
w.disabled = _._f.disabled || l;
|
|
2810
2831
|
}));
|
|
2811
2832
|
}, 0, !1));
|
|
2812
|
-
},
|
|
2813
|
-
let
|
|
2814
|
-
|
|
2815
|
-
let
|
|
2833
|
+
}, Qe = (l, d) => async (p) => {
|
|
2834
|
+
let _;
|
|
2835
|
+
p && (p.preventDefault && p.preventDefault(), p.persist && p.persist());
|
|
2836
|
+
let w = Y(i);
|
|
2816
2837
|
if (m.state.next({
|
|
2817
2838
|
isSubmitting: !0
|
|
2818
2839
|
}), r.resolver) {
|
|
2819
|
-
const { errors: v, values:
|
|
2820
|
-
|
|
2840
|
+
const { errors: v, values: E } = await O();
|
|
2841
|
+
x(), t.errors = v, w = Y(E);
|
|
2821
2842
|
} else
|
|
2822
|
-
await
|
|
2843
|
+
await P(n);
|
|
2823
2844
|
if (o.disabled.size)
|
|
2824
2845
|
for (const v of o.disabled)
|
|
2825
|
-
|
|
2826
|
-
if (
|
|
2846
|
+
Z(w, v);
|
|
2847
|
+
if (Z(t.errors, "root"), ne(t.errors)) {
|
|
2827
2848
|
m.state.next({
|
|
2828
2849
|
errors: {}
|
|
2829
2850
|
});
|
|
2830
2851
|
try {
|
|
2831
|
-
await l(
|
|
2852
|
+
await l(w, p);
|
|
2832
2853
|
} catch (v) {
|
|
2833
|
-
|
|
2854
|
+
_ = v;
|
|
2834
2855
|
}
|
|
2835
2856
|
} else
|
|
2836
|
-
d && await d({ ...t.errors },
|
|
2857
|
+
d && await d({ ...t.errors }, p), Be(), setTimeout(Be);
|
|
2837
2858
|
if (m.state.next({
|
|
2838
2859
|
isSubmitted: !0,
|
|
2839
2860
|
isSubmitting: !1,
|
|
2840
|
-
isSubmitSuccessful:
|
|
2861
|
+
isSubmitSuccessful: ne(t.errors) && !_,
|
|
2841
2862
|
submitCount: t.submitCount + 1,
|
|
2842
2863
|
errors: t.errors
|
|
2843
|
-
}),
|
|
2844
|
-
throw
|
|
2845
|
-
},
|
|
2846
|
-
|
|
2847
|
-
},
|
|
2848
|
-
const
|
|
2849
|
-
if (d.keepDefaultValues || (s =
|
|
2864
|
+
}), _)
|
|
2865
|
+
throw _;
|
|
2866
|
+
}, ct = (l, d = {}) => {
|
|
2867
|
+
S(n, l) && (J(d.defaultValue) ? j(l, Y(S(s, l))) : (j(l, d.defaultValue), G(s, l, Y(d.defaultValue))), d.keepTouched || Z(t.touchedFields, l), d.keepDirty || (Z(t.dirtyFields, l), t.isDirty = d.defaultValue ? M(l, Y(S(s, l))) : M()), d.keepError || (Z(t.errors, l), b.isValid && C()), m.state.next({ ...t }));
|
|
2868
|
+
}, L = (l, d = {}) => {
|
|
2869
|
+
const p = l ? Y(l) : s, _ = Y(p), w = ne(l), v = w ? s : _;
|
|
2870
|
+
if (d.keepDefaultValues || (s = p), !d.keepValues) {
|
|
2850
2871
|
if (d.keepDirtyValues) {
|
|
2851
|
-
const
|
|
2872
|
+
const E = /* @__PURE__ */ new Set([
|
|
2852
2873
|
...o.mount,
|
|
2853
|
-
...Object.keys(
|
|
2874
|
+
...Object.keys(Pe(s, i))
|
|
2854
2875
|
]);
|
|
2855
|
-
for (const
|
|
2856
|
-
const
|
|
2857
|
-
|
|
2876
|
+
for (const W of Array.from(E)) {
|
|
2877
|
+
const z = S(t.dirtyFields, W), te = S(i, W), Me = S(v, W);
|
|
2878
|
+
z && !J(te) ? G(v, W, te) : !z && !J(Me) && j(W, Me);
|
|
2858
2879
|
}
|
|
2859
2880
|
} else {
|
|
2860
|
-
if (
|
|
2861
|
-
for (const
|
|
2862
|
-
const
|
|
2863
|
-
if (
|
|
2864
|
-
const
|
|
2865
|
-
if (
|
|
2866
|
-
const
|
|
2867
|
-
if (
|
|
2868
|
-
|
|
2881
|
+
if (Pt && J(l))
|
|
2882
|
+
for (const E of o.mount) {
|
|
2883
|
+
const W = S(n, E);
|
|
2884
|
+
if (W && W._f) {
|
|
2885
|
+
const z = Array.isArray(W._f.refs) ? W._f.refs[0] : W._f.ref;
|
|
2886
|
+
if (ft(z)) {
|
|
2887
|
+
const te = z.closest("form");
|
|
2888
|
+
if (te) {
|
|
2889
|
+
te.reset();
|
|
2869
2890
|
break;
|
|
2870
2891
|
}
|
|
2871
2892
|
}
|
|
2872
2893
|
}
|
|
2873
2894
|
}
|
|
2874
2895
|
if (d.keepFieldsRef)
|
|
2875
|
-
for (const
|
|
2876
|
-
|
|
2896
|
+
for (const E of o.mount)
|
|
2897
|
+
j(E, S(v, E));
|
|
2877
2898
|
else
|
|
2878
2899
|
n = {};
|
|
2879
2900
|
}
|
|
2880
|
-
i = r.shouldUnregister ? d.keepDefaultValues ?
|
|
2901
|
+
i = r.shouldUnregister ? d.keepDefaultValues ? Y(s) : {} : Y(v), m.array.next({
|
|
2881
2902
|
values: { ...v }
|
|
2882
2903
|
}), m.state.next({
|
|
2883
2904
|
values: { ...v }
|
|
@@ -2891,56 +2912,56 @@ function pa(e = {}) {
|
|
|
2891
2912
|
watch: /* @__PURE__ */ new Set(),
|
|
2892
2913
|
watchAll: !1,
|
|
2893
2914
|
focus: ""
|
|
2894
|
-
}, a.mount = !b.isValid || !!d.keepIsValid || !!d.keepDirtyValues || !r.shouldUnregister && !
|
|
2915
|
+
}, a.mount = !b.isValid || !!d.keepIsValid || !!d.keepDirtyValues || !r.shouldUnregister && !ne(v), a.watch = !!r.shouldUnregister, a.keepIsValid = !!d.keepIsValid, a.action = !1, d.keepErrors || (t.errors = {}), m.state.next({
|
|
2895
2916
|
submitCount: d.keepSubmitCount ? t.submitCount : 0,
|
|
2896
|
-
isDirty:
|
|
2917
|
+
isDirty: w ? !1 : d.keepDirty ? t.isDirty : !!(d.keepDefaultValues && !Se(l, s)),
|
|
2897
2918
|
isSubmitted: d.keepIsSubmitted ? t.isSubmitted : !1,
|
|
2898
|
-
dirtyFields:
|
|
2919
|
+
dirtyFields: w ? {} : d.keepDirtyValues ? d.keepDefaultValues && i ? Pe(s, i) : t.dirtyFields : d.keepDefaultValues && l ? Pe(s, l) : d.keepDirty ? t.dirtyFields : {},
|
|
2899
2920
|
touchedFields: d.keepTouched ? t.touchedFields : {},
|
|
2900
2921
|
errors: d.keepErrors ? t.errors : {},
|
|
2901
2922
|
isSubmitSuccessful: d.keepIsSubmitSuccessful ? t.isSubmitSuccessful : !1,
|
|
2902
2923
|
isSubmitting: !1,
|
|
2903
2924
|
defaultValues: s
|
|
2904
2925
|
});
|
|
2905
|
-
},
|
|
2906
|
-
const
|
|
2907
|
-
if (
|
|
2908
|
-
const
|
|
2909
|
-
|
|
2910
|
-
|
|
2926
|
+
}, Ve = (l, d) => L(ce(l) ? l(i) : l, { ...r.resetOptions, ...d }), et = (l, d = {}) => {
|
|
2927
|
+
const p = S(n, l), _ = p && p._f;
|
|
2928
|
+
if (_) {
|
|
2929
|
+
const w = _.refs ? _.refs[0] : _.ref;
|
|
2930
|
+
w.focus && setTimeout(() => {
|
|
2931
|
+
w.focus(), d.shouldSelect && ce(w.select) && w.select();
|
|
2911
2932
|
});
|
|
2912
2933
|
}
|
|
2913
|
-
},
|
|
2934
|
+
}, ke = (l) => {
|
|
2914
2935
|
t = {
|
|
2915
2936
|
...t,
|
|
2916
2937
|
...l
|
|
2917
2938
|
};
|
|
2918
|
-
},
|
|
2939
|
+
}, zt = {
|
|
2919
2940
|
control: {
|
|
2920
|
-
register:
|
|
2921
|
-
unregister:
|
|
2922
|
-
getFieldState:
|
|
2923
|
-
handleSubmit:
|
|
2924
|
-
setError:
|
|
2925
|
-
_subscribe:
|
|
2926
|
-
_runSchema:
|
|
2927
|
-
_updateIsValidating:
|
|
2928
|
-
_focusError:
|
|
2929
|
-
_getWatch:
|
|
2930
|
-
_getDirty:
|
|
2941
|
+
register: Oe,
|
|
2942
|
+
unregister: Te,
|
|
2943
|
+
getFieldState: _e,
|
|
2944
|
+
handleSubmit: Qe,
|
|
2945
|
+
setError: Ze,
|
|
2946
|
+
_subscribe: Fe,
|
|
2947
|
+
_runSchema: O,
|
|
2948
|
+
_updateIsValidating: x,
|
|
2949
|
+
_focusError: Be,
|
|
2950
|
+
_getWatch: A,
|
|
2951
|
+
_getDirty: M,
|
|
2931
2952
|
_setValid: C,
|
|
2932
2953
|
_setFieldArray: y,
|
|
2933
|
-
_setDisabledField:
|
|
2934
|
-
_setErrors:
|
|
2935
|
-
_getFieldArray:
|
|
2936
|
-
_reset:
|
|
2937
|
-
_resetDefaultValues: () =>
|
|
2938
|
-
|
|
2954
|
+
_setDisabledField: Ye,
|
|
2955
|
+
_setErrors: N,
|
|
2956
|
+
_getFieldArray: B,
|
|
2957
|
+
_reset: L,
|
|
2958
|
+
_resetDefaultValues: () => ce(r.defaultValues) && r.defaultValues().then((l) => {
|
|
2959
|
+
Ve(l, r.resetOptions), m.state.next({
|
|
2939
2960
|
isLoading: !1
|
|
2940
2961
|
});
|
|
2941
2962
|
}),
|
|
2942
|
-
_removeUnmounted:
|
|
2943
|
-
_disableForm:
|
|
2963
|
+
_removeUnmounted: H,
|
|
2964
|
+
_disableForm: ut,
|
|
2944
2965
|
_subjects: m,
|
|
2945
2966
|
_proxyFormState: b,
|
|
2946
2967
|
get _fields() {
|
|
@@ -2977,31 +2998,31 @@ function pa(e = {}) {
|
|
|
2977
2998
|
};
|
|
2978
2999
|
}
|
|
2979
3000
|
},
|
|
2980
|
-
subscribe:
|
|
2981
|
-
trigger:
|
|
2982
|
-
register:
|
|
2983
|
-
handleSubmit:
|
|
2984
|
-
watch:
|
|
2985
|
-
setValue:
|
|
2986
|
-
getValues:
|
|
2987
|
-
reset:
|
|
2988
|
-
resetField:
|
|
2989
|
-
clearErrors:
|
|
2990
|
-
unregister:
|
|
2991
|
-
setError:
|
|
2992
|
-
setFocus:
|
|
2993
|
-
getFieldState:
|
|
3001
|
+
subscribe: De,
|
|
3002
|
+
trigger: ue,
|
|
3003
|
+
register: Oe,
|
|
3004
|
+
handleSubmit: Qe,
|
|
3005
|
+
watch: Xe,
|
|
3006
|
+
setValue: j,
|
|
3007
|
+
getValues: Je,
|
|
3008
|
+
reset: Ve,
|
|
3009
|
+
resetField: ct,
|
|
3010
|
+
clearErrors: lt,
|
|
3011
|
+
unregister: Te,
|
|
3012
|
+
setError: Ze,
|
|
3013
|
+
setFocus: et,
|
|
3014
|
+
getFieldState: _e
|
|
2994
3015
|
};
|
|
2995
3016
|
return {
|
|
2996
|
-
...
|
|
2997
|
-
formControl:
|
|
3017
|
+
...zt,
|
|
3018
|
+
formControl: zt
|
|
2998
3019
|
};
|
|
2999
3020
|
}
|
|
3000
|
-
function
|
|
3001
|
-
const r =
|
|
3021
|
+
function vt(e = {}) {
|
|
3022
|
+
const r = re.useRef(void 0), t = re.useRef(void 0), [n, s] = re.useState({
|
|
3002
3023
|
isDirty: !1,
|
|
3003
3024
|
isValidating: !1,
|
|
3004
|
-
isLoading:
|
|
3025
|
+
isLoading: ce(e.defaultValues),
|
|
3005
3026
|
isSubmitted: !1,
|
|
3006
3027
|
isSubmitting: !1,
|
|
3007
3028
|
isSubmitSuccessful: !1,
|
|
@@ -3013,23 +3034,23 @@ function pt(e = {}) {
|
|
|
3013
3034
|
errors: e.errors || {},
|
|
3014
3035
|
disabled: e.disabled || !1,
|
|
3015
3036
|
isReady: !1,
|
|
3016
|
-
defaultValues:
|
|
3037
|
+
defaultValues: ce(e.defaultValues) ? void 0 : e.defaultValues
|
|
3017
3038
|
});
|
|
3018
3039
|
if (!r.current)
|
|
3019
3040
|
if (e.formControl)
|
|
3020
3041
|
r.current = {
|
|
3021
3042
|
...e.formControl,
|
|
3022
3043
|
formState: n
|
|
3023
|
-
}, e.defaultValues && !
|
|
3044
|
+
}, e.defaultValues && !ce(e.defaultValues) && e.formControl.reset(e.defaultValues, e.resetOptions);
|
|
3024
3045
|
else {
|
|
3025
|
-
const { formControl: a, ...o } =
|
|
3046
|
+
const { formControl: a, ...o } = ba(e);
|
|
3026
3047
|
r.current = {
|
|
3027
3048
|
...o,
|
|
3028
3049
|
formState: n
|
|
3029
3050
|
};
|
|
3030
3051
|
}
|
|
3031
3052
|
const i = r.current.control;
|
|
3032
|
-
return i._options = e,
|
|
3053
|
+
return i._options = e, ra(() => {
|
|
3033
3054
|
const a = i._subscribe({
|
|
3034
3055
|
formState: i._proxyFormState,
|
|
3035
3056
|
callback: () => s({ ...i._formState }),
|
|
@@ -3039,69 +3060,69 @@ function pt(e = {}) {
|
|
|
3039
3060
|
...o,
|
|
3040
3061
|
isReady: !0
|
|
3041
3062
|
})), i._formState.isReady = !0, a;
|
|
3042
|
-
}, [i]),
|
|
3063
|
+
}, [i]), re.useEffect(() => i._disableForm(e.disabled), [i, e.disabled]), re.useEffect(() => {
|
|
3043
3064
|
e.mode && (i._options.mode = e.mode), e.reValidateMode && (i._options.reValidateMode = e.reValidateMode);
|
|
3044
|
-
}, [i, e.mode, e.reValidateMode]),
|
|
3065
|
+
}, [i, e.mode, e.reValidateMode]), re.useEffect(() => {
|
|
3045
3066
|
e.errors && (i._setErrors(e.errors), i._focusError());
|
|
3046
|
-
}, [i, e.errors]),
|
|
3067
|
+
}, [i, e.errors]), re.useEffect(() => {
|
|
3047
3068
|
e.shouldUnregister && i._subjects.state.next({
|
|
3048
3069
|
values: i._getWatch()
|
|
3049
3070
|
});
|
|
3050
|
-
}, [i, e.shouldUnregister]),
|
|
3071
|
+
}, [i, e.shouldUnregister]), re.useEffect(() => {
|
|
3051
3072
|
if (i._proxyFormState.isDirty) {
|
|
3052
3073
|
const a = i._getDirty();
|
|
3053
3074
|
a !== n.isDirty && i._subjects.state.next({
|
|
3054
3075
|
isDirty: a
|
|
3055
3076
|
});
|
|
3056
3077
|
}
|
|
3057
|
-
}, [i, n.isDirty]),
|
|
3078
|
+
}, [i, n.isDirty]), re.useEffect(() => {
|
|
3058
3079
|
var a;
|
|
3059
3080
|
e.values && !Se(e.values, t.current) ? (i._reset(e.values, {
|
|
3060
3081
|
keepFieldsRef: !0,
|
|
3061
3082
|
...i._options.resetOptions
|
|
3062
3083
|
}), !((a = i._options.resetOptions) === null || a === void 0) && a.keepIsValid || i._setValid(), t.current = e.values, s((o) => ({ ...o }))) : i._resetDefaultValues();
|
|
3063
|
-
}, [i, e.values]),
|
|
3084
|
+
}, [i, e.values]), re.useEffect(() => {
|
|
3064
3085
|
i._state.mount || (i._setValid(), i._state.mount = !0), i._state.watch && (i._state.watch = !1, i._subjects.state.next({ ...i._formState })), i._removeUnmounted();
|
|
3065
|
-
}), r.current.formState =
|
|
3086
|
+
}), r.current.formState = re.useMemo(() => ta(n, i), [i, n]), r.current;
|
|
3066
3087
|
}
|
|
3067
|
-
const
|
|
3088
|
+
const vr = (e, r, t) => {
|
|
3068
3089
|
if (e && "reportValidity" in e) {
|
|
3069
|
-
const n =
|
|
3090
|
+
const n = S(t, r);
|
|
3070
3091
|
e.setCustomValidity(n && n.message || ""), e.reportValidity();
|
|
3071
3092
|
}
|
|
3072
|
-
},
|
|
3093
|
+
}, va = (e, r) => {
|
|
3073
3094
|
for (const t in r.fields) {
|
|
3074
3095
|
const n = r.fields[t];
|
|
3075
|
-
n && n.ref && "reportValidity" in n.ref ?
|
|
3096
|
+
n && n.ref && "reportValidity" in n.ref ? vr(n.ref, t, e) : n.refs && n.refs.forEach((s) => vr(s, t, e));
|
|
3076
3097
|
}
|
|
3077
|
-
},
|
|
3078
|
-
r.shouldUseNativeValidation &&
|
|
3098
|
+
}, xa = (e, r) => {
|
|
3099
|
+
r.shouldUseNativeValidation && va(e, r);
|
|
3079
3100
|
const t = {};
|
|
3080
3101
|
for (const n in e) {
|
|
3081
|
-
const s =
|
|
3082
|
-
if (
|
|
3083
|
-
const a = Object.assign({},
|
|
3084
|
-
|
|
3102
|
+
const s = S(r.fields, n), i = Object.assign(e[n] || {}, { ref: s && s.ref });
|
|
3103
|
+
if (wa(r.names || Object.keys(e), n)) {
|
|
3104
|
+
const a = Object.assign({}, S(t, n));
|
|
3105
|
+
G(a, "root", i), G(t, n, a);
|
|
3085
3106
|
} else
|
|
3086
|
-
|
|
3107
|
+
G(t, n, i);
|
|
3087
3108
|
}
|
|
3088
3109
|
return t;
|
|
3089
|
-
},
|
|
3090
|
-
var
|
|
3110
|
+
}, wa = (e, r) => e.some((t) => t.startsWith(r + "."));
|
|
3111
|
+
var xt = function(e, r, t) {
|
|
3091
3112
|
return t === void 0 && (t = {}), function(n, s, i) {
|
|
3092
3113
|
try {
|
|
3093
3114
|
var a = !i.shouldUseNativeValidation && i.criteriaMode === "all";
|
|
3094
|
-
return Promise.resolve(/* @__PURE__ */
|
|
3115
|
+
return Promise.resolve(/* @__PURE__ */ Ls(e, n, Object.assign({}, r, { abortPipeEarly: !a }))).then(function(o) {
|
|
3095
3116
|
if (o.issues) {
|
|
3096
3117
|
for (var c = {}; o.issues.length; ) {
|
|
3097
|
-
var
|
|
3098
|
-
if (g && (c[g] || (c[g] = { message:
|
|
3099
|
-
var b = c[g].types, h = b && b[
|
|
3100
|
-
c[g] =
|
|
3118
|
+
var f = o.issues[0], g = /* @__PURE__ */ Ss(f);
|
|
3119
|
+
if (g && (c[g] || (c[g] = { message: f.message, type: f.type }), a)) {
|
|
3120
|
+
var b = c[g].types, h = b && b[f.type];
|
|
3121
|
+
c[g] = rn(g, a, c, f.type, h ? [].concat(h, f.message) : f.message);
|
|
3101
3122
|
}
|
|
3102
3123
|
o.issues.shift();
|
|
3103
3124
|
}
|
|
3104
|
-
return { values: {}, errors:
|
|
3125
|
+
return { values: {}, errors: xa(c, i) };
|
|
3105
3126
|
}
|
|
3106
3127
|
return { values: t.raw ? n : o.output, errors: {} };
|
|
3107
3128
|
});
|
|
@@ -3110,19 +3131,19 @@ var mt = function(e, r, t) {
|
|
|
3110
3131
|
}
|
|
3111
3132
|
};
|
|
3112
3133
|
};
|
|
3113
|
-
const
|
|
3134
|
+
const xr = 27, wr = 12, _r = 10, _a = Ge("enum"), ka = (e, r) => {
|
|
3114
3135
|
const t = {
|
|
3115
3136
|
min: e.minSelected ?? 0,
|
|
3116
3137
|
max: e.maxSelected ?? e.options.length
|
|
3117
3138
|
};
|
|
3118
|
-
return
|
|
3119
|
-
checked: /* @__PURE__ */ Ie(/* @__PURE__ */
|
|
3139
|
+
return xt(/* @__PURE__ */ xe({
|
|
3140
|
+
checked: /* @__PURE__ */ Ie(/* @__PURE__ */ Zr(/* @__PURE__ */ ae(), /* @__PURE__ */ Gr()), /* @__PURE__ */ Ot((n) => Object.entries(n).filter(([s, i]) => i).map(([s, i]) => s)), /* @__PURE__ */ st(t.max, r("validation_multiple_choice_max", {
|
|
3120
3141
|
count: t.max
|
|
3121
|
-
})), /* @__PURE__ */
|
|
3142
|
+
})), /* @__PURE__ */ Ue(t.min, r("validation_multiple_choice_min", {
|
|
3122
3143
|
count: t.min
|
|
3123
3144
|
})))
|
|
3124
3145
|
}));
|
|
3125
|
-
},
|
|
3146
|
+
}, Ca = Rr(({
|
|
3126
3147
|
option: e,
|
|
3127
3148
|
...r
|
|
3128
3149
|
}, t) => u(we, {
|
|
@@ -3136,47 +3157,47 @@ const mr = 27, yr = 12, gr = 10, ba = Ue("enum"), va = (e, r) => {
|
|
|
3136
3157
|
htmlFor: r.id,
|
|
3137
3158
|
children: e.label
|
|
3138
3159
|
})]
|
|
3139
|
-
})),
|
|
3160
|
+
})), kr = mt("gutter-stable flex w-full flex-1 flex-wrap gap-2 overflow-y-auto rounded-xl p-2.5 pr-4", {
|
|
3140
3161
|
variants: {
|
|
3141
3162
|
variant: {
|
|
3142
3163
|
// In cases where there is only one option, we want to center it
|
|
3143
3164
|
singleOption: "justify-center",
|
|
3144
3165
|
// Two choices with exactly 1 min 1 max
|
|
3145
|
-
booleanLike:
|
|
3166
|
+
booleanLike: Yr
|
|
3146
3167
|
}
|
|
3147
3168
|
}
|
|
3148
|
-
}),
|
|
3169
|
+
}), Sa = ({
|
|
3149
3170
|
input: e,
|
|
3150
3171
|
onSubmitSuccess: r
|
|
3151
3172
|
}) => {
|
|
3152
3173
|
var g, b;
|
|
3153
|
-
const t = e.key ? (g =
|
|
3174
|
+
const t = e.key ? (g = K.current$.value.flow) == null ? void 0 : g.data.submissions[e.key] : void 0, n = (e.config.minSelected === 1 || e.config.minSelected === void 0) && e.config.maxSelected === 1, s = n && e.config.options.length === 2, {
|
|
3154
3175
|
t: i
|
|
3155
|
-
} =
|
|
3176
|
+
} = ee(), {
|
|
3156
3177
|
register: a,
|
|
3157
3178
|
handleSubmit: o,
|
|
3158
3179
|
formState: {
|
|
3159
3180
|
errors: c
|
|
3160
3181
|
}
|
|
3161
|
-
} =
|
|
3182
|
+
} = vt({
|
|
3162
3183
|
defaultValues: {
|
|
3163
|
-
checked: n ? {} :
|
|
3184
|
+
checked: n ? {} : _a(t) ? Object.fromEntries(t.value.map((h) => [h, !0])) : {}
|
|
3164
3185
|
},
|
|
3165
|
-
resolver:
|
|
3166
|
-
}),
|
|
3186
|
+
resolver: ka(e.config, i)
|
|
3187
|
+
}), f = jt();
|
|
3167
3188
|
return s ? u("ul", {
|
|
3168
3189
|
style: {
|
|
3169
|
-
maxHeight: 6.5 *
|
|
3190
|
+
maxHeight: 6.5 * xr + 5 * wr + 2 * _r
|
|
3170
3191
|
},
|
|
3171
|
-
class:
|
|
3192
|
+
class: kr({
|
|
3172
3193
|
variant: "booleanLike"
|
|
3173
3194
|
}),
|
|
3174
3195
|
children: e.config.options.map((h, m) => u("li", {
|
|
3175
|
-
class:
|
|
3176
|
-
children: u(
|
|
3196
|
+
class: Qr,
|
|
3197
|
+
children: u(en, {
|
|
3177
3198
|
type: "submit",
|
|
3178
|
-
ref: (
|
|
3179
|
-
|
|
3199
|
+
ref: (k) => {
|
|
3200
|
+
k && m === 0 && (f.current = k);
|
|
3180
3201
|
},
|
|
3181
3202
|
label: h.label,
|
|
3182
3203
|
value: "true",
|
|
@@ -3189,35 +3210,35 @@ const mr = 27, yr = 12, gr = 10, ba = Ue("enum"), va = (e, r) => {
|
|
|
3189
3210
|
}) : u("form", {
|
|
3190
3211
|
noValidate: !0,
|
|
3191
3212
|
onSubmit: (h) => o((m) => {
|
|
3192
|
-
const
|
|
3213
|
+
const k = m.checked;
|
|
3193
3214
|
r({
|
|
3194
3215
|
type: "enum",
|
|
3195
|
-
value:
|
|
3216
|
+
value: k
|
|
3196
3217
|
});
|
|
3197
3218
|
})(h),
|
|
3198
3219
|
children: [u("div", {
|
|
3199
3220
|
class: "flex items-center gap-1",
|
|
3200
3221
|
children: [u("ul", {
|
|
3201
3222
|
style: {
|
|
3202
|
-
maxHeight: 6.5 *
|
|
3223
|
+
maxHeight: 6.5 * xr + 5 * wr + 2 * _r
|
|
3203
3224
|
},
|
|
3204
|
-
class:
|
|
3225
|
+
class: kr({
|
|
3205
3226
|
variant: e.config.options.length === 1 ? "singleOption" : void 0
|
|
3206
3227
|
}),
|
|
3207
3228
|
children: e.config.options.map((h, m) => {
|
|
3208
|
-
const
|
|
3209
|
-
ref:
|
|
3229
|
+
const k = `checked.${h.value}`, {
|
|
3230
|
+
ref: I,
|
|
3210
3231
|
...C
|
|
3211
|
-
} = a(
|
|
3232
|
+
} = a(k);
|
|
3212
3233
|
return u("li", {
|
|
3213
3234
|
class: "relative",
|
|
3214
|
-
children: u(
|
|
3235
|
+
children: u(Ca, {
|
|
3215
3236
|
option: h,
|
|
3216
3237
|
autoFocus: m === 0,
|
|
3217
|
-
ref: (
|
|
3218
|
-
|
|
3238
|
+
ref: (x) => {
|
|
3239
|
+
x && m === 0 && (f.current = x), I(x);
|
|
3219
3240
|
},
|
|
3220
|
-
id:
|
|
3241
|
+
id: k,
|
|
3221
3242
|
...C,
|
|
3222
3243
|
onClick: n ? () => r({
|
|
3223
3244
|
type: "enum",
|
|
@@ -3239,47 +3260,47 @@ const mr = 27, yr = 12, gr = 10, ba = Ue("enum"), va = (e, r) => {
|
|
|
3239
3260
|
})]
|
|
3240
3261
|
}), u("div", {
|
|
3241
3262
|
class: "px-1",
|
|
3242
|
-
children: u(
|
|
3263
|
+
children: u(He, {
|
|
3243
3264
|
error: (b = c.checked) == null ? void 0 : b.root
|
|
3244
3265
|
})
|
|
3245
3266
|
})]
|
|
3246
3267
|
});
|
|
3247
|
-
},
|
|
3268
|
+
}, Ia = Ge("number"), Aa = (e, r) => {
|
|
3248
3269
|
const t = e.min ?? Number.MIN_SAFE_INTEGER, n = e.max ?? Number.MAX_SAFE_INTEGER, s = e.decimalCases ?? 0;
|
|
3249
|
-
return
|
|
3250
|
-
number: /* @__PURE__ */ Ie(/* @__PURE__ */
|
|
3270
|
+
return xt(/* @__PURE__ */ xe({
|
|
3271
|
+
number: /* @__PURE__ */ Ie(/* @__PURE__ */ Hr(r("validation_number")), /* @__PURE__ */ Ur(t, r("validation_number_min", {
|
|
3251
3272
|
min: t
|
|
3252
|
-
})), /* @__PURE__ */
|
|
3273
|
+
})), /* @__PURE__ */ $r(n, r("validation_number_max", {
|
|
3253
3274
|
max: n
|
|
3254
|
-
})), /* @__PURE__ */
|
|
3275
|
+
})), /* @__PURE__ */ Pr((i) => i === Number(i.toFixed(s)), r("validation_number_decimal_cases", {
|
|
3255
3276
|
count: s
|
|
3256
3277
|
})))
|
|
3257
3278
|
}));
|
|
3258
|
-
},
|
|
3279
|
+
}, Ea = ({
|
|
3259
3280
|
input: e,
|
|
3260
3281
|
onSubmitSuccess: r
|
|
3261
3282
|
}) => {
|
|
3262
3283
|
var b;
|
|
3263
|
-
const t = e.config.defaultValue, n = e.key ? (b =
|
|
3284
|
+
const t = e.config.defaultValue, n = e.key ? (b = K.current$.value.flow) == null ? void 0 : b.data.submissions[e.key] : void 0, {
|
|
3264
3285
|
t: s
|
|
3265
|
-
} =
|
|
3286
|
+
} = ee(), {
|
|
3266
3287
|
register: i,
|
|
3267
3288
|
handleSubmit: a,
|
|
3268
3289
|
formState: {
|
|
3269
3290
|
errors: o
|
|
3270
3291
|
}
|
|
3271
|
-
} =
|
|
3292
|
+
} = vt({
|
|
3272
3293
|
defaultValues: {
|
|
3273
|
-
number:
|
|
3294
|
+
number: Ia(n) ? n.value : t ? Number(t) : void 0
|
|
3274
3295
|
},
|
|
3275
|
-
resolver:
|
|
3296
|
+
resolver: Aa(e.config, s)
|
|
3276
3297
|
}), {
|
|
3277
3298
|
ref: c,
|
|
3278
|
-
...
|
|
3299
|
+
...f
|
|
3279
3300
|
} = i("number", {
|
|
3280
3301
|
required: !e.config.optional,
|
|
3281
3302
|
valueAsNumber: !0
|
|
3282
|
-
}), g =
|
|
3303
|
+
}), g = he();
|
|
3283
3304
|
return Ae(() => {
|
|
3284
3305
|
g.current && (g.current.focus(), g.current.select());
|
|
3285
3306
|
}, []), u("form", {
|
|
@@ -3295,7 +3316,7 @@ const mr = 27, yr = 12, gr = 10, ba = Ue("enum"), va = (e, r) => {
|
|
|
3295
3316
|
children: [u("div", {
|
|
3296
3317
|
class: "relative min-w-0 flex-grow",
|
|
3297
3318
|
children: [u("input", {
|
|
3298
|
-
...
|
|
3319
|
+
...f,
|
|
3299
3320
|
id: "chat-input",
|
|
3300
3321
|
autocomplete: "off",
|
|
3301
3322
|
autoCapitalize: "off",
|
|
@@ -3307,7 +3328,7 @@ const mr = 27, yr = 12, gr = 10, ba = Ue("enum"), va = (e, r) => {
|
|
|
3307
3328
|
type: "text",
|
|
3308
3329
|
min: e.config.min,
|
|
3309
3330
|
max: e.config.max,
|
|
3310
|
-
class:
|
|
3331
|
+
class: ze({
|
|
3311
3332
|
optional: e.config.optional,
|
|
3312
3333
|
className: "[type=number:-webkit-inner-spin-button] w-full rounded-full [-webkit-outer-spin-button:none]"
|
|
3313
3334
|
}),
|
|
@@ -3317,17 +3338,17 @@ const mr = 27, yr = 12, gr = 10, ba = Ue("enum"), va = (e, r) => {
|
|
|
3317
3338
|
onClick: () => r(null)
|
|
3318
3339
|
})]
|
|
3319
3340
|
}), u(Re, {})]
|
|
3320
|
-
}), u(
|
|
3341
|
+
}), u(He, {
|
|
3321
3342
|
error: o.number
|
|
3322
3343
|
})]
|
|
3323
3344
|
});
|
|
3324
|
-
},
|
|
3345
|
+
}, Fa = (e) => {
|
|
3325
3346
|
if (e === "")
|
|
3326
3347
|
return {
|
|
3327
3348
|
countryCode: "",
|
|
3328
3349
|
phoneNumber: ""
|
|
3329
3350
|
};
|
|
3330
|
-
const r = Object.entries(
|
|
3351
|
+
const r = Object.entries(Bt).find((s) => e.startsWith(s[1])), t = r ? r[1] : "", n = e.replace(t, "");
|
|
3331
3352
|
return /^\d+$/.test(n) ? {
|
|
3332
3353
|
countryCode: t,
|
|
3333
3354
|
phoneNumber: n
|
|
@@ -3335,53 +3356,53 @@ const mr = 27, yr = 12, gr = 10, ba = Ue("enum"), va = (e, r) => {
|
|
|
3335
3356
|
countryCode: "",
|
|
3336
3357
|
phoneNumber: ""
|
|
3337
3358
|
};
|
|
3338
|
-
},
|
|
3339
|
-
const r = /* @__PURE__ */ Ie(/* @__PURE__ */
|
|
3340
|
-
return
|
|
3359
|
+
}, Va = "44", Ma = /^[0-9 ]+$/, La = Ge("string"), Na = Ge("phone"), Ra = (e) => {
|
|
3360
|
+
const r = /* @__PURE__ */ Ie(/* @__PURE__ */ ae(e("validation_country_code")), /* @__PURE__ */ Tt(Ma, e("validation_country_code"))), t = /* @__PURE__ */ Ie(/* @__PURE__ */ ae(e("validation_phone")), /* @__PURE__ */ Ue(1, e("validation_phone")), /* @__PURE__ */ Ot((n) => n.replace(/[^0-9]/g, "")));
|
|
3361
|
+
return xt(/* @__PURE__ */ xe({
|
|
3341
3362
|
countryCode: r,
|
|
3342
3363
|
phoneNumber: t
|
|
3343
3364
|
}));
|
|
3344
|
-
},
|
|
3365
|
+
}, Da = ({
|
|
3345
3366
|
input: e,
|
|
3346
3367
|
onSubmitSuccess: r
|
|
3347
3368
|
}) => {
|
|
3348
|
-
var
|
|
3349
|
-
const t = e.key ? (
|
|
3369
|
+
var I;
|
|
3370
|
+
const t = e.key ? (I = K.current$.value.flow) == null ? void 0 : I.data.submissions[e.key] : void 0, {
|
|
3350
3371
|
t: n
|
|
3351
|
-
} =
|
|
3372
|
+
} = ee(), [s, i] = ve(), a = La(t) ? Fa(t.value) : Na(t) ? t.value : void 0, {
|
|
3352
3373
|
register: o,
|
|
3353
3374
|
handleSubmit: c,
|
|
3354
3375
|
formState: {
|
|
3355
|
-
errors:
|
|
3376
|
+
errors: f
|
|
3356
3377
|
},
|
|
3357
3378
|
watch: g
|
|
3358
|
-
} =
|
|
3379
|
+
} = vt({
|
|
3359
3380
|
defaultValues: {
|
|
3360
|
-
countryCode: (a == null ? void 0 : a.countryCode) ?? e.config.defaultValue.countryCode ??
|
|
3381
|
+
countryCode: (a == null ? void 0 : a.countryCode) ?? e.config.defaultValue.countryCode ?? Va,
|
|
3361
3382
|
phoneNumber: (a == null ? void 0 : a.phoneNumber) ?? e.config.defaultValue.phoneNumber ?? ""
|
|
3362
3383
|
},
|
|
3363
|
-
resolver:
|
|
3384
|
+
resolver: Ra(n)
|
|
3364
3385
|
}), {
|
|
3365
3386
|
ref: b,
|
|
3366
3387
|
...h
|
|
3367
3388
|
} = o("phoneNumber", {
|
|
3368
3389
|
required: !e.config.optional
|
|
3369
|
-
}), m =
|
|
3390
|
+
}), m = he(), k = g("countryCode");
|
|
3370
3391
|
return Ae(() => {
|
|
3371
3392
|
m.current && (m.current.focus(), m.current.select());
|
|
3372
3393
|
}, []), u("form", {
|
|
3373
3394
|
noValidate: !0,
|
|
3374
3395
|
class: "flex flex-col gap-1 p-2.5",
|
|
3375
3396
|
onSubmit: c((C) => {
|
|
3376
|
-
const
|
|
3397
|
+
const x = C.phoneNumber.replace(/[^0-9]/g, ""), y = C.countryCode.replace(/[^0-9]/g, "");
|
|
3377
3398
|
i(void 0);
|
|
3378
|
-
const
|
|
3379
|
-
if (
|
|
3399
|
+
const F = e.config.minChars ?? 7, N = x.length + y.length;
|
|
3400
|
+
if (N < F)
|
|
3380
3401
|
return i(n("validation_phone_min_chars", {
|
|
3381
|
-
count:
|
|
3402
|
+
count: F
|
|
3382
3403
|
}));
|
|
3383
3404
|
const V = e.config.maxChars;
|
|
3384
|
-
if (V != null &&
|
|
3405
|
+
if (V != null && N > V)
|
|
3385
3406
|
return i(n("validation_max_chars", {
|
|
3386
3407
|
count: V
|
|
3387
3408
|
}));
|
|
@@ -3389,11 +3410,11 @@ const mr = 27, yr = 12, gr = 10, ba = Ue("enum"), va = (e, r) => {
|
|
|
3389
3410
|
type: "phone",
|
|
3390
3411
|
value: {
|
|
3391
3412
|
countryCode: y,
|
|
3392
|
-
phoneNumber:
|
|
3413
|
+
phoneNumber: x
|
|
3393
3414
|
}
|
|
3394
3415
|
}) : r({
|
|
3395
3416
|
type: "string",
|
|
3396
|
-
value:
|
|
3417
|
+
value: k + C.phoneNumber
|
|
3397
3418
|
});
|
|
3398
3419
|
}),
|
|
3399
3420
|
children: [u("div", {
|
|
@@ -3404,14 +3425,14 @@ const mr = 27, yr = 12, gr = 10, ba = Ue("enum"), va = (e, r) => {
|
|
|
3404
3425
|
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",
|
|
3405
3426
|
htmlFor: `isdk_phone_${e.key}`,
|
|
3406
3427
|
children: [u("span", {
|
|
3407
|
-
children: ["+",
|
|
3428
|
+
children: ["+", k]
|
|
3408
3429
|
}), u("select", {
|
|
3409
3430
|
...o("countryCode", {}),
|
|
3410
3431
|
id: `isdk_phone_${e.key}`,
|
|
3411
3432
|
class: "absolute inset-0 opacity-0",
|
|
3412
|
-
children: Object.entries(
|
|
3413
|
-
value:
|
|
3414
|
-
children: [C, " (+",
|
|
3433
|
+
children: Object.entries(Bt).map(([C, x]) => u("option", {
|
|
3434
|
+
value: x,
|
|
3435
|
+
children: [C, " (+", x, ")"]
|
|
3415
3436
|
}, C))
|
|
3416
3437
|
})]
|
|
3417
3438
|
}), u("input", {
|
|
@@ -3426,7 +3447,7 @@ const mr = 27, yr = 12, gr = 10, ba = Ue("enum"), va = (e, r) => {
|
|
|
3426
3447
|
ref: (C) => {
|
|
3427
3448
|
C && (m.current = C), b(C);
|
|
3428
3449
|
},
|
|
3429
|
-
class:
|
|
3450
|
+
class: ze({
|
|
3430
3451
|
optional: e.config.optional,
|
|
3431
3452
|
className: "min-w-0 flex-1 rounded-r-full"
|
|
3432
3453
|
}),
|
|
@@ -3436,47 +3457,47 @@ const mr = 27, yr = 12, gr = 10, ba = Ue("enum"), va = (e, r) => {
|
|
|
3436
3457
|
onClick: () => r(null)
|
|
3437
3458
|
})]
|
|
3438
3459
|
}), u(Re, {})]
|
|
3439
|
-
}), u(
|
|
3440
|
-
error:
|
|
3460
|
+
}), u(He, {
|
|
3461
|
+
error: f.countryCode || f.phoneNumber || {
|
|
3441
3462
|
message: s
|
|
3442
3463
|
}
|
|
3443
3464
|
})]
|
|
3444
3465
|
});
|
|
3445
|
-
},
|
|
3446
|
-
time:
|
|
3466
|
+
}, dt = (e) => e === void 0 ? 0 : Math.max(0, Math.ceil((e - Date.now()) / 1e3)), Cr = (e, r, t, n) => t !== void 0 && n * 1e3 > Mr ? e("submission_available_at", {
|
|
3467
|
+
time: Lr(t, r)
|
|
3447
3468
|
}) : e("submission_cooldown", {
|
|
3448
3469
|
count: n
|
|
3449
|
-
}),
|
|
3470
|
+
}), Ta = ({
|
|
3450
3471
|
input: e,
|
|
3451
3472
|
onSubmitSuccess: r
|
|
3452
3473
|
}) => {
|
|
3453
3474
|
const {
|
|
3454
3475
|
t,
|
|
3455
3476
|
locale: n
|
|
3456
|
-
} =
|
|
3477
|
+
} = ee(), {
|
|
3457
3478
|
availableAt: s
|
|
3458
|
-
} = e.config, [i, a] = ve(() =>
|
|
3459
|
-
|
|
3460
|
-
const g =
|
|
3479
|
+
} = e.config, [i, a] = ve(() => dt(s)), [o, c] = ve("");
|
|
3480
|
+
Nr(() => {
|
|
3481
|
+
const g = dt(s);
|
|
3461
3482
|
if (a(g), g === 0)
|
|
3462
3483
|
return;
|
|
3463
|
-
c(
|
|
3484
|
+
c(Cr(t, n, s, g));
|
|
3464
3485
|
const b = setInterval(() => {
|
|
3465
|
-
const h =
|
|
3486
|
+
const h = dt(s);
|
|
3466
3487
|
a(h), !(h > 0) && (clearInterval(b), c(t("submission_cooldown_ready")));
|
|
3467
3488
|
}, 250);
|
|
3468
3489
|
return () => clearInterval(b);
|
|
3469
3490
|
}, [s, n, t]);
|
|
3470
|
-
const
|
|
3491
|
+
const f = i > 0;
|
|
3471
3492
|
return u("div", {
|
|
3472
3493
|
class: "flex flex-col items-center gap-2 py-3",
|
|
3473
3494
|
children: [u("button", {
|
|
3474
3495
|
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]",
|
|
3475
3496
|
name: e.key,
|
|
3476
|
-
"aria-disabled":
|
|
3477
|
-
"aria-describedby":
|
|
3497
|
+
"aria-disabled": f,
|
|
3498
|
+
"aria-describedby": f ? "submit-cooldown" : void 0,
|
|
3478
3499
|
onClick: () => {
|
|
3479
|
-
|
|
3500
|
+
dt(s) > 0 || r(null);
|
|
3480
3501
|
},
|
|
3481
3502
|
children: u("span", {
|
|
3482
3503
|
class: "flex items-center gap-1.5",
|
|
@@ -3498,20 +3519,20 @@ const mr = 27, yr = 12, gr = 10, ba = Ue("enum"), va = (e, r) => {
|
|
|
3498
3519
|
})]
|
|
3499
3520
|
})]
|
|
3500
3521
|
})
|
|
3501
|
-
}),
|
|
3522
|
+
}), f && u("p", {
|
|
3502
3523
|
id: "submit-cooldown",
|
|
3503
3524
|
"aria-hidden": "true",
|
|
3504
3525
|
class: "text-neutral-11 text-xs",
|
|
3505
|
-
children:
|
|
3526
|
+
children: Cr(t, n, s, i)
|
|
3506
3527
|
}), u("p", {
|
|
3507
3528
|
role: "status",
|
|
3508
3529
|
class: "sr-only",
|
|
3509
3530
|
children: o
|
|
3510
3531
|
})]
|
|
3511
3532
|
});
|
|
3512
|
-
},
|
|
3513
|
-
e.style.height = "auto", e.style.height = `${Math.min(e.scrollHeight,
|
|
3514
|
-
},
|
|
3533
|
+
}, Oa = 160, Sr = (e) => {
|
|
3534
|
+
e.style.height = "auto", e.style.height = `${Math.min(e.scrollHeight, Oa)}px`;
|
|
3535
|
+
}, Ba = {
|
|
3515
3536
|
date: {
|
|
3516
3537
|
type: "date",
|
|
3517
3538
|
inputMode: "text"
|
|
@@ -3530,7 +3551,7 @@ const mr = 27, yr = 12, gr = 10, ba = Ue("enum"), va = (e, r) => {
|
|
|
3530
3551
|
inputMode: "url",
|
|
3531
3552
|
formNoValidate: !0
|
|
3532
3553
|
}
|
|
3533
|
-
},
|
|
3554
|
+
}, ja = Ge("string"), Pa = (e, r) => {
|
|
3534
3555
|
const t = {
|
|
3535
3556
|
maxLength: r("validation_max_chars", {
|
|
3536
3557
|
count: e.maxChars ?? 999
|
|
@@ -3539,43 +3560,43 @@ const mr = 27, yr = 12, gr = 10, ba = Ue("enum"), va = (e, r) => {
|
|
|
3539
3560
|
count: e.minChars ?? 1
|
|
3540
3561
|
})
|
|
3541
3562
|
};
|
|
3542
|
-
return
|
|
3563
|
+
return xt(/* @__PURE__ */ xe({
|
|
3543
3564
|
text: {
|
|
3544
|
-
date: /* @__PURE__ */ Ie(/* @__PURE__ */
|
|
3545
|
-
email: /* @__PURE__ */ Ie(/* @__PURE__ */
|
|
3546
|
-
text: /* @__PURE__ */ Ie(/* @__PURE__ */
|
|
3547
|
-
url: /* @__PURE__ */ Ie(/* @__PURE__ */
|
|
3565
|
+
date: /* @__PURE__ */ Ie(/* @__PURE__ */ ae(r("validation_date")), /* @__PURE__ */ Tt(/^\d{4}-\d{2}-\d{2}$/, r("validation_date"))),
|
|
3566
|
+
email: /* @__PURE__ */ Ie(/* @__PURE__ */ ae(r("validation_email")), /* @__PURE__ */ qr(r("validation_email")), /* @__PURE__ */ Ue(e.minChars ?? 1, t.minLength), /* @__PURE__ */ st(e.maxChars ?? 1 / 0, t.maxLength)),
|
|
3567
|
+
text: /* @__PURE__ */ Ie(/* @__PURE__ */ ae(), /* @__PURE__ */ Ue(e.minChars ?? 1, t.minLength), /* @__PURE__ */ st(e.maxChars ?? 1 / 0, t.maxLength)),
|
|
3568
|
+
url: /* @__PURE__ */ Ie(/* @__PURE__ */ ae(r("validation_url")), /* @__PURE__ */ Wr(r("validation_url")), /* @__PURE__ */ Ue(e.minChars ?? 1, t.minLength), /* @__PURE__ */ st(e.maxChars ?? 1 / 0, t.maxLength))
|
|
3548
3569
|
}[e.format]
|
|
3549
3570
|
}));
|
|
3550
|
-
},
|
|
3571
|
+
}, qa = ({
|
|
3551
3572
|
input: e,
|
|
3552
3573
|
onSubmitSuccess: r
|
|
3553
3574
|
}) => {
|
|
3554
|
-
var
|
|
3575
|
+
var I;
|
|
3555
3576
|
const {
|
|
3556
3577
|
t
|
|
3557
|
-
} =
|
|
3578
|
+
} = ee(), n = e.key ? (I = K.current$.value.flow) == null ? void 0 : I.data.submissions[e.key] : void 0, s = e.config.defaultValue, i = e.config.multiline === !0 && e.config.format === "text", {
|
|
3558
3579
|
register: a,
|
|
3559
3580
|
handleSubmit: o,
|
|
3560
3581
|
watch: c,
|
|
3561
3582
|
formState: {
|
|
3562
|
-
errors:
|
|
3583
|
+
errors: f
|
|
3563
3584
|
}
|
|
3564
|
-
} =
|
|
3585
|
+
} = vt({
|
|
3565
3586
|
defaultValues: {
|
|
3566
|
-
text:
|
|
3587
|
+
text: ja(n) ? n.value : s ?? ""
|
|
3567
3588
|
},
|
|
3568
|
-
resolver:
|
|
3589
|
+
resolver: Pa(e.config, t)
|
|
3569
3590
|
}), {
|
|
3570
3591
|
ref: g,
|
|
3571
3592
|
...b
|
|
3572
3593
|
} = a("text", {
|
|
3573
3594
|
required: !e.config.optional
|
|
3574
|
-
}), h =
|
|
3595
|
+
}), h = he();
|
|
3575
3596
|
Ae(() => {
|
|
3576
|
-
h.current && (h.current instanceof HTMLTextAreaElement &&
|
|
3597
|
+
h.current && (h.current instanceof HTMLTextAreaElement && Sr(h.current), h.current.focus(), h.current.select());
|
|
3577
3598
|
}, []);
|
|
3578
|
-
const m = e.config.maxChars,
|
|
3599
|
+
const m = e.config.maxChars, k = i && m !== void 0 ? c("text").length : void 0;
|
|
3579
3600
|
return u("form", {
|
|
3580
3601
|
noValidate: !0,
|
|
3581
3602
|
class: "flex flex-col gap-1 p-2.5",
|
|
@@ -3595,24 +3616,24 @@ const mr = 27, yr = 12, gr = 10, ba = Ue("enum"), va = (e, r) => {
|
|
|
3595
3616
|
rows: 2,
|
|
3596
3617
|
maxLength: m,
|
|
3597
3618
|
autoFocus: !0,
|
|
3598
|
-
"aria-describedby":
|
|
3599
|
-
onInput: (C) =>
|
|
3619
|
+
"aria-describedby": k !== void 0 ? "chat-input-count" : void 0,
|
|
3620
|
+
onInput: (C) => Sr(C.currentTarget),
|
|
3600
3621
|
onKeyDown: (C) => {
|
|
3601
|
-
var
|
|
3602
|
-
C.key === "Enter" && (C.ctrlKey || C.metaKey) && (C.preventDefault(), (
|
|
3622
|
+
var x;
|
|
3623
|
+
C.key === "Enter" && (C.ctrlKey || C.metaKey) && (C.preventDefault(), (x = C.currentTarget.form) == null || x.requestSubmit());
|
|
3603
3624
|
},
|
|
3604
3625
|
ref: (C) => {
|
|
3605
3626
|
C && (h.current = C), g(C);
|
|
3606
3627
|
},
|
|
3607
3628
|
placeholder: e.config.placeholder,
|
|
3608
|
-
class:
|
|
3629
|
+
class: ze({
|
|
3609
3630
|
optional: !!e.config.optional,
|
|
3610
3631
|
className: "block w-full resize-none overflow-y-auto rounded-2xl"
|
|
3611
3632
|
})
|
|
3612
3633
|
}) : u("input", {
|
|
3613
3634
|
id: "chat-input",
|
|
3614
3635
|
...b,
|
|
3615
|
-
...
|
|
3636
|
+
...Ba[e.config.format],
|
|
3616
3637
|
autocomplete: "off",
|
|
3617
3638
|
autoCapitalize: "off",
|
|
3618
3639
|
autoCorrect: "off",
|
|
@@ -3621,7 +3642,7 @@ const mr = 27, yr = 12, gr = 10, ba = Ue("enum"), va = (e, r) => {
|
|
|
3621
3642
|
C && (h.current = C), g(C);
|
|
3622
3643
|
},
|
|
3623
3644
|
placeholder: e.config.placeholder,
|
|
3624
|
-
class:
|
|
3645
|
+
class: ze({
|
|
3625
3646
|
optional: !!e.config.optional,
|
|
3626
3647
|
className: "w-full rounded-full"
|
|
3627
3648
|
})
|
|
@@ -3633,29 +3654,29 @@ const mr = 27, yr = 12, gr = 10, ba = Ue("enum"), va = (e, r) => {
|
|
|
3633
3654
|
}
|
|
3634
3655
|
)]
|
|
3635
3656
|
}), u(Re, {})]
|
|
3636
|
-
}),
|
|
3657
|
+
}), k !== void 0 && m !== void 0 && u("p", {
|
|
3637
3658
|
id: "chat-input-count",
|
|
3638
3659
|
class: "text-neutral-10 px-3 text-right text-xs",
|
|
3639
|
-
children: [
|
|
3640
|
-
}), u(
|
|
3641
|
-
error:
|
|
3660
|
+
children: [k, "/", m]
|
|
3661
|
+
}), u(He, {
|
|
3662
|
+
error: f.text
|
|
3642
3663
|
})]
|
|
3643
3664
|
});
|
|
3644
3665
|
}, $a = {
|
|
3645
|
-
text:
|
|
3646
|
-
phone:
|
|
3647
|
-
"multiple-choice":
|
|
3666
|
+
text: qa,
|
|
3667
|
+
phone: Da,
|
|
3668
|
+
"multiple-choice": Sa,
|
|
3648
3669
|
boolean: $s,
|
|
3649
|
-
file:
|
|
3650
|
-
submit:
|
|
3651
|
-
address:
|
|
3652
|
-
number:
|
|
3653
|
-
},
|
|
3670
|
+
file: Js,
|
|
3671
|
+
submit: Ta,
|
|
3672
|
+
address: Bs,
|
|
3673
|
+
number: Ea
|
|
3674
|
+
}, Ua = ({
|
|
3654
3675
|
logger: e,
|
|
3655
3676
|
analytics: r
|
|
3656
3677
|
}) => {
|
|
3657
3678
|
var i;
|
|
3658
|
-
const t = (i =
|
|
3679
|
+
const t = (i = K.current$.value.flow) == null ? void 0 : i.data.currentInput, n = he(null), s = () => ie.onInteractionFn$.value();
|
|
3659
3680
|
return Ae(() => {
|
|
3660
3681
|
var a;
|
|
3661
3682
|
(a = n.current) == null || a.scrollTo({
|
|
@@ -3673,7 +3694,7 @@ const mr = 27, yr = 12, gr = 10, ba = Ue("enum"), va = (e, r) => {
|
|
|
3673
3694
|
return u(a, {
|
|
3674
3695
|
logger: e,
|
|
3675
3696
|
analytics: r,
|
|
3676
|
-
onSubmitSuccess:
|
|
3697
|
+
onSubmitSuccess: ie.onSubmitSuccessFn$.value,
|
|
3677
3698
|
input: t
|
|
3678
3699
|
});
|
|
3679
3700
|
})() : u("div", {
|
|
@@ -3681,7 +3702,7 @@ const mr = 27, yr = 12, gr = 10, ba = Ue("enum"), va = (e, r) => {
|
|
|
3681
3702
|
children: [u("input", {
|
|
3682
3703
|
"aria-hidden": "true",
|
|
3683
3704
|
id: "chat-input",
|
|
3684
|
-
class:
|
|
3705
|
+
class: ze({
|
|
3685
3706
|
optional: !1,
|
|
3686
3707
|
className: "flex-grow rounded-full"
|
|
3687
3708
|
}),
|
|
@@ -3695,30 +3716,30 @@ const mr = 27, yr = 12, gr = 10, ba = Ue("enum"), va = (e, r) => {
|
|
|
3695
3716
|
})
|
|
3696
3717
|
});
|
|
3697
3718
|
};
|
|
3698
|
-
function
|
|
3719
|
+
function Wa(e) {
|
|
3699
3720
|
return e && e.__esModule && Object.prototype.hasOwnProperty.call(e, "default") ? e.default : e;
|
|
3700
3721
|
}
|
|
3701
|
-
var
|
|
3722
|
+
var za = function(e) {
|
|
3702
3723
|
return e instanceof RegExp;
|
|
3703
|
-
},
|
|
3724
|
+
}, Ka = function(r) {
|
|
3704
3725
|
var t = /[\\^$.*+?()[\]{}|]/g, n = RegExp(t.source);
|
|
3705
3726
|
return r && n.test(r) ? r.replace(t, "\\$&") : r;
|
|
3706
|
-
},
|
|
3727
|
+
}, cn = function(e) {
|
|
3707
3728
|
return typeof e == "string";
|
|
3708
|
-
},
|
|
3729
|
+
}, Ga = function(e) {
|
|
3709
3730
|
var r = [];
|
|
3710
3731
|
return e.forEach(function(t) {
|
|
3711
3732
|
Array.isArray(t) ? r = r.concat(t) : r.push(t);
|
|
3712
3733
|
}), r;
|
|
3713
3734
|
};
|
|
3714
|
-
function
|
|
3735
|
+
function Ha(e, r, t) {
|
|
3715
3736
|
var n = 0, s = 0;
|
|
3716
3737
|
if (e === "")
|
|
3717
3738
|
return e;
|
|
3718
|
-
if (!e || !
|
|
3739
|
+
if (!e || !cn(e))
|
|
3719
3740
|
throw new TypeError("First argument to react-string-replace#replaceString must be a string");
|
|
3720
3741
|
var i = r;
|
|
3721
|
-
|
|
3742
|
+
za(i) || (i = new RegExp("(" + Ka(i) + ")", "gi"));
|
|
3722
3743
|
for (var a = e.split(i), o = 1, c = a.length; o < c; o += 2) {
|
|
3723
3744
|
if (a[o] === void 0 || a[o - 1] === void 0) {
|
|
3724
3745
|
console.warn("reactStringReplace: Encountered undefined value during string replacement. Your RegExp may not be working the way you expect.");
|
|
@@ -3728,32 +3749,32 @@ function Wa(e, r, t) {
|
|
|
3728
3749
|
}
|
|
3729
3750
|
return a;
|
|
3730
3751
|
}
|
|
3731
|
-
var
|
|
3732
|
-
return Array.isArray(r) || (r = [r]),
|
|
3733
|
-
return
|
|
3752
|
+
var Ja = function(r, t, n) {
|
|
3753
|
+
return Array.isArray(r) || (r = [r]), Ga(r.map(function(s) {
|
|
3754
|
+
return cn(s) ? Ha(s, t, n) : s;
|
|
3734
3755
|
}));
|
|
3735
3756
|
};
|
|
3736
|
-
const
|
|
3737
|
-
const r =
|
|
3738
|
-
const [, c,
|
|
3739
|
-
return
|
|
3740
|
-
class:
|
|
3741
|
-
href:
|
|
3742
|
-
children: c ??
|
|
3743
|
-
},
|
|
3757
|
+
const rt = /* @__PURE__ */ Wa(Ja), Za = /(\[[^\]]+\]\([^)]+\))/g, Xa = /\[([^\]]+)\]\(([^)]+)\)/, Ya = /(https?:\/\/[^\s]+)/g, Qa = /_(.*?)_/g, ei = /\*\*(.*?)\*\*/g, ti = /\\n|\n/g, Ir = "text-accent-10 hover:text-accent-11 no-underline underline-offset-2 hover:underline", ri = (e) => {
|
|
3758
|
+
const r = rt(e, Za, (a, o) => {
|
|
3759
|
+
const [, c, f] = a.match(Xa) ?? [];
|
|
3760
|
+
return f ? u("a", {
|
|
3761
|
+
class: Ir,
|
|
3762
|
+
href: f,
|
|
3763
|
+
children: c ?? f
|
|
3764
|
+
}, f + o) : u("span", {
|
|
3744
3765
|
children: "INVALID LINK"
|
|
3745
3766
|
});
|
|
3746
|
-
}), t =
|
|
3747
|
-
class:
|
|
3767
|
+
}), t = rt(r, Ya, (a, o) => u("a", {
|
|
3768
|
+
class: Ir,
|
|
3748
3769
|
href: a,
|
|
3749
3770
|
children: a
|
|
3750
|
-
}, a + o)), n =
|
|
3771
|
+
}, a + o)), n = rt(t, Qa, (a, o) => u("em", {
|
|
3751
3772
|
children: a
|
|
3752
|
-
}, a + o)), s =
|
|
3773
|
+
}, a + o)), s = rt(n, ei, (a, o) => u("strong", {
|
|
3753
3774
|
children: a
|
|
3754
3775
|
}, a + o));
|
|
3755
|
-
return
|
|
3756
|
-
},
|
|
3776
|
+
return rt(s, ti, (a, o) => u("br", {}, `br-${o}`));
|
|
3777
|
+
}, ni = mt("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", {
|
|
3757
3778
|
variants: {
|
|
3758
3779
|
side: {
|
|
3759
3780
|
left: "bg-bubble-weak-bg text-neutral-12 shadow-surface-sm outline outline-1 outline-bubble-weak rounded-bl-md",
|
|
@@ -3767,7 +3788,7 @@ const Xe = /* @__PURE__ */ ja(za), Ka = /(\[[^\]]+\]\([^)]+\))/g, Ga = /\[([^\]]
|
|
|
3767
3788
|
defaultVariants: {
|
|
3768
3789
|
side: "left"
|
|
3769
3790
|
}
|
|
3770
|
-
}),
|
|
3791
|
+
}), si = ({
|
|
3771
3792
|
children: e,
|
|
3772
3793
|
className: r,
|
|
3773
3794
|
animate: t,
|
|
@@ -3777,14 +3798,14 @@ const Xe = /* @__PURE__ */ ja(za), Ka = /(\[[^\]]+\]\([^)]+\))/g, Ga = /\[([^\]]
|
|
|
3777
3798
|
style: {
|
|
3778
3799
|
transformOrigin: n === "left" ? "0% 50%" : "100% 50%"
|
|
3779
3800
|
},
|
|
3780
|
-
class:
|
|
3801
|
+
class: ni({
|
|
3781
3802
|
className: r,
|
|
3782
3803
|
side: n,
|
|
3783
3804
|
animate: t
|
|
3784
3805
|
}),
|
|
3785
3806
|
...s,
|
|
3786
3807
|
children: e
|
|
3787
|
-
}),
|
|
3808
|
+
}), ai = ({
|
|
3788
3809
|
message: e
|
|
3789
3810
|
}) => u("div", {
|
|
3790
3811
|
class: "bg-accent-3 flex w-full items-center justify-center overflow-hidden rounded-xl px-2 py-2",
|
|
@@ -3808,14 +3829,14 @@ const Xe = /* @__PURE__ */ ja(za), Ka = /(\[[^\]]+\]\([^)]+\))/g, Ga = /\[([^\]]
|
|
|
3808
3829
|
})
|
|
3809
3830
|
})]
|
|
3810
3831
|
})
|
|
3811
|
-
}),
|
|
3832
|
+
}), ii = ({
|
|
3812
3833
|
className: e,
|
|
3813
3834
|
...r
|
|
3814
3835
|
}) => u("div", {
|
|
3815
3836
|
"aria-hidden": !0,
|
|
3816
|
-
children:
|
|
3837
|
+
children: ie.isBotTyping$.value === !0 ? u("div", {
|
|
3817
3838
|
"data-testid": "typing-indicator",
|
|
3818
|
-
class:
|
|
3839
|
+
class: Ke("flex gap-1 p-4", e),
|
|
3819
3840
|
...r,
|
|
3820
3841
|
children: Array.from({
|
|
3821
3842
|
length: 3
|
|
@@ -3826,10 +3847,10 @@ const Xe = /* @__PURE__ */ ja(za), Ka = /(\[[^\]]+\]\([^)]+\))/g, Ga = /\[([^\]]
|
|
|
3826
3847
|
}
|
|
3827
3848
|
}))
|
|
3828
3849
|
}) : void 0
|
|
3829
|
-
}),
|
|
3850
|
+
}), oi = {
|
|
3830
3851
|
bot: "left",
|
|
3831
3852
|
user: "right"
|
|
3832
|
-
},
|
|
3853
|
+
}, li = mt("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)]", {
|
|
3833
3854
|
variants: {
|
|
3834
3855
|
variant: {
|
|
3835
3856
|
info: "text-neutral-11",
|
|
@@ -3838,12 +3859,12 @@ const Xe = /* @__PURE__ */ ja(za), Ka = /(\[[^\]]+\]\([^)]+\))/g, Ga = /\[([^\]]
|
|
|
3838
3859
|
success: "text-system-success"
|
|
3839
3860
|
}
|
|
3840
3861
|
}
|
|
3841
|
-
}),
|
|
3862
|
+
}), ui = ({
|
|
3842
3863
|
lastSentMessageFooter: e
|
|
3843
3864
|
}) => {
|
|
3844
3865
|
const {
|
|
3845
3866
|
t: r
|
|
3846
|
-
} =
|
|
3867
|
+
} = ee(), t = K.current$.value.flow, n = (t == null ? void 0 : t.data.messages) ?? [], s = t ? Dt(t) : void 0;
|
|
3847
3868
|
return u("ol", {
|
|
3848
3869
|
"aria-label": r("chat_messages"),
|
|
3849
3870
|
"aria-live": "polite",
|
|
@@ -3852,28 +3873,28 @@ const Xe = /* @__PURE__ */ ja(za), Ka = /(\[[^\]]+\]\([^)]+\))/g, Ga = /\[([^\]]
|
|
|
3852
3873
|
children: u("li", {
|
|
3853
3874
|
class: "flex",
|
|
3854
3875
|
tabIndex: a === n.length - 1 ? -1 : void 0,
|
|
3855
|
-
children: [s && i.groupId === s && !n.slice(a + 1).some((o) => o.groupId === s) ? e : null,
|
|
3876
|
+
children: [s && i.groupId === s && !n.slice(a + 1).some((o) => o.groupId === s) ? e : null, Mn(i).with({
|
|
3856
3877
|
type: "system"
|
|
3857
3878
|
}, (o) => u("p", {
|
|
3858
|
-
class:
|
|
3879
|
+
class: li({
|
|
3859
3880
|
variant: o.variant
|
|
3860
3881
|
}),
|
|
3861
3882
|
children: o.text
|
|
3862
3883
|
})).with({
|
|
3863
3884
|
type: "text",
|
|
3864
|
-
author:
|
|
3885
|
+
author: Ln.union("bot", "user")
|
|
3865
3886
|
}, (o) => {
|
|
3866
|
-
const c = a === n.length - 1,
|
|
3887
|
+
const c = a === n.length - 1, f = o.author === "bot" ? ri(o.text) : o.text;
|
|
3867
3888
|
return u(we, {
|
|
3868
|
-
children: u(
|
|
3889
|
+
children: u(si, {
|
|
3869
3890
|
animate: c,
|
|
3870
|
-
side:
|
|
3871
|
-
children:
|
|
3891
|
+
side: oi[o.author],
|
|
3892
|
+
children: f
|
|
3872
3893
|
}, a)
|
|
3873
3894
|
});
|
|
3874
3895
|
}).with({
|
|
3875
3896
|
type: "link"
|
|
3876
|
-
}, (o) => u(
|
|
3897
|
+
}, (o) => u(ai, {
|
|
3877
3898
|
message: o
|
|
3878
3899
|
})).with({
|
|
3879
3900
|
type: "image"
|
|
@@ -3885,7 +3906,7 @@ const Xe = /* @__PURE__ */ ja(za), Ka = /(\[[^\]]+\]\([^)]+\))/g, Ga = /\[([^\]]
|
|
|
3885
3906
|
}
|
|
3886
3907
|
})).with({
|
|
3887
3908
|
type: "file"
|
|
3888
|
-
}, (o) => u(
|
|
3909
|
+
}, (o) => u(zs, {
|
|
3889
3910
|
class: o.author === "bot" ? void 0 : "ml-auto",
|
|
3890
3911
|
file: {
|
|
3891
3912
|
name: o.fileName,
|
|
@@ -3895,9 +3916,9 @@ const Xe = /* @__PURE__ */ ja(za), Ka = /(\[[^\]]+\]\([^)]+\))/g, Ga = /\[([^\]]
|
|
|
3895
3916
|
type: "loading"
|
|
3896
3917
|
}, (o) => {
|
|
3897
3918
|
const c = n[n.length - 1];
|
|
3898
|
-
return !(o === c) ||
|
|
3919
|
+
return !(o === c) || ie.isBotTyping$.value ? null : u("div", {
|
|
3899
3920
|
class: "flex flex-grow flex-col items-center justify-center gap-2",
|
|
3900
|
-
children: [u(
|
|
3921
|
+
children: [u(Rt, {
|
|
3901
3922
|
"aria-hidden": o.text ? "true" : void 0,
|
|
3902
3923
|
class: "text-neutral-6 h-8 w-8"
|
|
3903
3924
|
}), o.text ? u("p", {
|
|
@@ -3909,7 +3930,7 @@ const Xe = /* @__PURE__ */ ja(za), Ka = /(\[[^\]]+\]\([^)]+\))/g, Ga = /\[([^\]]
|
|
|
3909
3930
|
}).exhaustive()]
|
|
3910
3931
|
})
|
|
3911
3932
|
}, a)), u("li", {
|
|
3912
|
-
class:
|
|
3933
|
+
class: ie.captchaVisible$.value ? "flex" : "hidden",
|
|
3913
3934
|
children: u("div", {
|
|
3914
3935
|
"data-captcha-slot": !0,
|
|
3915
3936
|
tabIndex: -1,
|
|
@@ -3917,9 +3938,9 @@ const Xe = /* @__PURE__ */ ja(za), Ka = /(\[[^\]]+\]\([^)]+\))/g, Ga = /\[([^\]]
|
|
|
3917
3938
|
"aria-label": r("captcha_check"),
|
|
3918
3939
|
class: "w-full max-w-[min(100%,24rem)] rounded-md"
|
|
3919
3940
|
})
|
|
3920
|
-
}, "captcha"), u(
|
|
3941
|
+
}, "captcha"), u(ii, {}, "typing")]
|
|
3921
3942
|
});
|
|
3922
|
-
},
|
|
3943
|
+
}, hi = ({
|
|
3923
3944
|
logger: e,
|
|
3924
3945
|
apiClient: r,
|
|
3925
3946
|
analytics: t,
|
|
@@ -3927,37 +3948,37 @@ const Xe = /* @__PURE__ */ ja(za), Ka = /(\[[^\]]+\]\([^)]+\))/g, Ga = /\[([^\]]
|
|
|
3927
3948
|
}) => {
|
|
3928
3949
|
const {
|
|
3929
3950
|
flow: s
|
|
3930
|
-
} =
|
|
3951
|
+
} = K.current$.value;
|
|
3931
3952
|
Ne(s, "Flow is required to exist to show chatbot body");
|
|
3932
|
-
const i =
|
|
3953
|
+
const i = K.viewState$.value, {
|
|
3933
3954
|
chatRef: a,
|
|
3934
3955
|
chatService: o
|
|
3935
|
-
} =
|
|
3956
|
+
} = Nn(), {
|
|
3936
3957
|
t: c
|
|
3937
|
-
} =
|
|
3958
|
+
} = ee(), [f, g] = ve();
|
|
3938
3959
|
return Ae(() => {
|
|
3939
|
-
i === "maximised" &&
|
|
3960
|
+
i === "maximised" && ie.scrollToEnd();
|
|
3940
3961
|
}, [i]), Ae(() => {
|
|
3941
3962
|
var V;
|
|
3942
3963
|
const {
|
|
3943
3964
|
state: b,
|
|
3944
3965
|
flow: h
|
|
3945
|
-
} =
|
|
3966
|
+
} = K.current$.peek();
|
|
3946
3967
|
if (b !== "loaded")
|
|
3947
3968
|
throw new Error(c("invalid_state"));
|
|
3948
3969
|
let m = h.data.nodeHistory.at(-1);
|
|
3949
|
-
if (
|
|
3970
|
+
if (ie.scrollToEnd(), K.setInput(void 0), h.data.isFinished)
|
|
3950
3971
|
return;
|
|
3951
|
-
const
|
|
3952
|
-
const
|
|
3953
|
-
!
|
|
3972
|
+
const k = () => {
|
|
3973
|
+
const T = K.current$.peek().flow;
|
|
3974
|
+
!T || T.data.hasInteracted || (K.markAsInteracted(), er(t, T, "FLOW_INTERACT"));
|
|
3954
3975
|
};
|
|
3955
|
-
|
|
3976
|
+
ie.onInteractionFn$.value = k, m === void 0 ? (m = Or(s.nodes).id, K.setCurrentNodeId(m), er(t, h, "FLOW_START")) : K.removeMessagesSentByNodeIds([m, Mt]);
|
|
3956
3977
|
const {
|
|
3957
|
-
interpret:
|
|
3978
|
+
interpret: I,
|
|
3958
3979
|
abort: C,
|
|
3959
|
-
undo:
|
|
3960
|
-
} =
|
|
3980
|
+
undo: x
|
|
3981
|
+
} = Xn({
|
|
3961
3982
|
context: s.context,
|
|
3962
3983
|
analytics: {
|
|
3963
3984
|
service: t,
|
|
@@ -3970,44 +3991,44 @@ const Xe = /* @__PURE__ */ ja(za), Ka = /(\[[^\]]+\]\([^)]+\))/g, Ga = /\[([^\]]
|
|
|
3970
3991
|
chatService: o,
|
|
3971
3992
|
t: c,
|
|
3972
3993
|
getApplicationRecovery: () => {
|
|
3973
|
-
var
|
|
3974
|
-
return (
|
|
3994
|
+
var T;
|
|
3995
|
+
return (T = K.current$.peek().flow) == null ? void 0 : T.data.applicationRecovery;
|
|
3975
3996
|
},
|
|
3976
|
-
setApplicationRecovery:
|
|
3977
|
-
persistWriteBarrier: () =>
|
|
3997
|
+
setApplicationRecovery: K.setApplicationRecovery,
|
|
3998
|
+
persistWriteBarrier: () => K.persistWriteBarrier(h),
|
|
3978
3999
|
// We need to get fresh submissions, that’s why we call `peek` here.
|
|
3979
4000
|
getSubmissions: () => {
|
|
3980
|
-
var
|
|
3981
|
-
return (
|
|
4001
|
+
var T;
|
|
4002
|
+
return (T = K.current$.peek().flow) == null ? void 0 : T.data.submissions;
|
|
3982
4003
|
},
|
|
3983
|
-
onInterpret: (
|
|
4004
|
+
onInterpret: (T) => K.setCurrentNodeId(T.id),
|
|
3984
4005
|
onFlowEnd: async () => {
|
|
3985
|
-
var
|
|
3986
|
-
|
|
3987
|
-
const
|
|
3988
|
-
Ne(
|
|
4006
|
+
var R;
|
|
4007
|
+
K.markAsFinished();
|
|
4008
|
+
const T = K.current$.peek().flow;
|
|
4009
|
+
Ne(T), t.log({
|
|
3989
4010
|
event: "FLOW_END",
|
|
3990
4011
|
properties: {
|
|
3991
4012
|
flow_id: s.id,
|
|
3992
4013
|
flow_version: s.version,
|
|
3993
|
-
flow_session_id:
|
|
4014
|
+
flow_session_id: T.data.flowSessionId,
|
|
3994
4015
|
flow_build: s.build,
|
|
3995
4016
|
job: s.job
|
|
3996
4017
|
},
|
|
3997
|
-
customProperties: (
|
|
4018
|
+
customProperties: (R = s.analytics) == null ? void 0 : R.customProperties
|
|
3998
4019
|
});
|
|
3999
4020
|
}
|
|
4000
|
-
}), y = m,
|
|
4001
|
-
g(() =>
|
|
4002
|
-
},
|
|
4003
|
-
return h.offerResume ?
|
|
4021
|
+
}), y = m, F = () => {
|
|
4022
|
+
g(() => x), I(y);
|
|
4023
|
+
}, N = new AbortController();
|
|
4024
|
+
return h.offerResume ? vs({
|
|
4004
4025
|
chatService: o,
|
|
4005
4026
|
t: c,
|
|
4006
|
-
signal:
|
|
4007
|
-
}).then((
|
|
4008
|
-
|
|
4009
|
-
}) :
|
|
4010
|
-
|
|
4027
|
+
signal: N.signal
|
|
4028
|
+
}).then((T) => (K.settleResume(h), T ? F() : (K.restart(), Rn.flushStateData()))).catch((T) => {
|
|
4029
|
+
T instanceof Fr || e.error("Resume prompt failed", T);
|
|
4030
|
+
}) : F(), () => {
|
|
4031
|
+
N.abort(), ie.onInteractionFn$.value === k && (ie.onInteractionFn$.value = () => {
|
|
4011
4032
|
}), C();
|
|
4012
4033
|
};
|
|
4013
4034
|
}, [t, r, o, e, s, n, c]), u(we, {
|
|
@@ -4022,44 +4043,44 @@ const Xe = /* @__PURE__ */ ja(za), Ka = /(\[[^\]]+\]\([^)]+\))/g, Ga = /\[([^\]]
|
|
|
4022
4043
|
style: {
|
|
4023
4044
|
WebkitOverflowScrolling: "touch"
|
|
4024
4045
|
},
|
|
4025
|
-
children: u(
|
|
4026
|
-
lastSentMessageFooter: !
|
|
4027
|
-
undoFn:
|
|
4046
|
+
children: u(ui, {
|
|
4047
|
+
lastSentMessageFooter: !Dt(s) || !f ? null : u(ci, {
|
|
4048
|
+
undoFn: f
|
|
4028
4049
|
})
|
|
4029
4050
|
})
|
|
4030
|
-
}),
|
|
4051
|
+
}), ie.isReadingHistory$.value && !s.data.isFinished && !ie.isBotTyping$.value && u("div", {
|
|
4031
4052
|
class: "absolute bottom-2 left-1/2 -translate-x-1/2",
|
|
4032
|
-
children: u(
|
|
4053
|
+
children: u(Dr, {
|
|
4033
4054
|
class: "bg-neutral-1 ring-divider shadow-surface-md ring-1",
|
|
4034
4055
|
"aria-label": c("jump_to_current"),
|
|
4035
4056
|
onClick: () => {
|
|
4036
4057
|
var h, m;
|
|
4037
|
-
|
|
4058
|
+
ie.scrollToEnd(), (m = ((h = a.current) == null ? void 0 : h.querySelector('li[tabindex="-1"]')) ?? a.current) == null || m.focus({
|
|
4038
4059
|
preventScroll: !0
|
|
4039
4060
|
});
|
|
4040
4061
|
},
|
|
4041
|
-
children: u(
|
|
4062
|
+
children: u(Dn, {})
|
|
4042
4063
|
})
|
|
4043
4064
|
})]
|
|
4044
|
-
}), u(
|
|
4065
|
+
}), u(Ua, {
|
|
4045
4066
|
logger: e,
|
|
4046
4067
|
analytics: t
|
|
4047
4068
|
})]
|
|
4048
4069
|
});
|
|
4049
|
-
},
|
|
4070
|
+
}, ci = ({
|
|
4050
4071
|
undoFn: e
|
|
4051
4072
|
}) => {
|
|
4052
4073
|
const {
|
|
4053
4074
|
t: r
|
|
4054
|
-
} =
|
|
4075
|
+
} = ee();
|
|
4055
4076
|
return u("div", {
|
|
4056
4077
|
class: "flex flex-1 items-center justify-end px-1",
|
|
4057
|
-
children: u(
|
|
4078
|
+
children: u(Dr, {
|
|
4058
4079
|
"aria-label": r("undo"),
|
|
4059
4080
|
onClick: async () => {
|
|
4060
4081
|
const {
|
|
4061
4082
|
flow: t
|
|
4062
|
-
} =
|
|
4083
|
+
} = K.current$.peek();
|
|
4063
4084
|
Ne(t), e(t.data.nodeHistory);
|
|
4064
4085
|
},
|
|
4065
4086
|
children: u("path", {
|
|
@@ -4069,5 +4090,5 @@ const Xe = /* @__PURE__ */ ja(za), Ka = /(\[[^\]]+\]\([^)]+\))/g, Ga = /\[([^\]]
|
|
|
4069
4090
|
});
|
|
4070
4091
|
};
|
|
4071
4092
|
export {
|
|
4072
|
-
|
|
4093
|
+
hi as ChatbotBody
|
|
4073
4094
|
};
|