dorkos 0.125.4 → 0.126.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 +87565 -87134
- package/dist/browser/native/package-manifest.json +1 -1
- package/dist/browser/source-manifest.json +1 -1
- package/dist/client/assets/{AboutPage-CTG5VvGg.js → AboutPage-2c9n8B32.js} +1 -1
- package/dist/client/assets/{ActivityErrorState-BSuvlEdx.js → ActivityErrorState-muwC_jif.js} +1 -1
- package/dist/client/assets/{ActivityPage-BoiN89nn.js → ActivityPage-2aUz3zv0.js} +1 -1
- package/dist/client/assets/{ActivityRow-Bj0V45d7.js → ActivityRow-nQBqDCak.js} +1 -1
- package/dist/client/assets/{AdapterIcon-LFpWySMg.js → AdapterIcon-ChpyilnO.js} +1 -1
- package/dist/client/assets/{AdapterSetupWizard-D9V6g6ha.js → AdapterSetupWizard-DRKQp5Gh.js} +2 -2
- package/dist/client/assets/{AgentOptionRow-nGR6PdC6.js → AgentOptionRow-CeVPhvTq.js} +1 -1
- package/dist/client/assets/{AgentPicker-BhsmtQgu.js → AgentPicker-D8YX1P_q.js} +1 -1
- package/dist/client/assets/{AgentRequestCard-DBVuClMO.js → AgentRequestCard-refCLvuV.js} +3 -3
- package/dist/client/assets/{AppearancePage-DoDVD6OA.js → AppearancePage-BDTIp3j0.js} +1 -1
- package/dist/client/assets/{ApplyToOverridesDialog-56HrIRuZ.js → ApplyToOverridesDialog-C-XL9N4W.js} +1 -1
- package/dist/client/assets/{AttentionSignalRow-x8vRACw-.js → AttentionSignalRow-Dn4rP542.js} +1 -1
- package/dist/client/assets/{BaseTanStackRouterDevtoolsPanel-B-iktbLX-Bxeb6ihh.js → BaseTanStackRouterDevtoolsPanel-B-iktbLX-B0sy0nRk.js} +1 -1
- package/dist/client/assets/{BindingDialog-D6HqDfnK.js → BindingDialog-DMYB-vWm.js} +1 -1
- package/dist/client/assets/{BlintzCanvas-DFsdE-hF.js → BlintzCanvas-D9ZLEDXc.js} +28 -28
- package/dist/client/assets/{CanvasCsvContent-BsRV_kUK.js → CanvasCsvContent-DMqGpNWm.js} +1 -1
- package/dist/client/assets/{CanvasFileContent-BzGYGFSi.js → CanvasFileContent-Bxhc86lv.js} +2 -2
- package/dist/client/assets/{CanvasModel3dContent-dA90prow.js → CanvasModel3dContent-D783Ql7m.js} +2 -2
- package/dist/client/assets/ChannelComposer-BNlD-d2W.js +44 -0
- package/dist/client/assets/{ChatAppsOff-4xIVwDUJ.js → ChatAppsOff-eRAfqzJR.js} +2 -2
- package/dist/client/assets/{CodeMirrorDiff-Cexj7RYA.js → CodeMirrorDiff-CqEUAG6G.js} +1 -1
- package/dist/client/assets/{CodeMirrorEditor-D1-q0hSM.js → CodeMirrorEditor-BM1ANude.js} +1 -1
- package/dist/client/assets/{CommitmentList-Bn7E15MO.js → CommitmentList-C3QvbbGF.js} +1 -1
- package/dist/client/assets/{CommitmentsPage-Ch-y0wr0.js → CommitmentsPage-bmqKNd-Z.js} +1 -1
- package/dist/client/assets/{ComputerResourceView-Bbqh7e8R.js → ComputerResourceView-78falOZG.js} +1 -1
- package/dist/client/assets/{ComputerViewer-XqZtg4O4.js → ComputerViewer-DZ2RiDbn.js} +1 -1
- package/dist/client/assets/{ConnectionAccessLists-D324Hahi.js → ConnectionAccessLists-CXsNyR4U.js} +1 -1
- package/dist/client/assets/{ConnectionsPage-5nIQrmtW.js → ConnectionsPage-bpkRfRRK.js} +2 -2
- package/dist/client/assets/{ConventionPage-PFy9ASYy.js → ConventionPage-rYtICYjS.js} +3 -3
- package/dist/client/assets/{ExtensionPageRoute-ClLEO5sJ.js → ExtensionPageRoute-DXTqUrR4.js} +2 -2
- package/dist/client/assets/{FloatingTanStackRouterDevtools-CqogiFob-D007PSSL.js → FloatingTanStackRouterDevtools-CqogiFob-CCNB3_Gb.js} +1 -1
- package/dist/client/assets/ForwardConsentHost-BfVnJ6oD.js +1 -0
- package/dist/client/assets/HandlePage-BH_G4sMV.js +1 -0
- package/dist/client/assets/{HeartbeatPage-IqTdsHR6.js → HeartbeatPage-DdAfcR81.js} +1 -1
- package/dist/client/assets/{KeyEntry-ZYnZcVmM.js → KeyEntry-CR7GBqXf.js} +1 -1
- package/dist/client/assets/{LexicalField-PdcZjVov.js → LexicalField-RAoub3wq.js} +2 -2
- package/dist/client/assets/{ManagesPage-doVOC8Dk.js → ManagesPage-CEhYj9ov.js} +1 -1
- package/dist/client/assets/{Marketplace-B9X8IIWI.js → Marketplace-DtxHDbF4.js} +2 -2
- package/dist/client/assets/{MarketplaceSourcesView-BZCnUvqP.js → MarketplaceSourcesView-CSFvFtV_.js} +1 -1
- package/dist/client/assets/{McpAppFrame-BXdeDoQB.js → McpAppFrame-1mPdRK9p.js} +2 -2
- package/dist/client/assets/{McpSigninBody-CI-gwQuU.js → McpSigninBody--HfjMnE1.js} +1 -1
- package/dist/client/assets/{Model3dViewer-ws_p2e-Q.js → Model3dViewer-BT2SY67i.js} +1 -1
- package/dist/client/assets/NamePage-CaJsVRhh.js +1 -0
- package/dist/client/assets/NewDirectMessageMenu-QUtJTzKI.js +1 -0
- package/dist/client/assets/{NotificationsPage-D_qHMJYR.js → NotificationsPage-D3fleW0i.js} +1 -1
- package/dist/client/assets/OpenMeshSwitch-8WEn0WrA.js +5 -0
- package/dist/client/assets/{OperatorIdentityForm-DBbsUGPX.js → OperatorIdentityForm-BRKAQS0D.js} +1 -1
- package/dist/client/assets/{PermissionHistory-DNBswqms.js → PermissionHistory-5stLHBu8.js} +1 -1
- package/dist/client/assets/{PermissionsPage-D6cAIUTe.js → PermissionsPage-C2pB1TCJ.js} +1 -1
- package/dist/client/assets/{PersonalityPopover-d_PR1nuF.js → PersonalityPopover-DIbsJ6HP.js} +1 -1
- package/dist/client/assets/PhotoPage-33Xh8sq1.js +1 -0
- package/dist/client/assets/{PreviewRefusedNotice-p-KIYJVf.js → PreviewRefusedNotice-CjT7jQ45.js} +1 -1
- package/dist/client/assets/{ProfileFields-D_e9XQav.js → ProfileFields-gZNaFBow.js} +1 -1
- package/dist/client/assets/{ProfilePanelContainer-DxSkglaS.js → ProfilePanelContainer-DYf7L8xJ.js} +1 -1
- package/dist/client/assets/{ProfileRolePicker-kNJMfzUF.js → ProfileRolePicker-DclYXFSP.js} +1 -1
- package/dist/client/assets/{PromptSuggestionChips-Dpie7Ut6.js → PromptSuggestionChips-k9HolS90.js} +1 -1
- package/dist/client/assets/{ReportsToPopover-kZWnpINs.js → ReportsToPopover-Bh5KrFbJ.js} +1 -1
- package/dist/client/assets/RoomSurface-32U7Wl6Z.js +1 -0
- package/dist/client/assets/{RoomsPage-B88d-F2r.js → RoomsPage-sdMZgHla.js} +1 -1
- package/dist/client/assets/{RunsOnPopover-C51USCpv.js → RunsOnPopover-B5_Jz7ir.js} +1 -1
- package/dist/client/assets/{RuntimeConnectFlow-DJMtgkZF.js → RuntimeConnectFlow-C_6ozpAK.js} +1 -1
- package/dist/client/assets/RuntimeSetupDialog-BDvzruM4.js +1 -0
- package/dist/client/assets/{SeenDevices-DQnrqn19.js → SeenDevices-CZ--8ljN.js} +3 -3
- package/dist/client/assets/{SessionsPage-BxT6HETG.js → SessionsPage-BKyrJh1O.js} +1 -1
- package/dist/client/assets/{SettingsDialog-BriAKBHz.js → SettingsDialog-E5hPag3F.js} +3 -3
- package/dist/client/assets/{SkillsPage-QfxMaHeF.js → SkillsPage-BeL6zfgw.js} +1 -1
- package/dist/client/assets/{TaskDialogWrapper-D54Nqlkr.js → TaskDialogWrapper-B-IP5hYv.js} +1 -1
- package/dist/client/assets/TasksEmptyState-BcftWVbk.js +3 -0
- package/dist/client/assets/TasksPage-CmroTI1v.js +1 -0
- package/dist/client/assets/{TeamComputerEntry-BtSsE94x.js → TeamComputerEntry-DbfoZrZz.js} +1 -1
- package/dist/client/assets/{ToolsPage-CfM2Cdtm.js → ToolsPage-h-PS45fZ.js} +1 -1
- package/dist/client/assets/{TopologyGraph-BMvLKLwd.js → TopologyGraph-Bk_0y0Yy.js} +15 -15
- package/dist/client/assets/{TourHost-XxcgkZcj.js → TourHost-D4La-1-E.js} +1 -1
- package/dist/client/assets/{UnlinkDialog-D1tIChdU.js → UnlinkDialog-CWd4fhT4.js} +1 -1
- package/dist/client/assets/UnreadDivider-Bvg9QLn9.js +1 -0
- package/dist/client/assets/{WidgetErrorCard-DQWpqcbG.js → WidgetErrorCard-DictdlWO.js} +3 -3
- package/dist/client/assets/WorkView-DxThzZ0w.js +51 -0
- package/dist/client/assets/{_shell-C5LhHVEU.js → _shell-CX_gaQPE.js} +22 -22
- package/dist/client/assets/{_shell._home-BhaXi3EI.js → _shell._home-CBNsPEH4.js} +1 -1
- package/dist/client/assets/{_shell._home.activity-Bd8jIlgC.js → _shell._home.activity-DpSGWVSW.js} +1 -1
- package/dist/client/assets/_shell._home.index-BWH93iWg.js +3 -0
- package/dist/client/assets/_shell._home.tasks-Ive4UW8c.js +1 -0
- package/dist/client/assets/{_shell._home.workspaces-Cew8PET2.js → _shell._home.workspaces-3R3VtH7x.js} +1 -1
- package/dist/client/assets/{_shell.channels-efUOy5uH.js → _shell.channels-DRslcaiA.js} +4 -4
- package/dist/client/assets/{_shell.connections-DS8BI_M6.js → _shell.connections-BPQxNUPD.js} +1 -1
- package/dist/client/assets/{_shell.feedback-requests-C9nwY8FH.js → _shell.feedback-requests-DkXEk3qm.js} +2 -2
- package/dist/client/assets/_shell.marketplace-D8deZF5L.js +1 -0
- package/dist/client/assets/_shell.marketplace_.sources-BHG9MqWR.js +1 -0
- package/dist/client/assets/_shell.session-CkdA2hgF.js +1 -0
- package/dist/client/assets/{_shell.team-DejtvgcD.js → _shell.team-CZu-l34d.js} +3 -3
- package/dist/client/assets/_shell.threads-Cz-EZQXr.js +1 -0
- package/dist/client/assets/_shell.x._extensionId-Cry6E5KK.js +1 -0
- package/dist/client/assets/_shell.x._extensionId_._-Cry6E5KK.js +1 -0
- package/dist/client/assets/{abnfDiagram-WEYOIA3C-CAQusbaN.js → abnfDiagram-WEYOIA3C-4hI8_uRi.js} +1 -1
- package/dist/client/assets/{access-copy-DzgVmhna.js → access-copy-BegDAoeR.js} +1 -1
- package/dist/client/assets/{arc-Dx6GrexJ.js → arc-DgydwPM5.js} +1 -1
- package/dist/client/assets/{architectureDiagram-ZHVYKT53-wFr3hleP.js → architectureDiagram-ZHVYKT53-4kexDkbn.js} +1 -1
- package/dist/client/assets/{banner-C0yzCrO7.js → banner-CYV5jQI0.js} +2 -2
- package/dist/client/assets/{blockDiagram-RJAE7QA3-CnuvSqM0.js → blockDiagram-RJAE7QA3-BUP4L5_m.js} +1 -1
- package/dist/client/assets/{c4Diagram-XDPPPE54-DzLijAHt.js → c4Diagram-XDPPPE54-B4HK3S3o.js} +1 -1
- package/dist/client/assets/{card-ZF4yWM1Y.js → card-6VNSI3kT.js} +1 -1
- package/dist/client/assets/channel-Bf4e4rlX.js +1 -0
- package/dist/client/assets/{chunk-2E7WHVMD-SN1xBBT1.js → chunk-2E7WHVMD-Bhw5hCVI.js} +1 -1
- package/dist/client/assets/{chunk-2Q5K7J3B-DbW-InNL.js → chunk-2Q5K7J3B-CeUgfCvO.js} +1 -1
- package/dist/client/assets/{chunk-4EMNKR2T-DxMZsEVE.js → chunk-4EMNKR2T-DqSZunXx.js} +1 -1
- package/dist/client/assets/{chunk-55XCU76K-9dknyxgR.js → chunk-55XCU76K-Bigp9-bU.js} +1 -1
- package/dist/client/assets/{chunk-5VM5RSS4-CeL_dp1K.js → chunk-5VM5RSS4-DF1L8DrH.js} +1 -1
- package/dist/client/assets/{chunk-JWPE2WC7-H-uQEL4m.js → chunk-JWPE2WC7-lcFap_43.js} +1 -1
- package/dist/client/assets/{chunk-VQ5W62QI-YZCtp46Q.js → chunk-VQ5W62QI-Bgmsy9NF.js} +1 -1
- package/dist/client/assets/{chunk-XXDRQBXY-CTsuviQ9.js → chunk-XXDRQBXY-DFFzLm_u.js} +1 -1
- package/dist/client/assets/{chunk-ZCHMQSOR-Dymmj4ca.js → chunk-ZCHMQSOR-B4aJwBdo.js} +2 -2
- package/dist/client/assets/{classDiagram-v2-4MYWR3UA-AZrXuO6n.js → classDiagram-v2-4MYWR3UA-BdUAMGnS.js} +1 -1
- package/dist/client/assets/{command-D2uvj-5S.js → command-Dz2pZLle.js} +1 -1
- package/dist/client/assets/{cose-bilkent-JH36ORCC-DH6uyH8n.js → cose-bilkent-JH36ORCC-BdJxQmWe.js} +1 -1
- package/dist/client/assets/{cpu-CxkuIIZ9.js → cpu-CjKJ8pVl.js} +1 -1
- package/dist/client/assets/{cynefin-EF2NZ3EQ-CPF1WTGP.js → cynefin-EF2NZ3EQ-BvnDWKe0.js} +1 -1
- package/dist/client/assets/{cynefinDiagram-WF24UDRP-BvgLB9D2.js → cynefinDiagram-WF24UDRP-DKL8UyvS.js} +1 -1
- package/dist/client/assets/{dagre-NK4GIZVX-Dbgki4TG.js → dagre-NK4GIZVX-CCuJpxlY.js} +1 -1
- package/dist/client/assets/{diagram-CBK3MWTC-C84DYVUU.js → diagram-CBK3MWTC-C1jeuv8r.js} +1 -1
- package/dist/client/assets/{diagram-I5XIIV2D-DKFohwHa.js → diagram-I5XIIV2D-CSnTyOU0.js} +1 -1
- package/dist/client/assets/{diagram-ODIL2UCW-C80JpCDz.js → diagram-ODIL2UCW-9w6q1YKi.js} +1 -1
- package/dist/client/assets/{diagram-PFBEJUXE-I7bZPRJw.js → diagram-PFBEJUXE-BMFBmD0P.js} +1 -1
- package/dist/client/assets/{diagram-RJA3I4VV-Gqdnf6A3.js → diagram-RJA3I4VV-D9Utl6qX.js} +1 -1
- package/dist/client/assets/{diagram-TYUNFSNR-CCzmXB0d.js → diagram-TYUNFSNR-u_ogc51l.js} +1 -1
- package/dist/client/assets/{ebnfDiagram-V4P3TTPT-DWKMGbp5.js → ebnfDiagram-V4P3TTPT-Bg_smbFH.js} +1 -1
- package/dist/client/assets/{elk-QONTBCTQ-BH9-VsJv.js → elk-QONTBCTQ-CtuwbIK2.js} +1 -1
- package/dist/client/assets/{empty-state-CQVHyP7G.js → empty-state-CbFKhqwB.js} +1 -1
- package/dist/client/assets/{erDiagram-KYQIGQAA-Dw7o0PKQ.js → erDiagram-KYQIGQAA-MlvYHdZ7.js} +1 -1
- package/dist/client/assets/{execution-config-B0Ip8o1B.js → execution-config-BjNjQoBp.js} +1 -1
- package/dist/client/assets/{file-aWVIKIhu.js → file-JokR8lB2.js} +1 -1
- package/dist/client/assets/{file-exclamation-point-VqrEIkK2.js → file-exclamation-point-sl45DZYe.js} +1 -1
- package/dist/client/assets/{file-text-BcDT6eqO.js → file-text-C4PxLfBm.js} +1 -1
- package/dist/client/assets/{find-latest-widget-fence-BBx2mbzG.js → find-latest-widget-fence-Bc1LICCy.js} +5 -5
- package/dist/client/assets/{flowDiagram-IUGLLWBU-DUap_2VM.js → flowDiagram-IUGLLWBU-BlrKbUnh.js} +1 -1
- package/dist/client/assets/{form-Bq-P02ub.js → form-1NlezfMg.js} +1 -1
- package/dist/client/assets/{format-cron-CoTCXmQp.js → format-cron-C57sE3sK.js} +1 -1
- package/dist/client/assets/{ganttDiagram-R7GPNTJY-GAxFxszj.js → ganttDiagram-R7GPNTJY-BhCCQ-d7.js} +3 -3
- package/dist/client/assets/{git-branch-Cvc-Sr6q.js → git-branch-BXEb1Sqq.js} +1 -1
- package/dist/client/assets/{gitGraphDiagram-PDYL7XHY-CNXDdCW9.js → gitGraphDiagram-PDYL7XHY-Chl1aqHg.js} +1 -1
- package/dist/client/assets/{graph-CtCYTWZj.js → graph-DIIpUxLd.js} +1 -1
- package/dist/client/assets/{heart-yvX6jsem.js → heart-CUs7jdhV.js} +1 -1
- package/dist/client/assets/{highlighted-body-KPVGNVTW-B6iFwydl.js → highlighted-body-KPVGNVTW-DlDHGjld.js} +1 -1
- package/dist/client/assets/image-lightbox-BczXKBTZ.js +1 -0
- package/dist/client/assets/image-off-Ch98GGBJ.js +6 -0
- package/dist/client/assets/{index-BsmQ2VMC.js → index-0MDZSAdr.js} +1 -1
- package/dist/client/assets/{index-KLtoKDvx.js → index-37h1E-65.js} +1 -1
- package/dist/client/assets/{index-CIIAns2d.js → index-8FrM4Unx.js} +1 -1
- package/dist/client/assets/{index-D9pvn-mm.js → index-B0p2_o3r.js} +1 -1
- package/dist/client/assets/{index-BI7mYC3q.js → index-B0q1o1JU.js} +1 -1
- package/dist/client/assets/{index-p7yYM6Iz.js → index-BAnl5kwm.js} +1 -1
- package/dist/client/assets/{index-io81RE8o.js → index-BC41bN42.js} +1 -1
- package/dist/client/assets/{index-CYPbNdgY.js → index-BNJa5z6K.js} +7 -7
- package/dist/client/assets/{index-CZA2uFZQ.js → index-BQlnEL5t.js} +1 -1
- package/dist/client/assets/{index-BzlepYwD.js → index-BRyEtRBO.js} +1 -1
- package/dist/client/assets/index-BThp0Av1.js +1 -0
- package/dist/client/assets/{index-FCztjyrm.js → index-BVjrgWDa.js} +1 -1
- package/dist/client/assets/{index-thNMHUmT.js → index-BiyMpL0z.js} +1 -1
- package/dist/client/assets/{index-GEDh_fwN.js → index-BwHCH3tE.js} +1 -1
- package/dist/client/assets/index-ByIDaFWv.js +1 -0
- package/dist/client/assets/{index-NbnKjhyZ.js → index-BzqkXlms.js} +1 -1
- package/dist/client/assets/index-CFJcOzPD.js +1 -0
- package/dist/client/assets/{index-B8YnzTmr.js → index-CQTeDD0B.js} +1 -1
- package/dist/client/assets/{index-Dqq2lV9x.js → index-CSOhBvPV.js} +1 -1
- package/dist/client/assets/{index-DefXQdQA.js → index-CYhf-E_N.js} +1 -1
- package/dist/client/assets/{index-BSGg8ud2.js → index-CaVP52c1.js} +1 -1
- package/dist/client/assets/{index-CCo77KAN.js → index-Cn1ZEy3S.js} +1 -1
- package/dist/client/assets/{index-N3JAoXse.js → index-CnNGTb8f.js} +1 -1
- package/dist/client/assets/{index-CaOL5rt9.js → index-Cnjpi7ar.js} +3 -3
- package/dist/client/assets/{index-Cdzlu1-P.js → index-CoHeCySh.js} +1 -1
- package/dist/client/assets/index-CujX3mpY.css +1 -0
- package/dist/client/assets/{index-DRao3lV4.js → index-Cw0QRsnv.js} +1 -1
- package/dist/client/assets/{index-D1e3aPAe.js → index-Czar7aPT.js} +2 -2
- package/dist/client/assets/{index-CYl4FhO7.js → index-D1Be28yK.js} +1 -1
- package/dist/client/assets/{index-xKvoBO92.js → index-D6NjBiAq.js} +1 -1
- package/dist/client/assets/{index-CXCoNv1T.js → index-DMfV6rUz.js} +1 -1
- package/dist/client/assets/index-D_9H4FdK.js +1 -0
- package/dist/client/assets/{index-Bcv5Znqx.js → index-DaZdDh7o.js} +1 -1
- package/dist/client/assets/{index-sTYFlBEJ.js → index-DlZ77Qfj.js} +1 -1
- package/dist/client/assets/index-Dv6HjbCS.js +1 -0
- package/dist/client/assets/index-DwrBsA10.js +1053 -0
- package/dist/client/assets/{index-B1UgkD5d.js → index-DzLIbXMR.js} +1 -1
- package/dist/client/assets/{index-COenrxg6.js → index-Ev7FZl9a.js} +1 -1
- package/dist/client/assets/{index-B7M2ny5y.js → index-HnW-eS5i.js} +1 -1
- package/dist/client/assets/{index-DuEmhl4K.js → index-hyqRnlFg.js} +1 -1
- package/dist/client/assets/{index-B36G1Wt7.js → index-pQstFziR.js} +3 -3
- package/dist/client/assets/{index-vWi6pOlY.js → index-rKEUwjq8.js} +1 -1
- package/dist/client/assets/{index-BJKRrppi.js → index-slBSiB-H.js} +1 -1
- package/dist/client/assets/{index-BIoO-kFF.js → index-vU7itvE8.js} +1 -1
- package/dist/client/assets/{index.esm-BYS3OpKb.js → index.esm-DM8Bqi3n.js} +1 -1
- package/dist/client/assets/{infoDiagram-MVDRKAX5-BB5v9AOj.js → infoDiagram-MVDRKAX5-C0p1eP9j.js} +1 -1
- package/dist/client/assets/{inline-code-Df1J1tQV.js → inline-code-CNmpgW3O.js} +1 -1
- package/dist/client/assets/{ishikawaDiagram-HPEHV2GE-D8Zw0Wka.js → ishikawaDiagram-HPEHV2GE-COdxgYUT.js} +1 -1
- package/dist/client/assets/{journeyDiagram-BOSHW7O7-CIaVEmcq.js → journeyDiagram-BOSHW7O7-C84Ny9n9.js} +1 -1
- package/dist/client/assets/{kanban-definition-FNSA4HC5-D0jxBQB1.js → kanban-definition-FNSA4HC5-ECSXhFX0.js} +1 -1
- package/dist/client/assets/{layers-Byywl2sz.js → layers-JgRwJGyf.js} +1 -1
- package/dist/client/assets/{lightbulb-Cu6PlV7n.js → lightbulb-BhQB8sFP.js} +1 -1
- package/dist/client/assets/{link-2-D2LX2bAn.js → link-2-B4byjdgg.js} +1 -1
- package/dist/client/assets/{list-runtime-types-C4Ik3n5A.js → list-runtime-types-M5_gxIg1.js} +1 -1
- package/dist/client/assets/{markdown-content-BbH7L0YO.js → markdown-content-C3qWcii6.js} +1 -1
- package/dist/client/assets/{mention-pill-DxRP9Bkp.js → mention-pill-DUbgdKmA.js} +1 -1
- package/dist/client/assets/{mermaid.core-D9Vc69mt.js → mermaid.core-BQiwaVjZ.js} +4 -4
- package/dist/client/assets/{message-square-off-BP01X_ck.js → message-square-off-AjtFFe_u.js} +1 -1
- package/dist/client/assets/{mindmap-definition-6OY57UG3-DNd2V0AH.js → mindmap-definition-6OY57UG3-BfA6EqgP.js} +1 -1
- package/dist/client/assets/{more-details-7psgoF8x.js → more-details-itSF4Fah.js} +1 -1
- package/dist/client/assets/{owner-notice-83ejBJ3g.js → owner-notice-B6JRjE_c.js} +1 -1
- package/dist/client/assets/{package-DSJyi_sq.js → package-5YQSitlR.js} +1 -1
- package/dist/client/assets/{page-container-D7q7ISl1.js → page-container-DBPUOYYM.js} +1 -1
- package/dist/client/assets/{pane-resize-handle-BnQ8IKj6.js → pane-resize-handle-Kwb3zKa6.js} +1 -1
- package/dist/client/assets/{paperclip-CeOJ8Nwp.js → paperclip-IRKZTEQw.js} +1 -1
- package/dist/client/assets/{path-input-BToXn1c2.js → path-input-BHkA4fFw.js} +1 -1
- package/dist/client/assets/{pegDiagram-ECIUJNBX-sCkH1RIT.js → pegDiagram-ECIUJNBX-CqIy9WDe.js} +1 -1
- package/dist/client/assets/{pieDiagram-GNMPY74T-B4V9xf2z.js → pieDiagram-GNMPY74T-C5yI3cvV.js} +1 -1
- package/dist/client/assets/{plug-CMcqk2p3.js → plug-CupdBXaG.js} +1 -1
- package/dist/client/assets/{primer-trigger-DtyY4fpx.js → primer-trigger-Ci_XRRfX.js} +2 -2
- package/dist/client/assets/{profile-errors-DSKechEz.js → profile-errors-aEsWNifs.js} +1 -1
- package/dist/client/assets/{progress-8CDPI0xL.js → progress-Bpmb837n.js} +1 -1
- package/dist/client/assets/{quadrantDiagram-D57K4MC3-DkcmqAD-.js → quadrantDiagram-D57K4MC3-DyCDNvk7.js} +1 -1
- package/dist/client/assets/{query-error-state-jrioxcrf.js → query-error-state-s6AJaHa3.js} +1 -1
- package/dist/client/assets/{radio-D3k0l1vj.js → radio-Ci6Ghks8.js} +1 -1
- package/dist/client/assets/{railroadDiagram-Y72NRBL7-T9Qbdks1.js → railroadDiagram-Y72NRBL7-B3u1B937.js} +1 -1
- package/dist/client/assets/registry-DatwH4jj.js +1 -0
- package/dist/client/assets/registry-NGfn1R2_.js +34 -0
- package/dist/client/assets/{relay-trace-schemas-epyobQGg.js → relay-trace-schemas-hOFIzdY-.js} +2 -2
- package/dist/client/assets/{repeat-Cbe4MVvF.js → repeat-B1S2ceC2.js} +1 -1
- package/dist/client/assets/{requirementDiagram-EQYSW5RA-BKrsOvZR.js → requirementDiagram-EQYSW5RA-CdG-unip.js} +1 -1
- package/dist/client/assets/{room-files-source-wUgOb12j.js → room-files-source-J7gnN1gx.js} +2 -2
- package/dist/client/assets/{rotate-ccw-clock-CI-xhvb_.js → rotate-ccw-clock-7Q2akPFi.js} +1 -1
- package/dist/client/assets/{rotate-cw-BGDIfrKN.js → rotate-cw-DK3Rzmlh.js} +1 -1
- package/dist/client/assets/{sankeyDiagram-SY24JHO5-SVj2Csf7.js → sankeyDiagram-SY24JHO5-D3Z4Qk2b.js} +1 -1
- package/dist/client/assets/{scroll-area-D3x48cAw.js → scroll-area-6Gelypei.js} +1 -1
- package/dist/client/assets/{search-x-Dz-ryi0D.js → search-x-Be8VetKs.js} +2 -2
- package/dist/client/assets/{sequenceDiagram-BLEHNHQU-CSliXD3t.js → sequenceDiagram-BLEHNHQU-RXPgeLr6.js} +1 -1
- package/dist/client/assets/{shield-x-FVhBth4G.js → shield-x-D8lJ0Op0.js} +1 -1
- package/dist/client/assets/signed-in-NOeTLLso.js +1 -0
- package/dist/client/assets/{sizeCapture-INFHLROL-4lP-N234.js → sizeCapture-INFHLROL-q7qki1pK.js} +1 -1
- package/dist/client/assets/{soul-file-CS-EETV8.js → soul-file-DTEcjDxP.js} +1 -1
- package/dist/client/assets/{stateDiagram-v2-A6IESKWZ-Cij5yf9S.js → stateDiagram-v2-A6IESKWZ-DFs6IVbj.js} +1 -1
- package/dist/client/assets/{swimlanes-B3ENRKFQ-iSf_hOim.js → swimlanes-B3ENRKFQ-D1A-3JE-.js} +1 -1
- package/dist/client/assets/swimlanesDiagram-AYQRV4AK-hZFkkqUb.js +8 -0
- package/dist/client/assets/{table-Cg_1lfh0.js → table-CuBPM_bg.js} +1 -1
- package/dist/client/assets/{timeline-definition-JXYKGLGB-DVZj2yY_.js → timeline-definition-JXYKGLGB-CLHy0rAb.js} +1 -1
- package/dist/client/assets/{trust-posture-CkEXRlxW.js → trust-posture-BXXe8F8n.js} +1 -1
- package/dist/client/assets/{unplug-CASvw-Yn.js → unplug-Cuej6sM6.js} +1 -1
- package/dist/client/assets/{unverified-catalog-notice-CMDo7sp5.js → unverified-catalog-notice-BbK4SCJp.js} +1 -1
- package/dist/client/assets/{use-adapter-catalog-BVeUe0tR.js → use-adapter-catalog-Cy7ENVZN.js} +1 -1
- package/dist/client/assets/{use-bindings-Clux6PJ0.js → use-bindings-Tj0BcF4m.js} +1 -1
- package/dist/client/assets/{use-composer-prefs-D0poHQqk.js → use-composer-prefs-BrQVpwRi.js} +1 -1
- package/dist/client/assets/{use-connector-management-CQQGCFaL.js → use-connector-management-CLZQXgln.js} +1 -1
- package/dist/client/assets/{use-deep-link-scroll-BdGMaupf.js → use-deep-link-scroll-BeqtUhj2.js} +1 -1
- package/dist/client/assets/{use-delete-binding-CSpocSwM.js → use-delete-binding-d7ii9iFQ.js} +1 -1
- package/dist/client/assets/{use-dev-links-c6K0en5G.js → use-dev-links-MYOV3h2q.js} +1 -1
- package/dist/client/assets/{use-direct-message-panel-sq9_ehHu.js → use-direct-message-panel-C_lXDYnB.js} +1 -1
- package/dist/client/assets/{use-external-adapter-catalog-C3T1MGxz.js → use-external-adapter-catalog-kMFSEJGV.js} +1 -1
- package/dist/client/assets/use-full-activity-feed-MFSkvnza.js +1 -0
- package/dist/client/assets/use-is-below-desktop-CJJ4zMQO.js +1 -0
- package/dist/client/assets/{use-local-browser-Di54G1yg.js → use-local-browser-1oVtlmXD.js} +1 -1
- package/dist/client/assets/{use-mesh-topology-C_bdAJfy.js → use-mesh-topology-BJs6M6kh.js} +1 -1
- package/dist/client/assets/{use-mounted-ref-C_ChQ0xs.js → use-mounted-ref-DitdlmSI.js} +1 -1
- package/dist/client/assets/{use-notification-prefs-BjGauolP.js → use-notification-prefs-CXbRTRLF.js} +1 -1
- package/dist/client/assets/use-pending-read-CvX1lOb8.js +1 -0
- package/dist/client/assets/{use-personality-commit-WeCQulwl.js → use-personality-commit-DQrWyVGT.js} +1 -1
- package/dist/client/assets/{use-promo-activation-C9I5YwBo.js → use-promo-activation-CgdBHk2f.js} +3 -3
- package/dist/client/assets/{use-promo-dismissals-BhTNS7LX.js → use-promo-dismissals-DprcDmfs.js} +1 -1
- package/dist/client/assets/{use-pulse-freshness-DDo5a3nh.js → use-pulse-freshness-BtMzHCs3.js} +1 -1
- package/dist/client/assets/{use-relay-config-Bfjxr2lE.js → use-relay-config-CGBlgXC2.js} +1 -1
- package/dist/client/assets/{use-room-follow-claim-D_HTjK2r.js → use-room-follow-claim-Db5U7kWT.js} +1 -1
- package/dist/client/assets/{use-room-sessions-UwyzNxeo.js → use-room-sessions-K6mdH-Tb.js} +1 -1
- package/dist/client/assets/{use-roving-tab-list-CXAJxnx0.js → use-roving-tab-list-B2zxa_F_.js} +1 -1
- package/dist/client/assets/{use-session-canvas-CTDXU27z.js → use-session-canvas-D4G5fO_a.js} +7 -7
- package/dist/client/assets/{use-status-budget-CFS9gmSZ.js → use-status-budget-UccdTZ7o.js} +4 -4
- package/dist/client/assets/use-transform-BBj2pwbo.js +1 -0
- package/dist/client/assets/{use-unclaimed-chats-BlUFVbnm.js → use-unclaimed-chats-BidDnyt8.js} +1 -1
- package/dist/client/assets/use-update-config-D8g4P42J.js +1 -0
- package/dist/client/assets/{useMutationState-CUuSnqrc.js → useMutationState-RYxTf1aD.js} +1 -1
- package/dist/client/assets/{usecaseDiagram-WPOLBNNX-BTdq_YOC.js → usecaseDiagram-WPOLBNNX-Bjmcc2gK.js} +1 -1
- package/dist/client/assets/{vennDiagram-Q3Y3IDCW-BLQwiECh.js → vennDiagram-Q3Y3IDCW-Cd6C9CxW.js} +1 -1
- package/dist/client/assets/{wardleyDiagram-IVAIDKWA-Cp8QrBQm.js → wardleyDiagram-IVAIDKWA-CzWWmwUL.js} +1 -1
- package/dist/client/assets/{xychartDiagram-4URNHDU4-CrrAKTa0.js → xychartDiagram-4URNHDU4-DSUn9rhA.js} +1 -1
- package/dist/client/index.html +2 -2
- package/dist/drizzle/20261025175042_dor3123_needs_attention.sql +7 -0
- package/dist/drizzle/meta/20261025175042_snapshot.json +14093 -0
- package/dist/drizzle/meta/_journal.json +7 -0
- package/dist/server/extension-child.cjs +188 -107
- package/dist/server/index.js +11155 -7967
- package/dist/server/index.js.map +2 -2
- package/package.json +7 -7
- package/dist/client/assets/ChannelComposer-MROo35vI.js +0 -44
- package/dist/client/assets/HandlePage-DW4b2avU.js +0 -1
- package/dist/client/assets/NamePage-Cv95tb4E.js +0 -1
- package/dist/client/assets/NewDirectMessageMenu-PuW-lVGF.js +0 -1
- package/dist/client/assets/OpenMeshSwitch-DiuAcyMj.js +0 -5
- package/dist/client/assets/PhotoPage-D8f25EFY.js +0 -1
- package/dist/client/assets/RoomSurface-DyubmENi.js +0 -1
- package/dist/client/assets/RuntimeSetupDialog-DQss2qqJ.js +0 -1
- package/dist/client/assets/TasksEmptyState-rCcan38Y.js +0 -3
- package/dist/client/assets/TasksPage-rIqxyB15.js +0 -1
- package/dist/client/assets/UnreadDivider-mAlJ1Ci7.js +0 -1
- package/dist/client/assets/WorkView-D1V2vzFd.js +0 -63
- package/dist/client/assets/_shell._home.index-zoh1Ij4R.js +0 -3
- package/dist/client/assets/_shell._home.tasks-CnfbD4z-.js +0 -1
- package/dist/client/assets/_shell.marketplace-BxOR_qkR.js +0 -1
- package/dist/client/assets/_shell.marketplace_.sources-BdVMq5Gt.js +0 -1
- package/dist/client/assets/_shell.session-DxIjWGPk.js +0 -1
- package/dist/client/assets/_shell.threads-BiIjml5t.js +0 -1
- package/dist/client/assets/_shell.x._extensionId-VrXvDnpj.js +0 -1
- package/dist/client/assets/_shell.x._extensionId_._-VrXvDnpj.js +0 -1
- package/dist/client/assets/channel-BhigWC_Q.js +0 -1
- package/dist/client/assets/image-lightbox-COo7DKXH.js +0 -1
- package/dist/client/assets/image-off-BPRcQBvJ.js +0 -6
- package/dist/client/assets/index-7EayMDlv.js +0 -1
- package/dist/client/assets/index-BSNB2iOV.js +0 -1053
- package/dist/client/assets/index-CNlIRtiQ.js +0 -23
- package/dist/client/assets/index-Cbu89CsC.js +0 -1
- package/dist/client/assets/index-Drg391kA.js +0 -1
- package/dist/client/assets/index-DtlBeLQB.css +0 -1
- package/dist/client/assets/index-ZRwRzKll.js +0 -1
- package/dist/client/assets/index-bgXdb4vP.js +0 -1
- package/dist/client/assets/registry-B0s0gwF4.js +0 -1
- package/dist/client/assets/signed-in-BQcV7AMx.js +0 -1
- package/dist/client/assets/swimlanesDiagram-AYQRV4AK-C8oY0fep.js +0 -8
- package/dist/client/assets/use-full-activity-feed-Bmmagy2q.js +0 -1
- package/dist/client/assets/use-is-below-desktop-CGj5vT8N.js +0 -1
- package/dist/client/assets/use-panel-tab-placements-Bn-CIS6M.js +0 -1
- package/dist/client/assets/use-pending-read-CIp204qI.js +0 -1
- package/dist/client/assets/use-update-config-BwjEWlgj.js +0 -1
- /package/dist/client/assets/{WorkView-DIs3GY4I.css → registry-DIs3GY4I.css} +0 -0
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{
|
|
1
|
+
import{O as De,aU as _e,a1 as ne,r as a,jj as He,jk as Q,jl as W,jm as U,ge as ie,jn as Ce,a7 as Z,jo as ee,aN as dt,jp as ut,a3 as oe,jq as ft,jr as ht,js as pt,jt as mt,aY as Te,ju as xt,j as e,x as Fe,U as gt,C as Ue,aq as yt,ek as be,jv as vt,G as Oe,jw as Ct,jx as bt,jy as jt,jz as X,jA as ve,bJ as de,bK as ue,bL as fe,bM as he,bN as pe,bO as me,bP as xe,bR as ge,B as Y,b8 as kt,er as Ae,jB as wt,jC as Et,a2 as ce,jD as qe,eQ as Nt,jE as Rt,jF as St,jG as Dt,jH as Tt,aP as je,jI as Qe,a4 as Be,gc as Pe,a0 as Ft,gO as Ot,e1 as Le,jJ as Pt,gt as Mt,jK as _t,d2 as At,d3 as Lt,d5 as zt,d6 as It,d7 as $t,eB as Kt,I as Ht,dM as Ut}from"./index-DwrBsA10.js";import{t as ae,g as qt,C as Qt,n as Ge,r as Ye,a as Bt,p as Gt,F as Yt,w as Wt,c as We,b as Vt}from"./room-files-source-J7gnN1gx.js";import{N as ls,R as cs}from"./room-files-source-J7gnN1gx.js";import{d as Jt}from"./query-keys-DeYqUDia.js";import{r as Xt,c as Zt}from"./composer-insert-BpyATrmR.js";import{u as en}from"./index-DlZ77Qfj.js";import{r as Ve,h as Je,F as tn}from"./file-drag-GDx2qhdk.js";import{R as Xe}from"./rotate-cw-DK3Rzmlh.js";import{L as nn}from"./link-2-B4byjdgg.js";import{F as Ze}from"./file-JokR8lB2.js";import{G as et}from"./git-branch-BXEb1Sqq.js";import{M as sn}from"./more-details-itSF4Fah.js";import"./markdown-content-C3qWcii6.js";import"./file-exclamation-point-sl45DZYe.js";/**
|
|
2
2
|
* @license lucide-react v1.48.0 - ISC
|
|
3
3
|
*
|
|
4
4
|
* This source code is licensed under the ISC license.
|
|
@@ -13,5 +13,5 @@ import{W as De,aU as Me,a1 as ne,r as a,jc as He,jd as Q,je as W,jf as U,g9 as i
|
|
|
13
13
|
*
|
|
14
14
|
* This source code is licensed under the ISC license.
|
|
15
15
|
* See the LICENSE file in the root directory of this source tree.
|
|
16
|
-
*/const at={name:"upload",size:24,node:[["path",{d:"M12 3v12",key:"1x0j5s"}],["path",{d:"m17 8-5-5-5 5",key:"7q97r8"}],["path",{d:"M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4",key:"ih7n3h"}]]};at.node;const rn=De(at);function le(t,n,r){return["file-explorer","tree",t.scopeKey,n,t.filtersHidden?r:null]}function we(t,n,r,m){return{queryKey:le(t,n,r),queryFn:()=>t.list(n,{showHidden:r}),staleTime:Me.FILE_TREE_STALE_TIME_MS,gcTime:Me.FILE_TREE_GC_TIME_MS,refetchOnWindowFocus:!0,placeholderData:f=>f??m.getQueryData(le(t,n,!r))}}const on=[".git",".dork",".claude",".agents","node_modules"];function ln(t){return t.startsWith(".")||on.includes(t)}const Re=["ROOM.md","README.md"];function Se(t){return Re.some(n=>n.toLowerCase()===t.toLowerCase())}function rt(t){return t.filter(n=>!ln(n.name))}function cn(t){if(t.reduce((f,g)=>g.type==="file"&&Se(g.name)?f+1:f,0)===0)return t;const r=[],m=[];for(const f of t)f.type==="file"&&Se(f.name)?r.push(f):m.push(f);return r.sort((f,g)=>Re.findIndex(s=>s.toLowerCase()===f.name.toLowerCase())-Re.findIndex(s=>s.toLowerCase()===g.name.toLowerCase())),[...r,...m]}const dn=/ copy(?: \d+)?$/;function _e({name:t,isDir:n,taken:r}){const m=new Set(r);if(!m.has(t))return t;const f=n?-1:t.lastIndexOf("."),g=f>0,s=g?t.slice(f):"",p=(g?t.slice(0,f):t).replace(dn,"");for(let o=1;;o+=1){const i=o===1?`${p} copy${s}`:`${p} copy ${o}${s}`;if(!m.has(i))return i}}function ze(t,n,r){return{name:n,path:t,type:r,size:0,mtime:Date.now(),isSymlink:!1}}function un(t){const n=ne(),{source:r,showHidden:m,queryClient:f,inFlightRef:g}=t,s=r.cwd??"",[p,o]=a.useState(null),i=a.useCallback(async u=>{g.current+=1;try{return await u()}finally{g.current-=1}},[g]),d=a.useMemo(()=>{const u=x=>le(r,x,m);return{getChildren:x=>{var w;return((w=f.getQueryData(u(x)))==null?void 0:w.entries)??[]},isLoaded:x=>f.getQueryData(u(x))!==void 0,takenNames:async x=>(await n.readFileTree(s,{path:x===Q?void 0:x,showHidden:!0})).entries.map(b=>b.name),snapshot:x=>f.getQueryData(u(x)),setChildren:(x,w)=>{f.setQueryData(u(x),b=>({entries:He(w((b==null?void 0:b.entries)??[]))}))},restore:(x,w)=>{f.setQueryData(u(x),w)},invalidate:x=>{f.invalidateQueries({queryKey:u(x),exact:!0}),f.invalidateQueries({queryKey:Xt.index(s)})}}},[f,n,s,r,m]),R=a.useCallback((u,x,w)=>i(async()=>{const b=ee(u,x),D=!d.getChildren(u).some(L=>L.path===b),H=d.snapshot(u);D&&d.setChildren(u,L=>[...L,ze(b,x,w)]);try{return await n.createEntry(s,b,w),!0}catch(L){return D&&d.restore(u,H),ae(L,`Couldn’t create ${w==="dir"?"folder":"file"}`),!1}finally{d.invalidate(u)}}),[n,s,d,i]),F=a.useCallback((u,x)=>i(async()=>{if(x===u.name||x.length===0)return!0;const w=W(u.path),b=ee(w,x),D=d.getChildren(w).some(A=>A.path===b),H=d.snapshot(w),L={...u,name:x,path:b};D||d.setChildren(w,A=>A.map(K=>K.path===u.path?L:K));try{return await n.renameEntry(s,u.path,b),U.getState().remapExpandedPaths(u.path,b),!0}catch(A){return D||d.restore(w,H),ae(A,"Couldn’t rename"),!1}finally{d.invalidate(w)}}),[n,s,d,i]),E=a.useCallback(u=>i(async()=>{const x=W(u.path),w=d.snapshot(x);d.setChildren(x,b=>b.filter(D=>D.path!==u.path));try{await n.deleteEntry(s,u.path,{recursive:!0}),U.getState().dropExpandedPaths(u.path)}catch(b){d.restore(x,w),ae(b,"Couldn’t delete")}finally{d.invalidate(x)}}),[n,s,d,i]),M=a.useCallback(u=>i(async()=>{const x=W(u.path);if(u.type==="file"){const w=d.snapshot(x);d.setChildren(x,b=>b.filter(D=>D.path!==u.path));try{await n.deleteEntry(s,u.path),U.getState().dropExpandedPaths(u.path)}catch(b){d.restore(x,w),ae(b,"Couldn’t delete")}finally{d.invalidate(x)}return}try{await n.deleteEntry(s,u.path),d.setChildren(x,w=>w.filter(b=>b.path!==u.path)),U.getState().dropExpandedPaths(u.path),d.invalidate(x)}catch(w){if(qt(w)==="DIR_NOT_EMPTY"){o(u);return}ae(w,"Couldn’t delete")}}),[n,s,d,i]),j=a.useCallback(async()=>{const u=p;o(null),u&&await E(u)},[p,E]),$=a.useCallback(()=>o(null),[]),I=a.useCallback((u,x)=>i(async()=>{const w=W(u),b=ie(u),D=ee(x,b);if(x===w||D===u||Ce(x,u))return;const H=d.getChildren(w).find(C=>C.path===u);if(!H)return;const L=d.isLoaded(x),A=L&&d.getChildren(x).some(C=>C.path===D),K={...H,name:b,path:D},Y=d.snapshot(w),O=L?d.snapshot(x):void 0;d.setChildren(w,C=>C.filter(z=>z.path!==u)),L&&!A&&d.setChildren(x,C=>[...C,K]);try{await n.renameEntry(s,u,D),U.getState().remapExpandedPaths(u,D)}catch(C){d.restore(w,Y),L&&!A&&d.restore(x,O),ae(C,"Couldn’t move")}finally{d.invalidate(w),L&&d.invalidate(x)}}),[n,s,d,i]),v=a.useCallback((u,x)=>i(async()=>{if(u.isDir&&Ce(x,u.path)){J.error(Qt);return}let w;try{w=await d.takenNames(x)}catch(A){ae(A,"Couldn’t copy");return}const b=_e({name:ie(u.path),isDir:u.isDir,taken:w}),D=ee(x,b),H=d.isLoaded(x),L=H?d.snapshot(x):void 0;if(H){const A=d.getChildren(W(u.path)).find(Y=>Y.path===u.path),K=A?{...A,name:b,path:D}:ze(D,b,u.isDir?"dir":"file");d.setChildren(x,Y=>[...Y,K])}try{await n.copyEntry(s,u.path,D)}catch(A){H&&d.restore(x,L),ae(A,"Couldn’t copy")}finally{d.invalidate(x)}}),[n,s,d,i]);return{createEntry:R,renameEntry:F,removeEntry:M,moveEntry:I,copyEntry:v,pendingRecursiveDelete:p,confirmRecursiveDelete:j,cancelRecursiveDelete:$}}function fn(t){return t!=null&&t.startsWith("darwin")?"Reveal in Finder":t!=null&&t.startsWith("win32")?"Reveal in File Explorer":"Show in file manager"}function hn(t,n){const r=t.includes("\\")&&!t.includes("/"),m=t.replace(/[\\/]+$/,""),f=r?n.split("/").join("\\"):n;return`${m}${r?"\\":"/"}${f}`}function pn(t){const n=ne(),{data:r}=dt(),m=a.useMemo(()=>n.supportsReveal?fn(r==null?void 0:r.platform):null,[n.supportsReveal,r==null?void 0:r.platform]),f=a.useCallback(async i=>{if(t)try{await n.revealEntry(t,i.path)}catch(d){ae(d,"Couldn’t open the file manager")}},[n,t]),{copy:g}=ut(),s=a.useCallback(async(i,d)=>{const R=d==="absolute"&&t?hn(t,i.path):i.path;await g(R)||J.error("Couldn’t copy to the clipboard")},[t,g]),p=a.useCallback(i=>{Zt(Jt(i.path))||J.error("Open a chat to add this file")},[]),o=a.useCallback(i=>{U.getState().setClipboard({path:i.path,isDir:i.type==="dir"});try{navigator.clipboard.writeText(i.path).catch(()=>{})}catch{}},[]);return{revealLabel:m,reveal:f,copyPath:s,addToChat:p,copyToClipboard:o}}const mn=1e3;function xn(t){const{source:n,showHidden:r,queryClient:m,inFlightRef:f}=t,g=n.changes,[s,p]=a.useState(null),[o,i]=a.useState(null),[d,R]=a.useState(null),[F,E]=a.useState(0),M=a.useCallback(async c=>{f.current+=1,E(h=>h+1);try{return await c()}finally{f.current-=1,E(h=>h-1)}},[f]),j=a.useMemo(()=>{const c=h=>le(n,h,r);return{listing:h=>m.getQueryData(c(h)),isLoaded:h=>m.getQueryData(c(h))!==void 0,entries:h=>{var T;return((T=m.getQueryData(c(h)))==null?void 0:T.entries)??[]},setEntries:(h,T)=>m.setQueryData(c(h),y=>({...y,entries:He(T((y==null?void 0:y.entries)??[]))})),restore:(h,T)=>m.setQueryData(c(h),T),fetch:h=>n.list(h,{showHidden:!0}),refreshAll:()=>{m.invalidateQueries({queryKey:["file-explorer","tree",n.scopeKey]}),m.invalidateQueries({queryKey:["file-explorer","preview",n.scopeKey]})}}},[m,n,r]),$=a.useCallback(async c=>{const h=j.listing(c);return(h==null?void 0:h.commit)!==void 0?h.commit:(await j.fetch(c)).commit??null},[j]),I=a.useCallback((c,h,T,y)=>{switch(c.status){case"changed":return!0;case"conflict":return R({kind:h,path:c.path,lastCommit:c.lastCommit,retry:()=>T(c.commit)}),!1;case"exists":return J.error(y===void 0?c.reason:Ye(y)),!1;case"refused":return J.error(c.reason),!1}},[]),v=a.useCallback((c,h)=>{J.error(Ge(c)??h)},[]),u=a.useCallback((c,h,T)=>{const y=P=>M(async()=>{if(g===void 0)return!1;const N=W(c.path),S=W(h),k=ie(h),q=j.isLoaded(S),te=q&&j.entries(S).some(X=>X.path===h),V=j.listing(N),ye=S===N?void 0:j.listing(S),l={...c,name:k,path:h};te||(S===N?j.setEntries(N,X=>X.map(se=>se.path===c.path?l:se)):(j.setEntries(N,X=>X.filter(se=>se.path!==c.path)),q&&j.setEntries(S,X=>[...X,l])));const _=()=>{j.restore(N,V),S!==N&&q&&j.restore(S,ye)};try{const X=P??await $(N);if(X===null)return _(),J.error("This room has no files to change yet."),!1;const se=await g.move({from:c.path,to:h,baseCommit:X}),Ee=I(se,T,async re=>{await y(re)},k);return Ee?U.getState().remapExpandedPaths(c.path,h):_(),Ee}catch(X){return _(),v(X,T==="rename"?"Couldn’t rename":"Couldn’t move"),!1}finally{j.refreshAll()}});return y(null)},[g,j,M,$,I,v]),x=a.useCallback(async(c,h)=>h===c.name||h.length===0?!0:u(c,ee(W(c.path),h),"rename"),[u]),w=a.useCallback(async(c,h)=>{const T=W(c),y=ee(h,ie(c));if(h===T||y===c||Ce(h,c))return;const P=j.entries(T).find(N=>N.path===c);P&&await u(P,y,"move")},[j,u]),b=a.useCallback(async c=>{let h=0;const T=[c];for(;T.length>0;){const y=T.shift(),P=await j.fetch(y);for(const N of P.entries)if(N.type==="dir"?T.push(N.path):h+=1,h>=mn)return{count:h,moreThan:!0}}return{count:h,moreThan:!1}},[j]),D=a.useCallback(c=>{if(c.type!=="dir"){p({entry:c,fileCount:1,moreThan:!1});return}p({entry:c,fileCount:null,moreThan:!1}),b(c.path).then(({count:h,moreThan:T})=>p(y=>(y==null?void 0:y.entry.path)===c.path?{entry:c,fileCount:h,moreThan:T}:y),()=>{})},[b]),H=a.useCallback(c=>{const h=T=>M(async()=>{if(g===void 0)return;const y=W(c.path),P=j.listing(y);j.setEntries(y,N=>N.filter(S=>S.path!==c.path));try{const N=T??await $(y);if(N===null){j.restore(y,P);return}const S=await g.remove({path:c.path,baseCommit:N});I(S,"delete",q=>h(q))?U.getState().dropExpandedPaths(c.path):j.restore(y,P)}catch(N){j.restore(y,P),v(N,"Couldn’t delete")}finally{j.refreshAll()}});return h(null)},[g,j,M,$,I,v]),L=a.useCallback(async()=>{const c=s;p(null),c&&await H(c.entry)},[s,H]),A=a.useCallback(()=>p(null),[]),K=a.useCallback((c,h,T,y)=>{const P=N=>M(async()=>{if(g===void 0)return;const S=j.isLoaded(c),k=S?j.listing(c):void 0;if(S){const q=new Set(j.entries(c).map(V=>V.name)),te=h.filter(V=>!q.has(V.name)).map(V=>({name:V.name,path:ee(c,V.name),type:"file",size:V.size}));te.length>0&&j.setEntries(c,V=>[...V,...te])}try{const q=await g.upload({dir:c,baseCommit:N,replace:T,files:h});!I(q,"upload",V=>P(V))&&S&&j.restore(c,k)}catch(q){S&&j.restore(c,k),v(q,"Couldn’t upload")}finally{j.refreshAll()}});return P(y)},[g,j,M,I,v]),Y=a.useCallback(async(c,h)=>{if(g===void 0||h.length===0)return;if(h.length>g.maxUploadFiles){J.error(`Nothing was uploaded. One upload takes up to ${g.maxUploadFiles} files.`);return}let T;try{T=await j.fetch(c)}catch(k){v(k,"Couldn’t upload");return}const y=T.entries.map(k=>k.name),P=new Set(y),N=h.map(k=>k.name).filter(k=>P.has(k)),S=T.commit??null;if(N.length===0){await K(c,h,[],S);return}i({dir:c,files:h,names:N,taken:y,baseCommit:S})},[g,j,v,K]),O=a.useCallback(async c=>{const h=o;if(i(null),h===null)return;if(c==="replace"){await K(h.dir,h.files,h.names,h.baseCommit);return}const T=new Set([...h.taken,...h.files.map(N=>N.name)]),y=new Set(h.names),P=h.files.map(N=>{if(!y.has(N.name))return N;const S=_e({name:N.name,isDir:!1,taken:T});return T.add(S),new File([N],S,{type:N.type,lastModified:N.lastModified})});await K(h.dir,P,[],h.baseCommit)},[o,K]),C=a.useCallback(()=>i(null),[]),z=a.useCallback(()=>R(null),[]),B=a.useMemo(()=>o===null?null:{dir:o.dir,names:o.names},[o]);return{renameEntry:x,moveEntry:w,requestDelete:D,pendingDelete:s,confirmDelete:L,cancelDelete:A,upload:Y,pendingClash:B,resolveClash:O,cancelClash:C,conflict:d,dismissConflict:z,busy:F>0}}const $e={scopeKey:"",cwd:null,writable:!1,provenance:!1,filtersHidden:!0,preview:"canvas",editable:!1,list:()=>Promise.resolve({entries:[]})};function gn(t){var c,h,T;const n=ne(),r=oe(),{setTheme:m}=ft(),f=U(y=>y.showHidden),g=U(y=>y.expanded),s=U(y=>y.loadExplorerForCwd),p=U(y=>y.pruneMissing),o=(t==null?void 0:t.scopeKey)??null,i=(t==null?void 0:t.cwd)??null;a.useEffect(()=>{s(o)},[o,s]);const d=a.useMemo(()=>[Q,...ht(g)],[g]),R=pt({queries:t?d.map(y=>we(t,y,f,r)):[]}),F=(t==null?void 0:t.filtersHidden)??!0,E=a.useMemo(()=>{const y={};return d.forEach((P,N)=>{var q;const S=R[N];let k=((q=S==null?void 0:S.data)==null?void 0:q.entries)??[];!f&&!F&&(k=rt(k)),P===Q&&(k=cn(k)),y[P]={entries:k,loading:(S==null?void 0:S.isLoading)??!1,error:(S==null?void 0:S.isError)??!1}}),y},[d,R,f,F]),M=a.useRef(0),j=a.useRef({});a.useEffect(()=>{M.current>0||d.forEach((y,P)=>{var S,k,q;const N=(k=(S=R[P])==null?void 0:S.data)==null?void 0:k.entries;!N||(q=R[P])!=null&&q.isError||j.current[y]!==N&&(j.current[y]=N,p(y,N.map(te=>te.name)))})},[d,R,p]);const $=a.useMemo(()=>mt(g,E),[g,E]),I=!!t&&!!((c=E[Q])!=null&&c.loading),v=!!t&&!!((h=E[Q])!=null&&h.error),u=(T=R[0])==null?void 0:T.error,x=v&&u?Bt(u):void 0,w=(x==null?void 0:x.message)??null,b=(x==null?void 0:x.command)??null,D=a.useMemo(()=>{var P;const y=new Set;for(const N of d)N!==Q&&((P=E[N])!=null&&P.error)&&y.add(N);return y},[d,E]),H=a.useCallback(y=>{if(y.type!=="dir")return;const P=U.getState();P.setDirExpanded(y.path,!P.expanded[y.path])},[]),L=a.useCallback(y=>{if(y===Q)return;const P=U.getState();P.expanded[y]||P.setDirExpanded(y,!0)},[]),A=(t==null?void 0:t.preview)==="canvas",K=a.useCallback(y=>{if(y.type!=="file"||!A)return;const P={getStore:Te.getState,setTheme:m,supportsTerminal:n.supportsTerminal};xt(P,{action:"open_file",sourcePath:y.path},"user")},[A,m,n]),Y=a.useCallback(()=>{o!==null&&r.invalidateQueries({queryKey:["file-explorer","tree",o]})},[r,o]),O=a.useCallback(y=>{t!==null&&r.invalidateQueries({queryKey:le(t,y,f),exact:!0})},[r,t,f]);a.useEffect(()=>{if(t!=null&&t.events)return t.events(Y)},[t,Y]);const C=un({source:t??$e,showHidden:f,queryClient:r,inFlightRef:M}),z=xn({source:t??$e,showHidden:f,queryClient:r,inFlightRef:M}),B=pn(i);return{rows:$,rootLoading:I,rootError:v,rootErrorMessage:w,rootErrorCommand:b,errorPaths:D,toggleExpand:H,ensureExpanded:L,openFile:K,reload:Y,retryDir:O,changes:t!=null&&t.changes?z:null,...C,...B}}function yn(t){const{transport:n,cwd:r}=t;return{scopeKey:r,cwd:r,writable:!0,provenance:!1,filtersHidden:!0,preview:"canvas",editable:!1,list(m,f){return n.readFileTree(r,{path:m===""?void 0:m,showHidden:f.showHidden})}}}function ke(t){return Array.from(t).includes("Files")}function ot(t){const n=Array.from(t.items??[]);if(!(n.length>0&&n.every(g=>"webkitGetAsEntry"in g)))return{files:Array.from(t.files??[]),folders:0};const m=[];let f=0;for(const g of n){if(g.kind!=="file")continue;const s=g.webkitGetAsEntry();if(s!=null&&s.isDirectory){f+=1;continue}const p=g.getAsFile();p&&m.push(p)}return{files:m,folders:f}}const vn=12;function Cn({row:t,selected:n,renaming:r,error:m,onSelect:f,onActivate:g,onRetry:s,onSubmitRename:p,onCancelRename:o,onNewFile:i,onNewFolder:d,onStartRename:R,onDelete:F,onMove:E,onCopyInto:M,onCopy:j,onPaste:$,onDuplicate:I,canPasteInto:v,revealLabel:u,onReveal:x,onAddToChat:w,onCopyPath:b,readOnly:D=!1,provenance:H=!1,copyable:L=!0,onDisk:A=!0,onUpload:K,onPickUpload:Y}){const{entry:O,depth:C,expanded:z,loading:B}=t,c=O.type==="dir",h=c?O.path:W(O.path),[T,y]=a.useState(!1),P=!c&&C===0&&Se(O.name),N=Yt(O.lastCommit),S=e.jsxs("div",{role:"treeitem","aria-label":O.name,"aria-expanded":c?z:void 0,"aria-selected":n,tabIndex:-1,onKeyDown:k=>{(k.key==="Enter"||k.key===" ")&&(k.preventDefault(),f(O),g(O))},draggable:!r&&!D,onDragStart:k=>{D||(k.dataTransfer.setData("text/plain",O.path),k.dataTransfer.setData(tn,O.path),k.dataTransfer.effectAllowed="copyMove")},onDragOver:k=>{if(k.stopPropagation(),!D&&K&&ke(k.dataTransfer.types)){k.preventDefault(),k.dataTransfer.dropEffect="copy",y(!0);return}D||!c||!Xe(k.dataTransfer.types)||(k.preventDefault(),k.dataTransfer.dropEffect=k.altKey&&L?"copy":"move",y(!0))},onDragLeave:()=>y(!1),onDrop:k=>{if(k.stopPropagation(),D)return;if(y(!1),K&&ke(k.dataTransfer.types)){k.preventDefault();const{files:te}=ot(k.dataTransfer);K(h,te);return}if(!c)return;const q=Ve(k.dataTransfer);q!==null&&(k.preventDefault(),k.altKey&&L?M(q,O.path):E(q,O.path))},onClick:()=>{f(O),g(O)},className:Oe("flex w-full cursor-pointer items-center gap-1 py-1 pr-2 text-sm transition-colors",n?"bg-accent text-foreground":"hover:bg-accent/50",T&&"ring-ring/60 bg-accent ring-1"),style:{paddingLeft:C*vn+8},children:[e.jsx("span",{className:"flex size-4 flex-shrink-0 items-center justify-center",children:c&&(B?e.jsx(Fe,{size:"xs",className:"text-muted-foreground"}):m?e.jsx("button",{type:"button","aria-label":"Retry loading",title:"Couldn’t load. Retry",onClick:k=>{k.stopPropagation(),s()},className:"flex items-center justify-center",children:e.jsx(Ze,{className:"text-destructive size-3.5"})}):z?e.jsx(gt,{className:"text-muted-foreground size-3.5"}):e.jsx(Ue,{className:"text-muted-foreground size-3.5"}))}),c?z?e.jsx(yt,{className:"size-(--size-icon-sm) flex-shrink-0 text-sky-500"}):e.jsx(je,{className:"size-(--size-icon-sm) flex-shrink-0 text-sky-500"}):O.isSymlink===!0?e.jsx(nn,{className:"text-muted-foreground size-(--size-icon-sm) flex-shrink-0"}):e.jsx(Je,{className:"text-muted-foreground size-(--size-icon-sm) flex-shrink-0"}),r?e.jsx(jn,{initialName:O.name,onSubmit:k=>p(O,k),onCancel:o}):e.jsx("span",{className:"min-w-0 flex-1 truncate",children:O.name}),P&&!r&&e.jsx(vt,{"aria-label":"Pinned to the top",className:"text-muted-foreground/60 size-3 flex-shrink-0"}),H&&!r&&e.jsx("span",{className:"text-muted-foreground/70 text-2xs max-w-[45%] flex-shrink-0 truncate tabular-nums",title:N.title??void 0,children:N.label})]});return D?S:e.jsxs(Ct,{children:[e.jsx(jt,{asChild:!0,children:S}),e.jsxs(bt,{className:"w-52",children:[e.jsx(Z,{movesFocus:!0,onClick:()=>i(h),children:"New file"}),e.jsx(Z,{movesFocus:!0,onClick:()=>d(h),children:"New folder"}),Y&&e.jsx(Z,{onClick:()=>Y(h),children:"Upload files…"}),A&&e.jsxs(e.Fragment,{children:[e.jsx(ve,{}),u&&e.jsx(Z,{onClick:()=>x(O),children:u}),e.jsx(Z,{movesFocus:!0,onClick:()=>w(O),children:"Add to chat"})]}),L&&e.jsxs(e.Fragment,{children:[e.jsx(ve,{}),e.jsx(Z,{onClick:()=>j(O),children:"Copy"}),e.jsx(Z,{disabled:!v(h),onClick:()=>$(h),children:"Paste"}),e.jsx(Z,{onClick:()=>I(O),children:"Duplicate"})]}),e.jsx(ve,{}),A?e.jsxs(e.Fragment,{children:[e.jsx(Z,{onClick:()=>b(O,"absolute"),children:"Copy path"}),e.jsx(Z,{onClick:()=>b(O,"relative"),children:"Copy relative path"})]}):e.jsx(Z,{onClick:()=>b(O,"relative"),children:"Copy path"}),e.jsx(ve,{}),e.jsx(Z,{movesFocus:!0,onClick:()=>R(O),children:"Rename"}),e.jsx(Z,{variant:"destructive",onClick:()=>F(O),children:"Delete"})]})]})}function jn({initialName:t,onSubmit:n,onCancel:r}){const m=a.useRef(null),[f,g]=a.useState(t);a.useEffect(()=>{const p=m.current;if(!p)return;p.focus();const o=t.lastIndexOf(".");p.setSelectionRange(0,o>0?o:t.length)},[t]);const s=()=>{const p=f.trim();p&&p!==t?n(p):r()};return e.jsx("input",{ref:m,type:"text",value:f,"aria-label":"New name",onChange:p=>g(p.target.value),onClick:p=>p.stopPropagation(),onBlur:s,onKeyDown:p=>{p.stopPropagation(),p.key==="Enter"?s():p.key==="Escape"&&r()},className:"border-border bg-background focus-ring min-w-0 flex-1 rounded border px-1 py-0 text-sm outline-none"})}const bn=100,kn=28,wn=250;function En(t){const{rows:n,selectedPath:r,renamingPath:m,errorPaths:f,onSelectPath:g,onRetryDir:s}=t,p=a.useRef(null),o=U(C=>C.setScrollTop),i=U(C=>C.scopeKey),d=a.useCallback(C=>C.type==="dir"?t.onToggle(C):t.onOpen(C),[t]),R=Rn(t,d),F=n.length>bn,E=en({count:n.length,getScrollElement:()=>p.current,estimateSize:()=>kn,overscan:12,enabled:F}),M=a.useRef({scope:void 0,done:!1}),j=a.useRef(null);a.useLayoutEffect(()=>{const C=M.current;if(C.scope!==i&&(C.scope=i,C.done=!1),C.done||n.length===0)return;const z=p.current;if(!z)return;const B=U.getState().scrollTop;if(B<=0){C.done=!0;return}F?E.scrollToOffset(B):z.scrollTop=B,j.current=z.scrollTop,z.scrollTop>=B&&(C.done=!0)},[n.length,i,F,E]);const $=a.useRef(null),I=a.useRef(null),v=a.useCallback(()=>{const C=p.current;C&&C.scrollTop!==j.current&&(M.current.done=!0,$.current=C.scrollTop,I.current&&clearTimeout(I.current),I.current=setTimeout(()=>{I.current=null,$.current!==null&&o($.current)},wn))},[o]);a.useEffect(()=>()=>{I.current&&clearTimeout(I.current),$.current!==null&&o($.current)},[o]);const u=a.useRef(void 0);a.useEffect(()=>{var c,h;const C=u.current;if(u.current=r,C===void 0||r===C||r===null)return;const z=n.findIndex(T=>T.entry.path===r);if(z<0)return;const B=p.current;B&&(F?E.scrollToIndex(z,{align:"auto"}):(h=(c=B.querySelector(`[data-row-index="${z}"]`))==null?void 0:c.scrollIntoView)==null||h.call(c,{block:"nearest"}),j.current=B.scrollTop)},[r,n,F,E]);const[x,w]=a.useState(!1),{onCopyInto:b,onMove:D}=t,H=t.readOnly===!0,L=t.copyable!==!1,A=a.useCallback(C=>{H||!Xe(C.dataTransfer.types)||(C.preventDefault(),C.dataTransfer.dropEffect=C.altKey&&L?"copy":"move",w(!0))},[H,L]),K=a.useCallback((C,z)=>{const B=n.find(c=>c.entry.path===C);B&&b({path:C,isDir:B.entry.type==="dir"},z)},[n,b]),Y=a.useCallback(C=>{if(w(!1),H)return;const z=Ve(C.dataTransfer);z!==null&&(C.preventDefault(),C.altKey&&L?K(z,Q):D(z,Q))},[K,D,H,L]),O=C=>e.jsx(Cn,{row:C,selected:C.entry.path===r,renaming:C.entry.path===m,error:C.entry.type==="dir"&&C.expanded&&f.has(C.entry.path),onSelect:z=>g(z.path),onActivate:d,onRetry:()=>s(C.entry.path),onSubmitRename:t.onSubmitRename,onCancelRename:t.onCancelRename,onStartRename:t.onStartRename,onNewFile:t.onNewFile,onNewFolder:t.onNewFolder,onDelete:t.onDelete,onMove:t.onMove,onCopyInto:K,onCopy:t.onCopy,onPaste:t.onPaste,onDuplicate:t.onDuplicate,canPasteInto:t.canPasteInto,revealLabel:t.revealLabel,onReveal:t.onReveal,onAddToChat:t.onAddToChat,onCopyPath:t.onCopyPath,readOnly:t.readOnly,provenance:t.provenance,copyable:t.copyable,onDisk:t.onDisk,onUpload:t.onUpload,onPickUpload:t.onPickUpload});return e.jsx("div",{ref:p,role:"tree","aria-label":"File explorer",tabIndex:0,onKeyDown:R,onScroll:v,onDragOver:A,onDragLeave:()=>w(!1),onDrop:Y,className:Oe("focus-visible:ring-ring h-full overflow-auto outline-none focus-visible:ring-1 focus-visible:ring-inset",x&&"ring-ring/60 bg-accent/30 ring-1 ring-inset"),children:F?e.jsx("div",{style:{height:E.getTotalSize()},className:"relative w-full",children:E.getVirtualItems().map(C=>e.jsx("div",{"data-row-index":C.index,className:"absolute top-0 left-0 w-full",style:{transform:`translateY(${C.start}px)`},children:O(n[C.index])},n[C.index].entry.path))}):n.map((C,z)=>e.jsx("div",{"data-row-index":z,children:O(C)},C.entry.path))})}function Nn(t){return t?t.type==="dir"?t.path:W(t.path):Q}function Rn(t,n){const{rows:r,selectedPath:m,renamingPath:f,onSelectPath:g}=t;return a.useCallback(s=>{var i,d,R,F;if(f!==null)return;const p=r.findIndex(E=>E.entry.path===m),o=p>=0?r[p]:void 0;if(s.metaKey||s.ctrlKey){if(t.readOnly===!0||t.copyable===!1)return;const E=s.key.toLowerCase();if(E==="c"&&o){s.preventDefault(),t.onCopy(o.entry);return}if(E==="v"){s.preventDefault(),t.onPaste(Nn(o==null?void 0:o.entry));return}return}switch(s.key){case"ArrowDown":s.preventDefault(),g(((i=r[Math.min(p+1,r.length-1)])==null?void 0:i.entry.path)??((d=r[0])==null?void 0:d.entry.path));break;case"ArrowUp":s.preventDefault(),g(((R=r[Math.max(p-1,0)])==null?void 0:R.entry.path)??((F=r[0])==null?void 0:F.entry.path));break;case"ArrowRight":(o==null?void 0:o.entry.type)==="dir"&&!o.expanded&&(s.preventDefault(),t.onToggle(o.entry));break;case"ArrowLeft":if(!o)break;if(s.preventDefault(),o.entry.type==="dir"&&o.expanded)t.onToggle(o.entry);else{const E=W(o.entry.path);E&&g(E)}break;case"Enter":o&&(s.preventDefault(),n(o.entry));break;case"F2":o&&t.readOnly!==!0&&(s.preventDefault(),t.onStartRename(o.entry));break;case"Delete":case"Backspace":o&&t.readOnly!==!0&&(s.preventDefault(),t.onDelete(o.entry));break}},[r,m,f,g,t,n])}const Sn={rename:"Rename it anyway",move:"Move it anyway",delete:"Delete it anyway",upload:"Upload mine over it"},Dn={rename:"nothing was renamed",move:"nothing was moved",delete:"nothing was deleted",upload:"nothing was uploaded"};function Tn(t){const{entry:n,fileCount:r,moreThan:m}=t;if(n.type!=="dir")return`“${n.name}” leaves the room’s files.`;const f=r===null?"everything in it":m?`the more than ${r.toLocaleString()} files in it`:r===1?"the 1 file in it":`the ${r.toLocaleString()} files in it`;return`“${n.name}” and ${f} leave the room’s files.`}const Fn="The room’s history keeps a copy. An agent can restore it.";function On({changes:t,onOpenTheirs:n,onReturnFocus:r}){var E;const m=M=>{M.preventDefault();const j=document.activeElement;j!==null&&j!==document.body||r()},{pendingDelete:f,pendingClash:g,conflict:s}=t,[p,o]=a.useState(f);f!==null&&f!==p&&o(f);const[i,d]=a.useState(g);g!==null&&g!==i&&d(g);const R=i===null?"":i.dir===Q?"The top folder":`“${i.dir}”`,F=(i==null?void 0:i.names.length)===1;return e.jsxs(e.Fragment,{children:[e.jsx(de,{open:f!==null,onOpenChange:M=>!M&&t.cancelDelete(),children:e.jsxs(ue,{onCloseAutoFocus:m,children:[e.jsxs(fe,{children:[e.jsx(he,{children:p===null?"":`Delete “${p.entry.name}”?`}),e.jsx(pe,{asChild:!0,children:e.jsxs("div",{className:"space-y-2",children:[e.jsx("p",{children:p===null?"":Tn(p)}),e.jsx("p",{children:Fn})]})})]}),e.jsxs(me,{children:[e.jsx(xe,{onClick:t.cancelDelete,children:"Cancel"}),e.jsx(ge,{onClick:()=>void t.confirmDelete(),className:"bg-destructive hover:bg-destructive/90 dark:bg-destructive/60 text-white",children:(p==null?void 0:p.entry.type)==="dir"?"Delete folder":"Delete file"})]})]})}),e.jsx(de,{open:g!==null,onOpenChange:M=>!M&&t.cancelClash(),children:e.jsxs(ue,{onCloseAutoFocus:m,children:[e.jsxs(fe,{children:[e.jsx(he,{children:F?`Replace “${i==null?void 0:i.names[0]}”?`:`Replace ${(i==null?void 0:i.names.length)??0} files?`}),e.jsx(pe,{children:F?`${R} already has a file with this name. Replace it, or keep both.`:`${R} already has files named ${(i==null?void 0:i.names.join(", "))??""}. Replace them, or keep both.`})]}),e.jsxs(me,{children:[e.jsx(xe,{onClick:t.cancelClash,children:"Cancel"}),e.jsx(G,{variant:"outline",onClick:()=>void t.resolveClash("keep-both"),children:"Keep both"}),e.jsx(ge,{onClick:()=>void t.resolveClash("replace"),children:"Replace"})]})]})}),e.jsx(de,{open:s!==null,onOpenChange:M=>!M&&t.dismissConflict(),children:e.jsxs(ue,{onCloseAutoFocus:m,children:[e.jsxs(fe,{children:[e.jsx(he,{children:"Somebody changed this first"}),e.jsx(pe,{children:s===null?"":`${((E=s.lastCommit)==null?void 0:E.author)??"Somebody"} changed “${s.path}” after you opened it, so ${Dn[s.kind]}.`})]}),(s==null?void 0:s.lastCommit)&&e.jsxs("p",{className:"text-muted-foreground text-xs",children:[s.lastCommit.subject," · ",kt(s.lastCommit.at)]}),e.jsxs(me,{children:[e.jsx(xe,{onClick:t.dismissConflict,children:"Cancel"}),e.jsx(G,{variant:"outline",onClick:()=>{s!==null&&(t.dismissConflict(),n(s.path))},children:"Open their version"}),e.jsx(ge,{onClick:()=>{s!==null&&(t.dismissConflict(),s.retry())},className:"bg-destructive hover:bg-destructive/90 dark:bg-destructive/60 text-white",children:s===null?"":Sn[s.kind]})]})]})})]})}function Ie(t,n){return n.name===t?Ye(t):`“${n.name}” is already there. Some computers ignore capital letters in names. Pick another name.`}const Pn="Folders can’t be uploaded. Drop the files inside instead.";function _n({source:t,className:n,onCommands:r}={}){var ye;const m=ne(),f=Te(l=>l.selectedCwd),g=a.useMemo(()=>f?yn({transport:m,cwd:f}):null,[m,f]),s=t===void 0?g:t,p=s!==null&&!s.writable,o=gn(s),i=o.changes,d=oe(),R=U(l=>l.showHidden),{rows:F,rootLoading:E,rootError:M,rootErrorMessage:j,rootErrorCommand:$,errorPaths:I}=o,v=U(l=>l.setCommands),u=U(l=>l.selectedPath),x=U(l=>l.setSelectedPath),w=U(l=>l.clipboard),[b,D]=a.useState(null),[H,L]=a.useState(null),[A,K]=a.useState(null),Y=a.useCallback(l=>K(l===null?null:{path:l,isNew:!1}),[]),O=a.useRef(null),C=a.useRef(Q),[z,B]=a.useState(!1),c=a.useCallback((l,_)=>{if(i!==null){if(_.length===0){J.error(Pn);return}o.ensureExpanded(l),i.upload(l,_)}},[i,o]),h=a.useRef(null),T=a.useCallback(()=>{var l,_;(_=(l=h.current)==null?void 0:l.querySelector('[role="tree"]'))==null||_.focus()},[]),y=a.useCallback(l=>{var _;C.current=l,(_=O.current)==null||_.click()},[]),P=a.useCallback(l=>w!==null&&!(w.isDir&&Ce(l,w.path)),[w]),N=a.useCallback((l,_)=>{o.ensureExpanded(l),Ae.flushSync(()=>{L(null),D({parent:l,type:_})})},[o]),S=a.useCallback(l=>{Ae.flushSync(()=>L(l.path))},[]),k=a.useRef({startCreate:N,reload:o.reload,pickUpload:y});a.useEffect(()=>{k.current={startCreate:N,reload:o.reload,pickUpload:y}});const q=i!==null;a.useEffect(()=>{if(p||r===void 0&&q)return;const l=r??v;return l({newFile:()=>k.current.startCreate(Q,"file"),newFolder:()=>k.current.startCreate(Q,"dir"),refresh:()=>k.current.reload(),...q&&{upload:()=>k.current.pickUpload(Q)}}),()=>l(null)},[v,r,p,q]);const te=a.useCallback(async l=>{var se;if(!b||s===null)return;const _=b;if(D(null),i!==null){const re=(((se=d.getQueryData(le(s,_.parent,R)))==null?void 0:se.entries)??[]).find(ct=>ct.name.toLowerCase()===l.toLowerCase());if(_.type==="dir"){if(re!==void 0&&!(re.type==="dir"&&re.name===l)){J.error(Ie(l,re));return}D({parent:ee(_.parent,l),type:"file",firstInFolder:l});return}if(re!==void 0){J.error(Ie(l,re));return}const lt=ee(_.parent,l);K({path:lt,isNew:!0});return}await o.createEntry(_.parent,l,_.type)&&x(ee(_.parent,l))},[b,s,i,d,R,o,x]),V=a.useCallback(async(l,_)=>{L(null),(i?await i.renameEntry(l,_):await o.renameEntry(l,_))&&x(ee(W(l.path),_))},[i,o,x]);return s===null?t!==void 0?null:e.jsx("div",{className:"text-muted-foreground flex h-full items-center justify-center p-6 text-center text-sm",children:"Pick a folder to see its files."}):e.jsxs("div",{ref:h,className:Oe("flex h-full flex-col",z&&"ring-ring/60 bg-accent/30 ring-1 ring-inset",n),onDragOver:l=>{i===null||!ke(l.dataTransfer.types)||(l.preventDefault(),l.dataTransfer.dropEffect="copy",B(!0))},onDragLeave:l=>{l.currentTarget.contains(l.relatedTarget)||B(!1)},onDrop:l=>{B(!1),!(i===null||!ke(l.dataTransfer.types))&&(l.preventDefault(),c(Q,ot(l.dataTransfer).files))},children:[i!==null&&e.jsx("input",{ref:O,type:"file",multiple:!0,hidden:!0,"aria-hidden":!0,tabIndex:-1,"data-testid":"room-files-upload-input",onChange:l=>{const _=Array.from(l.target.files??[]);l.target.value="",c(C.current,_)}}),e.jsxs("div",{className:"min-h-0 flex-1",children:[b&&e.jsx(Mn,{type:b.type,firstInFolder:b.firstInFolder,onSubmit:l=>void te(l),onCancel:()=>D(null)},`${b.parent}:${b.type}:${b.firstInFolder??""}`),E&&F.length===0?e.jsx("div",{className:"flex h-20 items-center justify-center",children:e.jsx(Fe,{size:"md",className:"text-muted-foreground",label:"Loading files"})}):M&&F.length===0?e.jsxs("div",{className:"text-muted-foreground flex min-h-20 flex-col items-center justify-center gap-2 px-4 py-3 text-center text-xs [overflow-wrap:anywhere]",children:[e.jsx("span",{children:j??"Couldn’t load files."}),$!==null&&e.jsx("code",{"aria-label":"Command that removes the settings",className:"bg-muted text-foreground block w-full rounded px-2 py-1.5 text-left font-mono select-all",children:$}),e.jsxs(G,{variant:"outline",size:"xs",onClick:o.reload,children:[e.jsx(Ze,{}),"Retry"]})]}):F.length===0&&!b?e.jsx("div",{className:"text-muted-foreground/60 flex h-20 items-center justify-center px-4 text-center text-xs",children:i!==null?"No files yet. Drop files here, or use Upload.":"Empty folder"}):e.jsx(En,{rows:F,selectedPath:u,renamingPath:H,errorPaths:I,onSelectPath:x,onToggle:o.toggleExpand,onOpen:l=>{s.preview==="inline"?Y(l.path):o.openFile(l)},onRetryDir:o.retryDir,onSubmitRename:(l,_)=>void V(l,_),onCancelRename:()=>L(null),onStartRename:S,onNewFile:l=>N(l,"file"),onNewFolder:l=>N(l,"dir"),onDelete:l=>i?i.requestDelete(l):void o.removeEntry(l),onMove:(l,_)=>void(i?i.moveEntry(l,_):o.moveEntry(l,_)),onCopyInto:(l,_)=>void o.copyEntry(l,_),onCopy:o.copyToClipboard,onPaste:l=>{w&&o.copyEntry(w,l)},onDuplicate:l=>void o.copyEntry({path:l.path,isDir:l.type==="dir"},W(l.path)),canPasteInto:P,readOnly:p,provenance:s.provenance,copyable:i===null,onDisk:s.cwd!==null,onUpload:i?c:void 0,onPickUpload:i?y:void 0,revealLabel:o.revealLabel,onReveal:l=>void o.reveal(l),onAddToChat:o.addToChat,onCopyPath:(l,_)=>void o.copyPath(l,_)})]}),s.preview==="inline"&&e.jsx(Gt,{source:s,path:(A==null?void 0:A.path)??null,isNew:(A==null?void 0:A.isNew)??!1,onCreated:()=>{A!==null&&(K({path:A.path,isNew:!1}),x(A.path))},onClose:()=>K(null)}),i!==null&&e.jsx(On,{changes:i,onOpenTheirs:l=>Y(l),onReturnFocus:T}),e.jsx(de,{open:o.pendingRecursiveDelete!==null,onOpenChange:l=>!l&&o.cancelRecursiveDelete(),children:e.jsxs(ue,{children:[e.jsxs(fe,{children:[e.jsxs(he,{children:["Delete “",(ye=o.pendingRecursiveDelete)==null?void 0:ye.name,"”?"]}),e.jsx(pe,{children:"This folder isn’t empty. Everything inside is deleted. This can’t be undone."})]}),e.jsxs(me,{children:[e.jsx(xe,{onClick:o.cancelRecursiveDelete,children:"Cancel"}),e.jsx(ge,{onClick:()=>void o.confirmRecursiveDelete(),className:"bg-destructive hover:bg-destructive/90 dark:bg-destructive/60 text-white",children:"Delete folder"})]})]})})]})}function Mn({type:t,firstInFolder:n,onSubmit:r,onCancel:m}){const f=a.useRef(null),[g,s]=a.useState("");a.useEffect(()=>{var i;(i=f.current)==null||i.focus()},[]);const p=()=>{const i=g.trim();i?r(i):m()},o=e.jsxs("div",{className:"flex items-center gap-1",children:[t==="dir"?e.jsx(je,{className:"size-(--size-icon-sm) flex-shrink-0 text-sky-500"}):e.jsx(Je,{className:"text-muted-foreground size-(--size-icon-sm) flex-shrink-0"}),e.jsx("input",{ref:f,type:"text",value:g,"aria-label":n!==void 0?`First file in ${n}`:t==="dir"?"New folder name":"New file name",placeholder:t==="dir"?"folder-name":"file-name",onChange:i=>s(i.target.value),onBlur:p,onKeyDown:i=>{i.key==="Enter"?p():i.key==="Escape"&&m()},className:"border-border bg-background focus-ring min-w-0 flex-1 rounded border px-1 py-0 text-sm outline-none"})]});return n===void 0?e.jsx("div",{className:"px-3 py-1",children:o}):e.jsxs("div",{className:"space-y-1 px-3 py-1",children:[e.jsxs("p",{className:"text-muted-foreground flex min-w-0 items-center gap-1 text-xs",children:[e.jsx(je,{className:"size-(--size-icon-xs) flex-shrink-0 text-sky-500"}),e.jsx("span",{className:"truncate",children:n})]}),o,e.jsx("p",{className:"text-muted-foreground text-2xs",children:"Name its first file. The folder appears on save."})]})}function it(){const t=U(m=>m.showHidden),n=U(m=>m.setShowHidden),r=t?"Hide hidden files":"Show hidden files";return e.jsx(G,{variant:"ghost",size:"icon-xs","aria-label":r,title:r,onClick:()=>n(!t),children:t?e.jsx(wt,{className:"text-muted-foreground"}):e.jsx(Et,{className:"text-muted-foreground"})})}function An({cwd:t}){const n=ne(),{data:r}=ce({queryKey:["file-explorer","workspace",t],queryFn:()=>n.resolveWorkspace(t),staleTime:6e4});return r!=null&&r.branch?e.jsxs("span",{className:"text-muted-foreground bg-muted/50 text-2xs inline-flex min-w-0 items-center gap-1 rounded px-1.5 py-0.5",title:`Workspace ${r.key} on ${r.branch}`,children:[e.jsx(et,{className:"size-3 flex-shrink-0"}),e.jsx("span",{className:"truncate",children:r.branch})]}):null}function ss(){const t=Te(r=>r.selectedCwd),n=U(r=>r.commands);return t?e.jsxs(e.Fragment,{children:[e.jsx(An,{cwd:t}),e.jsx(G,{variant:"ghost",size:"icon-xs","aria-label":"New file",title:"New file",onClick:()=>n==null?void 0:n.newFile(),children:e.jsx(st,{className:"text-muted-foreground"})}),e.jsx(G,{variant:"ghost",size:"icon-xs","aria-label":"New folder",title:"New folder",onClick:()=>n==null?void 0:n.newFolder(),children:e.jsx(qe,{className:"text-muted-foreground"})}),e.jsx(it,{}),e.jsx(G,{variant:"ghost",size:"icon-xs","aria-label":"Refresh",title:"Refresh",onClick:()=>n==null?void 0:n.refresh(),children:e.jsx(Nt,{className:"text-muted-foreground"})})]}):null}function Ln({roomId:t}){const n=ne(),r=oe(),m=ce(Qe(n,t));a.useEffect(()=>Wt(r,t,()=>{r.invalidateQueries({queryKey:be.repoStatus(t)})}),[r,t]);const f=a.useMemo(()=>{var o;return((o=m.data)==null?void 0:o.kind)==="ok"?Rt(m.data.status):[]},[m.data]),g=St(f),s=Dt(f);if(!s)return null;const p=f.map((o,i)=>`${g[i]}: ${Tt(o)}`);return e.jsxs("span",{"data-slot":"pending-work-badge",title:p.join(`
|
|
17
|
-
`),className:"text-muted-foreground bg-muted/50 text-2xs inline-flex min-w-0 items-center gap-1 rounded px-1.5 py-0.5",children:[e.jsx(et,{className:"size-3 flex-shrink-0"}),e.jsxs("span",{className:"sr-only",children:["Not merged into the room yet. ",p.join(". "),"."]}),e.jsx("span",{"aria-hidden":"true",className:"truncate",children:s})]})}const zn={added:"added",modified:"changed",deleted:"deleted",untracked:"new"},$n=new Map([["OPERATOR_ONLY","Only the owner of this DorkOS can keep or discard these."],["ROOM_FILE_NOT_FOUND","One of those changes is gone, so nothing was discarded. The list is refreshed."],["MERGE_IN_FLIGHT","Something else is writing to these files. Nothing changed. Try again in a moment."],["MAIN_CHECKOUT_DIRTY","These files are on another branch. Switch them back to main yourself."],["ROOM_REPO_GIT_UNAVAILABLE","Room files need git, and git isn’t installed on this computer."],["ROOM_HAS_NO_REPO","This room no longer has its own files."],["ROOM_REPOS_DISABLED","Room files are turned off on this install."]]);function In({roomId:t}){var $,I;const n=ne(),r=oe(),m=ce(Qe(n,t)),[f,g]=a.useState([]),[s,p]=a.useState(!1),[o,i]=a.useState(null),d=Be({mutationFn:v=>n.repairRoomMain(t,v),onSuccess:()=>{g([]),p(!1),i(null),r.invalidateQueries({queryKey:be.repoStatus(t)})},onError:v=>{p(!1);const u=$n.get(Pe(v)??"");i(u??"Couldn’t update the files. Try again in a moment."),r.invalidateQueries({queryKey:be.repoStatus(t)})}});if((($=m.data)==null?void 0:$.kind)==="unavailable")return e.jsx("p",{role:"alert","data-slot":"room-main-warning",className:"border-border/60 text-muted-foreground rounded-lg border px-3 py-2.5 text-xs",children:"Couldn’t check this room’s files. Saves may not work. Try again soon."});const R=((I=m.data)==null?void 0:I.kind)==="ok"?m.data.status.main:void 0;if(R===void 0||!R.dirty)return null;const F=R.branch!=="main",E=f.filter(v=>R.strays.some(u=>u.path===v)),M=s&&E.length>0,j=v=>g(u=>u.includes(v)?u.filter(x=>x!==v):[...u,v]);return e.jsxs("div",{"data-slot":"room-main-warning",className:"border-border/60 bg-muted/40 space-y-3 rounded-lg border px-3 py-2.5 text-sm",children:[e.jsxs("div",{className:"flex gap-2",children:[e.jsx(Ft,{className:"text-muted-foreground mt-0.5 size-(--size-icon-sm) flex-shrink-0"}),e.jsxs("div",{className:"min-w-0 space-y-1",children:[e.jsxs("div",{role:"alert",className:"space-y-1",children:[e.jsx("p",{className:"font-medium",children:"Somebody changed this room’s files outside DorkOS"}),F?e.jsxs(e.Fragment,{children:[e.jsx("p",{className:"text-muted-foreground text-xs",children:`This room’s files are on ${R.branch??"no branch"}, not main.`}),e.jsx("p",{className:"text-muted-foreground text-xs",children:"Saves and agent merges wait until they’re back on main."})]}):e.jsx("p",{className:"text-muted-foreground text-xs",children:"Saves and agent merges wait until you keep or discard these."})]}),F&&e.jsx(sn,{className:"text-xs",children:e.jsx("p",{children:"DorkOS won’t switch the branch for you. There may be work on it."})})]})]}),!F&&e.jsxs(e.Fragment,{children:[e.jsx("ul",{className:"space-y-1.5",children:R.strays.map(v=>e.jsxs("li",{className:"flex items-center gap-2",children:[e.jsx(Ot,{id:`stray-${t}-${v.path}`,checked:E.includes(v.path),onCheckedChange:()=>j(v.path),disabled:d.isPending}),e.jsx("label",{htmlFor:`stray-${t}-${v.path}`,className:"min-w-0 flex-1 cursor-pointer truncate font-mono text-xs",title:v.path,children:v.path}),e.jsx("span",{className:"text-muted-foreground flex-shrink-0 text-xs",children:zn[v.kind]})]},v.path))}),R.strayCount>R.strays.length&&e.jsxs("p",{className:"text-muted-foreground text-xs",children:["…and ",R.strayCount-R.strays.length," more not shown. “Keep them all” keeps these too."]}),M?e.jsxs("div",{className:"space-y-2",children:[e.jsx("p",{className:"text-xs",children:E.length===1?"Discard this change? It can’t be undone.":`Discard these ${E.length} changes? They can’t be undone.`}),e.jsxs("div",{className:"flex flex-wrap gap-2",children:[e.jsx(G,{type:"button",variant:"ghost",size:"sm",disabled:d.isPending,onClick:()=>p(!1),children:"Cancel"}),e.jsx(G,{type:"button",variant:"destructive",size:"sm",disabled:d.isPending,onClick:()=>d.mutate({action:"discard",paths:[...E]}),children:E.length===1?"Discard change":`Discard ${E.length} changes`})]})]}):e.jsxs("div",{className:"flex flex-wrap gap-2",children:[e.jsx(G,{type:"button",variant:"outline",size:"sm",disabled:d.isPending,onClick:()=>d.mutate({action:"commit"}),children:"Keep them all"}),e.jsx(G,{type:"button",variant:"ghost",size:"sm",disabled:d.isPending||E.length===0,onClick:()=>p(!0),children:E.length===0?"Discard…":`Discard ${E.length}`})]})]}),o!==null&&e.jsx("p",{role:"alert",className:"text-destructive text-xs",children:o})]})}const Ne="pointer-coarse:size-11",Kn=new Map([["ROOM_REPOS_DISABLED","Room files are turned off for this DorkOS."],["ROOM_REPO_GIT_UNAVAILABLE","Git isn’t available on this computer."],["MERGE_IN_FLIGHT","This room’s files are busy. Try again."],["ROOM_ARCHIVED","Bring this room back before setting up files."],["OPERATOR_ONLY","Only the owner can set up room files."]]);function Hn(t){const n=Kn.get(Pe(t)??"");return n||(t instanceof TypeError||t instanceof Error&&/fetch|offline|network/i.test(t.message)?"You’re offline. Try again when this computer reconnects.":"Couldn’t set up files. Try again.")}function as({roomId:t,canChange:n,canSetUp:r=!1}){const m=ne(),f=oe(),g=U(v=>v.showHidden),[s,p]=a.useState(null),[o,i]=a.useState(!1),d=a.useMemo(()=>We({transport:m,queryClient:f,roomId:t,canChange:n}),[m,f,t,n]),R=we(d,Q,g,f),F=ce(R),E=Be({mutationFn:async()=>{try{return await m.enableRoomRepo(t)}catch(v){if(Pe(v)==="ROOM_REPO_EXISTS")return null;throw v}},onSuccess:async()=>{i(!1),await Promise.all([f.invalidateQueries({queryKey:R.queryKey}),f.invalidateQueries({queryKey:be.repoStatus(t)})])}}),M=F.isSuccess&&F.data.absent===!0,j=F.isSuccess&&!M||F.isError,[$,I]=a.useState(null);if(j&&$!==t&&I(t),!j&&$!==t&&!M)return null;if(M){if(!r)return null;const v=E.isError?Hn(E.error):null;return e.jsxs("section",{"aria-label":"Room files",className:"space-y-2",children:[e.jsxs("header",{className:"flex items-center gap-2",children:[e.jsx(Le,{className:"text-muted-foreground size-(--size-icon-sm) shrink-0"}),e.jsx("h3",{className:"text-muted-foreground text-xs font-medium tracking-wide uppercase",children:"Files"})]}),e.jsxs("div",{className:"border-border/60 flex items-center justify-between gap-3 rounded-lg border px-3 py-2.5",children:[e.jsx("p",{className:"text-muted-foreground text-sm",children:"This room has no shared files."}),e.jsx(G,{type:"button",size:"sm",variant:"outline",className:"shrink-0 pointer-coarse:min-h-11",onClick:()=>{E.reset(),i(!0)},children:"Set up files…"})]}),v!==null&&e.jsx("p",{role:"alert",className:"text-status-danger text-xs",children:v}),e.jsx(de,{open:o,onOpenChange:i,children:e.jsxs(ue,{className:"max-sm:top-auto max-sm:bottom-0 max-sm:translate-y-0 max-sm:rounded-b-none",children:[e.jsxs(fe,{children:[e.jsx(he,{children:"Set up files for this room?"}),e.jsx(pe,{children:"This creates shared files and ROOM.md for everyone here. It can’t be undone."})]}),v!==null&&e.jsx("p",{role:"alert",className:"text-status-danger text-sm",children:v}),e.jsxs(me,{children:[e.jsx(xe,{className:"pointer-coarse:min-h-11",children:"Cancel"}),e.jsxs(ge,{className:"pointer-coarse:min-h-11",disabled:E.isPending,onClick:u=>{u.preventDefault(),E.mutate()},children:[E.isPending&&e.jsx(Pt,{className:"animate-spin"}),E.isPending?"Setting up…":"Set up files"]})]})]})})]})}return e.jsxs("section",{"aria-label":"Room files",className:"space-y-2",children:[e.jsxs("header",{className:"flex items-center gap-2",children:[e.jsx(Le,{className:"text-muted-foreground size-(--size-icon-sm) flex-shrink-0"}),e.jsx("h3",{className:"text-muted-foreground text-xs font-medium tracking-wide uppercase",children:"Files"}),e.jsx("div",{className:"min-w-0 flex-1",children:e.jsx(Ln,{roomId:t})}),n&&e.jsxs(e.Fragment,{children:[e.jsx(G,{variant:"ghost",size:"icon-xs",className:Ne,"aria-label":"New file",title:"New file",disabled:s===null,onClick:()=>s==null?void 0:s.newFile(),children:e.jsx(st,{className:"text-muted-foreground"})}),e.jsx(G,{variant:"ghost",size:"icon-xs",className:Ne,"aria-label":"New folder",title:"New folder",disabled:s===null,onClick:()=>s==null?void 0:s.newFolder(),children:e.jsx(qe,{className:"text-muted-foreground"})}),e.jsx(G,{variant:"ghost",size:"icon-xs",className:Ne,"aria-label":"Upload files",title:"Upload files",disabled:(s==null?void 0:s.upload)===void 0,onClick:()=>{var v;return(v=s==null?void 0:s.upload)==null?void 0:v.call(s)},children:e.jsx(rn,{className:"text-muted-foreground"})})]}),e.jsx(it,{})]}),e.jsx(In,{roomId:t}),e.jsx("div",{"data-slot":"room-files-body",className:"border-border/60 h-72 overflow-hidden rounded-lg border",children:e.jsx(_n,{source:d,onCommands:p})})]})}function rs({roomId:t,attachment:n}){var i;const r=ne(),m=oe(),f=a.useMemo(()=>We({transport:r,queryClient:m,roomId:t}),[r,m,t]),g=ce(we(f,Q,!1,m)),[s,p]=a.useState(!1),o=_t(t);return!g.isSuccess||g.data.absent===!0||((i=o.data)==null?void 0:i.archived)!==!1?null:e.jsxs(e.Fragment,{children:[e.jsx(G,{type:"button",variant:"ghost",size:"icon-xs","aria-label":`Save ${n.name} to the room’s files`,title:"Save to room files",className:"text-muted-foreground hover:text-foreground mt-0.5 pointer-coarse:size-11",onClick:()=>p(!0),children:e.jsx(Mt,{})}),s&&e.jsx(Un,{roomId:t,source:f,attachment:n,onClose:()=>p(!1)})]})}function Un({roomId:t,source:n,attachment:r,onClose:m}){const f=ne(),g=oe(),[s,p]=a.useState(Q),[o,i]=a.useState(r.name),[d,R]=a.useState(null),[F,E]=a.useState(!1),M=a.useId(),j=ce(we(n,s,!1,g)),$=a.useMemo(()=>{var v;return rt(((v=j.data)==null?void 0:v.entries)??[]).filter(u=>u.type==="dir")},[j.data]),I=async()=>{var u,x;const v=o.trim();if(v!==""){E(!0),R(null);try{await f.saveAttachmentToRoomFiles(t,{attachmentId:r.id,dir:s,name:v,baseCommit:((u=j.data)==null?void 0:u.commit)??null}),g.invalidateQueries({queryKey:["file-explorer","tree",n.scopeKey]}),J.success(`Saved ${v} to the room’s files`),m()}catch(w){let b;try{b=Vt(w,g,t)}catch{b={status:"refused",reason:Ge(w)??"Couldn’t save. Try again in a moment."}}if(b.status==="exists"){const D=(((x=j.data)==null?void 0:x.entries)??[]).map(H=>H.name);R({reason:`This folder already has a file called “${v}”. Pick another name.`,suggestion:_e({name:v,isDir:!1,taken:[...D,v]})})}else b.status==="conflict"?(R({reason:"This folder changed while you chose, so nothing was saved. Try again."}),j.refetch()):b.status==="refused"&&R({reason:b.reason})}finally{E(!1)}}};return e.jsx(At,{open:!0,onOpenChange:v=>!v&&m(),children:e.jsxs(Lt,{className:"sm:max-w-md",children:[e.jsxs(zt,{children:[e.jsx($t,{children:"Save to room files"}),e.jsx(It,{children:"Everyone in the room, and their agents, can find it there."})]}),e.jsxs(Kt,{className:"space-y-3",children:[e.jsxs("div",{className:"space-y-1",children:[e.jsx("p",{className:"text-muted-foreground text-xs font-medium",children:"Folder"}),e.jsxs("div",{role:"group","aria-label":"Folders",className:"border-border/60 max-h-56 overflow-auto rounded-md border",children:[e.jsx("p",{className:"bg-muted/40 truncate px-3 py-1.5 font-mono text-xs",children:s===Q?"Top folder":`${s}/`}),s!==Q&&e.jsx(Ke,{label:"Up one folder",icon:e.jsx(an,{className:"text-muted-foreground size-(--size-icon-sm)"}),onClick:()=>p(W(s))}),j.isPending?e.jsx("div",{className:"flex h-12 items-center justify-center",children:e.jsx(Fe,{size:"sm",className:"text-muted-foreground",label:"Loading folders"})}):$.length===0?e.jsx("p",{className:"text-muted-foreground px-3 py-2 text-xs",children:"No folders in here."}):$.map(v=>e.jsx(Ke,{label:v.name,icon:e.jsx(je,{className:"size-(--size-icon-sm) text-sky-500"}),chevron:!0,onClick:()=>p(ee(s,ie(v.path)))},v.path))]})]}),e.jsxs("div",{className:"space-y-1",children:[e.jsx("label",{htmlFor:M,className:"text-muted-foreground text-xs font-medium",children:"Name"}),e.jsx(Ht,{id:M,value:o,onChange:v=>{i(v.target.value),R(null)},spellCheck:!1,autoComplete:"off"})]}),d!==null&&e.jsxs("div",{role:"alert",className:"text-destructive space-y-1 text-xs",children:[e.jsx("p",{children:d.reason}),d.suggestion!==void 0&&e.jsxs(G,{type:"button",variant:"outline",size:"xs",onClick:()=>{i(d.suggestion),R(null)},children:["Use “",d.suggestion,"”"]})]})]}),e.jsxs(Ut,{className:"gap-2",children:[e.jsx(G,{type:"button",variant:"ghost",onClick:m,children:"Cancel"}),e.jsx(G,{type:"button",disabled:F||o.trim()===""||j.isPending,onClick:()=>void I(),children:F?"Saving…":s===Q?"Save to the top folder":`Save to ${ie(s)}`})]})]})})}function Ke({label:t,icon:n,chevron:r=!1,onClick:m}){return e.jsxs("button",{type:"button",onClick:m,className:"hover:bg-accent/50 focus-visible:bg-accent flex w-full items-center gap-2 px-3 py-1.5 text-left text-sm outline-none",children:[n,e.jsx("span",{className:"min-w-0 flex-1 truncate",children:t}),r&&e.jsx(Ue,{className:"text-muted-foreground size-3.5"})]})}export{_n as FileExplorer,ss as FileExplorerActions,Gt as FilePreviewDialog,on as HIDDEN_ENTRY_NAMES,it as HiddenEntriesToggle,ls as NO_PROVENANCE,Re as PINNED_ENTRY_NAMES,cs as ROOM_FILES_REFRESH_INTERVAL_MS,as as RoomFilesSection,rs as SaveToRoomFilesButton,We as createRoomFilesSource,yn as createSessionCwdSource,le as explorerDirQueryKey,we as explorerDirQueryOptions,ln as isHiddenEntryName,Se as isPinnedEntryName,cn as pinnedFirst,Yt as provenanceLine,Qe as roomRepoStatusQueryOptions,rt as withoutHidden};
|
|
16
|
+
*/const at={name:"upload",size:24,node:[["path",{d:"M12 3v12",key:"1x0j5s"}],["path",{d:"m17 8-5-5-5 5",key:"7q97r8"}],["path",{d:"M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4",key:"ih7n3h"}]]};at.node;const rn=De(at);function le(t,n,r){return["file-explorer","tree",t.scopeKey,n,t.filtersHidden?r:null]}function we(t,n,r,m){return{queryKey:le(t,n,r),queryFn:()=>t.list(n,{showHidden:r}),staleTime:_e.FILE_TREE_STALE_TIME_MS,gcTime:_e.FILE_TREE_GC_TIME_MS,refetchOnWindowFocus:!0,placeholderData:f=>f??m.getQueryData(le(t,n,!r))}}const on=[".git",".dork",".claude",".agents","node_modules"];function ln(t){return t.startsWith(".")||on.includes(t)}const Re=["ROOM.md","README.md"];function Se(t){return Re.some(n=>n.toLowerCase()===t.toLowerCase())}function rt(t){return t.filter(n=>!ln(n.name))}function cn(t){if(t.reduce((f,g)=>g.type==="file"&&Se(g.name)?f+1:f,0)===0)return t;const r=[],m=[];for(const f of t)f.type==="file"&&Se(f.name)?r.push(f):m.push(f);return r.sort((f,g)=>Re.findIndex(s=>s.toLowerCase()===f.name.toLowerCase())-Re.findIndex(s=>s.toLowerCase()===g.name.toLowerCase())),[...r,...m]}const dn=/ copy(?: \d+)?$/;function Me({name:t,isDir:n,taken:r}){const m=new Set(r);if(!m.has(t))return t;const f=n?-1:t.lastIndexOf("."),g=f>0,s=g?t.slice(f):"",p=(g?t.slice(0,f):t).replace(dn,"");for(let o=1;;o+=1){const i=o===1?`${p} copy${s}`:`${p} copy ${o}${s}`;if(!m.has(i))return i}}function ze(t,n,r){return{name:n,path:t,type:r,size:0,mtime:Date.now(),isSymlink:!1}}function un(t){const n=ne(),{source:r,showHidden:m,queryClient:f,inFlightRef:g}=t,s=r.cwd??"",[p,o]=a.useState(null),i=a.useCallback(async u=>{g.current+=1;try{return await u()}finally{g.current-=1}},[g]),d=a.useMemo(()=>{const u=x=>le(r,x,m);return{getChildren:x=>{var w;return((w=f.getQueryData(u(x)))==null?void 0:w.entries)??[]},isLoaded:x=>f.getQueryData(u(x))!==void 0,takenNames:async x=>(await n.readFileTree(s,{path:x===Q?void 0:x,showHidden:!0})).entries.map(j=>j.name),snapshot:x=>f.getQueryData(u(x)),setChildren:(x,w)=>{f.setQueryData(u(x),j=>({entries:He(w((j==null?void 0:j.entries)??[]))}))},restore:(x,w)=>{f.setQueryData(u(x),w)},invalidate:x=>{f.invalidateQueries({queryKey:u(x),exact:!0}),f.invalidateQueries({queryKey:Jt.index(s)})}}},[f,n,s,r,m]),R=a.useCallback((u,x,w)=>i(async()=>{const j=ee(u,x),D=!d.getChildren(u).some(L=>L.path===j),H=d.snapshot(u);D&&d.setChildren(u,L=>[...L,ze(j,x,w)]);try{return await n.createEntry(s,j,w),!0}catch(L){return D&&d.restore(u,H),ae(L,`Couldn’t create ${w==="dir"?"folder":"file"}`),!1}finally{d.invalidate(u)}}),[n,s,d,i]),F=a.useCallback((u,x)=>i(async()=>{if(x===u.name||x.length===0)return!0;const w=W(u.path),j=ee(w,x),D=d.getChildren(w).some(A=>A.path===j),H=d.snapshot(w),L={...u,name:x,path:j};D||d.setChildren(w,A=>A.map(K=>K.path===u.path?L:K));try{return await n.renameEntry(s,u.path,j),U.getState().remapExpandedPaths(u.path,j),!0}catch(A){return D||d.restore(w,H),ae(A,"Couldn’t rename"),!1}finally{d.invalidate(w)}}),[n,s,d,i]),E=a.useCallback(u=>i(async()=>{const x=W(u.path),w=d.snapshot(x);d.setChildren(x,j=>j.filter(D=>D.path!==u.path));try{await n.deleteEntry(s,u.path,{recursive:!0}),U.getState().dropExpandedPaths(u.path)}catch(j){d.restore(x,w),ae(j,"Couldn’t delete")}finally{d.invalidate(x)}}),[n,s,d,i]),_=a.useCallback(u=>i(async()=>{const x=W(u.path);if(u.type==="file"){const w=d.snapshot(x);d.setChildren(x,j=>j.filter(D=>D.path!==u.path));try{await n.deleteEntry(s,u.path),U.getState().dropExpandedPaths(u.path)}catch(j){d.restore(x,w),ae(j,"Couldn’t delete")}finally{d.invalidate(x)}return}try{await n.deleteEntry(s,u.path),d.setChildren(x,w=>w.filter(j=>j.path!==u.path)),U.getState().dropExpandedPaths(u.path),d.invalidate(x)}catch(w){if(qt(w)==="DIR_NOT_EMPTY"){o(u);return}ae(w,"Couldn’t delete")}}),[n,s,d,i]),b=a.useCallback(async()=>{const u=p;o(null),u&&await E(u)},[p,E]),I=a.useCallback(()=>o(null),[]),$=a.useCallback((u,x)=>i(async()=>{const w=W(u),j=ie(u),D=ee(x,j);if(x===w||D===u||Ce(x,u))return;const H=d.getChildren(w).find(C=>C.path===u);if(!H)return;const L=d.isLoaded(x),A=L&&d.getChildren(x).some(C=>C.path===D),K={...H,name:j,path:D},G=d.snapshot(w),O=L?d.snapshot(x):void 0;d.setChildren(w,C=>C.filter(z=>z.path!==u)),L&&!A&&d.setChildren(x,C=>[...C,K]);try{await n.renameEntry(s,u,D),U.getState().remapExpandedPaths(u,D)}catch(C){d.restore(w,G),L&&!A&&d.restore(x,O),ae(C,"Couldn’t move")}finally{d.invalidate(w),L&&d.invalidate(x)}}),[n,s,d,i]),v=a.useCallback((u,x)=>i(async()=>{if(u.isDir&&Ce(x,u.path)){Z.error(Qt);return}let w;try{w=await d.takenNames(x)}catch(A){ae(A,"Couldn’t copy");return}const j=Me({name:ie(u.path),isDir:u.isDir,taken:w}),D=ee(x,j),H=d.isLoaded(x),L=H?d.snapshot(x):void 0;if(H){const A=d.getChildren(W(u.path)).find(G=>G.path===u.path),K=A?{...A,name:j,path:D}:ze(D,j,u.isDir?"dir":"file");d.setChildren(x,G=>[...G,K])}try{await n.copyEntry(s,u.path,D)}catch(A){H&&d.restore(x,L),ae(A,"Couldn’t copy")}finally{d.invalidate(x)}}),[n,s,d,i]);return{createEntry:R,renameEntry:F,removeEntry:_,moveEntry:$,copyEntry:v,pendingRecursiveDelete:p,confirmRecursiveDelete:b,cancelRecursiveDelete:I}}function fn(t){return t!=null&&t.startsWith("darwin")?"Reveal in Finder":t!=null&&t.startsWith("win32")?"Reveal in File Explorer":"Show in file manager"}function hn(t,n){const r=t.includes("\\")&&!t.includes("/"),m=t.replace(/[\\/]+$/,""),f=r?n.split("/").join("\\"):n;return`${m}${r?"\\":"/"}${f}`}function pn(t){const n=ne(),{data:r}=dt(),m=a.useMemo(()=>n.supportsReveal?fn(r==null?void 0:r.platform):null,[n.supportsReveal,r==null?void 0:r.platform]),f=a.useCallback(async i=>{if(t)try{await n.revealEntry(t,i.path)}catch(d){ae(d,"Couldn’t open the file manager")}},[n,t]),{copy:g}=ut(),s=a.useCallback(async(i,d)=>{const R=d==="absolute"&&t?hn(t,i.path):i.path;await g(R)||Z.error("Couldn’t copy to the clipboard")},[t,g]),p=a.useCallback(i=>{Xt(Zt(i.path))||Z.error("Open a chat to add this file")},[]),o=a.useCallback(i=>{U.getState().setClipboard({path:i.path,isDir:i.type==="dir"});try{navigator.clipboard.writeText(i.path).catch(()=>{})}catch{}},[]);return{revealLabel:m,reveal:f,copyPath:s,addToChat:p,copyToClipboard:o}}const mn=1e3;function xn(t){const{source:n,showHidden:r,queryClient:m,inFlightRef:f}=t,g=n.changes,[s,p]=a.useState(null),[o,i]=a.useState(null),[d,R]=a.useState(null),[F,E]=a.useState(0),_=a.useCallback(async c=>{f.current+=1,E(h=>h+1);try{return await c()}finally{f.current-=1,E(h=>h-1)}},[f]),b=a.useMemo(()=>{const c=h=>le(n,h,r);return{listing:h=>m.getQueryData(c(h)),isLoaded:h=>m.getQueryData(c(h))!==void 0,entries:h=>{var T;return((T=m.getQueryData(c(h)))==null?void 0:T.entries)??[]},setEntries:(h,T)=>m.setQueryData(c(h),y=>({...y,entries:He(T((y==null?void 0:y.entries)??[]))})),restore:(h,T)=>m.setQueryData(c(h),T),fetch:h=>n.list(h,{showHidden:!0}),refreshAll:()=>{m.invalidateQueries({queryKey:["file-explorer","tree",n.scopeKey]}),m.invalidateQueries({queryKey:["file-explorer","preview",n.scopeKey]})}}},[m,n,r]),I=a.useCallback(async c=>{const h=b.listing(c);return(h==null?void 0:h.commit)!==void 0?h.commit:(await b.fetch(c)).commit??null},[b]),$=a.useCallback((c,h,T,y)=>{switch(c.status){case"changed":return!0;case"conflict":return R({kind:h,path:c.path,lastCommit:c.lastCommit,retry:()=>T(c.commit)}),!1;case"exists":return Z.error(y===void 0?c.reason:Ge(y)),!1;case"refused":return Z.error(c.reason),!1}},[]),v=a.useCallback((c,h)=>{Z.error(Ye(c)??h)},[]),u=a.useCallback((c,h,T)=>{const y=P=>_(async()=>{if(g===void 0)return!1;const N=W(c.path),S=W(h),k=ie(h),q=b.isLoaded(S),te=q&&b.entries(S).some(J=>J.path===h),V=b.listing(N),ye=S===N?void 0:b.listing(S),l={...c,name:k,path:h};te||(S===N?b.setEntries(N,J=>J.map(se=>se.path===c.path?l:se)):(b.setEntries(N,J=>J.filter(se=>se.path!==c.path)),q&&b.setEntries(S,J=>[...J,l])));const M=()=>{b.restore(N,V),S!==N&&q&&b.restore(S,ye)};try{const J=P??await I(N);if(J===null)return M(),Z.error("This room has no files to change yet."),!1;const se=await g.move({from:c.path,to:h,baseCommit:J}),Ee=$(se,T,async re=>{await y(re)},k);return Ee?U.getState().remapExpandedPaths(c.path,h):M(),Ee}catch(J){return M(),v(J,T==="rename"?"Couldn’t rename":"Couldn’t move"),!1}finally{b.refreshAll()}});return y(null)},[g,b,_,I,$,v]),x=a.useCallback(async(c,h)=>h===c.name||h.length===0?!0:u(c,ee(W(c.path),h),"rename"),[u]),w=a.useCallback(async(c,h)=>{const T=W(c),y=ee(h,ie(c));if(h===T||y===c||Ce(h,c))return;const P=b.entries(T).find(N=>N.path===c);P&&await u(P,y,"move")},[b,u]),j=a.useCallback(async c=>{let h=0;const T=[c];for(;T.length>0;){const y=T.shift(),P=await b.fetch(y);for(const N of P.entries)if(N.type==="dir"?T.push(N.path):h+=1,h>=mn)return{count:h,moreThan:!0}}return{count:h,moreThan:!1}},[b]),D=a.useCallback(c=>{if(c.type!=="dir"){p({entry:c,fileCount:1,moreThan:!1});return}p({entry:c,fileCount:null,moreThan:!1}),j(c.path).then(({count:h,moreThan:T})=>p(y=>(y==null?void 0:y.entry.path)===c.path?{entry:c,fileCount:h,moreThan:T}:y),()=>{})},[j]),H=a.useCallback(c=>{const h=T=>_(async()=>{if(g===void 0)return;const y=W(c.path),P=b.listing(y);b.setEntries(y,N=>N.filter(S=>S.path!==c.path));try{const N=T??await I(y);if(N===null){b.restore(y,P);return}const S=await g.remove({path:c.path,baseCommit:N});$(S,"delete",q=>h(q))?U.getState().dropExpandedPaths(c.path):b.restore(y,P)}catch(N){b.restore(y,P),v(N,"Couldn’t delete")}finally{b.refreshAll()}});return h(null)},[g,b,_,I,$,v]),L=a.useCallback(async()=>{const c=s;p(null),c&&await H(c.entry)},[s,H]),A=a.useCallback(()=>p(null),[]),K=a.useCallback((c,h,T,y)=>{const P=N=>_(async()=>{if(g===void 0)return;const S=b.isLoaded(c),k=S?b.listing(c):void 0;if(S){const q=new Set(b.entries(c).map(V=>V.name)),te=h.filter(V=>!q.has(V.name)).map(V=>({name:V.name,path:ee(c,V.name),type:"file",size:V.size}));te.length>0&&b.setEntries(c,V=>[...V,...te])}try{const q=await g.upload({dir:c,baseCommit:N,replace:T,files:h});!$(q,"upload",V=>P(V))&&S&&b.restore(c,k)}catch(q){S&&b.restore(c,k),v(q,"Couldn’t upload")}finally{b.refreshAll()}});return P(y)},[g,b,_,$,v]),G=a.useCallback(async(c,h)=>{if(g===void 0||h.length===0)return;if(h.length>g.maxUploadFiles){Z.error(`Nothing was uploaded. One upload takes up to ${g.maxUploadFiles} files.`);return}let T;try{T=await b.fetch(c)}catch(k){v(k,"Couldn’t upload");return}const y=T.entries.map(k=>k.name),P=new Set(y),N=h.map(k=>k.name).filter(k=>P.has(k)),S=T.commit??null;if(N.length===0){await K(c,h,[],S);return}i({dir:c,files:h,names:N,taken:y,baseCommit:S})},[g,b,v,K]),O=a.useCallback(async c=>{const h=o;if(i(null),h===null)return;if(c==="replace"){await K(h.dir,h.files,h.names,h.baseCommit);return}const T=new Set([...h.taken,...h.files.map(N=>N.name)]),y=new Set(h.names),P=h.files.map(N=>{if(!y.has(N.name))return N;const S=Me({name:N.name,isDir:!1,taken:T});return T.add(S),new File([N],S,{type:N.type,lastModified:N.lastModified})});await K(h.dir,P,[],h.baseCommit)},[o,K]),C=a.useCallback(()=>i(null),[]),z=a.useCallback(()=>R(null),[]),B=a.useMemo(()=>o===null?null:{dir:o.dir,names:o.names},[o]);return{renameEntry:x,moveEntry:w,requestDelete:D,pendingDelete:s,confirmDelete:L,cancelDelete:A,upload:G,pendingClash:B,resolveClash:O,cancelClash:C,conflict:d,dismissConflict:z,busy:F>0}}const Ie={scopeKey:"",cwd:null,writable:!1,provenance:!1,filtersHidden:!0,preview:"canvas",editable:!1,list:()=>Promise.resolve({entries:[]})};function gn(t){var c,h,T;const n=ne(),r=oe(),{setTheme:m}=ft(),f=U(y=>y.showHidden),g=U(y=>y.expanded),s=U(y=>y.loadExplorerForCwd),p=U(y=>y.pruneMissing),o=(t==null?void 0:t.scopeKey)??null,i=(t==null?void 0:t.cwd)??null;a.useEffect(()=>{s(o)},[o,s]);const d=a.useMemo(()=>[Q,...ht(g)],[g]),R=pt({queries:t?d.map(y=>we(t,y,f,r)):[]}),F=(t==null?void 0:t.filtersHidden)??!0,E=a.useMemo(()=>{const y={};return d.forEach((P,N)=>{var q;const S=R[N];let k=((q=S==null?void 0:S.data)==null?void 0:q.entries)??[];!f&&!F&&(k=rt(k)),P===Q&&(k=cn(k)),y[P]={entries:k,loading:(S==null?void 0:S.isLoading)??!1,error:(S==null?void 0:S.isError)??!1}}),y},[d,R,f,F]),_=a.useRef(0),b=a.useRef({});a.useEffect(()=>{_.current>0||d.forEach((y,P)=>{var S,k,q;const N=(k=(S=R[P])==null?void 0:S.data)==null?void 0:k.entries;!N||(q=R[P])!=null&&q.isError||b.current[y]!==N&&(b.current[y]=N,p(y,N.map(te=>te.name)))})},[d,R,p]);const I=a.useMemo(()=>mt(g,E),[g,E]),$=!!t&&!!((c=E[Q])!=null&&c.loading),v=!!t&&!!((h=E[Q])!=null&&h.error),u=(T=R[0])==null?void 0:T.error,x=v&&u?Bt(u):void 0,w=(x==null?void 0:x.message)??null,j=(x==null?void 0:x.command)??null,D=a.useMemo(()=>{var P;const y=new Set;for(const N of d)N!==Q&&((P=E[N])!=null&&P.error)&&y.add(N);return y},[d,E]),H=a.useCallback(y=>{if(y.type!=="dir")return;const P=U.getState();P.setDirExpanded(y.path,!P.expanded[y.path])},[]),L=a.useCallback(y=>{if(y===Q)return;const P=U.getState();P.expanded[y]||P.setDirExpanded(y,!0)},[]),A=(t==null?void 0:t.preview)==="canvas",K=a.useCallback(y=>{if(y.type!=="file"||!A)return;const P={getStore:Te.getState,setTheme:m,supportsTerminal:n.supportsTerminal};xt(P,{action:"open_file",sourcePath:y.path},"user")},[A,m,n]),G=a.useCallback(()=>{o!==null&&r.invalidateQueries({queryKey:["file-explorer","tree",o]})},[r,o]),O=a.useCallback(y=>{t!==null&&r.invalidateQueries({queryKey:le(t,y,f),exact:!0})},[r,t,f]);a.useEffect(()=>{if(t!=null&&t.events)return t.events(G)},[t,G]);const C=un({source:t??Ie,showHidden:f,queryClient:r,inFlightRef:_}),z=xn({source:t??Ie,showHidden:f,queryClient:r,inFlightRef:_}),B=pn(i);return{rows:I,rootLoading:$,rootError:v,rootErrorMessage:w,rootErrorCommand:j,errorPaths:D,toggleExpand:H,ensureExpanded:L,openFile:K,reload:G,retryDir:O,changes:t!=null&&t.changes?z:null,...C,...B}}function yn(t){const{transport:n,cwd:r}=t;return{scopeKey:r,cwd:r,writable:!0,provenance:!1,filtersHidden:!0,preview:"canvas",editable:!1,list(m,f){return n.readFileTree(r,{path:m===""?void 0:m,showHidden:f.showHidden})}}}function ke(t){return Array.from(t).includes("Files")}function ot(t){const n=Array.from(t.items??[]);if(!(n.length>0&&n.every(g=>"webkitGetAsEntry"in g)))return{files:Array.from(t.files??[]),folders:0};const m=[];let f=0;for(const g of n){if(g.kind!=="file")continue;const s=g.webkitGetAsEntry();if(s!=null&&s.isDirectory){f+=1;continue}const p=g.getAsFile();p&&m.push(p)}return{files:m,folders:f}}const vn=12;function Cn({row:t,selected:n,renaming:r,error:m,onSelect:f,onActivate:g,onRetry:s,onSubmitRename:p,onCancelRename:o,onNewFile:i,onNewFolder:d,onStartRename:R,onDelete:F,onMove:E,onCopyInto:_,onCopy:b,onPaste:I,onDuplicate:$,canPasteInto:v,revealLabel:u,onReveal:x,onAddToChat:w,onCopyPath:j,readOnly:D=!1,provenance:H=!1,copyable:L=!0,onDisk:A=!0,onUpload:K,onPickUpload:G}){const{entry:O,depth:C,expanded:z,loading:B}=t,c=O.type==="dir",h=c?O.path:W(O.path),[T,y]=a.useState(!1),P=!c&&C===0&&Se(O.name),N=Gt(O.lastCommit),S=e.jsxs("div",{role:"treeitem","aria-label":O.name,"aria-expanded":c?z:void 0,"aria-selected":n,tabIndex:-1,onKeyDown:k=>{(k.key==="Enter"||k.key===" ")&&(k.preventDefault(),f(O),g(O))},draggable:!r&&!D,onDragStart:k=>{D||(k.dataTransfer.setData("text/plain",O.path),k.dataTransfer.setData(tn,O.path),k.dataTransfer.effectAllowed="copyMove")},onDragOver:k=>{if(k.stopPropagation(),!D&&K&&ke(k.dataTransfer.types)){k.preventDefault(),k.dataTransfer.dropEffect="copy",y(!0);return}D||!c||!Je(k.dataTransfer.types)||(k.preventDefault(),k.dataTransfer.dropEffect=k.altKey&&L?"copy":"move",y(!0))},onDragLeave:()=>y(!1),onDrop:k=>{if(k.stopPropagation(),D)return;if(y(!1),K&&ke(k.dataTransfer.types)){k.preventDefault();const{files:te}=ot(k.dataTransfer);K(h,te);return}if(!c)return;const q=Ve(k.dataTransfer);q!==null&&(k.preventDefault(),k.altKey&&L?_(q,O.path):E(q,O.path))},onClick:()=>{f(O),g(O)},className:Oe("flex w-full cursor-pointer items-center gap-1 py-1 pr-2 text-sm transition-colors",n?"bg-accent text-foreground":"hover:bg-accent/50",T&&"ring-ring/60 bg-accent ring-1"),style:{paddingLeft:C*vn+8},children:[e.jsx("span",{className:"flex size-4 flex-shrink-0 items-center justify-center",children:c&&(B?e.jsx(Fe,{size:"xs",className:"text-muted-foreground"}):m?e.jsx("button",{type:"button","aria-label":"Retry loading",title:"Couldn’t load. Retry",onClick:k=>{k.stopPropagation(),s()},className:"flex items-center justify-center",children:e.jsx(Xe,{className:"text-destructive size-3.5"})}):z?e.jsx(gt,{className:"text-muted-foreground size-3.5"}):e.jsx(Ue,{className:"text-muted-foreground size-3.5"}))}),c?z?e.jsx(yt,{className:"size-(--size-icon-sm) flex-shrink-0 text-sky-500"}):e.jsx(be,{className:"size-(--size-icon-sm) flex-shrink-0 text-sky-500"}):O.isSymlink===!0?e.jsx(nn,{className:"text-muted-foreground size-(--size-icon-sm) flex-shrink-0"}):e.jsx(Ze,{className:"text-muted-foreground size-(--size-icon-sm) flex-shrink-0"}),r?e.jsx(bn,{initialName:O.name,onSubmit:k=>p(O,k),onCancel:o}):e.jsx("span",{className:"min-w-0 flex-1 truncate",children:O.name}),P&&!r&&e.jsx(vt,{"aria-label":"Pinned to the top",className:"text-muted-foreground/60 size-3 flex-shrink-0"}),H&&!r&&e.jsx("span",{className:"text-muted-foreground/70 text-2xs max-w-[45%] flex-shrink-0 truncate tabular-nums",title:N.title??void 0,children:N.label})]});return D?S:e.jsxs(Ct,{children:[e.jsx(bt,{asChild:!0,children:S}),e.jsxs(jt,{className:"w-52",children:[e.jsx(X,{movesFocus:!0,onClick:()=>i(h),children:"New file"}),e.jsx(X,{movesFocus:!0,onClick:()=>d(h),children:"New folder"}),G&&e.jsx(X,{onClick:()=>G(h),children:"Upload files…"}),A&&e.jsxs(e.Fragment,{children:[e.jsx(ve,{}),u&&e.jsx(X,{onClick:()=>x(O),children:u}),e.jsx(X,{movesFocus:!0,onClick:()=>w(O),children:"Add to chat"})]}),L&&e.jsxs(e.Fragment,{children:[e.jsx(ve,{}),e.jsx(X,{onClick:()=>b(O),children:"Copy"}),e.jsx(X,{disabled:!v(h),onClick:()=>I(h),children:"Paste"}),e.jsx(X,{onClick:()=>$(O),children:"Duplicate"})]}),e.jsx(ve,{}),A?e.jsxs(e.Fragment,{children:[e.jsx(X,{onClick:()=>j(O,"absolute"),children:"Copy path"}),e.jsx(X,{onClick:()=>j(O,"relative"),children:"Copy relative path"})]}):e.jsx(X,{onClick:()=>j(O,"relative"),children:"Copy path"}),e.jsx(ve,{}),e.jsx(X,{movesFocus:!0,onClick:()=>R(O),children:"Rename"}),e.jsx(X,{variant:"destructive",onClick:()=>F(O),children:"Delete"})]})]})}function bn({initialName:t,onSubmit:n,onCancel:r}){const m=a.useRef(null),[f,g]=a.useState(t);a.useEffect(()=>{const p=m.current;if(!p)return;p.focus();const o=t.lastIndexOf(".");p.setSelectionRange(0,o>0?o:t.length)},[t]);const s=()=>{const p=f.trim();p&&p!==t?n(p):r()};return e.jsx("input",{ref:m,type:"text",value:f,"aria-label":"New name",onChange:p=>g(p.target.value),onClick:p=>p.stopPropagation(),onBlur:s,onKeyDown:p=>{p.stopPropagation(),p.key==="Enter"?s():p.key==="Escape"&&r()},className:"border-border bg-background focus-ring min-w-0 flex-1 rounded border px-1 py-0 text-sm outline-none"})}const jn=100,kn=28,wn=250;function En(t){const{rows:n,selectedPath:r,renamingPath:m,errorPaths:f,onSelectPath:g,onRetryDir:s}=t,p=a.useRef(null),o=U(C=>C.setScrollTop),i=U(C=>C.scopeKey),d=a.useCallback(C=>C.type==="dir"?t.onToggle(C):t.onOpen(C),[t]),R=Rn(t,d),F=n.length>jn,E=en({count:n.length,getScrollElement:()=>p.current,estimateSize:()=>kn,overscan:12,enabled:F}),_=a.useRef({scope:void 0,done:!1}),b=a.useRef(null);a.useLayoutEffect(()=>{const C=_.current;if(C.scope!==i&&(C.scope=i,C.done=!1),C.done||n.length===0)return;const z=p.current;if(!z)return;const B=U.getState().scrollTop;if(B<=0){C.done=!0;return}F?E.scrollToOffset(B):z.scrollTop=B,b.current=z.scrollTop,z.scrollTop>=B&&(C.done=!0)},[n.length,i,F,E]);const I=a.useRef(null),$=a.useRef(null),v=a.useCallback(()=>{const C=p.current;C&&C.scrollTop!==b.current&&(_.current.done=!0,I.current=C.scrollTop,$.current&&clearTimeout($.current),$.current=setTimeout(()=>{$.current=null,I.current!==null&&o(I.current)},wn))},[o]);a.useEffect(()=>()=>{$.current&&clearTimeout($.current),I.current!==null&&o(I.current)},[o]);const u=a.useRef(void 0);a.useEffect(()=>{var c,h;const C=u.current;if(u.current=r,C===void 0||r===C||r===null)return;const z=n.findIndex(T=>T.entry.path===r);if(z<0)return;const B=p.current;B&&(F?E.scrollToIndex(z,{align:"auto"}):(h=(c=B.querySelector(`[data-row-index="${z}"]`))==null?void 0:c.scrollIntoView)==null||h.call(c,{block:"nearest"}),b.current=B.scrollTop)},[r,n,F,E]);const[x,w]=a.useState(!1),{onCopyInto:j,onMove:D}=t,H=t.readOnly===!0,L=t.copyable!==!1,A=a.useCallback(C=>{H||!Je(C.dataTransfer.types)||(C.preventDefault(),C.dataTransfer.dropEffect=C.altKey&&L?"copy":"move",w(!0))},[H,L]),K=a.useCallback((C,z)=>{const B=n.find(c=>c.entry.path===C);B&&j({path:C,isDir:B.entry.type==="dir"},z)},[n,j]),G=a.useCallback(C=>{if(w(!1),H)return;const z=Ve(C.dataTransfer);z!==null&&(C.preventDefault(),C.altKey&&L?K(z,Q):D(z,Q))},[K,D,H,L]),O=C=>e.jsx(Cn,{row:C,selected:C.entry.path===r,renaming:C.entry.path===m,error:C.entry.type==="dir"&&C.expanded&&f.has(C.entry.path),onSelect:z=>g(z.path),onActivate:d,onRetry:()=>s(C.entry.path),onSubmitRename:t.onSubmitRename,onCancelRename:t.onCancelRename,onStartRename:t.onStartRename,onNewFile:t.onNewFile,onNewFolder:t.onNewFolder,onDelete:t.onDelete,onMove:t.onMove,onCopyInto:K,onCopy:t.onCopy,onPaste:t.onPaste,onDuplicate:t.onDuplicate,canPasteInto:t.canPasteInto,revealLabel:t.revealLabel,onReveal:t.onReveal,onAddToChat:t.onAddToChat,onCopyPath:t.onCopyPath,readOnly:t.readOnly,provenance:t.provenance,copyable:t.copyable,onDisk:t.onDisk,onUpload:t.onUpload,onPickUpload:t.onPickUpload});return e.jsx("div",{ref:p,role:"tree","aria-label":"File explorer",tabIndex:0,onKeyDown:R,onScroll:v,onDragOver:A,onDragLeave:()=>w(!1),onDrop:G,className:Oe("focus-visible:ring-ring h-full overflow-auto outline-none focus-visible:ring-1 focus-visible:ring-inset",x&&"ring-ring/60 bg-accent/30 ring-1 ring-inset"),children:F?e.jsx("div",{style:{height:E.getTotalSize()},className:"relative w-full",children:E.getVirtualItems().map(C=>e.jsx("div",{"data-row-index":C.index,className:"absolute top-0 left-0 w-full",style:{transform:`translateY(${C.start}px)`},children:O(n[C.index])},n[C.index].entry.path))}):n.map((C,z)=>e.jsx("div",{"data-row-index":z,children:O(C)},C.entry.path))})}function Nn(t){return t?t.type==="dir"?t.path:W(t.path):Q}function Rn(t,n){const{rows:r,selectedPath:m,renamingPath:f,onSelectPath:g}=t;return a.useCallback(s=>{var i,d,R,F;if(f!==null)return;const p=r.findIndex(E=>E.entry.path===m),o=p>=0?r[p]:void 0;if(s.metaKey||s.ctrlKey){if(t.readOnly===!0||t.copyable===!1)return;const E=s.key.toLowerCase();if(E==="c"&&o){s.preventDefault(),t.onCopy(o.entry);return}if(E==="v"){s.preventDefault(),t.onPaste(Nn(o==null?void 0:o.entry));return}return}switch(s.key){case"ArrowDown":s.preventDefault(),g(((i=r[Math.min(p+1,r.length-1)])==null?void 0:i.entry.path)??((d=r[0])==null?void 0:d.entry.path));break;case"ArrowUp":s.preventDefault(),g(((R=r[Math.max(p-1,0)])==null?void 0:R.entry.path)??((F=r[0])==null?void 0:F.entry.path));break;case"ArrowRight":(o==null?void 0:o.entry.type)==="dir"&&!o.expanded&&(s.preventDefault(),t.onToggle(o.entry));break;case"ArrowLeft":if(!o)break;if(s.preventDefault(),o.entry.type==="dir"&&o.expanded)t.onToggle(o.entry);else{const E=W(o.entry.path);E&&g(E)}break;case"Enter":o&&(s.preventDefault(),n(o.entry));break;case"F2":o&&t.readOnly!==!0&&(s.preventDefault(),t.onStartRename(o.entry));break;case"Delete":case"Backspace":o&&t.readOnly!==!0&&(s.preventDefault(),t.onDelete(o.entry));break}},[r,m,f,g,t,n])}const Sn={rename:"Rename it anyway",move:"Move it anyway",delete:"Delete it anyway",upload:"Upload mine over it"},Dn={rename:"nothing was renamed",move:"nothing was moved",delete:"nothing was deleted",upload:"nothing was uploaded"};function Tn(t){const{entry:n,fileCount:r,moreThan:m}=t;if(n.type!=="dir")return`“${n.name}” leaves the room’s files.`;const f=r===null?"everything in it":m?`the more than ${r.toLocaleString()} files in it`:r===1?"the 1 file in it":`the ${r.toLocaleString()} files in it`;return`“${n.name}” and ${f} leave the room’s files.`}const Fn="The room’s history keeps a copy. An agent can restore it.";function On({changes:t,onOpenTheirs:n,onReturnFocus:r}){var E;const m=_=>{_.preventDefault();const b=document.activeElement;b!==null&&b!==document.body||r()},{pendingDelete:f,pendingClash:g,conflict:s}=t,[p,o]=a.useState(f);f!==null&&f!==p&&o(f);const[i,d]=a.useState(g);g!==null&&g!==i&&d(g);const R=i===null?"":i.dir===Q?"The top folder":`“${i.dir}”`,F=(i==null?void 0:i.names.length)===1;return e.jsxs(e.Fragment,{children:[e.jsx(de,{open:f!==null,onOpenChange:_=>!_&&t.cancelDelete(),children:e.jsxs(ue,{onCloseAutoFocus:m,children:[e.jsxs(fe,{children:[e.jsx(he,{children:p===null?"":`Delete “${p.entry.name}”?`}),e.jsx(pe,{asChild:!0,children:e.jsxs("div",{className:"space-y-2",children:[e.jsx("p",{children:p===null?"":Tn(p)}),e.jsx("p",{children:Fn})]})})]}),e.jsxs(me,{children:[e.jsx(xe,{onClick:t.cancelDelete,children:"Cancel"}),e.jsx(ge,{onClick:()=>void t.confirmDelete(),className:"bg-destructive hover:bg-destructive/90 dark:bg-destructive/60 text-white",children:(p==null?void 0:p.entry.type)==="dir"?"Delete folder":"Delete file"})]})]})}),e.jsx(de,{open:g!==null,onOpenChange:_=>!_&&t.cancelClash(),children:e.jsxs(ue,{onCloseAutoFocus:m,children:[e.jsxs(fe,{children:[e.jsx(he,{children:F?`Replace “${i==null?void 0:i.names[0]}”?`:`Replace ${(i==null?void 0:i.names.length)??0} files?`}),e.jsx(pe,{children:F?`${R} already has a file with this name. Replace it, or keep both.`:`${R} already has files named ${(i==null?void 0:i.names.join(", "))??""}. Replace them, or keep both.`})]}),e.jsxs(me,{children:[e.jsx(xe,{onClick:t.cancelClash,children:"Cancel"}),e.jsx(Y,{variant:"outline",onClick:()=>void t.resolveClash("keep-both"),children:"Keep both"}),e.jsx(ge,{onClick:()=>void t.resolveClash("replace"),children:"Replace"})]})]})}),e.jsx(de,{open:s!==null,onOpenChange:_=>!_&&t.dismissConflict(),children:e.jsxs(ue,{onCloseAutoFocus:m,children:[e.jsxs(fe,{children:[e.jsx(he,{children:"Somebody changed this first"}),e.jsx(pe,{children:s===null?"":`${((E=s.lastCommit)==null?void 0:E.author)??"Somebody"} changed “${s.path}” after you opened it, so ${Dn[s.kind]}.`})]}),(s==null?void 0:s.lastCommit)&&e.jsxs("p",{className:"text-muted-foreground text-xs",children:[s.lastCommit.subject," · ",kt(s.lastCommit.at)]}),e.jsxs(me,{children:[e.jsx(xe,{onClick:t.dismissConflict,children:"Cancel"}),e.jsx(Y,{variant:"outline",onClick:()=>{s!==null&&(t.dismissConflict(),n(s.path))},children:"Open their version"}),e.jsx(ge,{onClick:()=>{s!==null&&(t.dismissConflict(),s.retry())},className:"bg-destructive hover:bg-destructive/90 dark:bg-destructive/60 text-white",children:s===null?"":Sn[s.kind]})]})]})})]})}function $e(t,n){return n.name===t?Ge(t):`“${n.name}” is already there. Some computers ignore capital letters in names. Pick another name.`}const Pn="Folders can’t be uploaded. Drop the files inside instead.";function Mn({source:t,className:n,onCommands:r}={}){var ye;const m=ne(),f=Te(l=>l.selectedCwd),g=a.useMemo(()=>f?yn({transport:m,cwd:f}):null,[m,f]),s=t===void 0?g:t,p=s!==null&&!s.writable,o=gn(s),i=o.changes,d=oe(),R=U(l=>l.showHidden),{rows:F,rootLoading:E,rootError:_,rootErrorMessage:b,rootErrorCommand:I,errorPaths:$}=o,v=U(l=>l.setCommands),u=U(l=>l.selectedPath),x=U(l=>l.setSelectedPath),w=U(l=>l.clipboard),[j,D]=a.useState(null),[H,L]=a.useState(null),[A,K]=a.useState(null),G=a.useCallback(l=>K(l===null?null:{path:l,isNew:!1}),[]),O=a.useRef(null),C=a.useRef(Q),[z,B]=a.useState(!1),c=a.useCallback((l,M)=>{if(i!==null){if(M.length===0){Z.error(Pn);return}o.ensureExpanded(l),i.upload(l,M)}},[i,o]),h=a.useRef(null),T=a.useCallback(()=>{var l,M;(M=(l=h.current)==null?void 0:l.querySelector('[role="tree"]'))==null||M.focus()},[]),y=a.useCallback(l=>{var M;C.current=l,(M=O.current)==null||M.click()},[]),P=a.useCallback(l=>w!==null&&!(w.isDir&&Ce(l,w.path)),[w]),N=a.useCallback((l,M)=>{o.ensureExpanded(l),Ae.flushSync(()=>{L(null),D({parent:l,type:M})})},[o]),S=a.useCallback(l=>{Ae.flushSync(()=>L(l.path))},[]),k=a.useRef({startCreate:N,reload:o.reload,pickUpload:y});a.useEffect(()=>{k.current={startCreate:N,reload:o.reload,pickUpload:y}});const q=i!==null;a.useEffect(()=>{if(p||r===void 0&&q)return;const l=r??v;return l({newFile:()=>k.current.startCreate(Q,"file"),newFolder:()=>k.current.startCreate(Q,"dir"),refresh:()=>k.current.reload(),...q&&{upload:()=>k.current.pickUpload(Q)}}),()=>l(null)},[v,r,p,q]);const te=a.useCallback(async l=>{var se;if(!j||s===null)return;const M=j;if(D(null),i!==null){const re=(((se=d.getQueryData(le(s,M.parent,R)))==null?void 0:se.entries)??[]).find(ct=>ct.name.toLowerCase()===l.toLowerCase());if(M.type==="dir"){if(re!==void 0&&!(re.type==="dir"&&re.name===l)){Z.error($e(l,re));return}D({parent:ee(M.parent,l),type:"file",firstInFolder:l});return}if(re!==void 0){Z.error($e(l,re));return}const lt=ee(M.parent,l);K({path:lt,isNew:!0});return}await o.createEntry(M.parent,l,M.type)&&x(ee(M.parent,l))},[j,s,i,d,R,o,x]),V=a.useCallback(async(l,M)=>{L(null),(i?await i.renameEntry(l,M):await o.renameEntry(l,M))&&x(ee(W(l.path),M))},[i,o,x]);return s===null?t!==void 0?null:e.jsx("div",{className:"text-muted-foreground flex h-full items-center justify-center p-6 text-center text-sm",children:"Pick a folder to see its files."}):e.jsxs("div",{ref:h,className:Oe("flex h-full flex-col",z&&"ring-ring/60 bg-accent/30 ring-1 ring-inset",n),onDragOver:l=>{i===null||!ke(l.dataTransfer.types)||(l.preventDefault(),l.dataTransfer.dropEffect="copy",B(!0))},onDragLeave:l=>{l.currentTarget.contains(l.relatedTarget)||B(!1)},onDrop:l=>{B(!1),!(i===null||!ke(l.dataTransfer.types))&&(l.preventDefault(),c(Q,ot(l.dataTransfer).files))},children:[i!==null&&e.jsx("input",{ref:O,type:"file",multiple:!0,hidden:!0,"aria-hidden":!0,tabIndex:-1,"data-testid":"room-files-upload-input",onChange:l=>{const M=Array.from(l.target.files??[]);l.target.value="",c(C.current,M)}}),e.jsxs("div",{className:"min-h-0 flex-1",children:[j&&e.jsx(_n,{type:j.type,firstInFolder:j.firstInFolder,onSubmit:l=>void te(l),onCancel:()=>D(null)},`${j.parent}:${j.type}:${j.firstInFolder??""}`),E&&F.length===0?e.jsx("div",{className:"flex h-20 items-center justify-center",children:e.jsx(Fe,{size:"md",className:"text-muted-foreground",label:"Loading files"})}):_&&F.length===0?e.jsxs("div",{className:"text-muted-foreground flex min-h-20 flex-col items-center justify-center gap-2 px-4 py-3 text-center text-xs [overflow-wrap:anywhere]",children:[e.jsx("span",{children:b??"Couldn’t load files."}),I!==null&&e.jsx("code",{"aria-label":"Command that removes the settings",className:"bg-muted text-foreground block w-full rounded px-2 py-1.5 text-left font-mono select-all",children:I}),e.jsxs(Y,{variant:"outline",size:"xs",onClick:o.reload,children:[e.jsx(Xe,{}),"Retry"]})]}):F.length===0&&!j?e.jsx("div",{className:"text-muted-foreground/60 flex h-20 items-center justify-center px-4 text-center text-xs",children:i!==null?"No files yet. Drop files here, or use Upload.":"Empty folder"}):e.jsx(En,{rows:F,selectedPath:u,renamingPath:H,errorPaths:$,onSelectPath:x,onToggle:o.toggleExpand,onOpen:l=>{s.preview==="inline"?G(l.path):o.openFile(l)},onRetryDir:o.retryDir,onSubmitRename:(l,M)=>void V(l,M),onCancelRename:()=>L(null),onStartRename:S,onNewFile:l=>N(l,"file"),onNewFolder:l=>N(l,"dir"),onDelete:l=>i?i.requestDelete(l):void o.removeEntry(l),onMove:(l,M)=>void(i?i.moveEntry(l,M):o.moveEntry(l,M)),onCopyInto:(l,M)=>void o.copyEntry(l,M),onCopy:o.copyToClipboard,onPaste:l=>{w&&o.copyEntry(w,l)},onDuplicate:l=>void o.copyEntry({path:l.path,isDir:l.type==="dir"},W(l.path)),canPasteInto:P,readOnly:p,provenance:s.provenance,copyable:i===null,onDisk:s.cwd!==null,onUpload:i?c:void 0,onPickUpload:i?y:void 0,revealLabel:o.revealLabel,onReveal:l=>void o.reveal(l),onAddToChat:o.addToChat,onCopyPath:(l,M)=>void o.copyPath(l,M)})]}),s.preview==="inline"&&e.jsx(Yt,{source:s,path:(A==null?void 0:A.path)??null,isNew:(A==null?void 0:A.isNew)??!1,onCreated:()=>{A!==null&&(K({path:A.path,isNew:!1}),x(A.path))},onClose:()=>K(null)}),i!==null&&e.jsx(On,{changes:i,onOpenTheirs:l=>G(l),onReturnFocus:T}),e.jsx(de,{open:o.pendingRecursiveDelete!==null,onOpenChange:l=>!l&&o.cancelRecursiveDelete(),children:e.jsxs(ue,{children:[e.jsxs(fe,{children:[e.jsxs(he,{children:["Delete “",(ye=o.pendingRecursiveDelete)==null?void 0:ye.name,"”?"]}),e.jsx(pe,{children:"This folder isn’t empty. Everything inside is deleted. This can’t be undone."})]}),e.jsxs(me,{children:[e.jsx(xe,{onClick:o.cancelRecursiveDelete,children:"Cancel"}),e.jsx(ge,{onClick:()=>void o.confirmRecursiveDelete(),className:"bg-destructive hover:bg-destructive/90 dark:bg-destructive/60 text-white",children:"Delete folder"})]})]})})]})}function _n({type:t,firstInFolder:n,onSubmit:r,onCancel:m}){const f=a.useRef(null),[g,s]=a.useState("");a.useEffect(()=>{var i;(i=f.current)==null||i.focus()},[]);const p=()=>{const i=g.trim();i?r(i):m()},o=e.jsxs("div",{className:"flex items-center gap-1",children:[t==="dir"?e.jsx(be,{className:"size-(--size-icon-sm) flex-shrink-0 text-sky-500"}):e.jsx(Ze,{className:"text-muted-foreground size-(--size-icon-sm) flex-shrink-0"}),e.jsx("input",{ref:f,type:"text",value:g,"aria-label":n!==void 0?`First file in ${n}`:t==="dir"?"New folder name":"New file name",placeholder:t==="dir"?"folder-name":"file-name",onChange:i=>s(i.target.value),onBlur:p,onKeyDown:i=>{i.key==="Enter"?p():i.key==="Escape"&&m()},className:"border-border bg-background focus-ring min-w-0 flex-1 rounded border px-1 py-0 text-sm outline-none"})]});return n===void 0?e.jsx("div",{className:"px-3 py-1",children:o}):e.jsxs("div",{className:"space-y-1 px-3 py-1",children:[e.jsxs("p",{className:"text-muted-foreground flex min-w-0 items-center gap-1 text-xs",children:[e.jsx(be,{className:"size-(--size-icon-xs) flex-shrink-0 text-sky-500"}),e.jsx("span",{className:"truncate",children:n})]}),o,e.jsx("p",{className:"text-muted-foreground text-2xs",children:"Name its first file. The folder appears on save."})]})}function it(){const t=U(m=>m.showHidden),n=U(m=>m.setShowHidden),r=t?"Hide hidden files":"Show hidden files";return e.jsx(Y,{variant:"ghost",size:"icon-xs","aria-label":r,title:r,onClick:()=>n(!t),children:t?e.jsx(wt,{className:"text-muted-foreground"}):e.jsx(Et,{className:"text-muted-foreground"})})}function An({cwd:t}){const n=ne(),{data:r}=ce({queryKey:["file-explorer","workspace",t],queryFn:()=>n.resolveWorkspace(t),staleTime:6e4});return r!=null&&r.branch?e.jsxs("span",{className:"text-muted-foreground bg-muted/50 text-2xs inline-flex min-w-0 items-center gap-1 rounded px-1.5 py-0.5",title:`Workspace ${r.key} on ${r.branch}`,children:[e.jsx(et,{className:"size-3 flex-shrink-0"}),e.jsx("span",{className:"truncate",children:r.branch})]}):null}function ss(){const t=Te(r=>r.selectedCwd),n=U(r=>r.commands);return t?e.jsxs(e.Fragment,{children:[e.jsx(An,{cwd:t}),e.jsx(Y,{variant:"ghost",size:"icon-xs","aria-label":"New file",title:"New file",onClick:()=>n==null?void 0:n.newFile(),children:e.jsx(st,{className:"text-muted-foreground"})}),e.jsx(Y,{variant:"ghost",size:"icon-xs","aria-label":"New folder",title:"New folder",onClick:()=>n==null?void 0:n.newFolder(),children:e.jsx(qe,{className:"text-muted-foreground"})}),e.jsx(it,{}),e.jsx(Y,{variant:"ghost",size:"icon-xs","aria-label":"Refresh",title:"Refresh",onClick:()=>n==null?void 0:n.refresh(),children:e.jsx(Nt,{className:"text-muted-foreground"})})]}):null}function Ln({roomId:t}){const n=ne(),r=oe(),m=ce(Qe(n,t));a.useEffect(()=>Wt(r,t,()=>{r.invalidateQueries({queryKey:je.repoStatus(t)})}),[r,t]);const f=a.useMemo(()=>{var o;return((o=m.data)==null?void 0:o.kind)==="ok"?Rt(m.data.status):[]},[m.data]),g=St(f),s=Dt(f);if(!s)return null;const p=f.map((o,i)=>`${g[i]}: ${Tt(o)}`);return e.jsxs("span",{"data-slot":"pending-work-badge",title:p.join(`
|
|
17
|
+
`),className:"text-muted-foreground bg-muted/50 text-2xs inline-flex min-w-0 items-center gap-1 rounded px-1.5 py-0.5",children:[e.jsx(et,{className:"size-3 flex-shrink-0"}),e.jsxs("span",{className:"sr-only",children:["Not merged into the room yet. ",p.join(". "),"."]}),e.jsx("span",{"aria-hidden":"true",className:"truncate",children:s})]})}const zn={added:"added",modified:"changed",deleted:"deleted",untracked:"new"},In=new Map([["OPERATOR_ONLY","Only the owner of this DorkOS can keep or discard these."],["ROOM_FILE_NOT_FOUND","One of those changes is gone, so nothing was discarded. The list is refreshed."],["MERGE_IN_FLIGHT","Something else is writing to these files. Nothing changed. Try again in a moment."],["MAIN_CHECKOUT_DIRTY","These files are on another branch. Switch them back to main yourself."],["ROOM_REPO_GIT_UNAVAILABLE","Room files need git, and git isn’t installed on this computer."],["ROOM_HAS_NO_REPO","This room no longer has its own files."],["ROOM_REPOS_DISABLED","Room files are turned off on this install."]]);function $n({roomId:t}){var I,$;const n=ne(),r=oe(),m=ce(Qe(n,t)),[f,g]=a.useState([]),[s,p]=a.useState(!1),[o,i]=a.useState(null),d=Be({mutationFn:v=>n.repairRoomMain(t,v),onSuccess:()=>{g([]),p(!1),i(null),r.invalidateQueries({queryKey:je.repoStatus(t)})},onError:v=>{p(!1);const u=In.get(Pe(v)??"");i(u??"Couldn’t update the files. Try again in a moment."),r.invalidateQueries({queryKey:je.repoStatus(t)})}});if(((I=m.data)==null?void 0:I.kind)==="unavailable")return e.jsx("p",{role:"alert","data-slot":"room-main-warning",className:"border-border/60 text-muted-foreground rounded-lg border px-3 py-2.5 text-xs",children:"Couldn’t check this room’s files. Saves may not work. Try again soon."});const R=(($=m.data)==null?void 0:$.kind)==="ok"?m.data.status.main:void 0;if(R===void 0||!R.dirty)return null;const F=R.branch!=="main",E=f.filter(v=>R.strays.some(u=>u.path===v)),_=s&&E.length>0,b=v=>g(u=>u.includes(v)?u.filter(x=>x!==v):[...u,v]);return e.jsxs("div",{"data-slot":"room-main-warning",className:"border-border/60 bg-muted/40 space-y-3 rounded-lg border px-3 py-2.5 text-sm",children:[e.jsxs("div",{className:"flex gap-2",children:[e.jsx(Ft,{className:"text-muted-foreground mt-0.5 size-(--size-icon-sm) flex-shrink-0"}),e.jsxs("div",{className:"min-w-0 space-y-1",children:[e.jsxs("div",{role:"alert",className:"space-y-1",children:[e.jsx("p",{className:"font-medium",children:"Somebody changed this room’s files outside DorkOS"}),F?e.jsxs(e.Fragment,{children:[e.jsx("p",{className:"text-muted-foreground text-xs",children:`This room’s files are on ${R.branch??"no branch"}, not main.`}),e.jsx("p",{className:"text-muted-foreground text-xs",children:"Saves and agent merges wait until they’re back on main."})]}):e.jsx("p",{className:"text-muted-foreground text-xs",children:"Saves and agent merges wait until you keep or discard these."})]}),F&&e.jsx(sn,{className:"text-xs",children:e.jsx("p",{children:"DorkOS won’t switch the branch for you. There may be work on it."})})]})]}),!F&&e.jsxs(e.Fragment,{children:[e.jsx("ul",{className:"space-y-1.5",children:R.strays.map(v=>e.jsxs("li",{className:"flex items-center gap-2",children:[e.jsx(Ot,{id:`stray-${t}-${v.path}`,checked:E.includes(v.path),onCheckedChange:()=>b(v.path),disabled:d.isPending}),e.jsx("label",{htmlFor:`stray-${t}-${v.path}`,className:"min-w-0 flex-1 cursor-pointer truncate font-mono text-xs",title:v.path,children:v.path}),e.jsx("span",{className:"text-muted-foreground flex-shrink-0 text-xs",children:zn[v.kind]})]},v.path))}),R.strayCount>R.strays.length&&e.jsxs("p",{className:"text-muted-foreground text-xs",children:["…and ",R.strayCount-R.strays.length," more not shown. “Keep them all” keeps these too."]}),_?e.jsxs("div",{className:"space-y-2",children:[e.jsx("p",{className:"text-xs",children:E.length===1?"Discard this change? It can’t be undone.":`Discard these ${E.length} changes? They can’t be undone.`}),e.jsxs("div",{className:"flex flex-wrap gap-2",children:[e.jsx(Y,{type:"button",variant:"ghost",size:"sm",disabled:d.isPending,onClick:()=>p(!1),children:"Cancel"}),e.jsx(Y,{type:"button",variant:"destructive",size:"sm",disabled:d.isPending,onClick:()=>d.mutate({action:"discard",paths:[...E]}),children:E.length===1?"Discard change":`Discard ${E.length} changes`})]})]}):e.jsxs("div",{className:"flex flex-wrap gap-2",children:[e.jsx(Y,{type:"button",variant:"outline",size:"sm",disabled:d.isPending,onClick:()=>d.mutate({action:"commit"}),children:"Keep them all"}),e.jsx(Y,{type:"button",variant:"ghost",size:"sm",disabled:d.isPending||E.length===0,onClick:()=>p(!0),children:E.length===0?"Discard…":`Discard ${E.length}`})]})]}),o!==null&&e.jsx("p",{role:"alert",className:"text-destructive text-xs",children:o})]})}const Ne="pointer-coarse:size-11",Kn=new Map([["ROOM_REPOS_DISABLED","Room files are turned off for this DorkOS."],["ROOM_REPO_GIT_UNAVAILABLE","Git isn’t available on this computer."],["MERGE_IN_FLIGHT","This room’s files are busy. Try again."],["ROOM_ARCHIVED","Bring this room back before setting up files."],["OPERATOR_ONLY","Only the owner can set up room files."]]);function Hn(t){const n=Kn.get(Pe(t)??"");return n||(t instanceof TypeError||t instanceof Error&&/fetch|offline|network/i.test(t.message)?"You’re offline. Try again when this computer reconnects.":"Couldn’t set up files. Try again.")}function as({roomId:t,canChange:n,canSetUp:r=!1}){const m=ne(),f=oe(),g=U(v=>v.showHidden),[s,p]=a.useState(null),[o,i]=a.useState(!1),d=a.useMemo(()=>We({transport:m,queryClient:f,roomId:t,canChange:n}),[m,f,t,n]),R=we(d,Q,g,f),F=ce(R),E=Be({mutationFn:async()=>{try{return await m.enableRoomRepo(t)}catch(v){if(Pe(v)==="ROOM_REPO_EXISTS")return null;throw v}},onSuccess:async()=>{i(!1),await Promise.all([f.invalidateQueries({queryKey:R.queryKey}),f.invalidateQueries({queryKey:je.repoStatus(t)})])}}),_=F.isSuccess&&F.data.absent===!0,b=F.isSuccess&&!_||F.isError,[I,$]=a.useState(null);if(b&&I!==t&&$(t),!b&&I!==t&&!_)return null;if(_){if(!r)return null;const v=E.isError?Hn(E.error):null;return e.jsxs("section",{"aria-label":"Room files",className:"space-y-2",children:[e.jsxs("header",{className:"flex items-center gap-2",children:[e.jsx(Le,{className:"text-muted-foreground size-(--size-icon-sm) shrink-0"}),e.jsx("h3",{className:"text-muted-foreground text-xs font-medium tracking-wide uppercase",children:"Files"})]}),e.jsxs("div",{className:"border-border/60 flex items-center justify-between gap-3 rounded-lg border px-3 py-2.5",children:[e.jsx("p",{className:"text-muted-foreground text-sm",children:"This room has no shared files."}),e.jsx(Y,{type:"button",size:"sm",variant:"outline",className:"shrink-0 pointer-coarse:min-h-11",onClick:()=>{E.reset(),i(!0)},children:"Set up files…"})]}),v!==null&&e.jsx("p",{role:"alert",className:"text-status-danger text-xs",children:v}),e.jsx(de,{open:o,onOpenChange:i,children:e.jsxs(ue,{className:"max-sm:top-auto max-sm:bottom-0 max-sm:translate-y-0 max-sm:rounded-b-none",children:[e.jsxs(fe,{children:[e.jsx(he,{children:"Set up files for this room?"}),e.jsx(pe,{children:"This creates shared files and ROOM.md for everyone here. It can’t be undone."})]}),v!==null&&e.jsx("p",{role:"alert",className:"text-status-danger text-sm",children:v}),e.jsxs(me,{children:[e.jsx(xe,{className:"pointer-coarse:min-h-11",children:"Cancel"}),e.jsxs(ge,{className:"pointer-coarse:min-h-11",disabled:E.isPending,onClick:u=>{u.preventDefault(),E.mutate()},children:[E.isPending&&e.jsx(Pt,{className:"animate-spin"}),E.isPending?"Setting up…":"Set up files"]})]})]})})]})}return e.jsxs("section",{"aria-label":"Room files",className:"space-y-2",children:[e.jsxs("header",{className:"flex items-center gap-2",children:[e.jsx(Le,{className:"text-muted-foreground size-(--size-icon-sm) flex-shrink-0"}),e.jsx("h3",{className:"text-muted-foreground text-xs font-medium tracking-wide uppercase",children:"Files"}),e.jsx("div",{className:"min-w-0 flex-1",children:e.jsx(Ln,{roomId:t})}),n&&e.jsxs(e.Fragment,{children:[e.jsx(Y,{variant:"ghost",size:"icon-xs",className:Ne,"aria-label":"New file",title:"New file",disabled:s===null,onClick:()=>s==null?void 0:s.newFile(),children:e.jsx(st,{className:"text-muted-foreground"})}),e.jsx(Y,{variant:"ghost",size:"icon-xs",className:Ne,"aria-label":"New folder",title:"New folder",disabled:s===null,onClick:()=>s==null?void 0:s.newFolder(),children:e.jsx(qe,{className:"text-muted-foreground"})}),e.jsx(Y,{variant:"ghost",size:"icon-xs",className:Ne,"aria-label":"Upload files",title:"Upload files",disabled:(s==null?void 0:s.upload)===void 0,onClick:()=>{var v;return(v=s==null?void 0:s.upload)==null?void 0:v.call(s)},children:e.jsx(rn,{className:"text-muted-foreground"})})]}),e.jsx(it,{})]}),e.jsx($n,{roomId:t}),e.jsx("div",{"data-slot":"room-files-body",className:"border-border/60 h-72 overflow-hidden rounded-lg border",children:e.jsx(Mn,{source:d,onCommands:p})})]})}function rs({roomId:t,attachment:n}){var i;const r=ne(),m=oe(),f=a.useMemo(()=>We({transport:r,queryClient:m,roomId:t}),[r,m,t]),g=ce(we(f,Q,!1,m)),[s,p]=a.useState(!1),o=Mt(t);return!g.isSuccess||g.data.absent===!0||((i=o.data)==null?void 0:i.archived)!==!1?null:e.jsxs(e.Fragment,{children:[e.jsx(Y,{type:"button",variant:"ghost",size:"icon-xs","aria-label":`Save ${n.name} to the room’s files`,title:"Save to room files",className:"text-muted-foreground hover:text-foreground mt-0.5 pointer-coarse:size-11",onClick:()=>p(!0),children:e.jsx(_t,{})}),s&&e.jsx(Un,{roomId:t,source:f,attachment:n,onClose:()=>p(!1)})]})}function Un({roomId:t,source:n,attachment:r,onClose:m}){const f=ne(),g=oe(),[s,p]=a.useState(Q),[o,i]=a.useState(r.name),[d,R]=a.useState(null),[F,E]=a.useState(!1),_=a.useId(),b=ce(we(n,s,!1,g)),I=a.useMemo(()=>{var v;return rt(((v=b.data)==null?void 0:v.entries)??[]).filter(u=>u.type==="dir")},[b.data]),$=async()=>{var u,x;const v=o.trim();if(v!==""){E(!0),R(null);try{await f.saveAttachmentToRoomFiles(t,{attachmentId:r.id,dir:s,name:v,baseCommit:((u=b.data)==null?void 0:u.commit)??null}),g.invalidateQueries({queryKey:["file-explorer","tree",n.scopeKey]}),Z.success(`Saved ${v} to the room’s files`),m()}catch(w){let j;try{j=Vt(w,g,t)}catch{j={status:"refused",reason:Ye(w)??"Couldn’t save. Try again in a moment."}}if(j.status==="exists"){const D=(((x=b.data)==null?void 0:x.entries)??[]).map(H=>H.name);R({reason:`This folder already has a file called “${v}”. Pick another name.`,suggestion:Me({name:v,isDir:!1,taken:[...D,v]})})}else j.status==="conflict"?(R({reason:"This folder changed while you chose, so nothing was saved. Try again."}),b.refetch()):j.status==="refused"&&R({reason:j.reason})}finally{E(!1)}}};return e.jsx(At,{open:!0,onOpenChange:v=>!v&&m(),children:e.jsxs(Lt,{className:"sm:max-w-md",children:[e.jsxs(zt,{children:[e.jsx(It,{children:"Save to room files"}),e.jsx($t,{children:"Everyone in the room, and their agents, can find it there."})]}),e.jsxs(Kt,{className:"space-y-3",children:[e.jsxs("div",{className:"space-y-1",children:[e.jsx("p",{className:"text-muted-foreground text-xs font-medium",children:"Folder"}),e.jsxs("div",{role:"group","aria-label":"Folders",className:"border-border/60 max-h-56 overflow-auto rounded-md border",children:[e.jsx("p",{className:"bg-muted/40 truncate px-3 py-1.5 font-mono text-xs",children:s===Q?"Top folder":`${s}/`}),s!==Q&&e.jsx(Ke,{label:"Up one folder",icon:e.jsx(an,{className:"text-muted-foreground size-(--size-icon-sm)"}),onClick:()=>p(W(s))}),b.isPending?e.jsx("div",{className:"flex h-12 items-center justify-center",children:e.jsx(Fe,{size:"sm",className:"text-muted-foreground",label:"Loading folders"})}):I.length===0?e.jsx("p",{className:"text-muted-foreground px-3 py-2 text-xs",children:"No folders in here."}):I.map(v=>e.jsx(Ke,{label:v.name,icon:e.jsx(be,{className:"size-(--size-icon-sm) text-sky-500"}),chevron:!0,onClick:()=>p(ee(s,ie(v.path)))},v.path))]})]}),e.jsxs("div",{className:"space-y-1",children:[e.jsx("label",{htmlFor:_,className:"text-muted-foreground text-xs font-medium",children:"Name"}),e.jsx(Ht,{id:_,value:o,onChange:v=>{i(v.target.value),R(null)},spellCheck:!1,autoComplete:"off"})]}),d!==null&&e.jsxs("div",{role:"alert",className:"text-destructive space-y-1 text-xs",children:[e.jsx("p",{children:d.reason}),d.suggestion!==void 0&&e.jsxs(Y,{type:"button",variant:"outline",size:"xs",onClick:()=>{i(d.suggestion),R(null)},children:["Use “",d.suggestion,"”"]})]})]}),e.jsxs(Ut,{className:"gap-2",children:[e.jsx(Y,{type:"button",variant:"ghost",onClick:m,children:"Cancel"}),e.jsx(Y,{type:"button",disabled:F||o.trim()===""||b.isPending,onClick:()=>void $(),children:F?"Saving…":s===Q?"Save to the top folder":`Save to ${ie(s)}`})]})]})})}function Ke({label:t,icon:n,chevron:r=!1,onClick:m}){return e.jsxs("button",{type:"button",onClick:m,className:"hover:bg-accent/50 focus-visible:bg-accent flex w-full items-center gap-2 px-3 py-1.5 text-left text-sm outline-none",children:[n,e.jsx("span",{className:"min-w-0 flex-1 truncate",children:t}),r&&e.jsx(Ue,{className:"text-muted-foreground size-3.5"})]})}export{Mn as FileExplorer,ss as FileExplorerActions,Yt as FilePreviewDialog,on as HIDDEN_ENTRY_NAMES,it as HiddenEntriesToggle,ls as NO_PROVENANCE,Re as PINNED_ENTRY_NAMES,cs as ROOM_FILES_REFRESH_INTERVAL_MS,as as RoomFilesSection,rs as SaveToRoomFilesButton,We as createRoomFilesSource,yn as createSessionCwdSource,le as explorerDirQueryKey,we as explorerDirQueryOptions,ln as isHiddenEntryName,Se as isPinnedEntryName,cn as pinnedFirst,Gt as provenanceLine,Qe as roomRepoStatusQueryOptions,rt as withoutHidden};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{C as m,a as x,c as h}from"./use-status-budget-
|
|
1
|
+
import{C as m,a as x,c as h}from"./use-status-budget-UccdTZ7o.js";import{A as xe,b as he,d as pe,e as fe,G as ge,M as je,f as Se,P as be,g as ve,R as ke,h as Ne,S as Ce,i as Ie,j as we,U as Pe,W as ye,k as Me,l as Re,m as Ae,n as Te,o as Ue,p as De,r as Ee,s as Ge,q as Le,u as Oe,t as $e,v as Be,w as qe,x as Fe,y as _e,z as ze}from"./use-status-budget-UccdTZ7o.js";import{cu as p,j as s,l as f,B as g,cm as j,cw as S,aY as b,cx as v,cy as t,G as k,cz as r,cA as N,cB as C,cC as I,r as l,cD as w,_ as P}from"./index-DwrBsA10.js";import{cE as Qe,cF as Ve,cG as Ke,cH as We,cI as Je,cJ as Ye,cK as Xe,cL as Ze,cM as es,cN as ss,cO as ts,cP as ns,cQ as as,cR as os,cS as rs,cT as is,cU as cs,cV as ls}from"./index-DwrBsA10.js";import{f as y}from"./format-duration-BCr6uzby.js";import{r as M}from"./composer-insert-BpyATrmR.js";import{S as R}from"./ConnectionAccessLists-CXsNyR4U.js";import"./git-branch-BXEb1Sqq.js";import"./use-update-config-D8g4P42J.js";import"./settings-for-runtime-BoOa-ZFG.js";import"./card-6VNSI3kT.js";import"./RuntimeSetupDialog-BDvzruM4.js";import"./inline-code-CNmpgW3O.js";import"./list-runtime-types-M5_gxIg1.js";import"./RuntimeConnectFlow-C_6ozpAK.js";import"./useMutationState-RYxTf1aD.js";import"./runtime-connect-Dn0T5YWv.js";import"./unverified-catalog-notice-BbK4SCJp.js";import"./layers-JgRwJGyf.js";import"./cpu-CjKJ8pVl.js";import"./access-copy-BegDAoeR.js";import"./query-error-state-s6AJaHa3.js";import"./empty-state-CbFKhqwB.js";const A="I need access to another service. Ask me which service and actions you need, then request only that access.";function T({sessionId:e}){const a=p(),o=s.jsx(g,{variant:"secondary",size:"sm","data-testid":`ask-agent-for-connection-${e}`,onClick:()=>M(A),children:"Ask your agent"});return s.jsx(R,{sessionId:e,onManage:()=>void a({...f.connections()}),emptyAction:o,footer:s.jsx("div",{className:"pt-1",children:o})})}const U=1e3;function ue(){const[e]=j(),a=S(e??""),o=b(n=>n.rightPanelOpen);return e?s.jsx(D,{diagnostics:a,live:o,connectors:s.jsx(T,{sessionId:e})}):s.jsx("div",{className:"text-muted-foreground flex h-full items-center justify-center p-6 text-center text-xs",children:"Open a chat to inspect it."})}function D({diagnostics:e,live:a=!0,connectors:o}){return s.jsxs("div",{"data-slot":"session-inspector",className:"flex h-full min-w-0 flex-col gap-4 overflow-y-auto p-3",children:[s.jsx(E,{diagnostics:e,live:a}),s.jsx(G,{diagnostics:e}),s.jsx(L,{diagnostics:e}),s.jsx(O,{diagnostics:e}),o,s.jsxs("div",{className:"mt-auto pt-2",children:[s.jsx(v,{className:"mb-2"}),s.jsx(m,{diagnostics:e,className:"w-full justify-center"})]})]})}function E({diagnostics:e,live:a}){const o=F(e.lastEventAt,a),n=x[e.connectionState];return s.jsxs(c,{label:"Live",children:[s.jsx(t,{label:"Live updates",children:s.jsxs("span",{className:"inline-flex items-center gap-1.5",children:[s.jsx("span",{"aria-hidden":!0,className:k("inline-block size-1.5 rounded-full",n.color,n.tasks&&"animate-breath")}),n.shortLabel]})}),s.jsx(t,{label:"Turn",children:$(e)}),s.jsx(t,{label:"Last event",children:e.lastEventSeq===0?"none yet":`seq ${e.lastEventSeq}`}),s.jsx(t,{label:"Resumed from",children:e.snapshotCursor===null?"not hydrated":`cursor ${e.snapshotCursor}`}),s.jsx(t,{label:"Last update",children:o===null?"—":`${y(o)} ago`}),s.jsx(t,{label:"Queued messages",children:String(e.queueDepth)})]})}function G({diagnostics:e}){return s.jsxs(c,{label:"Resolved",children:[s.jsx(t,{label:"Directory",wrap:!0,children:e.cwd??"—"}),s.jsx(t,{label:"Git",children:q(e.git)}),s.jsx(t,{label:"Runs on",children:e.runtime??"—"}),s.jsx(t,{label:"Model",wrap:!0,children:e.model??"—"}),e.selectedModel!==null&&e.selectedModel!==e.model&&s.jsx(t,{label:"Model selected",children:e.selectedModel}),s.jsx(t,{label:"Effort",children:e.effort??"—"}),s.jsx(t,{label:"Fast mode",children:e.fastMode?"on":"off"}),s.jsx(t,{label:"Permissions",children:e.permissionMode}),s.jsx(t,{label:"Chat ID",wrap:!0,children:e.sessionId}),s.jsx(t,{label:"DorkOS version",children:e.clientVersion??"—"})]})}function L({diagnostics:e}){var o;const a=(((o=e.contextUsage)==null?void 0:o.categories)??[]).filter(n=>n.tokens>0).sort((n,i)=>i.tokens-n.tokens);return s.jsxs(c,{label:"Usage",children:[s.jsx(t,{label:"Context",children:e.contextPercent===null?"—":`${e.contextPercent}% full`}),e.contextUsage&&s.jsxs(t,{label:"Tokens",children:[r(e.contextUsage.totalTokens)," / ",r(e.contextUsage.maxTokens)]}),a.map(n=>s.jsx(t,{label:n.name,indent:!0,swatch:n.color,"data-testid":`context-category-${n.name}`,children:r(n.tokens)},n.name)),e.cache===null?s.jsx(t,{label:"Cache",children:"nothing cached yet"}):s.jsxs(s.Fragment,{children:[s.jsx(t,{label:"Cache hit",children:`${h(e.cache)}%`}),s.jsx(t,{label:"Cache read",indent:!0,children:r(e.cache.readTokens)}),s.jsx(t,{label:"Cache written",indent:!0,children:r(e.cache.creationTokens)})]}),e.usage!==null&&N(e.usage)?s.jsx("div",{className:"pt-1",children:s.jsx(C,{usage:e.usage})}):s.jsx(t,{label:"Usage & cost",children:"no usage reported"})]})}function O({diagnostics:e}){const{running:a,finished:o}=I(e.activeSubagents);return s.jsxs(c,{label:"Subagents",children:[s.jsx(t,{label:"Running",children:B(a.length,e.runningSubagentCount)}),a.map(n=>s.jsx(u,{subagent:n},n.taskId)),o.length>0&&s.jsxs(s.Fragment,{children:[s.jsx(t,{label:"Finished this turn",children:String(o.length)}),o.map(n=>s.jsx(u,{subagent:n},n.taskId))]}),s.jsx(t,{label:"Available",children:e.subagents.length===0?"none":e.subagents.map(n=>n.name).join(", ")})]})}function u({subagent:e}){return s.jsxs("div",{"data-testid":`active-subagent-${e.taskId}`,"data-status":e.status,className:"space-y-0.5 py-1",children:[s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx(w,{className:"text-muted-foreground size-3.5 shrink-0","aria-hidden":!0}),s.jsx("span",{className:"min-w-0 flex-1 truncate",children:e.description??e.taskId}),s.jsx(P,{size:"xs",variant:"secondary",className:"shrink-0",children:e.status})]}),s.jsxs("p",{className:"text-muted-foreground text-3xs pl-5 leading-tight",children:[e.toolUses??0," tool",e.toolUses===1?"":"s",e.lastToolName?` · last ${e.lastToolName}`:""]})]})}function c({label:e,children:a}){return s.jsxs("section",{className:"min-w-0",children:[s.jsx("h3",{className:"text-muted-foreground px-1 pb-1 text-xs font-medium tracking-wide uppercase",children:e}),s.jsx("div",{className:"space-y-1 px-1 text-xs",children:a})]})}function $(e){return e.triggerPending?"sending":e.streaming?"streaming":e.lifecycle??"not hydrated"}function B(e,a){const o=e===0?"none":String(e);return a===null||a===e?o:`${o} · server says ${a}`}function q(e){return e.state==="unknown"?"—":e.state==="no-repo"?"no repo":e.dirty?`${e.branch} · changed`:`${e.branch} · clean`}function F(e,a){const[o,n]=l.useState(()=>Date.now());return l.useEffect(()=>{if(e===null||!a)return;const i=()=>n(Date.now());i();const d=setInterval(i,U);return()=>clearInterval(d)},[e,a]),e===null?null:Math.max(0,o-e)}export{Qe as AccountBadge,Ve as AccountBadgeView,Ke as AccountItem,We as AccountMenuRow,Je as AccountPopover,Ye as AccountTrigger,xe as AutoModeConfirmDialog,he as ConnectionItem,pe as ContextItem,fe as CwdItem,ge as GitStatusItem,je as MakeDefaultStopLine,Se as ModelConfigPopover,be as PermissionModeItem,ve as PlanModeItem,ke as ReadOnlyModeNotice,Ne as RuntimeItem,ue as SessionInspector,Ce as SessionPopover,D as SessionReadout,Ie as StatusLine,we as SubagentsItem,Pe as UsageRevealPopover,Xe as UsageStatusItem,ye as WifiTurnCapPill,Ze as accountChipPromotion,Me as applyStatusBudget,es as canOfferContinue,ss as chipToneFor,Re as evaluateExtensionStatusItems,ts as formatCost,Ae as formatDiagnostics,Te as gitPromotionState,N as hasRenderableUsage,ns as isGitStatusOk,Ue as isPhoneDensity,De as isUsageAbsorbed,I as partitionSubagents,Ee as resolveStatusBudget,Ge as selectPromotedItems,as as showsStaleMark,Le as statusModelLabel,Oe as useExtensionStatusItems,os as useGitStatus,$e as useMakeDefaultStop,Be as useReadOnlyModeHint,rs as useResolvedSessionRuntime,is as useRuntimeChip,cs as useSessionAccount,S as useSessionDiagnostics,ls as useSessionPermissionPicker,qe as useSessionPopoverShortcut,Fe as useStatusBarPins,_e as useStatusBudget,ze as useStatusUsage};
|