@inploi/plugin-chatbot 13.1.0 → 14.0.0

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