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