dorkos 0.120.0 → 0.121.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/bin/cli.js +118 -22
- package/dist/browser/native/package-manifest.json +1 -1
- package/dist/browser/source-manifest.json +1 -1
- package/dist/client/assets/{AboutPage-Y8O56Cz5.js → AboutPage-CtI8gbER.js} +1 -1
- package/dist/client/assets/{ActivityErrorState-DlROxqde.js → ActivityErrorState-CHTXfBS7.js} +1 -1
- package/dist/client/assets/{ActivityPage-BdV90CV2.js → ActivityPage-B8p4yYJL.js} +1 -1
- package/dist/client/assets/{ActivityRow-B5yiD_uD.js → ActivityRow-CSuSz-92.js} +1 -1
- package/dist/client/assets/{AdapterIcon-Dyq92Eup.js → AdapterIcon-Qnxn0cE5.js} +1 -1
- package/dist/client/assets/{AdapterSetupWizard-D9tqz7Hl.js → AdapterSetupWizard-BG8H-Lld.js} +1 -1
- package/dist/client/assets/{AgentOptionRow-BeRqDo7c.js → AgentOptionRow-BWFQFynn.js} +1 -1
- package/dist/client/assets/{AgentPicker-BRyYVJZu.js → AgentPicker-CL93SET3.js} +1 -1
- package/dist/client/assets/{AgentRequestCard-xX6fAKgO.js → AgentRequestCard-CamX7Tvr.js} +4 -4
- package/dist/client/assets/{AppearancePage-DKF9BqRt.js → AppearancePage-rN70_7ih.js} +1 -1
- package/dist/client/assets/{ApplyToOverridesDialog-CPvtr_-f.js → ApplyToOverridesDialog-DeWaXbgm.js} +1 -1
- package/dist/client/assets/{AttentionSignalRow-vBfioH1A.js → AttentionSignalRow-CKcSWExi.js} +1 -1
- package/dist/client/assets/{BaseTanStackRouterDevtoolsPanel-B-iktbLX-B50zNtwB.js → BaseTanStackRouterDevtoolsPanel-B-iktbLX-BwYaLf2P.js} +1 -1
- package/dist/client/assets/{BindingDialog-CSNjws3F.js → BindingDialog-DqPDLYbF.js} +1 -1
- package/dist/client/assets/BlintzCanvas-DoAZs5bz.js +1231 -0
- package/dist/client/assets/{BlintzCanvas-GgiCXV7C.css → BlintzCanvas-xZ3u3nk7.css} +1 -1
- package/dist/client/assets/{CanvasCsvContent-0Mb7uOuA.js → CanvasCsvContent-ViqRJuhW.js} +1 -1
- package/dist/client/assets/CanvasFileContent-ClcHZ_l-.js +2 -0
- package/dist/client/assets/{CanvasModel3dContent-UokbHY9i.js → CanvasModel3dContent-Cm3msNdQ.js} +2 -2
- package/dist/client/assets/{ChatAppsOff-CLRB0YU5.js → ChatAppsOff-D0PbHYqF.js} +1 -1
- package/dist/client/assets/{CodeMirrorDiff-B4uFJD6g.js → CodeMirrorDiff-DFNSXeuV.js} +1 -1
- package/dist/client/assets/{CodeMirrorEditor-rYOrBAZc.js → CodeMirrorEditor-AgkgsSqN.js} +1 -1
- package/dist/client/assets/{CommitmentList-i-IZ4gbr.js → CommitmentList-0V6QivXH.js} +1 -1
- package/dist/client/assets/{CommitmentsPage-ChO1JkrE.js → CommitmentsPage-i3XoHwBj.js} +1 -1
- package/dist/client/assets/{ComputerResourceView-pLuD2ie6.js → ComputerResourceView-RPoBc-km.js} +1 -1
- package/dist/client/assets/{ComputerViewer-D7tPmpY5.js → ComputerViewer-2ugaCd0H.js} +1 -1
- package/dist/client/assets/{ConnectionAccessLists-D6VH1vX3.js → ConnectionAccessLists-DaPP4U96.js} +1 -1
- package/dist/client/assets/{ConnectionsPage-7x5olD9q.js → ConnectionsPage-BVqYvfk5.js} +2 -2
- package/dist/client/assets/{ConventionPage-BTYLWw6p.js → ConventionPage-BoqncrFd.js} +1 -1
- package/dist/client/assets/{ExtensionPageRoute-A9AdBBbw.js → ExtensionPageRoute-BrOEeNX3.js} +2 -2
- package/dist/client/assets/{FloatingTanStackRouterDevtools-CqogiFob-ayv0yz1C.js → FloatingTanStackRouterDevtools-CqogiFob-DLwix3K7.js} +1 -1
- package/dist/client/assets/HandlePage-B_5GLHsp.js +1 -0
- package/dist/client/assets/{HeartbeatPage-Dh6W9Qg5.js → HeartbeatPage-DgXhbaBJ.js} +1 -1
- package/dist/client/assets/{KeyEntry-owhPGtw3.js → KeyEntry-CRr32Ae5.js} +1 -1
- package/dist/client/assets/{LexicalField-B1NFMLD6.js → LexicalField-DeAoA6yr.js} +1 -1
- package/dist/client/assets/{ManagesPage-BAnBmBdo.js → ManagesPage-ZBWYLTZx.js} +1 -1
- package/dist/client/assets/{Marketplace-67maxdwz.js → Marketplace-iL5p8Omt.js} +4 -4
- package/dist/client/assets/{MarketplaceSourcesView-CzPBNJJj.js → MarketplaceSourcesView-CsNLVOdP.js} +1 -1
- package/dist/client/assets/{McpAppFrame-CuObpQTg.js → McpAppFrame-B1WPswgk.js} +1 -1
- package/dist/client/assets/{McpSigninBody-B-ayj6bQ.js → McpSigninBody-CJ28yu0o.js} +1 -1
- package/dist/client/assets/{Model3dViewer-DRVqxazk.js → Model3dViewer-BIZWdK8g.js} +1 -1
- package/dist/client/assets/NamePage-0nr288eM.js +1 -0
- package/dist/client/assets/{NewDirectMessageMenu-B3DxayR2.js → NewDirectMessageMenu-DRx9e9kM.js} +1 -1
- package/dist/client/assets/{NotificationsPage-BavEo7VZ.js → NotificationsPage-cfqgSuVy.js} +1 -1
- package/dist/client/assets/{OpenMeshSwitch-BwkX2Toa.js → OpenMeshSwitch-BIIuKDku.js} +1 -1
- package/dist/client/assets/{OperatorIdentityForm-CtWgz2yi.js → OperatorIdentityForm-BKUSGrs6.js} +1 -1
- package/dist/client/assets/{PermissionHistory-DvM0F2bS.js → PermissionHistory-Ctdqhib6.js} +1 -1
- package/dist/client/assets/{PermissionsPage-D1DJHezV.js → PermissionsPage-CYA_zdrV.js} +1 -1
- package/dist/client/assets/{PersonalityPopover-BV-9wfIl.js → PersonalityPopover-BR4Cpr2C.js} +1 -1
- package/dist/client/assets/PhotoPage-C3Ir3wlA.js +1 -0
- package/dist/client/assets/{PresetPicker-BOQKgYAK.js → PresetPicker-zGvDOqTf.js} +2 -2
- package/dist/client/assets/{PreviewRefusedNotice-BdhUln2h.js → PreviewRefusedNotice-D1Tl265t.js} +1 -1
- package/dist/client/assets/{ProfileFields-DFRnRR38.js → ProfileFields-T3vVbHRC.js} +1 -1
- package/dist/client/assets/{ProfilePanelContainer-CkxX9Dps.js → ProfilePanelContainer-CParzTPA.js} +1 -1
- package/dist/client/assets/{ProfileRolePicker-BSYi_luB.js → ProfileRolePicker-BU4eiMKn.js} +1 -1
- package/dist/client/assets/{PromptSuggestionChips-r08GqBH1.js → PromptSuggestionChips-CGNQc2Tf.js} +1 -1
- package/dist/client/assets/{ReportsToPopover-BcsM5Eia.js → ReportsToPopover-Dj5U_Ppi.js} +1 -1
- package/dist/client/assets/{RoomSurface-DaRCf4og.js → RoomSurface-BIyjtxKD.js} +7 -7
- package/dist/client/assets/{RoomsPage-CQqsdVvB.js → RoomsPage-Cvs3h6f0.js} +1 -1
- package/dist/client/assets/{RunsOnPopover-DFb4xEhP.js → RunsOnPopover-BUlYwRW4.js} +1 -1
- package/dist/client/assets/{RuntimeConnectFlow-pKFJlNSJ.js → RuntimeConnectFlow-ChrvjC84.js} +1 -1
- package/dist/client/assets/{RuntimeSetupDialog-DvBJbrmj.js → RuntimeSetupDialog-BK9yo7YF.js} +1 -1
- package/dist/client/assets/{SessionsPage-CGgnEPh7.js → SessionsPage-CWUwU3US.js} +1 -1
- package/dist/client/assets/{SettingsDialog-D0cmzjrH.js → SettingsDialog-BApzy0J8.js} +3 -3
- package/dist/client/assets/{SkillsPage-DDoPlsn2.js → SkillsPage-z3XnApNX.js} +1 -1
- package/dist/client/assets/{TaskDialogWrapper-DoIVzbKU.js → TaskDialogWrapper-BEWUpAlk.js} +1 -1
- package/dist/client/assets/{TasksEmptyState-B68O6dnT.js → TasksEmptyState-CLwpLnIO.js} +2 -2
- package/dist/client/assets/{TasksPage-BsBDphim.js → TasksPage-CyHjr9OZ.js} +1 -1
- package/dist/client/assets/{TeamComputerEntry-CoQ4EsDm.js → TeamComputerEntry-BHHIofx3.js} +1 -1
- package/dist/client/assets/{ToolsPage-Cl1aOpev.js → ToolsPage-CckCco8x.js} +1 -1
- package/dist/client/assets/TopologyGraph-Dox7aWP3.js +30 -0
- package/dist/client/assets/{TourHost-4O6TJzc-.js → TourHost-CTBewD-a.js} +1 -1
- package/dist/client/assets/{UnlinkDialog-DIMY60Fi.js → UnlinkDialog-CFRgExId.js} +1 -1
- package/dist/client/assets/{WidgetErrorCard-CzWw_SPD.js → WidgetErrorCard-Dx5oPMlF.js} +23 -23
- package/dist/client/assets/_commonjs-dynamic-modules-TDtrdbi3.js +1 -0
- package/dist/client/assets/{_shell-BRH2Y-U-.js → _shell-BHUZq_8C.js} +1 -1
- package/dist/client/assets/{_shell._home-DG3Vw7S5.js → _shell._home-DnBkgWs4.js} +1 -1
- package/dist/client/assets/{_shell._home.activity-COI96oAO.js → _shell._home.activity-CVCC-EEI.js} +1 -1
- package/dist/client/assets/{_shell._home.index-CTwsTjcQ.js → _shell._home.index-Ck6jxwIx.js} +1 -1
- package/dist/client/assets/{_shell._home.tasks-DOVoPYaf.js → _shell._home.tasks-B7QQAZnA.js} +1 -1
- package/dist/client/assets/{_shell._home.workspaces-ApZhnjwy.js → _shell._home.workspaces-DlrRd9tv.js} +1 -1
- package/dist/client/assets/{_shell.channels-CRkJHU5R.js → _shell.channels-CiWehoyl.js} +4 -4
- package/dist/client/assets/{_shell.connections-bhAK3jnE.js → _shell.connections-CGP5hZHq.js} +1 -1
- package/dist/client/assets/{_shell.feedback-requests-k43R8-rW.js → _shell.feedback-requests-BxxNvw6j.js} +1 -1
- package/dist/client/assets/_shell.marketplace-BoAmyvPt.js +1 -0
- package/dist/client/assets/_shell.marketplace_.sources-BpqWjkGL.js +1 -0
- package/dist/client/assets/{_shell.session-D871zZl3.js → _shell.session-KyPj3OxK.js} +17 -17
- package/dist/client/assets/{_shell.team-DHCM1QoO.js → _shell.team-CsXH3NkS.js} +4 -4
- package/dist/client/assets/_shell.x._extensionId-CfiAgtoq.js +1 -0
- package/dist/client/assets/_shell.x._extensionId_._-CfiAgtoq.js +1 -0
- package/dist/client/assets/abnfDiagram-WEYOIA3C-CMdkyiQ3.js +1 -0
- package/dist/client/assets/{access-copy-BVzi1REx.js → access-copy-CW-z1oMH.js} +1 -1
- package/dist/client/assets/arc-Bw7tftQk.js +1 -0
- package/dist/client/assets/architectureDiagram-ZHVYKT53-BhpXALtX.js +36 -0
- package/dist/client/assets/{banner-3xXXsU5J.js → banner-EomQNDOH.js} +1 -1
- package/dist/client/assets/blockDiagram-RJAE7QA3-Bxk_BuZv.js +140 -0
- package/dist/client/assets/c4Diagram-XDPPPE54-CYN0FwR8.js +38 -0
- package/dist/client/assets/{card-Bt6IU-Bh.js → card-ww4ebz8h.js} +1 -1
- package/dist/client/assets/channel-DZpRF3QJ.js +1 -0
- package/dist/client/assets/chunk-2E7WHVMD-IPDvYcPa.js +88 -0
- package/dist/client/assets/chunk-2Q5K7J3B-DZ5bU5Ax.js +1 -0
- package/dist/client/assets/chunk-4EMNKR2T-DrsWxa6Y.js +1 -0
- package/dist/client/assets/chunk-55XCU76K-CiBbKG0b.js +1 -0
- package/dist/client/assets/chunk-5VM5RSS4-B3K3MUav.js +15 -0
- package/dist/client/assets/chunk-JWPE2WC7-CjV5RcIh.js +1 -0
- package/dist/client/assets/chunk-VQ5W62QI-CWoRr0H2.js +1 -0
- package/dist/client/assets/chunk-XXDRQBXY-E0nvzXiG.js +1 -0
- package/dist/client/assets/chunk-ZCHMQSOR-DFop6Lvt.js +2 -0
- package/dist/client/assets/classDiagram-v2-4MYWR3UA-B7JJfc9z.js +217 -0
- package/dist/client/assets/{command-CWokzKS1.js → command-D4fLpJxA.js} +1 -1
- package/dist/client/assets/cose-bilkent-JH36ORCC-BjNppl29.js +1 -0
- package/dist/client/assets/{cpu-BzByzE9V.js → cpu-DCe0Yyml.js} +1 -1
- package/dist/client/assets/cynefin-EF2NZ3EQ-PmRntJwW.js +141 -0
- package/dist/client/assets/cynefinDiagram-WF24UDRP-Ctdbp_Vg.js +62 -0
- package/dist/client/assets/cytoscape.esm-BLAcgzS2.js +331 -0
- package/dist/client/assets/dagre-NK4GIZVX-5tvLY2ZW.js +4 -0
- package/dist/client/assets/defaultLocale-DX6XiGOO.js +1 -0
- package/dist/client/assets/diagram-CBK3MWTC-DZO-XBOO.js +24 -0
- package/dist/client/assets/diagram-I5XIIV2D-CWBbA1Pv.js +24 -0
- package/dist/client/assets/diagram-ODIL2UCW-hP5A1tGl.js +30 -0
- package/dist/client/assets/diagram-PFBEJUXE-EI_-RoN7.js +3 -0
- package/dist/client/assets/diagram-RJA3I4VV-TrYq9A4Z.js +41 -0
- package/dist/client/assets/diagram-TYUNFSNR-BAQq2OM5.js +200 -0
- package/dist/client/assets/ebnfDiagram-V4P3TTPT-cKbeW9dQ.js +1 -0
- package/dist/client/assets/elk-QONTBCTQ-wpfNPp0q.js +27 -0
- package/dist/client/assets/{empty-state-BgnQDiMZ.js → empty-state-DXWQsHMf.js} +1 -1
- package/dist/client/assets/erDiagram-KYQIGQAA-Dk0OrvjE.js +99 -0
- package/dist/client/assets/{execution-config-D5-SEt2t.js → execution-config-CAyT2Qoo.js} +1 -1
- package/dist/client/assets/{file-VHDTQub2.js → file-Bf7D_47y.js} +1 -1
- package/dist/client/assets/{file-exclamation-point-DbWvGys0.js → file-exclamation-point-DZXE9_8o.js} +1 -1
- package/dist/client/assets/{file-text-BAhi2zct.js → file-text-C1ougnBY.js} +1 -1
- package/dist/client/assets/{find-latest-widget-fence-Z0HPVqeK.js → find-latest-widget-fence-B1_-pC-Z.js} +1 -1
- package/dist/client/assets/flowDiagram-IUGLLWBU-CdlOoRZV.js +213 -0
- package/dist/client/assets/{form-Blrb1xBU.js → form-D7kF-U0d.js} +1 -1
- package/dist/client/assets/{format-cron-lKWqEmle.js → format-cron-ZtliseYi.js} +1 -1
- package/dist/client/assets/ganttDiagram-R7GPNTJY-x0MJLv5d.js +292 -0
- package/dist/client/assets/{git-branch-BObm8Rlz.js → git-branch-B2k77X3Q.js} +1 -1
- package/dist/client/assets/gitGraphDiagram-PDYL7XHY-CruCvk7w.js +106 -0
- package/dist/client/assets/graph-5PBe05F8.js +1 -0
- package/dist/client/assets/{heart-Du7nuefC.js → heart-CmqGJPDc.js} +1 -1
- package/dist/client/assets/{highlighted-body-KPVGNVTW-B_GO7V1P.js → highlighted-body-KPVGNVTW-Bqu2cQDj.js} +1 -1
- package/dist/client/assets/{image-lightbox-BZ1TV3mN.js → image-lightbox-BBbz-ThL.js} +1 -1
- package/dist/client/assets/{image-off-hnjcBIzN.js → image-off-BCtWIY4q.js} +1 -1
- package/dist/client/assets/{index-Ch-ON5gw.js → index-1ShgR_xt.js} +1 -1
- package/dist/client/assets/{index-DoMJUxt_.js → index-8IAr9b71.js} +1 -1
- package/dist/client/assets/{index-EZHlD3gf.js → index-8TfzCkKR.js} +1 -1
- package/dist/client/assets/{index-B0tAedq7.js → index-B5rRtvWx.js} +1 -1
- package/dist/client/assets/index-B6dEbNhI.js +1 -0
- package/dist/client/assets/{index-WxtASL5_.js → index-BCk4wW-T.js} +1 -1
- package/dist/client/assets/{index-Ci74HAFs.js → index-BIIH5CXj.js} +1 -1
- package/dist/client/assets/{index-CiQxS4Bn.js → index-BXMxoWrk.js} +1 -1
- package/dist/client/assets/index-BXZlDqvy.js +74 -0
- package/dist/client/assets/{index-Bm0z9mHt.js → index-BfRW2WTx.js} +1 -1
- package/dist/client/assets/{index-CCg7yRe1.js → index-BpmmNapD.js} +1 -1
- package/dist/client/assets/{index-r_O6CmXY.js → index-BrQGZ6iF.js} +1 -1
- package/dist/client/assets/{index-Df7a-2P5.js → index-BuGQxHrf.js} +1 -1
- package/dist/client/assets/{index-BP68J4pb.js → index-BzPgsdPn.js} +1 -1
- package/dist/client/assets/{index-CqoIjNC2.js → index-C11Ssk2u.js} +2 -2
- package/dist/client/assets/{index-BnNTKsbt.js → index-CJ5v2_Cz.js} +1 -1
- package/dist/client/assets/{index-4PAAWURd.js → index-CMNc_OrC.js} +1 -1
- package/dist/client/assets/{index-BvjuGXcS.js → index-CQ0VLZf-.js} +1 -1
- package/dist/client/assets/{index-BaRQVgiN.js → index-ChwNEkM8.js} +1 -1
- package/dist/client/assets/index-Cl8trmnL.js +1 -0
- package/dist/client/assets/{index-1I8qHZDt.js → index-ClBIPuLA.js} +1 -1
- package/dist/client/assets/{index-D6y4WeTi.js → index-Cml5572f.js} +1 -1
- package/dist/client/assets/{index-DHYvT3nr.js → index-Cp3yShS8.js} +6 -6
- package/dist/client/assets/{index-DB8TDRSm.js → index-CtycM8wY.js} +1 -1
- package/dist/client/assets/{index-aXm0xP_2.js → index-Cv0GsC4n.js} +1 -1
- package/dist/client/assets/{index-ox3ce99A.js → index-DAdo_yIq.js} +1 -1
- package/dist/client/assets/{index-HxT_wkaZ.js → index-DIxzqCwG.js} +1 -1
- package/dist/client/assets/{index-Cdyszxoa.js → index-DKDK-3KH.js} +5 -5
- package/dist/client/assets/index-DPNBHwcQ.js +1 -0
- package/dist/client/assets/{index-BgzgdvDn.js → index-DbDI5BAA.js} +1 -1
- package/dist/client/assets/{index-Dc5cpBoO.js → index-DcZPWi_I.js} +248 -248
- package/dist/client/assets/{index-CBm3whA-.js → index-Dmn03xST.js} +1 -1
- package/dist/client/assets/{index-BeVbHOwX.js → index-Do6eeFps.js} +2 -2
- package/dist/client/assets/{index-BtbZpz4b.js → index-DrA03bMq.js} +1 -1
- package/dist/client/assets/{index-D5TZCu8j.js → index-DsJWzmWw.js} +1 -1
- package/dist/client/assets/{index-DRea_Gi0.js → index-EdJm7ZN-.js} +1 -1
- package/dist/client/assets/{index-CQCN6kWR.js → index-JxeBJIuE.js} +1 -1
- package/dist/client/assets/{index-BUOcbPfv.js → index-mFOJXyAE.js} +3 -3
- package/dist/client/assets/{index-BVKXIbLh.js → index-rWZWP3Wh.js} +1 -1
- package/dist/client/assets/{index-DkhM0fDi.js → index-t4Ud6YTX.js} +1 -1
- package/dist/client/assets/{index-Lh82Rz5C.js → index-xaMF1mrN.js} +1 -1
- package/dist/client/assets/{index-C60RrnTd.js → index-xmk9Ohv9.js} +1 -1
- package/dist/client/assets/{index-4GC2fkeO.js → index-yI1r4pSP.js} +1 -1
- package/dist/client/assets/{index.esm-DXsF3Bua.js → index.esm-CZZtbPRj.js} +1 -1
- package/dist/client/assets/infoDiagram-MVDRKAX5-Bj9DD77n.js +2 -0
- package/dist/client/assets/init-Gi6I4Gst.js +1 -0
- package/dist/client/assets/{inline-code-DAEoWvTf.js → inline-code-g9PVHZI2.js} +1 -1
- package/dist/client/assets/ishikawaDiagram-HPEHV2GE-DckI6dhS.js +70 -0
- package/dist/client/assets/journeyDiagram-BOSHW7O7-Ce1GAVa0.js +139 -0
- package/dist/client/assets/kanban-definition-FNSA4HC5-Kq5O9rZa.js +89 -0
- package/dist/client/assets/katex-DLorvT8M.js +257 -0
- package/dist/client/assets/{layers-CsM34LRv.js → layers-D3lEdRF0.js} +1 -1
- package/dist/client/assets/{lightbulb-B8JAixK_.js → lightbulb-BFE-KkFU.js} +1 -1
- package/dist/client/assets/linear-BT-xgETh.js +1 -0
- package/dist/client/assets/{link-2-Csc6okl3.js → link-2-Dvb6g-2Q.js} +1 -1
- package/dist/client/assets/{list-runtime-types-DQrZNB7x.js → list-runtime-types-8YGEK3Al.js} +1 -1
- package/dist/client/assets/{markdown-content-DPc7aD1j.js → markdown-content-Cqq_QMXA.js} +1 -1
- package/dist/client/assets/{mention-pill-8P_w4muj.js → mention-pill-Bnzt4u2l.js} +1 -1
- package/dist/client/assets/mermaid.core-dpp59v7L.js +312 -0
- package/dist/client/assets/{message-square-off-D5DXu2cY.js → message-square-off-BX2XnEDx.js} +1 -1
- package/dist/client/assets/mindmap-definition-6OY57UG3-CFdfJO6g.js +98 -0
- package/dist/client/assets/{more-details-DEeu2M-p.js → more-details-B4lBMpKi.js} +1 -1
- package/dist/client/assets/ordinal-Cboi1Yqb.js +1 -0
- package/dist/client/assets/{owner-notice-BW4k1ycg.js → owner-notice-ByjrIRmX.js} +1 -1
- package/dist/client/assets/{package-BSwwAFVm.js → package-6Rbxg35g.js} +1 -1
- package/dist/client/assets/{page-container-CjPUNtNw.js → page-container-DoZzad36.js} +1 -1
- package/dist/client/assets/{paperclip-DQaRz34E.js → paperclip-B-jDXtxw.js} +1 -1
- package/dist/client/assets/{path-input-CgXSYNZn.js → path-input-DpqUD8hN.js} +1 -1
- package/dist/client/assets/pegDiagram-ECIUJNBX-eVnSw2Ma.js +1 -0
- package/dist/client/assets/pieDiagram-GNMPY74T-BYG7LY5Q.js +39 -0
- package/dist/client/assets/{plug-BaUXMfIl.js → plug-DnaAhcy4.js} +1 -1
- package/dist/client/assets/{primer-trigger-DHB0vilf.js → primer-trigger-Da5ECjY8.js} +2 -2
- package/dist/client/assets/{profile-errors-JW2XTgia.js → profile-errors-GbTNc2-M.js} +1 -1
- package/dist/client/assets/{progress-CErAw8zp.js → progress-DlIRjXIA.js} +1 -1
- package/dist/client/assets/quadrantDiagram-D57K4MC3-CRgNKuHR.js +7 -0
- package/dist/client/assets/{query-error-state-BFWpEXsl.js → query-error-state-DB-Jby7_.js} +1 -1
- package/dist/client/assets/{radio-Bkx216ga.js → radio-CaaE60ws.js} +1 -1
- package/dist/client/assets/railroadDiagram-Y72NRBL7-DGL-Hqz9.js +1 -0
- package/dist/client/assets/registry-DS1Ghdft.js +1 -0
- package/dist/client/assets/{relay-trace-schemas-DiZj_AFV.js → relay-trace-schemas-CcCqyOrA.js} +2 -2
- package/dist/client/assets/requirementDiagram-EQYSW5RA-DKsFpU3l.js +84 -0
- package/dist/client/assets/{room-files-source-BilZvdpf.js → room-files-source-CbbVpvSW.js} +1 -1
- package/dist/client/assets/{rotate-ccw-clock-D_SO1stN.js → rotate-ccw-clock-CeY00nlZ.js} +1 -1
- package/dist/client/assets/{rotate-cw-C68kM23F.js → rotate-cw-Djl5J_x9.js} +1 -1
- package/dist/client/assets/sankeyDiagram-SY24JHO5-BFRkDxic.js +40 -0
- package/dist/client/assets/{scroll-area-CVWFUmJV.js → scroll-area-BOqrziJf.js} +1 -1
- package/dist/client/assets/{search-x-BTFVvyA2.js → search-x-B_mHjnlo.js} +1 -1
- package/dist/client/assets/sequenceDiagram-BLEHNHQU-fHea3KOI.js +169 -0
- package/dist/client/assets/{shield-check-Dpxi6WqO.js → shield-check-Csnr5rFy.js} +1 -1
- package/dist/client/assets/{shield-x-CdCCgyXk.js → shield-x-Dhl4YvvW.js} +1 -1
- package/dist/client/assets/{signed-in-BxAnDo0S.js → signed-in-BMqAss8c.js} +1 -1
- package/dist/client/assets/sizeCapture-INFHLROL-CztsD3qF.js +1 -0
- package/dist/client/assets/{soul-file-CRfKVJX3.js → soul-file-DOfamgB5.js} +1 -1
- package/dist/client/assets/stateDiagram-v2-A6IESKWZ-CWyOqZ9S.js +291 -0
- package/dist/client/assets/swimlanes-B3ENRKFQ-0EfOxSAX.js +1 -0
- package/dist/client/assets/swimlanesDiagram-AYQRV4AK-C7fkUKrq.js +8 -0
- package/dist/client/assets/{table-BL3xUC41.js → table-L7FvN6Or.js} +1 -1
- package/dist/client/assets/{terminal-u_UCRzSM.js → terminal-C9M5a_PS.js} +1 -1
- package/dist/client/assets/timeline-definition-JXYKGLGB-sFyYvZ20.js +120 -0
- package/dist/client/assets/transform-BqqRT-Iy.js +1 -0
- package/dist/client/assets/{trust-posture-B-v4BWo7.js → trust-posture-dl6qwDtI.js} +1 -1
- package/dist/client/assets/{unplug-CFbC-L5W.js → unplug-CFUEVRbc.js} +1 -1
- package/dist/client/assets/{unverified-catalog-notice-ZUqscVFM.js → unverified-catalog-notice-CdYU3WEJ.js} +1 -1
- package/dist/client/assets/{use-adapter-catalog-Z4MDWZAZ.js → use-adapter-catalog-YTofdqDJ.js} +1 -1
- package/dist/client/assets/{use-bindings-CsTavmf-.js → use-bindings-CpyT6kNu.js} +1 -1
- package/dist/client/assets/{use-composer-prefs-BY2dTvep.js → use-composer-prefs-CK_EK_QJ.js} +1 -1
- package/dist/client/assets/{use-connector-management-L9l21yTi.js → use-connector-management-DwoK8kon.js} +1 -1
- package/dist/client/assets/{use-deep-link-scroll-Bn2ZUtDY.js → use-deep-link-scroll-CgRjt48R.js} +1 -1
- package/dist/client/assets/{use-delete-binding-DLvdHtPD.js → use-delete-binding-CfsnMXrL.js} +1 -1
- package/dist/client/assets/{use-dev-links-DFvL8mIg.js → use-dev-links-B3I-ZK34.js} +1 -1
- package/dist/client/assets/{use-external-adapter-catalog-Be57G4tz.js → use-external-adapter-catalog-aGlZNRrp.js} +1 -1
- package/dist/client/assets/{use-full-activity-feed-Cp3lYXdi.js → use-full-activity-feed-B61Olhdw.js} +1 -1
- package/dist/client/assets/use-is-below-desktop-Qwyg-mFb.js +1 -0
- package/dist/client/assets/use-is-hub-CSz6NDaP.js +1 -0
- package/dist/client/assets/{use-jump-back-in-ChH1FSEK.js → use-jump-back-in-C39GOTHa.js} +3 -3
- package/dist/client/assets/{use-local-browser-zA8gMhcC.js → use-local-browser-DCwzB4D8.js} +1 -1
- package/dist/client/assets/{use-mesh-topology-CvoD-L1G.js → use-mesh-topology-LRYxFuZp.js} +1 -1
- package/dist/client/assets/{use-mounted-ref-Ch0wqQry.js → use-mounted-ref-CZaegwTr.js} +1 -1
- package/dist/client/assets/{use-notification-prefs-DeR05zhp.js → use-notification-prefs-FtOiUS5H.js} +1 -1
- package/dist/client/assets/{use-panel-tab-placements-DdjrmaoK.js → use-panel-tab-placements-Dv2OPvKh.js} +1 -1
- package/dist/client/assets/use-pending-read-DBOl1ee_.js +1 -0
- package/dist/client/assets/{use-personality-commit-qQfISO2-.js → use-personality-commit-BB5aeh6p.js} +1 -1
- package/dist/client/assets/{use-promo-activation-CwGoE7b-.js → use-promo-activation-BW0u7n7m.js} +2 -2
- package/dist/client/assets/{use-promo-dismissals-BBqVN4hx.js → use-promo-dismissals-BOXzW4kD.js} +1 -1
- package/dist/client/assets/{use-pulse-freshness-BKW7tjvX.js → use-pulse-freshness-ClW-MLMo.js} +1 -1
- package/dist/client/assets/{use-relay-config-D5iieBXl.js → use-relay-config-hItHtkSr.js} +1 -1
- package/dist/client/assets/{use-room-follow-claim-BwZh2ZPH.js → use-room-follow-claim-wotzxUWc.js} +1 -1
- package/dist/client/assets/{use-roving-tab-list-Ct7yDAUE.js → use-roving-tab-list-DkbO6xSs.js} +1 -1
- package/dist/client/assets/use-session-canvas-C_fuAgW_.js +24 -0
- package/dist/client/assets/{use-session-diagnostics-Dn-Wnyhh.js → use-session-diagnostics-DmxvD-wy.js} +1 -1
- package/dist/client/assets/{use-unclaimed-chats-M-c5tjXH.js → use-unclaimed-chats-DKpexDm3.js} +1 -1
- package/dist/client/assets/use-update-config-CSYwg557.js +1 -0
- package/dist/client/assets/{useMutationState-Cd-VqRAv.js → useMutationState-Btf2Hp1a.js} +1 -1
- package/dist/client/assets/usecaseDiagram-WPOLBNNX-DRngjDUq.js +370 -0
- package/dist/client/assets/value-wA6veExk.js +1 -0
- package/dist/client/assets/vennDiagram-Q3Y3IDCW-iK-dlS1-.js +34 -0
- package/dist/client/assets/wardleyDiagram-IVAIDKWA-sOS67Cks.js +78 -0
- package/dist/client/assets/xychartDiagram-4URNHDU4-EgnLiIao.js +7 -0
- package/dist/client/index.html +1 -1
- package/dist/server/index.js +4223 -3493
- package/dist/server/index.js.map +2 -2
- package/package.json +6 -6
- package/dist/client/assets/BlintzCanvas-ClOKWzws.js +0 -1141
- package/dist/client/assets/CanvasFileContent-B_8zsIas.js +0 -2
- package/dist/client/assets/HandlePage-BdRWgke2.js +0 -1
- package/dist/client/assets/NamePage-DyH8JAqT.js +0 -1
- package/dist/client/assets/PhotoPage-BHvRQnex.js +0 -1
- package/dist/client/assets/TopologyGraph-D3CxaLGX.js +0 -30
- package/dist/client/assets/_shell.marketplace-DGN_IdZY.js +0 -1
- package/dist/client/assets/_shell.marketplace_.sources-2YMpLInp.js +0 -1
- package/dist/client/assets/_shell.x._extensionId-D3-n5IRW.js +0 -1
- package/dist/client/assets/_shell.x._extensionId_._-D3-n5IRW.js +0 -1
- package/dist/client/assets/index-DCOOlbEt.js +0 -1
- package/dist/client/assets/index-Dain_3cO.js +0 -1
- package/dist/client/assets/index-_5Dn0bFm.js +0 -74
- package/dist/client/assets/registry-Ce1VRIS3.js +0 -1
- package/dist/client/assets/use-is-below-desktop-DmekpHAF.js +0 -1
- package/dist/client/assets/use-is-hub-el7LTkg3.js +0 -1
- package/dist/client/assets/use-pending-read-DBpte0GI.js +0 -1
- package/dist/client/assets/use-session-canvas-CJrfZrYG.js +0 -24
- package/dist/client/assets/use-update-config-DhlbZldm.js +0 -1
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import{W as Rt,r as m,j as t,
|
|
1
|
+
import{W as Rt,r as m,j as t,gA as wt,a1 as ee,a3 as de,ji as ue,jj as V,jk as B,jl as St,c4 as Re,l as ge,a2 as bt,a4 as Te,jm as kt,jn as At,jo as Dt,jp as je,jq as ke,B as k,jr as Tt,ct as Et,js as Ge,d$ as ce,dU as Mt,dV as Ot,dW as It,dX as $t,dY as Kt,I as We,g9 as Ve,g$ as Ut,ga as Xe,gb as Ze,gc as et,gd as tt,ge as st,gf as nt,gg as _t,$ as Lt,jt as zt,iD as xe,cw as Ee,cx as Me,cz as Oe,cA as Ie,cB as $e,dw as Ke,dc as Ue,a7 as rt,ju as Pt,jv as qt,hi as Ft,jw as Ht,jx as _e,jy as Yt,jz as Bt,jA as at,jB as Jt,jC as it,jD as ot,jE as Qt,dI as lt,jF as Gt,jG as Wt,jH as Vt,iR as Xt,a0 as Zt,e2 as es,fp as ts,jI as ss,cD as ct,jJ as ns,jK as rs,ad as as,n as He}from"./index-DcZPWi_I.js";import{T as is,R as os,a as ls}from"./RoomSurface-BIyjtxKD.js";import{M as pe,C as Ne}from"./index-Cp3yShS8.js";import{M as cs}from"./markdown-content-Cqq_QMXA.js";import{o as ds,a as us,c as ms}from"./owner-notice-ByjrIRmX.js";import"./use-jump-back-in-C39GOTHa.js";import"./use-room-follow-claim-wotzxUWc.js";import"./WidgetErrorCard-Dx5oPMlF.js";import"./index-1ShgR_xt.js";import"./card-ww4ebz8h.js";import"./progress-DlIRjXIA.js";import"./table-L7FvN6Or.js";import"./terminal-C9M5a_PS.js";import"./package-6Rbxg35g.js";import"./heart-CmqGJPDc.js";import"./git-branch-B2k77X3Q.js";import"./file-text-C1ougnBY.js";import"./file-Bf7D_47y.js";import"./find-latest-widget-fence-B1_-pC-Z.js";import"./format-duration-BCr6uzby.js";import"./RuntimeSetupDialog-BK9yo7YF.js";import"./inline-code-g9PVHZI2.js";import"./list-runtime-types-8YGEK3Al.js";import"./RuntimeConnectFlow-ChrvjC84.js";import"./useMutationState-Btf2Hp1a.js";import"./runtime-connect-Dn0T5YWv.js";import"./mention-pill-Bnzt4u2l.js";import"./rotate-ccw-clock-CeY00nlZ.js";import"./unplug-CFUEVRbc.js";import"./message-square-off-BX2XnEDx.js";import"./registry-DS1Ghdft.js";import"./use-connector-management-DwoK8kon.js";import"./AgentRequestCard-CamX7Tvr.js";import"./access-copy-CW-z1oMH.js";import"./query-error-state-DB-Jby7_.js";import"./empty-state-DXWQsHMf.js";import"./use-bindings-CpyT6kNu.js";import"./connection-copy--MA7AN04.js";import"./KeyEntry-CRr32Ae5.js";import"./file-drag-GDx2qhdk.js";import"./paperclip-B-jDXtxw.js";import"./index-yI1r4pSP.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 dt={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"}]]};dt.node;const fs=Rt(dt),ps=5e3;function hs({connection:e}){var d;const s=e.official===!0&&e.status==="connected"&&((d=e.access)==null?void 0:d.state)==="unverified",n=m.useMemo(()=>s?{}:null,[s]),[r,o]=m.useState(null);return m.useEffect(()=>{if(!n)return;const f=setTimeout(()=>o(n),ps);return()=>clearTimeout(f)},[n]),n===null||r!==n?null:t.jsx(wt,{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."})}const gs=500,ie=new Map;function ut(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 De(e,s){if(s.size===0)return e;let n=!1;const r=e.map(o=>{const d=s.get(o.id),f=d?ut(o,d):o;return f!==o&&(n=!0),f});return n?r:e}function Ce(e,s,...n){const r=new Map;for(const o of n)for(const d of o){if(d.community!==e||d.roomId!==s)throw new Error("Community history contains a different room.");r.set(d.id,d)}return[...r.values()].sort((o,d)=>o.remoteSeq-d.remoteSeq)}function xs(e,s,n=!0,r=0,o="legacy",d=!1,f){const l=ee(),a=m.useRef(f);m.useEffect(()=>{a.current=f},[f]);const i=de(),h=ue(!0,o,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]),[N,C]=m.useState(()=>({address:u,room:null,entries:[],revisions:ie,deliveries:[],status:"connecting"}));return m.useEffect(()=>{if(!h||!n)return;const v=h,w=new AbortController;let x,O=0,A,z,F=!1;C({address:u,room:null,entries:[],revisions:ie,deliveries:[],status:"connecting"});function M(){F=!0,A=void 0,z=void 0,i.removeQueries({queryKey:B.remote(v,e)}),C({address:u,room:null,entries:[],revisions:ie,deliveries:[],status:"removed"})}async function q(){try{await l.subscribeRemoteCommunityRoom(e,s,j=>{var $;if(!(w.signal.aborted||F||!V(v))){if(j.type==="closed"){(j.reason==="removed"||j.reason==="revoked")&&M();return}if(O=0,j.type==="snapshot")A=j.cursor??void 0,j.redactionCursor&&(z=j.redactionCursor),i.setQueryData(B.room(v,e,s),j.room),C(y=>({address:u,room:j.room,entries:De(Ce(e,s,y.address===u?y.entries:[],j.entries).slice(-500),y.address===u?y.revisions:ie),revisions:y.address===u?y.revisions:ie,deliveries:y.deliveries.filter(g=>!j.entries.some(
|
|
6
|
+
*/const dt={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"}]]};dt.node;const fs=Rt(dt),ps=5e3;function hs({connection:e}){var d;const s=e.official===!0&&e.status==="connected"&&((d=e.access)==null?void 0:d.state)==="unverified",n=m.useMemo(()=>s?{}:null,[s]),[r,o]=m.useState(null);return m.useEffect(()=>{if(!n)return;const f=setTimeout(()=>o(n),ps);return()=>clearTimeout(f)},[n]),n===null||r!==n?null:t.jsx(wt,{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."})}const gs=500,ie=new Map;function ut(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 De(e,s){if(s.size===0)return e;let n=!1;const r=e.map(o=>{const d=s.get(o.id),f=d?ut(o,d):o;return f!==o&&(n=!0),f});return n?r:e}function Ce(e,s,...n){const r=new Map;for(const o of n)for(const d of o){if(d.community!==e||d.roomId!==s)throw new Error("Community history contains a different room.");r.set(d.id,d)}return[...r.values()].sort((o,d)=>o.remoteSeq-d.remoteSeq)}function xs(e,s,n=!0,r=0,o="legacy",d=!1,f){const l=ee(),a=m.useRef(f);m.useEffect(()=>{a.current=f},[f]);const i=de(),h=ue(!0,o,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]),[N,C]=m.useState(()=>({address:u,room:null,entries:[],revisions:ie,deliveries:[],status:"connecting"}));return m.useEffect(()=>{if(!h||!n)return;const v=h,w=new AbortController;let x,O=0,A,z,F=!1;C({address:u,room:null,entries:[],revisions:ie,deliveries:[],status:"connecting"});function M(){F=!0,A=void 0,z=void 0,i.removeQueries({queryKey:B.remote(v,e)}),C({address:u,room:null,entries:[],revisions:ie,deliveries:[],status:"removed"})}async function q(){try{await l.subscribeRemoteCommunityRoom(e,s,j=>{var $;if(!(w.signal.aborted||F||!V(v))){if(j.type==="closed"){(j.reason==="removed"||j.reason==="revoked")&&M();return}if(O=0,j.type==="snapshot")A=j.cursor??void 0,j.redactionCursor&&(z=j.redactionCursor),i.setQueryData(B.room(v,e,s),j.room),C(y=>({address:u,room:j.room,entries:De(Ce(e,s,y.address===u?y.entries:[],j.entries).slice(-500),y.address===u?y.revisions:ie),revisions:y.address===u?y.revisions:ie,deliveries:y.deliveries.filter(g=>!j.entries.some(K=>K.originIdempotencyKey===g.idempotencyKey)),status:j.stale?"offline":"live"}));else if(j.type==="revision"){const y=j.entry;j.redactionCursor&&(z=j.redactionCursor);const g=[...B.room(v,e,s),"entries"],b=i.getQueriesData({queryKey:g}).some(([,S])=>S==null?void 0:S.pages.some(_=>_.entries.some(H=>H.id===y.id)))||i.isFetching({queryKey:g})>0||(($=a.current)==null?void 0:$.call(a,y.id))===!0;i.setQueriesData({queryKey:g},S=>{if(!S)return S;let _=!1;const H=S.pages.map(X=>{const re=X.entries.map(Z=>ut(Z,y));return re.some((Z,me)=>Z!==X.entries[me])?(_=!0,{...X,entries:re}):X});return _?{...S,pages:H}:S}),C(S=>{if(!b&&!S.entries.some(H=>H.id===y.id))return S;const _=new Map(S.revisions);for(_.delete(y.id),_.set(y.id,y);_.size>gs;)_.delete(_.keys().next().value);return{...S,entries:De(S.entries,_),revisions:_}})}else j.type==="deliveries"?C(y=>({...y,deliveries:j.deliveries.filter(g=>!y.entries.some(K=>K.originIdempotencyKey===g.idempotencyKey))})):(A=j.entry.cursor,C(y=>({...y,entries:Ce(e,s,y.entries,[j.entry]).slice(-500),deliveries:y.deliveries.filter(g=>g.idempotencyKey!==j.entry.originIdempotencyKey),status:"live"})))}},{since:A,redactions:z,signal:w.signal})}catch(j){if(w.signal.aborted||!V(v))return;const $=j&&typeof j=="object"&&"status"in j?j.status:void 0,y=j&&typeof j=="object"&&"code"in j?j.code:void 0;y==="COMMUNITY_DELETED"||y==="COMMUNITY_TAKEN_DOWN"?(M(),i.invalidateQueries({queryKey:B.connections(v)})):$===401||$===403||$===404?M():$===410&&y==="COMMUNITY_CURSOR_STALE"&&(A=void 0)}if(w.signal.aborted||F||!V(v))return;const U=i.getQueryData(B.room(v,e,s));U&&i.setQueryData(B.room(v,e,s),{...U,stale:!0,writable:!1}),C(j=>({...j,room:j.room?{...j.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,r,i,l,h,d]),N.address!==u||!h?{address:u,room:null,entries:[],revisions:ie,deliveries:[],status:"connecting"}:n?N:d?{...N,room:N.room?{...N.room,stale:!0,writable:!1}:null,deliveries:[],status:"offline"}:{address:u,room:null,entries:[],revisions:ie,deliveries:[],status:"removed"}}function ys(e,s,n){var l;const r=St(),o=Re(),d=e!==void 0&&((l=r.room)==null?void 0:l.id)===e,f=r.status!=="loading";return m.useEffect(()=>{d&&o({...ge.home(),search:{...s===void 0?{}:{thread:s},...n===void 0?{}:{entry:n}},replace:!0})},[d,s,n,o]),e===void 0?"show":d?"redirecting":f?"show":"pending"}function vs(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 js=new Set(["COMMUNITY_MUTED","COMMUNITY_SLOW_MODE","COMMUNITY_RULES_NOT_ACCEPTED"]);function Ns(e){const s=e==null?void 0:e.code;return typeof s=="string"&&js.has(s)}function Cs(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 Rs(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 ws({community:e,roomId:s,enabled:n,accessFingerprint:r}){var F;const o=ee(),d=de(),f=ue(n,r,e),l=f?[...B.room(f,e,s),"standing"]:[...B.all,"owner","unresolved",e,"room",s,"standing"],a=bt({queryKey:l,queryFn:()=>At(f,()=>o.getRemoteCommunityStanding(e,s)),enabled:n&&f!==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}}),[i,h]=m.useState(null),[u,N]=m.useState(()=>Date.now()),C=(F=a.data)!=null&&F.mutedUntil?Date.parse(a.data.mutedUntil):null;m.useEffect(()=>{if(i!==null&&i>u){const M=setTimeout(()=>N(Date.now()),1e3);return()=>clearTimeout(M)}if(C!==null&&C>u){const M=setTimeout(()=>N(Date.now()),Math.min(C-u+50,1073741824));return()=>clearTimeout(M)}},[C,u,i]);const v=a.refetch,w=m.useCallback(M=>{if((M==null?void 0:M.code)==="COMMUNITY_SLOW_MODE"){const U=M.retryAfterMs;if(typeof U=="number"&&U>0){const j=Date.now();N(j),h(j+U)}return}v()},[v]),x=Te({meta:{suppressErrorToast:!0},mutationFn:M=>o.acceptRemoteCommunityRules(e,M),onSuccess:M=>{d.setQueryData(l,q=>q&&{...q,rules:M})},onError:()=>void v()}),O=Rs(a.data,u),A=i===null?0:Math.ceil((i-u)/1e3),z=O??(A>0?{kind:"slow",secondsLeft:A}:null);return{standing:a.data,hold:z,noteHold:w,accept:x}}const Ss=new Set(["COMMUNITY_DELETED","COMMUNITY_TAKEN_DOWN"]),bs=30*6e4,he=new Map;function mt(e,s,n){return JSON.stringify([e,s,n])}function ft(e){return Date.now()-e<bs}function ks(e){for(const[s,n]of he)ft(n.at)||he.delete(s);return he.get(e)}function As(){return Date.now()}function Ds(e,s,n){he.set(e,{attachmentId:s,at:n})}function Ye(e){for(const s of e.files)he.delete(mt(e.ref,e.roomId,s.id))}function Be(e){return e.filter(s=>s.trim()).join(`
|
|
7
7
|
|
|
8
|
-
`)}function Ts(e){const s=e==null?void 0:e.code;return typeof s=="string"&&Ss.has(s)}function Ae(e){return e.map(({id:s,file:n})=>({id:s,file:n,status:"pending",progress:0}))}function Es({ref:e,roomId:s,canSend:n,entries:r,onReceipt:o,draft:d,ownerKey:f,contextKey:l=f,onHold:a}){const i=ee(),h=JSON.stringify([f,e,s,l]),u=Dt(d),N=u.text,C=m.useMemo(()=>Ae(u.files),[u.files]),v=m.useRef(d);m.useLayoutEffect(()=>{v.current=d},[d]);function w(c){const R=v.current;if(!R)return;const I=je.getState(),T=I.drafts[ke(R)],E=c({text:(T==null?void 0:T.text)??"",files:Ae((T==null?void 0:T.files)??[])});I.write(R,{text:E.text,files:E.files.map(({id:P,file:Q})=>({id:P,file:Q}))})}function x(c){w(R=>({...R,text:c}))}function O(c){w(R=>({...R,files:c(R.files)}))}const[A,z]=m.useState(null);function F(c){z(c===null?null:{address:h,context:l,message:c})}const[M,q]=m.useState([]),K=m.useRef(new Map),j=m.useRef(0),$=m.useRef(new Map),y=m.useRef(new Set),g=m.useRef(h),U=m.useRef(l),b=m.useRef(!0),S=m.useRef(n),_=m.useRef(o),H=m.useRef(a);m.useLayoutEffect(()=>{g.current=h,U.current=l,S.current=n,_.current=o,H.current=a},[h,n,l,o,a]),m.useEffect(()=>(b.current=!0,()=>{b.current=!1}),[]),m.useEffect(()=>{let c=!1;for(const R of r){if(!R.originIdempotencyKey)continue;const I=K.current.get(R.originIdempotencyKey);(I==null?void 0:I.address)===g.current&&I.context===U.current&&K.current.delete(R.originIdempotencyKey)&&(Ye(I),c=!0)}c&&q([...K.current.values()])},[r]);function X(){b.current&&q([...K.current.values()].filter(c=>c.address===g.current&&c.context===U.current).map(c=>({...c})))}async function re(c){var R,I;if(!(y.current.has(c.key)||!S.current||!b.current||c.address!==g.current)){y.current.add(c.key),c.status="sending",c.error=void 0,X();try{!c.posted&&c.uploadedAt.some(E=>!ft(E))&&(c.attachmentIds=[],c.uploadedAt=[],c.triedAt=[],c.uploadRound+=1);for(let E=c.attachmentIds.length;E<c.files.length;E++){if(!S.current||!b.current||c.address!==g.current)throw new Error("Reconnect to this channel, then try again.");const P=c.files[E],Q=mt(c.ref,c.roomId,P.id),J=ks(Q);if(J){c.attachmentIds.push(J.attachmentId),c.uploadedAt.push(J.at);continue}const te=(R=c.triedAt)[E]??(R[E]=As()),G=await i.uploadRemoteCommunityAttachment(c.ref,c.roomId,P.file,c.uploadRound?`${c.key}:file:${E}:${c.uploadRound}`:`${c.key}:file:${E}`);Ds(Q,G.id,te),c.uploadedAt.push(te),c.attachmentIds.push(G.id)}if(!S.current||!b.current||c.address!==g.current)throw new Error("Reconnect to this channel, then try again.");c.posted=!0;const T=await i.postRemoteCommunityEntry(c.ref,c.roomId,{text:c.text,parentEntryId:c.parentEntryId,attachmentIds:c.attachmentIds,idempotencyKey:c.key});K.current.delete(c.key),Ye(c),b.current&&c.address===g.current&&c.context===U.current&&_.current(T)}catch(T){if(Ts(T)&&Z(c)){K.current.delete(c.key);return}if(Ns(T)&&Z(c)){K.current.delete(c.key),b.current&&c.address===g.current&&((I=H.current)==null||I.call(H,T));return}c.status="failed",c.error=T instanceof Error?T.message:"Not confirmed. Try this message again."}finally{y.current.delete(c.key),X()}}}function Z(c){const{draft:R}=c.origin,I=ke(R),T=je.getState(),E=T.drafts[I],P=(E==null?void 0:E.text)??"";let Q=$.current.get(I)??[];const J=Be(Q.map(W=>W.origin.typed));let te=P;J&&P.startsWith(J)?te=P.slice(J.length).replace(/^\n+/,""):Q=[];const G=[...Q,c].sort((W,se)=>W.origin.seq-se.origin.seq),ye=new Set(G.flatMap(W=>W.files.map(se=>se.id))),ae=[...G.flatMap(W=>W.files.map(({id:se,file:fe})=>({id:se,file:fe}))),...((E==null?void 0:E.files)??[]).filter(W=>!ye.has(W.id))];return T.write(R,{text:Be([...G.map(W=>W.origin.typed),te]),files:ae}),I in je.getState().drafts?($.current.set(I,G),!0):!1}function me(c){const R=v.current;if(!R||!S.current)return;const I=je.getState(),T=I.drafts[ke(R)];if(!T||!T.text.trim()&&T.files.length===0)return;if(K.current.size>=30){F("Too many messages waiting. Let them send, or retry them first.");return}const E=I.take(R),P=Ae(E.files),Q={address:h,context:l,ref:e,roomId:s,key:crypto.randomUUID(),text:E.text.trim()?E.text:P.map(J=>J.file.name).join(", "),parentEntryId:c,files:P,attachmentIds:[],uploadedAt:[],triedAt:[],posted:!1,uploadRound:0,status:"sending",origin:{draft:R,typed:E.text,seq:j.current+=1}};K.current.set(Q.key,Q),F(null),re(Q)}return{text:N,setText:x,attachments:{staged:C,add(c){if(c.some(R=>R.size>25*1024*1024)){F("Each file must be 25 MB or smaller.");return}O(R=>R.length+c.length>8?(F("Attach up to eight files to one message."),R):[...R,...c.map(I=>({id:crypto.randomUUID(),file:I,status:"pending",progress:0}))])},remove(c){O(R=>R.filter(I=>I.id!==c))},retry(){},cancel(){O(()=>[])},hasFailed:!1,isUploading:!1,holdsSendWhileUploading:!1},deliveries:M.filter(c=>c.address===h&&c.context===l),error:(A==null?void 0:A.address)===h&&A.context===l?A.message:null,send:me,retry(c){const R=K.current.get(c);R&&re(R)}}}function pt({entry:e,onThread:s,onReport:n}){const r=ee(),o=m.useId(),[d,f]=m.useState(null),[l,a]=m.useState(null),i={id:JSON.stringify([e.community,e.authorId]),kind:e.authorKind,displayName:e.authorDisplayName};async function h(u,N){if(l)return;a(u),f(null);let C;try{const v=await r.downloadRemoteCommunityAttachment(e.community,e.roomId,u);C=URL.createObjectURL(v);const w=document.createElement("a");w.href=C,w.download=Array.from(N,x=>x==="/"||x==="\\"||x.charCodeAt(0)<32?"_":x).join(""),document.body.append(w),w.click(),w.remove()}catch(v){f(v instanceof Error?v.message:"Couldn’t download the file. Try again.")}finally{C&&setTimeout(()=>URL.revokeObjectURL(C),1e3),a(null)}}return t.jsxs(pe.Root,{role:e.authorKind==="human"?"user":"assistant","aria-labelledby":o,children:[t.jsx(pe.Gutter,{author:i,at:e.createdAt}),t.jsxs(pe.Body,{children:[t.jsx(pe.Author,{id:o,author:i,at:e.createdAt}),t.jsxs(pe.Content,{children:[t.jsx(cs,{content:e.text}),e.attachments.map(u=>t.jsx(k,{variant:"outline",size:"sm",disabled:l!==null,onClick:()=>void h(u.id,u.name),className:"max-w-full",children:t.jsx("span",{className:"min-w-0 truncate",children:l===u.id?"Downloading…":u.name})},u.id)),d&&t.jsx("p",{role:"alert",className:"text-destructive text-sm",children:d}),s&&t.jsx(k,{variant:"ghost",size:"sm",onClick:()=>s(e.threadRootEntryId??e.id),children:e.depth===0?"Reply in thread":"Open thread"}),n&&t.jsx(k,{variant:"ghost",size:"sm",onClick:n,children:"Report"})]})]})]})}function Ms({community:e,roomId:s,online:n,canEnroll:r,accessFingerprint:o}){var y,g,U;const d=ee(),f=de(),l=ue(!0,o,e),a=Tt(e,r,o),i=Et(),h=Ge(e,r,o),[u,N]=m.useState(""),[C,v]=m.useState(""),[w,x]=m.useState(!1),[O,A]=m.useState(null),[z,F]=m.useState(null),M=m.useId(),q=((y=a.data)==null?void 0:y.filter(b=>b.active))??[],K=((g=i.data)==null?void 0:g.agents.filter(b=>!q.some(S=>S.localAgentId===b.id)))??[];async function j(){l&&V(l)&&await f.invalidateQueries({queryKey:B.remote(l,e)})}async function $(b){if(b.preventDefault(),!u||w||!n||!r||!l)return;const S=l;x(!0),A(null);try{if(await d.enrollRemoteCommunityAgent(e,u,C.trim()?{handle:C.trim()}:{}),!V(S))return;N(""),v(""),await j()}catch(_){V(S)&&A(_ instanceof Error?_.message:"Couldn’t add the agent. Try again.")}finally{V(S)&&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."}),a.isError&&t.jsxs("p",{role:"alert",children:["Couldn’t load your agents in this space."," ",t.jsx(k,{variant:"ghost",size:"sm",onClick:()=>void a.refetch(),children:"Retry"})]}),(U=a.data)==null?void 0:U.map(b=>{var S;return t.jsx(Os,{agent:b,roomId:s,online:n,canEnroll:r,takesDms:((S=h.data)==null?void 0:S.available)===!0,onChanged:j,onNotice:F},b.localAgentId)}),i.isError&&t.jsx("p",{role:"alert",children:"Couldn’t load the agents on this computer."}),r&&K.length>0&&t.jsxs("form",{onSubmit:b=>void $(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(ce,{htmlFor:`${M}-agent`,children:"Local agent"}),t.jsxs(Mt,{value:u,onValueChange:N,disabled:!n||w,children:[t.jsx(Ot,{id:`${M}-agent`,children:t.jsx(It,{placeholder:"Choose an agent"})}),t.jsx($t,{children:K.map(b=>t.jsx(Ut,{value:b.id,children:b.name},b.id))})]})]}),t.jsxs("div",{className:"min-w-40 flex-1 space-y-1",children:[t.jsx(ce,{htmlFor:`${M}-handle`,children:"Space handle (optional)"}),t.jsx(We,{id:`${M}-handle`,value:C,onChange:b=>v(b.target.value),disabled:!n||w,placeholder:"Use the agent’s handle"})]}),t.jsx(k,{type:"submit",disabled:!u||!n||w,children:w?"Adding…":"Add to space"})]}),z&&t.jsx("p",{role:"status",className:"text-muted-foreground text-sm",children:z}),O&&t.jsx("p",{role:"alert",className:"text-destructive text-sm",children:O})]})}function Os({agent:e,roomId:s,online:n,canEnroll:r,takesDms:o,onChanged:d,onNotice:f}){const l=ee(),[a,i]=m.useState(null),[h,u]=m.useState(null),N=e.roomIds.includes(s),C=m.useId();async function v(x,O){if(!a){i(x),u(null);try{await O(),await d()}catch(A){u(A instanceof Error?A.message:"Couldn’t finish that. Try again.")}finally{i(null)}}}function w(x){f(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(k,{variant:"outline",size:"sm",disabled:a!==null||!r||!e.active||!N&&!n,onClick:()=>void v("membership",async()=>{N?w(await l.leaveRemoteCommunityAgentRoom(e.community,s,e.localAgentId)):await l.joinRemoteCommunityAgentRoom(e.community,s,e.localAgentId)}),children:N?"Leave channel":"Join channel"}),t.jsx(k,{variant:"ghost",size:"sm",disabled:a!==null||!r,onClick:()=>void v("stop",()=>l.haltRemoteCommunityAgent(e.community,s,e.localAgentId)),children:"Stop agent"}),t.jsxs(Ve,{children:[t.jsx(Kt,{asChild:!0,children:t.jsx(k,{variant:"ghost",size:"sm",disabled:a!==null||!r,children:"Remove from space"})}),t.jsxs(Xe,{children:[t.jsxs(Ze,{children:[t.jsxs(et,{children:["Remove ",e.displayName,"?"]}),t.jsx(tt,{children:"It leaves every channel in this space. You can re-add it."})]}),t.jsxs(st,{children:[t.jsx(nt,{children:"Cancel"}),t.jsx(_t,{onClick:()=>void v("remove",async()=>w(await l.ejectRemoteCommunityAgent(e.community,e.localAgentId))),children:"Remove agent"})]})]})]})]}),o&&e.active&&t.jsxs("div",{className:"flex items-center gap-2",children:[t.jsx(Lt,{id:C,checked:e.acceptsDms===!0,disabled:a!==null||!r||!n,onCheckedChange:x=>void v("dms",()=>l.setRemoteCommunityAgentDms(e.community,e.localAgentId,x))}),t.jsx(ce,{htmlFor:C,className:"text-xs font-normal",children:"Takes direct messages"})]}),h&&t.jsx("p",{role:"status",className:"text-muted-foreground text-xs",children:h})]})}function Is({community:e,agent:s,disabled:n,accessFingerprint:r}){const o=ee(),d=Re(),f=de(),l=ue(!0,r,e),[a,i]=m.useState(!1),[h,u]=m.useState(null);async function N(){if(!a){i(!0),u(null);try{const C=await o.startRemoteCommunityDm(e,s.memberId);l&&await f.invalidateQueries({queryKey:B.dms(l,e)}),d({...ge.channels(),search:{community:e,id:C.roomId}})}catch(C){u(C.code===zt?`${s.displayName} isn’t taking direct messages.`:"Couldn’t open the direct message. Try again.")}finally{i(!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(k,{variant:"ghost",size:"sm",disabled:n||a,onClick:()=>void N(),"aria-label":`Message ${s.displayName}`,children:"Message"})]})}function $s(e,s){const n=new Date(e),r=n.toLocaleTimeString([],{hour:"numeric",minute:"2-digit"});return n.toDateString()===s.toDateString()?r:`${n.toLocaleDateString([],{month:"short",day:"numeric",...n.getFullYear()===s.getFullYear()?{}:{year:"numeric"}})}, ${r}`}function Us(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:$s(e.lastSeenAt,s)}}:null}function Ks({roster:e,failed:s,canMention:n,onMention:r,community:o,roomId:d,online:f,canEnroll:l,agentsKey:a,accessFingerprint:i}){var C,v,w;const u=((C=Ge(o,!0,i).data)==null?void 0:C.available)===!0,N=(w=(v=xe().data)==null?void 0:v.find(x=>x.ref===o))==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=Us(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(z=>z.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!==N&&t.jsx(Is,{community:o,agent:x,disabled:!f,accessFingerprint:i}),x.handle&&t.jsxs(k,{variant:"ghost",size:"sm",disabled:!n,onClick:()=>r(x.handle),children:["Mention @",x.handle]})]})]},x.memberId)}),l&&t.jsx(Ms,{community:o,roomId:d,online:f,canEnroll:!0,accessFingerprint:i},a)]})}function ht(e,s){return e instanceof Error&&e.message?e.message:s}function _s({conduct:e,staff:s,onReadRules:n}){const{hold:r,standing:o}=e;return(r==null?void 0:r.kind)==="rules"?t.jsx("div",{className:"px-1 pb-1",children:t.jsx(k,{size:"sm",variant:"outline",onClick:n,children:"Read the rules"})}):r||s||!(o!=null&&o.slowModeSeconds)?null:t.jsxs("p",{className:"text-muted-foreground px-1 pb-1 text-xs",children:["Slow mode: one message every ",o.slowModeSeconds,"s."]})}function Ls({conduct:e,open:s,onOpenChange:n}){var d;const r=(d=e.standing)==null?void 0:d.rules,o=r?r.acceptedVersion>=r.version:!1;return t.jsx(Ee,{open:s,onOpenChange:n,children:t.jsxs(Me,{className:"sm:max-w-lg",children:[t.jsxs(Oe,{children:[t.jsx(Ie,{children:"Space rules"}),t.jsx($e,{children:o?"You accepted these rules.":"Accept these rules to post here."})]}),t.jsxs(Ue,{children:[t.jsx("div",{className:"max-h-[50vh] overflow-y-auto rounded-md border p-3 text-sm leading-relaxed whitespace-pre-wrap",children:(r==null?void 0:r.text)??"This space has no rules."}),e.accept.error&&t.jsx("p",{role:"alert",className:"text-destructive mt-2 text-sm",children:ht(e.accept.error,"Couldn’t accept the rules. Try again.")})]}),t.jsxs(Ke,{children:[t.jsx(k,{variant:"outline",onClick:()=>n(!1),children:"Close"}),(r==null?void 0:r.text)&&!o&&t.jsx(k,{disabled:e.accept.isPending,onClick:()=>e.accept.mutate(r.version,{onSuccess:()=>n(!1)}),children:e.accept.isPending?"Accepting…":"Accept rules"})]})]})})}function zs({community:e,accessFingerprint:s,currentName:n,open:r,onOpenChange:o}){return t.jsx(Ee,{open:r,onOpenChange:o,children:t.jsx(Me,{className:"sm:max-w-md",children:r&&t.jsx(Ps,{community:e,accessFingerprint:s,currentName:n,onDone:()=>o(!1)})})})}function Ps({community:e,accessFingerprint:s,currentName:n,onDone:r}){const o=ee(),d=de(),f=ue(!0,s,e),[l,a]=m.useState(n),i=Te({meta:{suppressErrorToast:!0},mutationFn:u=>o.setRemoteCommunityDisplayName(e,u),onSuccess:async()=>{f&&await d.invalidateQueries({queryKey:B.content(f,e)}),r()}}),h=l.trim();return t.jsxs("form",{onSubmit:u=>{u.preventDefault(),h&&h!==n&&i.mutate(h)},children:[t.jsxs(Oe,{children:[t.jsx(Ie,{children:"Your name in this space"}),t.jsx($e,{children:"Other spaces keep the name they show."})]}),t.jsxs(Ue,{className:"space-y-2",children:[t.jsx(ce,{htmlFor:"remote-community-display-name",children:"Name"}),t.jsx(We,{id:"remote-community-display-name",value:l,maxLength:128,autoComplete:"nickname",onChange:u=>a(u.target.value)}),i.error&&t.jsx("p",{role:"alert",className:"text-destructive text-sm",children:ht(i.error,"Couldn’t change your name. Try again.")})]}),t.jsxs(Ke,{children:[t.jsx(k,{type:"button",variant:"outline",onClick:r,children:"Cancel"}),t.jsx(k,{type:"submit",disabled:!h||h===n||i.isPending,children:i.isPending?"Saving…":"Save name"})]})]})}const qs=[{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 Fs({entry:e,onClose:s}){return t.jsx(Ee,{open:e!==null,onOpenChange:n=>!n&&s(),children:t.jsx(Me,{className:"sm:max-w-md",children:e&&t.jsx(Hs,{entry:e,onClose:s},e.id)})})}function Hs({entry:e,onClose:s}){const n=ee(),r=m.useId(),[o,d]=m.useState(null),[f,l]=m.useState(""),a=Te({meta:{suppressErrorToast:!0},mutationFn:i=>n.reportRemoteCommunityEntry(e.community,e.roomId,e.id,i),onSuccess:()=>{rt("Message reported"),s()}});return t.jsxs("form",{onSubmit:i=>{i.preventDefault(),o&&a.mutate({reason:o,...f.trim()?{note:f.trim()}:{}})},children:[t.jsxs(Oe,{children:[t.jsx(Ie,{children:"Report message"}),t.jsx($e,{children:"This space’s owners and admins review reports."})]}),t.jsxs(Ue,{className:"space-y-4",children:[t.jsxs("p",{className:"text-muted-foreground line-clamp-3 text-sm",children:[e.authorDisplayName,": ",e.text]}),t.jsx(Pt,{"aria-label":"Reason",value:o??"",onValueChange:i=>d(i),children:qs.map(i=>t.jsxs("div",{className:"flex items-center gap-2",children:[t.jsx(qt,{value:i.value,id:`${r}-${i.value}`}),t.jsx(ce,{htmlFor:`${r}-${i.value}`,children:i.label})]},i.value))}),t.jsxs("div",{className:"space-y-1.5",children:[t.jsx(ce,{htmlFor:`${r}-note`,children:"Note (optional)"}),t.jsx(Ft,{id:`${r}-note`,value:f,maxLength:Ht,onChange:i=>l(i.target.value),rows:3}),t.jsx("p",{className:"text-muted-foreground text-xs",children:"Only owners and admins see this."})]}),a.error&&t.jsx("p",{role:"alert",className:"text-destructive text-sm",children:a.error instanceof Error&&a.error.message?a.error.message:"Couldn’t send the report. Try again."})]}),t.jsxs(Ke,{children:[t.jsx(k,{type:"button",variant:"outline",onClick:s,children:"Cancel"}),t.jsx(k,{type:"submit",disabled:!o||a.isPending,children:a.isPending?"Sending…":"Send report"})]})]})}function Ys({agentDeliveries:e,drafts:s,entries:n,threadId:r,canSend:o,action:d,onRetryAgent:f,onRetryDraft:l}){return t.jsxs(t.Fragment,{children:[e.filter(a=>a.parentEntryId===(r??null)&&!n.some(i=>i.originIdempotencyKey===a.idempotencyKey)).map(a=>t.jsxs("div",{className:"border-t px-4 py-2 text-sm",role:"status",children:[t.jsxs("p",{className:"font-medium",children:[a.author.displayName," · Agent"]}),t.jsx("p",{className:"whitespace-pre-wrap",children:a.text}),a.attachments.map((i,h)=>t.jsx("span",{className:"mr-2",children:i.name},h)),t.jsx("p",{className:"text-muted-foreground",children:a.state==="pending"?"Waiting for the space to confirm…":a.failure==="expired"?"Not confirmed. Too late to try again.":"Not confirmed. Check the space and the agent’s channel access."}),a.state==="pending"&&a.retryable&&t.jsx(k,{variant:"outline",size:"sm",disabled:!o||d!==null,onClick:()=>f(a.idempotencyKey),children:d===`retry:${a.idempotencyKey}`?"Retrying…":"Retry now"})]},a.idempotencyKey)),s.filter(a=>a.parentEntryId===r&&!n.some(i=>i.originIdempotencyKey===a.key)).map(a=>t.jsxs("div",{className:"border-t px-4 py-2 text-sm",role:"status",children:[t.jsx("p",{className:"whitespace-pre-wrap",children:a.text}),a.files.map(i=>t.jsx("span",{className:"mr-2",children:i.file.name},i.id)),t.jsx("p",{className:"text-muted-foreground",children:a.status==="sending"?"Sending…":"Delivery not confirmed."}),a.error&&t.jsx("p",{children:a.error}),a.status==="failed"&&t.jsx(k,{variant:"outline",size:"sm",disabled:!o,onClick:()=>l(a.key),children:"Retry message"})]},a.key))]})}function Bs(e,s){var d;const n=new Map;for(const f of e)f.thread&&n.set(f.id,{count:f.thread.replyCount,lastAt:f.thread.lastReplyAt,through:f.threadLastReplySeq});const r=new Map;for(const f of s){const l=f.threadRootEntryId;if(f.depth===0||l===null)continue;const a=(d=n.get(l))==null?void 0:d.through;if(a!==void 0&&f.remoteSeq<=a)continue;const i=r.get(l);r.set(l,{count:((i==null?void 0:i.count)??0)+1,newest:i&&i.newest.remoteSeq>f.remoteSeq?i.newest:f})}const o=new Map;for(const f of new Set([...n.keys(),...r.keys()])){const l=n.get(f),a=r.get(f),i=l===void 0?a.count:l.through===void 0?Math.max(l.count,(a==null?void 0:a.count)??0):l.count+((a==null?void 0:a.count)??0);o.set(f,{count:i,lastAt:(a==null?void 0:a.newest.createdAt)??l.lastAt,unread:0})}return o}const Qs={reactions:!1,threads:!0,runWith:!1,attachments:!0,mentions:!0,streamHealth:!0,presence:!1,turnStatus:!1,asks:!1};function Js({community:e,roomId:s,threadId:n,onThread:r,dmAgentName:o}){var ze,Pe,qe,Fe;const d=ee(),l=(ze=xe().data)==null?void 0:ze.find(p=>p.ref===e),a=_e(l==null?void 0:l.access),i=ue(!0,a.fingerprint,e),{ownerAddress:h,contextAddress:u}=vs(i),N=de(),C=Yt(),v=Bt(),w=(Pe=C.data)==null?void 0:Pe.destinations.find(p=>p.ref===e&&p.roomId===s),x=m.useRef(null),O=m.useRef(void 0),A=(w==null?void 0:w.scrollAnchorEntryId)??null,z=m.useCallback(p=>{if(!i||n)return;x.current&&clearTimeout(x.current),x.current=null;const D=p??null,L=O.current===void 0?A:O.current;D===null&&L===null||(x.current=setTimeout(()=>{x.current=null,O.current=D,v.mutate({ref:e,roomId:s,threadId:n??null,scrollAnchorEntryId:D})},400))},[i,e,v,A,s,n]);m.useEffect(()=>()=>{x.current&&clearTimeout(x.current)},[]),m.useEffect(()=>{(l==null?void 0:l.status)==="reconnect-required"&&i&&N.removeQueries({queryKey:B.remote(i,e)})},[i,e,l==null?void 0:l.status,N]);const F=at(e,s,a.capabilities.read,a.fingerprint),[M,q]=m.useState(0),K=m.useRef([]),j=m.useCallback(p=>K.current.some(D=>D.id===p),[]),$=xs(e,s,a.capabilities.stream,M,a.fingerprint,a.cacheReadable,j),y=$.status==="removed",g=y?null:$.room??F.data,U=Qt(e,s,n,!y&&a.capabilities.read&&(g==null?void 0:g.readable)===!0,a.fingerprint),b=it(e,s,!y&&a.capabilities.read&&(g==null?void 0:g.readable)===!0,a.fingerprint),[S,_]=m.useState(()=>({address:u,entries:[]})),H=m.useMemo(()=>S.address===u?S.entries:[],[u,S]);m.useEffect(()=>{K.current=H},[H]);const[X,re]=m.useState(0),[Z,me]=m.useState(!1),[we,c]=m.useState(null),[R,I]=m.useState(null),T=ws({community:e,roomId:s,enabled:!y&&a.capabilities.read&&(g==null?void 0:g.readable)===!0,accessFingerprint:a.fingerprint}),E=(l==null?void 0:l.connectedHumanMemberId)??null,P=(qe=b.data)==null?void 0:qe.members.find(p=>p.memberId===E),Q=p=>{var D;return p===E||((D=b.data)==null?void 0:D.members.some(L=>L.memberId===p&&L.ownerMemberId===E))===!0},[J,te]=m.useState({address:"",name:null,error:null}),G=J.address===u?J.name:null,ye=J.address===u?J.error:null,ae=m.useRef(null),W=m.useRef(null),se=m.useRef(null),fe=!y&&a.capabilities.post&&$.status==="live"&&(g==null?void 0:g.writable)===!0,Se=fe&&T.hold===null,oe=m.useMemo(()=>{var p;return y?[]:De(Ce(e,s,...((p=U.data)==null?void 0:p.pages.map(D=>D.entries))??[],$.entries,H),$.revisions)},[e,s,U.data,$.entries,$.revisions,H,y]),xt=m.useCallback(p=>{_(D=>({address:u,entries:Ce(e,s,D.address===u?D.entries:[],[p]).slice(-500)})),re(D=>D+1)},[u,e,s]);m.useLayoutEffect(()=>{var p;X>0&&((p=se.current)==null||p.scrollToBottom())},[X]);const yt=m.useMemo(()=>{var p;return i?{ownerKey:i.ownerKey,epoch:i.epoch,ref:e,generation:((p=i.connection)==null?void 0:p.generation)??0,roomId:s,threadId:n}:null},[i,e,s,n]),Y=Es({ref:e,roomId:s,canSend:Se,entries:oe,onReceipt:xt,draft:yt,ownerKey:h||"unresolved",contextKey:u||"unresolved",onHold:T.noteHold}),vt=oe.filter(p=>n?p.id===n||p.threadRootEntryId===n:p.depth===0),jt=m.useMemo(()=>{var p;return n?new Map:Bs(((p=U.data)==null?void 0:p.pages.flatMap(D=>D.entries))??[],oe)},[n,U.data,oe]),Le=vt.flatMap(p=>{const D=jt.get(p.id);return D?[{kind:"message",entry:p},{kind:"replies",rootId:p.id,summary:D}]:[{kind:"message",entry:p}]}),Nt=Le.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 ${o??(g==null?void 0:g.title)??"this channel"}…`,canSend:Se,canSendReason:y?"You no longer have access to this channel.":T.hold?Cs(T.hold):!a.capabilities.post&&a.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:Y.attachments,async send(){Y.send(n)}};async function ve(p,D){if(G||!i)return;const L=i,le=u;te({address:le,name:p,error:null});try{if(await D(),!V(L))return;(p==="join"||p==="leave"||p.startsWith("retry:"))&&q(ne=>ne+1),await N.invalidateQueries({queryKey:B.remote(L,e)})}catch(ne){V(L)&&te({address:le,name:p,error:ne instanceof Error?ne.message:"Couldn’t finish that. Try again."})}finally{V(L)&&te(ne=>ne.address===le?{...ne,name:null}:ne)}}function Ct(){var L;const p=oe.at(-1);if(n||U.hasNextPage||!p||$.status!=="live"||((L=ae.current)==null?void 0:L.address)===u&&ae.current.cursor===p.cursor||!i)return;const D=i;ae.current={address:u,cursor:p.cursor},d.setRemoteCommunityReadCursor(e,s,p.cursor).then(()=>{V(D)&&N.invalidateQueries({queryKey:B.rooms(D,e)})}).catch(()=>{var le;((le=ae.current)==null?void 0:le.address)===u&&(ae.current=null)})}return t.jsxs(Ne.Root,{surface:"room",capabilities:Qs,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(k,{variant:"ghost",size:"sm",onClick:()=>r(),children:"Back to channel"}),!y&&a.capabilities.post&&g&&!g.joined&&!g.stale&&t.jsx(k,{size:"sm",disabled:G!==null,onClick:()=>void ve("join",()=>d.joinRemoteCommunityRoom(e,s)),children:"Join channel"}),a.cacheReadable&&t.jsx(k,{variant:"ghost",size:"sm",disabled:y,onClick:()=>me(!Z),children:Z?"Hide members":"Members"}),((Fe=T.standing)==null?void 0:Fe.rules.text)&&t.jsx(k,{variant:"ghost",size:"sm",onClick:()=>c("rules"),children:"Rules"}),a.capabilities.post&&t.jsx(k,{variant:"ghost",size:"sm",onClick:()=>c("name"),children:"Your name"}),a.capabilities.enrollAgent&&t.jsx(k,{variant:"outline",size:"sm",disabled:G!==null,onClick:()=>void ve("stop",()=>d.haltRemoteCommunityRoom(e,s)),children:G==="stop"?"Stopping…":"Stop my agents"}),a.capabilities.post&&(g==null?void 0:g.joined)&&!o&&t.jsx(k,{variant:"ghost",size:"sm",disabled:G!==null||!fe,onClick:()=>void ve("leave",async()=>{await d.leaveRemoteCommunityRoom(e,s),i&&N.removeQueries({queryKey:B.room(i,e,s)})}),children:"Leave channel"})]}),ye&&t.jsx("p",{role:"alert",className:"text-destructive px-4 py-2 text-sm",children:ye}),y?t.jsx("p",{role:"status",className:"p-6 text-sm",children:"You no longer have access to this channel."}):t.jsxs(t.Fragment,{children:[$.status!=="live"&&t.jsx("p",{role:"status",className:"text-muted-foreground px-4 py-2 text-sm",children:$.status==="connecting"?"Connecting to the space…":"Space unavailable. Showing saved messages."}),F.isError&&t.jsx("p",{role:"alert",className:"px-4 py-2 text-sm",children:"Couldn’t load this channel."}),Z&&t.jsx(Ks,{roster:b.data,failed:b.isError,canMention:fe,onMention:p=>{var D;Y.setText(`${Y.text}${Y.text&&!Y.text.endsWith(" ")?" ":""}@${p} `),(D=W.current)==null||D.focus()},community:e,roomId:s,online:$.status==="live",canEnroll:a.capabilities.enrollAgent,agentsKey:u,accessFingerprint:a.fingerprint}),U.isError&&t.jsxs("p",{role:"alert",className:"p-3 text-sm",children:["Some messages could not be loaded."," ",t.jsx(k,{variant:"ghost",size:"sm",onClick:()=>void U.refetch(),children:"Retry"})]}),U.hasNextPage&&t.jsx(k,{variant:"ghost",size:"sm",disabled:U.isFetchingNextPage,onClick:()=>void U.fetchNextPage(),children:"Load the next page of history"}),t.jsx(Ne.Timeline,{ref:se,conversationId:be.id,rows:Nt,label:n?"Space thread":"Space messages",busy:U.isFetching,resumeRow:()=>n?void 0:A??void 0,onTopRow:z,onReachedBottom:Ct,onOpenThread:r,empty:t.jsx("p",{className:"text-muted-foreground p-6 text-sm",children:U.isPending?"Loading messages…":"No messages here yet."}),renderRow:(p,D)=>{const L=Le[D.index];return L.kind==="message"?t.jsx(pt,{entry:L.entry,onThread:r,onReport:a.capabilities.post&&b.data&&!Q(L.entry.authorId)?()=>I(L.entry):void 0}):t.jsx(is,{summary:L.summary,open:!1,onOpen:()=>r(L.rootId)})}}),t.jsx(Ys,{agentDeliveries:$.deliveries,drafts:Y.deliveries,entries:oe,threadId:n,canSend:Se,action:G,onRetryAgent:p=>void ve(`retry:${p}`,()=>d.retryRemoteCommunityDelivery(e,s,p)),onRetryDraft:Y.retry}),Y.error&&t.jsx("p",{role:"alert",className:"text-destructive px-4 py-2 text-sm",children:Y.error}),t.jsx(Ne.Composer,{inputRef:W,aboveInput:t.jsx(_s,{conduct:T,staff:["owner","admin"].includes((P==null?void 0:P.role)??""),onReadRules:()=>c("rules")}),className:"m-3",value:Y.text,onChange:Y.setText,onSubmit:()=>Y.send(n),input:{isStreaming:!1,contextKey:be.id,canSubmit:Y.text.trim().length>0||Y.attachments.staged.length>0}})]})]}),t.jsx(Ls,{conduct:T,open:we==="rules",onOpenChange:p=>c(p?"rules":null)}),t.jsx(zs,{community:e,accessFingerprint:a.fingerprint,currentName:(P==null?void 0:P.displayName)??"",open:we==="name",onOpenChange:p=>c(p?"name":null)}),t.jsx(Fs,{entry:R,onClose:()=>I(null)})]})}function Gs({community:e,roomId:s}){var h,u;const n=xe(),r=(h=n.data)==null?void 0:h.find(N=>N.ref===e),o=_e(r==null?void 0:r.access),d=at(e,s??"",!!s&&o.capabilities.read,o.fingerprint),{dm:f}=ot(e,s??"",!!s&&o.capabilities.read,o.fingerprint),l=(r==null?void 0:r.label)??"Space",a=s?f?Jt(f):(u=d.data)==null?void 0:u.title:void 0,i=r===void 0&&n.fetchStatus==="fetching"||s!==void 0&&a===void 0&&d.fetchStatus==="fetching";return t.jsx(lt,{pending:i,children:a?`${l} · ${a}`:l})}function gt(e){var s,n,r,o;return!e||e.status==="reconnect-required"?null:((n=(s=e.access)==null?void 0:s.lastKnown)==null?void 0:n.lifecycle)==="deleted"?"deleted":((o=(r=e.access)==null?void 0:r.lastKnown)==null?void 0:o.lifecycle)==="taken_down"?"taken-down":e.seemsGoneSince?"seems-gone":null}function Qe(e,s,n){return`${e} ${e===1?s:n}`}function Ws(e,s){const n=[e>0?Qe(e,"message from your agents","messages from your agents"):null,s>0?Qe(s,"draft of yours","drafts of yours"):null].filter(o=>o!==null);if(n.length===0)return null;const r=n.length===1&&(e===1||s===1);return`${n.join(" and ")} ${r?"wasn’t":"weren’t"} sent.`}function Vs({connection:e,onRemoved:s}){const n=gt(e),r=Gt(),[o,d]=m.useState(!1),{ownerKey:f}=Wt(),l=Vt(f,e.ref),{copied:a,failed:i,copy:h}=Xt(),u=e.label,N=e.seemsGoneSince?new Date(e.seemsGoneSince).toLocaleDateString(void 0,{year:"numeric",month:"long",day:"numeric"}):null;function C(){r.mutate(e,{onSuccess:()=>{d(!1),rt.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 ${N}, ${u} says it doesn’t exist. Its channels, messages and files are still here.`,O=Ws(v?e.undeliveredAgentMessages??0:0,l.length),A=l.length===0?null:l.length===1?"Your unsent draft is cleared too.":`Your ${l.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(fs,{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:a?"Copied.":i?"Couldn’t copy to the clipboard.":""}),t.jsxs("div",{className:"flex flex-wrap items-center justify-center gap-2",children:[l.length>0&&t.jsx(k,{variant:"outline",onClick:()=>void h(l.join(`
|
|
8
|
+
`)}function Ts(e){const s=e==null?void 0:e.code;return typeof s=="string"&&Ss.has(s)}function Ae(e){return e.map(({id:s,file:n})=>({id:s,file:n,status:"pending",progress:0}))}function Es({ref:e,roomId:s,canSend:n,entries:r,onReceipt:o,draft:d,ownerKey:f,contextKey:l=f,onHold:a}){const i=ee(),h=JSON.stringify([f,e,s,l]),u=Dt(d),N=u.text,C=m.useMemo(()=>Ae(u.files),[u.files]),v=m.useRef(d);m.useLayoutEffect(()=>{v.current=d},[d]);function w(c){const R=v.current;if(!R)return;const I=je.getState(),T=I.drafts[ke(R)],E=c({text:(T==null?void 0:T.text)??"",files:Ae((T==null?void 0:T.files)??[])});I.write(R,{text:E.text,files:E.files.map(({id:P,file:J})=>({id:P,file:J}))})}function x(c){w(R=>({...R,text:c}))}function O(c){w(R=>({...R,files:c(R.files)}))}const[A,z]=m.useState(null);function F(c){z(c===null?null:{address:h,context:l,message:c})}const[M,q]=m.useState([]),U=m.useRef(new Map),j=m.useRef(0),$=m.useRef(new Map),y=m.useRef(new Set),g=m.useRef(h),K=m.useRef(l),b=m.useRef(!0),S=m.useRef(n),_=m.useRef(o),H=m.useRef(a);m.useLayoutEffect(()=>{g.current=h,K.current=l,S.current=n,_.current=o,H.current=a},[h,n,l,o,a]),m.useEffect(()=>(b.current=!0,()=>{b.current=!1}),[]),m.useEffect(()=>{let c=!1;for(const R of r){if(!R.originIdempotencyKey)continue;const I=U.current.get(R.originIdempotencyKey);(I==null?void 0:I.address)===g.current&&I.context===K.current&&U.current.delete(R.originIdempotencyKey)&&(Ye(I),c=!0)}c&&q([...U.current.values()])},[r]);function X(){b.current&&q([...U.current.values()].filter(c=>c.address===g.current&&c.context===K.current).map(c=>({...c})))}async function re(c){var R,I;if(!(y.current.has(c.key)||!S.current||!b.current||c.address!==g.current)){y.current.add(c.key),c.status="sending",c.error=void 0,X();try{!c.posted&&c.uploadedAt.some(E=>!ft(E))&&(c.attachmentIds=[],c.uploadedAt=[],c.triedAt=[],c.uploadRound+=1);for(let E=c.attachmentIds.length;E<c.files.length;E++){if(!S.current||!b.current||c.address!==g.current)throw new Error("Reconnect to this channel, then try again.");const P=c.files[E],J=mt(c.ref,c.roomId,P.id),Q=ks(J);if(Q){c.attachmentIds.push(Q.attachmentId),c.uploadedAt.push(Q.at);continue}const te=(R=c.triedAt)[E]??(R[E]=As()),G=await i.uploadRemoteCommunityAttachment(c.ref,c.roomId,P.file,c.uploadRound?`${c.key}:file:${E}:${c.uploadRound}`:`${c.key}:file:${E}`);Ds(J,G.id,te),c.uploadedAt.push(te),c.attachmentIds.push(G.id)}if(!S.current||!b.current||c.address!==g.current)throw new Error("Reconnect to this channel, then try again.");c.posted=!0;const T=await i.postRemoteCommunityEntry(c.ref,c.roomId,{text:c.text,parentEntryId:c.parentEntryId,attachmentIds:c.attachmentIds,idempotencyKey:c.key});U.current.delete(c.key),Ye(c),b.current&&c.address===g.current&&c.context===K.current&&_.current(T)}catch(T){if(Ts(T)&&Z(c)){U.current.delete(c.key);return}if(Ns(T)&&Z(c)){U.current.delete(c.key),b.current&&c.address===g.current&&((I=H.current)==null||I.call(H,T));return}c.status="failed",c.error=T instanceof Error?T.message:"Not confirmed. Try this message again."}finally{y.current.delete(c.key),X()}}}function Z(c){const{draft:R}=c.origin,I=ke(R),T=je.getState(),E=T.drafts[I],P=(E==null?void 0:E.text)??"";let J=$.current.get(I)??[];const Q=Be(J.map(W=>W.origin.typed));let te=P;Q&&P.startsWith(Q)?te=P.slice(Q.length).replace(/^\n+/,""):J=[];const G=[...J,c].sort((W,se)=>W.origin.seq-se.origin.seq),ye=new Set(G.flatMap(W=>W.files.map(se=>se.id))),ae=[...G.flatMap(W=>W.files.map(({id:se,file:fe})=>({id:se,file:fe}))),...((E==null?void 0:E.files)??[]).filter(W=>!ye.has(W.id))];return T.write(R,{text:Be([...G.map(W=>W.origin.typed),te]),files:ae}),I in je.getState().drafts?($.current.set(I,G),!0):!1}function me(c){const R=v.current;if(!R||!S.current)return;const I=je.getState(),T=I.drafts[ke(R)];if(!T||!T.text.trim()&&T.files.length===0)return;if(U.current.size>=30){F("Too many messages waiting. Let them send, or retry them first.");return}const E=I.take(R),P=Ae(E.files),J={address:h,context:l,ref:e,roomId:s,key:crypto.randomUUID(),text:E.text.trim()?E.text:P.map(Q=>Q.file.name).join(", "),parentEntryId:c,files:P,attachmentIds:[],uploadedAt:[],triedAt:[],posted:!1,uploadRound:0,status:"sending",origin:{draft:R,typed:E.text,seq:j.current+=1}};U.current.set(J.key,J),F(null),re(J)}return{text:N,setText:x,attachments:{staged:C,add(c){if(c.some(R=>R.size>25*1024*1024)){F("Each file must be 25 MB or smaller.");return}O(R=>R.length+c.length>8?(F("Attach up to eight files to one message."),R):[...R,...c.map(I=>({id:crypto.randomUUID(),file:I,status:"pending",progress:0}))])},remove(c){O(R=>R.filter(I=>I.id!==c))},retry(){},cancel(){O(()=>[])},hasFailed:!1,isUploading:!1,holdsSendWhileUploading:!1},deliveries:M.filter(c=>c.address===h&&c.context===l),error:(A==null?void 0:A.address)===h&&A.context===l?A.message:null,send:me,retry(c){const R=U.current.get(c);R&&re(R)}}}function pt({entry:e,onThread:s,onReport:n}){const r=ee(),o=m.useId(),[d,f]=m.useState(null),[l,a]=m.useState(null),i={id:JSON.stringify([e.community,e.authorId]),kind:e.authorKind,displayName:e.authorDisplayName};async function h(u,N){if(l)return;a(u),f(null);let C;try{const v=await r.downloadRemoteCommunityAttachment(e.community,e.roomId,u);C=URL.createObjectURL(v);const w=document.createElement("a");w.href=C,w.download=Array.from(N,x=>x==="/"||x==="\\"||x.charCodeAt(0)<32?"_":x).join(""),document.body.append(w),w.click(),w.remove()}catch(v){f(v instanceof Error?v.message:"Couldn’t download the file. Try again.")}finally{C&&setTimeout(()=>URL.revokeObjectURL(C),1e3),a(null)}}return t.jsxs(pe.Root,{role:e.authorKind==="human"?"user":"assistant","aria-labelledby":o,children:[t.jsx(pe.Gutter,{author:i,at:e.createdAt}),t.jsxs(pe.Body,{children:[t.jsx(pe.Author,{id:o,author:i,at:e.createdAt}),t.jsxs(pe.Content,{children:[t.jsx(cs,{content:e.text}),e.attachments.map(u=>t.jsx(k,{variant:"outline",size:"sm",disabled:l!==null,onClick:()=>void h(u.id,u.name),className:"max-w-full",children:t.jsx("span",{className:"min-w-0 truncate",children:l===u.id?"Downloading…":u.name})},u.id)),d&&t.jsx("p",{role:"alert",className:"text-destructive text-sm",children:d}),s&&t.jsx(k,{variant:"ghost",size:"sm",onClick:()=>s(e.threadRootEntryId??e.id),children:e.depth===0?"Reply in thread":"Open thread"}),n&&t.jsx(k,{variant:"ghost",size:"sm",onClick:n,children:"Report"})]})]})]})}function Ms({community:e,roomId:s,online:n,canEnroll:r,accessFingerprint:o}){var y,g,K;const d=ee(),f=de(),l=ue(!0,o,e),a=Tt(e,r,o),i=Et(),h=Ge(e,r,o),[u,N]=m.useState(""),[C,v]=m.useState(""),[w,x]=m.useState(!1),[O,A]=m.useState(null),[z,F]=m.useState(null),M=m.useId(),q=((y=a.data)==null?void 0:y.filter(b=>b.active))??[],U=((g=i.data)==null?void 0:g.agents.filter(b=>!q.some(S=>S.localAgentId===b.id)))??[];async function j(){l&&V(l)&&await f.invalidateQueries({queryKey:B.remote(l,e)})}async function $(b){if(b.preventDefault(),!u||w||!n||!r||!l)return;const S=l;x(!0),A(null);try{if(await d.enrollRemoteCommunityAgent(e,u,C.trim()?{handle:C.trim()}:{}),!V(S))return;N(""),v(""),await j()}catch(_){V(S)&&A(_ instanceof Error?_.message:"Couldn’t add the agent. Try again.")}finally{V(S)&&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."}),a.isError&&t.jsxs("p",{role:"alert",children:["Couldn’t load your agents in this space."," ",t.jsx(k,{variant:"ghost",size:"sm",onClick:()=>void a.refetch(),children:"Retry"})]}),(K=a.data)==null?void 0:K.map(b=>{var S;return t.jsx(Os,{agent:b,roomId:s,online:n,canEnroll:r,takesDms:((S=h.data)==null?void 0:S.available)===!0,onChanged:j,onNotice:F},b.localAgentId)}),i.isError&&t.jsx("p",{role:"alert",children:"Couldn’t load the agents on this computer."}),r&&U.length>0&&t.jsxs("form",{onSubmit:b=>void $(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(ce,{htmlFor:`${M}-agent`,children:"Local agent"}),t.jsxs(Mt,{value:u,onValueChange:N,disabled:!n||w,children:[t.jsx(Ot,{id:`${M}-agent`,children:t.jsx(It,{placeholder:"Choose an agent"})}),t.jsx($t,{children:U.map(b=>t.jsx(Kt,{value:b.id,children:b.name},b.id))})]})]}),t.jsxs("div",{className:"min-w-40 flex-1 space-y-1",children:[t.jsx(ce,{htmlFor:`${M}-handle`,children:"Space handle (optional)"}),t.jsx(We,{id:`${M}-handle`,value:C,onChange:b=>v(b.target.value),disabled:!n||w,placeholder:"Use the agent’s handle"})]}),t.jsx(k,{type:"submit",disabled:!u||!n||w,children:w?"Adding…":"Add to space"})]}),z&&t.jsx("p",{role:"status",className:"text-muted-foreground text-sm",children:z}),O&&t.jsx("p",{role:"alert",className:"text-destructive text-sm",children:O})]})}function Os({agent:e,roomId:s,online:n,canEnroll:r,takesDms:o,onChanged:d,onNotice:f}){const l=ee(),[a,i]=m.useState(null),[h,u]=m.useState(null),N=e.roomIds.includes(s),C=m.useId();async function v(x,O){if(!a){i(x),u(null);try{await O(),await d()}catch(A){u(A instanceof Error?A.message:"Couldn’t finish that. Try again.")}finally{i(null)}}}function w(x){f(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(k,{variant:"outline",size:"sm",disabled:a!==null||!r||!e.active||!N&&!n,onClick:()=>void v("membership",async()=>{N?w(await l.leaveRemoteCommunityAgentRoom(e.community,s,e.localAgentId)):await l.joinRemoteCommunityAgentRoom(e.community,s,e.localAgentId)}),children:N?"Leave channel":"Join channel"}),t.jsx(k,{variant:"ghost",size:"sm",disabled:a!==null||!r,onClick:()=>void v("stop",()=>l.haltRemoteCommunityAgent(e.community,s,e.localAgentId)),children:"Stop agent"}),t.jsxs(Ve,{children:[t.jsx(Ut,{asChild:!0,children:t.jsx(k,{variant:"ghost",size:"sm",disabled:a!==null||!r,children:"Remove from space"})}),t.jsxs(Xe,{children:[t.jsxs(Ze,{children:[t.jsxs(et,{children:["Remove ",e.displayName,"?"]}),t.jsx(tt,{children:"It leaves every channel in this space. You can re-add it."})]}),t.jsxs(st,{children:[t.jsx(nt,{children:"Cancel"}),t.jsx(_t,{onClick:()=>void v("remove",async()=>w(await l.ejectRemoteCommunityAgent(e.community,e.localAgentId))),children:"Remove agent"})]})]})]})]}),o&&e.active&&t.jsxs("div",{className:"flex items-center gap-2",children:[t.jsx(Lt,{id:C,checked:e.acceptsDms===!0,disabled:a!==null||!r||!n,onCheckedChange:x=>void v("dms",()=>l.setRemoteCommunityAgentDms(e.community,e.localAgentId,x))}),t.jsx(ce,{htmlFor:C,className:"text-xs font-normal",children:"Takes direct messages"})]}),h&&t.jsx("p",{role:"status",className:"text-muted-foreground text-xs",children:h})]})}function Is({community:e,agent:s,disabled:n,accessFingerprint:r}){const o=ee(),d=Re(),f=de(),l=ue(!0,r,e),[a,i]=m.useState(!1),[h,u]=m.useState(null);async function N(){if(!a){i(!0),u(null);try{const C=await o.startRemoteCommunityDm(e,s.memberId);l&&await f.invalidateQueries({queryKey:B.dms(l,e)}),d({...ge.channels(),search:{community:e,id:C.roomId}})}catch(C){u(C.code===zt?`${s.displayName} isn’t taking direct messages.`:"Couldn’t open the direct message. Try again.")}finally{i(!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(k,{variant:"ghost",size:"sm",disabled:n||a,onClick:()=>void N(),"aria-label":`Message ${s.displayName}`,children:"Message"})]})}function $s(e,s){const n=new Date(e),r=n.toLocaleTimeString([],{hour:"numeric",minute:"2-digit"});return n.toDateString()===s.toDateString()?r:`${n.toLocaleDateString([],{month:"short",day:"numeric",...n.getFullYear()===s.getFullYear()?{}:{year:"numeric"}})}, ${r}`}function Ks(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:$s(e.lastSeenAt,s)}}:null}function Us({roster:e,failed:s,canMention:n,onMention:r,community:o,roomId:d,online:f,canEnroll:l,agentsKey:a,accessFingerprint:i}){var C,v,w;const u=((C=Ge(o,!0,i).data)==null?void 0:C.available)===!0,N=(w=(v=xe().data)==null?void 0:v.find(x=>x.ref===o))==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=Ks(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(z=>z.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!==N&&t.jsx(Is,{community:o,agent:x,disabled:!f,accessFingerprint:i}),x.handle&&t.jsxs(k,{variant:"ghost",size:"sm",disabled:!n,onClick:()=>r(x.handle),children:["Mention @",x.handle]})]})]},x.memberId)}),l&&t.jsx(Ms,{community:o,roomId:d,online:f,canEnroll:!0,accessFingerprint:i},a)]})}function ht(e,s){return e instanceof Error&&e.message?e.message:s}function _s({conduct:e,staff:s,onReadRules:n}){const{hold:r,standing:o}=e;return(r==null?void 0:r.kind)==="rules"?t.jsx("div",{className:"px-1 pb-1",children:t.jsx(k,{size:"sm",variant:"outline",onClick:n,children:"Read the rules"})}):r||s||!(o!=null&&o.slowModeSeconds)?null:t.jsxs("p",{className:"text-muted-foreground px-1 pb-1 text-xs",children:["Slow mode: one message every ",o.slowModeSeconds,"s."]})}function Ls({conduct:e,open:s,onOpenChange:n}){var d;const r=(d=e.standing)==null?void 0:d.rules,o=r?r.acceptedVersion>=r.version:!1;return t.jsx(Ee,{open:s,onOpenChange:n,children:t.jsxs(Me,{className:"sm:max-w-lg",children:[t.jsxs(Oe,{children:[t.jsx(Ie,{children:"Space rules"}),t.jsx($e,{children:o?"You accepted these rules.":"Accept these rules to post here."})]}),t.jsxs(Ke,{children:[t.jsx("div",{className:"max-h-[50vh] overflow-y-auto rounded-md border p-3 text-sm leading-relaxed whitespace-pre-wrap",children:(r==null?void 0:r.text)??"This space has no rules."}),e.accept.error&&t.jsx("p",{role:"alert",className:"text-destructive mt-2 text-sm",children:ht(e.accept.error,"Couldn’t accept the rules. Try again.")})]}),t.jsxs(Ue,{children:[t.jsx(k,{variant:"outline",onClick:()=>n(!1),children:"Close"}),(r==null?void 0:r.text)&&!o&&t.jsx(k,{disabled:e.accept.isPending,onClick:()=>e.accept.mutate(r.version,{onSuccess:()=>n(!1)}),children:e.accept.isPending?"Accepting…":"Accept rules"})]})]})})}function zs({community:e,accessFingerprint:s,currentName:n,open:r,onOpenChange:o}){return t.jsx(Ee,{open:r,onOpenChange:o,children:t.jsx(Me,{className:"sm:max-w-md",children:r&&t.jsx(Ps,{community:e,accessFingerprint:s,currentName:n,onDone:()=>o(!1)})})})}function Ps({community:e,accessFingerprint:s,currentName:n,onDone:r}){const o=ee(),d=de(),f=ue(!0,s,e),[l,a]=m.useState(n),i=Te({meta:{suppressErrorToast:!0},mutationFn:u=>o.setRemoteCommunityDisplayName(e,u),onSuccess:async()=>{f&&await d.invalidateQueries({queryKey:B.content(f,e)}),r()}}),h=l.trim();return t.jsxs("form",{onSubmit:u=>{u.preventDefault(),h&&h!==n&&i.mutate(h)},children:[t.jsxs(Oe,{children:[t.jsx(Ie,{children:"Your name in this space"}),t.jsx($e,{children:"Other spaces keep the name they show."})]}),t.jsxs(Ke,{className:"space-y-2",children:[t.jsx(ce,{htmlFor:"remote-community-display-name",children:"Name"}),t.jsx(We,{id:"remote-community-display-name",value:l,maxLength:128,autoComplete:"nickname",onChange:u=>a(u.target.value)}),i.error&&t.jsx("p",{role:"alert",className:"text-destructive text-sm",children:ht(i.error,"Couldn’t change your name. Try again.")})]}),t.jsxs(Ue,{children:[t.jsx(k,{type:"button",variant:"outline",onClick:r,children:"Cancel"}),t.jsx(k,{type:"submit",disabled:!h||h===n||i.isPending,children:i.isPending?"Saving…":"Save name"})]})]})}const qs=[{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 Fs({entry:e,onClose:s}){return t.jsx(Ee,{open:e!==null,onOpenChange:n=>!n&&s(),children:t.jsx(Me,{className:"sm:max-w-md",children:e&&t.jsx(Hs,{entry:e,onClose:s},e.id)})})}function Hs({entry:e,onClose:s}){const n=ee(),r=m.useId(),[o,d]=m.useState(null),[f,l]=m.useState(""),a=Te({meta:{suppressErrorToast:!0},mutationFn:i=>n.reportRemoteCommunityEntry(e.community,e.roomId,e.id,i),onSuccess:()=>{rt("Message reported"),s()}});return t.jsxs("form",{onSubmit:i=>{i.preventDefault(),o&&a.mutate({reason:o,...f.trim()?{note:f.trim()}:{}})},children:[t.jsxs(Oe,{children:[t.jsx(Ie,{children:"Report message"}),t.jsx($e,{children:"This space’s owners and admins review reports."})]}),t.jsxs(Ke,{className:"space-y-4",children:[t.jsxs("p",{className:"text-muted-foreground line-clamp-3 text-sm",children:[e.authorDisplayName,": ",e.text]}),t.jsx(Pt,{"aria-label":"Reason",value:o??"",onValueChange:i=>d(i),children:qs.map(i=>t.jsxs("div",{className:"flex items-center gap-2",children:[t.jsx(qt,{value:i.value,id:`${r}-${i.value}`}),t.jsx(ce,{htmlFor:`${r}-${i.value}`,children:i.label})]},i.value))}),t.jsxs("div",{className:"space-y-1.5",children:[t.jsx(ce,{htmlFor:`${r}-note`,children:"Note (optional)"}),t.jsx(Ft,{id:`${r}-note`,value:f,maxLength:Ht,onChange:i=>l(i.target.value),rows:3}),t.jsx("p",{className:"text-muted-foreground text-xs",children:"Only owners and admins see this."})]}),a.error&&t.jsx("p",{role:"alert",className:"text-destructive text-sm",children:a.error instanceof Error&&a.error.message?a.error.message:"Couldn’t send the report. Try again."})]}),t.jsxs(Ue,{children:[t.jsx(k,{type:"button",variant:"outline",onClick:s,children:"Cancel"}),t.jsx(k,{type:"submit",disabled:!o||a.isPending,children:a.isPending?"Sending…":"Send report"})]})]})}function Ys({agentDeliveries:e,drafts:s,entries:n,threadId:r,canSend:o,action:d,onRetryAgent:f,onRetryDraft:l}){return t.jsxs(t.Fragment,{children:[e.filter(a=>a.parentEntryId===(r??null)&&!n.some(i=>i.originIdempotencyKey===a.idempotencyKey)).map(a=>t.jsxs("div",{className:"border-t px-4 py-2 text-sm",role:"status",children:[t.jsxs("p",{className:"font-medium",children:[a.author.displayName," · Agent"]}),t.jsx("p",{className:"whitespace-pre-wrap",children:a.text}),a.attachments.map((i,h)=>t.jsx("span",{className:"mr-2",children:i.name},h)),t.jsx("p",{className:"text-muted-foreground",children:a.state==="pending"?"Waiting for the space to confirm…":a.failure==="expired"?"Not confirmed. Too late to try again.":"Not confirmed. Check the space and the agent’s channel access."}),a.state==="pending"&&a.retryable&&t.jsx(k,{variant:"outline",size:"sm",disabled:!o||d!==null,onClick:()=>f(a.idempotencyKey),children:d===`retry:${a.idempotencyKey}`?"Retrying…":"Retry now"})]},a.idempotencyKey)),s.filter(a=>a.parentEntryId===r&&!n.some(i=>i.originIdempotencyKey===a.key)).map(a=>t.jsxs("div",{className:"border-t px-4 py-2 text-sm",role:"status",children:[t.jsx("p",{className:"whitespace-pre-wrap",children:a.text}),a.files.map(i=>t.jsx("span",{className:"mr-2",children:i.file.name},i.id)),t.jsx("p",{className:"text-muted-foreground",children:a.status==="sending"?"Sending…":"Delivery not confirmed."}),a.error&&t.jsx("p",{children:a.error}),a.status==="failed"&&t.jsx(k,{variant:"outline",size:"sm",disabled:!o,onClick:()=>l(a.key),children:"Retry message"})]},a.key))]})}function Bs(e,s){var d;const n=new Map;for(const f of e)f.thread&&n.set(f.id,{count:f.thread.replyCount,lastAt:f.thread.lastReplyAt,through:f.threadLastReplySeq});const r=new Map;for(const f of s){const l=f.threadRootEntryId;if(f.depth===0||l===null)continue;const a=(d=n.get(l))==null?void 0:d.through;if(a!==void 0&&f.remoteSeq<=a)continue;const i=r.get(l);r.set(l,{count:((i==null?void 0:i.count)??0)+1,newest:i&&i.newest.remoteSeq>f.remoteSeq?i.newest:f})}const o=new Map;for(const f of new Set([...n.keys(),...r.keys()])){const l=n.get(f),a=r.get(f),i=l===void 0?a.count:l.through===void 0?Math.max(l.count,(a==null?void 0:a.count)??0):l.count+((a==null?void 0:a.count)??0);o.set(f,{count:i,lastAt:(a==null?void 0:a.newest.createdAt)??l.lastAt,unread:0})}return o}const Js={reactions:!1,threads:!0,runWith:!1,attachments:!0,mentions:!0,streamHealth:!0,presence:!1,turnStatus:!1,asks:!1};function Qs({community:e,roomId:s,threadId:n,onThread:r,dmAgentName:o}){var ze,Pe,qe,Fe;const d=ee(),l=(ze=xe().data)==null?void 0:ze.find(p=>p.ref===e),a=_e(l==null?void 0:l.access),i=ue(!0,a.fingerprint,e),{ownerAddress:h,contextAddress:u}=vs(i),N=de(),C=Yt(),v=Bt(),w=(Pe=C.data)==null?void 0:Pe.destinations.find(p=>p.ref===e&&p.roomId===s),x=m.useRef(null),O=m.useRef(void 0),A=(w==null?void 0:w.scrollAnchorEntryId)??null,z=m.useCallback(p=>{if(!i||n)return;x.current&&clearTimeout(x.current),x.current=null;const D=p??null,L=O.current===void 0?A:O.current;D===null&&L===null||(x.current=setTimeout(()=>{x.current=null,O.current=D,v.mutate({ref:e,roomId:s,threadId:n??null,scrollAnchorEntryId:D})},400))},[i,e,v,A,s,n]);m.useEffect(()=>()=>{x.current&&clearTimeout(x.current)},[]),m.useEffect(()=>{(l==null?void 0:l.status)==="reconnect-required"&&i&&N.removeQueries({queryKey:B.remote(i,e)})},[i,e,l==null?void 0:l.status,N]);const F=at(e,s,a.capabilities.read,a.fingerprint),[M,q]=m.useState(0),U=m.useRef([]),j=m.useCallback(p=>U.current.some(D=>D.id===p),[]),$=xs(e,s,a.capabilities.stream,M,a.fingerprint,a.cacheReadable,j),y=$.status==="removed",g=y?null:$.room??F.data,K=Jt(e,s,n,!y&&a.capabilities.read&&(g==null?void 0:g.readable)===!0,a.fingerprint),b=it(e,s,!y&&a.capabilities.read&&(g==null?void 0:g.readable)===!0,a.fingerprint),[S,_]=m.useState(()=>({address:u,entries:[]})),H=m.useMemo(()=>S.address===u?S.entries:[],[u,S]);m.useEffect(()=>{U.current=H},[H]);const[X,re]=m.useState(0),[Z,me]=m.useState(!1),[we,c]=m.useState(null),[R,I]=m.useState(null),T=ws({community:e,roomId:s,enabled:!y&&a.capabilities.read&&(g==null?void 0:g.readable)===!0,accessFingerprint:a.fingerprint}),E=(l==null?void 0:l.connectedHumanMemberId)??null,P=(qe=b.data)==null?void 0:qe.members.find(p=>p.memberId===E),J=p=>{var D;return p===E||((D=b.data)==null?void 0:D.members.some(L=>L.memberId===p&&L.ownerMemberId===E))===!0},[Q,te]=m.useState({address:"",name:null,error:null}),G=Q.address===u?Q.name:null,ye=Q.address===u?Q.error:null,ae=m.useRef(null),W=m.useRef(null),se=m.useRef(null),fe=!y&&a.capabilities.post&&$.status==="live"&&(g==null?void 0:g.writable)===!0,Se=fe&&T.hold===null,oe=m.useMemo(()=>{var p;return y?[]:De(Ce(e,s,...((p=K.data)==null?void 0:p.pages.map(D=>D.entries))??[],$.entries,H),$.revisions)},[e,s,K.data,$.entries,$.revisions,H,y]),xt=m.useCallback(p=>{_(D=>({address:u,entries:Ce(e,s,D.address===u?D.entries:[],[p]).slice(-500)})),re(D=>D+1)},[u,e,s]);m.useLayoutEffect(()=>{var p;X>0&&((p=se.current)==null||p.scrollToBottom())},[X]);const yt=m.useMemo(()=>{var p;return i?{ownerKey:i.ownerKey,epoch:i.epoch,ref:e,generation:((p=i.connection)==null?void 0:p.generation)??0,roomId:s,threadId:n}:null},[i,e,s,n]),Y=Es({ref:e,roomId:s,canSend:Se,entries:oe,onReceipt:xt,draft:yt,ownerKey:h||"unresolved",contextKey:u||"unresolved",onHold:T.noteHold}),vt=oe.filter(p=>n?p.id===n||p.threadRootEntryId===n:p.depth===0),jt=m.useMemo(()=>{var p;return n?new Map:Bs(((p=K.data)==null?void 0:p.pages.flatMap(D=>D.entries))??[],oe)},[n,K.data,oe]),Le=vt.flatMap(p=>{const D=jt.get(p.id);return D?[{kind:"message",entry:p},{kind:"replies",rootId:p.id,summary:D}]:[{kind:"message",entry:p}]}),Nt=Le.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 ${o??(g==null?void 0:g.title)??"this channel"}…`,canSend:Se,canSendReason:y?"You no longer have access to this channel.":T.hold?Cs(T.hold):!a.capabilities.post&&a.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:Y.attachments,async send(){Y.send(n)}};async function ve(p,D){if(G||!i)return;const L=i,le=u;te({address:le,name:p,error:null});try{if(await D(),!V(L))return;(p==="join"||p==="leave"||p.startsWith("retry:"))&&q(ne=>ne+1),await N.invalidateQueries({queryKey:B.remote(L,e)})}catch(ne){V(L)&&te({address:le,name:p,error:ne instanceof Error?ne.message:"Couldn’t finish that. Try again."})}finally{V(L)&&te(ne=>ne.address===le?{...ne,name:null}:ne)}}function Ct(){var L;const p=oe.at(-1);if(n||K.hasNextPage||!p||$.status!=="live"||((L=ae.current)==null?void 0:L.address)===u&&ae.current.cursor===p.cursor||!i)return;const D=i;ae.current={address:u,cursor:p.cursor},d.setRemoteCommunityReadCursor(e,s,p.cursor).then(()=>{V(D)&&N.invalidateQueries({queryKey:B.rooms(D,e)})}).catch(()=>{var le;((le=ae.current)==null?void 0:le.address)===u&&(ae.current=null)})}return t.jsxs(Ne.Root,{surface:"room",capabilities:Js,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(k,{variant:"ghost",size:"sm",onClick:()=>r(),children:"Back to channel"}),!y&&a.capabilities.post&&g&&!g.joined&&!g.stale&&t.jsx(k,{size:"sm",disabled:G!==null,onClick:()=>void ve("join",()=>d.joinRemoteCommunityRoom(e,s)),children:"Join channel"}),a.cacheReadable&&t.jsx(k,{variant:"ghost",size:"sm",disabled:y,onClick:()=>me(!Z),children:Z?"Hide members":"Members"}),((Fe=T.standing)==null?void 0:Fe.rules.text)&&t.jsx(k,{variant:"ghost",size:"sm",onClick:()=>c("rules"),children:"Rules"}),a.capabilities.post&&t.jsx(k,{variant:"ghost",size:"sm",onClick:()=>c("name"),children:"Your name"}),a.capabilities.enrollAgent&&t.jsx(k,{variant:"outline",size:"sm",disabled:G!==null,onClick:()=>void ve("stop",()=>d.haltRemoteCommunityRoom(e,s)),children:G==="stop"?"Stopping…":"Stop my agents"}),a.capabilities.post&&(g==null?void 0:g.joined)&&!o&&t.jsx(k,{variant:"ghost",size:"sm",disabled:G!==null||!fe,onClick:()=>void ve("leave",async()=>{await d.leaveRemoteCommunityRoom(e,s),i&&N.removeQueries({queryKey:B.room(i,e,s)})}),children:"Leave channel"})]}),ye&&t.jsx("p",{role:"alert",className:"text-destructive px-4 py-2 text-sm",children:ye}),y?t.jsx("p",{role:"status",className:"p-6 text-sm",children:"You no longer have access to this channel."}):t.jsxs(t.Fragment,{children:[$.status!=="live"&&t.jsx("p",{role:"status",className:"text-muted-foreground px-4 py-2 text-sm",children:$.status==="connecting"?"Connecting to the space…":"Space unavailable. Showing saved messages."}),F.isError&&t.jsx("p",{role:"alert",className:"px-4 py-2 text-sm",children:"Couldn’t load this channel."}),Z&&t.jsx(Us,{roster:b.data,failed:b.isError,canMention:fe,onMention:p=>{var D;Y.setText(`${Y.text}${Y.text&&!Y.text.endsWith(" ")?" ":""}@${p} `),(D=W.current)==null||D.focus()},community:e,roomId:s,online:$.status==="live",canEnroll:a.capabilities.enrollAgent,agentsKey:u,accessFingerprint:a.fingerprint}),K.isError&&t.jsxs("p",{role:"alert",className:"p-3 text-sm",children:["Some messages could not be loaded."," ",t.jsx(k,{variant:"ghost",size:"sm",onClick:()=>void K.refetch(),children:"Retry"})]}),K.hasNextPage&&t.jsx(k,{variant:"ghost",size:"sm",disabled:K.isFetchingNextPage,onClick:()=>void K.fetchNextPage(),children:"Load the next page of history"}),t.jsx(Ne.Timeline,{ref:se,conversationId:be.id,rows:Nt,label:n?"Space thread":"Space messages",busy:K.isFetching,resumeRow:()=>n?void 0:A??void 0,onTopRow:z,onReachedBottom:Ct,onOpenThread:r,empty:t.jsx("p",{className:"text-muted-foreground p-6 text-sm",children:K.isPending?"Loading messages…":"No messages here yet."}),renderRow:(p,D)=>{const L=Le[D.index];return L.kind==="message"?t.jsx(pt,{entry:L.entry,onThread:r,onReport:a.capabilities.post&&b.data&&!J(L.entry.authorId)?()=>I(L.entry):void 0}):t.jsx(is,{summary:L.summary,open:!1,onOpen:()=>r(L.rootId)})}}),t.jsx(Ys,{agentDeliveries:$.deliveries,drafts:Y.deliveries,entries:oe,threadId:n,canSend:Se,action:G,onRetryAgent:p=>void ve(`retry:${p}`,()=>d.retryRemoteCommunityDelivery(e,s,p)),onRetryDraft:Y.retry}),Y.error&&t.jsx("p",{role:"alert",className:"text-destructive px-4 py-2 text-sm",children:Y.error}),t.jsx(Ne.Composer,{inputRef:W,aboveInput:t.jsx(_s,{conduct:T,staff:["owner","admin"].includes((P==null?void 0:P.role)??""),onReadRules:()=>c("rules")}),className:"m-3",value:Y.text,onChange:Y.setText,onSubmit:()=>Y.send(n),input:{isStreaming:!1,contextKey:be.id,canSubmit:Y.text.trim().length>0||Y.attachments.staged.length>0}})]})]}),t.jsx(Ls,{conduct:T,open:we==="rules",onOpenChange:p=>c(p?"rules":null)}),t.jsx(zs,{community:e,accessFingerprint:a.fingerprint,currentName:(P==null?void 0:P.displayName)??"",open:we==="name",onOpenChange:p=>c(p?"name":null)}),t.jsx(Fs,{entry:R,onClose:()=>I(null)})]})}function Gs({community:e,roomId:s}){var h,u;const n=xe(),r=(h=n.data)==null?void 0:h.find(N=>N.ref===e),o=_e(r==null?void 0:r.access),d=at(e,s??"",!!s&&o.capabilities.read,o.fingerprint),{dm:f}=ot(e,s??"",!!s&&o.capabilities.read,o.fingerprint),l=(r==null?void 0:r.label)??"Space",a=s?f?Qt(f):(u=d.data)==null?void 0:u.title:void 0,i=r===void 0&&n.fetchStatus==="fetching"||s!==void 0&&a===void 0&&d.fetchStatus==="fetching";return t.jsx(lt,{pending:i,children:a?`${l} · ${a}`:l})}function gt(e){var s,n,r,o;return!e||e.status==="reconnect-required"?null:((n=(s=e.access)==null?void 0:s.lastKnown)==null?void 0:n.lifecycle)==="deleted"?"deleted":((o=(r=e.access)==null?void 0:r.lastKnown)==null?void 0:o.lifecycle)==="taken_down"?"taken-down":e.seemsGoneSince?"seems-gone":null}function Je(e,s,n){return`${e} ${e===1?s:n}`}function Ws(e,s){const n=[e>0?Je(e,"message from your agents","messages from your agents"):null,s>0?Je(s,"draft of yours","drafts of yours"):null].filter(o=>o!==null);if(n.length===0)return null;const r=n.length===1&&(e===1||s===1);return`${n.join(" and ")} ${r?"wasn’t":"weren’t"} sent.`}function Vs({connection:e,onRemoved:s}){const n=gt(e),r=Gt(),[o,d]=m.useState(!1),{ownerKey:f}=Wt(),l=Vt(f,e.ref),{copied:a,failed:i,copy:h}=Xt(),u=e.label,N=e.seemsGoneSince?new Date(e.seemsGoneSince).toLocaleDateString(void 0,{year:"numeric",month:"long",day:"numeric"}):null;function C(){r.mutate(e,{onSuccess:()=>{d(!1),rt.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 ${N}, ${u} says it doesn’t exist. Its channels, messages and files are still here.`,O=Ws(v?e.undeliveredAgentMessages??0:0,l.length),A=l.length===0?null:l.length===1?"Your unsent draft is cleared too.":`Your ${l.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(fs,{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:a?"Copied.":i?"Couldn’t copy to the clipboard.":""}),t.jsxs("div",{className:"flex flex-wrap items-center justify-center gap-2",children:[l.length>0&&t.jsx(k,{variant:"outline",onClick:()=>void h(l.join(`
|
|
9
9
|
|
|
10
|
-
`)),children:a?"Copied":i?"Couldn’t copy":l.length===1?"Copy your draft":"Copy your drafts"}),t.jsx(k,{variant:v?"outline":"destructive",onClick:()=>d(!0),children:v?"Remove from DorkOS":"Remove local copy"})]}),t.jsx(Ve,{open:o,onOpenChange:z=>{z||r.reset(),d(z)},children:t.jsxs(Xe,{children:[t.jsxs(Ze,{children:[t.jsx(et,{children:v?`Remove ${u} from DorkOS?`:`Remove your copy of ${u}?`}),t.jsx(tt,{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})]})})]}),r.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(st,{children:[t.jsx(nt,{disabled:r.isPending,children:"Cancel"}),t.jsx(k,{variant:"destructive",disabled:r.isPending,onClick:C,children:r.isPending?"Removing…":v?"Remove from DorkOS":"Remove local copy"})]})]})})]})}function Xs({connection:e,dateFormat:s}){var d,f;const n=ds(e);if(!n)return null;const[r,...o]=us(n,(f=(d=e.access)==null?void 0:d.lastKnown)==null?void 0:f.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(Zt,{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:r}),o.map(l=>t.jsx("p",{children:l},l))]}),t.jsxs(k,{variant:"outline",size:"sm",className:"shrink-0",onClick:()=>ts(ms(e)),children:["Open space",t.jsx(es,{className:"size-3.5","aria-hidden":!0})]})]})}const Zs={reactions:!1,threads:!1,runWith:!1,attachments:!1,mentions:!1,streamHealth:!1,presence:!1,turnStatus:!1,asks:!1};function en({dm:e,localAgentId:s,access:n}){var a,i,h,u;const r=ss(e.community,e.roomId,s,n),o=m.useRef(null),d=m.useRef(!0),f=(i=(a=r.data)==null?void 0:a.entries.at(-1))==null?void 0:i.id;m.useLayoutEffect(()=>{const N=o.current;N&&d.current&&(N.scrollTop=N.scrollHeight)},[f]);const l={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:Zs,target:l,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:o,onScroll:N=>{const C=N.currentTarget;d.current=C.scrollHeight-C.scrollTop-C.clientHeight<40},className:"min-h-0 flex-1 overflow-auto py-2","aria-label":"Messages",children:[r.isError&&t.jsxs("p",{role:"alert",className:"px-4 text-sm",children:["Couldn’t load this direct message."," ",t.jsx(k,{variant:"ghost",size:"sm",onClick:()=>void r.refetch(),children:"Retry"})]}),((h=r.data)==null?void 0:h.entries.length)===0&&t.jsx("p",{className:"text-muted-foreground px-4 text-sm",children:"No messages yet."}),(u=r.data)==null?void 0:u.entries.map(N=>t.jsx(pt,{entry:N},N.id))]})]})})}function tn({community:e,roomId:s,children:n}){var f;const r=(f=xe().data)==null?void 0:f.find(l=>l.ref===e),o=_e(r==null?void 0:r.access),{dm:d}=ot(e,s,o.verified&&o.capabilities.read,o.fingerprint);return d?d.readOnly&&d.localAgentId?t.jsx(en,{dm:d,localAgentId:d.localAgentId,access:o.fingerprint}):t.jsxs("div",{className:"flex h-full min-h-0 flex-col",children:[t.jsx(sn,{dm:d,accessFingerprint:o.fingerprint}),t.jsx("div",{className:"min-h-0 flex-1",children:n(d.agent.displayName)})]}):n()}function sn({dm:e,accessFingerprint:s}){var d;const r=(d=it(e.community,e.roomId,!0,s).data)==null?void 0:d.members.find(f=>f.memberId===e.agent.memberId),o=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:` · ${o}’s agent · ${o} can read this`})]}),(r==null?void 0:r.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 nn(){const{id:e,community:s}=ct({from:"/_shell/channels"}),n=ns(s);return s&&!n.visible?n.isLoading?null:t.jsx(rs,{...ge.channels(),search:{},replace:!0}):t.jsxs(t.Fragment,{children:[s?t.jsx(Gs,{community:s,roomId:e}):e===void 0&&t.jsx(lt,{children:"Channels"}),t.jsx(rn,{})]})}function rn(){const{id:e,thread:s,entry:n,community:r}=ct({from:"/_shell/channels"}),o=Re(),d=ys(r?void 0:e,s,n),f=as();return r&&e?t.jsx(
|
|
10
|
+
`)),children:a?"Copied":i?"Couldn’t copy":l.length===1?"Copy your draft":"Copy your drafts"}),t.jsx(k,{variant:v?"outline":"destructive",onClick:()=>d(!0),children:v?"Remove from DorkOS":"Remove local copy"})]}),t.jsx(Ve,{open:o,onOpenChange:z=>{z||r.reset(),d(z)},children:t.jsxs(Xe,{children:[t.jsxs(Ze,{children:[t.jsx(et,{children:v?`Remove ${u} from DorkOS?`:`Remove your copy of ${u}?`}),t.jsx(tt,{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})]})})]}),r.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(st,{children:[t.jsx(nt,{disabled:r.isPending,children:"Cancel"}),t.jsx(k,{variant:"destructive",disabled:r.isPending,onClick:C,children:r.isPending?"Removing…":v?"Remove from DorkOS":"Remove local copy"})]})]})})]})}function Xs({connection:e,dateFormat:s}){var d,f;const n=ds(e);if(!n)return null;const[r,...o]=us(n,(f=(d=e.access)==null?void 0:d.lastKnown)==null?void 0:f.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(Zt,{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:r}),o.map(l=>t.jsx("p",{children:l},l))]}),t.jsxs(k,{variant:"outline",size:"sm",className:"shrink-0",onClick:()=>ts(ms(e)),children:["Open space",t.jsx(es,{className:"size-3.5","aria-hidden":!0})]})]})}const Zs={reactions:!1,threads:!1,runWith:!1,attachments:!1,mentions:!1,streamHealth:!1,presence:!1,turnStatus:!1,asks:!1};function en({dm:e,localAgentId:s,access:n}){var a,i,h,u;const r=ss(e.community,e.roomId,s,n),o=m.useRef(null),d=m.useRef(!0),f=(i=(a=r.data)==null?void 0:a.entries.at(-1))==null?void 0:i.id;m.useLayoutEffect(()=>{const N=o.current;N&&d.current&&(N.scrollTop=N.scrollHeight)},[f]);const l={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:Zs,target:l,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:o,onScroll:N=>{const C=N.currentTarget;d.current=C.scrollHeight-C.scrollTop-C.clientHeight<40},className:"min-h-0 flex-1 overflow-auto py-2","aria-label":"Messages",children:[r.isError&&t.jsxs("p",{role:"alert",className:"px-4 text-sm",children:["Couldn’t load this direct message."," ",t.jsx(k,{variant:"ghost",size:"sm",onClick:()=>void r.refetch(),children:"Retry"})]}),((h=r.data)==null?void 0:h.entries.length)===0&&t.jsx("p",{className:"text-muted-foreground px-4 text-sm",children:"No messages yet."}),(u=r.data)==null?void 0:u.entries.map(N=>t.jsx(pt,{entry:N},N.id))]})]})})}function tn({community:e,roomId:s,children:n}){var f;const r=(f=xe().data)==null?void 0:f.find(l=>l.ref===e),o=_e(r==null?void 0:r.access),{dm:d}=ot(e,s,o.verified&&o.capabilities.read,o.fingerprint);return d?d.readOnly&&d.localAgentId?t.jsx(en,{dm:d,localAgentId:d.localAgentId,access:o.fingerprint}):t.jsxs("div",{className:"flex h-full min-h-0 flex-col",children:[t.jsx(sn,{dm:d,accessFingerprint:o.fingerprint}),t.jsx("div",{className:"min-h-0 flex-1",children:n(d.agent.displayName)})]}):n()}function sn({dm:e,accessFingerprint:s}){var d;const r=(d=it(e.community,e.roomId,!0,s).data)==null?void 0:d.members.find(f=>f.memberId===e.agent.memberId),o=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:` · ${o}’s agent · ${o} can read this`})]}),(r==null?void 0:r.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 nn(){const{id:e,community:s}=ct({from:"/_shell/channels"}),n=ns(s);return s&&!n.visible?n.isLoading?null:t.jsx(rs,{...ge.channels(),search:{},replace:!0}):t.jsxs(t.Fragment,{children:[s?t.jsx(Gs,{community:s,roomId:e}):e===void 0&&t.jsx(lt,{children:"Channels"}),t.jsx(rn,{})]})}function rn(){const{id:e,thread:s,entry:n,community:r}=ct({from:"/_shell/channels"}),o=Re(),d=ys(r?void 0:e,s,n),f=as();return r&&e?t.jsx(Qe,{community:r,children:t.jsx(tn,{community:r,roomId:e,children:l=>t.jsx(Qs,{community:r,roomId:e,threadId:s,dmAgentName:l,onThread:a=>{o({...ge.channels(),search:{community:r,id:e,thread:a}})}})},JSON.stringify([r,e]))}):r?t.jsx(Qe,{community:r,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(He,{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."})]})}):d==="pending"?t.jsx("div",{className:"flex h-full flex-col","aria-busy":!0,children:t.jsx(os,{})}):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(He,{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:f?"Open one from All, at the bottom of the screen.":"Open one from the sidebar, or use + next to Channels."})]}):t.jsx(ls,{roomId:e,threadId:s,entrySeq:n,threadRoute:"/channels"})}function Qe({community:e,children:s}){var o;const n=Re(),r=(o=xe().data)==null?void 0:o.find(d=>d.ref===e);return r&>(r)?t.jsx(Vs,{connection:r,onRemoved:()=>void n({...ge.channels(),search:{}})}):t.jsxs("div",{className:"flex h-full min-h-0 flex-col",children:[r&&t.jsx(Xs,{connection:r}),r&&t.jsx(hs,{connection:r}),t.jsx("div",{className:"min-h-0 flex-1",children:s})]})}const Qn=nn;export{Qn as component};
|