@telia-ace/widget-conversation 1.1.2-rc.2 → 1.1.2-rc.3

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.
@@ -0,0 +1,1522 @@
1
+ import { jsx as n, jsxs as m, Fragment as z } from "react/jsx-runtime";
2
+ import a from "@emotion/styled";
3
+ import { Input as oe, Button as L, borderTabStyle as p, SymbolBadge as w, useIsTabbing as se, useDispatch as Y, useProperties as N, useScroll as ae, Typography as G, invertedHoverButton as $e, Html as J, List as ie, buttonCss as K, ItemList as j, itemList as D, Link as ve, useComponent as xe, genericHtml as we, headingElement as Q, usePrevious as ke, list as Ce, WidgetOverlayOutlet as le, useContainer as Se, ConversationContext as ze } from "@telia-ace/widget-ui";
4
+ import { appendClassNames as M, htmlParentContains as Le } from "@telia-ace/widget-utilities";
5
+ import { css as y, keyframes as Ne } from "@emotion/react";
6
+ import Ie, { useState as R, useEffect as X, forwardRef as Z, useContext as Me, Suspense as Te, useRef as ce, useMemo as Ae, useCallback as de } from "react";
7
+ import { FormComponent as He } from "@telia-ace/widget-forms";
8
+ import { ConversationMessageListItemType as C, ConversationMessageType as W } from "./index.mjs";
9
+ import "@telia-ace/widget-core";
10
+ import "@telia-ace/widget-services";
11
+ import "@telia-ace/widget-plugins";
12
+ const Re = ({ className: t }) => {
13
+ const [e, r] = R(""), [o, s] = R(!1), [i, c] = R(0), [d, u] = R(0), f = se(), b = Y(), {
14
+ inputPlaceholder: l = "Type your message",
15
+ inputHidden: h = !1,
16
+ inputDisabled: x = !1,
17
+ sendButtonLabel: T = "Send message",
18
+ inputMultiline: k = !0,
19
+ secondaryAction: $
20
+ } = N(), [A, v] = ae(!0);
21
+ X(() => {
22
+ if (v.current) {
23
+ const { lineHeight: g, maxHeight: H } = getComputedStyle(v.current);
24
+ if (g && g.indexOf("px") > -1) {
25
+ const I = g.split("px"), pe = parseInt(I[0], 10);
26
+ c(pe);
27
+ const be = H.split("px");
28
+ u(parseInt(be[0], 10));
29
+ }
30
+ }
31
+ }, [v.current]);
32
+ const E = (g) => {
33
+ !g.shiftKey || !k ? (g.preventDefault(), e && e.length > 0 && (b("user-submit", { text: e }), r(""), P(""))) : e.length < 1 && g.preventDefault();
34
+ }, fe = (g) => {
35
+ $ && (g.preventDefault(), b("action", {
36
+ actionKey: $.action,
37
+ ...$
38
+ }));
39
+ }, ye = (g) => {
40
+ if (k && v.current) {
41
+ const H = v.current.scrollHeight;
42
+ if (H > i) {
43
+ v.current.style.height = "auto";
44
+ let I = H;
45
+ g.length < 1 && (I = i), v.current.style.height = `${I}px`, I >= d ? v.current.style.overflowY = "scroll" : v.current.style.overflowY = "hidden";
46
+ }
47
+ }
48
+ }, P = (g) => {
49
+ ye(g), r(g), g && g.length > 0 && b("user-typing", { textLength: g.length });
50
+ };
51
+ return h ? null : /* @__PURE__ */ m(
52
+ je,
53
+ {
54
+ grow: k,
55
+ className: M("humany-conversation-input", t),
56
+ "data-has-focus": o,
57
+ scrollableCss: A,
58
+ isTabbing: f,
59
+ children: [
60
+ $ && /* @__PURE__ */ n(
61
+ Ke,
62
+ {
63
+ disabled: x,
64
+ onClick: fe,
65
+ title: $.label,
66
+ "aria-label": $.label,
67
+ children: /* @__PURE__ */ n(
68
+ w,
69
+ {
70
+ size: 24,
71
+ symbol: { type: "Svg", content: $.icon || "browse" }
72
+ }
73
+ )
74
+ }
75
+ ),
76
+ k ? /* @__PURE__ */ n(
77
+ Be,
78
+ {
79
+ value: e,
80
+ onChange: P,
81
+ onEnter: E,
82
+ disabled: x,
83
+ "aria-label": l,
84
+ placeholder: l,
85
+ onFocusChange: s,
86
+ type: "textarea",
87
+ rows: 1,
88
+ ref: v
89
+ }
90
+ ) : /* @__PURE__ */ n(
91
+ Oe,
92
+ {
93
+ value: e,
94
+ onChange: P,
95
+ onEnter: E,
96
+ disabled: x,
97
+ "aria-label": l,
98
+ placeholder: l,
99
+ onFocusChange: s
100
+ }
101
+ ),
102
+ /* @__PURE__ */ n(
103
+ me,
104
+ {
105
+ disabled: !1,
106
+ onClick: E,
107
+ title: T,
108
+ "aria-label": T,
109
+ children: /* @__PURE__ */ n(
110
+ De,
111
+ {
112
+ size: 22,
113
+ symbol: { type: "Svg", content: "send" },
114
+ hasContent: !!e && !!e.length
115
+ }
116
+ )
117
+ }
118
+ )
119
+ ]
120
+ }
121
+ );
122
+ }, Be = a(oe)`
123
+ resize: none;
124
+ flex: 1;
125
+ flex-shrink: 1;
126
+ min-height: 1.2em;
127
+ max-height: 148px;
128
+ line-height: 1.2em;
129
+ height: 1.2em;
130
+ padding: 0;
131
+ margin: ${(t) => {
132
+ var e;
133
+ return (e = t.theme.sizes) == null ? void 0 : e.medium;
134
+ }};
135
+ font-size: ${(t) => {
136
+ var e;
137
+ return (e = t.theme.fonts) == null ? void 0 : e.normal;
138
+ }};
139
+ border: none;
140
+ transition: height 200ms linear;
141
+ outline: none;
142
+ `, Oe = a(oe)`
143
+ flex: 1;
144
+ border: none;
145
+ background-color: transparent;
146
+ font-weight: 300;
147
+ font-size: ${(t) => {
148
+ var e;
149
+ return (e = t.theme.fonts) == null ? void 0 : e.normal;
150
+ }};
151
+ line-height: 1.2em;
152
+ outline: none;
153
+ padding: ${(t) => {
154
+ var e;
155
+ return (e = t.theme.sizes) == null ? void 0 : e.medium;
156
+ }};
157
+ color: ${(t) => {
158
+ var e;
159
+ return (e = t.theme.colors) == null ? void 0 : e.text;
160
+ }};
161
+ &::placeholder {
162
+ color: ${(t) => {
163
+ var e;
164
+ return (e = t.theme.colors) == null ? void 0 : e.textLight;
165
+ }};
166
+ font-style: italic;
167
+ }
168
+ `, me = a(L)`
169
+ flex: 0 0 50px;
170
+ align-self: stretch;
171
+ background-color: transparent;
172
+ display: flex;
173
+ align-items: center;
174
+ justify-content: center;
175
+ border: none;
176
+ color: #a6a6a6;
177
+ &:focus-visible {
178
+ ${p};
179
+ }
180
+ `, Ke = a(me)`
181
+ border-right: ${(t) => t.theme.border};
182
+ margin: ${(t) => {
183
+ var e;
184
+ return (e = t.theme.sizes) == null ? void 0 : e.normal;
185
+ }} 0;
186
+ `, je = a.div`
187
+ ${(t) => t.grow ? y`
188
+ min-height: 50px;
189
+ max-height: 150px;
190
+ ` : y`
191
+ height: 50px;
192
+ `}
193
+ flex: 0 0 auto;
194
+ display: flex;
195
+ align-items: center;
196
+ background-color: ${(t) => {
197
+ var e;
198
+ return (e = t.theme.colors) == null ? void 0 : e.accent;
199
+ }};
200
+ border-top: ${(t) => t.theme.inputBorder};
201
+ ${(t) => t["data-has-focus"] && t.isTabbing && p}
202
+ textarea {
203
+ ${(t) => !!t.scrollableCss && t.scrollableCss}
204
+ }
205
+ `, De = a(
206
+ ({
207
+ hasContent: t,
208
+ ...e
209
+ }) => /* @__PURE__ */ n(w, { ...e })
210
+ )`
211
+ line,
212
+ path {
213
+ stroke: ${(t) => {
214
+ var e;
215
+ return t.hasContent ? (e = t.theme.colors) == null ? void 0 : e.primary : "#a6a6a6";
216
+ }};
217
+ fill: ${(t) => {
218
+ var e;
219
+ return t.hasContent ? (e = t.theme.colors) == null ? void 0 : e.primary : "#a6a6a6";
220
+ }};
221
+ }
222
+ `, Ee = a.div`
223
+ width: ${(t) => t.avatarSize || "32px"};
224
+ height: ${(t) => t.avatarSize || "32px"};
225
+ border-radius: 50%;
226
+ background-color: ${(t) => {
227
+ var e;
228
+ return (e = t.theme.colors) == null ? void 0 : e.accent;
229
+ }};
230
+ border: ${(t) => t.theme.border};
231
+ grid-area: avatar;
232
+ align-self: flex-end;
233
+ justify-self: center;
234
+ overflow: hidden;
235
+ margin-right: 10px;
236
+ display: flex;
237
+ justify-content: center;
238
+ align-items: center;
239
+ color: ${(t) => {
240
+ var e;
241
+ return (e = t.theme.colors) == null ? void 0 : e.text;
242
+ }};
243
+
244
+ > img {
245
+ height: 100%;
246
+ width: 100%;
247
+ object-fit: cover;
248
+ }
249
+
250
+ > svg {
251
+ width: 90%;
252
+ height: 90%;
253
+ padding: 10%;
254
+ color: ${(t) => {
255
+ var e;
256
+ return (e = t.theme.colors) == null ? void 0 : e.text;
257
+ }};
258
+
259
+ line,
260
+ path,
261
+ circle,
262
+ fill {
263
+ stroke: ${(t) => {
264
+ var e;
265
+ return (e = t.theme.colors) == null ? void 0 : e.text;
266
+ }};
267
+ }
268
+ }
269
+ `, Pe = Ne`
270
+ 0% {
271
+ opacity: 0;
272
+ }
273
+ 75% {
274
+ opacity: 1;
275
+ }
276
+ 100% {
277
+ opacity: 0;
278
+ }
279
+ `, We = a.div`
280
+ display: flex;
281
+ justify-content: center;
282
+ > div {
283
+ height: 10px;
284
+ width: 10px;
285
+ border-radius: 50%;
286
+ margin: 5px;
287
+ background-color: ${(t) => {
288
+ var e;
289
+ return (e = t.theme.colors) == null ? void 0 : e.text;
290
+ }};
291
+ animation: ${Pe} 1s infinite;
292
+ }
293
+ > div:nth-of-type(2) {
294
+ animation-delay: 100ms;
295
+ }
296
+ > div:nth-of-type(3) {
297
+ animation-delay: 200ms;
298
+ }
299
+ `, V = a.div`
300
+ grid-area: content;
301
+ max-width: 100%;
302
+ overflow: hidden;
303
+ `, Fe = a(G)`
304
+ font-size: ${(t) => {
305
+ var e;
306
+ return (e = t.theme.fonts) == null ? void 0 : e.normal;
307
+ }};
308
+ font-weight: normal;
309
+ margin: 0;
310
+ `, q = a.div`
311
+ display: flex;
312
+ ${(t) => t.left && "justify-content: start;"};
313
+ ${(t) => t.center && "justify-content: center;"};
314
+ ${(t) => t.right && "justify-content: end;"};
315
+ `, _ = a.div`
316
+ ${(t) => {
317
+ var e;
318
+ return t.padded && `padding: ${(e = t.theme.sizes) == null ? void 0 : e.medium};`;
319
+ }}
320
+ ${(t) => !t.user && t.stacked && Ue(t.stacked, t.theme)}
321
+ ${(t) => t.user && t.stacked && Ve(t.stacked, t.theme)}
322
+
323
+ display: inline-block;
324
+ margin-top: ${(t) => {
325
+ var e;
326
+ return (e = t.theme.sizes) == null ? void 0 : e.normal;
327
+ }};
328
+ && > * {
329
+ overflow-wrap: break-word;
330
+ word-wrap: break-word;
331
+ word-break: break-all;
332
+ word-break: break-word;
333
+ hyphens: auto;
334
+ }
335
+ max-width: 100%;
336
+ ${(t) => t.fullWidth && "width: 100%;"}
337
+ `, Ue = (t, e) => {
338
+ var o, s;
339
+ const r = y`
340
+ background-color: ${(o = e.colors) == null ? void 0 : o.accent};
341
+ color: ${(s = e.colors) == null ? void 0 : s.text};
342
+ ${e.border && `border: ${e.border};`};
343
+ `;
344
+ return e.borderRadius ? y`
345
+ ${r}
346
+
347
+ border-top-right-radius: ${e.borderRadius};
348
+ border-bottom-right-radius: ${e.borderRadius};
349
+
350
+ ${t === "first" && `
351
+ border-top-left-radius: ${e.borderRadius};
352
+ `}
353
+
354
+ ${t === "last" && `
355
+ border-bottom-left-radius: ${e.borderRadius};
356
+ `}
357
+ ` : r;
358
+ }, Ve = (t, e) => {
359
+ var o, s;
360
+ const r = y`
361
+ background-color: ${(o = e.colors) == null ? void 0 : o.primary};
362
+ color: ${(s = e.colors) == null ? void 0 : s.accent};
363
+ `;
364
+ return e.borderRadius ? y`
365
+ ${r}
366
+
367
+ border-top-left-radius: ${e.borderRadius};
368
+ border-bottom-left-radius: ${e.borderRadius};
369
+
370
+ ${t === "first" && `
371
+ border-top-right-radius: ${e.borderRadius};
372
+ `}
373
+
374
+ ${t === "last" && `
375
+ border-bottom-right-radius: ${e.borderRadius};
376
+ `}
377
+ ` : r;
378
+ }, B = a.div`
379
+ margin-bottom: ${(t) => {
380
+ var e;
381
+ return (e = t.theme.sizes) == null ? void 0 : e.normal;
382
+ }};
383
+ &:last-child {
384
+ margin-bottom: 0;
385
+ }
386
+ `, S = (t) => {
387
+ var e, r;
388
+ return y`
389
+ margin: ${(e = t.theme.sizes) == null ? void 0 : e.medium} 0;
390
+ padding: 0 ${(r = t.theme.sizes) == null ? void 0 : r.medium};
391
+ `;
392
+ }, qe = a(He)`
393
+ & button.humany-form-component-button {
394
+ ${(t) => {
395
+ var e, r, o, s;
396
+ return ((e = t.theme.colors) == null ? void 0 : e.primary) && ((r = t.theme.colors) == null ? void 0 : r.accent) && $e({
397
+ active: !1,
398
+ primaryColor: (o = t.theme.colors) == null ? void 0 : o.primary,
399
+ secondaryColor: (s = t.theme.colors) == null ? void 0 : s.accent,
400
+ theme: t.theme
401
+ });
402
+ }};
403
+ display: block;
404
+ width: 100%;
405
+ margin-bottom: ${(t) => {
406
+ var e;
407
+ return (e = t.theme.sizes) == null ? void 0 : e.normal;
408
+ }};
409
+ }
410
+ & button.humany-form-component-submit {
411
+ width: 100%;
412
+ margin: 0;
413
+ :not(:last-child) {
414
+ margin-bottom: ${(t) => {
415
+ var e;
416
+ return (e = t.theme.sizes) == null ? void 0 : e.normal;
417
+ }};
418
+ }
419
+ }
420
+ `, _e = a(J)`
421
+ white-space: pre-wrap;
422
+ a {
423
+ color: ${(t) => t.theme.colors.link};
424
+ &:focus {
425
+ ${(t) => {
426
+ var e;
427
+ return ((e = t.theme.accessibility) == null ? void 0 : e.isTabbing) && p;
428
+ }};
429
+ }
430
+ }
431
+ `, Ye = a(ie)`
432
+ padding: 0;
433
+ list-style: none;
434
+ margin: 0 -${(t) => {
435
+ var e;
436
+ return (e = t.theme.sizes) == null ? void 0 : e.normal;
437
+ }};
438
+ > li {
439
+ margin: ${(t) => {
440
+ var e;
441
+ return (e = t.theme.sizes) == null ? void 0 : e.normal;
442
+ }};
443
+ }
444
+ `, Ge = a.button`
445
+ ${(t) => K(t)};
446
+ display: block;
447
+ background-color: ${(t) => {
448
+ var e;
449
+ return (e = t.theme.colors) == null ? void 0 : e.primary;
450
+ }};
451
+ width: 100%;
452
+ color: #fff;
453
+ &:focus-visible {
454
+ ${p}
455
+ background-color: transparent;
456
+ }
457
+ `, te = Z(
458
+ ({ boxed: t, className: e, agentData: r }, o) => /* @__PURE__ */ n(V, { ref: o, children: /* @__PURE__ */ n(q, { left: t, center: !t, children: /* @__PURE__ */ n(
459
+ _,
460
+ {
461
+ padded: !!t,
462
+ stacked: t ? "first" : void 0,
463
+ children: /* @__PURE__ */ m(We, { children: [
464
+ /* @__PURE__ */ n("div", {}),
465
+ /* @__PURE__ */ n("div", {}),
466
+ /* @__PURE__ */ n("div", {})
467
+ ] })
468
+ }
469
+ ) }) })
470
+ ), ue = Ie.createContext(null), Je = a.p`
471
+ && {
472
+ font-size: ${(t) => {
473
+ var e;
474
+ return (e = t.theme.fonts) == null ? void 0 : e.small;
475
+ }};
476
+ font-weight: 300;
477
+ }
478
+ margin: 0;
479
+ line-height: 1.5em;
480
+ grid-area: info;
481
+ color: ${(t) => {
482
+ var e;
483
+ return (e = t.theme.colors) == null ? void 0 : e.text;
484
+ }};
485
+ `, ne = (t, e) => new Date(t).toLocaleTimeString(e || [], {
486
+ hour: "2-digit",
487
+ minute: "2-digit"
488
+ }), O = ({ className: t, name: e, timestamp: r }) => {
489
+ const o = Me(ue);
490
+ if (!e && !r)
491
+ return null;
492
+ let s = "";
493
+ return e ? r ? s = `${e}: ${ne(r, o)}` : s = e : r && (s = ne(r, o)), /* @__PURE__ */ n(Je, { children: s });
494
+ }, he = ({
495
+ className: t,
496
+ children: e,
497
+ sender: r,
498
+ timestamp: o
499
+ }) => {
500
+ const { avatar: s, name: i } = r, { avatarSize: c } = N();
501
+ return /* @__PURE__ */ m(
502
+ Qe,
503
+ {
504
+ hasAvatar: !!s,
505
+ className: M(
506
+ t,
507
+ "humany-conversation-agent-message"
508
+ ),
509
+ children: [
510
+ s && /* @__PURE__ */ n(Ee, { avatarSize: c, children: typeof s == "string" ? (
511
+ // eslint-disable-next-line jsx-a11y/alt-text
512
+ /* @__PURE__ */ n("img", { src: s })
513
+ ) : /* @__PURE__ */ n(w, { symbol: s }) }),
514
+ e,
515
+ /* @__PURE__ */ n(O, { name: i, timestamp: o })
516
+ ]
517
+ }
518
+ );
519
+ }, Qe = a.div`
520
+ display: grid;
521
+ margin-right: 10%;
522
+ width: 90%;
523
+ ${(t) => t.hasAvatar ? y`
524
+ grid-template-columns: auto 1fr;
525
+ grid-template-rows: 1fr auto;
526
+ grid-template-areas:
527
+ 'avatar content'
528
+ '. info';
529
+ ` : y`
530
+ grid-template-columns: 1fr;
531
+ grid-template-rows: 1fr auto;
532
+ grid-template-areas:
533
+ 'content'
534
+ 'info';
535
+ `};
536
+ `, Xe = Z(
537
+ ({ className: t, children: e, timestamp: r, discrete: o, fullWidth: s }, i) => /* @__PURE__ */ n(
538
+ Ze,
539
+ {
540
+ ref: i,
541
+ className: M(
542
+ t,
543
+ "humany-conversation-system-message"
544
+ ),
545
+ fullWidth: s,
546
+ children: o ? /* @__PURE__ */ m(et, { className: "humany-conversation-discrete-message", children: [
547
+ e,
548
+ /* @__PURE__ */ n(O, { timestamp: r })
549
+ ] }) : /* @__PURE__ */ m(z, { children: [
550
+ e,
551
+ /* @__PURE__ */ n(O, { timestamp: r })
552
+ ] })
553
+ }
554
+ )
555
+ ), Ze = a.div`
556
+ ${(t) => t.fullWidth && "width: 100%"};
557
+ padding: 0 ${(t) => {
558
+ var e;
559
+ return (e = t.theme.sizes) == null ? void 0 : e.large;
560
+ }};
561
+ overflow: auto;
562
+ `, et = a.div`
563
+ text-align: center;
564
+ word-wrap: break-word;
565
+ font-size: ${(t) => {
566
+ var e;
567
+ return (e = t.theme.fonts) == null ? void 0 : e.normal;
568
+ }};
569
+ color: ${(t) => {
570
+ var e;
571
+ return (e = t.theme.colors) == null ? void 0 : e.text;
572
+ }};
573
+ > p {
574
+ margin: 0;
575
+ }
576
+ `, tt = ({ className: t, children: e, timestamp: r }) => {
577
+ const { userLabel: o = "" } = N();
578
+ return /* @__PURE__ */ m(
579
+ nt,
580
+ {
581
+ className: M(
582
+ t,
583
+ "humany-conversation-user-message"
584
+ ),
585
+ children: [
586
+ e,
587
+ /* @__PURE__ */ n(O, { name: o, timestamp: r })
588
+ ]
589
+ }
590
+ );
591
+ }, nt = a.div`
592
+ margin-left: 10%;
593
+ width: 90%;
594
+ display: flex;
595
+ flex-direction: column;
596
+ align-items: flex-end;
597
+ `, ee = (t) => Array.isArray(t) ? t : Object.keys(t).map((e) => ({
598
+ label: t[e],
599
+ actionKey: e
600
+ })), rt = ({ header: t, actions: e, dispatch: r }) => /* @__PURE__ */ n(
601
+ ot,
602
+ {
603
+ className: "humany-conversation-button-list",
604
+ header: t,
605
+ items: ee(e),
606
+ renderItem: (o) => {
607
+ var i;
608
+ const s = !!((i = o == null ? void 0 : o.data) != null && i.href);
609
+ return /* @__PURE__ */ n("li", { children: s ? /* @__PURE__ */ m(
610
+ st,
611
+ {
612
+ onClick: () => {
613
+ r("action", o);
614
+ },
615
+ href: o.data.href,
616
+ target: o.data.target,
617
+ "aria-label": o.label,
618
+ title: o.label,
619
+ children: [
620
+ /* @__PURE__ */ n(w, { symbol: o.symbol }),
621
+ o.label
622
+ ]
623
+ }
624
+ ) : /* @__PURE__ */ m(
625
+ at,
626
+ {
627
+ onClick: () => {
628
+ r("action", o);
629
+ },
630
+ "aria-label": o.label,
631
+ title: o.label,
632
+ children: [
633
+ /* @__PURE__ */ n(w, { symbol: o.symbol }),
634
+ o.label
635
+ ]
636
+ }
637
+ ) }, o.actionKey);
638
+ }
639
+ }
640
+ ), ot = a(j)`
641
+ ${D}
642
+ > ul {
643
+ display: flex;
644
+ flex-wrap: wrap;
645
+ gap: ${(t) => {
646
+ var e;
647
+ return (e = t.theme.sizes) == null ? void 0 : e.normal;
648
+ }};
649
+ > li {
650
+ margin: 0;
651
+ }
652
+ }
653
+ ${S}
654
+ `, st = a(ve)`
655
+ ${K};
656
+
657
+ display: block;
658
+ padding: ${(t) => {
659
+ var e;
660
+ return (e = t.theme.sizes) == null ? void 0 : e.normal;
661
+ }};
662
+ background-color: ${(t) => {
663
+ var e;
664
+ return (e = t.theme.colors) == null ? void 0 : e.primary;
665
+ }};
666
+ width: 100%;
667
+ color: #ffffff;
668
+ overflow: hidden;
669
+ text-overflow: ellipsis;
670
+ &:focus-visible {
671
+ ${p}
672
+ background-color: transparent;
673
+ }
674
+
675
+ i,
676
+ svg {
677
+ margin-right: ${(t) => {
678
+ var e;
679
+ return (e = t.theme.sizes) == null ? void 0 : e.small;
680
+ }};
681
+ }
682
+ `, at = a(L)`
683
+ ${K};
684
+
685
+ display: block;
686
+ padding: ${(t) => {
687
+ var e;
688
+ return (e = t.theme.sizes) == null ? void 0 : e.normal;
689
+ }};
690
+ background-color: ${(t) => {
691
+ var e;
692
+ return (e = t.theme.colors) == null ? void 0 : e.primary;
693
+ }};
694
+ width: 100%;
695
+ color: #ffffff;
696
+ overflow: hidden;
697
+ text-overflow: ellipsis;
698
+ &:focus-visible {
699
+ ${p}
700
+ background-color: transparent;
701
+ }
702
+
703
+ i,
704
+ svg {
705
+ margin-right: ${(t) => {
706
+ var e;
707
+ return (e = t.theme.sizes) == null ? void 0 : e.small;
708
+ }};
709
+ }
710
+ `, it = ({ type: t, content: e = {} }) => {
711
+ const r = xe(t);
712
+ return !r || !t ? null : /* @__PURE__ */ n(Te, { fallback: null, children: /* @__PURE__ */ n(r, { ...e }) });
713
+ }, lt = ({ body: t }) => /* @__PURE__ */ n(ct, { html: t }), ct = a(J)`
714
+ ${we}
715
+ color: inherit;
716
+ white-space: pre-wrap;
717
+ ${S}
718
+ a {
719
+ color: ${(t) => t.theme.colors.link};
720
+ &:focus-visible {
721
+ ${p};
722
+ }
723
+ }
724
+ `, dt = ({ header: t, actions: e, dispatch: r }) => /* @__PURE__ */ n(
725
+ mt,
726
+ {
727
+ className: "humany-conversation-item-list",
728
+ header: t,
729
+ items: ee(e),
730
+ renderItem: (o) => {
731
+ var s;
732
+ return /* @__PURE__ */ n("li", { children: /* @__PURE__ */ m(ut, { children: [
733
+ ((s = o.symbol) == null ? void 0 : s.content) && /* @__PURE__ */ n("div", { className: "item-icon", children: /* @__PURE__ */ n(
734
+ w,
735
+ {
736
+ size: 22,
737
+ symbol: {
738
+ type: o.symbol.type,
739
+ content: o.symbol.content
740
+ }
741
+ }
742
+ ) }),
743
+ /* @__PURE__ */ m("div", { className: "item-body", children: [
744
+ /* @__PURE__ */ n(
745
+ L,
746
+ {
747
+ onClick: () => {
748
+ r("action", o);
749
+ },
750
+ "aria-label": o.label,
751
+ title: o.label,
752
+ children: o.label
753
+ }
754
+ ),
755
+ o.description && /* @__PURE__ */ n("p", { children: o.description })
756
+ ] })
757
+ ] }) }, o.actionKey);
758
+ }
759
+ }
760
+ ), mt = a(j)`
761
+ ${D}
762
+
763
+ > .humany-paragraph {
764
+ ${S}
765
+ margin-bottom: 0;
766
+
767
+ h1 {
768
+ margin: 0;
769
+ }
770
+ }
771
+
772
+ ${(t) => Q(t)(
773
+ "h1",
774
+ y`
775
+ white-space: normal;
776
+ `
777
+ )}
778
+
779
+ > ul {
780
+ display: flex;
781
+ flex-direction: column;
782
+ gap: ${(t) => {
783
+ var e;
784
+ return (e = t.theme.sizes) == null ? void 0 : e.normal;
785
+ }};
786
+ > li {
787
+ margin: 0;
788
+ }
789
+ }
790
+
791
+ li {
792
+ border-bottom: ${(t) => t.theme.border};
793
+
794
+ &:last-of-type {
795
+ border-bottom: none;
796
+ }
797
+ }
798
+ `, ut = a.div`
799
+ display: flex;
800
+ gap: ${(t) => {
801
+ var e;
802
+ return (e = t.theme.sizes) == null ? void 0 : e.medium;
803
+ }};
804
+ ${S}
805
+
806
+ .item-icon {
807
+ }
808
+
809
+ .item-body {
810
+ display: flex;
811
+ flex-direction: column;
812
+ align-items: flex-start;
813
+ gap: ${(t) => {
814
+ var e;
815
+ return (e = t.theme.sizes) == null ? void 0 : e.normal;
816
+ }};
817
+
818
+ p {
819
+ margin: 0;
820
+ white-space: normal;
821
+ }
822
+ }
823
+
824
+ button {
825
+ background: transparent;
826
+ border: none;
827
+ font-family: inherit;
828
+ font-size: ${(t) => {
829
+ var e;
830
+ return (e = t.theme.fonts) == null ? void 0 : e.normal;
831
+ }};
832
+ cursor: pointer;
833
+ padding: 0;
834
+ margin: 0;
835
+
836
+ &:focus-visible {
837
+ ${p}
838
+ span {
839
+ color: ${(t) => {
840
+ var e;
841
+ return (e = t.theme.colors) == null ? void 0 : e.primary;
842
+ }};
843
+ text-decoration: underline;
844
+ }
845
+ }
846
+ }
847
+ `, ht = ({ header: t, actions: e, dispatch: r }) => {
848
+ const o = ke(e), s = ce(), i = se();
849
+ return X(() => {
850
+ if (o && Array.isArray(e) && Array.isArray(o) && o.length < e.length && s.current) {
851
+ const c = s.current.querySelectorAll(
852
+ ".humany-conversation-link-list > ul > li"
853
+ ), d = c[o.length];
854
+ if (c.length === e.length && o.length) {
855
+ const u = c[o.length - 1];
856
+ if (u) {
857
+ const f = u.querySelector(
858
+ ".humany-button"
859
+ );
860
+ f && f.focus();
861
+ }
862
+ } else
863
+ d && new MutationObserver((f, b) => {
864
+ f.forEach((l) => {
865
+ if (l.addedNodes) {
866
+ const h = Array.from(
867
+ l.addedNodes
868
+ ).find((x) => x.tagName === "BUTTON");
869
+ h && Le(s.current, document.activeElement) && (i && h.focus(), b.disconnect());
870
+ }
871
+ });
872
+ }).observe(d, {
873
+ attributes: !1,
874
+ characterData: !1,
875
+ childList: !0,
876
+ subtree: !0,
877
+ attributeOldValue: !1,
878
+ characterDataOldValue: !1
879
+ });
880
+ }
881
+ }), /* @__PURE__ */ n(
882
+ gt,
883
+ {
884
+ ref: s,
885
+ className: "humany-conversation-link-list",
886
+ header: t,
887
+ items: ee(e),
888
+ renderItem: (c) => /* @__PURE__ */ n("li", { children: /* @__PURE__ */ m(
889
+ ft,
890
+ {
891
+ help: c.actionKey === "help",
892
+ onClick: () => {
893
+ r("action", c);
894
+ },
895
+ "aria-label": c.label,
896
+ title: c.label,
897
+ children: [
898
+ c.label,
899
+ c.actionKey === "help" && /* @__PURE__ */ n(
900
+ w,
901
+ {
902
+ size: 14,
903
+ symbol: {
904
+ type: "Svg",
905
+ content: "caret-down"
906
+ }
907
+ }
908
+ )
909
+ ]
910
+ }
911
+ ) }, c.actionKey)
912
+ }
913
+ );
914
+ }, gt = a(j)`
915
+ ${D}
916
+ ${S}
917
+
918
+ ${(t) => Q(t)(
919
+ "h1",
920
+ y`
921
+ white-space: normal;
922
+ `
923
+ )}
924
+
925
+ > ul {
926
+ display: flex;
927
+ flex-direction: column;
928
+ gap: ${(t) => {
929
+ var e;
930
+ return (e = t.theme.sizes) == null ? void 0 : e.normal;
931
+ }};
932
+ > li {
933
+ margin: 0;
934
+ }
935
+ }
936
+ `, ft = a(L)`
937
+ display: block;
938
+ text-align: left;
939
+ font-weight: 300;
940
+ color: ${(t) => {
941
+ var e;
942
+ return (e = t.theme.colors) == null ? void 0 : e.primary;
943
+ }};
944
+ max-width: 100%;
945
+ text-overflow: ellipsis;
946
+ overflow: hidden;
947
+
948
+ ${(t) => {
949
+ var e, r;
950
+ return t.help && y`
951
+ color: ${(e = t.theme.colors) == null ? void 0 : e.text};
952
+ text-decoration: underline;
953
+
954
+ i,
955
+ svg {
956
+ margin-left: ${(r = t.theme.sizes) == null ? void 0 : r.small};
957
+ }
958
+ `;
959
+ }}
960
+
961
+ &:focus-visible {
962
+ ${p}
963
+ span {
964
+ color: ${(t) => {
965
+ var e;
966
+ return (e = t.theme.colors) == null ? void 0 : e.primary;
967
+ }};
968
+ text-decoration: underline;
969
+ }
970
+ }
971
+ `, yt = () => /* @__PURE__ */ n(pt, { className: "humany-conversation-separator" }), pt = a.div`
972
+ ${(t) => t.theme.border && `border-bottom: ${t.theme.border};`}
973
+ width: 100%;
974
+ `, bt = ({ text: t }) => /* @__PURE__ */ n($t, { className: "humany-conversation-text", variant: "span", children: t }), $t = a(G)`
975
+ ${S}
976
+ `, vt = ({
977
+ header: t = "Video call",
978
+ acceptLabel: e = "Accept",
979
+ declineLabel: r = "Decline",
980
+ dispatch: o
981
+ }) => {
982
+ const s = Ae(() => [
983
+ {
984
+ label: e,
985
+ actionKey: "accept-video-call",
986
+ symbol: {
987
+ type: "Svg",
988
+ content: "video"
989
+ }
990
+ },
991
+ {
992
+ label: r,
993
+ actionKey: "decline-video-call",
994
+ symbol: {
995
+ type: "Svg",
996
+ content: "close"
997
+ }
998
+ }
999
+ ], [e, r]);
1000
+ return /* @__PURE__ */ n(
1001
+ xt,
1002
+ {
1003
+ className: "humany-conversation-video-request",
1004
+ header: t,
1005
+ items: s,
1006
+ renderItem: (i) => {
1007
+ const c = i.actionKey === "accept-video-call" ? "#70c48e" : "#da5c85";
1008
+ return /* @__PURE__ */ n("li", { children: /* @__PURE__ */ n(
1009
+ wt,
1010
+ {
1011
+ onClick: () => {
1012
+ o("action", i);
1013
+ },
1014
+ "aria-label": i.label,
1015
+ title: i.label,
1016
+ bgColor: c,
1017
+ children: /* @__PURE__ */ n(w, { symbol: i.symbol, size: 25 })
1018
+ }
1019
+ ) }, i.actionKey);
1020
+ }
1021
+ }
1022
+ );
1023
+ }, xt = a(j)`
1024
+ ${(t) => D(t)}
1025
+ > ul {
1026
+ display: flex;
1027
+ flex-wrap: wrap;
1028
+ gap: ${(t) => {
1029
+ var e;
1030
+ return (e = t.theme.sizes) == null ? void 0 : e.normal;
1031
+ }};
1032
+ > li {
1033
+ margin: 0;
1034
+ }
1035
+ }
1036
+ ${(t) => S(t)}
1037
+ `, wt = a(L)`
1038
+ ${K};
1039
+
1040
+ background-color: ${(t) => t.bgColor};
1041
+ display: flex;
1042
+ justify-content: center;
1043
+ align-items: center;
1044
+ color: #ffffff;
1045
+ width: 46px;
1046
+ height: 46px;
1047
+ border-radius: 100%;
1048
+
1049
+ &:focus-visible {
1050
+ ${p}
1051
+ background-color: transparent;
1052
+
1053
+ i,
1054
+ svg {
1055
+ color: ${(t) => {
1056
+ var e;
1057
+ return (e = t.theme.colors) == null ? void 0 : e.primary;
1058
+ }};
1059
+
1060
+ path {
1061
+ stroke: ${(t) => {
1062
+ var e;
1063
+ return (e = t.theme.colors) == null ? void 0 : e.primary;
1064
+ }};
1065
+ }
1066
+ }
1067
+ }
1068
+
1069
+ i,
1070
+ svg {
1071
+ color: #fff;
1072
+
1073
+ path {
1074
+ stroke: #fff;
1075
+ }
1076
+ }
1077
+ `, kt = ([t, e]) => ({ type: t, content: e }), Ct = ({ items: t, dispatch: e }) => /* @__PURE__ */ n(
1078
+ St,
1079
+ {
1080
+ role: "none",
1081
+ className: "humany-message-list",
1082
+ items: t.map(kt),
1083
+ renderLi: !0,
1084
+ renderItem: (r) => {
1085
+ switch (r.type) {
1086
+ case C.Text:
1087
+ return /* @__PURE__ */ n(bt, { text: r.content });
1088
+ case C.HTML:
1089
+ return /* @__PURE__ */ n(lt, { ...r.content });
1090
+ case C.Separator:
1091
+ return /* @__PURE__ */ n(yt, { ...r.content });
1092
+ case C.ItemList:
1093
+ return /* @__PURE__ */ n(dt, { ...r.content, dispatch: e });
1094
+ case C.LinkList:
1095
+ return /* @__PURE__ */ n(ht, { ...r.content, dispatch: e });
1096
+ case C.ButtonList:
1097
+ return /* @__PURE__ */ n(rt, { ...r.content, dispatch: e });
1098
+ case C.VideoRequest:
1099
+ return /* @__PURE__ */ n(vt, { ...r.content, dispatch: e });
1100
+ default:
1101
+ return /* @__PURE__ */ n(it, { type: r.type, content: r.content });
1102
+ }
1103
+ }
1104
+ }
1105
+ ), St = a(ie)`
1106
+ ${Ce}
1107
+
1108
+ > li {
1109
+ margin: 0;
1110
+ }
1111
+ `, zt = Z(
1112
+ ({ className: t, timestamp: e, sender: r, type: o, content: s }, i) => {
1113
+ const c = de(
1114
+ (l) => {
1115
+ let h = "first";
1116
+ return s.length > 1 && (h = l === 0 ? "first" : l + 1 === s.length ? "last" : "middle"), h;
1117
+ },
1118
+ [s]
1119
+ ), { userLabel: d = "" } = N(), u = () => /* @__PURE__ */ n(z, { children: s.map((l) => {
1120
+ const { key: h, body: x, title: T, form: k, actions: $ } = l, A = !!x && !T && !k && !$;
1121
+ return /* @__PURE__ */ n(
1122
+ Xe,
1123
+ {
1124
+ className: t,
1125
+ discrete: A,
1126
+ ref: i,
1127
+ timestamp: e,
1128
+ fullWidth: !!k || !!$,
1129
+ children: A && x ? /* @__PURE__ */ n(J, { html: x }) : /* @__PURE__ */ n(F, { isSystem: !0, content: l })
1130
+ },
1131
+ h
1132
+ );
1133
+ }) }), f = () => /* @__PURE__ */ m(z, { children: [
1134
+ /* @__PURE__ */ m(re, { className: "humany-sr-only", children: [
1135
+ r == null ? void 0 : r.name,
1136
+ ":"
1137
+ ] }),
1138
+ /* @__PURE__ */ n(
1139
+ he,
1140
+ {
1141
+ sender: r,
1142
+ timestamp: e,
1143
+ className: t,
1144
+ children: /* @__PURE__ */ n(V, { className: "humany-message-content-bundle", children: s.map((l, h) => /* @__PURE__ */ n(
1145
+ q,
1146
+ {
1147
+ className: "humany-message-container",
1148
+ left: !0,
1149
+ ref: i,
1150
+ children: /* @__PURE__ */ n(
1151
+ F,
1152
+ {
1153
+ content: l,
1154
+ stacked: c(h)
1155
+ }
1156
+ )
1157
+ },
1158
+ l.key
1159
+ )) })
1160
+ }
1161
+ )
1162
+ ] }), b = () => /* @__PURE__ */ m(z, { children: [
1163
+ /* @__PURE__ */ m(re, { className: "humany-sr-only", children: [
1164
+ d,
1165
+ ":"
1166
+ ] }),
1167
+ /* @__PURE__ */ n(tt, { timestamp: e, className: t, children: /* @__PURE__ */ n(V, { className: "humany-message-content-bundle", children: s.map((l, h) => /* @__PURE__ */ n(
1168
+ q,
1169
+ {
1170
+ className: "humany-message-container",
1171
+ right: !0,
1172
+ ref: i,
1173
+ children: /* @__PURE__ */ n(
1174
+ F,
1175
+ {
1176
+ isUser: !0,
1177
+ content: l,
1178
+ stacked: c(h)
1179
+ }
1180
+ )
1181
+ },
1182
+ l.key
1183
+ )) }) })
1184
+ ] });
1185
+ switch (o) {
1186
+ case W.System:
1187
+ return u();
1188
+ case W.Agent:
1189
+ return f();
1190
+ case W.User:
1191
+ return b();
1192
+ default:
1193
+ return null;
1194
+ }
1195
+ }
1196
+ ), F = ({
1197
+ content: t,
1198
+ isUser: e,
1199
+ isSystem: r,
1200
+ stacked: o
1201
+ }) => {
1202
+ const s = Y(), { title: i, body: c, actions: d, form: u, items: f } = t;
1203
+ return f ? /* @__PURE__ */ n(
1204
+ _,
1205
+ {
1206
+ className: "humany-message-content",
1207
+ user: !!e,
1208
+ stacked: o,
1209
+ children: /* @__PURE__ */ n(Ct, { items: f, dispatch: s })
1210
+ }
1211
+ ) : /* @__PURE__ */ m(
1212
+ _,
1213
+ {
1214
+ className: "humany-message-content",
1215
+ padded: !r,
1216
+ user: !!e,
1217
+ stacked: o,
1218
+ fullWidth: !!u || !!d,
1219
+ children: [
1220
+ i && /* @__PURE__ */ n(B, { children: /* @__PURE__ */ n(Fe, { variant: "h2", children: i }) }),
1221
+ c && /* @__PURE__ */ n(B, { children: /* @__PURE__ */ n(_e, { html: c }) }),
1222
+ u && /* @__PURE__ */ n(B, { children: /* @__PURE__ */ n(
1223
+ qe,
1224
+ {
1225
+ ...u,
1226
+ onChange: (l, h) => {
1227
+ s("form", {
1228
+ data: h,
1229
+ formKey: u.schema.id,
1230
+ actionKey: l
1231
+ });
1232
+ }
1233
+ }
1234
+ ) }),
1235
+ d && /* @__PURE__ */ n(B, { children: /* @__PURE__ */ n(
1236
+ Ye,
1237
+ {
1238
+ items: Object.keys(d).map((l) => ({ label: d[l], actionKey: l })),
1239
+ renderItem: (l) => /* @__PURE__ */ n("li", { children: /* @__PURE__ */ n(
1240
+ Ge,
1241
+ {
1242
+ onClick: () => {
1243
+ s("action", l.actionKey);
1244
+ },
1245
+ children: l.label
1246
+ }
1247
+ ) }, l.actionKey)
1248
+ }
1249
+ ) })
1250
+ ]
1251
+ }
1252
+ );
1253
+ }, re = a.div`
1254
+ position: absolute;
1255
+ left: -10000px;
1256
+ top: auto;
1257
+ width: 1px;
1258
+ height: 1px;
1259
+ overflow: hidden;
1260
+ `, ge = () => {
1261
+ const t = de((d) => {
1262
+ d && setTimeout(() => {
1263
+ d.scrollIntoView({
1264
+ block: "start",
1265
+ behavior: "smooth"
1266
+ });
1267
+ }, 250);
1268
+ }, []), [e, r] = ae(!0), {
1269
+ messages: o,
1270
+ loading: s,
1271
+ typingActors: i = []
1272
+ } = N(), c = () => i && i.length ? i.map((d, u) => /* @__PURE__ */ n(
1273
+ U,
1274
+ {
1275
+ id: `typing_${d.name}`,
1276
+ children: /* @__PURE__ */ n(he, { timestamp: Date.now(), sender: d, children: /* @__PURE__ */ n(
1277
+ te,
1278
+ {
1279
+ boxed: !0,
1280
+ ref: t
1281
+ }
1282
+ ) })
1283
+ },
1284
+ `typing_${d.name}`
1285
+ )) : null;
1286
+ return /* @__PURE__ */ m(z, { children: [
1287
+ /* @__PURE__ */ m(Lt, { tabIndex: 0, scrollableCss: e, ref: r, children: [
1288
+ o && o.length ? o.map((d, u) => {
1289
+ const { type: f, timestamp: b, sender: l, content: h } = d;
1290
+ return /* @__PURE__ */ n(
1291
+ U,
1292
+ {
1293
+ className: "humany-conversation-entry",
1294
+ tabIndex: -1,
1295
+ children: /* @__PURE__ */ n(zt, { ...d, ref: t })
1296
+ },
1297
+ `${f}_${l == null ? void 0 : l.name}_${b}_${h[0].key}`
1298
+ );
1299
+ }) : null,
1300
+ c(),
1301
+ s && /* @__PURE__ */ n(U, { children: /* @__PURE__ */ n(te, { ref: t }) })
1302
+ ] }),
1303
+ /* @__PURE__ */ n(Re, {})
1304
+ ] });
1305
+ }, Lt = a.div`
1306
+ display: flex;
1307
+ flex-direction: column;
1308
+ align-items: stretch;
1309
+ flex: 0 1 100%;
1310
+ padding: 0 ${(t) => {
1311
+ var e;
1312
+ return (e = t.theme.sizes) == null ? void 0 : e.medium;
1313
+ }};
1314
+ ${(t) => !!t.scrollableCss && t.scrollableCss};
1315
+ &:focus-visible {
1316
+ ${(t) => p(t)};
1317
+ }
1318
+ `, U = a.div`
1319
+ margin: 0;
1320
+ margin-bottom: ${(t) => {
1321
+ var e;
1322
+ return (e = t.theme.sizes) == null ? void 0 : e.medium;
1323
+ }};
1324
+
1325
+ &:first-of-type {
1326
+ margin-top: ${(t) => {
1327
+ var e;
1328
+ return (e = t.theme.sizes) == null ? void 0 : e.medium;
1329
+ }};
1330
+ }
1331
+
1332
+ &:last-of-type {
1333
+ padding-bottom: ${(t) => {
1334
+ var e;
1335
+ return (e = t.theme.sizes) == null ? void 0 : e.medium;
1336
+ }};
1337
+ }
1338
+
1339
+ & span,
1340
+ p,
1341
+ a,
1342
+ div {
1343
+ font-weight: 300;
1344
+ }
1345
+
1346
+ & b,
1347
+ h1 {
1348
+ font-weight: normal;
1349
+ }
1350
+ ${(t) => Q(t)(
1351
+ "h1",
1352
+ y`
1353
+ font-weight: normal;
1354
+ `
1355
+ )}
1356
+ `, Nt = ({ dispatch: t }) => {
1357
+ const e = ce(null);
1358
+ return X(() => {
1359
+ e.current && e.current.parentNode && t("overlay-mounted", e.current);
1360
+ }, [e]), /* @__PURE__ */ n(
1361
+ le,
1362
+ {
1363
+ portalId: "humany-conversation-overlay-portal",
1364
+ className: "humany-conversation-overlay-outlet",
1365
+ ref: e
1366
+ }
1367
+ );
1368
+ }, It = ({
1369
+ dispatch: t,
1370
+ header: e,
1371
+ buttonLabel: r
1372
+ }) => /* @__PURE__ */ m(
1373
+ Mt,
1374
+ {
1375
+ portalId: "humany-conversation-portal",
1376
+ className: "humany-conversation-outlet",
1377
+ children: [
1378
+ /* @__PURE__ */ m(Tt, { className: "humany-conversation-outlet-head", children: [
1379
+ /* @__PURE__ */ n(
1380
+ Ht,
1381
+ {
1382
+ className: "humany-conversation-outlet-head-button",
1383
+ "aria-label": r,
1384
+ title: r,
1385
+ onClick: () => t("hide-overlay-conversation"),
1386
+ children: /* @__PURE__ */ n(
1387
+ w,
1388
+ {
1389
+ symbol: {
1390
+ type: "Svg",
1391
+ content: "caret-down"
1392
+ },
1393
+ size: 20
1394
+ }
1395
+ )
1396
+ }
1397
+ ),
1398
+ e && /* @__PURE__ */ n(
1399
+ At,
1400
+ {
1401
+ className: "humany-conversation-outlet-header",
1402
+ variant: "h1",
1403
+ children: e
1404
+ }
1405
+ )
1406
+ ] }),
1407
+ /* @__PURE__ */ n(ge, {})
1408
+ ]
1409
+ }
1410
+ ), Mt = a(le)`
1411
+ z-index: 11;
1412
+ top: auto;
1413
+ height: 65%;
1414
+ background-color: #ffffff;
1415
+ display: flex;
1416
+ flex-direction: column;
1417
+ border-top-right-radius: ${(t) => {
1418
+ var e;
1419
+ return (e = t.theme.sizes) == null ? void 0 : e.large;
1420
+ }};
1421
+ border-top-left-radius: ${(t) => {
1422
+ var e;
1423
+ return (e = t.theme.sizes) == null ? void 0 : e.large;
1424
+ }};
1425
+ `, Tt = a.div`
1426
+ display: flex;
1427
+ flex-direction: column;
1428
+ justify-content: center;
1429
+ align-items: center;
1430
+ gap: ${(t) => {
1431
+ var e;
1432
+ return (e = t.theme.sizes) == null ? void 0 : e.normal;
1433
+ }};
1434
+ padding: ${(t) => {
1435
+ var e;
1436
+ return (e = t.theme.sizes) == null ? void 0 : e.normal;
1437
+ }};
1438
+ ${(t) => t.theme.border && `border-bottom: ${t.theme.border};`}
1439
+ `, At = a(G)`
1440
+ font-size: ${(t) => {
1441
+ var e;
1442
+ return (e = t.theme.fonts) == null ? void 0 : e.medium;
1443
+ }};
1444
+ color: ${(t) => {
1445
+ var e;
1446
+ return (e = t.theme.colors) == null ? void 0 : e.text;
1447
+ }};
1448
+ margin: 0;
1449
+ `, Ht = a(L)`
1450
+ display: flex;
1451
+ align-items: center;
1452
+ justify-content: center;
1453
+ padding: ${(t) => {
1454
+ var e;
1455
+ return (e = t.theme.sizes) == null ? void 0 : e.small;
1456
+ }} ${(t) => {
1457
+ var e;
1458
+ return (e = t.theme.sizes) == null ? void 0 : e.medium;
1459
+ }};
1460
+ ${(t) => t.theme.borderRadius && `border-radius: ${t.theme.borderRadius};`}
1461
+
1462
+ &:focus-visible {
1463
+ ${p};
1464
+ }
1465
+
1466
+ svg line {
1467
+ stroke: ${(t) => {
1468
+ var e;
1469
+ return (e = t.theme.colors) == null ? void 0 : e.text;
1470
+ }};
1471
+ }
1472
+ `, qt = ({ className: t, ...e }) => {
1473
+ const {
1474
+ overlay: r,
1475
+ overlayConversationHeader: o,
1476
+ overlayConversationCloseLabel: s,
1477
+ conversationControllerId: i
1478
+ } = N(), c = Y(), u = Se().get("$settings");
1479
+ return /* @__PURE__ */ n(
1480
+ ze.Provider,
1481
+ {
1482
+ value: i ? { id: i } : null,
1483
+ children: /* @__PURE__ */ m(ue.Provider, { value: u == null ? void 0 : u.language, children: [
1484
+ /* @__PURE__ */ n(
1485
+ Rt,
1486
+ {
1487
+ "aria-live": "assertive",
1488
+ ...e,
1489
+ className: M(
1490
+ t,
1491
+ "humany-conversation-component"
1492
+ ),
1493
+ children: /* @__PURE__ */ n(ge, {})
1494
+ }
1495
+ ),
1496
+ r && /* @__PURE__ */ m(z, { children: [
1497
+ /* @__PURE__ */ n(Nt, { dispatch: c }),
1498
+ r.conversation && /* @__PURE__ */ n(
1499
+ It,
1500
+ {
1501
+ dispatch: c,
1502
+ header: o,
1503
+ buttonLabel: s
1504
+ }
1505
+ )
1506
+ ] })
1507
+ ] })
1508
+ }
1509
+ );
1510
+ }, Rt = a.div`
1511
+ position: absolute;
1512
+ right: 0;
1513
+ left: 0;
1514
+ bottom: 0;
1515
+ top: 0;
1516
+ overflow: hidden;
1517
+ display: flex;
1518
+ flex-direction: column;
1519
+ `;
1520
+ export {
1521
+ qt as default
1522
+ };