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