dorkos 0.125.2 → 0.125.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (307) hide show
  1. package/dist/bin/cli.js +125 -20
  2. package/dist/browser/native/package-manifest.json +1 -1
  3. package/dist/browser/source-manifest.json +1 -1
  4. package/dist/client/assets/{AboutPage-BqGlH1pd.js → AboutPage-DSSx1Gzx.js} +1 -1
  5. package/dist/client/assets/{ActivityErrorState-C4hqCedX.js → ActivityErrorState-C-mLOmJm.js} +1 -1
  6. package/dist/client/assets/{ActivityPage-frpyizcK.js → ActivityPage-DsOjjulF.js} +1 -1
  7. package/dist/client/assets/{ActivityRow-DB9c3g1G.js → ActivityRow-ylgCMe7Y.js} +1 -1
  8. package/dist/client/assets/{AdapterIcon-CEHkdca8.js → AdapterIcon-DT5OdFbe.js} +1 -1
  9. package/dist/client/assets/{AdapterSetupWizard-DLJMkb-u.js → AdapterSetupWizard-C6jxF55P.js} +1 -1
  10. package/dist/client/assets/{AgentOptionRow-D-QjHi5k.js → AgentOptionRow-CtdBmX9G.js} +1 -1
  11. package/dist/client/assets/{AgentPicker-DoGucmqI.js → AgentPicker--wr93sVO.js} +1 -1
  12. package/dist/client/assets/{AgentRequestCard--9GA9ymH.js → AgentRequestCard-DVoE2cnk.js} +4 -4
  13. package/dist/client/assets/{AppearancePage-NHNiZrtY.js → AppearancePage-DR_g6BJO.js} +1 -1
  14. package/dist/client/assets/{ApplyToOverridesDialog-Clo55n6V.js → ApplyToOverridesDialog-BqaoB6AS.js} +1 -1
  15. package/dist/client/assets/{AttentionSignalRow-BOpClaCD.js → AttentionSignalRow-CM0TrrbJ.js} +1 -1
  16. package/dist/client/assets/{BaseTanStackRouterDevtoolsPanel-B-iktbLX-D9Tm8ual.js → BaseTanStackRouterDevtoolsPanel-B-iktbLX-DJ54CELa.js} +1 -1
  17. package/dist/client/assets/{BindingDialog-DZcTXLE8.js → BindingDialog-JAPULq7H.js} +1 -1
  18. package/dist/client/assets/{BlintzCanvas-DzjdPTlx.js → BlintzCanvas-B3-FjszN.js} +3 -3
  19. package/dist/client/assets/{CanvasCsvContent-xYUrbFeA.js → CanvasCsvContent-Cmqry1BS.js} +1 -1
  20. package/dist/client/assets/{CanvasFileContent-D6fTvMea.js → CanvasFileContent-BMkxUF1r.js} +2 -2
  21. package/dist/client/assets/{CanvasModel3dContent-DEassnBV.js → CanvasModel3dContent-DBhuNbFD.js} +2 -2
  22. package/dist/client/assets/ChannelComposer-WR3_Vvta.js +44 -0
  23. package/dist/client/assets/{ChatAppsOff-C00Nl_w6.js → ChatAppsOff-CY5_0lQH.js} +1 -1
  24. package/dist/client/assets/{CodeMirrorDiff-JYxkSqFi.js → CodeMirrorDiff-_EI44zW6.js} +1 -1
  25. package/dist/client/assets/{CodeMirrorEditor-CVXZ9B5S.js → CodeMirrorEditor-x1lTuDQH.js} +1 -1
  26. package/dist/client/assets/{CommitmentList-CcCSwcZ8.js → CommitmentList-D-CvccnF.js} +1 -1
  27. package/dist/client/assets/{CommitmentsPage-BrDbzpyR.js → CommitmentsPage-CLw1FRLv.js} +1 -1
  28. package/dist/client/assets/{ComputerResourceView-BlLvMt1I.js → ComputerResourceView-QJnXivV4.js} +1 -1
  29. package/dist/client/assets/{ComputerViewer-B8SWICbj.js → ComputerViewer-DbTGz3OL.js} +1 -1
  30. package/dist/client/assets/{ConnectionAccessLists-Bsb-t24W.js → ConnectionAccessLists-CB5UY0f0.js} +1 -1
  31. package/dist/client/assets/{ConnectionsPage-RAhWxuWU.js → ConnectionsPage-SpEJxCeF.js} +1 -1
  32. package/dist/client/assets/{ConventionPage-CNij_BXA.js → ConventionPage-C2NIZjG3.js} +1 -1
  33. package/dist/client/assets/{ExtensionPageRoute-BsGqTcyI.js → ExtensionPageRoute-Drr5uceG.js} +1 -1
  34. package/dist/client/assets/{FloatingTanStackRouterDevtools-CqogiFob-eQVA1bL6.js → FloatingTanStackRouterDevtools-CqogiFob-kKteNmsx.js} +1 -1
  35. package/dist/client/assets/HandlePage-A1OCw0nr.js +1 -0
  36. package/dist/client/assets/{HeartbeatPage-D0tKoR6G.js → HeartbeatPage-BLGTx_57.js} +1 -1
  37. package/dist/client/assets/{KeyEntry-CSmznLcG.js → KeyEntry-DgN8iewR.js} +1 -1
  38. package/dist/client/assets/{LexicalField-gYKPjFfN.js → LexicalField-Bfj72GvX.js} +1 -1
  39. package/dist/client/assets/{ManagesPage-BF6MFrsv.js → ManagesPage-C3G1-Mep.js} +1 -1
  40. package/dist/client/assets/{Marketplace-BWDlXgwH.js → Marketplace-Dg0bIo7_.js} +2 -2
  41. package/dist/client/assets/{MarketplaceSourcesView-BhKzgkiO.js → MarketplaceSourcesView-KPw8YYXi.js} +1 -1
  42. package/dist/client/assets/{McpAppFrame-BotrzoHd.js → McpAppFrame-DjJ4EM39.js} +1 -1
  43. package/dist/client/assets/{McpSigninBody-CdeX_lYs.js → McpSigninBody-V6RSsDqe.js} +1 -1
  44. package/dist/client/assets/{Model3dViewer-KHktOpbD.js → Model3dViewer-woNPO5OC.js} +1 -1
  45. package/dist/client/assets/NamePage-Du9m4rGe.js +1 -0
  46. package/dist/client/assets/{NewDirectMessageMenu-CuvKJEDY.js → NewDirectMessageMenu-CmCOFmXQ.js} +1 -1
  47. package/dist/client/assets/{NotificationsPage-DWcgfZJD.js → NotificationsPage-kUtiVsFS.js} +1 -1
  48. package/dist/client/assets/{OpenMeshSwitch-DdJ7g4yD.js → OpenMeshSwitch-r6HJBjR6.js} +1 -1
  49. package/dist/client/assets/{OperatorIdentityForm-7FUOEWw_.js → OperatorIdentityForm-B29T-N9x.js} +1 -1
  50. package/dist/client/assets/{PermissionHistory-CgQhZrvg.js → PermissionHistory-CV8cFJr3.js} +1 -1
  51. package/dist/client/assets/{PermissionsPage-CK34y1VF.js → PermissionsPage-_PKlbWde.js} +1 -1
  52. package/dist/client/assets/{PersonalityPopover-3BA36sB0.js → PersonalityPopover-BOXTCA6E.js} +1 -1
  53. package/dist/client/assets/PhotoPage-Dx-3Lhm5.js +1 -0
  54. package/dist/client/assets/{PreviewRefusedNotice-CnqAE9sr.js → PreviewRefusedNotice-CdHja8fU.js} +1 -1
  55. package/dist/client/assets/{ProfileFields-CIbISW83.js → ProfileFields-C48alR3i.js} +1 -1
  56. package/dist/client/assets/{ProfilePanelContainer-DPDHtTbI.js → ProfilePanelContainer-BpJVbdUL.js} +1 -1
  57. package/dist/client/assets/{ProfileRolePicker-83GFtm2P.js → ProfileRolePicker-DtuSZNaw.js} +1 -1
  58. package/dist/client/assets/{PromptSuggestionChips-B9chKG4w.js → PromptSuggestionChips-DT-JdGeO.js} +1 -1
  59. package/dist/client/assets/{ReportsToPopover-DUv03JZP.js → ReportsToPopover-BP2nxz2E.js} +1 -1
  60. package/dist/client/assets/{RoomSurface-Bq6Slne3.js → RoomSurface-C_mTmn8g.js} +1 -1
  61. package/dist/client/assets/{RoomsPage-BKxzz-nN.js → RoomsPage-gDIy73MQ.js} +1 -1
  62. package/dist/client/assets/{RunsOnPopover-BIdmMhs9.js → RunsOnPopover-DhXG88Uj.js} +1 -1
  63. package/dist/client/assets/{RuntimeConnectFlow-IaRVgmqH.js → RuntimeConnectFlow-BsZsQZS9.js} +1 -1
  64. package/dist/client/assets/{RuntimeSetupDialog-Er-lzjmK.js → RuntimeSetupDialog-BSb5iK2A.js} +1 -1
  65. package/dist/client/assets/{SeenDevices-9quCcdUW.js → SeenDevices-dzzlSeB2.js} +3 -3
  66. package/dist/client/assets/{SessionsPage-CGic5VaN.js → SessionsPage-C6nmCWVM.js} +1 -1
  67. package/dist/client/assets/{SettingsDialog-BZ58IaK1.js → SettingsDialog-5aEZ-DG6.js} +3 -3
  68. package/dist/client/assets/{SkillsPage-VRYwez5T.js → SkillsPage-DSIKEsHr.js} +1 -1
  69. package/dist/client/assets/{TaskDialogWrapper-C9LMV8oe.js → TaskDialogWrapper-Cst7UxoY.js} +1 -1
  70. package/dist/client/assets/{TasksEmptyState-CagC0LAa.js → TasksEmptyState-DityFi7P.js} +1 -1
  71. package/dist/client/assets/{TasksPage-3gkHB1Pv.js → TasksPage-BZx_Ku0k.js} +1 -1
  72. package/dist/client/assets/{TeamComputerEntry-BD89Y5e6.js → TeamComputerEntry-uj1GcPP_.js} +1 -1
  73. package/dist/client/assets/{ToolsPage-Ds6LwY79.js → ToolsPage-Qm6x37SO.js} +1 -1
  74. package/dist/client/assets/{TopologyGraph-CiZ2ACcQ.js → TopologyGraph-2C3Ij6tO.js} +2 -2
  75. package/dist/client/assets/{TourHost-BISNaEzZ.js → TourHost-BsV8lcXT.js} +1 -1
  76. package/dist/client/assets/{UnlinkDialog-DTuXHNsi.js → UnlinkDialog-ClNn0nv6.js} +1 -1
  77. package/dist/client/assets/{UnreadDivider-l_VZ7ECn.js → UnreadDivider-CGKnJcx7.js} +1 -1
  78. package/dist/client/assets/{WidgetErrorCard-I8WiJv2g.js → WidgetErrorCard-oq5MKUX_.js} +3 -3
  79. package/dist/client/assets/{WorkView-_wehEEl-.js → WorkView-wVnGvWAz.js} +15 -15
  80. package/dist/client/assets/{_shell-BLcPeb8K.js → _shell-D4V8GQqV.js} +6 -6
  81. package/dist/client/assets/{_shell._home-CcRH-M-A.js → _shell._home-DoaHLKk8.js} +1 -1
  82. package/dist/client/assets/{_shell._home.activity-cR24Vr9Q.js → _shell._home.activity-BP1byb8g.js} +1 -1
  83. package/dist/client/assets/{_shell._home.index-agU2ItcI.js → _shell._home.index-BB5pgiqt.js} +2 -2
  84. package/dist/client/assets/{_shell._home.tasks-BDR9JTj3.js → _shell._home.tasks-B3w6mqyb.js} +1 -1
  85. package/dist/client/assets/{_shell._home.workspaces-B4nlcACK.js → _shell._home.workspaces-BcOiklL5.js} +1 -1
  86. package/dist/client/assets/_shell.channels-DxSDnd-3.js +10 -0
  87. package/dist/client/assets/{_shell.connections-CWQYcH58.js → _shell.connections-YKOm7ap5.js} +1 -1
  88. package/dist/client/assets/{_shell.feedback-requests-BkgHtyZr.js → _shell.feedback-requests-DC2Jw1EF.js} +1 -1
  89. package/dist/client/assets/_shell.marketplace-BUh4boaf.js +1 -0
  90. package/dist/client/assets/_shell.marketplace_.sources-CnOFcGv1.js +1 -0
  91. package/dist/client/assets/_shell.session-BUP7x_Ra.js +1 -0
  92. package/dist/client/assets/{_shell.team-CTIVEpZQ.js → _shell.team-C9QJNwaK.js} +3 -3
  93. package/dist/client/assets/{_shell.threads-ClWYrnld.js → _shell.threads-gs_o48eZ.js} +1 -1
  94. package/dist/client/assets/_shell.x._extensionId-B-X7HuaQ.js +1 -0
  95. package/dist/client/assets/_shell.x._extensionId_._-B-X7HuaQ.js +1 -0
  96. package/dist/client/assets/{abnfDiagram-WEYOIA3C-0-Mx5lSG.js → abnfDiagram-WEYOIA3C-sjxf16g2.js} +1 -1
  97. package/dist/client/assets/{access-copy-Cj31J6PU.js → access-copy-_81ChCG3.js} +1 -1
  98. package/dist/client/assets/{arc-DVmpcNHP.js → arc-B-c5OGeX.js} +1 -1
  99. package/dist/client/assets/{architectureDiagram-ZHVYKT53-BZhMXbuC.js → architectureDiagram-ZHVYKT53-CExq4B1X.js} +1 -1
  100. package/dist/client/assets/{banner-Ctq7kvQ0.js → banner-BhzLIs7u.js} +1 -1
  101. package/dist/client/assets/{blockDiagram-RJAE7QA3-Ctmof3-7.js → blockDiagram-RJAE7QA3-C1D5MR7Z.js} +1 -1
  102. package/dist/client/assets/{c4Diagram-XDPPPE54-BPglmQhG.js → c4Diagram-XDPPPE54-DMtF_wcg.js} +1 -1
  103. package/dist/client/assets/{card-DI7YtQh3.js → card-Dsy8PPN6.js} +1 -1
  104. package/dist/client/assets/channel-C6IoQ0kc.js +1 -0
  105. package/dist/client/assets/{chunk-2E7WHVMD-DIK6CHka.js → chunk-2E7WHVMD-DCmxZwyD.js} +1 -1
  106. package/dist/client/assets/{chunk-2Q5K7J3B-C3uATYd9.js → chunk-2Q5K7J3B-BXvjhtJ3.js} +1 -1
  107. package/dist/client/assets/{chunk-4EMNKR2T-Dl3iYXVl.js → chunk-4EMNKR2T-CR6qWjas.js} +1 -1
  108. package/dist/client/assets/{chunk-55XCU76K-BJF-Hcs9.js → chunk-55XCU76K-Bny7RY06.js} +1 -1
  109. package/dist/client/assets/{chunk-5VM5RSS4-Cju3BnqQ.js → chunk-5VM5RSS4-B9aD4Uib.js} +1 -1
  110. package/dist/client/assets/{chunk-JWPE2WC7-v1omZzgE.js → chunk-JWPE2WC7-D28Xa5gr.js} +1 -1
  111. package/dist/client/assets/{chunk-VQ5W62QI-2HqA3jPL.js → chunk-VQ5W62QI-CLgnUSgl.js} +1 -1
  112. package/dist/client/assets/{chunk-XXDRQBXY-RDXwFs9Z.js → chunk-XXDRQBXY-vMTRVR5A.js} +1 -1
  113. package/dist/client/assets/{chunk-ZCHMQSOR-DhQsY-OT.js → chunk-ZCHMQSOR-Ck0VFEtd.js} +2 -2
  114. package/dist/client/assets/{classDiagram-v2-4MYWR3UA-DC5N-GDk.js → classDiagram-v2-4MYWR3UA-Dh4gPh4M.js} +1 -1
  115. package/dist/client/assets/{command-DpK0GpDM.js → command-CxjTPW0z.js} +1 -1
  116. package/dist/client/assets/{cose-bilkent-JH36ORCC-BriFsb6c.js → cose-bilkent-JH36ORCC-BA-tF0x7.js} +1 -1
  117. package/dist/client/assets/{cpu-DzCUBK-1.js → cpu-SRODWAA1.js} +1 -1
  118. package/dist/client/assets/{cynefin-EF2NZ3EQ-cj34OpiI.js → cynefin-EF2NZ3EQ-B_kxrTf4.js} +1 -1
  119. package/dist/client/assets/{cynefinDiagram-WF24UDRP-DvAggKpl.js → cynefinDiagram-WF24UDRP-Be0brpVq.js} +1 -1
  120. package/dist/client/assets/{dagre-NK4GIZVX-BskSpt7C.js → dagre-NK4GIZVX-zI9I0fUC.js} +1 -1
  121. package/dist/client/assets/{diagram-CBK3MWTC-C6BZljcO.js → diagram-CBK3MWTC-jN0pUEKR.js} +1 -1
  122. package/dist/client/assets/{diagram-I5XIIV2D--4FPRmBZ.js → diagram-I5XIIV2D-BjRZmmQf.js} +1 -1
  123. package/dist/client/assets/{diagram-ODIL2UCW-kZxp81Fr.js → diagram-ODIL2UCW-BtnkiX3a.js} +1 -1
  124. package/dist/client/assets/{diagram-PFBEJUXE-BSXBAffS.js → diagram-PFBEJUXE-Bteh9wpL.js} +1 -1
  125. package/dist/client/assets/{diagram-RJA3I4VV-DLDPF6FG.js → diagram-RJA3I4VV-hRmqKbOC.js} +1 -1
  126. package/dist/client/assets/{diagram-TYUNFSNR-CoU2knZy.js → diagram-TYUNFSNR-NKdthGes.js} +1 -1
  127. package/dist/client/assets/{ebnfDiagram-V4P3TTPT-C77T1UPB.js → ebnfDiagram-V4P3TTPT-CpkD13ID.js} +1 -1
  128. package/dist/client/assets/{elk-QONTBCTQ-UFXrlbAn.js → elk-QONTBCTQ-Dw4bdkn4.js} +1 -1
  129. package/dist/client/assets/{empty-state-aNwJA6H8.js → empty-state-Xw8KQdod.js} +1 -1
  130. package/dist/client/assets/{erDiagram-KYQIGQAA-CyLB8fKu.js → erDiagram-KYQIGQAA-fiThyiH_.js} +1 -1
  131. package/dist/client/assets/{execution-config-D7JzMYC2.js → execution-config-ryHuiBdx.js} +1 -1
  132. package/dist/client/assets/{file-bSD5jgk_.js → file-CbZILJJL.js} +1 -1
  133. package/dist/client/assets/{file-exclamation-point-BcCIL-rE.js → file-exclamation-point-rCHuN_aY.js} +1 -1
  134. package/dist/client/assets/{file-text-DTvj1wzM.js → file-text-DGtefNvG.js} +1 -1
  135. package/dist/client/assets/{find-latest-widget-fence-D01ENK2h.js → find-latest-widget-fence-DJDfJAaN.js} +1 -1
  136. package/dist/client/assets/{flowDiagram-IUGLLWBU-qmnUF-Ak.js → flowDiagram-IUGLLWBU-ORyRd0wW.js} +1 -1
  137. package/dist/client/assets/{form-C_yPntkz.js → form-USBlP2n_.js} +1 -1
  138. package/dist/client/assets/{format-cron-DUPWkOrW.js → format-cron-u8efK62G.js} +1 -1
  139. package/dist/client/assets/{ganttDiagram-R7GPNTJY-CBzoqGuU.js → ganttDiagram-R7GPNTJY-BC-M9_Wi.js} +1 -1
  140. package/dist/client/assets/{git-branch-ClXAt1_G.js → git-branch-jQqbJAvp.js} +1 -1
  141. package/dist/client/assets/{gitGraphDiagram-PDYL7XHY-DMh_n1S2.js → gitGraphDiagram-PDYL7XHY-NIdjLN38.js} +1 -1
  142. package/dist/client/assets/{graph-BgkuepqW.js → graph-CBIOKOiw.js} +1 -1
  143. package/dist/client/assets/{heart-BrjEmIsl.js → heart-CSbB9K4Q.js} +1 -1
  144. package/dist/client/assets/{highlighted-body-KPVGNVTW-DlHNVEaV.js → highlighted-body-KPVGNVTW-OC8sqXXy.js} +1 -1
  145. package/dist/client/assets/{image-lightbox-BtzkRztd.js → image-lightbox-DgWS2xlv.js} +1 -1
  146. package/dist/client/assets/{image-off-4yaoLh32.js → image-off-DziiNcIl.js} +1 -1
  147. package/dist/client/assets/{index-CMLDdOez.js → index-B-KhOLHd.js} +1 -1
  148. package/dist/client/assets/{index-DQ9ppIWv.js → index-B5eM1_q1.js} +1 -1
  149. package/dist/client/assets/{index-A_qzw4D8.js → index-B9utW3HE.js} +1 -1
  150. package/dist/client/assets/{index-BUkUamu4.js → index-BAaqQW-m.js} +1 -1
  151. package/dist/client/assets/index-BGGnQdij.js +17 -0
  152. package/dist/client/assets/{index-BeVLPg9t.js → index-BN02EVKP.js} +1 -1
  153. package/dist/client/assets/{index-DrnHzrt4.js → index-BOaou3k5.js} +1 -1
  154. package/dist/client/assets/{index-B-X82FND.js → index-BU_bmsP2.js} +1 -1
  155. package/dist/client/assets/{index-C_H6ZIel.js → index-BYxDsLTQ.js} +1 -1
  156. package/dist/client/assets/index-BpsATTKn.js +1 -0
  157. package/dist/client/assets/{index-CyfSPJ1D.js → index-Bz9CgPjs.js} +1 -1
  158. package/dist/client/assets/{index-CNiC7KUz.js → index-C49AWTah.js} +1 -1
  159. package/dist/client/assets/{index-BtG4vr8c.js → index-C5gtuueN.js} +1 -1
  160. package/dist/client/assets/{index-FhmSwVD0.js → index-C9UgTEuh.js} +1 -1
  161. package/dist/client/assets/{index-WkQdt6Zo.js → index-CCohVfmo.js} +1 -1
  162. package/dist/client/assets/{index-6yT0Qr0s.js → index-CDslENFz.js} +1 -1
  163. package/dist/client/assets/{index-f1W4Bd4W.js → index-CP7hD01s.js} +1 -1
  164. package/dist/client/assets/{index-C0LPB1iH.js → index-CRPh-508.js} +1 -1
  165. package/dist/client/assets/{index-qdygDruh.js → index-CRTzTiNF.js} +1 -1
  166. package/dist/client/assets/index-CUKvspHB.js +1 -0
  167. package/dist/client/assets/{index-CNV11SW6.js → index-CWhDGAYM.js} +1 -1
  168. package/dist/client/assets/{index-DXalAOXT.js → index-CeJVF9AD.js} +1 -1
  169. package/dist/client/assets/{index-DgxXSEmR.js → index-CiAb-mD4.js} +1 -1
  170. package/dist/client/assets/{index-DX546SK5.js → index-CuT_aCM-.js} +2 -2
  171. package/dist/client/assets/{index-DZ1BC5JW.js → index-D9Ej8fsx.js} +1 -1
  172. package/dist/client/assets/{index-WxG6nG96.js → index-DJlq_kd_.js} +1 -1
  173. package/dist/client/assets/{index-DGdKO24t.js → index-DJyLZL6w.js} +1 -1
  174. package/dist/client/assets/index-DSYz85aL.js +1053 -0
  175. package/dist/client/assets/{index-Dj4I8KcL.js → index-DYF1ER90.js} +3 -3
  176. package/dist/client/assets/{index-Ckut3u-d.js → index-DeDh_2c1.js} +1 -1
  177. package/dist/client/assets/{index-CSyZb1X9.js → index-DfYJ-zxk.js} +1 -1
  178. package/dist/client/assets/{index-C_xSr5lb.js → index-DgnJZ7RZ.js} +1 -1
  179. package/dist/client/assets/{index-BqHUbNdh.js → index-Dk33a8Wz.js} +1 -1
  180. package/dist/client/assets/{index-CJhmUsIv.js → index-DkcRrH0O.js} +1 -1
  181. package/dist/client/assets/{index-Bgg4cW4L.js → index-DnyoNFRt.js} +1 -1
  182. package/dist/client/assets/index-DtlBeLQB.css +1 -0
  183. package/dist/client/assets/{index-BXtagrMY.js → index-LFeqJL-v.js} +1 -1
  184. package/dist/client/assets/{index-t-NyR7HD.js → index-RXFhiamo.js} +1 -1
  185. package/dist/client/assets/{index-D0yajRDv.js → index-Yr72qWri.js} +1 -1
  186. package/dist/client/assets/{index-CThGpHO2.js → index-YtJ82pkp.js} +1 -1
  187. package/dist/client/assets/{index-CrQWuUpr.js → index-fAHI5hei.js} +1 -1
  188. package/dist/client/assets/{index-DFWrO42z.js → index-j5szQcqb.js} +1 -1
  189. package/dist/client/assets/{index-DB2t3GUm.js → index-jJbbnV9q.js} +3 -3
  190. package/dist/client/assets/{index-Cefoks17.js → index-n6f9pLtt.js} +1 -1
  191. package/dist/client/assets/{index-Adjbt_HC.js → index-w4wyJU8q.js} +1 -1
  192. package/dist/client/assets/{index.esm-Bb3LMu5X.js → index.esm-Dyd3JXuK.js} +1 -1
  193. package/dist/client/assets/{infoDiagram-MVDRKAX5-DbU4eDjZ.js → infoDiagram-MVDRKAX5-CPcm-36U.js} +1 -1
  194. package/dist/client/assets/{inline-code-DwFNff3_.js → inline-code-BjkmgK0M.js} +1 -1
  195. package/dist/client/assets/{ishikawaDiagram-HPEHV2GE-DmHmF-HT.js → ishikawaDiagram-HPEHV2GE-B8eVNEDQ.js} +1 -1
  196. package/dist/client/assets/{journeyDiagram-BOSHW7O7-DsjOeP3J.js → journeyDiagram-BOSHW7O7-CGkIGaMV.js} +1 -1
  197. package/dist/client/assets/{kanban-definition-FNSA4HC5-ByQ1WGy2.js → kanban-definition-FNSA4HC5-BTDbT6UJ.js} +1 -1
  198. package/dist/client/assets/{layers-DFZUUHM5.js → layers-DyShcAgn.js} +1 -1
  199. package/dist/client/assets/{lightbulb-Bbgsejp1.js → lightbulb-QljDqLq7.js} +1 -1
  200. package/dist/client/assets/{link-2-xieOmwOK.js → link-2-7SoeCkEs.js} +1 -1
  201. package/dist/client/assets/{list-runtime-types-B0CSonAi.js → list-runtime-types-DvfLx6v2.js} +1 -1
  202. package/dist/client/assets/{markdown-content-ysBIqFAg.js → markdown-content-D7t62wwm.js} +1 -1
  203. package/dist/client/assets/{mention-pill-Daeu1X92.js → mention-pill-DNQ2ICCW.js} +1 -1
  204. package/dist/client/assets/{mermaid.core-B1mQMOXd.js → mermaid.core-NAyHAvFm.js} +4 -4
  205. package/dist/client/assets/{message-square-off-D9hm8WNH.js → message-square-off-D6K1M95g.js} +1 -1
  206. package/dist/client/assets/{mindmap-definition-6OY57UG3-CoP-DGm1.js → mindmap-definition-6OY57UG3-26dEepZx.js} +1 -1
  207. package/dist/client/assets/{more-details-DHCpYDi7.js → more-details-BJ_2FYn8.js} +1 -1
  208. package/dist/client/assets/{owner-notice-Crxco7HN.js → owner-notice-CIfb2Yr7.js} +1 -1
  209. package/dist/client/assets/{package-CD8xq7hk.js → package-CeRLwc1u.js} +1 -1
  210. package/dist/client/assets/{page-container-B9sDc2wq.js → page-container-D2J6eon9.js} +1 -1
  211. package/dist/client/assets/{pane-resize-handle-DOchpdJ6.js → pane-resize-handle-CXxva43c.js} +1 -1
  212. package/dist/client/assets/{paperclip-CzhXW5qi.js → paperclip-DFuuQSWM.js} +1 -1
  213. package/dist/client/assets/{path-input-Z2p922fj.js → path-input-DhGxbEsh.js} +1 -1
  214. package/dist/client/assets/{pegDiagram-ECIUJNBX-TEsMAO1a.js → pegDiagram-ECIUJNBX-BJu6g9eg.js} +1 -1
  215. package/dist/client/assets/{pieDiagram-GNMPY74T-CMIDIiMP.js → pieDiagram-GNMPY74T-CMf8TQF7.js} +1 -1
  216. package/dist/client/assets/{plug-BEp9Ly3k.js → plug-Bqwk5g66.js} +1 -1
  217. package/dist/client/assets/{primer-trigger-4qUY83SX.js → primer-trigger-NAz78FSN.js} +1 -1
  218. package/dist/client/assets/{profile-errors-CezsKqhA.js → profile-errors--0_JG2R0.js} +1 -1
  219. package/dist/client/assets/{progress-eQl1UvNz.js → progress-cQRXQehb.js} +1 -1
  220. package/dist/client/assets/{quadrantDiagram-D57K4MC3-DXjohzOz.js → quadrantDiagram-D57K4MC3-Bb92PcA9.js} +1 -1
  221. package/dist/client/assets/{query-error-state-COuKRlU0.js → query-error-state-C2QLFCgp.js} +1 -1
  222. package/dist/client/assets/{radio-Cdnkcg1w.js → radio-CBD2fSSB.js} +1 -1
  223. package/dist/client/assets/{railroadDiagram-Y72NRBL7-BojgH6Hw.js → railroadDiagram-Y72NRBL7-YN2siyto.js} +1 -1
  224. package/dist/client/assets/registry-CsiY3fnM.js +1 -0
  225. package/dist/client/assets/{relay-trace-schemas-XcVQg5Fa.js → relay-trace-schemas-yWn__06J.js} +1 -1
  226. package/dist/client/assets/{repeat-wB31CP7I.js → repeat-CtIEyxm4.js} +1 -1
  227. package/dist/client/assets/{requirementDiagram-EQYSW5RA-Gojbrcvg.js → requirementDiagram-EQYSW5RA-DJBQviv-.js} +1 -1
  228. package/dist/client/assets/{room-files-source-DXKpm43a.js → room-files-source-nnbGMKus.js} +1 -1
  229. package/dist/client/assets/{rotate-ccw-clock-LSKKAcnR.js → rotate-ccw-clock-C2jXtg-P.js} +1 -1
  230. package/dist/client/assets/{rotate-cw-scTEKxeZ.js → rotate-cw-34X3Kx8Z.js} +1 -1
  231. package/dist/client/assets/{sankeyDiagram-SY24JHO5-QS71aycL.js → sankeyDiagram-SY24JHO5-DH2qnwVI.js} +1 -1
  232. package/dist/client/assets/{scroll-area-BNFXgTKM.js → scroll-area-DYTbXWMY.js} +1 -1
  233. package/dist/client/assets/{search-x-Cjf0n9z7.js → search-x-DeFOvp_5.js} +1 -1
  234. package/dist/client/assets/{sequenceDiagram-BLEHNHQU-Beg7mj69.js → sequenceDiagram-BLEHNHQU-CkHcuOw2.js} +1 -1
  235. package/dist/client/assets/{shield-x-Dr4BZfo_.js → shield-x-bloGLifl.js} +1 -1
  236. package/dist/client/assets/{signed-in-L9MLqTuc.js → signed-in-DD2qV0PJ.js} +1 -1
  237. package/dist/client/assets/{sizeCapture-INFHLROL-3Oo1KjRp.js → sizeCapture-INFHLROL-BXK-Cxjs.js} +1 -1
  238. package/dist/client/assets/{soul-file-CxpOawh5.js → soul-file-DFPctfHR.js} +1 -1
  239. package/dist/client/assets/{stateDiagram-v2-A6IESKWZ-DFYIDQ6C.js → stateDiagram-v2-A6IESKWZ-DP_cqXJO.js} +1 -1
  240. package/dist/client/assets/{swimlanes-B3ENRKFQ-BUgKOOrv.js → swimlanes-B3ENRKFQ-BZxkK7Fr.js} +1 -1
  241. package/dist/client/assets/swimlanesDiagram-AYQRV4AK-DXRZtHKX.js +8 -0
  242. package/dist/client/assets/{table-B0LsKsEv.js → table-B8zvHC0J.js} +1 -1
  243. package/dist/client/assets/{timeline-definition-JXYKGLGB-BsPZ0P_8.js → timeline-definition-JXYKGLGB-BPZ64ADa.js} +1 -1
  244. package/dist/client/assets/{trust-posture-Cm7OhCEx.js → trust-posture-C9r0jGhc.js} +1 -1
  245. package/dist/client/assets/{unplug-DLA7Ib_s.js → unplug-DYZEcvkR.js} +1 -1
  246. package/dist/client/assets/{unverified-catalog-notice-CxBO_pta.js → unverified-catalog-notice-DAhwNpy_.js} +1 -1
  247. package/dist/client/assets/{use-adapter-catalog-C333Z2Q6.js → use-adapter-catalog-DrDMqxhZ.js} +1 -1
  248. package/dist/client/assets/{use-bindings-Bu4yLLR5.js → use-bindings-Ci7hpEO4.js} +1 -1
  249. package/dist/client/assets/{use-composer-prefs-BnjCX9pM.js → use-composer-prefs-FpUdi_wE.js} +1 -1
  250. package/dist/client/assets/{use-connector-management-Bo6wOJQS.js → use-connector-management-CinfkPZI.js} +1 -1
  251. package/dist/client/assets/{use-deep-link-scroll-D867V6rs.js → use-deep-link-scroll-DZnA4iYZ.js} +1 -1
  252. package/dist/client/assets/{use-delete-binding-DKObM-zT.js → use-delete-binding-DDtaCc3v.js} +1 -1
  253. package/dist/client/assets/{use-dev-links-C0Zc30aj.js → use-dev-links-CtHwhTBj.js} +1 -1
  254. package/dist/client/assets/{use-direct-message-panel-DNWtQq4B.js → use-direct-message-panel-Da9rkfA3.js} +1 -1
  255. package/dist/client/assets/{use-external-adapter-catalog-Bv5rDkX4.js → use-external-adapter-catalog-CikM-LiV.js} +1 -1
  256. package/dist/client/assets/{use-full-activity-feed-CFUj0qCS.js → use-full-activity-feed-B6TQc-xB.js} +1 -1
  257. package/dist/client/assets/use-is-below-desktop-DJQVU5CF.js +1 -0
  258. package/dist/client/assets/{use-local-browser-BeZjn0gA.js → use-local-browser-ABoWOGv1.js} +1 -1
  259. package/dist/client/assets/{use-mesh-topology-DurMpvjU.js → use-mesh-topology-C5njB0KY.js} +1 -1
  260. package/dist/client/assets/{use-mounted-ref-CBSuPNPv.js → use-mounted-ref-Bp9Wp7zY.js} +1 -1
  261. package/dist/client/assets/{use-notification-prefs-b8iKvzB4.js → use-notification-prefs-DXww4pVV.js} +1 -1
  262. package/dist/client/assets/{use-panel-tab-placements-BcKEux1G.js → use-panel-tab-placements-DLQeHI7w.js} +1 -1
  263. package/dist/client/assets/use-pending-read-CgR0BnSW.js +1 -0
  264. package/dist/client/assets/{use-personality-commit-u3kQ6h3H.js → use-personality-commit-DYQ3KVxd.js} +1 -1
  265. package/dist/client/assets/{use-promo-activation-C8_cGmEW.js → use-promo-activation-nURLgFxH.js} +1 -1
  266. package/dist/client/assets/{use-promo-dismissals-B3VuaQCf.js → use-promo-dismissals-BQkeHMCS.js} +1 -1
  267. package/dist/client/assets/{use-pulse-freshness-CSWQ0TZS.js → use-pulse-freshness-B8VeNnHj.js} +1 -1
  268. package/dist/client/assets/{use-relay-config-BA6c0FMB.js → use-relay-config-D0BknsXK.js} +1 -1
  269. package/dist/client/assets/{use-room-follow-claim-BV-MtDQ5.js → use-room-follow-claim-BruRRf3z.js} +1 -1
  270. package/dist/client/assets/{use-room-sessions-W62Zl72O.js → use-room-sessions-DGcrmZvE.js} +1 -1
  271. package/dist/client/assets/{use-roving-tab-list-CMITzUHu.js → use-roving-tab-list-YQ4MgIBO.js} +1 -1
  272. package/dist/client/assets/{use-session-canvas-u63m2mYH.js → use-session-canvas-BaGypLR6.js} +3 -3
  273. package/dist/client/assets/{use-status-budget-CbmPFvpQ.js → use-status-budget-Q1ltHI80.js} +4 -4
  274. package/dist/client/assets/{use-unclaimed-chats-D7SEUfiO.js → use-unclaimed-chats-Bext8Aim.js} +1 -1
  275. package/dist/client/assets/use-update-config-BJEw2LjV.js +1 -0
  276. package/dist/client/assets/{useMutationState-rOg4bnKv.js → useMutationState-C3WVn0hu.js} +1 -1
  277. package/dist/client/assets/{usecaseDiagram-WPOLBNNX-C-w0e-nv.js → usecaseDiagram-WPOLBNNX-Dg4P8nSr.js} +1 -1
  278. package/dist/client/assets/{vennDiagram-Q3Y3IDCW-BNm2WXT5.js → vennDiagram-Q3Y3IDCW-B8Txoqsz.js} +1 -1
  279. package/dist/client/assets/{wardleyDiagram-IVAIDKWA-BFyFLiir.js → wardleyDiagram-IVAIDKWA-lgQBspKc.js} +1 -1
  280. package/dist/client/assets/{xychartDiagram-4URNHDU4-BKxZlnEx.js → xychartDiagram-4URNHDU4-Ct9-Lgo9.js} +1 -1
  281. package/dist/client/index.html +2 -2
  282. package/dist/server/extension-child.cjs +1701 -435
  283. package/dist/server/index.js +23150 -21706
  284. package/dist/server/index.js.map +2 -2
  285. package/package.json +4 -4
  286. package/dist/client/assets/ChannelComposer-CutghXOq.js +0 -44
  287. package/dist/client/assets/HandlePage-XG5mP_e9.js +0 -1
  288. package/dist/client/assets/NamePage-Cdd9-mZg.js +0 -1
  289. package/dist/client/assets/PhotoPage-DFic-gDH.js +0 -1
  290. package/dist/client/assets/_shell.channels-B7lTxkqM.js +0 -10
  291. package/dist/client/assets/_shell.marketplace-BMqwT9qX.js +0 -1
  292. package/dist/client/assets/_shell.marketplace_.sources-pXGa7Cqb.js +0 -1
  293. package/dist/client/assets/_shell.session-CmoE1W38.js +0 -1
  294. package/dist/client/assets/_shell.x._extensionId-BiXilrSW.js +0 -1
  295. package/dist/client/assets/_shell.x._extensionId_._-BiXilrSW.js +0 -1
  296. package/dist/client/assets/channel-A2WD4smw.js +0 -1
  297. package/dist/client/assets/index-BMCDckcY.js +0 -17
  298. package/dist/client/assets/index-BOuCpkRb.js +0 -1
  299. package/dist/client/assets/index-BVq1p60h.js +0 -1
  300. package/dist/client/assets/index-CjUfPyOM.js +0 -1053
  301. package/dist/client/assets/index-D2ZFfqZZ.css +0 -1
  302. package/dist/client/assets/registry-BSucT23N.js +0 -1
  303. package/dist/client/assets/swimlanesDiagram-AYQRV4AK-Bqjv1MSj.js +0 -8
  304. package/dist/client/assets/use-is-below-desktop-BUS7OPGv.js +0 -1
  305. package/dist/client/assets/use-is-hub-CFhvDMHt.js +0 -1
  306. package/dist/client/assets/use-pending-read-BBBAnUYu.js +0 -1
  307. package/dist/client/assets/use-update-config-Dfd7KMde.js +0 -1
@@ -1,4 +1,4 @@
1
1
  [diffend] Oversized file quarantined before diffing.
2
2
  name: package/dist/server/index.js.map
3
- size: 64257265 bytes
4
- sha256: c9a448e0e0b110e28fba86600564364c3f9b4e9c69b62c06483630ba514ca5f2
3
+ size: 64403575 bytes
4
+ sha256: d61c82b9f70a2c71bde0123f5d8c537ebe4130478b6e356f19e1dbea8136698b
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "dorkos",
3
- "version": "0.125.2",
3
+ "version": "0.125.3",
4
4
  "description": "You, multiplied. Build and run your business with an agent team. Your agents join your team chat, take on real work, and build the tools your company runs on.",
5
5
  "license": "MIT",
6
6
  "author": "Dorian Collier",
@@ -83,12 +83,12 @@
83
83
  "typescript": "^5.9.3",
84
84
  "vitest": "^4.1.11",
85
85
  "@dorkos/browser": "0.0.0",
86
- "@dorkos/db": "0.0.0",
86
+ "@dorkos/eslint-config": "0.0.0",
87
87
  "@dorkos/harness": "0.0.0",
88
88
  "@dorkos/marketplace": "0.0.0",
89
- "@dorkos/server": "0.0.0",
90
- "@dorkos/eslint-config": "0.0.0",
91
89
  "@dorkos/typescript-config": "0.0.0",
90
+ "@dorkos/server": "0.0.0",
91
+ "@dorkos/db": "0.0.0",
92
92
  "@dorkos/shared": "0.0.0",
93
93
  "@dorkos/client": "0.0.0"
94
94
  },
@@ -1,44 +0,0 @@
1
- const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/index-BMCDckcY.js","assets/index-CjUfPyOM.js","assets/index-D2ZFfqZZ.css","assets/room-files-source-DXKpm43a.js","assets/markdown-content-ysBIqFAg.js","assets/file-exclamation-point-BcCIL-rE.js","assets/query-keys-DeYqUDia.js","assets/composer-insert-BpyATrmR.js","assets/index-6yT0Qr0s.js","assets/file-drag-GDx2qhdk.js","assets/rotate-cw-scTEKxeZ.js","assets/link-2-xieOmwOK.js","assets/file-bSD5jgk_.js","assets/git-branch-ClXAt1_G.js","assets/more-details-DHCpYDi7.js"])))=>i.map(i=>d[i]);
2
- import{W as F,r as i,j as l,B as ue,hv as yt,mD as bt,g as vt,jS as kt,G as ne,a1 as fe,a3 as De,a4 as Pe,aP as H,c8 as Fe,c9 as wt,cO as Nt,mE as It,kx as Rt,mF as Ct,h as At,aA as Mt,cf as Le,gk as se,q as Z,a7 as Be,s as pe,ml as jt,mG as St,mn as Ot,mH as _t,dX as Et,fW as Tt,mB as $t,mI as Dt,mJ as Pt,a0 as Ft,bx as Lt,mK as Bt,mL as Ut,ji as Ht,ib as Kt,h0 as Wt,lt as Ne,mM as Ue,bL as qt,ls as X,lw as He,mN as zt,c7 as ge,ai as Vt,bP as he,i6 as Ke,mO as Gt,cj as We,mP as Jt,eU as Yt,k7 as qe,mQ as ze,aZ as Xt,gZ as Ve,lv as Qt,mR as Ge,mS as Zt,mT as en,mU as tn,mV as Ie,eN as nn,mW as sn,mX as on,mY as an,mZ as rn,m_ as cn,m$ as ln,l as dn,hI as un,ar as Je,lk as mn,aj as fn,n0 as pn,n1 as gn,n2 as hn,b8 as xn,bX as yn,n3 as bn,n4 as vn,n5 as kn,n6 as wn,by as Re,ea as Nn}from"./index-CjUfPyOM.js";import{g as Ce,m as Ae,h as xe,f as Ye,M as In,a as Rn,E as Cn,i as An,j as Mn,b as P,c as jn,k as Sn,u as On,C as _n}from"./index-Dj4I8KcL.js";import{R as En,A as Xe}from"./repeat-wB31CP7I.js";import{u as Tn}from"./use-room-sessions-W62Zl72O.js";import"./WidgetErrorCard-I8WiJv2g.js";import{M as $n}from"./markdown-content-ysBIqFAg.js";import{W as Dn,a as Pn}from"./find-latest-widget-fence-D01ENK2h.js";import{f as Fn}from"./format-duration-BCr6uzby.js";import{H as Ln,a as Bn,b as Un}from"./RuntimeSetupDialog-Er-lzjmK.js";import{M as Me}from"./mention-pill-Daeu1X92.js";import{R as Hn}from"./rotate-ccw-clock-LSKKAcnR.js";import{U as Kn}from"./unplug-DLA7Ib_s.js";import{M as Wn}from"./message-square-off-D9hm8WNH.js";import{i as qn}from"./registry-BSucT23N.js";/**
3
- * @license lucide-react v1.48.0 - ISC
4
- *
5
- * This source code is licensed under the ISC license.
6
- * See the LICENSE file in the root directory of this source tree.
7
- */const Qe={name:"hand",size:24,node:[["path",{d:"M18 11V6a2 2 0 0 0-2-2a2 2 0 0 0-2 2",key:"1fvzgz"}],["path",{d:"M14 10V4a2 2 0 0 0-2-2a2 2 0 0 0-2 2v2",key:"1kc0my"}],["path",{d:"M10 10.5V6a2 2 0 0 0-2-2a2 2 0 0 0-2 2v8",key:"10h0bg"}],["path",{d:"M18 8a2 2 0 1 1 4 0v6a8 8 0 0 1-8 8h-2c-2.8 0-4.5-.86-5.99-2.34l-3.6-3.6a2 2 0 0 1 2.83-2.82L7 15",key:"1s1gnw"}]]};Qe.node;const zn=F(Qe);/**
8
- * @license lucide-react v1.48.0 - ISC
9
- *
10
- * This source code is licensed under the ISC license.
11
- * See the LICENSE file in the root directory of this source tree.
12
- */const Ze={name:"link-2-off",size:24,node:[["path",{d:"M9 17H7A5 5 0 0 1 7 7",key:"10o201"}],["path",{d:"M15 7h2a5 5 0 0 1 4 8",key:"1d3206"}],["line",{x1:"8",x2:"12",y1:"12",y2:"12",key:"rvw6j4"}],["line",{x1:"2",x2:"22",y1:"2",y2:"22",key:"a6p6uj"}]]};Ze.node;const Vn=F(Ze);/**
13
- * @license lucide-react v1.48.0 - ISC
14
- *
15
- * This source code is licensed under the ISC license.
16
- * See the LICENSE file in the root directory of this source tree.
17
- */const et={name:"megaphone",size:24,node:[["path",{d:"M11 6a13 13 0 0 0 8.4-2.8A1 1 0 0 1 21 4v12a1 1 0 0 1-1.6.8A13 13 0 0 0 11 14H5a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2z",key:"q8bfy3"}],["path",{d:"M6 14a12 12 0 0 0 2.4 7.2 2 2 0 0 0 3.2-2.4A8 8 0 0 1 10 14",key:"1853fq"}],["path",{d:"M8 6v8",key:"15ugcq"}]]};et.node;const Gn=F(et);/**
18
- * @license lucide-react v1.48.0 - ISC
19
- *
20
- * This source code is licensed under the ISC license.
21
- * See the LICENSE file in the root directory of this source tree.
22
- */const tt={name:"power-off",size:24,node:[["path",{d:"M18.36 6.64A9 9 0 0 1 20.77 15",key:"dxknvb"}],["path",{d:"M6.16 6.16a9 9 0 1 0 12.68 12.68",key:"1x7qb5"}],["path",{d:"M12 2v4",key:"3427ic"}],["path",{d:"m2 2 20 20",key:"1ooewy"}]]};tt.node;const Jn=F(tt);/**
23
- * @license lucide-react v1.48.0 - ISC
24
- *
25
- * This source code is licensed under the ISC license.
26
- * See the LICENSE file in the root directory of this source tree.
27
- */const nt={name:"reply",size:24,node:[["path",{d:"M20 18v-2a4 4 0 0 0-4-4H4",key:"5vmcpk"}],["path",{d:"m9 17-5-5 5-5",key:"nvlc11"}]]};nt.node;const Yn=F(nt);/**
28
- * @license lucide-react v1.48.0 - ISC
29
- *
30
- * This source code is licensed under the ISC license.
31
- * See the LICENSE file in the root directory of this source tree.
32
- */const st={name:"timer",size:24,node:[["line",{x1:"10",x2:"14",y1:"2",y2:"2",key:"14vaq8"}],["line",{x1:"12",x2:"15",y1:"14",y2:"11",key:"17fdiu"}],["circle",{cx:"12",cy:"14",r:"8",key:"1e1u0o"}]]};st.node;const Xn=F(st);/**
33
- * @license lucide-react v1.48.0 - ISC
34
- *
35
- * This source code is licensed under the ISC license.
36
- * See the LICENSE file in the root directory of this source tree.
37
- */const ot={name:"user-minus",size:24,node:[["path",{d:"M16 21v-2a4 4 0 0 0-4-4H6a4 4 0 0 0-4 4v2",key:"1yyitq"}],["circle",{cx:"9",cy:"7",r:"4",key:"nufk8"}],["line",{x1:"22",x2:"16",y1:"11",y2:"11",key:"1shjgl"}]]};ot.node;const je=F(ot);/**
38
- * @license lucide-react v1.48.0 - ISC
39
- *
40
- * This source code is licensed under the ISC license.
41
- * See the LICENSE file in the root directory of this source tree.
42
- */const at={name:"user-x",size:24,node:[["path",{d:"M16 21v-2a4 4 0 0 0-4-4H6a4 4 0 0 0-4 4v2",key:"1yyitq"}],["circle",{cx:"9",cy:"7",r:"4",key:"nufk8"}],["line",{x1:"17",x2:"22",y1:"8",y2:"13",key:"3nzzx3"}],["line",{x1:"22",x2:"17",y1:"8",y2:"13",key:"1swrse"}]]};at.node;const Qn=F(at),Zn='[data-slot="identity-hover-card-actions"] button:not(:disabled)';function es(e){const{open:n,setOpen:s,triggerRef:t,enabled:o}=e,a=i.useRef(null),r=i.useRef(!1);i.useEffect(()=>{if(!n||!r.current)return;r.current=!1;let u=0,x=0;const v=()=>{var m;const f=(m=a.current)==null?void 0:m.querySelector(Zn);if(f)return f.focus();++u<10&&(x=requestAnimationFrame(v))};return v(),()=>cancelAnimationFrame(x)},[n]);const c=i.useCallback(u=>{var x;!u&&((x=a.current)!=null&&x.contains(document.activeElement))||s(u)},[s]),d=i.useCallback(u=>{!o||u.key!=="Enter"&&u.key!==" "||(u.preventDefault(),r.current=!0,s(!0))},[o,s]),g=i.useMemo(()=>({onEscapeKeyDown:()=>{var u;return(u=t.current)==null?void 0:u.focus()},onBlur:u=>{var v,f,m;const x=u.relatedTarget;x&&((v=a.current)!=null&&v.contains(x)||(f=t.current)!=null&&f.contains(x))||(m=a.current)!=null&&m.contains(document.activeElement)||s(!1)}}),[s,t]);return{contentRef:a,handleOpenChange:c,onTriggerKeyDown:d,contentHandlers:g}}function ce(e){const n=e.key==="ArrowRight"||e.key==="ArrowDown",s=e.key==="ArrowLeft"||e.key==="ArrowUp",t=e.key==="Tab";if(!n&&!s&&!t)return;const o=e.currentTarget.closest('[data-slot="identity-hover-card-actions"]');if(!o)return;const a=Array.from(o.querySelectorAll("button:not(:disabled)")),r=a.indexOf(document.activeElement);if(r===-1||a.length===0)return;e.preventDefault();const c=s||t&&e.shiftKey?-1:1;a[(r+c+a.length)%a.length].focus()}function ts({kind:e,about:n}){const t=[e==="agent"?"Agent":e==="human"?"Person":null,n.role].filter(Boolean).join(" · ");return!t&&!n.status?null:l.jsxs("div",{className:"flex min-w-0 flex-col gap-0.5 px-3 pb-3","data-slot":"identity-hover-card-about",children:[t&&l.jsx("p",{className:"text-muted-foreground truncate text-xs",title:t,children:t}),n.status&&l.jsx("p",{className:"text-foreground/80 truncate text-xs","data-slot":"identity-hover-card-status",children:n.status})]})}function ns({actions:e,onAct:n}){const s=t=>()=>{n(),t()};return l.jsxs("div",{className:"border-border mt-auto flex flex-col gap-2 border-t p-3","data-slot":"identity-hover-card-actions",role:"group","aria-label":"Actions",children:[l.jsxs("div",{className:"flex gap-2",children:[e.onMessage&&l.jsx(ue,{size:"xs",className:"flex-1",onClick:s(e.onMessage),onKeyDown:ce,children:"Message"}),e.onViewProfile&&l.jsx(ue,{size:"xs",variant:"outline",className:"flex-1",onClick:s(e.onViewProfile),onKeyDown:ce,children:"Profile"})]}),e.session&&l.jsxs("button",{type:"button","data-slot":"identity-hover-card-session",onClick:s(e.session.onOpen),onKeyDown:ce,className:"text-muted-foreground hover:text-foreground focus-visible:ring-ring flex min-w-0 items-center gap-1.5 rounded-sm text-left text-xs transition-colors focus-visible:ring-2 focus-visible:outline-none",children:[l.jsx(yt,{className:"size-3.5 shrink-0","aria-hidden":!0}),l.jsx("span",{className:"truncate",children:e.session.label})]})]})}const ss=300;function G({className:e,children:n}){return l.jsx("span",{className:ne("bg-muted text-muted-foreground text-2xs inline-flex max-w-full items-center gap-1 truncate rounded-full px-2 py-0.5",e),children:n})}function ye({identity:e,children:n,onViewProfile:s,about:t,actions:o,onOpenChange:a,openOnClick:r=!1,className:c}){const{kind:d,displayName:g,handle:u,color:x,emoji:v,imageUrl:f,origin:m,agent:p}=e,h=x??"hsl(var(--muted-foreground))",w=typeof m=="object"&&m!==null,y=d==="agent"&&(p==null?void 0:p.working)!=null?p.working:null,[I,S]=i.useState(!1),C=i.useCallback(k=>{S(k),a==null||a(k)},[a]),A=i.useRef(!1),N=i.useRef(null),M=bt({onLongPress:()=>{A.current&&C(!0)}}),{contentRef:j,handleOpenChange:b,onTriggerKeyDown:O,contentHandlers:_}=es({open:I,setOpen:C,triggerRef:N,enabled:r&&o!==void 0});return l.jsxs(Ln,{open:I,onOpenChange:b,openDelay:ss,children:[l.jsx(Bn,{asChild:!0,ref:N,"data-gesture-priority":"",...M,onPointerDown:k=>{A.current=k.pointerType==="touch"||k.pointerType==="pen",M.onPointerDown(k)},...r?{onClick:()=>C(!0),onKeyDown:O}:{},children:n}),l.jsxs(Un,{ref:j,..._,...o?{role:"dialog","aria-label":g}:{},"data-slot":"identity-hover-card",align:"start",className:ne("flex w-64 flex-col gap-0 overflow-hidden p-0",c),children:[l.jsxs("div",{className:"flex items-center gap-3 p-3",children:[l.jsx(vt,{"aria-hidden":!0,color:h,emoji:v,imageUrl:f,fallback:kt(g),kind:d,origin:m,status:y?"working":"idle",size:"md"}),l.jsxs("div",{className:"min-w-0",children:[l.jsx("p",{className:"text-foreground truncate text-sm font-semibold",children:g}),u&&l.jsxs("p",{className:"text-muted-foreground truncate text-xs font-medium",children:["@",u]})]})]}),t&&l.jsx(ts,{kind:d,about:t}),l.jsxs("div",{className:"flex flex-wrap gap-1.5 px-3 pb-3 empty:hidden",children:[d==="agent"&&((p==null?void 0:p.runtime)||(p==null?void 0:p.model))&&l.jsx(G,{children:[p.runtime,p.model].filter(Boolean).join(" · ")}),y&&l.jsxs(G,{className:"bg-status-success-bg text-status-success-fg",children:["Working · ",Fn(y.forMs)]}),d==="human"&&l.jsx(G,{children:w?m.platform:"On this machine"}),d==="agent"&&(p==null?void 0:p.managedBy)&&l.jsxs(G,{children:["Managed by"," ",p.managedBy.handle?`@${p.managedBy.handle}`:p.managedBy.displayName]})]}),o?l.jsx(ns,{actions:o,onAct:()=>{var k;(k=N.current)==null||k.focus(),C(!1)}}):s?l.jsx("button",{type:"button","data-slot":"identity-hover-card-profile",onClick:()=>{var k;(k=N.current)==null||k.focus(),s()},className:"border-border hover:bg-accent focus-visible:ring-ring text-brand-text mt-auto flex w-full items-center border-t px-3 py-2 text-left text-xs font-medium transition-colors focus-visible:ring-2 focus-visible:outline-none",children:"View profile"}):l.jsxs("div",{className:"border-border mt-auto flex items-center justify-between border-t px-3 py-2",children:[l.jsx("span",{className:"text-muted-foreground text-xs font-medium",children:"View profile"}),l.jsx("span",{className:"text-muted-foreground text-3xs tracking-wide uppercase",children:"soon"})]})]})]})}function os(){const e=fe(),n=De();return Pe({onMutate:({roomId:s,entryId:t,emoji:o,viewerAuthorId:a})=>{var u;const r=n.getQueryData(H.entries(s)),c=(u=r==null?void 0:r.find(x=>x.id===t))==null?void 0:u.reactions,{reactions:d,on:g}=Ce(c,o,a);return n.setQueryData(H.entries(s),x=>Ae(x,t,d)),{on:g}},mutationFn:({roomId:s,entryId:t,emoji:o,viewerAuthorId:a})=>{var d,g;const r=n.getQueryData(H.entries(s)),c=((g=(d=r==null?void 0:r.find(u=>u.id===t))==null?void 0:d.reactions)==null?void 0:g.some(u=>u.emoji===o&&u.authorIds.includes(a)))??!1;return e.toggleReaction(s,t,{emoji:o,on:c})},onError:(s,{roomId:t,entryId:o,emoji:a,viewerAuthorId:r},c)=>{c!==void 0&&n.setQueryData(H.entries(t),d=>{var x;const g=(x=d==null?void 0:d.find(v=>v.id===o))==null?void 0:x.reactions,{reactions:u}=Ce(g,a,r,!c.on);return Ae(d,o,u)})},onSuccess:({frequents:s},{roomId:t})=>{n.setQueryData(H.detail(t),o=>o&&{...o,reactionFrequents:s})},meta:{errorLabel:"Couldn’t add your reaction",errorToastId:"room-reaction"}})}function W(e){return e.threadRootEntryId??e.parentEntryId}function as(e){return W(e)??e.id}function rs(e,n){return Math.max(n??0,e)}function Wo(e,n,s){let t=e[0],o=0;for(const a of e)a.seq>t.seq&&(t=a),n!==null&&a.seq>n&&(o+=1);return{count:rs(e.length,s),lastAt:t.createdAt,unread:o}}function is(e){var C,A;const{agentPath:n,displayName:s,onViewProfile:t,engaged:o}=e,a=Fe(),r=wt(),c=a&&o&&n!==void 0,d=Nt(c?n:null),g=It(d.member),u=Rt(),x=Ct(),v=At(),f=Mt(),{data:m}=Le({enabled:c&&r}),p=f.status==="ready"?f.roomId:null,h=m==null?void 0:m.find(N=>N.id===p),w=h?se(h):null,y=(A=(C=d.member)==null?void 0:C.agent)==null?void 0:A.effectiveRuntimeId,I=i.useCallback(()=>{n!==void 0&&(Z.getState().recordOpened("agent",n),u({agentPath:n},y?{runtime:y}:{}))},[n,u,y]),S=i.useCallback(async()=>{if(n===void 0||!v)return;const N=await x(n);if(N===null){Be(`${s} has no session in ${w??"this room"} yet`);return}v(pe({session:N}))},[n,v,x,s,w]);return i.useMemo(()=>!a||n===void 0?null:{about:{role:d.role,status:g},actions:{onMessage:I,...t?{onViewProfile:t}:{},...r&&w?{session:{label:`Session in ${w}`,onOpen:()=>void S()}}:{}}},[a,n,d.role,g,I,t,r,w,S])}function cs({identity:e,agentPath:n,onViewProfile:s,openOnClick:t=!1,children:o}){const[a,r]=i.useState(!1),c=is({agentPath:n,displayName:e.displayName,onViewProfile:s,engaged:a}),d=i.useCallback(g=>{g&&r(!0)},[]);return l.jsx(ye,{identity:e,onViewProfile:s,onOpenChange:d,openOnClick:t&&c!==null,...c?{about:c.about,actions:c.actions}:{},children:o})}function ls(e){return l.jsx(Pn,{code:e.code,isIncomplete:e.isIncomplete})}const ds=[{language:Dn,component:ls}],us={turn_failed:{Icon:Ft,tone:"text-status-warning"},agent_busy:{Icon:Pt},agent_gone:{Icon:Qn,tone:"text-status-warning"},agent_left:{Icon:je,tone:"text-status-warning"},room_archived:{Icon:Dt},agent_reseated:{Icon:$t},handle_changed:{Icon:Xe},runtime_gone:{Icon:Jn,tone:"text-status-warning"},agent_paused:{Icon:Tt},agent_declined:{Icon:Wn},agent_unavailable:{Icon:Et},awaiting_approval:{Icon:zn,tone:"text-status-warning"},halted:{Icon:_t},budget_reached:{Icon:Ot},cascade_stopped:{Icon:St},addressing_changed:{Icon:Gn},bridge_blocked:{Icon:Kn,tone:"text-status-warning"},bridge_undelivered:{Icon:jt,tone:"text-status-warning"},bridge_rate_limited:{Icon:Xn},bridge_second_agent_refused:{Icon:je},bridge_disconnected:{Icon:Vn},bridge_agent_swapped:{Icon:En},bridge_history_note:{Icon:Hn}},ms={Icon:Lt},le=80;function fs(e){const n=e.trim();if(n.length<=le)return n;const s=n.slice(0,le),t=s.lastIndexOf(" ");return`${(t>le/2?s.slice(0,t):s).trimEnd()}…`}function ps(e,n,s){const t=gs(e,s),o=a=>l.jsx("a",{href:n.href,onClick:n.onOpen,"data-testid":"room-notice-session-link",className:"focus-ring hover:text-foreground rounded py-2 font-medium underline underline-offset-2",children:a});return t===null?l.jsxs(l.Fragment,{children:[e," ",o("Open chat")]}):l.jsxs(l.Fragment,{children:[e.slice(0,t.index),o(t.words),e.slice(t.index+t.words.length)]})}function gs(e,n){if(n!==void 0){const t=Bt(n),o=e.lastIndexOf(t);if(o!==-1)return{index:o,words:t}}const s=Ut.exec(e);return s===null?null:{index:s.index,words:s[0]}}function hs({entry:e,feedPosition:n,rowId:s,sessionLink:t,subjectName:o}){const{Icon:a,tone:r}=(e.body.notice&&us[e.body.notice])??ms;return l.jsxs("p",{id:s,"data-slot":"notice-row","data-testid":"room-notice","data-notice":e.body.notice??"unknown",...n&&{role:"article","aria-label":fs(e.body.text)},...xe(n),className:ne("focus-visible:ring-ring flex items-start gap-2 px-[var(--msg-padding-x)] py-2 text-xs outline-none focus-visible:ring-2",r??"text-muted-foreground"),children:[l.jsx(a,{"aria-hidden":!0,className:"mt-px size-3.5 shrink-0"}),l.jsx("span",{children:t?ps(e.body.text,t,o):e.body.text})]})}const xs=qn.moment;function ys({entry:e,moment:n,subject:s,subjectIdentity:t,feedPosition:o,rowId:a}){const r=Ye(e.createdAt);return l.jsx("div",{id:a,"data-slot":"moment-row","data-testid":"room-moment","data-moment":n.kind,role:"article","aria-label":`Moment: ${e.body.text}`,...xe(o),className:"focus-visible:ring-ring px-[var(--msg-padding-x)] py-1 outline-none focus-visible:ring-2",children:l.jsxs("div",{className:"border-border/60 bg-muted/40 flex items-center gap-2.5 rounded-lg border px-3 py-2",children:[l.jsx(ye,{identity:{kind:s.kind,displayName:s.displayName,handle:t==null?void 0:t.handle,color:s.color,emoji:s.emoji,imageUrl:s.imageUrl,origin:t==null?void 0:t.origin,agent:t==null?void 0:t.agent},children:l.jsxs("span",{"data-testid":"room-moment-identity",className:"flex shrink-0 items-center",children:[l.jsx(In,{author:s}),l.jsx("span",{className:"sr-only",children:s.displayName})]})}),l.jsx(xs,{"data-testid":"room-moment-mark","aria-hidden":!0,className:"text-muted-foreground size-3.5 shrink-0"}),l.jsx("p",{className:"min-w-0 flex-1 text-sm",children:e.body.text}),r.length>0&&l.jsx("time",{dateTime:e.createdAt,title:Rn(e.createdAt),className:"text-msg-timestamp shrink-0 text-xs",children:r})]})})}function bs(e,n){const s=X.getState(),t=s.drafts[e]??"",o=t===""||t.endsWith(" ")||t.endsWith(`
43
- `)?"":" ";s.set(e,`${t}${o}@${n} `)}function vs({roomId:e,entry:n,author:s,viewerAuthorId:t,onViewProfile:o}){const a=as(n),r=n.body.text,c=(s==null?void 0:s.id)===t?void 0:(s==null?void 0:s.handle)??void 0,d=s==null?void 0:s.displayName,{copy:g}=Ht({toastOnSettle:!0});return i.useMemo(()=>{const u={reply:{id:"reply",label:"Reply in thread",icon:Yn,run:()=>{Wt.getState().openThread(e,a,!0),Ne.getState().requestFocus(Ue(e,a))}},copy:{id:"copy",label:"Copy text",icon:Kt,run:()=>void g(r)}};return o!==void 0&&(u.profile={id:"profile",label:"View profile",icon:qt,run:o}),c!==void 0&&(u.mention={id:"mention",label:d===void 0?"Mention author":`Mention ${d}`,icon:Xe,run:()=>{bs(e,c),Ne.getState().requestFocus(e)}}),Cn.map(x=>u[x]).filter(x=>x!==void 0)},[e,a,r,c,d,o,g])}function ks(e){if(e.kind==="notice")return{kind:"notice"};const n=e.body.moment;return n?{kind:"moment",moment:n}:{kind:"message"}}function qo(e,n=[]){return new Map([...n.map(s=>[s.author.id,{...s.author,origin:s.origin}]),...e.map(s=>[s.author.id,{...s.author,origin:s.origin}])])}function zo(e,n){const s=e.body.subjectAuthorId;return s===void 0||n.has(e.authorId)?e.authorId:s}function ws(e,n,s){const t=n.get(e),o=He({record:{kind:(t==null?void 0:t.kind)??"system",id:e,displayName:(t==null?void 0:t.displayName)??"Unknown",emoji:t==null?void 0:t.emoji,color:t==null?void 0:t.color,imageUrl:t==null?void 0:t.imageUrl},override:(t==null?void 0:t.agentRef)===void 0?null:s==null?void 0:s.get(t.agentRef)});return{kind:o.kind,id:e,displayName:(t==null?void 0:t.displayName)??"Unknown",emoji:o.emoji,imageUrl:o.imageUrl,color:o.color,isExternal:typeof(t==null?void 0:t.origin)=="object"&&(t==null?void 0:t.origin)!==null,...(t==null?void 0:t.retired)===!0?{retired:!0}:{}}}function Vo(e){const n=new Set;for(const a of e)W(a)===null&&n.add(a.id);const s=[],t=new Map,o=new Set;for(const a of e){const r=W(a);if(r===null){s.push(a);continue}if(!n.has(r)){s.push(a),o.add(a.id);continue}const c=t.get(r);c?c.push(a):t.set(r,[a])}return{topLevel:s,repliesByRoot:t,orphaned:o}}function Ns(e){return`thread-${e}`}function Is(e){return`thread-row-${e}`}function Go(e){return`thread-panel-entry-${e}`}function Rs(e){return`room-entry-${e}`}function Cs(e,n){const s=e.find(c=>c.id===n);if(s===void 0)return null;const t=W(s)??null,o={rowId:n,domId:Rs(n)};if(t===null)return o;const a=e.find(c=>c.id===t);return a!==void 0&&(W(a)??null)===null?{rowId:Ns(t),domId:Is(t)}:o}function Jo(e,n){if(n===null)return null;const s=e.find(t=>t.seq===n);return s===void 0?null:Cs(e,s.id)}const Se=48;function Yo(e,n,s){const t=e.body.answersEntryId;if(t===void 0||t===e.id||n!==void 0&&n.id===t)return null;const o=s(t);if(o===void 0)return null;const a=o.body.text.replace(/\s+/gu," ").trim();return a.length===0?null:{entryId:t,excerpt:a.length>Se?`${a.slice(0,Se).trimEnd()}…`:a}}function As(e,n){const s=new Map;for(const t of e){const o=n[t.projectPath];if(!o)continue;const a=zt({runtime:o.runtime,model:o.model});s.set(ge(t.projectPath),{memberId:t.id,visual:Vt(o),runtime:a.label,...a.modelLabel!==null&&{model:a.modelLabel}})}return s}function Ms(e){const n=new Map;for(const[s,t]of e)n.set(s,t.visual);return n}const js={info:new Map,faces:new Map},be=i.createContext(js);function Xo({known:e,children:n}){return l.jsx(be.Provider,{value:e,children:n})}function Qo(){const e=he(),n=i.useMemo(()=>{var r;return((r=e.data)==null?void 0:r.agents)??[]},[e.data]),s=i.useMemo(()=>n.map(r=>r.projectPath),[n]),t=Ke(s),o=i.useMemo(()=>As(n,t.data??{}),[n,t.data]),a=i.useMemo(()=>Ms(o),[o]);return i.useMemo(()=>({info:o,faces:a}),[o,a])}function ee(e){const n=i.useContext(be);return e===void 0?void 0:n.info.get(e)}function Ss(){return i.useContext(be).faces}function Os({showAuthorHeader:e,headerId:n,displayName:s,time:t,summary:o,contentId:a,summaryId:r,feedPosition:c}){return{...e?{"aria-labelledby":n}:{"aria-label":t.length>0?`${s}, ${t}`:s},"aria-describedby":o===null?a:r,...xe(c)}}const Q=120,_s="code block";function Es(e){if(e.length<=Q&&!e.includes("```"))return null;const n=Ts(e);return n.length===0?null:n}function Ts(e){const n=e.replace(/```[\s\S]*?(?:```|$)/g,` ${_s} `).replace(/`([^`]*)`/g,"$1").replace(/!\[([^\]]*)\]\([^)]*\)/g,"$1").replace(/\[([^\]]*)\]\([^)]*\)/g,"$1").replace(/^\s{0,3}(?:#{1,6}\s+|>\s?|[-*+]\s+)/gm,"").replace(/^\s{0,3}\|?[\s:|-]*\|[\s:|-]*$/gm," ").replace(/\|/g," ").replace(/[*_~]{1,3}/g,"").replace(/\s+/g," ").trim();if(n.length<=Q)return n;const s=$s(n,Q),t=s.lastIndexOf(" ");return`${(t>Q/2?s.slice(0,t):s).trimEnd()}…`}function $s(e,n){if(typeof Intl.Segmenter=="function"){const t=new Intl.Segmenter(void 0,{granularity:"grapheme"});let o="";for(const{segment:a}of t.segment(e)){if(o.length+a.length>n)break;o+=a}return o}let s="";for(const t of e){if(s.length+t.length>n)break;s+=t}return s}function Ds({roomId:e,entry:n,viewerAuthorId:s,reactionFrequents:t,streamStalled:o,isMember:a=!0}){const r=os(),c=o===!0||!a,d=i.useMemo(()=>n.reactions??[],[n.reactions]),g=i.useMemo(()=>d.filter(v=>An(v,s)).map(v=>v.emoji),[d,s]),u=i.useCallback(v=>r.mutate({roomId:e,entryId:n.id,emoji:v,viewerAuthorId:s}),[r,e,n.id,s]),x=i.useMemo(()=>({quick:t,mine:g,onToggle:u,disabled:c}),[t,g,u,c]);return{reactions:d,toggle:u,quickRow:x}}function Ps({barRef:e,pillsRef:n,hasReactions:s}){return t=>{var a,r;if(t.target!==t.currentTarget)return;const{key:o}=t;if(o==="ArrowDown"&&s){t.preventDefault(),(a=n.current)==null||a.focusFirst();return}o!=="ArrowRight"&&o!=="Enter"||(t.preventDefault(),(r=e.current)==null||r.focusFirst())}}function Fs(e,n){var x,v;const s=n.body.subjectAuthorId,t=n.body.notice,o=n.kind==="notice"&&t!==void 0&&s!==void 0&&Gt.includes(t),a=Tn(e,{enabled:o}),r=We(),c=De(),d=fe(),g=o?((v=(x=a.data)==null?void 0:x.bindings.find(f=>f.authorId===s))==null?void 0:v.sessionId)??null:null,u=i.useCallback(f=>{f.button!==0||f.metaKey||f.ctrlKey||f.shiftKey||f.altKey||(f.preventDefault(),!(g===null||s===void 0)&&Jt({queryClient:c,transport:d},e,s).then(m=>{m.kind!=="none"&&r(pe({session:m.kind==="bound"?m.sessionId:g}))}))},[s,r,c,e,g,d]);return i.useMemo(()=>g===null?null:{href:Yt({session:g}),onOpen:u},[u,g])}const te="mention",ve="author_id",Ls={[te]:[ve]},Bs=[te];function Us(e,n){if(!n||n.length===0)return e;const s=Hs(e,n);if(s.length===0)return e;let t=e;for(let o=s.length-1;o>=0;o--){const{offset:a,length:r,authorId:c}=s[o],d=t.slice(0,a),g=t.slice(a,a+r),u=t.slice(a+r);t=`${d}<${te} ${ve}="${c}">${g}</${te}>${u}`}return t}function Hs(e,n){const s=[...n].sort((a,r)=>a.offset-r.offset),t=[];let o=0;for(const a of s)a.offset<o||a.offset+a.length>e.length||(t.push(a),o=a.offset+a.length);return t}const Ks=new Map,rt=i.createContext(Ks);function Ws({authors:e,children:n}){return l.jsx(rt.Provider,{value:e,children:n})}function qs(e){const n=i.useContext(rt);return e===void 0?void 0:n.get(e)}const Oe=new WeakMap;function zs(e){const n=Oe.get(e);if(n)return n;const s=new Map(e.map(t=>[ge(t.projectPath),t.projectPath]));return Oe.set(e,s),s}function Vs(e){var t;const s=(t=he().data)==null?void 0:t.agents;return i.useMemo(()=>e===void 0||!s?void 0:zs(s).get(e),[s,e])}function it(e){const{agentRef:n,identity:s,onViewProfile:t}=e,o=Fe(),a=Vs(o?n:void 0),r=ee(n);return i.useMemo(()=>{if(!o||s.kind!=="agent"||a===void 0)return null;const c={...s,agent:r&&{runtime:r.runtime,...r.model&&{model:r.model}}},d=(g,u={})=>l.jsx(cs,{identity:c,agentPath:a,onViewProfile:t,openOnClick:u.openOnClick??!1,children:g});return{wrap:d,wrapAvatar:g=>d(l.jsx("button",{type:"button",tabIndex:-1,"aria-label":s.displayName,"aria-haspopup":"dialog",className:"focus-ring inline-flex cursor-pointer rounded-sm","data-slot":"room-agent-card-face",children:g}),{openOnClick:!0}),wrapName:g=>d(l.jsx("button",{type:"button","aria-haspopup":"dialog",className:ne(g.props.className,"focus-ring cursor-pointer rounded-sm text-left underline-offset-4 hover:underline"),"data-slot":"room-agent-card-name",children:s.displayName}),{openOnClick:!0})}},[o,s,a,r,t])}const Gs={kind:"human",displayName:""};function Js(e){return typeof e=="string"?e.replace(/^@/,""):""}function Ys({authorId:e,children:n}){const s=qs(e),t=ee(s==null?void 0:s.agentRef),{open:o}=qe(),a=s?He({record:s,override:t==null?void 0:t.visual}):null,r=s?ze(s,t==null?void 0:t.memberId):void 0,c=i.useMemo(()=>r===void 0?void 0:()=>o(r),[r,o]),d=a==null?void 0:a.color,g=a==null?void 0:a.emoji,u=a==null?void 0:a.imageUrl,x=i.useMemo(()=>s?{kind:s.kind,displayName:s.displayName,handle:s.handle??void 0,color:d,emoji:g,imageUrl:u,origin:s.origin,agent:t&&{runtime:t.runtime,...t.model&&{model:t.model}}}:null,[s,d,g,u,t]),v=it({agentRef:s==null?void 0:s.agentRef,identity:x??Gs,onViewProfile:c});if(!s||!x)return l.jsx(Me,{kind:"human",label:Js(n),resolved:!1});const m=v?{role:"button",tabIndex:0,"aria-haspopup":"dialog"}:c?{role:"button",tabIndex:0,"aria-label":`View ${s.displayName}’s profile`,onClick:c,onKeyDown:h=>{h.key!=="Enter"&&h.key!==" "||(h.preventDefault(),c())}}:{},p=l.jsx(Me,{kind:s.kind,label:s.displayName,handle:s.handle??void 0,color:s.color,origin:s.origin,resolved:!0,interactive:c!==void 0,...m});return v?v.wrap(p,{openOnClick:!0}):l.jsx(ye,{onViewProfile:c,identity:x,children:p})}function Xs(e){return{mention:n=>{const s=n[ve],t=typeof s=="string"?s:void 0;return!t||!e.has(t)?l.jsx(l.Fragment,{children:n.children}):l.jsx(Ys,{authorId:t,children:n.children})}}}function Qs({entry:e,authors:n}){const s=i.useMemo(()=>Us(e.body.text,e.mentionSpans),[e.body.text,e.mentionSpans]),t=i.useMemo(()=>{var a;return new Set(((a=e.mentionSpans)==null?void 0:a.map(r=>r.authorId))??[])},[e.mentionSpans]),o=i.useMemo(()=>Xs(t),[t]);return l.jsx(Ws,{authors:n,children:l.jsx($n,{content:s,className:"msg-prose",allowedTags:Ls,literalTagContent:Bs,components:o,renderers:ds})})}function Zs(e){return function(s){return l.jsx(Qs,{entry:s,authors:e})}}const ct="the top folder";function _e(e){return e.slice(e.lastIndexOf("/")+1)}function eo(e){const n=e.lastIndexOf("/");return n===-1?"":e.slice(0,n)}function to(e){return e===""?ct:`${e}/`}function de(e){return e.target!==void 0?e.target===""?ct:e.target:to(eo(e.paths[0]??""))}function no(e,n){const s=e.paths[0]??"",t=e.target;switch(e.kind){case"edit":return`${n} edited ${t??s}`;case"add":return`${n} added ${t??s}`;case"upload":return e.pathCount===1?`${n} uploaded ${_e(s)} to ${de(e)}`:`${n} uploaded ${e.pathCount} files to ${de(e)}`;case"rename":{const o=e.from??"";return t!==void 0?`${n} renamed ${o} to ${t}`:o.endsWith("/")?`${n} renamed ${o}`:`${n} renamed ${o} to ${s}`}case"delete":return t!==void 0?`${n} deleted ${t}`:e.pathCount===1?`${n} deleted ${s}`:`${n} deleted ${e.pathCount} files`;case"from-attachment":return`${n} saved ${_e(s)} from the chat to ${de(e)}`}}const so=i.lazy(()=>Xt(()=>import("./index-BMCDckcY.js"),__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14])).then(e=>({default:e.SaveToRoomFilesButton})));function Zo({roomId:e,entry:n,author:s,authorRef:t,authors:o,viewerAuthorId:a,authorNames:r,reactionFrequents:c,streamStalled:d,isMember:g=!0,grouping:u,orphanedReply:x,answers:v,feedPosition:f,rowId:m}){const p=Ye(n.createdAt),h=i.useMemo(()=>{const L=Es(n.body.text),ie=Mn(n.attachments??[]);if(ie===null)return L;const we=L??n.body.text.trim();return we.length>0?`${we} ${ie}`:ie},[n.body.text,n.attachments]),w=i.useId(),y=`${w}-author`,I=`${w}-content`,S=`${w}-summary`,C=i.useRef(null),A=i.useRef(null),N=i.useRef(null),{reactions:M,toggle:j,quickRow:b}=Ds({roomId:e,entry:n,viewerAuthorId:a,reactionFrequents:c,streamStalled:d,isMember:g}),O=ee(t==null?void 0:t.agentRef),{open:_}=qe(),k=t===void 0?void 0:ze(t,O==null?void 0:O.memberId),D=i.useCallback(()=>{k!==void 0&&_(k)},[_,k]),T=k===void 0?void 0:D,q=vs({roomId:e,entry:n,author:t,viewerAuthorId:a,onViewProfile:T}),z=(t==null?void 0:t.handle)??void 0,B=i.useMemo(()=>({kind:s.kind,displayName:s.displayName,handle:z,color:s.color,emoji:s.emoji,imageUrl:s.imageUrl}),[s.kind,s.displayName,z,s.color,s.emoji,s.imageUrl]),$=it({agentRef:t==null?void 0:t.agentRef,identity:B,onViewProfile:T}),R=Ps({barRef:A,pillsRef:N,hasReactions:M.length>0}),U=i.useCallback(()=>{var L;return(L=C.current)==null?void 0:L.focus()},[]),oe=i.useMemo(()=>Zs(o),[o]),pt=i.useCallback(L=>l.jsx(i.Suspense,{fallback:null,children:l.jsx(so,{roomId:e,attachment:L})}),[e]),gt=Ss(),ae=n.body.subjectAuthorId??n.authorId,E=o.get(ae),V=ee(E==null?void 0:E.agentRef),ht=Fs(e,n),re=ks(n);if(re.kind==="notice")return l.jsx(hs,{entry:n,feedPosition:f,rowId:m,sessionLink:ht,subjectName:E==null?void 0:E.displayName});if(re.kind==="moment")return l.jsx(ys,{entry:n,moment:re.moment,subject:ae===n.authorId?s:ws(ae,o,gt),subjectIdentity:{handle:(E==null?void 0:E.handle)??void 0,origin:E==null?void 0:E.origin,agent:V&&{runtime:V.runtime,...V.model&&{model:V.model}}},feedPosition:f,rowId:m});const xt=u.position==="first"||u.position==="only";return l.jsxs(P.Root,{ref:C,id:m,position:u.position,actions:q,reactions:b,"data-testid":"room-entry",tabIndex:0,...Os({showAuthorHeader:xt,headerId:y,displayName:s.displayName,time:p,summary:h,contentId:I,summaryId:S,feedPosition:f}),onKeyDown:R,children:[l.jsx(P.Gutter,{author:s,at:n.createdAt,onViewProfile:$?void 0:T,isSelf:n.authorId===a,renderAvatar:$==null?void 0:$.wrapAvatar}),l.jsxs(P.Body,{children:[l.jsx(P.Author,{id:y,author:s,at:n.createdAt,origin:t==null?void 0:t.origin,renderName:$==null?void 0:$.wrapName}),x===!0&&l.jsx("p",{"data-testid":"room-entry-orphan",className:"text-muted-foreground text-xs italic",children:"Replying to an earlier message"}),v!=null&&l.jsx("p",{"data-testid":"room-entry-answers",className:"text-muted-foreground mb-1 truncate text-xs italic",children:`Answering “${v.excerpt}”`}),l.jsx(P.Content,{id:I,className:"[&_:not(pre)>code]:wrap-anywhere [&_pre]:overflow-x-auto",children:n.body.fileChange?l.jsx("p",{"data-testid":"room-entry-file-change",className:"wrap-anywhere",children:no(n.body.fileChange,(E==null?void 0:E.displayName)??"Somebody")}):oe(n,{rowId:n.id,isStreaming:!1})}),h!==null&&l.jsx("span",{id:S,className:"hidden",children:h}),l.jsx(P.Attachments,{items:n.attachments??[],renderAction:g?pt:void 0}),l.jsx(P.Reactions,{ref:N,reactions:M,viewerAuthorId:a,names:r,frequents:c,onToggle:j,disabled:d===!0||!g,onExit:U}),l.jsx(P.Actions,{actions:q,reactions:b,barRef:A,onExit:U})]})]})}const ea={reactions:!0,threads:!0,runWith:!1,attachments:!0,mentions:!0,streamHealth:!0,presence:!0,turnStatus:!1,asks:!0};function oo(e){const n=fe(),[s,t]=i.useState([]),o=i.useRef(new Map),a=i.useCallback(f=>{const m=f.map(p=>({id:crypto.randomUUID(),file:p,status:"pending",progress:0}));t(p=>[...p,...m])},[]),r=i.useCallback(f=>{o.current.delete(f),t(m=>m.filter(p=>p.id!==f))},[]),c=i.useCallback(f=>{if(!f){o.current.clear(),t([]);return}const m=new Set(f);for(const p of m)o.current.delete(p);t(p=>p.filter(h=>!m.has(h.id)))},[]),d=i.useCallback(f=>{o.current.delete(f),t(m=>m.map(p=>p.id===f&&p.status==="error"?{...p,status:"pending",progress:0,error:void 0}:p))},[]),g=i.useRef(null),u=Pe({meta:{suppressErrorToast:!0},mutationFn:async f=>{t(w=>w.map(y=>f.some(I=>I.id===y.id)?{...y,status:"uploading"}:y));const m=w=>{t(y=>y.map(I=>I.status==="uploading"?{...I,progress:w.percentage}:I))},p=new AbortController;g.current=p;const h=f.map(w=>w.file);return n.uploadRoomAttachments(e,h,m,p.signal)},onSettled:()=>{g.current=null},onSuccess:(f,m)=>{m.forEach((p,h)=>{const w=f[h];w&&o.current.set(p.id,w.id)}),t(p=>p.map(h=>m.findIndex(y=>y.id===h.id)===-1?h:{...h,status:"uploaded",progress:100}))},onError:f=>{t(m=>m.map(p=>p.status==="uploading"?{...p,status:"error",error:f.message}:p))}}),x=i.useCallback(()=>{var f;(f=g.current)==null||f.abort()},[]),v=i.useCallback(async()=>{const f=s.filter(p=>p.status==="error");if(f.length>0)throw new Error(f.length===1?`${f[0].file.name} didn’t upload. Try again or remove it.`:`${f.length} files didn’t upload. Try again or remove them.`);const m=s.filter(p=>p.status==="pending");return m.length>0&&await u.mutateAsync(m),s.map(p=>o.current.get(p.id)).filter(p=>p!==void 0)},[s,u]);return{pendingFiles:s,addFiles:a,removeFile:r,retryFile:d,clearFiles:c,cancelUpload:x,uploadAndGetIds:v,hasPendingFiles:s.length>0,hasFailedUpload:s.some(f=>f.status==="error"),isUploading:u.isPending}}function ta(e){const{room:n,threadRootId:s}=e,t=jn(),o=Sn(),a=oo((n==null?void 0:n.id)??""),r=n!==void 0&&Ve(n.members,n.viewerAuthorId),c=i.useRef({attachments:a,post:t,reply:o,room:n,threadRootId:s});i.useEffect(()=>{c.current={attachments:a,post:t,reply:o,room:n,threadRootId:s}});const d=i.useCallback(y=>c.current.attachments.addFiles(y),[]),g=i.useCallback(y=>c.current.attachments.removeFile(y),[]),u=i.useCallback(y=>c.current.attachments.retryFile(y),[]),x=i.useCallback(()=>c.current.attachments.cancelUpload(),[]),{pendingFiles:v,hasFailedUpload:f,isUploading:m}=a,p=i.useMemo(()=>({staged:v,add:d,remove:g,retry:u,cancel:x,hasFailed:f,isUploading:m,holdsSendWhileUploading:!1}),[v,f,m,d,g,u,x]),h=i.useCallback(async y=>{const{attachments:I,post:S,reply:C,room:A,threadRootId:N}=c.current;if(A===void 0)throw new Error("That room isn’t loaded yet.");if(A.archived)throw new Error("This room is archived.");Z.getState().recordOpened("room",A.id);const M=Qt(),j=I.pendingFiles.map(k=>k.file.name),b=I.pendingFiles.map(k=>k.id),O=await I.uploadAndGetIds();I.clearFiles(b);const _=y.parentEntryId??N;if(_!==void 0){C.mutate({roomId:A.id,rootEntryId:_,text:y.text,clientId:M,attachmentIds:O,attachmentNames:j});return}S.mutate({roomId:A.id,text:y.text,clientId:M,attachmentIds:O,attachmentNames:j})},[]);return{target:i.useMemo(()=>({kind:"room",id:(n==null?void 0:n.id)??"",placeholder:n===void 0?"Message…":s===void 0?`Message ${se(n)}…`:"Reply in this thread…",canSend:n!==void 0&&!n.archived&&r,...n===void 0?{canSendReason:"Still opening this room…"}:n.archived?{canSendReason:"This room is archived. You can read it, but not add to it."}:r?{}:{canSendReason:Ge},send:h,attachments:p}),[n,s,r,p,h]),attachments:a}}const lt=8;function dt(e){if(e==null)return null;const n=e.replace(/\s+/g," ").trim();return n.length===0?null:n}function ao(e){if(tn(e)){const s=e.unreadCount??0;return s===1?"1 new message":`${s} new messages`}const n=e.working??0;return n>0?n===1?"1 agent working":`${n} agents working`:dt(e.topic)}function Ee(e){return{kind:"session",id:e.id,name:en(e.title),summary:dt(e.lastMessagePreview),lastActivityAt:e.updatedAt,session:e}}function ro(e){return{kind:e.kind==="dm"?"dm":"channel",id:e.id,name:se(e),summary:ao(e),lastActivityAt:e.lastActivityAt,room:e}}function J(e){if(e===void 0)return null;const n=Date.parse(e);return Number.isNaN(n)?null:n}function io(e){return e.kind==="session"?Ie("session",e.id):Ie("room",e.id)}function Te(e,n){const s=[J(n[io(e)]),...e.kind==="session"?[J(e.session.lastTouchedByYouAt),J(e.session.userLastMessageAt)]:[]].filter(t=>t!==null);return s.length>0?Math.max(...s):J(e.lastActivityAt)??Number.NEGATIVE_INFINITY}function co(e){return(n,s)=>Te(s,e)-Te(n,e)||s.id.localeCompare(n.id)}function lo(e){const n=new Set;return e.filter(s=>{const t=`${s.kind}:${s.id}`;return n.has(t)?!1:(n.add(t),!0)})}function uo(e,n){return!(n.has(e.id)||e.unreadCount===null||e.lastActivityAt===e.createdAt)}function mo({sessions:e,rooms:n,mutedRoomIds:s=new Set,interactions:t={},limit:o=lt}){const{yours:a,spinOffs:r,automated:c}=Zt(e),d=co(t),g=[...a.map(Ee),...n.filter(u=>uo(u,s)).map(ro)].sort(d);return{items:lo(g).slice(0,o),automated:[...r,...c].map(Ee).sort(d).slice(0,o)}}const fo=3,po=on;function go({limit:e=lt,mutedRoomIds:n,enabled:s=!0}={}){var g,u;const t=nn(Math.max(e*fo,po),{enabled:s}),o=Le({enabled:s}),a=sn(),r=(g=t.data)==null?void 0:g.sessions,c=o.data;return{...i.useMemo(()=>mo({sessions:r??[],rooms:c??[],mutedRoomIds:n,interactions:a,limit:e}),[r,c,n,a,e]),isLoading:s&&(t.isLoading||o.isLoading),warnings:((u=t.data)==null?void 0:u.warnings)??[]}}const ho=6,ut="jump-back-in-listbox";function ke(e){return`jump-back-in-item-${e}`}const xo='[role="combobox"]';function K(e){return e instanceof Element&&e.matches(xo)}function yo({value:e,yieldToPalette:n=!1,enabled:s=!0}){const t=We(),o=an(),[a,r]=i.useState(!1),[c,d]=i.useState({stamp:"",index:0}),[g,u]=i.useState(!1),[x,v]=i.useState(!1);e.length>0&&!x&&v(!0);const f=i.useRef(!1);i.useEffect(()=>{f.current=!0},[]);const{data:m}=he({enabled:s}),p=i.useMemo(()=>((m==null?void 0:m.agents)??[]).map(R=>R.projectPath),[m]),{data:h}=Ke(p,{enabled:s}),w=i.useMemo(()=>h??{},[h]),y=i.useMemo(()=>rn(p,w),[p,w]),I=i.useMemo(()=>new Map(p.map(R=>[ge(R),R])),[p]),S=i.useCallback(R=>cn({room:R,agentsByPath:w,pathByAgentRef:I}),[w,I]),C=i.useMemo(()=>ln(o.muted),[o.muted]),{items:A}=go({mutedRoomIds:C,enabled:s}),N=i.useMemo(()=>A.slice(0,ho),[A]),M=s&&a&&!g&&!x&&!n&&e.length===0&&N.length>0,j=`${M}:${N.length}`,b=c.stamp===j?c.index:0,O=i.useCallback(R=>{f.current&&K(R.target)&&(u(!1),v(!1),r(!0))},[]),_=i.useCallback(R=>{K(R.target)&&r(!0)},[]),k=i.useCallback(R=>{K(R.target)&&r(!1)},[]),D=i.useCallback(R=>{N.length!==0&&d(U=>{const oe=U.stamp===j?U.index:0;return{stamp:j,index:(oe+R+N.length)%N.length}})},[N.length,j]),T=i.useCallback(()=>D(1),[D]),q=i.useCallback(()=>D(-1),[D]),z=i.useCallback(()=>{u(!0)},[]),B=i.useCallback(R=>{if(u(!0),R.kind==="session"){R.session.cwd&&Z.getState().recordOpened("agent",R.session.cwd),t(pe({dir:R.session.cwd??void 0,session:R.session.id}));return}Z.getState().recordOpened("room",R.room.id),t({...dn.channels(),search:{id:R.room.id}})},[t]),$=i.useCallback(()=>{const R=N[b];!M||!R||B(R)},[M,N,b,B]);return{isOpen:M,hasRows:N.length>0,rows:N,agents:w,displayNames:y,visualOf:S,selectedIndex:b,activeDescendantId:M&&N[b]!==void 0?ke(b):void 0,listboxId:M?ut:void 0,handleFocus:O,handleBlur:k,handlePointerDown:_,moveDown:T,moveUp:q,selectHighlighted:$,selectRow:B,dismiss:z}}function mt({mark:e,label:n,title:s,summary:t,lastActivityAt:o,index:a,isSelected:r,now:c,onSelect:d}){const g=i.useMemo(()=>Number.isNaN(Date.parse(o))?null:xn(o),[o,c]);return l.jsxs("div",{id:ke(a),role:"option","aria-selected":r,"data-selected":r,title:s,onClick:d,className:"data-[selected=true]:bg-accent hover:bg-muted flex cursor-pointer items-start gap-2 rounded-md px-2 py-1.5 transition-colors duration-100",children:[l.jsx("span",{className:"mt-px flex shrink-0 items-center",children:e}),l.jsxs("span",{className:"flex min-w-0 flex-1 flex-col",children:[l.jsxs("span",{className:"flex w-full items-center gap-1.5",children:[l.jsx("span",{className:"text-foreground min-w-0 flex-1 truncate text-sm",children:n}),g!==null&&l.jsx("span",{className:"text-muted-foreground/60 text-3xs shrink-0",children:g})]}),t!==null&&l.jsx("span",{className:"text-muted-foreground/70 text-2xs truncate",children:t})]})]})}function bo({item:e,agent:n,displayName:s,index:t,isSelected:o,now:a,onSelect:r}){const c=mn(n,e.session.cwd??s);return l.jsx(mt,{mark:l.jsx(fn,{color:c.color,emoji:c.emoji,size:"xs"}),label:e.name,title:`${s} · ${e.name}`,summary:e.summary,lastActivityAt:e.lastActivityAt,index:t,isSelected:o,now:a,onSelect:r})}function vo({item:e,visual:n,index:s,isSelected:t,now:o,onSelect:a}){return l.jsx(mt,{mark:l.jsx(gn,{room:e.room,participants:e.room.participants,visuals:hn(n)}),label:l.jsx(pn,{room:e.room}),title:e.summary===null?e.name:`${e.name} · ${e.summary}`,summary:e.summary,lastActivityAt:e.lastActivityAt,index:s,isSelected:t,now:o,onSelect:a})}function ko({rows:e,selectedIndex:n,agents:s={},displayNames:t={},visualOf:o,onSelect:a}){const r=un(6e4);return i.useEffect(()=>{var c,d;(d=(c=document.getElementById(ke(n)))==null?void 0:c.scrollIntoView)==null||d.call(c,{block:"nearest"})},[n]),l.jsx(Je.div,{initial:{opacity:0,scale:.98,y:4},animate:{opacity:1,scale:1,y:0},exit:{opacity:0,scale:.98,y:4},transition:{duration:.15,ease:[0,0,.2,1]},className:"bg-popover max-h-80 overflow-hidden rounded-lg border shadow-lg",onMouseDown:c=>c.preventDefault(),children:l.jsx("div",{id:ut,role:"listbox","aria-label":"Jump back in",className:"max-h-72 overflow-y-auto p-1.5",children:e.map((c,d)=>{var g;return c.kind==="session"?l.jsx(bo,{item:c,agent:c.session.cwd&&s[c.session.cwd]||null,displayName:c.session.cwd&&t[c.session.cwd]||((g=c.session.cwd)==null?void 0:g.split("/").pop())||"Agent",index:d,isSelected:d===n,now:r,onSelect:()=>a(c)},`session-${c.id}`):l.jsx(vo,{item:c,visual:o(c.room),index:d,isSelected:d===n,now:r,onSelect:()=>a(c)},`room-${c.id}`)})})})}const $e={people:"People",agents:"Agents"},wo=["people","agents"];function No(e,n){const s=[];for(const{author:t}of e){if(t.kind==="system"||t.id===n||t.retired)continue;const o=t.handle;s.push({section:t.kind==="agent"?"agents":"people",authorId:t.id,label:t.displayName,...o?{handle:o}:{},...t.emoji?{emoji:t.emoji}:{},...t.color?{color:t.color}:{},disabled:!o,...o?{}:{disabledReason:"No @name"}})}return s}function Io(e,n,s){const t=n.trim().toLowerCase(),o=e.map((a,r)=>({row:a,position:r,tier:Ro(a,t)})).filter(a=>a.tier!==null).sort((a,r)=>a.tier-r.tier||a.position-r.position);return s.flatMap(a=>o.filter(r=>r.row.section===a).map(({row:r})=>r))}function Ro(e,n){var o;if(n==="")return 0;const s=[(o=e.handle)==null?void 0:o.toLowerCase(),e.label.toLowerCase()].filter(a=>a!==void 0);let t=null;for(const a of s){const r=a===n?0:a.startsWith(n)?1:a.includes(n)?2:null;r!==null&&(t===null||r<t)&&(t=r)}return t}function Y(e,n,s){var a;const t=e.length;if(t===0)return 0;let o=(n%t+t)%t;for(let r=0;r<t;r++){if(!((a=e[o])!=null&&a.disabled))return o;o=(o+s+t)%t}return 0}function Co(e,n,s,t){const o=e.slice(0,n),a=e.slice(n+1+s.length),r=`@${t}`,c=a.startsWith(" ")?"":" ";return{value:o+r+c+a,cursorPos:o.length+r.length+1}}const Ao=/(^|\s)@([A-Za-z0-9_.-]*)$/,ft="mention-palette-listbox";function me(e){return`mention-item-${e}`}function Mo({members:e,viewerAuthorId:n,text:s,sectionOrder:t=wo}){var _;const[o,a]=i.useState(!1),[r,c]=i.useState(""),[d,g]=i.useState(-1),u=yn(s),x=i.useRef(!1),v=i.useMemo(()=>No(e,n),[e,n]),f=i.useMemo(()=>o?Io(v,r,t):[],[v,r,o,t]),[m,p]=i.useState(null),h=m!==null&&m.query===r&&m.open===o?m.index:Y(f,0,1),w=f[h],y=f.length===0||w!==void 0&&!w.disabled?h:Y(f,0,1),I=i.useCallback((k,D)=>{const T=k.slice(0,D).match(Ao);if(!T){a(!1);return}a(!0),c(T[2]),g((T.index??0)+T[1].length)},[]),S=i.useCallback(k=>{u.write(k),x.current=!1},[u]),C=i.useCallback(k=>{x.current||I(u.read(),k)},[I,u]),A=i.useCallback(()=>{p({query:r,open:o,index:Y(f,y+1,1)})},[f,y,r,o]),N=i.useCallback(()=>{p({query:r,open:o,index:Y(f,y-1,-1)})},[f,y,r,o]),M=i.useCallback(k=>k.disabled||k.handle===void 0?null:(x.current=!0,a(!1),Co(u.read(),d,r,k.handle)),[d,r,u]),j=i.useCallback(()=>{const k=f[y];return k?M(k):(a(!1),null)},[f,y,M]),b=i.useCallback(()=>{x.current=!0,a(!1)},[]),O=f.some(k=>!k.disabled);return{isOpen:o,hasSelectableRows:O,rows:f,selectedIndex:y,activeDescendantId:o&&((_=f[y])==null?void 0:_.disabled)===!1?me(y):void 0,listboxId:o?ft:void 0,noteTextChange:S,handleCursorChange:C,moveDown:A,moveUp:N,selectHighlighted:j,selectRow:M,dismiss:b}}function jo({rows:e,selectedIndex:n,onSelect:s}){const t=i.useMemo(()=>{const o=[];return e.forEach((a,r)=>{const c=o[o.length-1];c&&c.section===a.section?c.items.push({row:a,index:r}):o.push({section:a.section,items:[{row:a,index:r}]})}),o},[e]);return i.useEffect(()=>{var o;(o=document.getElementById(me(n)))==null||o.scrollIntoView({block:"nearest"})},[n]),l.jsx(Je.div,{initial:{opacity:0,scale:.98,y:4},animate:{opacity:1,scale:1,y:0},exit:{opacity:0,scale:.98,y:4},transition:{duration:.15,ease:[0,0,.2,1]},className:"bg-popover max-h-80 overflow-hidden rounded-lg border shadow-lg",onMouseDown:o=>o.preventDefault(),children:l.jsx("div",{id:ft,role:"listbox","aria-label":"Mentions",className:"max-h-72 overflow-y-auto p-1.5",children:e.length===0?l.jsx("div",{className:"text-muted-foreground px-2 py-4 text-center text-sm",children:"No one by that name."}):t.map(({section:o,items:a},r)=>l.jsxs("div",{role:"group","aria-label":$e[o],children:[r>0&&l.jsx("div",{className:"bg-border mx-2 my-1.5 h-px"}),l.jsx("div",{"aria-hidden":!0,className:"text-muted-foreground/70 text-2xs px-2 pt-1.5 pb-1 font-medium tracking-wide uppercase",children:$e[o]}),a.map(({row:c,index:d})=>{const g=d===n;return l.jsxs("div",{id:me(d),role:"option","aria-selected":g,"aria-disabled":c.disabled,"data-selected":g,"data-disabled":c.disabled,onClick:()=>{c.disabled||s(c)},className:c.disabled?"flex cursor-not-allowed items-center gap-2 rounded-md px-2 py-1.5 opacity-45":"data-[selected=true]:bg-accent hover:bg-muted flex cursor-pointer items-center gap-2 rounded-md px-2 py-1.5 transition-colors duration-100",children:[l.jsx("span",{"aria-hidden":!0,className:"size-4 shrink-0 text-center text-sm leading-none",children:c.emoji}),l.jsx("span",{className:"text-foreground truncate text-sm font-medium",children:c.label}),c.handle!==void 0&&l.jsxs("span",{className:"text-muted-foreground/70 truncate font-mono text-xs",children:["@",c.handle]}),c.disabledReason!==void 0&&l.jsx("span",{className:"text-muted-foreground/70 text-2xs ml-auto shrink-0",children:c.disabledReason})]},c.authorId)})]},o))})})}function na({room:e,threadRootId:n,focusOnMount:s,offerJumpBackIn:t,onFocusChange:o,attachments:a}){const r=n===void 0?e.id:Ue(e.id,n),c=bn(r),{target:d}=On(),g=vn(),u=kn(r),x=i.useRef(null),v=Ve(e.members,e.viewerAuthorId),f=i.useRef(!1),m=Mo({members:e.members,viewerAuthorId:e.viewerAuthorId,text:c}),p=t===!0,h=yo({value:c,yieldToPalette:m.isOpen,enabled:p}),w=i.useRef(u);i.useEffect(()=>{var b;u!==w.current&&(w.current=u,(b=x.current)==null||b.focus())},[u]),i.useEffect(()=>{var b;s===!0&&((b=x.current)==null||b.focusUnlessTouch())},[]);const y=i.useCallback(b=>X.getState().set(r,b),[r]),[I,S]=i.useState(null);i.useLayoutEffect(()=>{var b;I!==null&&((b=x.current)==null||b.focusAt(I.pos))},[I]);const C=i.useCallback(b=>{b&&(y(b.value),S({pos:b.cursorPos}))},[y]),A=i.useCallback(b=>C(m.selectRow(b)),[m,C]),N=i.useCallback(()=>C(m.selectHighlighted()),[m,C]),M=()=>{if(d===null||!d.canSend||f.current)return;m.dismiss();const b=X.getState().take(r).trim();if(b==="")return;const O=a.pendingFiles.length>0;O&&(f.current=!0),d.send({text:b}).catch(()=>{const _=X.getState(),k=_.drafts[r]??"";_.set(r,k===""?b:`${b}
44
- ${k}`)}).finally(()=>{O&&(f.current=!1)})};if(!v)return l.jsxs("div",{className:"flex items-center justify-between gap-3 border-t px-4 py-3",children:[l.jsx("p",{className:"text-muted-foreground text-sm",children:Ge}),l.jsx(ue,{type:"button",size:"sm",variant:"outline",disabled:g.isPending,onClick:()=>g.mutate({roomId:e.id,authorId:e.viewerAuthorId},{onSuccess:()=>Be.success(`You joined ${se(e)}`)}),children:wn})]});const j=l.jsx(_n.Composer,{inputRef:x,value:c,onChange:b=>{y(b),m.noteTextChange(b)},onSubmit:M,head:l.jsx("span",{role:"status","aria-live":"polite","aria-atomic":"true",className:"sr-only",children:m.isOpen&&m.rows.length===0?"No one by that name.":""}),mentionPicker:l.jsx(Re,{children:m.isOpen&&l.jsx(jo,{rows:m.rows,selectedIndex:m.selectedIndex,onSelect:A})}),overlays:l.jsx(l.Fragment,{children:l.jsx(Re,{children:h.isOpen&&l.jsx(ko,{rows:h.rows,selectedIndex:h.selectedIndex,agents:h.agents,displayNames:h.displayNames,visualOf:h.visualOf,onSelect:h.selectRow})})}),input:{onCursorChange:m.handleCursorChange,isStreaming:!1,isPaletteOpen:m.isOpen||h.isOpen,paletteHasResults:h.isOpen?h.hasRows:m.hasSelectableRows,onArrowUp:h.isOpen?h.moveUp:m.moveUp,onArrowDown:h.isOpen?h.moveDown:m.moveDown,onCommandSelect:h.isOpen?h.selectHighlighted:N,onEscape:h.isOpen?h.dismiss:m.dismiss,tabPicks:!h.isOpen,onClear:()=>{y(""),m.dismiss()},activeDescendantId:h.isOpen?h.activeDescendantId:m.activeDescendantId,paletteListboxId:h.isOpen?h.listboxId:m.listboxId,contextKey:r,...a.hasFailedUpload?{canSubmitReason:"A file didn’t upload. Try it again or remove it, then send."}:{}}});return!p&&o===void 0?j:l.jsx("section",{className:"flex flex-col","data-testid":Nn.homeComposer,onFocus:b=>{h.handleFocus(b),K(b.target)&&(o==null||o(!0))},onBlur:b=>{h.handleBlur(b),K(b.target)&&(o==null||o(!1))},onPointerDown:h.handlePointerDown,children:j})}export{Xo as A,na as C,ye as I,ea as R,qo as a,Zo as b,ws as c,zo as d,Qo as e,Yo as f,Vo as g,Ns as h,rs as i,Wo as j,Is as k,Rs as l,Cs as m,Go as n,Jo as o,K as p,as as r,W as t,ta as u};
@@ -1 +0,0 @@
1
- import{j as o}from"./index-CjUfPyOM.js";import{a as t}from"./ProfileFields-CIbISW83.js";import"./profile-errors-CezsKqhA.js";import"./use-mounted-ref-CBSuPNPv.js";function n({member:r}){return o.jsx(t,{member:r})}export{n as HandlePage};
@@ -1 +0,0 @@
1
- import{j as o}from"./index-CjUfPyOM.js";import{P as m}from"./ProfileFields-CIbISW83.js";import"./profile-errors-CezsKqhA.js";import"./use-mounted-ref-CBSuPNPv.js";function a({member:r}){return o.jsx(m,{member:r})}export{a as NamePage};
@@ -1 +0,0 @@
1
- import{j as r}from"./index-CjUfPyOM.js";import{b as t}from"./ProfileFields-CIbISW83.js";import"./profile-errors-CezsKqhA.js";import"./use-mounted-ref-CBSuPNPv.js";function s({member:o}){return r.jsx(t,{member:o})}export{s as PhotoPage};
@@ -1,10 +0,0 @@
1
- import{W as Mt,r as f,j as t,gU as Ot,a1 as V,ks as Xe,a2 as Ze,kt as z,a3 as le,a4 as we,ku as $t,kv as ue,kw as X,cf as Ut,kx as It,c6 as Lt,g$ as Ft,cj as Re,l as xe,ky as Kt,kz as _t,kA as Pt,kB as je,kC as Ae,B as S,kD as qt,cQ as zt,kE as et,eu as ae,en as tt,eo as st,ep as nt,eq as at,er as Te,I as Me,fX as rt,hs as Yt,fY as it,fZ as ot,f_ as lt,f$ as ct,g0 as dt,g1 as ut,g2 as Ht,$ as Qt,kF as Bt,kG as Jt,kH as Wt,kI as ge,cT as Oe,cU as $e,cW as Ue,cX as Ie,cY as Le,dU as Fe,dB as Ke,a7 as mt,kJ as Gt,kK as Vt,hT as Xt,kL as Zt,kM as _e,kN as es,kO as ts,kP as ft,kQ as ss,kR as pt,kS as ht,kT as ns,eb as xt,kU as as,kV as rs,kW as is,ji as os,a0 as ls,ey as cs,fe as ds,kX as us,c$ as gt,kY as ms,kZ as fs,ad as ps,n as Qe}from"./index-CjUfPyOM.js";import{T as hs,R as xs,a as gs}from"./RoomSurface-Bq6Slne3.js";import{b as pe,C as Ne}from"./index-Dj4I8KcL.js";import{M as ys}from"./markdown-content-ysBIqFAg.js";import{o as vs,a as js,c as Ns}from"./owner-notice-Crxco7HN.js";import"./ChannelComposer-CutghXOq.js";import"./pane-resize-handle-DOchpdJ6.js";import"./UnreadDivider-l_VZ7ECn.js";import"./use-room-follow-claim-BV-MtDQ5.js";import"./use-connector-management-Bo6wOJQS.js";import"./AgentRequestCard--9GA9ymH.js";import"./access-copy-Cj31J6PU.js";import"./query-error-state-COuKRlU0.js";import"./empty-state-aNwJA6H8.js";import"./use-bindings-Bu4yLLR5.js";import"./connection-copy--MA7AN04.js";import"./KeyEntry-CSmznLcG.js";import"./use-room-sessions-W62Zl72O.js";import"./file-bSD5jgk_.js";import"./file-drag-GDx2qhdk.js";import"./find-latest-widget-fence-D01ENK2h.js";import"./WidgetErrorCard-I8WiJv2g.js";import"./index-D0yajRDv.js";import"./card-DI7YtQh3.js";import"./progress-eQl1UvNz.js";import"./table-B0LsKsEv.js";import"./package-CD8xq7hk.js";import"./heart-BrjEmIsl.js";import"./git-branch-ClXAt1_G.js";import"./file-text-DTvj1wzM.js";import"./paperclip-CzhXW5qi.js";import"./index-6yT0Qr0s.js";import"./RuntimeSetupDialog-Er-lzjmK.js";import"./inline-code-DwFNff3_.js";import"./list-runtime-types-B0CSonAi.js";import"./RuntimeConnectFlow-IaRVgmqH.js";import"./useMutationState-rOg4bnKv.js";import"./runtime-connect-Dn0T5YWv.js";import"./repeat-wB31CP7I.js";import"./format-duration-BCr6uzby.js";import"./mention-pill-Daeu1X92.js";import"./rotate-ccw-clock-LSKKAcnR.js";import"./unplug-DLA7Ib_s.js";import"./message-square-off-D9hm8WNH.js";import"./registry-BSucT23N.js";/**
2
- * @license lucide-react v1.48.0 - ISC
3
- *
4
- * This source code is licensed under the ISC license.
5
- * See the LICENSE file in the root directory of this source tree.
6
- */const yt={name:"circle-off",size:24,node:[["path",{d:"m2 2 20 20",key:"1ooewy"}],["path",{d:"M8.35 2.69A10 10 0 0 1 21.3 15.65",key:"1pfsoa"}],["path",{d:"M19.08 19.08A10 10 0 1 1 4.92 4.92",key:"1ablyi"}]]};yt.node;const Cs=Mt(yt),ws=5e3;function Rs({connection:e}){var l;const s=e.official===!0&&e.status==="connected"&&((l=e.access)==null?void 0:l.state)==="unverified",n=f.useMemo(()=>s?{}:null,[s]),[a,i]=f.useState(null);return f.useEffect(()=>{if(!n)return;const d=setTimeout(()=>i(n),ws);return()=>clearTimeout(d)},[n]),n===null||a!==n?null:t.jsx(Ot,{tone:"info",role:"status",className:"m-3","data-testid":"official-space-unreachable",children:"The DorkOS community isn’t reachable right now. Try again in a few minutes."})}function vt(e,s){return[...z.remote(e,s),"teammates"]}function Ss(e,s=!0){const n=V(),a=Xe(s);return Ze({queryKey:a?vt(a,e):[...z.all,"owner","unresolved",e,"teammates"],queryFn:()=>$t(a,async()=>{const[i,l]=await Promise.all([n.getCommunityWakeAgentsFrom(e),n.getCommunityTeammateSpend(e)]);return{wakeAgentsFrom:i.wakeAgentsFrom,spend:l}}),enabled:s&&a!==null})}function ks(e){const s=V(),n=le(),a=Xe(!0);return we({mutationFn:async i=>{"wakeAgentsFrom"in i?await s.setCommunityWakeAgentsFrom(e,i.wakeAgentsFrom):await s.setCommunityTeammateSpendLimit(e,i.monthlyLimitUsd)},onSettled:async()=>{a&&await n.invalidateQueries({queryKey:vt(a,e)})}})}const bs=500,oe=new Map;function jt(e,s){return e.id!==s.id||e.community!==s.community||e.roomId!==s.roomId||e.text===s.text&&e.authorDisplayName===s.authorDisplayName&&JSON.stringify(e.mentions)===JSON.stringify(s.mentions)&&JSON.stringify(e.attachments)===JSON.stringify(s.attachments)?e:{...e,text:s.text,mentions:s.mentions,attachments:s.attachments,authorDisplayName:s.authorDisplayName}}function Ee(e,s){if(s.size===0)return e;let n=!1;const a=e.map(i=>{const l=s.get(i.id),d=l?jt(i,l):i;return d!==i&&(n=!0),d});return n?a:e}function Ce(e,s,...n){const a=new Map;for(const i of n)for(const l of i){if(l.community!==e||l.roomId!==s)throw new Error("Community history contains a different room.");a.set(l.id,l)}return[...a.values()].sort((i,l)=>i.remoteSeq-l.remoteSeq)}function As(e,s,n=!0,a=0,i="legacy",l=!1,d){const c=V(),r=f.useRef(d);f.useEffect(()=>{r.current=d},[d]);const o=le(),h=ue(!0,i,e),u=JSON.stringify([h==null?void 0:h.ownerKey,h==null?void 0:h.epoch,h==null?void 0:h.route.epoch,h==null?void 0:h.accessFingerprint,e,s]),[y,N]=f.useState(()=>({address:u,room:null,entries:[],revisions:oe,deliveries:[],status:"connecting"}));return f.useEffect(()=>{if(!h||!n)return;const v=h,w=new AbortController;let g,O=0,A,_,Y=!1;N({address:u,room:null,entries:[],revisions:oe,deliveries:[],status:"connecting"});function M(){Y=!0,A=void 0,_=void 0,o.removeQueries({queryKey:z.remote(v,e)}),N({address:u,room:null,entries:[],revisions:oe,deliveries:[],status:"removed"})}async function q(){try{await c.subscribeRemoteCommunityRoom(e,s,C=>{var U;if(!(w.signal.aborted||Y||!X(v))){if(C.type==="closed"){(C.reason==="removed"||C.reason==="revoked")&&M();return}if(O=0,C.type==="snapshot")A=C.cursor??void 0,C.redactionCursor&&(_=C.redactionCursor),o.setQueryData(z.room(v,e,s),C.room),N(j=>({address:u,room:C.room,entries:Ee(Ce(e,s,j.address===u?j.entries:[],C.entries).slice(-500),j.address===u?j.revisions:oe),revisions:j.address===u?j.revisions:oe,deliveries:j.deliveries.filter(x=>!C.entries.some(I=>I.originIdempotencyKey===x.idempotencyKey)),status:C.stale?"offline":"live"}));else if(C.type==="revision"){const j=C.entry;C.redactionCursor&&(_=C.redactionCursor);const x=[...z.room(v,e,s),"entries"],b=o.getQueriesData({queryKey:x}).some(([,k])=>k==null?void 0:k.pages.some(F=>F.entries.some(H=>H.id===j.id)))||o.isFetching({queryKey:x})>0||((U=r.current)==null?void 0:U.call(r,j.id))===!0;o.setQueriesData({queryKey:x},k=>{if(!k)return k;let F=!1;const H=k.pages.map(Z=>{const re=Z.entries.map(ee=>jt(ee,j));return re.some((ee,me)=>ee!==Z.entries[me])?(F=!0,{...Z,entries:re}):Z});return F?{...k,pages:H}:k}),N(k=>{if(!b&&!k.entries.some(H=>H.id===j.id))return k;const F=new Map(k.revisions);for(F.delete(j.id),F.set(j.id,j);F.size>bs;)F.delete(F.keys().next().value);return{...k,entries:Ee(k.entries,F),revisions:F}})}else C.type==="deliveries"?N(j=>({...j,deliveries:C.deliveries.filter(x=>!j.entries.some(I=>I.originIdempotencyKey===x.idempotencyKey))})):(A=C.entry.cursor,N(j=>({...j,entries:Ce(e,s,j.entries,[C.entry]).slice(-500),deliveries:j.deliveries.filter(x=>x.idempotencyKey!==C.entry.originIdempotencyKey),status:"live"})))}},{since:A,redactions:_,signal:w.signal})}catch(C){if(w.signal.aborted||!X(v))return;const U=C&&typeof C=="object"&&"status"in C?C.status:void 0,j=C&&typeof C=="object"&&"code"in C?C.code:void 0;j==="COMMUNITY_DELETED"||j==="COMMUNITY_TAKEN_DOWN"?(M(),o.invalidateQueries({queryKey:z.connections(v)})):U===401||U===403||U===404?M():U===410&&j==="COMMUNITY_CURSOR_STALE"&&(A=void 0)}if(w.signal.aborted||Y||!X(v))return;const L=o.getQueryData(z.room(v,e,s));L&&o.setQueryData(z.room(v,e,s),{...L,stale:!0,writable:!1}),N(C=>({...C,room:C.room?{...C.room,stale:!0,writable:!1}:null,status:"offline"})),g=setTimeout(()=>{q()},Math.min(3e4,1e3*2**Math.min(O++,5)))}return q(),()=>{w.abort(),clearTimeout(g)}},[u,e,s,n,a,o,c,h,l]),y.address!==u||!h?{address:u,room:null,entries:[],revisions:oe,deliveries:[],status:"connecting"}:n?y:l?{...y,room:y.room?{...y.room,stale:!0,writable:!1}:null,deliveries:[],status:"offline"}:{address:u,room:null,entries:[],revisions:oe,deliveries:[],status:"removed"}}function Ds(e){var h;const s=Ut(),n=It(),a=e===void 0||(h=s.data)==null?void 0:h.find(u=>u.id===e),i=a!==void 0&&Lt(a)!==null,l=e===void 0||s.data!==void 0||s.isError,[d,c]=f.useState(void 0),r=e!==void 0&&d===e,o=f.useRef(void 0);return f.useEffect(()=>{!i||e===void 0||r||o.current===e||(o.current=e,n({roomId:e},{replace:!0,quiet:!0}).then(u=>{u||c(e)}))},[i,e,r,n]),l?i&&!r?"redirecting":"show":"pending"}function Ts(e,s,n){var c;const a=Ft(),i=Re(),l=e!==void 0&&((c=a.room)==null?void 0:c.id)===e,d=a.status!=="loading";return f.useEffect(()=>{l&&i({...xe.home(),search:{...s===void 0?{}:{thread:s},...n===void 0?{}:{entry:n}},replace:!0})},[l,s,n,i]),e===void 0?"show":l?"redirecting":d?"show":"pending"}function Es(e){return e?{ownerAddress:JSON.stringify([e.ownerKey,e.epoch]),contextAddress:JSON.stringify([e.ownerKey,e.epoch,e.route.epoch,e.accessFingerprint])}:{ownerAddress:"",contextAddress:""}}const Ms=new Set(["COMMUNITY_MUTED","COMMUNITY_SLOW_MODE","COMMUNITY_RULES_NOT_ACCEPTED"]);function Os(e){const s=e==null?void 0:e.code;return typeof s=="string"&&Ms.has(s)}function $s(e,s=new Date){return e.kind==="muted"?`You’re muted here until ${Kt(e.until,s)??"later"}.`:e.kind==="rules"?"Accept this space’s rules to post.":`Slow mode. Post again in ${e.secondsLeft}s.`}function Us(e,s){if(!e)return null;if(e.mutedUntil&&Date.parse(e.mutedUntil)>s)return{kind:"muted",until:e.mutedUntil};const{rules:n}=e;return n.text!==null&&n.version>0&&n.acceptedVersion<n.version?{kind:"rules"}:null}function Is({community:e,roomId:s,enabled:n,accessFingerprint:a}){var Y;const i=V(),l=le(),d=ue(n,a,e),c=d?[...z.room(d,e,s),"standing"]:[...z.all,"owner","unresolved",e,"room",s,"standing"],r=Ze({queryKey:c,queryFn:()=>_t(d,()=>i.getRemoteCommunityStanding(e,s)),enabled:n&&d!==null,staleTime:3e4,retry:!1,refetchInterval:M=>{var q;return(q=M.state.data)!=null&&q.mutedUntil&&Date.parse(M.state.data.mutedUntil)>Date.now()?6e4:!1}}),[o,h]=f.useState(null),[u,y]=f.useState(()=>Date.now()),N=(Y=r.data)!=null&&Y.mutedUntil?Date.parse(r.data.mutedUntil):null;f.useEffect(()=>{if(o!==null&&o>u){const M=setTimeout(()=>y(Date.now()),1e3);return()=>clearTimeout(M)}if(N!==null&&N>u){const M=setTimeout(()=>y(Date.now()),Math.min(N-u+50,1073741824));return()=>clearTimeout(M)}},[N,u,o]);const v=r.refetch,w=f.useCallback(M=>{if((M==null?void 0:M.code)==="COMMUNITY_SLOW_MODE"){const L=M.retryAfterMs;if(typeof L=="number"&&L>0){const C=Date.now();y(C),h(C+L)}return}v()},[v]),g=we({meta:{suppressErrorToast:!0},mutationFn:M=>i.acceptRemoteCommunityRules(e,M),onSuccess:M=>{l.setQueryData(c,q=>q&&{...q,rules:M})},onError:()=>void v()}),O=Us(r.data,u),A=o===null?0:Math.ceil((o-u)/1e3),_=O??(A>0?{kind:"slow",secondsLeft:A}:null);return{standing:r.data,hold:_,noteHold:w,accept:g}}const Ls=new Set(["COMMUNITY_DELETED","COMMUNITY_TAKEN_DOWN"]),Fs=30*6e4,he=new Map;function Nt(e,s,n){return JSON.stringify([e,s,n])}function Ct(e){return Date.now()-e<Fs}function Ks(e){for(const[s,n]of he)Ct(n.at)||he.delete(s);return he.get(e)}function _s(){return Date.now()}function Ps(e,s,n){he.set(e,{attachmentId:s,at:n})}function Be(e){for(const s of e.files)he.delete(Nt(e.ref,e.roomId,s.id))}function Je(e){return e.filter(s=>s.trim()).join(`
7
-
8
- `)}function qs(e){const s=e==null?void 0:e.code;return typeof s=="string"&&Ls.has(s)}function De(e){return e.map(({id:s,file:n})=>({id:s,file:n,status:"pending",progress:0}))}function zs({ref:e,roomId:s,canSend:n,entries:a,onReceipt:i,draft:l,ownerKey:d,contextKey:c=d,onHold:r}){const o=V(),h=JSON.stringify([d,e,s,c]),u=Pt(l),y=u.text,N=f.useMemo(()=>De(u.files),[u.files]),v=f.useRef(l);f.useLayoutEffect(()=>{v.current=l},[l]);function w(m){const R=v.current;if(!R)return;const $=je.getState(),T=$.drafts[Ae(R)],E=m({text:(T==null?void 0:T.text)??"",files:De((T==null?void 0:T.files)??[])});$.write(R,{text:E.text,files:E.files.map(({id:P,file:B})=>({id:P,file:B}))})}function g(m){w(R=>({...R,text:m}))}function O(m){w(R=>({...R,files:m(R.files)}))}const[A,_]=f.useState(null);function Y(m){_(m===null?null:{address:h,context:c,message:m})}const[M,q]=f.useState([]),L=f.useRef(new Map),C=f.useRef(0),U=f.useRef(new Map),j=f.useRef(new Set),x=f.useRef(h),I=f.useRef(c),b=f.useRef(!0),k=f.useRef(n),F=f.useRef(i),H=f.useRef(r);f.useLayoutEffect(()=>{x.current=h,I.current=c,k.current=n,F.current=i,H.current=r},[h,n,c,i,r]),f.useEffect(()=>(b.current=!0,()=>{b.current=!1}),[]),f.useEffect(()=>{let m=!1;for(const R of a){if(!R.originIdempotencyKey)continue;const $=L.current.get(R.originIdempotencyKey);($==null?void 0:$.address)===x.current&&$.context===I.current&&L.current.delete(R.originIdempotencyKey)&&(Be($),m=!0)}m&&q([...L.current.values()])},[a]);function Z(){b.current&&q([...L.current.values()].filter(m=>m.address===x.current&&m.context===I.current).map(m=>({...m})))}async function re(m){var R,$;if(!(j.current.has(m.key)||!k.current||!b.current||m.address!==x.current)){j.current.add(m.key),m.status="sending",m.error=void 0,Z();try{!m.posted&&m.uploadedAt.some(E=>!Ct(E))&&(m.attachmentIds=[],m.uploadedAt=[],m.triedAt=[],m.uploadRound+=1);for(let E=m.attachmentIds.length;E<m.files.length;E++){if(!k.current||!b.current||m.address!==x.current)throw new Error("Reconnect to this channel, then try again.");const P=m.files[E],B=Nt(m.ref,m.roomId,P.id),J=Ks(B);if(J){m.attachmentIds.push(J.attachmentId),m.uploadedAt.push(J.at);continue}const te=(R=m.triedAt)[E]??(R[E]=_s()),W=await o.uploadRemoteCommunityAttachment(m.ref,m.roomId,P.file,m.uploadRound?`${m.key}:file:${E}:${m.uploadRound}`:`${m.key}:file:${E}`);Ps(B,W.id,te),m.uploadedAt.push(te),m.attachmentIds.push(W.id)}if(!k.current||!b.current||m.address!==x.current)throw new Error("Reconnect to this channel, then try again.");m.posted=!0;const T=await o.postRemoteCommunityEntry(m.ref,m.roomId,{text:m.text,parentEntryId:m.parentEntryId,attachmentIds:m.attachmentIds,idempotencyKey:m.key});L.current.delete(m.key),Be(m),b.current&&m.address===x.current&&m.context===I.current&&F.current(T)}catch(T){if(qs(T)&&ee(m)){L.current.delete(m.key);return}if(Os(T)&&ee(m)){L.current.delete(m.key),b.current&&m.address===x.current&&(($=H.current)==null||$.call(H,T));return}m.status="failed",m.error=T instanceof Error?T.message:"Not confirmed. Try this message again."}finally{j.current.delete(m.key),Z()}}}function ee(m){const{draft:R}=m.origin,$=Ae(R),T=je.getState(),E=T.drafts[$],P=(E==null?void 0:E.text)??"";let B=U.current.get($)??[];const J=Je(B.map(G=>G.origin.typed));let te=P;J&&P.startsWith(J)?te=P.slice(J.length).replace(/^\n+/,""):B=[];const W=[...B,m].sort((G,se)=>G.origin.seq-se.origin.seq),ye=new Set(W.flatMap(G=>G.files.map(se=>se.id))),ie=[...W.flatMap(G=>G.files.map(({id:se,file:fe})=>({id:se,file:fe}))),...((E==null?void 0:E.files)??[]).filter(G=>!ye.has(G.id))];return T.write(R,{text:Je([...W.map(G=>G.origin.typed),te]),files:ie}),$ in je.getState().drafts?(U.current.set($,W),!0):!1}function me(m){const R=v.current;if(!R||!k.current)return;const $=je.getState(),T=$.drafts[Ae(R)];if(!T||!T.text.trim()&&T.files.length===0)return;if(L.current.size>=30){Y("Too many messages waiting. Let them send, or retry them first.");return}const E=$.take(R),P=De(E.files),B={address:h,context:c,ref:e,roomId:s,key:crypto.randomUUID(),text:E.text.trim()?E.text:P.map(J=>J.file.name).join(", "),parentEntryId:m,files:P,attachmentIds:[],uploadedAt:[],triedAt:[],posted:!1,uploadRound:0,status:"sending",origin:{draft:R,typed:E.text,seq:C.current+=1}};L.current.set(B.key,B),Y(null),re(B)}return{text:y,setText:g,attachments:{staged:N,add(m){if(m.some(R=>R.size>25*1024*1024)){Y("Each file must be 25 MB or smaller.");return}O(R=>R.length+m.length>8?(Y("Attach up to eight files to one message."),R):[...R,...m.map($=>({id:crypto.randomUUID(),file:$,status:"pending",progress:0}))])},remove(m){O(R=>R.filter($=>$.id!==m))},retry(){},cancel(){O(()=>[])},hasFailed:!1,isUploading:!1,holdsSendWhileUploading:!1},deliveries:M.filter(m=>m.address===h&&m.context===c),error:(A==null?void 0:A.address)===h&&A.context===c?A.message:null,send:me,retry(m){const R=L.current.get(m);R&&re(R)}}}function wt({entry:e,onThread:s,onReport:n}){const a=V(),i=f.useId(),[l,d]=f.useState(null),[c,r]=f.useState(null),o={id:JSON.stringify([e.community,e.authorId]),kind:e.authorKind,displayName:e.authorDisplayName};async function h(u,y){if(c)return;r(u),d(null);let N;try{const v=await a.downloadRemoteCommunityAttachment(e.community,e.roomId,u);N=URL.createObjectURL(v);const w=document.createElement("a");w.href=N,w.download=Array.from(y,g=>g==="/"||g==="\\"||g.charCodeAt(0)<32?"_":g).join(""),document.body.append(w),w.click(),w.remove()}catch(v){d(v instanceof Error?v.message:"Couldn’t download the file. Try again.")}finally{N&&setTimeout(()=>URL.revokeObjectURL(N),1e3),r(null)}}return t.jsxs(pe.Root,{role:e.authorKind==="human"?"user":"assistant","aria-labelledby":i,children:[t.jsx(pe.Gutter,{author:o,at:e.createdAt}),t.jsxs(pe.Body,{children:[t.jsx(pe.Author,{id:i,author:o,at:e.createdAt}),t.jsxs(pe.Content,{children:[t.jsx(ys,{content:e.text}),e.attachments.map(u=>t.jsx(S,{variant:"outline",size:"sm",disabled:c!==null,onClick:()=>void h(u.id,u.name),className:"max-w-full",children:t.jsx("span",{className:"min-w-0 truncate",children:c===u.id?"Downloading…":u.name})},u.id)),l&&t.jsx("p",{role:"alert",className:"text-destructive text-sm",children:l}),s&&t.jsx(S,{variant:"ghost",size:"sm",onClick:()=>s(e.threadRootEntryId??e.id),children:e.depth===0?"Reply in thread":"Open thread"}),n&&t.jsx(S,{variant:"ghost",size:"sm",onClick:n,children:"Report"})]})]})]})}function Ys({community:e,roomId:s,online:n,canEnroll:a,accessFingerprint:i}){var j,x,I;const l=V(),d=le(),c=ue(!0,i,e),r=qt(e,a,i),o=zt(),h=et(e,a,i),[u,y]=f.useState(""),[N,v]=f.useState(""),[w,g]=f.useState(!1),[O,A]=f.useState(null),[_,Y]=f.useState(null),M=f.useId(),q=((j=r.data)==null?void 0:j.filter(b=>b.active))??[],L=((x=o.data)==null?void 0:x.agents.filter(b=>!q.some(k=>k.localAgentId===b.id)))??[];async function C(){c&&X(c)&&await d.invalidateQueries({queryKey:z.remote(c,e)})}async function U(b){if(b.preventDefault(),!u||w||!n||!a||!c)return;const k=c;g(!0),A(null);try{if(await l.enrollRemoteCommunityAgent(e,u,N.trim()?{handle:N.trim()}:{}),!X(k))return;y(""),v(""),await C()}catch(F){X(k)&&A(F instanceof Error?F.message:"Couldn’t add the agent. Try again.")}finally{X(k)&&g(!1)}}return t.jsxs("section",{className:"mt-3 space-y-2 border-t pt-3","aria-label":"Your agents in this space",children:[t.jsx("h3",{className:"text-sm font-medium",children:"My agents"}),t.jsx("p",{className:"text-muted-foreground text-xs",children:"Add an agent from here, then choose whether it joins this channel."}),r.isError&&t.jsxs("p",{role:"alert",children:["Couldn’t load your agents in this space."," ",t.jsx(S,{variant:"ghost",size:"sm",onClick:()=>void r.refetch(),children:"Retry"})]}),(I=r.data)==null?void 0:I.map(b=>{var k;return t.jsx(Hs,{agent:b,roomId:s,online:n,canEnroll:a,takesDms:((k=h.data)==null?void 0:k.available)===!0,onChanged:C,onNotice:Y},b.localAgentId)}),o.isError&&t.jsx("p",{role:"alert",children:"Couldn’t load the agents on this computer."}),a&&L.length>0&&t.jsxs("form",{onSubmit:b=>void U(b),className:"flex flex-wrap items-end gap-2",children:[t.jsxs("div",{className:"min-w-40 flex-1 space-y-1",children:[t.jsx(ae,{htmlFor:`${M}-agent`,children:"Local agent"}),t.jsxs(tt,{value:u,onValueChange:y,disabled:!n||w,children:[t.jsx(st,{id:`${M}-agent`,children:t.jsx(nt,{placeholder:"Choose an agent"})}),t.jsx(at,{children:L.map(b=>t.jsx(Te,{value:b.id,children:b.name},b.id))})]})]}),t.jsxs("div",{className:"min-w-40 flex-1 space-y-1",children:[t.jsx(ae,{htmlFor:`${M}-handle`,children:"Space handle (optional)"}),t.jsx(Me,{id:`${M}-handle`,value:N,onChange:b=>v(b.target.value),disabled:!n||w,placeholder:"Use the agent’s handle"})]}),t.jsx(S,{type:"submit",disabled:!u||!n||w,children:w?"Adding…":"Add to space"})]}),_&&t.jsx("p",{role:"status",className:"text-muted-foreground text-sm",children:_}),O&&t.jsx("p",{role:"alert",className:"text-destructive text-sm",children:O})]})}function Hs({agent:e,roomId:s,online:n,canEnroll:a,takesDms:i,onChanged:l,onNotice:d}){const c=V(),[r,o]=f.useState(null),[h,u]=f.useState(null),y=e.roomIds.includes(s),N=f.useId();async function v(g,O){if(!r){o(g),u(null);try{await O(),await l()}catch(A){u(A instanceof Error?A.message:"Couldn’t finish that. Try again.")}finally{o(null)}}}function w(g){d(g.remoteRevoked?"Stopped taking part.":"Stopped here, but the space wasn’t told. Try again when it’s reachable.")}return t.jsxs("div",{className:"space-y-1 rounded-md border p-2",children:[t.jsxs("p",{className:"text-sm font-medium",children:[e.displayName,!e.active&&" · stopped here"," ",t.jsxs("span",{className:"text-muted-foreground font-normal",children:["· owned by ",e.ownerDisplayName]})]}),t.jsxs("div",{className:"flex flex-wrap gap-1",children:[t.jsx(S,{variant:"outline",size:"sm",disabled:r!==null||!a||!e.active||!y&&!n,onClick:()=>void v("membership",async()=>{y?w(await c.leaveRemoteCommunityAgentRoom(e.community,s,e.localAgentId)):await c.joinRemoteCommunityAgentRoom(e.community,s,e.localAgentId)}),children:y?"Leave channel":"Join channel"}),t.jsx(S,{variant:"ghost",size:"sm",disabled:r!==null||!a,onClick:()=>void v("stop",()=>c.haltRemoteCommunityAgent(e.community,s,e.localAgentId)),children:"Stop agent"}),t.jsxs(rt,{children:[t.jsx(Yt,{asChild:!0,children:t.jsx(S,{variant:"ghost",size:"sm",disabled:r!==null||!a,children:"Remove from space"})}),t.jsxs(it,{children:[t.jsxs(ot,{children:[t.jsxs(lt,{children:["Remove ",e.displayName,"?"]}),t.jsx(ct,{children:"It leaves every channel in this space. You can re-add it."})]}),t.jsxs(dt,{children:[t.jsx(ut,{children:"Cancel"}),t.jsx(Ht,{onClick:()=>void v("remove",async()=>w(await c.ejectRemoteCommunityAgent(e.community,e.localAgentId))),children:"Remove agent"})]})]})]})]}),i&&e.active&&t.jsxs("div",{className:"flex items-center gap-2",children:[t.jsx(Qt,{id:N,checked:e.acceptsDms===!0,disabled:r!==null||!a||!n,onCheckedChange:g=>void v("dms",()=>c.setRemoteCommunityAgentDms(e.community,e.localAgentId,g))}),t.jsx(ae,{htmlFor:N,className:"text-xs font-normal",children:"Takes direct messages"})]}),h&&t.jsx("p",{role:"status",className:"text-muted-foreground text-xs",children:h})]})}function Qs({community:e,agent:s,disabled:n,accessFingerprint:a}){const i=V(),l=Re(),d=le(),c=ue(!0,a,e),[r,o]=f.useState(!1),[h,u]=f.useState(null);async function y(){if(!r){o(!0),u(null);try{const N=await i.startRemoteCommunityDm(e,s.memberId);c&&await d.invalidateQueries({queryKey:z.dms(c,e)}),l({...xe.channels(),search:{community:e,id:N.roomId}})}catch(N){u(N.code===Bt?`${s.displayName} isn’t taking direct messages.`:"Couldn’t open the direct message. Try again.")}finally{o(!1)}}}return t.jsxs("span",{className:"flex flex-wrap items-center justify-end gap-x-2",children:[h&&t.jsx("span",{role:"status",className:"text-muted-foreground order-last w-full text-right text-xs sm:order-none sm:w-auto",children:h}),t.jsx(S,{variant:"ghost",size:"sm",disabled:n||r,onClick:()=>void y(),"aria-label":`Message ${s.displayName}`,children:"Message"})]})}function We(e){return`$${e.toFixed(2)}`}function Bs({community:e,online:s,canEnroll:n}){var w;const a=f.useId(),i=Ss(e),l=ks(e),d=(w=i.data)==null?void 0:w.spend,[c,r]=f.useState(null),o=(d==null?void 0:d.monthlyLimitUsd)!=null?String(d.monthlyLimitUsd):"",h=c??o,u=h.trim()===""?null:Jt(Number(h)),y=u===null||Number.isFinite(u)&&u>=Wt,N=u!==((d==null?void 0:d.monthlyLimitUsd)??null);function v(g){g.preventDefault(),!(!y||!N||l.isPending)&&l.mutate({monthlyLimitUsd:u},{onSuccess:()=>r(null)})}return!n&&!(d!=null&&d.hasAgentsHere)?null:t.jsxs("section",{className:"mt-3 space-y-2 border-t pt-3","aria-labelledby":`${a}-heading`,children:[t.jsx("h3",{id:`${a}-heading`,className:"text-sm font-medium",children:"Teammates"}),i.isError&&t.jsxs("p",{role:"alert",className:"text-sm",children:["Couldn’t load teammate settings."," ",t.jsx(S,{variant:"ghost",size:"sm",onClick:()=>void i.refetch(),children:"Retry"})]}),i.data&&d&&t.jsxs(t.Fragment,{children:[t.jsxs("div",{className:"space-y-1",children:[t.jsx(ae,{htmlFor:`${a}-wake`,children:"Who can wake your agents"}),t.jsxs(tt,{value:i.data.wakeAgentsFrom,onValueChange:g=>l.mutate({wakeAgentsFrom:g==="me"?"me":"members"}),disabled:!s||l.isPending,children:[t.jsx(st,{id:`${a}-wake`,className:"max-w-64",children:t.jsx(nt,{})}),t.jsxs(at,{children:[t.jsx(Te,{value:"members",children:"Anyone in this space"}),t.jsx(Te,{value:"me",children:"Only me"})]})]})]}),t.jsxs("form",{onSubmit:v,className:"space-y-1",children:[t.jsx(ae,{htmlFor:`${a}-limit`,children:"Monthly limit for teammates"}),t.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[t.jsx("span",{className:"text-muted-foreground text-sm","aria-hidden":!0,children:"$"}),t.jsx(Me,{id:`${a}-limit`,inputMode:"decimal",value:h,onChange:g=>r(g.target.value),placeholder:"No limit","aria-invalid":!y,disabled:!s||l.isPending,className:"w-32"}),t.jsx(S,{type:"submit",size:"sm",disabled:!s||!y||!N||l.isPending,children:"Save"})]}),t.jsxs("p",{className:"text-muted-foreground text-xs",children:[d.monthlyLimitUsd===null?"No limit":`Limit ${We(d.monthlyLimitUsd)} a month`,` · ${We(d.spentUsd)} spent this month${d.approximate?", approximate":""}`]}),t.jsx("p",{className:"text-muted-foreground text-xs",children:"Past the limit, teammates’ messages wake nobody. A running turn may go slightly over."}),!y&&t.jsx("p",{role:"alert",className:"text-destructive text-xs",children:"Enter at least $0.01, or leave it empty."})]}),l.isError&&t.jsx("p",{role:"alert",className:"text-destructive text-sm",children:"Couldn’t save. Try again."})]})]})}function Js(e,s){const n=new Date(e),a=n.toLocaleTimeString([],{hour:"numeric",minute:"2-digit"});return n.toDateString()===s.toDateString()?a:`${n.toLocaleDateString([],{month:"short",day:"numeric",...n.getFullYear()===s.getFullYear()?{}:{year:"numeric"}})}, ${a}`}function Ws(e,s=new Date){return e.kind!=="agent"?null:e.availability==="available"?{text:"Available"}:e.availability==="offline"&&e.lastSeenAt?{text:"Offline since",since:{dateTime:new Date(e.lastSeenAt).toISOString(),label:Js(e.lastSeenAt,s)}}:null}function Gs({roster:e,failed:s,canMention:n,onMention:a,community:i,roomId:l,online:d,canEnroll:c,agentsKey:r,accessFingerprint:o}){var N,v,w;const u=((N=et(i,!0,o).data)==null?void 0:N.available)===!0,y=(w=(v=ge().data)==null?void 0:v.find(g=>g.ref===i))==null?void 0:w.connectedHumanMemberId;return t.jsxs("div",{className:"max-h-48 overflow-auto border-b p-3","aria-label":"Channel members",children:[s&&t.jsx("p",{role:"alert",children:"Couldn’t load members."}),(e==null?void 0:e.stale)&&t.jsx("p",{className:"text-muted-foreground text-sm",children:"Saved member list"}),e==null?void 0:e.members.map(g=>{var A;const O=Ws(g);return t.jsxs("div",{className:"flex flex-wrap items-center justify-between gap-x-2 text-sm",children:[t.jsxs("span",{children:[g.displayName,g.kind==="agent"?" · Agent":"",g.ownerMemberId&&` · owned by ${((A=e.members.find(_=>_.memberId===g.ownerMemberId))==null?void 0:A.displayName)??"a space member"}`,O&&t.jsxs("span",{className:"text-muted-foreground",children:[` · ${O.text}`,O.since&&t.jsxs(t.Fragment,{children:[" ",t.jsx("time",{dateTime:O.since.dateTime,children:O.since.label})]})]})]}),t.jsxs("span",{className:"flex flex-wrap items-center justify-end",children:[u&&g.kind==="agent"&&g.ownerMemberId!==y&&t.jsx(Qs,{community:i,agent:g,disabled:!d,accessFingerprint:o}),g.handle&&t.jsxs(S,{variant:"ghost",size:"sm",disabled:!n,onClick:()=>a(g.handle),children:["Mention @",g.handle]})]})]},g.memberId)}),c&&t.jsx(Ys,{community:i,roomId:l,online:d,canEnroll:!0,accessFingerprint:o},r),t.jsx(Bs,{community:i,online:d,canEnroll:c})]})}function Rt(e,s){return e instanceof Error&&e.message?e.message:s}function Vs({conduct:e,staff:s,onReadRules:n}){const{hold:a,standing:i}=e;return(a==null?void 0:a.kind)==="rules"?t.jsx("div",{className:"px-1 pb-1",children:t.jsx(S,{size:"sm",variant:"outline",onClick:n,children:"Read the rules"})}):a||s||!(i!=null&&i.slowModeSeconds)?null:t.jsxs("p",{className:"text-muted-foreground px-1 pb-1 text-xs",children:["Slow mode: one message every ",i.slowModeSeconds,"s."]})}function Xs({conduct:e,open:s,onOpenChange:n}){var l;const a=(l=e.standing)==null?void 0:l.rules,i=a?a.acceptedVersion>=a.version:!1;return t.jsx(Oe,{open:s,onOpenChange:n,children:t.jsxs($e,{className:"sm:max-w-lg",children:[t.jsxs(Ue,{children:[t.jsx(Ie,{children:"Space rules"}),t.jsx(Le,{children:i?"You accepted these rules.":"Accept these rules to post here."})]}),t.jsxs(Fe,{children:[t.jsx("div",{className:"max-h-[50vh] overflow-y-auto rounded-md border p-3 text-sm leading-relaxed whitespace-pre-wrap",children:(a==null?void 0:a.text)??"This space has no rules."}),e.accept.error&&t.jsx("p",{role:"alert",className:"text-destructive mt-2 text-sm",children:Rt(e.accept.error,"Couldn’t accept the rules. Try again.")})]}),t.jsxs(Ke,{children:[t.jsx(S,{variant:"outline",onClick:()=>n(!1),children:"Close"}),(a==null?void 0:a.text)&&!i&&t.jsx(S,{disabled:e.accept.isPending,onClick:()=>e.accept.mutate(a.version,{onSuccess:()=>n(!1)}),children:e.accept.isPending?"Accepting…":"Accept rules"})]})]})})}function Zs({community:e,accessFingerprint:s,currentName:n,open:a,onOpenChange:i}){return t.jsx(Oe,{open:a,onOpenChange:i,children:t.jsx($e,{className:"sm:max-w-md",children:a&&t.jsx(en,{community:e,accessFingerprint:s,currentName:n,onDone:()=>i(!1)})})})}function en({community:e,accessFingerprint:s,currentName:n,onDone:a}){const i=V(),l=le(),d=ue(!0,s,e),[c,r]=f.useState(n),o=we({meta:{suppressErrorToast:!0},mutationFn:u=>i.setRemoteCommunityDisplayName(e,u),onSuccess:async()=>{d&&await l.invalidateQueries({queryKey:z.content(d,e)}),a()}}),h=c.trim();return t.jsxs("form",{onSubmit:u=>{u.preventDefault(),h&&h!==n&&o.mutate(h)},children:[t.jsxs(Ue,{children:[t.jsx(Ie,{children:"Your name in this space"}),t.jsx(Le,{children:"Other spaces keep the name they show."})]}),t.jsxs(Fe,{className:"space-y-2",children:[t.jsx(ae,{htmlFor:"remote-community-display-name",children:"Name"}),t.jsx(Me,{id:"remote-community-display-name",value:c,maxLength:128,autoComplete:"nickname",onChange:u=>r(u.target.value)}),o.error&&t.jsx("p",{role:"alert",className:"text-destructive text-sm",children:Rt(o.error,"Couldn’t change your name. Try again.")})]}),t.jsxs(Ke,{children:[t.jsx(S,{type:"button",variant:"outline",onClick:a,children:"Cancel"}),t.jsx(S,{type:"submit",disabled:!h||h===n||o.isPending,children:o.isPending?"Saving…":"Save name"})]})]})}const tn=[{value:"spam",label:"Spam"},{value:"harassment",label:"Harassment"},{value:"off_topic",label:"Off topic"},{value:"illegal",label:"Against the law"},{value:"other",label:"Something else"}];function sn({entry:e,onClose:s}){return t.jsx(Oe,{open:e!==null,onOpenChange:n=>!n&&s(),children:t.jsx($e,{className:"sm:max-w-md",children:e&&t.jsx(nn,{entry:e,onClose:s},e.id)})})}function nn({entry:e,onClose:s}){const n=V(),a=f.useId(),[i,l]=f.useState(null),[d,c]=f.useState(""),r=we({meta:{suppressErrorToast:!0},mutationFn:o=>n.reportRemoteCommunityEntry(e.community,e.roomId,e.id,o),onSuccess:()=>{mt("Message reported"),s()}});return t.jsxs("form",{onSubmit:o=>{o.preventDefault(),i&&r.mutate({reason:i,...d.trim()?{note:d.trim()}:{}})},children:[t.jsxs(Ue,{children:[t.jsx(Ie,{children:"Report message"}),t.jsx(Le,{children:"This space’s owners and admins review reports."})]}),t.jsxs(Fe,{className:"space-y-4",children:[t.jsxs("p",{className:"text-muted-foreground line-clamp-3 text-sm",children:[e.authorDisplayName,": ",e.text]}),t.jsx(Gt,{"aria-label":"Reason",value:i??"",onValueChange:o=>l(o),children:tn.map(o=>t.jsxs("div",{className:"flex items-center gap-2",children:[t.jsx(Vt,{value:o.value,id:`${a}-${o.value}`}),t.jsx(ae,{htmlFor:`${a}-${o.value}`,children:o.label})]},o.value))}),t.jsxs("div",{className:"space-y-1.5",children:[t.jsx(ae,{htmlFor:`${a}-note`,children:"Note (optional)"}),t.jsx(Xt,{id:`${a}-note`,value:d,maxLength:Zt,onChange:o=>c(o.target.value),rows:3}),t.jsx("p",{className:"text-muted-foreground text-xs",children:"Only owners and admins see this."})]}),r.error&&t.jsx("p",{role:"alert",className:"text-destructive text-sm",children:r.error instanceof Error&&r.error.message?r.error.message:"Couldn’t send the report. Try again."})]}),t.jsxs(Ke,{children:[t.jsx(S,{type:"button",variant:"outline",onClick:s,children:"Cancel"}),t.jsx(S,{type:"submit",disabled:!i||r.isPending,children:r.isPending?"Sending…":"Send report"})]})]})}function an({agentDeliveries:e,drafts:s,entries:n,threadId:a,canSend:i,action:l,onRetryAgent:d,onRetryDraft:c}){return t.jsxs(t.Fragment,{children:[e.filter(r=>r.parentEntryId===(a??null)&&!n.some(o=>o.originIdempotencyKey===r.idempotencyKey)).map(r=>t.jsxs("div",{className:"border-t px-4 py-2 text-sm",role:"status",children:[t.jsxs("p",{className:"font-medium",children:[r.author.displayName," · Agent"]}),t.jsx("p",{className:"whitespace-pre-wrap",children:r.text}),r.attachments.map((o,h)=>t.jsx("span",{className:"mr-2",children:o.name},h)),t.jsx("p",{className:"text-muted-foreground",children:r.state==="pending"?"Waiting for the space to confirm…":r.failure==="expired"?"Not confirmed. Too late to try again.":"Not confirmed. Check the space and the agent’s channel access."}),r.state==="pending"&&r.retryable&&t.jsx(S,{variant:"outline",size:"sm",disabled:!i||l!==null,onClick:()=>d(r.idempotencyKey),children:l===`retry:${r.idempotencyKey}`?"Retrying…":"Retry now"})]},r.idempotencyKey)),s.filter(r=>r.parentEntryId===a&&!n.some(o=>o.originIdempotencyKey===r.key)).map(r=>t.jsxs("div",{className:"border-t px-4 py-2 text-sm",role:"status",children:[t.jsx("p",{className:"whitespace-pre-wrap",children:r.text}),r.files.map(o=>t.jsx("span",{className:"mr-2",children:o.file.name},o.id)),t.jsx("p",{className:"text-muted-foreground",children:r.status==="sending"?"Sending…":"Delivery not confirmed."}),r.error&&t.jsx("p",{children:r.error}),r.status==="failed"&&t.jsx(S,{variant:"outline",size:"sm",disabled:!i,onClick:()=>c(r.key),children:"Retry message"})]},r.key))]})}function rn(e,s){var l;const n=new Map;for(const d of e)d.thread&&n.set(d.id,{count:d.thread.replyCount,lastAt:d.thread.lastReplyAt,through:d.threadLastReplySeq});const a=new Map;for(const d of s){const c=d.threadRootEntryId;if(d.depth===0||c===null)continue;const r=(l=n.get(c))==null?void 0:l.through;if(r!==void 0&&d.remoteSeq<=r)continue;const o=a.get(c);a.set(c,{count:((o==null?void 0:o.count)??0)+1,newest:o&&o.newest.remoteSeq>d.remoteSeq?o.newest:d})}const i=new Map;for(const d of new Set([...n.keys(),...a.keys()])){const c=n.get(d),r=a.get(d),o=c===void 0?r.count:c.through===void 0?Math.max(c.count,(r==null?void 0:r.count)??0):c.count+((r==null?void 0:r.count)??0);i.set(d,{count:o,lastAt:(r==null?void 0:r.newest.createdAt)??c.lastAt,unread:0})}return i}const on={reactions:!1,threads:!0,runWith:!1,attachments:!0,mentions:!0,streamHealth:!0,presence:!1,turnStatus:!1,asks:!1};function ln({community:e,roomId:s,threadId:n,onThread:a,dmAgentName:i}){var qe,ze,Ye,He;const l=V(),c=(qe=ge().data)==null?void 0:qe.find(p=>p.ref===e),r=_e(c==null?void 0:c.access),o=ue(!0,r.fingerprint,e),{ownerAddress:h,contextAddress:u}=Es(o),y=le(),N=es(),v=ts(),w=(ze=N.data)==null?void 0:ze.destinations.find(p=>p.ref===e&&p.roomId===s),g=f.useRef(null),O=f.useRef(void 0),A=(w==null?void 0:w.scrollAnchorEntryId)??null,_=f.useCallback(p=>{if(!o||n)return;g.current&&clearTimeout(g.current),g.current=null;const D=p??null,K=O.current===void 0?A:O.current;D===null&&K===null||(g.current=setTimeout(()=>{g.current=null,O.current=D,v.mutate({ref:e,roomId:s,threadId:n??null,scrollAnchorEntryId:D})},400))},[o,e,v,A,s,n]);f.useEffect(()=>()=>{g.current&&clearTimeout(g.current)},[]),f.useEffect(()=>{(c==null?void 0:c.status)==="reconnect-required"&&o&&y.removeQueries({queryKey:z.remote(o,e)})},[o,e,c==null?void 0:c.status,y]);const Y=ft(e,s,r.capabilities.read,r.fingerprint),[M,q]=f.useState(0),L=f.useRef([]),C=f.useCallback(p=>L.current.some(D=>D.id===p),[]),U=As(e,s,r.capabilities.stream,M,r.fingerprint,r.cacheReadable,C),j=U.status==="removed",x=j?null:U.room??Y.data,I=ss(e,s,n,!j&&r.capabilities.read&&(x==null?void 0:x.readable)===!0,r.fingerprint),b=pt(e,s,!j&&r.capabilities.read&&(x==null?void 0:x.readable)===!0,r.fingerprint),[k,F]=f.useState(()=>({address:u,entries:[]})),H=f.useMemo(()=>k.address===u?k.entries:[],[u,k]);f.useEffect(()=>{L.current=H},[H]);const[Z,re]=f.useState(0),[ee,me]=f.useState(!1),[Se,m]=f.useState(null),[R,$]=f.useState(null),T=Is({community:e,roomId:s,enabled:!j&&r.capabilities.read&&(x==null?void 0:x.readable)===!0,accessFingerprint:r.fingerprint}),E=(c==null?void 0:c.connectedHumanMemberId)??null,P=(Ye=b.data)==null?void 0:Ye.members.find(p=>p.memberId===E),B=p=>{var D;return p===E||((D=b.data)==null?void 0:D.members.some(K=>K.memberId===p&&K.ownerMemberId===E))===!0},[J,te]=f.useState({address:"",name:null,error:null}),W=J.address===u?J.name:null,ye=J.address===u?J.error:null,ie=f.useRef(null),G=f.useRef(null),se=f.useRef(null),fe=!j&&r.capabilities.post&&U.status==="live"&&(x==null?void 0:x.writable)===!0,ke=fe&&T.hold===null,ce=f.useMemo(()=>{var p;return j?[]:Ee(Ce(e,s,...((p=I.data)==null?void 0:p.pages.map(D=>D.entries))??[],U.entries,H),U.revisions)},[e,s,I.data,U.entries,U.revisions,H,j]),kt=f.useCallback(p=>{F(D=>({address:u,entries:Ce(e,s,D.address===u?D.entries:[],[p]).slice(-500)})),re(D=>D+1)},[u,e,s]);f.useLayoutEffect(()=>{var p;Z>0&&((p=se.current)==null||p.scrollToBottom())},[Z]);const bt=f.useMemo(()=>{var p;return o?{ownerKey:o.ownerKey,epoch:o.epoch,ref:e,generation:((p=o.connection)==null?void 0:p.generation)??0,roomId:s,threadId:n}:null},[o,e,s,n]),Q=zs({ref:e,roomId:s,canSend:ke,entries:ce,onReceipt:kt,draft:bt,ownerKey:h||"unresolved",contextKey:u||"unresolved",onHold:T.noteHold}),At=ce.filter(p=>n?p.id===n||p.threadRootEntryId===n:p.depth===0),Dt=f.useMemo(()=>{var p;return n?new Map:rn(((p=I.data)==null?void 0:p.pages.flatMap(D=>D.entries))??[],ce)},[n,I.data,ce]),Pe=At.flatMap(p=>{const D=Dt.get(p.id);return D?[{kind:"message",entry:p},{kind:"replies",rootId:p.id,summary:D}]:[{kind:"message",entry:p}]}),Tt=Pe.map(p=>p.kind==="replies"?{kind:"thread-reply",id:`${p.rootId}:replies`,rootId:p.rootId,replyCount:p.summary.count,lastAt:p.summary.lastAt}:{kind:"message",id:p.entry.id,payload:p.entry,grouping:{position:"only"},author:{id:JSON.stringify([e,p.entry.authorId]),kind:p.entry.authorKind,displayName:p.entry.authorDisplayName},at:p.entry.createdAt}),be={kind:"room",id:JSON.stringify([e,s,n]),placeholder:n?"Reply in thread…":`Message ${i??(x==null?void 0:x.title)??"this channel"}…`,canSend:ke,canSendReason:j?"You no longer have access to this channel.":T.hold?$s(T.hold):!r.capabilities.post&&r.cacheReadable?"This space is read-only.":x!=null&&x.archived?"This channel is archived.":x!=null&&x.joined?"Reconnecting. You can send once the space is back.":"Join this channel to send messages.",attachments:Q.attachments,async send(){Q.send(n)}};async function ve(p,D){if(W||!o)return;const K=o,de=u;te({address:de,name:p,error:null});try{if(await D(),!X(K))return;(p==="join"||p==="leave"||p.startsWith("retry:"))&&q(ne=>ne+1),await y.invalidateQueries({queryKey:z.remote(K,e)})}catch(ne){X(K)&&te({address:de,name:p,error:ne instanceof Error?ne.message:"Couldn’t finish that. Try again."})}finally{X(K)&&te(ne=>ne.address===de?{...ne,name:null}:ne)}}function Et(){var K;const p=ce.at(-1);if(n||I.hasNextPage||!p||U.status!=="live"||((K=ie.current)==null?void 0:K.address)===u&&ie.current.cursor===p.cursor||!o)return;const D=o;ie.current={address:u,cursor:p.cursor},l.setRemoteCommunityReadCursor(e,s,p.cursor).then(()=>{X(D)&&y.invalidateQueries({queryKey:z.rooms(D,e)})}).catch(()=>{var de;((de=ie.current)==null?void 0:de.address)===u&&(ie.current=null)})}return t.jsxs(Ne.Root,{surface:"room",capabilities:on,target:be,children:[t.jsxs("section",{className:"flex h-full min-h-0 flex-col","aria-label":(x==null?void 0:x.title)??"Space channel",children:[t.jsxs("div",{className:"flex flex-wrap items-center gap-2 border-b px-3 py-2",children:[n&&t.jsx(S,{variant:"ghost",size:"sm",onClick:()=>a(),children:"Back to channel"}),!j&&r.capabilities.post&&x&&!x.joined&&!x.stale&&t.jsx(S,{size:"sm",disabled:W!==null,onClick:()=>void ve("join",()=>l.joinRemoteCommunityRoom(e,s)),children:"Join channel"}),r.cacheReadable&&t.jsx(S,{variant:"ghost",size:"sm",disabled:j,onClick:()=>me(!ee),children:ee?"Hide members":"Members"}),((He=T.standing)==null?void 0:He.rules.text)&&t.jsx(S,{variant:"ghost",size:"sm",onClick:()=>m("rules"),children:"Rules"}),r.capabilities.post&&t.jsx(S,{variant:"ghost",size:"sm",onClick:()=>m("name"),children:"Your name"}),r.capabilities.enrollAgent&&t.jsx(S,{variant:"outline",size:"sm",disabled:W!==null,onClick:()=>void ve("stop",()=>l.haltRemoteCommunityRoom(e,s)),children:W==="stop"?"Stopping…":"Stop my agents"}),r.capabilities.post&&(x==null?void 0:x.joined)&&!i&&t.jsx(S,{variant:"ghost",size:"sm",disabled:W!==null||!fe,onClick:()=>void ve("leave",async()=>{await l.leaveRemoteCommunityRoom(e,s),o&&y.removeQueries({queryKey:z.room(o,e,s)})}),children:"Leave channel"})]}),ye&&t.jsx("p",{role:"alert",className:"text-destructive px-4 py-2 text-sm",children:ye}),j?t.jsx("p",{role:"status",className:"p-6 text-sm",children:"You no longer have access to this channel."}):t.jsxs(t.Fragment,{children:[U.status!=="live"&&t.jsx("p",{role:"status",className:"text-muted-foreground px-4 py-2 text-sm",children:U.status==="connecting"?"Connecting to the space…":"Space unavailable. Showing saved messages."}),Y.isError&&t.jsx("p",{role:"alert",className:"px-4 py-2 text-sm",children:"Couldn’t load this channel."}),ee&&t.jsx(Gs,{roster:b.data,failed:b.isError,canMention:fe,onMention:p=>{var D;Q.setText(`${Q.text}${Q.text&&!Q.text.endsWith(" ")?" ":""}@${p} `),(D=G.current)==null||D.focus()},community:e,roomId:s,online:U.status==="live",canEnroll:r.capabilities.enrollAgent,agentsKey:u,accessFingerprint:r.fingerprint}),I.isError&&t.jsxs("p",{role:"alert",className:"p-3 text-sm",children:["Some messages could not be loaded."," ",t.jsx(S,{variant:"ghost",size:"sm",onClick:()=>void I.refetch(),children:"Retry"})]}),I.hasNextPage&&t.jsx(S,{variant:"ghost",size:"sm",disabled:I.isFetchingNextPage,onClick:()=>void I.fetchNextPage(),children:"Load the next page of history"}),t.jsx(Ne.Timeline,{ref:se,conversationId:be.id,rows:Tt,label:n?"Space thread":"Space messages",busy:I.isFetching,resumeRow:()=>n?void 0:A??void 0,onTopRow:_,onReachedBottom:Et,onOpenThread:a,empty:t.jsx("p",{className:"text-muted-foreground p-6 text-sm",children:I.isPending?"Loading messages…":"No messages here yet."}),renderRow:(p,D)=>{const K=Pe[D.index];return K.kind==="message"?t.jsx(wt,{entry:K.entry,onThread:a,onReport:r.capabilities.post&&b.data&&!B(K.entry.authorId)?()=>$(K.entry):void 0}):t.jsx(hs,{summary:K.summary,open:!1,onOpen:()=>a(K.rootId)})}}),t.jsx(an,{agentDeliveries:U.deliveries,drafts:Q.deliveries,entries:ce,threadId:n,canSend:ke,action:W,onRetryAgent:p=>void ve(`retry:${p}`,()=>l.retryRemoteCommunityDelivery(e,s,p)),onRetryDraft:Q.retry}),Q.error&&t.jsx("p",{role:"alert",className:"text-destructive px-4 py-2 text-sm",children:Q.error}),t.jsx(Ne.Composer,{inputRef:G,aboveInput:t.jsx(Vs,{conduct:T,staff:["owner","admin"].includes((P==null?void 0:P.role)??""),onReadRules:()=>m("rules")}),className:"m-3",value:Q.text,onChange:Q.setText,onSubmit:()=>Q.send(n),input:{isStreaming:!1,contextKey:be.id,canSubmit:Q.text.trim().length>0||Q.attachments.staged.length>0}})]})]}),t.jsx(Xs,{conduct:T,open:Se==="rules",onOpenChange:p=>m(p?"rules":null)}),t.jsx(Zs,{community:e,accessFingerprint:r.fingerprint,currentName:(P==null?void 0:P.displayName)??"",open:Se==="name",onOpenChange:p=>m(p?"name":null)}),t.jsx(sn,{entry:R,onClose:()=>$(null)})]})}function cn({community:e,roomId:s}){var h,u;const n=ge(),a=(h=n.data)==null?void 0:h.find(y=>y.ref===e),i=_e(a==null?void 0:a.access),l=ft(e,s??"",!!s&&i.capabilities.read,i.fingerprint),{dm:d}=ht(e,s??"",!!s&&i.capabilities.read,i.fingerprint),c=(a==null?void 0:a.label)??"Space",r=s?d?ns(d):(u=l.data)==null?void 0:u.title:void 0,o=a===void 0&&n.fetchStatus==="fetching"||s!==void 0&&r===void 0&&l.fetchStatus==="fetching";return t.jsx(xt,{pending:o,children:r?`${c} · ${r}`:c})}function St(e){var s,n,a,i;return!e||e.status==="reconnect-required"?null:((n=(s=e.access)==null?void 0:s.lastKnown)==null?void 0:n.lifecycle)==="deleted"?"deleted":((i=(a=e.access)==null?void 0:a.lastKnown)==null?void 0:i.lifecycle)==="taken_down"?"taken-down":e.seemsGoneSince?"seems-gone":null}function Ge(e,s,n){return`${e} ${e===1?s:n}`}function dn(e,s){const n=[e>0?Ge(e,"message from your agents","messages from your agents"):null,s>0?Ge(s,"draft of yours","drafts of yours"):null].filter(i=>i!==null);if(n.length===0)return null;const a=n.length===1&&(e===1||s===1);return`${n.join(" and ")} ${a?"wasn’t":"weren’t"} sent.`}function un({connection:e,onRemoved:s}){const n=St(e),a=as(),[i,l]=f.useState(!1),{ownerKey:d}=rs(),c=is(d,e.ref),{copied:r,failed:o,copy:h}=os(),u=e.label,y=e.seemsGoneSince?new Date(e.seemsGoneSince).toLocaleDateString(void 0,{year:"numeric",month:"long",day:"numeric"}):null;function N(){a.mutate(e,{onSuccess:()=>{l(!1),mt.success(`${u} is removed from DorkOS.`),s()}})}const v=n==="deleted"||n==="taken-down",w=n==="taken-down"?"This space was taken down":n==="deleted"?"This space was deleted":"This space seems to be gone",g=n==="taken-down"?`DorkOS removed its copy here. If ${u} returns, you can connect again.`:n==="deleted"?"DorkOS removed its copy from this computer.":`Since ${y}, ${u} says it doesn’t exist. Its channels, messages and files are still here.`,O=dn(v?e.undeliveredAgentMessages??0:0,c.length),A=c.length===0?null:c.length===1?"Your unsent draft is cleared too.":`Your ${c.length} unsent drafts are cleared too.`;return t.jsxs("div",{className:"flex h-full flex-col items-center justify-center gap-3 p-10 text-center text-sm","data-testid":"community-gone",children:[t.jsx(Cs,{className:"text-muted-foreground/50 size-10","aria-hidden":!0}),t.jsx("p",{className:"text-foreground font-medium",children:w}),t.jsx("p",{className:"text-muted-foreground max-w-sm",children:g}),O&&t.jsx("p",{role:"status",className:"text-foreground max-w-sm","data-testid":"community-gone-unsent",children:O}),t.jsx("span",{className:"sr-only","aria-live":"polite","data-testid":"community-gone-copy-status",children:r?"Copied.":o?"Couldn’t copy to the clipboard.":""}),t.jsxs("div",{className:"flex flex-wrap items-center justify-center gap-2",children:[c.length>0&&t.jsx(S,{variant:"outline",onClick:()=>void h(c.join(`
9
-
10
- `)),children:r?"Copied":o?"Couldn’t copy":c.length===1?"Copy your draft":"Copy your drafts"}),t.jsx(S,{variant:v?"outline":"destructive",onClick:()=>l(!0),children:v?"Remove from DorkOS":"Remove local copy"})]}),t.jsx(rt,{open:i,onOpenChange:_=>{_||a.reset(),l(_)},children:t.jsxs(it,{children:[t.jsxs(ot,{children:[t.jsx(lt,{children:v?`Remove ${u} from DorkOS?`:`Remove your copy of ${u}?`}),t.jsx(ct,{asChild:!0,children:t.jsxs("div",{className:"space-y-2",children:[t.jsx("p",{children:v?`${u} leaves this app. Nothing else is stored here.`:"This deletes its channels, messages and files from this computer."}),!v&&t.jsx("p",{children:"Your agents stop answering there. If it’s still around, you can connect again."}),A&&t.jsx("p",{children:A})]})})]}),a.isError&&t.jsx("p",{role:"alert",className:"text-destructive text-sm",children:"Couldn’t remove it. Check that DorkOS is running, then try again."}),t.jsxs(dt,{children:[t.jsx(ut,{disabled:a.isPending,children:"Cancel"}),t.jsx(S,{variant:"destructive",disabled:a.isPending,onClick:N,children:a.isPending?"Removing…":v?"Remove from DorkOS":"Remove local copy"})]})]})})]})}function mn({connection:e,dateFormat:s}){var l,d;const n=vs(e);if(!n)return null;const[a,...i]=js(n,(d=(l=e.access)==null?void 0:l.lastKnown)==null?void 0:d.lifecycle,s);return t.jsxs("section",{"aria-label":"Request to take over this space",className:"border-status-warning-border bg-status-warning-bg text-status-warning-fg flex flex-wrap items-start gap-x-3 gap-y-2 border-b px-4 py-3 text-sm",children:[t.jsx(ls,{className:"mt-0.5 size-4 shrink-0","aria-hidden":!0}),t.jsxs("div",{className:"min-w-0 flex-1 basis-60 space-y-1",children:[t.jsx("p",{className:"text-foreground font-medium",children:a}),i.map(c=>t.jsx("p",{children:c},c))]}),t.jsxs(S,{variant:"outline",size:"sm",className:"shrink-0",onClick:()=>ds(Ns(e)),children:["Open space",t.jsx(cs,{className:"size-3.5","aria-hidden":!0})]})]})}const fn={reactions:!1,threads:!1,runWith:!1,attachments:!1,mentions:!1,streamHealth:!1,presence:!1,turnStatus:!1,asks:!1};function pn({dm:e,localAgentId:s,access:n}){var r,o,h,u;const a=us(e.community,e.roomId,s,n),i=f.useRef(null),l=f.useRef(!0),d=(o=(r=a.data)==null?void 0:r.entries.at(-1))==null?void 0:o.id;f.useLayoutEffect(()=>{const y=i.current;y&&l.current&&(y.scrollTop=y.scrollHeight)},[d]);const c={kind:"room",id:JSON.stringify([e.community,e.roomId,"read-only"]),placeholder:"",canSend:!1,canSendReason:"This direct message is read-only.",attachments:null,send:()=>Promise.reject(new Error("This direct message is read-only."))};return t.jsx(Ne.Root,{surface:"room",capabilities:fn,target:c,children:t.jsxs("div",{className:"flex h-full min-h-0 flex-col",children:[t.jsxs("section",{className:"border-b px-4 py-2 text-sm","aria-label":"About this direct message",children:[t.jsxs("p",{children:[t.jsx("span",{className:"font-medium",children:`${e.member.displayName} with ${e.agent.displayName}`}),t.jsx("span",{className:"text-muted-foreground",children:" · Read-only"})]}),t.jsx("p",{className:"text-muted-foreground text-xs",children:`Only ${e.member.displayName} and ${e.agent.displayName} can post here.`})]}),t.jsxs("section",{ref:i,onScroll:y=>{const N=y.currentTarget;l.current=N.scrollHeight-N.scrollTop-N.clientHeight<40},className:"min-h-0 flex-1 overflow-auto py-2","aria-label":"Messages",children:[a.isError&&t.jsxs("p",{role:"alert",className:"px-4 text-sm",children:["Couldn’t load this direct message."," ",t.jsx(S,{variant:"ghost",size:"sm",onClick:()=>void a.refetch(),children:"Retry"})]}),((h=a.data)==null?void 0:h.entries.length)===0&&t.jsx("p",{className:"text-muted-foreground px-4 text-sm",children:"No messages yet."}),(u=a.data)==null?void 0:u.entries.map(y=>t.jsx(wt,{entry:y},y.id))]})]})})}function hn({community:e,roomId:s,children:n}){var d;const a=(d=ge().data)==null?void 0:d.find(c=>c.ref===e),i=_e(a==null?void 0:a.access),{dm:l}=ht(e,s,i.verified&&i.capabilities.read,i.fingerprint);return l?l.readOnly&&l.localAgentId?t.jsx(pn,{dm:l,localAgentId:l.localAgentId,access:i.fingerprint}):t.jsxs("div",{className:"flex h-full min-h-0 flex-col",children:[t.jsx(xn,{dm:l,accessFingerprint:i.fingerprint}),t.jsx("div",{className:"min-h-0 flex-1",children:n(l.agent.displayName)})]}):n()}function xn({dm:e,accessFingerprint:s}){var l;const a=(l=pt(e.community,e.roomId,!0,s).data)==null?void 0:l.members.find(d=>d.memberId===e.agent.memberId),i=e.agent.ownerDisplayName;return t.jsxs("section",{className:"border-b px-4 py-2 text-sm","aria-label":"About this direct message",children:[t.jsxs("p",{children:[t.jsx("span",{className:"font-medium",children:e.agent.displayName}),t.jsx("span",{className:"text-muted-foreground",children:` · ${i}’s agent · ${i} can read this`})]}),(a==null?void 0:a.availability)==="offline"&&t.jsx("p",{role:"status",className:"text-muted-foreground text-xs",children:`Offline. ${e.agent.displayName} won’t answer until its computer is back on.`})]})}function gn(){const{id:e,community:s}=gt({from:"/_shell/channels"}),n=ms(s);return s&&!n.visible?n.isLoading?null:t.jsx(fs,{...xe.channels(),search:{},replace:!0}):t.jsxs(t.Fragment,{children:[s?t.jsx(cn,{community:s,roomId:e}):e===void 0&&t.jsx(xt,{children:"Channels"}),t.jsx(yn,{})]})}function yn(){const{id:e,thread:s,entry:n,community:a}=gt({from:"/_shell/channels"}),i=Re(),l=Ts(a?void 0:e,s,n),d=Ds(a?void 0:e),c=ps();return a&&e?t.jsx(Ve,{community:a,children:t.jsx(hn,{community:a,roomId:e,children:r=>t.jsx(ln,{community:a,roomId:e,threadId:s,dmAgentName:r,onThread:o=>{i({...xe.channels(),search:{community:a,id:e,thread:o}})}})},JSON.stringify([a,e]))}):a?t.jsx(Ve,{community:a,children:t.jsxs("div",{className:"text-muted-foreground flex h-full flex-col items-center justify-center gap-2 p-10 text-center text-sm",children:[t.jsx(Qe,{className:"text-muted-foreground/50 size-10","aria-hidden":!0}),t.jsx("p",{className:"text-foreground font-medium",children:"No channel selected"}),t.jsx("p",{className:"max-w-sm",children:"Choose a channel from this space."})]})}):l==="pending"||d==="pending"?t.jsx("div",{className:"flex h-full flex-col","aria-busy":!0,children:t.jsx(xs,{})}):l==="redirecting"||d==="redirecting"?null:e===void 0?t.jsxs("div",{className:"text-muted-foreground flex h-full flex-col items-center justify-center gap-2 p-10 text-center text-sm",children:[t.jsx(Qe,{className:"text-muted-foreground/50 size-10","aria-hidden":!0}),t.jsx("p",{className:"text-foreground font-medium",children:"Pick a channel or DM"}),t.jsx("p",{className:"max-w-sm",children:c?"Open one from All, at the bottom of the screen.":"Open one from the sidebar, or use + next to Channels."})]}):t.jsx(gs,{roomId:e,threadId:s,entrySeq:n,threadRoute:"/channels"})}function Ve({community:e,children:s}){var i;const n=Re(),a=(i=ge().data)==null?void 0:i.find(l=>l.ref===e);return a&&St(a)?t.jsx(un,{connection:a,onRemoved:()=>void n({...xe.channels(),search:{}})}):t.jsxs("div",{className:"flex h-full min-h-0 flex-col",children:[a&&t.jsx(mn,{connection:a}),a&&t.jsx(Rs,{connection:a}),t.jsx("div",{className:"min-h-0 flex-1",children:s})]})}const da=gn;export{da as component};
@@ -1 +0,0 @@
1
- import{j as t}from"./index-CjUfPyOM.js";import{M as o}from"./Marketplace-BWDlXgwH.js";import{P as r}from"./page-container-B9sDc2wq.js";import"./PreviewRefusedNotice-CnqAE9sr.js";import"./shield-x-Dr4BZfo_.js";import"./card-DI7YtQh3.js";import"./empty-state-aNwJA6H8.js";import"./markdown-content-ysBIqFAg.js";import"./use-unclaimed-chats-D7SEUfiO.js";import"./use-bindings-Bu4yLLR5.js";import"./UnlinkDialog-DTuXHNsi.js";import"./use-dev-links-C0Zc30aj.js";import"./more-details-DHCpYDi7.js";import"./file-bSD5jgk_.js";import"./AgentPicker-DoGucmqI.js";import"./command-DpK0GpDM.js";import"./AgentOptionRow-D-QjHi5k.js";import"./useMutationState-rOg4bnKv.js";import"./file-exclamation-point-BcCIL-rE.js";import"./rotate-ccw-clock-LSKKAcnR.js";import"./path-input-Z2p922fj.js";function i(){return t.jsx(r,{width:"wide",children:t.jsx(o,{})})}const R=i;export{R as component};
@@ -1 +0,0 @@
1
- import{j as o}from"./index-CjUfPyOM.js";import{P as r}from"./page-container-B9sDc2wq.js";import{M as e}from"./MarketplaceSourcesView-BhKzgkiO.js";import"./use-pending-read-BBBAnUYu.js";function t(){return o.jsx(r,{width:"reading",children:o.jsx(e,{})})}const s=t;export{s as component};
@@ -1 +0,0 @@
1
- import{S as o}from"./WorkView-_wehEEl-.js";import"./index-CjUfPyOM.js";import"./WidgetErrorCard-I8WiJv2g.js";import"./index-Dj4I8KcL.js";import"./PromptSuggestionChips-B9chKG4w.js";import"./primer-trigger-4qUY83SX.js";import"./use-is-below-desktop-BUS7OPGv.js";import"./use-notification-prefs-b8iKvzB4.js";import"./card-DI7YtQh3.js";import"./use-status-budget-CbmPFvpQ.js";import"./git-branch-ClXAt1_G.js";import"./use-update-config-Dfd7KMde.js";import"./settings-for-runtime-BoOa-ZFG.js";import"./RuntimeSetupDialog-Er-lzjmK.js";import"./inline-code-DwFNff3_.js";import"./list-runtime-types-B0CSonAi.js";import"./RuntimeConnectFlow-IaRVgmqH.js";import"./useMutationState-rOg4bnKv.js";import"./runtime-connect-Dn0T5YWv.js";import"./unverified-catalog-notice-CxBO_pta.js";import"./layers-DFZUUHM5.js";import"./cpu-DzCUBK-1.js";import"./banner-Ctq7kvQ0.js";import"./UnreadDivider-l_VZ7ECn.js";import"./composer-insert-BpyATrmR.js";import"./use-composer-prefs-BnjCX9pM.js";import"./McpAppFrame-BotrzoHd.js";import"./more-details-DHCpYDi7.js";import"./find-latest-widget-fence-D01ENK2h.js";import"./file-bSD5jgk_.js";import"./use-session-canvas-u63m2mYH.js";import"./rotate-cw-scTEKxeZ.js";import"./query-keys-DeYqUDia.js";import"./index.esm-Bb3LMu5X.js";import"./file-text-DTvj1wzM.js";import"./markdown-content-ysBIqFAg.js";import"./shield-x-Dr4BZfo_.js";import"./McpSigninBody-CdeX_lYs.js";import"./image-off-4yaoLh32.js";import"./format-duration-BCr6uzby.js";import"./use-connector-management-Bo6wOJQS.js";import"./AgentRequestCard--9GA9ymH.js";import"./access-copy-Cj31J6PU.js";import"./query-error-state-COuKRlU0.js";import"./empty-state-aNwJA6H8.js";import"./use-bindings-Bu4yLLR5.js";import"./connection-copy--MA7AN04.js";import"./KeyEntry-CSmznLcG.js";import"./index-D0yajRDv.js";import"./progress-eQl1UvNz.js";import"./table-B0LsKsEv.js";import"./package-CD8xq7hk.js";import"./heart-BrjEmIsl.js";import"./file-drag-GDx2qhdk.js";import"./paperclip-CzhXW5qi.js";import"./index-6yT0Qr0s.js";const mo=o;export{mo as component};
@@ -1 +0,0 @@
1
- import{E as o}from"./ExtensionPageRoute-BsGqTcyI.js";import"./index-CjUfPyOM.js";import"./empty-state-aNwJA6H8.js";import"./page-container-B9sDc2wq.js";import"./use-dev-links-C0Zc30aj.js";import"./UnlinkDialog-DTuXHNsi.js";const e=o;export{e as component};
@@ -1 +0,0 @@
1
- import{E as o}from"./ExtensionPageRoute-BsGqTcyI.js";import"./index-CjUfPyOM.js";import"./empty-state-aNwJA6H8.js";import"./page-container-B9sDc2wq.js";import"./use-dev-links-C0Zc30aj.js";import"./UnlinkDialog-DTuXHNsi.js";const e=o;export{e as component};
@@ -1 +0,0 @@
1
- import{U as a,C as n}from"./mermaid.core-B1mQMOXd.js";const t=(r,o)=>a.lang.round(n.parse(r)[o]);export{t as c};
@@ -1,17 +0,0 @@
1
- import{W as Se,aU as Me,a1 as ne,r as s,jc as Ie,jd as Q,je as G,jf as H,g9 as le,jg as Ce,a7 as J,jh as ee,as as lt,ji as it,a3 as oe,jj as ct,jk as dt,jl as ut,jm as ft,aY as Te,jn as ht,j as e,x as Fe,T as pt,C as Ke,aq as mt,es as be,jo as xt,G as Pe,jp as gt,jq as yt,jr as vt,js as Z,jt as ue,fX as fe,fY as he,fZ as pe,f_ as me,f$ as xe,g0 as ge,g1 as ye,g2 as ve,B as W,b8 as Ct,ez as _e,ju as bt,jv as jt,a2 as ce,jw as He,dX as kt,jx as wt,jy as Et,jz as Dt,jA as Nt,aP as De,jB as Ue,a4 as Rt,g7 as St,a0 as Tt,hf as Ft,ec as Pt,gX as Ot,jC as Mt,cT as _t,cU as At,cW as Lt,cX as zt,cY as $t,dU as It,I as Kt,dB as Ht}from"./index-CjUfPyOM.js";import{t as ae,g as Ut,C as qt,n as qe,r as Qe,a as Qt,p as Bt,F as Yt,w as Wt,c as Be,b as Gt}from"./room-files-source-DXKpm43a.js";import{N as rs,R as os}from"./room-files-source-DXKpm43a.js";import{d as Vt}from"./query-keys-DeYqUDia.js";import{r as Xt,c as Zt}from"./composer-insert-BpyATrmR.js";import{u as Jt}from"./index-6yT0Qr0s.js";import{r as Ye,h as We,F as en}from"./file-drag-GDx2qhdk.js";import{R as Ge}from"./rotate-cw-scTEKxeZ.js";import{L as tn}from"./link-2-xieOmwOK.js";import{F as Ve}from"./file-bSD5jgk_.js";import{G as Xe}from"./git-branch-ClXAt1_G.js";import{M as nn}from"./more-details-DHCpYDi7.js";import"./markdown-content-ysBIqFAg.js";import"./file-exclamation-point-BcCIL-rE.js";/**
2
- * @license lucide-react v1.48.0 - ISC
3
- *
4
- * This source code is licensed under the ISC license.
5
- * See the LICENSE file in the root directory of this source tree.
6
- */const Ze={name:"corner-left-up",size:24,node:[["path",{d:"M14 9 9 4 4 9",key:"1af5af"}],["path",{d:"M20 20h-7a4 4 0 0 1-4-4V4",key:"1blwi3"}]]};Ze.node;const sn=Se(Ze);/**
7
- * @license lucide-react v1.48.0 - ISC
8
- *
9
- * This source code is licensed under the ISC license.
10
- * See the LICENSE file in the root directory of this source tree.
11
- */const Je={name:"file-plus",size:24,node:[["path",{d:"M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z",key:"1oefj6"}],["path",{d:"M14 2v5a1 1 0 0 0 1 1h5",key:"wfsgrz"}],["path",{d:"M9 15h6",key:"cctwl0"}],["path",{d:"M12 18v-6",key:"17g6i2"}]]};Je.node;const et=Se(Je);/**
12
- * @license lucide-react v1.48.0 - ISC
13
- *
14
- * This source code is licensed under the ISC license.
15
- * See the LICENSE file in the root directory of this source tree.
16
- */const tt={name:"upload",size:24,node:[["path",{d:"M12 3v12",key:"1x0j5s"}],["path",{d:"m17 8-5-5-5 5",key:"7q97r8"}],["path",{d:"M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4",key:"ih7n3h"}]]};tt.node;const an=Se(tt);function ie(t,n,a){return["file-explorer","tree",t.scopeKey,n,t.filtersHidden?a:null]}function ke(t,n,a,x){return{queryKey:ie(t,n,a),queryFn:()=>t.list(n,{showHidden:a}),staleTime:Me.FILE_TREE_STALE_TIME_MS,gcTime:Me.FILE_TREE_GC_TIME_MS,refetchOnWindowFocus:!0,placeholderData:p=>p??x.getQueryData(ie(t,n,!a))}}const rn=[".git",".dork",".claude",".agents","node_modules"];function on(t){return t.startsWith(".")||rn.includes(t)}const Ne=["ROOM.md","README.md"];function Re(t){return Ne.some(n=>n.toLowerCase()===t.toLowerCase())}function nt(t){return t.filter(n=>!on(n.name))}function ln(t){if(t.reduce((p,c)=>c.type==="file"&&Re(c.name)?p+1:p,0)===0)return t;const a=[],x=[];for(const p of t)p.type==="file"&&Re(p.name)?a.push(p):x.push(p);return a.sort((p,c)=>Ne.findIndex(o=>o.toLowerCase()===p.name.toLowerCase())-Ne.findIndex(o=>o.toLowerCase()===c.name.toLowerCase())),[...a,...x]}const cn=/ copy(?: \d+)?$/;function Oe({name:t,isDir:n,taken:a}){const x=new Set(a);if(!x.has(t))return t;const p=n?-1:t.lastIndexOf("."),c=p>0,o=c?t.slice(p):"",m=(c?t.slice(0,p):t).replace(cn,"");for(let r=1;;r+=1){const l=r===1?`${m} copy${o}`:`${m} copy ${r}${o}`;if(!x.has(l))return l}}function Ae(t,n,a){return{name:n,path:t,type:a,size:0,mtime:Date.now(),isSymlink:!1}}function dn(t){const n=ne(),{source:a,showHidden:x,queryClient:p,inFlightRef:c}=t,o=a.cwd??"",[m,r]=s.useState(null),l=s.useCallback(async h=>{c.current+=1;try{return await h()}finally{c.current-=1}},[c]),u=s.useMemo(()=>{const h=g=>ie(a,g,x);return{getChildren:g=>{var w;return((w=p.getQueryData(h(g)))==null?void 0:w.entries)??[]},isLoaded:g=>p.getQueryData(h(g))!==void 0,takenNames:async g=>(await n.readFileTree(o,{path:g===Q?void 0:g,showHidden:!0})).entries.map(b=>b.name),snapshot:g=>p.getQueryData(h(g)),setChildren:(g,w)=>{p.setQueryData(h(g),b=>({entries:Ie(w((b==null?void 0:b.entries)??[]))}))},restore:(g,w)=>{p.setQueryData(h(g),w)},invalidate:g=>{p.invalidateQueries({queryKey:h(g),exact:!0}),p.invalidateQueries({queryKey:Vt.index(o)})}}},[p,n,o,a,x]),N=s.useCallback((h,g,w)=>l(async()=>{const b=ee(h,g),S=!u.getChildren(h).some(A=>A.path===b),K=u.snapshot(h);S&&u.setChildren(h,A=>[...A,Ae(b,g,w)]);try{return await n.createEntry(o,b,w),!0}catch(A){return S&&u.restore(h,K),ae(A,`Couldn’t create ${w==="dir"?"folder":"file"}`),!1}finally{u.invalidate(h)}}),[n,o,u,l]),F=s.useCallback((h,g)=>l(async()=>{if(g===h.name||g.length===0)return!0;const w=G(h.path),b=ee(w,g),S=u.getChildren(w).some(_=>_.path===b),K=u.snapshot(w),A={...h,name:g,path:b};S||u.setChildren(w,_=>_.map($=>$.path===h.path?A:$));try{return await n.renameEntry(o,h.path,b),H.getState().remapExpandedPaths(h.path,b),!0}catch(_){return S||u.restore(w,K),ae(_,"Couldn’t rename"),!1}finally{u.invalidate(w)}}),[n,o,u,l]),D=s.useCallback(h=>l(async()=>{const g=G(h.path),w=u.snapshot(g);u.setChildren(g,b=>b.filter(S=>S.path!==h.path));try{await n.deleteEntry(o,h.path,{recursive:!0}),H.getState().dropExpandedPaths(h.path)}catch(b){u.restore(g,w),ae(b,"Couldn’t delete")}finally{u.invalidate(g)}}),[n,o,u,l]),L=s.useCallback(h=>l(async()=>{const g=G(h.path);if(h.type==="file"){const w=u.snapshot(g);u.setChildren(g,b=>b.filter(S=>S.path!==h.path));try{await n.deleteEntry(o,h.path),H.getState().dropExpandedPaths(h.path)}catch(b){u.restore(g,w),ae(b,"Couldn’t delete")}finally{u.invalidate(g)}return}try{await n.deleteEntry(o,h.path),u.setChildren(g,w=>w.filter(b=>b.path!==h.path)),H.getState().dropExpandedPaths(h.path),u.invalidate(g)}catch(w){if(Ut(w)==="DIR_NOT_EMPTY"){r(h);return}ae(w,"Couldn’t delete")}}),[n,o,u,l]),C=s.useCallback(async()=>{const h=m;r(null),h&&await D(h)},[m,D]),U=s.useCallback(()=>r(null),[]),I=s.useCallback((h,g)=>l(async()=>{const w=G(h),b=le(h),S=ee(g,b);if(g===w||S===h||Ce(g,h))return;const K=u.getChildren(w).find(v=>v.path===h);if(!K)return;const A=u.isLoaded(g),_=A&&u.getChildren(g).some(v=>v.path===S),$={...K,name:b,path:S},Y=u.snapshot(w),P=A?u.snapshot(g):void 0;u.setChildren(w,v=>v.filter(z=>z.path!==h)),A&&!_&&u.setChildren(g,v=>[...v,$]);try{await n.renameEntry(o,h,S),H.getState().remapExpandedPaths(h,S)}catch(v){u.restore(w,Y),A&&!_&&u.restore(g,P),ae(v,"Couldn’t move")}finally{u.invalidate(w),A&&u.invalidate(g)}}),[n,o,u,l]),k=s.useCallback((h,g)=>l(async()=>{if(h.isDir&&Ce(g,h.path)){J.error(qt);return}let w;try{w=await u.takenNames(g)}catch(_){ae(_,"Couldn’t copy");return}const b=Oe({name:le(h.path),isDir:h.isDir,taken:w}),S=ee(g,b),K=u.isLoaded(g),A=K?u.snapshot(g):void 0;if(K){const _=u.getChildren(G(h.path)).find(Y=>Y.path===h.path),$=_?{..._,name:b,path:S}:Ae(S,b,h.isDir?"dir":"file");u.setChildren(g,Y=>[...Y,$])}try{await n.copyEntry(o,h.path,S)}catch(_){K&&u.restore(g,A),ae(_,"Couldn’t copy")}finally{u.invalidate(g)}}),[n,o,u,l]);return{createEntry:N,renameEntry:F,removeEntry:L,moveEntry:I,copyEntry:k,pendingRecursiveDelete:m,confirmRecursiveDelete:C,cancelRecursiveDelete:U}}function un(t){return t!=null&&t.startsWith("darwin")?"Reveal in Finder":t!=null&&t.startsWith("win32")?"Reveal in File Explorer":"Show in file manager"}function fn(t,n){const a=t.includes("\\")&&!t.includes("/"),x=t.replace(/[\\/]+$/,""),p=a?n.split("/").join("\\"):n;return`${x}${a?"\\":"/"}${p}`}function hn(t){const n=ne(),{data:a}=lt(),x=s.useMemo(()=>n.supportsReveal?un(a==null?void 0:a.platform):null,[n.supportsReveal,a==null?void 0:a.platform]),p=s.useCallback(async l=>{if(t)try{await n.revealEntry(t,l.path)}catch(u){ae(u,"Couldn’t open the file manager")}},[n,t]),{copy:c}=it(),o=s.useCallback(async(l,u)=>{const N=u==="absolute"&&t?fn(t,l.path):l.path;await c(N)||J.error("Couldn’t copy to the clipboard")},[t,c]),m=s.useCallback(l=>{Xt(Zt(l.path))||J.error("Open a chat to add this file")},[]),r=s.useCallback(l=>{H.getState().setClipboard({path:l.path,isDir:l.type==="dir"});try{navigator.clipboard.writeText(l.path).catch(()=>{})}catch{}},[]);return{revealLabel:x,reveal:p,copyPath:o,addToChat:m,copyToClipboard:r}}const pn=1e3;function mn(t){const{source:n,showHidden:a,queryClient:x,inFlightRef:p}=t,c=n.changes,[o,m]=s.useState(null),[r,l]=s.useState(null),[u,N]=s.useState(null),[F,D]=s.useState(0),L=s.useCallback(async d=>{p.current+=1,D(f=>f+1);try{return await d()}finally{p.current-=1,D(f=>f-1)}},[p]),C=s.useMemo(()=>{const d=f=>ie(n,f,a);return{listing:f=>x.getQueryData(d(f)),isLoaded:f=>x.getQueryData(d(f))!==void 0,entries:f=>{var T;return((T=x.getQueryData(d(f)))==null?void 0:T.entries)??[]},setEntries:(f,T)=>x.setQueryData(d(f),y=>({...y,entries:Ie(T((y==null?void 0:y.entries)??[]))})),restore:(f,T)=>x.setQueryData(d(f),T),fetch:f=>n.list(f,{showHidden:!0}),refreshAll:()=>{x.invalidateQueries({queryKey:["file-explorer","tree",n.scopeKey]}),x.invalidateQueries({queryKey:["file-explorer","preview",n.scopeKey]})}}},[x,n,a]),U=s.useCallback(async d=>{const f=C.listing(d);return(f==null?void 0:f.commit)!==void 0?f.commit:(await C.fetch(d)).commit??null},[C]),I=s.useCallback((d,f,T,y)=>{switch(d.status){case"changed":return!0;case"conflict":return N({kind:f,path:d.path,lastCommit:d.lastCommit,retry:()=>T(d.commit)}),!1;case"exists":return J.error(y===void 0?d.reason:qe(y)),!1;case"refused":return J.error(d.reason),!1}},[]),k=s.useCallback((d,f)=>{J.error(Qe(d)??f)},[]),h=s.useCallback((d,f,T)=>{const y=O=>L(async()=>{if(c===void 0)return!1;const E=G(d.path),R=G(f),j=le(f),q=C.isLoaded(R),te=q&&C.entries(R).some(X=>X.path===f),V=C.listing(E),de=R===E?void 0:C.listing(R),i={...d,name:j,path:f};te||(R===E?C.setEntries(E,X=>X.map(se=>se.path===d.path?i:se)):(C.setEntries(E,X=>X.filter(se=>se.path!==d.path)),q&&C.setEntries(R,X=>[...X,i])));const M=()=>{C.restore(E,V),R!==E&&q&&C.restore(R,de)};try{const X=O??await U(E);if(X===null)return M(),J.error("This room has no files to change yet."),!1;const se=await c.move({from:d.path,to:f,baseCommit:X}),we=I(se,T,async re=>{await y(re)},j);return we?H.getState().remapExpandedPaths(d.path,f):M(),we}catch(X){return M(),k(X,T==="rename"?"Couldn’t rename":"Couldn’t move"),!1}finally{C.refreshAll()}});return y(null)},[c,C,L,U,I,k]),g=s.useCallback(async(d,f)=>f===d.name||f.length===0?!0:h(d,ee(G(d.path),f),"rename"),[h]),w=s.useCallback(async(d,f)=>{const T=G(d),y=ee(f,le(d));if(f===T||y===d||Ce(f,d))return;const O=C.entries(T).find(E=>E.path===d);O&&await h(O,y,"move")},[C,h]),b=s.useCallback(async d=>{let f=0;const T=[d];for(;T.length>0;){const y=T.shift(),O=await C.fetch(y);for(const E of O.entries)if(E.type==="dir"?T.push(E.path):f+=1,f>=pn)return{count:f,moreThan:!0}}return{count:f,moreThan:!1}},[C]),S=s.useCallback(d=>{if(d.type!=="dir"){m({entry:d,fileCount:1,moreThan:!1});return}m({entry:d,fileCount:null,moreThan:!1}),b(d.path).then(({count:f,moreThan:T})=>m(y=>(y==null?void 0:y.entry.path)===d.path?{entry:d,fileCount:f,moreThan:T}:y),()=>{})},[b]),K=s.useCallback(d=>{const f=T=>L(async()=>{if(c===void 0)return;const y=G(d.path),O=C.listing(y);C.setEntries(y,E=>E.filter(R=>R.path!==d.path));try{const E=T??await U(y);if(E===null){C.restore(y,O);return}const R=await c.remove({path:d.path,baseCommit:E});I(R,"delete",q=>f(q))?H.getState().dropExpandedPaths(d.path):C.restore(y,O)}catch(E){C.restore(y,O),k(E,"Couldn’t delete")}finally{C.refreshAll()}});return f(null)},[c,C,L,U,I,k]),A=s.useCallback(async()=>{const d=o;m(null),d&&await K(d.entry)},[o,K]),_=s.useCallback(()=>m(null),[]),$=s.useCallback((d,f,T,y)=>{const O=E=>L(async()=>{if(c===void 0)return;const R=C.isLoaded(d),j=R?C.listing(d):void 0;if(R){const q=new Set(C.entries(d).map(V=>V.name)),te=f.filter(V=>!q.has(V.name)).map(V=>({name:V.name,path:ee(d,V.name),type:"file",size:V.size}));te.length>0&&C.setEntries(d,V=>[...V,...te])}try{const q=await c.upload({dir:d,baseCommit:E,replace:T,files:f});!I(q,"upload",V=>O(V))&&R&&C.restore(d,j)}catch(q){R&&C.restore(d,j),k(q,"Couldn’t upload")}finally{C.refreshAll()}});return O(y)},[c,C,L,I,k]),Y=s.useCallback(async(d,f)=>{if(c===void 0||f.length===0)return;if(f.length>c.maxUploadFiles){J.error(`Nothing was uploaded. One upload takes up to ${c.maxUploadFiles} files.`);return}let T;try{T=await C.fetch(d)}catch(j){k(j,"Couldn’t upload");return}const y=T.entries.map(j=>j.name),O=new Set(y),E=f.map(j=>j.name).filter(j=>O.has(j)),R=T.commit??null;if(E.length===0){await $(d,f,[],R);return}l({dir:d,files:f,names:E,taken:y,baseCommit:R})},[c,C,k,$]),P=s.useCallback(async d=>{const f=r;if(l(null),f===null)return;if(d==="replace"){await $(f.dir,f.files,f.names,f.baseCommit);return}const T=new Set([...f.taken,...f.files.map(E=>E.name)]),y=new Set(f.names),O=f.files.map(E=>{if(!y.has(E.name))return E;const R=Oe({name:E.name,isDir:!1,taken:T});return T.add(R),new File([E],R,{type:E.type,lastModified:E.lastModified})});await $(f.dir,O,[],f.baseCommit)},[r,$]),v=s.useCallback(()=>l(null),[]),z=s.useCallback(()=>N(null),[]),B=s.useMemo(()=>r===null?null:{dir:r.dir,names:r.names},[r]);return{renameEntry:g,moveEntry:w,requestDelete:S,pendingDelete:o,confirmDelete:A,cancelDelete:_,upload:Y,pendingClash:B,resolveClash:P,cancelClash:v,conflict:u,dismissConflict:z,busy:F>0}}const Le={scopeKey:"",cwd:null,writable:!1,provenance:!1,filtersHidden:!0,preview:"canvas",editable:!1,list:()=>Promise.resolve({entries:[]})};function xn(t){var d,f,T;const n=ne(),a=oe(),{setTheme:x}=ct(),p=H(y=>y.showHidden),c=H(y=>y.expanded),o=H(y=>y.loadExplorerForCwd),m=H(y=>y.pruneMissing),r=(t==null?void 0:t.scopeKey)??null,l=(t==null?void 0:t.cwd)??null;s.useEffect(()=>{o(r)},[r,o]);const u=s.useMemo(()=>[Q,...dt(c)],[c]),N=ut({queries:t?u.map(y=>ke(t,y,p,a)):[]}),F=(t==null?void 0:t.filtersHidden)??!0,D=s.useMemo(()=>{const y={};return u.forEach((O,E)=>{var q;const R=N[E];let j=((q=R==null?void 0:R.data)==null?void 0:q.entries)??[];!p&&!F&&(j=nt(j)),O===Q&&(j=ln(j)),y[O]={entries:j,loading:(R==null?void 0:R.isLoading)??!1,error:(R==null?void 0:R.isError)??!1}}),y},[u,N,p,F]),L=s.useRef(0),C=s.useRef({});s.useEffect(()=>{L.current>0||u.forEach((y,O)=>{var R,j,q;const E=(j=(R=N[O])==null?void 0:R.data)==null?void 0:j.entries;!E||(q=N[O])!=null&&q.isError||C.current[y]!==E&&(C.current[y]=E,m(y,E.map(te=>te.name)))})},[u,N,m]);const U=s.useMemo(()=>ft(c,D),[c,D]),I=!!t&&!!((d=D[Q])!=null&&d.loading),k=!!t&&!!((f=D[Q])!=null&&f.error),h=(T=N[0])==null?void 0:T.error,g=k&&h?Qt(h):void 0,w=(g==null?void 0:g.message)??null,b=(g==null?void 0:g.command)??null,S=s.useMemo(()=>{var O;const y=new Set;for(const E of u)E!==Q&&((O=D[E])!=null&&O.error)&&y.add(E);return y},[u,D]),K=s.useCallback(y=>{if(y.type!=="dir")return;const O=H.getState();O.setDirExpanded(y.path,!O.expanded[y.path])},[]),A=s.useCallback(y=>{if(y===Q)return;const O=H.getState();O.expanded[y]||O.setDirExpanded(y,!0)},[]),_=(t==null?void 0:t.preview)==="canvas",$=s.useCallback(y=>{if(y.type!=="file"||!_)return;const O={getStore:Te.getState,setTheme:x,supportsTerminal:n.supportsTerminal};ht(O,{action:"open_file",sourcePath:y.path},"user")},[_,x,n]),Y=s.useCallback(()=>{r!==null&&a.invalidateQueries({queryKey:["file-explorer","tree",r]})},[a,r]),P=s.useCallback(y=>{t!==null&&a.invalidateQueries({queryKey:ie(t,y,p),exact:!0})},[a,t,p]);s.useEffect(()=>{if(t!=null&&t.events)return t.events(Y)},[t,Y]);const v=dn({source:t??Le,showHidden:p,queryClient:a,inFlightRef:L}),z=mn({source:t??Le,showHidden:p,queryClient:a,inFlightRef:L}),B=hn(l);return{rows:U,rootLoading:I,rootError:k,rootErrorMessage:w,rootErrorCommand:b,errorPaths:S,toggleExpand:K,ensureExpanded:A,openFile:$,reload:Y,retryDir:P,changes:t!=null&&t.changes?z:null,...v,...B}}function gn(t){const{transport:n,cwd:a}=t;return{scopeKey:a,cwd:a,writable:!0,provenance:!1,filtersHidden:!0,preview:"canvas",editable:!1,list(x,p){return n.readFileTree(a,{path:x===""?void 0:x,showHidden:p.showHidden})}}}function je(t){return Array.from(t).includes("Files")}function st(t){const n=Array.from(t.items??[]);if(!(n.length>0&&n.every(c=>"webkitGetAsEntry"in c)))return{files:Array.from(t.files??[]),folders:0};const x=[];let p=0;for(const c of n){if(c.kind!=="file")continue;const o=c.webkitGetAsEntry();if(o!=null&&o.isDirectory){p+=1;continue}const m=c.getAsFile();m&&x.push(m)}return{files:x,folders:p}}const yn=12;function vn({row:t,selected:n,renaming:a,error:x,onSelect:p,onActivate:c,onRetry:o,onSubmitRename:m,onCancelRename:r,onNewFile:l,onNewFolder:u,onStartRename:N,onDelete:F,onMove:D,onCopyInto:L,onCopy:C,onPaste:U,onDuplicate:I,canPasteInto:k,revealLabel:h,onReveal:g,onAddToChat:w,onCopyPath:b,readOnly:S=!1,provenance:K=!1,copyable:A=!0,onDisk:_=!0,onUpload:$,onPickUpload:Y}){const{entry:P,depth:v,expanded:z,loading:B}=t,d=P.type==="dir",f=d?P.path:G(P.path),[T,y]=s.useState(!1),O=!d&&v===0&&Re(P.name),E=Bt(P.lastCommit),R=e.jsxs("div",{role:"treeitem","aria-label":P.name,"aria-expanded":d?z:void 0,"aria-selected":n,tabIndex:-1,onKeyDown:j=>{(j.key==="Enter"||j.key===" ")&&(j.preventDefault(),p(P),c(P))},draggable:!a&&!S,onDragStart:j=>{S||(j.dataTransfer.setData("text/plain",P.path),j.dataTransfer.setData(en,P.path),j.dataTransfer.effectAllowed="copyMove")},onDragOver:j=>{if(j.stopPropagation(),!S&&$&&je(j.dataTransfer.types)){j.preventDefault(),j.dataTransfer.dropEffect="copy",y(!0);return}S||!d||!We(j.dataTransfer.types)||(j.preventDefault(),j.dataTransfer.dropEffect=j.altKey&&A?"copy":"move",y(!0))},onDragLeave:()=>y(!1),onDrop:j=>{if(j.stopPropagation(),S)return;if(y(!1),$&&je(j.dataTransfer.types)){j.preventDefault();const{files:te}=st(j.dataTransfer);$(f,te);return}if(!d)return;const q=Ye(j.dataTransfer);q!==null&&(j.preventDefault(),j.altKey&&A?L(q,P.path):D(q,P.path))},onClick:()=>{p(P),c(P)},className:Pe("flex w-full cursor-pointer items-center gap-1 py-1 pr-2 text-sm transition-colors",n?"bg-accent text-foreground":"hover:bg-accent/50",T&&"ring-ring/60 bg-accent ring-1"),style:{paddingLeft:v*yn+8},children:[e.jsx("span",{className:"flex size-4 flex-shrink-0 items-center justify-center",children:d&&(B?e.jsx(Fe,{size:"xs",className:"text-muted-foreground"}):x?e.jsx("button",{type:"button","aria-label":"Retry loading",title:"Couldn’t load. Retry",onClick:j=>{j.stopPropagation(),o()},className:"flex items-center justify-center",children:e.jsx(Ge,{className:"text-destructive size-3.5"})}):z?e.jsx(pt,{className:"text-muted-foreground size-3.5"}):e.jsx(Ke,{className:"text-muted-foreground size-3.5"}))}),d?z?e.jsx(mt,{className:"size-(--size-icon-sm) flex-shrink-0 text-sky-500"}):e.jsx(be,{className:"size-(--size-icon-sm) flex-shrink-0 text-sky-500"}):P.isSymlink===!0?e.jsx(tn,{className:"text-muted-foreground size-(--size-icon-sm) flex-shrink-0"}):e.jsx(Ve,{className:"text-muted-foreground size-(--size-icon-sm) flex-shrink-0"}),a?e.jsx(Cn,{initialName:P.name,onSubmit:j=>m(P,j),onCancel:r}):e.jsx("span",{className:"min-w-0 flex-1 truncate",children:P.name}),O&&!a&&e.jsx(xt,{"aria-label":"Pinned to the top",className:"text-muted-foreground/60 size-3 flex-shrink-0"}),K&&!a&&e.jsx("span",{className:"text-muted-foreground/70 text-2xs max-w-[45%] flex-shrink-0 truncate tabular-nums",title:E.title??void 0,children:E.label})]});return S?R:e.jsxs(gt,{children:[e.jsx(yt,{asChild:!0,children:R}),e.jsxs(vt,{className:"w-52",children:[e.jsx(Z,{movesFocus:!0,onClick:()=>l(f),children:"New file"}),e.jsx(Z,{movesFocus:!0,onClick:()=>u(f),children:"New folder"}),Y&&e.jsx(Z,{onClick:()=>Y(f),children:"Upload files…"}),_&&e.jsxs(e.Fragment,{children:[e.jsx(ue,{}),h&&e.jsx(Z,{onClick:()=>g(P),children:h}),e.jsx(Z,{movesFocus:!0,onClick:()=>w(P),children:"Add to chat"})]}),A&&e.jsxs(e.Fragment,{children:[e.jsx(ue,{}),e.jsx(Z,{onClick:()=>C(P),children:"Copy"}),e.jsx(Z,{disabled:!k(f),onClick:()=>U(f),children:"Paste"}),e.jsx(Z,{onClick:()=>I(P),children:"Duplicate"})]}),e.jsx(ue,{}),_?e.jsxs(e.Fragment,{children:[e.jsx(Z,{onClick:()=>b(P,"absolute"),children:"Copy path"}),e.jsx(Z,{onClick:()=>b(P,"relative"),children:"Copy relative path"})]}):e.jsx(Z,{onClick:()=>b(P,"relative"),children:"Copy path"}),e.jsx(ue,{}),e.jsx(Z,{movesFocus:!0,onClick:()=>N(P),children:"Rename"}),e.jsx(Z,{variant:"destructive",onClick:()=>F(P),children:"Delete"})]})]})}function Cn({initialName:t,onSubmit:n,onCancel:a}){const x=s.useRef(null),[p,c]=s.useState(t);s.useEffect(()=>{const m=x.current;if(!m)return;m.focus();const r=t.lastIndexOf(".");m.setSelectionRange(0,r>0?r:t.length)},[t]);const o=()=>{const m=p.trim();m&&m!==t?n(m):a()};return e.jsx("input",{ref:x,type:"text",value:p,"aria-label":"New name",onChange:m=>c(m.target.value),onClick:m=>m.stopPropagation(),onBlur:o,onKeyDown:m=>{m.stopPropagation(),m.key==="Enter"?o():m.key==="Escape"&&a()},className:"border-border bg-background focus-ring min-w-0 flex-1 rounded border px-1 py-0 text-sm outline-none"})}const bn=100,jn=28,kn=250;function wn(t){const{rows:n,selectedPath:a,renamingPath:x,errorPaths:p,onSelectPath:c,onRetryDir:o}=t,m=s.useRef(null),r=H(v=>v.setScrollTop),l=H(v=>v.scopeKey),u=s.useCallback(v=>v.type==="dir"?t.onToggle(v):t.onOpen(v),[t]),N=Dn(t,u),F=n.length>bn,D=Jt({count:n.length,getScrollElement:()=>m.current,estimateSize:()=>jn,overscan:12,enabled:F}),L=s.useRef({scope:void 0,done:!1}),C=s.useRef(null);s.useLayoutEffect(()=>{const v=L.current;if(v.scope!==l&&(v.scope=l,v.done=!1),v.done||n.length===0)return;const z=m.current;if(!z)return;const B=H.getState().scrollTop;if(B<=0){v.done=!0;return}F?D.scrollToOffset(B):z.scrollTop=B,C.current=z.scrollTop,z.scrollTop>=B&&(v.done=!0)},[n.length,l,F,D]);const U=s.useRef(null),I=s.useRef(null),k=s.useCallback(()=>{const v=m.current;v&&v.scrollTop!==C.current&&(L.current.done=!0,U.current=v.scrollTop,I.current&&clearTimeout(I.current),I.current=setTimeout(()=>{I.current=null,U.current!==null&&r(U.current)},kn))},[r]);s.useEffect(()=>()=>{I.current&&clearTimeout(I.current),U.current!==null&&r(U.current)},[r]);const h=s.useRef(void 0);s.useEffect(()=>{var d,f;const v=h.current;if(h.current=a,v===void 0||a===v||a===null)return;const z=n.findIndex(T=>T.entry.path===a);if(z<0)return;const B=m.current;B&&(F?D.scrollToIndex(z,{align:"auto"}):(f=(d=B.querySelector(`[data-row-index="${z}"]`))==null?void 0:d.scrollIntoView)==null||f.call(d,{block:"nearest"}),C.current=B.scrollTop)},[a,n,F,D]);const[g,w]=s.useState(!1),{onCopyInto:b,onMove:S}=t,K=t.readOnly===!0,A=t.copyable!==!1,_=s.useCallback(v=>{K||!We(v.dataTransfer.types)||(v.preventDefault(),v.dataTransfer.dropEffect=v.altKey&&A?"copy":"move",w(!0))},[K,A]),$=s.useCallback((v,z)=>{const B=n.find(d=>d.entry.path===v);B&&b({path:v,isDir:B.entry.type==="dir"},z)},[n,b]),Y=s.useCallback(v=>{if(w(!1),K)return;const z=Ye(v.dataTransfer);z!==null&&(v.preventDefault(),v.altKey&&A?$(z,Q):S(z,Q))},[$,S,K,A]),P=v=>e.jsx(vn,{row:v,selected:v.entry.path===a,renaming:v.entry.path===x,error:v.entry.type==="dir"&&v.expanded&&p.has(v.entry.path),onSelect:z=>c(z.path),onActivate:u,onRetry:()=>o(v.entry.path),onSubmitRename:t.onSubmitRename,onCancelRename:t.onCancelRename,onStartRename:t.onStartRename,onNewFile:t.onNewFile,onNewFolder:t.onNewFolder,onDelete:t.onDelete,onMove:t.onMove,onCopyInto:$,onCopy:t.onCopy,onPaste:t.onPaste,onDuplicate:t.onDuplicate,canPasteInto:t.canPasteInto,revealLabel:t.revealLabel,onReveal:t.onReveal,onAddToChat:t.onAddToChat,onCopyPath:t.onCopyPath,readOnly:t.readOnly,provenance:t.provenance,copyable:t.copyable,onDisk:t.onDisk,onUpload:t.onUpload,onPickUpload:t.onPickUpload});return e.jsx("div",{ref:m,role:"tree","aria-label":"File explorer",tabIndex:0,onKeyDown:N,onScroll:k,onDragOver:_,onDragLeave:()=>w(!1),onDrop:Y,className:Pe("focus-visible:ring-ring h-full overflow-auto outline-none focus-visible:ring-1 focus-visible:ring-inset",g&&"ring-ring/60 bg-accent/30 ring-1 ring-inset"),children:F?e.jsx("div",{style:{height:D.getTotalSize()},className:"relative w-full",children:D.getVirtualItems().map(v=>e.jsx("div",{"data-row-index":v.index,className:"absolute top-0 left-0 w-full",style:{transform:`translateY(${v.start}px)`},children:P(n[v.index])},n[v.index].entry.path))}):n.map((v,z)=>e.jsx("div",{"data-row-index":z,children:P(v)},v.entry.path))})}function En(t){return t?t.type==="dir"?t.path:G(t.path):Q}function Dn(t,n){const{rows:a,selectedPath:x,renamingPath:p,onSelectPath:c}=t;return s.useCallback(o=>{var l,u,N,F;if(p!==null)return;const m=a.findIndex(D=>D.entry.path===x),r=m>=0?a[m]:void 0;if(o.metaKey||o.ctrlKey){if(t.readOnly===!0||t.copyable===!1)return;const D=o.key.toLowerCase();if(D==="c"&&r){o.preventDefault(),t.onCopy(r.entry);return}if(D==="v"){o.preventDefault(),t.onPaste(En(r==null?void 0:r.entry));return}return}switch(o.key){case"ArrowDown":o.preventDefault(),c(((l=a[Math.min(m+1,a.length-1)])==null?void 0:l.entry.path)??((u=a[0])==null?void 0:u.entry.path));break;case"ArrowUp":o.preventDefault(),c(((N=a[Math.max(m-1,0)])==null?void 0:N.entry.path)??((F=a[0])==null?void 0:F.entry.path));break;case"ArrowRight":(r==null?void 0:r.entry.type)==="dir"&&!r.expanded&&(o.preventDefault(),t.onToggle(r.entry));break;case"ArrowLeft":if(!r)break;if(o.preventDefault(),r.entry.type==="dir"&&r.expanded)t.onToggle(r.entry);else{const D=G(r.entry.path);D&&c(D)}break;case"Enter":r&&(o.preventDefault(),n(r.entry));break;case"F2":r&&t.readOnly!==!0&&(o.preventDefault(),t.onStartRename(r.entry));break;case"Delete":case"Backspace":r&&t.readOnly!==!0&&(o.preventDefault(),t.onDelete(r.entry));break}},[a,x,p,c,t,n])}const Nn={rename:"Rename it anyway",move:"Move it anyway",delete:"Delete it anyway",upload:"Upload mine over it"},Rn={rename:"nothing was renamed",move:"nothing was moved",delete:"nothing was deleted",upload:"nothing was uploaded"};function Sn(t){const{entry:n,fileCount:a,moreThan:x}=t;if(n.type!=="dir")return`“${n.name}” leaves the room’s files.`;const p=a===null?"everything in it":x?`the more than ${a.toLocaleString()} files in it`:a===1?"the 1 file in it":`the ${a.toLocaleString()} files in it`;return`“${n.name}” and ${p} leave the room’s files.`}const Tn="The room’s history keeps a copy. An agent can restore it.";function Fn({changes:t,onOpenTheirs:n,onReturnFocus:a}){var D;const x=L=>{L.preventDefault();const C=document.activeElement;C!==null&&C!==document.body||a()},{pendingDelete:p,pendingClash:c,conflict:o}=t,[m,r]=s.useState(p);p!==null&&p!==m&&r(p);const[l,u]=s.useState(c);c!==null&&c!==l&&u(c);const N=l===null?"":l.dir===Q?"The top folder":`“${l.dir}”`,F=(l==null?void 0:l.names.length)===1;return e.jsxs(e.Fragment,{children:[e.jsx(fe,{open:p!==null,onOpenChange:L=>!L&&t.cancelDelete(),children:e.jsxs(he,{onCloseAutoFocus:x,children:[e.jsxs(pe,{children:[e.jsx(me,{children:m===null?"":`Delete “${m.entry.name}”?`}),e.jsx(xe,{asChild:!0,children:e.jsxs("div",{className:"space-y-2",children:[e.jsx("p",{children:m===null?"":Sn(m)}),e.jsx("p",{children:Tn})]})})]}),e.jsxs(ge,{children:[e.jsx(ye,{onClick:t.cancelDelete,children:"Cancel"}),e.jsx(ve,{onClick:()=>void t.confirmDelete(),className:"bg-destructive hover:bg-destructive/90 dark:bg-destructive/60 text-white",children:(m==null?void 0:m.entry.type)==="dir"?"Delete folder":"Delete file"})]})]})}),e.jsx(fe,{open:c!==null,onOpenChange:L=>!L&&t.cancelClash(),children:e.jsxs(he,{onCloseAutoFocus:x,children:[e.jsxs(pe,{children:[e.jsx(me,{children:F?`Replace “${l==null?void 0:l.names[0]}”?`:`Replace ${(l==null?void 0:l.names.length)??0} files?`}),e.jsx(xe,{children:F?`${N} already has a file with this name. Replace it, or keep both.`:`${N} already has files named ${(l==null?void 0:l.names.join(", "))??""}. Replace them, or keep both.`})]}),e.jsxs(ge,{children:[e.jsx(ye,{onClick:t.cancelClash,children:"Cancel"}),e.jsx(W,{variant:"outline",onClick:()=>void t.resolveClash("keep-both"),children:"Keep both"}),e.jsx(ve,{onClick:()=>void t.resolveClash("replace"),children:"Replace"})]})]})}),e.jsx(fe,{open:o!==null,onOpenChange:L=>!L&&t.dismissConflict(),children:e.jsxs(he,{onCloseAutoFocus:x,children:[e.jsxs(pe,{children:[e.jsx(me,{children:"Somebody changed this first"}),e.jsx(xe,{children:o===null?"":`${((D=o.lastCommit)==null?void 0:D.author)??"Somebody"} changed “${o.path}” after you opened it, so ${Rn[o.kind]}.`})]}),(o==null?void 0:o.lastCommit)&&e.jsxs("p",{className:"text-muted-foreground text-xs",children:[o.lastCommit.subject," · ",Ct(o.lastCommit.at)]}),e.jsxs(ge,{children:[e.jsx(ye,{onClick:t.dismissConflict,children:"Cancel"}),e.jsx(W,{variant:"outline",onClick:()=>{o!==null&&(t.dismissConflict(),n(o.path))},children:"Open their version"}),e.jsx(ve,{onClick:()=>{o!==null&&(t.dismissConflict(),o.retry())},className:"bg-destructive hover:bg-destructive/90 dark:bg-destructive/60 text-white",children:o===null?"":Nn[o.kind]})]})]})})]})}function ze(t,n){return n.name===t?qe(t):`“${n.name}” is already there. Some computers ignore capital letters in names. Pick another name.`}const Pn="Folders can’t be uploaded. Drop the files inside instead.";function On({source:t,className:n,onCommands:a}={}){var de;const x=ne(),p=Te(i=>i.selectedCwd),c=s.useMemo(()=>p?gn({transport:x,cwd:p}):null,[x,p]),o=t===void 0?c:t,m=o!==null&&!o.writable,r=xn(o),l=r.changes,u=oe(),N=H(i=>i.showHidden),{rows:F,rootLoading:D,rootError:L,rootErrorMessage:C,rootErrorCommand:U,errorPaths:I}=r,k=H(i=>i.setCommands),h=H(i=>i.selectedPath),g=H(i=>i.setSelectedPath),w=H(i=>i.clipboard),[b,S]=s.useState(null),[K,A]=s.useState(null),[_,$]=s.useState(null),Y=s.useCallback(i=>$(i===null?null:{path:i,isNew:!1}),[]),P=s.useRef(null),v=s.useRef(Q),[z,B]=s.useState(!1),d=s.useCallback((i,M)=>{if(l!==null){if(M.length===0){J.error(Pn);return}r.ensureExpanded(i),l.upload(i,M)}},[l,r]),f=s.useRef(null),T=s.useCallback(()=>{var i,M;(M=(i=f.current)==null?void 0:i.querySelector('[role="tree"]'))==null||M.focus()},[]),y=s.useCallback(i=>{var M;v.current=i,(M=P.current)==null||M.click()},[]),O=s.useCallback(i=>w!==null&&!(w.isDir&&Ce(i,w.path)),[w]),E=s.useCallback((i,M)=>{r.ensureExpanded(i),_e.flushSync(()=>{A(null),S({parent:i,type:M})})},[r]),R=s.useCallback(i=>{_e.flushSync(()=>A(i.path))},[]),j=s.useRef({startCreate:E,reload:r.reload,pickUpload:y});s.useEffect(()=>{j.current={startCreate:E,reload:r.reload,pickUpload:y}});const q=l!==null;s.useEffect(()=>{if(m||a===void 0&&q)return;const i=a??k;return i({newFile:()=>j.current.startCreate(Q,"file"),newFolder:()=>j.current.startCreate(Q,"dir"),refresh:()=>j.current.reload(),...q&&{upload:()=>j.current.pickUpload(Q)}}),()=>i(null)},[k,a,m,q]);const te=s.useCallback(async i=>{var se;if(!b||o===null)return;const M=b;if(S(null),l!==null){const re=(((se=u.getQueryData(ie(o,M.parent,N)))==null?void 0:se.entries)??[]).find(ot=>ot.name.toLowerCase()===i.toLowerCase());if(M.type==="dir"){if(re!==void 0&&!(re.type==="dir"&&re.name===i)){J.error(ze(i,re));return}S({parent:ee(M.parent,i),type:"file",firstInFolder:i});return}if(re!==void 0){J.error(ze(i,re));return}const rt=ee(M.parent,i);$({path:rt,isNew:!0});return}await r.createEntry(M.parent,i,M.type)&&g(ee(M.parent,i))},[b,o,l,u,N,r,g]),V=s.useCallback(async(i,M)=>{A(null),(l?await l.renameEntry(i,M):await r.renameEntry(i,M))&&g(ee(G(i.path),M))},[l,r,g]);return o===null?t!==void 0?null:e.jsx("div",{className:"text-muted-foreground flex h-full items-center justify-center p-6 text-center text-sm",children:"Pick a folder to see its files."}):e.jsxs("div",{ref:f,className:Pe("flex h-full flex-col",z&&"ring-ring/60 bg-accent/30 ring-1 ring-inset",n),onDragOver:i=>{l===null||!je(i.dataTransfer.types)||(i.preventDefault(),i.dataTransfer.dropEffect="copy",B(!0))},onDragLeave:i=>{i.currentTarget.contains(i.relatedTarget)||B(!1)},onDrop:i=>{B(!1),!(l===null||!je(i.dataTransfer.types))&&(i.preventDefault(),d(Q,st(i.dataTransfer).files))},children:[l!==null&&e.jsx("input",{ref:P,type:"file",multiple:!0,hidden:!0,"aria-hidden":!0,tabIndex:-1,"data-testid":"room-files-upload-input",onChange:i=>{const M=Array.from(i.target.files??[]);i.target.value="",d(v.current,M)}}),e.jsxs("div",{className:"min-h-0 flex-1",children:[b&&e.jsx(Mn,{type:b.type,firstInFolder:b.firstInFolder,onSubmit:i=>void te(i),onCancel:()=>S(null)},`${b.parent}:${b.type}:${b.firstInFolder??""}`),D&&F.length===0?e.jsx("div",{className:"flex h-20 items-center justify-center",children:e.jsx(Fe,{size:"md",className:"text-muted-foreground",label:"Loading files"})}):L&&F.length===0?e.jsxs("div",{className:"text-muted-foreground flex min-h-20 flex-col items-center justify-center gap-2 px-4 py-3 text-center text-xs [overflow-wrap:anywhere]",children:[e.jsx("span",{children:C??"Couldn’t load files."}),U!==null&&e.jsx("code",{"aria-label":"Command that removes the settings",className:"bg-muted text-foreground block w-full rounded px-2 py-1.5 text-left font-mono select-all",children:U}),e.jsxs(W,{variant:"outline",size:"xs",onClick:r.reload,children:[e.jsx(Ge,{}),"Retry"]})]}):F.length===0&&!b?e.jsx("div",{className:"text-muted-foreground/60 flex h-20 items-center justify-center px-4 text-center text-xs",children:l!==null?"No files yet. Drop files here, or use Upload.":"Empty folder"}):e.jsx(wn,{rows:F,selectedPath:h,renamingPath:K,errorPaths:I,onSelectPath:g,onToggle:r.toggleExpand,onOpen:i=>{o.preview==="inline"?Y(i.path):r.openFile(i)},onRetryDir:r.retryDir,onSubmitRename:(i,M)=>void V(i,M),onCancelRename:()=>A(null),onStartRename:R,onNewFile:i=>E(i,"file"),onNewFolder:i=>E(i,"dir"),onDelete:i=>l?l.requestDelete(i):void r.removeEntry(i),onMove:(i,M)=>void(l?l.moveEntry(i,M):r.moveEntry(i,M)),onCopyInto:(i,M)=>void r.copyEntry(i,M),onCopy:r.copyToClipboard,onPaste:i=>{w&&r.copyEntry(w,i)},onDuplicate:i=>void r.copyEntry({path:i.path,isDir:i.type==="dir"},G(i.path)),canPasteInto:O,readOnly:m,provenance:o.provenance,copyable:l===null,onDisk:o.cwd!==null,onUpload:l?d:void 0,onPickUpload:l?y:void 0,revealLabel:r.revealLabel,onReveal:i=>void r.reveal(i),onAddToChat:r.addToChat,onCopyPath:(i,M)=>void r.copyPath(i,M)})]}),o.preview==="inline"&&e.jsx(Yt,{source:o,path:(_==null?void 0:_.path)??null,isNew:(_==null?void 0:_.isNew)??!1,onCreated:()=>{_!==null&&($({path:_.path,isNew:!1}),g(_.path))},onClose:()=>$(null)}),l!==null&&e.jsx(Fn,{changes:l,onOpenTheirs:i=>Y(i),onReturnFocus:T}),e.jsx(fe,{open:r.pendingRecursiveDelete!==null,onOpenChange:i=>!i&&r.cancelRecursiveDelete(),children:e.jsxs(he,{children:[e.jsxs(pe,{children:[e.jsxs(me,{children:["Delete “",(de=r.pendingRecursiveDelete)==null?void 0:de.name,"”?"]}),e.jsx(xe,{children:"This folder isn’t empty. Everything inside is deleted. This can’t be undone."})]}),e.jsxs(ge,{children:[e.jsx(ye,{onClick:r.cancelRecursiveDelete,children:"Cancel"}),e.jsx(ve,{onClick:()=>void r.confirmRecursiveDelete(),className:"bg-destructive hover:bg-destructive/90 dark:bg-destructive/60 text-white",children:"Delete folder"})]})]})})]})}function Mn({type:t,firstInFolder:n,onSubmit:a,onCancel:x}){const p=s.useRef(null),[c,o]=s.useState("");s.useEffect(()=>{var l;(l=p.current)==null||l.focus()},[]);const m=()=>{const l=c.trim();l?a(l):x()},r=e.jsxs("div",{className:"flex items-center gap-1",children:[t==="dir"?e.jsx(be,{className:"size-(--size-icon-sm) flex-shrink-0 text-sky-500"}):e.jsx(Ve,{className:"text-muted-foreground size-(--size-icon-sm) flex-shrink-0"}),e.jsx("input",{ref:p,type:"text",value:c,"aria-label":n!==void 0?`First file in ${n}`:t==="dir"?"New folder name":"New file name",placeholder:t==="dir"?"folder-name":"file-name",onChange:l=>o(l.target.value),onBlur:m,onKeyDown:l=>{l.key==="Enter"?m():l.key==="Escape"&&x()},className:"border-border bg-background focus-ring min-w-0 flex-1 rounded border px-1 py-0 text-sm outline-none"})]});return n===void 0?e.jsx("div",{className:"px-3 py-1",children:r}):e.jsxs("div",{className:"space-y-1 px-3 py-1",children:[e.jsxs("p",{className:"text-muted-foreground flex min-w-0 items-center gap-1 text-xs",children:[e.jsx(be,{className:"size-(--size-icon-xs) flex-shrink-0 text-sky-500"}),e.jsx("span",{className:"truncate",children:n})]}),r,e.jsx("p",{className:"text-muted-foreground text-2xs",children:"Name its first file. The folder appears on save."})]})}function at(){const t=H(x=>x.showHidden),n=H(x=>x.setShowHidden),a=t?"Hide hidden files":"Show hidden files";return e.jsx(W,{variant:"ghost",size:"icon-xs","aria-label":a,title:a,onClick:()=>n(!t),children:t?e.jsx(bt,{className:"text-muted-foreground"}):e.jsx(jt,{className:"text-muted-foreground"})})}function _n({cwd:t}){const n=ne(),{data:a}=ce({queryKey:["file-explorer","workspace",t],queryFn:()=>n.resolveWorkspace(t),staleTime:6e4});return a!=null&&a.branch?e.jsxs("span",{className:"text-muted-foreground bg-muted/50 text-2xs inline-flex min-w-0 items-center gap-1 rounded px-1.5 py-0.5",title:`Workspace ${a.key} on ${a.branch}`,children:[e.jsx(Xe,{className:"size-3 flex-shrink-0"}),e.jsx("span",{className:"truncate",children:a.branch})]}):null}function es(){const t=Te(a=>a.selectedCwd),n=H(a=>a.commands);return t?e.jsxs(e.Fragment,{children:[e.jsx(_n,{cwd:t}),e.jsx(W,{variant:"ghost",size:"icon-xs","aria-label":"New file",title:"New file",onClick:()=>n==null?void 0:n.newFile(),children:e.jsx(et,{className:"text-muted-foreground"})}),e.jsx(W,{variant:"ghost",size:"icon-xs","aria-label":"New folder",title:"New folder",onClick:()=>n==null?void 0:n.newFolder(),children:e.jsx(He,{className:"text-muted-foreground"})}),e.jsx(at,{}),e.jsx(W,{variant:"ghost",size:"icon-xs","aria-label":"Refresh",title:"Refresh",onClick:()=>n==null?void 0:n.refresh(),children:e.jsx(kt,{className:"text-muted-foreground"})})]}):null}function An({roomId:t}){const n=ne(),a=oe(),x=ce(Ue(n,t));s.useEffect(()=>Wt(a,t,()=>{a.invalidateQueries({queryKey:De.repoStatus(t)})}),[a,t]);const p=s.useMemo(()=>{var r;return((r=x.data)==null?void 0:r.kind)==="ok"?wt(x.data.status):[]},[x.data]),c=Et(p),o=Dt(p);if(!o)return null;const m=p.map((r,l)=>`${c[l]}: ${Nt(r)}`);return e.jsxs("span",{"data-slot":"pending-work-badge",title:m.join(`
17
- `),className:"text-muted-foreground bg-muted/50 text-2xs inline-flex min-w-0 items-center gap-1 rounded px-1.5 py-0.5",children:[e.jsx(Xe,{className:"size-3 flex-shrink-0"}),e.jsxs("span",{className:"sr-only",children:["Not merged into the room yet. ",m.join(". "),"."]}),e.jsx("span",{"aria-hidden":"true",className:"truncate",children:o})]})}const Ln={added:"added",modified:"changed",deleted:"deleted",untracked:"new"},zn=new Map([["OPERATOR_ONLY","Only the owner of this DorkOS can keep or discard these."],["ROOM_FILE_NOT_FOUND","One of those changes is gone, so nothing was discarded. The list is refreshed."],["MERGE_IN_FLIGHT","Something else is writing to these files. Nothing changed. Try again in a moment."],["MAIN_CHECKOUT_DIRTY","These files are on another branch. Switch them back to main yourself."],["ROOM_REPO_GIT_UNAVAILABLE","Room files need git, and git isn’t installed on this computer."],["ROOM_HAS_NO_REPO","This room no longer has its own files."],["ROOM_REPOS_DISABLED","Room files are turned off on this install."]]);function $n({roomId:t}){var U,I;const n=ne(),a=oe(),x=ce(Ue(n,t)),[p,c]=s.useState([]),[o,m]=s.useState(!1),[r,l]=s.useState(null),u=Rt({mutationFn:k=>n.repairRoomMain(t,k),onSuccess:()=>{c([]),m(!1),l(null),a.invalidateQueries({queryKey:De.repoStatus(t)})},onError:k=>{m(!1);const h=zn.get(St(k)??"");l(h??"Couldn’t update the files. Try again in a moment."),a.invalidateQueries({queryKey:De.repoStatus(t)})}});if(((U=x.data)==null?void 0:U.kind)==="unavailable")return e.jsx("p",{role:"alert","data-slot":"room-main-warning",className:"border-border/60 text-muted-foreground rounded-lg border px-3 py-2.5 text-xs",children:"Couldn’t check this room’s files. Saves may not work. Try again soon."});const N=((I=x.data)==null?void 0:I.kind)==="ok"?x.data.status.main:void 0;if(N===void 0||!N.dirty)return null;const F=N.branch!=="main",D=p.filter(k=>N.strays.some(h=>h.path===k)),L=o&&D.length>0,C=k=>c(h=>h.includes(k)?h.filter(g=>g!==k):[...h,k]);return e.jsxs("div",{"data-slot":"room-main-warning",className:"border-border/60 bg-muted/40 space-y-3 rounded-lg border px-3 py-2.5 text-sm",children:[e.jsxs("div",{className:"flex gap-2",children:[e.jsx(Tt,{className:"text-muted-foreground mt-0.5 size-(--size-icon-sm) flex-shrink-0"}),e.jsxs("div",{className:"min-w-0 space-y-1",children:[e.jsxs("div",{role:"alert",className:"space-y-1",children:[e.jsx("p",{className:"font-medium",children:"Somebody changed this room’s files outside DorkOS"}),F?e.jsxs(e.Fragment,{children:[e.jsx("p",{className:"text-muted-foreground text-xs",children:`This room’s files are on ${N.branch??"no branch"}, not main.`}),e.jsx("p",{className:"text-muted-foreground text-xs",children:"Saves and agent merges wait until they’re back on main."})]}):e.jsx("p",{className:"text-muted-foreground text-xs",children:"Saves and agent merges wait until you keep or discard these."})]}),F&&e.jsx(nn,{className:"text-xs",children:e.jsx("p",{children:"DorkOS won’t switch the branch for you. There may be work on it."})})]})]}),!F&&e.jsxs(e.Fragment,{children:[e.jsx("ul",{className:"space-y-1.5",children:N.strays.map(k=>e.jsxs("li",{className:"flex items-center gap-2",children:[e.jsx(Ft,{id:`stray-${t}-${k.path}`,checked:D.includes(k.path),onCheckedChange:()=>C(k.path),disabled:u.isPending}),e.jsx("label",{htmlFor:`stray-${t}-${k.path}`,className:"min-w-0 flex-1 cursor-pointer truncate font-mono text-xs",title:k.path,children:k.path}),e.jsx("span",{className:"text-muted-foreground flex-shrink-0 text-xs",children:Ln[k.kind]})]},k.path))}),N.strayCount>N.strays.length&&e.jsxs("p",{className:"text-muted-foreground text-xs",children:["…and ",N.strayCount-N.strays.length," more not shown. “Keep them all” keeps these too."]}),L?e.jsxs("div",{className:"space-y-2",children:[e.jsx("p",{className:"text-xs",children:D.length===1?"Discard this change? It can’t be undone.":`Discard these ${D.length} changes? They can’t be undone.`}),e.jsxs("div",{className:"flex flex-wrap gap-2",children:[e.jsx(W,{type:"button",variant:"ghost",size:"sm",disabled:u.isPending,onClick:()=>m(!1),children:"Cancel"}),e.jsx(W,{type:"button",variant:"destructive",size:"sm",disabled:u.isPending,onClick:()=>u.mutate({action:"discard",paths:[...D]}),children:D.length===1?"Discard change":`Discard ${D.length} changes`})]})]}):e.jsxs("div",{className:"flex flex-wrap gap-2",children:[e.jsx(W,{type:"button",variant:"outline",size:"sm",disabled:u.isPending,onClick:()=>u.mutate({action:"commit"}),children:"Keep them all"}),e.jsx(W,{type:"button",variant:"ghost",size:"sm",disabled:u.isPending||D.length===0,onClick:()=>m(!0),children:D.length===0?"Discard…":`Discard ${D.length}`})]})]}),r!==null&&e.jsx("p",{role:"alert",className:"text-destructive text-xs",children:r})]})}const Ee="pointer-coarse:size-11";function ts({roomId:t,canChange:n}){const a=ne(),x=oe(),p=H(F=>F.showHidden),[c,o]=s.useState(null),m=s.useMemo(()=>Be({transport:a,queryClient:x,roomId:t,canChange:n}),[a,x,t,n]),r=ce(ke(m,Q,p,x)),l=r.isSuccess&&r.data.absent!==!0||r.isError,[u,N]=s.useState(null);return l&&u!==t&&N(t),!l&&u!==t?null:e.jsxs("section",{"aria-label":"Room files",className:"space-y-2",children:[e.jsxs("header",{className:"flex items-center gap-2",children:[e.jsx(Pt,{className:"text-muted-foreground size-(--size-icon-sm) flex-shrink-0"}),e.jsx("h3",{className:"text-muted-foreground text-xs font-medium tracking-wide uppercase",children:"Files"}),e.jsx("div",{className:"min-w-0 flex-1",children:e.jsx(An,{roomId:t})}),n&&e.jsxs(e.Fragment,{children:[e.jsx(W,{variant:"ghost",size:"icon-xs",className:Ee,"aria-label":"New file",title:"New file",disabled:c===null,onClick:()=>c==null?void 0:c.newFile(),children:e.jsx(et,{className:"text-muted-foreground"})}),e.jsx(W,{variant:"ghost",size:"icon-xs",className:Ee,"aria-label":"New folder",title:"New folder",disabled:c===null,onClick:()=>c==null?void 0:c.newFolder(),children:e.jsx(He,{className:"text-muted-foreground"})}),e.jsx(W,{variant:"ghost",size:"icon-xs",className:Ee,"aria-label":"Upload files",title:"Upload files",disabled:(c==null?void 0:c.upload)===void 0,onClick:()=>{var F;return(F=c==null?void 0:c.upload)==null?void 0:F.call(c)},children:e.jsx(an,{className:"text-muted-foreground"})})]}),e.jsx(at,{})]}),e.jsx($n,{roomId:t}),e.jsx("div",{"data-slot":"room-files-body",className:"border-border/60 h-72 overflow-hidden rounded-lg border",children:e.jsx(On,{source:m,onCommands:o})})]})}function ns({roomId:t,attachment:n}){var l;const a=ne(),x=oe(),p=s.useMemo(()=>Be({transport:a,queryClient:x,roomId:t}),[a,x,t]),c=ce(ke(p,Q,!1,x)),[o,m]=s.useState(!1),r=Ot(t);return!c.isSuccess||c.data.absent===!0||((l=r.data)==null?void 0:l.archived)!==!1?null:e.jsxs(e.Fragment,{children:[e.jsx(W,{type:"button",variant:"ghost",size:"icon-xs","aria-label":`Save ${n.name} to the room’s files`,title:"Save to room files",className:"text-muted-foreground hover:text-foreground mt-0.5 pointer-coarse:size-11",onClick:()=>m(!0),children:e.jsx(Mt,{})}),o&&e.jsx(In,{roomId:t,source:p,attachment:n,onClose:()=>m(!1)})]})}function In({roomId:t,source:n,attachment:a,onClose:x}){const p=ne(),c=oe(),[o,m]=s.useState(Q),[r,l]=s.useState(a.name),[u,N]=s.useState(null),[F,D]=s.useState(!1),L=s.useId(),C=ce(ke(n,o,!1,c)),U=s.useMemo(()=>{var k;return nt(((k=C.data)==null?void 0:k.entries)??[]).filter(h=>h.type==="dir")},[C.data]),I=async()=>{var h,g;const k=r.trim();if(k!==""){D(!0),N(null);try{await p.saveAttachmentToRoomFiles(t,{attachmentId:a.id,dir:o,name:k,baseCommit:((h=C.data)==null?void 0:h.commit)??null}),c.invalidateQueries({queryKey:["file-explorer","tree",n.scopeKey]}),J.success(`Saved ${k} to the room’s files`),x()}catch(w){let b;try{b=Gt(w,c,t)}catch{b={status:"refused",reason:Qe(w)??"Couldn’t save. Try again in a moment."}}if(b.status==="exists"){const S=(((g=C.data)==null?void 0:g.entries)??[]).map(K=>K.name);N({reason:`This folder already has a file called “${k}”. Pick another name.`,suggestion:Oe({name:k,isDir:!1,taken:[...S,k]})})}else b.status==="conflict"?(N({reason:"This folder changed while you chose, so nothing was saved. Try again."}),C.refetch()):b.status==="refused"&&N({reason:b.reason})}finally{D(!1)}}};return e.jsx(_t,{open:!0,onOpenChange:k=>!k&&x(),children:e.jsxs(At,{className:"sm:max-w-md",children:[e.jsxs(Lt,{children:[e.jsx(zt,{children:"Save to room files"}),e.jsx($t,{children:"Everyone in the room, and their agents, can find it there."})]}),e.jsxs(It,{className:"space-y-3",children:[e.jsxs("div",{className:"space-y-1",children:[e.jsx("p",{className:"text-muted-foreground text-xs font-medium",children:"Folder"}),e.jsxs("div",{role:"group","aria-label":"Folders",className:"border-border/60 max-h-56 overflow-auto rounded-md border",children:[e.jsx("p",{className:"bg-muted/40 truncate px-3 py-1.5 font-mono text-xs",children:o===Q?"Top folder":`${o}/`}),o!==Q&&e.jsx($e,{label:"Up one folder",icon:e.jsx(sn,{className:"text-muted-foreground size-(--size-icon-sm)"}),onClick:()=>m(G(o))}),C.isPending?e.jsx("div",{className:"flex h-12 items-center justify-center",children:e.jsx(Fe,{size:"sm",className:"text-muted-foreground",label:"Loading folders"})}):U.length===0?e.jsx("p",{className:"text-muted-foreground px-3 py-2 text-xs",children:"No folders in here."}):U.map(k=>e.jsx($e,{label:k.name,icon:e.jsx(be,{className:"size-(--size-icon-sm) text-sky-500"}),chevron:!0,onClick:()=>m(ee(o,le(k.path)))},k.path))]})]}),e.jsxs("div",{className:"space-y-1",children:[e.jsx("label",{htmlFor:L,className:"text-muted-foreground text-xs font-medium",children:"Name"}),e.jsx(Kt,{id:L,value:r,onChange:k=>{l(k.target.value),N(null)},spellCheck:!1,autoComplete:"off"})]}),u!==null&&e.jsxs("div",{role:"alert",className:"text-destructive space-y-1 text-xs",children:[e.jsx("p",{children:u.reason}),u.suggestion!==void 0&&e.jsxs(W,{type:"button",variant:"outline",size:"xs",onClick:()=>{l(u.suggestion),N(null)},children:["Use “",u.suggestion,"”"]})]})]}),e.jsxs(Ht,{className:"gap-2",children:[e.jsx(W,{type:"button",variant:"ghost",onClick:x,children:"Cancel"}),e.jsx(W,{type:"button",disabled:F||r.trim()===""||C.isPending,onClick:()=>void I(),children:F?"Saving…":o===Q?"Save to the top folder":`Save to ${le(o)}`})]})]})})}function $e({label:t,icon:n,chevron:a=!1,onClick:x}){return e.jsxs("button",{type:"button",onClick:x,className:"hover:bg-accent/50 focus-visible:bg-accent flex w-full items-center gap-2 px-3 py-1.5 text-left text-sm outline-none",children:[n,e.jsx("span",{className:"min-w-0 flex-1 truncate",children:t}),a&&e.jsx(Ke,{className:"text-muted-foreground size-3.5"})]})}export{On as FileExplorer,es as FileExplorerActions,Yt as FilePreviewDialog,rn as HIDDEN_ENTRY_NAMES,at as HiddenEntriesToggle,rs as NO_PROVENANCE,Ne as PINNED_ENTRY_NAMES,os as ROOM_FILES_REFRESH_INTERVAL_MS,ts as RoomFilesSection,ns as SaveToRoomFilesButton,Be as createRoomFilesSource,gn as createSessionCwdSource,ie as explorerDirQueryKey,ke as explorerDirQueryOptions,on as isHiddenEntryName,Re as isPinnedEntryName,ln as pinnedFirst,Bt as provenanceLine,Ue as roomRepoStatusQueryOptions,nt as withoutHidden};
@@ -1 +0,0 @@
1
- import{A as p,T as a}from"./TeamComputerEntry-BD89Y5e6.js";import{C,a as n}from"./ComputerResourceView-BlLvMt1I.js";import"./index-CjUfPyOM.js";import"./ComputerViewer-B8SWICbj.js";import"./use-is-below-desktop-BUS7OPGv.js";export{p as AgentComputerPanel,C as ComputerPanelView,n as ComputerPipView,a as TeamComputerEntry};
@@ -1 +0,0 @@
1
- import{I as n,M as h}from"./Marketplace-BWDlXgwH.js";import{M as I,P as U,m as V,u as b,a as C}from"./index-CjUfPyOM.js";import{M as j}from"./MarketplaceSourcesView-BhKzgkiO.js";import{U as v}from"./UnlinkDialog-DTuXHNsi.js";import"./PreviewRefusedNotice-CnqAE9sr.js";import"./shield-x-Dr4BZfo_.js";import"./card-DI7YtQh3.js";import"./empty-state-aNwJA6H8.js";import"./markdown-content-ysBIqFAg.js";import"./use-unclaimed-chats-D7SEUfiO.js";import"./use-bindings-Bu4yLLR5.js";import"./more-details-DHCpYDi7.js";import"./use-dev-links-C0Zc30aj.js";import"./file-bSD5jgk_.js";import"./AgentPicker-DoGucmqI.js";import"./command-DpK0GpDM.js";import"./AgentOptionRow-D-QjHi5k.js";import"./useMutationState-rOg4bnKv.js";import"./file-exclamation-point-BcCIL-rE.js";import"./rotate-ccw-clock-LSKKAcnR.js";import"./path-input-Z2p922fj.js";import"./use-pending-read-BBBAnUYu.js";export{n as InstalledPackagesView,h as Marketplace,I as MarketplaceSidebar,j as MarketplaceSourcesView,U as PackageCard,v as UnlinkDialog,V as marketplaceSearchSchema,b as useMarketplaceParams,C as useMarketplaceStore};