dorkos 0.123.0 → 0.124.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/bin/cli.js +1688 -837
- package/dist/browser/native/package-manifest.json +1 -1
- package/dist/browser/source-manifest.json +1 -1
- package/dist/client/assets/{AboutPage-BmtoPqP9.js → AboutPage-DHaZvsJE.js} +1 -1
- package/dist/client/assets/{ActivityErrorState-CEzdFJiR.js → ActivityErrorState-BP-qFk2S.js} +1 -1
- package/dist/client/assets/{ActivityPage-mFYgTr3e.js → ActivityPage-Bme3TzdQ.js} +1 -1
- package/dist/client/assets/{ActivityRow-Bkc0kkim.js → ActivityRow-BRZyW9MA.js} +1 -1
- package/dist/client/assets/{AdapterIcon-DVgTrgnM.js → AdapterIcon-BcfquTja.js} +1 -1
- package/dist/client/assets/{AdapterSetupWizard-I03EluU5.js → AdapterSetupWizard-B4I23pBg.js} +2 -2
- package/dist/client/assets/{AgentOptionRow-DI1TzLaR.js → AgentOptionRow-Cb34LtmH.js} +1 -1
- package/dist/client/assets/{AgentPicker-CBYeBzjf.js → AgentPicker-ouNRFSDh.js} +1 -1
- package/dist/client/assets/{AgentRequestCard-DQ6GYoeE.js → AgentRequestCard-B6MHIsxa.js} +3 -3
- package/dist/client/assets/{AppearancePage-62xIPNPn.js → AppearancePage-CutehigK.js} +1 -1
- package/dist/client/assets/ApplyToOverridesDialog-B-wIUI27.js +1 -0
- package/dist/client/assets/{AttentionSignalRow-Coe5pYX6.js → AttentionSignalRow-B1aMjgX_.js} +1 -1
- package/dist/client/assets/{BaseTanStackRouterDevtoolsPanel-B-iktbLX-D07cg75s.js → BaseTanStackRouterDevtoolsPanel-B-iktbLX-CdWF4WLz.js} +1 -1
- package/dist/client/assets/{BindingDialog-DVyxVXZM.js → BindingDialog-BAdueON5.js} +1 -1
- package/dist/client/assets/{BlintzCanvas-BmfkiUQJ.js → BlintzCanvas-b30dG4gx.js} +3 -3
- package/dist/client/assets/{CanvasCsvContent-CRTr-AI7.js → CanvasCsvContent-DGHgSikG.js} +1 -1
- package/dist/client/assets/{CanvasFileContent-rOmY1s3T.js → CanvasFileContent-D1bFaUeh.js} +2 -2
- package/dist/client/assets/{CanvasModel3dContent-D7oRT6ey.js → CanvasModel3dContent-dST7g1v2.js} +2 -2
- package/dist/client/assets/{ChatAppsOff-BmuOTq83.js → ChatAppsOff-DiObvmJS.js} +1 -1
- package/dist/client/assets/{CodeMirrorDiff-DidSWwYJ.js → CodeMirrorDiff-BncI1OY1.js} +1 -1
- package/dist/client/assets/{CodeMirrorEditor-BUAWGbRo.js → CodeMirrorEditor-DV6psv19.js} +1 -1
- package/dist/client/assets/{CommitmentList-uK4CKaz0.js → CommitmentList-Dx_Ek_Gl.js} +1 -1
- package/dist/client/assets/{CommitmentsPage-BWITH1r2.js → CommitmentsPage-Bca8NMUa.js} +1 -1
- package/dist/client/assets/{ComputerResourceView-adgF_EZU.js → ComputerResourceView-DNVNFTdn.js} +1 -1
- package/dist/client/assets/{ComputerViewer-D87LhxwL.js → ComputerViewer-D8SxJdMm.js} +1 -1
- package/dist/client/assets/{ConnectionAccessLists-BFEFqcSZ.js → ConnectionAccessLists-Bhj1YT15.js} +1 -1
- package/dist/client/assets/{ConnectionsPage-Cd_cLoSY.js → ConnectionsPage-B20JZxoK.js} +2 -2
- package/dist/client/assets/{ConventionPage-BSztD-gU.js → ConventionPage-De645wxU.js} +1 -1
- package/dist/client/assets/{ExtensionPageRoute-BSge6XRv.js → ExtensionPageRoute-nTeiOBRQ.js} +2 -2
- package/dist/client/assets/{FloatingTanStackRouterDevtools-CqogiFob-TO2CUPG0.js → FloatingTanStackRouterDevtools-CqogiFob-DM79UITv.js} +1 -1
- package/dist/client/assets/HandlePage-B08V-om7.js +1 -0
- package/dist/client/assets/{HeartbeatPage-DIJzdOhj.js → HeartbeatPage-CBoUxz6t.js} +1 -1
- package/dist/client/assets/{KeyEntry-DJnzW3Mu.js → KeyEntry-Cug8ocpX.js} +1 -1
- package/dist/client/assets/{LexicalField-BxzNvIjJ.js → LexicalField-Bv_ogmAq.js} +1 -1
- package/dist/client/assets/{ManagesPage-BQj8KbYA.js → ManagesPage-DfJBQKK3.js} +1 -1
- package/dist/client/assets/{Marketplace-CIG5_a_H.js → Marketplace-swCVUbdY.js} +2 -2
- package/dist/client/assets/{MarketplaceSourcesView-16HKvFK-.js → MarketplaceSourcesView-CDZDChpV.js} +1 -1
- package/dist/client/assets/{McpAppFrame-5xlga1jD.js → McpAppFrame-BM9cNPPd.js} +1 -1
- package/dist/client/assets/McpSigninBody-DKyUKrEE.js +1 -0
- package/dist/client/assets/{Model3dViewer-CQ0sA_kr.js → Model3dViewer-rXSL5y2P.js} +1 -1
- package/dist/client/assets/NamePage-JwMDK1JD.js +1 -0
- package/dist/client/assets/{NewDirectMessageMenu-D092y0K9.js → NewDirectMessageMenu-GCEMS5oV.js} +1 -1
- package/dist/client/assets/{NotificationsPage-CskOPdhh.js → NotificationsPage-DSWsOVLa.js} +1 -1
- package/dist/client/assets/{OpenMeshSwitch-BHRm328L.js → OpenMeshSwitch-BTuctDj4.js} +2 -2
- package/dist/client/assets/OperatorIdentityForm-ODDMd2YN.js +1 -0
- package/dist/client/assets/PermissionHistory-41a58Se7.js +1 -0
- package/dist/client/assets/{PermissionsPage-XuPOSYll.js → PermissionsPage-DefmymZ6.js} +1 -1
- package/dist/client/assets/{PersonalityPopover-BrZjxakx.js → PersonalityPopover-7zPVBI1I.js} +1 -1
- package/dist/client/assets/PhotoPage-DlOVhkW9.js +1 -0
- package/dist/client/assets/{PreviewRefusedNotice-BANdpT9O.js → PreviewRefusedNotice-CwGlBJ7U.js} +1 -1
- package/dist/client/assets/{ProfileFields-Dp68ebW9.js → ProfileFields-DVMkpJSb.js} +1 -1
- package/dist/client/assets/{ProfilePanelContainer-BKwGdI90.js → ProfilePanelContainer-RrhoPD3T.js} +1 -1
- package/dist/client/assets/{ProfileRolePicker-ClOdfLda.js → ProfileRolePicker-CXRVBCAu.js} +1 -1
- package/dist/client/assets/{PromptSuggestionChips-zcW4UJ_O.js → PromptSuggestionChips-bBroJdTi.js} +1 -1
- package/dist/client/assets/{ReportsToPopover-BwDVGqFg.js → ReportsToPopover-CfPatsWM.js} +1 -1
- package/dist/client/assets/{RoomSurface-CSKIvyHH.js → RoomSurface-CdgCdV6h.js} +10 -10
- package/dist/client/assets/{RoomsPage-CAvrRbPk.js → RoomsPage-C3dDp1Mb.js} +1 -1
- package/dist/client/assets/{RunsOnPopover-CQ4t9EZ-.js → RunsOnPopover-BcKjfQi-.js} +1 -1
- package/dist/client/assets/{RuntimeConnectFlow--fVpIf0B.js → RuntimeConnectFlow-DCIRnvOH.js} +1 -1
- package/dist/client/assets/{RuntimeSetupDialog-COpyPrqL.js → RuntimeSetupDialog-Bg-0b-LC.js} +1 -1
- package/dist/client/assets/SeenDevices-nMsGUQTv.js +19 -0
- package/dist/client/assets/{SessionsPage-FDyYzuXs.js → SessionsPage-Cqfx4FGW.js} +1 -1
- package/dist/client/assets/SettingsDialog-C8r2igJ_.js +12 -0
- package/dist/client/assets/{SkillsPage-PLXEY0LB.js → SkillsPage-BleHQavF.js} +1 -1
- package/dist/client/assets/TaskDialogWrapper-BhTEvf-u.js +1 -0
- package/dist/client/assets/{TasksEmptyState-8RZxhRh6.js → TasksEmptyState-Bprx1k8M.js} +2 -2
- package/dist/client/assets/{TasksPage-C-EtQXKb.js → TasksPage-Dub39yEJ.js} +1 -1
- package/dist/client/assets/{TeamComputerEntry-qx_19Htj.js → TeamComputerEntry-CJ-NG0u5.js} +1 -1
- package/dist/client/assets/ToolsPage-IsD6M-ZW.js +2 -0
- package/dist/client/assets/{TopologyGraph-1wtG1BE9.js → TopologyGraph-CwyasvFI.js} +2 -2
- package/dist/client/assets/{TourHost-C664E8OY.js → TourHost-BYfztuPb.js} +1 -1
- package/dist/client/assets/{UnlinkDialog-Di1oBFA_.js → UnlinkDialog-BKhgxVdF.js} +1 -1
- package/dist/client/assets/{WidgetErrorCard-BfgGzyqg.js → WidgetErrorCard-1NyzIJBj.js} +7 -7
- package/dist/client/assets/_shell-Ct2Bz7D0.js +80 -0
- package/dist/client/assets/{_shell._home-Hz78BY6-.js → _shell._home-xWj7wO5z.js} +1 -1
- package/dist/client/assets/{_shell._home.activity-BxvI0gkw.js → _shell._home.activity-BqcLoaB1.js} +1 -1
- package/dist/client/assets/{_shell._home.index-Cqq81f3P.js → _shell._home.index-D4sQsKKk.js} +1 -1
- package/dist/client/assets/{_shell._home.tasks-Cth56CwC.js → _shell._home.tasks--UhQB6h3.js} +1 -1
- package/dist/client/assets/{_shell._home.workspaces-DkoOJSWz.js → _shell._home.workspaces-BPFD8Of2.js} +1 -1
- package/dist/client/assets/_shell.channels-CnFdvRzc.js +10 -0
- package/dist/client/assets/_shell.connections-Ik01wS5M.js +1 -0
- package/dist/client/assets/{_shell.feedback-requests-BTxHdsfb.js → _shell.feedback-requests-Czu42kzo.js} +2 -2
- package/dist/client/assets/_shell.marketplace-Cezv-i16.js +1 -0
- package/dist/client/assets/_shell.marketplace_.sources-BTENmr4W.js +1 -0
- package/dist/client/assets/_shell.session-BjevHF_O.js +63 -0
- package/dist/client/assets/{_shell.team-ZxGwa39m.js → _shell.team-UfaJqohh.js} +4 -4
- package/dist/client/assets/_shell.x._extensionId-0OO_Xr72.js +1 -0
- package/dist/client/assets/_shell.x._extensionId_._-0OO_Xr72.js +1 -0
- package/dist/client/assets/{abnfDiagram-WEYOIA3C-CzqPVMdw.js → abnfDiagram-WEYOIA3C-oxkfGyl6.js} +1 -1
- package/dist/client/assets/{access-copy-Dj09Xk4b.js → access-copy-Dggxx2cX.js} +1 -1
- package/dist/client/assets/{arc-Bgy7ExYl.js → arc-CqQdP0Qe.js} +1 -1
- package/dist/client/assets/{architectureDiagram-ZHVYKT53-DYfb2p9r.js → architectureDiagram-ZHVYKT53-89xM7zJD.js} +1 -1
- package/dist/client/assets/{banner-dlsHTWSf.js → banner-DqJ2pM0Y.js} +1 -1
- package/dist/client/assets/{blockDiagram-RJAE7QA3-BkOzLL8s.js → blockDiagram-RJAE7QA3-CcxwDmZC.js} +1 -1
- package/dist/client/assets/{c4Diagram-XDPPPE54-CsZm4qpD.js → c4Diagram-XDPPPE54-DCIhIyXa.js} +1 -1
- package/dist/client/assets/{card-Dj6ZfRgu.js → card-DT-vFAns.js} +1 -1
- package/dist/client/assets/channel-Ngk70nQZ.js +1 -0
- package/dist/client/assets/{chunk-2E7WHVMD-GA96Jfps.js → chunk-2E7WHVMD-BfWEXcCj.js} +1 -1
- package/dist/client/assets/{chunk-2Q5K7J3B-CW2i0IkT.js → chunk-2Q5K7J3B-KLXLZXlR.js} +1 -1
- package/dist/client/assets/{chunk-4EMNKR2T-BwFvnPZg.js → chunk-4EMNKR2T-CL5Gttmj.js} +1 -1
- package/dist/client/assets/{chunk-55XCU76K-MOezzAAB.js → chunk-55XCU76K-cfAl84Mv.js} +1 -1
- package/dist/client/assets/{chunk-5VM5RSS4-woru6zOC.js → chunk-5VM5RSS4-BqUyGgoH.js} +1 -1
- package/dist/client/assets/{chunk-JWPE2WC7-CUrKlP2M.js → chunk-JWPE2WC7-BWr2ST9i.js} +1 -1
- package/dist/client/assets/{chunk-VQ5W62QI-CqZ2cdEu.js → chunk-VQ5W62QI-V5zYx50O.js} +1 -1
- package/dist/client/assets/{chunk-XXDRQBXY-ByAcvWaE.js → chunk-XXDRQBXY-gnvheN_J.js} +1 -1
- package/dist/client/assets/{chunk-ZCHMQSOR-3nkba9kj.js → chunk-ZCHMQSOR-ClGxxZvV.js} +2 -2
- package/dist/client/assets/{classDiagram-v2-4MYWR3UA-B-zZKAmI.js → classDiagram-v2-4MYWR3UA-DvmHzDb5.js} +1 -1
- package/dist/client/assets/{command-BAOEURY7.js → command-CNx4L11m.js} +1 -1
- package/dist/client/assets/{cose-bilkent-JH36ORCC-sCKxRv1H.js → cose-bilkent-JH36ORCC-Df8nXBRj.js} +1 -1
- package/dist/client/assets/{cpu-TtYQqONc.js → cpu-D8KJEkdh.js} +1 -1
- package/dist/client/assets/{cynefin-EF2NZ3EQ-CXzvL5Cg.js → cynefin-EF2NZ3EQ-CAn6ufHs.js} +1 -1
- package/dist/client/assets/{cynefinDiagram-WF24UDRP-C0wjhu9X.js → cynefinDiagram-WF24UDRP-Cep_NrRw.js} +1 -1
- package/dist/client/assets/{dagre-NK4GIZVX-Doi2IPkY.js → dagre-NK4GIZVX-sWD3z9wf.js} +1 -1
- package/dist/client/assets/{diagram-CBK3MWTC-11TVuPel.js → diagram-CBK3MWTC-CUpaBATr.js} +1 -1
- package/dist/client/assets/{diagram-I5XIIV2D-CJq7fHFM.js → diagram-I5XIIV2D-BejWB2ry.js} +1 -1
- package/dist/client/assets/{diagram-ODIL2UCW-2Ae6unuU.js → diagram-ODIL2UCW-BGKJfNk9.js} +1 -1
- package/dist/client/assets/{diagram-PFBEJUXE-BXza6_iz.js → diagram-PFBEJUXE-V0dP8H8k.js} +1 -1
- package/dist/client/assets/{diagram-RJA3I4VV-Z0i3uBW9.js → diagram-RJA3I4VV-Bf5dVsFX.js} +1 -1
- package/dist/client/assets/{diagram-TYUNFSNR-Dq_-g1oP.js → diagram-TYUNFSNR-CLrMSqb4.js} +1 -1
- package/dist/client/assets/{ebnfDiagram-V4P3TTPT-vxzIvg-W.js → ebnfDiagram-V4P3TTPT-BGG4CWA0.js} +1 -1
- package/dist/client/assets/{elk-QONTBCTQ-BBIXXtg_.js → elk-QONTBCTQ-bf9D6f0w.js} +1 -1
- package/dist/client/assets/{empty-state-kISAAp0z.js → empty-state-CDoXnrKn.js} +1 -1
- package/dist/client/assets/{erDiagram-KYQIGQAA-Bk2MeLBx.js → erDiagram-KYQIGQAA-fEUv-33P.js} +1 -1
- package/dist/client/assets/{execution-config-DYFe-VNC.js → execution-config-Ca9MDOtV.js} +1 -1
- package/dist/client/assets/{file-DEt4KgZG.js → file-CiyVL55_.js} +1 -1
- package/dist/client/assets/{file-exclamation-point-QqXJhXD9.js → file-exclamation-point-DaFRIKco.js} +1 -1
- package/dist/client/assets/{file-text-CRw31ZWd.js → file-text-DsnD-A8g.js} +1 -1
- package/dist/client/assets/{find-latest-widget-fence-B3aaiBNI.js → find-latest-widget-fence-CNsnCgbB.js} +1 -1
- package/dist/client/assets/{flowDiagram-IUGLLWBU-B53m4r8u.js → flowDiagram-IUGLLWBU-CRbeSDod.js} +1 -1
- package/dist/client/assets/{form-Bjhk9zOn.js → form-Cru78aT-.js} +1 -1
- package/dist/client/assets/{format-cron-9tmNIcgl.js → format-cron-9K38-tn1.js} +1 -1
- package/dist/client/assets/{ganttDiagram-R7GPNTJY-CS6TN3R1.js → ganttDiagram-R7GPNTJY-Mkk7zgs_.js} +1 -1
- package/dist/client/assets/{git-branch-DWerghmw.js → git-branch-CONwEYiR.js} +1 -1
- package/dist/client/assets/{gitGraphDiagram-PDYL7XHY-D096ZtqE.js → gitGraphDiagram-PDYL7XHY-Drre0vyA.js} +1 -1
- package/dist/client/assets/{graph-DQpTuPmX.js → graph-BJlnKWgo.js} +1 -1
- package/dist/client/assets/{heart-CRkjVW7-.js → heart-CqwUlIUG.js} +1 -1
- package/dist/client/assets/{highlighted-body-KPVGNVTW-DoVCXOMU.js → highlighted-body-KPVGNVTW-e4LXC_pS.js} +1 -1
- package/dist/client/assets/image-lightbox-DHDtzoja.js +1 -0
- package/dist/client/assets/{image-off-VyMBVwgK.js → image-off-DZuLkaRJ.js} +2 -2
- package/dist/client/assets/{index-DN2sTT2U.js → index-1yEXEZiH.js} +1 -1
- package/dist/client/assets/{index-BBcAekWE.js → index-A41zxoWk.js} +1 -1
- package/dist/client/assets/{index-CEVwhauU.js → index-B25gvCK_.js} +1 -1
- package/dist/client/assets/index-B9bZYNKR.js +1 -0
- package/dist/client/assets/{index-TnoaFCrj.js → index-BBmkfbXd.js} +1 -1
- package/dist/client/assets/{index-CvhR1oZB.js → index-BDD2EyoW.js} +1 -1
- package/dist/client/assets/{index-BcFMs7lK.js → index-BFNy-Yp3.js} +1 -1
- package/dist/client/assets/{index-CyGRWyhV.js → index-BIB-maE5.js} +1 -1
- package/dist/client/assets/{index-DBo2XfNv.js → index-BKp2B9JS.js} +1 -1
- package/dist/client/assets/index-BLP5O7X9.js +1 -0
- package/dist/client/assets/{index-2EaVZrJe.js → index-BTjZIgFn.js} +1 -1
- package/dist/client/assets/{index-DKWpwwxo.js → index-BV2Ezdxv.js} +1 -1
- package/dist/client/assets/{index-igLqtuoO.js → index-B_0LYi32.js} +1 -1
- package/dist/client/assets/{index-BpjEclkM.js → index-Bd7vUYhr.js} +1 -1
- package/dist/client/assets/{index-_emDKzsu.js → index-Bo7x9IkO.js} +1 -1
- package/dist/client/assets/{index-C3sW6rkN.js → index-BtDxwJsM.js} +22 -20
- package/dist/client/assets/{index-C6Fo2htT.js → index-By58MgcZ.js} +1 -1
- package/dist/client/assets/index-C3cvP8Fo.js +1033 -0
- package/dist/client/assets/{index-Cs3WB8yn.js → index-CVuEUzi5.js} +1 -1
- package/dist/client/assets/{index-n3-zWcH-.js → index-CoWJD3Jg.js} +2 -2
- package/dist/client/assets/{index-Ctqe81qr.js → index-CyVH876g.js} +1 -1
- package/dist/client/assets/index-D67Kfy-M.js +1 -0
- package/dist/client/assets/{index-C6udJCgz.js → index-DAlpmAIA.js} +1 -1
- package/dist/client/assets/{index-setKr4xl.js → index-DDNwNOHF.js} +1 -1
- package/dist/client/assets/{index-COMRALJO.js → index-DL8ISRMH.js} +1 -1
- package/dist/client/assets/{index-Czm6C7FZ.js → index-DabU6r9W.js} +3 -3
- package/dist/client/assets/{index-CDuYKaGY.js → index-DdJBZE0H.js} +1 -1
- package/dist/client/assets/{index-CiVeycsn.js → index-DijWcSDZ.js} +5 -5
- package/dist/client/assets/index-DyRGZyur.css +1 -0
- package/dist/client/assets/{index-DmFNztTX.js → index-DzwZJuO1.js} +1 -1
- package/dist/client/assets/{index-Csr_C1sk.js → index-HR8BYVRQ.js} +1 -1
- package/dist/client/assets/{index-BLkXoquZ.js → index-LEcodwyW.js} +1 -1
- package/dist/client/assets/index-UPF8suf2.js +1 -0
- package/dist/client/assets/{index-rCvQat0D.js → index-Vz7VUm9l.js} +1 -1
- package/dist/client/assets/index-YW-v746p.js +1 -0
- package/dist/client/assets/{index-DgyhdQnI.js → index-cI2u8WZS.js} +1 -1
- package/dist/client/assets/{index-DNzk9m1D.js → index-iTQUa_b2.js} +3 -3
- package/dist/client/assets/{index-b9p_y2Ql.js → index-mZqojApH.js} +1 -1
- package/dist/client/assets/{index-gIQ7FrL9.js → index-pVFjKNjX.js} +1 -1
- package/dist/client/assets/{index-t3eRSGcT.js → index-skAhJyIF.js} +1 -1
- package/dist/client/assets/{index-BiFJIg4n.js → index-vJy88bwb.js} +1 -1
- package/dist/client/assets/index-wY5OcS4a.js +43 -0
- package/dist/client/assets/{index-B2rBVMNl.js → index-x1yAu9zJ.js} +1 -1
- package/dist/client/assets/index-xAgihCJ7.js +1 -0
- package/dist/client/assets/{index.esm-bLeQzVWT.js → index.esm-BUPoRUaG.js} +1 -1
- package/dist/client/assets/{infoDiagram-MVDRKAX5-nN_N76Fn.js → infoDiagram-MVDRKAX5-B_Wyzufh.js} +1 -1
- package/dist/client/assets/{inline-code-D9bLKHjY.js → inline-code-BIzGDx6z.js} +1 -1
- package/dist/client/assets/{ishikawaDiagram-HPEHV2GE-CiLFbWXd.js → ishikawaDiagram-HPEHV2GE-BDk2-6Pd.js} +1 -1
- package/dist/client/assets/{journeyDiagram-BOSHW7O7-Dn3yOv96.js → journeyDiagram-BOSHW7O7-7qf9KWEQ.js} +1 -1
- package/dist/client/assets/{kanban-definition-FNSA4HC5-JxiBdBQC.js → kanban-definition-FNSA4HC5-CFYDQmXn.js} +1 -1
- package/dist/client/assets/{layers-DTnLoRvE.js → layers-C9tVVcXg.js} +1 -1
- package/dist/client/assets/{lightbulb-CRKLr5q3.js → lightbulb-f4jtsAh0.js} +1 -1
- package/dist/client/assets/{link-2-hgHg-lyw.js → link-2-ZNlK1BG1.js} +1 -1
- package/dist/client/assets/{list-runtime-types-Bb33QiMC.js → list-runtime-types-CqO-QFYD.js} +1 -1
- package/dist/client/assets/{markdown-content-D0FpU2cz.js → markdown-content-DaEVxezf.js} +1 -1
- package/dist/client/assets/{mention-pill-uuaUvwSW.js → mention-pill-BiCPflY-.js} +1 -1
- package/dist/client/assets/{mermaid.core-x3Hh6iut.js → mermaid.core-SX8SzrsU.js} +4 -4
- package/dist/client/assets/{message-square-off-B8N6YF9R.js → message-square-off-_qbedNGF.js} +1 -1
- package/dist/client/assets/{mindmap-definition-6OY57UG3-D0SEv5Re.js → mindmap-definition-6OY57UG3-BloJIArH.js} +1 -1
- package/dist/client/assets/{more-details-CadxnGyH.js → more-details-CdJT0Ehl.js} +1 -1
- package/dist/client/assets/{owner-notice-CJHyha58.js → owner-notice-BDafFD_I.js} +1 -1
- package/dist/client/assets/{package-B8G7jQm-.js → package-Cb7lEm7t.js} +1 -1
- package/dist/client/assets/{page-container-Bb-_N7lw.js → page-container-DsRgIMAL.js} +1 -1
- package/dist/client/assets/{paperclip-BDeYGKqh.js → paperclip-DNu1VtoX.js} +1 -1
- package/dist/client/assets/{path-input-BIfexEKz.js → path-input-D3O71b-X.js} +1 -1
- package/dist/client/assets/{pegDiagram-ECIUJNBX-7ivMd0-b.js → pegDiagram-ECIUJNBX-Di48kPNu.js} +1 -1
- package/dist/client/assets/{pieDiagram-GNMPY74T-DGDkbFvu.js → pieDiagram-GNMPY74T-DY8B_SPD.js} +1 -1
- package/dist/client/assets/{plug-wP1d6OUX.js → plug-IIS_cL9-.js} +1 -1
- package/dist/client/assets/{primer-trigger-CEli_z4n.js → primer-trigger-DurKYe8C.js} +2 -2
- package/dist/client/assets/{profile-errors-C1qSJkiG.js → profile-errors-BdhZfdvZ.js} +1 -1
- package/dist/client/assets/{progress-DmUieXLn.js → progress-g5kkqvlR.js} +1 -1
- package/dist/client/assets/{quadrantDiagram-D57K4MC3-AFQRVSsK.js → quadrantDiagram-D57K4MC3-Depv_dON.js} +1 -1
- package/dist/client/assets/{query-error-state--8AnWSSn.js → query-error-state-PuLGD7Jp.js} +1 -1
- package/dist/client/assets/{radio-mkA-Sqe0.js → radio-QOLZSBz1.js} +1 -1
- package/dist/client/assets/{railroadDiagram-Y72NRBL7-3QBa2d3j.js → railroadDiagram-Y72NRBL7-BfD2AiZM.js} +1 -1
- package/dist/client/assets/registry-Ck8p6n1T.js +1 -0
- package/dist/client/assets/{relay-trace-schemas-fScydQ3A.js → relay-trace-schemas-DF_DfZ7s.js} +2 -2
- package/dist/client/assets/{requirementDiagram-EQYSW5RA-BVBqcASy.js → requirementDiagram-EQYSW5RA-B1iTjrkD.js} +1 -1
- package/dist/client/assets/{room-files-source-BhkPUTiP.js → room-files-source-g1th8mWs.js} +2 -2
- package/dist/client/assets/{rotate-ccw-clock-DiuTseKz.js → rotate-ccw-clock-BGwYMaGL.js} +1 -1
- package/dist/client/assets/{rotate-cw-DvoxWwSx.js → rotate-cw-B4Y0q4GY.js} +1 -1
- package/dist/client/assets/{sankeyDiagram-SY24JHO5-DFjfOD38.js → sankeyDiagram-SY24JHO5-D5TzVJrQ.js} +1 -1
- package/dist/client/assets/{scroll-area-DYyyRqW_.js → scroll-area-BvScZKSa.js} +1 -1
- package/dist/client/assets/{search-x-CA-FzEqZ.js → search-x-CqN5twBj.js} +1 -1
- package/dist/client/assets/{sequenceDiagram-BLEHNHQU-Cr9LzoSF.js → sequenceDiagram-BLEHNHQU-BhUahaNf.js} +1 -1
- package/dist/client/assets/{shield-x-B0W_7qwR.js → shield-x-DHJrwtKp.js} +1 -1
- package/dist/client/assets/{signed-in-X2utDqQS.js → signed-in-BmywDpR5.js} +1 -1
- package/dist/client/assets/{sizeCapture-INFHLROL-Do_jfNyT.js → sizeCapture-INFHLROL-D2Vi1Kq9.js} +1 -1
- package/dist/client/assets/{soul-file-DgfhKQIK.js → soul-file-BMpVFN7U.js} +1 -1
- package/dist/client/assets/{stateDiagram-v2-A6IESKWZ-BCi9yk_0.js → stateDiagram-v2-A6IESKWZ-b9gSbZnF.js} +1 -1
- package/dist/client/assets/{swimlanes-B3ENRKFQ-3SSAw2av.js → swimlanes-B3ENRKFQ-i47jxLY6.js} +1 -1
- package/dist/client/assets/swimlanesDiagram-AYQRV4AK-CA9gW19w.js +8 -0
- package/dist/client/assets/{table-DvU_oS4E.js → table-CN2HCi4p.js} +1 -1
- package/dist/client/assets/{terminal-Dw2QZ7Dh.js → terminal-BORQniao.js} +1 -1
- package/dist/client/assets/{timeline-definition-JXYKGLGB-DTLPXTMA.js → timeline-definition-JXYKGLGB-eY5gj0js.js} +1 -1
- package/dist/client/assets/{trust-posture-2MR0ap9o.js → trust-posture-Bcyy5Fub.js} +1 -1
- package/dist/client/assets/{unplug-CAVOLB2R.js → unplug-lkD35Rwp.js} +1 -1
- package/dist/client/assets/{unverified-catalog-notice-u4ikVg8J.js → unverified-catalog-notice-DiCIrrhU.js} +1 -1
- package/dist/client/assets/{use-adapter-catalog-BQKfRxXC.js → use-adapter-catalog-BrqVd-47.js} +1 -1
- package/dist/client/assets/{use-bindings-BV6HA0MD.js → use-bindings-CU2RSXOy.js} +1 -1
- package/dist/client/assets/{use-composer-prefs-DCSzOnEO.js → use-composer-prefs-Dy2oTM8Y.js} +1 -1
- package/dist/client/assets/{use-connector-management-fr1tx-GZ.js → use-connector-management-5oRqzydY.js} +1 -1
- package/dist/client/assets/{use-deep-link-scroll-v02TbidQ.js → use-deep-link-scroll-Bg5nW8qq.js} +1 -1
- package/dist/client/assets/{use-delete-binding-CnziYpXo.js → use-delete-binding-qeyRkvR1.js} +1 -1
- package/dist/client/assets/{use-dev-links-k4YWFO1v.js → use-dev-links-FY4J_PjA.js} +1 -1
- package/dist/client/assets/{use-external-adapter-catalog-DoGUfa2F.js → use-external-adapter-catalog-HiWFZZrW.js} +1 -1
- package/dist/client/assets/{use-full-activity-feed-CQNxgxnw.js → use-full-activity-feed-K1uk9Wya.js} +1 -1
- package/dist/client/assets/use-is-below-desktop-Cu_jKnft.js +1 -0
- package/dist/client/assets/use-is-hub-BX7ypNRJ.js +1 -0
- package/dist/client/assets/{use-jump-back-in-BuO6A0P7.js → use-jump-back-in-BjZ8EswV.js} +3 -3
- package/dist/client/assets/{use-local-browser-BNzN5O1P.js → use-local-browser-CTFiF0wf.js} +1 -1
- package/dist/client/assets/{use-mesh-topology-CpIDE8lD.js → use-mesh-topology-CafidaIH.js} +1 -1
- package/dist/client/assets/{use-mounted-ref-BAO3qunF.js → use-mounted-ref-B38uSLCx.js} +1 -1
- package/dist/client/assets/{use-notification-prefs-CtqeH5Pk.js → use-notification-prefs-m9XSNB6W.js} +1 -1
- package/dist/client/assets/{use-panel-tab-placements-DFobGBRm.js → use-panel-tab-placements-D9n6rNJ1.js} +1 -1
- package/dist/client/assets/use-pending-read-BoV-UI1E.js +1 -0
- package/dist/client/assets/{use-personality-commit-BvqCwzAC.js → use-personality-commit-ChLQfLrK.js} +1 -1
- package/dist/client/assets/{use-promo-activation-Dz5cYm-X.js → use-promo-activation-DbJDgp4_.js} +3 -3
- package/dist/client/assets/{use-promo-dismissals-CuOsnqnZ.js → use-promo-dismissals-Csw0j0N0.js} +1 -1
- package/dist/client/assets/{use-pulse-freshness-qcTH6PM7.js → use-pulse-freshness-BIZ7daHW.js} +1 -1
- package/dist/client/assets/{use-relay-config-1mAMDNbc.js → use-relay-config-hUB3lVFv.js} +1 -1
- package/dist/client/assets/{use-room-follow-claim-CCGhsyH3.js → use-room-follow-claim-BpKzhniV.js} +1 -1
- package/dist/client/assets/{use-roving-tab-list-Bsg2dfUx.js → use-roving-tab-list-BtM0bZL7.js} +1 -1
- package/dist/client/assets/{use-session-canvas-awPngMKg.js → use-session-canvas-DRrkNRcL.js} +3 -3
- package/dist/client/assets/use-session-diagnostics-BTNgouum.js +16 -0
- package/dist/client/assets/{use-unclaimed-chats-Db_wuzt0.js → use-unclaimed-chats-BbMZtNG9.js} +1 -1
- package/dist/client/assets/use-update-config-CkWwKNkY.js +1 -0
- package/dist/client/assets/{useMutationState-BvwBDXKc.js → useMutationState-CVpvw27W.js} +1 -1
- package/dist/client/assets/{usecaseDiagram-WPOLBNNX-1zKygEKR.js → usecaseDiagram-WPOLBNNX-CHcpeLg4.js} +1 -1
- package/dist/client/assets/{vennDiagram-Q3Y3IDCW-BR2EbgGY.js → vennDiagram-Q3Y3IDCW-gQbZL_A6.js} +1 -1
- package/dist/client/assets/{wardleyDiagram-IVAIDKWA-D0OwouJc.js → wardleyDiagram-IVAIDKWA-BFH_WHzZ.js} +1 -1
- package/dist/client/assets/{xychartDiagram-4URNHDU4-BM-7_FQQ.js → xychartDiagram-4URNHDU4-B0QpyqeZ.js} +1 -1
- package/dist/client/index.html +2 -2
- package/dist/drizzle/20261018210140_remote_command_agent_computer_kind.sql +21 -0
- package/dist/drizzle/20261019142317_turn_marks.sql +3 -0
- package/dist/drizzle/20261019185620_dor3037_wifi_holds.sql +8 -0
- package/dist/drizzle/meta/20261018210140_snapshot.json +14027 -0
- package/dist/drizzle/meta/20261019142317_snapshot.json +14048 -0
- package/dist/drizzle/meta/20261019185620_snapshot.json +14079 -0
- package/dist/drizzle/meta/_journal.json +21 -0
- package/dist/server/extension-child.cjs +18 -2
- package/dist/server/index.js +64322 -32299
- package/dist/server/index.js.map +2 -2
- package/package.json +4 -4
- package/dist/client/assets/ApplyToOverridesDialog-CrqkeHQb.js +0 -1
- package/dist/client/assets/HandlePage-BKiqymRF.js +0 -1
- package/dist/client/assets/McpSigninBody-COIHpHq_.js +0 -1
- package/dist/client/assets/NamePage-D7W6VMYd.js +0 -1
- package/dist/client/assets/OperatorIdentityForm-C3op6BIC.js +0 -1
- package/dist/client/assets/PermissionHistory-CKebTVkq.js +0 -1
- package/dist/client/assets/PhotoPage-Ch1at4A6.js +0 -1
- package/dist/client/assets/SeenDevices-BPw3UgjX.js +0 -19
- package/dist/client/assets/SettingsDialog-Bdws5dbS.js +0 -12
- package/dist/client/assets/TaskDialogWrapper-CTcW70s8.js +0 -1
- package/dist/client/assets/ToolsPage-D5-fx1EA.js +0 -2
- package/dist/client/assets/_shell-BLTSXXDw.js +0 -80
- package/dist/client/assets/_shell.channels-D_GQU4RB.js +0 -10
- package/dist/client/assets/_shell.connections-DZrlxs4G.js +0 -1
- package/dist/client/assets/_shell.marketplace-CZxkAmFz.js +0 -1
- package/dist/client/assets/_shell.marketplace_.sources-Q0BTQIuE.js +0 -1
- package/dist/client/assets/_shell.session-DvGL0DoX.js +0 -63
- package/dist/client/assets/_shell.x._extensionId-B6Tm5KuT.js +0 -1
- package/dist/client/assets/_shell.x._extensionId_._-B6Tm5KuT.js +0 -1
- package/dist/client/assets/channel-CGffcDRq.js +0 -1
- package/dist/client/assets/image-lightbox-BXzbN27o.js +0 -1
- package/dist/client/assets/index-1qv8ldHx.js +0 -1
- package/dist/client/assets/index-8-iQ6PnT.js +0 -1028
- package/dist/client/assets/index-BFitbVs4.js +0 -1
- package/dist/client/assets/index-C24HfJir.js +0 -1
- package/dist/client/assets/index-CI84yP-g.js +0 -1
- package/dist/client/assets/index-D5zUdnZM.js +0 -1
- package/dist/client/assets/index-DUZrTFYD.css +0 -1
- package/dist/client/assets/index-DX_2Mxwv.js +0 -1
- package/dist/client/assets/index-Dgrk2udV.js +0 -38
- package/dist/client/assets/registry-Bnd-HFt3.js +0 -1
- package/dist/client/assets/shield-check-CpUB_Ju1.js +0 -6
- package/dist/client/assets/swimlanesDiagram-AYQRV4AK-jpZCGfva.js +0 -8
- package/dist/client/assets/use-is-below-desktop-DR8FEbRW.js +0 -1
- package/dist/client/assets/use-is-hub-BmpgFnFp.js +0 -1
- package/dist/client/assets/use-pending-read-Do0_vZ2I.js +0 -1
- package/dist/client/assets/use-session-diagnostics-D5g8Mc52.js +0 -16
- package/dist/client/assets/use-update-config-DwtH_H9Z.js +0 -1
|
@@ -1,17 +1,17 @@
|
|
|
1
|
-
import{W as Se,aR as Me,a1 as ne,r as s,
|
|
1
|
+
import{W as Se,aR as Me,a1 as ne,r as s,iJ as Ie,iK as Q,iL as G,iM as H,gn as ie,iN as Ce,a7 as J,iO as ee,as as it,iP as lt,a3 as oe,iQ as ct,iR as dt,iS as ut,iT as ft,aW as Te,iU as ht,j as e,x as Fe,T as pt,C as Ke,aq as mt,d$ as be,iu as xt,G as Pe,iV as gt,iW as yt,iX as vt,iY as Z,iZ as ue,gc as fe,gd as he,ge as pe,gf as me,gg as xe,gh as ge,gi as ye,gj as ve,B as Y,b6 as Ct,e6 as _e,iz as bt,i_ as jt,a2 as ce,i$ as He,dB as kt,j0 as wt,j1 as Et,j2 as Dt,j3 as Nt,bk as De,j4 as Ue,a4 as Rt,gl as St,a0 as Tt,gS as Ft,dL as Pt,iD as Ot,j5 as Mt,cy as _t,cz as At,cB as Lt,cC as zt,cD as $t,dy as It,I as Kt,de as Ht}from"./index-C3cvP8Fo.js";import{t as ae,g as Ut,C as qt,n as qe,r as Qe,a as Qt,p as Bt,F as Wt,w as Yt,c as Be,b as Gt}from"./room-files-source-g1th8mWs.js";import{N as rs,R as os}from"./room-files-source-g1th8mWs.js";import{d as Vt}from"./query-keys-DeYqUDia.js";import{r as Xt,c as Zt}from"./composer-insert-BpyATrmR.js";import{u as Jt}from"./index-pVFjKNjX.js";import{r as We,h as Ye,F as en}from"./file-drag-GDx2qhdk.js";import{R as Ge}from"./rotate-cw-B4Y0q4GY.js";import{L as tn}from"./link-2-ZNlK1BG1.js";import{F as Ve}from"./file-CiyVL55_.js";import{G as Xe}from"./git-branch-CONwEYiR.js";import{M as nn}from"./more-details-CdJT0Ehl.js";import"./markdown-content-DaEVxezf.js";import"./file-exclamation-point-DaFRIKco.js";/**
|
|
2
2
|
* @license lucide-react v1.48.0 - ISC
|
|
3
3
|
*
|
|
4
4
|
* This source code is licensed under the ISC license.
|
|
5
5
|
* See the LICENSE file in the root directory of this source tree.
|
|
6
|
-
*/const
|
|
6
|
+
*/const Ze={name:"corner-left-up",size:24,node:[["path",{d:"M14 9 9 4 4 9",key:"1af5af"}],["path",{d:"M20 20h-7a4 4 0 0 1-4-4V4",key:"1blwi3"}]]};Ze.node;const sn=Se(Ze);/**
|
|
7
7
|
* @license lucide-react v1.48.0 - ISC
|
|
8
8
|
*
|
|
9
9
|
* This source code is licensed under the ISC license.
|
|
10
10
|
* See the LICENSE file in the root directory of this source tree.
|
|
11
|
-
*/const
|
|
11
|
+
*/const Je={name:"file-plus",size:24,node:[["path",{d:"M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z",key:"1oefj6"}],["path",{d:"M14 2v5a1 1 0 0 0 1 1h5",key:"wfsgrz"}],["path",{d:"M9 15h6",key:"cctwl0"}],["path",{d:"M12 18v-6",key:"17g6i2"}]]};Je.node;const et=Se(Je);/**
|
|
12
12
|
* @license lucide-react v1.48.0 - ISC
|
|
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 tt={name:"upload",size:24,node:[["path",{d:"M12 3v12",key:"1x0j5s"}],["path",{d:"m17 8-5-5-5 5",key:"7q97r8"}],["path",{d:"M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4",key:"ih7n3h"}]]};tt.node;const an=Se(tt);function le(t,n,a){return["file-explorer","tree",t.scopeKey,n,t.filtersHidden?a:null]}function je(t,n,a,x){return{queryKey:le(t,n,a),queryFn:()=>t.list(n,{showHidden:a}),staleTime:Me.FILE_TREE_STALE_TIME_MS,gcTime:Me.FILE_TREE_GC_TIME_MS,refetchOnWindowFocus:!0,placeholderData:p=>p??x.getQueryData(le(t,n,!a))}}const rn=[".git",".dork",".claude",".agents","node_modules"];function on(t){return t.startsWith(".")||rn.includes(t)}const Ne=["ROOM.md","README.md"];function Re(t){return Ne.some(n=>n.toLowerCase()===t.toLowerCase())}function nt(t){return t.filter(n=>!on(n.name))}function ln(t){if(t.reduce((p,c)=>c.type==="file"&&Re(c.name)?p+1:p,0)===0)return t;const a=[],x=[];for(const p of t)p.type==="file"&&Re(p.name)?a.push(p):x.push(p);return a.sort((p,c)=>Ne.findIndex(o=>o.toLowerCase()===p.name.toLowerCase())-Ne.findIndex(o=>o.toLowerCase()===c.name.toLowerCase())),[...a,...x]}const cn=/ copy(?: \d+)?$/;function Oe({name:t,isDir:n,taken:a}){const x=new Set(a);if(!x.has(t))return t;const p=n?-1:t.lastIndexOf("."),c=p>0,o=c?t.slice(p):"",m=(c?t.slice(0,p):t).replace(cn,"");for(let r=1;;r+=1){const i=r===1?`${m} copy${o}`:`${m} copy ${r}${o}`;if(!x.has(i))return i}}function Ae(t,n,a){return{name:n,path:t,type:a,size:0,mtime:Date.now(),isSymlink:!1}}function dn(t){const n=ne(),{source:a,showHidden:x,queryClient:p,inFlightRef:c}=t,o=a.cwd??"",[m,r]=s.useState(null),i=s.useCallback(async h=>{c.current+=1;try{return await h()}finally{c.current-=1}},[c]),u=s.useMemo(()=>{const h=g=>le(a,g,x);return{getChildren:g=>{var w;return((w=p.getQueryData(h(g)))==null?void 0:w.entries)??[]},isLoaded:g=>p.getQueryData(h(g))!==void 0,takenNames:async g=>(await n.readFileTree(o,{path:g===Q?void 0:g,showHidden:!0})).entries.map(b=>b.name),snapshot:g=>p.getQueryData(h(g)),setChildren:(g,w)=>{p.setQueryData(h(g),b=>({entries:Ie(w((b==null?void 0:b.entries)??[]))}))},restore:(g,w)=>{p.setQueryData(h(g),w)},invalidate:g=>{p.invalidateQueries({queryKey:h(g),exact:!0}),p.invalidateQueries({queryKey:Vt.index(o)})}}},[p,n,o,a,x]),N=s.useCallback((h,g,w)=>i(async()=>{const b=ee(h,g),S=!u.getChildren(h).some(A=>A.path===b),K=u.snapshot(h);S&&u.setChildren(h,A=>[...A,Ae(b,g,w)]);try{return await n.createEntry(o,b,w),!0}catch(A){return S&&u.restore(h,K),ae(A,`Couldn’t create ${w==="dir"?"folder":"file"}`),!1}finally{u.invalidate(h)}}),[n,o,u,i]),F=s.useCallback((h,g)=>i(async()=>{if(g===h.name||g.length===0)return!0;const w=G(h.path),b=ee(w,g),S=u.getChildren(w).some(_=>_.path===b),K=u.snapshot(w),A={...h,name:g,path:b};S||u.setChildren(w,_=>_.map($=>$.path===h.path?A:$));try{return await n.renameEntry(o,h.path,b),H.getState().remapExpandedPaths(h.path,b),!0}catch(_){return S||u.restore(w,K),ae(_,"Couldn’t rename"),!1}finally{u.invalidate(w)}}),[n,o,u,i]),D=s.useCallback(h=>i(async()=>{const g=G(h.path),w=u.snapshot(g);u.setChildren(g,b=>b.filter(S=>S.path!==h.path));try{await n.deleteEntry(o,h.path,{recursive:!0}),H.getState().dropExpandedPaths(h.path)}catch(b){u.restore(g,w),ae(b,"Couldn’t delete")}finally{u.invalidate(g)}}),[n,o,u,i]),L=s.useCallback(h=>i(async()=>{const g=G(h.path);if(h.type==="file"){const w=u.snapshot(g);u.setChildren(g,b=>b.filter(S=>S.path!==h.path));try{await n.deleteEntry(o,h.path),H.getState().dropExpandedPaths(h.path)}catch(b){u.restore(g,w),ae(b,"Couldn’t delete")}finally{u.invalidate(g)}return}try{await n.deleteEntry(o,h.path),u.setChildren(g,w=>w.filter(b=>b.path!==h.path)),H.getState().dropExpandedPaths(h.path),u.invalidate(g)}catch(w){if(qt(w)==="DIR_NOT_EMPTY"){r(h);return}ae(w,"Couldn’t delete")}}),[n,o,u,i]),C=s.useCallback(async()=>{const h=m;r(null),h&&await D(h)},[m,D]),q=s.useCallback(()=>r(null),[]),I=s.useCallback((h,g)=>i(async()=>{const w=G(h),b=ie(h),S=ee(g,b);if(g===w||S===h||Ce(g,h))return;const K=u.getChildren(w).find(v=>v.path===h);if(!K)return;const A=u.isLoaded(g),_=A&&u.getChildren(g).some(v=>v.path===S),$={...K,name:b,path:S},W=u.snapshot(w),P=A?u.snapshot(g):void 0;u.setChildren(w,v=>v.filter(z=>z.path!==h)),A&&!_&&u.setChildren(g,v=>[...v,$]);try{await n.renameEntry(o,h,S),H.getState().remapExpandedPaths(h,S)}catch(v){u.restore(w,W),A&&!_&&u.restore(g,P),ae(v,"Couldn’t move")}finally{u.invalidate(w),A&&u.invalidate(g)}}),[n,o,u,i]),j=s.useCallback((h,g)=>i(async()=>{if(h.isDir&&Ce(g,h.path)){X.error(Ut);return}let w;try{w=await u.takenNames(g)}catch(_){ae(_,"Couldn’t copy");return}const b=Oe({name:ie(h.path),isDir:h.isDir,taken:w}),S=ee(g,b),K=u.isLoaded(g),A=K?u.snapshot(g):void 0;if(K){const _=u.getChildren(G(h.path)).find(W=>W.path===h.path),$=_?{..._,name:b,path:S}:Ae(S,b,h.isDir?"dir":"file");u.setChildren(g,W=>[...W,$])}try{await n.copyEntry(o,h.path,S)}catch(_){K&&u.restore(g,A),ae(_,"Couldn’t copy")}finally{u.invalidate(g)}}),[n,o,u,i]);return{createEntry:N,renameEntry:F,removeEntry:L,moveEntry:I,copyEntry:j,pendingRecursiveDelete:m,confirmRecursiveDelete:C,cancelRecursiveDelete:q}}function un(t){return t!=null&&t.startsWith("darwin")?"Reveal in Finder":t!=null&&t.startsWith("win32")?"Reveal in File Explorer":"Show in file manager"}function fn(t,n){const a=t.includes("\\")&&!t.includes("/"),x=t.replace(/[\\/]+$/,""),p=a?n.split("/").join("\\"):n;return`${x}${a?"\\":"/"}${p}`}function hn(t){const n=ne(),{data:a}=it(),x=s.useMemo(()=>n.supportsReveal?un(a==null?void 0:a.platform):null,[n.supportsReveal,a==null?void 0:a.platform]),p=s.useCallback(async i=>{if(t)try{await n.revealEntry(t,i.path)}catch(u){ae(u,"Couldn’t open the file manager")}},[n,t]),{copy:c}=lt(),o=s.useCallback(async(i,u)=>{const N=u==="absolute"&&t?fn(t,i.path):i.path;await c(N)||X.error("Couldn’t copy to the clipboard")},[t,c]),m=s.useCallback(i=>{Zt(Jt(i.path))||X.error("Open a chat to add this file")},[]),r=s.useCallback(i=>{H.getState().setClipboard({path:i.path,isDir:i.type==="dir"});try{navigator.clipboard.writeText(i.path).catch(()=>{})}catch{}},[]);return{revealLabel:x,reveal:p,copyPath:o,addToChat:m,copyToClipboard:r}}const pn=1e3;function mn(t){const{source:n,showHidden:a,queryClient:x,inFlightRef:p}=t,c=n.changes,[o,m]=s.useState(null),[r,i]=s.useState(null),[u,N]=s.useState(null),[F,D]=s.useState(0),L=s.useCallback(async d=>{p.current+=1,D(f=>f+1);try{return await d()}finally{p.current-=1,D(f=>f-1)}},[p]),C=s.useMemo(()=>{const d=f=>le(n,f,a);return{listing:f=>x.getQueryData(d(f)),isLoaded:f=>x.getQueryData(d(f))!==void 0,entries:f=>{var T;return((T=x.getQueryData(d(f)))==null?void 0:T.entries)??[]},setEntries:(f,T)=>x.setQueryData(d(f),y=>({...y,entries:Ie(T((y==null?void 0:y.entries)??[]))})),restore:(f,T)=>x.setQueryData(d(f),T),fetch:f=>n.list(f,{showHidden:!0}),refreshAll:()=>{x.invalidateQueries({queryKey:["file-explorer","tree",n.scopeKey]}),x.invalidateQueries({queryKey:["file-explorer","preview",n.scopeKey]})}}},[x,n,a]),q=s.useCallback(async d=>{const f=C.listing(d);return(f==null?void 0:f.commit)!==void 0?f.commit:(await C.fetch(d)).commit??null},[C]),I=s.useCallback((d,f,T,y)=>{switch(d.status){case"changed":return!0;case"conflict":return N({kind:f,path:d.path,lastCommit:d.lastCommit,retry:()=>T(d.commit)}),!1;case"exists":return X.error(y===void 0?d.reason:Ue(y)),!1;case"refused":return X.error(d.reason),!1}},[]),j=s.useCallback((d,f)=>{X.error(Qe(d)??f)},[]),h=s.useCallback((d,f,T)=>{const y=O=>L(async()=>{if(c===void 0)return!1;const E=G(d.path),R=G(f),k=ie(f),U=C.isLoaded(R),te=U&&C.entries(R).some(Z=>Z.path===f),V=C.listing(E),de=R===E?void 0:C.listing(R),l={...d,name:k,path:f};te||(R===E?C.setEntries(E,Z=>Z.map(se=>se.path===d.path?l:se)):(C.setEntries(E,Z=>Z.filter(se=>se.path!==d.path)),U&&C.setEntries(R,Z=>[...Z,l])));const M=()=>{C.restore(E,V),R!==E&&U&&C.restore(R,de)};try{const Z=O??await q(E);if(Z===null)return M(),X.error("This room has no files to change yet."),!1;const se=await c.move({from:d.path,to:f,baseCommit:Z}),we=I(se,T,async re=>{await y(re)},k);return we?H.getState().remapExpandedPaths(d.path,f):M(),we}catch(Z){return M(),j(Z,T==="rename"?"Couldn’t rename":"Couldn’t move"),!1}finally{C.refreshAll()}});return y(null)},[c,C,L,q,I,j]),g=s.useCallback(async(d,f)=>f===d.name||f.length===0?!0:h(d,ee(G(d.path),f),"rename"),[h]),w=s.useCallback(async(d,f)=>{const T=G(d),y=ee(f,ie(d));if(f===T||y===d||Ce(f,d))return;const O=C.entries(T).find(E=>E.path===d);O&&await h(O,y,"move")},[C,h]),b=s.useCallback(async d=>{let f=0;const T=[d];for(;T.length>0;){const y=T.shift(),O=await C.fetch(y);for(const E of O.entries)if(E.type==="dir"?T.push(E.path):f+=1,f>=pn)return{count:f,moreThan:!0}}return{count:f,moreThan:!1}},[C]),S=s.useCallback(d=>{if(d.type!=="dir"){m({entry:d,fileCount:1,moreThan:!1});return}m({entry:d,fileCount:null,moreThan:!1}),b(d.path).then(({count:f,moreThan:T})=>m(y=>(y==null?void 0:y.entry.path)===d.path?{entry:d,fileCount:f,moreThan:T}:y),()=>{})},[b]),K=s.useCallback(d=>{const f=T=>L(async()=>{if(c===void 0)return;const y=G(d.path),O=C.listing(y);C.setEntries(y,E=>E.filter(R=>R.path!==d.path));try{const E=T??await q(y);if(E===null){C.restore(y,O);return}const R=await c.remove({path:d.path,baseCommit:E});I(R,"delete",U=>f(U))?H.getState().dropExpandedPaths(d.path):C.restore(y,O)}catch(E){C.restore(y,O),j(E,"Couldn’t delete")}finally{C.refreshAll()}});return f(null)},[c,C,L,q,I,j]),A=s.useCallback(async()=>{const d=o;m(null),d&&await K(d.entry)},[o,K]),_=s.useCallback(()=>m(null),[]),$=s.useCallback((d,f,T,y)=>{const O=E=>L(async()=>{if(c===void 0)return;const R=C.isLoaded(d),k=R?C.listing(d):void 0;if(R){const U=new Set(C.entries(d).map(V=>V.name)),te=f.filter(V=>!U.has(V.name)).map(V=>({name:V.name,path:ee(d,V.name),type:"file",size:V.size}));te.length>0&&C.setEntries(d,V=>[...V,...te])}try{const U=await c.upload({dir:d,baseCommit:E,replace:T,files:f});!I(U,"upload",V=>O(V))&&R&&C.restore(d,k)}catch(U){R&&C.restore(d,k),j(U,"Couldn’t upload")}finally{C.refreshAll()}});return O(y)},[c,C,L,I,j]),W=s.useCallback(async(d,f)=>{if(c===void 0||f.length===0)return;if(f.length>c.maxUploadFiles){X.error(`Nothing was uploaded. One upload takes up to ${c.maxUploadFiles} files.`);return}let T;try{T=await C.fetch(d)}catch(k){j(k,"Couldn’t upload");return}const y=T.entries.map(k=>k.name),O=new Set(y),E=f.map(k=>k.name).filter(k=>O.has(k)),R=T.commit??null;if(E.length===0){await $(d,f,[],R);return}i({dir:d,files:f,names:E,taken:y,baseCommit:R})},[c,C,j,$]),P=s.useCallback(async d=>{const f=r;if(i(null),f===null)return;if(d==="replace"){await $(f.dir,f.files,f.names,f.baseCommit);return}const T=new Set([...f.taken,...f.files.map(E=>E.name)]),y=new Set(f.names),O=f.files.map(E=>{if(!y.has(E.name))return E;const R=Oe({name:E.name,isDir:!1,taken:T});return T.add(R),new File([E],R,{type:E.type,lastModified:E.lastModified})});await $(f.dir,O,[],f.baseCommit)},[r,$]),v=s.useCallback(()=>i(null),[]),z=s.useCallback(()=>N(null),[]),B=s.useMemo(()=>r===null?null:{dir:r.dir,names:r.names},[r]);return{renameEntry:g,moveEntry:w,requestDelete:S,pendingDelete:o,confirmDelete:A,cancelDelete:_,upload:W,pendingClash:B,resolveClash:P,cancelClash:v,conflict:u,dismissConflict:z,busy:F>0}}const Le={scopeKey:"",cwd:null,writable:!1,provenance:!1,filtersHidden:!0,preview:"canvas",editable:!1,list:()=>Promise.resolve({entries:[]})};function xn(t){var d,f,T;const n=ne(),a=oe(),{setTheme:x}=ct(),p=H(y=>y.showHidden),c=H(y=>y.expanded),o=H(y=>y.loadExplorerForCwd),m=H(y=>y.pruneMissing),r=(t==null?void 0:t.scopeKey)??null,i=(t==null?void 0:t.cwd)??null;s.useEffect(()=>{o(r)},[r,o]);const u=s.useMemo(()=>[Q,...dt(c)],[c]),N=ut({queries:t?u.map(y=>je(t,y,p,a)):[]}),F=(t==null?void 0:t.filtersHidden)??!0,D=s.useMemo(()=>{const y={};return u.forEach((O,E)=>{var U;const R=N[E];let k=((U=R==null?void 0:R.data)==null?void 0:U.entries)??[];!p&&!F&&(k=nt(k)),O===Q&&(k=ln(k)),y[O]={entries:k,loading:(R==null?void 0:R.isLoading)??!1,error:(R==null?void 0:R.isError)??!1}}),y},[u,N,p,F]),L=s.useRef(0),C=s.useRef({});s.useEffect(()=>{L.current>0||u.forEach((y,O)=>{var R,k,U;const E=(k=(R=N[O])==null?void 0:R.data)==null?void 0:k.entries;!E||(U=N[O])!=null&&U.isError||C.current[y]!==E&&(C.current[y]=E,m(y,E.map(te=>te.name)))})},[u,N,m]);const q=s.useMemo(()=>ft(c,D),[c,D]),I=!!t&&!!((d=D[Q])!=null&&d.loading),j=!!t&&!!((f=D[Q])!=null&&f.error),h=(T=N[0])==null?void 0:T.error,g=j&&h?Qt(h):void 0,w=(g==null?void 0:g.message)??null,b=(g==null?void 0:g.command)??null,S=s.useMemo(()=>{var O;const y=new Set;for(const E of u)E!==Q&&((O=D[E])!=null&&O.error)&&y.add(E);return y},[u,D]),K=s.useCallback(y=>{if(y.type!=="dir")return;const O=H.getState();O.setDirExpanded(y.path,!O.expanded[y.path])},[]),A=s.useCallback(y=>{if(y===Q)return;const O=H.getState();O.expanded[y]||O.setDirExpanded(y,!0)},[]),_=(t==null?void 0:t.preview)==="canvas",$=s.useCallback(y=>{if(y.type!=="file"||!_)return;const O={getStore:Te.getState,setTheme:x,supportsTerminal:n.supportsTerminal};ht(O,{action:"open_file",sourcePath:y.path},"user")},[_,x,n]),W=s.useCallback(()=>{r!==null&&a.invalidateQueries({queryKey:["file-explorer","tree",r]})},[a,r]),P=s.useCallback(y=>{t!==null&&a.invalidateQueries({queryKey:le(t,y,p),exact:!0})},[a,t,p]);s.useEffect(()=>{if(t!=null&&t.events)return t.events(W)},[t,W]);const v=dn({source:t??Le,showHidden:p,queryClient:a,inFlightRef:L}),z=mn({source:t??Le,showHidden:p,queryClient:a,inFlightRef:L}),B=hn(i);return{rows:q,rootLoading:I,rootError:j,rootErrorMessage:w,rootErrorCommand:b,errorPaths:S,toggleExpand:K,ensureExpanded:A,openFile:$,reload:W,retryDir:P,changes:t!=null&&t.changes?z:null,...v,...B}}function gn(t){const{transport:n,cwd:a}=t;return{scopeKey:a,cwd:a,writable:!0,provenance:!1,filtersHidden:!0,preview:"canvas",editable:!1,list(x,p){return n.readFileTree(a,{path:x===""?void 0:x,showHidden:p.showHidden})}}}function ke(t){return Array.from(t).includes("Files")}function st(t){const n=Array.from(t.items??[]);if(!(n.length>0&&n.every(c=>"webkitGetAsEntry"in c)))return{files:Array.from(t.files??[]),folders:0};const x=[];let p=0;for(const c of n){if(c.kind!=="file")continue;const o=c.webkitGetAsEntry();if(o!=null&&o.isDirectory){p+=1;continue}const m=c.getAsFile();m&&x.push(m)}return{files:x,folders:p}}const yn=12;function vn({row:t,selected:n,renaming:a,error:x,onSelect:p,onActivate:c,onRetry:o,onSubmitRename:m,onCancelRename:r,onNewFile:i,onNewFolder:u,onStartRename:N,onDelete:F,onMove:D,onCopyInto:L,onCopy:C,onPaste:q,onDuplicate:I,canPasteInto:j,revealLabel:h,onReveal:g,onAddToChat:w,onCopyPath:b,readOnly:S=!1,provenance:K=!1,copyable:A=!0,onDisk:_=!0,onUpload:$,onPickUpload:W}){const{entry:P,depth:v,expanded:z,loading:B}=t,d=P.type==="dir",f=d?P.path:G(P.path),[T,y]=s.useState(!1),O=!d&&v===0&&Re(P.name),E=Bt(P.lastCommit),R=e.jsxs("div",{role:"treeitem","aria-label":P.name,"aria-expanded":d?z:void 0,"aria-selected":n,tabIndex:-1,onKeyDown:k=>{(k.key==="Enter"||k.key===" ")&&(k.preventDefault(),p(P),c(P))},draggable:!a&&!S,onDragStart:k=>{S||(k.dataTransfer.setData("text/plain",P.path),k.dataTransfer.setData(en,P.path),k.dataTransfer.effectAllowed="copyMove")},onDragOver:k=>{if(k.stopPropagation(),!S&&$&&ke(k.dataTransfer.types)){k.preventDefault(),k.dataTransfer.dropEffect="copy",y(!0);return}S||!d||!Ye(k.dataTransfer.types)||(k.preventDefault(),k.dataTransfer.dropEffect=k.altKey&&A?"copy":"move",y(!0))},onDragLeave:()=>y(!1),onDrop:k=>{if(k.stopPropagation(),S)return;if(y(!1),$&&ke(k.dataTransfer.types)){k.preventDefault();const{files:te}=st(k.dataTransfer);$(f,te);return}if(!d)return;const U=We(k.dataTransfer);U!==null&&(k.preventDefault(),k.altKey&&A?L(U,P.path):D(U,P.path))},onClick:()=>{p(P),c(P)},className:Pe("flex w-full cursor-pointer items-center gap-1 py-1 pr-2 text-sm transition-colors",n?"bg-accent text-foreground":"hover:bg-accent/50",T&&"ring-ring/60 bg-accent ring-1"),style:{paddingLeft:v*yn+8},children:[e.jsx("span",{className:"flex size-4 flex-shrink-0 items-center justify-center",children:d&&(B?e.jsx(Fe,{size:"xs",className:"text-muted-foreground"}):x?e.jsx("button",{type:"button","aria-label":"Retry loading",title:"Couldn’t load. Retry",onClick:k=>{k.stopPropagation(),o()},className:"flex items-center justify-center",children:e.jsx(Ge,{className:"text-destructive size-3.5"})}):z?e.jsx(pt,{className:"text-muted-foreground size-3.5"}):e.jsx(Ke,{className:"text-muted-foreground size-3.5"}))}),d?z?e.jsx(mt,{className:"size-(--size-icon-sm) flex-shrink-0 text-sky-500"}):e.jsx(be,{className:"size-(--size-icon-sm) flex-shrink-0 text-sky-500"}):P.isSymlink===!0?e.jsx(tn,{className:"text-muted-foreground size-(--size-icon-sm) flex-shrink-0"}):e.jsx(Ve,{className:"text-muted-foreground size-(--size-icon-sm) flex-shrink-0"}),a?e.jsx(Cn,{initialName:P.name,onSubmit:k=>m(P,k),onCancel:r}):e.jsx("span",{className:"min-w-0 flex-1 truncate",children:P.name}),O&&!a&&e.jsx(xt,{"aria-label":"Pinned to the top",className:"text-muted-foreground/60 size-3 flex-shrink-0"}),K&&!a&&e.jsx("span",{className:"text-muted-foreground/70 text-2xs max-w-[45%] flex-shrink-0 truncate tabular-nums",title:E.title??void 0,children:E.label})]});return S?R:e.jsxs(gt,{children:[e.jsx(yt,{asChild:!0,children:R}),e.jsxs(vt,{className:"w-52",children:[e.jsx(J,{movesFocus:!0,onClick:()=>i(f),children:"New file"}),e.jsx(J,{movesFocus:!0,onClick:()=>u(f),children:"New folder"}),W&&e.jsx(J,{onClick:()=>W(f),children:"Upload files…"}),_&&e.jsxs(e.Fragment,{children:[e.jsx(ue,{}),h&&e.jsx(J,{onClick:()=>g(P),children:h}),e.jsx(J,{movesFocus:!0,onClick:()=>w(P),children:"Add to chat"})]}),A&&e.jsxs(e.Fragment,{children:[e.jsx(ue,{}),e.jsx(J,{onClick:()=>C(P),children:"Copy"}),e.jsx(J,{disabled:!j(f),onClick:()=>q(f),children:"Paste"}),e.jsx(J,{onClick:()=>I(P),children:"Duplicate"})]}),e.jsx(ue,{}),_?e.jsxs(e.Fragment,{children:[e.jsx(J,{onClick:()=>b(P,"absolute"),children:"Copy path"}),e.jsx(J,{onClick:()=>b(P,"relative"),children:"Copy relative path"})]}):e.jsx(J,{onClick:()=>b(P,"relative"),children:"Copy path"}),e.jsx(ue,{}),e.jsx(J,{movesFocus:!0,onClick:()=>N(P),children:"Rename"}),e.jsx(J,{variant:"destructive",onClick:()=>F(P),children:"Delete"})]})]})}function Cn({initialName:t,onSubmit:n,onCancel:a}){const x=s.useRef(null),[p,c]=s.useState(t);s.useEffect(()=>{const m=x.current;if(!m)return;m.focus();const r=t.lastIndexOf(".");m.setSelectionRange(0,r>0?r:t.length)},[t]);const o=()=>{const m=p.trim();m&&m!==t?n(m):a()};return e.jsx("input",{ref:x,type:"text",value:p,"aria-label":"New name",onChange:m=>c(m.target.value),onClick:m=>m.stopPropagation(),onBlur:o,onKeyDown:m=>{m.stopPropagation(),m.key==="Enter"?o():m.key==="Escape"&&a()},className:"border-border bg-background focus-ring min-w-0 flex-1 rounded border px-1 py-0 text-sm outline-none"})}const bn=100,kn=28,jn=250;function wn(t){const{rows:n,selectedPath:a,renamingPath:x,errorPaths:p,onSelectPath:c,onRetryDir:o}=t,m=s.useRef(null),r=H(v=>v.setScrollTop),i=H(v=>v.scopeKey),u=s.useCallback(v=>v.type==="dir"?t.onToggle(v):t.onOpen(v),[t]),N=Dn(t,u),F=n.length>bn,D=Xt({count:n.length,getScrollElement:()=>m.current,estimateSize:()=>kn,overscan:12,enabled:F}),L=s.useRef({scope:void 0,done:!1}),C=s.useRef(null);s.useLayoutEffect(()=>{const v=L.current;if(v.scope!==i&&(v.scope=i,v.done=!1),v.done||n.length===0)return;const z=m.current;if(!z)return;const B=H.getState().scrollTop;if(B<=0){v.done=!0;return}F?D.scrollToOffset(B):z.scrollTop=B,C.current=z.scrollTop,z.scrollTop>=B&&(v.done=!0)},[n.length,i,F,D]);const q=s.useRef(null),I=s.useRef(null),j=s.useCallback(()=>{const v=m.current;v&&v.scrollTop!==C.current&&(L.current.done=!0,q.current=v.scrollTop,I.current&&clearTimeout(I.current),I.current=setTimeout(()=>{I.current=null,q.current!==null&&r(q.current)},jn))},[r]);s.useEffect(()=>()=>{I.current&&clearTimeout(I.current),q.current!==null&&r(q.current)},[r]);const h=s.useRef(void 0);s.useEffect(()=>{var d,f;const v=h.current;if(h.current=a,v===void 0||a===v||a===null)return;const z=n.findIndex(T=>T.entry.path===a);if(z<0)return;const B=m.current;B&&(F?D.scrollToIndex(z,{align:"auto"}):(f=(d=B.querySelector(`[data-row-index="${z}"]`))==null?void 0:d.scrollIntoView)==null||f.call(d,{block:"nearest"}),C.current=B.scrollTop)},[a,n,F,D]);const[g,w]=s.useState(!1),{onCopyInto:b,onMove:S}=t,K=t.readOnly===!0,A=t.copyable!==!1,_=s.useCallback(v=>{K||!Ye(v.dataTransfer.types)||(v.preventDefault(),v.dataTransfer.dropEffect=v.altKey&&A?"copy":"move",w(!0))},[K,A]),$=s.useCallback((v,z)=>{const B=n.find(d=>d.entry.path===v);B&&b({path:v,isDir:B.entry.type==="dir"},z)},[n,b]),W=s.useCallback(v=>{if(w(!1),K)return;const z=We(v.dataTransfer);z!==null&&(v.preventDefault(),v.altKey&&A?$(z,Q):S(z,Q))},[$,S,K,A]),P=v=>e.jsx(vn,{row:v,selected:v.entry.path===a,renaming:v.entry.path===x,error:v.entry.type==="dir"&&v.expanded&&p.has(v.entry.path),onSelect:z=>c(z.path),onActivate:u,onRetry:()=>o(v.entry.path),onSubmitRename:t.onSubmitRename,onCancelRename:t.onCancelRename,onStartRename:t.onStartRename,onNewFile:t.onNewFile,onNewFolder:t.onNewFolder,onDelete:t.onDelete,onMove:t.onMove,onCopyInto:$,onCopy:t.onCopy,onPaste:t.onPaste,onDuplicate:t.onDuplicate,canPasteInto:t.canPasteInto,revealLabel:t.revealLabel,onReveal:t.onReveal,onAddToChat:t.onAddToChat,onCopyPath:t.onCopyPath,readOnly:t.readOnly,provenance:t.provenance,copyable:t.copyable,onDisk:t.onDisk,onUpload:t.onUpload,onPickUpload:t.onPickUpload});return e.jsx("div",{ref:m,role:"tree","aria-label":"File explorer",tabIndex:0,onKeyDown:N,onScroll:j,onDragOver:_,onDragLeave:()=>w(!1),onDrop:W,className:Pe("focus-visible:ring-ring h-full overflow-auto outline-none focus-visible:ring-1 focus-visible:ring-inset",g&&"ring-ring/60 bg-accent/30 ring-1 ring-inset"),children:F?e.jsx("div",{style:{height:D.getTotalSize()},className:"relative w-full",children:D.getVirtualItems().map(v=>e.jsx("div",{"data-row-index":v.index,className:"absolute top-0 left-0 w-full",style:{transform:`translateY(${v.start}px)`},children:P(n[v.index])},n[v.index].entry.path))}):n.map((v,z)=>e.jsx("div",{"data-row-index":z,children:P(v)},v.entry.path))})}function En(t){return t?t.type==="dir"?t.path:G(t.path):Q}function Dn(t,n){const{rows:a,selectedPath:x,renamingPath:p,onSelectPath:c}=t;return s.useCallback(o=>{var i,u,N,F;if(p!==null)return;const m=a.findIndex(D=>D.entry.path===x),r=m>=0?a[m]:void 0;if(o.metaKey||o.ctrlKey){if(t.readOnly===!0||t.copyable===!1)return;const D=o.key.toLowerCase();if(D==="c"&&r){o.preventDefault(),t.onCopy(r.entry);return}if(D==="v"){o.preventDefault(),t.onPaste(En(r==null?void 0:r.entry));return}return}switch(o.key){case"ArrowDown":o.preventDefault(),c(((i=a[Math.min(m+1,a.length-1)])==null?void 0:i.entry.path)??((u=a[0])==null?void 0:u.entry.path));break;case"ArrowUp":o.preventDefault(),c(((N=a[Math.max(m-1,0)])==null?void 0:N.entry.path)??((F=a[0])==null?void 0:F.entry.path));break;case"ArrowRight":(r==null?void 0:r.entry.type)==="dir"&&!r.expanded&&(o.preventDefault(),t.onToggle(r.entry));break;case"ArrowLeft":if(!r)break;if(o.preventDefault(),r.entry.type==="dir"&&r.expanded)t.onToggle(r.entry);else{const D=G(r.entry.path);D&&c(D)}break;case"Enter":r&&(o.preventDefault(),n(r.entry));break;case"F2":r&&t.readOnly!==!0&&(o.preventDefault(),t.onStartRename(r.entry));break;case"Delete":case"Backspace":r&&t.readOnly!==!0&&(o.preventDefault(),t.onDelete(r.entry));break}},[a,x,p,c,t,n])}const Nn={rename:"Rename it anyway",move:"Move it anyway",delete:"Delete it anyway",upload:"Upload mine over it"},Rn={rename:"nothing was renamed",move:"nothing was moved",delete:"nothing was deleted",upload:"nothing was uploaded"};function Sn(t){const{entry:n,fileCount:a,moreThan:x}=t;if(n.type!=="dir")return`“${n.name}” leaves the room’s files.`;const p=a===null?"everything in it":x?`the more than ${a.toLocaleString()} files in it`:a===1?"the 1 file in it":`the ${a.toLocaleString()} files in it`;return`“${n.name}” and ${p} leave the room’s files.`}const Tn="The room’s history keeps a copy. An agent can restore it.";function Fn({changes:t,onOpenTheirs:n,onReturnFocus:a}){var D;const x=L=>{L.preventDefault();const C=document.activeElement;C!==null&&C!==document.body||a()},{pendingDelete:p,pendingClash:c,conflict:o}=t,[m,r]=s.useState(p);p!==null&&p!==m&&r(p);const[i,u]=s.useState(c);c!==null&&c!==i&&u(c);const N=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(fe,{open:p!==null,onOpenChange:L=>!L&&t.cancelDelete(),children:e.jsxs(he,{onCloseAutoFocus:x,children:[e.jsxs(pe,{children:[e.jsx(me,{children:m===null?"":`Delete “${m.entry.name}”?`}),e.jsx(xe,{asChild:!0,children:e.jsxs("div",{className:"space-y-2",children:[e.jsx("p",{children:m===null?"":Sn(m)}),e.jsx("p",{children:Tn})]})})]}),e.jsxs(ge,{children:[e.jsx(ye,{onClick:t.cancelDelete,children:"Cancel"}),e.jsx(ve,{onClick:()=>void t.confirmDelete(),className:"bg-destructive hover:bg-destructive/90 dark:bg-destructive/60 text-white",children:(m==null?void 0:m.entry.type)==="dir"?"Delete folder":"Delete file"})]})]})}),e.jsx(fe,{open:c!==null,onOpenChange:L=>!L&&t.cancelClash(),children:e.jsxs(he,{onCloseAutoFocus:x,children:[e.jsxs(pe,{children:[e.jsx(me,{children:F?`Replace “${i==null?void 0:i.names[0]}”?`:`Replace ${(i==null?void 0:i.names.length)??0} files?`}),e.jsx(xe,{children:F?`${N} already has a file with this name. Replace it, or keep both.`:`${N} already has files named ${(i==null?void 0:i.names.join(", "))??""}. Replace them, or keep both.`})]}),e.jsxs(ge,{children:[e.jsx(ye,{onClick:t.cancelClash,children:"Cancel"}),e.jsx(Y,{variant:"outline",onClick:()=>void t.resolveClash("keep-both"),children:"Keep both"}),e.jsx(ve,{onClick:()=>void t.resolveClash("replace"),children:"Replace"})]})]})}),e.jsx(fe,{open:o!==null,onOpenChange:L=>!L&&t.dismissConflict(),children:e.jsxs(he,{onCloseAutoFocus:x,children:[e.jsxs(pe,{children:[e.jsx(me,{children:"Somebody changed this first"}),e.jsx(xe,{children:o===null?"":`${((D=o.lastCommit)==null?void 0:D.author)??"Somebody"} changed “${o.path}” after you opened it, so ${Rn[o.kind]}.`})]}),(o==null?void 0:o.lastCommit)&&e.jsxs("p",{className:"text-muted-foreground text-xs",children:[o.lastCommit.subject," · ",Ct(o.lastCommit.at)]}),e.jsxs(ge,{children:[e.jsx(ye,{onClick:t.dismissConflict,children:"Cancel"}),e.jsx(Y,{variant:"outline",onClick:()=>{o!==null&&(t.dismissConflict(),n(o.path))},children:"Open their version"}),e.jsx(ve,{onClick:()=>{o!==null&&(t.dismissConflict(),o.retry())},className:"bg-destructive hover:bg-destructive/90 dark:bg-destructive/60 text-white",children:o===null?"":Nn[o.kind]})]})]})})]})}function ze(t,n){return n.name===t?Ue(t):`“${n.name}” is already there. Some computers ignore capital letters in names. Pick another name.`}const Pn="Folders can’t be uploaded. Drop the files inside instead.";function On({source:t,className:n,onCommands:a}={}){var de;const x=ne(),p=Te(l=>l.selectedCwd),c=s.useMemo(()=>p?gn({transport:x,cwd:p}):null,[x,p]),o=t===void 0?c:t,m=o!==null&&!o.writable,r=xn(o),i=r.changes,u=oe(),N=H(l=>l.showHidden),{rows:F,rootLoading:D,rootError:L,rootErrorMessage:C,rootErrorCommand:q,errorPaths:I}=r,j=H(l=>l.setCommands),h=H(l=>l.selectedPath),g=H(l=>l.setSelectedPath),w=H(l=>l.clipboard),[b,S]=s.useState(null),[K,A]=s.useState(null),[_,$]=s.useState(null),W=s.useCallback(l=>$(l===null?null:{path:l,isNew:!1}),[]),P=s.useRef(null),v=s.useRef(Q),[z,B]=s.useState(!1),d=s.useCallback((l,M)=>{if(i!==null){if(M.length===0){X.error(Pn);return}r.ensureExpanded(l),i.upload(l,M)}},[i,r]),f=s.useRef(null),T=s.useCallback(()=>{var l,M;(M=(l=f.current)==null?void 0:l.querySelector('[role="tree"]'))==null||M.focus()},[]),y=s.useCallback(l=>{var M;v.current=l,(M=P.current)==null||M.click()},[]),O=s.useCallback(l=>w!==null&&!(w.isDir&&Ce(l,w.path)),[w]),E=s.useCallback((l,M)=>{r.ensureExpanded(l),_e.flushSync(()=>{A(null),S({parent:l,type:M})})},[r]),R=s.useCallback(l=>{_e.flushSync(()=>A(l.path))},[]),k=s.useRef({startCreate:E,reload:r.reload,pickUpload:y});s.useEffect(()=>{k.current={startCreate:E,reload:r.reload,pickUpload:y}});const U=i!==null;s.useEffect(()=>{if(m||a===void 0&&U)return;const l=a??j;return l({newFile:()=>k.current.startCreate(Q,"file"),newFolder:()=>k.current.startCreate(Q,"dir"),refresh:()=>k.current.reload(),...U&&{upload:()=>k.current.pickUpload(Q)}}),()=>l(null)},[j,a,m,U]);const te=s.useCallback(async l=>{var se;if(!b||o===null)return;const M=b;if(S(null),i!==null){const re=(((se=u.getQueryData(le(o,M.parent,N)))==null?void 0:se.entries)??[]).find(ot=>ot.name.toLowerCase()===l.toLowerCase());if(M.type==="dir"){if(re!==void 0&&!(re.type==="dir"&&re.name===l)){X.error(ze(l,re));return}S({parent:ee(M.parent,l),type:"file",firstInFolder:l});return}if(re!==void 0){X.error(ze(l,re));return}const rt=ee(M.parent,l);$({path:rt,isNew:!0});return}await r.createEntry(M.parent,l,M.type)&&g(ee(M.parent,l))},[b,o,i,u,N,r,g]),V=s.useCallback(async(l,M)=>{A(null),(i?await i.renameEntry(l,M):await r.renameEntry(l,M))&&g(ee(G(l.path),M))},[i,r,g]);return o===null?t!==void 0?null:e.jsx("div",{className:"text-muted-foreground flex h-full items-center justify-center p-6 text-center text-sm",children:"Pick a folder to see its files."}):e.jsxs("div",{ref:f,className:Pe("flex h-full flex-col",z&&"ring-ring/60 bg-accent/30 ring-1 ring-inset",n),onDragOver: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(),d(Q,st(l.dataTransfer).files))},children:[i!==null&&e.jsx("input",{ref:P,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="",d(v.current,M)}}),e.jsxs("div",{className:"min-h-0 flex-1",children:[b&&e.jsx(Mn,{type:b.type,firstInFolder:b.firstInFolder,onSubmit:l=>void te(l),onCancel:()=>S(null)},`${b.parent}:${b.type}:${b.firstInFolder??""}`),D&&F.length===0?e.jsx("div",{className:"flex h-20 items-center justify-center",children:e.jsx(Fe,{size:"md",className:"text-muted-foreground",label:"Loading files"})}):L&&F.length===0?e.jsxs("div",{className:"text-muted-foreground flex min-h-20 flex-col items-center justify-center gap-2 px-4 py-3 text-center text-xs [overflow-wrap:anywhere]",children:[e.jsx("span",{children:C??"Couldn’t load files."}),q!==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:q}),e.jsxs(Y,{variant:"outline",size:"xs",onClick:r.reload,children:[e.jsx(Ge,{}),"Retry"]})]}):F.length===0&&!b?e.jsx("div",{className:"text-muted-foreground/60 flex h-20 items-center justify-center px-4 text-center text-xs",children:i!==null?"No files yet. Drop files here, or use Upload.":"Empty folder"}):e.jsx(wn,{rows:F,selectedPath:h,renamingPath:K,errorPaths:I,onSelectPath:g,onToggle:r.toggleExpand,onOpen:l=>{o.preview==="inline"?W(l.path):r.openFile(l)},onRetryDir:r.retryDir,onSubmitRename:(l,M)=>void V(l,M),onCancelRename:()=>A(null),onStartRename:R,onNewFile:l=>E(l,"file"),onNewFolder:l=>E(l,"dir"),onDelete:l=>i?i.requestDelete(l):void r.removeEntry(l),onMove:(l,M)=>void(i?i.moveEntry(l,M):r.moveEntry(l,M)),onCopyInto:(l,M)=>void r.copyEntry(l,M),onCopy:r.copyToClipboard,onPaste:l=>{w&&r.copyEntry(w,l)},onDuplicate:l=>void r.copyEntry({path:l.path,isDir:l.type==="dir"},G(l.path)),canPasteInto:O,readOnly:m,provenance:o.provenance,copyable:i===null,onDisk:o.cwd!==null,onUpload:i?d:void 0,onPickUpload:i?y:void 0,revealLabel:r.revealLabel,onReveal:l=>void r.reveal(l),onAddToChat:r.addToChat,onCopyPath:(l,M)=>void r.copyPath(l,M)})]}),o.preview==="inline"&&e.jsx(Wt,{source:o,path:(_==null?void 0:_.path)??null,isNew:(_==null?void 0:_.isNew)??!1,onCreated:()=>{_!==null&&($({path:_.path,isNew:!1}),g(_.path))},onClose:()=>$(null)}),i!==null&&e.jsx(Fn,{changes:i,onOpenTheirs:l=>W(l),onReturnFocus:T}),e.jsx(fe,{open:r.pendingRecursiveDelete!==null,onOpenChange:l=>!l&&r.cancelRecursiveDelete(),children:e.jsxs(he,{children:[e.jsxs(pe,{children:[e.jsxs(me,{children:["Delete “",(de=r.pendingRecursiveDelete)==null?void 0:de.name,"”?"]}),e.jsx(xe,{children:"This folder isn’t empty. Everything inside is deleted. This can’t be undone."})]}),e.jsxs(ge,{children:[e.jsx(ye,{onClick:r.cancelRecursiveDelete,children:"Cancel"}),e.jsx(ve,{onClick:()=>void r.confirmRecursiveDelete(),className:"bg-destructive hover:bg-destructive/90 dark:bg-destructive/60 text-white",children:"Delete folder"})]})]})})]})}function Mn({type:t,firstInFolder:n,onSubmit:a,onCancel:x}){const p=s.useRef(null),[c,o]=s.useState("");s.useEffect(()=>{var i;(i=p.current)==null||i.focus()},[]);const m=()=>{const i=c.trim();i?a(i):x()},r=e.jsxs("div",{className:"flex items-center gap-1",children:[t==="dir"?e.jsx(be,{className:"size-(--size-icon-sm) flex-shrink-0 text-sky-500"}):e.jsx(Ve,{className:"text-muted-foreground size-(--size-icon-sm) flex-shrink-0"}),e.jsx("input",{ref:p,type:"text",value:c,"aria-label":n!==void 0?`First file in ${n}`:t==="dir"?"New folder name":"New file name",placeholder:t==="dir"?"folder-name":"file-name",onChange:i=>o(i.target.value),onBlur:m,onKeyDown:i=>{i.key==="Enter"?m():i.key==="Escape"&&x()},className:"border-border bg-background focus-ring min-w-0 flex-1 rounded border px-1 py-0 text-sm outline-none"})]});return n===void 0?e.jsx("div",{className:"px-3 py-1",children:r}):e.jsxs("div",{className:"space-y-1 px-3 py-1",children:[e.jsxs("p",{className:"text-muted-foreground flex min-w-0 items-center gap-1 text-xs",children:[e.jsx(be,{className:"size-(--size-icon-xs) flex-shrink-0 text-sky-500"}),e.jsx("span",{className:"truncate",children:n})]}),r,e.jsx("p",{className:"text-muted-foreground text-2xs",children:"Name its first file. The folder appears on save."})]})}function at(){const t=H(x=>x.showHidden),n=H(x=>x.setShowHidden),a=t?"Hide hidden files":"Show hidden files";return e.jsx(Y,{variant:"ghost",size:"icon-xs","aria-label":a,title:a,onClick:()=>n(!t),children:t?e.jsx(bt,{className:"text-muted-foreground"}):e.jsx(kt,{className:"text-muted-foreground"})})}function _n({cwd:t}){const n=ne(),{data:a}=ce({queryKey:["file-explorer","workspace",t],queryFn:()=>n.resolveWorkspace(t),staleTime:6e4});return a!=null&&a.branch?e.jsxs("span",{className:"text-muted-foreground bg-muted/50 text-2xs inline-flex min-w-0 items-center gap-1 rounded px-1.5 py-0.5",title:`Workspace ${a.key} on ${a.branch}`,children:[e.jsx(Ze,{className:"size-3 flex-shrink-0"}),e.jsx("span",{className:"truncate",children:a.branch})]}):null}function es(){const t=Te(a=>a.selectedCwd),n=H(a=>a.commands);return t?e.jsxs(e.Fragment,{children:[e.jsx(_n,{cwd:t}),e.jsx(Y,{variant:"ghost",size:"icon-xs","aria-label":"New file",title:"New file",onClick:()=>n==null?void 0:n.newFile(),children:e.jsx(et,{className:"text-muted-foreground"})}),e.jsx(Y,{variant:"ghost",size:"icon-xs","aria-label":"New folder",title:"New folder",onClick:()=>n==null?void 0:n.newFolder(),children:e.jsx(He,{className:"text-muted-foreground"})}),e.jsx(at,{}),e.jsx(Y,{variant:"ghost",size:"icon-xs","aria-label":"Refresh",title:"Refresh",onClick:()=>n==null?void 0:n.refresh(),children:e.jsx(jt,{className:"text-muted-foreground"})})]}):null}function An({roomId:t}){const n=ne(),a=oe(),x=ce(qe(n,t));s.useEffect(()=>Yt(a,t,()=>{a.invalidateQueries({queryKey:De.repoStatus(t)})}),[a,t]);const p=s.useMemo(()=>{var r;return((r=x.data)==null?void 0:r.kind)==="ok"?wt(x.data.status):[]},[x.data]),c=Et(p),o=Dt(p);if(!o)return null;const m=p.map((r,i)=>`${c[i]}: ${Nt(r)}`);return e.jsxs("span",{"data-slot":"pending-work-badge",title:m.join(`
|
|
17
|
-
`),className:"text-muted-foreground bg-muted/50 text-2xs inline-flex min-w-0 items-center gap-1 rounded px-1.5 py-0.5",children:[e.jsx(Ze,{className:"size-3 flex-shrink-0"}),e.jsxs("span",{className:"sr-only",children:["Not merged into the room yet. ",m.join(". "),"."]}),e.jsx("span",{"aria-hidden":"true",className:"truncate",children:o})]})}const Ln={added:"added",modified:"changed",deleted:"deleted",untracked:"new"},zn=new Map([["OPERATOR_ONLY","Only the owner of this DorkOS can keep or discard these."],["ROOM_FILE_NOT_FOUND","One of those changes is gone, so nothing was discarded. The list is refreshed."],["MERGE_IN_FLIGHT","Something else is writing to these files. Nothing changed. Try again in a moment."],["MAIN_CHECKOUT_DIRTY","These files are on another branch. Switch them back to main yourself."],["ROOM_REPO_GIT_UNAVAILABLE","Room files need git, and git isn’t installed on this computer."],["ROOM_HAS_NO_REPO","This room no longer has its own files."],["ROOM_REPOS_DISABLED","Room files are turned off on this install."]]);function $n({roomId:t}){var q,I;const n=ne(),a=oe(),x=ce(qe(n,t)),[p,c]=s.useState([]),[o,m]=s.useState(!1),[r,i]=s.useState(null),u=Rt({mutationFn:j=>n.repairRoomMain(t,j),onSuccess:()=>{c([]),m(!1),i(null),a.invalidateQueries({queryKey:De.repoStatus(t)})},onError:j=>{m(!1);const h=zn.get(St(j)??"");i(h??"Couldn’t update the files. Try again in a moment."),a.invalidateQueries({queryKey:De.repoStatus(t)})}});if(((q=x.data)==null?void 0:q.kind)==="unavailable")return e.jsx("p",{role:"alert","data-slot":"room-main-warning",className:"border-border/60 text-muted-foreground rounded-lg border px-3 py-2.5 text-xs",children:"Couldn’t check this room’s files. Saves may not work. Try again soon."});const N=((I=x.data)==null?void 0:I.kind)==="ok"?x.data.status.main:void 0;if(N===void 0||!N.dirty)return null;const F=N.branch!=="main",D=p.filter(j=>N.strays.some(h=>h.path===j)),L=o&&D.length>0,C=j=>c(h=>h.includes(j)?h.filter(g=>g!==j):[...h,j]);return e.jsxs("div",{"data-slot":"room-main-warning",className:"border-border/60 bg-muted/40 space-y-3 rounded-lg border px-3 py-2.5 text-sm",children:[e.jsxs("div",{className:"flex gap-2",children:[e.jsx(Tt,{className:"text-muted-foreground mt-0.5 size-(--size-icon-sm) flex-shrink-0"}),e.jsxs("div",{className:"min-w-0 space-y-1",children:[e.jsxs("div",{role:"alert",className:"space-y-1",children:[e.jsx("p",{className:"font-medium",children:"Somebody changed this room’s files outside DorkOS"}),F?e.jsxs(e.Fragment,{children:[e.jsx("p",{className:"text-muted-foreground text-xs",children:`This room’s files are on ${N.branch??"no branch"}, not main.`}),e.jsx("p",{className:"text-muted-foreground text-xs",children:"Saves and agent merges wait until they’re back on main."})]}):e.jsx("p",{className:"text-muted-foreground text-xs",children:"Saves and agent merges wait until you keep or discard these."})]}),F&&e.jsx(nn,{className:"text-xs",children:e.jsx("p",{children:"DorkOS won’t switch the branch for you. There may be work on it."})})]})]}),!F&&e.jsxs(e.Fragment,{children:[e.jsx("ul",{className:"space-y-1.5",children:N.strays.map(j=>e.jsxs("li",{className:"flex items-center gap-2",children:[e.jsx(Ft,{id:`stray-${t}-${j.path}`,checked:D.includes(j.path),onCheckedChange:()=>C(j.path),disabled:u.isPending}),e.jsx("label",{htmlFor:`stray-${t}-${j.path}`,className:"min-w-0 flex-1 cursor-pointer truncate font-mono text-xs",title:j.path,children:j.path}),e.jsx("span",{className:"text-muted-foreground flex-shrink-0 text-xs",children:Ln[j.kind]})]},j.path))}),N.strayCount>N.strays.length&&e.jsxs("p",{className:"text-muted-foreground text-xs",children:["…and ",N.strayCount-N.strays.length," more not shown. “Keep them all” keeps these too."]}),L?e.jsxs("div",{className:"space-y-2",children:[e.jsx("p",{className:"text-xs",children:D.length===1?"Discard this change? It can’t be undone.":`Discard these ${D.length} changes? They can’t be undone.`}),e.jsxs("div",{className:"flex flex-wrap gap-2",children:[e.jsx(Y,{type:"button",variant:"ghost",size:"sm",disabled:u.isPending,onClick:()=>m(!1),children:"Cancel"}),e.jsx(Y,{type:"button",variant:"destructive",size:"sm",disabled:u.isPending,onClick:()=>u.mutate({action:"discard",paths:[...D]}),children:D.length===1?"Discard change":`Discard ${D.length} changes`})]})]}):e.jsxs("div",{className:"flex flex-wrap gap-2",children:[e.jsx(Y,{type:"button",variant:"outline",size:"sm",disabled:u.isPending,onClick:()=>u.mutate({action:"commit"}),children:"Keep them all"}),e.jsx(Y,{type:"button",variant:"ghost",size:"sm",disabled:u.isPending||D.length===0,onClick:()=>m(!0),children:D.length===0?"Discard…":`Discard ${D.length}`})]})]}),r!==null&&e.jsx("p",{role:"alert",className:"text-destructive text-xs",children:r})]})}const Ee="pointer-coarse:size-11";function ts({roomId:t,canChange:n}){const a=ne(),x=oe(),p=H(F=>F.showHidden),[c,o]=s.useState(null),m=s.useMemo(()=>Be({transport:a,queryClient:x,roomId:t,canChange:n}),[a,x,t,n]),r=ce(je(m,Q,p,x)),i=r.isSuccess&&r.data.absent!==!0||r.isError,[u,N]=s.useState(null);return i&&u!==t&&N(t),!i&&u!==t?null:e.jsxs("section",{"aria-label":"Room files",className:"space-y-2",children:[e.jsxs("header",{className:"flex items-center gap-2",children:[e.jsx(Pt,{className:"text-muted-foreground size-(--size-icon-sm) flex-shrink-0"}),e.jsx("h3",{className:"text-muted-foreground text-xs font-medium tracking-wide uppercase",children:"Files"}),e.jsx("div",{className:"min-w-0 flex-1",children:e.jsx(An,{roomId:t})}),n&&e.jsxs(e.Fragment,{children:[e.jsx(Y,{variant:"ghost",size:"icon-xs",className:Ee,"aria-label":"New file",title:"New file",disabled:c===null,onClick:()=>c==null?void 0:c.newFile(),children:e.jsx(et,{className:"text-muted-foreground"})}),e.jsx(Y,{variant:"ghost",size:"icon-xs",className:Ee,"aria-label":"New folder",title:"New folder",disabled:c===null,onClick:()=>c==null?void 0:c.newFolder(),children:e.jsx(He,{className:"text-muted-foreground"})}),e.jsx(Y,{variant:"ghost",size:"icon-xs",className:Ee,"aria-label":"Upload files",title:"Upload files",disabled:(c==null?void 0:c.upload)===void 0,onClick:()=>{var F;return(F=c==null?void 0:c.upload)==null?void 0:F.call(c)},children:e.jsx(an,{className:"text-muted-foreground"})})]}),e.jsx(at,{})]}),e.jsx($n,{roomId:t}),e.jsx("div",{"data-slot":"room-files-body",className:"border-border/60 h-72 overflow-hidden rounded-lg border",children:e.jsx(On,{source:m,onCommands:o})})]})}function ns({roomId:t,attachment:n}){var i;const a=ne(),x=oe(),p=s.useMemo(()=>Be({transport:a,queryClient:x,roomId:t}),[a,x,t]),c=ce(je(p,Q,!1,x)),[o,m]=s.useState(!1),r=Ot(t);return!c.isSuccess||c.data.absent===!0||((i=r.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:()=>m(!0),children:e.jsx(Mt,{})}),o&&e.jsx(In,{roomId:t,source:p,attachment:n,onClose:()=>m(!1)})]})}function In({roomId:t,source:n,attachment:a,onClose:x}){const p=ne(),c=oe(),[o,m]=s.useState(Q),[r,i]=s.useState(a.name),[u,N]=s.useState(null),[F,D]=s.useState(!1),L=s.useId(),C=ce(je(n,o,!1,c)),q=s.useMemo(()=>{var j;return nt(((j=C.data)==null?void 0:j.entries)??[]).filter(h=>h.type==="dir")},[C.data]),I=async()=>{var h,g;const j=r.trim();if(j!==""){D(!0),N(null);try{await p.saveAttachmentToRoomFiles(t,{attachmentId:a.id,dir:o,name:j,baseCommit:((h=C.data)==null?void 0:h.commit)??null}),c.invalidateQueries({queryKey:["file-explorer","tree",n.scopeKey]}),X.success(`Saved ${j} to the room’s files`),x()}catch(w){let b;try{b=Gt(w,c,t)}catch{b={status:"refused",reason:Qe(w)??"Couldn’t save. Try again in a moment."}}if(b.status==="exists"){const S=(((g=C.data)==null?void 0:g.entries)??[]).map(K=>K.name);N({reason:`This folder already has a file called “${j}”. Pick another name.`,suggestion:Oe({name:j,isDir:!1,taken:[...S,j]})})}else b.status==="conflict"?(N({reason:"This folder changed while you chose, so nothing was saved. Try again."}),C.refetch()):b.status==="refused"&&N({reason:b.reason})}finally{D(!1)}}};return e.jsx(_t,{open:!0,onOpenChange:j=>!j&&x(),children:e.jsxs(At,{className:"sm:max-w-md",children:[e.jsxs(Lt,{children:[e.jsx(zt,{children:"Save to room files"}),e.jsx($t,{children:"Everyone in the room, and their agents, can find it there."})]}),e.jsxs(It,{className:"space-y-3",children:[e.jsxs("div",{className:"space-y-1",children:[e.jsx("p",{className:"text-muted-foreground text-xs font-medium",children:"Folder"}),e.jsxs("div",{role:"group","aria-label":"Folders",className:"border-border/60 max-h-56 overflow-auto rounded-md border",children:[e.jsx("p",{className:"bg-muted/40 truncate px-3 py-1.5 font-mono text-xs",children:o===Q?"Top folder":`${o}/`}),o!==Q&&e.jsx($e,{label:"Up one folder",icon:e.jsx(sn,{className:"text-muted-foreground size-(--size-icon-sm)"}),onClick:()=>m(G(o))}),C.isPending?e.jsx("div",{className:"flex h-12 items-center justify-center",children:e.jsx(Fe,{size:"sm",className:"text-muted-foreground",label:"Loading folders"})}):q.length===0?e.jsx("p",{className:"text-muted-foreground px-3 py-2 text-xs",children:"No folders in here."}):q.map(j=>e.jsx($e,{label:j.name,icon:e.jsx(be,{className:"size-(--size-icon-sm) text-sky-500"}),chevron:!0,onClick:()=>m(ee(o,ie(j.path)))},j.path))]})]}),e.jsxs("div",{className:"space-y-1",children:[e.jsx("label",{htmlFor:L,className:"text-muted-foreground text-xs font-medium",children:"Name"}),e.jsx(Kt,{id:L,value:r,onChange:j=>{i(j.target.value),N(null)},spellCheck:!1,autoComplete:"off"})]}),u!==null&&e.jsxs("div",{role:"alert",className:"text-destructive space-y-1 text-xs",children:[e.jsx("p",{children:u.reason}),u.suggestion!==void 0&&e.jsxs(Y,{type:"button",variant:"outline",size:"xs",onClick:()=>{i(u.suggestion),N(null)},children:["Use “",u.suggestion,"”"]})]})]}),e.jsxs(Ht,{className:"gap-2",children:[e.jsx(Y,{type:"button",variant:"ghost",onClick:x,children:"Cancel"}),e.jsx(Y,{type:"button",disabled:F||r.trim()===""||C.isPending,onClick:()=>void I(),children:F?"Saving…":o===Q?"Save to the top folder":`Save to ${ie(o)}`})]})]})})}function $e({label:t,icon:n,chevron:a=!1,onClick:x}){return e.jsxs("button",{type:"button",onClick:x,className:"hover:bg-accent/50 focus-visible:bg-accent flex w-full items-center gap-2 px-3 py-1.5 text-left text-sm outline-none",children:[n,e.jsx("span",{className:"min-w-0 flex-1 truncate",children:t}),a&&e.jsx(Ke,{className:"text-muted-foreground size-3.5"})]})}export{On as FileExplorer,es as FileExplorerActions,Wt as FilePreviewDialog,rn as HIDDEN_ENTRY_NAMES,at as HiddenEntriesToggle,rs as NO_PROVENANCE,Ne as PINNED_ENTRY_NAMES,os as ROOM_FILES_REFRESH_INTERVAL_MS,ts as RoomFilesSection,ns as SaveToRoomFilesButton,Be as createRoomFilesSource,gn as createSessionCwdSource,le as explorerDirQueryKey,je as explorerDirQueryOptions,on as isHiddenEntryName,Re as isPinnedEntryName,ln as pinnedFirst,Bt as provenanceLine,qe as roomRepoStatusQueryOptions,nt as withoutHidden};
|
|
16
|
+
*/const tt={name:"upload",size:24,node:[["path",{d:"M12 3v12",key:"1x0j5s"}],["path",{d:"m17 8-5-5-5 5",key:"7q97r8"}],["path",{d:"M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4",key:"ih7n3h"}]]};tt.node;const an=Se(tt);function le(t,n,a){return["file-explorer","tree",t.scopeKey,n,t.filtersHidden?a:null]}function ke(t,n,a,x){return{queryKey:le(t,n,a),queryFn:()=>t.list(n,{showHidden:a}),staleTime:Me.FILE_TREE_STALE_TIME_MS,gcTime:Me.FILE_TREE_GC_TIME_MS,refetchOnWindowFocus:!0,placeholderData:p=>p??x.getQueryData(le(t,n,!a))}}const rn=[".git",".dork",".claude",".agents","node_modules"];function on(t){return t.startsWith(".")||rn.includes(t)}const Ne=["ROOM.md","README.md"];function Re(t){return Ne.some(n=>n.toLowerCase()===t.toLowerCase())}function nt(t){return t.filter(n=>!on(n.name))}function ln(t){if(t.reduce((p,c)=>c.type==="file"&&Re(c.name)?p+1:p,0)===0)return t;const a=[],x=[];for(const p of t)p.type==="file"&&Re(p.name)?a.push(p):x.push(p);return a.sort((p,c)=>Ne.findIndex(o=>o.toLowerCase()===p.name.toLowerCase())-Ne.findIndex(o=>o.toLowerCase()===c.name.toLowerCase())),[...a,...x]}const cn=/ copy(?: \d+)?$/;function Oe({name:t,isDir:n,taken:a}){const x=new Set(a);if(!x.has(t))return t;const p=n?-1:t.lastIndexOf("."),c=p>0,o=c?t.slice(p):"",m=(c?t.slice(0,p):t).replace(cn,"");for(let r=1;;r+=1){const i=r===1?`${m} copy${o}`:`${m} copy ${r}${o}`;if(!x.has(i))return i}}function Ae(t,n,a){return{name:n,path:t,type:a,size:0,mtime:Date.now(),isSymlink:!1}}function dn(t){const n=ne(),{source:a,showHidden:x,queryClient:p,inFlightRef:c}=t,o=a.cwd??"",[m,r]=s.useState(null),i=s.useCallback(async h=>{c.current+=1;try{return await h()}finally{c.current-=1}},[c]),u=s.useMemo(()=>{const h=g=>le(a,g,x);return{getChildren:g=>{var w;return((w=p.getQueryData(h(g)))==null?void 0:w.entries)??[]},isLoaded:g=>p.getQueryData(h(g))!==void 0,takenNames:async g=>(await n.readFileTree(o,{path:g===Q?void 0:g,showHidden:!0})).entries.map(b=>b.name),snapshot:g=>p.getQueryData(h(g)),setChildren:(g,w)=>{p.setQueryData(h(g),b=>({entries:Ie(w((b==null?void 0:b.entries)??[]))}))},restore:(g,w)=>{p.setQueryData(h(g),w)},invalidate:g=>{p.invalidateQueries({queryKey:h(g),exact:!0}),p.invalidateQueries({queryKey:Vt.index(o)})}}},[p,n,o,a,x]),N=s.useCallback((h,g,w)=>i(async()=>{const b=ee(h,g),S=!u.getChildren(h).some(A=>A.path===b),K=u.snapshot(h);S&&u.setChildren(h,A=>[...A,Ae(b,g,w)]);try{return await n.createEntry(o,b,w),!0}catch(A){return S&&u.restore(h,K),ae(A,`Couldn’t create ${w==="dir"?"folder":"file"}`),!1}finally{u.invalidate(h)}}),[n,o,u,i]),F=s.useCallback((h,g)=>i(async()=>{if(g===h.name||g.length===0)return!0;const w=G(h.path),b=ee(w,g),S=u.getChildren(w).some(_=>_.path===b),K=u.snapshot(w),A={...h,name:g,path:b};S||u.setChildren(w,_=>_.map($=>$.path===h.path?A:$));try{return await n.renameEntry(o,h.path,b),H.getState().remapExpandedPaths(h.path,b),!0}catch(_){return S||u.restore(w,K),ae(_,"Couldn’t rename"),!1}finally{u.invalidate(w)}}),[n,o,u,i]),D=s.useCallback(h=>i(async()=>{const g=G(h.path),w=u.snapshot(g);u.setChildren(g,b=>b.filter(S=>S.path!==h.path));try{await n.deleteEntry(o,h.path,{recursive:!0}),H.getState().dropExpandedPaths(h.path)}catch(b){u.restore(g,w),ae(b,"Couldn’t delete")}finally{u.invalidate(g)}}),[n,o,u,i]),L=s.useCallback(h=>i(async()=>{const g=G(h.path);if(h.type==="file"){const w=u.snapshot(g);u.setChildren(g,b=>b.filter(S=>S.path!==h.path));try{await n.deleteEntry(o,h.path),H.getState().dropExpandedPaths(h.path)}catch(b){u.restore(g,w),ae(b,"Couldn’t delete")}finally{u.invalidate(g)}return}try{await n.deleteEntry(o,h.path),u.setChildren(g,w=>w.filter(b=>b.path!==h.path)),H.getState().dropExpandedPaths(h.path),u.invalidate(g)}catch(w){if(Ut(w)==="DIR_NOT_EMPTY"){r(h);return}ae(w,"Couldn’t delete")}}),[n,o,u,i]),C=s.useCallback(async()=>{const h=m;r(null),h&&await D(h)},[m,D]),U=s.useCallback(()=>r(null),[]),I=s.useCallback((h,g)=>i(async()=>{const w=G(h),b=ie(h),S=ee(g,b);if(g===w||S===h||Ce(g,h))return;const K=u.getChildren(w).find(v=>v.path===h);if(!K)return;const A=u.isLoaded(g),_=A&&u.getChildren(g).some(v=>v.path===S),$={...K,name:b,path:S},W=u.snapshot(w),P=A?u.snapshot(g):void 0;u.setChildren(w,v=>v.filter(z=>z.path!==h)),A&&!_&&u.setChildren(g,v=>[...v,$]);try{await n.renameEntry(o,h,S),H.getState().remapExpandedPaths(h,S)}catch(v){u.restore(w,W),A&&!_&&u.restore(g,P),ae(v,"Couldn’t move")}finally{u.invalidate(w),A&&u.invalidate(g)}}),[n,o,u,i]),k=s.useCallback((h,g)=>i(async()=>{if(h.isDir&&Ce(g,h.path)){J.error(qt);return}let w;try{w=await u.takenNames(g)}catch(_){ae(_,"Couldn’t copy");return}const b=Oe({name:ie(h.path),isDir:h.isDir,taken:w}),S=ee(g,b),K=u.isLoaded(g),A=K?u.snapshot(g):void 0;if(K){const _=u.getChildren(G(h.path)).find(W=>W.path===h.path),$=_?{..._,name:b,path:S}:Ae(S,b,h.isDir?"dir":"file");u.setChildren(g,W=>[...W,$])}try{await n.copyEntry(o,h.path,S)}catch(_){K&&u.restore(g,A),ae(_,"Couldn’t copy")}finally{u.invalidate(g)}}),[n,o,u,i]);return{createEntry:N,renameEntry:F,removeEntry:L,moveEntry:I,copyEntry:k,pendingRecursiveDelete:m,confirmRecursiveDelete:C,cancelRecursiveDelete:U}}function un(t){return t!=null&&t.startsWith("darwin")?"Reveal in Finder":t!=null&&t.startsWith("win32")?"Reveal in File Explorer":"Show in file manager"}function fn(t,n){const a=t.includes("\\")&&!t.includes("/"),x=t.replace(/[\\/]+$/,""),p=a?n.split("/").join("\\"):n;return`${x}${a?"\\":"/"}${p}`}function hn(t){const n=ne(),{data:a}=it(),x=s.useMemo(()=>n.supportsReveal?un(a==null?void 0:a.platform):null,[n.supportsReveal,a==null?void 0:a.platform]),p=s.useCallback(async i=>{if(t)try{await n.revealEntry(t,i.path)}catch(u){ae(u,"Couldn’t open the file manager")}},[n,t]),{copy:c}=lt(),o=s.useCallback(async(i,u)=>{const N=u==="absolute"&&t?fn(t,i.path):i.path;await c(N)||J.error("Couldn’t copy to the clipboard")},[t,c]),m=s.useCallback(i=>{Xt(Zt(i.path))||J.error("Open a chat to add this file")},[]),r=s.useCallback(i=>{H.getState().setClipboard({path:i.path,isDir:i.type==="dir"});try{navigator.clipboard.writeText(i.path).catch(()=>{})}catch{}},[]);return{revealLabel:x,reveal:p,copyPath:o,addToChat:m,copyToClipboard:r}}const pn=1e3;function mn(t){const{source:n,showHidden:a,queryClient:x,inFlightRef:p}=t,c=n.changes,[o,m]=s.useState(null),[r,i]=s.useState(null),[u,N]=s.useState(null),[F,D]=s.useState(0),L=s.useCallback(async d=>{p.current+=1,D(f=>f+1);try{return await d()}finally{p.current-=1,D(f=>f-1)}},[p]),C=s.useMemo(()=>{const d=f=>le(n,f,a);return{listing:f=>x.getQueryData(d(f)),isLoaded:f=>x.getQueryData(d(f))!==void 0,entries:f=>{var T;return((T=x.getQueryData(d(f)))==null?void 0:T.entries)??[]},setEntries:(f,T)=>x.setQueryData(d(f),y=>({...y,entries:Ie(T((y==null?void 0:y.entries)??[]))})),restore:(f,T)=>x.setQueryData(d(f),T),fetch:f=>n.list(f,{showHidden:!0}),refreshAll:()=>{x.invalidateQueries({queryKey:["file-explorer","tree",n.scopeKey]}),x.invalidateQueries({queryKey:["file-explorer","preview",n.scopeKey]})}}},[x,n,a]),U=s.useCallback(async d=>{const f=C.listing(d);return(f==null?void 0:f.commit)!==void 0?f.commit:(await C.fetch(d)).commit??null},[C]),I=s.useCallback((d,f,T,y)=>{switch(d.status){case"changed":return!0;case"conflict":return N({kind:f,path:d.path,lastCommit:d.lastCommit,retry:()=>T(d.commit)}),!1;case"exists":return J.error(y===void 0?d.reason:qe(y)),!1;case"refused":return J.error(d.reason),!1}},[]),k=s.useCallback((d,f)=>{J.error(Qe(d)??f)},[]),h=s.useCallback((d,f,T)=>{const y=O=>L(async()=>{if(c===void 0)return!1;const E=G(d.path),R=G(f),j=ie(f),q=C.isLoaded(R),te=q&&C.entries(R).some(X=>X.path===f),V=C.listing(E),de=R===E?void 0:C.listing(R),l={...d,name:j,path:f};te||(R===E?C.setEntries(E,X=>X.map(se=>se.path===d.path?l:se)):(C.setEntries(E,X=>X.filter(se=>se.path!==d.path)),q&&C.setEntries(R,X=>[...X,l])));const M=()=>{C.restore(E,V),R!==E&&q&&C.restore(R,de)};try{const X=O??await U(E);if(X===null)return M(),J.error("This room has no files to change yet."),!1;const se=await c.move({from:d.path,to:f,baseCommit:X}),we=I(se,T,async re=>{await y(re)},j);return we?H.getState().remapExpandedPaths(d.path,f):M(),we}catch(X){return M(),k(X,T==="rename"?"Couldn’t rename":"Couldn’t move"),!1}finally{C.refreshAll()}});return y(null)},[c,C,L,U,I,k]),g=s.useCallback(async(d,f)=>f===d.name||f.length===0?!0:h(d,ee(G(d.path),f),"rename"),[h]),w=s.useCallback(async(d,f)=>{const T=G(d),y=ee(f,ie(d));if(f===T||y===d||Ce(f,d))return;const O=C.entries(T).find(E=>E.path===d);O&&await h(O,y,"move")},[C,h]),b=s.useCallback(async d=>{let f=0;const T=[d];for(;T.length>0;){const y=T.shift(),O=await C.fetch(y);for(const E of O.entries)if(E.type==="dir"?T.push(E.path):f+=1,f>=pn)return{count:f,moreThan:!0}}return{count:f,moreThan:!1}},[C]),S=s.useCallback(d=>{if(d.type!=="dir"){m({entry:d,fileCount:1,moreThan:!1});return}m({entry:d,fileCount:null,moreThan:!1}),b(d.path).then(({count:f,moreThan:T})=>m(y=>(y==null?void 0:y.entry.path)===d.path?{entry:d,fileCount:f,moreThan:T}:y),()=>{})},[b]),K=s.useCallback(d=>{const f=T=>L(async()=>{if(c===void 0)return;const y=G(d.path),O=C.listing(y);C.setEntries(y,E=>E.filter(R=>R.path!==d.path));try{const E=T??await U(y);if(E===null){C.restore(y,O);return}const R=await c.remove({path:d.path,baseCommit:E});I(R,"delete",q=>f(q))?H.getState().dropExpandedPaths(d.path):C.restore(y,O)}catch(E){C.restore(y,O),k(E,"Couldn’t delete")}finally{C.refreshAll()}});return f(null)},[c,C,L,U,I,k]),A=s.useCallback(async()=>{const d=o;m(null),d&&await K(d.entry)},[o,K]),_=s.useCallback(()=>m(null),[]),$=s.useCallback((d,f,T,y)=>{const O=E=>L(async()=>{if(c===void 0)return;const R=C.isLoaded(d),j=R?C.listing(d):void 0;if(R){const q=new Set(C.entries(d).map(V=>V.name)),te=f.filter(V=>!q.has(V.name)).map(V=>({name:V.name,path:ee(d,V.name),type:"file",size:V.size}));te.length>0&&C.setEntries(d,V=>[...V,...te])}try{const q=await c.upload({dir:d,baseCommit:E,replace:T,files:f});!I(q,"upload",V=>O(V))&&R&&C.restore(d,j)}catch(q){R&&C.restore(d,j),k(q,"Couldn’t upload")}finally{C.refreshAll()}});return O(y)},[c,C,L,I,k]),W=s.useCallback(async(d,f)=>{if(c===void 0||f.length===0)return;if(f.length>c.maxUploadFiles){J.error(`Nothing was uploaded. One upload takes up to ${c.maxUploadFiles} files.`);return}let T;try{T=await C.fetch(d)}catch(j){k(j,"Couldn’t upload");return}const y=T.entries.map(j=>j.name),O=new Set(y),E=f.map(j=>j.name).filter(j=>O.has(j)),R=T.commit??null;if(E.length===0){await $(d,f,[],R);return}i({dir:d,files:f,names:E,taken:y,baseCommit:R})},[c,C,k,$]),P=s.useCallback(async d=>{const f=r;if(i(null),f===null)return;if(d==="replace"){await $(f.dir,f.files,f.names,f.baseCommit);return}const T=new Set([...f.taken,...f.files.map(E=>E.name)]),y=new Set(f.names),O=f.files.map(E=>{if(!y.has(E.name))return E;const R=Oe({name:E.name,isDir:!1,taken:T});return T.add(R),new File([E],R,{type:E.type,lastModified:E.lastModified})});await $(f.dir,O,[],f.baseCommit)},[r,$]),v=s.useCallback(()=>i(null),[]),z=s.useCallback(()=>N(null),[]),B=s.useMemo(()=>r===null?null:{dir:r.dir,names:r.names},[r]);return{renameEntry:g,moveEntry:w,requestDelete:S,pendingDelete:o,confirmDelete:A,cancelDelete:_,upload:W,pendingClash:B,resolveClash:P,cancelClash:v,conflict:u,dismissConflict:z,busy:F>0}}const Le={scopeKey:"",cwd:null,writable:!1,provenance:!1,filtersHidden:!0,preview:"canvas",editable:!1,list:()=>Promise.resolve({entries:[]})};function xn(t){var d,f,T;const n=ne(),a=oe(),{setTheme:x}=ct(),p=H(y=>y.showHidden),c=H(y=>y.expanded),o=H(y=>y.loadExplorerForCwd),m=H(y=>y.pruneMissing),r=(t==null?void 0:t.scopeKey)??null,i=(t==null?void 0:t.cwd)??null;s.useEffect(()=>{o(r)},[r,o]);const u=s.useMemo(()=>[Q,...dt(c)],[c]),N=ut({queries:t?u.map(y=>ke(t,y,p,a)):[]}),F=(t==null?void 0:t.filtersHidden)??!0,D=s.useMemo(()=>{const y={};return u.forEach((O,E)=>{var q;const R=N[E];let j=((q=R==null?void 0:R.data)==null?void 0:q.entries)??[];!p&&!F&&(j=nt(j)),O===Q&&(j=ln(j)),y[O]={entries:j,loading:(R==null?void 0:R.isLoading)??!1,error:(R==null?void 0:R.isError)??!1}}),y},[u,N,p,F]),L=s.useRef(0),C=s.useRef({});s.useEffect(()=>{L.current>0||u.forEach((y,O)=>{var R,j,q;const E=(j=(R=N[O])==null?void 0:R.data)==null?void 0:j.entries;!E||(q=N[O])!=null&&q.isError||C.current[y]!==E&&(C.current[y]=E,m(y,E.map(te=>te.name)))})},[u,N,m]);const U=s.useMemo(()=>ft(c,D),[c,D]),I=!!t&&!!((d=D[Q])!=null&&d.loading),k=!!t&&!!((f=D[Q])!=null&&f.error),h=(T=N[0])==null?void 0:T.error,g=k&&h?Qt(h):void 0,w=(g==null?void 0:g.message)??null,b=(g==null?void 0:g.command)??null,S=s.useMemo(()=>{var O;const y=new Set;for(const E of u)E!==Q&&((O=D[E])!=null&&O.error)&&y.add(E);return y},[u,D]),K=s.useCallback(y=>{if(y.type!=="dir")return;const O=H.getState();O.setDirExpanded(y.path,!O.expanded[y.path])},[]),A=s.useCallback(y=>{if(y===Q)return;const O=H.getState();O.expanded[y]||O.setDirExpanded(y,!0)},[]),_=(t==null?void 0:t.preview)==="canvas",$=s.useCallback(y=>{if(y.type!=="file"||!_)return;const O={getStore:Te.getState,setTheme:x,supportsTerminal:n.supportsTerminal};ht(O,{action:"open_file",sourcePath:y.path},"user")},[_,x,n]),W=s.useCallback(()=>{r!==null&&a.invalidateQueries({queryKey:["file-explorer","tree",r]})},[a,r]),P=s.useCallback(y=>{t!==null&&a.invalidateQueries({queryKey:le(t,y,p),exact:!0})},[a,t,p]);s.useEffect(()=>{if(t!=null&&t.events)return t.events(W)},[t,W]);const v=dn({source:t??Le,showHidden:p,queryClient:a,inFlightRef:L}),z=mn({source:t??Le,showHidden:p,queryClient:a,inFlightRef:L}),B=hn(i);return{rows:U,rootLoading:I,rootError:k,rootErrorMessage:w,rootErrorCommand:b,errorPaths:S,toggleExpand:K,ensureExpanded:A,openFile:$,reload:W,retryDir:P,changes:t!=null&&t.changes?z:null,...v,...B}}function gn(t){const{transport:n,cwd:a}=t;return{scopeKey:a,cwd:a,writable:!0,provenance:!1,filtersHidden:!0,preview:"canvas",editable:!1,list(x,p){return n.readFileTree(a,{path:x===""?void 0:x,showHidden:p.showHidden})}}}function je(t){return Array.from(t).includes("Files")}function st(t){const n=Array.from(t.items??[]);if(!(n.length>0&&n.every(c=>"webkitGetAsEntry"in c)))return{files:Array.from(t.files??[]),folders:0};const x=[];let p=0;for(const c of n){if(c.kind!=="file")continue;const o=c.webkitGetAsEntry();if(o!=null&&o.isDirectory){p+=1;continue}const m=c.getAsFile();m&&x.push(m)}return{files:x,folders:p}}const yn=12;function vn({row:t,selected:n,renaming:a,error:x,onSelect:p,onActivate:c,onRetry:o,onSubmitRename:m,onCancelRename:r,onNewFile:i,onNewFolder:u,onStartRename:N,onDelete:F,onMove:D,onCopyInto:L,onCopy:C,onPaste:U,onDuplicate:I,canPasteInto:k,revealLabel:h,onReveal:g,onAddToChat:w,onCopyPath:b,readOnly:S=!1,provenance:K=!1,copyable:A=!0,onDisk:_=!0,onUpload:$,onPickUpload:W}){const{entry:P,depth:v,expanded:z,loading:B}=t,d=P.type==="dir",f=d?P.path:G(P.path),[T,y]=s.useState(!1),O=!d&&v===0&&Re(P.name),E=Bt(P.lastCommit),R=e.jsxs("div",{role:"treeitem","aria-label":P.name,"aria-expanded":d?z:void 0,"aria-selected":n,tabIndex:-1,onKeyDown:j=>{(j.key==="Enter"||j.key===" ")&&(j.preventDefault(),p(P),c(P))},draggable:!a&&!S,onDragStart:j=>{S||(j.dataTransfer.setData("text/plain",P.path),j.dataTransfer.setData(en,P.path),j.dataTransfer.effectAllowed="copyMove")},onDragOver:j=>{if(j.stopPropagation(),!S&&$&&je(j.dataTransfer.types)){j.preventDefault(),j.dataTransfer.dropEffect="copy",y(!0);return}S||!d||!Ye(j.dataTransfer.types)||(j.preventDefault(),j.dataTransfer.dropEffect=j.altKey&&A?"copy":"move",y(!0))},onDragLeave:()=>y(!1),onDrop:j=>{if(j.stopPropagation(),S)return;if(y(!1),$&&je(j.dataTransfer.types)){j.preventDefault();const{files:te}=st(j.dataTransfer);$(f,te);return}if(!d)return;const q=We(j.dataTransfer);q!==null&&(j.preventDefault(),j.altKey&&A?L(q,P.path):D(q,P.path))},onClick:()=>{p(P),c(P)},className:Pe("flex w-full cursor-pointer items-center gap-1 py-1 pr-2 text-sm transition-colors",n?"bg-accent text-foreground":"hover:bg-accent/50",T&&"ring-ring/60 bg-accent ring-1"),style:{paddingLeft:v*yn+8},children:[e.jsx("span",{className:"flex size-4 flex-shrink-0 items-center justify-center",children:d&&(B?e.jsx(Fe,{size:"xs",className:"text-muted-foreground"}):x?e.jsx("button",{type:"button","aria-label":"Retry loading",title:"Couldn’t load. Retry",onClick:j=>{j.stopPropagation(),o()},className:"flex items-center justify-center",children:e.jsx(Ge,{className:"text-destructive size-3.5"})}):z?e.jsx(pt,{className:"text-muted-foreground size-3.5"}):e.jsx(Ke,{className:"text-muted-foreground size-3.5"}))}),d?z?e.jsx(mt,{className:"size-(--size-icon-sm) flex-shrink-0 text-sky-500"}):e.jsx(be,{className:"size-(--size-icon-sm) flex-shrink-0 text-sky-500"}):P.isSymlink===!0?e.jsx(tn,{className:"text-muted-foreground size-(--size-icon-sm) flex-shrink-0"}):e.jsx(Ve,{className:"text-muted-foreground size-(--size-icon-sm) flex-shrink-0"}),a?e.jsx(Cn,{initialName:P.name,onSubmit:j=>m(P,j),onCancel:r}):e.jsx("span",{className:"min-w-0 flex-1 truncate",children:P.name}),O&&!a&&e.jsx(xt,{"aria-label":"Pinned to the top",className:"text-muted-foreground/60 size-3 flex-shrink-0"}),K&&!a&&e.jsx("span",{className:"text-muted-foreground/70 text-2xs max-w-[45%] flex-shrink-0 truncate tabular-nums",title:E.title??void 0,children:E.label})]});return S?R:e.jsxs(gt,{children:[e.jsx(yt,{asChild:!0,children:R}),e.jsxs(vt,{className:"w-52",children:[e.jsx(Z,{movesFocus:!0,onClick:()=>i(f),children:"New file"}),e.jsx(Z,{movesFocus:!0,onClick:()=>u(f),children:"New folder"}),W&&e.jsx(Z,{onClick:()=>W(f),children:"Upload files…"}),_&&e.jsxs(e.Fragment,{children:[e.jsx(ue,{}),h&&e.jsx(Z,{onClick:()=>g(P),children:h}),e.jsx(Z,{movesFocus:!0,onClick:()=>w(P),children:"Add to chat"})]}),A&&e.jsxs(e.Fragment,{children:[e.jsx(ue,{}),e.jsx(Z,{onClick:()=>C(P),children:"Copy"}),e.jsx(Z,{disabled:!k(f),onClick:()=>U(f),children:"Paste"}),e.jsx(Z,{onClick:()=>I(P),children:"Duplicate"})]}),e.jsx(ue,{}),_?e.jsxs(e.Fragment,{children:[e.jsx(Z,{onClick:()=>b(P,"absolute"),children:"Copy path"}),e.jsx(Z,{onClick:()=>b(P,"relative"),children:"Copy relative path"})]}):e.jsx(Z,{onClick:()=>b(P,"relative"),children:"Copy path"}),e.jsx(ue,{}),e.jsx(Z,{movesFocus:!0,onClick:()=>N(P),children:"Rename"}),e.jsx(Z,{variant:"destructive",onClick:()=>F(P),children:"Delete"})]})]})}function Cn({initialName:t,onSubmit:n,onCancel:a}){const x=s.useRef(null),[p,c]=s.useState(t);s.useEffect(()=>{const m=x.current;if(!m)return;m.focus();const r=t.lastIndexOf(".");m.setSelectionRange(0,r>0?r:t.length)},[t]);const o=()=>{const m=p.trim();m&&m!==t?n(m):a()};return e.jsx("input",{ref:x,type:"text",value:p,"aria-label":"New name",onChange:m=>c(m.target.value),onClick:m=>m.stopPropagation(),onBlur:o,onKeyDown:m=>{m.stopPropagation(),m.key==="Enter"?o():m.key==="Escape"&&a()},className:"border-border bg-background focus-ring min-w-0 flex-1 rounded border px-1 py-0 text-sm outline-none"})}const bn=100,jn=28,kn=250;function wn(t){const{rows:n,selectedPath:a,renamingPath:x,errorPaths:p,onSelectPath:c,onRetryDir:o}=t,m=s.useRef(null),r=H(v=>v.setScrollTop),i=H(v=>v.scopeKey),u=s.useCallback(v=>v.type==="dir"?t.onToggle(v):t.onOpen(v),[t]),N=Dn(t,u),F=n.length>bn,D=Jt({count:n.length,getScrollElement:()=>m.current,estimateSize:()=>jn,overscan:12,enabled:F}),L=s.useRef({scope:void 0,done:!1}),C=s.useRef(null);s.useLayoutEffect(()=>{const v=L.current;if(v.scope!==i&&(v.scope=i,v.done=!1),v.done||n.length===0)return;const z=m.current;if(!z)return;const B=H.getState().scrollTop;if(B<=0){v.done=!0;return}F?D.scrollToOffset(B):z.scrollTop=B,C.current=z.scrollTop,z.scrollTop>=B&&(v.done=!0)},[n.length,i,F,D]);const U=s.useRef(null),I=s.useRef(null),k=s.useCallback(()=>{const v=m.current;v&&v.scrollTop!==C.current&&(L.current.done=!0,U.current=v.scrollTop,I.current&&clearTimeout(I.current),I.current=setTimeout(()=>{I.current=null,U.current!==null&&r(U.current)},kn))},[r]);s.useEffect(()=>()=>{I.current&&clearTimeout(I.current),U.current!==null&&r(U.current)},[r]);const h=s.useRef(void 0);s.useEffect(()=>{var d,f;const v=h.current;if(h.current=a,v===void 0||a===v||a===null)return;const z=n.findIndex(T=>T.entry.path===a);if(z<0)return;const B=m.current;B&&(F?D.scrollToIndex(z,{align:"auto"}):(f=(d=B.querySelector(`[data-row-index="${z}"]`))==null?void 0:d.scrollIntoView)==null||f.call(d,{block:"nearest"}),C.current=B.scrollTop)},[a,n,F,D]);const[g,w]=s.useState(!1),{onCopyInto:b,onMove:S}=t,K=t.readOnly===!0,A=t.copyable!==!1,_=s.useCallback(v=>{K||!Ye(v.dataTransfer.types)||(v.preventDefault(),v.dataTransfer.dropEffect=v.altKey&&A?"copy":"move",w(!0))},[K,A]),$=s.useCallback((v,z)=>{const B=n.find(d=>d.entry.path===v);B&&b({path:v,isDir:B.entry.type==="dir"},z)},[n,b]),W=s.useCallback(v=>{if(w(!1),K)return;const z=We(v.dataTransfer);z!==null&&(v.preventDefault(),v.altKey&&A?$(z,Q):S(z,Q))},[$,S,K,A]),P=v=>e.jsx(vn,{row:v,selected:v.entry.path===a,renaming:v.entry.path===x,error:v.entry.type==="dir"&&v.expanded&&p.has(v.entry.path),onSelect:z=>c(z.path),onActivate:u,onRetry:()=>o(v.entry.path),onSubmitRename:t.onSubmitRename,onCancelRename:t.onCancelRename,onStartRename:t.onStartRename,onNewFile:t.onNewFile,onNewFolder:t.onNewFolder,onDelete:t.onDelete,onMove:t.onMove,onCopyInto:$,onCopy:t.onCopy,onPaste:t.onPaste,onDuplicate:t.onDuplicate,canPasteInto:t.canPasteInto,revealLabel:t.revealLabel,onReveal:t.onReveal,onAddToChat:t.onAddToChat,onCopyPath:t.onCopyPath,readOnly:t.readOnly,provenance:t.provenance,copyable:t.copyable,onDisk:t.onDisk,onUpload:t.onUpload,onPickUpload:t.onPickUpload});return e.jsx("div",{ref:m,role:"tree","aria-label":"File explorer",tabIndex:0,onKeyDown:N,onScroll:k,onDragOver:_,onDragLeave:()=>w(!1),onDrop:W,className:Pe("focus-visible:ring-ring h-full overflow-auto outline-none focus-visible:ring-1 focus-visible:ring-inset",g&&"ring-ring/60 bg-accent/30 ring-1 ring-inset"),children:F?e.jsx("div",{style:{height:D.getTotalSize()},className:"relative w-full",children:D.getVirtualItems().map(v=>e.jsx("div",{"data-row-index":v.index,className:"absolute top-0 left-0 w-full",style:{transform:`translateY(${v.start}px)`},children:P(n[v.index])},n[v.index].entry.path))}):n.map((v,z)=>e.jsx("div",{"data-row-index":z,children:P(v)},v.entry.path))})}function En(t){return t?t.type==="dir"?t.path:G(t.path):Q}function Dn(t,n){const{rows:a,selectedPath:x,renamingPath:p,onSelectPath:c}=t;return s.useCallback(o=>{var i,u,N,F;if(p!==null)return;const m=a.findIndex(D=>D.entry.path===x),r=m>=0?a[m]:void 0;if(o.metaKey||o.ctrlKey){if(t.readOnly===!0||t.copyable===!1)return;const D=o.key.toLowerCase();if(D==="c"&&r){o.preventDefault(),t.onCopy(r.entry);return}if(D==="v"){o.preventDefault(),t.onPaste(En(r==null?void 0:r.entry));return}return}switch(o.key){case"ArrowDown":o.preventDefault(),c(((i=a[Math.min(m+1,a.length-1)])==null?void 0:i.entry.path)??((u=a[0])==null?void 0:u.entry.path));break;case"ArrowUp":o.preventDefault(),c(((N=a[Math.max(m-1,0)])==null?void 0:N.entry.path)??((F=a[0])==null?void 0:F.entry.path));break;case"ArrowRight":(r==null?void 0:r.entry.type)==="dir"&&!r.expanded&&(o.preventDefault(),t.onToggle(r.entry));break;case"ArrowLeft":if(!r)break;if(o.preventDefault(),r.entry.type==="dir"&&r.expanded)t.onToggle(r.entry);else{const D=G(r.entry.path);D&&c(D)}break;case"Enter":r&&(o.preventDefault(),n(r.entry));break;case"F2":r&&t.readOnly!==!0&&(o.preventDefault(),t.onStartRename(r.entry));break;case"Delete":case"Backspace":r&&t.readOnly!==!0&&(o.preventDefault(),t.onDelete(r.entry));break}},[a,x,p,c,t,n])}const Nn={rename:"Rename it anyway",move:"Move it anyway",delete:"Delete it anyway",upload:"Upload mine over it"},Rn={rename:"nothing was renamed",move:"nothing was moved",delete:"nothing was deleted",upload:"nothing was uploaded"};function Sn(t){const{entry:n,fileCount:a,moreThan:x}=t;if(n.type!=="dir")return`“${n.name}” leaves the room’s files.`;const p=a===null?"everything in it":x?`the more than ${a.toLocaleString()} files in it`:a===1?"the 1 file in it":`the ${a.toLocaleString()} files in it`;return`“${n.name}” and ${p} leave the room’s files.`}const Tn="The room’s history keeps a copy. An agent can restore it.";function Fn({changes:t,onOpenTheirs:n,onReturnFocus:a}){var D;const x=L=>{L.preventDefault();const C=document.activeElement;C!==null&&C!==document.body||a()},{pendingDelete:p,pendingClash:c,conflict:o}=t,[m,r]=s.useState(p);p!==null&&p!==m&&r(p);const[i,u]=s.useState(c);c!==null&&c!==i&&u(c);const N=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(fe,{open:p!==null,onOpenChange:L=>!L&&t.cancelDelete(),children:e.jsxs(he,{onCloseAutoFocus:x,children:[e.jsxs(pe,{children:[e.jsx(me,{children:m===null?"":`Delete “${m.entry.name}”?`}),e.jsx(xe,{asChild:!0,children:e.jsxs("div",{className:"space-y-2",children:[e.jsx("p",{children:m===null?"":Sn(m)}),e.jsx("p",{children:Tn})]})})]}),e.jsxs(ge,{children:[e.jsx(ye,{onClick:t.cancelDelete,children:"Cancel"}),e.jsx(ve,{onClick:()=>void t.confirmDelete(),className:"bg-destructive hover:bg-destructive/90 dark:bg-destructive/60 text-white",children:(m==null?void 0:m.entry.type)==="dir"?"Delete folder":"Delete file"})]})]})}),e.jsx(fe,{open:c!==null,onOpenChange:L=>!L&&t.cancelClash(),children:e.jsxs(he,{onCloseAutoFocus:x,children:[e.jsxs(pe,{children:[e.jsx(me,{children:F?`Replace “${i==null?void 0:i.names[0]}”?`:`Replace ${(i==null?void 0:i.names.length)??0} files?`}),e.jsx(xe,{children:F?`${N} already has a file with this name. Replace it, or keep both.`:`${N} already has files named ${(i==null?void 0:i.names.join(", "))??""}. Replace them, or keep both.`})]}),e.jsxs(ge,{children:[e.jsx(ye,{onClick:t.cancelClash,children:"Cancel"}),e.jsx(Y,{variant:"outline",onClick:()=>void t.resolveClash("keep-both"),children:"Keep both"}),e.jsx(ve,{onClick:()=>void t.resolveClash("replace"),children:"Replace"})]})]})}),e.jsx(fe,{open:o!==null,onOpenChange:L=>!L&&t.dismissConflict(),children:e.jsxs(he,{onCloseAutoFocus:x,children:[e.jsxs(pe,{children:[e.jsx(me,{children:"Somebody changed this first"}),e.jsx(xe,{children:o===null?"":`${((D=o.lastCommit)==null?void 0:D.author)??"Somebody"} changed “${o.path}” after you opened it, so ${Rn[o.kind]}.`})]}),(o==null?void 0:o.lastCommit)&&e.jsxs("p",{className:"text-muted-foreground text-xs",children:[o.lastCommit.subject," · ",Ct(o.lastCommit.at)]}),e.jsxs(ge,{children:[e.jsx(ye,{onClick:t.dismissConflict,children:"Cancel"}),e.jsx(Y,{variant:"outline",onClick:()=>{o!==null&&(t.dismissConflict(),n(o.path))},children:"Open their version"}),e.jsx(ve,{onClick:()=>{o!==null&&(t.dismissConflict(),o.retry())},className:"bg-destructive hover:bg-destructive/90 dark:bg-destructive/60 text-white",children:o===null?"":Nn[o.kind]})]})]})})]})}function ze(t,n){return n.name===t?qe(t):`“${n.name}” is already there. Some computers ignore capital letters in names. Pick another name.`}const Pn="Folders can’t be uploaded. Drop the files inside instead.";function On({source:t,className:n,onCommands:a}={}){var de;const x=ne(),p=Te(l=>l.selectedCwd),c=s.useMemo(()=>p?gn({transport:x,cwd:p}):null,[x,p]),o=t===void 0?c:t,m=o!==null&&!o.writable,r=xn(o),i=r.changes,u=oe(),N=H(l=>l.showHidden),{rows:F,rootLoading:D,rootError:L,rootErrorMessage:C,rootErrorCommand:U,errorPaths:I}=r,k=H(l=>l.setCommands),h=H(l=>l.selectedPath),g=H(l=>l.setSelectedPath),w=H(l=>l.clipboard),[b,S]=s.useState(null),[K,A]=s.useState(null),[_,$]=s.useState(null),W=s.useCallback(l=>$(l===null?null:{path:l,isNew:!1}),[]),P=s.useRef(null),v=s.useRef(Q),[z,B]=s.useState(!1),d=s.useCallback((l,M)=>{if(i!==null){if(M.length===0){J.error(Pn);return}r.ensureExpanded(l),i.upload(l,M)}},[i,r]),f=s.useRef(null),T=s.useCallback(()=>{var l,M;(M=(l=f.current)==null?void 0:l.querySelector('[role="tree"]'))==null||M.focus()},[]),y=s.useCallback(l=>{var M;v.current=l,(M=P.current)==null||M.click()},[]),O=s.useCallback(l=>w!==null&&!(w.isDir&&Ce(l,w.path)),[w]),E=s.useCallback((l,M)=>{r.ensureExpanded(l),_e.flushSync(()=>{A(null),S({parent:l,type:M})})},[r]),R=s.useCallback(l=>{_e.flushSync(()=>A(l.path))},[]),j=s.useRef({startCreate:E,reload:r.reload,pickUpload:y});s.useEffect(()=>{j.current={startCreate:E,reload:r.reload,pickUpload:y}});const q=i!==null;s.useEffect(()=>{if(m||a===void 0&&q)return;const l=a??k;return l({newFile:()=>j.current.startCreate(Q,"file"),newFolder:()=>j.current.startCreate(Q,"dir"),refresh:()=>j.current.reload(),...q&&{upload:()=>j.current.pickUpload(Q)}}),()=>l(null)},[k,a,m,q]);const te=s.useCallback(async l=>{var se;if(!b||o===null)return;const M=b;if(S(null),i!==null){const re=(((se=u.getQueryData(le(o,M.parent,N)))==null?void 0:se.entries)??[]).find(ot=>ot.name.toLowerCase()===l.toLowerCase());if(M.type==="dir"){if(re!==void 0&&!(re.type==="dir"&&re.name===l)){J.error(ze(l,re));return}S({parent:ee(M.parent,l),type:"file",firstInFolder:l});return}if(re!==void 0){J.error(ze(l,re));return}const rt=ee(M.parent,l);$({path:rt,isNew:!0});return}await r.createEntry(M.parent,l,M.type)&&g(ee(M.parent,l))},[b,o,i,u,N,r,g]),V=s.useCallback(async(l,M)=>{A(null),(i?await i.renameEntry(l,M):await r.renameEntry(l,M))&&g(ee(G(l.path),M))},[i,r,g]);return o===null?t!==void 0?null:e.jsx("div",{className:"text-muted-foreground flex h-full items-center justify-center p-6 text-center text-sm",children:"Pick a folder to see its files."}):e.jsxs("div",{ref:f,className:Pe("flex h-full flex-col",z&&"ring-ring/60 bg-accent/30 ring-1 ring-inset",n),onDragOver:l=>{i===null||!je(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||!je(l.dataTransfer.types))&&(l.preventDefault(),d(Q,st(l.dataTransfer).files))},children:[i!==null&&e.jsx("input",{ref:P,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="",d(v.current,M)}}),e.jsxs("div",{className:"min-h-0 flex-1",children:[b&&e.jsx(Mn,{type:b.type,firstInFolder:b.firstInFolder,onSubmit:l=>void te(l),onCancel:()=>S(null)},`${b.parent}:${b.type}:${b.firstInFolder??""}`),D&&F.length===0?e.jsx("div",{className:"flex h-20 items-center justify-center",children:e.jsx(Fe,{size:"md",className:"text-muted-foreground",label:"Loading files"})}):L&&F.length===0?e.jsxs("div",{className:"text-muted-foreground flex min-h-20 flex-col items-center justify-center gap-2 px-4 py-3 text-center text-xs [overflow-wrap:anywhere]",children:[e.jsx("span",{children:C??"Couldn’t load files."}),U!==null&&e.jsx("code",{"aria-label":"Command that removes the settings",className:"bg-muted text-foreground block w-full rounded px-2 py-1.5 text-left font-mono select-all",children:U}),e.jsxs(Y,{variant:"outline",size:"xs",onClick:r.reload,children:[e.jsx(Ge,{}),"Retry"]})]}):F.length===0&&!b?e.jsx("div",{className:"text-muted-foreground/60 flex h-20 items-center justify-center px-4 text-center text-xs",children:i!==null?"No files yet. Drop files here, or use Upload.":"Empty folder"}):e.jsx(wn,{rows:F,selectedPath:h,renamingPath:K,errorPaths:I,onSelectPath:g,onToggle:r.toggleExpand,onOpen:l=>{o.preview==="inline"?W(l.path):r.openFile(l)},onRetryDir:r.retryDir,onSubmitRename:(l,M)=>void V(l,M),onCancelRename:()=>A(null),onStartRename:R,onNewFile:l=>E(l,"file"),onNewFolder:l=>E(l,"dir"),onDelete:l=>i?i.requestDelete(l):void r.removeEntry(l),onMove:(l,M)=>void(i?i.moveEntry(l,M):r.moveEntry(l,M)),onCopyInto:(l,M)=>void r.copyEntry(l,M),onCopy:r.copyToClipboard,onPaste:l=>{w&&r.copyEntry(w,l)},onDuplicate:l=>void r.copyEntry({path:l.path,isDir:l.type==="dir"},G(l.path)),canPasteInto:O,readOnly:m,provenance:o.provenance,copyable:i===null,onDisk:o.cwd!==null,onUpload:i?d:void 0,onPickUpload:i?y:void 0,revealLabel:r.revealLabel,onReveal:l=>void r.reveal(l),onAddToChat:r.addToChat,onCopyPath:(l,M)=>void r.copyPath(l,M)})]}),o.preview==="inline"&&e.jsx(Wt,{source:o,path:(_==null?void 0:_.path)??null,isNew:(_==null?void 0:_.isNew)??!1,onCreated:()=>{_!==null&&($({path:_.path,isNew:!1}),g(_.path))},onClose:()=>$(null)}),i!==null&&e.jsx(Fn,{changes:i,onOpenTheirs:l=>W(l),onReturnFocus:T}),e.jsx(fe,{open:r.pendingRecursiveDelete!==null,onOpenChange:l=>!l&&r.cancelRecursiveDelete(),children:e.jsxs(he,{children:[e.jsxs(pe,{children:[e.jsxs(me,{children:["Delete “",(de=r.pendingRecursiveDelete)==null?void 0:de.name,"”?"]}),e.jsx(xe,{children:"This folder isn’t empty. Everything inside is deleted. This can’t be undone."})]}),e.jsxs(ge,{children:[e.jsx(ye,{onClick:r.cancelRecursiveDelete,children:"Cancel"}),e.jsx(ve,{onClick:()=>void r.confirmRecursiveDelete(),className:"bg-destructive hover:bg-destructive/90 dark:bg-destructive/60 text-white",children:"Delete folder"})]})]})})]})}function Mn({type:t,firstInFolder:n,onSubmit:a,onCancel:x}){const p=s.useRef(null),[c,o]=s.useState("");s.useEffect(()=>{var i;(i=p.current)==null||i.focus()},[]);const m=()=>{const i=c.trim();i?a(i):x()},r=e.jsxs("div",{className:"flex items-center gap-1",children:[t==="dir"?e.jsx(be,{className:"size-(--size-icon-sm) flex-shrink-0 text-sky-500"}):e.jsx(Ve,{className:"text-muted-foreground size-(--size-icon-sm) flex-shrink-0"}),e.jsx("input",{ref:p,type:"text",value:c,"aria-label":n!==void 0?`First file in ${n}`:t==="dir"?"New folder name":"New file name",placeholder:t==="dir"?"folder-name":"file-name",onChange:i=>o(i.target.value),onBlur:m,onKeyDown:i=>{i.key==="Enter"?m():i.key==="Escape"&&x()},className:"border-border bg-background focus-ring min-w-0 flex-1 rounded border px-1 py-0 text-sm outline-none"})]});return n===void 0?e.jsx("div",{className:"px-3 py-1",children:r}):e.jsxs("div",{className:"space-y-1 px-3 py-1",children:[e.jsxs("p",{className:"text-muted-foreground flex min-w-0 items-center gap-1 text-xs",children:[e.jsx(be,{className:"size-(--size-icon-xs) flex-shrink-0 text-sky-500"}),e.jsx("span",{className:"truncate",children:n})]}),r,e.jsx("p",{className:"text-muted-foreground text-2xs",children:"Name its first file. The folder appears on save."})]})}function at(){const t=H(x=>x.showHidden),n=H(x=>x.setShowHidden),a=t?"Hide hidden files":"Show hidden files";return e.jsx(Y,{variant:"ghost",size:"icon-xs","aria-label":a,title:a,onClick:()=>n(!t),children:t?e.jsx(bt,{className:"text-muted-foreground"}):e.jsx(jt,{className:"text-muted-foreground"})})}function _n({cwd:t}){const n=ne(),{data:a}=ce({queryKey:["file-explorer","workspace",t],queryFn:()=>n.resolveWorkspace(t),staleTime:6e4});return a!=null&&a.branch?e.jsxs("span",{className:"text-muted-foreground bg-muted/50 text-2xs inline-flex min-w-0 items-center gap-1 rounded px-1.5 py-0.5",title:`Workspace ${a.key} on ${a.branch}`,children:[e.jsx(Xe,{className:"size-3 flex-shrink-0"}),e.jsx("span",{className:"truncate",children:a.branch})]}):null}function es(){const t=Te(a=>a.selectedCwd),n=H(a=>a.commands);return t?e.jsxs(e.Fragment,{children:[e.jsx(_n,{cwd:t}),e.jsx(Y,{variant:"ghost",size:"icon-xs","aria-label":"New file",title:"New file",onClick:()=>n==null?void 0:n.newFile(),children:e.jsx(et,{className:"text-muted-foreground"})}),e.jsx(Y,{variant:"ghost",size:"icon-xs","aria-label":"New folder",title:"New folder",onClick:()=>n==null?void 0:n.newFolder(),children:e.jsx(He,{className:"text-muted-foreground"})}),e.jsx(at,{}),e.jsx(Y,{variant:"ghost",size:"icon-xs","aria-label":"Refresh",title:"Refresh",onClick:()=>n==null?void 0:n.refresh(),children:e.jsx(kt,{className:"text-muted-foreground"})})]}):null}function An({roomId:t}){const n=ne(),a=oe(),x=ce(Ue(n,t));s.useEffect(()=>Yt(a,t,()=>{a.invalidateQueries({queryKey:De.repoStatus(t)})}),[a,t]);const p=s.useMemo(()=>{var r;return((r=x.data)==null?void 0:r.kind)==="ok"?wt(x.data.status):[]},[x.data]),c=Et(p),o=Dt(p);if(!o)return null;const m=p.map((r,i)=>`${c[i]}: ${Nt(r)}`);return e.jsxs("span",{"data-slot":"pending-work-badge",title:m.join(`
|
|
17
|
+
`),className:"text-muted-foreground bg-muted/50 text-2xs inline-flex min-w-0 items-center gap-1 rounded px-1.5 py-0.5",children:[e.jsx(Xe,{className:"size-3 flex-shrink-0"}),e.jsxs("span",{className:"sr-only",children:["Not merged into the room yet. ",m.join(". "),"."]}),e.jsx("span",{"aria-hidden":"true",className:"truncate",children:o})]})}const Ln={added:"added",modified:"changed",deleted:"deleted",untracked:"new"},zn=new Map([["OPERATOR_ONLY","Only the owner of this DorkOS can keep or discard these."],["ROOM_FILE_NOT_FOUND","One of those changes is gone, so nothing was discarded. The list is refreshed."],["MERGE_IN_FLIGHT","Something else is writing to these files. Nothing changed. Try again in a moment."],["MAIN_CHECKOUT_DIRTY","These files are on another branch. Switch them back to main yourself."],["ROOM_REPO_GIT_UNAVAILABLE","Room files need git, and git isn’t installed on this computer."],["ROOM_HAS_NO_REPO","This room no longer has its own files."],["ROOM_REPOS_DISABLED","Room files are turned off on this install."]]);function $n({roomId:t}){var U,I;const n=ne(),a=oe(),x=ce(Ue(n,t)),[p,c]=s.useState([]),[o,m]=s.useState(!1),[r,i]=s.useState(null),u=Rt({mutationFn:k=>n.repairRoomMain(t,k),onSuccess:()=>{c([]),m(!1),i(null),a.invalidateQueries({queryKey:De.repoStatus(t)})},onError:k=>{m(!1);const h=zn.get(St(k)??"");i(h??"Couldn’t update the files. Try again in a moment."),a.invalidateQueries({queryKey:De.repoStatus(t)})}});if(((U=x.data)==null?void 0:U.kind)==="unavailable")return e.jsx("p",{role:"alert","data-slot":"room-main-warning",className:"border-border/60 text-muted-foreground rounded-lg border px-3 py-2.5 text-xs",children:"Couldn’t check this room’s files. Saves may not work. Try again soon."});const N=((I=x.data)==null?void 0:I.kind)==="ok"?x.data.status.main:void 0;if(N===void 0||!N.dirty)return null;const F=N.branch!=="main",D=p.filter(k=>N.strays.some(h=>h.path===k)),L=o&&D.length>0,C=k=>c(h=>h.includes(k)?h.filter(g=>g!==k):[...h,k]);return e.jsxs("div",{"data-slot":"room-main-warning",className:"border-border/60 bg-muted/40 space-y-3 rounded-lg border px-3 py-2.5 text-sm",children:[e.jsxs("div",{className:"flex gap-2",children:[e.jsx(Tt,{className:"text-muted-foreground mt-0.5 size-(--size-icon-sm) flex-shrink-0"}),e.jsxs("div",{className:"min-w-0 space-y-1",children:[e.jsxs("div",{role:"alert",className:"space-y-1",children:[e.jsx("p",{className:"font-medium",children:"Somebody changed this room’s files outside DorkOS"}),F?e.jsxs(e.Fragment,{children:[e.jsx("p",{className:"text-muted-foreground text-xs",children:`This room’s files are on ${N.branch??"no branch"}, not main.`}),e.jsx("p",{className:"text-muted-foreground text-xs",children:"Saves and agent merges wait until they’re back on main."})]}):e.jsx("p",{className:"text-muted-foreground text-xs",children:"Saves and agent merges wait until you keep or discard these."})]}),F&&e.jsx(nn,{className:"text-xs",children:e.jsx("p",{children:"DorkOS won’t switch the branch for you. There may be work on it."})})]})]}),!F&&e.jsxs(e.Fragment,{children:[e.jsx("ul",{className:"space-y-1.5",children:N.strays.map(k=>e.jsxs("li",{className:"flex items-center gap-2",children:[e.jsx(Ft,{id:`stray-${t}-${k.path}`,checked:D.includes(k.path),onCheckedChange:()=>C(k.path),disabled:u.isPending}),e.jsx("label",{htmlFor:`stray-${t}-${k.path}`,className:"min-w-0 flex-1 cursor-pointer truncate font-mono text-xs",title:k.path,children:k.path}),e.jsx("span",{className:"text-muted-foreground flex-shrink-0 text-xs",children:Ln[k.kind]})]},k.path))}),N.strayCount>N.strays.length&&e.jsxs("p",{className:"text-muted-foreground text-xs",children:["…and ",N.strayCount-N.strays.length," more not shown. “Keep them all” keeps these too."]}),L?e.jsxs("div",{className:"space-y-2",children:[e.jsx("p",{className:"text-xs",children:D.length===1?"Discard this change? It can’t be undone.":`Discard these ${D.length} changes? They can’t be undone.`}),e.jsxs("div",{className:"flex flex-wrap gap-2",children:[e.jsx(Y,{type:"button",variant:"ghost",size:"sm",disabled:u.isPending,onClick:()=>m(!1),children:"Cancel"}),e.jsx(Y,{type:"button",variant:"destructive",size:"sm",disabled:u.isPending,onClick:()=>u.mutate({action:"discard",paths:[...D]}),children:D.length===1?"Discard change":`Discard ${D.length} changes`})]})]}):e.jsxs("div",{className:"flex flex-wrap gap-2",children:[e.jsx(Y,{type:"button",variant:"outline",size:"sm",disabled:u.isPending,onClick:()=>u.mutate({action:"commit"}),children:"Keep them all"}),e.jsx(Y,{type:"button",variant:"ghost",size:"sm",disabled:u.isPending||D.length===0,onClick:()=>m(!0),children:D.length===0?"Discard…":`Discard ${D.length}`})]})]}),r!==null&&e.jsx("p",{role:"alert",className:"text-destructive text-xs",children:r})]})}const Ee="pointer-coarse:size-11";function ts({roomId:t,canChange:n}){const a=ne(),x=oe(),p=H(F=>F.showHidden),[c,o]=s.useState(null),m=s.useMemo(()=>Be({transport:a,queryClient:x,roomId:t,canChange:n}),[a,x,t,n]),r=ce(ke(m,Q,p,x)),i=r.isSuccess&&r.data.absent!==!0||r.isError,[u,N]=s.useState(null);return i&&u!==t&&N(t),!i&&u!==t?null:e.jsxs("section",{"aria-label":"Room files",className:"space-y-2",children:[e.jsxs("header",{className:"flex items-center gap-2",children:[e.jsx(Pt,{className:"text-muted-foreground size-(--size-icon-sm) flex-shrink-0"}),e.jsx("h3",{className:"text-muted-foreground text-xs font-medium tracking-wide uppercase",children:"Files"}),e.jsx("div",{className:"min-w-0 flex-1",children:e.jsx(An,{roomId:t})}),n&&e.jsxs(e.Fragment,{children:[e.jsx(Y,{variant:"ghost",size:"icon-xs",className:Ee,"aria-label":"New file",title:"New file",disabled:c===null,onClick:()=>c==null?void 0:c.newFile(),children:e.jsx(et,{className:"text-muted-foreground"})}),e.jsx(Y,{variant:"ghost",size:"icon-xs",className:Ee,"aria-label":"New folder",title:"New folder",disabled:c===null,onClick:()=>c==null?void 0:c.newFolder(),children:e.jsx(He,{className:"text-muted-foreground"})}),e.jsx(Y,{variant:"ghost",size:"icon-xs",className:Ee,"aria-label":"Upload files",title:"Upload files",disabled:(c==null?void 0:c.upload)===void 0,onClick:()=>{var F;return(F=c==null?void 0:c.upload)==null?void 0:F.call(c)},children:e.jsx(an,{className:"text-muted-foreground"})})]}),e.jsx(at,{})]}),e.jsx($n,{roomId:t}),e.jsx("div",{"data-slot":"room-files-body",className:"border-border/60 h-72 overflow-hidden rounded-lg border",children:e.jsx(On,{source:m,onCommands:o})})]})}function ns({roomId:t,attachment:n}){var i;const a=ne(),x=oe(),p=s.useMemo(()=>Be({transport:a,queryClient:x,roomId:t}),[a,x,t]),c=ce(ke(p,Q,!1,x)),[o,m]=s.useState(!1),r=Ot(t);return!c.isSuccess||c.data.absent===!0||((i=r.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:()=>m(!0),children:e.jsx(Mt,{})}),o&&e.jsx(In,{roomId:t,source:p,attachment:n,onClose:()=>m(!1)})]})}function In({roomId:t,source:n,attachment:a,onClose:x}){const p=ne(),c=oe(),[o,m]=s.useState(Q),[r,i]=s.useState(a.name),[u,N]=s.useState(null),[F,D]=s.useState(!1),L=s.useId(),C=ce(ke(n,o,!1,c)),U=s.useMemo(()=>{var k;return nt(((k=C.data)==null?void 0:k.entries)??[]).filter(h=>h.type==="dir")},[C.data]),I=async()=>{var h,g;const k=r.trim();if(k!==""){D(!0),N(null);try{await p.saveAttachmentToRoomFiles(t,{attachmentId:a.id,dir:o,name:k,baseCommit:((h=C.data)==null?void 0:h.commit)??null}),c.invalidateQueries({queryKey:["file-explorer","tree",n.scopeKey]}),J.success(`Saved ${k} to the room’s files`),x()}catch(w){let b;try{b=Gt(w,c,t)}catch{b={status:"refused",reason:Qe(w)??"Couldn’t save. Try again in a moment."}}if(b.status==="exists"){const S=(((g=C.data)==null?void 0:g.entries)??[]).map(K=>K.name);N({reason:`This folder already has a file called “${k}”. Pick another name.`,suggestion:Oe({name:k,isDir:!1,taken:[...S,k]})})}else b.status==="conflict"?(N({reason:"This folder changed while you chose, so nothing was saved. Try again."}),C.refetch()):b.status==="refused"&&N({reason:b.reason})}finally{D(!1)}}};return e.jsx(_t,{open:!0,onOpenChange:k=>!k&&x(),children:e.jsxs(At,{className:"sm:max-w-md",children:[e.jsxs(Lt,{children:[e.jsx(zt,{children:"Save to room files"}),e.jsx($t,{children:"Everyone in the room, and their agents, can find it there."})]}),e.jsxs(It,{className:"space-y-3",children:[e.jsxs("div",{className:"space-y-1",children:[e.jsx("p",{className:"text-muted-foreground text-xs font-medium",children:"Folder"}),e.jsxs("div",{role:"group","aria-label":"Folders",className:"border-border/60 max-h-56 overflow-auto rounded-md border",children:[e.jsx("p",{className:"bg-muted/40 truncate px-3 py-1.5 font-mono text-xs",children:o===Q?"Top folder":`${o}/`}),o!==Q&&e.jsx($e,{label:"Up one folder",icon:e.jsx(sn,{className:"text-muted-foreground size-(--size-icon-sm)"}),onClick:()=>m(G(o))}),C.isPending?e.jsx("div",{className:"flex h-12 items-center justify-center",children:e.jsx(Fe,{size:"sm",className:"text-muted-foreground",label:"Loading folders"})}):U.length===0?e.jsx("p",{className:"text-muted-foreground px-3 py-2 text-xs",children:"No folders in here."}):U.map(k=>e.jsx($e,{label:k.name,icon:e.jsx(be,{className:"size-(--size-icon-sm) text-sky-500"}),chevron:!0,onClick:()=>m(ee(o,ie(k.path)))},k.path))]})]}),e.jsxs("div",{className:"space-y-1",children:[e.jsx("label",{htmlFor:L,className:"text-muted-foreground text-xs font-medium",children:"Name"}),e.jsx(Kt,{id:L,value:r,onChange:k=>{i(k.target.value),N(null)},spellCheck:!1,autoComplete:"off"})]}),u!==null&&e.jsxs("div",{role:"alert",className:"text-destructive space-y-1 text-xs",children:[e.jsx("p",{children:u.reason}),u.suggestion!==void 0&&e.jsxs(Y,{type:"button",variant:"outline",size:"xs",onClick:()=>{i(u.suggestion),N(null)},children:["Use “",u.suggestion,"”"]})]})]}),e.jsxs(Ht,{className:"gap-2",children:[e.jsx(Y,{type:"button",variant:"ghost",onClick:x,children:"Cancel"}),e.jsx(Y,{type:"button",disabled:F||r.trim()===""||C.isPending,onClick:()=>void I(),children:F?"Saving…":o===Q?"Save to the top folder":`Save to ${ie(o)}`})]})]})})}function $e({label:t,icon:n,chevron:a=!1,onClick:x}){return e.jsxs("button",{type:"button",onClick:x,className:"hover:bg-accent/50 focus-visible:bg-accent flex w-full items-center gap-2 px-3 py-1.5 text-left text-sm outline-none",children:[n,e.jsx("span",{className:"min-w-0 flex-1 truncate",children:t}),a&&e.jsx(Ke,{className:"text-muted-foreground size-3.5"})]})}export{On as FileExplorer,es as FileExplorerActions,Wt as FilePreviewDialog,rn as HIDDEN_ENTRY_NAMES,at as HiddenEntriesToggle,rs as NO_PROVENANCE,Ne as PINNED_ENTRY_NAMES,os as ROOM_FILES_REFRESH_INTERVAL_MS,ts as RoomFilesSection,ns as SaveToRoomFilesButton,Be as createRoomFilesSource,gn as createSessionCwdSource,le as explorerDirQueryKey,ke as explorerDirQueryOptions,on as isHiddenEntryName,Re as isPinnedEntryName,ln as pinnedFirst,Bt as provenanceLine,Ue as roomRepoStatusQueryOptions,nt as withoutHidden};
|