@mieweb/ui 0.10.0-dev.3 → 0.10.0-dev.31

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/README.md +4 -4
  2. package/agent/mieweb-ui.instructions.md +90 -1
  3. package/dist/CsvBlock-FX5YNGNE.cjs +17 -0
  4. package/dist/{CsvBlock-ROJCKJDP.cjs.map → CsvBlock-FX5YNGNE.cjs.map} +1 -1
  5. package/dist/CsvBlock-VLMG7GUO.js +8 -0
  6. package/dist/{CsvBlock-UWPMTLE2.js.map → CsvBlock-VLMG7GUO.js.map} +1 -1
  7. package/dist/HtmlPreviewBlock-5JE7L3GR.js +8 -0
  8. package/dist/{HtmlPreviewBlock-ME5U3XNS.js.map → HtmlPreviewBlock-5JE7L3GR.js.map} +1 -1
  9. package/dist/HtmlPreviewBlock-UO37JQ3K.cjs +17 -0
  10. package/dist/{HtmlPreviewBlock-DWFN6EUB.cjs.map → HtmlPreviewBlock-UO37JQ3K.cjs.map} +1 -1
  11. package/dist/Input-yN516s5_.d.cts +3 -0
  12. package/dist/Input-yN516s5_.d.ts +3 -0
  13. package/dist/MermaidBlock-3XHFBAMV.js +8 -0
  14. package/dist/{MermaidBlock-2B6CPD6Y.js.map → MermaidBlock-3XHFBAMV.js.map} +1 -1
  15. package/dist/MermaidBlock-RZ75RPZA.cjs +17 -0
  16. package/dist/{MermaidBlock-D2UC5M55.cjs.map → MermaidBlock-RZ75RPZA.cjs.map} +1 -1
  17. package/dist/SurveyBlock-MUVJ3JUI.js +8 -0
  18. package/dist/{SurveyBlock-4DO62RBT.js.map → SurveyBlock-MUVJ3JUI.js.map} +1 -1
  19. package/dist/SurveyBlock-VH47YXZC.cjs +17 -0
  20. package/dist/{SurveyBlock-4CD4AYMJ.cjs.map → SurveyBlock-VH47YXZC.cjs.map} +1 -1
  21. package/dist/ag-grid.d.cts +142 -1
  22. package/dist/ag-grid.d.ts +142 -1
  23. package/dist/brands/bluehive.cjs +3 -3
  24. package/dist/brands/bluehive.css +3 -0
  25. package/dist/brands/bluehive.js +1 -1
  26. package/dist/brands/index.cjs +14 -14
  27. package/dist/brands/index.js +4 -4
  28. package/dist/{chunk-JYZW2PZS.cjs → chunk-254QK722.cjs} +7 -7
  29. package/dist/chunk-254QK722.cjs.map +1 -0
  30. package/dist/{chunk-VKELAMAZ.js → chunk-2JICT4A2.js} +27 -11
  31. package/dist/chunk-2JICT4A2.js.map +1 -0
  32. package/dist/{chunk-VPWJCJCX.cjs → chunk-35Y4ILCU.cjs} +7 -7
  33. package/dist/{chunk-VPWJCJCX.cjs.map → chunk-35Y4ILCU.cjs.map} +1 -1
  34. package/dist/{chunk-G3JX3UAU.cjs → chunk-3KPDQG5O.cjs} +5 -5
  35. package/dist/{chunk-G3JX3UAU.cjs.map → chunk-3KPDQG5O.cjs.map} +1 -1
  36. package/dist/{chunk-Y5HFM7LO.js → chunk-3RXZWHCU.js} +4 -4
  37. package/dist/{chunk-Y5HFM7LO.js.map → chunk-3RXZWHCU.js.map} +1 -1
  38. package/dist/chunk-3YBS4WUQ.js +52 -0
  39. package/dist/chunk-3YBS4WUQ.js.map +1 -0
  40. package/dist/{chunk-WNJRS7Y7.cjs → chunk-3ZWCIPFT.cjs} +4 -2
  41. package/dist/chunk-3ZWCIPFT.cjs.map +1 -0
  42. package/dist/chunk-4HC2IBOX.js +258 -0
  43. package/dist/chunk-4HC2IBOX.js.map +1 -0
  44. package/dist/chunk-4IS3QCOQ.cjs +453 -0
  45. package/dist/chunk-4IS3QCOQ.cjs.map +1 -0
  46. package/dist/chunk-4NCDU5IG.cjs +56 -0
  47. package/dist/chunk-4NCDU5IG.cjs.map +1 -0
  48. package/dist/{chunk-E4IBHYJ7.cjs → chunk-6N6LIAUJ.cjs} +9 -9
  49. package/dist/{chunk-E4IBHYJ7.cjs.map → chunk-6N6LIAUJ.cjs.map} +1 -1
  50. package/dist/{chunk-3M7TAXNR.js → chunk-6ZPTZTKN.js} +3 -3
  51. package/dist/{chunk-3M7TAXNR.js.map → chunk-6ZPTZTKN.js.map} +1 -1
  52. package/dist/{chunk-MWVW4APN.cjs → chunk-7UTBDFFL.cjs} +4 -4
  53. package/dist/{chunk-MWVW4APN.cjs.map → chunk-7UTBDFFL.cjs.map} +1 -1
  54. package/dist/{chunk-FJ7YPVKV.js → chunk-7X6R3JIA.js} +3 -3
  55. package/dist/{chunk-FJ7YPVKV.js.map → chunk-7X6R3JIA.js.map} +1 -1
  56. package/dist/{chunk-GOALNQZ2.js → chunk-7YO7DNUV.js} +4 -83
  57. package/dist/chunk-7YO7DNUV.js.map +1 -0
  58. package/dist/{chunk-P2CA3XGI.js → chunk-7ZV67VZE.js} +4 -4
  59. package/dist/{chunk-P2CA3XGI.js.map → chunk-7ZV67VZE.js.map} +1 -1
  60. package/dist/chunk-ADW7ZYCY.cjs +2707 -0
  61. package/dist/chunk-ADW7ZYCY.cjs.map +1 -0
  62. package/dist/{chunk-2G75X6TS.cjs → chunk-AHHFFXJR.cjs} +3 -3
  63. package/dist/{chunk-2G75X6TS.cjs.map → chunk-AHHFFXJR.cjs.map} +1 -1
  64. package/dist/{chunk-VILW53UZ.js → chunk-BIQ7GSO2.js} +3 -3
  65. package/dist/{chunk-VILW53UZ.js.map → chunk-BIQ7GSO2.js.map} +1 -1
  66. package/dist/chunk-BM35CACB.js +148 -0
  67. package/dist/chunk-BM35CACB.js.map +1 -0
  68. package/dist/chunk-BNH4SXJB.js +874 -0
  69. package/dist/chunk-BNH4SXJB.js.map +1 -0
  70. package/dist/{chunk-XEAT7XJG.cjs → chunk-BUT6MF5K.cjs} +29 -13
  71. package/dist/chunk-BUT6MF5K.cjs.map +1 -0
  72. package/dist/{chunk-UAMXCMST.cjs → chunk-CFI3TQMA.cjs} +3 -3
  73. package/dist/{chunk-UAMXCMST.cjs.map → chunk-CFI3TQMA.cjs.map} +1 -1
  74. package/dist/{chunk-J5CSLNCN.cjs → chunk-COM7RNZU.cjs} +2 -2
  75. package/dist/{chunk-J5CSLNCN.cjs.map → chunk-COM7RNZU.cjs.map} +1 -1
  76. package/dist/{chunk-XI34EGK5.cjs → chunk-CPPUT74P.cjs} +9 -9
  77. package/dist/{chunk-XI34EGK5.cjs.map → chunk-CPPUT74P.cjs.map} +1 -1
  78. package/dist/{chunk-ACCAXVOG.js → chunk-CRS2CQWM.js} +134 -56
  79. package/dist/chunk-CRS2CQWM.js.map +1 -0
  80. package/dist/{chunk-OE5CKRUC.js → chunk-D22GE27K.js} +4 -4
  81. package/dist/{chunk-OE5CKRUC.js.map → chunk-D22GE27K.js.map} +1 -1
  82. package/dist/chunk-DXEPYK3I.cjs +92 -0
  83. package/dist/chunk-DXEPYK3I.cjs.map +1 -0
  84. package/dist/{chunk-ZGRCSNPK.js → chunk-E2PBPQGS.js} +4 -4
  85. package/dist/{chunk-ZGRCSNPK.js.map → chunk-E2PBPQGS.js.map} +1 -1
  86. package/dist/{chunk-5JJ2DAE4.js → chunk-ENMXHZNE.js} +3 -3
  87. package/dist/{chunk-5JJ2DAE4.js.map → chunk-ENMXHZNE.js.map} +1 -1
  88. package/dist/{chunk-XCP454Q6.js → chunk-F4N67NAF.js} +12 -3
  89. package/dist/chunk-F4N67NAF.js.map +1 -0
  90. package/dist/chunk-FBCDYTWM.js +385 -0
  91. package/dist/chunk-FBCDYTWM.js.map +1 -0
  92. package/dist/{chunk-VU6UTJRM.js → chunk-FIKO4WR6.js} +3 -3
  93. package/dist/{chunk-VU6UTJRM.js.map → chunk-FIKO4WR6.js.map} +1 -1
  94. package/dist/{chunk-DEDN5HAG.js → chunk-FZURBQJ2.js} +3 -3
  95. package/dist/{chunk-DEDN5HAG.js.map → chunk-FZURBQJ2.js.map} +1 -1
  96. package/dist/{chunk-JHULS3EC.js → chunk-GBUVIGD5.js} +89 -3
  97. package/dist/chunk-GBUVIGD5.js.map +1 -0
  98. package/dist/chunk-GU5OS7JJ.cjs +281 -0
  99. package/dist/chunk-GU5OS7JJ.cjs.map +1 -0
  100. package/dist/{chunk-V7D3YGUV.js → chunk-GVLNXPJX.js} +4 -4
  101. package/dist/{chunk-V7D3YGUV.js.map → chunk-GVLNXPJX.js.map} +1 -1
  102. package/dist/chunk-GVM6DTR5.js +90 -0
  103. package/dist/chunk-GVM6DTR5.js.map +1 -0
  104. package/dist/{chunk-SQHMGT4W.js → chunk-GW4RFJZ5.js} +7 -7
  105. package/dist/chunk-GW4RFJZ5.js.map +1 -0
  106. package/dist/{chunk-3QEVGSFG.cjs → chunk-GYXUS65N.cjs} +5 -5
  107. package/dist/{chunk-3QEVGSFG.cjs.map → chunk-GYXUS65N.cjs.map} +1 -1
  108. package/dist/{chunk-WGPLUCBD.js → chunk-H2IAMSHK.js} +3 -3
  109. package/dist/{chunk-WGPLUCBD.js.map → chunk-H2IAMSHK.js.map} +1 -1
  110. package/dist/{chunk-JID7AZTO.cjs → chunk-H3ROMJYI.cjs} +4 -4
  111. package/dist/{chunk-JID7AZTO.cjs.map → chunk-H3ROMJYI.cjs.map} +1 -1
  112. package/dist/{chunk-GD7EBGC4.cjs → chunk-HC3NAN55.cjs} +19 -19
  113. package/dist/{chunk-GD7EBGC4.cjs.map → chunk-HC3NAN55.cjs.map} +1 -1
  114. package/dist/{chunk-7ZXAQTV4.cjs → chunk-HIZWOAWY.cjs} +8 -8
  115. package/dist/{chunk-7ZXAQTV4.cjs.map → chunk-HIZWOAWY.cjs.map} +1 -1
  116. package/dist/{chunk-NV2CWBI2.cjs → chunk-IEY3ZJIT.cjs} +12 -3
  117. package/dist/chunk-IEY3ZJIT.cjs.map +1 -0
  118. package/dist/chunk-IT775BYG.js +179 -0
  119. package/dist/chunk-IT775BYG.js.map +1 -0
  120. package/dist/chunk-IYWG72DM.js +166 -0
  121. package/dist/chunk-IYWG72DM.js.map +1 -0
  122. package/dist/{chunk-2YCERQWC.js → chunk-JBIGSP2T.js} +6 -6
  123. package/dist/{chunk-2YCERQWC.js.map → chunk-JBIGSP2T.js.map} +1 -1
  124. package/dist/{chunk-IX6KFB3K.cjs → chunk-JELTRRR5.cjs} +9 -9
  125. package/dist/{chunk-IX6KFB3K.cjs.map → chunk-JELTRRR5.cjs.map} +1 -1
  126. package/dist/{chunk-YQDA366U.js → chunk-JHG3ELS2.js} +2 -2
  127. package/dist/{chunk-YQDA366U.js.map → chunk-JHG3ELS2.js.map} +1 -1
  128. package/dist/{chunk-WWJIW2IH.cjs → chunk-JSXIB6EJ.cjs} +4 -4
  129. package/dist/{chunk-WWJIW2IH.cjs.map → chunk-JSXIB6EJ.cjs.map} +1 -1
  130. package/dist/{chunk-WNM7IZJ7.js → chunk-K34DXMLZ.js} +7 -7
  131. package/dist/{chunk-WNM7IZJ7.js.map → chunk-K34DXMLZ.js.map} +1 -1
  132. package/dist/{chunk-FXO5ARBB.cjs → chunk-KDW6BD4O.cjs} +4 -4
  133. package/dist/{chunk-FXO5ARBB.cjs.map → chunk-KDW6BD4O.cjs.map} +1 -1
  134. package/dist/{chunk-Z5V7SAZ4.js → chunk-KFEN2SRZ.js} +3 -3
  135. package/dist/{chunk-Z5V7SAZ4.js.map → chunk-KFEN2SRZ.js.map} +1 -1
  136. package/dist/{chunk-2QKBTPUC.cjs → chunk-KGKBZN3T.cjs} +8 -8
  137. package/dist/{chunk-2QKBTPUC.cjs.map → chunk-KGKBZN3T.cjs.map} +1 -1
  138. package/dist/{chunk-UV2FVNWT.cjs → chunk-LFPJ3OUM.cjs} +5 -5
  139. package/dist/{chunk-UV2FVNWT.cjs.map → chunk-LFPJ3OUM.cjs.map} +1 -1
  140. package/dist/{chunk-WNAA6CLE.cjs → chunk-LHBWRMNC.cjs} +94 -2
  141. package/dist/chunk-LHBWRMNC.cjs.map +1 -0
  142. package/dist/{chunk-JI244Y7C.js → chunk-MLAWXPRY.js} +190 -5
  143. package/dist/chunk-MLAWXPRY.js.map +1 -0
  144. package/dist/chunk-N7C4OEP7.cjs +356 -0
  145. package/dist/chunk-N7C4OEP7.cjs.map +1 -0
  146. package/dist/{chunk-WNZAYBVB.cjs → chunk-NKV76R65.cjs} +48 -48
  147. package/dist/{chunk-WNZAYBVB.cjs.map → chunk-NKV76R65.cjs.map} +1 -1
  148. package/dist/{chunk-PYJDVWXM.js → chunk-NUB5HRKS.js} +3 -3
  149. package/dist/{chunk-PYJDVWXM.js.map → chunk-NUB5HRKS.js.map} +1 -1
  150. package/dist/{chunk-LL6IWKI3.js → chunk-OW3SQJ7P.js} +3 -3
  151. package/dist/{chunk-LL6IWKI3.js.map → chunk-OW3SQJ7P.js.map} +1 -1
  152. package/dist/{chunk-5GUOOLPR.cjs → chunk-P5CMZZRZ.cjs} +5 -5
  153. package/dist/{chunk-5GUOOLPR.cjs.map → chunk-P5CMZZRZ.cjs.map} +1 -1
  154. package/dist/{chunk-3T7QGLNB.js → chunk-PJEL5ZZV.js} +4 -2
  155. package/dist/chunk-PJEL5ZZV.js.map +1 -0
  156. package/dist/{chunk-H4ZXMQQW.js → chunk-QOVJ6Z6R.js} +3 -3
  157. package/dist/{chunk-H4ZXMQQW.js.map → chunk-QOVJ6Z6R.js.map} +1 -1
  158. package/dist/{chunk-U42F3HLE.cjs → chunk-QURJVPRH.cjs} +190 -5
  159. package/dist/chunk-QURJVPRH.cjs.map +1 -0
  160. package/dist/{chunk-X4XPNTCZ.cjs → chunk-R5Z7AOVU.cjs} +136 -58
  161. package/dist/chunk-R5Z7AOVU.cjs.map +1 -0
  162. package/dist/{chunk-TMMVIUUN.js → chunk-R6KPWIGO.js} +4 -4
  163. package/dist/{chunk-TMMVIUUN.js.map → chunk-R6KPWIGO.js.map} +1 -1
  164. package/dist/{chunk-22CYDCXA.js → chunk-RM2HPQIC.js} +105 -14
  165. package/dist/chunk-RM2HPQIC.js.map +1 -0
  166. package/dist/{chunk-ENKFJJZX.js → chunk-SD7ONW6S.js} +6 -6
  167. package/dist/{chunk-ENKFJJZX.js.map → chunk-SD7ONW6S.js.map} +1 -1
  168. package/dist/{chunk-RJ6NTJHC.js → chunk-SRMTRD7F.js} +3 -3
  169. package/dist/{chunk-RJ6NTJHC.js.map → chunk-SRMTRD7F.js.map} +1 -1
  170. package/dist/chunk-T4JYUICS.js +2657 -0
  171. package/dist/chunk-T4JYUICS.js.map +1 -0
  172. package/dist/{chunk-7ZDPD5ZX.cjs → chunk-T4L7Q5FA.cjs} +7 -7
  173. package/dist/{chunk-7ZDPD5ZX.cjs.map → chunk-T4L7Q5FA.cjs.map} +1 -1
  174. package/dist/{chunk-NJ6MY6V5.js → chunk-T5BBZQ66.js} +3 -3
  175. package/dist/{chunk-NJ6MY6V5.js.map → chunk-T5BBZQ66.js.map} +1 -1
  176. package/dist/{chunk-2IZLKPUW.js → chunk-THLIL6PY.js} +3 -3
  177. package/dist/{chunk-2IZLKPUW.js.map → chunk-THLIL6PY.js.map} +1 -1
  178. package/dist/{chunk-SGFYA22I.cjs → chunk-TJCX4OML.cjs} +8 -8
  179. package/dist/{chunk-SGFYA22I.cjs.map → chunk-TJCX4OML.cjs.map} +1 -1
  180. package/dist/{chunk-N6IY47YA.cjs → chunk-TTSSUOEV.cjs} +8 -8
  181. package/dist/{chunk-N6IY47YA.cjs.map → chunk-TTSSUOEV.cjs.map} +1 -1
  182. package/dist/{chunk-5MCBWTIF.cjs → chunk-TYE5K5WV.cjs} +4 -4
  183. package/dist/{chunk-5MCBWTIF.cjs.map → chunk-TYE5K5WV.cjs.map} +1 -1
  184. package/dist/{chunk-VOKVG3ER.js → chunk-UBSH27C2.js} +4 -4
  185. package/dist/{chunk-VOKVG3ER.js.map → chunk-UBSH27C2.js.map} +1 -1
  186. package/dist/{chunk-TAXD5ADA.cjs → chunk-UEDTZYGI.cjs} +3 -3
  187. package/dist/{chunk-TAXD5ADA.cjs.map → chunk-UEDTZYGI.cjs.map} +1 -1
  188. package/dist/{chunk-UQ3VVR6A.cjs → chunk-UPWIJC6I.cjs} +3 -3
  189. package/dist/{chunk-UQ3VVR6A.cjs.map → chunk-UPWIJC6I.cjs.map} +1 -1
  190. package/dist/{chunk-S7WCHDBO.js → chunk-VCI2Y7ST.js} +3 -3
  191. package/dist/{chunk-S7WCHDBO.js.map → chunk-VCI2Y7ST.js.map} +1 -1
  192. package/dist/chunk-VINZZQBD.cjs +323 -0
  193. package/dist/chunk-VINZZQBD.cjs.map +1 -0
  194. package/dist/{chunk-OD47TTAW.cjs → chunk-VOQJHSXN.cjs} +9 -9
  195. package/dist/{chunk-OD47TTAW.cjs.map → chunk-VOQJHSXN.cjs.map} +1 -1
  196. package/dist/chunk-VPTASZ2O.cjs +171 -0
  197. package/dist/chunk-VPTASZ2O.cjs.map +1 -0
  198. package/dist/chunk-WXFGHDTV.cjs +896 -0
  199. package/dist/chunk-WXFGHDTV.cjs.map +1 -0
  200. package/dist/{chunk-VNYW4C4J.cjs → chunk-X6A27RGO.cjs} +4 -84
  201. package/dist/chunk-X6A27RGO.cjs.map +1 -0
  202. package/dist/chunk-XBTKZCZF.js +333 -0
  203. package/dist/chunk-XBTKZCZF.js.map +1 -0
  204. package/dist/chunk-XDIMTPZU.cjs +202 -0
  205. package/dist/chunk-XDIMTPZU.cjs.map +1 -0
  206. package/dist/chunk-XDU65GLW.js +21 -0
  207. package/dist/chunk-XDU65GLW.js.map +1 -0
  208. package/dist/chunk-XI74P5F2.cjs +424 -0
  209. package/dist/chunk-XI74P5F2.cjs.map +1 -0
  210. package/dist/{chunk-WIAQQNFU.cjs → chunk-XRVMYT5G.cjs} +106 -13
  211. package/dist/chunk-XRVMYT5G.cjs.map +1 -0
  212. package/dist/chunk-XVW5DPPP.js +429 -0
  213. package/dist/chunk-XVW5DPPP.js.map +1 -0
  214. package/dist/chunk-Y4E2WRUR.cjs +188 -0
  215. package/dist/chunk-Y4E2WRUR.cjs.map +1 -0
  216. package/dist/chunk-Y4QNLW7W.js +300 -0
  217. package/dist/chunk-Y4QNLW7W.js.map +1 -0
  218. package/dist/{chunk-6EN3IQQI.cjs → chunk-YRHBSSQ3.cjs} +6 -6
  219. package/dist/{chunk-6EN3IQQI.cjs.map → chunk-YRHBSSQ3.cjs.map} +1 -1
  220. package/dist/{chunk-KZFBQ7GY.js → chunk-YU55JD35.js} +3 -3
  221. package/dist/{chunk-KZFBQ7GY.js.map → chunk-YU55JD35.js.map} +1 -1
  222. package/dist/chunk-YW2AKBLS.cjs +23 -0
  223. package/dist/chunk-YW2AKBLS.cjs.map +1 -0
  224. package/dist/{chunk-ELPW32ZI.cjs → chunk-ZTMYKAVU.cjs} +45 -45
  225. package/dist/{chunk-ELPW32ZI.cjs.map → chunk-ZTMYKAVU.cjs.map} +1 -1
  226. package/dist/{chunk-3QGS6CXD.js → chunk-ZYL4SNOR.js} +3 -3
  227. package/dist/{chunk-3QGS6CXD.js.map → chunk-ZYL4SNOR.js.map} +1 -1
  228. package/dist/components/Alert/index.d.cts +1 -1
  229. package/dist/components/Alert/index.d.ts +1 -1
  230. package/dist/components/AlertDialog/index.cjs +6 -5
  231. package/dist/components/AlertDialog/index.d.cts +28 -3
  232. package/dist/components/AlertDialog/index.d.ts +28 -3
  233. package/dist/components/AlertDialog/index.js +5 -4
  234. package/dist/components/AudioRecorder/index.d.cts +2 -2
  235. package/dist/components/AudioRecorder/index.d.ts +2 -2
  236. package/dist/components/Autocomplete/index.d.cts +8 -2
  237. package/dist/components/Autocomplete/index.d.ts +8 -2
  238. package/dist/components/Avatar/index.d.cts +1 -1
  239. package/dist/components/Avatar/index.d.ts +1 -1
  240. package/dist/components/Badge/index.d.cts +1 -1
  241. package/dist/components/Badge/index.d.ts +1 -1
  242. package/dist/components/BoardView/index.cjs +24 -0
  243. package/dist/components/BoardView/index.cjs.map +1 -0
  244. package/dist/components/BoardView/index.d.cts +41 -0
  245. package/dist/components/BoardView/index.d.ts +41 -0
  246. package/dist/components/BoardView/index.js +7 -0
  247. package/dist/components/BoardView/index.js.map +1 -0
  248. package/dist/components/Button/index.cjs +4 -3
  249. package/dist/components/Button/index.d.cts +2 -1
  250. package/dist/components/Button/index.d.ts +2 -1
  251. package/dist/components/Button/index.js +2 -1
  252. package/dist/components/CalendarView/index.cjs +23 -0
  253. package/dist/components/CalendarView/index.cjs.map +1 -0
  254. package/dist/components/CalendarView/index.d.cts +39 -0
  255. package/dist/components/CalendarView/index.d.ts +39 -0
  256. package/dist/components/CalendarView/index.js +10 -0
  257. package/dist/components/CalendarView/index.js.map +1 -0
  258. package/dist/components/Card/index.d.cts +3 -3
  259. package/dist/components/Card/index.d.ts +3 -3
  260. package/dist/components/Collapsible/index.cjs +6 -6
  261. package/dist/components/Collapsible/index.js +3 -3
  262. package/dist/components/CountryCodeDropdown/index.cjs +5 -5
  263. package/dist/components/CountryCodeDropdown/index.js +2 -2
  264. package/dist/components/CustomizableDashboard/index.cjs +10 -9
  265. package/dist/components/CustomizableDashboard/index.js +3 -2
  266. package/dist/components/Dropdown/index.cjs +10 -10
  267. package/dist/components/Dropdown/index.d.cts +2 -1
  268. package/dist/components/Dropdown/index.d.ts +2 -1
  269. package/dist/components/Dropdown/index.js +3 -3
  270. package/dist/components/FloatingWindow/index.cjs +5 -4
  271. package/dist/components/FloatingWindow/index.js +3 -2
  272. package/dist/components/GanttView/index.cjs +20 -0
  273. package/dist/components/GanttView/index.cjs.map +1 -0
  274. package/dist/components/GanttView/index.d.cts +36 -0
  275. package/dist/components/GanttView/index.d.ts +36 -0
  276. package/dist/components/GanttView/index.js +7 -0
  277. package/dist/components/GanttView/index.js.map +1 -0
  278. package/dist/components/GlossaryTooltip/index.cjs +3 -3
  279. package/dist/components/GlossaryTooltip/index.js +2 -2
  280. package/dist/components/KeyboardShortcutsOverlay/index.cjs +5 -5
  281. package/dist/components/KeyboardShortcutsOverlay/index.js +3 -3
  282. package/dist/components/ListView/index.cjs +23 -0
  283. package/dist/components/ListView/index.cjs.map +1 -0
  284. package/dist/components/ListView/index.d.cts +124 -0
  285. package/dist/components/ListView/index.d.ts +124 -0
  286. package/dist/components/ListView/index.js +10 -0
  287. package/dist/components/ListView/index.js.map +1 -0
  288. package/dist/components/Markdown/index.cjs +20 -19
  289. package/dist/components/Markdown/index.js +8 -7
  290. package/dist/components/MediaEditor/index.cjs +15 -14
  291. package/dist/components/MediaEditor/index.d.cts +91 -2
  292. package/dist/components/MediaEditor/index.d.ts +91 -2
  293. package/dist/components/MediaEditor/index.js +10 -9
  294. package/dist/components/MediaFeed/index.cjs +26 -0
  295. package/dist/components/MediaFeed/index.cjs.map +1 -0
  296. package/dist/components/MediaFeed/index.d.cts +104 -0
  297. package/dist/components/MediaFeed/index.d.ts +104 -0
  298. package/dist/components/MediaFeed/index.js +17 -0
  299. package/dist/components/MediaFeed/index.js.map +1 -0
  300. package/dist/components/MediaPlayer/index.cjs +7 -6
  301. package/dist/components/MediaPlayer/index.d.cts +19 -1
  302. package/dist/components/MediaPlayer/index.d.ts +19 -1
  303. package/dist/components/MediaPlayer/index.js +4 -3
  304. package/dist/components/MegaMenu/index.cjs +6 -5
  305. package/dist/components/MegaMenu/index.js +3 -2
  306. package/dist/components/Modal/index.cjs +10 -10
  307. package/dist/components/Modal/index.js +2 -2
  308. package/dist/components/Pagination/index.d.cts +1 -1
  309. package/dist/components/Pagination/index.d.ts +1 -1
  310. package/dist/components/PhoneInput/index.d.cts +36 -3
  311. package/dist/components/PhoneInput/index.d.ts +36 -3
  312. package/dist/components/Progress/index.d.cts +1 -1
  313. package/dist/components/Progress/index.d.ts +1 -1
  314. package/dist/components/Q/index.d.cts +2 -2
  315. package/dist/components/Q/index.d.ts +2 -2
  316. package/dist/components/QuickAction/index.d.cts +1 -1
  317. package/dist/components/QuickAction/index.d.ts +1 -1
  318. package/dist/components/RadialExplorer/index.cjs +5 -4
  319. package/dist/components/RadialExplorer/index.js +4 -3
  320. package/dist/components/RecordButton/index.d.cts +1 -1
  321. package/dist/components/RecordButton/index.d.ts +1 -1
  322. package/dist/components/RichTextEditor/index.cjs +9 -8
  323. package/dist/components/RichTextEditor/index.d.cts +7 -2
  324. package/dist/components/RichTextEditor/index.d.ts +7 -2
  325. package/dist/components/RichTextEditor/index.js +6 -5
  326. package/dist/components/ScrollArea/index.d.cts +1 -1
  327. package/dist/components/ScrollArea/index.d.ts +1 -1
  328. package/dist/components/SectionSpyNav/index.cjs +4 -3
  329. package/dist/components/SectionSpyNav/index.js +3 -2
  330. package/dist/components/Select/index.cjs +4 -4
  331. package/dist/components/Select/index.d.cts +1 -2
  332. package/dist/components/Select/index.d.ts +1 -2
  333. package/dist/components/Select/index.js +2 -2
  334. package/dist/components/Skeleton/index.d.cts +1 -1
  335. package/dist/components/Skeleton/index.d.ts +1 -1
  336. package/dist/components/Slider/index.d.cts +2 -2
  337. package/dist/components/Slider/index.d.ts +2 -2
  338. package/dist/components/SliderCalculator/index.cjs +4 -4
  339. package/dist/components/SliderCalculator/index.js +2 -2
  340. package/dist/components/SourceTip/index.cjs +3 -3
  341. package/dist/components/SourceTip/index.js +2 -2
  342. package/dist/components/Spinner/index.d.cts +2 -2
  343. package/dist/components/Spinner/index.d.ts +2 -2
  344. package/dist/components/SuperChat/index.cjs +1406 -823
  345. package/dist/components/SuperChat/index.cjs.map +1 -1
  346. package/dist/components/SuperChat/index.d.cts +126 -8
  347. package/dist/components/SuperChat/index.d.ts +126 -8
  348. package/dist/components/SuperChat/index.js +1398 -815
  349. package/dist/components/SuperChat/index.js.map +1 -1
  350. package/dist/components/SuperChat/plugins/index.cjs +6 -6
  351. package/dist/components/SuperChat/plugins/index.d.cts +2 -3
  352. package/dist/components/SuperChat/plugins/index.d.ts +2 -3
  353. package/dist/components/SuperChat/plugins/index.js +5 -5
  354. package/dist/components/Text/index.d.cts +3 -3
  355. package/dist/components/Text/index.d.ts +3 -3
  356. package/dist/components/Textarea/index.d.cts +1 -2
  357. package/dist/components/Textarea/index.d.ts +1 -2
  358. package/dist/components/ThemeProvider/index.cjs +9 -9
  359. package/dist/components/ThemeProvider/index.d.cts +3 -1
  360. package/dist/components/ThemeProvider/index.d.ts +3 -1
  361. package/dist/components/ThemeProvider/index.js +3 -3
  362. package/dist/components/Tooltip/index.cjs +3 -3
  363. package/dist/components/Tooltip/index.js +2 -2
  364. package/dist/components/TranscriptView/index.d.cts +85 -4
  365. package/dist/components/TranscriptView/index.d.ts +85 -4
  366. package/dist/components/ViewSet/index.cjs +24 -0
  367. package/dist/components/ViewSet/index.cjs.map +1 -0
  368. package/dist/components/ViewSet/index.d.cts +200 -0
  369. package/dist/components/ViewSet/index.d.ts +200 -0
  370. package/dist/components/ViewSet/index.js +15 -0
  371. package/dist/components/ViewSet/index.js.map +1 -0
  372. package/dist/components/ViewSwitcher/index.cjs +20 -0
  373. package/dist/components/ViewSwitcher/index.cjs.map +1 -0
  374. package/dist/components/ViewSwitcher/index.d.cts +4 -0
  375. package/dist/components/ViewSwitcher/index.d.ts +4 -0
  376. package/dist/components/ViewSwitcher/index.js +7 -0
  377. package/dist/components/ViewSwitcher/index.js.map +1 -0
  378. package/dist/datavis.cjs +3 -2
  379. package/dist/datavis.cjs.map +1 -1
  380. package/dist/datavis.d.cts +167 -13
  381. package/dist/datavis.d.ts +167 -13
  382. package/dist/datavis.js +2 -1
  383. package/dist/datavis.js.map +1 -1
  384. package/dist/deck.cjs +3360 -0
  385. package/dist/deck.cjs.map +1 -0
  386. package/dist/deck.d.cts +712 -0
  387. package/dist/deck.d.ts +712 -0
  388. package/dist/deck.js +3316 -0
  389. package/dist/deck.js.map +1 -0
  390. package/dist/esheet.cjs +14 -13
  391. package/dist/esheet.cjs.map +1 -1
  392. package/dist/esheet.d.cts +183 -1
  393. package/dist/esheet.d.ts +183 -1
  394. package/dist/esheet.js +11 -10
  395. package/dist/esheet.js.map +1 -1
  396. package/dist/globe.cjs +2 -2
  397. package/dist/globe.js +1 -1
  398. package/dist/hooks/index.cjs +60 -27
  399. package/dist/hooks/index.d.cts +590 -31
  400. package/dist/hooks/index.d.ts +590 -31
  401. package/dist/hooks/index.js +6 -5
  402. package/dist/icons-wBacj6BW.d.cts +142 -0
  403. package/dist/icons-wBacj6BW.d.ts +142 -0
  404. package/dist/index-DoYYWsNc.d.cts +127 -0
  405. package/dist/index-DoYYWsNc.d.ts +127 -0
  406. package/dist/index.cjs +1420 -1048
  407. package/dist/index.cjs.map +1 -1
  408. package/dist/index.d.cts +8796 -482
  409. package/dist/index.d.ts +8796 -482
  410. package/dist/index.js +368 -232
  411. package/dist/index.js.map +1 -1
  412. package/dist/kerebron.cjs +58 -19
  413. package/dist/kerebron.cjs.map +1 -1
  414. package/dist/kerebron.css +115 -0
  415. package/dist/kerebron.d.cts +37 -0
  416. package/dist/kerebron.d.ts +37 -0
  417. package/dist/kerebron.js +58 -19
  418. package/dist/kerebron.js.map +1 -1
  419. package/dist/maps.cjs +160 -0
  420. package/dist/maps.cjs.map +1 -0
  421. package/dist/maps.d.cts +42 -0
  422. package/dist/maps.d.ts +42 -0
  423. package/dist/maps.js +138 -0
  424. package/dist/maps.js.map +1 -0
  425. package/dist/motion.cjs +7 -7
  426. package/dist/motion.d.cts +186 -2
  427. package/dist/motion.d.ts +186 -2
  428. package/dist/motion.js +2 -2
  429. package/dist/q.d.cts +25 -3
  430. package/dist/q.d.ts +25 -3
  431. package/dist/styles/effects.css +133 -0
  432. package/dist/styles/init.css +3 -0
  433. package/dist/styles.css +1 -1
  434. package/dist/tailwind-preset.cjs +4 -4
  435. package/dist/tailwind-preset.js +1 -1
  436. package/dist/templates.cjs +156 -0
  437. package/dist/templates.cjs.map +1 -0
  438. package/dist/templates.d.cts +734 -0
  439. package/dist/templates.d.ts +734 -0
  440. package/dist/templates.js +11 -0
  441. package/dist/templates.js.map +1 -0
  442. package/dist/types-Cx1FHLq2.d.cts +548 -0
  443. package/dist/types-Cx1FHLq2.d.ts +548 -0
  444. package/dist/types-DsdZvEI1.d.cts +92 -0
  445. package/dist/types-DsdZvEI1.d.ts +92 -0
  446. package/dist/utils/index.d.cts +13 -2
  447. package/dist/utils/index.d.ts +13 -2
  448. package/package.json +62 -13
  449. package/dist/Animated-XmH6k8pZ.d.cts +0 -188
  450. package/dist/Animated-XmH6k8pZ.d.ts +0 -188
  451. package/dist/CsvBlock-ROJCKJDP.cjs +0 -16
  452. package/dist/CsvBlock-UWPMTLE2.js +0 -7
  453. package/dist/HtmlPreviewBlock-DWFN6EUB.cjs +0 -16
  454. package/dist/HtmlPreviewBlock-ME5U3XNS.js +0 -7
  455. package/dist/MedicationEditor-Bp4NLy7y.d.cts +0 -352
  456. package/dist/MedicationEditor-Bp4NLy7y.d.ts +0 -352
  457. package/dist/MermaidBlock-2B6CPD6Y.js +0 -7
  458. package/dist/MermaidBlock-D2UC5M55.cjs +0 -16
  459. package/dist/SurveyBlock-4CD4AYMJ.cjs +0 -16
  460. package/dist/SurveyBlock-4DO62RBT.js +0 -7
  461. package/dist/chunk-22CYDCXA.js.map +0 -1
  462. package/dist/chunk-3T7QGLNB.js.map +0 -1
  463. package/dist/chunk-6HFFWEM3.cjs +0 -22
  464. package/dist/chunk-6HFFWEM3.cjs.map +0 -1
  465. package/dist/chunk-ACCAXVOG.js.map +0 -1
  466. package/dist/chunk-GOALNQZ2.js.map +0 -1
  467. package/dist/chunk-HB7C7NB5.js +0 -20
  468. package/dist/chunk-HB7C7NB5.js.map +0 -1
  469. package/dist/chunk-JHULS3EC.js.map +0 -1
  470. package/dist/chunk-JI244Y7C.js.map +0 -1
  471. package/dist/chunk-JYZW2PZS.cjs.map +0 -1
  472. package/dist/chunk-NV2CWBI2.cjs.map +0 -1
  473. package/dist/chunk-SQHMGT4W.js.map +0 -1
  474. package/dist/chunk-U42F3HLE.cjs.map +0 -1
  475. package/dist/chunk-VKELAMAZ.js.map +0 -1
  476. package/dist/chunk-VNYW4C4J.cjs.map +0 -1
  477. package/dist/chunk-WIAQQNFU.cjs.map +0 -1
  478. package/dist/chunk-WNAA6CLE.cjs.map +0 -1
  479. package/dist/chunk-WNJRS7Y7.cjs.map +0 -1
  480. package/dist/chunk-X4XPNTCZ.cjs.map +0 -1
  481. package/dist/chunk-XCP454Q6.js.map +0 -1
  482. package/dist/chunk-XEAT7XJG.cjs.map +0 -1
  483. package/dist/html-MdxqSzjD.d.cts +0 -13
  484. package/dist/html-MdxqSzjD.d.ts +0 -13
  485. package/dist/orderRows-BUJYgSc7.d.cts +0 -221
  486. package/dist/orderRows-BUJYgSc7.d.ts +0 -221
  487. package/dist/transcript-Cg7uSW-C.d.cts +0 -84
  488. package/dist/transcript-Cg7uSW-C.d.ts +0 -84
  489. package/dist/types-B97JNRNQ.d.cts +0 -251
  490. package/dist/types-CnPEwzlp.d.cts +0 -254
  491. package/dist/types-CnPEwzlp.d.ts +0 -254
  492. package/dist/types-gZXrfLj6.d.ts +0 -251
  493. package/dist/useAnchoredPosition-CKwLSQW8.d.cts +0 -76
  494. package/dist/useAnchoredPosition-CKwLSQW8.d.ts +0 -76
  495. package/dist/useTheme-B9SWu6ui.d.cts +0 -24
  496. package/dist/useTheme-B9SWu6ui.d.ts +0 -24
  497. package/dist/useTranscriptEdits-CGzlemHT.d.cts +0 -182
  498. package/dist/useTranscriptEdits-D32bLs0l.d.ts +0 -182
@@ -1,29 +1,40 @@
1
1
  'use strict';
2
2
 
3
3
  var chunkJFLC7SHM_cjs = require('../../chunk-JFLC7SHM.cjs');
4
- var chunkWIAQQNFU_cjs = require('../../chunk-WIAQQNFU.cjs');
5
- var chunkX4XPNTCZ_cjs = require('../../chunk-X4XPNTCZ.cjs');
6
- var chunkSGFYA22I_cjs = require('../../chunk-SGFYA22I.cjs');
4
+ var chunkXRVMYT5G_cjs = require('../../chunk-XRVMYT5G.cjs');
5
+ var chunkR5Z7AOVU_cjs = require('../../chunk-R5Z7AOVU.cjs');
6
+ var chunkWXFGHDTV_cjs = require('../../chunk-WXFGHDTV.cjs');
7
+ require('../../chunk-GLXTVCHN.cjs');
8
+ var chunkBUT6MF5K_cjs = require('../../chunk-BUT6MF5K.cjs');
9
+ var chunkTJCX4OML_cjs = require('../../chunk-TJCX4OML.cjs');
10
+ require('../../chunk-PJ6CC53R.cjs');
7
11
  var chunkJEIW7BSV_cjs = require('../../chunk-JEIW7BSV.cjs');
8
12
  require('../../chunk-VBWRH4UW.cjs');
9
- require('../../chunk-PJ6CC53R.cjs');
13
+ var chunkVPTASZ2O_cjs = require('../../chunk-VPTASZ2O.cjs');
14
+ require('../../chunk-254QK722.cjs');
15
+ require('../../chunk-T4L7Q5FA.cjs');
10
16
  require('../../chunk-I44YNYI6.cjs');
11
17
  require('../../chunk-Z5S5JEJD.cjs');
18
+ require('../../chunk-NNEFAUHV.cjs');
19
+ require('../../chunk-FHY3K6PL.cjs');
12
20
  require('../../chunk-FSGEDDF2.cjs');
13
21
  require('../../chunk-AOHJILLU.cjs');
14
- require('../../chunk-FHY3K6PL.cjs');
22
+ require('../../chunk-SCV7C55E.cjs');
15
23
  require('../../chunk-L7L5S2HO.cjs');
24
+ var chunkYW2AKBLS_cjs = require('../../chunk-YW2AKBLS.cjs');
25
+ var chunkX6A27RGO_cjs = require('../../chunk-X6A27RGO.cjs');
16
26
  var chunkYVL3XATO_cjs = require('../../chunk-YVL3XATO.cjs');
17
- require('../../chunk-NV2CWBI2.cjs');
27
+ require('../../chunk-DXEPYK3I.cjs');
28
+ var chunkIEY3ZJIT_cjs = require('../../chunk-IEY3ZJIT.cjs');
18
29
  var chunkS5RVSXDV_cjs = require('../../chunk-S5RVSXDV.cjs');
19
30
  require('../../chunk-EUAMEVVI.cjs');
20
- var React2 = require('react');
31
+ var React3 = require('react');
32
+ var lucideReact = require('lucide-react');
33
+ var classVarianceAuthority = require('class-variance-authority');
34
+ var jsxRuntime = require('react/jsx-runtime');
21
35
  var Markdown = require('react-markdown');
22
36
  var remarkGfm = require('remark-gfm');
23
37
  var rehypeSanitize = require('rehype-sanitize');
24
- var jsxRuntime = require('react/jsx-runtime');
25
- var classVarianceAuthority = require('class-variance-authority');
26
- var lucideReact = require('lucide-react');
27
38
  var reactVirtual = require('@tanstack/react-virtual');
28
39
 
29
40
  function _interopDefault (e) { return e && e.__esModule ? e : { default: e }; }
@@ -46,399 +57,204 @@ function _interopNamespace(e) {
46
57
  return Object.freeze(n);
47
58
  }
48
59
 
49
- var React2__namespace = /*#__PURE__*/_interopNamespace(React2);
60
+ var React3__namespace = /*#__PURE__*/_interopNamespace(React3);
50
61
  var Markdown__default = /*#__PURE__*/_interopDefault(Markdown);
51
62
  var remarkGfm__default = /*#__PURE__*/_interopDefault(remarkGfm);
52
63
  var rehypeSanitize__default = /*#__PURE__*/_interopDefault(rehypeSanitize);
53
64
 
54
- function remarkPreserveLineBreaks() {
55
- const splitNode = (node) => {
56
- if (!node.children) return;
57
- const next = [];
58
- for (const child of node.children) {
59
- if (child.type === "text" && child.value && child.value.includes("\n")) {
60
- const segments = child.value.split("\n");
61
- segments.forEach((segment, i) => {
62
- if (i > 0) next.push({ type: "break" });
63
- if (segment) next.push({ type: "text", value: segment });
64
- });
65
- } else {
66
- splitNode(child);
67
- next.push(child);
68
- }
65
+ function MessageMedia({
66
+ attachment,
67
+ onOpen,
68
+ openLabel,
69
+ playLabel,
70
+ errorLabel,
71
+ retryLabel,
72
+ launchId
73
+ }) {
74
+ const playable = attachment.kind !== "image";
75
+ const actionLabel = playable ? playLabel : openLabel;
76
+ return /* @__PURE__ */ jsxRuntime.jsxs(
77
+ "div",
78
+ {
79
+ "data-slot": "superchat-message-media",
80
+ className: "mt-3 flex w-72 max-w-full flex-col gap-2",
81
+ children: [
82
+ attachment.title && /* @__PURE__ */ jsxRuntime.jsx("p", { className: "text-sm font-medium", children: attachment.title }),
83
+ attachment.kind === "image" && attachment.src ? /* @__PURE__ */ jsxRuntime.jsx(
84
+ "img",
85
+ {
86
+ src: attachment.src,
87
+ alt: attachment.alt ?? attachment.title ?? "",
88
+ loading: "lazy",
89
+ className: "max-h-72 w-full rounded-lg object-contain"
90
+ }
91
+ ) : (attachment.kind === "video" || attachment.kind === "audio") && attachment.src ? (
92
+ // An opaque themed surface: the player's semi-transparent states
93
+ // (error, loading) must never compose onto a colored chat bubble.
94
+ /* @__PURE__ */ jsxRuntime.jsx("div", { className: "bg-background overflow-hidden rounded-lg", children: /* @__PURE__ */ jsxRuntime.jsx(
95
+ chunkBUT6MF5K_cjs.MediaPlayer,
96
+ {
97
+ src: attachment.src,
98
+ kind: attachment.kind,
99
+ poster: attachment.poster,
100
+ "aria-label": attachment.alt ?? attachment.title ?? openLabel,
101
+ controls: !onOpen,
102
+ preload: "metadata",
103
+ labels: { error: errorLabel, retry: retryLabel },
104
+ className: "max-h-72"
105
+ }
106
+ ) })
107
+ ) : attachment.poster ? /* @__PURE__ */ jsxRuntime.jsx(
108
+ "img",
109
+ {
110
+ src: attachment.poster,
111
+ alt: attachment.alt ?? attachment.title ?? "",
112
+ loading: "lazy",
113
+ className: "max-h-72 w-full rounded-lg object-contain"
114
+ }
115
+ ) : null,
116
+ attachment.caption && /* @__PURE__ */ jsxRuntime.jsx("p", { className: "text-sm", children: attachment.caption }),
117
+ onOpen && /* @__PURE__ */ jsxRuntime.jsx(chunkXRVMYT5G_cjs.ButtonGroup, { children: /* @__PURE__ */ jsxRuntime.jsx(
118
+ chunkX6A27RGO_cjs.Button,
119
+ {
120
+ "data-media-launch-id": launchId,
121
+ variant: "secondary",
122
+ size: "sm",
123
+ leftIcon: playable ? /* @__PURE__ */ jsxRuntime.jsx(lucideReact.Play, { className: "size-4", "aria-hidden": "true" }) : void 0,
124
+ "aria-label": playable && attachment.title ? `${playLabel} ${attachment.title}` : actionLabel,
125
+ onClick: () => onOpen(playable),
126
+ children: actionLabel
127
+ }
128
+ ) })
129
+ ]
69
130
  }
70
- node.children = next;
71
- };
72
- return (tree) => splitNode(tree);
131
+ );
73
132
  }
74
- function baseSanitizeSchema() {
75
- const schema = JSON.parse(JSON.stringify(rehypeSanitize.defaultSchema));
76
- const attributes = schema.attributes ?? {};
77
- const allowClass = (tag) => {
78
- const existing = attributes[tag] ?? [];
79
- const withoutClass = existing.filter(
80
- (a) => !(Array.isArray(a) && a[0] === "className")
81
- );
82
- attributes[tag] = [...withoutClass, "className"];
83
- };
84
- allowClass("code");
85
- allowClass("pre");
86
- allowClass("span");
87
- allowClass("div");
88
- schema.attributes = attributes;
89
- return schema;
133
+ function formatTime(time) {
134
+ return new Date(time).toLocaleTimeString(void 0, {
135
+ hour: "numeric",
136
+ minute: "2-digit"
137
+ });
90
138
  }
91
- function mergeSanitizeSchema(base, extra) {
92
- if (!extra) return base;
93
- const out = { ...base };
94
- if (Array.isArray(extra.tagNames)) {
95
- const a = base.tagNames ?? [];
96
- out.tagNames = Array.from(/* @__PURE__ */ new Set([...a, ...extra.tagNames]));
139
+ function byTime(a, b) {
140
+ return new Date(a.time).getTime() - new Date(b.time).getTime();
141
+ }
142
+ function lastActivityOf(c) {
143
+ if (c.lastActivity) return new Date(c.lastActivity).getTime();
144
+ const last = lastMessageByTime(c.thread);
145
+ return last ? new Date(last.time).getTime() : 0;
146
+ }
147
+ function escapeRegExp(value) {
148
+ return value.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
149
+ }
150
+ function detectMentions(text, participants) {
151
+ const ids = [];
152
+ for (const p of participants) {
153
+ if (p.kind === "system") continue;
154
+ const token = "@" + p.name.split(" ")[0];
155
+ const pattern = new RegExp(
156
+ `(?<![\\w@])${escapeRegExp(token)}(?![\\w])`,
157
+ "i"
158
+ );
159
+ if (pattern.test(text)) ids.push(p.id);
97
160
  }
98
- if (extra.attributes && typeof extra.attributes === "object") {
99
- const baseAttrs = {
100
- ...base.attributes ?? {}
101
- };
102
- for (const [tag, attrs] of Object.entries(
103
- extra.attributes
104
- )) {
105
- baseAttrs[tag] = [...baseAttrs[tag] ?? [], ...attrs];
161
+ return ids;
162
+ }
163
+ function lastMessageByTime(thread) {
164
+ let latest;
165
+ let latestTime = -Infinity;
166
+ for (const message of thread) {
167
+ const t = new Date(message.time).getTime();
168
+ if (t >= latestTime) {
169
+ latest = message;
170
+ latestTime = t;
106
171
  }
107
- out.attributes = baseAttrs;
108
172
  }
109
- if (extra.protocols && typeof extra.protocols === "object") {
110
- const baseProtocols = {
111
- ...base.protocols ?? {}
112
- };
113
- for (const [attr, protocols] of Object.entries(
114
- extra.protocols
115
- )) {
116
- baseProtocols[attr] = Array.from(
117
- /* @__PURE__ */ new Set([...baseProtocols[attr] ?? [], ...protocols])
118
- );
173
+ return latest;
174
+ }
175
+ function parseHexColor(value) {
176
+ const hex = value.trim();
177
+ if (!/^#([0-9a-f]{3}|[0-9a-f]{6})$/i.test(hex)) return null;
178
+ const normalized = hex.length === 4 ? "#" + [...hex.slice(1)].map((char) => char + char).join("") : hex;
179
+ return [1, 3, 5].map(
180
+ (start) => parseInt(normalized.slice(start, start + 2), 16)
181
+ );
182
+ }
183
+ function relativeLuminanceChannel(channel) {
184
+ const normalized = channel / 255;
185
+ return normalized <= 0.03928 ? normalized / 12.92 : ((normalized + 0.055) / 1.055) ** 2.4;
186
+ }
187
+ function relativeLuminance(value) {
188
+ const rgb = parseHexColor(value);
189
+ if (!rgb) return null;
190
+ const [red, green, blue] = rgb;
191
+ return 0.2126 * relativeLuminanceChannel(red) + 0.7152 * relativeLuminanceChannel(green) + 0.0722 * relativeLuminanceChannel(blue);
192
+ }
193
+ function contrastRatio(foreground, background) {
194
+ const foregroundLuminance = relativeLuminance(foreground);
195
+ const backgroundLuminance = relativeLuminance(background);
196
+ if (foregroundLuminance === null || backgroundLuminance === null) return null;
197
+ const lighter = Math.max(foregroundLuminance, backgroundLuminance);
198
+ const darker = Math.min(foregroundLuminance, backgroundLuminance);
199
+ return (lighter + 0.05) / (darker + 0.05);
200
+ }
201
+ function minimumContrastRatio(value, backgrounds) {
202
+ const contrasts = backgrounds.map((background) => contrastRatio(value, background)).filter((contrast) => contrast !== null);
203
+ if (contrasts.length !== backgrounds.length) return null;
204
+ return Math.min(...contrasts);
205
+ }
206
+ function accessibleAccentTextColor(value) {
207
+ if (!value) return void 0;
208
+ const contrast = minimumContrastRatio(value, ["#f5f5f5", "#262626"]);
209
+ if (contrast === null) return value;
210
+ return contrast < 4.5 ? void 0 : value;
211
+ }
212
+ function ParticipantAvatar({
213
+ participant
214
+ }) {
215
+ const isAgent = participant?.kind === "agent";
216
+ const backgroundColor = participant?.color ?? (isAgent ? "var(--mieweb-primary-700, #1f2937)" : "#64748b");
217
+ return /* @__PURE__ */ jsxRuntime.jsx(
218
+ chunkJEIW7BSV_cjs.Avatar,
219
+ {
220
+ size: "xs",
221
+ src: participant?.avatar,
222
+ alt: "",
223
+ name: participant?.name ?? "?",
224
+ fallback: isAgent ? /* @__PURE__ */ jsxRuntime.jsx(chunkXRVMYT5G_cjs.SparklesIcon, { size: "sm" }) : void 0,
225
+ style: { backgroundColor },
226
+ "aria-hidden": "true",
227
+ className: "shrink-0"
119
228
  }
120
- out.protocols = baseProtocols;
121
- }
122
- for (const [k, v] of Object.entries(extra)) {
123
- if (k === "tagNames" || k === "attributes" || k === "protocols") continue;
124
- out[k] = v;
125
- }
126
- return out;
229
+ );
127
230
  }
128
- function baseComponents() {
129
- return {
130
- a: ({ node: _node, children, ...props }) => /* @__PURE__ */ jsxRuntime.jsx(
131
- "a",
231
+ function ReferenceChip({
232
+ reference,
233
+ linkBuilder,
234
+ onReferenceClick
235
+ }) {
236
+ const href = linkBuilder?.(reference);
237
+ const content = /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
238
+ /* @__PURE__ */ jsxRuntime.jsx(
239
+ chunkYVL3XATO_cjs.Badge,
132
240
  {
133
- ...props,
134
- className: chunkS5RVSXDV_cjs.cn(
135
- "text-primary-800 hover:text-primary-900 dark:text-primary-300 underline underline-offset-2",
136
- props.className
137
- ),
138
- target: props.target ?? "_blank",
139
- rel: props.rel ?? "noopener noreferrer",
140
- children
241
+ variant: "default",
242
+ size: "sm",
243
+ className: "rounded px-1.5 text-[10px] font-semibold tracking-wide uppercase",
244
+ children: reference.refType
141
245
  }
142
246
  ),
143
- pre: ({ node: _node, ...props }) => /* @__PURE__ */ jsxRuntime.jsx(
144
- "pre",
247
+ /* @__PURE__ */ jsxRuntime.jsx("span", { className: "truncate", children: reference.title })
248
+ ] });
249
+ const className = "inline-flex max-w-full items-center gap-2 rounded-lg border border-neutral-200 bg-white px-3 py-1.5 text-sm text-neutral-700 hover:border-primary-300 dark:border-neutral-700 dark:bg-neutral-800 dark:text-neutral-200";
250
+ if (href) {
251
+ return /* @__PURE__ */ jsxRuntime.jsx(
252
+ "a",
145
253
  {
146
- ...props,
147
- tabIndex: 0,
148
- className: chunkS5RVSXDV_cjs.cn(
149
- "overflow-x-auto rounded-lg bg-neutral-900 p-3 text-sm text-neutral-100 dark:bg-neutral-950",
150
- props.className
151
- )
152
- }
153
- ),
154
- code: ({ node: _node, ...props }) => {
155
- const isBlock = typeof props.className === "string" && props.className.includes("language-");
156
- return /* @__PURE__ */ jsxRuntime.jsx(
157
- "code",
158
- {
159
- ...props,
160
- className: chunkS5RVSXDV_cjs.cn(
161
- !isBlock && "rounded bg-neutral-200 px-1 py-0.5 text-[0.85em] text-neutral-800 dark:bg-neutral-700 dark:text-neutral-100",
162
- props.className
163
- )
164
- }
165
- );
166
- },
167
- input: ({ node: _node, ...props }) => {
168
- if (props.type === "checkbox") {
169
- return /* @__PURE__ */ jsxRuntime.jsx(
170
- "input",
171
- {
172
- ...props,
173
- "aria-label": props["aria-label"] ?? (props["aria-labelledby"] ? void 0 : "Task list item")
174
- }
175
- );
176
- }
177
- return /* @__PURE__ */ jsxRuntime.jsx("input", { ...props });
178
- },
179
- table: ({ node: _node, ...props }) => /* @__PURE__ */ jsxRuntime.jsx("div", { className: "my-2 overflow-x-auto", children: /* @__PURE__ */ jsxRuntime.jsx(
180
- "table",
181
- {
182
- ...props,
183
- className: chunkS5RVSXDV_cjs.cn(
184
- "w-full border-collapse text-sm [&_td]:border [&_td]:border-neutral-200 [&_td]:px-2 [&_td]:py-1 dark:[&_td]:border-neutral-700 [&_th]:border [&_th]:border-neutral-200 [&_th]:px-2 [&_th]:py-1 [&_th]:text-start dark:[&_th]:border-neutral-700",
185
- props.className
186
- )
187
- }
188
- ) }),
189
- // Tailwind's preflight resets list markers/padding; restore them explicitly
190
- // so bullets/numbers show without depending on the typography plugin.
191
- ul: ({ node: _node, ...props }) => /* @__PURE__ */ jsxRuntime.jsx("ul", { ...props, className: chunkS5RVSXDV_cjs.cn("list-disc ps-5", props.className) }),
192
- ol: ({ node: _node, ...props }) => /* @__PURE__ */ jsxRuntime.jsx("ol", { ...props, className: chunkS5RVSXDV_cjs.cn("list-decimal ps-5", props.className) }),
193
- li: ({ node: _node, ...props }) => /* @__PURE__ */ jsxRuntime.jsx("li", { ...props, className: chunkS5RVSXDV_cjs.cn("ps-1", props.className) }),
194
- // Preflight also flattens headings to body size/weight; restore a sensible
195
- // hierarchy without depending on the typography plugin.
196
- h1: ({ node: _node, children, ...props }) => /* @__PURE__ */ jsxRuntime.jsx(
197
- "h1",
198
- {
199
- ...props,
200
- className: chunkS5RVSXDV_cjs.cn("mt-3 mb-1 text-xl font-semibold", props.className),
201
- children
202
- }
203
- ),
204
- h2: ({ node: _node, children, ...props }) => /* @__PURE__ */ jsxRuntime.jsx(
205
- "h2",
206
- {
207
- ...props,
208
- className: chunkS5RVSXDV_cjs.cn("mt-3 mb-1 text-lg font-semibold", props.className),
209
- children
210
- }
211
- ),
212
- h3: ({ node: _node, children, ...props }) => /* @__PURE__ */ jsxRuntime.jsx(
213
- "h3",
214
- {
215
- ...props,
216
- className: chunkS5RVSXDV_cjs.cn("mt-2 mb-1 text-base font-semibold", props.className),
217
- children
218
- }
219
- ),
220
- h4: ({ node: _node, children, ...props }) => /* @__PURE__ */ jsxRuntime.jsx(
221
- "h4",
222
- {
223
- ...props,
224
- className: chunkS5RVSXDV_cjs.cn("mt-2 mb-1 text-sm font-semibold", props.className),
225
- children
226
- }
227
- ),
228
- h5: ({ node: _node, children, ...props }) => /* @__PURE__ */ jsxRuntime.jsx(
229
- "h5",
230
- {
231
- ...props,
232
- className: chunkS5RVSXDV_cjs.cn("mt-2 mb-1 text-sm font-semibold", props.className),
233
- children
234
- }
235
- ),
236
- h6: ({ node: _node, children, ...props }) => /* @__PURE__ */ jsxRuntime.jsx(
237
- "h6",
238
- {
239
- ...props,
240
- className: chunkS5RVSXDV_cjs.cn(
241
- "mt-2 mb-1 text-xs font-semibold tracking-wide uppercase",
242
- props.className
243
- ),
244
- children
245
- }
246
- ),
247
- hr: ({ node: _node, ...props }) => /* @__PURE__ */ jsxRuntime.jsx(
248
- "hr",
249
- {
250
- ...props,
251
- className: chunkS5RVSXDV_cjs.cn(
252
- "my-2 border-neutral-300 dark:border-neutral-600",
253
- props.className
254
- )
255
- }
256
- )
257
- };
258
- }
259
- function createMarkdownRenderer(options = {}) {
260
- const { plugins = [], trusted = false } = options;
261
- const remarkPlugins = [
262
- remarkGfm__default.default,
263
- remarkPreserveLineBreaks,
264
- ...plugins.flatMap((p) => p.remarkPlugins ?? [])
265
- ];
266
- const pluginRehype = plugins.flatMap(
267
- (p) => p.rehypePlugins ?? []
268
- );
269
- const sanitizeSchema = plugins.reduce(
270
- (acc, p) => mergeSanitizeSchema(acc, p.sanitizeSchema),
271
- baseSanitizeSchema()
272
- );
273
- const rehypePlugins = trusted ? pluginRehype : [...pluginRehype, [rehypeSanitize__default.default, sanitizeSchema]];
274
- const components = plugins.reduce(
275
- (acc, p) => ({ ...acc, ...p.components }),
276
- baseComponents()
277
- );
278
- const MarkdownRenderer = (text, ctx) => /* @__PURE__ */ jsxRuntime.jsx(
279
- MarkdownContent,
280
- {
281
- text,
282
- messageId: ctx.messageId,
283
- streaming: ctx.streaming,
284
- remarkPlugins,
285
- rehypePlugins,
286
- components
287
- },
288
- ctx.messageId
289
- );
290
- return MarkdownRenderer;
291
- }
292
- var transformUrl = (url, key, node) => {
293
- if (key === "src" && node.tagName === "img" && (/^data:image\//i.test(url) || /^blob:/i.test(url))) {
294
- return url;
295
- }
296
- return Markdown.defaultUrlTransform(url);
297
- };
298
- var MarkdownContent = React2__namespace.memo(function MarkdownContent2({
299
- text,
300
- messageId,
301
- streaming,
302
- remarkPlugins,
303
- rehypePlugins,
304
- components
305
- }) {
306
- return /* @__PURE__ */ jsxRuntime.jsx(chunkJFLC7SHM_cjs.TextRenderContext.Provider, { value: { messageId, streaming }, children: /* @__PURE__ */ jsxRuntime.jsx(
307
- Markdown__default.default,
308
- {
309
- remarkPlugins,
310
- rehypePlugins,
311
- urlTransform: transformUrl,
312
- components,
313
- children: text
314
- }
315
- ) });
316
- });
317
- function formatTime(time) {
318
- return new Date(time).toLocaleTimeString(void 0, {
319
- hour: "numeric",
320
- minute: "2-digit"
321
- });
322
- }
323
- function byTime(a, b) {
324
- return new Date(a.time).getTime() - new Date(b.time).getTime();
325
- }
326
- function lastActivityOf(c) {
327
- if (c.lastActivity) return new Date(c.lastActivity).getTime();
328
- const last = lastMessageByTime(c.thread);
329
- return last ? new Date(last.time).getTime() : 0;
330
- }
331
- function escapeRegExp(value) {
332
- return value.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
333
- }
334
- function detectMentions(text, participants) {
335
- const ids = [];
336
- for (const p of participants) {
337
- if (p.kind === "system") continue;
338
- const token = "@" + p.name.split(" ")[0];
339
- const pattern = new RegExp(
340
- `(?<![\\w@])${escapeRegExp(token)}(?![\\w])`,
341
- "i"
342
- );
343
- if (pattern.test(text)) ids.push(p.id);
344
- }
345
- return ids;
346
- }
347
- function lastMessageByTime(thread) {
348
- let latest;
349
- let latestTime = -Infinity;
350
- for (const message of thread) {
351
- const t = new Date(message.time).getTime();
352
- if (t >= latestTime) {
353
- latest = message;
354
- latestTime = t;
355
- }
356
- }
357
- return latest;
358
- }
359
- function parseHexColor(value) {
360
- const hex = value.trim();
361
- if (!/^#([0-9a-f]{3}|[0-9a-f]{6})$/i.test(hex)) return null;
362
- const normalized = hex.length === 4 ? "#" + [...hex.slice(1)].map((char) => char + char).join("") : hex;
363
- return [1, 3, 5].map(
364
- (start) => parseInt(normalized.slice(start, start + 2), 16)
365
- );
366
- }
367
- function relativeLuminanceChannel(channel) {
368
- const normalized = channel / 255;
369
- return normalized <= 0.03928 ? normalized / 12.92 : ((normalized + 0.055) / 1.055) ** 2.4;
370
- }
371
- function relativeLuminance(value) {
372
- const rgb = parseHexColor(value);
373
- if (!rgb) return null;
374
- const [red, green, blue] = rgb;
375
- return 0.2126 * relativeLuminanceChannel(red) + 0.7152 * relativeLuminanceChannel(green) + 0.0722 * relativeLuminanceChannel(blue);
376
- }
377
- function contrastRatio(foreground, background) {
378
- const foregroundLuminance = relativeLuminance(foreground);
379
- const backgroundLuminance = relativeLuminance(background);
380
- if (foregroundLuminance === null || backgroundLuminance === null) return null;
381
- const lighter = Math.max(foregroundLuminance, backgroundLuminance);
382
- const darker = Math.min(foregroundLuminance, backgroundLuminance);
383
- return (lighter + 0.05) / (darker + 0.05);
384
- }
385
- function minimumContrastRatio(value, backgrounds) {
386
- const contrasts = backgrounds.map((background) => contrastRatio(value, background)).filter((contrast) => contrast !== null);
387
- if (contrasts.length !== backgrounds.length) return null;
388
- return Math.min(...contrasts);
389
- }
390
- function accessibleAccentTextColor(value) {
391
- if (!value) return void 0;
392
- const contrast = minimumContrastRatio(value, ["#f5f5f5", "#262626"]);
393
- if (contrast === null) return value;
394
- return contrast < 4.5 ? void 0 : value;
395
- }
396
- function ParticipantAvatar({
397
- participant
398
- }) {
399
- const isAgent = participant?.kind === "agent";
400
- const backgroundColor = participant?.color ?? (isAgent ? "var(--mieweb-primary-700, #1f2937)" : "#64748b");
401
- return /* @__PURE__ */ jsxRuntime.jsx(
402
- chunkJEIW7BSV_cjs.Avatar,
403
- {
404
- size: "xs",
405
- src: participant?.avatar,
406
- alt: "",
407
- name: participant?.name ?? "?",
408
- fallback: isAgent ? /* @__PURE__ */ jsxRuntime.jsx(chunkWIAQQNFU_cjs.SparklesIcon, { size: "sm" }) : void 0,
409
- style: { backgroundColor },
410
- "aria-hidden": "true",
411
- className: "shrink-0"
412
- }
413
- );
414
- }
415
- function ReferenceChip({
416
- reference,
417
- linkBuilder,
418
- onReferenceClick
419
- }) {
420
- const href = linkBuilder?.(reference);
421
- const content = /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
422
- /* @__PURE__ */ jsxRuntime.jsx(
423
- chunkYVL3XATO_cjs.Badge,
424
- {
425
- variant: "default",
426
- size: "sm",
427
- className: "rounded px-1.5 text-[10px] font-semibold tracking-wide uppercase",
428
- children: reference.refType
429
- }
430
- ),
431
- /* @__PURE__ */ jsxRuntime.jsx("span", { className: "truncate", children: reference.title })
432
- ] });
433
- const className = "inline-flex max-w-full items-center gap-2 rounded-lg border border-neutral-200 bg-white px-3 py-1.5 text-sm text-neutral-700 hover:border-primary-300 dark:border-neutral-700 dark:bg-neutral-800 dark:text-neutral-200";
434
- if (href) {
435
- return /* @__PURE__ */ jsxRuntime.jsx(
436
- "a",
437
- {
438
- href,
439
- className,
440
- onClick: () => onReferenceClick?.(reference),
441
- children: content
254
+ href,
255
+ className,
256
+ onClick: () => onReferenceClick?.(reference),
257
+ children: content
442
258
  }
443
259
  );
444
260
  }
@@ -498,11 +314,11 @@ function useMessageCopy({
498
314
  getText,
499
315
  defaultFormat
500
316
  }) {
501
- const [copied, setCopied] = React2__namespace.useState(false);
502
- const copiedTimer = React2__namespace.useRef(
317
+ const [copied, setCopied] = React3__namespace.useState(false);
318
+ const copiedTimer = React3__namespace.useRef(
503
319
  void 0
504
320
  );
505
- React2__namespace.useEffect(() => () => window.clearTimeout(copiedTimer.current), []);
321
+ React3__namespace.useEffect(() => () => window.clearTimeout(copiedTimer.current), []);
506
322
  const flash = () => {
507
323
  setCopied(true);
508
324
  window.clearTimeout(copiedTimer.current);
@@ -546,7 +362,7 @@ function ActionMenuItem({
546
362
  item,
547
363
  onSelect
548
364
  }) {
549
- return /* @__PURE__ */ jsxRuntime.jsx(chunkSGFYA22I_cjs.DropdownItem, { onClick: () => onSelect(item.onSelect), children: item.description ? /* @__PURE__ */ jsxRuntime.jsxs("span", { className: "flex flex-col items-start", children: [
365
+ return /* @__PURE__ */ jsxRuntime.jsx(chunkTJCX4OML_cjs.DropdownItem, { onClick: () => onSelect(item.onSelect), children: item.description ? /* @__PURE__ */ jsxRuntime.jsxs("span", { className: "flex flex-col items-start", children: [
550
366
  /* @__PURE__ */ jsxRuntime.jsx("span", { children: item.label }),
551
367
  /* @__PURE__ */ jsxRuntime.jsx("span", { className: "text-[10px] font-normal text-neutral-400", children: item.description })
552
368
  ] }) : item.label });
@@ -555,7 +371,7 @@ function FooterActionButton({
555
371
  action,
556
372
  isSelf
557
373
  }) {
558
- const [open, setOpen] = React2__namespace.useState(false);
374
+ const [open, setOpen] = React3__namespace.useState(false);
559
375
  const onClickCapture = action.submenu ? (e) => {
560
376
  if (e.metaKey || e.ctrlKey) {
561
377
  e.preventDefault();
@@ -578,7 +394,7 @@ function FooterActionButton({
578
394
  );
579
395
  if (!action.submenu) return button;
580
396
  return /* @__PURE__ */ jsxRuntime.jsx(
581
- chunkSGFYA22I_cjs.Dropdown,
397
+ chunkTJCX4OML_cjs.Dropdown,
582
398
  {
583
399
  open,
584
400
  onOpenChange: setOpen,
@@ -598,17 +414,13 @@ function FooterActionButton({
598
414
  }
599
415
  );
600
416
  }
601
- var MessageActionsBar = React2__namespace.forwardRef(function MessageActionsBar2({ actions, isSelf }, ref) {
417
+ var MessageActionsBar = React3__namespace.forwardRef(function MessageActionsBar2({ actions, isSelf }, ref) {
602
418
  return /* @__PURE__ */ jsxRuntime.jsx(
603
419
  "div",
604
420
  {
605
421
  ref,
606
422
  "data-slot": "superchat-message-actions",
607
- className: chunkS5RVSXDV_cjs.cn(
608
- "flex items-center gap-0.5",
609
- isSelf && "justify-end",
610
- actionRevealClass
611
- ),
423
+ className: chunkS5RVSXDV_cjs.cn("flex flex-col items-center gap-0.5", actionRevealClass),
612
424
  children: actions.map((action) => /* @__PURE__ */ jsxRuntime.jsx(FooterActionButton, { action, isSelf }, action.id))
613
425
  }
614
426
  );
@@ -618,7 +430,7 @@ function MessageOverflowMenu({
618
430
  actions,
619
431
  footerVisible
620
432
  }) {
621
- const [open, setOpen] = React2__namespace.useState(false);
433
+ const [open, setOpen] = React3__namespace.useState(false);
622
434
  const select = (fn) => {
623
435
  setOpen(false);
624
436
  fn();
@@ -627,7 +439,7 @@ function MessageOverflowMenu({
627
439
  "div",
628
440
  {
629
441
  className: chunkS5RVSXDV_cjs.cn(
630
- "sticky bottom-2 shrink-0 self-end transition-opacity",
442
+ "sticky bottom-2 mt-auto shrink-0 transition-opacity",
631
443
  // Rich content (e.g. NITRO tables) layers internals up to z-50, so the
632
444
  // open menu's stacking context must clear that.
633
445
  open ? "z-[60]" : "z-10",
@@ -637,7 +449,7 @@ function MessageOverflowMenu({
637
449
  footerVisible && !open && "pointer-events-none invisible opacity-0"
638
450
  ),
639
451
  children: /* @__PURE__ */ jsxRuntime.jsx(
640
- chunkSGFYA22I_cjs.Dropdown,
452
+ chunkTJCX4OML_cjs.Dropdown,
641
453
  {
642
454
  open,
643
455
  onOpenChange: setOpen,
@@ -656,9 +468,9 @@ function MessageOverflowMenu({
656
468
  (action) => action.submenu ? (
657
469
  // Actions with variants collapse to just their submenu — a
658
470
  // top-level default item would duplicate the flyout's options.
659
- /* @__PURE__ */ jsxRuntime.jsx(chunkSGFYA22I_cjs.DropdownSubmenu, { label: action.submenu.label, children: action.submenu.items.map((item) => /* @__PURE__ */ jsxRuntime.jsx(ActionMenuItem, { item, onSelect: select }, item.id)) }, action.id)
471
+ /* @__PURE__ */ jsxRuntime.jsx(chunkTJCX4OML_cjs.DropdownSubmenu, { label: action.submenu.label, children: action.submenu.items.map((item) => /* @__PURE__ */ jsxRuntime.jsx(ActionMenuItem, { item, onSelect: select }, item.id)) }, action.id)
660
472
  ) : /* @__PURE__ */ jsxRuntime.jsx(
661
- chunkSGFYA22I_cjs.DropdownItem,
473
+ chunkTJCX4OML_cjs.DropdownItem,
662
474
  {
663
475
  onClick: () => select(action.onSelect),
664
476
  children: action.label
@@ -671,7 +483,7 @@ function MessageOverflowMenu({
671
483
  }
672
484
  );
673
485
  }
674
- var MessageRow = React2__namespace.memo(function MessageRow2({
486
+ var MessageRow = React3__namespace.memo(function MessageRow2({
675
487
  message,
676
488
  participant,
677
489
  isSelf,
@@ -680,21 +492,27 @@ var MessageRow = React2__namespace.memo(function MessageRow2({
680
492
  onReferenceClick,
681
493
  editable,
682
494
  onMessageEdited,
683
- defaultCopyFormat = "rich"
495
+ defaultCopyFormat = "rich",
496
+ onOpenMedia,
497
+ openMediaLabel = "Open in media feed",
498
+ playMediaLabel = "Play",
499
+ mediaErrorLabel,
500
+ mediaRetryLabel
684
501
  }) {
685
502
  const streaming = message.status === "streaming";
686
- const hasBody = !!message.text || (message.content?.length ?? 0) > 0;
687
- const [isEditing, setIsEditing] = React2__namespace.useState(false);
688
- const [draft, setDraft] = React2__namespace.useState(message.text ?? "");
689
- const editRef = React2__namespace.useRef(null);
690
- const bubbleRef = React2__namespace.useRef(null);
691
- const autosize = React2__namespace.useCallback(() => {
503
+ const hasBody = !!message.text || (message.content?.length ?? 0) > 0 || (message.media?.length ?? 0) > 0;
504
+ const [isEditing, setIsEditing] = React3__namespace.useState(false);
505
+ const [draft, setDraft] = React3__namespace.useState(message.text ?? "");
506
+ const [editMinWidth, setEditMinWidth] = React3__namespace.useState();
507
+ const editRef = React3__namespace.useRef(null);
508
+ const bubbleRef = React3__namespace.useRef(null);
509
+ const autosize = React3__namespace.useCallback(() => {
692
510
  const el = editRef.current;
693
511
  if (!el) return;
694
512
  el.style.height = "auto";
695
513
  el.style.height = `${el.scrollHeight}px`;
696
514
  }, []);
697
- React2__namespace.useEffect(() => {
515
+ React3__namespace.useEffect(() => {
698
516
  if (!isEditing) return;
699
517
  const el = editRef.current;
700
518
  if (!el) return;
@@ -709,337 +527,662 @@ var MessageRow = React2__namespace.memo(function MessageRow2({
709
527
  ${block.text}
710
528
  \`\`\``;
711
529
  }
712
- if ((block.type === "text" || block.type === "thinking") && block.text) {
713
- return block.text;
530
+ if ((block.type === "text" || block.type === "thinking") && block.text) {
531
+ return block.text;
532
+ }
533
+ return "";
534
+ }).filter(Boolean).join("\n\n") ?? "";
535
+ const canCopy = !isEditing && (!!message.content?.length || typeof message.text === "string" && message.text.length > 0);
536
+ const showEditAction = canEdit && !isEditing;
537
+ const actionCount = (canCopy ? 1 : 0) + (showEditAction ? 1 : 0);
538
+ const hasActions = actionCount > 0;
539
+ const collapseToMenu = actionCount > 1;
540
+ const copy = useMessageCopy({
541
+ markdown: markdownSource,
542
+ getHtml: () => bubbleRef.current?.innerHTML ?? "",
543
+ getText: () => bubbleRef.current?.textContent ?? "",
544
+ defaultFormat: defaultCopyFormat
545
+ });
546
+ const actionsBarRef = React3__namespace.useRef(null);
547
+ const [footerVisible, setFooterVisible] = React3__namespace.useState(true);
548
+ React3__namespace.useEffect(() => {
549
+ const el = actionsBarRef.current;
550
+ if (!el || typeof globalThis.IntersectionObserver === "undefined") return;
551
+ const observer = new globalThis.IntersectionObserver(([entry]) => {
552
+ setFooterVisible(entry?.isIntersecting ?? false);
553
+ });
554
+ observer.observe(el);
555
+ return () => observer.disconnect();
556
+ }, [hasActions, collapseToMenu]);
557
+ if (message.type === "system") {
558
+ return /* @__PURE__ */ jsxRuntime.jsx(
559
+ "div",
560
+ {
561
+ "data-slot": "superchat-system-message",
562
+ role: "status",
563
+ className: "my-1 text-center text-xs text-neutral-500 dark:text-neutral-400",
564
+ children: message.text
565
+ }
566
+ );
567
+ }
568
+ if (message.type === "ref" && message.ref) {
569
+ return /* @__PURE__ */ jsxRuntime.jsx(
570
+ "div",
571
+ {
572
+ "data-slot": "superchat-reference",
573
+ className: chunkS5RVSXDV_cjs.cn("flex", isSelf && "justify-end"),
574
+ children: /* @__PURE__ */ jsxRuntime.jsx(
575
+ ReferenceChip,
576
+ {
577
+ reference: message.ref,
578
+ linkBuilder,
579
+ onReferenceClick
580
+ }
581
+ )
582
+ }
583
+ );
584
+ }
585
+ const accent = participant?.color;
586
+ const accentTextColor = accessibleAccentTextColor(accent);
587
+ const authorName = participant?.name ?? "Unknown";
588
+ const startEdit = () => {
589
+ const el = bubbleRef.current;
590
+ if (el) {
591
+ const cs = getComputedStyle(el);
592
+ const contentWidth = el.clientWidth - parseFloat(cs.paddingLeft) - parseFloat(cs.paddingRight);
593
+ setEditMinWidth(contentWidth > 0 ? contentWidth : void 0);
594
+ }
595
+ setDraft(message.text ?? "");
596
+ setIsEditing(true);
597
+ };
598
+ const cancelEdit = () => setIsEditing(false);
599
+ const saveEdit = () => {
600
+ const next = draft.trim();
601
+ if (next && next !== message.text) onMessageEdited?.(message.id, next);
602
+ setIsEditing(false);
603
+ };
604
+ const handleEditPaste = (e) => {
605
+ const files = Array.from(e.clipboardData.items).filter((item) => item.kind === "file" && item.type.startsWith("image/")).map((item) => item.getAsFile()).filter((f) => f !== null);
606
+ if (files.length === 0) return;
607
+ e.preventDefault();
608
+ const el = e.currentTarget;
609
+ const start = el.selectionStart ?? draft.length;
610
+ const end = el.selectionEnd ?? draft.length;
611
+ Promise.all(
612
+ files.map(
613
+ (file, i) => new Promise((resolve) => {
614
+ const reader = new window.FileReader();
615
+ reader.onload = () => {
616
+ const dataUrl = typeof reader.result === "string" ? reader.result : "";
617
+ const name = file.name || `pasted-image-${i + 1}.png`;
618
+ resolve(dataUrl ? `![${name}](${dataUrl})` : "");
619
+ };
620
+ reader.readAsDataURL(file);
621
+ })
622
+ )
623
+ ).then((snippets) => {
624
+ const insert = snippets.filter(Boolean).join("\n");
625
+ if (!insert) return;
626
+ el.focus();
627
+ el.setSelectionRange(start, end);
628
+ const text = `${insert}
629
+ `;
630
+ const inserted = typeof document !== "undefined" && typeof document.execCommand === "function" && document.execCommand("insertText", false, text);
631
+ if (!inserted) {
632
+ setDraft((prev) => `${prev.slice(0, start)}${text}${prev.slice(end)}`);
633
+ }
634
+ requestAnimationFrame(autosize);
635
+ });
636
+ };
637
+ const actions = [
638
+ ...canCopy ? [
639
+ {
640
+ id: "copy",
641
+ label: "Copy message",
642
+ title: "Copy message (\u2318/Ctrl-click: default format)",
643
+ icon: copy.copied ? /* @__PURE__ */ jsxRuntime.jsx(lucideReact.Check, { size: 14, "aria-hidden": "true" }) : /* @__PURE__ */ jsxRuntime.jsx(lucideReact.Clipboard, { size: 14, "aria-hidden": "true" }),
644
+ onSelect: copy.copyDefault,
645
+ submenu: {
646
+ label: "Copy as",
647
+ items: [
648
+ {
649
+ id: "copy-rich",
650
+ label: "Copy as rich text",
651
+ description: "Rich text + Markdown",
652
+ onSelect: copy.copyRich
653
+ },
654
+ {
655
+ id: "copy-markdown",
656
+ label: "Copy as Markdown",
657
+ onSelect: copy.copyMarkdown
658
+ },
659
+ {
660
+ id: "copy-plain",
661
+ label: "Copy as plain text",
662
+ onSelect: copy.copyPlain
663
+ }
664
+ ]
665
+ }
666
+ }
667
+ ] : [],
668
+ ...showEditAction ? [
669
+ {
670
+ id: "edit",
671
+ label: "Edit message",
672
+ icon: /* @__PURE__ */ jsxRuntime.jsx(lucideReact.Pencil, { size: 14, "aria-hidden": "true" }),
673
+ onSelect: startEdit
674
+ }
675
+ ] : []
676
+ ];
677
+ return /* @__PURE__ */ jsxRuntime.jsxs(
678
+ "div",
679
+ {
680
+ "data-slot": "superchat-message",
681
+ role: "article",
682
+ "aria-label": `${authorName}, ${formatTime(message.time)}`,
683
+ className: chunkS5RVSXDV_cjs.cn(
684
+ "group flex gap-2",
685
+ isSelf ? "flex-row-reverse" : "flex-row"
686
+ ),
687
+ children: [
688
+ /* @__PURE__ */ jsxRuntime.jsxs(
689
+ "div",
690
+ {
691
+ "data-slot": "superchat-message-gutter",
692
+ className: "flex shrink-0 flex-col items-center gap-1",
693
+ children: [
694
+ /* @__PURE__ */ jsxRuntime.jsx(ParticipantAvatar, { participant }),
695
+ hasActions && /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
696
+ /* @__PURE__ */ jsxRuntime.jsx(
697
+ MessageOverflowMenu,
698
+ {
699
+ isSelf,
700
+ actions,
701
+ footerVisible: collapseToMenu ? false : footerVisible
702
+ }
703
+ ),
704
+ !collapseToMenu && /* @__PURE__ */ jsxRuntime.jsx(
705
+ MessageActionsBar,
706
+ {
707
+ ref: actionsBarRef,
708
+ actions,
709
+ isSelf
710
+ }
711
+ )
712
+ ] })
713
+ ]
714
+ }
715
+ ),
716
+ /* @__PURE__ */ jsxRuntime.jsxs(
717
+ "div",
718
+ {
719
+ className: chunkS5RVSXDV_cjs.cn(
720
+ "flex min-w-0 flex-1 flex-col gap-1",
721
+ isSelf && "items-end"
722
+ ),
723
+ children: [
724
+ /* @__PURE__ */ jsxRuntime.jsxs(
725
+ "div",
726
+ {
727
+ "data-slot": "superchat-message-meta",
728
+ className: "flex items-baseline gap-2",
729
+ children: [
730
+ /* @__PURE__ */ jsxRuntime.jsx(
731
+ "span",
732
+ {
733
+ className: "text-xs font-medium",
734
+ style: accentTextColor ? { color: accentTextColor } : void 0,
735
+ children: authorName
736
+ }
737
+ ),
738
+ participant?.role && /* @__PURE__ */ jsxRuntime.jsx("span", { className: "text-[10px] text-neutral-500 dark:text-neutral-400", children: participant.role }),
739
+ /* @__PURE__ */ jsxRuntime.jsx("span", { className: "text-[10px] text-neutral-500 dark:text-neutral-400", children: formatTime(message.time) }),
740
+ message.editedAt && /* @__PURE__ */ jsxRuntime.jsx(
741
+ "span",
742
+ {
743
+ "data-slot": "superchat-edited-indicator",
744
+ className: "text-[10px] text-neutral-500 dark:text-neutral-400",
745
+ title: `Edited ${formatTime(message.editedAt)}`,
746
+ children: "(edited)"
747
+ }
748
+ )
749
+ ]
750
+ }
751
+ ),
752
+ /* @__PURE__ */ jsxRuntime.jsx(
753
+ "div",
754
+ {
755
+ className: chunkS5RVSXDV_cjs.cn(
756
+ "flex w-full items-center gap-1",
757
+ isSelf ? "flex-row-reverse" : "flex-row"
758
+ ),
759
+ children: /* @__PURE__ */ jsxRuntime.jsx(
760
+ chunkXRVMYT5G_cjs.ChatBubble,
761
+ {
762
+ ref: bubbleRef,
763
+ "data-slot": "superchat-bubble",
764
+ variant: isSelf ? "user" : "assistant",
765
+ hasError: message.status === "error",
766
+ className: "text-sm has-[[data-slot=superchat-nitro-table]]:w-full has-[[data-slot=superchat-nitro-table]]:max-w-full",
767
+ children: isEditing ? /* @__PURE__ */ jsxRuntime.jsxs(
768
+ "div",
769
+ {
770
+ "data-slot": "superchat-message-editor",
771
+ className: "flex w-80 max-w-full flex-col gap-2",
772
+ style: editMinWidth ? { minWidth: editMinWidth } : void 0,
773
+ children: [
774
+ /* @__PURE__ */ jsxRuntime.jsx(
775
+ "textarea",
776
+ {
777
+ value: draft,
778
+ ref: editRef,
779
+ rows: 2,
780
+ onChange: (e) => {
781
+ setDraft(e.target.value);
782
+ autosize();
783
+ },
784
+ onPaste: handleEditPaste,
785
+ onKeyDown: (e) => {
786
+ if (e.key === "Enter" && !e.shiftKey) {
787
+ e.preventDefault();
788
+ saveEdit();
789
+ } else if (e.key === "Escape") {
790
+ e.preventDefault();
791
+ cancelEdit();
792
+ }
793
+ },
794
+ "aria-label": "Edit message",
795
+ className: "focus:ring-primary-500 max-h-60 min-h-16 w-full resize-none rounded-lg border border-neutral-300 bg-white px-3 py-2 text-sm text-neutral-900 focus:ring-1 focus:outline-none dark:border-neutral-600 dark:bg-neutral-900 dark:text-white"
796
+ }
797
+ ),
798
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex justify-end gap-2", children: [
799
+ /* @__PURE__ */ jsxRuntime.jsx(
800
+ "button",
801
+ {
802
+ type: "button",
803
+ onClick: cancelEdit,
804
+ className: "rounded-md px-2.5 py-1 text-xs font-medium text-neutral-200 hover:bg-white/10",
805
+ children: "Cancel"
806
+ }
807
+ ),
808
+ /* @__PURE__ */ jsxRuntime.jsx(
809
+ "button",
810
+ {
811
+ type: "button",
812
+ onClick: saveEdit,
813
+ disabled: !draft.trim() || draft.trim() === message.text,
814
+ className: "rounded-md bg-white px-2.5 py-1 text-xs font-medium text-neutral-900 hover:bg-neutral-100 disabled:opacity-40",
815
+ children: "Save"
816
+ }
817
+ )
818
+ ] })
819
+ ]
820
+ }
821
+ ) : /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
822
+ message.content?.map((block, i) => {
823
+ if (block.type === "tool_use" && block.toolCall) {
824
+ return /* @__PURE__ */ jsxRuntime.jsx(chunkXRVMYT5G_cjs.MCPToolCallDisplay, { toolCall: block.toolCall }, i);
825
+ }
826
+ if ((block.type === "text" || block.type === "thinking") && block.text) {
827
+ return /* @__PURE__ */ jsxRuntime.jsx(
828
+ "div",
829
+ {
830
+ className: "prose prose-sm dark:prose-invert max-w-none **:wrap-break-word",
831
+ children: renderText(block.text, {
832
+ messageId: message.id,
833
+ streaming,
834
+ role: participant?.kind === "human" ? "user" : "assistant"
835
+ })
836
+ },
837
+ i
838
+ );
839
+ }
840
+ if (block.type === "code" && block.text) {
841
+ const fenced = `\`\`\`${block.language ?? ""}
842
+ ${block.text}
843
+ \`\`\``;
844
+ return /* @__PURE__ */ jsxRuntime.jsx(
845
+ "div",
846
+ {
847
+ className: "prose prose-sm dark:prose-invert max-w-none **:wrap-break-word",
848
+ children: renderText(fenced, {
849
+ messageId: message.id,
850
+ streaming,
851
+ role: participant?.kind === "human" ? "user" : "assistant"
852
+ })
853
+ },
854
+ i
855
+ );
856
+ }
857
+ return null;
858
+ }),
859
+ message.text && /* @__PURE__ */ jsxRuntime.jsx("div", { className: "prose prose-sm dark:prose-invert max-w-none **:wrap-break-word", children: renderText(message.text, {
860
+ messageId: message.id,
861
+ streaming,
862
+ role: participant?.kind === "human" ? "user" : "assistant"
863
+ }) }),
864
+ message.media?.map((attachment) => /* @__PURE__ */ jsxRuntime.jsx(
865
+ MessageMedia,
866
+ {
867
+ attachment,
868
+ openLabel: openMediaLabel,
869
+ playLabel: playMediaLabel,
870
+ errorLabel: mediaErrorLabel,
871
+ retryLabel: mediaRetryLabel,
872
+ launchId: JSON.stringify([message.id, attachment.id]),
873
+ onOpen: onOpenMedia ? (play) => onOpenMedia(message.id, attachment.id, play) : void 0
874
+ },
875
+ attachment.id
876
+ )),
877
+ streaming && !hasBody && /* @__PURE__ */ jsxRuntime.jsx("div", { className: "flex items-center justify-center", children: /* @__PURE__ */ jsxRuntime.jsx(chunkXRVMYT5G_cjs.AITypingIndicator, {}) })
878
+ ] })
879
+ }
880
+ )
881
+ }
882
+ )
883
+ ]
884
+ }
885
+ )
886
+ ]
887
+ }
888
+ );
889
+ });
890
+ var sidebarItem = classVarianceAuthority.cva(
891
+ "flex w-full items-center gap-2 rounded-lg px-3 py-2 text-start text-sm transition-colors",
892
+ {
893
+ variants: {
894
+ active: {
895
+ true: "bg-primary-100 text-primary-900 dark:bg-primary-900/40 dark:text-primary-100",
896
+ false: "text-neutral-700 hover:bg-neutral-100 dark:text-neutral-200 dark:hover:bg-neutral-800"
897
+ }
898
+ },
899
+ defaultVariants: { active: false }
900
+ }
901
+ );
902
+
903
+ // src/components/SuperChat/media.ts
904
+ function getConversationMediaItems(conversation) {
905
+ const participants = new Map(
906
+ conversation.participants.map((participant) => [
907
+ participant.id,
908
+ participant
909
+ ])
910
+ );
911
+ return [...conversation.thread].sort(byTime).flatMap(
912
+ (message) => (message.media ?? []).map((attachment) => ({
913
+ // Tuple encoding prevents collisions when ids themselves contain a
914
+ // delimiter. Including the conversation keeps selection scoped to it.
915
+ id: JSON.stringify([conversation.id, message.id, attachment.id]),
916
+ conversationId: conversation.id,
917
+ message,
918
+ attachment,
919
+ participant: participants.get(message.participantId)
920
+ }))
921
+ );
922
+ }
923
+ function remarkPreserveLineBreaks() {
924
+ const splitNode = (node) => {
925
+ if (!node.children) return;
926
+ const next = [];
927
+ for (const child of node.children) {
928
+ if (child.type === "text" && child.value && child.value.includes("\n")) {
929
+ const segments = child.value.split("\n");
930
+ segments.forEach((segment, i) => {
931
+ if (i > 0) next.push({ type: "break" });
932
+ if (segment) next.push({ type: "text", value: segment });
933
+ });
934
+ } else {
935
+ splitNode(child);
936
+ next.push(child);
937
+ }
938
+ }
939
+ node.children = next;
940
+ };
941
+ return (tree) => splitNode(tree);
942
+ }
943
+ function baseSanitizeSchema() {
944
+ const schema = JSON.parse(JSON.stringify(rehypeSanitize.defaultSchema));
945
+ const attributes = schema.attributes ?? {};
946
+ const allowClass = (tag) => {
947
+ const existing = attributes[tag] ?? [];
948
+ const withoutClass = existing.filter(
949
+ (a) => !(Array.isArray(a) && a[0] === "className")
950
+ );
951
+ attributes[tag] = [...withoutClass, "className"];
952
+ };
953
+ allowClass("code");
954
+ allowClass("pre");
955
+ allowClass("span");
956
+ allowClass("div");
957
+ schema.attributes = attributes;
958
+ return schema;
959
+ }
960
+ function mergeSanitizeSchema(base, extra) {
961
+ if (!extra) return base;
962
+ const out = { ...base };
963
+ if (Array.isArray(extra.tagNames)) {
964
+ const a = base.tagNames ?? [];
965
+ out.tagNames = Array.from(/* @__PURE__ */ new Set([...a, ...extra.tagNames]));
966
+ }
967
+ if (extra.attributes && typeof extra.attributes === "object") {
968
+ const baseAttrs = {
969
+ ...base.attributes ?? {}
970
+ };
971
+ for (const [tag, attrs] of Object.entries(
972
+ extra.attributes
973
+ )) {
974
+ baseAttrs[tag] = [...baseAttrs[tag] ?? [], ...attrs];
975
+ }
976
+ out.attributes = baseAttrs;
977
+ }
978
+ if (extra.protocols && typeof extra.protocols === "object") {
979
+ const baseProtocols = {
980
+ ...base.protocols ?? {}
981
+ };
982
+ for (const [attr, protocols] of Object.entries(
983
+ extra.protocols
984
+ )) {
985
+ baseProtocols[attr] = Array.from(
986
+ /* @__PURE__ */ new Set([...baseProtocols[attr] ?? [], ...protocols])
987
+ );
714
988
  }
715
- return "";
716
- }).filter(Boolean).join("\n\n") ?? "";
717
- const canCopy = !isEditing && (!!message.content?.length || typeof message.text === "string" && message.text.length > 0);
718
- const hasActions = canCopy || canEdit && !isEditing;
719
- const copy = useMessageCopy({
720
- markdown: markdownSource,
721
- getHtml: () => bubbleRef.current?.innerHTML ?? "",
722
- getText: () => bubbleRef.current?.textContent ?? "",
723
- defaultFormat: defaultCopyFormat
724
- });
725
- const actionsBarRef = React2__namespace.useRef(null);
726
- const [footerVisible, setFooterVisible] = React2__namespace.useState(true);
727
- React2__namespace.useEffect(() => {
728
- const el = actionsBarRef.current;
729
- if (!el || typeof globalThis.IntersectionObserver === "undefined") return;
730
- const observer = new globalThis.IntersectionObserver(([entry]) => {
731
- setFooterVisible(entry?.isIntersecting ?? false);
732
- });
733
- observer.observe(el);
734
- return () => observer.disconnect();
735
- }, [hasActions]);
736
- if (message.type === "system") {
737
- return /* @__PURE__ */ jsxRuntime.jsx(
738
- "div",
989
+ out.protocols = baseProtocols;
990
+ }
991
+ for (const [k, v] of Object.entries(extra)) {
992
+ if (k === "tagNames" || k === "attributes" || k === "protocols") continue;
993
+ out[k] = v;
994
+ }
995
+ return out;
996
+ }
997
+ function baseComponents() {
998
+ return {
999
+ a: ({ node: _node, children, ...props }) => /* @__PURE__ */ jsxRuntime.jsx(
1000
+ "a",
739
1001
  {
740
- "data-slot": "superchat-system-message",
741
- role: "status",
742
- className: "my-1 text-center text-xs text-neutral-500 dark:text-neutral-400",
743
- children: message.text
1002
+ ...props,
1003
+ className: chunkS5RVSXDV_cjs.cn(
1004
+ "text-primary-800 hover:text-primary-900 dark:text-primary-300 underline underline-offset-2",
1005
+ props.className
1006
+ ),
1007
+ target: props.target ?? "_blank",
1008
+ rel: props.rel ?? "noopener noreferrer",
1009
+ children
744
1010
  }
745
- );
746
- }
747
- if (message.type === "ref" && message.ref) {
748
- return /* @__PURE__ */ jsxRuntime.jsx(
749
- "div",
1011
+ ),
1012
+ pre: ({ node: _node, ...props }) => /* @__PURE__ */ jsxRuntime.jsx(
1013
+ "pre",
750
1014
  {
751
- "data-slot": "superchat-reference",
752
- className: chunkS5RVSXDV_cjs.cn("flex", isSelf && "justify-end"),
753
- children: /* @__PURE__ */ jsxRuntime.jsx(
754
- ReferenceChip,
1015
+ ...props,
1016
+ tabIndex: 0,
1017
+ className: chunkS5RVSXDV_cjs.cn(
1018
+ "overflow-x-auto rounded-lg bg-neutral-900 p-3 text-sm text-neutral-100 dark:bg-neutral-950",
1019
+ props.className
1020
+ )
1021
+ }
1022
+ ),
1023
+ code: ({ node: _node, ...props }) => {
1024
+ const isBlock = typeof props.className === "string" && props.className.includes("language-");
1025
+ return /* @__PURE__ */ jsxRuntime.jsx(
1026
+ "code",
1027
+ {
1028
+ ...props,
1029
+ className: chunkS5RVSXDV_cjs.cn(
1030
+ !isBlock && "rounded bg-neutral-200 px-1 py-0.5 text-[0.85em] text-neutral-800 dark:bg-neutral-700 dark:text-neutral-100",
1031
+ props.className
1032
+ )
1033
+ }
1034
+ );
1035
+ },
1036
+ input: ({ node: _node, ...props }) => {
1037
+ if (props.type === "checkbox") {
1038
+ return /* @__PURE__ */ jsxRuntime.jsx(
1039
+ "input",
755
1040
  {
756
- reference: message.ref,
757
- linkBuilder,
758
- onReferenceClick
1041
+ ...props,
1042
+ "aria-label": props["aria-label"] ?? (props["aria-labelledby"] ? void 0 : "Task list item")
759
1043
  }
1044
+ );
1045
+ }
1046
+ return /* @__PURE__ */ jsxRuntime.jsx("input", { ...props });
1047
+ },
1048
+ table: ({ node: _node, ...props }) => /* @__PURE__ */ jsxRuntime.jsx("div", { className: "my-2 overflow-x-auto", children: /* @__PURE__ */ jsxRuntime.jsx(
1049
+ "table",
1050
+ {
1051
+ ...props,
1052
+ className: chunkS5RVSXDV_cjs.cn(
1053
+ "w-full border-collapse text-sm [&_td]:border [&_td]:border-neutral-200 [&_td]:px-2 [&_td]:py-1 dark:[&_td]:border-neutral-700 [&_th]:border [&_th]:border-neutral-200 [&_th]:px-2 [&_th]:py-1 [&_th]:text-start dark:[&_th]:border-neutral-700",
1054
+ props.className
760
1055
  )
761
1056
  }
762
- );
763
- }
764
- const accent = participant?.color;
765
- const accentTextColor = accessibleAccentTextColor(accent);
766
- const authorName = participant?.name ?? "Unknown";
767
- const startEdit = () => {
768
- setDraft(message.text ?? "");
769
- setIsEditing(true);
770
- };
771
- const cancelEdit = () => setIsEditing(false);
772
- const saveEdit = () => {
773
- const next = draft.trim();
774
- if (next && next !== message.text) onMessageEdited?.(message.id, next);
775
- setIsEditing(false);
776
- };
777
- const handleEditPaste = (e) => {
778
- const files = Array.from(e.clipboardData.items).filter((item) => item.kind === "file" && item.type.startsWith("image/")).map((item) => item.getAsFile()).filter((f) => f !== null);
779
- if (files.length === 0) return;
780
- e.preventDefault();
781
- const el = e.currentTarget;
782
- const start = el.selectionStart ?? draft.length;
783
- const end = el.selectionEnd ?? draft.length;
784
- Promise.all(
785
- files.map(
786
- (file, i) => new Promise((resolve) => {
787
- const reader = new window.FileReader();
788
- reader.onload = () => {
789
- const dataUrl = typeof reader.result === "string" ? reader.result : "";
790
- const name = file.name || `pasted-image-${i + 1}.png`;
791
- resolve(dataUrl ? `![${name}](${dataUrl})` : "");
792
- };
793
- reader.readAsDataURL(file);
794
- })
795
- )
796
- ).then((snippets) => {
797
- const insert = snippets.filter(Boolean).join("\n");
798
- if (!insert) return;
799
- el.focus();
800
- el.setSelectionRange(start, end);
801
- const text = `${insert}
802
- `;
803
- const inserted = typeof document !== "undefined" && typeof document.execCommand === "function" && document.execCommand("insertText", false, text);
804
- if (!inserted) {
805
- setDraft((prev) => `${prev.slice(0, start)}${text}${prev.slice(end)}`);
1057
+ ) }),
1058
+ // Tailwind's preflight resets list markers/padding; restore them explicitly
1059
+ // so bullets/numbers show without depending on the typography plugin.
1060
+ ul: ({ node: _node, ...props }) => /* @__PURE__ */ jsxRuntime.jsx("ul", { ...props, className: chunkS5RVSXDV_cjs.cn("list-disc ps-5", props.className) }),
1061
+ ol: ({ node: _node, ...props }) => /* @__PURE__ */ jsxRuntime.jsx("ol", { ...props, className: chunkS5RVSXDV_cjs.cn("list-decimal ps-5", props.className) }),
1062
+ li: ({ node: _node, ...props }) => /* @__PURE__ */ jsxRuntime.jsx("li", { ...props, className: chunkS5RVSXDV_cjs.cn("ps-1", props.className) }),
1063
+ // Preflight also flattens headings to body size/weight; restore a sensible
1064
+ // hierarchy without depending on the typography plugin.
1065
+ h1: ({ node: _node, children, ...props }) => /* @__PURE__ */ jsxRuntime.jsx(
1066
+ "h1",
1067
+ {
1068
+ ...props,
1069
+ className: chunkS5RVSXDV_cjs.cn("mt-3 mb-1 text-xl font-semibold", props.className),
1070
+ children
806
1071
  }
807
- requestAnimationFrame(autosize);
808
- });
809
- };
810
- const actions = [
811
- ...canCopy ? [
1072
+ ),
1073
+ h2: ({ node: _node, children, ...props }) => /* @__PURE__ */ jsxRuntime.jsx(
1074
+ "h2",
812
1075
  {
813
- id: "copy",
814
- label: "Copy message",
815
- title: "Copy message (\u2318/Ctrl-click: default format)",
816
- icon: copy.copied ? /* @__PURE__ */ jsxRuntime.jsx(lucideReact.Check, { size: 14, "aria-hidden": "true" }) : /* @__PURE__ */ jsxRuntime.jsx(lucideReact.Clipboard, { size: 14, "aria-hidden": "true" }),
817
- onSelect: copy.copyDefault,
818
- submenu: {
819
- label: "Copy as",
820
- items: [
821
- {
822
- id: "copy-rich",
823
- label: "Copy as rich text",
824
- description: "Rich text + Markdown",
825
- onSelect: copy.copyRich
826
- },
827
- {
828
- id: "copy-markdown",
829
- label: "Copy as Markdown",
830
- onSelect: copy.copyMarkdown
831
- },
832
- {
833
- id: "copy-plain",
834
- label: "Copy as plain text",
835
- onSelect: copy.copyPlain
836
- }
837
- ]
838
- }
1076
+ ...props,
1077
+ className: chunkS5RVSXDV_cjs.cn("mt-3 mb-1 text-lg font-semibold", props.className),
1078
+ children
1079
+ }
1080
+ ),
1081
+ h3: ({ node: _node, children, ...props }) => /* @__PURE__ */ jsxRuntime.jsx(
1082
+ "h3",
1083
+ {
1084
+ ...props,
1085
+ className: chunkS5RVSXDV_cjs.cn("mt-2 mb-1 text-base font-semibold", props.className),
1086
+ children
1087
+ }
1088
+ ),
1089
+ h4: ({ node: _node, children, ...props }) => /* @__PURE__ */ jsxRuntime.jsx(
1090
+ "h4",
1091
+ {
1092
+ ...props,
1093
+ className: chunkS5RVSXDV_cjs.cn("mt-2 mb-1 text-sm font-semibold", props.className),
1094
+ children
839
1095
  }
840
- ] : [],
841
- ...canEdit && !isEditing ? [
1096
+ ),
1097
+ h5: ({ node: _node, children, ...props }) => /* @__PURE__ */ jsxRuntime.jsx(
1098
+ "h5",
842
1099
  {
843
- id: "edit",
844
- label: "Edit message",
845
- icon: /* @__PURE__ */ jsxRuntime.jsx(lucideReact.Pencil, { size: 14, "aria-hidden": "true" }),
846
- onSelect: startEdit
1100
+ ...props,
1101
+ className: chunkS5RVSXDV_cjs.cn("mt-2 mb-1 text-sm font-semibold", props.className),
1102
+ children
847
1103
  }
848
- ] : []
1104
+ ),
1105
+ h6: ({ node: _node, children, ...props }) => /* @__PURE__ */ jsxRuntime.jsx(
1106
+ "h6",
1107
+ {
1108
+ ...props,
1109
+ className: chunkS5RVSXDV_cjs.cn(
1110
+ "mt-2 mb-1 text-xs font-semibold tracking-wide uppercase",
1111
+ props.className
1112
+ ),
1113
+ children
1114
+ }
1115
+ ),
1116
+ hr: ({ node: _node, ...props }) => /* @__PURE__ */ jsxRuntime.jsx(
1117
+ "hr",
1118
+ {
1119
+ ...props,
1120
+ className: chunkS5RVSXDV_cjs.cn(
1121
+ "my-2 border-neutral-300 dark:border-neutral-600",
1122
+ props.className
1123
+ )
1124
+ }
1125
+ )
1126
+ };
1127
+ }
1128
+ function createMarkdownRenderer(options = {}) {
1129
+ const { plugins = [], trusted = false } = options;
1130
+ const remarkPlugins = [
1131
+ remarkGfm__default.default,
1132
+ remarkPreserveLineBreaks,
1133
+ ...plugins.flatMap((p) => p.remarkPlugins ?? [])
849
1134
  ];
850
- return /* @__PURE__ */ jsxRuntime.jsxs(
851
- "div",
852
- {
853
- "data-slot": "superchat-message",
854
- role: "article",
855
- "aria-label": `${authorName}, ${formatTime(message.time)}`,
856
- className: chunkS5RVSXDV_cjs.cn(
857
- "group flex gap-2",
858
- isSelf ? "flex-row-reverse" : "flex-row"
859
- ),
860
- children: [
861
- /* @__PURE__ */ jsxRuntime.jsx(ParticipantAvatar, { participant }),
862
- /* @__PURE__ */ jsxRuntime.jsxs("div", { className: chunkS5RVSXDV_cjs.cn("flex min-w-0 flex-col gap-1", isSelf && "items-end"), children: [
863
- /* @__PURE__ */ jsxRuntime.jsxs(
864
- "div",
865
- {
866
- "data-slot": "superchat-message-meta",
867
- className: "flex items-baseline gap-2",
868
- children: [
869
- /* @__PURE__ */ jsxRuntime.jsx(
870
- "span",
871
- {
872
- className: "text-xs font-medium",
873
- style: accentTextColor ? { color: accentTextColor } : void 0,
874
- children: authorName
875
- }
876
- ),
877
- participant?.role && /* @__PURE__ */ jsxRuntime.jsx("span", { className: "text-[10px] text-neutral-500 dark:text-neutral-400", children: participant.role }),
878
- /* @__PURE__ */ jsxRuntime.jsx("span", { className: "text-[10px] text-neutral-500 dark:text-neutral-400", children: formatTime(message.time) }),
879
- message.editedAt && /* @__PURE__ */ jsxRuntime.jsx(
880
- "span",
881
- {
882
- "data-slot": "superchat-edited-indicator",
883
- className: "text-[10px] text-neutral-500 dark:text-neutral-400",
884
- title: `Edited ${formatTime(message.editedAt)}`,
885
- children: "(edited)"
886
- }
887
- )
888
- ]
889
- }
890
- ),
891
- /* @__PURE__ */ jsxRuntime.jsxs(
892
- "div",
893
- {
894
- className: chunkS5RVSXDV_cjs.cn(
895
- "flex items-center gap-1",
896
- isSelf ? "flex-row-reverse" : "flex-row"
897
- ),
898
- children: [
899
- hasActions && /* @__PURE__ */ jsxRuntime.jsx(
900
- MessageOverflowMenu,
901
- {
902
- isSelf,
903
- actions,
904
- footerVisible
905
- }
906
- ),
907
- /* @__PURE__ */ jsxRuntime.jsx(
908
- chunkWIAQQNFU_cjs.ChatBubble,
909
- {
910
- ref: bubbleRef,
911
- "data-slot": "superchat-bubble",
912
- variant: isSelf ? "user" : "assistant",
913
- hasError: message.status === "error",
914
- className: "text-sm has-[[data-slot=superchat-nitro-table]]:w-full has-[[data-slot=superchat-nitro-table]]:max-w-full",
915
- children: isEditing ? /* @__PURE__ */ jsxRuntime.jsxs(
916
- "div",
917
- {
918
- "data-slot": "superchat-message-editor",
919
- className: "flex w-80 max-w-full flex-col gap-2",
920
- children: [
921
- /* @__PURE__ */ jsxRuntime.jsx(
922
- "textarea",
923
- {
924
- value: draft,
925
- ref: editRef,
926
- rows: 2,
927
- onChange: (e) => {
928
- setDraft(e.target.value);
929
- autosize();
930
- },
931
- onPaste: handleEditPaste,
932
- onKeyDown: (e) => {
933
- if (e.key === "Enter" && !e.shiftKey) {
934
- e.preventDefault();
935
- saveEdit();
936
- } else if (e.key === "Escape") {
937
- e.preventDefault();
938
- cancelEdit();
939
- }
940
- },
941
- "aria-label": "Edit message",
942
- className: "focus:ring-primary-500 max-h-60 min-h-16 w-full resize-none rounded-lg border border-neutral-300 bg-white px-3 py-2 text-sm text-neutral-900 focus:ring-1 focus:outline-none dark:border-neutral-600 dark:bg-neutral-900 dark:text-white"
943
- }
944
- ),
945
- /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex justify-end gap-2", children: [
946
- /* @__PURE__ */ jsxRuntime.jsx(
947
- "button",
948
- {
949
- type: "button",
950
- onClick: cancelEdit,
951
- className: "rounded-md px-2.5 py-1 text-xs font-medium text-neutral-200 hover:bg-white/10",
952
- children: "Cancel"
953
- }
954
- ),
955
- /* @__PURE__ */ jsxRuntime.jsx(
956
- "button",
957
- {
958
- type: "button",
959
- onClick: saveEdit,
960
- disabled: !draft.trim() || draft.trim() === message.text,
961
- className: "rounded-md bg-white px-2.5 py-1 text-xs font-medium text-neutral-900 hover:bg-neutral-100 disabled:opacity-40",
962
- children: "Save"
963
- }
964
- )
965
- ] })
966
- ]
967
- }
968
- ) : /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
969
- message.content?.map((block, i) => {
970
- if (block.type === "tool_use" && block.toolCall) {
971
- return /* @__PURE__ */ jsxRuntime.jsx(chunkWIAQQNFU_cjs.MCPToolCallDisplay, { toolCall: block.toolCall }, i);
972
- }
973
- if ((block.type === "text" || block.type === "thinking") && block.text) {
974
- return /* @__PURE__ */ jsxRuntime.jsx(
975
- "div",
976
- {
977
- className: "prose prose-sm dark:prose-invert max-w-none **:wrap-break-word",
978
- children: renderText(block.text, {
979
- messageId: message.id,
980
- streaming,
981
- role: participant?.kind === "human" ? "user" : "assistant"
982
- })
983
- },
984
- i
985
- );
986
- }
987
- if (block.type === "code" && block.text) {
988
- const fenced = `\`\`\`${block.language ?? ""}
989
- ${block.text}
990
- \`\`\``;
991
- return /* @__PURE__ */ jsxRuntime.jsx(
992
- "div",
993
- {
994
- className: "prose prose-sm dark:prose-invert max-w-none **:wrap-break-word",
995
- children: renderText(fenced, {
996
- messageId: message.id,
997
- streaming,
998
- role: participant?.kind === "human" ? "user" : "assistant"
999
- })
1000
- },
1001
- i
1002
- );
1003
- }
1004
- return null;
1005
- }),
1006
- message.text && /* @__PURE__ */ jsxRuntime.jsx("div", { className: "prose prose-sm dark:prose-invert max-w-none **:wrap-break-word", children: renderText(message.text, {
1007
- messageId: message.id,
1008
- streaming,
1009
- role: participant?.kind === "human" ? "user" : "assistant"
1010
- }) }),
1011
- streaming && !hasBody && /* @__PURE__ */ jsxRuntime.jsx("div", { className: "flex items-center justify-center", children: /* @__PURE__ */ jsxRuntime.jsx(chunkWIAQQNFU_cjs.AITypingIndicator, {}) })
1012
- ] })
1013
- }
1014
- )
1015
- ]
1016
- }
1017
- ),
1018
- hasActions && /* @__PURE__ */ jsxRuntime.jsx(
1019
- MessageActionsBar,
1020
- {
1021
- ref: actionsBarRef,
1022
- actions,
1023
- isSelf
1024
- }
1025
- )
1026
- ] })
1027
- ]
1028
- }
1135
+ const pluginRehype = plugins.flatMap(
1136
+ (p) => p.rehypePlugins ?? []
1029
1137
  );
1030
- });
1031
- var sidebarItem = classVarianceAuthority.cva(
1032
- "flex w-full items-center gap-2 rounded-lg px-3 py-2 text-start text-sm transition-colors",
1033
- {
1034
- variants: {
1035
- active: {
1036
- true: "bg-primary-100 text-primary-900 dark:bg-primary-900/40 dark:text-primary-100",
1037
- false: "text-neutral-700 hover:bg-neutral-100 dark:text-neutral-200 dark:hover:bg-neutral-800"
1038
- }
1138
+ const sanitizeSchema = plugins.reduce(
1139
+ (acc, p) => mergeSanitizeSchema(acc, p.sanitizeSchema),
1140
+ baseSanitizeSchema()
1141
+ );
1142
+ const rehypePlugins = trusted ? pluginRehype : [...pluginRehype, [rehypeSanitize__default.default, sanitizeSchema]];
1143
+ const components = plugins.reduce(
1144
+ (acc, p) => ({ ...acc, ...p.components }),
1145
+ baseComponents()
1146
+ );
1147
+ const MarkdownRenderer = (text, ctx) => /* @__PURE__ */ jsxRuntime.jsx(
1148
+ MarkdownContent,
1149
+ {
1150
+ text,
1151
+ messageId: ctx.messageId,
1152
+ streaming: ctx.streaming,
1153
+ remarkPlugins,
1154
+ rehypePlugins,
1155
+ components
1039
1156
  },
1040
- defaultVariants: { active: false }
1157
+ ctx.messageId
1158
+ );
1159
+ return MarkdownRenderer;
1160
+ }
1161
+ var transformUrl = (url, key, node) => {
1162
+ if (key === "src" && node.tagName === "img" && (/^data:image\//i.test(url) || /^blob:/i.test(url))) {
1163
+ return url;
1041
1164
  }
1042
- );
1165
+ return Markdown.defaultUrlTransform(url);
1166
+ };
1167
+ var MarkdownContent = React3__namespace.memo(function MarkdownContent2({
1168
+ text,
1169
+ messageId,
1170
+ streaming,
1171
+ remarkPlugins,
1172
+ rehypePlugins,
1173
+ components
1174
+ }) {
1175
+ return /* @__PURE__ */ jsxRuntime.jsx(chunkJFLC7SHM_cjs.TextRenderContext.Provider, { value: { messageId, streaming }, children: /* @__PURE__ */ jsxRuntime.jsx(
1176
+ Markdown__default.default,
1177
+ {
1178
+ remarkPlugins,
1179
+ rehypePlugins,
1180
+ urlTransform: transformUrl,
1181
+ components,
1182
+ children: text
1183
+ }
1184
+ ) });
1185
+ });
1043
1186
  function VirtualThread({
1044
1187
  items,
1045
1188
  participantById,
@@ -1050,32 +1193,28 @@ function VirtualThread({
1050
1193
  editable,
1051
1194
  onMessageEdited,
1052
1195
  defaultCopyFormat,
1053
- order,
1054
- conversationId,
1196
+ onOpenMedia,
1197
+ openMediaLabel,
1198
+ playMediaLabel,
1199
+ mediaErrorLabel,
1200
+ mediaRetryLabel,
1201
+ scrollRef,
1202
+ contentRef,
1055
1203
  containerProps
1056
1204
  }) {
1057
- const parentRef = React2__namespace.useRef(null);
1058
1205
  const virtualizer = reactVirtual.useVirtualizer({
1059
1206
  count: items.length,
1060
- getScrollElement: () => parentRef.current,
1207
+ getScrollElement: () => scrollRef.current,
1061
1208
  // Rough first guess; real heights are measured via measureElement.
1062
1209
  estimateSize: () => 88,
1063
1210
  overscan: 10,
1064
1211
  getItemKey: (index) => items[index]?.id ?? index
1065
1212
  });
1066
- const count = items.length;
1067
- React2__namespace.useEffect(() => {
1068
- if (count === 0) return;
1069
- if (order === "desc") {
1070
- virtualizer.scrollToIndex(0, { align: "start" });
1071
- } else {
1072
- virtualizer.scrollToIndex(count - 1, { align: "end" });
1073
- }
1074
- }, [count, conversationId, order]);
1075
1213
  const virtualItems = virtualizer.getVirtualItems();
1076
- return /* @__PURE__ */ jsxRuntime.jsx("div", { ...containerProps, ref: parentRef, children: /* @__PURE__ */ jsxRuntime.jsx(
1214
+ return /* @__PURE__ */ jsxRuntime.jsx("div", { ...containerProps, ref: scrollRef, children: /* @__PURE__ */ jsxRuntime.jsx(
1077
1215
  "div",
1078
1216
  {
1217
+ ref: contentRef,
1079
1218
  style: {
1080
1219
  height: virtualizer.getTotalSize(),
1081
1220
  position: "relative",
@@ -1107,7 +1246,12 @@ function VirtualThread({
1107
1246
  onReferenceClick,
1108
1247
  editable,
1109
1248
  onMessageEdited,
1110
- defaultCopyFormat
1249
+ defaultCopyFormat,
1250
+ onOpenMedia,
1251
+ openMediaLabel,
1252
+ playMediaLabel,
1253
+ mediaErrorLabel,
1254
+ mediaRetryLabel
1111
1255
  }
1112
1256
  ) })
1113
1257
  },
@@ -1119,6 +1263,11 @@ function VirtualThread({
1119
1263
  }
1120
1264
  function SuperChat({
1121
1265
  conversation,
1266
+ view,
1267
+ defaultView = "thread",
1268
+ onViewChange,
1269
+ mediaFeedProps,
1270
+ mediaLabels,
1122
1271
  currentParticipantId,
1123
1272
  renderPlugins,
1124
1273
  renderTextContent,
@@ -1130,44 +1279,366 @@ function SuperChat({
1130
1279
  linkBuilder,
1131
1280
  defaultCopyFormat,
1132
1281
  className,
1282
+ showHeader = true,
1283
+ placeholder,
1284
+ allowAttachments,
1285
+ agents,
1286
+ selectedAgent,
1287
+ onAgentChange,
1288
+ agentSelectorLabel,
1289
+ modelSelectorProps,
1290
+ isStreaming,
1291
+ onStop,
1292
+ stopLabel,
1133
1293
  onMessageSent,
1134
1294
  onMessageEdited,
1135
1295
  onConversationClosed,
1136
1296
  onReferenceClick,
1137
1297
  onBack
1138
1298
  }) {
1139
- const headingId = React2__namespace.useId();
1140
- React2__namespace.useEffect(() => {
1141
- chunkX4XPNTCZ_cjs.notifyComposerMigrationOnce("SuperChat");
1299
+ const headingId = React3__namespace.useId();
1300
+ const [internalView, setInternalView] = React3__namespace.useState({
1301
+ conversationId: conversation.id,
1302
+ view: defaultView
1303
+ });
1304
+ const activeView = view ?? (internalView.conversationId === conversation.id ? internalView.view : "thread");
1305
+ const labels = {
1306
+ backToConversation: "Back to conversation",
1307
+ openMedia: "Open in media feed",
1308
+ playMedia: "Play",
1309
+ unknownAuthor: "Unknown",
1310
+ ...mediaLabels
1311
+ };
1312
+ const mediaItems = React3__namespace.useMemo(() => {
1313
+ const items = getConversationMediaItems(conversation);
1314
+ return order === "desc" ? items.reverse() : items;
1315
+ }, [conversation, order]);
1316
+ const [mediaSelection, setMediaSelection] = React3__namespace.useState();
1317
+ const [manualPlaybackRequest, setManualPlaybackRequest] = React3__namespace.useState();
1318
+ const playbackRequestCounter = React3__namespace.useRef(0);
1319
+ const mediaFeedRef = React3__namespace.useRef(null);
1320
+ const backToConversationRef = React3__namespace.useRef(null);
1321
+ const focusMediaOnOpenRef = React3__namespace.useRef(false);
1322
+ const focusThreadOnBackRef = React3__namespace.useRef(false);
1323
+ const mediaReturnTargetRef = React3__namespace.useRef(void 0);
1324
+ const mediaContextRef = React3__namespace.useRef({
1325
+ conversation,
1326
+ view,
1327
+ onViewChange,
1328
+ mediaFeedProps,
1329
+ mediaItems
1330
+ });
1331
+ mediaContextRef.current = {
1332
+ conversation,
1333
+ view,
1334
+ onViewChange,
1335
+ mediaFeedProps,
1336
+ mediaItems
1337
+ };
1338
+ const setView = React3__namespace.useCallback((next) => {
1339
+ const context = mediaContextRef.current;
1340
+ if (context.view === void 0)
1341
+ setInternalView({ conversationId: context.conversation.id, view: next });
1342
+ context.onViewChange?.(next, { conversation: context.conversation });
1343
+ }, []);
1344
+ const handleMediaSelection = React3__namespace.useCallback((item) => {
1345
+ setMediaSelection({ conversationId: item.conversationId, itemId: item.id });
1346
+ mediaContextRef.current.mediaFeedProps?.onActiveItemChange?.(item);
1347
+ }, []);
1348
+ const handleOpenMedia = React3__namespace.useCallback(
1349
+ (messageId, attachmentId, play = false) => {
1350
+ const item = mediaContextRef.current.mediaItems.find(
1351
+ (candidate) => candidate.message.id === messageId && candidate.attachment.id === attachmentId
1352
+ );
1353
+ if (!item) return;
1354
+ handleMediaSelection(item);
1355
+ mediaReturnTargetRef.current = {
1356
+ conversationId: item.conversationId,
1357
+ messageId,
1358
+ attachmentId
1359
+ };
1360
+ focusMediaOnOpenRef.current = true;
1361
+ setManualPlaybackRequest(
1362
+ play ? {
1363
+ conversationId: item.conversationId,
1364
+ itemId: item.id,
1365
+ requestId: ++playbackRequestCounter.current
1366
+ } : void 0
1367
+ );
1368
+ setView("media");
1369
+ },
1370
+ [handleMediaSelection, setView]
1371
+ );
1372
+ const handleBackToConversation = React3__namespace.useCallback(() => {
1373
+ focusMediaOnOpenRef.current = false;
1374
+ focusThreadOnBackRef.current = true;
1375
+ setManualPlaybackRequest(void 0);
1376
+ setView("thread");
1377
+ }, [setView]);
1378
+ const hostPlaybackRequest = mediaFeedProps?.playbackRequest;
1379
+ const hostPlaybackKey = hostPlaybackRequest ? `${hostPlaybackRequest.itemId}\0${hostPlaybackRequest.requestId}` : void 0;
1380
+ React3__namespace.useEffect(() => {
1381
+ if (hostPlaybackKey === void 0) return;
1382
+ setManualPlaybackRequest(void 0);
1383
+ }, [hostPlaybackKey]);
1384
+ React3__namespace.useEffect(() => {
1385
+ if (internalView.conversationId !== conversation.id) {
1386
+ setInternalView({ conversationId: conversation.id, view: "thread" });
1387
+ }
1388
+ if (mediaReturnTargetRef.current?.conversationId !== conversation.id) {
1389
+ mediaReturnTargetRef.current = void 0;
1390
+ focusMediaOnOpenRef.current = false;
1391
+ focusThreadOnBackRef.current = false;
1392
+ setManualPlaybackRequest(void 0);
1393
+ }
1394
+ }, [conversation.id, internalView.conversationId]);
1395
+ React3__namespace.useEffect(() => {
1396
+ if (activeView !== "media" || !focusMediaOnOpenRef.current) return;
1397
+ const target = mediaFeedRef.current?.querySelector(
1398
+ 'article[tabindex="0"]'
1399
+ ) ?? mediaFeedRef.current?.querySelector('[role="feed"]');
1400
+ if (target) focusMediaOnOpenRef.current = false;
1401
+ (target ?? backToConversationRef.current)?.focus({ preventScroll: true });
1402
+ }, [
1403
+ activeView,
1404
+ mediaFeedProps?.loading,
1405
+ mediaFeedProps?.error,
1406
+ mediaItems.length
1407
+ ]);
1408
+ React3__namespace.useEffect(() => {
1409
+ chunkR5Z7AOVU_cjs.notifyComposerMigrationOnce("SuperChat");
1142
1410
  }, []);
1143
- const renderText = React2__namespace.useMemo(
1411
+ const renderText = React3__namespace.useMemo(
1144
1412
  () => renderTextContent ?? createMarkdownRenderer({
1145
1413
  plugins: renderPlugins,
1146
1414
  trusted: trustedContent
1147
1415
  }),
1148
1416
  [renderTextContent, renderPlugins, trustedContent]
1149
1417
  );
1150
- const threadRef = React2__namespace.useRef(null);
1151
- React2__namespace.useEffect(() => {
1152
- if (virtualized) return;
1153
- const el = threadRef.current;
1154
- if (!el) return;
1155
- el.scrollTop = order === "desc" ? 0 : el.scrollHeight;
1156
- }, [conversation.thread.length, conversation.id, order, virtualized]);
1157
- const participantById = React2__namespace.useMemo(() => {
1418
+ const prefersReducedMotion = chunkYW2AKBLS_cjs.usePrefersReducedMotion();
1419
+ const {
1420
+ containerRef: threadRef,
1421
+ contentRef: threadContentRef,
1422
+ isAtBottom,
1423
+ scrollToBottom,
1424
+ anchorToTurnStart,
1425
+ followIfPinned,
1426
+ stopFollowing
1427
+ } = chunkVPTASZ2O_cjs.useStickToBottom({
1428
+ disabled: order === "desc" || activeView === "media"
1429
+ });
1430
+ React3__namespace.useEffect(() => {
1431
+ if (activeView !== "thread") return;
1432
+ setManualPlaybackRequest(void 0);
1433
+ if (!focusThreadOnBackRef.current) return;
1434
+ focusThreadOnBackRef.current = false;
1435
+ const source = mediaReturnTargetRef.current;
1436
+ const launchId = source ? JSON.stringify([source.messageId, source.attachmentId]) : void 0;
1437
+ const launcher = source?.conversationId === conversation.id ? Array.from(
1438
+ threadRef.current?.querySelectorAll(
1439
+ "[data-media-launch-id]"
1440
+ ) ?? []
1441
+ ).find((button) => button.dataset.mediaLaunchId === launchId) : void 0;
1442
+ (launcher ?? threadRef.current)?.focus({ preventScroll: true });
1443
+ }, [activeView, conversation.id, threadRef]);
1444
+ const [hasNewBelow, setHasNewBelow] = React3__namespace.useState(false);
1445
+ const [turnStartId, setTurnStartId] = React3__namespace.useState(null);
1446
+ const [turnMinHeight, setTurnMinHeight] = React3__namespace.useState();
1447
+ const anchoredTurnRef = React3__namespace.useRef(null);
1448
+ const threadSnapshotRef = React3__namespace.useRef(void 0);
1449
+ const atBottomRef = React3__namespace.useRef(isAtBottom);
1450
+ atBottomRef.current = isAtBottom;
1451
+ const pendingMediaOwnSendRef = React3__namespace.useRef(false);
1452
+ const pendingMediaAppendRef = React3__namespace.useRef(false);
1453
+ React3__namespace.useEffect(() => {
1454
+ threadSnapshotRef.current = void 0;
1455
+ pendingMediaOwnSendRef.current = false;
1456
+ pendingMediaAppendRef.current = false;
1457
+ setTurnStartId(null);
1458
+ anchoredTurnRef.current = null;
1459
+ if (order === "desc") {
1460
+ const el = threadRef.current;
1461
+ if (el) el.scrollTop = 0;
1462
+ } else {
1463
+ scrollToBottom("auto");
1464
+ }
1465
+ setHasNewBelow(false);
1466
+ }, [conversation.id, order]);
1467
+ const threadLength = conversation.thread.length;
1468
+ const prevThreadLengthRef = React3__namespace.useRef(threadLength);
1469
+ const prevMessageIdsRef = React3__namespace.useRef(
1470
+ new Set(conversation.thread.map((message) => message.id))
1471
+ );
1472
+ const policyConversationRef = React3__namespace.useRef(conversation.id);
1473
+ const policyBaselinedRef = React3__namespace.useRef(false);
1474
+ React3__namespace.useEffect(() => {
1475
+ if (!policyBaselinedRef.current || policyConversationRef.current !== conversation.id) {
1476
+ policyBaselinedRef.current = true;
1477
+ policyConversationRef.current = conversation.id;
1478
+ prevThreadLengthRef.current = threadLength;
1479
+ prevMessageIdsRef.current = new Set(
1480
+ conversation.thread.map((message) => message.id)
1481
+ );
1482
+ if (order !== "desc" && [...conversation.thread].sort(byTime).at(-1)?.status === "streaming") {
1483
+ stopFollowing();
1484
+ }
1485
+ return;
1486
+ }
1487
+ if (threadLength === prevThreadLengthRef.current) return;
1488
+ const grew = threadLength > prevThreadLengthRef.current;
1489
+ prevThreadLengthRef.current = threadLength;
1490
+ if (grew && activeView === "media") pendingMediaAppendRef.current = true;
1491
+ if (order === "desc") {
1492
+ const el = threadRef.current;
1493
+ if (el) el.scrollTop = 0;
1494
+ return;
1495
+ }
1496
+ const prevIds = prevMessageIdsRef.current;
1497
+ let turnStart;
1498
+ if (grew && currentParticipantId) {
1499
+ for (const message of [...conversation.thread].sort(byTime)) {
1500
+ if (!prevIds.has(message.id) && message.participantId === currentParticipantId) {
1501
+ turnStart = message.id;
1502
+ }
1503
+ }
1504
+ }
1505
+ if (turnStart) {
1506
+ if (activeView === "media") pendingMediaOwnSendRef.current = true;
1507
+ if (virtualized) {
1508
+ scrollToBottom("auto");
1509
+ } else {
1510
+ setTurnStartId(turnStart);
1511
+ }
1512
+ } else if (grew) {
1513
+ const newest = [...conversation.thread].sort(byTime).at(-1);
1514
+ if (newest?.status === "streaming") {
1515
+ followIfPinned("auto");
1516
+ stopFollowing();
1517
+ } else if (!followIfPinned("auto")) {
1518
+ setHasNewBelow(true);
1519
+ }
1520
+ } else {
1521
+ followIfPinned("auto");
1522
+ }
1523
+ }, [threadLength, order, isAtBottom, conversation.id, activeView]);
1524
+ React3__namespace.useLayoutEffect(() => {
1525
+ if (activeView !== "thread") return;
1526
+ const container = threadRef.current;
1527
+ if (!container) return;
1528
+ const snapshot = threadSnapshotRef.current;
1529
+ const sameThread = snapshot?.conversationId === conversation.id && snapshot.order === order;
1530
+ const ownSend = pendingMediaOwnSendRef.current;
1531
+ const appended = pendingMediaAppendRef.current;
1532
+ pendingMediaOwnSendRef.current = false;
1533
+ pendingMediaAppendRef.current = false;
1534
+ if (order === "desc") {
1535
+ container.scrollTop = sameThread && !appended ? snapshot.scrollTop : 0;
1536
+ } else if (ownSend && !virtualized) ; else if (sameThread && !ownSend && (!snapshot.atBottom || !appended)) {
1537
+ container.scrollTop = snapshot.scrollTop;
1538
+ if (!snapshot.atBottom) stopFollowing();
1539
+ } else {
1540
+ scrollToBottom("auto");
1541
+ if ([...conversation.thread].sort(byTime).at(-1)?.status === "streaming")
1542
+ stopFollowing();
1543
+ }
1544
+ return () => {
1545
+ threadSnapshotRef.current = {
1546
+ conversationId: conversation.id,
1547
+ order,
1548
+ scrollTop: container.scrollTop,
1549
+ atBottom: atBottomRef.current
1550
+ };
1551
+ };
1552
+ }, [conversation.id, order, activeView, virtualized]);
1553
+ React3__namespace.useLayoutEffect(() => {
1554
+ if (!turnStartId || anchoredTurnRef.current === turnStartId) return;
1555
+ const container = threadRef.current;
1556
+ if (!container) return;
1557
+ const reserve = Math.max(0, container.clientHeight - 32);
1558
+ if (turnMinHeight !== reserve) {
1559
+ setTurnMinHeight(reserve);
1560
+ return;
1561
+ }
1562
+ const target = container.querySelector(
1563
+ '[data-slot="superchat-turn"]'
1564
+ );
1565
+ if (target) {
1566
+ anchorToTurnStart(target, prefersReducedMotion ? "auto" : "smooth");
1567
+ anchoredTurnRef.current = turnStartId;
1568
+ }
1569
+ }, [
1570
+ turnStartId,
1571
+ turnMinHeight,
1572
+ anchorToTurnStart,
1573
+ prefersReducedMotion,
1574
+ threadRef,
1575
+ activeView
1576
+ ]);
1577
+ React3__namespace.useEffect(() => {
1578
+ prevMessageIdsRef.current = new Set(
1579
+ conversation.thread.map((message) => message.id)
1580
+ );
1581
+ });
1582
+ React3__namespace.useEffect(() => {
1583
+ if (isAtBottom) setHasNewBelow(false);
1584
+ }, [isAtBottom]);
1585
+ const newestMessage = React3__namespace.useMemo(
1586
+ () => [...conversation.thread].sort(byTime).at(-1),
1587
+ [conversation]
1588
+ );
1589
+ const raiseNewBelow = React3__namespace.useCallback(() => {
1590
+ if (order !== "desc") setHasNewBelow(true);
1591
+ }, [order]);
1592
+ const resumeFollowing = React3__namespace.useCallback(() => {
1593
+ if (order !== "desc") scrollToBottom("auto");
1594
+ }, [order, scrollToBottom]);
1595
+ chunkVPTASZ2O_cjs.useStreamEndedBelowFold(
1596
+ newestMessage,
1597
+ isAtBottom,
1598
+ raiseNewBelow,
1599
+ resumeFollowing
1600
+ );
1601
+ const handleJumpToBottom = React3__namespace.useCallback(() => {
1602
+ scrollToBottom(prefersReducedMotion ? "auto" : "smooth");
1603
+ }, [scrollToBottom, prefersReducedMotion]);
1604
+ const participantById = React3__namespace.useMemo(() => {
1158
1605
  const map = /* @__PURE__ */ new Map();
1159
1606
  conversation.participants.forEach((p) => map.set(p.id, p));
1160
1607
  return map;
1161
1608
  }, [conversation]);
1162
- const orderedThread = React2__namespace.useMemo(() => {
1609
+ const orderedThread = React3__namespace.useMemo(() => {
1163
1610
  const sorted = [...conversation.thread].sort(byTime);
1164
1611
  return order === "desc" ? sorted.reverse() : sorted;
1165
1612
  }, [conversation, order]);
1166
- const onMessageEditedRef = React2__namespace.useRef(onMessageEdited);
1613
+ const turnIndex = React3__namespace.useMemo(
1614
+ () => turnStartId && order !== "desc" ? orderedThread.findIndex((message) => message.id === turnStartId) : -1,
1615
+ [orderedThread, turnStartId, order]
1616
+ );
1617
+ const renderMessageRow = (m) => /* @__PURE__ */ jsxRuntime.jsx(
1618
+ MessageRow,
1619
+ {
1620
+ message: m,
1621
+ participant: participantById.get(m.participantId),
1622
+ isSelf: !!currentParticipantId && m.participantId === currentParticipantId,
1623
+ renderText,
1624
+ linkBuilder,
1625
+ onReferenceClick,
1626
+ editable,
1627
+ onMessageEdited: handleMessageEdited,
1628
+ defaultCopyFormat,
1629
+ onOpenMedia: handleOpenMedia,
1630
+ openMediaLabel: labels.openMedia,
1631
+ playMediaLabel: labels.playMedia,
1632
+ mediaErrorLabel: mediaFeedProps?.labels?.mediaError,
1633
+ mediaRetryLabel: mediaFeedProps?.labels?.retry
1634
+ },
1635
+ m.id
1636
+ );
1637
+ const onMessageEditedRef = React3__namespace.useRef(onMessageEdited);
1167
1638
  onMessageEditedRef.current = onMessageEdited;
1168
- const conversationRef = React2__namespace.useRef(conversation);
1639
+ const conversationRef = React3__namespace.useRef(conversation);
1169
1640
  conversationRef.current = conversation;
1170
- const handleMessageEdited = React2__namespace.useCallback(
1641
+ const handleMessageEdited = React3__namespace.useCallback(
1171
1642
  (messageId, text) => {
1172
1643
  onMessageEditedRef.current?.(messageId, text, {
1173
1644
  conversation: conversationRef.current
@@ -1176,7 +1647,7 @@ function SuperChat({
1176
1647
  []
1177
1648
  );
1178
1649
  const editable = !readOnly && !!onMessageEdited;
1179
- const mentionOptions = React2__namespace.useMemo(
1650
+ const mentionOptions = React3__namespace.useMemo(
1180
1651
  () => conversation.participants.filter((p) => p.kind !== "system").map((p) => ({
1181
1652
  id: p.id,
1182
1653
  label: p.name,
@@ -1186,17 +1657,17 @@ function SuperChat({
1186
1657
  })),
1187
1658
  [conversation.participants]
1188
1659
  );
1189
- const composerAccept = React2__namespace.useMemo(
1660
+ const composerAccept = React3__namespace.useMemo(
1190
1661
  () => acceptTokensFor(acceptedFileTypes),
1191
1662
  [acceptedFileTypes]
1192
1663
  );
1193
- const [draft, setDraft] = React2__namespace.useState("");
1194
- const draftEpochRef = React2__namespace.useRef(0);
1195
- const handleDraftChange = React2__namespace.useCallback((value) => {
1664
+ const [draft, setDraft] = React3__namespace.useState("");
1665
+ const draftEpochRef = React3__namespace.useRef(0);
1666
+ const handleDraftChange = React3__namespace.useCallback((value) => {
1196
1667
  draftEpochRef.current += 1;
1197
1668
  setDraft(value);
1198
1669
  }, []);
1199
- const handleComposerSend = React2__namespace.useCallback(
1670
+ const handleComposerSend = React3__namespace.useCallback(
1200
1671
  async (message) => {
1201
1672
  const epoch = draftEpochRef.current;
1202
1673
  try {
@@ -1227,7 +1698,7 @@ function SuperChat({
1227
1698
  className
1228
1699
  ),
1229
1700
  children: [
1230
- /* @__PURE__ */ jsxRuntime.jsxs(
1701
+ showHeader ? /* @__PURE__ */ jsxRuntime.jsxs(
1231
1702
  "header",
1232
1703
  {
1233
1704
  "data-slot": "superchat-header",
@@ -1286,77 +1757,165 @@ function SuperChat({
1286
1757
  onClick: () => onConversationClosed(conversation),
1287
1758
  "aria-label": "Close conversation",
1288
1759
  className: "rounded-md p-1 text-neutral-400 hover:bg-neutral-100 dark:hover:bg-neutral-800",
1289
- children: /* @__PURE__ */ jsxRuntime.jsx(chunkWIAQQNFU_cjs.CloseIcon, {})
1760
+ children: /* @__PURE__ */ jsxRuntime.jsx(chunkXRVMYT5G_cjs.CloseIcon, {})
1290
1761
  }
1291
1762
  )
1292
1763
  ]
1293
1764
  }
1765
+ ) : (
1766
+ // Keeps the panel's aria-labelledby reference valid without a visible header.
1767
+ /* @__PURE__ */ jsxRuntime.jsx("h2", { id: headingId, className: "sr-only", children: conversation.title })
1294
1768
  ),
1295
- virtualized ? /* @__PURE__ */ jsxRuntime.jsx(
1296
- VirtualThread,
1769
+ activeView === "media" ? /* @__PURE__ */ jsxRuntime.jsxs(
1770
+ "div",
1297
1771
  {
1298
- items: orderedThread,
1299
- participantById,
1300
- currentParticipantId,
1301
- renderText,
1302
- linkBuilder,
1303
- onReferenceClick,
1304
- editable,
1305
- onMessageEdited: handleMessageEdited,
1306
- defaultCopyFormat,
1307
- order,
1308
- conversationId: conversation.id,
1309
- containerProps: {
1310
- "data-slot": "superchat-thread",
1311
- role: "log",
1312
- "aria-label": "Messages",
1313
- "aria-live": "polite",
1314
- // Focusable so keyboard-only users can scroll the message history.
1315
- tabIndex: 0,
1316
- className: "flex-1 overflow-y-auto p-4"
1317
- }
1772
+ "data-slot": "superchat-media-view",
1773
+ className: "flex min-h-0 flex-1 flex-col",
1774
+ children: [
1775
+ /* @__PURE__ */ jsxRuntime.jsx("div", { className: "px-4 pt-2", children: /* @__PURE__ */ jsxRuntime.jsx(chunkXRVMYT5G_cjs.ButtonGroup, { className: "justify-start", children: /* @__PURE__ */ jsxRuntime.jsx(
1776
+ chunkX6A27RGO_cjs.Button,
1777
+ {
1778
+ ref: backToConversationRef,
1779
+ variant: "ghost",
1780
+ size: "sm",
1781
+ leftIcon: /* @__PURE__ */ jsxRuntime.jsx(
1782
+ lucideReact.ArrowLeft,
1783
+ {
1784
+ className: "size-4 rtl:rotate-180",
1785
+ "aria-hidden": "true"
1786
+ }
1787
+ ),
1788
+ onClick: handleBackToConversation,
1789
+ children: labels.backToConversation
1790
+ }
1791
+ ) }) }),
1792
+ /* @__PURE__ */ React3.createElement(
1793
+ chunkWXFGHDTV_cjs.MediaFeed,
1794
+ {
1795
+ ...mediaFeedProps,
1796
+ ref: mediaFeedRef,
1797
+ key: conversation.id,
1798
+ items: mediaItems,
1799
+ getId: (item) => item.id,
1800
+ getMedia: (item) => item.attachment,
1801
+ getTitle: (item) => item.attachment.title ?? "",
1802
+ getCaption: (item) => item.attachment.caption ?? item.message.text,
1803
+ getAuthor: (item) => ({
1804
+ name: item.participant?.name ?? labels.unknownAuthor,
1805
+ avatar: item.participant?.avatar
1806
+ }),
1807
+ activeItemId: mediaFeedProps?.activeItemId ?? (mediaSelection?.conversationId === conversation.id ? mediaSelection.itemId : void 0),
1808
+ onActiveItemChange: handleMediaSelection,
1809
+ playbackRequest: manualPlaybackRequest?.conversationId === conversation.id ? manualPlaybackRequest : mediaFeedProps?.playbackRequest,
1810
+ className: chunkS5RVSXDV_cjs.cn("min-h-0 flex-1", mediaFeedProps?.className)
1811
+ }
1812
+ )
1813
+ ]
1318
1814
  }
1319
- ) : /* @__PURE__ */ jsxRuntime.jsx(
1815
+ ) : /* @__PURE__ */ jsxRuntime.jsxs(
1320
1816
  "div",
1321
1817
  {
1322
- "data-slot": "superchat-thread",
1323
- ref: threadRef,
1324
- role: "log",
1325
- "aria-label": "Messages",
1326
- "aria-live": "polite",
1327
- tabIndex: 0,
1328
- className: "flex-1 space-y-4 overflow-y-auto p-4",
1329
- children: orderedThread.map((m) => /* @__PURE__ */ jsxRuntime.jsx(
1330
- MessageRow,
1331
- {
1332
- message: m,
1333
- participant: participantById.get(m.participantId),
1334
- isSelf: !!currentParticipantId && m.participantId === currentParticipantId,
1335
- renderText,
1336
- linkBuilder,
1337
- onReferenceClick,
1338
- editable,
1339
- onMessageEdited: handleMessageEdited,
1340
- defaultCopyFormat
1341
- },
1342
- m.id
1343
- ))
1818
+ "data-slot": "superchat-thread-viewport",
1819
+ className: "relative flex min-h-0 flex-1 flex-col",
1820
+ children: [
1821
+ virtualized ? /* @__PURE__ */ jsxRuntime.jsx(
1822
+ VirtualThread,
1823
+ {
1824
+ items: orderedThread,
1825
+ participantById,
1826
+ currentParticipantId,
1827
+ renderText,
1828
+ linkBuilder,
1829
+ onReferenceClick,
1830
+ editable,
1831
+ onMessageEdited: handleMessageEdited,
1832
+ defaultCopyFormat,
1833
+ onOpenMedia: handleOpenMedia,
1834
+ openMediaLabel: labels.openMedia,
1835
+ playMediaLabel: labels.playMedia,
1836
+ mediaErrorLabel: mediaFeedProps?.labels?.mediaError,
1837
+ mediaRetryLabel: mediaFeedProps?.labels?.retry,
1838
+ scrollRef: threadRef,
1839
+ contentRef: threadContentRef,
1840
+ containerProps: {
1841
+ "data-slot": "superchat-thread",
1842
+ role: "log",
1843
+ "aria-label": "Messages",
1844
+ "aria-live": "polite",
1845
+ // Focusable so keyboard-only users can scroll the message history.
1846
+ tabIndex: 0,
1847
+ className: "flex-1 overflow-y-auto p-4"
1848
+ }
1849
+ }
1850
+ ) : /* @__PURE__ */ jsxRuntime.jsx(
1851
+ "div",
1852
+ {
1853
+ "data-slot": "superchat-thread",
1854
+ ref: threadRef,
1855
+ role: "log",
1856
+ "aria-label": "Messages",
1857
+ "aria-live": "polite",
1858
+ tabIndex: 0,
1859
+ className: "flex-1 overflow-y-auto p-4",
1860
+ children: /* @__PURE__ */ jsxRuntime.jsxs("div", { ref: threadContentRef, className: "space-y-4", children: [
1861
+ (turnIndex === -1 ? orderedThread : orderedThread.slice(0, turnIndex)).map(renderMessageRow),
1862
+ turnIndex !== -1 && /* @__PURE__ */ jsxRuntime.jsx(
1863
+ "div",
1864
+ {
1865
+ "data-slot": "superchat-turn",
1866
+ className: "space-y-4",
1867
+ style: { minHeight: turnMinHeight },
1868
+ children: orderedThread.slice(turnIndex).map(renderMessageRow)
1869
+ }
1870
+ )
1871
+ ] })
1872
+ }
1873
+ ),
1874
+ /* @__PURE__ */ jsxRuntime.jsx(chunkIEY3ZJIT_cjs.AnimatedPresence, { children: order !== "desc" && !isAtBottom && /* @__PURE__ */ jsxRuntime.jsx(
1875
+ chunkIEY3ZJIT_cjs.Animated,
1876
+ {
1877
+ preset: "fade",
1878
+ mode: "presence",
1879
+ className: "absolute inset-x-0 bottom-0 z-20",
1880
+ children: /* @__PURE__ */ jsxRuntime.jsx(
1881
+ chunkXRVMYT5G_cjs.JumpToBottomButton,
1882
+ {
1883
+ dataSlot: "superchat-jump-to-bottom",
1884
+ hasNewMessages: hasNewBelow,
1885
+ onClick: handleJumpToBottom
1886
+ }
1887
+ )
1888
+ },
1889
+ "jump-to-bottom"
1890
+ ) })
1891
+ ]
1344
1892
  }
1345
1893
  ),
1346
1894
  /* @__PURE__ */ jsxRuntime.jsx(
1347
- chunkX4XPNTCZ_cjs.ChatComposer,
1895
+ chunkR5Z7AOVU_cjs.ChatComposer,
1348
1896
  {
1349
1897
  value: draft,
1350
1898
  onValueChange: handleDraftChange,
1351
1899
  onSend: handleComposerSend,
1352
1900
  disabled: readOnly,
1353
- placeholder: readOnly ? "Read-only conversation" : "Type a message\u2026 use @ to address an agent",
1901
+ className: "px-4 pb-4",
1902
+ placeholder: readOnly ? "Read-only conversation" : placeholder ?? "Type a message\u2026 use @ to address an agent",
1354
1903
  mentionOptions,
1355
- allowAttachments: !readOnly,
1904
+ allowAttachments: !readOnly && (allowAttachments ?? true),
1356
1905
  acceptedFileTypes: composerAccept,
1357
1906
  maxFileSize: 25 * 1024 * 1024,
1358
1907
  maxLength: 1e5,
1359
- inputLabel: "Message"
1908
+ inputLabel: "Message",
1909
+ showAgentSelector: !!agents?.length,
1910
+ agents,
1911
+ selectedAgent,
1912
+ onAgentChange,
1913
+ agentSelectorLabel,
1914
+ showModelSelector: !!modelSelectorProps,
1915
+ modelSelectorProps,
1916
+ isStreaming,
1917
+ onStop,
1918
+ stopLabel
1360
1919
  }
1361
1920
  )
1362
1921
  ]
@@ -1371,12 +1930,14 @@ function SuperChatConversations({
1371
1930
  onConversationOpened,
1372
1931
  onNewConversation
1373
1932
  }) {
1374
- const [internalActive, setInternalActive] = React2__namespace.useState(
1933
+ const [internalActive, setInternalActive] = React3__namespace.useState(
1375
1934
  defaultActiveConversationId ?? conversations[0]?.id
1376
1935
  );
1936
+ const [hasMounted, setHasMounted] = React3__namespace.useState(false);
1937
+ React3__namespace.useEffect(() => setHasMounted(true), []);
1377
1938
  const requestedId = activeConversationId ?? internalActive;
1378
1939
  const activeId = conversations.some((c) => c.id === requestedId) ? requestedId : conversations[0]?.id;
1379
- const sortedConversations = React2__namespace.useMemo(
1940
+ const sortedConversations = React3__namespace.useMemo(
1380
1941
  () => [...conversations].sort((a, b) => lastActivityOf(b) - lastActivityOf(a)),
1381
1942
  [conversations]
1382
1943
  );
@@ -1428,10 +1989,21 @@ function SuperChatConversations({
1428
1989
  /* @__PURE__ */ jsxRuntime.jsx("span", { className: "block truncate font-medium", children: c.title }),
1429
1990
  last?.text && /* @__PURE__ */ jsxRuntime.jsx("span", { className: "block truncate text-xs text-neutral-600 dark:text-neutral-400", children: last.text })
1430
1991
  ] }),
1431
- !!c.unread && /* @__PURE__ */ jsxRuntime.jsxs("span", { className: "bg-primary-600 ms-1 inline-flex h-5 min-w-5 items-center justify-center rounded-full px-1.5 text-[10px] font-semibold text-white", children: [
1432
- c.unread,
1433
- /* @__PURE__ */ jsxRuntime.jsx("span", { className: "sr-only", children: " unread messages" })
1434
- ] })
1992
+ /* @__PURE__ */ jsxRuntime.jsx(chunkIEY3ZJIT_cjs.AnimatedPresence, { initial: hasMounted, children: !!c.unread && /* @__PURE__ */ jsxRuntime.jsxs(
1993
+ chunkIEY3ZJIT_cjs.Animated,
1994
+ {
1995
+ as: "span",
1996
+ preset: "pop",
1997
+ mode: "presence",
1998
+ "data-slot": "superchat-unread-badge",
1999
+ className: "bg-primary-600 ms-1 inline-flex h-5 min-w-5 items-center justify-center rounded-full px-1.5 text-[10px] font-semibold text-white",
2000
+ children: [
2001
+ c.unread,
2002
+ /* @__PURE__ */ jsxRuntime.jsx("span", { className: "sr-only", children: " unread messages" })
2003
+ ]
2004
+ },
2005
+ "unread"
2006
+ ) })
1435
2007
  ]
1436
2008
  }
1437
2009
  ) }, c.id);
@@ -1444,6 +2016,11 @@ function SuperChatConversations({
1444
2016
  }
1445
2017
  function SuperChatInbox({
1446
2018
  conversations,
2019
+ view,
2020
+ defaultView,
2021
+ onViewChange,
2022
+ mediaFeedProps,
2023
+ mediaLabels,
1447
2024
  activeConversationId,
1448
2025
  defaultActiveConversationId,
1449
2026
  currentParticipantId,
@@ -1465,13 +2042,13 @@ function SuperChatInbox({
1465
2042
  onNewConversation,
1466
2043
  onReferenceClick
1467
2044
  }) {
1468
- const [internalActive, setInternalActive] = React2__namespace.useState(
2045
+ const [internalActive, setInternalActive] = React3__namespace.useState(
1469
2046
  defaultActiveConversationId ?? conversations[0]?.id
1470
2047
  );
1471
2048
  const requestedId = activeConversationId ?? internalActive;
1472
2049
  const active = conversations.find((c) => c.id === requestedId) ?? conversations[0];
1473
2050
  const activeId = active?.id;
1474
- const [mobileView, setMobileView] = React2__namespace.useState("list");
2051
+ const [mobileView, setMobileView] = React3__namespace.useState("list");
1475
2052
  const handleOpen = (c) => {
1476
2053
  if (activeConversationId === void 0) setInternalActive(c.id);
1477
2054
  setMobileView("chat");
@@ -1505,6 +2082,11 @@ function SuperChatInbox({
1505
2082
  SuperChat,
1506
2083
  {
1507
2084
  conversation: active,
2085
+ view,
2086
+ defaultView,
2087
+ onViewChange,
2088
+ mediaFeedProps,
2089
+ mediaLabels,
1508
2090
  currentParticipantId,
1509
2091
  renderPlugins,
1510
2092
  renderTextContent,
@@ -1552,5 +2134,6 @@ exports.SuperChat = SuperChat;
1552
2134
  exports.SuperChatConversations = SuperChatConversations;
1553
2135
  exports.SuperChatInbox = SuperChatInbox;
1554
2136
  exports.createMarkdownRenderer = createMarkdownRenderer;
2137
+ exports.getConversationMediaItems = getConversationMediaItems;
1555
2138
  //# sourceMappingURL=index.cjs.map
1556
2139
  //# sourceMappingURL=index.cjs.map