@inploi/plugin-chatbot 7.1.1 → 9.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/cdn/index.js +3 -3
- package/cdn/style.css +1 -1
- package/dist/chatbot-body-3f51cdbc.cjs +1 -0
- package/dist/{chatbot-body-4fc6a204.js → chatbot-body-a533deae.js} +897 -968
- package/dist/chatbot.d.ts +1 -0
- package/dist/chatbot.dom.d.ts +2 -1
- package/dist/chatbot.idb.d.ts +2 -1
- package/dist/chatbot.lifecycle.test.d.ts +1 -0
- package/dist/chatbot.state.d.ts +247 -1
- package/dist/chatbot.utils.d.ts +0 -1
- package/dist/components/chatbot-body.d.ts +3 -3
- package/dist/components/chatbot.d.ts +3 -3
- package/dist/index-03247696.js +3932 -0
- package/dist/index-db52f862.cjs +5 -0
- package/dist/interpreter.d.ts +3 -3
- package/dist/plugin-chatbot.cjs +1 -1
- package/dist/plugin-chatbot.js +1 -1
- package/dist/style.css +1 -1
- package/package.json +5 -5
- package/dist/chatbot-body-b0bae6c4.cjs +0 -1
- package/dist/index-086aae7d.js +0 -3841
- package/dist/index-5d6165c2.cjs +0 -5
|
@@ -1,17 +1,17 @@
|
|
|
1
|
-
import { g as
|
|
1
|
+
import { g as He, i as Yt, k as Re, a as Qt, b as me, A as Lr, c as Mr, M as it, z as R, h as se, _ as ue, p as ce, F as er, u as Y, o as c, d as je, e as We, y as xe, f as we, s as D, j as Nr, l as ge, m as Tr, n as st, q as Q, r as Dr, t as tr, v as Rr, w as Or, x as Br, B as Fe, C as K, D as Pr, E as jr, G as pe, H as Oe, I as qe, J as rr, K as $r, L as Ur, N as zr, O as qr, P as Hr, Q as Kr, R as nr, S as Gr, T as Wr, U as X, V as Jr, W as Xr, X as Zr, Y as Yr } from "./index-03247696.js";
|
|
2
2
|
import "@inploi/sdk";
|
|
3
|
-
const
|
|
3
|
+
const Et = ({
|
|
4
4
|
condition: e,
|
|
5
5
|
context: t,
|
|
6
6
|
submissions: r,
|
|
7
7
|
ifBlock: n
|
|
8
8
|
}) => {
|
|
9
|
-
const [
|
|
10
|
-
if (!
|
|
9
|
+
const [i, ...s] = e.compareKey.split(".");
|
|
10
|
+
if (!i)
|
|
11
11
|
return !1;
|
|
12
|
-
const o =
|
|
12
|
+
const o = ar({
|
|
13
13
|
context: t,
|
|
14
|
-
key:
|
|
14
|
+
key: i,
|
|
15
15
|
path: s,
|
|
16
16
|
submissions: r
|
|
17
17
|
});
|
|
@@ -19,23 +19,23 @@ const Mt = ({
|
|
|
19
19
|
return !1;
|
|
20
20
|
switch (o.type) {
|
|
21
21
|
case "address": {
|
|
22
|
-
const
|
|
22
|
+
const a = He(o.value, s.join("."));
|
|
23
23
|
switch (e.compare) {
|
|
24
24
|
case "equals":
|
|
25
|
-
return
|
|
25
|
+
return a === e.compareValue;
|
|
26
26
|
case "contains":
|
|
27
|
-
return
|
|
27
|
+
return a ? a.includes(e.compareValue) : !1;
|
|
28
28
|
case "notEquals":
|
|
29
|
-
return
|
|
29
|
+
return a !== e.compareValue;
|
|
30
30
|
case "notContains":
|
|
31
|
-
return
|
|
31
|
+
return a ? !a.includes(e.compareValue) : !0;
|
|
32
32
|
}
|
|
33
33
|
break;
|
|
34
34
|
}
|
|
35
35
|
case "integration": {
|
|
36
36
|
if (typeof o.value != "object" || Array.isArray(o.value))
|
|
37
37
|
return !1;
|
|
38
|
-
const
|
|
38
|
+
const a = He(o.value, s.join(".")), f = {
|
|
39
39
|
...n,
|
|
40
40
|
data: {
|
|
41
41
|
compareKey: "_temp",
|
|
@@ -43,42 +43,42 @@ const Mt = ({
|
|
|
43
43
|
compareValue: e.compareValue
|
|
44
44
|
}
|
|
45
45
|
};
|
|
46
|
-
switch (typeof
|
|
46
|
+
switch (typeof a) {
|
|
47
47
|
case "boolean":
|
|
48
|
-
return
|
|
48
|
+
return De(f, {
|
|
49
49
|
submissions: {
|
|
50
50
|
_temp: {
|
|
51
|
-
value:
|
|
51
|
+
value: a,
|
|
52
52
|
type: "boolean"
|
|
53
53
|
}
|
|
54
54
|
},
|
|
55
55
|
context: t
|
|
56
56
|
});
|
|
57
57
|
case "string":
|
|
58
|
-
return
|
|
58
|
+
return De(f, {
|
|
59
59
|
submissions: {
|
|
60
60
|
_temp: {
|
|
61
|
-
value:
|
|
61
|
+
value: a,
|
|
62
62
|
type: "string"
|
|
63
63
|
}
|
|
64
64
|
},
|
|
65
65
|
context: t
|
|
66
66
|
});
|
|
67
67
|
case "number":
|
|
68
|
-
return
|
|
68
|
+
return De(f, {
|
|
69
69
|
submissions: {
|
|
70
70
|
_temp: {
|
|
71
|
-
value:
|
|
71
|
+
value: a,
|
|
72
72
|
type: "number"
|
|
73
73
|
}
|
|
74
74
|
},
|
|
75
75
|
context: t
|
|
76
76
|
});
|
|
77
77
|
case "object":
|
|
78
|
-
return Array.isArray(
|
|
78
|
+
return Array.isArray(a) && a.every(Yt) ? De(f, {
|
|
79
79
|
submissions: {
|
|
80
80
|
_temp: {
|
|
81
|
-
value:
|
|
81
|
+
value: a,
|
|
82
82
|
type: "enum"
|
|
83
83
|
}
|
|
84
84
|
},
|
|
@@ -88,46 +88,46 @@ const Mt = ({
|
|
|
88
88
|
break;
|
|
89
89
|
}
|
|
90
90
|
case "boolean": {
|
|
91
|
-
const
|
|
91
|
+
const a = e.compareValue === "true";
|
|
92
92
|
switch (e.compare) {
|
|
93
93
|
case "equals":
|
|
94
|
-
return o.value ===
|
|
94
|
+
return o.value === a;
|
|
95
95
|
case "notEquals":
|
|
96
|
-
return o.value !==
|
|
96
|
+
return o.value !== a;
|
|
97
97
|
}
|
|
98
98
|
break;
|
|
99
99
|
}
|
|
100
100
|
case "phone":
|
|
101
101
|
case "string": {
|
|
102
|
-
const
|
|
102
|
+
const a = o.type === "phone" ? Je(o.value) : o.value;
|
|
103
103
|
switch (e.compare) {
|
|
104
104
|
case "equals":
|
|
105
|
-
return
|
|
105
|
+
return a === e.compareValue;
|
|
106
106
|
case "contains":
|
|
107
|
-
return
|
|
107
|
+
return a ? a.includes(e.compareValue) : !1;
|
|
108
108
|
case "notEquals":
|
|
109
|
-
return
|
|
109
|
+
return a !== e.compareValue;
|
|
110
110
|
case "notContains":
|
|
111
|
-
return
|
|
111
|
+
return a ? !a.includes(e.compareValue) : !0;
|
|
112
112
|
}
|
|
113
113
|
break;
|
|
114
114
|
}
|
|
115
115
|
case "number": {
|
|
116
116
|
try {
|
|
117
|
-
const
|
|
117
|
+
const a = Number(e.compareValue);
|
|
118
118
|
switch (e.compare) {
|
|
119
119
|
case "equals":
|
|
120
|
-
return o.value ===
|
|
120
|
+
return o.value === a;
|
|
121
121
|
case "notEquals":
|
|
122
|
-
return o.value !==
|
|
122
|
+
return o.value !== a;
|
|
123
123
|
case "greaterThan":
|
|
124
|
-
return o.value >
|
|
124
|
+
return o.value > a;
|
|
125
125
|
case "greaterThanOrEqualTo":
|
|
126
|
-
return o.value >=
|
|
126
|
+
return o.value >= a;
|
|
127
127
|
case "lessThan":
|
|
128
|
-
return o.value <
|
|
128
|
+
return o.value < a;
|
|
129
129
|
case "lessThanOrEqualTo":
|
|
130
|
-
return o.value <=
|
|
130
|
+
return o.value <= a;
|
|
131
131
|
}
|
|
132
132
|
} catch {
|
|
133
133
|
return console.error(`Failed to parse number in if-block ${n.id}`, o.value), !1;
|
|
@@ -147,14 +147,14 @@ const Mt = ({
|
|
|
147
147
|
}
|
|
148
148
|
break;
|
|
149
149
|
}
|
|
150
|
-
},
|
|
150
|
+
}, De = (e, {
|
|
151
151
|
context: t,
|
|
152
152
|
submissions: r
|
|
153
153
|
}) => {
|
|
154
154
|
const n = "combinator" in e.data ? e.data.conditions : [e.data];
|
|
155
155
|
if (("combinator" in e.data ? e.data.combinator : "and") === "or") {
|
|
156
156
|
for (const s of n)
|
|
157
|
-
if (
|
|
157
|
+
if (Et({
|
|
158
158
|
condition: s,
|
|
159
159
|
context: t,
|
|
160
160
|
submissions: r,
|
|
@@ -164,7 +164,7 @@ const Mt = ({
|
|
|
164
164
|
return !1;
|
|
165
165
|
} else {
|
|
166
166
|
for (const s of n)
|
|
167
|
-
if (!
|
|
167
|
+
if (!Et({
|
|
168
168
|
condition: s,
|
|
169
169
|
context: t,
|
|
170
170
|
submissions: r,
|
|
@@ -173,13 +173,13 @@ const Mt = ({
|
|
|
173
173
|
return !1;
|
|
174
174
|
return !0;
|
|
175
175
|
}
|
|
176
|
-
},
|
|
176
|
+
}, Qr = /{{\s*([^}]+?)\s*(?:\|\s*([^}]+?)\s*)?}}/g, ae = (e, {
|
|
177
177
|
context: t,
|
|
178
178
|
submissions: r
|
|
179
|
-
}) => e.replace(
|
|
180
|
-
const [o, ...
|
|
179
|
+
}) => e.replace(Qr, (n, i, s = "") => {
|
|
180
|
+
const [o, ...a] = i.trim().split("."), f = ar({
|
|
181
181
|
key: o,
|
|
182
|
-
path:
|
|
182
|
+
path: a,
|
|
183
183
|
submissions: r,
|
|
184
184
|
context: t
|
|
185
185
|
});
|
|
@@ -189,7 +189,7 @@ const Mt = ({
|
|
|
189
189
|
case "boolean":
|
|
190
190
|
return f.value === !0 ? "true" : "false";
|
|
191
191
|
case "file":
|
|
192
|
-
return f.value.map((p) => `${p.name} (${
|
|
192
|
+
return f.value.map((p) => `${p.name} (${Re(p.sizeKb)})`).join(", ");
|
|
193
193
|
case "enum":
|
|
194
194
|
return f.value.join(", ");
|
|
195
195
|
case "address":
|
|
@@ -198,11 +198,11 @@ const Mt = ({
|
|
|
198
198
|
case "string":
|
|
199
199
|
return f.value ? f.value.toString() : s;
|
|
200
200
|
case "phone":
|
|
201
|
-
return
|
|
201
|
+
return Je(f.value);
|
|
202
202
|
case "integration": {
|
|
203
203
|
if (typeof f.value != "object" || Array.isArray(f.value))
|
|
204
204
|
break;
|
|
205
|
-
const p =
|
|
205
|
+
const p = He(f.value, a.join("."));
|
|
206
206
|
switch (typeof p) {
|
|
207
207
|
case "boolean":
|
|
208
208
|
return p === !0 ? "true" : "false";
|
|
@@ -211,55 +211,55 @@ const Mt = ({
|
|
|
211
211
|
case "number":
|
|
212
212
|
return p.toString();
|
|
213
213
|
case "object":
|
|
214
|
-
if (Array.isArray(p) && p.every(
|
|
214
|
+
if (Array.isArray(p) && p.every(Yt))
|
|
215
215
|
return p.join(", ");
|
|
216
216
|
}
|
|
217
217
|
break;
|
|
218
218
|
}
|
|
219
219
|
}
|
|
220
220
|
return s;
|
|
221
|
-
}),
|
|
221
|
+
}), sr = ({
|
|
222
222
|
node: e,
|
|
223
223
|
nodes: t,
|
|
224
224
|
stopWhen: r
|
|
225
225
|
}) => {
|
|
226
226
|
if ((r == null ? void 0 : r(e)) === !0)
|
|
227
227
|
return e;
|
|
228
|
-
const n = e.nextId ? t.find((
|
|
228
|
+
const n = e.nextId ? t.find((i) => i.id === e.nextId) : void 0;
|
|
229
229
|
if (n)
|
|
230
|
-
return
|
|
230
|
+
return sr({
|
|
231
231
|
node: n,
|
|
232
232
|
nodes: t,
|
|
233
233
|
stopWhen: r
|
|
234
234
|
});
|
|
235
|
-
},
|
|
235
|
+
}, en = ({
|
|
236
236
|
childNode: e,
|
|
237
237
|
nodes: t
|
|
238
238
|
}) => {
|
|
239
|
-
const n = t.filter((
|
|
240
|
-
if (!
|
|
239
|
+
const n = t.filter((i) => i.type === "if-block").find((i) => {
|
|
240
|
+
if (!i.branchId)
|
|
241
241
|
return !1;
|
|
242
|
-
const s = t.find((
|
|
242
|
+
const s = t.find((a) => a.id === i.branchId);
|
|
243
243
|
if (!s)
|
|
244
244
|
return !1;
|
|
245
|
-
const o =
|
|
245
|
+
const o = sr({
|
|
246
246
|
node: s,
|
|
247
247
|
nodes: t,
|
|
248
|
-
stopWhen: (
|
|
248
|
+
stopWhen: (a) => a.id === e.id
|
|
249
249
|
});
|
|
250
250
|
return !(!o || o.id !== e.id);
|
|
251
251
|
});
|
|
252
252
|
if (n != null && n.nextId)
|
|
253
|
-
return t.find((
|
|
254
|
-
},
|
|
253
|
+
return t.find((i) => i.id === n.nextId);
|
|
254
|
+
}, tn = ({
|
|
255
255
|
flow: e,
|
|
256
256
|
analytics: t,
|
|
257
257
|
logger: r,
|
|
258
|
-
|
|
259
|
-
context:
|
|
258
|
+
talentBankClient: n,
|
|
259
|
+
context: i,
|
|
260
260
|
apiClient: s,
|
|
261
261
|
getSubmissions: o,
|
|
262
|
-
chatService:
|
|
262
|
+
chatService: a,
|
|
263
263
|
onFlowEnd: f,
|
|
264
264
|
onInterpret: p,
|
|
265
265
|
t: C
|
|
@@ -275,33 +275,37 @@ const Mt = ({
|
|
|
275
275
|
}
|
|
276
276
|
})
|
|
277
277
|
}, y = async (b, E) => {
|
|
278
|
+
if (v.signal.aborted)
|
|
279
|
+
return;
|
|
278
280
|
const V = o();
|
|
279
281
|
p == null || p(b, E);
|
|
280
282
|
try {
|
|
281
|
-
await
|
|
283
|
+
await rn({
|
|
282
284
|
flow: e,
|
|
283
285
|
analytics: h,
|
|
284
286
|
logger: r,
|
|
285
|
-
|
|
287
|
+
talentBankClient: n,
|
|
286
288
|
apiClient: s,
|
|
287
|
-
context:
|
|
289
|
+
context: i,
|
|
288
290
|
node: b,
|
|
289
291
|
submissions: V,
|
|
290
292
|
t: C,
|
|
291
293
|
chat: {
|
|
292
|
-
sendMessage: async (x) =>
|
|
294
|
+
sendMessage: async (x) => a.send({
|
|
293
295
|
groupId: b.id,
|
|
294
296
|
message: x,
|
|
295
297
|
signal: v.signal
|
|
296
298
|
}),
|
|
297
|
-
userInput: async (x) =>
|
|
299
|
+
userInput: async (x) => a.input({
|
|
298
300
|
input: x,
|
|
299
301
|
signal: v.signal
|
|
300
302
|
}),
|
|
301
|
-
addToSubmissions:
|
|
303
|
+
addToSubmissions: (x, _) => {
|
|
304
|
+
v.signal.aborted || a.addToSubmissions(x, _);
|
|
305
|
+
}
|
|
302
306
|
},
|
|
303
307
|
next: (x) => {
|
|
304
|
-
const _ = x ? e.nodes.find((I) => I.id === x) :
|
|
308
|
+
const _ = x ? e.nodes.find((I) => I.id === x) : en({
|
|
305
309
|
childNode: b,
|
|
306
310
|
nodes: e.nodes
|
|
307
311
|
});
|
|
@@ -310,21 +314,21 @@ const Mt = ({
|
|
|
310
314
|
end: () => f == null ? void 0 : f(b)
|
|
311
315
|
});
|
|
312
316
|
} catch (x) {
|
|
313
|
-
if (x instanceof
|
|
317
|
+
if (x instanceof Lr)
|
|
314
318
|
return;
|
|
315
319
|
throw x;
|
|
316
320
|
}
|
|
317
321
|
};
|
|
318
322
|
return {
|
|
319
323
|
interpret: async (b) => {
|
|
320
|
-
const E = e.nodes.find((V) => V.id === b) ??
|
|
324
|
+
const E = e.nodes.find((V) => V.id === b) ?? Qt(e.nodes);
|
|
321
325
|
return y(E);
|
|
322
326
|
},
|
|
323
327
|
undo: (b) => {
|
|
324
328
|
let E = 1;
|
|
325
329
|
const V = e.nodes.find((_) => _.id === b[b.length - 1]);
|
|
326
330
|
for (let _ = b.length - 2; _ > 0; _--) {
|
|
327
|
-
const I = b[_], O = e.nodes.find((
|
|
331
|
+
const I = b[_], O = e.nodes.find((A) => A.id === I);
|
|
328
332
|
if (!O || (E++, O.type.startsWith("question-")))
|
|
329
333
|
break;
|
|
330
334
|
}
|
|
@@ -338,99 +342,99 @@ const Mt = ({
|
|
|
338
342
|
v.abort();
|
|
339
343
|
}
|
|
340
344
|
};
|
|
341
|
-
},
|
|
342
|
-
async function
|
|
345
|
+
}, Je = (e) => `+${e.countryCode} ${e.phoneNumber}`;
|
|
346
|
+
async function rn(e) {
|
|
343
347
|
const t = e.node;
|
|
344
348
|
switch (t.type) {
|
|
345
349
|
case "text":
|
|
346
|
-
return
|
|
350
|
+
return fn({
|
|
347
351
|
...e,
|
|
348
352
|
node: t
|
|
349
353
|
});
|
|
350
354
|
case "image":
|
|
351
|
-
return
|
|
355
|
+
return hn({
|
|
352
356
|
...e,
|
|
353
357
|
node: t
|
|
354
358
|
});
|
|
355
359
|
case "question-text":
|
|
356
|
-
return
|
|
360
|
+
return pn({
|
|
357
361
|
...e,
|
|
358
362
|
node: t
|
|
359
363
|
});
|
|
360
364
|
case "question-enum":
|
|
361
|
-
return
|
|
365
|
+
return yn({
|
|
362
366
|
...e,
|
|
363
367
|
node: t
|
|
364
368
|
});
|
|
365
369
|
case "question-number":
|
|
366
|
-
return
|
|
370
|
+
return mn({
|
|
367
371
|
...e,
|
|
368
372
|
node: t
|
|
369
373
|
});
|
|
370
374
|
case "question-phone":
|
|
371
|
-
return
|
|
375
|
+
return gn({
|
|
372
376
|
...e,
|
|
373
377
|
node: t
|
|
374
378
|
});
|
|
375
379
|
case "question-boolean":
|
|
376
|
-
return
|
|
380
|
+
return bn({
|
|
377
381
|
...e,
|
|
378
382
|
node: t
|
|
379
383
|
});
|
|
380
384
|
case "question-file":
|
|
381
|
-
return
|
|
385
|
+
return xn({
|
|
382
386
|
...e,
|
|
383
387
|
node: t
|
|
384
388
|
});
|
|
385
389
|
case "question-address":
|
|
386
|
-
return
|
|
390
|
+
return vn({
|
|
387
391
|
...e,
|
|
388
392
|
node: t
|
|
389
393
|
});
|
|
390
394
|
case "end-flow":
|
|
391
|
-
return
|
|
395
|
+
return wn({
|
|
392
396
|
...e,
|
|
393
397
|
node: t
|
|
394
398
|
});
|
|
395
399
|
case "if-block":
|
|
396
|
-
return
|
|
400
|
+
return dn({
|
|
397
401
|
...e,
|
|
398
402
|
node: t
|
|
399
403
|
});
|
|
400
404
|
case "jump":
|
|
401
|
-
return
|
|
405
|
+
return on({
|
|
402
406
|
...e,
|
|
403
407
|
node: t
|
|
404
408
|
});
|
|
405
409
|
case "link":
|
|
406
|
-
return
|
|
410
|
+
return un({
|
|
407
411
|
...e,
|
|
408
412
|
node: t
|
|
409
413
|
});
|
|
410
414
|
case "integration-application-submit":
|
|
411
|
-
return
|
|
415
|
+
return cn({
|
|
412
416
|
...e,
|
|
413
417
|
node: t
|
|
414
418
|
});
|
|
415
419
|
case "add-submission":
|
|
416
|
-
return
|
|
420
|
+
return ln({
|
|
417
421
|
...e,
|
|
418
422
|
node: t
|
|
419
423
|
});
|
|
420
424
|
case "integration-workflow-get":
|
|
421
425
|
throw Error("Workflow should be unreachable");
|
|
422
426
|
case "identify":
|
|
423
|
-
return
|
|
427
|
+
return sn({
|
|
424
428
|
...e,
|
|
425
429
|
node: t
|
|
426
430
|
});
|
|
427
431
|
case "check-duplicate":
|
|
428
|
-
return
|
|
432
|
+
return an({
|
|
429
433
|
...e,
|
|
430
434
|
node: t
|
|
431
435
|
});
|
|
432
436
|
case "feedback":
|
|
433
|
-
return
|
|
437
|
+
return nn({
|
|
434
438
|
...e,
|
|
435
439
|
node: t
|
|
436
440
|
});
|
|
@@ -445,18 +449,18 @@ const Ve = (e, t) => {
|
|
|
445
449
|
throw new Error(`Submission at “${t}” is not a string or number`);
|
|
446
450
|
return r;
|
|
447
451
|
};
|
|
448
|
-
async function
|
|
452
|
+
async function nn({
|
|
449
453
|
next: e,
|
|
450
454
|
node: t
|
|
451
455
|
}) {
|
|
452
456
|
e(t.nextId);
|
|
453
457
|
}
|
|
454
|
-
async function
|
|
458
|
+
async function sn({
|
|
455
459
|
next: e,
|
|
456
460
|
node: t,
|
|
457
461
|
analytics: r,
|
|
458
462
|
submissions: n,
|
|
459
|
-
logger:
|
|
463
|
+
logger: i
|
|
460
464
|
}) {
|
|
461
465
|
if (!n)
|
|
462
466
|
return e(t.nextId);
|
|
@@ -473,35 +477,35 @@ async function an({
|
|
|
473
477
|
key: s,
|
|
474
478
|
value: o
|
|
475
479
|
}) => {
|
|
476
|
-
var
|
|
477
|
-
return [s, (
|
|
480
|
+
var a;
|
|
481
|
+
return [s, (a = n[o]) == null ? void 0 : a.value];
|
|
478
482
|
})) : void 0
|
|
479
483
|
}
|
|
480
484
|
});
|
|
481
485
|
} catch (s) {
|
|
482
|
-
|
|
486
|
+
i.error(s);
|
|
483
487
|
} finally {
|
|
484
488
|
e(t.nextId);
|
|
485
489
|
}
|
|
486
490
|
}
|
|
487
|
-
async function
|
|
491
|
+
async function an({
|
|
488
492
|
next: e,
|
|
489
493
|
node: t,
|
|
490
|
-
|
|
494
|
+
talentBankClient: r,
|
|
491
495
|
submissions: n,
|
|
492
|
-
flow:
|
|
496
|
+
flow: i,
|
|
493
497
|
logger: s,
|
|
494
498
|
chat: o
|
|
495
499
|
}) {
|
|
496
500
|
var f;
|
|
497
|
-
let
|
|
501
|
+
let a = {
|
|
498
502
|
isDuplicate: !1
|
|
499
503
|
};
|
|
500
504
|
if (n && r) {
|
|
501
|
-
const p = t.data.scope === "job" ? (f =
|
|
505
|
+
const p = t.data.scope === "job" ? (f = i.job) == null ? void 0 : f.id : void 0;
|
|
502
506
|
if (t.data.scope === "company" || p != null)
|
|
503
507
|
try {
|
|
504
|
-
|
|
508
|
+
a = await r.checkDuplicate({
|
|
505
509
|
email: Ve(n, t.data.email).toString(),
|
|
506
510
|
jobId: p,
|
|
507
511
|
scope: t.data.scope
|
|
@@ -512,21 +516,21 @@ async function on({
|
|
|
512
516
|
}
|
|
513
517
|
o.addToSubmissions(t.data.key, {
|
|
514
518
|
type: "integration",
|
|
515
|
-
value:
|
|
519
|
+
value: a
|
|
516
520
|
}), e(t.nextId);
|
|
517
521
|
}
|
|
518
|
-
async function
|
|
522
|
+
async function on({
|
|
519
523
|
next: e,
|
|
520
524
|
node: t
|
|
521
525
|
}) {
|
|
522
526
|
e(t.data.targetId);
|
|
523
527
|
}
|
|
524
|
-
async function
|
|
528
|
+
async function ln({
|
|
525
529
|
next: e,
|
|
526
530
|
node: t,
|
|
527
531
|
logger: r,
|
|
528
532
|
submissions: n,
|
|
529
|
-
context:
|
|
533
|
+
context: i
|
|
530
534
|
}) {
|
|
531
535
|
if (!n) {
|
|
532
536
|
r.error("Submissions not found");
|
|
@@ -534,21 +538,21 @@ async function cn({
|
|
|
534
538
|
}
|
|
535
539
|
n[t.data.key] = {
|
|
536
540
|
type: "string",
|
|
537
|
-
value:
|
|
541
|
+
value: ae(t.data.value, {
|
|
538
542
|
submissions: n,
|
|
539
|
-
context:
|
|
543
|
+
context: i
|
|
540
544
|
})
|
|
541
545
|
}, e(t.nextId);
|
|
542
546
|
}
|
|
543
|
-
async function
|
|
547
|
+
async function cn({
|
|
544
548
|
chat: e,
|
|
545
549
|
next: t,
|
|
546
550
|
node: r,
|
|
547
551
|
logger: n,
|
|
548
|
-
apiClient:
|
|
552
|
+
apiClient: i,
|
|
549
553
|
submissions: s,
|
|
550
554
|
analytics: o,
|
|
551
|
-
flow:
|
|
555
|
+
flow: a,
|
|
552
556
|
t: f
|
|
553
557
|
}) {
|
|
554
558
|
const p = async (C) => {
|
|
@@ -564,21 +568,21 @@ async function un({
|
|
|
564
568
|
const {
|
|
565
569
|
anonymous_id: v,
|
|
566
570
|
session_id: h
|
|
567
|
-
} = o.getSessionInfo(), y = await
|
|
571
|
+
} = o.getSessionInfo(), y = await i.fetch("/flow/submit", {
|
|
568
572
|
method: "POST",
|
|
569
573
|
body: JSON.stringify({
|
|
570
574
|
log_submit: !1,
|
|
571
575
|
integration_id: r.data.integrationId,
|
|
572
576
|
anonymous_id: v,
|
|
573
577
|
session_id: h,
|
|
574
|
-
job:
|
|
575
|
-
submissions:
|
|
578
|
+
job: a.job,
|
|
579
|
+
submissions: Mr(s || {})
|
|
576
580
|
})
|
|
577
581
|
}).catch((b) => b);
|
|
578
582
|
r.data.key && e.addToSubmissions(r.data.key, {
|
|
579
583
|
type: "integration",
|
|
580
584
|
value: y
|
|
581
|
-
}),
|
|
585
|
+
}), it(y).with({
|
|
582
586
|
integration_response: R.select(R.union({
|
|
583
587
|
service: R.optional(R.string),
|
|
584
588
|
status: R.number,
|
|
@@ -595,20 +599,20 @@ async function un({
|
|
|
595
599
|
o.log({
|
|
596
600
|
event: "FLOW_SUBMIT",
|
|
597
601
|
properties: {
|
|
598
|
-
flow_id:
|
|
599
|
-
flow_version:
|
|
600
|
-
flow_session_id:
|
|
601
|
-
flow_build:
|
|
602
|
+
flow_id: a.id,
|
|
603
|
+
flow_version: a.version,
|
|
604
|
+
flow_session_id: a.data.flowSessionId,
|
|
605
|
+
flow_build: a.build,
|
|
602
606
|
service: b.service ?? "INVALID_SERVICE",
|
|
603
607
|
response: {
|
|
604
608
|
status: b.status,
|
|
605
609
|
payload: "data" in b ? b.data : b.error.data ?? null
|
|
606
610
|
},
|
|
607
|
-
job:
|
|
611
|
+
job: a.job
|
|
608
612
|
}
|
|
609
613
|
});
|
|
610
614
|
}).otherwise(() => {
|
|
611
|
-
}), await
|
|
615
|
+
}), await it(y).with({
|
|
612
616
|
integration_response: {
|
|
613
617
|
data: R.select("redirect", {
|
|
614
618
|
redirect_url: R.string,
|
|
@@ -636,12 +640,12 @@ async function un({
|
|
|
636
640
|
o.log({
|
|
637
641
|
event: "FLOW_REDIRECT",
|
|
638
642
|
properties: {
|
|
639
|
-
flow_build:
|
|
640
|
-
flow_id:
|
|
643
|
+
flow_build: a.build,
|
|
644
|
+
flow_id: a.id,
|
|
641
645
|
flow_session_id: h,
|
|
642
|
-
flow_version:
|
|
646
|
+
flow_version: a.version,
|
|
643
647
|
href: E.toString(),
|
|
644
|
-
job:
|
|
648
|
+
job: a.job
|
|
645
649
|
}
|
|
646
650
|
});
|
|
647
651
|
}
|
|
@@ -684,53 +688,53 @@ async function un({
|
|
|
684
688
|
};
|
|
685
689
|
await p(r.data.skipConfirmation);
|
|
686
690
|
}
|
|
687
|
-
async function
|
|
691
|
+
async function un({
|
|
688
692
|
chat: e,
|
|
689
693
|
next: t,
|
|
690
694
|
node: r,
|
|
691
695
|
submissions: n,
|
|
692
|
-
context:
|
|
696
|
+
context: i
|
|
693
697
|
}) {
|
|
694
698
|
await e.sendMessage({
|
|
695
699
|
type: "link",
|
|
696
|
-
href:
|
|
700
|
+
href: ae(r.data.href, {
|
|
697
701
|
submissions: n,
|
|
698
|
-
context:
|
|
702
|
+
context: i
|
|
699
703
|
}),
|
|
700
|
-
text:
|
|
704
|
+
text: ae(r.data.cta, {
|
|
701
705
|
submissions: n,
|
|
702
|
-
context:
|
|
706
|
+
context: i
|
|
703
707
|
})
|
|
704
708
|
}), t(r.nextId);
|
|
705
709
|
}
|
|
706
|
-
async function
|
|
710
|
+
async function dn({
|
|
707
711
|
submissions: e,
|
|
708
712
|
next: t,
|
|
709
713
|
node: r,
|
|
710
714
|
context: n
|
|
711
715
|
}) {
|
|
712
|
-
t(
|
|
716
|
+
t(De(r, {
|
|
713
717
|
submissions: e,
|
|
714
718
|
context: n
|
|
715
719
|
}) ? r.branchId : r.nextId);
|
|
716
720
|
}
|
|
717
|
-
async function
|
|
721
|
+
async function fn({
|
|
718
722
|
chat: e,
|
|
719
723
|
next: t,
|
|
720
724
|
node: r,
|
|
721
725
|
submissions: n,
|
|
722
|
-
context:
|
|
726
|
+
context: i
|
|
723
727
|
}) {
|
|
724
728
|
await e.sendMessage({
|
|
725
729
|
author: "bot",
|
|
726
730
|
type: "text",
|
|
727
|
-
text:
|
|
731
|
+
text: ae(r.data.text, {
|
|
728
732
|
submissions: n,
|
|
729
|
-
context:
|
|
733
|
+
context: i
|
|
730
734
|
})
|
|
731
735
|
}), t(r.nextId);
|
|
732
736
|
}
|
|
733
|
-
async function
|
|
737
|
+
async function hn({
|
|
734
738
|
chat: e,
|
|
735
739
|
next: t,
|
|
736
740
|
node: r
|
|
@@ -743,20 +747,20 @@ async function pn({
|
|
|
743
747
|
width: r.data.width
|
|
744
748
|
}), t(r.nextId);
|
|
745
749
|
}
|
|
746
|
-
async function
|
|
750
|
+
async function pn({
|
|
747
751
|
chat: e,
|
|
748
752
|
next: t,
|
|
749
753
|
node: r,
|
|
750
754
|
submissions: n,
|
|
751
|
-
context:
|
|
755
|
+
context: i,
|
|
752
756
|
t: s
|
|
753
757
|
}) {
|
|
754
758
|
await e.sendMessage({
|
|
755
759
|
author: "bot",
|
|
756
760
|
type: "text",
|
|
757
|
-
text:
|
|
761
|
+
text: ae(r.data.question, {
|
|
758
762
|
submissions: n,
|
|
759
|
-
context:
|
|
763
|
+
context: i
|
|
760
764
|
})
|
|
761
765
|
});
|
|
762
766
|
const o = r.data.format === "phone" ? await e.userInput({
|
|
@@ -788,23 +792,23 @@ async function mn({
|
|
|
788
792
|
}) : await e.sendMessage({
|
|
789
793
|
author: "user",
|
|
790
794
|
type: "text",
|
|
791
|
-
text: o.type === "phone" ?
|
|
795
|
+
text: o.type === "phone" ? Je(o.value) : o.value
|
|
792
796
|
}), t(r.nextId);
|
|
793
797
|
}
|
|
794
|
-
async function
|
|
798
|
+
async function mn({
|
|
795
799
|
chat: e,
|
|
796
800
|
next: t,
|
|
797
801
|
node: r,
|
|
798
802
|
submissions: n,
|
|
799
|
-
context:
|
|
803
|
+
context: i,
|
|
800
804
|
t: s
|
|
801
805
|
}) {
|
|
802
806
|
await e.sendMessage({
|
|
803
807
|
author: "bot",
|
|
804
808
|
type: "text",
|
|
805
|
-
text:
|
|
809
|
+
text: ae(r.data.question, {
|
|
806
810
|
submissions: n,
|
|
807
|
-
context:
|
|
811
|
+
context: i
|
|
808
812
|
})
|
|
809
813
|
});
|
|
810
814
|
const o = await e.userInput({
|
|
@@ -828,19 +832,19 @@ async function gn({
|
|
|
828
832
|
text: o.value.toString()
|
|
829
833
|
}), t(r.nextId);
|
|
830
834
|
}
|
|
831
|
-
async function
|
|
835
|
+
async function gn({
|
|
832
836
|
chat: e,
|
|
833
837
|
next: t,
|
|
834
838
|
node: r,
|
|
835
839
|
submissions: n,
|
|
836
|
-
context:
|
|
840
|
+
context: i
|
|
837
841
|
}) {
|
|
838
842
|
await e.sendMessage({
|
|
839
843
|
author: "bot",
|
|
840
844
|
type: "text",
|
|
841
|
-
text:
|
|
845
|
+
text: ae(r.data.question, {
|
|
842
846
|
submissions: n,
|
|
843
|
-
context:
|
|
847
|
+
context: i
|
|
844
848
|
})
|
|
845
849
|
});
|
|
846
850
|
const s = await e.userInput({
|
|
@@ -863,23 +867,23 @@ async function yn({
|
|
|
863
867
|
}) : await e.sendMessage({
|
|
864
868
|
author: "user",
|
|
865
869
|
type: "text",
|
|
866
|
-
text: s.type === "phone" ?
|
|
870
|
+
text: s.type === "phone" ? Je(s.value) : s.value
|
|
867
871
|
}), t(r.nextId);
|
|
868
872
|
}
|
|
869
|
-
async function
|
|
873
|
+
async function yn({
|
|
870
874
|
chat: e,
|
|
871
875
|
next: t,
|
|
872
876
|
node: r,
|
|
873
877
|
submissions: n,
|
|
874
|
-
context:
|
|
878
|
+
context: i,
|
|
875
879
|
t: s
|
|
876
880
|
}) {
|
|
877
881
|
await e.sendMessage({
|
|
878
882
|
author: "bot",
|
|
879
883
|
type: "text",
|
|
880
|
-
text:
|
|
884
|
+
text: ae(r.data.question, {
|
|
881
885
|
submissions: n,
|
|
882
|
-
context:
|
|
886
|
+
context: i
|
|
883
887
|
})
|
|
884
888
|
});
|
|
885
889
|
const o = await e.userInput({
|
|
@@ -894,23 +898,23 @@ async function bn({
|
|
|
894
898
|
}) : await e.sendMessage({
|
|
895
899
|
author: "user",
|
|
896
900
|
type: "text",
|
|
897
|
-
text: r.data.options.filter((
|
|
901
|
+
text: r.data.options.filter((a) => o.value.includes(a.value)).map((a) => a.label).join(", ")
|
|
898
902
|
}), t(r.nextId);
|
|
899
903
|
}
|
|
900
|
-
async function
|
|
904
|
+
async function bn({
|
|
901
905
|
chat: e,
|
|
902
906
|
next: t,
|
|
903
907
|
node: r,
|
|
904
908
|
submissions: n,
|
|
905
|
-
context:
|
|
909
|
+
context: i,
|
|
906
910
|
t: s
|
|
907
911
|
}) {
|
|
908
912
|
await e.sendMessage({
|
|
909
913
|
author: "bot",
|
|
910
914
|
type: "text",
|
|
911
|
-
text:
|
|
915
|
+
text: ae(r.data.question, {
|
|
912
916
|
submissions: n,
|
|
913
|
-
context:
|
|
917
|
+
context: i
|
|
914
918
|
})
|
|
915
919
|
});
|
|
916
920
|
const o = await e.userInput({
|
|
@@ -934,7 +938,7 @@ async function vn({
|
|
|
934
938
|
text: o.value === !0 ? r.data.trueLabel : r.data.falseLabel
|
|
935
939
|
}), t(r.nextId);
|
|
936
940
|
}
|
|
937
|
-
async function
|
|
941
|
+
async function vn({
|
|
938
942
|
chat: e,
|
|
939
943
|
next: t,
|
|
940
944
|
node: r,
|
|
@@ -945,7 +949,7 @@ async function xn({
|
|
|
945
949
|
type: "text",
|
|
946
950
|
text: r.data.question
|
|
947
951
|
});
|
|
948
|
-
const
|
|
952
|
+
const i = await e.userInput({
|
|
949
953
|
type: "address",
|
|
950
954
|
key: r.data.key,
|
|
951
955
|
config: {
|
|
@@ -954,14 +958,14 @@ async function xn({
|
|
|
954
958
|
placeholder: r.data.placeholder
|
|
955
959
|
}
|
|
956
960
|
});
|
|
957
|
-
if (
|
|
961
|
+
if (i === null)
|
|
958
962
|
await e.sendMessage({
|
|
959
963
|
type: "system",
|
|
960
964
|
variant: "info",
|
|
961
965
|
text: n("skipped")
|
|
962
966
|
});
|
|
963
967
|
else {
|
|
964
|
-
const s = Object.values(
|
|
968
|
+
const s = Object.values(i.value).filter((o) => o && o.trim().length > 0).join(", ");
|
|
965
969
|
await e.sendMessage({
|
|
966
970
|
author: "user",
|
|
967
971
|
type: "text",
|
|
@@ -970,20 +974,20 @@ async function xn({
|
|
|
970
974
|
}
|
|
971
975
|
return t(r.nextId);
|
|
972
976
|
}
|
|
973
|
-
async function
|
|
977
|
+
async function xn({
|
|
974
978
|
node: e,
|
|
975
979
|
chat: t,
|
|
976
980
|
next: r,
|
|
977
981
|
submissions: n,
|
|
978
|
-
context:
|
|
982
|
+
context: i,
|
|
979
983
|
t: s
|
|
980
984
|
}) {
|
|
981
985
|
await t.sendMessage({
|
|
982
986
|
author: "bot",
|
|
983
987
|
type: "text",
|
|
984
|
-
text:
|
|
988
|
+
text: ae(e.data.question, {
|
|
985
989
|
submissions: n,
|
|
986
|
-
context:
|
|
990
|
+
context: i
|
|
987
991
|
})
|
|
988
992
|
});
|
|
989
993
|
const o = await t.userInput({
|
|
@@ -1004,16 +1008,16 @@ async function wn({
|
|
|
1004
1008
|
text: s("skipped")
|
|
1005
1009
|
});
|
|
1006
1010
|
else
|
|
1007
|
-
for (const
|
|
1011
|
+
for (const a of o.value)
|
|
1008
1012
|
await t.sendMessage({
|
|
1009
1013
|
author: "user",
|
|
1010
1014
|
type: "file",
|
|
1011
|
-
fileName:
|
|
1012
|
-
fileSizeKb:
|
|
1015
|
+
fileName: a.name,
|
|
1016
|
+
fileSizeKb: a.sizeKb
|
|
1013
1017
|
});
|
|
1014
1018
|
r(e.nextId);
|
|
1015
1019
|
}
|
|
1016
|
-
async function
|
|
1020
|
+
async function wn({
|
|
1017
1021
|
chat: e,
|
|
1018
1022
|
end: t,
|
|
1019
1023
|
node: r
|
|
@@ -1024,7 +1028,7 @@ async function kn({
|
|
|
1024
1028
|
text: r.data.systemMessage
|
|
1025
1029
|
}), t();
|
|
1026
1030
|
}
|
|
1027
|
-
const
|
|
1031
|
+
const ar = ({
|
|
1028
1032
|
key: e,
|
|
1029
1033
|
path: t,
|
|
1030
1034
|
submissions: r,
|
|
@@ -1033,89 +1037,89 @@ const lr = ({
|
|
|
1033
1037
|
if (e === "$context") {
|
|
1034
1038
|
if (!t)
|
|
1035
1039
|
return;
|
|
1036
|
-
const
|
|
1037
|
-
switch (typeof
|
|
1040
|
+
const i = He(n, t.join("."));
|
|
1041
|
+
switch (typeof i) {
|
|
1038
1042
|
case "string":
|
|
1039
1043
|
return {
|
|
1040
1044
|
type: "string",
|
|
1041
|
-
value:
|
|
1045
|
+
value: i
|
|
1042
1046
|
};
|
|
1043
1047
|
case "number":
|
|
1044
1048
|
return {
|
|
1045
1049
|
type: "number",
|
|
1046
|
-
value:
|
|
1050
|
+
value: i
|
|
1047
1051
|
};
|
|
1048
1052
|
case "boolean":
|
|
1049
1053
|
return {
|
|
1050
1054
|
type: "boolean",
|
|
1051
|
-
value:
|
|
1055
|
+
value: i
|
|
1052
1056
|
};
|
|
1053
1057
|
default:
|
|
1054
|
-
console.warn(`Unexpected type for $context.${t.join(".")}`,
|
|
1058
|
+
console.warn(`Unexpected type for $context.${t.join(".")}`, i);
|
|
1055
1059
|
return;
|
|
1056
1060
|
}
|
|
1057
1061
|
}
|
|
1058
1062
|
return r == null ? void 0 : r[e];
|
|
1059
1063
|
};
|
|
1060
|
-
function
|
|
1064
|
+
function Ft(e, t) {
|
|
1061
1065
|
let r;
|
|
1062
1066
|
return (...n) => {
|
|
1063
1067
|
window.clearTimeout(r), r = window.setTimeout(() => e(...n), t);
|
|
1064
1068
|
};
|
|
1065
1069
|
}
|
|
1066
|
-
function
|
|
1067
|
-
const
|
|
1070
|
+
function kn({ debounce: e, scroll: t, polyfill: r, offsetSize: n } = { debounce: 0, scroll: !1, offsetSize: !1 }) {
|
|
1071
|
+
const i = r || (typeof window > "u" ? class {
|
|
1068
1072
|
} : window.ResizeObserver);
|
|
1069
|
-
if (!
|
|
1073
|
+
if (!i)
|
|
1070
1074
|
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");
|
|
1071
|
-
const [s, o] = se({ left: 0, top: 0, width: 0, height: 0, bottom: 0, right: 0, x: 0, y: 0 }),
|
|
1072
|
-
|
|
1073
|
-
const [v, h, y] =
|
|
1075
|
+
const [s, o] = se({ left: 0, top: 0, width: 0, height: 0, bottom: 0, right: 0, x: 0, y: 0 }), a = ue({ element: null, scrollContainers: null, resizeObserver: null, lastBounds: s, orientationHandler: null }), f = e ? typeof e == "number" ? e : e.scroll : null, p = e ? typeof e == "number" ? e : e.resize : null, C = ue(!1);
|
|
1076
|
+
ce(() => (C.current = !0, () => void (C.current = !1)));
|
|
1077
|
+
const [v, h, y] = er(() => {
|
|
1074
1078
|
const x = () => {
|
|
1075
|
-
if (!
|
|
1079
|
+
if (!a.current.element)
|
|
1076
1080
|
return;
|
|
1077
|
-
const { left: _, top: I, width: O, height:
|
|
1078
|
-
|
|
1081
|
+
const { left: _, top: I, width: O, height: A, bottom: ye, right: Ce, x: ie, y: de } = a.current.element.getBoundingClientRect(), z = { left: _, top: I, width: O, height: A, bottom: ye, right: Ce, x: ie, y: de };
|
|
1082
|
+
a.current.element instanceof HTMLElement && n && (z.height = a.current.element.offsetHeight, z.width = a.current.element.offsetWidth), Object.freeze(z), C.current && !Vn(a.current.lastBounds, z) && o(a.current.lastBounds = z);
|
|
1079
1083
|
};
|
|
1080
|
-
return [x, p ?
|
|
1084
|
+
return [x, p ? Ft(x, p) : x, f ? Ft(x, f) : x];
|
|
1081
1085
|
}, [o, n, f, p]);
|
|
1082
1086
|
function b() {
|
|
1083
|
-
|
|
1087
|
+
a.current.scrollContainers && (a.current.scrollContainers.forEach((x) => x.removeEventListener("scroll", y, !0)), a.current.scrollContainers = null), a.current.resizeObserver && (a.current.resizeObserver.disconnect(), a.current.resizeObserver = null), a.current.orientationHandler && ("orientation" in screen && "removeEventListener" in screen.orientation ? screen.orientation.removeEventListener("change", a.current.orientationHandler) : "onorientationchange" in window && window.removeEventListener("orientationchange", a.current.orientationHandler));
|
|
1084
1088
|
}
|
|
1085
1089
|
function E() {
|
|
1086
|
-
|
|
1090
|
+
a.current.element && (a.current.resizeObserver = new i(y), a.current.resizeObserver.observe(a.current.element), t && a.current.scrollContainers && a.current.scrollContainers.forEach((x) => x.addEventListener("scroll", y, { capture: !0, passive: !0 })), a.current.orientationHandler = () => {
|
|
1087
1091
|
y();
|
|
1088
|
-
}, "orientation" in screen && "addEventListener" in screen.orientation ? screen.orientation.addEventListener("change",
|
|
1092
|
+
}, "orientation" in screen && "addEventListener" in screen.orientation ? screen.orientation.addEventListener("change", a.current.orientationHandler) : "onorientationchange" in window && window.addEventListener("orientationchange", a.current.orientationHandler));
|
|
1089
1093
|
}
|
|
1090
1094
|
const V = (x) => {
|
|
1091
|
-
!x || x ===
|
|
1095
|
+
!x || x === a.current.element || (b(), a.current.element = x, a.current.scrollContainers = ir(x), E());
|
|
1092
1096
|
};
|
|
1093
|
-
return
|
|
1097
|
+
return Cn(y, !!t), _n(h), ce(() => {
|
|
1094
1098
|
b(), E();
|
|
1095
|
-
}, [t, y, h]),
|
|
1099
|
+
}, [t, y, h]), ce(() => b, []), [V, s, v];
|
|
1096
1100
|
}
|
|
1097
|
-
function
|
|
1098
|
-
|
|
1101
|
+
function _n(e) {
|
|
1102
|
+
ce(() => {
|
|
1099
1103
|
const t = e;
|
|
1100
1104
|
return window.addEventListener("resize", t), () => void window.removeEventListener("resize", t);
|
|
1101
1105
|
}, [e]);
|
|
1102
1106
|
}
|
|
1103
|
-
function
|
|
1104
|
-
|
|
1107
|
+
function Cn(e, t) {
|
|
1108
|
+
ce(() => {
|
|
1105
1109
|
if (t) {
|
|
1106
1110
|
const r = e;
|
|
1107
1111
|
return window.addEventListener("scroll", r, { capture: !0, passive: !0 }), () => void window.removeEventListener("scroll", r, !0);
|
|
1108
1112
|
}
|
|
1109
1113
|
}, [e, t]);
|
|
1110
1114
|
}
|
|
1111
|
-
function
|
|
1115
|
+
function ir(e) {
|
|
1112
1116
|
const t = [];
|
|
1113
1117
|
if (!e || e === document.body)
|
|
1114
1118
|
return t;
|
|
1115
|
-
const { overflow: r, overflowX: n, overflowY:
|
|
1116
|
-
return [r, n,
|
|
1119
|
+
const { overflow: r, overflowX: n, overflowY: i } = window.getComputedStyle(e);
|
|
1120
|
+
return [r, n, i].some((s) => s === "auto" || s === "scroll") && t.push(e), [...t, ...ir(e.parentElement)];
|
|
1117
1121
|
}
|
|
1118
|
-
const
|
|
1122
|
+
const Sn = ["x", "y", "top", "bottom", "left", "right", "width", "height"], Vn = (e, t) => Sn.every((r) => e[r] === t[r]), ke = ({
|
|
1119
1123
|
class: e,
|
|
1120
1124
|
...t
|
|
1121
1125
|
}) => {
|
|
@@ -1144,81 +1148,6 @@ const Vn = ["x", "y", "top", "bottom", "left", "right", "width", "height"], En =
|
|
|
1144
1148
|
})]
|
|
1145
1149
|
})
|
|
1146
1150
|
});
|
|
1147
|
-
}, Fn = 25, ct = lt({
|
|
1148
|
-
instant: () => {
|
|
1149
|
-
},
|
|
1150
|
-
smooth: () => {
|
|
1151
|
-
}
|
|
1152
|
-
}), H = {
|
|
1153
|
-
onSubmitSuccessFn$: lt(() => {
|
|
1154
|
-
}),
|
|
1155
|
-
isBotTyping$: lt(!1),
|
|
1156
|
-
scrollToEnd: {
|
|
1157
|
-
instant: () => ct.value.instant(),
|
|
1158
|
-
smooth: () => ct.value.smooth()
|
|
1159
|
-
}
|
|
1160
|
-
}, In = () => {
|
|
1161
|
-
const e = ae(null);
|
|
1162
|
-
ye(() => {
|
|
1163
|
-
ct.value = {
|
|
1164
|
-
instant: () => {
|
|
1165
|
-
var r;
|
|
1166
|
-
return (r = e.current) == null ? void 0 : r.scrollTo({
|
|
1167
|
-
top: e.current.scrollHeight,
|
|
1168
|
-
behavior: "instant"
|
|
1169
|
-
});
|
|
1170
|
-
},
|
|
1171
|
-
smooth: () => {
|
|
1172
|
-
e.current && e.current.scrollHeight - e.current.scrollTop <= e.current.clientHeight * 2 && e.current.scrollTo({
|
|
1173
|
-
top: e.current.scrollHeight,
|
|
1174
|
-
behavior: "smooth"
|
|
1175
|
-
});
|
|
1176
|
-
}
|
|
1177
|
-
};
|
|
1178
|
-
}, [e]);
|
|
1179
|
-
const t = ft(() => ({
|
|
1180
|
-
addToSubmissions: (n, a) => A.setSubmission(n, a),
|
|
1181
|
-
send: async ({
|
|
1182
|
-
message: n,
|
|
1183
|
-
signal: a,
|
|
1184
|
-
groupId: s
|
|
1185
|
-
}) => {
|
|
1186
|
-
if (await Ge(n).with({
|
|
1187
|
-
author: "bot",
|
|
1188
|
-
type: "text"
|
|
1189
|
-
}, async (o) => {
|
|
1190
|
-
if (a != null && a.aborted)
|
|
1191
|
-
throw new De();
|
|
1192
|
-
H.isBotTyping$.value = !0;
|
|
1193
|
-
const i = Math.min(Math.max(20, o.text.length), 100) * Fn;
|
|
1194
|
-
await new Promise((f) => setTimeout(f, i, {
|
|
1195
|
-
signal: a
|
|
1196
|
-
})), H.isBotTyping$.value = !1;
|
|
1197
|
-
}).otherwise(async () => {
|
|
1198
|
-
}), a != null && a.aborted)
|
|
1199
|
-
throw new De();
|
|
1200
|
-
A.addMessage(n, s);
|
|
1201
|
-
},
|
|
1202
|
-
input: ({
|
|
1203
|
-
input: n,
|
|
1204
|
-
signal: a
|
|
1205
|
-
}) => {
|
|
1206
|
-
if (a != null && a.aborted)
|
|
1207
|
-
throw new De();
|
|
1208
|
-
return A.setInput(n), new Promise((s) => {
|
|
1209
|
-
const o = (i) => {
|
|
1210
|
-
if (a != null && a.aborted)
|
|
1211
|
-
throw new De();
|
|
1212
|
-
A.setInput(void 0), n.key && A.setSubmission(n.key, i), s(i);
|
|
1213
|
-
};
|
|
1214
|
-
H.onSubmitSuccessFn$.value = o;
|
|
1215
|
-
});
|
|
1216
|
-
}
|
|
1217
|
-
}), []);
|
|
1218
|
-
return {
|
|
1219
|
-
chatRef: e,
|
|
1220
|
-
chatService: t
|
|
1221
|
-
};
|
|
1222
1151
|
}, Ie = ({
|
|
1223
1152
|
error: e
|
|
1224
1153
|
}) => !e || !e.message ? null : c("div", {
|
|
@@ -1282,7 +1211,7 @@ const Vn = ["x", "y", "top", "bottom", "left", "right", "width", "height"], En =
|
|
|
1282
1211
|
})]
|
|
1283
1212
|
}), r("skip")]
|
|
1284
1213
|
});
|
|
1285
|
-
},
|
|
1214
|
+
}, ct = {
|
|
1286
1215
|
Afghanistan: "93",
|
|
1287
1216
|
Albania: "355",
|
|
1288
1217
|
Algeria: "213",
|
|
@@ -1530,7 +1459,7 @@ const Vn = ["x", "y", "top", "bottom", "left", "right", "width", "height"], En =
|
|
|
1530
1459
|
Zambia: "260",
|
|
1531
1460
|
Zimbabwe: "263",
|
|
1532
1461
|
"Åland Islands": "358"
|
|
1533
|
-
},
|
|
1462
|
+
}, $e = We("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", {
|
|
1534
1463
|
variants: {
|
|
1535
1464
|
optional: {
|
|
1536
1465
|
true: "pr-16 pl-3",
|
|
@@ -1540,47 +1469,47 @@ const Vn = ["x", "y", "top", "bottom", "left", "right", "width", "height"], En =
|
|
|
1540
1469
|
defaultVariants: {
|
|
1541
1470
|
optional: !1
|
|
1542
1471
|
}
|
|
1543
|
-
}),
|
|
1472
|
+
}), En = "https://api.mapbox.com/search/searchbox/v1/suggest", Fn = "ZzRDWFU0dTZ3SF9aWk9RNGl6QzZaWS5RZmlFak13a0hPbGxXZXlNSGN5RUhObUJ6TXpSV08yUW5OdE5tSTZJU1lpd2lJb1JYYXRObmJ2Tm5iaGhHZWx4V1lpb2pJMUp5ZS5rcA==", In = (e) => atob(e).split("").reverse().join(""), oe = ge({
|
|
1544
1473
|
name: Q()
|
|
1545
|
-
}),
|
|
1546
|
-
suggestions:
|
|
1547
|
-
full_address:
|
|
1548
|
-
place_formatted:
|
|
1549
|
-
name:
|
|
1474
|
+
}), An = ge({
|
|
1475
|
+
suggestions: Tr(ge({
|
|
1476
|
+
full_address: st(Q()),
|
|
1477
|
+
place_formatted: st(Q()),
|
|
1478
|
+
name: st(Q()),
|
|
1550
1479
|
mapbox_id: Q(),
|
|
1551
|
-
context:
|
|
1552
|
-
address:
|
|
1553
|
-
street:
|
|
1554
|
-
neighborhood:
|
|
1555
|
-
locality:
|
|
1556
|
-
district:
|
|
1557
|
-
place:
|
|
1558
|
-
region:
|
|
1559
|
-
postcode:
|
|
1560
|
-
country:
|
|
1480
|
+
context: Dr(ge({
|
|
1481
|
+
address: oe,
|
|
1482
|
+
street: oe,
|
|
1483
|
+
neighborhood: oe,
|
|
1484
|
+
locality: oe,
|
|
1485
|
+
district: oe,
|
|
1486
|
+
place: oe,
|
|
1487
|
+
region: oe,
|
|
1488
|
+
postcode: oe,
|
|
1489
|
+
country: oe
|
|
1561
1490
|
}))
|
|
1562
1491
|
}))
|
|
1563
|
-
}),
|
|
1492
|
+
}), Ln = ({
|
|
1564
1493
|
logger: e,
|
|
1565
1494
|
t
|
|
1566
|
-
}) =>
|
|
1495
|
+
}) => er(() => {
|
|
1567
1496
|
var n;
|
|
1568
|
-
const r = (n =
|
|
1497
|
+
const r = (n = D.current$.peek().flow) == null ? void 0 : n.data.flowSessionId;
|
|
1569
1498
|
return r ? {
|
|
1570
1499
|
enabled: !0,
|
|
1571
|
-
getPredictions: async (
|
|
1500
|
+
getPredictions: async (i) => {
|
|
1572
1501
|
var v;
|
|
1573
|
-
const s = new URL(
|
|
1574
|
-
s.searchParams.set("q",
|
|
1575
|
-
const o = (v =
|
|
1576
|
-
o && o.lat !== void 0 && o.lng !== void 0 && o.lat >= -90 && o.lat <= 90 && o.lng >= -180 && o.lng <= 180 && s.searchParams.set("proximity", `${o.lng},${o.lat}`), s.searchParams.set("access_token",
|
|
1502
|
+
const s = new URL(En);
|
|
1503
|
+
s.searchParams.set("q", i), s.searchParams.set("session_token", r);
|
|
1504
|
+
const o = (v = D.current$.peek().flow) == null ? void 0 : v.locationOrigin;
|
|
1505
|
+
o && o.lat !== void 0 && o.lng !== void 0 && o.lat >= -90 && o.lat <= 90 && o.lng >= -180 && o.lng <= 180 && s.searchParams.set("proximity", `${o.lng},${o.lat}`), s.searchParams.set("access_token", In(Fn));
|
|
1577
1506
|
const f = await fetch(s);
|
|
1578
1507
|
if (!f.ok)
|
|
1579
1508
|
return e.error("Failed to get address details", f), {
|
|
1580
1509
|
ok: !1,
|
|
1581
1510
|
error: t("address_error")
|
|
1582
1511
|
};
|
|
1583
|
-
const p =
|
|
1512
|
+
const p = Nr(An, await f.json());
|
|
1584
1513
|
if (p.success === !1)
|
|
1585
1514
|
return e.error("Failed to parse address details", p.issues), {
|
|
1586
1515
|
ok: !1,
|
|
@@ -1592,7 +1521,7 @@ const Vn = ["x", "y", "top", "bottom", "left", "right", "width", "height"], En =
|
|
|
1592
1521
|
return {
|
|
1593
1522
|
ok: !0,
|
|
1594
1523
|
data: C.map((h) => {
|
|
1595
|
-
var y, b, E, V, x, _, I, O,
|
|
1524
|
+
var y, b, E, V, x, _, I, O, A;
|
|
1596
1525
|
return {
|
|
1597
1526
|
label: h.full_address ?? h.place_formatted ?? h.name ?? h.mapbox_id,
|
|
1598
1527
|
id: h.mapbox_id,
|
|
@@ -1603,7 +1532,7 @@ const Vn = ["x", "y", "top", "bottom", "left", "right", "width", "height"], En =
|
|
|
1603
1532
|
city: ((x = h.context.place) == null ? void 0 : x.name) ?? ((_ = h.context.district) == null ? void 0 : _.name),
|
|
1604
1533
|
state: (I = h.context.region) == null ? void 0 : I.name,
|
|
1605
1534
|
postcode: (O = h.context.postcode) == null ? void 0 : O.name,
|
|
1606
|
-
country: (
|
|
1535
|
+
country: (A = h.context.country) == null ? void 0 : A.name
|
|
1607
1536
|
}
|
|
1608
1537
|
};
|
|
1609
1538
|
})
|
|
@@ -1612,7 +1541,7 @@ const Vn = ["x", "y", "top", "bottom", "left", "right", "width", "height"], En =
|
|
|
1612
1541
|
} : {
|
|
1613
1542
|
enabled: !1
|
|
1614
1543
|
};
|
|
1615
|
-
}, [e, t]),
|
|
1544
|
+
}, [e, t]), It = (e) => {
|
|
1616
1545
|
const {
|
|
1617
1546
|
t
|
|
1618
1547
|
} = Y();
|
|
@@ -1635,31 +1564,31 @@ const Vn = ["x", "y", "top", "bottom", "left", "right", "width", "height"], En =
|
|
|
1635
1564
|
children: t("back")
|
|
1636
1565
|
})]
|
|
1637
1566
|
});
|
|
1638
|
-
},
|
|
1567
|
+
}, Mn = ({
|
|
1639
1568
|
input: e,
|
|
1640
1569
|
onSubmitSuccess: t,
|
|
1641
1570
|
logger: r
|
|
1642
1571
|
}) => {
|
|
1643
1572
|
const {
|
|
1644
1573
|
t: n
|
|
1645
|
-
} = Y(), [
|
|
1574
|
+
} = Y(), [i, s] = se(), [o, a] = se([]), {
|
|
1646
1575
|
enabled: f,
|
|
1647
1576
|
getPredictions: p
|
|
1648
|
-
} =
|
|
1577
|
+
} = Ln({
|
|
1649
1578
|
logger: r,
|
|
1650
1579
|
t: n
|
|
1651
1580
|
}), [C, v] = se(f ? "query" : "manual"), [h, y] = se(""), [b, E] = se(), V = (x) => {
|
|
1652
|
-
me(f, "Query state should not be enabled"), x = x.trim(), x !== (h == null ? void 0 : h.trim()) && (y(x), x === "" &&
|
|
1581
|
+
me(f, "Query state should not be enabled"), x = x.trim(), x !== (h == null ? void 0 : h.trim()) && (y(x), x === "" && a([]), E(void 0), p(x).then((_) => {
|
|
1653
1582
|
if (_.ok === !1) {
|
|
1654
|
-
|
|
1583
|
+
a([]), E(_.error);
|
|
1655
1584
|
return;
|
|
1656
1585
|
}
|
|
1657
|
-
|
|
1586
|
+
a(_.data);
|
|
1658
1587
|
}));
|
|
1659
1588
|
};
|
|
1660
1589
|
switch (C) {
|
|
1661
1590
|
case "query":
|
|
1662
|
-
return me(f, "Query state should not be enabled"), c(
|
|
1591
|
+
return me(f, "Query state should not be enabled"), c(Nn, {
|
|
1663
1592
|
input: e,
|
|
1664
1593
|
onSkip: () => t(null),
|
|
1665
1594
|
onAddressSelect: (x) => {
|
|
@@ -1678,43 +1607,43 @@ const Vn = ["x", "y", "top", "bottom", "left", "right", "width", "height"], En =
|
|
|
1678
1607
|
error: b
|
|
1679
1608
|
});
|
|
1680
1609
|
case "details":
|
|
1681
|
-
return me(
|
|
1610
|
+
return me(i !== void 0), c(Lt, {
|
|
1682
1611
|
input: e,
|
|
1683
1612
|
logger: r,
|
|
1684
1613
|
onSubmitSuccess: t,
|
|
1685
|
-
addressFields:
|
|
1686
|
-
actions: c(
|
|
1614
|
+
addressFields: i,
|
|
1615
|
+
actions: c(It, {
|
|
1687
1616
|
onClick: () => {
|
|
1688
1617
|
v("query");
|
|
1689
1618
|
}
|
|
1690
1619
|
})
|
|
1691
1620
|
});
|
|
1692
1621
|
case "manual":
|
|
1693
|
-
return c(
|
|
1622
|
+
return c(Lt, {
|
|
1694
1623
|
logger: r,
|
|
1695
1624
|
input: e,
|
|
1696
1625
|
onSubmitSuccess: t,
|
|
1697
1626
|
addressFields: {},
|
|
1698
|
-
actions: f ? c(
|
|
1627
|
+
actions: f ? c(It, {
|
|
1699
1628
|
onClick: () => {
|
|
1700
1629
|
v("query");
|
|
1701
1630
|
}
|
|
1702
1631
|
}) : void 0
|
|
1703
1632
|
});
|
|
1704
1633
|
}
|
|
1705
|
-
},
|
|
1634
|
+
}, Nn = ({
|
|
1706
1635
|
input: e,
|
|
1707
1636
|
onSkip: t,
|
|
1708
1637
|
suggestions: r,
|
|
1709
1638
|
onAddressSelect: n,
|
|
1710
|
-
query:
|
|
1639
|
+
query: i,
|
|
1711
1640
|
onAddressSearch: s,
|
|
1712
1641
|
error: o
|
|
1713
1642
|
}) => {
|
|
1714
1643
|
const {
|
|
1715
|
-
t:
|
|
1716
|
-
} = Y(), f =
|
|
1717
|
-
return
|
|
1644
|
+
t: a
|
|
1645
|
+
} = Y(), f = ue(null);
|
|
1646
|
+
return xe(() => {
|
|
1718
1647
|
f.current && (f.current.focus(), f.current.select());
|
|
1719
1648
|
}, []), c(we, {
|
|
1720
1649
|
children: [c("form", {
|
|
@@ -1733,9 +1662,9 @@ const Vn = ["x", "y", "top", "bottom", "left", "right", "width", "height"], En =
|
|
|
1733
1662
|
id: "chat-address",
|
|
1734
1663
|
autocomplete: "address-line1 country-name postal-code",
|
|
1735
1664
|
autoFocus: !0,
|
|
1736
|
-
placeholder: e.config.placeholder ||
|
|
1737
|
-
defaultValue:
|
|
1738
|
-
class:
|
|
1665
|
+
placeholder: e.config.placeholder || a("address_search"),
|
|
1666
|
+
defaultValue: i,
|
|
1667
|
+
class: $e({
|
|
1739
1668
|
optional: !!e.config.optional,
|
|
1740
1669
|
className: "w-full rounded-full"
|
|
1741
1670
|
})
|
|
@@ -1763,7 +1692,7 @@ const Vn = ["x", "y", "top", "bottom", "left", "right", "width", "height"], En =
|
|
|
1763
1692
|
})]
|
|
1764
1693
|
}), c("span", {
|
|
1765
1694
|
class: "sr-only",
|
|
1766
|
-
children:
|
|
1695
|
+
children: a("search")
|
|
1767
1696
|
})]
|
|
1768
1697
|
})
|
|
1769
1698
|
})]
|
|
@@ -1807,32 +1736,32 @@ const Vn = ["x", "y", "top", "bottom", "left", "right", "width", "height"], En =
|
|
|
1807
1736
|
},
|
|
1808
1737
|
children: c("span", {
|
|
1809
1738
|
class: "flex-grow",
|
|
1810
|
-
children:
|
|
1739
|
+
children: a("address_manual")
|
|
1811
1740
|
})
|
|
1812
1741
|
})
|
|
1813
1742
|
}, "")]
|
|
1814
1743
|
})]
|
|
1815
1744
|
});
|
|
1816
|
-
},
|
|
1745
|
+
}, At = ["line1", "line2", "line3", "city", "state", "postcode", "country"], Lt = ({
|
|
1817
1746
|
addressFields: e,
|
|
1818
1747
|
onSubmitSuccess: t,
|
|
1819
1748
|
actions: r,
|
|
1820
1749
|
input: n
|
|
1821
1750
|
}) => {
|
|
1822
|
-
const
|
|
1823
|
-
|
|
1824
|
-
if (
|
|
1825
|
-
const
|
|
1826
|
-
|
|
1751
|
+
const i = ue(null);
|
|
1752
|
+
xe(() => {
|
|
1753
|
+
if (i.current) {
|
|
1754
|
+
const a = i.current.querySelector("input");
|
|
1755
|
+
a && (a.focus(), a.select());
|
|
1827
1756
|
}
|
|
1828
1757
|
}, []);
|
|
1829
|
-
const s = Object.keys(
|
|
1758
|
+
const s = Object.keys(ct), {
|
|
1830
1759
|
t: o
|
|
1831
1760
|
} = Y();
|
|
1832
1761
|
return c("form", {
|
|
1833
1762
|
class: "bg-neutral-1/90 flex flex-col justify-end gap-2 p-2",
|
|
1834
|
-
onSubmit: (
|
|
1835
|
-
const f = new FormData(
|
|
1763
|
+
onSubmit: (a) => {
|
|
1764
|
+
const f = new FormData(a.currentTarget), p = Object.fromEntries(f.entries());
|
|
1836
1765
|
t({
|
|
1837
1766
|
type: "address",
|
|
1838
1767
|
value: p
|
|
@@ -1840,27 +1769,27 @@ const Vn = ["x", "y", "top", "bottom", "left", "right", "width", "height"], En =
|
|
|
1840
1769
|
},
|
|
1841
1770
|
children: [c("div", {
|
|
1842
1771
|
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]",
|
|
1843
|
-
ref:
|
|
1844
|
-
children:
|
|
1845
|
-
const p = `isdk_${
|
|
1772
|
+
ref: i,
|
|
1773
|
+
children: At.map((a, f) => {
|
|
1774
|
+
const p = `isdk_${a}`, C = n.config.keys[a];
|
|
1846
1775
|
return C ? c(we, {
|
|
1847
1776
|
children: [c("label", {
|
|
1848
1777
|
for: p,
|
|
1849
1778
|
class: "text-neutral-9 [&:has(+*>input:focus)]:text-neutral-11 w-24 pb-2 text-xs uppercase leading-3 tracking-widest transition-colors",
|
|
1850
|
-
children: o(
|
|
1779
|
+
children: o(a)
|
|
1851
1780
|
}), c("div", {
|
|
1852
1781
|
class: "flex flex-col items-stretch gap-1.5",
|
|
1853
|
-
children: [
|
|
1782
|
+
children: [a === "country" ? c("div", {
|
|
1854
1783
|
class: "relative",
|
|
1855
1784
|
children: [c("select", {
|
|
1856
1785
|
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",
|
|
1857
1786
|
name: C,
|
|
1858
1787
|
id: p,
|
|
1859
|
-
defaultValue: e[
|
|
1788
|
+
defaultValue: e[a],
|
|
1860
1789
|
required: !0,
|
|
1861
1790
|
children: [e.country && !s.includes(e.country) ? c("option", {
|
|
1862
|
-
value: e[
|
|
1863
|
-
children: e[
|
|
1791
|
+
value: e[a],
|
|
1792
|
+
children: e[a]
|
|
1864
1793
|
}) : c("option", {
|
|
1865
1794
|
value: "",
|
|
1866
1795
|
children: o("select_country")
|
|
@@ -1888,9 +1817,9 @@ const Vn = ["x", "y", "top", "bottom", "left", "right", "width", "height"], En =
|
|
|
1888
1817
|
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",
|
|
1889
1818
|
name: C,
|
|
1890
1819
|
id: p,
|
|
1891
|
-
defaultValue: e[
|
|
1820
|
+
defaultValue: e[a],
|
|
1892
1821
|
required: !0
|
|
1893
|
-
}), f ===
|
|
1822
|
+
}), f === At.length - 1 ? c("hr", {
|
|
1894
1823
|
class: "m-0 w-full border-b border-b-transparent"
|
|
1895
1824
|
}) : c("hr", {
|
|
1896
1825
|
class: "border-b-neutral-5 m-0 w-full border-b border-solid"
|
|
@@ -1908,13 +1837,13 @@ const Vn = ["x", "y", "top", "bottom", "left", "right", "width", "height"], En =
|
|
|
1908
1837
|
})]
|
|
1909
1838
|
})]
|
|
1910
1839
|
});
|
|
1911
|
-
},
|
|
1912
|
-
const e =
|
|
1913
|
-
return
|
|
1840
|
+
}, ut = () => {
|
|
1841
|
+
const e = ue(null);
|
|
1842
|
+
return ce(() => {
|
|
1914
1843
|
var t;
|
|
1915
1844
|
(t = e.current) == null || t.focus();
|
|
1916
1845
|
}, []), e;
|
|
1917
|
-
},
|
|
1846
|
+
}, or = ["true", "false"], Tn = Br(or), Dn = "answer", lr = "flex items-center flex-wrap gap-2 p-2.5", cr = "min-w-0 max-w-full flex-auto", ur = tr(({
|
|
1918
1847
|
label: e,
|
|
1919
1848
|
...t
|
|
1920
1849
|
}, r) => c("button", {
|
|
@@ -1925,30 +1854,30 @@ const Vn = ["x", "y", "top", "bottom", "left", "right", "width", "height"], En =
|
|
|
1925
1854
|
class: "text-center text-base",
|
|
1926
1855
|
children: e
|
|
1927
1856
|
})
|
|
1928
|
-
})),
|
|
1857
|
+
})), Rn = ({
|
|
1929
1858
|
input: e,
|
|
1930
1859
|
onSubmitSuccess: t
|
|
1931
1860
|
}) => {
|
|
1932
|
-
const r =
|
|
1861
|
+
const r = ut();
|
|
1933
1862
|
return c("form", {
|
|
1934
1863
|
noValidate: !0,
|
|
1935
1864
|
class: "",
|
|
1936
1865
|
onSubmit: (n) => {
|
|
1937
1866
|
n.preventDefault();
|
|
1938
|
-
const
|
|
1867
|
+
const i = Rr(n).value, s = Or(Tn, i);
|
|
1939
1868
|
t({
|
|
1940
1869
|
type: "boolean",
|
|
1941
1870
|
value: s === "true"
|
|
1942
1871
|
});
|
|
1943
1872
|
},
|
|
1944
1873
|
children: [c("ul", {
|
|
1945
|
-
class:
|
|
1946
|
-
children:
|
|
1947
|
-
class:
|
|
1948
|
-
children: c(
|
|
1949
|
-
ref:
|
|
1874
|
+
class: lr,
|
|
1875
|
+
children: or.map((n, i) => c("li", {
|
|
1876
|
+
class: cr,
|
|
1877
|
+
children: c(ur, {
|
|
1878
|
+
ref: i === 0 ? r : null,
|
|
1950
1879
|
type: "submit",
|
|
1951
|
-
name:
|
|
1880
|
+
name: Dn,
|
|
1952
1881
|
value: n,
|
|
1953
1882
|
label: e.config.labels[n]
|
|
1954
1883
|
}, n)
|
|
@@ -1962,15 +1891,15 @@ const Vn = ["x", "y", "top", "bottom", "left", "right", "width", "height"], En =
|
|
|
1962
1891
|
})
|
|
1963
1892
|
})]
|
|
1964
1893
|
});
|
|
1965
|
-
},
|
|
1894
|
+
}, On = (e) => new Promise((t, r) => {
|
|
1966
1895
|
const n = new FileReader();
|
|
1967
1896
|
n.readAsDataURL(e), n.onload = () => n.result ? t(n.result.toString()) : r("No result from reader"), n.onerror = r;
|
|
1968
|
-
}),
|
|
1897
|
+
}), Bn = (e) => e.reduce((t, r) => t + r.sizeKb, 0), Pn = Fe("file"), Mt = 3, jn = ({
|
|
1969
1898
|
file: e,
|
|
1970
1899
|
class: t,
|
|
1971
1900
|
...r
|
|
1972
1901
|
}) => {
|
|
1973
|
-
const n = e.name.split(".").pop(),
|
|
1902
|
+
const n = e.name.split(".").pop(), i = e.name.replace(new RegExp(`.${n}$`), "");
|
|
1974
1903
|
return c("div", {
|
|
1975
1904
|
class: je("bg-accent-1 outline-accent-4 flex max-w-full gap-2 overflow-hidden rounded-lg px-3 py-2 text-sm outline", t),
|
|
1976
1905
|
...r,
|
|
@@ -1979,42 +1908,42 @@ const Vn = ["x", "y", "top", "bottom", "left", "right", "width", "height"], En =
|
|
|
1979
1908
|
class: "text-accent-12 flex flex-grow overflow-hidden",
|
|
1980
1909
|
children: [c("span", {
|
|
1981
1910
|
class: "block truncate",
|
|
1982
|
-
children:
|
|
1911
|
+
children: i
|
|
1983
1912
|
}), c("span", {
|
|
1984
1913
|
children: [".", n]
|
|
1985
1914
|
})]
|
|
1986
1915
|
}), c("p", {
|
|
1987
1916
|
"aria-label": "File size",
|
|
1988
1917
|
class: "text-accent-11",
|
|
1989
|
-
children:
|
|
1918
|
+
children: Re(e.sizeKb)
|
|
1990
1919
|
})]
|
|
1991
1920
|
});
|
|
1992
|
-
},
|
|
1921
|
+
}, Nt = ({
|
|
1993
1922
|
class: e,
|
|
1994
1923
|
...t
|
|
1995
1924
|
}) => c("li", {
|
|
1996
1925
|
class: je("outline-neutral-6 text-neutral-11 bg-neutral-1 block rounded-md px-1 py-0.5 text-xs outline outline-1", e),
|
|
1997
1926
|
...t
|
|
1998
|
-
}),
|
|
1927
|
+
}), dr = (e) => {
|
|
1999
1928
|
const t = e.split(".").pop();
|
|
2000
1929
|
if (!t)
|
|
2001
1930
|
throw new Error("No file extension found");
|
|
2002
1931
|
return t ? "." + t : "";
|
|
2003
|
-
},
|
|
1932
|
+
}, $n = ({
|
|
2004
1933
|
allowedExtensions: e,
|
|
2005
1934
|
files: t
|
|
2006
1935
|
}) => {
|
|
2007
1936
|
const r = e.map((n) => n.toLowerCase());
|
|
2008
|
-
return t.every((n) => r.includes(
|
|
2009
|
-
},
|
|
2010
|
-
const r =
|
|
1937
|
+
return t.every((n) => r.includes(dr(n.name).toLowerCase()));
|
|
1938
|
+
}, Un = (e, t) => {
|
|
1939
|
+
const r = dr(e);
|
|
2011
1940
|
return `${e.replace(new RegExp(`${r}$`), "").slice(0, t)}${r}`;
|
|
2012
|
-
},
|
|
1941
|
+
}, zn = ({
|
|
2013
1942
|
input: e,
|
|
2014
1943
|
onSubmitSuccess: t
|
|
2015
1944
|
}) => {
|
|
2016
1945
|
var v;
|
|
2017
|
-
const r = (v =
|
|
1946
|
+
const r = (v = D.current$.value.flow) == null ? void 0 : v.data.submissions[e.key], [n, i] = se(Pn(r) ? r.value : []), [s, o] = se(), a = n.length - Mt, f = Bn(n), p = ut(), {
|
|
2018
1947
|
t: C
|
|
2019
1948
|
} = Y();
|
|
2020
1949
|
return c("form", {
|
|
@@ -2022,7 +1951,7 @@ const Vn = ["x", "y", "top", "bottom", "left", "right", "width", "height"], En =
|
|
|
2022
1951
|
onSubmit: (h) => (h.preventDefault(), o(void 0), n.length === 0 ? o({
|
|
2023
1952
|
type: "required",
|
|
2024
1953
|
message: C("validation_file")
|
|
2025
|
-
}) : e.config.extensions.length > 0 &&
|
|
1954
|
+
}) : e.config.extensions.length > 0 && !$n({
|
|
2026
1955
|
allowedExtensions: e.config.extensions,
|
|
2027
1956
|
files: n
|
|
2028
1957
|
}) ? o({
|
|
@@ -2032,7 +1961,7 @@ const Vn = ["x", "y", "top", "bottom", "left", "right", "width", "height"], En =
|
|
|
2032
1961
|
})}`
|
|
2033
1962
|
}) : e.config.fileSizeLimitKib && f > e.config.fileSizeLimitKib ? o({
|
|
2034
1963
|
type: "max",
|
|
2035
|
-
message: `File size exceeds limit of ${
|
|
1964
|
+
message: `File size exceeds limit of ${Re(e.config.fileSizeLimitKib)}`
|
|
2036
1965
|
}) : e.config.allowMultiple === !1 && n.length > 1 ? o({
|
|
2037
1966
|
type: "invalid",
|
|
2038
1967
|
message: C("validation_file_max", {
|
|
@@ -2051,9 +1980,9 @@ const Vn = ["x", "y", "top", "bottom", "left", "right", "width", "height"], En =
|
|
|
2051
1980
|
children: [n.length > 0 ? c(we, {
|
|
2052
1981
|
children: [c("ul", {
|
|
2053
1982
|
class: "flex max-w-full flex-wrap justify-center gap-1 overflow-hidden p-1",
|
|
2054
|
-
children: [n.slice(0,
|
|
1983
|
+
children: [n.slice(0, Mt).map((h) => {
|
|
2055
1984
|
const y = h.name.split(".").pop(), b = h.name.replace(new RegExp(`.${y}$`), "");
|
|
2056
|
-
return c(
|
|
1985
|
+
return c(Nt, {
|
|
2057
1986
|
class: "flex overflow-hidden",
|
|
2058
1987
|
children: [c("span", {
|
|
2059
1988
|
class: "block truncate",
|
|
@@ -2062,12 +1991,12 @@ const Vn = ["x", "y", "top", "bottom", "left", "right", "width", "height"], En =
|
|
|
2062
1991
|
children: [".", y]
|
|
2063
1992
|
})]
|
|
2064
1993
|
});
|
|
2065
|
-
}),
|
|
2066
|
-
children: ["+",
|
|
1994
|
+
}), a > 0 ? c(Nt, {
|
|
1995
|
+
children: ["+", a, " file", a !== 1 ? "s" : ""]
|
|
2067
1996
|
}) : null]
|
|
2068
1997
|
}), c("p", {
|
|
2069
1998
|
class: "text-neutral-11 text-xs",
|
|
2070
|
-
children: [
|
|
1999
|
+
children: [Re(f), " ", n.length > 1 ? "total" : ""]
|
|
2071
2000
|
})]
|
|
2072
2001
|
}) : c("div", {
|
|
2073
2002
|
class: "flex flex-col justify-center gap-4 pb-6 pt-5",
|
|
@@ -2094,7 +2023,7 @@ const Vn = ["x", "y", "top", "bottom", "left", "right", "width", "height"], En =
|
|
|
2094
2023
|
}), e.config.fileSizeLimitKib ? c("p", {
|
|
2095
2024
|
class: "text-neutral-10 text-xs",
|
|
2096
2025
|
children: ["(", C("file_max_size", {
|
|
2097
|
-
size:
|
|
2026
|
+
size: Re(e.config.fileSizeLimitKib)
|
|
2098
2027
|
}), ")"]
|
|
2099
2028
|
}) : null]
|
|
2100
2029
|
}), c("aside", {
|
|
@@ -2117,9 +2046,9 @@ const Vn = ["x", "y", "top", "bottom", "left", "right", "width", "height"], En =
|
|
|
2117
2046
|
onInput: async (h) => {
|
|
2118
2047
|
me(h.target instanceof HTMLInputElement);
|
|
2119
2048
|
const y = h.target.files ? Array.from(h.target.files) : [], b = await Promise.allSettled(y.map(async (V) => {
|
|
2120
|
-
const x = await
|
|
2049
|
+
const x = await On(V);
|
|
2121
2050
|
return {
|
|
2122
|
-
name:
|
|
2051
|
+
name: Un(V.name, 42),
|
|
2123
2052
|
data: x,
|
|
2124
2053
|
sizeKb: V.size / 1e3
|
|
2125
2054
|
};
|
|
@@ -2132,7 +2061,7 @@ const Vn = ["x", "y", "top", "bottom", "left", "right", "width", "height"], En =
|
|
|
2132
2061
|
message: "Invalid file"
|
|
2133
2062
|
});
|
|
2134
2063
|
const E = b.map((V) => V.status === "fulfilled" ? V.value : null).filter(Boolean);
|
|
2135
|
-
|
|
2064
|
+
i(E);
|
|
2136
2065
|
},
|
|
2137
2066
|
multiple: e.config.allowMultiple,
|
|
2138
2067
|
type: "file",
|
|
@@ -2152,47 +2081,47 @@ const Vn = ["x", "y", "top", "bottom", "left", "right", "width", "height"], En =
|
|
|
2152
2081
|
})]
|
|
2153
2082
|
});
|
|
2154
2083
|
};
|
|
2155
|
-
var
|
|
2156
|
-
const
|
|
2157
|
-
var
|
|
2084
|
+
var Ue = (e) => e.type === "checkbox", ve = (e) => e instanceof Date, W = (e) => e == null;
|
|
2085
|
+
const fr = (e) => typeof e == "object";
|
|
2086
|
+
var j = (e) => !W(e) && !Array.isArray(e) && fr(e) && !ve(e), qn = (e) => j(e) && e.target ? Ue(e.target) ? e.target.checked : e.target.value : e, Hn = (e) => e.substring(0, e.search(/\.\d+(\.|$)/)) || e, Kn = (e, t) => e.has(Hn(t)), Gn = (e) => {
|
|
2158
2087
|
const t = e.constructor && e.constructor.prototype;
|
|
2159
|
-
return
|
|
2160
|
-
},
|
|
2088
|
+
return j(t) && t.hasOwnProperty("isPrototypeOf");
|
|
2089
|
+
}, dt = typeof window < "u" && typeof window.HTMLElement < "u" && typeof document < "u";
|
|
2161
2090
|
function U(e) {
|
|
2162
2091
|
if (e instanceof Date)
|
|
2163
2092
|
return new Date(e);
|
|
2164
2093
|
const t = typeof FileList < "u" && e instanceof FileList;
|
|
2165
|
-
if (
|
|
2094
|
+
if (dt && (e instanceof Blob || t))
|
|
2166
2095
|
return e;
|
|
2167
2096
|
const r = Array.isArray(e);
|
|
2168
|
-
if (!r && !(
|
|
2097
|
+
if (!r && !(j(e) && Gn(e)))
|
|
2169
2098
|
return e;
|
|
2170
2099
|
const n = r ? [] : Object.create(Object.getPrototypeOf(e));
|
|
2171
|
-
for (const
|
|
2172
|
-
Object.prototype.hasOwnProperty.call(e,
|
|
2100
|
+
for (const i in e)
|
|
2101
|
+
Object.prototype.hasOwnProperty.call(e, i) && (n[i] = U(e[i]));
|
|
2173
2102
|
return n;
|
|
2174
2103
|
}
|
|
2175
|
-
var
|
|
2176
|
-
if (!t ||
|
|
2104
|
+
var Xe = (e) => /^\w*$/.test(e), B = (e) => e === void 0, ft = (e) => Array.isArray(e) ? e.filter(Boolean) : [], ht = (e) => ft(e.replace(/["|']|\]/g, "").split(/\.|\[/)), k = (e, t, r) => {
|
|
2105
|
+
if (!t || !j(e))
|
|
2177
2106
|
return r;
|
|
2178
|
-
const n = (
|
|
2107
|
+
const n = (Xe(t) ? [t] : ht(t)).reduce((i, s) => W(i) ? i : i[s], e);
|
|
2179
2108
|
return B(n) || n === e ? B(e[t]) ? r : e[t] : n;
|
|
2180
|
-
}, ne = (e) => typeof e == "boolean", te = (e) => typeof e == "function",
|
|
2109
|
+
}, ne = (e) => typeof e == "boolean", te = (e) => typeof e == "function", T = (e, t, r) => {
|
|
2181
2110
|
let n = -1;
|
|
2182
|
-
const
|
|
2111
|
+
const i = Xe(t) ? [t] : ht(t), s = i.length, o = s - 1;
|
|
2183
2112
|
for (; ++n < s; ) {
|
|
2184
|
-
const
|
|
2113
|
+
const a = i[n];
|
|
2185
2114
|
let f = r;
|
|
2186
2115
|
if (n !== o) {
|
|
2187
|
-
const p = e[
|
|
2188
|
-
f =
|
|
2116
|
+
const p = e[a];
|
|
2117
|
+
f = j(p) || Array.isArray(p) ? p : isNaN(+i[n + 1]) ? {} : [];
|
|
2189
2118
|
}
|
|
2190
|
-
if (
|
|
2119
|
+
if (a === "__proto__" || a === "constructor" || a === "prototype")
|
|
2191
2120
|
return;
|
|
2192
|
-
e[
|
|
2121
|
+
e[a] = f, e = e[a];
|
|
2193
2122
|
}
|
|
2194
2123
|
};
|
|
2195
|
-
const
|
|
2124
|
+
const Tt = {
|
|
2196
2125
|
BLUR: "blur",
|
|
2197
2126
|
FOCUS_OUT: "focusout",
|
|
2198
2127
|
CHANGE: "change"
|
|
@@ -2202,7 +2131,7 @@ const Bt = {
|
|
|
2202
2131
|
onSubmit: "onSubmit",
|
|
2203
2132
|
onTouched: "onTouched",
|
|
2204
2133
|
all: "all"
|
|
2205
|
-
},
|
|
2134
|
+
}, le = {
|
|
2206
2135
|
max: "max",
|
|
2207
2136
|
min: "min",
|
|
2208
2137
|
maxLength: "maxLength",
|
|
@@ -2210,67 +2139,67 @@ const Bt = {
|
|
|
2210
2139
|
pattern: "pattern",
|
|
2211
2140
|
required: "required",
|
|
2212
2141
|
validate: "validate"
|
|
2213
|
-
},
|
|
2214
|
-
|
|
2215
|
-
var
|
|
2216
|
-
const
|
|
2142
|
+
}, Wn = K.createContext(null);
|
|
2143
|
+
Wn.displayName = "HookFormControlContext";
|
|
2144
|
+
var Jn = (e, t, r, n = !0) => {
|
|
2145
|
+
const i = {
|
|
2217
2146
|
defaultValues: t._defaultValues
|
|
2218
2147
|
};
|
|
2219
2148
|
for (const s in e)
|
|
2220
|
-
Object.defineProperty(
|
|
2149
|
+
Object.defineProperty(i, s, {
|
|
2221
2150
|
get: () => {
|
|
2222
2151
|
const o = s;
|
|
2223
2152
|
return t._proxyFormState[o] !== re.all && (t._proxyFormState[o] = !n || re.all), r && (r[o] = !0), e[o];
|
|
2224
2153
|
}
|
|
2225
2154
|
});
|
|
2226
|
-
return
|
|
2155
|
+
return i;
|
|
2227
2156
|
};
|
|
2228
|
-
const
|
|
2229
|
-
var Z = (e) => typeof e == "string",
|
|
2157
|
+
const Xn = typeof window < "u" ? K.useLayoutEffect : K.useEffect;
|
|
2158
|
+
var Z = (e) => typeof e == "string", Zn = (e, t, r, n, i) => Z(e) ? (n && t.watch.add(e), k(r, e, i)) : Array.isArray(e) ? e.map((s) => (n && t.watch.add(s), k(r, s))) : (n && (t.watchAll = !0), r), ot = (e) => W(e) || !fr(e);
|
|
2230
2159
|
function he(e, t, r = /* @__PURE__ */ new WeakSet()) {
|
|
2231
|
-
if (
|
|
2160
|
+
if (ot(e) || ot(t))
|
|
2232
2161
|
return Object.is(e, t);
|
|
2233
|
-
if (
|
|
2162
|
+
if (ve(e) && ve(t))
|
|
2234
2163
|
return Object.is(e.getTime(), t.getTime());
|
|
2235
|
-
const n = Object.keys(e),
|
|
2236
|
-
if (n.length !==
|
|
2164
|
+
const n = Object.keys(e), i = Object.keys(t);
|
|
2165
|
+
if (n.length !== i.length)
|
|
2237
2166
|
return !1;
|
|
2238
2167
|
if (r.has(e) || r.has(t))
|
|
2239
2168
|
return !0;
|
|
2240
2169
|
r.add(e), r.add(t);
|
|
2241
2170
|
for (const s of n) {
|
|
2242
2171
|
const o = e[s];
|
|
2243
|
-
if (!
|
|
2172
|
+
if (!i.includes(s))
|
|
2244
2173
|
return !1;
|
|
2245
2174
|
if (s !== "ref") {
|
|
2246
|
-
const
|
|
2247
|
-
if (
|
|
2175
|
+
const a = t[s];
|
|
2176
|
+
if (ve(o) && ve(a) || j(o) && j(a) || Array.isArray(o) && Array.isArray(a) ? !he(o, a, r) : !Object.is(o, a))
|
|
2248
2177
|
return !1;
|
|
2249
2178
|
}
|
|
2250
2179
|
}
|
|
2251
2180
|
return !0;
|
|
2252
2181
|
}
|
|
2253
|
-
const
|
|
2254
|
-
|
|
2255
|
-
var
|
|
2182
|
+
const Yn = K.createContext(null);
|
|
2183
|
+
Yn.displayName = "HookFormContext";
|
|
2184
|
+
var hr = (e, t, r, n, i) => t ? {
|
|
2256
2185
|
...r[e],
|
|
2257
2186
|
types: {
|
|
2258
2187
|
...r[e] && r[e].types ? r[e].types : {},
|
|
2259
|
-
[n]:
|
|
2188
|
+
[n]: i || !0
|
|
2260
2189
|
}
|
|
2261
|
-
} : {},
|
|
2190
|
+
} : {}, Be = (e) => Array.isArray(e) ? e : [e], Dt = () => {
|
|
2262
2191
|
let e = [];
|
|
2263
2192
|
return {
|
|
2264
2193
|
get observers() {
|
|
2265
2194
|
return e;
|
|
2266
2195
|
},
|
|
2267
|
-
next: (
|
|
2196
|
+
next: (i) => {
|
|
2268
2197
|
for (const s of e)
|
|
2269
|
-
s.next && s.next(
|
|
2198
|
+
s.next && s.next(i);
|
|
2270
2199
|
},
|
|
2271
|
-
subscribe: (
|
|
2200
|
+
subscribe: (i) => (e.push(i), {
|
|
2272
2201
|
unsubscribe: () => {
|
|
2273
|
-
e = e.filter((s) => s !==
|
|
2202
|
+
e = e.filter((s) => s !== i);
|
|
2274
2203
|
}
|
|
2275
2204
|
}),
|
|
2276
2205
|
unsubscribe: () => {
|
|
@@ -2278,76 +2207,76 @@ var gr = (e, t, r, n, a) => t ? {
|
|
|
2278
2207
|
}
|
|
2279
2208
|
};
|
|
2280
2209
|
};
|
|
2281
|
-
function
|
|
2210
|
+
function pr(e, t) {
|
|
2282
2211
|
const r = {};
|
|
2283
2212
|
for (const n in e)
|
|
2284
2213
|
if (e.hasOwnProperty(n)) {
|
|
2285
|
-
const
|
|
2286
|
-
if (
|
|
2287
|
-
const o =
|
|
2288
|
-
|
|
2214
|
+
const i = e[n], s = t[n];
|
|
2215
|
+
if (i && j(i) && s) {
|
|
2216
|
+
const o = pr(i, s);
|
|
2217
|
+
j(o) && (r[n] = o);
|
|
2289
2218
|
} else
|
|
2290
2219
|
e[n] && (r[n] = s);
|
|
2291
2220
|
}
|
|
2292
2221
|
return r;
|
|
2293
2222
|
}
|
|
2294
|
-
var
|
|
2295
|
-
if (!
|
|
2223
|
+
var G = (e) => j(e) && !Object.keys(e).length, pt = (e) => e.type === "file", Ke = (e) => {
|
|
2224
|
+
if (!dt)
|
|
2296
2225
|
return !1;
|
|
2297
2226
|
const t = e ? e.ownerDocument : 0;
|
|
2298
2227
|
return e instanceof (t && t.defaultView ? t.defaultView.HTMLElement : HTMLElement);
|
|
2299
|
-
},
|
|
2300
|
-
function
|
|
2228
|
+
}, mr = (e) => e.type === "select-multiple", mt = (e) => e.type === "radio", Qn = (e) => mt(e) || Ue(e), at = (e) => Ke(e) && e.isConnected;
|
|
2229
|
+
function es(e, t) {
|
|
2301
2230
|
const r = t.slice(0, -1).length;
|
|
2302
2231
|
let n = 0;
|
|
2303
2232
|
for (; n < r; )
|
|
2304
2233
|
e = B(e) ? n++ : e[t[n++]];
|
|
2305
2234
|
return e;
|
|
2306
2235
|
}
|
|
2307
|
-
function
|
|
2236
|
+
function ts(e) {
|
|
2308
2237
|
for (const t in e)
|
|
2309
2238
|
if (e.hasOwnProperty(t) && !B(e[t]))
|
|
2310
2239
|
return !1;
|
|
2311
2240
|
return !0;
|
|
2312
2241
|
}
|
|
2313
2242
|
function P(e, t) {
|
|
2314
|
-
const r = Array.isArray(t) ? t :
|
|
2315
|
-
return n && delete n[s],
|
|
2243
|
+
const r = Array.isArray(t) ? t : Xe(t) ? [t] : ht(t), n = r.length === 1 ? e : es(e, r), i = r.length - 1, s = r[i];
|
|
2244
|
+
return n && delete n[s], i !== 0 && (j(n) && G(n) || Array.isArray(n) && ts(n)) && P(e, r.slice(0, -1)), e;
|
|
2316
2245
|
}
|
|
2317
|
-
var
|
|
2246
|
+
var rs = (e) => {
|
|
2318
2247
|
for (const t in e)
|
|
2319
2248
|
if (te(e[t]))
|
|
2320
2249
|
return !0;
|
|
2321
2250
|
return !1;
|
|
2322
2251
|
};
|
|
2323
|
-
function
|
|
2324
|
-
return Array.isArray(e) ||
|
|
2252
|
+
function gr(e) {
|
|
2253
|
+
return Array.isArray(e) || j(e) && !rs(e);
|
|
2325
2254
|
}
|
|
2326
|
-
function
|
|
2255
|
+
function lt(e, t = {}) {
|
|
2327
2256
|
for (const r in e) {
|
|
2328
2257
|
const n = e[r];
|
|
2329
|
-
|
|
2258
|
+
gr(n) ? (t[r] = Array.isArray(n) ? [] : {}, lt(n, t[r])) : B(n) || (t[r] = !0);
|
|
2330
2259
|
}
|
|
2331
2260
|
return t;
|
|
2332
2261
|
}
|
|
2333
2262
|
function Ee(e, t, r) {
|
|
2334
|
-
r || (r =
|
|
2263
|
+
r || (r = lt(t));
|
|
2335
2264
|
for (const n in e) {
|
|
2336
|
-
const
|
|
2337
|
-
if (
|
|
2338
|
-
B(t) ||
|
|
2265
|
+
const i = e[n];
|
|
2266
|
+
if (gr(i))
|
|
2267
|
+
B(t) || ot(r[n]) ? r[n] = lt(i, Array.isArray(i) ? [] : {}) : Ee(i, W(t) ? {} : t[n], r[n]);
|
|
2339
2268
|
else {
|
|
2340
2269
|
const s = t[n];
|
|
2341
|
-
r[n] = !he(
|
|
2270
|
+
r[n] = !he(i, s);
|
|
2342
2271
|
}
|
|
2343
2272
|
}
|
|
2344
2273
|
return r;
|
|
2345
2274
|
}
|
|
2346
|
-
const
|
|
2275
|
+
const Rt = {
|
|
2347
2276
|
value: !1,
|
|
2348
2277
|
isValid: !1
|
|
2349
|
-
},
|
|
2350
|
-
var
|
|
2278
|
+
}, Ot = { value: !0, isValid: !0 };
|
|
2279
|
+
var yr = (e) => {
|
|
2351
2280
|
if (Array.isArray(e)) {
|
|
2352
2281
|
if (e.length > 1) {
|
|
2353
2282
|
const t = e.filter((r) => r && r.checked && !r.disabled).map((r) => r.value);
|
|
@@ -2355,98 +2284,98 @@ var xr = (e) => {
|
|
|
2355
2284
|
}
|
|
2356
2285
|
return e[0].checked && !e[0].disabled ? (
|
|
2357
2286
|
// @ts-expect-error expected to work in the browser
|
|
2358
|
-
e[0].attributes && !B(e[0].attributes.value) ? B(e[0].value) || e[0].value === "" ?
|
|
2359
|
-
) :
|
|
2287
|
+
e[0].attributes && !B(e[0].attributes.value) ? B(e[0].value) || e[0].value === "" ? Ot : { value: e[0].value, isValid: !0 } : Ot
|
|
2288
|
+
) : Rt;
|
|
2360
2289
|
}
|
|
2361
|
-
return
|
|
2362
|
-
},
|
|
2363
|
-
const
|
|
2290
|
+
return Rt;
|
|
2291
|
+
}, br = (e, { valueAsNumber: t, valueAsDate: r, setValueAs: n }) => B(e) ? e : t ? e === "" ? NaN : e && +e : r && Z(e) ? new Date(e) : n ? n(e) : e;
|
|
2292
|
+
const Bt = {
|
|
2364
2293
|
isValid: !1,
|
|
2365
2294
|
value: null
|
|
2366
2295
|
};
|
|
2367
|
-
var
|
|
2296
|
+
var vr = (e) => Array.isArray(e) ? e.reduce((t, r) => r && r.checked && !r.disabled ? {
|
|
2368
2297
|
isValid: !0,
|
|
2369
2298
|
value: r.value
|
|
2370
|
-
} : t,
|
|
2371
|
-
function
|
|
2299
|
+
} : t, Bt) : Bt;
|
|
2300
|
+
function Pt(e) {
|
|
2372
2301
|
const t = e.ref;
|
|
2373
|
-
return
|
|
2302
|
+
return pt(t) ? t.files : mt(t) ? vr(e.refs).value : mr(t) ? [...t.selectedOptions].map(({ value: r }) => r) : Ue(t) ? yr(e.refs).value : br(B(t.value) ? e.ref.value : t.value, e);
|
|
2374
2303
|
}
|
|
2375
|
-
var
|
|
2376
|
-
const
|
|
2304
|
+
var ns = (e, t, r, n) => {
|
|
2305
|
+
const i = {};
|
|
2377
2306
|
for (const s of e) {
|
|
2378
2307
|
const o = k(t, s);
|
|
2379
|
-
o &&
|
|
2308
|
+
o && T(i, s, o._f);
|
|
2380
2309
|
}
|
|
2381
2310
|
return {
|
|
2382
2311
|
criteriaMode: r,
|
|
2383
2312
|
names: [...e],
|
|
2384
|
-
fields:
|
|
2313
|
+
fields: i,
|
|
2385
2314
|
shouldUseNativeValidation: n
|
|
2386
2315
|
};
|
|
2387
|
-
},
|
|
2316
|
+
}, Ge = (e) => e instanceof RegExp, Ne = (e) => B(e) ? e : Ge(e) ? e.source : j(e) ? Ge(e.value) ? e.value.source : e.value : e, jt = (e) => ({
|
|
2388
2317
|
isOnSubmit: !e || e === re.onSubmit,
|
|
2389
2318
|
isOnBlur: e === re.onBlur,
|
|
2390
2319
|
isOnChange: e === re.onChange,
|
|
2391
2320
|
isOnAll: e === re.all,
|
|
2392
2321
|
isOnTouch: e === re.onTouched
|
|
2393
2322
|
});
|
|
2394
|
-
const
|
|
2395
|
-
var
|
|
2396
|
-
const
|
|
2397
|
-
for (const
|
|
2398
|
-
const s = k(e,
|
|
2323
|
+
const $t = "AsyncFunction";
|
|
2324
|
+
var ss = (e) => !!e && !!e.validate && !!(te(e.validate) && e.validate.constructor.name === $t || j(e.validate) && Object.values(e.validate).find((t) => t.constructor.name === $t)), as = (e) => e.mount && (e.required || e.min || e.max || e.maxLength || e.minLength || e.pattern || e.validate), Ut = (e, t, r) => !r && (t.watchAll || t.watch.has(e) || [...t.watch].some((n) => e.startsWith(n) && /^\.\w+/.test(e.slice(n.length))));
|
|
2325
|
+
const Pe = (e, t, r, n) => {
|
|
2326
|
+
for (const i of r || Object.keys(e)) {
|
|
2327
|
+
const s = k(e, i);
|
|
2399
2328
|
if (s) {
|
|
2400
|
-
const { _f: o, ...
|
|
2329
|
+
const { _f: o, ...a } = s;
|
|
2401
2330
|
if (o) {
|
|
2402
|
-
if (o.refs && o.refs[0] && t(o.refs[0],
|
|
2331
|
+
if (o.refs && o.refs[0] && t(o.refs[0], i) && !n)
|
|
2403
2332
|
return !0;
|
|
2404
2333
|
if (o.ref && t(o.ref, o.name) && !n)
|
|
2405
2334
|
return !0;
|
|
2406
|
-
if (
|
|
2335
|
+
if (Pe(a, t))
|
|
2407
2336
|
break;
|
|
2408
|
-
} else if (
|
|
2337
|
+
} else if (j(a) && Pe(a, t))
|
|
2409
2338
|
break;
|
|
2410
2339
|
}
|
|
2411
2340
|
}
|
|
2412
2341
|
};
|
|
2413
|
-
function
|
|
2342
|
+
function zt(e, t, r) {
|
|
2414
2343
|
const n = k(e, r);
|
|
2415
|
-
if (n ||
|
|
2344
|
+
if (n || Xe(r))
|
|
2416
2345
|
return {
|
|
2417
2346
|
error: n,
|
|
2418
2347
|
name: r
|
|
2419
2348
|
};
|
|
2420
|
-
const
|
|
2421
|
-
for (;
|
|
2422
|
-
const s =
|
|
2349
|
+
const i = r.split(".");
|
|
2350
|
+
for (; i.length; ) {
|
|
2351
|
+
const s = i.join("."), o = k(t, s), a = k(e, s);
|
|
2423
2352
|
if (o && !Array.isArray(o) && r !== s)
|
|
2424
2353
|
return { name: r };
|
|
2425
|
-
if (
|
|
2354
|
+
if (a && a.type)
|
|
2426
2355
|
return {
|
|
2427
2356
|
name: s,
|
|
2428
|
-
error:
|
|
2357
|
+
error: a
|
|
2429
2358
|
};
|
|
2430
|
-
if (
|
|
2359
|
+
if (a && a.root && a.root.type)
|
|
2431
2360
|
return {
|
|
2432
2361
|
name: `${s}.root`,
|
|
2433
|
-
error:
|
|
2362
|
+
error: a.root
|
|
2434
2363
|
};
|
|
2435
|
-
|
|
2364
|
+
i.pop();
|
|
2436
2365
|
}
|
|
2437
2366
|
return {
|
|
2438
2367
|
name: r
|
|
2439
2368
|
};
|
|
2440
2369
|
}
|
|
2441
|
-
var
|
|
2370
|
+
var is = (e, t, r, n) => {
|
|
2442
2371
|
r(e);
|
|
2443
|
-
const { name:
|
|
2444
|
-
return
|
|
2445
|
-
},
|
|
2446
|
-
const n =
|
|
2447
|
-
return
|
|
2372
|
+
const { name: i, ...s } = e;
|
|
2373
|
+
return G(s) || Object.keys(s).length >= Object.keys(t).length || Object.keys(s).find((o) => t[o] === (!n || re.all));
|
|
2374
|
+
}, os = (e, t, r) => !e || !t || e === t || Be(e).some((n) => n && (r ? n === t : n.startsWith(t) || t.startsWith(n))), ls = (e, t, r, n, i) => i.isOnAll ? !1 : !r && i.isOnTouch ? !(t || e) : (r ? n.isOnBlur : i.isOnBlur) ? !e : (r ? n.isOnChange : i.isOnChange) ? e : !0, cs = (e, t) => !ft(k(e, t)).length && P(e, t), us = (e, t, r) => {
|
|
2375
|
+
const n = Be(k(e, r));
|
|
2376
|
+
return T(n, "root", t[r]), T(e, r, n), e;
|
|
2448
2377
|
};
|
|
2449
|
-
function
|
|
2378
|
+
function qt(e, t, r = "validate") {
|
|
2450
2379
|
if (Z(e) || Array.isArray(e) && e.every(Z) || ne(e) && !e)
|
|
2451
2380
|
return {
|
|
2452
2381
|
type: r,
|
|
@@ -2454,98 +2383,98 @@ function Wt(e, t, r = "validate") {
|
|
|
2454
2383
|
ref: t
|
|
2455
2384
|
};
|
|
2456
2385
|
}
|
|
2457
|
-
var Se = (e) =>
|
|
2386
|
+
var Se = (e) => j(e) && !Ge(e) ? e : {
|
|
2458
2387
|
value: e,
|
|
2459
2388
|
message: ""
|
|
2460
|
-
},
|
|
2461
|
-
const { ref: o, refs:
|
|
2389
|
+
}, Ht = async (e, t, r, n, i, s) => {
|
|
2390
|
+
const { ref: o, refs: a, required: f, maxLength: p, minLength: C, min: v, max: h, pattern: y, validate: b, name: E, valueAsNumber: V, mount: x } = e._f, _ = k(r, E);
|
|
2462
2391
|
if (!x || t.has(E))
|
|
2463
2392
|
return {};
|
|
2464
|
-
const I =
|
|
2465
|
-
|
|
2466
|
-
},
|
|
2467
|
-
const
|
|
2468
|
-
|
|
2393
|
+
const I = a ? a[0] : o, O = (F) => {
|
|
2394
|
+
i && I.reportValidity && (I.setCustomValidity(ne(F) ? "" : F || ""), I.reportValidity());
|
|
2395
|
+
}, A = {}, ye = mt(o), Ce = Ue(o), ie = ye || Ce, de = (V || pt(o)) && B(o.value) && B(_) || Ke(o) && o.value === "" || _ === "" || Array.isArray(_) && !_.length, z = hr.bind(null, E, n, A), ze = (F, L, $, q = le.maxLength, ee = le.minLength) => {
|
|
2396
|
+
const J = F ? L : $;
|
|
2397
|
+
A[E] = {
|
|
2469
2398
|
type: F ? q : ee,
|
|
2470
|
-
message:
|
|
2399
|
+
message: J,
|
|
2471
2400
|
ref: o,
|
|
2472
|
-
...z(F ? q : ee,
|
|
2401
|
+
...z(F ? q : ee, J)
|
|
2473
2402
|
};
|
|
2474
2403
|
};
|
|
2475
|
-
if (s ? !Array.isArray(_) || !_.length : f && (!
|
|
2404
|
+
if (s ? !Array.isArray(_) || !_.length : f && (!ie && (de || W(_)) || ne(_) && !_ || Ce && !yr(a).isValid || ye && !vr(a).isValid)) {
|
|
2476
2405
|
const { value: F, message: L } = Z(f) ? { value: !!f, message: f } : Se(f);
|
|
2477
|
-
if (F && (
|
|
2478
|
-
type:
|
|
2406
|
+
if (F && (A[E] = {
|
|
2407
|
+
type: le.required,
|
|
2479
2408
|
message: L,
|
|
2480
2409
|
ref: I,
|
|
2481
|
-
...z(
|
|
2410
|
+
...z(le.required, L)
|
|
2482
2411
|
}, !n))
|
|
2483
|
-
return O(L),
|
|
2412
|
+
return O(L), A;
|
|
2484
2413
|
}
|
|
2485
|
-
if (!de && (!
|
|
2414
|
+
if (!de && (!W(v) || !W(h))) {
|
|
2486
2415
|
let F, L;
|
|
2487
|
-
const
|
|
2488
|
-
if (!
|
|
2416
|
+
const $ = Se(h), q = Se(v);
|
|
2417
|
+
if (!W(_) && !isNaN(_)) {
|
|
2489
2418
|
const ee = o.valueAsNumber || _ && +_;
|
|
2490
|
-
|
|
2419
|
+
W($.value) || (F = ee > $.value), W(q.value) || (L = ee < q.value);
|
|
2491
2420
|
} else {
|
|
2492
|
-
const ee = o.valueAsDate || new Date(_),
|
|
2493
|
-
Z(
|
|
2421
|
+
const ee = o.valueAsDate || new Date(_), J = (Me) => /* @__PURE__ */ new Date((/* @__PURE__ */ new Date()).toDateString() + " " + Me), Ae = o.type == "time", Le = o.type == "week";
|
|
2422
|
+
Z($.value) && _ && (F = Ae ? J(_) > J($.value) : Le ? _ > $.value : ee > new Date($.value)), Z(q.value) && _ && (L = Ae ? J(_) < J(q.value) : Le ? _ < q.value : ee < new Date(q.value));
|
|
2494
2423
|
}
|
|
2495
|
-
if ((F || L) && (
|
|
2496
|
-
return O(
|
|
2424
|
+
if ((F || L) && (ze(!!F, $.message, q.message, le.max, le.min), !n))
|
|
2425
|
+
return O(A[E].message), A;
|
|
2497
2426
|
}
|
|
2498
2427
|
if ((p || C) && !de && (Z(_) || s && Array.isArray(_))) {
|
|
2499
|
-
const F = Se(p), L = Se(C),
|
|
2500
|
-
if ((
|
|
2501
|
-
return O(
|
|
2428
|
+
const F = Se(p), L = Se(C), $ = !W(F.value) && _.length > +F.value, q = !W(L.value) && _.length < +L.value;
|
|
2429
|
+
if (($ || q) && (ze($, F.message, L.message), !n))
|
|
2430
|
+
return O(A[E].message), A;
|
|
2502
2431
|
}
|
|
2503
2432
|
if (y && !de && Z(_)) {
|
|
2504
2433
|
const { value: F, message: L } = Se(y);
|
|
2505
|
-
if (
|
|
2506
|
-
type:
|
|
2434
|
+
if (Ge(F) && !_.match(F) && (A[E] = {
|
|
2435
|
+
type: le.pattern,
|
|
2507
2436
|
message: L,
|
|
2508
2437
|
ref: o,
|
|
2509
|
-
...z(
|
|
2438
|
+
...z(le.pattern, L)
|
|
2510
2439
|
}, !n))
|
|
2511
|
-
return O(L),
|
|
2440
|
+
return O(L), A;
|
|
2512
2441
|
}
|
|
2513
2442
|
if (b) {
|
|
2514
2443
|
if (te(b)) {
|
|
2515
|
-
const F = await b(_, r), L =
|
|
2516
|
-
if (L && (
|
|
2444
|
+
const F = await b(_, r), L = qt(F, I);
|
|
2445
|
+
if (L && (A[E] = {
|
|
2517
2446
|
...L,
|
|
2518
|
-
...z(
|
|
2447
|
+
...z(le.validate, L.message)
|
|
2519
2448
|
}, !n))
|
|
2520
|
-
return O(L.message),
|
|
2521
|
-
} else if (
|
|
2449
|
+
return O(L.message), A;
|
|
2450
|
+
} else if (j(b)) {
|
|
2522
2451
|
let F = {};
|
|
2523
2452
|
for (const L in b) {
|
|
2524
|
-
if (!
|
|
2453
|
+
if (!G(F) && !n)
|
|
2525
2454
|
break;
|
|
2526
|
-
const
|
|
2527
|
-
|
|
2528
|
-
|
|
2529
|
-
...z(L,
|
|
2530
|
-
}, O(
|
|
2455
|
+
const $ = qt(await b[L](_, r), I, L);
|
|
2456
|
+
$ && (F = {
|
|
2457
|
+
...$,
|
|
2458
|
+
...z(L, $.message)
|
|
2459
|
+
}, O($.message), n && (A[E] = F));
|
|
2531
2460
|
}
|
|
2532
|
-
if (!
|
|
2461
|
+
if (!G(F) && (A[E] = {
|
|
2533
2462
|
ref: I,
|
|
2534
2463
|
...F
|
|
2535
2464
|
}, !n))
|
|
2536
|
-
return
|
|
2465
|
+
return A;
|
|
2537
2466
|
}
|
|
2538
2467
|
}
|
|
2539
|
-
return O(!0),
|
|
2468
|
+
return O(!0), A;
|
|
2540
2469
|
};
|
|
2541
|
-
const
|
|
2470
|
+
const ds = {
|
|
2542
2471
|
mode: re.onSubmit,
|
|
2543
2472
|
reValidateMode: re.onChange,
|
|
2544
2473
|
shouldFocusError: !0
|
|
2545
2474
|
};
|
|
2546
|
-
function
|
|
2475
|
+
function fs(e = {}) {
|
|
2547
2476
|
let t = {
|
|
2548
|
-
...
|
|
2477
|
+
...ds,
|
|
2549
2478
|
...e
|
|
2550
2479
|
}, r = {
|
|
2551
2480
|
submitCount: 0,
|
|
@@ -2562,12 +2491,12 @@ function ms(e = {}) {
|
|
|
2562
2491
|
validatingFields: {},
|
|
2563
2492
|
errors: t.errors || {},
|
|
2564
2493
|
disabled: t.disabled || !1
|
|
2565
|
-
}, n = {},
|
|
2494
|
+
}, n = {}, i = j(t.defaultValues) || j(t.values) ? U(t.defaultValues || t.values) || {} : {}, s = t.shouldUnregister ? {} : U(i), o = {
|
|
2566
2495
|
action: !1,
|
|
2567
2496
|
mount: !1,
|
|
2568
2497
|
watch: !1,
|
|
2569
2498
|
keepIsValid: !1
|
|
2570
|
-
},
|
|
2499
|
+
}, a = {
|
|
2571
2500
|
mount: /* @__PURE__ */ new Set(),
|
|
2572
2501
|
disabled: /* @__PURE__ */ new Set(),
|
|
2573
2502
|
unMount: /* @__PURE__ */ new Set(),
|
|
@@ -2589,39 +2518,39 @@ function ms(e = {}) {
|
|
|
2589
2518
|
...v
|
|
2590
2519
|
};
|
|
2591
2520
|
const y = {
|
|
2592
|
-
array:
|
|
2593
|
-
state:
|
|
2521
|
+
array: Dt(),
|
|
2522
|
+
state: Dt()
|
|
2594
2523
|
}, b = t.criteriaMode === re.all, E = (l) => (u) => {
|
|
2595
2524
|
clearTimeout(p), p = setTimeout(l, u);
|
|
2596
2525
|
}, V = async (l) => {
|
|
2597
2526
|
if (!o.keepIsValid && !t.disabled && (v.isValid || h.isValid || l)) {
|
|
2598
2527
|
let u;
|
|
2599
|
-
t.resolver ? (u =
|
|
2528
|
+
t.resolver ? (u = G((await ie()).errors), x()) : u = await z(n, !0), u !== r.isValid && y.state.next({
|
|
2600
2529
|
isValid: u
|
|
2601
2530
|
});
|
|
2602
2531
|
}
|
|
2603
2532
|
}, x = (l, u) => {
|
|
2604
|
-
!t.disabled && (v.isValidating || v.validatingFields || h.isValidating || h.validatingFields) && ((l || Array.from(
|
|
2605
|
-
d && (u ?
|
|
2533
|
+
!t.disabled && (v.isValidating || v.validatingFields || h.isValidating || h.validatingFields) && ((l || Array.from(a.mount)).forEach((d) => {
|
|
2534
|
+
d && (u ? T(r.validatingFields, d, u) : P(r.validatingFields, d));
|
|
2606
2535
|
}), y.state.next({
|
|
2607
2536
|
validatingFields: r.validatingFields,
|
|
2608
|
-
isValidating: !
|
|
2537
|
+
isValidating: !G(r.validatingFields)
|
|
2609
2538
|
}));
|
|
2610
2539
|
}, _ = (l, u = [], d, w, g = !0, m = !0) => {
|
|
2611
2540
|
if (w && d && !t.disabled) {
|
|
2612
2541
|
if (o.action = !0, m && Array.isArray(k(n, l))) {
|
|
2613
2542
|
const S = d(k(n, l), w.argA, w.argB);
|
|
2614
|
-
g &&
|
|
2543
|
+
g && T(n, l, S);
|
|
2615
2544
|
}
|
|
2616
2545
|
if (m && Array.isArray(k(r.errors, l))) {
|
|
2617
2546
|
const S = d(k(r.errors, l), w.argA, w.argB);
|
|
2618
|
-
g &&
|
|
2547
|
+
g && T(r.errors, l, S), cs(r.errors, l);
|
|
2619
2548
|
}
|
|
2620
2549
|
if ((v.touchedFields || h.touchedFields) && m && Array.isArray(k(r.touchedFields, l))) {
|
|
2621
2550
|
const S = d(k(r.touchedFields, l), w.argA, w.argB);
|
|
2622
|
-
g &&
|
|
2551
|
+
g && T(r.touchedFields, l, S);
|
|
2623
2552
|
}
|
|
2624
|
-
(v.dirtyFields || h.dirtyFields) && (r.dirtyFields = Ee(
|
|
2553
|
+
(v.dirtyFields || h.dirtyFields) && (r.dirtyFields = Ee(i, s)), y.state.next({
|
|
2625
2554
|
name: l,
|
|
2626
2555
|
isDirty: F(l, u),
|
|
2627
2556
|
dirtyFields: r.dirtyFields,
|
|
@@ -2629,9 +2558,9 @@ function ms(e = {}) {
|
|
|
2629
2558
|
isValid: r.isValid
|
|
2630
2559
|
});
|
|
2631
2560
|
} else
|
|
2632
|
-
|
|
2561
|
+
T(s, l, u);
|
|
2633
2562
|
}, I = (l, u) => {
|
|
2634
|
-
|
|
2563
|
+
T(r.errors, l, u), y.state.next({
|
|
2635
2564
|
errors: r.errors
|
|
2636
2565
|
});
|
|
2637
2566
|
}, O = (l) => {
|
|
@@ -2639,33 +2568,33 @@ function ms(e = {}) {
|
|
|
2639
2568
|
errors: r.errors,
|
|
2640
2569
|
isValid: !1
|
|
2641
2570
|
});
|
|
2642
|
-
},
|
|
2571
|
+
}, A = (l, u, d, w) => {
|
|
2643
2572
|
const g = k(n, l);
|
|
2644
2573
|
if (g) {
|
|
2645
|
-
const m = k(s, l, B(d) ? k(
|
|
2646
|
-
B(m) || w && w.defaultChecked || u ?
|
|
2574
|
+
const m = k(s, l, B(d) ? k(i, l) : d);
|
|
2575
|
+
B(m) || w && w.defaultChecked || u ? T(s, l, u ? m : Pt(g._f)) : q(l, m), o.mount && !o.action && V();
|
|
2647
2576
|
}
|
|
2648
|
-
},
|
|
2577
|
+
}, ye = (l, u, d, w, g) => {
|
|
2649
2578
|
let m = !1, S = !1;
|
|
2650
|
-
const
|
|
2579
|
+
const M = {
|
|
2651
2580
|
name: l
|
|
2652
2581
|
};
|
|
2653
2582
|
if (!t.disabled) {
|
|
2654
2583
|
if (!d || w) {
|
|
2655
|
-
(v.isDirty || h.isDirty) && (S = r.isDirty, r.isDirty =
|
|
2656
|
-
const
|
|
2657
|
-
S = !!k(r.dirtyFields, l),
|
|
2584
|
+
(v.isDirty || h.isDirty) && (S = r.isDirty, r.isDirty = M.isDirty = F(), m = S !== M.isDirty);
|
|
2585
|
+
const N = he(k(i, l), u);
|
|
2586
|
+
S = !!k(r.dirtyFields, l), N ? P(r.dirtyFields, l) : T(r.dirtyFields, l, !0), M.dirtyFields = r.dirtyFields, m = m || (v.dirtyFields || h.dirtyFields) && S !== !N;
|
|
2658
2587
|
}
|
|
2659
2588
|
if (d) {
|
|
2660
|
-
const
|
|
2661
|
-
|
|
2589
|
+
const N = k(r.touchedFields, l);
|
|
2590
|
+
N || (T(r.touchedFields, l, d), M.touchedFields = r.touchedFields, m = m || (v.touchedFields || h.touchedFields) && N !== d);
|
|
2662
2591
|
}
|
|
2663
|
-
m && g && y.state.next(
|
|
2592
|
+
m && g && y.state.next(M);
|
|
2664
2593
|
}
|
|
2665
|
-
return m ?
|
|
2594
|
+
return m ? M : {};
|
|
2666
2595
|
}, Ce = (l, u, d, w) => {
|
|
2667
2596
|
const g = k(r.errors, l), m = (v.isValid || h.isValid) && ne(u) && r.isValid !== u;
|
|
2668
|
-
if (t.delayError && d ? (f = E(() => I(l, d)), f(t.delayError)) : (clearTimeout(p), f = null, d ?
|
|
2597
|
+
if (t.delayError && d ? (f = E(() => I(l, d)), f(t.delayError)) : (clearTimeout(p), f = null, d ? T(r.errors, l, d) : P(r.errors, l)), (d ? !he(g, d) : g) || !G(w) || m) {
|
|
2669
2598
|
const S = {
|
|
2670
2599
|
...w,
|
|
2671
2600
|
...m && ne(u) ? { isValid: u } : {},
|
|
@@ -2677,12 +2606,12 @@ function ms(e = {}) {
|
|
|
2677
2606
|
...S
|
|
2678
2607
|
}, y.state.next(S);
|
|
2679
2608
|
}
|
|
2680
|
-
},
|
|
2681
|
-
const { errors: u } = await
|
|
2609
|
+
}, ie = async (l) => (x(l, !0), await t.resolver(s, t.context, ns(l || a.mount, n, t.criteriaMode, t.shouldUseNativeValidation))), de = async (l) => {
|
|
2610
|
+
const { errors: u } = await ie(l);
|
|
2682
2611
|
if (x(l), l)
|
|
2683
2612
|
for (const d of l) {
|
|
2684
2613
|
const w = k(u, d);
|
|
2685
|
-
w ?
|
|
2614
|
+
w ? T(r.errors, d, w) : P(r.errors, d);
|
|
2686
2615
|
}
|
|
2687
2616
|
else
|
|
2688
2617
|
r.errors = u;
|
|
@@ -2695,55 +2624,55 @@ function ms(e = {}) {
|
|
|
2695
2624
|
if (g) {
|
|
2696
2625
|
const { _f: m, ...S } = g;
|
|
2697
2626
|
if (m) {
|
|
2698
|
-
const
|
|
2699
|
-
|
|
2700
|
-
const
|
|
2701
|
-
if (
|
|
2627
|
+
const M = a.array.has(m.name), N = g._f && ss(g._f);
|
|
2628
|
+
N && v.validatingFields && x([m.name], !0);
|
|
2629
|
+
const H = await Ht(g, a.disabled, s, b, t.shouldUseNativeValidation && !u, M);
|
|
2630
|
+
if (N && v.validatingFields && x([m.name]), H[m.name] && (d.valid = !1, u || e.shouldUseNativeValidation))
|
|
2702
2631
|
break;
|
|
2703
|
-
!u && (k(
|
|
2632
|
+
!u && (k(H, m.name) ? M ? us(r.errors, H, m.name) : T(r.errors, m.name, H[m.name]) : P(r.errors, m.name));
|
|
2704
2633
|
}
|
|
2705
|
-
!
|
|
2634
|
+
!G(S) && await z(S, u, d);
|
|
2706
2635
|
}
|
|
2707
2636
|
}
|
|
2708
2637
|
return d.valid;
|
|
2709
|
-
},
|
|
2710
|
-
for (const l of
|
|
2638
|
+
}, ze = () => {
|
|
2639
|
+
for (const l of a.unMount) {
|
|
2711
2640
|
const u = k(n, l);
|
|
2712
|
-
u && (u._f.refs ? u._f.refs.every((d) => !
|
|
2641
|
+
u && (u._f.refs ? u._f.refs.every((d) => !at(d)) : !at(u._f.ref)) && Qe(l);
|
|
2713
2642
|
}
|
|
2714
|
-
|
|
2715
|
-
}, F = (l, u) => !t.disabled && (l && u &&
|
|
2716
|
-
...o.mount ? s : B(u) ?
|
|
2717
|
-
}, d, u),
|
|
2643
|
+
a.unMount = /* @__PURE__ */ new Set();
|
|
2644
|
+
}, F = (l, u) => !t.disabled && (l && u && T(s, l, u), !he(gt(), i)), L = (l, u, d) => Zn(l, a, {
|
|
2645
|
+
...o.mount ? s : B(u) ? i : Z(l) ? { [l]: u } : u
|
|
2646
|
+
}, d, u), $ = (l) => ft(k(o.mount ? s : i, l, t.shouldUnregister ? k(i, l, []) : [])), q = (l, u, d = {}) => {
|
|
2718
2647
|
const w = k(n, l);
|
|
2719
2648
|
let g = u;
|
|
2720
2649
|
if (w) {
|
|
2721
2650
|
const m = w._f;
|
|
2722
|
-
m && (!m.disabled &&
|
|
2723
|
-
(!S.defaultChecked || !S.disabled) && (Array.isArray(g) ? S.checked = !!g.find((
|
|
2724
|
-
}) : m.refs.forEach((S) => S.checked = S.value === g) :
|
|
2651
|
+
m && (!m.disabled && T(s, l, br(u, m)), g = Ke(m.ref) && W(u) ? "" : u, mr(m.ref) ? [...m.ref.options].forEach((S) => S.selected = g.includes(S.value)) : m.refs ? Ue(m.ref) ? m.refs.forEach((S) => {
|
|
2652
|
+
(!S.defaultChecked || !S.disabled) && (Array.isArray(g) ? S.checked = !!g.find((M) => M === S.value) : S.checked = g === S.value || !!g);
|
|
2653
|
+
}) : m.refs.forEach((S) => S.checked = S.value === g) : pt(m.ref) ? m.ref.value = "" : (m.ref.value = g, m.ref.type || y.state.next({
|
|
2725
2654
|
name: l,
|
|
2726
2655
|
values: U(s)
|
|
2727
2656
|
})));
|
|
2728
2657
|
}
|
|
2729
|
-
(d.shouldDirty || d.shouldTouch) &&
|
|
2658
|
+
(d.shouldDirty || d.shouldTouch) && ye(l, g, d.shouldTouch, d.shouldDirty, !0), d.shouldValidate && Me(l);
|
|
2730
2659
|
}, ee = (l, u, d) => {
|
|
2731
2660
|
for (const w in u) {
|
|
2732
2661
|
if (!u.hasOwnProperty(w))
|
|
2733
2662
|
return;
|
|
2734
2663
|
const g = u[w], m = l + "." + w, S = k(n, m);
|
|
2735
|
-
(
|
|
2664
|
+
(a.array.has(l) || j(g) || S && !S._f) && !ve(g) ? ee(m, g, d) : q(m, g, d);
|
|
2736
2665
|
}
|
|
2737
|
-
},
|
|
2738
|
-
const w = k(n, l), g =
|
|
2739
|
-
|
|
2666
|
+
}, J = (l, u, d = {}) => {
|
|
2667
|
+
const w = k(n, l), g = a.array.has(l), m = U(u);
|
|
2668
|
+
T(s, l, m), g ? (y.array.next({
|
|
2740
2669
|
name: l,
|
|
2741
2670
|
values: U(s)
|
|
2742
2671
|
}), (v.isDirty || v.dirtyFields || h.isDirty || h.dirtyFields) && d.shouldDirty && y.state.next({
|
|
2743
2672
|
name: l,
|
|
2744
|
-
dirtyFields: Ee(
|
|
2673
|
+
dirtyFields: Ee(i, s),
|
|
2745
2674
|
isDirty: F(l, m)
|
|
2746
|
-
})) : w && !w._f && !
|
|
2675
|
+
})) : w && !w._f && !W(m) ? ee(l, m, d) : q(l, m, d), Ut(l, a) ? y.state.next({
|
|
2747
2676
|
...r,
|
|
2748
2677
|
name: l,
|
|
2749
2678
|
values: U(s)
|
|
@@ -2755,39 +2684,39 @@ function ms(e = {}) {
|
|
|
2755
2684
|
o.mount = !0;
|
|
2756
2685
|
const u = l.target;
|
|
2757
2686
|
let d = u.name, w = !0;
|
|
2758
|
-
const g = k(n, d), m = (
|
|
2759
|
-
w = Number.isNaN(
|
|
2760
|
-
}, S =
|
|
2687
|
+
const g = k(n, d), m = (N) => {
|
|
2688
|
+
w = Number.isNaN(N) || ve(N) && isNaN(N.getTime()) || he(N, k(s, d, N));
|
|
2689
|
+
}, S = jt(t.mode), M = jt(t.reValidateMode);
|
|
2761
2690
|
if (g) {
|
|
2762
|
-
let
|
|
2763
|
-
const
|
|
2764
|
-
|
|
2765
|
-
const
|
|
2691
|
+
let N, H;
|
|
2692
|
+
const be = u.type ? Pt(g._f) : qn(l), fe = l.type === Tt.BLUR || l.type === Tt.FOCUS_OUT, Fr = !as(g._f) && !t.resolver && !k(r.errors, d) && !g._f.deps || ls(fe, k(r.touchedFields, d), r.isSubmitted, M, S), rt = Ut(d, a, fe);
|
|
2693
|
+
T(s, d, be), fe ? (!u || !u.readOnly) && (g._f.onBlur && g._f.onBlur(l), f && f(0)) : g._f.onChange && g._f.onChange(l);
|
|
2694
|
+
const nt = ye(d, be, fe), Ir = !G(nt) || rt;
|
|
2766
2695
|
if (!fe && y.state.next({
|
|
2767
2696
|
name: d,
|
|
2768
2697
|
type: l.type,
|
|
2769
2698
|
values: U(s)
|
|
2770
|
-
}),
|
|
2771
|
-
return (v.isValid || h.isValid) && (t.mode === "onBlur" ? fe && V() : fe || V()),
|
|
2772
|
-
if (!fe &&
|
|
2773
|
-
const { errors:
|
|
2774
|
-
if (x([d]), m(
|
|
2775
|
-
const
|
|
2776
|
-
|
|
2699
|
+
}), Fr)
|
|
2700
|
+
return (v.isValid || h.isValid) && (t.mode === "onBlur" ? fe && V() : fe || V()), Ir && y.state.next({ name: d, ...rt ? {} : nt });
|
|
2701
|
+
if (!fe && rt && y.state.next({ ...r }), t.resolver) {
|
|
2702
|
+
const { errors: St } = await ie([d]);
|
|
2703
|
+
if (x([d]), m(be), w) {
|
|
2704
|
+
const Ar = zt(r.errors, n, d), Vt = zt(St, n, Ar.name || d);
|
|
2705
|
+
N = Vt.error, d = Vt.name, H = G(St);
|
|
2777
2706
|
}
|
|
2778
2707
|
} else
|
|
2779
|
-
x([d], !0),
|
|
2780
|
-
w && (g._f.deps && (!Array.isArray(g._f.deps) || g._f.deps.length > 0) &&
|
|
2708
|
+
x([d], !0), N = (await Ht(g, a.disabled, s, b, t.shouldUseNativeValidation))[d], x([d]), m(be), w && (N ? H = !1 : (v.isValid || h.isValid) && (H = await z(n, !0)));
|
|
2709
|
+
w && (g._f.deps && (!Array.isArray(g._f.deps) || g._f.deps.length > 0) && Me(g._f.deps), Ce(d, H, N, nt));
|
|
2781
2710
|
}
|
|
2782
|
-
},
|
|
2711
|
+
}, Le = (l, u) => {
|
|
2783
2712
|
if (k(r.errors, u) && l.focus)
|
|
2784
2713
|
return l.focus(), 1;
|
|
2785
|
-
},
|
|
2714
|
+
}, Me = async (l, u = {}) => {
|
|
2786
2715
|
let d, w;
|
|
2787
|
-
const g =
|
|
2716
|
+
const g = Be(l);
|
|
2788
2717
|
if (t.resolver) {
|
|
2789
2718
|
const m = await de(B(l) ? l : g);
|
|
2790
|
-
d =
|
|
2719
|
+
d = G(m), w = l ? !g.some((S) => k(m, S)) : d;
|
|
2791
2720
|
} else
|
|
2792
2721
|
l ? (w = (await Promise.all(g.map(async (m) => {
|
|
2793
2722
|
const S = k(n, m);
|
|
@@ -2797,20 +2726,20 @@ function ms(e = {}) {
|
|
|
2797
2726
|
...!Z(l) || (v.isValid || h.isValid) && d !== r.isValid ? {} : { name: l },
|
|
2798
2727
|
...t.resolver || !l ? { isValid: d } : {},
|
|
2799
2728
|
errors: r.errors
|
|
2800
|
-
}), u.shouldFocus && !w &&
|
|
2801
|
-
},
|
|
2729
|
+
}), u.shouldFocus && !w && Pe(n, Le, l ? g : a.mount), w;
|
|
2730
|
+
}, gt = (l, u) => {
|
|
2802
2731
|
let d = {
|
|
2803
|
-
...o.mount ? s :
|
|
2732
|
+
...o.mount ? s : i
|
|
2804
2733
|
};
|
|
2805
|
-
return u && (d =
|
|
2806
|
-
},
|
|
2734
|
+
return u && (d = pr(u.dirtyFields ? r.dirtyFields : r.touchedFields, d)), B(l) ? d : Z(l) ? k(d, l) : l.map((w) => k(d, w));
|
|
2735
|
+
}, yt = (l, u) => ({
|
|
2807
2736
|
invalid: !!k((u || r).errors, l),
|
|
2808
2737
|
isDirty: !!k((u || r).dirtyFields, l),
|
|
2809
2738
|
error: k((u || r).errors, l),
|
|
2810
2739
|
isValidating: !!k(r.validatingFields, l),
|
|
2811
2740
|
isTouched: !!k((u || r).touchedFields, l)
|
|
2812
|
-
}),
|
|
2813
|
-
const u = l ?
|
|
2741
|
+
}), wr = (l) => {
|
|
2742
|
+
const u = l ? Be(l) : void 0;
|
|
2814
2743
|
u == null || u.forEach((d) => P(r.errors, d)), u ? u.forEach((d) => {
|
|
2815
2744
|
y.state.next({
|
|
2816
2745
|
name: d,
|
|
@@ -2819,10 +2748,10 @@ function ms(e = {}) {
|
|
|
2819
2748
|
}) : y.state.next({
|
|
2820
2749
|
errors: {}
|
|
2821
2750
|
});
|
|
2822
|
-
},
|
|
2823
|
-
const w = (k(n, l, { _f: {} })._f || {}).ref, g = k(r.errors, l) || {}, { ref: m, message: S, type:
|
|
2824
|
-
|
|
2825
|
-
...
|
|
2751
|
+
}, bt = (l, u, d) => {
|
|
2752
|
+
const w = (k(n, l, { _f: {} })._f || {}).ref, g = k(r.errors, l) || {}, { ref: m, message: S, type: M, ...N } = g;
|
|
2753
|
+
T(r.errors, l, {
|
|
2754
|
+
...N,
|
|
2826
2755
|
...u,
|
|
2827
2756
|
ref: w
|
|
2828
2757
|
}), y.state.next({
|
|
@@ -2830,44 +2759,44 @@ function ms(e = {}) {
|
|
|
2830
2759
|
errors: r.errors,
|
|
2831
2760
|
isValid: !1
|
|
2832
2761
|
}), d && d.shouldFocus && w && w.focus && w.focus();
|
|
2833
|
-
},
|
|
2762
|
+
}, kr = (l, u) => te(l) ? y.state.subscribe({
|
|
2834
2763
|
next: (d) => "values" in d && l(L(void 0, u), d)
|
|
2835
|
-
}) : L(l, u, !0),
|
|
2764
|
+
}) : L(l, u, !0), vt = (l) => y.state.subscribe({
|
|
2836
2765
|
next: (u) => {
|
|
2837
|
-
|
|
2766
|
+
os(l.name, u.name, l.exact) && is(u, l.formState || v, Er, l.reRenderRoot) && l.callback({
|
|
2838
2767
|
values: { ...s },
|
|
2839
2768
|
...r,
|
|
2840
2769
|
...u,
|
|
2841
|
-
defaultValues:
|
|
2770
|
+
defaultValues: i
|
|
2842
2771
|
});
|
|
2843
2772
|
}
|
|
2844
|
-
}).unsubscribe,
|
|
2773
|
+
}).unsubscribe, _r = (l) => (o.mount = !0, h = {
|
|
2845
2774
|
...h,
|
|
2846
2775
|
...l.formState
|
|
2847
|
-
},
|
|
2776
|
+
}, vt({
|
|
2848
2777
|
...l,
|
|
2849
2778
|
formState: {
|
|
2850
2779
|
...C,
|
|
2851
2780
|
...l.formState
|
|
2852
2781
|
}
|
|
2853
|
-
})),
|
|
2854
|
-
for (const d of l ?
|
|
2855
|
-
|
|
2782
|
+
})), Qe = (l, u = {}) => {
|
|
2783
|
+
for (const d of l ? Be(l) : a.mount)
|
|
2784
|
+
a.mount.delete(d), a.array.delete(d), u.keepValue || (P(n, d), P(s, d)), !u.keepError && P(r.errors, d), !u.keepDirty && P(r.dirtyFields, d), !u.keepTouched && P(r.touchedFields, d), !u.keepIsValidating && P(r.validatingFields, d), !t.shouldUnregister && !u.keepDefaultValue && P(i, d);
|
|
2856
2785
|
y.state.next({
|
|
2857
2786
|
values: U(s)
|
|
2858
2787
|
}), y.state.next({
|
|
2859
2788
|
...r,
|
|
2860
2789
|
...u.keepDirty ? { isDirty: F() } : {}
|
|
2861
2790
|
}), !u.keepIsValid && V();
|
|
2862
|
-
},
|
|
2863
|
-
if (ne(l) && o.mount || l ||
|
|
2864
|
-
const g =
|
|
2865
|
-
l ?
|
|
2791
|
+
}, xt = ({ disabled: l, name: u }) => {
|
|
2792
|
+
if (ne(l) && o.mount || l || a.disabled.has(u)) {
|
|
2793
|
+
const g = a.disabled.has(u) !== !!l;
|
|
2794
|
+
l ? a.disabled.add(u) : a.disabled.delete(u), g && o.mount && !o.action && V();
|
|
2866
2795
|
}
|
|
2867
|
-
},
|
|
2796
|
+
}, et = (l, u = {}) => {
|
|
2868
2797
|
let d = k(n, l);
|
|
2869
2798
|
const w = ne(u.disabled) || ne(t.disabled);
|
|
2870
|
-
return
|
|
2799
|
+
return T(n, l, {
|
|
2871
2800
|
...d || {},
|
|
2872
2801
|
_f: {
|
|
2873
2802
|
...d && d._f ? d._f : { ref: { name: l } },
|
|
@@ -2875,10 +2804,10 @@ function ms(e = {}) {
|
|
|
2875
2804
|
mount: !0,
|
|
2876
2805
|
...u
|
|
2877
2806
|
}
|
|
2878
|
-
}),
|
|
2807
|
+
}), a.mount.add(l), d ? xt({
|
|
2879
2808
|
disabled: ne(u.disabled) ? u.disabled : t.disabled,
|
|
2880
2809
|
name: l
|
|
2881
|
-
}) :
|
|
2810
|
+
}) : A(l, !0, u.value), {
|
|
2882
2811
|
...w ? { disabled: u.disabled || t.disabled } : {},
|
|
2883
2812
|
...t.progressive ? {
|
|
2884
2813
|
required: !!u.required,
|
|
@@ -2893,49 +2822,49 @@ function ms(e = {}) {
|
|
|
2893
2822
|
onBlur: Ae,
|
|
2894
2823
|
ref: (g) => {
|
|
2895
2824
|
if (g) {
|
|
2896
|
-
|
|
2897
|
-
const m = B(g.value) && g.querySelectorAll && g.querySelectorAll("input,select,textarea")[0] || g, S =
|
|
2898
|
-
if (S ?
|
|
2825
|
+
et(l, u), d = k(n, l);
|
|
2826
|
+
const m = B(g.value) && g.querySelectorAll && g.querySelectorAll("input,select,textarea")[0] || g, S = Qn(m), M = d._f.refs || [];
|
|
2827
|
+
if (S ? M.find((N) => N === m) : m === d._f.ref)
|
|
2899
2828
|
return;
|
|
2900
|
-
|
|
2829
|
+
T(n, l, {
|
|
2901
2830
|
_f: {
|
|
2902
2831
|
...d._f,
|
|
2903
2832
|
...S ? {
|
|
2904
2833
|
refs: [
|
|
2905
|
-
...
|
|
2834
|
+
...M.filter(at),
|
|
2906
2835
|
m,
|
|
2907
|
-
...Array.isArray(k(
|
|
2836
|
+
...Array.isArray(k(i, l)) ? [{}] : []
|
|
2908
2837
|
],
|
|
2909
2838
|
ref: { type: m.type, name: l }
|
|
2910
2839
|
} : { ref: m }
|
|
2911
2840
|
}
|
|
2912
|
-
}),
|
|
2841
|
+
}), A(l, !1, void 0, m);
|
|
2913
2842
|
} else
|
|
2914
|
-
d = k(n, l, {}), d._f && (d._f.mount = !1), (t.shouldUnregister || u.shouldUnregister) && !(
|
|
2843
|
+
d = k(n, l, {}), d._f && (d._f.mount = !1), (t.shouldUnregister || u.shouldUnregister) && !(Kn(a.array, l) && o.action) && a.unMount.add(l);
|
|
2915
2844
|
}
|
|
2916
2845
|
};
|
|
2917
|
-
},
|
|
2918
|
-
ne(l) && (y.state.next({ disabled: l }),
|
|
2846
|
+
}, tt = () => t.shouldFocusError && Pe(n, Le, a.mount), Cr = (l) => {
|
|
2847
|
+
ne(l) && (y.state.next({ disabled: l }), Pe(n, (u, d) => {
|
|
2919
2848
|
const w = k(n, d);
|
|
2920
2849
|
w && (u.disabled = w._f.disabled || l, Array.isArray(w._f.refs) && w._f.refs.forEach((g) => {
|
|
2921
2850
|
g.disabled = w._f.disabled || l;
|
|
2922
2851
|
}));
|
|
2923
2852
|
}, 0, !1));
|
|
2924
|
-
},
|
|
2853
|
+
}, wt = (l, u) => async (d) => {
|
|
2925
2854
|
let w;
|
|
2926
2855
|
d && (d.preventDefault && d.preventDefault(), d.persist && d.persist());
|
|
2927
2856
|
let g = U(s);
|
|
2928
2857
|
if (y.state.next({
|
|
2929
2858
|
isSubmitting: !0
|
|
2930
2859
|
}), t.resolver) {
|
|
2931
|
-
const { errors: m, values: S } = await
|
|
2860
|
+
const { errors: m, values: S } = await ie();
|
|
2932
2861
|
x(), r.errors = m, g = U(S);
|
|
2933
2862
|
} else
|
|
2934
2863
|
await z(n);
|
|
2935
|
-
if (
|
|
2936
|
-
for (const m of
|
|
2864
|
+
if (a.disabled.size)
|
|
2865
|
+
for (const m of a.disabled)
|
|
2937
2866
|
P(g, m);
|
|
2938
|
-
if (P(r.errors, "root"),
|
|
2867
|
+
if (P(r.errors, "root"), G(r.errors)) {
|
|
2939
2868
|
y.state.next({
|
|
2940
2869
|
errors: {}
|
|
2941
2870
|
});
|
|
@@ -2945,76 +2874,76 @@ function ms(e = {}) {
|
|
|
2945
2874
|
w = m;
|
|
2946
2875
|
}
|
|
2947
2876
|
} else
|
|
2948
|
-
u && await u({ ...r.errors }, d),
|
|
2877
|
+
u && await u({ ...r.errors }, d), tt(), setTimeout(tt);
|
|
2949
2878
|
if (y.state.next({
|
|
2950
2879
|
isSubmitted: !0,
|
|
2951
2880
|
isSubmitting: !1,
|
|
2952
|
-
isSubmitSuccessful:
|
|
2881
|
+
isSubmitSuccessful: G(r.errors) && !w,
|
|
2953
2882
|
submitCount: r.submitCount + 1,
|
|
2954
2883
|
errors: r.errors
|
|
2955
2884
|
}), w)
|
|
2956
2885
|
throw w;
|
|
2957
|
-
},
|
|
2958
|
-
k(n, l) && (B(u.defaultValue) ?
|
|
2959
|
-
},
|
|
2960
|
-
const d = l ? U(l) :
|
|
2961
|
-
if (u.keepDefaultValues || (
|
|
2886
|
+
}, Sr = (l, u = {}) => {
|
|
2887
|
+
k(n, l) && (B(u.defaultValue) ? J(l, U(k(i, l))) : (J(l, u.defaultValue), T(i, l, U(u.defaultValue))), u.keepTouched || P(r.touchedFields, l), u.keepDirty || (P(r.dirtyFields, l), r.isDirty = u.defaultValue ? F(l, U(k(i, l))) : F()), u.keepError || (P(r.errors, l), v.isValid && V()), y.state.next({ ...r }));
|
|
2888
|
+
}, kt = (l, u = {}) => {
|
|
2889
|
+
const d = l ? U(l) : i, w = U(d), g = G(l), m = g ? i : w;
|
|
2890
|
+
if (u.keepDefaultValues || (i = d), !u.keepValues) {
|
|
2962
2891
|
if (u.keepDirtyValues) {
|
|
2963
2892
|
const S = /* @__PURE__ */ new Set([
|
|
2964
|
-
...
|
|
2965
|
-
...Object.keys(Ee(
|
|
2893
|
+
...a.mount,
|
|
2894
|
+
...Object.keys(Ee(i, s))
|
|
2966
2895
|
]);
|
|
2967
|
-
for (const
|
|
2968
|
-
const
|
|
2969
|
-
|
|
2896
|
+
for (const M of Array.from(S)) {
|
|
2897
|
+
const N = k(r.dirtyFields, M), H = k(s, M), be = k(m, M);
|
|
2898
|
+
N && !B(H) ? T(m, M, H) : !N && !B(be) && J(M, be);
|
|
2970
2899
|
}
|
|
2971
2900
|
} else {
|
|
2972
|
-
if (
|
|
2973
|
-
for (const S of
|
|
2974
|
-
const
|
|
2975
|
-
if (
|
|
2976
|
-
const
|
|
2977
|
-
if (
|
|
2978
|
-
const
|
|
2979
|
-
if (
|
|
2980
|
-
|
|
2901
|
+
if (dt && B(l))
|
|
2902
|
+
for (const S of a.mount) {
|
|
2903
|
+
const M = k(n, S);
|
|
2904
|
+
if (M && M._f) {
|
|
2905
|
+
const N = Array.isArray(M._f.refs) ? M._f.refs[0] : M._f.ref;
|
|
2906
|
+
if (Ke(N)) {
|
|
2907
|
+
const H = N.closest("form");
|
|
2908
|
+
if (H) {
|
|
2909
|
+
H.reset();
|
|
2981
2910
|
break;
|
|
2982
2911
|
}
|
|
2983
2912
|
}
|
|
2984
2913
|
}
|
|
2985
2914
|
}
|
|
2986
2915
|
if (u.keepFieldsRef)
|
|
2987
|
-
for (const S of
|
|
2988
|
-
|
|
2916
|
+
for (const S of a.mount)
|
|
2917
|
+
J(S, k(m, S));
|
|
2989
2918
|
else
|
|
2990
2919
|
n = {};
|
|
2991
2920
|
}
|
|
2992
|
-
s = t.shouldUnregister ? u.keepDefaultValues ? U(
|
|
2921
|
+
s = t.shouldUnregister ? u.keepDefaultValues ? U(i) : {} : U(m), y.array.next({
|
|
2993
2922
|
values: { ...m }
|
|
2994
2923
|
}), y.state.next({
|
|
2995
2924
|
values: { ...m }
|
|
2996
2925
|
});
|
|
2997
2926
|
}
|
|
2998
|
-
|
|
2999
|
-
mount: u.keepDirtyValues ?
|
|
2927
|
+
a = {
|
|
2928
|
+
mount: u.keepDirtyValues ? a.mount : /* @__PURE__ */ new Set(),
|
|
3000
2929
|
unMount: /* @__PURE__ */ new Set(),
|
|
3001
2930
|
array: /* @__PURE__ */ new Set(),
|
|
3002
2931
|
disabled: /* @__PURE__ */ new Set(),
|
|
3003
2932
|
watch: /* @__PURE__ */ new Set(),
|
|
3004
2933
|
watchAll: !1,
|
|
3005
2934
|
focus: ""
|
|
3006
|
-
}, o.mount = !v.isValid || !!u.keepIsValid || !!u.keepDirtyValues || !t.shouldUnregister && !
|
|
2935
|
+
}, o.mount = !v.isValid || !!u.keepIsValid || !!u.keepDirtyValues || !t.shouldUnregister && !G(m), o.watch = !!t.shouldUnregister, o.keepIsValid = !!u.keepIsValid, o.action = !1, u.keepErrors || (r.errors = {}), y.state.next({
|
|
3007
2936
|
submitCount: u.keepSubmitCount ? r.submitCount : 0,
|
|
3008
|
-
isDirty: g ? !1 : u.keepDirty ? r.isDirty : !!(u.keepDefaultValues && !he(l,
|
|
2937
|
+
isDirty: g ? !1 : u.keepDirty ? r.isDirty : !!(u.keepDefaultValues && !he(l, i)),
|
|
3009
2938
|
isSubmitted: u.keepIsSubmitted ? r.isSubmitted : !1,
|
|
3010
|
-
dirtyFields: g ? {} : u.keepDirtyValues ? u.keepDefaultValues && s ? Ee(
|
|
2939
|
+
dirtyFields: g ? {} : u.keepDirtyValues ? u.keepDefaultValues && s ? Ee(i, s) : r.dirtyFields : u.keepDefaultValues && l ? Ee(i, l) : u.keepDirty ? r.dirtyFields : {},
|
|
3011
2940
|
touchedFields: u.keepTouched ? r.touchedFields : {},
|
|
3012
2941
|
errors: u.keepErrors ? r.errors : {},
|
|
3013
2942
|
isSubmitSuccessful: u.keepIsSubmitSuccessful ? r.isSubmitSuccessful : !1,
|
|
3014
2943
|
isSubmitting: !1,
|
|
3015
|
-
defaultValues:
|
|
2944
|
+
defaultValues: i
|
|
3016
2945
|
});
|
|
3017
|
-
},
|
|
2946
|
+
}, _t = (l, u) => kt(te(l) ? l(s) : l, { ...t.resetOptions, ...u }), Vr = (l, u = {}) => {
|
|
3018
2947
|
const d = k(n, l), w = d && d._f;
|
|
3019
2948
|
if (w) {
|
|
3020
2949
|
const g = w.refs ? w.refs[0] : w.ref;
|
|
@@ -3022,37 +2951,37 @@ function ms(e = {}) {
|
|
|
3022
2951
|
g.focus(), u.shouldSelect && te(g.select) && g.select();
|
|
3023
2952
|
});
|
|
3024
2953
|
}
|
|
3025
|
-
},
|
|
2954
|
+
}, Er = (l) => {
|
|
3026
2955
|
r = {
|
|
3027
2956
|
...r,
|
|
3028
2957
|
...l
|
|
3029
2958
|
};
|
|
3030
|
-
},
|
|
2959
|
+
}, Ct = {
|
|
3031
2960
|
control: {
|
|
3032
|
-
register:
|
|
3033
|
-
unregister:
|
|
3034
|
-
getFieldState:
|
|
3035
|
-
handleSubmit:
|
|
3036
|
-
setError:
|
|
3037
|
-
_subscribe:
|
|
3038
|
-
_runSchema:
|
|
2961
|
+
register: et,
|
|
2962
|
+
unregister: Qe,
|
|
2963
|
+
getFieldState: yt,
|
|
2964
|
+
handleSubmit: wt,
|
|
2965
|
+
setError: bt,
|
|
2966
|
+
_subscribe: vt,
|
|
2967
|
+
_runSchema: ie,
|
|
3039
2968
|
_updateIsValidating: x,
|
|
3040
|
-
_focusError:
|
|
2969
|
+
_focusError: tt,
|
|
3041
2970
|
_getWatch: L,
|
|
3042
2971
|
_getDirty: F,
|
|
3043
2972
|
_setValid: V,
|
|
3044
2973
|
_setFieldArray: _,
|
|
3045
|
-
_setDisabledField:
|
|
2974
|
+
_setDisabledField: xt,
|
|
3046
2975
|
_setErrors: O,
|
|
3047
|
-
_getFieldArray:
|
|
3048
|
-
_reset:
|
|
2976
|
+
_getFieldArray: $,
|
|
2977
|
+
_reset: kt,
|
|
3049
2978
|
_resetDefaultValues: () => te(t.defaultValues) && t.defaultValues().then((l) => {
|
|
3050
|
-
|
|
2979
|
+
_t(l, t.resetOptions), y.state.next({
|
|
3051
2980
|
isLoading: !1
|
|
3052
2981
|
});
|
|
3053
2982
|
}),
|
|
3054
|
-
_removeUnmounted:
|
|
3055
|
-
_disableForm:
|
|
2983
|
+
_removeUnmounted: ze,
|
|
2984
|
+
_disableForm: Cr,
|
|
3056
2985
|
_subjects: y,
|
|
3057
2986
|
_proxyFormState: v,
|
|
3058
2987
|
get _fields() {
|
|
@@ -3068,13 +2997,13 @@ function ms(e = {}) {
|
|
|
3068
2997
|
o = l;
|
|
3069
2998
|
},
|
|
3070
2999
|
get _defaultValues() {
|
|
3071
|
-
return
|
|
3000
|
+
return i;
|
|
3072
3001
|
},
|
|
3073
3002
|
get _names() {
|
|
3074
|
-
return
|
|
3003
|
+
return a;
|
|
3075
3004
|
},
|
|
3076
3005
|
set _names(l) {
|
|
3077
|
-
|
|
3006
|
+
a = l;
|
|
3078
3007
|
},
|
|
3079
3008
|
get _formState() {
|
|
3080
3009
|
return r;
|
|
@@ -3089,28 +3018,28 @@ function ms(e = {}) {
|
|
|
3089
3018
|
};
|
|
3090
3019
|
}
|
|
3091
3020
|
},
|
|
3092
|
-
subscribe:
|
|
3093
|
-
trigger:
|
|
3094
|
-
register:
|
|
3095
|
-
handleSubmit:
|
|
3096
|
-
watch:
|
|
3097
|
-
setValue:
|
|
3098
|
-
getValues:
|
|
3099
|
-
reset:
|
|
3100
|
-
resetField:
|
|
3101
|
-
clearErrors:
|
|
3102
|
-
unregister:
|
|
3103
|
-
setError:
|
|
3104
|
-
setFocus:
|
|
3105
|
-
getFieldState:
|
|
3021
|
+
subscribe: _r,
|
|
3022
|
+
trigger: Me,
|
|
3023
|
+
register: et,
|
|
3024
|
+
handleSubmit: wt,
|
|
3025
|
+
watch: kr,
|
|
3026
|
+
setValue: J,
|
|
3027
|
+
getValues: gt,
|
|
3028
|
+
reset: _t,
|
|
3029
|
+
resetField: Sr,
|
|
3030
|
+
clearErrors: wr,
|
|
3031
|
+
unregister: Qe,
|
|
3032
|
+
setError: bt,
|
|
3033
|
+
setFocus: Vr,
|
|
3034
|
+
getFieldState: yt
|
|
3106
3035
|
};
|
|
3107
3036
|
return {
|
|
3108
|
-
...
|
|
3109
|
-
formControl:
|
|
3037
|
+
...Ct,
|
|
3038
|
+
formControl: Ct
|
|
3110
3039
|
};
|
|
3111
3040
|
}
|
|
3112
|
-
function
|
|
3113
|
-
const t =
|
|
3041
|
+
function Ze(e = {}) {
|
|
3042
|
+
const t = K.useRef(void 0), r = K.useRef(void 0), [n, i] = K.useState({
|
|
3114
3043
|
isDirty: !1,
|
|
3115
3044
|
isValidating: !1,
|
|
3116
3045
|
isLoading: te(e.defaultValues),
|
|
@@ -3134,107 +3063,107 @@ function Qe(e = {}) {
|
|
|
3134
3063
|
formState: n
|
|
3135
3064
|
}, e.defaultValues && !te(e.defaultValues) && e.formControl.reset(e.defaultValues, e.resetOptions);
|
|
3136
3065
|
else {
|
|
3137
|
-
const { formControl: o, ...
|
|
3066
|
+
const { formControl: o, ...a } = fs(e);
|
|
3138
3067
|
t.current = {
|
|
3139
|
-
...
|
|
3068
|
+
...a,
|
|
3140
3069
|
formState: n
|
|
3141
3070
|
};
|
|
3142
3071
|
}
|
|
3143
3072
|
const s = t.current.control;
|
|
3144
|
-
return s._options = e,
|
|
3073
|
+
return s._options = e, Xn(() => {
|
|
3145
3074
|
const o = s._subscribe({
|
|
3146
3075
|
formState: s._proxyFormState,
|
|
3147
|
-
callback: () =>
|
|
3076
|
+
callback: () => i({ ...s._formState }),
|
|
3148
3077
|
reRenderRoot: !0
|
|
3149
3078
|
});
|
|
3150
|
-
return
|
|
3151
|
-
...
|
|
3079
|
+
return i((a) => ({
|
|
3080
|
+
...a,
|
|
3152
3081
|
isReady: !0
|
|
3153
3082
|
})), s._formState.isReady = !0, o;
|
|
3154
|
-
}, [s]),
|
|
3083
|
+
}, [s]), K.useEffect(() => s._disableForm(e.disabled), [s, e.disabled]), K.useEffect(() => {
|
|
3155
3084
|
e.mode && (s._options.mode = e.mode), e.reValidateMode && (s._options.reValidateMode = e.reValidateMode);
|
|
3156
|
-
}, [s, e.mode, e.reValidateMode]),
|
|
3085
|
+
}, [s, e.mode, e.reValidateMode]), K.useEffect(() => {
|
|
3157
3086
|
e.errors && (s._setErrors(e.errors), s._focusError());
|
|
3158
|
-
}, [s, e.errors]),
|
|
3087
|
+
}, [s, e.errors]), K.useEffect(() => {
|
|
3159
3088
|
e.shouldUnregister && s._subjects.state.next({
|
|
3160
3089
|
values: s._getWatch()
|
|
3161
3090
|
});
|
|
3162
|
-
}, [s, e.shouldUnregister]),
|
|
3091
|
+
}, [s, e.shouldUnregister]), K.useEffect(() => {
|
|
3163
3092
|
if (s._proxyFormState.isDirty) {
|
|
3164
3093
|
const o = s._getDirty();
|
|
3165
3094
|
o !== n.isDirty && s._subjects.state.next({
|
|
3166
3095
|
isDirty: o
|
|
3167
3096
|
});
|
|
3168
3097
|
}
|
|
3169
|
-
}, [s, n.isDirty]),
|
|
3098
|
+
}, [s, n.isDirty]), K.useEffect(() => {
|
|
3170
3099
|
var o;
|
|
3171
3100
|
e.values && !he(e.values, r.current) ? (s._reset(e.values, {
|
|
3172
3101
|
keepFieldsRef: !0,
|
|
3173
3102
|
...s._options.resetOptions
|
|
3174
|
-
}), !((o = s._options.resetOptions) === null || o === void 0) && o.keepIsValid || s._setValid(), r.current = e.values,
|
|
3175
|
-
}, [s, e.values]),
|
|
3103
|
+
}), !((o = s._options.resetOptions) === null || o === void 0) && o.keepIsValid || s._setValid(), r.current = e.values, i((a) => ({ ...a }))) : s._resetDefaultValues();
|
|
3104
|
+
}, [s, e.values]), K.useEffect(() => {
|
|
3176
3105
|
s._state.mount || (s._setValid(), s._state.mount = !0), s._state.watch && (s._state.watch = !1, s._subjects.state.next({ ...s._formState })), s._removeUnmounted();
|
|
3177
|
-
}), t.current.formState =
|
|
3106
|
+
}), t.current.formState = K.useMemo(() => Jn(n, s), [s, n]), t.current;
|
|
3178
3107
|
}
|
|
3179
|
-
const
|
|
3108
|
+
const Kt = (e, t, r) => {
|
|
3180
3109
|
if (e && "reportValidity" in e) {
|
|
3181
3110
|
const n = k(r, t);
|
|
3182
3111
|
e.setCustomValidity(n && n.message || ""), e.reportValidity();
|
|
3183
3112
|
}
|
|
3184
|
-
},
|
|
3113
|
+
}, hs = (e, t) => {
|
|
3185
3114
|
for (const r in t.fields) {
|
|
3186
3115
|
const n = t.fields[r];
|
|
3187
|
-
n && n.ref && "reportValidity" in n.ref ?
|
|
3116
|
+
n && n.ref && "reportValidity" in n.ref ? Kt(n.ref, r, e) : n.refs && n.refs.forEach((i) => Kt(i, r, e));
|
|
3188
3117
|
}
|
|
3189
|
-
},
|
|
3190
|
-
t.shouldUseNativeValidation &&
|
|
3118
|
+
}, ps = (e, t) => {
|
|
3119
|
+
t.shouldUseNativeValidation && hs(e, t);
|
|
3191
3120
|
const r = {};
|
|
3192
3121
|
for (const n in e) {
|
|
3193
|
-
const
|
|
3194
|
-
if (
|
|
3122
|
+
const i = k(t.fields, n), s = Object.assign(e[n] || {}, { ref: i && i.ref });
|
|
3123
|
+
if (ms(t.names || Object.keys(e), n)) {
|
|
3195
3124
|
const o = Object.assign({}, k(r, n));
|
|
3196
|
-
|
|
3125
|
+
T(o, "root", s), T(r, n, o);
|
|
3197
3126
|
} else
|
|
3198
|
-
|
|
3127
|
+
T(r, n, s);
|
|
3199
3128
|
}
|
|
3200
3129
|
return r;
|
|
3201
|
-
},
|
|
3202
|
-
var
|
|
3203
|
-
return r === void 0 && (r = {}), function(n,
|
|
3130
|
+
}, ms = (e, t) => e.some((r) => r.startsWith(t + "."));
|
|
3131
|
+
var Ye = function(e, t, r) {
|
|
3132
|
+
return r === void 0 && (r = {}), function(n, i, s) {
|
|
3204
3133
|
try {
|
|
3205
3134
|
var o = !s.shouldUseNativeValidation && s.criteriaMode === "all";
|
|
3206
|
-
return Promise.resolve(
|
|
3207
|
-
if (
|
|
3208
|
-
for (var f = {};
|
|
3209
|
-
var p =
|
|
3135
|
+
return Promise.resolve(Pr(e, n, Object.assign({}, t, { abortPipeEarly: !o }))).then(function(a) {
|
|
3136
|
+
if (a.issues) {
|
|
3137
|
+
for (var f = {}; a.issues.length; ) {
|
|
3138
|
+
var p = a.issues[0], C = jr(p);
|
|
3210
3139
|
if (C && (f[C] || (f[C] = { message: p.message, type: p.type }), o)) {
|
|
3211
3140
|
var v = f[C].types, h = v && v[p.type];
|
|
3212
|
-
f[C] =
|
|
3141
|
+
f[C] = hr(C, o, f, p.type, h ? [].concat(h, p.message) : p.message);
|
|
3213
3142
|
}
|
|
3214
|
-
|
|
3143
|
+
a.issues.shift();
|
|
3215
3144
|
}
|
|
3216
|
-
return { values: {}, errors:
|
|
3145
|
+
return { values: {}, errors: ps(f, s) };
|
|
3217
3146
|
}
|
|
3218
|
-
return { values: r.raw ? n :
|
|
3147
|
+
return { values: r.raw ? n : a.output, errors: {} };
|
|
3219
3148
|
});
|
|
3220
|
-
} catch (
|
|
3221
|
-
return Promise.reject(
|
|
3149
|
+
} catch (a) {
|
|
3150
|
+
return Promise.reject(a);
|
|
3222
3151
|
}
|
|
3223
3152
|
};
|
|
3224
3153
|
};
|
|
3225
|
-
const
|
|
3154
|
+
const Gt = 27, Wt = 12, Jt = 10, gs = Fe("enum"), ys = (e, t) => {
|
|
3226
3155
|
const r = {
|
|
3227
3156
|
min: e.minSelected ?? 0,
|
|
3228
3157
|
max: e.maxSelected ?? e.options.length
|
|
3229
3158
|
};
|
|
3230
|
-
return
|
|
3231
|
-
checked: pe(
|
|
3159
|
+
return Ye(ge({
|
|
3160
|
+
checked: pe($r(Q(), Ur()), rr((n) => Object.entries(n).filter(([i, s]) => s).map(([i, s]) => i)), qe(r.max, t("validation_multiple_choice_max", {
|
|
3232
3161
|
count: r.max
|
|
3233
|
-
})),
|
|
3162
|
+
})), Oe(r.min, t("validation_multiple_choice_min", {
|
|
3234
3163
|
count: r.min
|
|
3235
3164
|
})))
|
|
3236
3165
|
}));
|
|
3237
|
-
},
|
|
3166
|
+
}, bs = tr(({
|
|
3238
3167
|
option: e,
|
|
3239
3168
|
...t
|
|
3240
3169
|
}, r) => c(we, {
|
|
@@ -3248,44 +3177,44 @@ const Zt = 27, Yt = 12, Qt = 10, vs = Fe("enum"), xs = (e, t) => {
|
|
|
3248
3177
|
htmlFor: t.id,
|
|
3249
3178
|
children: e.label
|
|
3250
3179
|
})]
|
|
3251
|
-
})),
|
|
3180
|
+
})), Xt = We("gutter-stable flex w-full flex-1 flex-wrap gap-2 overflow-y-auto rounded-xl p-2.5 pr-4", {
|
|
3252
3181
|
variants: {
|
|
3253
3182
|
variant: {
|
|
3254
3183
|
// In cases where there is only one option, we want to center it
|
|
3255
3184
|
singleOption: "justify-center",
|
|
3256
3185
|
// Two choices with exactly 1 min 1 max
|
|
3257
|
-
booleanLike:
|
|
3186
|
+
booleanLike: lr
|
|
3258
3187
|
}
|
|
3259
3188
|
}
|
|
3260
|
-
}),
|
|
3189
|
+
}), vs = ({
|
|
3261
3190
|
input: e,
|
|
3262
3191
|
onSubmitSuccess: t
|
|
3263
3192
|
}) => {
|
|
3264
3193
|
var C, v;
|
|
3265
|
-
const r = e.key ? (C =
|
|
3194
|
+
const r = e.key ? (C = D.current$.value.flow) == null ? void 0 : C.data.submissions[e.key] : void 0, n = (e.config.minSelected === 1 || e.config.minSelected === void 0) && e.config.maxSelected === 1, i = n && e.config.options.length === 2, {
|
|
3266
3195
|
t: s
|
|
3267
3196
|
} = Y(), {
|
|
3268
3197
|
register: o,
|
|
3269
|
-
handleSubmit:
|
|
3198
|
+
handleSubmit: a,
|
|
3270
3199
|
formState: {
|
|
3271
3200
|
errors: f
|
|
3272
3201
|
}
|
|
3273
|
-
} =
|
|
3202
|
+
} = Ze({
|
|
3274
3203
|
defaultValues: {
|
|
3275
|
-
checked: n ? {} :
|
|
3204
|
+
checked: n ? {} : gs(r) ? Object.fromEntries(r.value.map((h) => [h, !0])) : {}
|
|
3276
3205
|
},
|
|
3277
|
-
resolver:
|
|
3278
|
-
}), p =
|
|
3279
|
-
return
|
|
3206
|
+
resolver: ys(e.config, s)
|
|
3207
|
+
}), p = ut();
|
|
3208
|
+
return i ? c("ul", {
|
|
3280
3209
|
style: {
|
|
3281
|
-
maxHeight: 6.5 *
|
|
3210
|
+
maxHeight: 6.5 * Gt + 5 * Wt + 2 * Jt
|
|
3282
3211
|
},
|
|
3283
|
-
class:
|
|
3212
|
+
class: Xt({
|
|
3284
3213
|
variant: "booleanLike"
|
|
3285
3214
|
}),
|
|
3286
3215
|
children: e.config.options.map((h, y) => c("li", {
|
|
3287
|
-
class:
|
|
3288
|
-
children: c(
|
|
3216
|
+
class: cr,
|
|
3217
|
+
children: c(ur, {
|
|
3289
3218
|
type: "submit",
|
|
3290
3219
|
ref: (b) => {
|
|
3291
3220
|
b && y === 0 && (p.current = b);
|
|
@@ -3300,7 +3229,7 @@ const Zt = 27, Yt = 12, Qt = 10, vs = Fe("enum"), xs = (e, t) => {
|
|
|
3300
3229
|
}, h.value))
|
|
3301
3230
|
}) : c("form", {
|
|
3302
3231
|
noValidate: !0,
|
|
3303
|
-
onSubmit: (h) =>
|
|
3232
|
+
onSubmit: (h) => a((y) => {
|
|
3304
3233
|
const b = y.checked;
|
|
3305
3234
|
t({
|
|
3306
3235
|
type: "enum",
|
|
@@ -3311,9 +3240,9 @@ const Zt = 27, Yt = 12, Qt = 10, vs = Fe("enum"), xs = (e, t) => {
|
|
|
3311
3240
|
class: "flex items-center gap-1",
|
|
3312
3241
|
children: [c("ul", {
|
|
3313
3242
|
style: {
|
|
3314
|
-
maxHeight: 6.5 *
|
|
3243
|
+
maxHeight: 6.5 * Gt + 5 * Wt + 2 * Jt
|
|
3315
3244
|
},
|
|
3316
|
-
class:
|
|
3245
|
+
class: Xt({
|
|
3317
3246
|
variant: e.config.options.length === 1 ? "singleOption" : void 0
|
|
3318
3247
|
}),
|
|
3319
3248
|
children: e.config.options.map((h, y) => {
|
|
@@ -3323,7 +3252,7 @@ const Zt = 27, Yt = 12, Qt = 10, vs = Fe("enum"), xs = (e, t) => {
|
|
|
3323
3252
|
} = o(b);
|
|
3324
3253
|
return c("li", {
|
|
3325
3254
|
class: "relative",
|
|
3326
|
-
children: c(
|
|
3255
|
+
children: c(bs, {
|
|
3327
3256
|
option: h,
|
|
3328
3257
|
autoFocus: y === 0,
|
|
3329
3258
|
ref: (x) => {
|
|
@@ -3356,43 +3285,43 @@ const Zt = 27, Yt = 12, Qt = 10, vs = Fe("enum"), xs = (e, t) => {
|
|
|
3356
3285
|
})
|
|
3357
3286
|
})]
|
|
3358
3287
|
});
|
|
3359
|
-
},
|
|
3360
|
-
const r = e.min ?? Number.MIN_SAFE_INTEGER, n = e.max ?? Number.MAX_SAFE_INTEGER,
|
|
3361
|
-
return
|
|
3362
|
-
number: pe(
|
|
3288
|
+
}, xs = Fe("number"), ws = (e, t) => {
|
|
3289
|
+
const r = e.min ?? Number.MIN_SAFE_INTEGER, n = e.max ?? Number.MAX_SAFE_INTEGER, i = e.decimalCases ?? 0;
|
|
3290
|
+
return Ye(ge({
|
|
3291
|
+
number: pe(Kr(t("validation_number")), Hr(r, t("validation_number_min", {
|
|
3363
3292
|
min: r
|
|
3364
|
-
})),
|
|
3293
|
+
})), qr(n, t("validation_number_max", {
|
|
3365
3294
|
max: n
|
|
3366
|
-
})),
|
|
3367
|
-
count:
|
|
3295
|
+
})), zr((s) => s === Number(s.toFixed(i)), t("validation_number_decimal_cases", {
|
|
3296
|
+
count: i
|
|
3368
3297
|
})))
|
|
3369
3298
|
}));
|
|
3370
|
-
},
|
|
3299
|
+
}, ks = ({
|
|
3371
3300
|
input: e,
|
|
3372
3301
|
onSubmitSuccess: t
|
|
3373
3302
|
}) => {
|
|
3374
3303
|
var v;
|
|
3375
|
-
const r = e.config.defaultValue, n = e.key ? (v =
|
|
3376
|
-
t:
|
|
3304
|
+
const r = e.config.defaultValue, n = e.key ? (v = D.current$.value.flow) == null ? void 0 : v.data.submissions[e.key] : void 0, {
|
|
3305
|
+
t: i
|
|
3377
3306
|
} = Y(), {
|
|
3378
3307
|
register: s,
|
|
3379
3308
|
handleSubmit: o,
|
|
3380
3309
|
formState: {
|
|
3381
|
-
errors:
|
|
3310
|
+
errors: a
|
|
3382
3311
|
}
|
|
3383
|
-
} =
|
|
3312
|
+
} = Ze({
|
|
3384
3313
|
defaultValues: {
|
|
3385
|
-
number: r ? Number(r) :
|
|
3314
|
+
number: r ? Number(r) : xs(n) ? n.value : void 0
|
|
3386
3315
|
},
|
|
3387
|
-
resolver:
|
|
3316
|
+
resolver: ws(e.config, i)
|
|
3388
3317
|
}), {
|
|
3389
3318
|
ref: f,
|
|
3390
3319
|
...p
|
|
3391
3320
|
} = s("number", {
|
|
3392
3321
|
required: !e.config.optional,
|
|
3393
3322
|
valueAsNumber: !0
|
|
3394
|
-
}), C =
|
|
3395
|
-
return
|
|
3323
|
+
}), C = ue();
|
|
3324
|
+
return xe(() => {
|
|
3396
3325
|
C.current && (C.current.focus(), C.current.select());
|
|
3397
3326
|
}, []), c("form", {
|
|
3398
3327
|
class: "flex flex-col gap-1 p-2.5",
|
|
@@ -3419,7 +3348,7 @@ const Zt = 27, Yt = 12, Qt = 10, vs = Fe("enum"), xs = (e, t) => {
|
|
|
3419
3348
|
type: "text",
|
|
3420
3349
|
min: e.config.min,
|
|
3421
3350
|
max: e.config.max,
|
|
3422
|
-
class:
|
|
3351
|
+
class: $e({
|
|
3423
3352
|
optional: e.config.optional,
|
|
3424
3353
|
className: "[type=number:-webkit-inner-spin-button] w-full rounded-full [-webkit-outer-spin-button:none]"
|
|
3425
3354
|
}),
|
|
@@ -3430,16 +3359,16 @@ const Zt = 27, Yt = 12, Qt = 10, vs = Fe("enum"), xs = (e, t) => {
|
|
|
3430
3359
|
})]
|
|
3431
3360
|
}), c(ke, {})]
|
|
3432
3361
|
}), c(Ie, {
|
|
3433
|
-
error:
|
|
3362
|
+
error: a.number
|
|
3434
3363
|
})]
|
|
3435
3364
|
});
|
|
3436
|
-
},
|
|
3365
|
+
}, _s = (e) => {
|
|
3437
3366
|
if (e === "")
|
|
3438
3367
|
return {
|
|
3439
3368
|
countryCode: "",
|
|
3440
3369
|
phoneNumber: ""
|
|
3441
3370
|
};
|
|
3442
|
-
const t = Object.entries(
|
|
3371
|
+
const t = Object.entries(ct).find((i) => e.startsWith(i[1])), r = t ? t[1] : "", n = e.replace(r, "");
|
|
3443
3372
|
return /^\d+$/.test(n) ? {
|
|
3444
3373
|
countryCode: r,
|
|
3445
3374
|
phoneNumber: n
|
|
@@ -3447,39 +3376,39 @@ const Zt = 27, Yt = 12, Qt = 10, vs = Fe("enum"), xs = (e, t) => {
|
|
|
3447
3376
|
countryCode: "",
|
|
3448
3377
|
phoneNumber: ""
|
|
3449
3378
|
};
|
|
3450
|
-
},
|
|
3451
|
-
const t = pe(Q(e("validation_country_code")),
|
|
3452
|
-
return
|
|
3379
|
+
}, Cs = "44", Ss = /^[0-9 ]+$/, Vs = Fe("string"), Es = Fe("phone"), Fs = (e) => {
|
|
3380
|
+
const t = pe(Q(e("validation_country_code")), nr(Ss, e("validation_country_code"))), r = pe(Q(e("validation_phone")), Oe(1, e("validation_phone")), rr((n) => n.replace(/[^0-9]/g, "")));
|
|
3381
|
+
return Ye(ge({
|
|
3453
3382
|
countryCode: t,
|
|
3454
3383
|
phoneNumber: r
|
|
3455
3384
|
}));
|
|
3456
|
-
},
|
|
3385
|
+
}, Is = ({
|
|
3457
3386
|
input: e,
|
|
3458
3387
|
onSubmitSuccess: t
|
|
3459
3388
|
}) => {
|
|
3460
3389
|
var E;
|
|
3461
|
-
const r = e.key ? (E =
|
|
3390
|
+
const r = e.key ? (E = D.current$.value.flow) == null ? void 0 : E.data.submissions[e.key] : void 0, {
|
|
3462
3391
|
t: n
|
|
3463
|
-
} = Y(), [
|
|
3464
|
-
register:
|
|
3392
|
+
} = Y(), [i, s] = se(), o = Vs(r) ? _s(r.value) : Es(r) ? r.value : void 0, {
|
|
3393
|
+
register: a,
|
|
3465
3394
|
handleSubmit: f,
|
|
3466
3395
|
formState: {
|
|
3467
3396
|
errors: p
|
|
3468
3397
|
},
|
|
3469
3398
|
watch: C
|
|
3470
|
-
} =
|
|
3399
|
+
} = Ze({
|
|
3471
3400
|
defaultValues: {
|
|
3472
|
-
countryCode: (o == null ? void 0 : o.countryCode) ?? e.config.defaultValue.countryCode ??
|
|
3401
|
+
countryCode: (o == null ? void 0 : o.countryCode) ?? e.config.defaultValue.countryCode ?? Cs,
|
|
3473
3402
|
phoneNumber: (o == null ? void 0 : o.phoneNumber) ?? e.config.defaultValue.phoneNumber ?? ""
|
|
3474
3403
|
},
|
|
3475
|
-
resolver:
|
|
3404
|
+
resolver: Fs(n)
|
|
3476
3405
|
}), {
|
|
3477
3406
|
ref: v,
|
|
3478
3407
|
...h
|
|
3479
|
-
} =
|
|
3408
|
+
} = a("phoneNumber", {
|
|
3480
3409
|
required: !e.config.optional
|
|
3481
|
-
}), y =
|
|
3482
|
-
return
|
|
3410
|
+
}), y = ue(), b = C("countryCode");
|
|
3411
|
+
return xe(() => {
|
|
3483
3412
|
y.current && (y.current.focus(), y.current.select());
|
|
3484
3413
|
}, []), c("form", {
|
|
3485
3414
|
noValidate: !0,
|
|
@@ -3492,10 +3421,10 @@ const Zt = 27, Yt = 12, Qt = 10, vs = Fe("enum"), xs = (e, t) => {
|
|
|
3492
3421
|
return s(n("validation_phone_min_chars", {
|
|
3493
3422
|
count: I
|
|
3494
3423
|
}));
|
|
3495
|
-
const
|
|
3496
|
-
if (
|
|
3424
|
+
const A = e.config.maxChars;
|
|
3425
|
+
if (A != null && O > A)
|
|
3497
3426
|
return s(n("validation_max_chars", {
|
|
3498
|
-
count:
|
|
3427
|
+
count: A
|
|
3499
3428
|
}));
|
|
3500
3429
|
e.config.submissionFormat === "phone" ? t({
|
|
3501
3430
|
type: "phone",
|
|
@@ -3518,10 +3447,10 @@ const Zt = 27, Yt = 12, Qt = 10, vs = Fe("enum"), xs = (e, t) => {
|
|
|
3518
3447
|
children: [c("span", {
|
|
3519
3448
|
children: ["+", b]
|
|
3520
3449
|
}), c("select", {
|
|
3521
|
-
...
|
|
3450
|
+
...a("countryCode", {}),
|
|
3522
3451
|
id: `isdk_phone_${e.key}`,
|
|
3523
3452
|
class: "absolute inset-0 opacity-0",
|
|
3524
|
-
children: Object.entries(
|
|
3453
|
+
children: Object.entries(ct).map(([V, x]) => c("option", {
|
|
3525
3454
|
value: x,
|
|
3526
3455
|
children: [V, " (+", x, ")"]
|
|
3527
3456
|
}, V))
|
|
@@ -3538,7 +3467,7 @@ const Zt = 27, Yt = 12, Qt = 10, vs = Fe("enum"), xs = (e, t) => {
|
|
|
3538
3467
|
ref: (V) => {
|
|
3539
3468
|
V && (y.current = V), v(V);
|
|
3540
3469
|
},
|
|
3541
|
-
class:
|
|
3470
|
+
class: $e({
|
|
3542
3471
|
optional: e.config.optional,
|
|
3543
3472
|
className: "min-w-0 flex-1 rounded-r-full"
|
|
3544
3473
|
}),
|
|
@@ -3550,11 +3479,11 @@ const Zt = 27, Yt = 12, Qt = 10, vs = Fe("enum"), xs = (e, t) => {
|
|
|
3550
3479
|
}), c(ke, {})]
|
|
3551
3480
|
}), c(Ie, {
|
|
3552
3481
|
error: p.countryCode || p.phoneNumber || {
|
|
3553
|
-
message:
|
|
3482
|
+
message: i
|
|
3554
3483
|
}
|
|
3555
3484
|
})]
|
|
3556
3485
|
});
|
|
3557
|
-
},
|
|
3486
|
+
}, As = ({
|
|
3558
3487
|
input: e,
|
|
3559
3488
|
onSubmitSuccess: t
|
|
3560
3489
|
}) => c("div", {
|
|
@@ -3586,7 +3515,7 @@ const Zt = 27, Yt = 12, Qt = 10, vs = Fe("enum"), xs = (e, t) => {
|
|
|
3586
3515
|
})]
|
|
3587
3516
|
})
|
|
3588
3517
|
})
|
|
3589
|
-
}),
|
|
3518
|
+
}), Ls = {
|
|
3590
3519
|
date: {
|
|
3591
3520
|
type: "date",
|
|
3592
3521
|
inputMode: "text"
|
|
@@ -3605,7 +3534,7 @@ const Zt = 27, Yt = 12, Qt = 10, vs = Fe("enum"), xs = (e, t) => {
|
|
|
3605
3534
|
inputMode: "url",
|
|
3606
3535
|
formNoValidate: !0
|
|
3607
3536
|
}
|
|
3608
|
-
},
|
|
3537
|
+
}, Ms = Fe("string"), Ns = (e, t) => {
|
|
3609
3538
|
const r = {
|
|
3610
3539
|
maxLength: t("validation_max_chars", {
|
|
3611
3540
|
count: e.maxChars ?? 999
|
|
@@ -3614,39 +3543,39 @@ const Zt = 27, Yt = 12, Qt = 10, vs = Fe("enum"), xs = (e, t) => {
|
|
|
3614
3543
|
count: e.minChars ?? 1
|
|
3615
3544
|
})
|
|
3616
3545
|
};
|
|
3617
|
-
return
|
|
3546
|
+
return Ye(ge({
|
|
3618
3547
|
text: {
|
|
3619
|
-
date: pe(Q(t("validation_date")),
|
|
3620
|
-
email: pe(Q(t("validation_email")),
|
|
3621
|
-
text: pe(Q(),
|
|
3622
|
-
url: pe(Q(t("validation_url")),
|
|
3548
|
+
date: pe(Q(t("validation_date")), nr(/^\d{4}-\d{2}-\d{2}$/, t("validation_date"))),
|
|
3549
|
+
email: pe(Q(t("validation_email")), Gr(t("validation_email")), Oe(e.minChars ?? 1, r.minLength), qe(e.maxChars ?? 1 / 0, r.maxLength)),
|
|
3550
|
+
text: pe(Q(), Oe(e.minChars ?? 1, r.minLength), qe(e.maxChars ?? 1 / 0, r.maxLength)),
|
|
3551
|
+
url: pe(Q(t("validation_url")), Wr(t("validation_url")), Oe(e.minChars ?? 1, r.minLength), qe(e.maxChars ?? 1 / 0, r.maxLength))
|
|
3623
3552
|
}[e.format]
|
|
3624
3553
|
}));
|
|
3625
|
-
},
|
|
3554
|
+
}, Ts = ({
|
|
3626
3555
|
input: e,
|
|
3627
3556
|
onSubmitSuccess: t
|
|
3628
3557
|
}) => {
|
|
3629
3558
|
var v;
|
|
3630
3559
|
const {
|
|
3631
3560
|
t: r
|
|
3632
|
-
} = Y(), n = e.key ? (v =
|
|
3561
|
+
} = Y(), n = e.key ? (v = D.current$.value.flow) == null ? void 0 : v.data.submissions[e.key] : void 0, i = e.config.defaultValue, {
|
|
3633
3562
|
register: s,
|
|
3634
3563
|
handleSubmit: o,
|
|
3635
3564
|
formState: {
|
|
3636
|
-
errors:
|
|
3565
|
+
errors: a
|
|
3637
3566
|
}
|
|
3638
|
-
} =
|
|
3567
|
+
} = Ze({
|
|
3639
3568
|
defaultValues: {
|
|
3640
|
-
text:
|
|
3569
|
+
text: i || (Ms(n) ? n.value : "")
|
|
3641
3570
|
},
|
|
3642
|
-
resolver:
|
|
3571
|
+
resolver: Ns(e.config, r)
|
|
3643
3572
|
}), {
|
|
3644
3573
|
ref: f,
|
|
3645
3574
|
...p
|
|
3646
3575
|
} = s("text", {
|
|
3647
3576
|
required: !e.config.optional
|
|
3648
|
-
}), C =
|
|
3649
|
-
return
|
|
3577
|
+
}), C = ue();
|
|
3578
|
+
return xe(() => {
|
|
3650
3579
|
C.current && (C.current.focus(), C.current.select());
|
|
3651
3580
|
}, []), c("form", {
|
|
3652
3581
|
noValidate: !0,
|
|
@@ -3664,7 +3593,7 @@ const Zt = 27, Yt = 12, Qt = 10, vs = Fe("enum"), xs = (e, t) => {
|
|
|
3664
3593
|
children: [c("input", {
|
|
3665
3594
|
id: "chat-input",
|
|
3666
3595
|
...p,
|
|
3667
|
-
...
|
|
3596
|
+
...Ls[e.config.format],
|
|
3668
3597
|
autocomplete: "off",
|
|
3669
3598
|
autoCapitalize: "off",
|
|
3670
3599
|
autoCorrect: "off",
|
|
@@ -3673,7 +3602,7 @@ const Zt = 27, Yt = 12, Qt = 10, vs = Fe("enum"), xs = (e, t) => {
|
|
|
3673
3602
|
h && (C.current = h), f(h);
|
|
3674
3603
|
},
|
|
3675
3604
|
placeholder: e.config.placeholder,
|
|
3676
|
-
class:
|
|
3605
|
+
class: $e({
|
|
3677
3606
|
optional: !!e.config.optional,
|
|
3678
3607
|
className: "w-full rounded-full"
|
|
3679
3608
|
})
|
|
@@ -3683,31 +3612,31 @@ const Zt = 27, Yt = 12, Qt = 10, vs = Fe("enum"), xs = (e, t) => {
|
|
|
3683
3612
|
})]
|
|
3684
3613
|
}), c(ke, {})]
|
|
3685
3614
|
}), c(Ie, {
|
|
3686
|
-
error:
|
|
3615
|
+
error: a.text
|
|
3687
3616
|
})]
|
|
3688
3617
|
});
|
|
3689
|
-
},
|
|
3690
|
-
text:
|
|
3691
|
-
phone:
|
|
3692
|
-
"multiple-choice":
|
|
3693
|
-
boolean:
|
|
3694
|
-
file:
|
|
3695
|
-
submit:
|
|
3696
|
-
address:
|
|
3697
|
-
number:
|
|
3698
|
-
},
|
|
3618
|
+
}, Ds = {
|
|
3619
|
+
text: Ts,
|
|
3620
|
+
phone: Is,
|
|
3621
|
+
"multiple-choice": vs,
|
|
3622
|
+
boolean: Rn,
|
|
3623
|
+
file: zn,
|
|
3624
|
+
submit: As,
|
|
3625
|
+
address: Mn,
|
|
3626
|
+
number: ks
|
|
3627
|
+
}, Rs = ({
|
|
3699
3628
|
logger: e
|
|
3700
3629
|
}) => {
|
|
3701
3630
|
var s;
|
|
3702
|
-
const t = (s =
|
|
3703
|
-
return
|
|
3704
|
-
const o =
|
|
3631
|
+
const t = (s = D.current$.value.flow) == null ? void 0 : s.data.currentInput, [r, n] = kn(), i = ue(null);
|
|
3632
|
+
return D.inputHeight$.value = n.height, ce(() => {
|
|
3633
|
+
const o = i.current;
|
|
3705
3634
|
if (o)
|
|
3706
|
-
return o.addEventListener("transitionstart",
|
|
3707
|
-
o.removeEventListener("transitionstart",
|
|
3635
|
+
return o.addEventListener("transitionstart", X.scrollToEnd.smooth), o.addEventListener("transitioncancel", X.scrollToEnd.smooth), o.addEventListener("transitionend", X.scrollToEnd.smooth), () => {
|
|
3636
|
+
o.removeEventListener("transitionstart", X.scrollToEnd.smooth), o.removeEventListener("transitioncancel", X.scrollToEnd.smooth), o.removeEventListener("transitionend", X.scrollToEnd.smooth);
|
|
3708
3637
|
};
|
|
3709
3638
|
}, []), c("div", {
|
|
3710
|
-
ref:
|
|
3639
|
+
ref: i,
|
|
3711
3640
|
class: "ease-expo-out absolute bottom-0 w-full overflow-hidden rounded-b-3xl backdrop-blur-xl transition-all duration-700 will-change-[height]",
|
|
3712
3641
|
style: {
|
|
3713
3642
|
height: n.height
|
|
@@ -3716,10 +3645,10 @@ const Zt = 27, Yt = 12, Qt = 10, vs = Fe("enum"), xs = (e, t) => {
|
|
|
3716
3645
|
ref: r,
|
|
3717
3646
|
class: "border-divider flex flex-col justify-end border-t",
|
|
3718
3647
|
children: t ? (() => {
|
|
3719
|
-
const o =
|
|
3648
|
+
const o = Ds[t.type];
|
|
3720
3649
|
return c(o, {
|
|
3721
3650
|
logger: e,
|
|
3722
|
-
onSubmitSuccess:
|
|
3651
|
+
onSubmitSuccess: X.onSubmitSuccessFn$.value,
|
|
3723
3652
|
input: t
|
|
3724
3653
|
});
|
|
3725
3654
|
})() : c("div", {
|
|
@@ -3727,7 +3656,7 @@ const Zt = 27, Yt = 12, Qt = 10, vs = Fe("enum"), xs = (e, t) => {
|
|
|
3727
3656
|
children: [c("input", {
|
|
3728
3657
|
"aria-hidden": "true",
|
|
3729
3658
|
id: "chat-input",
|
|
3730
|
-
class:
|
|
3659
|
+
class: $e({
|
|
3731
3660
|
optional: !1,
|
|
3732
3661
|
className: "flex-grow rounded-full"
|
|
3733
3662
|
}),
|
|
@@ -3741,62 +3670,62 @@ const Zt = 27, Yt = 12, Qt = 10, vs = Fe("enum"), xs = (e, t) => {
|
|
|
3741
3670
|
})
|
|
3742
3671
|
});
|
|
3743
3672
|
};
|
|
3744
|
-
var
|
|
3673
|
+
var Os = function(e) {
|
|
3745
3674
|
return e instanceof RegExp;
|
|
3746
|
-
},
|
|
3675
|
+
}, Bs = function(t) {
|
|
3747
3676
|
var r = /[\\^$.*+?()[\]{}|]/g, n = RegExp(r.source);
|
|
3748
3677
|
return t && n.test(t) ? t.replace(r, "\\$&") : t;
|
|
3749
|
-
},
|
|
3678
|
+
}, xr = function(e) {
|
|
3750
3679
|
return typeof e == "string";
|
|
3751
|
-
},
|
|
3680
|
+
}, Ps = function(e) {
|
|
3752
3681
|
var t = [];
|
|
3753
3682
|
return e.forEach(function(r) {
|
|
3754
3683
|
Array.isArray(r) ? t = t.concat(r) : t.push(r);
|
|
3755
3684
|
}), t;
|
|
3756
3685
|
};
|
|
3757
|
-
function
|
|
3758
|
-
var n = 0,
|
|
3686
|
+
function js(e, t, r) {
|
|
3687
|
+
var n = 0, i = 0;
|
|
3759
3688
|
if (e === "")
|
|
3760
3689
|
return e;
|
|
3761
|
-
if (!e || !
|
|
3690
|
+
if (!e || !xr(e))
|
|
3762
3691
|
throw new TypeError("First argument to react-string-replace#replaceString must be a string");
|
|
3763
3692
|
var s = t;
|
|
3764
|
-
|
|
3765
|
-
for (var o = e.split(s),
|
|
3766
|
-
if (o[
|
|
3693
|
+
Os(s) || (s = new RegExp("(" + Bs(s) + ")", "gi"));
|
|
3694
|
+
for (var o = e.split(s), a = 1, f = o.length; a < f; a += 2) {
|
|
3695
|
+
if (o[a] === void 0 || o[a - 1] === void 0) {
|
|
3767
3696
|
console.warn("reactStringReplace: Encountered undefined value during string replacement. Your RegExp may not be working the way you expect.");
|
|
3768
3697
|
continue;
|
|
3769
3698
|
}
|
|
3770
|
-
|
|
3699
|
+
i = o[a].length, n += o[a - 1].length, o[a] = r(o[a], a, n), n += i;
|
|
3771
3700
|
}
|
|
3772
3701
|
return o;
|
|
3773
3702
|
}
|
|
3774
|
-
var
|
|
3775
|
-
return Array.isArray(t) || (t = [t]),
|
|
3776
|
-
return
|
|
3703
|
+
var $s = function(t, r, n) {
|
|
3704
|
+
return Array.isArray(t) || (t = [t]), Ps(t.map(function(i) {
|
|
3705
|
+
return xr(i) ? js(i, r, n) : i;
|
|
3777
3706
|
}));
|
|
3778
3707
|
};
|
|
3779
|
-
const Te = /* @__PURE__ */
|
|
3780
|
-
const t = Te(e,
|
|
3781
|
-
const [, f, p] = o.match(
|
|
3708
|
+
const Te = /* @__PURE__ */ Jr($s), Us = /(\[[^\]]+\]\([^)]+\))/g, zs = /\[([^\]]+)\]\(([^)]+)\)/, qs = /(https?:\/\/[^\s]+)/g, Hs = /_(.*?)_/g, Ks = /\*\*(.*?)\*\*/g, Gs = /\\n|\n/g, Zt = "text-accent-10 hover:text-accent-11 no-underline underline-offset-2 hover:underline", Ws = (e) => {
|
|
3709
|
+
const t = Te(e, Us, (o, a) => {
|
|
3710
|
+
const [, f, p] = o.match(zs) ?? [];
|
|
3782
3711
|
return p ? c("a", {
|
|
3783
|
-
class:
|
|
3712
|
+
class: Zt,
|
|
3784
3713
|
href: p,
|
|
3785
3714
|
children: f ?? p
|
|
3786
|
-
}, p +
|
|
3715
|
+
}, p + a) : c("span", {
|
|
3787
3716
|
children: "INVALID LINK"
|
|
3788
3717
|
});
|
|
3789
|
-
}), r = Te(t,
|
|
3790
|
-
class:
|
|
3718
|
+
}), r = Te(t, qs, (o, a) => c("a", {
|
|
3719
|
+
class: Zt,
|
|
3791
3720
|
href: o,
|
|
3792
3721
|
children: o
|
|
3793
|
-
}, o +
|
|
3722
|
+
}, o + a)), n = Te(r, Hs, (o, a) => c("em", {
|
|
3794
3723
|
children: o
|
|
3795
|
-
}, o +
|
|
3724
|
+
}, o + a)), i = Te(n, Ks, (o, a) => c("strong", {
|
|
3796
3725
|
children: o
|
|
3797
|
-
}, o +
|
|
3798
|
-
return Te(
|
|
3799
|
-
},
|
|
3726
|
+
}, o + a));
|
|
3727
|
+
return Te(i, Gs, (o, a) => c("br", {}, `br-${a}`));
|
|
3728
|
+
}, Js = We("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", {
|
|
3800
3729
|
variants: {
|
|
3801
3730
|
side: {
|
|
3802
3731
|
left: "bg-bubble-weak-bg text-neutral-12 shadow-surface-sm outline outline-1 outline-bubble-weak rounded-bl-md",
|
|
@@ -3810,24 +3739,24 @@ const Te = /* @__PURE__ */ Zr(qs), Hs = /(\[[^\]]+\]\([^)]+\))/g, Ks = /\[([^\]]
|
|
|
3810
3739
|
defaultVariants: {
|
|
3811
3740
|
side: "left"
|
|
3812
3741
|
}
|
|
3813
|
-
}),
|
|
3742
|
+
}), Xs = ({
|
|
3814
3743
|
children: e,
|
|
3815
3744
|
className: t,
|
|
3816
3745
|
animate: r,
|
|
3817
3746
|
side: n,
|
|
3818
|
-
...
|
|
3747
|
+
...i
|
|
3819
3748
|
}) => c("p", {
|
|
3820
3749
|
style: {
|
|
3821
3750
|
transformOrigin: n === "left" ? "0% 50%" : "100% 50%"
|
|
3822
3751
|
},
|
|
3823
|
-
class:
|
|
3752
|
+
class: Js({
|
|
3824
3753
|
className: t,
|
|
3825
3754
|
side: n,
|
|
3826
3755
|
animate: r
|
|
3827
3756
|
}),
|
|
3828
|
-
...
|
|
3757
|
+
...i,
|
|
3829
3758
|
children: e
|
|
3830
|
-
}),
|
|
3759
|
+
}), Zs = ({
|
|
3831
3760
|
message: e
|
|
3832
3761
|
}) => c("div", {
|
|
3833
3762
|
class: "bg-accent-3 flex w-full items-center justify-center overflow-hidden rounded-xl px-2 py-2",
|
|
@@ -3851,14 +3780,14 @@ const Te = /* @__PURE__ */ Zr(qs), Hs = /(\[[^\]]+\]\([^)]+\))/g, Ks = /\[([^\]]
|
|
|
3851
3780
|
})
|
|
3852
3781
|
})]
|
|
3853
3782
|
})
|
|
3854
|
-
}),
|
|
3783
|
+
}), Ys = ({
|
|
3855
3784
|
className: e,
|
|
3856
3785
|
...t
|
|
3857
|
-
}) => (
|
|
3858
|
-
|
|
3786
|
+
}) => (ce(() => {
|
|
3787
|
+
X.scrollToEnd.smooth();
|
|
3859
3788
|
}), c("div", {
|
|
3860
3789
|
"aria-hidden": !0,
|
|
3861
|
-
children:
|
|
3790
|
+
children: X.isBotTyping$.value === !0 ? c("div", {
|
|
3862
3791
|
"aria-label": "Typing…",
|
|
3863
3792
|
class: je("flex gap-1 p-4", e),
|
|
3864
3793
|
...t,
|
|
@@ -3871,10 +3800,10 @@ const Te = /* @__PURE__ */ Zr(qs), Hs = /(\[[^\]]+\]\([^)]+\))/g, Ks = /\[([^\]]
|
|
|
3871
3800
|
}
|
|
3872
3801
|
}))
|
|
3873
3802
|
}) : void 0
|
|
3874
|
-
})),
|
|
3803
|
+
})), Qs = {
|
|
3875
3804
|
bot: "left",
|
|
3876
3805
|
user: "right"
|
|
3877
|
-
},
|
|
3806
|
+
}, ea = We("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)]", {
|
|
3878
3807
|
variants: {
|
|
3879
3808
|
variant: {
|
|
3880
3809
|
info: "text-neutral-8",
|
|
@@ -3883,23 +3812,23 @@ const Te = /* @__PURE__ */ Zr(qs), Hs = /(\[[^\]]+\]\([^)]+\))/g, Ks = /\[([^\]]
|
|
|
3883
3812
|
success: "text-[#4CAF50]"
|
|
3884
3813
|
}
|
|
3885
3814
|
}
|
|
3886
|
-
}),
|
|
3815
|
+
}), ta = ({
|
|
3887
3816
|
lastSentMessageFooter: e
|
|
3888
3817
|
}) => {
|
|
3889
3818
|
var r;
|
|
3890
|
-
const t = ((r =
|
|
3891
|
-
return
|
|
3892
|
-
|
|
3819
|
+
const t = ((r = D.current$.value.flow) == null ? void 0 : r.data.messages) ?? [];
|
|
3820
|
+
return ce(() => {
|
|
3821
|
+
X.scrollToEnd.smooth();
|
|
3893
3822
|
}, [t.length]), c("ol", {
|
|
3894
3823
|
"aria-label": "Chat messages",
|
|
3895
3824
|
class: "mt-auto flex flex-col justify-end gap-2 p-2 pt-[calc(var(--header-height)+1rem)]",
|
|
3896
|
-
children: [t.map((n,
|
|
3825
|
+
children: [t.map((n, i) => c(we, {
|
|
3897
3826
|
children: c("li", {
|
|
3898
3827
|
class: "flex",
|
|
3899
|
-
children:
|
|
3828
|
+
children: it(n).with({
|
|
3900
3829
|
type: "system"
|
|
3901
3830
|
}, (s) => c("p", {
|
|
3902
|
-
class:
|
|
3831
|
+
class: ea({
|
|
3903
3832
|
variant: s.variant
|
|
3904
3833
|
}),
|
|
3905
3834
|
children: s.text
|
|
@@ -3907,17 +3836,17 @@ const Te = /* @__PURE__ */ Zr(qs), Hs = /(\[[^\]]+\]\([^)]+\))/g, Ks = /\[([^\]]
|
|
|
3907
3836
|
type: "text",
|
|
3908
3837
|
author: R.union("bot", "user")
|
|
3909
3838
|
}, (s) => {
|
|
3910
|
-
const o = s.author === "user" && !t.slice(
|
|
3839
|
+
const o = s.author === "user" && !t.slice(i + 1).some((p) => p.type === "text" && p.author === "user"), a = i === t.length - 1, f = s.author === "bot" ? Ws(s.text) : s.text;
|
|
3911
3840
|
return c(we, {
|
|
3912
|
-
children: [o ? e : null, c(
|
|
3913
|
-
animate:
|
|
3914
|
-
side:
|
|
3841
|
+
children: [o ? e : null, c(Xs, {
|
|
3842
|
+
animate: a,
|
|
3843
|
+
side: Qs[s.author],
|
|
3915
3844
|
children: f
|
|
3916
|
-
},
|
|
3845
|
+
}, i)]
|
|
3917
3846
|
});
|
|
3918
3847
|
}).with({
|
|
3919
3848
|
type: "link"
|
|
3920
|
-
}, (s) => c(
|
|
3849
|
+
}, (s) => c(Zs, {
|
|
3921
3850
|
message: s
|
|
3922
3851
|
})).with({
|
|
3923
3852
|
type: "image"
|
|
@@ -3929,7 +3858,7 @@ const Te = /* @__PURE__ */ Zr(qs), Hs = /(\[[^\]]+\]\([^)]+\))/g, Ks = /\[([^\]]
|
|
|
3929
3858
|
}
|
|
3930
3859
|
})).with({
|
|
3931
3860
|
type: "file"
|
|
3932
|
-
}, (s) => c(
|
|
3861
|
+
}, (s) => c(jn, {
|
|
3933
3862
|
class: s.author === "bot" ? void 0 : "ml-auto",
|
|
3934
3863
|
file: {
|
|
3935
3864
|
name: s.fileName,
|
|
@@ -3939,130 +3868,130 @@ const Te = /* @__PURE__ */ Zr(qs), Hs = /(\[[^\]]+\]\([^)]+\))/g, Ks = /\[([^\]]
|
|
|
3939
3868
|
type: "loading"
|
|
3940
3869
|
}, (s) => {
|
|
3941
3870
|
const o = t[t.length - 1];
|
|
3942
|
-
return !(s === o) ||
|
|
3871
|
+
return !(s === o) || X.isBotTyping$.value ? null : c("div", {
|
|
3943
3872
|
class: "flex flex-grow flex-col items-center justify-center",
|
|
3944
|
-
children: c(
|
|
3873
|
+
children: c(Xr, {
|
|
3945
3874
|
class: "text-neutral-6 h-8 w-8"
|
|
3946
3875
|
})
|
|
3947
3876
|
});
|
|
3948
3877
|
}).exhaustive()
|
|
3949
3878
|
})
|
|
3950
|
-
},
|
|
3879
|
+
}, i)), c(Ys, {}, "typing")]
|
|
3951
3880
|
});
|
|
3952
|
-
},
|
|
3881
|
+
}, oa = ({
|
|
3953
3882
|
logger: e,
|
|
3954
3883
|
apiClient: t,
|
|
3955
3884
|
analytics: r,
|
|
3956
|
-
|
|
3885
|
+
talentBankClient: n
|
|
3957
3886
|
}) => {
|
|
3958
3887
|
const {
|
|
3959
|
-
flow:
|
|
3960
|
-
} =
|
|
3961
|
-
me(
|
|
3962
|
-
const s =
|
|
3888
|
+
flow: i
|
|
3889
|
+
} = D.current$.value;
|
|
3890
|
+
me(i, "Flow is required to exist to show chatbot body");
|
|
3891
|
+
const s = D.viewState$.value, {
|
|
3963
3892
|
chatRef: o,
|
|
3964
|
-
chatService:
|
|
3965
|
-
} =
|
|
3893
|
+
chatService: a
|
|
3894
|
+
} = Zr(), {
|
|
3966
3895
|
t: f
|
|
3967
3896
|
} = Y(), [p, C] = se();
|
|
3968
|
-
return
|
|
3969
|
-
s === "maximised" &&
|
|
3970
|
-
}, [s]),
|
|
3897
|
+
return xe(() => {
|
|
3898
|
+
s === "maximised" && X.scrollToEnd.instant();
|
|
3899
|
+
}, [s]), xe(() => {
|
|
3971
3900
|
var x, _;
|
|
3972
3901
|
const {
|
|
3973
3902
|
state: v,
|
|
3974
3903
|
flow: h
|
|
3975
|
-
} =
|
|
3904
|
+
} = D.current$.peek();
|
|
3976
3905
|
if (v !== "loaded")
|
|
3977
3906
|
throw new Error(f("invalid_state"));
|
|
3978
3907
|
let y = h.data.nodeHistory.at(-1);
|
|
3979
|
-
if (
|
|
3908
|
+
if (X.scrollToEnd.instant(), D.setInput(void 0), h.data.isFinished)
|
|
3980
3909
|
return;
|
|
3981
|
-
y === void 0 ? (y =
|
|
3910
|
+
y === void 0 ? (y = Qt(i.nodes).id, D.setCurrentNodeId(y), r.log({
|
|
3982
3911
|
event: "FLOW_START",
|
|
3983
3912
|
properties: {
|
|
3984
|
-
flow_id:
|
|
3985
|
-
flow_version:
|
|
3913
|
+
flow_id: i.id,
|
|
3914
|
+
flow_version: i.version,
|
|
3986
3915
|
flow_session_id: h.data.flowSessionId,
|
|
3987
|
-
flow_build:
|
|
3988
|
-
job:
|
|
3916
|
+
flow_build: i.build,
|
|
3917
|
+
job: i.job
|
|
3989
3918
|
},
|
|
3990
|
-
customProperties: (x =
|
|
3991
|
-
})) :
|
|
3919
|
+
customProperties: (x = i.analytics) == null ? void 0 : x.customProperties
|
|
3920
|
+
})) : D.removeMessagesSentByNodeIds([y]);
|
|
3992
3921
|
const {
|
|
3993
3922
|
interpret: b,
|
|
3994
3923
|
abort: E,
|
|
3995
3924
|
undo: V
|
|
3996
|
-
} =
|
|
3997
|
-
context:
|
|
3925
|
+
} = tn({
|
|
3926
|
+
context: i.context,
|
|
3998
3927
|
analytics: {
|
|
3999
3928
|
service: r,
|
|
4000
|
-
customProperties: (_ =
|
|
3929
|
+
customProperties: (_ = i.analytics) == null ? void 0 : _.customProperties
|
|
4001
3930
|
},
|
|
4002
3931
|
apiClient: t,
|
|
4003
3932
|
logger: e,
|
|
4004
|
-
|
|
4005
|
-
flow:
|
|
4006
|
-
chatService:
|
|
3933
|
+
talentBankClient: n,
|
|
3934
|
+
flow: i,
|
|
3935
|
+
chatService: a,
|
|
4007
3936
|
t: f,
|
|
4008
3937
|
// We need to get fresh submissions, that’s why we call `peek` here.
|
|
4009
3938
|
getSubmissions: () => {
|
|
4010
3939
|
var I;
|
|
4011
|
-
return (I =
|
|
3940
|
+
return (I = D.current$.peek().flow) == null ? void 0 : I.data.submissions;
|
|
4012
3941
|
},
|
|
4013
|
-
onInterpret: (I) =>
|
|
3942
|
+
onInterpret: (I) => D.setCurrentNodeId(I.id),
|
|
4014
3943
|
onFlowEnd: async () => {
|
|
4015
3944
|
var O;
|
|
4016
|
-
|
|
4017
|
-
const I =
|
|
3945
|
+
D.markAsFinished();
|
|
3946
|
+
const I = D.current$.peek().flow;
|
|
4018
3947
|
me(I), r.log({
|
|
4019
3948
|
event: "FLOW_END",
|
|
4020
3949
|
properties: {
|
|
4021
|
-
flow_id:
|
|
4022
|
-
flow_version:
|
|
3950
|
+
flow_id: i.id,
|
|
3951
|
+
flow_version: i.version,
|
|
4023
3952
|
flow_session_id: I.data.flowSessionId,
|
|
4024
|
-
flow_build:
|
|
4025
|
-
job:
|
|
3953
|
+
flow_build: i.build,
|
|
3954
|
+
job: i.job
|
|
4026
3955
|
},
|
|
4027
|
-
customProperties: (O =
|
|
3956
|
+
customProperties: (O = i.analytics) == null ? void 0 : O.customProperties
|
|
4028
3957
|
});
|
|
4029
3958
|
}
|
|
4030
3959
|
});
|
|
4031
3960
|
return C(() => V), b(y), E;
|
|
4032
|
-
}, [r, t,
|
|
3961
|
+
}, [r, t, a, e, i, n, f]), c(we, {
|
|
4033
3962
|
children: [c("div", {
|
|
4034
3963
|
ref: o,
|
|
4035
3964
|
className: "hide-scrollbars relative flex w-full max-w-full flex-grow flex-col overflow-y-scroll",
|
|
4036
3965
|
style: {
|
|
4037
3966
|
WebkitOverflowScrolling: "touch",
|
|
4038
|
-
paddingBottom:
|
|
3967
|
+
paddingBottom: D.inputHeight$.value
|
|
4039
3968
|
},
|
|
4040
|
-
children: c(
|
|
4041
|
-
lastSentMessageFooter:
|
|
3969
|
+
children: c(ta, {
|
|
3970
|
+
lastSentMessageFooter: i.data.isFinished || !p ? null : c(na, {
|
|
4042
3971
|
undoFn: p
|
|
4043
3972
|
})
|
|
4044
3973
|
})
|
|
4045
|
-
}), c(
|
|
3974
|
+
}), c(Rs, {
|
|
4046
3975
|
logger: e
|
|
4047
3976
|
})]
|
|
4048
3977
|
});
|
|
4049
|
-
},
|
|
3978
|
+
}, ra = (e) => e.type === "identify" ? [] : "key" in e.data && e.data.key ? [e.data.key] : "keys" in e.data ? Object.values(e.data.keys).filter((t) => typeof t == "string") : [], na = ({
|
|
4050
3979
|
undoFn: e
|
|
4051
3980
|
}) => {
|
|
4052
3981
|
const {
|
|
4053
3982
|
t
|
|
4054
3983
|
} = Y();
|
|
4055
|
-
return c(
|
|
3984
|
+
return c(Yr, {
|
|
4056
3985
|
onClick: async () => {
|
|
4057
3986
|
const {
|
|
4058
3987
|
flow: r
|
|
4059
|
-
} =
|
|
3988
|
+
} = D.current$.peek();
|
|
4060
3989
|
me(r);
|
|
4061
3990
|
const {
|
|
4062
3991
|
removed: n
|
|
4063
|
-
} = e(r.data.nodeHistory),
|
|
4064
|
-
|
|
4065
|
-
...
|
|
3992
|
+
} = e(r.data.nodeHistory), i = r.data.nodeHistory.splice(-n);
|
|
3993
|
+
i.length !== 0 && (D.removeMessagesSentByNodeIds(i), D.setInput(void 0), i.pop(), i.map((s) => r.nodes.find((o) => o.id === s)).filter(Boolean).flatMap(ra).forEach((s) => delete r.data.submissions[s]), D.current$.value = {
|
|
3994
|
+
...D.current$.value
|
|
4066
3995
|
});
|
|
4067
3996
|
},
|
|
4068
3997
|
children: [c("title", {
|
|
@@ -4073,5 +4002,5 @@ const Te = /* @__PURE__ */ Zr(qs), Hs = /(\[[^\]]+\]\([^)]+\))/g, Ks = /\[([^\]]
|
|
|
4073
4002
|
});
|
|
4074
4003
|
};
|
|
4075
4004
|
export {
|
|
4076
|
-
|
|
4005
|
+
oa as ChatbotBody
|
|
4077
4006
|
};
|