@inploi/plugin-chatbot 14.10.2 → 14.10.3
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-4e7939a4.cjs +5 -0
- package/dist/{chatbot-body-a22432d8.js → chatbot-body-cdaeae9e.js} +1143 -1138
- package/dist/chatbot.idb.d.ts +3 -1
- package/dist/{index-fd318f9f.js → index-74999c44.js} +472 -471
- package/dist/index-beaf07e9.cjs +5 -0
- package/dist/plugin-chatbot.cjs +1 -1
- package/dist/plugin-chatbot.js +1 -1
- package/package.json +2 -2
- package/dist/chatbot-body-64d33887.cjs +0 -5
- package/dist/index-f5c3c7c4.cjs +0 -5
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
var Sn = Object.defineProperty;
|
|
2
|
-
var
|
|
3
|
-
var
|
|
4
|
-
import {
|
|
2
|
+
var In = (e, r, t) => r in e ? Sn(e, r, { enumerable: !0, configurable: !0, writable: !0, value: t }) : e[r] = t;
|
|
3
|
+
var Q = (e, r, t) => (In(e, typeof r != "symbol" ? r + "" : r, t), t);
|
|
4
|
+
import { u as Or, p as vt, D as Tt, l as ze, f as Br, I as jr, a as An, E as En, N as Fn, T as $r, z as Vn, Z as Pr, H as Mn, C as Ln, s as Nn, g as Rn, S as Dn, U as rr, $ as nr, R as Tn, w as sr, m as On, y as Bn, b as qr, k as jn, x as $n, h as Pn, v as qn, c as U, d as re, o as c, e as Ze, i as xt, j as we, _ as ye, n as je, q as Re, r as ke, L as qt, F as Un, t as Ur, A as Wr, B as Wn, G as Xe, J as ar, K as se, M as ce, O as zn, P as Hn, Q as Kn, V as Gn, W as zr, X as Jn } from "./index-74999c44.js";
|
|
5
5
|
import "@inploi/sdk";
|
|
6
|
-
var
|
|
6
|
+
var Zn = "9.8.2", Hr = `https://sdk.inploi.com/@inploi/flows@${Zn}/cdn/captcha/index.html`, Xn = new URL(Hr).origin, ir = 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;
|
|
@@ -11,39 +11,39 @@ var Jn = "9.8.1", Hr = `https://sdk.inploi.com/@inploi/flows@${Jn}/cdn/captcha/i
|
|
|
11
11
|
}).catch((t) => {
|
|
12
12
|
throw Ft.delete(e), t;
|
|
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(m), s == null || s.removeEventListener("abort", p), f(),
|
|
18
|
-
}, y = (
|
|
19
|
-
clearTimeout(m), m = setTimeout(() => y("Captcha timed out"),
|
|
16
|
+
}, b = (I) => {
|
|
17
|
+
u || (u = !0, clearTimeout(m), s == null || s.removeEventListener("abort", p), f(), I());
|
|
18
|
+
}, y = (I) => b(() => n(new Error(I))), p = () => y("Captcha aborted"), m, k = (I) => {
|
|
19
|
+
clearTimeout(m), m = setTimeout(() => y("Captcha timed out"), I);
|
|
20
20
|
};
|
|
21
|
-
if (
|
|
21
|
+
if (k(ir), 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 I = await es(e);
|
|
25
|
+
if (I === void 0)
|
|
26
|
+
return b(() => t(void 0));
|
|
27
27
|
if (u)
|
|
28
28
|
return;
|
|
29
29
|
let C = document.createElement("iframe");
|
|
30
|
-
C.src = `${Hr}?${new URLSearchParams({ sitekey:
|
|
31
|
-
let x = !1,
|
|
32
|
-
if (!C.contentWindow ||
|
|
30
|
+
C.src = `${Hr}?${new URLSearchParams({ sitekey: I, origin: window.location.origin, ...a && { theme: a } }).toString()}`, C.title = "Cloudflare security check", C.style.cssText = `display:block;border:0;width:${i ? "100%" : "300px"};height:0;color-scheme:normal`, i ? i.appendChild(C) : (C.style.cssText += ";position:fixed;bottom:16px;right:16px;z-index:2147483647", document.body.appendChild(C));
|
|
31
|
+
let x = !1, v = (E) => {
|
|
32
|
+
if (!C.contentWindow || E.source !== C.contentWindow || E.origin !== Xn || !Qn(E.data))
|
|
33
33
|
return;
|
|
34
|
-
let
|
|
35
|
-
switch (
|
|
34
|
+
let N = E.data;
|
|
35
|
+
switch (N.type) {
|
|
36
36
|
case "token":
|
|
37
|
-
return
|
|
37
|
+
return b(() => t(N.token));
|
|
38
38
|
case "resize":
|
|
39
|
-
C.style.height = `${Math.max(0, Math.ceil(
|
|
39
|
+
C.style.height = `${Math.max(0, Math.ceil(N.height))}px`;
|
|
40
40
|
return;
|
|
41
41
|
case "before-interactive":
|
|
42
|
-
return x = !0,
|
|
42
|
+
return x = !0, k(Yn), o == null ? void 0 : o();
|
|
43
43
|
case "after-interactive":
|
|
44
|
-
return x = !1,
|
|
44
|
+
return x = !1, k(ir);
|
|
45
45
|
case "error":
|
|
46
|
-
!x && !
|
|
46
|
+
!x && !N.interactive && y("Captcha failed");
|
|
47
47
|
return;
|
|
48
48
|
case "expired":
|
|
49
49
|
return y("Captcha expired");
|
|
@@ -51,10 +51,10 @@ var Jn = "9.8.1", Hr = `https://sdk.inploi.com/@inploi/flows@${Jn}/cdn/captcha/i
|
|
|
51
51
|
return y("Captcha timed out");
|
|
52
52
|
}
|
|
53
53
|
};
|
|
54
|
-
window.addEventListener("message",
|
|
55
|
-
window.removeEventListener("message",
|
|
54
|
+
window.addEventListener("message", v), f = () => {
|
|
55
|
+
window.removeEventListener("message", v), C.remove();
|
|
56
56
|
};
|
|
57
|
-
})().catch((
|
|
57
|
+
})().catch((I) => b(() => n(I)));
|
|
58
58
|
}), or = ({ condition: e, context: r, submissions: t, ifBlock: n }) => {
|
|
59
59
|
let [s, ...i] = e.compareKey.split(".");
|
|
60
60
|
if (!s)
|
|
@@ -83,13 +83,13 @@ var Jn = "9.8.1", Hr = `https://sdk.inploi.com/@inploi/flows@${Jn}/cdn/captcha/i
|
|
|
83
83
|
let o = Tt(a.value, i), u = { ...n, data: { compareKey: "_temp", compare: e.compare, compareValue: e.compareValue } };
|
|
84
84
|
switch (typeof o) {
|
|
85
85
|
case "boolean":
|
|
86
|
-
return
|
|
86
|
+
return at(u, { submissions: { _temp: { value: o, type: "boolean" } }, context: r });
|
|
87
87
|
case "string":
|
|
88
|
-
return
|
|
88
|
+
return at(u, { submissions: { _temp: { value: o, type: "string" } }, context: r });
|
|
89
89
|
case "number":
|
|
90
|
-
return
|
|
90
|
+
return at(u, { submissions: { _temp: { value: o, type: "number" } }, context: r });
|
|
91
91
|
case "object":
|
|
92
|
-
return Array.isArray(o) && o.every((f) => typeof f == "string") ?
|
|
92
|
+
return Array.isArray(o) && o.every((f) => typeof f == "string") ? at(u, { submissions: { _temp: { value: o, type: "enum" } }, context: r }) : !1;
|
|
93
93
|
}
|
|
94
94
|
break;
|
|
95
95
|
}
|
|
@@ -105,7 +105,7 @@ var Jn = "9.8.1", Hr = `https://sdk.inploi.com/@inploi/flows@${Jn}/cdn/captcha/i
|
|
|
105
105
|
}
|
|
106
106
|
case "phone":
|
|
107
107
|
case "string": {
|
|
108
|
-
let o = a.type === "phone" ?
|
|
108
|
+
let o = a.type === "phone" ? vt(a.value) : a.value;
|
|
109
109
|
switch (e.compare) {
|
|
110
110
|
case "equals":
|
|
111
111
|
return o === e.compareValue;
|
|
@@ -153,7 +153,7 @@ var Jn = "9.8.1", Hr = `https://sdk.inploi.com/@inploi/flows@${Jn}/cdn/captcha/i
|
|
|
153
153
|
}
|
|
154
154
|
break;
|
|
155
155
|
}
|
|
156
|
-
},
|
|
156
|
+
}, at = (e, { context: r, submissions: t }) => {
|
|
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)
|
|
@@ -166,7 +166,7 @@ var Jn = "9.8.1", Hr = `https://sdk.inploi.com/@inploi/flows@${Jn}/cdn/captcha/i
|
|
|
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
170
|
let [a, ...o] = s.trim().split("."), u = Or({ key: a, path: o, submissions: t, context: r });
|
|
171
171
|
if (!u)
|
|
172
172
|
return i;
|
|
@@ -174,7 +174,7 @@ var Jn = "9.8.1", Hr = `https://sdk.inploi.com/@inploi/flows@${Jn}/cdn/captcha/i
|
|
|
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} (${ze(f.sizeKb)})`).join(", ");
|
|
178
178
|
case "enum":
|
|
179
179
|
return u.value.join(", ");
|
|
180
180
|
case "address":
|
|
@@ -183,7 +183,7 @@ var Jn = "9.8.1", Hr = `https://sdk.inploi.com/@inploi/flows@${Jn}/cdn/captcha/i
|
|
|
183
183
|
case "string":
|
|
184
184
|
return u.value ? u.value.toString() : i;
|
|
185
185
|
case "phone":
|
|
186
|
-
return
|
|
186
|
+
return vt(u.value);
|
|
187
187
|
case "integration": {
|
|
188
188
|
if (typeof u.value != "object" || Array.isArray(u.value))
|
|
189
189
|
break;
|
|
@@ -196,7 +196,7 @@ var Jn = "9.8.1", Hr = `https://sdk.inploi.com/@inploi/flows@${Jn}/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((b) => typeof b == "string"))
|
|
200
200
|
return f.join(", ");
|
|
201
201
|
}
|
|
202
202
|
break;
|
|
@@ -205,11 +205,11 @@ var Jn = "9.8.1", Hr = `https://sdk.inploi.com/@inploi/flows@${Jn}/cdn/captcha/i
|
|
|
205
205
|
return i;
|
|
206
206
|
});
|
|
207
207
|
/*! noble-hashes - MIT License (c) 2022 Paul Miller (paulmillr.com) */
|
|
208
|
-
function
|
|
208
|
+
function ss(e) {
|
|
209
209
|
return e instanceof Uint8Array || ArrayBuffer.isView(e) && e.constructor.name === "Uint8Array";
|
|
210
210
|
}
|
|
211
211
|
function Ut(e, r, t = "") {
|
|
212
|
-
const n =
|
|
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}`;
|
|
215
215
|
throw new Error(a + "expected Uint8Array" + o + ", got " + u);
|
|
@@ -222,7 +222,7 @@ function lr(e, r = !0) {
|
|
|
222
222
|
if (r && e.finished)
|
|
223
223
|
throw new Error("Hash#digest() has already been called");
|
|
224
224
|
}
|
|
225
|
-
function
|
|
225
|
+
function as(e, r) {
|
|
226
226
|
Ut(e, void 0, "digestInto() output");
|
|
227
227
|
const t = r.outputLen;
|
|
228
228
|
if (e.length < t)
|
|
@@ -238,44 +238,44 @@ function Vt(e) {
|
|
|
238
238
|
function pe(e, r) {
|
|
239
239
|
return e << 32 - r | e >>> r;
|
|
240
240
|
}
|
|
241
|
-
const
|
|
241
|
+
const is = /* @__PURE__ */ (() => (
|
|
242
242
|
// @ts-ignore
|
|
243
243
|
typeof Uint8Array.from([]).toHex == "function" && typeof Uint8Array.fromHex == "function"
|
|
244
|
-
))(),
|
|
245
|
-
function
|
|
246
|
-
if (Ut(e),
|
|
244
|
+
))(), os = /* @__PURE__ */ Array.from({ length: 256 }, (e, r) => r.toString(16).padStart(2, "0"));
|
|
245
|
+
function ls(e) {
|
|
246
|
+
if (Ut(e), is)
|
|
247
247
|
return e.toHex();
|
|
248
248
|
let r = "";
|
|
249
249
|
for (let t = 0; t < e.length; t++)
|
|
250
|
-
r +=
|
|
250
|
+
r += os[e[t]];
|
|
251
251
|
return r;
|
|
252
252
|
}
|
|
253
|
-
function
|
|
253
|
+
function cs(e, r = {}) {
|
|
254
254
|
const t = (s, i) => e(i).update(s).digest(), n = e(void 0);
|
|
255
255
|
return t.outputLen = n.outputLen, t.blockLen = n.blockLen, t.create = (s) => e(s), Object.assign(t, r), Object.freeze(t);
|
|
256
256
|
}
|
|
257
|
-
const
|
|
257
|
+
const us = (e) => ({
|
|
258
258
|
oid: Uint8Array.from([6, 9, 96, 134, 72, 1, 101, 3, 4, 2, e])
|
|
259
259
|
});
|
|
260
|
-
function
|
|
260
|
+
function ds(e, r, t) {
|
|
261
261
|
return e & r ^ ~e & t;
|
|
262
262
|
}
|
|
263
|
-
function
|
|
263
|
+
function fs(e, r, t) {
|
|
264
264
|
return e & r ^ e & t ^ r & t;
|
|
265
265
|
}
|
|
266
|
-
class
|
|
266
|
+
class hs {
|
|
267
267
|
constructor(r, t, n, s) {
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
268
|
+
Q(this, "blockLen");
|
|
269
|
+
Q(this, "outputLen");
|
|
270
|
+
Q(this, "padOffset");
|
|
271
|
+
Q(this, "isLE");
|
|
272
272
|
// For partial updates less than block size
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
273
|
+
Q(this, "buffer");
|
|
274
|
+
Q(this, "view");
|
|
275
|
+
Q(this, "finished", !1);
|
|
276
|
+
Q(this, "length", 0);
|
|
277
|
+
Q(this, "pos", 0);
|
|
278
|
+
Q(this, "destroyed", !1);
|
|
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) {
|
|
@@ -294,7 +294,7 @@ class fs {
|
|
|
294
294
|
return this.length += r.length, this.roundClean(), this;
|
|
295
295
|
}
|
|
296
296
|
digestInto(r) {
|
|
297
|
-
lr(this),
|
|
297
|
+
lr(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);
|
|
@@ -304,11 +304,11 @@ class fs {
|
|
|
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, b = this.get();
|
|
308
|
+
if (f > b.length)
|
|
309
309
|
throw new Error("_sha2: outputLen bigger than state");
|
|
310
310
|
for (let y = 0; y < f; y++)
|
|
311
|
-
o.setUint32(4 * y,
|
|
311
|
+
o.setUint32(4 * y, b[y], i);
|
|
312
312
|
}
|
|
313
313
|
digest() {
|
|
314
314
|
const { buffer: r, outputLen: t } = this;
|
|
@@ -325,7 +325,7 @@ class fs {
|
|
|
325
325
|
return this._cloneInto();
|
|
326
326
|
}
|
|
327
327
|
}
|
|
328
|
-
const
|
|
328
|
+
const Ve = /* @__PURE__ */ Uint32Array.from([
|
|
329
329
|
1779033703,
|
|
330
330
|
3144134277,
|
|
331
331
|
1013904242,
|
|
@@ -334,7 +334,7 @@ const Fe = /* @__PURE__ */ Uint32Array.from([
|
|
|
334
334
|
2600822924,
|
|
335
335
|
528734635,
|
|
336
336
|
1541459225
|
|
337
|
-
]),
|
|
337
|
+
]), ps = /* @__PURE__ */ Uint32Array.from([
|
|
338
338
|
1116352408,
|
|
339
339
|
1899447441,
|
|
340
340
|
3049323471,
|
|
@@ -399,8 +399,8 @@ const Fe = /* @__PURE__ */ Uint32Array.from([
|
|
|
399
399
|
2756734187,
|
|
400
400
|
3204031479,
|
|
401
401
|
3329325298
|
|
402
|
-
]),
|
|
403
|
-
class
|
|
402
|
+
]), Me = /* @__PURE__ */ new Uint32Array(64);
|
|
403
|
+
class ms extends hs {
|
|
404
404
|
constructor(r) {
|
|
405
405
|
super(64, r, 8, !1);
|
|
406
406
|
}
|
|
@@ -414,43 +414,43 @@ class ps extends fs {
|
|
|
414
414
|
}
|
|
415
415
|
process(r, t) {
|
|
416
416
|
for (let y = 0; y < 16; y++, t += 4)
|
|
417
|
-
|
|
417
|
+
Me[y] = r.getUint32(t, !1);
|
|
418
418
|
for (let y = 16; y < 64; y++) {
|
|
419
|
-
const p =
|
|
420
|
-
|
|
419
|
+
const p = Me[y - 15], m = Me[y - 2], k = pe(p, 7) ^ pe(p, 18) ^ p >>> 3, I = pe(m, 17) ^ pe(m, 19) ^ m >>> 10;
|
|
420
|
+
Me[y] = I + Me[y - 7] + k + Me[y - 16] | 0;
|
|
421
421
|
}
|
|
422
|
-
let { A: n, B: s, C: i, D: a, E: o, F: u, G: f, H:
|
|
422
|
+
let { A: n, B: s, C: i, D: a, E: o, F: u, G: f, H: b } = this;
|
|
423
423
|
for (let y = 0; y < 64; y++) {
|
|
424
|
-
const p = pe(o, 6) ^ pe(o, 11) ^ pe(o, 25), m =
|
|
425
|
-
|
|
424
|
+
const p = pe(o, 6) ^ pe(o, 11) ^ pe(o, 25), m = b + p + ds(o, u, f) + ps[y] + Me[y] | 0, I = (pe(n, 2) ^ pe(n, 13) ^ pe(n, 22)) + fs(n, s, i) | 0;
|
|
425
|
+
b = f, f = u, u = o, o = a + m | 0, a = i, i = s, s = n, n = m + I | 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, b = b + this.H | 0, this.set(n, s, i, a, o, u, f, b);
|
|
428
428
|
}
|
|
429
429
|
roundClean() {
|
|
430
|
-
Ot(
|
|
430
|
+
Ot(Me);
|
|
431
431
|
}
|
|
432
432
|
destroy() {
|
|
433
433
|
this.set(0, 0, 0, 0, 0, 0, 0, 0), Ot(this.buffer);
|
|
434
434
|
}
|
|
435
435
|
}
|
|
436
|
-
class
|
|
436
|
+
class ys extends ms {
|
|
437
437
|
constructor() {
|
|
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
|
-
|
|
442
|
-
|
|
443
|
-
|
|
444
|
-
|
|
445
|
-
|
|
446
|
-
|
|
447
|
-
|
|
448
|
-
|
|
441
|
+
Q(this, "A", Ve[0] | 0);
|
|
442
|
+
Q(this, "B", Ve[1] | 0);
|
|
443
|
+
Q(this, "C", Ve[2] | 0);
|
|
444
|
+
Q(this, "D", Ve[3] | 0);
|
|
445
|
+
Q(this, "E", Ve[4] | 0);
|
|
446
|
+
Q(this, "F", Ve[5] | 0);
|
|
447
|
+
Q(this, "G", Ve[6] | 0);
|
|
448
|
+
Q(this, "H", Ve[7] | 0);
|
|
449
449
|
}
|
|
450
450
|
}
|
|
451
|
-
const
|
|
452
|
-
() => new
|
|
453
|
-
/* @__PURE__ */
|
|
451
|
+
const bs = /* @__PURE__ */ cs(
|
|
452
|
+
() => new ys(),
|
|
453
|
+
/* @__PURE__ */ us(1)
|
|
454
454
|
);
|
|
455
455
|
var Kr = (e) => {
|
|
456
456
|
let r = e.find((t) => t.isHead);
|
|
@@ -461,8 +461,8 @@ var Kr = (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;
|
|
464
|
-
}, Bt = (e) => Array.isArray(e) ? e.map(Bt) : e !== null && typeof e == "object" ? Object.fromEntries(Object.entries(e).sort(([r], [t]) => r.localeCompare(t)).map(([r, t]) => [r, Bt(t)])) : typeof e == "function" ? void 0 : e, gs = (e) =>
|
|
465
|
-
function
|
|
464
|
+
}, Bt = (e) => Array.isArray(e) ? e.map(Bt) : e !== null && typeof e == "object" ? Object.fromEntries(Object.entries(e).sort(([r], [t]) => r.localeCompare(t)).map(([r, t]) => [r, Bt(t)])) : typeof e == "function" ? void 0 : e, gs = (e) => ls(bs(new TextEncoder().encode(JSON.stringify(Bt(e)))));
|
|
465
|
+
function vs(e, r, t, n) {
|
|
466
466
|
var s;
|
|
467
467
|
if (n != null && n.aborted)
|
|
468
468
|
return;
|
|
@@ -478,13 +478,13 @@ function bs(e, r, t, n) {
|
|
|
478
478
|
clearTimeout(u);
|
|
479
479
|
});
|
|
480
480
|
}
|
|
481
|
-
var Gr = ({ context: e, submissions: r }) => ({ context: e, submissions: r ?? {} }), he = (e, r) =>
|
|
481
|
+
var Gr = ({ context: e, submissions: r }) => ({ context: e, submissions: r ?? {} }), he = (e, r) => ns(e, Gr(r)), xs = (e, r) => at(e, Gr(r)), Jr = ({ 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
486
|
return Jr({ 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)
|
|
490
490
|
return !1;
|
|
@@ -496,44 +496,44 @@ var Gr = ({ context: e, submissions: r }) => ({ context: e, submissions: r ?? {}
|
|
|
496
496
|
});
|
|
497
497
|
if (t != null && t.nextId)
|
|
498
498
|
return r.find((n) => n.id === t.nextId);
|
|
499
|
-
},
|
|
500
|
-
var
|
|
501
|
-
let
|
|
502
|
-
(
|
|
503
|
-
var
|
|
504
|
-
if (
|
|
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: b, onSubmitNetworkError: y, closedRoleBehaviour: p, dateEchoLocale: m, onFlowEnd: k, onInterpret: I, forceSubmitConfirmation: C, t: x }) => {
|
|
500
|
+
var v;
|
|
501
|
+
let E = new AbortController(), N = { submitAccepted: !1 };
|
|
502
|
+
(v = e.data).startedWriteNodeIds ?? (v.startedWriteNodeIds = e.nodes.flatMap((R) => {
|
|
503
|
+
var j, O;
|
|
504
|
+
if (R.type !== "integration-application-submit" || !e.data.nodeHistory.includes(R.id))
|
|
505
505
|
return [];
|
|
506
|
-
let
|
|
507
|
-
return (
|
|
506
|
+
let W = R.data.key ? (j = a()) == null ? void 0 : j[R.data.key] : void 0;
|
|
507
|
+
return (W == null ? void 0 : W.type) === "integration" && ((O = Br(W.value)) == null ? void 0 : O.verdict) === "not_submitted" ? [] : [R.id];
|
|
508
508
|
}));
|
|
509
|
-
let
|
|
510
|
-
let
|
|
511
|
-
if (
|
|
509
|
+
let M = { ...r.service, log: (R) => r.service.log({ ...R, customProperties: { ...R.customProperties, ...r.customProperties } }) }, L = async (R, W) => {
|
|
510
|
+
let j = E.signal;
|
|
511
|
+
if (j.aborted)
|
|
512
512
|
return;
|
|
513
|
-
let
|
|
514
|
-
var
|
|
515
|
-
return A.id ===
|
|
513
|
+
let O = a(), z = o(), V = (z == null ? void 0 : z.submitNodeId) === R.id ? e.nodes.find((A) => {
|
|
514
|
+
var T;
|
|
515
|
+
return A.id === z.fileQuestionNodeId && A.type === "question-file" && ((T = O == null ? void 0 : O[A.data.key]) == null ? void 0 : T.type) !== "file";
|
|
516
516
|
}) : void 0;
|
|
517
|
-
if (
|
|
518
|
-
return
|
|
519
|
-
|
|
517
|
+
if (V)
|
|
518
|
+
return L(V, W);
|
|
519
|
+
I == null || I(R, W);
|
|
520
520
|
try {
|
|
521
|
-
await
|
|
522
|
-
if (
|
|
521
|
+
await Cs({ flow: e, analytics: M, logger: t, talentBankClient: n, apiClient: i, context: s, node: R, submissions: O, applicationRecovery: z, setApplicationRecovery: async (A) => {
|
|
522
|
+
if (!j.aborted)
|
|
523
523
|
try {
|
|
524
524
|
await u(A);
|
|
525
|
-
} catch (
|
|
526
|
-
t.error("Failed to persist application recovery",
|
|
525
|
+
} catch (T) {
|
|
526
|
+
t.error("Failed to persist application recovery", T);
|
|
527
527
|
}
|
|
528
|
-
}, forceSubmitConfirmation: C || (
|
|
529
|
-
|
|
528
|
+
}, forceSubmitConfirmation: C || (z == null ? void 0 : z.submitNodeId) === R.id, run: N, persistWriteBarrier: b, onSubmitNetworkError: y, closedRoleBehaviour: p, dateEchoLocale: m, signal: j, t: x, chat: { sendMessage: async (A) => f.send({ groupId: R.id, message: A, signal: j }), userInput: async (A) => f.input({ input: A, signal: j }), setSubmission: (A, T) => {
|
|
529
|
+
j.aborted || f.setSubmission(A, T);
|
|
530
530
|
}, captcha: f.captcha }, next: (A) => {
|
|
531
|
-
if (
|
|
531
|
+
if (j.aborted)
|
|
532
532
|
return;
|
|
533
|
-
let
|
|
534
|
-
return
|
|
533
|
+
let T = (z == null ? void 0 : z.fileQuestionNodeId) === R.id ? z.submitNodeId : A, $ = T ? e.nodes.find((K) => K.id === T) : ws({ childNode: R, nodes: e.nodes });
|
|
534
|
+
return $ ? L($, R) : k == null ? void 0 : k(R);
|
|
535
535
|
}, end: () => {
|
|
536
|
-
|
|
536
|
+
j.aborted || (k == null || k(R));
|
|
537
537
|
} });
|
|
538
538
|
} catch (A) {
|
|
539
539
|
if (A instanceof jr)
|
|
@@ -541,83 +541,83 @@ var Gr = ({ context: e, submissions: r }) => ({ context: e, submissions: r ?? {}
|
|
|
541
541
|
throw A;
|
|
542
542
|
}
|
|
543
543
|
};
|
|
544
|
-
return { interpret: async (
|
|
545
|
-
let
|
|
546
|
-
return
|
|
547
|
-
}, undo: (
|
|
548
|
-
var
|
|
549
|
-
if (delete e.data.reviewReplay, ((
|
|
544
|
+
return { interpret: async (R) => {
|
|
545
|
+
let W = e.nodes.find((j) => j.id === R) ?? Kr(e.nodes);
|
|
546
|
+
return L(W);
|
|
547
|
+
}, undo: (R) => {
|
|
548
|
+
var T;
|
|
549
|
+
if (delete e.data.reviewReplay, ((T = e.data.startedWriteNodeIds) == null ? void 0 : T.length) || e.data.isFinished)
|
|
550
550
|
return { removed: 0 };
|
|
551
|
-
let
|
|
552
|
-
if (
|
|
551
|
+
let W = Wt(e), j = W ? R.lastIndexOf(W) : -1, O = e.nodes.find(($) => $.id === W);
|
|
552
|
+
if (j === -1 || !O)
|
|
553
553
|
return { removed: 0 };
|
|
554
|
-
let
|
|
555
|
-
|
|
556
|
-
let
|
|
557
|
-
e.data.messages = e.data.messages.filter((
|
|
554
|
+
let z = e.nodes.find(($) => $.id === R[R.length - 1]);
|
|
555
|
+
E.abort();
|
|
556
|
+
let V = R.splice(j);
|
|
557
|
+
e.data.messages = e.data.messages.filter(($) => !$.groupId || !V.includes($.groupId)), e.data.currentInput = null;
|
|
558
558
|
let A = a();
|
|
559
|
-
for (let
|
|
560
|
-
let
|
|
561
|
-
if (!(!
|
|
562
|
-
for (let
|
|
563
|
-
typeof
|
|
559
|
+
for (let $ of V.slice(1)) {
|
|
560
|
+
let K = e.nodes.find((Z) => Z.id === $);
|
|
561
|
+
if (!(!K || !A || K.id === W) && ("key" in K.data && K.data.key && delete A[K.data.key], "keys" in K.data))
|
|
562
|
+
for (let Z of Object.values(K.data.keys))
|
|
563
|
+
typeof Z == "string" && delete A[Z];
|
|
564
564
|
}
|
|
565
|
-
return
|
|
565
|
+
return E = new AbortController(), L(O, z), { removed: V.length };
|
|
566
566
|
}, abort: () => {
|
|
567
|
-
|
|
567
|
+
E.abort();
|
|
568
568
|
} };
|
|
569
569
|
};
|
|
570
|
-
async function
|
|
570
|
+
async function Cs(e) {
|
|
571
571
|
let r = e.node;
|
|
572
572
|
switch (r.type) {
|
|
573
573
|
case "flow-section":
|
|
574
574
|
return await e.chat.sendMessage({ type: "system", variant: "info", text: r.data.title }), e.next(r.nextId);
|
|
575
575
|
case "pre-apply-result":
|
|
576
|
-
return
|
|
576
|
+
return zs({ ...e, node: r });
|
|
577
577
|
case "text":
|
|
578
|
-
return
|
|
578
|
+
return Ds({ ...e, node: r });
|
|
579
579
|
case "image":
|
|
580
|
-
return Rs({ ...e, node: r });
|
|
581
|
-
case "question-text":
|
|
582
580
|
return Ts({ ...e, node: r });
|
|
581
|
+
case "question-text":
|
|
582
|
+
return Os({ ...e, node: r });
|
|
583
583
|
case "question-enum":
|
|
584
|
-
return
|
|
584
|
+
return $s({ ...e, node: r });
|
|
585
585
|
case "question-number":
|
|
586
|
-
return Os({ ...e, node: r });
|
|
587
|
-
case "question-phone":
|
|
588
586
|
return Bs({ ...e, node: r });
|
|
587
|
+
case "question-phone":
|
|
588
|
+
return js({ ...e, node: r });
|
|
589
589
|
case "question-boolean":
|
|
590
590
|
return Ps({ ...e, node: r });
|
|
591
591
|
case "question-file":
|
|
592
|
-
return
|
|
592
|
+
return Us({ ...e, node: r });
|
|
593
593
|
case "question-address":
|
|
594
|
-
return
|
|
594
|
+
return qs({ ...e, node: r });
|
|
595
595
|
case "end-flow":
|
|
596
|
-
return
|
|
596
|
+
return Ws({ ...e, node: r });
|
|
597
597
|
case "if-block":
|
|
598
|
-
return
|
|
598
|
+
return Rs({ ...e, node: r });
|
|
599
599
|
case "jump":
|
|
600
|
-
return
|
|
600
|
+
return As({ ...e, node: r });
|
|
601
601
|
case "link":
|
|
602
|
-
return
|
|
602
|
+
return Ns({ ...e, node: r });
|
|
603
603
|
case "integration-application-submit":
|
|
604
|
-
return
|
|
604
|
+
return Ls({ ...e, node: r });
|
|
605
605
|
case "add-submission":
|
|
606
|
-
return
|
|
606
|
+
return Es({ ...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 Is({ ...e, node: r });
|
|
611
611
|
case "feedback":
|
|
612
|
-
return
|
|
612
|
+
return Ss({ ...e, node: r });
|
|
613
613
|
default:
|
|
614
614
|
throw new Error(`Unknown node: ${JSON.stringify(r)}`);
|
|
615
615
|
}
|
|
616
616
|
}
|
|
617
|
-
async function
|
|
617
|
+
async function Ss({ next: e, node: r }) {
|
|
618
618
|
e(r.nextId);
|
|
619
619
|
}
|
|
620
|
-
async function
|
|
620
|
+
async function Is({ 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) {
|
|
@@ -625,147 +625,152 @@ async function Ss({ next: e, node: r, talentBankClient: t, submissions: n, flow:
|
|
|
625
625
|
if (r.data.scope === "company" || f != null)
|
|
626
626
|
try {
|
|
627
627
|
o = await t.checkDuplicate({ email: An({ key: r.data.email, submissions: n }).toString(), jobId: f, scope: r.data.scope });
|
|
628
|
-
} catch (
|
|
629
|
-
i.error("[check-duplicate]",
|
|
628
|
+
} catch (b) {
|
|
629
|
+
i.error("[check-duplicate]", b);
|
|
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 Es({ 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
|
|
645
|
-
let { waitMs: n, throttles: s, maintenance: i } =
|
|
644
|
+
var Fs = 5e3, Vs = (e, r, t) => {
|
|
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
|
-
},
|
|
647
|
+
}, Ms = ["ApiError", "NotFoundError", "UnauthorisedError", "SchemaValidationError", "ParsingError"], Zr = (e) => e instanceof Error && Ms.includes(e.name) ? e : void 0, cr = (e) => {
|
|
648
648
|
let r = Zr(e);
|
|
649
649
|
return (r == null ? void 0 : r.name) === "ApiError" ? r : void 0;
|
|
650
650
|
};
|
|
651
|
-
async function
|
|
652
|
-
var
|
|
653
|
-
|
|
654
|
-
|
|
655
|
-
|
|
656
|
-
|
|
657
|
-
|
|
658
|
-
|
|
659
|
-
|
|
660
|
-
|
|
661
|
-
|
|
651
|
+
async function Ls({ chat: e, next: r, end: t, node: n, logger: s, apiClient: i, submissions: a, analytics: o, flow: u, applicationRecovery: f, setApplicationRecovery: b, forceSubmitConfirmation: y, run: p, persistWriteBarrier: m, signal: k, onSubmitNetworkError: I, closedRoleBehaviour: C, t: x }) {
|
|
652
|
+
var R, W;
|
|
653
|
+
let v = async ({ redirect_url: j, message: O, button_text: z }) => {
|
|
654
|
+
let { anonymous_id: V, session_id: A } = o.getSessionInfo();
|
|
655
|
+
await e.sendMessage({ type: "text", author: "bot", text: O ?? x("submission_redirect_message") });
|
|
656
|
+
try {
|
|
657
|
+
let T = new URL(j);
|
|
658
|
+
V && !T.searchParams.has("anonymous_id") && T.searchParams.set("anonymous_id", V), await e.sendMessage({ type: "link", href: T.toString(), text: z ?? x("complete_submission"), onClick: () => {
|
|
659
|
+
if (!A) {
|
|
660
|
+
s.error("session_id not set, cannot log FLOW_REDIRECT event");
|
|
661
|
+
return;
|
|
662
|
+
}
|
|
663
|
+
o.log({ event: "FLOW_REDIRECT", properties: { flow_build: u.build, flow_id: u.id, flow_session_id: A, flow_version: u.version, href: T.toString(), job: u.job } });
|
|
664
|
+
} });
|
|
665
|
+
} catch (T) {
|
|
666
|
+
s.error(`Invalid redirect URL: ${j}`, T), e.sendMessage({ type: "system", variant: "error", text: x("redirect_url_error") });
|
|
667
|
+
}
|
|
668
|
+
};
|
|
669
|
+
if ((R = u.data.startedWriteNodeIds) != null && R.includes(n.id) && (f == null ? void 0 : f.submitNodeId) !== n.id) {
|
|
670
|
+
let j = (W = u.data.submitRedirects) == null ? void 0 : W[n.id];
|
|
671
|
+
return j ? (await v(j), r(n.nextId)) : (await e.sendMessage({ type: "system", variant: "warning", text: x("submission_unknown") }), t());
|
|
672
|
+
}
|
|
673
|
+
let E = u.job ? `${n.id}@${u.job.id_type}:${u.job.id}` : n.id, N = 0, M = p.submitAccepted && n.data.skipConfirmation === !0 && (f == null ? void 0 : f.submitNodeId) !== n.id, L = async (j) => {
|
|
674
|
+
var ft, et, ht, tt, rt, pt, mt, It;
|
|
675
|
+
let O = ((ft = u.data.submitCooldown) == null ? void 0 : ft.key) === E ? u.data.submitCooldown : void 0;
|
|
676
|
+
O && (O.until = Math.min(O.until, Date.now() + (O.maintenance ? Vn : O.throttles ? Pr : Mn)));
|
|
677
|
+
let z = O == null ? void 0 : O.until;
|
|
678
|
+
(u.data.reviewRequiresSend === !0 && !M || j !== !0 || z !== void 0 && z > Date.now()) && await e.userInput({ type: "submit", key: void 0, config: { label: n.data.submitLabel, ...z !== void 0 && { availableAt: z } } }), M = !1;
|
|
679
|
+
let V;
|
|
662
680
|
if (n.data.captcha) {
|
|
663
|
-
let D = e.captcha,
|
|
681
|
+
let D = e.captcha, l = !0;
|
|
664
682
|
try {
|
|
665
|
-
|
|
683
|
+
V = await ts(i, { signal: k, container: (D == null ? void 0 : D.container()) ?? null, theme: D == null ? void 0 : D.theme, onInteractive: () => {
|
|
666
684
|
e.sendMessage({ type: "text", author: "bot", text: x("captcha_check") }).catch(() => {
|
|
667
685
|
}).then(() => {
|
|
668
|
-
|
|
686
|
+
l && (D == null || D.reveal(!0));
|
|
669
687
|
});
|
|
670
688
|
} });
|
|
671
|
-
} catch (
|
|
672
|
-
if (s.error("Captcha check failed",
|
|
689
|
+
} catch (d) {
|
|
690
|
+
if (s.error("Captcha check failed", d), k.aborted)
|
|
673
691
|
return;
|
|
674
692
|
} finally {
|
|
675
|
-
|
|
693
|
+
l = !1, D == null || D.reveal(!1);
|
|
676
694
|
}
|
|
677
695
|
}
|
|
678
696
|
await e.sendMessage({ type: "loading", text: x("submitting") });
|
|
679
|
-
let { anonymous_id:
|
|
680
|
-
if (
|
|
697
|
+
let { anonymous_id: A, session_id: T } = o.getSessionInfo();
|
|
698
|
+
if (k.aborted)
|
|
681
699
|
return;
|
|
682
|
-
let
|
|
683
|
-
if ((f == null ? void 0 : f.submitNodeId) === n.id && await
|
|
700
|
+
let $ = ((et = u.data.startedWriteNodeIds) == null ? void 0 : et.includes(n.id)) === !0;
|
|
701
|
+
if ((f == null ? void 0 : f.submitNodeId) === n.id && await b(void 0), $ || (u.data.startedWriteNodeIds = [...u.data.startedWriteNodeIds ?? [], n.id]), await m().catch((D) => s.error("Failed to persist application write barrier", D)), k.aborted)
|
|
684
702
|
return;
|
|
685
|
-
let
|
|
686
|
-
|
|
703
|
+
let K, Z = setTimeout(() => {
|
|
704
|
+
K = (async () => {
|
|
687
705
|
await e.sendMessage({ type: "text", author: "bot", text: x("submission_still_working") }), await e.sendMessage({ type: "loading", text: x("submitting") });
|
|
688
706
|
})().catch((D) => s.error("Failed to send submission progress message", D));
|
|
689
|
-
},
|
|
690
|
-
|
|
691
|
-
let
|
|
692
|
-
return (
|
|
707
|
+
}, Fs), le, G = await i.fetch("/flow/submit", { method: "POST", body: JSON.stringify({ log_submit: !1, integration_id: n.data.integrationId, anonymous_id: A, session_id: T, job: u.job, flow_build: u.build, ...V !== void 0 && { captcha_token: V }, submissions: Ln(u.nodes, Nn(a || {}, n.data.submitKeys)), pre_apply: $r(u.nodes, a || {}, u.data.flowSessionId) }) }).catch((D) => {
|
|
708
|
+
le = D;
|
|
709
|
+
let l = cr(D);
|
|
710
|
+
return (l == null ? void 0 : l.data) !== void 0 ? l.data : D;
|
|
693
711
|
});
|
|
694
|
-
if (clearTimeout(
|
|
712
|
+
if (clearTimeout(Z), await K, k.aborted)
|
|
695
713
|
return;
|
|
696
|
-
if (
|
|
697
|
-
return await
|
|
698
|
-
n.data.key && e.setSubmission(n.data.key, { type: "integration", value:
|
|
699
|
-
let
|
|
700
|
-
|
|
701
|
-
let
|
|
702
|
-
|
|
703
|
-
let
|
|
704
|
-
if ((
|
|
705
|
-
let { redirect_url: D, message:
|
|
706
|
-
|
|
707
|
-
try {
|
|
708
|
-
let be = new URL(D);
|
|
709
|
-
G && !be.searchParams.has("anonymous_id") && be.searchParams.set("anonymous_id", G), await e.sendMessage({ type: "link", href: be.toString(), text: yt ?? x("complete_submission"), onClick: () => {
|
|
710
|
-
if (!M) {
|
|
711
|
-
s.error("session_id not set, cannot log FLOW_REDIRECT event");
|
|
712
|
-
return;
|
|
713
|
-
}
|
|
714
|
-
o.log({ event: "FLOW_REDIRECT", properties: { flow_build: u.build, flow_id: u.id, flow_session_id: M, flow_version: u.version, href: be.toString(), job: u.job } });
|
|
715
|
-
} });
|
|
716
|
-
} catch (be) {
|
|
717
|
-
s.error(`Invalid redirect URL: ${D}`, be), e.sendMessage({ type: "system", variant: "error", text: x("redirect_url_error") });
|
|
718
|
-
}
|
|
719
|
-
return r(n.nextId);
|
|
714
|
+
if (le !== void 0 && !Zr(le) && I)
|
|
715
|
+
return await I(le, k), L(!0);
|
|
716
|
+
n.data.key && e.setSubmission(n.data.key, { type: "integration", value: G });
|
|
717
|
+
let Ce = (ht = cr(le)) == null ? void 0 : ht.status, Qe = typeof Ce == "number" ? Ce : void 0, B = Br(G, Qe), Te = u.data.failedAttemptAt, Se = Te == null ? void 0 : Te[E];
|
|
718
|
+
Te && Se !== void 0 && Se > Date.now() && (Se = Te[E] = Date.now());
|
|
719
|
+
let ut = Se !== void 0 && Date.now() - Se < Rn || ((tt = u.data.unconfirmedAttemptKeys) == null ? void 0 : tt.includes(E)) === !0, Ie = Dn(G);
|
|
720
|
+
Ie && 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: Ie.service, response: Ie.response, flow_type: "CHATBOT_DRAWER", job: u.job, ...(B == null ? void 0 : B.outcome) === "duplicate" && { outcome: ut ? "duplicate_after_own_attempt" : "duplicate" }, ...Ie.outcome && { outcome: Ie.outcome } } });
|
|
721
|
+
let dt = rr(G) || (G == null ? void 0 : G.success) === !0;
|
|
722
|
+
if ((dt || nr(G)) && (p.submitAccepted = !0), dt && ((rt = u.data.submitCooldown) == null ? void 0 : rt.throttles) !== void 0 && (delete u.data.submitCooldown.throttles, await m().catch((D) => s.error("Failed to persist submit cooldown reset", D))), rr(G)) {
|
|
723
|
+
let { redirect_url: D, message: l, button_text: d } = G.integration_response.data, h = { redirect_url: D, message: l, button_text: d };
|
|
724
|
+
return k.aborted ? void 0 : (u.data.submitRedirects = { ...u.data.submitRedirects, [n.id]: h }, await m().catch((_) => s.error("Failed to persist submit redirect", _)), await v(h), r(n.nextId));
|
|
720
725
|
}
|
|
721
|
-
let
|
|
722
|
-
if (
|
|
723
|
-
return await e.sendMessage({ type: "system", variant: "success", text:
|
|
724
|
-
if ((
|
|
726
|
+
let Pe = nr(G);
|
|
727
|
+
if (Pe)
|
|
728
|
+
return await e.sendMessage({ type: "system", variant: "success", text: Pe.message ?? x("submission_pending") }), r(n.nextId);
|
|
729
|
+
if ((G == null ? void 0 : G.success) === !0)
|
|
725
730
|
return n.data.skipConfirmation !== !0 && await e.sendMessage({ type: "system", variant: "success", text: x("submission_completed") }), r(n.nextId);
|
|
726
|
-
let
|
|
727
|
-
if (!
|
|
728
|
-
if (s.error(
|
|
729
|
-
return e.setSubmission(
|
|
730
|
-
if (
|
|
731
|
-
return await e.sendMessage({ type: "system", variant: "info", text: x(
|
|
732
|
-
if (
|
|
733
|
-
return await e.sendMessage({ type: "system", variant: "info", text: x("submission_closed") }), C === "terminal" ? (delete u.data.submitCooldown, t()) :
|
|
734
|
-
let D =
|
|
735
|
-
return D ? (await e.sendMessage({ type: "system", variant: "warning", text: D.until === void 0 ? x("submission_provider_maintenance_later") : x("submission_provider_maintenance", { time: qr(D.until, void 0) }) }),
|
|
731
|
+
let qe = Tn(B), Ae = qe !== void 0 && ((pt = a == null ? void 0 : a[qe]) == null ? void 0 : pt.type) === "file" ? qe : void 0, Ee = Ae === void 0 ? void 0 : u.nodes.find((D) => D.type === "question-file" && D.data.key === Ae);
|
|
732
|
+
if (!Ee && !(C === "terminal" && (B == null ? void 0 : B.outcome) === "closed") && !sr(B) && (u.data.submitCooldown = Vs(E, O, B)), (B == null ? void 0 : B.outcome) !== "duplicate" && (u.data.failedAttemptAt = { ...u.data.failedAttemptAt, [E]: Date.now() }, (mt = u.data.unconfirmedAttemptKeys) != null && mt.includes(E) && (u.data.unconfirmedAttemptKeys = u.data.unconfirmedAttemptKeys.filter((D) => D !== E))), (B == null ? void 0 : B.verdict) === "not_submitted" || (B == null ? void 0 : B.outcome) === "duplicate" || (B == null ? void 0 : B.outcome) === "closed" || On(G, Qe) ? ($ || (u.data.startedWriteNodeIds = (It = u.data.startedWriteNodeIds) == null ? void 0 : It.filter((D) => D !== n.id)), (f == null ? void 0 : f.submitNodeId) === n.id && await b(f), await m().catch((D) => s.error("Failed to persist application write barrier release", D))) : await m().catch((D) => s.error("Failed to persist submit cooldown", D)), B) {
|
|
733
|
+
if (s.error(le ?? B.message), Ee && Ae !== void 0)
|
|
734
|
+
return e.setSubmission(Ae, null), await b({ fileQuestionNodeId: Ee.id, submitNodeId: n.id }), await e.sendMessage({ type: "system", variant: "error", text: x("submission_unreadable_document") }), r(Ee.id);
|
|
735
|
+
if (B.outcome === "duplicate")
|
|
736
|
+
return await e.sendMessage({ type: "system", variant: "info", text: x(ut ? "submission_duplicate_earlier_attempt" : "submission_duplicate") }), L(!1);
|
|
737
|
+
if (B.outcome === "closed")
|
|
738
|
+
return await e.sendMessage({ type: "system", variant: "info", text: x("submission_closed") }), C === "terminal" ? (delete u.data.submitCooldown, t()) : L(!1);
|
|
739
|
+
let D = Bn(B);
|
|
740
|
+
return D ? (await e.sendMessage({ type: "system", variant: "warning", text: D.until === void 0 ? x("submission_provider_maintenance_later") : x("submission_provider_maintenance", { time: qr(D.until, void 0) }) }), L(!1)) : B.outcome === "unknown" ? (await e.sendMessage({ type: "system", variant: "warning", text: x(jn(B) ? "submission_unknown_do_not_resubmit" : "submission_unknown") }), L(!1)) : sr(B) ? $n(G) ? (await e.sendMessage({ type: "text", author: "bot", text: B.message }), L(!1)) : (N === 0 && await e.sendMessage({ type: "system", variant: "warning", text: x("captcha_failed") }), N++, L(N <= _s)) : Pn(B) ? (await e.sendMessage({ type: "system", variant: "error", text: x("submission_retryable") }), L(!1)) : (await e.sendMessage({ type: "system", variant: "error", text: x("submission_failed") }), t());
|
|
736
741
|
}
|
|
737
|
-
return s.error(
|
|
742
|
+
return s.error(le ?? G), await e.sendMessage({ type: "system", variant: "error", text: x("submission_failed") }), t();
|
|
738
743
|
};
|
|
739
|
-
await
|
|
744
|
+
await L(y === !0 && !M ? !1 : n.data.skipConfirmation);
|
|
740
745
|
}
|
|
741
|
-
async function
|
|
746
|
+
async function Ns({ chat: e, next: r, node: t, submissions: n, context: s }) {
|
|
742
747
|
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);
|
|
743
748
|
}
|
|
744
|
-
async function
|
|
745
|
-
r(
|
|
749
|
+
async function Rs({ submissions: e, next: r, node: t, context: n }) {
|
|
750
|
+
r(xs(t, { submissions: e, context: n }) ? t.branchId : t.nextId);
|
|
746
751
|
}
|
|
747
|
-
async function
|
|
752
|
+
async function Ds({ chat: e, next: r, node: t, submissions: n, context: s }) {
|
|
748
753
|
await e.sendMessage({ author: "bot", type: "text", text: he(t.data.text, { submissions: n, context: s }) }), r(t.nextId);
|
|
749
754
|
}
|
|
750
|
-
async function
|
|
755
|
+
async function Ts({ chat: e, next: r, node: t }) {
|
|
751
756
|
await e.sendMessage({ author: "bot", type: "image", url: t.data.url, height: t.data.height, width: t.data.width }), r(t.nextId);
|
|
752
757
|
}
|
|
753
|
-
async function
|
|
758
|
+
async function Os({ chat: e, next: r, node: t, submissions: n, context: s, t: i, dateEchoLocale: a }) {
|
|
754
759
|
await e.sendMessage({ author: "bot", type: "text", text: he(t.data.question, { submissions: n, context: s }) });
|
|
755
760
|
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 } });
|
|
756
|
-
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" ?
|
|
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 ? En(o.value, a) : o.value }), r(t.nextId);
|
|
757
762
|
}
|
|
758
|
-
async function
|
|
763
|
+
async function Bs({ chat: e, next: r, node: t, submissions: n, context: s, t: i }) {
|
|
759
764
|
await e.sendMessage({ author: "bot", type: "text", text: he(t.data.question, { submissions: n, context: s }) });
|
|
760
765
|
let a = await e.userInput({ key: t.data.key, type: "number", config: { max: t.data.max, min: t.data.min, optional: t.data.optional, placeholder: t.data.placeholder, decimalCases: t.data.decimalCases } });
|
|
761
766
|
a === null ? await e.sendMessage({ type: "system", variant: "info", semantic: "question-skipped", text: i("skipped") }) : await e.sendMessage({ author: "user", type: "text", text: a.value.toString() }), r(t.nextId);
|
|
762
767
|
}
|
|
763
|
-
async function
|
|
768
|
+
async function js({ chat: e, next: r, node: t, submissions: n, context: s, t: i }) {
|
|
764
769
|
await e.sendMessage({ author: "bot", type: "text", text: he(t.data.question, { submissions: n, context: s }) });
|
|
765
770
|
let a = await e.userInput({ key: t.data.key, type: "phone", config: { minChars: t.data.minChars, defaultValue: { countryCode: t.data.defaultCountryCode }, placeholder: t.data.placeholder, submissionFormat: "phone", optional: t.data.optional } });
|
|
766
|
-
a === null ? await e.sendMessage({ type: "system", variant: "info", semantic: "question-skipped", text: i("skipped") }) : await e.sendMessage({ author: "user", type: "text", text: a.type === "phone" ?
|
|
771
|
+
a === null ? await e.sendMessage({ type: "system", variant: "info", semantic: "question-skipped", text: i("skipped") }) : await e.sendMessage({ author: "user", type: "text", text: a.type === "phone" ? vt(a.value) : a.value }), r(t.nextId);
|
|
767
772
|
}
|
|
768
|
-
async function
|
|
773
|
+
async function $s({ chat: e, next: r, node: t, submissions: n, context: s, t: i }) {
|
|
769
774
|
await e.sendMessage({ author: "bot", type: "text", text: he(t.data.question, { submissions: n, context: s }) });
|
|
770
775
|
let a = await e.userInput({ key: t.data.key, type: "multiple-choice", config: t.data });
|
|
771
776
|
a.value.length === 0 ? await e.sendMessage({ type: "system", variant: "info", semantic: "question-skipped", text: i("skipped") }) : await e.sendMessage({ author: "user", type: "text", text: t.data.options.filter((o) => a.value.includes(o.value)).map((o) => o.label).join(", ") }), r(t.nextId);
|
|
@@ -775,7 +780,7 @@ async function Ps({ chat: e, next: r, node: t, submissions: n, context: s, t: i
|
|
|
775
780
|
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 } } });
|
|
776
781
|
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);
|
|
777
782
|
}
|
|
778
|
-
async function
|
|
783
|
+
async function qs({ chat: e, next: r, node: t, t: n }) {
|
|
779
784
|
await e.sendMessage({ author: "bot", type: "text", text: t.data.question });
|
|
780
785
|
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 } });
|
|
781
786
|
if (s === null)
|
|
@@ -786,7 +791,7 @@ async function $s({ chat: e, next: r, node: t, t: n }) {
|
|
|
786
791
|
}
|
|
787
792
|
return r(t.nextId);
|
|
788
793
|
}
|
|
789
|
-
async function
|
|
794
|
+
async function Us({ node: e, chat: r, next: t, submissions: n, context: s, t: i }) {
|
|
790
795
|
await r.sendMessage({ author: "bot", type: "text", text: he(e.data.question, { submissions: n, context: s }) });
|
|
791
796
|
let a = await r.userInput({ key: e.data.key, type: "file", config: { optional: e.data.optional, extensions: e.data.extensions, fileSizeLimitKib: e.data.maxSizeKb ?? 10 * 1024, allowMultiple: e.data.multiple === !0 } });
|
|
792
797
|
if (a === null)
|
|
@@ -796,17 +801,17 @@ async function qs({ node: e, chat: r, next: t, submissions: n, context: s, t: i
|
|
|
796
801
|
await r.sendMessage({ author: "user", type: "file", fileName: o.name, fileSizeKb: o.sizeKb });
|
|
797
802
|
return t(e.nextId);
|
|
798
803
|
}
|
|
799
|
-
async function
|
|
804
|
+
async function Ws({ chat: e, end: r, node: t }) {
|
|
800
805
|
await e.sendMessage({ type: "system", variant: "info", text: t.data.systemMessage }), r();
|
|
801
806
|
}
|
|
802
|
-
async function
|
|
803
|
-
let f = Fn(r.nodes, t || {}), { answers:
|
|
804
|
-
if (n.setSubmission(e.data.key, { type: "integration", value: y }),
|
|
807
|
+
async function zs({ 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: b, ...y } = f;
|
|
809
|
+
if (n.setSubmission(e.data.key, { type: "integration", value: y }), vs(r, i, { ...a.getSessionInfo(), job: r.job, flow_build: r.build, pre_apply: $r(r.nodes, t || {}, r.data.flowSessionId) }, o), f.status !== "skipped") {
|
|
805
810
|
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];
|
|
806
811
|
for (let m of ["hard", "advisory"]) {
|
|
807
|
-
let
|
|
808
|
-
|
|
809
|
-
` +
|
|
812
|
+
let k = b.filter((I) => !I.matched && I.severity === m);
|
|
813
|
+
k.length && p.push((m === "hard" ? "Role requirements" : "Other things to consider") + `
|
|
814
|
+
` + k.map((I) => `• ${I.message}`).join(`
|
|
810
815
|
`));
|
|
811
816
|
}
|
|
812
817
|
await n.sendMessage({ type: "text", author: "bot", text: p.join(`
|
|
@@ -829,7 +834,7 @@ const ur = (e, r, t) => {
|
|
|
829
834
|
},
|
|
830
835
|
customProperties: (n = r.analytics) == null ? void 0 : n.customProperties
|
|
831
836
|
});
|
|
832
|
-
}, jt = "resume-prompt",
|
|
837
|
+
}, jt = "resume-prompt", Hs = async ({
|
|
833
838
|
chatService: e,
|
|
834
839
|
t: r,
|
|
835
840
|
signal: t
|
|
@@ -857,16 +862,16 @@ const ur = (e, r, t) => {
|
|
|
857
862
|
},
|
|
858
863
|
signal: t
|
|
859
864
|
});
|
|
860
|
-
return
|
|
861
|
-
},
|
|
865
|
+
return U.removeMessagesSentByNodeIds([jt]), (n == null ? void 0 : n.value) !== !1;
|
|
866
|
+
}, $e = ({
|
|
862
867
|
class: e,
|
|
863
868
|
...r
|
|
864
869
|
}) => {
|
|
865
870
|
const {
|
|
866
871
|
t
|
|
867
|
-
} =
|
|
872
|
+
} = re();
|
|
868
873
|
return c("button", {
|
|
869
|
-
class:
|
|
874
|
+
class: Ze("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),
|
|
870
875
|
type: "submit",
|
|
871
876
|
...r,
|
|
872
877
|
children: c("svg", {
|
|
@@ -888,40 +893,40 @@ const ur = (e, r, t) => {
|
|
|
888
893
|
})
|
|
889
894
|
});
|
|
890
895
|
};
|
|
891
|
-
var
|
|
896
|
+
var ge;
|
|
892
897
|
// @__NO_SIDE_EFFECTS__
|
|
893
|
-
function
|
|
898
|
+
function wt(e) {
|
|
894
899
|
return {
|
|
895
|
-
lang: (e == null ? void 0 : e.lang) ?? (
|
|
900
|
+
lang: (e == null ? void 0 : e.lang) ?? (ge == null ? void 0 : ge.lang),
|
|
896
901
|
message: e == null ? void 0 : e.message,
|
|
897
|
-
abortEarly: (e == null ? void 0 : e.abortEarly) ?? (
|
|
898
|
-
abortPipeEarly: (e == null ? void 0 : e.abortPipeEarly) ?? (
|
|
902
|
+
abortEarly: (e == null ? void 0 : e.abortEarly) ?? (ge == null ? void 0 : ge.abortEarly),
|
|
903
|
+
abortPipeEarly: (e == null ? void 0 : e.abortPipeEarly) ?? (ge == null ? void 0 : ge.abortPipeEarly)
|
|
899
904
|
};
|
|
900
905
|
}
|
|
901
906
|
var Mt;
|
|
902
907
|
// @__NO_SIDE_EFFECTS__
|
|
903
|
-
function
|
|
908
|
+
function Ks(e) {
|
|
904
909
|
return Mt == null ? void 0 : Mt.get(e);
|
|
905
910
|
}
|
|
906
911
|
var Lt;
|
|
907
912
|
// @__NO_SIDE_EFFECTS__
|
|
908
|
-
function
|
|
913
|
+
function Gs(e) {
|
|
909
914
|
return Lt == null ? void 0 : Lt.get(e);
|
|
910
915
|
}
|
|
911
|
-
var
|
|
916
|
+
var Nt;
|
|
912
917
|
// @__NO_SIDE_EFFECTS__
|
|
913
|
-
function
|
|
918
|
+
function Js(e, r) {
|
|
914
919
|
var t;
|
|
915
|
-
return (t =
|
|
920
|
+
return (t = Nt == null ? void 0 : Nt.get(e)) == null ? void 0 : t.get(r);
|
|
916
921
|
}
|
|
917
922
|
// @__NO_SIDE_EFFECTS__
|
|
918
|
-
function
|
|
923
|
+
function Ge(e) {
|
|
919
924
|
var t, n;
|
|
920
925
|
const r = typeof e;
|
|
921
926
|
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;
|
|
922
927
|
}
|
|
923
|
-
function
|
|
924
|
-
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__ */
|
|
928
|
+
function te(e, r, t, n, s) {
|
|
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__ */ Ge(i), u = {
|
|
925
930
|
kind: e.kind,
|
|
926
931
|
type: e.type,
|
|
927
932
|
input: i,
|
|
@@ -934,33 +939,33 @@ function ee(e, r, t, n, s) {
|
|
|
934
939
|
lang: n.lang,
|
|
935
940
|
abortEarly: n.abortEarly,
|
|
936
941
|
abortPipeEarly: n.abortPipeEarly
|
|
937
|
-
}, f = e.kind === "schema",
|
|
938
|
-
|
|
942
|
+
}, f = e.kind === "schema", b = (s == null ? void 0 : s.message) ?? e.message ?? /* @__PURE__ */ Js(e.reference, u.lang) ?? (f ? /* @__PURE__ */ Gs(u.lang) : null) ?? n.message ?? /* @__PURE__ */ Ks(u.lang);
|
|
943
|
+
b !== void 0 && (u.message = typeof b == "function" ? (
|
|
939
944
|
// @ts-expect-error
|
|
940
|
-
|
|
941
|
-
) :
|
|
945
|
+
b(u)
|
|
946
|
+
) : b), f && (t.typed = !1), t.issues ? t.issues.push(u) : t.issues = [u];
|
|
942
947
|
}
|
|
943
948
|
// @__NO_SIDE_EFFECTS__
|
|
944
|
-
function
|
|
949
|
+
function be(e) {
|
|
945
950
|
return {
|
|
946
951
|
version: 1,
|
|
947
952
|
vendor: "valibot",
|
|
948
953
|
validate(r) {
|
|
949
|
-
return e["~run"]({ value: r }, /* @__PURE__ */
|
|
954
|
+
return e["~run"]({ value: r }, /* @__PURE__ */ wt());
|
|
950
955
|
}
|
|
951
956
|
};
|
|
952
957
|
}
|
|
953
958
|
// @__NO_SIDE_EFFECTS__
|
|
954
|
-
function
|
|
959
|
+
function Zs(e, r) {
|
|
955
960
|
return Object.hasOwn(e, r) && r !== "__proto__" && r !== "prototype" && r !== "constructor";
|
|
956
961
|
}
|
|
957
962
|
// @__NO_SIDE_EFFECTS__
|
|
958
|
-
function
|
|
963
|
+
function Xs(e, r) {
|
|
959
964
|
const t = [...new Set(e)];
|
|
960
965
|
return t.length > 1 ? `(${t.join(` ${r} `)})` : t[0] ?? "never";
|
|
961
966
|
}
|
|
962
967
|
// @__NO_SIDE_EFFECTS__
|
|
963
|
-
function
|
|
968
|
+
function Ys(e) {
|
|
964
969
|
if (e.path) {
|
|
965
970
|
let r = "";
|
|
966
971
|
for (const t of e.path)
|
|
@@ -972,7 +977,7 @@ function Xs(e) {
|
|
|
972
977
|
}
|
|
973
978
|
return null;
|
|
974
979
|
}
|
|
975
|
-
var
|
|
980
|
+
var Qs = class extends Error {
|
|
976
981
|
/**
|
|
977
982
|
* Creates a Valibot error with useful information.
|
|
978
983
|
*
|
|
@@ -981,7 +986,7 @@ var Ys = class extends Error {
|
|
|
981
986
|
constructor(e) {
|
|
982
987
|
super(e[0].message), this.name = "ValiError", this.issues = e;
|
|
983
988
|
}
|
|
984
|
-
},
|
|
989
|
+
}, ea = /^[\w+-]+(?:\.[\w+-]+)*@[\da-z]+(?:[.-][\da-z]+)*\.[a-z]{2,}$/iu;
|
|
985
990
|
// @__NO_SIDE_EFFECTS__
|
|
986
991
|
function Xr(e, r) {
|
|
987
992
|
return {
|
|
@@ -993,7 +998,7 @@ function Xr(e, r) {
|
|
|
993
998
|
requirement: e,
|
|
994
999
|
message: r,
|
|
995
1000
|
"~run"(t, n) {
|
|
996
|
-
return t.typed && !this.requirement(t.value) &&
|
|
1001
|
+
return t.typed && !this.requirement(t.value) && te(this, "input", t, n), t;
|
|
997
1002
|
}
|
|
998
1003
|
};
|
|
999
1004
|
}
|
|
@@ -1005,25 +1010,25 @@ function Yr(e) {
|
|
|
1005
1010
|
reference: Yr,
|
|
1006
1011
|
expects: null,
|
|
1007
1012
|
async: !1,
|
|
1008
|
-
requirement:
|
|
1013
|
+
requirement: ea,
|
|
1009
1014
|
message: e,
|
|
1010
1015
|
"~run"(r, t) {
|
|
1011
|
-
return r.typed && !this.requirement.test(r.value) &&
|
|
1016
|
+
return r.typed && !this.requirement.test(r.value) && te(this, "email", r, t), r;
|
|
1012
1017
|
}
|
|
1013
1018
|
};
|
|
1014
1019
|
}
|
|
1015
1020
|
// @__NO_SIDE_EFFECTS__
|
|
1016
|
-
function
|
|
1021
|
+
function it(e, r) {
|
|
1017
1022
|
return {
|
|
1018
1023
|
kind: "validation",
|
|
1019
1024
|
type: "max_length",
|
|
1020
|
-
reference:
|
|
1025
|
+
reference: it,
|
|
1021
1026
|
async: !1,
|
|
1022
1027
|
expects: `<=${e}`,
|
|
1023
1028
|
requirement: e,
|
|
1024
1029
|
message: r,
|
|
1025
1030
|
"~run"(t, n) {
|
|
1026
|
-
return t.typed && t.value.length > this.requirement &&
|
|
1031
|
+
return t.typed && t.value.length > this.requirement && te(this, "length", t, n, {
|
|
1027
1032
|
received: `${t.value.length}`
|
|
1028
1033
|
}), t;
|
|
1029
1034
|
}
|
|
@@ -1036,28 +1041,28 @@ function Qr(e, r) {
|
|
|
1036
1041
|
type: "max_value",
|
|
1037
1042
|
reference: Qr,
|
|
1038
1043
|
async: !1,
|
|
1039
|
-
expects: `<=${e instanceof Date ? e.toJSON() : /* @__PURE__ */
|
|
1044
|
+
expects: `<=${e instanceof Date ? e.toJSON() : /* @__PURE__ */ Ge(e)}`,
|
|
1040
1045
|
requirement: e,
|
|
1041
1046
|
message: r,
|
|
1042
1047
|
"~run"(t, n) {
|
|
1043
|
-
return t.typed && !(t.value <= this.requirement) &&
|
|
1044
|
-
received: t.value instanceof Date ? t.value.toJSON() : /* @__PURE__ */
|
|
1048
|
+
return t.typed && !(t.value <= this.requirement) && te(this, "value", t, n, {
|
|
1049
|
+
received: t.value instanceof Date ? t.value.toJSON() : /* @__PURE__ */ Ge(t.value)
|
|
1045
1050
|
}), t;
|
|
1046
1051
|
}
|
|
1047
1052
|
};
|
|
1048
1053
|
}
|
|
1049
1054
|
// @__NO_SIDE_EFFECTS__
|
|
1050
|
-
function
|
|
1055
|
+
function Ke(e, r) {
|
|
1051
1056
|
return {
|
|
1052
1057
|
kind: "validation",
|
|
1053
1058
|
type: "min_length",
|
|
1054
|
-
reference:
|
|
1059
|
+
reference: Ke,
|
|
1055
1060
|
async: !1,
|
|
1056
1061
|
expects: `>=${e}`,
|
|
1057
1062
|
requirement: e,
|
|
1058
1063
|
message: r,
|
|
1059
1064
|
"~run"(t, n) {
|
|
1060
|
-
return t.typed && t.value.length < this.requirement &&
|
|
1065
|
+
return t.typed && t.value.length < this.requirement && te(this, "length", t, n, {
|
|
1061
1066
|
received: `${t.value.length}`
|
|
1062
1067
|
}), t;
|
|
1063
1068
|
}
|
|
@@ -1070,12 +1075,12 @@ function en(e, r) {
|
|
|
1070
1075
|
type: "min_value",
|
|
1071
1076
|
reference: en,
|
|
1072
1077
|
async: !1,
|
|
1073
|
-
expects: `>=${e instanceof Date ? e.toJSON() : /* @__PURE__ */
|
|
1078
|
+
expects: `>=${e instanceof Date ? e.toJSON() : /* @__PURE__ */ Ge(e)}`,
|
|
1074
1079
|
requirement: e,
|
|
1075
1080
|
message: r,
|
|
1076
1081
|
"~run"(t, n) {
|
|
1077
|
-
return t.typed && !(t.value >= this.requirement) &&
|
|
1078
|
-
received: t.value instanceof Date ? t.value.toJSON() : /* @__PURE__ */
|
|
1082
|
+
return t.typed && !(t.value >= this.requirement) && te(this, "value", t, n, {
|
|
1083
|
+
received: t.value instanceof Date ? t.value.toJSON() : /* @__PURE__ */ Ge(t.value)
|
|
1079
1084
|
}), t;
|
|
1080
1085
|
}
|
|
1081
1086
|
};
|
|
@@ -1091,7 +1096,7 @@ function zt(e, r) {
|
|
|
1091
1096
|
requirement: e,
|
|
1092
1097
|
message: r,
|
|
1093
1098
|
"~run"(t, n) {
|
|
1094
|
-
return t.typed && !this.requirement.test(t.value) &&
|
|
1099
|
+
return t.typed && !this.requirement.test(t.value) && te(this, "format", t, n), t;
|
|
1095
1100
|
}
|
|
1096
1101
|
};
|
|
1097
1102
|
}
|
|
@@ -1125,12 +1130,12 @@ function tn(e) {
|
|
|
1125
1130
|
},
|
|
1126
1131
|
message: e,
|
|
1127
1132
|
"~run"(r, t) {
|
|
1128
|
-
return r.typed && !this.requirement(r.value) &&
|
|
1133
|
+
return r.typed && !this.requirement(r.value) && te(this, "URL", r, t), r;
|
|
1129
1134
|
}
|
|
1130
1135
|
};
|
|
1131
1136
|
}
|
|
1132
1137
|
// @__NO_SIDE_EFFECTS__
|
|
1133
|
-
function
|
|
1138
|
+
function ta(e, r, t) {
|
|
1134
1139
|
return typeof e.fallback == "function" ? (
|
|
1135
1140
|
// @ts-expect-error
|
|
1136
1141
|
e.fallback(r, t)
|
|
@@ -1160,7 +1165,7 @@ function nn(e, r) {
|
|
|
1160
1165
|
item: e,
|
|
1161
1166
|
message: r,
|
|
1162
1167
|
get "~standard"() {
|
|
1163
|
-
return /* @__PURE__ */
|
|
1168
|
+
return /* @__PURE__ */ be(this);
|
|
1164
1169
|
},
|
|
1165
1170
|
"~run"(t, n) {
|
|
1166
1171
|
var i;
|
|
@@ -1177,8 +1182,8 @@ function nn(e, r) {
|
|
|
1177
1182
|
key: a,
|
|
1178
1183
|
value: o
|
|
1179
1184
|
};
|
|
1180
|
-
for (const
|
|
1181
|
-
|
|
1185
|
+
for (const b of u.issues)
|
|
1186
|
+
b.path ? b.path.unshift(f) : b.path = [f], (i = t.issues) == null || i.push(b);
|
|
1182
1187
|
if (t.issues || (t.issues = u.issues), n.abortEarly) {
|
|
1183
1188
|
t.typed = !1;
|
|
1184
1189
|
break;
|
|
@@ -1187,7 +1192,7 @@ function nn(e, r) {
|
|
|
1187
1192
|
u.typed || (t.typed = !1), t.value.push(u.value);
|
|
1188
1193
|
}
|
|
1189
1194
|
} else
|
|
1190
|
-
|
|
1195
|
+
te(this, "type", t, n);
|
|
1191
1196
|
return t;
|
|
1192
1197
|
}
|
|
1193
1198
|
};
|
|
@@ -1202,10 +1207,10 @@ function sn(e) {
|
|
|
1202
1207
|
async: !1,
|
|
1203
1208
|
message: e,
|
|
1204
1209
|
get "~standard"() {
|
|
1205
|
-
return /* @__PURE__ */
|
|
1210
|
+
return /* @__PURE__ */ be(this);
|
|
1206
1211
|
},
|
|
1207
1212
|
"~run"(r, t) {
|
|
1208
|
-
return typeof r.value == "boolean" ? r.typed = !0 :
|
|
1213
|
+
return typeof r.value == "boolean" ? r.typed = !0 : te(this, "type", r, t), r;
|
|
1209
1214
|
}
|
|
1210
1215
|
};
|
|
1211
1216
|
}
|
|
@@ -1219,25 +1224,25 @@ function an(e) {
|
|
|
1219
1224
|
async: !1,
|
|
1220
1225
|
message: e,
|
|
1221
1226
|
get "~standard"() {
|
|
1222
|
-
return /* @__PURE__ */
|
|
1227
|
+
return /* @__PURE__ */ be(this);
|
|
1223
1228
|
},
|
|
1224
1229
|
"~run"(r, t) {
|
|
1225
|
-
return typeof r.value == "number" && !isNaN(r.value) ? r.typed = !0 :
|
|
1230
|
+
return typeof r.value == "number" && !isNaN(r.value) ? r.typed = !0 : te(this, "type", r, t), r;
|
|
1226
1231
|
}
|
|
1227
1232
|
};
|
|
1228
1233
|
}
|
|
1229
1234
|
// @__NO_SIDE_EFFECTS__
|
|
1230
|
-
function
|
|
1235
|
+
function _e(e, r) {
|
|
1231
1236
|
return {
|
|
1232
1237
|
kind: "schema",
|
|
1233
1238
|
type: "object",
|
|
1234
|
-
reference:
|
|
1239
|
+
reference: _e,
|
|
1235
1240
|
expects: "Object",
|
|
1236
1241
|
async: !1,
|
|
1237
1242
|
entries: e,
|
|
1238
1243
|
message: r,
|
|
1239
1244
|
get "~standard"() {
|
|
1240
|
-
return /* @__PURE__ */
|
|
1245
|
+
return /* @__PURE__ */ be(this);
|
|
1241
1246
|
},
|
|
1242
1247
|
"~run"(t, n) {
|
|
1243
1248
|
var i;
|
|
@@ -1253,7 +1258,7 @@ function ke(e, r) {
|
|
|
1253
1258
|
s[a]
|
|
1254
1259
|
) : /* @__PURE__ */ rn(o), f = o["~run"]({ value: u }, n);
|
|
1255
1260
|
if (f.issues) {
|
|
1256
|
-
const
|
|
1261
|
+
const b = {
|
|
1257
1262
|
type: "object",
|
|
1258
1263
|
origin: "value",
|
|
1259
1264
|
input: s,
|
|
@@ -1261,7 +1266,7 @@ function ke(e, r) {
|
|
|
1261
1266
|
value: u
|
|
1262
1267
|
};
|
|
1263
1268
|
for (const y of f.issues)
|
|
1264
|
-
y.path ? y.path.unshift(
|
|
1269
|
+
y.path ? y.path.unshift(b) : y.path = [b], (i = t.issues) == null || i.push(y);
|
|
1265
1270
|
if (t.issues || (t.issues = f.issues), n.abortEarly) {
|
|
1266
1271
|
t.typed = !1;
|
|
1267
1272
|
break;
|
|
@@ -1269,8 +1274,8 @@ function ke(e, r) {
|
|
|
1269
1274
|
}
|
|
1270
1275
|
f.typed || (t.typed = !1), t.value[a] = f.value;
|
|
1271
1276
|
} else if (o.fallback !== void 0)
|
|
1272
|
-
t.value[a] = /* @__PURE__ */
|
|
1273
|
-
else if (o.type !== "exact_optional" && o.type !== "optional" && o.type !== "nullish" && (
|
|
1277
|
+
t.value[a] = /* @__PURE__ */ ta(o);
|
|
1278
|
+
else if (o.type !== "exact_optional" && o.type !== "optional" && o.type !== "nullish" && (te(this, "key", t, n, {
|
|
1274
1279
|
input: void 0,
|
|
1275
1280
|
expected: `"${a}"`,
|
|
1276
1281
|
path: [
|
|
@@ -1287,23 +1292,23 @@ function ke(e, r) {
|
|
|
1287
1292
|
break;
|
|
1288
1293
|
}
|
|
1289
1294
|
} else
|
|
1290
|
-
|
|
1295
|
+
te(this, "type", t, n);
|
|
1291
1296
|
return t;
|
|
1292
1297
|
}
|
|
1293
1298
|
};
|
|
1294
1299
|
}
|
|
1295
1300
|
// @__NO_SIDE_EFFECTS__
|
|
1296
|
-
function
|
|
1301
|
+
function He(e, r) {
|
|
1297
1302
|
return {
|
|
1298
1303
|
kind: "schema",
|
|
1299
1304
|
type: "optional",
|
|
1300
|
-
reference:
|
|
1305
|
+
reference: He,
|
|
1301
1306
|
expects: `(${e.expects} | undefined)`,
|
|
1302
1307
|
async: !1,
|
|
1303
1308
|
wrapped: e,
|
|
1304
1309
|
default: r,
|
|
1305
1310
|
get "~standard"() {
|
|
1306
|
-
return /* @__PURE__ */
|
|
1311
|
+
return /* @__PURE__ */ be(this);
|
|
1307
1312
|
},
|
|
1308
1313
|
"~run"(t, n) {
|
|
1309
1314
|
return t.value === void 0 && (this.default !== void 0 && (t.value = /* @__PURE__ */ rn(this, t, n)), t.value === void 0) ? (t.typed = !0, t) : this.wrapped["~run"](t, n);
|
|
@@ -1316,15 +1321,15 @@ function on(e, r) {
|
|
|
1316
1321
|
kind: "schema",
|
|
1317
1322
|
type: "picklist",
|
|
1318
1323
|
reference: on,
|
|
1319
|
-
expects: /* @__PURE__ */
|
|
1324
|
+
expects: /* @__PURE__ */ Xs(e.map(Ge), "|"),
|
|
1320
1325
|
async: !1,
|
|
1321
1326
|
options: e,
|
|
1322
1327
|
message: r,
|
|
1323
1328
|
get "~standard"() {
|
|
1324
|
-
return /* @__PURE__ */
|
|
1329
|
+
return /* @__PURE__ */ be(this);
|
|
1325
1330
|
},
|
|
1326
1331
|
"~run"(t, n) {
|
|
1327
|
-
return this.options.includes(t.value) ? t.typed = !0 :
|
|
1332
|
+
return this.options.includes(t.value) ? t.typed = !0 : te(this, "type", t, n), t;
|
|
1328
1333
|
}
|
|
1329
1334
|
};
|
|
1330
1335
|
}
|
|
@@ -1340,7 +1345,7 @@ function ln(e, r, t) {
|
|
|
1340
1345
|
value: r,
|
|
1341
1346
|
message: t,
|
|
1342
1347
|
get "~standard"() {
|
|
1343
|
-
return /* @__PURE__ */
|
|
1348
|
+
return /* @__PURE__ */ be(this);
|
|
1344
1349
|
},
|
|
1345
1350
|
"~run"(n, s) {
|
|
1346
1351
|
var a, o;
|
|
@@ -1348,9 +1353,9 @@ function ln(e, r, t) {
|
|
|
1348
1353
|
if (i && typeof i == "object") {
|
|
1349
1354
|
n.typed = !0, n.value = {};
|
|
1350
1355
|
for (const u in i)
|
|
1351
|
-
if (/* @__PURE__ */
|
|
1352
|
-
const f = i[u],
|
|
1353
|
-
if (
|
|
1356
|
+
if (/* @__PURE__ */ Zs(i, u)) {
|
|
1357
|
+
const f = i[u], b = this.key["~run"]({ value: u }, s);
|
|
1358
|
+
if (b.issues) {
|
|
1354
1359
|
const p = {
|
|
1355
1360
|
type: "object",
|
|
1356
1361
|
origin: "key",
|
|
@@ -1358,9 +1363,9 @@ function ln(e, r, t) {
|
|
|
1358
1363
|
key: u,
|
|
1359
1364
|
value: f
|
|
1360
1365
|
};
|
|
1361
|
-
for (const m of
|
|
1366
|
+
for (const m of b.issues)
|
|
1362
1367
|
m.path = [p], (a = n.issues) == null || a.push(m);
|
|
1363
|
-
if (n.issues || (n.issues =
|
|
1368
|
+
if (n.issues || (n.issues = b.issues), s.abortEarly) {
|
|
1364
1369
|
n.typed = !1;
|
|
1365
1370
|
break;
|
|
1366
1371
|
}
|
|
@@ -1384,57 +1389,57 @@ function ln(e, r, t) {
|
|
|
1384
1389
|
break;
|
|
1385
1390
|
}
|
|
1386
1391
|
}
|
|
1387
|
-
(!
|
|
1392
|
+
(!b.typed || !y.typed) && (n.typed = !1), b.typed && (n.value[b.value] = y.value);
|
|
1388
1393
|
}
|
|
1389
1394
|
} else
|
|
1390
|
-
|
|
1395
|
+
te(this, "type", n, s);
|
|
1391
1396
|
return n;
|
|
1392
1397
|
}
|
|
1393
1398
|
};
|
|
1394
1399
|
}
|
|
1395
1400
|
// @__NO_SIDE_EFFECTS__
|
|
1396
|
-
function
|
|
1401
|
+
function oe(e) {
|
|
1397
1402
|
return {
|
|
1398
1403
|
kind: "schema",
|
|
1399
1404
|
type: "string",
|
|
1400
|
-
reference:
|
|
1405
|
+
reference: oe,
|
|
1401
1406
|
expects: "string",
|
|
1402
1407
|
async: !1,
|
|
1403
1408
|
message: e,
|
|
1404
1409
|
get "~standard"() {
|
|
1405
|
-
return /* @__PURE__ */
|
|
1410
|
+
return /* @__PURE__ */ be(this);
|
|
1406
1411
|
},
|
|
1407
1412
|
"~run"(r, t) {
|
|
1408
|
-
return typeof r.value == "string" ? r.typed = !0 :
|
|
1413
|
+
return typeof r.value == "string" ? r.typed = !0 : te(this, "type", r, t), r;
|
|
1409
1414
|
}
|
|
1410
1415
|
};
|
|
1411
1416
|
}
|
|
1412
|
-
function
|
|
1413
|
-
const n = e["~run"]({ value: r }, /* @__PURE__ */
|
|
1417
|
+
function ra(e, r, t) {
|
|
1418
|
+
const n = e["~run"]({ value: r }, /* @__PURE__ */ wt(t));
|
|
1414
1419
|
if (n.issues)
|
|
1415
|
-
throw new
|
|
1420
|
+
throw new Qs(n.issues);
|
|
1416
1421
|
return n.value;
|
|
1417
1422
|
}
|
|
1418
1423
|
// @__NO_SIDE_EFFECTS__
|
|
1419
|
-
function
|
|
1424
|
+
function na(e, r) {
|
|
1420
1425
|
const t = {};
|
|
1421
1426
|
for (const n in e.entries)
|
|
1422
|
-
t[n] = !r || r.includes(n) ? /* @__PURE__ */
|
|
1427
|
+
t[n] = !r || r.includes(n) ? /* @__PURE__ */ He(e.entries[n]) : e.entries[n];
|
|
1423
1428
|
return {
|
|
1424
1429
|
...e,
|
|
1425
1430
|
entries: t,
|
|
1426
1431
|
get "~standard"() {
|
|
1427
|
-
return /* @__PURE__ */
|
|
1432
|
+
return /* @__PURE__ */ be(this);
|
|
1428
1433
|
}
|
|
1429
1434
|
};
|
|
1430
1435
|
}
|
|
1431
1436
|
// @__NO_SIDE_EFFECTS__
|
|
1432
|
-
function
|
|
1437
|
+
function Ne(...e) {
|
|
1433
1438
|
return {
|
|
1434
1439
|
...e[0],
|
|
1435
1440
|
pipe: e,
|
|
1436
1441
|
get "~standard"() {
|
|
1437
|
-
return /* @__PURE__ */
|
|
1442
|
+
return /* @__PURE__ */ be(this);
|
|
1438
1443
|
},
|
|
1439
1444
|
"~run"(r, t) {
|
|
1440
1445
|
for (const n of e)
|
|
@@ -1450,8 +1455,8 @@ function Le(...e) {
|
|
|
1450
1455
|
};
|
|
1451
1456
|
}
|
|
1452
1457
|
// @__NO_SIDE_EFFECTS__
|
|
1453
|
-
function
|
|
1454
|
-
const n = e["~run"]({ value: r }, /* @__PURE__ */
|
|
1458
|
+
function sa(e, r, t) {
|
|
1459
|
+
const n = e["~run"]({ value: r }, /* @__PURE__ */ wt(t));
|
|
1455
1460
|
return {
|
|
1456
1461
|
typed: n.typed,
|
|
1457
1462
|
success: !n.issues,
|
|
@@ -1460,10 +1465,10 @@ function na(e, r, t) {
|
|
|
1460
1465
|
};
|
|
1461
1466
|
}
|
|
1462
1467
|
// @__NO_SIDE_EFFECTS__
|
|
1463
|
-
async function
|
|
1468
|
+
async function aa(e, r, t) {
|
|
1464
1469
|
const n = await e["~run"](
|
|
1465
1470
|
{ value: r },
|
|
1466
|
-
/* @__PURE__ */
|
|
1471
|
+
/* @__PURE__ */ wt(t)
|
|
1467
1472
|
);
|
|
1468
1473
|
return {
|
|
1469
1474
|
typed: n.typed,
|
|
@@ -1472,7 +1477,7 @@ async function sa(e, r, t) {
|
|
|
1472
1477
|
issues: n.issues
|
|
1473
1478
|
};
|
|
1474
1479
|
}
|
|
1475
|
-
const
|
|
1480
|
+
const Ye = ({
|
|
1476
1481
|
error: e
|
|
1477
1482
|
}) => !e || !e.message ? null : c("div", {
|
|
1478
1483
|
role: "alert",
|
|
@@ -1505,16 +1510,16 @@ const Qe = ({
|
|
|
1505
1510
|
class: "break-words pr-1 text-sm",
|
|
1506
1511
|
children: e.message
|
|
1507
1512
|
})]
|
|
1508
|
-
}),
|
|
1513
|
+
}), De = ({
|
|
1509
1514
|
class: e,
|
|
1510
1515
|
...r
|
|
1511
1516
|
}) => {
|
|
1512
1517
|
const {
|
|
1513
1518
|
t
|
|
1514
|
-
} =
|
|
1519
|
+
} = re();
|
|
1515
1520
|
return c("button", {
|
|
1516
1521
|
type: "button",
|
|
1517
|
-
class:
|
|
1522
|
+
class: Ze("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),
|
|
1518
1523
|
...r,
|
|
1519
1524
|
children: [c("svg", {
|
|
1520
1525
|
"aria-hidden": !0,
|
|
@@ -1537,7 +1542,7 @@ const Qe = ({
|
|
|
1537
1542
|
});
|
|
1538
1543
|
};
|
|
1539
1544
|
var Kt = { 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" };
|
|
1540
|
-
const
|
|
1545
|
+
const Je = 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", {
|
|
1541
1546
|
variants: {
|
|
1542
1547
|
optional: {
|
|
1543
1548
|
true: "pr-16 pl-3",
|
|
@@ -1547,72 +1552,72 @@ const Ze = wt("outline-divider ease-expo-out placeholder:text-neutral-10 text-ne
|
|
|
1547
1552
|
defaultVariants: {
|
|
1548
1553
|
optional: !1
|
|
1549
1554
|
}
|
|
1550
|
-
}),
|
|
1551
|
-
name: /* @__PURE__ */
|
|
1552
|
-
}),
|
|
1553
|
-
suggestions: /* @__PURE__ */ nn(/* @__PURE__ */
|
|
1554
|
-
feature_type: /* @__PURE__ */
|
|
1555
|
-
full_address: /* @__PURE__ */
|
|
1556
|
-
place_formatted: /* @__PURE__ */
|
|
1557
|
-
name: /* @__PURE__ */
|
|
1558
|
-
mapbox_id: /* @__PURE__ */
|
|
1559
|
-
context: /* @__PURE__ */
|
|
1560
|
-
address:
|
|
1561
|
-
street:
|
|
1562
|
-
neighborhood:
|
|
1563
|
-
locality:
|
|
1564
|
-
district:
|
|
1565
|
-
place:
|
|
1566
|
-
region:
|
|
1567
|
-
postcode:
|
|
1568
|
-
country:
|
|
1555
|
+
}), ia = "https://api.mapbox.com/search/searchbox/v1/suggest", oa = "ZzRDWFU0dTZ3SF9aWk9RNGl6QzZaWS5RZmlFak13a0hPbGxXZXlNSGN5RUhObUJ6TXpSV08yUW5OdE5tSTZJU1lpd2lJb1JYYXRObmJ2Tm5iaGhHZWx4V1lpb2pJMUp5ZS5rcA==", la = (e) => atob(e).split("").reverse().join(""), ve = /* @__PURE__ */ _e({
|
|
1556
|
+
name: /* @__PURE__ */ oe()
|
|
1557
|
+
}), ca = /* @__PURE__ */ _e({
|
|
1558
|
+
suggestions: /* @__PURE__ */ nn(/* @__PURE__ */ _e({
|
|
1559
|
+
feature_type: /* @__PURE__ */ He(/* @__PURE__ */ oe()),
|
|
1560
|
+
full_address: /* @__PURE__ */ He(/* @__PURE__ */ oe()),
|
|
1561
|
+
place_formatted: /* @__PURE__ */ He(/* @__PURE__ */ oe()),
|
|
1562
|
+
name: /* @__PURE__ */ He(/* @__PURE__ */ oe()),
|
|
1563
|
+
mapbox_id: /* @__PURE__ */ oe(),
|
|
1564
|
+
context: /* @__PURE__ */ na(/* @__PURE__ */ _e({
|
|
1565
|
+
address: ve,
|
|
1566
|
+
street: ve,
|
|
1567
|
+
neighborhood: ve,
|
|
1568
|
+
locality: ve,
|
|
1569
|
+
district: ve,
|
|
1570
|
+
place: ve,
|
|
1571
|
+
region: ve,
|
|
1572
|
+
postcode: ve,
|
|
1573
|
+
country: ve
|
|
1569
1574
|
}))
|
|
1570
1575
|
}))
|
|
1571
|
-
}),
|
|
1576
|
+
}), ua = ({
|
|
1572
1577
|
logger: e,
|
|
1573
1578
|
t: r
|
|
1574
|
-
}) =>
|
|
1579
|
+
}) => Un(() => {
|
|
1575
1580
|
var n;
|
|
1576
|
-
const t = (n =
|
|
1581
|
+
const t = (n = U.current$.peek().flow) == null ? void 0 : n.data.flowSessionId;
|
|
1577
1582
|
return t ? {
|
|
1578
1583
|
enabled: !0,
|
|
1579
1584
|
getPredictions: async (s) => {
|
|
1580
1585
|
var y;
|
|
1581
|
-
const i = new URL(
|
|
1586
|
+
const i = new URL(ia);
|
|
1582
1587
|
i.searchParams.set("q", s), i.searchParams.set("session_token", t);
|
|
1583
|
-
const a = (y =
|
|
1584
|
-
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", oa
|
|
1588
|
+
const a = (y = U.current$.peek().flow) == null ? void 0 : y.locationOrigin;
|
|
1589
|
+
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", la(oa));
|
|
1585
1590
|
const u = await fetch(i);
|
|
1586
1591
|
if (!u.ok)
|
|
1587
1592
|
return e.error("Failed to get address details", u), {
|
|
1588
1593
|
ok: !1,
|
|
1589
1594
|
error: r("address_error")
|
|
1590
1595
|
};
|
|
1591
|
-
const f = /* @__PURE__ */
|
|
1596
|
+
const f = /* @__PURE__ */ sa(ca, await u.json());
|
|
1592
1597
|
if (f.success === !1)
|
|
1593
1598
|
return e.error("Failed to parse address details", f.issues), {
|
|
1594
1599
|
ok: !1,
|
|
1595
1600
|
error: r("address_error")
|
|
1596
1601
|
};
|
|
1597
1602
|
const {
|
|
1598
|
-
suggestions:
|
|
1603
|
+
suggestions: b
|
|
1599
1604
|
} = f.output;
|
|
1600
1605
|
return {
|
|
1601
1606
|
ok: !0,
|
|
1602
|
-
data:
|
|
1603
|
-
var m,
|
|
1607
|
+
data: b.map((p) => {
|
|
1608
|
+
var m, k, I, C, x, v, E, N, M;
|
|
1604
1609
|
return {
|
|
1605
1610
|
// A postcode result has no full address and is named by the postcode itself (PROD-7311).
|
|
1606
1611
|
label: p.full_address ?? ([p.name, p.place_formatted].filter(Boolean).join(", ") || p.mapbox_id),
|
|
1607
1612
|
id: p.mapbox_id,
|
|
1608
1613
|
address: {
|
|
1609
|
-
line1: ((m = p.context.address) == null ? void 0 : m.name) ?? ((
|
|
1614
|
+
line1: ((m = p.context.address) == null ? void 0 : m.name) ?? ((k = p.context.street) == null ? void 0 : k.name),
|
|
1610
1615
|
line2: void 0,
|
|
1611
|
-
line3: ((
|
|
1612
|
-
city: ((x = p.context.place) == null ? void 0 : x.name) ?? ((
|
|
1613
|
-
state: (
|
|
1614
|
-
postcode: ((
|
|
1615
|
-
country: (
|
|
1616
|
+
line3: ((I = p.context.neighborhood) == null ? void 0 : I.name) ?? ((C = p.context.locality) == null ? void 0 : C.name),
|
|
1617
|
+
city: ((x = p.context.place) == null ? void 0 : x.name) ?? ((v = p.context.district) == null ? void 0 : v.name),
|
|
1618
|
+
state: (E = p.context.region) == null ? void 0 : E.name,
|
|
1619
|
+
postcode: ((N = p.context.postcode) == null ? void 0 : N.name) ?? (p.feature_type === "postcode" ? p.name : void 0),
|
|
1620
|
+
country: (M = p.context.country) == null ? void 0 : M.name
|
|
1616
1621
|
}
|
|
1617
1622
|
};
|
|
1618
1623
|
})
|
|
@@ -1624,7 +1629,7 @@ const Ze = wt("outline-divider ease-expo-out placeholder:text-neutral-10 text-ne
|
|
|
1624
1629
|
}, [e, r]), dr = (e) => {
|
|
1625
1630
|
const {
|
|
1626
1631
|
t: r
|
|
1627
|
-
} =
|
|
1632
|
+
} = re();
|
|
1628
1633
|
return c("button", {
|
|
1629
1634
|
type: "button",
|
|
1630
1635
|
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",
|
|
@@ -1644,75 +1649,75 @@ const Ze = wt("outline-divider ease-expo-out placeholder:text-neutral-10 text-ne
|
|
|
1644
1649
|
children: r("back")
|
|
1645
1650
|
})]
|
|
1646
1651
|
});
|
|
1647
|
-
},
|
|
1652
|
+
}, da = ({
|
|
1648
1653
|
input: e,
|
|
1649
1654
|
onSubmitSuccess: r,
|
|
1650
1655
|
logger: t
|
|
1651
1656
|
}) => {
|
|
1652
1657
|
const {
|
|
1653
1658
|
t: n
|
|
1654
|
-
} =
|
|
1659
|
+
} = re(), [s, i] = we(), {
|
|
1655
1660
|
enabled: a,
|
|
1656
1661
|
getPredictions: o
|
|
1657
|
-
} =
|
|
1662
|
+
} = ua({
|
|
1658
1663
|
logger: t,
|
|
1659
1664
|
t: n
|
|
1660
|
-
}), [u, f] =
|
|
1661
|
-
var
|
|
1662
|
-
if (
|
|
1665
|
+
}), [u, f] = we(a ? "query" : "manual"), [b, y] = we(""), [p, m] = we(), k = ye(), I = ye(), C = (v) => {
|
|
1666
|
+
var N;
|
|
1667
|
+
if (je(a, "Query state should not be enabled"), v = v.trim(), v === ((N = k.current) == null ? void 0 : N.query) || v === (p == null ? void 0 : p.query) && p.status === "done")
|
|
1663
1668
|
return;
|
|
1664
|
-
if (y(
|
|
1665
|
-
|
|
1669
|
+
if (y(v), v === "") {
|
|
1670
|
+
k.current = void 0, m(void 0);
|
|
1666
1671
|
return;
|
|
1667
1672
|
}
|
|
1668
|
-
const
|
|
1669
|
-
query:
|
|
1673
|
+
const E = k.current = {
|
|
1674
|
+
query: v
|
|
1670
1675
|
};
|
|
1671
1676
|
m({
|
|
1672
|
-
query:
|
|
1677
|
+
query: v,
|
|
1673
1678
|
status: "pending"
|
|
1674
|
-
}), o(
|
|
1675
|
-
|
|
1676
|
-
query:
|
|
1679
|
+
}), o(v).then((M) => {
|
|
1680
|
+
k.current === E && (k.current = void 0, m(M.ok ? {
|
|
1681
|
+
query: v,
|
|
1677
1682
|
status: "done",
|
|
1678
|
-
items:
|
|
1683
|
+
items: M.data
|
|
1679
1684
|
} : {
|
|
1680
|
-
query:
|
|
1685
|
+
query: v,
|
|
1681
1686
|
status: "failed",
|
|
1682
|
-
error:
|
|
1687
|
+
error: M.error
|
|
1683
1688
|
}));
|
|
1684
|
-
}, (
|
|
1685
|
-
|
|
1686
|
-
query:
|
|
1689
|
+
}, (M) => {
|
|
1690
|
+
k.current === E && (k.current = void 0, t.error("Failed to get address details", M), m({
|
|
1691
|
+
query: v,
|
|
1687
1692
|
status: "failed",
|
|
1688
1693
|
error: n("address_error")
|
|
1689
1694
|
}));
|
|
1690
1695
|
});
|
|
1691
|
-
}, x = (
|
|
1692
|
-
i((
|
|
1693
|
-
...
|
|
1694
|
-
[
|
|
1696
|
+
}, x = (v, E) => {
|
|
1697
|
+
i((N) => ({
|
|
1698
|
+
...N,
|
|
1699
|
+
[v]: E
|
|
1695
1700
|
}));
|
|
1696
1701
|
};
|
|
1697
1702
|
switch (u) {
|
|
1698
1703
|
case "query":
|
|
1699
|
-
return
|
|
1704
|
+
return je(a, "Query state should not be enabled"), c(fa, {
|
|
1700
1705
|
input: e,
|
|
1701
1706
|
onSkip: () => r(null),
|
|
1702
|
-
onAddressSelect: (
|
|
1703
|
-
if (
|
|
1704
|
-
|
|
1707
|
+
onAddressSelect: (v) => {
|
|
1708
|
+
if (v === "") {
|
|
1709
|
+
k.current && (k.current = void 0, m(void 0)), f("manual");
|
|
1705
1710
|
return;
|
|
1706
1711
|
}
|
|
1707
|
-
const
|
|
1708
|
-
|
|
1712
|
+
const E = (p == null ? void 0 : p.status) === "done" ? p.items.find((N) => N.id === v) : void 0;
|
|
1713
|
+
E && (I.current !== v && i(E.address), I.current = v, f("details"));
|
|
1709
1714
|
},
|
|
1710
1715
|
onAddressSearch: C,
|
|
1711
1716
|
lookup: p,
|
|
1712
|
-
query:
|
|
1717
|
+
query: b
|
|
1713
1718
|
});
|
|
1714
1719
|
case "details":
|
|
1715
|
-
return
|
|
1720
|
+
return je(s !== void 0), c(fr, {
|
|
1716
1721
|
input: e,
|
|
1717
1722
|
logger: t,
|
|
1718
1723
|
onSubmitSuccess: r,
|
|
@@ -1737,13 +1742,13 @@ const Ze = wt("outline-divider ease-expo-out placeholder:text-neutral-10 text-ne
|
|
|
1737
1742
|
}
|
|
1738
1743
|
}) : e.config.optional ? (
|
|
1739
1744
|
// Without address search this is the only screen, so an optional question needs its own way past.
|
|
1740
|
-
c(
|
|
1745
|
+
c(De, {
|
|
1741
1746
|
onClick: () => r(null)
|
|
1742
1747
|
})
|
|
1743
1748
|
) : void 0
|
|
1744
1749
|
});
|
|
1745
1750
|
}
|
|
1746
|
-
},
|
|
1751
|
+
}, fa = ({
|
|
1747
1752
|
input: e,
|
|
1748
1753
|
onSkip: r,
|
|
1749
1754
|
lookup: t,
|
|
@@ -1753,16 +1758,16 @@ const Ze = wt("outline-divider ease-expo-out placeholder:text-neutral-10 text-ne
|
|
|
1753
1758
|
}) => {
|
|
1754
1759
|
const {
|
|
1755
1760
|
t: a
|
|
1756
|
-
} =
|
|
1757
|
-
return
|
|
1761
|
+
} = re(), o = ye(null);
|
|
1762
|
+
return Re(() => {
|
|
1758
1763
|
o.current && (o.current.focus(), o.current.select());
|
|
1759
|
-
}, []), c(
|
|
1764
|
+
}, []), c(ke, {
|
|
1760
1765
|
children: [c("form", {
|
|
1761
1766
|
noValidate: !0,
|
|
1762
1767
|
onSubmit: (u) => {
|
|
1763
1768
|
u.preventDefault();
|
|
1764
|
-
const
|
|
1765
|
-
typeof
|
|
1769
|
+
const b = new FormData(u.currentTarget).get("address");
|
|
1770
|
+
typeof b == "string" && i(b);
|
|
1766
1771
|
},
|
|
1767
1772
|
class: "flex gap-2 p-2.5",
|
|
1768
1773
|
children: [c("div", {
|
|
@@ -1775,7 +1780,7 @@ const Ze = wt("outline-divider ease-expo-out placeholder:text-neutral-10 text-ne
|
|
|
1775
1780
|
autoFocus: !0,
|
|
1776
1781
|
placeholder: e.config.placeholder || a("address_search"),
|
|
1777
1782
|
defaultValue: s,
|
|
1778
|
-
class:
|
|
1783
|
+
class: Je({
|
|
1779
1784
|
optional: !!e.config.optional,
|
|
1780
1785
|
className: "w-full rounded-full"
|
|
1781
1786
|
})
|
|
@@ -1808,18 +1813,18 @@ const Ze = wt("outline-divider ease-expo-out placeholder:text-neutral-10 text-ne
|
|
|
1808
1813
|
children: a("search")
|
|
1809
1814
|
})]
|
|
1810
1815
|
})]
|
|
1811
|
-
}), e.config.optional && c(
|
|
1816
|
+
}), e.config.optional && c(De, {
|
|
1812
1817
|
class: "relative",
|
|
1813
1818
|
onClick: r
|
|
1814
1819
|
})]
|
|
1815
|
-
}), (t == null ? void 0 : t.status) === "failed" ? c(
|
|
1820
|
+
}), (t == null ? void 0 : t.status) === "failed" ? c(Ye, {
|
|
1816
1821
|
error: {
|
|
1817
1822
|
message: t.error
|
|
1818
1823
|
}
|
|
1819
1824
|
}) : null, c("p", {
|
|
1820
1825
|
role: "status",
|
|
1821
1826
|
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",
|
|
1822
|
-
children: (t == null ? void 0 : t.status) === "pending" ? c(
|
|
1827
|
+
children: (t == null ? void 0 : t.status) === "pending" ? c(ke, {
|
|
1823
1828
|
children: [c(qt, {
|
|
1824
1829
|
"aria-hidden": "true",
|
|
1825
1830
|
class: "h-4 w-4 shrink-0"
|
|
@@ -1863,7 +1868,7 @@ const Ze = wt("outline-divider ease-expo-out placeholder:text-neutral-10 text-ne
|
|
|
1863
1868
|
}, "")]
|
|
1864
1869
|
})]
|
|
1865
1870
|
});
|
|
1866
|
-
},
|
|
1871
|
+
}, Rt = ["line1", "line2", "line3", "city", "state", "postcode", "country"], fr = ({
|
|
1867
1872
|
addressFields: e,
|
|
1868
1873
|
onFieldChange: r,
|
|
1869
1874
|
onSubmitSuccess: t,
|
|
@@ -1871,7 +1876,7 @@ const Ze = wt("outline-divider ease-expo-out placeholder:text-neutral-10 text-ne
|
|
|
1871
1876
|
input: s
|
|
1872
1877
|
}) => {
|
|
1873
1878
|
const i = ye(null);
|
|
1874
|
-
|
|
1879
|
+
Re(() => {
|
|
1875
1880
|
if (i.current) {
|
|
1876
1881
|
const u = i.current.querySelector("input");
|
|
1877
1882
|
u && (u.focus(), u.select());
|
|
@@ -1879,17 +1884,17 @@ const Ze = wt("outline-divider ease-expo-out placeholder:text-neutral-10 text-ne
|
|
|
1879
1884
|
}, []);
|
|
1880
1885
|
const a = Object.keys(Kt), {
|
|
1881
1886
|
t: o
|
|
1882
|
-
} =
|
|
1887
|
+
} = re();
|
|
1883
1888
|
return c("form", {
|
|
1884
1889
|
class: "flex flex-col px-2 pt-2",
|
|
1885
1890
|
onSubmit: (u) => {
|
|
1886
|
-
const f = u.currentTarget,
|
|
1887
|
-
for (const m of
|
|
1891
|
+
const f = u.currentTarget, b = [...f.querySelectorAll("input")].filter((m) => m.value !== "" && !m.value.trim());
|
|
1892
|
+
for (const m of b) {
|
|
1888
1893
|
m.value = "";
|
|
1889
|
-
const
|
|
1890
|
-
|
|
1894
|
+
const k = Rt.find((I) => s.config.keys[I] === m.name);
|
|
1895
|
+
k && r(k, "");
|
|
1891
1896
|
}
|
|
1892
|
-
if (
|
|
1897
|
+
if (b.length > 0 && !f.checkValidity()) {
|
|
1893
1898
|
u.preventDefault(), f.reportValidity();
|
|
1894
1899
|
return;
|
|
1895
1900
|
}
|
|
@@ -1902,11 +1907,11 @@ const Ze = wt("outline-divider ease-expo-out placeholder:text-neutral-10 text-ne
|
|
|
1902
1907
|
children: [c("div", {
|
|
1903
1908
|
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]",
|
|
1904
1909
|
ref: i,
|
|
1905
|
-
children:
|
|
1906
|
-
const
|
|
1907
|
-
return y ? c(
|
|
1910
|
+
children: Rt.map((u, f) => {
|
|
1911
|
+
const b = `isdk_${u}`, y = s.config.keys[u];
|
|
1912
|
+
return y ? c(ke, {
|
|
1908
1913
|
children: [c("label", {
|
|
1909
|
-
for:
|
|
1914
|
+
for: b,
|
|
1910
1915
|
class: "text-neutral-11 [&:has(+*>input:focus)]:text-neutral-12 w-24 pb-2 text-xs uppercase leading-3 tracking-widest transition-colors",
|
|
1911
1916
|
children: o(u)
|
|
1912
1917
|
}), c("div", {
|
|
@@ -1916,7 +1921,7 @@ const Ze = wt("outline-divider ease-expo-out placeholder:text-neutral-10 text-ne
|
|
|
1916
1921
|
children: [c("select", {
|
|
1917
1922
|
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",
|
|
1918
1923
|
name: y,
|
|
1919
|
-
id:
|
|
1924
|
+
id: b,
|
|
1920
1925
|
defaultValue: e[u],
|
|
1921
1926
|
onChange: (p) => r(u, p.currentTarget.value),
|
|
1922
1927
|
required: !0,
|
|
@@ -1949,11 +1954,11 @@ const Ze = wt("outline-divider ease-expo-out placeholder:text-neutral-10 text-ne
|
|
|
1949
1954
|
autoFocus: f === 0 ? !0 : void 0,
|
|
1950
1955
|
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",
|
|
1951
1956
|
name: y,
|
|
1952
|
-
id:
|
|
1957
|
+
id: b,
|
|
1953
1958
|
defaultValue: e[u],
|
|
1954
1959
|
onInput: (p) => r(u, p.currentTarget.value),
|
|
1955
1960
|
required: u === "line2" ? s.config.line2Required === !0 : u !== "line3"
|
|
1956
|
-
}), f ===
|
|
1961
|
+
}), f === Rt.length - 1 ? c("hr", {
|
|
1957
1962
|
class: "m-0 w-full border-b border-b-transparent"
|
|
1958
1963
|
}) : c("hr", {
|
|
1959
1964
|
class: "border-b-neutral-5 m-0 w-full border-b border-solid"
|
|
@@ -1963,7 +1968,7 @@ const Ze = wt("outline-divider ease-expo-out placeholder:text-neutral-10 text-ne
|
|
|
1963
1968
|
})
|
|
1964
1969
|
}), c("div", {
|
|
1965
1970
|
class: "bg-neutral-1 sticky bottom-0 flex items-center py-2",
|
|
1966
|
-
children: [n, c(
|
|
1971
|
+
children: [n, c($e, {
|
|
1967
1972
|
class: "ml-auto"
|
|
1968
1973
|
})]
|
|
1969
1974
|
})]
|
|
@@ -1974,7 +1979,7 @@ const Ze = wt("outline-divider ease-expo-out placeholder:text-neutral-10 text-ne
|
|
|
1974
1979
|
var r;
|
|
1975
1980
|
(r = e.current) == null || r.focus();
|
|
1976
1981
|
}, []), e;
|
|
1977
|
-
}, cn = ["true", "false"],
|
|
1982
|
+
}, cn = ["true", "false"], ha = /* @__PURE__ */ on(cn), pa = "answer", un = "flex items-center flex-wrap gap-2 p-2.5", dn = "min-w-0 max-w-full flex-auto", fn = Wr(({
|
|
1978
1983
|
label: e,
|
|
1979
1984
|
...r
|
|
1980
1985
|
}, t) => c("button", {
|
|
@@ -1985,7 +1990,7 @@ const Ze = wt("outline-divider ease-expo-out placeholder:text-neutral-10 text-ne
|
|
|
1985
1990
|
class: "text-center text-base",
|
|
1986
1991
|
children: e
|
|
1987
1992
|
})
|
|
1988
|
-
})),
|
|
1993
|
+
})), ma = ({
|
|
1989
1994
|
input: e,
|
|
1990
1995
|
onSubmitSuccess: r
|
|
1991
1996
|
}) => {
|
|
@@ -1995,7 +2000,7 @@ const Ze = wt("outline-divider ease-expo-out placeholder:text-neutral-10 text-ne
|
|
|
1995
2000
|
class: "",
|
|
1996
2001
|
onSubmit: (n) => {
|
|
1997
2002
|
n.preventDefault();
|
|
1998
|
-
const s =
|
|
2003
|
+
const s = Wn(n).value, i = ra(ha, s);
|
|
1999
2004
|
r({
|
|
2000
2005
|
type: "boolean",
|
|
2001
2006
|
value: i === "true"
|
|
@@ -2008,28 +2013,28 @@ const Ze = wt("outline-divider ease-expo-out placeholder:text-neutral-10 text-ne
|
|
|
2008
2013
|
children: c(fn, {
|
|
2009
2014
|
ref: s === 0 ? t : null,
|
|
2010
2015
|
type: "submit",
|
|
2011
|
-
name:
|
|
2016
|
+
name: pa,
|
|
2012
2017
|
value: n,
|
|
2013
2018
|
label: e.config.labels[n]
|
|
2014
2019
|
}, n)
|
|
2015
2020
|
}))
|
|
2016
2021
|
}), e.config.optional && c("div", {
|
|
2017
2022
|
class: "px-2 pb-2",
|
|
2018
|
-
children: c(
|
|
2023
|
+
children: c(De, {
|
|
2019
2024
|
class: "relative w-full",
|
|
2020
2025
|
type: "button",
|
|
2021
2026
|
onClick: () => r(null)
|
|
2022
2027
|
})
|
|
2023
2028
|
})]
|
|
2024
2029
|
});
|
|
2025
|
-
},
|
|
2030
|
+
}, ya = (e) => new Promise((r, t) => {
|
|
2026
2031
|
const n = new FileReader();
|
|
2027
2032
|
n.onload = () => {
|
|
2028
2033
|
if (typeof n.result != "string" || !n.result)
|
|
2029
2034
|
return t(new Error("Invalid file"));
|
|
2030
2035
|
r(n.result);
|
|
2031
2036
|
}, n.onerror = t, n.readAsDataURL(e);
|
|
2032
|
-
}), hr = (e) => e.reduce((r, t) => r + t.sizeKb, 0),
|
|
2037
|
+
}), hr = (e) => e.reduce((r, t) => r + t.sizeKb, 0), ba = Xe("file"), pr = 3, _t = (e) => {
|
|
2033
2038
|
const r = e.lastIndexOf(".");
|
|
2034
2039
|
return r === -1 ? [e, ""] : [e.slice(0, r), e.slice(r)];
|
|
2035
2040
|
}, ga = ({
|
|
@@ -2039,9 +2044,9 @@ const Ze = wt("outline-divider ease-expo-out placeholder:text-neutral-10 text-ne
|
|
|
2039
2044
|
}) => {
|
|
2040
2045
|
const {
|
|
2041
2046
|
t: n
|
|
2042
|
-
} =
|
|
2047
|
+
} = re(), [s, i] = _t(e.name);
|
|
2043
2048
|
return c("div", {
|
|
2044
|
-
class:
|
|
2049
|
+
class: Ze("bg-accent-1 outline-accent-4 flex max-w-full gap-2 overflow-hidden rounded-lg px-3 py-2 text-sm outline", r),
|
|
2045
2050
|
...t,
|
|
2046
2051
|
children: [c("p", {
|
|
2047
2052
|
class: "text-accent-12 flex flex-grow overflow-hidden",
|
|
@@ -2059,38 +2064,38 @@ const Ze = wt("outline-divider ease-expo-out placeholder:text-neutral-10 text-ne
|
|
|
2059
2064
|
children: [c("span", {
|
|
2060
2065
|
class: "sr-only",
|
|
2061
2066
|
children: [n("file_size"), ": "]
|
|
2062
|
-
}),
|
|
2067
|
+
}), ze(e.sizeKb)]
|
|
2063
2068
|
})]
|
|
2064
2069
|
});
|
|
2065
2070
|
}, mr = ({
|
|
2066
2071
|
class: e,
|
|
2067
2072
|
...r
|
|
2068
2073
|
}) => c("li", {
|
|
2069
|
-
class:
|
|
2074
|
+
class: Ze("outline-neutral-6 text-neutral-11 bg-neutral-1 block rounded-md px-1 py-0.5 text-xs outline outline-1", e),
|
|
2070
2075
|
...r
|
|
2071
|
-
}),
|
|
2072
|
-
const [t, n] =
|
|
2076
|
+
}), va = (e, r) => {
|
|
2077
|
+
const [t, n] = _t(e);
|
|
2073
2078
|
return `${t.slice(0, r)}${n}`;
|
|
2074
2079
|
}, yr = (e) => ({
|
|
2075
|
-
name:
|
|
2080
|
+
name: va(e.name, 42),
|
|
2076
2081
|
sizeKb: e.size / 1e3
|
|
2077
|
-
}),
|
|
2078
|
-
const n =
|
|
2082
|
+
}), xa = [".heic", ".heif", ".jpg", ".jpeg", ".png", ".gif", ".webp", ".txt", ".rtf", ".odt", ".pages", ".zip"], wa = (e, r, t) => {
|
|
2083
|
+
const n = _t(r.name)[1].toLowerCase(), s = [...t.map((a) => a.toLowerCase()), ...xa], i = n === "" ? "none" : s.includes(n) ? n : "other";
|
|
2079
2084
|
return `chatbot-file-refused:${e}:${i}`;
|
|
2080
|
-
},
|
|
2085
|
+
}, _a = ({
|
|
2081
2086
|
input: e,
|
|
2082
2087
|
onSubmitSuccess: r,
|
|
2083
2088
|
analytics: t
|
|
2084
2089
|
}) => {
|
|
2085
2090
|
var C;
|
|
2086
|
-
const n = (C =
|
|
2091
|
+
const n = (C = U.current$.value.flow) == null ? void 0 : C.data.submissions[e.key], [s, i] = we(ba(n) && n.value.length ? {
|
|
2087
2092
|
status: "ready",
|
|
2088
2093
|
files: n.value
|
|
2089
2094
|
} : {
|
|
2090
2095
|
status: "empty"
|
|
2091
|
-
}), 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,
|
|
2096
|
+
}), 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, b = u.length - pr, y = hr(u), p = Gt(), {
|
|
2092
2097
|
t: m
|
|
2093
|
-
} =
|
|
2098
|
+
} = re(), k = (x) => {
|
|
2094
2099
|
if (!x.length)
|
|
2095
2100
|
return {
|
|
2096
2101
|
reason: "required",
|
|
@@ -2102,7 +2107,7 @@ const Ze = wt("outline-divider ease-expo-out placeholder:text-neutral-10 text-ne
|
|
|
2102
2107
|
if (!ar(x, e.config.extensions))
|
|
2103
2108
|
return {
|
|
2104
2109
|
reason: "type",
|
|
2105
|
-
file: x.find((
|
|
2110
|
+
file: x.find((v) => !ar([v], e.config.extensions)),
|
|
2106
2111
|
error: {
|
|
2107
2112
|
type: "validate",
|
|
2108
2113
|
message: m("validation_file_ext", {
|
|
@@ -2110,10 +2115,10 @@ const Ze = wt("outline-divider ease-expo-out placeholder:text-neutral-10 text-ne
|
|
|
2110
2115
|
})
|
|
2111
2116
|
}
|
|
2112
2117
|
};
|
|
2113
|
-
if (x.some((
|
|
2118
|
+
if (x.some((v) => v.sizeKb === 0))
|
|
2114
2119
|
return {
|
|
2115
2120
|
reason: "empty",
|
|
2116
|
-
file: x.find((
|
|
2121
|
+
file: x.find((v) => v.sizeKb === 0),
|
|
2117
2122
|
error: {
|
|
2118
2123
|
type: "validate",
|
|
2119
2124
|
message: m("validation_file_empty")
|
|
@@ -2125,7 +2130,7 @@ const Ze = wt("outline-divider ease-expo-out placeholder:text-neutral-10 text-ne
|
|
|
2125
2130
|
error: {
|
|
2126
2131
|
type: "max",
|
|
2127
2132
|
message: m("validation_file_size", {
|
|
2128
|
-
size:
|
|
2133
|
+
size: ze(e.config.fileSizeLimitKib)
|
|
2129
2134
|
})
|
|
2130
2135
|
}
|
|
2131
2136
|
};
|
|
@@ -2139,14 +2144,14 @@ const Ze = wt("outline-divider ease-expo-out placeholder:text-neutral-10 text-ne
|
|
|
2139
2144
|
})
|
|
2140
2145
|
}
|
|
2141
2146
|
};
|
|
2142
|
-
},
|
|
2143
|
-
var
|
|
2147
|
+
}, I = (x, v) => {
|
|
2148
|
+
var E, N;
|
|
2144
2149
|
return t.log({
|
|
2145
2150
|
event: "INTERACTION",
|
|
2146
2151
|
properties: {
|
|
2147
|
-
tag:
|
|
2152
|
+
tag: wa(x, v, e.config.extensions)
|
|
2148
2153
|
},
|
|
2149
|
-
customProperties: (
|
|
2154
|
+
customProperties: (N = (E = U.current$.peek().flow) == null ? void 0 : E.analytics) == null ? void 0 : N.customProperties
|
|
2150
2155
|
});
|
|
2151
2156
|
};
|
|
2152
2157
|
return c("form", {
|
|
@@ -2154,10 +2159,10 @@ const Ze = wt("outline-divider ease-expo-out placeholder:text-neutral-10 text-ne
|
|
|
2154
2159
|
onSubmit: (x) => {
|
|
2155
2160
|
if (x.preventDefault(), s.status === "pending" || s.status === "error")
|
|
2156
2161
|
return;
|
|
2157
|
-
const
|
|
2158
|
-
|
|
2162
|
+
const v = k(o);
|
|
2163
|
+
v ? i({
|
|
2159
2164
|
status: "error",
|
|
2160
|
-
error:
|
|
2165
|
+
error: v.error
|
|
2161
2166
|
}) : r({
|
|
2162
2167
|
type: "file",
|
|
2163
2168
|
value: o
|
|
@@ -2172,19 +2177,19 @@ const Ze = wt("outline-divider ease-expo-out placeholder:text-neutral-10 text-ne
|
|
|
2172
2177
|
children: [u.length > 0 ? c("ul", {
|
|
2173
2178
|
class: "flex max-w-full flex-wrap justify-center gap-1 overflow-hidden p-1",
|
|
2174
2179
|
children: [u.slice(0, pr).map((x) => {
|
|
2175
|
-
const [
|
|
2180
|
+
const [v, E] = _t(x.name);
|
|
2176
2181
|
return c(mr, {
|
|
2177
2182
|
class: "flex overflow-hidden",
|
|
2178
2183
|
children: [c("span", {
|
|
2179
2184
|
class: "block truncate",
|
|
2180
|
-
children:
|
|
2185
|
+
children: v
|
|
2181
2186
|
}), c("span", {
|
|
2182
|
-
children:
|
|
2187
|
+
children: E
|
|
2183
2188
|
})]
|
|
2184
2189
|
});
|
|
2185
|
-
}),
|
|
2190
|
+
}), b > 0 ? c(mr, {
|
|
2186
2191
|
children: m("file_more", {
|
|
2187
|
-
count:
|
|
2192
|
+
count: b
|
|
2188
2193
|
})
|
|
2189
2194
|
}) : null]
|
|
2190
2195
|
}) : c("div", {
|
|
@@ -2212,7 +2217,7 @@ const Ze = wt("outline-divider ease-expo-out placeholder:text-neutral-10 text-ne
|
|
|
2212
2217
|
}), e.config.fileSizeLimitKib ? c("p", {
|
|
2213
2218
|
class: "text-neutral-11 text-xs",
|
|
2214
2219
|
children: ["(", m("file_max_size", {
|
|
2215
|
-
size:
|
|
2220
|
+
size: ze(e.config.fileSizeLimitKib)
|
|
2216
2221
|
}), ")"]
|
|
2217
2222
|
}) : null]
|
|
2218
2223
|
}), c("aside", {
|
|
@@ -2232,18 +2237,18 @@ const Ze = wt("outline-divider ease-expo-out placeholder:text-neutral-10 text-ne
|
|
|
2232
2237
|
})]
|
|
2233
2238
|
}), c("p", {
|
|
2234
2239
|
role: "status",
|
|
2235
|
-
class:
|
|
2236
|
-
children: s.status === "pending" ? c(
|
|
2240
|
+
class: Ze("text-neutral-11 flex items-center gap-1.5 text-xs", u.length === 0 && "sr-only"),
|
|
2241
|
+
children: s.status === "pending" ? c(ke, {
|
|
2237
2242
|
children: [c(qt, {
|
|
2238
2243
|
"aria-hidden": "true",
|
|
2239
2244
|
class: "h-4 w-4"
|
|
2240
2245
|
}), m("file_preparing", {
|
|
2241
2246
|
count: u.length
|
|
2242
2247
|
})]
|
|
2243
|
-
}) : s.status === "ready" ? c(
|
|
2248
|
+
}) : s.status === "ready" ? c(ke, {
|
|
2244
2249
|
children: [o.length > 1 ? m("file_total_size", {
|
|
2245
|
-
size:
|
|
2246
|
-
}) :
|
|
2250
|
+
size: ze(y)
|
|
2251
|
+
}) : ze(y), c("span", {
|
|
2247
2252
|
class: "sr-only",
|
|
2248
2253
|
children: [". ", m("file_ready", {
|
|
2249
2254
|
count: o.length
|
|
@@ -2256,46 +2261,46 @@ const Ze = wt("outline-divider ease-expo-out placeholder:text-neutral-10 text-ne
|
|
|
2256
2261
|
count: e.config.allowMultiple ? 2 : 1
|
|
2257
2262
|
}),
|
|
2258
2263
|
onInput: async (x) => {
|
|
2259
|
-
|
|
2260
|
-
const
|
|
2264
|
+
je(x.target instanceof HTMLInputElement);
|
|
2265
|
+
const v = x.target.files ? Array.from(x.target.files) : [];
|
|
2261
2266
|
x.target.value = "";
|
|
2262
|
-
const [
|
|
2263
|
-
if (!
|
|
2267
|
+
const [E] = v;
|
|
2268
|
+
if (!E)
|
|
2264
2269
|
return;
|
|
2265
|
-
const
|
|
2266
|
-
if (
|
|
2267
|
-
return
|
|
2270
|
+
const N = ++a.current, M = s.status === "ready", L = v.map(yr), R = k(L);
|
|
2271
|
+
if (R)
|
|
2272
|
+
return I(R.reason, R.file ?? E), i({
|
|
2268
2273
|
status: "error",
|
|
2269
|
-
error:
|
|
2274
|
+
error: R.error
|
|
2270
2275
|
});
|
|
2271
2276
|
i({
|
|
2272
2277
|
status: "pending",
|
|
2273
|
-
files:
|
|
2278
|
+
files: L
|
|
2274
2279
|
});
|
|
2275
|
-
let
|
|
2280
|
+
let W;
|
|
2276
2281
|
try {
|
|
2277
|
-
const
|
|
2282
|
+
const j = await Promise.all(v.map(async (O) => {
|
|
2278
2283
|
try {
|
|
2279
2284
|
return {
|
|
2280
|
-
...yr(
|
|
2281
|
-
data: await
|
|
2285
|
+
...yr(O),
|
|
2286
|
+
data: await ya(O)
|
|
2282
2287
|
};
|
|
2283
|
-
} catch (
|
|
2284
|
-
throw
|
|
2288
|
+
} catch (z) {
|
|
2289
|
+
throw W ?? (W = O), z;
|
|
2285
2290
|
}
|
|
2286
2291
|
}));
|
|
2287
|
-
a.current ===
|
|
2292
|
+
a.current === N && i({
|
|
2288
2293
|
status: "ready",
|
|
2289
|
-
files:
|
|
2294
|
+
files: j
|
|
2290
2295
|
});
|
|
2291
2296
|
} catch {
|
|
2292
|
-
if (a.current !==
|
|
2297
|
+
if (a.current !== N)
|
|
2293
2298
|
return;
|
|
2294
|
-
|
|
2299
|
+
I("unreadable", W ?? E), i({
|
|
2295
2300
|
status: "error",
|
|
2296
2301
|
error: {
|
|
2297
2302
|
type: "invalid",
|
|
2298
|
-
message: m(
|
|
2303
|
+
message: m(M ? "file_read_error_replacement" : "file_read_error")
|
|
2299
2304
|
}
|
|
2300
2305
|
});
|
|
2301
2306
|
}
|
|
@@ -2307,59 +2312,59 @@ const Ze = wt("outline-divider ease-expo-out placeholder:text-neutral-10 text-ne
|
|
|
2307
2312
|
})]
|
|
2308
2313
|
}), c("div", {
|
|
2309
2314
|
class: "flex h-full flex-col items-center gap-2",
|
|
2310
|
-
children: [c(
|
|
2315
|
+
children: [c($e, {
|
|
2311
2316
|
disabled: o.length === 0
|
|
2312
|
-
}), e.config.optional && c(
|
|
2317
|
+
}), e.config.optional && c(De, {
|
|
2313
2318
|
class: "relative",
|
|
2314
2319
|
onClick: () => r(null)
|
|
2315
2320
|
})]
|
|
2316
2321
|
})]
|
|
2317
|
-
}), c(
|
|
2322
|
+
}), c(Ye, {
|
|
2318
2323
|
error: f
|
|
2319
2324
|
})]
|
|
2320
2325
|
});
|
|
2321
2326
|
};
|
|
2322
|
-
var
|
|
2327
|
+
var ct = (e) => e.type === "checkbox", Be = (e) => e instanceof Date, ie = (e) => e == null;
|
|
2323
2328
|
const hn = (e) => typeof e == "object";
|
|
2324
|
-
var
|
|
2329
|
+
var Y = (e) => !ie(e) && !Array.isArray(e) && hn(e) && !Be(e), ka = (e) => Y(e) && e.target ? ct(e.target) ? e.target.checked : e.target.value : e, Ca = (e) => e.substring(0, e.search(/\.\d+(\.|$)/)) || e, Sa = (e, r) => e.has(Ca(r)), Ia = (e) => {
|
|
2325
2330
|
const r = e.constructor && e.constructor.prototype;
|
|
2326
|
-
return
|
|
2331
|
+
return Y(r) && r.hasOwnProperty("isPrototypeOf");
|
|
2327
2332
|
}, Jt = typeof window < "u" && typeof window.HTMLElement < "u" && typeof document < "u";
|
|
2328
|
-
function
|
|
2333
|
+
function ee(e) {
|
|
2329
2334
|
if (e instanceof Date)
|
|
2330
2335
|
return new Date(e);
|
|
2331
2336
|
const r = typeof FileList < "u" && e instanceof FileList;
|
|
2332
2337
|
if (Jt && (e instanceof Blob || r))
|
|
2333
2338
|
return e;
|
|
2334
2339
|
const t = Array.isArray(e);
|
|
2335
|
-
if (!t && !(
|
|
2340
|
+
if (!t && !(Y(e) && Ia(e)))
|
|
2336
2341
|
return e;
|
|
2337
2342
|
const n = t ? [] : Object.create(Object.getPrototypeOf(e));
|
|
2338
2343
|
for (const s in e)
|
|
2339
|
-
Object.prototype.hasOwnProperty.call(e, s) && (n[s] =
|
|
2344
|
+
Object.prototype.hasOwnProperty.call(e, s) && (n[s] = ee(e[s]));
|
|
2340
2345
|
return n;
|
|
2341
2346
|
}
|
|
2342
|
-
var
|
|
2343
|
-
if (!r || !
|
|
2347
|
+
var kt = (e) => /^\w*$/.test(e), J = (e) => e === void 0, Zt = (e) => Array.isArray(e) ? e.filter(Boolean) : [], Xt = (e) => Zt(e.replace(/["|']|\]/g, "").split(/\.|\[/)), S = (e, r, t) => {
|
|
2348
|
+
if (!r || !Y(e))
|
|
2344
2349
|
return t;
|
|
2345
|
-
const n = (
|
|
2350
|
+
const n = (kt(r) ? [r] : Xt(r)).reduce((s, i) => ie(s) ? s : s[i], e);
|
|
2346
2351
|
return J(n) || n === e ? J(e[r]) ? t : e[r] : n;
|
|
2347
|
-
}, me = (e) => typeof e == "boolean", de = (e) => typeof e == "function",
|
|
2352
|
+
}, me = (e) => typeof e == "boolean", de = (e) => typeof e == "function", H = (e, r, t) => {
|
|
2348
2353
|
let n = -1;
|
|
2349
|
-
const s =
|
|
2354
|
+
const s = kt(r) ? [r] : Xt(r), i = s.length, a = i - 1;
|
|
2350
2355
|
for (; ++n < i; ) {
|
|
2351
2356
|
const o = s[n];
|
|
2352
2357
|
let u = t;
|
|
2353
2358
|
if (n !== a) {
|
|
2354
2359
|
const f = e[o];
|
|
2355
|
-
u =
|
|
2360
|
+
u = Y(f) || Array.isArray(f) ? f : isNaN(+s[n + 1]) ? {} : [];
|
|
2356
2361
|
}
|
|
2357
2362
|
if (o === "__proto__" || o === "constructor" || o === "prototype")
|
|
2358
2363
|
return;
|
|
2359
2364
|
e[o] = u, e = e[o];
|
|
2360
2365
|
}
|
|
2361
2366
|
};
|
|
2362
|
-
const
|
|
2367
|
+
const br = {
|
|
2363
2368
|
BLUR: "blur",
|
|
2364
2369
|
FOCUS_OUT: "focusout",
|
|
2365
2370
|
CHANGE: "change"
|
|
@@ -2369,7 +2374,7 @@ const gr = {
|
|
|
2369
2374
|
onSubmit: "onSubmit",
|
|
2370
2375
|
onTouched: "onTouched",
|
|
2371
2376
|
all: "all"
|
|
2372
|
-
},
|
|
2377
|
+
}, xe = {
|
|
2373
2378
|
max: "max",
|
|
2374
2379
|
min: "min",
|
|
2375
2380
|
maxLength: "maxLength",
|
|
@@ -2377,9 +2382,9 @@ const gr = {
|
|
|
2377
2382
|
pattern: "pattern",
|
|
2378
2383
|
required: "required",
|
|
2379
2384
|
validate: "validate"
|
|
2380
|
-
},
|
|
2381
|
-
|
|
2382
|
-
var
|
|
2385
|
+
}, Aa = se.createContext(null);
|
|
2386
|
+
Aa.displayName = "HookFormControlContext";
|
|
2387
|
+
var Ea = (e, r, t, n = !0) => {
|
|
2383
2388
|
const s = {
|
|
2384
2389
|
defaultValues: r._defaultValues
|
|
2385
2390
|
};
|
|
@@ -2392,12 +2397,12 @@ var Aa = (e, r, t, n = !0) => {
|
|
|
2392
2397
|
});
|
|
2393
2398
|
return s;
|
|
2394
2399
|
};
|
|
2395
|
-
const
|
|
2396
|
-
var
|
|
2397
|
-
function
|
|
2398
|
-
if (
|
|
2400
|
+
const Fa = typeof window < "u" ? se.useLayoutEffect : se.useEffect;
|
|
2401
|
+
var ue = (e) => typeof e == "string", Va = (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), $t = (e) => ie(e) || !hn(e);
|
|
2402
|
+
function Le(e, r, t = /* @__PURE__ */ new WeakSet()) {
|
|
2403
|
+
if ($t(e) || $t(r))
|
|
2399
2404
|
return Object.is(e, r);
|
|
2400
|
-
if (
|
|
2405
|
+
if (Be(e) && Be(r))
|
|
2401
2406
|
return Object.is(e.getTime(), r.getTime());
|
|
2402
2407
|
const n = Object.keys(e), s = Object.keys(r);
|
|
2403
2408
|
if (n.length !== s.length)
|
|
@@ -2411,21 +2416,21 @@ function Me(e, r, t = /* @__PURE__ */ new WeakSet()) {
|
|
|
2411
2416
|
return !1;
|
|
2412
2417
|
if (i !== "ref") {
|
|
2413
2418
|
const o = r[i];
|
|
2414
|
-
if (
|
|
2419
|
+
if (Be(a) && Be(o) || Y(a) && Y(o) || Array.isArray(a) && Array.isArray(o) ? !Le(a, o, t) : !Object.is(a, o))
|
|
2415
2420
|
return !1;
|
|
2416
2421
|
}
|
|
2417
2422
|
}
|
|
2418
2423
|
return !0;
|
|
2419
2424
|
}
|
|
2420
|
-
const
|
|
2421
|
-
|
|
2425
|
+
const Ma = se.createContext(null);
|
|
2426
|
+
Ma.displayName = "HookFormContext";
|
|
2422
2427
|
var pn = (e, r, t, n, s) => r ? {
|
|
2423
2428
|
...t[e],
|
|
2424
2429
|
types: {
|
|
2425
2430
|
...t[e] && t[e].types ? t[e].types : {},
|
|
2426
2431
|
[n]: s || !0
|
|
2427
2432
|
}
|
|
2428
|
-
} : {},
|
|
2433
|
+
} : {}, ot = (e) => Array.isArray(e) ? e : [e], gr = () => {
|
|
2429
2434
|
let e = [];
|
|
2430
2435
|
return {
|
|
2431
2436
|
get observers() {
|
|
@@ -2450,62 +2455,62 @@ function mn(e, r) {
|
|
|
2450
2455
|
for (const n in e)
|
|
2451
2456
|
if (e.hasOwnProperty(n)) {
|
|
2452
2457
|
const s = e[n], i = r[n];
|
|
2453
|
-
if (s &&
|
|
2458
|
+
if (s && Y(s) && i) {
|
|
2454
2459
|
const a = mn(s, i);
|
|
2455
|
-
|
|
2460
|
+
Y(a) && (t[n] = a);
|
|
2456
2461
|
} else
|
|
2457
2462
|
e[n] && (t[n] = i);
|
|
2458
2463
|
}
|
|
2459
2464
|
return t;
|
|
2460
2465
|
}
|
|
2461
|
-
var
|
|
2466
|
+
var ae = (e) => Y(e) && !Object.keys(e).length, Yt = (e) => e.type === "file", bt = (e) => {
|
|
2462
2467
|
if (!Jt)
|
|
2463
2468
|
return !1;
|
|
2464
2469
|
const r = e ? e.ownerDocument : 0;
|
|
2465
2470
|
return e instanceof (r && r.defaultView ? r.defaultView.HTMLElement : HTMLElement);
|
|
2466
|
-
}, yn = (e) => e.type === "select-multiple", Qt = (e) => e.type === "radio",
|
|
2467
|
-
function
|
|
2471
|
+
}, yn = (e) => e.type === "select-multiple", Qt = (e) => e.type === "radio", La = (e) => Qt(e) || ct(e), Dt = (e) => bt(e) && e.isConnected;
|
|
2472
|
+
function Na(e, r) {
|
|
2468
2473
|
const t = r.slice(0, -1).length;
|
|
2469
2474
|
let n = 0;
|
|
2470
2475
|
for (; n < t; )
|
|
2471
2476
|
e = J(e) ? n++ : e[r[n++]];
|
|
2472
2477
|
return e;
|
|
2473
2478
|
}
|
|
2474
|
-
function
|
|
2479
|
+
function Ra(e) {
|
|
2475
2480
|
for (const r in e)
|
|
2476
2481
|
if (e.hasOwnProperty(r) && !J(e[r]))
|
|
2477
2482
|
return !1;
|
|
2478
2483
|
return !0;
|
|
2479
2484
|
}
|
|
2480
|
-
function
|
|
2481
|
-
const t = Array.isArray(r) ? r :
|
|
2482
|
-
return n && delete n[i], s !== 0 && (
|
|
2485
|
+
function X(e, r) {
|
|
2486
|
+
const t = Array.isArray(r) ? r : kt(r) ? [r] : Xt(r), n = t.length === 1 ? e : Na(e, t), s = t.length - 1, i = t[s];
|
|
2487
|
+
return n && delete n[i], s !== 0 && (Y(n) && ae(n) || Array.isArray(n) && Ra(n)) && X(e, t.slice(0, -1)), e;
|
|
2483
2488
|
}
|
|
2484
|
-
var
|
|
2489
|
+
var Da = (e) => {
|
|
2485
2490
|
for (const r in e)
|
|
2486
2491
|
if (de(e[r]))
|
|
2487
2492
|
return !0;
|
|
2488
2493
|
return !1;
|
|
2489
2494
|
};
|
|
2490
|
-
function
|
|
2491
|
-
return Array.isArray(e) ||
|
|
2495
|
+
function bn(e) {
|
|
2496
|
+
return Array.isArray(e) || Y(e) && !Da(e);
|
|
2492
2497
|
}
|
|
2493
|
-
function
|
|
2498
|
+
function Pt(e, r = {}) {
|
|
2494
2499
|
for (const t in e) {
|
|
2495
2500
|
const n = e[t];
|
|
2496
|
-
|
|
2501
|
+
bn(n) ? (r[t] = Array.isArray(n) ? [] : {}, Pt(n, r[t])) : J(n) || (r[t] = !0);
|
|
2497
2502
|
}
|
|
2498
2503
|
return r;
|
|
2499
2504
|
}
|
|
2500
|
-
function
|
|
2501
|
-
t || (t =
|
|
2505
|
+
function We(e, r, t) {
|
|
2506
|
+
t || (t = Pt(r));
|
|
2502
2507
|
for (const n in e) {
|
|
2503
2508
|
const s = e[n];
|
|
2504
|
-
if (
|
|
2505
|
-
J(r) ||
|
|
2509
|
+
if (bn(s))
|
|
2510
|
+
J(r) || $t(t[n]) ? t[n] = Pt(s, Array.isArray(s) ? [] : {}) : We(s, ie(r) ? {} : r[n], t[n]);
|
|
2506
2511
|
else {
|
|
2507
2512
|
const i = r[n];
|
|
2508
|
-
t[n] = !
|
|
2513
|
+
t[n] = !Le(s, i);
|
|
2509
2514
|
}
|
|
2510
2515
|
}
|
|
2511
2516
|
return t;
|
|
@@ -2514,7 +2519,7 @@ const vr = {
|
|
|
2514
2519
|
value: !1,
|
|
2515
2520
|
isValid: !1
|
|
2516
2521
|
}, xr = { value: !0, isValid: !0 };
|
|
2517
|
-
var
|
|
2522
|
+
var gn = (e) => {
|
|
2518
2523
|
if (Array.isArray(e)) {
|
|
2519
2524
|
if (e.length > 1) {
|
|
2520
2525
|
const r = e.filter((t) => t && t.checked && !t.disabled).map((t) => t.value);
|
|
@@ -2526,7 +2531,7 @@ var bn = (e) => {
|
|
|
2526
2531
|
) : vr;
|
|
2527
2532
|
}
|
|
2528
2533
|
return vr;
|
|
2529
|
-
}, vn = (e, { valueAsNumber: r, valueAsDate: t, setValueAs: n }) => J(e) ? e : r ? e === "" ? NaN : e && +e : t &&
|
|
2534
|
+
}, vn = (e, { valueAsNumber: r, valueAsDate: t, setValueAs: n }) => J(e) ? e : r ? e === "" ? NaN : e && +e : t && ue(e) ? new Date(e) : n ? n(e) : e;
|
|
2530
2535
|
const wr = {
|
|
2531
2536
|
isValid: !1,
|
|
2532
2537
|
value: null
|
|
@@ -2537,13 +2542,13 @@ var xn = (e) => Array.isArray(e) ? e.reduce((r, t) => t && t.checked && !t.disab
|
|
|
2537
2542
|
} : r, wr) : wr;
|
|
2538
2543
|
function _r(e) {
|
|
2539
2544
|
const r = e.ref;
|
|
2540
|
-
return Yt(r) ? r.files : Qt(r) ? xn(e.refs).value : yn(r) ? [...r.selectedOptions].map(({ value: t }) => t) :
|
|
2545
|
+
return Yt(r) ? r.files : Qt(r) ? xn(e.refs).value : yn(r) ? [...r.selectedOptions].map(({ value: t }) => t) : ct(r) ? gn(e.refs).value : vn(J(r.value) ? e.ref.value : r.value, e);
|
|
2541
2546
|
}
|
|
2542
|
-
var
|
|
2547
|
+
var Ta = (e, r, t, n) => {
|
|
2543
2548
|
const s = {};
|
|
2544
2549
|
for (const i of e) {
|
|
2545
2550
|
const a = S(r, i);
|
|
2546
|
-
a &&
|
|
2551
|
+
a && H(s, i, a._f);
|
|
2547
2552
|
}
|
|
2548
2553
|
return {
|
|
2549
2554
|
criteriaMode: t,
|
|
@@ -2551,7 +2556,7 @@ var Ra = (e, r, t, n) => {
|
|
|
2551
2556
|
fields: s,
|
|
2552
2557
|
shouldUseNativeValidation: n
|
|
2553
2558
|
};
|
|
2554
|
-
},
|
|
2559
|
+
}, gt = (e) => e instanceof RegExp, nt = (e) => J(e) ? e : gt(e) ? e.source : Y(e) ? gt(e.value) ? e.value.source : e.value : e, kr = (e) => ({
|
|
2555
2560
|
isOnSubmit: !e || e === fe.onSubmit,
|
|
2556
2561
|
isOnBlur: e === fe.onBlur,
|
|
2557
2562
|
isOnChange: e === fe.onChange,
|
|
@@ -2559,8 +2564,8 @@ var Ra = (e, r, t, n) => {
|
|
|
2559
2564
|
isOnTouch: e === fe.onTouched
|
|
2560
2565
|
});
|
|
2561
2566
|
const Cr = "AsyncFunction";
|
|
2562
|
-
var
|
|
2563
|
-
const
|
|
2567
|
+
var Oa = (e) => !!e && !!e.validate && !!(de(e.validate) && e.validate.constructor.name === Cr || Y(e.validate) && Object.values(e.validate).find((r) => r.constructor.name === Cr)), Ba = (e) => e.mount && (e.required || e.min || e.max || e.maxLength || e.minLength || e.pattern || e.validate), Sr = (e, r, t) => !t && (r.watchAll || r.watch.has(e) || [...r.watch].some((n) => e.startsWith(n) && /^\.\w+/.test(e.slice(n.length))));
|
|
2568
|
+
const lt = (e, r, t, n) => {
|
|
2564
2569
|
for (const s of t || Object.keys(e)) {
|
|
2565
2570
|
const i = S(e, s);
|
|
2566
2571
|
if (i) {
|
|
@@ -2570,16 +2575,16 @@ const dt = (e, r, t, n) => {
|
|
|
2570
2575
|
return !0;
|
|
2571
2576
|
if (a.ref && r(a.ref, a.name) && !n)
|
|
2572
2577
|
return !0;
|
|
2573
|
-
if (
|
|
2578
|
+
if (lt(o, r))
|
|
2574
2579
|
break;
|
|
2575
|
-
} else if (
|
|
2580
|
+
} else if (Y(o) && lt(o, r))
|
|
2576
2581
|
break;
|
|
2577
2582
|
}
|
|
2578
2583
|
}
|
|
2579
2584
|
};
|
|
2580
|
-
function
|
|
2585
|
+
function Ir(e, r, t) {
|
|
2581
2586
|
const n = S(e, t);
|
|
2582
|
-
if (n ||
|
|
2587
|
+
if (n || kt(t))
|
|
2583
2588
|
return {
|
|
2584
2589
|
error: n,
|
|
2585
2590
|
name: t
|
|
@@ -2605,114 +2610,114 @@ function Er(e, r, t) {
|
|
|
2605
2610
|
name: t
|
|
2606
2611
|
};
|
|
2607
2612
|
}
|
|
2608
|
-
var
|
|
2613
|
+
var ja = (e, r, t, n) => {
|
|
2609
2614
|
t(e);
|
|
2610
2615
|
const { name: s, ...i } = e;
|
|
2611
|
-
return
|
|
2612
|
-
},
|
|
2613
|
-
const n =
|
|
2614
|
-
return
|
|
2616
|
+
return ae(i) || Object.keys(i).length >= Object.keys(r).length || Object.keys(i).find((a) => r[a] === (!n || fe.all));
|
|
2617
|
+
}, $a = (e, r, t) => !e || !r || e === r || ot(e).some((n) => n && (t ? n === r : n.startsWith(r) || r.startsWith(n))), Pa = (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, qa = (e, r) => !Zt(S(e, r)).length && X(e, r), Ua = (e, r, t) => {
|
|
2618
|
+
const n = ot(S(e, t));
|
|
2619
|
+
return H(n, "root", r[t]), H(e, t, n), e;
|
|
2615
2620
|
};
|
|
2616
2621
|
function Ar(e, r, t = "validate") {
|
|
2617
|
-
if (
|
|
2622
|
+
if (ue(e) || Array.isArray(e) && e.every(ue) || me(e) && !e)
|
|
2618
2623
|
return {
|
|
2619
2624
|
type: t,
|
|
2620
|
-
message:
|
|
2625
|
+
message: ue(e) ? e : "",
|
|
2621
2626
|
ref: r
|
|
2622
2627
|
};
|
|
2623
2628
|
}
|
|
2624
|
-
var
|
|
2629
|
+
var Ue = (e) => Y(e) && !gt(e) ? e : {
|
|
2625
2630
|
value: e,
|
|
2626
2631
|
message: ""
|
|
2627
|
-
},
|
|
2628
|
-
const { ref: a, refs: o, required: u, maxLength: f, minLength:
|
|
2629
|
-
if (!x || r.has(
|
|
2632
|
+
}, Er = async (e, r, t, n, s, i) => {
|
|
2633
|
+
const { ref: a, refs: o, required: u, maxLength: f, minLength: b, min: y, max: p, pattern: m, validate: k, name: I, valueAsNumber: C, mount: x } = e._f, v = S(t, I);
|
|
2634
|
+
if (!x || r.has(I))
|
|
2630
2635
|
return {};
|
|
2631
|
-
const
|
|
2632
|
-
s &&
|
|
2633
|
-
},
|
|
2634
|
-
const
|
|
2635
|
-
|
|
2636
|
-
type:
|
|
2637
|
-
message:
|
|
2636
|
+
const E = o ? o[0] : a, N = (V) => {
|
|
2637
|
+
s && E.reportValidity && (E.setCustomValidity(me(V) ? "" : V || ""), E.reportValidity());
|
|
2638
|
+
}, M = {}, L = Qt(a), R = ct(a), W = L || R, j = (C || Yt(a)) && J(a.value) && J(v) || bt(a) && a.value === "" || v === "" || Array.isArray(v) && !v.length, O = pn.bind(null, I, n, M), z = (V, A, T, $ = xe.maxLength, K = xe.minLength) => {
|
|
2639
|
+
const Z = V ? A : T;
|
|
2640
|
+
M[I] = {
|
|
2641
|
+
type: V ? $ : K,
|
|
2642
|
+
message: Z,
|
|
2638
2643
|
ref: a,
|
|
2639
|
-
...
|
|
2644
|
+
...O(V ? $ : K, Z)
|
|
2640
2645
|
};
|
|
2641
2646
|
};
|
|
2642
|
-
if (i ? !Array.isArray(
|
|
2643
|
-
const { value:
|
|
2644
|
-
if (
|
|
2645
|
-
type:
|
|
2647
|
+
if (i ? !Array.isArray(v) || !v.length : u && (!W && (j || ie(v)) || me(v) && !v || R && !gn(o).isValid || L && !xn(o).isValid)) {
|
|
2648
|
+
const { value: V, message: A } = ue(u) ? { value: !!u, message: u } : Ue(u);
|
|
2649
|
+
if (V && (M[I] = {
|
|
2650
|
+
type: xe.required,
|
|
2646
2651
|
message: A,
|
|
2647
|
-
ref:
|
|
2648
|
-
...
|
|
2652
|
+
ref: E,
|
|
2653
|
+
...O(xe.required, A)
|
|
2649
2654
|
}, !n))
|
|
2650
|
-
return
|
|
2655
|
+
return N(A), M;
|
|
2651
2656
|
}
|
|
2652
|
-
if (
|
|
2653
|
-
let
|
|
2654
|
-
const
|
|
2655
|
-
if (!
|
|
2656
|
-
const
|
|
2657
|
-
|
|
2657
|
+
if (!j && (!ie(y) || !ie(p))) {
|
|
2658
|
+
let V, A;
|
|
2659
|
+
const T = Ue(p), $ = Ue(y);
|
|
2660
|
+
if (!ie(v) && !isNaN(v)) {
|
|
2661
|
+
const K = a.valueAsNumber || v && +v;
|
|
2662
|
+
ie(T.value) || (V = K > T.value), ie($.value) || (A = K < $.value);
|
|
2658
2663
|
} else {
|
|
2659
|
-
const
|
|
2660
|
-
|
|
2664
|
+
const K = a.valueAsDate || new Date(v), Z = (Ce) => /* @__PURE__ */ new Date((/* @__PURE__ */ new Date()).toDateString() + " " + Ce), le = a.type == "time", G = a.type == "week";
|
|
2665
|
+
ue(T.value) && v && (V = le ? Z(v) > Z(T.value) : G ? v > T.value : K > new Date(T.value)), ue($.value) && v && (A = le ? Z(v) < Z($.value) : G ? v < $.value : K < new Date($.value));
|
|
2661
2666
|
}
|
|
2662
|
-
if ((
|
|
2663
|
-
return
|
|
2667
|
+
if ((V || A) && (z(!!V, T.message, $.message, xe.max, xe.min), !n))
|
|
2668
|
+
return N(M[I].message), M;
|
|
2664
2669
|
}
|
|
2665
|
-
if ((f ||
|
|
2666
|
-
const
|
|
2667
|
-
if ((
|
|
2668
|
-
return
|
|
2670
|
+
if ((f || b) && !j && (ue(v) || i && Array.isArray(v))) {
|
|
2671
|
+
const V = Ue(f), A = Ue(b), T = !ie(V.value) && v.length > +V.value, $ = !ie(A.value) && v.length < +A.value;
|
|
2672
|
+
if ((T || $) && (z(T, V.message, A.message), !n))
|
|
2673
|
+
return N(M[I].message), M;
|
|
2669
2674
|
}
|
|
2670
|
-
if (m &&
|
|
2671
|
-
const { value:
|
|
2672
|
-
if (
|
|
2673
|
-
type:
|
|
2675
|
+
if (m && !j && ue(v)) {
|
|
2676
|
+
const { value: V, message: A } = Ue(m);
|
|
2677
|
+
if (gt(V) && !v.match(V) && (M[I] = {
|
|
2678
|
+
type: xe.pattern,
|
|
2674
2679
|
message: A,
|
|
2675
2680
|
ref: a,
|
|
2676
|
-
...
|
|
2681
|
+
...O(xe.pattern, A)
|
|
2677
2682
|
}, !n))
|
|
2678
|
-
return
|
|
2683
|
+
return N(A), M;
|
|
2679
2684
|
}
|
|
2680
|
-
if (
|
|
2681
|
-
if (de(
|
|
2682
|
-
const
|
|
2683
|
-
if (A && (
|
|
2685
|
+
if (k) {
|
|
2686
|
+
if (de(k)) {
|
|
2687
|
+
const V = await k(v, t), A = Ar(V, E);
|
|
2688
|
+
if (A && (M[I] = {
|
|
2684
2689
|
...A,
|
|
2685
|
-
...
|
|
2690
|
+
...O(xe.validate, A.message)
|
|
2686
2691
|
}, !n))
|
|
2687
|
-
return
|
|
2688
|
-
} else if (
|
|
2689
|
-
let
|
|
2690
|
-
for (const A in
|
|
2691
|
-
if (!
|
|
2692
|
+
return N(A.message), M;
|
|
2693
|
+
} else if (Y(k)) {
|
|
2694
|
+
let V = {};
|
|
2695
|
+
for (const A in k) {
|
|
2696
|
+
if (!ae(V) && !n)
|
|
2692
2697
|
break;
|
|
2693
|
-
const
|
|
2694
|
-
|
|
2695
|
-
...
|
|
2696
|
-
...
|
|
2697
|
-
},
|
|
2698
|
+
const T = Ar(await k[A](v, t), E, A);
|
|
2699
|
+
T && (V = {
|
|
2700
|
+
...T,
|
|
2701
|
+
...O(A, T.message)
|
|
2702
|
+
}, N(T.message), n && (M[I] = V));
|
|
2698
2703
|
}
|
|
2699
|
-
if (!
|
|
2700
|
-
ref:
|
|
2701
|
-
...
|
|
2704
|
+
if (!ae(V) && (M[I] = {
|
|
2705
|
+
ref: E,
|
|
2706
|
+
...V
|
|
2702
2707
|
}, !n))
|
|
2703
|
-
return
|
|
2708
|
+
return M;
|
|
2704
2709
|
}
|
|
2705
2710
|
}
|
|
2706
|
-
return
|
|
2711
|
+
return N(!0), M;
|
|
2707
2712
|
};
|
|
2708
|
-
const
|
|
2713
|
+
const Wa = {
|
|
2709
2714
|
mode: fe.onSubmit,
|
|
2710
2715
|
reValidateMode: fe.onChange,
|
|
2711
2716
|
shouldFocusError: !0
|
|
2712
2717
|
};
|
|
2713
|
-
function
|
|
2718
|
+
function za(e = {}) {
|
|
2714
2719
|
let r = {
|
|
2715
|
-
...
|
|
2720
|
+
...Wa,
|
|
2716
2721
|
...e
|
|
2717
2722
|
}, t = {
|
|
2718
2723
|
submitCount: 0,
|
|
@@ -2729,7 +2734,7 @@ function Wa(e = {}) {
|
|
|
2729
2734
|
validatingFields: {},
|
|
2730
2735
|
errors: r.errors || {},
|
|
2731
2736
|
disabled: r.disabled || !1
|
|
2732
|
-
}, n = {}, s =
|
|
2737
|
+
}, n = {}, s = Y(r.defaultValues) || Y(r.values) ? ee(r.defaultValues || r.values) || {} : {}, i = r.shouldUnregister ? {} : ee(s), a = {
|
|
2733
2738
|
action: !1,
|
|
2734
2739
|
mount: !1,
|
|
2735
2740
|
watch: !1,
|
|
@@ -2741,7 +2746,7 @@ function Wa(e = {}) {
|
|
|
2741
2746
|
array: /* @__PURE__ */ new Set(),
|
|
2742
2747
|
watch: /* @__PURE__ */ new Set()
|
|
2743
2748
|
}, u, f = 0;
|
|
2744
|
-
const
|
|
2749
|
+
const b = {
|
|
2745
2750
|
isDirty: !1,
|
|
2746
2751
|
dirtyFields: !1,
|
|
2747
2752
|
validatingFields: !1,
|
|
@@ -2750,235 +2755,235 @@ function Wa(e = {}) {
|
|
|
2750
2755
|
isValid: !1,
|
|
2751
2756
|
errors: !1
|
|
2752
2757
|
}, y = {
|
|
2753
|
-
...
|
|
2758
|
+
...b
|
|
2754
2759
|
};
|
|
2755
2760
|
let p = {
|
|
2756
2761
|
...y
|
|
2757
2762
|
};
|
|
2758
2763
|
const m = {
|
|
2759
|
-
array:
|
|
2760
|
-
state:
|
|
2761
|
-
},
|
|
2764
|
+
array: gr(),
|
|
2765
|
+
state: gr()
|
|
2766
|
+
}, k = r.criteriaMode === fe.all, I = (l) => (d) => {
|
|
2762
2767
|
clearTimeout(f), f = setTimeout(l, d);
|
|
2763
2768
|
}, C = async (l) => {
|
|
2764
2769
|
if (!a.keepIsValid && !r.disabled && (y.isValid || p.isValid || l)) {
|
|
2765
2770
|
let d;
|
|
2766
|
-
r.resolver ? (d =
|
|
2771
|
+
r.resolver ? (d = ae((await W()).errors), x()) : d = await O(n, !0), d !== t.isValid && m.state.next({
|
|
2767
2772
|
isValid: d
|
|
2768
2773
|
});
|
|
2769
2774
|
}
|
|
2770
2775
|
}, x = (l, d) => {
|
|
2771
2776
|
!r.disabled && (y.isValidating || y.validatingFields || p.isValidating || p.validatingFields) && ((l || Array.from(o.mount)).forEach((h) => {
|
|
2772
|
-
h && (d ?
|
|
2777
|
+
h && (d ? H(t.validatingFields, h, d) : X(t.validatingFields, h));
|
|
2773
2778
|
}), m.state.next({
|
|
2774
2779
|
validatingFields: t.validatingFields,
|
|
2775
|
-
isValidating: !
|
|
2780
|
+
isValidating: !ae(t.validatingFields)
|
|
2776
2781
|
}));
|
|
2777
|
-
},
|
|
2778
|
-
if (
|
|
2779
|
-
if (a.action = !0,
|
|
2780
|
-
const
|
|
2781
|
-
w &&
|
|
2782
|
+
}, v = (l, d = [], h, _, w = !0, g = !0) => {
|
|
2783
|
+
if (_ && h && !r.disabled) {
|
|
2784
|
+
if (a.action = !0, g && Array.isArray(S(n, l))) {
|
|
2785
|
+
const F = h(S(n, l), _.argA, _.argB);
|
|
2786
|
+
w && H(n, l, F);
|
|
2782
2787
|
}
|
|
2783
|
-
if (
|
|
2784
|
-
const
|
|
2785
|
-
w &&
|
|
2788
|
+
if (g && Array.isArray(S(t.errors, l))) {
|
|
2789
|
+
const F = h(S(t.errors, l), _.argA, _.argB);
|
|
2790
|
+
w && H(t.errors, l, F), qa(t.errors, l);
|
|
2786
2791
|
}
|
|
2787
|
-
if ((y.touchedFields || p.touchedFields) &&
|
|
2788
|
-
const
|
|
2789
|
-
w &&
|
|
2792
|
+
if ((y.touchedFields || p.touchedFields) && g && Array.isArray(S(t.touchedFields, l))) {
|
|
2793
|
+
const F = h(S(t.touchedFields, l), _.argA, _.argB);
|
|
2794
|
+
w && H(t.touchedFields, l, F);
|
|
2790
2795
|
}
|
|
2791
|
-
(y.dirtyFields || p.dirtyFields) && (t.dirtyFields =
|
|
2796
|
+
(y.dirtyFields || p.dirtyFields) && (t.dirtyFields = We(s, i)), m.state.next({
|
|
2792
2797
|
name: l,
|
|
2793
|
-
isDirty:
|
|
2798
|
+
isDirty: V(l, d),
|
|
2794
2799
|
dirtyFields: t.dirtyFields,
|
|
2795
2800
|
errors: t.errors,
|
|
2796
2801
|
isValid: t.isValid
|
|
2797
2802
|
});
|
|
2798
2803
|
} else
|
|
2799
|
-
|
|
2800
|
-
},
|
|
2801
|
-
|
|
2804
|
+
H(i, l, d);
|
|
2805
|
+
}, E = (l, d) => {
|
|
2806
|
+
H(t.errors, l, d), m.state.next({
|
|
2802
2807
|
errors: t.errors
|
|
2803
2808
|
});
|
|
2804
|
-
},
|
|
2809
|
+
}, N = (l) => {
|
|
2805
2810
|
t.errors = l, m.state.next({
|
|
2806
2811
|
errors: t.errors,
|
|
2807
2812
|
isValid: !1
|
|
2808
2813
|
});
|
|
2809
|
-
},
|
|
2814
|
+
}, M = (l, d, h, _) => {
|
|
2810
2815
|
const w = S(n, l);
|
|
2811
2816
|
if (w) {
|
|
2812
|
-
const
|
|
2813
|
-
J(
|
|
2817
|
+
const g = S(i, l, J(h) ? S(s, l) : h);
|
|
2818
|
+
J(g) || _ && _.defaultChecked || d ? H(i, l, d ? g : _r(w._f)) : $(l, g), a.mount && !a.action && C();
|
|
2814
2819
|
}
|
|
2815
|
-
},
|
|
2816
|
-
let
|
|
2817
|
-
const
|
|
2820
|
+
}, L = (l, d, h, _, w) => {
|
|
2821
|
+
let g = !1, F = !1;
|
|
2822
|
+
const P = {
|
|
2818
2823
|
name: l
|
|
2819
2824
|
};
|
|
2820
2825
|
if (!r.disabled) {
|
|
2821
|
-
if (!h ||
|
|
2822
|
-
(y.isDirty || p.isDirty) && (
|
|
2823
|
-
const
|
|
2824
|
-
|
|
2826
|
+
if (!h || _) {
|
|
2827
|
+
(y.isDirty || p.isDirty) && (F = t.isDirty, t.isDirty = P.isDirty = V(), g = F !== P.isDirty);
|
|
2828
|
+
const q = Le(S(s, l), d);
|
|
2829
|
+
F = !!S(t.dirtyFields, l), q ? X(t.dirtyFields, l) : H(t.dirtyFields, l, !0), P.dirtyFields = t.dirtyFields, g = g || (y.dirtyFields || p.dirtyFields) && F !== !q;
|
|
2825
2830
|
}
|
|
2826
2831
|
if (h) {
|
|
2827
|
-
const
|
|
2828
|
-
|
|
2832
|
+
const q = S(t.touchedFields, l);
|
|
2833
|
+
q || (H(t.touchedFields, l, h), P.touchedFields = t.touchedFields, g = g || (y.touchedFields || p.touchedFields) && q !== h);
|
|
2829
2834
|
}
|
|
2830
|
-
|
|
2835
|
+
g && w && m.state.next(P);
|
|
2831
2836
|
}
|
|
2832
|
-
return
|
|
2833
|
-
},
|
|
2834
|
-
const w = S(t.errors, l),
|
|
2835
|
-
if (r.delayError && h ? (u =
|
|
2836
|
-
const
|
|
2837
|
-
...
|
|
2838
|
-
...
|
|
2837
|
+
return g ? P : {};
|
|
2838
|
+
}, R = (l, d, h, _) => {
|
|
2839
|
+
const w = S(t.errors, l), g = (y.isValid || p.isValid) && me(d) && t.isValid !== d;
|
|
2840
|
+
if (r.delayError && h ? (u = I(() => E(l, h)), u(r.delayError)) : (clearTimeout(f), u = null, h ? H(t.errors, l, h) : X(t.errors, l)), (h ? !Le(w, h) : w) || !ae(_) || g) {
|
|
2841
|
+
const F = {
|
|
2842
|
+
..._,
|
|
2843
|
+
...g && me(d) ? { isValid: d } : {},
|
|
2839
2844
|
errors: t.errors,
|
|
2840
2845
|
name: l
|
|
2841
2846
|
};
|
|
2842
2847
|
t = {
|
|
2843
2848
|
...t,
|
|
2844
|
-
...
|
|
2845
|
-
}, m.state.next(
|
|
2849
|
+
...F
|
|
2850
|
+
}, m.state.next(F);
|
|
2846
2851
|
}
|
|
2847
|
-
},
|
|
2848
|
-
const { errors: d } = await
|
|
2852
|
+
}, W = async (l) => (x(l, !0), await r.resolver(i, r.context, Ta(l || o.mount, n, r.criteriaMode, r.shouldUseNativeValidation))), j = async (l) => {
|
|
2853
|
+
const { errors: d } = await W(l);
|
|
2849
2854
|
if (x(l), l)
|
|
2850
2855
|
for (const h of l) {
|
|
2851
|
-
const
|
|
2852
|
-
|
|
2856
|
+
const _ = S(d, h);
|
|
2857
|
+
_ ? H(t.errors, h, _) : X(t.errors, h);
|
|
2853
2858
|
}
|
|
2854
2859
|
else
|
|
2855
2860
|
t.errors = d;
|
|
2856
2861
|
return d;
|
|
2857
|
-
},
|
|
2862
|
+
}, O = async (l, d, h = {
|
|
2858
2863
|
valid: !0
|
|
2859
2864
|
}) => {
|
|
2860
|
-
for (const
|
|
2861
|
-
const w = l[
|
|
2865
|
+
for (const _ in l) {
|
|
2866
|
+
const w = l[_];
|
|
2862
2867
|
if (w) {
|
|
2863
|
-
const { _f:
|
|
2864
|
-
if (
|
|
2865
|
-
const
|
|
2866
|
-
|
|
2867
|
-
const
|
|
2868
|
-
if (
|
|
2868
|
+
const { _f: g, ...F } = w;
|
|
2869
|
+
if (g) {
|
|
2870
|
+
const P = o.array.has(g.name), q = w._f && Oa(w._f);
|
|
2871
|
+
q && y.validatingFields && x([g.name], !0);
|
|
2872
|
+
const ne = await Er(w, o.disabled, i, k, r.shouldUseNativeValidation && !d, P);
|
|
2873
|
+
if (q && y.validatingFields && x([g.name]), ne[g.name] && (h.valid = !1, d || e.shouldUseNativeValidation))
|
|
2869
2874
|
break;
|
|
2870
|
-
!d && (S(
|
|
2875
|
+
!d && (S(ne, g.name) ? P ? Ua(t.errors, ne, g.name) : H(t.errors, g.name, ne[g.name]) : X(t.errors, g.name));
|
|
2871
2876
|
}
|
|
2872
|
-
!
|
|
2877
|
+
!ae(F) && await O(F, d, h);
|
|
2873
2878
|
}
|
|
2874
2879
|
}
|
|
2875
2880
|
return h.valid;
|
|
2876
|
-
},
|
|
2881
|
+
}, z = () => {
|
|
2877
2882
|
for (const l of o.unMount) {
|
|
2878
2883
|
const d = S(n, l);
|
|
2879
|
-
d && (d._f.refs ? d._f.refs.every((h) => !
|
|
2884
|
+
d && (d._f.refs ? d._f.refs.every((h) => !Dt(h)) : !Dt(d._f.ref)) && Pe(l);
|
|
2880
2885
|
}
|
|
2881
2886
|
o.unMount = /* @__PURE__ */ new Set();
|
|
2882
|
-
},
|
|
2883
|
-
...a.mount ? i : J(d) ? s :
|
|
2884
|
-
}, h, d),
|
|
2885
|
-
const
|
|
2887
|
+
}, V = (l, d) => !r.disabled && (l && d && H(i, l, d), !Le(Qe(), s)), A = (l, d, h) => Va(l, o, {
|
|
2888
|
+
...a.mount ? i : J(d) ? s : ue(l) ? { [l]: d } : d
|
|
2889
|
+
}, h, d), T = (l) => Zt(S(a.mount ? i : s, l, r.shouldUnregister ? S(s, l, []) : [])), $ = (l, d, h = {}) => {
|
|
2890
|
+
const _ = S(n, l);
|
|
2886
2891
|
let w = d;
|
|
2887
|
-
if (
|
|
2888
|
-
const
|
|
2889
|
-
|
|
2890
|
-
(!
|
|
2891
|
-
}) :
|
|
2892
|
+
if (_) {
|
|
2893
|
+
const g = _._f;
|
|
2894
|
+
g && (!g.disabled && H(i, l, vn(d, g)), w = bt(g.ref) && ie(d) ? "" : d, yn(g.ref) ? [...g.ref.options].forEach((F) => F.selected = w.includes(F.value)) : g.refs ? ct(g.ref) ? g.refs.forEach((F) => {
|
|
2895
|
+
(!F.defaultChecked || !F.disabled) && (Array.isArray(w) ? F.checked = !!w.find((P) => P === F.value) : F.checked = w === F.value || !!w);
|
|
2896
|
+
}) : g.refs.forEach((F) => F.checked = F.value === w) : Yt(g.ref) ? g.ref.value = "" : (g.ref.value = w, g.ref.type || m.state.next({
|
|
2892
2897
|
name: l,
|
|
2893
|
-
values:
|
|
2898
|
+
values: ee(i)
|
|
2894
2899
|
})));
|
|
2895
2900
|
}
|
|
2896
|
-
(h.shouldDirty || h.shouldTouch) &&
|
|
2897
|
-
},
|
|
2898
|
-
for (const
|
|
2899
|
-
if (!d.hasOwnProperty(
|
|
2901
|
+
(h.shouldDirty || h.shouldTouch) && L(l, w, h.shouldTouch, h.shouldDirty, !0), h.shouldValidate && Ce(l);
|
|
2902
|
+
}, K = (l, d, h) => {
|
|
2903
|
+
for (const _ in d) {
|
|
2904
|
+
if (!d.hasOwnProperty(_))
|
|
2900
2905
|
return;
|
|
2901
|
-
const w = d[
|
|
2902
|
-
(o.array.has(l) ||
|
|
2906
|
+
const w = d[_], g = l + "." + _, F = S(n, g);
|
|
2907
|
+
(o.array.has(l) || Y(w) || F && !F._f) && !Be(w) ? K(g, w, h) : $(g, w, h);
|
|
2903
2908
|
}
|
|
2904
|
-
},
|
|
2905
|
-
const
|
|
2906
|
-
|
|
2909
|
+
}, Z = (l, d, h = {}) => {
|
|
2910
|
+
const _ = S(n, l), w = o.array.has(l), g = ee(d);
|
|
2911
|
+
H(i, l, g), w ? (m.array.next({
|
|
2907
2912
|
name: l,
|
|
2908
|
-
values:
|
|
2913
|
+
values: ee(i)
|
|
2909
2914
|
}), (y.isDirty || y.dirtyFields || p.isDirty || p.dirtyFields) && h.shouldDirty && m.state.next({
|
|
2910
2915
|
name: l,
|
|
2911
|
-
dirtyFields:
|
|
2912
|
-
isDirty:
|
|
2913
|
-
})) :
|
|
2916
|
+
dirtyFields: We(s, i),
|
|
2917
|
+
isDirty: V(l, g)
|
|
2918
|
+
})) : _ && !_._f && !ie(g) ? K(l, g, h) : $(l, g, h), Sr(l, o) ? m.state.next({
|
|
2914
2919
|
...t,
|
|
2915
2920
|
name: l,
|
|
2916
|
-
values:
|
|
2921
|
+
values: ee(i)
|
|
2917
2922
|
}) : m.state.next({
|
|
2918
2923
|
name: a.mount ? l : void 0,
|
|
2919
|
-
values:
|
|
2924
|
+
values: ee(i)
|
|
2920
2925
|
});
|
|
2921
|
-
},
|
|
2926
|
+
}, le = async (l) => {
|
|
2922
2927
|
a.mount = !0;
|
|
2923
2928
|
const d = l.target;
|
|
2924
|
-
let h = d.name,
|
|
2925
|
-
const w = S(n, h),
|
|
2926
|
-
|
|
2927
|
-
},
|
|
2929
|
+
let h = d.name, _ = !0;
|
|
2930
|
+
const w = S(n, h), g = (q) => {
|
|
2931
|
+
_ = Number.isNaN(q) || Be(q) && isNaN(q.getTime()) || Le(q, S(i, h, q));
|
|
2932
|
+
}, F = kr(r.mode), P = kr(r.reValidateMode);
|
|
2928
2933
|
if (w) {
|
|
2929
|
-
let
|
|
2930
|
-
const
|
|
2931
|
-
|
|
2932
|
-
const
|
|
2933
|
-
if (!
|
|
2934
|
+
let q, ne;
|
|
2935
|
+
const Oe = d.type ? _r(w._f) : ka(l), Fe = l.type === br.BLUR || l.type === br.FOCUS_OUT, _n = !Ba(w._f) && !r.resolver && !S(t.errors, h) && !w._f.deps || Pa(Fe, S(t.touchedFields, h), t.isSubmitted, P, F), At = Sr(h, o, Fe);
|
|
2936
|
+
H(i, h, Oe), Fe ? (!d || !d.readOnly) && (w._f.onBlur && w._f.onBlur(l), u && u(0)) : w._f.onChange && w._f.onChange(l);
|
|
2937
|
+
const Et = L(h, Oe, Fe), kn = !ae(Et) || At;
|
|
2938
|
+
if (!Fe && m.state.next({
|
|
2934
2939
|
name: h,
|
|
2935
2940
|
type: l.type,
|
|
2936
|
-
values:
|
|
2941
|
+
values: ee(i)
|
|
2937
2942
|
}), _n)
|
|
2938
|
-
return (y.isValid || p.isValid) && (r.mode === "onBlur" ?
|
|
2939
|
-
if (!
|
|
2940
|
-
const { errors: er } = await
|
|
2941
|
-
if (x([h]),
|
|
2942
|
-
const Cn =
|
|
2943
|
-
|
|
2943
|
+
return (y.isValid || p.isValid) && (r.mode === "onBlur" ? Fe && C() : Fe || C()), kn && m.state.next({ name: h, ...At ? {} : Et });
|
|
2944
|
+
if (!Fe && At && m.state.next({ ...t }), r.resolver) {
|
|
2945
|
+
const { errors: er } = await W([h]);
|
|
2946
|
+
if (x([h]), g(Oe), _) {
|
|
2947
|
+
const Cn = Ir(t.errors, n, h), tr = Ir(er, n, Cn.name || h);
|
|
2948
|
+
q = tr.error, h = tr.name, ne = ae(er);
|
|
2944
2949
|
}
|
|
2945
2950
|
} else
|
|
2946
|
-
x([h], !0),
|
|
2947
|
-
|
|
2951
|
+
x([h], !0), q = (await Er(w, o.disabled, i, k, r.shouldUseNativeValidation))[h], x([h]), g(Oe), _ && (q ? ne = !1 : (y.isValid || p.isValid) && (ne = await O(n, !0)));
|
|
2952
|
+
_ && (w._f.deps && (!Array.isArray(w._f.deps) || w._f.deps.length > 0) && Ce(w._f.deps), R(h, ne, q, Et));
|
|
2948
2953
|
}
|
|
2949
|
-
},
|
|
2954
|
+
}, G = (l, d) => {
|
|
2950
2955
|
if (S(t.errors, d) && l.focus)
|
|
2951
2956
|
return l.focus(), 1;
|
|
2952
|
-
},
|
|
2953
|
-
let h,
|
|
2954
|
-
const w =
|
|
2957
|
+
}, Ce = async (l, d = {}) => {
|
|
2958
|
+
let h, _;
|
|
2959
|
+
const w = ot(l);
|
|
2955
2960
|
if (r.resolver) {
|
|
2956
|
-
const
|
|
2957
|
-
h =
|
|
2961
|
+
const g = await j(J(l) ? l : w);
|
|
2962
|
+
h = ae(g), _ = l ? !w.some((F) => S(g, F)) : h;
|
|
2958
2963
|
} else
|
|
2959
|
-
l ? (
|
|
2960
|
-
const
|
|
2961
|
-
return await
|
|
2962
|
-
}))).every(Boolean), !(!
|
|
2964
|
+
l ? (_ = (await Promise.all(w.map(async (g) => {
|
|
2965
|
+
const F = S(n, g);
|
|
2966
|
+
return await O(F && F._f ? { [g]: F } : F);
|
|
2967
|
+
}))).every(Boolean), !(!_ && !t.isValid) && C()) : _ = h = await O(n);
|
|
2963
2968
|
return m.state.next({
|
|
2964
|
-
...!
|
|
2969
|
+
...!ue(l) || (y.isValid || p.isValid) && h !== t.isValid ? {} : { name: l },
|
|
2965
2970
|
...r.resolver || !l ? { isValid: h } : {},
|
|
2966
2971
|
errors: t.errors
|
|
2967
|
-
}), d.shouldFocus && !
|
|
2968
|
-
},
|
|
2972
|
+
}), d.shouldFocus && !_ && lt(n, G, l ? w : o.mount), _;
|
|
2973
|
+
}, Qe = (l, d) => {
|
|
2969
2974
|
let h = {
|
|
2970
2975
|
...a.mount ? i : s
|
|
2971
2976
|
};
|
|
2972
|
-
return d && (h = mn(d.dirtyFields ? t.dirtyFields : t.touchedFields, h)), J(l) ? h :
|
|
2973
|
-
},
|
|
2977
|
+
return d && (h = mn(d.dirtyFields ? t.dirtyFields : t.touchedFields, h)), J(l) ? h : ue(l) ? S(h, l) : l.map((_) => S(h, _));
|
|
2978
|
+
}, B = (l, d) => ({
|
|
2974
2979
|
invalid: !!S((d || t).errors, l),
|
|
2975
2980
|
isDirty: !!S((d || t).dirtyFields, l),
|
|
2976
2981
|
error: S((d || t).errors, l),
|
|
2977
2982
|
isValidating: !!S(t.validatingFields, l),
|
|
2978
2983
|
isTouched: !!S((d || t).touchedFields, l)
|
|
2979
|
-
}),
|
|
2980
|
-
const d = l ?
|
|
2981
|
-
d == null || d.forEach((h) =>
|
|
2984
|
+
}), Te = (l) => {
|
|
2985
|
+
const d = l ? ot(l) : void 0;
|
|
2986
|
+
d == null || d.forEach((h) => X(t.errors, h)), d ? d.forEach((h) => {
|
|
2982
2987
|
m.state.next({
|
|
2983
2988
|
name: h,
|
|
2984
2989
|
errors: t.errors
|
|
@@ -2986,55 +2991,55 @@ function Wa(e = {}) {
|
|
|
2986
2991
|
}) : m.state.next({
|
|
2987
2992
|
errors: {}
|
|
2988
2993
|
});
|
|
2989
|
-
},
|
|
2990
|
-
const
|
|
2991
|
-
|
|
2992
|
-
...
|
|
2994
|
+
}, Se = (l, d, h) => {
|
|
2995
|
+
const _ = (S(n, l, { _f: {} })._f || {}).ref, w = S(t.errors, l) || {}, { ref: g, message: F, type: P, ...q } = w;
|
|
2996
|
+
H(t.errors, l, {
|
|
2997
|
+
...q,
|
|
2993
2998
|
...d,
|
|
2994
|
-
ref:
|
|
2999
|
+
ref: _
|
|
2995
3000
|
}), m.state.next({
|
|
2996
3001
|
name: l,
|
|
2997
3002
|
errors: t.errors,
|
|
2998
3003
|
isValid: !1
|
|
2999
|
-
}), h && h.shouldFocus &&
|
|
3000
|
-
},
|
|
3004
|
+
}), h && h.shouldFocus && _ && _.focus && _.focus();
|
|
3005
|
+
}, ut = (l, d) => de(l) ? m.state.subscribe({
|
|
3001
3006
|
next: (h) => "values" in h && l(A(void 0, d), h)
|
|
3002
|
-
}) : A(l, d, !0),
|
|
3007
|
+
}) : A(l, d, !0), Ie = (l) => m.state.subscribe({
|
|
3003
3008
|
next: (d) => {
|
|
3004
|
-
|
|
3009
|
+
$a(l.name, d.name, l.exact) && ja(d, l.formState || y, mt, l.reRenderRoot) && l.callback({
|
|
3005
3010
|
values: { ...i },
|
|
3006
3011
|
...t,
|
|
3007
3012
|
...d,
|
|
3008
3013
|
defaultValues: s
|
|
3009
3014
|
});
|
|
3010
3015
|
}
|
|
3011
|
-
}).unsubscribe,
|
|
3016
|
+
}).unsubscribe, dt = (l) => (a.mount = !0, p = {
|
|
3012
3017
|
...p,
|
|
3013
3018
|
...l.formState
|
|
3014
|
-
},
|
|
3019
|
+
}, Ie({
|
|
3015
3020
|
...l,
|
|
3016
3021
|
formState: {
|
|
3017
|
-
...
|
|
3022
|
+
...b,
|
|
3018
3023
|
...l.formState
|
|
3019
3024
|
}
|
|
3020
|
-
})),
|
|
3021
|
-
for (const h of l ?
|
|
3022
|
-
o.mount.delete(h), o.array.delete(h), d.keepValue || (
|
|
3025
|
+
})), Pe = (l, d = {}) => {
|
|
3026
|
+
for (const h of l ? ot(l) : o.mount)
|
|
3027
|
+
o.mount.delete(h), o.array.delete(h), d.keepValue || (X(n, h), X(i, h)), !d.keepError && X(t.errors, h), !d.keepDirty && X(t.dirtyFields, h), !d.keepTouched && X(t.touchedFields, h), !d.keepIsValidating && X(t.validatingFields, h), !r.shouldUnregister && !d.keepDefaultValue && X(s, h);
|
|
3023
3028
|
m.state.next({
|
|
3024
|
-
values:
|
|
3029
|
+
values: ee(i)
|
|
3025
3030
|
}), m.state.next({
|
|
3026
3031
|
...t,
|
|
3027
|
-
...d.keepDirty ? { isDirty:
|
|
3032
|
+
...d.keepDirty ? { isDirty: V() } : {}
|
|
3028
3033
|
}), !d.keepIsValid && C();
|
|
3029
|
-
},
|
|
3034
|
+
}, qe = ({ disabled: l, name: d }) => {
|
|
3030
3035
|
if (me(l) && a.mount || l || o.disabled.has(d)) {
|
|
3031
3036
|
const w = o.disabled.has(d) !== !!l;
|
|
3032
3037
|
l ? o.disabled.add(d) : o.disabled.delete(d), w && a.mount && !a.action && C();
|
|
3033
3038
|
}
|
|
3034
|
-
},
|
|
3039
|
+
}, Ae = (l, d = {}) => {
|
|
3035
3040
|
let h = S(n, l);
|
|
3036
|
-
const
|
|
3037
|
-
return
|
|
3041
|
+
const _ = me(d.disabled) || me(r.disabled);
|
|
3042
|
+
return H(n, l, {
|
|
3038
3043
|
...h || {},
|
|
3039
3044
|
_f: {
|
|
3040
3045
|
...h && h._f ? h._f : { ref: { name: l } },
|
|
@@ -3042,124 +3047,124 @@ function Wa(e = {}) {
|
|
|
3042
3047
|
mount: !0,
|
|
3043
3048
|
...d
|
|
3044
3049
|
}
|
|
3045
|
-
}), o.mount.add(l), h ?
|
|
3050
|
+
}), o.mount.add(l), h ? qe({
|
|
3046
3051
|
disabled: me(d.disabled) ? d.disabled : r.disabled,
|
|
3047
3052
|
name: l
|
|
3048
|
-
}) :
|
|
3049
|
-
...
|
|
3053
|
+
}) : M(l, !0, d.value), {
|
|
3054
|
+
..._ ? { disabled: d.disabled || r.disabled } : {},
|
|
3050
3055
|
...r.progressive ? {
|
|
3051
3056
|
required: !!d.required,
|
|
3052
|
-
min:
|
|
3053
|
-
max:
|
|
3054
|
-
minLength:
|
|
3055
|
-
maxLength:
|
|
3056
|
-
pattern:
|
|
3057
|
+
min: nt(d.min),
|
|
3058
|
+
max: nt(d.max),
|
|
3059
|
+
minLength: nt(d.minLength),
|
|
3060
|
+
maxLength: nt(d.maxLength),
|
|
3061
|
+
pattern: nt(d.pattern)
|
|
3057
3062
|
} : {},
|
|
3058
3063
|
name: l,
|
|
3059
|
-
onChange:
|
|
3060
|
-
onBlur:
|
|
3064
|
+
onChange: le,
|
|
3065
|
+
onBlur: le,
|
|
3061
3066
|
ref: (w) => {
|
|
3062
3067
|
if (w) {
|
|
3063
|
-
|
|
3064
|
-
const
|
|
3065
|
-
if (
|
|
3068
|
+
Ae(l, d), h = S(n, l);
|
|
3069
|
+
const g = J(w.value) && w.querySelectorAll && w.querySelectorAll("input,select,textarea")[0] || w, F = La(g), P = h._f.refs || [];
|
|
3070
|
+
if (F ? P.find((q) => q === g) : g === h._f.ref)
|
|
3066
3071
|
return;
|
|
3067
|
-
|
|
3072
|
+
H(n, l, {
|
|
3068
3073
|
_f: {
|
|
3069
3074
|
...h._f,
|
|
3070
|
-
...
|
|
3075
|
+
...F ? {
|
|
3071
3076
|
refs: [
|
|
3072
|
-
...
|
|
3073
|
-
|
|
3077
|
+
...P.filter(Dt),
|
|
3078
|
+
g,
|
|
3074
3079
|
...Array.isArray(S(s, l)) ? [{}] : []
|
|
3075
3080
|
],
|
|
3076
|
-
ref: { type:
|
|
3077
|
-
} : { ref:
|
|
3081
|
+
ref: { type: g.type, name: l }
|
|
3082
|
+
} : { ref: g }
|
|
3078
3083
|
}
|
|
3079
|
-
}),
|
|
3084
|
+
}), M(l, !1, void 0, g);
|
|
3080
3085
|
} else
|
|
3081
|
-
h = S(n, l, {}), h._f && (h._f.mount = !1), (r.shouldUnregister || d.shouldUnregister) && !(
|
|
3086
|
+
h = S(n, l, {}), h._f && (h._f.mount = !1), (r.shouldUnregister || d.shouldUnregister) && !(Sa(o.array, l) && a.action) && o.unMount.add(l);
|
|
3082
3087
|
}
|
|
3083
3088
|
};
|
|
3084
|
-
},
|
|
3085
|
-
me(l) && (m.state.next({ disabled: l }),
|
|
3086
|
-
const
|
|
3087
|
-
|
|
3088
|
-
w.disabled =
|
|
3089
|
+
}, Ee = () => r.shouldFocusError && lt(n, G, o.mount), ft = (l) => {
|
|
3090
|
+
me(l) && (m.state.next({ disabled: l }), lt(n, (d, h) => {
|
|
3091
|
+
const _ = S(n, h);
|
|
3092
|
+
_ && (d.disabled = _._f.disabled || l, Array.isArray(_._f.refs) && _._f.refs.forEach((w) => {
|
|
3093
|
+
w.disabled = _._f.disabled || l;
|
|
3089
3094
|
}));
|
|
3090
3095
|
}, 0, !1));
|
|
3091
|
-
},
|
|
3092
|
-
let
|
|
3096
|
+
}, et = (l, d) => async (h) => {
|
|
3097
|
+
let _;
|
|
3093
3098
|
h && (h.preventDefault && h.preventDefault(), h.persist && h.persist());
|
|
3094
|
-
let w =
|
|
3099
|
+
let w = ee(i);
|
|
3095
3100
|
if (m.state.next({
|
|
3096
3101
|
isSubmitting: !0
|
|
3097
3102
|
}), r.resolver) {
|
|
3098
|
-
const { errors:
|
|
3099
|
-
x(), t.errors =
|
|
3103
|
+
const { errors: g, values: F } = await W();
|
|
3104
|
+
x(), t.errors = g, w = ee(F);
|
|
3100
3105
|
} else
|
|
3101
|
-
await
|
|
3106
|
+
await O(n);
|
|
3102
3107
|
if (o.disabled.size)
|
|
3103
|
-
for (const
|
|
3104
|
-
|
|
3105
|
-
if (
|
|
3108
|
+
for (const g of o.disabled)
|
|
3109
|
+
X(w, g);
|
|
3110
|
+
if (X(t.errors, "root"), ae(t.errors)) {
|
|
3106
3111
|
m.state.next({
|
|
3107
3112
|
errors: {}
|
|
3108
3113
|
});
|
|
3109
3114
|
try {
|
|
3110
3115
|
await l(w, h);
|
|
3111
|
-
} catch (
|
|
3112
|
-
|
|
3116
|
+
} catch (g) {
|
|
3117
|
+
_ = g;
|
|
3113
3118
|
}
|
|
3114
3119
|
} else
|
|
3115
|
-
d && await d({ ...t.errors }, h),
|
|
3120
|
+
d && await d({ ...t.errors }, h), Ee(), setTimeout(Ee);
|
|
3116
3121
|
if (m.state.next({
|
|
3117
3122
|
isSubmitted: !0,
|
|
3118
3123
|
isSubmitting: !1,
|
|
3119
|
-
isSubmitSuccessful:
|
|
3124
|
+
isSubmitSuccessful: ae(t.errors) && !_,
|
|
3120
3125
|
submitCount: t.submitCount + 1,
|
|
3121
3126
|
errors: t.errors
|
|
3122
|
-
}),
|
|
3123
|
-
throw
|
|
3124
|
-
},
|
|
3125
|
-
S(n, l) && (J(d.defaultValue) ?
|
|
3126
|
-
},
|
|
3127
|
-
const h = l ?
|
|
3127
|
+
}), _)
|
|
3128
|
+
throw _;
|
|
3129
|
+
}, ht = (l, d = {}) => {
|
|
3130
|
+
S(n, l) && (J(d.defaultValue) ? Z(l, ee(S(s, l))) : (Z(l, d.defaultValue), H(s, l, ee(d.defaultValue))), d.keepTouched || X(t.touchedFields, l), d.keepDirty || (X(t.dirtyFields, l), t.isDirty = d.defaultValue ? V(l, ee(S(s, l))) : V()), d.keepError || (X(t.errors, l), y.isValid && C()), m.state.next({ ...t }));
|
|
3131
|
+
}, tt = (l, d = {}) => {
|
|
3132
|
+
const h = l ? ee(l) : s, _ = ee(h), w = ae(l), g = w ? s : _;
|
|
3128
3133
|
if (d.keepDefaultValues || (s = h), !d.keepValues) {
|
|
3129
3134
|
if (d.keepDirtyValues) {
|
|
3130
|
-
const
|
|
3135
|
+
const F = /* @__PURE__ */ new Set([
|
|
3131
3136
|
...o.mount,
|
|
3132
|
-
...Object.keys(
|
|
3137
|
+
...Object.keys(We(s, i))
|
|
3133
3138
|
]);
|
|
3134
|
-
for (const
|
|
3135
|
-
const
|
|
3136
|
-
|
|
3139
|
+
for (const P of Array.from(F)) {
|
|
3140
|
+
const q = S(t.dirtyFields, P), ne = S(i, P), Oe = S(g, P);
|
|
3141
|
+
q && !J(ne) ? H(g, P, ne) : !q && !J(Oe) && Z(P, Oe);
|
|
3137
3142
|
}
|
|
3138
3143
|
} else {
|
|
3139
3144
|
if (Jt && J(l))
|
|
3140
|
-
for (const
|
|
3141
|
-
const
|
|
3142
|
-
if (
|
|
3143
|
-
const
|
|
3144
|
-
if (bt(
|
|
3145
|
-
const
|
|
3146
|
-
if (
|
|
3147
|
-
|
|
3145
|
+
for (const F of o.mount) {
|
|
3146
|
+
const P = S(n, F);
|
|
3147
|
+
if (P && P._f) {
|
|
3148
|
+
const q = Array.isArray(P._f.refs) ? P._f.refs[0] : P._f.ref;
|
|
3149
|
+
if (bt(q)) {
|
|
3150
|
+
const ne = q.closest("form");
|
|
3151
|
+
if (ne) {
|
|
3152
|
+
ne.reset();
|
|
3148
3153
|
break;
|
|
3149
3154
|
}
|
|
3150
3155
|
}
|
|
3151
3156
|
}
|
|
3152
3157
|
}
|
|
3153
3158
|
if (d.keepFieldsRef)
|
|
3154
|
-
for (const
|
|
3155
|
-
|
|
3159
|
+
for (const F of o.mount)
|
|
3160
|
+
Z(F, S(g, F));
|
|
3156
3161
|
else
|
|
3157
3162
|
n = {};
|
|
3158
3163
|
}
|
|
3159
|
-
i = r.shouldUnregister ? d.keepDefaultValues ?
|
|
3160
|
-
values: { ...
|
|
3164
|
+
i = r.shouldUnregister ? d.keepDefaultValues ? ee(s) : {} : ee(g), m.array.next({
|
|
3165
|
+
values: { ...g }
|
|
3161
3166
|
}), m.state.next({
|
|
3162
|
-
values: { ...
|
|
3167
|
+
values: { ...g }
|
|
3163
3168
|
});
|
|
3164
3169
|
}
|
|
3165
3170
|
o = {
|
|
@@ -3170,56 +3175,56 @@ function Wa(e = {}) {
|
|
|
3170
3175
|
watch: /* @__PURE__ */ new Set(),
|
|
3171
3176
|
watchAll: !1,
|
|
3172
3177
|
focus: ""
|
|
3173
|
-
}, a.mount = !y.isValid || !!d.keepIsValid || !!d.keepDirtyValues || !r.shouldUnregister && !
|
|
3178
|
+
}, a.mount = !y.isValid || !!d.keepIsValid || !!d.keepDirtyValues || !r.shouldUnregister && !ae(g), a.watch = !!r.shouldUnregister, a.keepIsValid = !!d.keepIsValid, a.action = !1, d.keepErrors || (t.errors = {}), m.state.next({
|
|
3174
3179
|
submitCount: d.keepSubmitCount ? t.submitCount : 0,
|
|
3175
|
-
isDirty: w ? !1 : d.keepDirty ? t.isDirty : !!(d.keepDefaultValues && !
|
|
3180
|
+
isDirty: w ? !1 : d.keepDirty ? t.isDirty : !!(d.keepDefaultValues && !Le(l, s)),
|
|
3176
3181
|
isSubmitted: d.keepIsSubmitted ? t.isSubmitted : !1,
|
|
3177
|
-
dirtyFields: w ? {} : d.keepDirtyValues ? d.keepDefaultValues && i ?
|
|
3182
|
+
dirtyFields: w ? {} : d.keepDirtyValues ? d.keepDefaultValues && i ? We(s, i) : t.dirtyFields : d.keepDefaultValues && l ? We(s, l) : d.keepDirty ? t.dirtyFields : {},
|
|
3178
3183
|
touchedFields: d.keepTouched ? t.touchedFields : {},
|
|
3179
3184
|
errors: d.keepErrors ? t.errors : {},
|
|
3180
3185
|
isSubmitSuccessful: d.keepIsSubmitSuccessful ? t.isSubmitSuccessful : !1,
|
|
3181
3186
|
isSubmitting: !1,
|
|
3182
3187
|
defaultValues: s
|
|
3183
3188
|
});
|
|
3184
|
-
},
|
|
3185
|
-
const h = S(n, l),
|
|
3186
|
-
if (
|
|
3187
|
-
const w =
|
|
3189
|
+
}, rt = (l, d) => tt(de(l) ? l(i) : l, { ...r.resetOptions, ...d }), pt = (l, d = {}) => {
|
|
3190
|
+
const h = S(n, l), _ = h && h._f;
|
|
3191
|
+
if (_) {
|
|
3192
|
+
const w = _.refs ? _.refs[0] : _.ref;
|
|
3188
3193
|
w.focus && setTimeout(() => {
|
|
3189
3194
|
w.focus(), d.shouldSelect && de(w.select) && w.select();
|
|
3190
3195
|
});
|
|
3191
3196
|
}
|
|
3192
|
-
},
|
|
3197
|
+
}, mt = (l) => {
|
|
3193
3198
|
t = {
|
|
3194
3199
|
...t,
|
|
3195
3200
|
...l
|
|
3196
3201
|
};
|
|
3197
|
-
},
|
|
3202
|
+
}, D = {
|
|
3198
3203
|
control: {
|
|
3199
|
-
register:
|
|
3200
|
-
unregister:
|
|
3201
|
-
getFieldState:
|
|
3202
|
-
handleSubmit:
|
|
3203
|
-
setError:
|
|
3204
|
-
_subscribe:
|
|
3205
|
-
_runSchema:
|
|
3204
|
+
register: Ae,
|
|
3205
|
+
unregister: Pe,
|
|
3206
|
+
getFieldState: B,
|
|
3207
|
+
handleSubmit: et,
|
|
3208
|
+
setError: Se,
|
|
3209
|
+
_subscribe: Ie,
|
|
3210
|
+
_runSchema: W,
|
|
3206
3211
|
_updateIsValidating: x,
|
|
3207
|
-
_focusError:
|
|
3212
|
+
_focusError: Ee,
|
|
3208
3213
|
_getWatch: A,
|
|
3209
|
-
_getDirty:
|
|
3214
|
+
_getDirty: V,
|
|
3210
3215
|
_setValid: C,
|
|
3211
|
-
_setFieldArray:
|
|
3212
|
-
_setDisabledField:
|
|
3213
|
-
_setErrors:
|
|
3214
|
-
_getFieldArray:
|
|
3215
|
-
_reset:
|
|
3216
|
+
_setFieldArray: v,
|
|
3217
|
+
_setDisabledField: qe,
|
|
3218
|
+
_setErrors: N,
|
|
3219
|
+
_getFieldArray: T,
|
|
3220
|
+
_reset: tt,
|
|
3216
3221
|
_resetDefaultValues: () => de(r.defaultValues) && r.defaultValues().then((l) => {
|
|
3217
|
-
|
|
3222
|
+
rt(l, r.resetOptions), m.state.next({
|
|
3218
3223
|
isLoading: !1
|
|
3219
3224
|
});
|
|
3220
3225
|
}),
|
|
3221
|
-
_removeUnmounted:
|
|
3222
|
-
_disableForm:
|
|
3226
|
+
_removeUnmounted: z,
|
|
3227
|
+
_disableForm: ft,
|
|
3223
3228
|
_subjects: m,
|
|
3224
3229
|
_proxyFormState: y,
|
|
3225
3230
|
get _fields() {
|
|
@@ -3256,28 +3261,28 @@ function Wa(e = {}) {
|
|
|
3256
3261
|
};
|
|
3257
3262
|
}
|
|
3258
3263
|
},
|
|
3259
|
-
subscribe:
|
|
3260
|
-
trigger:
|
|
3261
|
-
register:
|
|
3262
|
-
handleSubmit:
|
|
3263
|
-
watch:
|
|
3264
|
-
setValue:
|
|
3265
|
-
getValues:
|
|
3266
|
-
reset:
|
|
3267
|
-
resetField:
|
|
3268
|
-
clearErrors:
|
|
3269
|
-
unregister:
|
|
3270
|
-
setError:
|
|
3271
|
-
setFocus:
|
|
3272
|
-
getFieldState:
|
|
3264
|
+
subscribe: dt,
|
|
3265
|
+
trigger: Ce,
|
|
3266
|
+
register: Ae,
|
|
3267
|
+
handleSubmit: et,
|
|
3268
|
+
watch: ut,
|
|
3269
|
+
setValue: Z,
|
|
3270
|
+
getValues: Qe,
|
|
3271
|
+
reset: rt,
|
|
3272
|
+
resetField: ht,
|
|
3273
|
+
clearErrors: Te,
|
|
3274
|
+
unregister: Pe,
|
|
3275
|
+
setError: Se,
|
|
3276
|
+
setFocus: pt,
|
|
3277
|
+
getFieldState: B
|
|
3273
3278
|
};
|
|
3274
3279
|
return {
|
|
3275
|
-
...
|
|
3276
|
-
formControl:
|
|
3280
|
+
...D,
|
|
3281
|
+
formControl: D
|
|
3277
3282
|
};
|
|
3278
3283
|
}
|
|
3279
|
-
function
|
|
3280
|
-
const r =
|
|
3284
|
+
function Ct(e = {}) {
|
|
3285
|
+
const r = se.useRef(void 0), t = se.useRef(void 0), [n, s] = se.useState({
|
|
3281
3286
|
isDirty: !1,
|
|
3282
3287
|
isValidating: !1,
|
|
3283
3288
|
isLoading: de(e.defaultValues),
|
|
@@ -3301,14 +3306,14 @@ function St(e = {}) {
|
|
|
3301
3306
|
formState: n
|
|
3302
3307
|
}, e.defaultValues && !de(e.defaultValues) && e.formControl.reset(e.defaultValues, e.resetOptions);
|
|
3303
3308
|
else {
|
|
3304
|
-
const { formControl: a, ...o } =
|
|
3309
|
+
const { formControl: a, ...o } = za(e);
|
|
3305
3310
|
r.current = {
|
|
3306
3311
|
...o,
|
|
3307
3312
|
formState: n
|
|
3308
3313
|
};
|
|
3309
3314
|
}
|
|
3310
3315
|
const i = r.current.control;
|
|
3311
|
-
return i._options = e,
|
|
3316
|
+
return i._options = e, Fa(() => {
|
|
3312
3317
|
const a = i._subscribe({
|
|
3313
3318
|
formState: i._proxyFormState,
|
|
3314
3319
|
callback: () => s({ ...i._formState }),
|
|
@@ -3318,69 +3323,69 @@ function St(e = {}) {
|
|
|
3318
3323
|
...o,
|
|
3319
3324
|
isReady: !0
|
|
3320
3325
|
})), i._formState.isReady = !0, a;
|
|
3321
|
-
}, [i]),
|
|
3326
|
+
}, [i]), se.useEffect(() => i._disableForm(e.disabled), [i, e.disabled]), se.useEffect(() => {
|
|
3322
3327
|
e.mode && (i._options.mode = e.mode), e.reValidateMode && (i._options.reValidateMode = e.reValidateMode);
|
|
3323
|
-
}, [i, e.mode, e.reValidateMode]),
|
|
3328
|
+
}, [i, e.mode, e.reValidateMode]), se.useEffect(() => {
|
|
3324
3329
|
e.errors && (i._setErrors(e.errors), i._focusError());
|
|
3325
|
-
}, [i, e.errors]),
|
|
3330
|
+
}, [i, e.errors]), se.useEffect(() => {
|
|
3326
3331
|
e.shouldUnregister && i._subjects.state.next({
|
|
3327
3332
|
values: i._getWatch()
|
|
3328
3333
|
});
|
|
3329
|
-
}, [i, e.shouldUnregister]),
|
|
3334
|
+
}, [i, e.shouldUnregister]), se.useEffect(() => {
|
|
3330
3335
|
if (i._proxyFormState.isDirty) {
|
|
3331
3336
|
const a = i._getDirty();
|
|
3332
3337
|
a !== n.isDirty && i._subjects.state.next({
|
|
3333
3338
|
isDirty: a
|
|
3334
3339
|
});
|
|
3335
3340
|
}
|
|
3336
|
-
}, [i, n.isDirty]),
|
|
3341
|
+
}, [i, n.isDirty]), se.useEffect(() => {
|
|
3337
3342
|
var a;
|
|
3338
|
-
e.values && !
|
|
3343
|
+
e.values && !Le(e.values, t.current) ? (i._reset(e.values, {
|
|
3339
3344
|
keepFieldsRef: !0,
|
|
3340
3345
|
...i._options.resetOptions
|
|
3341
3346
|
}), !((a = i._options.resetOptions) === null || a === void 0) && a.keepIsValid || i._setValid(), t.current = e.values, s((o) => ({ ...o }))) : i._resetDefaultValues();
|
|
3342
|
-
}, [i, e.values]),
|
|
3347
|
+
}, [i, e.values]), se.useEffect(() => {
|
|
3343
3348
|
i._state.mount || (i._setValid(), i._state.mount = !0), i._state.watch && (i._state.watch = !1, i._subjects.state.next({ ...i._formState })), i._removeUnmounted();
|
|
3344
|
-
}), r.current.formState =
|
|
3349
|
+
}), r.current.formState = se.useMemo(() => Ea(n, i), [i, n]), r.current;
|
|
3345
3350
|
}
|
|
3346
3351
|
const Fr = (e, r, t) => {
|
|
3347
3352
|
if (e && "reportValidity" in e) {
|
|
3348
3353
|
const n = S(t, r);
|
|
3349
3354
|
e.setCustomValidity(n && n.message || ""), e.reportValidity();
|
|
3350
3355
|
}
|
|
3351
|
-
},
|
|
3356
|
+
}, Ha = (e, r) => {
|
|
3352
3357
|
for (const t in r.fields) {
|
|
3353
3358
|
const n = r.fields[t];
|
|
3354
3359
|
n && n.ref && "reportValidity" in n.ref ? Fr(n.ref, t, e) : n.refs && n.refs.forEach((s) => Fr(s, t, e));
|
|
3355
3360
|
}
|
|
3356
|
-
},
|
|
3357
|
-
r.shouldUseNativeValidation &&
|
|
3361
|
+
}, Ka = (e, r) => {
|
|
3362
|
+
r.shouldUseNativeValidation && Ha(e, r);
|
|
3358
3363
|
const t = {};
|
|
3359
3364
|
for (const n in e) {
|
|
3360
3365
|
const s = S(r.fields, n), i = Object.assign(e[n] || {}, { ref: s && s.ref });
|
|
3361
|
-
if (
|
|
3366
|
+
if (Ga(r.names || Object.keys(e), n)) {
|
|
3362
3367
|
const a = Object.assign({}, S(t, n));
|
|
3363
|
-
|
|
3368
|
+
H(a, "root", i), H(t, n, a);
|
|
3364
3369
|
} else
|
|
3365
|
-
|
|
3370
|
+
H(t, n, i);
|
|
3366
3371
|
}
|
|
3367
3372
|
return t;
|
|
3368
|
-
},
|
|
3369
|
-
var
|
|
3373
|
+
}, Ga = (e, r) => e.some((t) => t.startsWith(r + "."));
|
|
3374
|
+
var St = function(e, r, t) {
|
|
3370
3375
|
return t === void 0 && (t = {}), function(n, s, i) {
|
|
3371
3376
|
try {
|
|
3372
3377
|
var a = !i.shouldUseNativeValidation && i.criteriaMode === "all";
|
|
3373
|
-
return Promise.resolve(/* @__PURE__ */
|
|
3378
|
+
return Promise.resolve(/* @__PURE__ */ aa(e, n, Object.assign({}, r, { abortPipeEarly: !a }))).then(function(o) {
|
|
3374
3379
|
if (o.issues) {
|
|
3375
3380
|
for (var u = {}; o.issues.length; ) {
|
|
3376
|
-
var f = o.issues[0],
|
|
3377
|
-
if (
|
|
3378
|
-
var y = u[
|
|
3379
|
-
u[
|
|
3381
|
+
var f = o.issues[0], b = /* @__PURE__ */ Ys(f);
|
|
3382
|
+
if (b && (u[b] || (u[b] = { message: f.message, type: f.type }), a)) {
|
|
3383
|
+
var y = u[b].types, p = y && y[f.type];
|
|
3384
|
+
u[b] = pn(b, a, u, f.type, p ? [].concat(p, f.message) : f.message);
|
|
3380
3385
|
}
|
|
3381
3386
|
o.issues.shift();
|
|
3382
3387
|
}
|
|
3383
|
-
return { values: {}, errors:
|
|
3388
|
+
return { values: {}, errors: Ka(u, i) };
|
|
3384
3389
|
}
|
|
3385
3390
|
return { values: t.raw ? n : o.output, errors: {} };
|
|
3386
3391
|
});
|
|
@@ -3389,22 +3394,22 @@ var Et = function(e, r, t) {
|
|
|
3389
3394
|
}
|
|
3390
3395
|
};
|
|
3391
3396
|
};
|
|
3392
|
-
const Vr = 27, Mr = 12, Lr = 10,
|
|
3397
|
+
const Vr = 27, Mr = 12, Lr = 10, Ja = Xe("enum"), Za = (e, r) => {
|
|
3393
3398
|
const t = {
|
|
3394
3399
|
min: e.minSelected ?? 0,
|
|
3395
3400
|
max: e.maxSelected ?? e.options.length
|
|
3396
3401
|
};
|
|
3397
|
-
return
|
|
3398
|
-
checked: /* @__PURE__ */
|
|
3402
|
+
return St(/* @__PURE__ */ _e({
|
|
3403
|
+
checked: /* @__PURE__ */ Ne(/* @__PURE__ */ ln(/* @__PURE__ */ oe(), /* @__PURE__ */ sn()), /* @__PURE__ */ Ht((n) => Object.entries(n).filter(([s, i]) => i).map(([s, i]) => s)), /* @__PURE__ */ it(t.max, r("validation_multiple_choice_max", {
|
|
3399
3404
|
count: t.max
|
|
3400
|
-
})), /* @__PURE__ */
|
|
3405
|
+
})), /* @__PURE__ */ Ke(t.min, r("validation_multiple_choice_min", {
|
|
3401
3406
|
count: t.min
|
|
3402
3407
|
})))
|
|
3403
3408
|
}));
|
|
3404
|
-
},
|
|
3409
|
+
}, Xa = Wr(({
|
|
3405
3410
|
option: e,
|
|
3406
3411
|
...r
|
|
3407
|
-
}, t) => c(
|
|
3412
|
+
}, t) => c(ke, {
|
|
3408
3413
|
children: [c("input", {
|
|
3409
3414
|
class: "peer sr-only h-full",
|
|
3410
3415
|
type: "checkbox",
|
|
@@ -3415,7 +3420,7 @@ const Vr = 27, Mr = 12, Lr = 10, Ga = Ye("enum"), Ja = (e, r) => {
|
|
|
3415
3420
|
htmlFor: r.id,
|
|
3416
3421
|
children: e.label
|
|
3417
3422
|
})]
|
|
3418
|
-
})),
|
|
3423
|
+
})), Nr = xt("gutter-stable flex w-full flex-1 flex-wrap gap-2 overflow-y-auto rounded-xl p-2.5 pr-4", {
|
|
3419
3424
|
variants: {
|
|
3420
3425
|
variant: {
|
|
3421
3426
|
// In cases where there is only one option, we want to center it
|
|
@@ -3424,38 +3429,38 @@ const Vr = 27, Mr = 12, Lr = 10, Ga = Ye("enum"), Ja = (e, r) => {
|
|
|
3424
3429
|
booleanLike: un
|
|
3425
3430
|
}
|
|
3426
3431
|
}
|
|
3427
|
-
}),
|
|
3432
|
+
}), Ya = ({
|
|
3428
3433
|
input: e,
|
|
3429
3434
|
onSubmitSuccess: r
|
|
3430
3435
|
}) => {
|
|
3431
|
-
var
|
|
3432
|
-
const t = e.key ? (
|
|
3436
|
+
var b, y;
|
|
3437
|
+
const t = e.key ? (b = U.current$.value.flow) == null ? void 0 : b.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, {
|
|
3433
3438
|
t: i
|
|
3434
|
-
} =
|
|
3439
|
+
} = re(), {
|
|
3435
3440
|
register: a,
|
|
3436
3441
|
handleSubmit: o,
|
|
3437
3442
|
formState: {
|
|
3438
3443
|
errors: u
|
|
3439
3444
|
}
|
|
3440
|
-
} =
|
|
3445
|
+
} = Ct({
|
|
3441
3446
|
defaultValues: {
|
|
3442
|
-
checked: n ? {} :
|
|
3447
|
+
checked: n ? {} : Ja(t) ? Object.fromEntries(t.value.map((p) => [p, !0])) : {}
|
|
3443
3448
|
},
|
|
3444
|
-
resolver:
|
|
3449
|
+
resolver: Za(e.config, i)
|
|
3445
3450
|
}), f = Gt();
|
|
3446
3451
|
return s ? c("ul", {
|
|
3447
3452
|
style: {
|
|
3448
3453
|
maxHeight: 6.5 * Vr + 5 * Mr + 2 * Lr
|
|
3449
3454
|
},
|
|
3450
|
-
class:
|
|
3455
|
+
class: Nr({
|
|
3451
3456
|
variant: "booleanLike"
|
|
3452
3457
|
}),
|
|
3453
3458
|
children: e.config.options.map((p, m) => c("li", {
|
|
3454
3459
|
class: dn,
|
|
3455
3460
|
children: c(fn, {
|
|
3456
3461
|
type: "submit",
|
|
3457
|
-
ref: (
|
|
3458
|
-
|
|
3462
|
+
ref: (k) => {
|
|
3463
|
+
k && m === 0 && (f.current = k);
|
|
3459
3464
|
},
|
|
3460
3465
|
label: p.label,
|
|
3461
3466
|
value: "true",
|
|
@@ -3468,10 +3473,10 @@ const Vr = 27, Mr = 12, Lr = 10, Ga = Ye("enum"), Ja = (e, r) => {
|
|
|
3468
3473
|
}) : c("form", {
|
|
3469
3474
|
noValidate: !0,
|
|
3470
3475
|
onSubmit: (p) => o((m) => {
|
|
3471
|
-
const
|
|
3476
|
+
const k = m.checked;
|
|
3472
3477
|
r({
|
|
3473
3478
|
type: "enum",
|
|
3474
|
-
value:
|
|
3479
|
+
value: k
|
|
3475
3480
|
});
|
|
3476
3481
|
})(p),
|
|
3477
3482
|
children: [c("div", {
|
|
@@ -3480,23 +3485,23 @@ const Vr = 27, Mr = 12, Lr = 10, Ga = Ye("enum"), Ja = (e, r) => {
|
|
|
3480
3485
|
style: {
|
|
3481
3486
|
maxHeight: 6.5 * Vr + 5 * Mr + 2 * Lr
|
|
3482
3487
|
},
|
|
3483
|
-
class:
|
|
3488
|
+
class: Nr({
|
|
3484
3489
|
variant: e.config.options.length === 1 ? "singleOption" : void 0
|
|
3485
3490
|
}),
|
|
3486
3491
|
children: e.config.options.map((p, m) => {
|
|
3487
|
-
const
|
|
3488
|
-
ref:
|
|
3492
|
+
const k = `checked.${p.value}`, {
|
|
3493
|
+
ref: I,
|
|
3489
3494
|
...C
|
|
3490
|
-
} = a(
|
|
3495
|
+
} = a(k);
|
|
3491
3496
|
return c("li", {
|
|
3492
3497
|
class: "relative",
|
|
3493
|
-
children: c(
|
|
3498
|
+
children: c(Xa, {
|
|
3494
3499
|
option: p,
|
|
3495
3500
|
autoFocus: m === 0,
|
|
3496
3501
|
ref: (x) => {
|
|
3497
|
-
x && m === 0 && (f.current = x),
|
|
3502
|
+
x && m === 0 && (f.current = x), I(x);
|
|
3498
3503
|
},
|
|
3499
|
-
id:
|
|
3504
|
+
id: k,
|
|
3500
3505
|
...C,
|
|
3501
3506
|
onClick: n ? () => r({
|
|
3502
3507
|
type: "enum",
|
|
@@ -3507,7 +3512,7 @@ const Vr = 27, Mr = 12, Lr = 10, Ga = Ye("enum"), Ja = (e, r) => {
|
|
|
3507
3512
|
})
|
|
3508
3513
|
}), c("div", {
|
|
3509
3514
|
class: "flex flex-col items-center gap-2 pr-2.5 pt-2.5",
|
|
3510
|
-
children: [n ? null : c(
|
|
3515
|
+
children: [n ? null : c($e, {}), e.config.minSelected === 0 && c(De, {
|
|
3511
3516
|
class: "relative",
|
|
3512
3517
|
type: "button",
|
|
3513
3518
|
onClick: () => r({
|
|
@@ -3518,15 +3523,15 @@ const Vr = 27, Mr = 12, Lr = 10, Ga = Ye("enum"), Ja = (e, r) => {
|
|
|
3518
3523
|
})]
|
|
3519
3524
|
}), c("div", {
|
|
3520
3525
|
class: "px-1",
|
|
3521
|
-
children: c(
|
|
3526
|
+
children: c(Ye, {
|
|
3522
3527
|
error: (y = u.checked) == null ? void 0 : y.root
|
|
3523
3528
|
})
|
|
3524
3529
|
})]
|
|
3525
3530
|
});
|
|
3526
|
-
},
|
|
3531
|
+
}, Qa = Xe("number"), ei = (e, r) => {
|
|
3527
3532
|
const t = e.min ?? Number.MIN_SAFE_INTEGER, n = e.max ?? Number.MAX_SAFE_INTEGER, s = e.decimalCases ?? 0;
|
|
3528
|
-
return
|
|
3529
|
-
number: /* @__PURE__ */
|
|
3533
|
+
return St(/* @__PURE__ */ _e({
|
|
3534
|
+
number: /* @__PURE__ */ Ne(/* @__PURE__ */ an(r("validation_number")), /* @__PURE__ */ en(t, r("validation_number_min", {
|
|
3530
3535
|
min: t
|
|
3531
3536
|
})), /* @__PURE__ */ Qr(n, r("validation_number_max", {
|
|
3532
3537
|
max: n
|
|
@@ -3534,33 +3539,33 @@ const Vr = 27, Mr = 12, Lr = 10, Ga = Ye("enum"), Ja = (e, r) => {
|
|
|
3534
3539
|
count: s
|
|
3535
3540
|
})))
|
|
3536
3541
|
}));
|
|
3537
|
-
},
|
|
3542
|
+
}, ti = ({
|
|
3538
3543
|
input: e,
|
|
3539
3544
|
onSubmitSuccess: r
|
|
3540
3545
|
}) => {
|
|
3541
3546
|
var y;
|
|
3542
|
-
const t = e.config.defaultValue, n = e.key ? (y =
|
|
3547
|
+
const t = e.config.defaultValue, n = e.key ? (y = U.current$.value.flow) == null ? void 0 : y.data.submissions[e.key] : void 0, {
|
|
3543
3548
|
t: s
|
|
3544
|
-
} =
|
|
3549
|
+
} = re(), {
|
|
3545
3550
|
register: i,
|
|
3546
3551
|
handleSubmit: a,
|
|
3547
3552
|
formState: {
|
|
3548
3553
|
errors: o
|
|
3549
3554
|
}
|
|
3550
|
-
} =
|
|
3555
|
+
} = Ct({
|
|
3551
3556
|
defaultValues: {
|
|
3552
|
-
number:
|
|
3557
|
+
number: Qa(n) ? n.value : t ? Number(t) : void 0
|
|
3553
3558
|
},
|
|
3554
|
-
resolver:
|
|
3559
|
+
resolver: ei(e.config, s)
|
|
3555
3560
|
}), {
|
|
3556
3561
|
ref: u,
|
|
3557
3562
|
...f
|
|
3558
3563
|
} = i("number", {
|
|
3559
3564
|
required: !e.config.optional,
|
|
3560
3565
|
valueAsNumber: !0
|
|
3561
|
-
}),
|
|
3562
|
-
return
|
|
3563
|
-
|
|
3566
|
+
}), b = ye();
|
|
3567
|
+
return Re(() => {
|
|
3568
|
+
b.current && (b.current.focus(), b.current.select());
|
|
3564
3569
|
}, []), c("form", {
|
|
3565
3570
|
class: "flex flex-col gap-1 p-2.5",
|
|
3566
3571
|
onSubmit: a((p) => {
|
|
@@ -3581,26 +3586,26 @@ const Vr = 27, Mr = 12, Lr = 10, Ga = Ye("enum"), Ja = (e, r) => {
|
|
|
3581
3586
|
autoCorrect: "off",
|
|
3582
3587
|
autoFocus: !0,
|
|
3583
3588
|
ref: (p) => {
|
|
3584
|
-
p && (
|
|
3589
|
+
p && (b.current = p), u(p);
|
|
3585
3590
|
},
|
|
3586
3591
|
type: "text",
|
|
3587
3592
|
min: e.config.min,
|
|
3588
3593
|
max: e.config.max,
|
|
3589
|
-
class:
|
|
3594
|
+
class: Je({
|
|
3590
3595
|
optional: e.config.optional,
|
|
3591
3596
|
className: "[type=number:-webkit-inner-spin-button] w-full rounded-full [-webkit-outer-spin-button:none]"
|
|
3592
3597
|
}),
|
|
3593
3598
|
placeholder: e.config.placeholder
|
|
3594
|
-
}), e.config.optional && c(
|
|
3599
|
+
}), e.config.optional && c(De, {
|
|
3595
3600
|
class: "absolute bottom-0 right-0.5 top-0",
|
|
3596
3601
|
onClick: () => r(null)
|
|
3597
3602
|
})]
|
|
3598
|
-
}), c(
|
|
3599
|
-
}), c(
|
|
3603
|
+
}), c($e, {})]
|
|
3604
|
+
}), c(Ye, {
|
|
3600
3605
|
error: o.number
|
|
3601
3606
|
})]
|
|
3602
3607
|
});
|
|
3603
|
-
},
|
|
3608
|
+
}, ri = (e) => {
|
|
3604
3609
|
if (e === "")
|
|
3605
3610
|
return {
|
|
3606
3611
|
countryCode: "",
|
|
@@ -3614,65 +3619,65 @@ const Vr = 27, Mr = 12, Lr = 10, Ga = Ye("enum"), Ja = (e, r) => {
|
|
|
3614
3619
|
countryCode: "",
|
|
3615
3620
|
phoneNumber: ""
|
|
3616
3621
|
};
|
|
3617
|
-
},
|
|
3618
|
-
const r = /* @__PURE__ */
|
|
3619
|
-
return
|
|
3622
|
+
}, ni = "44", si = /^[0-9 ]+$/, ai = Xe("string"), ii = Xe("phone"), oi = (e) => {
|
|
3623
|
+
const r = /* @__PURE__ */ Ne(/* @__PURE__ */ oe(e("validation_country_code")), /* @__PURE__ */ zt(si, e("validation_country_code"))), t = /* @__PURE__ */ Ne(/* @__PURE__ */ oe(e("validation_phone")), /* @__PURE__ */ Ke(1, e("validation_phone")), /* @__PURE__ */ Ht((n) => n.replace(/[^0-9]/g, "")));
|
|
3624
|
+
return St(/* @__PURE__ */ _e({
|
|
3620
3625
|
countryCode: r,
|
|
3621
3626
|
phoneNumber: t
|
|
3622
3627
|
}));
|
|
3623
|
-
},
|
|
3628
|
+
}, li = ({
|
|
3624
3629
|
input: e,
|
|
3625
3630
|
onSubmitSuccess: r
|
|
3626
3631
|
}) => {
|
|
3627
|
-
var
|
|
3628
|
-
const t = e.key ? (
|
|
3632
|
+
var I;
|
|
3633
|
+
const t = e.key ? (I = U.current$.value.flow) == null ? void 0 : I.data.submissions[e.key] : void 0, {
|
|
3629
3634
|
t: n
|
|
3630
|
-
} =
|
|
3635
|
+
} = re(), [s, i] = we(), a = ai(t) ? ri(t.value) : ii(t) ? t.value : void 0, {
|
|
3631
3636
|
register: o,
|
|
3632
3637
|
handleSubmit: u,
|
|
3633
3638
|
formState: {
|
|
3634
3639
|
errors: f
|
|
3635
3640
|
},
|
|
3636
|
-
watch:
|
|
3637
|
-
} =
|
|
3641
|
+
watch: b
|
|
3642
|
+
} = Ct({
|
|
3638
3643
|
defaultValues: {
|
|
3639
|
-
countryCode: (a == null ? void 0 : a.countryCode) ?? e.config.defaultValue.countryCode ??
|
|
3644
|
+
countryCode: (a == null ? void 0 : a.countryCode) ?? e.config.defaultValue.countryCode ?? ni,
|
|
3640
3645
|
phoneNumber: (a == null ? void 0 : a.phoneNumber) ?? e.config.defaultValue.phoneNumber ?? ""
|
|
3641
3646
|
},
|
|
3642
|
-
resolver:
|
|
3647
|
+
resolver: oi(n)
|
|
3643
3648
|
}), {
|
|
3644
3649
|
ref: y,
|
|
3645
3650
|
...p
|
|
3646
3651
|
} = o("phoneNumber", {
|
|
3647
3652
|
required: !e.config.optional
|
|
3648
|
-
}), m = ye(),
|
|
3649
|
-
return
|
|
3653
|
+
}), m = ye(), k = b("countryCode");
|
|
3654
|
+
return Re(() => {
|
|
3650
3655
|
m.current && (m.current.focus(), m.current.select());
|
|
3651
3656
|
}, []), c("form", {
|
|
3652
3657
|
noValidate: !0,
|
|
3653
3658
|
class: "flex flex-col gap-1 p-2.5",
|
|
3654
3659
|
onSubmit: u((C) => {
|
|
3655
|
-
const x = C.phoneNumber.replace(/[^0-9]/g, ""),
|
|
3660
|
+
const x = C.phoneNumber.replace(/[^0-9]/g, ""), v = C.countryCode.replace(/[^0-9]/g, "");
|
|
3656
3661
|
i(void 0);
|
|
3657
|
-
const
|
|
3658
|
-
if (
|
|
3662
|
+
const E = e.config.minChars ?? 7, N = x.length + v.length;
|
|
3663
|
+
if (N < E)
|
|
3659
3664
|
return i(n("validation_phone_min_chars", {
|
|
3660
|
-
count:
|
|
3665
|
+
count: E
|
|
3661
3666
|
}));
|
|
3662
|
-
const
|
|
3663
|
-
if (
|
|
3667
|
+
const M = e.config.maxChars;
|
|
3668
|
+
if (M != null && N > M)
|
|
3664
3669
|
return i(n("validation_max_chars", {
|
|
3665
|
-
count:
|
|
3670
|
+
count: M
|
|
3666
3671
|
}));
|
|
3667
3672
|
e.config.submissionFormat === "phone" ? r({
|
|
3668
3673
|
type: "phone",
|
|
3669
3674
|
value: {
|
|
3670
|
-
countryCode:
|
|
3675
|
+
countryCode: v,
|
|
3671
3676
|
phoneNumber: x
|
|
3672
3677
|
}
|
|
3673
3678
|
}) : r({
|
|
3674
3679
|
type: "string",
|
|
3675
|
-
value:
|
|
3680
|
+
value: k + C.phoneNumber
|
|
3676
3681
|
});
|
|
3677
3682
|
}),
|
|
3678
3683
|
children: [c("div", {
|
|
@@ -3683,7 +3688,7 @@ const Vr = 27, Mr = 12, Lr = 10, Ga = Ye("enum"), Ja = (e, r) => {
|
|
|
3683
3688
|
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",
|
|
3684
3689
|
htmlFor: `isdk_phone_${e.key}`,
|
|
3685
3690
|
children: [c("span", {
|
|
3686
|
-
children: ["+",
|
|
3691
|
+
children: ["+", k]
|
|
3687
3692
|
}), c("select", {
|
|
3688
3693
|
...o("countryCode", {}),
|
|
3689
3694
|
id: `isdk_phone_${e.key}`,
|
|
@@ -3705,43 +3710,43 @@ const Vr = 27, Mr = 12, Lr = 10, Ga = Ye("enum"), Ja = (e, r) => {
|
|
|
3705
3710
|
ref: (C) => {
|
|
3706
3711
|
C && (m.current = C), y(C);
|
|
3707
3712
|
},
|
|
3708
|
-
class:
|
|
3713
|
+
class: Je({
|
|
3709
3714
|
optional: e.config.optional,
|
|
3710
3715
|
className: "min-w-0 flex-1 rounded-r-full"
|
|
3711
3716
|
}),
|
|
3712
3717
|
placeholder: e.config.placeholder
|
|
3713
|
-
}), e.config.optional && c(
|
|
3718
|
+
}), e.config.optional && c(De, {
|
|
3714
3719
|
class: "absolute bottom-0 right-1 top-0",
|
|
3715
3720
|
onClick: () => r(null)
|
|
3716
3721
|
})]
|
|
3717
|
-
}), c(
|
|
3718
|
-
}), c(
|
|
3722
|
+
}), c($e, {})]
|
|
3723
|
+
}), c(Ye, {
|
|
3719
3724
|
error: f.countryCode || f.phoneNumber || {
|
|
3720
3725
|
message: s
|
|
3721
3726
|
}
|
|
3722
3727
|
})]
|
|
3723
3728
|
});
|
|
3724
|
-
},
|
|
3729
|
+
}, yt = (e) => e === void 0 ? 0 : Math.max(0, Math.ceil((e - Date.now()) / 1e3)), Rr = (e, r, t, n) => t !== void 0 && n * 1e3 > Pr ? e("submission_available_at", {
|
|
3725
3730
|
time: qr(t, r)
|
|
3726
3731
|
}) : e("submission_cooldown", {
|
|
3727
3732
|
count: n
|
|
3728
|
-
}),
|
|
3733
|
+
}), ci = ({
|
|
3729
3734
|
input: e,
|
|
3730
3735
|
onSubmitSuccess: r
|
|
3731
3736
|
}) => {
|
|
3732
3737
|
const {
|
|
3733
3738
|
t,
|
|
3734
3739
|
locale: n
|
|
3735
|
-
} =
|
|
3740
|
+
} = re(), {
|
|
3736
3741
|
availableAt: s
|
|
3737
|
-
} = e.config, [i, a] =
|
|
3742
|
+
} = e.config, [i, a] = we(() => yt(s)), [o, u] = we("");
|
|
3738
3743
|
Ur(() => {
|
|
3739
|
-
const
|
|
3740
|
-
if (a(
|
|
3744
|
+
const b = yt(s);
|
|
3745
|
+
if (a(b), b === 0)
|
|
3741
3746
|
return;
|
|
3742
|
-
u(
|
|
3747
|
+
u(Rr(t, n, s, b));
|
|
3743
3748
|
const y = setInterval(() => {
|
|
3744
|
-
const p =
|
|
3749
|
+
const p = yt(s);
|
|
3745
3750
|
a(p), !(p > 0) && (clearInterval(y), u(t("submission_cooldown_ready")));
|
|
3746
3751
|
}, 250);
|
|
3747
3752
|
return () => clearInterval(y);
|
|
@@ -3755,7 +3760,7 @@ const Vr = 27, Mr = 12, Lr = 10, Ga = Ye("enum"), Ja = (e, r) => {
|
|
|
3755
3760
|
"aria-disabled": f,
|
|
3756
3761
|
"aria-describedby": f ? "submit-cooldown" : void 0,
|
|
3757
3762
|
onClick: () => {
|
|
3758
|
-
|
|
3763
|
+
yt(s) > 0 || r(null);
|
|
3759
3764
|
},
|
|
3760
3765
|
children: c("span", {
|
|
3761
3766
|
class: "flex items-center gap-1.5",
|
|
@@ -3781,16 +3786,16 @@ const Vr = 27, Mr = 12, Lr = 10, Ga = Ye("enum"), Ja = (e, r) => {
|
|
|
3781
3786
|
id: "submit-cooldown",
|
|
3782
3787
|
"aria-hidden": "true",
|
|
3783
3788
|
class: "text-neutral-11 text-xs",
|
|
3784
|
-
children:
|
|
3789
|
+
children: Rr(t, n, s, i)
|
|
3785
3790
|
}), c("p", {
|
|
3786
3791
|
role: "status",
|
|
3787
3792
|
class: "sr-only",
|
|
3788
3793
|
children: o
|
|
3789
3794
|
})]
|
|
3790
3795
|
});
|
|
3791
|
-
},
|
|
3792
|
-
e.style.height = "auto", e.style.height = `${Math.min(e.scrollHeight,
|
|
3793
|
-
},
|
|
3796
|
+
}, ui = 160, Dr = (e) => {
|
|
3797
|
+
e.style.height = "auto", e.style.height = `${Math.min(e.scrollHeight, ui)}px`;
|
|
3798
|
+
}, di = {
|
|
3794
3799
|
date: {
|
|
3795
3800
|
type: "date",
|
|
3796
3801
|
inputMode: "text"
|
|
@@ -3809,7 +3814,7 @@ const Vr = 27, Mr = 12, Lr = 10, Ga = Ye("enum"), Ja = (e, r) => {
|
|
|
3809
3814
|
inputMode: "url",
|
|
3810
3815
|
formNoValidate: !0
|
|
3811
3816
|
}
|
|
3812
|
-
},
|
|
3817
|
+
}, fi = Xe("string"), hi = (e, r) => {
|
|
3813
3818
|
const t = {
|
|
3814
3819
|
maxLength: r("validation_max_chars", {
|
|
3815
3820
|
count: e.maxChars ?? 999
|
|
@@ -3818,43 +3823,43 @@ const Vr = 27, Mr = 12, Lr = 10, Ga = Ye("enum"), Ja = (e, r) => {
|
|
|
3818
3823
|
count: e.minChars ?? 1
|
|
3819
3824
|
})
|
|
3820
3825
|
};
|
|
3821
|
-
return
|
|
3826
|
+
return St(/* @__PURE__ */ _e({
|
|
3822
3827
|
text: {
|
|
3823
|
-
date: /* @__PURE__ */
|
|
3824
|
-
email: /* @__PURE__ */
|
|
3825
|
-
text: /* @__PURE__ */
|
|
3826
|
-
url: /* @__PURE__ */
|
|
3828
|
+
date: /* @__PURE__ */ Ne(/* @__PURE__ */ oe(r("validation_date")), /* @__PURE__ */ zt(/^\d{4}-\d{2}-\d{2}$/, r("validation_date"))),
|
|
3829
|
+
email: /* @__PURE__ */ Ne(/* @__PURE__ */ oe(r("validation_email")), /* @__PURE__ */ Yr(r("validation_email")), /* @__PURE__ */ Ke(e.minChars ?? 1, t.minLength), /* @__PURE__ */ it(e.maxChars ?? 1 / 0, t.maxLength)),
|
|
3830
|
+
text: /* @__PURE__ */ Ne(/* @__PURE__ */ oe(), /* @__PURE__ */ Ke(e.minChars ?? 1, t.minLength), /* @__PURE__ */ it(e.maxChars ?? 1 / 0, t.maxLength)),
|
|
3831
|
+
url: /* @__PURE__ */ Ne(/* @__PURE__ */ oe(r("validation_url")), /* @__PURE__ */ tn(r("validation_url")), /* @__PURE__ */ Ke(e.minChars ?? 1, t.minLength), /* @__PURE__ */ it(e.maxChars ?? 1 / 0, t.maxLength))
|
|
3827
3832
|
}[e.format]
|
|
3828
3833
|
}));
|
|
3829
|
-
},
|
|
3834
|
+
}, pi = ({
|
|
3830
3835
|
input: e,
|
|
3831
3836
|
onSubmitSuccess: r
|
|
3832
3837
|
}) => {
|
|
3833
|
-
var
|
|
3838
|
+
var I;
|
|
3834
3839
|
const {
|
|
3835
3840
|
t
|
|
3836
|
-
} =
|
|
3841
|
+
} = re(), n = e.key ? (I = U.current$.value.flow) == null ? void 0 : I.data.submissions[e.key] : void 0, s = e.config.defaultValue, i = e.config.multiline === !0 && e.config.format === "text", {
|
|
3837
3842
|
register: a,
|
|
3838
3843
|
handleSubmit: o,
|
|
3839
3844
|
watch: u,
|
|
3840
3845
|
formState: {
|
|
3841
3846
|
errors: f
|
|
3842
3847
|
}
|
|
3843
|
-
} =
|
|
3848
|
+
} = Ct({
|
|
3844
3849
|
defaultValues: {
|
|
3845
|
-
text:
|
|
3850
|
+
text: fi(n) ? n.value : s ?? ""
|
|
3846
3851
|
},
|
|
3847
|
-
resolver:
|
|
3852
|
+
resolver: hi(e.config, t)
|
|
3848
3853
|
}), {
|
|
3849
|
-
ref:
|
|
3854
|
+
ref: b,
|
|
3850
3855
|
...y
|
|
3851
3856
|
} = a("text", {
|
|
3852
3857
|
required: !e.config.optional
|
|
3853
3858
|
}), p = ye();
|
|
3854
|
-
|
|
3855
|
-
p.current && (p.current instanceof HTMLTextAreaElement &&
|
|
3859
|
+
Re(() => {
|
|
3860
|
+
p.current && (p.current instanceof HTMLTextAreaElement && Dr(p.current), p.current.focus(), p.current.select());
|
|
3856
3861
|
}, []);
|
|
3857
|
-
const m = e.config.maxChars,
|
|
3862
|
+
const m = e.config.maxChars, k = i && m !== void 0 ? u("text").length : void 0;
|
|
3858
3863
|
return c("form", {
|
|
3859
3864
|
noValidate: !0,
|
|
3860
3865
|
class: "flex flex-col gap-1 p-2.5",
|
|
@@ -3874,68 +3879,68 @@ const Vr = 27, Mr = 12, Lr = 10, Ga = Ye("enum"), Ja = (e, r) => {
|
|
|
3874
3879
|
rows: 2,
|
|
3875
3880
|
maxLength: m,
|
|
3876
3881
|
autoFocus: !0,
|
|
3877
|
-
"aria-describedby":
|
|
3878
|
-
onInput: (C) =>
|
|
3882
|
+
"aria-describedby": k !== void 0 ? "chat-input-count" : void 0,
|
|
3883
|
+
onInput: (C) => Dr(C.currentTarget),
|
|
3879
3884
|
onKeyDown: (C) => {
|
|
3880
3885
|
var x;
|
|
3881
3886
|
C.key === "Enter" && (C.ctrlKey || C.metaKey) && (C.preventDefault(), (x = C.currentTarget.form) == null || x.requestSubmit());
|
|
3882
3887
|
},
|
|
3883
3888
|
ref: (C) => {
|
|
3884
|
-
C && (p.current = C),
|
|
3889
|
+
C && (p.current = C), b(C);
|
|
3885
3890
|
},
|
|
3886
3891
|
placeholder: e.config.placeholder,
|
|
3887
|
-
class:
|
|
3892
|
+
class: Je({
|
|
3888
3893
|
optional: !!e.config.optional,
|
|
3889
3894
|
className: "block w-full resize-none overflow-y-auto rounded-2xl"
|
|
3890
3895
|
})
|
|
3891
3896
|
}) : c("input", {
|
|
3892
3897
|
id: "chat-input",
|
|
3893
3898
|
...y,
|
|
3894
|
-
...
|
|
3899
|
+
...di[e.config.format],
|
|
3895
3900
|
autocomplete: "off",
|
|
3896
3901
|
autoCapitalize: "off",
|
|
3897
3902
|
autoCorrect: "off",
|
|
3898
3903
|
autoFocus: !0,
|
|
3899
3904
|
ref: (C) => {
|
|
3900
|
-
C && (p.current = C),
|
|
3905
|
+
C && (p.current = C), b(C);
|
|
3901
3906
|
},
|
|
3902
3907
|
placeholder: e.config.placeholder,
|
|
3903
|
-
class:
|
|
3908
|
+
class: Je({
|
|
3904
3909
|
optional: !!e.config.optional,
|
|
3905
3910
|
className: "w-full rounded-full"
|
|
3906
3911
|
})
|
|
3907
3912
|
}), e.config.optional && c(
|
|
3908
|
-
|
|
3913
|
+
De,
|
|
3909
3914
|
{
|
|
3910
3915
|
class: i ? "absolute bottom-1 right-0.5" : "absolute bottom-0 right-0.5 top-0",
|
|
3911
3916
|
onClick: () => r(null)
|
|
3912
3917
|
}
|
|
3913
3918
|
)]
|
|
3914
|
-
}), c(
|
|
3915
|
-
}),
|
|
3919
|
+
}), c($e, {})]
|
|
3920
|
+
}), k !== void 0 && m !== void 0 && c("p", {
|
|
3916
3921
|
id: "chat-input-count",
|
|
3917
3922
|
class: "text-neutral-10 px-3 text-right text-xs",
|
|
3918
|
-
children: [
|
|
3919
|
-
}), c(
|
|
3923
|
+
children: [k, "/", m]
|
|
3924
|
+
}), c(Ye, {
|
|
3920
3925
|
error: f.text
|
|
3921
3926
|
})]
|
|
3922
3927
|
});
|
|
3923
|
-
},
|
|
3924
|
-
text:
|
|
3925
|
-
phone:
|
|
3926
|
-
"multiple-choice":
|
|
3927
|
-
boolean:
|
|
3928
|
-
file:
|
|
3929
|
-
submit:
|
|
3930
|
-
address:
|
|
3931
|
-
number:
|
|
3932
|
-
},
|
|
3928
|
+
}, mi = {
|
|
3929
|
+
text: pi,
|
|
3930
|
+
phone: li,
|
|
3931
|
+
"multiple-choice": Ya,
|
|
3932
|
+
boolean: ma,
|
|
3933
|
+
file: _a,
|
|
3934
|
+
submit: ci,
|
|
3935
|
+
address: da,
|
|
3936
|
+
number: ti
|
|
3937
|
+
}, yi = ({
|
|
3933
3938
|
logger: e,
|
|
3934
3939
|
analytics: r
|
|
3935
3940
|
}) => {
|
|
3936
3941
|
var i;
|
|
3937
|
-
const t = (i =
|
|
3938
|
-
return
|
|
3942
|
+
const t = (i = U.current$.value.flow) == null ? void 0 : i.data.currentInput, n = ye(null), s = () => ce.onInteractionFn$.value();
|
|
3943
|
+
return Re(() => {
|
|
3939
3944
|
var a;
|
|
3940
3945
|
(a = n.current) == null || a.scrollTo({
|
|
3941
3946
|
top: 0
|
|
@@ -3948,11 +3953,11 @@ const Vr = 27, Mr = 12, Lr = 10, Ga = Ye("enum"), Ja = (e, r) => {
|
|
|
3948
3953
|
onPointerDownCapture: t ? s : void 0,
|
|
3949
3954
|
onKeyDownCapture: t ? s : void 0,
|
|
3950
3955
|
children: t ? (() => {
|
|
3951
|
-
const a =
|
|
3956
|
+
const a = mi[t.type];
|
|
3952
3957
|
return c(a, {
|
|
3953
3958
|
logger: e,
|
|
3954
3959
|
analytics: r,
|
|
3955
|
-
onSubmitSuccess:
|
|
3960
|
+
onSubmitSuccess: ce.onSubmitSuccessFn$.value,
|
|
3956
3961
|
input: t
|
|
3957
3962
|
});
|
|
3958
3963
|
})() : c("div", {
|
|
@@ -3960,12 +3965,12 @@ const Vr = 27, Mr = 12, Lr = 10, Ga = Ye("enum"), Ja = (e, r) => {
|
|
|
3960
3965
|
children: [c("input", {
|
|
3961
3966
|
"aria-hidden": "true",
|
|
3962
3967
|
id: "chat-input",
|
|
3963
|
-
class:
|
|
3968
|
+
class: Je({
|
|
3964
3969
|
optional: !1,
|
|
3965
3970
|
className: "flex-grow rounded-full"
|
|
3966
3971
|
}),
|
|
3967
3972
|
disabled: !0
|
|
3968
|
-
}), c(
|
|
3973
|
+
}), c($e, {
|
|
3969
3974
|
disabled: !0,
|
|
3970
3975
|
"aria-hidden": "true",
|
|
3971
3976
|
tabIndex: -1
|
|
@@ -3974,30 +3979,30 @@ const Vr = 27, Mr = 12, Lr = 10, Ga = Ye("enum"), Ja = (e, r) => {
|
|
|
3974
3979
|
})
|
|
3975
3980
|
});
|
|
3976
3981
|
};
|
|
3977
|
-
function
|
|
3982
|
+
function bi(e) {
|
|
3978
3983
|
return e && e.__esModule && Object.prototype.hasOwnProperty.call(e, "default") ? e.default : e;
|
|
3979
3984
|
}
|
|
3980
3985
|
var gi = function(e) {
|
|
3981
3986
|
return e instanceof RegExp;
|
|
3982
|
-
},
|
|
3987
|
+
}, vi = function(r) {
|
|
3983
3988
|
var t = /[\\^$.*+?()[\]{}|]/g, n = RegExp(t.source);
|
|
3984
3989
|
return r && n.test(r) ? r.replace(t, "\\$&") : r;
|
|
3985
3990
|
}, wn = function(e) {
|
|
3986
3991
|
return typeof e == "string";
|
|
3987
|
-
},
|
|
3992
|
+
}, xi = function(e) {
|
|
3988
3993
|
var r = [];
|
|
3989
3994
|
return e.forEach(function(t) {
|
|
3990
3995
|
Array.isArray(t) ? r = r.concat(t) : r.push(t);
|
|
3991
3996
|
}), r;
|
|
3992
3997
|
};
|
|
3993
|
-
function
|
|
3998
|
+
function wi(e, r, t) {
|
|
3994
3999
|
var n = 0, s = 0;
|
|
3995
4000
|
if (e === "")
|
|
3996
4001
|
return e;
|
|
3997
4002
|
if (!e || !wn(e))
|
|
3998
4003
|
throw new TypeError("First argument to react-string-replace#replaceString must be a string");
|
|
3999
4004
|
var i = r;
|
|
4000
|
-
gi(i) || (i = new RegExp("(" +
|
|
4005
|
+
gi(i) || (i = new RegExp("(" + vi(i) + ")", "gi"));
|
|
4001
4006
|
for (var a = e.split(i), o = 1, u = a.length; o < u; o += 2) {
|
|
4002
4007
|
if (a[o] === void 0 || a[o - 1] === void 0) {
|
|
4003
4008
|
console.warn("reactStringReplace: Encountered undefined value during string replacement. Your RegExp may not be working the way you expect.");
|
|
@@ -4007,33 +4012,33 @@ function xi(e, r, t) {
|
|
|
4007
4012
|
}
|
|
4008
4013
|
return a;
|
|
4009
4014
|
}
|
|
4010
|
-
var
|
|
4011
|
-
return Array.isArray(r) || (r = [r]),
|
|
4012
|
-
return wn(s) ?
|
|
4015
|
+
var _i = function(r, t, n) {
|
|
4016
|
+
return Array.isArray(r) || (r = [r]), xi(r.map(function(s) {
|
|
4017
|
+
return wn(s) ? wi(s, t, n) : s;
|
|
4013
4018
|
}));
|
|
4014
4019
|
};
|
|
4015
|
-
const
|
|
4016
|
-
const r =
|
|
4017
|
-
const [, f,
|
|
4018
|
-
return
|
|
4020
|
+
const st = /* @__PURE__ */ bi(_i), ki = /(\[[^\]]+\]\([^)]+\))/g, Ci = /\[([^\]]+)\]\(([^)]+)\)/, Si = /(https?:\/\/[^\s]+)/g, Ii = /_(.*?)_/g, Ai = /\*\*(.*?)\*\*/g, Ei = /(\\n|\n)/g, Tr = "text-accent-10 hover:text-accent-11 no-underline underline-offset-2 hover:underline", Fi = (e) => {
|
|
4021
|
+
const r = st(e, ki, (o, u) => {
|
|
4022
|
+
const [, f, b] = o.match(Ci) ?? [];
|
|
4023
|
+
return b ? c("a", {
|
|
4019
4024
|
class: Tr,
|
|
4020
|
-
href:
|
|
4021
|
-
children: f ??
|
|
4022
|
-
},
|
|
4025
|
+
href: b,
|
|
4026
|
+
children: f ?? b
|
|
4027
|
+
}, b + u) : c("span", {
|
|
4023
4028
|
children: "INVALID LINK"
|
|
4024
4029
|
});
|
|
4025
|
-
}), t =
|
|
4030
|
+
}), t = st(r, Si, (o, u) => c("a", {
|
|
4026
4031
|
class: Tr,
|
|
4027
4032
|
href: o,
|
|
4028
4033
|
children: o
|
|
4029
|
-
}, o + u)), n =
|
|
4034
|
+
}, o + u)), n = st(t, Ii, (o, u) => c("em", {
|
|
4030
4035
|
children: o
|
|
4031
|
-
}, o + u)), s =
|
|
4036
|
+
}, o + u)), s = st(n, Ai, (o, u) => c("strong", {
|
|
4032
4037
|
children: o
|
|
4033
4038
|
}, o + u));
|
|
4034
4039
|
let i = 0;
|
|
4035
|
-
return
|
|
4036
|
-
},
|
|
4040
|
+
return st(s, Ei, () => c("br", {}, `br-${i++}`));
|
|
4041
|
+
}, Vi = xt("select-text max-w-[min(100%,24rem)] [text-wrap:pretty] leading-snug flex-shrink min-w-[2rem] py-2 px-3 rounded-[18px] min-h-[36px] break-words relative", {
|
|
4037
4042
|
variants: {
|
|
4038
4043
|
side: {
|
|
4039
4044
|
left: "bg-bubble-weak-bg text-neutral-12 shadow-surface-sm outline outline-1 outline-bubble-weak rounded-bl-md",
|
|
@@ -4047,7 +4052,7 @@ const ot = /* @__PURE__ */ yi(wi), _i = /(\[[^\]]+\]\([^)]+\))/g, ki = /\[([^\]]
|
|
|
4047
4052
|
defaultVariants: {
|
|
4048
4053
|
side: "left"
|
|
4049
4054
|
}
|
|
4050
|
-
}),
|
|
4055
|
+
}), Mi = ({
|
|
4051
4056
|
children: e,
|
|
4052
4057
|
className: r,
|
|
4053
4058
|
animate: t,
|
|
@@ -4057,14 +4062,14 @@ const ot = /* @__PURE__ */ yi(wi), _i = /(\[[^\]]+\]\([^)]+\))/g, ki = /\[([^\]]
|
|
|
4057
4062
|
style: {
|
|
4058
4063
|
transformOrigin: n === "left" ? "0% 50%" : "100% 50%"
|
|
4059
4064
|
},
|
|
4060
|
-
class:
|
|
4065
|
+
class: Vi({
|
|
4061
4066
|
className: r,
|
|
4062
4067
|
side: n,
|
|
4063
4068
|
animate: t
|
|
4064
4069
|
}),
|
|
4065
4070
|
...s,
|
|
4066
4071
|
children: e
|
|
4067
|
-
}),
|
|
4072
|
+
}), Li = ({
|
|
4068
4073
|
message: e
|
|
4069
4074
|
}) => c("div", {
|
|
4070
4075
|
class: "bg-accent-3 flex w-full items-center justify-center overflow-hidden rounded-xl px-2 py-2",
|
|
@@ -4088,14 +4093,14 @@ const ot = /* @__PURE__ */ yi(wi), _i = /(\[[^\]]+\]\([^)]+\))/g, ki = /\[([^\]]
|
|
|
4088
4093
|
})
|
|
4089
4094
|
})]
|
|
4090
4095
|
})
|
|
4091
|
-
}),
|
|
4096
|
+
}), Ni = ({
|
|
4092
4097
|
className: e,
|
|
4093
4098
|
...r
|
|
4094
4099
|
}) => c("div", {
|
|
4095
4100
|
"aria-hidden": !0,
|
|
4096
|
-
children:
|
|
4101
|
+
children: ce.isBotTyping$.value === !0 ? c("div", {
|
|
4097
4102
|
"data-testid": "typing-indicator",
|
|
4098
|
-
class:
|
|
4103
|
+
class: Ze("flex gap-1 p-4", e),
|
|
4099
4104
|
...r,
|
|
4100
4105
|
children: Array.from({
|
|
4101
4106
|
length: 3
|
|
@@ -4106,10 +4111,10 @@ const ot = /* @__PURE__ */ yi(wi), _i = /(\[[^\]]+\]\([^)]+\))/g, ki = /\[([^\]]
|
|
|
4106
4111
|
}
|
|
4107
4112
|
}))
|
|
4108
4113
|
}) : void 0
|
|
4109
|
-
}),
|
|
4114
|
+
}), Ri = {
|
|
4110
4115
|
bot: "left",
|
|
4111
4116
|
user: "right"
|
|
4112
|
-
},
|
|
4117
|
+
}, Di = 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)]", {
|
|
4113
4118
|
variants: {
|
|
4114
4119
|
variant: {
|
|
4115
4120
|
info: "text-neutral-11",
|
|
@@ -4118,42 +4123,42 @@ const ot = /* @__PURE__ */ yi(wi), _i = /(\[[^\]]+\]\([^)]+\))/g, ki = /\[([^\]]
|
|
|
4118
4123
|
success: "text-system-success"
|
|
4119
4124
|
}
|
|
4120
4125
|
}
|
|
4121
|
-
}),
|
|
4126
|
+
}), Ti = ({
|
|
4122
4127
|
lastSentMessageFooter: e
|
|
4123
4128
|
}) => {
|
|
4124
4129
|
const {
|
|
4125
4130
|
t: r
|
|
4126
|
-
} =
|
|
4131
|
+
} = re(), t = U.current$.value.flow, n = (t == null ? void 0 : t.data.messages) ?? [], s = t ? Wt(t) : void 0;
|
|
4127
4132
|
return c("ol", {
|
|
4128
4133
|
"aria-label": r("chat_messages"),
|
|
4129
4134
|
"aria-live": "polite",
|
|
4130
4135
|
class: "mt-auto flex flex-col justify-end gap-2 p-2 pt-[calc(var(--header-height)+1rem)]",
|
|
4131
|
-
children: [n.map((i, a) => c(
|
|
4136
|
+
children: [n.map((i, a) => c(ke, {
|
|
4132
4137
|
children: c("li", {
|
|
4133
4138
|
class: "flex",
|
|
4134
4139
|
tabIndex: a === n.length - 1 ? -1 : void 0,
|
|
4135
|
-
children: [s && i.groupId === s && !n.slice(a + 1).some((o) => o.groupId === s) ? e : null,
|
|
4140
|
+
children: [s && i.groupId === s && !n.slice(a + 1).some((o) => o.groupId === s) ? e : null, zn(i).with({
|
|
4136
4141
|
type: "system"
|
|
4137
4142
|
}, (o) => c("p", {
|
|
4138
|
-
class:
|
|
4143
|
+
class: Di({
|
|
4139
4144
|
variant: o.variant
|
|
4140
4145
|
}),
|
|
4141
4146
|
children: o.text
|
|
4142
4147
|
})).with({
|
|
4143
4148
|
type: "text",
|
|
4144
|
-
author:
|
|
4149
|
+
author: Hn.union("bot", "user")
|
|
4145
4150
|
}, (o) => {
|
|
4146
|
-
const u = a === n.length - 1, f = o.author === "bot" ?
|
|
4147
|
-
return c(
|
|
4148
|
-
children: c(
|
|
4151
|
+
const u = a === n.length - 1, f = o.author === "bot" ? Fi(o.text) : o.text;
|
|
4152
|
+
return c(ke, {
|
|
4153
|
+
children: c(Mi, {
|
|
4149
4154
|
animate: u,
|
|
4150
|
-
side:
|
|
4155
|
+
side: Ri[o.author],
|
|
4151
4156
|
children: f
|
|
4152
4157
|
}, a)
|
|
4153
4158
|
});
|
|
4154
4159
|
}).with({
|
|
4155
4160
|
type: "link"
|
|
4156
|
-
}, (o) => c(
|
|
4161
|
+
}, (o) => c(Li, {
|
|
4157
4162
|
message: o
|
|
4158
4163
|
})).with({
|
|
4159
4164
|
type: "image"
|
|
@@ -4175,7 +4180,7 @@ const ot = /* @__PURE__ */ yi(wi), _i = /(\[[^\]]+\]\([^)]+\))/g, ki = /\[([^\]]
|
|
|
4175
4180
|
type: "loading"
|
|
4176
4181
|
}, (o) => {
|
|
4177
4182
|
const u = n[n.length - 1];
|
|
4178
|
-
return !(o === u) ||
|
|
4183
|
+
return !(o === u) || ce.isBotTyping$.value ? null : c("div", {
|
|
4179
4184
|
class: "flex flex-grow flex-col items-center justify-center gap-2",
|
|
4180
4185
|
children: [c(qt, {
|
|
4181
4186
|
"aria-hidden": o.text ? "true" : void 0,
|
|
@@ -4189,7 +4194,7 @@ const ot = /* @__PURE__ */ yi(wi), _i = /(\[[^\]]+\]\([^)]+\))/g, ki = /\[([^\]]
|
|
|
4189
4194
|
}).exhaustive()]
|
|
4190
4195
|
})
|
|
4191
4196
|
}, a)), c("li", {
|
|
4192
|
-
class:
|
|
4197
|
+
class: ce.captchaVisible$.value ? "flex" : "hidden",
|
|
4193
4198
|
children: c("div", {
|
|
4194
4199
|
"data-captcha-slot": !0,
|
|
4195
4200
|
tabIndex: -1,
|
|
@@ -4197,7 +4202,7 @@ const ot = /* @__PURE__ */ yi(wi), _i = /(\[[^\]]+\]\([^)]+\))/g, ki = /\[([^\]]
|
|
|
4197
4202
|
"aria-label": r("captcha_check"),
|
|
4198
4203
|
class: "w-full max-w-[min(100%,24rem)] rounded-md"
|
|
4199
4204
|
})
|
|
4200
|
-
}, "captcha"), c(
|
|
4205
|
+
}, "captcha"), c(Ni, {}, "typing")]
|
|
4201
4206
|
});
|
|
4202
4207
|
}, Pi = ({
|
|
4203
4208
|
logger: e,
|
|
@@ -4207,41 +4212,41 @@ const ot = /* @__PURE__ */ yi(wi), _i = /(\[[^\]]+\]\([^)]+\))/g, ki = /\[([^\]]
|
|
|
4207
4212
|
}) => {
|
|
4208
4213
|
const {
|
|
4209
4214
|
flow: s
|
|
4210
|
-
} =
|
|
4211
|
-
|
|
4212
|
-
const i =
|
|
4215
|
+
} = U.current$.value;
|
|
4216
|
+
je(s, "Flow is required to exist to show chatbot body");
|
|
4217
|
+
const i = U.viewState$.value, {
|
|
4213
4218
|
chatRef: a,
|
|
4214
4219
|
chatService: o
|
|
4215
|
-
} =
|
|
4220
|
+
} = Kn(), {
|
|
4216
4221
|
t: u
|
|
4217
|
-
} =
|
|
4218
|
-
return
|
|
4219
|
-
i === "maximised" &&
|
|
4220
|
-
}, [i]),
|
|
4221
|
-
var
|
|
4222
|
+
} = re(), [f, b] = we();
|
|
4223
|
+
return Re(() => {
|
|
4224
|
+
i === "maximised" && ce.scrollToEnd();
|
|
4225
|
+
}, [i]), Re(() => {
|
|
4226
|
+
var M;
|
|
4222
4227
|
const {
|
|
4223
4228
|
state: y,
|
|
4224
4229
|
flow: p
|
|
4225
|
-
} =
|
|
4230
|
+
} = U.current$.peek();
|
|
4226
4231
|
if (y !== "loaded")
|
|
4227
4232
|
throw new Error(u("invalid_state"));
|
|
4228
4233
|
let m = p.data.nodeHistory.at(-1);
|
|
4229
|
-
if (
|
|
4234
|
+
if (ce.scrollToEnd(), U.setInput(void 0), p.data.isFinished)
|
|
4230
4235
|
return;
|
|
4231
|
-
const
|
|
4232
|
-
const
|
|
4233
|
-
!
|
|
4236
|
+
const k = () => {
|
|
4237
|
+
const L = U.current$.peek().flow;
|
|
4238
|
+
!L || L.data.hasInteracted || (U.markAsInteracted(), ur(t, L, "FLOW_INTERACT"));
|
|
4234
4239
|
};
|
|
4235
|
-
|
|
4240
|
+
ce.onInteractionFn$.value = k, m === void 0 ? (m = Kr(s.nodes).id, U.setCurrentNodeId(m), ur(t, p, "FLOW_START")) : U.removeMessagesSentByNodeIds([m, jt]);
|
|
4236
4241
|
const {
|
|
4237
|
-
interpret:
|
|
4242
|
+
interpret: I,
|
|
4238
4243
|
abort: C,
|
|
4239
4244
|
undo: x
|
|
4240
|
-
} =
|
|
4245
|
+
} = ks({
|
|
4241
4246
|
context: s.context,
|
|
4242
4247
|
analytics: {
|
|
4243
4248
|
service: t,
|
|
4244
|
-
customProperties: (
|
|
4249
|
+
customProperties: (M = s.analytics) == null ? void 0 : M.customProperties
|
|
4245
4250
|
},
|
|
4246
4251
|
apiClient: r,
|
|
4247
4252
|
logger: e,
|
|
@@ -4250,47 +4255,47 @@ const ot = /* @__PURE__ */ yi(wi), _i = /(\[[^\]]+\]\([^)]+\))/g, ki = /\[([^\]]
|
|
|
4250
4255
|
chatService: o,
|
|
4251
4256
|
t: u,
|
|
4252
4257
|
getApplicationRecovery: () => {
|
|
4253
|
-
var
|
|
4254
|
-
return (
|
|
4258
|
+
var L;
|
|
4259
|
+
return (L = U.current$.peek().flow) == null ? void 0 : L.data.applicationRecovery;
|
|
4255
4260
|
},
|
|
4256
|
-
setApplicationRecovery:
|
|
4257
|
-
persistWriteBarrier: () =>
|
|
4261
|
+
setApplicationRecovery: U.setApplicationRecovery,
|
|
4262
|
+
persistWriteBarrier: () => U.persistWriteBarrier(p),
|
|
4258
4263
|
// We need to get fresh submissions, that’s why we call `peek` here.
|
|
4259
4264
|
getSubmissions: () => {
|
|
4260
|
-
var
|
|
4261
|
-
return (
|
|
4265
|
+
var L;
|
|
4266
|
+
return (L = U.current$.peek().flow) == null ? void 0 : L.data.submissions;
|
|
4262
4267
|
},
|
|
4263
|
-
onInterpret: (
|
|
4268
|
+
onInterpret: (L) => U.setCurrentNodeId(L.id),
|
|
4264
4269
|
onFlowEnd: async () => {
|
|
4265
|
-
var
|
|
4266
|
-
|
|
4267
|
-
const
|
|
4268
|
-
|
|
4270
|
+
var R;
|
|
4271
|
+
U.markAsFinished();
|
|
4272
|
+
const L = U.current$.peek().flow;
|
|
4273
|
+
je(L), t.log({
|
|
4269
4274
|
event: "FLOW_END",
|
|
4270
4275
|
properties: {
|
|
4271
4276
|
flow_id: s.id,
|
|
4272
4277
|
flow_version: s.version,
|
|
4273
|
-
flow_session_id:
|
|
4278
|
+
flow_session_id: L.data.flowSessionId,
|
|
4274
4279
|
flow_build: s.build,
|
|
4275
4280
|
job: s.job
|
|
4276
4281
|
},
|
|
4277
|
-
customProperties: (
|
|
4282
|
+
customProperties: (R = s.analytics) == null ? void 0 : R.customProperties
|
|
4278
4283
|
});
|
|
4279
4284
|
}
|
|
4280
|
-
}),
|
|
4281
|
-
|
|
4282
|
-
},
|
|
4283
|
-
return p.offerResume ?
|
|
4285
|
+
}), v = m, E = () => {
|
|
4286
|
+
b(() => x), I(v);
|
|
4287
|
+
}, N = new AbortController();
|
|
4288
|
+
return p.offerResume ? Hs({
|
|
4284
4289
|
chatService: o,
|
|
4285
4290
|
t: u,
|
|
4286
|
-
signal:
|
|
4287
|
-
}).then((
|
|
4288
|
-
|
|
4289
|
-
}) :
|
|
4290
|
-
|
|
4291
|
+
signal: N.signal
|
|
4292
|
+
}).then((L) => (U.settleResume(p), L ? E() : (U.restart(), Gn.flushStateData()))).catch((L) => {
|
|
4293
|
+
L instanceof jr || e.error("Resume prompt failed", L);
|
|
4294
|
+
}) : E(), () => {
|
|
4295
|
+
N.abort(), ce.onInteractionFn$.value === k && (ce.onInteractionFn$.value = () => {
|
|
4291
4296
|
}), C();
|
|
4292
4297
|
};
|
|
4293
|
-
}, [t, r, o, e, s, n, u]), c(
|
|
4298
|
+
}, [t, r, o, e, s, n, u]), c(ke, {
|
|
4294
4299
|
children: [c("div", {
|
|
4295
4300
|
class: "relative flex min-h-0 w-full max-w-full flex-grow flex-col",
|
|
4296
4301
|
children: [c("div", {
|
|
@@ -4302,36 +4307,36 @@ const ot = /* @__PURE__ */ yi(wi), _i = /(\[[^\]]+\]\([^)]+\))/g, ki = /\[([^\]]
|
|
|
4302
4307
|
style: {
|
|
4303
4308
|
WebkitOverflowScrolling: "touch"
|
|
4304
4309
|
},
|
|
4305
|
-
children: c(
|
|
4306
|
-
lastSentMessageFooter: !Wt(s) || !f ? null : c(
|
|
4310
|
+
children: c(Ti, {
|
|
4311
|
+
lastSentMessageFooter: !Wt(s) || !f ? null : c(Oi, {
|
|
4307
4312
|
undoFn: f
|
|
4308
4313
|
})
|
|
4309
4314
|
})
|
|
4310
|
-
}),
|
|
4315
|
+
}), ce.isReadingHistory$.value && !s.data.isFinished && !ce.isBotTyping$.value && c("div", {
|
|
4311
4316
|
class: "absolute bottom-2 left-1/2 -translate-x-1/2",
|
|
4312
4317
|
children: c(zr, {
|
|
4313
4318
|
class: "bg-neutral-1 ring-divider shadow-surface-md ring-1",
|
|
4314
4319
|
"aria-label": u("jump_to_current"),
|
|
4315
4320
|
onClick: () => {
|
|
4316
4321
|
var p, m;
|
|
4317
|
-
|
|
4322
|
+
ce.scrollToEnd(), (m = ((p = a.current) == null ? void 0 : p.querySelector('li[tabindex="-1"]')) ?? a.current) == null || m.focus({
|
|
4318
4323
|
preventScroll: !0
|
|
4319
4324
|
});
|
|
4320
4325
|
},
|
|
4321
|
-
children: c(
|
|
4326
|
+
children: c(Jn, {})
|
|
4322
4327
|
})
|
|
4323
4328
|
})]
|
|
4324
|
-
}), c(
|
|
4329
|
+
}), c(yi, {
|
|
4325
4330
|
logger: e,
|
|
4326
4331
|
analytics: t
|
|
4327
4332
|
})]
|
|
4328
4333
|
});
|
|
4329
|
-
},
|
|
4334
|
+
}, Oi = ({
|
|
4330
4335
|
undoFn: e
|
|
4331
4336
|
}) => {
|
|
4332
4337
|
const {
|
|
4333
4338
|
t: r
|
|
4334
|
-
} =
|
|
4339
|
+
} = re();
|
|
4335
4340
|
return c("div", {
|
|
4336
4341
|
class: "flex flex-1 items-center justify-end px-1",
|
|
4337
4342
|
children: c(zr, {
|
|
@@ -4339,8 +4344,8 @@ const ot = /* @__PURE__ */ yi(wi), _i = /(\[[^\]]+\]\([^)]+\))/g, ki = /\[([^\]]
|
|
|
4339
4344
|
onClick: async () => {
|
|
4340
4345
|
const {
|
|
4341
4346
|
flow: t
|
|
4342
|
-
} =
|
|
4343
|
-
|
|
4347
|
+
} = U.current$.peek();
|
|
4348
|
+
je(t), e(t.data.nodeHistory);
|
|
4344
4349
|
},
|
|
4345
4350
|
children: c("path", {
|
|
4346
4351
|
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"
|