@mieweb/ui 0.10.0-dev.3 → 0.10.0-dev.30
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.
- package/README.md +4 -4
- package/agent/mieweb-ui.instructions.md +90 -1
- package/dist/CsvBlock-FX5YNGNE.cjs +17 -0
- package/dist/{CsvBlock-ROJCKJDP.cjs.map → CsvBlock-FX5YNGNE.cjs.map} +1 -1
- package/dist/CsvBlock-VLMG7GUO.js +8 -0
- package/dist/{CsvBlock-UWPMTLE2.js.map → CsvBlock-VLMG7GUO.js.map} +1 -1
- package/dist/HtmlPreviewBlock-5JE7L3GR.js +8 -0
- package/dist/{HtmlPreviewBlock-ME5U3XNS.js.map → HtmlPreviewBlock-5JE7L3GR.js.map} +1 -1
- package/dist/HtmlPreviewBlock-UO37JQ3K.cjs +17 -0
- package/dist/{HtmlPreviewBlock-DWFN6EUB.cjs.map → HtmlPreviewBlock-UO37JQ3K.cjs.map} +1 -1
- package/dist/Input-yN516s5_.d.cts +3 -0
- package/dist/Input-yN516s5_.d.ts +3 -0
- package/dist/MermaidBlock-3XHFBAMV.js +8 -0
- package/dist/{MermaidBlock-2B6CPD6Y.js.map → MermaidBlock-3XHFBAMV.js.map} +1 -1
- package/dist/MermaidBlock-RZ75RPZA.cjs +17 -0
- package/dist/{MermaidBlock-D2UC5M55.cjs.map → MermaidBlock-RZ75RPZA.cjs.map} +1 -1
- package/dist/SurveyBlock-MUVJ3JUI.js +8 -0
- package/dist/{SurveyBlock-4DO62RBT.js.map → SurveyBlock-MUVJ3JUI.js.map} +1 -1
- package/dist/SurveyBlock-VH47YXZC.cjs +17 -0
- package/dist/{SurveyBlock-4CD4AYMJ.cjs.map → SurveyBlock-VH47YXZC.cjs.map} +1 -1
- package/dist/ag-grid.d.cts +142 -1
- package/dist/ag-grid.d.ts +142 -1
- package/dist/brands/bluehive.cjs +3 -3
- package/dist/brands/bluehive.css +3 -0
- package/dist/brands/bluehive.js +1 -1
- package/dist/brands/index.cjs +14 -14
- package/dist/brands/index.js +4 -4
- package/dist/{chunk-JYZW2PZS.cjs → chunk-254QK722.cjs} +7 -7
- package/dist/chunk-254QK722.cjs.map +1 -0
- package/dist/{chunk-VKELAMAZ.js → chunk-2JICT4A2.js} +27 -11
- package/dist/chunk-2JICT4A2.js.map +1 -0
- package/dist/{chunk-VPWJCJCX.cjs → chunk-35Y4ILCU.cjs} +7 -7
- package/dist/{chunk-VPWJCJCX.cjs.map → chunk-35Y4ILCU.cjs.map} +1 -1
- package/dist/{chunk-G3JX3UAU.cjs → chunk-3KPDQG5O.cjs} +5 -5
- package/dist/{chunk-G3JX3UAU.cjs.map → chunk-3KPDQG5O.cjs.map} +1 -1
- package/dist/{chunk-Y5HFM7LO.js → chunk-3RXZWHCU.js} +4 -4
- package/dist/{chunk-Y5HFM7LO.js.map → chunk-3RXZWHCU.js.map} +1 -1
- package/dist/chunk-3YBS4WUQ.js +52 -0
- package/dist/chunk-3YBS4WUQ.js.map +1 -0
- package/dist/{chunk-WNJRS7Y7.cjs → chunk-3ZWCIPFT.cjs} +4 -2
- package/dist/chunk-3ZWCIPFT.cjs.map +1 -0
- package/dist/chunk-4HC2IBOX.js +258 -0
- package/dist/chunk-4HC2IBOX.js.map +1 -0
- package/dist/chunk-4IS3QCOQ.cjs +453 -0
- package/dist/chunk-4IS3QCOQ.cjs.map +1 -0
- package/dist/chunk-4NCDU5IG.cjs +56 -0
- package/dist/chunk-4NCDU5IG.cjs.map +1 -0
- package/dist/{chunk-E4IBHYJ7.cjs → chunk-6N6LIAUJ.cjs} +9 -9
- package/dist/{chunk-E4IBHYJ7.cjs.map → chunk-6N6LIAUJ.cjs.map} +1 -1
- package/dist/{chunk-3M7TAXNR.js → chunk-6ZPTZTKN.js} +3 -3
- package/dist/{chunk-3M7TAXNR.js.map → chunk-6ZPTZTKN.js.map} +1 -1
- package/dist/{chunk-MWVW4APN.cjs → chunk-7UTBDFFL.cjs} +4 -4
- package/dist/{chunk-MWVW4APN.cjs.map → chunk-7UTBDFFL.cjs.map} +1 -1
- package/dist/{chunk-FJ7YPVKV.js → chunk-7X6R3JIA.js} +3 -3
- package/dist/{chunk-FJ7YPVKV.js.map → chunk-7X6R3JIA.js.map} +1 -1
- package/dist/{chunk-GOALNQZ2.js → chunk-7YO7DNUV.js} +4 -83
- package/dist/chunk-7YO7DNUV.js.map +1 -0
- package/dist/{chunk-P2CA3XGI.js → chunk-7ZV67VZE.js} +4 -4
- package/dist/{chunk-P2CA3XGI.js.map → chunk-7ZV67VZE.js.map} +1 -1
- package/dist/chunk-ADW7ZYCY.cjs +2707 -0
- package/dist/chunk-ADW7ZYCY.cjs.map +1 -0
- package/dist/{chunk-2G75X6TS.cjs → chunk-AHHFFXJR.cjs} +3 -3
- package/dist/{chunk-2G75X6TS.cjs.map → chunk-AHHFFXJR.cjs.map} +1 -1
- package/dist/{chunk-VILW53UZ.js → chunk-BIQ7GSO2.js} +3 -3
- package/dist/{chunk-VILW53UZ.js.map → chunk-BIQ7GSO2.js.map} +1 -1
- package/dist/chunk-BM35CACB.js +148 -0
- package/dist/chunk-BM35CACB.js.map +1 -0
- package/dist/chunk-BNH4SXJB.js +874 -0
- package/dist/chunk-BNH4SXJB.js.map +1 -0
- package/dist/{chunk-XEAT7XJG.cjs → chunk-BUT6MF5K.cjs} +29 -13
- package/dist/chunk-BUT6MF5K.cjs.map +1 -0
- package/dist/{chunk-UAMXCMST.cjs → chunk-CFI3TQMA.cjs} +3 -3
- package/dist/{chunk-UAMXCMST.cjs.map → chunk-CFI3TQMA.cjs.map} +1 -1
- package/dist/{chunk-J5CSLNCN.cjs → chunk-COM7RNZU.cjs} +2 -2
- package/dist/{chunk-J5CSLNCN.cjs.map → chunk-COM7RNZU.cjs.map} +1 -1
- package/dist/{chunk-XI34EGK5.cjs → chunk-CPPUT74P.cjs} +9 -9
- package/dist/{chunk-XI34EGK5.cjs.map → chunk-CPPUT74P.cjs.map} +1 -1
- package/dist/{chunk-ACCAXVOG.js → chunk-CRS2CQWM.js} +134 -56
- package/dist/chunk-CRS2CQWM.js.map +1 -0
- package/dist/{chunk-OE5CKRUC.js → chunk-D22GE27K.js} +4 -4
- package/dist/{chunk-OE5CKRUC.js.map → chunk-D22GE27K.js.map} +1 -1
- package/dist/chunk-DXEPYK3I.cjs +92 -0
- package/dist/chunk-DXEPYK3I.cjs.map +1 -0
- package/dist/{chunk-ZGRCSNPK.js → chunk-E2PBPQGS.js} +4 -4
- package/dist/{chunk-ZGRCSNPK.js.map → chunk-E2PBPQGS.js.map} +1 -1
- package/dist/{chunk-5JJ2DAE4.js → chunk-ENMXHZNE.js} +3 -3
- package/dist/{chunk-5JJ2DAE4.js.map → chunk-ENMXHZNE.js.map} +1 -1
- package/dist/{chunk-XCP454Q6.js → chunk-F4N67NAF.js} +12 -3
- package/dist/chunk-F4N67NAF.js.map +1 -0
- package/dist/chunk-FBCDYTWM.js +385 -0
- package/dist/chunk-FBCDYTWM.js.map +1 -0
- package/dist/{chunk-VU6UTJRM.js → chunk-FIKO4WR6.js} +3 -3
- package/dist/{chunk-VU6UTJRM.js.map → chunk-FIKO4WR6.js.map} +1 -1
- package/dist/{chunk-DEDN5HAG.js → chunk-FZURBQJ2.js} +3 -3
- package/dist/{chunk-DEDN5HAG.js.map → chunk-FZURBQJ2.js.map} +1 -1
- package/dist/{chunk-JHULS3EC.js → chunk-GBUVIGD5.js} +89 -3
- package/dist/chunk-GBUVIGD5.js.map +1 -0
- package/dist/chunk-GU5OS7JJ.cjs +281 -0
- package/dist/chunk-GU5OS7JJ.cjs.map +1 -0
- package/dist/{chunk-V7D3YGUV.js → chunk-GVLNXPJX.js} +4 -4
- package/dist/{chunk-V7D3YGUV.js.map → chunk-GVLNXPJX.js.map} +1 -1
- package/dist/chunk-GVM6DTR5.js +90 -0
- package/dist/chunk-GVM6DTR5.js.map +1 -0
- package/dist/{chunk-SQHMGT4W.js → chunk-GW4RFJZ5.js} +7 -7
- package/dist/chunk-GW4RFJZ5.js.map +1 -0
- package/dist/{chunk-3QEVGSFG.cjs → chunk-GYXUS65N.cjs} +5 -5
- package/dist/{chunk-3QEVGSFG.cjs.map → chunk-GYXUS65N.cjs.map} +1 -1
- package/dist/{chunk-WGPLUCBD.js → chunk-H2IAMSHK.js} +3 -3
- package/dist/{chunk-WGPLUCBD.js.map → chunk-H2IAMSHK.js.map} +1 -1
- package/dist/{chunk-JID7AZTO.cjs → chunk-H3ROMJYI.cjs} +4 -4
- package/dist/{chunk-JID7AZTO.cjs.map → chunk-H3ROMJYI.cjs.map} +1 -1
- package/dist/{chunk-GD7EBGC4.cjs → chunk-HC3NAN55.cjs} +19 -19
- package/dist/{chunk-GD7EBGC4.cjs.map → chunk-HC3NAN55.cjs.map} +1 -1
- package/dist/{chunk-7ZXAQTV4.cjs → chunk-HIZWOAWY.cjs} +8 -8
- package/dist/{chunk-7ZXAQTV4.cjs.map → chunk-HIZWOAWY.cjs.map} +1 -1
- package/dist/{chunk-NV2CWBI2.cjs → chunk-IEY3ZJIT.cjs} +12 -3
- package/dist/chunk-IEY3ZJIT.cjs.map +1 -0
- package/dist/chunk-IT775BYG.js +179 -0
- package/dist/chunk-IT775BYG.js.map +1 -0
- package/dist/chunk-IYWG72DM.js +166 -0
- package/dist/chunk-IYWG72DM.js.map +1 -0
- package/dist/{chunk-2YCERQWC.js → chunk-JBIGSP2T.js} +6 -6
- package/dist/{chunk-2YCERQWC.js.map → chunk-JBIGSP2T.js.map} +1 -1
- package/dist/{chunk-IX6KFB3K.cjs → chunk-JELTRRR5.cjs} +9 -9
- package/dist/{chunk-IX6KFB3K.cjs.map → chunk-JELTRRR5.cjs.map} +1 -1
- package/dist/{chunk-YQDA366U.js → chunk-JHG3ELS2.js} +2 -2
- package/dist/{chunk-YQDA366U.js.map → chunk-JHG3ELS2.js.map} +1 -1
- package/dist/{chunk-WWJIW2IH.cjs → chunk-JSXIB6EJ.cjs} +4 -4
- package/dist/{chunk-WWJIW2IH.cjs.map → chunk-JSXIB6EJ.cjs.map} +1 -1
- package/dist/{chunk-WNM7IZJ7.js → chunk-K34DXMLZ.js} +7 -7
- package/dist/{chunk-WNM7IZJ7.js.map → chunk-K34DXMLZ.js.map} +1 -1
- package/dist/{chunk-FXO5ARBB.cjs → chunk-KDW6BD4O.cjs} +4 -4
- package/dist/{chunk-FXO5ARBB.cjs.map → chunk-KDW6BD4O.cjs.map} +1 -1
- package/dist/{chunk-Z5V7SAZ4.js → chunk-KFEN2SRZ.js} +3 -3
- package/dist/{chunk-Z5V7SAZ4.js.map → chunk-KFEN2SRZ.js.map} +1 -1
- package/dist/{chunk-2QKBTPUC.cjs → chunk-KGKBZN3T.cjs} +8 -8
- package/dist/{chunk-2QKBTPUC.cjs.map → chunk-KGKBZN3T.cjs.map} +1 -1
- package/dist/{chunk-UV2FVNWT.cjs → chunk-LFPJ3OUM.cjs} +5 -5
- package/dist/{chunk-UV2FVNWT.cjs.map → chunk-LFPJ3OUM.cjs.map} +1 -1
- package/dist/{chunk-WNAA6CLE.cjs → chunk-LHBWRMNC.cjs} +94 -2
- package/dist/chunk-LHBWRMNC.cjs.map +1 -0
- package/dist/{chunk-JI244Y7C.js → chunk-MLAWXPRY.js} +190 -5
- package/dist/chunk-MLAWXPRY.js.map +1 -0
- package/dist/chunk-N7C4OEP7.cjs +356 -0
- package/dist/chunk-N7C4OEP7.cjs.map +1 -0
- package/dist/{chunk-WNZAYBVB.cjs → chunk-NKV76R65.cjs} +48 -48
- package/dist/{chunk-WNZAYBVB.cjs.map → chunk-NKV76R65.cjs.map} +1 -1
- package/dist/{chunk-PYJDVWXM.js → chunk-NUB5HRKS.js} +3 -3
- package/dist/{chunk-PYJDVWXM.js.map → chunk-NUB5HRKS.js.map} +1 -1
- package/dist/{chunk-LL6IWKI3.js → chunk-OW3SQJ7P.js} +3 -3
- package/dist/{chunk-LL6IWKI3.js.map → chunk-OW3SQJ7P.js.map} +1 -1
- package/dist/{chunk-5GUOOLPR.cjs → chunk-P5CMZZRZ.cjs} +5 -5
- package/dist/{chunk-5GUOOLPR.cjs.map → chunk-P5CMZZRZ.cjs.map} +1 -1
- package/dist/{chunk-3T7QGLNB.js → chunk-PJEL5ZZV.js} +4 -2
- package/dist/chunk-PJEL5ZZV.js.map +1 -0
- package/dist/{chunk-H4ZXMQQW.js → chunk-QOVJ6Z6R.js} +3 -3
- package/dist/{chunk-H4ZXMQQW.js.map → chunk-QOVJ6Z6R.js.map} +1 -1
- package/dist/{chunk-U42F3HLE.cjs → chunk-QURJVPRH.cjs} +190 -5
- package/dist/chunk-QURJVPRH.cjs.map +1 -0
- package/dist/{chunk-X4XPNTCZ.cjs → chunk-R5Z7AOVU.cjs} +136 -58
- package/dist/chunk-R5Z7AOVU.cjs.map +1 -0
- package/dist/{chunk-TMMVIUUN.js → chunk-R6KPWIGO.js} +4 -4
- package/dist/{chunk-TMMVIUUN.js.map → chunk-R6KPWIGO.js.map} +1 -1
- package/dist/{chunk-22CYDCXA.js → chunk-RM2HPQIC.js} +105 -14
- package/dist/chunk-RM2HPQIC.js.map +1 -0
- package/dist/{chunk-ENKFJJZX.js → chunk-SD7ONW6S.js} +6 -6
- package/dist/{chunk-ENKFJJZX.js.map → chunk-SD7ONW6S.js.map} +1 -1
- package/dist/{chunk-RJ6NTJHC.js → chunk-SRMTRD7F.js} +3 -3
- package/dist/{chunk-RJ6NTJHC.js.map → chunk-SRMTRD7F.js.map} +1 -1
- package/dist/chunk-T4JYUICS.js +2657 -0
- package/dist/chunk-T4JYUICS.js.map +1 -0
- package/dist/{chunk-7ZDPD5ZX.cjs → chunk-T4L7Q5FA.cjs} +7 -7
- package/dist/{chunk-7ZDPD5ZX.cjs.map → chunk-T4L7Q5FA.cjs.map} +1 -1
- package/dist/{chunk-NJ6MY6V5.js → chunk-T5BBZQ66.js} +3 -3
- package/dist/{chunk-NJ6MY6V5.js.map → chunk-T5BBZQ66.js.map} +1 -1
- package/dist/{chunk-2IZLKPUW.js → chunk-THLIL6PY.js} +3 -3
- package/dist/{chunk-2IZLKPUW.js.map → chunk-THLIL6PY.js.map} +1 -1
- package/dist/{chunk-SGFYA22I.cjs → chunk-TJCX4OML.cjs} +8 -8
- package/dist/{chunk-SGFYA22I.cjs.map → chunk-TJCX4OML.cjs.map} +1 -1
- package/dist/{chunk-N6IY47YA.cjs → chunk-TTSSUOEV.cjs} +8 -8
- package/dist/{chunk-N6IY47YA.cjs.map → chunk-TTSSUOEV.cjs.map} +1 -1
- package/dist/{chunk-5MCBWTIF.cjs → chunk-TYE5K5WV.cjs} +4 -4
- package/dist/{chunk-5MCBWTIF.cjs.map → chunk-TYE5K5WV.cjs.map} +1 -1
- package/dist/{chunk-VOKVG3ER.js → chunk-UBSH27C2.js} +4 -4
- package/dist/{chunk-VOKVG3ER.js.map → chunk-UBSH27C2.js.map} +1 -1
- package/dist/{chunk-TAXD5ADA.cjs → chunk-UEDTZYGI.cjs} +3 -3
- package/dist/{chunk-TAXD5ADA.cjs.map → chunk-UEDTZYGI.cjs.map} +1 -1
- package/dist/{chunk-UQ3VVR6A.cjs → chunk-UPWIJC6I.cjs} +3 -3
- package/dist/{chunk-UQ3VVR6A.cjs.map → chunk-UPWIJC6I.cjs.map} +1 -1
- package/dist/{chunk-S7WCHDBO.js → chunk-VCI2Y7ST.js} +3 -3
- package/dist/{chunk-S7WCHDBO.js.map → chunk-VCI2Y7ST.js.map} +1 -1
- package/dist/chunk-VINZZQBD.cjs +323 -0
- package/dist/chunk-VINZZQBD.cjs.map +1 -0
- package/dist/{chunk-OD47TTAW.cjs → chunk-VOQJHSXN.cjs} +9 -9
- package/dist/{chunk-OD47TTAW.cjs.map → chunk-VOQJHSXN.cjs.map} +1 -1
- package/dist/chunk-VPTASZ2O.cjs +171 -0
- package/dist/chunk-VPTASZ2O.cjs.map +1 -0
- package/dist/chunk-WXFGHDTV.cjs +896 -0
- package/dist/chunk-WXFGHDTV.cjs.map +1 -0
- package/dist/{chunk-VNYW4C4J.cjs → chunk-X6A27RGO.cjs} +4 -84
- package/dist/chunk-X6A27RGO.cjs.map +1 -0
- package/dist/chunk-XBTKZCZF.js +333 -0
- package/dist/chunk-XBTKZCZF.js.map +1 -0
- package/dist/chunk-XDIMTPZU.cjs +202 -0
- package/dist/chunk-XDIMTPZU.cjs.map +1 -0
- package/dist/chunk-XDU65GLW.js +21 -0
- package/dist/chunk-XDU65GLW.js.map +1 -0
- package/dist/chunk-XI74P5F2.cjs +424 -0
- package/dist/chunk-XI74P5F2.cjs.map +1 -0
- package/dist/{chunk-WIAQQNFU.cjs → chunk-XRVMYT5G.cjs} +106 -13
- package/dist/chunk-XRVMYT5G.cjs.map +1 -0
- package/dist/chunk-XVW5DPPP.js +429 -0
- package/dist/chunk-XVW5DPPP.js.map +1 -0
- package/dist/chunk-Y4E2WRUR.cjs +188 -0
- package/dist/chunk-Y4E2WRUR.cjs.map +1 -0
- package/dist/chunk-Y4QNLW7W.js +300 -0
- package/dist/chunk-Y4QNLW7W.js.map +1 -0
- package/dist/{chunk-6EN3IQQI.cjs → chunk-YRHBSSQ3.cjs} +6 -6
- package/dist/{chunk-6EN3IQQI.cjs.map → chunk-YRHBSSQ3.cjs.map} +1 -1
- package/dist/{chunk-KZFBQ7GY.js → chunk-YU55JD35.js} +3 -3
- package/dist/{chunk-KZFBQ7GY.js.map → chunk-YU55JD35.js.map} +1 -1
- package/dist/chunk-YW2AKBLS.cjs +23 -0
- package/dist/chunk-YW2AKBLS.cjs.map +1 -0
- package/dist/{chunk-ELPW32ZI.cjs → chunk-ZTMYKAVU.cjs} +45 -45
- package/dist/{chunk-ELPW32ZI.cjs.map → chunk-ZTMYKAVU.cjs.map} +1 -1
- package/dist/{chunk-3QGS6CXD.js → chunk-ZYL4SNOR.js} +3 -3
- package/dist/{chunk-3QGS6CXD.js.map → chunk-ZYL4SNOR.js.map} +1 -1
- package/dist/components/Alert/index.d.cts +1 -1
- package/dist/components/Alert/index.d.ts +1 -1
- package/dist/components/AlertDialog/index.cjs +6 -5
- package/dist/components/AlertDialog/index.d.cts +28 -3
- package/dist/components/AlertDialog/index.d.ts +28 -3
- package/dist/components/AlertDialog/index.js +5 -4
- package/dist/components/AudioRecorder/index.d.cts +2 -2
- package/dist/components/AudioRecorder/index.d.ts +2 -2
- package/dist/components/Autocomplete/index.d.cts +8 -2
- package/dist/components/Autocomplete/index.d.ts +8 -2
- package/dist/components/Avatar/index.d.cts +1 -1
- package/dist/components/Avatar/index.d.ts +1 -1
- package/dist/components/Badge/index.d.cts +1 -1
- package/dist/components/Badge/index.d.ts +1 -1
- package/dist/components/BoardView/index.cjs +24 -0
- package/dist/components/BoardView/index.cjs.map +1 -0
- package/dist/components/BoardView/index.d.cts +41 -0
- package/dist/components/BoardView/index.d.ts +41 -0
- package/dist/components/BoardView/index.js +7 -0
- package/dist/components/BoardView/index.js.map +1 -0
- package/dist/components/Button/index.cjs +4 -3
- package/dist/components/Button/index.d.cts +2 -1
- package/dist/components/Button/index.d.ts +2 -1
- package/dist/components/Button/index.js +2 -1
- package/dist/components/CalendarView/index.cjs +23 -0
- package/dist/components/CalendarView/index.cjs.map +1 -0
- package/dist/components/CalendarView/index.d.cts +39 -0
- package/dist/components/CalendarView/index.d.ts +39 -0
- package/dist/components/CalendarView/index.js +10 -0
- package/dist/components/CalendarView/index.js.map +1 -0
- package/dist/components/Card/index.d.cts +3 -3
- package/dist/components/Card/index.d.ts +3 -3
- package/dist/components/Collapsible/index.cjs +6 -6
- package/dist/components/Collapsible/index.js +3 -3
- package/dist/components/CountryCodeDropdown/index.cjs +5 -5
- package/dist/components/CountryCodeDropdown/index.js +2 -2
- package/dist/components/CustomizableDashboard/index.cjs +10 -9
- package/dist/components/CustomizableDashboard/index.js +3 -2
- package/dist/components/Dropdown/index.cjs +10 -10
- package/dist/components/Dropdown/index.d.cts +2 -1
- package/dist/components/Dropdown/index.d.ts +2 -1
- package/dist/components/Dropdown/index.js +3 -3
- package/dist/components/FloatingWindow/index.cjs +5 -4
- package/dist/components/FloatingWindow/index.js +3 -2
- package/dist/components/GanttView/index.cjs +20 -0
- package/dist/components/GanttView/index.cjs.map +1 -0
- package/dist/components/GanttView/index.d.cts +36 -0
- package/dist/components/GanttView/index.d.ts +36 -0
- package/dist/components/GanttView/index.js +7 -0
- package/dist/components/GanttView/index.js.map +1 -0
- package/dist/components/GlossaryTooltip/index.cjs +3 -3
- package/dist/components/GlossaryTooltip/index.js +2 -2
- package/dist/components/KeyboardShortcutsOverlay/index.cjs +5 -5
- package/dist/components/KeyboardShortcutsOverlay/index.js +3 -3
- package/dist/components/ListView/index.cjs +23 -0
- package/dist/components/ListView/index.cjs.map +1 -0
- package/dist/components/ListView/index.d.cts +124 -0
- package/dist/components/ListView/index.d.ts +124 -0
- package/dist/components/ListView/index.js +10 -0
- package/dist/components/ListView/index.js.map +1 -0
- package/dist/components/Markdown/index.cjs +20 -19
- package/dist/components/Markdown/index.js +8 -7
- package/dist/components/MediaEditor/index.cjs +15 -14
- package/dist/components/MediaEditor/index.d.cts +91 -2
- package/dist/components/MediaEditor/index.d.ts +91 -2
- package/dist/components/MediaEditor/index.js +10 -9
- package/dist/components/MediaFeed/index.cjs +26 -0
- package/dist/components/MediaFeed/index.cjs.map +1 -0
- package/dist/components/MediaFeed/index.d.cts +104 -0
- package/dist/components/MediaFeed/index.d.ts +104 -0
- package/dist/components/MediaFeed/index.js +17 -0
- package/dist/components/MediaFeed/index.js.map +1 -0
- package/dist/components/MediaPlayer/index.cjs +7 -6
- package/dist/components/MediaPlayer/index.d.cts +19 -1
- package/dist/components/MediaPlayer/index.d.ts +19 -1
- package/dist/components/MediaPlayer/index.js +4 -3
- package/dist/components/MegaMenu/index.cjs +6 -5
- package/dist/components/MegaMenu/index.js +3 -2
- package/dist/components/Modal/index.cjs +10 -10
- package/dist/components/Modal/index.js +2 -2
- package/dist/components/Pagination/index.d.cts +1 -1
- package/dist/components/Pagination/index.d.ts +1 -1
- package/dist/components/PhoneInput/index.d.cts +36 -3
- package/dist/components/PhoneInput/index.d.ts +36 -3
- package/dist/components/Progress/index.d.cts +1 -1
- package/dist/components/Progress/index.d.ts +1 -1
- package/dist/components/Q/index.d.cts +2 -2
- package/dist/components/Q/index.d.ts +2 -2
- package/dist/components/QuickAction/index.d.cts +1 -1
- package/dist/components/QuickAction/index.d.ts +1 -1
- package/dist/components/RadialExplorer/index.cjs +5 -4
- package/dist/components/RadialExplorer/index.js +4 -3
- package/dist/components/RecordButton/index.d.cts +1 -1
- package/dist/components/RecordButton/index.d.ts +1 -1
- package/dist/components/RichTextEditor/index.cjs +9 -8
- package/dist/components/RichTextEditor/index.d.cts +7 -2
- package/dist/components/RichTextEditor/index.d.ts +7 -2
- package/dist/components/RichTextEditor/index.js +6 -5
- package/dist/components/ScrollArea/index.d.cts +1 -1
- package/dist/components/ScrollArea/index.d.ts +1 -1
- package/dist/components/SectionSpyNav/index.cjs +4 -3
- package/dist/components/SectionSpyNav/index.js +3 -2
- package/dist/components/Select/index.cjs +4 -4
- package/dist/components/Select/index.d.cts +1 -2
- package/dist/components/Select/index.d.ts +1 -2
- package/dist/components/Select/index.js +2 -2
- package/dist/components/Skeleton/index.d.cts +1 -1
- package/dist/components/Skeleton/index.d.ts +1 -1
- package/dist/components/Slider/index.d.cts +2 -2
- package/dist/components/Slider/index.d.ts +2 -2
- package/dist/components/SliderCalculator/index.cjs +4 -4
- package/dist/components/SliderCalculator/index.js +2 -2
- package/dist/components/SourceTip/index.cjs +3 -3
- package/dist/components/SourceTip/index.js +2 -2
- package/dist/components/Spinner/index.d.cts +2 -2
- package/dist/components/Spinner/index.d.ts +2 -2
- package/dist/components/SuperChat/index.cjs +1378 -819
- package/dist/components/SuperChat/index.cjs.map +1 -1
- package/dist/components/SuperChat/index.d.cts +35 -8
- package/dist/components/SuperChat/index.d.ts +35 -8
- package/dist/components/SuperChat/index.js +1370 -811
- package/dist/components/SuperChat/index.js.map +1 -1
- package/dist/components/SuperChat/plugins/index.cjs +6 -6
- package/dist/components/SuperChat/plugins/index.d.cts +2 -3
- package/dist/components/SuperChat/plugins/index.d.ts +2 -3
- package/dist/components/SuperChat/plugins/index.js +5 -5
- package/dist/components/Text/index.d.cts +3 -3
- package/dist/components/Text/index.d.ts +3 -3
- package/dist/components/Textarea/index.d.cts +1 -2
- package/dist/components/Textarea/index.d.ts +1 -2
- package/dist/components/ThemeProvider/index.cjs +9 -9
- package/dist/components/ThemeProvider/index.d.cts +3 -1
- package/dist/components/ThemeProvider/index.d.ts +3 -1
- package/dist/components/ThemeProvider/index.js +3 -3
- package/dist/components/Tooltip/index.cjs +3 -3
- package/dist/components/Tooltip/index.js +2 -2
- package/dist/components/TranscriptView/index.d.cts +85 -4
- package/dist/components/TranscriptView/index.d.ts +85 -4
- package/dist/components/ViewSet/index.cjs +24 -0
- package/dist/components/ViewSet/index.cjs.map +1 -0
- package/dist/components/ViewSet/index.d.cts +200 -0
- package/dist/components/ViewSet/index.d.ts +200 -0
- package/dist/components/ViewSet/index.js +15 -0
- package/dist/components/ViewSet/index.js.map +1 -0
- package/dist/components/ViewSwitcher/index.cjs +20 -0
- package/dist/components/ViewSwitcher/index.cjs.map +1 -0
- package/dist/components/ViewSwitcher/index.d.cts +4 -0
- package/dist/components/ViewSwitcher/index.d.ts +4 -0
- package/dist/components/ViewSwitcher/index.js +7 -0
- package/dist/components/ViewSwitcher/index.js.map +1 -0
- package/dist/datavis.cjs +3 -2
- package/dist/datavis.cjs.map +1 -1
- package/dist/datavis.d.cts +167 -13
- package/dist/datavis.d.ts +167 -13
- package/dist/datavis.js +2 -1
- package/dist/datavis.js.map +1 -1
- package/dist/deck.cjs +3360 -0
- package/dist/deck.cjs.map +1 -0
- package/dist/deck.d.cts +712 -0
- package/dist/deck.d.ts +712 -0
- package/dist/deck.js +3316 -0
- package/dist/deck.js.map +1 -0
- package/dist/esheet.cjs +14 -13
- package/dist/esheet.cjs.map +1 -1
- package/dist/esheet.d.cts +183 -1
- package/dist/esheet.d.ts +183 -1
- package/dist/esheet.js +11 -10
- package/dist/esheet.js.map +1 -1
- package/dist/globe.cjs +2 -2
- package/dist/globe.js +1 -1
- package/dist/hooks/index.cjs +60 -27
- package/dist/hooks/index.d.cts +590 -31
- package/dist/hooks/index.d.ts +590 -31
- package/dist/hooks/index.js +6 -5
- package/dist/icons-wBacj6BW.d.cts +142 -0
- package/dist/icons-wBacj6BW.d.ts +142 -0
- package/dist/index-DoYYWsNc.d.cts +127 -0
- package/dist/index-DoYYWsNc.d.ts +127 -0
- package/dist/index.cjs +1420 -1048
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +8796 -482
- package/dist/index.d.ts +8796 -482
- package/dist/index.js +368 -232
- package/dist/index.js.map +1 -1
- package/dist/kerebron.cjs +58 -19
- package/dist/kerebron.cjs.map +1 -1
- package/dist/kerebron.css +115 -0
- package/dist/kerebron.d.cts +37 -0
- package/dist/kerebron.d.ts +37 -0
- package/dist/kerebron.js +58 -19
- package/dist/kerebron.js.map +1 -1
- package/dist/maps.cjs +160 -0
- package/dist/maps.cjs.map +1 -0
- package/dist/maps.d.cts +42 -0
- package/dist/maps.d.ts +42 -0
- package/dist/maps.js +138 -0
- package/dist/maps.js.map +1 -0
- package/dist/motion.cjs +7 -7
- package/dist/motion.d.cts +186 -2
- package/dist/motion.d.ts +186 -2
- package/dist/motion.js +2 -2
- package/dist/q.d.cts +25 -3
- package/dist/q.d.ts +25 -3
- package/dist/styles/effects.css +133 -0
- package/dist/styles/init.css +3 -0
- package/dist/styles.css +1 -1
- package/dist/tailwind-preset.cjs +4 -4
- package/dist/tailwind-preset.js +1 -1
- package/dist/templates.cjs +156 -0
- package/dist/templates.cjs.map +1 -0
- package/dist/templates.d.cts +734 -0
- package/dist/templates.d.ts +734 -0
- package/dist/templates.js +11 -0
- package/dist/templates.js.map +1 -0
- package/dist/types-Cx1FHLq2.d.cts +548 -0
- package/dist/types-Cx1FHLq2.d.ts +548 -0
- package/dist/types-DsdZvEI1.d.cts +92 -0
- package/dist/types-DsdZvEI1.d.ts +92 -0
- package/dist/utils/index.d.cts +13 -2
- package/dist/utils/index.d.ts +13 -2
- package/package.json +62 -13
- package/dist/Animated-XmH6k8pZ.d.cts +0 -188
- package/dist/Animated-XmH6k8pZ.d.ts +0 -188
- package/dist/CsvBlock-ROJCKJDP.cjs +0 -16
- package/dist/CsvBlock-UWPMTLE2.js +0 -7
- package/dist/HtmlPreviewBlock-DWFN6EUB.cjs +0 -16
- package/dist/HtmlPreviewBlock-ME5U3XNS.js +0 -7
- package/dist/MedicationEditor-Bp4NLy7y.d.cts +0 -352
- package/dist/MedicationEditor-Bp4NLy7y.d.ts +0 -352
- package/dist/MermaidBlock-2B6CPD6Y.js +0 -7
- package/dist/MermaidBlock-D2UC5M55.cjs +0 -16
- package/dist/SurveyBlock-4CD4AYMJ.cjs +0 -16
- package/dist/SurveyBlock-4DO62RBT.js +0 -7
- package/dist/chunk-22CYDCXA.js.map +0 -1
- package/dist/chunk-3T7QGLNB.js.map +0 -1
- package/dist/chunk-6HFFWEM3.cjs +0 -22
- package/dist/chunk-6HFFWEM3.cjs.map +0 -1
- package/dist/chunk-ACCAXVOG.js.map +0 -1
- package/dist/chunk-GOALNQZ2.js.map +0 -1
- package/dist/chunk-HB7C7NB5.js +0 -20
- package/dist/chunk-HB7C7NB5.js.map +0 -1
- package/dist/chunk-JHULS3EC.js.map +0 -1
- package/dist/chunk-JI244Y7C.js.map +0 -1
- package/dist/chunk-JYZW2PZS.cjs.map +0 -1
- package/dist/chunk-NV2CWBI2.cjs.map +0 -1
- package/dist/chunk-SQHMGT4W.js.map +0 -1
- package/dist/chunk-U42F3HLE.cjs.map +0 -1
- package/dist/chunk-VKELAMAZ.js.map +0 -1
- package/dist/chunk-VNYW4C4J.cjs.map +0 -1
- package/dist/chunk-WIAQQNFU.cjs.map +0 -1
- package/dist/chunk-WNAA6CLE.cjs.map +0 -1
- package/dist/chunk-WNJRS7Y7.cjs.map +0 -1
- package/dist/chunk-X4XPNTCZ.cjs.map +0 -1
- package/dist/chunk-XCP454Q6.js.map +0 -1
- package/dist/chunk-XEAT7XJG.cjs.map +0 -1
- package/dist/html-MdxqSzjD.d.cts +0 -13
- package/dist/html-MdxqSzjD.d.ts +0 -13
- package/dist/orderRows-BUJYgSc7.d.cts +0 -221
- package/dist/orderRows-BUJYgSc7.d.ts +0 -221
- package/dist/transcript-Cg7uSW-C.d.cts +0 -84
- package/dist/transcript-Cg7uSW-C.d.ts +0 -84
- package/dist/types-B97JNRNQ.d.cts +0 -251
- package/dist/types-CnPEwzlp.d.cts +0 -254
- package/dist/types-CnPEwzlp.d.ts +0 -254
- package/dist/types-gZXrfLj6.d.ts +0 -251
- package/dist/useAnchoredPosition-CKwLSQW8.d.cts +0 -76
- package/dist/useAnchoredPosition-CKwLSQW8.d.ts +0 -76
- package/dist/useTheme-B9SWu6ui.d.cts +0 -24
- package/dist/useTheme-B9SWu6ui.d.ts +0 -24
- package/dist/useTranscriptEdits-CGzlemHT.d.cts +0 -182
- 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
|
|
5
|
-
var
|
|
6
|
-
var
|
|
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-
|
|
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-
|
|
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-
|
|
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
|
|
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
|
|
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
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
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
|
-
|
|
71
|
-
};
|
|
72
|
-
return (tree) => splitNode(tree);
|
|
131
|
+
);
|
|
73
132
|
}
|
|
74
|
-
function
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
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
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
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
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
))
|
|
105
|
-
|
|
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
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
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
|
-
|
|
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
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
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
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
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
|
-
|
|
144
|
-
|
|
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
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
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] =
|
|
502
|
-
const copiedTimer =
|
|
317
|
+
const [copied, setCopied] = React3__namespace.useState(false);
|
|
318
|
+
const copiedTimer = React3__namespace.useRef(
|
|
503
319
|
void 0
|
|
504
320
|
);
|
|
505
|
-
|
|
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(
|
|
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] =
|
|
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
|
-
|
|
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 =
|
|
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] =
|
|
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
|
|
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
|
-
|
|
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(
|
|
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
|
-
|
|
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 =
|
|
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] =
|
|
688
|
-
const [draft, setDraft] =
|
|
689
|
-
const
|
|
690
|
-
const
|
|
691
|
-
const
|
|
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
|
-
|
|
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 ? `` : "");
|
|
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
|
-
|
|
716
|
-
}
|
|
717
|
-
|
|
718
|
-
|
|
719
|
-
|
|
720
|
-
|
|
721
|
-
|
|
722
|
-
|
|
723
|
-
|
|
724
|
-
|
|
725
|
-
|
|
726
|
-
|
|
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
|
-
|
|
741
|
-
|
|
742
|
-
|
|
743
|
-
|
|
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
|
-
|
|
748
|
-
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
749
|
-
"div",
|
|
1011
|
+
),
|
|
1012
|
+
pre: ({ node: _node, ...props }) => /* @__PURE__ */ jsxRuntime.jsx(
|
|
1013
|
+
"pre",
|
|
750
1014
|
{
|
|
751
|
-
|
|
752
|
-
|
|
753
|
-
|
|
754
|
-
|
|
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
|
-
|
|
757
|
-
|
|
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
|
-
|
|
765
|
-
|
|
766
|
-
|
|
767
|
-
|
|
768
|
-
|
|
769
|
-
|
|
770
|
-
|
|
771
|
-
|
|
772
|
-
|
|
773
|
-
|
|
774
|
-
|
|
775
|
-
|
|
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 ? `` : "");
|
|
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
|
-
|
|
808
|
-
})
|
|
809
|
-
|
|
810
|
-
const actions = [
|
|
811
|
-
...canCopy ? [
|
|
1072
|
+
),
|
|
1073
|
+
h2: ({ node: _node, children, ...props }) => /* @__PURE__ */ jsxRuntime.jsx(
|
|
1074
|
+
"h2",
|
|
812
1075
|
{
|
|
813
|
-
|
|
814
|
-
|
|
815
|
-
|
|
816
|
-
|
|
817
|
-
|
|
818
|
-
|
|
819
|
-
|
|
820
|
-
|
|
821
|
-
|
|
822
|
-
|
|
823
|
-
|
|
824
|
-
|
|
825
|
-
|
|
826
|
-
|
|
827
|
-
|
|
828
|
-
|
|
829
|
-
|
|
830
|
-
|
|
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
|
-
...
|
|
1096
|
+
),
|
|
1097
|
+
h5: ({ node: _node, children, ...props }) => /* @__PURE__ */ jsxRuntime.jsx(
|
|
1098
|
+
"h5",
|
|
842
1099
|
{
|
|
843
|
-
|
|
844
|
-
|
|
845
|
-
|
|
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
|
-
|
|
851
|
-
|
|
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
|
-
|
|
1032
|
-
|
|
1033
|
-
|
|
1034
|
-
|
|
1035
|
-
|
|
1036
|
-
|
|
1037
|
-
|
|
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
|
-
|
|
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
|
-
|
|
1054
|
-
|
|
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: () =>
|
|
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:
|
|
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,
|
|
@@ -1136,38 +1285,349 @@ function SuperChat({
|
|
|
1136
1285
|
onReferenceClick,
|
|
1137
1286
|
onBack
|
|
1138
1287
|
}) {
|
|
1139
|
-
const headingId =
|
|
1140
|
-
|
|
1141
|
-
|
|
1288
|
+
const headingId = React3__namespace.useId();
|
|
1289
|
+
const [internalView, setInternalView] = React3__namespace.useState({
|
|
1290
|
+
conversationId: conversation.id,
|
|
1291
|
+
view: defaultView
|
|
1292
|
+
});
|
|
1293
|
+
const activeView = view ?? (internalView.conversationId === conversation.id ? internalView.view : "thread");
|
|
1294
|
+
const labels = {
|
|
1295
|
+
backToConversation: "Back to conversation",
|
|
1296
|
+
openMedia: "Open in media feed",
|
|
1297
|
+
playMedia: "Play",
|
|
1298
|
+
unknownAuthor: "Unknown",
|
|
1299
|
+
...mediaLabels
|
|
1300
|
+
};
|
|
1301
|
+
const mediaItems = React3__namespace.useMemo(() => {
|
|
1302
|
+
const items = getConversationMediaItems(conversation);
|
|
1303
|
+
return order === "desc" ? items.reverse() : items;
|
|
1304
|
+
}, [conversation, order]);
|
|
1305
|
+
const [mediaSelection, setMediaSelection] = React3__namespace.useState();
|
|
1306
|
+
const [manualPlaybackRequest, setManualPlaybackRequest] = React3__namespace.useState();
|
|
1307
|
+
const playbackRequestCounter = React3__namespace.useRef(0);
|
|
1308
|
+
const mediaFeedRef = React3__namespace.useRef(null);
|
|
1309
|
+
const backToConversationRef = React3__namespace.useRef(null);
|
|
1310
|
+
const focusMediaOnOpenRef = React3__namespace.useRef(false);
|
|
1311
|
+
const focusThreadOnBackRef = React3__namespace.useRef(false);
|
|
1312
|
+
const mediaReturnTargetRef = React3__namespace.useRef(void 0);
|
|
1313
|
+
const mediaContextRef = React3__namespace.useRef({
|
|
1314
|
+
conversation,
|
|
1315
|
+
view,
|
|
1316
|
+
onViewChange,
|
|
1317
|
+
mediaFeedProps,
|
|
1318
|
+
mediaItems
|
|
1319
|
+
});
|
|
1320
|
+
mediaContextRef.current = {
|
|
1321
|
+
conversation,
|
|
1322
|
+
view,
|
|
1323
|
+
onViewChange,
|
|
1324
|
+
mediaFeedProps,
|
|
1325
|
+
mediaItems
|
|
1326
|
+
};
|
|
1327
|
+
const setView = React3__namespace.useCallback((next) => {
|
|
1328
|
+
const context = mediaContextRef.current;
|
|
1329
|
+
if (context.view === void 0)
|
|
1330
|
+
setInternalView({ conversationId: context.conversation.id, view: next });
|
|
1331
|
+
context.onViewChange?.(next, { conversation: context.conversation });
|
|
1332
|
+
}, []);
|
|
1333
|
+
const handleMediaSelection = React3__namespace.useCallback((item) => {
|
|
1334
|
+
setMediaSelection({ conversationId: item.conversationId, itemId: item.id });
|
|
1335
|
+
mediaContextRef.current.mediaFeedProps?.onActiveItemChange?.(item);
|
|
1336
|
+
}, []);
|
|
1337
|
+
const handleOpenMedia = React3__namespace.useCallback(
|
|
1338
|
+
(messageId, attachmentId, play = false) => {
|
|
1339
|
+
const item = mediaContextRef.current.mediaItems.find(
|
|
1340
|
+
(candidate) => candidate.message.id === messageId && candidate.attachment.id === attachmentId
|
|
1341
|
+
);
|
|
1342
|
+
if (!item) return;
|
|
1343
|
+
handleMediaSelection(item);
|
|
1344
|
+
mediaReturnTargetRef.current = {
|
|
1345
|
+
conversationId: item.conversationId,
|
|
1346
|
+
messageId,
|
|
1347
|
+
attachmentId
|
|
1348
|
+
};
|
|
1349
|
+
focusMediaOnOpenRef.current = true;
|
|
1350
|
+
setManualPlaybackRequest(
|
|
1351
|
+
play ? {
|
|
1352
|
+
conversationId: item.conversationId,
|
|
1353
|
+
itemId: item.id,
|
|
1354
|
+
requestId: ++playbackRequestCounter.current
|
|
1355
|
+
} : void 0
|
|
1356
|
+
);
|
|
1357
|
+
setView("media");
|
|
1358
|
+
},
|
|
1359
|
+
[handleMediaSelection, setView]
|
|
1360
|
+
);
|
|
1361
|
+
const handleBackToConversation = React3__namespace.useCallback(() => {
|
|
1362
|
+
focusMediaOnOpenRef.current = false;
|
|
1363
|
+
focusThreadOnBackRef.current = true;
|
|
1364
|
+
setManualPlaybackRequest(void 0);
|
|
1365
|
+
setView("thread");
|
|
1366
|
+
}, [setView]);
|
|
1367
|
+
const hostPlaybackRequest = mediaFeedProps?.playbackRequest;
|
|
1368
|
+
const hostPlaybackKey = hostPlaybackRequest ? `${hostPlaybackRequest.itemId}\0${hostPlaybackRequest.requestId}` : void 0;
|
|
1369
|
+
React3__namespace.useEffect(() => {
|
|
1370
|
+
if (hostPlaybackKey === void 0) return;
|
|
1371
|
+
setManualPlaybackRequest(void 0);
|
|
1372
|
+
}, [hostPlaybackKey]);
|
|
1373
|
+
React3__namespace.useEffect(() => {
|
|
1374
|
+
if (internalView.conversationId !== conversation.id) {
|
|
1375
|
+
setInternalView({ conversationId: conversation.id, view: "thread" });
|
|
1376
|
+
}
|
|
1377
|
+
if (mediaReturnTargetRef.current?.conversationId !== conversation.id) {
|
|
1378
|
+
mediaReturnTargetRef.current = void 0;
|
|
1379
|
+
focusMediaOnOpenRef.current = false;
|
|
1380
|
+
focusThreadOnBackRef.current = false;
|
|
1381
|
+
setManualPlaybackRequest(void 0);
|
|
1382
|
+
}
|
|
1383
|
+
}, [conversation.id, internalView.conversationId]);
|
|
1384
|
+
React3__namespace.useEffect(() => {
|
|
1385
|
+
if (activeView !== "media" || !focusMediaOnOpenRef.current) return;
|
|
1386
|
+
const target = mediaFeedRef.current?.querySelector(
|
|
1387
|
+
'article[tabindex="0"]'
|
|
1388
|
+
) ?? mediaFeedRef.current?.querySelector('[role="feed"]');
|
|
1389
|
+
if (target) focusMediaOnOpenRef.current = false;
|
|
1390
|
+
(target ?? backToConversationRef.current)?.focus({ preventScroll: true });
|
|
1391
|
+
}, [
|
|
1392
|
+
activeView,
|
|
1393
|
+
mediaFeedProps?.loading,
|
|
1394
|
+
mediaFeedProps?.error,
|
|
1395
|
+
mediaItems.length
|
|
1396
|
+
]);
|
|
1397
|
+
React3__namespace.useEffect(() => {
|
|
1398
|
+
chunkR5Z7AOVU_cjs.notifyComposerMigrationOnce("SuperChat");
|
|
1142
1399
|
}, []);
|
|
1143
|
-
const renderText =
|
|
1400
|
+
const renderText = React3__namespace.useMemo(
|
|
1144
1401
|
() => renderTextContent ?? createMarkdownRenderer({
|
|
1145
1402
|
plugins: renderPlugins,
|
|
1146
1403
|
trusted: trustedContent
|
|
1147
1404
|
}),
|
|
1148
1405
|
[renderTextContent, renderPlugins, trustedContent]
|
|
1149
1406
|
);
|
|
1150
|
-
const
|
|
1151
|
-
|
|
1152
|
-
|
|
1153
|
-
|
|
1154
|
-
|
|
1155
|
-
|
|
1156
|
-
|
|
1157
|
-
|
|
1407
|
+
const prefersReducedMotion = chunkYW2AKBLS_cjs.usePrefersReducedMotion();
|
|
1408
|
+
const {
|
|
1409
|
+
containerRef: threadRef,
|
|
1410
|
+
contentRef: threadContentRef,
|
|
1411
|
+
isAtBottom,
|
|
1412
|
+
scrollToBottom,
|
|
1413
|
+
anchorToTurnStart,
|
|
1414
|
+
followIfPinned,
|
|
1415
|
+
stopFollowing
|
|
1416
|
+
} = chunkVPTASZ2O_cjs.useStickToBottom({
|
|
1417
|
+
disabled: order === "desc" || activeView === "media"
|
|
1418
|
+
});
|
|
1419
|
+
React3__namespace.useEffect(() => {
|
|
1420
|
+
if (activeView !== "thread") return;
|
|
1421
|
+
setManualPlaybackRequest(void 0);
|
|
1422
|
+
if (!focusThreadOnBackRef.current) return;
|
|
1423
|
+
focusThreadOnBackRef.current = false;
|
|
1424
|
+
const source = mediaReturnTargetRef.current;
|
|
1425
|
+
const launchId = source ? JSON.stringify([source.messageId, source.attachmentId]) : void 0;
|
|
1426
|
+
const launcher = source?.conversationId === conversation.id ? Array.from(
|
|
1427
|
+
threadRef.current?.querySelectorAll(
|
|
1428
|
+
"[data-media-launch-id]"
|
|
1429
|
+
) ?? []
|
|
1430
|
+
).find((button) => button.dataset.mediaLaunchId === launchId) : void 0;
|
|
1431
|
+
(launcher ?? threadRef.current)?.focus({ preventScroll: true });
|
|
1432
|
+
}, [activeView, conversation.id, threadRef]);
|
|
1433
|
+
const [hasNewBelow, setHasNewBelow] = React3__namespace.useState(false);
|
|
1434
|
+
const [turnStartId, setTurnStartId] = React3__namespace.useState(null);
|
|
1435
|
+
const [turnMinHeight, setTurnMinHeight] = React3__namespace.useState();
|
|
1436
|
+
const anchoredTurnRef = React3__namespace.useRef(null);
|
|
1437
|
+
const threadSnapshotRef = React3__namespace.useRef(void 0);
|
|
1438
|
+
const atBottomRef = React3__namespace.useRef(isAtBottom);
|
|
1439
|
+
atBottomRef.current = isAtBottom;
|
|
1440
|
+
const pendingMediaOwnSendRef = React3__namespace.useRef(false);
|
|
1441
|
+
const pendingMediaAppendRef = React3__namespace.useRef(false);
|
|
1442
|
+
React3__namespace.useEffect(() => {
|
|
1443
|
+
threadSnapshotRef.current = void 0;
|
|
1444
|
+
pendingMediaOwnSendRef.current = false;
|
|
1445
|
+
pendingMediaAppendRef.current = false;
|
|
1446
|
+
setTurnStartId(null);
|
|
1447
|
+
anchoredTurnRef.current = null;
|
|
1448
|
+
if (order === "desc") {
|
|
1449
|
+
const el = threadRef.current;
|
|
1450
|
+
if (el) el.scrollTop = 0;
|
|
1451
|
+
} else {
|
|
1452
|
+
scrollToBottom("auto");
|
|
1453
|
+
}
|
|
1454
|
+
setHasNewBelow(false);
|
|
1455
|
+
}, [conversation.id, order]);
|
|
1456
|
+
const threadLength = conversation.thread.length;
|
|
1457
|
+
const prevThreadLengthRef = React3__namespace.useRef(threadLength);
|
|
1458
|
+
const prevMessageIdsRef = React3__namespace.useRef(
|
|
1459
|
+
new Set(conversation.thread.map((message) => message.id))
|
|
1460
|
+
);
|
|
1461
|
+
const policyConversationRef = React3__namespace.useRef(conversation.id);
|
|
1462
|
+
const policyBaselinedRef = React3__namespace.useRef(false);
|
|
1463
|
+
React3__namespace.useEffect(() => {
|
|
1464
|
+
if (!policyBaselinedRef.current || policyConversationRef.current !== conversation.id) {
|
|
1465
|
+
policyBaselinedRef.current = true;
|
|
1466
|
+
policyConversationRef.current = conversation.id;
|
|
1467
|
+
prevThreadLengthRef.current = threadLength;
|
|
1468
|
+
prevMessageIdsRef.current = new Set(
|
|
1469
|
+
conversation.thread.map((message) => message.id)
|
|
1470
|
+
);
|
|
1471
|
+
if (order !== "desc" && [...conversation.thread].sort(byTime).at(-1)?.status === "streaming") {
|
|
1472
|
+
stopFollowing();
|
|
1473
|
+
}
|
|
1474
|
+
return;
|
|
1475
|
+
}
|
|
1476
|
+
if (threadLength === prevThreadLengthRef.current) return;
|
|
1477
|
+
const grew = threadLength > prevThreadLengthRef.current;
|
|
1478
|
+
prevThreadLengthRef.current = threadLength;
|
|
1479
|
+
if (grew && activeView === "media") pendingMediaAppendRef.current = true;
|
|
1480
|
+
if (order === "desc") {
|
|
1481
|
+
const el = threadRef.current;
|
|
1482
|
+
if (el) el.scrollTop = 0;
|
|
1483
|
+
return;
|
|
1484
|
+
}
|
|
1485
|
+
const prevIds = prevMessageIdsRef.current;
|
|
1486
|
+
let turnStart;
|
|
1487
|
+
if (grew && currentParticipantId) {
|
|
1488
|
+
for (const message of [...conversation.thread].sort(byTime)) {
|
|
1489
|
+
if (!prevIds.has(message.id) && message.participantId === currentParticipantId) {
|
|
1490
|
+
turnStart = message.id;
|
|
1491
|
+
}
|
|
1492
|
+
}
|
|
1493
|
+
}
|
|
1494
|
+
if (turnStart) {
|
|
1495
|
+
if (activeView === "media") pendingMediaOwnSendRef.current = true;
|
|
1496
|
+
if (virtualized) {
|
|
1497
|
+
scrollToBottom("auto");
|
|
1498
|
+
} else {
|
|
1499
|
+
setTurnStartId(turnStart);
|
|
1500
|
+
}
|
|
1501
|
+
} else if (grew) {
|
|
1502
|
+
const newest = [...conversation.thread].sort(byTime).at(-1);
|
|
1503
|
+
if (newest?.status === "streaming") {
|
|
1504
|
+
followIfPinned("auto");
|
|
1505
|
+
stopFollowing();
|
|
1506
|
+
} else if (!followIfPinned("auto")) {
|
|
1507
|
+
setHasNewBelow(true);
|
|
1508
|
+
}
|
|
1509
|
+
} else {
|
|
1510
|
+
followIfPinned("auto");
|
|
1511
|
+
}
|
|
1512
|
+
}, [threadLength, order, isAtBottom, conversation.id, activeView]);
|
|
1513
|
+
React3__namespace.useLayoutEffect(() => {
|
|
1514
|
+
if (activeView !== "thread") return;
|
|
1515
|
+
const container = threadRef.current;
|
|
1516
|
+
if (!container) return;
|
|
1517
|
+
const snapshot = threadSnapshotRef.current;
|
|
1518
|
+
const sameThread = snapshot?.conversationId === conversation.id && snapshot.order === order;
|
|
1519
|
+
const ownSend = pendingMediaOwnSendRef.current;
|
|
1520
|
+
const appended = pendingMediaAppendRef.current;
|
|
1521
|
+
pendingMediaOwnSendRef.current = false;
|
|
1522
|
+
pendingMediaAppendRef.current = false;
|
|
1523
|
+
if (order === "desc") {
|
|
1524
|
+
container.scrollTop = sameThread && !appended ? snapshot.scrollTop : 0;
|
|
1525
|
+
} else if (ownSend && !virtualized) ; else if (sameThread && !ownSend && (!snapshot.atBottom || !appended)) {
|
|
1526
|
+
container.scrollTop = snapshot.scrollTop;
|
|
1527
|
+
if (!snapshot.atBottom) stopFollowing();
|
|
1528
|
+
} else {
|
|
1529
|
+
scrollToBottom("auto");
|
|
1530
|
+
if ([...conversation.thread].sort(byTime).at(-1)?.status === "streaming")
|
|
1531
|
+
stopFollowing();
|
|
1532
|
+
}
|
|
1533
|
+
return () => {
|
|
1534
|
+
threadSnapshotRef.current = {
|
|
1535
|
+
conversationId: conversation.id,
|
|
1536
|
+
order,
|
|
1537
|
+
scrollTop: container.scrollTop,
|
|
1538
|
+
atBottom: atBottomRef.current
|
|
1539
|
+
};
|
|
1540
|
+
};
|
|
1541
|
+
}, [conversation.id, order, activeView, virtualized]);
|
|
1542
|
+
React3__namespace.useLayoutEffect(() => {
|
|
1543
|
+
if (!turnStartId || anchoredTurnRef.current === turnStartId) return;
|
|
1544
|
+
const container = threadRef.current;
|
|
1545
|
+
if (!container) return;
|
|
1546
|
+
const reserve = Math.max(0, container.clientHeight - 32);
|
|
1547
|
+
if (turnMinHeight !== reserve) {
|
|
1548
|
+
setTurnMinHeight(reserve);
|
|
1549
|
+
return;
|
|
1550
|
+
}
|
|
1551
|
+
const target = container.querySelector(
|
|
1552
|
+
'[data-slot="superchat-turn"]'
|
|
1553
|
+
);
|
|
1554
|
+
if (target) {
|
|
1555
|
+
anchorToTurnStart(target, prefersReducedMotion ? "auto" : "smooth");
|
|
1556
|
+
anchoredTurnRef.current = turnStartId;
|
|
1557
|
+
}
|
|
1558
|
+
}, [
|
|
1559
|
+
turnStartId,
|
|
1560
|
+
turnMinHeight,
|
|
1561
|
+
anchorToTurnStart,
|
|
1562
|
+
prefersReducedMotion,
|
|
1563
|
+
threadRef,
|
|
1564
|
+
activeView
|
|
1565
|
+
]);
|
|
1566
|
+
React3__namespace.useEffect(() => {
|
|
1567
|
+
prevMessageIdsRef.current = new Set(
|
|
1568
|
+
conversation.thread.map((message) => message.id)
|
|
1569
|
+
);
|
|
1570
|
+
});
|
|
1571
|
+
React3__namespace.useEffect(() => {
|
|
1572
|
+
if (isAtBottom) setHasNewBelow(false);
|
|
1573
|
+
}, [isAtBottom]);
|
|
1574
|
+
const newestMessage = React3__namespace.useMemo(
|
|
1575
|
+
() => [...conversation.thread].sort(byTime).at(-1),
|
|
1576
|
+
[conversation]
|
|
1577
|
+
);
|
|
1578
|
+
const raiseNewBelow = React3__namespace.useCallback(() => {
|
|
1579
|
+
if (order !== "desc") setHasNewBelow(true);
|
|
1580
|
+
}, [order]);
|
|
1581
|
+
const resumeFollowing = React3__namespace.useCallback(() => {
|
|
1582
|
+
if (order !== "desc") scrollToBottom("auto");
|
|
1583
|
+
}, [order, scrollToBottom]);
|
|
1584
|
+
chunkVPTASZ2O_cjs.useStreamEndedBelowFold(
|
|
1585
|
+
newestMessage,
|
|
1586
|
+
isAtBottom,
|
|
1587
|
+
raiseNewBelow,
|
|
1588
|
+
resumeFollowing
|
|
1589
|
+
);
|
|
1590
|
+
const handleJumpToBottom = React3__namespace.useCallback(() => {
|
|
1591
|
+
scrollToBottom(prefersReducedMotion ? "auto" : "smooth");
|
|
1592
|
+
}, [scrollToBottom, prefersReducedMotion]);
|
|
1593
|
+
const participantById = React3__namespace.useMemo(() => {
|
|
1158
1594
|
const map = /* @__PURE__ */ new Map();
|
|
1159
1595
|
conversation.participants.forEach((p) => map.set(p.id, p));
|
|
1160
1596
|
return map;
|
|
1161
1597
|
}, [conversation]);
|
|
1162
|
-
const orderedThread =
|
|
1598
|
+
const orderedThread = React3__namespace.useMemo(() => {
|
|
1163
1599
|
const sorted = [...conversation.thread].sort(byTime);
|
|
1164
1600
|
return order === "desc" ? sorted.reverse() : sorted;
|
|
1165
1601
|
}, [conversation, order]);
|
|
1166
|
-
const
|
|
1602
|
+
const turnIndex = React3__namespace.useMemo(
|
|
1603
|
+
() => turnStartId && order !== "desc" ? orderedThread.findIndex((message) => message.id === turnStartId) : -1,
|
|
1604
|
+
[orderedThread, turnStartId, order]
|
|
1605
|
+
);
|
|
1606
|
+
const renderMessageRow = (m) => /* @__PURE__ */ jsxRuntime.jsx(
|
|
1607
|
+
MessageRow,
|
|
1608
|
+
{
|
|
1609
|
+
message: m,
|
|
1610
|
+
participant: participantById.get(m.participantId),
|
|
1611
|
+
isSelf: !!currentParticipantId && m.participantId === currentParticipantId,
|
|
1612
|
+
renderText,
|
|
1613
|
+
linkBuilder,
|
|
1614
|
+
onReferenceClick,
|
|
1615
|
+
editable,
|
|
1616
|
+
onMessageEdited: handleMessageEdited,
|
|
1617
|
+
defaultCopyFormat,
|
|
1618
|
+
onOpenMedia: handleOpenMedia,
|
|
1619
|
+
openMediaLabel: labels.openMedia,
|
|
1620
|
+
playMediaLabel: labels.playMedia,
|
|
1621
|
+
mediaErrorLabel: mediaFeedProps?.labels?.mediaError,
|
|
1622
|
+
mediaRetryLabel: mediaFeedProps?.labels?.retry
|
|
1623
|
+
},
|
|
1624
|
+
m.id
|
|
1625
|
+
);
|
|
1626
|
+
const onMessageEditedRef = React3__namespace.useRef(onMessageEdited);
|
|
1167
1627
|
onMessageEditedRef.current = onMessageEdited;
|
|
1168
|
-
const conversationRef =
|
|
1628
|
+
const conversationRef = React3__namespace.useRef(conversation);
|
|
1169
1629
|
conversationRef.current = conversation;
|
|
1170
|
-
const handleMessageEdited =
|
|
1630
|
+
const handleMessageEdited = React3__namespace.useCallback(
|
|
1171
1631
|
(messageId, text) => {
|
|
1172
1632
|
onMessageEditedRef.current?.(messageId, text, {
|
|
1173
1633
|
conversation: conversationRef.current
|
|
@@ -1176,7 +1636,7 @@ function SuperChat({
|
|
|
1176
1636
|
[]
|
|
1177
1637
|
);
|
|
1178
1638
|
const editable = !readOnly && !!onMessageEdited;
|
|
1179
|
-
const mentionOptions =
|
|
1639
|
+
const mentionOptions = React3__namespace.useMemo(
|
|
1180
1640
|
() => conversation.participants.filter((p) => p.kind !== "system").map((p) => ({
|
|
1181
1641
|
id: p.id,
|
|
1182
1642
|
label: p.name,
|
|
@@ -1186,17 +1646,17 @@ function SuperChat({
|
|
|
1186
1646
|
})),
|
|
1187
1647
|
[conversation.participants]
|
|
1188
1648
|
);
|
|
1189
|
-
const composerAccept =
|
|
1649
|
+
const composerAccept = React3__namespace.useMemo(
|
|
1190
1650
|
() => acceptTokensFor(acceptedFileTypes),
|
|
1191
1651
|
[acceptedFileTypes]
|
|
1192
1652
|
);
|
|
1193
|
-
const [draft, setDraft] =
|
|
1194
|
-
const draftEpochRef =
|
|
1195
|
-
const handleDraftChange =
|
|
1653
|
+
const [draft, setDraft] = React3__namespace.useState("");
|
|
1654
|
+
const draftEpochRef = React3__namespace.useRef(0);
|
|
1655
|
+
const handleDraftChange = React3__namespace.useCallback((value) => {
|
|
1196
1656
|
draftEpochRef.current += 1;
|
|
1197
1657
|
setDraft(value);
|
|
1198
1658
|
}, []);
|
|
1199
|
-
const handleComposerSend =
|
|
1659
|
+
const handleComposerSend = React3__namespace.useCallback(
|
|
1200
1660
|
async (message) => {
|
|
1201
1661
|
const epoch = draftEpochRef.current;
|
|
1202
1662
|
try {
|
|
@@ -1286,70 +1746,145 @@ function SuperChat({
|
|
|
1286
1746
|
onClick: () => onConversationClosed(conversation),
|
|
1287
1747
|
"aria-label": "Close conversation",
|
|
1288
1748
|
className: "rounded-md p-1 text-neutral-400 hover:bg-neutral-100 dark:hover:bg-neutral-800",
|
|
1289
|
-
children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
1749
|
+
children: /* @__PURE__ */ jsxRuntime.jsx(chunkXRVMYT5G_cjs.CloseIcon, {})
|
|
1290
1750
|
}
|
|
1291
1751
|
)
|
|
1292
1752
|
]
|
|
1293
1753
|
}
|
|
1294
1754
|
),
|
|
1295
|
-
|
|
1296
|
-
|
|
1755
|
+
activeView === "media" ? /* @__PURE__ */ jsxRuntime.jsxs(
|
|
1756
|
+
"div",
|
|
1297
1757
|
{
|
|
1298
|
-
|
|
1299
|
-
|
|
1300
|
-
|
|
1301
|
-
|
|
1302
|
-
|
|
1303
|
-
|
|
1304
|
-
|
|
1305
|
-
|
|
1306
|
-
|
|
1307
|
-
|
|
1308
|
-
|
|
1309
|
-
|
|
1310
|
-
|
|
1311
|
-
|
|
1312
|
-
|
|
1313
|
-
|
|
1314
|
-
|
|
1315
|
-
|
|
1316
|
-
|
|
1317
|
-
|
|
1758
|
+
"data-slot": "superchat-media-view",
|
|
1759
|
+
className: "flex min-h-0 flex-1 flex-col",
|
|
1760
|
+
children: [
|
|
1761
|
+
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "px-4 pt-2", children: /* @__PURE__ */ jsxRuntime.jsx(chunkXRVMYT5G_cjs.ButtonGroup, { className: "justify-start", children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
1762
|
+
chunkX6A27RGO_cjs.Button,
|
|
1763
|
+
{
|
|
1764
|
+
ref: backToConversationRef,
|
|
1765
|
+
variant: "ghost",
|
|
1766
|
+
size: "sm",
|
|
1767
|
+
leftIcon: /* @__PURE__ */ jsxRuntime.jsx(
|
|
1768
|
+
lucideReact.ArrowLeft,
|
|
1769
|
+
{
|
|
1770
|
+
className: "size-4 rtl:rotate-180",
|
|
1771
|
+
"aria-hidden": "true"
|
|
1772
|
+
}
|
|
1773
|
+
),
|
|
1774
|
+
onClick: handleBackToConversation,
|
|
1775
|
+
children: labels.backToConversation
|
|
1776
|
+
}
|
|
1777
|
+
) }) }),
|
|
1778
|
+
/* @__PURE__ */ React3.createElement(
|
|
1779
|
+
chunkWXFGHDTV_cjs.MediaFeed,
|
|
1780
|
+
{
|
|
1781
|
+
...mediaFeedProps,
|
|
1782
|
+
ref: mediaFeedRef,
|
|
1783
|
+
key: conversation.id,
|
|
1784
|
+
items: mediaItems,
|
|
1785
|
+
getId: (item) => item.id,
|
|
1786
|
+
getMedia: (item) => item.attachment,
|
|
1787
|
+
getTitle: (item) => item.attachment.title ?? "",
|
|
1788
|
+
getCaption: (item) => item.attachment.caption ?? item.message.text,
|
|
1789
|
+
getAuthor: (item) => ({
|
|
1790
|
+
name: item.participant?.name ?? labels.unknownAuthor,
|
|
1791
|
+
avatar: item.participant?.avatar
|
|
1792
|
+
}),
|
|
1793
|
+
activeItemId: mediaFeedProps?.activeItemId ?? (mediaSelection?.conversationId === conversation.id ? mediaSelection.itemId : void 0),
|
|
1794
|
+
onActiveItemChange: handleMediaSelection,
|
|
1795
|
+
playbackRequest: manualPlaybackRequest?.conversationId === conversation.id ? manualPlaybackRequest : mediaFeedProps?.playbackRequest,
|
|
1796
|
+
className: chunkS5RVSXDV_cjs.cn("min-h-0 flex-1", mediaFeedProps?.className)
|
|
1797
|
+
}
|
|
1798
|
+
)
|
|
1799
|
+
]
|
|
1318
1800
|
}
|
|
1319
|
-
) : /* @__PURE__ */ jsxRuntime.
|
|
1801
|
+
) : /* @__PURE__ */ jsxRuntime.jsxs(
|
|
1320
1802
|
"div",
|
|
1321
1803
|
{
|
|
1322
|
-
"data-slot": "superchat-thread",
|
|
1323
|
-
|
|
1324
|
-
|
|
1325
|
-
|
|
1326
|
-
|
|
1327
|
-
|
|
1328
|
-
|
|
1329
|
-
|
|
1330
|
-
|
|
1331
|
-
|
|
1332
|
-
|
|
1333
|
-
|
|
1334
|
-
|
|
1335
|
-
|
|
1336
|
-
|
|
1337
|
-
|
|
1338
|
-
|
|
1339
|
-
|
|
1340
|
-
|
|
1341
|
-
|
|
1342
|
-
|
|
1343
|
-
|
|
1804
|
+
"data-slot": "superchat-thread-viewport",
|
|
1805
|
+
className: "relative flex min-h-0 flex-1 flex-col",
|
|
1806
|
+
children: [
|
|
1807
|
+
virtualized ? /* @__PURE__ */ jsxRuntime.jsx(
|
|
1808
|
+
VirtualThread,
|
|
1809
|
+
{
|
|
1810
|
+
items: orderedThread,
|
|
1811
|
+
participantById,
|
|
1812
|
+
currentParticipantId,
|
|
1813
|
+
renderText,
|
|
1814
|
+
linkBuilder,
|
|
1815
|
+
onReferenceClick,
|
|
1816
|
+
editable,
|
|
1817
|
+
onMessageEdited: handleMessageEdited,
|
|
1818
|
+
defaultCopyFormat,
|
|
1819
|
+
onOpenMedia: handleOpenMedia,
|
|
1820
|
+
openMediaLabel: labels.openMedia,
|
|
1821
|
+
playMediaLabel: labels.playMedia,
|
|
1822
|
+
mediaErrorLabel: mediaFeedProps?.labels?.mediaError,
|
|
1823
|
+
mediaRetryLabel: mediaFeedProps?.labels?.retry,
|
|
1824
|
+
scrollRef: threadRef,
|
|
1825
|
+
contentRef: threadContentRef,
|
|
1826
|
+
containerProps: {
|
|
1827
|
+
"data-slot": "superchat-thread",
|
|
1828
|
+
role: "log",
|
|
1829
|
+
"aria-label": "Messages",
|
|
1830
|
+
"aria-live": "polite",
|
|
1831
|
+
// Focusable so keyboard-only users can scroll the message history.
|
|
1832
|
+
tabIndex: 0,
|
|
1833
|
+
className: "flex-1 overflow-y-auto p-4"
|
|
1834
|
+
}
|
|
1835
|
+
}
|
|
1836
|
+
) : /* @__PURE__ */ jsxRuntime.jsx(
|
|
1837
|
+
"div",
|
|
1838
|
+
{
|
|
1839
|
+
"data-slot": "superchat-thread",
|
|
1840
|
+
ref: threadRef,
|
|
1841
|
+
role: "log",
|
|
1842
|
+
"aria-label": "Messages",
|
|
1843
|
+
"aria-live": "polite",
|
|
1844
|
+
tabIndex: 0,
|
|
1845
|
+
className: "flex-1 overflow-y-auto p-4",
|
|
1846
|
+
children: /* @__PURE__ */ jsxRuntime.jsxs("div", { ref: threadContentRef, className: "space-y-4", children: [
|
|
1847
|
+
(turnIndex === -1 ? orderedThread : orderedThread.slice(0, turnIndex)).map(renderMessageRow),
|
|
1848
|
+
turnIndex !== -1 && /* @__PURE__ */ jsxRuntime.jsx(
|
|
1849
|
+
"div",
|
|
1850
|
+
{
|
|
1851
|
+
"data-slot": "superchat-turn",
|
|
1852
|
+
className: "space-y-4",
|
|
1853
|
+
style: { minHeight: turnMinHeight },
|
|
1854
|
+
children: orderedThread.slice(turnIndex).map(renderMessageRow)
|
|
1855
|
+
}
|
|
1856
|
+
)
|
|
1857
|
+
] })
|
|
1858
|
+
}
|
|
1859
|
+
),
|
|
1860
|
+
/* @__PURE__ */ jsxRuntime.jsx(chunkIEY3ZJIT_cjs.AnimatedPresence, { children: order !== "desc" && !isAtBottom && /* @__PURE__ */ jsxRuntime.jsx(
|
|
1861
|
+
chunkIEY3ZJIT_cjs.Animated,
|
|
1862
|
+
{
|
|
1863
|
+
preset: "fade",
|
|
1864
|
+
mode: "presence",
|
|
1865
|
+
className: "absolute inset-x-0 bottom-0 z-20",
|
|
1866
|
+
children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
1867
|
+
chunkXRVMYT5G_cjs.JumpToBottomButton,
|
|
1868
|
+
{
|
|
1869
|
+
dataSlot: "superchat-jump-to-bottom",
|
|
1870
|
+
hasNewMessages: hasNewBelow,
|
|
1871
|
+
onClick: handleJumpToBottom
|
|
1872
|
+
}
|
|
1873
|
+
)
|
|
1874
|
+
},
|
|
1875
|
+
"jump-to-bottom"
|
|
1876
|
+
) })
|
|
1877
|
+
]
|
|
1344
1878
|
}
|
|
1345
1879
|
),
|
|
1346
1880
|
/* @__PURE__ */ jsxRuntime.jsx(
|
|
1347
|
-
|
|
1881
|
+
chunkR5Z7AOVU_cjs.ChatComposer,
|
|
1348
1882
|
{
|
|
1349
1883
|
value: draft,
|
|
1350
1884
|
onValueChange: handleDraftChange,
|
|
1351
1885
|
onSend: handleComposerSend,
|
|
1352
1886
|
disabled: readOnly,
|
|
1887
|
+
className: "px-4 pb-4",
|
|
1353
1888
|
placeholder: readOnly ? "Read-only conversation" : "Type a message\u2026 use @ to address an agent",
|
|
1354
1889
|
mentionOptions,
|
|
1355
1890
|
allowAttachments: !readOnly,
|
|
@@ -1371,12 +1906,14 @@ function SuperChatConversations({
|
|
|
1371
1906
|
onConversationOpened,
|
|
1372
1907
|
onNewConversation
|
|
1373
1908
|
}) {
|
|
1374
|
-
const [internalActive, setInternalActive] =
|
|
1909
|
+
const [internalActive, setInternalActive] = React3__namespace.useState(
|
|
1375
1910
|
defaultActiveConversationId ?? conversations[0]?.id
|
|
1376
1911
|
);
|
|
1912
|
+
const [hasMounted, setHasMounted] = React3__namespace.useState(false);
|
|
1913
|
+
React3__namespace.useEffect(() => setHasMounted(true), []);
|
|
1377
1914
|
const requestedId = activeConversationId ?? internalActive;
|
|
1378
1915
|
const activeId = conversations.some((c) => c.id === requestedId) ? requestedId : conversations[0]?.id;
|
|
1379
|
-
const sortedConversations =
|
|
1916
|
+
const sortedConversations = React3__namespace.useMemo(
|
|
1380
1917
|
() => [...conversations].sort((a, b) => lastActivityOf(b) - lastActivityOf(a)),
|
|
1381
1918
|
[conversations]
|
|
1382
1919
|
);
|
|
@@ -1428,10 +1965,21 @@ function SuperChatConversations({
|
|
|
1428
1965
|
/* @__PURE__ */ jsxRuntime.jsx("span", { className: "block truncate font-medium", children: c.title }),
|
|
1429
1966
|
last?.text && /* @__PURE__ */ jsxRuntime.jsx("span", { className: "block truncate text-xs text-neutral-600 dark:text-neutral-400", children: last.text })
|
|
1430
1967
|
] }),
|
|
1431
|
-
|
|
1432
|
-
|
|
1433
|
-
|
|
1434
|
-
|
|
1968
|
+
/* @__PURE__ */ jsxRuntime.jsx(chunkIEY3ZJIT_cjs.AnimatedPresence, { initial: hasMounted, children: !!c.unread && /* @__PURE__ */ jsxRuntime.jsxs(
|
|
1969
|
+
chunkIEY3ZJIT_cjs.Animated,
|
|
1970
|
+
{
|
|
1971
|
+
as: "span",
|
|
1972
|
+
preset: "pop",
|
|
1973
|
+
mode: "presence",
|
|
1974
|
+
"data-slot": "superchat-unread-badge",
|
|
1975
|
+
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",
|
|
1976
|
+
children: [
|
|
1977
|
+
c.unread,
|
|
1978
|
+
/* @__PURE__ */ jsxRuntime.jsx("span", { className: "sr-only", children: " unread messages" })
|
|
1979
|
+
]
|
|
1980
|
+
},
|
|
1981
|
+
"unread"
|
|
1982
|
+
) })
|
|
1435
1983
|
]
|
|
1436
1984
|
}
|
|
1437
1985
|
) }, c.id);
|
|
@@ -1444,6 +1992,11 @@ function SuperChatConversations({
|
|
|
1444
1992
|
}
|
|
1445
1993
|
function SuperChatInbox({
|
|
1446
1994
|
conversations,
|
|
1995
|
+
view,
|
|
1996
|
+
defaultView,
|
|
1997
|
+
onViewChange,
|
|
1998
|
+
mediaFeedProps,
|
|
1999
|
+
mediaLabels,
|
|
1447
2000
|
activeConversationId,
|
|
1448
2001
|
defaultActiveConversationId,
|
|
1449
2002
|
currentParticipantId,
|
|
@@ -1465,13 +2018,13 @@ function SuperChatInbox({
|
|
|
1465
2018
|
onNewConversation,
|
|
1466
2019
|
onReferenceClick
|
|
1467
2020
|
}) {
|
|
1468
|
-
const [internalActive, setInternalActive] =
|
|
2021
|
+
const [internalActive, setInternalActive] = React3__namespace.useState(
|
|
1469
2022
|
defaultActiveConversationId ?? conversations[0]?.id
|
|
1470
2023
|
);
|
|
1471
2024
|
const requestedId = activeConversationId ?? internalActive;
|
|
1472
2025
|
const active = conversations.find((c) => c.id === requestedId) ?? conversations[0];
|
|
1473
2026
|
const activeId = active?.id;
|
|
1474
|
-
const [mobileView, setMobileView] =
|
|
2027
|
+
const [mobileView, setMobileView] = React3__namespace.useState("list");
|
|
1475
2028
|
const handleOpen = (c) => {
|
|
1476
2029
|
if (activeConversationId === void 0) setInternalActive(c.id);
|
|
1477
2030
|
setMobileView("chat");
|
|
@@ -1505,6 +2058,11 @@ function SuperChatInbox({
|
|
|
1505
2058
|
SuperChat,
|
|
1506
2059
|
{
|
|
1507
2060
|
conversation: active,
|
|
2061
|
+
view,
|
|
2062
|
+
defaultView,
|
|
2063
|
+
onViewChange,
|
|
2064
|
+
mediaFeedProps,
|
|
2065
|
+
mediaLabels,
|
|
1508
2066
|
currentParticipantId,
|
|
1509
2067
|
renderPlugins,
|
|
1510
2068
|
renderTextContent,
|
|
@@ -1552,5 +2110,6 @@ exports.SuperChat = SuperChat;
|
|
|
1552
2110
|
exports.SuperChatConversations = SuperChatConversations;
|
|
1553
2111
|
exports.SuperChatInbox = SuperChatInbox;
|
|
1554
2112
|
exports.createMarkdownRenderer = createMarkdownRenderer;
|
|
2113
|
+
exports.getConversationMediaItems = getConversationMediaItems;
|
|
1555
2114
|
//# sourceMappingURL=index.cjs.map
|
|
1556
2115
|
//# sourceMappingURL=index.cjs.map
|