@inploi/plugin-chatbot 14.10.5 → 14.12.0
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 +4 -4
- package/dist/chatbot-body-17336a50.cjs +5 -0
- package/dist/{chatbot-body-79e96f30.js → chatbot-body-abed7b51.js} +1041 -1043
- package/dist/chatbot.d.ts +6 -0
- package/dist/chatbot.idb.d.ts +19 -0
- package/dist/i18n.d.ts +24 -18
- package/dist/index-95bb500a.cjs +5 -0
- package/dist/{index-bf148ac8.js → index-d1649bc5.js} +479 -461
- package/dist/plugin-chatbot.cjs +1 -1
- package/dist/plugin-chatbot.js +1 -1
- package/package.json +4 -4
- package/dist/chatbot-body-bcd93147.cjs +0 -5
- package/dist/index-fdcebcd0.cjs +0 -5
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
var Sn = Object.defineProperty;
|
|
2
|
-
var
|
|
3
|
-
var Y = (e, r, t) => (
|
|
4
|
-
import { u as
|
|
2
|
+
var En = (e, r, t) => r in e ? Sn(e, r, { enumerable: !0, configurable: !0, writable: !0, value: t }) : e[r] = t;
|
|
3
|
+
var Y = (e, r, t) => (En(e, typeof r != "symbol" ? r + "" : r, t), t);
|
|
4
|
+
import { u as Br, p as vt, D as Dt, l as Ge, f as $r, T as jr, a as An, E as In, N as Fn, I as Pr, C as Vn, s as Mn, g as Ln, S as Nn, U as nr, $ as sr, R as Rn, w as ar, m as Tn, y as Dn, b as qr, k as On, x as Bn, h as $n, z as jn, Z as Ur, H as Pn, v as qn, c as q, d as ne, o as c, e as Qe, i as xt, j as _e, _ as ye, n as Oe, q as Me, r as Ce, L as Ut, F as Un, t as Wr, A as zr, B as Wn, G as et, J as ir, K as ae, M as ce, O as zn, P as Hn, Q as Kn, V as Gn, W as Hr, X as Jn } from "./index-d1649bc5.js";
|
|
5
5
|
import "@inploi/sdk";
|
|
6
|
-
var Zn = "9.
|
|
6
|
+
var Zn = "9.9.1", Kr = `https://sdk.inploi.com/@inploi/flows@${Zn}/cdn/captcha/index.html`, Xn = new URL(Kr).origin, or = 3e4, Yn = 5 * 6e4, Qn = (e) => typeof e == "object" && e !== null && e.source === "inploi-captcha", Ft = /* @__PURE__ */ new WeakMap(), es = (e) => {
|
|
7
7
|
let r = Ft.get(e);
|
|
8
8
|
return r || (r = e.fetch("/flow/captcha").then((t) => {
|
|
9
9
|
let n = t == null ? void 0 : t.site_key;
|
|
@@ -13,58 +13,58 @@ var Zn = "9.8.2", Wr = `https://sdk.inploi.com/@inploi/flows@${Zn}/cdn/captcha/i
|
|
|
13
13
|
}), Ft.set(e, r)), r;
|
|
14
14
|
}, ts = (e, r = {}) => new Promise((t, n) => {
|
|
15
15
|
let { signal: s, container: i = null, theme: a, onInteractive: o } = r instanceof AbortSignal ? { signal: r } : r, u = !1, f = () => {
|
|
16
|
-
},
|
|
17
|
-
u || (u = !0, clearTimeout(
|
|
18
|
-
},
|
|
19
|
-
clearTimeout(
|
|
16
|
+
}, v = (_) => {
|
|
17
|
+
u || (u = !0, clearTimeout(y), s == null || s.removeEventListener("abort", p), f(), _());
|
|
18
|
+
}, b = (_) => v(() => n(new Error(_))), p = () => b("Captcha aborted"), y, C = (_) => {
|
|
19
|
+
clearTimeout(y), y = setTimeout(() => b("Captcha timed out"), _);
|
|
20
20
|
};
|
|
21
|
-
if (
|
|
21
|
+
if (C(or), s == null ? void 0 : s.aborted)
|
|
22
22
|
return p();
|
|
23
23
|
s == null || s.addEventListener("abort", p), (async () => {
|
|
24
|
-
let
|
|
25
|
-
if (
|
|
26
|
-
return
|
|
24
|
+
let _ = await es(e);
|
|
25
|
+
if (_ === void 0)
|
|
26
|
+
return v(() => t(void 0));
|
|
27
27
|
if (u)
|
|
28
28
|
return;
|
|
29
29
|
let k = document.createElement("iframe");
|
|
30
|
-
k.src = `${
|
|
31
|
-
let
|
|
32
|
-
if (!k.contentWindow ||
|
|
30
|
+
k.src = `${Kr}?${new URLSearchParams({ sitekey: _, origin: window.location.origin, ...a && { theme: a } }).toString()}`, k.title = "Cloudflare security check", k.style.cssText = `display:block;border:0;width:${i ? "100%" : "300px"};height:0;color-scheme:normal`, i ? i.appendChild(k) : (k.style.cssText += ";position:fixed;bottom:16px;right:16px;z-index:2147483647", document.body.appendChild(k));
|
|
31
|
+
let E = !1, g = (N) => {
|
|
32
|
+
if (!k.contentWindow || N.source !== k.contentWindow || N.origin !== Xn || !Qn(N.data))
|
|
33
33
|
return;
|
|
34
|
-
let
|
|
35
|
-
switch (
|
|
34
|
+
let V = N.data;
|
|
35
|
+
switch (V.type) {
|
|
36
36
|
case "token":
|
|
37
|
-
return
|
|
37
|
+
return v(() => t(V.token));
|
|
38
38
|
case "resize":
|
|
39
|
-
k.style.height = `${Math.max(0, Math.ceil(
|
|
39
|
+
k.style.height = `${Math.max(0, Math.ceil(V.height))}px`;
|
|
40
40
|
return;
|
|
41
41
|
case "before-interactive":
|
|
42
|
-
return
|
|
42
|
+
return E = !0, C(Yn), o == null ? void 0 : o();
|
|
43
43
|
case "after-interactive":
|
|
44
|
-
return
|
|
44
|
+
return E = !1, C(or);
|
|
45
45
|
case "error":
|
|
46
|
-
!
|
|
46
|
+
!E && !V.interactive && b("Captcha failed");
|
|
47
47
|
return;
|
|
48
48
|
case "expired":
|
|
49
|
-
return
|
|
49
|
+
return b("Captcha expired");
|
|
50
50
|
case "timeout":
|
|
51
|
-
return
|
|
51
|
+
return b("Captcha timed out");
|
|
52
52
|
}
|
|
53
53
|
};
|
|
54
|
-
window.addEventListener("message",
|
|
55
|
-
window.removeEventListener("message",
|
|
54
|
+
window.addEventListener("message", g), f = () => {
|
|
55
|
+
window.removeEventListener("message", g), k.remove();
|
|
56
56
|
};
|
|
57
|
-
})().catch((
|
|
58
|
-
}),
|
|
57
|
+
})().catch((_) => v(() => n(_)));
|
|
58
|
+
}), lr = ({ condition: e, context: r, submissions: t, ifBlock: n }) => {
|
|
59
59
|
let [s, ...i] = e.compareKey.split(".");
|
|
60
60
|
if (!s)
|
|
61
61
|
return !1;
|
|
62
|
-
let a =
|
|
62
|
+
let a = Br({ context: r, key: s, path: i, submissions: t });
|
|
63
63
|
if (!a)
|
|
64
64
|
return !1;
|
|
65
65
|
switch (a.type) {
|
|
66
66
|
case "address": {
|
|
67
|
-
let o =
|
|
67
|
+
let o = Dt(a.value, i);
|
|
68
68
|
switch (e.compare) {
|
|
69
69
|
case "equals":
|
|
70
70
|
return o === e.compareValue;
|
|
@@ -80,7 +80,7 @@ var Zn = "9.8.2", Wr = `https://sdk.inploi.com/@inploi/flows@${Zn}/cdn/captcha/i
|
|
|
80
80
|
case "integration": {
|
|
81
81
|
if (typeof a.value != "object" || Array.isArray(a.value))
|
|
82
82
|
return !1;
|
|
83
|
-
let o =
|
|
83
|
+
let o = Dt(a.value, i), u = { ...n, data: { compareKey: "_temp", compare: e.compare, compareValue: e.compareValue } };
|
|
84
84
|
switch (typeof o) {
|
|
85
85
|
case "boolean":
|
|
86
86
|
return lt(u, { submissions: { _temp: { value: o, type: "boolean" } }, context: r });
|
|
@@ -157,24 +157,24 @@ var Zn = "9.8.2", Wr = `https://sdk.inploi.com/@inploi/flows@${Zn}/cdn/captcha/i
|
|
|
157
157
|
let n = "combinator" in e.data ? e.data.conditions : [e.data];
|
|
158
158
|
if (("combinator" in e.data ? e.data.combinator : "and") === "or") {
|
|
159
159
|
for (let s of n)
|
|
160
|
-
if (
|
|
160
|
+
if (lr({ condition: s, context: r, submissions: t, ifBlock: e }))
|
|
161
161
|
return !0;
|
|
162
162
|
return !1;
|
|
163
163
|
} else {
|
|
164
164
|
for (let s of n)
|
|
165
|
-
if (!
|
|
165
|
+
if (!lr({ condition: s, context: r, submissions: t, ifBlock: e }))
|
|
166
166
|
return !1;
|
|
167
167
|
return !0;
|
|
168
168
|
}
|
|
169
169
|
}, rs = /{{\s*([^}]+?)\s*(?:\|\s*([^}]+?)\s*)?}}/g, ns = (e, { context: r, submissions: t }) => e.replace(rs, (n, s, i = "") => {
|
|
170
|
-
let [a, ...o] = s.trim().split("."), u =
|
|
170
|
+
let [a, ...o] = s.trim().split("."), u = Br({ key: a, path: o, submissions: t, context: r });
|
|
171
171
|
if (!u)
|
|
172
172
|
return i;
|
|
173
173
|
switch (u.type) {
|
|
174
174
|
case "boolean":
|
|
175
175
|
return u.value === !0 ? "true" : "false";
|
|
176
176
|
case "file":
|
|
177
|
-
return u.value.map((f) => `${f.name} (${
|
|
177
|
+
return u.value.map((f) => `${f.name} (${Ge(f.sizeKb)})`).join(", ");
|
|
178
178
|
case "enum":
|
|
179
179
|
return u.value.join(", ");
|
|
180
180
|
case "address":
|
|
@@ -187,7 +187,7 @@ var Zn = "9.8.2", Wr = `https://sdk.inploi.com/@inploi/flows@${Zn}/cdn/captcha/i
|
|
|
187
187
|
case "integration": {
|
|
188
188
|
if (typeof u.value != "object" || Array.isArray(u.value))
|
|
189
189
|
break;
|
|
190
|
-
let f =
|
|
190
|
+
let f = Dt(u.value, o);
|
|
191
191
|
switch (typeof f) {
|
|
192
192
|
case "boolean":
|
|
193
193
|
return f === !0 ? "true" : "false";
|
|
@@ -196,7 +196,7 @@ var Zn = "9.8.2", Wr = `https://sdk.inploi.com/@inploi/flows@${Zn}/cdn/captcha/i
|
|
|
196
196
|
case "number":
|
|
197
197
|
return f.toString();
|
|
198
198
|
case "object":
|
|
199
|
-
if (Array.isArray(f) && f.every((
|
|
199
|
+
if (Array.isArray(f) && f.every((v) => typeof v == "string"))
|
|
200
200
|
return f.join(", ");
|
|
201
201
|
}
|
|
202
202
|
break;
|
|
@@ -208,7 +208,7 @@ var Zn = "9.8.2", Wr = `https://sdk.inploi.com/@inploi/flows@${Zn}/cdn/captcha/i
|
|
|
208
208
|
function ss(e) {
|
|
209
209
|
return e instanceof Uint8Array || ArrayBuffer.isView(e) && e.constructor.name === "Uint8Array";
|
|
210
210
|
}
|
|
211
|
-
function
|
|
211
|
+
function Wt(e, r, t = "") {
|
|
212
212
|
const n = ss(e), s = e == null ? void 0 : e.length, i = r !== void 0;
|
|
213
213
|
if (!n || i && s !== r) {
|
|
214
214
|
const a = t && `"${t}" `, o = i ? ` of length ${r}` : "", u = n ? `length=${s}` : `type=${typeof e}`;
|
|
@@ -216,14 +216,14 @@ function Ut(e, r, t = "") {
|
|
|
216
216
|
}
|
|
217
217
|
return e;
|
|
218
218
|
}
|
|
219
|
-
function
|
|
219
|
+
function cr(e, r = !0) {
|
|
220
220
|
if (e.destroyed)
|
|
221
221
|
throw new Error("Hash instance has been destroyed");
|
|
222
222
|
if (r && e.finished)
|
|
223
223
|
throw new Error("Hash#digest() has already been called");
|
|
224
224
|
}
|
|
225
225
|
function as(e, r) {
|
|
226
|
-
|
|
226
|
+
Wt(e, void 0, "digestInto() output");
|
|
227
227
|
const t = r.outputLen;
|
|
228
228
|
if (e.length < t)
|
|
229
229
|
throw new Error('"digestInto() output" expected to be of length >=' + t);
|
|
@@ -243,7 +243,7 @@ const is = /* @__PURE__ */ (() => (
|
|
|
243
243
|
typeof Uint8Array.from([]).toHex == "function" && typeof Uint8Array.fromHex == "function"
|
|
244
244
|
))(), os = /* @__PURE__ */ Array.from({ length: 256 }, (e, r) => r.toString(16).padStart(2, "0"));
|
|
245
245
|
function ls(e) {
|
|
246
|
-
if (
|
|
246
|
+
if (Wt(e), is)
|
|
247
247
|
return e.toHex();
|
|
248
248
|
let r = "";
|
|
249
249
|
for (let t = 0; t < e.length; t++)
|
|
@@ -279,7 +279,7 @@ class hs {
|
|
|
279
279
|
this.blockLen = r, this.outputLen = t, this.padOffset = n, this.isLE = s, this.buffer = new Uint8Array(r), this.view = Vt(this.buffer);
|
|
280
280
|
}
|
|
281
281
|
update(r) {
|
|
282
|
-
|
|
282
|
+
cr(this), Wt(r);
|
|
283
283
|
const { view: t, buffer: n, blockLen: s } = this, i = r.length;
|
|
284
284
|
for (let a = 0; a < i; ) {
|
|
285
285
|
const o = Math.min(s - this.pos, i - a);
|
|
@@ -294,21 +294,21 @@ class hs {
|
|
|
294
294
|
return this.length += r.length, this.roundClean(), this;
|
|
295
295
|
}
|
|
296
296
|
digestInto(r) {
|
|
297
|
-
|
|
297
|
+
cr(this), as(r, this), this.finished = !0;
|
|
298
298
|
const { buffer: t, view: n, blockLen: s, isLE: i } = this;
|
|
299
299
|
let { pos: a } = this;
|
|
300
300
|
t[a++] = 128, Ot(this.buffer.subarray(a)), this.padOffset > s - a && (this.process(n, 0), a = 0);
|
|
301
|
-
for (let
|
|
302
|
-
t[
|
|
301
|
+
for (let b = a; b < s; b++)
|
|
302
|
+
t[b] = 0;
|
|
303
303
|
n.setBigUint64(s - 8, BigInt(this.length * 8), i), this.process(n, 0);
|
|
304
304
|
const o = Vt(r), u = this.outputLen;
|
|
305
305
|
if (u % 4)
|
|
306
306
|
throw new Error("_sha2: outputLen must be aligned to 32bit");
|
|
307
|
-
const f = u / 4,
|
|
308
|
-
if (f >
|
|
307
|
+
const f = u / 4, v = this.get();
|
|
308
|
+
if (f > v.length)
|
|
309
309
|
throw new Error("_sha2: outputLen bigger than state");
|
|
310
|
-
for (let
|
|
311
|
-
o.setUint32(4 *
|
|
310
|
+
for (let b = 0; b < f; b++)
|
|
311
|
+
o.setUint32(4 * b, v[b], i);
|
|
312
312
|
}
|
|
313
313
|
digest() {
|
|
314
314
|
const { buffer: r, outputLen: t } = this;
|
|
@@ -325,7 +325,7 @@ class hs {
|
|
|
325
325
|
return this._cloneInto();
|
|
326
326
|
}
|
|
327
327
|
}
|
|
328
|
-
const
|
|
328
|
+
const Ae = /* @__PURE__ */ Uint32Array.from([
|
|
329
329
|
1779033703,
|
|
330
330
|
3144134277,
|
|
331
331
|
1013904242,
|
|
@@ -399,7 +399,7 @@ const Ie = /* @__PURE__ */ Uint32Array.from([
|
|
|
399
399
|
2756734187,
|
|
400
400
|
3204031479,
|
|
401
401
|
3329325298
|
|
402
|
-
]),
|
|
402
|
+
]), Ie = /* @__PURE__ */ new Uint32Array(64);
|
|
403
403
|
class ms extends hs {
|
|
404
404
|
constructor(r) {
|
|
405
405
|
super(64, r, 8, !1);
|
|
@@ -413,21 +413,21 @@ class ms extends hs {
|
|
|
413
413
|
this.A = r | 0, this.B = t | 0, this.C = n | 0, this.D = s | 0, this.E = i | 0, this.F = a | 0, this.G = o | 0, this.H = u | 0;
|
|
414
414
|
}
|
|
415
415
|
process(r, t) {
|
|
416
|
-
for (let
|
|
417
|
-
|
|
418
|
-
for (let
|
|
419
|
-
const p =
|
|
420
|
-
|
|
416
|
+
for (let b = 0; b < 16; b++, t += 4)
|
|
417
|
+
Ie[b] = r.getUint32(t, !1);
|
|
418
|
+
for (let b = 16; b < 64; b++) {
|
|
419
|
+
const p = Ie[b - 15], y = Ie[b - 2], C = pe(p, 7) ^ pe(p, 18) ^ p >>> 3, _ = pe(y, 17) ^ pe(y, 19) ^ y >>> 10;
|
|
420
|
+
Ie[b] = _ + Ie[b - 7] + C + Ie[b - 16] | 0;
|
|
421
421
|
}
|
|
422
|
-
let { A: n, B: s, C: i, D: a, E: o, F: u, G: f, H:
|
|
423
|
-
for (let
|
|
424
|
-
const p = pe(o, 6) ^ pe(o, 11) ^ pe(o, 25),
|
|
425
|
-
|
|
422
|
+
let { A: n, B: s, C: i, D: a, E: o, F: u, G: f, H: v } = this;
|
|
423
|
+
for (let b = 0; b < 64; b++) {
|
|
424
|
+
const p = pe(o, 6) ^ pe(o, 11) ^ pe(o, 25), y = v + p + ds(o, u, f) + ps[b] + Ie[b] | 0, _ = (pe(n, 2) ^ pe(n, 13) ^ pe(n, 22)) + fs(n, s, i) | 0;
|
|
425
|
+
v = f, f = u, u = o, o = a + y | 0, a = i, i = s, s = n, n = y + _ | 0;
|
|
426
426
|
}
|
|
427
|
-
n = n + this.A | 0, s = s + this.B | 0, i = i + this.C | 0, a = a + this.D | 0, o = o + this.E | 0, u = u + this.F | 0, f = f + this.G | 0,
|
|
427
|
+
n = n + this.A | 0, s = s + this.B | 0, i = i + this.C | 0, a = a + this.D | 0, o = o + this.E | 0, u = u + this.F | 0, f = f + this.G | 0, v = v + this.H | 0, this.set(n, s, i, a, o, u, f, v);
|
|
428
428
|
}
|
|
429
429
|
roundClean() {
|
|
430
|
-
Ot(
|
|
430
|
+
Ot(Ie);
|
|
431
431
|
}
|
|
432
432
|
destroy() {
|
|
433
433
|
this.set(0, 0, 0, 0, 0, 0, 0, 0), Ot(this.buffer);
|
|
@@ -438,26 +438,26 @@ class ys extends ms {
|
|
|
438
438
|
super(32);
|
|
439
439
|
// We cannot use array here since array allows indexing by variable
|
|
440
440
|
// which means optimizer/compiler cannot use registers.
|
|
441
|
-
Y(this, "A",
|
|
442
|
-
Y(this, "B",
|
|
443
|
-
Y(this, "C",
|
|
444
|
-
Y(this, "D",
|
|
445
|
-
Y(this, "E",
|
|
446
|
-
Y(this, "F",
|
|
447
|
-
Y(this, "G",
|
|
448
|
-
Y(this, "H",
|
|
441
|
+
Y(this, "A", Ae[0] | 0);
|
|
442
|
+
Y(this, "B", Ae[1] | 0);
|
|
443
|
+
Y(this, "C", Ae[2] | 0);
|
|
444
|
+
Y(this, "D", Ae[3] | 0);
|
|
445
|
+
Y(this, "E", Ae[4] | 0);
|
|
446
|
+
Y(this, "F", Ae[5] | 0);
|
|
447
|
+
Y(this, "G", Ae[6] | 0);
|
|
448
|
+
Y(this, "H", Ae[7] | 0);
|
|
449
449
|
}
|
|
450
450
|
}
|
|
451
451
|
const bs = /* @__PURE__ */ cs(
|
|
452
452
|
() => new ys(),
|
|
453
453
|
/* @__PURE__ */ us(1)
|
|
454
454
|
);
|
|
455
|
-
var
|
|
455
|
+
var Gr = (e) => {
|
|
456
456
|
let r = e.find((t) => t.isHead);
|
|
457
457
|
if (!r)
|
|
458
458
|
throw new Error("No head node found");
|
|
459
459
|
return r;
|
|
460
|
-
},
|
|
460
|
+
}, zt = (e) => {
|
|
461
461
|
var r, t;
|
|
462
462
|
if (!(e.data.isFinished || (r = e.data.startedWriteNodeIds) != null && r.length))
|
|
463
463
|
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;
|
|
@@ -478,12 +478,12 @@ function vs(e, r, t, n) {
|
|
|
478
478
|
clearTimeout(u);
|
|
479
479
|
});
|
|
480
480
|
}
|
|
481
|
-
var
|
|
481
|
+
var Jr = ({ context: e, submissions: r }) => ({ context: e, submissions: r ?? {} }), he = (e, r) => ns(e, Jr(r)), xs = (e, r) => lt(e, Jr(r)), Zr = ({ node: e, nodes: r, stopWhen: t }) => {
|
|
482
482
|
if ((t == null ? void 0 : t(e)) === !0)
|
|
483
483
|
return e;
|
|
484
484
|
let n = e.nextId ? r.find((s) => s.id === e.nextId) : void 0;
|
|
485
485
|
if (n)
|
|
486
|
-
return
|
|
486
|
+
return Zr({ node: n, nodes: r, stopWhen: t });
|
|
487
487
|
}, ws = ({ childNode: e, nodes: r }) => {
|
|
488
488
|
let t = r.filter((n) => n.type === "if-block").find((n) => {
|
|
489
489
|
if (!n.branchId)
|
|
@@ -491,80 +491,80 @@ var Gr = ({ context: e, submissions: r }) => ({ context: e, submissions: r ?? {}
|
|
|
491
491
|
let s = r.find((a) => a.id === n.branchId);
|
|
492
492
|
if (!s)
|
|
493
493
|
return !1;
|
|
494
|
-
let i =
|
|
494
|
+
let i = Zr({ node: s, nodes: r, stopWhen: (a) => a.id === e.id });
|
|
495
495
|
return !(!i || i.id !== e.id);
|
|
496
496
|
});
|
|
497
497
|
if (t != null && t.nextId)
|
|
498
498
|
return r.find((n) => n.id === t.nextId);
|
|
499
|
-
}, _s = 3, ks = ({ flow: e, analytics: r, logger: t, talentBankClient: n, context: s, apiClient: i, getSubmissions: a, getApplicationRecovery: o, setApplicationRecovery: u, chatService: f, persistWriteBarrier:
|
|
499
|
+
}, _s = 3, ks = ({ flow: e, analytics: r, logger: t, talentBankClient: n, context: s, apiClient: i, getSubmissions: a, getApplicationRecovery: o, setApplicationRecovery: u, chatService: f, persistWriteBarrier: v, onSubmitNetworkError: b, closedRoleBehaviour: p, settledOutcomes: y = p, dateEchoLocale: C, onFlowEnd: _, onInterpret: k, forceSubmitConfirmation: E, flowType: g, t: N }) => {
|
|
500
500
|
var V;
|
|
501
|
-
let
|
|
501
|
+
let M = new AbortController(), O = { submitAccepted: !1 };
|
|
502
502
|
(V = e.data).startedWriteNodeIds ?? (V.startedWriteNodeIds = e.nodes.flatMap((T) => {
|
|
503
|
-
var
|
|
503
|
+
var B, I;
|
|
504
504
|
if (T.type !== "integration-application-submit" || !e.data.nodeHistory.includes(T.id))
|
|
505
505
|
return [];
|
|
506
|
-
let
|
|
507
|
-
return (
|
|
506
|
+
let R = T.data.key ? (B = a()) == null ? void 0 : B[T.data.key] : void 0;
|
|
507
|
+
return (R == null ? void 0 : R.type) === "integration" && ((I = $r(R.value)) == null ? void 0 : I.verdict) === "not_submitted" ? [] : [T.id];
|
|
508
508
|
}));
|
|
509
|
-
let
|
|
510
|
-
let
|
|
511
|
-
if (
|
|
509
|
+
let K = { ...r.service, log: (T) => r.service.log({ ...T, customProperties: { ...T.customProperties, ...r.customProperties } }) }, ee = async (T, R) => {
|
|
510
|
+
let B = M.signal;
|
|
511
|
+
if (B.aborted)
|
|
512
512
|
return;
|
|
513
|
-
let
|
|
514
|
-
var
|
|
515
|
-
return
|
|
513
|
+
let I = a(), F = o(), j = (F == null ? void 0 : F.submitNodeId) === T.id ? e.nodes.find((L) => {
|
|
514
|
+
var W;
|
|
515
|
+
return L.id === F.fileQuestionNodeId && L.type === "question-file" && ((W = I == null ? void 0 : I[L.data.key]) == null ? void 0 : W.type) !== "file";
|
|
516
516
|
}) : void 0;
|
|
517
|
-
if (
|
|
518
|
-
return
|
|
519
|
-
|
|
517
|
+
if (j)
|
|
518
|
+
return ee(j, R);
|
|
519
|
+
k == null || k(T, R);
|
|
520
520
|
try {
|
|
521
|
-
await Cs({ flow: e, analytics:
|
|
522
|
-
if (!
|
|
521
|
+
await Cs({ flow: e, analytics: K, logger: t, talentBankClient: n, apiClient: i, context: s, node: T, submissions: I, applicationRecovery: F, setApplicationRecovery: async (L) => {
|
|
522
|
+
if (!B.aborted)
|
|
523
523
|
try {
|
|
524
|
-
await u(
|
|
525
|
-
} catch (
|
|
526
|
-
t.error("Failed to persist application recovery",
|
|
524
|
+
await u(L);
|
|
525
|
+
} catch (W) {
|
|
526
|
+
t.error("Failed to persist application recovery", W);
|
|
527
527
|
}
|
|
528
|
-
}, forceSubmitConfirmation:
|
|
529
|
-
|
|
530
|
-
}, captcha: f.captcha }, next: (
|
|
531
|
-
if (
|
|
528
|
+
}, forceSubmitConfirmation: E || (F == null ? void 0 : F.submitNodeId) === T.id, run: O, persistWriteBarrier: v, onSubmitNetworkError: b, settledOutcomes: y, dateEchoLocale: C, flowType: g, signal: B, t: N, chat: { sendMessage: async (L) => f.send({ groupId: T.id, message: L, signal: B }), userInput: async (L) => f.input({ input: L, signal: B }), setSubmission: (L, W) => {
|
|
529
|
+
B.aborted || f.setSubmission(L, W);
|
|
530
|
+
}, captcha: f.captcha }, next: (L) => {
|
|
531
|
+
if (B.aborted)
|
|
532
532
|
return;
|
|
533
|
-
let
|
|
534
|
-
return
|
|
533
|
+
let W = (F == null ? void 0 : F.fileQuestionNodeId) === T.id ? F.submitNodeId : L, U = W ? e.nodes.find((te) => te.id === W) : ws({ childNode: T, nodes: e.nodes });
|
|
534
|
+
return U ? ee(U, T) : _ == null ? void 0 : _(T);
|
|
535
535
|
}, end: () => {
|
|
536
|
-
|
|
536
|
+
B.aborted || (_ == null || _(T));
|
|
537
537
|
} });
|
|
538
|
-
} catch (
|
|
539
|
-
if (
|
|
538
|
+
} catch (L) {
|
|
539
|
+
if (L instanceof jr)
|
|
540
540
|
return;
|
|
541
|
-
throw
|
|
541
|
+
throw L;
|
|
542
542
|
}
|
|
543
543
|
};
|
|
544
544
|
return { interpret: async (T) => {
|
|
545
|
-
let
|
|
546
|
-
return
|
|
545
|
+
let R = e.nodes.find((B) => B.id === T) ?? Gr(e.nodes);
|
|
546
|
+
return ee(R);
|
|
547
547
|
}, undo: (T) => {
|
|
548
|
-
var
|
|
549
|
-
if (delete e.data.reviewReplay, ((
|
|
548
|
+
var W;
|
|
549
|
+
if (delete e.data.reviewReplay, ((W = e.data.startedWriteNodeIds) == null ? void 0 : W.length) || e.data.isFinished)
|
|
550
550
|
return { removed: 0 };
|
|
551
|
-
let
|
|
552
|
-
if (
|
|
551
|
+
let R = zt(e), B = R ? T.lastIndexOf(R) : -1, I = e.nodes.find((U) => U.id === R);
|
|
552
|
+
if (B === -1 || !I)
|
|
553
553
|
return { removed: 0 };
|
|
554
|
-
let
|
|
555
|
-
|
|
556
|
-
let
|
|
557
|
-
e.data.messages = e.data.messages.filter((
|
|
558
|
-
let
|
|
559
|
-
for (let
|
|
560
|
-
let
|
|
561
|
-
if (!(!
|
|
562
|
-
for (let
|
|
563
|
-
typeof
|
|
554
|
+
let F = e.nodes.find((U) => U.id === T[T.length - 1]);
|
|
555
|
+
M.abort();
|
|
556
|
+
let j = T.splice(B);
|
|
557
|
+
e.data.messages = e.data.messages.filter((U) => !U.groupId || !j.includes(U.groupId)), e.data.currentInput = null;
|
|
558
|
+
let L = a();
|
|
559
|
+
for (let U of j.slice(1)) {
|
|
560
|
+
let te = e.nodes.find((X) => X.id === U);
|
|
561
|
+
if (!(!te || !L || te.id === R) && ("key" in te.data && te.data.key && delete L[te.data.key], "keys" in te.data))
|
|
562
|
+
for (let X of Object.values(te.data.keys))
|
|
563
|
+
typeof X == "string" && delete L[X];
|
|
564
564
|
}
|
|
565
|
-
return
|
|
565
|
+
return M = new AbortController(), ee(I, F), { removed: j.length };
|
|
566
566
|
}, abort: () => {
|
|
567
|
-
|
|
567
|
+
M.abort();
|
|
568
568
|
} };
|
|
569
569
|
};
|
|
570
570
|
async function Cs(e) {
|
|
@@ -591,23 +591,23 @@ async function Cs(e) {
|
|
|
591
591
|
case "question-file":
|
|
592
592
|
return zs({ ...e, node: r });
|
|
593
593
|
case "question-address":
|
|
594
|
-
return Hs({ ...e, node: r });
|
|
595
|
-
case "end-flow":
|
|
596
594
|
return Ws({ ...e, node: r });
|
|
595
|
+
case "end-flow":
|
|
596
|
+
return Hs({ ...e, node: r });
|
|
597
597
|
case "if-block":
|
|
598
|
-
return
|
|
598
|
+
return Ds({ ...e, node: r });
|
|
599
599
|
case "jump":
|
|
600
|
-
return
|
|
600
|
+
return As({ ...e, node: r });
|
|
601
601
|
case "link":
|
|
602
602
|
return Ts({ ...e, node: r });
|
|
603
603
|
case "integration-application-submit":
|
|
604
|
-
return
|
|
604
|
+
return Rs({ ...e, node: r });
|
|
605
605
|
case "add-submission":
|
|
606
|
-
return
|
|
606
|
+
return Is({ ...e, node: r });
|
|
607
607
|
case "integration-workflow-get":
|
|
608
608
|
throw Error("Workflow should be unreachable");
|
|
609
609
|
case "check-duplicate":
|
|
610
|
-
return
|
|
610
|
+
return Es({ ...e, node: r });
|
|
611
611
|
case "feedback":
|
|
612
612
|
return Ss({ ...e, node: r });
|
|
613
613
|
default:
|
|
@@ -617,136 +617,134 @@ async function Cs(e) {
|
|
|
617
617
|
async function Ss({ next: e, node: r }) {
|
|
618
618
|
e(r.nextId);
|
|
619
619
|
}
|
|
620
|
-
async function
|
|
620
|
+
async function Es({ next: e, node: r, talentBankClient: t, submissions: n, flow: s, logger: i, chat: a }) {
|
|
621
621
|
var u;
|
|
622
622
|
let o = { isDuplicate: !1 };
|
|
623
623
|
if (n && t) {
|
|
624
624
|
let f = r.data.scope === "job" ? (u = s.job) == null ? void 0 : u.id : void 0;
|
|
625
625
|
if (r.data.scope === "company" || f != null)
|
|
626
626
|
try {
|
|
627
|
-
o = await t.checkDuplicate({ email:
|
|
628
|
-
} catch (
|
|
629
|
-
i.error("[check-duplicate]",
|
|
627
|
+
o = await t.checkDuplicate({ email: An({ key: r.data.email, submissions: n }).toString(), jobId: f, scope: r.data.scope });
|
|
628
|
+
} catch (v) {
|
|
629
|
+
i.error("[check-duplicate]", v);
|
|
630
630
|
}
|
|
631
631
|
}
|
|
632
632
|
a.setSubmission(r.data.key, { type: "integration", value: o }), e(r.nextId);
|
|
633
633
|
}
|
|
634
|
-
async function
|
|
634
|
+
async function As({ next: e, node: r }) {
|
|
635
635
|
e(r.data.targetId);
|
|
636
636
|
}
|
|
637
|
-
async function
|
|
637
|
+
async function Is({ next: e, node: r, logger: t, submissions: n, context: s }) {
|
|
638
638
|
if (!n) {
|
|
639
639
|
t.error("Submissions not found");
|
|
640
640
|
return;
|
|
641
641
|
}
|
|
642
642
|
n[r.data.key] = { type: "string", value: he(r.data.value, { submissions: n, context: s }) }, e(r.nextId);
|
|
643
643
|
}
|
|
644
|
-
var Fs = 5e3, Vs = (e, r) => r ? `${e}@${r.id_type}:${r.id}` : e, Ms = (e, r = Date.now()) => Math.min(e.until, r + (e.maintenance ? jn : e.throttles ?
|
|
644
|
+
var Fs = 5e3, Vs = (e, r) => r ? `${e}@${r.id_type}:${r.id}` : e, Ms = (e, r = Date.now()) => Math.min(e.until, r + (e.maintenance ? jn : e.throttles ? Ur : Pn)), Ls = (e, r, t) => {
|
|
645
645
|
let { waitMs: n, throttles: s, maintenance: i } = qn(r == null ? void 0 : r.throttles, t);
|
|
646
646
|
return { key: e, until: Date.now() + n, ...s !== void 0 && { throttles: s }, ...i && { maintenance: i } };
|
|
647
|
-
},
|
|
648
|
-
let r =
|
|
647
|
+
}, Ns = ["ApiError", "NotFoundError", "UnauthorisedError", "SchemaValidationError", "ParsingError"], $t = (e) => e instanceof Error && Ns.includes(e.name) ? e : void 0, ur = (e) => {
|
|
648
|
+
let r = $t(e);
|
|
649
649
|
return (r == null ? void 0 : r.name) === "ApiError" ? r : void 0;
|
|
650
650
|
};
|
|
651
|
-
async function
|
|
652
|
-
var
|
|
653
|
-
let
|
|
654
|
-
let { anonymous_id:
|
|
655
|
-
await e.sendMessage({ type: "text", author: "bot", text:
|
|
651
|
+
async function Rs({ chat: e, next: r, end: t, node: n, logger: s, apiClient: i, submissions: a, analytics: o, flow: u, applicationRecovery: f, setApplicationRecovery: v, forceSubmitConfirmation: b, flowType: p, run: y, persistWriteBarrier: C, signal: _, onSubmitNetworkError: k, settledOutcomes: E, t: g }) {
|
|
652
|
+
var ee, T;
|
|
653
|
+
let N = async ({ redirect_url: R, message: B, button_text: I }) => {
|
|
654
|
+
let { anonymous_id: F, session_id: j } = o.getSessionInfo();
|
|
655
|
+
await e.sendMessage({ type: "text", author: "bot", text: B ?? g("submission_redirect_message") });
|
|
656
656
|
try {
|
|
657
|
-
let
|
|
658
|
-
|
|
659
|
-
if (!
|
|
657
|
+
let L = new URL(R);
|
|
658
|
+
F && !L.searchParams.has("anonymous_id") && L.searchParams.set("anonymous_id", F), await e.sendMessage({ type: "link", href: L.toString(), text: I ?? g("complete_submission"), onClick: () => {
|
|
659
|
+
if (!j) {
|
|
660
660
|
s.error("session_id not set, cannot log FLOW_REDIRECT event");
|
|
661
661
|
return;
|
|
662
662
|
}
|
|
663
|
-
o.log({ event: "FLOW_REDIRECT", properties: { flow_build: u.build, flow_id: u.id, flow_session_id:
|
|
663
|
+
o.log({ event: "FLOW_REDIRECT", properties: { flow_build: u.build, flow_id: u.id, flow_session_id: j, flow_version: u.version, href: L.toString(), job: u.job } });
|
|
664
664
|
} });
|
|
665
|
-
} catch (
|
|
666
|
-
s.error(`Invalid redirect URL: ${
|
|
665
|
+
} catch (L) {
|
|
666
|
+
s.error(`Invalid redirect URL: ${R}`, L), e.sendMessage({ type: "system", variant: "error", text: g("redirect_url_error") });
|
|
667
667
|
}
|
|
668
668
|
};
|
|
669
|
-
if ((
|
|
670
|
-
let
|
|
671
|
-
return
|
|
669
|
+
if ((ee = u.data.startedWriteNodeIds) != null && ee.includes(n.id) && (f == null ? void 0 : f.submitNodeId) !== n.id) {
|
|
670
|
+
let R = (T = u.data.submitRedirects) == null ? void 0 : T[n.id];
|
|
671
|
+
return R ? (await N(R), r(n.nextId)) : (await e.sendMessage({ type: "system", variant: "warning", text: g("submission_unknown") }), t());
|
|
672
672
|
}
|
|
673
|
-
let
|
|
674
|
-
var
|
|
675
|
-
let
|
|
676
|
-
|
|
677
|
-
let I =
|
|
678
|
-
(u.data.reviewRequiresSend === !0 && !O ||
|
|
679
|
-
let
|
|
673
|
+
let V = Vs(n.id, u.job), M = 0, O = y.submitAccepted && n.data.skipConfirmation === !0 && (f == null ? void 0 : f.submitNodeId) !== n.id, K = async (R) => {
|
|
674
|
+
var st, pt, mt, Et, at, l, d, h, w;
|
|
675
|
+
let B = ((st = u.data.submitCooldown) == null ? void 0 : st.key) === V ? u.data.submitCooldown : void 0;
|
|
676
|
+
B && (B.until = Ms(B));
|
|
677
|
+
let I = B == null ? void 0 : B.until;
|
|
678
|
+
(u.data.reviewRequiresSend === !0 && !O || R !== !0 || I !== void 0 && I > Date.now()) && await e.userInput({ type: "submit", key: void 0, config: { label: n.data.submitLabel, ...I !== void 0 && { availableAt: I } } }), O = !1;
|
|
679
|
+
let F;
|
|
680
680
|
if (n.data.captcha) {
|
|
681
|
-
let
|
|
681
|
+
let m = e.captcha, x = !0;
|
|
682
682
|
try {
|
|
683
|
-
|
|
684
|
-
e.sendMessage({ type: "text", author: "bot", text:
|
|
683
|
+
F = await ts(i, { signal: _, container: (m == null ? void 0 : m.container()) ?? null, theme: m == null ? void 0 : m.theme, onInteractive: () => {
|
|
684
|
+
e.sendMessage({ type: "text", author: "bot", text: g("captcha_check") }).catch(() => {
|
|
685
685
|
}).then(() => {
|
|
686
|
-
|
|
686
|
+
x && (m == null || m.reveal(!0));
|
|
687
687
|
});
|
|
688
688
|
} });
|
|
689
|
-
} catch (
|
|
690
|
-
if (s.error("Captcha check failed",
|
|
689
|
+
} catch (A) {
|
|
690
|
+
if (s.error("Captcha check failed", A), _.aborted)
|
|
691
691
|
return;
|
|
692
692
|
} finally {
|
|
693
|
-
|
|
693
|
+
x = !1, m == null || m.reveal(!1);
|
|
694
694
|
}
|
|
695
695
|
}
|
|
696
|
-
await e.sendMessage({ type: "loading", text:
|
|
697
|
-
let { anonymous_id:
|
|
698
|
-
if (
|
|
696
|
+
await e.sendMessage({ type: "loading", text: g("submitting") });
|
|
697
|
+
let { anonymous_id: j, session_id: L } = o.getSessionInfo();
|
|
698
|
+
if (_.aborted)
|
|
699
699
|
return;
|
|
700
|
-
let W = ((
|
|
701
|
-
if ((f == null ? void 0 : f.submitNodeId) === n.id && await
|
|
700
|
+
let W = ((pt = u.data.startedWriteNodeIds) == null ? void 0 : pt.includes(n.id)) === !0;
|
|
701
|
+
if ((f == null ? void 0 : f.submitNodeId) === n.id && await v(void 0), W || (u.data.startedWriteNodeIds = [...u.data.startedWriteNodeIds ?? [], n.id]), await C().catch((m) => s.error("Failed to persist application write barrier", m)), _.aborted)
|
|
702
702
|
return;
|
|
703
|
-
let
|
|
704
|
-
|
|
705
|
-
|
|
706
|
-
|
|
707
|
-
|
|
708
|
-
|
|
709
|
-
let d = cr(l);
|
|
710
|
-
return (d == null ? void 0 : d.data) !== void 0 ? d.data : l;
|
|
703
|
+
let U, te = setTimeout(() => {
|
|
704
|
+
U = e.sendMessage({ type: "loading", semantic: "submission-still-working", text: g("submission_still_working") }).catch((m) => s.error("Failed to send submission progress message", m));
|
|
705
|
+
}, Fs), X, H = await i.fetch("/flow/submit", { method: "POST", body: JSON.stringify({ log_submit: !1, integration_id: n.data.integrationId, anonymous_id: j, session_id: L, job: u.job, flow_build: u.build, ...F !== void 0 && { captcha_token: F }, submissions: Vn(u.nodes, Mn(a || {}, n.data.submitKeys)), pre_apply: Pr(u.nodes, a || {}, u.data.flowSessionId) }) }).catch((m) => {
|
|
706
|
+
X = m;
|
|
707
|
+
let x = ur(m);
|
|
708
|
+
return (x == null ? void 0 : x.data) !== void 0 ? x.data : m;
|
|
711
709
|
});
|
|
712
|
-
if (clearTimeout(
|
|
710
|
+
if (clearTimeout(te), await U, _.aborted)
|
|
713
711
|
return;
|
|
714
|
-
if (
|
|
715
|
-
return await k(
|
|
716
|
-
n.data.key && e.setSubmission(n.data.key, { type: "integration", value:
|
|
717
|
-
let
|
|
718
|
-
|
|
719
|
-
let
|
|
720
|
-
|
|
721
|
-
let
|
|
722
|
-
if ((
|
|
723
|
-
let { redirect_url:
|
|
724
|
-
return
|
|
712
|
+
if (X !== void 0 && !$t(X) && k)
|
|
713
|
+
return await k(X, _), K(!0);
|
|
714
|
+
n.data.key && e.setSubmission(n.data.key, { type: "integration", value: H });
|
|
715
|
+
let rt = (mt = ur(X)) == null ? void 0 : mt.status, $e = typeof rt == "number" ? rt : void 0, D = $r(H, $e), je = D === void 0 && $e === 429, Pe = E === "terminal" && ((D == null ? void 0 : D.outcome) === "closed" || (D == null ? void 0 : D.outcome) === "duplicate"), Se = u.data.failedAttemptAt, Ne = Se == null ? void 0 : Se[V];
|
|
716
|
+
Se && Ne !== void 0 && Ne > Date.now() && (Ne = Se[V] = Date.now());
|
|
717
|
+
let qe = Ne !== void 0 && Date.now() - Ne < Ln || ((Et = u.data.unconfirmedAttemptKeys) == null ? void 0 : Et.includes(V)) === !0, nt = (at = $t(X)) == null ? void 0 : at.status, ge = Nn(H, typeof nt == "number" ? nt : void 0);
|
|
718
|
+
ge && o.log({ event: "FLOW_SUBMIT", properties: { flow_id: u.id, flow_version: u.version, flow_session_id: u.data.flowSessionId, flow_build: u.build, service: ge.service, response: ge.response, captured: (H == null ? void 0 : H.captured) === !0, flow_type: (p == null ? void 0 : p()) ?? "CHATBOT_DRAWER", job: u.job, ...(D == null ? void 0 : D.outcome) === "duplicate" && { outcome: qe ? "duplicate_after_own_attempt" : "duplicate" }, ...ge.outcome && { outcome: ge.outcome } } });
|
|
719
|
+
let Ue = nr(H) || (H == null ? void 0 : H.success) === !0;
|
|
720
|
+
if ((Ue || sr(H)) && (y.submitAccepted = !0), Ue && ((l = u.data.submitCooldown) == null ? void 0 : l.throttles) !== void 0 && (delete u.data.submitCooldown.throttles, await C().catch((m) => s.error("Failed to persist submit cooldown reset", m))), nr(H)) {
|
|
721
|
+
let { redirect_url: m, message: x, button_text: A } = H.integration_response.data, $ = { redirect_url: m, message: x, button_text: A };
|
|
722
|
+
return _.aborted ? void 0 : (u.data.submitRedirects = { ...u.data.submitRedirects, [n.id]: $ }, await C().catch((P) => s.error("Failed to persist submit redirect", P)), await N($), r(n.nextId));
|
|
725
723
|
}
|
|
726
|
-
let
|
|
727
|
-
if (
|
|
728
|
-
return await e.sendMessage({ type: "system", variant: "success", text:
|
|
729
|
-
if ((
|
|
730
|
-
return n.data.skipConfirmation !== !0 && await e.sendMessage({ type: "system", variant: "success", text:
|
|
731
|
-
let
|
|
732
|
-
if (!
|
|
733
|
-
if (s.error(
|
|
734
|
-
return e.setSubmission(
|
|
735
|
-
if (
|
|
736
|
-
return await e.sendMessage({ type: "system", variant: "info", text:
|
|
737
|
-
if (
|
|
738
|
-
return await e.sendMessage({ type: "system", variant: "info", text:
|
|
739
|
-
let
|
|
740
|
-
return
|
|
724
|
+
let ht = sr(H);
|
|
725
|
+
if (ht)
|
|
726
|
+
return await e.sendMessage({ type: "system", variant: "success", text: ht.message ?? g("submission_pending") }), r(n.nextId);
|
|
727
|
+
if ((H == null ? void 0 : H.success) === !0)
|
|
728
|
+
return n.data.skipConfirmation !== !0 && await e.sendMessage({ type: "system", variant: "success", text: g("submission_completed") }), r(n.nextId);
|
|
729
|
+
let We = Rn(D), ze = We !== void 0 && ((d = a == null ? void 0 : a[We]) == null ? void 0 : d.type) === "file" ? We : void 0, Re = ze === void 0 ? void 0 : u.nodes.find((m) => m.type === "question-file" && m.data.key === ze);
|
|
730
|
+
if (!Re && !Pe && !ar(D) && (u.data.submitCooldown = Ls(V, B, D)), (D == null ? void 0 : D.outcome) !== "duplicate" && !je && (u.data.failedAttemptAt = { ...u.data.failedAttemptAt, [V]: Date.now() }, (h = u.data.unconfirmedAttemptKeys) != null && h.includes(V) && (u.data.unconfirmedAttemptKeys = u.data.unconfirmedAttemptKeys.filter((m) => m !== V))), (D == null ? void 0 : D.verdict) === "not_submitted" || (D == null ? void 0 : D.outcome) === "duplicate" || (D == null ? void 0 : D.outcome) === "closed" || je || Tn(H, $e) ? (W || (u.data.startedWriteNodeIds = (w = u.data.startedWriteNodeIds) == null ? void 0 : w.filter((m) => m !== n.id)), (f == null ? void 0 : f.submitNodeId) === n.id && await v(f), await C().catch((m) => s.error("Failed to persist application write barrier release", m))) : await C().catch((m) => s.error("Failed to persist submit cooldown", m)), D) {
|
|
731
|
+
if (s.error(X ?? D.message), Re && ze !== void 0)
|
|
732
|
+
return e.setSubmission(ze, null), await v({ fileQuestionNodeId: Re.id, submitNodeId: n.id }), await e.sendMessage({ type: "system", variant: "error", text: g("submission_unreadable_document") }), r(Re.id);
|
|
733
|
+
if (D.outcome === "duplicate")
|
|
734
|
+
return await e.sendMessage({ type: "system", variant: Pe ? "success" : "info", semantic: "submission-duplicate", text: g(qe ? "submission_duplicate_earlier_attempt" : "submission_duplicate") }), Pe ? (delete u.data.submitCooldown, t()) : K(!1);
|
|
735
|
+
if (D.outcome === "closed")
|
|
736
|
+
return await e.sendMessage({ type: "system", variant: "info", semantic: "submission-closed", text: g("submission_closed") }), Pe ? (delete u.data.submitCooldown, t()) : K(!1);
|
|
737
|
+
let m = Dn(D);
|
|
738
|
+
return m ? (await e.sendMessage({ type: "system", variant: "warning", text: m.until === void 0 ? g("submission_provider_maintenance_later") : g("submission_provider_maintenance", { time: qr(m.until, void 0) }) }), K(!1)) : D.outcome === "unknown" ? (await e.sendMessage({ type: "system", variant: "warning", text: g(On(D) ? "submission_unknown_do_not_resubmit" : "submission_unknown") }), K(!1)) : ar(D) ? Bn(H) ? (await e.sendMessage({ type: "text", author: "bot", text: D.message }), K(!1)) : (M === 0 && await e.sendMessage({ type: "system", variant: "warning", text: g("captcha_failed") }), M++, K(M <= _s)) : $n(D) ? (await e.sendMessage({ type: "system", variant: "error", text: g("submission_retryable") }), K(!1)) : (await e.sendMessage({ type: "system", variant: "error", text: g("submission_failed") }), t());
|
|
741
739
|
}
|
|
742
|
-
return s.error(
|
|
740
|
+
return s.error(X ?? H), je ? (await e.sendMessage({ type: "system", variant: "error", text: g("submission_retryable") }), K(!1)) : (await e.sendMessage({ type: "system", variant: "error", text: g("submission_failed") }), t());
|
|
743
741
|
};
|
|
744
|
-
await
|
|
742
|
+
await K(b === !0 && !O ? !1 : n.data.skipConfirmation);
|
|
745
743
|
}
|
|
746
744
|
async function Ts({ chat: e, next: r, node: t, submissions: n, context: s }) {
|
|
747
745
|
await e.sendMessage({ type: "link", href: he(t.data.href, { submissions: n, context: s }), text: he(t.data.cta, { submissions: n, context: s }) }), r(t.nextId);
|
|
748
746
|
}
|
|
749
|
-
async function
|
|
747
|
+
async function Ds({ submissions: e, next: r, node: t, context: n }) {
|
|
750
748
|
r(xs(t, { submissions: e, context: n }) ? t.branchId : t.nextId);
|
|
751
749
|
}
|
|
752
750
|
async function Os({ chat: e, next: r, node: t, submissions: n, context: s }) {
|
|
@@ -758,7 +756,7 @@ async function Bs({ chat: e, next: r, node: t }) {
|
|
|
758
756
|
async function $s({ chat: e, next: r, node: t, submissions: n, context: s, t: i, dateEchoLocale: a }) {
|
|
759
757
|
await e.sendMessage({ author: "bot", type: "text", text: he(t.data.question, { submissions: n, context: s }) });
|
|
760
758
|
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 } });
|
|
761
|
-
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" ? vt(o.value) : t.data.format === "date" && a !== void 0 ?
|
|
759
|
+
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" ? vt(o.value) : t.data.format === "date" && a !== void 0 ? In(o.value, a) : o.value }), r(t.nextId);
|
|
762
760
|
}
|
|
763
761
|
async function js({ chat: e, next: r, node: t, submissions: n, context: s, t: i }) {
|
|
764
762
|
await e.sendMessage({ author: "bot", type: "text", text: he(t.data.question, { submissions: n, context: s }) });
|
|
@@ -780,7 +778,7 @@ async function Us({ chat: e, next: r, node: t, submissions: n, context: s, t: i
|
|
|
780
778
|
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 } } });
|
|
781
779
|
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);
|
|
782
780
|
}
|
|
783
|
-
async function
|
|
781
|
+
async function Ws({ chat: e, next: r, node: t, t: n }) {
|
|
784
782
|
await e.sendMessage({ author: "bot", type: "text", text: t.data.question });
|
|
785
783
|
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 } });
|
|
786
784
|
if (s === null)
|
|
@@ -801,17 +799,17 @@ async function zs({ node: e, chat: r, next: t, submissions: n, context: s, t: i
|
|
|
801
799
|
await r.sendMessage({ author: "user", type: "file", fileName: o.name, fileSizeKb: o.sizeKb });
|
|
802
800
|
return t(e.nextId);
|
|
803
801
|
}
|
|
804
|
-
async function
|
|
802
|
+
async function Hs({ chat: e, end: r, node: t }) {
|
|
805
803
|
await e.sendMessage({ type: "system", variant: "info", text: t.data.systemMessage }), r();
|
|
806
804
|
}
|
|
807
805
|
async function Ks({ node: e, flow: r, submissions: t, chat: n, next: s, apiClient: i, analytics: a, signal: o, context: u }) {
|
|
808
|
-
let f = Fn(r.nodes, t || {}), { answers:
|
|
809
|
-
if (n.setSubmission(e.data.key, { type: "integration", value:
|
|
806
|
+
let f = Fn(r.nodes, t || {}), { answers: v, ...b } = f;
|
|
807
|
+
if (n.setSubmission(e.data.key, { type: "integration", value: b }), vs(r, i, { ...a.getSessionInfo(), job: r.job, flow_build: r.build, pre_apply: Pr(r.nodes, t || {}, r.data.flowSessionId) }, o), f.status !== "skipped") {
|
|
810
808
|
let p = [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];
|
|
811
|
-
for (let
|
|
812
|
-
let
|
|
813
|
-
|
|
814
|
-
` +
|
|
809
|
+
for (let y of ["hard", "advisory"]) {
|
|
810
|
+
let C = v.filter((_) => !_.matched && _.severity === y);
|
|
811
|
+
C.length && p.push((y === "hard" ? "Role requirements" : "Other things to consider") + `
|
|
812
|
+
` + C.map((_) => `• ${_.message}`).join(`
|
|
815
813
|
`));
|
|
816
814
|
}
|
|
817
815
|
await n.sendMessage({ type: "text", author: "bot", text: p.join(`
|
|
@@ -820,7 +818,7 @@ async function Ks({ node: e, flow: r, submissions: t, chat: n, next: s, apiClien
|
|
|
820
818
|
}
|
|
821
819
|
return s(e.nextId);
|
|
822
820
|
}
|
|
823
|
-
const
|
|
821
|
+
const dr = (e, r, t) => {
|
|
824
822
|
var n;
|
|
825
823
|
return e.log({
|
|
826
824
|
event: t,
|
|
@@ -834,7 +832,7 @@ const ur = (e, r, t) => {
|
|
|
834
832
|
},
|
|
835
833
|
customProperties: (n = r.analytics) == null ? void 0 : n.customProperties
|
|
836
834
|
});
|
|
837
|
-
},
|
|
835
|
+
}, jt = "resume-prompt", Gs = async ({
|
|
838
836
|
chatService: e,
|
|
839
837
|
t: r,
|
|
840
838
|
signal: t
|
|
@@ -845,7 +843,7 @@ const ur = (e, r, t) => {
|
|
|
845
843
|
author: "bot",
|
|
846
844
|
text: r("resume_prompt")
|
|
847
845
|
},
|
|
848
|
-
groupId:
|
|
846
|
+
groupId: jt,
|
|
849
847
|
signal: t
|
|
850
848
|
});
|
|
851
849
|
const n = await e.input({
|
|
@@ -862,16 +860,16 @@ const ur = (e, r, t) => {
|
|
|
862
860
|
},
|
|
863
861
|
signal: t
|
|
864
862
|
});
|
|
865
|
-
return
|
|
866
|
-
},
|
|
863
|
+
return q.removeMessagesSentByNodeIds([jt]), (n == null ? void 0 : n.value) !== !1;
|
|
864
|
+
}, Be = ({
|
|
867
865
|
class: e,
|
|
868
866
|
...r
|
|
869
867
|
}) => {
|
|
870
868
|
const {
|
|
871
869
|
t
|
|
872
|
-
} =
|
|
870
|
+
} = ne();
|
|
873
871
|
return c("button", {
|
|
874
|
-
class:
|
|
872
|
+
class: Qe("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),
|
|
875
873
|
type: "submit",
|
|
876
874
|
...r,
|
|
877
875
|
children: c("svg", {
|
|
@@ -893,14 +891,14 @@ const ur = (e, r, t) => {
|
|
|
893
891
|
})
|
|
894
892
|
});
|
|
895
893
|
};
|
|
896
|
-
var
|
|
894
|
+
var ve;
|
|
897
895
|
// @__NO_SIDE_EFFECTS__
|
|
898
896
|
function wt(e) {
|
|
899
897
|
return {
|
|
900
|
-
lang: (e == null ? void 0 : e.lang) ?? (
|
|
898
|
+
lang: (e == null ? void 0 : e.lang) ?? (ve == null ? void 0 : ve.lang),
|
|
901
899
|
message: e == null ? void 0 : e.message,
|
|
902
|
-
abortEarly: (e == null ? void 0 : e.abortEarly) ?? (
|
|
903
|
-
abortPipeEarly: (e == null ? void 0 : e.abortPipeEarly) ?? (
|
|
900
|
+
abortEarly: (e == null ? void 0 : e.abortEarly) ?? (ve == null ? void 0 : ve.abortEarly),
|
|
901
|
+
abortPipeEarly: (e == null ? void 0 : e.abortPipeEarly) ?? (ve == null ? void 0 : ve.abortPipeEarly)
|
|
904
902
|
};
|
|
905
903
|
}
|
|
906
904
|
var Mt;
|
|
@@ -913,20 +911,20 @@ var Lt;
|
|
|
913
911
|
function Zs(e) {
|
|
914
912
|
return Lt == null ? void 0 : Lt.get(e);
|
|
915
913
|
}
|
|
916
|
-
var
|
|
914
|
+
var Nt;
|
|
917
915
|
// @__NO_SIDE_EFFECTS__
|
|
918
916
|
function Xs(e, r) {
|
|
919
917
|
var t;
|
|
920
|
-
return (t =
|
|
918
|
+
return (t = Nt == null ? void 0 : Nt.get(e)) == null ? void 0 : t.get(r);
|
|
921
919
|
}
|
|
922
920
|
// @__NO_SIDE_EFFECTS__
|
|
923
|
-
function
|
|
921
|
+
function Xe(e) {
|
|
924
922
|
var t, n;
|
|
925
923
|
const r = typeof e;
|
|
926
924
|
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;
|
|
927
925
|
}
|
|
928
|
-
function
|
|
929
|
-
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__ */
|
|
926
|
+
function re(e, r, t, n, s) {
|
|
927
|
+
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__ */ Xe(i), u = {
|
|
930
928
|
kind: e.kind,
|
|
931
929
|
type: e.type,
|
|
932
930
|
input: i,
|
|
@@ -939,11 +937,11 @@ function ee(e, r, t, n, s) {
|
|
|
939
937
|
lang: n.lang,
|
|
940
938
|
abortEarly: n.abortEarly,
|
|
941
939
|
abortPipeEarly: n.abortPipeEarly
|
|
942
|
-
}, f = e.kind === "schema",
|
|
943
|
-
|
|
940
|
+
}, f = e.kind === "schema", v = (s == null ? void 0 : s.message) ?? e.message ?? /* @__PURE__ */ Xs(e.reference, u.lang) ?? (f ? /* @__PURE__ */ Zs(u.lang) : null) ?? n.message ?? /* @__PURE__ */ Js(u.lang);
|
|
941
|
+
v !== void 0 && (u.message = typeof v == "function" ? (
|
|
944
942
|
// @ts-expect-error
|
|
945
|
-
|
|
946
|
-
) :
|
|
943
|
+
v(u)
|
|
944
|
+
) : v), f && (t.typed = !1), t.issues ? t.issues.push(u) : t.issues = [u];
|
|
947
945
|
}
|
|
948
946
|
// @__NO_SIDE_EFFECTS__
|
|
949
947
|
function be(e) {
|
|
@@ -998,7 +996,7 @@ function Xr(e, r) {
|
|
|
998
996
|
requirement: e,
|
|
999
997
|
message: r,
|
|
1000
998
|
"~run"(t, n) {
|
|
1001
|
-
return t.typed && !this.requirement(t.value) &&
|
|
999
|
+
return t.typed && !this.requirement(t.value) && re(this, "input", t, n), t;
|
|
1002
1000
|
}
|
|
1003
1001
|
};
|
|
1004
1002
|
}
|
|
@@ -1013,7 +1011,7 @@ function Yr(e) {
|
|
|
1013
1011
|
requirement: ra,
|
|
1014
1012
|
message: e,
|
|
1015
1013
|
"~run"(r, t) {
|
|
1016
|
-
return r.typed && !this.requirement.test(r.value) &&
|
|
1014
|
+
return r.typed && !this.requirement.test(r.value) && re(this, "email", r, t), r;
|
|
1017
1015
|
}
|
|
1018
1016
|
};
|
|
1019
1017
|
}
|
|
@@ -1028,7 +1026,7 @@ function ct(e, r) {
|
|
|
1028
1026
|
requirement: e,
|
|
1029
1027
|
message: r,
|
|
1030
1028
|
"~run"(t, n) {
|
|
1031
|
-
return t.typed && t.value.length > this.requirement &&
|
|
1029
|
+
return t.typed && t.value.length > this.requirement && re(this, "length", t, n, {
|
|
1032
1030
|
received: `${t.value.length}`
|
|
1033
1031
|
}), t;
|
|
1034
1032
|
}
|
|
@@ -1041,28 +1039,28 @@ function Qr(e, r) {
|
|
|
1041
1039
|
type: "max_value",
|
|
1042
1040
|
reference: Qr,
|
|
1043
1041
|
async: !1,
|
|
1044
|
-
expects: `<=${e instanceof Date ? e.toJSON() : /* @__PURE__ */
|
|
1042
|
+
expects: `<=${e instanceof Date ? e.toJSON() : /* @__PURE__ */ Xe(e)}`,
|
|
1045
1043
|
requirement: e,
|
|
1046
1044
|
message: r,
|
|
1047
1045
|
"~run"(t, n) {
|
|
1048
|
-
return t.typed && !(t.value <= this.requirement) &&
|
|
1049
|
-
received: t.value instanceof Date ? t.value.toJSON() : /* @__PURE__ */
|
|
1046
|
+
return t.typed && !(t.value <= this.requirement) && re(this, "value", t, n, {
|
|
1047
|
+
received: t.value instanceof Date ? t.value.toJSON() : /* @__PURE__ */ Xe(t.value)
|
|
1050
1048
|
}), t;
|
|
1051
1049
|
}
|
|
1052
1050
|
};
|
|
1053
1051
|
}
|
|
1054
1052
|
// @__NO_SIDE_EFFECTS__
|
|
1055
|
-
function
|
|
1053
|
+
function Ze(e, r) {
|
|
1056
1054
|
return {
|
|
1057
1055
|
kind: "validation",
|
|
1058
1056
|
type: "min_length",
|
|
1059
|
-
reference:
|
|
1057
|
+
reference: Ze,
|
|
1060
1058
|
async: !1,
|
|
1061
1059
|
expects: `>=${e}`,
|
|
1062
1060
|
requirement: e,
|
|
1063
1061
|
message: r,
|
|
1064
1062
|
"~run"(t, n) {
|
|
1065
|
-
return t.typed && t.value.length < this.requirement &&
|
|
1063
|
+
return t.typed && t.value.length < this.requirement && re(this, "length", t, n, {
|
|
1066
1064
|
received: `${t.value.length}`
|
|
1067
1065
|
}), t;
|
|
1068
1066
|
}
|
|
@@ -1075,37 +1073,37 @@ function en(e, r) {
|
|
|
1075
1073
|
type: "min_value",
|
|
1076
1074
|
reference: en,
|
|
1077
1075
|
async: !1,
|
|
1078
|
-
expects: `>=${e instanceof Date ? e.toJSON() : /* @__PURE__ */
|
|
1076
|
+
expects: `>=${e instanceof Date ? e.toJSON() : /* @__PURE__ */ Xe(e)}`,
|
|
1079
1077
|
requirement: e,
|
|
1080
1078
|
message: r,
|
|
1081
1079
|
"~run"(t, n) {
|
|
1082
|
-
return t.typed && !(t.value >= this.requirement) &&
|
|
1083
|
-
received: t.value instanceof Date ? t.value.toJSON() : /* @__PURE__ */
|
|
1080
|
+
return t.typed && !(t.value >= this.requirement) && re(this, "value", t, n, {
|
|
1081
|
+
received: t.value instanceof Date ? t.value.toJSON() : /* @__PURE__ */ Xe(t.value)
|
|
1084
1082
|
}), t;
|
|
1085
1083
|
}
|
|
1086
1084
|
};
|
|
1087
1085
|
}
|
|
1088
1086
|
// @__NO_SIDE_EFFECTS__
|
|
1089
|
-
function
|
|
1087
|
+
function Ht(e, r) {
|
|
1090
1088
|
return {
|
|
1091
1089
|
kind: "validation",
|
|
1092
1090
|
type: "regex",
|
|
1093
|
-
reference:
|
|
1091
|
+
reference: Ht,
|
|
1094
1092
|
async: !1,
|
|
1095
1093
|
expects: `${e}`,
|
|
1096
1094
|
requirement: e,
|
|
1097
1095
|
message: r,
|
|
1098
1096
|
"~run"(t, n) {
|
|
1099
|
-
return t.typed && !this.requirement.test(t.value) &&
|
|
1097
|
+
return t.typed && !this.requirement.test(t.value) && re(this, "format", t, n), t;
|
|
1100
1098
|
}
|
|
1101
1099
|
};
|
|
1102
1100
|
}
|
|
1103
1101
|
// @__NO_SIDE_EFFECTS__
|
|
1104
|
-
function
|
|
1102
|
+
function Kt(e) {
|
|
1105
1103
|
return {
|
|
1106
1104
|
kind: "transformation",
|
|
1107
1105
|
type: "transform",
|
|
1108
|
-
reference:
|
|
1106
|
+
reference: Kt,
|
|
1109
1107
|
async: !1,
|
|
1110
1108
|
operation: e,
|
|
1111
1109
|
"~run"(r) {
|
|
@@ -1130,7 +1128,7 @@ function tn(e) {
|
|
|
1130
1128
|
},
|
|
1131
1129
|
message: e,
|
|
1132
1130
|
"~run"(r, t) {
|
|
1133
|
-
return r.typed && !this.requirement(r.value) &&
|
|
1131
|
+
return r.typed && !this.requirement(r.value) && re(this, "URL", r, t), r;
|
|
1134
1132
|
}
|
|
1135
1133
|
};
|
|
1136
1134
|
}
|
|
@@ -1182,8 +1180,8 @@ function nn(e, r) {
|
|
|
1182
1180
|
key: a,
|
|
1183
1181
|
value: o
|
|
1184
1182
|
};
|
|
1185
|
-
for (const
|
|
1186
|
-
|
|
1183
|
+
for (const v of u.issues)
|
|
1184
|
+
v.path ? v.path.unshift(f) : v.path = [f], (i = t.issues) == null || i.push(v);
|
|
1187
1185
|
if (t.issues || (t.issues = u.issues), n.abortEarly) {
|
|
1188
1186
|
t.typed = !1;
|
|
1189
1187
|
break;
|
|
@@ -1192,7 +1190,7 @@ function nn(e, r) {
|
|
|
1192
1190
|
u.typed || (t.typed = !1), t.value.push(u.value);
|
|
1193
1191
|
}
|
|
1194
1192
|
} else
|
|
1195
|
-
|
|
1193
|
+
re(this, "type", t, n);
|
|
1196
1194
|
return t;
|
|
1197
1195
|
}
|
|
1198
1196
|
};
|
|
@@ -1210,7 +1208,7 @@ function sn(e) {
|
|
|
1210
1208
|
return /* @__PURE__ */ be(this);
|
|
1211
1209
|
},
|
|
1212
1210
|
"~run"(r, t) {
|
|
1213
|
-
return typeof r.value == "boolean" ? r.typed = !0 :
|
|
1211
|
+
return typeof r.value == "boolean" ? r.typed = !0 : re(this, "type", r, t), r;
|
|
1214
1212
|
}
|
|
1215
1213
|
};
|
|
1216
1214
|
}
|
|
@@ -1227,16 +1225,16 @@ function an(e) {
|
|
|
1227
1225
|
return /* @__PURE__ */ be(this);
|
|
1228
1226
|
},
|
|
1229
1227
|
"~run"(r, t) {
|
|
1230
|
-
return typeof r.value == "number" && !isNaN(r.value) ? r.typed = !0 :
|
|
1228
|
+
return typeof r.value == "number" && !isNaN(r.value) ? r.typed = !0 : re(this, "type", r, t), r;
|
|
1231
1229
|
}
|
|
1232
1230
|
};
|
|
1233
1231
|
}
|
|
1234
1232
|
// @__NO_SIDE_EFFECTS__
|
|
1235
|
-
function
|
|
1233
|
+
function ke(e, r) {
|
|
1236
1234
|
return {
|
|
1237
1235
|
kind: "schema",
|
|
1238
1236
|
type: "object",
|
|
1239
|
-
reference:
|
|
1237
|
+
reference: ke,
|
|
1240
1238
|
expects: "Object",
|
|
1241
1239
|
async: !1,
|
|
1242
1240
|
entries: e,
|
|
@@ -1258,15 +1256,15 @@ function _e(e, r) {
|
|
|
1258
1256
|
s[a]
|
|
1259
1257
|
) : /* @__PURE__ */ rn(o), f = o["~run"]({ value: u }, n);
|
|
1260
1258
|
if (f.issues) {
|
|
1261
|
-
const
|
|
1259
|
+
const v = {
|
|
1262
1260
|
type: "object",
|
|
1263
1261
|
origin: "value",
|
|
1264
1262
|
input: s,
|
|
1265
1263
|
key: a,
|
|
1266
1264
|
value: u
|
|
1267
1265
|
};
|
|
1268
|
-
for (const
|
|
1269
|
-
|
|
1266
|
+
for (const b of f.issues)
|
|
1267
|
+
b.path ? b.path.unshift(v) : b.path = [v], (i = t.issues) == null || i.push(b);
|
|
1270
1268
|
if (t.issues || (t.issues = f.issues), n.abortEarly) {
|
|
1271
1269
|
t.typed = !1;
|
|
1272
1270
|
break;
|
|
@@ -1275,7 +1273,7 @@ function _e(e, r) {
|
|
|
1275
1273
|
f.typed || (t.typed = !1), t.value[a] = f.value;
|
|
1276
1274
|
} else if (o.fallback !== void 0)
|
|
1277
1275
|
t.value[a] = /* @__PURE__ */ na(o);
|
|
1278
|
-
else if (o.type !== "exact_optional" && o.type !== "optional" && o.type !== "nullish" && (
|
|
1276
|
+
else if (o.type !== "exact_optional" && o.type !== "optional" && o.type !== "nullish" && (re(this, "key", t, n, {
|
|
1279
1277
|
input: void 0,
|
|
1280
1278
|
expected: `"${a}"`,
|
|
1281
1279
|
path: [
|
|
@@ -1292,17 +1290,17 @@ function _e(e, r) {
|
|
|
1292
1290
|
break;
|
|
1293
1291
|
}
|
|
1294
1292
|
} else
|
|
1295
|
-
|
|
1293
|
+
re(this, "type", t, n);
|
|
1296
1294
|
return t;
|
|
1297
1295
|
}
|
|
1298
1296
|
};
|
|
1299
1297
|
}
|
|
1300
1298
|
// @__NO_SIDE_EFFECTS__
|
|
1301
|
-
function
|
|
1299
|
+
function Je(e, r) {
|
|
1302
1300
|
return {
|
|
1303
1301
|
kind: "schema",
|
|
1304
1302
|
type: "optional",
|
|
1305
|
-
reference:
|
|
1303
|
+
reference: Je,
|
|
1306
1304
|
expects: `(${e.expects} | undefined)`,
|
|
1307
1305
|
async: !1,
|
|
1308
1306
|
wrapped: e,
|
|
@@ -1321,7 +1319,7 @@ function on(e, r) {
|
|
|
1321
1319
|
kind: "schema",
|
|
1322
1320
|
type: "picklist",
|
|
1323
1321
|
reference: on,
|
|
1324
|
-
expects: /* @__PURE__ */ Qs(e.map(
|
|
1322
|
+
expects: /* @__PURE__ */ Qs(e.map(Xe), "|"),
|
|
1325
1323
|
async: !1,
|
|
1326
1324
|
options: e,
|
|
1327
1325
|
message: r,
|
|
@@ -1329,7 +1327,7 @@ function on(e, r) {
|
|
|
1329
1327
|
return /* @__PURE__ */ be(this);
|
|
1330
1328
|
},
|
|
1331
1329
|
"~run"(t, n) {
|
|
1332
|
-
return this.options.includes(t.value) ? t.typed = !0 :
|
|
1330
|
+
return this.options.includes(t.value) ? t.typed = !0 : re(this, "type", t, n), t;
|
|
1333
1331
|
}
|
|
1334
1332
|
};
|
|
1335
1333
|
}
|
|
@@ -1354,8 +1352,8 @@ function ln(e, r, t) {
|
|
|
1354
1352
|
n.typed = !0, n.value = {};
|
|
1355
1353
|
for (const u in i)
|
|
1356
1354
|
if (/* @__PURE__ */ Ys(i, u)) {
|
|
1357
|
-
const f = i[u],
|
|
1358
|
-
if (
|
|
1355
|
+
const f = i[u], v = this.key["~run"]({ value: u }, s);
|
|
1356
|
+
if (v.issues) {
|
|
1359
1357
|
const p = {
|
|
1360
1358
|
type: "object",
|
|
1361
1359
|
origin: "key",
|
|
@@ -1363,18 +1361,18 @@ function ln(e, r, t) {
|
|
|
1363
1361
|
key: u,
|
|
1364
1362
|
value: f
|
|
1365
1363
|
};
|
|
1366
|
-
for (const
|
|
1367
|
-
|
|
1368
|
-
if (n.issues || (n.issues =
|
|
1364
|
+
for (const y of v.issues)
|
|
1365
|
+
y.path = [p], (a = n.issues) == null || a.push(y);
|
|
1366
|
+
if (n.issues || (n.issues = v.issues), s.abortEarly) {
|
|
1369
1367
|
n.typed = !1;
|
|
1370
1368
|
break;
|
|
1371
1369
|
}
|
|
1372
1370
|
}
|
|
1373
|
-
const
|
|
1371
|
+
const b = this.value["~run"](
|
|
1374
1372
|
{ value: f },
|
|
1375
1373
|
s
|
|
1376
1374
|
);
|
|
1377
|
-
if (
|
|
1375
|
+
if (b.issues) {
|
|
1378
1376
|
const p = {
|
|
1379
1377
|
type: "object",
|
|
1380
1378
|
origin: "value",
|
|
@@ -1382,27 +1380,27 @@ function ln(e, r, t) {
|
|
|
1382
1380
|
key: u,
|
|
1383
1381
|
value: f
|
|
1384
1382
|
};
|
|
1385
|
-
for (const
|
|
1386
|
-
|
|
1387
|
-
if (n.issues || (n.issues =
|
|
1383
|
+
for (const y of b.issues)
|
|
1384
|
+
y.path ? y.path.unshift(p) : y.path = [p], (o = n.issues) == null || o.push(y);
|
|
1385
|
+
if (n.issues || (n.issues = b.issues), s.abortEarly) {
|
|
1388
1386
|
n.typed = !1;
|
|
1389
1387
|
break;
|
|
1390
1388
|
}
|
|
1391
1389
|
}
|
|
1392
|
-
(!
|
|
1390
|
+
(!v.typed || !b.typed) && (n.typed = !1), v.typed && (n.value[v.value] = b.value);
|
|
1393
1391
|
}
|
|
1394
1392
|
} else
|
|
1395
|
-
|
|
1393
|
+
re(this, "type", n, s);
|
|
1396
1394
|
return n;
|
|
1397
1395
|
}
|
|
1398
1396
|
};
|
|
1399
1397
|
}
|
|
1400
1398
|
// @__NO_SIDE_EFFECTS__
|
|
1401
|
-
function
|
|
1399
|
+
function le(e) {
|
|
1402
1400
|
return {
|
|
1403
1401
|
kind: "schema",
|
|
1404
1402
|
type: "string",
|
|
1405
|
-
reference:
|
|
1403
|
+
reference: le,
|
|
1406
1404
|
expects: "string",
|
|
1407
1405
|
async: !1,
|
|
1408
1406
|
message: e,
|
|
@@ -1410,7 +1408,7 @@ function ie(e) {
|
|
|
1410
1408
|
return /* @__PURE__ */ be(this);
|
|
1411
1409
|
},
|
|
1412
1410
|
"~run"(r, t) {
|
|
1413
|
-
return typeof r.value == "string" ? r.typed = !0 :
|
|
1411
|
+
return typeof r.value == "string" ? r.typed = !0 : re(this, "type", r, t), r;
|
|
1414
1412
|
}
|
|
1415
1413
|
};
|
|
1416
1414
|
}
|
|
@@ -1424,7 +1422,7 @@ function sa(e, r, t) {
|
|
|
1424
1422
|
function aa(e, r) {
|
|
1425
1423
|
const t = {};
|
|
1426
1424
|
for (const n in e.entries)
|
|
1427
|
-
t[n] = !r || r.includes(n) ? /* @__PURE__ */
|
|
1425
|
+
t[n] = !r || r.includes(n) ? /* @__PURE__ */ Je(e.entries[n]) : e.entries[n];
|
|
1428
1426
|
return {
|
|
1429
1427
|
...e,
|
|
1430
1428
|
entries: t,
|
|
@@ -1477,7 +1475,7 @@ async function oa(e, r, t) {
|
|
|
1477
1475
|
issues: n.issues
|
|
1478
1476
|
};
|
|
1479
1477
|
}
|
|
1480
|
-
const
|
|
1478
|
+
const tt = ({
|
|
1481
1479
|
error: e
|
|
1482
1480
|
}) => !e || !e.message ? null : c("div", {
|
|
1483
1481
|
role: "alert",
|
|
@@ -1516,10 +1514,10 @@ const Xe = ({
|
|
|
1516
1514
|
}) => {
|
|
1517
1515
|
const {
|
|
1518
1516
|
t
|
|
1519
|
-
} =
|
|
1517
|
+
} = ne();
|
|
1520
1518
|
return c("button", {
|
|
1521
1519
|
type: "button",
|
|
1522
|
-
class:
|
|
1520
|
+
class: Qe("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),
|
|
1523
1521
|
...r,
|
|
1524
1522
|
children: [c("svg", {
|
|
1525
1523
|
"aria-hidden": !0,
|
|
@@ -1541,8 +1539,8 @@ const Xe = ({
|
|
|
1541
1539
|
}), t("skip")]
|
|
1542
1540
|
});
|
|
1543
1541
|
};
|
|
1544
|
-
var
|
|
1545
|
-
const
|
|
1542
|
+
var Gt = { 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" };
|
|
1543
|
+
const Ye = xt("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", {
|
|
1546
1544
|
variants: {
|
|
1547
1545
|
optional: {
|
|
1548
1546
|
true: "pr-16 pl-3",
|
|
@@ -1552,25 +1550,25 @@ const Ge = xt("outline-divider ease-expo-out placeholder:text-neutral-10 text-ne
|
|
|
1552
1550
|
defaultVariants: {
|
|
1553
1551
|
optional: !1
|
|
1554
1552
|
}
|
|
1555
|
-
}), la = "https://api.mapbox.com/search/searchbox/v1/suggest", ca = "ZzRDWFU0dTZ3SF9aWk9RNGl6QzZaWS5RZmlFak13a0hPbGxXZXlNSGN5RUhObUJ6TXpSV08yUW5OdE5tSTZJU1lpd2lJb1JYYXRObmJ2Tm5iaGhHZWx4V1lpb2pJMUp5ZS5rcA==", ua = (e) => atob(e).split("").reverse().join(""),
|
|
1556
|
-
name: /* @__PURE__ */
|
|
1557
|
-
}), da = /* @__PURE__ */
|
|
1558
|
-
suggestions: /* @__PURE__ */ nn(/* @__PURE__ */
|
|
1559
|
-
feature_type: /* @__PURE__ */
|
|
1560
|
-
full_address: /* @__PURE__ */
|
|
1561
|
-
place_formatted: /* @__PURE__ */
|
|
1562
|
-
name: /* @__PURE__ */
|
|
1563
|
-
mapbox_id: /* @__PURE__ */
|
|
1564
|
-
context: /* @__PURE__ */ aa(/* @__PURE__ */
|
|
1565
|
-
address:
|
|
1566
|
-
street:
|
|
1567
|
-
neighborhood:
|
|
1568
|
-
locality:
|
|
1569
|
-
district:
|
|
1570
|
-
place:
|
|
1571
|
-
region:
|
|
1572
|
-
postcode:
|
|
1573
|
-
country:
|
|
1553
|
+
}), la = "https://api.mapbox.com/search/searchbox/v1/suggest", ca = "ZzRDWFU0dTZ3SF9aWk9RNGl6QzZaWS5RZmlFak13a0hPbGxXZXlNSGN5RUhObUJ6TXpSV08yUW5OdE5tSTZJU1lpd2lJb1JYYXRObmJ2Tm5iaGhHZWx4V1lpb2pJMUp5ZS5rcA==", ua = (e) => atob(e).split("").reverse().join(""), xe = /* @__PURE__ */ ke({
|
|
1554
|
+
name: /* @__PURE__ */ le()
|
|
1555
|
+
}), da = /* @__PURE__ */ ke({
|
|
1556
|
+
suggestions: /* @__PURE__ */ nn(/* @__PURE__ */ ke({
|
|
1557
|
+
feature_type: /* @__PURE__ */ Je(/* @__PURE__ */ le()),
|
|
1558
|
+
full_address: /* @__PURE__ */ Je(/* @__PURE__ */ le()),
|
|
1559
|
+
place_formatted: /* @__PURE__ */ Je(/* @__PURE__ */ le()),
|
|
1560
|
+
name: /* @__PURE__ */ Je(/* @__PURE__ */ le()),
|
|
1561
|
+
mapbox_id: /* @__PURE__ */ le(),
|
|
1562
|
+
context: /* @__PURE__ */ aa(/* @__PURE__ */ ke({
|
|
1563
|
+
address: xe,
|
|
1564
|
+
street: xe,
|
|
1565
|
+
neighborhood: xe,
|
|
1566
|
+
locality: xe,
|
|
1567
|
+
district: xe,
|
|
1568
|
+
place: xe,
|
|
1569
|
+
region: xe,
|
|
1570
|
+
postcode: xe,
|
|
1571
|
+
country: xe
|
|
1574
1572
|
}))
|
|
1575
1573
|
}))
|
|
1576
1574
|
}), fa = ({
|
|
@@ -1578,14 +1576,14 @@ const Ge = xt("outline-divider ease-expo-out placeholder:text-neutral-10 text-ne
|
|
|
1578
1576
|
t: r
|
|
1579
1577
|
}) => Un(() => {
|
|
1580
1578
|
var n;
|
|
1581
|
-
const t = (n =
|
|
1579
|
+
const t = (n = q.current$.peek().flow) == null ? void 0 : n.data.flowSessionId;
|
|
1582
1580
|
return t ? {
|
|
1583
1581
|
enabled: !0,
|
|
1584
1582
|
getPredictions: async (s) => {
|
|
1585
|
-
var
|
|
1583
|
+
var b;
|
|
1586
1584
|
const i = new URL(la);
|
|
1587
1585
|
i.searchParams.set("q", s), i.searchParams.set("session_token", t);
|
|
1588
|
-
const a = (
|
|
1586
|
+
const a = (b = q.current$.peek().flow) == null ? void 0 : b.locationOrigin;
|
|
1589
1587
|
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", ua(ca));
|
|
1590
1588
|
const u = await fetch(i);
|
|
1591
1589
|
if (!u.ok)
|
|
@@ -1600,24 +1598,24 @@ const Ge = xt("outline-divider ease-expo-out placeholder:text-neutral-10 text-ne
|
|
|
1600
1598
|
error: r("address_error")
|
|
1601
1599
|
};
|
|
1602
1600
|
const {
|
|
1603
|
-
suggestions:
|
|
1601
|
+
suggestions: v
|
|
1604
1602
|
} = f.output;
|
|
1605
1603
|
return {
|
|
1606
1604
|
ok: !0,
|
|
1607
|
-
data:
|
|
1608
|
-
var
|
|
1605
|
+
data: v.map((p) => {
|
|
1606
|
+
var y, C, _, k, E, g, N, V, M;
|
|
1609
1607
|
return {
|
|
1610
1608
|
// A postcode result has no full address and is named by the postcode itself (PROD-7311).
|
|
1611
1609
|
label: p.full_address ?? ([p.name, p.place_formatted].filter(Boolean).join(", ") || p.mapbox_id),
|
|
1612
1610
|
id: p.mapbox_id,
|
|
1613
1611
|
address: {
|
|
1614
|
-
line1: ((
|
|
1612
|
+
line1: ((y = p.context.address) == null ? void 0 : y.name) ?? ((C = p.context.street) == null ? void 0 : C.name),
|
|
1615
1613
|
line2: void 0,
|
|
1616
|
-
line3: ((
|
|
1617
|
-
city: ((
|
|
1618
|
-
state: (
|
|
1619
|
-
postcode: ((
|
|
1620
|
-
country: (
|
|
1614
|
+
line3: ((_ = p.context.neighborhood) == null ? void 0 : _.name) ?? ((k = p.context.locality) == null ? void 0 : k.name),
|
|
1615
|
+
city: ((E = p.context.place) == null ? void 0 : E.name) ?? ((g = p.context.district) == null ? void 0 : g.name),
|
|
1616
|
+
state: (N = p.context.region) == null ? void 0 : N.name,
|
|
1617
|
+
postcode: ((V = p.context.postcode) == null ? void 0 : V.name) ?? (p.feature_type === "postcode" ? p.name : void 0),
|
|
1618
|
+
country: (M = p.context.country) == null ? void 0 : M.name
|
|
1621
1619
|
}
|
|
1622
1620
|
};
|
|
1623
1621
|
})
|
|
@@ -1626,10 +1624,10 @@ const Ge = xt("outline-divider ease-expo-out placeholder:text-neutral-10 text-ne
|
|
|
1626
1624
|
} : {
|
|
1627
1625
|
enabled: !1
|
|
1628
1626
|
};
|
|
1629
|
-
}, [e, r]),
|
|
1627
|
+
}, [e, r]), fr = (e) => {
|
|
1630
1628
|
const {
|
|
1631
1629
|
t: r
|
|
1632
|
-
} =
|
|
1630
|
+
} = ne();
|
|
1633
1631
|
return c("button", {
|
|
1634
1632
|
type: "button",
|
|
1635
1633
|
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",
|
|
@@ -1656,87 +1654,87 @@ const Ge = xt("outline-divider ease-expo-out placeholder:text-neutral-10 text-ne
|
|
|
1656
1654
|
}) => {
|
|
1657
1655
|
const {
|
|
1658
1656
|
t: n
|
|
1659
|
-
} =
|
|
1657
|
+
} = ne(), [s, i] = _e(), {
|
|
1660
1658
|
enabled: a,
|
|
1661
1659
|
getPredictions: o
|
|
1662
1660
|
} = fa({
|
|
1663
1661
|
logger: t,
|
|
1664
1662
|
t: n
|
|
1665
|
-
}), [u, f] =
|
|
1666
|
-
var
|
|
1667
|
-
if (
|
|
1663
|
+
}), [u, f] = _e(a ? "query" : "manual"), [v, b] = _e(""), [p, y] = _e(), C = ye(), _ = ye(), k = (g) => {
|
|
1664
|
+
var V;
|
|
1665
|
+
if (Oe(a, "Query state should not be enabled"), g = g.trim(), g === ((V = C.current) == null ? void 0 : V.query) || g === (p == null ? void 0 : p.query) && p.status === "done")
|
|
1668
1666
|
return;
|
|
1669
|
-
if (
|
|
1670
|
-
|
|
1667
|
+
if (b(g), g === "") {
|
|
1668
|
+
C.current = void 0, y(void 0);
|
|
1671
1669
|
return;
|
|
1672
1670
|
}
|
|
1673
|
-
const
|
|
1674
|
-
query:
|
|
1671
|
+
const N = C.current = {
|
|
1672
|
+
query: g
|
|
1675
1673
|
};
|
|
1676
|
-
|
|
1677
|
-
query:
|
|
1674
|
+
y({
|
|
1675
|
+
query: g,
|
|
1678
1676
|
status: "pending"
|
|
1679
|
-
}), o(
|
|
1680
|
-
|
|
1681
|
-
query:
|
|
1677
|
+
}), o(g).then((M) => {
|
|
1678
|
+
C.current === N && (C.current = void 0, y(M.ok ? {
|
|
1679
|
+
query: g,
|
|
1682
1680
|
status: "done",
|
|
1683
|
-
items:
|
|
1681
|
+
items: M.data
|
|
1684
1682
|
} : {
|
|
1685
|
-
query:
|
|
1683
|
+
query: g,
|
|
1686
1684
|
status: "failed",
|
|
1687
|
-
error:
|
|
1685
|
+
error: M.error
|
|
1688
1686
|
}));
|
|
1689
|
-
}, (
|
|
1690
|
-
|
|
1691
|
-
query:
|
|
1687
|
+
}, (M) => {
|
|
1688
|
+
C.current === N && (C.current = void 0, t.error("Failed to get address details", M), y({
|
|
1689
|
+
query: g,
|
|
1692
1690
|
status: "failed",
|
|
1693
1691
|
error: n("address_error")
|
|
1694
1692
|
}));
|
|
1695
1693
|
});
|
|
1696
|
-
},
|
|
1697
|
-
i((
|
|
1698
|
-
...
|
|
1699
|
-
[
|
|
1694
|
+
}, E = (g, N) => {
|
|
1695
|
+
i((V) => ({
|
|
1696
|
+
...V,
|
|
1697
|
+
[g]: N
|
|
1700
1698
|
}));
|
|
1701
1699
|
};
|
|
1702
1700
|
switch (u) {
|
|
1703
1701
|
case "query":
|
|
1704
|
-
return
|
|
1702
|
+
return Oe(a, "Query state should not be enabled"), c(pa, {
|
|
1705
1703
|
input: e,
|
|
1706
1704
|
onSkip: () => r(null),
|
|
1707
|
-
onAddressSelect: (
|
|
1708
|
-
if (
|
|
1709
|
-
|
|
1705
|
+
onAddressSelect: (g) => {
|
|
1706
|
+
if (g === "") {
|
|
1707
|
+
C.current && (C.current = void 0, y(void 0)), f("manual");
|
|
1710
1708
|
return;
|
|
1711
1709
|
}
|
|
1712
|
-
const
|
|
1713
|
-
|
|
1710
|
+
const N = (p == null ? void 0 : p.status) === "done" ? p.items.find((V) => V.id === g) : void 0;
|
|
1711
|
+
N && (_.current !== g && i(N.address), _.current = g, f("details"));
|
|
1714
1712
|
},
|
|
1715
1713
|
onAddressSearch: k,
|
|
1716
1714
|
lookup: p,
|
|
1717
|
-
query:
|
|
1715
|
+
query: v
|
|
1718
1716
|
});
|
|
1719
1717
|
case "details":
|
|
1720
|
-
return
|
|
1718
|
+
return Oe(s !== void 0), c(hr, {
|
|
1721
1719
|
input: e,
|
|
1722
1720
|
logger: t,
|
|
1723
1721
|
onSubmitSuccess: r,
|
|
1724
1722
|
addressFields: s,
|
|
1725
|
-
onFieldChange:
|
|
1726
|
-
actions: c(
|
|
1723
|
+
onFieldChange: E,
|
|
1724
|
+
actions: c(fr, {
|
|
1727
1725
|
onClick: () => {
|
|
1728
1726
|
f("query");
|
|
1729
1727
|
}
|
|
1730
1728
|
})
|
|
1731
1729
|
});
|
|
1732
1730
|
case "manual":
|
|
1733
|
-
return c(
|
|
1731
|
+
return c(hr, {
|
|
1734
1732
|
logger: t,
|
|
1735
1733
|
input: e,
|
|
1736
1734
|
onSubmitSuccess: r,
|
|
1737
1735
|
addressFields: s ?? {},
|
|
1738
|
-
onFieldChange:
|
|
1739
|
-
actions: a ? c(
|
|
1736
|
+
onFieldChange: E,
|
|
1737
|
+
actions: a ? c(fr, {
|
|
1740
1738
|
onClick: () => {
|
|
1741
1739
|
f("query");
|
|
1742
1740
|
}
|
|
@@ -1758,16 +1756,16 @@ const Ge = xt("outline-divider ease-expo-out placeholder:text-neutral-10 text-ne
|
|
|
1758
1756
|
}) => {
|
|
1759
1757
|
const {
|
|
1760
1758
|
t: a
|
|
1761
|
-
} =
|
|
1759
|
+
} = ne(), o = ye(null);
|
|
1762
1760
|
return Me(() => {
|
|
1763
1761
|
o.current && (o.current.focus(), o.current.select());
|
|
1764
|
-
}, []), c(
|
|
1762
|
+
}, []), c(Ce, {
|
|
1765
1763
|
children: [c("form", {
|
|
1766
1764
|
noValidate: !0,
|
|
1767
1765
|
onSubmit: (u) => {
|
|
1768
1766
|
u.preventDefault();
|
|
1769
|
-
const
|
|
1770
|
-
typeof
|
|
1767
|
+
const v = new FormData(u.currentTarget).get("address");
|
|
1768
|
+
typeof v == "string" && i(v);
|
|
1771
1769
|
},
|
|
1772
1770
|
class: "flex gap-2 p-2.5",
|
|
1773
1771
|
children: [c("div", {
|
|
@@ -1780,7 +1778,7 @@ const Ge = xt("outline-divider ease-expo-out placeholder:text-neutral-10 text-ne
|
|
|
1780
1778
|
autoFocus: !0,
|
|
1781
1779
|
placeholder: e.config.placeholder || a("address_search"),
|
|
1782
1780
|
defaultValue: s,
|
|
1783
|
-
class:
|
|
1781
|
+
class: Ye({
|
|
1784
1782
|
optional: !!e.config.optional,
|
|
1785
1783
|
className: "w-full rounded-full"
|
|
1786
1784
|
})
|
|
@@ -1817,15 +1815,15 @@ const Ge = xt("outline-divider ease-expo-out placeholder:text-neutral-10 text-ne
|
|
|
1817
1815
|
class: "relative",
|
|
1818
1816
|
onClick: r
|
|
1819
1817
|
})]
|
|
1820
|
-
}), (t == null ? void 0 : t.status) === "failed" ? c(
|
|
1818
|
+
}), (t == null ? void 0 : t.status) === "failed" ? c(tt, {
|
|
1821
1819
|
error: {
|
|
1822
1820
|
message: t.error
|
|
1823
1821
|
}
|
|
1824
1822
|
}) : null, c("p", {
|
|
1825
1823
|
role: "status",
|
|
1826
1824
|
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",
|
|
1827
|
-
children: (t == null ? void 0 : t.status) === "pending" ? c(
|
|
1828
|
-
children: [c(
|
|
1825
|
+
children: (t == null ? void 0 : t.status) === "pending" ? c(Ce, {
|
|
1826
|
+
children: [c(Ut, {
|
|
1829
1827
|
"aria-hidden": "true",
|
|
1830
1828
|
class: "h-4 w-4 shrink-0"
|
|
1831
1829
|
}), a("address_searching")]
|
|
@@ -1868,7 +1866,7 @@ const Ge = xt("outline-divider ease-expo-out placeholder:text-neutral-10 text-ne
|
|
|
1868
1866
|
}, "")]
|
|
1869
1867
|
})]
|
|
1870
1868
|
});
|
|
1871
|
-
},
|
|
1869
|
+
}, Rt = ["line1", "line2", "line3", "city", "state", "postcode", "country"], hr = ({
|
|
1872
1870
|
addressFields: e,
|
|
1873
1871
|
onFieldChange: r,
|
|
1874
1872
|
onSubmitSuccess: t,
|
|
@@ -1882,24 +1880,24 @@ const Ge = xt("outline-divider ease-expo-out placeholder:text-neutral-10 text-ne
|
|
|
1882
1880
|
u && (u.focus(), u.select());
|
|
1883
1881
|
}
|
|
1884
1882
|
}, []);
|
|
1885
|
-
const a = Object.keys(
|
|
1883
|
+
const a = Object.keys(Gt), {
|
|
1886
1884
|
t: o
|
|
1887
|
-
} =
|
|
1885
|
+
} = ne();
|
|
1888
1886
|
return c("form", {
|
|
1889
1887
|
class: "flex flex-col px-2 pt-2",
|
|
1890
1888
|
onSubmit: (u) => {
|
|
1891
1889
|
u.preventDefault();
|
|
1892
|
-
const f = u.currentTarget,
|
|
1893
|
-
for (const
|
|
1894
|
-
|
|
1895
|
-
const
|
|
1896
|
-
|
|
1890
|
+
const f = u.currentTarget, v = [...f.querySelectorAll("input")].filter((y) => y.value !== "" && !y.value.trim());
|
|
1891
|
+
for (const y of v) {
|
|
1892
|
+
y.value = "";
|
|
1893
|
+
const C = Rt.find((_) => s.config.keys[_] === y.name);
|
|
1894
|
+
C && r(C, "");
|
|
1897
1895
|
}
|
|
1898
|
-
if (
|
|
1896
|
+
if (v.length > 0 && !f.checkValidity()) {
|
|
1899
1897
|
f.reportValidity();
|
|
1900
1898
|
return;
|
|
1901
1899
|
}
|
|
1902
|
-
const
|
|
1900
|
+
const b = new FormData(f), p = Object.fromEntries(b.entries());
|
|
1903
1901
|
t({
|
|
1904
1902
|
type: "address",
|
|
1905
1903
|
value: p
|
|
@@ -1908,11 +1906,11 @@ const Ge = xt("outline-divider ease-expo-out placeholder:text-neutral-10 text-ne
|
|
|
1908
1906
|
children: [c("div", {
|
|
1909
1907
|
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]",
|
|
1910
1908
|
ref: i,
|
|
1911
|
-
children:
|
|
1912
|
-
const
|
|
1913
|
-
return
|
|
1909
|
+
children: Rt.map((u, f) => {
|
|
1910
|
+
const v = `isdk_${u}`, b = s.config.keys[u];
|
|
1911
|
+
return b ? c(Ce, {
|
|
1914
1912
|
children: [c("label", {
|
|
1915
|
-
for:
|
|
1913
|
+
for: v,
|
|
1916
1914
|
class: "text-neutral-11 [&:has(+*>input:focus)]:text-neutral-12 w-24 pb-2 text-xs uppercase leading-3 tracking-widest transition-colors",
|
|
1917
1915
|
children: o(u)
|
|
1918
1916
|
}), c("div", {
|
|
@@ -1921,8 +1919,8 @@ const Ge = xt("outline-divider ease-expo-out placeholder:text-neutral-10 text-ne
|
|
|
1921
1919
|
class: "relative",
|
|
1922
1920
|
children: [c("select", {
|
|
1923
1921
|
class: "text-neutral-12 hover:bg-neutral-4 placeholder:text-neutral-8 focus:bg-neutral-5 w-full flex-1 appearance-none rounded-lg border-solid bg-transparent bg-none px-3 py-1.5 text-base transition-colors focus:outline-none",
|
|
1924
|
-
name:
|
|
1925
|
-
id:
|
|
1922
|
+
name: b,
|
|
1923
|
+
id: v,
|
|
1926
1924
|
defaultValue: e[u],
|
|
1927
1925
|
onChange: (p) => r(u, p.currentTarget.value),
|
|
1928
1926
|
required: !0,
|
|
@@ -1954,12 +1952,12 @@ const Ge = xt("outline-divider ease-expo-out placeholder:text-neutral-10 text-ne
|
|
|
1954
1952
|
}) : c("input", {
|
|
1955
1953
|
autoFocus: f === 0 ? !0 : void 0,
|
|
1956
1954
|
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",
|
|
1957
|
-
name:
|
|
1958
|
-
id:
|
|
1955
|
+
name: b,
|
|
1956
|
+
id: v,
|
|
1959
1957
|
defaultValue: e[u],
|
|
1960
1958
|
onInput: (p) => r(u, p.currentTarget.value),
|
|
1961
1959
|
required: u === "line2" ? s.config.line2Required === !0 : u !== "line3"
|
|
1962
|
-
}), f ===
|
|
1960
|
+
}), f === Rt.length - 1 ? c("hr", {
|
|
1963
1961
|
class: "m-0 w-full border-b border-b-transparent"
|
|
1964
1962
|
}) : c("hr", {
|
|
1965
1963
|
class: "border-b-neutral-5 m-0 w-full border-b border-solid"
|
|
@@ -1969,18 +1967,18 @@ const Ge = xt("outline-divider ease-expo-out placeholder:text-neutral-10 text-ne
|
|
|
1969
1967
|
})
|
|
1970
1968
|
}), c("div", {
|
|
1971
1969
|
class: "bg-neutral-1 sticky bottom-0 flex items-center py-2",
|
|
1972
|
-
children: [n, c(
|
|
1970
|
+
children: [n, c(Be, {
|
|
1973
1971
|
class: "ml-auto"
|
|
1974
1972
|
})]
|
|
1975
1973
|
})]
|
|
1976
1974
|
});
|
|
1977
|
-
},
|
|
1975
|
+
}, Jt = () => {
|
|
1978
1976
|
const e = ye(null);
|
|
1979
|
-
return
|
|
1977
|
+
return Wr(() => {
|
|
1980
1978
|
var r;
|
|
1981
1979
|
(r = e.current) == null || r.focus();
|
|
1982
1980
|
}, []), e;
|
|
1983
|
-
}, cn = ["true", "false"], ma = /* @__PURE__ */ on(cn), ya = "answer", un = "flex items-center flex-wrap gap-2 p-2.5", dn = "min-w-0 max-w-full flex-auto", fn =
|
|
1981
|
+
}, cn = ["true", "false"], ma = /* @__PURE__ */ on(cn), ya = "answer", un = "flex items-center flex-wrap gap-2 p-2.5", dn = "min-w-0 max-w-full flex-auto", fn = zr(({
|
|
1984
1982
|
label: e,
|
|
1985
1983
|
...r
|
|
1986
1984
|
}, t) => c("button", {
|
|
@@ -1995,13 +1993,13 @@ const Ge = xt("outline-divider ease-expo-out placeholder:text-neutral-10 text-ne
|
|
|
1995
1993
|
input: e,
|
|
1996
1994
|
onSubmitSuccess: r
|
|
1997
1995
|
}) => {
|
|
1998
|
-
const t =
|
|
1996
|
+
const t = Jt();
|
|
1999
1997
|
return c("form", {
|
|
2000
1998
|
noValidate: !0,
|
|
2001
1999
|
class: "",
|
|
2002
2000
|
onSubmit: (n) => {
|
|
2003
2001
|
n.preventDefault();
|
|
2004
|
-
const s =
|
|
2002
|
+
const s = Wn(n).value, i = sa(ma, s);
|
|
2005
2003
|
r({
|
|
2006
2004
|
type: "boolean",
|
|
2007
2005
|
value: i === "true"
|
|
@@ -2035,7 +2033,7 @@ const Ge = xt("outline-divider ease-expo-out placeholder:text-neutral-10 text-ne
|
|
|
2035
2033
|
return t(new Error("Invalid file"));
|
|
2036
2034
|
r(n.result);
|
|
2037
2035
|
}, n.onerror = t, n.readAsDataURL(e);
|
|
2038
|
-
}),
|
|
2036
|
+
}), pr = (e) => e.reduce((r, t) => r + t.sizeKb, 0), va = et("file"), mr = 3, _t = (e) => {
|
|
2039
2037
|
const r = e.lastIndexOf(".");
|
|
2040
2038
|
return r === -1 ? [e, ""] : [e.slice(0, r), e.slice(r)];
|
|
2041
2039
|
}, xa = ({
|
|
@@ -2045,9 +2043,9 @@ const Ge = xt("outline-divider ease-expo-out placeholder:text-neutral-10 text-ne
|
|
|
2045
2043
|
}) => {
|
|
2046
2044
|
const {
|
|
2047
2045
|
t: n
|
|
2048
|
-
} =
|
|
2046
|
+
} = ne(), [s, i] = _t(e.name);
|
|
2049
2047
|
return c("div", {
|
|
2050
|
-
class:
|
|
2048
|
+
class: Qe("bg-accent-1 outline-accent-4 flex max-w-full gap-2 overflow-hidden rounded-lg px-3 py-2 text-sm outline", r),
|
|
2051
2049
|
...t,
|
|
2052
2050
|
children: [c("p", {
|
|
2053
2051
|
class: "text-accent-12 flex flex-grow overflow-hidden",
|
|
@@ -2065,19 +2063,19 @@ const Ge = xt("outline-divider ease-expo-out placeholder:text-neutral-10 text-ne
|
|
|
2065
2063
|
children: [c("span", {
|
|
2066
2064
|
class: "sr-only",
|
|
2067
2065
|
children: [n("file_size"), ": "]
|
|
2068
|
-
}),
|
|
2066
|
+
}), Ge(e.sizeKb)]
|
|
2069
2067
|
})]
|
|
2070
2068
|
});
|
|
2071
|
-
},
|
|
2069
|
+
}, yr = ({
|
|
2072
2070
|
class: e,
|
|
2073
2071
|
...r
|
|
2074
2072
|
}) => c("li", {
|
|
2075
|
-
class:
|
|
2073
|
+
class: Qe("outline-neutral-6 text-neutral-11 bg-neutral-1 block rounded-md px-1 py-0.5 text-xs outline outline-1", e),
|
|
2076
2074
|
...r
|
|
2077
2075
|
}), wa = (e, r) => {
|
|
2078
2076
|
const [t, n] = _t(e);
|
|
2079
2077
|
return `${t.slice(0, r)}${n}`;
|
|
2080
|
-
},
|
|
2078
|
+
}, br = (e) => ({
|
|
2081
2079
|
name: wa(e.name, 42),
|
|
2082
2080
|
sizeKb: e.size / 1e3
|
|
2083
2081
|
}), _a = [".heic", ".heif", ".jpg", ".jpeg", ".png", ".gif", ".webp", ".txt", ".rtf", ".odt", ".pages", ".zip"], ka = (e, r, t) => {
|
|
@@ -2089,81 +2087,81 @@ const Ge = xt("outline-divider ease-expo-out placeholder:text-neutral-10 text-ne
|
|
|
2089
2087
|
analytics: t
|
|
2090
2088
|
}) => {
|
|
2091
2089
|
var k;
|
|
2092
|
-
const n = (k =
|
|
2090
|
+
const n = (k = q.current$.value.flow) == null ? void 0 : k.data.submissions[e.key], [s, i] = _e(va(n) && n.value.length ? {
|
|
2093
2091
|
status: "ready",
|
|
2094
2092
|
files: n.value
|
|
2095
2093
|
} : {
|
|
2096
2094
|
status: "empty"
|
|
2097
|
-
}), a = ye(0), o = s.status === "ready" ? s.files : [], u = s.status === "ready" || s.status === "pending" ? s.files : [], f = s.status === "error" ? s.error : void 0,
|
|
2098
|
-
t:
|
|
2099
|
-
} =
|
|
2100
|
-
if (!
|
|
2095
|
+
}), a = ye(0), o = s.status === "ready" ? s.files : [], u = s.status === "ready" || s.status === "pending" ? s.files : [], f = s.status === "error" ? s.error : void 0, v = u.length - mr, b = pr(u), p = Jt(), {
|
|
2096
|
+
t: y
|
|
2097
|
+
} = ne(), C = (E) => {
|
|
2098
|
+
if (!E.length)
|
|
2101
2099
|
return {
|
|
2102
2100
|
reason: "required",
|
|
2103
2101
|
error: {
|
|
2104
2102
|
type: "required",
|
|
2105
|
-
message:
|
|
2103
|
+
message: y("validation_file")
|
|
2106
2104
|
}
|
|
2107
2105
|
};
|
|
2108
|
-
if (!
|
|
2106
|
+
if (!ir(E, e.config.extensions))
|
|
2109
2107
|
return {
|
|
2110
2108
|
reason: "type",
|
|
2111
|
-
file:
|
|
2109
|
+
file: E.find((g) => !ir([g], e.config.extensions)),
|
|
2112
2110
|
error: {
|
|
2113
2111
|
type: "validate",
|
|
2114
|
-
message:
|
|
2112
|
+
message: y("validation_file_ext", {
|
|
2115
2113
|
ext: e.config.extensions.join(", ")
|
|
2116
2114
|
})
|
|
2117
2115
|
}
|
|
2118
2116
|
};
|
|
2119
|
-
if (
|
|
2117
|
+
if (E.some((g) => g.sizeKb === 0))
|
|
2120
2118
|
return {
|
|
2121
2119
|
reason: "empty",
|
|
2122
|
-
file:
|
|
2120
|
+
file: E.find((g) => g.sizeKb === 0),
|
|
2123
2121
|
error: {
|
|
2124
2122
|
type: "validate",
|
|
2125
|
-
message:
|
|
2123
|
+
message: y("validation_file_empty")
|
|
2126
2124
|
}
|
|
2127
2125
|
};
|
|
2128
|
-
if (e.config.fileSizeLimitKib &&
|
|
2126
|
+
if (e.config.fileSizeLimitKib && pr(E) > e.config.fileSizeLimitKib)
|
|
2129
2127
|
return {
|
|
2130
2128
|
reason: "size",
|
|
2131
2129
|
error: {
|
|
2132
2130
|
type: "max",
|
|
2133
|
-
message:
|
|
2134
|
-
size:
|
|
2131
|
+
message: y("validation_file_size", {
|
|
2132
|
+
size: Ge(e.config.fileSizeLimitKib)
|
|
2135
2133
|
})
|
|
2136
2134
|
}
|
|
2137
2135
|
};
|
|
2138
|
-
if (!e.config.allowMultiple &&
|
|
2136
|
+
if (!e.config.allowMultiple && E.length > 1)
|
|
2139
2137
|
return {
|
|
2140
2138
|
reason: "count",
|
|
2141
2139
|
error: {
|
|
2142
2140
|
type: "invalid",
|
|
2143
|
-
message:
|
|
2141
|
+
message: y("validation_file_max", {
|
|
2144
2142
|
count: 1
|
|
2145
2143
|
})
|
|
2146
2144
|
}
|
|
2147
2145
|
};
|
|
2148
|
-
},
|
|
2149
|
-
var
|
|
2146
|
+
}, _ = (E, g) => {
|
|
2147
|
+
var N, V;
|
|
2150
2148
|
return t.log({
|
|
2151
2149
|
event: "INTERACTION",
|
|
2152
2150
|
properties: {
|
|
2153
|
-
tag: ka(
|
|
2151
|
+
tag: ka(E, g, e.config.extensions)
|
|
2154
2152
|
},
|
|
2155
|
-
customProperties: (
|
|
2153
|
+
customProperties: (V = (N = q.current$.peek().flow) == null ? void 0 : N.analytics) == null ? void 0 : V.customProperties
|
|
2156
2154
|
});
|
|
2157
2155
|
};
|
|
2158
2156
|
return c("form", {
|
|
2159
2157
|
class: "flex flex-col gap-1 p-2.5",
|
|
2160
|
-
onSubmit: (
|
|
2161
|
-
if (
|
|
2158
|
+
onSubmit: (E) => {
|
|
2159
|
+
if (E.preventDefault(), s.status === "pending" || s.status === "error")
|
|
2162
2160
|
return;
|
|
2163
|
-
const
|
|
2164
|
-
|
|
2161
|
+
const g = C(o);
|
|
2162
|
+
g ? i({
|
|
2165
2163
|
status: "error",
|
|
2166
|
-
error:
|
|
2164
|
+
error: g.error
|
|
2167
2165
|
}) : r({
|
|
2168
2166
|
type: "file",
|
|
2169
2167
|
value: o
|
|
@@ -2177,20 +2175,20 @@ const Ge = xt("outline-divider ease-expo-out placeholder:text-neutral-10 text-ne
|
|
|
2177
2175
|
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",
|
|
2178
2176
|
children: [u.length > 0 ? c("ul", {
|
|
2179
2177
|
class: "flex max-w-full flex-wrap justify-center gap-1 overflow-hidden p-1",
|
|
2180
|
-
children: [u.slice(0,
|
|
2181
|
-
const [
|
|
2182
|
-
return c(
|
|
2178
|
+
children: [u.slice(0, mr).map((E) => {
|
|
2179
|
+
const [g, N] = _t(E.name);
|
|
2180
|
+
return c(yr, {
|
|
2183
2181
|
class: "flex overflow-hidden",
|
|
2184
2182
|
children: [c("span", {
|
|
2185
2183
|
class: "block truncate",
|
|
2186
|
-
children:
|
|
2184
|
+
children: g
|
|
2187
2185
|
}), c("span", {
|
|
2188
|
-
children:
|
|
2186
|
+
children: N
|
|
2189
2187
|
})]
|
|
2190
2188
|
});
|
|
2191
|
-
}),
|
|
2192
|
-
children:
|
|
2193
|
-
count:
|
|
2189
|
+
}), v > 0 ? c(yr, {
|
|
2190
|
+
children: y("file_more", {
|
|
2191
|
+
count: v
|
|
2194
2192
|
})
|
|
2195
2193
|
}) : null]
|
|
2196
2194
|
}) : c("div", {
|
|
@@ -2212,13 +2210,13 @@ const Ge = xt("outline-divider ease-expo-out placeholder:text-neutral-10 text-ne
|
|
|
2212
2210
|
})
|
|
2213
2211
|
}), c("p", {
|
|
2214
2212
|
class: "text-neutral-12 tracking-[-0.01em]",
|
|
2215
|
-
children:
|
|
2213
|
+
children: y("upload_file", {
|
|
2216
2214
|
count: e.config.allowMultiple ? 2 : 1
|
|
2217
2215
|
})
|
|
2218
2216
|
}), e.config.fileSizeLimitKib ? c("p", {
|
|
2219
2217
|
class: "text-neutral-11 text-xs",
|
|
2220
|
-
children: ["(",
|
|
2221
|
-
size:
|
|
2218
|
+
children: ["(", y("file_max_size", {
|
|
2219
|
+
size: Ge(e.config.fileSizeLimitKib)
|
|
2222
2220
|
}), ")"]
|
|
2223
2221
|
}) : null]
|
|
2224
2222
|
}), c("aside", {
|
|
@@ -2226,82 +2224,82 @@ const Ge = xt("outline-divider ease-expo-out placeholder:text-neutral-10 text-ne
|
|
|
2226
2224
|
children: [c("p", {
|
|
2227
2225
|
id: "accepted-filetypes",
|
|
2228
2226
|
class: "sr-only",
|
|
2229
|
-
children:
|
|
2227
|
+
children: y("file_extensions")
|
|
2230
2228
|
}), c("ul", {
|
|
2231
2229
|
"aria-describedby": "accepted-filetypes",
|
|
2232
2230
|
class: "flex flex-wrap justify-center gap-2",
|
|
2233
|
-
children: e.config.extensions.map((
|
|
2231
|
+
children: e.config.extensions.map((E) => c("li", {
|
|
2234
2232
|
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",
|
|
2235
|
-
children:
|
|
2233
|
+
children: E.replace(".", "")
|
|
2236
2234
|
}))
|
|
2237
2235
|
})]
|
|
2238
2236
|
})]
|
|
2239
2237
|
}), c("p", {
|
|
2240
2238
|
role: "status",
|
|
2241
|
-
class:
|
|
2242
|
-
children: s.status === "pending" ? c(
|
|
2243
|
-
children: [c(
|
|
2239
|
+
class: Qe("text-neutral-11 flex items-center gap-1.5 text-xs", u.length === 0 && "sr-only"),
|
|
2240
|
+
children: s.status === "pending" ? c(Ce, {
|
|
2241
|
+
children: [c(Ut, {
|
|
2244
2242
|
"aria-hidden": "true",
|
|
2245
2243
|
class: "h-4 w-4"
|
|
2246
|
-
}),
|
|
2244
|
+
}), y("file_preparing", {
|
|
2247
2245
|
count: u.length
|
|
2248
2246
|
})]
|
|
2249
|
-
}) : s.status === "ready" ? c(
|
|
2250
|
-
children: [o.length > 1 ?
|
|
2251
|
-
size:
|
|
2252
|
-
}) :
|
|
2247
|
+
}) : s.status === "ready" ? c(Ce, {
|
|
2248
|
+
children: [o.length > 1 ? y("file_total_size", {
|
|
2249
|
+
size: Ge(b)
|
|
2250
|
+
}) : Ge(b), c("span", {
|
|
2253
2251
|
class: "sr-only",
|
|
2254
|
-
children: [". ",
|
|
2252
|
+
children: [". ", y("file_ready", {
|
|
2255
2253
|
count: o.length
|
|
2256
2254
|
})]
|
|
2257
2255
|
})]
|
|
2258
2256
|
}) : null
|
|
2259
2257
|
}), c("input", {
|
|
2260
2258
|
id: "dropzone-file",
|
|
2261
|
-
"aria-label":
|
|
2259
|
+
"aria-label": y("upload_file", {
|
|
2262
2260
|
count: e.config.allowMultiple ? 2 : 1
|
|
2263
2261
|
}),
|
|
2264
|
-
onInput: async (
|
|
2265
|
-
|
|
2266
|
-
const
|
|
2267
|
-
|
|
2268
|
-
const [
|
|
2269
|
-
if (!
|
|
2262
|
+
onInput: async (E) => {
|
|
2263
|
+
Oe(E.target instanceof HTMLInputElement);
|
|
2264
|
+
const g = E.target.files ? Array.from(E.target.files) : [];
|
|
2265
|
+
E.target.value = "";
|
|
2266
|
+
const [N] = g;
|
|
2267
|
+
if (!N)
|
|
2270
2268
|
return;
|
|
2271
|
-
const
|
|
2272
|
-
if (
|
|
2273
|
-
return
|
|
2269
|
+
const V = ++a.current, M = s.status === "ready", O = g.map(br), K = C(O);
|
|
2270
|
+
if (K)
|
|
2271
|
+
return _(K.reason, K.file ?? N), i({
|
|
2274
2272
|
status: "error",
|
|
2275
|
-
error:
|
|
2273
|
+
error: K.error
|
|
2276
2274
|
});
|
|
2277
2275
|
i({
|
|
2278
2276
|
status: "pending",
|
|
2279
2277
|
files: O
|
|
2280
2278
|
});
|
|
2281
|
-
let
|
|
2279
|
+
let ee;
|
|
2282
2280
|
try {
|
|
2283
|
-
const
|
|
2281
|
+
const T = await Promise.all(g.map(async (R) => {
|
|
2284
2282
|
try {
|
|
2285
2283
|
return {
|
|
2286
|
-
...
|
|
2287
|
-
data: await ga(
|
|
2284
|
+
...br(R),
|
|
2285
|
+
data: await ga(R)
|
|
2288
2286
|
};
|
|
2289
|
-
} catch (
|
|
2290
|
-
throw
|
|
2287
|
+
} catch (B) {
|
|
2288
|
+
throw ee ?? (ee = R), B;
|
|
2291
2289
|
}
|
|
2292
2290
|
}));
|
|
2293
|
-
a.current ===
|
|
2291
|
+
a.current === V && i({
|
|
2294
2292
|
status: "ready",
|
|
2295
|
-
files:
|
|
2293
|
+
files: T
|
|
2296
2294
|
});
|
|
2297
2295
|
} catch {
|
|
2298
|
-
if (a.current !==
|
|
2296
|
+
if (a.current !== V)
|
|
2299
2297
|
return;
|
|
2300
|
-
|
|
2298
|
+
_("unreadable", ee ?? N), i({
|
|
2301
2299
|
status: "error",
|
|
2302
2300
|
error: {
|
|
2303
2301
|
type: "invalid",
|
|
2304
|
-
message:
|
|
2302
|
+
message: y(M ? "file_read_error_replacement" : "file_read_error")
|
|
2305
2303
|
}
|
|
2306
2304
|
});
|
|
2307
2305
|
}
|
|
@@ -2313,59 +2311,59 @@ const Ge = xt("outline-divider ease-expo-out placeholder:text-neutral-10 text-ne
|
|
|
2313
2311
|
})]
|
|
2314
2312
|
}), c("div", {
|
|
2315
2313
|
class: "flex h-full flex-col items-center gap-2",
|
|
2316
|
-
children: [c(
|
|
2314
|
+
children: [c(Be, {
|
|
2317
2315
|
disabled: o.length === 0
|
|
2318
2316
|
}), e.config.optional && c(Le, {
|
|
2319
2317
|
class: "relative",
|
|
2320
2318
|
onClick: () => r(null)
|
|
2321
2319
|
})]
|
|
2322
2320
|
})]
|
|
2323
|
-
}), c(
|
|
2321
|
+
}), c(tt, {
|
|
2324
2322
|
error: f
|
|
2325
2323
|
})]
|
|
2326
2324
|
});
|
|
2327
2325
|
};
|
|
2328
|
-
var ft = (e) => e.type === "checkbox",
|
|
2326
|
+
var ft = (e) => e.type === "checkbox", De = (e) => e instanceof Date, oe = (e) => e == null;
|
|
2329
2327
|
const hn = (e) => typeof e == "object";
|
|
2330
|
-
var
|
|
2328
|
+
var Z = (e) => !oe(e) && !Array.isArray(e) && hn(e) && !De(e), Sa = (e) => Z(e) && e.target ? ft(e.target) ? e.target.checked : e.target.value : e, Ea = (e) => e.substring(0, e.search(/\.\d+(\.|$)/)) || e, Aa = (e, r) => e.has(Ea(r)), Ia = (e) => {
|
|
2331
2329
|
const r = e.constructor && e.constructor.prototype;
|
|
2332
|
-
return
|
|
2333
|
-
},
|
|
2330
|
+
return Z(r) && r.hasOwnProperty("isPrototypeOf");
|
|
2331
|
+
}, Zt = typeof window < "u" && typeof window.HTMLElement < "u" && typeof document < "u";
|
|
2334
2332
|
function Q(e) {
|
|
2335
2333
|
if (e instanceof Date)
|
|
2336
2334
|
return new Date(e);
|
|
2337
2335
|
const r = typeof FileList < "u" && e instanceof FileList;
|
|
2338
|
-
if (
|
|
2336
|
+
if (Zt && (e instanceof Blob || r))
|
|
2339
2337
|
return e;
|
|
2340
2338
|
const t = Array.isArray(e);
|
|
2341
|
-
if (!t && !(
|
|
2339
|
+
if (!t && !(Z(e) && Ia(e)))
|
|
2342
2340
|
return e;
|
|
2343
2341
|
const n = t ? [] : Object.create(Object.getPrototypeOf(e));
|
|
2344
2342
|
for (const s in e)
|
|
2345
2343
|
Object.prototype.hasOwnProperty.call(e, s) && (n[s] = Q(e[s]));
|
|
2346
2344
|
return n;
|
|
2347
2345
|
}
|
|
2348
|
-
var kt = (e) => /^\w*$/.test(e),
|
|
2349
|
-
if (!r || !
|
|
2346
|
+
var kt = (e) => /^\w*$/.test(e), G = (e) => e === void 0, Xt = (e) => Array.isArray(e) ? e.filter(Boolean) : [], Yt = (e) => Xt(e.replace(/["|']|\]/g, "").split(/\.|\[/)), S = (e, r, t) => {
|
|
2347
|
+
if (!r || !Z(e))
|
|
2350
2348
|
return t;
|
|
2351
|
-
const n = (kt(r) ? [r] :
|
|
2352
|
-
return
|
|
2353
|
-
}, me = (e) => typeof e == "boolean", de = (e) => typeof e == "function",
|
|
2349
|
+
const n = (kt(r) ? [r] : Yt(r)).reduce((s, i) => oe(s) ? s : s[i], e);
|
|
2350
|
+
return G(n) || n === e ? G(e[r]) ? t : e[r] : n;
|
|
2351
|
+
}, me = (e) => typeof e == "boolean", de = (e) => typeof e == "function", z = (e, r, t) => {
|
|
2354
2352
|
let n = -1;
|
|
2355
|
-
const s = kt(r) ? [r] :
|
|
2353
|
+
const s = kt(r) ? [r] : Yt(r), i = s.length, a = i - 1;
|
|
2356
2354
|
for (; ++n < i; ) {
|
|
2357
2355
|
const o = s[n];
|
|
2358
2356
|
let u = t;
|
|
2359
2357
|
if (n !== a) {
|
|
2360
2358
|
const f = e[o];
|
|
2361
|
-
u =
|
|
2359
|
+
u = Z(f) || Array.isArray(f) ? f : isNaN(+s[n + 1]) ? {} : [];
|
|
2362
2360
|
}
|
|
2363
2361
|
if (o === "__proto__" || o === "constructor" || o === "prototype")
|
|
2364
2362
|
return;
|
|
2365
2363
|
e[o] = u, e = e[o];
|
|
2366
2364
|
}
|
|
2367
2365
|
};
|
|
2368
|
-
const
|
|
2366
|
+
const gr = {
|
|
2369
2367
|
BLUR: "blur",
|
|
2370
2368
|
FOCUS_OUT: "focusout",
|
|
2371
2369
|
CHANGE: "change"
|
|
@@ -2375,7 +2373,7 @@ const br = {
|
|
|
2375
2373
|
onSubmit: "onSubmit",
|
|
2376
2374
|
onTouched: "onTouched",
|
|
2377
2375
|
all: "all"
|
|
2378
|
-
},
|
|
2376
|
+
}, we = {
|
|
2379
2377
|
max: "max",
|
|
2380
2378
|
min: "min",
|
|
2381
2379
|
maxLength: "maxLength",
|
|
@@ -2383,7 +2381,7 @@ const br = {
|
|
|
2383
2381
|
pattern: "pattern",
|
|
2384
2382
|
required: "required",
|
|
2385
2383
|
validate: "validate"
|
|
2386
|
-
}, Fa =
|
|
2384
|
+
}, Fa = ae.createContext(null);
|
|
2387
2385
|
Fa.displayName = "HookFormControlContext";
|
|
2388
2386
|
var Va = (e, r, t, n = !0) => {
|
|
2389
2387
|
const s = {
|
|
@@ -2398,12 +2396,12 @@ var Va = (e, r, t, n = !0) => {
|
|
|
2398
2396
|
});
|
|
2399
2397
|
return s;
|
|
2400
2398
|
};
|
|
2401
|
-
const Ma = typeof window < "u" ?
|
|
2402
|
-
var
|
|
2399
|
+
const Ma = typeof window < "u" ? ae.useLayoutEffect : ae.useEffect;
|
|
2400
|
+
var ue = (e) => typeof e == "string", La = (e, r, t, n, s) => ue(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), Pt = (e) => oe(e) || !hn(e);
|
|
2403
2401
|
function Fe(e, r, t = /* @__PURE__ */ new WeakSet()) {
|
|
2404
|
-
if (
|
|
2402
|
+
if (Pt(e) || Pt(r))
|
|
2405
2403
|
return Object.is(e, r);
|
|
2406
|
-
if (
|
|
2404
|
+
if (De(e) && De(r))
|
|
2407
2405
|
return Object.is(e.getTime(), r.getTime());
|
|
2408
2406
|
const n = Object.keys(e), s = Object.keys(r);
|
|
2409
2407
|
if (n.length !== s.length)
|
|
@@ -2417,21 +2415,21 @@ function Fe(e, r, t = /* @__PURE__ */ new WeakSet()) {
|
|
|
2417
2415
|
return !1;
|
|
2418
2416
|
if (i !== "ref") {
|
|
2419
2417
|
const o = r[i];
|
|
2420
|
-
if (
|
|
2418
|
+
if (De(a) && De(o) || Z(a) && Z(o) || Array.isArray(a) && Array.isArray(o) ? !Fe(a, o, t) : !Object.is(a, o))
|
|
2421
2419
|
return !1;
|
|
2422
2420
|
}
|
|
2423
2421
|
}
|
|
2424
2422
|
return !0;
|
|
2425
2423
|
}
|
|
2426
|
-
const
|
|
2427
|
-
|
|
2424
|
+
const Na = ae.createContext(null);
|
|
2425
|
+
Na.displayName = "HookFormContext";
|
|
2428
2426
|
var pn = (e, r, t, n, s) => r ? {
|
|
2429
2427
|
...t[e],
|
|
2430
2428
|
types: {
|
|
2431
2429
|
...t[e] && t[e].types ? t[e].types : {},
|
|
2432
2430
|
[n]: s || !0
|
|
2433
2431
|
}
|
|
2434
|
-
} : {}, ut = (e) => Array.isArray(e) ? e : [e],
|
|
2432
|
+
} : {}, ut = (e) => Array.isArray(e) ? e : [e], vr = () => {
|
|
2435
2433
|
let e = [];
|
|
2436
2434
|
return {
|
|
2437
2435
|
get observers() {
|
|
@@ -2456,36 +2454,36 @@ function mn(e, r) {
|
|
|
2456
2454
|
for (const n in e)
|
|
2457
2455
|
if (e.hasOwnProperty(n)) {
|
|
2458
2456
|
const s = e[n], i = r[n];
|
|
2459
|
-
if (s &&
|
|
2457
|
+
if (s && Z(s) && i) {
|
|
2460
2458
|
const a = mn(s, i);
|
|
2461
|
-
|
|
2459
|
+
Z(a) && (t[n] = a);
|
|
2462
2460
|
} else
|
|
2463
2461
|
e[n] && (t[n] = i);
|
|
2464
2462
|
}
|
|
2465
2463
|
return t;
|
|
2466
2464
|
}
|
|
2467
|
-
var
|
|
2468
|
-
if (!
|
|
2465
|
+
var ie = (e) => Z(e) && !Object.keys(e).length, Qt = (e) => e.type === "file", bt = (e) => {
|
|
2466
|
+
if (!Zt)
|
|
2469
2467
|
return !1;
|
|
2470
2468
|
const r = e ? e.ownerDocument : 0;
|
|
2471
2469
|
return e instanceof (r && r.defaultView ? r.defaultView.HTMLElement : HTMLElement);
|
|
2472
|
-
}, yn = (e) => e.type === "select-multiple",
|
|
2470
|
+
}, yn = (e) => e.type === "select-multiple", er = (e) => e.type === "radio", Ra = (e) => er(e) || ft(e), Tt = (e) => bt(e) && e.isConnected;
|
|
2473
2471
|
function Ta(e, r) {
|
|
2474
2472
|
const t = r.slice(0, -1).length;
|
|
2475
2473
|
let n = 0;
|
|
2476
2474
|
for (; n < t; )
|
|
2477
|
-
e =
|
|
2475
|
+
e = G(e) ? n++ : e[r[n++]];
|
|
2478
2476
|
return e;
|
|
2479
2477
|
}
|
|
2480
|
-
function
|
|
2478
|
+
function Da(e) {
|
|
2481
2479
|
for (const r in e)
|
|
2482
|
-
if (e.hasOwnProperty(r) && !
|
|
2480
|
+
if (e.hasOwnProperty(r) && !G(e[r]))
|
|
2483
2481
|
return !1;
|
|
2484
2482
|
return !0;
|
|
2485
2483
|
}
|
|
2486
|
-
function
|
|
2487
|
-
const t = Array.isArray(r) ? r : kt(r) ? [r] :
|
|
2488
|
-
return n && delete n[i], s !== 0 && (
|
|
2484
|
+
function J(e, r) {
|
|
2485
|
+
const t = Array.isArray(r) ? r : kt(r) ? [r] : Yt(r), n = t.length === 1 ? e : Ta(e, t), s = t.length - 1, i = t[s];
|
|
2486
|
+
return n && delete n[i], s !== 0 && (Z(n) && ie(n) || Array.isArray(n) && Da(n)) && J(e, t.slice(0, -1)), e;
|
|
2489
2487
|
}
|
|
2490
2488
|
var Oa = (e) => {
|
|
2491
2489
|
for (const r in e)
|
|
@@ -2494,21 +2492,21 @@ var Oa = (e) => {
|
|
|
2494
2492
|
return !1;
|
|
2495
2493
|
};
|
|
2496
2494
|
function bn(e) {
|
|
2497
|
-
return Array.isArray(e) ||
|
|
2495
|
+
return Array.isArray(e) || Z(e) && !Oa(e);
|
|
2498
2496
|
}
|
|
2499
|
-
function
|
|
2497
|
+
function qt(e, r = {}) {
|
|
2500
2498
|
for (const t in e) {
|
|
2501
2499
|
const n = e[t];
|
|
2502
|
-
bn(n) ? (r[t] = Array.isArray(n) ? [] : {},
|
|
2500
|
+
bn(n) ? (r[t] = Array.isArray(n) ? [] : {}, qt(n, r[t])) : G(n) || (r[t] = !0);
|
|
2503
2501
|
}
|
|
2504
2502
|
return r;
|
|
2505
2503
|
}
|
|
2506
|
-
function
|
|
2507
|
-
t || (t =
|
|
2504
|
+
function Ke(e, r, t) {
|
|
2505
|
+
t || (t = qt(r));
|
|
2508
2506
|
for (const n in e) {
|
|
2509
2507
|
const s = e[n];
|
|
2510
2508
|
if (bn(s))
|
|
2511
|
-
|
|
2509
|
+
G(r) || Pt(t[n]) ? t[n] = qt(s, Array.isArray(s) ? [] : {}) : Ke(s, oe(r) ? {} : r[n], t[n]);
|
|
2512
2510
|
else {
|
|
2513
2511
|
const i = r[n];
|
|
2514
2512
|
t[n] = !Fe(s, i);
|
|
@@ -2516,10 +2514,10 @@ function Ue(e, r, t) {
|
|
|
2516
2514
|
}
|
|
2517
2515
|
return t;
|
|
2518
2516
|
}
|
|
2519
|
-
const
|
|
2517
|
+
const xr = {
|
|
2520
2518
|
value: !1,
|
|
2521
2519
|
isValid: !1
|
|
2522
|
-
},
|
|
2520
|
+
}, wr = { value: !0, isValid: !0 };
|
|
2523
2521
|
var gn = (e) => {
|
|
2524
2522
|
if (Array.isArray(e)) {
|
|
2525
2523
|
if (e.length > 1) {
|
|
@@ -2528,28 +2526,28 @@ var gn = (e) => {
|
|
|
2528
2526
|
}
|
|
2529
2527
|
return e[0].checked && !e[0].disabled ? (
|
|
2530
2528
|
// @ts-expect-error expected to work in the browser
|
|
2531
|
-
e[0].attributes && !
|
|
2532
|
-
) :
|
|
2529
|
+
e[0].attributes && !G(e[0].attributes.value) ? G(e[0].value) || e[0].value === "" ? wr : { value: e[0].value, isValid: !0 } : wr
|
|
2530
|
+
) : xr;
|
|
2533
2531
|
}
|
|
2534
|
-
return
|
|
2535
|
-
}, vn = (e, { valueAsNumber: r, valueAsDate: t, setValueAs: n }) =>
|
|
2536
|
-
const
|
|
2532
|
+
return xr;
|
|
2533
|
+
}, vn = (e, { valueAsNumber: r, valueAsDate: t, setValueAs: n }) => G(e) ? e : r ? e === "" ? NaN : e && +e : t && ue(e) ? new Date(e) : n ? n(e) : e;
|
|
2534
|
+
const _r = {
|
|
2537
2535
|
isValid: !1,
|
|
2538
2536
|
value: null
|
|
2539
2537
|
};
|
|
2540
2538
|
var xn = (e) => Array.isArray(e) ? e.reduce((r, t) => t && t.checked && !t.disabled ? {
|
|
2541
2539
|
isValid: !0,
|
|
2542
2540
|
value: t.value
|
|
2543
|
-
} : r,
|
|
2544
|
-
function
|
|
2541
|
+
} : r, _r) : _r;
|
|
2542
|
+
function kr(e) {
|
|
2545
2543
|
const r = e.ref;
|
|
2546
|
-
return
|
|
2544
|
+
return Qt(r) ? r.files : er(r) ? xn(e.refs).value : yn(r) ? [...r.selectedOptions].map(({ value: t }) => t) : ft(r) ? gn(e.refs).value : vn(G(r.value) ? e.ref.value : r.value, e);
|
|
2547
2545
|
}
|
|
2548
2546
|
var Ba = (e, r, t, n) => {
|
|
2549
2547
|
const s = {};
|
|
2550
2548
|
for (const i of e) {
|
|
2551
2549
|
const a = S(r, i);
|
|
2552
|
-
a &&
|
|
2550
|
+
a && z(s, i, a._f);
|
|
2553
2551
|
}
|
|
2554
2552
|
return {
|
|
2555
2553
|
criteriaMode: t,
|
|
@@ -2557,15 +2555,15 @@ var Ba = (e, r, t, n) => {
|
|
|
2557
2555
|
fields: s,
|
|
2558
2556
|
shouldUseNativeValidation: n
|
|
2559
2557
|
};
|
|
2560
|
-
}, gt = (e) => e instanceof RegExp, it = (e) =>
|
|
2558
|
+
}, gt = (e) => e instanceof RegExp, it = (e) => G(e) ? e : gt(e) ? e.source : Z(e) ? gt(e.value) ? e.value.source : e.value : e, Cr = (e) => ({
|
|
2561
2559
|
isOnSubmit: !e || e === fe.onSubmit,
|
|
2562
2560
|
isOnBlur: e === fe.onBlur,
|
|
2563
2561
|
isOnChange: e === fe.onChange,
|
|
2564
2562
|
isOnAll: e === fe.all,
|
|
2565
2563
|
isOnTouch: e === fe.onTouched
|
|
2566
2564
|
});
|
|
2567
|
-
const
|
|
2568
|
-
var $a = (e) => !!e && !!e.validate && !!(de(e.validate) && e.validate.constructor.name ===
|
|
2565
|
+
const Sr = "AsyncFunction";
|
|
2566
|
+
var $a = (e) => !!e && !!e.validate && !!(de(e.validate) && e.validate.constructor.name === Sr || Z(e.validate) && Object.values(e.validate).find((r) => r.constructor.name === Sr)), ja = (e) => e.mount && (e.required || e.min || e.max || e.maxLength || e.minLength || e.pattern || e.validate), Er = (e, r, t) => !t && (r.watchAll || r.watch.has(e) || [...r.watch].some((n) => e.startsWith(n) && /^\.\w+/.test(e.slice(n.length))));
|
|
2569
2567
|
const dt = (e, r, t, n) => {
|
|
2570
2568
|
for (const s of t || Object.keys(e)) {
|
|
2571
2569
|
const i = S(e, s);
|
|
@@ -2578,7 +2576,7 @@ const dt = (e, r, t, n) => {
|
|
|
2578
2576
|
return !0;
|
|
2579
2577
|
if (dt(o, r))
|
|
2580
2578
|
break;
|
|
2581
|
-
} else if (
|
|
2579
|
+
} else if (Z(o) && dt(o, r))
|
|
2582
2580
|
break;
|
|
2583
2581
|
}
|
|
2584
2582
|
}
|
|
@@ -2614,111 +2612,111 @@ function Ar(e, r, t) {
|
|
|
2614
2612
|
var Pa = (e, r, t, n) => {
|
|
2615
2613
|
t(e);
|
|
2616
2614
|
const { name: s, ...i } = e;
|
|
2617
|
-
return
|
|
2618
|
-
}, qa = (e, r, t) => !e || !r || e === r || ut(e).some((n) => n && (t ? n === r : n.startsWith(r) || r.startsWith(n))), Ua = (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,
|
|
2615
|
+
return ie(i) || Object.keys(i).length >= Object.keys(r).length || Object.keys(i).find((a) => r[a] === (!n || fe.all));
|
|
2616
|
+
}, qa = (e, r, t) => !e || !r || e === r || ut(e).some((n) => n && (t ? n === r : n.startsWith(r) || r.startsWith(n))), Ua = (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, Wa = (e, r) => !Xt(S(e, r)).length && J(e, r), za = (e, r, t) => {
|
|
2619
2617
|
const n = ut(S(e, t));
|
|
2620
|
-
return
|
|
2618
|
+
return z(n, "root", r[t]), z(e, t, n), e;
|
|
2621
2619
|
};
|
|
2622
2620
|
function Ir(e, r, t = "validate") {
|
|
2623
|
-
if (
|
|
2621
|
+
if (ue(e) || Array.isArray(e) && e.every(ue) || me(e) && !e)
|
|
2624
2622
|
return {
|
|
2625
2623
|
type: t,
|
|
2626
|
-
message:
|
|
2624
|
+
message: ue(e) ? e : "",
|
|
2627
2625
|
ref: r
|
|
2628
2626
|
};
|
|
2629
2627
|
}
|
|
2630
|
-
var
|
|
2628
|
+
var He = (e) => Z(e) && !gt(e) ? e : {
|
|
2631
2629
|
value: e,
|
|
2632
2630
|
message: ""
|
|
2633
|
-
},
|
|
2634
|
-
const { ref: a, refs: o, required: u, maxLength: f, minLength:
|
|
2635
|
-
if (!
|
|
2631
|
+
}, Fr = async (e, r, t, n, s, i) => {
|
|
2632
|
+
const { ref: a, refs: o, required: u, maxLength: f, minLength: v, min: b, max: p, pattern: y, validate: C, name: _, valueAsNumber: k, mount: E } = e._f, g = S(t, _);
|
|
2633
|
+
if (!E || r.has(_))
|
|
2636
2634
|
return {};
|
|
2637
|
-
const
|
|
2638
|
-
s &&
|
|
2639
|
-
},
|
|
2640
|
-
const
|
|
2641
|
-
|
|
2642
|
-
type: I ?
|
|
2643
|
-
message:
|
|
2635
|
+
const N = o ? o[0] : a, V = (I) => {
|
|
2636
|
+
s && N.reportValidity && (N.setCustomValidity(me(I) ? "" : I || ""), N.reportValidity());
|
|
2637
|
+
}, M = {}, O = er(a), K = ft(a), ee = O || K, T = (k || Qt(a)) && G(a.value) && G(g) || bt(a) && a.value === "" || g === "" || Array.isArray(g) && !g.length, R = pn.bind(null, _, n, M), B = (I, F, j, L = we.maxLength, W = we.minLength) => {
|
|
2638
|
+
const U = I ? F : j;
|
|
2639
|
+
M[_] = {
|
|
2640
|
+
type: I ? L : W,
|
|
2641
|
+
message: U,
|
|
2644
2642
|
ref: a,
|
|
2645
|
-
...
|
|
2643
|
+
...R(I ? L : W, U)
|
|
2646
2644
|
};
|
|
2647
2645
|
};
|
|
2648
|
-
if (i ? !Array.isArray(
|
|
2649
|
-
const { value: I, message:
|
|
2650
|
-
if (I && (
|
|
2651
|
-
type:
|
|
2652
|
-
message:
|
|
2653
|
-
ref:
|
|
2654
|
-
...
|
|
2646
|
+
if (i ? !Array.isArray(g) || !g.length : u && (!ee && (T || oe(g)) || me(g) && !g || K && !gn(o).isValid || O && !xn(o).isValid)) {
|
|
2647
|
+
const { value: I, message: F } = ue(u) ? { value: !!u, message: u } : He(u);
|
|
2648
|
+
if (I && (M[_] = {
|
|
2649
|
+
type: we.required,
|
|
2650
|
+
message: F,
|
|
2651
|
+
ref: N,
|
|
2652
|
+
...R(we.required, F)
|
|
2655
2653
|
}, !n))
|
|
2656
|
-
return F
|
|
2654
|
+
return V(F), M;
|
|
2657
2655
|
}
|
|
2658
|
-
if (!
|
|
2659
|
-
let I,
|
|
2660
|
-
const
|
|
2661
|
-
if (!
|
|
2662
|
-
const W = a.valueAsNumber ||
|
|
2663
|
-
|
|
2656
|
+
if (!T && (!oe(b) || !oe(p))) {
|
|
2657
|
+
let I, F;
|
|
2658
|
+
const j = He(p), L = He(b);
|
|
2659
|
+
if (!oe(g) && !isNaN(g)) {
|
|
2660
|
+
const W = a.valueAsNumber || g && +g;
|
|
2661
|
+
oe(j.value) || (I = W > j.value), oe(L.value) || (F = W < L.value);
|
|
2664
2662
|
} else {
|
|
2665
|
-
const W = a.valueAsDate || new Date(
|
|
2666
|
-
|
|
2663
|
+
const W = a.valueAsDate || new Date(g), U = (H) => /* @__PURE__ */ new Date((/* @__PURE__ */ new Date()).toDateString() + " " + H), te = a.type == "time", X = a.type == "week";
|
|
2664
|
+
ue(j.value) && g && (I = te ? U(g) > U(j.value) : X ? g > j.value : W > new Date(j.value)), ue(L.value) && g && (F = te ? U(g) < U(L.value) : X ? g < L.value : W < new Date(L.value));
|
|
2667
2665
|
}
|
|
2668
|
-
if ((I ||
|
|
2669
|
-
return
|
|
2666
|
+
if ((I || F) && (B(!!I, j.message, L.message, we.max, we.min), !n))
|
|
2667
|
+
return V(M[_].message), M;
|
|
2670
2668
|
}
|
|
2671
|
-
if ((f ||
|
|
2672
|
-
const I =
|
|
2673
|
-
if ((
|
|
2674
|
-
return
|
|
2669
|
+
if ((f || v) && !T && (ue(g) || i && Array.isArray(g))) {
|
|
2670
|
+
const I = He(f), F = He(v), j = !oe(I.value) && g.length > +I.value, L = !oe(F.value) && g.length < +F.value;
|
|
2671
|
+
if ((j || L) && (B(j, I.message, F.message), !n))
|
|
2672
|
+
return V(M[_].message), M;
|
|
2675
2673
|
}
|
|
2676
|
-
if (
|
|
2677
|
-
const { value: I, message:
|
|
2678
|
-
if (gt(I) && !
|
|
2679
|
-
type:
|
|
2680
|
-
message:
|
|
2674
|
+
if (y && !T && ue(g)) {
|
|
2675
|
+
const { value: I, message: F } = He(y);
|
|
2676
|
+
if (gt(I) && !g.match(I) && (M[_] = {
|
|
2677
|
+
type: we.pattern,
|
|
2678
|
+
message: F,
|
|
2681
2679
|
ref: a,
|
|
2682
|
-
...
|
|
2680
|
+
...R(we.pattern, F)
|
|
2683
2681
|
}, !n))
|
|
2684
|
-
return F
|
|
2682
|
+
return V(F), M;
|
|
2685
2683
|
}
|
|
2686
|
-
if (
|
|
2687
|
-
if (de(
|
|
2688
|
-
const I = await
|
|
2689
|
-
if (
|
|
2690
|
-
...
|
|
2691
|
-
...
|
|
2684
|
+
if (C) {
|
|
2685
|
+
if (de(C)) {
|
|
2686
|
+
const I = await C(g, t), F = Ir(I, N);
|
|
2687
|
+
if (F && (M[_] = {
|
|
2688
|
+
...F,
|
|
2689
|
+
...R(we.validate, F.message)
|
|
2692
2690
|
}, !n))
|
|
2693
|
-
return F
|
|
2694
|
-
} else if (
|
|
2691
|
+
return V(F.message), M;
|
|
2692
|
+
} else if (Z(C)) {
|
|
2695
2693
|
let I = {};
|
|
2696
|
-
for (const
|
|
2697
|
-
if (!
|
|
2694
|
+
for (const F in C) {
|
|
2695
|
+
if (!ie(I) && !n)
|
|
2698
2696
|
break;
|
|
2699
|
-
const
|
|
2700
|
-
|
|
2701
|
-
...
|
|
2702
|
-
...
|
|
2703
|
-
},
|
|
2697
|
+
const j = Ir(await C[F](g, t), N, F);
|
|
2698
|
+
j && (I = {
|
|
2699
|
+
...j,
|
|
2700
|
+
...R(F, j.message)
|
|
2701
|
+
}, V(j.message), n && (M[_] = I));
|
|
2704
2702
|
}
|
|
2705
|
-
if (!
|
|
2706
|
-
ref:
|
|
2703
|
+
if (!ie(I) && (M[_] = {
|
|
2704
|
+
ref: N,
|
|
2707
2705
|
...I
|
|
2708
2706
|
}, !n))
|
|
2709
|
-
return
|
|
2707
|
+
return M;
|
|
2710
2708
|
}
|
|
2711
2709
|
}
|
|
2712
|
-
return
|
|
2710
|
+
return V(!0), M;
|
|
2713
2711
|
};
|
|
2714
|
-
const
|
|
2712
|
+
const Ha = {
|
|
2715
2713
|
mode: fe.onSubmit,
|
|
2716
2714
|
reValidateMode: fe.onChange,
|
|
2717
2715
|
shouldFocusError: !0
|
|
2718
2716
|
};
|
|
2719
2717
|
function Ka(e = {}) {
|
|
2720
2718
|
let r = {
|
|
2721
|
-
...
|
|
2719
|
+
...Ha,
|
|
2722
2720
|
...e
|
|
2723
2721
|
}, t = {
|
|
2724
2722
|
submitCount: 0,
|
|
@@ -2735,7 +2733,7 @@ function Ka(e = {}) {
|
|
|
2735
2733
|
validatingFields: {},
|
|
2736
2734
|
errors: r.errors || {},
|
|
2737
2735
|
disabled: r.disabled || !1
|
|
2738
|
-
}, n = {}, s =
|
|
2736
|
+
}, n = {}, s = Z(r.defaultValues) || Z(r.values) ? Q(r.defaultValues || r.values) || {} : {}, i = r.shouldUnregister ? {} : Q(s), a = {
|
|
2739
2737
|
action: !1,
|
|
2740
2738
|
mount: !1,
|
|
2741
2739
|
watch: !1,
|
|
@@ -2747,7 +2745,7 @@ function Ka(e = {}) {
|
|
|
2747
2745
|
array: /* @__PURE__ */ new Set(),
|
|
2748
2746
|
watch: /* @__PURE__ */ new Set()
|
|
2749
2747
|
}, u, f = 0;
|
|
2750
|
-
const
|
|
2748
|
+
const v = {
|
|
2751
2749
|
isDirty: !1,
|
|
2752
2750
|
dirtyFields: !1,
|
|
2753
2751
|
validatingFields: !1,
|
|
@@ -2755,46 +2753,46 @@ function Ka(e = {}) {
|
|
|
2755
2753
|
isValidating: !1,
|
|
2756
2754
|
isValid: !1,
|
|
2757
2755
|
errors: !1
|
|
2758
|
-
},
|
|
2759
|
-
...
|
|
2756
|
+
}, b = {
|
|
2757
|
+
...v
|
|
2760
2758
|
};
|
|
2761
2759
|
let p = {
|
|
2762
|
-
...
|
|
2760
|
+
...b
|
|
2763
2761
|
};
|
|
2764
|
-
const
|
|
2765
|
-
array:
|
|
2766
|
-
state:
|
|
2767
|
-
},
|
|
2762
|
+
const y = {
|
|
2763
|
+
array: vr(),
|
|
2764
|
+
state: vr()
|
|
2765
|
+
}, C = r.criteriaMode === fe.all, _ = (l) => (d) => {
|
|
2768
2766
|
clearTimeout(f), f = setTimeout(l, d);
|
|
2769
2767
|
}, k = async (l) => {
|
|
2770
|
-
if (!a.keepIsValid && !r.disabled && (
|
|
2768
|
+
if (!a.keepIsValid && !r.disabled && (b.isValid || p.isValid || l)) {
|
|
2771
2769
|
let d;
|
|
2772
|
-
r.resolver ? (d =
|
|
2770
|
+
r.resolver ? (d = ie((await ee()).errors), E()) : d = await R(n, !0), d !== t.isValid && y.state.next({
|
|
2773
2771
|
isValid: d
|
|
2774
2772
|
});
|
|
2775
2773
|
}
|
|
2776
|
-
},
|
|
2777
|
-
!r.disabled && (
|
|
2778
|
-
h && (d ?
|
|
2779
|
-
}),
|
|
2774
|
+
}, E = (l, d) => {
|
|
2775
|
+
!r.disabled && (b.isValidating || b.validatingFields || p.isValidating || p.validatingFields) && ((l || Array.from(o.mount)).forEach((h) => {
|
|
2776
|
+
h && (d ? z(t.validatingFields, h, d) : J(t.validatingFields, h));
|
|
2777
|
+
}), y.state.next({
|
|
2780
2778
|
validatingFields: t.validatingFields,
|
|
2781
|
-
isValidating: !
|
|
2779
|
+
isValidating: !ie(t.validatingFields)
|
|
2782
2780
|
}));
|
|
2783
|
-
},
|
|
2781
|
+
}, g = (l, d = [], h, w, m = !0, x = !0) => {
|
|
2784
2782
|
if (w && h && !r.disabled) {
|
|
2785
|
-
if (a.action = !0,
|
|
2786
|
-
const
|
|
2787
|
-
|
|
2783
|
+
if (a.action = !0, x && Array.isArray(S(n, l))) {
|
|
2784
|
+
const A = h(S(n, l), w.argA, w.argB);
|
|
2785
|
+
m && z(n, l, A);
|
|
2788
2786
|
}
|
|
2789
|
-
if (
|
|
2790
|
-
const
|
|
2791
|
-
|
|
2787
|
+
if (x && Array.isArray(S(t.errors, l))) {
|
|
2788
|
+
const A = h(S(t.errors, l), w.argA, w.argB);
|
|
2789
|
+
m && z(t.errors, l, A), Wa(t.errors, l);
|
|
2792
2790
|
}
|
|
2793
|
-
if ((
|
|
2794
|
-
const
|
|
2795
|
-
|
|
2791
|
+
if ((b.touchedFields || p.touchedFields) && x && Array.isArray(S(t.touchedFields, l))) {
|
|
2792
|
+
const A = h(S(t.touchedFields, l), w.argA, w.argB);
|
|
2793
|
+
m && z(t.touchedFields, l, A);
|
|
2796
2794
|
}
|
|
2797
|
-
(
|
|
2795
|
+
(b.dirtyFields || p.dirtyFields) && (t.dirtyFields = Ke(s, i)), y.state.next({
|
|
2798
2796
|
name: l,
|
|
2799
2797
|
isDirty: I(l, d),
|
|
2800
2798
|
dirtyFields: t.dirtyFields,
|
|
@@ -2802,245 +2800,245 @@ function Ka(e = {}) {
|
|
|
2802
2800
|
isValid: t.isValid
|
|
2803
2801
|
});
|
|
2804
2802
|
} else
|
|
2805
|
-
|
|
2806
|
-
},
|
|
2807
|
-
|
|
2803
|
+
z(i, l, d);
|
|
2804
|
+
}, N = (l, d) => {
|
|
2805
|
+
z(t.errors, l, d), y.state.next({
|
|
2808
2806
|
errors: t.errors
|
|
2809
2807
|
});
|
|
2810
|
-
},
|
|
2811
|
-
t.errors = l,
|
|
2808
|
+
}, V = (l) => {
|
|
2809
|
+
t.errors = l, y.state.next({
|
|
2812
2810
|
errors: t.errors,
|
|
2813
2811
|
isValid: !1
|
|
2814
2812
|
});
|
|
2815
|
-
},
|
|
2816
|
-
const
|
|
2817
|
-
if (
|
|
2818
|
-
const
|
|
2819
|
-
|
|
2813
|
+
}, M = (l, d, h, w) => {
|
|
2814
|
+
const m = S(n, l);
|
|
2815
|
+
if (m) {
|
|
2816
|
+
const x = S(i, l, G(h) ? S(s, l) : h);
|
|
2817
|
+
G(x) || w && w.defaultChecked || d ? z(i, l, d ? x : kr(m._f)) : L(l, x), a.mount && !a.action && k();
|
|
2820
2818
|
}
|
|
2821
|
-
}, O = (l, d, h, w,
|
|
2822
|
-
let
|
|
2819
|
+
}, O = (l, d, h, w, m) => {
|
|
2820
|
+
let x = !1, A = !1;
|
|
2823
2821
|
const $ = {
|
|
2824
2822
|
name: l
|
|
2825
2823
|
};
|
|
2826
2824
|
if (!r.disabled) {
|
|
2827
2825
|
if (!h || w) {
|
|
2828
|
-
(
|
|
2829
|
-
const
|
|
2830
|
-
|
|
2826
|
+
(b.isDirty || p.isDirty) && (A = t.isDirty, t.isDirty = $.isDirty = I(), x = A !== $.isDirty);
|
|
2827
|
+
const P = Fe(S(s, l), d);
|
|
2828
|
+
A = !!S(t.dirtyFields, l), P ? J(t.dirtyFields, l) : z(t.dirtyFields, l, !0), $.dirtyFields = t.dirtyFields, x = x || (b.dirtyFields || p.dirtyFields) && A !== !P;
|
|
2831
2829
|
}
|
|
2832
2830
|
if (h) {
|
|
2833
|
-
const
|
|
2834
|
-
|
|
2831
|
+
const P = S(t.touchedFields, l);
|
|
2832
|
+
P || (z(t.touchedFields, l, h), $.touchedFields = t.touchedFields, x = x || (b.touchedFields || p.touchedFields) && P !== h);
|
|
2835
2833
|
}
|
|
2836
|
-
|
|
2834
|
+
x && m && y.state.next($);
|
|
2837
2835
|
}
|
|
2838
|
-
return
|
|
2839
|
-
},
|
|
2840
|
-
const
|
|
2841
|
-
if (r.delayError && h ? (u =
|
|
2842
|
-
const
|
|
2836
|
+
return x ? $ : {};
|
|
2837
|
+
}, K = (l, d, h, w) => {
|
|
2838
|
+
const m = S(t.errors, l), x = (b.isValid || p.isValid) && me(d) && t.isValid !== d;
|
|
2839
|
+
if (r.delayError && h ? (u = _(() => N(l, h)), u(r.delayError)) : (clearTimeout(f), u = null, h ? z(t.errors, l, h) : J(t.errors, l)), (h ? !Fe(m, h) : m) || !ie(w) || x) {
|
|
2840
|
+
const A = {
|
|
2843
2841
|
...w,
|
|
2844
|
-
...
|
|
2842
|
+
...x && me(d) ? { isValid: d } : {},
|
|
2845
2843
|
errors: t.errors,
|
|
2846
2844
|
name: l
|
|
2847
2845
|
};
|
|
2848
2846
|
t = {
|
|
2849
2847
|
...t,
|
|
2850
|
-
...
|
|
2851
|
-
},
|
|
2848
|
+
...A
|
|
2849
|
+
}, y.state.next(A);
|
|
2852
2850
|
}
|
|
2853
|
-
},
|
|
2854
|
-
const { errors: d } = await
|
|
2855
|
-
if (
|
|
2851
|
+
}, ee = async (l) => (E(l, !0), await r.resolver(i, r.context, Ba(l || o.mount, n, r.criteriaMode, r.shouldUseNativeValidation))), T = async (l) => {
|
|
2852
|
+
const { errors: d } = await ee(l);
|
|
2853
|
+
if (E(l), l)
|
|
2856
2854
|
for (const h of l) {
|
|
2857
2855
|
const w = S(d, h);
|
|
2858
|
-
w ?
|
|
2856
|
+
w ? z(t.errors, h, w) : J(t.errors, h);
|
|
2859
2857
|
}
|
|
2860
2858
|
else
|
|
2861
2859
|
t.errors = d;
|
|
2862
2860
|
return d;
|
|
2863
|
-
},
|
|
2861
|
+
}, R = async (l, d, h = {
|
|
2864
2862
|
valid: !0
|
|
2865
2863
|
}) => {
|
|
2866
2864
|
for (const w in l) {
|
|
2867
|
-
const
|
|
2868
|
-
if (
|
|
2869
|
-
const { _f:
|
|
2870
|
-
if (
|
|
2871
|
-
const $ = o.array.has(
|
|
2872
|
-
|
|
2873
|
-
const
|
|
2874
|
-
if (
|
|
2865
|
+
const m = l[w];
|
|
2866
|
+
if (m) {
|
|
2867
|
+
const { _f: x, ...A } = m;
|
|
2868
|
+
if (x) {
|
|
2869
|
+
const $ = o.array.has(x.name), P = m._f && $a(m._f);
|
|
2870
|
+
P && b.validatingFields && E([x.name], !0);
|
|
2871
|
+
const se = await Fr(m, o.disabled, i, C, r.shouldUseNativeValidation && !d, $);
|
|
2872
|
+
if (P && b.validatingFields && E([x.name]), se[x.name] && (h.valid = !1, d || e.shouldUseNativeValidation))
|
|
2875
2873
|
break;
|
|
2876
|
-
!d && (S(
|
|
2874
|
+
!d && (S(se, x.name) ? $ ? za(t.errors, se, x.name) : z(t.errors, x.name, se[x.name]) : J(t.errors, x.name));
|
|
2877
2875
|
}
|
|
2878
|
-
!
|
|
2876
|
+
!ie(A) && await R(A, d, h);
|
|
2879
2877
|
}
|
|
2880
2878
|
}
|
|
2881
2879
|
return h.valid;
|
|
2882
|
-
},
|
|
2880
|
+
}, B = () => {
|
|
2883
2881
|
for (const l of o.unMount) {
|
|
2884
2882
|
const d = S(n, l);
|
|
2885
|
-
d && (d._f.refs ? d._f.refs.every((h) => !Tt(h)) : !Tt(d._f.ref)) &&
|
|
2883
|
+
d && (d._f.refs ? d._f.refs.every((h) => !Tt(h)) : !Tt(d._f.ref)) && qe(l);
|
|
2886
2884
|
}
|
|
2887
2885
|
o.unMount = /* @__PURE__ */ new Set();
|
|
2888
|
-
}, I = (l, d) => !r.disabled && (l && d &&
|
|
2889
|
-
...a.mount ? i :
|
|
2890
|
-
}, h, d),
|
|
2886
|
+
}, I = (l, d) => !r.disabled && (l && d && z(i, l, d), !Fe(rt(), s)), F = (l, d, h) => La(l, o, {
|
|
2887
|
+
...a.mount ? i : G(d) ? s : ue(l) ? { [l]: d } : d
|
|
2888
|
+
}, h, d), j = (l) => Xt(S(a.mount ? i : s, l, r.shouldUnregister ? S(s, l, []) : [])), L = (l, d, h = {}) => {
|
|
2891
2889
|
const w = S(n, l);
|
|
2892
|
-
let
|
|
2890
|
+
let m = d;
|
|
2893
2891
|
if (w) {
|
|
2894
|
-
const
|
|
2895
|
-
|
|
2896
|
-
(!
|
|
2897
|
-
}) :
|
|
2892
|
+
const x = w._f;
|
|
2893
|
+
x && (!x.disabled && z(i, l, vn(d, x)), m = bt(x.ref) && oe(d) ? "" : d, yn(x.ref) ? [...x.ref.options].forEach((A) => A.selected = m.includes(A.value)) : x.refs ? ft(x.ref) ? x.refs.forEach((A) => {
|
|
2894
|
+
(!A.defaultChecked || !A.disabled) && (Array.isArray(m) ? A.checked = !!m.find(($) => $ === A.value) : A.checked = m === A.value || !!m);
|
|
2895
|
+
}) : x.refs.forEach((A) => A.checked = A.value === m) : Qt(x.ref) ? x.ref.value = "" : (x.ref.value = m, x.ref.type || y.state.next({
|
|
2898
2896
|
name: l,
|
|
2899
2897
|
values: Q(i)
|
|
2900
2898
|
})));
|
|
2901
2899
|
}
|
|
2902
|
-
(h.shouldDirty || h.shouldTouch) && O(l,
|
|
2900
|
+
(h.shouldDirty || h.shouldTouch) && O(l, m, h.shouldTouch, h.shouldDirty, !0), h.shouldValidate && H(l);
|
|
2903
2901
|
}, W = (l, d, h) => {
|
|
2904
2902
|
for (const w in d) {
|
|
2905
2903
|
if (!d.hasOwnProperty(w))
|
|
2906
2904
|
return;
|
|
2907
|
-
const
|
|
2908
|
-
(o.array.has(l) ||
|
|
2905
|
+
const m = d[w], x = l + "." + w, A = S(n, x);
|
|
2906
|
+
(o.array.has(l) || Z(m) || A && !A._f) && !De(m) ? W(x, m, h) : L(x, m, h);
|
|
2909
2907
|
}
|
|
2910
|
-
},
|
|
2911
|
-
const w = S(n, l),
|
|
2912
|
-
|
|
2908
|
+
}, U = (l, d, h = {}) => {
|
|
2909
|
+
const w = S(n, l), m = o.array.has(l), x = Q(d);
|
|
2910
|
+
z(i, l, x), m ? (y.array.next({
|
|
2913
2911
|
name: l,
|
|
2914
2912
|
values: Q(i)
|
|
2915
|
-
}), (
|
|
2913
|
+
}), (b.isDirty || b.dirtyFields || p.isDirty || p.dirtyFields) && h.shouldDirty && y.state.next({
|
|
2916
2914
|
name: l,
|
|
2917
|
-
dirtyFields:
|
|
2918
|
-
isDirty: I(l,
|
|
2919
|
-
})) : w && !w._f && !
|
|
2915
|
+
dirtyFields: Ke(s, i),
|
|
2916
|
+
isDirty: I(l, x)
|
|
2917
|
+
})) : w && !w._f && !oe(x) ? W(l, x, h) : L(l, x, h), Er(l, o) ? y.state.next({
|
|
2920
2918
|
...t,
|
|
2921
2919
|
name: l,
|
|
2922
2920
|
values: Q(i)
|
|
2923
|
-
}) :
|
|
2921
|
+
}) : y.state.next({
|
|
2924
2922
|
name: a.mount ? l : void 0,
|
|
2925
2923
|
values: Q(i)
|
|
2926
2924
|
});
|
|
2927
|
-
},
|
|
2925
|
+
}, te = async (l) => {
|
|
2928
2926
|
a.mount = !0;
|
|
2929
2927
|
const d = l.target;
|
|
2930
2928
|
let h = d.name, w = !0;
|
|
2931
|
-
const
|
|
2932
|
-
w = Number.isNaN(
|
|
2933
|
-
},
|
|
2934
|
-
if (
|
|
2935
|
-
let
|
|
2936
|
-
const
|
|
2937
|
-
|
|
2938
|
-
const
|
|
2939
|
-
if (!
|
|
2929
|
+
const m = S(n, h), x = (P) => {
|
|
2930
|
+
w = Number.isNaN(P) || De(P) && isNaN(P.getTime()) || Fe(P, S(i, h, P));
|
|
2931
|
+
}, A = Cr(r.mode), $ = Cr(r.reValidateMode);
|
|
2932
|
+
if (m) {
|
|
2933
|
+
let P, se;
|
|
2934
|
+
const Te = d.type ? kr(m._f) : Sa(l), Ee = l.type === gr.BLUR || l.type === gr.FOCUS_OUT, _n = !ja(m._f) && !r.resolver && !S(t.errors, h) && !m._f.deps || Ua(Ee, S(t.touchedFields, h), t.isSubmitted, $, A), At = Er(h, o, Ee);
|
|
2935
|
+
z(i, h, Te), Ee ? (!d || !d.readOnly) && (m._f.onBlur && m._f.onBlur(l), u && u(0)) : m._f.onChange && m._f.onChange(l);
|
|
2936
|
+
const It = O(h, Te, Ee), kn = !ie(It) || At;
|
|
2937
|
+
if (!Ee && y.state.next({
|
|
2940
2938
|
name: h,
|
|
2941
2939
|
type: l.type,
|
|
2942
2940
|
values: Q(i)
|
|
2943
2941
|
}), _n)
|
|
2944
|
-
return (
|
|
2945
|
-
if (!
|
|
2946
|
-
const { errors:
|
|
2947
|
-
if (
|
|
2948
|
-
const Cn = Ar(t.errors, n, h),
|
|
2949
|
-
|
|
2942
|
+
return (b.isValid || p.isValid) && (r.mode === "onBlur" ? Ee && k() : Ee || k()), kn && y.state.next({ name: h, ...At ? {} : It });
|
|
2943
|
+
if (!Ee && At && y.state.next({ ...t }), r.resolver) {
|
|
2944
|
+
const { errors: tr } = await ee([h]);
|
|
2945
|
+
if (E([h]), x(Te), w) {
|
|
2946
|
+
const Cn = Ar(t.errors, n, h), rr = Ar(tr, n, Cn.name || h);
|
|
2947
|
+
P = rr.error, h = rr.name, se = ie(tr);
|
|
2950
2948
|
}
|
|
2951
2949
|
} else
|
|
2952
|
-
|
|
2953
|
-
w && (
|
|
2950
|
+
E([h], !0), P = (await Fr(m, o.disabled, i, C, r.shouldUseNativeValidation))[h], E([h]), x(Te), w && (P ? se = !1 : (b.isValid || p.isValid) && (se = await R(n, !0)));
|
|
2951
|
+
w && (m._f.deps && (!Array.isArray(m._f.deps) || m._f.deps.length > 0) && H(m._f.deps), K(h, se, P, It));
|
|
2954
2952
|
}
|
|
2955
|
-
},
|
|
2953
|
+
}, X = (l, d) => {
|
|
2956
2954
|
if (S(t.errors, d) && l.focus)
|
|
2957
2955
|
return l.focus(), 1;
|
|
2958
|
-
},
|
|
2956
|
+
}, H = async (l, d = {}) => {
|
|
2959
2957
|
let h, w;
|
|
2960
|
-
const
|
|
2958
|
+
const m = ut(l);
|
|
2961
2959
|
if (r.resolver) {
|
|
2962
|
-
const
|
|
2963
|
-
h =
|
|
2960
|
+
const x = await T(G(l) ? l : m);
|
|
2961
|
+
h = ie(x), w = l ? !m.some((A) => S(x, A)) : h;
|
|
2964
2962
|
} else
|
|
2965
|
-
l ? (w = (await Promise.all(
|
|
2966
|
-
const
|
|
2967
|
-
return await
|
|
2968
|
-
}))).every(Boolean), !(!w && !t.isValid) && k()) : w = h = await
|
|
2969
|
-
return
|
|
2970
|
-
...!
|
|
2963
|
+
l ? (w = (await Promise.all(m.map(async (x) => {
|
|
2964
|
+
const A = S(n, x);
|
|
2965
|
+
return await R(A && A._f ? { [x]: A } : A);
|
|
2966
|
+
}))).every(Boolean), !(!w && !t.isValid) && k()) : w = h = await R(n);
|
|
2967
|
+
return y.state.next({
|
|
2968
|
+
...!ue(l) || (b.isValid || p.isValid) && h !== t.isValid ? {} : { name: l },
|
|
2971
2969
|
...r.resolver || !l ? { isValid: h } : {},
|
|
2972
2970
|
errors: t.errors
|
|
2973
|
-
}), d.shouldFocus && !w && dt(n,
|
|
2974
|
-
},
|
|
2971
|
+
}), d.shouldFocus && !w && dt(n, X, l ? m : o.mount), w;
|
|
2972
|
+
}, rt = (l, d) => {
|
|
2975
2973
|
let h = {
|
|
2976
2974
|
...a.mount ? i : s
|
|
2977
2975
|
};
|
|
2978
|
-
return d && (h = mn(d.dirtyFields ? t.dirtyFields : t.touchedFields, h)),
|
|
2979
|
-
},
|
|
2976
|
+
return d && (h = mn(d.dirtyFields ? t.dirtyFields : t.touchedFields, h)), G(l) ? h : ue(l) ? S(h, l) : l.map((w) => S(h, w));
|
|
2977
|
+
}, $e = (l, d) => ({
|
|
2980
2978
|
invalid: !!S((d || t).errors, l),
|
|
2981
2979
|
isDirty: !!S((d || t).dirtyFields, l),
|
|
2982
2980
|
error: S((d || t).errors, l),
|
|
2983
2981
|
isValidating: !!S(t.validatingFields, l),
|
|
2984
2982
|
isTouched: !!S((d || t).touchedFields, l)
|
|
2985
|
-
}),
|
|
2983
|
+
}), D = (l) => {
|
|
2986
2984
|
const d = l ? ut(l) : void 0;
|
|
2987
|
-
d == null || d.forEach((h) =>
|
|
2988
|
-
|
|
2985
|
+
d == null || d.forEach((h) => J(t.errors, h)), d ? d.forEach((h) => {
|
|
2986
|
+
y.state.next({
|
|
2989
2987
|
name: h,
|
|
2990
2988
|
errors: t.errors
|
|
2991
2989
|
});
|
|
2992
|
-
}) :
|
|
2990
|
+
}) : y.state.next({
|
|
2993
2991
|
errors: {}
|
|
2994
2992
|
});
|
|
2995
|
-
},
|
|
2996
|
-
const w = (S(n, l, { _f: {} })._f || {}).ref,
|
|
2997
|
-
|
|
2998
|
-
...
|
|
2993
|
+
}, je = (l, d, h) => {
|
|
2994
|
+
const w = (S(n, l, { _f: {} })._f || {}).ref, m = S(t.errors, l) || {}, { ref: x, message: A, type: $, ...P } = m;
|
|
2995
|
+
z(t.errors, l, {
|
|
2996
|
+
...P,
|
|
2999
2997
|
...d,
|
|
3000
2998
|
ref: w
|
|
3001
|
-
}),
|
|
2999
|
+
}), y.state.next({
|
|
3002
3000
|
name: l,
|
|
3003
3001
|
errors: t.errors,
|
|
3004
3002
|
isValid: !1
|
|
3005
3003
|
}), h && h.shouldFocus && w && w.focus && w.focus();
|
|
3006
|
-
},
|
|
3007
|
-
next: (h) => "values" in h && l(
|
|
3008
|
-
}) :
|
|
3004
|
+
}, Pe = (l, d) => de(l) ? y.state.subscribe({
|
|
3005
|
+
next: (h) => "values" in h && l(F(void 0, d), h)
|
|
3006
|
+
}) : F(l, d, !0), Se = (l) => y.state.subscribe({
|
|
3009
3007
|
next: (d) => {
|
|
3010
|
-
qa(l.name, d.name, l.exact) && Pa(d, l.formState ||
|
|
3008
|
+
qa(l.name, d.name, l.exact) && Pa(d, l.formState || b, mt, l.reRenderRoot) && l.callback({
|
|
3011
3009
|
values: { ...i },
|
|
3012
3010
|
...t,
|
|
3013
3011
|
...d,
|
|
3014
3012
|
defaultValues: s
|
|
3015
3013
|
});
|
|
3016
3014
|
}
|
|
3017
|
-
}).unsubscribe,
|
|
3015
|
+
}).unsubscribe, Ne = (l) => (a.mount = !0, p = {
|
|
3018
3016
|
...p,
|
|
3019
3017
|
...l.formState
|
|
3020
|
-
},
|
|
3018
|
+
}, Se({
|
|
3021
3019
|
...l,
|
|
3022
3020
|
formState: {
|
|
3023
|
-
...
|
|
3021
|
+
...v,
|
|
3024
3022
|
...l.formState
|
|
3025
3023
|
}
|
|
3026
|
-
})),
|
|
3024
|
+
})), qe = (l, d = {}) => {
|
|
3027
3025
|
for (const h of l ? ut(l) : o.mount)
|
|
3028
|
-
o.mount.delete(h), o.array.delete(h), d.keepValue || (
|
|
3029
|
-
|
|
3026
|
+
o.mount.delete(h), o.array.delete(h), d.keepValue || (J(n, h), J(i, h)), !d.keepError && J(t.errors, h), !d.keepDirty && J(t.dirtyFields, h), !d.keepTouched && J(t.touchedFields, h), !d.keepIsValidating && J(t.validatingFields, h), !r.shouldUnregister && !d.keepDefaultValue && J(s, h);
|
|
3027
|
+
y.state.next({
|
|
3030
3028
|
values: Q(i)
|
|
3031
|
-
}),
|
|
3029
|
+
}), y.state.next({
|
|
3032
3030
|
...t,
|
|
3033
3031
|
...d.keepDirty ? { isDirty: I() } : {}
|
|
3034
3032
|
}), !d.keepIsValid && k();
|
|
3035
|
-
},
|
|
3033
|
+
}, nt = ({ disabled: l, name: d }) => {
|
|
3036
3034
|
if (me(l) && a.mount || l || o.disabled.has(d)) {
|
|
3037
|
-
const
|
|
3038
|
-
l ? o.disabled.add(d) : o.disabled.delete(d),
|
|
3035
|
+
const m = o.disabled.has(d) !== !!l;
|
|
3036
|
+
l ? o.disabled.add(d) : o.disabled.delete(d), m && a.mount && !a.action && k();
|
|
3039
3037
|
}
|
|
3040
|
-
},
|
|
3038
|
+
}, ge = (l, d = {}) => {
|
|
3041
3039
|
let h = S(n, l);
|
|
3042
3040
|
const w = me(d.disabled) || me(r.disabled);
|
|
3043
|
-
return
|
|
3041
|
+
return z(n, l, {
|
|
3044
3042
|
...h || {},
|
|
3045
3043
|
_f: {
|
|
3046
3044
|
...h && h._f ? h._f : { ref: { name: l } },
|
|
@@ -3048,10 +3046,10 @@ function Ka(e = {}) {
|
|
|
3048
3046
|
mount: !0,
|
|
3049
3047
|
...d
|
|
3050
3048
|
}
|
|
3051
|
-
}), o.mount.add(l), h ?
|
|
3049
|
+
}), o.mount.add(l), h ? nt({
|
|
3052
3050
|
disabled: me(d.disabled) ? d.disabled : r.disabled,
|
|
3053
3051
|
name: l
|
|
3054
|
-
}) :
|
|
3052
|
+
}) : M(l, !0, d.value), {
|
|
3055
3053
|
...w ? { disabled: d.disabled || r.disabled } : {},
|
|
3056
3054
|
...r.progressive ? {
|
|
3057
3055
|
required: !!d.required,
|
|
@@ -3062,110 +3060,110 @@ function Ka(e = {}) {
|
|
|
3062
3060
|
pattern: it(d.pattern)
|
|
3063
3061
|
} : {},
|
|
3064
3062
|
name: l,
|
|
3065
|
-
onChange:
|
|
3066
|
-
onBlur:
|
|
3067
|
-
ref: (
|
|
3068
|
-
if (
|
|
3069
|
-
|
|
3070
|
-
const
|
|
3071
|
-
if (
|
|
3063
|
+
onChange: te,
|
|
3064
|
+
onBlur: te,
|
|
3065
|
+
ref: (m) => {
|
|
3066
|
+
if (m) {
|
|
3067
|
+
ge(l, d), h = S(n, l);
|
|
3068
|
+
const x = G(m.value) && m.querySelectorAll && m.querySelectorAll("input,select,textarea")[0] || m, A = Ra(x), $ = h._f.refs || [];
|
|
3069
|
+
if (A ? $.find((P) => P === x) : x === h._f.ref)
|
|
3072
3070
|
return;
|
|
3073
|
-
|
|
3071
|
+
z(n, l, {
|
|
3074
3072
|
_f: {
|
|
3075
3073
|
...h._f,
|
|
3076
|
-
...
|
|
3074
|
+
...A ? {
|
|
3077
3075
|
refs: [
|
|
3078
3076
|
...$.filter(Tt),
|
|
3079
|
-
|
|
3077
|
+
x,
|
|
3080
3078
|
...Array.isArray(S(s, l)) ? [{}] : []
|
|
3081
3079
|
],
|
|
3082
|
-
ref: { type:
|
|
3083
|
-
} : { ref:
|
|
3080
|
+
ref: { type: x.type, name: l }
|
|
3081
|
+
} : { ref: x }
|
|
3084
3082
|
}
|
|
3085
|
-
}),
|
|
3083
|
+
}), M(l, !1, void 0, x);
|
|
3086
3084
|
} else
|
|
3087
|
-
h = S(n, l, {}), h._f && (h._f.mount = !1), (r.shouldUnregister || d.shouldUnregister) && !(
|
|
3085
|
+
h = S(n, l, {}), h._f && (h._f.mount = !1), (r.shouldUnregister || d.shouldUnregister) && !(Aa(o.array, l) && a.action) && o.unMount.add(l);
|
|
3088
3086
|
}
|
|
3089
3087
|
};
|
|
3090
|
-
},
|
|
3091
|
-
me(l) && (
|
|
3088
|
+
}, Ue = () => r.shouldFocusError && dt(n, X, o.mount), ht = (l) => {
|
|
3089
|
+
me(l) && (y.state.next({ disabled: l }), dt(n, (d, h) => {
|
|
3092
3090
|
const w = S(n, h);
|
|
3093
|
-
w && (d.disabled = w._f.disabled || l, Array.isArray(w._f.refs) && w._f.refs.forEach((
|
|
3094
|
-
|
|
3091
|
+
w && (d.disabled = w._f.disabled || l, Array.isArray(w._f.refs) && w._f.refs.forEach((m) => {
|
|
3092
|
+
m.disabled = w._f.disabled || l;
|
|
3095
3093
|
}));
|
|
3096
3094
|
}, 0, !1));
|
|
3097
|
-
},
|
|
3095
|
+
}, We = (l, d) => async (h) => {
|
|
3098
3096
|
let w;
|
|
3099
3097
|
h && (h.preventDefault && h.preventDefault(), h.persist && h.persist());
|
|
3100
|
-
let
|
|
3101
|
-
if (
|
|
3098
|
+
let m = Q(i);
|
|
3099
|
+
if (y.state.next({
|
|
3102
3100
|
isSubmitting: !0
|
|
3103
3101
|
}), r.resolver) {
|
|
3104
|
-
const { errors:
|
|
3105
|
-
|
|
3102
|
+
const { errors: x, values: A } = await ee();
|
|
3103
|
+
E(), t.errors = x, m = Q(A);
|
|
3106
3104
|
} else
|
|
3107
|
-
await
|
|
3105
|
+
await R(n);
|
|
3108
3106
|
if (o.disabled.size)
|
|
3109
|
-
for (const
|
|
3110
|
-
|
|
3111
|
-
if (
|
|
3112
|
-
|
|
3107
|
+
for (const x of o.disabled)
|
|
3108
|
+
J(m, x);
|
|
3109
|
+
if (J(t.errors, "root"), ie(t.errors)) {
|
|
3110
|
+
y.state.next({
|
|
3113
3111
|
errors: {}
|
|
3114
3112
|
});
|
|
3115
3113
|
try {
|
|
3116
|
-
await l(
|
|
3117
|
-
} catch (
|
|
3118
|
-
w =
|
|
3114
|
+
await l(m, h);
|
|
3115
|
+
} catch (x) {
|
|
3116
|
+
w = x;
|
|
3119
3117
|
}
|
|
3120
3118
|
} else
|
|
3121
|
-
d && await d({ ...t.errors }, h),
|
|
3122
|
-
if (
|
|
3119
|
+
d && await d({ ...t.errors }, h), Ue(), setTimeout(Ue);
|
|
3120
|
+
if (y.state.next({
|
|
3123
3121
|
isSubmitted: !0,
|
|
3124
3122
|
isSubmitting: !1,
|
|
3125
|
-
isSubmitSuccessful:
|
|
3123
|
+
isSubmitSuccessful: ie(t.errors) && !w,
|
|
3126
3124
|
submitCount: t.submitCount + 1,
|
|
3127
3125
|
errors: t.errors
|
|
3128
3126
|
}), w)
|
|
3129
3127
|
throw w;
|
|
3130
|
-
},
|
|
3131
|
-
S(n, l) && (
|
|
3132
|
-
},
|
|
3133
|
-
const h = l ? Q(l) : s, w = Q(h),
|
|
3128
|
+
}, ze = (l, d = {}) => {
|
|
3129
|
+
S(n, l) && (G(d.defaultValue) ? U(l, Q(S(s, l))) : (U(l, d.defaultValue), z(s, l, Q(d.defaultValue))), d.keepTouched || J(t.touchedFields, l), d.keepDirty || (J(t.dirtyFields, l), t.isDirty = d.defaultValue ? I(l, Q(S(s, l))) : I()), d.keepError || (J(t.errors, l), b.isValid && k()), y.state.next({ ...t }));
|
|
3130
|
+
}, Re = (l, d = {}) => {
|
|
3131
|
+
const h = l ? Q(l) : s, w = Q(h), m = ie(l), x = m ? s : w;
|
|
3134
3132
|
if (d.keepDefaultValues || (s = h), !d.keepValues) {
|
|
3135
3133
|
if (d.keepDirtyValues) {
|
|
3136
|
-
const
|
|
3134
|
+
const A = /* @__PURE__ */ new Set([
|
|
3137
3135
|
...o.mount,
|
|
3138
|
-
...Object.keys(
|
|
3136
|
+
...Object.keys(Ke(s, i))
|
|
3139
3137
|
]);
|
|
3140
|
-
for (const $ of Array.from(
|
|
3141
|
-
const
|
|
3142
|
-
|
|
3138
|
+
for (const $ of Array.from(A)) {
|
|
3139
|
+
const P = S(t.dirtyFields, $), se = S(i, $), Te = S(x, $);
|
|
3140
|
+
P && !G(se) ? z(x, $, se) : !P && !G(Te) && U($, Te);
|
|
3143
3141
|
}
|
|
3144
3142
|
} else {
|
|
3145
|
-
if (
|
|
3146
|
-
for (const
|
|
3147
|
-
const $ = S(n,
|
|
3143
|
+
if (Zt && G(l))
|
|
3144
|
+
for (const A of o.mount) {
|
|
3145
|
+
const $ = S(n, A);
|
|
3148
3146
|
if ($ && $._f) {
|
|
3149
|
-
const
|
|
3150
|
-
if (bt(
|
|
3151
|
-
const
|
|
3152
|
-
if (
|
|
3153
|
-
|
|
3147
|
+
const P = Array.isArray($._f.refs) ? $._f.refs[0] : $._f.ref;
|
|
3148
|
+
if (bt(P)) {
|
|
3149
|
+
const se = P.closest("form");
|
|
3150
|
+
if (se) {
|
|
3151
|
+
se.reset();
|
|
3154
3152
|
break;
|
|
3155
3153
|
}
|
|
3156
3154
|
}
|
|
3157
3155
|
}
|
|
3158
3156
|
}
|
|
3159
3157
|
if (d.keepFieldsRef)
|
|
3160
|
-
for (const
|
|
3161
|
-
|
|
3158
|
+
for (const A of o.mount)
|
|
3159
|
+
U(A, S(x, A));
|
|
3162
3160
|
else
|
|
3163
3161
|
n = {};
|
|
3164
3162
|
}
|
|
3165
|
-
i = r.shouldUnregister ? d.keepDefaultValues ? Q(s) : {} : Q(
|
|
3166
|
-
values: { ...
|
|
3167
|
-
}),
|
|
3168
|
-
values: { ...
|
|
3163
|
+
i = r.shouldUnregister ? d.keepDefaultValues ? Q(s) : {} : Q(x), y.array.next({
|
|
3164
|
+
values: { ...x }
|
|
3165
|
+
}), y.state.next({
|
|
3166
|
+
values: { ...x }
|
|
3169
3167
|
});
|
|
3170
3168
|
}
|
|
3171
3169
|
o = {
|
|
@@ -3176,23 +3174,23 @@ function Ka(e = {}) {
|
|
|
3176
3174
|
watch: /* @__PURE__ */ new Set(),
|
|
3177
3175
|
watchAll: !1,
|
|
3178
3176
|
focus: ""
|
|
3179
|
-
}, a.mount = !
|
|
3177
|
+
}, a.mount = !b.isValid || !!d.keepIsValid || !!d.keepDirtyValues || !r.shouldUnregister && !ie(x), a.watch = !!r.shouldUnregister, a.keepIsValid = !!d.keepIsValid, a.action = !1, d.keepErrors || (t.errors = {}), y.state.next({
|
|
3180
3178
|
submitCount: d.keepSubmitCount ? t.submitCount : 0,
|
|
3181
|
-
isDirty:
|
|
3179
|
+
isDirty: m ? !1 : d.keepDirty ? t.isDirty : !!(d.keepDefaultValues && !Fe(l, s)),
|
|
3182
3180
|
isSubmitted: d.keepIsSubmitted ? t.isSubmitted : !1,
|
|
3183
|
-
dirtyFields:
|
|
3181
|
+
dirtyFields: m ? {} : d.keepDirtyValues ? d.keepDefaultValues && i ? Ke(s, i) : t.dirtyFields : d.keepDefaultValues && l ? Ke(s, l) : d.keepDirty ? t.dirtyFields : {},
|
|
3184
3182
|
touchedFields: d.keepTouched ? t.touchedFields : {},
|
|
3185
3183
|
errors: d.keepErrors ? t.errors : {},
|
|
3186
3184
|
isSubmitSuccessful: d.keepIsSubmitSuccessful ? t.isSubmitSuccessful : !1,
|
|
3187
3185
|
isSubmitting: !1,
|
|
3188
3186
|
defaultValues: s
|
|
3189
3187
|
});
|
|
3190
|
-
}, st = (l, d) =>
|
|
3188
|
+
}, st = (l, d) => Re(de(l) ? l(i) : l, { ...r.resetOptions, ...d }), pt = (l, d = {}) => {
|
|
3191
3189
|
const h = S(n, l), w = h && h._f;
|
|
3192
3190
|
if (w) {
|
|
3193
|
-
const
|
|
3194
|
-
|
|
3195
|
-
|
|
3191
|
+
const m = w.refs ? w.refs[0] : w.ref;
|
|
3192
|
+
m.focus && setTimeout(() => {
|
|
3193
|
+
m.focus(), d.shouldSelect && de(m.select) && m.select();
|
|
3196
3194
|
});
|
|
3197
3195
|
}
|
|
3198
3196
|
}, mt = (l) => {
|
|
@@ -3202,32 +3200,32 @@ function Ka(e = {}) {
|
|
|
3202
3200
|
};
|
|
3203
3201
|
}, at = {
|
|
3204
3202
|
control: {
|
|
3205
|
-
register:
|
|
3206
|
-
unregister:
|
|
3207
|
-
getFieldState:
|
|
3208
|
-
handleSubmit:
|
|
3209
|
-
setError:
|
|
3210
|
-
_subscribe:
|
|
3211
|
-
_runSchema:
|
|
3212
|
-
_updateIsValidating:
|
|
3213
|
-
_focusError:
|
|
3214
|
-
_getWatch:
|
|
3203
|
+
register: ge,
|
|
3204
|
+
unregister: qe,
|
|
3205
|
+
getFieldState: $e,
|
|
3206
|
+
handleSubmit: We,
|
|
3207
|
+
setError: je,
|
|
3208
|
+
_subscribe: Se,
|
|
3209
|
+
_runSchema: ee,
|
|
3210
|
+
_updateIsValidating: E,
|
|
3211
|
+
_focusError: Ue,
|
|
3212
|
+
_getWatch: F,
|
|
3215
3213
|
_getDirty: I,
|
|
3216
3214
|
_setValid: k,
|
|
3217
|
-
_setFieldArray:
|
|
3218
|
-
_setDisabledField:
|
|
3219
|
-
_setErrors:
|
|
3220
|
-
_getFieldArray:
|
|
3221
|
-
_reset:
|
|
3215
|
+
_setFieldArray: g,
|
|
3216
|
+
_setDisabledField: nt,
|
|
3217
|
+
_setErrors: V,
|
|
3218
|
+
_getFieldArray: j,
|
|
3219
|
+
_reset: Re,
|
|
3222
3220
|
_resetDefaultValues: () => de(r.defaultValues) && r.defaultValues().then((l) => {
|
|
3223
|
-
st(l, r.resetOptions),
|
|
3221
|
+
st(l, r.resetOptions), y.state.next({
|
|
3224
3222
|
isLoading: !1
|
|
3225
3223
|
});
|
|
3226
3224
|
}),
|
|
3227
|
-
_removeUnmounted:
|
|
3228
|
-
_disableForm:
|
|
3229
|
-
_subjects:
|
|
3230
|
-
_proxyFormState:
|
|
3225
|
+
_removeUnmounted: B,
|
|
3226
|
+
_disableForm: ht,
|
|
3227
|
+
_subjects: y,
|
|
3228
|
+
_proxyFormState: b,
|
|
3231
3229
|
get _fields() {
|
|
3232
3230
|
return n;
|
|
3233
3231
|
},
|
|
@@ -3262,20 +3260,20 @@ function Ka(e = {}) {
|
|
|
3262
3260
|
};
|
|
3263
3261
|
}
|
|
3264
3262
|
},
|
|
3265
|
-
subscribe:
|
|
3266
|
-
trigger:
|
|
3267
|
-
register:
|
|
3268
|
-
handleSubmit:
|
|
3269
|
-
watch:
|
|
3270
|
-
setValue:
|
|
3271
|
-
getValues:
|
|
3263
|
+
subscribe: Ne,
|
|
3264
|
+
trigger: H,
|
|
3265
|
+
register: ge,
|
|
3266
|
+
handleSubmit: We,
|
|
3267
|
+
watch: Pe,
|
|
3268
|
+
setValue: U,
|
|
3269
|
+
getValues: rt,
|
|
3272
3270
|
reset: st,
|
|
3273
|
-
resetField:
|
|
3274
|
-
clearErrors:
|
|
3275
|
-
unregister:
|
|
3276
|
-
setError:
|
|
3271
|
+
resetField: ze,
|
|
3272
|
+
clearErrors: D,
|
|
3273
|
+
unregister: qe,
|
|
3274
|
+
setError: je,
|
|
3277
3275
|
setFocus: pt,
|
|
3278
|
-
getFieldState:
|
|
3276
|
+
getFieldState: $e
|
|
3279
3277
|
};
|
|
3280
3278
|
return {
|
|
3281
3279
|
...at,
|
|
@@ -3283,7 +3281,7 @@ function Ka(e = {}) {
|
|
|
3283
3281
|
};
|
|
3284
3282
|
}
|
|
3285
3283
|
function Ct(e = {}) {
|
|
3286
|
-
const r =
|
|
3284
|
+
const r = ae.useRef(void 0), t = ae.useRef(void 0), [n, s] = ae.useState({
|
|
3287
3285
|
isDirty: !1,
|
|
3288
3286
|
isValidating: !1,
|
|
3289
3287
|
isLoading: de(e.defaultValues),
|
|
@@ -3324,32 +3322,32 @@ function Ct(e = {}) {
|
|
|
3324
3322
|
...o,
|
|
3325
3323
|
isReady: !0
|
|
3326
3324
|
})), i._formState.isReady = !0, a;
|
|
3327
|
-
}, [i]),
|
|
3325
|
+
}, [i]), ae.useEffect(() => i._disableForm(e.disabled), [i, e.disabled]), ae.useEffect(() => {
|
|
3328
3326
|
e.mode && (i._options.mode = e.mode), e.reValidateMode && (i._options.reValidateMode = e.reValidateMode);
|
|
3329
|
-
}, [i, e.mode, e.reValidateMode]),
|
|
3327
|
+
}, [i, e.mode, e.reValidateMode]), ae.useEffect(() => {
|
|
3330
3328
|
e.errors && (i._setErrors(e.errors), i._focusError());
|
|
3331
|
-
}, [i, e.errors]),
|
|
3329
|
+
}, [i, e.errors]), ae.useEffect(() => {
|
|
3332
3330
|
e.shouldUnregister && i._subjects.state.next({
|
|
3333
3331
|
values: i._getWatch()
|
|
3334
3332
|
});
|
|
3335
|
-
}, [i, e.shouldUnregister]),
|
|
3333
|
+
}, [i, e.shouldUnregister]), ae.useEffect(() => {
|
|
3336
3334
|
if (i._proxyFormState.isDirty) {
|
|
3337
3335
|
const a = i._getDirty();
|
|
3338
3336
|
a !== n.isDirty && i._subjects.state.next({
|
|
3339
3337
|
isDirty: a
|
|
3340
3338
|
});
|
|
3341
3339
|
}
|
|
3342
|
-
}, [i, n.isDirty]),
|
|
3340
|
+
}, [i, n.isDirty]), ae.useEffect(() => {
|
|
3343
3341
|
var a;
|
|
3344
3342
|
e.values && !Fe(e.values, t.current) ? (i._reset(e.values, {
|
|
3345
3343
|
keepFieldsRef: !0,
|
|
3346
3344
|
...i._options.resetOptions
|
|
3347
3345
|
}), !((a = i._options.resetOptions) === null || a === void 0) && a.keepIsValid || i._setValid(), t.current = e.values, s((o) => ({ ...o }))) : i._resetDefaultValues();
|
|
3348
|
-
}, [i, e.values]),
|
|
3346
|
+
}, [i, e.values]), ae.useEffect(() => {
|
|
3349
3347
|
i._state.mount || (i._setValid(), i._state.mount = !0), i._state.watch && (i._state.watch = !1, i._subjects.state.next({ ...i._formState })), i._removeUnmounted();
|
|
3350
|
-
}), r.current.formState =
|
|
3348
|
+
}), r.current.formState = ae.useMemo(() => Va(n, i), [i, n]), r.current;
|
|
3351
3349
|
}
|
|
3352
|
-
const
|
|
3350
|
+
const Vr = (e, r, t) => {
|
|
3353
3351
|
if (e && "reportValidity" in e) {
|
|
3354
3352
|
const n = S(t, r);
|
|
3355
3353
|
e.setCustomValidity(n && n.message || ""), e.reportValidity();
|
|
@@ -3357,7 +3355,7 @@ const Fr = (e, r, t) => {
|
|
|
3357
3355
|
}, Ga = (e, r) => {
|
|
3358
3356
|
for (const t in r.fields) {
|
|
3359
3357
|
const n = r.fields[t];
|
|
3360
|
-
n && n.ref && "reportValidity" in n.ref ?
|
|
3358
|
+
n && n.ref && "reportValidity" in n.ref ? Vr(n.ref, t, e) : n.refs && n.refs.forEach((s) => Vr(s, t, e));
|
|
3361
3359
|
}
|
|
3362
3360
|
}, Ja = (e, r) => {
|
|
3363
3361
|
r.shouldUseNativeValidation && Ga(e, r);
|
|
@@ -3366,9 +3364,9 @@ const Fr = (e, r, t) => {
|
|
|
3366
3364
|
const s = S(r.fields, n), i = Object.assign(e[n] || {}, { ref: s && s.ref });
|
|
3367
3365
|
if (Za(r.names || Object.keys(e), n)) {
|
|
3368
3366
|
const a = Object.assign({}, S(t, n));
|
|
3369
|
-
|
|
3367
|
+
z(a, "root", i), z(t, n, a);
|
|
3370
3368
|
} else
|
|
3371
|
-
|
|
3369
|
+
z(t, n, i);
|
|
3372
3370
|
}
|
|
3373
3371
|
return t;
|
|
3374
3372
|
}, Za = (e, r) => e.some((t) => t.startsWith(r + "."));
|
|
@@ -3379,10 +3377,10 @@ var St = function(e, r, t) {
|
|
|
3379
3377
|
return Promise.resolve(/* @__PURE__ */ oa(e, n, Object.assign({}, r, { abortPipeEarly: !a }))).then(function(o) {
|
|
3380
3378
|
if (o.issues) {
|
|
3381
3379
|
for (var u = {}; o.issues.length; ) {
|
|
3382
|
-
var f = o.issues[0],
|
|
3383
|
-
if (
|
|
3384
|
-
var
|
|
3385
|
-
u[
|
|
3380
|
+
var f = o.issues[0], v = /* @__PURE__ */ ea(f);
|
|
3381
|
+
if (v && (u[v] || (u[v] = { message: f.message, type: f.type }), a)) {
|
|
3382
|
+
var b = u[v].types, p = b && b[f.type];
|
|
3383
|
+
u[v] = pn(v, a, u, f.type, p ? [].concat(p, f.message) : f.message);
|
|
3386
3384
|
}
|
|
3387
3385
|
o.issues.shift();
|
|
3388
3386
|
}
|
|
@@ -3395,22 +3393,22 @@ var St = function(e, r, t) {
|
|
|
3395
3393
|
}
|
|
3396
3394
|
};
|
|
3397
3395
|
};
|
|
3398
|
-
const
|
|
3396
|
+
const Mr = 27, Lr = 12, Nr = 10, Xa = et("enum"), Ya = (e, r) => {
|
|
3399
3397
|
const t = {
|
|
3400
3398
|
min: e.minSelected ?? 0,
|
|
3401
3399
|
max: e.maxSelected ?? e.options.length
|
|
3402
3400
|
};
|
|
3403
|
-
return St(/* @__PURE__ */
|
|
3404
|
-
checked: /* @__PURE__ */ Ve(/* @__PURE__ */ ln(/* @__PURE__ */
|
|
3401
|
+
return St(/* @__PURE__ */ ke({
|
|
3402
|
+
checked: /* @__PURE__ */ Ve(/* @__PURE__ */ ln(/* @__PURE__ */ le(), /* @__PURE__ */ sn()), /* @__PURE__ */ Kt((n) => Object.entries(n).filter(([s, i]) => i).map(([s, i]) => s)), /* @__PURE__ */ ct(t.max, r("validation_multiple_choice_max", {
|
|
3405
3403
|
count: t.max
|
|
3406
|
-
})), /* @__PURE__ */
|
|
3404
|
+
})), /* @__PURE__ */ Ze(t.min, r("validation_multiple_choice_min", {
|
|
3407
3405
|
count: t.min
|
|
3408
3406
|
})))
|
|
3409
3407
|
}));
|
|
3410
|
-
}, Qa =
|
|
3408
|
+
}, Qa = zr(({
|
|
3411
3409
|
option: e,
|
|
3412
3410
|
...r
|
|
3413
|
-
}, t) => c(
|
|
3411
|
+
}, t) => c(Ce, {
|
|
3414
3412
|
children: [c("input", {
|
|
3415
3413
|
class: "peer sr-only h-full",
|
|
3416
3414
|
type: "checkbox",
|
|
@@ -3434,10 +3432,10 @@ const Vr = 27, Mr = 12, Lr = 10, Xa = Ze("enum"), Ya = (e, r) => {
|
|
|
3434
3432
|
input: e,
|
|
3435
3433
|
onSubmitSuccess: r
|
|
3436
3434
|
}) => {
|
|
3437
|
-
var
|
|
3438
|
-
const t = e.key ? (
|
|
3435
|
+
var v, b;
|
|
3436
|
+
const t = e.key ? (v = q.current$.value.flow) == null ? void 0 : v.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, {
|
|
3439
3437
|
t: i
|
|
3440
|
-
} =
|
|
3438
|
+
} = ne(), {
|
|
3441
3439
|
register: a,
|
|
3442
3440
|
handleSubmit: o,
|
|
3443
3441
|
formState: {
|
|
@@ -3448,20 +3446,20 @@ const Vr = 27, Mr = 12, Lr = 10, Xa = Ze("enum"), Ya = (e, r) => {
|
|
|
3448
3446
|
checked: n ? {} : Xa(t) ? Object.fromEntries(t.value.map((p) => [p, !0])) : {}
|
|
3449
3447
|
},
|
|
3450
3448
|
resolver: Ya(e.config, i)
|
|
3451
|
-
}), f =
|
|
3449
|
+
}), f = Jt();
|
|
3452
3450
|
return s ? c("ul", {
|
|
3453
3451
|
style: {
|
|
3454
|
-
maxHeight: 6.5 *
|
|
3452
|
+
maxHeight: 6.5 * Mr + 5 * Lr + 2 * Nr
|
|
3455
3453
|
},
|
|
3456
3454
|
class: Rr({
|
|
3457
3455
|
variant: "booleanLike"
|
|
3458
3456
|
}),
|
|
3459
|
-
children: e.config.options.map((p,
|
|
3457
|
+
children: e.config.options.map((p, y) => c("li", {
|
|
3460
3458
|
class: dn,
|
|
3461
3459
|
children: c(fn, {
|
|
3462
3460
|
type: "submit",
|
|
3463
|
-
ref: (
|
|
3464
|
-
|
|
3461
|
+
ref: (C) => {
|
|
3462
|
+
C && y === 0 && (f.current = C);
|
|
3465
3463
|
},
|
|
3466
3464
|
label: p.label,
|
|
3467
3465
|
value: "true",
|
|
@@ -3473,36 +3471,36 @@ const Vr = 27, Mr = 12, Lr = 10, Xa = Ze("enum"), Ya = (e, r) => {
|
|
|
3473
3471
|
}, p.value))
|
|
3474
3472
|
}) : c("form", {
|
|
3475
3473
|
noValidate: !0,
|
|
3476
|
-
onSubmit: (p) => o((
|
|
3477
|
-
const
|
|
3474
|
+
onSubmit: (p) => o((y) => {
|
|
3475
|
+
const C = y.checked;
|
|
3478
3476
|
r({
|
|
3479
3477
|
type: "enum",
|
|
3480
|
-
value:
|
|
3478
|
+
value: C
|
|
3481
3479
|
});
|
|
3482
3480
|
})(p),
|
|
3483
3481
|
children: [c("div", {
|
|
3484
3482
|
class: "flex items-center gap-1",
|
|
3485
3483
|
children: [c("ul", {
|
|
3486
3484
|
style: {
|
|
3487
|
-
maxHeight: 6.5 *
|
|
3485
|
+
maxHeight: 6.5 * Mr + 5 * Lr + 2 * Nr
|
|
3488
3486
|
},
|
|
3489
3487
|
class: Rr({
|
|
3490
3488
|
variant: e.config.options.length === 1 ? "singleOption" : void 0
|
|
3491
3489
|
}),
|
|
3492
|
-
children: e.config.options.map((p,
|
|
3493
|
-
const
|
|
3494
|
-
ref:
|
|
3490
|
+
children: e.config.options.map((p, y) => {
|
|
3491
|
+
const C = `checked.${p.value}`, {
|
|
3492
|
+
ref: _,
|
|
3495
3493
|
...k
|
|
3496
|
-
} = a(
|
|
3494
|
+
} = a(C);
|
|
3497
3495
|
return c("li", {
|
|
3498
3496
|
class: "relative",
|
|
3499
3497
|
children: c(Qa, {
|
|
3500
3498
|
option: p,
|
|
3501
|
-
autoFocus:
|
|
3502
|
-
ref: (
|
|
3503
|
-
|
|
3499
|
+
autoFocus: y === 0,
|
|
3500
|
+
ref: (E) => {
|
|
3501
|
+
E && y === 0 && (f.current = E), _(E);
|
|
3504
3502
|
},
|
|
3505
|
-
id:
|
|
3503
|
+
id: C,
|
|
3506
3504
|
...k,
|
|
3507
3505
|
onClick: n ? () => r({
|
|
3508
3506
|
type: "enum",
|
|
@@ -3513,7 +3511,7 @@ const Vr = 27, Mr = 12, Lr = 10, Xa = Ze("enum"), Ya = (e, r) => {
|
|
|
3513
3511
|
})
|
|
3514
3512
|
}), c("div", {
|
|
3515
3513
|
class: "flex flex-col items-center gap-2 pr-2.5 pt-2.5",
|
|
3516
|
-
children: [n ? null : c(
|
|
3514
|
+
children: [n ? null : c(Be, {}), e.config.minSelected === 0 && c(Le, {
|
|
3517
3515
|
class: "relative",
|
|
3518
3516
|
type: "button",
|
|
3519
3517
|
onClick: () => r({
|
|
@@ -3524,14 +3522,14 @@ const Vr = 27, Mr = 12, Lr = 10, Xa = Ze("enum"), Ya = (e, r) => {
|
|
|
3524
3522
|
})]
|
|
3525
3523
|
}), c("div", {
|
|
3526
3524
|
class: "px-1",
|
|
3527
|
-
children: c(
|
|
3528
|
-
error: (
|
|
3525
|
+
children: c(tt, {
|
|
3526
|
+
error: (b = u.checked) == null ? void 0 : b.root
|
|
3529
3527
|
})
|
|
3530
3528
|
})]
|
|
3531
3529
|
});
|
|
3532
|
-
}, ti =
|
|
3530
|
+
}, ti = et("number"), ri = (e, r) => {
|
|
3533
3531
|
const t = e.min ?? Number.MIN_SAFE_INTEGER, n = e.max ?? Number.MAX_SAFE_INTEGER, s = e.decimalCases ?? 0;
|
|
3534
|
-
return St(/* @__PURE__ */
|
|
3532
|
+
return St(/* @__PURE__ */ ke({
|
|
3535
3533
|
number: /* @__PURE__ */ Ve(/* @__PURE__ */ an(r("validation_number")), /* @__PURE__ */ en(t, r("validation_number_min", {
|
|
3536
3534
|
min: t
|
|
3537
3535
|
})), /* @__PURE__ */ Qr(n, r("validation_number_max", {
|
|
@@ -3544,10 +3542,10 @@ const Vr = 27, Mr = 12, Lr = 10, Xa = Ze("enum"), Ya = (e, r) => {
|
|
|
3544
3542
|
input: e,
|
|
3545
3543
|
onSubmitSuccess: r
|
|
3546
3544
|
}) => {
|
|
3547
|
-
var
|
|
3548
|
-
const t = e.config.defaultValue, n = e.key ? (
|
|
3545
|
+
var b;
|
|
3546
|
+
const t = e.config.defaultValue, n = e.key ? (b = q.current$.value.flow) == null ? void 0 : b.data.submissions[e.key] : void 0, {
|
|
3549
3547
|
t: s
|
|
3550
|
-
} =
|
|
3548
|
+
} = ne(), {
|
|
3551
3549
|
register: i,
|
|
3552
3550
|
handleSubmit: a,
|
|
3553
3551
|
formState: {
|
|
@@ -3564,9 +3562,9 @@ const Vr = 27, Mr = 12, Lr = 10, Xa = Ze("enum"), Ya = (e, r) => {
|
|
|
3564
3562
|
} = i("number", {
|
|
3565
3563
|
required: !e.config.optional,
|
|
3566
3564
|
valueAsNumber: !0
|
|
3567
|
-
}),
|
|
3565
|
+
}), v = ye();
|
|
3568
3566
|
return Me(() => {
|
|
3569
|
-
|
|
3567
|
+
v.current && (v.current.focus(), v.current.select());
|
|
3570
3568
|
}, []), c("form", {
|
|
3571
3569
|
class: "flex flex-col gap-1 p-2.5",
|
|
3572
3570
|
onSubmit: a((p) => {
|
|
@@ -3587,12 +3585,12 @@ const Vr = 27, Mr = 12, Lr = 10, Xa = Ze("enum"), Ya = (e, r) => {
|
|
|
3587
3585
|
autoCorrect: "off",
|
|
3588
3586
|
autoFocus: !0,
|
|
3589
3587
|
ref: (p) => {
|
|
3590
|
-
p && (
|
|
3588
|
+
p && (v.current = p), u(p);
|
|
3591
3589
|
},
|
|
3592
3590
|
type: "text",
|
|
3593
3591
|
min: e.config.min,
|
|
3594
3592
|
max: e.config.max,
|
|
3595
|
-
class:
|
|
3593
|
+
class: Ye({
|
|
3596
3594
|
optional: e.config.optional,
|
|
3597
3595
|
className: "[type=number:-webkit-inner-spin-button] w-full rounded-full [-webkit-outer-spin-button:none]"
|
|
3598
3596
|
}),
|
|
@@ -3601,8 +3599,8 @@ const Vr = 27, Mr = 12, Lr = 10, Xa = Ze("enum"), Ya = (e, r) => {
|
|
|
3601
3599
|
class: "absolute bottom-0 right-0.5 top-0",
|
|
3602
3600
|
onClick: () => r(null)
|
|
3603
3601
|
})]
|
|
3604
|
-
}), c(
|
|
3605
|
-
}), c(
|
|
3602
|
+
}), c(Be, {})]
|
|
3603
|
+
}), c(tt, {
|
|
3606
3604
|
error: o.number
|
|
3607
3605
|
})]
|
|
3608
3606
|
});
|
|
@@ -3612,7 +3610,7 @@ const Vr = 27, Mr = 12, Lr = 10, Xa = Ze("enum"), Ya = (e, r) => {
|
|
|
3612
3610
|
countryCode: "",
|
|
3613
3611
|
phoneNumber: ""
|
|
3614
3612
|
};
|
|
3615
|
-
const r = Object.entries(
|
|
3613
|
+
const r = Object.entries(Gt).find((s) => e.startsWith(s[1])), t = r ? r[1] : "", n = e.replace(t, "");
|
|
3616
3614
|
return /^\d+$/.test(n) ? {
|
|
3617
3615
|
countryCode: t,
|
|
3618
3616
|
phoneNumber: n
|
|
@@ -3620,9 +3618,9 @@ const Vr = 27, Mr = 12, Lr = 10, Xa = Ze("enum"), Ya = (e, r) => {
|
|
|
3620
3618
|
countryCode: "",
|
|
3621
3619
|
phoneNumber: ""
|
|
3622
3620
|
};
|
|
3623
|
-
}, ai = "44", ii = /^[0-9 ]+$/, oi =
|
|
3624
|
-
const r = /* @__PURE__ */ Ve(/* @__PURE__ */
|
|
3625
|
-
return St(/* @__PURE__ */
|
|
3621
|
+
}, ai = "44", ii = /^[0-9 ]+$/, oi = et("string"), li = et("phone"), ci = (e) => {
|
|
3622
|
+
const r = /* @__PURE__ */ Ve(/* @__PURE__ */ le(e("validation_country_code")), /* @__PURE__ */ Ht(ii, e("validation_country_code"))), t = /* @__PURE__ */ Ve(/* @__PURE__ */ le(e("validation_phone")), /* @__PURE__ */ Ze(1, e("validation_phone")), /* @__PURE__ */ Kt((n) => n.replace(/[^0-9]/g, "")));
|
|
3623
|
+
return St(/* @__PURE__ */ ke({
|
|
3626
3624
|
countryCode: r,
|
|
3627
3625
|
phoneNumber: t
|
|
3628
3626
|
}));
|
|
@@ -3630,16 +3628,16 @@ const Vr = 27, Mr = 12, Lr = 10, Xa = Ze("enum"), Ya = (e, r) => {
|
|
|
3630
3628
|
input: e,
|
|
3631
3629
|
onSubmitSuccess: r
|
|
3632
3630
|
}) => {
|
|
3633
|
-
var
|
|
3634
|
-
const t = e.key ? (
|
|
3631
|
+
var _;
|
|
3632
|
+
const t = e.key ? (_ = q.current$.value.flow) == null ? void 0 : _.data.submissions[e.key] : void 0, {
|
|
3635
3633
|
t: n
|
|
3636
|
-
} =
|
|
3634
|
+
} = ne(), [s, i] = _e(), a = oi(t) ? si(t.value) : li(t) ? t.value : void 0, {
|
|
3637
3635
|
register: o,
|
|
3638
3636
|
handleSubmit: u,
|
|
3639
3637
|
formState: {
|
|
3640
3638
|
errors: f
|
|
3641
3639
|
},
|
|
3642
|
-
watch:
|
|
3640
|
+
watch: v
|
|
3643
3641
|
} = Ct({
|
|
3644
3642
|
defaultValues: {
|
|
3645
3643
|
countryCode: (a == null ? void 0 : a.countryCode) ?? e.config.defaultValue.countryCode ?? ai,
|
|
@@ -3647,38 +3645,38 @@ const Vr = 27, Mr = 12, Lr = 10, Xa = Ze("enum"), Ya = (e, r) => {
|
|
|
3647
3645
|
},
|
|
3648
3646
|
resolver: ci(n)
|
|
3649
3647
|
}), {
|
|
3650
|
-
ref:
|
|
3648
|
+
ref: b,
|
|
3651
3649
|
...p
|
|
3652
3650
|
} = o("phoneNumber", {
|
|
3653
3651
|
required: !e.config.optional
|
|
3654
|
-
}),
|
|
3652
|
+
}), y = ye(), C = v("countryCode");
|
|
3655
3653
|
return Me(() => {
|
|
3656
|
-
|
|
3654
|
+
y.current && (y.current.focus(), y.current.select());
|
|
3657
3655
|
}, []), c("form", {
|
|
3658
3656
|
noValidate: !0,
|
|
3659
3657
|
class: "flex flex-col gap-1 p-2.5",
|
|
3660
3658
|
onSubmit: u((k) => {
|
|
3661
|
-
const
|
|
3659
|
+
const E = k.phoneNumber.replace(/[^0-9]/g, ""), g = k.countryCode.replace(/[^0-9]/g, "");
|
|
3662
3660
|
i(void 0);
|
|
3663
|
-
const
|
|
3664
|
-
if (
|
|
3661
|
+
const N = e.config.minChars ?? 7, V = E.length + g.length;
|
|
3662
|
+
if (V < N)
|
|
3665
3663
|
return i(n("validation_phone_min_chars", {
|
|
3666
|
-
count:
|
|
3664
|
+
count: N
|
|
3667
3665
|
}));
|
|
3668
|
-
const
|
|
3669
|
-
if (
|
|
3666
|
+
const M = e.config.maxChars;
|
|
3667
|
+
if (M != null && V > M)
|
|
3670
3668
|
return i(n("validation_max_chars", {
|
|
3671
|
-
count:
|
|
3669
|
+
count: M
|
|
3672
3670
|
}));
|
|
3673
3671
|
e.config.submissionFormat === "phone" ? r({
|
|
3674
3672
|
type: "phone",
|
|
3675
3673
|
value: {
|
|
3676
|
-
countryCode:
|
|
3677
|
-
phoneNumber:
|
|
3674
|
+
countryCode: g,
|
|
3675
|
+
phoneNumber: E
|
|
3678
3676
|
}
|
|
3679
3677
|
}) : r({
|
|
3680
3678
|
type: "string",
|
|
3681
|
-
value:
|
|
3679
|
+
value: C + k.phoneNumber
|
|
3682
3680
|
});
|
|
3683
3681
|
}),
|
|
3684
3682
|
children: [c("div", {
|
|
@@ -3689,14 +3687,14 @@ const Vr = 27, Mr = 12, Lr = 10, Xa = Ze("enum"), Ya = (e, r) => {
|
|
|
3689
3687
|
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",
|
|
3690
3688
|
htmlFor: `isdk_phone_${e.key}`,
|
|
3691
3689
|
children: [c("span", {
|
|
3692
|
-
children: ["+",
|
|
3690
|
+
children: ["+", C]
|
|
3693
3691
|
}), c("select", {
|
|
3694
3692
|
...o("countryCode", {}),
|
|
3695
3693
|
id: `isdk_phone_${e.key}`,
|
|
3696
3694
|
class: "absolute inset-0 opacity-0",
|
|
3697
|
-
children: Object.entries(
|
|
3698
|
-
value:
|
|
3699
|
-
children: [k, " (+",
|
|
3695
|
+
children: Object.entries(Gt).map(([k, E]) => c("option", {
|
|
3696
|
+
value: E,
|
|
3697
|
+
children: [k, " (+", E, ")"]
|
|
3700
3698
|
}, k))
|
|
3701
3699
|
})]
|
|
3702
3700
|
}), c("input", {
|
|
@@ -3709,9 +3707,9 @@ const Vr = 27, Mr = 12, Lr = 10, Xa = Ze("enum"), Ya = (e, r) => {
|
|
|
3709
3707
|
autoCorrect: "off",
|
|
3710
3708
|
autoFocus: !0,
|
|
3711
3709
|
ref: (k) => {
|
|
3712
|
-
k && (
|
|
3710
|
+
k && (y.current = k), b(k);
|
|
3713
3711
|
},
|
|
3714
|
-
class:
|
|
3712
|
+
class: Ye({
|
|
3715
3713
|
optional: e.config.optional,
|
|
3716
3714
|
className: "min-w-0 flex-1 rounded-r-full"
|
|
3717
3715
|
}),
|
|
@@ -3720,15 +3718,15 @@ const Vr = 27, Mr = 12, Lr = 10, Xa = Ze("enum"), Ya = (e, r) => {
|
|
|
3720
3718
|
class: "absolute bottom-0 right-1 top-0",
|
|
3721
3719
|
onClick: () => r(null)
|
|
3722
3720
|
})]
|
|
3723
|
-
}), c(
|
|
3724
|
-
}), c(
|
|
3721
|
+
}), c(Be, {})]
|
|
3722
|
+
}), c(tt, {
|
|
3725
3723
|
error: f.countryCode || f.phoneNumber || {
|
|
3726
3724
|
message: s
|
|
3727
3725
|
}
|
|
3728
3726
|
})]
|
|
3729
3727
|
});
|
|
3730
|
-
}, yt = (e) => e === void 0 ? 0 : Math.max(0, Math.ceil((e - Date.now()) / 1e3)),
|
|
3731
|
-
time:
|
|
3728
|
+
}, yt = (e) => e === void 0 ? 0 : Math.max(0, Math.ceil((e - Date.now()) / 1e3)), Tr = (e, r, t, n) => t !== void 0 && n * 1e3 > Ur ? e("submission_available_at", {
|
|
3729
|
+
time: qr(t, r)
|
|
3732
3730
|
}) : e("submission_cooldown", {
|
|
3733
3731
|
count: n
|
|
3734
3732
|
}), di = ({
|
|
@@ -3738,19 +3736,19 @@ const Vr = 27, Mr = 12, Lr = 10, Xa = Ze("enum"), Ya = (e, r) => {
|
|
|
3738
3736
|
const {
|
|
3739
3737
|
t,
|
|
3740
3738
|
locale: n
|
|
3741
|
-
} =
|
|
3739
|
+
} = ne(), {
|
|
3742
3740
|
availableAt: s
|
|
3743
|
-
} = e.config, [i, a] =
|
|
3744
|
-
|
|
3745
|
-
const
|
|
3746
|
-
if (a(
|
|
3741
|
+
} = e.config, [i, a] = _e(() => yt(s)), [o, u] = _e("");
|
|
3742
|
+
Wr(() => {
|
|
3743
|
+
const v = yt(s);
|
|
3744
|
+
if (a(v), v === 0)
|
|
3747
3745
|
return;
|
|
3748
|
-
u(
|
|
3749
|
-
const
|
|
3746
|
+
u(Tr(t, n, s, v));
|
|
3747
|
+
const b = setInterval(() => {
|
|
3750
3748
|
const p = yt(s);
|
|
3751
|
-
a(p), !(p > 0) && (clearInterval(
|
|
3749
|
+
a(p), !(p > 0) && (clearInterval(b), u(t("submission_cooldown_ready")));
|
|
3752
3750
|
}, 250);
|
|
3753
|
-
return () => clearInterval(
|
|
3751
|
+
return () => clearInterval(b);
|
|
3754
3752
|
}, [s, n, t]);
|
|
3755
3753
|
const f = i > 0;
|
|
3756
3754
|
return c("div", {
|
|
@@ -3787,14 +3785,14 @@ const Vr = 27, Mr = 12, Lr = 10, Xa = Ze("enum"), Ya = (e, r) => {
|
|
|
3787
3785
|
id: "submit-cooldown",
|
|
3788
3786
|
"aria-hidden": "true",
|
|
3789
3787
|
class: "text-neutral-11 text-xs",
|
|
3790
|
-
children:
|
|
3788
|
+
children: Tr(t, n, s, i)
|
|
3791
3789
|
}), c("p", {
|
|
3792
3790
|
role: "status",
|
|
3793
3791
|
class: "sr-only",
|
|
3794
3792
|
children: o
|
|
3795
3793
|
})]
|
|
3796
3794
|
});
|
|
3797
|
-
}, fi = 160,
|
|
3795
|
+
}, fi = 160, Dr = (e) => {
|
|
3798
3796
|
e.style.height = "auto", e.style.height = `${Math.min(e.scrollHeight, fi)}px`;
|
|
3799
3797
|
}, hi = {
|
|
3800
3798
|
date: {
|
|
@@ -3815,7 +3813,7 @@ const Vr = 27, Mr = 12, Lr = 10, Xa = Ze("enum"), Ya = (e, r) => {
|
|
|
3815
3813
|
inputMode: "url",
|
|
3816
3814
|
formNoValidate: !0
|
|
3817
3815
|
}
|
|
3818
|
-
}, pi =
|
|
3816
|
+
}, pi = et("string"), mi = (e, r) => {
|
|
3819
3817
|
const t = {
|
|
3820
3818
|
maxLength: r("validation_max_chars", {
|
|
3821
3819
|
count: e.maxChars ?? 999
|
|
@@ -3824,22 +3822,22 @@ const Vr = 27, Mr = 12, Lr = 10, Xa = Ze("enum"), Ya = (e, r) => {
|
|
|
3824
3822
|
count: e.minChars ?? 1
|
|
3825
3823
|
})
|
|
3826
3824
|
};
|
|
3827
|
-
return St(/* @__PURE__ */
|
|
3825
|
+
return St(/* @__PURE__ */ ke({
|
|
3828
3826
|
text: {
|
|
3829
|
-
date: /* @__PURE__ */ Ve(/* @__PURE__ */
|
|
3830
|
-
email: /* @__PURE__ */ Ve(/* @__PURE__ */
|
|
3831
|
-
text: /* @__PURE__ */ Ve(/* @__PURE__ */
|
|
3832
|
-
url: /* @__PURE__ */ Ve(/* @__PURE__ */
|
|
3827
|
+
date: /* @__PURE__ */ Ve(/* @__PURE__ */ le(r("validation_date")), /* @__PURE__ */ Ht(/^\d{4}-\d{2}-\d{2}$/, r("validation_date"))),
|
|
3828
|
+
email: /* @__PURE__ */ Ve(/* @__PURE__ */ le(r("validation_email")), /* @__PURE__ */ Yr(r("validation_email")), /* @__PURE__ */ Ze(e.minChars ?? 1, t.minLength), /* @__PURE__ */ ct(e.maxChars ?? 1 / 0, t.maxLength)),
|
|
3829
|
+
text: /* @__PURE__ */ Ve(/* @__PURE__ */ le(), /* @__PURE__ */ Ze(e.minChars ?? 1, t.minLength), /* @__PURE__ */ ct(e.maxChars ?? 1 / 0, t.maxLength)),
|
|
3830
|
+
url: /* @__PURE__ */ Ve(/* @__PURE__ */ le(r("validation_url")), /* @__PURE__ */ tn(r("validation_url")), /* @__PURE__ */ Ze(e.minChars ?? 1, t.minLength), /* @__PURE__ */ ct(e.maxChars ?? 1 / 0, t.maxLength))
|
|
3833
3831
|
}[e.format]
|
|
3834
3832
|
}));
|
|
3835
3833
|
}, yi = ({
|
|
3836
3834
|
input: e,
|
|
3837
3835
|
onSubmitSuccess: r
|
|
3838
3836
|
}) => {
|
|
3839
|
-
var
|
|
3837
|
+
var _;
|
|
3840
3838
|
const {
|
|
3841
3839
|
t
|
|
3842
|
-
} =
|
|
3840
|
+
} = ne(), n = e.key ? (_ = q.current$.value.flow) == null ? void 0 : _.data.submissions[e.key] : void 0, s = e.config.defaultValue, i = e.config.multiline === !0 && e.config.format === "text", {
|
|
3843
3841
|
register: a,
|
|
3844
3842
|
handleSubmit: o,
|
|
3845
3843
|
watch: u,
|
|
@@ -3852,15 +3850,15 @@ const Vr = 27, Mr = 12, Lr = 10, Xa = Ze("enum"), Ya = (e, r) => {
|
|
|
3852
3850
|
},
|
|
3853
3851
|
resolver: mi(e.config, t)
|
|
3854
3852
|
}), {
|
|
3855
|
-
ref:
|
|
3856
|
-
...
|
|
3853
|
+
ref: v,
|
|
3854
|
+
...b
|
|
3857
3855
|
} = a("text", {
|
|
3858
3856
|
required: !e.config.optional
|
|
3859
3857
|
}), p = ye();
|
|
3860
3858
|
Me(() => {
|
|
3861
|
-
p.current && (p.current instanceof HTMLTextAreaElement &&
|
|
3859
|
+
p.current && (p.current instanceof HTMLTextAreaElement && Dr(p.current), p.current.focus(), p.current.select());
|
|
3862
3860
|
}, []);
|
|
3863
|
-
const
|
|
3861
|
+
const y = e.config.maxChars, C = i && y !== void 0 ? u("text").length : void 0;
|
|
3864
3862
|
return c("form", {
|
|
3865
3863
|
noValidate: !0,
|
|
3866
3864
|
class: "flex flex-col gap-1 p-2.5",
|
|
@@ -3876,37 +3874,37 @@ const Vr = 27, Mr = 12, Lr = 10, Xa = Ze("enum"), Ya = (e, r) => {
|
|
|
3876
3874
|
class: "relative min-w-0 flex-1",
|
|
3877
3875
|
children: [i ? c("textarea", {
|
|
3878
3876
|
id: "chat-input",
|
|
3879
|
-
...
|
|
3877
|
+
...b,
|
|
3880
3878
|
rows: 2,
|
|
3881
|
-
maxLength:
|
|
3879
|
+
maxLength: y,
|
|
3882
3880
|
autoFocus: !0,
|
|
3883
|
-
"aria-describedby":
|
|
3884
|
-
onInput: (k) =>
|
|
3881
|
+
"aria-describedby": C !== void 0 ? "chat-input-count" : void 0,
|
|
3882
|
+
onInput: (k) => Dr(k.currentTarget),
|
|
3885
3883
|
onKeyDown: (k) => {
|
|
3886
|
-
var
|
|
3887
|
-
k.key === "Enter" && (k.ctrlKey || k.metaKey) && (k.preventDefault(), (
|
|
3884
|
+
var E;
|
|
3885
|
+
k.key === "Enter" && (k.ctrlKey || k.metaKey) && (k.preventDefault(), (E = k.currentTarget.form) == null || E.requestSubmit());
|
|
3888
3886
|
},
|
|
3889
3887
|
ref: (k) => {
|
|
3890
|
-
k && (p.current = k),
|
|
3888
|
+
k && (p.current = k), v(k);
|
|
3891
3889
|
},
|
|
3892
3890
|
placeholder: e.config.placeholder,
|
|
3893
|
-
class:
|
|
3891
|
+
class: Ye({
|
|
3894
3892
|
optional: !!e.config.optional,
|
|
3895
3893
|
className: "block w-full resize-none overflow-y-auto rounded-2xl"
|
|
3896
3894
|
})
|
|
3897
3895
|
}) : c("input", {
|
|
3898
3896
|
id: "chat-input",
|
|
3899
|
-
...
|
|
3897
|
+
...b,
|
|
3900
3898
|
...hi[e.config.format],
|
|
3901
3899
|
autocomplete: "off",
|
|
3902
3900
|
autoCapitalize: "off",
|
|
3903
3901
|
autoCorrect: "off",
|
|
3904
3902
|
autoFocus: !0,
|
|
3905
3903
|
ref: (k) => {
|
|
3906
|
-
k && (p.current = k),
|
|
3904
|
+
k && (p.current = k), v(k);
|
|
3907
3905
|
},
|
|
3908
3906
|
placeholder: e.config.placeholder,
|
|
3909
|
-
class:
|
|
3907
|
+
class: Ye({
|
|
3910
3908
|
optional: !!e.config.optional,
|
|
3911
3909
|
className: "w-full rounded-full"
|
|
3912
3910
|
})
|
|
@@ -3917,12 +3915,12 @@ const Vr = 27, Mr = 12, Lr = 10, Xa = Ze("enum"), Ya = (e, r) => {
|
|
|
3917
3915
|
onClick: () => r(null)
|
|
3918
3916
|
}
|
|
3919
3917
|
)]
|
|
3920
|
-
}), c(
|
|
3921
|
-
}),
|
|
3918
|
+
}), c(Be, {})]
|
|
3919
|
+
}), C !== void 0 && y !== void 0 && c("p", {
|
|
3922
3920
|
id: "chat-input-count",
|
|
3923
3921
|
class: "text-neutral-10 px-3 text-right text-xs",
|
|
3924
|
-
children: [
|
|
3925
|
-
}), c(
|
|
3922
|
+
children: [C, "/", y]
|
|
3923
|
+
}), c(tt, {
|
|
3926
3924
|
error: f.text
|
|
3927
3925
|
})]
|
|
3928
3926
|
});
|
|
@@ -3940,7 +3938,7 @@ const Vr = 27, Mr = 12, Lr = 10, Xa = Ze("enum"), Ya = (e, r) => {
|
|
|
3940
3938
|
analytics: r
|
|
3941
3939
|
}) => {
|
|
3942
3940
|
var i;
|
|
3943
|
-
const t = (i =
|
|
3941
|
+
const t = (i = q.current$.value.flow) == null ? void 0 : i.data.currentInput, n = ye(null), s = () => ce.onInteractionFn$.value();
|
|
3944
3942
|
return Me(() => {
|
|
3945
3943
|
var a;
|
|
3946
3944
|
(a = n.current) == null || a.scrollTo({
|
|
@@ -3958,7 +3956,7 @@ const Vr = 27, Mr = 12, Lr = 10, Xa = Ze("enum"), Ya = (e, r) => {
|
|
|
3958
3956
|
return c(a, {
|
|
3959
3957
|
logger: e,
|
|
3960
3958
|
analytics: r,
|
|
3961
|
-
onSubmitSuccess:
|
|
3959
|
+
onSubmitSuccess: ce.onSubmitSuccessFn$.value,
|
|
3962
3960
|
input: t
|
|
3963
3961
|
});
|
|
3964
3962
|
})() : c("div", {
|
|
@@ -3966,12 +3964,12 @@ const Vr = 27, Mr = 12, Lr = 10, Xa = Ze("enum"), Ya = (e, r) => {
|
|
|
3966
3964
|
children: [c("input", {
|
|
3967
3965
|
"aria-hidden": "true",
|
|
3968
3966
|
id: "chat-input",
|
|
3969
|
-
class:
|
|
3967
|
+
class: Ye({
|
|
3970
3968
|
optional: !1,
|
|
3971
3969
|
className: "flex-grow rounded-full"
|
|
3972
3970
|
}),
|
|
3973
3971
|
disabled: !0
|
|
3974
|
-
}), c(
|
|
3972
|
+
}), c(Be, {
|
|
3975
3973
|
disabled: !0,
|
|
3976
3974
|
"aria-hidden": "true",
|
|
3977
3975
|
tabIndex: -1
|
|
@@ -4018,21 +4016,21 @@ var Ci = function(r, t, n) {
|
|
|
4018
4016
|
return wn(s) ? ki(s, t, n) : s;
|
|
4019
4017
|
}));
|
|
4020
4018
|
};
|
|
4021
|
-
const ot = /* @__PURE__ */ vi(Ci), Si = /(\[[^\]]+\]\([^)]+\))/g,
|
|
4019
|
+
const ot = /* @__PURE__ */ vi(Ci), Si = /(\[[^\]]+\]\([^)]+\))/g, Ei = /\[([^\]]+)\]\(([^)]+)\)/, Ai = /(https?:\/\/[^\s]+)/g, Ii = /_(.*?)_/g, Fi = /\*\*(.*?)\*\*/g, Vi = /(\\n|\n)/g, Or = "text-accent-10 hover:text-accent-11 no-underline underline-offset-2 hover:underline", Mi = (e) => {
|
|
4022
4020
|
const r = ot(e, Si, (o, u) => {
|
|
4023
|
-
const [, f,
|
|
4024
|
-
return
|
|
4025
|
-
class:
|
|
4026
|
-
href:
|
|
4027
|
-
children: f ??
|
|
4028
|
-
},
|
|
4021
|
+
const [, f, v] = o.match(Ei) ?? [];
|
|
4022
|
+
return v ? c("a", {
|
|
4023
|
+
class: Or,
|
|
4024
|
+
href: v,
|
|
4025
|
+
children: f ?? v
|
|
4026
|
+
}, v + u) : c("span", {
|
|
4029
4027
|
children: "INVALID LINK"
|
|
4030
4028
|
});
|
|
4031
|
-
}), t = ot(r,
|
|
4032
|
-
class:
|
|
4029
|
+
}), t = ot(r, Ai, (o, u) => c("a", {
|
|
4030
|
+
class: Or,
|
|
4033
4031
|
href: o,
|
|
4034
4032
|
children: o
|
|
4035
|
-
}, o + u)), n = ot(t,
|
|
4033
|
+
}, o + u)), n = ot(t, Ii, (o, u) => c("em", {
|
|
4036
4034
|
children: o
|
|
4037
4035
|
}, o + u)), s = ot(n, Fi, (o, u) => c("strong", {
|
|
4038
4036
|
children: o
|
|
@@ -4053,7 +4051,7 @@ const ot = /* @__PURE__ */ vi(Ci), Si = /(\[[^\]]+\]\([^)]+\))/g, Ai = /\[([^\]]
|
|
|
4053
4051
|
defaultVariants: {
|
|
4054
4052
|
side: "left"
|
|
4055
4053
|
}
|
|
4056
|
-
}),
|
|
4054
|
+
}), Ni = ({
|
|
4057
4055
|
children: e,
|
|
4058
4056
|
className: r,
|
|
4059
4057
|
animate: t,
|
|
@@ -4070,7 +4068,7 @@ const ot = /* @__PURE__ */ vi(Ci), Si = /(\[[^\]]+\]\([^)]+\))/g, Ai = /\[([^\]]
|
|
|
4070
4068
|
}),
|
|
4071
4069
|
...s,
|
|
4072
4070
|
children: e
|
|
4073
|
-
}),
|
|
4071
|
+
}), Ri = ({
|
|
4074
4072
|
message: e
|
|
4075
4073
|
}) => c("div", {
|
|
4076
4074
|
class: "bg-accent-3 flex w-full items-center justify-center overflow-hidden rounded-xl px-2 py-2",
|
|
@@ -4099,9 +4097,9 @@ const ot = /* @__PURE__ */ vi(Ci), Si = /(\[[^\]]+\]\([^)]+\))/g, Ai = /\[([^\]]
|
|
|
4099
4097
|
...r
|
|
4100
4098
|
}) => c("div", {
|
|
4101
4099
|
"aria-hidden": !0,
|
|
4102
|
-
children:
|
|
4100
|
+
children: ce.isBotTyping$.value === !0 ? c("div", {
|
|
4103
4101
|
"data-testid": "typing-indicator",
|
|
4104
|
-
class:
|
|
4102
|
+
class: Qe("flex gap-1 p-4", e),
|
|
4105
4103
|
...r,
|
|
4106
4104
|
children: Array.from({
|
|
4107
4105
|
length: 3
|
|
@@ -4112,7 +4110,7 @@ const ot = /* @__PURE__ */ vi(Ci), Si = /(\[[^\]]+\]\([^)]+\))/g, Ai = /\[([^\]]
|
|
|
4112
4110
|
}
|
|
4113
4111
|
}))
|
|
4114
4112
|
}) : void 0
|
|
4115
|
-
}),
|
|
4113
|
+
}), Di = {
|
|
4116
4114
|
bot: "left",
|
|
4117
4115
|
user: "right"
|
|
4118
4116
|
}, Oi = xt("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)]", {
|
|
@@ -4129,12 +4127,12 @@ const ot = /* @__PURE__ */ vi(Ci), Si = /(\[[^\]]+\]\([^)]+\))/g, Ai = /\[([^\]]
|
|
|
4129
4127
|
}) => {
|
|
4130
4128
|
const {
|
|
4131
4129
|
t: r
|
|
4132
|
-
} =
|
|
4130
|
+
} = ne(), t = q.current$.value.flow, n = (t == null ? void 0 : t.data.messages) ?? [], s = t ? zt(t) : void 0;
|
|
4133
4131
|
return c("ol", {
|
|
4134
4132
|
"aria-label": r("chat_messages"),
|
|
4135
4133
|
"aria-live": "polite",
|
|
4136
4134
|
class: "mt-auto flex flex-col justify-end gap-2 p-2 pt-[calc(var(--header-height)+1rem)]",
|
|
4137
|
-
children: [n.map((i, a) => c(
|
|
4135
|
+
children: [n.map((i, a) => c(Ce, {
|
|
4138
4136
|
children: c("li", {
|
|
4139
4137
|
class: "flex",
|
|
4140
4138
|
tabIndex: a === n.length - 1 ? -1 : void 0,
|
|
@@ -4147,19 +4145,19 @@ const ot = /* @__PURE__ */ vi(Ci), Si = /(\[[^\]]+\]\([^)]+\))/g, Ai = /\[([^\]]
|
|
|
4147
4145
|
children: o.text
|
|
4148
4146
|
})).with({
|
|
4149
4147
|
type: "text",
|
|
4150
|
-
author:
|
|
4148
|
+
author: Hn.union("bot", "user")
|
|
4151
4149
|
}, (o) => {
|
|
4152
4150
|
const u = a === n.length - 1, f = o.author === "bot" ? Mi(o.text) : o.text;
|
|
4153
|
-
return c(
|
|
4154
|
-
children: c(
|
|
4151
|
+
return c(Ce, {
|
|
4152
|
+
children: c(Ni, {
|
|
4155
4153
|
animate: u,
|
|
4156
|
-
side:
|
|
4154
|
+
side: Di[o.author],
|
|
4157
4155
|
children: f
|
|
4158
4156
|
}, a)
|
|
4159
4157
|
});
|
|
4160
4158
|
}).with({
|
|
4161
4159
|
type: "link"
|
|
4162
|
-
}, (o) => c(
|
|
4160
|
+
}, (o) => c(Ri, {
|
|
4163
4161
|
message: o
|
|
4164
4162
|
})).with({
|
|
4165
4163
|
type: "image"
|
|
@@ -4181,9 +4179,9 @@ const ot = /* @__PURE__ */ vi(Ci), Si = /(\[[^\]]+\]\([^)]+\))/g, Ai = /\[([^\]]
|
|
|
4181
4179
|
type: "loading"
|
|
4182
4180
|
}, (o) => {
|
|
4183
4181
|
const u = n[n.length - 1];
|
|
4184
|
-
return !(o === u) ||
|
|
4182
|
+
return !(o === u) || ce.isBotTyping$.value || t != null && t.data.isFinished ? null : c("div", {
|
|
4185
4183
|
class: "flex flex-grow flex-col items-center justify-center gap-2",
|
|
4186
|
-
children: [c(
|
|
4184
|
+
children: [c(Ut, {
|
|
4187
4185
|
"aria-hidden": o.text ? "true" : void 0,
|
|
4188
4186
|
class: "text-neutral-6 h-8 w-8"
|
|
4189
4187
|
}), o.text ? c("p", {
|
|
@@ -4195,7 +4193,7 @@ const ot = /* @__PURE__ */ vi(Ci), Si = /(\[[^\]]+\]\([^)]+\))/g, Ai = /\[([^\]]
|
|
|
4195
4193
|
}).exhaustive()]
|
|
4196
4194
|
})
|
|
4197
4195
|
}, a)), c("li", {
|
|
4198
|
-
class:
|
|
4196
|
+
class: ce.captchaVisible$.value ? "flex" : "hidden",
|
|
4199
4197
|
children: c("div", {
|
|
4200
4198
|
"data-captcha-slot": !0,
|
|
4201
4199
|
tabIndex: -1,
|
|
@@ -4213,41 +4211,41 @@ const ot = /* @__PURE__ */ vi(Ci), Si = /(\[[^\]]+\]\([^)]+\))/g, Ai = /\[([^\]]
|
|
|
4213
4211
|
}) => {
|
|
4214
4212
|
const {
|
|
4215
4213
|
flow: s
|
|
4216
|
-
} =
|
|
4217
|
-
|
|
4218
|
-
const i =
|
|
4214
|
+
} = q.current$.value;
|
|
4215
|
+
Oe(s, "Flow is required to exist to show chatbot body");
|
|
4216
|
+
const i = q.viewState$.value, {
|
|
4219
4217
|
chatRef: a,
|
|
4220
4218
|
chatService: o
|
|
4221
4219
|
} = Kn(), {
|
|
4222
4220
|
t: u
|
|
4223
|
-
} =
|
|
4221
|
+
} = ne(), [f, v] = _e();
|
|
4224
4222
|
return Me(() => {
|
|
4225
|
-
i === "maximised" &&
|
|
4223
|
+
i === "maximised" && ce.scrollToEnd();
|
|
4226
4224
|
}, [i]), Me(() => {
|
|
4227
|
-
var
|
|
4225
|
+
var M;
|
|
4228
4226
|
const {
|
|
4229
|
-
state:
|
|
4227
|
+
state: b,
|
|
4230
4228
|
flow: p
|
|
4231
|
-
} =
|
|
4232
|
-
if (
|
|
4229
|
+
} = q.current$.peek();
|
|
4230
|
+
if (b !== "loaded")
|
|
4233
4231
|
throw new Error(u("invalid_state"));
|
|
4234
|
-
let
|
|
4235
|
-
if (
|
|
4232
|
+
let y = p.data.nodeHistory.at(-1);
|
|
4233
|
+
if (ce.scrollToEnd(), q.setInput(void 0), p.data.isFinished)
|
|
4236
4234
|
return;
|
|
4237
|
-
const
|
|
4238
|
-
const O =
|
|
4239
|
-
!O || O.data.hasInteracted || (
|
|
4235
|
+
const C = () => {
|
|
4236
|
+
const O = q.current$.peek().flow;
|
|
4237
|
+
!O || O.data.hasInteracted || (q.markAsInteracted(), dr(t, O, "FLOW_INTERACT"));
|
|
4240
4238
|
};
|
|
4241
|
-
|
|
4239
|
+
ce.onInteractionFn$.value = C, y === void 0 ? (y = Gr(s.nodes).id, q.setCurrentNodeId(y), dr(t, p, "FLOW_START")) : q.removeMessagesSentByNodeIds([y, jt]);
|
|
4242
4240
|
const {
|
|
4243
|
-
interpret:
|
|
4241
|
+
interpret: _,
|
|
4244
4242
|
abort: k,
|
|
4245
|
-
undo:
|
|
4243
|
+
undo: E
|
|
4246
4244
|
} = ks({
|
|
4247
4245
|
context: s.context,
|
|
4248
4246
|
analytics: {
|
|
4249
4247
|
service: t,
|
|
4250
|
-
customProperties: (
|
|
4248
|
+
customProperties: (M = s.analytics) == null ? void 0 : M.customProperties
|
|
4251
4249
|
},
|
|
4252
4250
|
apiClient: r,
|
|
4253
4251
|
logger: e,
|
|
@@ -4257,21 +4255,21 @@ const ot = /* @__PURE__ */ vi(Ci), Si = /(\[[^\]]+\]\([^)]+\))/g, Ai = /\[([^\]]
|
|
|
4257
4255
|
t: u,
|
|
4258
4256
|
getApplicationRecovery: () => {
|
|
4259
4257
|
var O;
|
|
4260
|
-
return (O =
|
|
4258
|
+
return (O = q.current$.peek().flow) == null ? void 0 : O.data.applicationRecovery;
|
|
4261
4259
|
},
|
|
4262
|
-
setApplicationRecovery:
|
|
4263
|
-
persistWriteBarrier: () =>
|
|
4260
|
+
setApplicationRecovery: q.setApplicationRecovery,
|
|
4261
|
+
persistWriteBarrier: () => q.persistWriteBarrier(p),
|
|
4264
4262
|
// We need to get fresh submissions, that’s why we call `peek` here.
|
|
4265
4263
|
getSubmissions: () => {
|
|
4266
4264
|
var O;
|
|
4267
|
-
return (O =
|
|
4265
|
+
return (O = q.current$.peek().flow) == null ? void 0 : O.data.submissions;
|
|
4268
4266
|
},
|
|
4269
|
-
onInterpret: (O) =>
|
|
4267
|
+
onInterpret: (O) => q.setCurrentNodeId(O.id),
|
|
4270
4268
|
onFlowEnd: async () => {
|
|
4271
|
-
var
|
|
4272
|
-
|
|
4273
|
-
const O =
|
|
4274
|
-
|
|
4269
|
+
var K;
|
|
4270
|
+
q.markAsFinished();
|
|
4271
|
+
const O = q.current$.peek().flow;
|
|
4272
|
+
Oe(O), t.log({
|
|
4275
4273
|
event: "FLOW_END",
|
|
4276
4274
|
properties: {
|
|
4277
4275
|
flow_id: s.id,
|
|
@@ -4280,23 +4278,23 @@ const ot = /* @__PURE__ */ vi(Ci), Si = /(\[[^\]]+\]\([^)]+\))/g, Ai = /\[([^\]]
|
|
|
4280
4278
|
flow_build: s.build,
|
|
4281
4279
|
job: s.job
|
|
4282
4280
|
},
|
|
4283
|
-
customProperties: (
|
|
4281
|
+
customProperties: (K = s.analytics) == null ? void 0 : K.customProperties
|
|
4284
4282
|
});
|
|
4285
4283
|
}
|
|
4286
|
-
}),
|
|
4287
|
-
|
|
4288
|
-
},
|
|
4284
|
+
}), g = y, N = () => {
|
|
4285
|
+
v(() => E), _(g);
|
|
4286
|
+
}, V = new AbortController();
|
|
4289
4287
|
return p.offerResume ? Gs({
|
|
4290
4288
|
chatService: o,
|
|
4291
4289
|
t: u,
|
|
4292
|
-
signal:
|
|
4293
|
-
}).then((O) => (
|
|
4294
|
-
O instanceof
|
|
4295
|
-
}) :
|
|
4296
|
-
|
|
4290
|
+
signal: V.signal
|
|
4291
|
+
}).then((O) => (q.settleResume(p), O ? N() : (q.restart(), Gn.flushStateData()))).catch((O) => {
|
|
4292
|
+
O instanceof jr || e.error("Resume prompt failed", O);
|
|
4293
|
+
}) : N(), () => {
|
|
4294
|
+
V.abort(), ce.onInteractionFn$.value === C && (ce.onInteractionFn$.value = () => {
|
|
4297
4295
|
}), k();
|
|
4298
4296
|
};
|
|
4299
|
-
}, [t, r, o, e, s, n, u]), c(
|
|
4297
|
+
}, [t, r, o, e, s, n, u]), c(Ce, {
|
|
4300
4298
|
children: [c("div", {
|
|
4301
4299
|
class: "relative flex min-h-0 w-full max-w-full flex-grow flex-col",
|
|
4302
4300
|
children: [c("div", {
|
|
@@ -4309,18 +4307,18 @@ const ot = /* @__PURE__ */ vi(Ci), Si = /(\[[^\]]+\]\([^)]+\))/g, Ai = /\[([^\]]
|
|
|
4309
4307
|
WebkitOverflowScrolling: "touch"
|
|
4310
4308
|
},
|
|
4311
4309
|
children: c(Bi, {
|
|
4312
|
-
lastSentMessageFooter: !
|
|
4310
|
+
lastSentMessageFooter: !zt(s) || !f ? null : c($i, {
|
|
4313
4311
|
undoFn: f
|
|
4314
4312
|
})
|
|
4315
4313
|
})
|
|
4316
|
-
}),
|
|
4314
|
+
}), ce.isReadingHistory$.value && !s.data.isFinished && !ce.isBotTyping$.value && c("div", {
|
|
4317
4315
|
class: "absolute bottom-2 left-1/2 -translate-x-1/2",
|
|
4318
|
-
children: c(
|
|
4316
|
+
children: c(Hr, {
|
|
4319
4317
|
class: "bg-neutral-1 ring-divider shadow-surface-md ring-1",
|
|
4320
4318
|
"aria-label": u("jump_to_current"),
|
|
4321
4319
|
onClick: () => {
|
|
4322
|
-
var p,
|
|
4323
|
-
|
|
4320
|
+
var p, y;
|
|
4321
|
+
ce.scrollToEnd(), (y = ((p = a.current) == null ? void 0 : p.querySelector('li[tabindex="-1"]')) ?? a.current) == null || y.focus({
|
|
4324
4322
|
preventScroll: !0
|
|
4325
4323
|
});
|
|
4326
4324
|
},
|
|
@@ -4337,16 +4335,16 @@ const ot = /* @__PURE__ */ vi(Ci), Si = /(\[[^\]]+\]\([^)]+\))/g, Ai = /\[([^\]]
|
|
|
4337
4335
|
}) => {
|
|
4338
4336
|
const {
|
|
4339
4337
|
t: r
|
|
4340
|
-
} =
|
|
4338
|
+
} = ne();
|
|
4341
4339
|
return c("div", {
|
|
4342
4340
|
class: "flex flex-1 items-center justify-end px-1",
|
|
4343
|
-
children: c(
|
|
4341
|
+
children: c(Hr, {
|
|
4344
4342
|
"aria-label": r("undo"),
|
|
4345
4343
|
onClick: async () => {
|
|
4346
4344
|
const {
|
|
4347
4345
|
flow: t
|
|
4348
|
-
} =
|
|
4349
|
-
|
|
4346
|
+
} = q.current$.peek();
|
|
4347
|
+
Oe(t), e(t.data.nodeHistory);
|
|
4350
4348
|
},
|
|
4351
4349
|
children: c("path", {
|
|
4352
4350
|
d: "M3 13h2.67l6.66-6.67a1.9 1.9 0 0 0 0-2.66 1.91 1.91 0 0 0-2.66 0L3 10.33V13Zm4.6-7.25 2.67 2.67"
|