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