@cloudflare/realtimekit-ui 1.0.9-staging.2 → 1.0.9-staging.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (498) hide show
  1. package/dist/browser.js +1 -1
  2. package/dist/cjs/ChatHead-e13f3b0e.js +13 -0
  3. package/dist/cjs/{TextMessage-4f9299ff.js → TextMessage-7bb3e1fd.js} +1 -1
  4. package/dist/cjs/{chat-04fd67b4.js → chat-717e517d.js} +1 -1
  5. package/dist/cjs/{notification-6f17add8.js → config-8c9ac89a.js} +0 -35
  6. package/dist/cjs/{ChatHead-6416d6cf.js → date-61ffcd0a.js} +0 -10
  7. package/dist/cjs/index-05554ce6.js +62 -2
  8. package/dist/cjs/index.cjs.js +11 -10
  9. package/dist/cjs/loader.cjs.js +1 -1
  10. package/dist/cjs/notification-567fe887.js +39 -0
  11. package/dist/cjs/realtimekit-ui.cjs.js +1 -1
  12. package/dist/cjs/rtk-ai-transcriptions.cjs.entry.js +2 -1
  13. package/dist/cjs/rtk-avatar_24.cjs.entry.js +2568 -0
  14. package/dist/cjs/rtk-breakout-room-manager_3.cjs.entry.js +397 -0
  15. package/dist/cjs/rtk-breakout-rooms-manager_9.cjs.entry.js +986 -0
  16. package/dist/cjs/rtk-channel-creator.cjs.entry.js +163 -0
  17. package/dist/cjs/rtk-channel-details.cjs.entry.js +49 -0
  18. package/dist/cjs/rtk-channel-header.cjs.entry.js +83 -0
  19. package/dist/cjs/rtk-channel-selector-ui.cjs.entry.js +4 -4
  20. package/dist/cjs/rtk-chat-composer-ui.cjs.entry.js +1 -1
  21. package/dist/cjs/rtk-chat-message.cjs.entry.js +118 -0
  22. package/dist/cjs/rtk-chat-messages-ui.cjs.entry.js +200 -0
  23. package/dist/cjs/rtk-chat-search-results.cjs.entry.js +57 -0
  24. package/dist/cjs/rtk-chat-selector-ui.cjs.entry.js +1 -1
  25. package/dist/cjs/rtk-debugger-audio_4.cjs.entry.js +686 -0
  26. package/dist/cjs/rtk-dialog-manager.cjs.entry.js +154 -0
  27. package/dist/cjs/rtk-dialog.cjs.entry.js +93 -0
  28. package/dist/cjs/rtk-file-message_3.cjs.entry.js +148 -0
  29. package/dist/cjs/rtk-logo.cjs.entry.js +77 -0
  30. package/dist/cjs/rtk-notification.cjs.entry.js +71 -0
  31. package/dist/cjs/rtk-notifications.cjs.entry.js +588 -0
  32. package/dist/cjs/rtk-sidebar.cjs.entry.js +1 -1
  33. package/dist/collection/components/rtk-channel-creator/rtk-channel-creator.js +5 -2
  34. package/dist/collection/components/rtk-channel-details/rtk-channel-details.js +2 -1
  35. package/dist/collection/components/rtk-channel-header/rtk-channel-header.js +1 -0
  36. package/dist/collection/components/rtk-channel-selector-ui/rtk-channel-selector-ui.js +5 -2
  37. package/dist/collection/components/rtk-chat/rtk-chat.js +5 -102
  38. package/dist/collection/components/rtk-chat-message/rtk-chat-message.js +3 -2
  39. package/dist/collection/components/rtk-chat-messages-ui/rtk-chat-messages-ui.js +13 -4
  40. package/dist/collection/components/rtk-chat-messages-ui-paginated/rtk-chat-messages-ui-paginated.js +4 -2
  41. package/dist/collection/components/rtk-chat-search-results/rtk-chat-search-results.js +2 -1
  42. package/dist/collection/components/rtk-dialog-manager/rtk-dialog-manager.js +0 -6
  43. package/dist/collection/components/rtk-file-message/rtk-file-message.js +3 -2
  44. package/dist/collection/components/rtk-image-message/rtk-image-message.js +5 -4
  45. package/dist/collection/components/rtk-message-view/rtk-message-view.css +26 -12
  46. package/dist/collection/components/rtk-message-view/rtk-message-view.js +23 -1
  47. package/dist/collection/components/rtk-paginated-list/rtk-paginated-list.css +2 -1
  48. package/dist/collection/components/rtk-paginated-list/rtk-paginated-list.js +3 -19
  49. package/dist/collection/components/rtk-sidebar/rtk-sidebar.css +2 -0
  50. package/dist/collection/components/rtk-text-message/rtk-text-message.js +3 -2
  51. package/dist/collection/utils/chat.js +1 -1
  52. package/dist/components/index.js +7 -7
  53. package/dist/components/{p-91a9efcf.js → p-013ffc19.js} +3 -3
  54. package/dist/components/{p-7f0ee3c6.js → p-024ef28a.js} +2 -2
  55. package/dist/components/{p-39a6a6a6.js → p-027ec380.js} +6 -6
  56. package/dist/components/{p-c663f9b1.js → p-06e20f42.js} +2 -2
  57. package/dist/components/{p-731ee854.js → p-08382c59.js} +5 -5
  58. package/dist/components/{p-65b9931e.js → p-0bbd0056.js} +2 -2
  59. package/dist/components/{p-a5a40d7e.js → p-102b6df8.js} +2 -2
  60. package/dist/components/{p-4772f368.js → p-121e073d.js} +2 -2
  61. package/dist/components/{p-c5dfd548.js → p-1f320625.js} +48 -325
  62. package/dist/components/{p-03fe0979.js → p-244cbe7b.js} +2 -2
  63. package/dist/components/{p-9ea5df8f.js → p-2508ac98.js} +2 -2
  64. package/dist/components/{p-9730c398.js → p-2590f470.js} +3 -3
  65. package/dist/components/{p-f46a0782.js → p-25ca06f2.js} +2 -2
  66. package/dist/components/{p-2b955eb0.js → p-27fea689.js} +4 -4
  67. package/dist/components/{p-cc5ecd67.js → p-2d08ab28.js} +2 -2
  68. package/dist/components/{p-ddb2df62.js → p-2ea7652f.js} +2 -2
  69. package/dist/components/{p-4c8cff29.js → p-30ac9705.js} +6 -21
  70. package/dist/components/{p-989d36e2.js → p-31c44fed.js} +6 -6
  71. package/dist/components/{p-c3582bf3.js → p-32609f9f.js} +12 -9
  72. package/dist/components/{p-3a80e3ab.js → p-32bf6a44.js} +4 -4
  73. package/dist/components/{p-c7413ac8.js → p-335f937c.js} +2 -2
  74. package/dist/components/{p-7119673c.js → p-33a87325.js} +2 -2
  75. package/dist/components/{p-3df2211d.js → p-3d3fa677.js} +2 -2
  76. package/dist/components/{p-1a60f5b0.js → p-3fa8f1e1.js} +2 -2
  77. package/dist/components/{p-af35ac31.js → p-47c25f64.js} +1 -1
  78. package/dist/components/{p-511ed3f8.js → p-498c01a6.js} +2 -2
  79. package/dist/components/{p-54dba22f.js → p-4b542718.js} +2 -2
  80. package/dist/components/{p-17867774.js → p-4c7f1a19.js} +2 -2
  81. package/dist/components/{p-b373754d.js → p-51de7af3.js} +1 -1
  82. package/dist/components/{p-52b090fc.js → p-52d1525c.js} +2 -2
  83. package/dist/components/{p-f5f0b499.js → p-560e7a4f.js} +1 -1
  84. package/dist/components/{p-93e1439e.js → p-566c1155.js} +1 -1
  85. package/dist/components/{p-49967150.js → p-5b03154d.js} +3 -3
  86. package/dist/components/{p-ed8955d0.js → p-5f26bba3.js} +2 -2
  87. package/dist/components/{p-12d2b558.js → p-63953295.js} +2 -2
  88. package/dist/components/{p-3438fd71.js → p-6756b222.js} +2 -2
  89. package/dist/components/{p-bccc21f8.js → p-68c9100f.js} +2 -2
  90. package/dist/components/{p-1d29b7c3.js → p-6c1b380d.js} +12 -12
  91. package/dist/components/{p-f9faeffc.js → p-6cbaf90a.js} +2 -2
  92. package/dist/components/{p-551bed08.js → p-6eabd1ad.js} +3 -3
  93. package/dist/components/{p-df25c2a7.js → p-6f340109.js} +1 -1
  94. package/dist/components/{p-840ef7fe.js → p-724074c4.js} +5 -5
  95. package/dist/components/{p-a09aefba.js → p-7481511c.js} +2 -2
  96. package/dist/components/{p-6bd3b767.js → p-78b61cce.js} +1 -1
  97. package/dist/components/{p-fb427023.js → p-7a322c43.js} +3 -3
  98. package/dist/components/{p-037e572f.js → p-7fc0dc2f.js} +1 -1
  99. package/dist/components/{p-a9d5d165.js → p-82c678d6.js} +7 -7
  100. package/dist/components/{p-314b1504.js → p-82f8c924.js} +2 -2
  101. package/dist/components/{p-6d49cf9f.js → p-84e5b453.js} +2 -2
  102. package/dist/components/{p-04aaec79.js → p-88e50eea.js} +17 -15
  103. package/dist/components/{p-f4ff7d70.js → p-97e1e186.js} +2 -2
  104. package/dist/components/{p-fb46d041.js → p-9c2c0760.js} +7 -7
  105. package/dist/components/{p-dc4b6fc4.js → p-9e87b2c9.js} +2 -2
  106. package/dist/components/{p-0a7f6a8a.js → p-9fd18352.js} +2 -2
  107. package/dist/components/{p-d2b37264.js → p-a0c8422f.js} +4 -4
  108. package/dist/components/{p-f734a4cf.js → p-a10b9faa.js} +2 -2
  109. package/dist/components/{p-d2c3870a.js → p-a159952c.js} +2 -2
  110. package/dist/components/{p-f81c7fda.js → p-a29c01fc.js} +2 -2
  111. package/dist/components/{p-897a04be.js → p-a4b26604.js} +4 -4
  112. package/dist/components/{p-a2f4f9e3.js → p-aae4c250.js} +1 -1
  113. package/dist/components/{p-72346e7f.js → p-afe77b50.js} +2 -2
  114. package/dist/components/{p-6fe2233b.js → p-b1338b4f.js} +3 -3
  115. package/dist/components/{p-e2e22bf8.js → p-b397a600.js} +4 -4
  116. package/dist/components/{p-34b580c9.js → p-b6ee1a32.js} +2 -2
  117. package/dist/components/{p-3fe1bb0d.js → p-b762cf1e.js} +11 -11
  118. package/dist/components/{p-4edd666b.js → p-bb8f2597.js} +6 -6
  119. package/dist/components/{p-b804a5f5.js → p-be9fe914.js} +7 -7
  120. package/dist/components/{p-9149c02e.js → p-c078ae06.js} +2 -2
  121. package/dist/components/{p-26055088.js → p-c07e3e6d.js} +2 -2
  122. package/dist/components/{p-40c5ca62.js → p-c515acba.js} +2 -2
  123. package/dist/components/{p-12437468.js → p-cf503999.js} +2 -2
  124. package/dist/components/{p-66bae0d9.js → p-d06d1eac.js} +2 -2
  125. package/dist/components/{p-0abe4b8a.js → p-dab9d3d6.js} +1 -1
  126. package/dist/components/{p-01a50790.js → p-e48cd596.js} +4 -4
  127. package/dist/components/{p-aba9b612.js → p-e732b5ee.js} +4 -4
  128. package/dist/components/{p-22d9d3ff.js → p-e87b68de.js} +5 -5
  129. package/dist/components/{p-22a734a8.js → p-eb7df0eb.js} +6 -6
  130. package/dist/components/{p-c40166a9.js → p-ef71b75e.js} +5 -5
  131. package/dist/components/{p-00ebd1dc.js → p-fa7412e2.js} +2 -2
  132. package/dist/components/{p-1986022b.js → p-fc21299d.js} +2 -2
  133. package/dist/components/{p-3051f5f5.js → p-fdb67d1f.js} +2 -2
  134. package/dist/components/rtk-ai-toggle.js +4 -4
  135. package/dist/components/rtk-ai-transcriptions.js +1 -1
  136. package/dist/components/rtk-ai.js +3 -3
  137. package/dist/components/rtk-audio-grid.js +2 -2
  138. package/dist/components/rtk-audio-tile.js +5 -5
  139. package/dist/components/rtk-audio-visualizer.js +1 -1
  140. package/dist/components/rtk-avatar.js +1 -1
  141. package/dist/components/rtk-breakout-room-manager.js +1 -1
  142. package/dist/components/rtk-breakout-room-participants.js +1 -1
  143. package/dist/components/rtk-breakout-rooms-manager.js +1 -1
  144. package/dist/components/rtk-breakout-rooms-toggle.js +4 -4
  145. package/dist/components/rtk-broadcast-message-modal.js +1 -1
  146. package/dist/components/rtk-camera-selector.js +1 -1
  147. package/dist/components/rtk-camera-toggle.js +4 -4
  148. package/dist/components/rtk-caption-toggle.js +4 -4
  149. package/dist/components/rtk-channel-creator.js +209 -1
  150. package/dist/components/rtk-channel-details.js +1 -1
  151. package/dist/components/rtk-channel-header.js +146 -1
  152. package/dist/components/rtk-channel-selector-ui.js +7 -7
  153. package/dist/components/rtk-channel-selector-view.js +1 -1
  154. package/dist/components/rtk-chat-composer-ui.js +6 -6
  155. package/dist/components/rtk-chat-composer-view.js +1 -1
  156. package/dist/components/rtk-chat-message.js +1 -1
  157. package/dist/components/rtk-chat-messages-ui-paginated.js +1 -1
  158. package/dist/components/rtk-chat-messages-ui.js +302 -1
  159. package/dist/components/rtk-chat-search-results.js +146 -1
  160. package/dist/components/rtk-chat-selector-ui.js +3 -3
  161. package/dist/components/rtk-chat-toggle.js +5 -5
  162. package/dist/components/rtk-chat.js +1 -1
  163. package/dist/components/rtk-clock.js +2 -2
  164. package/dist/components/rtk-confirmation-modal.js +1 -1
  165. package/dist/components/rtk-controlbar-button.js +1 -1
  166. package/dist/components/rtk-controlbar.js +2 -2
  167. package/dist/components/rtk-counter.js +1 -1
  168. package/dist/components/rtk-debugger-audio.js +1 -1
  169. package/dist/components/rtk-debugger-screenshare.js +1 -1
  170. package/dist/components/rtk-debugger-system.js +1 -1
  171. package/dist/components/rtk-debugger-toggle.js +4 -4
  172. package/dist/components/rtk-debugger-video.js +1 -1
  173. package/dist/components/rtk-debugger.js +1 -1
  174. package/dist/components/rtk-dialog-manager.js +305 -1
  175. package/dist/components/rtk-dialog.js +1 -1
  176. package/dist/components/rtk-draft-attachment-view.js +1 -1
  177. package/dist/components/rtk-emoji-picker-button.js +1 -1
  178. package/dist/components/rtk-emoji-picker.js +1 -1
  179. package/dist/components/rtk-ended-screen.js +3 -3
  180. package/dist/components/rtk-file-dropzone.js +2 -2
  181. package/dist/components/rtk-file-message-view.js +1 -1
  182. package/dist/components/rtk-file-message.js +1 -1
  183. package/dist/components/rtk-file-picker-button.js +1 -1
  184. package/dist/components/rtk-fullscreen-toggle.js +1 -1
  185. package/dist/components/rtk-grid-pagination.js +2 -2
  186. package/dist/components/rtk-grid.js +8 -8
  187. package/dist/components/rtk-header.js +2 -2
  188. package/dist/components/rtk-idle-screen.js +4 -4
  189. package/dist/components/rtk-image-message-view.js +1 -1
  190. package/dist/components/rtk-image-message.js +1 -1
  191. package/dist/components/rtk-image-viewer.js +2 -2
  192. package/dist/components/rtk-information-tooltip.js +2 -2
  193. package/dist/components/rtk-join-stage.js +1 -1
  194. package/dist/components/rtk-leave-button.js +4 -4
  195. package/dist/components/rtk-leave-meeting.js +1 -1
  196. package/dist/components/rtk-livestream-indicator.js +1 -1
  197. package/dist/components/rtk-livestream-player.js +1 -1
  198. package/dist/components/rtk-livestream-toggle.js +4 -4
  199. package/dist/components/rtk-logo.js +1 -1
  200. package/dist/components/rtk-markdown-view.js +1 -1
  201. package/dist/components/rtk-meeting-title.js +2 -2
  202. package/dist/components/rtk-meeting.js +46 -226
  203. package/dist/components/rtk-menu-item.js +1 -1
  204. package/dist/components/rtk-menu-list.js +1 -1
  205. package/dist/components/rtk-menu.js +1 -1
  206. package/dist/components/rtk-message-list-view.js +3 -3
  207. package/dist/components/rtk-message-view.js +1 -1
  208. package/dist/components/rtk-mic-toggle.js +4 -4
  209. package/dist/components/rtk-microphone-selector.js +1 -1
  210. package/dist/components/rtk-mixed-grid.js +5 -5
  211. package/dist/components/rtk-more-toggle.js +4 -4
  212. package/dist/components/rtk-mute-all-button.js +4 -4
  213. package/dist/components/rtk-mute-all-confirmation.js +1 -1
  214. package/dist/components/rtk-name-tag.js +1 -1
  215. package/dist/components/rtk-network-indicator.js +2 -2
  216. package/dist/components/rtk-notification.js +1 -1
  217. package/dist/components/rtk-notifications.js +629 -1
  218. package/dist/components/rtk-overlay-modal.js +1 -1
  219. package/dist/components/rtk-paginated-list.js +1 -1
  220. package/dist/components/rtk-participant-count.js +2 -2
  221. package/dist/components/rtk-participant-setup.js +2 -2
  222. package/dist/components/rtk-participant-tile.js +1 -1
  223. package/dist/components/rtk-participant.js +1 -1
  224. package/dist/components/rtk-participants-audio.js +3 -3
  225. package/dist/components/rtk-participants-stage-list.js +1 -1
  226. package/dist/components/rtk-participants-stage-queue.js +1 -1
  227. package/dist/components/rtk-participants-toggle.js +5 -5
  228. package/dist/components/rtk-participants-viewer-list.js +1 -1
  229. package/dist/components/rtk-participants-waiting-list.js +1 -1
  230. package/dist/components/rtk-participants.js +12 -12
  231. package/dist/components/rtk-permissions-message.js +1 -1
  232. package/dist/components/rtk-pip-toggle.js +4 -4
  233. package/dist/components/rtk-plugin-main.js +1 -1
  234. package/dist/components/rtk-plugins-toggle.js +5 -5
  235. package/dist/components/rtk-plugins.js +1 -1
  236. package/dist/components/rtk-poll-form.js +1 -1
  237. package/dist/components/rtk-poll.js +1 -1
  238. package/dist/components/rtk-polls-toggle.js +5 -5
  239. package/dist/components/rtk-polls.js +1 -1
  240. package/dist/components/rtk-recording-indicator.js +2 -2
  241. package/dist/components/rtk-recording-toggle.js +4 -4
  242. package/dist/components/rtk-screen-share-toggle.js +4 -4
  243. package/dist/components/rtk-screenshare-view.js +2 -2
  244. package/dist/components/rtk-settings-audio.js +1 -1
  245. package/dist/components/rtk-settings-toggle.js +4 -4
  246. package/dist/components/rtk-settings-video.js +1 -1
  247. package/dist/components/rtk-settings.js +10 -10
  248. package/dist/components/rtk-setup-screen.js +6 -6
  249. package/dist/components/rtk-sidebar-ui.js +1 -1
  250. package/dist/components/rtk-sidebar.js +9 -9
  251. package/dist/components/rtk-simple-grid.js +2 -2
  252. package/dist/components/rtk-speaker-selector.js +1 -1
  253. package/dist/components/rtk-spinner.js +1 -1
  254. package/dist/components/rtk-spotlight-grid.js +2 -2
  255. package/dist/components/rtk-spotlight-indicator.js +1 -1
  256. package/dist/components/rtk-stage-toggle.js +4 -4
  257. package/dist/components/rtk-stage.js +2 -2
  258. package/dist/components/rtk-switch.js +1 -1
  259. package/dist/components/rtk-tab-bar.js +1 -1
  260. package/dist/components/rtk-text-composer-view.js +1 -1
  261. package/dist/components/rtk-text-message-view.js +1 -1
  262. package/dist/components/rtk-text-message.js +1 -1
  263. package/dist/components/rtk-transcript.js +1 -1
  264. package/dist/components/rtk-transcripts.js +3 -3
  265. package/dist/components/rtk-ui-provider.js +2 -2
  266. package/dist/components/rtk-viewer-count.js +1 -1
  267. package/dist/components/rtk-waiting-screen.js +3 -3
  268. package/dist/docs/docs-components.json +140 -384
  269. package/dist/docs/docs-vscode.json +7 -3
  270. package/dist/esm/ChatHead-15c2f8d4.js +11 -0
  271. package/dist/esm/{TextMessage-07d53134.js → TextMessage-ca92045e.js} +1 -1
  272. package/dist/esm/{chat-32ac0c2b.js → chat-ff185374.js} +2 -2
  273. package/dist/esm/{notification-0794a8cc.js → config-e684aa4d.js} +3 -37
  274. package/dist/esm/{ChatHead-11b92a26.js → date-b1f78dea.js} +1 -10
  275. package/dist/esm/{debounce-6ec038d3.js → debounce-3ea4df36.js} +1 -1
  276. package/dist/esm/{file-849468c1.js → file-6114f1a9.js} +1 -1
  277. package/dist/esm/index-c1fb98bb.js +62 -2
  278. package/dist/esm/{index-849b9dd9.js → index-e65afca5.js} +1 -1
  279. package/dist/esm/index.js +7 -6
  280. package/dist/esm/loader.js +13266 -13290
  281. package/dist/esm/{merge-f5f3ca10.js → merge-7ffc04b3.js} +1 -1
  282. package/dist/esm/notification-78afaabf.js +37 -0
  283. package/dist/esm/realtimekit-ui.js +1 -1
  284. package/dist/esm/rtk-ai-toggle.entry.js +2 -2
  285. package/dist/esm/rtk-ai-transcriptions.entry.js +5 -4
  286. package/dist/esm/rtk-ai.entry.js +2 -2
  287. package/dist/esm/rtk-audio-grid.entry.js +2 -2
  288. package/dist/esm/rtk-audio-tile.entry.js +2 -2
  289. package/dist/esm/rtk-audio-visualizer_4.entry.js +2 -2
  290. package/dist/esm/rtk-avatar_24.entry.js +2541 -0
  291. package/dist/esm/rtk-breakout-room-manager_3.entry.js +391 -0
  292. package/dist/esm/rtk-breakout-rooms-manager_9.entry.js +974 -0
  293. package/dist/esm/rtk-breakout-rooms-toggle.entry.js +2 -2
  294. package/dist/esm/rtk-camera-selector_2.entry.js +2 -2
  295. package/dist/esm/rtk-camera-toggle.entry.js +2 -2
  296. package/dist/esm/rtk-caption-toggle.entry.js +2 -2
  297. package/dist/{components/p-c9a7cf06.js → esm/rtk-channel-creator.entry.js} +12 -64
  298. package/dist/esm/rtk-channel-details.entry.js +45 -0
  299. package/dist/{components/p-0c11d195.js → esm/rtk-channel-header.entry.js} +9 -78
  300. package/dist/esm/rtk-channel-selector-ui.entry.js +6 -6
  301. package/dist/esm/rtk-chat-composer-ui.entry.js +3 -3
  302. package/dist/esm/rtk-chat-message.entry.js +114 -0
  303. package/dist/{components/p-0e07ea51.js → esm/rtk-chat-messages-ui.entry.js} +14 -122
  304. package/dist/esm/rtk-chat-search-results.entry.js +53 -0
  305. package/dist/esm/rtk-chat-selector-ui.entry.js +3 -3
  306. package/dist/esm/rtk-chat-toggle.entry.js +3 -3
  307. package/dist/esm/rtk-clock.entry.js +2 -2
  308. package/dist/esm/rtk-controlbar-button.entry.js +2 -2
  309. package/dist/esm/rtk-controlbar.entry.js +2 -2
  310. package/dist/esm/rtk-debugger-audio_4.entry.js +679 -0
  311. package/dist/esm/rtk-debugger-toggle.entry.js +2 -2
  312. package/dist/{components/p-3042f998.js → esm/rtk-dialog-manager.entry.js} +10 -179
  313. package/dist/esm/rtk-dialog.entry.js +89 -0
  314. package/dist/esm/rtk-ended-screen.entry.js +2 -2
  315. package/dist/esm/rtk-file-dropzone.entry.js +2 -2
  316. package/dist/esm/rtk-file-message_3.entry.js +142 -0
  317. package/dist/esm/rtk-fullscreen-toggle.entry.js +2 -2
  318. package/dist/esm/rtk-grid-pagination.entry.js +2 -2
  319. package/dist/esm/rtk-grid.entry.js +2 -2
  320. package/dist/esm/rtk-header.entry.js +2 -2
  321. package/dist/esm/rtk-idle-screen.entry.js +2 -2
  322. package/dist/esm/rtk-image-viewer.entry.js +4 -4
  323. package/dist/esm/rtk-information-tooltip.entry.js +2 -2
  324. package/dist/esm/rtk-leave-button.entry.js +2 -2
  325. package/dist/esm/rtk-livestream-indicator_3.entry.js +2 -2
  326. package/dist/esm/rtk-livestream-toggle.entry.js +2 -2
  327. package/dist/esm/rtk-logo.entry.js +73 -0
  328. package/dist/esm/rtk-meeting-title.entry.js +2 -2
  329. package/dist/esm/rtk-message-list-view.entry.js +3 -3
  330. package/dist/esm/rtk-mic-toggle.entry.js +2 -2
  331. package/dist/esm/rtk-mixed-grid.entry.js +2 -2
  332. package/dist/esm/rtk-more-toggle.entry.js +2 -2
  333. package/dist/esm/rtk-mute-all-button.entry.js +2 -2
  334. package/dist/esm/rtk-name-tag.entry.js +3 -3
  335. package/dist/esm/rtk-network-indicator.entry.js +2 -2
  336. package/dist/esm/rtk-notification.entry.js +67 -0
  337. package/dist/{components/p-7a336667.js → esm/rtk-notifications.entry.js} +13 -60
  338. package/dist/esm/rtk-participant-count.entry.js +2 -2
  339. package/dist/esm/rtk-participant-setup.entry.js +2 -2
  340. package/dist/esm/rtk-participant_2.entry.js +4 -4
  341. package/dist/esm/rtk-participants-audio.entry.js +2 -2
  342. package/dist/esm/rtk-participants-stage-list_4.entry.js +2 -2
  343. package/dist/esm/rtk-participants-toggle.entry.js +3 -3
  344. package/dist/esm/rtk-participants.entry.js +3 -3
  345. package/dist/esm/rtk-pip-toggle.entry.js +2 -2
  346. package/dist/esm/rtk-plugin-main_2.entry.js +3 -3
  347. package/dist/esm/rtk-plugins-toggle.entry.js +3 -3
  348. package/dist/esm/rtk-plugins_2.entry.js +2 -2
  349. package/dist/esm/rtk-poll_2.entry.js +3 -3
  350. package/dist/esm/rtk-polls-toggle.entry.js +3 -3
  351. package/dist/esm/rtk-recording-indicator.entry.js +2 -2
  352. package/dist/esm/rtk-recording-toggle.entry.js +2 -2
  353. package/dist/esm/rtk-screen-share-toggle.entry.js +2 -2
  354. package/dist/esm/rtk-screenshare-view.entry.js +2 -2
  355. package/dist/esm/rtk-settings-audio_2.entry.js +2 -2
  356. package/dist/esm/rtk-settings-toggle.entry.js +2 -2
  357. package/dist/esm/rtk-settings.entry.js +2 -2
  358. package/dist/esm/rtk-setup-screen.entry.js +3 -3
  359. package/dist/esm/rtk-sidebar-ui.entry.js +2 -2
  360. package/dist/esm/rtk-sidebar.entry.js +4 -4
  361. package/dist/esm/rtk-simple-grid.entry.js +2 -2
  362. package/dist/esm/rtk-spotlight-grid.entry.js +2 -2
  363. package/dist/esm/rtk-spotlight-indicator.entry.js +2 -2
  364. package/dist/esm/rtk-stage-toggle.entry.js +2 -2
  365. package/dist/esm/rtk-stage.entry.js +2 -2
  366. package/dist/esm/rtk-transcript.entry.js +2 -2
  367. package/dist/esm/rtk-transcripts.entry.js +2 -2
  368. package/dist/esm/rtk-ui-provider.entry.js +2 -2
  369. package/dist/esm/rtk-waiting-screen.entry.js +2 -2
  370. package/dist/esm/{sidebar-76cae1f0.js → sidebar-030fff49.js} +1 -1
  371. package/dist/esm/{string-5e8dab07.js → string-068ce30a.js} +1 -1
  372. package/dist/esm/{ui-store-2965ff1a.js → ui-store-9e486e1b.js} +1 -1
  373. package/dist/realtimekit-ui/index.esm.js +1 -1
  374. package/dist/realtimekit-ui/{p-a7ba0456.entry.js → p-013ae8ca.entry.js} +1 -1
  375. package/dist/realtimekit-ui/{p-ff19ee1e.entry.js → p-0689d68b.entry.js} +1 -1
  376. package/dist/realtimekit-ui/{p-2318c3af.js → p-084b6f30.js} +1 -1
  377. package/dist/realtimekit-ui/{p-53ffaa9f.entry.js → p-0898c8ee.entry.js} +1 -1
  378. package/dist/realtimekit-ui/{p-e6f1e6aa.entry.js → p-09869644.entry.js} +1 -1
  379. package/dist/realtimekit-ui/{p-b6c83f82.entry.js → p-11c964cf.entry.js} +1 -1
  380. package/dist/realtimekit-ui/{p-b2b8b421.entry.js → p-124eb1c7.entry.js} +1 -1
  381. package/dist/realtimekit-ui/{p-2857144e.js → p-12e4cb4a.js} +1 -1
  382. package/dist/realtimekit-ui/{p-00b5bdeb.entry.js → p-158b1b0c.entry.js} +1 -1
  383. package/dist/realtimekit-ui/{p-2d729cec.entry.js → p-17c6d2fa.entry.js} +1 -1
  384. package/dist/realtimekit-ui/{p-404207e0.entry.js → p-2b373e53.entry.js} +1 -1
  385. package/dist/realtimekit-ui/p-2d7b969d.entry.js +1 -0
  386. package/dist/realtimekit-ui/{p-d7a5c237.entry.js → p-32030329.entry.js} +1 -1
  387. package/dist/realtimekit-ui/p-3369f405.entry.js +1 -0
  388. package/dist/realtimekit-ui/p-382270d8.js +1 -0
  389. package/dist/realtimekit-ui/{p-f1ab4672.entry.js → p-38aec474.entry.js} +1 -1
  390. package/dist/realtimekit-ui/{p-368420fc.entry.js → p-3a325310.entry.js} +1 -1
  391. package/dist/realtimekit-ui/{p-51a8a9e5.entry.js → p-3b8de127.entry.js} +1 -1
  392. package/dist/realtimekit-ui/{p-83a8cd29.entry.js → p-3d0c4257.entry.js} +1 -1
  393. package/dist/realtimekit-ui/{p-6495f016.entry.js → p-3e02ec0b.entry.js} +1 -1
  394. package/dist/realtimekit-ui/p-40be18ee.js +1 -0
  395. package/dist/realtimekit-ui/{p-dfa4a588.entry.js → p-4554a674.entry.js} +1 -1
  396. package/dist/realtimekit-ui/p-474ba04f.entry.js +1 -0
  397. package/dist/realtimekit-ui/p-487e808a.entry.js +1 -0
  398. package/dist/realtimekit-ui/p-4ab26f1f.entry.js +1 -0
  399. package/dist/realtimekit-ui/{p-2aa2727b.entry.js → p-4eba1baa.entry.js} +1 -1
  400. package/dist/realtimekit-ui/{p-1185eec6.entry.js → p-50157a65.entry.js} +1 -1
  401. package/dist/realtimekit-ui/p-51e949d6.entry.js +1 -0
  402. package/dist/realtimekit-ui/{p-2d09aeb4.entry.js → p-53ac3d30.entry.js} +1 -1
  403. package/dist/realtimekit-ui/{p-e32c13e0.entry.js → p-54a31e02.entry.js} +1 -1
  404. package/dist/realtimekit-ui/{p-95ab3abe.entry.js → p-5a2d8313.entry.js} +1 -1
  405. package/dist/realtimekit-ui/p-5b2d97fc.js +1 -0
  406. package/dist/realtimekit-ui/{p-f16345d6.entry.js → p-5bbfdabe.entry.js} +1 -1
  407. package/dist/realtimekit-ui/p-60a29b69.entry.js +1 -0
  408. package/dist/realtimekit-ui/{p-3144bec3.entry.js → p-60b39e38.entry.js} +1 -1
  409. package/dist/realtimekit-ui/{p-77f71d40.entry.js → p-61d3f74f.entry.js} +1 -1
  410. package/dist/realtimekit-ui/{p-2dc496f0.entry.js → p-62e0a141.entry.js} +1 -1
  411. package/dist/realtimekit-ui/{p-0ab52f70.entry.js → p-643194e4.entry.js} +1 -1
  412. package/dist/realtimekit-ui/p-6a45f305.js +1 -0
  413. package/dist/realtimekit-ui/{p-e65d2f04.entry.js → p-6adb2de4.entry.js} +1 -1
  414. package/dist/realtimekit-ui/{p-efabd2ce.js → p-6f211c3e.js} +1 -1
  415. package/dist/realtimekit-ui/{p-c1d92065.entry.js → p-74e1b5a6.entry.js} +1 -1
  416. package/dist/realtimekit-ui/p-7786e9a7.entry.js +1 -0
  417. package/dist/realtimekit-ui/{p-5cb4f925.entry.js → p-77e04fb7.entry.js} +1 -1
  418. package/dist/realtimekit-ui/{p-1f328e83.entry.js → p-788f26c4.entry.js} +1 -1
  419. package/dist/realtimekit-ui/p-78d19559.entry.js +1 -0
  420. package/dist/realtimekit-ui/{p-f5560043.entry.js → p-7b999408.entry.js} +1 -1
  421. package/dist/realtimekit-ui/{p-2799d5b2.js → p-80c856cd.js} +1 -1
  422. package/dist/realtimekit-ui/{p-2d6c5160.entry.js → p-871d8fbf.entry.js} +1 -1
  423. package/dist/realtimekit-ui/{p-64aa0fae.entry.js → p-882d07c9.entry.js} +1 -1
  424. package/dist/realtimekit-ui/{p-7fab2c53.entry.js → p-8b189438.entry.js} +1 -1
  425. package/dist/realtimekit-ui/{p-ac1ff0f8.entry.js → p-8c55a630.entry.js} +1 -1
  426. package/dist/realtimekit-ui/{p-e24289b8.entry.js → p-8f512d69.entry.js} +1 -1
  427. package/dist/realtimekit-ui/{p-c6c86fd8.js → p-91ea043c.js} +1 -1
  428. package/dist/realtimekit-ui/{p-145caa6b.js → p-91fd286c.js} +1 -1
  429. package/dist/realtimekit-ui/p-930f0255.entry.js +1 -0
  430. package/dist/realtimekit-ui/p-93b84c22.js +1 -0
  431. package/dist/realtimekit-ui/{p-34350578.entry.js → p-941f159e.entry.js} +1 -1
  432. package/dist/realtimekit-ui/{p-f3998c17.entry.js → p-949b2b6a.entry.js} +1 -1
  433. package/dist/realtimekit-ui/{p-47e89714.entry.js → p-986e7389.entry.js} +1 -1
  434. package/dist/realtimekit-ui/{p-db9dd8ea.entry.js → p-98ee3341.entry.js} +1 -1
  435. package/dist/realtimekit-ui/p-99801804.entry.js +1 -0
  436. package/dist/realtimekit-ui/{p-7fbca8d1.entry.js → p-9ad2c746.entry.js} +1 -1
  437. package/dist/realtimekit-ui/p-9c1f42dd.entry.js +1 -0
  438. package/dist/realtimekit-ui/{p-6334ca51.entry.js → p-9cbf286a.entry.js} +1 -1
  439. package/dist/realtimekit-ui/{p-62949a7d.entry.js → p-9d3cf603.entry.js} +1 -1
  440. package/dist/realtimekit-ui/{p-f5a3ccc0.entry.js → p-a0563ab4.entry.js} +1 -1
  441. package/dist/realtimekit-ui/{p-0b93c12d.entry.js → p-a319e81f.entry.js} +1 -1
  442. package/dist/realtimekit-ui/{p-7f896d33.entry.js → p-a4372f65.entry.js} +1 -1
  443. package/dist/realtimekit-ui/{p-e7a89e24.entry.js → p-a9126c12.entry.js} +1 -1
  444. package/dist/realtimekit-ui/{p-a55863be.entry.js → p-a9dd63ef.entry.js} +1 -1
  445. package/dist/realtimekit-ui/{p-3263d76d.entry.js → p-aa757cd3.entry.js} +1 -1
  446. package/dist/realtimekit-ui/{p-9b6d809b.entry.js → p-ad26f7fd.entry.js} +1 -1
  447. package/dist/realtimekit-ui/{p-560fc162.entry.js → p-ad887be1.entry.js} +1 -1
  448. package/dist/realtimekit-ui/{p-ead8970b.entry.js → p-ae7319ac.entry.js} +1 -1
  449. package/dist/realtimekit-ui/p-b387e9a1.entry.js +1 -0
  450. package/dist/realtimekit-ui/{p-22313959.entry.js → p-b388b4c6.entry.js} +1 -1
  451. package/dist/realtimekit-ui/{p-9ba26c9f.entry.js → p-bbf76104.entry.js} +1 -1
  452. package/dist/realtimekit-ui/p-bc1a2b04.entry.js +1 -0
  453. package/dist/realtimekit-ui/p-c1d026d1.entry.js +1 -0
  454. package/dist/realtimekit-ui/{p-543dcdc1.entry.js → p-c5c965b8.entry.js} +1 -1
  455. package/dist/realtimekit-ui/p-c7711712.entry.js +1 -0
  456. package/dist/realtimekit-ui/p-cdacd242.entry.js +1 -0
  457. package/dist/realtimekit-ui/{p-0979ba30.entry.js → p-cdf8bc21.entry.js} +1 -1
  458. package/dist/realtimekit-ui/{p-bfd7cd5a.entry.js → p-d0384d90.entry.js} +1 -1
  459. package/dist/realtimekit-ui/{p-81d1334c.entry.js → p-d0bba739.entry.js} +1 -1
  460. package/dist/realtimekit-ui/p-d8962ea0.entry.js +1 -0
  461. package/dist/realtimekit-ui/{p-616f3a25.entry.js → p-d95ce443.entry.js} +1 -1
  462. package/dist/realtimekit-ui/{p-35b87831.entry.js → p-d9cad67f.entry.js} +1 -1
  463. package/dist/realtimekit-ui/{p-a449b5cd.entry.js → p-dbd07824.entry.js} +1 -1
  464. package/dist/realtimekit-ui/{p-0266e82b.entry.js → p-de75d48d.entry.js} +1 -1
  465. package/dist/realtimekit-ui/{p-4b62d6f9.entry.js → p-e62593a2.entry.js} +1 -1
  466. package/dist/realtimekit-ui/{p-fa2ee341.js → p-e720b51e.js} +1 -1
  467. package/dist/realtimekit-ui/{p-9ac89beb.entry.js → p-e7b83772.entry.js} +1 -1
  468. package/dist/realtimekit-ui/{p-8046e263.js → p-e87928f7.js} +1 -1
  469. package/dist/realtimekit-ui/{p-39d0ad4d.entry.js → p-e925ca8a.entry.js} +1 -1
  470. package/dist/realtimekit-ui/{p-e0dd5f79.entry.js → p-f0f6c282.entry.js} +1 -1
  471. package/dist/realtimekit-ui/{p-47d8e5c8.entry.js → p-f775be53.entry.js} +1 -1
  472. package/dist/realtimekit-ui/{p-bad807c1.entry.js → p-fee7bd4f.entry.js} +1 -1
  473. package/dist/realtimekit-ui/realtimekit-ui.esm.js +1 -1
  474. package/dist/types/components/rtk-channel-creator/rtk-channel-creator.d.ts +3 -0
  475. package/dist/types/components/rtk-channel-details/rtk-channel-details.d.ts +1 -0
  476. package/dist/types/components/rtk-channel-header/rtk-channel-header.d.ts +1 -0
  477. package/dist/types/components/rtk-channel-selector-ui/rtk-channel-selector-ui.d.ts +3 -0
  478. package/dist/types/components/rtk-chat/rtk-chat.d.ts +0 -9
  479. package/dist/types/components/rtk-chat-message/rtk-chat-message.d.ts +1 -0
  480. package/dist/types/components/rtk-chat-messages-ui/rtk-chat-messages-ui.d.ts +3 -0
  481. package/dist/types/components/rtk-chat-search-results/rtk-chat-search-results.d.ts +1 -0
  482. package/dist/types/components/rtk-file-message/rtk-file-message.d.ts +1 -0
  483. package/dist/types/components/rtk-image-message/rtk-image-message.d.ts +1 -0
  484. package/dist/types/components/rtk-message-view/rtk-message-view.d.ts +2 -0
  485. package/dist/types/components/rtk-text-message/rtk-text-message.d.ts +1 -0
  486. package/dist/types/components.d.ts +104 -0
  487. package/dist/types/types/props.d.ts +1 -0
  488. package/dist/types/utils/chat.d.ts +1 -1
  489. package/package.json +1 -1
  490. package/dist/cjs/rtk-avatar_54.cjs.entry.js +0 -6417
  491. package/dist/components/p-6a47e2ee.js +0 -148
  492. package/dist/esm/rtk-avatar_54.entry.js +0 -6360
  493. package/dist/realtimekit-ui/p-173457a5.js +0 -1
  494. package/dist/realtimekit-ui/p-34c90f1c.entry.js +0 -1
  495. package/dist/realtimekit-ui/p-47314bc7.js +0 -1
  496. package/dist/realtimekit-ui/p-4ea418c9.js +0 -1
  497. package/dist/realtimekit-ui/p-55f181be.entry.js +0 -1
  498. package/dist/realtimekit-ui/p-bfed80f3.entry.js +0 -1
@@ -0,0 +1,2541 @@
1
+ import { r as registerInstance, h, H as Host, c as createEvent, a as getElement, w as writeTask } from './index-c1fb98bb.js';
2
+ import { e as defaultIconPack, h as useLanguage, c as createDefaultConfig, H as FlagsmithFeatureFlags, G as chatUnreadTimestamps, I as gracefulStorage, u as uiStore, b as createPeerStore } from './ui-store-9e486e1b.js';
3
+ import { f as formatName, g as getInitials, s as sanitizeLink, h as hasOnlyEmojis } from './string-068ce30a.js';
4
+ import { S as SyncWithStore } from './index-e65afca5.js';
5
+ import { d as debounce } from './debounce-3ea4df36.js';
6
+ import { h as handleFilesDataTransfer, g as generateChatGroupKey, T as TEMPORARY_CHANNEL_PREFIX, i as isDirectMessageChannel, d as alphabeticalSorter, e as getDMComparator, p as parseMessageForTarget, M as MAX_TEXT_LENGTH, f as parseRichText, j as extractReplyBlock, s as stripOutReplyBlock } from './chat-ff185374.js';
7
+ import { g as getExtension, a as getFileSize, d as downloadFile } from './file-6114f1a9.js';
8
+ import { p as provideRtkDesignSystem, d as deepMerge } from './merge-7ffc04b3.js';
9
+ import { R as Render } from './index-d31a2e33.js';
10
+ import { g as generateConfig } from './config-e684aa4d.js';
11
+ import { i as index } from './ResizeObserver.es-02979d4e.js';
12
+ import { c as computePosition, o as offset, f as flip, s as shift, a as arrow } from './floating-ui.dom.esm-21c3d54e.js';
13
+ import { f as formatDateTime, e as elapsedDuration } from './date-b1f78dea.js';
14
+ import { s as smoothScrollToBottom } from './scroll-2d8e810c.js';
15
+
16
+ const rtkAvatarCss = ":host{line-height:initial;font-family:var(--rtk-font-family, sans-serif);font-feature-settings:normal;font-variation-settings:normal}p{margin:var(--rtk-space-0, 0px);padding:var(--rtk-space-0, 0px)}:host{display:flex;height:var(--rtk-space-32, 128px);width:var(--rtk-space-32, 128px);align-items:center;justify-content:center;font-size:28px;--tw-bg-opacity:1;background-color:rgba(var(--rtk-colors-brand-500, 33 96 253) / var(--tw-bg-opacity));color:rgb(var(--rtk-colors-text-on-brand-1000, var(--rtk-colors-text-1000, 255 255 255)));overflow:clip;border-radius:9999px;-webkit-user-select:none;-moz-user-select:none;user-select:none}rtk-icon{height:50%;width:50%}.image-ctr{display:flex;height:100%;width:100%;align-items:center;justify-content:center;--tw-bg-opacity:1;background-color:rgba(var(--rtk-colors-background-700, 44 44 44) / var(--tw-bg-opacity));color:rgb(var(--rtk-colors-text-600, 255 255 255 / 0.52))}img{height:var(--rtk-space-0, 0px);width:var(--rtk-space-0, 0px);-o-object-fit:cover;object-fit:cover}img.loaded{height:100%;width:100%}.initials{display:flex;height:100%;width:100%;align-items:center;justify-content:center;text-transform:uppercase}.image{display:flex;height:100%;width:100%;align-items:center;justify-content:center}.image img{display:none;height:100%;width:100%;-o-object-fit:cover;object-fit:cover}.image img.loaded{display:block}:host([variant='hexagon']){border-radius:var(--rtk-border-radius-none, 0);clip-path:polygon(50% 0, 95% 25%, 95% 75%, 50% 100%, 5% 75%, 5% 25%)}:host([variant='square']){border-radius:var(--rtk-border-radius-none, 0);clip-path:polygon(0% 0%, 100% 0%, 100% 100%, 0% 100%)}:host([size='sm']){height:var(--rtk-space-14, 56px);width:var(--rtk-space-14, 56px);font-size:12px}:host([size='md']){height:var(--rtk-space-28, 112px);width:var(--rtk-space-28, 112px)}:host([size='lg']){height:var(--rtk-space-32, 128px);width:var(--rtk-space-32, 128px)}";
17
+ const RtkAvatarStyle0 = rtkAvatarCss;
18
+
19
+ var __decorate$h = (undefined && undefined.__decorate) || function (decorators, target, key, desc) {
20
+ var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
21
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function")
22
+ r = Reflect.decorate(decorators, target, key, desc);
23
+ else
24
+ for (var i = decorators.length - 1; i >= 0; i--)
25
+ if (d = decorators[i])
26
+ r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
27
+ return c > 3 && r && Object.defineProperty(target, key, r), r;
28
+ };
29
+ const RtkAvatar = class {
30
+ constructor(hostRef) {
31
+ registerInstance(this, hostRef);
32
+ /** Avatar type */
33
+ this.variant = 'circular';
34
+ /** Icon pack */
35
+ this.iconPack = defaultIconPack;
36
+ /** Language */
37
+ this.t = useLanguage();
38
+ this.imageState = 'loading';
39
+ this.getAvatar = () => {
40
+ var _a;
41
+ const name = formatName(((_a = this.participant) === null || _a === void 0 ? void 0 : _a.name) || '');
42
+ let picture;
43
+ if (this.participant != null && 'picture' in this.participant) {
44
+ picture = this.participant.picture;
45
+ }
46
+ if (picture && picture.length > 0 && this.imageState !== 'errored') {
47
+ return (h("div", { class: "image-ctr" }, this.imageState === 'loading' && h("rtk-spinner", { iconPack: this.iconPack }), h("img", { src: picture, class: { loaded: this.imageState === 'loaded' }, loading: "lazy", title: name, onLoad: () => (this.imageState = 'loaded'), onError: () => (this.imageState = 'errored'), part: "image" })));
48
+ }
49
+ const initials = getInitials(name);
50
+ return (h("div", { class: "initials", title: name, part: "initials" }, initials));
51
+ };
52
+ }
53
+ render() {
54
+ return (h(Host, { key: 'c1a0be37edb75c40b275ad59af85cee7df3f1cdf' }, this.getAvatar(), h("slot", { key: '1cd71e7494a09d68a52051edc279911dc3168515' })));
55
+ }
56
+ };
57
+ __decorate$h([
58
+ SyncWithStore()
59
+ ], RtkAvatar.prototype, "iconPack", void 0);
60
+ __decorate$h([
61
+ SyncWithStore()
62
+ ], RtkAvatar.prototype, "t", void 0);
63
+ RtkAvatar.style = RtkAvatarStyle0;
64
+
65
+ const rtkButtonCss = ":host{line-height:initial;font-family:var(--rtk-font-family, sans-serif);font-feature-settings:normal;font-variation-settings:normal}p{margin:var(--rtk-space-0, 0px);padding:var(--rtk-space-0, 0px)}:host{--icon-size:var(--rtk-button-icon-size, var(--rtk-space-5, 20px));--transition-property:var(--rtk-transition-property, all);--transition-duration:100ms;display:inline-flex;height:var(--rtk-space-8, 32px);cursor:pointer;--tw-bg-opacity:1;background-color:rgba(var(--rtk-colors-brand-500, 33 96 253) / var(--tw-bg-opacity));color:rgb(var(--rtk-colors-text-1000, 255 255 255));font-size:14px;-webkit-user-select:none;-moz-user-select:none;user-select:none;border-radius:var(--rtk-border-radius-sm, 4px);transition-property:var(--transition-property);transition-duration:var(--transition-duration)}button{box-sizing:border-box;background-color:transparent;color:inherit;border:var(--rtk-border-width-sm, 1px) solid transparent;padding-left:var(--rtk-space-2, 8px);padding-right:var(--rtk-space-2, 8px);display:inline-flex;flex-grow:1;justify-content:center;vertical-align:baseline;gap:var(--rtk-space-1, 4px);transition-property:var(--transition-property);transition-duration:var(--transition-duration);outline:none;height:inherit;border-radius:inherit;fill:inherit;cursor:inherit;font-weight:inherit;font-family:inherit;font-size:inherit;line-height:inherit}.start,.content,.end{align-self:center}::slotted(rtk-icon),::slotted(rtk-spinner){height:var(--icon-size);width:var(--icon-size)}:host([variant='primary']){color:rgb(var(--rtk-colors-text-on-brand-1000, var(--rtk-colors-text-1000, 255 255 255)))}:host(:hover){--tw-bg-opacity:1;background-color:rgba(var(--rtk-colors-brand-600, 13 81 253) / var(--tw-bg-opacity))}button:focus-visible{border-color:rgb(var(--rtk-colors-text-1000, 255 255 255))}:host(:active){--tw-bg-opacity:1;background-color:rgba(var(--rtk-colors-brand-700, 2 70 253) / var(--tw-bg-opacity))}:host([disabled]:not([disabled='false'])){cursor:not-allowed;opacity:0.6}:host([variant='secondary']){--tw-bg-opacity:1;background-color:rgba(var(--rtk-colors-background-600, 60 60 60) / var(--tw-bg-opacity))}:host([variant='secondary']:hover){--tw-bg-opacity:1;background-color:rgba(var(--rtk-colors-background-800, 30 30 30) / var(--tw-bg-opacity))}:host([variant='secondary']:active){--tw-bg-opacity:1;background-color:rgba(var(--rtk-colors-background-900, 26 26 26) / var(--tw-bg-opacity))}:host([variant='danger']){--tw-bg-opacity:1;background-color:rgba(var(--rtk-colors-danger, 255 45 45) / var(--tw-bg-opacity))}:host([variant='danger']:hover){background-color:rgba(var(--rtk-colors-danger, 255 45 45) / 0.7)}:host([variant='danger']:active){--tw-bg-opacity:1;background-color:rgba(var(--rtk-colors-danger, 255 45 45) / var(--tw-bg-opacity))}:host([variant='ghost']){background-color:transparent;color:inherit}:host([variant='ghost'].active){--tw-text-opacity:1;color:rgba(var(--rtk-colors-brand-300, 73 124 253) / var(--tw-text-opacity))}:host([variant='ghost']:hover){--tw-bg-opacity:1;background-color:rgba(var(--rtk-colors-background-600, 60 60 60) / var(--tw-bg-opacity))}:host([variant='ghost']:active){--tw-bg-opacity:1;background-color:rgba(var(--rtk-colors-background-700, 44 44 44) / var(--tw-bg-opacity))}:host([kind='icon']){--icon-size:var(--rtk-space-5, 20px);width:var(--rtk-space-8, 32px)}:host([kind='icon']) button{padding-left:var(--rtk-space-0, 0px);padding-right:var(--rtk-space-0, 0px)}:host([kind='wide']){width:100%}:host([size='lg']){--icon-size:var(--rtk-space-5, 20px);height:var(--rtk-space-10, 40px);font-size:16px}:host([size='lg'][kind='icon']){--icon-size:var(--rtk-space-6, 24px);height:var(--rtk-space-10, 40px);width:var(--rtk-space-10, 40px)}:host([size='sm']){--icon-size:var(--rtk-space-4, 16px);height:var(--rtk-space-6, 24px);font-size:12px}:host([size='sm'][kind='icon']){height:var(--rtk-space-6, 24px);width:var(--rtk-space-6, 24px)}";
66
+ const RtkButtonStyle0 = rtkButtonCss;
67
+
68
+ const RtkButton = class {
69
+ constructor(hostRef) {
70
+ registerInstance(this, hostRef);
71
+ /** Button variant */
72
+ this.variant = 'primary';
73
+ /** Button type */
74
+ this.kind = 'button';
75
+ /** Whether to reverse order of children */
76
+ this.reverse = false;
77
+ /** Where the button is disabled or not */
78
+ this.disabled = false;
79
+ /** Button type */
80
+ this.type = 'button';
81
+ }
82
+ render() {
83
+ return (h(Host, { key: '0f96cef4ae77a2be8013fa5d62d39626734eeced' }, h("button", { key: '8c06d5f5cc71779b8d56f31d2dd77b8d35e8b280', part: "button", type: this.type, disabled: this.disabled }, h("span", { key: 'ae741ddf8cc914f9493c26330b1f322541f64223', class: "start" }, h("slot", { key: '18275dab42a4dd38b5a59463ffca227e4a6df3c8', name: "start" })), h("span", { key: 'c2b912515b6edc2966c4cdb282c89022aa05c13f', class: "content", part: "content" }, h("slot", { key: '5d87993198e16a3b5f38e62979fa2ee5637a059d' })), h("span", { key: '0bc907da23ea362f8ae0b3fdf88452b1c3881078', class: "end" }, h("slot", { key: '0862eeefcfa5765ce605b99a04aab88222ed6e68', name: "end" })))));
84
+ }
85
+ static get delegatesFocus() { return true; }
86
+ };
87
+ RtkButton.style = RtkButtonStyle0;
88
+
89
+ const rtkChannelSelectorViewCss = ".scrollbar {\n /* For Firefox */\n scrollbar-width: thin;\n scrollbar-color: var(--rtk-scrollbar-color, rgb(var(--rtk-colors-background-600, 60 60 60)))\n var(--rtk-scrollbar-background, transparent);\n}\n\n/* For WebKit */\n.scrollbar::-webkit-scrollbar {\n height: var(--rtk-space-1\\.5, 6px);\n width: var(--rtk-space-1\\.5, 6px);\n border-radius: 9999px;\n background-color: var(--rtk-scrollbar-background, transparent);\n}\n\n.scrollbar::-webkit-scrollbar-thumb {\n border-radius: 9999px;\n background-color: var(--rtk-scrollbar-color, rgb(var(--rtk-colors-background-600, 60 60 60)));\n}\n\n\n:host {\n display: flex;\n flex-direction: column;\n width: 100%;\n --tw-bg-opacity: 1;\n background-color: rgba(var(--rtk-colors-background-900, 26 26 26) / var(--tw-bg-opacity));\n position: relative;\n z-index: 10;\n height: var(--rtk-space-12, 48px);\n min-height: 48px;\n}\n\n.dropdown-trigger {\n height: 100%;\n width: 100%;\n border-width: var(--rtk-border-width-none, 0);\n border-style: none;\n padding: var(--rtk-space-4, 16px);\n display: flex;\n align-items: center;\n justify-content: space-between;\n --tw-bg-opacity: 1;\n background-color: rgba(var(--rtk-colors-background-700, 44 44 44) / var(--tw-bg-opacity));\n font-size: 14px;\n color: rgb(var(--rtk-colors-text-1000, 255 255 255));\n cursor: pointer;\n position: absolute;\n z-index: 20;\n}\n\n.dropdown-trigger span {\n display: flex;\n flex: 1 1 0%;\n align-items: center;\n justify-content: space-between;\n}\n\n.dropdown-trigger rtk-icon {\n margin-left: var(--rtk-space-1, 4px);\n height: var(--rtk-space-5, 20px);\n width: var(--rtk-space-5, 20px);\n flex-shrink: 0;\n}\n\n@container chatcontainer (height < 360px) {\n .dropdown-trigger {\n padding: var(--rtk-space-2, 8px);\n }\n .dropdown {\n top: var(--rtk-space-8, 32px) !important;\n }\n .search-container {\n padding-left: var(--rtk-space-0, 0px) !important;\n padding-right: var(--rtk-space-0, 0px) !important;\n padding-top: var(--rtk-space-0, 0px) !important;\n padding-bottom: var(--rtk-space-0, 0px) !important;\n }\n input {\n height: var(--rtk-space-8, 32px) !important;\n border-radius: var(--rtk-border-radius-none, 0) !important;\n }\n .channel {\n height: var(--rtk-space-8, 32px) !important;\n border-radius: var(--rtk-border-radius-sm, 4px) !important;\n }\n .avatar-icon {\n height: var(--rtk-space-3, 12px) !important;\n width: var(--rtk-space-3, 12px) !important;\n padding: var(--rtk-space-1, 4px) !important;\n }\n\n rtk-avatar {\n height: var(--rtk-space-5, 20px) !important;\n width: var(--rtk-space-5, 20px) !important;\n }\n}\n\n.dropdown {\n position: absolute;\n width: 100%;\n --tw-bg-opacity: 1;\n background-color: rgba(var(--rtk-colors-background-900, 26 26 26) / var(--tw-bg-opacity));\n top: var(--rtk-space-12, 48px);\n z-index: 10;\n animation: 0.3s slide-down ease;\n}\n\n.dropdown .channels-container {\n max-height: var(--rtk-space-80, 320px);\n}\n\n.list {\n display: flex;\n flex-direction: column;\n}\n\n.list .channel .channel-data {\n align-items: flex-start;\n}\n\n.unread-count {\n display: flex;\n justify-content: center;\n height: var(--rtk-space-5, 20px);\n min-width: var(--rtk-space-3, 12px);\n border-radius: 9999px;\n padding-left: var(--rtk-space-1, 4px);\n padding-right: var(--rtk-space-1, 4px);\n font-size: 12px;\n line-height: 1.25rem;\n --tw-bg-opacity: 1;\n background-color: rgba(var(--rtk-colors-brand-500, 33 96 253) / var(--tw-bg-opacity));\n color: rgb(var(--rtk-colors-text-on-brand-1000, var(--rtk-colors-text-1000, 255 255 255)));\n}\n\ninput {\n height: var(--rtk-space-9, 36px);\n width: 100%;\n padding-left: var(--rtk-space-3, 12px);\n padding-right: var(--rtk-space-3, 12px);\n box-sizing: border-box;\n border-width: var(--rtk-border-width-none, 0);\n border-style: none;\n outline: 2px solid transparent;\n outline-offset: 2px;\n border-radius: var(--rtk-border-radius-sm, 4px);\n --tw-bg-opacity: 1;\n background-color: rgba(var(--rtk-colors-background-600, 60 60 60) / var(--tw-bg-opacity));\n color: rgb(var(--rtk-colors-text-1000, 255 255 255));\n}\n\n.search-container {\n display: flex;\n flex-shrink: 0;\n flex-grow: 0;\n flex-basis: auto;\n align-items: center;\n padding-top: var(--rtk-space-3, 12px);\n padding-bottom: var(--rtk-space-3, 12px);\n padding-left: var(--rtk-space-2, 8px);\n padding-right: var(--rtk-space-2, 8px);\n border-bottom: var(--rtk-border-width-sm, 1px) solid rgb(var(--rtk-colors-background-700, 44 44 44));\n}\n\n.search-container rtk-icon {\n margin-left: calc(var(--rtk-space-8, 32px) * -1);\n height: var(--rtk-space-5, 20px);\n width: var(--rtk-space-5, 20px);\n color: rgb(var(--rtk-colors-text-800, 255 255 255 / 0.76));\n}\n\n.channels-container {\n display: flex;\n flex-direction: column;\n gap: var(--rtk-space-1, 4px);\n padding: var(--rtk-space-2, 8px);\n flex: 1 1 auto;\n overflow-y: auto;\n}\n\n.channel {\n flex-shrink: 0;\n box-sizing: border-box;\n border-width: var(--rtk-border-width-none, 0);\n border-style: none;\n background-color: transparent;\n outline: 2px solid transparent;\n outline-offset: 2px;\n cursor: pointer;\n border-radius: var(--rtk-border-radius-md, 8px);\n display: flex;\n align-items: center;\n justify-content: space-between;\n gap: var(--rtk-space-2, 8px);\n height: var(--rtk-space-16, 64px);\n width: 100%;\n padding-left: var(--rtk-space-2, 8px);\n padding-right: var(--rtk-space-3, 12px);\n color: rgb(var(--rtk-colors-text-1000, 255 255 255));\n transition-property: color, background-color, border-color, text-decoration-color, fill, stroke;\n transition-timing-function: cubic-bezier(0.4, 0, 0.2, 1);\n transition-duration: 150ms;\n}\n\n.channel:hover {\n --tw-bg-opacity: 1;\n background-color: rgba(var(--rtk-colors-background-600, 60 60 60) / var(--tw-bg-opacity));\n}\n\n.channel .channel-data {\n flex: 1 1 0%;\n align-items: center;\n justify-content: space-between;\n display: flex;\n gap: var(--rtk-space-2, 8px);\n}\n\n.channel .name {\n font-size: 16px;\n}\n\n.channel .name, \n .channel .last-message {\n max-width: var(--rtk-space-40, 160px);\n text-align: left;\n overflow: hidden;\n display: -webkit-box;\n -webkit-box-orient: vertical;\n -webkit-line-clamp: 1;\n}\n\n.channel .no-message {\n font-style: italic;\n}\n\n.channel rtk-avatar {\n height: var(--rtk-space-12, 48px);\n width: var(--rtk-space-12, 48px);\n overflow: clip;\n border-radius: 9999px;\n font-size: 14px;\n}\n\n.channel .avatar-icon {\n height: var(--rtk-space-6, 24px);\n width: var(--rtk-space-6, 24px);\n padding: var(--rtk-space-3, 12px);\n color: rgb(var(--rtk-colors-text-on-brand-1000, var(--rtk-colors-text-1000, 255 255 255)));\n overflow: clip;\n border-radius: 9999px;\n --tw-bg-opacity: 1;\n background-color: rgba(var(--rtk-colors-brand-500, 33 96 253) / var(--tw-bg-opacity));\n}\n\n.channel time, \n .channel .last-message {\n font-size: 12px;\n color: rgb(var(--rtk-colors-text-800, 255 255 255 / 0.76));\n}\n\n.channel.active {\n --tw-bg-opacity: 1;\n background-color: rgba(var(--rtk-colors-brand-300, 73 124 253) / var(--tw-bg-opacity));\n color: rgb(var(--rtk-colors-text-on-brand-1000, var(--rtk-colors-text-1000, 255 255 255)));\n}\n\n.channel.active .unread-count {\n background-color: rgb(var(--rtk-colors-text-on-brand-800, var(--rtk-colors-text-800, 255 255 255 / 0.76)));\n --tw-text-opacity: 1;\n color: rgba(var(--rtk-colors-brand-500, 33 96 253) / var(--tw-text-opacity));\n}\n\n.channel.active time {\n color: rgb(var(--rtk-colors-text-on-brand-800, var(--rtk-colors-text-800, 255 255 255 / 0.76)));\n}\n\n.channel.active .last-message {\n color: rgb(var(--rtk-colors-text-on-brand-700, var(--rtk-colors-text-700, 255 255 255 / 0.64)));\n}\n\n.channel.active rtk-avatar {\n --tw-bg-opacity: 1;\n background-color: rgba(var(--rtk-colors-brand-500, 33 96 253) / var(--tw-bg-opacity));\n color: rgb(var(--rtk-colors-text-on-brand-1000, var(--rtk-colors-text-1000, 255 255 255)));\n}\n\n.col {\n gap: var(--rtk-space-1, 4px);\n display: flex;\n flex-direction: column;\n}\n\n.channel-meta {\n flex-shrink: 0;\n align-items: flex-end;\n}\n\n@keyframes slide-down {\n from {\n transform: translateY(-50px);\n }\n to {\n transform: translateY(0%);\n }\n}\n";
90
+ const RtkChannelSelectorViewStyle0 = rtkChannelSelectorViewCss;
91
+
92
+ var __decorate$g = (undefined && undefined.__decorate) || function (decorators, target, key, desc) {
93
+ var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
94
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function")
95
+ r = Reflect.decorate(decorators, target, key, desc);
96
+ else
97
+ for (var i = decorators.length - 1; i >= 0; i--)
98
+ if (d = decorators[i])
99
+ r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
100
+ return c > 3 && r && Object.defineProperty(target, key, r), r;
101
+ };
102
+ const RtkChannelSelectorView = class {
103
+ constructor(hostRef) {
104
+ registerInstance(this, hostRef);
105
+ this.channelChange = createEvent(this, "channelChange", 7);
106
+ /** Disables search bar (default = false) */
107
+ this.disableSearch = false;
108
+ /** Hides avatar (default = false) */
109
+ this.hideAvatar = false;
110
+ /** Icon Pack */
111
+ this.iconPack = defaultIconPack;
112
+ /** Language */
113
+ this.t = useLanguage();
114
+ /** Render as dropdown or list (default = list) */
115
+ this.viewAs = 'list';
116
+ this.searchQuery = '';
117
+ this.showDropdown = false;
118
+ this.calculateListHeight = debounce(() => {
119
+ if (this.viewAs === 'list' && this.$listEl) {
120
+ let height = 0;
121
+ const slotEl = this.$el.shadowRoot.querySelector('slot[name="header"]');
122
+ if (slotEl) {
123
+ slotEl.assignedElements().forEach((e) => (height += e.offsetHeight));
124
+ }
125
+ if (this.$searchEl) {
126
+ height += this.$searchEl.offsetHeight;
127
+ }
128
+ this.$listEl.style.height = `${window.innerHeight - height - 16}px`;
129
+ }
130
+ }, 60);
131
+ this.getFilteredChannels = () => {
132
+ if (this.searchQuery.trim() === '') {
133
+ return this.channels;
134
+ }
135
+ return this.channels.filter((channel) => {
136
+ return channel['name'].toLowerCase().includes(this.searchQuery.toLowerCase());
137
+ });
138
+ };
139
+ this.toggleDropdown = () => {
140
+ this.showDropdown = !this.showDropdown;
141
+ };
142
+ this.getChannelById = (id) => {
143
+ return this.channels.find((channel) => channel.id === id);
144
+ };
145
+ this.getTotalUnreads = () => {
146
+ return this.channels.reduce((acc, curr) => {
147
+ return acc + curr.unreadCount;
148
+ }, 0);
149
+ };
150
+ this.onChannelClickHandler = (channel) => {
151
+ this.channelChange.emit(channel);
152
+ if (this.viewAs === 'dropdown') {
153
+ this.showDropdown = false;
154
+ }
155
+ };
156
+ }
157
+ connectedCallback() {
158
+ this.resizeObserver = new ResizeObserver(this.calculateListHeight);
159
+ }
160
+ componentDidLoad() {
161
+ this.resizeObserver.observe(this.$el);
162
+ this.calculateListHeight();
163
+ }
164
+ disconnectedCallback() {
165
+ var _a;
166
+ (_a = this.resizeObserver) === null || _a === void 0 ? void 0 : _a.disconnect();
167
+ this.calculateListHeight.cancel();
168
+ }
169
+ getTimeLabel(messageDate) {
170
+ const today = new Date();
171
+ const yesterday = new Date(today);
172
+ yesterday.setDate(today.getDate() - 1);
173
+ const firstDayOfWeek = new Date(today);
174
+ firstDayOfWeek.setDate(today.getDate() - today.getDay() - 1);
175
+ if (messageDate.toDateString() === today.toDateString()) {
176
+ return messageDate.toLocaleTimeString([], { hour: '2-digit', minute: '2-digit' });
177
+ }
178
+ else if (messageDate.toDateString() === yesterday.toDateString()) {
179
+ return this.t('date.yesteday');
180
+ }
181
+ else if (messageDate > firstDayOfWeek) {
182
+ const weekdays = [
183
+ 'date.sunday',
184
+ 'date.monday',
185
+ 'date.tuesday',
186
+ 'date.wednesday',
187
+ 'date.thursday',
188
+ 'date.friday',
189
+ 'date.saturday',
190
+ ];
191
+ return this.t(weekdays[messageDate.getDay()]);
192
+ }
193
+ else {
194
+ return Intl.DateTimeFormat([], {
195
+ day: '2-digit',
196
+ month: '2-digit',
197
+ year: '2-digit',
198
+ }).format(messageDate);
199
+ }
200
+ }
201
+ render() {
202
+ const filteredChannels = this.getFilteredChannels();
203
+ const shouldShowDropdown = this.viewAs === 'list' || (this.viewAs === 'dropdown' && this.showDropdown);
204
+ return (h(Host, { key: 'adc8ab4b9c8c865998588fbd9766296f18b3e48e' }, this.viewAs === 'list' && h("slot", { key: 'e5740725a4349472ca2eb1fb0816eb2311a99838', name: "header" }), shouldShowDropdown && (h("div", { key: '425adc920c28e0421e07bb0bd9f61b31c42fcda9', class: {
205
+ dropdown: this.viewAs === 'dropdown',
206
+ scrollbar: this.viewAs === 'dropdown',
207
+ list: this.viewAs === 'list',
208
+ } }, !this.disableSearch && (h("div", { key: '9fbbc48d8489f2a6490729fac1fecdef1838e84a', class: "search-container", ref: (el) => (this.$searchEl = el) }, h("input", { key: 'f7fb43662d50274f80380b735ef9f5fc0b215442', type: "text", placeholder: this.t('chat.search_conversations'), value: this.searchQuery, onInput: (e) => (this.searchQuery = e.target.value) }), h("rtk-icon", { key: 'af76e65a1397d2a6e557a28b687e26aef641c568', icon: this.iconPack.search }))), h("div", { key: '0711a9cfcc811269a5020dc41030c0daee5cc8bf', class: "channels-container scrollbar", ref: (el) => (this.$listEl = el) }, filteredChannels.map((channel) => {
209
+ return (h("button", { class: { channel: true, active: this.selectedChannelId === channel.id }, onClick: () => this.onChannelClickHandler(channel) }, !this.hideAvatar && (h("div", null, channel.icon ? (h("rtk-icon", { class: "avatar-icon", icon: this.iconPack[channel.icon] })) : (h("rtk-avatar", { participant: {
210
+ name: channel.name,
211
+ picture: channel.avatarUrl,
212
+ } })))), h("div", { class: "channel-data" }, h("div", { class: "col" }, h("div", { class: "name" }, channel.name), channel.latestMessage && (h("div", { class: {
213
+ 'last-message': true,
214
+ 'no-message': !channel.latestMessage,
215
+ } }, h("rtk-text-message-view", { isMarkdown: true, text: channel.latestMessage })))), h("div", { class: "col channel-meta" }, channel.latestMessageTime && (h("time", { class: "time" }, this.getTimeLabel(channel.latestMessageTime))), channel.unreadCount > 0 && (h("div", { class: "unread-count" }, channel.unreadCount))))));
216
+ })))), this.viewAs === 'dropdown' && (h("button", { key: '0c87f90d6d0fe22284995ab7259689f80a862829', class: "dropdown-trigger", onClick: this.toggleDropdown }, h("span", { key: 'd1a364f2c5c57d19702d0b8707ca661c1dc4c14f' }, this.selectedChannelId &&
217
+ `${this.t('to')} ${this.getChannelById(this.selectedChannelId).name}`, this.getTotalUnreads() > 0 && (h("div", { key: 'bf789f9df82851825bc6ea12a19a5f37ab74aefe', class: "unread-count" }, this.getTotalUnreads()))), h("rtk-icon", { key: 'c0d03f883f4c46b2698be0f197751fc0470717ea', icon: this.showDropdown ? this.iconPack.chevron_up : this.iconPack.chevron_down })))));
218
+ }
219
+ get $el() { return getElement(this); }
220
+ };
221
+ __decorate$g([
222
+ SyncWithStore()
223
+ ], RtkChannelSelectorView.prototype, "iconPack", void 0);
224
+ __decorate$g([
225
+ SyncWithStore()
226
+ ], RtkChannelSelectorView.prototype, "t", void 0);
227
+ RtkChannelSelectorView.style = RtkChannelSelectorViewStyle0;
228
+
229
+ const rtkChatCss = ":host {\n line-height: initial;\n font-family: var(--rtk-font-family, sans-serif);\n\n font-feature-settings: normal;\n font-variation-settings: normal;\n}\n\np {\n margin: var(--rtk-space-0, 0px);\n padding: var(--rtk-space-0, 0px);\n}\n\n.scrollbar {\n /* For Firefox */\n scrollbar-width: thin;\n scrollbar-color: var(--rtk-scrollbar-color, rgb(var(--rtk-colors-background-600, 60 60 60)))\n var(--rtk-scrollbar-background, transparent);\n}\n\n/* For WebKit */\n.scrollbar::-webkit-scrollbar {\n height: var(--rtk-space-1\\.5, 6px);\n width: var(--rtk-space-1\\.5, 6px);\n border-radius: 9999px;\n background-color: var(--rtk-scrollbar-background, transparent);\n}\n\n.scrollbar::-webkit-scrollbar-thumb {\n border-radius: 9999px;\n background-color: var(--rtk-scrollbar-color, rgb(var(--rtk-colors-background-600, 60 60 60)));\n}\n\n\n:host {\n display: flex;\n height: 100%;\n width: 100%;\n flex-direction: column;\n font-size: 14px;\n position: relative;\n color: rgb(var(--rtk-colors-text-1000, 255 255 255));\n}\n\nh3 {\n margin: var(--rtk-space-0, 0px);\n display: flex;\n height: var(--rtk-space-12, 48px);\n align-items: center;\n justify-content: center;\n font-size: 16px;\n font-weight: 400;\n color: rgb(var(--rtk-colors-text-900, 255 255 255 / 0.88));\n text-align: center;\n}\n\n#dropzone {\n position: absolute;\n top: var(--rtk-space-0, 0px);\n right: var(--rtk-space-0, 0px);\n bottom: var(--rtk-space-0, 0px);\n left: var(--rtk-space-0, 0px);\n z-index: 10;\n display: none;\n flex-direction: column;\n align-items: center;\n justify-content: center;\n --tw-bg-opacity: 1;\n background-color: rgba(var(--rtk-colors-background-800, 30 30 30) / var(--tw-bg-opacity));\n color: rgb(var(--rtk-colors-text-700, 255 255 255 / 0.64));\n}\n\n#dropzone.active {\n display: flex;\n animation: 0.2s slide-up ease-in;\n}\n\nrtk-chat-messages-ui,\nrtk-chat-messages-ui-paginated {\n flex: 1 0 0;\n}\n\nrtk-chat-composer-view {\n margin: var(--rtk-space-2, 8px);\n}\n\n.chat-container {\n display: flex;\n height: 100%;\n width: 100%;\n flex-direction: row;\n container-type: size;\n container-name: chatcontainer;\n}\n\n@container chatcontainer (height < 360px) {\n rtk-channel-selector-view {\n height: var(--rtk-space-8, 32px);\n min-height: 24px;\n }\n}\n\n.chat {\n display: flex;\n flex: 1 1 0%;\n flex-direction: column;\n}\n\n.banner {\n height: 100%;\n width: 100%;\n display: flex;\n flex-direction: column;\n align-items: center;\n justify-content: center;\n}\n\n.banner .welcome-new-channel {\n width: var(--rtk-space-48, 192px);\n}\n\n.banner .create-channel-illustration {\n height: var(--rtk-space-40, 160px);\n width: var(--rtk-space-40, 160px);\n}\n\n.channel-selector-header {\n box-sizing: border-box;\n height: var(--rtk-space-16, 64px);\n padding: var(--rtk-space-4, 16px);\n display: flex;\n justify-content: space-between;\n border-bottom: var(--rtk-border-width-sm, 1px) solid rgb(var(--rtk-colors-background-700, 44 44 44));\n}\n\n.channel-selector-header .channel-create-btn {\n width: var(--rtk-space-8, 32px);\n justify-content: center;\n}\n\n.channel-selector-header .channel-create-btn:hover {\n --tw-text-opacity: 1;\n color: rgba(var(--rtk-colors-brand-300, 73 124 253) / var(--tw-text-opacity));\n}\n\n.view-chats-btn {\n margin-top: var(--rtk-space-4, 16px);\n}\n\n.selector-container {\n z-index: 50;\n width: 100%;\n max-width: var(--rtk-space-80, 320px);\n border-right: var(--rtk-border-width-sm, 1px) solid rgb(var(--rtk-colors-background-600, 60 60 60));\n}\n\n.selector-container.hide {\n display: none;\n}\n\n.mobile-close-btn {\n display: none;\n}\n\n.selector-container.mobile {\n height: 100%;\n width: 100%;\n max-width: 100%;\n position: absolute;\n top: var(--rtk-space-0, 0px);\n right: var(--rtk-space-0, 0px);\n bottom: var(--rtk-space-0, 0px);\n left: var(--rtk-space-0, 0px);\n background-color: rgba(var(--rtk-colors-background-1000, 8 8 8) / 0.6);\n display: flex;\n}\n\n.selector-container.mobile rtk-channel-selector-view {\n max-width: var(--rtk-space-96, 384px);\n animation: 0.3s swipe-in;\n}\n\n.selector-container.mobile .mobile-close-btn {\n margin-top: var(--rtk-space-4, 16px);\n margin-bottom: var(--rtk-space-4, 16px);\n margin-left: var(--rtk-space-6, 24px);\n margin-right: var(--rtk-space-6, 24px);\n display: block;\n}\n\n.pinned-messages-header {\n display: flex;\n align-items: center;\n gap: var(--rtk-space-2, 8px);\n padding: var(--rtk-space-2, 8px);\n --tw-bg-opacity: 1;\n background-color: rgba(var(--rtk-colors-background-600, 60 60 60) / var(--tw-bg-opacity));\n font-size: 12px;\n cursor: pointer;\n}\n\n.pinned-messages-header rtk-icon {\n height: var(--rtk-space-3, 12px);\n width: var(--rtk-space-3, 12px);\n}\n\n.pinned-messages-header:hover {\n --tw-bg-opacity: 1;\n background-color: rgba(var(--rtk-colors-brand-500, 33 96 253) / var(--tw-bg-opacity));\n}\n\n.pinned-messages-header.active {\n --tw-bg-opacity: 1;\n background-color: rgba(var(--rtk-colors-brand-500, 33 96 253) / var(--tw-bg-opacity));\n}\n\n@keyframes swipe-in {\n from {\n transform: translateX(-100%);\n }\n to {\n transform: translateX(0);\n }\n}\n";
230
+ const RtkChatStyle0 = rtkChatCss;
231
+
232
+ var __decorate$f = (undefined && undefined.__decorate) || function (decorators, target, key, desc) {
233
+ var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
234
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function")
235
+ r = Reflect.decorate(decorators, target, key, desc);
236
+ else
237
+ for (var i = decorators.length - 1; i >= 0; i--)
238
+ if (d = decorators[i])
239
+ r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
240
+ return c > 3 && r && Object.defineProperty(target, key, r), r;
241
+ };
242
+ const RtkChat = class {
243
+ constructor(hostRef) {
244
+ registerInstance(this, hostRef);
245
+ this.stateUpdate = createEvent(this, "rtkStateUpdate", 7);
246
+ this.chatUpdateListener = ({ message }) => {
247
+ if (message.channelId)
248
+ return;
249
+ if (!this.displayFilter || this.displayFilter(message)) {
250
+ this.addToChatGroup(message);
251
+ // shallow copy to trigger render
252
+ this.chatGroups = Object.assign({}, this.chatGroups);
253
+ }
254
+ };
255
+ this.chatPermissionUpdateListener = () => {
256
+ this.canSend = this.meeting.self.permissions.chatPublic.canSend;
257
+ this.canSendTextMessage = this.meeting.self.permissions.chatPublic.text;
258
+ this.canSendFiles = this.meeting.self.permissions.chatPublic.files;
259
+ };
260
+ /** Config */
261
+ this.config = createDefaultConfig();
262
+ /** Icon pack */
263
+ this.iconPack = defaultIconPack;
264
+ /** Language */
265
+ this.t = useLanguage();
266
+ /** disables private chat */
267
+ this.disablePrivateChat = false;
268
+ /** Can current user pin/unpin messages */
269
+ this.canPinMessages = false;
270
+ /**
271
+ * @deprecated
272
+ * Beta API, will change in future
273
+ * List of target presets allowed as private chat recipient
274
+ */
275
+ this.privatePresetFilter = [];
276
+ /**
277
+ * @deprecated
278
+ * Beta API, will change in future
279
+ * A filter function for messages to be displayed
280
+ */
281
+ this.displayFilter = undefined;
282
+ this.unreadCountGroups = {};
283
+ this.chatGroups = { everyone: [] };
284
+ this.selectedGroup = 'everyone';
285
+ this.now = new Date();
286
+ this.dropzoneActivated = false;
287
+ this.showLatestMessageButton = false;
288
+ this.canSend = false;
289
+ this.canSendTextMessage = false;
290
+ this.canSendFiles = false;
291
+ this.canPrivateMessage = false;
292
+ this.canSendPrivateTexts = false;
293
+ this.canSendPrivateFiles = false;
294
+ this.emojiPickerEnabled = false;
295
+ this.chatRecipientId = 'everyone';
296
+ this.participants = [];
297
+ this.channels = [];
298
+ this.editingMessage = null;
299
+ this.replyMessage = null;
300
+ this.searchQuery = '';
301
+ this.selectorState = 'hide';
302
+ this.creatingChannel = false;
303
+ this.showPinnedMessages = false;
304
+ this.channelMap = new Map();
305
+ this.onDragOver = (e) => {
306
+ e.preventDefault();
307
+ this.dropzoneActivated = true;
308
+ };
309
+ this.onDragLeave = () => {
310
+ this.dropzoneActivated = false;
311
+ };
312
+ this.onDrop = (e) => {
313
+ e.preventDefault();
314
+ this.dropzoneActivated = false;
315
+ handleFilesDataTransfer(e.dataTransfer.items, (type, file) => {
316
+ var _a, _b, _c, _d;
317
+ switch (type) {
318
+ case 'image':
319
+ if (this.isFileMessagingAllowed()) {
320
+ (_b = (_a = this.meeting) === null || _a === void 0 ? void 0 : _a.chat) === null || _b === void 0 ? void 0 : _b.sendImageMessage(file, this.getRecipientPeerIds());
321
+ }
322
+ break;
323
+ case 'file':
324
+ if (this.isFileMessagingAllowed()) {
325
+ (_d = (_c = this.meeting) === null || _c === void 0 ? void 0 : _c.chat) === null || _d === void 0 ? void 0 : _d.sendFileMessage(file, this.getRecipientPeerIds());
326
+ }
327
+ break;
328
+ }
329
+ });
330
+ };
331
+ this.disconnectMeeting = (meeting) => {
332
+ var _a, _b, _c, _d, _e, _f;
333
+ if (this.isPrivateChatSupported()) {
334
+ meeting === null || meeting === void 0 ? void 0 : meeting.participants.joined.removeListener('participantJoined', this.onParticipantUpdate);
335
+ meeting === null || meeting === void 0 ? void 0 : meeting.participants.joined.removeListener('participantLeft', this.onParticipantUpdate);
336
+ }
337
+ (_a = meeting === null || meeting === void 0 ? void 0 : meeting.chat) === null || _a === void 0 ? void 0 : _a.removeListener('chatUpdate', this.chatUpdateListener);
338
+ (_b = meeting === null || meeting === void 0 ? void 0 : meeting.chat) === null || _b === void 0 ? void 0 : _b.removeListener('channelCreate', this.onChannelCreateOrUpdate);
339
+ (_c = meeting === null || meeting === void 0 ? void 0 : meeting.chat) === null || _c === void 0 ? void 0 : _c.removeListener('channelUpdate', this.onChannelCreateOrUpdate);
340
+ (_d = meeting === null || meeting === void 0 ? void 0 : meeting.chat) === null || _d === void 0 ? void 0 : _d.removeListener('channelMessageUpdate', this.onChannelCreateOrUpdate);
341
+ (_f = (_e = meeting === null || meeting === void 0 ? void 0 : meeting.participants) === null || _e === void 0 ? void 0 : _e.all) === null || _f === void 0 ? void 0 : _f.removeListener('participantsUpdate', this.onChannelCreateOrUpdate);
342
+ meeting.self.permissions.removeListener('*', this.chatPermissionUpdateListener);
343
+ };
344
+ this.getFilteredParticipants = () => {
345
+ if (this.privatePresetFilter.length === 0)
346
+ return this.participants;
347
+ return this.participants.filter((p) => this.privatePresetFilter.includes(p.presetName));
348
+ };
349
+ this.onParticipantUpdate = () => {
350
+ this.participants = this.meeting.participants.joined
351
+ .toArray()
352
+ .filter((p) => this.privatePresetFilter.length === 0 || this.privatePresetFilter.includes(p.presetName));
353
+ // if selected participant leaves, reset state to everyone
354
+ if (this.selectedParticipant && !this.participants.includes(this.selectedParticipant)) {
355
+ this.selectedParticipant = null;
356
+ this.chatRecipientId = this.selectedGroup = 'everyone';
357
+ }
358
+ };
359
+ this.updateUnreadCountGroups = (obj) => {
360
+ this.unreadCountGroups = Object.assign(Object.assign({}, this.unreadCountGroups), obj);
361
+ };
362
+ this.isPrivateChatSupported = () => {
363
+ return this.canPrivateMessage && !this.disablePrivateChat;
364
+ };
365
+ this.updateRecipients = (event) => {
366
+ const { id } = event.detail;
367
+ this.chatRecipientId = id;
368
+ this.selectedParticipant = this.participants.find((p) => p.userId === id);
369
+ if (this.chatRecipientId !== 'everyone') {
370
+ const allParticipants = [this.chatRecipientId, this.meeting.self.userId];
371
+ const targetKey = generateChatGroupKey(allParticipants);
372
+ this.selectedGroup = targetKey;
373
+ }
374
+ else {
375
+ this.selectedGroup = 'everyone';
376
+ }
377
+ this.updateUnreadCountGroups({ [this.selectedGroup]: 0 });
378
+ };
379
+ this.isTextMessagingAllowed = () => {
380
+ if (this.chatRecipientId === 'everyone') {
381
+ // public chat
382
+ return this.canSend && this.canSendTextMessage;
383
+ }
384
+ // private chat
385
+ return this.canPrivateMessage && this.canSendPrivateTexts;
386
+ };
387
+ this.isFileMessagingAllowed = () => {
388
+ if (this.chatRecipientId === 'everyone') {
389
+ // public chat
390
+ return this.canSend && this.canSendFiles;
391
+ }
392
+ // private chat
393
+ return this.canPrivateMessage && this.canSendPrivateFiles;
394
+ };
395
+ this.onChannelChanged = (e) => {
396
+ const channel = e.detail;
397
+ if (channel.id.includes(TEMPORARY_CHANNEL_PREFIX)) {
398
+ this.createDMChannel(channel.id.replace(TEMPORARY_CHANNEL_PREFIX, ''));
399
+ }
400
+ else {
401
+ this.selectedChannelId = channel.id;
402
+ }
403
+ this.cleanup();
404
+ if (this.selectorState !== 'desktop') {
405
+ this.selectorState = 'hide';
406
+ }
407
+ };
408
+ this.createDMChannel = async (memberId) => {
409
+ this.creatingChannel = true;
410
+ const newChannel = await this.meeting.chat.createChannel('Direct Message', [memberId], {
411
+ visibility: 'private',
412
+ isDirectMessage: true,
413
+ });
414
+ this.creatingChannel = false;
415
+ this.selectedChannelId = newChannel.id;
416
+ };
417
+ this.cleanup = () => {
418
+ this.editingMessage = null;
419
+ this.replyMessage = null;
420
+ this.searchQuery = '';
421
+ };
422
+ this.onQuotedMessageDismiss = () => {
423
+ this.replyMessage = null;
424
+ };
425
+ this.onChannelCreateOrUpdate = (channel) => {
426
+ if (channel) {
427
+ this.channelMap.set(channel.id, channel);
428
+ }
429
+ else {
430
+ this.meeting.chat.channels.forEach((chan) => this.channelMap.set(chan.id, chan));
431
+ }
432
+ const allChannels = Array.from(this.channelMap.values());
433
+ const channels = allChannels
434
+ .filter((channel) => !isDirectMessageChannel(channel))
435
+ .sort((a, b) => alphabeticalSorter(a.displayName, b.displayName));
436
+ const membersWithChannel = allChannels.filter(isDirectMessageChannel).map((channel) => {
437
+ return Object.assign(Object.assign({}, channel), { displayName: this.getMemberDisplayName(channel) });
438
+ });
439
+ const membersWithoutChannel = this.meeting.participants.all
440
+ .toArray()
441
+ .filter((member) => {
442
+ if (member.userId === this.meeting.self.userId)
443
+ return false;
444
+ const matcher = getDMComparator([this.meeting.self.userId, member.userId]);
445
+ return membersWithChannel.every((channel) => getDMComparator(channel.memberIds) !== matcher);
446
+ })
447
+ .map((member) => {
448
+ return {
449
+ id: `${TEMPORARY_CHANNEL_PREFIX}${member.userId}`,
450
+ displayName: member.name,
451
+ displayPictureUrl: member.picture,
452
+ isDirectMessage: true,
453
+ unreadCount: 0,
454
+ };
455
+ });
456
+ const dms = [...membersWithChannel, ...membersWithoutChannel].sort((a, b) => alphabeticalSorter(a.displayName, b.displayName));
457
+ this.channels = [...channels, ...dms];
458
+ // select channel only if it is created in db
459
+ const nonTemporaryChannel = [...channels, ...membersWithChannel];
460
+ if (!this.selectedChannelId && nonTemporaryChannel.length !== 0) {
461
+ this.selectedChannelId = nonTemporaryChannel[0].id;
462
+ }
463
+ };
464
+ this.getMemberDisplayName = (channel) => {
465
+ var _a;
466
+ let id;
467
+ if (channel.memberIds.length === 1) {
468
+ // channel with self
469
+ id = channel.memberIds[0];
470
+ }
471
+ else {
472
+ id =
473
+ channel.memberIds[0] === this.meeting.self.userId
474
+ ? channel.memberIds[1]
475
+ : channel.memberIds[0];
476
+ }
477
+ const member = this.meeting.participants.all.toArray().find((member) => member.userId === id);
478
+ return (_a = member === null || member === void 0 ? void 0 : member.name) !== null && _a !== void 0 ? _a : id;
479
+ };
480
+ this.onNewMessageHandler = async (e) => {
481
+ const message = e.detail;
482
+ this.meeting.chat.sendMessage(message, this.getRecipientPeerIds());
483
+ };
484
+ this.onEditMessageHandler = async (e) => {
485
+ var _a, _b;
486
+ await ((_b = (_a = this.meeting) === null || _a === void 0 ? void 0 : _a.chat) === null || _b === void 0 ? void 0 : _b.editTextMessage(this.editingMessage.id, e.detail, this.editingMessage.channelId));
487
+ this.editingMessage = null;
488
+ };
489
+ this.onEditCancel = () => {
490
+ this.editingMessage = null;
491
+ };
492
+ this.onPinMessage = (event) => {
493
+ const message = event.detail;
494
+ if (message.pinned) {
495
+ this.meeting.chat.unpin(message.id);
496
+ }
497
+ else {
498
+ this.meeting.chat.pin(message.id);
499
+ }
500
+ };
501
+ this.onDeleteMessage = (event) => {
502
+ const message = event.detail;
503
+ this.meeting.chat.deleteMessage(message.id);
504
+ };
505
+ this.getPrivateChatRecipients = () => {
506
+ const participants = this.getFilteredParticipants().map((participant) => {
507
+ const key = generateChatGroupKey([participant.userId, this.meeting.self.userId]);
508
+ const result = {
509
+ id: participant.userId,
510
+ name: participant.name,
511
+ avatarUrl: participant.picture,
512
+ unreadCount: this.unreadCountGroups[key],
513
+ };
514
+ return result;
515
+ });
516
+ const everyone = {
517
+ id: 'everyone',
518
+ name: this.t('chat.everyone'),
519
+ icon: 'participants',
520
+ unreadCount: this.unreadCountGroups['everyone'],
521
+ };
522
+ return [everyone, ...participants];
523
+ };
524
+ this.onTogglePinnedMessages = () => {
525
+ this.showPinnedMessages = !this.showPinnedMessages;
526
+ };
527
+ this.renderPinnedMessagesHeader = () => {
528
+ if (this.meeting.chat.pinned.length === 0)
529
+ return null;
530
+ return (h("rtk-tooltip", { label: this.t('chat.toggle_pinned_msgs') }, h("div", { class: { 'pinned-messages-header': true, active: this.showPinnedMessages }, onClick: this.onTogglePinnedMessages }, h("rtk-icon", { icon: this.iconPack.pin }), this.t('chat.pinned_msgs'), ` (${this.meeting.chat.pinned.length})`)));
531
+ };
532
+ }
533
+ connectedCallback() {
534
+ if (!this.meeting)
535
+ return;
536
+ this.meetingChanged(this.meeting);
537
+ if (this.meeting && !this.meeting.chat) {
538
+ return;
539
+ }
540
+ if (this.isFileMessagingAllowed()) {
541
+ this.host.addEventListener('dragover', this.onDragOver);
542
+ this.host.addEventListener('dragleave', this.onDragLeave);
543
+ this.host.addEventListener('drop', this.onDrop);
544
+ }
545
+ }
546
+ onEditMessageInit(event) {
547
+ if (event.detail.flags.isReply) {
548
+ this.replyMessage = event.detail.payload;
549
+ }
550
+ else if (event.detail.flags.isEdit) {
551
+ this.editingMessage = event.detail.payload;
552
+ }
553
+ }
554
+ disconnectedCallback() {
555
+ var _a;
556
+ (_a = this.resizeObserver) === null || _a === void 0 ? void 0 : _a.disconnect();
557
+ this.disconnectMeeting(this.meeting);
558
+ this.host.removeEventListener('dragover', this.onDragOver);
559
+ this.host.removeEventListener('dragleave', this.onDragLeave);
560
+ this.host.removeEventListener('drop', this.onDrop);
561
+ }
562
+ meetingChanged(meeting, oldMeeting) {
563
+ var _a, _b, _c, _d, _e, _f;
564
+ if (oldMeeting != undefined)
565
+ this.disconnectMeeting(oldMeeting);
566
+ if (meeting && !meeting.chat)
567
+ return;
568
+ if (meeting != null) {
569
+ this.canSend = meeting.self.permissions.chatPublic.canSend;
570
+ this.canSendTextMessage = meeting.self.permissions.chatPublic.text;
571
+ this.canSendFiles = meeting.self.permissions.chatPublic.files;
572
+ this.canPrivateMessage = !!(((_a = meeting.self.permissions.chatPrivate) === null || _a === void 0 ? void 0 : _a.canSend) ||
573
+ ((_b = meeting.self.permissions.chatPrivate) === null || _b === void 0 ? void 0 : _b.canReceive));
574
+ this.canSendPrivateTexts = !!((_c = meeting.self.permissions.chatPrivate) === null || _c === void 0 ? void 0 : _c.text);
575
+ this.canSendPrivateFiles = !!((_d = meeting.self.permissions.chatPrivate) === null || _d === void 0 ? void 0 : _d.files);
576
+ this.canPinMessages =
577
+ ((_e = meeting === null || meeting === void 0 ? void 0 : meeting.__internals__) === null || _e === void 0 ? void 0 : _e.features.hasFeature(FlagsmithFeatureFlags.PINNED_MESSAGES)) &&
578
+ meeting.self.permissions.pinParticipant;
579
+ this.initializeChatGroups();
580
+ // shallow copy to trigger render
581
+ this.chatGroups = Object.assign({}, this.chatGroups);
582
+ meeting.self.permissions.on('*', this.chatPermissionUpdateListener);
583
+ this.onParticipantUpdate();
584
+ (_f = meeting.chat) === null || _f === void 0 ? void 0 : _f.addListener('chatUpdate', this.chatUpdateListener);
585
+ if (this.isPrivateChatSupported()) {
586
+ meeting.participants.joined.addListener('participantJoined', this.onParticipantUpdate);
587
+ meeting.participants.joined.addListener('participantLeft', this.onParticipantUpdate);
588
+ }
589
+ }
590
+ }
591
+ chatGroupsChanged(chatGroups) {
592
+ var _a, _b;
593
+ if (!this.isPrivateChatSupported()) {
594
+ return;
595
+ }
596
+ const unreadCounts = {};
597
+ for (const key in chatGroups) {
598
+ const lastReadTimestamp = (_a = chatUnreadTimestamps[key]) !== null && _a !== void 0 ? _a : 0;
599
+ unreadCounts[key] = chatGroups[key].filter((c) => c.type == 'chat' &&
600
+ c.message.time > lastReadTimestamp &&
601
+ c.message.userId !== this.meeting.self.userId).length;
602
+ if (key ===
603
+ generateChatGroupKey([this.meeting.self.userId, (_b = this.selectedParticipant) === null || _b === void 0 ? void 0 : _b.userId]) ||
604
+ (key === 'everyone' && this.selectedParticipant === null)) {
605
+ unreadCounts[key] = 0;
606
+ chatUnreadTimestamps[key] = new Date();
607
+ }
608
+ }
609
+ this.updateUnreadCountGroups(unreadCounts);
610
+ }
611
+ initializeChatGroups() {
612
+ var _a;
613
+ (_a = this.meeting.chat) === null || _a === void 0 ? void 0 : _a.messages.forEach((message) => {
614
+ if (!this.displayFilter || this.displayFilter(message)) {
615
+ this.addToChatGroup(message);
616
+ }
617
+ });
618
+ }
619
+ onDisplayFilterChanged(newFilter, oldFilter) {
620
+ if (newFilter !== oldFilter) {
621
+ this.chatGroups = {};
622
+ this.initializeChatGroups();
623
+ }
624
+ }
625
+ addToChatGroup(message) {
626
+ var _a;
627
+ const parsedMessage = parseMessageForTarget(message);
628
+ let key = 'everyone';
629
+ if (((_a = parsedMessage.targetUserIds) === null || _a === void 0 ? void 0 : _a.length) > 0) {
630
+ const allParticipants = new Set([
631
+ parsedMessage.userId,
632
+ ...parsedMessage.targetUserIds,
633
+ ]);
634
+ key = generateChatGroupKey(Array.from(allParticipants));
635
+ }
636
+ if (this.chatGroups[key] === undefined)
637
+ this.chatGroups[key] = [];
638
+ let isEditedMessage = false;
639
+ let messages = [];
640
+ this.chatGroups[key].forEach((chat) => {
641
+ if (chat.type === 'chat' && chat.message.id === message.id) {
642
+ isEditedMessage = true;
643
+ messages.push({ type: 'chat', message: parsedMessage });
644
+ }
645
+ else {
646
+ messages.push(chat);
647
+ }
648
+ });
649
+ if (!isEditedMessage) {
650
+ messages.push({ type: 'chat', message: parsedMessage });
651
+ }
652
+ this.chatGroups[key] = messages;
653
+ }
654
+ getRecipientPeerIds() {
655
+ let peerIds = [];
656
+ if (this.chatRecipientId !== 'everyone') {
657
+ peerIds = [this.selectedParticipant.id];
658
+ }
659
+ return peerIds;
660
+ }
661
+ channelSwitchListener(e) {
662
+ this.onChannelChanged(e);
663
+ }
664
+ renderComposerUI() {
665
+ var _a, _b, _c;
666
+ if (this.chatRecipientId === 'everyone') {
667
+ if (!this.canSendTextMessage && !this.canSendFiles)
668
+ return null;
669
+ }
670
+ else {
671
+ if (!this.canSendPrivateTexts && !this.canSendPrivateFiles)
672
+ return null;
673
+ }
674
+ const uiProps = { iconPack: this.iconPack, t: this.t, size: this.size };
675
+ const message = this.editingMessage ? this.editingMessage.message : '';
676
+ const quotedMessage = this.replyMessage ? this.replyMessage.message : '';
677
+ return (h("rtk-chat-composer-view", Object.assign({ message: message, storageKey: (_a = this.selectedChannelId) !== null && _a !== void 0 ? _a : `draft-${this.selectedChannelId}`, quotedMessage: quotedMessage, isEditing: !!this.editingMessage, canSendTextMessage: this.isTextMessagingAllowed(), canSendFiles: this.isFileMessagingAllowed(), disableEmojiPicker: !!((_c = (_b = this.meeting) === null || _b === void 0 ? void 0 : _b.__internals__) === null || _c === void 0 ? void 0 : _c.features.hasFeature(FlagsmithFeatureFlags.DISABLE_EMOJI_PICKER)), maxLength: this.meeting.chat.maxTextLimit, rateLimits: this.meeting.chat.rateLimits, inputTextPlaceholder: this.t('chat.message_placeholder'), onNewMessage: this.onNewMessageHandler, onEditMessage: this.onEditMessageHandler, onEditCancel: this.onEditCancel, onQuotedMessageDismiss: this.onQuotedMessageDismiss }, uiProps), h("slot", { name: "chat-addon", slot: "chat-addon" })));
678
+ }
679
+ render() {
680
+ var _a;
681
+ if (!this.meeting) {
682
+ return null;
683
+ }
684
+ let chatMessages = this.chatGroups[this.selectedGroup] || [];
685
+ if (this.showPinnedMessages && this.meeting.chat.pinned.length !== 0) {
686
+ chatMessages = chatMessages.filter((chat) => chat.type === 'chat' && chat.message.pinned);
687
+ }
688
+ return (h(Host, null, h("div", { class: "chat-container" }, h("div", { class: "chat" }, this.isFileMessagingAllowed() && (h("div", { id: "dropzone", class: { active: this.dropzoneActivated }, part: "dropzone" }, h("rtk-icon", { icon: this.iconPack.attach }), h("p", null, this.t('chat.send_attachment')))), this.renderPinnedMessagesHeader(), this.isPrivateChatSupported() && (h("rtk-channel-selector-view", { channels: this.getPrivateChatRecipients(), selectedChannelId: ((_a = this.selectedParticipant) === null || _a === void 0 ? void 0 : _a.userId) || 'everyone', onChannelChange: this.updateRecipients, t: this.t, viewAs: "dropdown" })), h("rtk-chat-messages-ui-paginated", { meeting: this.meeting, onPinMessage: this.onPinMessage, onDeleteMessage: this.onDeleteMessage, size: this.size, iconPack: this.iconPack, t: this.t }), this.renderComposerUI()))));
689
+ }
690
+ get host() { return getElement(this); }
691
+ static get watchers() { return {
692
+ "meeting": ["meetingChanged"],
693
+ "chatGroups": ["chatGroupsChanged"],
694
+ "displayFilter": ["onDisplayFilterChanged"]
695
+ }; }
696
+ };
697
+ __decorate$f([
698
+ SyncWithStore()
699
+ ], RtkChat.prototype, "meeting", void 0);
700
+ __decorate$f([
701
+ SyncWithStore()
702
+ ], RtkChat.prototype, "config", void 0);
703
+ __decorate$f([
704
+ SyncWithStore()
705
+ ], RtkChat.prototype, "iconPack", void 0);
706
+ __decorate$f([
707
+ SyncWithStore()
708
+ ], RtkChat.prototype, "t", void 0);
709
+ RtkChat.style = RtkChatStyle0;
710
+
711
+ const rtkChatComposerViewCss = ":host {\n display: flex;\n flex-direction: column;\n font-family: var(--rtk-font-family, sans-serif);\n font-size: 14px;\n position: relative;\n}\n\n.quoted-message-container {\n margin-bottom: var(--rtk-space-2, 8px);\n display: flex;\n justify-content: space-between;\n --tw-bg-opacity: 1;\n background-color: rgba(var(--rtk-colors-background-800, 30 30 30) / var(--tw-bg-opacity));\n color: rgb(var(--rtk-colors-text-1000, 255 255 255));\n border-radius: var(--rtk-border-radius-md, 8px);\n border: var(--rtk-border-width-sm, 1px) solid rgb(var(--rtk-colors-background-600, 60 60 60));\n}\n\n.quoted-message-container .quoted-message {\n flex: 1 1 0%;\n padding: var(--rtk-space-2, 8px);\n border-radius: var(--rtk-border-radius-md, 8px);\n max-height: var(--rtk-space-24, 96px);\n overflow-y: auto;\n word-break: break-all;\n}\n\n.quoted-message-container .quoted-message blockquote {\n display: none;\n}\n\n.quoted-message-container rtk-icon.dismiss {\n margin-left: auto;\n height: var(--rtk-space-5, 20px);\n width: var(--rtk-space-5, 20px);\n padding: var(--rtk-space-2, 8px);\n border-radius: var(--rtk-border-radius-md, 8px);\n color: rgb(var(--rtk-colors-text-600, 255 255 255 / 0.52));\n}\n\n.quoted-message-container rtk-icon.dismiss:hover {\n cursor: pointer;\n color: rgb(var(--rtk-colors-text-1000, 255 255 255));\n}\n\n.quoted-message-container rtk-icon.dismiss {\n transition-property: color, background-color, border-color, text-decoration-color, fill, stroke;\n transition-timing-function: cubic-bezier(0.4, 0, 0.2, 1);\n transition-duration: 150ms;\n}\n\n.composer-container {\n position: relative;\n --tw-bg-opacity: 1;\n background-color: rgba(var(--rtk-colors-background-800, 30 30 30) / var(--tw-bg-opacity));\n border-radius: var(--rtk-border-radius-md, 8px);\n overflow: hidden;\n border: var(--rtk-border-width-sm, 1px) solid rgb(var(--rtk-colors-background-600, 60 60 60));\n}\n\n.composer-container > .composers {\n min-height: 60px;\n }\n\n@container chatcontainer (height < 360px) {\n .composer-container > .composers {\n min-height: 30px;\n }\n}\n\n.chat-buttons {\n padding: var(--rtk-space-3, 12px);\n display: flex;\n align-items: center;\n justify-content: space-between;\n --tw-bg-opacity: 1;\n background-color: rgba(var(--rtk-colors-background-800, 30 30 30) / var(--tw-bg-opacity));\n color: rgb(var(--rtk-colors-text-1000, 255 255 255));\n}\n\n.chat-buttons .right {\n z-index: 10;\n}\n\n.chat-buttons .right .edit-buttons {\n display: flex;\n gap: var(--rtk-space-2, 8px);\n}\n\n.chat-buttons > div {\n display: flex;\n align-items: center;\n}\n\nrtk-emoji-picker {\n z-index: 20;\n position: absolute;\n top: calc(var(--rtk-space-72, 288px) * -1);\n border-top: var(--rtk-border-width-sm, 1px) solid rgb(var(--rtk-colors-background-600, 60 60 60));\n animation: 0.3s slide-up ease;\n}\n\n@keyframes slide-up {\n from {\n transform: translateY(100%);\n }\n to {\n transform: translateY(0%);\n }\n}\n";
712
+ const RtkChatComposerViewStyle0 = rtkChatComposerViewCss;
713
+
714
+ var __decorate$e = (undefined && undefined.__decorate) || function (decorators, target, key, desc) {
715
+ var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
716
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function")
717
+ r = Reflect.decorate(decorators, target, key, desc);
718
+ else
719
+ for (var i = decorators.length - 1; i >= 0; i--)
720
+ if (d = decorators[i])
721
+ r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
722
+ return c > 3 && r && Object.defineProperty(target, key, r), r;
723
+ };
724
+ const messageLimits = {
725
+ messagesSent: 0,
726
+ startTime: 0,
727
+ };
728
+ const RtkChatComposerView = class {
729
+ constructor(hostRef) {
730
+ registerInstance(this, hostRef);
731
+ this.onNewMessage = createEvent(this, "newMessage", 7);
732
+ this.onEditMessage = createEvent(this, "editMessage", 7);
733
+ this.onEditCancel = createEvent(this, "editCancel", 7);
734
+ this.onQuotedMessageDismiss = createEvent(this, "quotedMessageDismiss", 7);
735
+ /** Whether user can send text messages */
736
+ this.canSendTextMessage = true;
737
+ /** Whether user can send file messages */
738
+ this.canSendFiles = true;
739
+ /** Message to be pre-populated */
740
+ this.message = '';
741
+ /** Quote message to be displayed */
742
+ this.quotedMessage = '';
743
+ /** Key for storing message in localStorage */
744
+ this.storageKey = 'rtk-text-message';
745
+ /** Placeholder for text input */
746
+ this.inputTextPlaceholder = 'Enter your message';
747
+ /** Sets composer to edit mode */
748
+ this.isEditing = false;
749
+ /** Icon pack */
750
+ this.iconPack = defaultIconPack;
751
+ /** Language */
752
+ this.t = useLanguage();
753
+ /** Whether to show emoji picker */
754
+ this.disableEmojiPicker = false;
755
+ /** Rate limits */
756
+ this.rateLimits = {
757
+ period: 60,
758
+ maxInvocations: 60,
759
+ };
760
+ this.fileToUpload = null;
761
+ this.isEmojiPickerOpen = false;
762
+ this.disableSendButton = false;
763
+ this.rateLimitsBreached = false;
764
+ this.textMessage = '';
765
+ this.sendFile = () => {
766
+ if (!this.canSendFiles) {
767
+ return;
768
+ }
769
+ if (this.fileToUpload.type === 'image') {
770
+ this.onNewMessage.emit({
771
+ type: 'image',
772
+ image: this.fileToUpload.file,
773
+ });
774
+ }
775
+ else {
776
+ this.onNewMessage.emit({ type: 'file', file: this.fileToUpload.file });
777
+ }
778
+ this.fileToUpload = null;
779
+ };
780
+ this.handleSendMessage = () => {
781
+ if (!this.canSendTextMessage || this.rateLimitsBreached) {
782
+ return;
783
+ }
784
+ if (this.fileToUpload !== null) {
785
+ this.sendFile();
786
+ return;
787
+ }
788
+ const message = this.textMessage;
789
+ const currentTime = Date.now();
790
+ if (currentTime - messageLimits.startTime > this.rateLimits.period * 1000) {
791
+ messageLimits.startTime = currentTime;
792
+ messageLimits.messagesSent = 0;
793
+ }
794
+ messageLimits.messagesSent += 1;
795
+ this.checkRateLimitBreached(currentTime);
796
+ if (message.length > 0) {
797
+ if (this.quotedMessage.length !== 0) {
798
+ this.onNewMessage.emit({
799
+ type: 'text',
800
+ message,
801
+ });
802
+ }
803
+ else {
804
+ this.onNewMessage.emit({ type: 'text', message });
805
+ }
806
+ this.cleanup();
807
+ }
808
+ };
809
+ this.handleEditMessage = () => {
810
+ this.onEditMessage.emit(this.textMessage);
811
+ this.cleanup();
812
+ };
813
+ this.handleEditCancel = () => {
814
+ this.onEditCancel.emit();
815
+ this.cleanup();
816
+ };
817
+ this.onTextChangeHandler = (event) => {
818
+ var _a;
819
+ this.textMessage = event.detail;
820
+ if (this.textMessage.length >= ((_a = this.maxLength) !== null && _a !== void 0 ? _a : MAX_TEXT_LENGTH)) {
821
+ this.disableSendButton = true;
822
+ }
823
+ else if (this.disableSendButton) {
824
+ this.disableSendButton = false;
825
+ }
826
+ gracefulStorage.setItem(this.storageKey, event.detail);
827
+ };
828
+ this.onKeyDownHandler = (event) => {
829
+ if (event.key === 'Enter' && event.shiftKey) {
830
+ return;
831
+ }
832
+ if (this.disableSendButton) {
833
+ return;
834
+ }
835
+ if (event.key === 'Enter') {
836
+ event.preventDefault();
837
+ if (this.isEditing) {
838
+ this.handleEditMessage();
839
+ }
840
+ else {
841
+ this.handleSendMessage();
842
+ }
843
+ }
844
+ };
845
+ this.onFileUploadHandler = (type, file) => {
846
+ this.fileToUpload = { type, file };
847
+ };
848
+ this.onQuotedMessageDismissHandler = () => {
849
+ this.onQuotedMessageDismiss.emit();
850
+ };
851
+ this.cleanup = () => {
852
+ this.textMessage = '';
853
+ this.fileToUpload = null;
854
+ gracefulStorage.setItem(this.storageKey, '');
855
+ this.$textComposer.setText('', true);
856
+ this.isEmojiPickerOpen = false;
857
+ };
858
+ this.onKeyDownHandler = this.onKeyDownHandler.bind(this);
859
+ }
860
+ connectedCallback() {
861
+ this.textMessage = this.message || gracefulStorage.getItem(this.storageKey) || '';
862
+ this.checkRateLimitBreached(Date.now());
863
+ }
864
+ componentWillUpdate() {
865
+ this.textMessage = this.message || gracefulStorage.getItem(this.storageKey) || '';
866
+ }
867
+ componentDidLoad() {
868
+ if (this.message) {
869
+ writeTask(() => this.$textComposer.setText(this.message, true));
870
+ }
871
+ }
872
+ checkRateLimitBreached(currentTime) {
873
+ // Check if the function call is within limits
874
+ if (messageLimits.messagesSent >= this.rateLimits.maxInvocations) {
875
+ this.disableSendButton = true;
876
+ this.rateLimitsBreached = true;
877
+ const timeRemainingForReset = currentTime - messageLimits.startTime + this.rateLimits.period * 1000;
878
+ setTimeout(() => {
879
+ messageLimits.messagesSent = 0;
880
+ messageLimits.startTime = Date.now();
881
+ this.disableSendButton = false;
882
+ this.rateLimitsBreached = false;
883
+ }, timeRemainingForReset);
884
+ }
885
+ }
886
+ render() {
887
+ var _a;
888
+ const uiProps = { iconPack: this.iconPack, t: this.t };
889
+ return (h(Host, { key: '06455539e3067eb1c1c592b551d0ef99eba2f331' }, this.canSendTextMessage && this.isEmojiPickerOpen && (h("rtk-emoji-picker", Object.assign({ key: 'fe83b0ab9562cc0e1c61f89e4b441ef592edfa1a', part: "emoji-picker", onPickerClose: () => {
890
+ this.isEmojiPickerOpen = false;
891
+ }, onRtkEmojiClicked: (e) => {
892
+ this.textMessage += e.detail;
893
+ this.$textComposer.setText(this.textMessage, true);
894
+ } }, uiProps))), h("slot", { key: '8653c2e805e41adf5958941cc10ff01d43f97792', name: "chat-addon" }), this.quotedMessage && this.quotedMessage.length !== 0 && (h("div", { key: '82b9bf5203a799709e980d61ab827b9daf8292e6', class: "quoted-message-container", part: "quoted-message-container" }, h("div", { key: '4b9fe8f382da7075e815c329f2d7dca17ce0f694', class: "quoted-message scrollbar" }, h("rtk-text-message-view", { key: '7a16547e83d9bca43794e46e56c5a9c743a9929a', text: this.quotedMessage, isMarkdown: true })), h("div", { key: '5691b8d882016cda66cd2faf3858bc38cd53458c' }, h("rtk-icon", { key: '2d5b222bd5eaac6d46812b704674f52f86efdb92', "aria-label": this.t('dismiss'), class: "dismiss", icon: this.iconPack.dismiss, onClick: this.onQuotedMessageDismissHandler })))), h("div", { key: 'd7638411df9ae1b2cbef8cae66d0af2b7ad310e6', class: "composer-container" }, h("div", { key: 'ca1ee222584fdd27e53989d28b6ce583c6b0c400', class: "composers" }, this.fileToUpload && (h("rtk-draft-attachment-view", Object.assign({ key: 'd511c900c71a97f8f92640b73a7575dcd267de88' }, uiProps, { attachment: this.fileToUpload, onDeleteAttachment: () => (this.fileToUpload = null) }))), !this.fileToUpload && (h("rtk-text-composer-view", { key: '08f214184853dcedeccb5f07dac2a0a308269793', value: this.textMessage, placeholder: this.inputTextPlaceholder, onTextChange: this.onTextChangeHandler, keyDownHandler: this.onKeyDownHandler, maxLength: (_a = this.maxLength) !== null && _a !== void 0 ? _a : MAX_TEXT_LENGTH, rateLimitBreached: this.rateLimitsBreached, t: this.t, iconPack: this.iconPack, ref: (el) => (this.$textComposer = el) }))), h("div", { key: '9b6cbe7cb8529c8e60f8cc9e13cc95ca64504efc', class: "chat-buttons", part: "chat-buttons" }, h("div", { key: '30e24e8edf58179ef20ccd436d3833ba177ebb0d', class: "left", part: "chat-buttons-left" }, !this.fileToUpload && !this.isEditing && (h("div", { key: '54ad294bedab1c0bc7c02a72c4f3f51bc10bba85' }, this.canSendFiles && [
895
+ h("rtk-file-picker-button", Object.assign({ key: '1a0760e05a183b6c8da2ff02e33ecd40bfdb6e97' }, uiProps, { onFileChange: (event) => this.onFileUploadHandler('file', event.detail) })),
896
+ h("rtk-file-picker-button", Object.assign({ key: '5d6cf1928c8edb6737b367807c93152ad62cea36', filter: "image/*", label: this.t('chat.send_img'), icon: "image", onFileChange: (event) => this.onFileUploadHandler('image', event.detail) }, uiProps)),
897
+ ], this.canSendTextMessage && !this.disableEmojiPicker && (h("rtk-emoji-picker-button", Object.assign({ key: '50f14152b8d15009104e9b1dd05ee5e1ec49ab16', isActive: this.isEmojiPickerOpen, onClick: () => {
898
+ this.isEmojiPickerOpen = !this.isEmojiPickerOpen;
899
+ } }, uiProps))), h("slot", { key: '1e1fe81e1e196fc8d679bfc2d6ed0c6402c74a4a', name: "chat-buttons" })))), h("div", { key: '272526b7c81ed1acd028beceb3869c584e94308f', class: "right", part: "chat-buttons-right" }, !this.isEditing && (h("rtk-tooltip", { key: '6750abf323b2f1c951661c44390eb97d3ec71544', variant: "primary", label: this.t('chat.send_msg'), delay: 2000 }, h("rtk-button", { key: 'a159fa6dcc1f8ede64085abd8286a69ad86b7002', kind: "icon", disabled: this.disableSendButton, onClick: () => this.handleSendMessage(), title: this.t('chat.send_msg') }, h("rtk-icon", { key: 'bb26a3a7954727859f5566ecc60d746ac6700b7b', icon: this.iconPack.send })))), this.isEditing && (h("div", { key: '5ef512e3fc236510a518e76ce027f0c8fc1c9a0c', class: "edit-buttons" }, h("rtk-tooltip", { key: 'e18ae7567350d32b18a70de8cb2c1af0830353bc', variant: "secondary", label: this.t('cancel'), delay: 2000 }, h("rtk-button", { key: '4f4aa2e44308a393314ab95244c87a3b8d4b282c', kind: "icon", variant: "secondary", onClick: () => this.handleEditCancel(), title: this.t('cancel') }, h("rtk-icon", { key: 'a4a99fe9ae34707cb63f63461a4728baf70e3e7a', icon: this.iconPack.dismiss }))), h("rtk-tooltip", { key: '789315dbf551ba74d004459981532fa9a467ac45', variant: "primary", label: this.t('chat.update_msg'), delay: 2000 }, h("rtk-button", { key: '61da43993c2da9b8bd00796544030e9b4cb45f12', kind: "icon", onClick: () => this.handleEditMessage(), title: this.t('chat.send_msg') }, h("rtk-icon", { key: 'e45aab29b0f6553ed2d7f370a8817bdccdabe42e', icon: this.iconPack.checkmark }))))))))));
900
+ }
901
+ };
902
+ __decorate$e([
903
+ SyncWithStore()
904
+ ], RtkChatComposerView.prototype, "iconPack", void 0);
905
+ __decorate$e([
906
+ SyncWithStore()
907
+ ], RtkChatComposerView.prototype, "t", void 0);
908
+ RtkChatComposerView.style = RtkChatComposerViewStyle0;
909
+
910
+ const rtkChatMessagesUiPaginatedCss = ":host{display:flex;flex-direction:column;--tw-bg-opacity:1;background-color:rgba(var(--rtk-colors-background-900, 26 26 26) / var(--tw-bg-opacity));flex:1 0 0px}";
911
+ const RtkChatMessagesUiPaginatedStyle0 = rtkChatMessagesUiPaginatedCss;
912
+
913
+ var __decorate$d = (undefined && undefined.__decorate) || function (decorators, target, key, desc) {
914
+ var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
915
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function")
916
+ r = Reflect.decorate(decorators, target, key, desc);
917
+ else
918
+ for (var i = decorators.length - 1; i >= 0; i--)
919
+ if (d = decorators[i])
920
+ r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
921
+ return c > 3 && r && Object.defineProperty(target, key, r), r;
922
+ };
923
+ const RtkChatMessagesUiPaginated = class {
924
+ constructor(hostRef) {
925
+ registerInstance(this, hostRef);
926
+ this.editMessageInit = createEvent(this, "editMessageInit", 7);
927
+ this.onPinMessage = createEvent(this, "pinMessage", 7);
928
+ this.onDeleteMessage = createEvent(this, "deleteMessage", 7);
929
+ this.stateUpdate = createEvent(this, "rtkStateUpdate", 7);
930
+ /** Icon pack */
931
+ this.iconPack = defaultIconPack;
932
+ /** Language */
933
+ this.t = useLanguage();
934
+ /** Whether to align chat bubbles to the left */
935
+ this.leftAlign = false;
936
+ this.permissionsChanged = false;
937
+ this.pageSize = 25;
938
+ this.lastReadMessageIndex = -1;
939
+ this.permissionsUpdateListener = () => {
940
+ this.permissionsChanged = !this.permissionsChanged;
941
+ };
942
+ this.maybeMarkChannelAsRead = (messages) => {
943
+ if (!this.selectedChannelId)
944
+ return;
945
+ if (messages.length === 0)
946
+ return;
947
+ if (this.lastReadMessageIndex !== -1)
948
+ return;
949
+ const latestMsg = messages.at(0).time > messages.at(-1).time ? messages.at(0) : messages.at(-1);
950
+ if (!latestMsg.channelIndex)
951
+ return;
952
+ this.lastReadMessageIndex = parseInt(latestMsg.channelIndex, 10);
953
+ this.meeting.chat.markLastReadMessage(this.selectedChannelId, latestMsg);
954
+ };
955
+ this.getChatMessages = async (timestamp, size, reversed) => {
956
+ const { messages } = await this.meeting.chat.getMessages(timestamp, size, reversed, undefined, this.selectedChannelId);
957
+ this.maybeMarkChannelAsRead(messages);
958
+ return messages;
959
+ };
960
+ this.createChatNodes = (data) => {
961
+ /**
962
+ * NOTE(callmetarush): When between pages the message's isContinued
963
+ * will fail in current implementation
964
+ */
965
+ return data.map((message, idx) => {
966
+ var _a;
967
+ const isContinued = message.userId === ((_a = data[idx - 1]) === null || _a === void 0 ? void 0 : _a.userId);
968
+ return this.createChatNode(message, isContinued);
969
+ });
970
+ };
971
+ this.disconnectMeeting = (meeting) => {
972
+ var _a, _b;
973
+ (_a = meeting === null || meeting === void 0 ? void 0 : meeting.chat) === null || _a === void 0 ? void 0 : _a.removeListener('chatUpdate', this.chatUpdateListener);
974
+ (_b = this.meeting) === null || _b === void 0 ? void 0 : _b.self.permissions.removeListener('permissionsUpdate', this.permissionsUpdateListener);
975
+ };
976
+ this.getMessageActions = (message) => {
977
+ const actions = [];
978
+ // const isSelf = this.meeting.self.userId === message.userId;
979
+ // const chatMessagePermissions = this.meeting.self.permissions?.chatMessage;
980
+ // const canEdit =
981
+ // chatMessagePermissions === undefined
982
+ // ? isSelf
983
+ // : chatMessagePermissions.canEdit === 'ALL' ||
984
+ // (chatMessagePermissions.canEdit === 'SELF' && isSelf);
985
+ // const canDelete =
986
+ // chatMessagePermissions === undefined
987
+ // ? isSelf
988
+ // : chatMessagePermissions.canDelete === 'ALL' ||
989
+ // (chatMessagePermissions.canDelete === 'SELF' && isSelf);
990
+ if (this.meeting.self.permissions.pinParticipant) {
991
+ actions.push({
992
+ id: 'pin_message',
993
+ label: message.pinned ? this.t('unpin') : this.t('pin'),
994
+ icon: this.iconPack.pin,
995
+ });
996
+ }
997
+ // if (canDelete) {
998
+ // actions.push({
999
+ // id: 'delete_message',
1000
+ // label: this.t('chat.delete_msg'),
1001
+ // icon: this.iconPack.delete,
1002
+ // });
1003
+ // }
1004
+ return actions;
1005
+ };
1006
+ this.onMessageActionHandler = (actionId, message) => {
1007
+ switch (actionId) {
1008
+ case 'pin_message':
1009
+ this.onPinMessage.emit(message);
1010
+ break;
1011
+ case 'delete_message':
1012
+ this.onDeleteMessage.emit(message);
1013
+ break;
1014
+ }
1015
+ };
1016
+ this.createChatNode = (message, isContinued) => {
1017
+ var _a, _b, _c, _d;
1018
+ if (message.targetUserIds.length !== 0)
1019
+ return null; // don't render private messages
1020
+ let displayPicture;
1021
+ if (this.meeting.meta.viewType === 'CHAT') {
1022
+ displayPicture = (_a = this.meeting.participants.all
1023
+ .toArray()
1024
+ .find((p) => p.userId === message.userId)) === null || _a === void 0 ? void 0 : _a.picture;
1025
+ }
1026
+ else {
1027
+ if (this.meeting.self.userId === message.userId) {
1028
+ displayPicture = this.meeting.self.picture;
1029
+ }
1030
+ else {
1031
+ displayPicture =
1032
+ (_c = (_b = this.meeting.participants.joined
1033
+ .toArray()
1034
+ .find((member) => member.userId === message.userId)) === null || _b === void 0 ? void 0 : _b.picture) !== null && _c !== void 0 ? _c : (_d = this.meeting.participants.waitlisted.toArray().find((p) => p.userId === message.userId)) === null || _d === void 0 ? void 0 : _d.picture;
1035
+ }
1036
+ }
1037
+ const isSelf = message.userId === this.meeting.self.userId;
1038
+ const viewType = isSelf ? 'outgoing' : 'incoming';
1039
+ return (h("div", { class: { pinned: message.pinned } }, h("div", { class: "message-wrapper" }, h("rtk-message-view", { time: message.time, actions: this.getMessageActions(message), authorName: message.displayName, isSelf: isSelf, avatarUrl: displayPicture, hideAuthorName: isContinued, viewType: viewType, variant: "bubble", onAction: (event) => this.onMessageActionHandler(event.detail, message) }, h("div", null, h("div", { class: "body" }, message.type === 'text' && (h("rtk-text-message-view", { text: message.message, isMarkdown: true })), message.type === 'file' && (h("rtk-file-message-view", { name: message.name, url: message.link, size: message.size })), message.type === 'image' && (h("rtk-image-message-view", { url: message.link, onPreview: () => {
1040
+ this.stateUpdate.emit({ image: message });
1041
+ } }))), message.pinned && (h("div", { class: "pin-icon", part: "pin-icon" }, h("rtk-icon", { icon: this.iconPack.pin, size: "sm" }))))))));
1042
+ };
1043
+ this.chatUpdateListener = (data) => {
1044
+ if (this.selectedChannelId && data.message.channelId !== this.selectedChannelId)
1045
+ return;
1046
+ if (data.action === 'add') {
1047
+ this.$paginatedListRef.onNewNode(data.message);
1048
+ this.lastReadMessageIndex = -1;
1049
+ this.maybeMarkChannelAsRead([data.message]);
1050
+ }
1051
+ else if (data.action === 'delete') {
1052
+ this.$paginatedListRef.onNodeDelete(data.message.id);
1053
+ }
1054
+ else if (data.action === 'edit') {
1055
+ this.$paginatedListRef.onNodeUpdate(data.message.id, data.message);
1056
+ }
1057
+ };
1058
+ }
1059
+ componentDidLoad() {
1060
+ const slotted = this.host.shadowRoot.querySelector('slot');
1061
+ if (!slotted)
1062
+ return;
1063
+ this.children = slotted.assignedElements()[0];
1064
+ }
1065
+ connectedCallback() {
1066
+ this.meetingChanged(this.meeting);
1067
+ }
1068
+ disconnectedCallback() {
1069
+ this.disconnectMeeting(this.meeting);
1070
+ }
1071
+ meetingChanged(meeting, oldMeeting) {
1072
+ var _a;
1073
+ if (oldMeeting != undefined)
1074
+ this.disconnectMeeting(oldMeeting);
1075
+ if (meeting && !meeting.chat)
1076
+ return;
1077
+ if (meeting != null) {
1078
+ (_a = meeting.chat) === null || _a === void 0 ? void 0 : _a.addListener('chatUpdate', this.chatUpdateListener);
1079
+ meeting.self.permissions.addListener('permissionsUpdate', this.permissionsUpdateListener);
1080
+ }
1081
+ this.permissionsUpdateListener();
1082
+ }
1083
+ channelChanged() {
1084
+ this.lastReadMessageIndex = -1;
1085
+ }
1086
+ render() {
1087
+ return (h(Host, { key: '9716b4db0dbae3308a056693341635d93c0d1227' }, h("rtk-paginated-list", { key: '4b540e565aa0d7031ad8c84f35cadb07d207abfe', ref: (el) => (this.$paginatedListRef = el), pageSize: this.pageSize, pagesAllowed: 3, fetchData: this.getChatMessages, createNodes: this.createChatNodes, selectedItemId: this.selectedChannelId, emptyListLabel: this.t('chat.empty_channel') }, h("slot", { key: '41ffb56aea7e02f3c20f8ea261638d6fd9d80232' }))));
1088
+ }
1089
+ get host() { return getElement(this); }
1090
+ static get watchers() { return {
1091
+ "meeting": ["meetingChanged"],
1092
+ "selectedChannelId": ["channelChanged"]
1093
+ }; }
1094
+ };
1095
+ __decorate$d([
1096
+ SyncWithStore()
1097
+ ], RtkChatMessagesUiPaginated.prototype, "meeting", void 0);
1098
+ __decorate$d([
1099
+ SyncWithStore()
1100
+ ], RtkChatMessagesUiPaginated.prototype, "iconPack", void 0);
1101
+ __decorate$d([
1102
+ SyncWithStore()
1103
+ ], RtkChatMessagesUiPaginated.prototype, "t", void 0);
1104
+ RtkChatMessagesUiPaginated.style = RtkChatMessagesUiPaginatedStyle0;
1105
+
1106
+ const rtkDraftAttachmentViewCss = ":host{display:flex;--tw-bg-opacity:1;background-color:rgba(var(--rtk-colors-background-800, 30 30 30) / var(--tw-bg-opacity));border-top-left-radius:var(--rtk-border-radius-md, 8px);border-top-right-radius:var(--rtk-border-radius-md, 8px)}.preview-overlay{position:absolute;top:var(--rtk-space-0, 0px);right:var(--rtk-space-0, 0px);bottom:var(--rtk-space-0, 0px);left:var(--rtk-space-0, 0px);background-color:inherit}.preview{position:absolute;top:var(--rtk-space-4, 16px);left:var(--rtk-space-4, 16px);max-width:-moz-fit-content;max-width:fit-content;max-height:var(--rtk-space-20, 80px)}.preview:hover rtk-tooltip{display:block}.preview rtk-tooltip{position:absolute;top:calc(var(--rtk-space-1, 4px) * -1);left:calc(var(--rtk-space-1, 4px) * -1);display:none;margin-left:calc(var(--rtk-space-1, 4px) * -1);margin-top:calc(var(--rtk-space-1, 4px) * -1)}.preview rtk-button{display:flex;height:var(--rtk-space-4, 16px);width:var(--rtk-space-4, 16px);align-items:center;justify-content:center;border-radius:9999px;--tw-bg-opacity:1;background-color:rgba(var(--rtk-colors-background-600, 60 60 60) / var(--tw-bg-opacity));border:1px solid rgb(var(--rtk-colors-text-1000, 255 255 255))}.preview rtk-icon{height:var(--rtk-space-3, 12px);width:var(--rtk-space-3, 12px);color:rgb(var(--rtk-colors-text-1000, 255 255 255))}.preview-image{height:var(--rtk-space-16, 64px);width:var(--rtk-space-16, 64px);-o-object-fit:cover;object-fit:cover;max-height:100%;max-width:100%;overflow:clip;border-radius:var(--rtk-border-radius-md, 8px)}.preview-file{padding-left:var(--rtk-space-3, 12px);padding-right:var(--rtk-space-3, 12px);padding-top:var(--rtk-space-2, 8px);padding-bottom:var(--rtk-space-2, 8px);--tw-bg-opacity:1;background-color:rgba(var(--rtk-colors-background-600, 60 60 60) / var(--tw-bg-opacity));color:rgb(var(--rtk-colors-text-900, 255 255 255 / 0.88));overflow:hidden;text-overflow:ellipsis;white-space:nowrap;border-radius:var(--rtk-border-radius-md, 8px);max-width:200px}";
1107
+ const RtkDraftAttachmentViewStyle0 = rtkDraftAttachmentViewCss;
1108
+
1109
+ var __decorate$c = (undefined && undefined.__decorate) || function (decorators, target, key, desc) {
1110
+ var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
1111
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function")
1112
+ r = Reflect.decorate(decorators, target, key, desc);
1113
+ else
1114
+ for (var i = decorators.length - 1; i >= 0; i--)
1115
+ if (d = decorators[i])
1116
+ r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
1117
+ return c > 3 && r && Object.defineProperty(target, key, r), r;
1118
+ };
1119
+ const RtkDraftAttachmentView = class {
1120
+ constructor(hostRef) {
1121
+ registerInstance(this, hostRef);
1122
+ this.onDeleteAttachment = createEvent(this, "deleteAttachment", 7);
1123
+ /** Icon pack */
1124
+ this.iconPack = defaultIconPack;
1125
+ /** Language */
1126
+ this.t = useLanguage();
1127
+ /** Attachment to display */
1128
+ this.attachment = null;
1129
+ this.filePreview = null;
1130
+ this.fileReader = new FileReader();
1131
+ this.generatePreview = () => {
1132
+ if (this.attachment.type === 'image') {
1133
+ this.fileReader.readAsDataURL(this.attachment.file);
1134
+ }
1135
+ else if (this.attachment.type === 'file') {
1136
+ this.filePreview = this.attachment.file.name;
1137
+ }
1138
+ };
1139
+ this.onDeleteClickHandler = () => {
1140
+ this.filePreview = null;
1141
+ this.onDeleteAttachment.emit();
1142
+ };
1143
+ }
1144
+ onAttachmentChange() {
1145
+ this.generatePreview();
1146
+ }
1147
+ connectedCallback() {
1148
+ this.fileReader.onload = (e) => {
1149
+ if (typeof e.target.result === 'string') {
1150
+ this.filePreview = e.target.result;
1151
+ }
1152
+ };
1153
+ // this.fileReader.onloadstart = () => {};
1154
+ // this.fileReader.onloadend = () => {};
1155
+ }
1156
+ componentWillLoad() {
1157
+ this.onAttachmentChange();
1158
+ }
1159
+ render() {
1160
+ return (h(Host, { key: '22c8ff3317b6247dc6a0fa2088f28dc293de9738' }, h("div", { key: '317c0e6a06849af0af42d81353dc0002b82185a5', class: "preview-overlay" }, h("div", { key: '94d0d35a3696725b59341303760212cf6e01c8a7', class: "preview" }, h("rtk-tooltip", { key: '3171acf60f22a80cbcbf9d3d6f8cf5ac61b67b67', label: this.t('chat.cancel_upload') }, h("rtk-button", { key: '37d1055de9d59318c0f7f612dee3304838142968', variant: "secondary", kind: "icon", onClick: this.onDeleteClickHandler }, h("rtk-icon", { key: '9988b389300e0c6bd404d02440d7b3d323f384dd', icon: this.iconPack.dismiss }))), this.attachment.type === 'image' ? (h("img", { class: "preview-image", src: this.filePreview })) : (h("div", { class: "preview-file" }, h("span", null, this.filePreview)))))));
1161
+ }
1162
+ static get watchers() { return {
1163
+ "attachment": ["onAttachmentChange"]
1164
+ }; }
1165
+ };
1166
+ __decorate$c([
1167
+ SyncWithStore()
1168
+ ], RtkDraftAttachmentView.prototype, "iconPack", void 0);
1169
+ __decorate$c([
1170
+ SyncWithStore()
1171
+ ], RtkDraftAttachmentView.prototype, "t", void 0);
1172
+ RtkDraftAttachmentView.style = RtkDraftAttachmentViewStyle0;
1173
+
1174
+ const EMOJI_ASSET_URL = 'https://rtk-assets.realtime.cloudflare.com/assets/emojis-data.json';
1175
+ let cachedEmojis;
1176
+ /**
1177
+ * fetches the latest emoji list from CDN
1178
+ * @returns list of emojis
1179
+ */
1180
+ const fetchEmojis = async () => {
1181
+ if (!cachedEmojis) {
1182
+ const emojis = await fetch(EMOJI_ASSET_URL);
1183
+ cachedEmojis = emojis.json();
1184
+ }
1185
+ return cachedEmojis;
1186
+ };
1187
+
1188
+ const rtkEmojiPickerCss = ":host{line-height:initial;font-family:var(--rtk-font-family, sans-serif);font-feature-settings:normal;font-variation-settings:normal}p{margin:var(--rtk-space-0, 0px);padding:var(--rtk-space-0, 0px)}.scrollbar{scrollbar-width:thin;scrollbar-color:var(--rtk-scrollbar-color, rgb(var(--rtk-colors-background-600, 60 60 60)))\n var(--rtk-scrollbar-background, transparent)}.scrollbar::-webkit-scrollbar{height:var(--rtk-space-1\\.5, 6px);width:var(--rtk-space-1\\.5, 6px);border-radius:9999px;background-color:var(--rtk-scrollbar-background, transparent)}.scrollbar::-webkit-scrollbar-thumb{border-radius:9999px;background-color:var(--rtk-scrollbar-color, rgb(var(--rtk-colors-background-600, 60 60 60)))}:host{width:100%}.emoji-parent{box-sizing:border-box;display:inline-flex;height:var(--rtk-space-64, 256px);width:100%;max-width:640px;flex-direction:column;padding:var(--rtk-space-2, 8px);padding-bottom:var(--rtk-space-0, 0px);-webkit-user-select:none;-moz-user-select:none;user-select:none;transition-property:color, background-color, border-color, text-decoration-color, fill, stroke;transition-timing-function:cubic-bezier(0.4, 0, 0.2, 1);transition-duration:150ms;--tw-bg-opacity:1;background-color:rgba(var(--rtk-colors-background-800, 30 30 30) / var(--tw-bg-opacity));color:rgb(var(--rtk-colors-text-1000, 255 255 255))}.close-parent{display:flex;flex:1 1 0%;justify-content:flex-end;padding:var(--rtk-space-0, 0px);--tw-bg-opacity:1;background-color:rgba(var(--rtk-colors-background-800, 30 30 30) / var(--tw-bg-opacity));color:rgb(var(--rtk-colors-text-1000, 255 255 255))}#emoji-grid{margin-top:var(--rtk-space-2, 8px);box-sizing:border-box;display:flex;flex-direction:row;flex-wrap:wrap;align-content:flex-start;overflow-x:hidden;overflow-y:scroll;height:100%;grid-auto-rows:minmax(min-content, max-content)}#loader{display:flex;height:100%;width:100%;align-items:center;justify-content:center}input{display:block;height:var(--rtk-space-8, 32px);padding-left:var(--rtk-space-2, 8px);padding-right:var(--rtk-space-2, 8px);font-size:14px;border-width:var(--rtk-border-width-none, 0);border-style:solid;border-style:none;border-color:rgb(var(--rtk-colors-text-700, 255 255 255 / 0.64));--tw-bg-opacity:1;background-color:rgba(var(--rtk-colors-background-800, 30 30 30) / var(--tw-bg-opacity));color:rgb(var(--rtk-colors-text-900, 255 255 255 / 0.88))}input::-moz-placeholder{color:rgb(var(--rtk-colors-text-700, 255 255 255 / 0.64))}input::placeholder{color:rgb(var(--rtk-colors-text-700, 255 255 255 / 0.64))}input{border-radius:var(--rtk-border-radius-sm, 4px);outline:2px solid transparent;outline-offset:2px;transition-property:color, background-color, border-color, text-decoration-color, fill, stroke, opacity, box-shadow, transform, filter, -webkit-backdrop-filter;transition-property:color, background-color, border-color, text-decoration-color, fill, stroke, opacity, box-shadow, transform, filter, backdrop-filter;transition-property:color, background-color, border-color, text-decoration-color, fill, stroke, opacity, box-shadow, transform, filter, backdrop-filter, -webkit-backdrop-filter;transition-timing-function:cubic-bezier(0.4, 0, 0.2, 1);transition-duration:150ms;border:var(--rtk-border-width-sm, 1px) solid rgb(var(--rtk-colors-background-600, 60 60 60))}input:focus{--tw-border-opacity:1;border-color:rgba(var(--rtk-colors-brand-300, 73 124 253) / var(--tw-border-opacity));--tw-ring-offset-shadow:var(--tw-ring-inset) 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color);--tw-ring-shadow:var(--tw-ring-inset) 0 0 0 calc(4px + var(--tw-ring-offset-width)) var(--tw-ring-color);box-shadow:var(--tw-ring-offset-shadow), var(--tw-ring-shadow), var(--tw-shadow, 0 0 #0000);--tw-ring-color:rgba(var(--rtk-colors-brand-300, 73 124 253) / var(--tw-ring-opacity));--tw-ring-opacity:0.3}.emoji{height:var(--rtk-space-10, 40px);width:var(--rtk-space-10, 40px);font-size:20px;color:rgb(var(--rtk-colors-text-1000, 255 255 255))}";
1189
+ const RtkEmojiPickerStyle0 = rtkEmojiPickerCss;
1190
+
1191
+ var __decorate$b = (undefined && undefined.__decorate) || function (decorators, target, key, desc) {
1192
+ var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
1193
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function")
1194
+ r = Reflect.decorate(decorators, target, key, desc);
1195
+ else
1196
+ for (var i = decorators.length - 1; i >= 0; i--)
1197
+ if (d = decorators[i])
1198
+ r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
1199
+ return c > 3 && r && Object.defineProperty(target, key, r), r;
1200
+ };
1201
+ const RtkEmojiPicker = class {
1202
+ constructor(hostRef) {
1203
+ registerInstance(this, hostRef);
1204
+ this.pickerClose = createEvent(this, "pickerClose", 7);
1205
+ this.emojiClicked = createEvent(this, "rtkEmojiClicked", 7);
1206
+ /** Icon pack */
1207
+ this.iconPack = defaultIconPack;
1208
+ /** Language */
1209
+ this.t = useLanguage();
1210
+ /** Controls whether or not to focus on mount */
1211
+ this.focusWhenOpened = true;
1212
+ this.filterVal = '';
1213
+ this.filteredEmojis = [];
1214
+ }
1215
+ componentWillLoad() {
1216
+ // Don't use async here as it will block the render
1217
+ fetchEmojis().then((e) => {
1218
+ this.emojiList = e;
1219
+ this.handleInputChange(this.inputElement);
1220
+ });
1221
+ }
1222
+ componentDidLoad() {
1223
+ if (this.focusWhenOpened) {
1224
+ this.inputElement.focus();
1225
+ }
1226
+ }
1227
+ handleInputChange(target) {
1228
+ this.filterVal = target.value;
1229
+ const regex = new RegExp(`([^,]*?${this.filterVal}[^,]*):(\\d+)`, 'g');
1230
+ this.filteredEmojis = Array.from(this.emojiList['search'].matchAll(regex)).map((m) => {
1231
+ return { name: m[1], emoji: this.emojiList['emojis'][m[2]] };
1232
+ });
1233
+ }
1234
+ handleEmojiClick(emoji) {
1235
+ this.emojiClicked.emit(emoji);
1236
+ }
1237
+ mapEmojiList() {
1238
+ var _a;
1239
+ if (((_a = this.emojiList) === null || _a === void 0 ? void 0 : _a.length) > 0) {
1240
+ return (h("div", { id: "loader" }, h("rtk-spinner", { iconPack: this.iconPack })));
1241
+ }
1242
+ return (h("div", { id: "emoji-grid", class: "scrollbar max-w-40" }, this.filteredEmojis.map((e) => (h("rtk-button", { key: `emoji-button-${e.name}`, class: "emoji", variant: "ghost", kind: "icon", title: e.name, onClick: () => this.handleEmojiClick(e.emoji) }, e.emoji)))));
1243
+ }
1244
+ render() {
1245
+ return (h(Host, { key: '48f4159ff5232b9d03fdcabf2d39e4375ca4fa14' }, h("div", { key: '20f86592a9dc47231c0c6cf33484af981533e21d', class: 'close-parent' }, h("rtk-button", { key: 'cff61f9c8fa0c1e0a8b6dc9433abedf914f9ded0', variant: "ghost", kind: "icon", class: "close", onClick: () => { var _a; return (_a = this.pickerClose) === null || _a === void 0 ? void 0 : _a.emit(); }, "aria-label": this.t('close') }, h("rtk-icon", { key: '56a12d4cc55b80ea026c92906466ebb10bf6cd6e', icon: this.iconPack.dismiss }))), h("div", { key: 'b48a1933b33f9886f39955ecbd046ffff370719b', class: 'emoji-parent' }, h("input", { key: '40d0f74a160358c3214b810de0f2ee6f286f1af7', value: this.filterVal, onInput: (event) => this.handleInputChange(event.target), placeholder: this.t('search'), ref: (el) => (this.inputElement = el) }), this.mapEmojiList())));
1246
+ }
1247
+ };
1248
+ __decorate$b([
1249
+ SyncWithStore()
1250
+ ], RtkEmojiPicker.prototype, "iconPack", void 0);
1251
+ __decorate$b([
1252
+ SyncWithStore()
1253
+ ], RtkEmojiPicker.prototype, "t", void 0);
1254
+ RtkEmojiPicker.style = RtkEmojiPickerStyle0;
1255
+
1256
+ const rtkEmojiPickerButtonCss = ":host{}";
1257
+ const RtkEmojiPickerButtonStyle0 = rtkEmojiPickerButtonCss;
1258
+
1259
+ var __decorate$a = (undefined && undefined.__decorate) || function (decorators, target, key, desc) {
1260
+ var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
1261
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function")
1262
+ r = Reflect.decorate(decorators, target, key, desc);
1263
+ else
1264
+ for (var i = decorators.length - 1; i >= 0; i--)
1265
+ if (d = decorators[i])
1266
+ r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
1267
+ return c > 3 && r && Object.defineProperty(target, key, r), r;
1268
+ };
1269
+ const RtkEmojiPickerButton = class {
1270
+ constructor(hostRef) {
1271
+ registerInstance(this, hostRef);
1272
+ /** Icon pack */
1273
+ this.iconPack = defaultIconPack;
1274
+ /** Language */
1275
+ this.t = useLanguage();
1276
+ }
1277
+ render() {
1278
+ return (h("rtk-tooltip", { key: '9826128cb78d2cb79a21b4dcb877ecc1ab020090', label: this.t('chat.send_emoji') }, h("rtk-button", { key: '07fd6bcc6ffdb58278c843748f771a2597f8edcd', variant: "ghost", kind: "icon", class: { active: this.isActive }, title: this.t('chat.send_emoji') }, h("rtk-icon", { key: '30f352d18771bd542d9ca4ff1a4615ef5958ec7d', icon: this.iconPack.emoji_multiple }))));
1279
+ }
1280
+ };
1281
+ __decorate$a([
1282
+ SyncWithStore()
1283
+ ], RtkEmojiPickerButton.prototype, "iconPack", void 0);
1284
+ __decorate$a([
1285
+ SyncWithStore()
1286
+ ], RtkEmojiPickerButton.prototype, "t", void 0);
1287
+ RtkEmojiPickerButton.style = RtkEmojiPickerButtonStyle0;
1288
+
1289
+ const rtkFileMessageViewCss = ":host{line-height:initial;font-family:var(--rtk-font-family, sans-serif);font-feature-settings:normal;font-variation-settings:normal}p{margin:var(--rtk-space-0, 0px);padding:var(--rtk-space-0, 0px)}.file{display:flex;align-items:center;gap:var(--rtk-space-1, 4px);padding-left:var(--rtk-space-2, 8px);padding-right:var(--rtk-space-2, 8px);padding-top:var(--rtk-space-1, 4px);padding-bottom:var(--rtk-space-1, 4px);min-width:var(--rtk-space-40, 160px);max-width:var(--rtk-space-64, 256px);border-radius:var(--rtk-border-radius-sm, 4px);--tw-bg-opacity:1;background-color:rgba(var(--rtk-colors-background-700, 44 44 44) / var(--tw-bg-opacity));color:rgb(var(--rtk-colors-text-700, 255 255 255 / 0.64))}.file .file-data{margin-left:var(--rtk-space-1, 4px);flex:1 1 0%}.file .file-data .name{word-break:break-all;color:rgb(var(--rtk-colors-text-1000, 255 255 255));overflow:hidden;display:-webkit-box;-webkit-box-orient:vertical;-webkit-line-clamp:1}.file .file-data .file-data-split{margin-top:var(--rtk-space-0\\.5, 2px);display:flex;align-items:center;font-size:12px}.file .file-data .file-data-split .ext{margin-right:var(--rtk-space-2, 8px);text-transform:uppercase;overflow:hidden;display:-webkit-box;-webkit-box-orient:vertical;-webkit-line-clamp:1}.file .file-data .file-data-split .divider{height:var(--rtk-space-4, 16px);width:var(--rtk-space-0\\.5, 2px);--tw-bg-opacity:1;background-color:rgba(var(--rtk-colors-background-600, 60 60 60) / var(--tw-bg-opacity))}.file .file-data .file-data-split .size{margin-left:var(--rtk-space-2, 8px)}";
1290
+ const RtkFileMessageViewStyle0 = rtkFileMessageViewCss;
1291
+
1292
+ var __decorate$9 = (undefined && undefined.__decorate) || function (decorators, target, key, desc) {
1293
+ var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
1294
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function")
1295
+ r = Reflect.decorate(decorators, target, key, desc);
1296
+ else
1297
+ for (var i = decorators.length - 1; i >= 0; i--)
1298
+ if (d = decorators[i])
1299
+ r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
1300
+ return c > 3 && r && Object.defineProperty(target, key, r), r;
1301
+ };
1302
+ const RtkFileMessageView = class {
1303
+ constructor(hostRef) {
1304
+ registerInstance(this, hostRef);
1305
+ /** Icon pack */
1306
+ this.iconPack = defaultIconPack;
1307
+ }
1308
+ render() {
1309
+ return (h("div", { key: 'd2cbeddc138f81c05da1656ee7f59c170e83bd1e', class: "file" }, h("rtk-button", { key: 'b0ee90c3493c24e938b6ea88a317c642e4afc003', variant: "secondary", kind: "icon", onClick: () => downloadFile(sanitizeLink(this.url), { name: this.name, fallbackName: 'file' }), part: "button" }, h("rtk-icon", { key: 'c1b25c655b5c87bf95948abfa461f8b58ff79195', icon: this.iconPack.download })), h("div", { key: 'c961a8ce93d4ff4405590787a88b5a9bbdbf56ab', class: "file-data" }, h("div", { key: 'bd178354d166c7816d6fabb72f7bba70fd711415', class: "name" }, this.name), h("div", { key: '59a791ae9f94a13b4005a0d8f79d09687fe3fc4c', class: "file-data-split" }, h("div", { key: 'b31421fdf786d92eed0decec9d3b247530413aa9', class: "ext" }, getExtension(this.name)), h("span", { key: '7a0a2a188b3e0b6bee0cf54d3afe29c2454788bb', class: "divider" }), h("div", { key: 'b217b87fa0737732aae10662b82d337d7258e6d7', class: "size" }, getFileSize(this.size))))));
1310
+ }
1311
+ };
1312
+ __decorate$9([
1313
+ SyncWithStore()
1314
+ ], RtkFileMessageView.prototype, "iconPack", void 0);
1315
+ RtkFileMessageView.style = RtkFileMessageViewStyle0;
1316
+
1317
+ const rtkFilePickerButtonCss = ":host{}";
1318
+ const RtkFilePickerButtonStyle0 = rtkFilePickerButtonCss;
1319
+
1320
+ var __decorate$8 = (undefined && undefined.__decorate) || function (decorators, target, key, desc) {
1321
+ var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
1322
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function")
1323
+ r = Reflect.decorate(decorators, target, key, desc);
1324
+ else
1325
+ for (var i = decorators.length - 1; i >= 0; i--)
1326
+ if (d = decorators[i])
1327
+ r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
1328
+ return c > 3 && r && Object.defineProperty(target, key, r), r;
1329
+ };
1330
+ const RtkFilePickerButton = class {
1331
+ constructor(hostRef) {
1332
+ registerInstance(this, hostRef);
1333
+ this.onFileChange = createEvent(this, "fileChange", 7);
1334
+ /** Icon */
1335
+ this.icon = 'attach';
1336
+ /** Icon pack */
1337
+ this.iconPack = defaultIconPack;
1338
+ /** Language */
1339
+ this.t = useLanguage();
1340
+ this.uploadFile = () => {
1341
+ const input = this.fileInputField;
1342
+ input.type = 'file';
1343
+ if (this.filter) {
1344
+ input.accept = this.filter;
1345
+ }
1346
+ input.onchange = (e) => {
1347
+ const { validity, files: [file], } = e.target;
1348
+ if (validity.valid) {
1349
+ this.onFileChange.emit(file);
1350
+ }
1351
+ };
1352
+ input.click();
1353
+ };
1354
+ }
1355
+ connectedCallback() {
1356
+ this.fileInputField = document.createElement('input');
1357
+ }
1358
+ disconnectedCallback() {
1359
+ // For GC
1360
+ this.fileInputField = undefined;
1361
+ }
1362
+ render() {
1363
+ const label = this.label || this.t('chat.send_file');
1364
+ const icon = this.iconPack[this.icon];
1365
+ return (h("rtk-tooltip", { key: '90e405f39792f7ea0430c55e9b5ba0da72ce2a4a', label: label }, h("rtk-button", { key: 'f0957e7a9668afd9e25e866ea2acbb6891123bbe', variant: "ghost", kind: "icon", onClick: () => this.uploadFile(), title: label }, h("rtk-icon", { key: '1955f524343683974831b28629291428637aa8fc', icon: icon }))));
1366
+ }
1367
+ };
1368
+ __decorate$8([
1369
+ SyncWithStore()
1370
+ ], RtkFilePickerButton.prototype, "iconPack", void 0);
1371
+ __decorate$8([
1372
+ SyncWithStore()
1373
+ ], RtkFilePickerButton.prototype, "t", void 0);
1374
+ RtkFilePickerButton.style = RtkFilePickerButtonStyle0;
1375
+
1376
+ const rtkIconCss = ":host{line-height:initial;font-family:var(--rtk-font-family, sans-serif);font-feature-settings:normal;font-variation-settings:normal}p{margin:var(--rtk-space-0, 0px);padding:var(--rtk-space-0, 0px)}:host{display:block;height:var(--rtk-space-10, 40px);outline:2px solid transparent;outline-offset:2px}:host .icon-wrapper{display:flex;height:100%;width:100%;flex-direction:column;align-items:center}:host svg{height:100%;width:100%;outline:2px solid transparent;outline-offset:2px}:host([size='xl']){box-sizing:border-box;display:block;height:var(--rtk-space-16, 64px) !important;width:var(--rtk-space-16, 64px) !important;--rtk-spinner-color:currentColor}:host([size='md']){box-sizing:border-box;display:block;height:var(--rtk-space-6, 24px) !important;width:var(--rtk-space-6, 24px) !important;--rtk-spinner-color:currentColor}:host([size='sm']){box-sizing:border-box;display:block;height:var(--rtk-space-4, 16px) !important;width:var(--rtk-space-4, 16px) !important;--rtk-spinner-color:currentColor}:host([variant='secondary']) .icon-wrapper{--tw-text-opacity:1;color:rgba(var(--rtk-colors-background-600, 60 60 60) / var(--tw-text-opacity))}:host([variant='danger']) .icon-wrapper{--tw-text-opacity:1;color:rgba(var(--rtk-colors-danger, 255 45 45) / var(--tw-text-opacity))}";
1377
+ const RtkIconStyle0 = rtkIconCss;
1378
+
1379
+ const parseIcon = (icon) => {
1380
+ try {
1381
+ return JSON.parse(icon);
1382
+ }
1383
+ catch (e) {
1384
+ return icon;
1385
+ }
1386
+ };
1387
+ const RtkIcon = class {
1388
+ constructor(hostRef) {
1389
+ registerInstance(this, hostRef);
1390
+ /** Icon variant */
1391
+ this.variant = 'primary';
1392
+ /** Size */
1393
+ this.size = 'lg';
1394
+ }
1395
+ render() {
1396
+ return (h(Host, { key: 'fbacb1ee3dd4c1ca7aa612f08e938601df73036c' }, h("div", { key: '04c026967cb7aa3acb3fba09fcf5b0d33f45e2b0', class: "icon-wrapper", innerHTML: parseIcon(this.icon), part: "wrapper" })));
1397
+ }
1398
+ };
1399
+ RtkIcon.style = RtkIconStyle0;
1400
+
1401
+ const rtkImageMessageViewCss = ":host{line-height:initial;font-family:var(--rtk-font-family, sans-serif);font-feature-settings:normal;font-variation-settings:normal}p{margin:var(--rtk-space-0, 0px);padding:var(--rtk-space-0, 0px)}.image-spinner{cursor:wait}.image-errored{cursor:not-allowed}.image{display:block;font-family:var(--rtk-font-family, sans-serif);color:rgb(var(--rtk-colors-text-900, 255 255 255 / 0.88));position:relative;height:var(--rtk-space-40, 160px);max-width:var(--rtk-space-64, 256px);cursor:pointer}.image img{display:none;height:100%;width:100%;border-radius:var(--rtk-border-radius-sm, 4px);-o-object-fit:cover;object-fit:cover}.image .image-spinner{display:flex;height:100%;width:100%;flex-direction:column;align-items:center;justify-content:center;border-radius:var(--rtk-border-radius-sm, 4px);--tw-bg-opacity:1;background-color:rgba(var(--rtk-colors-background-800, 30 30 30) / var(--tw-bg-opacity))}.image .image-spinner rtk-spinner{--tw-text-opacity:1;color:rgba(var(--rtk-colors-brand-500, 33 96 253) / var(--tw-text-opacity))}.image .image-errored{display:flex;height:100%;width:100%;flex-direction:column;align-items:center;justify-content:center;border-radius:var(--rtk-border-radius-sm, 4px);background-color:rgba(var(--rtk-colors-danger, 255 45 45) / 0.1);--tw-text-opacity:1;color:rgba(var(--rtk-colors-danger, 255 45 45) / var(--tw-text-opacity))}.image .actions{display:none;height:var(--rtk-space-8, 32px);align-items:center;position:absolute;top:var(--rtk-space-2, 8px);right:var(--rtk-space-2, 8px);border-radius:var(--rtk-border-radius-sm, 4px);--tw-bg-opacity:1;background-color:rgba(var(--rtk-colors-background-900, 26 26 26) / var(--tw-bg-opacity));color:rgb(var(--rtk-colors-text-1000, 255 255 255));overflow:hidden;--tw-shadow:0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -4px rgb(0 0 0 / 0.1);--tw-shadow-colored:0 10px 15px -3px var(--tw-shadow-color), 0 4px 6px -4px var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000), var(--tw-ring-shadow, 0 0 #0000), var(--tw-shadow)}.image .actions .action{height:var(--rtk-space-8, 32px);width:var(--rtk-space-8, 32px);border-radius:var(--rtk-border-radius-none, 0);border-width:var(--rtk-border-width-none, 0);border-style:none;background-color:transparent;--tw-shadow:0 0 #0000;--tw-shadow-colored:0 0 #0000;box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000), var(--tw-ring-shadow, 0 0 #0000), var(--tw-shadow)}.image .actions .action:hover{--tw-bg-opacity:1;background-color:rgba(var(--rtk-colors-background-600, 60 60 60) / var(--tw-bg-opacity))}.image.loaded img{display:block}.image.loaded .image-spinner{display:none}.image:hover .actions,.image:focus .actions{display:flex}";
1402
+ const RtkImageMessageViewStyle0 = rtkImageMessageViewCss;
1403
+
1404
+ var __decorate$7 = (undefined && undefined.__decorate) || function (decorators, target, key, desc) {
1405
+ var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
1406
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function")
1407
+ r = Reflect.decorate(decorators, target, key, desc);
1408
+ else
1409
+ for (var i = decorators.length - 1; i >= 0; i--)
1410
+ if (d = decorators[i])
1411
+ r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
1412
+ return c > 3 && r && Object.defineProperty(target, key, r), r;
1413
+ };
1414
+ const RtkImageMessageView = class {
1415
+ constructor(hostRef) {
1416
+ registerInstance(this, hostRef);
1417
+ this.onPreview = createEvent(this, "preview", 7);
1418
+ /** Icon pack */
1419
+ this.iconPack = defaultIconPack;
1420
+ /** Language */
1421
+ this.t = useLanguage();
1422
+ this.status = 'loading';
1423
+ }
1424
+ render() {
1425
+ return (h("div", { key: '259bdc1102c6026dd10388ae759f67608c777b5f', class: { image: true, loaded: this.status === 'loaded' } }, h("img", { key: 'dbcb8d497fee3710f4474ec3ac0ce9a9b4f1bb49', src: sanitizeLink(this.url), onLoad: () => {
1426
+ this.status = 'loaded';
1427
+ }, onError: () => {
1428
+ this.status = 'errored';
1429
+ }, onClick: () => {
1430
+ if (this.status === 'loaded') {
1431
+ this.onPreview.emit(this.url);
1432
+ }
1433
+ } }), this.status === 'loading' && (h("div", { key: 'b0ecfada4428e1cb8c3625cc4ce3d2a5bae058ab', class: "image-spinner", title: this.t('chat.img.loading'), "aria-label": this.t('chat.img.loading') }, h("rtk-spinner", { key: 'fff61c6522d8bcb7de1345bb6505721ee6c6325e', iconPack: this.iconPack }))), this.status === 'errored' && (h("div", { key: 'c07e2cf6e9a94d375802c974e519d859ab48aa9b', class: "image-errored", title: this.t('chat.error.img_not_found'), "aria-label": this.t('chat.error.img_not_found') }, h("rtk-icon", { key: '83108f4f0396d77778463601a4f18d8593b0ffe7', icon: this.iconPack.image_off }))), this.status === 'loaded' && (h("div", { key: '96b5aafbd94eec920ae1cad14f09ab4a44571bd7', class: "actions" }, h("rtk-button", { key: 'a87ec11cc8de472aeb356689b49b6b366bd67f28', class: "action", variant: "secondary", kind: "icon", onClick: () => {
1434
+ this.onPreview.emit(this.url);
1435
+ } }, h("rtk-icon", { key: '543478c786b709ac477d4482874608c0b394b27c', icon: this.iconPack.full_screen_maximize })), h("rtk-button", { key: '6ce6d94a965688c7ec6ee64f79a4d13dda9651e3', class: "action", variant: "secondary", kind: "icon", onClick: () => downloadFile(this.url, { fallbackName: 'image' }) }, h("rtk-icon", { key: '3b1d67fbdd667e0d006e342c37f6e78c90fd2e34', icon: this.iconPack.download }))))));
1436
+ }
1437
+ };
1438
+ __decorate$7([
1439
+ SyncWithStore()
1440
+ ], RtkImageMessageView.prototype, "iconPack", void 0);
1441
+ __decorate$7([
1442
+ SyncWithStore()
1443
+ ], RtkImageMessageView.prototype, "t", void 0);
1444
+ RtkImageMessageView.style = RtkImageMessageViewStyle0;
1445
+
1446
+ const rtkMarkdownViewCss = ":host{line-height:initial;font-family:var(--rtk-font-family, sans-serif);font-feature-settings:normal;font-variation-settings:normal}p{margin:var(--rtk-space-0, 0px);padding:var(--rtk-space-0, 0px)}:host{overflow-wrap:break-word}a{color:currentColor}.block-quote,blockquote{margin:var(--rtk-space-0, 0px);margin-bottom:var(--rtk-space-3, 12px);--tw-border-spacing-x:1px;--tw-border-spacing-y:1px;border-spacing:var(--tw-border-spacing-x) var(--tw-border-spacing-y);border-top-width:var(--rtk-border-width-none, 0);border-bottom-width:var(--rtk-border-width-none, 0);border-left-width:var(--rtk-border-width-md, 2px);border-right-width:var(--rtk-border-width-none, 0);border-style:solid;padding:var(--rtk-space-0\\.5, 2px);padding-left:var(--rtk-space-2, 8px);border-radius:var(--rtk-border-radius-sm, 4px);border-top-left-radius:var(--rtk-border-radius-none, 0);border-bottom-left-radius:var(--rtk-border-radius-none, 0)}pre{white-space:pre-wrap}";
1447
+ const RtkMarkdownViewStyle0 = rtkMarkdownViewCss;
1448
+
1449
+ const RtkMarkdownView = class {
1450
+ constructor(hostRef) {
1451
+ registerInstance(this, hostRef);
1452
+ /** max length of text to render as markdown */
1453
+ this.maxLength = MAX_TEXT_LENGTH;
1454
+ this.restoreEmpty = (content, tag, renderCallback) => {
1455
+ return content.trim().length === 0 ? `${tag}${content}${tag}` : renderCallback(content);
1456
+ };
1457
+ this.renderLink = (content) => {
1458
+ return (h("a", { class: "link", href: content, target: "_blank", rel: "noopener noreferrer" }, content));
1459
+ };
1460
+ this.renderBold = (content) => {
1461
+ if (typeof content === 'string') {
1462
+ return this.restoreEmpty(content, '*', (c) => h("b", null, c));
1463
+ }
1464
+ return h("b", null, this.renderTokens(content));
1465
+ };
1466
+ this.renderItalic = (content) => {
1467
+ if (typeof content === 'string') {
1468
+ return this.restoreEmpty(content, '_', (c) => h("i", null, c));
1469
+ }
1470
+ return h("i", null, this.renderTokens(content));
1471
+ };
1472
+ this.renderStrikethrough = (content) => {
1473
+ if (typeof content === 'string') {
1474
+ return this.restoreEmpty(content, '~', (c) => h("s", null, c));
1475
+ }
1476
+ return h("b", null, this.renderTokens(content));
1477
+ };
1478
+ this.renderPlainText = (content) => {
1479
+ if (typeof content === 'string') {
1480
+ return content;
1481
+ }
1482
+ return h("p", null, this.renderTokens(content));
1483
+ };
1484
+ this.renderTokens = (tokens) => {
1485
+ return tokens.map((token) => {
1486
+ switch (token.type) {
1487
+ case 'a':
1488
+ if (typeof token.content === 'string') {
1489
+ return this.renderLink(token.content);
1490
+ }
1491
+ case 'b':
1492
+ return this.renderBold(token.content);
1493
+ case 'i':
1494
+ return this.renderItalic(token.content);
1495
+ case 's':
1496
+ return this.renderStrikethrough(token.content);
1497
+ case 'q':
1498
+ return h("span", { class: "block-quote" });
1499
+ case 'plain_text':
1500
+ default:
1501
+ return this.renderPlainText(token.content);
1502
+ }
1503
+ });
1504
+ };
1505
+ }
1506
+ renderMessage(text) {
1507
+ let lines = text.split('\n');
1508
+ let isCodeBlock = false;
1509
+ if (lines[0] === '```' && lines[lines.length - 1] === '```') {
1510
+ isCodeBlock = true;
1511
+ lines = lines.slice(1, -1);
1512
+ }
1513
+ const message = lines.map((line) => {
1514
+ const tokens = parseRichText(line);
1515
+ return h("p", null, this.renderTokens(tokens));
1516
+ });
1517
+ if (isCodeBlock) {
1518
+ return h("pre", { style: { whiteSpace: 'pre', overflow: 'scroll' } }, lines.join('\n'));
1519
+ }
1520
+ return message;
1521
+ }
1522
+ render() {
1523
+ const slicedMessage = this.text.slice(0, this.maxLength);
1524
+ const withReply = extractReplyBlock(slicedMessage, true);
1525
+ const withoutReply = stripOutReplyBlock(slicedMessage);
1526
+ return (h("p", { key: '9544292f118f2c6975a807d6bcc2d307c70b2940' }, withReply.length !== 0 && h("blockquote", { key: '294bca9889738148fd51ecd8487d2d98b5adee4b' }, this.renderMessage(withReply)), withoutReply.length !== 0 && this.renderMessage(withoutReply)));
1527
+ }
1528
+ };
1529
+ RtkMarkdownView.style = RtkMarkdownViewStyle0;
1530
+
1531
+ const sm = 640;
1532
+ const md = 768;
1533
+ const lg = 1080;
1534
+ const xl = 2160;
1535
+ const breakpoints = {
1536
+ sm: sm,
1537
+ md: md,
1538
+ lg: lg,
1539
+ xl: xl
1540
+ };
1541
+
1542
+ /**
1543
+ * Get the screen breakpoint from a given width
1544
+ * @param width The width of the container
1545
+ * @returns The screen breakpoint value
1546
+ */
1547
+ const getSize = (width) => {
1548
+ if (width >= breakpoints.lg)
1549
+ return 'lg';
1550
+ else if (width >= breakpoints.md)
1551
+ return 'md';
1552
+ else
1553
+ return 'sm';
1554
+ };
1555
+
1556
+ const rtkMeetingCss = ":host{line-height:initial;font-family:var(--rtk-font-family, sans-serif);font-feature-settings:normal;font-variation-settings:normal}p{margin:var(--rtk-space-0, 0px);padding:var(--rtk-space-0, 0px)}:host{box-sizing:border-box;display:flex;flex-direction:column;--tw-bg-opacity:1;background-color:rgba(var(--rtk-colors-background-1000, 8 8 8) / var(--tw-bg-opacity));color:rgb(var(--rtk-colors-text-900, 255 255 255 / 0.88));overflow:hidden;position:fixed;top:var(--rtk-space-0, 0px);right:var(--rtk-space-0, 0px);bottom:var(--rtk-space-0, 0px);left:var(--rtk-space-0, 0px);height:100%;width:100%}:host([mode='fill']){position:relative}";
1557
+ const RtkMeetingStyle0 = rtkMeetingCss;
1558
+
1559
+ const RtkMeeting = class {
1560
+ constructor(hostRef) {
1561
+ registerInstance(this, hostRef);
1562
+ this.statesUpdate = createEvent(this, "rtkStatesUpdate", 7);
1563
+ /** Since RtkMeeting by design works as a provider for component, to be in sync with other providers, added provider id */
1564
+ this.providerId = 'provider-' + Math.floor(Math.random() * 100);
1565
+ this.roomJoinedListener = () => {
1566
+ this.updateStates({ meeting: 'joined' });
1567
+ };
1568
+ this.waitlistedListener = () => {
1569
+ this.updateStates({ meeting: 'waiting' });
1570
+ };
1571
+ this.roomLeftListener = ({ state }) => {
1572
+ // Let socketConnectionUpdate listener handle this case.
1573
+ if (state === 'disconnected' || state === 'failed')
1574
+ return;
1575
+ this.updateStates({ meeting: 'ended', roomLeftState: state });
1576
+ };
1577
+ this.mediaPermissionUpdateListener = ({ kind, message }) => {
1578
+ if (['audio', 'video'].includes(kind)) {
1579
+ if ((message === 'DENIED' || message === 'SYSTEM_DENIED') &&
1580
+ (this.peerStore || uiStore).state.states.activeDebugger !== true) {
1581
+ const permissionModalSettings = {
1582
+ enabled: true,
1583
+ kind,
1584
+ };
1585
+ this.updateStates({ activePermissionsMessage: permissionModalSettings });
1586
+ }
1587
+ }
1588
+ };
1589
+ this.socketConnectionUpdateListener = ({ state }) => {
1590
+ if (state === 'failed') {
1591
+ setTimeout(() => {
1592
+ this.meeting.leave('disconnected');
1593
+ }, this.leaveRoomTimer);
1594
+ }
1595
+ };
1596
+ this.peerStore = null; // peer specific store for this meeting peer instance
1597
+ /** Whether to load config from preset */
1598
+ this.loadConfigFromPreset = false;
1599
+ /** Whether to apply the design system on the document root from config */
1600
+ this.applyDesignSystem = false;
1601
+ /** Fill type */
1602
+ this.mode = 'fixed';
1603
+ /** Whether participant should leave when this component gets unmounted */
1604
+ this.leaveOnUnmount = false;
1605
+ /** Language */
1606
+ this.t = useLanguage();
1607
+ /** UI Config */
1608
+ this.config = createDefaultConfig();
1609
+ /** Grid layout */
1610
+ this.gridLayout = 'row';
1611
+ /** Icon pack */
1612
+ this.iconPack = defaultIconPack;
1613
+ this.handleChangingMeeting = (destinationMeetingId) => {
1614
+ const currentStates = (this.peerStore || uiStore).state.states;
1615
+ this.updateStates({
1616
+ activeBreakoutRoomsManager: Object.assign(Object.assign({}, currentStates.activeBreakoutRoomsManager), { destinationMeetingId }),
1617
+ });
1618
+ };
1619
+ }
1620
+ connectedCallback() {
1621
+ var _a;
1622
+ if (typeof window !== 'undefined') {
1623
+ this.authErrorListener = (ev) => {
1624
+ if (ev.detail.message.includes('401')) {
1625
+ this.updateStates({ meeting: 'ended', roomLeftState: 'unauthorized' });
1626
+ }
1627
+ };
1628
+ window.addEventListener('rtkError', this.authErrorListener);
1629
+ }
1630
+ // Initialize default values
1631
+ this.leaveRoomTimer = 10000;
1632
+ this.loadConfigFromPreset = true;
1633
+ this.applyDesignSystem = true;
1634
+ // Setup event listeners
1635
+ this.setupStoreRequestListener();
1636
+ this.setupStateUpdateListener();
1637
+ this.meetingChanged(this.meeting);
1638
+ this.iconPackChanged(this.iconPack);
1639
+ this.tChanged(this.t);
1640
+ this.configChanged(this.config);
1641
+ this.resizeObserver = new index(() => this.handleResize());
1642
+ this.resizeObserver.observe(this.host);
1643
+ if (this.applyDesignSystem &&
1644
+ ((_a = this.config) === null || _a === void 0 ? void 0 : _a.designTokens) != null &&
1645
+ typeof document !== 'undefined' &&
1646
+ (this.peerStore || uiStore).state.states.activeDebugger !== true) {
1647
+ provideRtkDesignSystem(document.documentElement, this.config.designTokens);
1648
+ }
1649
+ }
1650
+ disconnectedCallback() {
1651
+ var _a;
1652
+ if (this.leaveOnUnmount) {
1653
+ (_a = this.meeting) === null || _a === void 0 ? void 0 : _a.leaveRoom();
1654
+ }
1655
+ this.resizeObserver.disconnect();
1656
+ window.removeEventListener('rtkError', this.authErrorListener);
1657
+ // Remove event listeners
1658
+ if (this.storeRequestListener) {
1659
+ this.host.removeEventListener('rtkRequestStore', this.storeRequestListener);
1660
+ this.storeRequestListener = null;
1661
+ }
1662
+ if (this.stateUpdateListener) {
1663
+ this.host.removeEventListener('rtkStateUpdate', this.stateUpdateListener);
1664
+ this.stateUpdateListener = null;
1665
+ }
1666
+ // Clear meeting listeners
1667
+ if (this.meeting) {
1668
+ this.clearListeners(this.meeting);
1669
+ }
1670
+ }
1671
+ setupStoreRequestListener() {
1672
+ // Remove existing listener if any
1673
+ if (this.storeRequestListener) {
1674
+ this.host.removeEventListener('rtkRequestStore', this.storeRequestListener);
1675
+ }
1676
+ // Listen for store requests from child components
1677
+ this.storeRequestListener = (event) => {
1678
+ // Provide peer specific store if available, otherwise fall back to global store
1679
+ if (!this.peerStore)
1680
+ return;
1681
+ const storeToProvide = this.peerStore;
1682
+ const responseEvent = new CustomEvent('rtkProvideStore', {
1683
+ detail: { store: storeToProvide, requestId: event.detail.requestId },
1684
+ });
1685
+ document.dispatchEvent(responseEvent);
1686
+ // Stop the event from bubbling further to prevent other meetings from handling it
1687
+ event.stopPropagation();
1688
+ };
1689
+ this.host.addEventListener('rtkRequestStore', this.storeRequestListener);
1690
+ }
1691
+ setupStateUpdateListener() {
1692
+ if (this.stateUpdateListener) {
1693
+ this.host.removeEventListener('rtkStateUpdate', this.stateUpdateListener);
1694
+ }
1695
+ this.stateUpdateListener = (event) => {
1696
+ const eventTarget = event.target;
1697
+ if (!this.host.contains(eventTarget)) {
1698
+ return;
1699
+ }
1700
+ this.updateStates(event.detail);
1701
+ };
1702
+ this.host.addEventListener('rtkStateUpdate', this.stateUpdateListener);
1703
+ }
1704
+ clearListeners(meeting) {
1705
+ if (!meeting)
1706
+ return;
1707
+ meeting.self.removeListener('roomLeft', this.roomLeftListener);
1708
+ meeting.self.removeListener('roomJoined', this.roomJoinedListener);
1709
+ meeting.self.removeListener('waitlisted', this.waitlistedListener);
1710
+ meeting.self.removeListener('mediaPermissionUpdate', this.mediaPermissionUpdateListener);
1711
+ meeting.meta.removeListener('socketConnectionUpdate', this.socketConnectionUpdateListener);
1712
+ }
1713
+ meetingChanged(meeting) {
1714
+ var _a, _b;
1715
+ if (!meeting)
1716
+ return;
1717
+ // Create peer specific store for this meeting peer instance
1718
+ if (meeting) {
1719
+ this.peerStore = createPeerStore({
1720
+ meeting,
1721
+ config: this.config,
1722
+ iconPack: this.iconPack,
1723
+ t: this.t,
1724
+ providerId: this.providerId,
1725
+ });
1726
+ // Notify components that peer specific store is now available
1727
+ document.dispatchEvent(new CustomEvent('rtkPeerStoreReady', {
1728
+ detail: {
1729
+ peerId: meeting.self.id,
1730
+ },
1731
+ }));
1732
+ }
1733
+ else {
1734
+ this.peerStore = null;
1735
+ }
1736
+ this.updateStates({ viewType: meeting.meta.viewType });
1737
+ if (this.loadConfigFromPreset && meeting.self.config != null) {
1738
+ const theme = meeting.self.config;
1739
+ const { config, data } = generateConfig(theme, meeting);
1740
+ this.config = config;
1741
+ if (this.showSetupScreen == null) {
1742
+ this.showSetupScreen = data.showSetupScreen;
1743
+ }
1744
+ if (meeting.connectedMeetings.supportsConnectedMeetings &&
1745
+ ((_a = (this.peerStore || uiStore).state.states.activeBreakoutRoomsManager) === null || _a === void 0 ? void 0 : _a.destinationMeetingId)) {
1746
+ this.showSetupScreen = false;
1747
+ }
1748
+ }
1749
+ if (this.applyDesignSystem &&
1750
+ ((_b = this.config) === null || _b === void 0 ? void 0 : _b.designTokens) != null &&
1751
+ typeof document !== 'undefined' &&
1752
+ (this.peerStore || uiStore).state.states.activeDebugger !== true) {
1753
+ provideRtkDesignSystem(document.documentElement, this.config.designTokens);
1754
+ }
1755
+ meeting.self.addListener('roomJoined', this.roomJoinedListener);
1756
+ meeting.self.addListener('waitlisted', this.waitlistedListener);
1757
+ meeting.self.addListener('roomLeft', this.roomLeftListener);
1758
+ meeting.self.addListener('mediaPermissionUpdate', this.mediaPermissionUpdateListener);
1759
+ meeting.meta.addListener('socketConnectionUpdate', this.socketConnectionUpdateListener);
1760
+ if (meeting.connectedMeetings.supportsConnectedMeetings) {
1761
+ meeting.connectedMeetings.once('changingMeeting', this.handleChangingMeeting);
1762
+ }
1763
+ if (meeting.self.roomJoined) {
1764
+ this.updateStates({ meeting: 'joined' });
1765
+ }
1766
+ else {
1767
+ if (this.showSetupScreen) {
1768
+ this.updateStates({ meeting: 'setup' });
1769
+ }
1770
+ else {
1771
+ meeting.joinRoom();
1772
+ }
1773
+ }
1774
+ window.removeEventListener('rtkError', this.authErrorListener);
1775
+ }
1776
+ iconPackChanged(newIconPack) {
1777
+ if (this.peerStore) {
1778
+ this.peerStore.state.iconPack = newIconPack;
1779
+ }
1780
+ }
1781
+ tChanged(newT) {
1782
+ if (this.peerStore) {
1783
+ this.peerStore.state.t = newT;
1784
+ }
1785
+ }
1786
+ configChanged(config) {
1787
+ if (this.peerStore) {
1788
+ this.peerStore.state.config = config;
1789
+ }
1790
+ if ((config === null || config === void 0 ? void 0 : config.designTokens) &&
1791
+ typeof document !== 'undefined' &&
1792
+ (this.peerStore || uiStore).state.states.activeDebugger !== true) {
1793
+ provideRtkDesignSystem(document.documentElement, config.designTokens);
1794
+ }
1795
+ }
1796
+ handleResize() {
1797
+ this.size = getSize(this.host.clientWidth);
1798
+ }
1799
+ updateStates(states) {
1800
+ // Use peer specific store if available, otherwise fall back to global store
1801
+ const targetStore = this.peerStore || uiStore;
1802
+ const newStates = Object.assign({}, targetStore.state.states);
1803
+ targetStore.state.states = deepMerge(newStates, states);
1804
+ // Emit unscoped event for backward compatibility
1805
+ this.statesUpdate.emit(targetStore.state.states);
1806
+ // Also emit a scoped event that only this meeting's components should listen to
1807
+ const scopedEvent = new CustomEvent('rtkStatesUpdate', {
1808
+ detail: targetStore.state.states,
1809
+ bubbles: true,
1810
+ composed: true,
1811
+ });
1812
+ this.host.dispatchEvent(scopedEvent);
1813
+ }
1814
+ render() {
1815
+ const defaults = {
1816
+ meeting: this.meeting,
1817
+ size: this.size,
1818
+ states: (this.peerStore || uiStore).state.states,
1819
+ config: this.config || createDefaultConfig(),
1820
+ iconPack: this.iconPack,
1821
+ t: this.t,
1822
+ };
1823
+ if ((this.peerStore || uiStore).state.states.viewType === 'CHAT') {
1824
+ return h("rtk-chat", Object.assign({}, defaults));
1825
+ }
1826
+ const elementProps = {
1827
+ 'rtk-grid': {
1828
+ layout: this.gridLayout,
1829
+ },
1830
+ };
1831
+ return h(Render, { element: "rtk-meeting", defaults: defaults, asHost: true, elementProps: elementProps });
1832
+ }
1833
+ get host() { return getElement(this); }
1834
+ static get watchers() { return {
1835
+ "meeting": ["meetingChanged"],
1836
+ "iconPack": ["iconPackChanged"],
1837
+ "t": ["tChanged"],
1838
+ "config": ["configChanged"]
1839
+ }; }
1840
+ };
1841
+ RtkMeeting.style = RtkMeetingStyle0;
1842
+
1843
+ const rtkMenuCss = ":host{line-height:initial;font-family:var(--rtk-font-family, sans-serif);font-feature-settings:normal;font-variation-settings:normal}p{margin:var(--rtk-space-0, 0px);padding:var(--rtk-space-0, 0px)}:host{position:relative;display:inline-block;color:rgb(var(--rtk-colors-text-1000, 255 255 255))}#menu-list{position:absolute;z-index:20;display:none}";
1844
+ const RtkMenuStyle0 = rtkMenuCss;
1845
+
1846
+ var __decorate$6 = (undefined && undefined.__decorate) || function (decorators, target, key, desc) {
1847
+ var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
1848
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function")
1849
+ r = Reflect.decorate(decorators, target, key, desc);
1850
+ else
1851
+ for (var i = decorators.length - 1; i >= 0; i--)
1852
+ if (d = decorators[i])
1853
+ r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
1854
+ return c > 3 && r && Object.defineProperty(target, key, r), r;
1855
+ };
1856
+ const RtkMenu$1 = class {
1857
+ constructor(hostRef) {
1858
+ registerInstance(this, hostRef);
1859
+ this.clickedThis = false;
1860
+ /** Placement of menu */
1861
+ this.placement = 'bottom-end';
1862
+ /** Offset in px */
1863
+ this.offset = 10;
1864
+ /** Icon pack */
1865
+ this.iconPack = defaultIconPack;
1866
+ /** Language */
1867
+ this.t = useLanguage();
1868
+ this.handleOutsideClick = () => {
1869
+ // handles clicking on other menu triggers
1870
+ if (!this.clickedThis) {
1871
+ // if other trigger is clicked, hide this menu-list
1872
+ this.menuListEl.style.display = 'none';
1873
+ }
1874
+ // reset the value
1875
+ this.clickedThis = false;
1876
+ };
1877
+ }
1878
+ componentDidLoad() {
1879
+ document.addEventListener('click', this.handleOutsideClick);
1880
+ this.update();
1881
+ }
1882
+ disconnectedCallback() {
1883
+ document.removeEventListener('click', this.handleOutsideClick);
1884
+ }
1885
+ update() {
1886
+ computePosition(this.triggerEl, this.menuListEl, {
1887
+ placement: this.placement,
1888
+ middleware: [offset(this.offset), flip(), shift({ padding: 5 })],
1889
+ }).then(({ x, y }) => {
1890
+ Object.assign(this.menuListEl.style, {
1891
+ left: `${x}px`,
1892
+ top: `${y}px`,
1893
+ });
1894
+ });
1895
+ }
1896
+ render() {
1897
+ return (h(Host, { key: 'a814ea3dde902a15cb6fb0db8a9c2409c240537f' }, h("span", { key: 'de2447524c6a1787a6b9442ccb9c3d56a33e9f4f', id: "trigger", ref: (el) => (this.triggerEl = el), onClick: () => {
1898
+ this.clickedThis = true;
1899
+ if (this.menuListEl.style.display !== 'block') {
1900
+ this.menuListEl.style.display = 'block';
1901
+ this.update();
1902
+ }
1903
+ else {
1904
+ this.menuListEl.style.display = 'none';
1905
+ }
1906
+ } }, h("slot", { key: 'fb566f431ceca452fad8b564cfb777bc90411a02', name: "trigger" })), h("span", { key: '50b030d301e54677d19cc21dadcec53f566b14cf', part: "menu-list", id: "menu-list", ref: (el) => (this.menuListEl = el) }, h("slot", { key: '59ce6c30c39155fec448114fd25752585d95c87d' }))));
1907
+ }
1908
+ };
1909
+ __decorate$6([
1910
+ SyncWithStore()
1911
+ ], RtkMenu$1.prototype, "iconPack", void 0);
1912
+ __decorate$6([
1913
+ SyncWithStore()
1914
+ ], RtkMenu$1.prototype, "t", void 0);
1915
+ RtkMenu$1.style = RtkMenuStyle0;
1916
+
1917
+ const rtkMenuItemCss = ":host{line-height:initial;font-family:var(--rtk-font-family, sans-serif);font-feature-settings:normal;font-variation-settings:normal}p{margin:var(--rtk-space-0, 0px);padding:var(--rtk-space-0, 0px)}:host{display:flex;align-items:center;padding-left:var(--rtk-space-3, 12px);padding-right:var(--rtk-space-3, 12px);padding-top:var(--rtk-space-2, 8px);padding-bottom:var(--rtk-space-2, 8px);cursor:pointer;transition-property:color, background-color, border-color, text-decoration-color, fill, stroke;transition-timing-function:cubic-bezier(0.4, 0, 0.2, 1);transition-duration:150ms;color:rgb(var(--rtk-colors-text-1000, 255 255 255));font-size:14px}::slotted([slot='start']){margin-right:var(--rtk-space-2, 8px)}::slotted([slot='end']){margin-left:var(--rtk-space-2, 8px)}:host(:hover){--tw-bg-opacity:1;background-color:rgba(var(--rtk-colors-background-600, 60 60 60) / var(--tw-bg-opacity))}:host(.red){--tw-text-opacity:1;color:rgba(var(--rtk-colors-danger, 255 45 45) / var(--tw-text-opacity))}";
1918
+ const RtkMenuItemStyle0 = rtkMenuItemCss;
1919
+
1920
+ var __decorate$5 = (undefined && undefined.__decorate) || function (decorators, target, key, desc) {
1921
+ var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
1922
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function")
1923
+ r = Reflect.decorate(decorators, target, key, desc);
1924
+ else
1925
+ for (var i = decorators.length - 1; i >= 0; i--)
1926
+ if (d = decorators[i])
1927
+ r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
1928
+ return c > 3 && r && Object.defineProperty(target, key, r), r;
1929
+ };
1930
+ const RtkMenuItem = class {
1931
+ constructor(hostRef) {
1932
+ registerInstance(this, hostRef);
1933
+ /** Icon pack */
1934
+ this.iconPack = defaultIconPack;
1935
+ /** Language */
1936
+ this.t = useLanguage();
1937
+ }
1938
+ render() {
1939
+ return (h(Host, { key: 'f0316fee5ac5fd2124ee26ac2664172007ad1c54' }, h("slot", { key: '994a3a27f743462a3ae0a4c95bc5de672119fdb6', name: "start" }), h("slot", { key: '24594ecaffb46a4b0458032596570fee37e6ae00' }), h("slot", { key: '4ede22267a24a37c508591b0148a1e1b2c391fc9', name: "end" })));
1940
+ }
1941
+ };
1942
+ __decorate$5([
1943
+ SyncWithStore()
1944
+ ], RtkMenuItem.prototype, "iconPack", void 0);
1945
+ __decorate$5([
1946
+ SyncWithStore()
1947
+ ], RtkMenuItem.prototype, "t", void 0);
1948
+ RtkMenuItem.style = RtkMenuItemStyle0;
1949
+
1950
+ const rtkMenuListCss = ":host{line-height:initial;font-family:var(--rtk-font-family, sans-serif);font-feature-settings:normal;font-variation-settings:normal}p{margin:var(--rtk-space-0, 0px);padding:var(--rtk-space-0, 0px)}:host{display:flex;width:-moz-max-content;width:max-content;flex-direction:column;padding-top:var(--rtk-space-2, 8px);padding-bottom:var(--rtk-space-2, 8px);--tw-bg-opacity:1;background-color:rgba(var(--rtk-colors-background-800, 30 30 30) / var(--tw-bg-opacity));color:rgb(var(--rtk-colors-text-1000, 255 255 255));overflow:hidden;border-radius:var(--rtk-border-radius-sm, 4px);--tw-shadow:0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -4px rgb(0 0 0 / 0.1);--tw-shadow-colored:0 10px 15px -3px var(--tw-shadow-color), 0 4px 6px -4px var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000), var(--tw-ring-shadow, 0 0 #0000), var(--tw-shadow)}";
1951
+ const RtkMenuListStyle0 = rtkMenuListCss;
1952
+
1953
+ var __decorate$4 = (undefined && undefined.__decorate) || function (decorators, target, key, desc) {
1954
+ var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
1955
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function")
1956
+ r = Reflect.decorate(decorators, target, key, desc);
1957
+ else
1958
+ for (var i = decorators.length - 1; i >= 0; i--)
1959
+ if (d = decorators[i])
1960
+ r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
1961
+ return c > 3 && r && Object.defineProperty(target, key, r), r;
1962
+ };
1963
+ const RtkMenuList = class {
1964
+ constructor(hostRef) {
1965
+ registerInstance(this, hostRef);
1966
+ /** Icon pack */
1967
+ this.iconPack = defaultIconPack;
1968
+ /** Language */
1969
+ this.t = useLanguage();
1970
+ }
1971
+ render() {
1972
+ return (h(Host, { key: 'c0974bc340294b197aa8310e5a9913126ac22c48' }, h("slot", { key: '1a660db36c713285203569957959663497803c5e' })));
1973
+ }
1974
+ };
1975
+ __decorate$4([
1976
+ SyncWithStore()
1977
+ ], RtkMenuList.prototype, "iconPack", void 0);
1978
+ __decorate$4([
1979
+ SyncWithStore()
1980
+ ], RtkMenuList.prototype, "t", void 0);
1981
+ RtkMenuList.style = RtkMenuListStyle0;
1982
+
1983
+ const rtkMessageViewCss = ":host{line-height:initial;font-family:var(--rtk-font-family, sans-serif);font-feature-settings:normal;font-variation-settings:normal}p{margin:var(--rtk-space-0, 0px);padding:var(--rtk-space-0, 0px)}.scrollbar{scrollbar-width:thin;scrollbar-color:var(--rtk-scrollbar-color, rgb(var(--rtk-colors-background-600, 60 60 60)))\n var(--rtk-scrollbar-background, transparent)}.scrollbar::-webkit-scrollbar{height:var(--rtk-space-1\\.5, 6px);width:var(--rtk-space-1\\.5, 6px);border-radius:9999px;background-color:var(--rtk-scrollbar-background, transparent)}.scrollbar::-webkit-scrollbar-thumb{border-radius:9999px;background-color:var(--rtk-scrollbar-color, rgb(var(--rtk-colors-background-600, 60 60 60)))}:host{max-width:var(--rtk-space-96, 384px)}.message-wrapper{display:flex;flex-direction:row-reverse;align-items:flex-start;gap:var(--rtk-space-2, 8px)}.message-wrapper.incoming{flex-direction:row}.message{display:flex;flex-direction:column;align-items:flex-end}.incoming .message{display:flex;flex-direction:column;align-items:flex-start}.header{margin-top:var(--rtk-space-1, 4px);margin-bottom:var(--rtk-space-1, 4px);align-self:flex-end;color:rgb(var(--rtk-colors-text-900, 255 255 255 / 0.88));font-size:12px;font-weight:600}.incoming .header{align-self:flex-start}.body{display:flex;flex-direction:column;min-width:var(--rtk-space-24, 96px);font-family:var(--rtk-font-family, sans-serif);color:rgb(var(--rtk-colors-text-900, 255 255 255 / 0.88));font-size:14px;line-height:1.375;position:relative}.bubble{max-width:90%;padding:var(--rtk-space-2, 8px);border-width:1px;border-style:solid;--tw-border-opacity:1;border-color:rgba(var(--rtk-colors-brand-600, 13 81 253) / var(--tw-border-opacity));--tw-bg-opacity:1;background-color:rgba(var(--rtk-colors-brand-500, 33 96 253) / var(--tw-bg-opacity));color:rgb(var(--rtk-colors-text-on-brand-1000, var(--rtk-colors-text-1000, 255 255 255)));border-radius:var(--rtk-border-radius-md, 8px)}.incoming .bubble{--tw-border-opacity:1;border-color:rgba(var(--rtk-colors-background-600, 60 60 60) / var(--tw-border-opacity));--tw-bg-opacity:1;background-color:rgba(var(--rtk-colors-background-800, 30 30 30) / var(--tw-bg-opacity));color:rgb(var(--rtk-colors-text-900, 255 255 255 / 0.88))}.metadata{margin-top:var(--rtk-space-2, 8px);align-self:flex-end;font-size:10px;color:rgb(var(--rtk-colors-text-800, 255 255 255 / 0.76))}.avatar{display:none}rtk-menu{position:absolute;right:var(--rtk-space-0, 0px);top:var(--rtk-space-0, 0px);border-radius:var(--rtk-border-radius-lg, 12px)}rtk-menu rtk-icon{height:var(--rtk-space-4, 16px);width:var(--rtk-space-4, 16px);cursor:pointer}.actions{display:flex;align-items:center;justify-content:center;padding-left:var(--rtk-space-2, 8px);padding-bottom:var(--rtk-space-2, 8px);padding-top:var(--rtk-space-1, 4px);padding-right:var(--rtk-space-1, 4px);border-radius:var(--rtk-border-radius-md, 8px);border-width:var(--rtk-border-width-none, 0);border-style:none;background:radial-gradient(\n at top right,\n rgb(var(--rtk-colors-brand-300, 73 124 253)) 60%,\n rgba(255, 255, 255, 0) 80%\n )}.actions rtk-icon{height:var(--rtk-space-4, 16px);width:var(--rtk-space-4, 16px);color:rgb(var(--rtk-colors-text-on-brand-1000, var(--rtk-colors-text-1000, 255 255 255)))}.incoming .actions{background:radial-gradient(\n at top right,\n rgb(var(--rtk-colors-background-800, 30 30 30)) 60%,\n rgba(255, 255, 255, 0) 80%\n )}.incoming .actions rtk-icon{color:rgb(var(--rtk-colors-text-900, 255 255 255 / 0.88))}.incoming rtk-avatar{--tw-bg-opacity:1;background-color:rgba(var(--rtk-colors-background-600, 60 60 60) / var(--tw-bg-opacity));color:rgb(var(--rtk-colors-text-900, 255 255 255 / 0.88))}@media (min-width: 400px){.avatar{display:flex;width:var(--rtk-space-6, 24px)}.avatar rtk-avatar{height:var(--rtk-space-6, 24px);width:var(--rtk-space-6, 24px);font-size:10px;overflow:clip;border-radius:9999px}}@media (hover: hover){rtk-menu{visibility:hidden}.body:hover rtk-menu{visibility:visible}}";
1984
+ const RtkMessageViewStyle0 = rtkMessageViewCss;
1985
+
1986
+ var __decorate$3 = (undefined && undefined.__decorate) || function (decorators, target, key, desc) {
1987
+ var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
1988
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function")
1989
+ r = Reflect.decorate(decorators, target, key, desc);
1990
+ else
1991
+ for (var i = decorators.length - 1; i >= 0; i--)
1992
+ if (d = decorators[i])
1993
+ r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
1994
+ return c > 3 && r && Object.defineProperty(target, key, r), r;
1995
+ };
1996
+ const RtkMessageView = class {
1997
+ constructor(hostRef) {
1998
+ registerInstance(this, hostRef);
1999
+ this.onAction = createEvent(this, "action", 7);
2000
+ /** List of actions to show in menu */
2001
+ this.actions = [];
2002
+ /** Appearance */
2003
+ this.variant = 'bubble';
2004
+ /** Render */
2005
+ this.viewType = 'outgoing';
2006
+ /** Hides avatar */
2007
+ this.hideAvatar = false;
2008
+ /** Is the message sent by the current user */
2009
+ this.isSelf = false;
2010
+ /** Hides author display label */
2011
+ this.hideAuthorName = false;
2012
+ /** Hides metadata (time) */
2013
+ this.hideMetadata = false;
2014
+ /** Icon pack */
2015
+ this.iconPack = defaultIconPack;
2016
+ }
2017
+ renderActions() {
2018
+ return (h("rtk-menu", { placement: "top-end", offset: 1 }, h("button", { slot: "trigger", class: "actions" }, h("rtk-icon", { icon: this.iconPack.chevron_down })), h("rtk-menu-list", null, this.actions.map((action) => (h("rtk-menu-item", { onClick: () => this.onAction.emit(action.id) }, action.icon && h("rtk-icon", { icon: action.icon, slot: "start" }), action.label))))));
2019
+ }
2020
+ render() {
2021
+ return (h(Host, { key: '61882011f477f816296277a4f2d5622d224e47f0' }, h("div", { key: 'ae21bfc0c499879da6a2167f0cad5203475de696', class: { 'message-wrapper': true, [this.viewType]: true } }, !this.hideAvatar && (h("aside", { key: '73b10ebb1dccdc4e2c9258f185eb14f07d11d542', class: "avatar", part: "avatar" }, h("rtk-avatar", { key: 'e07971bf9d7738fb2dcc015d339a13d5dca7c6f7', participant: { name: this.authorName, picture: this.avatarUrl }, size: "sm" }))), h("div", { key: '1e24801f717589e598c4160bea7ab10a59acfcc2', class: "message", part: "message" }, !this.hideAuthorName && (h("div", { key: '3178f750ad798b7d83508f82ead36ee5407fee4c', class: "header" }, this.authorName, " ", this.isSelf ? ' (You)' : '')), h("div", { key: '056445ef0c557d7d756330df5778ad8bc2d41e60', class: { body: true, bubble: this.variant === 'bubble' } }, h("slot", { key: '6d5486666ce2238e4387c2621d562b24704a9317' }), !this.hideMetadata && !!this.time && (h("div", { key: '1d4b9bdbb3aaf288dce4b43a31354df3d413b2b4', class: "metadata", title: formatDateTime(this.time) }, elapsedDuration(this.time, new Date(Date.now())))), this.actions.length !== 0 && this.renderActions())))));
2022
+ }
2023
+ };
2024
+ __decorate$3([
2025
+ SyncWithStore()
2026
+ ], RtkMessageView.prototype, "iconPack", void 0);
2027
+ RtkMessageView.style = RtkMessageViewStyle0;
2028
+
2029
+ const rtkPaginatedListCss = ".scrollbar{scrollbar-width:thin;scrollbar-color:var(--rtk-scrollbar-color, rgb(var(--rtk-colors-background-600, 60 60 60)))\n var(--rtk-scrollbar-background, transparent)}.scrollbar::-webkit-scrollbar{height:var(--rtk-space-1\\.5, 6px);width:var(--rtk-space-1\\.5, 6px);border-radius:9999px;background-color:var(--rtk-scrollbar-background, transparent)}.scrollbar::-webkit-scrollbar-thumb{border-radius:9999px;background-color:var(--rtk-scrollbar-color, rgb(var(--rtk-colors-background-600, 60 60 60)))}:host{position:relative;display:flex;flex-direction:column;flex:1}.container{box-sizing:border-box;display:flex;flex-direction:column-reverse;padding-top:var(--rtk-space-4, 16px);padding-bottom:var(--rtk-space-4, 16px);padding-left:var(--rtk-space-2, 8px);padding-right:var(--rtk-space-2, 8px);flex:1 0 0px;overflow-y:scroll}.file-picker{display:none}.chat *:first-child{margin-top:var(--rtk-space-0, 0px)}.chat .head{display:flex;align-items:center}.chat .head .name{margin-right:var(--rtk-space-4, 16px);font-size:12px;font-weight:700}.chat .head .time{font-size:12px;color:rgb(var(--rtk-colors-text-800, 255 255 255 / 0.76))}.chat .body{margin-top:var(--rtk-space-2, 8px);margin-bottom:var(--rtk-space-2, 8px);overflow-wrap:break-word;font-size:14px;line-height:1.375}.chat .body .emoji{font-size:24px}p{margin-top:var(--rtk-space-0, 0px);margin-bottom:var(--rtk-space-3, 12px)}rtk-text-message,rtk-image-message,rtk-file-message{margin-top:var(--rtk-space-4, 16px);display:block;padding-left:var(--rtk-space-3, 12px);padding-right:var(--rtk-space-3, 12px);font-family:var(--rtk-font-family, sans-serif);color:rgb(var(--rtk-colors-text-900, 255 255 255 / 0.88));box-sizing:border-box}*[is-continued]{margin-top:var(--rtk-space-3, 12px)}rtk-text-message[is-continued]{margin-top:var(--rtk-space-2, 8px)}.chat .image{position:relative;height:var(--rtk-space-40, 160px);max-width:var(--rtk-space-64, 256px);cursor:pointer}.chat .image img{display:none;height:100%;width:100%;border-radius:var(--rtk-border-radius-sm, 4px);-o-object-fit:cover;object-fit:cover}.chat .image .image-spinner{display:flex;height:100%;width:100%;flex-direction:column;align-items:center;justify-content:center;border-radius:var(--rtk-border-radius-sm, 4px);--tw-bg-opacity:1;background-color:rgba(var(--rtk-colors-background-800, 30 30 30) / var(--tw-bg-opacity))}.chat .image .image-spinner rtk-spinner{--tw-text-opacity:1;color:rgba(var(--rtk-colors-brand-500, 33 96 253) / var(--tw-text-opacity))}.chat .image .image-errored{display:flex;height:100%;width:100%;flex-direction:column;align-items:center;justify-content:center;border-radius:var(--rtk-border-radius-sm, 4px);background-color:rgba(var(--rtk-colors-danger, 255 45 45) / 0.1);--tw-text-opacity:1;color:rgba(var(--rtk-colors-danger, 255 45 45) / var(--tw-text-opacity))}.chat .image .actions{display:none;height:var(--rtk-space-8, 32px);align-items:center;position:absolute;top:var(--rtk-space-2, 8px);right:var(--rtk-space-2, 8px);border-radius:var(--rtk-border-radius-sm, 4px);--tw-bg-opacity:1;background-color:rgba(var(--rtk-colors-background-900, 26 26 26) / var(--tw-bg-opacity));color:rgb(var(--rtk-colors-text-1000, 255 255 255));overflow:hidden;--tw-shadow:0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -4px rgb(0 0 0 / 0.1);--tw-shadow-colored:0 10px 15px -3px var(--tw-shadow-color), 0 4px 6px -4px var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000), var(--tw-ring-shadow, 0 0 #0000), var(--tw-shadow)}.chat .image .actions .action{height:var(--rtk-space-8, 32px);width:var(--rtk-space-8, 32px);border-radius:var(--rtk-border-radius-none, 0);border-width:var(--rtk-border-width-none, 0);border-style:none;background-color:transparent;--tw-shadow:0 0 #0000;--tw-shadow-colored:0 0 #0000;box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000), var(--tw-ring-shadow, 0 0 #0000), var(--tw-shadow)}.chat .image .actions .action:hover{--tw-bg-opacity:1;background-color:rgba(var(--rtk-colors-background-600, 60 60 60) / var(--tw-bg-opacity))}.image.loaded img{display:block}.image.loaded .image-spinner{display:none}.image:hover .actions,.image:focus .actions{display:flex}.chat .file{display:flex;align-items:center;gap:var(--rtk-space-1, 4px);padding-left:var(--rtk-space-2, 8px);padding-right:var(--rtk-space-2, 8px);padding-top:var(--rtk-space-1\\.5, 6px);padding-bottom:var(--rtk-space-1\\.5, 6px);border-radius:var(--rtk-border-radius-sm, 4px);--tw-bg-opacity:1;background-color:rgba(var(--rtk-colors-background-700, 44 44 44) / var(--tw-bg-opacity));color:rgb(var(--rtk-colors-text-700, 255 255 255 / 0.64))}.chat .file .file-data{flex:1 1 0%}.chat .file .file-data .name{word-break:break-all;color:rgb(var(--rtk-colors-text-1000, 255 255 255));overflow:hidden;display:-webkit-box;-webkit-box-orient:vertical;-webkit-line-clamp:1}.chat .file .file-data .file-data-split{margin-top:var(--rtk-space-0\\.5, 2px);display:flex;align-items:center;font-size:12px}.chat .file .file-data .file-data-split .ext{margin-right:var(--rtk-space-2, 8px);text-transform:uppercase;overflow:hidden;display:-webkit-box;-webkit-box-orient:vertical;-webkit-line-clamp:1}.chat .file .file-data .file-data-split .divider{height:var(--rtk-space-4, 16px);width:var(--rtk-space-0\\.5, 2px);--tw-bg-opacity:1;background-color:rgba(var(--rtk-colors-background-600, 60 60 60) / var(--tw-bg-opacity))}.chat .file .file-data .file-data-split .size{margin-left:var(--rtk-space-2, 8px)}.smallest-dom-element{width:1px}#top-scroll{transform:translateY(20vh)}#bottom-scroll{transform:translateY(-20vh)}a{--tw-text-opacity:1;color:rgba(var(--rtk-colors-brand-300, 73 124 253) / var(--tw-text-opacity));text-decoration-line:none}a:hover{text-decoration-line:underline}.show-new-messages-ctr{pointer-events:none;position:absolute;bottom:var(--rtk-space-2, 8px);right:var(--rtk-space-4, 16px);z-index:10;margin-top:calc(var(--rtk-space-14, 56px) * -1);--tw-translate-y:var(--rtk-space-28, 112px);transform:translate(var(--tw-translate-x), var(--tw-translate-y)) rotate(var(--tw-rotate)) skewX(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y));opacity:0;transition-property:color, background-color, border-color, text-decoration-color, fill, stroke, opacity, box-shadow, transform, filter, -webkit-backdrop-filter;transition-property:color, background-color, border-color, text-decoration-color, fill, stroke, opacity, box-shadow, transform, filter, backdrop-filter;transition-property:color, background-color, border-color, text-decoration-color, fill, stroke, opacity, box-shadow, transform, filter, backdrop-filter, -webkit-backdrop-filter;transition-timing-function:cubic-bezier(0.4, 0, 0.2, 1);transition-duration:150ms}.show-new-messages-ctr.active{--tw-translate-y:var(--rtk-space-0, 0px);transform:translate(var(--tw-translate-x), var(--tw-translate-y)) rotate(var(--tw-rotate)) skewX(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y));opacity:1}.show-new-messages{pointer-events:auto;border-radius:9999px}.show-new-messages:hover{border-radius:9999px;--tw-ring-offset-shadow:var(--tw-ring-inset) 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color);--tw-ring-shadow:var(--tw-ring-inset) 0 0 0 calc(2px + var(--tw-ring-offset-width)) var(--tw-ring-color);box-shadow:var(--tw-ring-offset-shadow), var(--tw-ring-shadow), var(--tw-shadow, 0 0 #0000);--tw-ring-opacity:1;--tw-ring-color:rgba(var(--rtk-colors-background-600, 60 60 60) / var(--tw-ring-opacity));--tw-bg-opacity:1;background-color:rgba(var(--rtk-colors-background-600, 60 60 60) / var(--tw-bg-opacity))}rtk-spinner,.empty-list{margin:auto}.page-wrapper{margin-left:var(--rtk-space-1, 4px);margin-right:var(--rtk-space-1, 4px)}.message-wrapper{margin-bottom:var(--rtk-space-2, 8px)}.pinned .message-wrapper{position:relative}.pinned .pin-icon{position:absolute;right:calc(var(--rtk-space-1, 4px) * -1);top:calc(var(--rtk-space-1, 4px) * -1);display:flex;border-radius:var(--rtk-border-radius-sm, 4px)}.pinned rtk-message-view{--tw-bg-opacity:1;background-color:rgba(var(--rtk-colors-background-700, 44 44 44) / var(--tw-bg-opacity));padding-top:var(--rtk-space-1, 4px);padding-bottom:var(--rtk-space-1, 4px)}";
2030
+ const RtkPaginatedListStyle0 = rtkPaginatedListCss;
2031
+
2032
+ var __decorate$2 = (undefined && undefined.__decorate) || function (decorators, target, key, desc) {
2033
+ var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
2034
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function")
2035
+ r = Reflect.decorate(decorators, target, key, desc);
2036
+ else
2037
+ for (var i = decorators.length - 1; i >= 0; i--)
2038
+ if (d = decorators[i])
2039
+ r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
2040
+ return c > 3 && r && Object.defineProperty(target, key, r), r;
2041
+ };
2042
+ const RtkPaginatedList = class {
2043
+ constructor(hostRef) {
2044
+ registerInstance(this, hostRef);
2045
+ /** Icon pack */
2046
+ this.iconPack = defaultIconPack;
2047
+ /** Language */
2048
+ this.t = useLanguage();
2049
+ /** label to show when empty */
2050
+ this.emptyListLabel = null;
2051
+ this.isLoading = false;
2052
+ this.rerenderBoolean = false;
2053
+ /**
2054
+ * This gets disabled when the user scrolls up and the bottom node
2055
+ * is not visible anymore.
2056
+ */
2057
+ this.shouldRenderNewNodes = true;
2058
+ /**
2059
+ * This gets disabled when the user scrolls up and the bottom node
2060
+ * is not visible anymore.
2061
+ */
2062
+ this.hasNewNodesToRender = false;
2063
+ this.showEmptyListLabel = false;
2064
+ /**
2065
+ * This is a private variable not a state
2066
+ * since we want to debounce rerenders
2067
+ *
2068
+ * A list of pages where each page contains a number of Nodes
2069
+ * [
2070
+ * [Node 1, Node 2, Node 3.... Node N],
2071
+ * [Node 1, Node 2, Node 3.... Node N],
2072
+ * ]
2073
+ */
2074
+ this.pagesToRender = [[]];
2075
+ this.currentTime = () => {
2076
+ return new Date().getTime();
2077
+ };
2078
+ this.observe = (el) => {
2079
+ if (!el)
2080
+ return;
2081
+ this.intersectionObserver.observe(el);
2082
+ };
2083
+ }
2084
+ /**
2085
+ * On a new node created
2086
+ */
2087
+ async onNewNode(node) {
2088
+ if (!this.shouldRenderNewNodes) {
2089
+ this.hasNewNodesToRender = true;
2090
+ return;
2091
+ }
2092
+ this.addNodeToRender(node, false);
2093
+ this.rerender();
2094
+ }
2095
+ /**
2096
+ * On node deleted
2097
+ */
2098
+ async onNodeDelete(key) {
2099
+ const oldLength = this.pagesToRender.flat().length;
2100
+ this.pagesToRender = this.pagesToRender.map((page) => page.filter((item) => item.id !== key));
2101
+ if (oldLength !== this.pagesToRender.flat().length) {
2102
+ this.rerender();
2103
+ }
2104
+ }
2105
+ /**
2106
+ * On node updated
2107
+ */
2108
+ async onNodeUpdate(key, newItem) {
2109
+ let shouldRerender = false;
2110
+ this.pagesToRender = this.pagesToRender.map((page) => page.map((item) => {
2111
+ if (item.id === key) {
2112
+ shouldRerender = true;
2113
+ return newItem;
2114
+ }
2115
+ return item;
2116
+ }));
2117
+ if (shouldRerender)
2118
+ this.rerender();
2119
+ }
2120
+ onItemChanged(newItemId, oldItemId) {
2121
+ if (newItemId !== oldItemId) {
2122
+ this.pagesToRender = [[]];
2123
+ this.loadFirstPage().then(() => this.rerender());
2124
+ }
2125
+ }
2126
+ connectedCallback() {
2127
+ this.rerender = debounce(this.rerender.bind(this), 50, { maxWait: 200 });
2128
+ this.autoScroll = true;
2129
+ this.intersectionObserver = new IntersectionObserver((entries) => {
2130
+ writeTask(() => {
2131
+ for (const entry of entries) {
2132
+ if (entry.target.id === 'bottom-scroll') {
2133
+ if (entry.isIntersecting)
2134
+ this.loadBottom();
2135
+ else
2136
+ this.shouldRenderNewNodes = false;
2137
+ }
2138
+ if (entry.target.id === 'top-scroll' && entry.isIntersecting) {
2139
+ this.loadTop();
2140
+ }
2141
+ }
2142
+ });
2143
+ });
2144
+ }
2145
+ disconnectedCallback() {
2146
+ this.intersectionObserver.disconnect();
2147
+ }
2148
+ componentDidLoad() {
2149
+ /**
2150
+ * Adding observes here so that on the first render we scroll down
2151
+ * and shouldRenderNewNodes remains true
2152
+ */
2153
+ this.loadFirstPage();
2154
+ this.observe(this.$topRef);
2155
+ this.observe(this.$bottomRef);
2156
+ }
2157
+ componentDidRender() {
2158
+ if (this.shouldRenderNewNodes && this.autoScroll)
2159
+ smoothScrollToBottom(this.$paginatedList);
2160
+ }
2161
+ loadFirstPage() {
2162
+ return this.loadPage(this.currentTime(), this.pageSize, true, (data) => {
2163
+ if (data.length === 0) {
2164
+ this.showEmptyListLabel = true;
2165
+ }
2166
+ });
2167
+ }
2168
+ loadTop() {
2169
+ /**
2170
+ * If there is only one unfilled page or no page, no need to check
2171
+ * for top since it will be empty
2172
+ */
2173
+ if (this.pagesToRender.length === 0)
2174
+ return;
2175
+ if (this.pagesToRender.length === 1 && this.pagesToRender[0].length < this.pageSize)
2176
+ return;
2177
+ /**
2178
+ * TODO: Make this more flexible currently this only works with chat
2179
+ */
2180
+ const oldestVNode = this.pagesToRender[0][0];
2181
+ const oldestTimestamp = oldestVNode.timeMs;
2182
+ // TODO: scrollIntoView
2183
+ const onPageRendered = () => { }; // oldestVNode.$elm$?.scrollIntoView();
2184
+ this.loadPage(oldestTimestamp - 1, this.pageSize, true, onPageRendered);
2185
+ }
2186
+ loadBottom() {
2187
+ /**
2188
+ * If there is only one unfilled page or no page, no need to check
2189
+ * for top since it will be empty
2190
+ */
2191
+ if (this.pagesToRender.length === 0) {
2192
+ this.shouldRenderNewNodes = true;
2193
+ return;
2194
+ }
2195
+ if (this.pagesToRender.length === 1 && this.pagesToRender[0].length < this.pageSize) {
2196
+ this.shouldRenderNewNodes = true;
2197
+ return;
2198
+ }
2199
+ const newestVNode = this.pagesToRender.at(-1).at(-1);
2200
+ const newestTimestamp = newestVNode.timeMs;
2201
+ // TODO: scrollIntoView
2202
+ const onPageRendered = () => smoothScrollToBottom(this.$paginatedList);
2203
+ this.loadPage(newestTimestamp + 1, this.pageSize, false, onPageRendered);
2204
+ }
2205
+ addNodeToRender(node, addToStart) {
2206
+ if (addToStart) {
2207
+ const firstPage = this.pagesToRender[0];
2208
+ if (firstPage && (firstPage === null || firstPage === void 0 ? void 0 : firstPage.length) < this.pageSize) {
2209
+ /**
2210
+ * If first page is not full then just add to that page
2211
+ */
2212
+ firstPage.unshift(node);
2213
+ }
2214
+ else {
2215
+ /**
2216
+ * If first page is full then add a new page to the start
2217
+ */
2218
+ const newPage = [node];
2219
+ this.pagesToRender.unshift(newPage);
2220
+ this.removeLastPageIfNeeded(false);
2221
+ }
2222
+ }
2223
+ else {
2224
+ const [lastPage] = this.pagesToRender.slice(-1);
2225
+ if (lastPage && (lastPage === null || lastPage === void 0 ? void 0 : lastPage.length) < this.pageSize) {
2226
+ /**
2227
+ * If last page is not full then just add it
2228
+ */
2229
+ lastPage.push(node);
2230
+ }
2231
+ else {
2232
+ /**
2233
+ * If last page is full add a new page with just
2234
+ * this node
2235
+ */
2236
+ const newPage = [node];
2237
+ this.pagesToRender.push(newPage);
2238
+ this.removeLastPageIfNeeded(true);
2239
+ }
2240
+ }
2241
+ }
2242
+ /**
2243
+ * @param start
2244
+ * @param end
2245
+ * @param reversed Defines whether to add the page at the beginning or the end
2246
+ * @param onPageLoaded Callback for when all new nodes are rendered
2247
+ */
2248
+ async loadPage(timestamp, size, reversed, onPageRendered = () => { }) {
2249
+ this.isLoading = true;
2250
+ const data = (await this.fetchData(timestamp, size, reversed));
2251
+ this.isLoading = false;
2252
+ if (!(data === null || data === void 0 ? void 0 : data.length)) {
2253
+ /**
2254
+ * While scrolling down if there were no new items found
2255
+ * then start rendering new nodes;
2256
+ */
2257
+ if (!reversed) {
2258
+ this.hasNewNodesToRender = false;
2259
+ this.shouldRenderNewNodes = true;
2260
+ }
2261
+ onPageRendered([]);
2262
+ return;
2263
+ }
2264
+ data.forEach((node) => this.addNodeToRender(node, reversed));
2265
+ this.rerender();
2266
+ onPageRendered(data);
2267
+ }
2268
+ rerender() {
2269
+ this.rerenderBoolean = !this.rerenderBoolean;
2270
+ }
2271
+ removeLastPageIfNeeded(removeFromStart) {
2272
+ if (this.pagesToRender.length > this.pagesAllowed) {
2273
+ if (removeFromStart)
2274
+ this.pagesToRender.shift();
2275
+ else
2276
+ this.pagesToRender.pop();
2277
+ }
2278
+ }
2279
+ onDownArrowClicked() {
2280
+ /**
2281
+ * Load the freshest pages
2282
+ */
2283
+ this.loadBottom();
2284
+ }
2285
+ render() {
2286
+ var _a;
2287
+ /**
2288
+ * div.container is flex=column-reverse
2289
+ * which is why div#bottom-scroll comes before div#top-scroll
2290
+ * div.page-wrapper prevents reversal of messages
2291
+ */
2292
+ return (h(Host, { key: 'bb4971c301060a02d6a9ad536fb633c0c87519c4' }, h("div", { key: '92a9524264d790fff447aefb7cc20a9da6958687', class: "scrollbar container", part: "container", ref: (el) => (this.$paginatedList = el) }, h("div", { key: 'e64bd91ea1e869b9a1f5e861959ee78306c17bee', class: { 'show-new-messages-ctr': true, active: !this.shouldRenderNewNodes } }, h("rtk-button", { key: '2471e6614616aa33c9ecd5d0c1f47d09fa00b481', class: "show-new-messages", kind: "icon", variant: "secondary", part: "show-new-messages", onClick: () => this.onDownArrowClicked() }, h("rtk-icon", { key: 'ed0b255c69fbaeecc883c0492fd5b810b8d429b8', icon: this.iconPack.chevron_down }))), h("div", { key: '509aa620d47e853fd4e73d5b6c30433156b0f1da', class: "smallest-dom-element", id: "bottom-scroll", ref: (el) => (this.$bottomRef = el) }), this.isLoading && this.pagesToRender.flat().length === 0 && h("rtk-spinner", { key: '47e60a2fcb103200d763b9af257babfca5ee6e3c', size: "lg" }), this.pagesToRender.flat().length === 0 && this.showEmptyListLabel ? (h("div", { class: "empty-list" }, (_a = this.emptyListLabel) !== null && _a !== void 0 ? _a : this.t('list.empty'))) : (h("div", { class: "page-wrapper" }, this.pagesToRender.map((page) => this.createNodes(page)))), h("div", { key: '64ab66547b004130f9f3d0b0976c27c5aeeb720e', class: "smallest-dom-element", id: "top-scroll", ref: (el) => (this.$topRef = el) }))));
2293
+ }
2294
+ static get watchers() { return {
2295
+ "selectedItemId": ["onItemChanged"]
2296
+ }; }
2297
+ };
2298
+ __decorate$2([
2299
+ SyncWithStore()
2300
+ ], RtkPaginatedList.prototype, "iconPack", void 0);
2301
+ __decorate$2([
2302
+ SyncWithStore()
2303
+ ], RtkPaginatedList.prototype, "t", void 0);
2304
+ RtkPaginatedList.style = RtkPaginatedListStyle0;
2305
+
2306
+ const rtkSpinnerCss = ":host{line-height:initial;font-family:var(--rtk-font-family, sans-serif);font-feature-settings:normal;font-variation-settings:normal}p{margin:var(--rtk-space-0, 0px);padding:var(--rtk-space-0, 0px)}:host{box-sizing:border-box;display:block;height:var(--rtk-space-10, 40px);width:var(--rtk-space-10, 40px);--rtk-spinner-color:currentColor}.spinner{height:100%;width:100%}@keyframes spin{to{transform:rotate(360deg)}}.spinner{animation:spin 1s linear infinite;border-radius:9999px;background-color:transparent;animation-duration:1.3s}:host([size='md']){height:var(--rtk-space-6, 24px);width:var(--rtk-space-6, 24px)}:host([size='sm']){height:var(--rtk-space-4, 16px);width:var(--rtk-space-4, 16px)}";
2307
+ const RtkSpinnerStyle0 = rtkSpinnerCss;
2308
+
2309
+ var __decorate$1 = (undefined && undefined.__decorate) || function (decorators, target, key, desc) {
2310
+ var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
2311
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function")
2312
+ r = Reflect.decorate(decorators, target, key, desc);
2313
+ else
2314
+ for (var i = decorators.length - 1; i >= 0; i--)
2315
+ if (d = decorators[i])
2316
+ r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
2317
+ return c > 3 && r && Object.defineProperty(target, key, r), r;
2318
+ };
2319
+ const RtkSpinner = class {
2320
+ constructor(hostRef) {
2321
+ registerInstance(this, hostRef);
2322
+ /** Icon pack */
2323
+ this.iconPack = defaultIconPack;
2324
+ /** Size */
2325
+ this.size = 'md';
2326
+ }
2327
+ render() {
2328
+ return (h(Host, { key: '896d7e13900a390f5c03df4e2af45163d61f6d09' }, h("rtk-icon", { key: 'dd05bbbb3eb9db982d85db131b82c2bcaf253a94', class: "spinner", icon: this.iconPack.spinner })));
2329
+ }
2330
+ };
2331
+ __decorate$1([
2332
+ SyncWithStore()
2333
+ ], RtkSpinner.prototype, "iconPack", void 0);
2334
+ RtkSpinner.style = RtkSpinnerStyle0;
2335
+
2336
+ const rtkTextComposerViewCss = ".chat-input {\n position: relative;\n z-index: 10;\n box-sizing: border-box;\n display: flex;\n flex-direction: column;\n border-top-left-radius: var(--rtk-border-radius-md, 8px);\n border-top-right-radius: var(--rtk-border-radius-md, 8px)\n}\n\n .chat-input textarea {\n --tw-bg-opacity: 1;\n background-color: rgba(var(--rtk-colors-background-800, 30 30 30) / var(--tw-bg-opacity));\n box-sizing: border-box;\n padding: var(--rtk-space-3, 12px);\n color: rgb(var(--rtk-colors-text-1000, 255 255 255))\n}\n\n .chat-input textarea::-moz-placeholder {\n color: rgb(var(--rtk-colors-text-1000, 255 255 255))\n}\n\n .chat-input textarea::placeholder {\n color: rgb(var(--rtk-colors-text-1000, 255 255 255))\n}\n\n .chat-input textarea {\n font-family: var(--rtk-font-family, sans-serif);\n outline: 2px solid transparent;\n outline-offset: 2px;\n resize: none;\n overflow-y: auto;\n border-width: var(--rtk-border-width-none, 0);\n border-style: none;\n min-height: 60px;\n font-size: 14px\n}\n\n@container chatcontainer (height < 360px) {\n textarea {\n height: 30px !important;\n min-height: 30px !important\n }\n}\n\n.text-error {\n left: var(--rtk-space-0, 0px);\n z-index: 10;\n margin-top: var(--rtk-space-1, 4px);\n margin-left: var(--rtk-space-1, 4px);\n display: flex;\n width: -moz-fit-content;\n width: fit-content;\n align-items: center;\n justify-content: flex-start;\n border-radius: var(--rtk-border-radius-sm, 4px);\n --tw-border-opacity: 1;\n border-color: rgba(var(--rtk-colors-warning, 255 205 7) / var(--tw-border-opacity));\n --tw-bg-opacity: 1;\n background-color: rgba(var(--rtk-colors-background-600, 60 60 60) / var(--tw-bg-opacity));\n padding-left: var(--rtk-space-2, 8px);\n padding-right: var(--rtk-space-2, 8px);\n font-size: 12px;\n font-weight: 600;\n --tw-text-opacity: 1;\n color: rgba(var(--rtk-colors-warning, 255 205 7) / var(--tw-text-opacity));\n border: 1px solid\n}\n\n#warning-indicator {\n margin-right: var(--rtk-space-1, 4px);\n height: var(--rtk-space-3, 12px);\n width: var(--rtk-space-3, 12px)\n}\n\n.text-error.breached {\n --tw-border-opacity: 1;\n border-color: rgba(var(--rtk-colors-danger, 255 45 45) / var(--tw-border-opacity));\n --tw-text-opacity: 1;\n color: rgba(var(--rtk-colors-danger, 255 45 45) / var(--tw-text-opacity))\n}";
2337
+ const RtkTextComposerViewStyle0 = rtkTextComposerViewCss;
2338
+
2339
+ var __decorate = (undefined && undefined.__decorate) || function (decorators, target, key, desc) {
2340
+ var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
2341
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function")
2342
+ r = Reflect.decorate(decorators, target, key, desc);
2343
+ else
2344
+ for (var i = decorators.length - 1; i >= 0; i--)
2345
+ if (d = decorators[i])
2346
+ r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
2347
+ return c > 3 && r && Object.defineProperty(target, key, r), r;
2348
+ };
2349
+ const RtkTextComposerView = class {
2350
+ constructor(hostRef) {
2351
+ registerInstance(this, hostRef);
2352
+ this.onTextChange = createEvent(this, "textChange", 7);
2353
+ /** Disable the text input (default = false) */
2354
+ this.disabled = false;
2355
+ /** Boolean to indicate if rate limit is breached */
2356
+ this.rateLimitBreached = false;
2357
+ /** Keydown event handler function */
2358
+ this.keyDownHandler = () => { };
2359
+ /** Icon pack */
2360
+ this.iconPack = defaultIconPack;
2361
+ /** Language */
2362
+ this.t = useLanguage();
2363
+ this.maxLengthBreached = 0;
2364
+ this.onInputHandler = () => {
2365
+ const text = this.$textArea.value.trim();
2366
+ this.maybeResize(text);
2367
+ this.checkLength(text);
2368
+ this.onTextChange.emit(text);
2369
+ };
2370
+ this.maybeResize = (text) => {
2371
+ const newLines = [...text.matchAll(/\n/g)].length;
2372
+ this.$textArea.style.height = `${Math.min(200, 60 + 20 * newLines)}px`;
2373
+ };
2374
+ }
2375
+ componentDidLoad() {
2376
+ if (this.maxLength) {
2377
+ this.$textArea.maxLength = this.maxLength;
2378
+ }
2379
+ const text = this.$textArea.value.trim();
2380
+ if (text !== '') {
2381
+ this.maybeResize(text);
2382
+ }
2383
+ this.$textArea.focus();
2384
+ }
2385
+ /** Sets value of the text input */
2386
+ async setText(text, focus = false) {
2387
+ this.$textArea.value = text;
2388
+ this.maybeResize(text);
2389
+ if (focus) {
2390
+ this.$textArea.focus();
2391
+ }
2392
+ this.checkLength(text);
2393
+ this.onTextChange.emit(text);
2394
+ }
2395
+ checkLength(text) {
2396
+ // unicode code length
2397
+ const textLen = text.length;
2398
+ if (textLen + 10 >= this.maxLength) {
2399
+ this.maxLengthBreached = text.length;
2400
+ }
2401
+ else if (textLen + 10 < this.maxLength && this.maxLengthBreached > 0) {
2402
+ this.maxLengthBreached = 0;
2403
+ }
2404
+ }
2405
+ render() {
2406
+ return (h("div", { key: '16cc81323e6fb16e4d4a6622895ed7edc80f2db9', class: "chat-input", part: "chat-input-container" }, this.maxLengthBreached > 0 && (h("div", { key: '05fde7b4f3e084e464fcc3276f0ce1e0d909e6a7', class: 'text-error ' + (this.maxLengthBreached === this.maxLength ? 'breached' : '') }, h("rtk-icon", { key: 'd4101bf8933a9873605e88fbb617d8ae38bb56a1', id: "warning-indicator", icon: this.iconPack.warning, part: "warning-indicator" }), ' ', this.maxLengthBreached, " / ", this.maxLength, " ", this.t('chat.max_limit_warning'))), this.rateLimitBreached && (h("div", { key: '779a1c58114de2cce65a13ee3ea8cb308f7cd68a', class: 'text-error breached' }, h("rtk-icon", { key: '9dedd14d826b1437f434d92c985659ecc3bc1842', id: "warning-indicator", icon: this.iconPack.warning, part: "warning-indicator" }), ' ', this.t('chat.rate_limit_error'))), h("textarea", { key: 'f45f8f812ad668a86d2d0a22926bf437be44cbc9', ref: (el) => (this.$textArea = el), placeholder: this.placeholder, disabled: this.disabled, onInput: this.onInputHandler, onKeyDown: this.keyDownHandler, part: "chat-input", value: this.value })));
2407
+ }
2408
+ };
2409
+ __decorate([
2410
+ SyncWithStore()
2411
+ ], RtkTextComposerView.prototype, "iconPack", void 0);
2412
+ __decorate([
2413
+ SyncWithStore()
2414
+ ], RtkTextComposerView.prototype, "t", void 0);
2415
+ RtkTextComposerView.style = RtkTextComposerViewStyle0;
2416
+
2417
+ const rtkTextMessageViewCss = ":host{line-height:initial;font-family:var(--rtk-font-family, sans-serif);font-feature-settings:normal;font-variation-settings:normal}p{margin:var(--rtk-space-0, 0px);padding:var(--rtk-space-0, 0px)}.text{word-break:break-word;display:block;overflow-wrap:break-word;line-height:1.375}.text.emoji{font-size:24px}";
2418
+ const RtkTextMessageViewStyle0 = rtkTextMessageViewCss;
2419
+
2420
+ const RtkTextMessageView = class {
2421
+ constructor(hostRef) {
2422
+ registerInstance(this, hostRef);
2423
+ /** Renders text as markdown (default = true) */
2424
+ this.isMarkdown = false;
2425
+ }
2426
+ render() {
2427
+ return (h("p", { key: '3a9c21d67487ea40760163f0dd69152454049063', class: { text: true, emoji: hasOnlyEmojis(this.text) } }, this.isMarkdown ? h("rtk-markdown-view", { text: this.text }) : this.text));
2428
+ }
2429
+ };
2430
+ RtkTextMessageView.style = RtkTextMessageViewStyle0;
2431
+
2432
+ const rtkTooltipCss = ":host{line-height:initial;font-family:var(--rtk-font-family, sans-serif);font-feature-settings:normal;font-variation-settings:normal}p{margin:var(--rtk-space-0, 0px);padding:var(--rtk-space-0, 0px)}:host{--background-color:var(--rtk-tooltip-background-color, rgb(var(--rtk-colors-background-600, 60 60 60)));--color:var(--rtk-tooltip-color, rgb(var(--rtk-colors-text-1000, 255 255 255)));display:inline-flex}#trigger{display:block;width:100%;flex:1 1 0%}.tooltip{max-width:var(--rtk-space-64, 256px);position:fixed;z-index:20;display:none;width:-moz-max-content;width:max-content;padding-left:var(--rtk-space-2, 8px);padding-right:var(--rtk-space-2, 8px);padding-top:var(--rtk-space-1, 4px);padding-bottom:var(--rtk-space-1, 4px);border-radius:var(--rtk-border-radius-sm, 4px);--tw-shadow:0 1px 2px 0 rgb(0 0 0 / 0.05);--tw-shadow-colored:0 1px 2px 0 var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000), var(--tw-ring-shadow, 0 0 #0000), var(--tw-shadow);font-size:12px}.tooltip,#arrow{position:absolute;background-color:var(--background-color);color:var(--color)}#arrow{position:absolute;height:var(--rtk-space-2, 8px);width:var(--rtk-space-2, 8px);transform:rotate(45deg)}:host([variant='primary']){--background-color:rgb(var(--rtk-colors-brand-500, 33 96 253));--color:rgb(var(--rtk-colors-text-on-brand-1000, var(--rtk-colors-text-1000, 255 255 255)))}:host([kind='block']){display:block}";
2433
+ const RtkTooltipStyle0 = rtkTooltipCss;
2434
+
2435
+ const RtkMenu = class {
2436
+ constructor(hostRef) {
2437
+ registerInstance(this, hostRef);
2438
+ this.openChange = createEvent(this, "rtkOpenChange", 7);
2439
+ /** Tooltip label */
2440
+ this.label = '';
2441
+ /** Tooltip variant */
2442
+ this.variant = 'secondary';
2443
+ /** Disabled */
2444
+ this.disabled = false;
2445
+ /** Open */
2446
+ this.open = false;
2447
+ /** Tooltip kind */
2448
+ this.kind = 'inline';
2449
+ /** Placement of menu */
2450
+ this.placement = 'top';
2451
+ /** Delay before showing the tooltip */
2452
+ this.delay = 0;
2453
+ this.isInFocus = false;
2454
+ this.showMenu = () => {
2455
+ if (this.disabled)
2456
+ return;
2457
+ this.isInFocus = true;
2458
+ setTimeout(() => {
2459
+ if (this.isInFocus) {
2460
+ this.tooltipEl.style.display = 'block';
2461
+ this.update();
2462
+ this.openChange.emit(true);
2463
+ if (this.size === 'sm') {
2464
+ setTimeout(() => {
2465
+ if (this.isInFocus) {
2466
+ this.hideMenu();
2467
+ }
2468
+ }, 1000);
2469
+ }
2470
+ }
2471
+ }, this.delay);
2472
+ };
2473
+ this.hideMenu = () => {
2474
+ if (this.open || this.disabled)
2475
+ return;
2476
+ this.isInFocus = false;
2477
+ this.tooltipEl.style.display = 'none';
2478
+ this.openChange.emit(false);
2479
+ };
2480
+ }
2481
+ componentDidLoad() {
2482
+ this.triggerEl.addEventListener('focusin', this.showMenu);
2483
+ this.triggerEl.addEventListener('mouseenter', this.showMenu);
2484
+ this.triggerEl.addEventListener('focusout', this.hideMenu);
2485
+ this.triggerEl.addEventListener('mouseleave', this.hideMenu);
2486
+ writeTask(() => {
2487
+ this.openChanged(this.open);
2488
+ });
2489
+ }
2490
+ disconnectedCallback() {
2491
+ if (!this.triggerEl)
2492
+ return;
2493
+ this.triggerEl.removeEventListener('focusin', this.showMenu);
2494
+ this.triggerEl.removeEventListener('mouseenter', this.showMenu);
2495
+ this.triggerEl.removeEventListener('focusout', this.hideMenu);
2496
+ this.triggerEl.removeEventListener('mouseleave', this.hideMenu);
2497
+ this.triggerEl = undefined;
2498
+ }
2499
+ openChanged(open) {
2500
+ if (open) {
2501
+ this.showMenu();
2502
+ }
2503
+ else {
2504
+ this.hideMenu();
2505
+ }
2506
+ }
2507
+ update() {
2508
+ computePosition(this.triggerEl, this.tooltipEl, {
2509
+ placement: this.placement,
2510
+ middleware: [offset(8), flip(), shift({ padding: 5 }), arrow({ element: this.arrowEl })],
2511
+ }).then(({ x, y, placement, middlewareData }) => {
2512
+ Object.assign(this.tooltipEl.style, {
2513
+ left: `${x}px`,
2514
+ top: `${y}px`,
2515
+ });
2516
+ const { x: arrowX, y: arrowY } = middlewareData.arrow;
2517
+ const staticSide = {
2518
+ top: 'bottom',
2519
+ right: 'left',
2520
+ bottom: 'top',
2521
+ left: 'right',
2522
+ }[placement.split('-')[0]];
2523
+ Object.assign(this.arrowEl.style, {
2524
+ left: arrowX != null ? `${arrowX}px` : '',
2525
+ top: arrowY != null ? `${arrowY}px` : '',
2526
+ right: '',
2527
+ bottom: '',
2528
+ [staticSide]: '-4px',
2529
+ });
2530
+ });
2531
+ }
2532
+ render() {
2533
+ return (h(Host, { key: 'cee2142cb6afa3e002b614bd3dd18b710b749ac1' }, h("span", { key: '4ba5b4777592afc8eb0ae14b50e5ebbfbb43bd1f', part: "trigger", id: "trigger", ref: (el) => (this.triggerEl = el) }, h("slot", { key: 'fa1ecc3998424e21444324bf4b5c90d6891ab03f' })), h("div", { key: '39306bb13f784942525e0b8b203406512253be3d', part: "tooltip", class: "tooltip", id: "tooltip", role: "tooltip", ref: (el) => (this.tooltipEl = el) }, h("div", { key: 'd5bd2ca0781605c1ffe4cbeb1ade65430aed6691', id: "arrow", ref: (el) => (this.arrowEl = el), part: "arrow" }), this.label, h("slot", { key: 'c80c860e2c9cdcbe3c0e0ec97b8f4cd9c99abb78', name: "tooltip" }))));
2534
+ }
2535
+ static get watchers() { return {
2536
+ "open": ["openChanged"]
2537
+ }; }
2538
+ };
2539
+ RtkMenu.style = RtkTooltipStyle0;
2540
+
2541
+ export { RtkAvatar as rtk_avatar, RtkButton as rtk_button, RtkChannelSelectorView as rtk_channel_selector_view, RtkChat as rtk_chat, RtkChatComposerView as rtk_chat_composer_view, RtkChatMessagesUiPaginated as rtk_chat_messages_ui_paginated, RtkDraftAttachmentView as rtk_draft_attachment_view, RtkEmojiPicker as rtk_emoji_picker, RtkEmojiPickerButton as rtk_emoji_picker_button, RtkFileMessageView as rtk_file_message_view, RtkFilePickerButton as rtk_file_picker_button, RtkIcon as rtk_icon, RtkImageMessageView as rtk_image_message_view, RtkMarkdownView as rtk_markdown_view, RtkMeeting as rtk_meeting, RtkMenu$1 as rtk_menu, RtkMenuItem as rtk_menu_item, RtkMenuList as rtk_menu_list, RtkMessageView as rtk_message_view, RtkPaginatedList as rtk_paginated_list, RtkSpinner as rtk_spinner, RtkTextComposerView as rtk_text_composer_view, RtkTextMessageView as rtk_text_message_view, RtkMenu as rtk_tooltip };