@inploi/plugin-chatbot 14.5.0 → 14.7.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 +5 -5
- package/dist/{chatbot-body-389badb2.js → chatbot-body-8d36637a.js} +1221 -1204
- package/dist/chatbot-body-95e99884.cjs +5 -0
- package/dist/chatbot.idb.d.ts +1 -0
- package/dist/chatbot.state.d.ts +11 -6
- package/dist/i18n.d.ts +12 -6
- package/dist/index-51cb9a4f.cjs +5 -0
- package/dist/{index-985be818.js → index-8090d2e3.js} +1101 -1086
- package/dist/interpreter.d.ts +6 -4
- package/dist/plugin-chatbot.cjs +1 -1
- package/dist/plugin-chatbot.js +1 -1
- package/package.json +5 -5
- package/dist/chatbot-body-1daebc9e.cjs +0 -5
- package/dist/index-94e88490.cjs +0 -5
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { isApiErrorWithData as
|
|
1
|
+
import { W as yr, Z as ot, P as wt, Y as Ge, t as mr, g as gr, a as Ct, A as ss, Q as ns, I as as, j as br, _ as is, J as os, n as ls, C as $t, V as us, u as se, o as u, c as Oe, b as lt, h as ve, d as pe, i as Me, y as Ie, k as we, L as St, F as cs, s as $, p as vr, e as xr, f as ds, l as Re, X as qt, m as Q, q as ie, M as fs, z as ps, r as hs, S as wr, v as ys } from "./index-8090d2e3.js";
|
|
2
|
+
import { isApiErrorWithData as ms, ApiError as gs } from "@inploi/sdk";
|
|
3
3
|
const Ut = (e, r, t) => {
|
|
4
4
|
var s;
|
|
5
5
|
return e.log({
|
|
@@ -16,15 +16,15 @@ const Ut = (e, r, t) => {
|
|
|
16
16
|
});
|
|
17
17
|
};
|
|
18
18
|
var zt = ({ condition: e, context: r, submissions: t, ifBlock: s }) => {
|
|
19
|
-
let [
|
|
20
|
-
if (!
|
|
19
|
+
let [a, ...i] = e.compareKey.split(".");
|
|
20
|
+
if (!a)
|
|
21
21
|
return !1;
|
|
22
|
-
let n = yr({ context: r, key:
|
|
22
|
+
let n = yr({ context: r, key: a, path: i, submissions: t });
|
|
23
23
|
if (!n)
|
|
24
24
|
return !1;
|
|
25
25
|
switch (n.type) {
|
|
26
26
|
case "address": {
|
|
27
|
-
let o =
|
|
27
|
+
let o = wt(n.value, i);
|
|
28
28
|
switch (e.compare) {
|
|
29
29
|
case "equals":
|
|
30
30
|
return o === e.compareValue;
|
|
@@ -40,16 +40,16 @@ var zt = ({ condition: e, context: r, submissions: t, ifBlock: s }) => {
|
|
|
40
40
|
case "integration": {
|
|
41
41
|
if (typeof n.value != "object" || Array.isArray(n.value))
|
|
42
42
|
return !1;
|
|
43
|
-
let o =
|
|
43
|
+
let o = wt(n.value, i), c = { ...s, data: { compareKey: "_temp", compare: e.compare, compareValue: e.compareValue } };
|
|
44
44
|
switch (typeof o) {
|
|
45
45
|
case "boolean":
|
|
46
|
-
return
|
|
46
|
+
return Ke(c, { submissions: { _temp: { value: o, type: "boolean" } }, context: r });
|
|
47
47
|
case "string":
|
|
48
|
-
return
|
|
48
|
+
return Ke(c, { submissions: { _temp: { value: o, type: "string" } }, context: r });
|
|
49
49
|
case "number":
|
|
50
|
-
return
|
|
50
|
+
return Ke(c, { submissions: { _temp: { value: o, type: "number" } }, context: r });
|
|
51
51
|
case "object":
|
|
52
|
-
return Array.isArray(o) && o.every((
|
|
52
|
+
return Array.isArray(o) && o.every((p) => typeof p == "string") ? Ke(c, { submissions: { _temp: { value: o, type: "enum" } }, context: r }) : !1;
|
|
53
53
|
}
|
|
54
54
|
break;
|
|
55
55
|
}
|
|
@@ -65,7 +65,7 @@ var zt = ({ condition: e, context: r, submissions: t, ifBlock: s }) => {
|
|
|
65
65
|
}
|
|
66
66
|
case "phone":
|
|
67
67
|
case "string": {
|
|
68
|
-
let o = n.type === "phone" ?
|
|
68
|
+
let o = n.type === "phone" ? ot(n.value) : n.value;
|
|
69
69
|
switch (e.compare) {
|
|
70
70
|
case "equals":
|
|
71
71
|
return o === e.compareValue;
|
|
@@ -113,56 +113,56 @@ var zt = ({ condition: e, context: r, submissions: t, ifBlock: s }) => {
|
|
|
113
113
|
}
|
|
114
114
|
break;
|
|
115
115
|
}
|
|
116
|
-
},
|
|
116
|
+
}, Ke = (e, { context: r, submissions: t }) => {
|
|
117
117
|
let s = "combinator" in e.data ? e.data.conditions : [e.data];
|
|
118
118
|
if (("combinator" in e.data ? e.data.combinator : "and") === "or") {
|
|
119
|
-
for (let
|
|
120
|
-
if (zt({ condition:
|
|
119
|
+
for (let a of s)
|
|
120
|
+
if (zt({ condition: a, context: r, submissions: t, ifBlock: e }))
|
|
121
121
|
return !0;
|
|
122
122
|
return !1;
|
|
123
123
|
} else {
|
|
124
|
-
for (let
|
|
125
|
-
if (!zt({ condition:
|
|
124
|
+
for (let a of s)
|
|
125
|
+
if (!zt({ condition: a, context: r, submissions: t, ifBlock: e }))
|
|
126
126
|
return !1;
|
|
127
127
|
return !0;
|
|
128
128
|
}
|
|
129
|
-
},
|
|
130
|
-
let [n, ...o] =
|
|
129
|
+
}, bs = /{{\s*([^}]+?)\s*(?:\|\s*([^}]+?)\s*)?}}/g, vs = (e, { context: r, submissions: t }) => e.replace(bs, (s, a, i = "") => {
|
|
130
|
+
let [n, ...o] = a.trim().split("."), c = yr({ key: n, path: o, submissions: t, context: r });
|
|
131
131
|
if (!c)
|
|
132
|
-
return
|
|
132
|
+
return i;
|
|
133
133
|
switch (c.type) {
|
|
134
134
|
case "boolean":
|
|
135
135
|
return c.value === !0 ? "true" : "false";
|
|
136
136
|
case "file":
|
|
137
|
-
return c.value.map((
|
|
137
|
+
return c.value.map((p) => `${p.name} (${Ge(p.sizeKb)})`).join(", ");
|
|
138
138
|
case "enum":
|
|
139
139
|
return c.value.join(", ");
|
|
140
140
|
case "address":
|
|
141
|
-
return Object.values(c.value).filter((
|
|
141
|
+
return Object.values(c.value).filter((p) => p && p.trim().length > 0).join(", ");
|
|
142
142
|
case "number":
|
|
143
143
|
case "string":
|
|
144
|
-
return c.value ? c.value.toString() :
|
|
144
|
+
return c.value ? c.value.toString() : i;
|
|
145
145
|
case "phone":
|
|
146
|
-
return
|
|
146
|
+
return ot(c.value);
|
|
147
147
|
case "integration": {
|
|
148
148
|
if (typeof c.value != "object" || Array.isArray(c.value))
|
|
149
149
|
break;
|
|
150
|
-
let
|
|
151
|
-
switch (typeof
|
|
150
|
+
let p = wt(c.value, o);
|
|
151
|
+
switch (typeof p) {
|
|
152
152
|
case "boolean":
|
|
153
|
-
return
|
|
153
|
+
return p === !0 ? "true" : "false";
|
|
154
154
|
case "string":
|
|
155
|
-
return
|
|
155
|
+
return p;
|
|
156
156
|
case "number":
|
|
157
|
-
return
|
|
157
|
+
return p.toString();
|
|
158
158
|
case "object":
|
|
159
|
-
if (Array.isArray(
|
|
160
|
-
return
|
|
159
|
+
if (Array.isArray(p) && p.every((b) => typeof b == "string"))
|
|
160
|
+
return p.join(", ");
|
|
161
161
|
}
|
|
162
162
|
break;
|
|
163
163
|
}
|
|
164
164
|
}
|
|
165
|
-
return
|
|
165
|
+
return i;
|
|
166
166
|
});
|
|
167
167
|
const _r = ({
|
|
168
168
|
context: e,
|
|
@@ -170,63 +170,63 @@ const _r = ({
|
|
|
170
170
|
}) => ({
|
|
171
171
|
context: e,
|
|
172
172
|
submissions: r ?? {}
|
|
173
|
-
}),
|
|
173
|
+
}), he = (e, r) => vs(e, _r(r)), xs = (e, r) => Ke(e, _r(r)), kr = ({
|
|
174
174
|
node: e,
|
|
175
175
|
nodes: r,
|
|
176
176
|
stopWhen: t
|
|
177
177
|
}) => {
|
|
178
178
|
if ((t == null ? void 0 : t(e)) === !0)
|
|
179
179
|
return e;
|
|
180
|
-
const s = e.nextId ? r.find((
|
|
180
|
+
const s = e.nextId ? r.find((a) => a.id === e.nextId) : void 0;
|
|
181
181
|
if (s)
|
|
182
182
|
return kr({
|
|
183
183
|
node: s,
|
|
184
184
|
nodes: r,
|
|
185
185
|
stopWhen: t
|
|
186
186
|
});
|
|
187
|
-
},
|
|
187
|
+
}, ws = ({
|
|
188
188
|
childNode: e,
|
|
189
189
|
nodes: r
|
|
190
190
|
}) => {
|
|
191
|
-
const s = r.filter((
|
|
192
|
-
if (!
|
|
191
|
+
const s = r.filter((a) => a.type === "if-block").find((a) => {
|
|
192
|
+
if (!a.branchId)
|
|
193
193
|
return !1;
|
|
194
|
-
const
|
|
195
|
-
if (!
|
|
194
|
+
const i = r.find((o) => o.id === a.branchId);
|
|
195
|
+
if (!i)
|
|
196
196
|
return !1;
|
|
197
197
|
const n = kr({
|
|
198
|
-
node:
|
|
198
|
+
node: i,
|
|
199
199
|
nodes: r,
|
|
200
200
|
stopWhen: (o) => o.id === e.id
|
|
201
201
|
});
|
|
202
202
|
return !(!n || n.id !== e.id);
|
|
203
203
|
});
|
|
204
204
|
if (s != null && s.nextId)
|
|
205
|
-
return r.find((
|
|
206
|
-
},
|
|
205
|
+
return r.find((a) => a.id === s.nextId);
|
|
206
|
+
}, _s = ({
|
|
207
207
|
flow: e,
|
|
208
208
|
analytics: r,
|
|
209
209
|
logger: t,
|
|
210
210
|
talentBankClient: s,
|
|
211
|
-
context:
|
|
212
|
-
apiClient:
|
|
211
|
+
context: a,
|
|
212
|
+
apiClient: i,
|
|
213
213
|
getSubmissions: n,
|
|
214
214
|
getApplicationRecovery: o,
|
|
215
215
|
setApplicationRecovery: c,
|
|
216
|
-
chatService:
|
|
216
|
+
chatService: p,
|
|
217
217
|
persistWriteBarrier: b,
|
|
218
218
|
onFlowEnd: x,
|
|
219
|
-
onInterpret:
|
|
219
|
+
onInterpret: h,
|
|
220
220
|
t: m
|
|
221
221
|
}) => {
|
|
222
222
|
var I;
|
|
223
223
|
let C = new AbortController();
|
|
224
224
|
(I = e.data).startedWriteNodeIds ?? (I.startedWriteNodeIds = e.nodes.flatMap((y) => {
|
|
225
|
-
var M,
|
|
225
|
+
var M, O;
|
|
226
226
|
if (y.type !== "integration-application-submit" || !e.data.nodeHistory.includes(y.id))
|
|
227
227
|
return [];
|
|
228
228
|
const _ = y.data.key ? (M = n()) == null ? void 0 : M[y.data.key] : void 0;
|
|
229
|
-
return (_ == null ? void 0 : _.type) === "integration" && ((
|
|
229
|
+
return (_ == null ? void 0 : _.type) === "integration" && ((O = mr(_.value)) == null ? void 0 : O.verdict) === "not_submitted" ? [] : [y.id];
|
|
230
230
|
}));
|
|
231
231
|
const E = {
|
|
232
232
|
...r.service,
|
|
@@ -237,101 +237,101 @@ const _r = ({
|
|
|
237
237
|
...r.customProperties
|
|
238
238
|
}
|
|
239
239
|
})
|
|
240
|
-
},
|
|
241
|
-
const
|
|
242
|
-
if (
|
|
240
|
+
}, V = async (y, _) => {
|
|
241
|
+
const F = C.signal;
|
|
242
|
+
if (F.aborted)
|
|
243
243
|
return;
|
|
244
|
-
const M = n(),
|
|
245
|
-
var
|
|
246
|
-
return
|
|
244
|
+
const M = n(), O = o(), G = (O == null ? void 0 : O.submitNodeId) === y.id ? e.nodes.find((L) => {
|
|
245
|
+
var U;
|
|
246
|
+
return L.id === O.fileQuestionNodeId && L.type === "question-file" && ((U = M == null ? void 0 : M[L.data.key]) == null ? void 0 : U.type) !== "file";
|
|
247
247
|
}) : void 0;
|
|
248
248
|
if (G)
|
|
249
|
-
return
|
|
250
|
-
|
|
249
|
+
return V(G, _);
|
|
250
|
+
h == null || h(y, _);
|
|
251
251
|
try {
|
|
252
|
-
await
|
|
252
|
+
await ks({
|
|
253
253
|
flow: e,
|
|
254
254
|
analytics: E,
|
|
255
255
|
logger: t,
|
|
256
256
|
talentBankClient: s,
|
|
257
|
-
apiClient:
|
|
258
|
-
context:
|
|
257
|
+
apiClient: i,
|
|
258
|
+
context: a,
|
|
259
259
|
node: y,
|
|
260
260
|
submissions: M,
|
|
261
|
-
applicationRecovery:
|
|
262
|
-
setApplicationRecovery: async (
|
|
263
|
-
if (!
|
|
261
|
+
applicationRecovery: O,
|
|
262
|
+
setApplicationRecovery: async (L) => {
|
|
263
|
+
if (!F.aborted)
|
|
264
264
|
try {
|
|
265
|
-
await c(
|
|
266
|
-
} catch (
|
|
267
|
-
t.error("Failed to persist application recovery",
|
|
265
|
+
await c(L);
|
|
266
|
+
} catch (U) {
|
|
267
|
+
t.error("Failed to persist application recovery", U);
|
|
268
268
|
}
|
|
269
269
|
},
|
|
270
|
-
forceSubmitConfirmation: (
|
|
270
|
+
forceSubmitConfirmation: (O == null ? void 0 : O.submitNodeId) === y.id,
|
|
271
271
|
persistWriteBarrier: b,
|
|
272
|
-
signal:
|
|
272
|
+
signal: F,
|
|
273
273
|
t: m,
|
|
274
274
|
chat: {
|
|
275
|
-
sendMessage: async (
|
|
275
|
+
sendMessage: async (L) => p.send({
|
|
276
276
|
groupId: y.id,
|
|
277
|
-
message:
|
|
278
|
-
signal:
|
|
277
|
+
message: L,
|
|
278
|
+
signal: F
|
|
279
279
|
}),
|
|
280
|
-
userInput: async (
|
|
281
|
-
input:
|
|
282
|
-
signal:
|
|
280
|
+
userInput: async (L) => p.input({
|
|
281
|
+
input: L,
|
|
282
|
+
signal: F
|
|
283
283
|
}),
|
|
284
|
-
setSubmission: (
|
|
285
|
-
|
|
284
|
+
setSubmission: (L, U) => {
|
|
285
|
+
F.aborted || p.setSubmission(L, U);
|
|
286
286
|
}
|
|
287
287
|
},
|
|
288
|
-
next: (
|
|
289
|
-
if (
|
|
288
|
+
next: (L) => {
|
|
289
|
+
if (F.aborted)
|
|
290
290
|
return;
|
|
291
|
-
const
|
|
291
|
+
const U = (O == null ? void 0 : O.fileQuestionNodeId) === y.id ? O.submitNodeId : L, D = U ? e.nodes.find((T) => T.id === U) : ws({
|
|
292
292
|
childNode: y,
|
|
293
293
|
nodes: e.nodes
|
|
294
294
|
});
|
|
295
|
-
return
|
|
295
|
+
return D ? V(D, y) : x == null ? void 0 : x(y);
|
|
296
296
|
},
|
|
297
297
|
end: () => {
|
|
298
|
-
|
|
298
|
+
F.aborted || x == null || x(y);
|
|
299
299
|
}
|
|
300
300
|
});
|
|
301
|
-
} catch (
|
|
302
|
-
if (
|
|
301
|
+
} catch (L) {
|
|
302
|
+
if (L instanceof ss)
|
|
303
303
|
return;
|
|
304
|
-
throw
|
|
304
|
+
throw L;
|
|
305
305
|
}
|
|
306
306
|
};
|
|
307
307
|
return {
|
|
308
308
|
interpret: async (y) => {
|
|
309
|
-
const _ = e.nodes.find((
|
|
310
|
-
return
|
|
309
|
+
const _ = e.nodes.find((F) => F.id === y) ?? gr(e.nodes);
|
|
310
|
+
return V(_);
|
|
311
311
|
},
|
|
312
312
|
undo: (y) => {
|
|
313
|
-
var
|
|
314
|
-
if ((
|
|
313
|
+
var U;
|
|
314
|
+
if ((U = e.data.startedWriteNodeIds) != null && U.length || e.data.isFinished)
|
|
315
315
|
return {
|
|
316
316
|
removed: 0
|
|
317
317
|
};
|
|
318
|
-
const _ =
|
|
319
|
-
if (
|
|
318
|
+
const _ = Ct(e), F = _ ? y.lastIndexOf(_) : -1, M = e.nodes.find((D) => D.id === _);
|
|
319
|
+
if (F === -1 || !M)
|
|
320
320
|
return {
|
|
321
321
|
removed: 0
|
|
322
322
|
};
|
|
323
|
-
const
|
|
323
|
+
const O = e.nodes.find((D) => D.id === y[y.length - 1]);
|
|
324
324
|
C.abort();
|
|
325
|
-
const G = y.splice(
|
|
326
|
-
e.data.messages = e.data.messages.filter((
|
|
327
|
-
const
|
|
328
|
-
for (const
|
|
329
|
-
const
|
|
330
|
-
if (!(!
|
|
331
|
-
for (const w of Object.values(
|
|
332
|
-
typeof w == "string" && delete
|
|
325
|
+
const G = y.splice(F);
|
|
326
|
+
e.data.messages = e.data.messages.filter((D) => !D.groupId || !G.includes(D.groupId)), e.data.currentInput = null;
|
|
327
|
+
const L = n();
|
|
328
|
+
for (const D of G.slice(1)) {
|
|
329
|
+
const T = e.nodes.find((w) => w.id === D);
|
|
330
|
+
if (!(!T || !L || T.id === _) && ("key" in T.data && T.data.key && delete L[T.data.key], "keys" in T.data))
|
|
331
|
+
for (const w of Object.values(T.data.keys))
|
|
332
|
+
typeof w == "string" && delete L[w];
|
|
333
333
|
}
|
|
334
|
-
return C = new AbortController(),
|
|
334
|
+
return C = new AbortController(), V(M, O), {
|
|
335
335
|
removed: G.length
|
|
336
336
|
};
|
|
337
337
|
},
|
|
@@ -340,7 +340,7 @@ const _r = ({
|
|
|
340
340
|
}
|
|
341
341
|
};
|
|
342
342
|
};
|
|
343
|
-
async function
|
|
343
|
+
async function ks(e) {
|
|
344
344
|
const r = e.node;
|
|
345
345
|
switch (r.type) {
|
|
346
346
|
case "flow-section":
|
|
@@ -350,94 +350,94 @@ async function _s(e) {
|
|
|
350
350
|
text: r.data.title
|
|
351
351
|
}), e.next(r.nextId);
|
|
352
352
|
case "pre-apply-result":
|
|
353
|
-
return
|
|
353
|
+
return Ks({
|
|
354
354
|
...e,
|
|
355
355
|
node: r
|
|
356
356
|
});
|
|
357
357
|
case "text":
|
|
358
|
-
return
|
|
358
|
+
return Os({
|
|
359
359
|
...e,
|
|
360
360
|
node: r
|
|
361
361
|
});
|
|
362
362
|
case "image":
|
|
363
|
-
return
|
|
363
|
+
return Rs({
|
|
364
364
|
...e,
|
|
365
365
|
node: r
|
|
366
366
|
});
|
|
367
367
|
case "question-text":
|
|
368
|
-
return
|
|
368
|
+
return Ps({
|
|
369
369
|
...e,
|
|
370
370
|
node: r
|
|
371
371
|
});
|
|
372
372
|
case "question-enum":
|
|
373
|
-
return
|
|
373
|
+
return $s({
|
|
374
374
|
...e,
|
|
375
375
|
node: r
|
|
376
376
|
});
|
|
377
377
|
case "question-number":
|
|
378
|
-
return
|
|
378
|
+
return Bs({
|
|
379
379
|
...e,
|
|
380
380
|
node: r
|
|
381
381
|
});
|
|
382
382
|
case "question-phone":
|
|
383
|
-
return
|
|
383
|
+
return js({
|
|
384
384
|
...e,
|
|
385
385
|
node: r
|
|
386
386
|
});
|
|
387
387
|
case "question-boolean":
|
|
388
|
-
return
|
|
388
|
+
return qs({
|
|
389
389
|
...e,
|
|
390
390
|
node: r
|
|
391
391
|
});
|
|
392
392
|
case "question-file":
|
|
393
|
-
return
|
|
393
|
+
return zs({
|
|
394
394
|
...e,
|
|
395
395
|
node: r
|
|
396
396
|
});
|
|
397
397
|
case "question-address":
|
|
398
|
-
return
|
|
398
|
+
return Us({
|
|
399
399
|
...e,
|
|
400
400
|
node: r
|
|
401
401
|
});
|
|
402
402
|
case "end-flow":
|
|
403
|
-
return
|
|
403
|
+
return Ws({
|
|
404
404
|
...e,
|
|
405
405
|
node: r
|
|
406
406
|
});
|
|
407
407
|
case "if-block":
|
|
408
|
-
return
|
|
408
|
+
return Ts({
|
|
409
409
|
...e,
|
|
410
410
|
node: r
|
|
411
411
|
});
|
|
412
412
|
case "jump":
|
|
413
|
-
return
|
|
413
|
+
return Is({
|
|
414
414
|
...e,
|
|
415
415
|
node: r
|
|
416
416
|
});
|
|
417
417
|
case "link":
|
|
418
|
-
return
|
|
418
|
+
return Ds({
|
|
419
419
|
...e,
|
|
420
420
|
node: r
|
|
421
421
|
});
|
|
422
422
|
case "integration-application-submit":
|
|
423
|
-
return
|
|
423
|
+
return Ls({
|
|
424
424
|
...e,
|
|
425
425
|
node: r
|
|
426
426
|
});
|
|
427
427
|
case "add-submission":
|
|
428
|
-
return
|
|
428
|
+
return As({
|
|
429
429
|
...e,
|
|
430
430
|
node: r
|
|
431
431
|
});
|
|
432
432
|
case "integration-workflow-get":
|
|
433
433
|
throw Error("Workflow should be unreachable");
|
|
434
434
|
case "check-duplicate":
|
|
435
|
-
return
|
|
435
|
+
return Ss({
|
|
436
436
|
...e,
|
|
437
437
|
node: r
|
|
438
438
|
});
|
|
439
439
|
case "feedback":
|
|
440
|
-
return
|
|
440
|
+
return Cs({
|
|
441
441
|
...e,
|
|
442
442
|
node: r
|
|
443
443
|
});
|
|
@@ -445,19 +445,19 @@ async function _s(e) {
|
|
|
445
445
|
throw new Error(`Unknown node: ${JSON.stringify(r)}`);
|
|
446
446
|
}
|
|
447
447
|
}
|
|
448
|
-
async function
|
|
448
|
+
async function Cs({
|
|
449
449
|
next: e,
|
|
450
450
|
node: r
|
|
451
451
|
}) {
|
|
452
452
|
e(r.nextId);
|
|
453
453
|
}
|
|
454
|
-
async function
|
|
454
|
+
async function Ss({
|
|
455
455
|
next: e,
|
|
456
456
|
node: r,
|
|
457
457
|
talentBankClient: t,
|
|
458
458
|
submissions: s,
|
|
459
|
-
flow:
|
|
460
|
-
logger:
|
|
459
|
+
flow: a,
|
|
460
|
+
logger: i,
|
|
461
461
|
chat: n
|
|
462
462
|
}) {
|
|
463
463
|
var c;
|
|
@@ -465,19 +465,19 @@ async function Cs({
|
|
|
465
465
|
isDuplicate: !1
|
|
466
466
|
};
|
|
467
467
|
if (s && t) {
|
|
468
|
-
const
|
|
469
|
-
if (r.data.scope === "company" ||
|
|
468
|
+
const p = r.data.scope === "job" ? (c = a.job) == null ? void 0 : c.id : void 0;
|
|
469
|
+
if (r.data.scope === "company" || p != null)
|
|
470
470
|
try {
|
|
471
471
|
o = await t.checkDuplicate({
|
|
472
472
|
email: ns({
|
|
473
473
|
key: r.data.email,
|
|
474
474
|
submissions: s
|
|
475
475
|
}).toString(),
|
|
476
|
-
jobId:
|
|
476
|
+
jobId: p,
|
|
477
477
|
scope: r.data.scope
|
|
478
478
|
});
|
|
479
479
|
} catch (b) {
|
|
480
|
-
|
|
480
|
+
i.error("[check-duplicate]", b);
|
|
481
481
|
}
|
|
482
482
|
}
|
|
483
483
|
n.setSubmission(r.data.key, {
|
|
@@ -485,18 +485,18 @@ async function Cs({
|
|
|
485
485
|
value: o
|
|
486
486
|
}), e(r.nextId);
|
|
487
487
|
}
|
|
488
|
-
async function
|
|
488
|
+
async function Is({
|
|
489
489
|
next: e,
|
|
490
490
|
node: r
|
|
491
491
|
}) {
|
|
492
492
|
e(r.data.targetId);
|
|
493
493
|
}
|
|
494
|
-
async function
|
|
494
|
+
async function As({
|
|
495
495
|
next: e,
|
|
496
496
|
node: r,
|
|
497
497
|
logger: t,
|
|
498
498
|
submissions: s,
|
|
499
|
-
context:
|
|
499
|
+
context: a
|
|
500
500
|
}) {
|
|
501
501
|
if (!s) {
|
|
502
502
|
t.error("Submissions not found");
|
|
@@ -504,61 +504,61 @@ async function Is({
|
|
|
504
504
|
}
|
|
505
505
|
s[r.data.key] = {
|
|
506
506
|
type: "string",
|
|
507
|
-
value:
|
|
507
|
+
value: he(r.data.value, {
|
|
508
508
|
submissions: s,
|
|
509
|
-
context:
|
|
509
|
+
context: a
|
|
510
510
|
})
|
|
511
511
|
}, e(r.nextId);
|
|
512
512
|
}
|
|
513
|
-
const Fs = 5e3, Cr = 3e4, Vs = 2e4,
|
|
514
|
-
if ((t == null ? void 0 : t.
|
|
513
|
+
const Fs = 5e3, Cr = 3e4, Vs = 2e4, Ms = 6e4, Sr = 12e4, Es = 60 * 6e4, Ns = (e, r, t) => {
|
|
514
|
+
if (!((t == null ? void 0 : t.retryable) === !0 && (t.providerStatus === 429 || t.providerStatus !== void 0 && t.providerStatus >= 500 || t.phase === "workflow" && t.verdict === "not_submitted")))
|
|
515
515
|
return {
|
|
516
516
|
key: e,
|
|
517
517
|
until: Date.now() + Cr
|
|
518
518
|
};
|
|
519
|
-
const
|
|
519
|
+
const a = ((r == null ? void 0 : r.throttles) ?? 0) + 1, i = Math.min(a * Vs, Ms), n = (t.retryAfterSeconds ?? 0) * 1e3;
|
|
520
520
|
return {
|
|
521
521
|
key: e,
|
|
522
|
-
until: Date.now() + Math.min(Math.max(i,
|
|
523
|
-
throttles:
|
|
522
|
+
until: Date.now() + Math.min(Math.max(i, n), Sr),
|
|
523
|
+
throttles: a
|
|
524
524
|
};
|
|
525
525
|
};
|
|
526
|
-
async function
|
|
526
|
+
async function Ls({
|
|
527
527
|
chat: e,
|
|
528
528
|
next: r,
|
|
529
529
|
end: t,
|
|
530
530
|
node: s,
|
|
531
|
-
logger:
|
|
532
|
-
apiClient:
|
|
531
|
+
logger: a,
|
|
532
|
+
apiClient: i,
|
|
533
533
|
submissions: n,
|
|
534
534
|
analytics: o,
|
|
535
535
|
flow: c,
|
|
536
|
-
applicationRecovery:
|
|
536
|
+
applicationRecovery: p,
|
|
537
537
|
setApplicationRecovery: b,
|
|
538
538
|
forceSubmitConfirmation: x,
|
|
539
|
-
persistWriteBarrier:
|
|
539
|
+
persistWriteBarrier: h,
|
|
540
540
|
signal: m,
|
|
541
541
|
t: C
|
|
542
542
|
}) {
|
|
543
543
|
var I;
|
|
544
|
-
if ((I = c.data.startedWriteNodeIds) != null && I.includes(s.id) && (
|
|
544
|
+
if ((I = c.data.startedWriteNodeIds) != null && I.includes(s.id) && (p == null ? void 0 : p.submitNodeId) !== s.id)
|
|
545
545
|
return await e.sendMessage({
|
|
546
546
|
type: "system",
|
|
547
547
|
variant: "warning",
|
|
548
548
|
text: C("submission_unknown")
|
|
549
549
|
}), t();
|
|
550
|
-
const E = c.job ? `${s.id}@${c.job.id_type}:${c.job.id}` : s.id,
|
|
551
|
-
var
|
|
552
|
-
const _ = ((
|
|
550
|
+
const E = c.job ? `${s.id}@${c.job.id_type}:${c.job.id}` : s.id, V = async (y) => {
|
|
551
|
+
var Be, je, et, $e, tt, qe, rt;
|
|
552
|
+
const _ = ((Be = c.data.submitCooldown) == null ? void 0 : Be.key) === E ? c.data.submitCooldown : void 0;
|
|
553
553
|
_ && (_.until = Math.min(_.until, Date.now() + (_.throttles ? Sr : Cr)));
|
|
554
|
-
const
|
|
555
|
-
(y !== !0 ||
|
|
554
|
+
const F = _ == null ? void 0 : _.until;
|
|
555
|
+
(y !== !0 || F !== void 0 && F > Date.now()) && await e.userInput({
|
|
556
556
|
type: "submit",
|
|
557
557
|
key: void 0,
|
|
558
558
|
config: {
|
|
559
559
|
label: s.data.submitLabel,
|
|
560
|
-
...
|
|
561
|
-
availableAt:
|
|
560
|
+
...F !== void 0 && {
|
|
561
|
+
availableAt: F
|
|
562
562
|
}
|
|
563
563
|
}
|
|
564
564
|
}), await e.sendMessage({
|
|
@@ -567,16 +567,16 @@ async function Es({
|
|
|
567
567
|
});
|
|
568
568
|
const {
|
|
569
569
|
anonymous_id: M,
|
|
570
|
-
session_id:
|
|
570
|
+
session_id: O
|
|
571
571
|
} = o.getSessionInfo();
|
|
572
572
|
if (m.aborted)
|
|
573
573
|
return;
|
|
574
|
-
const G = ((
|
|
575
|
-
if ((
|
|
574
|
+
const G = ((je = c.data.startedWriteNodeIds) == null ? void 0 : je.includes(s.id)) === !0;
|
|
575
|
+
if ((p == null ? void 0 : p.submitNodeId) === s.id && await b(void 0), G || (c.data.startedWriteNodeIds = [...c.data.startedWriteNodeIds ?? [], s.id]), await h().catch((B) => a.error("Failed to persist application write barrier", B)), m.aborted)
|
|
576
576
|
return;
|
|
577
|
-
let
|
|
578
|
-
const
|
|
579
|
-
|
|
577
|
+
let L;
|
|
578
|
+
const U = setTimeout(() => {
|
|
579
|
+
L = (async () => {
|
|
580
580
|
await e.sendMessage({
|
|
581
581
|
type: "text",
|
|
582
582
|
author: "bot",
|
|
@@ -585,65 +585,72 @@ async function Es({
|
|
|
585
585
|
type: "loading",
|
|
586
586
|
text: C("submitting")
|
|
587
587
|
});
|
|
588
|
-
})().catch((
|
|
588
|
+
})().catch((B) => a.error("Failed to send submission progress message", B));
|
|
589
589
|
}, Fs);
|
|
590
|
-
let
|
|
591
|
-
const
|
|
590
|
+
let D;
|
|
591
|
+
const T = await i.fetch("/flow/submit", {
|
|
592
592
|
method: "POST",
|
|
593
593
|
body: JSON.stringify({
|
|
594
594
|
log_submit: !1,
|
|
595
595
|
integration_id: s.data.integrationId,
|
|
596
596
|
anonymous_id: M,
|
|
597
|
-
session_id:
|
|
597
|
+
session_id: O,
|
|
598
598
|
job: c.job,
|
|
599
599
|
flow_build: c.build,
|
|
600
|
-
submissions:
|
|
600
|
+
submissions: is(c.nodes, os(n || {}, s.data.submitKeys)),
|
|
601
601
|
pre_apply: br(c.nodes, n || {}, c.data.flowSessionId)
|
|
602
602
|
})
|
|
603
|
-
}).catch((
|
|
604
|
-
if (clearTimeout(
|
|
603
|
+
}).catch((B) => (D = B, ms(B) ? B.data : B));
|
|
604
|
+
if (clearTimeout(U), await L, m.aborted)
|
|
605
605
|
return;
|
|
606
606
|
s.data.key && e.setSubmission(s.data.key, {
|
|
607
607
|
type: "integration",
|
|
608
|
-
value:
|
|
608
|
+
value: T
|
|
609
609
|
});
|
|
610
|
-
const w = mr(
|
|
611
|
-
|
|
610
|
+
const w = mr(T, D instanceof gs ? D.status : void 0), N = c.data.failedAttemptAt;
|
|
611
|
+
let q = N == null ? void 0 : N[E];
|
|
612
|
+
N && q !== void 0 && q > Date.now() && (q = N[E] = Date.now());
|
|
613
|
+
const H = q !== void 0 && Date.now() - q < Es || ((et = c.data.unconfirmedAttemptKeys) == null ? void 0 : et.includes(E)) === !0, X = ls(T);
|
|
614
|
+
if (X && o.log({
|
|
612
615
|
event: "FLOW_SUBMIT",
|
|
613
616
|
properties: {
|
|
614
617
|
flow_id: c.id,
|
|
615
618
|
flow_version: c.version,
|
|
616
619
|
flow_session_id: c.data.flowSessionId,
|
|
617
620
|
flow_build: c.build,
|
|
618
|
-
service:
|
|
619
|
-
response:
|
|
621
|
+
service: X.service,
|
|
622
|
+
response: X.response,
|
|
620
623
|
flow_type: "CHATBOT_DRAWER",
|
|
621
624
|
job: c.job,
|
|
622
|
-
// Measures how many duplicates follow the candidate's own
|
|
625
|
+
// Measures how many duplicates follow the candidate's own recent failed attempt; set exactly when
|
|
626
|
+
// the earlier-attempt copy is shown.
|
|
623
627
|
...(w == null ? void 0 : w.outcome) === "duplicate" && {
|
|
624
|
-
outcome:
|
|
628
|
+
outcome: H ? "duplicate_after_own_attempt" : "duplicate"
|
|
629
|
+
},
|
|
630
|
+
...X.outcome && {
|
|
631
|
+
outcome: X.outcome
|
|
625
632
|
}
|
|
626
633
|
}
|
|
627
|
-
}), ($t(
|
|
634
|
+
}), ($t(T) || (T == null ? void 0 : T.success) === !0) && (($e = c.data.submitCooldown) == null ? void 0 : $e.throttles) !== void 0 && (delete c.data.submitCooldown.throttles, await h().catch((B) => a.error("Failed to persist submit cooldown reset", B))), $t(T)) {
|
|
628
635
|
const {
|
|
629
|
-
redirect_url:
|
|
630
|
-
message:
|
|
631
|
-
button_text:
|
|
632
|
-
} =
|
|
636
|
+
redirect_url: B,
|
|
637
|
+
message: st,
|
|
638
|
+
button_text: Ue
|
|
639
|
+
} = T.integration_response.data;
|
|
633
640
|
await e.sendMessage({
|
|
634
641
|
type: "text",
|
|
635
642
|
author: "bot",
|
|
636
|
-
text:
|
|
643
|
+
text: st ?? C("submission_redirect_message")
|
|
637
644
|
});
|
|
638
645
|
try {
|
|
639
|
-
const
|
|
640
|
-
M && !
|
|
646
|
+
const de = new URL(B);
|
|
647
|
+
M && !de.searchParams.has("anonymous_id") && de.searchParams.set("anonymous_id", M), await e.sendMessage({
|
|
641
648
|
type: "link",
|
|
642
|
-
href:
|
|
643
|
-
text:
|
|
649
|
+
href: de.toString(),
|
|
650
|
+
text: Ue ?? C("complete_submission"),
|
|
644
651
|
onClick: () => {
|
|
645
|
-
if (!
|
|
646
|
-
|
|
652
|
+
if (!O) {
|
|
653
|
+
a.error("session_id not set, cannot log FLOW_REDIRECT event");
|
|
647
654
|
return;
|
|
648
655
|
}
|
|
649
656
|
o.log({
|
|
@@ -651,16 +658,16 @@ async function Es({
|
|
|
651
658
|
properties: {
|
|
652
659
|
flow_build: c.build,
|
|
653
660
|
flow_id: c.id,
|
|
654
|
-
flow_session_id:
|
|
661
|
+
flow_session_id: O,
|
|
655
662
|
flow_version: c.version,
|
|
656
|
-
href:
|
|
663
|
+
href: de.toString(),
|
|
657
664
|
job: c.job
|
|
658
665
|
}
|
|
659
666
|
});
|
|
660
667
|
}
|
|
661
668
|
});
|
|
662
|
-
} catch (
|
|
663
|
-
|
|
669
|
+
} catch (de) {
|
|
670
|
+
a.error(`Invalid redirect URL: ${B}`, de), e.sendMessage({
|
|
664
671
|
type: "system",
|
|
665
672
|
variant: "error",
|
|
666
673
|
text: C("redirect_url_error")
|
|
@@ -668,95 +675,105 @@ async function Es({
|
|
|
668
675
|
}
|
|
669
676
|
return r(s.nextId);
|
|
670
677
|
}
|
|
671
|
-
|
|
678
|
+
const _e = us(T);
|
|
679
|
+
if (_e)
|
|
680
|
+
return await e.sendMessage({
|
|
681
|
+
type: "system",
|
|
682
|
+
variant: "success",
|
|
683
|
+
text: _e.message ?? C("submission_pending")
|
|
684
|
+
}), r(s.nextId);
|
|
685
|
+
if ((T == null ? void 0 : T.success) === !0)
|
|
672
686
|
return s.data.skipConfirmation !== !0 && await e.sendMessage({
|
|
673
687
|
type: "system",
|
|
674
688
|
variant: "success",
|
|
675
689
|
text: C("submission_completed")
|
|
676
690
|
}), r(s.nextId);
|
|
677
|
-
const
|
|
678
|
-
return
|
|
679
|
-
|
|
691
|
+
const ue = (w == null ? void 0 : w.phase) === "submit" && w.verdict === "confirmed" && w.code === "unreadable_document" && typeof w.field == "string" && w.status !== void 0 && w.status >= 400 && w.status < 500 && ((tt = n == null ? void 0 : n[w.field]) == null ? void 0 : tt.type) === "file" ? w.field : void 0, ce = ue === void 0 ? void 0 : c.nodes.find((B) => B.type === "question-file" && B.data.key === ue);
|
|
692
|
+
return ce || (c.data.submitCooldown = Ns(E, _, w)), (w == null ? void 0 : w.outcome) !== "duplicate" && (c.data.failedAttemptAt = {
|
|
693
|
+
...c.data.failedAttemptAt,
|
|
694
|
+
[E]: Date.now()
|
|
695
|
+
}, (qe = c.data.unconfirmedAttemptKeys) != null && qe.includes(E) && (c.data.unconfirmedAttemptKeys = c.data.unconfirmedAttemptKeys.filter((B) => B !== E))), (w == null ? void 0 : w.verdict) === "not_submitted" || (w == null ? void 0 : w.outcome) === "duplicate" || (w == null ? void 0 : w.outcome) === "closed" ? (G || (c.data.startedWriteNodeIds = (rt = c.data.startedWriteNodeIds) == null ? void 0 : rt.filter((B) => B !== s.id)), (p == null ? void 0 : p.submitNodeId) === s.id && await b(p), await h().catch((B) => a.error("Failed to persist application write barrier release", B))) : await h().catch((B) => a.error("Failed to persist submit cooldown", B)), w ? (a.error(D ?? w.message), ce && ue !== void 0 ? (e.setSubmission(ue, null), await b({
|
|
696
|
+
fileQuestionNodeId: ce.id,
|
|
680
697
|
submitNodeId: s.id
|
|
681
698
|
}), await e.sendMessage({
|
|
682
699
|
type: "system",
|
|
683
700
|
variant: "error",
|
|
684
701
|
text: C("submission_unreadable_document")
|
|
685
|
-
}), r(
|
|
702
|
+
}), r(ce.id)) : w.outcome === "duplicate" ? (await e.sendMessage({
|
|
686
703
|
type: "system",
|
|
687
704
|
variant: "info",
|
|
688
|
-
text: C(
|
|
689
|
-
}),
|
|
705
|
+
text: C(H ? "submission_duplicate_earlier_attempt" : "submission_duplicate")
|
|
706
|
+
}), V(!1)) : w.outcome === "closed" ? (await e.sendMessage({
|
|
690
707
|
type: "system",
|
|
691
708
|
variant: "info",
|
|
692
709
|
text: C("submission_closed")
|
|
693
|
-
}),
|
|
710
|
+
}), V(!1)) : w.outcome === "unknown" ? (await e.sendMessage({
|
|
694
711
|
type: "system",
|
|
695
712
|
variant: "warning",
|
|
696
713
|
text: C("submission_unknown")
|
|
697
|
-
}),
|
|
714
|
+
}), V(!1)) : (w.phase === "workflow" || w.phase === "authentication") && w.retryable === !0 && w.verdict === "not_submitted" ? (await e.sendMessage({
|
|
698
715
|
type: "system",
|
|
699
716
|
variant: "error",
|
|
700
717
|
text: C("submission_retryable")
|
|
701
|
-
}),
|
|
718
|
+
}), V(!1)) : (await e.sendMessage({
|
|
702
719
|
type: "system",
|
|
703
720
|
variant: "error",
|
|
704
721
|
text: C("submission_failed")
|
|
705
|
-
}), t())) : (
|
|
722
|
+
}), t())) : (a.error(D ?? T), await e.sendMessage({
|
|
706
723
|
type: "system",
|
|
707
724
|
variant: "error",
|
|
708
725
|
text: C("submission_failed")
|
|
709
726
|
}), t());
|
|
710
727
|
};
|
|
711
|
-
await
|
|
728
|
+
await V(x === !0 ? !1 : s.data.skipConfirmation);
|
|
712
729
|
}
|
|
713
|
-
async function
|
|
730
|
+
async function Ds({
|
|
714
731
|
chat: e,
|
|
715
732
|
next: r,
|
|
716
733
|
node: t,
|
|
717
734
|
submissions: s,
|
|
718
|
-
context:
|
|
735
|
+
context: a
|
|
719
736
|
}) {
|
|
720
737
|
await e.sendMessage({
|
|
721
738
|
type: "link",
|
|
722
|
-
href:
|
|
739
|
+
href: he(t.data.href, {
|
|
723
740
|
submissions: s,
|
|
724
|
-
context:
|
|
741
|
+
context: a
|
|
725
742
|
}),
|
|
726
|
-
text:
|
|
743
|
+
text: he(t.data.cta, {
|
|
727
744
|
submissions: s,
|
|
728
|
-
context:
|
|
745
|
+
context: a
|
|
729
746
|
})
|
|
730
747
|
}), r(t.nextId);
|
|
731
748
|
}
|
|
732
|
-
async function
|
|
749
|
+
async function Ts({
|
|
733
750
|
submissions: e,
|
|
734
751
|
next: r,
|
|
735
752
|
node: t,
|
|
736
753
|
context: s
|
|
737
754
|
}) {
|
|
738
|
-
r(
|
|
755
|
+
r(xs(t, {
|
|
739
756
|
submissions: e,
|
|
740
757
|
context: s
|
|
741
758
|
}) ? t.branchId : t.nextId);
|
|
742
759
|
}
|
|
743
|
-
async function
|
|
760
|
+
async function Os({
|
|
744
761
|
chat: e,
|
|
745
762
|
next: r,
|
|
746
763
|
node: t,
|
|
747
764
|
submissions: s,
|
|
748
|
-
context:
|
|
765
|
+
context: a
|
|
749
766
|
}) {
|
|
750
767
|
await e.sendMessage({
|
|
751
768
|
author: "bot",
|
|
752
769
|
type: "text",
|
|
753
|
-
text:
|
|
770
|
+
text: he(t.data.text, {
|
|
754
771
|
submissions: s,
|
|
755
|
-
context:
|
|
772
|
+
context: a
|
|
756
773
|
})
|
|
757
774
|
}), r(t.nextId);
|
|
758
775
|
}
|
|
759
|
-
async function
|
|
776
|
+
async function Rs({
|
|
760
777
|
chat: e,
|
|
761
778
|
next: r,
|
|
762
779
|
node: t
|
|
@@ -769,20 +786,20 @@ async function Ds({
|
|
|
769
786
|
width: t.data.width
|
|
770
787
|
}), r(t.nextId);
|
|
771
788
|
}
|
|
772
|
-
async function
|
|
789
|
+
async function Ps({
|
|
773
790
|
chat: e,
|
|
774
791
|
next: r,
|
|
775
792
|
node: t,
|
|
776
793
|
submissions: s,
|
|
777
|
-
context:
|
|
778
|
-
t:
|
|
794
|
+
context: a,
|
|
795
|
+
t: i
|
|
779
796
|
}) {
|
|
780
797
|
await e.sendMessage({
|
|
781
798
|
author: "bot",
|
|
782
799
|
type: "text",
|
|
783
|
-
text:
|
|
800
|
+
text: he(t.data.question, {
|
|
784
801
|
submissions: s,
|
|
785
|
-
context:
|
|
802
|
+
context: a
|
|
786
803
|
})
|
|
787
804
|
});
|
|
788
805
|
const n = t.data.format === "phone" ? await e.userInput({
|
|
@@ -810,27 +827,27 @@ async function Os({
|
|
|
810
827
|
n === null ? await e.sendMessage({
|
|
811
828
|
type: "system",
|
|
812
829
|
variant: "info",
|
|
813
|
-
text:
|
|
830
|
+
text: i("skipped")
|
|
814
831
|
}) : await e.sendMessage({
|
|
815
832
|
author: "user",
|
|
816
833
|
type: "text",
|
|
817
|
-
text: n.type === "phone" ?
|
|
834
|
+
text: n.type === "phone" ? ot(n.value) : n.value
|
|
818
835
|
}), r(t.nextId);
|
|
819
836
|
}
|
|
820
|
-
async function
|
|
837
|
+
async function Bs({
|
|
821
838
|
chat: e,
|
|
822
839
|
next: r,
|
|
823
840
|
node: t,
|
|
824
841
|
submissions: s,
|
|
825
|
-
context:
|
|
826
|
-
t:
|
|
842
|
+
context: a,
|
|
843
|
+
t: i
|
|
827
844
|
}) {
|
|
828
845
|
await e.sendMessage({
|
|
829
846
|
author: "bot",
|
|
830
847
|
type: "text",
|
|
831
|
-
text:
|
|
848
|
+
text: he(t.data.question, {
|
|
832
849
|
submissions: s,
|
|
833
|
-
context:
|
|
850
|
+
context: a
|
|
834
851
|
})
|
|
835
852
|
});
|
|
836
853
|
const n = await e.userInput({
|
|
@@ -847,27 +864,27 @@ async function Rs({
|
|
|
847
864
|
n === null ? await e.sendMessage({
|
|
848
865
|
type: "system",
|
|
849
866
|
variant: "info",
|
|
850
|
-
text:
|
|
867
|
+
text: i("skipped")
|
|
851
868
|
}) : await e.sendMessage({
|
|
852
869
|
author: "user",
|
|
853
870
|
type: "text",
|
|
854
871
|
text: n.value.toString()
|
|
855
872
|
}), r(t.nextId);
|
|
856
873
|
}
|
|
857
|
-
async function
|
|
874
|
+
async function js({
|
|
858
875
|
chat: e,
|
|
859
876
|
next: r,
|
|
860
877
|
node: t,
|
|
861
878
|
submissions: s,
|
|
862
|
-
context:
|
|
863
|
-
t:
|
|
879
|
+
context: a,
|
|
880
|
+
t: i
|
|
864
881
|
}) {
|
|
865
882
|
await e.sendMessage({
|
|
866
883
|
author: "bot",
|
|
867
884
|
type: "text",
|
|
868
|
-
text:
|
|
885
|
+
text: he(t.data.question, {
|
|
869
886
|
submissions: s,
|
|
870
|
-
context:
|
|
887
|
+
context: a
|
|
871
888
|
})
|
|
872
889
|
});
|
|
873
890
|
const n = await e.userInput({
|
|
@@ -886,27 +903,27 @@ async function Bs({
|
|
|
886
903
|
n === null ? await e.sendMessage({
|
|
887
904
|
type: "system",
|
|
888
905
|
variant: "info",
|
|
889
|
-
text:
|
|
906
|
+
text: i("skipped")
|
|
890
907
|
}) : await e.sendMessage({
|
|
891
908
|
author: "user",
|
|
892
909
|
type: "text",
|
|
893
|
-
text: n.type === "phone" ?
|
|
910
|
+
text: n.type === "phone" ? ot(n.value) : n.value
|
|
894
911
|
}), r(t.nextId);
|
|
895
912
|
}
|
|
896
|
-
async function
|
|
913
|
+
async function $s({
|
|
897
914
|
chat: e,
|
|
898
915
|
next: r,
|
|
899
916
|
node: t,
|
|
900
917
|
submissions: s,
|
|
901
|
-
context:
|
|
902
|
-
t:
|
|
918
|
+
context: a,
|
|
919
|
+
t: i
|
|
903
920
|
}) {
|
|
904
921
|
await e.sendMessage({
|
|
905
922
|
author: "bot",
|
|
906
923
|
type: "text",
|
|
907
|
-
text:
|
|
924
|
+
text: he(t.data.question, {
|
|
908
925
|
submissions: s,
|
|
909
|
-
context:
|
|
926
|
+
context: a
|
|
910
927
|
})
|
|
911
928
|
});
|
|
912
929
|
const n = await e.userInput({
|
|
@@ -917,27 +934,27 @@ async function Ps({
|
|
|
917
934
|
n.value.length === 0 ? await e.sendMessage({
|
|
918
935
|
type: "system",
|
|
919
936
|
variant: "info",
|
|
920
|
-
text:
|
|
937
|
+
text: i("skipped")
|
|
921
938
|
}) : await e.sendMessage({
|
|
922
939
|
author: "user",
|
|
923
940
|
type: "text",
|
|
924
941
|
text: t.data.options.filter((o) => n.value.includes(o.value)).map((o) => o.label).join(", ")
|
|
925
942
|
}), r(t.nextId);
|
|
926
943
|
}
|
|
927
|
-
async function
|
|
944
|
+
async function qs({
|
|
928
945
|
chat: e,
|
|
929
946
|
next: r,
|
|
930
947
|
node: t,
|
|
931
948
|
submissions: s,
|
|
932
|
-
context:
|
|
933
|
-
t:
|
|
949
|
+
context: a,
|
|
950
|
+
t: i
|
|
934
951
|
}) {
|
|
935
952
|
await e.sendMessage({
|
|
936
953
|
author: "bot",
|
|
937
954
|
type: "text",
|
|
938
|
-
text:
|
|
955
|
+
text: he(t.data.question, {
|
|
939
956
|
submissions: s,
|
|
940
|
-
context:
|
|
957
|
+
context: a
|
|
941
958
|
})
|
|
942
959
|
});
|
|
943
960
|
const n = await e.userInput({
|
|
@@ -954,14 +971,14 @@ async function js({
|
|
|
954
971
|
n === null ? await e.sendMessage({
|
|
955
972
|
type: "system",
|
|
956
973
|
variant: "info",
|
|
957
|
-
text:
|
|
974
|
+
text: i("skipped")
|
|
958
975
|
}) : await e.sendMessage({
|
|
959
976
|
author: "user",
|
|
960
977
|
type: "text",
|
|
961
978
|
text: n.value === !0 ? t.data.trueLabel : t.data.falseLabel
|
|
962
979
|
}), r(t.nextId);
|
|
963
980
|
}
|
|
964
|
-
async function
|
|
981
|
+
async function Us({
|
|
965
982
|
chat: e,
|
|
966
983
|
next: r,
|
|
967
984
|
node: t,
|
|
@@ -972,7 +989,7 @@ async function $s({
|
|
|
972
989
|
type: "text",
|
|
973
990
|
text: t.data.question
|
|
974
991
|
});
|
|
975
|
-
const
|
|
992
|
+
const a = await e.userInput({
|
|
976
993
|
type: "address",
|
|
977
994
|
key: t.data.key,
|
|
978
995
|
config: {
|
|
@@ -982,36 +999,36 @@ async function $s({
|
|
|
982
999
|
placeholder: t.data.placeholder
|
|
983
1000
|
}
|
|
984
1001
|
});
|
|
985
|
-
if (
|
|
1002
|
+
if (a === null)
|
|
986
1003
|
await e.sendMessage({
|
|
987
1004
|
type: "system",
|
|
988
1005
|
variant: "info",
|
|
989
1006
|
text: s("skipped")
|
|
990
1007
|
});
|
|
991
1008
|
else {
|
|
992
|
-
const
|
|
1009
|
+
const i = Object.values(a.value).filter((n) => n && n.trim().length > 0).join(", ");
|
|
993
1010
|
await e.sendMessage({
|
|
994
1011
|
author: "user",
|
|
995
1012
|
type: "text",
|
|
996
|
-
text:
|
|
1013
|
+
text: i
|
|
997
1014
|
});
|
|
998
1015
|
}
|
|
999
1016
|
return r(t.nextId);
|
|
1000
1017
|
}
|
|
1001
|
-
async function
|
|
1018
|
+
async function zs({
|
|
1002
1019
|
node: e,
|
|
1003
1020
|
chat: r,
|
|
1004
1021
|
next: t,
|
|
1005
1022
|
submissions: s,
|
|
1006
|
-
context:
|
|
1007
|
-
t:
|
|
1023
|
+
context: a,
|
|
1024
|
+
t: i
|
|
1008
1025
|
}) {
|
|
1009
1026
|
await r.sendMessage({
|
|
1010
1027
|
author: "bot",
|
|
1011
1028
|
type: "text",
|
|
1012
|
-
text:
|
|
1029
|
+
text: he(e.data.question, {
|
|
1013
1030
|
submissions: s,
|
|
1014
|
-
context:
|
|
1031
|
+
context: a
|
|
1015
1032
|
})
|
|
1016
1033
|
});
|
|
1017
1034
|
const n = await r.userInput({
|
|
@@ -1029,7 +1046,7 @@ async function qs({
|
|
|
1029
1046
|
await r.sendMessage({
|
|
1030
1047
|
type: "system",
|
|
1031
1048
|
variant: "info",
|
|
1032
|
-
text:
|
|
1049
|
+
text: i("skipped")
|
|
1033
1050
|
});
|
|
1034
1051
|
else
|
|
1035
1052
|
for (const o of n.value)
|
|
@@ -1041,7 +1058,7 @@ async function qs({
|
|
|
1041
1058
|
});
|
|
1042
1059
|
return t(e.nextId);
|
|
1043
1060
|
}
|
|
1044
|
-
async function
|
|
1061
|
+
async function Ws({
|
|
1045
1062
|
chat: e,
|
|
1046
1063
|
end: r,
|
|
1047
1064
|
node: t
|
|
@@ -1052,25 +1069,25 @@ async function Us({
|
|
|
1052
1069
|
text: t.data.systemMessage
|
|
1053
1070
|
}), r();
|
|
1054
1071
|
}
|
|
1055
|
-
async function
|
|
1072
|
+
async function Ks({
|
|
1056
1073
|
node: e,
|
|
1057
1074
|
flow: r,
|
|
1058
1075
|
submissions: t,
|
|
1059
1076
|
chat: s,
|
|
1060
|
-
next:
|
|
1061
|
-
apiClient:
|
|
1077
|
+
next: a,
|
|
1078
|
+
apiClient: i,
|
|
1062
1079
|
analytics: n
|
|
1063
1080
|
}) {
|
|
1064
|
-
const o =
|
|
1081
|
+
const o = as(r.nodes, t || {}), {
|
|
1065
1082
|
answers: c,
|
|
1066
|
-
...
|
|
1083
|
+
...p
|
|
1067
1084
|
} = o;
|
|
1068
1085
|
s.setSubmission(e.data.key, {
|
|
1069
1086
|
type: "integration",
|
|
1070
|
-
value:
|
|
1087
|
+
value: p
|
|
1071
1088
|
});
|
|
1072
1089
|
const b = new AbortController(), x = setTimeout(() => b.abort(), 5e3);
|
|
1073
|
-
if (
|
|
1090
|
+
if (i.fetch("/flow/pre-apply", {
|
|
1074
1091
|
method: "POST",
|
|
1075
1092
|
signal: b.signal,
|
|
1076
1093
|
body: JSON.stringify({
|
|
@@ -1083,9 +1100,9 @@ async function zs({
|
|
|
1083
1100
|
}).finally(() => clearTimeout(x)), o.status !== "skipped") {
|
|
1084
1101
|
const m = [o.status === "unavailable" ? "We could not prepare your pre-apply summary. You can still continue to your application." : o.hasHardConcerns ? e.data.messages.hard : o.hasAdvisoryConcerns ? e.data.messages.advisory : e.data.messages.matched];
|
|
1085
1102
|
for (const C of ["hard", "advisory"]) {
|
|
1086
|
-
const E = c.filter((
|
|
1103
|
+
const E = c.filter((V) => !V.matched && V.severity === C);
|
|
1087
1104
|
E.length && m.push((C === "hard" ? "Role requirements" : "Other things to consider") + `
|
|
1088
|
-
` + E.map((
|
|
1105
|
+
` + E.map((V) => `• ${V.message}`).join(`
|
|
1089
1106
|
`));
|
|
1090
1107
|
}
|
|
1091
1108
|
await s.sendMessage({
|
|
@@ -1106,7 +1123,7 @@ async function zs({
|
|
|
1106
1123
|
}
|
|
1107
1124
|
});
|
|
1108
1125
|
}
|
|
1109
|
-
return
|
|
1126
|
+
return a(e.nextId);
|
|
1110
1127
|
}
|
|
1111
1128
|
const Ee = ({
|
|
1112
1129
|
class: e,
|
|
@@ -1138,79 +1155,79 @@ const Ee = ({
|
|
|
1138
1155
|
})
|
|
1139
1156
|
});
|
|
1140
1157
|
};
|
|
1141
|
-
var
|
|
1158
|
+
var me;
|
|
1142
1159
|
// @__NO_SIDE_EFFECTS__
|
|
1143
|
-
function
|
|
1160
|
+
function ut(e) {
|
|
1144
1161
|
return {
|
|
1145
|
-
lang: (e == null ? void 0 : e.lang) ?? (
|
|
1162
|
+
lang: (e == null ? void 0 : e.lang) ?? (me == null ? void 0 : me.lang),
|
|
1146
1163
|
message: e == null ? void 0 : e.message,
|
|
1147
|
-
abortEarly: (e == null ? void 0 : e.abortEarly) ?? (
|
|
1148
|
-
abortPipeEarly: (e == null ? void 0 : e.abortPipeEarly) ?? (
|
|
1164
|
+
abortEarly: (e == null ? void 0 : e.abortEarly) ?? (me == null ? void 0 : me.abortEarly),
|
|
1165
|
+
abortPipeEarly: (e == null ? void 0 : e.abortPipeEarly) ?? (me == null ? void 0 : me.abortPipeEarly)
|
|
1149
1166
|
};
|
|
1150
1167
|
}
|
|
1151
|
-
var yt;
|
|
1152
|
-
// @__NO_SIDE_EFFECTS__
|
|
1153
|
-
function Ks(e) {
|
|
1154
|
-
return yt == null ? void 0 : yt.get(e);
|
|
1155
|
-
}
|
|
1156
1168
|
var mt;
|
|
1157
1169
|
// @__NO_SIDE_EFFECTS__
|
|
1158
|
-
function
|
|
1170
|
+
function Gs(e) {
|
|
1159
1171
|
return mt == null ? void 0 : mt.get(e);
|
|
1160
1172
|
}
|
|
1161
1173
|
var gt;
|
|
1162
1174
|
// @__NO_SIDE_EFFECTS__
|
|
1163
|
-
function
|
|
1175
|
+
function Hs(e) {
|
|
1176
|
+
return gt == null ? void 0 : gt.get(e);
|
|
1177
|
+
}
|
|
1178
|
+
var bt;
|
|
1179
|
+
// @__NO_SIDE_EFFECTS__
|
|
1180
|
+
function Js(e, r) {
|
|
1164
1181
|
var t;
|
|
1165
|
-
return (t =
|
|
1182
|
+
return (t = bt == null ? void 0 : bt.get(e)) == null ? void 0 : t.get(r);
|
|
1166
1183
|
}
|
|
1167
1184
|
// @__NO_SIDE_EFFECTS__
|
|
1168
|
-
function
|
|
1185
|
+
function Te(e) {
|
|
1169
1186
|
var t, s;
|
|
1170
1187
|
const r = typeof e;
|
|
1171
1188
|
return r === "string" ? `"${e}"` : r === "number" || r === "bigint" || r === "boolean" ? `${e}` : r === "object" || r === "function" ? (e && ((s = (t = Object.getPrototypeOf(e)) == null ? void 0 : t.constructor) == null ? void 0 : s.name)) ?? "null" : r;
|
|
1172
1189
|
}
|
|
1173
|
-
function
|
|
1174
|
-
const
|
|
1190
|
+
function Z(e, r, t, s, a) {
|
|
1191
|
+
const i = a && "input" in a ? a.input : t.value, n = (a == null ? void 0 : a.expected) ?? e.expects ?? null, o = (a == null ? void 0 : a.received) ?? /* @__PURE__ */ Te(i), c = {
|
|
1175
1192
|
kind: e.kind,
|
|
1176
1193
|
type: e.type,
|
|
1177
|
-
input:
|
|
1194
|
+
input: i,
|
|
1178
1195
|
expected: n,
|
|
1179
1196
|
received: o,
|
|
1180
1197
|
message: `Invalid ${r}: ${n ? `Expected ${n} but r` : "R"}eceived ${o}`,
|
|
1181
1198
|
requirement: e.requirement,
|
|
1182
|
-
path:
|
|
1183
|
-
issues:
|
|
1199
|
+
path: a == null ? void 0 : a.path,
|
|
1200
|
+
issues: a == null ? void 0 : a.issues,
|
|
1184
1201
|
lang: s.lang,
|
|
1185
1202
|
abortEarly: s.abortEarly,
|
|
1186
1203
|
abortPipeEarly: s.abortPipeEarly
|
|
1187
|
-
},
|
|
1204
|
+
}, p = e.kind === "schema", b = (a == null ? void 0 : a.message) ?? e.message ?? /* @__PURE__ */ Js(e.reference, c.lang) ?? (p ? /* @__PURE__ */ Hs(c.lang) : null) ?? s.message ?? /* @__PURE__ */ Gs(c.lang);
|
|
1188
1205
|
b !== void 0 && (c.message = typeof b == "function" ? (
|
|
1189
1206
|
// @ts-expect-error
|
|
1190
1207
|
b(c)
|
|
1191
|
-
) : b),
|
|
1208
|
+
) : b), p && (t.typed = !1), t.issues ? t.issues.push(c) : t.issues = [c];
|
|
1192
1209
|
}
|
|
1193
1210
|
// @__NO_SIDE_EFFECTS__
|
|
1194
|
-
function
|
|
1211
|
+
function ye(e) {
|
|
1195
1212
|
return {
|
|
1196
1213
|
version: 1,
|
|
1197
1214
|
vendor: "valibot",
|
|
1198
1215
|
validate(r) {
|
|
1199
|
-
return e["~run"]({ value: r }, /* @__PURE__ */
|
|
1216
|
+
return e["~run"]({ value: r }, /* @__PURE__ */ ut());
|
|
1200
1217
|
}
|
|
1201
1218
|
};
|
|
1202
1219
|
}
|
|
1203
1220
|
// @__NO_SIDE_EFFECTS__
|
|
1204
|
-
function
|
|
1221
|
+
function Xs(e, r) {
|
|
1205
1222
|
return Object.hasOwn(e, r) && r !== "__proto__" && r !== "prototype" && r !== "constructor";
|
|
1206
1223
|
}
|
|
1207
1224
|
// @__NO_SIDE_EFFECTS__
|
|
1208
|
-
function
|
|
1225
|
+
function Zs(e, r) {
|
|
1209
1226
|
const t = [...new Set(e)];
|
|
1210
1227
|
return t.length > 1 ? `(${t.join(` ${r} `)})` : t[0] ?? "never";
|
|
1211
1228
|
}
|
|
1212
1229
|
// @__NO_SIDE_EFFECTS__
|
|
1213
|
-
function
|
|
1230
|
+
function Ys(e) {
|
|
1214
1231
|
if (e.path) {
|
|
1215
1232
|
let r = "";
|
|
1216
1233
|
for (const t of e.path)
|
|
@@ -1222,7 +1239,7 @@ function Zs(e) {
|
|
|
1222
1239
|
}
|
|
1223
1240
|
return null;
|
|
1224
1241
|
}
|
|
1225
|
-
var
|
|
1242
|
+
var Qs = class extends Error {
|
|
1226
1243
|
/**
|
|
1227
1244
|
* Creates a Valibot error with useful information.
|
|
1228
1245
|
*
|
|
@@ -1231,7 +1248,7 @@ var Xs = class extends Error {
|
|
|
1231
1248
|
constructor(e) {
|
|
1232
1249
|
super(e[0].message), this.name = "ValiError", this.issues = e;
|
|
1233
1250
|
}
|
|
1234
|
-
},
|
|
1251
|
+
}, en = /^[\w+-]+(?:\.[\w+-]+)*@[\da-z]+(?:[.-][\da-z]+)*\.[a-z]{2,}$/iu;
|
|
1235
1252
|
// @__NO_SIDE_EFFECTS__
|
|
1236
1253
|
function Ir(e, r) {
|
|
1237
1254
|
return {
|
|
@@ -1243,114 +1260,114 @@ function Ir(e, r) {
|
|
|
1243
1260
|
requirement: e,
|
|
1244
1261
|
message: r,
|
|
1245
1262
|
"~run"(t, s) {
|
|
1246
|
-
return t.typed && !this.requirement(t.value) &&
|
|
1263
|
+
return t.typed && !this.requirement(t.value) && Z(this, "input", t, s), t;
|
|
1247
1264
|
}
|
|
1248
1265
|
};
|
|
1249
1266
|
}
|
|
1250
1267
|
// @__NO_SIDE_EFFECTS__
|
|
1251
|
-
function
|
|
1268
|
+
function Ar(e) {
|
|
1252
1269
|
return {
|
|
1253
1270
|
kind: "validation",
|
|
1254
1271
|
type: "email",
|
|
1255
|
-
reference:
|
|
1272
|
+
reference: Ar,
|
|
1256
1273
|
expects: null,
|
|
1257
1274
|
async: !1,
|
|
1258
|
-
requirement:
|
|
1275
|
+
requirement: en,
|
|
1259
1276
|
message: e,
|
|
1260
1277
|
"~run"(r, t) {
|
|
1261
|
-
return r.typed && !this.requirement.test(r.value) &&
|
|
1278
|
+
return r.typed && !this.requirement.test(r.value) && Z(this, "email", r, t), r;
|
|
1262
1279
|
}
|
|
1263
1280
|
};
|
|
1264
1281
|
}
|
|
1265
1282
|
// @__NO_SIDE_EFFECTS__
|
|
1266
|
-
function
|
|
1283
|
+
function He(e, r) {
|
|
1267
1284
|
return {
|
|
1268
1285
|
kind: "validation",
|
|
1269
1286
|
type: "max_length",
|
|
1270
|
-
reference:
|
|
1287
|
+
reference: He,
|
|
1271
1288
|
async: !1,
|
|
1272
1289
|
expects: `<=${e}`,
|
|
1273
1290
|
requirement: e,
|
|
1274
1291
|
message: r,
|
|
1275
1292
|
"~run"(t, s) {
|
|
1276
|
-
return t.typed && t.value.length > this.requirement &&
|
|
1293
|
+
return t.typed && t.value.length > this.requirement && Z(this, "length", t, s, {
|
|
1277
1294
|
received: `${t.value.length}`
|
|
1278
1295
|
}), t;
|
|
1279
1296
|
}
|
|
1280
1297
|
};
|
|
1281
1298
|
}
|
|
1282
1299
|
// @__NO_SIDE_EFFECTS__
|
|
1283
|
-
function
|
|
1300
|
+
function Fr(e, r) {
|
|
1284
1301
|
return {
|
|
1285
1302
|
kind: "validation",
|
|
1286
1303
|
type: "max_value",
|
|
1287
|
-
reference:
|
|
1304
|
+
reference: Fr,
|
|
1288
1305
|
async: !1,
|
|
1289
|
-
expects: `<=${e instanceof Date ? e.toJSON() : /* @__PURE__ */
|
|
1306
|
+
expects: `<=${e instanceof Date ? e.toJSON() : /* @__PURE__ */ Te(e)}`,
|
|
1290
1307
|
requirement: e,
|
|
1291
1308
|
message: r,
|
|
1292
1309
|
"~run"(t, s) {
|
|
1293
|
-
return t.typed && !(t.value <= this.requirement) &&
|
|
1294
|
-
received: t.value instanceof Date ? t.value.toJSON() : /* @__PURE__ */
|
|
1310
|
+
return t.typed && !(t.value <= this.requirement) && Z(this, "value", t, s, {
|
|
1311
|
+
received: t.value instanceof Date ? t.value.toJSON() : /* @__PURE__ */ Te(t.value)
|
|
1295
1312
|
}), t;
|
|
1296
1313
|
}
|
|
1297
1314
|
};
|
|
1298
1315
|
}
|
|
1299
1316
|
// @__NO_SIDE_EFFECTS__
|
|
1300
|
-
function
|
|
1317
|
+
function De(e, r) {
|
|
1301
1318
|
return {
|
|
1302
1319
|
kind: "validation",
|
|
1303
1320
|
type: "min_length",
|
|
1304
|
-
reference:
|
|
1321
|
+
reference: De,
|
|
1305
1322
|
async: !1,
|
|
1306
1323
|
expects: `>=${e}`,
|
|
1307
1324
|
requirement: e,
|
|
1308
1325
|
message: r,
|
|
1309
1326
|
"~run"(t, s) {
|
|
1310
|
-
return t.typed && t.value.length < this.requirement &&
|
|
1327
|
+
return t.typed && t.value.length < this.requirement && Z(this, "length", t, s, {
|
|
1311
1328
|
received: `${t.value.length}`
|
|
1312
1329
|
}), t;
|
|
1313
1330
|
}
|
|
1314
1331
|
};
|
|
1315
1332
|
}
|
|
1316
1333
|
// @__NO_SIDE_EFFECTS__
|
|
1317
|
-
function
|
|
1334
|
+
function Vr(e, r) {
|
|
1318
1335
|
return {
|
|
1319
1336
|
kind: "validation",
|
|
1320
1337
|
type: "min_value",
|
|
1321
|
-
reference:
|
|
1338
|
+
reference: Vr,
|
|
1322
1339
|
async: !1,
|
|
1323
|
-
expects: `>=${e instanceof Date ? e.toJSON() : /* @__PURE__ */
|
|
1340
|
+
expects: `>=${e instanceof Date ? e.toJSON() : /* @__PURE__ */ Te(e)}`,
|
|
1324
1341
|
requirement: e,
|
|
1325
1342
|
message: r,
|
|
1326
1343
|
"~run"(t, s) {
|
|
1327
|
-
return t.typed && !(t.value >= this.requirement) &&
|
|
1328
|
-
received: t.value instanceof Date ? t.value.toJSON() : /* @__PURE__ */
|
|
1344
|
+
return t.typed && !(t.value >= this.requirement) && Z(this, "value", t, s, {
|
|
1345
|
+
received: t.value instanceof Date ? t.value.toJSON() : /* @__PURE__ */ Te(t.value)
|
|
1329
1346
|
}), t;
|
|
1330
1347
|
}
|
|
1331
1348
|
};
|
|
1332
1349
|
}
|
|
1333
1350
|
// @__NO_SIDE_EFFECTS__
|
|
1334
|
-
function
|
|
1351
|
+
function It(e, r) {
|
|
1335
1352
|
return {
|
|
1336
1353
|
kind: "validation",
|
|
1337
1354
|
type: "regex",
|
|
1338
|
-
reference:
|
|
1355
|
+
reference: It,
|
|
1339
1356
|
async: !1,
|
|
1340
1357
|
expects: `${e}`,
|
|
1341
1358
|
requirement: e,
|
|
1342
1359
|
message: r,
|
|
1343
1360
|
"~run"(t, s) {
|
|
1344
|
-
return t.typed && !this.requirement.test(t.value) &&
|
|
1361
|
+
return t.typed && !this.requirement.test(t.value) && Z(this, "format", t, s), t;
|
|
1345
1362
|
}
|
|
1346
1363
|
};
|
|
1347
1364
|
}
|
|
1348
1365
|
// @__NO_SIDE_EFFECTS__
|
|
1349
|
-
function
|
|
1366
|
+
function At(e) {
|
|
1350
1367
|
return {
|
|
1351
1368
|
kind: "transformation",
|
|
1352
1369
|
type: "transform",
|
|
1353
|
-
reference:
|
|
1370
|
+
reference: At,
|
|
1354
1371
|
async: !1,
|
|
1355
1372
|
operation: e,
|
|
1356
1373
|
"~run"(r) {
|
|
@@ -1375,12 +1392,12 @@ function Mr(e) {
|
|
|
1375
1392
|
},
|
|
1376
1393
|
message: e,
|
|
1377
1394
|
"~run"(r, t) {
|
|
1378
|
-
return r.typed && !this.requirement(r.value) &&
|
|
1395
|
+
return r.typed && !this.requirement(r.value) && Z(this, "URL", r, t), r;
|
|
1379
1396
|
}
|
|
1380
1397
|
};
|
|
1381
1398
|
}
|
|
1382
1399
|
// @__NO_SIDE_EFFECTS__
|
|
1383
|
-
function
|
|
1400
|
+
function tn(e, r, t) {
|
|
1384
1401
|
return typeof e.fallback == "function" ? (
|
|
1385
1402
|
// @ts-expect-error
|
|
1386
1403
|
e.fallback(r, t)
|
|
@@ -1410,25 +1427,25 @@ function Nr(e, r) {
|
|
|
1410
1427
|
item: e,
|
|
1411
1428
|
message: r,
|
|
1412
1429
|
get "~standard"() {
|
|
1413
|
-
return /* @__PURE__ */
|
|
1430
|
+
return /* @__PURE__ */ ye(this);
|
|
1414
1431
|
},
|
|
1415
1432
|
"~run"(t, s) {
|
|
1416
|
-
var
|
|
1417
|
-
const
|
|
1418
|
-
if (Array.isArray(
|
|
1433
|
+
var i;
|
|
1434
|
+
const a = t.value;
|
|
1435
|
+
if (Array.isArray(a)) {
|
|
1419
1436
|
t.typed = !0, t.value = [];
|
|
1420
|
-
for (let n = 0; n <
|
|
1421
|
-
const o =
|
|
1437
|
+
for (let n = 0; n < a.length; n++) {
|
|
1438
|
+
const o = a[n], c = this.item["~run"]({ value: o }, s);
|
|
1422
1439
|
if (c.issues) {
|
|
1423
|
-
const
|
|
1440
|
+
const p = {
|
|
1424
1441
|
type: "array",
|
|
1425
1442
|
origin: "value",
|
|
1426
|
-
input:
|
|
1443
|
+
input: a,
|
|
1427
1444
|
key: n,
|
|
1428
1445
|
value: o
|
|
1429
1446
|
};
|
|
1430
1447
|
for (const b of c.issues)
|
|
1431
|
-
b.path ? b.path.unshift(
|
|
1448
|
+
b.path ? b.path.unshift(p) : b.path = [p], (i = t.issues) == null || i.push(b);
|
|
1432
1449
|
if (t.issues || (t.issues = c.issues), s.abortEarly) {
|
|
1433
1450
|
t.typed = !1;
|
|
1434
1451
|
break;
|
|
@@ -1437,7 +1454,7 @@ function Nr(e, r) {
|
|
|
1437
1454
|
c.typed || (t.typed = !1), t.value.push(c.value);
|
|
1438
1455
|
}
|
|
1439
1456
|
} else
|
|
1440
|
-
|
|
1457
|
+
Z(this, "type", t, s);
|
|
1441
1458
|
return t;
|
|
1442
1459
|
}
|
|
1443
1460
|
};
|
|
@@ -1452,108 +1469,108 @@ function Lr(e) {
|
|
|
1452
1469
|
async: !1,
|
|
1453
1470
|
message: e,
|
|
1454
1471
|
get "~standard"() {
|
|
1455
|
-
return /* @__PURE__ */
|
|
1472
|
+
return /* @__PURE__ */ ye(this);
|
|
1456
1473
|
},
|
|
1457
1474
|
"~run"(r, t) {
|
|
1458
|
-
return typeof r.value == "boolean" ? r.typed = !0 :
|
|
1475
|
+
return typeof r.value == "boolean" ? r.typed = !0 : Z(this, "type", r, t), r;
|
|
1459
1476
|
}
|
|
1460
1477
|
};
|
|
1461
1478
|
}
|
|
1462
1479
|
// @__NO_SIDE_EFFECTS__
|
|
1463
|
-
function
|
|
1480
|
+
function Dr(e) {
|
|
1464
1481
|
return {
|
|
1465
1482
|
kind: "schema",
|
|
1466
1483
|
type: "number",
|
|
1467
|
-
reference:
|
|
1484
|
+
reference: Dr,
|
|
1468
1485
|
expects: "number",
|
|
1469
1486
|
async: !1,
|
|
1470
1487
|
message: e,
|
|
1471
1488
|
get "~standard"() {
|
|
1472
|
-
return /* @__PURE__ */
|
|
1489
|
+
return /* @__PURE__ */ ye(this);
|
|
1473
1490
|
},
|
|
1474
1491
|
"~run"(r, t) {
|
|
1475
|
-
return typeof r.value == "number" && !isNaN(r.value) ? r.typed = !0 :
|
|
1492
|
+
return typeof r.value == "number" && !isNaN(r.value) ? r.typed = !0 : Z(this, "type", r, t), r;
|
|
1476
1493
|
}
|
|
1477
1494
|
};
|
|
1478
1495
|
}
|
|
1479
1496
|
// @__NO_SIDE_EFFECTS__
|
|
1480
|
-
function
|
|
1497
|
+
function xe(e, r) {
|
|
1481
1498
|
return {
|
|
1482
1499
|
kind: "schema",
|
|
1483
1500
|
type: "object",
|
|
1484
|
-
reference:
|
|
1501
|
+
reference: xe,
|
|
1485
1502
|
expects: "Object",
|
|
1486
1503
|
async: !1,
|
|
1487
1504
|
entries: e,
|
|
1488
1505
|
message: r,
|
|
1489
1506
|
get "~standard"() {
|
|
1490
|
-
return /* @__PURE__ */
|
|
1507
|
+
return /* @__PURE__ */ ye(this);
|
|
1491
1508
|
},
|
|
1492
1509
|
"~run"(t, s) {
|
|
1493
|
-
var
|
|
1494
|
-
const
|
|
1495
|
-
if (
|
|
1510
|
+
var i;
|
|
1511
|
+
const a = t.value;
|
|
1512
|
+
if (a && typeof a == "object") {
|
|
1496
1513
|
t.typed = !0, t.value = {};
|
|
1497
1514
|
for (const n in this.entries) {
|
|
1498
1515
|
const o = this.entries[n];
|
|
1499
|
-
if (n in
|
|
1516
|
+
if (n in a || (o.type === "exact_optional" || o.type === "optional" || o.type === "nullish") && // @ts-expect-error
|
|
1500
1517
|
o.default !== void 0) {
|
|
1501
|
-
const c = n in
|
|
1518
|
+
const c = n in a ? (
|
|
1502
1519
|
// @ts-expect-error
|
|
1503
|
-
|
|
1504
|
-
) : /* @__PURE__ */ Er(o),
|
|
1505
|
-
if (
|
|
1520
|
+
a[n]
|
|
1521
|
+
) : /* @__PURE__ */ Er(o), p = o["~run"]({ value: c }, s);
|
|
1522
|
+
if (p.issues) {
|
|
1506
1523
|
const b = {
|
|
1507
1524
|
type: "object",
|
|
1508
1525
|
origin: "value",
|
|
1509
|
-
input:
|
|
1526
|
+
input: a,
|
|
1510
1527
|
key: n,
|
|
1511
1528
|
value: c
|
|
1512
1529
|
};
|
|
1513
|
-
for (const x of
|
|
1514
|
-
x.path ? x.path.unshift(b) : x.path = [b], (
|
|
1515
|
-
if (t.issues || (t.issues =
|
|
1530
|
+
for (const x of p.issues)
|
|
1531
|
+
x.path ? x.path.unshift(b) : x.path = [b], (i = t.issues) == null || i.push(x);
|
|
1532
|
+
if (t.issues || (t.issues = p.issues), s.abortEarly) {
|
|
1516
1533
|
t.typed = !1;
|
|
1517
1534
|
break;
|
|
1518
1535
|
}
|
|
1519
1536
|
}
|
|
1520
|
-
|
|
1537
|
+
p.typed || (t.typed = !1), t.value[n] = p.value;
|
|
1521
1538
|
} else if (o.fallback !== void 0)
|
|
1522
|
-
t.value[n] = /* @__PURE__ */
|
|
1523
|
-
else if (o.type !== "exact_optional" && o.type !== "optional" && o.type !== "nullish" && (
|
|
1539
|
+
t.value[n] = /* @__PURE__ */ tn(o);
|
|
1540
|
+
else if (o.type !== "exact_optional" && o.type !== "optional" && o.type !== "nullish" && (Z(this, "key", t, s, {
|
|
1524
1541
|
input: void 0,
|
|
1525
1542
|
expected: `"${n}"`,
|
|
1526
1543
|
path: [
|
|
1527
1544
|
{
|
|
1528
1545
|
type: "object",
|
|
1529
1546
|
origin: "key",
|
|
1530
|
-
input:
|
|
1547
|
+
input: a,
|
|
1531
1548
|
key: n,
|
|
1532
1549
|
// @ts-expect-error
|
|
1533
|
-
value:
|
|
1550
|
+
value: a[n]
|
|
1534
1551
|
}
|
|
1535
1552
|
]
|
|
1536
1553
|
}), s.abortEarly))
|
|
1537
1554
|
break;
|
|
1538
1555
|
}
|
|
1539
1556
|
} else
|
|
1540
|
-
|
|
1557
|
+
Z(this, "type", t, s);
|
|
1541
1558
|
return t;
|
|
1542
1559
|
}
|
|
1543
1560
|
};
|
|
1544
1561
|
}
|
|
1545
1562
|
// @__NO_SIDE_EFFECTS__
|
|
1546
|
-
function
|
|
1563
|
+
function Je(e, r) {
|
|
1547
1564
|
return {
|
|
1548
1565
|
kind: "schema",
|
|
1549
1566
|
type: "optional",
|
|
1550
|
-
reference:
|
|
1567
|
+
reference: Je,
|
|
1551
1568
|
expects: `(${e.expects} | undefined)`,
|
|
1552
1569
|
async: !1,
|
|
1553
1570
|
wrapped: e,
|
|
1554
1571
|
default: r,
|
|
1555
1572
|
get "~standard"() {
|
|
1556
|
-
return /* @__PURE__ */
|
|
1573
|
+
return /* @__PURE__ */ ye(this);
|
|
1557
1574
|
},
|
|
1558
1575
|
"~run"(t, s) {
|
|
1559
1576
|
return t.value === void 0 && (this.default !== void 0 && (t.value = /* @__PURE__ */ Er(this, t, s)), t.value === void 0) ? (t.typed = !0, t) : this.wrapped["~run"](t, s);
|
|
@@ -1561,20 +1578,20 @@ function We(e, r) {
|
|
|
1561
1578
|
};
|
|
1562
1579
|
}
|
|
1563
1580
|
// @__NO_SIDE_EFFECTS__
|
|
1564
|
-
function
|
|
1581
|
+
function Tr(e, r) {
|
|
1565
1582
|
return {
|
|
1566
1583
|
kind: "schema",
|
|
1567
1584
|
type: "picklist",
|
|
1568
|
-
reference:
|
|
1569
|
-
expects: /* @__PURE__ */
|
|
1585
|
+
reference: Tr,
|
|
1586
|
+
expects: /* @__PURE__ */ Zs(e.map(Te), "|"),
|
|
1570
1587
|
async: !1,
|
|
1571
1588
|
options: e,
|
|
1572
1589
|
message: r,
|
|
1573
1590
|
get "~standard"() {
|
|
1574
|
-
return /* @__PURE__ */
|
|
1591
|
+
return /* @__PURE__ */ ye(this);
|
|
1575
1592
|
},
|
|
1576
1593
|
"~run"(t, s) {
|
|
1577
|
-
return this.options.includes(t.value) ? t.typed = !0 :
|
|
1594
|
+
return this.options.includes(t.value) ? t.typed = !0 : Z(this, "type", t, s), t;
|
|
1578
1595
|
}
|
|
1579
1596
|
};
|
|
1580
1597
|
}
|
|
@@ -1590,46 +1607,46 @@ function Or(e, r, t) {
|
|
|
1590
1607
|
value: r,
|
|
1591
1608
|
message: t,
|
|
1592
1609
|
get "~standard"() {
|
|
1593
|
-
return /* @__PURE__ */
|
|
1610
|
+
return /* @__PURE__ */ ye(this);
|
|
1594
1611
|
},
|
|
1595
|
-
"~run"(s,
|
|
1612
|
+
"~run"(s, a) {
|
|
1596
1613
|
var n, o;
|
|
1597
|
-
const
|
|
1598
|
-
if (
|
|
1614
|
+
const i = s.value;
|
|
1615
|
+
if (i && typeof i == "object") {
|
|
1599
1616
|
s.typed = !0, s.value = {};
|
|
1600
|
-
for (const c in
|
|
1601
|
-
if (/* @__PURE__ */
|
|
1602
|
-
const
|
|
1617
|
+
for (const c in i)
|
|
1618
|
+
if (/* @__PURE__ */ Xs(i, c)) {
|
|
1619
|
+
const p = i[c], b = this.key["~run"]({ value: c }, a);
|
|
1603
1620
|
if (b.issues) {
|
|
1604
|
-
const
|
|
1621
|
+
const h = {
|
|
1605
1622
|
type: "object",
|
|
1606
1623
|
origin: "key",
|
|
1607
|
-
input:
|
|
1624
|
+
input: i,
|
|
1608
1625
|
key: c,
|
|
1609
|
-
value:
|
|
1626
|
+
value: p
|
|
1610
1627
|
};
|
|
1611
1628
|
for (const m of b.issues)
|
|
1612
|
-
m.path = [
|
|
1613
|
-
if (s.issues || (s.issues = b.issues),
|
|
1629
|
+
m.path = [h], (n = s.issues) == null || n.push(m);
|
|
1630
|
+
if (s.issues || (s.issues = b.issues), a.abortEarly) {
|
|
1614
1631
|
s.typed = !1;
|
|
1615
1632
|
break;
|
|
1616
1633
|
}
|
|
1617
1634
|
}
|
|
1618
1635
|
const x = this.value["~run"](
|
|
1619
|
-
{ value:
|
|
1620
|
-
|
|
1636
|
+
{ value: p },
|
|
1637
|
+
a
|
|
1621
1638
|
);
|
|
1622
1639
|
if (x.issues) {
|
|
1623
|
-
const
|
|
1640
|
+
const h = {
|
|
1624
1641
|
type: "object",
|
|
1625
1642
|
origin: "value",
|
|
1626
|
-
input:
|
|
1643
|
+
input: i,
|
|
1627
1644
|
key: c,
|
|
1628
|
-
value:
|
|
1645
|
+
value: p
|
|
1629
1646
|
};
|
|
1630
1647
|
for (const m of x.issues)
|
|
1631
|
-
m.path ? m.path.unshift(
|
|
1632
|
-
if (s.issues || (s.issues = x.issues),
|
|
1648
|
+
m.path ? m.path.unshift(h) : m.path = [h], (o = s.issues) == null || o.push(m);
|
|
1649
|
+
if (s.issues || (s.issues = x.issues), a.abortEarly) {
|
|
1633
1650
|
s.typed = !1;
|
|
1634
1651
|
break;
|
|
1635
1652
|
}
|
|
@@ -1637,44 +1654,44 @@ function Or(e, r, t) {
|
|
|
1637
1654
|
(!b.typed || !x.typed) && (s.typed = !1), b.typed && (s.value[b.value] = x.value);
|
|
1638
1655
|
}
|
|
1639
1656
|
} else
|
|
1640
|
-
|
|
1657
|
+
Z(this, "type", s, a);
|
|
1641
1658
|
return s;
|
|
1642
1659
|
}
|
|
1643
1660
|
};
|
|
1644
1661
|
}
|
|
1645
1662
|
// @__NO_SIDE_EFFECTS__
|
|
1646
|
-
function
|
|
1663
|
+
function ae(e) {
|
|
1647
1664
|
return {
|
|
1648
1665
|
kind: "schema",
|
|
1649
1666
|
type: "string",
|
|
1650
|
-
reference:
|
|
1667
|
+
reference: ae,
|
|
1651
1668
|
expects: "string",
|
|
1652
1669
|
async: !1,
|
|
1653
1670
|
message: e,
|
|
1654
1671
|
get "~standard"() {
|
|
1655
|
-
return /* @__PURE__ */
|
|
1672
|
+
return /* @__PURE__ */ ye(this);
|
|
1656
1673
|
},
|
|
1657
1674
|
"~run"(r, t) {
|
|
1658
|
-
return typeof r.value == "string" ? r.typed = !0 :
|
|
1675
|
+
return typeof r.value == "string" ? r.typed = !0 : Z(this, "type", r, t), r;
|
|
1659
1676
|
}
|
|
1660
1677
|
};
|
|
1661
1678
|
}
|
|
1662
|
-
function
|
|
1663
|
-
const s = e["~run"]({ value: r }, /* @__PURE__ */
|
|
1679
|
+
function rn(e, r, t) {
|
|
1680
|
+
const s = e["~run"]({ value: r }, /* @__PURE__ */ ut(t));
|
|
1664
1681
|
if (s.issues)
|
|
1665
|
-
throw new
|
|
1682
|
+
throw new Qs(s.issues);
|
|
1666
1683
|
return s.value;
|
|
1667
1684
|
}
|
|
1668
1685
|
// @__NO_SIDE_EFFECTS__
|
|
1669
|
-
function
|
|
1686
|
+
function sn(e, r) {
|
|
1670
1687
|
const t = {};
|
|
1671
1688
|
for (const s in e.entries)
|
|
1672
|
-
t[s] = !r || r.includes(s) ? /* @__PURE__ */
|
|
1689
|
+
t[s] = !r || r.includes(s) ? /* @__PURE__ */ Je(e.entries[s]) : e.entries[s];
|
|
1673
1690
|
return {
|
|
1674
1691
|
...e,
|
|
1675
1692
|
entries: t,
|
|
1676
1693
|
get "~standard"() {
|
|
1677
|
-
return /* @__PURE__ */
|
|
1694
|
+
return /* @__PURE__ */ ye(this);
|
|
1678
1695
|
}
|
|
1679
1696
|
};
|
|
1680
1697
|
}
|
|
@@ -1684,7 +1701,7 @@ function Se(...e) {
|
|
|
1684
1701
|
...e[0],
|
|
1685
1702
|
pipe: e,
|
|
1686
1703
|
get "~standard"() {
|
|
1687
|
-
return /* @__PURE__ */
|
|
1704
|
+
return /* @__PURE__ */ ye(this);
|
|
1688
1705
|
},
|
|
1689
1706
|
"~run"(r, t) {
|
|
1690
1707
|
for (const s of e)
|
|
@@ -1700,8 +1717,8 @@ function Se(...e) {
|
|
|
1700
1717
|
};
|
|
1701
1718
|
}
|
|
1702
1719
|
// @__NO_SIDE_EFFECTS__
|
|
1703
|
-
function
|
|
1704
|
-
const s = e["~run"]({ value: r }, /* @__PURE__ */
|
|
1720
|
+
function nn(e, r, t) {
|
|
1721
|
+
const s = e["~run"]({ value: r }, /* @__PURE__ */ ut(t));
|
|
1705
1722
|
return {
|
|
1706
1723
|
typed: s.typed,
|
|
1707
1724
|
success: !s.issues,
|
|
@@ -1710,10 +1727,10 @@ function rn(e, r, t) {
|
|
|
1710
1727
|
};
|
|
1711
1728
|
}
|
|
1712
1729
|
// @__NO_SIDE_EFFECTS__
|
|
1713
|
-
async function
|
|
1730
|
+
async function an(e, r, t) {
|
|
1714
1731
|
const s = await e["~run"](
|
|
1715
1732
|
{ value: r },
|
|
1716
|
-
/* @__PURE__ */
|
|
1733
|
+
/* @__PURE__ */ ut(t)
|
|
1717
1734
|
);
|
|
1718
1735
|
return {
|
|
1719
1736
|
typed: s.typed,
|
|
@@ -1722,7 +1739,7 @@ async function sn(e, r, t) {
|
|
|
1722
1739
|
issues: s.issues
|
|
1723
1740
|
};
|
|
1724
1741
|
}
|
|
1725
|
-
const
|
|
1742
|
+
const Pe = ({
|
|
1726
1743
|
error: e
|
|
1727
1744
|
}) => !e || !e.message ? null : u("div", {
|
|
1728
1745
|
role: "alert",
|
|
@@ -1755,7 +1772,7 @@ const Be = ({
|
|
|
1755
1772
|
class: "break-words pr-1 text-sm",
|
|
1756
1773
|
children: e.message
|
|
1757
1774
|
})]
|
|
1758
|
-
}),
|
|
1775
|
+
}), Ae = ({
|
|
1759
1776
|
class: e,
|
|
1760
1777
|
...r
|
|
1761
1778
|
}) => {
|
|
@@ -1787,7 +1804,7 @@ const Be = ({
|
|
|
1787
1804
|
});
|
|
1788
1805
|
};
|
|
1789
1806
|
var Ft = { Afghanistan: "93", Albania: "355", Algeria: "213", "American Samoa": "1 684", Andorra: "376", Angola: "244", Anguilla: "1 264", Antarctica: "672", "Antigua and Barbuda": "1 268", Argentina: "54", Armenia: "374", Aruba: "297", Australia: "61", Austria: "43", Azerbaijan: "994", Bahrain: "973", Bangladesh: "880", Barbados: "1 246", Belarus: "375", Belgium: "32", Belize: "501", Benin: "229", Bermuda: "1 441", Bhutan: "975", Bolivia: "591", "Bosnia and Herzegovina": "387", Botswana: "267", "Bouvet Island": "47", Brazil: "55", "British Indian Ocean Territory": "246", "British Virgin Islands": "1 284", Brunei: "673", Bulgaria: "359", "Burkina Faso": "226", Burundi: "257", "Cabo Verde": "238", Cambodia: "855", Cameroon: "237", Canada: "1", "Caribbean Netherlands": "599", "Cayman Islands": "1 345", "Central African Republic": "236", Chad: "235", Chile: "56", China: "86", "Christmas Island": "61", "Cocos (Keeling) Islands": "61", Colombia: "57", Comoros: "269", "Cook Islands": "682", "Costa Rica": "506", Croatia: "385", Cuba: "53", Curaçao: "599", Cyprus: "357", Czechia: "420", "Côte d'Ivoire": "225", "Democratic Republic of the Congo": "243", Denmark: "45", Djibouti: "253", "Dominican Republic": "1 809", Ecuador: "593", Egypt: "20", "El Salvador": "503", "Equatorial Guinea": "240", Eritrea: "291", Estonia: "372", Eswatini: "268", Ethiopia: "251", "Falkland Islands (Islas Malvinas)": "500", "Faroe Islands": "298", Fiji: "679", Finland: "358", France: "33", "French Guiana": "594", "French Polynesia": "689", "French Southern and Antarctic Lands": "262", Gabon: "241", Georgia: "995", Germany: "49", Ghana: "233", Gibraltar: "350", Greece: "30", Greenland: "299", Grenada: "1 473", Guadeloupe: "590", Guam: "1 671", Guatemala: "502", Guernsey: "44", Guinea: "224", "Guinea-Bissau": "245", Guyana: "592", Haiti: "509", Honduras: "504", "Hong Kong": "852", Hungary: "36", Iceland: "354", India: "91", Indonesia: "62", Iran: "98", Iraq: "964", Ireland: "353", "Isle of Man": "44", Israel: "972", Italy: "39", Jamaica: "1 876", Japan: "81", Jersey: "44", Jordan: "962", Kazakhstan: "7", Kenya: "254", Kiribati: "686", Kosovo: "383", Kuwait: "965", Kyrgyzstan: "996", Laos: "856", Latvia: "371", Lebanon: "961", Lesotho: "266", Liberia: "231", Libya: "218", Liechtenstein: "423", Lithuania: "370", Luxembourg: "352", Macao: "853", Madagascar: "261", Malawi: "265", Malaysia: "60", Maldives: "960", Mali: "223", Malta: "356", "Marshall Islands": "692", Martinique: "596", Mauritania: "222", Mauritius: "230", Mayotte: "262", Mexico: "52", Micronesia: "691", Moldova: "373", Monaco: "377", Mongolia: "976", Montenegro: "382", Montserrat: "1 664", Morocco: "212", Mozambique: "258", "Myanmar (Burma)": "95", Namibia: "264", Nauru: "674", Nepal: "977", Netherlands: "31", "New Caledonia": "687", "New Zealand": "64", Nicaragua: "505", Niger: "227", Nigeria: "234", Niue: "683", "Norfolk Island": "672", "North Korea": "850", "North Macedonia": "389", "Northern Mariana Islands": "1 670", Norway: "47", Oman: "968", Pakistan: "92", Palau: "680", Palestine: "970", Panama: "507", "Papua New Guinea": "675", Paraguay: "595", Peru: "51", Philippines: "63", "Pitcairn Islands": "64", Poland: "48", Portugal: "351", "Puerto Rico": "1 787", Qatar: "974", Romania: "40", Russia: "7", Rwanda: "250", Réunion: "262", "Saint Barthélemy": "590", "Saint Helena, Ascension and Tristan da Cunha": "290", "Saint Kitts and Nevis": "1 869", "Saint Lucia": "1 758", "Saint Martin": "590", "Saint Pierre and Miquelon": "508", "Saint Vincent and the Grenadines": "1 784", Samoa: "685", "San Marino": "378", "Saudi Arabia": "966", Senegal: "221", Serbia: "381", Seychelles: "248", "Sierra Leone": "232", Singapore: "65", "Sint Maarten": "1 721", Slovakia: "421", Slovenia: "386", "Solomon Islands": "677", Somalia: "252", "South Africa": "27", "South Georgia and the South Sandwich Islands": "500", "South Korea": "82", "South Sudan": "211", Spain: "34", "Sri Lanka": "94", Sudan: "249", Suriname: "597", "Svalbard and Jan Mayen": "47", Sweden: "46", Switzerland: "41", Syria: "963", "São Tomé and Príncipe": "239", Taiwan: "886", Tajikistan: "992", Tanzania: "255", Thailand: "66", "The Bahamas": "1 242", "The Gambia": "220", "Timor-Leste": "670", Togo: "228", Tokelau: "690", Tonga: "676", "Trinidad and Tobago": "1 868", Tunisia: "216", Turkmenistan: "993", "Turks and Caicos Islands": "1 649", Tuvalu: "688", Türkiye: "90", "U.S. Virgin Islands": "1 340", Uganda: "256", Ukraine: "380", "United Arab Emirates": "971", "United Kingdom": "44", "United States": "1", "United States Minor Outlying Islands": "1", Uruguay: "598", Uzbekistan: "998", Vanuatu: "678", "Vatican City": "379", Venezuela: "58", Vietnam: "84", "Wallis and Futuna": "681", "Western Sahara": "212", Yemen: "967", Zambia: "260", Zimbabwe: "263", "Åland Islands": "358" };
|
|
1790
|
-
const
|
|
1807
|
+
const Ye = lt("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", {
|
|
1791
1808
|
variants: {
|
|
1792
1809
|
optional: {
|
|
1793
1810
|
true: "pr-16 pl-3",
|
|
@@ -1797,70 +1814,70 @@ const Je = st("outline-divider ease-expo-out placeholder:text-neutral-10 text-ne
|
|
|
1797
1814
|
defaultVariants: {
|
|
1798
1815
|
optional: !1
|
|
1799
1816
|
}
|
|
1800
|
-
}),
|
|
1801
|
-
name: /* @__PURE__ */
|
|
1802
|
-
}),
|
|
1803
|
-
suggestions: /* @__PURE__ */ Nr(/* @__PURE__ */
|
|
1804
|
-
full_address: /* @__PURE__ */
|
|
1805
|
-
place_formatted: /* @__PURE__ */
|
|
1806
|
-
name: /* @__PURE__ */
|
|
1807
|
-
mapbox_id: /* @__PURE__ */
|
|
1808
|
-
context: /* @__PURE__ */
|
|
1809
|
-
address:
|
|
1810
|
-
street:
|
|
1811
|
-
neighborhood:
|
|
1812
|
-
locality:
|
|
1813
|
-
district:
|
|
1814
|
-
place:
|
|
1815
|
-
region:
|
|
1816
|
-
postcode:
|
|
1817
|
-
country:
|
|
1817
|
+
}), on = "https://api.mapbox.com/search/searchbox/v1/suggest", ln = "ZzRDWFU0dTZ3SF9aWk9RNGl6QzZaWS5RZmlFak13a0hPbGxXZXlNSGN5RUhObUJ6TXpSV08yUW5OdE5tSTZJU1lpd2lJb1JYYXRObmJ2Tm5iaGhHZWx4V1lpb2pJMUp5ZS5rcA==", un = (e) => atob(e).split("").reverse().join(""), ge = /* @__PURE__ */ xe({
|
|
1818
|
+
name: /* @__PURE__ */ ae()
|
|
1819
|
+
}), cn = /* @__PURE__ */ xe({
|
|
1820
|
+
suggestions: /* @__PURE__ */ Nr(/* @__PURE__ */ xe({
|
|
1821
|
+
full_address: /* @__PURE__ */ Je(/* @__PURE__ */ ae()),
|
|
1822
|
+
place_formatted: /* @__PURE__ */ Je(/* @__PURE__ */ ae()),
|
|
1823
|
+
name: /* @__PURE__ */ Je(/* @__PURE__ */ ae()),
|
|
1824
|
+
mapbox_id: /* @__PURE__ */ ae(),
|
|
1825
|
+
context: /* @__PURE__ */ sn(/* @__PURE__ */ xe({
|
|
1826
|
+
address: ge,
|
|
1827
|
+
street: ge,
|
|
1828
|
+
neighborhood: ge,
|
|
1829
|
+
locality: ge,
|
|
1830
|
+
district: ge,
|
|
1831
|
+
place: ge,
|
|
1832
|
+
region: ge,
|
|
1833
|
+
postcode: ge,
|
|
1834
|
+
country: ge
|
|
1818
1835
|
}))
|
|
1819
1836
|
}))
|
|
1820
|
-
}),
|
|
1837
|
+
}), dn = ({
|
|
1821
1838
|
logger: e,
|
|
1822
1839
|
t: r
|
|
1823
|
-
}) =>
|
|
1840
|
+
}) => cs(() => {
|
|
1824
1841
|
var s;
|
|
1825
1842
|
const t = (s = $.current$.peek().flow) == null ? void 0 : s.data.flowSessionId;
|
|
1826
1843
|
return t ? {
|
|
1827
1844
|
enabled: !0,
|
|
1828
|
-
getPredictions: async (
|
|
1845
|
+
getPredictions: async (a) => {
|
|
1829
1846
|
var x;
|
|
1830
|
-
const
|
|
1831
|
-
|
|
1847
|
+
const i = new URL(on);
|
|
1848
|
+
i.searchParams.set("q", a), i.searchParams.set("session_token", t);
|
|
1832
1849
|
const n = (x = $.current$.peek().flow) == null ? void 0 : x.locationOrigin;
|
|
1833
|
-
n && n.lat !== void 0 && n.lng !== void 0 && n.lat >= -90 && n.lat <= 90 && n.lng >= -180 && n.lng <= 180 &&
|
|
1834
|
-
const c = await fetch(
|
|
1850
|
+
n && n.lat !== void 0 && n.lng !== void 0 && n.lat >= -90 && n.lat <= 90 && n.lng >= -180 && n.lng <= 180 && i.searchParams.set("proximity", `${n.lng},${n.lat}`), i.searchParams.set("access_token", un(ln));
|
|
1851
|
+
const c = await fetch(i);
|
|
1835
1852
|
if (!c.ok)
|
|
1836
1853
|
return e.error("Failed to get address details", c), {
|
|
1837
1854
|
ok: !1,
|
|
1838
1855
|
error: r("address_error")
|
|
1839
1856
|
};
|
|
1840
|
-
const
|
|
1841
|
-
if (
|
|
1842
|
-
return e.error("Failed to parse address details",
|
|
1857
|
+
const p = /* @__PURE__ */ nn(cn, await c.json());
|
|
1858
|
+
if (p.success === !1)
|
|
1859
|
+
return e.error("Failed to parse address details", p.issues), {
|
|
1843
1860
|
ok: !1,
|
|
1844
1861
|
error: r("address_error")
|
|
1845
1862
|
};
|
|
1846
1863
|
const {
|
|
1847
1864
|
suggestions: b
|
|
1848
|
-
} =
|
|
1865
|
+
} = p.output;
|
|
1849
1866
|
return {
|
|
1850
1867
|
ok: !0,
|
|
1851
|
-
data: b.map((
|
|
1852
|
-
var m, C, E,
|
|
1868
|
+
data: b.map((h) => {
|
|
1869
|
+
var m, C, E, V, I, y, _, F, M;
|
|
1853
1870
|
return {
|
|
1854
|
-
label:
|
|
1855
|
-
id:
|
|
1871
|
+
label: h.full_address ?? h.place_formatted ?? h.name ?? h.mapbox_id,
|
|
1872
|
+
id: h.mapbox_id,
|
|
1856
1873
|
address: {
|
|
1857
|
-
line1: ((m =
|
|
1874
|
+
line1: ((m = h.context.address) == null ? void 0 : m.name) ?? ((C = h.context.street) == null ? void 0 : C.name),
|
|
1858
1875
|
line2: void 0,
|
|
1859
|
-
line3: ((E =
|
|
1860
|
-
city: ((I =
|
|
1861
|
-
state: (_ =
|
|
1862
|
-
postcode: (
|
|
1863
|
-
country: (M =
|
|
1876
|
+
line3: ((E = h.context.neighborhood) == null ? void 0 : E.name) ?? ((V = h.context.locality) == null ? void 0 : V.name),
|
|
1877
|
+
city: ((I = h.context.place) == null ? void 0 : I.name) ?? ((y = h.context.district) == null ? void 0 : y.name),
|
|
1878
|
+
state: (_ = h.context.region) == null ? void 0 : _.name,
|
|
1879
|
+
postcode: (F = h.context.postcode) == null ? void 0 : F.name,
|
|
1880
|
+
country: (M = h.context.country) == null ? void 0 : M.name
|
|
1864
1881
|
}
|
|
1865
1882
|
};
|
|
1866
1883
|
})
|
|
@@ -1869,7 +1886,7 @@ const Je = st("outline-divider ease-expo-out placeholder:text-neutral-10 text-ne
|
|
|
1869
1886
|
} : {
|
|
1870
1887
|
enabled: !1
|
|
1871
1888
|
};
|
|
1872
|
-
}, [e, r]),
|
|
1889
|
+
}, [e, r]), Wt = (e) => {
|
|
1873
1890
|
const {
|
|
1874
1891
|
t: r
|
|
1875
1892
|
} = se();
|
|
@@ -1892,22 +1909,22 @@ const Je = st("outline-divider ease-expo-out placeholder:text-neutral-10 text-ne
|
|
|
1892
1909
|
children: r("back")
|
|
1893
1910
|
})]
|
|
1894
1911
|
});
|
|
1895
|
-
},
|
|
1912
|
+
}, fn = ({
|
|
1896
1913
|
input: e,
|
|
1897
1914
|
onSubmitSuccess: r,
|
|
1898
1915
|
logger: t
|
|
1899
1916
|
}) => {
|
|
1900
1917
|
const {
|
|
1901
1918
|
t: s
|
|
1902
|
-
} = se(), [
|
|
1919
|
+
} = se(), [a, i] = ve(), {
|
|
1903
1920
|
enabled: n,
|
|
1904
1921
|
getPredictions: o
|
|
1905
|
-
} =
|
|
1922
|
+
} = dn({
|
|
1906
1923
|
logger: t,
|
|
1907
1924
|
t: s
|
|
1908
|
-
}), [c,
|
|
1909
|
-
var
|
|
1910
|
-
if (Me(n, "Query state should not be enabled"), y = y.trim(), y === ((
|
|
1925
|
+
}), [c, p] = ve(n ? "query" : "manual"), [b, x] = ve(""), [h, m] = ve(), C = pe(), E = pe(), V = (y) => {
|
|
1926
|
+
var F;
|
|
1927
|
+
if (Me(n, "Query state should not be enabled"), y = y.trim(), y === ((F = C.current) == null ? void 0 : F.query) || y === (h == null ? void 0 : h.query) && h.status === "done")
|
|
1911
1928
|
return;
|
|
1912
1929
|
if (x(y), y === "") {
|
|
1913
1930
|
C.current = void 0, m(void 0);
|
|
@@ -1937,80 +1954,80 @@ const Je = st("outline-divider ease-expo-out placeholder:text-neutral-10 text-ne
|
|
|
1937
1954
|
}));
|
|
1938
1955
|
});
|
|
1939
1956
|
}, I = (y, _) => {
|
|
1940
|
-
|
|
1941
|
-
...
|
|
1957
|
+
i((F) => ({
|
|
1958
|
+
...F,
|
|
1942
1959
|
[y]: _
|
|
1943
1960
|
}));
|
|
1944
1961
|
};
|
|
1945
1962
|
switch (c) {
|
|
1946
1963
|
case "query":
|
|
1947
|
-
return Me(n, "Query state should not be enabled"), u(
|
|
1964
|
+
return Me(n, "Query state should not be enabled"), u(pn, {
|
|
1948
1965
|
input: e,
|
|
1949
1966
|
onSkip: () => r(null),
|
|
1950
1967
|
onAddressSelect: (y) => {
|
|
1951
1968
|
if (y === "") {
|
|
1952
|
-
C.current && (C.current = void 0, m(void 0)),
|
|
1969
|
+
C.current && (C.current = void 0, m(void 0)), p("manual");
|
|
1953
1970
|
return;
|
|
1954
1971
|
}
|
|
1955
|
-
const _ = (
|
|
1956
|
-
_ && (E.current !== y &&
|
|
1972
|
+
const _ = (h == null ? void 0 : h.status) === "done" ? h.items.find((F) => F.id === y) : void 0;
|
|
1973
|
+
_ && (E.current !== y && i(_.address), E.current = y, p("details"));
|
|
1957
1974
|
},
|
|
1958
|
-
onAddressSearch:
|
|
1959
|
-
lookup:
|
|
1975
|
+
onAddressSearch: V,
|
|
1976
|
+
lookup: h,
|
|
1960
1977
|
query: b
|
|
1961
1978
|
});
|
|
1962
1979
|
case "details":
|
|
1963
|
-
return Me(
|
|
1980
|
+
return Me(a !== void 0), u(Kt, {
|
|
1964
1981
|
input: e,
|
|
1965
1982
|
logger: t,
|
|
1966
1983
|
onSubmitSuccess: r,
|
|
1967
|
-
addressFields:
|
|
1984
|
+
addressFields: a,
|
|
1968
1985
|
onFieldChange: I,
|
|
1969
|
-
actions: u(
|
|
1986
|
+
actions: u(Wt, {
|
|
1970
1987
|
onClick: () => {
|
|
1971
|
-
|
|
1988
|
+
p("query");
|
|
1972
1989
|
}
|
|
1973
1990
|
})
|
|
1974
1991
|
});
|
|
1975
1992
|
case "manual":
|
|
1976
|
-
return u(
|
|
1993
|
+
return u(Kt, {
|
|
1977
1994
|
logger: t,
|
|
1978
1995
|
input: e,
|
|
1979
1996
|
onSubmitSuccess: r,
|
|
1980
|
-
addressFields:
|
|
1997
|
+
addressFields: a ?? {},
|
|
1981
1998
|
onFieldChange: I,
|
|
1982
|
-
actions: n ? u(
|
|
1999
|
+
actions: n ? u(Wt, {
|
|
1983
2000
|
onClick: () => {
|
|
1984
|
-
|
|
2001
|
+
p("query");
|
|
1985
2002
|
}
|
|
1986
2003
|
}) : e.config.optional ? (
|
|
1987
2004
|
// Without address search this is the only screen, so an optional question needs its own way past.
|
|
1988
|
-
u(
|
|
2005
|
+
u(Ae, {
|
|
1989
2006
|
onClick: () => r(null)
|
|
1990
2007
|
})
|
|
1991
2008
|
) : void 0
|
|
1992
2009
|
});
|
|
1993
2010
|
}
|
|
1994
|
-
},
|
|
2011
|
+
}, pn = ({
|
|
1995
2012
|
input: e,
|
|
1996
2013
|
onSkip: r,
|
|
1997
2014
|
lookup: t,
|
|
1998
2015
|
onAddressSelect: s,
|
|
1999
|
-
query:
|
|
2000
|
-
onAddressSearch:
|
|
2016
|
+
query: a,
|
|
2017
|
+
onAddressSearch: i
|
|
2001
2018
|
}) => {
|
|
2002
2019
|
const {
|
|
2003
2020
|
t: n
|
|
2004
|
-
} = se(), o =
|
|
2021
|
+
} = se(), o = pe(null);
|
|
2005
2022
|
return Ie(() => {
|
|
2006
2023
|
o.current && (o.current.focus(), o.current.select());
|
|
2007
|
-
}, []), u(
|
|
2024
|
+
}, []), u(we, {
|
|
2008
2025
|
children: [u("form", {
|
|
2009
2026
|
noValidate: !0,
|
|
2010
2027
|
onSubmit: (c) => {
|
|
2011
2028
|
c.preventDefault();
|
|
2012
2029
|
const b = new FormData(c.currentTarget).get("address");
|
|
2013
|
-
typeof b == "string" &&
|
|
2030
|
+
typeof b == "string" && i(b);
|
|
2014
2031
|
},
|
|
2015
2032
|
class: "flex gap-2 p-2.5",
|
|
2016
2033
|
children: [u("div", {
|
|
@@ -2022,8 +2039,8 @@ const Je = st("outline-divider ease-expo-out placeholder:text-neutral-10 text-ne
|
|
|
2022
2039
|
autocomplete: "address-line1 country-name postal-code",
|
|
2023
2040
|
autoFocus: !0,
|
|
2024
2041
|
placeholder: e.config.placeholder || n("address_search"),
|
|
2025
|
-
defaultValue:
|
|
2026
|
-
class:
|
|
2042
|
+
defaultValue: a,
|
|
2043
|
+
class: Ye({
|
|
2027
2044
|
optional: !!e.config.optional,
|
|
2028
2045
|
className: "w-full rounded-full"
|
|
2029
2046
|
})
|
|
@@ -2056,19 +2073,19 @@ const Je = st("outline-divider ease-expo-out placeholder:text-neutral-10 text-ne
|
|
|
2056
2073
|
children: n("search")
|
|
2057
2074
|
})]
|
|
2058
2075
|
})]
|
|
2059
|
-
}), e.config.optional && u(
|
|
2076
|
+
}), e.config.optional && u(Ae, {
|
|
2060
2077
|
class: "relative",
|
|
2061
2078
|
onClick: r
|
|
2062
2079
|
})]
|
|
2063
|
-
}), (t == null ? void 0 : t.status) === "failed" ? u(
|
|
2080
|
+
}), (t == null ? void 0 : t.status) === "failed" ? u(Pe, {
|
|
2064
2081
|
error: {
|
|
2065
2082
|
message: t.error
|
|
2066
2083
|
}
|
|
2067
2084
|
}) : null, u("p", {
|
|
2068
2085
|
role: "status",
|
|
2069
2086
|
class: (t == null ? void 0 : t.status) === "pending" || (t == null ? void 0 : t.status) === "done" && t.items.length === 0 ? "text-neutral-10 flex items-center gap-2 px-4 py-2 text-sm" : "sr-only",
|
|
2070
|
-
children: (t == null ? void 0 : t.status) === "pending" ? u(
|
|
2071
|
-
children: [u(
|
|
2087
|
+
children: (t == null ? void 0 : t.status) === "pending" ? u(we, {
|
|
2088
|
+
children: [u(St, {
|
|
2072
2089
|
"aria-hidden": "true",
|
|
2073
2090
|
class: "h-4 w-4 shrink-0"
|
|
2074
2091
|
}), n("address_searching")]
|
|
@@ -2111,17 +2128,17 @@ const Je = st("outline-divider ease-expo-out placeholder:text-neutral-10 text-ne
|
|
|
2111
2128
|
}, "")]
|
|
2112
2129
|
})]
|
|
2113
2130
|
});
|
|
2114
|
-
},
|
|
2131
|
+
}, vt = ["line1", "line2", "line3", "city", "state", "postcode", "country"], Kt = ({
|
|
2115
2132
|
addressFields: e,
|
|
2116
2133
|
onFieldChange: r,
|
|
2117
2134
|
onSubmitSuccess: t,
|
|
2118
2135
|
actions: s,
|
|
2119
|
-
input:
|
|
2136
|
+
input: a
|
|
2120
2137
|
}) => {
|
|
2121
|
-
const
|
|
2138
|
+
const i = pe(null);
|
|
2122
2139
|
Ie(() => {
|
|
2123
|
-
if (
|
|
2124
|
-
const c =
|
|
2140
|
+
if (i.current) {
|
|
2141
|
+
const c = i.current.querySelector("input");
|
|
2125
2142
|
c && (c.focus(), c.select());
|
|
2126
2143
|
}
|
|
2127
2144
|
}, []);
|
|
@@ -2131,28 +2148,28 @@ const Je = st("outline-divider ease-expo-out placeholder:text-neutral-10 text-ne
|
|
|
2131
2148
|
return u("form", {
|
|
2132
2149
|
class: "flex flex-col px-2 pt-2",
|
|
2133
2150
|
onSubmit: (c) => {
|
|
2134
|
-
const
|
|
2151
|
+
const p = c.currentTarget, b = [...p.querySelectorAll("input")].filter((m) => m.value !== "" && !m.value.trim());
|
|
2135
2152
|
for (const m of b) {
|
|
2136
2153
|
m.value = "";
|
|
2137
|
-
const C =
|
|
2154
|
+
const C = vt.find((E) => a.config.keys[E] === m.name);
|
|
2138
2155
|
C && r(C, "");
|
|
2139
2156
|
}
|
|
2140
|
-
if (b.length > 0 && !
|
|
2141
|
-
c.preventDefault(),
|
|
2157
|
+
if (b.length > 0 && !p.checkValidity()) {
|
|
2158
|
+
c.preventDefault(), p.reportValidity();
|
|
2142
2159
|
return;
|
|
2143
2160
|
}
|
|
2144
|
-
const x = new FormData(
|
|
2161
|
+
const x = new FormData(p), h = Object.fromEntries(x.entries());
|
|
2145
2162
|
t({
|
|
2146
2163
|
type: "address",
|
|
2147
|
-
value:
|
|
2164
|
+
value: h
|
|
2148
2165
|
});
|
|
2149
2166
|
},
|
|
2150
2167
|
children: [u("div", {
|
|
2151
2168
|
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]",
|
|
2152
|
-
ref:
|
|
2153
|
-
children:
|
|
2154
|
-
const b = `isdk_${c}`, x =
|
|
2155
|
-
return x ? u(
|
|
2169
|
+
ref: i,
|
|
2170
|
+
children: vt.map((c, p) => {
|
|
2171
|
+
const b = `isdk_${c}`, x = a.config.keys[c];
|
|
2172
|
+
return x ? u(we, {
|
|
2156
2173
|
children: [u("label", {
|
|
2157
2174
|
for: b,
|
|
2158
2175
|
class: "text-neutral-9 [&:has(+*>input:focus)]:text-neutral-11 w-24 pb-2 text-xs uppercase leading-3 tracking-widest transition-colors",
|
|
@@ -2166,7 +2183,7 @@ const Je = st("outline-divider ease-expo-out placeholder:text-neutral-10 text-ne
|
|
|
2166
2183
|
name: x,
|
|
2167
2184
|
id: b,
|
|
2168
2185
|
defaultValue: e[c],
|
|
2169
|
-
onChange: (
|
|
2186
|
+
onChange: (h) => r(c, h.currentTarget.value),
|
|
2170
2187
|
required: !0,
|
|
2171
2188
|
children: [e.country && !n.includes(e.country) ? u("option", {
|
|
2172
2189
|
value: e[c],
|
|
@@ -2174,10 +2191,10 @@ const Je = st("outline-divider ease-expo-out placeholder:text-neutral-10 text-ne
|
|
|
2174
2191
|
}) : u("option", {
|
|
2175
2192
|
value: "",
|
|
2176
2193
|
children: o("select_country")
|
|
2177
|
-
}), n.map((
|
|
2178
|
-
value:
|
|
2179
|
-
children:
|
|
2180
|
-
},
|
|
2194
|
+
}), n.map((h) => u("option", {
|
|
2195
|
+
value: h,
|
|
2196
|
+
children: h
|
|
2197
|
+
}, h))]
|
|
2181
2198
|
}), u("svg", {
|
|
2182
2199
|
class: "text-neutral-12 absolute bottom-2.5 right-2 flex items-center justify-center",
|
|
2183
2200
|
width: "16",
|
|
@@ -2194,14 +2211,14 @@ const Je = st("outline-divider ease-expo-out placeholder:text-neutral-10 text-ne
|
|
|
2194
2211
|
})
|
|
2195
2212
|
})]
|
|
2196
2213
|
}) : u("input", {
|
|
2197
|
-
autoFocus:
|
|
2214
|
+
autoFocus: p === 0 ? !0 : void 0,
|
|
2198
2215
|
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",
|
|
2199
2216
|
name: x,
|
|
2200
2217
|
id: b,
|
|
2201
2218
|
defaultValue: e[c],
|
|
2202
|
-
onInput: (
|
|
2203
|
-
required: c !== "line2" ||
|
|
2204
|
-
}),
|
|
2219
|
+
onInput: (h) => r(c, h.currentTarget.value),
|
|
2220
|
+
required: c !== "line2" || a.config.line2Required === !0
|
|
2221
|
+
}), p === vt.length - 1 ? u("hr", {
|
|
2205
2222
|
class: "m-0 w-full border-b border-b-transparent"
|
|
2206
2223
|
}) : u("hr", {
|
|
2207
2224
|
class: "border-b-neutral-5 m-0 w-full border-b border-solid"
|
|
@@ -2217,12 +2234,12 @@ const Je = st("outline-divider ease-expo-out placeholder:text-neutral-10 text-ne
|
|
|
2217
2234
|
})]
|
|
2218
2235
|
});
|
|
2219
2236
|
}, Vt = () => {
|
|
2220
|
-
const e =
|
|
2237
|
+
const e = pe(null);
|
|
2221
2238
|
return vr(() => {
|
|
2222
2239
|
var r;
|
|
2223
2240
|
(r = e.current) == null || r.focus();
|
|
2224
2241
|
}, []), e;
|
|
2225
|
-
}, Rr = ["true", "false"],
|
|
2242
|
+
}, Rr = ["true", "false"], hn = /* @__PURE__ */ Tr(Rr), yn = "answer", Pr = "flex items-center flex-wrap gap-2 p-2.5", Br = "min-w-0 max-w-full flex-auto", jr = xr(({
|
|
2226
2243
|
label: e,
|
|
2227
2244
|
...r
|
|
2228
2245
|
}, t) => u("button", {
|
|
@@ -2233,7 +2250,7 @@ const Je = st("outline-divider ease-expo-out placeholder:text-neutral-10 text-ne
|
|
|
2233
2250
|
class: "text-center text-base",
|
|
2234
2251
|
children: e
|
|
2235
2252
|
})
|
|
2236
|
-
})),
|
|
2253
|
+
})), mn = ({
|
|
2237
2254
|
input: e,
|
|
2238
2255
|
onSubmitSuccess: r
|
|
2239
2256
|
}) => {
|
|
@@ -2243,49 +2260,49 @@ const Je = st("outline-divider ease-expo-out placeholder:text-neutral-10 text-ne
|
|
|
2243
2260
|
class: "",
|
|
2244
2261
|
onSubmit: (s) => {
|
|
2245
2262
|
s.preventDefault();
|
|
2246
|
-
const
|
|
2263
|
+
const a = ds(s).value, i = rn(hn, a);
|
|
2247
2264
|
r({
|
|
2248
2265
|
type: "boolean",
|
|
2249
|
-
value:
|
|
2266
|
+
value: i === "true"
|
|
2250
2267
|
});
|
|
2251
2268
|
},
|
|
2252
2269
|
children: [u("ul", {
|
|
2253
|
-
class:
|
|
2254
|
-
children: Rr.map((s,
|
|
2255
|
-
class:
|
|
2270
|
+
class: Pr,
|
|
2271
|
+
children: Rr.map((s, a) => u("li", {
|
|
2272
|
+
class: Br,
|
|
2256
2273
|
children: u(jr, {
|
|
2257
|
-
ref:
|
|
2274
|
+
ref: a === 0 ? t : null,
|
|
2258
2275
|
type: "submit",
|
|
2259
|
-
name:
|
|
2276
|
+
name: yn,
|
|
2260
2277
|
value: s,
|
|
2261
2278
|
label: e.config.labels[s]
|
|
2262
2279
|
}, s)
|
|
2263
2280
|
}))
|
|
2264
2281
|
}), e.config.optional && u("div", {
|
|
2265
2282
|
class: "px-2 pb-2",
|
|
2266
|
-
children: u(
|
|
2283
|
+
children: u(Ae, {
|
|
2267
2284
|
class: "relative w-full",
|
|
2268
2285
|
type: "button",
|
|
2269
2286
|
onClick: () => r(null)
|
|
2270
2287
|
})
|
|
2271
2288
|
})]
|
|
2272
2289
|
});
|
|
2273
|
-
},
|
|
2290
|
+
}, gn = (e) => new Promise((r, t) => {
|
|
2274
2291
|
const s = new FileReader();
|
|
2275
2292
|
s.onload = () => {
|
|
2276
2293
|
if (typeof s.result != "string" || !s.result)
|
|
2277
2294
|
return t(new Error("Invalid file"));
|
|
2278
2295
|
r(s.result);
|
|
2279
2296
|
}, s.onerror = t, s.readAsDataURL(e);
|
|
2280
|
-
}), Gt = (e) => e.reduce((r, t) => r + t.sizeKb, 0),
|
|
2297
|
+
}), Gt = (e) => e.reduce((r, t) => r + t.sizeKb, 0), bn = Re("file"), Ht = 3, ct = (e) => {
|
|
2281
2298
|
const r = e.lastIndexOf(".");
|
|
2282
2299
|
return r === -1 ? [e, ""] : [e.slice(0, r), e.slice(r)];
|
|
2283
|
-
},
|
|
2300
|
+
}, vn = ({
|
|
2284
2301
|
file: e,
|
|
2285
2302
|
class: r,
|
|
2286
2303
|
...t
|
|
2287
2304
|
}) => {
|
|
2288
|
-
const [s,
|
|
2305
|
+
const [s, a] = ct(e.name);
|
|
2289
2306
|
return u("div", {
|
|
2290
2307
|
class: Oe("bg-accent-1 outline-accent-4 flex max-w-full gap-2 overflow-hidden rounded-lg px-3 py-2 text-sm outline", r),
|
|
2291
2308
|
...t,
|
|
@@ -2296,12 +2313,12 @@ const Je = st("outline-divider ease-expo-out placeholder:text-neutral-10 text-ne
|
|
|
2296
2313
|
class: "block truncate",
|
|
2297
2314
|
children: s
|
|
2298
2315
|
}), u("span", {
|
|
2299
|
-
children:
|
|
2316
|
+
children: a
|
|
2300
2317
|
})]
|
|
2301
2318
|
}), u("p", {
|
|
2302
2319
|
"aria-label": "File size",
|
|
2303
2320
|
class: "text-accent-11",
|
|
2304
|
-
children:
|
|
2321
|
+
children: Ge(e.sizeKb)
|
|
2305
2322
|
})]
|
|
2306
2323
|
});
|
|
2307
2324
|
}, Jt = ({
|
|
@@ -2310,27 +2327,27 @@ const Je = st("outline-divider ease-expo-out placeholder:text-neutral-10 text-ne
|
|
|
2310
2327
|
}) => u("li", {
|
|
2311
2328
|
class: Oe("outline-neutral-6 text-neutral-11 bg-neutral-1 block rounded-md px-1 py-0.5 text-xs outline outline-1", e),
|
|
2312
2329
|
...r
|
|
2313
|
-
}),
|
|
2314
|
-
const [t, s] =
|
|
2330
|
+
}), xn = (e, r) => {
|
|
2331
|
+
const [t, s] = ct(e);
|
|
2315
2332
|
return `${t.slice(0, r)}${s}`;
|
|
2316
|
-
},
|
|
2317
|
-
name:
|
|
2333
|
+
}, Xt = (e) => ({
|
|
2334
|
+
name: xn(e.name, 42),
|
|
2318
2335
|
sizeKb: e.size / 1e3
|
|
2319
|
-
}),
|
|
2320
|
-
const s =
|
|
2321
|
-
return `chatbot-file-refused:${e}:${
|
|
2322
|
-
},
|
|
2336
|
+
}), wn = [".heic", ".heif", ".jpg", ".jpeg", ".png", ".gif", ".webp", ".txt", ".rtf", ".odt", ".pages", ".zip"], _n = (e, r, t) => {
|
|
2337
|
+
const s = ct(r.name)[1].toLowerCase(), a = [...t.map((n) => n.toLowerCase()), ...wn], i = s === "" ? "none" : a.includes(s) ? s : "other";
|
|
2338
|
+
return `chatbot-file-refused:${e}:${i}`;
|
|
2339
|
+
}, kn = ({
|
|
2323
2340
|
input: e,
|
|
2324
2341
|
onSubmitSuccess: r,
|
|
2325
2342
|
analytics: t
|
|
2326
2343
|
}) => {
|
|
2327
|
-
var
|
|
2328
|
-
const s = (
|
|
2344
|
+
var V;
|
|
2345
|
+
const s = (V = $.current$.value.flow) == null ? void 0 : V.data.submissions[e.key], [a, i] = ve(bn(s) && s.value.length ? {
|
|
2329
2346
|
status: "ready",
|
|
2330
2347
|
files: s.value
|
|
2331
2348
|
} : {
|
|
2332
2349
|
status: "empty"
|
|
2333
|
-
}), n =
|
|
2350
|
+
}), n = pe(0), o = a.status === "ready" ? a.files : [], c = a.status === "ready" || a.status === "pending" ? a.files : [], p = a.status === "error" ? a.error : void 0, b = c.length - Ht, x = Gt(c), h = Vt(), {
|
|
2334
2351
|
t: m
|
|
2335
2352
|
} = se(), C = (I) => {
|
|
2336
2353
|
if (!I.length)
|
|
@@ -2358,7 +2375,7 @@ const Je = st("outline-divider ease-expo-out placeholder:text-neutral-10 text-ne
|
|
|
2358
2375
|
error: {
|
|
2359
2376
|
type: "max",
|
|
2360
2377
|
message: m("validation_file_size", {
|
|
2361
|
-
size:
|
|
2378
|
+
size: Ge(e.config.fileSizeLimitKib)
|
|
2362
2379
|
})
|
|
2363
2380
|
}
|
|
2364
2381
|
};
|
|
@@ -2373,22 +2390,22 @@ const Je = st("outline-divider ease-expo-out placeholder:text-neutral-10 text-ne
|
|
|
2373
2390
|
}
|
|
2374
2391
|
};
|
|
2375
2392
|
}, E = (I, y) => {
|
|
2376
|
-
var _,
|
|
2393
|
+
var _, F;
|
|
2377
2394
|
return t.log({
|
|
2378
2395
|
event: "INTERACTION",
|
|
2379
2396
|
properties: {
|
|
2380
|
-
tag:
|
|
2397
|
+
tag: _n(I, y, e.config.extensions)
|
|
2381
2398
|
},
|
|
2382
|
-
customProperties: (
|
|
2399
|
+
customProperties: (F = (_ = $.current$.peek().flow) == null ? void 0 : _.analytics) == null ? void 0 : F.customProperties
|
|
2383
2400
|
});
|
|
2384
2401
|
};
|
|
2385
2402
|
return u("form", {
|
|
2386
2403
|
class: "flex flex-col gap-1 p-2.5",
|
|
2387
2404
|
onSubmit: (I) => {
|
|
2388
|
-
if (I.preventDefault(),
|
|
2405
|
+
if (I.preventDefault(), a.status === "pending" || a.status === "error")
|
|
2389
2406
|
return;
|
|
2390
2407
|
const y = C(o);
|
|
2391
|
-
y ?
|
|
2408
|
+
y ? i({
|
|
2392
2409
|
status: "error",
|
|
2393
2410
|
error: y.error
|
|
2394
2411
|
}) : r({
|
|
@@ -2399,13 +2416,13 @@ const Je = st("outline-divider ease-expo-out placeholder:text-neutral-10 text-ne
|
|
|
2399
2416
|
children: [u("div", {
|
|
2400
2417
|
class: "flex items-center gap-2",
|
|
2401
2418
|
children: [u("label", {
|
|
2402
|
-
ref:
|
|
2419
|
+
ref: h,
|
|
2403
2420
|
for: "dropzone-file",
|
|
2404
2421
|
class: "border-neutral-8 bg-neutral-2 flex h-48 w-full cursor-pointer flex-col items-center justify-center overflow-hidden rounded-2xl border border-dashed p-4",
|
|
2405
2422
|
children: [c.length > 0 ? u("ul", {
|
|
2406
2423
|
class: "flex max-w-full flex-wrap justify-center gap-1 overflow-hidden p-1",
|
|
2407
2424
|
children: [c.slice(0, Ht).map((I) => {
|
|
2408
|
-
const [y, _] =
|
|
2425
|
+
const [y, _] = ct(I.name);
|
|
2409
2426
|
return u(Jt, {
|
|
2410
2427
|
class: "flex overflow-hidden",
|
|
2411
2428
|
children: [u("span", {
|
|
@@ -2443,7 +2460,7 @@ const Je = st("outline-divider ease-expo-out placeholder:text-neutral-10 text-ne
|
|
|
2443
2460
|
}), e.config.fileSizeLimitKib ? u("p", {
|
|
2444
2461
|
class: "text-neutral-10 text-xs",
|
|
2445
2462
|
children: ["(", m("file_max_size", {
|
|
2446
|
-
size:
|
|
2463
|
+
size: Ge(e.config.fileSizeLimitKib)
|
|
2447
2464
|
}), ")"]
|
|
2448
2465
|
}) : null]
|
|
2449
2466
|
}), u("aside", {
|
|
@@ -2464,15 +2481,15 @@ const Je = st("outline-divider ease-expo-out placeholder:text-neutral-10 text-ne
|
|
|
2464
2481
|
}), u("p", {
|
|
2465
2482
|
role: "status",
|
|
2466
2483
|
class: Oe("text-neutral-11 flex items-center gap-1.5 text-xs", c.length === 0 && "sr-only"),
|
|
2467
|
-
children:
|
|
2468
|
-
children: [u(
|
|
2484
|
+
children: a.status === "pending" ? u(we, {
|
|
2485
|
+
children: [u(St, {
|
|
2469
2486
|
"aria-hidden": "true",
|
|
2470
2487
|
class: "h-4 w-4"
|
|
2471
2488
|
}), m("file_preparing", {
|
|
2472
2489
|
count: c.length
|
|
2473
2490
|
})]
|
|
2474
|
-
}) :
|
|
2475
|
-
children: [
|
|
2491
|
+
}) : a.status === "ready" ? u(we, {
|
|
2492
|
+
children: [Ge(x), " ", o.length > 1 ? "total" : "", u("span", {
|
|
2476
2493
|
class: "sr-only",
|
|
2477
2494
|
children: [". ", m("file_ready", {
|
|
2478
2495
|
count: o.length
|
|
@@ -2488,36 +2505,36 @@ const Je = st("outline-divider ease-expo-out placeholder:text-neutral-10 text-ne
|
|
|
2488
2505
|
const [_] = y;
|
|
2489
2506
|
if (!_)
|
|
2490
2507
|
return;
|
|
2491
|
-
const
|
|
2508
|
+
const F = ++n.current, M = a.status === "ready", O = y.map(Xt), G = C(O);
|
|
2492
2509
|
if (G)
|
|
2493
|
-
return E(G.reason, G.file ?? _),
|
|
2510
|
+
return E(G.reason, G.file ?? _), i({
|
|
2494
2511
|
status: "error",
|
|
2495
2512
|
error: G.error
|
|
2496
2513
|
});
|
|
2497
|
-
|
|
2514
|
+
i({
|
|
2498
2515
|
status: "pending",
|
|
2499
|
-
files:
|
|
2516
|
+
files: O
|
|
2500
2517
|
});
|
|
2501
|
-
let
|
|
2518
|
+
let L;
|
|
2502
2519
|
try {
|
|
2503
|
-
const
|
|
2520
|
+
const U = await Promise.all(y.map(async (D) => {
|
|
2504
2521
|
try {
|
|
2505
2522
|
return {
|
|
2506
|
-
...
|
|
2507
|
-
data: await
|
|
2523
|
+
...Xt(D),
|
|
2524
|
+
data: await gn(D)
|
|
2508
2525
|
};
|
|
2509
|
-
} catch (
|
|
2510
|
-
throw
|
|
2526
|
+
} catch (T) {
|
|
2527
|
+
throw L ?? (L = D), T;
|
|
2511
2528
|
}
|
|
2512
2529
|
}));
|
|
2513
|
-
n.current ===
|
|
2530
|
+
n.current === F && i({
|
|
2514
2531
|
status: "ready",
|
|
2515
|
-
files:
|
|
2532
|
+
files: U
|
|
2516
2533
|
});
|
|
2517
2534
|
} catch {
|
|
2518
|
-
if (n.current !==
|
|
2535
|
+
if (n.current !== F)
|
|
2519
2536
|
return;
|
|
2520
|
-
E("unreadable",
|
|
2537
|
+
E("unreadable", L ?? _), i({
|
|
2521
2538
|
status: "error",
|
|
2522
2539
|
error: {
|
|
2523
2540
|
type: "invalid",
|
|
@@ -2535,57 +2552,57 @@ const Je = st("outline-divider ease-expo-out placeholder:text-neutral-10 text-ne
|
|
|
2535
2552
|
class: "flex h-full flex-col items-center gap-2",
|
|
2536
2553
|
children: [u(Ee, {
|
|
2537
2554
|
disabled: o.length === 0
|
|
2538
|
-
}), e.config.optional && u(
|
|
2555
|
+
}), e.config.optional && u(Ae, {
|
|
2539
2556
|
class: "relative",
|
|
2540
2557
|
onClick: () => r(null)
|
|
2541
2558
|
})]
|
|
2542
2559
|
})]
|
|
2543
|
-
}), u(
|
|
2544
|
-
error:
|
|
2560
|
+
}), u(Pe, {
|
|
2561
|
+
error: p
|
|
2545
2562
|
})]
|
|
2546
2563
|
});
|
|
2547
2564
|
};
|
|
2548
|
-
var
|
|
2565
|
+
var Qe = (e) => e.type === "checkbox", Ve = (e) => e instanceof Date, re = (e) => e == null;
|
|
2549
2566
|
const $r = (e) => typeof e == "object";
|
|
2550
|
-
var
|
|
2567
|
+
var K = (e) => !re(e) && !Array.isArray(e) && $r(e) && !Ve(e), Cn = (e) => K(e) && e.target ? Qe(e.target) ? e.target.checked : e.target.value : e, Sn = (e) => e.substring(0, e.search(/\.\d+(\.|$)/)) || e, In = (e, r) => e.has(Sn(r)), An = (e) => {
|
|
2551
2568
|
const r = e.constructor && e.constructor.prototype;
|
|
2552
|
-
return
|
|
2553
|
-
},
|
|
2554
|
-
function
|
|
2569
|
+
return K(r) && r.hasOwnProperty("isPrototypeOf");
|
|
2570
|
+
}, Mt = typeof window < "u" && typeof window.HTMLElement < "u" && typeof document < "u";
|
|
2571
|
+
function J(e) {
|
|
2555
2572
|
if (e instanceof Date)
|
|
2556
2573
|
return new Date(e);
|
|
2557
2574
|
const r = typeof FileList < "u" && e instanceof FileList;
|
|
2558
|
-
if (
|
|
2575
|
+
if (Mt && (e instanceof Blob || r))
|
|
2559
2576
|
return e;
|
|
2560
2577
|
const t = Array.isArray(e);
|
|
2561
|
-
if (!t && !(
|
|
2578
|
+
if (!t && !(K(e) && An(e)))
|
|
2562
2579
|
return e;
|
|
2563
2580
|
const s = t ? [] : Object.create(Object.getPrototypeOf(e));
|
|
2564
|
-
for (const
|
|
2565
|
-
Object.prototype.hasOwnProperty.call(e,
|
|
2581
|
+
for (const a in e)
|
|
2582
|
+
Object.prototype.hasOwnProperty.call(e, a) && (s[a] = J(e[a]));
|
|
2566
2583
|
return s;
|
|
2567
2584
|
}
|
|
2568
|
-
var
|
|
2569
|
-
if (!r || !
|
|
2585
|
+
var dt = (e) => /^\w*$/.test(e), z = (e) => e === void 0, Et = (e) => Array.isArray(e) ? e.filter(Boolean) : [], Nt = (e) => Et(e.replace(/["|']|\]/g, "").split(/\.|\[/)), S = (e, r, t) => {
|
|
2586
|
+
if (!r || !K(e))
|
|
2570
2587
|
return t;
|
|
2571
|
-
const s = (
|
|
2588
|
+
const s = (dt(r) ? [r] : Nt(r)).reduce((a, i) => re(a) ? a : a[i], e);
|
|
2572
2589
|
return z(s) || s === e ? z(e[r]) ? t : e[r] : s;
|
|
2573
|
-
},
|
|
2590
|
+
}, fe = (e) => typeof e == "boolean", oe = (e) => typeof e == "function", j = (e, r, t) => {
|
|
2574
2591
|
let s = -1;
|
|
2575
|
-
const
|
|
2576
|
-
for (; ++s <
|
|
2577
|
-
const o =
|
|
2592
|
+
const a = dt(r) ? [r] : Nt(r), i = a.length, n = i - 1;
|
|
2593
|
+
for (; ++s < i; ) {
|
|
2594
|
+
const o = a[s];
|
|
2578
2595
|
let c = t;
|
|
2579
2596
|
if (s !== n) {
|
|
2580
|
-
const
|
|
2581
|
-
c =
|
|
2597
|
+
const p = e[o];
|
|
2598
|
+
c = K(p) || Array.isArray(p) ? p : isNaN(+a[s + 1]) ? {} : [];
|
|
2582
2599
|
}
|
|
2583
2600
|
if (o === "__proto__" || o === "constructor" || o === "prototype")
|
|
2584
2601
|
return;
|
|
2585
2602
|
e[o] = c, e = e[o];
|
|
2586
2603
|
}
|
|
2587
2604
|
};
|
|
2588
|
-
const
|
|
2605
|
+
const Zt = {
|
|
2589
2606
|
BLUR: "blur",
|
|
2590
2607
|
FOCUS_OUT: "focusout",
|
|
2591
2608
|
CHANGE: "change"
|
|
@@ -2595,7 +2612,7 @@ const Xt = {
|
|
|
2595
2612
|
onSubmit: "onSubmit",
|
|
2596
2613
|
onTouched: "onTouched",
|
|
2597
2614
|
all: "all"
|
|
2598
|
-
},
|
|
2615
|
+
}, be = {
|
|
2599
2616
|
max: "max",
|
|
2600
2617
|
min: "min",
|
|
2601
2618
|
maxLength: "maxLength",
|
|
@@ -2603,67 +2620,67 @@ const Xt = {
|
|
|
2603
2620
|
pattern: "pattern",
|
|
2604
2621
|
required: "required",
|
|
2605
2622
|
validate: "validate"
|
|
2606
|
-
},
|
|
2607
|
-
|
|
2608
|
-
var
|
|
2609
|
-
const
|
|
2623
|
+
}, Fn = Q.createContext(null);
|
|
2624
|
+
Fn.displayName = "HookFormControlContext";
|
|
2625
|
+
var Vn = (e, r, t, s = !0) => {
|
|
2626
|
+
const a = {
|
|
2610
2627
|
defaultValues: r._defaultValues
|
|
2611
2628
|
};
|
|
2612
|
-
for (const
|
|
2613
|
-
Object.defineProperty(
|
|
2629
|
+
for (const i in e)
|
|
2630
|
+
Object.defineProperty(a, i, {
|
|
2614
2631
|
get: () => {
|
|
2615
|
-
const n =
|
|
2632
|
+
const n = i;
|
|
2616
2633
|
return r._proxyFormState[n] !== le.all && (r._proxyFormState[n] = !s || le.all), t && (t[n] = !0), e[n];
|
|
2617
2634
|
}
|
|
2618
2635
|
});
|
|
2619
|
-
return
|
|
2636
|
+
return a;
|
|
2620
2637
|
};
|
|
2621
|
-
const
|
|
2622
|
-
var ne = (e) => typeof e == "string",
|
|
2638
|
+
const Mn = typeof window < "u" ? Q.useLayoutEffect : Q.useEffect;
|
|
2639
|
+
var ne = (e) => typeof e == "string", En = (e, r, t, s, a) => ne(e) ? (s && r.watch.add(e), S(t, e, a)) : Array.isArray(e) ? e.map((i) => (s && r.watch.add(i), S(t, i))) : (s && (r.watchAll = !0), t), _t = (e) => re(e) || !$r(e);
|
|
2623
2640
|
function Ce(e, r, t = /* @__PURE__ */ new WeakSet()) {
|
|
2624
|
-
if (
|
|
2641
|
+
if (_t(e) || _t(r))
|
|
2625
2642
|
return Object.is(e, r);
|
|
2626
|
-
if (
|
|
2643
|
+
if (Ve(e) && Ve(r))
|
|
2627
2644
|
return Object.is(e.getTime(), r.getTime());
|
|
2628
|
-
const s = Object.keys(e),
|
|
2629
|
-
if (s.length !==
|
|
2645
|
+
const s = Object.keys(e), a = Object.keys(r);
|
|
2646
|
+
if (s.length !== a.length)
|
|
2630
2647
|
return !1;
|
|
2631
2648
|
if (t.has(e) || t.has(r))
|
|
2632
2649
|
return !0;
|
|
2633
2650
|
t.add(e), t.add(r);
|
|
2634
|
-
for (const
|
|
2635
|
-
const n = e[
|
|
2636
|
-
if (!
|
|
2651
|
+
for (const i of s) {
|
|
2652
|
+
const n = e[i];
|
|
2653
|
+
if (!a.includes(i))
|
|
2637
2654
|
return !1;
|
|
2638
|
-
if (
|
|
2639
|
-
const o = r[
|
|
2640
|
-
if (
|
|
2655
|
+
if (i !== "ref") {
|
|
2656
|
+
const o = r[i];
|
|
2657
|
+
if (Ve(n) && Ve(o) || K(n) && K(o) || Array.isArray(n) && Array.isArray(o) ? !Ce(n, o, t) : !Object.is(n, o))
|
|
2641
2658
|
return !1;
|
|
2642
2659
|
}
|
|
2643
2660
|
}
|
|
2644
2661
|
return !0;
|
|
2645
2662
|
}
|
|
2646
|
-
const
|
|
2647
|
-
|
|
2648
|
-
var qr = (e, r, t, s,
|
|
2663
|
+
const Nn = Q.createContext(null);
|
|
2664
|
+
Nn.displayName = "HookFormContext";
|
|
2665
|
+
var qr = (e, r, t, s, a) => r ? {
|
|
2649
2666
|
...t[e],
|
|
2650
2667
|
types: {
|
|
2651
2668
|
...t[e] && t[e].types ? t[e].types : {},
|
|
2652
|
-
[s]:
|
|
2669
|
+
[s]: a || !0
|
|
2653
2670
|
}
|
|
2654
|
-
} : {},
|
|
2671
|
+
} : {}, Xe = (e) => Array.isArray(e) ? e : [e], Yt = () => {
|
|
2655
2672
|
let e = [];
|
|
2656
2673
|
return {
|
|
2657
2674
|
get observers() {
|
|
2658
2675
|
return e;
|
|
2659
2676
|
},
|
|
2660
|
-
next: (
|
|
2661
|
-
for (const
|
|
2662
|
-
|
|
2677
|
+
next: (a) => {
|
|
2678
|
+
for (const i of e)
|
|
2679
|
+
i.next && i.next(a);
|
|
2663
2680
|
},
|
|
2664
|
-
subscribe: (
|
|
2681
|
+
subscribe: (a) => (e.push(a), {
|
|
2665
2682
|
unsubscribe: () => {
|
|
2666
|
-
e = e.filter((
|
|
2683
|
+
e = e.filter((i) => i !== a);
|
|
2667
2684
|
}
|
|
2668
2685
|
}),
|
|
2669
2686
|
unsubscribe: () => {
|
|
@@ -2675,63 +2692,63 @@ function Ur(e, r) {
|
|
|
2675
2692
|
const t = {};
|
|
2676
2693
|
for (const s in e)
|
|
2677
2694
|
if (e.hasOwnProperty(s)) {
|
|
2678
|
-
const
|
|
2679
|
-
if (
|
|
2680
|
-
const n = Ur(
|
|
2681
|
-
|
|
2695
|
+
const a = e[s], i = r[s];
|
|
2696
|
+
if (a && K(a) && i) {
|
|
2697
|
+
const n = Ur(a, i);
|
|
2698
|
+
K(n) && (t[s] = n);
|
|
2682
2699
|
} else
|
|
2683
|
-
e[s] && (t[s] =
|
|
2700
|
+
e[s] && (t[s] = i);
|
|
2684
2701
|
}
|
|
2685
2702
|
return t;
|
|
2686
2703
|
}
|
|
2687
|
-
var
|
|
2688
|
-
if (!
|
|
2704
|
+
var ee = (e) => K(e) && !Object.keys(e).length, Lt = (e) => e.type === "file", at = (e) => {
|
|
2705
|
+
if (!Mt)
|
|
2689
2706
|
return !1;
|
|
2690
2707
|
const r = e ? e.ownerDocument : 0;
|
|
2691
2708
|
return e instanceof (r && r.defaultView ? r.defaultView.HTMLElement : HTMLElement);
|
|
2692
|
-
}, zr = (e) => e.type === "select-multiple",
|
|
2693
|
-
function
|
|
2709
|
+
}, zr = (e) => e.type === "select-multiple", Dt = (e) => e.type === "radio", Ln = (e) => Dt(e) || Qe(e), xt = (e) => at(e) && e.isConnected;
|
|
2710
|
+
function Dn(e, r) {
|
|
2694
2711
|
const t = r.slice(0, -1).length;
|
|
2695
2712
|
let s = 0;
|
|
2696
2713
|
for (; s < t; )
|
|
2697
2714
|
e = z(e) ? s++ : e[r[s++]];
|
|
2698
2715
|
return e;
|
|
2699
2716
|
}
|
|
2700
|
-
function
|
|
2717
|
+
function Tn(e) {
|
|
2701
2718
|
for (const r in e)
|
|
2702
2719
|
if (e.hasOwnProperty(r) && !z(e[r]))
|
|
2703
2720
|
return !1;
|
|
2704
2721
|
return !0;
|
|
2705
2722
|
}
|
|
2706
|
-
function
|
|
2707
|
-
const t = Array.isArray(r) ? r :
|
|
2708
|
-
return s && delete s[
|
|
2723
|
+
function W(e, r) {
|
|
2724
|
+
const t = Array.isArray(r) ? r : dt(r) ? [r] : Nt(r), s = t.length === 1 ? e : Dn(e, t), a = t.length - 1, i = t[a];
|
|
2725
|
+
return s && delete s[i], a !== 0 && (K(s) && ee(s) || Array.isArray(s) && Tn(s)) && W(e, t.slice(0, -1)), e;
|
|
2709
2726
|
}
|
|
2710
|
-
var
|
|
2727
|
+
var On = (e) => {
|
|
2711
2728
|
for (const r in e)
|
|
2712
2729
|
if (oe(e[r]))
|
|
2713
2730
|
return !0;
|
|
2714
2731
|
return !1;
|
|
2715
2732
|
};
|
|
2716
|
-
function
|
|
2717
|
-
return Array.isArray(e) ||
|
|
2733
|
+
function Wr(e) {
|
|
2734
|
+
return Array.isArray(e) || K(e) && !On(e);
|
|
2718
2735
|
}
|
|
2719
|
-
function
|
|
2736
|
+
function kt(e, r = {}) {
|
|
2720
2737
|
for (const t in e) {
|
|
2721
2738
|
const s = e[t];
|
|
2722
|
-
|
|
2739
|
+
Wr(s) ? (r[t] = Array.isArray(s) ? [] : {}, kt(s, r[t])) : z(s) || (r[t] = !0);
|
|
2723
2740
|
}
|
|
2724
2741
|
return r;
|
|
2725
2742
|
}
|
|
2726
2743
|
function Le(e, r, t) {
|
|
2727
|
-
t || (t =
|
|
2744
|
+
t || (t = kt(r));
|
|
2728
2745
|
for (const s in e) {
|
|
2729
|
-
const
|
|
2730
|
-
if (
|
|
2731
|
-
z(r) ||
|
|
2746
|
+
const a = e[s];
|
|
2747
|
+
if (Wr(a))
|
|
2748
|
+
z(r) || _t(t[s]) ? t[s] = kt(a, Array.isArray(a) ? [] : {}) : Le(a, re(r) ? {} : r[s], t[s]);
|
|
2732
2749
|
else {
|
|
2733
|
-
const
|
|
2734
|
-
t[s] = !Ce(
|
|
2750
|
+
const i = r[s];
|
|
2751
|
+
t[s] = !Ce(a, i);
|
|
2735
2752
|
}
|
|
2736
2753
|
}
|
|
2737
2754
|
return t;
|
|
@@ -2740,7 +2757,7 @@ const Qt = {
|
|
|
2740
2757
|
value: !1,
|
|
2741
2758
|
isValid: !1
|
|
2742
2759
|
}, er = { value: !0, isValid: !0 };
|
|
2743
|
-
var
|
|
2760
|
+
var Kr = (e) => {
|
|
2744
2761
|
if (Array.isArray(e)) {
|
|
2745
2762
|
if (e.length > 1) {
|
|
2746
2763
|
const r = e.filter((t) => t && t.checked && !t.disabled).map((t) => t.value);
|
|
@@ -2763,21 +2780,21 @@ var Hr = (e) => Array.isArray(e) ? e.reduce((r, t) => t && t.checked && !t.disab
|
|
|
2763
2780
|
} : r, tr) : tr;
|
|
2764
2781
|
function rr(e) {
|
|
2765
2782
|
const r = e.ref;
|
|
2766
|
-
return
|
|
2783
|
+
return Lt(r) ? r.files : Dt(r) ? Hr(e.refs).value : zr(r) ? [...r.selectedOptions].map(({ value: t }) => t) : Qe(r) ? Kr(e.refs).value : Gr(z(r.value) ? e.ref.value : r.value, e);
|
|
2767
2784
|
}
|
|
2768
|
-
var
|
|
2769
|
-
const
|
|
2770
|
-
for (const
|
|
2771
|
-
const n = S(r,
|
|
2772
|
-
n && j(
|
|
2785
|
+
var Rn = (e, r, t, s) => {
|
|
2786
|
+
const a = {};
|
|
2787
|
+
for (const i of e) {
|
|
2788
|
+
const n = S(r, i);
|
|
2789
|
+
n && j(a, i, n._f);
|
|
2773
2790
|
}
|
|
2774
2791
|
return {
|
|
2775
2792
|
criteriaMode: t,
|
|
2776
2793
|
names: [...e],
|
|
2777
|
-
fields:
|
|
2794
|
+
fields: a,
|
|
2778
2795
|
shouldUseNativeValidation: s
|
|
2779
2796
|
};
|
|
2780
|
-
},
|
|
2797
|
+
}, it = (e) => e instanceof RegExp, ze = (e) => z(e) ? e : it(e) ? e.source : K(e) ? it(e.value) ? e.value.source : e.value : e, sr = (e) => ({
|
|
2781
2798
|
isOnSubmit: !e || e === le.onSubmit,
|
|
2782
2799
|
isOnBlur: e === le.onBlur,
|
|
2783
2800
|
isOnChange: e === le.onChange,
|
|
@@ -2785,160 +2802,160 @@ var Dn = (e, r, t, s) => {
|
|
|
2785
2802
|
isOnTouch: e === le.onTouched
|
|
2786
2803
|
});
|
|
2787
2804
|
const nr = "AsyncFunction";
|
|
2788
|
-
var
|
|
2789
|
-
const
|
|
2790
|
-
for (const
|
|
2791
|
-
const
|
|
2792
|
-
if (
|
|
2793
|
-
const { _f: n, ...o } =
|
|
2805
|
+
var Pn = (e) => !!e && !!e.validate && !!(oe(e.validate) && e.validate.constructor.name === nr || K(e.validate) && Object.values(e.validate).find((r) => r.constructor.name === nr)), Bn = (e) => e.mount && (e.required || e.min || e.max || e.maxLength || e.minLength || e.pattern || e.validate), ar = (e, r, t) => !t && (r.watchAll || r.watch.has(e) || [...r.watch].some((s) => e.startsWith(s) && /^\.\w+/.test(e.slice(s.length))));
|
|
2806
|
+
const Ze = (e, r, t, s) => {
|
|
2807
|
+
for (const a of t || Object.keys(e)) {
|
|
2808
|
+
const i = S(e, a);
|
|
2809
|
+
if (i) {
|
|
2810
|
+
const { _f: n, ...o } = i;
|
|
2794
2811
|
if (n) {
|
|
2795
|
-
if (n.refs && n.refs[0] && r(n.refs[0],
|
|
2812
|
+
if (n.refs && n.refs[0] && r(n.refs[0], a) && !s)
|
|
2796
2813
|
return !0;
|
|
2797
2814
|
if (n.ref && r(n.ref, n.name) && !s)
|
|
2798
2815
|
return !0;
|
|
2799
|
-
if (
|
|
2816
|
+
if (Ze(o, r))
|
|
2800
2817
|
break;
|
|
2801
|
-
} else if (
|
|
2818
|
+
} else if (K(o) && Ze(o, r))
|
|
2802
2819
|
break;
|
|
2803
2820
|
}
|
|
2804
2821
|
}
|
|
2805
2822
|
};
|
|
2806
|
-
function
|
|
2823
|
+
function ir(e, r, t) {
|
|
2807
2824
|
const s = S(e, t);
|
|
2808
|
-
if (s ||
|
|
2825
|
+
if (s || dt(t))
|
|
2809
2826
|
return {
|
|
2810
2827
|
error: s,
|
|
2811
2828
|
name: t
|
|
2812
2829
|
};
|
|
2813
|
-
const
|
|
2814
|
-
for (;
|
|
2815
|
-
const
|
|
2816
|
-
if (n && !Array.isArray(n) && t !==
|
|
2830
|
+
const a = t.split(".");
|
|
2831
|
+
for (; a.length; ) {
|
|
2832
|
+
const i = a.join("."), n = S(r, i), o = S(e, i);
|
|
2833
|
+
if (n && !Array.isArray(n) && t !== i)
|
|
2817
2834
|
return { name: t };
|
|
2818
2835
|
if (o && o.type)
|
|
2819
2836
|
return {
|
|
2820
|
-
name:
|
|
2837
|
+
name: i,
|
|
2821
2838
|
error: o
|
|
2822
2839
|
};
|
|
2823
2840
|
if (o && o.root && o.root.type)
|
|
2824
2841
|
return {
|
|
2825
|
-
name: `${
|
|
2842
|
+
name: `${i}.root`,
|
|
2826
2843
|
error: o.root
|
|
2827
2844
|
};
|
|
2828
|
-
|
|
2845
|
+
a.pop();
|
|
2829
2846
|
}
|
|
2830
2847
|
return {
|
|
2831
2848
|
name: t
|
|
2832
2849
|
};
|
|
2833
2850
|
}
|
|
2834
|
-
var
|
|
2851
|
+
var jn = (e, r, t, s) => {
|
|
2835
2852
|
t(e);
|
|
2836
|
-
const { name:
|
|
2837
|
-
return
|
|
2838
|
-
},
|
|
2839
|
-
const s =
|
|
2853
|
+
const { name: a, ...i } = e;
|
|
2854
|
+
return ee(i) || Object.keys(i).length >= Object.keys(r).length || Object.keys(i).find((n) => r[n] === (!s || le.all));
|
|
2855
|
+
}, $n = (e, r, t) => !e || !r || e === r || Xe(e).some((s) => s && (t ? s === r : s.startsWith(r) || r.startsWith(s))), qn = (e, r, t, s, a) => a.isOnAll ? !1 : !t && a.isOnTouch ? !(r || e) : (t ? s.isOnBlur : a.isOnBlur) ? !e : (t ? s.isOnChange : a.isOnChange) ? e : !0, Un = (e, r) => !Et(S(e, r)).length && W(e, r), zn = (e, r, t) => {
|
|
2856
|
+
const s = Xe(S(e, t));
|
|
2840
2857
|
return j(s, "root", r[t]), j(e, t, s), e;
|
|
2841
2858
|
};
|
|
2842
2859
|
function or(e, r, t = "validate") {
|
|
2843
|
-
if (ne(e) || Array.isArray(e) && e.every(ne) ||
|
|
2860
|
+
if (ne(e) || Array.isArray(e) && e.every(ne) || fe(e) && !e)
|
|
2844
2861
|
return {
|
|
2845
2862
|
type: t,
|
|
2846
2863
|
message: ne(e) ? e : "",
|
|
2847
2864
|
ref: r
|
|
2848
2865
|
};
|
|
2849
2866
|
}
|
|
2850
|
-
var Ne = (e) =>
|
|
2867
|
+
var Ne = (e) => K(e) && !it(e) ? e : {
|
|
2851
2868
|
value: e,
|
|
2852
2869
|
message: ""
|
|
2853
|
-
}, lr = async (e, r, t, s,
|
|
2854
|
-
const { ref: n, refs: o, required: c, maxLength:
|
|
2870
|
+
}, lr = async (e, r, t, s, a, i) => {
|
|
2871
|
+
const { ref: n, refs: o, required: c, maxLength: p, minLength: b, min: x, max: h, pattern: m, validate: C, name: E, valueAsNumber: V, mount: I } = e._f, y = S(t, E);
|
|
2855
2872
|
if (!I || r.has(E))
|
|
2856
2873
|
return {};
|
|
2857
|
-
const _ = o ? o[0] : n,
|
|
2858
|
-
|
|
2859
|
-
}, M = {},
|
|
2860
|
-
const
|
|
2874
|
+
const _ = o ? o[0] : n, F = (w) => {
|
|
2875
|
+
a && _.reportValidity && (_.setCustomValidity(fe(w) ? "" : w || ""), _.reportValidity());
|
|
2876
|
+
}, M = {}, O = Dt(n), G = Qe(n), L = O || G, U = (V || Lt(n)) && z(n.value) && z(y) || at(n) && n.value === "" || y === "" || Array.isArray(y) && !y.length, D = qr.bind(null, E, s, M), T = (w, N, q, H = be.maxLength, X = be.minLength) => {
|
|
2877
|
+
const te = w ? N : q;
|
|
2861
2878
|
M[E] = {
|
|
2862
|
-
type: w ?
|
|
2863
|
-
message:
|
|
2879
|
+
type: w ? H : X,
|
|
2880
|
+
message: te,
|
|
2864
2881
|
ref: n,
|
|
2865
|
-
...
|
|
2882
|
+
...D(w ? H : X, te)
|
|
2866
2883
|
};
|
|
2867
2884
|
};
|
|
2868
|
-
if (
|
|
2869
|
-
const { value: w, message:
|
|
2885
|
+
if (i ? !Array.isArray(y) || !y.length : c && (!L && (U || re(y)) || fe(y) && !y || G && !Kr(o).isValid || O && !Hr(o).isValid)) {
|
|
2886
|
+
const { value: w, message: N } = ne(c) ? { value: !!c, message: c } : Ne(c);
|
|
2870
2887
|
if (w && (M[E] = {
|
|
2871
|
-
type:
|
|
2872
|
-
message:
|
|
2888
|
+
type: be.required,
|
|
2889
|
+
message: N,
|
|
2873
2890
|
ref: _,
|
|
2874
|
-
...
|
|
2891
|
+
...D(be.required, N)
|
|
2875
2892
|
}, !s))
|
|
2876
|
-
return
|
|
2893
|
+
return F(N), M;
|
|
2877
2894
|
}
|
|
2878
|
-
if (!
|
|
2879
|
-
let w,
|
|
2880
|
-
const
|
|
2895
|
+
if (!U && (!re(x) || !re(h))) {
|
|
2896
|
+
let w, N;
|
|
2897
|
+
const q = Ne(h), H = Ne(x);
|
|
2881
2898
|
if (!re(y) && !isNaN(y)) {
|
|
2882
2899
|
const X = n.valueAsNumber || y && +y;
|
|
2883
|
-
re(
|
|
2900
|
+
re(q.value) || (w = X > q.value), re(H.value) || (N = X < H.value);
|
|
2884
2901
|
} else {
|
|
2885
|
-
const X = n.valueAsDate || new Date(y),
|
|
2886
|
-
ne(
|
|
2902
|
+
const X = n.valueAsDate || new Date(y), te = (ce) => /* @__PURE__ */ new Date((/* @__PURE__ */ new Date()).toDateString() + " " + ce), _e = n.type == "time", ue = n.type == "week";
|
|
2903
|
+
ne(q.value) && y && (w = _e ? te(y) > te(q.value) : ue ? y > q.value : X > new Date(q.value)), ne(H.value) && y && (N = _e ? te(y) < te(H.value) : ue ? y < H.value : X < new Date(H.value));
|
|
2887
2904
|
}
|
|
2888
|
-
if ((w ||
|
|
2889
|
-
return
|
|
2905
|
+
if ((w || N) && (T(!!w, q.message, H.message, be.max, be.min), !s))
|
|
2906
|
+
return F(M[E].message), M;
|
|
2890
2907
|
}
|
|
2891
|
-
if ((
|
|
2892
|
-
const w = Ne(
|
|
2893
|
-
if ((
|
|
2894
|
-
return
|
|
2908
|
+
if ((p || b) && !U && (ne(y) || i && Array.isArray(y))) {
|
|
2909
|
+
const w = Ne(p), N = Ne(b), q = !re(w.value) && y.length > +w.value, H = !re(N.value) && y.length < +N.value;
|
|
2910
|
+
if ((q || H) && (T(q, w.message, N.message), !s))
|
|
2911
|
+
return F(M[E].message), M;
|
|
2895
2912
|
}
|
|
2896
|
-
if (m && !
|
|
2897
|
-
const { value: w, message:
|
|
2898
|
-
if (
|
|
2899
|
-
type:
|
|
2900
|
-
message:
|
|
2913
|
+
if (m && !U && ne(y)) {
|
|
2914
|
+
const { value: w, message: N } = Ne(m);
|
|
2915
|
+
if (it(w) && !y.match(w) && (M[E] = {
|
|
2916
|
+
type: be.pattern,
|
|
2917
|
+
message: N,
|
|
2901
2918
|
ref: n,
|
|
2902
|
-
...
|
|
2919
|
+
...D(be.pattern, N)
|
|
2903
2920
|
}, !s))
|
|
2904
|
-
return
|
|
2921
|
+
return F(N), M;
|
|
2905
2922
|
}
|
|
2906
2923
|
if (C) {
|
|
2907
2924
|
if (oe(C)) {
|
|
2908
|
-
const w = await C(y, t),
|
|
2909
|
-
if (
|
|
2910
|
-
...
|
|
2911
|
-
...
|
|
2925
|
+
const w = await C(y, t), N = or(w, _);
|
|
2926
|
+
if (N && (M[E] = {
|
|
2927
|
+
...N,
|
|
2928
|
+
...D(be.validate, N.message)
|
|
2912
2929
|
}, !s))
|
|
2913
|
-
return
|
|
2914
|
-
} else if (
|
|
2930
|
+
return F(N.message), M;
|
|
2931
|
+
} else if (K(C)) {
|
|
2915
2932
|
let w = {};
|
|
2916
|
-
for (const
|
|
2917
|
-
if (!
|
|
2933
|
+
for (const N in C) {
|
|
2934
|
+
if (!ee(w) && !s)
|
|
2918
2935
|
break;
|
|
2919
|
-
const
|
|
2920
|
-
|
|
2921
|
-
...
|
|
2922
|
-
...
|
|
2923
|
-
},
|
|
2936
|
+
const q = or(await C[N](y, t), _, N);
|
|
2937
|
+
q && (w = {
|
|
2938
|
+
...q,
|
|
2939
|
+
...D(N, q.message)
|
|
2940
|
+
}, F(q.message), s && (M[E] = w));
|
|
2924
2941
|
}
|
|
2925
|
-
if (!
|
|
2942
|
+
if (!ee(w) && (M[E] = {
|
|
2926
2943
|
ref: _,
|
|
2927
2944
|
...w
|
|
2928
2945
|
}, !s))
|
|
2929
2946
|
return M;
|
|
2930
2947
|
}
|
|
2931
2948
|
}
|
|
2932
|
-
return
|
|
2949
|
+
return F(!0), M;
|
|
2933
2950
|
};
|
|
2934
|
-
const
|
|
2951
|
+
const Wn = {
|
|
2935
2952
|
mode: le.onSubmit,
|
|
2936
2953
|
reValidateMode: le.onChange,
|
|
2937
2954
|
shouldFocusError: !0
|
|
2938
2955
|
};
|
|
2939
|
-
function
|
|
2956
|
+
function Kn(e = {}) {
|
|
2940
2957
|
let r = {
|
|
2941
|
-
...
|
|
2958
|
+
...Wn,
|
|
2942
2959
|
...e
|
|
2943
2960
|
}, t = {
|
|
2944
2961
|
submitCount: 0,
|
|
@@ -2955,7 +2972,7 @@ function zn(e = {}) {
|
|
|
2955
2972
|
validatingFields: {},
|
|
2956
2973
|
errors: r.errors || {},
|
|
2957
2974
|
disabled: r.disabled || !1
|
|
2958
|
-
}, s = {},
|
|
2975
|
+
}, s = {}, a = K(r.defaultValues) || K(r.values) ? J(r.defaultValues || r.values) || {} : {}, i = r.shouldUnregister ? {} : J(a), n = {
|
|
2959
2976
|
action: !1,
|
|
2960
2977
|
mount: !1,
|
|
2961
2978
|
watch: !1,
|
|
@@ -2966,7 +2983,7 @@ function zn(e = {}) {
|
|
|
2966
2983
|
unMount: /* @__PURE__ */ new Set(),
|
|
2967
2984
|
array: /* @__PURE__ */ new Set(),
|
|
2968
2985
|
watch: /* @__PURE__ */ new Set()
|
|
2969
|
-
}, c,
|
|
2986
|
+
}, c, p = 0;
|
|
2970
2987
|
const b = {
|
|
2971
2988
|
isDirty: !1,
|
|
2972
2989
|
dirtyFields: !1,
|
|
@@ -2978,43 +2995,43 @@ function zn(e = {}) {
|
|
|
2978
2995
|
}, x = {
|
|
2979
2996
|
...b
|
|
2980
2997
|
};
|
|
2981
|
-
let
|
|
2998
|
+
let h = {
|
|
2982
2999
|
...x
|
|
2983
3000
|
};
|
|
2984
3001
|
const m = {
|
|
2985
3002
|
array: Yt(),
|
|
2986
3003
|
state: Yt()
|
|
2987
3004
|
}, C = r.criteriaMode === le.all, E = (l) => (d) => {
|
|
2988
|
-
clearTimeout(
|
|
2989
|
-
},
|
|
2990
|
-
if (!n.keepIsValid && !r.disabled && (x.isValid ||
|
|
3005
|
+
clearTimeout(p), p = setTimeout(l, d);
|
|
3006
|
+
}, V = async (l) => {
|
|
3007
|
+
if (!n.keepIsValid && !r.disabled && (x.isValid || h.isValid || l)) {
|
|
2991
3008
|
let d;
|
|
2992
|
-
r.resolver ? (d =
|
|
3009
|
+
r.resolver ? (d = ee((await L()).errors), I()) : d = await D(s, !0), d !== t.isValid && m.state.next({
|
|
2993
3010
|
isValid: d
|
|
2994
3011
|
});
|
|
2995
3012
|
}
|
|
2996
3013
|
}, I = (l, d) => {
|
|
2997
|
-
!r.disabled && (x.isValidating || x.validatingFields ||
|
|
2998
|
-
f && (d ? j(t.validatingFields, f, d) :
|
|
3014
|
+
!r.disabled && (x.isValidating || x.validatingFields || h.isValidating || h.validatingFields) && ((l || Array.from(o.mount)).forEach((f) => {
|
|
3015
|
+
f && (d ? j(t.validatingFields, f, d) : W(t.validatingFields, f));
|
|
2999
3016
|
}), m.state.next({
|
|
3000
3017
|
validatingFields: t.validatingFields,
|
|
3001
|
-
isValidating: !
|
|
3018
|
+
isValidating: !ee(t.validatingFields)
|
|
3002
3019
|
}));
|
|
3003
3020
|
}, y = (l, d = [], f, k, v = !0, g = !0) => {
|
|
3004
3021
|
if (k && f && !r.disabled) {
|
|
3005
3022
|
if (n.action = !0, g && Array.isArray(S(s, l))) {
|
|
3006
|
-
const
|
|
3007
|
-
v && j(s, l,
|
|
3023
|
+
const A = f(S(s, l), k.argA, k.argB);
|
|
3024
|
+
v && j(s, l, A);
|
|
3008
3025
|
}
|
|
3009
3026
|
if (g && Array.isArray(S(t.errors, l))) {
|
|
3010
|
-
const
|
|
3011
|
-
v && j(t.errors, l,
|
|
3027
|
+
const A = f(S(t.errors, l), k.argA, k.argB);
|
|
3028
|
+
v && j(t.errors, l, A), Un(t.errors, l);
|
|
3012
3029
|
}
|
|
3013
|
-
if ((x.touchedFields ||
|
|
3014
|
-
const
|
|
3015
|
-
v && j(t.touchedFields, l,
|
|
3030
|
+
if ((x.touchedFields || h.touchedFields) && g && Array.isArray(S(t.touchedFields, l))) {
|
|
3031
|
+
const A = f(S(t.touchedFields, l), k.argA, k.argB);
|
|
3032
|
+
v && j(t.touchedFields, l, A);
|
|
3016
3033
|
}
|
|
3017
|
-
(x.dirtyFields ||
|
|
3034
|
+
(x.dirtyFields || h.dirtyFields) && (t.dirtyFields = Le(a, i)), m.state.next({
|
|
3018
3035
|
name: l,
|
|
3019
3036
|
isDirty: w(l, d),
|
|
3020
3037
|
dirtyFields: t.dirtyFields,
|
|
@@ -3022,12 +3039,12 @@ function zn(e = {}) {
|
|
|
3022
3039
|
isValid: t.isValid
|
|
3023
3040
|
});
|
|
3024
3041
|
} else
|
|
3025
|
-
j(
|
|
3042
|
+
j(i, l, d);
|
|
3026
3043
|
}, _ = (l, d) => {
|
|
3027
3044
|
j(t.errors, l, d), m.state.next({
|
|
3028
3045
|
errors: t.errors
|
|
3029
3046
|
});
|
|
3030
|
-
},
|
|
3047
|
+
}, F = (l) => {
|
|
3031
3048
|
t.errors = l, m.state.next({
|
|
3032
3049
|
errors: t.errors,
|
|
3033
3050
|
isValid: !1
|
|
@@ -3035,165 +3052,165 @@ function zn(e = {}) {
|
|
|
3035
3052
|
}, M = (l, d, f, k) => {
|
|
3036
3053
|
const v = S(s, l);
|
|
3037
3054
|
if (v) {
|
|
3038
|
-
const g = S(
|
|
3039
|
-
z(g) || k && k.defaultChecked || d ? j(
|
|
3055
|
+
const g = S(i, l, z(f) ? S(a, l) : f);
|
|
3056
|
+
z(g) || k && k.defaultChecked || d ? j(i, l, d ? g : rr(v._f)) : H(l, g), n.mount && !n.action && V();
|
|
3040
3057
|
}
|
|
3041
|
-
},
|
|
3042
|
-
let g = !1,
|
|
3058
|
+
}, O = (l, d, f, k, v) => {
|
|
3059
|
+
let g = !1, A = !1;
|
|
3043
3060
|
const R = {
|
|
3044
3061
|
name: l
|
|
3045
3062
|
};
|
|
3046
3063
|
if (!r.disabled) {
|
|
3047
3064
|
if (!f || k) {
|
|
3048
|
-
(x.isDirty ||
|
|
3049
|
-
const
|
|
3050
|
-
|
|
3065
|
+
(x.isDirty || h.isDirty) && (A = t.isDirty, t.isDirty = R.isDirty = w(), g = A !== R.isDirty);
|
|
3066
|
+
const P = Ce(S(a, l), d);
|
|
3067
|
+
A = !!S(t.dirtyFields, l), P ? W(t.dirtyFields, l) : j(t.dirtyFields, l, !0), R.dirtyFields = t.dirtyFields, g = g || (x.dirtyFields || h.dirtyFields) && A !== !P;
|
|
3051
3068
|
}
|
|
3052
3069
|
if (f) {
|
|
3053
|
-
const
|
|
3054
|
-
|
|
3070
|
+
const P = S(t.touchedFields, l);
|
|
3071
|
+
P || (j(t.touchedFields, l, f), R.touchedFields = t.touchedFields, g = g || (x.touchedFields || h.touchedFields) && P !== f);
|
|
3055
3072
|
}
|
|
3056
3073
|
g && v && m.state.next(R);
|
|
3057
3074
|
}
|
|
3058
3075
|
return g ? R : {};
|
|
3059
3076
|
}, G = (l, d, f, k) => {
|
|
3060
|
-
const v = S(t.errors, l), g = (x.isValid ||
|
|
3061
|
-
if (r.delayError && f ? (c = E(() => _(l, f)), c(r.delayError)) : (clearTimeout(
|
|
3062
|
-
const
|
|
3077
|
+
const v = S(t.errors, l), g = (x.isValid || h.isValid) && fe(d) && t.isValid !== d;
|
|
3078
|
+
if (r.delayError && f ? (c = E(() => _(l, f)), c(r.delayError)) : (clearTimeout(p), c = null, f ? j(t.errors, l, f) : W(t.errors, l)), (f ? !Ce(v, f) : v) || !ee(k) || g) {
|
|
3079
|
+
const A = {
|
|
3063
3080
|
...k,
|
|
3064
|
-
...g &&
|
|
3081
|
+
...g && fe(d) ? { isValid: d } : {},
|
|
3065
3082
|
errors: t.errors,
|
|
3066
3083
|
name: l
|
|
3067
3084
|
};
|
|
3068
3085
|
t = {
|
|
3069
3086
|
...t,
|
|
3070
|
-
...
|
|
3071
|
-
}, m.state.next(
|
|
3087
|
+
...A
|
|
3088
|
+
}, m.state.next(A);
|
|
3072
3089
|
}
|
|
3073
|
-
},
|
|
3074
|
-
const { errors: d } = await
|
|
3090
|
+
}, L = async (l) => (I(l, !0), await r.resolver(i, r.context, Rn(l || o.mount, s, r.criteriaMode, r.shouldUseNativeValidation))), U = async (l) => {
|
|
3091
|
+
const { errors: d } = await L(l);
|
|
3075
3092
|
if (I(l), l)
|
|
3076
3093
|
for (const f of l) {
|
|
3077
3094
|
const k = S(d, f);
|
|
3078
|
-
k ? j(t.errors, f, k) :
|
|
3095
|
+
k ? j(t.errors, f, k) : W(t.errors, f);
|
|
3079
3096
|
}
|
|
3080
3097
|
else
|
|
3081
3098
|
t.errors = d;
|
|
3082
3099
|
return d;
|
|
3083
|
-
},
|
|
3100
|
+
}, D = async (l, d, f = {
|
|
3084
3101
|
valid: !0
|
|
3085
3102
|
}) => {
|
|
3086
3103
|
for (const k in l) {
|
|
3087
3104
|
const v = l[k];
|
|
3088
3105
|
if (v) {
|
|
3089
|
-
const { _f: g, ...
|
|
3106
|
+
const { _f: g, ...A } = v;
|
|
3090
3107
|
if (g) {
|
|
3091
|
-
const R = o.array.has(g.name),
|
|
3092
|
-
|
|
3093
|
-
const
|
|
3094
|
-
if (
|
|
3108
|
+
const R = o.array.has(g.name), P = v._f && Pn(v._f);
|
|
3109
|
+
P && x.validatingFields && I([g.name], !0);
|
|
3110
|
+
const Y = await lr(v, o.disabled, i, C, r.shouldUseNativeValidation && !d, R);
|
|
3111
|
+
if (P && x.validatingFields && I([g.name]), Y[g.name] && (f.valid = !1, d || e.shouldUseNativeValidation))
|
|
3095
3112
|
break;
|
|
3096
|
-
!d && (S(
|
|
3113
|
+
!d && (S(Y, g.name) ? R ? zn(t.errors, Y, g.name) : j(t.errors, g.name, Y[g.name]) : W(t.errors, g.name));
|
|
3097
3114
|
}
|
|
3098
|
-
!
|
|
3115
|
+
!ee(A) && await D(A, d, f);
|
|
3099
3116
|
}
|
|
3100
3117
|
}
|
|
3101
3118
|
return f.valid;
|
|
3102
|
-
},
|
|
3119
|
+
}, T = () => {
|
|
3103
3120
|
for (const l of o.unMount) {
|
|
3104
3121
|
const d = S(s, l);
|
|
3105
|
-
d && (d._f.refs ? d._f.refs.every((f) => !
|
|
3122
|
+
d && (d._f.refs ? d._f.refs.every((f) => !xt(f)) : !xt(d._f.ref)) && B(l);
|
|
3106
3123
|
}
|
|
3107
3124
|
o.unMount = /* @__PURE__ */ new Set();
|
|
3108
|
-
}, w = (l, d) => !r.disabled && (l && d && j(
|
|
3109
|
-
...n.mount ?
|
|
3110
|
-
}, f, d),
|
|
3125
|
+
}, w = (l, d) => !r.disabled && (l && d && j(i, l, d), !Ce(Be(), a)), N = (l, d, f) => En(l, o, {
|
|
3126
|
+
...n.mount ? i : z(d) ? a : ne(l) ? { [l]: d } : d
|
|
3127
|
+
}, f, d), q = (l) => Et(S(n.mount ? i : a, l, r.shouldUnregister ? S(a, l, []) : [])), H = (l, d, f = {}) => {
|
|
3111
3128
|
const k = S(s, l);
|
|
3112
3129
|
let v = d;
|
|
3113
3130
|
if (k) {
|
|
3114
3131
|
const g = k._f;
|
|
3115
|
-
g && (!g.disabled && j(
|
|
3116
|
-
(!
|
|
3117
|
-
}) : g.refs.forEach((
|
|
3132
|
+
g && (!g.disabled && j(i, l, Gr(d, g)), v = at(g.ref) && re(d) ? "" : d, zr(g.ref) ? [...g.ref.options].forEach((A) => A.selected = v.includes(A.value)) : g.refs ? Qe(g.ref) ? g.refs.forEach((A) => {
|
|
3133
|
+
(!A.defaultChecked || !A.disabled) && (Array.isArray(v) ? A.checked = !!v.find((R) => R === A.value) : A.checked = v === A.value || !!v);
|
|
3134
|
+
}) : g.refs.forEach((A) => A.checked = A.value === v) : Lt(g.ref) ? g.ref.value = "" : (g.ref.value = v, g.ref.type || m.state.next({
|
|
3118
3135
|
name: l,
|
|
3119
|
-
values:
|
|
3136
|
+
values: J(i)
|
|
3120
3137
|
})));
|
|
3121
3138
|
}
|
|
3122
|
-
(f.shouldDirty || f.shouldTouch) &&
|
|
3139
|
+
(f.shouldDirty || f.shouldTouch) && O(l, v, f.shouldTouch, f.shouldDirty, !0), f.shouldValidate && ce(l);
|
|
3123
3140
|
}, X = (l, d, f) => {
|
|
3124
3141
|
for (const k in d) {
|
|
3125
3142
|
if (!d.hasOwnProperty(k))
|
|
3126
3143
|
return;
|
|
3127
|
-
const v = d[k], g = l + "." + k,
|
|
3128
|
-
(o.array.has(l) ||
|
|
3144
|
+
const v = d[k], g = l + "." + k, A = S(s, g);
|
|
3145
|
+
(o.array.has(l) || K(v) || A && !A._f) && !Ve(v) ? X(g, v, f) : H(g, v, f);
|
|
3129
3146
|
}
|
|
3130
|
-
},
|
|
3131
|
-
const k = S(s, l), v = o.array.has(l), g =
|
|
3132
|
-
j(
|
|
3147
|
+
}, te = (l, d, f = {}) => {
|
|
3148
|
+
const k = S(s, l), v = o.array.has(l), g = J(d);
|
|
3149
|
+
j(i, l, g), v ? (m.array.next({
|
|
3133
3150
|
name: l,
|
|
3134
|
-
values:
|
|
3135
|
-
}), (x.isDirty || x.dirtyFields ||
|
|
3151
|
+
values: J(i)
|
|
3152
|
+
}), (x.isDirty || x.dirtyFields || h.isDirty || h.dirtyFields) && f.shouldDirty && m.state.next({
|
|
3136
3153
|
name: l,
|
|
3137
|
-
dirtyFields: Le(
|
|
3154
|
+
dirtyFields: Le(a, i),
|
|
3138
3155
|
isDirty: w(l, g)
|
|
3139
|
-
})) : k && !k._f && !re(g) ? X(l, g, f) :
|
|
3156
|
+
})) : k && !k._f && !re(g) ? X(l, g, f) : H(l, g, f), ar(l, o) ? m.state.next({
|
|
3140
3157
|
...t,
|
|
3141
3158
|
name: l,
|
|
3142
|
-
values:
|
|
3159
|
+
values: J(i)
|
|
3143
3160
|
}) : m.state.next({
|
|
3144
3161
|
name: n.mount ? l : void 0,
|
|
3145
|
-
values:
|
|
3162
|
+
values: J(i)
|
|
3146
3163
|
});
|
|
3147
|
-
},
|
|
3164
|
+
}, _e = async (l) => {
|
|
3148
3165
|
n.mount = !0;
|
|
3149
3166
|
const d = l.target;
|
|
3150
3167
|
let f = d.name, k = !0;
|
|
3151
|
-
const v = S(s, f), g = (
|
|
3152
|
-
k = Number.isNaN(
|
|
3153
|
-
},
|
|
3168
|
+
const v = S(s, f), g = (P) => {
|
|
3169
|
+
k = Number.isNaN(P) || Ve(P) && isNaN(P.getTime()) || Ce(P, S(i, f, P));
|
|
3170
|
+
}, A = sr(r.mode), R = sr(r.reValidateMode);
|
|
3154
3171
|
if (v) {
|
|
3155
|
-
let
|
|
3156
|
-
const
|
|
3157
|
-
j(
|
|
3158
|
-
const
|
|
3172
|
+
let P, Y;
|
|
3173
|
+
const Fe = d.type ? rr(v._f) : Cn(l), ke = l.type === Zt.BLUR || l.type === Zt.FOCUS_OUT, es = !Bn(v._f) && !r.resolver && !S(t.errors, f) && !v._f.deps || qn(ke, S(t.touchedFields, f), t.isSubmitted, R, A), ht = ar(f, o, ke);
|
|
3174
|
+
j(i, f, Fe), ke ? (!d || !d.readOnly) && (v._f.onBlur && v._f.onBlur(l), c && c(0)) : v._f.onChange && v._f.onChange(l);
|
|
3175
|
+
const yt = O(f, Fe, ke), ts = !ee(yt) || ht;
|
|
3159
3176
|
if (!ke && m.state.next({
|
|
3160
3177
|
name: f,
|
|
3161
3178
|
type: l.type,
|
|
3162
|
-
values:
|
|
3179
|
+
values: J(i)
|
|
3163
3180
|
}), es)
|
|
3164
|
-
return (x.isValid ||
|
|
3181
|
+
return (x.isValid || h.isValid) && (r.mode === "onBlur" ? ke && V() : ke || V()), ts && m.state.next({ name: f, ...ht ? {} : yt });
|
|
3165
3182
|
if (!ke && ht && m.state.next({ ...t }), r.resolver) {
|
|
3166
|
-
const { errors:
|
|
3167
|
-
if (I([f]), g(
|
|
3168
|
-
const rs =
|
|
3169
|
-
|
|
3183
|
+
const { errors: Bt } = await L([f]);
|
|
3184
|
+
if (I([f]), g(Fe), k) {
|
|
3185
|
+
const rs = ir(t.errors, s, f), jt = ir(Bt, s, rs.name || f);
|
|
3186
|
+
P = jt.error, f = jt.name, Y = ee(Bt);
|
|
3170
3187
|
}
|
|
3171
3188
|
} else
|
|
3172
|
-
I([f], !0),
|
|
3173
|
-
k && (v._f.deps && (!Array.isArray(v._f.deps) || v._f.deps.length > 0) &&
|
|
3189
|
+
I([f], !0), P = (await lr(v, o.disabled, i, C, r.shouldUseNativeValidation))[f], I([f]), g(Fe), k && (P ? Y = !1 : (x.isValid || h.isValid) && (Y = await D(s, !0)));
|
|
3190
|
+
k && (v._f.deps && (!Array.isArray(v._f.deps) || v._f.deps.length > 0) && ce(v._f.deps), G(f, Y, P, yt));
|
|
3174
3191
|
}
|
|
3175
|
-
},
|
|
3192
|
+
}, ue = (l, d) => {
|
|
3176
3193
|
if (S(t.errors, d) && l.focus)
|
|
3177
3194
|
return l.focus(), 1;
|
|
3178
|
-
},
|
|
3195
|
+
}, ce = async (l, d = {}) => {
|
|
3179
3196
|
let f, k;
|
|
3180
|
-
const v =
|
|
3197
|
+
const v = Xe(l);
|
|
3181
3198
|
if (r.resolver) {
|
|
3182
|
-
const g = await
|
|
3183
|
-
f =
|
|
3199
|
+
const g = await U(z(l) ? l : v);
|
|
3200
|
+
f = ee(g), k = l ? !v.some((A) => S(g, A)) : f;
|
|
3184
3201
|
} else
|
|
3185
3202
|
l ? (k = (await Promise.all(v.map(async (g) => {
|
|
3186
|
-
const
|
|
3187
|
-
return await
|
|
3188
|
-
}))).every(Boolean), !(!k && !t.isValid) &&
|
|
3203
|
+
const A = S(s, g);
|
|
3204
|
+
return await D(A && A._f ? { [g]: A } : A);
|
|
3205
|
+
}))).every(Boolean), !(!k && !t.isValid) && V()) : k = f = await D(s);
|
|
3189
3206
|
return m.state.next({
|
|
3190
|
-
...!ne(l) || (x.isValid ||
|
|
3207
|
+
...!ne(l) || (x.isValid || h.isValid) && f !== t.isValid ? {} : { name: l },
|
|
3191
3208
|
...r.resolver || !l ? { isValid: f } : {},
|
|
3192
3209
|
errors: t.errors
|
|
3193
|
-
}), d.shouldFocus && !k &&
|
|
3194
|
-
},
|
|
3210
|
+
}), d.shouldFocus && !k && Ze(s, ue, l ? v : o.mount), k;
|
|
3211
|
+
}, Be = (l, d) => {
|
|
3195
3212
|
let f = {
|
|
3196
|
-
...n.mount ?
|
|
3213
|
+
...n.mount ? i : a
|
|
3197
3214
|
};
|
|
3198
3215
|
return d && (f = Ur(d.dirtyFields ? t.dirtyFields : t.touchedFields, f)), z(l) ? f : ne(l) ? S(f, l) : l.map((k) => S(f, k));
|
|
3199
3216
|
}, je = (l, d) => ({
|
|
@@ -3202,9 +3219,9 @@ function zn(e = {}) {
|
|
|
3202
3219
|
error: S((d || t).errors, l),
|
|
3203
3220
|
isValidating: !!S(t.validatingFields, l),
|
|
3204
3221
|
isTouched: !!S((d || t).touchedFields, l)
|
|
3205
|
-
}),
|
|
3206
|
-
const d = l ?
|
|
3207
|
-
d == null || d.forEach((f) =>
|
|
3222
|
+
}), et = (l) => {
|
|
3223
|
+
const d = l ? Xe(l) : void 0;
|
|
3224
|
+
d == null || d.forEach((f) => W(t.errors, f)), d ? d.forEach((f) => {
|
|
3208
3225
|
m.state.next({
|
|
3209
3226
|
name: f,
|
|
3210
3227
|
errors: t.errors
|
|
@@ -3212,10 +3229,10 @@ function zn(e = {}) {
|
|
|
3212
3229
|
}) : m.state.next({
|
|
3213
3230
|
errors: {}
|
|
3214
3231
|
});
|
|
3215
|
-
},
|
|
3216
|
-
const k = (S(s, l, { _f: {} })._f || {}).ref, v = S(t.errors, l) || {}, { ref: g, message:
|
|
3232
|
+
}, $e = (l, d, f) => {
|
|
3233
|
+
const k = (S(s, l, { _f: {} })._f || {}).ref, v = S(t.errors, l) || {}, { ref: g, message: A, type: R, ...P } = v;
|
|
3217
3234
|
j(t.errors, l, {
|
|
3218
|
-
...
|
|
3235
|
+
...P,
|
|
3219
3236
|
...d,
|
|
3220
3237
|
ref: k
|
|
3221
3238
|
}), m.state.next({
|
|
@@ -3223,43 +3240,43 @@ function zn(e = {}) {
|
|
|
3223
3240
|
errors: t.errors,
|
|
3224
3241
|
isValid: !1
|
|
3225
3242
|
}), f && f.shouldFocus && k && k.focus && k.focus();
|
|
3226
|
-
},
|
|
3227
|
-
next: (f) => "values" in f && l(
|
|
3228
|
-
}) :
|
|
3243
|
+
}, tt = (l, d) => oe(l) ? m.state.subscribe({
|
|
3244
|
+
next: (f) => "values" in f && l(N(void 0, d), f)
|
|
3245
|
+
}) : N(l, d, !0), qe = (l) => m.state.subscribe({
|
|
3229
3246
|
next: (d) => {
|
|
3230
|
-
|
|
3231
|
-
values: { ...
|
|
3247
|
+
$n(l.name, d.name, l.exact) && jn(d, l.formState || x, Qr, l.reRenderRoot) && l.callback({
|
|
3248
|
+
values: { ...i },
|
|
3232
3249
|
...t,
|
|
3233
3250
|
...d,
|
|
3234
|
-
defaultValues:
|
|
3251
|
+
defaultValues: a
|
|
3235
3252
|
});
|
|
3236
3253
|
}
|
|
3237
|
-
}).unsubscribe,
|
|
3238
|
-
...
|
|
3254
|
+
}).unsubscribe, rt = (l) => (n.mount = !0, h = {
|
|
3255
|
+
...h,
|
|
3239
3256
|
...l.formState
|
|
3240
|
-
},
|
|
3257
|
+
}, qe({
|
|
3241
3258
|
...l,
|
|
3242
3259
|
formState: {
|
|
3243
3260
|
...b,
|
|
3244
3261
|
...l.formState
|
|
3245
3262
|
}
|
|
3246
|
-
})),
|
|
3247
|
-
for (const f of l ?
|
|
3248
|
-
o.mount.delete(f), o.array.delete(f), d.keepValue || (
|
|
3263
|
+
})), B = (l, d = {}) => {
|
|
3264
|
+
for (const f of l ? Xe(l) : o.mount)
|
|
3265
|
+
o.mount.delete(f), o.array.delete(f), d.keepValue || (W(s, f), W(i, f)), !d.keepError && W(t.errors, f), !d.keepDirty && W(t.dirtyFields, f), !d.keepTouched && W(t.touchedFields, f), !d.keepIsValidating && W(t.validatingFields, f), !r.shouldUnregister && !d.keepDefaultValue && W(a, f);
|
|
3249
3266
|
m.state.next({
|
|
3250
|
-
values:
|
|
3267
|
+
values: J(i)
|
|
3251
3268
|
}), m.state.next({
|
|
3252
3269
|
...t,
|
|
3253
3270
|
...d.keepDirty ? { isDirty: w() } : {}
|
|
3254
|
-
}), !d.keepIsValid &&
|
|
3255
|
-
},
|
|
3256
|
-
if (
|
|
3271
|
+
}), !d.keepIsValid && V();
|
|
3272
|
+
}, st = ({ disabled: l, name: d }) => {
|
|
3273
|
+
if (fe(l) && n.mount || l || o.disabled.has(d)) {
|
|
3257
3274
|
const v = o.disabled.has(d) !== !!l;
|
|
3258
|
-
l ? o.disabled.add(d) : o.disabled.delete(d), v && n.mount && !n.action &&
|
|
3275
|
+
l ? o.disabled.add(d) : o.disabled.delete(d), v && n.mount && !n.action && V();
|
|
3259
3276
|
}
|
|
3260
|
-
},
|
|
3277
|
+
}, Ue = (l, d = {}) => {
|
|
3261
3278
|
let f = S(s, l);
|
|
3262
|
-
const k =
|
|
3279
|
+
const k = fe(d.disabled) || fe(r.disabled);
|
|
3263
3280
|
return j(s, l, {
|
|
3264
3281
|
...f || {},
|
|
3265
3282
|
_f: {
|
|
@@ -3268,67 +3285,67 @@ function zn(e = {}) {
|
|
|
3268
3285
|
mount: !0,
|
|
3269
3286
|
...d
|
|
3270
3287
|
}
|
|
3271
|
-
}), o.mount.add(l), f ?
|
|
3272
|
-
disabled:
|
|
3288
|
+
}), o.mount.add(l), f ? st({
|
|
3289
|
+
disabled: fe(d.disabled) ? d.disabled : r.disabled,
|
|
3273
3290
|
name: l
|
|
3274
3291
|
}) : M(l, !0, d.value), {
|
|
3275
3292
|
...k ? { disabled: d.disabled || r.disabled } : {},
|
|
3276
3293
|
...r.progressive ? {
|
|
3277
3294
|
required: !!d.required,
|
|
3278
|
-
min:
|
|
3279
|
-
max:
|
|
3280
|
-
minLength:
|
|
3281
|
-
maxLength:
|
|
3282
|
-
pattern:
|
|
3295
|
+
min: ze(d.min),
|
|
3296
|
+
max: ze(d.max),
|
|
3297
|
+
minLength: ze(d.minLength),
|
|
3298
|
+
maxLength: ze(d.maxLength),
|
|
3299
|
+
pattern: ze(d.pattern)
|
|
3283
3300
|
} : {},
|
|
3284
3301
|
name: l,
|
|
3285
|
-
onChange:
|
|
3286
|
-
onBlur:
|
|
3302
|
+
onChange: _e,
|
|
3303
|
+
onBlur: _e,
|
|
3287
3304
|
ref: (v) => {
|
|
3288
3305
|
if (v) {
|
|
3289
|
-
|
|
3290
|
-
const g = z(v.value) && v.querySelectorAll && v.querySelectorAll("input,select,textarea")[0] || v,
|
|
3291
|
-
if (
|
|
3306
|
+
Ue(l, d), f = S(s, l);
|
|
3307
|
+
const g = z(v.value) && v.querySelectorAll && v.querySelectorAll("input,select,textarea")[0] || v, A = Ln(g), R = f._f.refs || [];
|
|
3308
|
+
if (A ? R.find((P) => P === g) : g === f._f.ref)
|
|
3292
3309
|
return;
|
|
3293
3310
|
j(s, l, {
|
|
3294
3311
|
_f: {
|
|
3295
3312
|
...f._f,
|
|
3296
|
-
...
|
|
3313
|
+
...A ? {
|
|
3297
3314
|
refs: [
|
|
3298
|
-
...R.filter(
|
|
3315
|
+
...R.filter(xt),
|
|
3299
3316
|
g,
|
|
3300
|
-
...Array.isArray(S(
|
|
3317
|
+
...Array.isArray(S(a, l)) ? [{}] : []
|
|
3301
3318
|
],
|
|
3302
3319
|
ref: { type: g.type, name: l }
|
|
3303
3320
|
} : { ref: g }
|
|
3304
3321
|
}
|
|
3305
3322
|
}), M(l, !1, void 0, g);
|
|
3306
3323
|
} else
|
|
3307
|
-
f = S(s, l, {}), f._f && (f._f.mount = !1), (r.shouldUnregister || d.shouldUnregister) && !(
|
|
3324
|
+
f = S(s, l, {}), f._f && (f._f.mount = !1), (r.shouldUnregister || d.shouldUnregister) && !(In(o.array, l) && n.action) && o.unMount.add(l);
|
|
3308
3325
|
}
|
|
3309
3326
|
};
|
|
3310
|
-
},
|
|
3311
|
-
|
|
3327
|
+
}, de = () => r.shouldFocusError && Ze(s, ue, o.mount), Xr = (l) => {
|
|
3328
|
+
fe(l) && (m.state.next({ disabled: l }), Ze(s, (d, f) => {
|
|
3312
3329
|
const k = S(s, f);
|
|
3313
3330
|
k && (d.disabled = k._f.disabled || l, Array.isArray(k._f.refs) && k._f.refs.forEach((v) => {
|
|
3314
3331
|
v.disabled = k._f.disabled || l;
|
|
3315
3332
|
}));
|
|
3316
3333
|
}, 0, !1));
|
|
3317
|
-
},
|
|
3334
|
+
}, Tt = (l, d) => async (f) => {
|
|
3318
3335
|
let k;
|
|
3319
3336
|
f && (f.preventDefault && f.preventDefault(), f.persist && f.persist());
|
|
3320
|
-
let v =
|
|
3337
|
+
let v = J(i);
|
|
3321
3338
|
if (m.state.next({
|
|
3322
3339
|
isSubmitting: !0
|
|
3323
3340
|
}), r.resolver) {
|
|
3324
|
-
const { errors: g, values:
|
|
3325
|
-
I(), t.errors = g, v =
|
|
3341
|
+
const { errors: g, values: A } = await L();
|
|
3342
|
+
I(), t.errors = g, v = J(A);
|
|
3326
3343
|
} else
|
|
3327
|
-
await
|
|
3344
|
+
await D(s);
|
|
3328
3345
|
if (o.disabled.size)
|
|
3329
3346
|
for (const g of o.disabled)
|
|
3330
|
-
|
|
3331
|
-
if (
|
|
3347
|
+
W(v, g);
|
|
3348
|
+
if (W(t.errors, "root"), ee(t.errors)) {
|
|
3332
3349
|
m.state.next({
|
|
3333
3350
|
errors: {}
|
|
3334
3351
|
});
|
|
@@ -3338,51 +3355,51 @@ function zn(e = {}) {
|
|
|
3338
3355
|
k = g;
|
|
3339
3356
|
}
|
|
3340
3357
|
} else
|
|
3341
|
-
d && await d({ ...t.errors }, f),
|
|
3358
|
+
d && await d({ ...t.errors }, f), de(), setTimeout(de);
|
|
3342
3359
|
if (m.state.next({
|
|
3343
3360
|
isSubmitted: !0,
|
|
3344
3361
|
isSubmitting: !1,
|
|
3345
|
-
isSubmitSuccessful:
|
|
3362
|
+
isSubmitSuccessful: ee(t.errors) && !k,
|
|
3346
3363
|
submitCount: t.submitCount + 1,
|
|
3347
3364
|
errors: t.errors
|
|
3348
3365
|
}), k)
|
|
3349
3366
|
throw k;
|
|
3350
|
-
},
|
|
3351
|
-
S(s, l) && (z(d.defaultValue) ?
|
|
3367
|
+
}, Zr = (l, d = {}) => {
|
|
3368
|
+
S(s, l) && (z(d.defaultValue) ? te(l, J(S(a, l))) : (te(l, d.defaultValue), j(a, l, J(d.defaultValue))), d.keepTouched || W(t.touchedFields, l), d.keepDirty || (W(t.dirtyFields, l), t.isDirty = d.defaultValue ? w(l, J(S(a, l))) : w()), d.keepError || (W(t.errors, l), x.isValid && V()), m.state.next({ ...t }));
|
|
3352
3369
|
}, Ot = (l, d = {}) => {
|
|
3353
|
-
const f = l ?
|
|
3354
|
-
if (d.keepDefaultValues || (
|
|
3370
|
+
const f = l ? J(l) : a, k = J(f), v = ee(l), g = v ? a : k;
|
|
3371
|
+
if (d.keepDefaultValues || (a = f), !d.keepValues) {
|
|
3355
3372
|
if (d.keepDirtyValues) {
|
|
3356
|
-
const
|
|
3373
|
+
const A = /* @__PURE__ */ new Set([
|
|
3357
3374
|
...o.mount,
|
|
3358
|
-
...Object.keys(Le(
|
|
3375
|
+
...Object.keys(Le(a, i))
|
|
3359
3376
|
]);
|
|
3360
|
-
for (const R of Array.from(
|
|
3361
|
-
const
|
|
3362
|
-
|
|
3377
|
+
for (const R of Array.from(A)) {
|
|
3378
|
+
const P = S(t.dirtyFields, R), Y = S(i, R), Fe = S(g, R);
|
|
3379
|
+
P && !z(Y) ? j(g, R, Y) : !P && !z(Fe) && te(R, Fe);
|
|
3363
3380
|
}
|
|
3364
3381
|
} else {
|
|
3365
|
-
if (
|
|
3366
|
-
for (const
|
|
3367
|
-
const R = S(s,
|
|
3382
|
+
if (Mt && z(l))
|
|
3383
|
+
for (const A of o.mount) {
|
|
3384
|
+
const R = S(s, A);
|
|
3368
3385
|
if (R && R._f) {
|
|
3369
|
-
const
|
|
3370
|
-
if (
|
|
3371
|
-
const
|
|
3372
|
-
if (
|
|
3373
|
-
|
|
3386
|
+
const P = Array.isArray(R._f.refs) ? R._f.refs[0] : R._f.ref;
|
|
3387
|
+
if (at(P)) {
|
|
3388
|
+
const Y = P.closest("form");
|
|
3389
|
+
if (Y) {
|
|
3390
|
+
Y.reset();
|
|
3374
3391
|
break;
|
|
3375
3392
|
}
|
|
3376
3393
|
}
|
|
3377
3394
|
}
|
|
3378
3395
|
}
|
|
3379
3396
|
if (d.keepFieldsRef)
|
|
3380
|
-
for (const
|
|
3381
|
-
|
|
3397
|
+
for (const A of o.mount)
|
|
3398
|
+
te(A, S(g, A));
|
|
3382
3399
|
else
|
|
3383
3400
|
s = {};
|
|
3384
3401
|
}
|
|
3385
|
-
|
|
3402
|
+
i = r.shouldUnregister ? d.keepDefaultValues ? J(a) : {} : J(g), m.array.next({
|
|
3386
3403
|
values: { ...g }
|
|
3387
3404
|
}), m.state.next({
|
|
3388
3405
|
values: { ...g }
|
|
@@ -3396,18 +3413,18 @@ function zn(e = {}) {
|
|
|
3396
3413
|
watch: /* @__PURE__ */ new Set(),
|
|
3397
3414
|
watchAll: !1,
|
|
3398
3415
|
focus: ""
|
|
3399
|
-
}, n.mount = !x.isValid || !!d.keepIsValid || !!d.keepDirtyValues || !r.shouldUnregister && !
|
|
3416
|
+
}, n.mount = !x.isValid || !!d.keepIsValid || !!d.keepDirtyValues || !r.shouldUnregister && !ee(g), n.watch = !!r.shouldUnregister, n.keepIsValid = !!d.keepIsValid, n.action = !1, d.keepErrors || (t.errors = {}), m.state.next({
|
|
3400
3417
|
submitCount: d.keepSubmitCount ? t.submitCount : 0,
|
|
3401
|
-
isDirty: v ? !1 : d.keepDirty ? t.isDirty : !!(d.keepDefaultValues && !Ce(l,
|
|
3418
|
+
isDirty: v ? !1 : d.keepDirty ? t.isDirty : !!(d.keepDefaultValues && !Ce(l, a)),
|
|
3402
3419
|
isSubmitted: d.keepIsSubmitted ? t.isSubmitted : !1,
|
|
3403
|
-
dirtyFields: v ? {} : d.keepDirtyValues ? d.keepDefaultValues &&
|
|
3420
|
+
dirtyFields: v ? {} : d.keepDirtyValues ? d.keepDefaultValues && i ? Le(a, i) : t.dirtyFields : d.keepDefaultValues && l ? Le(a, l) : d.keepDirty ? t.dirtyFields : {},
|
|
3404
3421
|
touchedFields: d.keepTouched ? t.touchedFields : {},
|
|
3405
3422
|
errors: d.keepErrors ? t.errors : {},
|
|
3406
3423
|
isSubmitSuccessful: d.keepIsSubmitSuccessful ? t.isSubmitSuccessful : !1,
|
|
3407
3424
|
isSubmitting: !1,
|
|
3408
|
-
defaultValues:
|
|
3425
|
+
defaultValues: a
|
|
3409
3426
|
});
|
|
3410
|
-
}, Rt = (l, d) => Ot(oe(l) ? l(
|
|
3427
|
+
}, Rt = (l, d) => Ot(oe(l) ? l(i) : l, { ...r.resetOptions, ...d }), Yr = (l, d = {}) => {
|
|
3411
3428
|
const f = S(s, l), k = f && f._f;
|
|
3412
3429
|
if (k) {
|
|
3413
3430
|
const v = k.refs ? k.refs[0] : k.ref;
|
|
@@ -3420,39 +3437,39 @@ function zn(e = {}) {
|
|
|
3420
3437
|
...t,
|
|
3421
3438
|
...l
|
|
3422
3439
|
};
|
|
3423
|
-
},
|
|
3440
|
+
}, Pt = {
|
|
3424
3441
|
control: {
|
|
3425
|
-
register:
|
|
3426
|
-
unregister:
|
|
3442
|
+
register: Ue,
|
|
3443
|
+
unregister: B,
|
|
3427
3444
|
getFieldState: je,
|
|
3428
|
-
handleSubmit:
|
|
3429
|
-
setError:
|
|
3430
|
-
_subscribe:
|
|
3431
|
-
_runSchema:
|
|
3445
|
+
handleSubmit: Tt,
|
|
3446
|
+
setError: $e,
|
|
3447
|
+
_subscribe: qe,
|
|
3448
|
+
_runSchema: L,
|
|
3432
3449
|
_updateIsValidating: I,
|
|
3433
|
-
_focusError:
|
|
3434
|
-
_getWatch:
|
|
3450
|
+
_focusError: de,
|
|
3451
|
+
_getWatch: N,
|
|
3435
3452
|
_getDirty: w,
|
|
3436
|
-
_setValid:
|
|
3453
|
+
_setValid: V,
|
|
3437
3454
|
_setFieldArray: y,
|
|
3438
|
-
_setDisabledField:
|
|
3439
|
-
_setErrors:
|
|
3440
|
-
_getFieldArray:
|
|
3455
|
+
_setDisabledField: st,
|
|
3456
|
+
_setErrors: F,
|
|
3457
|
+
_getFieldArray: q,
|
|
3441
3458
|
_reset: Ot,
|
|
3442
3459
|
_resetDefaultValues: () => oe(r.defaultValues) && r.defaultValues().then((l) => {
|
|
3443
3460
|
Rt(l, r.resetOptions), m.state.next({
|
|
3444
3461
|
isLoading: !1
|
|
3445
3462
|
});
|
|
3446
3463
|
}),
|
|
3447
|
-
_removeUnmounted:
|
|
3448
|
-
_disableForm:
|
|
3464
|
+
_removeUnmounted: T,
|
|
3465
|
+
_disableForm: Xr,
|
|
3449
3466
|
_subjects: m,
|
|
3450
3467
|
_proxyFormState: x,
|
|
3451
3468
|
get _fields() {
|
|
3452
3469
|
return s;
|
|
3453
3470
|
},
|
|
3454
3471
|
get _formValues() {
|
|
3455
|
-
return
|
|
3472
|
+
return i;
|
|
3456
3473
|
},
|
|
3457
3474
|
get _state() {
|
|
3458
3475
|
return n;
|
|
@@ -3461,7 +3478,7 @@ function zn(e = {}) {
|
|
|
3461
3478
|
n = l;
|
|
3462
3479
|
},
|
|
3463
3480
|
get _defaultValues() {
|
|
3464
|
-
return
|
|
3481
|
+
return a;
|
|
3465
3482
|
},
|
|
3466
3483
|
get _names() {
|
|
3467
3484
|
return o;
|
|
@@ -3482,28 +3499,28 @@ function zn(e = {}) {
|
|
|
3482
3499
|
};
|
|
3483
3500
|
}
|
|
3484
3501
|
},
|
|
3485
|
-
subscribe:
|
|
3486
|
-
trigger:
|
|
3487
|
-
register:
|
|
3488
|
-
handleSubmit:
|
|
3489
|
-
watch:
|
|
3490
|
-
setValue:
|
|
3491
|
-
getValues:
|
|
3502
|
+
subscribe: rt,
|
|
3503
|
+
trigger: ce,
|
|
3504
|
+
register: Ue,
|
|
3505
|
+
handleSubmit: Tt,
|
|
3506
|
+
watch: tt,
|
|
3507
|
+
setValue: te,
|
|
3508
|
+
getValues: Be,
|
|
3492
3509
|
reset: Rt,
|
|
3493
|
-
resetField:
|
|
3494
|
-
clearErrors:
|
|
3495
|
-
unregister:
|
|
3496
|
-
setError:
|
|
3510
|
+
resetField: Zr,
|
|
3511
|
+
clearErrors: et,
|
|
3512
|
+
unregister: B,
|
|
3513
|
+
setError: $e,
|
|
3497
3514
|
setFocus: Yr,
|
|
3498
3515
|
getFieldState: je
|
|
3499
3516
|
};
|
|
3500
3517
|
return {
|
|
3501
|
-
...
|
|
3502
|
-
formControl:
|
|
3518
|
+
...Pt,
|
|
3519
|
+
formControl: Pt
|
|
3503
3520
|
};
|
|
3504
3521
|
}
|
|
3505
|
-
function
|
|
3506
|
-
const r =
|
|
3522
|
+
function ft(e = {}) {
|
|
3523
|
+
const r = Q.useRef(void 0), t = Q.useRef(void 0), [s, a] = Q.useState({
|
|
3507
3524
|
isDirty: !1,
|
|
3508
3525
|
isValidating: !1,
|
|
3509
3526
|
isLoading: oe(e.defaultValues),
|
|
@@ -3527,86 +3544,86 @@ function ot(e = {}) {
|
|
|
3527
3544
|
formState: s
|
|
3528
3545
|
}, e.defaultValues && !oe(e.defaultValues) && e.formControl.reset(e.defaultValues, e.resetOptions);
|
|
3529
3546
|
else {
|
|
3530
|
-
const { formControl: n, ...o } =
|
|
3547
|
+
const { formControl: n, ...o } = Kn(e);
|
|
3531
3548
|
r.current = {
|
|
3532
3549
|
...o,
|
|
3533
3550
|
formState: s
|
|
3534
3551
|
};
|
|
3535
3552
|
}
|
|
3536
|
-
const
|
|
3537
|
-
return
|
|
3538
|
-
const n =
|
|
3539
|
-
formState:
|
|
3540
|
-
callback: () =>
|
|
3553
|
+
const i = r.current.control;
|
|
3554
|
+
return i._options = e, Mn(() => {
|
|
3555
|
+
const n = i._subscribe({
|
|
3556
|
+
formState: i._proxyFormState,
|
|
3557
|
+
callback: () => a({ ...i._formState }),
|
|
3541
3558
|
reRenderRoot: !0
|
|
3542
3559
|
});
|
|
3543
|
-
return
|
|
3560
|
+
return a((o) => ({
|
|
3544
3561
|
...o,
|
|
3545
3562
|
isReady: !0
|
|
3546
|
-
})),
|
|
3547
|
-
}, [
|
|
3548
|
-
e.mode && (
|
|
3549
|
-
}, [
|
|
3550
|
-
e.errors && (
|
|
3551
|
-
}, [
|
|
3552
|
-
e.shouldUnregister &&
|
|
3553
|
-
values:
|
|
3563
|
+
})), i._formState.isReady = !0, n;
|
|
3564
|
+
}, [i]), Q.useEffect(() => i._disableForm(e.disabled), [i, e.disabled]), Q.useEffect(() => {
|
|
3565
|
+
e.mode && (i._options.mode = e.mode), e.reValidateMode && (i._options.reValidateMode = e.reValidateMode);
|
|
3566
|
+
}, [i, e.mode, e.reValidateMode]), Q.useEffect(() => {
|
|
3567
|
+
e.errors && (i._setErrors(e.errors), i._focusError());
|
|
3568
|
+
}, [i, e.errors]), Q.useEffect(() => {
|
|
3569
|
+
e.shouldUnregister && i._subjects.state.next({
|
|
3570
|
+
values: i._getWatch()
|
|
3554
3571
|
});
|
|
3555
|
-
}, [
|
|
3556
|
-
if (
|
|
3557
|
-
const n =
|
|
3558
|
-
n !== s.isDirty &&
|
|
3572
|
+
}, [i, e.shouldUnregister]), Q.useEffect(() => {
|
|
3573
|
+
if (i._proxyFormState.isDirty) {
|
|
3574
|
+
const n = i._getDirty();
|
|
3575
|
+
n !== s.isDirty && i._subjects.state.next({
|
|
3559
3576
|
isDirty: n
|
|
3560
3577
|
});
|
|
3561
3578
|
}
|
|
3562
|
-
}, [
|
|
3579
|
+
}, [i, s.isDirty]), Q.useEffect(() => {
|
|
3563
3580
|
var n;
|
|
3564
|
-
e.values && !Ce(e.values, t.current) ? (
|
|
3581
|
+
e.values && !Ce(e.values, t.current) ? (i._reset(e.values, {
|
|
3565
3582
|
keepFieldsRef: !0,
|
|
3566
|
-
...
|
|
3567
|
-
}), !((n =
|
|
3568
|
-
}, [
|
|
3569
|
-
|
|
3570
|
-
}), r.current.formState =
|
|
3583
|
+
...i._options.resetOptions
|
|
3584
|
+
}), !((n = i._options.resetOptions) === null || n === void 0) && n.keepIsValid || i._setValid(), t.current = e.values, a((o) => ({ ...o }))) : i._resetDefaultValues();
|
|
3585
|
+
}, [i, e.values]), Q.useEffect(() => {
|
|
3586
|
+
i._state.mount || (i._setValid(), i._state.mount = !0), i._state.watch && (i._state.watch = !1, i._subjects.state.next({ ...i._formState })), i._removeUnmounted();
|
|
3587
|
+
}), r.current.formState = Q.useMemo(() => Vn(s, i), [i, s]), r.current;
|
|
3571
3588
|
}
|
|
3572
3589
|
const ur = (e, r, t) => {
|
|
3573
3590
|
if (e && "reportValidity" in e) {
|
|
3574
3591
|
const s = S(t, r);
|
|
3575
3592
|
e.setCustomValidity(s && s.message || ""), e.reportValidity();
|
|
3576
3593
|
}
|
|
3577
|
-
},
|
|
3594
|
+
}, Gn = (e, r) => {
|
|
3578
3595
|
for (const t in r.fields) {
|
|
3579
3596
|
const s = r.fields[t];
|
|
3580
|
-
s && s.ref && "reportValidity" in s.ref ? ur(s.ref, t, e) : s.refs && s.refs.forEach((
|
|
3597
|
+
s && s.ref && "reportValidity" in s.ref ? ur(s.ref, t, e) : s.refs && s.refs.forEach((a) => ur(a, t, e));
|
|
3581
3598
|
}
|
|
3582
|
-
},
|
|
3583
|
-
r.shouldUseNativeValidation &&
|
|
3599
|
+
}, Hn = (e, r) => {
|
|
3600
|
+
r.shouldUseNativeValidation && Gn(e, r);
|
|
3584
3601
|
const t = {};
|
|
3585
3602
|
for (const s in e) {
|
|
3586
|
-
const
|
|
3587
|
-
if (
|
|
3603
|
+
const a = S(r.fields, s), i = Object.assign(e[s] || {}, { ref: a && a.ref });
|
|
3604
|
+
if (Jn(r.names || Object.keys(e), s)) {
|
|
3588
3605
|
const n = Object.assign({}, S(t, s));
|
|
3589
|
-
j(n, "root",
|
|
3606
|
+
j(n, "root", i), j(t, s, n);
|
|
3590
3607
|
} else
|
|
3591
|
-
j(t, s,
|
|
3608
|
+
j(t, s, i);
|
|
3592
3609
|
}
|
|
3593
3610
|
return t;
|
|
3594
|
-
},
|
|
3595
|
-
var
|
|
3596
|
-
return t === void 0 && (t = {}), function(s,
|
|
3611
|
+
}, Jn = (e, r) => e.some((t) => t.startsWith(r + "."));
|
|
3612
|
+
var pt = function(e, r, t) {
|
|
3613
|
+
return t === void 0 && (t = {}), function(s, a, i) {
|
|
3597
3614
|
try {
|
|
3598
|
-
var n = !
|
|
3599
|
-
return Promise.resolve(/* @__PURE__ */
|
|
3615
|
+
var n = !i.shouldUseNativeValidation && i.criteriaMode === "all";
|
|
3616
|
+
return Promise.resolve(/* @__PURE__ */ an(e, s, Object.assign({}, r, { abortPipeEarly: !n }))).then(function(o) {
|
|
3600
3617
|
if (o.issues) {
|
|
3601
3618
|
for (var c = {}; o.issues.length; ) {
|
|
3602
|
-
var
|
|
3603
|
-
if (b && (c[b] || (c[b] = { message:
|
|
3604
|
-
var x = c[b].types,
|
|
3605
|
-
c[b] = qr(b, n, c,
|
|
3619
|
+
var p = o.issues[0], b = /* @__PURE__ */ Ys(p);
|
|
3620
|
+
if (b && (c[b] || (c[b] = { message: p.message, type: p.type }), n)) {
|
|
3621
|
+
var x = c[b].types, h = x && x[p.type];
|
|
3622
|
+
c[b] = qr(b, n, c, p.type, h ? [].concat(h, p.message) : p.message);
|
|
3606
3623
|
}
|
|
3607
3624
|
o.issues.shift();
|
|
3608
3625
|
}
|
|
3609
|
-
return { values: {}, errors:
|
|
3626
|
+
return { values: {}, errors: Hn(c, i) };
|
|
3610
3627
|
}
|
|
3611
3628
|
return { values: t.raw ? s : o.output, errors: {} };
|
|
3612
3629
|
});
|
|
@@ -3615,22 +3632,22 @@ var lt = function(e, r, t) {
|
|
|
3615
3632
|
}
|
|
3616
3633
|
};
|
|
3617
3634
|
};
|
|
3618
|
-
const cr = 27, dr = 12, fr = 10,
|
|
3635
|
+
const cr = 27, dr = 12, fr = 10, Xn = Re("enum"), Zn = (e, r) => {
|
|
3619
3636
|
const t = {
|
|
3620
3637
|
min: e.minSelected ?? 0,
|
|
3621
3638
|
max: e.maxSelected ?? e.options.length
|
|
3622
3639
|
};
|
|
3623
|
-
return
|
|
3624
|
-
checked: /* @__PURE__ */ Se(/* @__PURE__ */ Or(/* @__PURE__ */
|
|
3640
|
+
return pt(/* @__PURE__ */ xe({
|
|
3641
|
+
checked: /* @__PURE__ */ Se(/* @__PURE__ */ Or(/* @__PURE__ */ ae(), /* @__PURE__ */ Lr()), /* @__PURE__ */ At((s) => Object.entries(s).filter(([a, i]) => i).map(([a, i]) => a)), /* @__PURE__ */ He(t.max, r("validation_multiple_choice_max", {
|
|
3625
3642
|
count: t.max
|
|
3626
|
-
})), /* @__PURE__ */
|
|
3643
|
+
})), /* @__PURE__ */ De(t.min, r("validation_multiple_choice_min", {
|
|
3627
3644
|
count: t.min
|
|
3628
3645
|
})))
|
|
3629
3646
|
}));
|
|
3630
|
-
},
|
|
3647
|
+
}, Yn = xr(({
|
|
3631
3648
|
option: e,
|
|
3632
3649
|
...r
|
|
3633
|
-
}, t) => u(
|
|
3650
|
+
}, t) => u(we, {
|
|
3634
3651
|
children: [u("input", {
|
|
3635
3652
|
class: "peer sr-only h-full",
|
|
3636
3653
|
type: "checkbox",
|
|
@@ -3641,99 +3658,99 @@ const cr = 27, dr = 12, fr = 10, Hn = Re("enum"), Jn = (e, r) => {
|
|
|
3641
3658
|
htmlFor: r.id,
|
|
3642
3659
|
children: e.label
|
|
3643
3660
|
})]
|
|
3644
|
-
})),
|
|
3661
|
+
})), pr = lt("gutter-stable flex w-full flex-1 flex-wrap gap-2 overflow-y-auto rounded-xl p-2.5 pr-4", {
|
|
3645
3662
|
variants: {
|
|
3646
3663
|
variant: {
|
|
3647
3664
|
// In cases where there is only one option, we want to center it
|
|
3648
3665
|
singleOption: "justify-center",
|
|
3649
3666
|
// Two choices with exactly 1 min 1 max
|
|
3650
|
-
booleanLike:
|
|
3667
|
+
booleanLike: Pr
|
|
3651
3668
|
}
|
|
3652
3669
|
}
|
|
3653
|
-
}),
|
|
3670
|
+
}), Qn = ({
|
|
3654
3671
|
input: e,
|
|
3655
3672
|
onSubmitSuccess: r
|
|
3656
3673
|
}) => {
|
|
3657
3674
|
var b, x;
|
|
3658
|
-
const t = e.key ? (b = $.current$.value.flow) == null ? void 0 : b.data.submissions[e.key] : void 0, s = (e.config.minSelected === 1 || e.config.minSelected === void 0) && e.config.maxSelected === 1,
|
|
3659
|
-
t:
|
|
3675
|
+
const t = e.key ? (b = $.current$.value.flow) == null ? void 0 : b.data.submissions[e.key] : void 0, s = (e.config.minSelected === 1 || e.config.minSelected === void 0) && e.config.maxSelected === 1, a = s && e.config.options.length === 2, {
|
|
3676
|
+
t: i
|
|
3660
3677
|
} = se(), {
|
|
3661
3678
|
register: n,
|
|
3662
3679
|
handleSubmit: o,
|
|
3663
3680
|
formState: {
|
|
3664
3681
|
errors: c
|
|
3665
3682
|
}
|
|
3666
|
-
} =
|
|
3683
|
+
} = ft({
|
|
3667
3684
|
defaultValues: {
|
|
3668
|
-
checked: s ? {} :
|
|
3685
|
+
checked: s ? {} : Xn(t) ? Object.fromEntries(t.value.map((h) => [h, !0])) : {}
|
|
3669
3686
|
},
|
|
3670
|
-
resolver:
|
|
3671
|
-
}),
|
|
3672
|
-
return
|
|
3687
|
+
resolver: Zn(e.config, i)
|
|
3688
|
+
}), p = Vt();
|
|
3689
|
+
return a ? u("ul", {
|
|
3673
3690
|
style: {
|
|
3674
3691
|
maxHeight: 6.5 * cr + 5 * dr + 2 * fr
|
|
3675
3692
|
},
|
|
3676
|
-
class:
|
|
3693
|
+
class: pr({
|
|
3677
3694
|
variant: "booleanLike"
|
|
3678
3695
|
}),
|
|
3679
|
-
children: e.config.options.map((
|
|
3680
|
-
class:
|
|
3696
|
+
children: e.config.options.map((h, m) => u("li", {
|
|
3697
|
+
class: Br,
|
|
3681
3698
|
children: u(jr, {
|
|
3682
3699
|
type: "submit",
|
|
3683
3700
|
ref: (C) => {
|
|
3684
|
-
C && m === 0 && (
|
|
3701
|
+
C && m === 0 && (p.current = C);
|
|
3685
3702
|
},
|
|
3686
|
-
label:
|
|
3703
|
+
label: h.label,
|
|
3687
3704
|
value: "true",
|
|
3688
3705
|
onClick: () => r({
|
|
3689
3706
|
type: "enum",
|
|
3690
|
-
value: [
|
|
3707
|
+
value: [h.value]
|
|
3691
3708
|
})
|
|
3692
3709
|
})
|
|
3693
|
-
},
|
|
3710
|
+
}, h.value))
|
|
3694
3711
|
}) : u("form", {
|
|
3695
3712
|
noValidate: !0,
|
|
3696
|
-
onSubmit: (
|
|
3713
|
+
onSubmit: (h) => o((m) => {
|
|
3697
3714
|
const C = m.checked;
|
|
3698
3715
|
r({
|
|
3699
3716
|
type: "enum",
|
|
3700
3717
|
value: C
|
|
3701
3718
|
});
|
|
3702
|
-
})(
|
|
3719
|
+
})(h),
|
|
3703
3720
|
children: [u("div", {
|
|
3704
3721
|
class: "flex items-center gap-1",
|
|
3705
3722
|
children: [u("ul", {
|
|
3706
3723
|
style: {
|
|
3707
3724
|
maxHeight: 6.5 * cr + 5 * dr + 2 * fr
|
|
3708
3725
|
},
|
|
3709
|
-
class:
|
|
3726
|
+
class: pr({
|
|
3710
3727
|
variant: e.config.options.length === 1 ? "singleOption" : void 0
|
|
3711
3728
|
}),
|
|
3712
|
-
children: e.config.options.map((
|
|
3713
|
-
const C = `checked.${
|
|
3729
|
+
children: e.config.options.map((h, m) => {
|
|
3730
|
+
const C = `checked.${h.value}`, {
|
|
3714
3731
|
ref: E,
|
|
3715
|
-
...
|
|
3732
|
+
...V
|
|
3716
3733
|
} = n(C);
|
|
3717
3734
|
return u("li", {
|
|
3718
3735
|
class: "relative",
|
|
3719
|
-
children: u(
|
|
3720
|
-
option:
|
|
3736
|
+
children: u(Yn, {
|
|
3737
|
+
option: h,
|
|
3721
3738
|
autoFocus: m === 0,
|
|
3722
3739
|
ref: (I) => {
|
|
3723
|
-
I && m === 0 && (
|
|
3740
|
+
I && m === 0 && (p.current = I), E(I);
|
|
3724
3741
|
},
|
|
3725
3742
|
id: C,
|
|
3726
|
-
...
|
|
3743
|
+
...V,
|
|
3727
3744
|
onClick: s ? () => r({
|
|
3728
3745
|
type: "enum",
|
|
3729
|
-
value: [
|
|
3746
|
+
value: [h.value]
|
|
3730
3747
|
}) : void 0
|
|
3731
3748
|
})
|
|
3732
|
-
},
|
|
3749
|
+
}, h.value);
|
|
3733
3750
|
})
|
|
3734
3751
|
}), u("div", {
|
|
3735
3752
|
class: "flex flex-col items-center gap-2 pr-2.5 pt-2.5",
|
|
3736
|
-
children: [s ? null : u(Ee, {}), e.config.minSelected === 0 && u(
|
|
3753
|
+
children: [s ? null : u(Ee, {}), e.config.minSelected === 0 && u(Ae, {
|
|
3737
3754
|
class: "relative",
|
|
3738
3755
|
type: "button",
|
|
3739
3756
|
onClick: () => r({
|
|
@@ -3744,55 +3761,55 @@ const cr = 27, dr = 12, fr = 10, Hn = Re("enum"), Jn = (e, r) => {
|
|
|
3744
3761
|
})]
|
|
3745
3762
|
}), u("div", {
|
|
3746
3763
|
class: "px-1",
|
|
3747
|
-
children: u(
|
|
3764
|
+
children: u(Pe, {
|
|
3748
3765
|
error: (x = c.checked) == null ? void 0 : x.root
|
|
3749
3766
|
})
|
|
3750
3767
|
})]
|
|
3751
3768
|
});
|
|
3752
|
-
},
|
|
3753
|
-
const t = e.min ?? Number.MIN_SAFE_INTEGER, s = e.max ?? Number.MAX_SAFE_INTEGER,
|
|
3754
|
-
return
|
|
3755
|
-
number: /* @__PURE__ */ Se(/* @__PURE__ */
|
|
3769
|
+
}, ea = Re("number"), ta = (e, r) => {
|
|
3770
|
+
const t = e.min ?? Number.MIN_SAFE_INTEGER, s = e.max ?? Number.MAX_SAFE_INTEGER, a = e.decimalCases ?? 0;
|
|
3771
|
+
return pt(/* @__PURE__ */ xe({
|
|
3772
|
+
number: /* @__PURE__ */ Se(/* @__PURE__ */ Dr(r("validation_number")), /* @__PURE__ */ Vr(t, r("validation_number_min", {
|
|
3756
3773
|
min: t
|
|
3757
|
-
})), /* @__PURE__ */
|
|
3774
|
+
})), /* @__PURE__ */ Fr(s, r("validation_number_max", {
|
|
3758
3775
|
max: s
|
|
3759
|
-
})), /* @__PURE__ */ Ir((
|
|
3760
|
-
count:
|
|
3776
|
+
})), /* @__PURE__ */ Ir((i) => i === Number(i.toFixed(a)), r("validation_number_decimal_cases", {
|
|
3777
|
+
count: a
|
|
3761
3778
|
})))
|
|
3762
3779
|
}));
|
|
3763
|
-
},
|
|
3780
|
+
}, ra = ({
|
|
3764
3781
|
input: e,
|
|
3765
3782
|
onSubmitSuccess: r
|
|
3766
3783
|
}) => {
|
|
3767
3784
|
var x;
|
|
3768
3785
|
const t = e.config.defaultValue, s = e.key ? (x = $.current$.value.flow) == null ? void 0 : x.data.submissions[e.key] : void 0, {
|
|
3769
|
-
t:
|
|
3786
|
+
t: a
|
|
3770
3787
|
} = se(), {
|
|
3771
|
-
register:
|
|
3788
|
+
register: i,
|
|
3772
3789
|
handleSubmit: n,
|
|
3773
3790
|
formState: {
|
|
3774
3791
|
errors: o
|
|
3775
3792
|
}
|
|
3776
|
-
} =
|
|
3793
|
+
} = ft({
|
|
3777
3794
|
defaultValues: {
|
|
3778
|
-
number:
|
|
3795
|
+
number: ea(s) ? s.value : t ? Number(t) : void 0
|
|
3779
3796
|
},
|
|
3780
|
-
resolver:
|
|
3797
|
+
resolver: ta(e.config, a)
|
|
3781
3798
|
}), {
|
|
3782
3799
|
ref: c,
|
|
3783
|
-
...
|
|
3784
|
-
} =
|
|
3800
|
+
...p
|
|
3801
|
+
} = i("number", {
|
|
3785
3802
|
required: !e.config.optional,
|
|
3786
3803
|
valueAsNumber: !0
|
|
3787
|
-
}), b =
|
|
3804
|
+
}), b = pe();
|
|
3788
3805
|
return Ie(() => {
|
|
3789
3806
|
b.current && (b.current.focus(), b.current.select());
|
|
3790
3807
|
}, []), u("form", {
|
|
3791
3808
|
class: "flex flex-col gap-1 p-2.5",
|
|
3792
|
-
onSubmit: n((
|
|
3793
|
-
|
|
3809
|
+
onSubmit: n((h) => {
|
|
3810
|
+
h.number !== void 0 && r({
|
|
3794
3811
|
type: "number",
|
|
3795
|
-
value:
|
|
3812
|
+
value: h.number
|
|
3796
3813
|
});
|
|
3797
3814
|
}),
|
|
3798
3815
|
children: [u("div", {
|
|
@@ -3800,39 +3817,39 @@ const cr = 27, dr = 12, fr = 10, Hn = Re("enum"), Jn = (e, r) => {
|
|
|
3800
3817
|
children: [u("div", {
|
|
3801
3818
|
class: "relative min-w-0 flex-grow",
|
|
3802
3819
|
children: [u("input", {
|
|
3803
|
-
...
|
|
3820
|
+
...p,
|
|
3804
3821
|
id: "chat-input",
|
|
3805
3822
|
autocomplete: "off",
|
|
3806
3823
|
autoCapitalize: "off",
|
|
3807
3824
|
autoCorrect: "off",
|
|
3808
3825
|
autoFocus: !0,
|
|
3809
|
-
ref: (
|
|
3810
|
-
|
|
3826
|
+
ref: (h) => {
|
|
3827
|
+
h && (b.current = h), c(h);
|
|
3811
3828
|
},
|
|
3812
3829
|
type: "text",
|
|
3813
3830
|
min: e.config.min,
|
|
3814
3831
|
max: e.config.max,
|
|
3815
|
-
class:
|
|
3832
|
+
class: Ye({
|
|
3816
3833
|
optional: e.config.optional,
|
|
3817
3834
|
className: "[type=number:-webkit-inner-spin-button] w-full rounded-full [-webkit-outer-spin-button:none]"
|
|
3818
3835
|
}),
|
|
3819
3836
|
placeholder: e.config.placeholder
|
|
3820
|
-
}), e.config.optional && u(
|
|
3837
|
+
}), e.config.optional && u(Ae, {
|
|
3821
3838
|
class: "absolute bottom-0 right-0.5 top-0",
|
|
3822
3839
|
onClick: () => r(null)
|
|
3823
3840
|
})]
|
|
3824
3841
|
}), u(Ee, {})]
|
|
3825
|
-
}), u(
|
|
3842
|
+
}), u(Pe, {
|
|
3826
3843
|
error: o.number
|
|
3827
3844
|
})]
|
|
3828
3845
|
});
|
|
3829
|
-
},
|
|
3846
|
+
}, sa = (e) => {
|
|
3830
3847
|
if (e === "")
|
|
3831
3848
|
return {
|
|
3832
3849
|
countryCode: "",
|
|
3833
3850
|
phoneNumber: ""
|
|
3834
3851
|
};
|
|
3835
|
-
const r = Object.entries(Ft).find((
|
|
3852
|
+
const r = Object.entries(Ft).find((a) => e.startsWith(a[1])), t = r ? r[1] : "", s = e.replace(t, "");
|
|
3836
3853
|
return /^\d+$/.test(s) ? {
|
|
3837
3854
|
countryCode: t,
|
|
3838
3855
|
phoneNumber: s
|
|
@@ -3840,54 +3857,54 @@ const cr = 27, dr = 12, fr = 10, Hn = Re("enum"), Jn = (e, r) => {
|
|
|
3840
3857
|
countryCode: "",
|
|
3841
3858
|
phoneNumber: ""
|
|
3842
3859
|
};
|
|
3843
|
-
},
|
|
3844
|
-
const r = /* @__PURE__ */ Se(/* @__PURE__ */
|
|
3845
|
-
return
|
|
3860
|
+
}, na = "44", aa = /^[0-9 ]+$/, ia = Re("string"), oa = Re("phone"), la = (e) => {
|
|
3861
|
+
const r = /* @__PURE__ */ Se(/* @__PURE__ */ ae(e("validation_country_code")), /* @__PURE__ */ It(aa, e("validation_country_code"))), t = /* @__PURE__ */ Se(/* @__PURE__ */ ae(e("validation_phone")), /* @__PURE__ */ De(1, e("validation_phone")), /* @__PURE__ */ At((s) => s.replace(/[^0-9]/g, "")));
|
|
3862
|
+
return pt(/* @__PURE__ */ xe({
|
|
3846
3863
|
countryCode: r,
|
|
3847
3864
|
phoneNumber: t
|
|
3848
3865
|
}));
|
|
3849
|
-
},
|
|
3866
|
+
}, ua = ({
|
|
3850
3867
|
input: e,
|
|
3851
3868
|
onSubmitSuccess: r
|
|
3852
3869
|
}) => {
|
|
3853
3870
|
var E;
|
|
3854
3871
|
const t = e.key ? (E = $.current$.value.flow) == null ? void 0 : E.data.submissions[e.key] : void 0, {
|
|
3855
3872
|
t: s
|
|
3856
|
-
} = se(), [
|
|
3873
|
+
} = se(), [a, i] = ve(), n = ia(t) ? sa(t.value) : oa(t) ? t.value : void 0, {
|
|
3857
3874
|
register: o,
|
|
3858
3875
|
handleSubmit: c,
|
|
3859
3876
|
formState: {
|
|
3860
|
-
errors:
|
|
3877
|
+
errors: p
|
|
3861
3878
|
},
|
|
3862
3879
|
watch: b
|
|
3863
|
-
} =
|
|
3880
|
+
} = ft({
|
|
3864
3881
|
defaultValues: {
|
|
3865
|
-
countryCode: (n == null ? void 0 : n.countryCode) ?? e.config.defaultValue.countryCode ??
|
|
3882
|
+
countryCode: (n == null ? void 0 : n.countryCode) ?? e.config.defaultValue.countryCode ?? na,
|
|
3866
3883
|
phoneNumber: (n == null ? void 0 : n.phoneNumber) ?? e.config.defaultValue.phoneNumber ?? ""
|
|
3867
3884
|
},
|
|
3868
|
-
resolver:
|
|
3885
|
+
resolver: la(s)
|
|
3869
3886
|
}), {
|
|
3870
3887
|
ref: x,
|
|
3871
|
-
...
|
|
3888
|
+
...h
|
|
3872
3889
|
} = o("phoneNumber", {
|
|
3873
3890
|
required: !e.config.optional
|
|
3874
|
-
}), m =
|
|
3891
|
+
}), m = pe(), C = b("countryCode");
|
|
3875
3892
|
return Ie(() => {
|
|
3876
3893
|
m.current && (m.current.focus(), m.current.select());
|
|
3877
3894
|
}, []), u("form", {
|
|
3878
3895
|
noValidate: !0,
|
|
3879
3896
|
class: "flex flex-col gap-1 p-2.5",
|
|
3880
|
-
onSubmit: c((
|
|
3881
|
-
const I =
|
|
3882
|
-
|
|
3883
|
-
const _ = e.config.minChars ?? 7,
|
|
3884
|
-
if (
|
|
3885
|
-
return
|
|
3897
|
+
onSubmit: c((V) => {
|
|
3898
|
+
const I = V.phoneNumber.replace(/[^0-9]/g, ""), y = V.countryCode.replace(/[^0-9]/g, "");
|
|
3899
|
+
i(void 0);
|
|
3900
|
+
const _ = e.config.minChars ?? 7, F = I.length + y.length;
|
|
3901
|
+
if (F < _)
|
|
3902
|
+
return i(s("validation_phone_min_chars", {
|
|
3886
3903
|
count: _
|
|
3887
3904
|
}));
|
|
3888
3905
|
const M = e.config.maxChars;
|
|
3889
|
-
if (M != null &&
|
|
3890
|
-
return
|
|
3906
|
+
if (M != null && F > M)
|
|
3907
|
+
return i(s("validation_max_chars", {
|
|
3891
3908
|
count: M
|
|
3892
3909
|
}));
|
|
3893
3910
|
e.config.submissionFormat === "phone" ? r({
|
|
@@ -3898,7 +3915,7 @@ const cr = 27, dr = 12, fr = 10, Hn = Re("enum"), Jn = (e, r) => {
|
|
|
3898
3915
|
}
|
|
3899
3916
|
}) : r({
|
|
3900
3917
|
type: "string",
|
|
3901
|
-
value: C +
|
|
3918
|
+
value: C + V.phoneNumber
|
|
3902
3919
|
});
|
|
3903
3920
|
}),
|
|
3904
3921
|
children: [u("div", {
|
|
@@ -3914,13 +3931,13 @@ const cr = 27, dr = 12, fr = 10, Hn = Re("enum"), Jn = (e, r) => {
|
|
|
3914
3931
|
...o("countryCode", {}),
|
|
3915
3932
|
id: `isdk_phone_${e.key}`,
|
|
3916
3933
|
class: "absolute inset-0 opacity-0",
|
|
3917
|
-
children: Object.entries(Ft).map(([
|
|
3934
|
+
children: Object.entries(Ft).map(([V, I]) => u("option", {
|
|
3918
3935
|
value: I,
|
|
3919
|
-
children: [
|
|
3920
|
-
},
|
|
3936
|
+
children: [V, " (+", I, ")"]
|
|
3937
|
+
}, V))
|
|
3921
3938
|
})]
|
|
3922
3939
|
}), u("input", {
|
|
3923
|
-
...
|
|
3940
|
+
...h,
|
|
3924
3941
|
id: "chat-input",
|
|
3925
3942
|
type: "tel",
|
|
3926
3943
|
inputMode: "tel",
|
|
@@ -3928,26 +3945,26 @@ const cr = 27, dr = 12, fr = 10, Hn = Re("enum"), Jn = (e, r) => {
|
|
|
3928
3945
|
autoCapitalize: "off",
|
|
3929
3946
|
autoCorrect: "off",
|
|
3930
3947
|
autoFocus: !0,
|
|
3931
|
-
ref: (
|
|
3932
|
-
|
|
3948
|
+
ref: (V) => {
|
|
3949
|
+
V && (m.current = V), x(V);
|
|
3933
3950
|
},
|
|
3934
|
-
class:
|
|
3951
|
+
class: Ye({
|
|
3935
3952
|
optional: e.config.optional,
|
|
3936
3953
|
className: "min-w-0 flex-1 rounded-r-full"
|
|
3937
3954
|
}),
|
|
3938
3955
|
placeholder: e.config.placeholder
|
|
3939
|
-
}), e.config.optional && u(
|
|
3956
|
+
}), e.config.optional && u(Ae, {
|
|
3940
3957
|
class: "absolute bottom-0 right-1 top-0",
|
|
3941
3958
|
onClick: () => r(null)
|
|
3942
3959
|
})]
|
|
3943
3960
|
}), u(Ee, {})]
|
|
3944
|
-
}), u(
|
|
3945
|
-
error:
|
|
3946
|
-
message:
|
|
3961
|
+
}), u(Pe, {
|
|
3962
|
+
error: p.countryCode || p.phoneNumber || {
|
|
3963
|
+
message: a
|
|
3947
3964
|
}
|
|
3948
3965
|
})]
|
|
3949
3966
|
});
|
|
3950
|
-
},
|
|
3967
|
+
}, nt = (e) => e === void 0 ? 0 : Math.max(0, Math.ceil((e - Date.now()) / 1e3)), ca = ({
|
|
3951
3968
|
input: e,
|
|
3952
3969
|
onSubmitSuccess: r
|
|
3953
3970
|
}) => {
|
|
@@ -3955,21 +3972,21 @@ const cr = 27, dr = 12, fr = 10, Hn = Re("enum"), Jn = (e, r) => {
|
|
|
3955
3972
|
t
|
|
3956
3973
|
} = se(), {
|
|
3957
3974
|
availableAt: s
|
|
3958
|
-
} = e.config, [
|
|
3975
|
+
} = e.config, [a, i] = ve(() => nt(s)), [n, o] = ve("");
|
|
3959
3976
|
vr(() => {
|
|
3960
|
-
const
|
|
3961
|
-
if (
|
|
3977
|
+
const p = nt(s);
|
|
3978
|
+
if (i(p), p === 0)
|
|
3962
3979
|
return;
|
|
3963
3980
|
o(t("submission_cooldown", {
|
|
3964
|
-
count:
|
|
3981
|
+
count: p
|
|
3965
3982
|
}));
|
|
3966
3983
|
const b = setInterval(() => {
|
|
3967
|
-
const x =
|
|
3968
|
-
|
|
3984
|
+
const x = nt(s);
|
|
3985
|
+
i(x), !(x > 0) && (clearInterval(b), o(t("submission_cooldown_ready")));
|
|
3969
3986
|
}, 250);
|
|
3970
3987
|
return () => clearInterval(b);
|
|
3971
3988
|
}, [s, t]);
|
|
3972
|
-
const c =
|
|
3989
|
+
const c = a > 0;
|
|
3973
3990
|
return u("div", {
|
|
3974
3991
|
class: "flex flex-col items-center gap-2 py-3",
|
|
3975
3992
|
children: [u("button", {
|
|
@@ -3978,7 +3995,7 @@ const cr = 27, dr = 12, fr = 10, Hn = Re("enum"), Jn = (e, r) => {
|
|
|
3978
3995
|
"aria-disabled": c,
|
|
3979
3996
|
"aria-describedby": c ? "submit-cooldown" : void 0,
|
|
3980
3997
|
onClick: () => {
|
|
3981
|
-
|
|
3998
|
+
nt(s) > 0 || r(null);
|
|
3982
3999
|
},
|
|
3983
4000
|
children: u("span", {
|
|
3984
4001
|
class: "flex items-center gap-1.5",
|
|
@@ -4005,7 +4022,7 @@ const cr = 27, dr = 12, fr = 10, Hn = Re("enum"), Jn = (e, r) => {
|
|
|
4005
4022
|
"aria-hidden": "true",
|
|
4006
4023
|
class: "text-neutral-11 text-xs",
|
|
4007
4024
|
children: t("submission_cooldown", {
|
|
4008
|
-
count:
|
|
4025
|
+
count: a
|
|
4009
4026
|
})
|
|
4010
4027
|
}), u("p", {
|
|
4011
4028
|
role: "status",
|
|
@@ -4013,7 +4030,7 @@ const cr = 27, dr = 12, fr = 10, Hn = Re("enum"), Jn = (e, r) => {
|
|
|
4013
4030
|
children: n
|
|
4014
4031
|
})]
|
|
4015
4032
|
});
|
|
4016
|
-
},
|
|
4033
|
+
}, da = {
|
|
4017
4034
|
date: {
|
|
4018
4035
|
type: "date",
|
|
4019
4036
|
inputMode: "text"
|
|
@@ -4032,7 +4049,7 @@ const cr = 27, dr = 12, fr = 10, Hn = Re("enum"), Jn = (e, r) => {
|
|
|
4032
4049
|
inputMode: "url",
|
|
4033
4050
|
formNoValidate: !0
|
|
4034
4051
|
}
|
|
4035
|
-
},
|
|
4052
|
+
}, fa = Re("string"), pa = (e, r) => {
|
|
4036
4053
|
const t = {
|
|
4037
4054
|
maxLength: r("validation_max_chars", {
|
|
4038
4055
|
count: e.maxChars ?? 999
|
|
@@ -4041,47 +4058,47 @@ const cr = 27, dr = 12, fr = 10, Hn = Re("enum"), Jn = (e, r) => {
|
|
|
4041
4058
|
count: e.minChars ?? 1
|
|
4042
4059
|
})
|
|
4043
4060
|
};
|
|
4044
|
-
return
|
|
4061
|
+
return pt(/* @__PURE__ */ xe({
|
|
4045
4062
|
text: {
|
|
4046
|
-
date: /* @__PURE__ */ Se(/* @__PURE__ */
|
|
4047
|
-
email: /* @__PURE__ */ Se(/* @__PURE__ */
|
|
4048
|
-
text: /* @__PURE__ */ Se(/* @__PURE__ */
|
|
4049
|
-
url: /* @__PURE__ */ Se(/* @__PURE__ */
|
|
4063
|
+
date: /* @__PURE__ */ Se(/* @__PURE__ */ ae(r("validation_date")), /* @__PURE__ */ It(/^\d{4}-\d{2}-\d{2}$/, r("validation_date"))),
|
|
4064
|
+
email: /* @__PURE__ */ Se(/* @__PURE__ */ ae(r("validation_email")), /* @__PURE__ */ Ar(r("validation_email")), /* @__PURE__ */ De(e.minChars ?? 1, t.minLength), /* @__PURE__ */ He(e.maxChars ?? 1 / 0, t.maxLength)),
|
|
4065
|
+
text: /* @__PURE__ */ Se(/* @__PURE__ */ ae(), /* @__PURE__ */ De(e.minChars ?? 1, t.minLength), /* @__PURE__ */ He(e.maxChars ?? 1 / 0, t.maxLength)),
|
|
4066
|
+
url: /* @__PURE__ */ Se(/* @__PURE__ */ ae(r("validation_url")), /* @__PURE__ */ Mr(r("validation_url")), /* @__PURE__ */ De(e.minChars ?? 1, t.minLength), /* @__PURE__ */ He(e.maxChars ?? 1 / 0, t.maxLength))
|
|
4050
4067
|
}[e.format]
|
|
4051
4068
|
}));
|
|
4052
|
-
},
|
|
4069
|
+
}, ha = ({
|
|
4053
4070
|
input: e,
|
|
4054
4071
|
onSubmitSuccess: r
|
|
4055
4072
|
}) => {
|
|
4056
4073
|
var x;
|
|
4057
4074
|
const {
|
|
4058
4075
|
t
|
|
4059
|
-
} = se(), s = e.key ? (x = $.current$.value.flow) == null ? void 0 : x.data.submissions[e.key] : void 0,
|
|
4060
|
-
register:
|
|
4076
|
+
} = se(), s = e.key ? (x = $.current$.value.flow) == null ? void 0 : x.data.submissions[e.key] : void 0, a = e.config.defaultValue, {
|
|
4077
|
+
register: i,
|
|
4061
4078
|
handleSubmit: n,
|
|
4062
4079
|
formState: {
|
|
4063
4080
|
errors: o
|
|
4064
4081
|
}
|
|
4065
|
-
} =
|
|
4082
|
+
} = ft({
|
|
4066
4083
|
defaultValues: {
|
|
4067
|
-
text:
|
|
4084
|
+
text: fa(s) ? s.value : a ?? ""
|
|
4068
4085
|
},
|
|
4069
|
-
resolver:
|
|
4086
|
+
resolver: pa(e.config, t)
|
|
4070
4087
|
}), {
|
|
4071
4088
|
ref: c,
|
|
4072
|
-
...
|
|
4073
|
-
} =
|
|
4089
|
+
...p
|
|
4090
|
+
} = i("text", {
|
|
4074
4091
|
required: !e.config.optional
|
|
4075
|
-
}), b =
|
|
4092
|
+
}), b = pe();
|
|
4076
4093
|
return Ie(() => {
|
|
4077
4094
|
b.current && (b.current.focus(), b.current.select());
|
|
4078
4095
|
}, []), u("form", {
|
|
4079
4096
|
noValidate: !0,
|
|
4080
4097
|
class: "flex flex-col gap-1 p-2.5",
|
|
4081
|
-
onSubmit: n((
|
|
4098
|
+
onSubmit: n((h) => {
|
|
4082
4099
|
r({
|
|
4083
4100
|
type: "string",
|
|
4084
|
-
value:
|
|
4101
|
+
value: h.text
|
|
4085
4102
|
});
|
|
4086
4103
|
}),
|
|
4087
4104
|
children: [u("div", {
|
|
@@ -4090,44 +4107,44 @@ const cr = 27, dr = 12, fr = 10, Hn = Re("enum"), Jn = (e, r) => {
|
|
|
4090
4107
|
class: "relative min-w-0 flex-1",
|
|
4091
4108
|
children: [u("input", {
|
|
4092
4109
|
id: "chat-input",
|
|
4093
|
-
...
|
|
4094
|
-
...
|
|
4110
|
+
...p,
|
|
4111
|
+
...da[e.config.format],
|
|
4095
4112
|
autocomplete: "off",
|
|
4096
4113
|
autoCapitalize: "off",
|
|
4097
4114
|
autoCorrect: "off",
|
|
4098
4115
|
autoFocus: !0,
|
|
4099
|
-
ref: (
|
|
4100
|
-
|
|
4116
|
+
ref: (h) => {
|
|
4117
|
+
h && (b.current = h), c(h);
|
|
4101
4118
|
},
|
|
4102
4119
|
placeholder: e.config.placeholder,
|
|
4103
|
-
class:
|
|
4120
|
+
class: Ye({
|
|
4104
4121
|
optional: !!e.config.optional,
|
|
4105
4122
|
className: "w-full rounded-full"
|
|
4106
4123
|
})
|
|
4107
|
-
}), e.config.optional && u(
|
|
4124
|
+
}), e.config.optional && u(Ae, {
|
|
4108
4125
|
class: "absolute bottom-0 right-0.5 top-0",
|
|
4109
4126
|
onClick: () => r(null)
|
|
4110
4127
|
})]
|
|
4111
4128
|
}), u(Ee, {})]
|
|
4112
|
-
}), u(
|
|
4129
|
+
}), u(Pe, {
|
|
4113
4130
|
error: o.text
|
|
4114
4131
|
})]
|
|
4115
4132
|
});
|
|
4116
|
-
},
|
|
4117
|
-
text:
|
|
4118
|
-
phone:
|
|
4119
|
-
"multiple-choice":
|
|
4120
|
-
boolean:
|
|
4121
|
-
file:
|
|
4122
|
-
submit:
|
|
4123
|
-
address:
|
|
4124
|
-
number:
|
|
4125
|
-
},
|
|
4133
|
+
}, ya = {
|
|
4134
|
+
text: ha,
|
|
4135
|
+
phone: ua,
|
|
4136
|
+
"multiple-choice": Qn,
|
|
4137
|
+
boolean: mn,
|
|
4138
|
+
file: kn,
|
|
4139
|
+
submit: ca,
|
|
4140
|
+
address: fn,
|
|
4141
|
+
number: ra
|
|
4142
|
+
}, ma = ({
|
|
4126
4143
|
logger: e,
|
|
4127
4144
|
analytics: r
|
|
4128
4145
|
}) => {
|
|
4129
|
-
var
|
|
4130
|
-
const t = (
|
|
4146
|
+
var i;
|
|
4147
|
+
const t = (i = $.current$.value.flow) == null ? void 0 : i.data.currentInput, s = pe(null), a = () => ie.onInteractionFn$.value();
|
|
4131
4148
|
return Ie(() => {
|
|
4132
4149
|
var n;
|
|
4133
4150
|
(n = s.current) == null || n.scrollTo({
|
|
@@ -4138,14 +4155,14 @@ const cr = 27, dr = 12, fr = 10, Hn = Re("enum"), Jn = (e, r) => {
|
|
|
4138
4155
|
class: "border-divider max-h-[calc(100%-var(--header-height)-4rem)] w-full shrink-0 scroll-pb-12 overflow-y-auto overscroll-contain border-t",
|
|
4139
4156
|
children: u("div", {
|
|
4140
4157
|
class: "flex flex-col",
|
|
4141
|
-
onPointerDownCapture: t ?
|
|
4142
|
-
onKeyDownCapture: t ?
|
|
4158
|
+
onPointerDownCapture: t ? a : void 0,
|
|
4159
|
+
onKeyDownCapture: t ? a : void 0,
|
|
4143
4160
|
children: t ? (() => {
|
|
4144
|
-
const n =
|
|
4161
|
+
const n = ya[t.type];
|
|
4145
4162
|
return u(n, {
|
|
4146
4163
|
logger: e,
|
|
4147
4164
|
analytics: r,
|
|
4148
|
-
onSubmitSuccess:
|
|
4165
|
+
onSubmitSuccess: ie.onSubmitSuccessFn$.value,
|
|
4149
4166
|
input: t
|
|
4150
4167
|
});
|
|
4151
4168
|
})() : u("div", {
|
|
@@ -4153,7 +4170,7 @@ const cr = 27, dr = 12, fr = 10, Hn = Re("enum"), Jn = (e, r) => {
|
|
|
4153
4170
|
children: [u("input", {
|
|
4154
4171
|
"aria-hidden": "true",
|
|
4155
4172
|
id: "chat-input",
|
|
4156
|
-
class:
|
|
4173
|
+
class: Ye({
|
|
4157
4174
|
optional: !1,
|
|
4158
4175
|
className: "flex-grow rounded-full"
|
|
4159
4176
|
}),
|
|
@@ -4167,65 +4184,65 @@ const cr = 27, dr = 12, fr = 10, Hn = Re("enum"), Jn = (e, r) => {
|
|
|
4167
4184
|
})
|
|
4168
4185
|
});
|
|
4169
4186
|
};
|
|
4170
|
-
function
|
|
4187
|
+
function ga(e) {
|
|
4171
4188
|
return e && e.__esModule && Object.prototype.hasOwnProperty.call(e, "default") ? e.default : e;
|
|
4172
4189
|
}
|
|
4173
|
-
var
|
|
4190
|
+
var ba = function(e) {
|
|
4174
4191
|
return e instanceof RegExp;
|
|
4175
|
-
},
|
|
4192
|
+
}, va = function(r) {
|
|
4176
4193
|
var t = /[\\^$.*+?()[\]{}|]/g, s = RegExp(t.source);
|
|
4177
4194
|
return r && s.test(r) ? r.replace(t, "\\$&") : r;
|
|
4178
4195
|
}, Jr = function(e) {
|
|
4179
4196
|
return typeof e == "string";
|
|
4180
|
-
},
|
|
4197
|
+
}, xa = function(e) {
|
|
4181
4198
|
var r = [];
|
|
4182
4199
|
return e.forEach(function(t) {
|
|
4183
4200
|
Array.isArray(t) ? r = r.concat(t) : r.push(t);
|
|
4184
4201
|
}), r;
|
|
4185
4202
|
};
|
|
4186
|
-
function
|
|
4187
|
-
var s = 0,
|
|
4203
|
+
function wa(e, r, t) {
|
|
4204
|
+
var s = 0, a = 0;
|
|
4188
4205
|
if (e === "")
|
|
4189
4206
|
return e;
|
|
4190
4207
|
if (!e || !Jr(e))
|
|
4191
4208
|
throw new TypeError("First argument to react-string-replace#replaceString must be a string");
|
|
4192
|
-
var
|
|
4193
|
-
|
|
4194
|
-
for (var n = e.split(
|
|
4209
|
+
var i = r;
|
|
4210
|
+
ba(i) || (i = new RegExp("(" + va(i) + ")", "gi"));
|
|
4211
|
+
for (var n = e.split(i), o = 1, c = n.length; o < c; o += 2) {
|
|
4195
4212
|
if (n[o] === void 0 || n[o - 1] === void 0) {
|
|
4196
4213
|
console.warn("reactStringReplace: Encountered undefined value during string replacement. Your RegExp may not be working the way you expect.");
|
|
4197
4214
|
continue;
|
|
4198
4215
|
}
|
|
4199
|
-
|
|
4216
|
+
a = n[o].length, s += n[o - 1].length, n[o] = t(n[o], o, s), s += a;
|
|
4200
4217
|
}
|
|
4201
4218
|
return n;
|
|
4202
4219
|
}
|
|
4203
|
-
var
|
|
4204
|
-
return Array.isArray(r) || (r = [r]),
|
|
4205
|
-
return Jr(
|
|
4220
|
+
var _a = function(r, t, s) {
|
|
4221
|
+
return Array.isArray(r) || (r = [r]), xa(r.map(function(a) {
|
|
4222
|
+
return Jr(a) ? wa(a, t, s) : a;
|
|
4206
4223
|
}));
|
|
4207
4224
|
};
|
|
4208
|
-
const
|
|
4209
|
-
const r =
|
|
4210
|
-
const [, c,
|
|
4211
|
-
return
|
|
4212
|
-
class:
|
|
4213
|
-
href:
|
|
4214
|
-
children: c ??
|
|
4215
|
-
},
|
|
4225
|
+
const We = /* @__PURE__ */ ga(_a), ka = /(\[[^\]]+\]\([^)]+\))/g, Ca = /\[([^\]]+)\]\(([^)]+)\)/, Sa = /(https?:\/\/[^\s]+)/g, Ia = /_(.*?)_/g, Aa = /\*\*(.*?)\*\*/g, Fa = /\\n|\n/g, hr = "text-accent-10 hover:text-accent-11 no-underline underline-offset-2 hover:underline", Va = (e) => {
|
|
4226
|
+
const r = We(e, ka, (n, o) => {
|
|
4227
|
+
const [, c, p] = n.match(Ca) ?? [];
|
|
4228
|
+
return p ? u("a", {
|
|
4229
|
+
class: hr,
|
|
4230
|
+
href: p,
|
|
4231
|
+
children: c ?? p
|
|
4232
|
+
}, p + o) : u("span", {
|
|
4216
4233
|
children: "INVALID LINK"
|
|
4217
4234
|
});
|
|
4218
|
-
}), t =
|
|
4219
|
-
class:
|
|
4235
|
+
}), t = We(r, Sa, (n, o) => u("a", {
|
|
4236
|
+
class: hr,
|
|
4220
4237
|
href: n,
|
|
4221
4238
|
children: n
|
|
4222
|
-
}, n + o)), s =
|
|
4239
|
+
}, n + o)), s = We(t, Ia, (n, o) => u("em", {
|
|
4223
4240
|
children: n
|
|
4224
|
-
}, n + o)),
|
|
4241
|
+
}, n + o)), a = We(s, Aa, (n, o) => u("strong", {
|
|
4225
4242
|
children: n
|
|
4226
4243
|
}, n + o));
|
|
4227
|
-
return
|
|
4228
|
-
},
|
|
4244
|
+
return We(a, Fa, (n, o) => u("br", {}, `br-${o}`));
|
|
4245
|
+
}, Ma = lt("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", {
|
|
4229
4246
|
variants: {
|
|
4230
4247
|
side: {
|
|
4231
4248
|
left: "bg-bubble-weak-bg text-neutral-12 shadow-surface-sm outline outline-1 outline-bubble-weak rounded-bl-md",
|
|
@@ -4239,24 +4256,24 @@ const qe = /* @__PURE__ */ yi(xi), wi = /(\[[^\]]+\]\([^)]+\))/g, _i = /\[([^\]]
|
|
|
4239
4256
|
defaultVariants: {
|
|
4240
4257
|
side: "left"
|
|
4241
4258
|
}
|
|
4242
|
-
}),
|
|
4259
|
+
}), Ea = ({
|
|
4243
4260
|
children: e,
|
|
4244
4261
|
className: r,
|
|
4245
4262
|
animate: t,
|
|
4246
4263
|
side: s,
|
|
4247
|
-
...
|
|
4264
|
+
...a
|
|
4248
4265
|
}) => u("p", {
|
|
4249
4266
|
style: {
|
|
4250
4267
|
transformOrigin: s === "left" ? "0% 50%" : "100% 50%"
|
|
4251
4268
|
},
|
|
4252
|
-
class:
|
|
4269
|
+
class: Ma({
|
|
4253
4270
|
className: r,
|
|
4254
4271
|
side: s,
|
|
4255
4272
|
animate: t
|
|
4256
4273
|
}),
|
|
4257
|
-
...
|
|
4274
|
+
...a,
|
|
4258
4275
|
children: e
|
|
4259
|
-
}),
|
|
4276
|
+
}), Na = ({
|
|
4260
4277
|
message: e
|
|
4261
4278
|
}) => u("div", {
|
|
4262
4279
|
class: "bg-accent-3 flex w-full items-center justify-center overflow-hidden rounded-xl px-2 py-2",
|
|
@@ -4280,12 +4297,12 @@ const qe = /* @__PURE__ */ yi(xi), wi = /(\[[^\]]+\]\([^)]+\))/g, _i = /\[([^\]]
|
|
|
4280
4297
|
})
|
|
4281
4298
|
})]
|
|
4282
4299
|
})
|
|
4283
|
-
}),
|
|
4300
|
+
}), La = ({
|
|
4284
4301
|
className: e,
|
|
4285
4302
|
...r
|
|
4286
4303
|
}) => u("div", {
|
|
4287
4304
|
"aria-hidden": !0,
|
|
4288
|
-
children:
|
|
4305
|
+
children: ie.isBotTyping$.value === !0 ? u("div", {
|
|
4289
4306
|
"aria-label": "Typing…",
|
|
4290
4307
|
class: Oe("flex gap-1 p-4", e),
|
|
4291
4308
|
...r,
|
|
@@ -4298,10 +4315,10 @@ const qe = /* @__PURE__ */ yi(xi), wi = /(\[[^\]]+\]\([^)]+\))/g, _i = /\[([^\]]
|
|
|
4298
4315
|
}
|
|
4299
4316
|
}))
|
|
4300
4317
|
}) : void 0
|
|
4301
|
-
}),
|
|
4318
|
+
}), Da = {
|
|
4302
4319
|
bot: "left",
|
|
4303
4320
|
user: "right"
|
|
4304
|
-
},
|
|
4321
|
+
}, Ta = lt("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)]", {
|
|
4305
4322
|
variants: {
|
|
4306
4323
|
variant: {
|
|
4307
4324
|
info: "text-neutral-8",
|
|
@@ -4310,40 +4327,40 @@ const qe = /* @__PURE__ */ yi(xi), wi = /(\[[^\]]+\]\([^)]+\))/g, _i = /\[([^\]]
|
|
|
4310
4327
|
success: "text-[#4CAF50]"
|
|
4311
4328
|
}
|
|
4312
4329
|
}
|
|
4313
|
-
}),
|
|
4330
|
+
}), Oa = ({
|
|
4314
4331
|
lastSentMessageFooter: e
|
|
4315
4332
|
}) => {
|
|
4316
|
-
const r = $.current$.value.flow, t = (r == null ? void 0 : r.data.messages) ?? [], s = r ?
|
|
4333
|
+
const r = $.current$.value.flow, t = (r == null ? void 0 : r.data.messages) ?? [], s = r ? Ct(r) : void 0;
|
|
4317
4334
|
return u("ol", {
|
|
4318
4335
|
"aria-label": "Chat messages",
|
|
4319
4336
|
"aria-live": "polite",
|
|
4320
4337
|
class: "mt-auto flex flex-col justify-end gap-2 p-2 pt-[calc(var(--header-height)+1rem)]",
|
|
4321
|
-
children: [t.map((
|
|
4338
|
+
children: [t.map((a, i) => u(we, {
|
|
4322
4339
|
children: u("li", {
|
|
4323
4340
|
class: "flex",
|
|
4324
|
-
tabIndex:
|
|
4325
|
-
children: [s &&
|
|
4341
|
+
tabIndex: i === t.length - 1 ? -1 : void 0,
|
|
4342
|
+
children: [s && a.groupId === s && !t.slice(i + 1).some((n) => n.groupId === s) ? e : null, fs(a).with({
|
|
4326
4343
|
type: "system"
|
|
4327
4344
|
}, (n) => u("p", {
|
|
4328
|
-
class:
|
|
4345
|
+
class: Ta({
|
|
4329
4346
|
variant: n.variant
|
|
4330
4347
|
}),
|
|
4331
4348
|
children: n.text
|
|
4332
4349
|
})).with({
|
|
4333
4350
|
type: "text",
|
|
4334
|
-
author:
|
|
4351
|
+
author: ps.union("bot", "user")
|
|
4335
4352
|
}, (n) => {
|
|
4336
|
-
const o =
|
|
4337
|
-
return u(
|
|
4338
|
-
children: u(
|
|
4353
|
+
const o = i === t.length - 1, c = n.author === "bot" ? Va(n.text) : n.text;
|
|
4354
|
+
return u(we, {
|
|
4355
|
+
children: u(Ea, {
|
|
4339
4356
|
animate: o,
|
|
4340
|
-
side:
|
|
4357
|
+
side: Da[n.author],
|
|
4341
4358
|
children: c
|
|
4342
|
-
},
|
|
4359
|
+
}, i)
|
|
4343
4360
|
});
|
|
4344
4361
|
}).with({
|
|
4345
4362
|
type: "link"
|
|
4346
|
-
}, (n) => u(
|
|
4363
|
+
}, (n) => u(Na, {
|
|
4347
4364
|
message: n
|
|
4348
4365
|
})).with({
|
|
4349
4366
|
type: "image"
|
|
@@ -4355,7 +4372,7 @@ const qe = /* @__PURE__ */ yi(xi), wi = /(\[[^\]]+\]\([^)]+\))/g, _i = /\[([^\]]
|
|
|
4355
4372
|
}
|
|
4356
4373
|
})).with({
|
|
4357
4374
|
type: "file"
|
|
4358
|
-
}, (n) => u(
|
|
4375
|
+
}, (n) => u(vn, {
|
|
4359
4376
|
class: n.author === "bot" ? void 0 : "ml-auto",
|
|
4360
4377
|
file: {
|
|
4361
4378
|
name: n.fileName,
|
|
@@ -4365,9 +4382,9 @@ const qe = /* @__PURE__ */ yi(xi), wi = /(\[[^\]]+\]\([^)]+\))/g, _i = /\[([^\]]
|
|
|
4365
4382
|
type: "loading"
|
|
4366
4383
|
}, (n) => {
|
|
4367
4384
|
const o = t[t.length - 1];
|
|
4368
|
-
return !(n === o) ||
|
|
4385
|
+
return !(n === o) || ie.isBotTyping$.value ? null : u("div", {
|
|
4369
4386
|
class: "flex flex-grow flex-col items-center justify-center gap-2",
|
|
4370
|
-
children: [u(
|
|
4387
|
+
children: [u(St, {
|
|
4371
4388
|
"aria-hidden": n.text ? "true" : void 0,
|
|
4372
4389
|
class: "text-neutral-6 h-8 w-8"
|
|
4373
4390
|
}), n.text ? u("p", {
|
|
@@ -4378,56 +4395,56 @@ const qe = /* @__PURE__ */ yi(xi), wi = /(\[[^\]]+\]\([^)]+\))/g, _i = /\[([^\]]
|
|
|
4378
4395
|
});
|
|
4379
4396
|
}).exhaustive()]
|
|
4380
4397
|
})
|
|
4381
|
-
},
|
|
4398
|
+
}, i)), u(La, {}, "typing")]
|
|
4382
4399
|
});
|
|
4383
|
-
},
|
|
4400
|
+
}, $a = ({
|
|
4384
4401
|
logger: e,
|
|
4385
4402
|
apiClient: r,
|
|
4386
4403
|
analytics: t,
|
|
4387
4404
|
talentBankClient: s
|
|
4388
4405
|
}) => {
|
|
4389
4406
|
const {
|
|
4390
|
-
flow:
|
|
4407
|
+
flow: a
|
|
4391
4408
|
} = $.current$.value;
|
|
4392
|
-
Me(
|
|
4393
|
-
const
|
|
4409
|
+
Me(a, "Flow is required to exist to show chatbot body");
|
|
4410
|
+
const i = $.viewState$.value, {
|
|
4394
4411
|
chatRef: n,
|
|
4395
4412
|
chatService: o
|
|
4396
4413
|
} = hs(), {
|
|
4397
4414
|
t: c
|
|
4398
|
-
} = se(), [
|
|
4415
|
+
} = se(), [p, b] = ve();
|
|
4399
4416
|
return Ie(() => {
|
|
4400
|
-
|
|
4401
|
-
}, [
|
|
4417
|
+
i === "maximised" && ie.scrollToEnd();
|
|
4418
|
+
}, [i]), Ie(() => {
|
|
4402
4419
|
var y;
|
|
4403
4420
|
const {
|
|
4404
4421
|
state: x,
|
|
4405
|
-
flow:
|
|
4422
|
+
flow: h
|
|
4406
4423
|
} = $.current$.peek();
|
|
4407
4424
|
if (x !== "loaded")
|
|
4408
4425
|
throw new Error(c("invalid_state"));
|
|
4409
|
-
let m =
|
|
4410
|
-
if (
|
|
4426
|
+
let m = h.data.nodeHistory.at(-1);
|
|
4427
|
+
if (ie.scrollToEnd(), $.setInput(void 0), h.data.isFinished)
|
|
4411
4428
|
return;
|
|
4412
4429
|
const C = () => {
|
|
4413
4430
|
const _ = $.current$.peek().flow;
|
|
4414
4431
|
!_ || _.data.hasInteracted || ($.markAsInteracted(), Ut(t, _, "FLOW_INTERACT"));
|
|
4415
4432
|
};
|
|
4416
|
-
|
|
4433
|
+
ie.onInteractionFn$.value = C, m === void 0 ? (m = gr(a.nodes).id, $.setCurrentNodeId(m), Ut(t, h, "FLOW_START")) : $.removeMessagesSentByNodeIds([m]);
|
|
4417
4434
|
const {
|
|
4418
4435
|
interpret: E,
|
|
4419
|
-
abort:
|
|
4436
|
+
abort: V,
|
|
4420
4437
|
undo: I
|
|
4421
|
-
} =
|
|
4422
|
-
context:
|
|
4438
|
+
} = _s({
|
|
4439
|
+
context: a.context,
|
|
4423
4440
|
analytics: {
|
|
4424
4441
|
service: t,
|
|
4425
|
-
customProperties: (y =
|
|
4442
|
+
customProperties: (y = a.analytics) == null ? void 0 : y.customProperties
|
|
4426
4443
|
},
|
|
4427
4444
|
apiClient: r,
|
|
4428
4445
|
logger: e,
|
|
4429
4446
|
talentBankClient: s,
|
|
4430
|
-
flow:
|
|
4447
|
+
flow: a,
|
|
4431
4448
|
chatService: o,
|
|
4432
4449
|
t: c,
|
|
4433
4450
|
getApplicationRecovery: () => {
|
|
@@ -4435,7 +4452,7 @@ const qe = /* @__PURE__ */ yi(xi), wi = /(\[[^\]]+\]\([^)]+\))/g, _i = /\[([^\]]
|
|
|
4435
4452
|
return (_ = $.current$.peek().flow) == null ? void 0 : _.data.applicationRecovery;
|
|
4436
4453
|
},
|
|
4437
4454
|
setApplicationRecovery: $.setApplicationRecovery,
|
|
4438
|
-
persistWriteBarrier: () => $.persistWriteBarrier(
|
|
4455
|
+
persistWriteBarrier: () => $.persistWriteBarrier(h),
|
|
4439
4456
|
// We need to get fresh submissions, that’s why we call `peek` here.
|
|
4440
4457
|
getSubmissions: () => {
|
|
4441
4458
|
var _;
|
|
@@ -4443,27 +4460,27 @@ const qe = /* @__PURE__ */ yi(xi), wi = /(\[[^\]]+\]\([^)]+\))/g, _i = /\[([^\]]
|
|
|
4443
4460
|
},
|
|
4444
4461
|
onInterpret: (_) => $.setCurrentNodeId(_.id),
|
|
4445
4462
|
onFlowEnd: async () => {
|
|
4446
|
-
var
|
|
4463
|
+
var F;
|
|
4447
4464
|
$.markAsFinished();
|
|
4448
4465
|
const _ = $.current$.peek().flow;
|
|
4449
4466
|
Me(_), t.log({
|
|
4450
4467
|
event: "FLOW_END",
|
|
4451
4468
|
properties: {
|
|
4452
|
-
flow_id:
|
|
4453
|
-
flow_version:
|
|
4469
|
+
flow_id: a.id,
|
|
4470
|
+
flow_version: a.version,
|
|
4454
4471
|
flow_session_id: _.data.flowSessionId,
|
|
4455
|
-
flow_build:
|
|
4456
|
-
job:
|
|
4472
|
+
flow_build: a.build,
|
|
4473
|
+
job: a.job
|
|
4457
4474
|
},
|
|
4458
|
-
customProperties: (
|
|
4475
|
+
customProperties: (F = a.analytics) == null ? void 0 : F.customProperties
|
|
4459
4476
|
});
|
|
4460
4477
|
}
|
|
4461
4478
|
});
|
|
4462
4479
|
return b(() => I), E(m), () => {
|
|
4463
|
-
|
|
4464
|
-
}),
|
|
4480
|
+
ie.onInteractionFn$.value === C && (ie.onInteractionFn$.value = () => {
|
|
4481
|
+
}), V();
|
|
4465
4482
|
};
|
|
4466
|
-
}, [t, r, o, e,
|
|
4483
|
+
}, [t, r, o, e, a, s, c]), u(we, {
|
|
4467
4484
|
children: [u("div", {
|
|
4468
4485
|
class: "relative flex min-h-0 w-full max-w-full flex-grow flex-col",
|
|
4469
4486
|
children: [u("div", {
|
|
@@ -4475,31 +4492,31 @@ const qe = /* @__PURE__ */ yi(xi), wi = /(\[[^\]]+\]\([^)]+\))/g, _i = /\[([^\]]
|
|
|
4475
4492
|
style: {
|
|
4476
4493
|
WebkitOverflowScrolling: "touch"
|
|
4477
4494
|
},
|
|
4478
|
-
children: u(
|
|
4479
|
-
lastSentMessageFooter: !
|
|
4480
|
-
undoFn:
|
|
4495
|
+
children: u(Oa, {
|
|
4496
|
+
lastSentMessageFooter: !Ct(a) || !p ? null : u(Ra, {
|
|
4497
|
+
undoFn: p
|
|
4481
4498
|
})
|
|
4482
4499
|
})
|
|
4483
|
-
}),
|
|
4500
|
+
}), ie.isReadingHistory$.value && !a.data.isFinished && !ie.isBotTyping$.value && u("div", {
|
|
4484
4501
|
class: "absolute bottom-2 left-1/2 -translate-x-1/2",
|
|
4485
4502
|
children: u(wr, {
|
|
4486
4503
|
class: "bg-neutral-1 ring-divider shadow-surface-md ring-1",
|
|
4487
4504
|
"aria-label": c("jump_to_current"),
|
|
4488
4505
|
onClick: () => {
|
|
4489
|
-
var
|
|
4490
|
-
|
|
4506
|
+
var h, m;
|
|
4507
|
+
ie.scrollToEnd(), (m = ((h = n.current) == null ? void 0 : h.querySelector('li[tabindex="-1"]')) ?? n.current) == null || m.focus({
|
|
4491
4508
|
preventScroll: !0
|
|
4492
4509
|
});
|
|
4493
4510
|
},
|
|
4494
|
-
children: u(
|
|
4511
|
+
children: u(ys, {})
|
|
4495
4512
|
})
|
|
4496
4513
|
})]
|
|
4497
|
-
}), u(
|
|
4514
|
+
}), u(ma, {
|
|
4498
4515
|
logger: e,
|
|
4499
4516
|
analytics: t
|
|
4500
4517
|
})]
|
|
4501
4518
|
});
|
|
4502
|
-
},
|
|
4519
|
+
}, Ra = ({
|
|
4503
4520
|
undoFn: e
|
|
4504
4521
|
}) => {
|
|
4505
4522
|
const {
|
|
@@ -4522,5 +4539,5 @@ const qe = /* @__PURE__ */ yi(xi), wi = /(\[[^\]]+\]\([^)]+\))/g, _i = /\[([^\]]
|
|
|
4522
4539
|
});
|
|
4523
4540
|
};
|
|
4524
4541
|
export {
|
|
4525
|
-
|
|
4542
|
+
$a as ChatbotBody
|
|
4526
4543
|
};
|