@inploi/plugin-chatbot 4.1.3 → 4.2.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/cdn/index.js +3 -3
- package/cdn/style.css +1 -1
- package/dist/chatbot-body-bf860914.cjs +1 -0
- package/dist/{chatbot-body-87199b8f.js → chatbot-body-cb27f685.js} +448 -459
- package/dist/chatbot.d.ts +6 -3
- package/dist/chatbot.state.d.ts +2 -1
- package/dist/{index-6f98abfb.cjs → index-4c82e536.cjs} +2 -2
- package/dist/{index-c974e995.js → index-fab0ae6e.js} +12 -11
- package/dist/plugin-chatbot.cjs +1 -1
- package/dist/plugin-chatbot.js +1 -1
- package/dist/style.css +1 -1
- package/package.json +3 -3
- package/dist/chatbot-body-0b71f113.cjs +0 -1
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { g as Ue, i as Yt, k as
|
|
1
|
+
import { g as Ue, i as Yt, k as Ne, a as er, b as le, A as Fe, c as Ir, N as Ke, _ as D, 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 I, l as Ze, m as he, n as Mr, q as at, r as ee, t as Fr, v as ke, w as Lr, x as rr, z as Nr, 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-fab0ae6e.js";
|
|
2
2
|
import "@inploi/sdk";
|
|
3
3
|
const Ft = ({
|
|
4
4
|
condition: e,
|
|
@@ -44,7 +44,7 @@ const Ft = ({
|
|
|
44
44
|
};
|
|
45
45
|
switch (typeof u) {
|
|
46
46
|
case "boolean":
|
|
47
|
-
return
|
|
47
|
+
return Le(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 Le(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 Le(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) ? Le(d, {
|
|
78
78
|
submissions: {
|
|
79
79
|
_temp: {
|
|
80
80
|
value: u,
|
|
@@ -146,7 +146,7 @@ const Ft = ({
|
|
|
146
146
|
}
|
|
147
147
|
break;
|
|
148
148
|
}
|
|
149
|
-
},
|
|
149
|
+
}, Le = (e, {
|
|
150
150
|
context: t,
|
|
151
151
|
submissions: r
|
|
152
152
|
}) => {
|
|
@@ -188,11 +188,11 @@ const Ft = ({
|
|
|
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((p) => `${p.name} (${Ne(p.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((p) => p && p.trim().length > 0).join(", ");
|
|
196
196
|
case "number":
|
|
197
197
|
case "string":
|
|
198
198
|
return d.value ? d.value.toString() : a;
|
|
@@ -201,17 +201,17 @@ const Ft = ({
|
|
|
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 p = Ue(d.value, u.join("."));
|
|
205
|
+
switch (typeof p) {
|
|
206
206
|
case "boolean":
|
|
207
|
-
return
|
|
207
|
+
return p === !0 ? "true" : "false";
|
|
208
208
|
case "string":
|
|
209
|
-
return
|
|
209
|
+
return p;
|
|
210
210
|
case "number":
|
|
211
|
-
return
|
|
211
|
+
return p.toString();
|
|
212
212
|
case "object":
|
|
213
|
-
if (Array.isArray(
|
|
214
|
-
return
|
|
213
|
+
if (Array.isArray(p) && p.every(Yt))
|
|
214
|
+
return p.join(", ");
|
|
215
215
|
}
|
|
216
216
|
break;
|
|
217
217
|
}
|
|
@@ -260,9 +260,9 @@ const Ft = ({
|
|
|
260
260
|
chatService: i,
|
|
261
261
|
onFlowEnd: u,
|
|
262
262
|
onInterpret: d,
|
|
263
|
-
t:
|
|
263
|
+
t: p
|
|
264
264
|
}) => {
|
|
265
|
-
let
|
|
265
|
+
let w = new AbortController();
|
|
266
266
|
const v = {
|
|
267
267
|
...t.service,
|
|
268
268
|
log: (k) => t.service.log({
|
|
@@ -272,7 +272,7 @@ const Ft = ({
|
|
|
272
272
|
...t.customProperties
|
|
273
273
|
}
|
|
274
274
|
})
|
|
275
|
-
},
|
|
275
|
+
}, h = async (k, y) => {
|
|
276
276
|
const A = a();
|
|
277
277
|
d == null || d(k, y);
|
|
278
278
|
try {
|
|
@@ -284,16 +284,16 @@ const Ft = ({
|
|
|
284
284
|
context: n,
|
|
285
285
|
node: k,
|
|
286
286
|
submissions: A,
|
|
287
|
-
t:
|
|
287
|
+
t: p,
|
|
288
288
|
chat: {
|
|
289
289
|
sendMessage: async (S) => i.send({
|
|
290
290
|
groupId: k.id,
|
|
291
291
|
message: S,
|
|
292
|
-
signal:
|
|
292
|
+
signal: w.signal
|
|
293
293
|
}),
|
|
294
294
|
userInput: async (S) => i.input({
|
|
295
295
|
input: S,
|
|
296
|
-
signal:
|
|
296
|
+
signal: w.signal
|
|
297
297
|
}),
|
|
298
298
|
addToSubmissions: i.addToSubmissions
|
|
299
299
|
},
|
|
@@ -302,7 +302,7 @@ const Ft = ({
|
|
|
302
302
|
childNode: k,
|
|
303
303
|
nodes: e.nodes
|
|
304
304
|
});
|
|
305
|
-
return E ?
|
|
305
|
+
return E ? h(E, k) : u == null ? void 0 : u(k);
|
|
306
306
|
},
|
|
307
307
|
end: () => u == null ? void 0 : u(k)
|
|
308
308
|
});
|
|
@@ -315,24 +315,24 @@ 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 h(y);
|
|
319
319
|
},
|
|
320
320
|
undo: (k) => {
|
|
321
321
|
let y = 1;
|
|
322
322
|
const A = e.nodes.find((E) => E.id === k[k.length - 1]);
|
|
323
323
|
for (let E = k.length - 2; E > 0; E--) {
|
|
324
|
-
const g = k[E],
|
|
325
|
-
if (!
|
|
324
|
+
const g = k[E], M = e.nodes.find((R) => R.id === g);
|
|
325
|
+
if (!M || (y++, M.type.startsWith("question-")))
|
|
326
326
|
break;
|
|
327
327
|
}
|
|
328
|
-
|
|
328
|
+
w.abort(), w = 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"), h(S, A), {
|
|
331
331
|
removed: y
|
|
332
332
|
};
|
|
333
333
|
},
|
|
334
334
|
abort: () => {
|
|
335
|
-
|
|
335
|
+
w.abort();
|
|
336
336
|
}
|
|
337
337
|
};
|
|
338
338
|
}, Xe = (e) => `+${e.countryCode} ${e.phoneNumber}`;
|
|
@@ -512,8 +512,8 @@ async function tn({
|
|
|
512
512
|
flow: u,
|
|
513
513
|
t: d
|
|
514
514
|
}) {
|
|
515
|
-
const
|
|
516
|
-
|
|
515
|
+
const p = async (w) => {
|
|
516
|
+
w !== !0 && await e.userInput({
|
|
517
517
|
type: "submit",
|
|
518
518
|
key: void 0,
|
|
519
519
|
config: {
|
|
@@ -524,14 +524,14 @@ async function tn({
|
|
|
524
524
|
});
|
|
525
525
|
const {
|
|
526
526
|
anonymous_id: v,
|
|
527
|
-
session_id:
|
|
527
|
+
session_id: h
|
|
528
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: h,
|
|
535
535
|
job: u.job,
|
|
536
536
|
submissions: Ir(a || {})
|
|
537
537
|
})
|
|
@@ -540,16 +540,16 @@ async function tn({
|
|
|
540
540
|
type: "integration",
|
|
541
541
|
value: k
|
|
542
542
|
}), Ke(k).with({
|
|
543
|
-
integration_response:
|
|
544
|
-
service:
|
|
545
|
-
status:
|
|
546
|
-
data:
|
|
543
|
+
integration_response: D.select(D.union({
|
|
544
|
+
service: D.optional(D.string),
|
|
545
|
+
status: D.number,
|
|
546
|
+
data: D.any
|
|
547
547
|
}, {
|
|
548
|
-
service:
|
|
549
|
-
status:
|
|
548
|
+
service: D.optional(D.string),
|
|
549
|
+
status: D.number,
|
|
550
550
|
error: {
|
|
551
|
-
message:
|
|
552
|
-
data:
|
|
551
|
+
message: D.string,
|
|
552
|
+
data: D.any
|
|
553
553
|
}
|
|
554
554
|
}))
|
|
555
555
|
}, (y) => {
|
|
@@ -569,60 +569,52 @@ async function tn({
|
|
|
569
569
|
}
|
|
570
570
|
});
|
|
571
571
|
}).otherwise(() => {
|
|
572
|
-
}), await Ke(k).with(
|
|
573
|
-
ats_data: V.select("redirect", {
|
|
574
|
-
redirect_url: V.string,
|
|
575
|
-
message: V.optional(V.union(V.string, V.nullish)),
|
|
576
|
-
button_text: V.optional(V.union(V.string, V.nullish))
|
|
577
|
-
})
|
|
578
|
-
}, {
|
|
572
|
+
}), await Ke(k).with({
|
|
579
573
|
integration_response: {
|
|
580
|
-
data:
|
|
581
|
-
redirect_url:
|
|
582
|
-
message:
|
|
583
|
-
button_text:
|
|
574
|
+
data: D.select("redirect", {
|
|
575
|
+
redirect_url: D.string,
|
|
576
|
+
message: D.optional(D.union(D.string, D.nullish)),
|
|
577
|
+
button_text: D.optional(D.union(D.string, D.nullish))
|
|
584
578
|
})
|
|
585
579
|
}
|
|
586
|
-
}
|
|
587
|
-
|
|
588
|
-
|
|
589
|
-
|
|
590
|
-
|
|
591
|
-
|
|
592
|
-
|
|
593
|
-
|
|
594
|
-
|
|
595
|
-
|
|
596
|
-
|
|
597
|
-
|
|
598
|
-
|
|
599
|
-
|
|
600
|
-
|
|
601
|
-
|
|
602
|
-
return;
|
|
603
|
-
}
|
|
604
|
-
i.log({
|
|
605
|
-
event: "FLOW_REDIRECT",
|
|
606
|
-
properties: {
|
|
607
|
-
flow_build: u.build,
|
|
608
|
-
flow_id: u.id,
|
|
609
|
-
flow_session_id: p,
|
|
610
|
-
flow_version: u.version,
|
|
611
|
-
href: A.toString(),
|
|
612
|
-
job: u.job
|
|
613
|
-
}
|
|
614
|
-
});
|
|
580
|
+
}, async (y) => {
|
|
581
|
+
await e.sendMessage({
|
|
582
|
+
type: "text",
|
|
583
|
+
author: "bot",
|
|
584
|
+
text: y.redirect.message ?? d("submission_redirect_message")
|
|
585
|
+
});
|
|
586
|
+
try {
|
|
587
|
+
const A = new URL(y.redirect.redirect_url);
|
|
588
|
+
v && !A.searchParams.has("anonymous_id") && A.searchParams.set("anonymous_id", v), await e.sendMessage({
|
|
589
|
+
type: "link",
|
|
590
|
+
href: A.toString(),
|
|
591
|
+
text: y.redirect.button_text ?? d("complete_submission"),
|
|
592
|
+
onClick: () => {
|
|
593
|
+
if (!h) {
|
|
594
|
+
n.error("session_id not set, cannot log FLOW_REDIRECT event");
|
|
595
|
+
return;
|
|
615
596
|
}
|
|
616
|
-
|
|
617
|
-
|
|
618
|
-
|
|
619
|
-
|
|
620
|
-
|
|
621
|
-
|
|
622
|
-
|
|
623
|
-
|
|
624
|
-
|
|
597
|
+
i.log({
|
|
598
|
+
event: "FLOW_REDIRECT",
|
|
599
|
+
properties: {
|
|
600
|
+
flow_build: u.build,
|
|
601
|
+
flow_id: u.id,
|
|
602
|
+
flow_session_id: h,
|
|
603
|
+
flow_version: u.version,
|
|
604
|
+
href: A.toString(),
|
|
605
|
+
job: u.job
|
|
606
|
+
}
|
|
607
|
+
});
|
|
608
|
+
}
|
|
609
|
+
});
|
|
610
|
+
} catch (A) {
|
|
611
|
+
n.error(`Invalid redirect URL: ${y.redirect.redirect_url}`, A), e.sendMessage({
|
|
612
|
+
type: "system",
|
|
613
|
+
variant: "error",
|
|
614
|
+
text: d("redirect_url_error")
|
|
615
|
+
});
|
|
625
616
|
}
|
|
617
|
+
t(r.nextId);
|
|
626
618
|
}).with({
|
|
627
619
|
success: !0
|
|
628
620
|
}, async () => {
|
|
@@ -631,33 +623,27 @@ async function tn({
|
|
|
631
623
|
variant: "success",
|
|
632
624
|
text: d("submission_completed")
|
|
633
625
|
}), t(r.nextId);
|
|
634
|
-
}).with(
|
|
635
|
-
success: !1,
|
|
636
|
-
ats_data: V.select("error", {
|
|
637
|
-
message: V.string
|
|
638
|
-
})
|
|
639
|
-
}, {
|
|
626
|
+
}).with({
|
|
640
627
|
integration_response: {
|
|
641
|
-
error:
|
|
642
|
-
message:
|
|
628
|
+
error: D.select("error", {
|
|
629
|
+
message: D.string
|
|
643
630
|
})
|
|
644
631
|
}
|
|
645
|
-
}
|
|
646
|
-
var A;
|
|
632
|
+
}, async (y) => {
|
|
647
633
|
n.error(y.error), await e.sendMessage({
|
|
648
634
|
type: "system",
|
|
649
635
|
variant: "error",
|
|
650
|
-
text:
|
|
651
|
-
}), await
|
|
636
|
+
text: y.error.message || d("submission_failed")
|
|
637
|
+
}), await p(!1);
|
|
652
638
|
}).otherwise(async (y) => {
|
|
653
639
|
n.error(y), await e.sendMessage({
|
|
654
640
|
type: "system",
|
|
655
641
|
variant: "error",
|
|
656
642
|
text: d("submission_failed")
|
|
657
|
-
}), await
|
|
643
|
+
}), await p(!1);
|
|
658
644
|
});
|
|
659
645
|
};
|
|
660
|
-
await
|
|
646
|
+
await p(r.data.skipConfirmation);
|
|
661
647
|
}
|
|
662
648
|
async function rn({
|
|
663
649
|
chat: e,
|
|
@@ -684,7 +670,7 @@ async function nn({
|
|
|
684
670
|
node: r,
|
|
685
671
|
context: n
|
|
686
672
|
}) {
|
|
687
|
-
t(
|
|
673
|
+
t(Le(r, {
|
|
688
674
|
submissions: e,
|
|
689
675
|
context: n
|
|
690
676
|
}) ? r.branchId : r.nextId);
|
|
@@ -1035,23 +1021,23 @@ function ft(e, t, r) {
|
|
|
1035
1021
|
var n, s, a, i, u;
|
|
1036
1022
|
t == null && (t = 100);
|
|
1037
1023
|
function d() {
|
|
1038
|
-
var
|
|
1039
|
-
|
|
1024
|
+
var w = Date.now() - i;
|
|
1025
|
+
w < t && w >= 0 ? n = setTimeout(d, t - w) : (n = null, r || (u = e.apply(a, s), a = s = null));
|
|
1040
1026
|
}
|
|
1041
|
-
var
|
|
1027
|
+
var p = function() {
|
|
1042
1028
|
a = this, s = arguments, i = Date.now();
|
|
1043
|
-
var
|
|
1044
|
-
return n || (n = setTimeout(d, t)),
|
|
1029
|
+
var w = r && !n;
|
|
1030
|
+
return n || (n = setTimeout(d, t)), w && (u = e.apply(a, s), a = s = null), u;
|
|
1045
1031
|
};
|
|
1046
|
-
return
|
|
1032
|
+
return p.clear = function() {
|
|
1047
1033
|
n && (clearTimeout(n), n = null);
|
|
1048
|
-
},
|
|
1034
|
+
}, p.flush = function() {
|
|
1049
1035
|
n && (u = e.apply(a, s), a = s = null, clearTimeout(n), n = null);
|
|
1050
|
-
},
|
|
1036
|
+
}, p;
|
|
1051
1037
|
}
|
|
1052
1038
|
ft.debounce = ft;
|
|
1053
1039
|
var mn = ft;
|
|
1054
|
-
const
|
|
1040
|
+
const Lt = /* @__PURE__ */ tr(mn);
|
|
1055
1041
|
function gn(e) {
|
|
1056
1042
|
let {
|
|
1057
1043
|
debounce: t,
|
|
@@ -1081,25 +1067,25 @@ function gn(e) {
|
|
|
1081
1067
|
scrollContainers: null,
|
|
1082
1068
|
resizeObserver: null,
|
|
1083
1069
|
lastBounds: i
|
|
1084
|
-
}),
|
|
1070
|
+
}), p = t ? typeof t == "number" ? t : t.scroll : null, w = t ? typeof t == "number" ? t : t.resize : null, v = re(!1);
|
|
1085
1071
|
ue(() => (v.current = !0, () => void (v.current = !1)));
|
|
1086
|
-
const [
|
|
1072
|
+
const [h, k, y] = pt(() => {
|
|
1087
1073
|
const g = () => {
|
|
1088
1074
|
if (!d.current.element)
|
|
1089
1075
|
return;
|
|
1090
1076
|
const {
|
|
1091
|
-
left:
|
|
1092
|
-
top:
|
|
1093
|
-
width:
|
|
1077
|
+
left: M,
|
|
1078
|
+
top: R,
|
|
1079
|
+
width: N,
|
|
1094
1080
|
height: me,
|
|
1095
1081
|
bottom: ce,
|
|
1096
1082
|
right: Ee,
|
|
1097
1083
|
x: H,
|
|
1098
1084
|
y: se
|
|
1099
1085
|
} = d.current.element.getBoundingClientRect(), q = {
|
|
1100
|
-
left:
|
|
1101
|
-
top:
|
|
1102
|
-
width:
|
|
1086
|
+
left: M,
|
|
1087
|
+
top: R,
|
|
1088
|
+
width: N,
|
|
1103
1089
|
height: me,
|
|
1104
1090
|
bottom: ce,
|
|
1105
1091
|
right: Ee,
|
|
@@ -1108,8 +1094,8 @@ function gn(e) {
|
|
|
1108
1094
|
};
|
|
1109
1095
|
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
1096
|
};
|
|
1111
|
-
return [g,
|
|
1112
|
-
}, [u, s,
|
|
1097
|
+
return [g, w ? Lt(g, w) : g, p ? Lt(g, p) : g];
|
|
1098
|
+
}, [u, s, p, w]);
|
|
1113
1099
|
function A() {
|
|
1114
1100
|
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
1101
|
}
|
|
@@ -1124,7 +1110,7 @@ function gn(e) {
|
|
|
1124
1110
|
};
|
|
1125
1111
|
return yn(y, !!r), bn(k), ue(() => {
|
|
1126
1112
|
A(), S();
|
|
1127
|
-
}, [r, y, k]), ue(() => A, []), [E, i,
|
|
1113
|
+
}, [r, y, k]), ue(() => A, []), [E, i, h];
|
|
1128
1114
|
}
|
|
1129
1115
|
function bn(e) {
|
|
1130
1116
|
ue(() => {
|
|
@@ -1216,7 +1202,7 @@ const vn = ["x", "y", "top", "bottom", "left", "right", "width", "height"], xn =
|
|
|
1216
1202
|
};
|
|
1217
1203
|
}, [e]);
|
|
1218
1204
|
const t = pt(() => ({
|
|
1219
|
-
addToSubmissions: (n, s) =>
|
|
1205
|
+
addToSubmissions: (n, s) => I.setSubmission(n, s),
|
|
1220
1206
|
send: async ({
|
|
1221
1207
|
message: n,
|
|
1222
1208
|
signal: s,
|
|
@@ -1236,7 +1222,7 @@ const vn = ["x", "y", "top", "bottom", "left", "right", "width", "height"], xn =
|
|
|
1236
1222
|
}).otherwise(async () => {
|
|
1237
1223
|
}), s != null && s.aborted)
|
|
1238
1224
|
throw new Fe();
|
|
1239
|
-
|
|
1225
|
+
I.addMessage(n, a);
|
|
1240
1226
|
},
|
|
1241
1227
|
input: ({
|
|
1242
1228
|
input: n,
|
|
@@ -1244,11 +1230,11 @@ const vn = ["x", "y", "top", "bottom", "left", "right", "width", "height"], xn =
|
|
|
1244
1230
|
}) => {
|
|
1245
1231
|
if (s != null && s.aborted)
|
|
1246
1232
|
throw new Fe();
|
|
1247
|
-
return
|
|
1233
|
+
return I.setInput(n), new Promise((a) => {
|
|
1248
1234
|
const i = (u) => {
|
|
1249
1235
|
if (s != null && s.aborted)
|
|
1250
1236
|
throw new Fe();
|
|
1251
|
-
|
|
1237
|
+
I.setInput(void 0), n.key && I.setSubmission(n.key, u), a(u);
|
|
1252
1238
|
};
|
|
1253
1239
|
z.onSubmitSuccessFn$.value = i;
|
|
1254
1240
|
});
|
|
@@ -1604,42 +1590,45 @@ const vn = ["x", "y", "top", "bottom", "left", "right", "width", "height"], xn =
|
|
|
1604
1590
|
t
|
|
1605
1591
|
}) => pt(() => {
|
|
1606
1592
|
var n;
|
|
1607
|
-
const r = (n =
|
|
1593
|
+
const r = (n = I.current$.peek().flow) == null ? void 0 : n.data.flowSessionId;
|
|
1608
1594
|
return r ? {
|
|
1609
1595
|
enabled: !0,
|
|
1610
1596
|
getPredictions: async (s) => {
|
|
1597
|
+
var v;
|
|
1611
1598
|
const a = new URL(kn);
|
|
1612
|
-
a.searchParams.set("q", s), a.searchParams.set("session_token", r)
|
|
1613
|
-
const i =
|
|
1614
|
-
|
|
1615
|
-
|
|
1599
|
+
a.searchParams.set("q", s), a.searchParams.set("session_token", r);
|
|
1600
|
+
const i = (v = I.current$.peek().flow) == null ? void 0 : v.locationOrigin;
|
|
1601
|
+
i && i.lat !== void 0 && i.lng !== void 0 && i.lat >= -90 && i.lat <= 90 && i.lng >= -180 && i.lng <= 180 && a.searchParams.set("proximity", `${i.lng},${i.lat}`), a.searchParams.set("access_token", Cn(Sn));
|
|
1602
|
+
const d = await fetch(a);
|
|
1603
|
+
if (!d.ok)
|
|
1604
|
+
return e.error("Failed to get address details", d), {
|
|
1616
1605
|
ok: !1,
|
|
1617
1606
|
error: t("address_error")
|
|
1618
1607
|
};
|
|
1619
|
-
const
|
|
1620
|
-
if (
|
|
1621
|
-
return e.error("Failed to parse address details",
|
|
1608
|
+
const p = Lr(En, await d.json());
|
|
1609
|
+
if (p.success === !1)
|
|
1610
|
+
return e.error("Failed to parse address details", p.issues), {
|
|
1622
1611
|
ok: !1,
|
|
1623
1612
|
error: t("address_error")
|
|
1624
1613
|
};
|
|
1625
1614
|
const {
|
|
1626
|
-
suggestions:
|
|
1627
|
-
} =
|
|
1615
|
+
suggestions: w
|
|
1616
|
+
} = p.output;
|
|
1628
1617
|
return {
|
|
1629
1618
|
ok: !0,
|
|
1630
|
-
data:
|
|
1631
|
-
var
|
|
1619
|
+
data: w.map((h) => {
|
|
1620
|
+
var k, y, A, S, E, g, M, R, N;
|
|
1632
1621
|
return {
|
|
1633
1622
|
label: h.full_address ?? h.place_formatted ?? h.name ?? h.mapbox_id,
|
|
1634
1623
|
id: h.mapbox_id,
|
|
1635
1624
|
address: {
|
|
1636
|
-
line1: ((
|
|
1625
|
+
line1: ((k = h.context.address) == null ? void 0 : k.name) ?? ((y = h.context.street) == null ? void 0 : y.name),
|
|
1637
1626
|
line2: void 0,
|
|
1638
|
-
line3: ((
|
|
1639
|
-
city: ((
|
|
1640
|
-
state: (
|
|
1641
|
-
postcode: (
|
|
1642
|
-
country: (
|
|
1627
|
+
line3: ((A = h.context.neighborhood) == null ? void 0 : A.name) ?? ((S = h.context.locality) == null ? void 0 : S.name),
|
|
1628
|
+
city: ((E = h.context.place) == null ? void 0 : E.name) ?? ((g = h.context.district) == null ? void 0 : g.name),
|
|
1629
|
+
state: (M = h.context.region) == null ? void 0 : M.name,
|
|
1630
|
+
postcode: (R = h.context.postcode) == null ? void 0 : R.name,
|
|
1631
|
+
country: (N = h.context.country) == null ? void 0 : N.name
|
|
1643
1632
|
}
|
|
1644
1633
|
};
|
|
1645
1634
|
})
|
|
@@ -1648,7 +1637,7 @@ const vn = ["x", "y", "top", "bottom", "left", "right", "width", "height"], xn =
|
|
|
1648
1637
|
} : {
|
|
1649
1638
|
enabled: !1
|
|
1650
1639
|
};
|
|
1651
|
-
}, [e, t]),
|
|
1640
|
+
}, [e, t]), Nt = (e) => {
|
|
1652
1641
|
const {
|
|
1653
1642
|
t
|
|
1654
1643
|
} = G();
|
|
@@ -1680,12 +1669,12 @@ const vn = ["x", "y", "top", "bottom", "left", "right", "width", "height"], xn =
|
|
|
1680
1669
|
t: n
|
|
1681
1670
|
} = G(), [s, a] = Y(), [i, u] = Y([]), {
|
|
1682
1671
|
enabled: d,
|
|
1683
|
-
getPredictions:
|
|
1672
|
+
getPredictions: p
|
|
1684
1673
|
} = An({
|
|
1685
1674
|
logger: r,
|
|
1686
1675
|
t: n
|
|
1687
|
-
}), [
|
|
1688
|
-
le(d, "Query state should not be enabled"), E = E.trim(), E !== (
|
|
1676
|
+
}), [w, v] = Y(d ? "query" : "manual"), [h, k] = Y(""), [y, A] = Y(), S = (E) => {
|
|
1677
|
+
le(d, "Query state should not be enabled"), E = E.trim(), E !== (h == null ? void 0 : h.trim()) && (k(E), E === "" && u([]), A(void 0), p(E).then((g) => {
|
|
1689
1678
|
if (g.ok === !1) {
|
|
1690
1679
|
u([]), A(g.error);
|
|
1691
1680
|
return;
|
|
@@ -1693,7 +1682,7 @@ const vn = ["x", "y", "top", "bottom", "left", "right", "width", "height"], xn =
|
|
|
1693
1682
|
u(g.data);
|
|
1694
1683
|
}));
|
|
1695
1684
|
};
|
|
1696
|
-
switch (
|
|
1685
|
+
switch (w) {
|
|
1697
1686
|
case "query":
|
|
1698
1687
|
return le(d, "Query state should not be enabled"), l(In, {
|
|
1699
1688
|
input: e,
|
|
@@ -1703,14 +1692,14 @@ const vn = ["x", "y", "top", "bottom", "left", "right", "width", "height"], xn =
|
|
|
1703
1692
|
a(void 0), v("manual");
|
|
1704
1693
|
return;
|
|
1705
1694
|
}
|
|
1706
|
-
const g = i.find((
|
|
1695
|
+
const g = i.find((M) => M.id === E);
|
|
1707
1696
|
g && (a(g.address), v("details"));
|
|
1708
1697
|
},
|
|
1709
1698
|
onAddressSearch: (E) => {
|
|
1710
1699
|
S(E);
|
|
1711
1700
|
},
|
|
1712
1701
|
suggestions: i,
|
|
1713
|
-
query:
|
|
1702
|
+
query: h,
|
|
1714
1703
|
error: y
|
|
1715
1704
|
});
|
|
1716
1705
|
case "details":
|
|
@@ -1719,7 +1708,7 @@ const vn = ["x", "y", "top", "bottom", "left", "right", "width", "height"], xn =
|
|
|
1719
1708
|
logger: r,
|
|
1720
1709
|
onSubmitSuccess: t,
|
|
1721
1710
|
addressFields: s,
|
|
1722
|
-
actions: l(
|
|
1711
|
+
actions: l(Nt, {
|
|
1723
1712
|
onClick: () => {
|
|
1724
1713
|
v("query");
|
|
1725
1714
|
}
|
|
@@ -1731,7 +1720,7 @@ const vn = ["x", "y", "top", "bottom", "left", "right", "width", "height"], xn =
|
|
|
1731
1720
|
input: e,
|
|
1732
1721
|
onSubmitSuccess: t,
|
|
1733
1722
|
addressFields: {},
|
|
1734
|
-
actions: d ? l(
|
|
1723
|
+
actions: d ? l(Nt, {
|
|
1735
1724
|
onClick: () => {
|
|
1736
1725
|
v("query");
|
|
1737
1726
|
}
|
|
@@ -1755,9 +1744,9 @@ const vn = ["x", "y", "top", "bottom", "left", "right", "width", "height"], xn =
|
|
|
1755
1744
|
}, []), l(ke, {
|
|
1756
1745
|
children: [l("form", {
|
|
1757
1746
|
noValidate: !0,
|
|
1758
|
-
onSubmit: (
|
|
1759
|
-
|
|
1760
|
-
const v = new FormData(
|
|
1747
|
+
onSubmit: (p) => {
|
|
1748
|
+
p.preventDefault();
|
|
1749
|
+
const v = new FormData(p.currentTarget).get("address");
|
|
1761
1750
|
typeof v == "string" && a(v);
|
|
1762
1751
|
},
|
|
1763
1752
|
class: "flex gap-1 p-2.5",
|
|
@@ -1812,15 +1801,15 @@ const vn = ["x", "y", "top", "bottom", "left", "right", "width", "height"], xn =
|
|
|
1812
1801
|
message: i
|
|
1813
1802
|
}
|
|
1814
1803
|
}) : null, l("ul", {
|
|
1815
|
-
children: [r.map((
|
|
1804
|
+
children: [r.map((p) => l("li", {
|
|
1816
1805
|
children: l("button", {
|
|
1817
1806
|
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
1807
|
onClick: () => {
|
|
1819
|
-
n(
|
|
1808
|
+
n(p.id);
|
|
1820
1809
|
},
|
|
1821
1810
|
children: [l("span", {
|
|
1822
1811
|
class: "flex-grow",
|
|
1823
|
-
children:
|
|
1812
|
+
children: p.label
|
|
1824
1813
|
}), l("svg", {
|
|
1825
1814
|
class: "flex-none",
|
|
1826
1815
|
width: "16",
|
|
@@ -1835,7 +1824,7 @@ const vn = ["x", "y", "top", "bottom", "left", "right", "width", "height"], xn =
|
|
|
1835
1824
|
})
|
|
1836
1825
|
})]
|
|
1837
1826
|
})
|
|
1838
|
-
},
|
|
1827
|
+
}, p.id)), l("li", {
|
|
1839
1828
|
children: l("button", {
|
|
1840
1829
|
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
1830
|
onClick: () => {
|
|
@@ -1868,20 +1857,20 @@ const vn = ["x", "y", "top", "bottom", "left", "right", "width", "height"], xn =
|
|
|
1868
1857
|
return l("form", {
|
|
1869
1858
|
class: "bg-neutral-1/90 flex flex-col justify-end gap-2 p-2",
|
|
1870
1859
|
onSubmit: (u) => {
|
|
1871
|
-
const d = new FormData(u.currentTarget),
|
|
1860
|
+
const d = new FormData(u.currentTarget), p = Object.fromEntries(d.entries());
|
|
1872
1861
|
t({
|
|
1873
1862
|
type: "address",
|
|
1874
|
-
value:
|
|
1863
|
+
value: p
|
|
1875
1864
|
});
|
|
1876
1865
|
},
|
|
1877
1866
|
children: [l("div", {
|
|
1878
1867
|
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
1868
|
ref: s,
|
|
1880
1869
|
children: Tt.map((u, d) => {
|
|
1881
|
-
const
|
|
1882
|
-
return
|
|
1870
|
+
const p = `isdk_${u}`, w = n.config.keys[u];
|
|
1871
|
+
return w ? l(ke, {
|
|
1883
1872
|
children: [l("label", {
|
|
1884
|
-
for:
|
|
1873
|
+
for: p,
|
|
1885
1874
|
class: "text-neutral-9 [&:has(+*>input:focus)]:text-neutral-11 w-24 pb-2 text-xs uppercase leading-3 tracking-widest transition-colors",
|
|
1886
1875
|
children: i(u)
|
|
1887
1876
|
}), l("div", {
|
|
@@ -1890,8 +1879,8 @@ const vn = ["x", "y", "top", "bottom", "left", "right", "width", "height"], xn =
|
|
|
1890
1879
|
class: "relative",
|
|
1891
1880
|
children: [l("select", {
|
|
1892
1881
|
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
|
-
name:
|
|
1894
|
-
id:
|
|
1882
|
+
name: w,
|
|
1883
|
+
id: p,
|
|
1895
1884
|
defaultValue: e[u],
|
|
1896
1885
|
required: !0,
|
|
1897
1886
|
children: [e.country && !a.includes(e.country) ? l("option", {
|
|
@@ -1922,8 +1911,8 @@ const vn = ["x", "y", "top", "bottom", "left", "right", "width", "height"], xn =
|
|
|
1922
1911
|
}) : l("input", {
|
|
1923
1912
|
autoFocus: d === 0 ? !0 : void 0,
|
|
1924
1913
|
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
|
-
name:
|
|
1926
|
-
id:
|
|
1914
|
+
name: w,
|
|
1915
|
+
id: p,
|
|
1927
1916
|
defaultValue: e[u],
|
|
1928
1917
|
required: !0
|
|
1929
1918
|
}), d === Tt.length - 1 ? l("hr", {
|
|
@@ -1961,7 +1950,7 @@ const vn = ["x", "y", "top", "bottom", "left", "right", "width", "height"], xn =
|
|
|
1961
1950
|
class: "truncate text-center text-base",
|
|
1962
1951
|
children: e
|
|
1963
1952
|
})
|
|
1964
|
-
})),
|
|
1953
|
+
})), Ln = ({
|
|
1965
1954
|
input: e,
|
|
1966
1955
|
onSubmitSuccess: t
|
|
1967
1956
|
}) => {
|
|
@@ -1971,7 +1960,7 @@ const vn = ["x", "y", "top", "bottom", "left", "right", "width", "height"], xn =
|
|
|
1971
1960
|
class: "",
|
|
1972
1961
|
onSubmit: (n) => {
|
|
1973
1962
|
n.preventDefault();
|
|
1974
|
-
const s =
|
|
1963
|
+
const s = Nr(n).value, a = nr(Mn, s);
|
|
1975
1964
|
t({
|
|
1976
1965
|
type: "boolean",
|
|
1977
1966
|
value: a === "true"
|
|
@@ -1998,7 +1987,7 @@ const vn = ["x", "y", "top", "bottom", "left", "right", "width", "height"], xn =
|
|
|
1998
1987
|
})
|
|
1999
1988
|
})]
|
|
2000
1989
|
});
|
|
2001
|
-
},
|
|
1990
|
+
}, Nn = (e) => new Promise((t, r) => {
|
|
2002
1991
|
const n = new FileReader();
|
|
2003
1992
|
n.readAsDataURL(e), n.onload = () => n.result ? t(n.result.toString()) : r("No result from reader"), n.onerror = r;
|
|
2004
1993
|
}), Tn = (e) => e.reduce((t, r) => t + r.sizeKb, 0), Dn = Se("file"), Rt = 3, Rn = ({
|
|
@@ -2022,7 +2011,7 @@ const vn = ["x", "y", "top", "bottom", "left", "right", "width", "height"], xn =
|
|
|
2022
2011
|
}), l("p", {
|
|
2023
2012
|
"aria-label": "File size",
|
|
2024
2013
|
class: "text-accent-11",
|
|
2025
|
-
children:
|
|
2014
|
+
children: Ne(e.sizeKb)
|
|
2026
2015
|
})]
|
|
2027
2016
|
});
|
|
2028
2017
|
}, Ot = ({
|
|
@@ -2050,28 +2039,28 @@ const vn = ["x", "y", "top", "bottom", "left", "right", "width", "height"], xn =
|
|
|
2050
2039
|
onSubmitSuccess: t
|
|
2051
2040
|
}) => {
|
|
2052
2041
|
var v;
|
|
2053
|
-
const r = (v =
|
|
2054
|
-
t:
|
|
2042
|
+
const r = (v = I.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), p = gt(), {
|
|
2043
|
+
t: w
|
|
2055
2044
|
} = G();
|
|
2056
2045
|
return l("form", {
|
|
2057
2046
|
class: "flex flex-col gap-1 p-2.5",
|
|
2058
|
-
onSubmit: (
|
|
2047
|
+
onSubmit: (h) => (h.preventDefault(), i(void 0), n.length === 0 ? i({
|
|
2059
2048
|
type: "required",
|
|
2060
|
-
message:
|
|
2049
|
+
message: w("validation_file")
|
|
2061
2050
|
}) : e.config.extensions.length > 0 && !On({
|
|
2062
2051
|
allowedExtensions: e.config.extensions,
|
|
2063
2052
|
files: n
|
|
2064
2053
|
}) ? i({
|
|
2065
2054
|
type: "validate",
|
|
2066
|
-
message: `${
|
|
2055
|
+
message: `${w("validation_file_ext", {
|
|
2067
2056
|
ext: e.config.extensions.join(", ")
|
|
2068
2057
|
})}`
|
|
2069
2058
|
}) : e.config.fileSizeLimitKib && d > e.config.fileSizeLimitKib ? i({
|
|
2070
2059
|
type: "max",
|
|
2071
|
-
message: `File size exceeds limit of ${
|
|
2060
|
+
message: `File size exceeds limit of ${Ne(e.config.fileSizeLimitKib)}`
|
|
2072
2061
|
}) : e.config.allowMultiple === !1 && n.length > 1 ? i({
|
|
2073
2062
|
type: "invalid",
|
|
2074
|
-
message:
|
|
2063
|
+
message: w("validation_file_max", {
|
|
2075
2064
|
count: 1
|
|
2076
2065
|
})
|
|
2077
2066
|
}) : t({
|
|
@@ -2081,14 +2070,14 @@ const vn = ["x", "y", "top", "bottom", "left", "right", "width", "height"], xn =
|
|
|
2081
2070
|
children: [l("div", {
|
|
2082
2071
|
class: "flex items-center gap-2",
|
|
2083
2072
|
children: [l("label", {
|
|
2084
|
-
ref:
|
|
2073
|
+
ref: p,
|
|
2085
2074
|
for: "dropzone-file",
|
|
2086
2075
|
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
2076
|
children: [n.length > 0 ? l(ke, {
|
|
2088
2077
|
children: [l("ul", {
|
|
2089
2078
|
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 =
|
|
2079
|
+
children: [n.slice(0, Rt).map((h) => {
|
|
2080
|
+
const k = h.name.split(".").pop(), y = h.name.replace(new RegExp(`.${k}$`), "");
|
|
2092
2081
|
return l(Ot, {
|
|
2093
2082
|
class: "flex overflow-hidden",
|
|
2094
2083
|
children: [l("span", {
|
|
@@ -2103,7 +2092,7 @@ const vn = ["x", "y", "top", "bottom", "left", "right", "width", "height"], xn =
|
|
|
2103
2092
|
}) : null]
|
|
2104
2093
|
}), l("p", {
|
|
2105
2094
|
class: "text-neutral-11 text-xs",
|
|
2106
|
-
children: [
|
|
2095
|
+
children: [Ne(d), " ", n.length > 1 ? "total" : ""]
|
|
2107
2096
|
})]
|
|
2108
2097
|
}) : l("div", {
|
|
2109
2098
|
class: "flex flex-col justify-center gap-4 pb-6 pt-5",
|
|
@@ -2124,13 +2113,13 @@ const vn = ["x", "y", "top", "bottom", "left", "right", "width", "height"], xn =
|
|
|
2124
2113
|
})
|
|
2125
2114
|
}), l("p", {
|
|
2126
2115
|
class: "text-neutral-12 tracking-[-0.01em]",
|
|
2127
|
-
children:
|
|
2116
|
+
children: w("upload_file", {
|
|
2128
2117
|
count: e.config.allowMultiple ? 2 : 1
|
|
2129
2118
|
})
|
|
2130
2119
|
}), e.config.fileSizeLimitKib ? l("p", {
|
|
2131
2120
|
class: "text-neutral-10 text-xs",
|
|
2132
|
-
children: ["(",
|
|
2133
|
-
size:
|
|
2121
|
+
children: ["(", w("file_max_size", {
|
|
2122
|
+
size: Ne(e.config.fileSizeLimitKib)
|
|
2134
2123
|
}), ")"]
|
|
2135
2124
|
}) : null]
|
|
2136
2125
|
}), l("aside", {
|
|
@@ -2138,22 +2127,22 @@ const vn = ["x", "y", "top", "bottom", "left", "right", "width", "height"], xn =
|
|
|
2138
2127
|
children: [l("p", {
|
|
2139
2128
|
id: "accepted-filetypes",
|
|
2140
2129
|
class: "sr-only",
|
|
2141
|
-
children:
|
|
2130
|
+
children: w("file_extensions")
|
|
2142
2131
|
}), l("ul", {
|
|
2143
2132
|
"aria-describedby": "accepted-filetypes",
|
|
2144
2133
|
class: "flex flex-wrap justify-center gap-2",
|
|
2145
|
-
children: e.config.extensions.map((
|
|
2134
|
+
children: e.config.extensions.map((h) => l("li", {
|
|
2146
2135
|
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:
|
|
2136
|
+
children: h.replace(".", "")
|
|
2148
2137
|
}))
|
|
2149
2138
|
})]
|
|
2150
2139
|
})]
|
|
2151
2140
|
}), l("input", {
|
|
2152
2141
|
id: "dropzone-file",
|
|
2153
|
-
onInput: async (
|
|
2154
|
-
le(
|
|
2155
|
-
const k =
|
|
2156
|
-
const E = await
|
|
2142
|
+
onInput: async (h) => {
|
|
2143
|
+
le(h.target instanceof HTMLInputElement);
|
|
2144
|
+
const k = h.target.files ? Array.from(h.target.files) : [], y = await Promise.allSettled(k.map(async (S) => {
|
|
2145
|
+
const E = await Nn(S);
|
|
2157
2146
|
return {
|
|
2158
2147
|
name: Bn(S.name, 42),
|
|
2159
2148
|
data: E,
|
|
@@ -2210,11 +2199,11 @@ function oe(e) {
|
|
|
2210
2199
|
return e;
|
|
2211
2200
|
return t;
|
|
2212
2201
|
}
|
|
2213
|
-
var Be = (e) => Array.isArray(e) ? e.filter(Boolean) : [],
|
|
2202
|
+
var Be = (e) => Array.isArray(e) ? e.filter(Boolean) : [], B = (e) => e === void 0, x = (e, t, r) => {
|
|
2214
2203
|
if (!t || !$(e))
|
|
2215
2204
|
return r;
|
|
2216
2205
|
const n = Be(t.split(/[,[\].]+?/)).reduce((s, a) => U(s) ? s : s[a], e);
|
|
2217
|
-
return
|
|
2206
|
+
return B(n) || n === e ? B(e[t]) ? r : e[t] : n;
|
|
2218
2207
|
}, de = (e) => typeof e == "boolean";
|
|
2219
2208
|
const Bt = {
|
|
2220
2209
|
BLUR: "blur",
|
|
@@ -2264,7 +2253,7 @@ function Gn(e) {
|
|
|
2264
2253
|
};
|
|
2265
2254
|
}, [e.disabled]);
|
|
2266
2255
|
}
|
|
2267
|
-
var te = (e) => typeof e == "string", Hn = (e, t, r, n, s) => te(e) ? (n && t.watch.add(e),
|
|
2256
|
+
var te = (e) => typeof e == "string", Hn = (e, t, r, n, s) => te(e) ? (n && t.watch.add(e), x(r, e, s)) : Array.isArray(e) ? e.map((a) => (n && t.watch.add(a), x(r, a))) : (n && (t.watchAll = !0), r), yt = (e) => /^\w*$/.test(e), hr = (e) => Be(e.replace(/["|']|\]/g, "").split(/\.|\[/));
|
|
2268
2257
|
function L(e, t, r) {
|
|
2269
2258
|
let n = -1;
|
|
2270
2259
|
const s = yt(t) ? [t] : hr(t), a = s.length, i = a - 1;
|
|
@@ -2272,8 +2261,8 @@ function L(e, t, r) {
|
|
|
2272
2261
|
const u = s[n];
|
|
2273
2262
|
let d = r;
|
|
2274
2263
|
if (n !== i) {
|
|
2275
|
-
const
|
|
2276
|
-
d = $(
|
|
2264
|
+
const p = e[u];
|
|
2265
|
+
d = $(p) || Array.isArray(p) ? p : isNaN(+s[n + 1]) ? {} : [];
|
|
2277
2266
|
}
|
|
2278
2267
|
e[u] = d, e = e[u];
|
|
2279
2268
|
}
|
|
@@ -2294,7 +2283,7 @@ var pr = (e, t, r, n, s) => t ? {
|
|
|
2294
2283
|
}), $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
2284
|
const ze = (e, t, r, n) => {
|
|
2296
2285
|
for (const s of r || Object.keys(e)) {
|
|
2297
|
-
const a =
|
|
2286
|
+
const a = x(e, s);
|
|
2298
2287
|
if (a) {
|
|
2299
2288
|
const { _f: i, ...u } = a;
|
|
2300
2289
|
if (i) {
|
|
@@ -2308,7 +2297,7 @@ const ze = (e, t, r, n) => {
|
|
|
2308
2297
|
}
|
|
2309
2298
|
};
|
|
2310
2299
|
var Wn = (e, t, r) => {
|
|
2311
|
-
const n = Be(
|
|
2300
|
+
const n = Be(x(e, r));
|
|
2312
2301
|
return L(n, "root", t[r]), L(e, r, n), e;
|
|
2313
2302
|
}, vt = (e) => e.type === "file", fe = (e) => typeof e == "function", Ge = (e) => {
|
|
2314
2303
|
if (!bt)
|
|
@@ -2328,7 +2317,7 @@ var mr = (e) => {
|
|
|
2328
2317
|
}
|
|
2329
2318
|
return e[0].checked && !e[0].disabled ? (
|
|
2330
2319
|
// @ts-expect-error expected to work in the browser
|
|
2331
|
-
e[0].attributes && !
|
|
2320
|
+
e[0].attributes && !B(e[0].attributes.value) ? B(e[0].value) || e[0].value === "" ? zt : { value: e[0].value, isValid: !0 } : zt
|
|
2332
2321
|
) : jt;
|
|
2333
2322
|
}
|
|
2334
2323
|
return jt;
|
|
@@ -2353,14 +2342,14 @@ var we = (e) => $(e) && !He(e) ? e : {
|
|
|
2353
2342
|
value: e,
|
|
2354
2343
|
message: ""
|
|
2355
2344
|
}, Kt = async (e, t, r, n, s) => {
|
|
2356
|
-
const { ref: a, refs: i, required: u, maxLength: d, minLength:
|
|
2345
|
+
const { ref: a, refs: i, required: u, maxLength: d, minLength: p, min: w, max: v, pattern: h, validate: k, name: y, valueAsNumber: A, mount: S, disabled: E } = e._f, g = x(t, y);
|
|
2357
2346
|
if (!S || E)
|
|
2358
2347
|
return {};
|
|
2359
|
-
const
|
|
2360
|
-
n &&
|
|
2361
|
-
},
|
|
2362
|
-
const X = F ?
|
|
2363
|
-
|
|
2348
|
+
const M = i ? i[0] : a, R = (F) => {
|
|
2349
|
+
n && M.reportValidity && (M.setCustomValidity(de(F) ? "" : F || ""), M.reportValidity());
|
|
2350
|
+
}, N = {}, me = xt(a), ce = Oe(a), Ee = me || ce, H = (A || vt(a)) && B(a.value) && B(g) || Ge(a) && a.value === "" || g === "" || Array.isArray(g) && !g.length, se = pr.bind(null, y, r, N), q = (F, V, O, K = ie.maxLength, W = ie.minLength) => {
|
|
2351
|
+
const X = F ? V : O;
|
|
2352
|
+
N[y] = {
|
|
2364
2353
|
type: F ? K : W,
|
|
2365
2354
|
message: X,
|
|
2366
2355
|
ref: a,
|
|
@@ -2368,81 +2357,81 @@ var we = (e) => $(e) && !He(e) ? e : {
|
|
|
2368
2357
|
};
|
|
2369
2358
|
};
|
|
2370
2359
|
if (s ? !Array.isArray(g) || !g.length : u && (!Ee && (H || U(g)) || de(g) && !g || ce && !mr(i).isValid || me && !gr(i).isValid)) {
|
|
2371
|
-
const { value: F, message:
|
|
2372
|
-
if (F && (
|
|
2360
|
+
const { value: F, message: V } = qe(u) ? { value: !!u, message: u } : we(u);
|
|
2361
|
+
if (F && (N[y] = {
|
|
2373
2362
|
type: ie.required,
|
|
2374
|
-
message:
|
|
2375
|
-
ref:
|
|
2376
|
-
...se(ie.required,
|
|
2363
|
+
message: V,
|
|
2364
|
+
ref: M,
|
|
2365
|
+
...se(ie.required, V)
|
|
2377
2366
|
}, !r))
|
|
2378
|
-
return
|
|
2367
|
+
return R(V), N;
|
|
2379
2368
|
}
|
|
2380
|
-
if (!H && (!U(
|
|
2381
|
-
let F,
|
|
2382
|
-
const
|
|
2369
|
+
if (!H && (!U(w) || !U(v))) {
|
|
2370
|
+
let F, V;
|
|
2371
|
+
const O = we(v), K = we(w);
|
|
2383
2372
|
if (!U(g) && !isNaN(g)) {
|
|
2384
2373
|
const W = a.valueAsNumber || g && +g;
|
|
2385
|
-
U(
|
|
2374
|
+
U(O.value) || (F = W > O.value), U(K.value) || (V = W < K.value);
|
|
2386
2375
|
} else {
|
|
2387
2376
|
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
|
-
te(
|
|
2377
|
+
te(O.value) && g && (F = ge ? X(g) > X(O.value) : Ae ? g > O.value : W > new Date(O.value)), te(K.value) && g && (V = ge ? X(g) < X(K.value) : Ae ? g < K.value : W < new Date(K.value));
|
|
2389
2378
|
}
|
|
2390
|
-
if ((F ||
|
|
2391
|
-
return
|
|
2379
|
+
if ((F || V) && (q(!!F, O.message, K.message, ie.max, ie.min), !r))
|
|
2380
|
+
return R(N[y].message), N;
|
|
2392
2381
|
}
|
|
2393
|
-
if ((d ||
|
|
2394
|
-
const F = we(d),
|
|
2395
|
-
if ((
|
|
2396
|
-
return
|
|
2382
|
+
if ((d || p) && !H && (te(g) || s && Array.isArray(g))) {
|
|
2383
|
+
const F = we(d), V = we(p), O = !U(F.value) && g.length > +F.value, K = !U(V.value) && g.length < +V.value;
|
|
2384
|
+
if ((O || K) && (q(O, F.message, V.message), !r))
|
|
2385
|
+
return R(N[y].message), N;
|
|
2397
2386
|
}
|
|
2398
|
-
if (
|
|
2399
|
-
const { value: F, message:
|
|
2400
|
-
if (He(F) && !g.match(F) && (
|
|
2387
|
+
if (h && !H && te(g)) {
|
|
2388
|
+
const { value: F, message: V } = we(h);
|
|
2389
|
+
if (He(F) && !g.match(F) && (N[y] = {
|
|
2401
2390
|
type: ie.pattern,
|
|
2402
|
-
message:
|
|
2391
|
+
message: V,
|
|
2403
2392
|
ref: a,
|
|
2404
|
-
...se(ie.pattern,
|
|
2393
|
+
...se(ie.pattern, V)
|
|
2405
2394
|
}, !r))
|
|
2406
|
-
return
|
|
2395
|
+
return R(V), N;
|
|
2407
2396
|
}
|
|
2408
2397
|
if (k) {
|
|
2409
2398
|
if (fe(k)) {
|
|
2410
|
-
const F = await k(g, t),
|
|
2411
|
-
if (
|
|
2412
|
-
...
|
|
2413
|
-
...se(ie.validate,
|
|
2399
|
+
const F = await k(g, t), V = Ut(F, M);
|
|
2400
|
+
if (V && (N[y] = {
|
|
2401
|
+
...V,
|
|
2402
|
+
...se(ie.validate, V.message)
|
|
2414
2403
|
}, !r))
|
|
2415
|
-
return
|
|
2404
|
+
return R(V.message), N;
|
|
2416
2405
|
} else if ($(k)) {
|
|
2417
2406
|
let F = {};
|
|
2418
|
-
for (const
|
|
2407
|
+
for (const V in k) {
|
|
2419
2408
|
if (!J(F) && !r)
|
|
2420
2409
|
break;
|
|
2421
|
-
const
|
|
2422
|
-
|
|
2423
|
-
...
|
|
2424
|
-
...se(
|
|
2425
|
-
},
|
|
2410
|
+
const O = Ut(await k[V](g, t), M, V);
|
|
2411
|
+
O && (F = {
|
|
2412
|
+
...O,
|
|
2413
|
+
...se(V, O.message)
|
|
2414
|
+
}, R(O.message), r && (N[y] = F));
|
|
2426
2415
|
}
|
|
2427
|
-
if (!J(F) && (
|
|
2428
|
-
ref:
|
|
2416
|
+
if (!J(F) && (N[y] = {
|
|
2417
|
+
ref: M,
|
|
2429
2418
|
...F
|
|
2430
2419
|
}, !r))
|
|
2431
|
-
return
|
|
2420
|
+
return N;
|
|
2432
2421
|
}
|
|
2433
2422
|
}
|
|
2434
|
-
return
|
|
2423
|
+
return R(!0), N;
|
|
2435
2424
|
};
|
|
2436
2425
|
function Jn(e, t) {
|
|
2437
2426
|
const r = t.slice(0, -1).length;
|
|
2438
2427
|
let n = 0;
|
|
2439
2428
|
for (; n < r; )
|
|
2440
|
-
e =
|
|
2429
|
+
e = B(e) ? n++ : e[t[n++]];
|
|
2441
2430
|
return e;
|
|
2442
2431
|
}
|
|
2443
2432
|
function Zn(e) {
|
|
2444
2433
|
for (const t in e)
|
|
2445
|
-
if (e.hasOwnProperty(t) && !
|
|
2434
|
+
if (e.hasOwnProperty(t) && !B(e[t]))
|
|
2446
2435
|
return !1;
|
|
2447
2436
|
return !0;
|
|
2448
2437
|
}
|
|
@@ -2508,19 +2497,19 @@ function vr(e, t, r) {
|
|
|
2508
2497
|
const n = Array.isArray(e);
|
|
2509
2498
|
if ($(e) || n)
|
|
2510
2499
|
for (const s in e)
|
|
2511
|
-
Array.isArray(e[s]) || $(e[s]) && !yr(e[s]) ?
|
|
2500
|
+
Array.isArray(e[s]) || $(e[s]) && !yr(e[s]) ? B(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
2501
|
return r;
|
|
2513
2502
|
}
|
|
2514
|
-
var ut = (e, t) => vr(e, t, Je(t)), xr = (e, { valueAsNumber: t, valueAsDate: r, setValueAs: n }) =>
|
|
2503
|
+
var ut = (e, t) => vr(e, t, Je(t)), xr = (e, { valueAsNumber: t, valueAsDate: r, setValueAs: n }) => B(e) ? e : t ? e === "" ? NaN : e && +e : r && te(e) ? new Date(e) : n ? n(e) : e;
|
|
2515
2504
|
function ct(e) {
|
|
2516
2505
|
const t = e.ref;
|
|
2517
2506
|
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) : Oe(t) ? mr(e.refs).value : xr(
|
|
2507
|
+
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(B(t.value) ? e.ref.value : t.value, e);
|
|
2519
2508
|
}
|
|
2520
2509
|
var Qn = (e, t, r, n) => {
|
|
2521
2510
|
const s = {};
|
|
2522
2511
|
for (const a of e) {
|
|
2523
|
-
const i =
|
|
2512
|
+
const i = x(t, a);
|
|
2524
2513
|
i && L(s, a, i._f);
|
|
2525
2514
|
}
|
|
2526
2515
|
return {
|
|
@@ -2529,9 +2518,9 @@ var Qn = (e, t, r, n) => {
|
|
|
2529
2518
|
fields: s,
|
|
2530
2519
|
shouldUseNativeValidation: n
|
|
2531
2520
|
};
|
|
2532
|
-
}, Ie = (e) =>
|
|
2521
|
+
}, Ie = (e) => B(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);
|
|
2533
2522
|
function Gt(e, t, r) {
|
|
2534
|
-
const n =
|
|
2523
|
+
const n = x(e, r);
|
|
2535
2524
|
if (n || yt(r))
|
|
2536
2525
|
return {
|
|
2537
2526
|
error: n,
|
|
@@ -2539,7 +2528,7 @@ function Gt(e, t, r) {
|
|
|
2539
2528
|
};
|
|
2540
2529
|
const s = r.split(".");
|
|
2541
2530
|
for (; s.length; ) {
|
|
2542
|
-
const a = s.join("."), i =
|
|
2531
|
+
const a = s.join("."), i = x(t, a), u = x(e, a);
|
|
2543
2532
|
if (i && !Array.isArray(i) && r !== a)
|
|
2544
2533
|
return { name: r };
|
|
2545
2534
|
if (u && u.type)
|
|
@@ -2553,7 +2542,7 @@ function Gt(e, t, r) {
|
|
|
2553
2542
|
name: r
|
|
2554
2543
|
};
|
|
2555
2544
|
}
|
|
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(
|
|
2545
|
+
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(x(e, t)).length && j(e, t);
|
|
2557
2546
|
const rs = {
|
|
2558
2547
|
mode: Z.onSubmit,
|
|
2559
2548
|
reValidateMode: Z.onChange,
|
|
@@ -2585,7 +2574,7 @@ function ns(e = {}, t) {
|
|
|
2585
2574
|
unMount: /* @__PURE__ */ new Set(),
|
|
2586
2575
|
array: /* @__PURE__ */ new Set(),
|
|
2587
2576
|
watch: /* @__PURE__ */ new Set()
|
|
2588
|
-
},
|
|
2577
|
+
}, p, w = 0;
|
|
2589
2578
|
const v = {
|
|
2590
2579
|
isDirty: !1,
|
|
2591
2580
|
dirtyFields: !1,
|
|
@@ -2593,53 +2582,53 @@ function ns(e = {}, t) {
|
|
|
2593
2582
|
isValidating: !1,
|
|
2594
2583
|
isValid: !1,
|
|
2595
2584
|
errors: !1
|
|
2596
|
-
},
|
|
2585
|
+
}, h = {
|
|
2597
2586
|
values: ot(),
|
|
2598
2587
|
array: ot(),
|
|
2599
2588
|
state: ot()
|
|
2600
2589
|
}, k = e.resetOptions && e.resetOptions.keepDirtyValues, y = Pt(r.mode), A = Pt(r.reValidateMode), S = r.criteriaMode === Z.all, E = (o) => (c) => {
|
|
2601
|
-
clearTimeout(
|
|
2590
|
+
clearTimeout(w), w = setTimeout(o, c);
|
|
2602
2591
|
}, g = async (o) => {
|
|
2603
2592
|
if (v.isValid || o) {
|
|
2604
2593
|
const c = r.resolver ? J((await H()).errors) : await q(s, !0);
|
|
2605
|
-
c !== n.isValid &&
|
|
2594
|
+
c !== n.isValid && h.state.next({
|
|
2606
2595
|
isValid: c
|
|
2607
2596
|
});
|
|
2608
2597
|
}
|
|
2609
|
-
},
|
|
2598
|
+
}, M = (o) => v.isValidating && h.state.next({
|
|
2610
2599
|
isValidating: o
|
|
2611
|
-
}),
|
|
2600
|
+
}), R = (o, c = [], f, _, b = !0, m = !0) => {
|
|
2612
2601
|
if (_ && f) {
|
|
2613
|
-
if (u.action = !0, m && Array.isArray(
|
|
2614
|
-
const C = f(
|
|
2602
|
+
if (u.action = !0, m && Array.isArray(x(s, o))) {
|
|
2603
|
+
const C = f(x(s, o), _.argA, _.argB);
|
|
2615
2604
|
b && L(s, o, C);
|
|
2616
2605
|
}
|
|
2617
|
-
if (m && Array.isArray(
|
|
2618
|
-
const C = f(
|
|
2606
|
+
if (m && Array.isArray(x(n.errors, o))) {
|
|
2607
|
+
const C = f(x(n.errors, o), _.argA, _.argB);
|
|
2619
2608
|
b && L(n.errors, o, C), ts(n.errors, o);
|
|
2620
2609
|
}
|
|
2621
|
-
if (v.touchedFields && m && Array.isArray(
|
|
2622
|
-
const C = f(
|
|
2610
|
+
if (v.touchedFields && m && Array.isArray(x(n.touchedFields, o))) {
|
|
2611
|
+
const C = f(x(n.touchedFields, o), _.argA, _.argB);
|
|
2623
2612
|
b && L(n.touchedFields, o, C);
|
|
2624
2613
|
}
|
|
2625
|
-
v.dirtyFields && (n.dirtyFields = ut(a, i)),
|
|
2614
|
+
v.dirtyFields && (n.dirtyFields = ut(a, i)), h.state.next({
|
|
2626
2615
|
name: o,
|
|
2627
|
-
isDirty:
|
|
2616
|
+
isDirty: V(o, c),
|
|
2628
2617
|
dirtyFields: n.dirtyFields,
|
|
2629
2618
|
errors: n.errors,
|
|
2630
2619
|
isValid: n.isValid
|
|
2631
2620
|
});
|
|
2632
2621
|
} else
|
|
2633
2622
|
L(i, o, c);
|
|
2634
|
-
},
|
|
2635
|
-
L(n.errors, o, c),
|
|
2623
|
+
}, N = (o, c) => {
|
|
2624
|
+
L(n.errors, o, c), h.state.next({
|
|
2636
2625
|
errors: n.errors
|
|
2637
2626
|
});
|
|
2638
2627
|
}, me = (o, c, f, _) => {
|
|
2639
|
-
const b =
|
|
2628
|
+
const b = x(s, o);
|
|
2640
2629
|
if (b) {
|
|
2641
|
-
const m =
|
|
2642
|
-
|
|
2630
|
+
const m = x(i, o, B(f) ? x(a, o) : f);
|
|
2631
|
+
B(m) || _ && _.defaultChecked || c ? L(i, o, c ? m : ct(b._f)) : W(o, m), u.mount && g();
|
|
2643
2632
|
}
|
|
2644
2633
|
}, ce = (o, c, f, _, b) => {
|
|
2645
2634
|
let m = !1, C = !1;
|
|
@@ -2647,18 +2636,18 @@ function ns(e = {}, t) {
|
|
|
2647
2636
|
name: o
|
|
2648
2637
|
};
|
|
2649
2638
|
if (!f || _) {
|
|
2650
|
-
v.isDirty && (C = n.isDirty, n.isDirty = T.isDirty =
|
|
2651
|
-
const
|
|
2652
|
-
C =
|
|
2639
|
+
v.isDirty && (C = n.isDirty, n.isDirty = T.isDirty = V(), m = C !== T.isDirty);
|
|
2640
|
+
const P = be(x(a, o), c);
|
|
2641
|
+
C = x(n.dirtyFields, o), P ? j(n.dirtyFields, o) : L(n.dirtyFields, o, !0), T.dirtyFields = n.dirtyFields, m = m || v.dirtyFields && C !== !P;
|
|
2653
2642
|
}
|
|
2654
2643
|
if (f) {
|
|
2655
|
-
const
|
|
2656
|
-
|
|
2644
|
+
const P = x(n.touchedFields, o);
|
|
2645
|
+
P || (L(n.touchedFields, o, f), T.touchedFields = n.touchedFields, m = m || v.touchedFields && P !== f);
|
|
2657
2646
|
}
|
|
2658
|
-
return m && b &&
|
|
2647
|
+
return m && b && h.state.next(T), m ? T : {};
|
|
2659
2648
|
}, Ee = (o, c, f, _) => {
|
|
2660
|
-
const b =
|
|
2661
|
-
if (e.delayError && f ? (
|
|
2649
|
+
const b = x(n.errors, o), m = v.isValid && de(c) && n.isValid !== c;
|
|
2650
|
+
if (e.delayError && f ? (p = E(() => N(o, f)), p(e.delayError)) : (clearTimeout(w), p = null, f ? L(n.errors, o, f) : j(n.errors, o)), (f ? !be(b, f) : b) || !J(_) || m) {
|
|
2662
2651
|
const C = {
|
|
2663
2652
|
..._,
|
|
2664
2653
|
...m && de(c) ? { isValid: c } : {},
|
|
@@ -2668,14 +2657,14 @@ function ns(e = {}, t) {
|
|
|
2668
2657
|
n = {
|
|
2669
2658
|
...n,
|
|
2670
2659
|
...C
|
|
2671
|
-
},
|
|
2660
|
+
}, h.state.next(C);
|
|
2672
2661
|
}
|
|
2673
|
-
|
|
2662
|
+
M(!1);
|
|
2674
2663
|
}, H = async (o) => r.resolver(i, r.context, Qn(o || d.mount, s, r.criteriaMode, r.shouldUseNativeValidation)), se = async (o) => {
|
|
2675
2664
|
const { errors: c } = await H(o);
|
|
2676
2665
|
if (o)
|
|
2677
2666
|
for (const f of o) {
|
|
2678
|
-
const _ =
|
|
2667
|
+
const _ = x(c, f);
|
|
2679
2668
|
_ ? L(n.errors, f, _) : j(n.errors, f);
|
|
2680
2669
|
}
|
|
2681
2670
|
else
|
|
@@ -2689,10 +2678,10 @@ function ns(e = {}, t) {
|
|
|
2689
2678
|
if (b) {
|
|
2690
2679
|
const { _f: m, ...C } = b;
|
|
2691
2680
|
if (m) {
|
|
2692
|
-
const T = d.array.has(m.name),
|
|
2693
|
-
if (
|
|
2681
|
+
const T = d.array.has(m.name), P = await Kt(b, i, S, r.shouldUseNativeValidation && !c, T);
|
|
2682
|
+
if (P[m.name] && (f.valid = !1, c))
|
|
2694
2683
|
break;
|
|
2695
|
-
!c && (
|
|
2684
|
+
!c && (x(P, m.name) ? T ? Wn(n.errors, P, m.name) : L(n.errors, m.name, P[m.name]) : j(n.errors, m.name));
|
|
2696
2685
|
}
|
|
2697
2686
|
C && await q(C, c, f);
|
|
2698
2687
|
}
|
|
@@ -2700,18 +2689,18 @@ function ns(e = {}, t) {
|
|
|
2700
2689
|
return f.valid;
|
|
2701
2690
|
}, F = () => {
|
|
2702
2691
|
for (const o of d.unMount) {
|
|
2703
|
-
const c =
|
|
2692
|
+
const c = x(s, o);
|
|
2704
2693
|
c && (c._f.refs ? c._f.refs.every((f) => !lt(f)) : !lt(c._f.ref)) && tt(o);
|
|
2705
2694
|
}
|
|
2706
2695
|
d.unMount = /* @__PURE__ */ new Set();
|
|
2707
|
-
},
|
|
2708
|
-
...u.mount ? i :
|
|
2709
|
-
}, f, c), K = (o) => Be(
|
|
2710
|
-
const _ =
|
|
2696
|
+
}, V = (o, c) => (o && c && L(i, o, c), !be(wt(), a)), O = (o, c, f) => Hn(o, d, {
|
|
2697
|
+
...u.mount ? i : B(c) ? a : te(o) ? { [o]: c } : c
|
|
2698
|
+
}, f, c), K = (o) => Be(x(u.mount ? i : a, o, e.shouldUnregister ? x(a, o, []) : [])), W = (o, c, f = {}) => {
|
|
2699
|
+
const _ = x(s, o);
|
|
2711
2700
|
let b = c;
|
|
2712
2701
|
if (_) {
|
|
2713
2702
|
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 ? 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 ||
|
|
2703
|
+
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 || h.values.next({
|
|
2715
2704
|
name: o,
|
|
2716
2705
|
values: { ...i }
|
|
2717
2706
|
})));
|
|
@@ -2719,64 +2708,64 @@ function ns(e = {}, t) {
|
|
|
2719
2708
|
(f.shouldDirty || f.shouldTouch) && ce(o, b, f.shouldTouch, f.shouldDirty, !0), f.shouldValidate && et(o);
|
|
2720
2709
|
}, X = (o, c, f) => {
|
|
2721
2710
|
for (const _ in c) {
|
|
2722
|
-
const b = c[_], m = `${o}.${_}`, C =
|
|
2711
|
+
const b = c[_], m = `${o}.${_}`, C = x(s, m);
|
|
2723
2712
|
(d.array.has(o) || !We(b) || C && !C._f) && !_e(b) ? X(m, b, f) : W(m, b, f);
|
|
2724
2713
|
}
|
|
2725
2714
|
}, ge = (o, c, f = {}) => {
|
|
2726
|
-
const _ =
|
|
2727
|
-
L(i, o, m), b ? (
|
|
2715
|
+
const _ = x(s, o), b = d.array.has(o), m = oe(c);
|
|
2716
|
+
L(i, o, m), b ? (h.array.next({
|
|
2728
2717
|
name: o,
|
|
2729
2718
|
values: { ...i }
|
|
2730
|
-
}), (v.isDirty || v.dirtyFields) && f.shouldDirty &&
|
|
2719
|
+
}), (v.isDirty || v.dirtyFields) && f.shouldDirty && h.state.next({
|
|
2731
2720
|
name: o,
|
|
2732
2721
|
dirtyFields: ut(a, i),
|
|
2733
|
-
isDirty:
|
|
2734
|
-
})) : _ && !_._f && !U(m) ? X(o, m, f) : W(o, m, f), $t(o, d) &&
|
|
2722
|
+
isDirty: V(o, m)
|
|
2723
|
+
})) : _ && !_._f && !U(m) ? X(o, m, f) : W(o, m, f), $t(o, d) && h.state.next({ ...n }), h.values.next({
|
|
2735
2724
|
name: o,
|
|
2736
2725
|
values: { ...i }
|
|
2737
2726
|
}), !u.mount && t();
|
|
2738
2727
|
}, Ae = async (o) => {
|
|
2739
2728
|
const c = o.target;
|
|
2740
2729
|
let f = c.name, _ = !0;
|
|
2741
|
-
const b =
|
|
2742
|
-
_ = Number.isNaN(T) || T ===
|
|
2730
|
+
const b = x(s, f), m = () => c.type ? ct(b._f) : $n(o), C = (T) => {
|
|
2731
|
+
_ = Number.isNaN(T) || T === x(i, f, T);
|
|
2743
2732
|
};
|
|
2744
2733
|
if (b) {
|
|
2745
|
-
let T,
|
|
2746
|
-
const $e = m(), xe = o.type === Bt.BLUR || o.type === Bt.FOCUS_OUT, Er = !Yn(b._f) && !r.resolver && !
|
|
2747
|
-
L(i, f, $e), xe ? (b._f.onBlur && b._f.onBlur(o),
|
|
2734
|
+
let T, P;
|
|
2735
|
+
const $e = m(), xe = o.type === Bt.BLUR || o.type === Bt.FOCUS_OUT, Er = !Yn(b._f) && !r.resolver && !x(n.errors, f) && !b._f.deps || es(xe, x(n.touchedFields, f), n.isSubmitted, A, y), nt = $t(f, d, xe);
|
|
2736
|
+
L(i, f, $e), xe ? (b._f.onBlur && b._f.onBlur(o), p && p(0)) : b._f.onChange && b._f.onChange(o);
|
|
2748
2737
|
const st = ce(f, $e, xe, !1), Ar = !J(st) || nt;
|
|
2749
|
-
if (!xe &&
|
|
2738
|
+
if (!xe && h.values.next({
|
|
2750
2739
|
name: f,
|
|
2751
2740
|
type: o.type,
|
|
2752
2741
|
values: { ...i }
|
|
2753
2742
|
}), Er)
|
|
2754
|
-
return v.isValid && g(), Ar &&
|
|
2755
|
-
if (!xe && nt &&
|
|
2743
|
+
return v.isValid && g(), Ar && h.state.next({ name: f, ...nt ? {} : st });
|
|
2744
|
+
if (!xe && nt && h.state.next({ ...n }), M(!0), r.resolver) {
|
|
2756
2745
|
const { errors: It } = await H([f]);
|
|
2757
2746
|
if (C($e), _) {
|
|
2758
2747
|
const Vr = Gt(n.errors, s, f), Mt = Gt(It, s, Vr.name || f);
|
|
2759
|
-
T = Mt.error, f = Mt.name,
|
|
2748
|
+
T = Mt.error, f = Mt.name, P = J(It);
|
|
2760
2749
|
}
|
|
2761
2750
|
} else
|
|
2762
|
-
T = (await Kt(b, i, S, r.shouldUseNativeValidation))[f], C($e), _ && (T ?
|
|
2763
|
-
_ && (b._f.deps && et(b._f.deps), Ee(f,
|
|
2751
|
+
T = (await Kt(b, i, S, r.shouldUseNativeValidation))[f], C($e), _ && (T ? P = !1 : v.isValid && (P = await q(s, !0)));
|
|
2752
|
+
_ && (b._f.deps && et(b._f.deps), Ee(f, P, T, st));
|
|
2764
2753
|
}
|
|
2765
2754
|
}, Pe = (o, c) => {
|
|
2766
|
-
if (
|
|
2755
|
+
if (x(n.errors, c) && o.focus)
|
|
2767
2756
|
return o.focus(), 1;
|
|
2768
2757
|
}, et = async (o, c = {}) => {
|
|
2769
2758
|
let f, _;
|
|
2770
2759
|
const b = it(o);
|
|
2771
|
-
if (
|
|
2772
|
-
const m = await se(
|
|
2773
|
-
f = J(m), _ = o ? !b.some((C) =>
|
|
2760
|
+
if (M(!0), r.resolver) {
|
|
2761
|
+
const m = await se(B(o) ? o : b);
|
|
2762
|
+
f = J(m), _ = o ? !b.some((C) => x(m, C)) : f;
|
|
2774
2763
|
} else
|
|
2775
2764
|
o ? (_ = (await Promise.all(b.map(async (m) => {
|
|
2776
|
-
const C =
|
|
2765
|
+
const C = x(s, m);
|
|
2777
2766
|
return await q(C && C._f ? { [m]: C } : C);
|
|
2778
2767
|
}))).every(Boolean), !(!_ && !n.isValid) && g()) : _ = f = await q(s);
|
|
2779
|
-
return
|
|
2768
|
+
return h.state.next({
|
|
2780
2769
|
...!te(o) || v.isValid && f !== n.isValid ? {} : { name: o },
|
|
2781
2770
|
...r.resolver || !o ? { isValid: f } : {},
|
|
2782
2771
|
errors: n.errors,
|
|
@@ -2787,44 +2776,44 @@ function ns(e = {}, t) {
|
|
|
2787
2776
|
...a,
|
|
2788
2777
|
...u.mount ? i : {}
|
|
2789
2778
|
};
|
|
2790
|
-
return
|
|
2779
|
+
return B(o) ? c : te(o) ? x(c, o) : o.map((f) => x(c, f));
|
|
2791
2780
|
}, _t = (o, c) => ({
|
|
2792
|
-
invalid: !!
|
|
2793
|
-
isDirty: !!
|
|
2794
|
-
isTouched: !!
|
|
2795
|
-
error:
|
|
2781
|
+
invalid: !!x((c || n).errors, o),
|
|
2782
|
+
isDirty: !!x((c || n).dirtyFields, o),
|
|
2783
|
+
isTouched: !!x((c || n).touchedFields, o),
|
|
2784
|
+
error: x((c || n).errors, o)
|
|
2796
2785
|
}), _r = (o) => {
|
|
2797
|
-
o && it(o).forEach((c) => j(n.errors, c)),
|
|
2786
|
+
o && it(o).forEach((c) => j(n.errors, c)), h.state.next({
|
|
2798
2787
|
errors: o ? n.errors : {}
|
|
2799
2788
|
});
|
|
2800
2789
|
}, kt = (o, c, f) => {
|
|
2801
|
-
const _ = (
|
|
2790
|
+
const _ = (x(s, o, { _f: {} })._f || {}).ref;
|
|
2802
2791
|
L(n.errors, o, {
|
|
2803
2792
|
...c,
|
|
2804
2793
|
ref: _
|
|
2805
|
-
}),
|
|
2794
|
+
}), h.state.next({
|
|
2806
2795
|
name: o,
|
|
2807
2796
|
errors: n.errors,
|
|
2808
2797
|
isValid: !1
|
|
2809
2798
|
}), f && f.shouldFocus && _ && _.focus && _.focus();
|
|
2810
|
-
}, kr = (o, c) => fe(o) ?
|
|
2811
|
-
next: (f) => o(
|
|
2812
|
-
}) :
|
|
2799
|
+
}, kr = (o, c) => fe(o) ? h.values.subscribe({
|
|
2800
|
+
next: (f) => o(O(void 0, c), f)
|
|
2801
|
+
}) : O(o, c, !0), tt = (o, c = {}) => {
|
|
2813
2802
|
for (const f of o ? it(o) : d.mount)
|
|
2814
2803
|
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
|
-
|
|
2804
|
+
h.values.next({
|
|
2816
2805
|
values: { ...i }
|
|
2817
|
-
}),
|
|
2806
|
+
}), h.state.next({
|
|
2818
2807
|
...n,
|
|
2819
|
-
...c.keepDirty ? { isDirty:
|
|
2808
|
+
...c.keepDirty ? { isDirty: V() } : {}
|
|
2820
2809
|
}), !c.keepIsValid && g();
|
|
2821
2810
|
}, St = ({ disabled: o, name: c, field: f, fields: _, value: b }) => {
|
|
2822
2811
|
if (de(o)) {
|
|
2823
|
-
const m = o ? void 0 :
|
|
2812
|
+
const m = o ? void 0 : B(b) ? ct(f ? f._f : x(_, c)._f) : b;
|
|
2824
2813
|
L(i, c, m), ce(c, m, !1, !1, !0);
|
|
2825
2814
|
}
|
|
2826
2815
|
}, rt = (o, c = {}) => {
|
|
2827
|
-
let f =
|
|
2816
|
+
let f = x(s, o);
|
|
2828
2817
|
const _ = de(c.disabled);
|
|
2829
2818
|
return L(s, o, {
|
|
2830
2819
|
...f || {},
|
|
@@ -2853,9 +2842,9 @@ function ns(e = {}, t) {
|
|
|
2853
2842
|
onBlur: Ae,
|
|
2854
2843
|
ref: (b) => {
|
|
2855
2844
|
if (b) {
|
|
2856
|
-
rt(o, c), f =
|
|
2857
|
-
const m =
|
|
2858
|
-
if (C ? T.find((
|
|
2845
|
+
rt(o, c), f = x(s, o);
|
|
2846
|
+
const m = B(b.value) && b.querySelectorAll && b.querySelectorAll("input,select,textarea")[0] || b, C = Xn(m), T = f._f.refs || [];
|
|
2847
|
+
if (C ? T.find((P) => P === m) : m === f._f.ref)
|
|
2859
2848
|
return;
|
|
2860
2849
|
L(s, o, {
|
|
2861
2850
|
_f: {
|
|
@@ -2864,33 +2853,33 @@ function ns(e = {}, t) {
|
|
|
2864
2853
|
refs: [
|
|
2865
2854
|
...T.filter(lt),
|
|
2866
2855
|
m,
|
|
2867
|
-
...Array.isArray(
|
|
2856
|
+
...Array.isArray(x(a, o)) ? [{}] : []
|
|
2868
2857
|
],
|
|
2869
2858
|
ref: { type: m.type, name: o }
|
|
2870
2859
|
} : { ref: m }
|
|
2871
2860
|
}
|
|
2872
2861
|
}), me(o, !1, void 0, m);
|
|
2873
2862
|
} else
|
|
2874
|
-
f =
|
|
2863
|
+
f = x(s, o, {}), f._f && (f._f.mount = !1), (r.shouldUnregister || c.shouldUnregister) && !(zn(d.array, o) && u.action) && d.unMount.add(o);
|
|
2875
2864
|
}
|
|
2876
2865
|
};
|
|
2877
2866
|
}, Ct = () => r.shouldFocusError && ze(s, Pe, d.mount), Sr = (o) => {
|
|
2878
|
-
de(o) && (
|
|
2867
|
+
de(o) && (h.state.next({ disabled: o }), ze(s, (c) => {
|
|
2879
2868
|
c.disabled = o;
|
|
2880
2869
|
}, 0, !1));
|
|
2881
2870
|
}, Et = (o, c) => async (f) => {
|
|
2882
2871
|
f && (f.preventDefault && f.preventDefault(), f.persist && f.persist());
|
|
2883
2872
|
let _ = oe(i);
|
|
2884
|
-
if (
|
|
2873
|
+
if (h.state.next({
|
|
2885
2874
|
isSubmitting: !0
|
|
2886
2875
|
}), r.resolver) {
|
|
2887
2876
|
const { errors: b, values: m } = await H();
|
|
2888
2877
|
n.errors = b, _ = m;
|
|
2889
2878
|
} else
|
|
2890
2879
|
await q(s);
|
|
2891
|
-
j(n.errors, "root"), J(n.errors) ? (
|
|
2880
|
+
j(n.errors, "root"), J(n.errors) ? (h.state.next({
|
|
2892
2881
|
errors: {}
|
|
2893
|
-
}), await o(_, f)) : (c && await c({ ...n.errors }, f), Ct(), setTimeout(Ct)),
|
|
2882
|
+
}), await o(_, f)) : (c && await c({ ...n.errors }, f), Ct(), setTimeout(Ct)), h.state.next({
|
|
2894
2883
|
isSubmitted: !0,
|
|
2895
2884
|
isSubmitting: !1,
|
|
2896
2885
|
isSubmitSuccessful: J(n.errors),
|
|
@@ -2898,23 +2887,23 @@ function ns(e = {}, t) {
|
|
|
2898
2887
|
errors: n.errors
|
|
2899
2888
|
});
|
|
2900
2889
|
}, Cr = (o, c = {}) => {
|
|
2901
|
-
|
|
2890
|
+
x(s, o) && (B(c.defaultValue) ? ge(o, x(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 ? V(o, x(a, o)) : V()), c.keepError || (j(n.errors, o), v.isValid && g()), h.state.next({ ...n }));
|
|
2902
2891
|
}, At = (o, c = {}) => {
|
|
2903
2892
|
const f = o ? oe(o) : a, _ = oe(f), b = o && !J(o) ? _ : a;
|
|
2904
2893
|
if (c.keepDefaultValues || (a = f), !c.keepValues) {
|
|
2905
2894
|
if (c.keepDirtyValues || k)
|
|
2906
2895
|
for (const m of d.mount)
|
|
2907
|
-
|
|
2896
|
+
x(n.dirtyFields, m) ? L(b, m, x(i, m)) : ge(m, x(b, m));
|
|
2908
2897
|
else {
|
|
2909
|
-
if (bt &&
|
|
2898
|
+
if (bt && B(o))
|
|
2910
2899
|
for (const m of d.mount) {
|
|
2911
|
-
const C =
|
|
2900
|
+
const C = x(s, m);
|
|
2912
2901
|
if (C && C._f) {
|
|
2913
2902
|
const T = Array.isArray(C._f.refs) ? C._f.refs[0] : C._f.ref;
|
|
2914
2903
|
if (Ge(T)) {
|
|
2915
|
-
const
|
|
2916
|
-
if (
|
|
2917
|
-
|
|
2904
|
+
const P = T.closest("form");
|
|
2905
|
+
if (P) {
|
|
2906
|
+
P.reset();
|
|
2918
2907
|
break;
|
|
2919
2908
|
}
|
|
2920
2909
|
}
|
|
@@ -2922,9 +2911,9 @@ function ns(e = {}, t) {
|
|
|
2922
2911
|
}
|
|
2923
2912
|
s = {};
|
|
2924
2913
|
}
|
|
2925
|
-
i = e.shouldUnregister ? c.keepDefaultValues ? oe(a) : {} : oe(b),
|
|
2914
|
+
i = e.shouldUnregister ? c.keepDefaultValues ? oe(a) : {} : oe(b), h.array.next({
|
|
2926
2915
|
values: { ...b }
|
|
2927
|
-
}),
|
|
2916
|
+
}), h.values.next({
|
|
2928
2917
|
values: { ...b }
|
|
2929
2918
|
});
|
|
2930
2919
|
}
|
|
@@ -2935,7 +2924,7 @@ function ns(e = {}, t) {
|
|
|
2935
2924
|
watch: /* @__PURE__ */ new Set(),
|
|
2936
2925
|
watchAll: !1,
|
|
2937
2926
|
focus: ""
|
|
2938
|
-
}, !u.mount && t(), u.mount = !v.isValid || !!c.keepIsValid, u.watch = !!e.shouldUnregister,
|
|
2927
|
+
}, !u.mount && t(), u.mount = !v.isValid || !!c.keepIsValid, u.watch = !!e.shouldUnregister, h.state.next({
|
|
2939
2928
|
submitCount: c.keepSubmitCount ? n.submitCount : 0,
|
|
2940
2929
|
isDirty: c.keepDirty ? n.isDirty : !!(c.keepDefaultValues && !be(o, a)),
|
|
2941
2930
|
isSubmitted: c.keepIsSubmitted ? n.isSubmitted : !1,
|
|
@@ -2954,16 +2943,16 @@ function ns(e = {}, t) {
|
|
|
2954
2943
|
handleSubmit: Et,
|
|
2955
2944
|
setError: kt,
|
|
2956
2945
|
_executeSchema: H,
|
|
2957
|
-
_getWatch:
|
|
2958
|
-
_getDirty:
|
|
2946
|
+
_getWatch: O,
|
|
2947
|
+
_getDirty: V,
|
|
2959
2948
|
_updateValid: g,
|
|
2960
2949
|
_removeUnmounted: F,
|
|
2961
|
-
_updateFieldArray:
|
|
2950
|
+
_updateFieldArray: R,
|
|
2962
2951
|
_updateDisabledField: St,
|
|
2963
2952
|
_getFieldArray: K,
|
|
2964
2953
|
_reset: At,
|
|
2965
2954
|
_resetDefaultValues: () => fe(r.defaultValues) && r.defaultValues().then((o) => {
|
|
2966
|
-
Vt(o, r.resetOptions),
|
|
2955
|
+
Vt(o, r.resetOptions), h.state.next({
|
|
2967
2956
|
isLoading: !1
|
|
2968
2957
|
});
|
|
2969
2958
|
}),
|
|
@@ -2974,7 +2963,7 @@ function ns(e = {}, t) {
|
|
|
2974
2963
|
};
|
|
2975
2964
|
},
|
|
2976
2965
|
_disableForm: Sr,
|
|
2977
|
-
_subjects:
|
|
2966
|
+
_subjects: h,
|
|
2978
2967
|
_proxyFormState: v,
|
|
2979
2968
|
get _fields() {
|
|
2980
2969
|
return s;
|
|
@@ -3025,7 +3014,7 @@ function ns(e = {}, t) {
|
|
|
3025
3014
|
unregister: tt,
|
|
3026
3015
|
setError: kt,
|
|
3027
3016
|
setFocus: (o, c = {}) => {
|
|
3028
|
-
const f =
|
|
3017
|
+
const f = x(s, o), _ = f && f._f;
|
|
3029
3018
|
if (_) {
|
|
3030
3019
|
const b = _.refs ? _.refs[0] : _.ref;
|
|
3031
3020
|
b.focus && (b.focus(), c.shouldSelect && b.select());
|
|
@@ -3075,7 +3064,7 @@ function Qe(e = {}) {
|
|
|
3075
3064
|
}
|
|
3076
3065
|
var Ht = function(e, t, r) {
|
|
3077
3066
|
if (e && "reportValidity" in e) {
|
|
3078
|
-
var n =
|
|
3067
|
+
var n = x(r, t);
|
|
3079
3068
|
e.setCustomValidity(n && n.message || ""), e.reportValidity();
|
|
3080
3069
|
}
|
|
3081
3070
|
}, ss = function(e, t) {
|
|
@@ -3091,9 +3080,9 @@ var Ht = function(e, t, r) {
|
|
|
3091
3080
|
t.shouldUseNativeValidation && ss(e, t);
|
|
3092
3081
|
var r = {};
|
|
3093
3082
|
for (var n in e) {
|
|
3094
|
-
var s =
|
|
3083
|
+
var s = x(t.fields, n), a = Object.assign(e[n] || {}, { ref: s && s.ref });
|
|
3095
3084
|
if (os(t.names || Object.keys(e), n)) {
|
|
3096
|
-
var i = Object.assign({}, is(
|
|
3085
|
+
var i = Object.assign({}, is(x(r, n)));
|
|
3097
3086
|
L(i, "root", a), L(r, n, i);
|
|
3098
3087
|
} else
|
|
3099
3088
|
L(r, n, a);
|
|
@@ -3126,14 +3115,14 @@ var Ht = function(e, t, r) {
|
|
|
3126
3115
|
return Promise.resolve(function(i, u) {
|
|
3127
3116
|
try {
|
|
3128
3117
|
var d = function() {
|
|
3129
|
-
function
|
|
3118
|
+
function p(v) {
|
|
3130
3119
|
return { values: r.raw ? n : v, errors: {} };
|
|
3131
3120
|
}
|
|
3132
|
-
var
|
|
3133
|
-
return r.mode === "sync" ?
|
|
3121
|
+
var w = Object.assign({}, { abortEarly: !1, abortPipeEarly: !1 }, t);
|
|
3122
|
+
return r.mode === "sync" ? p(nr(e, n, w)) : Promise.resolve(Dr(e, n, w)).then(p);
|
|
3134
3123
|
}();
|
|
3135
|
-
} catch (
|
|
3136
|
-
return u(
|
|
3124
|
+
} catch (p) {
|
|
3125
|
+
return u(p);
|
|
3137
3126
|
}
|
|
3138
3127
|
return d && d.then ? d.then(void 0, u) : d;
|
|
3139
3128
|
}(0, function(i) {
|
|
@@ -3185,8 +3174,8 @@ const Wt = 27, Jt = 12, Zt = 10, us = Se("enum"), cs = (e, t) => {
|
|
|
3185
3174
|
input: e,
|
|
3186
3175
|
onSubmitSuccess: t
|
|
3187
3176
|
}) => {
|
|
3188
|
-
var
|
|
3189
|
-
const r = e.key ? (
|
|
3177
|
+
var w, v;
|
|
3178
|
+
const r = e.key ? (w = I.current$.value.flow) == null ? void 0 : w.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
3179
|
t: a
|
|
3191
3180
|
} = G(), {
|
|
3192
3181
|
register: i,
|
|
@@ -3196,10 +3185,10 @@ const Wt = 27, Jt = 12, Zt = 10, us = Se("enum"), cs = (e, t) => {
|
|
|
3196
3185
|
}
|
|
3197
3186
|
} = Qe({
|
|
3198
3187
|
defaultValues: {
|
|
3199
|
-
checked: n ? {} : us(r) ? Object.fromEntries(r.value.map((
|
|
3188
|
+
checked: n ? {} : us(r) ? Object.fromEntries(r.value.map((h) => [h, !0])) : {}
|
|
3200
3189
|
},
|
|
3201
3190
|
resolver: cs(e.config, a)
|
|
3202
|
-
}),
|
|
3191
|
+
}), p = gt();
|
|
3203
3192
|
return s ? l("ul", {
|
|
3204
3193
|
style: {
|
|
3205
3194
|
maxHeight: 6.5 * Wt + 5 * Jt + 2 * Zt
|
|
@@ -3207,30 +3196,30 @@ const Wt = 27, Jt = 12, Zt = 10, us = Se("enum"), cs = (e, t) => {
|
|
|
3207
3196
|
class: Xt({
|
|
3208
3197
|
variant: "booleanLike"
|
|
3209
3198
|
}),
|
|
3210
|
-
children: e.config.options.map((
|
|
3199
|
+
children: e.config.options.map((h, k) => l("li", {
|
|
3211
3200
|
class: "flex-1",
|
|
3212
3201
|
children: l(cr, {
|
|
3213
3202
|
type: "submit",
|
|
3214
3203
|
ref: (y) => {
|
|
3215
|
-
y && k === 0 && (
|
|
3204
|
+
y && k === 0 && (p.current = y);
|
|
3216
3205
|
},
|
|
3217
|
-
label:
|
|
3206
|
+
label: h.label,
|
|
3218
3207
|
value: "true",
|
|
3219
3208
|
onClick: () => t({
|
|
3220
3209
|
type: "enum",
|
|
3221
|
-
value: [
|
|
3210
|
+
value: [h.value]
|
|
3222
3211
|
})
|
|
3223
3212
|
})
|
|
3224
|
-
},
|
|
3213
|
+
}, h.value))
|
|
3225
3214
|
}) : l("form", {
|
|
3226
3215
|
noValidate: !0,
|
|
3227
|
-
onSubmit: (
|
|
3216
|
+
onSubmit: (h) => u((k) => {
|
|
3228
3217
|
const y = k.checked;
|
|
3229
3218
|
t({
|
|
3230
3219
|
type: "enum",
|
|
3231
3220
|
value: y
|
|
3232
3221
|
});
|
|
3233
|
-
})(
|
|
3222
|
+
})(h),
|
|
3234
3223
|
children: [l("div", {
|
|
3235
3224
|
class: "flex items-center gap-1",
|
|
3236
3225
|
children: [l("ul", {
|
|
@@ -3240,27 +3229,27 @@ const Wt = 27, Jt = 12, Zt = 10, us = Se("enum"), cs = (e, t) => {
|
|
|
3240
3229
|
class: Xt({
|
|
3241
3230
|
variant: e.config.options.length === 1 ? "singleOption" : void 0
|
|
3242
3231
|
}),
|
|
3243
|
-
children: e.config.options.map((
|
|
3244
|
-
const y = `checked.${
|
|
3232
|
+
children: e.config.options.map((h, k) => {
|
|
3233
|
+
const y = `checked.${h.value}`, {
|
|
3245
3234
|
ref: A,
|
|
3246
3235
|
...S
|
|
3247
3236
|
} = i(y);
|
|
3248
3237
|
return l("li", {
|
|
3249
3238
|
class: "relative",
|
|
3250
3239
|
children: l(ds, {
|
|
3251
|
-
option:
|
|
3240
|
+
option: h,
|
|
3252
3241
|
autoFocus: k === 0,
|
|
3253
3242
|
ref: (E) => {
|
|
3254
|
-
E && k === 0 && (
|
|
3243
|
+
E && k === 0 && (p.current = E), A(E);
|
|
3255
3244
|
},
|
|
3256
3245
|
id: y,
|
|
3257
3246
|
...S,
|
|
3258
3247
|
onClick: n ? () => t({
|
|
3259
3248
|
type: "enum",
|
|
3260
|
-
value: [
|
|
3249
|
+
value: [h.value]
|
|
3261
3250
|
}) : void 0
|
|
3262
3251
|
})
|
|
3263
|
-
},
|
|
3252
|
+
}, h.value);
|
|
3264
3253
|
})
|
|
3265
3254
|
}), l("div", {
|
|
3266
3255
|
class: "flex flex-col items-center gap-2 pr-2.5 pt-2.5",
|
|
@@ -3295,7 +3284,7 @@ const Wt = 27, Jt = 12, Zt = 10, us = Se("enum"), cs = (e, t) => {
|
|
|
3295
3284
|
onSubmitSuccess: t
|
|
3296
3285
|
}) => {
|
|
3297
3286
|
var v;
|
|
3298
|
-
const r = e.config.defaultValue, n = e.key ? (v =
|
|
3287
|
+
const r = e.config.defaultValue, n = e.key ? (v = I.current$.value.flow) == null ? void 0 : v.data.submissions[e.key] : void 0, {
|
|
3299
3288
|
t: s
|
|
3300
3289
|
} = G(), {
|
|
3301
3290
|
register: a,
|
|
@@ -3310,19 +3299,19 @@ const Wt = 27, Jt = 12, Zt = 10, us = Se("enum"), cs = (e, t) => {
|
|
|
3310
3299
|
resolver: ps(e.config, s)
|
|
3311
3300
|
}), {
|
|
3312
3301
|
ref: d,
|
|
3313
|
-
...
|
|
3302
|
+
...p
|
|
3314
3303
|
} = a("number", {
|
|
3315
3304
|
required: !e.config.optional,
|
|
3316
3305
|
valueAsNumber: !0
|
|
3317
|
-
}),
|
|
3306
|
+
}), w = re();
|
|
3318
3307
|
return pe(() => {
|
|
3319
|
-
|
|
3308
|
+
w.current && (w.current.focus(), w.current.select());
|
|
3320
3309
|
}, []), l("form", {
|
|
3321
3310
|
class: "flex flex-col gap-1 p-2.5",
|
|
3322
|
-
onSubmit: i((
|
|
3323
|
-
|
|
3311
|
+
onSubmit: i((h) => {
|
|
3312
|
+
h.number !== void 0 && t({
|
|
3324
3313
|
type: "number",
|
|
3325
|
-
value:
|
|
3314
|
+
value: h.number
|
|
3326
3315
|
});
|
|
3327
3316
|
}),
|
|
3328
3317
|
children: [l("div", {
|
|
@@ -3330,14 +3319,14 @@ const Wt = 27, Jt = 12, Zt = 10, us = Se("enum"), cs = (e, t) => {
|
|
|
3330
3319
|
children: [l("div", {
|
|
3331
3320
|
class: "relative min-w-0 flex-grow",
|
|
3332
3321
|
children: [l("input", {
|
|
3333
|
-
...
|
|
3322
|
+
...p,
|
|
3334
3323
|
id: "chat-input",
|
|
3335
3324
|
autocomplete: "off",
|
|
3336
3325
|
autoCapitalize: "off",
|
|
3337
3326
|
autoCorrect: "off",
|
|
3338
3327
|
autoFocus: !0,
|
|
3339
|
-
ref: (
|
|
3340
|
-
|
|
3328
|
+
ref: (h) => {
|
|
3329
|
+
h && (w.current = h), d(h);
|
|
3341
3330
|
},
|
|
3342
3331
|
type: "text",
|
|
3343
3332
|
min: e.config.min,
|
|
@@ -3381,15 +3370,15 @@ const Wt = 27, Jt = 12, Zt = 10, us = Se("enum"), cs = (e, t) => {
|
|
|
3381
3370
|
onSubmitSuccess: t
|
|
3382
3371
|
}) => {
|
|
3383
3372
|
var A;
|
|
3384
|
-
const r = e.key ? (A =
|
|
3373
|
+
const r = e.key ? (A = I.current$.value.flow) == null ? void 0 : A.data.submissions[e.key] : void 0, {
|
|
3385
3374
|
t: n
|
|
3386
3375
|
} = G(), [s, a] = Y(), i = vs(r) ? gs(r.value) : xs(r) ? r.value : void 0, {
|
|
3387
3376
|
register: u,
|
|
3388
3377
|
handleSubmit: d,
|
|
3389
3378
|
formState: {
|
|
3390
|
-
errors:
|
|
3379
|
+
errors: p
|
|
3391
3380
|
},
|
|
3392
|
-
watch:
|
|
3381
|
+
watch: w
|
|
3393
3382
|
} = Qe({
|
|
3394
3383
|
defaultValues: {
|
|
3395
3384
|
countryCode: (i == null ? void 0 : i.countryCode) ?? e.config.defaultValue.countryCode ?? bs,
|
|
@@ -3398,10 +3387,10 @@ const Wt = 27, Jt = 12, Zt = 10, us = Se("enum"), cs = (e, t) => {
|
|
|
3398
3387
|
resolver: ws(n)
|
|
3399
3388
|
}), {
|
|
3400
3389
|
ref: v,
|
|
3401
|
-
...
|
|
3390
|
+
...h
|
|
3402
3391
|
} = u("phoneNumber", {
|
|
3403
3392
|
required: !e.config.optional
|
|
3404
|
-
}), k = re(), y =
|
|
3393
|
+
}), k = re(), y = w("countryCode");
|
|
3405
3394
|
return pe(() => {
|
|
3406
3395
|
k.current && (k.current.focus(), k.current.select());
|
|
3407
3396
|
}, []), l("form", {
|
|
@@ -3410,10 +3399,10 @@ const Wt = 27, Jt = 12, Zt = 10, us = Se("enum"), cs = (e, t) => {
|
|
|
3410
3399
|
onSubmit: d((S) => {
|
|
3411
3400
|
const E = S.phoneNumber.replace(/[^0-9]/g, ""), g = S.countryCode.replace(/[^0-9]/g, "");
|
|
3412
3401
|
a(void 0);
|
|
3413
|
-
const
|
|
3414
|
-
if (E.length + g.length <
|
|
3402
|
+
const M = e.config.minChars ?? 7;
|
|
3403
|
+
if (E.length + g.length < M)
|
|
3415
3404
|
return a(n("validation_phone_min_chars", {
|
|
3416
|
-
count:
|
|
3405
|
+
count: M
|
|
3417
3406
|
}));
|
|
3418
3407
|
e.config.submissionFormat === "phone" ? t({
|
|
3419
3408
|
type: "phone",
|
|
@@ -3445,7 +3434,7 @@ const Wt = 27, Jt = 12, Zt = 10, us = Se("enum"), cs = (e, t) => {
|
|
|
3445
3434
|
}, S))
|
|
3446
3435
|
})]
|
|
3447
3436
|
}), l("input", {
|
|
3448
|
-
...
|
|
3437
|
+
...h,
|
|
3449
3438
|
id: "chat-input",
|
|
3450
3439
|
type: "tel",
|
|
3451
3440
|
inputMode: "tel",
|
|
@@ -3467,7 +3456,7 @@ const Wt = 27, Jt = 12, Zt = 10, us = Se("enum"), cs = (e, t) => {
|
|
|
3467
3456
|
})]
|
|
3468
3457
|
}), l(ye, {})]
|
|
3469
3458
|
}), l(Ce, {
|
|
3470
|
-
error:
|
|
3459
|
+
error: p.countryCode || p.phoneNumber || {
|
|
3471
3460
|
message: s
|
|
3472
3461
|
}
|
|
3473
3462
|
})]
|
|
@@ -3542,7 +3531,7 @@ const Wt = 27, Jt = 12, Zt = 10, us = Se("enum"), cs = (e, t) => {
|
|
|
3542
3531
|
var v;
|
|
3543
3532
|
const {
|
|
3544
3533
|
t: r
|
|
3545
|
-
} = G(), n = e.key ? (v =
|
|
3534
|
+
} = G(), n = e.key ? (v = I.current$.value.flow) == null ? void 0 : v.data.submissions[e.key] : void 0, s = e.config.defaultValue, {
|
|
3546
3535
|
register: a,
|
|
3547
3536
|
handleSubmit: i,
|
|
3548
3537
|
formState: {
|
|
@@ -3555,19 +3544,19 @@ const Wt = 27, Jt = 12, Zt = 10, us = Se("enum"), cs = (e, t) => {
|
|
|
3555
3544
|
resolver: Es(e.config, r)
|
|
3556
3545
|
}), {
|
|
3557
3546
|
ref: d,
|
|
3558
|
-
...
|
|
3547
|
+
...p
|
|
3559
3548
|
} = a("text", {
|
|
3560
3549
|
required: !e.config.optional
|
|
3561
|
-
}),
|
|
3550
|
+
}), w = re();
|
|
3562
3551
|
return pe(() => {
|
|
3563
|
-
|
|
3552
|
+
w.current && (w.current.focus(), w.current.select());
|
|
3564
3553
|
}, []), l("form", {
|
|
3565
3554
|
noValidate: !0,
|
|
3566
3555
|
class: "flex flex-col gap-1 p-2.5",
|
|
3567
|
-
onSubmit: i((
|
|
3556
|
+
onSubmit: i((h) => {
|
|
3568
3557
|
t({
|
|
3569
3558
|
type: "string",
|
|
3570
|
-
value:
|
|
3559
|
+
value: h.text
|
|
3571
3560
|
});
|
|
3572
3561
|
}),
|
|
3573
3562
|
children: [l("div", {
|
|
@@ -3576,14 +3565,14 @@ const Wt = 27, Jt = 12, Zt = 10, us = Se("enum"), cs = (e, t) => {
|
|
|
3576
3565
|
class: "relative min-w-0 flex-1",
|
|
3577
3566
|
children: [l("input", {
|
|
3578
3567
|
id: "chat-input",
|
|
3579
|
-
...
|
|
3568
|
+
...p,
|
|
3580
3569
|
...Ss[e.config.format],
|
|
3581
3570
|
autocomplete: "off",
|
|
3582
3571
|
autoCapitalize: "off",
|
|
3583
3572
|
autoCorrect: "off",
|
|
3584
3573
|
autoFocus: !0,
|
|
3585
|
-
ref: (
|
|
3586
|
-
|
|
3574
|
+
ref: (h) => {
|
|
3575
|
+
h && (w.current = h), d(h);
|
|
3587
3576
|
},
|
|
3588
3577
|
placeholder: e.config.placeholder,
|
|
3589
3578
|
class: Re({
|
|
@@ -3603,7 +3592,7 @@ const Wt = 27, Jt = 12, Zt = 10, us = Se("enum"), cs = (e, t) => {
|
|
|
3603
3592
|
text: As,
|
|
3604
3593
|
phone: _s,
|
|
3605
3594
|
"multiple-choice": fs,
|
|
3606
|
-
boolean:
|
|
3595
|
+
boolean: Ln,
|
|
3607
3596
|
file: Pn,
|
|
3608
3597
|
submit: ks,
|
|
3609
3598
|
address: Vn,
|
|
@@ -3612,8 +3601,8 @@ const Wt = 27, Jt = 12, Zt = 10, us = Se("enum"), cs = (e, t) => {
|
|
|
3612
3601
|
logger: e
|
|
3613
3602
|
}) => {
|
|
3614
3603
|
var a;
|
|
3615
|
-
const t = (a =
|
|
3616
|
-
return
|
|
3604
|
+
const t = (a = I.current$.value.flow) == null ? void 0 : a.data.currentInput, [r, n] = gn(), s = re(null);
|
|
3605
|
+
return I.inputHeight$.value = n.height, ue(() => {
|
|
3617
3606
|
const i = s.current;
|
|
3618
3607
|
if (i)
|
|
3619
3608
|
return i.addEventListener("transitionstart", z.scrollToEnd.smooth), i.addEventListener("transitioncancel", z.scrollToEnd.smooth), i.addEventListener("transitionend", z.scrollToEnd.smooth), () => {
|
|
@@ -3661,13 +3650,13 @@ var Ms = function(e) {
|
|
|
3661
3650
|
return t && n.test(t) ? t.replace(r, "\\$&") : t;
|
|
3662
3651
|
}, wr = function(e) {
|
|
3663
3652
|
return typeof e == "string";
|
|
3664
|
-
},
|
|
3653
|
+
}, Ls = function(e) {
|
|
3665
3654
|
var t = [];
|
|
3666
3655
|
return e.forEach(function(r) {
|
|
3667
3656
|
Array.isArray(r) ? t = t.concat(r) : t.push(r);
|
|
3668
3657
|
}), t;
|
|
3669
3658
|
};
|
|
3670
|
-
function
|
|
3659
|
+
function Ns(e, t, r) {
|
|
3671
3660
|
var n = 0, s = 0;
|
|
3672
3661
|
if (e === "")
|
|
3673
3662
|
return e;
|
|
@@ -3685,18 +3674,18 @@ function Ls(e, t, r) {
|
|
|
3685
3674
|
return i;
|
|
3686
3675
|
}
|
|
3687
3676
|
var Ts = function(t, r, n) {
|
|
3688
|
-
return Array.isArray(t) || (t = [t]),
|
|
3689
|
-
return wr(s) ?
|
|
3677
|
+
return Array.isArray(t) || (t = [t]), Ls(t.map(function(s) {
|
|
3678
|
+
return wr(s) ? Ns(s, r, n) : s;
|
|
3690
3679
|
}));
|
|
3691
3680
|
};
|
|
3692
3681
|
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
3682
|
const t = Me(e, Ds, (i, u) => {
|
|
3694
|
-
const [, d,
|
|
3695
|
-
return
|
|
3683
|
+
const [, d, p] = i.match(Rs) ?? [];
|
|
3684
|
+
return p ? l("a", {
|
|
3696
3685
|
class: Qt,
|
|
3697
|
-
href:
|
|
3698
|
-
children: d ??
|
|
3699
|
-
},
|
|
3686
|
+
href: p,
|
|
3687
|
+
children: d ?? p
|
|
3688
|
+
}, p + u) : l("span", {
|
|
3700
3689
|
children: "INVALID LINK"
|
|
3701
3690
|
});
|
|
3702
3691
|
}), r = Me(t, Os, (i, u) => l("a", {
|
|
@@ -3800,7 +3789,7 @@ const Me = /* @__PURE__ */ tr(Ts), Ds = /(\[[^\]]+\]\([^)]+\))/g, Rs = /\[([^\]]
|
|
|
3800
3789
|
lastSentMessageFooter: e
|
|
3801
3790
|
}) => {
|
|
3802
3791
|
var r;
|
|
3803
|
-
const t = ((r =
|
|
3792
|
+
const t = ((r = I.current$.value.flow) == null ? void 0 : r.data.messages) ?? [];
|
|
3804
3793
|
return ue(() => {
|
|
3805
3794
|
z.scrollToEnd.smooth();
|
|
3806
3795
|
}, [t.length]), l("ol", {
|
|
@@ -3818,9 +3807,9 @@ const Me = /* @__PURE__ */ tr(Ts), Ds = /(\[[^\]]+\]\([^)]+\))/g, Rs = /\[([^\]]
|
|
|
3818
3807
|
children: a.text
|
|
3819
3808
|
})).with({
|
|
3820
3809
|
type: "text",
|
|
3821
|
-
author:
|
|
3810
|
+
author: D.union("bot", "user")
|
|
3822
3811
|
}, (a) => {
|
|
3823
|
-
const i = a.author === "user" && !t.slice(s + 1).some((
|
|
3812
|
+
const i = a.author === "user" && !t.slice(s + 1).some((p) => p.type === "text" && p.author === "user"), u = s === t.length - 1, d = a.author === "bot" ? js(a.text) : a.text;
|
|
3824
3813
|
return l(qs, {
|
|
3825
3814
|
animate: u,
|
|
3826
3815
|
side: Gs[a.author],
|
|
@@ -3867,28 +3856,28 @@ const Me = /* @__PURE__ */ tr(Ts), Ds = /(\[[^\]]+\]\([^)]+\))/g, Rs = /\[([^\]]
|
|
|
3867
3856
|
}) => {
|
|
3868
3857
|
const {
|
|
3869
3858
|
flow: n
|
|
3870
|
-
} =
|
|
3859
|
+
} = I.current$.value;
|
|
3871
3860
|
le(n, "Flow is required to exist to show chatbot body");
|
|
3872
|
-
const s =
|
|
3861
|
+
const s = I.viewState$.value, {
|
|
3873
3862
|
chatRef: a,
|
|
3874
3863
|
chatService: i
|
|
3875
3864
|
} = _n(), {
|
|
3876
3865
|
t: u
|
|
3877
|
-
} = G(), [d,
|
|
3866
|
+
} = G(), [d, p] = Y();
|
|
3878
3867
|
return pe(() => {
|
|
3879
3868
|
s === "maximised" && z.scrollToEnd.instant();
|
|
3880
3869
|
}, [s]), pe(() => {
|
|
3881
3870
|
var S, E;
|
|
3882
3871
|
const {
|
|
3883
|
-
state:
|
|
3872
|
+
state: w,
|
|
3884
3873
|
flow: v
|
|
3885
|
-
} =
|
|
3886
|
-
if (
|
|
3874
|
+
} = I.current$.peek();
|
|
3875
|
+
if (w !== "loaded")
|
|
3887
3876
|
throw new Error(u("invalid_state"));
|
|
3888
|
-
let
|
|
3889
|
-
if (z.scrollToEnd.instant(),
|
|
3877
|
+
let h = v.data.nodeHistory.at(-1);
|
|
3878
|
+
if (z.scrollToEnd.instant(), I.setInput(void 0), v.data.isFinished)
|
|
3890
3879
|
return;
|
|
3891
|
-
|
|
3880
|
+
h === void 0 ? (h = er(n.nodes).id, I.setCurrentNodeId(h), r.log({
|
|
3892
3881
|
event: "FLOW_START",
|
|
3893
3882
|
properties: {
|
|
3894
3883
|
flow_id: n.id,
|
|
@@ -3898,7 +3887,7 @@ const Me = /* @__PURE__ */ tr(Ts), Ds = /(\[[^\]]+\]\([^)]+\))/g, Rs = /\[([^\]]
|
|
|
3898
3887
|
job: n.job
|
|
3899
3888
|
},
|
|
3900
3889
|
customProperties: (S = n.analytics) == null ? void 0 : S.customProperties
|
|
3901
|
-
})) :
|
|
3890
|
+
})) : I.removeMessagesSentByNodeIds([h]);
|
|
3902
3891
|
const {
|
|
3903
3892
|
interpret: k,
|
|
3904
3893
|
abort: y,
|
|
@@ -3917,30 +3906,30 @@ const Me = /* @__PURE__ */ tr(Ts), Ds = /(\[[^\]]+\]\([^)]+\))/g, Rs = /\[([^\]]
|
|
|
3917
3906
|
// We need to get fresh submissions, that’s why we call `peek` here.
|
|
3918
3907
|
getSubmissions: () => {
|
|
3919
3908
|
var g;
|
|
3920
|
-
return (g =
|
|
3909
|
+
return (g = I.current$.peek().flow) == null ? void 0 : g.data.submissions;
|
|
3921
3910
|
},
|
|
3922
|
-
onInterpret: (g,
|
|
3923
|
-
var
|
|
3924
|
-
const
|
|
3925
|
-
le(
|
|
3911
|
+
onInterpret: (g, M) => {
|
|
3912
|
+
var N;
|
|
3913
|
+
const R = I.current$.peek().flow;
|
|
3914
|
+
le(R), M && (R.data.sequence = R.data.sequence + 1, r.log({
|
|
3926
3915
|
event: "FLOW_NODE",
|
|
3927
3916
|
properties: {
|
|
3928
3917
|
flow_id: n.id,
|
|
3929
3918
|
flow_version: n.version,
|
|
3930
|
-
from_node_id:
|
|
3919
|
+
from_node_id: M.id,
|
|
3931
3920
|
flow_build: n.build,
|
|
3932
3921
|
to_node_id: g.id,
|
|
3933
|
-
sequence:
|
|
3934
|
-
flow_session_id:
|
|
3922
|
+
sequence: R.data.sequence,
|
|
3923
|
+
flow_session_id: R.data.flowSessionId,
|
|
3935
3924
|
job: n.job
|
|
3936
3925
|
},
|
|
3937
|
-
customProperties: (
|
|
3938
|
-
})),
|
|
3926
|
+
customProperties: (N = n.analytics) == null ? void 0 : N.customProperties
|
|
3927
|
+
})), I.setCurrentNodeId(g.id);
|
|
3939
3928
|
},
|
|
3940
3929
|
onFlowEnd: async () => {
|
|
3941
|
-
var
|
|
3942
|
-
|
|
3943
|
-
const g =
|
|
3930
|
+
var M;
|
|
3931
|
+
I.markAsFinished();
|
|
3932
|
+
const g = I.current$.peek().flow;
|
|
3944
3933
|
le(g), r.log({
|
|
3945
3934
|
event: "FLOW_END",
|
|
3946
3935
|
properties: {
|
|
@@ -3950,18 +3939,18 @@ const Me = /* @__PURE__ */ tr(Ts), Ds = /(\[[^\]]+\]\([^)]+\))/g, Rs = /\[([^\]]
|
|
|
3950
3939
|
flow_build: n.build,
|
|
3951
3940
|
job: n.job
|
|
3952
3941
|
},
|
|
3953
|
-
customProperties: (
|
|
3942
|
+
customProperties: (M = n.analytics) == null ? void 0 : M.customProperties
|
|
3954
3943
|
});
|
|
3955
3944
|
}
|
|
3956
3945
|
});
|
|
3957
|
-
return
|
|
3946
|
+
return p(() => A), k(h), y;
|
|
3958
3947
|
}, [r, t, i, e, n, u]), l(ke, {
|
|
3959
3948
|
children: [l("div", {
|
|
3960
3949
|
ref: a,
|
|
3961
3950
|
className: "hide-scrollbars relative flex w-full max-w-full flex-grow flex-col overflow-y-scroll",
|
|
3962
3951
|
style: {
|
|
3963
3952
|
WebkitOverflowScrolling: "touch",
|
|
3964
|
-
paddingBottom:
|
|
3953
|
+
paddingBottom: I.inputHeight$.value
|
|
3965
3954
|
},
|
|
3966
3955
|
children: l(Ws, {
|
|
3967
3956
|
lastSentMessageFooter: n.data.isFinished || !d ? null : l(Zs, {
|
|
@@ -3985,13 +3974,13 @@ const Me = /* @__PURE__ */ tr(Ts), Ds = /(\[[^\]]+\]\([^)]+\))/g, Rs = /\[([^\]]
|
|
|
3985
3974
|
onClick: async () => {
|
|
3986
3975
|
const {
|
|
3987
3976
|
flow: r
|
|
3988
|
-
} =
|
|
3977
|
+
} = I.current$.peek();
|
|
3989
3978
|
le(r);
|
|
3990
3979
|
const {
|
|
3991
3980
|
removed: n
|
|
3992
3981
|
} = e(r.data.nodeHistory), s = r.data.nodeHistory.splice(-n);
|
|
3993
|
-
s.length !== 0 && (
|
|
3994
|
-
...
|
|
3982
|
+
s.length !== 0 && (I.removeMessagesSentByNodeIds(s), I.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]), I.current$.value = {
|
|
3983
|
+
...I.current$.value
|
|
3995
3984
|
});
|
|
3996
3985
|
},
|
|
3997
3986
|
children: t("undo")
|