dorkos 0.124.0 → 0.124.1

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 (311) hide show
  1. package/dist/bin/cli.js +935 -551
  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-BH8Ndn3e.js → AboutPage-DHaZvsJE.js} +1 -1
  5. package/dist/client/assets/{ActivityErrorState-K5Mew9EX.js → ActivityErrorState-BP-qFk2S.js} +1 -1
  6. package/dist/client/assets/{ActivityPage-BB20L5HU.js → ActivityPage-Bme3TzdQ.js} +1 -1
  7. package/dist/client/assets/{ActivityRow-C5O7rnmS.js → ActivityRow-BRZyW9MA.js} +1 -1
  8. package/dist/client/assets/{AdapterIcon-Bmybvrzb.js → AdapterIcon-BcfquTja.js} +1 -1
  9. package/dist/client/assets/{AdapterSetupWizard-CkdV7Hhh.js → AdapterSetupWizard-B4I23pBg.js} +1 -1
  10. package/dist/client/assets/{AgentOptionRow-BA2cDa7r.js → AgentOptionRow-Cb34LtmH.js} +1 -1
  11. package/dist/client/assets/{AgentPicker-CsIIPGZJ.js → AgentPicker-ouNRFSDh.js} +1 -1
  12. package/dist/client/assets/{AgentRequestCard-0fOxvaoe.js → AgentRequestCard-B6MHIsxa.js} +2 -2
  13. package/dist/client/assets/{AppearancePage-XOjkkoli.js → AppearancePage-CutehigK.js} +1 -1
  14. package/dist/client/assets/ApplyToOverridesDialog-B-wIUI27.js +1 -0
  15. package/dist/client/assets/{AttentionSignalRow-CjjZobp7.js → AttentionSignalRow-B1aMjgX_.js} +1 -1
  16. package/dist/client/assets/{BaseTanStackRouterDevtoolsPanel-B-iktbLX-9TVHyRPJ.js → BaseTanStackRouterDevtoolsPanel-B-iktbLX-CdWF4WLz.js} +1 -1
  17. package/dist/client/assets/{BindingDialog-DLoAQauL.js → BindingDialog-BAdueON5.js} +1 -1
  18. package/dist/client/assets/{BlintzCanvas-CYHsXAcY.js → BlintzCanvas-b30dG4gx.js} +3 -3
  19. package/dist/client/assets/{CanvasCsvContent--Gr7Fe_U.js → CanvasCsvContent-DGHgSikG.js} +1 -1
  20. package/dist/client/assets/{CanvasFileContent-estXyAbr.js → CanvasFileContent-D1bFaUeh.js} +2 -2
  21. package/dist/client/assets/{CanvasModel3dContent-CkOo930M.js → CanvasModel3dContent-dST7g1v2.js} +2 -2
  22. package/dist/client/assets/{ChatAppsOff-D4L1zJVN.js → ChatAppsOff-DiObvmJS.js} +1 -1
  23. package/dist/client/assets/{CodeMirrorDiff-DY_6ju-z.js → CodeMirrorDiff-BncI1OY1.js} +1 -1
  24. package/dist/client/assets/{CodeMirrorEditor-BUoDBsBv.js → CodeMirrorEditor-DV6psv19.js} +1 -1
  25. package/dist/client/assets/{CommitmentList-wDkcVP9c.js → CommitmentList-Dx_Ek_Gl.js} +1 -1
  26. package/dist/client/assets/{CommitmentsPage-CzSM6b8R.js → CommitmentsPage-Bca8NMUa.js} +1 -1
  27. package/dist/client/assets/{ComputerResourceView-cERD9H2L.js → ComputerResourceView-DNVNFTdn.js} +1 -1
  28. package/dist/client/assets/{ComputerViewer-rMcfbk2_.js → ComputerViewer-D8SxJdMm.js} +1 -1
  29. package/dist/client/assets/{ConnectionAccessLists-f7QeQbQo.js → ConnectionAccessLists-Bhj1YT15.js} +1 -1
  30. package/dist/client/assets/{ConnectionsPage-BmjtA6pw.js → ConnectionsPage-B20JZxoK.js} +1 -1
  31. package/dist/client/assets/{ConventionPage-CH-ah6nI.js → ConventionPage-De645wxU.js} +1 -1
  32. package/dist/client/assets/{ExtensionPageRoute-CJIxa6ST.js → ExtensionPageRoute-nTeiOBRQ.js} +1 -1
  33. package/dist/client/assets/{FloatingTanStackRouterDevtools-CqogiFob-BP7EJ2JL.js → FloatingTanStackRouterDevtools-CqogiFob-DM79UITv.js} +1 -1
  34. package/dist/client/assets/HandlePage-B08V-om7.js +1 -0
  35. package/dist/client/assets/{HeartbeatPage-BUsf-qrU.js → HeartbeatPage-CBoUxz6t.js} +1 -1
  36. package/dist/client/assets/{KeyEntry-C2kWdN8q.js → KeyEntry-Cug8ocpX.js} +1 -1
  37. package/dist/client/assets/{LexicalField-CR8ulsI_.js → LexicalField-Bv_ogmAq.js} +1 -1
  38. package/dist/client/assets/{ManagesPage-DTtsIOGi.js → ManagesPage-DfJBQKK3.js} +1 -1
  39. package/dist/client/assets/{Marketplace-iaV5XAzv.js → Marketplace-swCVUbdY.js} +2 -2
  40. package/dist/client/assets/{MarketplaceSourcesView-6tgzUfFj.js → MarketplaceSourcesView-CDZDChpV.js} +1 -1
  41. package/dist/client/assets/{McpAppFrame-C7eYYdI9.js → McpAppFrame-BM9cNPPd.js} +1 -1
  42. package/dist/client/assets/{McpSigninBody-BDyGbJ7I.js → McpSigninBody-DKyUKrEE.js} +1 -1
  43. package/dist/client/assets/{Model3dViewer-BujDNuVS.js → Model3dViewer-rXSL5y2P.js} +1 -1
  44. package/dist/client/assets/NamePage-JwMDK1JD.js +1 -0
  45. package/dist/client/assets/{NewDirectMessageMenu-D4e-z2Jt.js → NewDirectMessageMenu-GCEMS5oV.js} +1 -1
  46. package/dist/client/assets/{NotificationsPage-CkDeTaJp.js → NotificationsPage-DSWsOVLa.js} +1 -1
  47. package/dist/client/assets/{OpenMeshSwitch-CtbOt3r5.js → OpenMeshSwitch-BTuctDj4.js} +1 -1
  48. package/dist/client/assets/{OperatorIdentityForm-Vr4qZnmM.js → OperatorIdentityForm-ODDMd2YN.js} +1 -1
  49. package/dist/client/assets/PermissionHistory-41a58Se7.js +1 -0
  50. package/dist/client/assets/{PermissionsPage-f4QaX8oM.js → PermissionsPage-DefmymZ6.js} +1 -1
  51. package/dist/client/assets/{PersonalityPopover-BkZruwF-.js → PersonalityPopover-7zPVBI1I.js} +1 -1
  52. package/dist/client/assets/PhotoPage-DlOVhkW9.js +1 -0
  53. package/dist/client/assets/{PreviewRefusedNotice-BXC2K0tx.js → PreviewRefusedNotice-CwGlBJ7U.js} +1 -1
  54. package/dist/client/assets/{ProfileFields-BebX5oiv.js → ProfileFields-DVMkpJSb.js} +1 -1
  55. package/dist/client/assets/{ProfilePanelContainer-DZoL65zQ.js → ProfilePanelContainer-RrhoPD3T.js} +1 -1
  56. package/dist/client/assets/{ProfileRolePicker-D9H7wsuT.js → ProfileRolePicker-CXRVBCAu.js} +1 -1
  57. package/dist/client/assets/{PromptSuggestionChips-B5fDmc-g.js → PromptSuggestionChips-bBroJdTi.js} +1 -1
  58. package/dist/client/assets/{ReportsToPopover-uVYhSqj7.js → ReportsToPopover-CfPatsWM.js} +1 -1
  59. package/dist/client/assets/{RoomSurface-Bg5WV4Ep.js → RoomSurface-CdgCdV6h.js} +11 -11
  60. package/dist/client/assets/{RoomsPage-yflYFulU.js → RoomsPage-C3dDp1Mb.js} +1 -1
  61. package/dist/client/assets/{RunsOnPopover-DtGrX1Vq.js → RunsOnPopover-BcKjfQi-.js} +1 -1
  62. package/dist/client/assets/{RuntimeConnectFlow-DjReuQ-T.js → RuntimeConnectFlow-DCIRnvOH.js} +1 -1
  63. package/dist/client/assets/{RuntimeSetupDialog-Cr4GRi8c.js → RuntimeSetupDialog-Bg-0b-LC.js} +1 -1
  64. package/dist/client/assets/SeenDevices-nMsGUQTv.js +19 -0
  65. package/dist/client/assets/{SessionsPage-BWu-en78.js → SessionsPage-Cqfx4FGW.js} +1 -1
  66. package/dist/client/assets/SettingsDialog-C8r2igJ_.js +12 -0
  67. package/dist/client/assets/{SkillsPage-BdUb9SZy.js → SkillsPage-BleHQavF.js} +1 -1
  68. package/dist/client/assets/{TaskDialogWrapper-qYJPEoSR.js → TaskDialogWrapper-BhTEvf-u.js} +1 -1
  69. package/dist/client/assets/{TasksEmptyState-Bgcg9vxF.js → TasksEmptyState-Bprx1k8M.js} +2 -2
  70. package/dist/client/assets/{TasksPage-Ch5W2WQS.js → TasksPage-Dub39yEJ.js} +1 -1
  71. package/dist/client/assets/{TeamComputerEntry-CPwSIMRw.js → TeamComputerEntry-CJ-NG0u5.js} +1 -1
  72. package/dist/client/assets/ToolsPage-IsD6M-ZW.js +2 -0
  73. package/dist/client/assets/{TopologyGraph-I4_mkMHM.js → TopologyGraph-CwyasvFI.js} +14 -14
  74. package/dist/client/assets/{TourHost-BPaSwh9I.js → TourHost-BYfztuPb.js} +1 -1
  75. package/dist/client/assets/{UnlinkDialog-BUWZUu5P.js → UnlinkDialog-BKhgxVdF.js} +1 -1
  76. package/dist/client/assets/{WidgetErrorCard-cS8yMCxU.js → WidgetErrorCard-1NyzIJBj.js} +6 -6
  77. package/dist/client/assets/_shell-Ct2Bz7D0.js +80 -0
  78. package/dist/client/assets/{_shell._home-DCA5k-jb.js → _shell._home-xWj7wO5z.js} +1 -1
  79. package/dist/client/assets/{_shell._home.activity-BX4nFLna.js → _shell._home.activity-BqcLoaB1.js} +1 -1
  80. package/dist/client/assets/{_shell._home.index-C8t8cw72.js → _shell._home.index-D4sQsKKk.js} +1 -1
  81. package/dist/client/assets/{_shell._home.tasks-BgUeEvhK.js → _shell._home.tasks--UhQB6h3.js} +1 -1
  82. package/dist/client/assets/{_shell._home.workspaces-BPBdnkRt.js → _shell._home.workspaces-BPFD8Of2.js} +1 -1
  83. package/dist/client/assets/{_shell.channels-CX4kki7G.js → _shell.channels-CnFdvRzc.js} +4 -4
  84. package/dist/client/assets/{_shell.connections-0vP7g7E4.js → _shell.connections-Ik01wS5M.js} +1 -1
  85. package/dist/client/assets/{_shell.feedback-requests-TsuaO4eR.js → _shell.feedback-requests-Czu42kzo.js} +1 -1
  86. package/dist/client/assets/_shell.marketplace-Cezv-i16.js +1 -0
  87. package/dist/client/assets/_shell.marketplace_.sources-BTENmr4W.js +1 -0
  88. package/dist/client/assets/_shell.session-BjevHF_O.js +63 -0
  89. package/dist/client/assets/{_shell.team-Bm6cOBhR.js → _shell.team-UfaJqohh.js} +3 -3
  90. package/dist/client/assets/_shell.x._extensionId-0OO_Xr72.js +1 -0
  91. package/dist/client/assets/_shell.x._extensionId_._-0OO_Xr72.js +1 -0
  92. package/dist/client/assets/{abnfDiagram-WEYOIA3C-CrvoN15x.js → abnfDiagram-WEYOIA3C-oxkfGyl6.js} +1 -1
  93. package/dist/client/assets/{access-copy-B3yNZ7Gz.js → access-copy-Dggxx2cX.js} +1 -1
  94. package/dist/client/assets/{arc-CuT6QA_y.js → arc-CqQdP0Qe.js} +1 -1
  95. package/dist/client/assets/{architectureDiagram-ZHVYKT53-CPXCZ9H4.js → architectureDiagram-ZHVYKT53-89xM7zJD.js} +1 -1
  96. package/dist/client/assets/{banner-DRumuw3F.js → banner-DqJ2pM0Y.js} +1 -1
  97. package/dist/client/assets/{blockDiagram-RJAE7QA3-CM0rka9p.js → blockDiagram-RJAE7QA3-CcxwDmZC.js} +1 -1
  98. package/dist/client/assets/{c4Diagram-XDPPPE54-D4j2cXRy.js → c4Diagram-XDPPPE54-DCIhIyXa.js} +1 -1
  99. package/dist/client/assets/{card-B3CtfC3R.js → card-DT-vFAns.js} +1 -1
  100. package/dist/client/assets/channel-Ngk70nQZ.js +1 -0
  101. package/dist/client/assets/{chunk-2E7WHVMD-KGyqhVpO.js → chunk-2E7WHVMD-BfWEXcCj.js} +1 -1
  102. package/dist/client/assets/{chunk-2Q5K7J3B-Dl0BHoqK.js → chunk-2Q5K7J3B-KLXLZXlR.js} +1 -1
  103. package/dist/client/assets/{chunk-4EMNKR2T-Da7vH6Kv.js → chunk-4EMNKR2T-CL5Gttmj.js} +1 -1
  104. package/dist/client/assets/{chunk-55XCU76K-DgBUEROO.js → chunk-55XCU76K-cfAl84Mv.js} +1 -1
  105. package/dist/client/assets/{chunk-5VM5RSS4-BQ4mn-_I.js → chunk-5VM5RSS4-BqUyGgoH.js} +1 -1
  106. package/dist/client/assets/{chunk-JWPE2WC7-8LPR3mXf.js → chunk-JWPE2WC7-BWr2ST9i.js} +1 -1
  107. package/dist/client/assets/{chunk-VQ5W62QI-BkIVXi4W.js → chunk-VQ5W62QI-V5zYx50O.js} +1 -1
  108. package/dist/client/assets/{chunk-XXDRQBXY-DQXJx06h.js → chunk-XXDRQBXY-gnvheN_J.js} +1 -1
  109. package/dist/client/assets/{chunk-ZCHMQSOR-DzCE7qlD.js → chunk-ZCHMQSOR-ClGxxZvV.js} +2 -2
  110. package/dist/client/assets/{classDiagram-v2-4MYWR3UA-C_cZra7c.js → classDiagram-v2-4MYWR3UA-DvmHzDb5.js} +1 -1
  111. package/dist/client/assets/{command-CDKbyppr.js → command-CNx4L11m.js} +1 -1
  112. package/dist/client/assets/{cose-bilkent-JH36ORCC-DlXHdGwT.js → cose-bilkent-JH36ORCC-Df8nXBRj.js} +1 -1
  113. package/dist/client/assets/{cpu-B7xLO7jn.js → cpu-D8KJEkdh.js} +1 -1
  114. package/dist/client/assets/{cynefin-EF2NZ3EQ-HhP4ArLc.js → cynefin-EF2NZ3EQ-CAn6ufHs.js} +1 -1
  115. package/dist/client/assets/{cynefinDiagram-WF24UDRP-D4GgWnZV.js → cynefinDiagram-WF24UDRP-Cep_NrRw.js} +1 -1
  116. package/dist/client/assets/{dagre-NK4GIZVX-SZ_OI2Zi.js → dagre-NK4GIZVX-sWD3z9wf.js} +1 -1
  117. package/dist/client/assets/{diagram-CBK3MWTC-BN-_Ja5m.js → diagram-CBK3MWTC-CUpaBATr.js} +1 -1
  118. package/dist/client/assets/{diagram-I5XIIV2D-t7AK6xnL.js → diagram-I5XIIV2D-BejWB2ry.js} +1 -1
  119. package/dist/client/assets/{diagram-ODIL2UCW-C1V7szSc.js → diagram-ODIL2UCW-BGKJfNk9.js} +1 -1
  120. package/dist/client/assets/{diagram-PFBEJUXE-DPtraQ2g.js → diagram-PFBEJUXE-V0dP8H8k.js} +1 -1
  121. package/dist/client/assets/{diagram-RJA3I4VV-D2XNRB2b.js → diagram-RJA3I4VV-Bf5dVsFX.js} +1 -1
  122. package/dist/client/assets/{diagram-TYUNFSNR-BieaRy38.js → diagram-TYUNFSNR-CLrMSqb4.js} +1 -1
  123. package/dist/client/assets/{ebnfDiagram-V4P3TTPT-Bwki86UY.js → ebnfDiagram-V4P3TTPT-BGG4CWA0.js} +1 -1
  124. package/dist/client/assets/{elk-QONTBCTQ-WEXSAyHB.js → elk-QONTBCTQ-bf9D6f0w.js} +1 -1
  125. package/dist/client/assets/{empty-state-J-UJ0BUU.js → empty-state-CDoXnrKn.js} +1 -1
  126. package/dist/client/assets/{erDiagram-KYQIGQAA-DIKASnoc.js → erDiagram-KYQIGQAA-fEUv-33P.js} +1 -1
  127. package/dist/client/assets/{execution-config-ILQiJAmy.js → execution-config-Ca9MDOtV.js} +1 -1
  128. package/dist/client/assets/{file-D40js1Zx.js → file-CiyVL55_.js} +1 -1
  129. package/dist/client/assets/{file-exclamation-point-Dg3ZpiAe.js → file-exclamation-point-DaFRIKco.js} +1 -1
  130. package/dist/client/assets/{file-text-DgdvRfMk.js → file-text-DsnD-A8g.js} +1 -1
  131. package/dist/client/assets/{find-latest-widget-fence-D4kBWC_1.js → find-latest-widget-fence-CNsnCgbB.js} +1 -1
  132. package/dist/client/assets/{flowDiagram-IUGLLWBU-CoavNw0M.js → flowDiagram-IUGLLWBU-CRbeSDod.js} +1 -1
  133. package/dist/client/assets/{form-DlPwEgQH.js → form-Cru78aT-.js} +1 -1
  134. package/dist/client/assets/{format-cron-BrK8RzgT.js → format-cron-9K38-tn1.js} +1 -1
  135. package/dist/client/assets/{ganttDiagram-R7GPNTJY-DccKAz7f.js → ganttDiagram-R7GPNTJY-Mkk7zgs_.js} +1 -1
  136. package/dist/client/assets/{git-branch-BpxhecMq.js → git-branch-CONwEYiR.js} +1 -1
  137. package/dist/client/assets/{gitGraphDiagram-PDYL7XHY-DEbo_dgQ.js → gitGraphDiagram-PDYL7XHY-Drre0vyA.js} +1 -1
  138. package/dist/client/assets/{graph-DROgI3M3.js → graph-BJlnKWgo.js} +1 -1
  139. package/dist/client/assets/{heart-c7u4Ezxt.js → heart-CqwUlIUG.js} +1 -1
  140. package/dist/client/assets/{highlighted-body-KPVGNVTW-CrATNdTR.js → highlighted-body-KPVGNVTW-e4LXC_pS.js} +1 -1
  141. package/dist/client/assets/{image-lightbox-DE_fHkw-.js → image-lightbox-DHDtzoja.js} +1 -1
  142. package/dist/client/assets/{image-off-BExgZjfM.js → image-off-DZuLkaRJ.js} +1 -1
  143. package/dist/client/assets/{index-D0eJtRlK.js → index-1yEXEZiH.js} +1 -1
  144. package/dist/client/assets/{index-Be0OJLWK.js → index-A41zxoWk.js} +1 -1
  145. package/dist/client/assets/{index-DeRDq7bD.js → index-B25gvCK_.js} +1 -1
  146. package/dist/client/assets/index-B9bZYNKR.js +1 -0
  147. package/dist/client/assets/{index-DaZ1I8s-.js → index-BBmkfbXd.js} +1 -1
  148. package/dist/client/assets/{index-DNGNMW3c.js → index-BDD2EyoW.js} +1 -1
  149. package/dist/client/assets/{index-Ccf1XBTs.js → index-BFNy-Yp3.js} +1 -1
  150. package/dist/client/assets/{index-DksjixUS.js → index-BIB-maE5.js} +1 -1
  151. package/dist/client/assets/{index-CbHCZsbE.js → index-BKp2B9JS.js} +1 -1
  152. package/dist/client/assets/{index-DCJQGDZk.js → index-BLP5O7X9.js} +1 -1
  153. package/dist/client/assets/{index-DhHobJd3.js → index-BTjZIgFn.js} +1 -1
  154. package/dist/client/assets/{index-BVqSmajJ.js → index-BV2Ezdxv.js} +1 -1
  155. package/dist/client/assets/{index-C7B3eSOP.js → index-B_0LYi32.js} +1 -1
  156. package/dist/client/assets/{index-DDgOoXP1.js → index-Bd7vUYhr.js} +1 -1
  157. package/dist/client/assets/{index-BlyoyIck.js → index-Bo7x9IkO.js} +1 -1
  158. package/dist/client/assets/{index-D150FXCC.js → index-BtDxwJsM.js} +1 -1
  159. package/dist/client/assets/{index-DswGXheF.js → index-By58MgcZ.js} +1 -1
  160. package/dist/client/assets/index-C3cvP8Fo.js +1033 -0
  161. package/dist/client/assets/{index-C5or4L_3.js → index-CVuEUzi5.js} +1 -1
  162. package/dist/client/assets/{index-BkoMsjtM.js → index-CoWJD3Jg.js} +2 -2
  163. package/dist/client/assets/{index-CqPRAM_6.js → index-CyVH876g.js} +1 -1
  164. package/dist/client/assets/{index-BGqvci3k.js → index-D67Kfy-M.js} +1 -1
  165. package/dist/client/assets/{index-D3YeRrne.js → index-DAlpmAIA.js} +1 -1
  166. package/dist/client/assets/{index-BEkYBuOq.js → index-DDNwNOHF.js} +1 -1
  167. package/dist/client/assets/{index-CD8aw6Jb.js → index-DL8ISRMH.js} +1 -1
  168. package/dist/client/assets/{index-AzyLwYS_.js → index-DabU6r9W.js} +3 -3
  169. package/dist/client/assets/{index-CT_pFeX_.js → index-DdJBZE0H.js} +1 -1
  170. package/dist/client/assets/{index-B3eeEDWj.js → index-DijWcSDZ.js} +1 -1
  171. package/dist/client/assets/index-DyRGZyur.css +1 -0
  172. package/dist/client/assets/{index-DINk1YfD.js → index-DzwZJuO1.js} +1 -1
  173. package/dist/client/assets/{index-CZmqtJWZ.js → index-HR8BYVRQ.js} +1 -1
  174. package/dist/client/assets/{index-J3Hh1MnL.js → index-LEcodwyW.js} +1 -1
  175. package/dist/client/assets/index-UPF8suf2.js +1 -0
  176. package/dist/client/assets/{index-DT7pv2iW.js → index-Vz7VUm9l.js} +1 -1
  177. package/dist/client/assets/index-YW-v746p.js +1 -0
  178. package/dist/client/assets/{index-2wezsLA_.js → index-cI2u8WZS.js} +1 -1
  179. package/dist/client/assets/{index-InEBtYxw.js → index-iTQUa_b2.js} +6 -6
  180. package/dist/client/assets/{index-CYy1cjtq.js → index-mZqojApH.js} +1 -1
  181. package/dist/client/assets/{index-dyAahqKe.js → index-pVFjKNjX.js} +1 -1
  182. package/dist/client/assets/{index-DxiRRZRo.js → index-skAhJyIF.js} +1 -1
  183. package/dist/client/assets/{index-BizvylBV.js → index-vJy88bwb.js} +1 -1
  184. package/dist/client/assets/index-wY5OcS4a.js +43 -0
  185. package/dist/client/assets/{index-mwf7ZNk2.js → index-x1yAu9zJ.js} +1 -1
  186. package/dist/client/assets/{index-F-vqXYqa.js → index-xAgihCJ7.js} +1 -1
  187. package/dist/client/assets/{index.esm-BFJ9SG0n.js → index.esm-BUPoRUaG.js} +1 -1
  188. package/dist/client/assets/{infoDiagram-MVDRKAX5-VL8q5pKx.js → infoDiagram-MVDRKAX5-B_Wyzufh.js} +1 -1
  189. package/dist/client/assets/{inline-code-BE9ckzPs.js → inline-code-BIzGDx6z.js} +1 -1
  190. package/dist/client/assets/{ishikawaDiagram-HPEHV2GE-BLKkPYF-.js → ishikawaDiagram-HPEHV2GE-BDk2-6Pd.js} +1 -1
  191. package/dist/client/assets/{journeyDiagram-BOSHW7O7-CSYpRobu.js → journeyDiagram-BOSHW7O7-7qf9KWEQ.js} +1 -1
  192. package/dist/client/assets/{kanban-definition-FNSA4HC5-HilAqtZo.js → kanban-definition-FNSA4HC5-CFYDQmXn.js} +1 -1
  193. package/dist/client/assets/{layers-Cm7coqdo.js → layers-C9tVVcXg.js} +1 -1
  194. package/dist/client/assets/{lightbulb-DqdWS75d.js → lightbulb-f4jtsAh0.js} +1 -1
  195. package/dist/client/assets/{link-2-CDJapTSa.js → link-2-ZNlK1BG1.js} +1 -1
  196. package/dist/client/assets/{list-runtime-types-CP82p1u4.js → list-runtime-types-CqO-QFYD.js} +1 -1
  197. package/dist/client/assets/{markdown-content-m_qereFc.js → markdown-content-DaEVxezf.js} +1 -1
  198. package/dist/client/assets/{mention-pill-DV5HIG5Q.js → mention-pill-BiCPflY-.js} +1 -1
  199. package/dist/client/assets/{mermaid.core-zxW6MBr-.js → mermaid.core-SX8SzrsU.js} +4 -4
  200. package/dist/client/assets/{message-square-off-YVtpbaJ0.js → message-square-off-_qbedNGF.js} +1 -1
  201. package/dist/client/assets/{mindmap-definition-6OY57UG3-IAYemvOg.js → mindmap-definition-6OY57UG3-BloJIArH.js} +1 -1
  202. package/dist/client/assets/{more-details-ReA2ZFBn.js → more-details-CdJT0Ehl.js} +1 -1
  203. package/dist/client/assets/{owner-notice-M4hn_1ep.js → owner-notice-BDafFD_I.js} +1 -1
  204. package/dist/client/assets/{package-CUuTl39E.js → package-Cb7lEm7t.js} +1 -1
  205. package/dist/client/assets/{page-container-BnmNikNZ.js → page-container-DsRgIMAL.js} +1 -1
  206. package/dist/client/assets/{paperclip-C6fYq5Zf.js → paperclip-DNu1VtoX.js} +1 -1
  207. package/dist/client/assets/{path-input-DHn9-XaE.js → path-input-D3O71b-X.js} +1 -1
  208. package/dist/client/assets/{pegDiagram-ECIUJNBX-CojaUwe7.js → pegDiagram-ECIUJNBX-Di48kPNu.js} +1 -1
  209. package/dist/client/assets/{pieDiagram-GNMPY74T-CjP3pw6V.js → pieDiagram-GNMPY74T-DY8B_SPD.js} +1 -1
  210. package/dist/client/assets/{plug-DHQcxt7N.js → plug-IIS_cL9-.js} +1 -1
  211. package/dist/client/assets/{primer-trigger-BmV5wjek.js → primer-trigger-DurKYe8C.js} +2 -2
  212. package/dist/client/assets/{profile-errors-BSCuj3rT.js → profile-errors-BdhZfdvZ.js} +1 -1
  213. package/dist/client/assets/{progress-4FQQfnS6.js → progress-g5kkqvlR.js} +1 -1
  214. package/dist/client/assets/{quadrantDiagram-D57K4MC3-OP0Z8zcR.js → quadrantDiagram-D57K4MC3-Depv_dON.js} +1 -1
  215. package/dist/client/assets/{query-error-state-BkUdxenP.js → query-error-state-PuLGD7Jp.js} +1 -1
  216. package/dist/client/assets/{radio-ta5Bw763.js → radio-QOLZSBz1.js} +1 -1
  217. package/dist/client/assets/{railroadDiagram-Y72NRBL7-CT3NCb9b.js → railroadDiagram-Y72NRBL7-BfD2AiZM.js} +1 -1
  218. package/dist/client/assets/registry-Ck8p6n1T.js +1 -0
  219. package/dist/client/assets/{relay-trace-schemas-DwUuyxao.js → relay-trace-schemas-DF_DfZ7s.js} +1 -1
  220. package/dist/client/assets/{requirementDiagram-EQYSW5RA-tde4lYGp.js → requirementDiagram-EQYSW5RA-B1iTjrkD.js} +1 -1
  221. package/dist/client/assets/{room-files-source-CZWhaaOy.js → room-files-source-g1th8mWs.js} +2 -2
  222. package/dist/client/assets/{rotate-ccw-clock-RfbbgUa4.js → rotate-ccw-clock-BGwYMaGL.js} +1 -1
  223. package/dist/client/assets/{rotate-cw-B3rB_YSw.js → rotate-cw-B4Y0q4GY.js} +1 -1
  224. package/dist/client/assets/{sankeyDiagram-SY24JHO5-sdCzIA7-.js → sankeyDiagram-SY24JHO5-D5TzVJrQ.js} +1 -1
  225. package/dist/client/assets/{scroll-area-B4WB7Q40.js → scroll-area-BvScZKSa.js} +1 -1
  226. package/dist/client/assets/{search-x-DCUmWW2_.js → search-x-CqN5twBj.js} +1 -1
  227. package/dist/client/assets/{sequenceDiagram-BLEHNHQU-DvzTJcKu.js → sequenceDiagram-BLEHNHQU-BhUahaNf.js} +1 -1
  228. package/dist/client/assets/{shield-x-CANziVLc.js → shield-x-DHJrwtKp.js} +1 -1
  229. package/dist/client/assets/signed-in-BmywDpR5.js +1 -0
  230. package/dist/client/assets/{sizeCapture-INFHLROL-DuDA7TKE.js → sizeCapture-INFHLROL-D2Vi1Kq9.js} +1 -1
  231. package/dist/client/assets/{soul-file-Co_8f1qw.js → soul-file-BMpVFN7U.js} +1 -1
  232. package/dist/client/assets/{stateDiagram-v2-A6IESKWZ-BJPX5JTC.js → stateDiagram-v2-A6IESKWZ-b9gSbZnF.js} +1 -1
  233. package/dist/client/assets/{swimlanes-B3ENRKFQ-CiLSffGv.js → swimlanes-B3ENRKFQ-i47jxLY6.js} +1 -1
  234. package/dist/client/assets/swimlanesDiagram-AYQRV4AK-CA9gW19w.js +8 -0
  235. package/dist/client/assets/{table-BSAvOYPp.js → table-CN2HCi4p.js} +1 -1
  236. package/dist/client/assets/{terminal-6CdY-T1V.js → terminal-BORQniao.js} +1 -1
  237. package/dist/client/assets/{timeline-definition-JXYKGLGB-5oq8sl82.js → timeline-definition-JXYKGLGB-eY5gj0js.js} +1 -1
  238. package/dist/client/assets/{trust-posture-D-Yjm6ot.js → trust-posture-Bcyy5Fub.js} +1 -1
  239. package/dist/client/assets/{unplug-Bq_1WdV7.js → unplug-lkD35Rwp.js} +1 -1
  240. package/dist/client/assets/{unverified-catalog-notice-CEzu54YH.js → unverified-catalog-notice-DiCIrrhU.js} +1 -1
  241. package/dist/client/assets/{use-adapter-catalog-Tn3ZbPAj.js → use-adapter-catalog-BrqVd-47.js} +1 -1
  242. package/dist/client/assets/{use-bindings-Bz9YRgO7.js → use-bindings-CU2RSXOy.js} +1 -1
  243. package/dist/client/assets/{use-composer-prefs-D9oKJSQN.js → use-composer-prefs-Dy2oTM8Y.js} +1 -1
  244. package/dist/client/assets/{use-connector-management-CLYFraXN.js → use-connector-management-5oRqzydY.js} +1 -1
  245. package/dist/client/assets/{use-deep-link-scroll-DkS713kG.js → use-deep-link-scroll-Bg5nW8qq.js} +1 -1
  246. package/dist/client/assets/{use-delete-binding-CukKpHBK.js → use-delete-binding-qeyRkvR1.js} +1 -1
  247. package/dist/client/assets/{use-dev-links-DQ32IcGe.js → use-dev-links-FY4J_PjA.js} +1 -1
  248. package/dist/client/assets/{use-external-adapter-catalog-D-FO_XW6.js → use-external-adapter-catalog-HiWFZZrW.js} +1 -1
  249. package/dist/client/assets/{use-full-activity-feed-BNxcyb1j.js → use-full-activity-feed-K1uk9Wya.js} +1 -1
  250. package/dist/client/assets/use-is-below-desktop-Cu_jKnft.js +1 -0
  251. package/dist/client/assets/use-is-hub-BX7ypNRJ.js +1 -0
  252. package/dist/client/assets/{use-jump-back-in-Bibj5tVk.js → use-jump-back-in-BjZ8EswV.js} +1 -1
  253. package/dist/client/assets/{use-local-browser-xg7WXAVK.js → use-local-browser-CTFiF0wf.js} +1 -1
  254. package/dist/client/assets/{use-mesh-topology-BgCSFw8s.js → use-mesh-topology-CafidaIH.js} +1 -1
  255. package/dist/client/assets/{use-mounted-ref-qRbdZfOU.js → use-mounted-ref-B38uSLCx.js} +1 -1
  256. package/dist/client/assets/{use-notification-prefs-B-4kZR7I.js → use-notification-prefs-m9XSNB6W.js} +1 -1
  257. package/dist/client/assets/{use-panel-tab-placements-CCq-mZlY.js → use-panel-tab-placements-D9n6rNJ1.js} +1 -1
  258. package/dist/client/assets/use-pending-read-BoV-UI1E.js +1 -0
  259. package/dist/client/assets/{use-personality-commit-DwSisUfF.js → use-personality-commit-ChLQfLrK.js} +1 -1
  260. package/dist/client/assets/{use-promo-activation-Botoso6l.js → use-promo-activation-DbJDgp4_.js} +1 -1
  261. package/dist/client/assets/{use-promo-dismissals-RJXp-r_J.js → use-promo-dismissals-Csw0j0N0.js} +1 -1
  262. package/dist/client/assets/{use-pulse-freshness-B3390hGg.js → use-pulse-freshness-BIZ7daHW.js} +1 -1
  263. package/dist/client/assets/{use-relay-config-BV0xcLwS.js → use-relay-config-hUB3lVFv.js} +1 -1
  264. package/dist/client/assets/{use-room-follow-claim-Du4hKHIJ.js → use-room-follow-claim-BpKzhniV.js} +1 -1
  265. package/dist/client/assets/{use-roving-tab-list-g2hO6Ruz.js → use-roving-tab-list-BtM0bZL7.js} +1 -1
  266. package/dist/client/assets/{use-session-canvas-i30oMO_Q.js → use-session-canvas-DRrkNRcL.js} +3 -3
  267. package/dist/client/assets/use-session-diagnostics-BTNgouum.js +16 -0
  268. package/dist/client/assets/{use-unclaimed-chats-B92om889.js → use-unclaimed-chats-BbMZtNG9.js} +1 -1
  269. package/dist/client/assets/use-update-config-CkWwKNkY.js +1 -0
  270. package/dist/client/assets/{useMutationState-DdOGdpjP.js → useMutationState-CVpvw27W.js} +1 -1
  271. package/dist/client/assets/{usecaseDiagram-WPOLBNNX-Di5pJvcw.js → usecaseDiagram-WPOLBNNX-CHcpeLg4.js} +1 -1
  272. package/dist/client/assets/{vennDiagram-Q3Y3IDCW-K7KAf26T.js → vennDiagram-Q3Y3IDCW-gQbZL_A6.js} +1 -1
  273. package/dist/client/assets/{wardleyDiagram-IVAIDKWA-DVTaxQt9.js → wardleyDiagram-IVAIDKWA-BFH_WHzZ.js} +1 -1
  274. package/dist/client/assets/{xychartDiagram-4URNHDU4-x-lSJm_B.js → xychartDiagram-4URNHDU4-B0QpyqeZ.js} +1 -1
  275. package/dist/client/index.html +2 -2
  276. package/dist/drizzle/20261019185620_dor3037_wifi_holds.sql +8 -0
  277. package/dist/drizzle/meta/20261019185620_snapshot.json +14079 -0
  278. package/dist/drizzle/meta/_journal.json +7 -0
  279. package/dist/server/extension-child.cjs +18 -2
  280. package/dist/server/index.js +55523 -26605
  281. package/dist/server/index.js.map +2 -2
  282. package/package.json +6 -6
  283. package/dist/client/assets/ApplyToOverridesDialog-CoO6V1G4.js +0 -1
  284. package/dist/client/assets/HandlePage-Cg8H3mQS.js +0 -1
  285. package/dist/client/assets/NamePage-Bx8T98OF.js +0 -1
  286. package/dist/client/assets/PermissionHistory-DzU1rf2B.js +0 -1
  287. package/dist/client/assets/PhotoPage-CmrOIRjf.js +0 -1
  288. package/dist/client/assets/SeenDevices-SPWkdzoK.js +0 -19
  289. package/dist/client/assets/SettingsDialog-_dEXUhHe.js +0 -12
  290. package/dist/client/assets/ToolsPage-Idimrn3o.js +0 -2
  291. package/dist/client/assets/_shell-ClVN2pUj.js +0 -80
  292. package/dist/client/assets/_shell.marketplace-CiL6YRbl.js +0 -1
  293. package/dist/client/assets/_shell.marketplace_.sources-C0sI8e21.js +0 -1
  294. package/dist/client/assets/_shell.session-_hhBvFc6.js +0 -63
  295. package/dist/client/assets/_shell.x._extensionId-BWy5v1YE.js +0 -1
  296. package/dist/client/assets/_shell.x._extensionId_._-BWy5v1YE.js +0 -1
  297. package/dist/client/assets/channel-DjBlTcCV.js +0 -1
  298. package/dist/client/assets/index-7jby-RRg.js +0 -1
  299. package/dist/client/assets/index-BqIHtiaE.js +0 -1
  300. package/dist/client/assets/index-Cga0qx1T.js +0 -1033
  301. package/dist/client/assets/index-Ct4At33X.js +0 -1
  302. package/dist/client/assets/index-DITPwUa9.js +0 -38
  303. package/dist/client/assets/index-DUZrTFYD.css +0 -1
  304. package/dist/client/assets/registry-Dc102rws.js +0 -1
  305. package/dist/client/assets/signed-in-DctJ2IWe.js +0 -1
  306. package/dist/client/assets/swimlanesDiagram-AYQRV4AK-Dv1-QS9J.js +0 -8
  307. package/dist/client/assets/use-is-below-desktop-gTvJDvw4.js +0 -1
  308. package/dist/client/assets/use-is-hub-B1vPpkYU.js +0 -1
  309. package/dist/client/assets/use-pending-read-C8L_v4Zw.js +0 -1
  310. package/dist/client/assets/use-session-diagnostics-a4b83F5J.js +0 -16
  311. package/dist/client/assets/use-update-config-Tbn3SodN.js +0 -1
@@ -1,10 +1,10 @@
1
- import{W as Mt,r as f,j as t,gD as Ot,a1 as V,jR as Xe,a2 as Ze,jS as z,a3 as le,a4 as we,jT as $t,jU as ue,jV as X,eP as Ut,jW as It,jX as Lt,jY as Ft,c6 as Re,l as ge,jZ as _t,j_ as Kt,j$ as Pt,k0 as je,k1 as Ae,B as S,k2 as qt,cv as zt,k3 as et,e1 as ae,dW as tt,dX as st,dY as nt,dZ as at,d_ as Te,I as Me,gc as rt,h2 as Yt,gd as it,ge as ot,gf as lt,gg as ct,gh as dt,gi as ut,gj as Ht,$ as Bt,k4 as Qt,k5 as Wt,k6 as Jt,jg as xe,cy as Oe,cz as $e,cB as Ue,cC as Ie,cD as Le,dy as Fe,de as _e,a7 as mt,k7 as Gt,k8 as Vt,hm as Xt,k9 as Zt,ka as Ke,kb as es,kc as ts,kd as ft,ke as ss,kf as pt,kg as ht,kh as ns,dK as gt,ki as as,kj as rs,kk as is,iN as os,a0 as ls,e5 as cs,fs as ds,kl as us,cF as xt,km as ms,kn as fs,ad as ps,n as Be}from"./index-Cga0qx1T.js";import{T as hs,R as gs,a as xs}from"./RoomSurface-Bg5WV4Ep.js";import{M as pe,C as Ne}from"./index-InEBtYxw.js";import{M as ys}from"./markdown-content-m_qereFc.js";import{o as vs,a as js,c as Ns}from"./owner-notice-M4hn_1ep.js";import"./use-jump-back-in-Bibj5tVk.js";import"./use-room-follow-claim-Du4hKHIJ.js";import"./WidgetErrorCard-cS8yMCxU.js";import"./index-F-vqXYqa.js";import"./card-B3CtfC3R.js";import"./progress-4FQQfnS6.js";import"./table-BSAvOYPp.js";import"./terminal-6CdY-T1V.js";import"./package-CUuTl39E.js";import"./heart-c7u4Ezxt.js";import"./git-branch-BpxhecMq.js";import"./file-text-DgdvRfMk.js";import"./file-D40js1Zx.js";import"./find-latest-widget-fence-D4kBWC_1.js";import"./format-duration-BCr6uzby.js";import"./RuntimeSetupDialog-Cr4GRi8c.js";import"./inline-code-BE9ckzPs.js";import"./list-runtime-types-CP82p1u4.js";import"./RuntimeConnectFlow-DjReuQ-T.js";import"./useMutationState-DdOGdpjP.js";import"./runtime-connect-Dn0T5YWv.js";import"./mention-pill-DV5HIG5Q.js";import"./rotate-ccw-clock-RfbbgUa4.js";import"./unplug-Bq_1WdV7.js";import"./message-square-off-YVtpbaJ0.js";import"./registry-Dc102rws.js";import"./use-connector-management-CLYFraXN.js";import"./AgentRequestCard-0fOxvaoe.js";import"./access-copy-B3yNZ7Gz.js";import"./query-error-state-BkUdxenP.js";import"./empty-state-J-UJ0BUU.js";import"./use-bindings-Bz9YRgO7.js";import"./connection-copy--MA7AN04.js";import"./KeyEntry-C2kWdN8q.js";import"./file-drag-GDx2qhdk.js";import"./paperclip-C6fYq5Zf.js";import"./index-dyAahqKe.js";/**
1
+ import{W as Mt,r as f,j as t,gz as Ot,a1 as V,jF as Xe,a2 as Ze,jG as q,a3 as le,a4 as we,jH as $t,jI as ue,jJ as X,eP as Ut,jK as It,jL as Lt,jM as Ft,c6 as Re,l as xe,jN as Kt,jO as _t,jP as Pt,jQ as je,jR as Ae,B as S,jS as zt,cv as qt,jT as et,e1 as ae,dW as tt,dX as st,dY as nt,dZ as at,d_ as Te,I as Me,gc as rt,h3 as Ht,gd as it,ge as ot,gf as lt,gg as ct,gh as dt,gi as ut,gj as Yt,$ as Qt,jU as Bt,jV as Jt,jW as Wt,jX as ge,cy as Oe,cz as $e,cB as Ue,cC as Ie,cD as Le,dy as Fe,de as Ke,a7 as mt,jY as Gt,jZ as Vt,hr as Xt,j_ as Zt,j$ as _e,k0 as es,k1 as ts,k2 as ft,k3 as ss,k4 as pt,k5 as ht,k6 as ns,dK as xt,k7 as as,k8 as rs,k9 as is,iP as os,a0 as ls,e5 as cs,fs as ds,ka as us,cF as gt,kb as ms,kc as fs,ad as ps,n as Qe}from"./index-C3cvP8Fo.js";import{T as hs,R as xs,a as gs}from"./RoomSurface-CdgCdV6h.js";import{M as pe,C as Ne}from"./index-iTQUa_b2.js";import{M as ys}from"./markdown-content-DaEVxezf.js";import{o as vs,a as js,c as Ns}from"./owner-notice-BDafFD_I.js";import"./use-jump-back-in-BjZ8EswV.js";import"./use-room-follow-claim-BpKzhniV.js";import"./WidgetErrorCard-1NyzIJBj.js";import"./index-xAgihCJ7.js";import"./card-DT-vFAns.js";import"./progress-g5kkqvlR.js";import"./table-CN2HCi4p.js";import"./terminal-BORQniao.js";import"./package-Cb7lEm7t.js";import"./heart-CqwUlIUG.js";import"./git-branch-CONwEYiR.js";import"./file-text-DsnD-A8g.js";import"./file-CiyVL55_.js";import"./find-latest-widget-fence-CNsnCgbB.js";import"./format-duration-BCr6uzby.js";import"./RuntimeSetupDialog-Bg-0b-LC.js";import"./inline-code-BIzGDx6z.js";import"./list-runtime-types-CqO-QFYD.js";import"./RuntimeConnectFlow-DCIRnvOH.js";import"./useMutationState-CVpvw27W.js";import"./runtime-connect-Dn0T5YWv.js";import"./mention-pill-BiCPflY-.js";import"./rotate-ccw-clock-BGwYMaGL.js";import"./unplug-lkD35Rwp.js";import"./message-square-off-_qbedNGF.js";import"./registry-Ck8p6n1T.js";import"./use-connector-management-5oRqzydY.js";import"./AgentRequestCard-B6MHIsxa.js";import"./access-copy-Dggxx2cX.js";import"./query-error-state-PuLGD7Jp.js";import"./empty-state-CDoXnrKn.js";import"./use-bindings-CU2RSXOy.js";import"./connection-copy--MA7AN04.js";import"./KeyEntry-Cug8ocpX.js";import"./file-drag-GDx2qhdk.js";import"./paperclip-DNu1VtoX.js";import"./index-pVFjKNjX.js";/**
2
2
  * @license lucide-react v1.48.0 - ISC
3
3
  *
4
4
  * This source code is licensed under the ISC license.
5
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 x,O=0,A,K,Y=!1;N({address:u,room:null,entries:[],revisions:oe,deliveries:[],status:"connecting"});function M(){Y=!0,A=void 0,K=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&&(K=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(g=>!C.entries.some(I=>I.originIdempotencyKey===g.idempotencyKey)),status:C.stale?"offline":"live"}));else if(C.type==="revision"){const j=C.entry;C.redactionCursor&&(K=C.redactionCursor);const g=[...z.room(v,e,s),"entries"],b=o.getQueriesData({queryKey:g}).some(([,k])=>k==null?void 0:k.pages.some(F=>F.entries.some(H=>H.id===j.id)))||o.isFetching({queryKey:g})>0||((U=r.current)==null?void 0:U.call(r,j.id))===!0;o.setQueriesData({queryKey:g},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(g=>!j.entries.some(I=>I.originIdempotencyKey===g.idempotencyKey))})):(A=C.entry.cursor,N(j=>({...j,entries:Ce(e,s,j.entries,[C.entry]).slice(-500),deliveries:j.deliveries.filter(g=>g.idempotencyKey!==C.entry.originIdempotencyKey),status:"live"})))}},{since:A,redactions:K,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"})),x=setTimeout(()=>{q()},Math.min(3e4,1e3*2**Math.min(O++,5)))}return q(),()=>{w.abort(),clearTimeout(x)}},[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({...ge.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 ${_t(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:()=>Kt(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]),x=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),K=O??(A>0?{kind:"slow",secondsLeft:A}:null);return{standing:r.data,hold:K,noteHold:w,accept:x}}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 _s(e){for(const[s,n]of he)Ct(n.at)||he.delete(s);return he.get(e)}function Ks(){return Date.now()}function Ps(e,s,n){he.set(e,{attachmentId:s,at:n})}function Qe(e){for(const s of e.files)he.delete(Nt(e.ref,e.roomId,s.id))}function We(e){return e.filter(s=>s.trim()).join(`
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[...q.remote(e,s),"teammates"]}function Ss(e,s=!0){const n=V(),a=Xe(s);return Ze({queryKey:a?vt(a,e):[...q.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,_,H=!1;N({address:u,room:null,entries:[],revisions:oe,deliveries:[],status:"connecting"});function M(){H=!0,A=void 0,_=void 0,o.removeQueries({queryKey:q.remote(v,e)}),N({address:u,room:null,entries:[],revisions:oe,deliveries:[],status:"removed"})}async function z(){try{await c.subscribeRemoteCommunityRoom(e,s,C=>{var U;if(!(w.signal.aborted||H||!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(q.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=[...q.room(v,e,s),"entries"],b=o.getQueriesData({queryKey:x}).some(([,k])=>k==null?void 0:k.pages.some(F=>F.entries.some(Y=>Y.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 Y=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:Y}:k}),N(k=>{if(!b&&!k.entries.some(Y=>Y.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:q.connections(v)})):U===401||U===403||U===404?M():U===410&&j==="COMMUNITY_CURSOR_STALE"&&(A=void 0)}if(w.signal.aborted||H||!X(v))return;const L=o.getQueryData(q.room(v,e,s));L&&o.setQueryData(q.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(()=>{z()},Math.min(3e4,1e3*2**Math.min(O++,5)))}return z(),()=>{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 H;const i=V(),l=le(),d=ue(n,a,e),c=d?[...q.room(d,e,s),"standing"]:[...q.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 z;return(z=M.state.data)!=null&&z.mutedUntil&&Date.parse(M.state.data.mutedUntil)>Date.now()?6e4:!1}}),[o,h]=f.useState(null),[u,y]=f.useState(()=>Date.now()),N=(H=r.data)!=null&&H.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,z=>z&&{...z,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
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:Q})=>({id:P,file:Q}))})}function x(m){w(R=>({...R,text:m}))}function O(m){w(R=>({...R,files:m(R.files)}))}const[A,K]=f.useState(null);function Y(m){K(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),g=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(()=>{g.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)===g.current&&$.context===I.current&&L.current.delete(R.originIdempotencyKey)&&(Qe($),m=!0)}m&&q([...L.current.values()])},[a]);function Z(){b.current&&q([...L.current.values()].filter(m=>m.address===g.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!==g.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!==g.current)throw new Error("Reconnect to this channel, then try again.");const P=m.files[E],Q=Nt(m.ref,m.roomId,P.id),W=_s(Q);if(W){m.attachmentIds.push(W.attachmentId),m.uploadedAt.push(W.at);continue}const te=(R=m.triedAt)[E]??(R[E]=Ks()),J=await o.uploadRemoteCommunityAttachment(m.ref,m.roomId,P.file,m.uploadRound?`${m.key}:file:${E}:${m.uploadRound}`:`${m.key}:file:${E}`);Ps(Q,J.id,te),m.uploadedAt.push(te),m.attachmentIds.push(J.id)}if(!k.current||!b.current||m.address!==g.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),Qe(m),b.current&&m.address===g.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===g.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 Q=U.current.get($)??[];const W=We(Q.map(G=>G.origin.typed));let te=P;W&&P.startsWith(W)?te=P.slice(W.length).replace(/^\n+/,""):Q=[];const J=[...Q,m].sort((G,se)=>G.origin.seq-se.origin.seq),ye=new Set(J.flatMap(G=>G.files.map(se=>se.id))),ie=[...J.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:We([...J.map(G=>G.origin.typed),te]),files:ie}),$ in je.getState().drafts?(U.current.set($,J),!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),Q={address:h,context:c,ref:e,roomId:s,key:crypto.randomUUID(),text:E.text.trim()?E.text:P.map(W=>W.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(Q.key,Q),Y(null),re(Q)}return{text:y,setText:x,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,x=>x==="/"||x==="\\"||x.charCodeAt(0)<32?"_":x).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,g,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,x]=f.useState(!1),[O,A]=f.useState(null),[K,Y]=f.useState(null),M=f.useId(),q=((j=r.data)==null?void 0:j.filter(b=>b.active))??[],L=((g=o.data)==null?void 0:g.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;x(!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)&&x(!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"})]}),K&&t.jsx("p",{role:"status",className:"text-muted-foreground text-sm",children:K}),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(x,O){if(!r){o(x),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(x){d(x.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(Bt,{id:N,checked:e.acceptsDms===!0,disabled:r!==null||!a||!n,onCheckedChange:x=>void v("dms",()=>c.setRemoteCommunityAgentDms(e.community,e.localAgentId,x))}),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 Bs({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({...ge.channels(),search:{community:e,id:N.roomId}})}catch(N){u(N.code===Qt?`${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 Je(e){return`$${e.toFixed(2)}`}function Qs({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:Wt(Number(h)),y=u===null||Number.isFinite(u)&&u>=Jt,N=u!==((d==null?void 0:d.monthlyLimitUsd)??null);function v(x){x.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:x=>l.mutate({wakeAgentsFrom:x==="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:x=>r(x.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 ${Je(d.monthlyLimitUsd)} a month`,` · ${Je(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 Ws(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 Js(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:Ws(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=xe().data)==null?void 0:v.find(x=>x.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(x=>{var A;const O=Js(x);return t.jsxs("div",{className:"flex flex-wrap items-center justify-between gap-x-2 text-sm",children:[t.jsxs("span",{children:[x.displayName,x.kind==="agent"?" · Agent":"",x.ownerMemberId&&` · owned by ${((A=e.members.find(K=>K.memberId===x.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&&x.kind==="agent"&&x.ownerMemberId!==y&&t.jsx(Bs,{community:i,agent:x,disabled:!d,accessFingerprint:o}),x.handle&&t.jsxs(S,{variant:"ghost",size:"sm",disabled:!n,onClick:()=>a(x.handle),children:["Mention @",x.handle]})]})]},x.memberId)}),c&&t.jsx(Ys,{community:i,roomId:l,online:d,canEnroll:!0,accessFingerprint:o},r),t.jsx(Qs,{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(_e,{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(_e,{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(_e,{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=xe().data)==null?void 0:qe.find(p=>p.ref===e),r=Ke(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),x=f.useRef(null),O=f.useRef(void 0),A=(w==null?void 0:w.scrollAnchorEntryId)??null,K=f.useCallback(p=>{if(!o||n)return;x.current&&clearTimeout(x.current),x.current=null;const D=p??null,_=O.current===void 0?A:O.current;D===null&&_===null||(x.current=setTimeout(()=>{x.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(()=>()=>{x.current&&clearTimeout(x.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",g=j?null:U.room??Y.data,I=ss(e,s,n,!j&&r.capabilities.read&&(g==null?void 0:g.readable)===!0,r.fingerprint),b=pt(e,s,!j&&r.capabilities.read&&(g==null?void 0:g.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&&(g==null?void 0:g.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),Q=p=>{var D;return p===E||((D=b.data)==null?void 0:D.members.some(_=>_.memberId===p&&_.ownerMemberId===E))===!0},[W,te]=f.useState({address:"",name:null,error:null}),J=W.address===u?W.name:null,ye=W.address===u?W.error:null,ie=f.useRef(null),G=f.useRef(null),se=f.useRef(null),fe=!j&&r.capabilities.post&&U.status==="live"&&(g==null?void 0:g.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]),B=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??(g==null?void 0:g.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.":g!=null&&g.archived?"This channel is archived.":g!=null&&g.joined?"Reconnecting. You can send once the space is back.":"Join this channel to send messages.",attachments:B.attachments,async send(){B.send(n)}};async function ve(p,D){if(J||!o)return;const _=o,de=u;te({address:de,name:p,error:null});try{if(await D(),!X(_))return;(p==="join"||p==="leave"||p.startsWith("retry:"))&&q(ne=>ne+1),await y.invalidateQueries({queryKey:z.remote(_,e)})}catch(ne){X(_)&&te({address:de,name:p,error:ne instanceof Error?ne.message:"Couldn’t finish that. Try again."})}finally{X(_)&&te(ne=>ne.address===de?{...ne,name:null}:ne)}}function Et(){var _;const p=ce.at(-1);if(n||I.hasNextPage||!p||U.status!=="live"||((_=ie.current)==null?void 0:_.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":(g==null?void 0:g.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&&g&&!g.joined&&!g.stale&&t.jsx(S,{size:"sm",disabled:J!==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:J!==null,onClick:()=>void ve("stop",()=>l.haltRemoteCommunityRoom(e,s)),children:J==="stop"?"Stopping…":"Stop my agents"}),r.capabilities.post&&(g==null?void 0:g.joined)&&!i&&t.jsx(S,{variant:"ghost",size:"sm",disabled:J!==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;B.setText(`${B.text}${B.text&&!B.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:K,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 _=Pe[D.index];return _.kind==="message"?t.jsx(wt,{entry:_.entry,onThread:a,onReport:r.capabilities.post&&b.data&&!Q(_.entry.authorId)?()=>$(_.entry):void 0}):t.jsx(hs,{summary:_.summary,open:!1,onOpen:()=>a(_.rootId)})}}),t.jsx(an,{agentDeliveries:U.deliveries,drafts:B.deliveries,entries:ce,threadId:n,canSend:ke,action:J,onRetryAgent:p=>void ve(`retry:${p}`,()=>l.retryRemoteCommunityDelivery(e,s,p)),onRetryDraft:B.retry}),B.error&&t.jsx("p",{role:"alert",className:"text-destructive px-4 py-2 text-sm",children:B.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:B.text,onChange:B.setText,onSubmit:()=>B.send(n),input:{isStreaming:!1,contextKey:be.id,canSubmit:B.text.trim().length>0||B.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=xe(),a=(h=n.data)==null?void 0:h.find(y=>y.ref===e),i=Ke(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(gt,{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",x=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:x}),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(`
8
+ `)}function zs(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 qs({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 H(m){_(m===null?null:{address:h,context:c,message:m})}const[M,z]=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),Y=f.useRef(r);f.useLayoutEffect(()=>{x.current=h,I.current=c,k.current=n,F.current=i,Y.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&&z([...L.current.values()])},[a]);function Z(){b.current&&z([...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(zs(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&&(($=Y.current)==null||$.call(Y,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){H("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),H(null),re(B)}return{text:y,setText:g,attachments:{staged:N,add(m){if(m.some(R=>R.size>25*1024*1024)){H("Each file must be 25 MB or smaller.");return}O(R=>R.length+m.length>8?(H("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 Hs({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=zt(e,a,i),o=qt(),h=et(e,a,i),[u,y]=f.useState(""),[N,v]=f.useState(""),[w,g]=f.useState(!1),[O,A]=f.useState(null),[_,H]=f.useState(null),M=f.useId(),z=((j=r.data)==null?void 0:j.filter(b=>b.active))??[],L=((x=o.data)==null?void 0:x.agents.filter(b=>!z.some(k=>k.localAgentId===b.id)))??[];async function C(){c&&X(c)&&await d.invalidateQueries({queryKey:q.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(Ys,{agent:b,roomId:s,online:n,canEnroll:a,takesDms:((k=h.data)==null?void 0:k.available)===!0,onChanged:C,onNotice:H},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 Ys({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(Ht,{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(Yt,{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:q.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(Hs,{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:q.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 ze,qe,He,Ye;const l=V(),c=(ze=ge().data)==null?void 0:ze.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=(qe=N.data)==null?void 0:qe.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:q.remote(o,e)})},[o,e,c==null?void 0:c.status,y]);const H=ft(e,s,r.capabilities.read,r.fingerprint),[M,z]=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??H.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:[]})),Y=f.useMemo(()=>k.address===u?k.entries:[],[u,k]);f.useEffect(()=>{L.current=Y},[Y]);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=(He=b.data)==null?void 0:He.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,Y),U.revisions)},[e,s,I.data,U.entries,U.revisions,Y,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=qs({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:"))&&z(ne=>ne+1),await y.invalidateQueries({queryKey:q.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:q.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"}),((Ye=T.standing)==null?void 0:Ye.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:q.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."}),H.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
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:K=>{K||a.reset(),l(K)},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=xe().data)==null?void 0:d.find(c=>c.ref===e),i=Ke(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(gn,{dm:l,accessFingerprint:i.fingerprint}),t.jsx("div",{className:"min-h-0 flex-1",children:n(l.agent.displayName)})]}):n()}function gn({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 xn(){const{id:e,community:s}=xt({from:"/_shell/channels"}),n=ms(s);return s&&!n.visible?n.isLoading?null:t.jsx(fs,{...ge.channels(),search:{},replace:!0}):t.jsxs(t.Fragment,{children:[s?t.jsx(cn,{community:s,roomId:e}):e===void 0&&t.jsx(gt,{children:"Channels"}),t.jsx(yn,{})]})}function yn(){const{id:e,thread:s,entry:n,community:a}=xt({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({...ge.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(Be,{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(gs,{})}):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(Be,{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(xs,{roomId:e,threadId:s,entrySeq:n,threadRoute:"/channels"})}function Ve({community:e,children:s}){var i;const n=Re(),a=(i=xe().data)==null?void 0:i.find(l=>l.ref===e);return a&&St(a)?t.jsx(un,{connection:a,onRemoved:()=>void n({...ge.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 oa=xn;export{oa as component};
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 oa=gn;export{oa as component};