@inploi/plugin-chatbot 4.1.1 → 4.1.2
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 +3 -3
- package/cdn/style.css +1 -1
- package/dist/{chatbot-body-d941017f.cjs → chatbot-body-0b71f113.cjs} +1 -1
- package/dist/{chatbot-body-38907c4e.js → chatbot-body-87199b8f.js} +538 -538
- package/dist/{index-4fe4e036.cjs → index-6f98abfb.cjs} +1 -1
- package/dist/{index-41ded41e.js → index-c974e995.js} +2 -2
- package/dist/plugin-chatbot.cjs +1 -1
- package/dist/plugin-chatbot.js +1 -1
- package/dist/style.css +1 -1
- package/package.json +3 -2
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { g as Ue, i as Yt, k as
|
|
1
|
+
import { g as Ue, i as Yt, k as Le, a as er, b as le, A as Fe, c as Ir, N as Ke, _ as V, d as tr, h as Y, e as re, p as ue, F as pt, u as G, o as l, f as De, j as dt, y as pe, s as M, l as Ze, m as he, n as Mr, q as at, r as ee, t as Fr, v as ke, w as Nr, x as rr, z as Lr, B as nr, C as Tr, D as Se, E as Q, G as Dr, V as Rr, H as sr, I as je, J as Te, K as Or, L as Br, M as Pr, O as $r, P as jr, Q as zr, R as qr, S as Ur, T as Kr, U as Gr } from "./index-c974e995.js";
|
|
2
2
|
import "@inploi/sdk";
|
|
3
3
|
const Ft = ({
|
|
4
4
|
condition: e,
|
|
@@ -6,20 +6,20 @@ const Ft = ({
|
|
|
6
6
|
submissions: r,
|
|
7
7
|
ifBlock: n
|
|
8
8
|
}) => {
|
|
9
|
-
const [
|
|
10
|
-
if (!
|
|
9
|
+
const [s, ...a] = e.compareKey.split(".");
|
|
10
|
+
if (!s)
|
|
11
11
|
return !1;
|
|
12
12
|
const i = ir({
|
|
13
13
|
context: t,
|
|
14
|
-
key:
|
|
15
|
-
path:
|
|
14
|
+
key: s,
|
|
15
|
+
path: a,
|
|
16
16
|
submissions: r
|
|
17
17
|
});
|
|
18
18
|
if (!i)
|
|
19
19
|
return !1;
|
|
20
20
|
switch (i.type) {
|
|
21
21
|
case "address": {
|
|
22
|
-
const u = Ue(i.value,
|
|
22
|
+
const u = Ue(i.value, a.join("."));
|
|
23
23
|
switch (e.compare) {
|
|
24
24
|
case "equals":
|
|
25
25
|
return u === e.compareValue;
|
|
@@ -35,7 +35,7 @@ const Ft = ({
|
|
|
35
35
|
case "integration": {
|
|
36
36
|
if (typeof i.value != "object" || Array.isArray(i.value))
|
|
37
37
|
return !1;
|
|
38
|
-
const u = Ue(i.value,
|
|
38
|
+
const u = Ue(i.value, a.join(".")), d = {
|
|
39
39
|
...n,
|
|
40
40
|
data: {
|
|
41
41
|
...n.data,
|
|
@@ -44,7 +44,7 @@ const Ft = ({
|
|
|
44
44
|
};
|
|
45
45
|
switch (typeof u) {
|
|
46
46
|
case "boolean":
|
|
47
|
-
return
|
|
47
|
+
return Ne(d, {
|
|
48
48
|
submissions: {
|
|
49
49
|
_temp: {
|
|
50
50
|
value: u,
|
|
@@ -54,7 +54,7 @@ const Ft = ({
|
|
|
54
54
|
context: t
|
|
55
55
|
});
|
|
56
56
|
case "string":
|
|
57
|
-
return
|
|
57
|
+
return Ne(d, {
|
|
58
58
|
submissions: {
|
|
59
59
|
_temp: {
|
|
60
60
|
value: u,
|
|
@@ -64,7 +64,7 @@ const Ft = ({
|
|
|
64
64
|
context: t
|
|
65
65
|
});
|
|
66
66
|
case "number":
|
|
67
|
-
return
|
|
67
|
+
return Ne(d, {
|
|
68
68
|
submissions: {
|
|
69
69
|
_temp: {
|
|
70
70
|
value: u,
|
|
@@ -74,7 +74,7 @@ const Ft = ({
|
|
|
74
74
|
context: t
|
|
75
75
|
});
|
|
76
76
|
case "object":
|
|
77
|
-
return Array.isArray(u) && u.every(Yt) ?
|
|
77
|
+
return Array.isArray(u) && u.every(Yt) ? Ne(d, {
|
|
78
78
|
submissions: {
|
|
79
79
|
_temp: {
|
|
80
80
|
value: u,
|
|
@@ -146,15 +146,15 @@ const Ft = ({
|
|
|
146
146
|
}
|
|
147
147
|
break;
|
|
148
148
|
}
|
|
149
|
-
},
|
|
149
|
+
}, Ne = (e, {
|
|
150
150
|
context: t,
|
|
151
151
|
submissions: r
|
|
152
152
|
}) => {
|
|
153
153
|
const n = "combinator" in e.data ? e.data.conditions : [e.data];
|
|
154
154
|
if (("combinator" in e.data ? e.data.combinator : "and") === "or") {
|
|
155
|
-
for (const
|
|
155
|
+
for (const a of n)
|
|
156
156
|
if (Ft({
|
|
157
|
-
condition:
|
|
157
|
+
condition: a,
|
|
158
158
|
context: t,
|
|
159
159
|
submissions: r,
|
|
160
160
|
ifBlock: e
|
|
@@ -162,9 +162,9 @@ const Ft = ({
|
|
|
162
162
|
return !0;
|
|
163
163
|
return !1;
|
|
164
164
|
} else {
|
|
165
|
-
for (const
|
|
165
|
+
for (const a of n)
|
|
166
166
|
if (!Ft({
|
|
167
|
-
condition:
|
|
167
|
+
condition: a,
|
|
168
168
|
context: t,
|
|
169
169
|
submissions: r,
|
|
170
170
|
ifBlock: e
|
|
@@ -175,48 +175,48 @@ const Ft = ({
|
|
|
175
175
|
}, Hr = /{{\s*([^}]+?)\s*(?:\|\s*([^}]+?)\s*)?}}/g, ne = (e, {
|
|
176
176
|
context: t,
|
|
177
177
|
submissions: r
|
|
178
|
-
}) => e.replace(Hr, (n,
|
|
179
|
-
const [i, ...u] =
|
|
178
|
+
}) => e.replace(Hr, (n, s, a = "") => {
|
|
179
|
+
const [i, ...u] = s.trim().split("."), d = ir({
|
|
180
180
|
key: i,
|
|
181
181
|
path: u,
|
|
182
182
|
submissions: r,
|
|
183
183
|
context: t
|
|
184
184
|
});
|
|
185
185
|
if (!d)
|
|
186
|
-
return
|
|
186
|
+
return a;
|
|
187
187
|
switch (d.type) {
|
|
188
188
|
case "boolean":
|
|
189
189
|
return d.value === !0 ? "true" : "false";
|
|
190
190
|
case "file":
|
|
191
|
-
return d.value.map((
|
|
191
|
+
return d.value.map((h) => `${h.name} (${Le(h.sizeKb)})`).join(", ");
|
|
192
192
|
case "enum":
|
|
193
193
|
return d.value.join(", ");
|
|
194
194
|
case "address":
|
|
195
|
-
return Object.values(d.value).filter((
|
|
195
|
+
return Object.values(d.value).filter((h) => h && h.trim().length > 0).join(", ");
|
|
196
196
|
case "number":
|
|
197
197
|
case "string":
|
|
198
|
-
return d.value ? d.value.toString() :
|
|
198
|
+
return d.value ? d.value.toString() : a;
|
|
199
199
|
case "phone":
|
|
200
200
|
return Xe(d.value);
|
|
201
201
|
case "integration": {
|
|
202
202
|
if (typeof d.value != "object" || Array.isArray(d.value))
|
|
203
203
|
break;
|
|
204
|
-
const
|
|
205
|
-
switch (typeof
|
|
204
|
+
const h = Ue(d.value, u.join("."));
|
|
205
|
+
switch (typeof h) {
|
|
206
206
|
case "boolean":
|
|
207
|
-
return
|
|
207
|
+
return h === !0 ? "true" : "false";
|
|
208
208
|
case "string":
|
|
209
|
-
return
|
|
209
|
+
return h;
|
|
210
210
|
case "number":
|
|
211
|
-
return
|
|
211
|
+
return h.toString();
|
|
212
212
|
case "object":
|
|
213
|
-
if (Array.isArray(
|
|
214
|
-
return
|
|
213
|
+
if (Array.isArray(h) && h.every(Yt))
|
|
214
|
+
return h.join(", ");
|
|
215
215
|
}
|
|
216
216
|
break;
|
|
217
217
|
}
|
|
218
218
|
}
|
|
219
|
-
return
|
|
219
|
+
return a;
|
|
220
220
|
}), ar = ({
|
|
221
221
|
node: e,
|
|
222
222
|
nodes: t,
|
|
@@ -224,7 +224,7 @@ const Ft = ({
|
|
|
224
224
|
}) => {
|
|
225
225
|
if ((r == null ? void 0 : r(e)) === !0)
|
|
226
226
|
return e;
|
|
227
|
-
const n = e.nextId ? t.find((
|
|
227
|
+
const n = e.nextId ? t.find((s) => s.id === e.nextId) : void 0;
|
|
228
228
|
if (n)
|
|
229
229
|
return ar({
|
|
230
230
|
node: n,
|
|
@@ -235,32 +235,32 @@ const Ft = ({
|
|
|
235
235
|
childNode: e,
|
|
236
236
|
nodes: t
|
|
237
237
|
}) => {
|
|
238
|
-
const n = t.filter((
|
|
239
|
-
if (!
|
|
238
|
+
const n = t.filter((s) => s.type === "if-block").find((s) => {
|
|
239
|
+
if (!s.branchId)
|
|
240
240
|
return !1;
|
|
241
|
-
const
|
|
242
|
-
if (!
|
|
241
|
+
const a = t.find((u) => u.id === s.branchId);
|
|
242
|
+
if (!a)
|
|
243
243
|
return !1;
|
|
244
244
|
const i = ar({
|
|
245
|
-
node:
|
|
245
|
+
node: a,
|
|
246
246
|
nodes: t,
|
|
247
247
|
stopWhen: (u) => u.id === e.id
|
|
248
248
|
});
|
|
249
249
|
return !(!i || i.id !== e.id);
|
|
250
250
|
});
|
|
251
251
|
if (n != null && n.nextId)
|
|
252
|
-
return t.find((
|
|
252
|
+
return t.find((s) => s.id === n.nextId);
|
|
253
253
|
}, Jr = ({
|
|
254
254
|
flow: e,
|
|
255
255
|
analytics: t,
|
|
256
256
|
logger: r,
|
|
257
257
|
context: n,
|
|
258
|
-
apiClient:
|
|
259
|
-
getSubmissions:
|
|
258
|
+
apiClient: s,
|
|
259
|
+
getSubmissions: a,
|
|
260
260
|
chatService: i,
|
|
261
261
|
onFlowEnd: u,
|
|
262
262
|
onInterpret: d,
|
|
263
|
-
t:
|
|
263
|
+
t: h
|
|
264
264
|
}) => {
|
|
265
265
|
let x = new AbortController();
|
|
266
266
|
const v = {
|
|
@@ -272,19 +272,19 @@ const Ft = ({
|
|
|
272
272
|
...t.customProperties
|
|
273
273
|
}
|
|
274
274
|
})
|
|
275
|
-
},
|
|
276
|
-
const A =
|
|
275
|
+
}, p = async (k, y) => {
|
|
276
|
+
const A = a();
|
|
277
277
|
d == null || d(k, y);
|
|
278
278
|
try {
|
|
279
279
|
await Zr({
|
|
280
280
|
flow: e,
|
|
281
281
|
analytics: v,
|
|
282
282
|
logger: r,
|
|
283
|
-
apiClient:
|
|
283
|
+
apiClient: s,
|
|
284
284
|
context: n,
|
|
285
285
|
node: k,
|
|
286
286
|
submissions: A,
|
|
287
|
-
t:
|
|
287
|
+
t: h,
|
|
288
288
|
chat: {
|
|
289
289
|
sendMessage: async (S) => i.send({
|
|
290
290
|
groupId: k.id,
|
|
@@ -302,12 +302,12 @@ const Ft = ({
|
|
|
302
302
|
childNode: k,
|
|
303
303
|
nodes: e.nodes
|
|
304
304
|
});
|
|
305
|
-
return E ?
|
|
305
|
+
return E ? p(E, k) : u == null ? void 0 : u(k);
|
|
306
306
|
},
|
|
307
307
|
end: () => u == null ? void 0 : u(k)
|
|
308
308
|
});
|
|
309
309
|
} catch (S) {
|
|
310
|
-
if (S instanceof
|
|
310
|
+
if (S instanceof Fe)
|
|
311
311
|
return;
|
|
312
312
|
throw S;
|
|
313
313
|
}
|
|
@@ -315,7 +315,7 @@ const Ft = ({
|
|
|
315
315
|
return {
|
|
316
316
|
interpret: async (k) => {
|
|
317
317
|
const y = e.nodes.find((A) => A.id === k) ?? er(e.nodes);
|
|
318
|
-
return
|
|
318
|
+
return p(y);
|
|
319
319
|
},
|
|
320
320
|
undo: (k) => {
|
|
321
321
|
let y = 1;
|
|
@@ -327,7 +327,7 @@ const Ft = ({
|
|
|
327
327
|
}
|
|
328
328
|
x.abort(), x = new AbortController();
|
|
329
329
|
const S = e.nodes.find((E) => E.id === k[k.length - y]);
|
|
330
|
-
return le(S, "Undo failed: new start node not found"),
|
|
330
|
+
return le(S, "Undo failed: new start node not found"), p(S, A), {
|
|
331
331
|
removed: y
|
|
332
332
|
};
|
|
333
333
|
},
|
|
@@ -448,7 +448,7 @@ async function Qr({
|
|
|
448
448
|
node: t,
|
|
449
449
|
analytics: r,
|
|
450
450
|
submissions: n,
|
|
451
|
-
logger:
|
|
451
|
+
logger: s
|
|
452
452
|
}) {
|
|
453
453
|
if (!n)
|
|
454
454
|
return e(t.nextId);
|
|
@@ -462,16 +462,16 @@ async function Qr({
|
|
|
462
462
|
email: t.data.email ? Ve(n, t.data.email).toString() : void 0,
|
|
463
463
|
phone_number: t.data.phoneNumber ? Ve(n, t.data.phoneNumber).toString() : void 0,
|
|
464
464
|
custom_traits: t.data.customTraits ? Object.fromEntries(t.data.customTraits.map(({
|
|
465
|
-
key:
|
|
465
|
+
key: a,
|
|
466
466
|
value: i
|
|
467
467
|
}) => {
|
|
468
468
|
var u;
|
|
469
|
-
return [
|
|
469
|
+
return [a, (u = n[i]) == null ? void 0 : u.value];
|
|
470
470
|
})) : void 0
|
|
471
471
|
}
|
|
472
472
|
});
|
|
473
|
-
} catch (
|
|
474
|
-
|
|
473
|
+
} catch (a) {
|
|
474
|
+
s.error(a);
|
|
475
475
|
} finally {
|
|
476
476
|
e(t.nextId);
|
|
477
477
|
}
|
|
@@ -487,7 +487,7 @@ async function en({
|
|
|
487
487
|
node: t,
|
|
488
488
|
logger: r,
|
|
489
489
|
submissions: n,
|
|
490
|
-
context:
|
|
490
|
+
context: s
|
|
491
491
|
}) {
|
|
492
492
|
if (!n) {
|
|
493
493
|
r.error("Submissions not found");
|
|
@@ -497,7 +497,7 @@ async function en({
|
|
|
497
497
|
type: "string",
|
|
498
498
|
value: ne(t.data.value, {
|
|
499
499
|
submissions: n,
|
|
500
|
-
context:
|
|
500
|
+
context: s
|
|
501
501
|
})
|
|
502
502
|
}, e(t.nextId);
|
|
503
503
|
}
|
|
@@ -506,13 +506,13 @@ async function tn({
|
|
|
506
506
|
next: t,
|
|
507
507
|
node: r,
|
|
508
508
|
logger: n,
|
|
509
|
-
apiClient:
|
|
510
|
-
submissions:
|
|
509
|
+
apiClient: s,
|
|
510
|
+
submissions: a,
|
|
511
511
|
analytics: i,
|
|
512
512
|
flow: u,
|
|
513
513
|
t: d
|
|
514
514
|
}) {
|
|
515
|
-
const
|
|
515
|
+
const h = async (x) => {
|
|
516
516
|
x !== !0 && await e.userInput({
|
|
517
517
|
type: "submit",
|
|
518
518
|
key: void 0,
|
|
@@ -524,16 +524,16 @@ async function tn({
|
|
|
524
524
|
});
|
|
525
525
|
const {
|
|
526
526
|
anonymous_id: v,
|
|
527
|
-
session_id:
|
|
528
|
-
} = i.getSessionInfo(), k = await
|
|
527
|
+
session_id: p
|
|
528
|
+
} = i.getSessionInfo(), k = await s.fetch("/flow/submit", {
|
|
529
529
|
method: "POST",
|
|
530
530
|
body: JSON.stringify({
|
|
531
531
|
log_submit: !1,
|
|
532
532
|
integration_id: r.data.integrationId,
|
|
533
533
|
anonymous_id: v,
|
|
534
|
-
session_id:
|
|
534
|
+
session_id: p,
|
|
535
535
|
job: u.job,
|
|
536
|
-
submissions: Ir(
|
|
536
|
+
submissions: Ir(a || {})
|
|
537
537
|
})
|
|
538
538
|
}).catch((y) => y);
|
|
539
539
|
r.data.key && e.addToSubmissions(r.data.key, {
|
|
@@ -597,7 +597,7 @@ async function tn({
|
|
|
597
597
|
href: A.toString(),
|
|
598
598
|
text: y.redirect.button_text ?? d("complete_submission"),
|
|
599
599
|
onClick: () => {
|
|
600
|
-
if (!
|
|
600
|
+
if (!p) {
|
|
601
601
|
n.error("session_id not set, cannot log FLOW_REDIRECT event");
|
|
602
602
|
return;
|
|
603
603
|
}
|
|
@@ -606,7 +606,7 @@ async function tn({
|
|
|
606
606
|
properties: {
|
|
607
607
|
flow_build: u.build,
|
|
608
608
|
flow_id: u.id,
|
|
609
|
-
flow_session_id:
|
|
609
|
+
flow_session_id: p,
|
|
610
610
|
flow_version: u.version,
|
|
611
611
|
href: A.toString(),
|
|
612
612
|
job: u.job
|
|
@@ -648,33 +648,33 @@ async function tn({
|
|
|
648
648
|
type: "system",
|
|
649
649
|
variant: "error",
|
|
650
650
|
text: ((A = y.error) == null ? void 0 : A.message) || d("submission_failed")
|
|
651
|
-
}), await
|
|
651
|
+
}), await h(!1);
|
|
652
652
|
}).otherwise(async (y) => {
|
|
653
653
|
n.error(y), await e.sendMessage({
|
|
654
654
|
type: "system",
|
|
655
655
|
variant: "error",
|
|
656
656
|
text: d("submission_failed")
|
|
657
|
-
}), await
|
|
657
|
+
}), await h(!1);
|
|
658
658
|
});
|
|
659
659
|
};
|
|
660
|
-
await
|
|
660
|
+
await h(r.data.skipConfirmation);
|
|
661
661
|
}
|
|
662
662
|
async function rn({
|
|
663
663
|
chat: e,
|
|
664
664
|
next: t,
|
|
665
665
|
node: r,
|
|
666
666
|
submissions: n,
|
|
667
|
-
context:
|
|
667
|
+
context: s
|
|
668
668
|
}) {
|
|
669
669
|
await e.sendMessage({
|
|
670
670
|
type: "link",
|
|
671
671
|
href: ne(r.data.href, {
|
|
672
672
|
submissions: n,
|
|
673
|
-
context:
|
|
673
|
+
context: s
|
|
674
674
|
}),
|
|
675
675
|
text: ne(r.data.cta, {
|
|
676
676
|
submissions: n,
|
|
677
|
-
context:
|
|
677
|
+
context: s
|
|
678
678
|
})
|
|
679
679
|
}), t(r.nextId);
|
|
680
680
|
}
|
|
@@ -684,7 +684,7 @@ async function nn({
|
|
|
684
684
|
node: r,
|
|
685
685
|
context: n
|
|
686
686
|
}) {
|
|
687
|
-
t(
|
|
687
|
+
t(Ne(r, {
|
|
688
688
|
submissions: e,
|
|
689
689
|
context: n
|
|
690
690
|
}) ? r.branchId : r.nextId);
|
|
@@ -694,14 +694,14 @@ async function sn({
|
|
|
694
694
|
next: t,
|
|
695
695
|
node: r,
|
|
696
696
|
submissions: n,
|
|
697
|
-
context:
|
|
697
|
+
context: s
|
|
698
698
|
}) {
|
|
699
699
|
await e.sendMessage({
|
|
700
700
|
author: "bot",
|
|
701
701
|
type: "text",
|
|
702
702
|
text: ne(r.data.text, {
|
|
703
703
|
submissions: n,
|
|
704
|
-
context:
|
|
704
|
+
context: s
|
|
705
705
|
})
|
|
706
706
|
}), t(r.nextId);
|
|
707
707
|
}
|
|
@@ -723,15 +723,15 @@ async function on({
|
|
|
723
723
|
next: t,
|
|
724
724
|
node: r,
|
|
725
725
|
submissions: n,
|
|
726
|
-
context:
|
|
727
|
-
t:
|
|
726
|
+
context: s,
|
|
727
|
+
t: a
|
|
728
728
|
}) {
|
|
729
729
|
await e.sendMessage({
|
|
730
730
|
author: "bot",
|
|
731
731
|
type: "text",
|
|
732
732
|
text: ne(r.data.question, {
|
|
733
733
|
submissions: n,
|
|
734
|
-
context:
|
|
734
|
+
context: s
|
|
735
735
|
})
|
|
736
736
|
});
|
|
737
737
|
const i = r.data.format === "phone" ? await e.userInput({
|
|
@@ -758,7 +758,7 @@ async function on({
|
|
|
758
758
|
i === null ? await e.sendMessage({
|
|
759
759
|
type: "system",
|
|
760
760
|
variant: "info",
|
|
761
|
-
text:
|
|
761
|
+
text: a("skipped")
|
|
762
762
|
}) : await e.sendMessage({
|
|
763
763
|
author: "user",
|
|
764
764
|
type: "text",
|
|
@@ -770,15 +770,15 @@ async function ln({
|
|
|
770
770
|
next: t,
|
|
771
771
|
node: r,
|
|
772
772
|
submissions: n,
|
|
773
|
-
context:
|
|
774
|
-
t:
|
|
773
|
+
context: s,
|
|
774
|
+
t: a
|
|
775
775
|
}) {
|
|
776
776
|
await e.sendMessage({
|
|
777
777
|
author: "bot",
|
|
778
778
|
type: "text",
|
|
779
779
|
text: ne(r.data.question, {
|
|
780
780
|
submissions: n,
|
|
781
|
-
context:
|
|
781
|
+
context: s
|
|
782
782
|
})
|
|
783
783
|
});
|
|
784
784
|
const i = await e.userInput({
|
|
@@ -795,7 +795,7 @@ async function ln({
|
|
|
795
795
|
i === null ? await e.sendMessage({
|
|
796
796
|
type: "system",
|
|
797
797
|
variant: "info",
|
|
798
|
-
text:
|
|
798
|
+
text: a("skipped")
|
|
799
799
|
}) : await e.sendMessage({
|
|
800
800
|
author: "user",
|
|
801
801
|
type: "text",
|
|
@@ -807,17 +807,17 @@ async function un({
|
|
|
807
807
|
next: t,
|
|
808
808
|
node: r,
|
|
809
809
|
submissions: n,
|
|
810
|
-
context:
|
|
810
|
+
context: s
|
|
811
811
|
}) {
|
|
812
812
|
await e.sendMessage({
|
|
813
813
|
author: "bot",
|
|
814
814
|
type: "text",
|
|
815
815
|
text: ne(r.data.question, {
|
|
816
816
|
submissions: n,
|
|
817
|
-
context:
|
|
817
|
+
context: s
|
|
818
818
|
})
|
|
819
819
|
});
|
|
820
|
-
const
|
|
820
|
+
const a = await e.userInput({
|
|
821
821
|
key: r.data.key,
|
|
822
822
|
type: "phone",
|
|
823
823
|
config: {
|
|
@@ -830,14 +830,14 @@ async function un({
|
|
|
830
830
|
optional: r.data.optional
|
|
831
831
|
}
|
|
832
832
|
});
|
|
833
|
-
|
|
833
|
+
a === null ? await e.sendMessage({
|
|
834
834
|
type: "system",
|
|
835
835
|
variant: "info",
|
|
836
836
|
text: "Skipped"
|
|
837
837
|
}) : await e.sendMessage({
|
|
838
838
|
author: "user",
|
|
839
839
|
type: "text",
|
|
840
|
-
text:
|
|
840
|
+
text: a.type === "phone" ? Xe(a.value) : a.value
|
|
841
841
|
}), t(r.nextId);
|
|
842
842
|
}
|
|
843
843
|
async function cn({
|
|
@@ -845,15 +845,15 @@ async function cn({
|
|
|
845
845
|
next: t,
|
|
846
846
|
node: r,
|
|
847
847
|
submissions: n,
|
|
848
|
-
context:
|
|
849
|
-
t:
|
|
848
|
+
context: s,
|
|
849
|
+
t: a
|
|
850
850
|
}) {
|
|
851
851
|
await e.sendMessage({
|
|
852
852
|
author: "bot",
|
|
853
853
|
type: "text",
|
|
854
854
|
text: ne(r.data.question, {
|
|
855
855
|
submissions: n,
|
|
856
|
-
context:
|
|
856
|
+
context: s
|
|
857
857
|
})
|
|
858
858
|
});
|
|
859
859
|
const i = await e.userInput({
|
|
@@ -864,7 +864,7 @@ async function cn({
|
|
|
864
864
|
i.value.length === 0 ? await e.sendMessage({
|
|
865
865
|
type: "system",
|
|
866
866
|
variant: "info",
|
|
867
|
-
text:
|
|
867
|
+
text: a("skipped")
|
|
868
868
|
}) : await e.sendMessage({
|
|
869
869
|
author: "user",
|
|
870
870
|
type: "text",
|
|
@@ -876,15 +876,15 @@ async function dn({
|
|
|
876
876
|
next: t,
|
|
877
877
|
node: r,
|
|
878
878
|
submissions: n,
|
|
879
|
-
context:
|
|
880
|
-
t:
|
|
879
|
+
context: s,
|
|
880
|
+
t: a
|
|
881
881
|
}) {
|
|
882
882
|
await e.sendMessage({
|
|
883
883
|
author: "bot",
|
|
884
884
|
type: "text",
|
|
885
885
|
text: ne(r.data.question, {
|
|
886
886
|
submissions: n,
|
|
887
|
-
context:
|
|
887
|
+
context: s
|
|
888
888
|
})
|
|
889
889
|
});
|
|
890
890
|
const i = await e.userInput({
|
|
@@ -901,7 +901,7 @@ async function dn({
|
|
|
901
901
|
i === null ? await e.sendMessage({
|
|
902
902
|
type: "system",
|
|
903
903
|
variant: "info",
|
|
904
|
-
text:
|
|
904
|
+
text: a("skipped")
|
|
905
905
|
}) : await e.sendMessage({
|
|
906
906
|
author: "user",
|
|
907
907
|
type: "text",
|
|
@@ -919,7 +919,7 @@ async function fn({
|
|
|
919
919
|
type: "text",
|
|
920
920
|
text: r.data.question
|
|
921
921
|
});
|
|
922
|
-
const
|
|
922
|
+
const s = await e.userInput({
|
|
923
923
|
type: "address",
|
|
924
924
|
key: r.data.key,
|
|
925
925
|
config: {
|
|
@@ -928,18 +928,18 @@ async function fn({
|
|
|
928
928
|
placeholder: r.data.placeholder
|
|
929
929
|
}
|
|
930
930
|
});
|
|
931
|
-
if (
|
|
931
|
+
if (s === null)
|
|
932
932
|
await e.sendMessage({
|
|
933
933
|
type: "system",
|
|
934
934
|
variant: "info",
|
|
935
935
|
text: n("skipped")
|
|
936
936
|
});
|
|
937
937
|
else {
|
|
938
|
-
const
|
|
938
|
+
const a = Object.values(s.value).filter((i) => i && i.trim().length > 0).join(", ");
|
|
939
939
|
await e.sendMessage({
|
|
940
940
|
author: "user",
|
|
941
941
|
type: "text",
|
|
942
|
-
text:
|
|
942
|
+
text: a
|
|
943
943
|
});
|
|
944
944
|
}
|
|
945
945
|
return t(r.nextId);
|
|
@@ -949,15 +949,15 @@ async function hn({
|
|
|
949
949
|
chat: t,
|
|
950
950
|
next: r,
|
|
951
951
|
submissions: n,
|
|
952
|
-
context:
|
|
953
|
-
t:
|
|
952
|
+
context: s,
|
|
953
|
+
t: a
|
|
954
954
|
}) {
|
|
955
955
|
await t.sendMessage({
|
|
956
956
|
author: "bot",
|
|
957
957
|
type: "text",
|
|
958
958
|
text: ne(e.data.question, {
|
|
959
959
|
submissions: n,
|
|
960
|
-
context:
|
|
960
|
+
context: s
|
|
961
961
|
})
|
|
962
962
|
});
|
|
963
963
|
const i = await t.userInput({
|
|
@@ -975,7 +975,7 @@ async function hn({
|
|
|
975
975
|
await t.sendMessage({
|
|
976
976
|
type: "system",
|
|
977
977
|
variant: "info",
|
|
978
|
-
text:
|
|
978
|
+
text: a("skipped")
|
|
979
979
|
});
|
|
980
980
|
else
|
|
981
981
|
for (const u of i.value)
|
|
@@ -1007,47 +1007,47 @@ const ir = ({
|
|
|
1007
1007
|
if (e === "$context") {
|
|
1008
1008
|
if (!t)
|
|
1009
1009
|
return;
|
|
1010
|
-
const
|
|
1011
|
-
switch (typeof
|
|
1010
|
+
const s = Ue(n, t.join("."));
|
|
1011
|
+
switch (typeof s) {
|
|
1012
1012
|
case "string":
|
|
1013
1013
|
return {
|
|
1014
1014
|
type: "string",
|
|
1015
|
-
value:
|
|
1015
|
+
value: s
|
|
1016
1016
|
};
|
|
1017
1017
|
case "number":
|
|
1018
1018
|
return {
|
|
1019
1019
|
type: "number",
|
|
1020
|
-
value:
|
|
1020
|
+
value: s
|
|
1021
1021
|
};
|
|
1022
1022
|
case "boolean":
|
|
1023
1023
|
return {
|
|
1024
1024
|
type: "boolean",
|
|
1025
|
-
value:
|
|
1025
|
+
value: s
|
|
1026
1026
|
};
|
|
1027
1027
|
default:
|
|
1028
|
-
console.warn(`Unexpected type for $context.${t.join(".")}`,
|
|
1028
|
+
console.warn(`Unexpected type for $context.${t.join(".")}`, s);
|
|
1029
1029
|
return;
|
|
1030
1030
|
}
|
|
1031
1031
|
}
|
|
1032
1032
|
return r == null ? void 0 : r[e];
|
|
1033
1033
|
};
|
|
1034
1034
|
function ft(e, t, r) {
|
|
1035
|
-
var n,
|
|
1035
|
+
var n, s, a, i, u;
|
|
1036
1036
|
t == null && (t = 100);
|
|
1037
1037
|
function d() {
|
|
1038
1038
|
var x = Date.now() - i;
|
|
1039
|
-
x < t && x >= 0 ? n = setTimeout(d, t - x) : (n = null, r || (u = e.apply(
|
|
1039
|
+
x < t && x >= 0 ? n = setTimeout(d, t - x) : (n = null, r || (u = e.apply(a, s), a = s = null));
|
|
1040
1040
|
}
|
|
1041
|
-
var
|
|
1042
|
-
|
|
1041
|
+
var h = function() {
|
|
1042
|
+
a = this, s = arguments, i = Date.now();
|
|
1043
1043
|
var x = r && !n;
|
|
1044
|
-
return n || (n = setTimeout(d, t)), x && (u = e.apply(
|
|
1044
|
+
return n || (n = setTimeout(d, t)), x && (u = e.apply(a, s), a = s = null), u;
|
|
1045
1045
|
};
|
|
1046
|
-
return
|
|
1046
|
+
return h.clear = function() {
|
|
1047
1047
|
n && (clearTimeout(n), n = null);
|
|
1048
|
-
},
|
|
1049
|
-
n && (u = e.apply(
|
|
1050
|
-
},
|
|
1048
|
+
}, h.flush = function() {
|
|
1049
|
+
n && (u = e.apply(a, s), a = s = null, clearTimeout(n), n = null);
|
|
1050
|
+
}, h;
|
|
1051
1051
|
}
|
|
1052
1052
|
ft.debounce = ft;
|
|
1053
1053
|
var mn = ft;
|
|
@@ -1057,15 +1057,15 @@ function gn(e) {
|
|
|
1057
1057
|
debounce: t,
|
|
1058
1058
|
scroll: r,
|
|
1059
1059
|
polyfill: n,
|
|
1060
|
-
offsetSize:
|
|
1060
|
+
offsetSize: s
|
|
1061
1061
|
} = e === void 0 ? {
|
|
1062
1062
|
debounce: 0,
|
|
1063
1063
|
scroll: !1,
|
|
1064
1064
|
offsetSize: !1
|
|
1065
1065
|
} : e;
|
|
1066
|
-
const
|
|
1066
|
+
const a = n || (typeof window > "u" ? class {
|
|
1067
1067
|
} : window.ResizeObserver);
|
|
1068
|
-
if (!
|
|
1068
|
+
if (!a)
|
|
1069
1069
|
throw new Error("This browser does not support ResizeObserver out of the box. See: https://github.com/react-spring/react-use-measure/#resize-observer-polyfills");
|
|
1070
1070
|
const [i, u] = Y({
|
|
1071
1071
|
left: 0,
|
|
@@ -1081,9 +1081,9 @@ function gn(e) {
|
|
|
1081
1081
|
scrollContainers: null,
|
|
1082
1082
|
resizeObserver: null,
|
|
1083
1083
|
lastBounds: i
|
|
1084
|
-
}),
|
|
1084
|
+
}), h = t ? typeof t == "number" ? t : t.scroll : null, x = t ? typeof t == "number" ? t : t.resize : null, v = re(!1);
|
|
1085
1085
|
ue(() => (v.current = !0, () => void (v.current = !1)));
|
|
1086
|
-
const [
|
|
1086
|
+
const [p, k, y] = pt(() => {
|
|
1087
1087
|
const g = () => {
|
|
1088
1088
|
if (!d.current.element)
|
|
1089
1089
|
return;
|
|
@@ -1106,15 +1106,15 @@ function gn(e) {
|
|
|
1106
1106
|
x: H,
|
|
1107
1107
|
y: se
|
|
1108
1108
|
};
|
|
1109
|
-
d.current.element instanceof HTMLElement &&
|
|
1109
|
+
d.current.element instanceof HTMLElement && s && (q.height = d.current.element.offsetHeight, q.width = d.current.element.offsetWidth), Object.freeze(q), v.current && !xn(d.current.lastBounds, q) && u(d.current.lastBounds = q);
|
|
1110
1110
|
};
|
|
1111
|
-
return [g, x ? Nt(g, x) : g,
|
|
1112
|
-
}, [u,
|
|
1111
|
+
return [g, x ? Nt(g, x) : g, h ? Nt(g, h) : g];
|
|
1112
|
+
}, [u, s, h, x]);
|
|
1113
1113
|
function A() {
|
|
1114
1114
|
d.current.scrollContainers && (d.current.scrollContainers.forEach((g) => g.removeEventListener("scroll", y, !0)), d.current.scrollContainers = null), d.current.resizeObserver && (d.current.resizeObserver.disconnect(), d.current.resizeObserver = null);
|
|
1115
1115
|
}
|
|
1116
1116
|
function S() {
|
|
1117
|
-
d.current.element && (d.current.resizeObserver = new
|
|
1117
|
+
d.current.element && (d.current.resizeObserver = new a(y), d.current.resizeObserver.observe(d.current.element), r && d.current.scrollContainers && d.current.scrollContainers.forEach((g) => g.addEventListener("scroll", y, {
|
|
1118
1118
|
capture: !0,
|
|
1119
1119
|
passive: !0
|
|
1120
1120
|
})));
|
|
@@ -1124,7 +1124,7 @@ function gn(e) {
|
|
|
1124
1124
|
};
|
|
1125
1125
|
return yn(y, !!r), bn(k), ue(() => {
|
|
1126
1126
|
A(), S();
|
|
1127
|
-
}, [r, y, k]), ue(() => A, []), [E, i,
|
|
1127
|
+
}, [r, y, k]), ue(() => A, []), [E, i, p];
|
|
1128
1128
|
}
|
|
1129
1129
|
function bn(e) {
|
|
1130
1130
|
ue(() => {
|
|
@@ -1150,9 +1150,9 @@ function or(e) {
|
|
|
1150
1150
|
const {
|
|
1151
1151
|
overflow: r,
|
|
1152
1152
|
overflowX: n,
|
|
1153
|
-
overflowY:
|
|
1153
|
+
overflowY: s
|
|
1154
1154
|
} = window.getComputedStyle(e);
|
|
1155
|
-
return [r, n,
|
|
1155
|
+
return [r, n, s].some((a) => a === "auto" || a === "scroll") && t.push(e), [...t, ...or(e.parentElement)];
|
|
1156
1156
|
}
|
|
1157
1157
|
const vn = ["x", "y", "top", "bottom", "left", "right", "width", "height"], xn = (e, t) => vn.every((r) => e[r] === t[r]), ye = ({
|
|
1158
1158
|
class: e,
|
|
@@ -1162,7 +1162,7 @@ const vn = ["x", "y", "top", "bottom", "left", "right", "width", "height"], xn =
|
|
|
1162
1162
|
t: r
|
|
1163
1163
|
} = G();
|
|
1164
1164
|
return l("button", {
|
|
1165
|
-
class:
|
|
1165
|
+
class: De("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),
|
|
1166
1166
|
type: "submit",
|
|
1167
1167
|
...t,
|
|
1168
1168
|
children: l("svg", {
|
|
@@ -1216,39 +1216,39 @@ const vn = ["x", "y", "top", "bottom", "left", "right", "width", "height"], xn =
|
|
|
1216
1216
|
};
|
|
1217
1217
|
}, [e]);
|
|
1218
1218
|
const t = pt(() => ({
|
|
1219
|
-
addToSubmissions: (n,
|
|
1219
|
+
addToSubmissions: (n, s) => M.setSubmission(n, s),
|
|
1220
1220
|
send: async ({
|
|
1221
1221
|
message: n,
|
|
1222
|
-
signal:
|
|
1223
|
-
groupId:
|
|
1222
|
+
signal: s,
|
|
1223
|
+
groupId: a
|
|
1224
1224
|
}) => {
|
|
1225
1225
|
if (await Ke(n).with({
|
|
1226
1226
|
author: "bot",
|
|
1227
1227
|
type: "text"
|
|
1228
1228
|
}, async (i) => {
|
|
1229
|
-
if (
|
|
1230
|
-
throw new
|
|
1229
|
+
if (s != null && s.aborted)
|
|
1230
|
+
throw new Fe();
|
|
1231
1231
|
z.isBotTyping$.value = !0;
|
|
1232
1232
|
const u = Math.min(Math.max(20, i.text.length), 100) * wn;
|
|
1233
1233
|
await new Promise((d) => setTimeout(d, u, {
|
|
1234
|
-
signal:
|
|
1234
|
+
signal: s
|
|
1235
1235
|
})), z.isBotTyping$.value = !1;
|
|
1236
1236
|
}).otherwise(async () => {
|
|
1237
|
-
}),
|
|
1238
|
-
throw new
|
|
1239
|
-
M.addMessage(n,
|
|
1237
|
+
}), s != null && s.aborted)
|
|
1238
|
+
throw new Fe();
|
|
1239
|
+
M.addMessage(n, a);
|
|
1240
1240
|
},
|
|
1241
1241
|
input: ({
|
|
1242
1242
|
input: n,
|
|
1243
|
-
signal:
|
|
1243
|
+
signal: s
|
|
1244
1244
|
}) => {
|
|
1245
|
-
if (
|
|
1246
|
-
throw new
|
|
1247
|
-
return M.setInput(n), new Promise((
|
|
1245
|
+
if (s != null && s.aborted)
|
|
1246
|
+
throw new Fe();
|
|
1247
|
+
return M.setInput(n), new Promise((a) => {
|
|
1248
1248
|
const i = (u) => {
|
|
1249
|
-
if (
|
|
1250
|
-
throw new
|
|
1251
|
-
M.setInput(void 0), n.key && M.setSubmission(n.key, u),
|
|
1249
|
+
if (s != null && s.aborted)
|
|
1250
|
+
throw new Fe();
|
|
1251
|
+
M.setInput(void 0), n.key && M.setSubmission(n.key, u), a(u);
|
|
1252
1252
|
};
|
|
1253
1253
|
z.onSubmitSuccessFn$.value = i;
|
|
1254
1254
|
});
|
|
@@ -1300,7 +1300,7 @@ const vn = ["x", "y", "top", "bottom", "left", "right", "width", "height"], xn =
|
|
|
1300
1300
|
} = G();
|
|
1301
1301
|
return l("button", {
|
|
1302
1302
|
type: "button",
|
|
1303
|
-
class:
|
|
1303
|
+
class: De("fr text-neutral-9 flex flex-shrink-0 items-center justify-center gap-1 rounded-full py-[6px] pl-2 pr-3 text-sm underline-offset-2 transition-all", e),
|
|
1304
1304
|
...t,
|
|
1305
1305
|
children: [l("svg", {
|
|
1306
1306
|
"aria-hidden": !0,
|
|
@@ -1569,7 +1569,7 @@ const vn = ["x", "y", "top", "bottom", "left", "right", "width", "height"], xn =
|
|
|
1569
1569
|
Zambia: "260",
|
|
1570
1570
|
Zimbabwe: "263",
|
|
1571
1571
|
"Åland Islands": "358"
|
|
1572
|
-
},
|
|
1572
|
+
}, Re = Ze("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", {
|
|
1573
1573
|
variants: {
|
|
1574
1574
|
optional: {
|
|
1575
1575
|
true: "pr-16 pl-3",
|
|
@@ -1607,10 +1607,10 @@ const vn = ["x", "y", "top", "bottom", "left", "right", "width", "height"], xn =
|
|
|
1607
1607
|
const r = (n = M.current$.peek().flow) == null ? void 0 : n.data.flowSessionId;
|
|
1608
1608
|
return r ? {
|
|
1609
1609
|
enabled: !0,
|
|
1610
|
-
getPredictions: async (
|
|
1611
|
-
const
|
|
1612
|
-
|
|
1613
|
-
const i = await fetch(
|
|
1610
|
+
getPredictions: async (s) => {
|
|
1611
|
+
const a = new URL(kn);
|
|
1612
|
+
a.searchParams.set("q", s), a.searchParams.set("session_token", r), a.searchParams.set("access_token", Cn(Sn));
|
|
1613
|
+
const i = await fetch(a);
|
|
1614
1614
|
if (!i.ok)
|
|
1615
1615
|
return e.error("Failed to get address details", i), {
|
|
1616
1616
|
ok: !1,
|
|
@@ -1627,19 +1627,19 @@ const vn = ["x", "y", "top", "bottom", "left", "right", "width", "height"], xn =
|
|
|
1627
1627
|
} = u.output;
|
|
1628
1628
|
return {
|
|
1629
1629
|
ok: !0,
|
|
1630
|
-
data: d.map((
|
|
1631
|
-
var x, v,
|
|
1630
|
+
data: d.map((h) => {
|
|
1631
|
+
var x, v, p, k, y, A, S, E, g;
|
|
1632
1632
|
return {
|
|
1633
|
-
label:
|
|
1634
|
-
id:
|
|
1633
|
+
label: h.full_address ?? h.place_formatted ?? h.name ?? h.mapbox_id,
|
|
1634
|
+
id: h.mapbox_id,
|
|
1635
1635
|
address: {
|
|
1636
|
-
line1: ((x =
|
|
1636
|
+
line1: ((x = h.context.address) == null ? void 0 : x.name) ?? ((v = h.context.street) == null ? void 0 : v.name),
|
|
1637
1637
|
line2: void 0,
|
|
1638
|
-
line3: ((
|
|
1639
|
-
city: ((y =
|
|
1640
|
-
state: (S =
|
|
1641
|
-
postcode: (E =
|
|
1642
|
-
country: (g =
|
|
1638
|
+
line3: ((p = h.context.neighborhood) == null ? void 0 : p.name) ?? ((k = h.context.locality) == null ? void 0 : k.name),
|
|
1639
|
+
city: ((y = h.context.place) == null ? void 0 : y.name) ?? ((A = h.context.district) == null ? void 0 : A.name),
|
|
1640
|
+
state: (S = h.context.region) == null ? void 0 : S.name,
|
|
1641
|
+
postcode: (E = h.context.postcode) == null ? void 0 : E.name,
|
|
1642
|
+
country: (g = h.context.country) == null ? void 0 : g.name
|
|
1643
1643
|
}
|
|
1644
1644
|
};
|
|
1645
1645
|
})
|
|
@@ -1678,14 +1678,14 @@ const vn = ["x", "y", "top", "bottom", "left", "right", "width", "height"], xn =
|
|
|
1678
1678
|
}) => {
|
|
1679
1679
|
const {
|
|
1680
1680
|
t: n
|
|
1681
|
-
} = G(), [
|
|
1681
|
+
} = G(), [s, a] = Y(), [i, u] = Y([]), {
|
|
1682
1682
|
enabled: d,
|
|
1683
|
-
getPredictions:
|
|
1683
|
+
getPredictions: h
|
|
1684
1684
|
} = An({
|
|
1685
1685
|
logger: r,
|
|
1686
1686
|
t: n
|
|
1687
|
-
}), [x, v] = Y(d ? "query" : "manual"), [
|
|
1688
|
-
le(d, "Query state should not be enabled"), E = E.trim(), E !== (
|
|
1687
|
+
}), [x, v] = Y(d ? "query" : "manual"), [p, k] = Y(""), [y, A] = Y(), S = (E) => {
|
|
1688
|
+
le(d, "Query state should not be enabled"), E = E.trim(), E !== (p == null ? void 0 : p.trim()) && (k(E), E === "" && u([]), A(void 0), h(E).then((g) => {
|
|
1689
1689
|
if (g.ok === !1) {
|
|
1690
1690
|
u([]), A(g.error);
|
|
1691
1691
|
return;
|
|
@@ -1700,25 +1700,25 @@ const vn = ["x", "y", "top", "bottom", "left", "right", "width", "height"], xn =
|
|
|
1700
1700
|
onSkip: () => t(null),
|
|
1701
1701
|
onAddressSelect: (E) => {
|
|
1702
1702
|
if (E === "") {
|
|
1703
|
-
|
|
1703
|
+
a(void 0), v("manual");
|
|
1704
1704
|
return;
|
|
1705
1705
|
}
|
|
1706
1706
|
const g = i.find((N) => N.id === E);
|
|
1707
|
-
g && (
|
|
1707
|
+
g && (a(g.address), v("details"));
|
|
1708
1708
|
},
|
|
1709
1709
|
onAddressSearch: (E) => {
|
|
1710
1710
|
S(E);
|
|
1711
1711
|
},
|
|
1712
1712
|
suggestions: i,
|
|
1713
|
-
query:
|
|
1713
|
+
query: p,
|
|
1714
1714
|
error: y
|
|
1715
1715
|
});
|
|
1716
1716
|
case "details":
|
|
1717
|
-
return le(
|
|
1717
|
+
return le(s !== void 0), l(Dt, {
|
|
1718
1718
|
input: e,
|
|
1719
1719
|
logger: r,
|
|
1720
1720
|
onSubmitSuccess: t,
|
|
1721
|
-
addressFields:
|
|
1721
|
+
addressFields: s,
|
|
1722
1722
|
actions: l(Lt, {
|
|
1723
1723
|
onClick: () => {
|
|
1724
1724
|
v("query");
|
|
@@ -1743,8 +1743,8 @@ const vn = ["x", "y", "top", "bottom", "left", "right", "width", "height"], xn =
|
|
|
1743
1743
|
onSkip: t,
|
|
1744
1744
|
suggestions: r,
|
|
1745
1745
|
onAddressSelect: n,
|
|
1746
|
-
query:
|
|
1747
|
-
onAddressSearch:
|
|
1746
|
+
query: s,
|
|
1747
|
+
onAddressSearch: a,
|
|
1748
1748
|
error: i
|
|
1749
1749
|
}) => {
|
|
1750
1750
|
const {
|
|
@@ -1755,10 +1755,10 @@ const vn = ["x", "y", "top", "bottom", "left", "right", "width", "height"], xn =
|
|
|
1755
1755
|
}, []), l(ke, {
|
|
1756
1756
|
children: [l("form", {
|
|
1757
1757
|
noValidate: !0,
|
|
1758
|
-
onSubmit: (
|
|
1759
|
-
|
|
1760
|
-
const v = new FormData(
|
|
1761
|
-
typeof v == "string" &&
|
|
1758
|
+
onSubmit: (h) => {
|
|
1759
|
+
h.preventDefault();
|
|
1760
|
+
const v = new FormData(h.currentTarget).get("address");
|
|
1761
|
+
typeof v == "string" && a(v);
|
|
1762
1762
|
},
|
|
1763
1763
|
class: "flex gap-1 p-2.5",
|
|
1764
1764
|
children: [l("div", {
|
|
@@ -1770,8 +1770,8 @@ const vn = ["x", "y", "top", "bottom", "left", "right", "width", "height"], xn =
|
|
|
1770
1770
|
autocomplete: "address-line1 country-name postal-code",
|
|
1771
1771
|
autoFocus: !0,
|
|
1772
1772
|
placeholder: e.config.placeholder || u("address_search"),
|
|
1773
|
-
defaultValue:
|
|
1774
|
-
class:
|
|
1773
|
+
defaultValue: s,
|
|
1774
|
+
class: Re({
|
|
1775
1775
|
optional: !!e.config.optional,
|
|
1776
1776
|
className: "w-full rounded-full"
|
|
1777
1777
|
})
|
|
@@ -1812,15 +1812,15 @@ const vn = ["x", "y", "top", "bottom", "left", "right", "width", "height"], xn =
|
|
|
1812
1812
|
message: i
|
|
1813
1813
|
}
|
|
1814
1814
|
}) : null, l("ul", {
|
|
1815
|
-
children: [r.map((
|
|
1815
|
+
children: [r.map((h) => l("li", {
|
|
1816
1816
|
children: l("button", {
|
|
1817
1817
|
class: "text-neutral-11 fr hover:bg-neutral-3 focus-visible:bg-neutral-3 hover:text-neutral-12 border-b-neutral-3 flex w-full items-center border border-b border-solid border-transparent px-4 py-3 text-sm transition-colors duration-100",
|
|
1818
1818
|
onClick: () => {
|
|
1819
|
-
n(
|
|
1819
|
+
n(h.id);
|
|
1820
1820
|
},
|
|
1821
1821
|
children: [l("span", {
|
|
1822
1822
|
class: "flex-grow",
|
|
1823
|
-
children:
|
|
1823
|
+
children: h.label
|
|
1824
1824
|
}), l("svg", {
|
|
1825
1825
|
class: "flex-none",
|
|
1826
1826
|
width: "16",
|
|
@@ -1835,7 +1835,7 @@ const vn = ["x", "y", "top", "bottom", "left", "right", "width", "height"], xn =
|
|
|
1835
1835
|
})
|
|
1836
1836
|
})]
|
|
1837
1837
|
})
|
|
1838
|
-
},
|
|
1838
|
+
}, h.id)), l("li", {
|
|
1839
1839
|
children: l("button", {
|
|
1840
1840
|
class: "text-neutral-11 fr hover:bg-neutral-3 focus-visible:bg-neutral-3 hover:text-neutral-12 border-b-neutral-3 flex w-full items-center border border-b border-solid border-transparent px-4 py-3 text-sm transition-colors duration-100",
|
|
1841
1841
|
onClick: () => {
|
|
@@ -1855,33 +1855,33 @@ const vn = ["x", "y", "top", "bottom", "left", "right", "width", "height"], xn =
|
|
|
1855
1855
|
actions: r,
|
|
1856
1856
|
input: n
|
|
1857
1857
|
}) => {
|
|
1858
|
-
const
|
|
1858
|
+
const s = re(null);
|
|
1859
1859
|
pe(() => {
|
|
1860
|
-
if (
|
|
1861
|
-
const u =
|
|
1860
|
+
if (s.current) {
|
|
1861
|
+
const u = s.current.querySelector("input");
|
|
1862
1862
|
u && (u.focus(), u.select());
|
|
1863
1863
|
}
|
|
1864
1864
|
}, []);
|
|
1865
|
-
const
|
|
1865
|
+
const a = Object.keys(mt), {
|
|
1866
1866
|
t: i
|
|
1867
1867
|
} = G();
|
|
1868
1868
|
return l("form", {
|
|
1869
1869
|
class: "bg-neutral-1/90 flex flex-col justify-end gap-2 p-2",
|
|
1870
1870
|
onSubmit: (u) => {
|
|
1871
|
-
const d = new FormData(u.currentTarget),
|
|
1871
|
+
const d = new FormData(u.currentTarget), h = Object.fromEntries(d.entries());
|
|
1872
1872
|
t({
|
|
1873
1873
|
type: "address",
|
|
1874
|
-
value:
|
|
1874
|
+
value: h
|
|
1875
1875
|
});
|
|
1876
1876
|
},
|
|
1877
1877
|
children: [l("div", {
|
|
1878
1878
|
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]",
|
|
1879
|
-
ref:
|
|
1879
|
+
ref: s,
|
|
1880
1880
|
children: Tt.map((u, d) => {
|
|
1881
|
-
const
|
|
1881
|
+
const h = `isdk_${u}`, x = n.config.keys[u];
|
|
1882
1882
|
return x ? l(ke, {
|
|
1883
1883
|
children: [l("label", {
|
|
1884
|
-
for:
|
|
1884
|
+
for: h,
|
|
1885
1885
|
class: "text-neutral-9 [&:has(+*>input:focus)]:text-neutral-11 w-24 pb-2 text-xs uppercase leading-3 tracking-widest transition-colors",
|
|
1886
1886
|
children: i(u)
|
|
1887
1887
|
}), l("div", {
|
|
@@ -1891,16 +1891,16 @@ const vn = ["x", "y", "top", "bottom", "left", "right", "width", "height"], xn =
|
|
|
1891
1891
|
children: [l("select", {
|
|
1892
1892
|
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",
|
|
1893
1893
|
name: x,
|
|
1894
|
-
id:
|
|
1894
|
+
id: h,
|
|
1895
1895
|
defaultValue: e[u],
|
|
1896
1896
|
required: !0,
|
|
1897
|
-
children: [e.country && !
|
|
1897
|
+
children: [e.country && !a.includes(e.country) ? l("option", {
|
|
1898
1898
|
value: e[u],
|
|
1899
1899
|
children: e[u]
|
|
1900
1900
|
}) : l("option", {
|
|
1901
1901
|
value: "",
|
|
1902
1902
|
children: i("select_country")
|
|
1903
|
-
}),
|
|
1903
|
+
}), a.map((v) => l("option", {
|
|
1904
1904
|
value: v,
|
|
1905
1905
|
children: v
|
|
1906
1906
|
}, v))]
|
|
@@ -1923,7 +1923,7 @@ const vn = ["x", "y", "top", "bottom", "left", "right", "width", "height"], xn =
|
|
|
1923
1923
|
autoFocus: d === 0 ? !0 : void 0,
|
|
1924
1924
|
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",
|
|
1925
1925
|
name: x,
|
|
1926
|
-
id:
|
|
1926
|
+
id: h,
|
|
1927
1927
|
defaultValue: e[u],
|
|
1928
1928
|
required: !0
|
|
1929
1929
|
}), d === Tt.length - 1 ? l("hr", {
|
|
@@ -1971,18 +1971,18 @@ const vn = ["x", "y", "top", "bottom", "left", "right", "width", "height"], xn =
|
|
|
1971
1971
|
class: "",
|
|
1972
1972
|
onSubmit: (n) => {
|
|
1973
1973
|
n.preventDefault();
|
|
1974
|
-
const
|
|
1974
|
+
const s = Lr(n).value, a = nr(Mn, s);
|
|
1975
1975
|
t({
|
|
1976
1976
|
type: "boolean",
|
|
1977
|
-
value:
|
|
1977
|
+
value: a === "true"
|
|
1978
1978
|
});
|
|
1979
1979
|
},
|
|
1980
1980
|
children: [l("ul", {
|
|
1981
1981
|
class: ur,
|
|
1982
|
-
children: lr.map((n,
|
|
1982
|
+
children: lr.map((n, s) => l("li", {
|
|
1983
1983
|
class: "flex-1",
|
|
1984
1984
|
children: l(cr, {
|
|
1985
|
-
ref:
|
|
1985
|
+
ref: s === 0 ? r : null,
|
|
1986
1986
|
type: "submit",
|
|
1987
1987
|
name: Fn,
|
|
1988
1988
|
value: n,
|
|
@@ -2006,30 +2006,30 @@ const vn = ["x", "y", "top", "bottom", "left", "right", "width", "height"], xn =
|
|
|
2006
2006
|
class: t,
|
|
2007
2007
|
...r
|
|
2008
2008
|
}) => {
|
|
2009
|
-
const n = e.name.split(".").pop(),
|
|
2009
|
+
const n = e.name.split(".").pop(), s = e.name.replace(new RegExp(`.${n}$`), "");
|
|
2010
2010
|
return l("div", {
|
|
2011
|
-
class:
|
|
2011
|
+
class: De("bg-accent-1 outline-accent-4 flex max-w-full gap-2 overflow-hidden rounded-lg px-3 py-2 text-sm outline", t),
|
|
2012
2012
|
...r,
|
|
2013
2013
|
children: [l("p", {
|
|
2014
2014
|
"aria-label": "File name",
|
|
2015
2015
|
class: "text-accent-12 flex flex-grow overflow-hidden",
|
|
2016
2016
|
children: [l("span", {
|
|
2017
2017
|
class: "block truncate",
|
|
2018
|
-
children:
|
|
2018
|
+
children: s
|
|
2019
2019
|
}), l("span", {
|
|
2020
2020
|
children: [".", n]
|
|
2021
2021
|
})]
|
|
2022
2022
|
}), l("p", {
|
|
2023
2023
|
"aria-label": "File size",
|
|
2024
2024
|
class: "text-accent-11",
|
|
2025
|
-
children:
|
|
2025
|
+
children: Le(e.sizeKb)
|
|
2026
2026
|
})]
|
|
2027
2027
|
});
|
|
2028
2028
|
}, Ot = ({
|
|
2029
2029
|
class: e,
|
|
2030
2030
|
...t
|
|
2031
2031
|
}) => l("li", {
|
|
2032
|
-
class:
|
|
2032
|
+
class: De("outline-neutral-6 text-neutral-11 bg-neutral-1 block rounded-md px-1 py-0.5 text-xs outline outline-1", e),
|
|
2033
2033
|
...t
|
|
2034
2034
|
}), dr = (e) => {
|
|
2035
2035
|
const t = e.split(".").pop();
|
|
@@ -2050,12 +2050,12 @@ const vn = ["x", "y", "top", "bottom", "left", "right", "width", "height"], xn =
|
|
|
2050
2050
|
onSubmitSuccess: t
|
|
2051
2051
|
}) => {
|
|
2052
2052
|
var v;
|
|
2053
|
-
const r = (v = M.current$.value.flow) == null ? void 0 : v.data.submissions[e.key], [n,
|
|
2053
|
+
const r = (v = M.current$.value.flow) == null ? void 0 : v.data.submissions[e.key], [n, s] = Y(Dn(r) ? r.value : []), [a, i] = Y(), u = n.length - Rt, d = Tn(n), h = gt(), {
|
|
2054
2054
|
t: x
|
|
2055
2055
|
} = G();
|
|
2056
2056
|
return l("form", {
|
|
2057
2057
|
class: "flex flex-col gap-1 p-2.5",
|
|
2058
|
-
onSubmit: (
|
|
2058
|
+
onSubmit: (p) => (p.preventDefault(), i(void 0), n.length === 0 ? i({
|
|
2059
2059
|
type: "required",
|
|
2060
2060
|
message: x("validation_file")
|
|
2061
2061
|
}) : e.config.extensions.length > 0 && !On({
|
|
@@ -2068,7 +2068,7 @@ const vn = ["x", "y", "top", "bottom", "left", "right", "width", "height"], xn =
|
|
|
2068
2068
|
})}`
|
|
2069
2069
|
}) : e.config.fileSizeLimitKib && d > e.config.fileSizeLimitKib ? i({
|
|
2070
2070
|
type: "max",
|
|
2071
|
-
message: `File size exceeds limit of ${
|
|
2071
|
+
message: `File size exceeds limit of ${Le(e.config.fileSizeLimitKib)}`
|
|
2072
2072
|
}) : e.config.allowMultiple === !1 && n.length > 1 ? i({
|
|
2073
2073
|
type: "invalid",
|
|
2074
2074
|
message: x("validation_file_max", {
|
|
@@ -2081,14 +2081,14 @@ const vn = ["x", "y", "top", "bottom", "left", "right", "width", "height"], xn =
|
|
|
2081
2081
|
children: [l("div", {
|
|
2082
2082
|
class: "flex items-center gap-2",
|
|
2083
2083
|
children: [l("label", {
|
|
2084
|
-
ref:
|
|
2084
|
+
ref: h,
|
|
2085
2085
|
for: "dropzone-file",
|
|
2086
2086
|
class: "border-neutral-8 bg-neutral-2 flex h-48 w-full cursor-pointer flex-col items-center justify-center overflow-hidden rounded-2xl border border-dashed p-4",
|
|
2087
2087
|
children: [n.length > 0 ? l(ke, {
|
|
2088
2088
|
children: [l("ul", {
|
|
2089
2089
|
class: "flex max-w-full flex-wrap justify-center gap-1 overflow-hidden p-1",
|
|
2090
|
-
children: [n.slice(0, Rt).map((
|
|
2091
|
-
const k =
|
|
2090
|
+
children: [n.slice(0, Rt).map((p) => {
|
|
2091
|
+
const k = p.name.split(".").pop(), y = p.name.replace(new RegExp(`.${k}$`), "");
|
|
2092
2092
|
return l(Ot, {
|
|
2093
2093
|
class: "flex overflow-hidden",
|
|
2094
2094
|
children: [l("span", {
|
|
@@ -2103,7 +2103,7 @@ const vn = ["x", "y", "top", "bottom", "left", "right", "width", "height"], xn =
|
|
|
2103
2103
|
}) : null]
|
|
2104
2104
|
}), l("p", {
|
|
2105
2105
|
class: "text-neutral-11 text-xs",
|
|
2106
|
-
children: [
|
|
2106
|
+
children: [Le(d), " ", n.length > 1 ? "total" : ""]
|
|
2107
2107
|
})]
|
|
2108
2108
|
}) : l("div", {
|
|
2109
2109
|
class: "flex flex-col justify-center gap-4 pb-6 pt-5",
|
|
@@ -2130,7 +2130,7 @@ const vn = ["x", "y", "top", "bottom", "left", "right", "width", "height"], xn =
|
|
|
2130
2130
|
}), e.config.fileSizeLimitKib ? l("p", {
|
|
2131
2131
|
class: "text-neutral-10 text-xs",
|
|
2132
2132
|
children: ["(", x("file_max_size", {
|
|
2133
|
-
size:
|
|
2133
|
+
size: Le(e.config.fileSizeLimitKib)
|
|
2134
2134
|
}), ")"]
|
|
2135
2135
|
}) : null]
|
|
2136
2136
|
}), l("aside", {
|
|
@@ -2142,17 +2142,17 @@ const vn = ["x", "y", "top", "bottom", "left", "right", "width", "height"], xn =
|
|
|
2142
2142
|
}), l("ul", {
|
|
2143
2143
|
"aria-describedby": "accepted-filetypes",
|
|
2144
2144
|
class: "flex flex-wrap justify-center gap-2",
|
|
2145
|
-
children: e.config.extensions.map((
|
|
2145
|
+
children: e.config.extensions.map((p) => l("li", {
|
|
2146
2146
|
class: "ring-lowest outline-neutral-6 text-neutral-9 bg-neutral-1 rounded-md px-1 py-0.5 text-[11px] uppercase tracking-wide outline outline-1 ring-2",
|
|
2147
|
-
children:
|
|
2147
|
+
children: p.replace(".", "")
|
|
2148
2148
|
}))
|
|
2149
2149
|
})]
|
|
2150
2150
|
})]
|
|
2151
2151
|
}), l("input", {
|
|
2152
2152
|
id: "dropzone-file",
|
|
2153
|
-
onInput: async (
|
|
2154
|
-
le(
|
|
2155
|
-
const k =
|
|
2153
|
+
onInput: async (p) => {
|
|
2154
|
+
le(p.target instanceof HTMLInputElement);
|
|
2155
|
+
const k = p.target.files ? Array.from(p.target.files) : [], y = await Promise.allSettled(k.map(async (S) => {
|
|
2156
2156
|
const E = await Ln(S);
|
|
2157
2157
|
return {
|
|
2158
2158
|
name: Bn(S.name, 42),
|
|
@@ -2168,7 +2168,7 @@ const vn = ["x", "y", "top", "bottom", "left", "right", "width", "height"], xn =
|
|
|
2168
2168
|
message: "Invalid file"
|
|
2169
2169
|
});
|
|
2170
2170
|
const A = y.map((S) => S.status === "fulfilled" ? S.value : null).filter(Boolean);
|
|
2171
|
-
|
|
2171
|
+
s(A);
|
|
2172
2172
|
},
|
|
2173
2173
|
multiple: e.config.allowMultiple,
|
|
2174
2174
|
type: "file",
|
|
@@ -2183,13 +2183,13 @@ const vn = ["x", "y", "top", "bottom", "left", "right", "width", "height"], xn =
|
|
|
2183
2183
|
})]
|
|
2184
2184
|
})]
|
|
2185
2185
|
}), l(Ce, {
|
|
2186
|
-
error:
|
|
2186
|
+
error: a
|
|
2187
2187
|
})]
|
|
2188
2188
|
});
|
|
2189
2189
|
};
|
|
2190
|
-
var
|
|
2190
|
+
var Oe = (e) => e.type === "checkbox", _e = (e) => e instanceof Date, U = (e) => e == null;
|
|
2191
2191
|
const fr = (e) => typeof e == "object";
|
|
2192
|
-
var $ = (e) => !U(e) && !Array.isArray(e) && fr(e) && !_e(e), $n = (e) => $(e) && e.target ?
|
|
2192
|
+
var $ = (e) => !U(e) && !Array.isArray(e) && fr(e) && !_e(e), $n = (e) => $(e) && e.target ? Oe(e.target) ? e.target.checked : e.target.value : e, jn = (e) => e.substring(0, e.search(/\.\d+(\.|$)/)) || e, zn = (e, t) => e.has(jn(t)), qn = (e) => {
|
|
2193
2193
|
const t = e.constructor && e.constructor.prototype;
|
|
2194
2194
|
return $(t) && t.hasOwnProperty("isPrototypeOf");
|
|
2195
2195
|
}, bt = typeof window < "u" && typeof window.HTMLElement < "u" && typeof document < "u";
|
|
@@ -2210,10 +2210,10 @@ function oe(e) {
|
|
|
2210
2210
|
return e;
|
|
2211
2211
|
return t;
|
|
2212
2212
|
}
|
|
2213
|
-
var
|
|
2213
|
+
var Be = (e) => Array.isArray(e) ? e.filter(Boolean) : [], O = (e) => e === void 0, w = (e, t, r) => {
|
|
2214
2214
|
if (!t || !$(e))
|
|
2215
2215
|
return r;
|
|
2216
|
-
const n =
|
|
2216
|
+
const n = Be(t.split(/[,[\].]+?/)).reduce((s, a) => U(s) ? s : s[a], e);
|
|
2217
2217
|
return O(n) || n === e ? O(e[t]) ? r : e[t] : n;
|
|
2218
2218
|
}, de = (e) => typeof e == "boolean";
|
|
2219
2219
|
const Bt = {
|
|
@@ -2237,21 +2237,21 @@ const Bt = {
|
|
|
2237
2237
|
};
|
|
2238
2238
|
Q.createContext(null);
|
|
2239
2239
|
var Un = (e, t, r, n = !0) => {
|
|
2240
|
-
const
|
|
2240
|
+
const s = {
|
|
2241
2241
|
defaultValues: t._defaultValues
|
|
2242
2242
|
};
|
|
2243
|
-
for (const
|
|
2244
|
-
Object.defineProperty(
|
|
2243
|
+
for (const a in e)
|
|
2244
|
+
Object.defineProperty(s, a, {
|
|
2245
2245
|
get: () => {
|
|
2246
|
-
const i =
|
|
2246
|
+
const i = a;
|
|
2247
2247
|
return t._proxyFormState[i] !== Z.all && (t._proxyFormState[i] = !n || Z.all), r && (r[i] = !0), e[i];
|
|
2248
2248
|
}
|
|
2249
2249
|
});
|
|
2250
|
-
return
|
|
2250
|
+
return s;
|
|
2251
2251
|
}, J = (e) => $(e) && !Object.keys(e).length, Kn = (e, t, r, n) => {
|
|
2252
2252
|
r(e);
|
|
2253
|
-
const { name:
|
|
2254
|
-
return J(
|
|
2253
|
+
const { name: s, ...a } = e;
|
|
2254
|
+
return J(a) || Object.keys(a).length >= Object.keys(t).length || Object.keys(a).find((i) => t[i] === (!n || Z.all));
|
|
2255
2255
|
}, it = (e) => Array.isArray(e) ? e : [e];
|
|
2256
2256
|
function Gn(e) {
|
|
2257
2257
|
const t = Q.useRef(e);
|
|
@@ -2264,26 +2264,26 @@ function Gn(e) {
|
|
|
2264
2264
|
};
|
|
2265
2265
|
}, [e.disabled]);
|
|
2266
2266
|
}
|
|
2267
|
-
var te = (e) => typeof e == "string", Hn = (e, t, r, n,
|
|
2267
|
+
var te = (e) => typeof e == "string", Hn = (e, t, r, n, s) => te(e) ? (n && t.watch.add(e), w(r, e, s)) : Array.isArray(e) ? e.map((a) => (n && t.watch.add(a), w(r, a))) : (n && (t.watchAll = !0), r), yt = (e) => /^\w*$/.test(e), hr = (e) => Be(e.replace(/["|']|\]/g, "").split(/\.|\[/));
|
|
2268
2268
|
function L(e, t, r) {
|
|
2269
2269
|
let n = -1;
|
|
2270
|
-
const
|
|
2271
|
-
for (; ++n <
|
|
2272
|
-
const u =
|
|
2270
|
+
const s = yt(t) ? [t] : hr(t), a = s.length, i = a - 1;
|
|
2271
|
+
for (; ++n < a; ) {
|
|
2272
|
+
const u = s[n];
|
|
2273
2273
|
let d = r;
|
|
2274
2274
|
if (n !== i) {
|
|
2275
|
-
const
|
|
2276
|
-
d = $(
|
|
2275
|
+
const h = e[u];
|
|
2276
|
+
d = $(h) || Array.isArray(h) ? h : isNaN(+s[n + 1]) ? {} : [];
|
|
2277
2277
|
}
|
|
2278
2278
|
e[u] = d, e = e[u];
|
|
2279
2279
|
}
|
|
2280
2280
|
return e;
|
|
2281
2281
|
}
|
|
2282
|
-
var pr = (e, t, r, n,
|
|
2282
|
+
var pr = (e, t, r, n, s) => t ? {
|
|
2283
2283
|
...r[e],
|
|
2284
2284
|
types: {
|
|
2285
2285
|
...r[e] && r[e].types ? r[e].types : {},
|
|
2286
|
-
[n]:
|
|
2286
|
+
[n]: s || !0
|
|
2287
2287
|
}
|
|
2288
2288
|
} : {}, Pt = (e) => ({
|
|
2289
2289
|
isOnSubmit: !e || e === Z.onSubmit,
|
|
@@ -2293,12 +2293,12 @@ var pr = (e, t, r, n, a) => t ? {
|
|
|
2293
2293
|
isOnTouch: e === Z.onTouched
|
|
2294
2294
|
}), $t = (e, t, r) => !r && (t.watchAll || t.watch.has(e) || [...t.watch].some((n) => e.startsWith(n) && /^\.\w+/.test(e.slice(n.length))));
|
|
2295
2295
|
const ze = (e, t, r, n) => {
|
|
2296
|
-
for (const
|
|
2297
|
-
const
|
|
2298
|
-
if (
|
|
2299
|
-
const { _f: i, ...u } =
|
|
2296
|
+
for (const s of r || Object.keys(e)) {
|
|
2297
|
+
const a = w(e, s);
|
|
2298
|
+
if (a) {
|
|
2299
|
+
const { _f: i, ...u } = a;
|
|
2300
2300
|
if (i) {
|
|
2301
|
-
if (i.refs && i.refs[0] && t(i.refs[0],
|
|
2301
|
+
if (i.refs && i.refs[0] && t(i.refs[0], s) && !n)
|
|
2302
2302
|
break;
|
|
2303
2303
|
if (i.ref && t(i.ref, i.name) && !n)
|
|
2304
2304
|
break;
|
|
@@ -2308,7 +2308,7 @@ const ze = (e, t, r, n) => {
|
|
|
2308
2308
|
}
|
|
2309
2309
|
};
|
|
2310
2310
|
var Wn = (e, t, r) => {
|
|
2311
|
-
const n =
|
|
2311
|
+
const n = Be(w(e, r));
|
|
2312
2312
|
return L(n, "root", t[r]), L(e, r, n), e;
|
|
2313
2313
|
}, vt = (e) => e.type === "file", fe = (e) => typeof e == "function", Ge = (e) => {
|
|
2314
2314
|
if (!bt)
|
|
@@ -2352,22 +2352,22 @@ function Ut(e, t, r = "validate") {
|
|
|
2352
2352
|
var we = (e) => $(e) && !He(e) ? e : {
|
|
2353
2353
|
value: e,
|
|
2354
2354
|
message: ""
|
|
2355
|
-
}, Kt = async (e, t, r, n,
|
|
2356
|
-
const { ref:
|
|
2355
|
+
}, Kt = async (e, t, r, n, s) => {
|
|
2356
|
+
const { ref: a, refs: i, required: u, maxLength: d, minLength: h, min: x, max: v, pattern: p, validate: k, name: y, valueAsNumber: A, mount: S, disabled: E } = e._f, g = w(t, y);
|
|
2357
2357
|
if (!S || E)
|
|
2358
2358
|
return {};
|
|
2359
|
-
const N = i ? i[0] :
|
|
2359
|
+
const N = i ? i[0] : a, P = (F) => {
|
|
2360
2360
|
n && N.reportValidity && (N.setCustomValidity(de(F) ? "" : F || ""), N.reportValidity());
|
|
2361
|
-
}, D = {}, me = xt(
|
|
2361
|
+
}, D = {}, me = xt(a), ce = Oe(a), Ee = me || ce, H = (A || vt(a)) && O(a.value) && O(g) || Ge(a) && a.value === "" || g === "" || Array.isArray(g) && !g.length, se = pr.bind(null, y, r, D), q = (F, I, R, K = ie.maxLength, W = ie.minLength) => {
|
|
2362
2362
|
const X = F ? I : R;
|
|
2363
2363
|
D[y] = {
|
|
2364
2364
|
type: F ? K : W,
|
|
2365
2365
|
message: X,
|
|
2366
|
-
ref:
|
|
2366
|
+
ref: a,
|
|
2367
2367
|
...se(F ? K : W, X)
|
|
2368
2368
|
};
|
|
2369
2369
|
};
|
|
2370
|
-
if (
|
|
2370
|
+
if (s ? !Array.isArray(g) || !g.length : u && (!Ee && (H || U(g)) || de(g) && !g || ce && !mr(i).isValid || me && !gr(i).isValid)) {
|
|
2371
2371
|
const { value: F, message: I } = qe(u) ? { value: !!u, message: u } : we(u);
|
|
2372
2372
|
if (F && (D[y] = {
|
|
2373
2373
|
type: ie.required,
|
|
@@ -2381,26 +2381,26 @@ var we = (e) => $(e) && !He(e) ? e : {
|
|
|
2381
2381
|
let F, I;
|
|
2382
2382
|
const R = we(v), K = we(x);
|
|
2383
2383
|
if (!U(g) && !isNaN(g)) {
|
|
2384
|
-
const W =
|
|
2384
|
+
const W = a.valueAsNumber || g && +g;
|
|
2385
2385
|
U(R.value) || (F = W > R.value), U(K.value) || (I = W < K.value);
|
|
2386
2386
|
} else {
|
|
2387
|
-
const W =
|
|
2387
|
+
const W = a.valueAsDate || new Date(g), X = (Pe) => /* @__PURE__ */ new Date((/* @__PURE__ */ new Date()).toDateString() + " " + Pe), ge = a.type == "time", Ae = a.type == "week";
|
|
2388
2388
|
te(R.value) && g && (F = ge ? X(g) > X(R.value) : Ae ? g > R.value : W > new Date(R.value)), te(K.value) && g && (I = ge ? X(g) < X(K.value) : Ae ? g < K.value : W < new Date(K.value));
|
|
2389
2389
|
}
|
|
2390
2390
|
if ((F || I) && (q(!!F, R.message, K.message, ie.max, ie.min), !r))
|
|
2391
2391
|
return P(D[y].message), D;
|
|
2392
2392
|
}
|
|
2393
|
-
if ((d ||
|
|
2394
|
-
const F = we(d), I = we(
|
|
2393
|
+
if ((d || h) && !H && (te(g) || s && Array.isArray(g))) {
|
|
2394
|
+
const F = we(d), I = we(h), R = !U(F.value) && g.length > +F.value, K = !U(I.value) && g.length < +I.value;
|
|
2395
2395
|
if ((R || K) && (q(R, F.message, I.message), !r))
|
|
2396
2396
|
return P(D[y].message), D;
|
|
2397
2397
|
}
|
|
2398
|
-
if (
|
|
2399
|
-
const { value: F, message: I } = we(
|
|
2398
|
+
if (p && !H && te(g)) {
|
|
2399
|
+
const { value: F, message: I } = we(p);
|
|
2400
2400
|
if (He(F) && !g.match(F) && (D[y] = {
|
|
2401
2401
|
type: ie.pattern,
|
|
2402
2402
|
message: I,
|
|
2403
|
-
ref:
|
|
2403
|
+
ref: a,
|
|
2404
2404
|
...se(ie.pattern, I)
|
|
2405
2405
|
}, !r))
|
|
2406
2406
|
return P(I), D;
|
|
@@ -2447,8 +2447,8 @@ function Zn(e) {
|
|
|
2447
2447
|
return !0;
|
|
2448
2448
|
}
|
|
2449
2449
|
function j(e, t) {
|
|
2450
|
-
const r = Array.isArray(t) ? t : yt(t) ? [t] : hr(t), n = r.length === 1 ? e : Jn(e, r),
|
|
2451
|
-
return n && delete n[
|
|
2450
|
+
const r = Array.isArray(t) ? t : yt(t) ? [t] : hr(t), n = r.length === 1 ? e : Jn(e, r), s = r.length - 1, a = r[s];
|
|
2451
|
+
return n && delete n[a], s !== 0 && ($(n) && J(n) || Array.isArray(n) && Zn(n)) && j(e, r.slice(0, -1)), e;
|
|
2452
2452
|
}
|
|
2453
2453
|
function ot() {
|
|
2454
2454
|
let e = [];
|
|
@@ -2456,13 +2456,13 @@ function ot() {
|
|
|
2456
2456
|
get observers() {
|
|
2457
2457
|
return e;
|
|
2458
2458
|
},
|
|
2459
|
-
next: (
|
|
2460
|
-
for (const
|
|
2461
|
-
|
|
2459
|
+
next: (s) => {
|
|
2460
|
+
for (const a of e)
|
|
2461
|
+
a.next && a.next(s);
|
|
2462
2462
|
},
|
|
2463
|
-
subscribe: (
|
|
2463
|
+
subscribe: (s) => (e.push(s), {
|
|
2464
2464
|
unsubscribe: () => {
|
|
2465
|
-
e = e.filter((
|
|
2465
|
+
e = e.filter((a) => a !== s);
|
|
2466
2466
|
}
|
|
2467
2467
|
}),
|
|
2468
2468
|
unsubscribe: () => {
|
|
@@ -2479,19 +2479,19 @@ function be(e, t) {
|
|
|
2479
2479
|
const r = Object.keys(e), n = Object.keys(t);
|
|
2480
2480
|
if (r.length !== n.length)
|
|
2481
2481
|
return !1;
|
|
2482
|
-
for (const
|
|
2483
|
-
const
|
|
2484
|
-
if (!n.includes(
|
|
2482
|
+
for (const s of r) {
|
|
2483
|
+
const a = e[s];
|
|
2484
|
+
if (!n.includes(s))
|
|
2485
2485
|
return !1;
|
|
2486
|
-
if (
|
|
2487
|
-
const i = t[
|
|
2488
|
-
if (_e(
|
|
2486
|
+
if (s !== "ref") {
|
|
2487
|
+
const i = t[s];
|
|
2488
|
+
if (_e(a) && _e(i) || $(a) && $(i) || Array.isArray(a) && Array.isArray(i) ? !be(a, i) : a !== i)
|
|
2489
2489
|
return !1;
|
|
2490
2490
|
}
|
|
2491
2491
|
}
|
|
2492
2492
|
return !0;
|
|
2493
2493
|
}
|
|
2494
|
-
var br = (e) => e.type === "select-multiple", Xn = (e) => xt(e) ||
|
|
2494
|
+
var br = (e) => e.type === "select-multiple", Xn = (e) => xt(e) || Oe(e), lt = (e) => Ge(e) && e.isConnected, yr = (e) => {
|
|
2495
2495
|
for (const t in e)
|
|
2496
2496
|
if (fe(e[t]))
|
|
2497
2497
|
return !0;
|
|
@@ -2507,26 +2507,26 @@ function Je(e, t = {}) {
|
|
|
2507
2507
|
function vr(e, t, r) {
|
|
2508
2508
|
const n = Array.isArray(e);
|
|
2509
2509
|
if ($(e) || n)
|
|
2510
|
-
for (const
|
|
2511
|
-
Array.isArray(e[
|
|
2510
|
+
for (const s in e)
|
|
2511
|
+
Array.isArray(e[s]) || $(e[s]) && !yr(e[s]) ? O(t) || We(r[s]) ? r[s] = Array.isArray(e[s]) ? Je(e[s], []) : { ...Je(e[s]) } : vr(e[s], U(t) ? {} : t[s], r[s]) : r[s] = !be(e[s], t[s]);
|
|
2512
2512
|
return r;
|
|
2513
2513
|
}
|
|
2514
2514
|
var ut = (e, t) => vr(e, t, Je(t)), xr = (e, { valueAsNumber: t, valueAsDate: r, setValueAs: n }) => O(e) ? e : t ? e === "" ? NaN : e && +e : r && te(e) ? new Date(e) : n ? n(e) : e;
|
|
2515
2515
|
function ct(e) {
|
|
2516
2516
|
const t = e.ref;
|
|
2517
2517
|
if (!(e.refs ? e.refs.every((r) => r.disabled) : t.disabled))
|
|
2518
|
-
return vt(t) ? t.files : xt(t) ? gr(e.refs).value : br(t) ? [...t.selectedOptions].map(({ value: r }) => r) :
|
|
2518
|
+
return vt(t) ? t.files : xt(t) ? gr(e.refs).value : br(t) ? [...t.selectedOptions].map(({ value: r }) => r) : Oe(t) ? mr(e.refs).value : xr(O(t.value) ? e.ref.value : t.value, e);
|
|
2519
2519
|
}
|
|
2520
2520
|
var Qn = (e, t, r, n) => {
|
|
2521
|
-
const
|
|
2522
|
-
for (const
|
|
2523
|
-
const i = w(t,
|
|
2524
|
-
i && L(
|
|
2521
|
+
const s = {};
|
|
2522
|
+
for (const a of e) {
|
|
2523
|
+
const i = w(t, a);
|
|
2524
|
+
i && L(s, a, i._f);
|
|
2525
2525
|
}
|
|
2526
2526
|
return {
|
|
2527
2527
|
criteriaMode: r,
|
|
2528
2528
|
names: [...e],
|
|
2529
|
-
fields:
|
|
2529
|
+
fields: s,
|
|
2530
2530
|
shouldUseNativeValidation: n
|
|
2531
2531
|
};
|
|
2532
2532
|
}, Ie = (e) => O(e) ? e : He(e) ? e.source : $(e) ? He(e.value) ? e.value.source : e.value : e, Yn = (e) => e.mount && (e.required || e.min || e.max || e.maxLength || e.minLength || e.pattern || e.validate);
|
|
@@ -2537,23 +2537,23 @@ function Gt(e, t, r) {
|
|
|
2537
2537
|
error: n,
|
|
2538
2538
|
name: r
|
|
2539
2539
|
};
|
|
2540
|
-
const
|
|
2541
|
-
for (;
|
|
2542
|
-
const
|
|
2543
|
-
if (i && !Array.isArray(i) && r !==
|
|
2540
|
+
const s = r.split(".");
|
|
2541
|
+
for (; s.length; ) {
|
|
2542
|
+
const a = s.join("."), i = w(t, a), u = w(e, a);
|
|
2543
|
+
if (i && !Array.isArray(i) && r !== a)
|
|
2544
2544
|
return { name: r };
|
|
2545
2545
|
if (u && u.type)
|
|
2546
2546
|
return {
|
|
2547
|
-
name:
|
|
2547
|
+
name: a,
|
|
2548
2548
|
error: u
|
|
2549
2549
|
};
|
|
2550
|
-
|
|
2550
|
+
s.pop();
|
|
2551
2551
|
}
|
|
2552
2552
|
return {
|
|
2553
2553
|
name: r
|
|
2554
2554
|
};
|
|
2555
2555
|
}
|
|
2556
|
-
var es = (e, t, r, n,
|
|
2556
|
+
var es = (e, t, r, n, s) => s.isOnAll ? !1 : !r && s.isOnTouch ? !(t || e) : (r ? n.isOnBlur : s.isOnBlur) ? !e : (r ? n.isOnChange : s.isOnChange) ? e : !0, ts = (e, t) => !Be(w(e, t)).length && j(e, t);
|
|
2557
2557
|
const rs = {
|
|
2558
2558
|
mode: Z.onSubmit,
|
|
2559
2559
|
reValidateMode: Z.onChange,
|
|
@@ -2576,7 +2576,7 @@ function ns(e = {}, t) {
|
|
|
2576
2576
|
dirtyFields: {},
|
|
2577
2577
|
errors: {},
|
|
2578
2578
|
disabled: !1
|
|
2579
|
-
},
|
|
2579
|
+
}, s = {}, a = $(r.defaultValues) || $(r.values) ? oe(r.defaultValues || r.values) || {} : {}, i = r.shouldUnregister ? {} : oe(a), u = {
|
|
2580
2580
|
action: !1,
|
|
2581
2581
|
mount: !1,
|
|
2582
2582
|
watch: !1
|
|
@@ -2585,7 +2585,7 @@ function ns(e = {}, t) {
|
|
|
2585
2585
|
unMount: /* @__PURE__ */ new Set(),
|
|
2586
2586
|
array: /* @__PURE__ */ new Set(),
|
|
2587
2587
|
watch: /* @__PURE__ */ new Set()
|
|
2588
|
-
},
|
|
2588
|
+
}, h, x = 0;
|
|
2589
2589
|
const v = {
|
|
2590
2590
|
isDirty: !1,
|
|
2591
2591
|
dirtyFields: !1,
|
|
@@ -2593,7 +2593,7 @@ function ns(e = {}, t) {
|
|
|
2593
2593
|
isValidating: !1,
|
|
2594
2594
|
isValid: !1,
|
|
2595
2595
|
errors: !1
|
|
2596
|
-
},
|
|
2596
|
+
}, p = {
|
|
2597
2597
|
values: ot(),
|
|
2598
2598
|
array: ot(),
|
|
2599
2599
|
state: ot()
|
|
@@ -2601,18 +2601,18 @@ function ns(e = {}, t) {
|
|
|
2601
2601
|
clearTimeout(x), x = setTimeout(o, c);
|
|
2602
2602
|
}, g = async (o) => {
|
|
2603
2603
|
if (v.isValid || o) {
|
|
2604
|
-
const c = r.resolver ? J((await H()).errors) : await q(
|
|
2605
|
-
c !== n.isValid &&
|
|
2604
|
+
const c = r.resolver ? J((await H()).errors) : await q(s, !0);
|
|
2605
|
+
c !== n.isValid && p.state.next({
|
|
2606
2606
|
isValid: c
|
|
2607
2607
|
});
|
|
2608
2608
|
}
|
|
2609
|
-
}, N = (o) => v.isValidating &&
|
|
2609
|
+
}, N = (o) => v.isValidating && p.state.next({
|
|
2610
2610
|
isValidating: o
|
|
2611
2611
|
}), P = (o, c = [], f, _, b = !0, m = !0) => {
|
|
2612
2612
|
if (_ && f) {
|
|
2613
|
-
if (u.action = !0, m && Array.isArray(w(
|
|
2614
|
-
const C = f(w(
|
|
2615
|
-
b && L(
|
|
2613
|
+
if (u.action = !0, m && Array.isArray(w(s, o))) {
|
|
2614
|
+
const C = f(w(s, o), _.argA, _.argB);
|
|
2615
|
+
b && L(s, o, C);
|
|
2616
2616
|
}
|
|
2617
2617
|
if (m && Array.isArray(w(n.errors, o))) {
|
|
2618
2618
|
const C = f(w(n.errors, o), _.argA, _.argB);
|
|
@@ -2622,7 +2622,7 @@ function ns(e = {}, t) {
|
|
|
2622
2622
|
const C = f(w(n.touchedFields, o), _.argA, _.argB);
|
|
2623
2623
|
b && L(n.touchedFields, o, C);
|
|
2624
2624
|
}
|
|
2625
|
-
v.dirtyFields && (n.dirtyFields = ut(
|
|
2625
|
+
v.dirtyFields && (n.dirtyFields = ut(a, i)), p.state.next({
|
|
2626
2626
|
name: o,
|
|
2627
2627
|
isDirty: I(o, c),
|
|
2628
2628
|
dirtyFields: n.dirtyFields,
|
|
@@ -2632,13 +2632,13 @@ function ns(e = {}, t) {
|
|
|
2632
2632
|
} else
|
|
2633
2633
|
L(i, o, c);
|
|
2634
2634
|
}, D = (o, c) => {
|
|
2635
|
-
L(n.errors, o, c),
|
|
2635
|
+
L(n.errors, o, c), p.state.next({
|
|
2636
2636
|
errors: n.errors
|
|
2637
2637
|
});
|
|
2638
2638
|
}, me = (o, c, f, _) => {
|
|
2639
|
-
const b = w(
|
|
2639
|
+
const b = w(s, o);
|
|
2640
2640
|
if (b) {
|
|
2641
|
-
const m = w(i, o, O(f) ? w(
|
|
2641
|
+
const m = w(i, o, O(f) ? w(a, o) : f);
|
|
2642
2642
|
O(m) || _ && _.defaultChecked || c ? L(i, o, c ? m : ct(b._f)) : W(o, m), u.mount && g();
|
|
2643
2643
|
}
|
|
2644
2644
|
}, ce = (o, c, f, _, b) => {
|
|
@@ -2648,17 +2648,17 @@ function ns(e = {}, t) {
|
|
|
2648
2648
|
};
|
|
2649
2649
|
if (!f || _) {
|
|
2650
2650
|
v.isDirty && (C = n.isDirty, n.isDirty = T.isDirty = I(), m = C !== T.isDirty);
|
|
2651
|
-
const B = be(w(
|
|
2651
|
+
const B = be(w(a, o), c);
|
|
2652
2652
|
C = w(n.dirtyFields, o), B ? j(n.dirtyFields, o) : L(n.dirtyFields, o, !0), T.dirtyFields = n.dirtyFields, m = m || v.dirtyFields && C !== !B;
|
|
2653
2653
|
}
|
|
2654
2654
|
if (f) {
|
|
2655
2655
|
const B = w(n.touchedFields, o);
|
|
2656
2656
|
B || (L(n.touchedFields, o, f), T.touchedFields = n.touchedFields, m = m || v.touchedFields && B !== f);
|
|
2657
2657
|
}
|
|
2658
|
-
return m && b &&
|
|
2658
|
+
return m && b && p.state.next(T), m ? T : {};
|
|
2659
2659
|
}, Ee = (o, c, f, _) => {
|
|
2660
2660
|
const b = w(n.errors, o), m = v.isValid && de(c) && n.isValid !== c;
|
|
2661
|
-
if (e.delayError && f ? (
|
|
2661
|
+
if (e.delayError && f ? (h = E(() => D(o, f)), h(e.delayError)) : (clearTimeout(x), h = null, f ? L(n.errors, o, f) : j(n.errors, o)), (f ? !be(b, f) : b) || !J(_) || m) {
|
|
2662
2662
|
const C = {
|
|
2663
2663
|
..._,
|
|
2664
2664
|
...m && de(c) ? { isValid: c } : {},
|
|
@@ -2668,10 +2668,10 @@ function ns(e = {}, t) {
|
|
|
2668
2668
|
n = {
|
|
2669
2669
|
...n,
|
|
2670
2670
|
...C
|
|
2671
|
-
},
|
|
2671
|
+
}, p.state.next(C);
|
|
2672
2672
|
}
|
|
2673
2673
|
N(!1);
|
|
2674
|
-
}, H = async (o) => r.resolver(i, r.context, Qn(o || d.mount,
|
|
2674
|
+
}, H = async (o) => r.resolver(i, r.context, Qn(o || d.mount, s, r.criteriaMode, r.shouldUseNativeValidation)), se = async (o) => {
|
|
2675
2675
|
const { errors: c } = await H(o);
|
|
2676
2676
|
if (o)
|
|
2677
2677
|
for (const f of o) {
|
|
@@ -2700,18 +2700,18 @@ function ns(e = {}, t) {
|
|
|
2700
2700
|
return f.valid;
|
|
2701
2701
|
}, F = () => {
|
|
2702
2702
|
for (const o of d.unMount) {
|
|
2703
|
-
const c = w(
|
|
2703
|
+
const c = w(s, o);
|
|
2704
2704
|
c && (c._f.refs ? c._f.refs.every((f) => !lt(f)) : !lt(c._f.ref)) && tt(o);
|
|
2705
2705
|
}
|
|
2706
2706
|
d.unMount = /* @__PURE__ */ new Set();
|
|
2707
|
-
}, I = (o, c) => (o && c && L(i, o, c), !be(wt(),
|
|
2708
|
-
...u.mount ? i : O(c) ?
|
|
2709
|
-
}, f, c), K = (o) =>
|
|
2710
|
-
const _ = w(
|
|
2707
|
+
}, I = (o, c) => (o && c && L(i, o, c), !be(wt(), a)), R = (o, c, f) => Hn(o, d, {
|
|
2708
|
+
...u.mount ? i : O(c) ? a : te(o) ? { [o]: c } : c
|
|
2709
|
+
}, f, c), K = (o) => Be(w(u.mount ? i : a, o, e.shouldUnregister ? w(a, o, []) : [])), W = (o, c, f = {}) => {
|
|
2710
|
+
const _ = w(s, o);
|
|
2711
2711
|
let b = c;
|
|
2712
2712
|
if (_) {
|
|
2713
2713
|
const m = _._f;
|
|
2714
|
-
m && (!m.disabled && L(i, o, xr(c, m)), b = Ge(m.ref) && U(c) ? "" : c, br(m.ref) ? [...m.ref.options].forEach((C) => C.selected = b.includes(C.value)) : m.refs ?
|
|
2714
|
+
m && (!m.disabled && L(i, o, xr(c, m)), b = Ge(m.ref) && U(c) ? "" : c, br(m.ref) ? [...m.ref.options].forEach((C) => C.selected = b.includes(C.value)) : m.refs ? Oe(m.ref) ? m.refs.length > 1 ? m.refs.forEach((C) => (!C.defaultChecked || !C.disabled) && (C.checked = Array.isArray(b) ? !!b.find((T) => T === C.value) : b === C.value)) : m.refs[0] && (m.refs[0].checked = !!b) : m.refs.forEach((C) => C.checked = C.value === b) : vt(m.ref) ? m.ref.value = "" : (m.ref.value = b, m.ref.type || p.values.next({
|
|
2715
2715
|
name: o,
|
|
2716
2716
|
values: { ...i }
|
|
2717
2717
|
})));
|
|
@@ -2719,50 +2719,50 @@ function ns(e = {}, t) {
|
|
|
2719
2719
|
(f.shouldDirty || f.shouldTouch) && ce(o, b, f.shouldTouch, f.shouldDirty, !0), f.shouldValidate && et(o);
|
|
2720
2720
|
}, X = (o, c, f) => {
|
|
2721
2721
|
for (const _ in c) {
|
|
2722
|
-
const b = c[_], m = `${o}.${_}`, C = w(
|
|
2722
|
+
const b = c[_], m = `${o}.${_}`, C = w(s, m);
|
|
2723
2723
|
(d.array.has(o) || !We(b) || C && !C._f) && !_e(b) ? X(m, b, f) : W(m, b, f);
|
|
2724
2724
|
}
|
|
2725
2725
|
}, ge = (o, c, f = {}) => {
|
|
2726
|
-
const _ = w(
|
|
2727
|
-
L(i, o, m), b ? (
|
|
2726
|
+
const _ = w(s, o), b = d.array.has(o), m = oe(c);
|
|
2727
|
+
L(i, o, m), b ? (p.array.next({
|
|
2728
2728
|
name: o,
|
|
2729
2729
|
values: { ...i }
|
|
2730
|
-
}), (v.isDirty || v.dirtyFields) && f.shouldDirty &&
|
|
2730
|
+
}), (v.isDirty || v.dirtyFields) && f.shouldDirty && p.state.next({
|
|
2731
2731
|
name: o,
|
|
2732
|
-
dirtyFields: ut(
|
|
2732
|
+
dirtyFields: ut(a, i),
|
|
2733
2733
|
isDirty: I(o, m)
|
|
2734
|
-
})) : _ && !_._f && !U(m) ? X(o, m, f) : W(o, m, f), $t(o, d) &&
|
|
2734
|
+
})) : _ && !_._f && !U(m) ? X(o, m, f) : W(o, m, f), $t(o, d) && p.state.next({ ...n }), p.values.next({
|
|
2735
2735
|
name: o,
|
|
2736
2736
|
values: { ...i }
|
|
2737
2737
|
}), !u.mount && t();
|
|
2738
2738
|
}, Ae = async (o) => {
|
|
2739
2739
|
const c = o.target;
|
|
2740
2740
|
let f = c.name, _ = !0;
|
|
2741
|
-
const b = w(
|
|
2741
|
+
const b = w(s, f), m = () => c.type ? ct(b._f) : $n(o), C = (T) => {
|
|
2742
2742
|
_ = Number.isNaN(T) || T === w(i, f, T);
|
|
2743
2743
|
};
|
|
2744
2744
|
if (b) {
|
|
2745
2745
|
let T, B;
|
|
2746
|
-
const
|
|
2747
|
-
L(i, f,
|
|
2748
|
-
const st = ce(f,
|
|
2749
|
-
if (!xe &&
|
|
2746
|
+
const $e = m(), xe = o.type === Bt.BLUR || o.type === Bt.FOCUS_OUT, Er = !Yn(b._f) && !r.resolver && !w(n.errors, f) && !b._f.deps || es(xe, w(n.touchedFields, f), n.isSubmitted, A, y), nt = $t(f, d, xe);
|
|
2747
|
+
L(i, f, $e), xe ? (b._f.onBlur && b._f.onBlur(o), h && h(0)) : b._f.onChange && b._f.onChange(o);
|
|
2748
|
+
const st = ce(f, $e, xe, !1), Ar = !J(st) || nt;
|
|
2749
|
+
if (!xe && p.values.next({
|
|
2750
2750
|
name: f,
|
|
2751
2751
|
type: o.type,
|
|
2752
2752
|
values: { ...i }
|
|
2753
2753
|
}), Er)
|
|
2754
|
-
return v.isValid && g(), Ar &&
|
|
2755
|
-
if (!xe && nt &&
|
|
2754
|
+
return v.isValid && g(), Ar && p.state.next({ name: f, ...nt ? {} : st });
|
|
2755
|
+
if (!xe && nt && p.state.next({ ...n }), N(!0), r.resolver) {
|
|
2756
2756
|
const { errors: It } = await H([f]);
|
|
2757
|
-
if (C(
|
|
2758
|
-
const Vr = Gt(n.errors,
|
|
2757
|
+
if (C($e), _) {
|
|
2758
|
+
const Vr = Gt(n.errors, s, f), Mt = Gt(It, s, Vr.name || f);
|
|
2759
2759
|
T = Mt.error, f = Mt.name, B = J(It);
|
|
2760
2760
|
}
|
|
2761
2761
|
} else
|
|
2762
|
-
T = (await Kt(b, i, S, r.shouldUseNativeValidation))[f], C(
|
|
2762
|
+
T = (await Kt(b, i, S, r.shouldUseNativeValidation))[f], C($e), _ && (T ? B = !1 : v.isValid && (B = await q(s, !0)));
|
|
2763
2763
|
_ && (b._f.deps && et(b._f.deps), Ee(f, B, T, st));
|
|
2764
2764
|
}
|
|
2765
|
-
},
|
|
2765
|
+
}, Pe = (o, c) => {
|
|
2766
2766
|
if (w(n.errors, c) && o.focus)
|
|
2767
2767
|
return o.focus(), 1;
|
|
2768
2768
|
}, et = async (o, c = {}) => {
|
|
@@ -2773,18 +2773,18 @@ function ns(e = {}, t) {
|
|
|
2773
2773
|
f = J(m), _ = o ? !b.some((C) => w(m, C)) : f;
|
|
2774
2774
|
} else
|
|
2775
2775
|
o ? (_ = (await Promise.all(b.map(async (m) => {
|
|
2776
|
-
const C = w(
|
|
2776
|
+
const C = w(s, m);
|
|
2777
2777
|
return await q(C && C._f ? { [m]: C } : C);
|
|
2778
|
-
}))).every(Boolean), !(!_ && !n.isValid) && g()) : _ = f = await q(
|
|
2779
|
-
return
|
|
2778
|
+
}))).every(Boolean), !(!_ && !n.isValid) && g()) : _ = f = await q(s);
|
|
2779
|
+
return p.state.next({
|
|
2780
2780
|
...!te(o) || v.isValid && f !== n.isValid ? {} : { name: o },
|
|
2781
2781
|
...r.resolver || !o ? { isValid: f } : {},
|
|
2782
2782
|
errors: n.errors,
|
|
2783
2783
|
isValidating: !1
|
|
2784
|
-
}), c.shouldFocus && !_ && ze(
|
|
2784
|
+
}), c.shouldFocus && !_ && ze(s, Pe, o ? b : d.mount), _;
|
|
2785
2785
|
}, wt = (o) => {
|
|
2786
2786
|
const c = {
|
|
2787
|
-
...
|
|
2787
|
+
...a,
|
|
2788
2788
|
...u.mount ? i : {}
|
|
2789
2789
|
};
|
|
2790
2790
|
return O(o) ? c : te(o) ? w(c, o) : o.map((f) => w(c, f));
|
|
@@ -2794,27 +2794,27 @@ function ns(e = {}, t) {
|
|
|
2794
2794
|
isTouched: !!w((c || n).touchedFields, o),
|
|
2795
2795
|
error: w((c || n).errors, o)
|
|
2796
2796
|
}), _r = (o) => {
|
|
2797
|
-
o && it(o).forEach((c) => j(n.errors, c)),
|
|
2797
|
+
o && it(o).forEach((c) => j(n.errors, c)), p.state.next({
|
|
2798
2798
|
errors: o ? n.errors : {}
|
|
2799
2799
|
});
|
|
2800
2800
|
}, kt = (o, c, f) => {
|
|
2801
|
-
const _ = (w(
|
|
2801
|
+
const _ = (w(s, o, { _f: {} })._f || {}).ref;
|
|
2802
2802
|
L(n.errors, o, {
|
|
2803
2803
|
...c,
|
|
2804
2804
|
ref: _
|
|
2805
|
-
}),
|
|
2805
|
+
}), p.state.next({
|
|
2806
2806
|
name: o,
|
|
2807
2807
|
errors: n.errors,
|
|
2808
2808
|
isValid: !1
|
|
2809
2809
|
}), f && f.shouldFocus && _ && _.focus && _.focus();
|
|
2810
|
-
}, kr = (o, c) => fe(o) ?
|
|
2810
|
+
}, kr = (o, c) => fe(o) ? p.values.subscribe({
|
|
2811
2811
|
next: (f) => o(R(void 0, c), f)
|
|
2812
2812
|
}) : R(o, c, !0), tt = (o, c = {}) => {
|
|
2813
2813
|
for (const f of o ? it(o) : d.mount)
|
|
2814
|
-
d.mount.delete(f), d.array.delete(f), c.keepValue || (j(
|
|
2815
|
-
|
|
2814
|
+
d.mount.delete(f), d.array.delete(f), c.keepValue || (j(s, f), j(i, f)), !c.keepError && j(n.errors, f), !c.keepDirty && j(n.dirtyFields, f), !c.keepTouched && j(n.touchedFields, f), !r.shouldUnregister && !c.keepDefaultValue && j(a, f);
|
|
2815
|
+
p.values.next({
|
|
2816
2816
|
values: { ...i }
|
|
2817
|
-
}),
|
|
2817
|
+
}), p.state.next({
|
|
2818
2818
|
...n,
|
|
2819
2819
|
...c.keepDirty ? { isDirty: I() } : {}
|
|
2820
2820
|
}), !c.keepIsValid && g();
|
|
@@ -2824,9 +2824,9 @@ function ns(e = {}, t) {
|
|
|
2824
2824
|
L(i, c, m), ce(c, m, !1, !1, !0);
|
|
2825
2825
|
}
|
|
2826
2826
|
}, rt = (o, c = {}) => {
|
|
2827
|
-
let f = w(
|
|
2827
|
+
let f = w(s, o);
|
|
2828
2828
|
const _ = de(c.disabled);
|
|
2829
|
-
return L(
|
|
2829
|
+
return L(s, o, {
|
|
2830
2830
|
...f || {},
|
|
2831
2831
|
_f: {
|
|
2832
2832
|
...f && f._f ? f._f : { ref: { name: o } },
|
|
@@ -2853,44 +2853,44 @@ function ns(e = {}, t) {
|
|
|
2853
2853
|
onBlur: Ae,
|
|
2854
2854
|
ref: (b) => {
|
|
2855
2855
|
if (b) {
|
|
2856
|
-
rt(o, c), f = w(
|
|
2856
|
+
rt(o, c), f = w(s, o);
|
|
2857
2857
|
const m = O(b.value) && b.querySelectorAll && b.querySelectorAll("input,select,textarea")[0] || b, C = Xn(m), T = f._f.refs || [];
|
|
2858
2858
|
if (C ? T.find((B) => B === m) : m === f._f.ref)
|
|
2859
2859
|
return;
|
|
2860
|
-
L(
|
|
2860
|
+
L(s, o, {
|
|
2861
2861
|
_f: {
|
|
2862
2862
|
...f._f,
|
|
2863
2863
|
...C ? {
|
|
2864
2864
|
refs: [
|
|
2865
2865
|
...T.filter(lt),
|
|
2866
2866
|
m,
|
|
2867
|
-
...Array.isArray(w(
|
|
2867
|
+
...Array.isArray(w(a, o)) ? [{}] : []
|
|
2868
2868
|
],
|
|
2869
2869
|
ref: { type: m.type, name: o }
|
|
2870
2870
|
} : { ref: m }
|
|
2871
2871
|
}
|
|
2872
2872
|
}), me(o, !1, void 0, m);
|
|
2873
2873
|
} else
|
|
2874
|
-
f = w(
|
|
2874
|
+
f = w(s, o, {}), f._f && (f._f.mount = !1), (r.shouldUnregister || c.shouldUnregister) && !(zn(d.array, o) && u.action) && d.unMount.add(o);
|
|
2875
2875
|
}
|
|
2876
2876
|
};
|
|
2877
|
-
}, Ct = () => r.shouldFocusError && ze(
|
|
2878
|
-
de(o) && (
|
|
2877
|
+
}, Ct = () => r.shouldFocusError && ze(s, Pe, d.mount), Sr = (o) => {
|
|
2878
|
+
de(o) && (p.state.next({ disabled: o }), ze(s, (c) => {
|
|
2879
2879
|
c.disabled = o;
|
|
2880
2880
|
}, 0, !1));
|
|
2881
2881
|
}, Et = (o, c) => async (f) => {
|
|
2882
2882
|
f && (f.preventDefault && f.preventDefault(), f.persist && f.persist());
|
|
2883
2883
|
let _ = oe(i);
|
|
2884
|
-
if (
|
|
2884
|
+
if (p.state.next({
|
|
2885
2885
|
isSubmitting: !0
|
|
2886
2886
|
}), r.resolver) {
|
|
2887
2887
|
const { errors: b, values: m } = await H();
|
|
2888
2888
|
n.errors = b, _ = m;
|
|
2889
2889
|
} else
|
|
2890
|
-
await q(
|
|
2891
|
-
j(n.errors, "root"), J(n.errors) ? (
|
|
2890
|
+
await q(s);
|
|
2891
|
+
j(n.errors, "root"), J(n.errors) ? (p.state.next({
|
|
2892
2892
|
errors: {}
|
|
2893
|
-
}), await o(_, f)) : (c && await c({ ...n.errors }, f), Ct(), setTimeout(Ct)),
|
|
2893
|
+
}), await o(_, f)) : (c && await c({ ...n.errors }, f), Ct(), setTimeout(Ct)), p.state.next({
|
|
2894
2894
|
isSubmitted: !0,
|
|
2895
2895
|
isSubmitting: !1,
|
|
2896
2896
|
isSubmitSuccessful: J(n.errors),
|
|
@@ -2898,17 +2898,17 @@ function ns(e = {}, t) {
|
|
|
2898
2898
|
errors: n.errors
|
|
2899
2899
|
});
|
|
2900
2900
|
}, Cr = (o, c = {}) => {
|
|
2901
|
-
w(
|
|
2901
|
+
w(s, o) && (O(c.defaultValue) ? ge(o, w(a, o)) : (ge(o, c.defaultValue), L(a, o, c.defaultValue)), c.keepTouched || j(n.touchedFields, o), c.keepDirty || (j(n.dirtyFields, o), n.isDirty = c.defaultValue ? I(o, w(a, o)) : I()), c.keepError || (j(n.errors, o), v.isValid && g()), p.state.next({ ...n }));
|
|
2902
2902
|
}, At = (o, c = {}) => {
|
|
2903
|
-
const f = o ? oe(o) :
|
|
2904
|
-
if (c.keepDefaultValues || (
|
|
2903
|
+
const f = o ? oe(o) : a, _ = oe(f), b = o && !J(o) ? _ : a;
|
|
2904
|
+
if (c.keepDefaultValues || (a = f), !c.keepValues) {
|
|
2905
2905
|
if (c.keepDirtyValues || k)
|
|
2906
2906
|
for (const m of d.mount)
|
|
2907
2907
|
w(n.dirtyFields, m) ? L(b, m, w(i, m)) : ge(m, w(b, m));
|
|
2908
2908
|
else {
|
|
2909
2909
|
if (bt && O(o))
|
|
2910
2910
|
for (const m of d.mount) {
|
|
2911
|
-
const C = w(
|
|
2911
|
+
const C = w(s, m);
|
|
2912
2912
|
if (C && C._f) {
|
|
2913
2913
|
const T = Array.isArray(C._f.refs) ? C._f.refs[0] : C._f.ref;
|
|
2914
2914
|
if (Ge(T)) {
|
|
@@ -2920,11 +2920,11 @@ function ns(e = {}, t) {
|
|
|
2920
2920
|
}
|
|
2921
2921
|
}
|
|
2922
2922
|
}
|
|
2923
|
-
|
|
2923
|
+
s = {};
|
|
2924
2924
|
}
|
|
2925
|
-
i = e.shouldUnregister ? c.keepDefaultValues ? oe(
|
|
2925
|
+
i = e.shouldUnregister ? c.keepDefaultValues ? oe(a) : {} : oe(b), p.array.next({
|
|
2926
2926
|
values: { ...b }
|
|
2927
|
-
}),
|
|
2927
|
+
}), p.values.next({
|
|
2928
2928
|
values: { ...b }
|
|
2929
2929
|
});
|
|
2930
2930
|
}
|
|
@@ -2935,11 +2935,11 @@ function ns(e = {}, t) {
|
|
|
2935
2935
|
watch: /* @__PURE__ */ new Set(),
|
|
2936
2936
|
watchAll: !1,
|
|
2937
2937
|
focus: ""
|
|
2938
|
-
}, !u.mount && t(), u.mount = !v.isValid || !!c.keepIsValid, u.watch = !!e.shouldUnregister,
|
|
2938
|
+
}, !u.mount && t(), u.mount = !v.isValid || !!c.keepIsValid, u.watch = !!e.shouldUnregister, p.state.next({
|
|
2939
2939
|
submitCount: c.keepSubmitCount ? n.submitCount : 0,
|
|
2940
|
-
isDirty: c.keepDirty ? n.isDirty : !!(c.keepDefaultValues && !be(o,
|
|
2940
|
+
isDirty: c.keepDirty ? n.isDirty : !!(c.keepDefaultValues && !be(o, a)),
|
|
2941
2941
|
isSubmitted: c.keepIsSubmitted ? n.isSubmitted : !1,
|
|
2942
|
-
dirtyFields: c.keepDirtyValues ? n.dirtyFields : c.keepDefaultValues && o ? ut(
|
|
2942
|
+
dirtyFields: c.keepDirtyValues ? n.dirtyFields : c.keepDefaultValues && o ? ut(a, o) : {},
|
|
2943
2943
|
touchedFields: c.keepTouched ? n.touchedFields : {},
|
|
2944
2944
|
errors: c.keepErrors ? n.errors : {},
|
|
2945
2945
|
isSubmitSuccessful: c.keepIsSubmitSuccessful ? n.isSubmitSuccessful : !1,
|
|
@@ -2963,7 +2963,7 @@ function ns(e = {}, t) {
|
|
|
2963
2963
|
_getFieldArray: K,
|
|
2964
2964
|
_reset: At,
|
|
2965
2965
|
_resetDefaultValues: () => fe(r.defaultValues) && r.defaultValues().then((o) => {
|
|
2966
|
-
Vt(o, r.resetOptions),
|
|
2966
|
+
Vt(o, r.resetOptions), p.state.next({
|
|
2967
2967
|
isLoading: !1
|
|
2968
2968
|
});
|
|
2969
2969
|
}),
|
|
@@ -2974,10 +2974,10 @@ function ns(e = {}, t) {
|
|
|
2974
2974
|
};
|
|
2975
2975
|
},
|
|
2976
2976
|
_disableForm: Sr,
|
|
2977
|
-
_subjects:
|
|
2977
|
+
_subjects: p,
|
|
2978
2978
|
_proxyFormState: v,
|
|
2979
2979
|
get _fields() {
|
|
2980
|
-
return
|
|
2980
|
+
return s;
|
|
2981
2981
|
},
|
|
2982
2982
|
get _formValues() {
|
|
2983
2983
|
return i;
|
|
@@ -2989,7 +2989,7 @@ function ns(e = {}, t) {
|
|
|
2989
2989
|
u = o;
|
|
2990
2990
|
},
|
|
2991
2991
|
get _defaultValues() {
|
|
2992
|
-
return
|
|
2992
|
+
return a;
|
|
2993
2993
|
},
|
|
2994
2994
|
get _names() {
|
|
2995
2995
|
return d;
|
|
@@ -3025,7 +3025,7 @@ function ns(e = {}, t) {
|
|
|
3025
3025
|
unregister: tt,
|
|
3026
3026
|
setError: kt,
|
|
3027
3027
|
setFocus: (o, c = {}) => {
|
|
3028
|
-
const f = w(
|
|
3028
|
+
const f = w(s, o), _ = f && f._f;
|
|
3029
3029
|
if (_) {
|
|
3030
3030
|
const b = _.refs ? _.refs[0] : _.ref;
|
|
3031
3031
|
b.focus && (b.focus(), c.shouldSelect && b.select());
|
|
@@ -3035,7 +3035,7 @@ function ns(e = {}, t) {
|
|
|
3035
3035
|
};
|
|
3036
3036
|
}
|
|
3037
3037
|
function Qe(e = {}) {
|
|
3038
|
-
const t = Q.useRef(), r = Q.useRef(), [n,
|
|
3038
|
+
const t = Q.useRef(), r = Q.useRef(), [n, s] = Q.useState({
|
|
3039
3039
|
isDirty: !1,
|
|
3040
3040
|
isValidating: !1,
|
|
3041
3041
|
isLoading: fe(e.defaultValues),
|
|
@@ -3051,27 +3051,27 @@ function Qe(e = {}) {
|
|
|
3051
3051
|
defaultValues: fe(e.defaultValues) ? void 0 : e.defaultValues
|
|
3052
3052
|
});
|
|
3053
3053
|
t.current || (t.current = {
|
|
3054
|
-
...ns(e, () =>
|
|
3054
|
+
...ns(e, () => s((i) => ({ ...i }))),
|
|
3055
3055
|
formState: n
|
|
3056
3056
|
});
|
|
3057
|
-
const
|
|
3058
|
-
return
|
|
3059
|
-
subject:
|
|
3057
|
+
const a = t.current.control;
|
|
3058
|
+
return a._options = e, Gn({
|
|
3059
|
+
subject: a._subjects.state,
|
|
3060
3060
|
next: (i) => {
|
|
3061
|
-
Kn(i,
|
|
3061
|
+
Kn(i, a._proxyFormState, a._updateFormState, !0) && s({ ...a._formState });
|
|
3062
3062
|
}
|
|
3063
|
-
}), Q.useEffect(() =>
|
|
3064
|
-
if (
|
|
3065
|
-
const i =
|
|
3066
|
-
i !== n.isDirty &&
|
|
3063
|
+
}), Q.useEffect(() => a._disableForm(e.disabled), [a, e.disabled]), Q.useEffect(() => {
|
|
3064
|
+
if (a._proxyFormState.isDirty) {
|
|
3065
|
+
const i = a._getDirty();
|
|
3066
|
+
i !== n.isDirty && a._subjects.state.next({
|
|
3067
3067
|
isDirty: i
|
|
3068
3068
|
});
|
|
3069
3069
|
}
|
|
3070
|
-
}, [
|
|
3071
|
-
e.values && !be(e.values, r.current) ? (
|
|
3072
|
-
}, [e.values,
|
|
3073
|
-
|
|
3074
|
-
}), t.current.formState = Un(n,
|
|
3070
|
+
}, [a, n.isDirty]), Q.useEffect(() => {
|
|
3071
|
+
e.values && !be(e.values, r.current) ? (a._reset(e.values, a._options.resetOptions), r.current = e.values) : a._resetDefaultValues();
|
|
3072
|
+
}, [e.values, a]), Q.useEffect(() => {
|
|
3073
|
+
a._state.mount || (a._updateValid(), a._state.mount = !0), a._state.watch && (a._state.watch = !1, a._subjects.state.next({ ...a._formState })), a._removeUnmounted();
|
|
3074
|
+
}), t.current.formState = Un(n, a), t.current;
|
|
3075
3075
|
}
|
|
3076
3076
|
var Ht = function(e, t, r) {
|
|
3077
3077
|
if (e && "reportValidity" in e) {
|
|
@@ -3079,10 +3079,10 @@ var Ht = function(e, t, r) {
|
|
|
3079
3079
|
e.setCustomValidity(n && n.message || ""), e.reportValidity();
|
|
3080
3080
|
}
|
|
3081
3081
|
}, ss = function(e, t) {
|
|
3082
|
-
var r = function(
|
|
3083
|
-
var
|
|
3084
|
-
|
|
3085
|
-
return Ht(i,
|
|
3082
|
+
var r = function(s) {
|
|
3083
|
+
var a = t.fields[s];
|
|
3084
|
+
a && a.ref && "reportValidity" in a.ref ? Ht(a.ref, s, e) : a.refs && a.refs.forEach(function(i) {
|
|
3085
|
+
return Ht(i, s, e);
|
|
3086
3086
|
});
|
|
3087
3087
|
};
|
|
3088
3088
|
for (var n in t.fields)
|
|
@@ -3091,12 +3091,12 @@ var Ht = function(e, t, r) {
|
|
|
3091
3091
|
t.shouldUseNativeValidation && ss(e, t);
|
|
3092
3092
|
var r = {};
|
|
3093
3093
|
for (var n in e) {
|
|
3094
|
-
var
|
|
3094
|
+
var s = w(t.fields, n), a = Object.assign(e[n] || {}, { ref: s && s.ref });
|
|
3095
3095
|
if (os(t.names || Object.keys(e), n)) {
|
|
3096
3096
|
var i = Object.assign({}, is(w(r, n)));
|
|
3097
|
-
L(i, "root",
|
|
3097
|
+
L(i, "root", a), L(r, n, i);
|
|
3098
3098
|
} else
|
|
3099
|
-
L(r, n,
|
|
3099
|
+
L(r, n, a);
|
|
3100
3100
|
}
|
|
3101
3101
|
return r;
|
|
3102
3102
|
}, is = function(e) {
|
|
@@ -3109,36 +3109,36 @@ var Ht = function(e, t, r) {
|
|
|
3109
3109
|
for (var r = {}; e.issues.length; ) {
|
|
3110
3110
|
var n = e.issues[0];
|
|
3111
3111
|
if (n.path) {
|
|
3112
|
-
var
|
|
3112
|
+
var s = n.path.map(function(u) {
|
|
3113
3113
|
return u.key;
|
|
3114
3114
|
}).join(".");
|
|
3115
|
-
if (r[
|
|
3116
|
-
var
|
|
3117
|
-
r[
|
|
3115
|
+
if (r[s] || (r[s] = { message: n.message, type: n.validation }), t) {
|
|
3116
|
+
var a = r[s].types, i = a && a[n.validation];
|
|
3117
|
+
r[s] = pr(s, t, r, n.validation, i ? [].concat(i, n.message) : n.message);
|
|
3118
3118
|
}
|
|
3119
3119
|
e.issues.shift();
|
|
3120
3120
|
}
|
|
3121
3121
|
}
|
|
3122
3122
|
return r;
|
|
3123
3123
|
}, Ye = function(e, t, r) {
|
|
3124
|
-
return r === void 0 && (r = {}), function(n,
|
|
3124
|
+
return r === void 0 && (r = {}), function(n, s, a) {
|
|
3125
3125
|
try {
|
|
3126
3126
|
return Promise.resolve(function(i, u) {
|
|
3127
3127
|
try {
|
|
3128
3128
|
var d = function() {
|
|
3129
|
-
function
|
|
3129
|
+
function h(v) {
|
|
3130
3130
|
return { values: r.raw ? n : v, errors: {} };
|
|
3131
3131
|
}
|
|
3132
3132
|
var x = Object.assign({}, { abortEarly: !1, abortPipeEarly: !1 }, t);
|
|
3133
|
-
return r.mode === "sync" ?
|
|
3133
|
+
return r.mode === "sync" ? h(nr(e, n, x)) : Promise.resolve(Dr(e, n, x)).then(h);
|
|
3134
3134
|
}();
|
|
3135
|
-
} catch (
|
|
3136
|
-
return u(
|
|
3135
|
+
} catch (h) {
|
|
3136
|
+
return u(h);
|
|
3137
3137
|
}
|
|
3138
3138
|
return d && d.then ? d.then(void 0, u) : d;
|
|
3139
3139
|
}(0, function(i) {
|
|
3140
3140
|
if (i instanceof Rr)
|
|
3141
|
-
return { values: {}, errors: as(ls(i, !
|
|
3141
|
+
return { values: {}, errors: as(ls(i, !a.shouldUseNativeValidation && a.criteriaMode === "all"), a) };
|
|
3142
3142
|
throw i;
|
|
3143
3143
|
}));
|
|
3144
3144
|
} catch (i) {
|
|
@@ -3152,9 +3152,9 @@ const Wt = 27, Jt = 12, Zt = 10, us = Se("enum"), cs = (e, t) => {
|
|
|
3152
3152
|
max: e.maxSelected ?? e.options.length
|
|
3153
3153
|
};
|
|
3154
3154
|
return Ye(he({
|
|
3155
|
-
checked: sr(Or(Br()), (n) => Object.entries(n).filter(([
|
|
3155
|
+
checked: sr(Or(Br()), (n) => Object.entries(n).filter(([s, a]) => a).map(([s, a]) => s), [je(r.max, t("validation_multiple_choice_max", {
|
|
3156
3156
|
count: r.max
|
|
3157
|
-
})),
|
|
3157
|
+
})), Te(r.min, t("validation_multiple_choice_min", {
|
|
3158
3158
|
count: r.min
|
|
3159
3159
|
}))])
|
|
3160
3160
|
}));
|
|
@@ -3186,8 +3186,8 @@ const Wt = 27, Jt = 12, Zt = 10, us = Se("enum"), cs = (e, t) => {
|
|
|
3186
3186
|
onSubmitSuccess: t
|
|
3187
3187
|
}) => {
|
|
3188
3188
|
var x, v;
|
|
3189
|
-
const r = e.key ? (x = M.current$.value.flow) == null ? void 0 : x.data.submissions[e.key] : void 0, n = (e.config.minSelected === 1 || e.config.minSelected === void 0) && e.config.maxSelected === 1,
|
|
3190
|
-
t:
|
|
3189
|
+
const r = e.key ? (x = M.current$.value.flow) == null ? void 0 : x.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, {
|
|
3190
|
+
t: a
|
|
3191
3191
|
} = G(), {
|
|
3192
3192
|
register: i,
|
|
3193
3193
|
handleSubmit: u,
|
|
@@ -3196,41 +3196,41 @@ const Wt = 27, Jt = 12, Zt = 10, us = Se("enum"), cs = (e, t) => {
|
|
|
3196
3196
|
}
|
|
3197
3197
|
} = Qe({
|
|
3198
3198
|
defaultValues: {
|
|
3199
|
-
checked: n ? {} : us(r) ? Object.fromEntries(r.value.map((
|
|
3199
|
+
checked: n ? {} : us(r) ? Object.fromEntries(r.value.map((p) => [p, !0])) : {}
|
|
3200
3200
|
},
|
|
3201
|
-
resolver: cs(e.config,
|
|
3202
|
-
}),
|
|
3203
|
-
return
|
|
3201
|
+
resolver: cs(e.config, a)
|
|
3202
|
+
}), h = gt();
|
|
3203
|
+
return s ? l("ul", {
|
|
3204
3204
|
style: {
|
|
3205
3205
|
maxHeight: 6.5 * Wt + 5 * Jt + 2 * Zt
|
|
3206
3206
|
},
|
|
3207
3207
|
class: Xt({
|
|
3208
3208
|
variant: "booleanLike"
|
|
3209
3209
|
}),
|
|
3210
|
-
children: e.config.options.map((
|
|
3210
|
+
children: e.config.options.map((p, k) => l("li", {
|
|
3211
3211
|
class: "flex-1",
|
|
3212
3212
|
children: l(cr, {
|
|
3213
3213
|
type: "submit",
|
|
3214
3214
|
ref: (y) => {
|
|
3215
|
-
y && k === 0 && (
|
|
3215
|
+
y && k === 0 && (h.current = y);
|
|
3216
3216
|
},
|
|
3217
|
-
label:
|
|
3217
|
+
label: p.label,
|
|
3218
3218
|
value: "true",
|
|
3219
3219
|
onClick: () => t({
|
|
3220
3220
|
type: "enum",
|
|
3221
|
-
value: [
|
|
3221
|
+
value: [p.value]
|
|
3222
3222
|
})
|
|
3223
3223
|
})
|
|
3224
|
-
},
|
|
3224
|
+
}, p.value))
|
|
3225
3225
|
}) : l("form", {
|
|
3226
3226
|
noValidate: !0,
|
|
3227
|
-
onSubmit: (
|
|
3227
|
+
onSubmit: (p) => u((k) => {
|
|
3228
3228
|
const y = k.checked;
|
|
3229
3229
|
t({
|
|
3230
3230
|
type: "enum",
|
|
3231
3231
|
value: y
|
|
3232
3232
|
});
|
|
3233
|
-
})(
|
|
3233
|
+
})(p),
|
|
3234
3234
|
children: [l("div", {
|
|
3235
3235
|
class: "flex items-center gap-1",
|
|
3236
3236
|
children: [l("ul", {
|
|
@@ -3240,27 +3240,27 @@ const Wt = 27, Jt = 12, Zt = 10, us = Se("enum"), cs = (e, t) => {
|
|
|
3240
3240
|
class: Xt({
|
|
3241
3241
|
variant: e.config.options.length === 1 ? "singleOption" : void 0
|
|
3242
3242
|
}),
|
|
3243
|
-
children: e.config.options.map((
|
|
3244
|
-
const y = `checked.${
|
|
3243
|
+
children: e.config.options.map((p, k) => {
|
|
3244
|
+
const y = `checked.${p.value}`, {
|
|
3245
3245
|
ref: A,
|
|
3246
3246
|
...S
|
|
3247
3247
|
} = i(y);
|
|
3248
3248
|
return l("li", {
|
|
3249
3249
|
class: "relative",
|
|
3250
3250
|
children: l(ds, {
|
|
3251
|
-
option:
|
|
3251
|
+
option: p,
|
|
3252
3252
|
autoFocus: k === 0,
|
|
3253
3253
|
ref: (E) => {
|
|
3254
|
-
E && k === 0 && (
|
|
3254
|
+
E && k === 0 && (h.current = E), A(E);
|
|
3255
3255
|
},
|
|
3256
3256
|
id: y,
|
|
3257
3257
|
...S,
|
|
3258
3258
|
onClick: n ? () => t({
|
|
3259
3259
|
type: "enum",
|
|
3260
|
-
value: [
|
|
3260
|
+
value: [p.value]
|
|
3261
3261
|
}) : void 0
|
|
3262
3262
|
})
|
|
3263
|
-
},
|
|
3263
|
+
}, p.value);
|
|
3264
3264
|
})
|
|
3265
3265
|
}), l("div", {
|
|
3266
3266
|
class: "flex flex-col items-center gap-2 pr-2.5 pt-2.5",
|
|
@@ -3280,14 +3280,14 @@ const Wt = 27, Jt = 12, Zt = 10, us = Se("enum"), cs = (e, t) => {
|
|
|
3280
3280
|
})]
|
|
3281
3281
|
});
|
|
3282
3282
|
}, hs = Se("number"), ps = (e, t) => {
|
|
3283
|
-
const r = e.min ?? Number.MIN_SAFE_INTEGER, n = e.max ?? Number.MAX_SAFE_INTEGER,
|
|
3283
|
+
const r = e.min ?? Number.MIN_SAFE_INTEGER, n = e.max ?? Number.MAX_SAFE_INTEGER, s = e.decimalCases ?? 0;
|
|
3284
3284
|
return Ye(he({
|
|
3285
3285
|
number: Pr(t("validation_number"), [$r(r, t("validation_number_min", {
|
|
3286
3286
|
min: r
|
|
3287
3287
|
})), jr(n, t("validation_number_max", {
|
|
3288
3288
|
max: n
|
|
3289
|
-
})), zr((
|
|
3290
|
-
count:
|
|
3289
|
+
})), zr((a) => a === Number(a.toFixed(s)), t("validation_number_decimal_cases", {
|
|
3290
|
+
count: s
|
|
3291
3291
|
}))])
|
|
3292
3292
|
}));
|
|
3293
3293
|
}, ms = ({
|
|
@@ -3296,9 +3296,9 @@ const Wt = 27, Jt = 12, Zt = 10, us = Se("enum"), cs = (e, t) => {
|
|
|
3296
3296
|
}) => {
|
|
3297
3297
|
var v;
|
|
3298
3298
|
const r = e.config.defaultValue, n = e.key ? (v = M.current$.value.flow) == null ? void 0 : v.data.submissions[e.key] : void 0, {
|
|
3299
|
-
t:
|
|
3299
|
+
t: s
|
|
3300
3300
|
} = G(), {
|
|
3301
|
-
register:
|
|
3301
|
+
register: a,
|
|
3302
3302
|
handleSubmit: i,
|
|
3303
3303
|
formState: {
|
|
3304
3304
|
errors: u
|
|
@@ -3307,11 +3307,11 @@ const Wt = 27, Jt = 12, Zt = 10, us = Se("enum"), cs = (e, t) => {
|
|
|
3307
3307
|
defaultValues: {
|
|
3308
3308
|
number: r ? Number(r) : hs(n) ? n.value : void 0
|
|
3309
3309
|
},
|
|
3310
|
-
resolver: ps(e.config,
|
|
3310
|
+
resolver: ps(e.config, s)
|
|
3311
3311
|
}), {
|
|
3312
3312
|
ref: d,
|
|
3313
|
-
...
|
|
3314
|
-
} =
|
|
3313
|
+
...h
|
|
3314
|
+
} = a("number", {
|
|
3315
3315
|
required: !e.config.optional,
|
|
3316
3316
|
valueAsNumber: !0
|
|
3317
3317
|
}), x = re();
|
|
@@ -3319,10 +3319,10 @@ const Wt = 27, Jt = 12, Zt = 10, us = Se("enum"), cs = (e, t) => {
|
|
|
3319
3319
|
x.current && (x.current.focus(), x.current.select());
|
|
3320
3320
|
}, []), l("form", {
|
|
3321
3321
|
class: "flex flex-col gap-1 p-2.5",
|
|
3322
|
-
onSubmit: i((
|
|
3323
|
-
|
|
3322
|
+
onSubmit: i((p) => {
|
|
3323
|
+
p.number !== void 0 && t({
|
|
3324
3324
|
type: "number",
|
|
3325
|
-
value:
|
|
3325
|
+
value: p.number
|
|
3326
3326
|
});
|
|
3327
3327
|
}),
|
|
3328
3328
|
children: [l("div", {
|
|
@@ -3330,19 +3330,19 @@ const Wt = 27, Jt = 12, Zt = 10, us = Se("enum"), cs = (e, t) => {
|
|
|
3330
3330
|
children: [l("div", {
|
|
3331
3331
|
class: "relative min-w-0 flex-grow",
|
|
3332
3332
|
children: [l("input", {
|
|
3333
|
-
...
|
|
3333
|
+
...h,
|
|
3334
3334
|
id: "chat-input",
|
|
3335
3335
|
autocomplete: "off",
|
|
3336
3336
|
autoCapitalize: "off",
|
|
3337
3337
|
autoCorrect: "off",
|
|
3338
3338
|
autoFocus: !0,
|
|
3339
|
-
ref: (
|
|
3340
|
-
|
|
3339
|
+
ref: (p) => {
|
|
3340
|
+
p && (x.current = p), d(p);
|
|
3341
3341
|
},
|
|
3342
3342
|
type: "text",
|
|
3343
3343
|
min: e.config.min,
|
|
3344
3344
|
max: e.config.max,
|
|
3345
|
-
class:
|
|
3345
|
+
class: Re({
|
|
3346
3346
|
optional: e.config.optional,
|
|
3347
3347
|
className: "[type=number:-webkit-inner-spin-button] w-full rounded-full [-webkit-outer-spin-button:none]"
|
|
3348
3348
|
}),
|
|
@@ -3362,7 +3362,7 @@ const Wt = 27, Jt = 12, Zt = 10, us = Se("enum"), cs = (e, t) => {
|
|
|
3362
3362
|
countryCode: "",
|
|
3363
3363
|
phoneNumber: ""
|
|
3364
3364
|
};
|
|
3365
|
-
const t = Object.entries(mt).find((
|
|
3365
|
+
const t = Object.entries(mt).find((s) => e.startsWith(s[1])), r = t ? t[1] : "", n = e.replace(r, "");
|
|
3366
3366
|
return /^\d+$/.test(n) ? {
|
|
3367
3367
|
countryCode: r,
|
|
3368
3368
|
phoneNumber: n
|
|
@@ -3371,7 +3371,7 @@ const Wt = 27, Jt = 12, Zt = 10, us = Se("enum"), cs = (e, t) => {
|
|
|
3371
3371
|
phoneNumber: ""
|
|
3372
3372
|
};
|
|
3373
3373
|
}, bs = "44", ys = /^[0-9 ]+$/, vs = Se("string"), xs = Se("phone"), ws = (e) => {
|
|
3374
|
-
const t = ee(e("validation_country_code"), [qr(ys, e("validation_country_code"))]), r = sr(ee(e("validation_phone"), [
|
|
3374
|
+
const t = ee(e("validation_country_code"), [qr(ys, e("validation_country_code"))]), r = sr(ee(e("validation_phone"), [Te(1, e("validation_phone"))]), (n) => n.replace(/[^0-9]/g, ""), []);
|
|
3375
3375
|
return Ye(he({
|
|
3376
3376
|
countryCode: t,
|
|
3377
3377
|
phoneNumber: r
|
|
@@ -3383,11 +3383,11 @@ const Wt = 27, Jt = 12, Zt = 10, us = Se("enum"), cs = (e, t) => {
|
|
|
3383
3383
|
var A;
|
|
3384
3384
|
const r = e.key ? (A = M.current$.value.flow) == null ? void 0 : A.data.submissions[e.key] : void 0, {
|
|
3385
3385
|
t: n
|
|
3386
|
-
} = G(), [
|
|
3386
|
+
} = G(), [s, a] = Y(), i = vs(r) ? gs(r.value) : xs(r) ? r.value : void 0, {
|
|
3387
3387
|
register: u,
|
|
3388
3388
|
handleSubmit: d,
|
|
3389
3389
|
formState: {
|
|
3390
|
-
errors:
|
|
3390
|
+
errors: h
|
|
3391
3391
|
},
|
|
3392
3392
|
watch: x
|
|
3393
3393
|
} = Qe({
|
|
@@ -3398,7 +3398,7 @@ const Wt = 27, Jt = 12, Zt = 10, us = Se("enum"), cs = (e, t) => {
|
|
|
3398
3398
|
resolver: ws(n)
|
|
3399
3399
|
}), {
|
|
3400
3400
|
ref: v,
|
|
3401
|
-
...
|
|
3401
|
+
...p
|
|
3402
3402
|
} = u("phoneNumber", {
|
|
3403
3403
|
required: !e.config.optional
|
|
3404
3404
|
}), k = re(), y = x("countryCode");
|
|
@@ -3409,10 +3409,10 @@ const Wt = 27, Jt = 12, Zt = 10, us = Se("enum"), cs = (e, t) => {
|
|
|
3409
3409
|
class: "flex flex-col gap-1 p-2.5",
|
|
3410
3410
|
onSubmit: d((S) => {
|
|
3411
3411
|
const E = S.phoneNumber.replace(/[^0-9]/g, ""), g = S.countryCode.replace(/[^0-9]/g, "");
|
|
3412
|
-
|
|
3412
|
+
a(void 0);
|
|
3413
3413
|
const N = e.config.minChars ?? 7;
|
|
3414
3414
|
if (E.length + g.length < N)
|
|
3415
|
-
return
|
|
3415
|
+
return a(n("validation_phone_min_chars", {
|
|
3416
3416
|
count: N
|
|
3417
3417
|
}));
|
|
3418
3418
|
e.config.submissionFormat === "phone" ? t({
|
|
@@ -3445,7 +3445,7 @@ const Wt = 27, Jt = 12, Zt = 10, us = Se("enum"), cs = (e, t) => {
|
|
|
3445
3445
|
}, S))
|
|
3446
3446
|
})]
|
|
3447
3447
|
}), l("input", {
|
|
3448
|
-
...
|
|
3448
|
+
...p,
|
|
3449
3449
|
id: "chat-input",
|
|
3450
3450
|
type: "tel",
|
|
3451
3451
|
inputMode: "tel",
|
|
@@ -3456,7 +3456,7 @@ const Wt = 27, Jt = 12, Zt = 10, us = Se("enum"), cs = (e, t) => {
|
|
|
3456
3456
|
ref: (S) => {
|
|
3457
3457
|
S && (k.current = S), v(S);
|
|
3458
3458
|
},
|
|
3459
|
-
class:
|
|
3459
|
+
class: Re({
|
|
3460
3460
|
optional: e.config.optional,
|
|
3461
3461
|
className: "min-w-0 flex-1 rounded-r-full"
|
|
3462
3462
|
}),
|
|
@@ -3467,8 +3467,8 @@ const Wt = 27, Jt = 12, Zt = 10, us = Se("enum"), cs = (e, t) => {
|
|
|
3467
3467
|
})]
|
|
3468
3468
|
}), l(ye, {})]
|
|
3469
3469
|
}), l(Ce, {
|
|
3470
|
-
error:
|
|
3471
|
-
message:
|
|
3470
|
+
error: h.countryCode || h.phoneNumber || {
|
|
3471
|
+
message: s
|
|
3472
3472
|
}
|
|
3473
3473
|
})]
|
|
3474
3474
|
});
|
|
@@ -3530,9 +3530,9 @@ const Wt = 27, Jt = 12, Zt = 10, us = Se("enum"), cs = (e, t) => {
|
|
|
3530
3530
|
};
|
|
3531
3531
|
return Ye(he({
|
|
3532
3532
|
text: {
|
|
3533
|
-
email: ee(t("validation_email"), [Ur(t("validation_email")),
|
|
3534
|
-
text: ee([
|
|
3535
|
-
url: ee([Kr(t("validation_url")),
|
|
3533
|
+
email: ee(t("validation_email"), [Ur(t("validation_email")), Te(e.minChars ?? 1, r.minLength), je(e.maxChars ?? 1 / 0, r.maxLength)]),
|
|
3534
|
+
text: ee([Te(e.minChars ?? 1, r.minLength), je(e.maxChars ?? 1 / 0, r.maxLength)]),
|
|
3535
|
+
url: ee([Kr(t("validation_url")), Te(e.minChars ?? 1, r.minLength), je(e.maxChars ?? 1 / 0, r.maxLength)])
|
|
3536
3536
|
}[e.format]
|
|
3537
3537
|
}));
|
|
3538
3538
|
}, As = ({
|
|
@@ -3542,21 +3542,21 @@ const Wt = 27, Jt = 12, Zt = 10, us = Se("enum"), cs = (e, t) => {
|
|
|
3542
3542
|
var v;
|
|
3543
3543
|
const {
|
|
3544
3544
|
t: r
|
|
3545
|
-
} = G(), n = e.key ? (v = M.current$.value.flow) == null ? void 0 : v.data.submissions[e.key] : void 0,
|
|
3546
|
-
register:
|
|
3545
|
+
} = G(), n = e.key ? (v = M.current$.value.flow) == null ? void 0 : v.data.submissions[e.key] : void 0, s = e.config.defaultValue, {
|
|
3546
|
+
register: a,
|
|
3547
3547
|
handleSubmit: i,
|
|
3548
3548
|
formState: {
|
|
3549
3549
|
errors: u
|
|
3550
3550
|
}
|
|
3551
3551
|
} = Qe({
|
|
3552
3552
|
defaultValues: {
|
|
3553
|
-
text:
|
|
3553
|
+
text: s || (Cs(n) ? n.value : "")
|
|
3554
3554
|
},
|
|
3555
3555
|
resolver: Es(e.config, r)
|
|
3556
3556
|
}), {
|
|
3557
3557
|
ref: d,
|
|
3558
|
-
...
|
|
3559
|
-
} =
|
|
3558
|
+
...h
|
|
3559
|
+
} = a("text", {
|
|
3560
3560
|
required: !e.config.optional
|
|
3561
3561
|
}), x = re();
|
|
3562
3562
|
return pe(() => {
|
|
@@ -3564,10 +3564,10 @@ const Wt = 27, Jt = 12, Zt = 10, us = Se("enum"), cs = (e, t) => {
|
|
|
3564
3564
|
}, []), l("form", {
|
|
3565
3565
|
noValidate: !0,
|
|
3566
3566
|
class: "flex flex-col gap-1 p-2.5",
|
|
3567
|
-
onSubmit: i((
|
|
3567
|
+
onSubmit: i((p) => {
|
|
3568
3568
|
t({
|
|
3569
3569
|
type: "string",
|
|
3570
|
-
value:
|
|
3570
|
+
value: p.text
|
|
3571
3571
|
});
|
|
3572
3572
|
}),
|
|
3573
3573
|
children: [l("div", {
|
|
@@ -3576,17 +3576,17 @@ const Wt = 27, Jt = 12, Zt = 10, us = Se("enum"), cs = (e, t) => {
|
|
|
3576
3576
|
class: "relative min-w-0 flex-1",
|
|
3577
3577
|
children: [l("input", {
|
|
3578
3578
|
id: "chat-input",
|
|
3579
|
-
...
|
|
3579
|
+
...h,
|
|
3580
3580
|
...Ss[e.config.format],
|
|
3581
3581
|
autocomplete: "off",
|
|
3582
3582
|
autoCapitalize: "off",
|
|
3583
3583
|
autoCorrect: "off",
|
|
3584
3584
|
autoFocus: !0,
|
|
3585
|
-
ref: (
|
|
3586
|
-
|
|
3585
|
+
ref: (p) => {
|
|
3586
|
+
p && (x.current = p), d(p);
|
|
3587
3587
|
},
|
|
3588
3588
|
placeholder: e.config.placeholder,
|
|
3589
|
-
class:
|
|
3589
|
+
class: Re({
|
|
3590
3590
|
optional: !!e.config.optional,
|
|
3591
3591
|
className: "w-full rounded-full"
|
|
3592
3592
|
})
|
|
@@ -3611,16 +3611,16 @@ const Wt = 27, Jt = 12, Zt = 10, us = Se("enum"), cs = (e, t) => {
|
|
|
3611
3611
|
}, Is = ({
|
|
3612
3612
|
logger: e
|
|
3613
3613
|
}) => {
|
|
3614
|
-
var
|
|
3615
|
-
const t = (
|
|
3614
|
+
var a;
|
|
3615
|
+
const t = (a = M.current$.value.flow) == null ? void 0 : a.data.currentInput, [r, n] = gn(), s = re(null);
|
|
3616
3616
|
return M.inputHeight$.value = n.height, ue(() => {
|
|
3617
|
-
const i =
|
|
3617
|
+
const i = s.current;
|
|
3618
3618
|
if (i)
|
|
3619
3619
|
return i.addEventListener("transitionstart", z.scrollToEnd.smooth), i.addEventListener("transitioncancel", z.scrollToEnd.smooth), i.addEventListener("transitionend", z.scrollToEnd.smooth), () => {
|
|
3620
3620
|
i.removeEventListener("transitionstart", z.scrollToEnd.smooth), i.removeEventListener("transitioncancel", z.scrollToEnd.smooth), i.removeEventListener("transitionend", z.scrollToEnd.smooth);
|
|
3621
3621
|
};
|
|
3622
3622
|
}, []), l("div", {
|
|
3623
|
-
ref:
|
|
3623
|
+
ref: s,
|
|
3624
3624
|
class: "ease-expo-out absolute bottom-0 w-full overflow-hidden rounded-b-3xl backdrop-blur-xl transition-all duration-700 will-change-[height]",
|
|
3625
3625
|
style: {
|
|
3626
3626
|
height: n.height
|
|
@@ -3640,7 +3640,7 @@ const Wt = 27, Jt = 12, Zt = 10, us = Se("enum"), cs = (e, t) => {
|
|
|
3640
3640
|
children: [l("input", {
|
|
3641
3641
|
"aria-hidden": "true",
|
|
3642
3642
|
id: "chat-input",
|
|
3643
|
-
class:
|
|
3643
|
+
class: Re({
|
|
3644
3644
|
optional: !1,
|
|
3645
3645
|
className: "flex-grow rounded-full"
|
|
3646
3646
|
}),
|
|
@@ -3668,48 +3668,48 @@ var Ms = function(e) {
|
|
|
3668
3668
|
}), t;
|
|
3669
3669
|
};
|
|
3670
3670
|
function Ls(e, t, r) {
|
|
3671
|
-
var n = 0,
|
|
3671
|
+
var n = 0, s = 0;
|
|
3672
3672
|
if (e === "")
|
|
3673
3673
|
return e;
|
|
3674
3674
|
if (!e || !wr(e))
|
|
3675
3675
|
throw new TypeError("First argument to react-string-replace#replaceString must be a string");
|
|
3676
|
-
var
|
|
3677
|
-
Ms(
|
|
3678
|
-
for (var i = e.split(
|
|
3676
|
+
var a = t;
|
|
3677
|
+
Ms(a) || (a = new RegExp("(" + Fs(a) + ")", "gi"));
|
|
3678
|
+
for (var i = e.split(a), u = 1, d = i.length; u < d; u += 2) {
|
|
3679
3679
|
if (i[u] === void 0 || i[u - 1] === void 0) {
|
|
3680
3680
|
console.warn("reactStringReplace: Encountered undefined value during string replacement. Your RegExp may not be working the way you expect.");
|
|
3681
3681
|
continue;
|
|
3682
3682
|
}
|
|
3683
|
-
|
|
3683
|
+
s = i[u].length, n += i[u - 1].length, i[u] = r(i[u], u, n), n += s;
|
|
3684
3684
|
}
|
|
3685
3685
|
return i;
|
|
3686
3686
|
}
|
|
3687
3687
|
var Ts = function(t, r, n) {
|
|
3688
|
-
return Array.isArray(t) || (t = [t]), Ns(t.map(function(
|
|
3689
|
-
return wr(
|
|
3688
|
+
return Array.isArray(t) || (t = [t]), Ns(t.map(function(s) {
|
|
3689
|
+
return wr(s) ? Ls(s, r, n) : s;
|
|
3690
3690
|
}));
|
|
3691
3691
|
};
|
|
3692
|
-
const
|
|
3693
|
-
const t =
|
|
3694
|
-
const [,
|
|
3695
|
-
return
|
|
3692
|
+
const Me = /* @__PURE__ */ tr(Ts), Ds = /(\[[^\]]+\]\([^)]+\))/g, Rs = /\[([^\]]+)\]\(([^)]+)\)/, Os = /(https?:\/\/[^\s]+)/g, Bs = /_(.*?)_/g, Ps = /\*\*(.*?)\*\*/g, $s = /\\n|\n/g, Qt = "text-accent-10 hover:text-accent-11 no-underline underline-offset-2 hover:underline", js = (e) => {
|
|
3693
|
+
const t = Me(e, Ds, (i, u) => {
|
|
3694
|
+
const [, d, h] = i.match(Rs) ?? [];
|
|
3695
|
+
return h ? l("a", {
|
|
3696
3696
|
class: Qt,
|
|
3697
|
-
href:
|
|
3698
|
-
children:
|
|
3699
|
-
},
|
|
3697
|
+
href: h,
|
|
3698
|
+
children: d ?? h
|
|
3699
|
+
}, h + u) : l("span", {
|
|
3700
3700
|
children: "INVALID LINK"
|
|
3701
3701
|
});
|
|
3702
|
-
}), r =
|
|
3702
|
+
}), r = Me(t, Os, (i, u) => l("a", {
|
|
3703
3703
|
class: Qt,
|
|
3704
|
-
href:
|
|
3705
|
-
children:
|
|
3706
|
-
},
|
|
3707
|
-
children:
|
|
3708
|
-
},
|
|
3709
|
-
|
|
3710
|
-
|
|
3711
|
-
|
|
3712
|
-
},
|
|
3704
|
+
href: i,
|
|
3705
|
+
children: i
|
|
3706
|
+
}, i + u)), n = Me(r, Bs, (i, u) => l("em", {
|
|
3707
|
+
children: i
|
|
3708
|
+
}, i + u)), s = Me(n, Ps, (i, u) => l("strong", {
|
|
3709
|
+
children: i
|
|
3710
|
+
}, i + u));
|
|
3711
|
+
return Me(s, $s, (i, u) => l("br", {}, `br-${u}`));
|
|
3712
|
+
}, zs = Ze("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", {
|
|
3713
3713
|
variants: {
|
|
3714
3714
|
side: {
|
|
3715
3715
|
left: "bg-bubble-weak-bg text-neutral-12 shadow-surface-sm outline outline-1 outline-bubble-weak rounded-bl-md",
|
|
@@ -3723,24 +3723,24 @@ const $e = /* @__PURE__ */ tr(Ts), Ds = /(\[[^\]]+\]\([^)]+\))/g, Rs = /\[([^\]]
|
|
|
3723
3723
|
defaultVariants: {
|
|
3724
3724
|
side: "left"
|
|
3725
3725
|
}
|
|
3726
|
-
}),
|
|
3726
|
+
}), qs = ({
|
|
3727
3727
|
children: e,
|
|
3728
3728
|
className: t,
|
|
3729
3729
|
animate: r,
|
|
3730
3730
|
side: n,
|
|
3731
|
-
...
|
|
3731
|
+
...s
|
|
3732
3732
|
}) => l("p", {
|
|
3733
3733
|
style: {
|
|
3734
3734
|
transformOrigin: n === "left" ? "0% 50%" : "100% 50%"
|
|
3735
3735
|
},
|
|
3736
|
-
class:
|
|
3736
|
+
class: zs({
|
|
3737
3737
|
className: t,
|
|
3738
3738
|
side: n,
|
|
3739
3739
|
animate: r
|
|
3740
3740
|
}),
|
|
3741
|
-
...
|
|
3741
|
+
...s,
|
|
3742
3742
|
children: e
|
|
3743
|
-
}),
|
|
3743
|
+
}), Us = ({
|
|
3744
3744
|
message: e
|
|
3745
3745
|
}) => l("div", {
|
|
3746
3746
|
class: "bg-accent-3 flex w-full items-center justify-center overflow-hidden rounded-xl px-2 py-2",
|
|
@@ -3764,7 +3764,7 @@ const $e = /* @__PURE__ */ tr(Ts), Ds = /(\[[^\]]+\]\([^)]+\))/g, Rs = /\[([^\]]
|
|
|
3764
3764
|
})
|
|
3765
3765
|
})]
|
|
3766
3766
|
})
|
|
3767
|
-
}),
|
|
3767
|
+
}), Ks = ({
|
|
3768
3768
|
className: e,
|
|
3769
3769
|
...t
|
|
3770
3770
|
}) => (ue(() => {
|
|
@@ -3773,7 +3773,7 @@ const $e = /* @__PURE__ */ tr(Ts), Ds = /(\[[^\]]+\]\([^)]+\))/g, Rs = /\[([^\]]
|
|
|
3773
3773
|
"aria-hidden": !0,
|
|
3774
3774
|
children: z.isBotTyping$.value === !0 ? l("div", {
|
|
3775
3775
|
"aria-label": "Typing…",
|
|
3776
|
-
class:
|
|
3776
|
+
class: De("flex gap-1 p-4", e),
|
|
3777
3777
|
...t,
|
|
3778
3778
|
children: Array.from({
|
|
3779
3779
|
length: 3
|
|
@@ -3784,10 +3784,10 @@ const $e = /* @__PURE__ */ tr(Ts), Ds = /(\[[^\]]+\]\([^)]+\))/g, Rs = /\[([^\]]
|
|
|
3784
3784
|
}
|
|
3785
3785
|
}))
|
|
3786
3786
|
}) : void 0
|
|
3787
|
-
})),
|
|
3787
|
+
})), Gs = {
|
|
3788
3788
|
bot: "left",
|
|
3789
3789
|
user: "right"
|
|
3790
|
-
},
|
|
3790
|
+
}, Hs = Ze("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)]", {
|
|
3791
3791
|
variants: {
|
|
3792
3792
|
variant: {
|
|
3793
3793
|
info: "text-neutral-8",
|
|
@@ -3796,7 +3796,7 @@ const $e = /* @__PURE__ */ tr(Ts), Ds = /(\[[^\]]+\]\([^)]+\))/g, Rs = /\[([^\]]
|
|
|
3796
3796
|
success: "text-[#4CAF50]"
|
|
3797
3797
|
}
|
|
3798
3798
|
}
|
|
3799
|
-
}),
|
|
3799
|
+
}), Ws = ({
|
|
3800
3800
|
lastSentMessageFooter: e
|
|
3801
3801
|
}) => {
|
|
3802
3802
|
var r;
|
|
@@ -3806,51 +3806,51 @@ const $e = /* @__PURE__ */ tr(Ts), Ds = /(\[[^\]]+\]\([^)]+\))/g, Rs = /\[([^\]]
|
|
|
3806
3806
|
}, [t.length]), l("ol", {
|
|
3807
3807
|
"aria-label": "Chat messages",
|
|
3808
3808
|
class: "mt-auto flex flex-col justify-end gap-2 p-2 pt-[calc(var(--header-height)+1rem)]",
|
|
3809
|
-
children: [t.map((n,
|
|
3809
|
+
children: [t.map((n, s) => l(ke, {
|
|
3810
3810
|
children: l("li", {
|
|
3811
3811
|
class: "flex",
|
|
3812
3812
|
children: Ke(n).with({
|
|
3813
3813
|
type: "system"
|
|
3814
|
-
}, (
|
|
3815
|
-
class:
|
|
3816
|
-
variant:
|
|
3814
|
+
}, (a) => l("p", {
|
|
3815
|
+
class: Hs({
|
|
3816
|
+
variant: a.variant
|
|
3817
3817
|
}),
|
|
3818
|
-
children:
|
|
3818
|
+
children: a.text
|
|
3819
3819
|
})).with({
|
|
3820
3820
|
type: "text",
|
|
3821
3821
|
author: V.union("bot", "user")
|
|
3822
|
-
}, (
|
|
3823
|
-
const i =
|
|
3824
|
-
return l(
|
|
3822
|
+
}, (a) => {
|
|
3823
|
+
const i = a.author === "user" && !t.slice(s + 1).some((h) => h.type === "text" && h.author === "user"), u = s === t.length - 1, d = a.author === "bot" ? js(a.text) : a.text;
|
|
3824
|
+
return l(qs, {
|
|
3825
3825
|
animate: u,
|
|
3826
|
-
side:
|
|
3826
|
+
side: Gs[a.author],
|
|
3827
3827
|
children: [d, i ? e : null]
|
|
3828
|
-
},
|
|
3828
|
+
}, s);
|
|
3829
3829
|
}).with({
|
|
3830
3830
|
type: "link"
|
|
3831
|
-
}, (
|
|
3832
|
-
message:
|
|
3831
|
+
}, (a) => l(Us, {
|
|
3832
|
+
message: a
|
|
3833
3833
|
})).with({
|
|
3834
3834
|
type: "image"
|
|
3835
|
-
}, (
|
|
3835
|
+
}, (a) => l("img", {
|
|
3836
3836
|
class: "shadow-surface-md w-full max-w-[min(100%,24rem)] rounded-2xl",
|
|
3837
|
-
src:
|
|
3837
|
+
src: a.url,
|
|
3838
3838
|
style: {
|
|
3839
|
-
aspectRatio:
|
|
3839
|
+
aspectRatio: a.width / a.height
|
|
3840
3840
|
}
|
|
3841
3841
|
})).with({
|
|
3842
3842
|
type: "file"
|
|
3843
|
-
}, (
|
|
3844
|
-
class:
|
|
3843
|
+
}, (a) => l(Rn, {
|
|
3844
|
+
class: a.author === "bot" ? void 0 : "ml-auto",
|
|
3845
3845
|
file: {
|
|
3846
|
-
name:
|
|
3847
|
-
sizeKb:
|
|
3846
|
+
name: a.fileName,
|
|
3847
|
+
sizeKb: a.fileSizeKb
|
|
3848
3848
|
}
|
|
3849
3849
|
})).with({
|
|
3850
3850
|
type: "loading"
|
|
3851
|
-
}, (
|
|
3851
|
+
}, (a) => {
|
|
3852
3852
|
const i = t[t.length - 1];
|
|
3853
|
-
return !(
|
|
3853
|
+
return !(a === i) || z.isBotTyping$.value ? null : l("div", {
|
|
3854
3854
|
class: "flex flex-grow flex-col items-center justify-center",
|
|
3855
3855
|
children: l(Gr, {
|
|
3856
3856
|
class: "text-neutral-6 h-8 w-8"
|
|
@@ -3858,9 +3858,9 @@ const $e = /* @__PURE__ */ tr(Ts), Ds = /(\[[^\]]+\]\([^)]+\))/g, Rs = /\[([^\]]
|
|
|
3858
3858
|
});
|
|
3859
3859
|
}).exhaustive()
|
|
3860
3860
|
})
|
|
3861
|
-
},
|
|
3861
|
+
}, s)), l(Ks, {}, "typing")]
|
|
3862
3862
|
});
|
|
3863
|
-
},
|
|
3863
|
+
}, na = ({
|
|
3864
3864
|
logger: e,
|
|
3865
3865
|
apiClient: t,
|
|
3866
3866
|
analytics: r
|
|
@@ -3869,15 +3869,15 @@ const $e = /* @__PURE__ */ tr(Ts), Ds = /(\[[^\]]+\]\([^)]+\))/g, Rs = /\[([^\]]
|
|
|
3869
3869
|
flow: n
|
|
3870
3870
|
} = M.current$.value;
|
|
3871
3871
|
le(n, "Flow is required to exist to show chatbot body");
|
|
3872
|
-
const
|
|
3873
|
-
chatRef:
|
|
3872
|
+
const s = M.viewState$.value, {
|
|
3873
|
+
chatRef: a,
|
|
3874
3874
|
chatService: i
|
|
3875
3875
|
} = _n(), {
|
|
3876
3876
|
t: u
|
|
3877
|
-
} = G(), [d,
|
|
3877
|
+
} = G(), [d, h] = Y();
|
|
3878
3878
|
return pe(() => {
|
|
3879
|
-
|
|
3880
|
-
}, [
|
|
3879
|
+
s === "maximised" && z.scrollToEnd.instant();
|
|
3880
|
+
}, [s]), pe(() => {
|
|
3881
3881
|
var S, E;
|
|
3882
3882
|
const {
|
|
3883
3883
|
state: x,
|
|
@@ -3885,10 +3885,10 @@ const $e = /* @__PURE__ */ tr(Ts), Ds = /(\[[^\]]+\]\([^)]+\))/g, Rs = /\[([^\]]
|
|
|
3885
3885
|
} = M.current$.peek();
|
|
3886
3886
|
if (x !== "loaded")
|
|
3887
3887
|
throw new Error(u("invalid_state"));
|
|
3888
|
-
let
|
|
3888
|
+
let p = v.data.nodeHistory.at(-1);
|
|
3889
3889
|
if (z.scrollToEnd.instant(), M.setInput(void 0), v.data.isFinished)
|
|
3890
3890
|
return;
|
|
3891
|
-
|
|
3891
|
+
p === void 0 ? (p = er(n.nodes).id, M.setCurrentNodeId(p), r.log({
|
|
3892
3892
|
event: "FLOW_START",
|
|
3893
3893
|
properties: {
|
|
3894
3894
|
flow_id: n.id,
|
|
@@ -3898,7 +3898,7 @@ const $e = /* @__PURE__ */ tr(Ts), Ds = /(\[[^\]]+\]\([^)]+\))/g, Rs = /\[([^\]]
|
|
|
3898
3898
|
job: n.job
|
|
3899
3899
|
},
|
|
3900
3900
|
customProperties: (S = n.analytics) == null ? void 0 : S.customProperties
|
|
3901
|
-
})) : M.removeMessagesSentByNodeIds([
|
|
3901
|
+
})) : M.removeMessagesSentByNodeIds([p]);
|
|
3902
3902
|
const {
|
|
3903
3903
|
interpret: k,
|
|
3904
3904
|
abort: y,
|
|
@@ -3954,17 +3954,17 @@ const $e = /* @__PURE__ */ tr(Ts), Ds = /(\[[^\]]+\]\([^)]+\))/g, Rs = /\[([^\]]
|
|
|
3954
3954
|
});
|
|
3955
3955
|
}
|
|
3956
3956
|
});
|
|
3957
|
-
return
|
|
3957
|
+
return h(() => A), k(p), y;
|
|
3958
3958
|
}, [r, t, i, e, n, u]), l(ke, {
|
|
3959
3959
|
children: [l("div", {
|
|
3960
|
-
ref:
|
|
3960
|
+
ref: a,
|
|
3961
3961
|
className: "hide-scrollbars relative flex w-full max-w-full flex-grow flex-col overflow-y-scroll",
|
|
3962
3962
|
style: {
|
|
3963
3963
|
WebkitOverflowScrolling: "touch",
|
|
3964
3964
|
paddingBottom: M.inputHeight$.value
|
|
3965
3965
|
},
|
|
3966
|
-
children: l(
|
|
3967
|
-
lastSentMessageFooter: n.data.isFinished || !d ? null : l(
|
|
3966
|
+
children: l(Ws, {
|
|
3967
|
+
lastSentMessageFooter: n.data.isFinished || !d ? null : l(Zs, {
|
|
3968
3968
|
undoFn: d
|
|
3969
3969
|
})
|
|
3970
3970
|
})
|
|
@@ -3972,7 +3972,7 @@ const $e = /* @__PURE__ */ tr(Ts), Ds = /(\[[^\]]+\]\([^)]+\))/g, Rs = /\[([^\]]
|
|
|
3972
3972
|
logger: e
|
|
3973
3973
|
})]
|
|
3974
3974
|
});
|
|
3975
|
-
},
|
|
3975
|
+
}, Js = (e) => "key" in e.data && e.data.key ? [e.data.key] : "keys" in e.data ? Object.values(e.data.keys).filter((t) => typeof t == "string") : [], Zs = ({
|
|
3976
3976
|
undoFn: e
|
|
3977
3977
|
}) => {
|
|
3978
3978
|
const {
|
|
@@ -3989,8 +3989,8 @@ const $e = /* @__PURE__ */ tr(Ts), Ds = /(\[[^\]]+\]\([^)]+\))/g, Rs = /\[([^\]]
|
|
|
3989
3989
|
le(r);
|
|
3990
3990
|
const {
|
|
3991
3991
|
removed: n
|
|
3992
|
-
} = e(r.data.nodeHistory),
|
|
3993
|
-
|
|
3992
|
+
} = e(r.data.nodeHistory), s = r.data.nodeHistory.splice(-n);
|
|
3993
|
+
s.length !== 0 && (M.removeMessagesSentByNodeIds(s), M.setInput(void 0), s.pop(), s.map((a) => r.nodes.find((i) => i.id === a)).filter(Boolean).flatMap(Js).forEach((a) => delete r.data.submissions[a]), M.current$.value = {
|
|
3994
3994
|
...M.current$.value
|
|
3995
3995
|
});
|
|
3996
3996
|
},
|
|
@@ -3999,5 +3999,5 @@ const $e = /* @__PURE__ */ tr(Ts), Ds = /(\[[^\]]+\]\([^)]+\))/g, Rs = /\[([^\]]
|
|
|
3999
3999
|
});
|
|
4000
4000
|
};
|
|
4001
4001
|
export {
|
|
4002
|
-
|
|
4002
|
+
na as ChatbotBody
|
|
4003
4003
|
};
|