@rqmii_immersive/agent-react-sdk 5.3.4 → 5.4.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.
Files changed (45) hide show
  1. package/dist/{RqmiiCloudAvatarPlayer-Bi44g7bl.js → RqmiiCloudAvatarPlayer-Cit_rrpj.js} +2472 -2478
  2. package/dist/RqmiiCloudAvatarPlayer-Cit_rrpj.js.map +1 -0
  3. package/dist/{RqmiiCloudAvatarPlayer-DDtkCYFJ.cjs → RqmiiCloudAvatarPlayer-DUQwPcpd.cjs} +293 -293
  4. package/dist/RqmiiCloudAvatarPlayer-DUQwPcpd.cjs.map +1 -0
  5. package/dist/agent-react-sdk.css +1 -1
  6. package/dist/components/RqmiiAgentRoom.d.ts +1 -1
  7. package/dist/components/RqmiiAgentRoom.d.ts.map +1 -1
  8. package/dist/core/managers/audio.d.ts +1 -3
  9. package/dist/core/managers/audio.d.ts.map +1 -1
  10. package/dist/embed.js +805 -799
  11. package/dist/embed.js.map +1 -1
  12. package/dist/hooks/use-rqmii-connection.d.ts.map +1 -1
  13. package/dist/index.cjs +1 -1
  14. package/dist/index.js +2 -2
  15. package/dist/provider/RqmiiAgentProvider.d.ts +1 -1
  16. package/dist/provider/RqmiiAgentProvider.d.ts.map +1 -1
  17. package/dist/provider/use-manager-lifecycle.d.ts +0 -2
  18. package/dist/provider/use-manager-lifecycle.d.ts.map +1 -1
  19. package/dist/types/index.d.ts +29 -7
  20. package/dist/types/index.d.ts.map +1 -1
  21. package/dist/ui/RqmiiAgentChat.d.ts +2 -2
  22. package/dist/ui/RqmiiAgentChat.d.ts.map +1 -1
  23. package/dist/ui/agent-data.d.ts.map +1 -1
  24. package/dist/ui/chat/ChatBox.d.ts.map +1 -1
  25. package/dist/ui/chat/chat-box-content.d.ts.map +1 -1
  26. package/dist/ui/chat/consent-dialog.d.ts +4 -2
  27. package/dist/ui/chat/consent-dialog.d.ts.map +1 -1
  28. package/dist/ui/chat/feedback.d.ts +3 -1
  29. package/dist/ui/chat/feedback.d.ts.map +1 -1
  30. package/dist/ui/chat/markdown.d.ts +12 -0
  31. package/dist/ui/chat/markdown.d.ts.map +1 -0
  32. package/dist/ui/chat/markdown.test.d.ts +2 -0
  33. package/dist/ui/chat/markdown.test.d.ts.map +1 -0
  34. package/dist/ui/chat/panels.d.ts.map +1 -1
  35. package/dist/ui/chat/utils.d.ts +17 -7
  36. package/dist/ui/chat/utils.d.ts.map +1 -1
  37. package/dist/ui/chat/utils.test.d.ts +2 -0
  38. package/dist/ui/chat/utils.test.d.ts.map +1 -0
  39. package/dist/ui.cjs +28 -22
  40. package/dist/ui.cjs.map +1 -1
  41. package/dist/ui.js +1396 -1105
  42. package/dist/ui.js.map +1 -1
  43. package/package.json +1 -1
  44. package/dist/RqmiiCloudAvatarPlayer-Bi44g7bl.js.map +0 -1
  45. package/dist/RqmiiCloudAvatarPlayer-DDtkCYFJ.cjs.map +0 -1
package/dist/ui.js CHANGED
@@ -1,8 +1,8 @@
1
- import { A as oe, u as ka, g as Oe, j as de, h as ue, i as aa, l as ta, k as na, R as fa, c as va } from "./RqmiiCloudAvatarPlayer-Bi44g7bl.js";
2
- import { E as ni, d as ii } from "./RqmiiCloudAvatarPlayer-Bi44g7bl.js";
3
- import { jsx as n, jsxs as f, Fragment as Ve } from "react/jsx-runtime";
4
- import j, { useContext as ya, createContext as Fa, forwardRef as ia, createElement as Pe, useState as y, useEffect as I, useRef as _, useLayoutEffect as Ye, useCallback as se, useMemo as te } from "react";
5
- const Ea = {
1
+ import { A as de, u as Ea, g as He, j as ge, h as pe, i as oa, l as sa, k as ra, R as za, c as Sa } from "./RqmiiCloudAvatarPlayer-Cit_rrpj.js";
2
+ import { E as gi, d as pi } from "./RqmiiCloudAvatarPlayer-Cit_rrpj.js";
3
+ import { jsx as n, jsxs as v, Fragment as Te } from "react/jsx-runtime";
4
+ import A, { useContext as xa, createContext as Ma, forwardRef as la, createElement as Le, useState as y, useEffect as I, useRef as B, useLayoutEffect as We, useCallback as ie, useMemo as $ } from "react";
5
+ const wa = {
6
6
  sendMessage: "Stuur 'n boodskap",
7
7
  send: "Stuur",
8
8
  close: "Sluit",
@@ -45,7 +45,7 @@ const Ea = {
45
45
  leadFormEmail: "E-pos",
46
46
  leadFormPhone: "Foon",
47
47
  leadFormMessage: "Jou boodskap"
48
- }, Ta = {
48
+ }, Pa = {
49
49
  sendMessage: "Dërgo një mesazh",
50
50
  send: "Dërgo",
51
51
  close: "Mbyll",
@@ -88,7 +88,7 @@ const Ea = {
88
88
  leadFormEmail: "Email",
89
89
  leadFormPhone: "Telefoni",
90
90
  leadFormMessage: "Mesazhi juaj"
91
- }, za = {
91
+ }, Ca = {
92
92
  sendMessage: "اكتب رسالة",
93
93
  send: "إرسال",
94
94
  close: "إغلاق",
@@ -131,7 +131,7 @@ const Ea = {
131
131
  leadFormEmail: "البريد الإلكتروني",
132
132
  leadFormPhone: "رقم الهاتف",
133
133
  leadFormMessage: "رسالتك"
134
- }, Sa = {
134
+ }, La = {
135
135
  sendMessage: "اكتب رسالة",
136
136
  send: "إرسال",
137
137
  close: "إغلاق",
@@ -174,7 +174,7 @@ const Ea = {
174
174
  leadFormEmail: "البريد الإلكتروني",
175
175
  leadFormPhone: "رقم الهاتف",
176
176
  leadFormMessage: "رسالتك"
177
- }, xa = {
177
+ }, Aa = {
178
178
  sendMessage: "اكتب رسالة",
179
179
  send: "إرسال",
180
180
  close: "إغلاق",
@@ -217,7 +217,7 @@ const Ea = {
217
217
  leadFormEmail: "البريد الإلكتروني",
218
218
  leadFormPhone: "رقم الهاتف",
219
219
  leadFormMessage: "رسالتك"
220
- }, Ma = {
220
+ }, _a = {
221
221
  sendMessage: "Mesaj göndər",
222
222
  send: "Göndər",
223
223
  close: "Bağla",
@@ -260,7 +260,7 @@ const Ea = {
260
260
  leadFormEmail: "E-poçt",
261
261
  leadFormPhone: "Telefon",
262
262
  leadFormMessage: "Mesajınız"
263
- }, Pa = {
263
+ }, qa = {
264
264
  sendMessage: "Bidali mezua",
265
265
  send: "Bidali",
266
266
  close: "Itxi",
@@ -303,7 +303,7 @@ const Ea = {
303
303
  leadFormEmail: "Helbide elektronikoa",
304
304
  leadFormPhone: "Telefonoa",
305
305
  leadFormMessage: "Zure mezua"
306
- }, Ca = {
306
+ }, Ia = {
307
307
  sendMessage: "Адправіць паведамленне",
308
308
  send: "Адправіць",
309
309
  close: "Зачыніць",
@@ -346,7 +346,7 @@ const Ea = {
346
346
  leadFormEmail: "Электронная пошта",
347
347
  leadFormPhone: "Тэлефон",
348
348
  leadFormMessage: "Ваша паведамленне"
349
- }, wa = {
349
+ }, Va = {
350
350
  sendMessage: "একটি বার্তা পাঠান",
351
351
  send: "পাঠান",
352
352
  close: "বন্ধ করুন",
@@ -389,7 +389,7 @@ const Ea = {
389
389
  leadFormEmail: "ইমেইল",
390
390
  leadFormPhone: "ফোন",
391
391
  leadFormMessage: "আপনার বার্তা"
392
- }, La = {
392
+ }, Na = {
393
393
  sendMessage: "Pošalji poruku",
394
394
  send: "Pošalji",
395
395
  close: "Zatvori",
@@ -432,7 +432,7 @@ const Ea = {
432
432
  leadFormEmail: "E-mail",
433
433
  leadFormPhone: "Telefon",
434
434
  leadFormMessage: "Vaša poruka"
435
- }, Aa = {
435
+ }, ja = {
436
436
  sendMessage: "Изпрати съобщение",
437
437
  send: "Изпрати",
438
438
  close: "Затвори",
@@ -475,7 +475,7 @@ const Ea = {
475
475
  leadFormEmail: "Имейл",
476
476
  leadFormPhone: "Телефон",
477
477
  leadFormMessage: "Вашето съобщение"
478
- }, Va = {
478
+ }, Da = {
479
479
  sendMessage: "Enviar un missatge",
480
480
  send: "Enviar",
481
481
  close: "Tancar",
@@ -518,7 +518,7 @@ const Ea = {
518
518
  leadFormEmail: "Correu electrònic",
519
519
  leadFormPhone: "Telèfon",
520
520
  leadFormMessage: "El teu missatge"
521
- }, ja = {
521
+ }, Ra = {
522
522
  sendMessage: "发送消息",
523
523
  send: "发送",
524
524
  close: "关闭",
@@ -561,7 +561,7 @@ const Ea = {
561
561
  leadFormEmail: "电子邮箱",
562
562
  leadFormPhone: "电话",
563
563
  leadFormMessage: "您的留言"
564
- }, Da = {
564
+ }, Ba = {
565
565
  sendMessage: "Pošalji poruku",
566
566
  send: "Pošalji",
567
567
  close: "Zatvori",
@@ -604,7 +604,7 @@ const Ea = {
604
604
  leadFormEmail: "E-mail",
605
605
  leadFormPhone: "Telefon",
606
606
  leadFormMessage: "Vaša poruka"
607
- }, Ia = {
607
+ }, Ga = {
608
608
  sendMessage: "Poslat zprávu",
609
609
  send: "Odeslat",
610
610
  close: "Zavřít",
@@ -647,7 +647,7 @@ const Ea = {
647
647
  leadFormEmail: "E-mail",
648
648
  leadFormPhone: "Telefon",
649
649
  leadFormMessage: "Vaše zpráva"
650
- }, qa = {
650
+ }, Ua = {
651
651
  sendMessage: "Send en besked",
652
652
  send: "Send",
653
653
  close: "Luk",
@@ -690,7 +690,7 @@ const Ea = {
690
690
  leadFormEmail: "E-mail",
691
691
  leadFormPhone: "Telefon",
692
692
  leadFormMessage: "Din besked"
693
- }, Na = {
693
+ }, Ka = {
694
694
  sendMessage: "Stuur een bericht",
695
695
  send: "Verzenden",
696
696
  close: "Sluiten",
@@ -733,7 +733,7 @@ const Ea = {
733
733
  leadFormEmail: "E-mail",
734
734
  leadFormPhone: "Telefoon",
735
735
  leadFormMessage: "Uw bericht"
736
- }, _a = {
736
+ }, Oa = {
737
737
  sendMessage: "Send a message",
738
738
  send: "Send",
739
739
  close: "Close",
@@ -776,7 +776,7 @@ const Ea = {
776
776
  leadFormEmail: "Email",
777
777
  leadFormPhone: "Phone",
778
778
  leadFormMessage: "Your message"
779
- }, Ra = {
779
+ }, Ya = {
780
780
  sendMessage: "Saada sõnum",
781
781
  send: "Saada",
782
782
  close: "Sulge",
@@ -819,7 +819,7 @@ const Ea = {
819
819
  leadFormEmail: "E-post",
820
820
  leadFormPhone: "Telefon",
821
821
  leadFormMessage: "Teie sõnum"
822
- }, Ba = {
822
+ }, Qa = {
823
823
  sendMessage: "Lähetä viesti",
824
824
  send: "Lähetä",
825
825
  close: "Sulje",
@@ -862,7 +862,7 @@ const Ea = {
862
862
  leadFormEmail: "Sähköposti",
863
863
  leadFormPhone: "Puhelin",
864
864
  leadFormMessage: "Viestisi"
865
- }, Ga = {
865
+ }, Ha = {
866
866
  sendMessage: "Envoyer un message",
867
867
  send: "Envoyer",
868
868
  close: "Fermer",
@@ -905,7 +905,7 @@ const Ea = {
905
905
  leadFormEmail: "E-mail",
906
906
  leadFormPhone: "Téléphone",
907
907
  leadFormMessage: "Votre message"
908
- }, Ua = {
908
+ }, Wa = {
909
909
  sendMessage: "Enviar unha mensaxe",
910
910
  send: "Enviar",
911
911
  close: "Pechar",
@@ -948,7 +948,7 @@ const Ea = {
948
948
  leadFormEmail: "Correo electrónico",
949
949
  leadFormPhone: "Teléfono",
950
950
  leadFormMessage: "A túa mensaxe"
951
- }, Ka = {
951
+ }, $a = {
952
952
  sendMessage: "Nachricht senden",
953
953
  send: "Senden",
954
954
  close: "Schließen",
@@ -991,7 +991,7 @@ const Ea = {
991
991
  leadFormEmail: "E-Mail",
992
992
  leadFormPhone: "Telefon",
993
993
  leadFormMessage: "Ihre Nachricht"
994
- }, Oa = {
994
+ }, Za = {
995
995
  sendMessage: "Αποστολή μηνύματος",
996
996
  send: "Αποστολή",
997
997
  close: "Κλείσιμο",
@@ -1034,7 +1034,7 @@ const Ea = {
1034
1034
  leadFormEmail: "E-mail",
1035
1035
  leadFormPhone: "Τηλέφωνο",
1036
1036
  leadFormMessage: "Το μήνυμά σας"
1037
- }, Ya = {
1037
+ }, Ja = {
1038
1038
  sendMessage: "સંદેશ મોકલો",
1039
1039
  send: "મોકલો",
1040
1040
  close: "બંધ કરો",
@@ -1077,7 +1077,7 @@ const Ea = {
1077
1077
  leadFormEmail: "ઇમેઇલ",
1078
1078
  leadFormPhone: "ફોન",
1079
1079
  leadFormMessage: "તમારો સંદેશ"
1080
- }, Qa = {
1080
+ }, Xa = {
1081
1081
  sendMessage: "संदेश भेजें",
1082
1082
  send: "भेजें",
1083
1083
  close: "बंद करें",
@@ -1120,7 +1120,7 @@ const Ea = {
1120
1120
  leadFormEmail: "ईमेल",
1121
1121
  leadFormPhone: "फ़ोन",
1122
1122
  leadFormMessage: "आपका संदेश"
1123
- }, Ha = {
1123
+ }, et = {
1124
1124
  sendMessage: "Üzenet küldése",
1125
1125
  send: "Küldés",
1126
1126
  close: "Bezárás",
@@ -1163,7 +1163,7 @@ const Ea = {
1163
1163
  leadFormEmail: "E-mail",
1164
1164
  leadFormPhone: "Telefon",
1165
1165
  leadFormMessage: "Üzenete"
1166
- }, Wa = {
1166
+ }, at = {
1167
1167
  sendMessage: "Kirim pesan",
1168
1168
  send: "Kirim",
1169
1169
  close: "Tutup",
@@ -1206,7 +1206,7 @@ const Ea = {
1206
1206
  leadFormEmail: "Email",
1207
1207
  leadFormPhone: "Telepon",
1208
1208
  leadFormMessage: "Pesan Anda"
1209
- }, $a = {
1209
+ }, tt = {
1210
1210
  sendMessage: "Invia un messaggio",
1211
1211
  send: "Invia",
1212
1212
  close: "Chiudi",
@@ -1249,7 +1249,7 @@ const Ea = {
1249
1249
  leadFormEmail: "E-mail",
1250
1250
  leadFormPhone: "Telefono",
1251
1251
  leadFormMessage: "Il tuo messaggio"
1252
- }, Za = {
1252
+ }, nt = {
1253
1253
  sendMessage: "メッセージを送信",
1254
1254
  send: "送信",
1255
1255
  close: "閉じる",
@@ -1292,7 +1292,7 @@ const Ea = {
1292
1292
  leadFormEmail: "メールアドレス",
1293
1293
  leadFormPhone: "電話番号",
1294
1294
  leadFormMessage: "メッセージ"
1295
- }, Ja = {
1295
+ }, it = {
1296
1296
  sendMessage: "ಸಂದೇಶ ಕಳುಹಿಸಿ",
1297
1297
  send: "ಕಳುಹಿಸಿ",
1298
1298
  close: "ಮುಚ್ಚಿ",
@@ -1335,7 +1335,7 @@ const Ea = {
1335
1335
  leadFormEmail: "ಇಮೇಲ್",
1336
1336
  leadFormPhone: "ಫೋನ್",
1337
1337
  leadFormMessage: "ನಿಮ್ಮ ಸಂದೇಶ"
1338
- }, Xa = {
1338
+ }, ot = {
1339
1339
  sendMessage: "Хабарлама жіберу",
1340
1340
  send: "Жіберу",
1341
1341
  close: "Жабу",
@@ -1378,7 +1378,7 @@ const Ea = {
1378
1378
  leadFormEmail: "Электрондық пошта",
1379
1379
  leadFormPhone: "Телефон",
1380
1380
  leadFormMessage: "Сіздің хабарламаңыз"
1381
- }, et = {
1381
+ }, st = {
1382
1382
  sendMessage: "메시지 보내기",
1383
1383
  send: "보내기",
1384
1384
  close: "닫기",
@@ -1421,7 +1421,7 @@ const Ea = {
1421
1421
  leadFormEmail: "이메일",
1422
1422
  leadFormPhone: "전화번호",
1423
1423
  leadFormMessage: "메시지"
1424
- }, at = {
1424
+ }, rt = {
1425
1425
  sendMessage: "Sūtīt ziņojumu",
1426
1426
  send: "Sūtīt",
1427
1427
  close: "Aizvērt",
@@ -1464,7 +1464,7 @@ const Ea = {
1464
1464
  leadFormEmail: "E-pasts",
1465
1465
  leadFormPhone: "Tālrunis",
1466
1466
  leadFormMessage: "Jūsu ziņojums"
1467
- }, tt = {
1467
+ }, lt = {
1468
1468
  sendMessage: "Siųsti žinutę",
1469
1469
  send: "Siųsti",
1470
1470
  close: "Uždaryti",
@@ -1507,7 +1507,7 @@ const Ea = {
1507
1507
  leadFormEmail: "El. paštas",
1508
1508
  leadFormPhone: "Telefonas",
1509
1509
  leadFormMessage: "Jūsų žinutė"
1510
- }, nt = {
1510
+ }, ct = {
1511
1511
  sendMessage: "Испрати порака",
1512
1512
  send: "Испрати",
1513
1513
  close: "Затвори",
@@ -1550,7 +1550,7 @@ const Ea = {
1550
1550
  leadFormEmail: "Е-пошта",
1551
1551
  leadFormPhone: "Телефон",
1552
1552
  leadFormMessage: "Вашата порака"
1553
- }, it = {
1553
+ }, dt = {
1554
1554
  sendMessage: "Hantar mesej",
1555
1555
  send: "Hantar",
1556
1556
  close: "Tutup",
@@ -1593,7 +1593,7 @@ const Ea = {
1593
1593
  leadFormEmail: "E-mel",
1594
1594
  leadFormPhone: "Telefon",
1595
1595
  leadFormMessage: "Mesej anda"
1596
- }, ot = {
1596
+ }, ut = {
1597
1597
  sendMessage: "ഒരു സന്ദേശം അയയ്‌ക്കുക",
1598
1598
  send: "അയയ്‌ക്കുക",
1599
1599
  close: "അടയ്‌ക്കുക",
@@ -1636,7 +1636,7 @@ const Ea = {
1636
1636
  leadFormEmail: "ഇമെയിൽ",
1637
1637
  leadFormPhone: "ഫോൺ",
1638
1638
  leadFormMessage: "നിങ്ങളുടെ സന്ദേശം"
1639
- }, st = {
1639
+ }, mt = {
1640
1640
  sendMessage: "संदेश पाठवा",
1641
1641
  send: "पाठवा",
1642
1642
  close: "बंद करा",
@@ -1679,7 +1679,7 @@ const Ea = {
1679
1679
  leadFormEmail: "ईमेल",
1680
1680
  leadFormPhone: "फोन",
1681
1681
  leadFormMessage: "तुमचा संदेश"
1682
- }, rt = {
1682
+ }, ht = {
1683
1683
  sendMessage: "Send en melding",
1684
1684
  send: "Send",
1685
1685
  close: "Lukk",
@@ -1722,7 +1722,7 @@ const Ea = {
1722
1722
  leadFormEmail: "E-post",
1723
1723
  leadFormPhone: "Telefon",
1724
1724
  leadFormMessage: "Din melding"
1725
- }, lt = {
1725
+ }, gt = {
1726
1726
  sendMessage: "پیامی بنویسید",
1727
1727
  send: "ارسال",
1728
1728
  close: "بستن",
@@ -1765,7 +1765,7 @@ const Ea = {
1765
1765
  leadFormEmail: "ایمیل",
1766
1766
  leadFormPhone: "تلفن",
1767
1767
  leadFormMessage: "پیام شما"
1768
- }, ct = {
1768
+ }, pt = {
1769
1769
  sendMessage: "Wyślij wiadomość",
1770
1770
  send: "Wyślij",
1771
1771
  close: "Zamknij",
@@ -1808,7 +1808,7 @@ const Ea = {
1808
1808
  leadFormEmail: "E-mail",
1809
1809
  leadFormPhone: "Telefon",
1810
1810
  leadFormMessage: "Twoja wiadomość"
1811
- }, dt = {
1811
+ }, bt = {
1812
1812
  sendMessage: "Enviar mensagem",
1813
1813
  send: "Enviar",
1814
1814
  close: "Fechar",
@@ -1851,7 +1851,7 @@ const Ea = {
1851
1851
  leadFormEmail: "E-mail",
1852
1852
  leadFormPhone: "Telefone",
1853
1853
  leadFormMessage: "Sua mensagem"
1854
- }, ut = {
1854
+ }, ft = {
1855
1855
  sendMessage: "ਇੱਕ ਸੁਨੇਹਾ ਭੇਜੋ",
1856
1856
  send: "ਭੇਜੋ",
1857
1857
  close: "ਬੰਦ ਕਰੋ",
@@ -1894,7 +1894,7 @@ const Ea = {
1894
1894
  leadFormEmail: "ਈਮੇਲ",
1895
1895
  leadFormPhone: "ਫ਼ੋਨ",
1896
1896
  leadFormMessage: "ਤੁਹਾਡਾ ਸੁਨੇਹਾ"
1897
- }, mt = {
1897
+ }, kt = {
1898
1898
  sendMessage: "Trimite un mesaj",
1899
1899
  send: "Trimite",
1900
1900
  close: "Închide",
@@ -1937,7 +1937,7 @@ const Ea = {
1937
1937
  leadFormEmail: "E-mail",
1938
1938
  leadFormPhone: "Telefon",
1939
1939
  leadFormMessage: "Mesajul dumneavoastră"
1940
- }, ht = {
1940
+ }, vt = {
1941
1941
  sendMessage: "Отправить сообщение",
1942
1942
  send: "Отправить",
1943
1943
  close: "Закрыть",
@@ -1980,7 +1980,7 @@ const Ea = {
1980
1980
  leadFormEmail: "Электронная почта",
1981
1981
  leadFormPhone: "Телефон",
1982
1982
  leadFormMessage: "Ваше сообщение"
1983
- }, gt = {
1983
+ }, yt = {
1984
1984
  sendMessage: "Пошаљи поруку",
1985
1985
  send: "Пошаљи",
1986
1986
  close: "Затвори",
@@ -2023,7 +2023,7 @@ const Ea = {
2023
2023
  leadFormEmail: "Имејл",
2024
2024
  leadFormPhone: "Телефон",
2025
2025
  leadFormMessage: "Ваша порука"
2026
- }, pt = {
2026
+ }, Ft = {
2027
2027
  sendMessage: "Poslať správu",
2028
2028
  send: "Odoslať",
2029
2029
  close: "Zavrieť",
@@ -2066,7 +2066,7 @@ const Ea = {
2066
2066
  leadFormEmail: "E-mail",
2067
2067
  leadFormPhone: "Telefón",
2068
2068
  leadFormMessage: "Vaša správa"
2069
- }, bt = {
2069
+ }, Tt = {
2070
2070
  sendMessage: "Pošlji sporočilo",
2071
2071
  send: "Pošlji",
2072
2072
  close: "Zapri",
@@ -2109,7 +2109,7 @@ const Ea = {
2109
2109
  leadFormEmail: "E-pošta",
2110
2110
  leadFormPhone: "Telefon",
2111
2111
  leadFormMessage: "Vaše sporočilo"
2112
- }, kt = {
2112
+ }, Et = {
2113
2113
  sendMessage: "Enviar un mensaje",
2114
2114
  send: "Enviar",
2115
2115
  close: "Cerrar",
@@ -2152,7 +2152,7 @@ const Ea = {
2152
2152
  leadFormEmail: "Correo electrónico",
2153
2153
  leadFormPhone: "Teléfono",
2154
2154
  leadFormMessage: "Tu mensaje"
2155
- }, ft = {
2155
+ }, zt = {
2156
2156
  sendMessage: "Tuma ujumbe",
2157
2157
  send: "Tuma",
2158
2158
  close: "Funga",
@@ -2195,7 +2195,7 @@ const Ea = {
2195
2195
  leadFormEmail: "Barua pepe",
2196
2196
  leadFormPhone: "Simu",
2197
2197
  leadFormMessage: "Ujumbe wako"
2198
- }, vt = {
2198
+ }, St = {
2199
2199
  sendMessage: "Skicka ett meddelande",
2200
2200
  send: "Skicka",
2201
2201
  close: "Stäng",
@@ -2238,7 +2238,7 @@ const Ea = {
2238
2238
  leadFormEmail: "E-post",
2239
2239
  leadFormPhone: "Telefon",
2240
2240
  leadFormMessage: "Ditt meddelande"
2241
- }, yt = {
2241
+ }, xt = {
2242
2242
  sendMessage: "Magpadala ng mensahe",
2243
2243
  send: "Ipadala",
2244
2244
  close: "Isara",
@@ -2281,7 +2281,7 @@ const Ea = {
2281
2281
  leadFormEmail: "Email",
2282
2282
  leadFormPhone: "Telepono",
2283
2283
  leadFormMessage: "Ang iyong mensahe"
2284
- }, Ft = {
2284
+ }, Mt = {
2285
2285
  sendMessage: "ஒரு செய்தி அனுப்பவும்",
2286
2286
  send: "அனுப்பு",
2287
2287
  close: "மூடு",
@@ -2324,7 +2324,7 @@ const Ea = {
2324
2324
  leadFormEmail: "மின்னஞ்சல்",
2325
2325
  leadFormPhone: "தொலைபேசி",
2326
2326
  leadFormMessage: "உங்கள் செய்தி"
2327
- }, Et = {
2327
+ }, wt = {
2328
2328
  sendMessage: "సందేశం పంపండి",
2329
2329
  send: "పంపు",
2330
2330
  close: "మూసివేయండి",
@@ -2367,7 +2367,7 @@ const Ea = {
2367
2367
  leadFormEmail: "ఇమెయిల్",
2368
2368
  leadFormPhone: "ఫోన్",
2369
2369
  leadFormMessage: "మీ సందేశం"
2370
- }, Tt = {
2370
+ }, Pt = {
2371
2371
  sendMessage: "ส่งข้อความ",
2372
2372
  send: "ส่ง",
2373
2373
  close: "ปิด",
@@ -2410,7 +2410,7 @@ const Ea = {
2410
2410
  leadFormEmail: "อีเมล",
2411
2411
  leadFormPhone: "โทรศัพท์",
2412
2412
  leadFormMessage: "ข้อความของคุณ"
2413
- }, zt = {
2413
+ }, Ct = {
2414
2414
  sendMessage: "Mesaj gönder",
2415
2415
  send: "Gönder",
2416
2416
  close: "Kapat",
@@ -2453,7 +2453,7 @@ const Ea = {
2453
2453
  leadFormEmail: "E-posta",
2454
2454
  leadFormPhone: "Telefon",
2455
2455
  leadFormMessage: "Mesajınız"
2456
- }, St = {
2456
+ }, Lt = {
2457
2457
  sendMessage: "Надіслати повідомлення",
2458
2458
  send: "Надіслати",
2459
2459
  close: "Закрити",
@@ -2496,7 +2496,7 @@ const Ea = {
2496
2496
  leadFormEmail: "Електронна пошта",
2497
2497
  leadFormPhone: "Телефон",
2498
2498
  leadFormMessage: "Ваше повідомлення"
2499
- }, xt = {
2499
+ }, At = {
2500
2500
  sendMessage: "پیغام بھیجیں",
2501
2501
  send: "بھیجیں",
2502
2502
  close: "بند کریں",
@@ -2539,7 +2539,7 @@ const Ea = {
2539
2539
  leadFormEmail: "ای میل",
2540
2540
  leadFormPhone: "فون",
2541
2541
  leadFormMessage: "آپ کا پیغام"
2542
- }, Mt = {
2542
+ }, _t = {
2543
2543
  sendMessage: "Gửi tin nhắn",
2544
2544
  send: "Gửi",
2545
2545
  close: "Đóng",
@@ -2582,7 +2582,7 @@ const Ea = {
2582
2582
  leadFormEmail: "Email",
2583
2583
  leadFormPhone: "Điện thoại",
2584
2584
  leadFormMessage: "Tin nhắn của bạn"
2585
- }, Pt = {
2585
+ }, qt = {
2586
2586
  sendMessage: "Anfon neges",
2587
2587
  send: "Anfon",
2588
2588
  close: "Cau",
@@ -2625,69 +2625,69 @@ const Ea = {
2625
2625
  leadFormEmail: "E-bost",
2626
2626
  leadFormPhone: "Ffôn",
2627
2627
  leadFormMessage: "Eich neges"
2628
- }, Qe = {
2629
- af: Ea,
2630
- sq: Ta,
2631
- ar: za,
2632
- "ar-eg": Sa,
2633
- "ar-sa": xa,
2634
- az: Ma,
2635
- eu: Pa,
2636
- be: Ca,
2637
- bn: wa,
2638
- bs: La,
2639
- bg: Aa,
2640
- ca: Va,
2641
- zh: ja,
2642
- hr: Da,
2643
- cs: Ia,
2644
- da: qa,
2645
- nl: Na,
2646
- en: _a,
2647
- et: Ra,
2648
- fi: Ba,
2649
- fr: Ga,
2650
- gl: Ua,
2651
- de: Ka,
2652
- el: Oa,
2653
- gu: Ya,
2654
- hi: Qa,
2655
- hu: Ha,
2656
- id: Wa,
2657
- it: $a,
2658
- ja: Za,
2659
- kn: Ja,
2660
- kk: Xa,
2661
- ko: et,
2662
- lv: at,
2663
- lt: tt,
2664
- mk: nt,
2665
- ms: it,
2666
- ml: ot,
2667
- mr: st,
2668
- no: rt,
2669
- fa: lt,
2670
- pl: ct,
2671
- pt: dt,
2672
- pa: ut,
2673
- ro: mt,
2674
- ru: ht,
2675
- sr: gt,
2676
- sk: pt,
2677
- sl: bt,
2678
- es: kt,
2679
- sw: ft,
2680
- sv: vt,
2681
- tl: yt,
2682
- ta: Ft,
2683
- te: Et,
2684
- th: Tt,
2685
- tr: zt,
2686
- uk: St,
2687
- ur: xt,
2688
- vi: Mt,
2689
- cy: Pt
2690
- }, Ce = [
2628
+ }, $e = {
2629
+ af: wa,
2630
+ sq: Pa,
2631
+ ar: Ca,
2632
+ "ar-eg": La,
2633
+ "ar-sa": Aa,
2634
+ az: _a,
2635
+ eu: qa,
2636
+ be: Ia,
2637
+ bn: Va,
2638
+ bs: Na,
2639
+ bg: ja,
2640
+ ca: Da,
2641
+ zh: Ra,
2642
+ hr: Ba,
2643
+ cs: Ga,
2644
+ da: Ua,
2645
+ nl: Ka,
2646
+ en: Oa,
2647
+ et: Ya,
2648
+ fi: Qa,
2649
+ fr: Ha,
2650
+ gl: Wa,
2651
+ de: $a,
2652
+ el: Za,
2653
+ gu: Ja,
2654
+ hi: Xa,
2655
+ hu: et,
2656
+ id: at,
2657
+ it: tt,
2658
+ ja: nt,
2659
+ kn: it,
2660
+ kk: ot,
2661
+ ko: st,
2662
+ lv: rt,
2663
+ lt,
2664
+ mk: ct,
2665
+ ms: dt,
2666
+ ml: ut,
2667
+ mr: mt,
2668
+ no: ht,
2669
+ fa: gt,
2670
+ pl: pt,
2671
+ pt: bt,
2672
+ pa: ft,
2673
+ ro: kt,
2674
+ ru: vt,
2675
+ sr: yt,
2676
+ sk: Ft,
2677
+ sl: Tt,
2678
+ es: Et,
2679
+ sw: zt,
2680
+ sv: St,
2681
+ tl: xt,
2682
+ ta: Mt,
2683
+ te: wt,
2684
+ th: Pt,
2685
+ tr: Ct,
2686
+ uk: Lt,
2687
+ ur: At,
2688
+ vi: _t,
2689
+ cy: qt
2690
+ }, Ae = [
2691
2691
  { value: "af", label: "Afrikaans", dir: "ltr" },
2692
2692
  { value: "sq", label: "Shqip", dir: "ltr" },
2693
2693
  { value: "ar-eg", label: "العربية (مصر)", dir: "rtl" },
@@ -2748,23 +2748,23 @@ const Ea = {
2748
2748
  { value: "ur", label: "اردو", dir: "rtl" },
2749
2749
  { value: "vi", label: "Tiếng Việt", dir: "ltr" },
2750
2750
  { value: "cy", label: "Cymraeg", dir: "ltr" }
2751
- ], He = Ce.map(
2751
+ ], Ze = Ae.map(
2752
2752
  (a) => a.value
2753
2753
  );
2754
- function We(a) {
2755
- return Ce.find((e) => e.value === a) || Ce.find((e) => e.value === "en");
2754
+ function Je(a) {
2755
+ return Ae.find((e) => e.value === a) || Ae.find((e) => e.value === "en");
2756
2756
  }
2757
- function F(a, e) {
2758
- return Qe[a]?.[e] || Qe.en[e] || e;
2757
+ function z(a, e) {
2758
+ return $e[a]?.[e] || $e.en[e] || e;
2759
2759
  }
2760
- function pe(a, e = "en") {
2761
- const t = Array.isArray(a) ? a.filter((i) => He.includes(i)) : [];
2762
- return !t.includes(e) && He.includes(e) && t.unshift(e), t.length ? [...new Set(t)] : ["ar-sa"];
2760
+ function ye(a, e = "en") {
2761
+ const t = Array.isArray(a) ? a.filter((i) => Ze.includes(i)) : [];
2762
+ return !t.includes(e) && Ze.includes(e) && t.unshift(e), t.length ? [...new Set(t)] : ["ar-sa"];
2763
2763
  }
2764
- const $e = {
2764
+ const Xe = {
2765
2765
  id: null,
2766
2766
  name: "Agent",
2767
- agentType: oe.TEXT,
2767
+ agentType: de.TEXT,
2768
2768
  useText: !0,
2769
2769
  useVoice: !1,
2770
2770
  faceImage: null,
@@ -2775,67 +2775,105 @@ const $e = {
2775
2775
  welcomeMessages: {},
2776
2776
  conversation: { default_language: "ar-sa", languages: ["ar-sa"], suggested_messages: {} },
2777
2777
  widget: {
2778
- appearance: { brand_color: null, position: "right", show_branding: !0, footer_content: {} },
2778
+ appearance: {
2779
+ position: "right",
2780
+ show_branding: !0,
2781
+ show_topbar_avatar_image: !0,
2782
+ font: "Cairo",
2783
+ footer_content: {},
2784
+ theme: { mode: "dark", accent_color: null, end_call_button_color: null }
2785
+ },
2779
2786
  behavior: {
2780
- post_chat_rating_enabled: !1,
2781
- welcome_bubble_enabled: !1,
2782
- welcome_bubble_delay_seconds: 3,
2783
- welcome_bubble_sound_enabled: !1,
2787
+ default_open: !1,
2788
+ conversation_ended_screen: {
2789
+ post_chat_rating_enabled: !1,
2790
+ show_conversation_id: !0
2791
+ },
2792
+ welcome_bubble: {
2793
+ enabled: !1,
2794
+ delay_seconds: 3,
2795
+ sound_enabled: !1
2796
+ },
2784
2797
  typing_indicator_enabled: !0,
2785
2798
  suggested_messages: {}
2799
+ },
2800
+ consent: {
2801
+ enabled: !1,
2802
+ one_time: !0,
2803
+ content: {}
2786
2804
  }
2787
2805
  }
2788
2806
  };
2789
- function ge(a) {
2790
- if (!a) return $e;
2791
- const e = a, t = e.agent_type || e.agentType || oe.TEXT, i = typeof e.use_text == "boolean" ? e.use_text : typeof e.useText == "boolean" ? e.useText : t !== oe.VOICE, s = typeof e.use_voice == "boolean" ? e.use_voice : typeof e.useVoice == "boolean" ? e.useVoice : t === oe.TEXT_AND_VOICE || t === oe.CLOUD_AVATAR || t === oe.DESKTOP_AVATAR, o = e.conversation || e.agent_customization?.conversation || {}, r = e.speech || e.agent_customization?.speech || {}, c = o.default_language || "ar-sa", d = pe(o.languages, c), l = e.widget || e.agent_customization?.widget || null, m = l?.appearance, u = l?.behavior, h = l, z = typeof m?.hide_branding == "boolean" ? !m.hide_branding : typeof m?.show_branding == "boolean" ? m.show_branding : !0, b = u?.suggested_messages || l?.suggested_messages || o.suggested_messages || o.suggestedMessages || {}, x = h ? {
2807
+ function ve(a) {
2808
+ if (!a) return Xe;
2809
+ const e = a, t = e.agent_type || e.agentType || de.TEXT, i = typeof e.use_text == "boolean" ? e.use_text : typeof e.useText == "boolean" ? e.useText : t !== de.VOICE, o = typeof e.use_voice == "boolean" ? e.use_voice : typeof e.useVoice == "boolean" ? e.useVoice : t === de.TEXT_AND_VOICE || t === de.CLOUD_AVATAR || t === de.DESKTOP_AVATAR, s = e.conversation || e.agent_customization?.conversation || {}, r = e.speech || e.agent_customization?.speech || {}, c = s.default_language || "ar-sa", l = ye(s.languages, c), d = e.widget || e.agent_customization?.widget || e.widget_customization || null, m = d?.appearance, u = d?.behavior, h = d, F = typeof m?.hide_branding == "boolean" ? !m.hide_branding : typeof m?.show_branding == "boolean" ? m.show_branding : !0, b = typeof m?.show_topbar_avatar_image == "boolean" ? m.show_topbar_avatar_image : typeof m?.showTopbarAvatarImage == "boolean" ? m.showTopbarAvatarImage : typeof d?.show_topbar_avatar_image == "boolean" ? d.show_topbar_avatar_image : typeof d?.showTopbarAvatarImage == "boolean" ? d.showTopbarAvatarImage : typeof e.show_topbar_avatar_image == "boolean" ? e.show_topbar_avatar_image : typeof e.showTopbarAvatarImage == "boolean" ? e.showTopbarAvatarImage : !0, M = u?.suggested_messages || d?.suggested_messages || s.suggested_messages || s.suggestedMessages || {}, S = typeof u?.default_open == "boolean" ? u.default_open : typeof u?.defaultOpen == "boolean" ? u.defaultOpen : typeof d?.default_open == "boolean" ? d.default_open : typeof d?.defaultOpen == "boolean" ? d.defaultOpen : typeof e.default_open == "boolean" ? e.default_open : typeof e.defaultOpen == "boolean" ? e.defaultOpen : !1, T = typeof m?.font == "string" ? m.font : typeof d?.font == "string" ? d.font : typeof e.font == "string" ? e.font : "Cairo", k = (() => {
2810
+ const U = (T || "").trim().toLowerCase().replace(/[-_]/g, " ");
2811
+ return U === "readex pro" || U === "readex" ? "Readex Pro" : U === "noto sans" || U === "noto" || U === "noto sans arabic" ? "Noto Sans" : "Cairo";
2812
+ })(), p = d?.consent || e.consent || e.consent_config || null, g = typeof p?.enabled == "boolean" ? p.enabled : !1, w = typeof p?.one_time == "boolean" ? p.one_time : typeof p?.oneTime == "boolean" ? p.oneTime : !0, E = p?.content || p?.body || {}, f = u?.conversation_ended_screen, P = {
2813
+ post_chat_rating_enabled: typeof f?.post_chat_rating_enabled == "boolean" ? f.post_chat_rating_enabled : typeof u?.post_chat_rating_enabled == "boolean" ? u.post_chat_rating_enabled : !1,
2814
+ show_conversation_id: typeof f?.show_conversation_id == "boolean" ? f.show_conversation_id : typeof f?.showConversationId == "boolean" ? f.showConversationId : !0
2815
+ }, C = u?.welcome_bubble, _ = {
2816
+ enabled: typeof C?.enabled == "boolean" ? C.enabled : !1,
2817
+ delay_seconds: typeof C?.delay_seconds == "number" ? C.delay_seconds : 3,
2818
+ sound_enabled: typeof C?.sound_enabled == "boolean" ? C.sound_enabled : !1
2819
+ }, x = m?.theme, j = {
2820
+ mode: x?.mode === "light" ? "light" : "dark",
2821
+ accent_color: typeof x?.accent_color == "string" ? x.accent_color : null,
2822
+ end_call_button_color: typeof x?.end_call_button_color == "string" ? x.end_call_button_color : null
2823
+ }, R = h ? {
2792
2824
  appearance: {
2793
- brand_color: m?.brand_color,
2794
2825
  position: m?.position || "right",
2795
- show_branding: z,
2796
- footer_content: m?.footer_content || {}
2826
+ show_branding: F,
2827
+ show_topbar_avatar_image: b,
2828
+ font: k,
2829
+ footer_content: m?.footer_content || {},
2830
+ theme: j
2797
2831
  },
2798
2832
  behavior: {
2799
- post_chat_rating_enabled: typeof u?.post_chat_rating_enabled == "boolean" ? u.post_chat_rating_enabled : !1,
2800
- welcome_bubble_enabled: typeof u?.welcome_bubble_enabled == "boolean" ? u.welcome_bubble_enabled : !1,
2801
- welcome_bubble_delay_seconds: typeof u?.welcome_bubble_delay_seconds == "number" ? u.welcome_bubble_delay_seconds : 3,
2802
- welcome_bubble_sound_enabled: typeof u?.welcome_bubble_sound_enabled == "boolean" ? u.welcome_bubble_sound_enabled : !1,
2833
+ default_open: S,
2834
+ conversation_ended_screen: P,
2835
+ welcome_bubble: _,
2803
2836
  typing_indicator_enabled: typeof u?.typing_indicator_enabled == "boolean" ? u.typing_indicator_enabled : !0,
2804
- suggested_messages: b
2837
+ suggested_messages: M
2838
+ },
2839
+ consent: {
2840
+ enabled: g,
2841
+ one_time: w,
2842
+ content: E
2805
2843
  }
2806
- } : void 0, v = e.consent || e.consent_config || null, E = o.welcome_message || o.welcomeMessage || e.welcome_message || e.welcomeMessage || {}, g = Object.fromEntries(
2807
- Object.entries(E).filter(([, T]) => typeof T == "string").map(([T, M]) => [T, M.slice(0, 1e3)])
2808
- ), k = typeof e.allow_interrupt == "boolean" ? e.allow_interrupt : typeof r.allow_interrupt == "boolean" ? r.allow_interrupt : !0, p = typeof e.allow_welcome_message_interrupt == "boolean" ? e.allow_welcome_message_interrupt : typeof r.allow_welcome_message_interrupt == "boolean" ? r.allow_welcome_message_interrupt : !1, S = (typeof e.face_image == "string" ? e.face_image : null) || (typeof e.faceImage == "string" ? e.faceImage : null) || null;
2844
+ } : void 0, D = e.consent || e.consent_config || null, L = s.welcome_message || s.welcomeMessage || e.welcome_message || e.welcomeMessage || {}, G = Object.fromEntries(
2845
+ Object.entries(L).filter(([, U]) => typeof U == "string").map(([U, J]) => [U, J.slice(0, 1e3)])
2846
+ ), N = typeof e.allow_interrupt == "boolean" ? e.allow_interrupt : typeof r.allow_interrupt == "boolean" ? r.allow_interrupt : !0, Y = typeof e.allow_welcome_message_interrupt == "boolean" ? e.allow_welcome_message_interrupt : typeof r.allow_welcome_message_interrupt == "boolean" ? r.allow_welcome_message_interrupt : !1, O = (typeof e.face_image == "string" ? e.face_image : null) || (typeof e.faceImage == "string" ? e.faceImage : null) || null;
2809
2847
  return {
2810
2848
  id: e.id || null,
2811
- name: e.name || $e.name,
2849
+ name: e.name || Xe.name,
2812
2850
  agentType: t,
2813
2851
  useText: i,
2814
- useVoice: s,
2815
- faceImage: S,
2816
- allowInterrupt: k,
2817
- allowWelcomeMessageInterrupt: p,
2818
- welcomeMessages: g,
2819
- languages: d,
2820
- defaultLanguage: d.includes(c) ? c : d[0],
2852
+ useVoice: o,
2853
+ faceImage: O,
2854
+ allowInterrupt: N,
2855
+ allowWelcomeMessageInterrupt: Y,
2856
+ welcomeMessages: G,
2857
+ languages: l,
2858
+ defaultLanguage: l.includes(c) ? c : l[0],
2821
2859
  conversation: {
2822
2860
  default_language: c,
2823
- languages: d,
2824
- suggested_messages: b
2861
+ languages: l,
2862
+ suggested_messages: M
2825
2863
  },
2826
- widget: x || void 0,
2827
- consent: v ? {
2828
- enabled: v.enabled ?? !1,
2829
- title: v.title || void 0,
2830
- body: v.body || void 0,
2831
- acceptLabel: v.accept_label || v.acceptLabel || void 0,
2832
- declineLabel: v.decline_label || v.declineLabel || void 0,
2833
- termsUrl: v.terms_url || v.termsUrl || void 0,
2834
- privacyUrl: v.privacy_url || v.privacyUrl || void 0
2864
+ widget: R || void 0,
2865
+ consent: D ? {
2866
+ enabled: D.enabled ?? !1,
2867
+ title: D.title || void 0,
2868
+ body: D.body || void 0,
2869
+ acceptLabel: D.accept_label || D.acceptLabel || void 0,
2870
+ declineLabel: D.decline_label || D.declineLabel || void 0,
2871
+ termsUrl: D.terms_url || D.termsUrl || void 0,
2872
+ privacyUrl: D.privacy_url || D.privacyUrl || void 0
2835
2873
  } : void 0
2836
2874
  };
2837
2875
  }
2838
- async function Ct({
2876
+ async function It({
2839
2877
  restUrl: a,
2840
2878
  identifier: e,
2841
2879
  withCredentials: t = !1,
@@ -2843,7 +2881,7 @@ async function Ct({
2843
2881
  }) {
2844
2882
  if (!a) throw new Error("Missing restUrl");
2845
2883
  if (!e) throw new Error("Missing identifier (agent_id or api_key)");
2846
- const s = await fetch(`${a}/agent/${e}/customization`, {
2884
+ const o = await fetch(`${a}/agent/${e}/customization`, {
2847
2885
  method: "GET",
2848
2886
  mode: "cors",
2849
2887
  credentials: t ? "include" : "omit",
@@ -2852,29 +2890,29 @@ async function Ct({
2852
2890
  },
2853
2891
  signal: i
2854
2892
  });
2855
- if (!s.ok)
2856
- throw new Error(`Failed to load agent customization: ${s.status}`);
2857
- const o = await s.json();
2858
- return ge({
2859
- id: o.id,
2860
- name: o.name,
2861
- company_name: o.company_name,
2862
- agent_type: o.agent_type,
2863
- use_voice: o.use_voice,
2864
- use_text: o.use_text,
2865
- face_image: o.face_image,
2866
- conversation: o.conversation,
2867
- widget: o.widget,
2868
- allow_interrupt: o.allow_interrupt,
2869
- allow_welcome_message_interrupt: o.allow_welcome_message_interrupt,
2870
- welcome_message: o.welcome_message
2893
+ if (!o.ok)
2894
+ throw new Error(`Failed to load agent customization: ${o.status}`);
2895
+ const s = await o.json();
2896
+ return ve({
2897
+ id: s.id,
2898
+ name: s.name,
2899
+ company_name: s.company_name,
2900
+ agent_type: s.agent_type,
2901
+ use_voice: s.use_voice,
2902
+ use_text: s.use_text,
2903
+ face_image: s.face_image,
2904
+ conversation: s.conversation,
2905
+ widget: s.widget,
2906
+ allow_interrupt: s.allow_interrupt,
2907
+ allow_welcome_message_interrupt: s.allow_welcome_message_interrupt,
2908
+ welcome_message: s.welcome_message
2871
2909
  });
2872
2910
  }
2873
- async function Zn({ restUrl: a, apiKey: e, agentId: t, signal: i }) {
2911
+ async function li({ restUrl: a, apiKey: e, agentId: t, signal: i }) {
2874
2912
  if (!a) throw new Error("Missing restUrl");
2875
- const s = e || t;
2876
- if (!s) throw new Error("Provide one of apiKey or agentId");
2877
- const o = await fetch(`${a}/agent/${s}`, {
2913
+ const o = e || t;
2914
+ if (!o) throw new Error("Provide one of apiKey or agentId");
2915
+ const s = await fetch(`${a}/agent/${o}`, {
2878
2916
  method: "GET",
2879
2917
  mode: "cors",
2880
2918
  credentials: "omit",
@@ -2883,24 +2921,24 @@ async function Zn({ restUrl: a, apiKey: e, agentId: t, signal: i }) {
2883
2921
  },
2884
2922
  signal: i
2885
2923
  });
2886
- if (!o.ok) {
2887
- let r = `HTTP ${o.status}`;
2924
+ if (!s.ok) {
2925
+ let r = `HTTP ${s.status}`;
2888
2926
  try {
2889
- const d = await o.json();
2890
- r = d?.detail || d?.message || r;
2927
+ const l = await s.json();
2928
+ r = l?.detail || l?.message || r;
2891
2929
  } catch {
2892
2930
  }
2893
2931
  throw new Error(r);
2894
2932
  }
2895
- return ge(await o.json());
2933
+ return ve(await s.json());
2896
2934
  }
2897
- function wt(a, e) {
2935
+ function Vt(a, e) {
2898
2936
  if (!e) return a;
2899
2937
  let { useVoice: t, useText: i } = a;
2900
2938
  return typeof e.use_voice == "boolean" && (t = e.use_voice), typeof e.use_text == "boolean" && (i = e.use_text), t === a.useVoice && i === a.useText ? a : { ...a, useVoice: t, useText: i };
2901
2939
  }
2902
- function ve(a) {
2903
- return a.agentType === oe.CLOUD_AVATAR || a.agentType === oe.DESKTOP_AVATAR ? "avatar" : a.useText && a.useVoice ? "text_and_voice" : a.useVoice ? "voice" : "text";
2940
+ function Ee(a) {
2941
+ return a.agentType === de.CLOUD_AVATAR || a.agentType === de.DESKTOP_AVATAR ? "avatar" : a.useText && a.useVoice ? "text_and_voice" : a.useVoice ? "voice" : "text";
2904
2942
  }
2905
2943
  /**
2906
2944
  * @license lucide-react v1.24.0 - ISC
@@ -2908,21 +2946,21 @@ function ve(a) {
2908
2946
  * This source code is licensed under the ISC license.
2909
2947
  * See the LICENSE file in the root directory of this source tree.
2910
2948
  */
2911
- const oa = (...a) => a.filter((e, t, i) => !!e && e.trim() !== "" && i.indexOf(e) === t).join(" ").trim();
2949
+ const ca = (...a) => a.filter((e, t, i) => !!e && e.trim() !== "" && i.indexOf(e) === t).join(" ").trim();
2912
2950
  /**
2913
2951
  * @license lucide-react v1.24.0 - ISC
2914
2952
  *
2915
2953
  * This source code is licensed under the ISC license.
2916
2954
  * See the LICENSE file in the root directory of this source tree.
2917
2955
  */
2918
- const Lt = (a) => a.replace(/([a-z0-9])([A-Z])/g, "$1-$2").toLowerCase();
2956
+ const Nt = (a) => a.replace(/([a-z0-9])([A-Z])/g, "$1-$2").toLowerCase();
2919
2957
  /**
2920
2958
  * @license lucide-react v1.24.0 - ISC
2921
2959
  *
2922
2960
  * This source code is licensed under the ISC license.
2923
2961
  * See the LICENSE file in the root directory of this source tree.
2924
2962
  */
2925
- const At = (a) => a.replace(
2963
+ const jt = (a) => a.replace(
2926
2964
  /^([A-Z])|[\s-_]+(\w)/g,
2927
2965
  (e, t, i) => i ? i.toUpperCase() : t.toLowerCase()
2928
2966
  );
@@ -2932,8 +2970,8 @@ const At = (a) => a.replace(
2932
2970
  * This source code is licensed under the ISC license.
2933
2971
  * See the LICENSE file in the root directory of this source tree.
2934
2972
  */
2935
- const Ze = (a) => {
2936
- const e = At(a);
2973
+ const ea = (a) => {
2974
+ const e = jt(a);
2937
2975
  return e.charAt(0).toUpperCase() + e.slice(1);
2938
2976
  };
2939
2977
  /**
@@ -2942,7 +2980,7 @@ const Ze = (a) => {
2942
2980
  * This source code is licensed under the ISC license.
2943
2981
  * See the LICENSE file in the root directory of this source tree.
2944
2982
  */
2945
- var Me = {
2983
+ var Ce = {
2946
2984
  xmlns: "http://www.w3.org/2000/svg",
2947
2985
  width: 24,
2948
2986
  height: 24,
@@ -2959,36 +2997,36 @@ var Me = {
2959
2997
  * This source code is licensed under the ISC license.
2960
2998
  * See the LICENSE file in the root directory of this source tree.
2961
2999
  */
2962
- const Vt = (a) => {
3000
+ const Dt = (a) => {
2963
3001
  for (const e in a)
2964
3002
  if (e.startsWith("aria-") || e === "role" || e === "title")
2965
3003
  return !0;
2966
3004
  return !1;
2967
- }, jt = Fa({}), Dt = () => ya(jt), It = ia(
2968
- ({ color: a, size: e, strokeWidth: t, absoluteStrokeWidth: i, className: s = "", children: o, iconNode: r, ...c }, d) => {
3005
+ }, Rt = Ma({}), Bt = () => xa(Rt), Gt = la(
3006
+ ({ color: a, size: e, strokeWidth: t, absoluteStrokeWidth: i, className: o = "", children: s, iconNode: r, ...c }, l) => {
2969
3007
  const {
2970
- size: l = 24,
3008
+ size: d = 24,
2971
3009
  strokeWidth: m = 2,
2972
3010
  absoluteStrokeWidth: u = !1,
2973
3011
  color: h = "currentColor",
2974
- className: z = ""
2975
- } = Dt() ?? {}, b = i ?? u ? Number(t ?? m) * 24 / Number(e ?? l) : t ?? m;
2976
- return Pe(
3012
+ className: F = ""
3013
+ } = Bt() ?? {}, b = i ?? u ? Number(t ?? m) * 24 / Number(e ?? d) : t ?? m;
3014
+ return Le(
2977
3015
  "svg",
2978
3016
  {
2979
- ref: d,
2980
- ...Me,
2981
- width: e ?? l ?? Me.width,
2982
- height: e ?? l ?? Me.height,
3017
+ ref: l,
3018
+ ...Ce,
3019
+ width: e ?? d ?? Ce.width,
3020
+ height: e ?? d ?? Ce.height,
2983
3021
  stroke: a ?? h,
2984
3022
  strokeWidth: b,
2985
- className: oa("lucide", z, s),
2986
- ...!o && !Vt(c) && { "aria-hidden": "true" },
3023
+ className: ca("lucide", F, o),
3024
+ ...!s && !Dt(c) && { "aria-hidden": "true" },
2987
3025
  ...c
2988
3026
  },
2989
3027
  [
2990
- ...r.map(([x, v]) => Pe(x, v)),
2991
- ...Array.isArray(o) ? o : [o]
3028
+ ...r.map(([M, S]) => Le(M, S)),
3029
+ ...Array.isArray(s) ? s : [s]
2992
3030
  ]
2993
3031
  );
2994
3032
  }
@@ -2999,20 +3037,20 @@ const Vt = (a) => {
2999
3037
  * This source code is licensed under the ISC license.
3000
3038
  * See the LICENSE file in the root directory of this source tree.
3001
3039
  */
3002
- const Y = (a, e) => {
3003
- const t = ia(
3004
- ({ className: i, ...s }, o) => Pe(It, {
3005
- ref: o,
3040
+ const H = (a, e) => {
3041
+ const t = la(
3042
+ ({ className: i, ...o }, s) => Le(Gt, {
3043
+ ref: s,
3006
3044
  iconNode: e,
3007
- className: oa(
3008
- `lucide-${Lt(Ze(a))}`,
3045
+ className: ca(
3046
+ `lucide-${Nt(ea(a))}`,
3009
3047
  `lucide-${a}`,
3010
3048
  i
3011
3049
  ),
3012
- ...s
3050
+ ...o
3013
3051
  })
3014
3052
  );
3015
- return t.displayName = Ze(a), t;
3053
+ return t.displayName = ea(a), t;
3016
3054
  };
3017
3055
  /**
3018
3056
  * @license lucide-react v1.24.0 - ISC
@@ -3020,94 +3058,94 @@ const Y = (a, e) => {
3020
3058
  * This source code is licensed under the ISC license.
3021
3059
  * See the LICENSE file in the root directory of this source tree.
3022
3060
  */
3023
- const qt = [
3061
+ const Ut = [
3024
3062
  ["path", { d: "m5 12 7-7 7 7", key: "hav0vg" }],
3025
3063
  ["path", { d: "M12 19V5", key: "x0mq9r" }]
3026
- ], Nt = Y("arrow-up", qt);
3064
+ ], Kt = H("arrow-up", Ut);
3027
3065
  /**
3028
3066
  * @license lucide-react v1.24.0 - ISC
3029
3067
  *
3030
3068
  * This source code is licensed under the ISC license.
3031
3069
  * See the LICENSE file in the root directory of this source tree.
3032
3070
  */
3033
- const _t = [["path", { d: "m15 18-6-6 6-6", key: "1wnfg3" }]], Rt = Y("chevron-left", _t);
3071
+ const Ot = [["path", { d: "m15 18-6-6 6-6", key: "1wnfg3" }]], Yt = H("chevron-left", Ot);
3034
3072
  /**
3035
3073
  * @license lucide-react v1.24.0 - ISC
3036
3074
  *
3037
3075
  * This source code is licensed under the ISC license.
3038
3076
  * See the LICENSE file in the root directory of this source tree.
3039
3077
  */
3040
- const Bt = [["path", { d: "m6 9 6 6 6-6", key: "qrunsl" }]], sa = Y("chevron-down", Bt);
3078
+ const Qt = [["path", { d: "m6 9 6 6 6-6", key: "qrunsl" }]], da = H("chevron-down", Qt);
3041
3079
  /**
3042
3080
  * @license lucide-react v1.24.0 - ISC
3043
3081
  *
3044
3082
  * This source code is licensed under the ISC license.
3045
3083
  * See the LICENSE file in the root directory of this source tree.
3046
3084
  */
3047
- const Gt = [["path", { d: "m18 15-6-6-6 6", key: "153udz" }]], Ut = Y("chevron-up", Gt);
3085
+ const Ht = [["path", { d: "m18 15-6-6-6 6", key: "153udz" }]], Wt = H("chevron-up", Ht);
3048
3086
  /**
3049
3087
  * @license lucide-react v1.24.0 - ISC
3050
3088
  *
3051
3089
  * This source code is licensed under the ISC license.
3052
3090
  * See the LICENSE file in the root directory of this source tree.
3053
3091
  */
3054
- const Kt = [["path", { d: "M21 12a9 9 0 1 1-6.219-8.56", key: "13zald" }]], ye = Y("loader-circle", Kt);
3092
+ const $t = [["path", { d: "M21 12a9 9 0 1 1-6.219-8.56", key: "13zald" }]], ze = H("loader-circle", $t);
3055
3093
  /**
3056
3094
  * @license lucide-react v1.24.0 - ISC
3057
3095
  *
3058
3096
  * This source code is licensed under the ISC license.
3059
3097
  * See the LICENSE file in the root directory of this source tree.
3060
3098
  */
3061
- const Ot = [
3099
+ const Zt = [
3062
3100
  ["path", { d: "M15 3h6v6", key: "1q9fwt" }],
3063
3101
  ["path", { d: "m21 3-7 7", key: "1l2asr" }],
3064
3102
  ["path", { d: "m3 21 7-7", key: "tjx5ai" }],
3065
3103
  ["path", { d: "M9 21H3v-6", key: "wtvkvv" }]
3066
- ], Yt = Y("maximize-2", Ot);
3104
+ ], Jt = H("maximize-2", Zt);
3067
3105
  /**
3068
3106
  * @license lucide-react v1.24.0 - ISC
3069
3107
  *
3070
3108
  * This source code is licensed under the ISC license.
3071
3109
  * See the LICENSE file in the root directory of this source tree.
3072
3110
  */
3073
- const Qt = [
3111
+ const Xt = [
3074
3112
  ["path", { d: "M12 19v3", key: "npa21l" }],
3075
3113
  ["path", { d: "M15 9.34V5a3 3 0 0 0-5.68-1.33", key: "1gzdoj" }],
3076
3114
  ["path", { d: "M16.95 16.95A7 7 0 0 1 5 12v-2", key: "cqa7eg" }],
3077
3115
  ["path", { d: "M18.89 13.23A7 7 0 0 0 19 12v-2", key: "16hl24" }],
3078
3116
  ["path", { d: "m2 2 20 20", key: "1ooewy" }],
3079
3117
  ["path", { d: "M9 9v3a3 3 0 0 0 5.12 2.12", key: "r2i35w" }]
3080
- ], je = Y("mic-off", Qt);
3118
+ ], Ve = H("mic-off", Xt);
3081
3119
  /**
3082
3120
  * @license lucide-react v1.24.0 - ISC
3083
3121
  *
3084
3122
  * This source code is licensed under the ISC license.
3085
3123
  * See the LICENSE file in the root directory of this source tree.
3086
3124
  */
3087
- const Ht = [
3125
+ const en = [
3088
3126
  ["path", { d: "M12 19v3", key: "npa21l" }],
3089
3127
  ["path", { d: "M19 10v2a7 7 0 0 1-14 0v-2", key: "1vc78b" }],
3090
3128
  ["rect", { x: "9", y: "2", width: "6", height: "13", rx: "3", key: "s6n7sd" }]
3091
- ], Fe = Y("mic", Ht);
3129
+ ], Se = H("mic", en);
3092
3130
  /**
3093
3131
  * @license lucide-react v1.24.0 - ISC
3094
3132
  *
3095
3133
  * This source code is licensed under the ISC license.
3096
3134
  * See the LICENSE file in the root directory of this source tree.
3097
3135
  */
3098
- const Wt = [
3136
+ const an = [
3099
3137
  ["path", { d: "m14 10 7-7", key: "oa77jy" }],
3100
3138
  ["path", { d: "M20 10h-6V4", key: "mjg0md" }],
3101
3139
  ["path", { d: "m3 21 7-7", key: "tjx5ai" }],
3102
3140
  ["path", { d: "M4 14h6v6", key: "rmj7iw" }]
3103
- ], Ee = Y("minimize-2", Wt);
3141
+ ], xe = H("minimize-2", an);
3104
3142
  /**
3105
3143
  * @license lucide-react v1.24.0 - ISC
3106
3144
  *
3107
3145
  * This source code is licensed under the ISC license.
3108
3146
  * See the LICENSE file in the root directory of this source tree.
3109
3147
  */
3110
- const $t = [
3148
+ const tn = [
3111
3149
  [
3112
3150
  "path",
3113
3151
  {
@@ -3123,14 +3161,14 @@ const $t = [
3123
3161
  key: "10hv5p"
3124
3162
  }
3125
3163
  ]
3126
- ], De = Y("phone-off", $t);
3164
+ ], Ne = H("phone-off", tn);
3127
3165
  /**
3128
3166
  * @license lucide-react v1.24.0 - ISC
3129
3167
  *
3130
3168
  * This source code is licensed under the ISC license.
3131
3169
  * See the LICENSE file in the root directory of this source tree.
3132
3170
  */
3133
- const Zt = [
3171
+ const nn = [
3134
3172
  [
3135
3173
  "path",
3136
3174
  {
@@ -3138,24 +3176,24 @@ const Zt = [
3138
3176
  key: "9njp5v"
3139
3177
  }
3140
3178
  ]
3141
- ], Ie = Y("phone", Zt);
3179
+ ], je = H("phone", nn);
3142
3180
  /**
3143
3181
  * @license lucide-react v1.24.0 - ISC
3144
3182
  *
3145
3183
  * This source code is licensed under the ISC license.
3146
3184
  * See the LICENSE file in the root directory of this source tree.
3147
3185
  */
3148
- const Jt = [
3186
+ const on = [
3149
3187
  ["path", { d: "M3 12a9 9 0 1 0 9-9 9.75 9.75 0 0 0-6.74 2.74L3 8", key: "1357e3" }],
3150
3188
  ["path", { d: "M3 3v5h5", key: "1xhq8a" }]
3151
- ], Xt = Y("rotate-ccw", Jt);
3189
+ ], sn = H("rotate-ccw", on);
3152
3190
  /**
3153
3191
  * @license lucide-react v1.24.0 - ISC
3154
3192
  *
3155
3193
  * This source code is licensed under the ISC license.
3156
3194
  * See the LICENSE file in the root directory of this source tree.
3157
3195
  */
3158
- const en = [
3196
+ const rn = [
3159
3197
  [
3160
3198
  "path",
3161
3199
  {
@@ -3163,46 +3201,81 @@ const en = [
3163
3201
  key: "r04s7s"
3164
3202
  }
3165
3203
  ]
3166
- ], an = Y("star", en);
3204
+ ], ln = H("star", rn);
3167
3205
  /**
3168
3206
  * @license lucide-react v1.24.0 - ISC
3169
3207
  *
3170
3208
  * This source code is licensed under the ISC license.
3171
3209
  * See the LICENSE file in the root directory of this source tree.
3172
3210
  */
3173
- const tn = [
3211
+ const cn = [
3174
3212
  ["path", { d: "M18 6 6 18", key: "1bl5f8" }],
3175
3213
  ["path", { d: "m6 6 12 12", key: "d8bk6v" }]
3176
- ], qe = Y("x", tn), ie = () => {
3177
- }, nn = 767;
3178
- function we() {
3179
- return typeof window < "u" && window.innerWidth <= nn;
3214
+ ], De = H("x", cn), oe = () => {
3215
+ }, dn = 767;
3216
+ function _e() {
3217
+ return typeof window < "u" && window.innerWidth <= dn;
3180
3218
  }
3181
3219
  function V(...a) {
3182
3220
  return a.filter(Boolean).join(" ");
3183
3221
  }
3184
- function H(a) {
3185
- return a.startsWith("ar") || ["fa", "ur", "he"].includes(a) ? "rqmii-chat-font-ar" : "rqmii-chat-font-latin";
3222
+ function un(a) {
3223
+ const e = (a || "").trim().toLowerCase().replace(/[-_]/g, " ");
3224
+ return e === "readex pro" || e === "readex" ? "'Readex Pro', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif" : e === "noto sans" || e === "noto" || e === "noto sans arabic" ? "'Noto Sans', 'Noto Sans Arabic', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif" : "'Cairo', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif";
3186
3225
  }
3187
- function Je(a) {
3188
- return a.startsWith("ar") ? "rqmii-chat-font-ar" : "rqmii-chat-font-latin";
3226
+ function aa(a) {
3227
+ if (!a) return "#ffffff";
3228
+ const e = a.replace("#", "").trim();
3229
+ let t = e;
3230
+ if (e.length === 3 && (t = e.split("").map((c) => c + c).join("")), t.length < 6) return "#ffffff";
3231
+ const i = parseInt(t.substring(0, 2), 16), o = parseInt(t.substring(2, 4), 16), s = parseInt(t.substring(4, 6), 16);
3232
+ return Number.isNaN(i) || Number.isNaN(o) || Number.isNaN(s) ? "#ffffff" : (i * 299 + o * 587 + s * 114) / 1e3 >= 128 ? "#000000" : "#ffffff";
3233
+ }
3234
+ function Re(a) {
3235
+ const e = {
3236
+ "--rqmii-font-family": un(a?.font)
3237
+ }, t = a?.theme?.accent_color?.trim();
3238
+ if (t) {
3239
+ const o = aa(t);
3240
+ e["--rqmii-accent"] = t, e["--rqmii-accent-text"] = o, e["--rqmii-message-user"] = t, e["--rqmii-message-user-text"] = o;
3241
+ }
3242
+ const i = a?.theme?.end_call_button_color?.trim();
3243
+ if (i) {
3244
+ const o = aa(i);
3245
+ e["--rqmii-end-call-bg"] = i, e["--rqmii-end-call-text"] = o;
3246
+ }
3247
+ return e;
3248
+ }
3249
+ function mn(a) {
3250
+ const e = (a || "").trim().toLowerCase().replace(/[-_]/g, " ");
3251
+ return e === "readex pro" || e === "readex" ? "https://fonts.googleapis.com/css2?family=Readex+Pro:wght@400;500;600;700&display=swap" : e === "noto sans" || e === "noto" || e === "noto sans arabic" ? "https://fonts.googleapis.com/css2?family=Noto+Sans:wght@400;500;600;700&family=Noto+Sans+Arabic:wght@400;500;600;700&display=swap" : "https://fonts.googleapis.com/css2?family=Cairo:wght@400;500;600;700&display=swap";
3252
+ }
3253
+ function ua(a) {
3254
+ if (typeof document > "u") return;
3255
+ const e = mn(a);
3256
+ if (document.querySelector(`link[data-rqmii-font="${e}"]`)) return;
3257
+ const i = document.createElement("link");
3258
+ i.rel = "stylesheet", i.href = e, i.setAttribute("data-rqmii-font", e), document.head.appendChild(i);
3259
+ }
3260
+ function Z(a) {
3261
+ return "";
3189
3262
  }
3190
3263
  function re(a) {
3191
3264
  return a.startsWith("ar") || ["fa", "ur", "he"].includes(a) ? "rtl" : "ltr";
3192
3265
  }
3193
- function Ne(a) {
3266
+ function Be(a) {
3194
3267
  const e = Math.floor(a / 60).toString().padStart(2, "0"), t = (a % 60).toString().padStart(2, "0");
3195
3268
  return `${e}:${t}`;
3196
3269
  }
3197
- function on(a = !0) {
3270
+ function hn(a = !0) {
3198
3271
  const [e, t] = y(0);
3199
3272
  return I(() => {
3200
3273
  if (!a) return;
3201
- const i = setInterval(() => t((s) => s + 1), 1e3);
3274
+ const i = setInterval(() => t((o) => o + 1), 1e3);
3202
3275
  return () => clearInterval(i);
3203
3276
  }, [a]), e;
3204
3277
  }
3205
- function sn() {
3278
+ function gn() {
3206
3279
  const [a, e] = y(null);
3207
3280
  return I(() => {
3208
3281
  const t = window.visualViewport;
@@ -3213,66 +3286,66 @@ function sn() {
3213
3286
  };
3214
3287
  }, []), a;
3215
3288
  }
3216
- function rn(a, e) {
3217
- const t = _([]);
3289
+ function pn(a, e) {
3290
+ const t = B([]);
3218
3291
  t.current = a.match(/\S+\s*/g) || [a];
3219
- const [i, s] = y(
3292
+ const [i, o] = y(
3220
3293
  () => e ? Math.min(1, t.current.length) : t.current.length
3221
3294
  );
3222
3295
  return I(() => {
3223
3296
  if (!e || !a) {
3224
- s(t.current.length);
3297
+ o(t.current.length);
3225
3298
  return;
3226
3299
  }
3227
- if (s((r) => Math.max(1, r)), t.current.length <= 1) return;
3228
- const o = setInterval(() => {
3229
- s((r) => r >= t.current.length ? (clearInterval(o), r) : r + 1);
3300
+ if (o((r) => Math.max(1, r)), t.current.length <= 1) return;
3301
+ const s = setInterval(() => {
3302
+ o((r) => r >= t.current.length ? (clearInterval(s), r) : r + 1);
3230
3303
  }, 50);
3231
- return () => clearInterval(o);
3304
+ return () => clearInterval(s);
3232
3305
  }, [a, e]), t.current.slice(0, i).join("");
3233
3306
  }
3234
- const ln = j.lazy(() => import("./Orb-BLYExpBk.js").then((a) => ({ default: a.RqmiiOrb }))), _e = j.memo(function({ language: e, languages: t, onChange: i }) {
3235
- const [s, o] = y(!1), r = _(null), c = We(e), d = pe(t, e).map((l) => We(l)).filter(Boolean);
3307
+ const bn = A.lazy(() => import("./Orb-BLYExpBk.js").then((a) => ({ default: a.RqmiiOrb }))), Ge = A.memo(function({ language: e, languages: t, onChange: i }) {
3308
+ const [o, s] = y(!1), r = B(null), c = Je(e), l = ye(t, e).map((d) => Je(d)).filter(Boolean);
3236
3309
  return I(() => {
3237
- if (!s) return;
3238
- const l = (m) => {
3239
- r.current?.contains(m.target) || o(!1);
3310
+ if (!o) return;
3311
+ const d = (m) => {
3312
+ r.current?.contains(m.target) || s(!1);
3240
3313
  };
3241
- return document.addEventListener("mousedown", l), () => document.removeEventListener("mousedown", l);
3242
- }, [s]), /* @__PURE__ */ f("div", { className: "rqmii-chat-language", ref: r, children: [
3243
- /* @__PURE__ */ f("button", { type: "button", className: V("rqmii-chat-pill", Je(e)), onClick: () => o((l) => !l), children: [
3314
+ return document.addEventListener("mousedown", d), () => document.removeEventListener("mousedown", d);
3315
+ }, [o]), /* @__PURE__ */ v("div", { className: "rqmii-chat-language", ref: r, children: [
3316
+ /* @__PURE__ */ v("button", { type: "button", className: "rqmii-chat-pill", onClick: () => s((d) => !d), children: [
3244
3317
  /* @__PURE__ */ n("span", { children: c?.label || e }),
3245
- /* @__PURE__ */ n(sa, { size: 16 })
3318
+ /* @__PURE__ */ n(da, { size: 16 })
3246
3319
  ] }),
3247
- s && d.length > 1 && /* @__PURE__ */ n("div", { className: "rqmii-chat-language-menu", children: d.map((l) => /* @__PURE__ */ n(
3320
+ o && l.length > 1 && /* @__PURE__ */ n("div", { className: "rqmii-chat-language-menu", children: l.map((d) => /* @__PURE__ */ n(
3248
3321
  "button",
3249
3322
  {
3250
3323
  type: "button",
3251
- className: V("rqmii-chat-language-item", Je(l.value), l.value === e && "is-selected"),
3324
+ className: V("rqmii-chat-language-item", d.value === e && "is-selected"),
3252
3325
  onClick: () => {
3253
- i(l.value), o(!1);
3326
+ i(d.value), s(!1);
3254
3327
  },
3255
- children: l.label
3328
+ children: d.label
3256
3329
  },
3257
- l.value
3330
+ d.value
3258
3331
  )) })
3259
3332
  ] });
3260
- }), le = j.memo(function({ language: e = "en", brand: t = "rqmii", agent: i }) {
3261
- const s = i?.widget?.appearance, o = s?.show_branding !== !1, r = s?.footer_content?.[e], c = !!r?.trim();
3262
- return !o && !c ? /* @__PURE__ */ n("div", { style: { padding: 11 } }) : /* @__PURE__ */ f("div", { className: "rqmii-chat-footer", children: [
3263
- o && /* @__PURE__ */ f("p", { children: [
3333
+ }), ue = A.memo(function({ language: e = "en", brand: t = "rqmii", agent: i }) {
3334
+ const o = i?.widget?.appearance, s = o?.show_branding !== !1, r = o?.footer_content?.[e], c = !!r?.trim();
3335
+ return !s && !c ? /* @__PURE__ */ n("div", { style: { padding: 11 } }) : /* @__PURE__ */ v("div", { className: "rqmii-chat-footer", children: [
3336
+ s && /* @__PURE__ */ v("p", { children: [
3264
3337
  "Powered by ",
3265
3338
  /* @__PURE__ */ n("strong", { children: t })
3266
3339
  ] }),
3267
3340
  c && /* @__PURE__ */ n("p", { children: r })
3268
3341
  ] });
3269
- }), J = j.memo(function({
3342
+ }), te = A.memo(function({
3270
3343
  agent: e,
3271
3344
  size: t = "large",
3272
3345
  active: i = !1,
3273
- className: s = ""
3346
+ className: o = ""
3274
3347
  }) {
3275
- const o = e?.faceImage, r = !o || o === "orb";
3348
+ const s = e?.faceImage, r = !s || s === "orb";
3276
3349
  return /* @__PURE__ */ n(
3277
3350
  "div",
3278
3351
  {
@@ -3281,860 +3354,1015 @@ const ln = j.lazy(() => import("./Orb-BLYExpBk.js").then((a) => ({ default: a.Rq
3281
3354
  `rqmii-agent-avatar--${t}`,
3282
3355
  i && "is-active",
3283
3356
  r && "is-orb",
3284
- s
3357
+ o
3285
3358
  ),
3286
- children: r ? /* @__PURE__ */ n(j.Suspense, { fallback: null, children: /* @__PURE__ */ n(ln, { className: "rqmii-agent-avatar-orb" }) }) : /* @__PURE__ */ n(
3359
+ children: r ? /* @__PURE__ */ n(A.Suspense, { fallback: null, children: /* @__PURE__ */ n(bn, { className: "rqmii-agent-avatar-orb" }) }) : /* @__PURE__ */ n(
3287
3360
  "img",
3288
3361
  {
3289
- src: o,
3362
+ src: s,
3290
3363
  alt: e?.name || "Agent"
3291
3364
  }
3292
3365
  )
3293
3366
  }
3294
3367
  );
3295
- }), ra = j.memo(function({ agent: e, onClick: t, className: i = "", position: s = "fixed", active: o = !1 }) {
3296
- return /* @__PURE__ */ n("button", { type: "button", className: V("rqmii-chat-open-button", s === "fixed" && "is-fixed", i), onClick: t, "aria-label": "Open chat", children: /* @__PURE__ */ n(J, { agent: e, size: "button", active: o }) });
3368
+ }), ma = A.memo(function({ agent: e, onClick: t, className: i = "", position: o = "fixed", active: s = !1 }) {
3369
+ return /* @__PURE__ */ n("button", { type: "button", className: V("rqmii-chat-open-button", o === "fixed" && "is-fixed", i), onClick: t, "aria-label": "Open chat", children: /* @__PURE__ */ n(te, { agent: e, size: "button", active: s }) });
3297
3370
  });
3298
- function cn() {
3371
+ function fn() {
3299
3372
  try {
3300
3373
  const a = window.AudioContext || window.webkitAudioContext;
3301
3374
  if (!a) return;
3302
- const e = new a(), t = e.currentTime, i = e.createOscillator(), s = e.createGain();
3303
- i.type = "sine", i.frequency.setValueAtTime(880, t), i.frequency.setValueAtTime(1180, t + 0.12), s.gain.setValueAtTime(1e-4, t), s.gain.exponentialRampToValueAtTime(0.18, t + 0.02), s.gain.exponentialRampToValueAtTime(1e-4, t + 0.32), i.connect(s), s.connect(e.destination), i.start(t), i.stop(t + 0.34), i.onended = () => {
3375
+ const e = new a(), t = e.currentTime, i = e.createOscillator(), o = e.createGain();
3376
+ i.type = "sine", i.frequency.setValueAtTime(880, t), i.frequency.setValueAtTime(1180, t + 0.12), o.gain.setValueAtTime(1e-4, t), o.gain.exponentialRampToValueAtTime(0.18, t + 0.02), o.gain.exponentialRampToValueAtTime(1e-4, t + 0.32), i.connect(o), o.connect(e.destination), i.start(t), i.stop(t + 0.34), i.onended = () => {
3304
3377
  e.close();
3305
3378
  };
3306
3379
  } catch {
3307
3380
  }
3308
3381
  }
3309
- const dn = j.memo(function({ message: e, delaySeconds: t, soundEnabled: i, language: s, buttonPosition: o = "right", onClick: r }) {
3310
- const [c, d] = y(!1), l = e.trim();
3382
+ const kn = A.memo(function({ message: e, delaySeconds: t, soundEnabled: i, language: o, buttonPosition: s = "right", onClick: r }) {
3383
+ const [c, l] = y(!1), d = e.trim();
3311
3384
  return I(() => {
3312
- if (!l) return;
3385
+ if (!d) return;
3313
3386
  const u = setTimeout(() => {
3314
- d(!0), i && cn();
3387
+ l(!0), i && fn();
3315
3388
  }, Math.max(0, t) * 1e3);
3316
3389
  return () => clearTimeout(u);
3317
- }, [l, t, i]), !c || !l ? null : /* @__PURE__ */ n(
3390
+ }, [d, t, i]), !c || !d ? null : /* @__PURE__ */ n(
3318
3391
  "button",
3319
3392
  {
3320
3393
  type: "button",
3321
- className: V("rqmii-chat-welcome-bubble", o === "right" ? "is-right" : "is-left", H(s)),
3322
- dir: re(s),
3394
+ className: V("rqmii-chat-welcome-bubble", s === "right" ? "is-right" : "is-left", Z()),
3395
+ dir: re(o),
3323
3396
  onClick: r,
3324
- "aria-label": l,
3325
- children: l
3397
+ "aria-label": d,
3398
+ children: d
3326
3399
  }
3327
3400
  );
3328
- }), Te = j.memo(function({ language: e, placeholder: t, onSend: i, disabled: s = !1, variant: o = "text" }) {
3329
- const [r, c] = y(""), d = _(null), l = 168, m = () => {
3401
+ }), Me = A.memo(function({ language: e, placeholder: t, onSend: i, disabled: o = !1, variant: s = "text" }) {
3402
+ const [r, c] = y(""), l = B(null), d = 168, m = () => {
3330
3403
  const u = r.trim();
3331
- !u || s || (i(u), c(""), d.current && (d.current.style.height = "auto"));
3404
+ !u || o || (i(u), c(""), l.current && (l.current.style.height = "auto"));
3332
3405
  };
3333
- return /* @__PURE__ */ f("div", { className: V("rqmii-chat-input", H(e), o === "voice" && "is-voice"), children: [
3406
+ return /* @__PURE__ */ v("div", { className: V("rqmii-chat-input", Z(), s === "voice" && "is-voice"), children: [
3334
3407
  /* @__PURE__ */ n(
3335
3408
  "textarea",
3336
3409
  {
3337
- ref: d,
3410
+ ref: l,
3338
3411
  value: r,
3339
- disabled: s,
3340
- rows: o === "compact" ? 2 : 3,
3412
+ disabled: o,
3413
+ rows: s === "compact" ? 2 : 3,
3341
3414
  dir: re(e),
3342
- placeholder: t || F(e, "sendMessage"),
3415
+ placeholder: t || z(e, "sendMessage"),
3343
3416
  onChange: (u) => {
3344
3417
  c(u.target.value);
3345
- const h = d.current;
3346
- h && (h.style.height = "auto", h.style.height = `${Math.min(h.scrollHeight, l)}px`);
3418
+ const h = l.current;
3419
+ h && (h.style.height = "auto", h.style.height = `${Math.min(h.scrollHeight, d)}px`);
3347
3420
  },
3348
3421
  onKeyDown: (u) => {
3349
3422
  u.key === "Enter" && !u.shiftKey && (u.preventDefault(), m());
3350
3423
  }
3351
3424
  }
3352
3425
  ),
3353
- /* @__PURE__ */ n("button", { type: "button", onClick: m, disabled: !r.trim() || s, "aria-label": F(e, "send"), children: /* @__PURE__ */ n(Nt, { size: 20 }) })
3426
+ /* @__PURE__ */ n("button", { type: "button", onClick: m, disabled: !r.trim() || o, "aria-label": z(e, "send"), children: /* @__PURE__ */ n(Kt, { size: 20 }) })
3354
3427
  ] });
3355
- }), un = j.memo(function({ text: e, streaming: t }) {
3356
- const i = rn(e, t);
3357
- return /* @__PURE__ */ n(Ve, { children: i });
3358
- }), Le = 133, mn = Le + 44, hn = 767, he = 36, gn = 8, Xe = he + gn;
3359
- function pn() {
3360
- return typeof window > "u" ? Le : window.innerWidth <= hn ? mn : Le;
3428
+ }), vn = A.memo(function({ text: e, streaming: t }) {
3429
+ const i = pn(e, t);
3430
+ return /* @__PURE__ */ n(Te, { children: i });
3431
+ }), qe = 133, yn = qe + 44, Fn = 767, ke = 36, Tn = 8, ta = ke + Tn;
3432
+ function En() {
3433
+ return typeof window > "u" ? qe : window.innerWidth <= Fn ? yn : qe;
3361
3434
  }
3362
- function bn(a) {
3435
+ function zn(a) {
3363
3436
  return a === "rtl" ? "right" : "left";
3364
3437
  }
3365
- function kn(a, e, t, i) {
3438
+ function Sn(a, e, t, i) {
3366
3439
  if (!a.length) return null;
3367
- const s = Math.max(...a.map((r) => r.offsetTop)), o = a.filter((r) => r.offsetTop >= s - 0.5);
3368
- return t === "right" ? o.find((r) => r.offsetLeft + r.offsetWidth > e - i) || null : o.find((r) => r.offsetLeft < i) || null;
3440
+ const o = Math.max(...a.map((r) => r.offsetTop)), s = a.filter((r) => r.offsetTop >= o - 0.5);
3441
+ return t === "right" ? s.find((r) => r.offsetLeft + r.offsetWidth > e - i) || null : s.find((r) => r.offsetLeft < i) || null;
3369
3442
  }
3370
- function ea(a, e, t, i) {
3371
- for (let s = 0; s < 2; s++) {
3372
- const o = kn(a, e, t, i);
3373
- if (!o) break;
3374
- t === "right" ? o.style.marginRight = `${i}px` : o.style.marginLeft = `${i}px`, o.style.maxWidth = `calc(100% - ${i}px)`;
3443
+ function na(a, e, t, i) {
3444
+ for (let o = 0; o < 2; o++) {
3445
+ const s = Sn(a, e, t, i);
3446
+ if (!s) break;
3447
+ t === "right" ? s.style.marginRight = `${i}px` : s.style.marginLeft = `${i}px`, s.style.maxWidth = `calc(100% - ${i}px)`;
3375
3448
  }
3376
3449
  }
3377
- const fn = j.memo(function({ suggestions: e, language: t, onClick: i }) {
3378
- const [s, o] = y(!1), [r, c] = y(!1), [d, l] = y(null), [m, u] = y(null), h = _(null), z = _([]), b = re(t || "en"), x = bn(b), v = (E) => {
3379
- E.forEach((g) => {
3380
- g && (g.style.maxWidth = "", g.style.marginRight = "", g.style.marginLeft = "");
3450
+ const xn = A.memo(function({ suggestions: e, language: t, onClick: i }) {
3451
+ const [o, s] = y(!1), [r, c] = y(!1), [l, d] = y(null), [m, u] = y(null), h = B(null), F = B([]), b = re(t || "en"), M = zn(b), S = (T) => {
3452
+ T.forEach((k) => {
3453
+ k && (k.style.maxWidth = "", k.style.marginRight = "", k.style.marginLeft = "");
3381
3454
  });
3382
3455
  };
3383
- return Ye(() => {
3384
- const E = h.current;
3385
- if (!E || s) return;
3386
- const g = () => {
3387
- const p = z.current;
3388
- v(p);
3389
- const S = E.clientWidth, T = pn(), M = () => {
3390
- for (let L = 0; L < p.length; L++) {
3391
- const A = p[L];
3392
- if (A && A.offsetTop + A.offsetHeight > T + 0.5)
3393
- return L;
3456
+ return We(() => {
3457
+ const T = h.current;
3458
+ if (!T || o) return;
3459
+ const k = () => {
3460
+ const g = F.current;
3461
+ S(g);
3462
+ const w = T.clientWidth, E = En(), f = () => {
3463
+ for (let C = 0; C < g.length; C++) {
3464
+ const _ = g[C];
3465
+ if (_ && _.offsetTop + _.offsetHeight > E + 0.5)
3466
+ return C;
3394
3467
  }
3395
3468
  return null;
3396
3469
  };
3397
- let P = M();
3470
+ let P = f();
3398
3471
  if (P !== null)
3399
- for (let L = 0; L <= p.length; L++) {
3400
- v(p);
3401
- const A = p.slice(0, P).filter((D) => !!D);
3402
- ea(A, S, x, Xe);
3403
- const C = M();
3404
- if (C === null || C >= P) break;
3405
- P = C;
3472
+ for (let C = 0; C <= g.length; C++) {
3473
+ S(g);
3474
+ const _ = g.slice(0, P).filter((j) => !!j);
3475
+ na(_, w, M, ta);
3476
+ const x = f();
3477
+ if (x === null || x >= P) break;
3478
+ P = x;
3406
3479
  }
3407
- if (l(P), c(P !== null), P !== null) {
3408
- const L = p.slice(0, P).filter((C) => !!C), A = L.length ? Math.max(...L.map((C) => C.offsetTop + C.offsetHeight)) : he;
3409
- u(A - he);
3480
+ if (d(P), c(P !== null), P !== null) {
3481
+ const C = g.slice(0, P).filter((x) => !!x), _ = C.length ? Math.max(...C.map((x) => x.offsetTop + x.offsetHeight)) : ke;
3482
+ u(_ - ke);
3410
3483
  } else
3411
3484
  u(null);
3412
3485
  };
3413
- g();
3414
- const k = typeof ResizeObserver < "u" ? new ResizeObserver(g) : null;
3415
- return k?.observe(E), () => {
3416
- k?.disconnect(), v(z.current);
3486
+ k();
3487
+ const p = typeof ResizeObserver < "u" ? new ResizeObserver(k) : null;
3488
+ return p?.observe(T), () => {
3489
+ p?.disconnect(), S(F.current);
3417
3490
  };
3418
- }, [e, s, x]), Ye(() => {
3419
- const E = h.current;
3420
- if (!E || !s) return;
3421
- const g = z.current.filter((p) => !!p);
3422
- v(z.current), ea(g, E.clientWidth, x, Xe);
3423
- const k = g.length ? Math.max(...g.map((p) => p.offsetTop + p.offsetHeight)) : he;
3424
- return u(k - he), () => {
3425
- v(z.current);
3491
+ }, [e, o, M]), We(() => {
3492
+ const T = h.current;
3493
+ if (!T || !o) return;
3494
+ const k = F.current.filter((g) => !!g);
3495
+ S(F.current), na(k, T.clientWidth, M, ta);
3496
+ const p = k.length ? Math.max(...k.map((g) => g.offsetTop + g.offsetHeight)) : ke;
3497
+ return u(p - ke), () => {
3498
+ S(F.current);
3426
3499
  };
3427
- }, [s, e, x]), e.length ? /* @__PURE__ */ n("div", { className: V("rqmii-suggested-messages", s && "is-expanded", r && "has-overflow"), dir: b, children: /* @__PURE__ */ f("div", { ref: h, className: V("rqmii-suggested-messages-inner", s ? "is-expanded" : "is-collapsed"), children: [
3428
- e.map((E, g) => {
3429
- const k = !s && d !== null && g >= d;
3500
+ }, [o, e, M]), e.length ? /* @__PURE__ */ n("div", { className: V("rqmii-suggested-messages", o && "is-expanded", r && "has-overflow"), dir: b, children: /* @__PURE__ */ v("div", { ref: h, className: V("rqmii-suggested-messages-inner", o ? "is-expanded" : "is-collapsed"), children: [
3501
+ e.map((T, k) => {
3502
+ const p = !o && l !== null && k >= l;
3430
3503
  return /* @__PURE__ */ n(
3431
3504
  "button",
3432
3505
  {
3433
- ref: (p) => {
3434
- z.current[g] = p;
3506
+ ref: (g) => {
3507
+ F.current[k] = g;
3435
3508
  },
3436
3509
  type: "button",
3437
3510
  className: "rqmii-suggested-message",
3438
- onClick: () => i(E),
3439
- style: k ? { visibility: "hidden" } : void 0,
3440
- "aria-hidden": k || void 0,
3441
- tabIndex: k ? -1 : void 0,
3442
- children: E
3511
+ onClick: () => i(T),
3512
+ style: p ? { visibility: "hidden" } : void 0,
3513
+ "aria-hidden": p || void 0,
3514
+ tabIndex: p ? -1 : void 0,
3515
+ children: T
3443
3516
  },
3444
- g
3517
+ k
3445
3518
  );
3446
3519
  }),
3447
3520
  r && /* @__PURE__ */ n(
3448
3521
  "button",
3449
3522
  {
3450
3523
  type: "button",
3451
- className: V("rqmii-suggested-messages-toggle", x === "left" && "is-start-left"),
3524
+ className: V("rqmii-suggested-messages-toggle", M === "left" && "is-start-left"),
3452
3525
  style: m != null ? { top: m, bottom: "auto" } : void 0,
3453
- onClick: () => o((E) => (E && h.current && (h.current.scrollTop = 0), !E)),
3454
- "aria-label": s ? "Show less" : "Show more",
3455
- "aria-expanded": s,
3456
- children: s ? /* @__PURE__ */ n(Ut, { size: 14 }) : /* @__PURE__ */ n(sa, { size: 14 })
3526
+ onClick: () => s((T) => (T && h.current && (h.current.scrollTop = 0), !T)),
3527
+ "aria-label": o ? "Show less" : "Show more",
3528
+ "aria-expanded": o,
3529
+ children: o ? /* @__PURE__ */ n(Wt, { size: 14 }) : /* @__PURE__ */ n(da, { size: 14 })
3457
3530
  }
3458
3531
  )
3459
3532
  ] }) }) : null;
3460
- }), vn = j.memo(function({ language: e }) {
3533
+ }), Mn = A.memo(function({ language: e }) {
3461
3534
  const t = re(e || "en");
3462
- return /* @__PURE__ */ n("div", { className: "rqmii-chat-message-row", children: /* @__PURE__ */ f("div", { className: "rqmii-chat-message rqmii-chat-typing-indicator", dir: t, children: [
3535
+ return /* @__PURE__ */ n("div", { className: "rqmii-chat-message-row", children: /* @__PURE__ */ v("div", { className: "rqmii-chat-message rqmii-chat-typing-indicator", dir: t, children: [
3463
3536
  /* @__PURE__ */ n("span", { className: "rqmii-chat-typing-dot" }),
3464
3537
  /* @__PURE__ */ n("span", { className: "rqmii-chat-typing-dot" }),
3465
3538
  /* @__PURE__ */ n("span", { className: "rqmii-chat-typing-dot" })
3466
3539
  ] }) });
3467
3540
  });
3468
- function yn(a) {
3541
+ function wn(a) {
3469
3542
  return a === "message";
3470
3543
  }
3471
- const Fn = {
3544
+ const Pn = {
3472
3545
  name: "leadFormName",
3473
3546
  email: "leadFormEmail",
3474
3547
  phone: "leadFormPhone",
3475
3548
  message: "leadFormMessage"
3476
- }, En = j.memo(function({ messageId: e, form: t, language: i, textDirection: s, formSubmitted: o }) {
3477
- const r = ka(), [c, d] = y({}), [l, m] = y(!1), [u, h] = y(!!o), [z, b] = y(null), x = t.title || F(i, "leadFormTitle"), v = (k) => {
3478
- const p = Fn[k.key];
3479
- return `${p ? F(i, p) : k.label}${k.required ? "*" : ""}`;
3480
- }, E = (k, p) => {
3481
- d((S) => ({ ...S, [k]: p })), z && b(null);
3482
- }, g = async (k) => {
3483
- if (k.preventDefault(), l || u) return;
3484
- if (t.fields.some((T) => T.required && !c[T.key]?.trim())) {
3485
- b(F(i, "leadFormRequiredError"));
3549
+ }, Cn = A.memo(function({ messageId: e, form: t, language: i, textDirection: o, formSubmitted: s }) {
3550
+ const r = Ea(), [c, l] = y({}), [d, m] = y(!1), [u, h] = y(!!s), [F, b] = y(null), M = t.title || z(i, "leadFormTitle"), S = (p) => {
3551
+ const g = Pn[p.key];
3552
+ return `${g ? z(i, g) : p.label}${p.required ? "*" : ""}`;
3553
+ }, T = (p, g) => {
3554
+ l((w) => ({ ...w, [p]: g })), F && b(null);
3555
+ }, k = async (p) => {
3556
+ if (p.preventDefault(), d || u) return;
3557
+ if (t.fields.some((E) => E.required && !c[E.key]?.trim())) {
3558
+ b(z(i, "leadFormRequiredError"));
3486
3559
  return;
3487
3560
  }
3488
- const S = {};
3489
- for (const T of t.fields) {
3490
- const M = c[T.key]?.trim();
3491
- M && (S[T.key] = M);
3561
+ const w = {};
3562
+ for (const E of t.fields) {
3563
+ const f = c[E.key]?.trim();
3564
+ f && (w[E.key] = f);
3492
3565
  }
3493
3566
  m(!0), b(null);
3494
3567
  try {
3495
- await r.submitLead({ agentId: t.agentId, collectedData: S }), h(!0), r.setMessages(
3568
+ await r.submitLead({ agentId: t.agentId, collectedData: w }), h(!0), r.setMessages(
3496
3569
  r.messages.map(
3497
- (T) => T.id === e ? { ...T, formSubmitted: !0 } : T
3570
+ (E) => E.id === e ? { ...E, formSubmitted: !0 } : E
3498
3571
  )
3499
3572
  );
3500
- } catch (T) {
3501
- b(T?.message || F(i, "leadFormGenericError"));
3573
+ } catch (E) {
3574
+ b(E?.message || z(i, "leadFormGenericError"));
3502
3575
  } finally {
3503
3576
  m(!1);
3504
3577
  }
3505
3578
  };
3506
- return u ? /* @__PURE__ */ n("div", { className: "rqmii-chat-message-row rqmii-chat-lead-form-row", children: /* @__PURE__ */ n("div", { className: "rqmii-chat-lead-form rqmii-chat-lead-form--done", dir: s, children: /* @__PURE__ */ n("div", { className: "rqmii-chat-lead-form-success", children: F(i, "leadFormSuccess") }) }) }) : /* @__PURE__ */ n("div", { className: "rqmii-chat-message-row rqmii-chat-lead-form-row", children: /* @__PURE__ */ f("form", { className: "rqmii-chat-lead-form", dir: s, onSubmit: g, children: [
3507
- /* @__PURE__ */ n("div", { className: "rqmii-chat-lead-form-title", children: x }),
3508
- t.fields.map((k) => {
3509
- const p = v(k), S = k.type === "email" ? "email" : k.type === "date" ? "date" : "text";
3510
- return yn(k.key) ? /* @__PURE__ */ n(
3579
+ return u ? /* @__PURE__ */ n("div", { className: "rqmii-chat-message-row rqmii-chat-lead-form-row", children: /* @__PURE__ */ n("div", { className: "rqmii-chat-lead-form rqmii-chat-lead-form--done", dir: o, children: /* @__PURE__ */ n("div", { className: "rqmii-chat-lead-form-success", children: z(i, "leadFormSuccess") }) }) }) : /* @__PURE__ */ n("div", { className: "rqmii-chat-message-row rqmii-chat-lead-form-row", children: /* @__PURE__ */ v("form", { className: "rqmii-chat-lead-form", dir: o, onSubmit: k, children: [
3580
+ /* @__PURE__ */ n("div", { className: "rqmii-chat-lead-form-title", children: M }),
3581
+ t.fields.map((p) => {
3582
+ const g = S(p), w = p.type === "email" ? "email" : p.type === "date" ? "date" : "text";
3583
+ return wn(p.key) ? /* @__PURE__ */ n(
3511
3584
  "textarea",
3512
3585
  {
3513
3586
  className: "rqmii-chat-lead-form-input rqmii-chat-lead-form-textarea",
3514
- placeholder: p,
3515
- value: c[k.key] || "",
3516
- onChange: (T) => E(k.key, T.target.value),
3517
- disabled: l,
3587
+ placeholder: g,
3588
+ value: c[p.key] || "",
3589
+ onChange: (E) => T(p.key, E.target.value),
3590
+ disabled: d,
3518
3591
  rows: 4
3519
3592
  },
3520
- k.key
3593
+ p.key
3521
3594
  ) : /* @__PURE__ */ n(
3522
3595
  "input",
3523
3596
  {
3524
3597
  className: "rqmii-chat-lead-form-input",
3525
- type: S,
3526
- placeholder: p,
3527
- value: c[k.key] || "",
3528
- onChange: (T) => E(k.key, T.target.value),
3529
- disabled: l
3598
+ type: w,
3599
+ placeholder: g,
3600
+ value: c[p.key] || "",
3601
+ onChange: (E) => T(p.key, E.target.value),
3602
+ disabled: d
3530
3603
  },
3531
- k.key
3604
+ p.key
3532
3605
  );
3533
3606
  }),
3534
- z && /* @__PURE__ */ n("div", { className: "rqmii-chat-lead-form-error", children: z }),
3535
- /* @__PURE__ */ n("button", { type: "submit", className: "rqmii-chat-lead-form-submit", disabled: l, children: l ? F(i, "loading") : F(i, "submit") })
3607
+ F && /* @__PURE__ */ n("div", { className: "rqmii-chat-lead-form-error", children: F }),
3608
+ /* @__PURE__ */ n("button", { type: "submit", className: "rqmii-chat-lead-form-submit", disabled: d, children: d ? z(i, "loading") : z(i, "submit") })
3536
3609
  ] }) });
3537
- }), Tn = j.memo(function({ message: e, textDirection: t, language: i }) {
3610
+ }), Ln = A.memo(function({ message: e, textDirection: t, language: i }) {
3538
3611
  if (e.role === "lead_form" && e.form)
3539
- return /* @__PURE__ */ n(En, { messageId: e.id, form: e.form, language: i, textDirection: t, formSubmitted: e.formSubmitted });
3540
- const s = e.role === "user" || e.sender === "user";
3541
- return /* @__PURE__ */ n("div", { className: V("rqmii-chat-message-row", s && "is-user"), children: /* @__PURE__ */ n("div", { className: "rqmii-chat-message", dir: t, children: /* @__PURE__ */ n(un, { text: e.text, streaming: e.streaming }) }) });
3542
- }), Re = j.memo(function({ messages: e, partialTranscript: t, language: i, showTypingIndicator: s }) {
3543
- const o = _(null), r = re(i || "en"), c = _(e.length);
3612
+ return /* @__PURE__ */ n(Cn, { messageId: e.id, form: e.form, language: i, textDirection: t, formSubmitted: e.formSubmitted });
3613
+ const o = e.role === "user" || e.sender === "user";
3614
+ return /* @__PURE__ */ n("div", { className: V("rqmii-chat-message-row", o && "is-user"), children: /* @__PURE__ */ n("div", { className: "rqmii-chat-message", dir: t, children: /* @__PURE__ */ n(vn, { text: e.text, streaming: e.streaming }) }) });
3615
+ }), Ue = A.memo(function({ messages: e, partialTranscript: t, language: i, showTypingIndicator: o }) {
3616
+ const s = B(null), r = re(i || "en"), c = B(e.length);
3544
3617
  return I(() => {
3545
- if (!o.current) return;
3546
- const d = e.length !== c.current;
3547
- c.current = e.length, o.current.scrollIntoView({ behavior: d ? "smooth" : "instant", block: "end" });
3548
- }, [e, t]), /* @__PURE__ */ f("div", { className: "rqmii-chat-messages", children: [
3549
- e.map((d) => /* @__PURE__ */ n(Tn, { message: d, textDirection: r, language: i || "en" }, d.id || `${d.role}-${d.text}`)),
3550
- s && /* @__PURE__ */ n(vn, { language: i }),
3618
+ if (!s.current) return;
3619
+ const l = e.length !== c.current;
3620
+ c.current = e.length, s.current.scrollIntoView({ behavior: l ? "smooth" : "instant", block: "end" });
3621
+ }, [e, t]), /* @__PURE__ */ v("div", { className: "rqmii-chat-messages", children: [
3622
+ e.map((l) => /* @__PURE__ */ n(Ln, { message: l, textDirection: r, language: i || "en" }, l.id || `${l.role}-${l.text}`)),
3623
+ o && /* @__PURE__ */ n(Mn, { language: i }),
3551
3624
  t && /* @__PURE__ */ n("div", { className: "rqmii-chat-message-row is-user is-partial", children: /* @__PURE__ */ n("div", { className: "rqmii-chat-message", dir: r, children: t }) }),
3552
- /* @__PURE__ */ n("div", { ref: o })
3625
+ /* @__PURE__ */ n("div", { ref: s })
3553
3626
  ] });
3554
- }), la = j.memo(function({ message: e, onRetry: t, onClose: i, language: s = "en" }) {
3555
- return /* @__PURE__ */ f("div", { className: "rqmii-chat-panel rqmii-chat-panel--error", children: [
3627
+ }), ha = A.memo(function({ message: e, onRetry: t, onClose: i, language: o = "en" }) {
3628
+ return /* @__PURE__ */ v("div", { className: "rqmii-chat-panel rqmii-chat-panel--error", children: [
3556
3629
  i && /* @__PURE__ */ n("button", { type: "button", className: "rqmii-error-close", onClick: i, children: "×" }),
3557
- /* @__PURE__ */ n("p", { children: e || F(s, "connectionFailed") }),
3558
- t && /* @__PURE__ */ f("button", { type: "button", className: "rqmii-chat-retry", onClick: t, children: [
3559
- /* @__PURE__ */ n(Xt, { size: 16 }),
3560
- /* @__PURE__ */ n("span", { children: F(s, "retry") })
3630
+ /* @__PURE__ */ n("p", { children: e || z(o, "connectionFailed") }),
3631
+ t && /* @__PURE__ */ v("button", { type: "button", className: "rqmii-chat-retry", onClick: t, children: [
3632
+ /* @__PURE__ */ n(sn, { size: 16 }),
3633
+ /* @__PURE__ */ n("span", { children: z(o, "retry") })
3561
3634
  ] })
3562
3635
  ] });
3563
- }), zn = 5;
3564
- function ca({ rating: a, onRate: e, readonly: t, size: i = 28 }) {
3565
- const [s, o] = y(0), r = s || a;
3566
- return /* @__PURE__ */ n("div", { className: "rqmii-chat-rating-stars", role: "radiogroup", children: Array.from({ length: zn }, (c, d) => {
3567
- const l = d + 1, m = l <= r;
3636
+ }), An = 5;
3637
+ function ga({ rating: a, onRate: e, readonly: t, size: i = 28 }) {
3638
+ const [o, s] = y(0), r = o || a;
3639
+ return /* @__PURE__ */ n("div", { className: "rqmii-chat-rating-stars", role: "radiogroup", children: Array.from({ length: An }, (c, l) => {
3640
+ const d = l + 1, m = d <= r;
3568
3641
  return /* @__PURE__ */ n(
3569
3642
  "button",
3570
3643
  {
3571
3644
  type: "button",
3572
3645
  className: V("rqmii-chat-star", m && "is-filled", t && "is-readonly"),
3573
3646
  disabled: t,
3574
- "aria-label": `${l}`,
3575
- "aria-checked": l === a,
3647
+ "aria-label": `${d}`,
3648
+ "aria-checked": d === a,
3576
3649
  role: "radio",
3577
- onMouseEnter: () => !t && o(l),
3578
- onMouseLeave: () => !t && o(0),
3579
- onClick: () => !t && e?.(l),
3580
- children: /* @__PURE__ */ n(an, { size: i, fill: m ? "currentColor" : "none" })
3650
+ onMouseEnter: () => !t && s(d),
3651
+ onMouseLeave: () => !t && s(0),
3652
+ onClick: () => !t && e?.(d),
3653
+ children: /* @__PURE__ */ n(ln, { size: i, fill: m ? "currentColor" : "none" })
3581
3654
  },
3582
- l
3655
+ d
3583
3656
  );
3584
3657
  }) });
3585
3658
  }
3586
- function Sn({
3659
+ function _n({
3587
3660
  language: a,
3588
3661
  rating: e,
3589
3662
  endedBy: t,
3590
3663
  sessionId: i,
3591
- interactive: s,
3592
- showTellUsMore: o,
3593
- onRate: r,
3594
- onTellUsMore: c
3664
+ interactive: o,
3665
+ showTellUsMore: s,
3666
+ showRating: r = !0,
3667
+ showConversationId: c = !0,
3668
+ onRate: l,
3669
+ onTellUsMore: d
3595
3670
  }) {
3596
- const d = e > 0 ? F(a, "ratingThankYou") : F(a, "ratingQuestion"), l = t === "user" ? F(a, "youEnded") : F(a, "agentEnded");
3597
- return /* @__PURE__ */ f("div", { className: V("rqmii-chat-rating", H(a)), dir: re(a), children: [
3598
- /* @__PURE__ */ n("div", { className: "rqmii-chat-rating-header", children: d }),
3599
- /* @__PURE__ */ n(ca, { rating: e, onRate: r, readonly: !s }),
3600
- o && /* @__PURE__ */ n("button", { type: "button", className: "rqmii-chat-rating-more", onClick: c, children: F(a, "tellUsMore") }),
3601
- /* @__PURE__ */ f("div", { className: "rqmii-chat-rating-meta", children: [
3602
- /* @__PURE__ */ n("div", { children: l }),
3603
- i && /* @__PURE__ */ f("div", { children: [
3604
- F(a, "sessionIdLabel"),
3605
- " ",
3606
- /* @__PURE__ */ n("span", { className: "rqmii-chat-font-latin", children: i })
3607
- ] })
3608
- ] })
3609
- ] });
3671
+ const m = e > 0 ? z(a, "ratingThankYou") : z(a, "ratingQuestion"), u = t === "user" ? z(a, "youEnded") : z(a, "agentEnded");
3672
+ return /* @__PURE__ */ v(
3673
+ "div",
3674
+ {
3675
+ className: V("rqmii-chat-rating", !r && "rqmii-chat-rating--unrated", Z()),
3676
+ dir: re(a),
3677
+ children: [
3678
+ r && /* @__PURE__ */ v(Te, { children: [
3679
+ /* @__PURE__ */ n("div", { className: "rqmii-chat-rating-header", children: m }),
3680
+ /* @__PURE__ */ n(ga, { rating: e, onRate: l, readonly: !o }),
3681
+ s && /* @__PURE__ */ n("button", { type: "button", className: "rqmii-chat-rating-more", onClick: d, children: z(a, "tellUsMore") })
3682
+ ] }),
3683
+ /* @__PURE__ */ v("div", { className: "rqmii-chat-rating-meta", children: [
3684
+ /* @__PURE__ */ n("div", { children: u }),
3685
+ c && i && /* @__PURE__ */ v("div", { children: [
3686
+ z(a, "sessionIdLabel"),
3687
+ " ",
3688
+ /* @__PURE__ */ n("span", { children: i })
3689
+ ] })
3690
+ ] })
3691
+ ]
3692
+ }
3693
+ );
3610
3694
  }
3611
- function xn({
3695
+ function qn({
3612
3696
  agent: a,
3613
3697
  language: e,
3614
3698
  rating: t,
3615
3699
  onBack: i,
3616
- onMinimize: s,
3617
- onSubmit: o
3700
+ onMinimize: o,
3701
+ onSubmit: s
3618
3702
  }) {
3619
- const [r, c] = y(""), [d, l] = y(!1), m = r.trim().length > 0 && !d, u = async () => {
3703
+ const [r, c] = y(""), [l, d] = y(!1), m = r.trim().length > 0 && !l, u = async () => {
3620
3704
  if (m) {
3621
- l(!0);
3705
+ d(!0);
3622
3706
  try {
3623
- await o(r.trim());
3707
+ await s(r.trim());
3624
3708
  } finally {
3625
- l(!1);
3709
+ d(!1);
3626
3710
  }
3627
3711
  }
3628
3712
  };
3629
- return /* @__PURE__ */ f("div", { className: V("rqmii-chat-panel rqmii-chat-panel--feedback", H(e)), dir: re(e), children: [
3630
- /* @__PURE__ */ f("div", { className: "rqmii-chat-topbar", children: [
3631
- /* @__PURE__ */ n("button", { type: "button", className: "rqmii-chat-circle-button", onClick: i, "aria-label": "Back", children: /* @__PURE__ */ n(Rt, { size: 20 }) }),
3632
- /* @__PURE__ */ n("button", { type: "button", className: "rqmii-chat-circle-button", onClick: s, "aria-label": F(e, "minimize"), children: /* @__PURE__ */ n(Ee, { size: 20 }) })
3713
+ return /* @__PURE__ */ v("div", { className: V("rqmii-chat-panel rqmii-chat-panel--feedback", Z()), dir: re(e), children: [
3714
+ /* @__PURE__ */ v("div", { className: "rqmii-chat-topbar", children: [
3715
+ /* @__PURE__ */ n("button", { type: "button", className: "rqmii-chat-circle-button", onClick: i, "aria-label": "Back", children: /* @__PURE__ */ n(Yt, { size: 20 }) }),
3716
+ /* @__PURE__ */ n("button", { type: "button", className: "rqmii-chat-circle-button", onClick: o, "aria-label": z(e, "minimize"), children: /* @__PURE__ */ n(xe, { size: 20 }) })
3633
3717
  ] }),
3634
- /* @__PURE__ */ f("div", { className: "rqmii-chat-feedback-body", children: [
3635
- /* @__PURE__ */ n(J, { agent: a, size: "hero" }),
3636
- /* @__PURE__ */ n(ca, { rating: t, readonly: !0 }),
3637
- /* @__PURE__ */ n("div", { className: "rqmii-chat-feedback-title", children: F(e, "ratingThankYou") }),
3638
- /* @__PURE__ */ n("div", { className: "rqmii-chat-feedback-subtitle", children: F(e, "feedbackSubtitle") }),
3718
+ /* @__PURE__ */ v("div", { className: "rqmii-chat-feedback-body", children: [
3719
+ /* @__PURE__ */ n(te, { agent: a, size: "hero" }),
3720
+ /* @__PURE__ */ n(ga, { rating: t, readonly: !0 }),
3721
+ /* @__PURE__ */ n("div", { className: "rqmii-chat-feedback-title", children: z(e, "ratingThankYou") }),
3722
+ /* @__PURE__ */ n("div", { className: "rqmii-chat-feedback-subtitle", children: z(e, "feedbackSubtitle") }),
3639
3723
  /* @__PURE__ */ n(
3640
3724
  "textarea",
3641
3725
  {
3642
3726
  className: "rqmii-chat-feedback-input",
3643
3727
  value: r,
3644
3728
  dir: re(e),
3645
- placeholder: F(e, "feedbackPlaceholder"),
3729
+ placeholder: z(e, "feedbackPlaceholder"),
3646
3730
  onChange: (h) => c(h.target.value)
3647
3731
  }
3648
3732
  ),
3649
- /* @__PURE__ */ n("div", { className: "rqmii-chat-feedback-actions", children: /* @__PURE__ */ n("button", { type: "button", className: "rqmii-chat-feedback-submit", onClick: u, disabled: !m, children: d ? /* @__PURE__ */ n(ye, { className: "rqmii-chat-spin", size: 18 }) : F(e, "submit") }) })
3733
+ /* @__PURE__ */ n("div", { className: "rqmii-chat-feedback-actions", children: /* @__PURE__ */ n("button", { type: "button", className: "rqmii-chat-feedback-submit", onClick: u, disabled: !m, children: l ? /* @__PURE__ */ n(ze, { className: "rqmii-chat-spin", size: 18 }) : z(e, "submit") }) })
3650
3734
  ] }),
3651
- /* @__PURE__ */ n(le, { language: e, agent: a })
3735
+ /* @__PURE__ */ n(ue, { language: e, agent: a })
3652
3736
  ] });
3653
3737
  }
3654
- const Mn = j.lazy(() => import("./RqmiiCloudAvatarPlayer-Bi44g7bl.js").then((a) => a.e).then((a) => ({ default: a.RqmiiCloudAvatarPlayer })));
3655
- function be(a) {
3738
+ const In = A.lazy(() => import("./RqmiiCloudAvatarPlayer-Cit_rrpj.js").then((a) => a.e).then((a) => ({ default: a.RqmiiCloudAvatarPlayer })));
3739
+ function Fe(a) {
3656
3740
  if (!(a == null || typeof window > "u" || window.innerWidth >= 768))
3657
3741
  return {
3658
3742
  top: `${window.innerHeight - a}px`,
3659
3743
  bottom: 0
3660
3744
  };
3661
3745
  }
3662
- const Pn = j.memo(function({ agent: e, language: t, languages: i, onLanguageChange: s, onClose: o, onSend: r, isVoiceEnabled: c = !1, isAudioPlaying: d = !1, isVoiceSetupLoading: l = !1, onStartVoice: m, visualViewportHeight: u, disabled: h = !1, error: z, suggestions: b, onSuggestionClick: x, compact: v = !1 }) {
3663
- const E = be(u), [g, k] = j.useState(we);
3664
- j.useEffect(() => {
3665
- const M = () => k(we());
3666
- return window.addEventListener("resize", M), () => window.removeEventListener("resize", M);
3746
+ const Vn = A.memo(function({ agent: e, language: t, languages: i, onLanguageChange: o, onClose: s, onSend: r, isVoiceEnabled: c = !1, isAudioPlaying: l = !1, isVoiceSetupLoading: d = !1, onStartVoice: m, visualViewportHeight: u, disabled: h = !1, error: F, suggestions: b, onSuggestionClick: M, compact: S = !1 }) {
3747
+ const T = Fe(u), [k, p] = A.useState(_e);
3748
+ A.useEffect(() => {
3749
+ const f = () => p(_e());
3750
+ return window.addEventListener("resize", f), () => window.removeEventListener("resize", f);
3667
3751
  }, []);
3668
- const p = v && !g, S = p ? "start" : "hero", T = b && b.length > 0;
3669
- return /* @__PURE__ */ f("div", { className: V("rqmii-chat-panel rqmii-chat-panel--start", p && "rqmii-chat-panel--start-compact", H(t)), style: E, children: [
3670
- /* @__PURE__ */ f("div", { className: "rqmii-chat-topbar", children: [
3752
+ const g = S && !k, w = g ? "start" : "hero", E = b && b.length > 0;
3753
+ return /* @__PURE__ */ v("div", { className: V("rqmii-chat-panel rqmii-chat-panel--start", g && "rqmii-chat-panel--start-compact", Z()), style: T, children: [
3754
+ /* @__PURE__ */ v("div", { className: "rqmii-chat-topbar", children: [
3671
3755
  /* @__PURE__ */ n("span", {}),
3672
- /* @__PURE__ */ f("div", { className: "rqmii-chat-topbar-actions", children: [
3673
- /* @__PURE__ */ n(_e, { language: t, languages: i, onChange: s }),
3674
- /* @__PURE__ */ n("button", { type: "button", className: "rqmii-chat-circle-button", onClick: o, children: /* @__PURE__ */ n(qe, { size: 20 }) })
3756
+ /* @__PURE__ */ v("div", { className: "rqmii-chat-topbar-actions", children: [
3757
+ /* @__PURE__ */ n(Ge, { language: t, languages: i, onChange: o }),
3758
+ /* @__PURE__ */ n("button", { type: "button", className: "rqmii-chat-circle-button", onClick: s, children: /* @__PURE__ */ n(De, { size: 20 }) })
3675
3759
  ] })
3676
3760
  ] }),
3677
- /* @__PURE__ */ f("div", { className: "rqmii-chat-start-body", children: [
3678
- c ? /* @__PURE__ */ f("div", { className: V("rqmii-chat-call-avatar-wrap", p && "is-compact"), children: [
3679
- /* @__PURE__ */ n(J, { agent: e, size: S, active: d }),
3680
- /* @__PURE__ */ n("button", { type: "button", className: V("rqmii-chat-call-button", p && "is-compact"), onClick: m, disabled: l, "aria-label": F(t, "startVoice"), children: l ? /* @__PURE__ */ n(ye, { className: "rqmii-chat-spin", size: p ? 18 : 24 }) : /* @__PURE__ */ n(Ie, { size: p ? 18 : 24 }) })
3681
- ] }) : /* @__PURE__ */ n(J, { agent: e, size: S }),
3761
+ /* @__PURE__ */ v("div", { className: "rqmii-chat-start-body", children: [
3762
+ c ? /* @__PURE__ */ v("div", { className: V("rqmii-chat-call-avatar-wrap", g && "is-compact"), children: [
3763
+ /* @__PURE__ */ n(te, { agent: e, size: w, active: l }),
3764
+ /* @__PURE__ */ n("button", { type: "button", className: V("rqmii-chat-call-button", g && "is-compact"), onClick: m, disabled: d, "aria-label": z(t, "startVoice"), children: d ? /* @__PURE__ */ n(ze, { className: "rqmii-chat-spin", size: g ? 18 : 24 }) : /* @__PURE__ */ n(je, { size: g ? 18 : 24 }) })
3765
+ ] }) : /* @__PURE__ */ n(te, { agent: e, size: w }),
3682
3766
  /* @__PURE__ */ n("div", { className: "rqmii-chat-agent-name", children: e.name }),
3683
- z && /* @__PURE__ */ n("div", { className: "rqmii-chat-error-text", children: z })
3767
+ F && /* @__PURE__ */ n("div", { className: "rqmii-chat-error-text", children: F })
3684
3768
  ] }),
3685
- T && /* @__PURE__ */ n("div", { className: "rqmii-chat-start-suggestions", children: /* @__PURE__ */ n(fn, { suggestions: b, language: t, onClick: (M) => x?.(M) }) }),
3686
- /* @__PURE__ */ n(Te, { language: t, onSend: r, disabled: h }),
3687
- /* @__PURE__ */ n(le, { language: t, agent: e })
3769
+ E && /* @__PURE__ */ n("div", { className: "rqmii-chat-start-suggestions", children: /* @__PURE__ */ n(xn, { suggestions: b, language: t, onClick: (f) => M?.(f) }) }),
3770
+ /* @__PURE__ */ n(Me, { language: t, onSend: r, disabled: h }),
3771
+ /* @__PURE__ */ n(ue, { language: t, agent: e })
3688
3772
  ] });
3689
- }), Cn = j.memo(function({ agent: e, language: t, languages: i, onLanguageChange: s, onClose: o, onStartVoice: r, isVoiceSetupLoading: c = !1, isAudioPlaying: d, visualViewportHeight: l }) {
3690
- const m = be(l);
3691
- return /* @__PURE__ */ f("div", { className: V("rqmii-chat-panel rqmii-chat-panel--voice-start", H(t)), style: m, children: [
3692
- /* @__PURE__ */ f("div", { className: "rqmii-chat-topbar", children: [
3773
+ }), Nn = A.memo(function({ agent: e, language: t, languages: i, onLanguageChange: o, onClose: s, onStartVoice: r, isVoiceSetupLoading: c = !1, isAudioPlaying: l, visualViewportHeight: d }) {
3774
+ const m = Fe(d);
3775
+ return /* @__PURE__ */ v("div", { className: V("rqmii-chat-panel rqmii-chat-panel--voice-start", Z()), style: m, children: [
3776
+ /* @__PURE__ */ v("div", { className: "rqmii-chat-topbar", children: [
3693
3777
  /* @__PURE__ */ n("span", {}),
3694
- /* @__PURE__ */ f("div", { className: "rqmii-chat-topbar-actions", children: [
3695
- /* @__PURE__ */ n(_e, { language: t, languages: i, onChange: s }),
3696
- /* @__PURE__ */ n("button", { type: "button", className: "rqmii-chat-circle-button", onClick: o, children: /* @__PURE__ */ n(qe, { size: 20 }) })
3778
+ /* @__PURE__ */ v("div", { className: "rqmii-chat-topbar-actions", children: [
3779
+ /* @__PURE__ */ n(Ge, { language: t, languages: i, onChange: o }),
3780
+ /* @__PURE__ */ n("button", { type: "button", className: "rqmii-chat-circle-button", onClick: s, children: /* @__PURE__ */ n(De, { size: 20 }) })
3697
3781
  ] })
3698
3782
  ] }),
3699
- /* @__PURE__ */ f("div", { className: "rqmii-chat-call-body", children: [
3700
- /* @__PURE__ */ f("div", { className: "rqmii-chat-call-avatar-wrap", children: [
3701
- /* @__PURE__ */ n(J, { agent: e, size: "hero", active: d }),
3702
- /* @__PURE__ */ n("button", { type: "button", className: "rqmii-chat-call-button", onClick: r, disabled: c, "aria-label": F(t, "startVoice"), children: c ? /* @__PURE__ */ n(ye, { className: "rqmii-chat-spin", size: 24 }) : /* @__PURE__ */ n(Ie, { size: 24 }) })
3783
+ /* @__PURE__ */ v("div", { className: "rqmii-chat-call-body", children: [
3784
+ /* @__PURE__ */ v("div", { className: "rqmii-chat-call-avatar-wrap", children: [
3785
+ /* @__PURE__ */ n(te, { agent: e, size: "hero", active: l }),
3786
+ /* @__PURE__ */ n("button", { type: "button", className: "rqmii-chat-call-button", onClick: r, disabled: c, "aria-label": z(t, "startVoice"), children: c ? /* @__PURE__ */ n(ze, { className: "rqmii-chat-spin", size: 24 }) : /* @__PURE__ */ n(je, { size: 24 }) })
3703
3787
  ] }),
3704
- /* @__PURE__ */ f("div", { className: "rqmii-chat-agent-name", children: [
3705
- F(t, "call"),
3788
+ /* @__PURE__ */ v("div", { className: "rqmii-chat-agent-name", children: [
3789
+ z(t, "call"),
3706
3790
  " ",
3707
3791
  e.name
3708
3792
  ] })
3709
3793
  ] }),
3710
- /* @__PURE__ */ n(le, { language: t, agent: e })
3794
+ /* @__PURE__ */ n(ue, { language: t, agent: e })
3711
3795
  ] });
3712
- }), wn = j.memo(function({ agent: e, language: t, onEndSession: i, onMinimize: s, messages: o, partialTranscript: r, onSend: c, isAudioPlaying: d, isVoiceEnabled: l, onToggleVoice: m, isListening: u, isSpeaking: h, isLoading: z, isAgentThinking: b, isAgentSpeaking: x, onStartVoice: v, elapsed: E, visualViewportHeight: g, waitingForResponse: k }) {
3713
- const p = da({ language: t, isListening: u, isLoading: z, isSpeaking: h, isAudioPlaying: d, isAgentThinking: b, isAgentSpeaking: x, persistentListening: !1 }), S = be(g);
3714
- return /* @__PURE__ */ f("div", { className: V("rqmii-chat-panel rqmii-chat-panel--conversation", H(t)), style: S, children: [
3715
- /* @__PURE__ */ f("div", { className: "rqmii-chat-header", children: [
3716
- /* @__PURE__ */ n(J, { agent: e, size: "header", active: d }),
3717
- l && p && /* @__PURE__ */ n("div", { className: "rqmii-chat-header-status", children: /* @__PURE__ */ n("span", { children: p }) }),
3796
+ }), jn = A.memo(function({ agent: e, language: t, onEndSession: i, onMinimize: o, messages: s, partialTranscript: r, onSend: c, isAudioPlaying: l, isVoiceEnabled: d, onToggleVoice: m, isListening: u, isSpeaking: h, isLoading: F, isAgentThinking: b, isAgentSpeaking: M, onStartVoice: S, elapsed: T, visualViewportHeight: k, waitingForResponse: p }) {
3797
+ const g = pa({ language: t, isListening: u, isLoading: F, isSpeaking: h, isAudioPlaying: l, isAgentThinking: b, isAgentSpeaking: M, persistentListening: !1 }), w = Fe(k), E = e.widget?.appearance?.show_topbar_avatar_image !== !1;
3798
+ return /* @__PURE__ */ v("div", { className: V("rqmii-chat-panel rqmii-chat-panel--conversation", Z()), style: w, children: [
3799
+ /* @__PURE__ */ v("div", { className: "rqmii-chat-header", children: [
3800
+ E && /* @__PURE__ */ n(te, { agent: e, size: "header", active: l }),
3801
+ d && g && /* @__PURE__ */ n("div", { className: V("rqmii-chat-header-status", !E && "is-expanded"), children: /* @__PURE__ */ n("span", { children: g }) }),
3718
3802
  /* @__PURE__ */ n("div", { className: "rqmii-chat-header-spacer" }),
3719
- /* @__PURE__ */ f("div", { className: "rqmii-chat-header-actions", children: [
3720
- s && /* @__PURE__ */ n("button", { type: "button", className: "rqmii-chat-circle-button", onClick: s, "aria-label": F(t, "minimize"), children: /* @__PURE__ */ n(Ee, { size: 20 }) }),
3721
- l && /* @__PURE__ */ n("button", { type: "button", className: V("rqmii-chat-circle-button", h && "is-active"), onClick: m, "aria-label": u ? F(t, "stopVoice") : F(t, "startVoice"), children: u ? /* @__PURE__ */ n(Fe, { size: 20 }) : /* @__PURE__ */ n(je, { size: 20 }) }),
3722
- /* @__PURE__ */ n("button", { type: "button", className: "rqmii-chat-circle-button is-danger", onClick: i, "aria-label": F(t, "endCall"), children: /* @__PURE__ */ n(De, { size: 20 }) })
3803
+ /* @__PURE__ */ v("div", { className: "rqmii-chat-header-actions", children: [
3804
+ o && /* @__PURE__ */ n("button", { type: "button", className: "rqmii-chat-circle-button", onClick: o, "aria-label": z(t, "minimize"), children: /* @__PURE__ */ n(xe, { size: 20 }) }),
3805
+ d && /* @__PURE__ */ n("button", { type: "button", className: V("rqmii-chat-circle-button", h && "is-active"), onClick: m, "aria-label": u ? z(t, "stopVoice") : z(t, "startVoice"), children: u ? /* @__PURE__ */ n(Se, { size: 20 }) : /* @__PURE__ */ n(Ve, { size: 20 }) }),
3806
+ /* @__PURE__ */ n("button", { type: "button", className: "rqmii-chat-circle-button is-danger", onClick: i, "aria-label": z(t, "endCall"), children: /* @__PURE__ */ n(Ne, { size: 20 }) })
3723
3807
  ] })
3724
3808
  ] }),
3725
- /* @__PURE__ */ n(Re, { messages: o, partialTranscript: r, language: t, showTypingIndicator: k }),
3726
- l && /* @__PURE__ */ n("div", { className: "rqmii-chat-session-counter", children: Ne(E) }),
3727
- /* @__PURE__ */ n(Te, { language: t, onSend: c }),
3728
- /* @__PURE__ */ n(le, { language: t, agent: e })
3809
+ /* @__PURE__ */ n(Ue, { messages: s, partialTranscript: r, language: t, showTypingIndicator: p }),
3810
+ d && /* @__PURE__ */ n("div", { className: "rqmii-chat-session-counter", children: Be(T) }),
3811
+ /* @__PURE__ */ n(Me, { language: t, onSend: c }),
3812
+ /* @__PURE__ */ n(ue, { language: t, agent: e })
3729
3813
  ] });
3730
- }), Ln = j.memo(function({ agent: e, language: t, onEndSession: i, onMinimize: s, isListening: o, isLoading: r, isSpeaking: c, isAudioPlaying: d, isAgentThinking: l, isAgentSpeaking: m, onToggleVoice: u, elapsed: h, visualViewportHeight: z }) {
3731
- const b = da({ language: t, isListening: o, isLoading: r, isSpeaking: c, isAudioPlaying: d, isAgentThinking: l, isAgentSpeaking: m, persistentListening: !0 }), x = be(z);
3732
- return /* @__PURE__ */ f("div", { className: V("rqmii-chat-panel rqmii-chat-panel--voice-call", H(t)), style: x, children: [
3733
- /* @__PURE__ */ f("div", { className: "rqmii-chat-call-status", children: [
3734
- /* @__PURE__ */ n("span", { className: V("rqmii-chat-live-dot", o && "is-live") }),
3735
- /* @__PURE__ */ n("span", { children: Ne(h) }),
3736
- /* @__PURE__ */ n("button", { type: "button", className: "rqmii-chat-circle-button", onClick: s, children: /* @__PURE__ */ n(Ee, { size: 20 }) })
3814
+ }), Dn = A.memo(function({ agent: e, language: t, onEndSession: i, onMinimize: o, isListening: s, isLoading: r, isSpeaking: c, isAudioPlaying: l, isAgentThinking: d, isAgentSpeaking: m, onToggleVoice: u, elapsed: h, visualViewportHeight: F }) {
3815
+ const b = pa({ language: t, isListening: s, isLoading: r, isSpeaking: c, isAudioPlaying: l, isAgentThinking: d, isAgentSpeaking: m, persistentListening: !0 }), M = Fe(F);
3816
+ return /* @__PURE__ */ v("div", { className: V("rqmii-chat-panel rqmii-chat-panel--voice-call", Z()), style: M, children: [
3817
+ /* @__PURE__ */ v("div", { className: "rqmii-chat-call-status", children: [
3818
+ /* @__PURE__ */ n("span", { className: V("rqmii-chat-live-dot", s && "is-live") }),
3819
+ /* @__PURE__ */ n("span", { children: Be(h) }),
3820
+ /* @__PURE__ */ n("button", { type: "button", className: "rqmii-chat-circle-button", onClick: o, children: /* @__PURE__ */ n(xe, { size: 20 }) })
3737
3821
  ] }),
3738
- /* @__PURE__ */ f("div", { className: "rqmii-chat-voice-frame", children: [
3739
- /* @__PURE__ */ n(J, { agent: e, size: "hero", active: d }),
3822
+ /* @__PURE__ */ v("div", { className: "rqmii-chat-voice-frame", children: [
3823
+ /* @__PURE__ */ n(te, { agent: e, size: "hero", active: l }),
3740
3824
  /* @__PURE__ */ n("div", { className: "rqmii-chat-agent-name", children: e.name }),
3741
- /* @__PURE__ */ n("div", { className: V("rqmii-chat-status-pill", !b && "is-empty"), children: b || F(t, "listening") }),
3742
- /* @__PURE__ */ f("div", { className: "rqmii-chat-voice-actions", children: [
3743
- /* @__PURE__ */ n("button", { type: "button", className: V("rqmii-chat-circle-button", c && "is-active"), onClick: u, children: o ? /* @__PURE__ */ n(Fe, { size: 20 }) : /* @__PURE__ */ n(je, { size: 20 }) }),
3744
- /* @__PURE__ */ n("button", { type: "button", className: "rqmii-chat-circle-button is-danger", onClick: i, "aria-label": F(t, "endCall"), children: /* @__PURE__ */ n(De, { size: 20 }) })
3825
+ /* @__PURE__ */ n("div", { className: V("rqmii-chat-status-pill", !b && "is-empty"), children: b || z(t, "listening") }),
3826
+ /* @__PURE__ */ v("div", { className: "rqmii-chat-voice-actions", children: [
3827
+ /* @__PURE__ */ n("button", { type: "button", className: V("rqmii-chat-circle-button", c && "is-active"), onClick: u, children: s ? /* @__PURE__ */ n(Se, { size: 20 }) : /* @__PURE__ */ n(Ve, { size: 20 }) }),
3828
+ /* @__PURE__ */ n("button", { type: "button", className: "rqmii-chat-circle-button is-danger", onClick: i, "aria-label": z(t, "endCall"), children: /* @__PURE__ */ n(Ne, { size: 20 }) })
3745
3829
  ] })
3746
3830
  ] }),
3747
- /* @__PURE__ */ n(le, { language: t, agent: e })
3831
+ /* @__PURE__ */ n(ue, { language: t, agent: e })
3748
3832
  ] });
3749
3833
  });
3750
- function da({ language: a, isListening: e, isLoading: t, isSpeaking: i, isAudioPlaying: s, isAgentThinking: o, isAgentSpeaking: r, persistentListening: c = !1 }) {
3751
- return t ? F(a, "loading") : i ? F(a, "listening") : s || r ? F(a, "talkToInterrupt") : o ? F(a, "processing") : e && c ? F(a, "listening") : null;
3834
+ function pa({ language: a, isListening: e, isLoading: t, isSpeaking: i, isAudioPlaying: o, isAgentThinking: s, isAgentSpeaking: r, persistentListening: c = !1 }) {
3835
+ return t ? z(a, "loading") : i ? z(a, "listening") : o || r ? z(a, "talkToInterrupt") : s ? z(a, "processing") : e && c ? z(a, "listening") : null;
3752
3836
  }
3753
- const An = j.memo(function({ agent: e, language: t, onRestore: i, onClose: s, isListening: o, isAudioPlaying: r, isSpeaking: c, onToggleVoice: d, elapsed: l, variant: m = "voice" }) {
3837
+ const Rn = A.memo(function({ agent: e, language: t, onRestore: i, onClose: o, isListening: s, isAudioPlaying: r, isSpeaking: c, onToggleVoice: l, elapsed: d, variant: m = "voice" }) {
3754
3838
  const u = m === "text";
3755
- return /* @__PURE__ */ f("div", { className: V("rqmii-chat-minimized", H(t)), children: [
3756
- /* @__PURE__ */ n(J, { agent: e, size: "minimized", active: r }),
3757
- !u && /* @__PURE__ */ n("span", { className: "rqmii-chat-minimized-time", children: Ne(l) }),
3758
- /* @__PURE__ */ f("div", { className: "rqmii-chat-minimized-actions", children: [
3759
- /* @__PURE__ */ n("button", { type: "button", className: "rqmii-chat-circle-button", onClick: i, "aria-label": F(t, "maximize"), children: /* @__PURE__ */ n(Yt, { size: 20 }) }),
3760
- !u && /* @__PURE__ */ n("button", { type: "button", className: V("rqmii-chat-circle-button", c && "is-active"), onClick: d, "aria-label": o ? F(t, "stopVoice") : F(t, "startVoice"), children: o ? /* @__PURE__ */ n(Fe, { size: 20 }) : /* @__PURE__ */ n(je, { size: 20 }) }),
3761
- /* @__PURE__ */ n("button", { type: "button", className: "rqmii-chat-circle-button is-danger", onClick: s, "aria-label": F(t, "endCall"), children: /* @__PURE__ */ n(De, { size: 20 }) })
3839
+ return /* @__PURE__ */ v("div", { className: V("rqmii-chat-minimized", Z()), children: [
3840
+ /* @__PURE__ */ n(te, { agent: e, size: "minimized", active: r }),
3841
+ !u && /* @__PURE__ */ n("span", { className: "rqmii-chat-minimized-time", children: Be(d) }),
3842
+ /* @__PURE__ */ v("div", { className: "rqmii-chat-minimized-actions", children: [
3843
+ /* @__PURE__ */ n("button", { type: "button", className: "rqmii-chat-circle-button", onClick: i, "aria-label": z(t, "maximize"), children: /* @__PURE__ */ n(Jt, { size: 20 }) }),
3844
+ !u && /* @__PURE__ */ n("button", { type: "button", className: V("rqmii-chat-circle-button", c && "is-active"), onClick: l, "aria-label": s ? z(t, "stopVoice") : z(t, "startVoice"), children: s ? /* @__PURE__ */ n(Se, { size: 20 }) : /* @__PURE__ */ n(Ve, { size: 20 }) }),
3845
+ /* @__PURE__ */ n("button", { type: "button", className: "rqmii-chat-circle-button is-danger", onClick: o, "aria-label": z(t, "endCall"), children: /* @__PURE__ */ n(Ne, { size: 20 }) })
3762
3846
  ] })
3763
3847
  ] });
3764
- }), Vn = j.memo(function({
3848
+ }), Bn = A.memo(function({
3765
3849
  agent: e,
3766
3850
  language: t,
3767
3851
  languages: i,
3768
- chatKind: s,
3769
- messages: o,
3852
+ chatKind: o,
3853
+ messages: s,
3770
3854
  onLanguageChange: r,
3771
3855
  onMinimize: c,
3772
- onStartNewVoice: d,
3773
- onStartNewText: l,
3856
+ onStartNewVoice: l,
3857
+ onStartNewText: d,
3774
3858
  isVoiceSetupLoading: m = !1,
3775
3859
  visualViewportHeight: u,
3776
3860
  rating: h,
3777
- endedBy: z,
3861
+ endedBy: F,
3778
3862
  sessionId: b,
3779
- ratingInteractive: x,
3780
- showTellUsMore: v,
3781
- onRate: E,
3782
- onTellUsMore: g
3863
+ ratingInteractive: M,
3864
+ showTellUsMore: S,
3865
+ onRate: T,
3866
+ onTellUsMore: k
3783
3867
  }) {
3784
- const k = be(u), p = b && e.widget?.behavior?.post_chat_rating_enabled ? /* @__PURE__ */ n(
3785
- Sn,
3868
+ const p = Fe(u), g = e.widget?.behavior?.conversation_ended_screen, w = !!g?.post_chat_rating_enabled, E = g?.show_conversation_id ?? !0, f = /* @__PURE__ */ n(
3869
+ _n,
3786
3870
  {
3787
3871
  language: t,
3788
3872
  rating: h,
3789
- endedBy: z,
3873
+ endedBy: F,
3790
3874
  sessionId: b,
3791
- interactive: x,
3792
- showTellUsMore: v,
3793
- onRate: E,
3794
- onTellUsMore: g
3875
+ interactive: M,
3876
+ showTellUsMore: S,
3877
+ showRating: w,
3878
+ showConversationId: E,
3879
+ onRate: T,
3880
+ onTellUsMore: k
3795
3881
  }
3796
- ) : null, S = s === "voice" || s === "text_and_voice", T = s === "text" || s === "text_and_voice", M = /* @__PURE__ */ f("div", { className: "rqmii-chat-topbar-actions rqmii-chat-topbar-actions--ended", children: [
3797
- /* @__PURE__ */ n(_e, { language: t, languages: i, onChange: r }),
3882
+ ), P = o === "voice" || o === "text_and_voice", C = o === "text" || o === "text_and_voice", _ = /* @__PURE__ */ v("div", { className: "rqmii-chat-topbar-actions rqmii-chat-topbar-actions--ended", children: [
3883
+ /* @__PURE__ */ n(Ge, { language: t, languages: i, onChange: r }),
3798
3884
  /* @__PURE__ */ n(
3799
3885
  "button",
3800
3886
  {
3801
3887
  type: "button",
3802
3888
  className: "rqmii-chat-circle-button",
3803
3889
  onClick: c,
3804
- "aria-label": F(t, "minimize"),
3805
- children: /* @__PURE__ */ n(Ee, { size: 20 })
3890
+ "aria-label": z(t, "minimize"),
3891
+ children: /* @__PURE__ */ n(xe, { size: 20 })
3806
3892
  }
3807
3893
  ),
3808
- S && /* @__PURE__ */ n(
3894
+ P && /* @__PURE__ */ n(
3809
3895
  "button",
3810
3896
  {
3811
3897
  type: "button",
3812
3898
  className: "rqmii-chat-circle-button rqmii-chat-circle-button--call-start",
3813
- onClick: d,
3899
+ onClick: l,
3814
3900
  disabled: m,
3815
- "aria-label": F(t, "startVoice"),
3816
- children: m ? /* @__PURE__ */ n(ye, { className: "rqmii-chat-spin", size: 20 }) : /* @__PURE__ */ n(Ie, { size: 20 })
3901
+ "aria-label": z(t, "startVoice"),
3902
+ children: m ? /* @__PURE__ */ n(ze, { className: "rqmii-chat-spin", size: 20 }) : /* @__PURE__ */ n(je, { size: 20 })
3817
3903
  }
3818
3904
  )
3819
3905
  ] });
3820
- return s === "voice" ? /* @__PURE__ */ f("div", { className: V("rqmii-chat-panel rqmii-chat-panel--voice-call", H(t)), style: k, children: [
3821
- /* @__PURE__ */ f("div", { className: "rqmii-chat-topbar", children: [
3822
- /* @__PURE__ */ n("span", {}),
3823
- M
3824
- ] }),
3825
- /* @__PURE__ */ f("div", { className: "rqmii-chat-voice-frame", children: [
3826
- /* @__PURE__ */ n(J, { agent: e, size: "hero" }),
3827
- /* @__PURE__ */ n("div", { className: "rqmii-chat-agent-name", children: e.name }),
3828
- p
3829
- ] }),
3830
- /* @__PURE__ */ n(le, { language: t, agent: e })
3831
- ] }) : /* @__PURE__ */ f("div", { className: V("rqmii-chat-panel rqmii-chat-panel--conversation", H(t)), style: k, children: [
3832
- /* @__PURE__ */ f("div", { className: "rqmii-chat-topbar", children: [
3833
- /* @__PURE__ */ n(J, { agent: e, size: "header" }),
3834
- M
3906
+ if (o === "voice")
3907
+ return /* @__PURE__ */ v("div", { className: V("rqmii-chat-panel rqmii-chat-panel--voice-call", Z()), style: p, children: [
3908
+ /* @__PURE__ */ v("div", { className: "rqmii-chat-topbar", children: [
3909
+ /* @__PURE__ */ n("span", {}),
3910
+ _
3911
+ ] }),
3912
+ /* @__PURE__ */ v("div", { className: "rqmii-chat-voice-frame", children: [
3913
+ /* @__PURE__ */ n(te, { agent: e, size: "hero" }),
3914
+ /* @__PURE__ */ n("div", { className: "rqmii-chat-agent-name", children: e.name }),
3915
+ f
3916
+ ] }),
3917
+ /* @__PURE__ */ n(ue, { language: t, agent: e })
3918
+ ] });
3919
+ const x = e.widget?.appearance?.show_topbar_avatar_image !== !1;
3920
+ return /* @__PURE__ */ v("div", { className: V("rqmii-chat-panel rqmii-chat-panel--conversation", Z()), style: p, children: [
3921
+ /* @__PURE__ */ v("div", { className: "rqmii-chat-topbar", children: [
3922
+ x ? /* @__PURE__ */ n(te, { agent: e, size: "header" }) : /* @__PURE__ */ n("span", {}),
3923
+ _
3835
3924
  ] }),
3836
- /* @__PURE__ */ n(Re, { messages: o, language: t }),
3837
- p,
3838
- T && /* @__PURE__ */ n(Te, { language: t, onSend: l }),
3839
- /* @__PURE__ */ n(le, { language: t, agent: e })
3925
+ /* @__PURE__ */ n(Ue, { messages: s, language: t }),
3926
+ f,
3927
+ C && /* @__PURE__ */ n(Me, { language: t, onSend: d }),
3928
+ /* @__PURE__ */ n(ue, { language: t, agent: e })
3840
3929
  ] });
3841
- }), ua = j.memo(function({ agent: e, language: t, onClose: i }) {
3842
- const { streamingUrl: s, isCloudStreamConnected: o, cloudStreamError: r } = Oe(), { isAvatarSpeaking: c } = Oe(), { messages: d, sendTextMessage: l } = de();
3843
- return /* @__PURE__ */ f("div", { className: V("rqmii-avatar-panel", H(t)), children: [
3844
- /* @__PURE__ */ f("div", { className: "rqmii-avatar-stream", children: [
3845
- /* @__PURE__ */ n(j.Suspense, { fallback: /* @__PURE__ */ n("div", { className: "rqmii-avatar-overlay", children: F(t, "loading") }), children: /* @__PURE__ */ n(Mn, { autoConnect: !0, muted: !1 }) }),
3846
- !s && /* @__PURE__ */ n("div", { className: "rqmii-avatar-overlay", children: F(t, "loading") }),
3847
- r && /* @__PURE__ */ n("div", { className: "rqmii-avatar-overlay", children: F(t, "connectionFailed") }),
3848
- /* @__PURE__ */ f("div", { className: "rqmii-avatar-controls", children: [
3849
- /* @__PURE__ */ n(J, { agent: e, size: "header", active: c }),
3930
+ }), ba = A.memo(function({ agent: e, language: t, onClose: i }) {
3931
+ const { streamingUrl: o, isCloudStreamConnected: s, cloudStreamError: r } = He(), { isAvatarSpeaking: c } = He(), { messages: l, sendTextMessage: d } = ge();
3932
+ return /* @__PURE__ */ v("div", { className: V("rqmii-avatar-panel", Z()), children: [
3933
+ /* @__PURE__ */ v("div", { className: "rqmii-avatar-stream", children: [
3934
+ /* @__PURE__ */ n(A.Suspense, { fallback: /* @__PURE__ */ n("div", { className: "rqmii-avatar-overlay", children: z(t, "loading") }), children: /* @__PURE__ */ n(In, { autoConnect: !0, muted: !1 }) }),
3935
+ !o && /* @__PURE__ */ n("div", { className: "rqmii-avatar-overlay", children: z(t, "loading") }),
3936
+ r && /* @__PURE__ */ n("div", { className: "rqmii-avatar-overlay", children: z(t, "connectionFailed") }),
3937
+ /* @__PURE__ */ v("div", { className: "rqmii-avatar-controls", children: [
3938
+ /* @__PURE__ */ n(te, { agent: e, size: "header", active: c }),
3850
3939
  /* @__PURE__ */ n("div", { className: "rqmii-chat-header-spacer" }),
3851
- /* @__PURE__ */ n("button", { type: "button", className: "rqmii-chat-circle-button", disabled: !o, children: /* @__PURE__ */ n(Fe, { size: 20 }) }),
3852
- /* @__PURE__ */ n("button", { type: "button", className: "rqmii-chat-circle-button is-danger", onClick: i, children: /* @__PURE__ */ n(qe, { size: 20 }) })
3940
+ /* @__PURE__ */ n("button", { type: "button", className: "rqmii-chat-circle-button", disabled: !s, children: /* @__PURE__ */ n(Se, { size: 20 }) }),
3941
+ /* @__PURE__ */ n("button", { type: "button", className: "rqmii-chat-circle-button is-danger", onClick: i, children: /* @__PURE__ */ n(De, { size: 20 }) })
3853
3942
  ] })
3854
3943
  ] }),
3855
- e.useText && /* @__PURE__ */ f("div", { className: "rqmii-avatar-sidebar", children: [
3856
- /* @__PURE__ */ n(Re, { messages: d, language: t }),
3857
- /* @__PURE__ */ n(Te, { language: t, onSend: l, variant: "compact" }),
3858
- /* @__PURE__ */ n(le, { language: t, agent: e })
3944
+ e.useText && /* @__PURE__ */ v("div", { className: "rqmii-avatar-sidebar", children: [
3945
+ /* @__PURE__ */ n(Ue, { messages: l, language: t }),
3946
+ /* @__PURE__ */ n(Me, { language: t, onSend: d, variant: "compact" }),
3947
+ /* @__PURE__ */ n(ue, { language: t, agent: e })
3859
3948
  ] })
3860
3949
  ] });
3861
3950
  });
3862
- function jn({ language: a, config: e, onAccept: t, onDecline: i }) {
3863
- const s = e?.title?.[a] || F(a, "consentTitle"), o = e?.body?.[a] || F(a, "consentBody"), r = e?.acceptLabel?.[a] || F(a, "consentAccept"), c = e?.declineLabel?.[a] || F(a, "consentDecline"), d = e?.termsUrl?.[a], l = e?.privacyUrl?.[a];
3864
- return /* @__PURE__ */ f("div", { className: "rqmii-chat-panel rqmii-chat-panel--start", style: { justifyContent: "space-between" }, children: [
3865
- /* @__PURE__ */ f("div", { style: { flex: 1, display: "flex", flexDirection: "column", justifyContent: "center", padding: "24px", gap: "16px" }, children: [
3866
- /* @__PURE__ */ n("div", { style: { fontSize: "16px", fontWeight: 600, color: "var(--rqmii-text)" }, children: s }),
3867
- /* @__PURE__ */ f("div", { style: { fontSize: "13px", lineHeight: 1.5, color: "var(--rqmii-muted)" }, children: [
3868
- o,
3869
- (d || l) && /* @__PURE__ */ f("span", { children: [
3870
- " ",
3871
- d && /* @__PURE__ */ n("a", { href: d, target: "_blank", rel: "noopener noreferrer", style: { color: "var(--rqmii-action)", textDecoration: "underline" }, children: F(a, "consentTermsLink") }),
3872
- d && l && /* @__PURE__ */ f("span", { children: [
3873
- " ",
3874
- F(a, "close")?.toLowerCase() === "close" ? "and" : "و",
3875
- " "
3876
- ] }),
3877
- l && /* @__PURE__ */ n("a", { href: l, target: "_blank", rel: "noopener noreferrer", style: { color: "var(--rqmii-action)", textDecoration: "underline" }, children: F(a, "consentPrivacyLink") }),
3878
- "."
3879
- ] })
3880
- ] })
3881
- ] }),
3882
- /* @__PURE__ */ f("div", { style: { display: "flex", justifyContent: "flex-end", gap: "12px", padding: "0 24px 24px" }, children: [
3883
- /* @__PURE__ */ n(
3884
- "button",
3885
- {
3886
- type: "button",
3887
- className: "rqmii-chat-pill",
3888
- onClick: i,
3889
- style: { background: "transparent", border: "1px solid var(--rqmii-border)" },
3890
- children: c
3891
- }
3951
+ function Gn(a) {
3952
+ const e = a.trim(), t = e.toLowerCase();
3953
+ return t.startsWith("javascript:") || t.startsWith("data:") || t.startsWith("vbscript:") ? "#" : e;
3954
+ }
3955
+ function se(a) {
3956
+ const e = [], t = /(\[([^\]]+)\]\(([^)]+)\))|(\*\*([^*]+)\*\*|__([^_]+)__)|(\*([^*]+)\*|_([^_]+)_)|(~~([^~]+)~~)|(`([^`]+)`)/g;
3957
+ let i = 0, o;
3958
+ for (; (o = t.exec(a)) !== null; ) {
3959
+ o.index > i && e.push(a.slice(i, o.index));
3960
+ const s = `inline-${o.index}-${o[0]}`;
3961
+ if (o[1]) {
3962
+ const r = o[2], c = o[3];
3963
+ e.push(
3964
+ /* @__PURE__ */ n(
3965
+ "a",
3966
+ {
3967
+ href: Gn(c),
3968
+ target: "_blank",
3969
+ rel: "noopener noreferrer",
3970
+ className: "rqmii-markdown-link",
3971
+ children: se(r)
3972
+ },
3973
+ s
3974
+ )
3975
+ );
3976
+ } else if (o[4]) {
3977
+ const r = o[5] || o[6];
3978
+ e.push(
3979
+ /* @__PURE__ */ n("strong", { className: "rqmii-markdown-strong", children: se(r) }, s)
3980
+ );
3981
+ } else if (o[7]) {
3982
+ const r = o[8] || o[9];
3983
+ e.push(
3984
+ /* @__PURE__ */ n("em", { className: "rqmii-markdown-em", children: se(r) }, s)
3985
+ );
3986
+ } else if (o[10]) {
3987
+ const r = o[11];
3988
+ e.push(
3989
+ /* @__PURE__ */ n("del", { className: "rqmii-markdown-del", children: se(r) }, s)
3990
+ );
3991
+ } else if (o[12]) {
3992
+ const r = o[13];
3993
+ e.push(
3994
+ /* @__PURE__ */ n("code", { className: "rqmii-markdown-code", children: r }, s)
3995
+ );
3996
+ }
3997
+ i = t.lastIndex;
3998
+ }
3999
+ return i < a.length && e.push(a.slice(i)), e;
4000
+ }
4001
+ function ia(a, e) {
4002
+ const t = a.split(`
4003
+ `);
4004
+ return t.length === 1 ? se(t[0]) : t.map((i, o) => /* @__PURE__ */ v(A.Fragment, { children: [
4005
+ o > 0 && /* @__PURE__ */ n("br", {}),
4006
+ se(i)
4007
+ ] }, `${e}-ln-${o}`));
4008
+ }
4009
+ function Un({
4010
+ content: a,
4011
+ className: e = ""
4012
+ }) {
4013
+ if (!a || !a.trim()) return null;
4014
+ const t = a.replace(/\r\n/g, `
4015
+ `).split(/\n{2,}/), i = [];
4016
+ return t.forEach((o, s) => {
4017
+ const r = o.trim();
4018
+ if (!r) return;
4019
+ const c = `block-${s}`;
4020
+ if (r.startsWith("#")) {
4021
+ const l = r.match(/^(#{1,6})\s+(.+)$/s);
4022
+ if (l) {
4023
+ const d = l[1].length, m = l[2].trim(), u = se(m);
4024
+ d === 1 ? i.push(/* @__PURE__ */ n("h3", { className: "rqmii-markdown-h1", children: u }, c)) : d === 2 ? i.push(/* @__PURE__ */ n("h4", { className: "rqmii-markdown-h2", children: u }, c)) : i.push(/* @__PURE__ */ n("h5", { className: "rqmii-markdown-h3", children: u }, c));
4025
+ return;
4026
+ }
4027
+ }
4028
+ if (r.startsWith(">")) {
4029
+ const l = r.split(`
4030
+ `).map((d) => d.replace(/^>\s?/, "")).join(`
4031
+ `);
4032
+ i.push(
4033
+ /* @__PURE__ */ n("blockquote", { className: "rqmii-markdown-blockquote", children: ia(l, c) }, c)
4034
+ );
4035
+ return;
4036
+ }
4037
+ if (/^[-*]\s+/m.test(r)) {
4038
+ const l = r.split(`
4039
+ `);
4040
+ if (l.every((m) => /^[-*]\s+/.test(m.trim()) || m.trim() === "")) {
4041
+ const m = l.map((u) => u.trim().replace(/^[-*]\s+/, "")).filter(Boolean);
4042
+ i.push(
4043
+ /* @__PURE__ */ n("ul", { className: "rqmii-markdown-ul", children: m.map((u, h) => /* @__PURE__ */ n("li", { children: se(u) }, `${c}-li-${h}`)) }, c)
4044
+ );
4045
+ return;
4046
+ }
4047
+ }
4048
+ if (/^\d+\.\s+/m.test(r)) {
4049
+ const l = r.split(`
4050
+ `);
4051
+ if (l.every((m) => /^\d+\.\s+/.test(m.trim()) || m.trim() === "")) {
4052
+ const m = l.map((u) => u.trim().replace(/^\d+\.\s+/, "")).filter(Boolean);
4053
+ i.push(
4054
+ /* @__PURE__ */ n("ol", { className: "rqmii-markdown-ol", children: m.map((u, h) => /* @__PURE__ */ n("li", { children: se(u) }, `${c}-li-${h}`)) }, c)
4055
+ );
4056
+ return;
4057
+ }
4058
+ }
4059
+ i.push(
4060
+ /* @__PURE__ */ n("p", { className: "rqmii-markdown-p", children: ia(r, c) }, c)
4061
+ );
4062
+ }), /* @__PURE__ */ n("div", { className: `rqmii-markdown ${e}`.trim(), children: i });
4063
+ }
4064
+ const Kn = A.memo(Un);
4065
+ function On({
4066
+ language: a,
4067
+ content: e,
4068
+ config: t,
4069
+ agent: i,
4070
+ onAccept: o,
4071
+ onDecline: s
4072
+ }) {
4073
+ const r = e || t?.body?.[a] || z(a, "consentBody") || "", c = t?.acceptLabel?.[a] || z(a, "consentAccept"), l = t?.declineLabel?.[a] || z(a, "consentDecline");
4074
+ return /* @__PURE__ */ v(
4075
+ "div",
4076
+ {
4077
+ className: V(
4078
+ "rqmii-chat-panel rqmii-chat-panel--start rqmii-chat-panel--consent",
4079
+ Z()
3892
4080
  ),
3893
- /* @__PURE__ */ n(
3894
- "button",
3895
- {
3896
- type: "button",
3897
- className: "rqmii-chat-pill",
3898
- onClick: t,
3899
- style: { background: "#fff", color: "#000" },
3900
- children: r
3901
- }
3902
- )
3903
- ] })
3904
- ] });
4081
+ dir: re(a),
4082
+ children: [
4083
+ /* @__PURE__ */ n("div", { className: "rqmii-chat-consent-body", children: /* @__PURE__ */ n(Kn, { content: r }) }),
4084
+ /* @__PURE__ */ v("div", { className: "rqmii-chat-consent-actions", children: [
4085
+ /* @__PURE__ */ n(
4086
+ "button",
4087
+ {
4088
+ type: "button",
4089
+ className: "rqmii-chat-consent-button rqmii-chat-consent-button--decline",
4090
+ onClick: s,
4091
+ children: l
4092
+ }
4093
+ ),
4094
+ /* @__PURE__ */ n(
4095
+ "button",
4096
+ {
4097
+ type: "button",
4098
+ className: "rqmii-chat-consent-button rqmii-chat-consent-button--accept",
4099
+ onClick: o,
4100
+ children: c
4101
+ }
4102
+ )
4103
+ ] })
4104
+ ]
4105
+ }
4106
+ );
3905
4107
  }
3906
- function Dn(a) {
4108
+ function Yn(a) {
3907
4109
  return a ? typeof a == "string" ? a : typeof a == "object" && typeof a.text == "string" ? a.text : "" : "";
3908
4110
  }
3909
- function In(a) {
4111
+ function Qn(a) {
3910
4112
  return a === "text" || a === "voice" || a === "text_and_voice";
3911
4113
  }
3912
- const Be = j.memo(function({
4114
+ const Ke = A.memo(function({
3913
4115
  agent: e,
3914
4116
  language: t,
3915
4117
  languages: i,
3916
- onLanguageChange: s = ie,
3917
- onEndSession: o = ie,
4118
+ onLanguageChange: o = oe,
4119
+ onEndSession: s = oe,
3918
4120
  onMinimize: r,
3919
4121
  messages: c,
3920
- onSendMessage: d,
3921
- isPreview: l = !1,
4122
+ onSendMessage: l,
4123
+ isPreview: d = !1,
3922
4124
  chatKind: m,
3923
4125
  sdk: u,
3924
4126
  renderPanel: h,
3925
- messagesRef: z,
4127
+ messagesRef: F,
3926
4128
  initialText: b,
3927
- autoStartVoice: x
4129
+ autoStartVoice: M
3928
4130
  }) {
3929
- const [v, E] = y(!1), g = m || ve(e), [k, p] = y(() => g === "voice" && u.isSessionReady || g === "voice" && !!x), [S, T] = y(() => (g === "text" || g === "text_and_voice") && u.isSessionReady || !!b || g === "text_and_voice" && !!x), [M, P] = y(!1), [L, A] = y(!1), [C, D] = y(null), W = on(g === "voice" && k || g === "text_and_voice" && S), q = sn(), B = e.consent?.enabled && !v && !l, N = In(g), { events: U } = ue();
4131
+ const S = e.widget?.consent || e.consent, T = !!S?.enabled, k = S?.content?.[t] || S?.body?.[t] || "", p = S?.one_time !== !1, g = e.id ? `rqmii_consent_${e.id}` : null, [w, E] = y(() => {
4132
+ if (!T || !k) return !0;
4133
+ if (p && g && typeof window < "u")
4134
+ try {
4135
+ return window.localStorage.getItem(g) === "true";
4136
+ } catch {
4137
+ return !1;
4138
+ }
4139
+ return !1;
4140
+ }), f = m || Ee(e), [P, C] = y(() => f === "voice" && u.isSessionReady || f === "voice" && !!M), [_, x] = y(() => (f === "text" || f === "text_and_voice") && u.isSessionReady || !!b || f === "text_and_voice" && !!M), [j, R] = y(!1), [D, L] = y(!1), [G, N] = y(null), O = hn(f === "voice" && P || f === "text_and_voice" && _), U = gn(), J = T && !!k && !w && !d, X = Qn(f), { events: W } = pe();
3930
4141
  I(() => {
3931
- if (!U) return;
3932
- const K = () => {
3933
- N && we() && P(!0);
3934
- }, Z = () => {
3935
- N && P(!1);
4142
+ if (!W) return;
4143
+ const Q = () => {
4144
+ X && _e() && R(!0);
4145
+ }, be = () => {
4146
+ X && R(!1);
3936
4147
  };
3937
- return U.on("minimize_chat", K), U.on("maximize_chat", Z), () => {
3938
- U.off("minimize_chat", K), U.off("maximize_chat", Z);
4148
+ return W.on("minimize_chat", Q), W.on("maximize_chat", be), () => {
4149
+ W.off("minimize_chat", Q), W.off("maximize_chat", be);
3939
4150
  };
3940
- }, [U, N]);
3941
- const O = () => E(!0), Q = () => {
3942
- r ? r() : o();
3943
- }, X = (K) => {
3944
- s(K), l || u.changeSessionLanguage(K);
3945
- }, ne = se((K) => {
3946
- if (D(null), A(!0), d) {
3947
- d(K);
4151
+ }, [W, X]);
4152
+ const ee = ie(() => {
4153
+ if (p && g && typeof window < "u")
4154
+ try {
4155
+ window.localStorage.setItem(g, "true");
4156
+ } catch {
4157
+ }
4158
+ E(!0);
4159
+ }, [p, g]), K = ie(() => {
4160
+ r ? r() : s();
4161
+ }, [r, s]), me = (Q) => {
4162
+ o(Q), d || u.changeSessionLanguage(Q);
4163
+ }, ae = ie((Q) => {
4164
+ if (N(null), L(!0), l) {
4165
+ l(Q);
3948
4166
  return;
3949
4167
  }
3950
- u.sendTextMessage(K);
3951
- }, [d, u]);
4168
+ u.sendTextMessage(Q);
4169
+ }, [l, u]);
3952
4170
  I(() => {
3953
- z && (z.current = u.messages);
4171
+ F && (F.current = u.messages);
3954
4172
  });
3955
- const ee = _(!1);
4173
+ const le = B(!1);
3956
4174
  I(() => {
3957
- ee.current || (b ? (ee.current = !0, ne(b)) : x && (ee.current = !0, D(null), A(!0), u.isVoiceActive || u.startVoice()));
4175
+ le.current || (b ? (le.current = !0, ae(b)) : M && (le.current = !0, N(null), L(!0), u.isVoiceActive || u.startVoice()));
3958
4176
  }, []), I(() => {
3959
- L && u.isSessionReady && (A(!1), g === "voice" ? p(!0) : T(!0));
3960
- }, [L, u.isSessionReady, g]), I(() => {
3961
- L && u.error && (A(!1), D(u.error));
3962
- }, [L, u.error]);
3963
- const $ = se(() => {
3964
- D(null), A(!0), u.isVoiceActive || u.startVoice();
4177
+ D && u.isSessionReady && (L(!1), f === "voice" ? C(!0) : x(!0));
4178
+ }, [D, u.isSessionReady, f]), I(() => {
4179
+ D && u.error && (L(!1), N(u.error));
4180
+ }, [D, u.error]);
4181
+ const ce = ie(() => {
4182
+ N(null), L(!0), u.isVoiceActive || u.startVoice();
3965
4183
  }, [u]);
3966
- if (u.error && !l && (S || k)) return /* @__PURE__ */ n(la, { message: u.error, language: t, onClose: o });
3967
- if (B)
3968
- return /* @__PURE__ */ n(jn, { language: t, config: e.consent, onAccept: O, onDecline: Q });
3969
- const R = {
4184
+ if (u.error && !d && (_ || P)) return /* @__PURE__ */ n(ha, { message: u.error, language: t, onClose: s });
4185
+ if (J)
4186
+ return /* @__PURE__ */ n(
4187
+ On,
4188
+ {
4189
+ language: t,
4190
+ content: k,
4191
+ config: e.consent,
4192
+ agent: e,
4193
+ onAccept: ee,
4194
+ onDecline: K
4195
+ }
4196
+ );
4197
+ const he = {
3970
4198
  agent: e,
3971
4199
  language: t,
3972
4200
  languages: i,
3973
- chatKind: g,
4201
+ chatKind: f,
3974
4202
  sdk: u,
3975
- isPreview: l,
3976
- onLanguageChange: X,
3977
- onClose: o,
3978
- onMinimize: N ? () => P(!0) : void 0,
3979
- onRestore: N ? () => P(!1) : void 0,
3980
- onSend: ne,
3981
- voiceStarted: k,
3982
- conversationStarted: S,
3983
- isMinimized: M,
3984
- elapsed: W,
3985
- setVoiceStarted: p,
3986
- setConversationStarted: T
4203
+ isPreview: d,
4204
+ onLanguageChange: me,
4205
+ onClose: s,
4206
+ onMinimize: X ? () => R(!0) : void 0,
4207
+ onRestore: X ? () => R(!1) : void 0,
4208
+ onSend: ae,
4209
+ voiceStarted: P,
4210
+ conversationStarted: _,
4211
+ isMinimized: j,
4212
+ elapsed: O,
4213
+ setVoiceStarted: C,
4214
+ setConversationStarted: x
3987
4215
  };
3988
- return h ? /* @__PURE__ */ n(Ve, { children: h(R) }) : /* @__PURE__ */ n(qn, { ...R, connecting: L, connectError: C, visualViewportHeight: q, onCloseWidget: r ?? o, initiateVoice: $, onSendSuggestion: (K) => {
3989
- D(null), A(!0), u.sendSuggestion?.(K);
4216
+ return h ? /* @__PURE__ */ n(Te, { children: h(he) }) : /* @__PURE__ */ n(Hn, { ...he, connecting: D, connectError: G, visualViewportHeight: U, onCloseWidget: r ?? s, initiateVoice: ce, onSendSuggestion: (Q) => {
4217
+ N(null), L(!0), u.sendSuggestion?.(Q);
3990
4218
  } });
3991
- }), qn = j.memo(function({ agent: e, language: t, languages: i, chatKind: s, sdk: o, onLanguageChange: r, onClose: c, onMinimize: d, onRestore: l, onSend: m, voiceStarted: u, conversationStarted: h, isMinimized: z, elapsed: b, setVoiceStarted: x, setConversationStarted: v, visualViewportHeight: E, connecting: g = !1, connectError: k = null, onCloseWidget: p, initiateVoice: S, onSendSuggestion: T }) {
3992
- const M = e.widget?.behavior?.typing_indicator_enabled ?? !0, P = s === "text" ? o.waitingForResponse && M : !1, L = o.messages;
3993
- if (s === "avatar") return /* @__PURE__ */ n(ua, { agent: e, language: t, onClose: c });
3994
- if (z)
3995
- return /* @__PURE__ */ n(An, { agent: e, language: t, onRestore: l, onClose: c, isListening: o.isVoiceActive, isAudioPlaying: o.isAudioPlaying, isSpeaking: o.vad.isSpeaking, onToggleVoice: o.toggleVoice, elapsed: b, variant: s === "text" ? "text" : "voice" });
3996
- if (s === "voice" && u)
3997
- return /* @__PURE__ */ n(Ln, { agent: e, language: t, onEndSession: c, onMinimize: d, isListening: o.isVoiceActive, isLoading: o.vad.isLoading, isSpeaking: o.vad.isSpeaking, isAudioPlaying: o.isAudioPlaying, isAgentThinking: o.isAgentThinking, isAgentSpeaking: o.isAgentSpeaking, onToggleVoice: o.toggleVoice, elapsed: b, visualViewportHeight: E });
3998
- if (s === "voice")
3999
- return /* @__PURE__ */ n(Cn, { agent: e, language: t, languages: i, onLanguageChange: r, onClose: p, isAudioPlaying: o.isAudioPlaying, isVoiceSetupLoading: o.isVoiceSetupLoading || g, onStartVoice: S, visualViewportHeight: E });
4000
- if (!h && (o.messages.length === 0 || g)) {
4001
- const A = (e.widget?.behavior?.suggested_messages?.[t] || e.conversation?.suggested_messages?.[t])?.filter((G) => G.trim()) || void 0, C = (G) => {
4002
- o.sendSuggestion ? T(G) : m?.(G);
4003
- }, D = s === "text_and_voice" || ve(e) === "text_and_voice";
4004
- return /* @__PURE__ */ n(Pn, { agent: e, language: t, languages: i, onLanguageChange: r, onClose: p, onSend: m, isVoiceEnabled: D, isAudioPlaying: o.isAudioPlaying, isVoiceSetupLoading: o.isVoiceSetupLoading || g, onStartVoice: S, visualViewportHeight: E, disabled: g, error: k || void 0, suggestions: A, onSuggestionClick: C, compact: !!A });
4219
+ }), Hn = A.memo(function({ agent: e, language: t, languages: i, chatKind: o, sdk: s, onLanguageChange: r, onClose: c, onMinimize: l, onRestore: d, onSend: m, voiceStarted: u, conversationStarted: h, isMinimized: F, elapsed: b, setVoiceStarted: M, setConversationStarted: S, visualViewportHeight: T, connecting: k = !1, connectError: p = null, onCloseWidget: g, initiateVoice: w, onSendSuggestion: E }) {
4220
+ const f = e.widget?.behavior?.typing_indicator_enabled ?? !0, P = o === "text" ? s.waitingForResponse && f : !1, C = s.messages;
4221
+ if (o === "avatar") return /* @__PURE__ */ n(ba, { agent: e, language: t, onClose: c });
4222
+ if (F)
4223
+ return /* @__PURE__ */ n(Rn, { agent: e, language: t, onRestore: d, onClose: c, isListening: s.isVoiceActive, isAudioPlaying: s.isAudioPlaying, isSpeaking: s.vad.isSpeaking, onToggleVoice: s.toggleVoice, elapsed: b, variant: o === "text" ? "text" : "voice" });
4224
+ if (o === "voice" && u)
4225
+ return /* @__PURE__ */ n(Dn, { agent: e, language: t, onEndSession: c, onMinimize: l, isListening: s.isVoiceActive, isLoading: s.vad.isLoading, isSpeaking: s.vad.isSpeaking, isAudioPlaying: s.isAudioPlaying, isAgentThinking: s.isAgentThinking, isAgentSpeaking: s.isAgentSpeaking, onToggleVoice: s.toggleVoice, elapsed: b, visualViewportHeight: T });
4226
+ if (o === "voice")
4227
+ return /* @__PURE__ */ n(Nn, { agent: e, language: t, languages: i, onLanguageChange: r, onClose: g, isAudioPlaying: s.isAudioPlaying, isVoiceSetupLoading: s.isVoiceSetupLoading || k, onStartVoice: w, visualViewportHeight: T });
4228
+ if (!h && (s.messages.length === 0 || k)) {
4229
+ const _ = (e.widget?.behavior?.suggested_messages?.[t] || e.conversation?.suggested_messages?.[t])?.filter((R) => R.trim()) || void 0, x = (R) => {
4230
+ s.sendSuggestion ? E(R) : m?.(R);
4231
+ }, j = o === "text_and_voice" || Ee(e) === "text_and_voice";
4232
+ return /* @__PURE__ */ n(Vn, { agent: e, language: t, languages: i, onLanguageChange: r, onClose: g, onSend: m, isVoiceEnabled: j, isAudioPlaying: s.isAudioPlaying, isVoiceSetupLoading: s.isVoiceSetupLoading || k, onStartVoice: w, visualViewportHeight: T, disabled: k, error: p || void 0, suggestions: _, onSuggestionClick: x, compact: !!_ });
4005
4233
  }
4006
- return /* @__PURE__ */ n(wn, { agent: e, language: t, onEndSession: c, messages: L, partialTranscript: Dn(o.partialTranscript), onSend: m, isAudioPlaying: o.isAudioPlaying, isVoiceEnabled: s === "text_and_voice", isListening: o.isVoiceActive, isSpeaking: o.vad.isSpeaking, isLoading: o.vad.isLoading, isAgentThinking: o.isAgentThinking, isAgentSpeaking: o.isAgentSpeaking, onToggleVoice: o.toggleVoice, onStartVoice: o.startVoice, onMinimize: d, elapsed: b, visualViewportHeight: E, waitingForResponse: P });
4007
- }), Nn = { isListening: !1, isLoading: !1, isSpeaking: !1, toggle: async () => !1 };
4008
- function ma({ isSessionReady: a, sendTextMessage: e, messages: t }) {
4009
- const [i, s] = y(null), [o, r] = y(null), c = se(() => {
4010
- s((d) => (d && (a ? e(d) : r(d)), null));
4234
+ return /* @__PURE__ */ n(jn, { agent: e, language: t, onEndSession: c, messages: C, partialTranscript: Yn(s.partialTranscript), onSend: m, isAudioPlaying: s.isAudioPlaying, isVoiceEnabled: o === "text_and_voice", isListening: s.isVoiceActive, isSpeaking: s.vad.isSpeaking, isLoading: s.vad.isLoading, isAgentThinking: s.isAgentThinking, isAgentSpeaking: s.isAgentSpeaking, onToggleVoice: s.toggleVoice, onStartVoice: s.startVoice, onMinimize: l, elapsed: b, visualViewportHeight: T, waitingForResponse: P });
4235
+ }), Wn = { isListening: !1, isLoading: !1, isSpeaking: !1, toggle: async () => !1 };
4236
+ function fa({ isSessionReady: a, sendTextMessage: e, messages: t }) {
4237
+ const [i, o] = y(null), [s, r] = y(null), c = ie(() => {
4238
+ o((l) => (l && (a ? e(l) : r(l)), null));
4011
4239
  }, [a, e]);
4012
4240
  return I(() => {
4013
4241
  i && t.length !== 0 && c();
4014
4242
  }, [t, i, c]), I(() => {
4015
4243
  if (!i) return;
4016
- const d = setTimeout(c, 5e3);
4017
- return () => clearTimeout(d);
4244
+ const l = setTimeout(c, 5e3);
4245
+ return () => clearTimeout(l);
4018
4246
  }, [i, c]), I(() => {
4019
- !o || !a || (e(o), r(null));
4020
- }, [a, o, e]), { pendingWelcomeText: i, pendingMessage: o, setPendingWelcomeText: s, setPendingMessage: r, sendPendingWelcomeText: c };
4247
+ !s || !a || (e(s), r(null));
4248
+ }, [a, s, e]), { pendingWelcomeText: i, pendingMessage: s, setPendingWelcomeText: o, setPendingMessage: r, sendPendingWelcomeText: c };
4021
4249
  }
4022
- function Ge({ isSessionReady: a, signalClientReady: e }) {
4023
- const [t, i] = y(!1), [s, o] = y(void 0), r = _(!1);
4250
+ function Oe({ isSessionReady: a, signalClientReady: e }) {
4251
+ const [t, i] = y(!1), [o, s] = y(void 0), r = B(!1);
4024
4252
  return I(() => {
4025
- !a || r.current || !t || (r.current = !0, e(s), i(!1));
4026
- }, [a, t, s, e]), { emitClientReady: se((d) => {
4027
- a ? (r.current = !0, e(d)) : (o(d), i(!0));
4253
+ !a || r.current || !t || (r.current = !0, e(o), i(!1));
4254
+ }, [a, t, o, e]), { emitClientReady: ie((l) => {
4255
+ a ? (r.current = !0, e(l)) : (s(l), i(!0));
4028
4256
  }, [a, e]) };
4029
4257
  }
4030
- const _n = 300;
4031
- function Rn(a) {
4032
- const { isPreview: e = !1, ...t } = a, { messages: i, sendTextMessage: s, emitUserMessage: o, addLocalMessage: r, clearMessages: c } = de(), { changeSessionLanguage: d, clearSessionHistory: l, signalClientReady: m, error: u, isSessionReady: h, isAgentThinking: z, isAgentSpeaking: b } = ue(), x = _(!1), v = _(null), E = _(!1), [g, k] = y(!1), [p, S] = y(null), [T, M] = y(!1), P = _(i.length);
4258
+ const $n = 300;
4259
+ function Zn(a) {
4260
+ const { isPreview: e = !1, ...t } = a, { messages: i, sendTextMessage: o, emitUserMessage: s, addLocalMessage: r, clearMessages: c } = ge(), { changeSessionLanguage: l, clearSessionHistory: d, signalClientReady: m, error: u, isSessionReady: h, isAgentThinking: F, isAgentSpeaking: b } = pe(), M = B(!1), S = B(null), T = B(!1), [k, p] = y(!1), [g, w] = y(null), [E, f] = y(!1), P = B(i.length);
4033
4261
  I(() => {
4034
4262
  if (i.length > P.current) {
4035
- const q = i[i.length - 1];
4036
- q.role === "assistant" && q.streaming && M(!1);
4263
+ const L = i[i.length - 1];
4264
+ L.role === "assistant" && L.streaming && f(!1);
4037
4265
  }
4038
4266
  P.current = i.length;
4039
- }, [i]), aa("message_rate_limited", se(() => {
4040
- M(!1);
4267
+ }, [i]), oa("message_rate_limited", ie(() => {
4268
+ f(!1);
4041
4269
  }, [])), I(() => {
4042
- if (!h || !g || E.current) return;
4043
- const q = v.current;
4044
- if (q === null) return;
4045
- E.current = !0, v.current = null, r("user", q), S(null);
4046
- const B = a.agent.welcomeMessages?.[a.language];
4047
- m(B ? { welcomeMessage: B } : void 0);
4270
+ if (!h || !k || T.current) return;
4271
+ const L = S.current;
4272
+ if (L === null) return;
4273
+ T.current = !0, S.current = null, r("user", L), w(null);
4274
+ const G = a.agent.welcomeMessages?.[a.language];
4275
+ m(G ? { welcomeMessage: G } : void 0);
4048
4276
  const N = setTimeout(() => {
4049
- o(q), M(!0);
4050
- }, _n);
4277
+ s(L), f(!0);
4278
+ }, $n);
4051
4279
  return () => clearTimeout(N);
4052
- }, [h, g, m, o, r]);
4053
- const L = te(() => p ? [{ id: "first-user", role: "user", text: p }, ...i] : i, [p, i]), A = se(() => {
4054
- S(null), c();
4055
- }, [c]), C = {
4280
+ }, [h, k, m, s, r]);
4281
+ const C = $(() => g ? [{ id: "first-user", role: "user", text: g }, ...i] : i, [g, i]), _ = ie(() => {
4282
+ w(null), c();
4283
+ }, [c]), x = {
4056
4284
  emitClientReady: m,
4057
- sendMessage: (q) => {
4058
- s(q);
4285
+ sendMessage: (L) => {
4286
+ o(L);
4059
4287
  },
4060
- queueForWelcome: ie,
4061
- enableVoice: ie,
4062
- disableVoice: ie,
4288
+ queueForWelcome: oe,
4289
+ enableVoice: oe,
4290
+ disableVoice: oe,
4063
4291
  language: a.language,
4064
4292
  isSessionReady: h,
4065
4293
  supportsVoice: !1,
4066
4294
  isVoiceActive: !1,
4067
4295
  chatKind: "text"
4068
- }, D = (q, B) => {
4069
- a.onSessionStart?.(), x.current ? (M(!0), B.sendMessage(q)) : (x.current = !0, S(q), v.current = q, k(!0), M(!0));
4070
- }, G = (q) => {
4071
- a.onTextSend ? a.onTextSend(q, C) : D(q, C);
4296
+ }, j = (L, G) => {
4297
+ a.onSessionStart?.(), M.current ? (f(!0), G.sendMessage(L)) : (M.current = !0, w(L), S.current = L, p(!0), f(!0));
4298
+ }, R = (L) => {
4299
+ a.onTextSend ? a.onTextSend(L, x) : j(L, x);
4072
4300
  };
4073
4301
  return /* @__PURE__ */ n(
4074
- Be,
4302
+ Ke,
4075
4303
  {
4076
4304
  ...t,
4077
4305
  isPreview: e,
4078
4306
  chatKind: "text",
4079
4307
  sdk: {
4080
- messages: L,
4081
- sendTextMessage: G,
4082
- clearMessages: A,
4083
- clearSessionHistory: l,
4308
+ messages: C,
4309
+ sendTextMessage: R,
4310
+ clearMessages: _,
4311
+ clearSessionHistory: d,
4084
4312
  isAudioPlaying: !1,
4085
4313
  partialTranscript: null,
4086
- changeSessionLanguage: d,
4314
+ changeSessionLanguage: l,
4087
4315
  error: u,
4088
- isAgentThinking: z,
4316
+ isAgentThinking: F,
4089
4317
  isAgentSpeaking: b,
4090
4318
  isVoiceSetupLoading: !1,
4091
4319
  isVoiceActive: !1,
4092
4320
  isSessionReady: h,
4093
- vad: Nn,
4094
- startVoice: ie,
4095
- prepareVoice: ie,
4096
- toggleVoice: ie,
4321
+ vad: Wn,
4322
+ startVoice: oe,
4323
+ prepareVoice: oe,
4324
+ toggleVoice: oe,
4097
4325
  signalClientReady: m,
4098
- waitingForResponse: T,
4099
- sendSuggestion: G
4326
+ waitingForResponse: E,
4327
+ sendSuggestion: R
4100
4328
  }
4101
4329
  }
4102
4330
  );
4103
4331
  }
4104
- function Bn(a) {
4105
- const { isPreview: e = !1, ...t } = a, { messages: i, sendTextMessage: s, clearMessages: o } = de(), { isAudioPlaying: r, partialTranscript: c } = ta(), { changeSessionLanguage: d, clearSessionHistory: l, signalClientReady: m, error: u, isSessionReady: h, isAgentThinking: z, isAgentSpeaking: b } = ue(), { setPendingWelcomeText: x, setPendingMessage: v } = ma({ isSessionReady: h, sendTextMessage: s, messages: i }), { emitClientReady: E } = Ge({ isSessionReady: h, signalClientReady: m }), [g, k] = y(!1), p = na({
4332
+ function Jn(a) {
4333
+ const { isPreview: e = !1, ...t } = a, { messages: i, sendTextMessage: o, clearMessages: s } = ge(), { isAudioPlaying: r, partialTranscript: c } = sa(), { changeSessionLanguage: l, clearSessionHistory: d, signalClientReady: m, error: u, isSessionReady: h, isAgentThinking: F, isAgentSpeaking: b } = pe(), { setPendingWelcomeText: M, setPendingMessage: S } = fa({ isSessionReady: h, sendTextMessage: o, messages: i }), { emitClientReady: T } = Oe({ isSessionReady: h, signalClientReady: m }), [k, p] = y(!1), g = ra({
4106
4334
  enabled: !0,
4107
4335
  preloadStream: !1
4108
- }), { isLoading: S, isListening: T, toggle: M } = p, P = S, L = T || g;
4336
+ }), { isLoading: w, isListening: E, toggle: f } = g, P = w, C = E || k;
4109
4337
  I(() => {
4110
- !g || !h || S || T || M();
4111
- }, [g, h, S, T, M]);
4112
- const A = () => {
4338
+ !k || !h || w || E || f();
4339
+ }, [k, h, w, E, f]);
4340
+ const _ = () => {
4113
4341
  a.onSessionStart?.();
4114
- }, C = {
4115
- emitClientReady: E,
4342
+ }, x = {
4343
+ emitClientReady: T,
4116
4344
  sendMessage: (N) => {
4117
- h ? s(N) : v(N);
4345
+ h ? o(N) : S(N);
4118
4346
  },
4119
- queueForWelcome: (N) => x(N),
4120
- enableVoice: () => k(!0),
4347
+ queueForWelcome: (N) => M(N),
4348
+ enableVoice: () => p(!0),
4121
4349
  disableVoice: () => {
4122
- k(!1), T && M();
4350
+ p(!1), E && f();
4123
4351
  },
4124
4352
  language: a.language,
4125
4353
  isSessionReady: h,
4126
4354
  supportsVoice: !0,
4127
- isVoiceActive: L,
4355
+ isVoiceActive: C,
4128
4356
  chatKind: "voice"
4129
- }, D = (N) => {
4130
- A(), N.enableVoice();
4131
- const U = a.agent.welcomeMessages?.[a.language];
4132
- N.emitClientReady(U ? { welcomeMessage: U } : void 0);
4133
- }, G = (N) => {
4357
+ }, j = (N) => {
4358
+ _(), N.enableVoice();
4359
+ const Y = a.agent.welcomeMessages?.[a.language];
4360
+ N.emitClientReady(Y ? { welcomeMessage: Y } : void 0);
4361
+ }, R = (N) => {
4134
4362
  N.isVoiceActive ? N.disableVoice() : N.enableVoice();
4135
4363
  };
4136
4364
  return /* @__PURE__ */ n(
4137
- Be,
4365
+ Ke,
4138
4366
  {
4139
4367
  ...t,
4140
4368
  isPreview: e,
@@ -4143,439 +4371,502 @@ function Bn(a) {
4143
4371
  messages: i,
4144
4372
  sendTextMessage: () => {
4145
4373
  },
4146
- clearMessages: o,
4147
- clearSessionHistory: l,
4374
+ clearMessages: s,
4375
+ clearSessionHistory: d,
4148
4376
  isAudioPlaying: r,
4149
4377
  partialTranscript: c,
4150
- changeSessionLanguage: d,
4378
+ changeSessionLanguage: l,
4151
4379
  error: u,
4152
- isAgentThinking: z,
4380
+ isAgentThinking: F,
4153
4381
  isAgentSpeaking: b,
4154
4382
  isVoiceSetupLoading: P,
4155
- isVoiceActive: L,
4383
+ isVoiceActive: C,
4156
4384
  isSessionReady: h,
4157
- vad: p,
4385
+ vad: g,
4158
4386
  startVoice: () => {
4159
- a.onVoiceStart ? a.onVoiceStart(C) : D(C);
4387
+ a.onVoiceStart ? a.onVoiceStart(x) : j(x);
4160
4388
  },
4161
4389
  prepareVoice: () => {
4162
4390
  },
4163
4391
  toggleVoice: () => {
4164
- a.onVoiceToggle ? a.onVoiceToggle(C) : G(C);
4392
+ a.onVoiceToggle ? a.onVoiceToggle(x) : R(x);
4165
4393
  },
4166
4394
  signalClientReady: m
4167
4395
  }
4168
4396
  }
4169
4397
  );
4170
4398
  }
4171
- const Gn = 300;
4172
- function Un(a) {
4173
- const { isPreview: e = !1, ...t } = a, { messages: i, sendTextMessage: s, emitUserMessage: o, addLocalMessage: r, clearMessages: c } = de(), { isAudioPlaying: d, partialTranscript: l } = ta(), { changeSessionLanguage: m, clearSessionHistory: u, signalClientReady: h, error: z, isSessionReady: b, isAgentThinking: x, isAgentSpeaking: v } = ue(), { emitClientReady: E } = Ge({ isSessionReady: b, signalClientReady: h }), [g, k] = y(!1), p = _(null), [S, T] = y(!1), M = _(null), [P, L] = y(!1), A = _(!1), C = _(!1), D = _(!1), [G, W] = y(null), [q, B] = y(!1), N = _(i.length);
4399
+ const Xn = 300;
4400
+ function ei(a) {
4401
+ const { isPreview: e = !1, ...t } = a, { messages: i, sendTextMessage: o, emitUserMessage: s, addLocalMessage: r, clearMessages: c } = ge(), { isAudioPlaying: l, partialTranscript: d } = sa(), { changeSessionLanguage: m, clearSessionHistory: u, signalClientReady: h, error: F, isSessionReady: b, isAgentThinking: M, isAgentSpeaking: S } = pe(), { emitClientReady: T } = Oe({ isSessionReady: b, signalClientReady: h }), [k, p] = y(!1), g = B(null), [w, E] = y(!1), f = B(null), [P, C] = y(!1), _ = B(!1), x = B(!1), j = B(!1), [R, D] = y(null), [L, G] = y(!1), N = B(i.length);
4174
4402
  I(() => {
4175
4403
  if (i.length > N.current) {
4176
- const w = i[i.length - 1];
4177
- w.role === "assistant" && w.streaming && B(!1);
4404
+ const q = i[i.length - 1];
4405
+ q.role === "assistant" && q.streaming && G(!1);
4178
4406
  }
4179
4407
  N.current = i.length;
4180
- }, [i]), aa("message_rate_limited", se(() => {
4181
- B(!1);
4408
+ }, [i]), oa("message_rate_limited", ie(() => {
4409
+ G(!1);
4182
4410
  }, []));
4183
- const U = na({
4411
+ const Y = ra({
4184
4412
  enabled: !0,
4185
4413
  preloadStream: !1
4186
- }), { isLoading: O, isListening: Q, toggle: X } = U, ne = O, ee = Q || g;
4414
+ }), { isLoading: O, isListening: U, toggle: J } = Y, X = O, W = U || k;
4187
4415
  I(() => {
4188
- !g || !b || O || Q || X();
4189
- }, [g, b, O, Q, X]), I(() => {
4190
- if (!b || !S || D.current) return;
4191
- const w = p.current;
4192
- if (w === null) return;
4193
- D.current = !0, p.current = null, r("user", w), W(null);
4194
- const ae = a.agent.welcomeMessages?.[a.language];
4195
- h(ae ? { welcomeMessage: ae } : void 0);
4196
- const xe = setTimeout(() => {
4197
- o(w), B(!0);
4198
- }, Gn);
4199
- return () => clearTimeout(xe);
4200
- }, [b, S, h, o, r]), I(() => {
4201
- if (!b || !P || A.current) return;
4202
- const w = M.current;
4203
- w !== null && (A.current = !0, M.current = null, r("user", w), o(w), B(!0), L(!1));
4204
- }, [b, P, o, r]);
4205
- const $ = te(() => G ? [{ id: "first-user", role: "user", text: G }, ...i] : i, [G, i]), R = se(() => {
4206
- W(null), C.current = !1, D.current = !1, c();
4207
- }, [c]), K = () => {
4416
+ !k || !b || O || U || J();
4417
+ }, [k, b, O, U, J]), I(() => {
4418
+ if (!b || !w || j.current) return;
4419
+ const q = g.current;
4420
+ if (q === null) return;
4421
+ j.current = !0, g.current = null, r("user", q), D(null);
4422
+ const ne = a.agent.welcomeMessages?.[a.language];
4423
+ h(ne ? { welcomeMessage: ne } : void 0);
4424
+ const Pe = setTimeout(() => {
4425
+ s(q), G(!0);
4426
+ }, Xn);
4427
+ return () => clearTimeout(Pe);
4428
+ }, [b, w, h, s, r]), I(() => {
4429
+ if (!b || !P || _.current) return;
4430
+ const q = f.current;
4431
+ q !== null && (_.current = !0, f.current = null, r("user", q), s(q), G(!0), C(!1));
4432
+ }, [b, P, s, r]);
4433
+ const ee = $(() => R ? [{ id: "first-user", role: "user", text: R }, ...i] : i, [R, i]), K = ie(() => {
4434
+ D(null), x.current = !1, j.current = !1, c();
4435
+ }, [c]), me = () => {
4208
4436
  a.onSessionStart?.();
4209
- }, Z = {
4210
- emitClientReady: (w) => {
4211
- D.current = !0, C.current = !0, E(w);
4437
+ }, ae = {
4438
+ emitClientReady: (q) => {
4439
+ j.current = !0, x.current = !0, T(q);
4212
4440
  },
4213
- sendMessage: (w) => {
4214
- s(w);
4441
+ sendMessage: (q) => {
4442
+ o(q);
4215
4443
  },
4216
4444
  queueForWelcome: () => {
4217
4445
  },
4218
- enableVoice: () => k(!0),
4446
+ enableVoice: () => p(!0),
4219
4447
  disableVoice: () => {
4220
- k(!1), Q && X();
4448
+ p(!1), U && J();
4221
4449
  },
4222
4450
  language: a.language,
4223
4451
  isSessionReady: b,
4224
4452
  supportsVoice: !0,
4225
- isVoiceActive: ee,
4453
+ isVoiceActive: W,
4226
4454
  chatKind: "text_and_voice"
4227
- }, ke = (w, ae) => {
4228
- K(), !C.current && !D.current ? (C.current = !0, a.onStartText?.(), W(w), p.current = w, T(!0), B(!0)) : (C.current = !0, B(!0), ae.sendMessage(w));
4229
- }, ce = (w) => {
4230
- K(), C.current = !0, D.current = !0, a.onStartVoice?.(), w.enableVoice();
4231
- const ae = a.agent.welcomeMessages?.[a.language];
4232
- w.emitClientReady(ae ? { welcomeMessage: ae } : void 0);
4233
- }, fe = (w) => {
4234
- w.isVoiceActive ? w.disableVoice() : w.enableVoice();
4235
- }, Se = {
4236
- messages: $,
4237
- sendTextMessage: (w) => {
4238
- a.onTextSend ? a.onTextSend(w, Z) : ke(w, Z);
4455
+ }, le = (q, ne) => {
4456
+ me(), !x.current && !j.current ? (x.current = !0, a.onStartText?.(), D(q), g.current = q, E(!0), G(!0)) : (x.current = !0, G(!0), ne.sendMessage(q));
4457
+ }, ce = (q) => {
4458
+ me(), x.current = !0, j.current = !0, a.onStartVoice?.(), q.enableVoice();
4459
+ const ne = a.agent.welcomeMessages?.[a.language];
4460
+ q.emitClientReady(ne ? { welcomeMessage: ne } : void 0);
4461
+ }, he = (q) => {
4462
+ q.isVoiceActive ? q.disableVoice() : q.enableVoice();
4463
+ }, we = {
4464
+ messages: ee,
4465
+ sendTextMessage: (q) => {
4466
+ a.onTextSend ? a.onTextSend(q, ae) : le(q, ae);
4239
4467
  },
4240
- clearMessages: R,
4468
+ clearMessages: K,
4241
4469
  clearSessionHistory: u,
4242
- isAudioPlaying: d,
4243
- partialTranscript: l,
4470
+ isAudioPlaying: l,
4471
+ partialTranscript: d,
4244
4472
  changeSessionLanguage: m,
4245
- error: z,
4246
- isAgentThinking: x,
4247
- isAgentSpeaking: v,
4248
- isVoiceSetupLoading: ne,
4249
- isVoiceActive: ee,
4473
+ error: F,
4474
+ isAgentThinking: M,
4475
+ isAgentSpeaking: S,
4476
+ isVoiceSetupLoading: X,
4477
+ isVoiceActive: W,
4250
4478
  isSessionReady: b,
4251
- vad: U,
4479
+ vad: Y,
4252
4480
  startVoice: () => {
4253
- a.onVoiceStart ? a.onVoiceStart(Z) : ce(Z);
4481
+ a.onVoiceStart ? a.onVoiceStart(ae) : ce(ae);
4254
4482
  },
4255
4483
  prepareVoice: () => {
4256
4484
  },
4257
4485
  toggleVoice: () => {
4258
- a.onVoiceToggle ? a.onVoiceToggle(Z) : fe(Z);
4486
+ a.onVoiceToggle ? a.onVoiceToggle(ae) : he(ae);
4259
4487
  },
4260
4488
  signalClientReady: h,
4261
- waitingForResponse: q,
4262
- sendSuggestion: (w) => {
4263
- K(), C.current = !0, D.current = !0, a.onStartVoice?.(), k(!0), M.current = w, L(!0);
4489
+ waitingForResponse: L,
4490
+ sendSuggestion: (q) => {
4491
+ me(), x.current = !0, j.current = !0, a.onStartVoice?.(), p(!0), f.current = q, C(!0);
4264
4492
  }
4265
4493
  };
4266
4494
  return /* @__PURE__ */ n(
4267
- Be,
4495
+ Ke,
4268
4496
  {
4269
4497
  ...t,
4270
4498
  isPreview: e,
4271
4499
  chatKind: a.textOnly ? "text" : "text_and_voice",
4272
- sdk: Se
4500
+ sdk: we
4273
4501
  }
4274
4502
  );
4275
4503
  }
4276
- function Kn(a) {
4277
- const { isPreview: e = !1, agent: t, language: i, languages: s, onLanguageChange: o, onEndSession: r, onMinimize: c, messages: d, onSendMessage: l } = a, m = r || c || ie, { messages: u, sendTextMessage: h, clearMessages: z } = de(), { changeSessionLanguage: b, clearSessionHistory: x, signalClientReady: v, error: E, isSessionReady: g, isAgentThinking: k, isAgentSpeaking: p } = ue();
4278
- return ma({ isSessionReady: g, sendTextMessage: h, messages: u }), Ge({ isSessionReady: g, signalClientReady: v }), E && !e ? /* @__PURE__ */ n(la, { message: E, language: i, onClose: m }) : /* @__PURE__ */ n(ua, { agent: t, language: i, onClose: m });
4504
+ function ai(a) {
4505
+ const { isPreview: e = !1, agent: t, language: i, languages: o, onLanguageChange: s, onEndSession: r, onMinimize: c, messages: l, onSendMessage: d } = a, m = r || c || oe, { messages: u, sendTextMessage: h, clearMessages: F } = ge(), { changeSessionLanguage: b, clearSessionHistory: M, signalClientReady: S, error: T, isSessionReady: k, isAgentThinking: p, isAgentSpeaking: g } = pe();
4506
+ return fa({ isSessionReady: k, sendTextMessage: h, messages: u }), Oe({ isSessionReady: k, signalClientReady: S }), T && !e ? /* @__PURE__ */ n(ha, { message: T, language: i, onClose: m }) : /* @__PURE__ */ n(ba, { agent: t, language: i, onClose: m });
4279
4507
  }
4280
- function Jn({ agent: a, defaultOpen: e = !1, className: t = "", preview: i = !1, ChatBoxComponent: s }) {
4281
- const [o, r] = j.useState(e), [c, d] = j.useState(a.defaultLanguage), l = te(() => pe(a.languages, a.defaultLanguage), [a.defaultLanguage, a.languages]);
4282
- return j.useEffect(() => {
4508
+ function ci({ agent: a, defaultOpen: e, className: t = "", preview: i = !1, ChatBoxComponent: o }) {
4509
+ const s = e !== void 0 ? e : a.widget?.behavior?.default_open ?? !1, [r, c] = A.useState(s), [l, d] = A.useState(a.defaultLanguage), m = $(() => ye(a.languages, a.defaultLanguage), [a.defaultLanguage, a.languages]);
4510
+ A.useEffect(() => {
4283
4511
  d(a.defaultLanguage);
4284
- }, [a.defaultLanguage]), /* @__PURE__ */ f("div", { className: V("rqmii-chat-surface", i && "is-preview", t), children: [
4285
- !o && /* @__PURE__ */ n(ra, { agent: a, onClick: () => r(!0), position: i ? "static" : "fixed" }),
4286
- o && /* @__PURE__ */ n(s, { agent: a, language: c, languages: l, onLanguageChange: d, onClose: () => r(!1), isPreview: i })
4287
- ] });
4512
+ }, [a.defaultLanguage]), A.useEffect(() => {
4513
+ c(s);
4514
+ }, [s]);
4515
+ const u = a.widget?.appearance?.theme?.mode === "light" ? "light" : "dark", h = $(() => Re(a.widget?.appearance), [a.widget?.appearance]);
4516
+ return /* @__PURE__ */ v(
4517
+ "div",
4518
+ {
4519
+ className: V("rqmii-chat-surface", `rqmii-theme-${u}`, i && "is-preview", t),
4520
+ "data-theme": u,
4521
+ style: h,
4522
+ children: [
4523
+ !r && /* @__PURE__ */ n(ma, { agent: a, onClick: () => c(!0), position: i ? "static" : "fixed" }),
4524
+ r && /* @__PURE__ */ n(o, { agent: a, language: l, languages: m, onLanguageChange: d, onClose: () => c(!1), isPreview: i })
4525
+ ]
4526
+ }
4527
+ );
4288
4528
  }
4289
- function On({ restUrl: a, identifier: e, fallbackAgent: t, withCredentials: i = !1, children: s, onError: o }) {
4290
- const [r, c] = y(() => t ? ge(t) : null), [d, l] = y(null);
4529
+ function ti({ restUrl: a, identifier: e, fallbackAgent: t, withCredentials: i = !1, children: o, onError: s }) {
4530
+ const [r, c] = y(() => t ? ve(t) : null), [l, d] = y(null);
4291
4531
  return I(() => {
4292
- t && (c(ge(t)), l(null));
4532
+ t && (c(ve(t)), d(null));
4293
4533
  }, [t]), I(() => {
4294
4534
  if (!e || t) return;
4295
4535
  const m = new AbortController();
4296
- return l(null), Ct({ restUrl: a, identifier: e, withCredentials: i, signal: m.signal }).then(c).catch((u) => {
4297
- m.signal.aborted || (l(u), o?.(u));
4536
+ return d(null), It({ restUrl: a, identifier: e, withCredentials: i, signal: m.signal }).then(c).catch((u) => {
4537
+ m.signal.aborted || (t || d(u), s?.(u));
4298
4538
  }), () => m.abort();
4299
- }, [t, e, o, a, i]), d ? /* @__PURE__ */ n("div", { className: "rqmii-chat-panel rqmii-chat-panel--error", children: d.message || "Could not load agent" }) : r ? /* @__PURE__ */ n(Ve, { children: s(r) }) : /* @__PURE__ */ n("div", { className: "rqmii-chat-panel rqmii-chat-panel--error", children: "Loading" });
4539
+ }, [t, e, s, a, i]), l ? /* @__PURE__ */ n("div", { className: "rqmii-chat-panel rqmii-chat-panel--error", children: l.message || "Could not load agent" }) : r ? /* @__PURE__ */ n(Te, { children: o(r) }) : /* @__PURE__ */ n("div", { className: "rqmii-chat-panel rqmii-chat-panel--error", children: "Loading" });
4300
4540
  }
4301
- function Ae({ agent: a, language: e, languages: t, onLanguageChange: i, onEndSession: s, onMinimize: o, onStartText: r, onStartVoice: c, textOnly: d, messages: l, onSendMessage: m, isPreview: u, onSessionStart: h, initialText: z, autoStartVoice: b }) {
4302
- const x = ve(a), v = { agent: a, language: e, languages: t, onLanguageChange: i, onEndSession: s, onMinimize: o, messages: l, onSendMessage: m, isPreview: u, onSessionStart: h, initialText: z, autoStartVoice: b };
4303
- switch (x) {
4541
+ function Ie({ agent: a, language: e, languages: t, onLanguageChange: i, onEndSession: o, onMinimize: s, onStartText: r, onStartVoice: c, textOnly: l, messages: d, onSendMessage: m, isPreview: u, onSessionStart: h, initialText: F, autoStartVoice: b }) {
4542
+ const M = Ee(a), S = { agent: a, language: e, languages: t, onLanguageChange: i, onEndSession: o, onMinimize: s, messages: d, onSendMessage: m, isPreview: u, onSessionStart: h, initialText: F, autoStartVoice: b };
4543
+ switch (M) {
4304
4544
  case "avatar":
4305
- return /* @__PURE__ */ n(Kn, { ...v });
4545
+ return /* @__PURE__ */ n(ai, { ...S });
4306
4546
  case "voice":
4307
- return /* @__PURE__ */ n(Bn, { ...v });
4547
+ return /* @__PURE__ */ n(Jn, { ...S });
4308
4548
  case "text_and_voice":
4309
- return /* @__PURE__ */ n(Un, { ...v, onStartText: r, onStartVoice: c, textOnly: d });
4549
+ return /* @__PURE__ */ n(ei, { ...S, onStartText: r, onStartVoice: c, textOnly: l });
4310
4550
  case "text":
4311
4551
  default:
4312
- return /* @__PURE__ */ n(Rn, { ...v });
4552
+ return /* @__PURE__ */ n(Zn, { ...S });
4313
4553
  }
4314
4554
  }
4315
- function Yn({
4555
+ function ni({
4316
4556
  agent: a,
4317
4557
  language: e,
4318
4558
  languages: t,
4319
4559
  startMode: i,
4320
- directive: s,
4321
- open: o,
4560
+ directive: o,
4561
+ open: s,
4322
4562
  onOpen: r,
4323
4563
  onLanguageChange: c,
4324
- onMinimize: d,
4325
- onStartNewSession: l,
4564
+ onMinimize: l,
4565
+ onStartNewSession: d,
4326
4566
  onSessionStart: m,
4327
4567
  onStartText: u,
4328
4568
  onStartVoice: h
4329
4569
  }) {
4330
- const { connectionState: z, isConnected: b, isSessionTerminated: x, creditExhausted: v, session: E, endSession: g, submitFeedback: k, interrupt: p } = ue(), { messages: S } = de(), T = _(!1), M = _(null), [P, L] = y(null), [A, C] = y(0), [D, G] = y(!1), [W, q] = y(!1), [B, N] = y(!1);
4570
+ const { connectionState: F, isConnected: b, isSessionTerminated: M, creditExhausted: S, session: T, endSession: k, submitFeedback: p, interrupt: g } = pe(), { messages: w } = ge(), E = B(!1), f = B(null), [P, C] = y(null), [_, x] = y(0), [j, R] = y(!1), [D, L] = y(!1), [G, N] = y(!1);
4331
4571
  I(() => {
4332
- b && (T.current = !0);
4572
+ b && (E.current = !0);
4333
4573
  }, [b]), I(() => {
4334
4574
  if (P) return;
4335
- let R = null;
4336
- x || z === "ended" ? R = M.current === "user" ? "user_ended" : "terminated" : z === "failed" ? v ? R = "credits_exhausted" : T.current ? R = "connection_lost" : R = "failed" : v && (R = "credits_exhausted"), R && L({
4337
- sessionId: E.sessionId,
4338
- endedBy: M.current ?? "agent",
4339
- reason: R
4575
+ let K = null;
4576
+ M || F === "ended" ? K = f.current === "user" ? "user_ended" : "terminated" : F === "failed" ? S ? K = "credits_exhausted" : E.current ? K = "connection_lost" : K = "failed" : S && (K = "credits_exhausted"), K && C({
4577
+ sessionId: T.sessionId,
4578
+ endedBy: f.current ?? "agent",
4579
+ reason: K
4340
4580
  });
4341
- }, [x, z, v, E.sessionId, P]);
4342
- const U = () => {
4343
- M.current = "user", p(), g();
4344
- }, O = P?.sessionId ?? null, Q = (R) => {
4345
- D || (C(R), O && k({ sessionId: O, rating: R, endedBy: P?.endedBy }).catch(() => {
4346
- }), B || (N(!0), q(!0)));
4347
- }, X = async (R) => {
4581
+ }, [M, F, S, T.sessionId, P]);
4582
+ const Y = () => {
4583
+ f.current = "user", g(), k();
4584
+ }, O = P?.sessionId ?? null, U = (K) => {
4585
+ j || (x(K), O && p({ sessionId: O, rating: K, endedBy: P?.endedBy }).catch(() => {
4586
+ }), G || (N(!0), L(!0)));
4587
+ }, J = async (K) => {
4348
4588
  if (O)
4349
4589
  try {
4350
- await k({ sessionId: O, feedback: R, endedBy: P?.endedBy });
4590
+ await p({ sessionId: O, feedback: K, endedBy: P?.endedBy });
4351
4591
  } catch {
4352
4592
  }
4353
- G(!0), q(!1);
4593
+ R(!0), L(!1);
4354
4594
  };
4355
- if (!o)
4356
- return /* @__PURE__ */ n(ra, { agent: a, onClick: r, active: z === "connected" });
4357
- const ne = ve(a), ee = a.agentType === "cloud_avatar" || a.agentType === "desktop_avatar", $ = i === "text";
4358
- return ee ? /* @__PURE__ */ n(
4359
- Ae,
4595
+ if (!s)
4596
+ return /* @__PURE__ */ n(ma, { agent: a, onClick: r, active: F === "connected" });
4597
+ const X = Ee(a), W = a.agentType === "cloud_avatar" || a.agentType === "desktop_avatar", ee = i === "text";
4598
+ return W ? /* @__PURE__ */ n(
4599
+ Ie,
4360
4600
  {
4361
4601
  agent: a,
4362
4602
  language: e,
4363
4603
  languages: t,
4364
4604
  onLanguageChange: c,
4365
- onEndSession: U,
4366
- onMinimize: d,
4605
+ onEndSession: Y,
4606
+ onMinimize: l,
4367
4607
  onSessionStart: m,
4368
4608
  onStartText: u,
4369
4609
  onStartVoice: h,
4370
- textOnly: $
4610
+ textOnly: ee
4371
4611
  }
4372
- ) : P ? W && O ? /* @__PURE__ */ n(
4373
- xn,
4612
+ ) : P ? D && O ? /* @__PURE__ */ n(
4613
+ qn,
4374
4614
  {
4375
4615
  agent: a,
4376
4616
  language: e,
4377
- rating: A,
4378
- onBack: () => q(!1),
4379
- onMinimize: d,
4380
- onSubmit: X
4617
+ rating: _,
4618
+ onBack: () => L(!1),
4619
+ onMinimize: l,
4620
+ onSubmit: J
4381
4621
  }
4382
4622
  ) : /* @__PURE__ */ n(
4383
- Vn,
4623
+ Bn,
4384
4624
  {
4385
4625
  agent: a,
4386
4626
  language: e,
4387
4627
  languages: t,
4388
- chatKind: ne === "avatar" ? "text" : ne,
4389
- messages: S,
4628
+ chatKind: X === "avatar" ? "text" : X,
4629
+ messages: w,
4390
4630
  onLanguageChange: c,
4391
- onMinimize: d,
4392
- onStartNewVoice: () => l("voice"),
4393
- onStartNewText: (R) => l("text", R),
4394
- rating: A,
4631
+ onMinimize: l,
4632
+ onStartNewVoice: () => d("voice"),
4633
+ onStartNewText: (K) => d("text", K),
4634
+ rating: _,
4395
4635
  endedBy: P.endedBy,
4396
4636
  sessionId: O,
4397
- ratingInteractive: !D,
4398
- showTellUsMore: B && !D,
4399
- onRate: Q,
4400
- onTellUsMore: () => q(!0)
4637
+ ratingInteractive: !j,
4638
+ showTellUsMore: G && !j,
4639
+ onRate: U,
4640
+ onTellUsMore: () => L(!0)
4401
4641
  }
4402
4642
  ) : /* @__PURE__ */ n(
4403
- Ae,
4643
+ Ie,
4404
4644
  {
4405
4645
  agent: a,
4406
4646
  language: e,
4407
4647
  languages: t,
4408
4648
  onLanguageChange: c,
4409
- onEndSession: U,
4410
- onMinimize: d,
4649
+ onEndSession: Y,
4650
+ onMinimize: l,
4411
4651
  onSessionStart: m,
4412
4652
  onStartText: u,
4413
4653
  onStartVoice: h,
4414
- textOnly: $,
4415
- initialText: s?.mode === "text" ? s.text : void 0,
4416
- autoStartVoice: s?.mode === "voice"
4654
+ textOnly: ee,
4655
+ initialText: o?.mode === "text" ? o.text : void 0,
4656
+ autoStartVoice: o?.mode === "voice"
4417
4657
  }
4418
4658
  );
4419
4659
  }
4420
- function Xn({ wsUrl: a, restUrl: e, apiKey: t, agentId: i, agent: s, language: o, defaultOpen: r = !1, open: c, className: d = "", pcmOptions: l, debug: m = !1, withCredentials: u = !1, onError: h, onInitialized: z, config: b, promptOverrides: x, clientTools: v, onMinimize: E, onOpen: g }) {
4421
- if ([!!t, !!i].filter(Boolean).length > 1)
4660
+ function di(a) {
4661
+ const {
4662
+ wsUrl: e,
4663
+ restUrl: t,
4664
+ apiKey: i,
4665
+ agentId: o,
4666
+ agent: s,
4667
+ language: r,
4668
+ defaultOpen: c,
4669
+ open: l,
4670
+ className: d = "",
4671
+ debug: m = !1,
4672
+ withCredentials: u = !1,
4673
+ onError: h,
4674
+ onInitialized: F,
4675
+ config: b,
4676
+ promptOverrides: M,
4677
+ clientTools: S,
4678
+ onMinimize: T,
4679
+ onOpen: k
4680
+ } = a;
4681
+ if ([!!i, !!o].filter(Boolean).length > 1)
4422
4682
  throw new Error("RqmiiAgentChat: only one of apiKey, or agentId may be provided");
4423
- return /* @__PURE__ */ n(On, { restUrl: e, identifier: t || i, fallbackAgent: s, withCredentials: u, onError: h, children: (S) => /* @__PURE__ */ n(
4424
- Qn,
4683
+ return /* @__PURE__ */ n(ti, { restUrl: t, identifier: i || o, fallbackAgent: s, withCredentials: u, onError: h, children: (w) => /* @__PURE__ */ n(
4684
+ ii,
4425
4685
  {
4426
- wsUrl: a,
4427
- restUrl: e,
4428
- apiKey: t,
4429
- agentId: i,
4430
- agent: S,
4431
- language: o,
4432
- defaultOpen: r,
4433
- open: c,
4686
+ wsUrl: e,
4687
+ restUrl: t,
4688
+ apiKey: i,
4689
+ agentId: o,
4690
+ agent: w,
4691
+ language: r,
4692
+ defaultOpen: c,
4693
+ open: l,
4434
4694
  className: d,
4435
- pcmOptions: l,
4436
4695
  debug: m,
4437
4696
  withCredentials: u,
4438
4697
  onError: h,
4439
- onInitialized: z,
4698
+ onInitialized: F,
4440
4699
  config: b,
4441
- promptOverrides: x,
4442
- clientTools: v,
4443
- onMinimize: E,
4444
- onOpen: g
4700
+ promptOverrides: M,
4701
+ clientTools: S,
4702
+ onMinimize: T,
4703
+ onOpen: k
4445
4704
  }
4446
4705
  ) });
4447
4706
  }
4448
- function Qn({ wsUrl: a, restUrl: e, apiKey: t, agentId: i, agent: s, language: o, defaultOpen: r, open: c, className: d, pcmOptions: l, debug: m, withCredentials: u, onError: h, onInitialized: z, config: b, promptOverrides: x, clientTools: v, onMinimize: E, onOpen: g }) {
4449
- const [k, p] = y(r), S = c !== void 0 ? c : k, [T, M] = y(!1), [P, L] = y(o || s.defaultLanguage), [A, C] = y("idle"), [D, G] = y(0), [W, q] = y(null), [B, N] = y(!1), U = s.agentType === "cloud_avatar" || s.agentType === "desktop_avatar", O = U, Q = s.widget?.behavior, X = s.welcomeMessages?.[P] || "", ne = !S && !B && !O && !!Q?.welcome_bubble_enabled && !!X.trim(), ee = te(() => pe(s.languages, s.defaultLanguage), [s.defaultLanguage, s.languages]), $ = te(() => A === "text" ? { ...b ?? {}, use_voice: !1, use_text: !0 } : b, [b, A]), R = te(
4450
- () => wt(s, $),
4451
- [s, $]
4452
- ), K = !O && R.useVoice, Z = U ? S : T, ke = te(() => ({
4707
+ function ii({ wsUrl: a, restUrl: e, apiKey: t, agentId: i, agent: o, language: s, defaultOpen: r, open: c, className: l, debug: d, withCredentials: m, onError: u, onInitialized: h, config: F, promptOverrides: b, clientTools: M, onMinimize: S, onOpen: T }) {
4708
+ const k = r !== void 0 ? r : o.widget?.behavior?.default_open ?? !1, [p, g] = y(k), w = c !== void 0 ? c : p;
4709
+ I(() => {
4710
+ c === void 0 && g(k);
4711
+ }, [k, c]);
4712
+ const [E, f] = y(!1), [P, C] = y(s || o.defaultLanguage), [_, x] = y("idle"), [j, R] = y(0), [D, L] = y(null), [G, N] = y(!1), Y = o.agentType === "cloud_avatar" || o.agentType === "desktop_avatar", O = Y, U = o.widget?.behavior?.welcome_bubble, J = o.welcomeMessages?.[P] || "", X = !w && !G && !O && !!U?.enabled && !!J.trim(), W = $(() => ye(o.languages, o.defaultLanguage), [o.defaultLanguage, o.languages]);
4713
+ I(() => {
4714
+ ua(o.widget?.appearance?.font);
4715
+ }, [o.widget?.appearance?.font]);
4716
+ const ee = $(() => _ === "text" ? { ...F ?? {}, use_voice: !1, use_text: !0 } : F, [F, _]), K = $(
4717
+ () => Vt(o, ee),
4718
+ [o, ee]
4719
+ ), me = !O && K.useVoice, ae = Y ? w : E, le = $(() => ({
4453
4720
  ...t ? { apiKey: t } : {},
4454
4721
  ...i ? { agentId: i } : {},
4455
4722
  language: P,
4456
- config: $,
4457
- ...x ? { promptOverrides: x } : {}
4458
- }), [i, t, P, $, x]), ce = _(null), fe = _(!1), ze = _(D), Ue = ze.current !== D;
4459
- ze.current = D, T && (!fe.current || Ue) && (ce.current = ke), fe.current = T, T || (ce.current = null);
4460
- const Ke = T && ce.current ? ce.current : ke;
4723
+ config: ee,
4724
+ ...b ? { promptOverrides: b } : {}
4725
+ }), [i, t, P, ee, b]), ce = B(null), he = B(!1), Q = B(j), be = Q.current !== j;
4726
+ Q.current = j, E && (!he.current || be) && (ce.current = le), he.current = E, E || (ce.current = null);
4727
+ const Ye = E && ce.current ? ce.current : le;
4461
4728
  I(() => {
4462
- L(o || s.defaultLanguage);
4463
- }, [s.defaultLanguage, o]);
4464
- const Se = te(() => h ? (me) => {
4465
- C("idle"), h(me);
4466
- } : (me) => {
4467
- C("idle");
4468
- }, [h]), w = () => {
4469
- C("text"), M(!0);
4470
- }, ae = () => {
4471
- C("voice"), M(!0);
4472
- }, xe = () => {
4473
- c === void 0 && p(!1), E?.();
4474
- }, ha = () => {
4475
- c === void 0 && p(!0), N(!0), g?.();
4476
- }, ga = (me, pa) => {
4477
- q(me === "text" ? { mode: "text", text: pa ?? "" } : { mode: "voice" }), C(me), M(!0), G((ba) => ba + 1);
4478
- };
4729
+ C(s || o.defaultLanguage);
4730
+ }, [o.defaultLanguage, s]);
4731
+ const we = $(() => u ? (fe) => {
4732
+ x("idle"), u(fe);
4733
+ } : (fe) => {
4734
+ x("idle");
4735
+ }, [u]), q = () => {
4736
+ x("text"), f(!0);
4737
+ }, ne = () => {
4738
+ x("voice"), f(!0);
4739
+ }, Pe = () => {
4740
+ c === void 0 && g(!1), S?.();
4741
+ }, ka = () => {
4742
+ c === void 0 && g(!0), N(!0), T?.();
4743
+ }, va = (fe, Fa) => {
4744
+ L(fe === "text" ? { mode: "text", text: Fa ?? "" } : { mode: "voice" }), x(fe), f(!0), R((Ta) => Ta + 1);
4745
+ }, Qe = o.widget?.appearance?.theme?.mode === "light" ? "light" : "dark", ya = $(() => Re(o.widget?.appearance), [o.widget?.appearance]);
4479
4746
  return /* @__PURE__ */ n(
4480
- va,
4747
+ Sa,
4481
4748
  {
4482
4749
  wsUrl: a,
4483
4750
  restUrl: e,
4484
- session: Ke,
4485
- connect: Z,
4486
- enableAudio: K,
4487
- pcmOptions: l,
4488
- debug: m,
4489
- withCredentials: u,
4490
- onError: Se,
4491
- onInitialized: z,
4492
- clientTools: v,
4493
- children: /* @__PURE__ */ f("div", { className: V("rqmii-chat-surface", s.widget?.appearance?.position === "left" && "rqmii-position-left", d), dir: "ltr", children: [
4494
- ne && /* @__PURE__ */ n(
4495
- dn,
4496
- {
4497
- message: X,
4498
- delaySeconds: Q?.welcome_bubble_delay_seconds ?? 3,
4499
- soundEnabled: !!Q?.welcome_bubble_sound_enabled,
4500
- language: P,
4501
- buttonPosition: s.widget?.appearance?.position === "left" ? "left" : "right",
4502
- onClick: () => N(!0)
4503
- }
4504
- ),
4505
- /* @__PURE__ */ n(
4506
- Yn,
4507
- {
4508
- agent: s,
4509
- language: P,
4510
- languages: ee,
4511
- startMode: A,
4512
- directive: W,
4513
- open: S,
4514
- onOpen: ha,
4515
- onLanguageChange: L,
4516
- onMinimize: xe,
4517
- onStartNewSession: ga,
4518
- onSessionStart: () => M(!0),
4519
- onStartText: w,
4520
- onStartVoice: ae
4521
- }
4522
- )
4523
- ] })
4751
+ session: Ye,
4752
+ connect: ae,
4753
+ enableAudio: me,
4754
+ debug: d,
4755
+ withCredentials: m,
4756
+ onError: we,
4757
+ onInitialized: h,
4758
+ clientTools: M,
4759
+ children: /* @__PURE__ */ v(
4760
+ "div",
4761
+ {
4762
+ className: V(
4763
+ "rqmii-chat-surface",
4764
+ `rqmii-theme-${Qe}`,
4765
+ o.widget?.appearance?.position === "left" && "rqmii-position-left",
4766
+ l
4767
+ ),
4768
+ "data-theme": Qe,
4769
+ style: ya,
4770
+ dir: "ltr",
4771
+ children: [
4772
+ X && /* @__PURE__ */ n(
4773
+ kn,
4774
+ {
4775
+ message: J,
4776
+ delaySeconds: U?.delay_seconds ?? 3,
4777
+ soundEnabled: !!U?.sound_enabled,
4778
+ language: P,
4779
+ buttonPosition: o.widget?.appearance?.position === "left" ? "left" : "right",
4780
+ onClick: () => N(!0)
4781
+ }
4782
+ ),
4783
+ /* @__PURE__ */ n(
4784
+ ni,
4785
+ {
4786
+ agent: o,
4787
+ language: P,
4788
+ languages: W,
4789
+ startMode: _,
4790
+ directive: D,
4791
+ open: w,
4792
+ onOpen: ka,
4793
+ onLanguageChange: C,
4794
+ onMinimize: Pe,
4795
+ onStartNewSession: va,
4796
+ onSessionStart: () => f(!0),
4797
+ onStartText: q,
4798
+ onStartVoice: ne
4799
+ }
4800
+ )
4801
+ ]
4802
+ }
4803
+ )
4524
4804
  },
4525
- D
4805
+ j
4526
4806
  );
4527
4807
  }
4528
- function ei({ agent: a, language: e, open: t = !0, className: i = "", messages: s, onSendMessage: o, onClose: r }) {
4529
- const c = te(() => ge(a), [a]), [d, l] = y(t), [m, u] = y(e || c.defaultLanguage), h = te(() => pe(c.languages, c.defaultLanguage), [c.defaultLanguage, c.languages]);
4808
+ function ui(a) {
4809
+ const { agent: e, language: t, open: i = !0, className: o = "", messages: s, onSendMessage: r, onClose: c } = a, l = $(() => ve(e), [e]), [d, m] = y(i), [u, h] = y(t || l.defaultLanguage), F = $(() => ye(l.languages, l.defaultLanguage), [l.defaultLanguage, l.languages]), b = l.widget?.appearance?.theme?.mode === "light" ? "light" : "dark", M = $(() => Re(l.widget?.appearance), [l.widget?.appearance]);
4530
4810
  return I(() => {
4531
- e && u(e);
4532
- }, [e]), I(() => {
4533
- l(t);
4534
- }, [t]), /* @__PURE__ */ n(fa, { wsUrl: "", restUrl: "", enableAudio: !1, children: /* @__PURE__ */ n("div", { className: V("rqmii-chat-surface is-preview", i), dir: "ltr", children: d ? /* @__PURE__ */ n(
4535
- Ae,
4811
+ t && h(t);
4812
+ }, [t]), I(() => {
4813
+ m(i);
4814
+ }, [i]), I(() => {
4815
+ ua(l.widget?.appearance?.font);
4816
+ }, [l.widget?.appearance?.font]), /* @__PURE__ */ n(za, { wsUrl: "", restUrl: "", enableAudio: !1, children: /* @__PURE__ */ n(
4817
+ "div",
4536
4818
  {
4537
- agent: c,
4538
- language: m,
4539
- languages: h,
4540
- onLanguageChange: u,
4541
- onEndSession: () => {
4542
- l(!1), r?.();
4543
- },
4544
- onMinimize: () => {
4545
- l(!1), r?.();
4546
- },
4547
- messages: s,
4548
- onSendMessage: o,
4549
- isPreview: !0
4819
+ className: V("rqmii-chat-surface is-preview", `rqmii-theme-${b}`, o),
4820
+ "data-theme": b,
4821
+ style: M,
4822
+ dir: "ltr",
4823
+ children: d ? /* @__PURE__ */ n(
4824
+ Ie,
4825
+ {
4826
+ agent: l,
4827
+ language: u,
4828
+ languages: F,
4829
+ onLanguageChange: h,
4830
+ onEndSession: () => {
4831
+ m(!1), c?.();
4832
+ },
4833
+ onMinimize: () => {
4834
+ m(!1), c?.();
4835
+ },
4836
+ messages: s,
4837
+ onSendMessage: r,
4838
+ isPreview: !0
4839
+ }
4840
+ ) : null
4550
4841
  }
4551
- ) : null }) });
4842
+ ) });
4552
4843
  }
4553
4844
  export {
4554
- jn as ConsentDialog,
4555
- Vn as EndedChatPanel,
4556
- ni as EpicPixelStreamingPlayer,
4557
- xn as FeedbackPanel,
4558
- Ce as RQMII_CHAT_LANGUAGES,
4559
- He as RQMII_CHAT_LANGUAGE_VALUES,
4560
- Sn as RatingBar,
4561
- J as RqmiiAgentAvatar,
4562
- Xn as RqmiiAgentChat,
4563
- ei as RqmiiAgentChatPreview,
4564
- va as RqmiiAgentRoom,
4565
- Kn as RqmiiAvatarChatBox,
4566
- le as RqmiiChatFooter,
4567
- ra as RqmiiChatOpenButton,
4568
- Jn as RqmiiChatSurface,
4569
- ii as RqmiiCloudAvatarPlayer,
4570
- Un as RqmiiTextAndVoiceChatBox,
4571
- Rn as RqmiiTextChatBox,
4572
- Bn as RqmiiVoiceChatBox,
4573
- Zn as fetchAgentConfig,
4574
- Ct as fetchAgentCustomization,
4575
- We as getChatLanguage,
4576
- F as getChatText,
4577
- pe as normalizeChatLanguages,
4578
- ge as normalizePublicAgent,
4579
- ve as resolveChatKind
4845
+ On as ConsentDialog,
4846
+ Bn as EndedChatPanel,
4847
+ gi as EpicPixelStreamingPlayer,
4848
+ qn as FeedbackPanel,
4849
+ Ae as RQMII_CHAT_LANGUAGES,
4850
+ Ze as RQMII_CHAT_LANGUAGE_VALUES,
4851
+ _n as RatingBar,
4852
+ te as RqmiiAgentAvatar,
4853
+ di as RqmiiAgentChat,
4854
+ ui as RqmiiAgentChatPreview,
4855
+ Sa as RqmiiAgentRoom,
4856
+ ai as RqmiiAvatarChatBox,
4857
+ ue as RqmiiChatFooter,
4858
+ ma as RqmiiChatOpenButton,
4859
+ ci as RqmiiChatSurface,
4860
+ pi as RqmiiCloudAvatarPlayer,
4861
+ ei as RqmiiTextAndVoiceChatBox,
4862
+ Zn as RqmiiTextChatBox,
4863
+ Jn as RqmiiVoiceChatBox,
4864
+ li as fetchAgentConfig,
4865
+ It as fetchAgentCustomization,
4866
+ Je as getChatLanguage,
4867
+ z as getChatText,
4868
+ ye as normalizeChatLanguages,
4869
+ ve as normalizePublicAgent,
4870
+ Ee as resolveChatKind
4580
4871
  };
4581
4872
  //# sourceMappingURL=ui.js.map