@p4code/cli 0.8.14 → 0.8.15
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.mjs +1 -1
- package/dist/{binCli-BvhJ8Jqb.mjs → binCli-IAUzRF0Y.mjs} +43 -16
- package/dist/client/.vite/manifest.json +2143 -2143
- package/dist/client/assets/AlertDialogRoot-DYtW2IF3.js +2 -0
- package/dist/client/assets/{AnimatedHeight-CH-N3JTc.js → AnimatedHeight-CzFc8xri.js} +2 -2
- package/dist/client/assets/{AuthSurfaceShell-Dfm2iXjM.js → AuthSurfaceShell-ByOYQAV0.js} +2 -2
- package/dist/client/assets/{CSPContext-4VAD2_gc.js → CSPContext-DcW0os5z.js} +2 -2
- package/dist/client/assets/{ChatGptUsageButton-BE2a_fvh.js → ChatGptUsageButton-KFBZLDN7.js} +2 -2
- package/dist/client/assets/{ChatMarkdown-2qihmx2E.js → ChatMarkdown-BoxySKsC.js} +4 -4
- package/dist/client/assets/{CheckboxIndicator-ClY0P0ol.js → CheckboxIndicator-DRAilQdq.js} +2 -2
- package/dist/client/assets/{CodexSetupSection.logic-CZIedhFM.js → CodexSetupSection.logic-d-rT4H0o.js} +2 -2
- package/dist/client/assets/{CollapsiblePanel-Cubscn-a.js → CollapsiblePanel-DMH4QH0_.js} +2 -2
- package/dist/client/assets/{ComboboxClear-qTthzuJh.js → ComboboxClear-DV4ygCOL.js} +2 -2
- package/dist/client/assets/{CommandBlock-cV3B4sIS.js → CommandBlock-_boutMAe.js} +2 -2
- package/dist/client/assets/{ComposerPromptEditor-l0YJjut-.js → ComposerPromptEditor-BTCrYVhm.js} +4 -4
- package/dist/client/assets/{CompositeRoot-DUqf78yV.js → CompositeRoot-CsrLt1o5.js} +2 -2
- package/dist/client/assets/{ConnectionStatusDot-cdpNRZhA.js → ConnectionStatusDot-uWbIqk3l.js} +2 -2
- package/dist/client/assets/{DevicePanel-CyqJ_QAv.js → DevicePanel-DwMrOlt0.js} +2 -2
- package/dist/client/assets/{DeviceSetup-B9gRys_T.js → DeviceSetup-CbOHLIaV.js} +2 -2
- package/dist/client/assets/{DialogTitle-CQU6s1Wy.js → DialogTitle-BgclXafx.js} +2 -2
- package/dist/client/assets/{DiffCommentAnnotation-DqJdp0B7.js → DiffCommentAnnotation-Aq3V-yP1.js} +2 -2
- package/dist/client/assets/{DiffFileTree-C0BZv_u5.js → DiffFileTree-CKQPTUag.js} +2 -2
- package/dist/client/assets/{DiffPanel-DvpW3Wct.js → DiffPanel-BXML30Ty.js} +2 -2
- package/dist/client/assets/{DiffWorkerPoolProvider-C0s_fra9.js → DiffWorkerPoolProvider-CibTihO7.js} +2 -2
- package/dist/client/assets/{EmbeddedDesign-DGCXXVf5.js → EmbeddedDesign-722JShay.js} +2 -2
- package/dist/client/assets/{EnvironmentMachineIcon-DCdlTSYU.js → EnvironmentMachineIcon-Czk_PJpp.js} +2 -2
- package/dist/client/assets/{ExpandableText-BtdwzlFy.js → ExpandableText-Ggw0uVXl.js} +2 -2
- package/dist/client/assets/{FieldControl-BI2gK4Z0.js → FieldControl-Bw2_eFMa.js} +2 -2
- package/dist/client/assets/{FileDiff-BtKZeeO5.js → FileDiff-Cen-Dayi.js} +2 -2
- package/dist/client/assets/{FilePreviewPanel-DzVGuSCc.js → FilePreviewPanel-BMK5AG_P.js} +2 -2
- package/dist/client/assets/{FoldedSettingsSection-VCEXXLW3.js → FoldedSettingsSection-G9y7luve.js} +2 -2
- package/dist/client/assets/{FormContext-Bgwez2tv.js → FormContext-7fCTOXXA.js} +2 -2
- package/dist/client/assets/{Icons-B5JVkp3z.js → Icons-CSAp87pJ.js} +2 -2
- package/dist/client/assets/Input-Cr3X6dPy.js +2 -0
- package/dist/client/assets/{KeybindingsSettings.logic-6lVDnd1N.js → KeybindingsSettings.logic-CsSjvH9c.js} +2 -2
- package/dist/client/assets/{NoProjectsHero-BQBJO2CN.js → NoProjectsHero-iGEFavkK.js} +2 -2
- package/dist/client/assets/{PanelLayoutControls-DnSdAhOm.js → PanelLayoutControls-C4Gm81F_.js} +4 -4
- package/dist/client/assets/{PierreEntryIcon-B1r7qMgq.js → PierreEntryIcon-CnGUKKOC.js} +2 -2
- package/dist/client/assets/{PopoverHandle-CBT8hFut.js → PopoverHandle-BkhR-kKK.js} +2 -2
- package/dist/client/assets/{PreviewPanel-CtXaNx5N.js → PreviewPanel-BZNqorNM.js} +2 -2
- package/dist/client/assets/{ProjectDefaultsSettings-BYtlqxeq.js → ProjectDefaultsSettings-DzMIpb2U.js} +2 -2
- package/dist/client/assets/{ProjectFavicon-B5bWp7V6.js → ProjectFavicon-Dk18tk1C.js} +3 -3
- package/dist/client/assets/{ProjectIconPickerDialog-BWSyrwJD.js → ProjectIconPickerDialog-DnmG78V1.js} +2 -2
- package/dist/client/assets/{ProjectMonogram-B9iJhcVp.js → ProjectMonogram-CWdfC9NP.js} +2 -2
- package/dist/client/assets/{ProviderAuthTerminal-B2L5_uXE.js → ProviderAuthTerminal-nDUEuuwR.js} +2 -2
- package/dist/client/assets/{ProviderModelPicker-B8ibbi9S.js → ProviderModelPicker-DhOV_BIX.js} +2 -2
- package/dist/client/assets/{ProviderSettingsForm-DYn7It9I.js → ProviderSettingsForm-Cyw48DUr.js} +2 -2
- package/dist/client/assets/{PullRequestCodeTab-BfSQc1r1.js → PullRequestCodeTab-BpjwcQvb.js} +2 -2
- package/dist/client/assets/{ReadOnlySourcePreview-8MghAaC9.js → ReadOnlySourcePreview-DMF3eLls.js} +2 -2
- package/dist/client/assets/{RenderErrorBoundary-Dm9BLD1I.js → RenderErrorBoundary-DQC7sq87.js} +2 -2
- package/dist/client/assets/{ScheduledTasksSettings-ClZG_1G7.js → ScheduledTasksSettings-CZK46eKO.js} +2 -2
- package/dist/client/assets/{ScopedSwitch-C7nxtEAT.js → ScopedSwitch-BECzQob0.js} +2 -2
- package/dist/client/assets/{ScrollAreaCorner-CoeXGFSL.js → ScrollAreaCorner-DXYr9Xbu.js} +2 -2
- package/dist/client/assets/{SecretInput-CROqj1gF.js → SecretInput-WUih9JDs.js} +2 -2
- package/dist/client/assets/{SelectScrollUpArrow-SDOpV3nj.js → SelectScrollUpArrow-BIdW5z3c.js} +2 -2
- package/dist/client/assets/{SettingsPanels-kXpGLc3M.js → SettingsPanels-B3TcgEEZ.js} +2 -2
- package/dist/client/assets/{SettingsPanels.logic-CcNyZsm-.js → SettingsPanels.logic-DpJJdWIn.js} +2 -2
- package/dist/client/assets/{SettingsScopeNotice-CM4ubyNs.js → SettingsScopeNotice-CcgRSc9E.js} +2 -2
- package/dist/client/assets/{T3ConnectAccountPages-Cm4JG3hx.js → T3ConnectAccountPages-8GTdhVAB.js} +2 -2
- package/dist/client/assets/{T3ConnectSidebarSignIn-CmvCTtlG.js → T3ConnectSidebarSignIn-CY6WtOps.js} +2 -2
- package/dist/client/assets/{ThemeEditorPanel-kOwPAMtd.js → ThemeEditorPanel-i2RAKM6Z.js} +2 -2
- package/dist/client/assets/{ThreadTerminalDrawer-CK0khkH6.js → ThreadTerminalDrawer-D7lW_0Ez.js} +2 -2
- package/dist/client/assets/{TooltipViewport-BKD6QABG.js → TooltipViewport-Daddx30c.js} +2 -2
- package/dist/client/assets/{Virtualizer-B895TWmX.js → Virtualizer-CTxMd1UV.js} +2 -2
- package/dist/client/assets/{WorkspaceBreadcrumb-BmVcurpi.js → WorkspaceBreadcrumb-B3WecLwo.js} +2 -2
- package/dist/client/assets/{WorkspacePageContainer-BSjVd7h4.js → WorkspacePageContainer-rn16R8Ps.js} +2 -2
- package/dist/client/assets/{WorkspacePageHeader-BLYOcS9Z.js → WorkspacePageHeader-B2wsiKGJ.js} +2 -2
- package/dist/client/assets/{_chat-akhFQFVf.js → _chat-DCAacYa_.js} +6 -6
- package/dist/client/assets/{_chat.index-P-ZRID1j.js → _chat.index-CqT22uaz.js} +2 -2
- package/dist/client/assets/{_chat.new-DXkFcRYp.js → _chat.new-CTRPd-7l.js} +2 -2
- package/dist/client/assets/{_chat.pull-requests-BYR5YTIM.js → _chat.pull-requests-DZwiHPhH.js} +2 -2
- package/dist/client/assets/{abnfDiagram-VCTEODGH-CcoyEMJc.js → abnfDiagram-VCTEODGH-0sYdmV4a.js} +2 -2
- package/dist/client/assets/{alert-5swcxUBm.js → alert-CvIEaZOb.js} +2 -2
- package/dist/client/assets/architecture-7GRP2DOG-Cre3v_DI.js +1 -0
- package/dist/client/assets/{architectureDiagram-5GKGNRK7-CXxubV6d.js → architectureDiagram-5GKGNRK7-CyILOixS.js} +2 -2
- package/dist/client/assets/{assets-C7tdule6.js → assets-CqHuBXjp.js} +2 -2
- package/dist/client/assets/{blockDiagram-I7D4REHJ-DWnNJQVf.js → blockDiagram-I7D4REHJ-x-VvNLUl.js} +2 -2
- package/dist/client/assets/{browserHistoryStore-PqPCT4tW.js → browserHistoryStore-BpqZwrsk.js} +2 -2
- package/dist/client/assets/{browserLinkTarget-CWURM-O2.js → browserLinkTarget-EXHYn6yB.js} +2 -2
- package/dist/client/assets/{c4Diagram-7LVT6UL2-DKlxhhfG.js → c4Diagram-7LVT6UL2-B0k0wHF6.js} +2 -2
- package/dist/client/assets/channel-DQC0VAAf.js +2 -0
- package/dist/client/assets/{checkbox-1tz9neVf.js → checkbox-EHQPSidC.js} +2 -2
- package/dist/client/assets/{chunk-4HAMMTFA-BXCbWh-l.js → chunk-4HAMMTFA-Uul0p-TJ.js} +2 -2
- package/dist/client/assets/{chunk-75Z2AOVW-ByRA_PDR.js → chunk-75Z2AOVW-SUa_8bmt.js} +2 -2
- package/dist/client/assets/{chunk-DU6HZSFF-CxOE2RJx.js → chunk-DU6HZSFF-DZ_qPx6g.js} +2 -2
- package/dist/client/assets/{chunk-F27PBJKO-DXbxgIcF.js → chunk-F27PBJKO-DNArajpV.js} +2 -2
- package/dist/client/assets/{chunk-GMAD6QVW-C-CPxvzK.js → chunk-GMAD6QVW-DCcQWsDo.js} +2 -2
- package/dist/client/assets/{chunk-GVQU2GXP-N8FA1SLM.js → chunk-GVQU2GXP-CUeM0ruH.js} +2 -2
- package/dist/client/assets/{chunk-IMKFNOWR-DTBCxfEA.js → chunk-IMKFNOWR-Dz48fQ1q.js} +2 -2
- package/dist/client/assets/{chunk-L3NEJ4N5-DpY0Sgfm.js → chunk-L3NEJ4N5-Css7u6Lh.js} +2 -2
- package/dist/client/assets/{chunk-OSK3NFVY-BZXi7c79.js → chunk-OSK3NFVY-CDaAT2I-.js} +2 -2
- package/dist/client/assets/{chunk-P2QGCYS3-CEZ0Wrp3.js → chunk-P2QGCYS3-CrKr6f8Y.js} +2 -2
- package/dist/client/assets/{chunk-POPQ4Y6H-ChY6VtHX.js → chunk-POPQ4Y6H-BqMK6oaX.js} +2 -2
- package/dist/client/assets/{chunk-PWAF6VOD-ynZZsG4M.js → chunk-PWAF6VOD-CyuqbEJS.js} +2 -2
- package/dist/client/assets/{chunk-SHT3W25Y-B2nWifo1.js → chunk-SHT3W25Y-BrH-w9EI.js} +2 -2
- package/dist/client/assets/{chunk-SVP7TREG-B8mLhKtO.js → chunk-SVP7TREG-DC8LP4Dl.js} +2 -2
- package/dist/client/assets/{chunk-TICWLB2K-DRpXMD23.js → chunk-TICWLB2K-D9Rk3v5O.js} +2 -2
- package/dist/client/assets/classDiagram-ZZMXUADV-BnsjDrR7.js +2 -0
- package/dist/client/assets/classDiagram-v2-VYDZK3BY-BnsjDrR7.js +2 -0
- package/dist/client/assets/{color-picker-N6f_Hu7P.js → color-picker-Dd1K-QRk.js} +2 -2
- package/dist/client/assets/{combobox-B07cVaQY.js → combobox-BqpUmoio.js} +2 -2
- package/dist/client/assets/{command-B70eQIps.js → command-D1peviZr.js} +2 -2
- package/dist/client/assets/{connect-C2Pvay2K.js → connect-_R8iiudK.js} +2 -2
- package/dist/client/assets/{connect-agent-F9m6jdrN.js → connect-agent-hovmaVDF.js} +2 -2
- package/dist/client/assets/{cynefin-OW5HDTMX-Bdj9a2Tr.js → cynefin-OW5HDTMX-EgbU-rQt.js} +1 -1
- package/dist/client/assets/{cynefinDiagram-5FMLGOSQ-CI4Z0tY2.js → cynefinDiagram-5FMLGOSQ-D1_um-xk.js} +2 -2
- package/dist/client/assets/{dagre-GXQ25YYZ-BiXNu3UE.js → dagre-GXQ25YYZ-BUeriIID.js} +2 -2
- package/dist/client/assets/{device-dy573Bzs.js → device-DIh4Fmq_.js} +2 -2
- package/dist/client/assets/{diagram-S7CK7UJ4-BoHm89r6.js → diagram-S7CK7UJ4-Du3htb_X.js} +2 -2
- package/dist/client/assets/{diagram-UQ7AKVKN-C-2Ubrz8.js → diagram-UQ7AKVKN-B02FTV2h.js} +2 -2
- package/dist/client/assets/{diagram-VSXAHHWV-5CTD9pHp.js → diagram-VSXAHHWV-C-GXxjgO.js} +2 -2
- package/dist/client/assets/{diagram-VX7I27RA-BJfYpp_F.js → diagram-VX7I27RA-C9x6jBO2.js} +2 -2
- package/dist/client/assets/{diagram-Z3DM3KII-z35dx_kK.js → diagram-Z3DM3KII-BOzwpZ6f.js} +2 -2
- package/dist/client/assets/{dialog-DmneyTGi.js → dialog-BfenC7sz.js} +2 -2
- package/dist/client/assets/{diffRendering-BiYYLTwl.js → diffRendering-EPxtkQvT.js} +2 -2
- package/dist/client/assets/{discovery-list-ZGkddsst.js → discovery-list-NHMaJPrr.js} +2 -2
- package/dist/client/assets/{dist-Bl7QV0pY.js → dist-BgOJfdC2.js} +3 -3
- package/dist/client/assets/{draft-input-DHZ1J7B_.js → draft-input-rVkOduh_.js} +2 -2
- package/dist/client/assets/{duoViewer-CPD9Wvk1.js → duoViewer-CbfTiSKj.js} +2 -2
- package/dist/client/assets/{dynamic-DcfMLaU_.js → dynamic-7n-O1eEM.js} +2 -2
- package/dist/client/assets/{ebnfDiagram-PWID7BFC-C2Fa8ORo.js → ebnfDiagram-PWID7BFC-B-aK7ztf.js} +2 -2
- package/dist/client/assets/{embeddedScripts-DFdnbLSr.js → embeddedScripts-D-v7UxHT.js} +2 -2
- package/dist/client/assets/{empty-hFNkAHps.js → empty-xf3NEL4p.js} +2 -2
- package/dist/client/assets/{entities-B2DNkHHQ.js → entities-CyQRuOur.js} +2 -2
- package/dist/client/assets/{environments-Bqz0Jaj_.js → environments-CjU9SGCA.js} +2 -2
- package/dist/client/assets/{erDiagram-RLTQ6QDP-WIlBdlNc.js → erDiagram-RLTQ6QDP-BUkP1ax_.js} +2 -2
- package/dist/client/assets/eventmodeling-NTZA5JFV-an9DCCTW.js +1 -0
- package/dist/client/assets/{fileLinks-Y7rrQ-ob.js → fileLinks-sFAkJkUp.js} +2 -2
- package/dist/client/assets/{fileTreeExpansion-CktIYdPM.js → fileTreeExpansion-BoG00fm4.js} +2 -2
- package/dist/client/assets/flowDiagram-HODETNUW-pchK5tHw.js +1 -0
- package/dist/client/assets/{ganttDiagram-EL5Y4UJY-CzIDxrzr.js → ganttDiagram-EL5Y4UJY-C9-_e4R8.js} +2 -2
- package/dist/client/assets/{getDiffFileInput-DaXZ00WD.js → getDiffFileInput-Eacwf1x6.js} +2 -2
- package/dist/client/assets/{gitGraph-4MIJSDKK-VJZ5WW8j.js → gitGraph-4MIJSDKK-DpJxnpww.js} +1 -1
- package/dist/client/assets/{gitGraphDiagram-WWUBYQGX--N7ACKgH.js → gitGraphDiagram-WWUBYQGX-D1kbQfjj.js} +2 -2
- package/dist/client/assets/{guideRunStore-C8Xso-YV.js → guideRunStore-pssxpidL.js} +2 -2
- package/dist/client/assets/{htmlRender-BxVc1PlI.js → htmlRender-CDbYs9Mi.js} +2 -2
- package/dist/client/assets/{index-9_IX9wXh.js → index-BcfzEf8A.js} +3 -3
- package/dist/client/assets/{info-A6RAGUB7-BsLL2HTs.js → info-A6RAGUB7-NwzA9LEB.js} +1 -1
- package/dist/client/assets/{infoDiagram-27XIBGKW-H0RWUQa6.js → infoDiagram-27XIBGKW--zzuhsyp.js} +2 -2
- package/dist/client/assets/{input-RqvQJ9gh.js → input-CF-egQtG.js} +2 -2
- package/dist/client/assets/{input-group-BFtrsedw.js → input-group-CifPZlNg.js} +2 -2
- package/dist/client/assets/{ishikawaDiagram-5VMMS53U-BoBtpQFP.js → ishikawaDiagram-5VMMS53U-BtNAzuJP.js} +2 -2
- package/dist/client/assets/{journeyDiagram-3NMN7TZE-rcwS0plS.js → journeyDiagram-3NMN7TZE-CkOdxsrK.js} +2 -2
- package/dist/client/assets/{kanban-definition-UXKFOSKX-CMC0FYSq.js → kanban-definition-UXKFOSKX-L-Zve5xm.js} +2 -2
- package/dist/client/assets/{kbd-BnsXAHsc.js → kbd-DN9MXWor.js} +2 -2
- package/dist/client/assets/{keybindings-BtHOXkP-.js → keybindings-BlEA4Dlt.js} +2 -2
- package/dist/client/assets/{lazyRouteComponent-T0YE6Rn9.js → lazyRouteComponent-b9hpLjZB.js} +2 -2
- package/dist/client/assets/{line-CbOfbAku.js → line-CUIFqVat.js} +2 -2
- package/dist/client/assets/{link-gKYnbTYT.js → link-BIudTto8.js} +2 -2
- package/dist/client/assets/{linkedPrompt-Bw0INRKj.js → linkedPrompt-DQkjE7kc.js} +2 -2
- package/dist/client/assets/{main-C6Kmott7.js → main-C58_iQqs.js} +7 -7
- package/dist/client/assets/{mediaReference-CRKV_ScS.js → mediaReference-D5Qxnp2d.js} +2 -2
- package/dist/client/assets/{mediaSource-Hn2lPB2b.js → mediaSource-DRXKCFCg.js} +2 -2
- package/dist/client/assets/{mermaid-parser.core-BGJPFG4o.js → mermaid-parser.core-Dy9NqIcU.js} +4 -4
- package/dist/client/assets/{mermaid.core-Bt6Qv84k.js → mermaid.core-C1Tbkxei.js} +5 -5
- package/dist/client/assets/{mindmap-definition-YA3MSWOX-4Y8RevXP.js → mindmap-definition-YA3MSWOX-CNHVmlJ4.js} +2 -2
- package/dist/client/assets/{number-field-DIYUxout.js → number-field-CydqGM9B.js} +2 -2
- package/dist/client/assets/{observeResize-D9ECzP-D.js → observeResize-BxVCxCXG.js} +2 -2
- package/dist/client/assets/{onboarding-BnJjKcjq.js → onboarding-DQxSrthd.js} +2 -2
- package/dist/client/assets/{openFileInPreview-BupyBOTN.js → openFileInPreview-tPdJXpV4.js} +2 -2
- package/dist/client/assets/{p4ProjectFile-CUk0B5Zd.js → p4ProjectFile-Dqppy-Sd.js} +2 -2
- package/dist/client/assets/{packet-AYTQ26CC-CRQRHja4.js → packet-AYTQ26CC-D66WQAPv.js} +1 -1
- package/dist/client/assets/{pair-ohR-X0pV.js → pair-BgezPXaC.js} +2 -2
- package/dist/client/assets/{pegDiagram-XKGWAZYB-Dk0K8AzU.js → pegDiagram-XKGWAZYB-D4RZHNwH.js} +2 -2
- package/dist/client/assets/{phoneViewer-DD_58CZV.js → phoneViewer-DKIr7vIR.js} +2 -2
- package/dist/client/assets/{pie-WAS4IAKB-CWKurrWM.js → pie-WAS4IAKB-ChXk3493.js} +1 -1
- package/dist/client/assets/{pieDiagram-E7YTZNPT-DlRA_ADi.js → pieDiagram-E7YTZNPT-BYlPIaAz.js} +2 -2
- package/dist/client/assets/{pierre-icons-Bj2UJzq7.js → pierre-icons-ByQ4P7uM.js} +2 -2
- package/dist/client/assets/{popover-DE9WCm99.js → popover-BunL7s_L.js} +2 -2
- package/dist/client/assets/{preview-Cl-7ojv-.js → preview-B_wcdd8X.js} +2 -2
- package/dist/client/assets/{preview-Czvs-xjq.js → preview-DDUAtKQn.js} +2 -2
- package/dist/client/assets/{previewMiniPlayerStore-Bz1T9oVV.js → previewMiniPlayerStore-gZV-IkW-.js} +2 -2
- package/dist/client/assets/{primary-C0h34HcZ.js → primary-BI3yNRjI.js} +2 -2
- package/dist/client/assets/{primaryCloudLinkState-EkUmcneJ.js → primaryCloudLinkState-Dn_lMN_C.js} +2 -2
- package/dist/client/assets/{projectFilesQueryState-DDX2gPG6.js → projectFilesQueryState-DfToGDLi.js} +2 -2
- package/dist/client/assets/{projectScriptEditor-B-W-Sbdv.js → projectScriptEditor-De4HeOtY.js} +2 -2
- package/dist/client/assets/{providerSkills-OoPsDyac.js → providerSkills-DrIXn_7R.js} +2 -2
- package/dist/client/assets/{pullRequestDetail.logic-BZIPv0wR.js → pullRequestDetail.logic-CGUKFcHo.js} +2 -2
- package/dist/client/assets/{pullRequestIcons-D5Yo5Zsn.js → pullRequestIcons-BZCS4C5B.js} +2 -2
- package/dist/client/assets/{pullRequestReviewStore-DaEzt1m1.js → pullRequestReviewStore-BqvYYzmT.js} +2 -2
- package/dist/client/assets/{pullRequests-BuF4aTBF.js → pullRequests-tIwkUcK2.js} +2 -2
- package/dist/client/assets/{quadrantDiagram-AXDQQJYC-Cgrn1gJf.js → quadrantDiagram-AXDQQJYC-kMIaUDbV.js} +2 -2
- package/dist/client/assets/{queries-B5qQohie.js → queries-DMjiMwzO.js} +2 -2
- package/dist/client/assets/{query-Bd5_Y_Vy.js → query-CRswjQ7f.js} +2 -2
- package/dist/client/assets/{radar-RG4KPBEZ-BNds8J7E.js → radar-RG4KPBEZ-_vEYfKqV.js} +1 -1
- package/dist/client/assets/{radio-group-CBunNtTU.js → radio-group-DzD2uI5x.js} +2 -2
- package/dist/client/assets/{railroad-74A4TZTK-c-ku32yb.js → railroad-74A4TZTK-BiD9GwPs.js} +1 -1
- package/dist/client/assets/railroad-abnf-HS5TGJTU-Dx3SBIg8.js +1 -0
- package/dist/client/assets/railroad-ebnf-LZEXJU2U-DqrIX1EX.js +1 -0
- package/dist/client/assets/railroad-peg-WCYAUIDC-zKUem5fh.js +1 -0
- package/dist/client/assets/{railroadDiagram-O6MQD6OU-CQ0Qmd0t.js → railroadDiagram-O6MQD6OU-VThEbY2-.js} +2 -2
- package/dist/client/assets/{renderScheduler-CFozWmL-.js → renderScheduler-ZbiToRGe.js} +2 -2
- package/dist/client/assets/{requirementDiagram-BXWQKSXE-ssGfFSCi.js → requirementDiagram-BXWQKSXE-CYlc8xoq.js} +2 -2
- package/dist/client/assets/{rightPanelStore-6-YhsfkE.js → rightPanelStore-CcmIdfDA.js} +2 -2
- package/dist/client/assets/{runtime-C2Cbg6bw.js → runtime-BjJBBHTp.js} +2 -2
- package/dist/client/assets/{runtime-C9FXEGBC.js → runtime-D102A-Bu.js} +3 -3
- package/dist/client/assets/{runtimeModeConfig-C3q8YqVA.js → runtimeModeConfig-CGosfJJ5.js} +2 -2
- package/dist/client/assets/{sankeyDiagram-P5KCCOFB-CTZUXdFj.js → sankeyDiagram-P5KCCOFB-CHYSv9pX.js} +2 -2
- package/dist/client/assets/{scheduledTasksSettings.logic-Cucrqmxt.js → scheduledTasksSettings.logic-DhrwaClP.js} +2 -2
- package/dist/client/assets/{scroll-area-Davaj52_.js → scroll-area-OkcD8f0Y.js} +2 -2
- package/dist/client/assets/{select-B47XfaxQ.js → select-BUFUt6O3.js} +2 -2
- package/dist/client/assets/{sequenceDiagram-WJ2MYXX4-B8uW-gHN.js → sequenceDiagram-WJ2MYXX4-D1y7ChUn.js} +2 -2
- package/dist/client/assets/{server-B3nCKBrK.js → server-DTGT8WWf.js} +2 -2
- package/dist/client/assets/{session-DtKtS09P.js → session-Dh8maTO3.js} +2 -2
- package/dist/client/assets/session-logic-CJeISKsG.js +26 -0
- package/dist/client/assets/{settings-BNJbLRpG.js → settings-CrZbdtKO.js} +2 -2
- package/dist/client/assets/{settings.appearance-DKLKCSXj.js → settings.appearance-BNB57wVJ.js} +2 -2
- package/dist/client/assets/settings.archived-C3Vs8tIa.js +2 -0
- package/dist/client/assets/{settings.computer-use-BcdKzzUy.js → settings.computer-use-CNLnfXe7.js} +2 -2
- package/dist/client/assets/{settings.connections-Cjmfz_7g.js → settings.connections-CKn7dmOC.js} +2 -2
- package/dist/client/assets/{settings.data-controls-CZHmsfBq.js → settings.data-controls-B8uFJ36x.js} +2 -2
- package/dist/client/assets/{settings.decisions-C3WA_g2Z.js → settings.decisions-Cy46-IzS.js} +2 -2
- package/dist/client/assets/{settings.diagnostics-Bfh6T3JX.js → settings.diagnostics-BeATxGLt.js} +2 -2
- package/dist/client/assets/{settings.general-HB-_Jy6d.js → settings.general-BAL2BKm_.js} +2 -2
- package/dist/client/assets/{settings.integrations-C-uLxrlE.js → settings.integrations-Bg8Ve2zj.js} +2 -2
- package/dist/client/assets/{settings.keybindings-BGq7j4EC.js → settings.keybindings-B3Yph4YE.js} +2 -2
- package/dist/client/assets/{settings.open-source-licenses-VexlqZXJ.js → settings.open-source-licenses-Dx_Hoxhs.js} +2 -2
- package/dist/client/assets/settings.plugins-TfmhiHSr.js +5 -0
- package/dist/client/assets/{settings.projects-Bl6-Pt9m.js → settings.projects-DyqRcoD5.js} +3 -3
- package/dist/client/assets/{settings.providers-Dk00EIn3.js → settings.providers-CqMvOZmv.js} +3 -3
- package/dist/client/assets/{settings.scheduled-tasks-IH5fvnPs.js → settings.scheduled-tasks-gzepleP4.js} +2 -2
- package/dist/client/assets/{settings.snap-shot-CaOvSkk3.js → settings.snap-shot-DPIz29B9.js} +2 -2
- package/dist/client/assets/{settings.source-control-hwzkeaj5.js → settings.source-control-BMPVT8GA.js} +2 -2
- package/dist/client/assets/{settings.storage-YtslAsAl.js → settings.storage-Cd4Vn9s1.js} +2 -2
- package/dist/client/assets/{settingsLayout-Oe2gP0HD.js → settingsLayout-BRcW18Dy.js} +2 -2
- package/dist/client/assets/{sidebar-BkujXU9U.js → sidebar-CNP67lTi.js} +2 -2
- package/dist/client/assets/{sidebarProjectGrouping-zfg6kMP5.js → sidebarProjectGrouping-BRC9yCnW.js} +2 -2
- package/dist/client/assets/{skeleton-C6_D5JUu.js → skeleton-DDh76jpd.js} +2 -2
- package/dist/client/assets/{sortable.esm-CFdu6ubt.js → sortable.esm-KZlxUbRj.js} +2 -2
- package/dist/client/assets/{sourceControl-CNpb3juM.js → sourceControl-DXwrIEUZ.js} +2 -2
- package/dist/client/assets/{spinner-CpLstN6u.js → spinner-DYnZ-Bpa.js} +2 -2
- package/dist/client/assets/{standalone-page-7vaVYOp-.js → standalone-page-DUgQaNPq.js} +2 -2
- package/dist/client/assets/{stateDiagram-D77RDMKH-BXjvJECk.js → stateDiagram-D77RDMKH-DhHX_ym0.js} +2 -2
- package/dist/client/assets/stateDiagram-v2-MP3YSRHH-Dy0yVJgc.js +2 -0
- package/dist/client/assets/{swimlanes-42K2YHIH-BuQKiVFK.js → swimlanes-42K2YHIH-gr_Fo6MW.js} +2 -2
- package/dist/client/assets/swimlanesDiagram-VR7AAH4N-CPHF5kgn.js +9 -0
- package/dist/client/assets/{terminal-links-CjmSI9gV.js → terminal-links-CV_3r1U3.js} +2 -2
- package/dist/client/assets/{terminalSessions-C0i8FMIw.js → terminalSessions-aS2PVMmc.js} +2 -2
- package/dist/client/assets/{textarea-DKdxwZZC.js → textarea-Dt0w6mtc.js} +2 -2
- package/dist/client/assets/{themePalette-7p_LOU3J.js → themePalette-9CODTNe7.js} +2 -2
- package/dist/client/assets/{threadSort-urWEkJav.js → threadSort-BGtAZpdL.js} +2 -2
- package/dist/client/assets/{timeline-definition-24CTP7MA-gsy_kdrp.js → timeline-definition-24CTP7MA-DOSB4Ras.js} +2 -2
- package/dist/client/assets/{toast-D1xgN6T2.js → toast-SPJYfh08.js} +2 -2
- package/dist/client/assets/{toggle-BshAsXT6.js → toggle-C3pF5hng.js} +2 -2
- package/dist/client/assets/{toggle-group-ZNzhUvHt.js → toggle-group-C4V_4iet.js} +2 -2
- package/dist/client/assets/{tooltip-Cq9yz15d.js → tooltip-Cco13jKX.js} +2 -2
- package/dist/client/assets/{treeView-Q6P3EWNA-BHvMPOqK.js → treeView-Q6P3EWNA-DTI4SxFY.js} +1 -1
- package/dist/client/assets/{treemap-WGGIJYW6-D8SWHA1Z.js → treemap-WGGIJYW6-CVnkW1D0.js} +1 -1
- package/dist/client/assets/{usage-BsNTrKRO.js → usage-539lpsjW.js} +2 -2
- package/dist/client/assets/{usageAccess-CieOJbVm.js → usageAccess-CeCsk7TS.js} +2 -2
- package/dist/client/assets/{usageFormat-BEGhDYfU.js → usageFormat-CQXspPhL.js} +2 -2
- package/dist/client/assets/{usageShortcuts-DxuByyhD.js → usageShortcuts-DaMuOxo1.js} +2 -2
- package/dist/client/assets/{use-atom-command-DFVJioxM.js → use-atom-command-BHmF32aL.js} +2 -2
- package/dist/client/assets/{useAriaLabelledBy-u5efXUxw.js → useAriaLabelledBy-BinWYOc0.js} +2 -2
- package/dist/client/assets/{useHandleNewThread-D3kzOunA.js → useHandleNewThread-Tv2D0mTw.js} +2 -2
- package/dist/client/assets/{useLocation-B3ir4ben.js → useLocation-BQwksr61.js} +2 -2
- package/dist/client/assets/useNavigate-LjcLtV_e.js +2 -0
- package/dist/client/assets/{useNavigateBack-XQd0WINI.js → useNavigateBack-D2S1CDHR.js} +2 -2
- package/dist/client/assets/{useParams-Cil-ZIwd.js → useParams-D_8gJiai.js} +2 -2
- package/dist/client/assets/{usePermissionStatus-C4aMrLLP.js → usePermissionStatus-Bl_cAihc.js} +2 -2
- package/dist/client/assets/{usePullRequestActions-eR9_K37m.js → usePullRequestActions-DscMhi-m.js} +2 -2
- package/dist/client/assets/{useRegisterFieldControl-75QESVfk.js → useRegisterFieldControl-Bp078Il-.js} +2 -2
- package/dist/client/assets/{useScopedModelAvailability-DloNarQ1.js → useScopedModelAvailability-BP4GoHk-.js} +2 -2
- package/dist/client/assets/{useSettings-BVUg52H2.js → useSettings-DUgjfqYw.js} +2 -2
- package/dist/client/assets/{useT3ConnectAuthPrompt-iHfw63uu.js → useT3ConnectAuthPrompt-D0cW1Kb6.js} +2 -2
- package/dist/client/assets/utils-Dx_TSvdC.js +37 -0
- package/dist/client/assets/{vcsRefInvalidation-DZeFb_fD.js → vcsRefInvalidation-CRBfa6Wz.js} +2 -2
- package/dist/client/assets/{vennDiagram-4TSXK5OY-DWeHYWRx.js → vennDiagram-4TSXK5OY-BVgFdMgp.js} +2 -2
- package/dist/client/assets/{wardley-WFR3VGLG-CfPV8k7N.js → wardley-WFR3VGLG-Dmh19KFW.js} +1 -1
- package/dist/client/assets/{wardleyDiagram-VM6X3IG4-D0SH6I3q.js → wardleyDiagram-VM6X3IG4-CLjnvp-z.js} +2 -2
- package/dist/client/assets/{welcome-BWkyKuVQ.js → welcome-BcEvYhrg.js} +2 -2
- package/dist/client/assets/{xychartDiagram-S5SC5T6Z-CHYweeaE.js → xychartDiagram-S5SC5T6Z-CmyAZ93b.js} +2 -2
- package/dist/client/index.html +1 -1
- package/dist/{renderer-BFtino0A.mjs → renderer-B8qsc7RL.mjs} +2 -2
- package/dist/{runtime-ERvpj9Mz.mjs → runtime-CEdmfdaF.mjs} +18 -4
- package/package.json +1 -1
- package/dist/client/assets/AlertDialogRoot-DvQNG7Nt.js +0 -2
- package/dist/client/assets/Input-BQRZG5rU.js +0 -2
- package/dist/client/assets/architecture-7GRP2DOG-BCI44Tco.js +0 -1
- package/dist/client/assets/channel-FPHxEbB1.js +0 -2
- package/dist/client/assets/classDiagram-ZZMXUADV-BmhihMCg.js +0 -2
- package/dist/client/assets/classDiagram-v2-VYDZK3BY-BmhihMCg.js +0 -2
- package/dist/client/assets/eventmodeling-NTZA5JFV-Q6rJ-HVs.js +0 -1
- package/dist/client/assets/flowDiagram-HODETNUW-Dyon23dU.js +0 -1
- package/dist/client/assets/railroad-abnf-HS5TGJTU-DdK1L4Kf.js +0 -1
- package/dist/client/assets/railroad-ebnf-LZEXJU2U-DAIwdsWb.js +0 -1
- package/dist/client/assets/railroad-peg-WCYAUIDC-B6SwzZWt.js +0 -1
- package/dist/client/assets/session-logic-P3KsudEl.js +0 -26
- package/dist/client/assets/settings.archived-BeEB6d0D.js +0 -2
- package/dist/client/assets/settings.plugins-P_jMyYCz.js +0 -5
- package/dist/client/assets/stateDiagram-v2-MP3YSRHH-DoChugDq.js +0 -2
- package/dist/client/assets/swimlanesDiagram-VR7AAH4N-Bwk0C9Yw.js +0 -9
- package/dist/client/assets/useNavigate-DRqH9NhA.js +0 -2
- package/dist/client/assets/utils-BEVyjoxo.js +0 -37
package/dist/client/assets/{settings.connections-Cjmfz_7g.js → settings.connections-CKn7dmOC.js}
RENAMED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{i as e}from"./rolldown-runtime-Dd_uD5pT.js";import{r as t}from"./Icon-l19w4AjM.js";import{$b as n,$n as r,$o as i,BT as a,By as o,C_ as s,Cy as c,D_ as l,E_ as u,Gd as d,Gn as f,Go as p,Gp as m,Hg as h,IT as g,Kg as _,LT as v,Lc as y,NE as b,NT as x,Pp as S,Qn as C,Qo as w,Rp as T,S_ as E,T_ as D,Tf as O,Ub as k,Um as A,YS as j,Yn as M,Yo as N,Zn as P,__ as F,_m as ee,ar as te,b_ as ne,bd as re,cr as ie,f_ as ae,ir as oe,is as se,j_ as ce,jx as I,lE as le,l_ as ue,lv as L,m_ as de,or as fe,p_ as R,rr as pe,s_ as me,sr as z,ss as he,t as ge,tr as _e,u_ as ve,v_ as ye,vd as be,w_ as B,x_ as xe,y_ as Se,yl as Ce}from"./utils-BEVyjoxo.js";import{Dt as V,Et as we,F as Te,Ht as Ee,On as De,Ot as Oe,R as ke,Ut as Ae,W as je,jt as Me,kt as Ne,o as Pe,on as Fe,tt as H,w as Ie,x as U}from"./runtime-C9FXEGBC.js";import{E as W,Et as Le,F as Re,S as ze,St as Be,Tt as Ve,_ as He,bt as Ue,t as G}from"./runtime-C2Cbg6bw.js";import{a as We,c as Ge,o as Ke,s as qe,t as Je}from"./select-B47XfaxQ.js";import{t as K}from"./spinner-CpLstN6u.js";import{i as q,p as Ye}from"./toast-D1xgN6T2.js";import{a as Xe,n as Ze,t as Qe}from"./tooltip-Cq9yz15d.js";import{a as $e,l as et,o as tt,s as J}from"./environments-Bqz0Jaj_.js";import{f as nt,h as rt,s as it}from"./server-B3nCKBrK.js";import{a as at,i as ot,n as st,s as ct}from"./session-DtKtS09P.js";import{n as lt}from"./query-Bd5_Y_Vy.js";import{t as ut}from"./use-atom-command-DFVJioxM.js";import{W as dt,b as ft,c as Y,s as pt,v as mt}from"./useSettings-BVUg52H2.js";import{n as ht}from"./toastHelpers-Dsph6LwL.js";import{i as gt,r as _t}from"./timestampFormat-wac2e_Jz.js";import{t as vt}from"./textarea-DKdxwZZC.js";import{_ as yt,b as bt,g as xt,h as St,v as Ct,x as wt,y as Tt}from"./command-B70eQIps.js";import{t as Et}from"./input-RqvQJ9gh.js";import{t as Dt}from"./scroll-area-Davaj52_.js";import{a as Ot,c as kt,i as At,l as jt,n as Mt,o as Nt,r as Pt,s as Ft,t as It}from"./dialog-DmneyTGi.js";import{n as Lt}from"./T3ConnectAccountPages-Cm4JG3hx.js";import{a as Rt,i as zt,o as Bt,r as Vt,t as Ht}from"./empty-hFNkAHps.js";import{t as Ut}from"./AnimatedHeight-CH-N3JTc.js";import{C as Wt,_ as Gt,w as Kt,y as qt}from"./keybindings-BtHOXkP-.js";import{i as Jt,o as Yt,t as Xt}from"./popover-DE9WCm99.js";import{t as Zt}from"./checkbox-1tz9neVf.js";import{a as Qt,b as $t,c as en,h as tn,i as nn,l as rn,m as an,n as on,o as sn,p as cn,s as ln,t as un,u as dn}from"./sortable.esm-CFdu6ubt.js";import{n as fn,t as pn}from"./EnvironmentMachineIcon-DCdlTSYU.js";import{r as mn,t as hn}from"./alert-5swcxUBm.js";import{a as gn,i as _n,s as vn,u as yn}from"./settingsLayout-Oe2gP0HD.js";import{t as X}from"./ConnectionStatusDot-cdpNRZhA.js";import{a as bn,n as xn,o as Sn,s as Cn,t as wn}from"./primary-C0h34HcZ.js";import{n as Tn,t as En}from"./onboarding-BnJjKcjq.js";import{Ar as Dn,Er as On,Fa as kn,Fr as An,Gn as jn,Ir as Mn,Jn as Nn,Kn as Pn,La as Fn,Mr as In,Nr as Ln,Or as Rn,Pa as zn,Pr as Bn,Qn as Vn,T as Hn,Tr as Un,Xn as Wn,Yn as Gn,Zn as Kn,_r as qn,an as Jn,ci as Yn,gr as Xn,hr as Zn,in as Qn,ir as $n,jr as er,kr as tr,mr as nr,nn as rr,on as ir,qn as ar,si as or}from"./main-C6Kmott7.js";import{t as sr}from"./FoldedSettingsSection-VCEXXLW3.js";var Z=b(),cr=[{scope:ye,title:`View environment`,description:`Read threads, status, checkpoints, and configuration.`},{scope:F,title:`Operate tasks`,description:`Start, update, and stop tasks.`},{scope:s,title:`Change environment settings`,description:`Edit environment preferences and keybindings.`},{scope:ne,title:`Manage providers`,description:`Configure, install, sign in to, and update providers and usage sources.`},{scope:ae,title:`Maintain environment`,description:`Update the server and control environment processes.`},{scope:Se,title:`Control previews`,description:`Open browser previews and host browser automation.`},{scope:ve,title:`View diagnostics and usage`,description:`Read process diagnostics, resource history, and usage totals.`},{scope:l,title:`View terminals`,description:`Read existing terminal output and status.`},{scope:u,title:`Use terminals`,description:`Create terminals and send input to running shells.`},{scope:B,title:`Change source control`,description:`Commit, push, manage branches and repositories, and change pull requests.`},{scope:R,title:`Read files`,description:`Browse host files, search workspaces, and inspect local changes.`},{scope:de,title:`Write files`,description:`Edit workspace files and save plans to disk.`},{scope:me,title:`View access`,description:`Inspect pairing links and authorized clients.`},{scope:ue,title:`Manage access`,description:`Issue and revoke credentials for other clients.`},{scope:xe,title:`View relay`,description:`Inspect managed relay connectivity.`},{scope:E,title:`Manage relay`,description:`Change managed tunnel connectivity.`}],Q=e(le(),1);function lr(e){let t=(0,Z.c)(4),{environmentId:n,connected:r,routeContext:i}=e,a=i!==void 0&&i,o=at(n),s;return t[0]!==r||t[1]!==a||t[2]!==o?(s=r&&!o.hasError&&!o.isPending&&o.data?.authenticated?(0,Q.jsxs)(`div`,{className:`space-y-3 py-3 text-xs`,children:[(0,Q.jsx)(`p`,{className:`text-muted-foreground`,children:a?`These permissions apply to your active route. Other routes may have different permissions.`:`These permissions apply to this client’s current connection.`}),(0,Q.jsx)(`ul`,{className:`grid gap-x-6 gap-y-2 sm:grid-cols-2`,children:cr.map(e=>{let{scope:t,title:n}=e;return(0,Q.jsxs)(`li`,{className:`flex items-start justify-between gap-3`,children:[(0,Q.jsx)(`span`,{children:n}),(0,Q.jsx)(`span`,{className:`shrink-0 text-muted-foreground`,children:ce(o.data,t)?`Allowed`:`Not granted`})]},t)})})]}):(0,Q.jsx)(`p`,{className:`py-3 text-xs text-muted-foreground`,children:`Permissions not checked. Connect to this environment to view this session’s permissions.`}),t[0]=r,t[1]=a,t[2]=o,t[3]=s):s=t[3],s}var $=e(t(),1);function ur(e,t){let n=new URL(e);return n.pathname=`/pair`,Le(n,t).toString()}function dr(e,t){return new URL(e).protocol===`https:`?ze({host:e,token:t}):null}function fr(){let e=(0,Z.c)(48),t=window.desktopBridge?.setLocalEnvironmentEnabled,[n]=(0,$.useState)(pr),[r,i]=(0,$.useState)(!1),[a,o]=(0,$.useState)(!1),[s,c]=(0,$.useState)(null);if(!t)return null;let l;e[0]===n?l=e[1]:(l=async()=>{o(!0),c(null);try{await t(!n)}catch(e){let t=e;c(t instanceof Error?t.message:`Couldn't change this setting.`),o(!1)}},e[0]=n,e[1]=l);let u=l,d;e[2]===Symbol.for(`react.memo_cache_sentinel`)?(d=$n(`local-environment`),e[2]=d):d=e[2];let f=n?`Run agents on this computer. Turn off to use P4 Code only with remote environments.`:`Turned off. Agents only run in remote environments.`,p;e[3]===Symbol.for(`react.memo_cache_sentinel`)?(p=()=>i(!0),e[3]=p):p=e[3];let m;e[4]!==n||e[5]!==a?(m=(0,Q.jsx)(Fn,{checked:n,disabled:a,onCheckedChange:p,"aria-label":`Local environment`}),e[4]=n,e[5]=a,e[6]=m):m=e[6];let h;e[7]!==f||e[8]!==m?(h=(0,Q.jsx)(gn,{...d,description:f,control:m}),e[7]=f,e[8]=m,e[9]=h):h=e[9];let g;e[10]===a?g=e[11]:(g=e=>{a||(i(e),e||c(null))},e[10]=a,e[11]=g);let _=n?`Turn off local environment?`:`Turn on local environment?`,v;e[12]===_?v=e[13]:(v=(0,Q.jsx)(Mn,{children:_}),e[12]=_,e[13]=v);let y=n?`P4 Code will restart without running a server on this computer. Any agents and terminals running here will stop, and other devices will no longer be able to connect to this computer. Your projects, history, and remote environments are unaffected.`:`P4 Code will restart and start running a server on this computer again.`,b;e[14]===y?b=e[15]:(b=(0,Q.jsx)(In,{children:y}),e[14]=y,e[15]=b);let x;e[16]!==b||e[17]!==v?(x=(0,Q.jsxs)(Bn,{children:[v,b]}),e[16]=b,e[17]=v,e[18]=x):x=e[18];let S;e[19]===s?S=e[20]:(S=s?(0,Q.jsx)(`p`,{className:`px-6 pb-4 text-sm text-destructive`,children:s}):null,e[19]=s,e[20]=S);let C;e[21]===Symbol.for(`react.memo_cache_sentinel`)?(C=(0,Q.jsx)(z,{variant:`outline`}),e[21]=C):C=e[21];let w;e[22]===a?w=e[23]:(w=(0,Q.jsx)(er,{disabled:a,render:C,children:`Cancel`}),e[22]=a,e[23]=w);let T=n?`destructive`:`default`,E;e[24]===u?E=e[25]:(E=()=>void u(),e[24]=u,e[25]=E);let D;e[26]!==n||e[27]!==a?(D=a?(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(K,{size:`sm`}),`Restarting…`]}):n?`Restart and turn off`:`Restart and turn on`,e[26]=n,e[27]=a,e[28]=D):D=e[28];let O;e[29]!==a||e[30]!==T||e[31]!==E||e[32]!==D?(O=(0,Q.jsx)(z,{variant:T,disabled:a,onClick:E,children:D}),e[29]=a,e[30]=T,e[31]=E,e[32]=D,e[33]=O):O=e[33];let k;e[34]!==w||e[35]!==O?(k=(0,Q.jsxs)(Ln,{children:[w,O]}),e[34]=w,e[35]=O,e[36]=k):k=e[36];let A;e[37]!==x||e[38]!==S||e[39]!==k?(A=(0,Q.jsxs)(An,{children:[x,S,k]}),e[37]=x,e[38]=S,e[39]=k,e[40]=A):A=e[40];let j;e[41]!==r||e[42]!==A||e[43]!==g?(j=(0,Q.jsx)(Dn,{open:r,onOpenChange:g,children:A}),e[41]=r,e[42]=A,e[43]=g,e[44]=j):j=e[44];let M;return e[45]!==j||e[46]!==h?(M=(0,Q.jsxs)(Q.Fragment,{children:[h,j]}),e[45]=j,e[46]=h,e[47]=M):M=e[47],M}function pr(){return!Ie()}function mr(e){return e.serverConfig===null?`Connect to this environment to change its icon.`:e.serverConfig.environment.capabilities.environmentIcon===!0?e.operateAccess===`granted`?null:`Your session on this environment cannot change its settings.`:`This environment's server is too old to keep an icon. Update it to choose one.`}function hr(e){let t=(0,Z.c)(27),{environmentId:n,serverConfig:i}=e,a=ft(n),o=ot(n,`settings:write`)?`granted`:`denied`,s;t[0]!==o||t[1]!==i?(s=mr({serverConfig:i,operateAccess:o}),t[0]=o,t[1]=i,t[2]=s):s=t[2];let c=s,l=i?.environment.platform.machine??`server`,u;t[3]===i?u=t[4]:(u=Ce(i),t[3]=i,t[4]=u);let d=u,f;t[5]===d?f=t[6]:(f=(0,Q.jsxs)(te,{children:[(0,Q.jsx)(fn,{kind:d}),`Icon`]}),t[5]=d,t[6]=f);let p;t[7]===c?p=t[8]:(p=c===null?null:(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(M,{disabled:!0,className:`whitespace-normal`,children:c}),(0,Q.jsx)(_e,{})]}),t[7]=c,t[8]=p);let m;t[9]!==l||t[10]!==c||t[11]!==a?(m=e=>{c===null&&_(e)&&a({environmentIcon:e===l?null:e})},t[9]=l,t[10]=c,t[11]=a,t[12]=m):m=t[12];let g;t[13]!==l||t[14]!==c||t[15]!==i?.environment?(g=h.map(e=>(0,Q.jsx)(r,{value:e,disabled:c!==null,children:(0,Q.jsxs)(`span`,{className:`flex min-w-0 items-center gap-2`,children:[(0,Q.jsx)(fn,{kind:e,className:`size-3.5 shrink-0`}),(0,Q.jsx)(`span`,{className:`min-w-0 flex-1 truncate`,children:pn[e]}),e===l?(0,Q.jsx)(`span`,{className:`shrink-0 text-xs text-muted-foreground`,children:i?.environment.platform.machine?`detected`:`default`}):null]})},e)),t[13]=l,t[14]=c,t[15]=i?.environment,t[16]=g):g=t[16];let v;t[17]!==d||t[18]!==m||t[19]!==g?(v=(0,Q.jsx)(C,{value:d,onValueChange:m,children:g}),t[17]=d,t[18]=m,t[19]=g,t[20]=v):v=t[20];let y;t[21]!==p||t[22]!==v?(y=(0,Q.jsxs)(oe,{children:[p,v]}),t[21]=p,t[22]=v,t[23]=y):y=t[23];let b;return t[24]!==f||t[25]!==y?(b=(0,Q.jsxs)(pe,{children:[f,y]}),t[24]=f,t[25]=y,t[26]=b):b=t[26],b}function gr(e){let t=(0,Z.c)(31),{environment:n,onAddRoute:r}=e,i=Ne(n.entry),a=i.map(vr),[o,s]=(0,$.useState)(null),c=o!==null&&o.length===a.length&&o.some((e,t)=>e!==a[t])?[...o]:a,l=new Map(i.map(_r)),u=c.flatMap(e=>l.get(e)??[]),d=ct(n.environmentId),f;t[0]!==n.connection||t[1]!==d._tag||t[2]!==d.value?(f=d._tag===`Some`&&n.connection.phase===`connected`?V(d.value.target):null,t[0]=n.connection,t[1]=d._tag,t[2]=d.value,t[3]=f):f=t[3];let p=f,m=ut(rt.reorderRoutes,`Reorder routes`),h=ut(rt.removeRoute,`Remove route`),g;t[4]===Symbol.for(`react.memo_cache_sentinel`)?(g={activationConstraint:{distance:4}},t[4]=g):g=t[4];let _;t[5]===Symbol.for(`react.memo_cache_sentinel`)?(_={coordinateGetter:nn},t[5]=_):_=t[5];let v=an(cn(rn,g),cn(en,_)),y;t[6]!==n.environmentId||t[7]!==h?(y=async e=>{let t=we(e);await dt(`Remove ${Oe(e)} route?${t===null?``:`\n${t}`}`,{variant:`destructive`})===!0&&await h({environmentId:n.environmentId,routeId:V(e.target)})},t[6]=n.environmentId,t[7]=h,t[8]=y):y=t[8];let b=y,x=e=>{if(e.over===null||e.active.id===e.over.id)return;let t=on(c,c.indexOf(String(e.active.id)),c.indexOf(String(e.over.id)));s(t),m({environmentId:n.environmentId,routeIds:t}).then(e=>{e._tag===`Failure`&&s(null)})},C=ln,w=dn,T;t[9]===Symbol.for(`react.memo_cache_sentinel`)?(T=[Yn,or],t[9]=T):T=t[9];let E=un,D=sn,O=`Routes to ${n.label}, preferred first`,k=u.map((e,t)=>(0,Q.jsx)(yr,{route:e,position:t+1,inUse:V(e.target)===p,removable:u.length>1&&!Me(e),onRemove:()=>void b(e)},V(e.target))),A;t[10]!==k||t[11]!==O?(A=(0,Q.jsx)(`ol`,{"aria-label":O,children:k}),t[10]=k,t[11]=O,t[12]=A):A=t[12];let j;t[13]!==E||t[14]!==c||t[15]!==A||t[16]!==D?(j=(0,Q.jsx)(E,{items:c,strategy:D,children:A}),t[13]=E,t[14]=c,t[15]=A,t[16]=D,t[17]=j):j=t[17];let M;t[18]!==C||t[19]!==x||t[20]!==v||t[21]!==j||t[22]!==w||t[23]!==T?(M=(0,Q.jsx)(C,{sensors:v,collisionDetection:w,modifiers:T,onDragEnd:x,children:j}),t[18]=C,t[19]=x,t[20]=v,t[21]=j,t[22]=w,t[23]=T,t[24]=M):M=t[24];let N;t[25]===Symbol.for(`react.memo_cache_sentinel`)?(N=(0,Q.jsx)(S,{className:`size-3`}),t[25]=N):N=t[25];let P;t[26]===r?P=t[27]:(P=(0,Q.jsx)(`div`,{className:`-ml-1.5 pt-1`,children:(0,Q.jsxs)(z,{size:`xs`,variant:`ghost-muted`,onClick:r,children:[N,`Add route`]})}),t[26]=r,t[27]=P);let F;return t[28]!==M||t[29]!==P?(F=(0,Q.jsxs)(`div`,{className:`mt-2 border-t border-border/50 py-2`,children:[M,P]}),t[28]=M,t[29]=P,t[30]=F):F=t[30],F}function _r(e){return[V(e.target),e]}function vr(e){return V(e.target)}function yr(e){let t=(0,Z.c)(43),{route:n,position:r,inUse:i,removable:a,onRemove:o}=e,s;t[0]===n.target?s=t[1]:(s=V(n.target),t[0]=n.target,t[1]=s);let c=s,l;t[2]===n?l=t[3]:(l=Oe(n),t[2]=n,t[3]=l);let u=l,d;t[4]===n?d=t[5]:(d=we(n),t[4]=n,t[5]=d);let f=d,p;t[6]===c?p=t[7]:(p={id:c},t[6]=c,t[7]=p);let{attributes:m,listeners:h,setNodeRef:g,setActivatorNodeRef:_,transform:v,transition:y,isDragging:b}=Qt(p),x;t[8]===v?x=t[9]:(x=tn.Translate.toString(v),t[8]=v,t[9]=x);let S;t[10]!==x||t[11]!==y?(S={transform:x,transition:y},t[10]=x,t[11]=y,t[12]=S):S=t[12];let C=b&&`relative z-10 rounded-md bg-background shadow-md`,w;t[13]===C?w=t[14]:(w=ge(`flex items-center gap-2 py-2`,C),t[13]=C,t[14]=w);let T;t[15]===i?T=t[16]:(T=i?(0,Q.jsx)(`span`,{className:`rounded-sm bg-success/12 px-1 text-2xs font-normal text-success-foreground`,children:`In use`}):null,t[15]=i,t[16]=T);let E;t[17]!==u||t[18]!==T?(E=(0,Q.jsxs)(`p`,{className:`flex items-center gap-1.5 text-xs font-medium text-foreground`,children:[u,T]}),t[17]=u,t[18]=T,t[19]=E):E=t[19];let D;t[20]!==f||t[21]!==n?(D=f===null?null:(0,Q.jsxs)(`p`,{className:`truncate text-2xs text-muted-foreground`,children:[f,Me(n)?` · found automatically`:``]}),t[20]=f,t[21]=n,t[22]=D):D=t[22];let k;t[23]!==E||t[24]!==D?(k=(0,Q.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[E,D]}),t[23]=E,t[24]=D,t[25]=k):k=t[25];let j=`Reorder ${u}, position ${r}`,M;t[26]===Symbol.for(`react.memo_cache_sentinel`)?(M=(0,Q.jsx)(O,{className:`size-3.5`}),t[26]=M):M=t[26];let N;t[27]!==m||t[28]!==h||t[29]!==_||t[30]!==j?(N=(0,Q.jsx)(`button`,{type:`button`,ref:_,...m,...h,"aria-label":j,className:`flex size-6 shrink-0 cursor-grab touch-none items-center justify-center rounded text-muted-foreground/70 outline-none hover:text-foreground focus-visible:ring-2 focus-visible:ring-inset focus-visible:ring-ring active:cursor-grabbing`,children:M}),t[27]=m,t[28]=h,t[29]=_,t[30]=j,t[31]=N):N=t[31];let P;t[32]!==u||t[33]!==o||t[34]!==a?(P=a?(0,Q.jsxs)(Qe,{children:[(0,Q.jsx)(Xe,{render:(0,Q.jsx)(z,{type:`button`,variant:`ghost-muted`,size:`icon-xs`,"aria-label":`Remove ${u} route`,onClick:o}),children:(0,Q.jsx)(A,{className:`size-3`})}),(0,Q.jsx)(Ze,{side:`top`,children:`Remove route`})]}):null,t[32]=u,t[33]=o,t[34]=a,t[35]=P):P=t[35];let F;return t[36]!==g||t[37]!==k||t[38]!==N||t[39]!==P||t[40]!==S||t[41]!==w?(F=(0,Q.jsxs)(`li`,{ref:g,style:S,className:w,children:[k,N,P]}),t[36]=g,t[37]=k,t[38]=N,t[39]=P,t[40]=S,t[41]=w,t[42]=F):F=t[42],F}function br(e){let t=e.username?`${e.username}@${e.hostname}`:e.hostname;return e.port?`${t}:${e.port}`:t}function xr(e,t=null){let{entry:n}=e;if(n.target._tag===`PrimaryConnectionTarget`)return`This machine`;let r=Ne(n);if(r.length>1){let e=t===null?void 0:r.find(e=>V(e.target)===V(t));return e===void 0?Oe(r[0]):`via ${Oe(e)}`}return e.relayManaged?`P4 Connect`:He(n.target)?`WSL`:n.target._tag===`SshConnectionTarget`&&v(n.profile)&&n.profile.value._tag===`SshConnectionProfile`?`SSH ${br(n.profile.value.target)}`:e.displayUrl??`Remote link`}function Sr(e){let t=(0,Z.c)(23),{kind:n,label:r,subtitle:i,below:a,detail:o,dimmed:s,className:c,children:l}=e,u=s!==void 0&&s&&`opacity-60`,d;t[0]!==c||t[1]!==u?(d=ge(`grid grid-cols-[auto_minmax(0,1fr)_auto] items-center gap-x-3 px-3 py-2.5 sm:px-4`,u,c),t[0]=c,t[1]=u,t[2]=d):d=t[2];let f;t[3]===n?f=t[4]:(f=(0,Q.jsx)(fn,{"aria-hidden":!0,kind:n,className:`size-4 text-muted-foreground`}),t[3]=n,t[4]=f);let p;t[5]===r?p=t[6]:(p=(0,Q.jsx)(`p`,{className:`truncate text-sm font-medium text-foreground`,children:r}),t[5]=r,t[6]=p);let m;t[7]===i?m=t[8]:(m=(0,Q.jsx)(`div`,{className:`truncate text-xs text-muted-foreground`,children:i}),t[7]=i,t[8]=m);let h;t[9]!==a||t[10]!==p||t[11]!==m?(h=(0,Q.jsxs)(`div`,{className:`min-w-0`,children:[p,m,a]}),t[9]=a,t[10]=p,t[11]=m,t[12]=h):h=t[12];let g;t[13]===l?g=t[14]:(g=(0,Q.jsx)(`div`,{className:`flex shrink-0 items-center gap-1`,children:l}),t[13]=l,t[14]=g);let _;t[15]===o?_=t[16]:(_=o?(0,Q.jsx)(`div`,{className:`col-span-2 col-start-2 min-w-0`,children:o}):null,t[15]=o,t[16]=_);let v;return t[17]!==d||t[18]!==f||t[19]!==h||t[20]!==g||t[21]!==_?(v=(0,Q.jsxs)(`div`,{className:d,children:[f,h,g,_]}),t[17]=d,t[18]=f,t[19]=h,t[20]=g,t[21]=_,t[22]=v):v=t[22],v}var Cr=[{value:100,label:`Prefer`},{value:50,label:`Normal`},{value:25,label:`Less often`},{value:0,label:`Manual only`}];function wr(e){return e===void 0||e===50?50:e===0?0:e<50?25:100}function Tr(e){return Cr.find(t=>t.value===e).label}function Er(e,t){let n=e.flatMap(e=>{let n=wr(t[e.environmentId]);return n===50?[]:[`${e.label} ${Tr(n).toLowerCase()}`]});return n.length===0?null:n.join(` · `)}function Dr(e){let t=(0,Z.c)(27),{environments:n}=e,r=pt(),i=Y(),a=mt();if(n.length<2)return null;let o;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(o=$n(`load-balancing`),t[0]=o):o=t[0];let{id:s,title:c}=o,l;t[1]!==n||t[2]!==r.loadBalancingEnabled||t[3]!==r.loadBalancingWeights?(l=r.loadBalancingEnabled?Er(n,r.loadBalancingWeights):`Off`,t[1]=n,t[2]=r.loadBalancingEnabled,t[3]=r.loadBalancingWeights,t[4]=l):l=t[4];let u=!i,d;t[5]===a?d=t[6]:(d=e=>a({loadBalancingEnabled:e}),t[5]=a,t[6]=d);let f;t[7]!==r.loadBalancingEnabled||t[8]!==u||t[9]!==d?(f=(0,Q.jsx)(Fn,{"aria-label":`Automatically balance load`,checked:r.loadBalancingEnabled,disabled:u,onCheckedChange:d}),t[7]=r.loadBalancingEnabled,t[8]=u,t[9]=d,t[10]=f):f=t[10];let p;t[11]===Symbol.for(`react.memo_cache_sentinel`)?(p=(0,Q.jsx)(`p`,{className:`px-3 py-2.5 text-xs text-muted-foreground sm:px-4`,children:`New threads in shared projects start on the machine with the most free CPU and memory, weighted by each machine's preference.`}),t[11]=p):p=t[11];let m;if(t[12]!==n||t[13]!==r.loadBalancingEnabled||t[14]!==r.loadBalancingWeights||t[15]!==i||t[16]!==a){let e;t[18]!==r.loadBalancingEnabled||t[19]!==r.loadBalancingWeights||t[20]!==i||t[21]!==a?(e=e=>(0,Q.jsx)(Sr,{kind:Ce(e.serverConfig),label:e.label,subtitle:xr(e),children:(0,Q.jsxs)(Je,{items:Cr,value:wr(r.loadBalancingWeights[e.environmentId]),disabled:!i||!r.loadBalancingEnabled,onValueChange:t=>{t!==null&&a({loadBalancingWeights:{...r.loadBalancingWeights,[e.environmentId]:t}})},children:[(0,Q.jsx)(qe,{size:`xs`,className:`w-32`,"aria-label":`${e.label} load preference`,children:(0,Q.jsx)(Ge,{})}),(0,Q.jsx)(Ke,{align:`end`,alignItemWithTrigger:!1,children:Cr.map(Or)})]})},e.environmentId),t[18]=r.loadBalancingEnabled,t[19]=r.loadBalancingWeights,t[20]=i,t[21]=a,t[22]=e):e=t[22],m=n.map(e),t[12]=n,t[13]=r.loadBalancingEnabled,t[14]=r.loadBalancingWeights,t[15]=i,t[16]=a,t[17]=m}else m=t[17];let h;return t[23]!==l||t[24]!==f||t[25]!==m?(h=(0,Q.jsxs)(sr,{id:s,title:c,summary:l,control:f,children:[p,m]}),t[23]=l,t[24]=f,t[25]=m,t[26]=h):h=t[26],h}function Or(e){let{value:t,label:n}=e;return(0,Q.jsx)(We,{value:t,children:n},t)}var kr=[{value:`off`,label:`Off`},{value:`read`,label:`Read PRs`},{value:`read-write`,label:`Read and act`}],Ar={"read-write":`read and act`,read:`read PRs`};function jr(e){let t=[`read-write`,`read`].flatMap(t=>{let n=e.filter(e=>e.permission===t);return n.length===0?[]:[`${n.map(e=>e.label).join(`, `)} ${Ar[t]}`]});return t.length===0?null:t.join(` · `)}function Mr(e){let t=(0,Z.c)(19),{environments:n}=e,r=N(rt.githubRoutingPermissionsValueAtom),i=N(rt.catalogValueAtom),a=ut(rt.setGitHubRoutingPermission),[o,s]=(0,$.useState)(!1);if(n.length<2)return null;let c;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(c=$n(`github-routing`),t[0]=c):c=t[0];let{id:l,title:u}=c,d;t[1]!==n||t[2]!==r?(d=jr(n.map(e=>({label:e.label,permission:Ae(e.entry,r)})))??`Off`,t[1]=n,t[2]=r,t[3]=d):d=t[3];let f;t[4]===Symbol.for(`react.memo_cache_sentinel`)?(f=(0,Q.jsx)(`p`,{className:`px-3 py-2.5 text-xs text-muted-foreground sm:px-4`,children:`Machines you trust here can read PR data through each other's GitHub access. Enable both machines. Read and act may use broader permissions than the machine that owns them. This applies only to this device.`}),t[4]=f):f=t[4];let p;if(t[5]!==i||t[6]!==n||t[7]!==r||t[8]!==o||t[9]!==a){let e;t[11]!==i||t[12]!==r||t[13]!==o||t[14]!==a?(e=e=>(0,Q.jsx)(Sr,{kind:Ce(e.serverConfig),label:e.label,subtitle:xr(e),children:(0,Q.jsxs)(Je,{items:kr,value:Ae(e.entry,r),disabled:!i.isReady||o||Ee(e.entry)===null,onValueChange:t=>{t!==null&&(s(!0),a({environmentId:e.environmentId,permission:t}).then(e=>{s(!1),e._tag===`Failure`&&q.add({type:`error`,title:`Could not save GitHub routing permission`})}))},children:[(0,Q.jsx)(qe,{size:`xs`,className:`w-32`,"aria-label":`${e.label} GitHub routing`,children:(0,Q.jsx)(Ge,{})}),(0,Q.jsx)(Ke,{align:`end`,alignItemWithTrigger:!1,children:kr.map(Nr)})]})},e.environmentId),t[11]=i,t[12]=r,t[13]=o,t[14]=a,t[15]=e):e=t[15],p=n.map(e),t[5]=i,t[6]=n,t[7]=r,t[8]=o,t[9]=a,t[10]=p}else p=t[10];let m;return t[16]!==d||t[17]!==p?(m=(0,Q.jsxs)(sr,{id:l,title:u,summary:d,children:[f,p]}),t[16]=d,t[17]=p,t[18]=m):m=t[18],m}function Nr(e){let{value:t,label:n}=e;return(0,Q.jsx)(We,{value:t,children:n},t)}function Pr(e){let t=(0,Z.c)(26),{environmentLabel:n,onCancel:r,onConfirm:i}=e,a=Lt(),[o,s]=(0,$.useState)(n);n!==null&&n!==o&&s(n);let c=a.open,l=n!==null,u;t[0]===r?u=t[1]:(u=e=>{e||r()},t[0]=r,t[1]=u);let d;t[2]===o?d=t[3]:(d=(0,Q.jsxs)(Mn,{children:[`Remove `,o,` from this device?`]}),t[2]=o,t[3]=d);let f;t[4]===Symbol.for(`react.memo_cache_sentinel`)?(f=(0,Q.jsx)(In,{children:`This forgets its pairing, credentials, and cached threads here.`}),t[4]=f):f=t[4];let p;t[5]!==r||t[6]!==c?(p=c?(0,Q.jsx)(ie,{onClick:()=>{r(),c()},children:`P4 Connect settings`}):`P4 Connect settings`,t[5]=r,t[6]=c,t[7]=p):p=t[7];let m;t[8]===p?m=t[9]:(m=(0,Q.jsxs)(In,{children:[`It stays on your P4 Connect account and keeps its host space. Deregister it in`,` `,p,` `,`to free it.`]}),t[8]=p,t[9]=m);let h;t[10]!==d||t[11]!==m?(h=(0,Q.jsxs)(Bn,{children:[d,f,m]}),t[10]=d,t[11]=m,t[12]=h):h=t[12];let g;t[13]===Symbol.for(`react.memo_cache_sentinel`)?(g=(0,Q.jsx)(er,{render:(0,Q.jsx)(z,{variant:`outline`}),children:`Cancel`}),t[13]=g):g=t[13];let _;t[14]===i?_=t[15]:(_=(0,Q.jsxs)(Ln,{children:[g,(0,Q.jsx)(z,{variant:`destructive`,onClick:i,children:`Remove from this device`})]}),t[14]=i,t[15]=_);let v;t[16]!==h||t[17]!==_?(v=(0,Q.jsxs)(An,{children:[h,_]}),t[16]=h,t[17]=_,t[18]=v):v=t[18];let y;t[19]!==l||t[20]!==v||t[21]!==u?(y=(0,Q.jsx)(Dn,{open:l,onOpenChange:u,children:v}),t[19]=l,t[20]=v,t[21]=u,t[22]=y):y=t[22];let b;return t[23]!==a.portals||t[24]!==y?(b=(0,Q.jsxs)(Q.Fragment,{children:[y,a.portals]}),t[23]=a.portals,t[24]=y,t[25]=b):b=t[25],b}var Fr={pairingLinks:[],clientSessions:[]};function Ir(e,t,n){let r=n(t);return[...e.filter(e=>n(e)!==r),t]}function Lr(e,t){switch(t.type){case`snapshot`:return t.payload;case`pairingLinkUpserted`:return{...e,pairingLinks:Ir(e.pairingLinks,t.payload,e=>e.id)};case`pairingLinkRemoved`:return{...e,pairingLinks:e.pairingLinks.filter(e=>e.id!==t.payload.id)};case`clientUpserted`:return{...e,clientSessions:Ir(e.clientSessions,t.payload,e=>e.sessionId)};case`clientRemoved`:return{...e,clientSessions:e.clientSessions.filter(e=>e.sessionId!==t.payload.sessionId)}}}function Rr(e,t){let n=Lr(e,t);return[n,[{version:1,revision:t.revision,type:`snapshot`,payload:n}]]}function zr(e){return{accessChanges:Te(e,{label:`environment-data:server:auth-access-changes`,subscribe:e=>H(y.subscribeAuthAccess,{}).pipe(L(()=>Fr,Rr))})}}var Br=zr(G),Vr=3e4,Hr=class extends o()(`DesktopNetworkAccessUnavailableError`,{}){get message(){return`Desktop network access is unavailable.`}},Ur=class extends o()(`DesktopServerExposureStateLoadError`,{cause:c()}){get message(){return`Failed to load desktop server exposure state.`}},Wr=class extends o()(`DesktopAdvertisedEndpointsLoadError`,{cause:c()}){get message(){return`Failed to load advertised desktop endpoints.`}};function Gr(){return typeof window>`u`?void 0:window.desktopBridge}function Kr(e){let t=I(`loadDesktopNetworkAccess`)(function*(){let t=e();if(!t)return yield*new Hr;let[r,i]=yield*n([j({try:()=>t.getServerExposureState(),catch:e=>new Ur({cause:e})}),j({try:()=>t.getAdvertisedEndpoints(),catch:e=>new Wr({cause:e})})],{concurrency:`unbounded`});return{advertisedEndpoints:i,serverExposureState:r}});return i(t()).pipe(se({staleTime:Vr,revalidateOnMount:!0}),w,he(`desktop:network-access`))}var qr=Kr(Gr);function Jr(){p.refresh(qr)}function Yr(e,t){let n=t.trim().toLowerCase();if(n.length===0)return e;let r=[],i=[];for(let t of e){let e=t.alias.toLowerCase();e.startsWith(n)?r.push(t):e.includes(n)&&i.push(t)}return[...r,...i]}var Xr=class extends o()(`DesktopSshDiscoveryUnavailableError`,{}){get message(){return`Desktop SSH host discovery is unavailable.`}},Zr=class extends o()(`DesktopSshDiscoveryError`,{cause:c()}){get message(){return`Failed to discover SSH hosts.`}};function Qr(){return typeof window>`u`?void 0:window.desktopBridge}function $r(e){let t=I(`discoverDesktopSshHosts`)(function*(){let t=e();return t?yield*j({try:()=>t.discoverSshHosts(),catch:e=>new Zr({cause:e})}):yield*new Xr});return i(t()).pipe(se({staleTime:3e4,revalidateOnMount:!0}),w,he(`desktop:ssh-hosts`))}var ei=$r(Qr),ti=443,ni=[],ri=[],ii=`backend:default-wsl`,ai=`backend:wsl-off`,oi=new Intl.DateTimeFormat(void 0,{dateStyle:`medium`,timeStyle:`short`});function si(e){let t=new Date(e);return Number.isNaN(t.getTime())?e:oi.format(t)}function ci(e){let t=(0,Z.c)(13),{scopes:n,label:r}=e,i=`${n.length} ${n.length===1?`scope`:`scopes`}`,a=`${r}: show ${i}`,o;t[0]===a?o=t[1]:(o=(0,Q.jsx)(`button`,{type:`button`,"aria-label":a,className:`cursor-help underline decoration-border underline-offset-2 outline-hidden hover:text-foreground focus-visible:text-foreground`}),t[0]=a,t[1]=o);let s;t[2]!==i||t[3]!==o?(s=(0,Q.jsx)(Yt,{openOnHover:!0,delay:250,closeDelay:100,render:o,children:i}),t[2]=i,t[3]=o,t[4]=s):s=t[4];let c;t[5]===Symbol.for(`react.memo_cache_sentinel`)?(c=(0,Q.jsx)(`p`,{className:`mb-1 font-medium`,children:`Granted scopes`}),t[5]=c):c=t[5];let l;t[6]===n?l=t[7]:(l=n.map(li),t[6]=n,t[7]=l);let u;t[8]===l?u=t[9]:(u=(0,Q.jsxs)(Jt,{side:`top`,align:`start`,tooltipStyle:!0,className:`w-max max-w-80 whitespace-normal`,children:[c,(0,Q.jsx)(`div`,{className:`flex flex-col gap-0.5`,children:l})]}),t[8]=l,t[9]=u);let d;return t[10]!==s||t[11]!==u?(d=(0,Q.jsxs)(Xt,{children:[s,u]}),t[10]=s,t[11]=u,t[12]=d):d=t[12],d}function li(e){return(0,Q.jsx)(`code`,{className:`font-mono text-foreground/85`,children:e},e)}function ui(e){let t=e.host.trim();if(t.length===0)throw Error(`SSH host or alias is required.`);let n=t,r=e.username.trim()||null,i=null,a=n.lastIndexOf(`@`);if(a>0){let e=n.slice(0,a).trim();n=n.slice(a+1).trim(),!r&&e.length>0&&(r=e)}let o=/^\[([^\]]+)\](?::(\d+))?$/u.exec(n);if(o)n=o[1].trim(),o[2]&&(i=Number.parseInt(o[2],10));else{let e=n.split(`:`);e.length===2&&/^\d+$/u.test(e[1]??``)&&(n=e[0].trim(),i=Number.parseInt(e[1],10))}let s=e.port.trim();if(s.length>0&&(i=Number.parseInt(s,10)),n.length===0)throw Error(`SSH host or alias is required.`);if(i!==null&&(!Number.isInteger(i)||i<=0||i>65535))throw Error(`SSH port must be between 1 and 65535.`);return{alias:n,hostname:n,username:r,port:i}}function di(e){let t=e.trim();if(!t)return null;try{let e=/^[a-zA-Z][a-zA-Z\d+.-]*:\/\//u.test(t)||t.startsWith(`//`)?t:`https://${t}`,n=new URL(e,window.location.origin),r=W(n);if(r)return{host:r.host,pairingCode:r.token};let i=Ve(n);return i?{host:n.origin,pairingCode:i}:null}catch{return null}}function fi(e){let t=di(e.host);if(t)return t;let n=e.host.trim(),r=e.pairingCode.trim();if(!n)throw Error(`Enter a backend host.`);if(!r)throw Error(`Enter a pairing code.`);return{host:n,pairingCode:r}}function pi(e){let t=`Failed to connect SSH host.`;return(e instanceof Error?e.message:t).replace(/^Error invoking remote method 'desktop:ensure-ssh-environment':\s*/u,``).replace(/^Ssh[A-Za-z]+Error:\s*/u,``).trim()||t}var mi=`first:rounded-t-xl last:rounded-b-xl px-3 py-2.5 sm:px-4`;function hi(e){return Qn}function gi(e,t){return e===`endpoint-rail`?ge(`relative first:rounded-t-xl last:rounded-b-xl px-3 py-3 sm:px-4`,!t&&`bg-muted/15`):ge(mi,!t&&`bg-muted/24`)}function _i(e){return[...e].toSorted((e,t)=>new Date(t.createdAt).getTime()-new Date(e.createdAt).getTime())}function vi(e,t){return[`${e.length} ${e.length===1?`client`:`clients`}`,t.length>0?`${t.length} ${t.length===1?`pairing link`:`pairing links`}`:null].filter(e=>e!==null).join(` · `)}function yi(e){return[...e].toSorted((e,t)=>e.current===t.current?e.connected===t.connected?new Date(t.issuedAt).getTime()-new Date(e.issuedAt).getTime():e.connected?-1:1:e.current?-1:1)}function bi(e){return{...e,scopes:e.permissions??e.scopes,createdAt:k(e.createdAt),expiresAt:k(e.expiresAt)}}function xi(e){return{...e,scopes:e.permissions??e.scopes,issuedAt:k(e.issuedAt),expiresAt:k(e.expiresAt),lastConnectedAt:e.lastConnectedAt===null?null:k(e.lastConnectedAt)}}function Si(e,t){let n=e.filter(e=>e.status!==`unavailable`);if(t){let e=n.find(e=>wi(e)===t);if(e)return e}return n.find(e=>e.isDefault)??n.find(e=>e.reachability!==`loopback`)??n.find(e=>e.compatibility.hostedHttpsApp===`compatible`)??null}function Ci(e){return e.id.startsWith(`tailscale-magicdns:`)}function wi(e){if(e.id.startsWith(`desktop-loopback:`))return`desktop-core:loopback:http`;if(e.id.startsWith(`desktop-lan:`))return`desktop-core:lan:http`;if(e.id.startsWith(`tailscale-ip:`))return`tailscale:ip:http`;if(Ci(e))return`tailscale:magicdns:https`;let t=`unknown`;try{t=new URL(e.httpBaseUrl).protocol.replace(/:$/u,``)}catch{}return`${e.provider.id}:${e.reachability}:${t}:${e.label}`}function Ti(e,t){return e.compatibility.hostedHttpsApp===`compatible`?dr(e.httpBaseUrl,t)??ur(e.httpBaseUrl,t):ur(e.httpBaseUrl,t)}function Ei(e){let t=new URL(`/pair`,window.location.href);return Le(t,e).toString()}function Di(e){try{let t=new URL(e);return t.pathname===`/pair`&&t.searchParams.has(`host`)}catch{return!1}}function Oi(e,t){if(Di(t))return`Opens the hosted app, no install needed`;switch(e.reachability){case`lan`:return`Devices on the same network`;case`private-network`:return`Devices on your private network`;case`public`:return`Reachable from anywhere`;case`loopback`:return`Clients on this machine`}}var ki=(0,$.memo)(function(e){let t=(0,Z.c)(135),{pairingLink:n,credential:r,endpointUrl:i,endpoints:a,defaultEndpointKey:o,presentation:s,revokingPairingLinkId:c,onRevoke:l,canRevoke:u}=e,d=s===void 0?`current`:s,f=yn(1e3),p=new Date(n.expiresAt).getTime(),[m,h]=(0,$.useState)(!1),[g,_]=(0,$.useState)(!1),[v,y]=(0,$.useState)(null),b=(0,$.useId)(),x;t[0]===r?x=t[1]:(x=r?Ei(r):null,t[0]=r,t[1]=x);let S=x,C;t[2]!==r||t[3]!==i?(C=r&&i!=null&&i!==``?dr(i,r):null,t[2]=r,t[3]=i,t[4]=C):C=t[4];let w=C,E;if(t[5]!==r||t[6]!==o||t[7]!==a){let e=Si(a,o);E=e&&r?Ti(e,r):null,t[5]=r,t[6]=o,t[7]=a,t[8]=E}else E=t[8];let D=E,O;if(t[9]!==r||t[10]!==a){bb0:{let e=[];if(!r){O=e;break bb0}for(let t of a){if(t.status===`unavailable`)continue;let n=Ti(t,r);e.push({id:t.id,preferenceKey:wi(t),label:t.label,url:n,detail:Oi(t,n),qrShareable:ar(t)})}O=e}t[9]=r,t[10]=a,t[11]=O}else O=t[11];let k=O,A;t[12]!==r||t[13]!==S||t[14]!==D||t[15]!==i||t[16]!==w?(A=D??(r&&i!=null&&i!==``?w??ur(i,r):U(window.location.hostname)?null:S),t[12]=r,t[13]=S,t[14]=D,t[15]=i,t[16]=w,t[17]=A):A=t[17];let j=A,[M,N]=(0,$.useState)(null),P=M??j??r??``,F=P!==r,ee=F&&Di(P),te=k.find(e=>e.url===P)?.qrShareable??!0,ne=typeof window<`u`&&window.isSecureContext&&navigator.clipboard?.writeText!=null,re;t[18]===Symbol.for(`react.memo_cache_sentinel`)?(re={onCopy:Zi,onError:(e,t)=>{let{value:n,kind:r}=t;N(n),h(!0),q.add(ht({type:`error`,title:ne?r===`hosted-link`?`Could not copy hosted app link`:r===`link`?`Could not copy pairing URL`:`Could not copy pairing code`:`Clipboard copy unavailable`,description:ne?e.message:`Showing the full value instead.`}))}},t[18]=re):re=t[18];let{copyToClipboard:ie}=Ye(re),ae;t[19]===ie?ae=t[20]:(ae=(e,t)=>{ie(e,{value:e,kind:t})},t[19]=ie,t[20]=ae);let oe=ae,se=Qi,ce;t[21]!==oe||t[22]!==r?(ce=()=>{r&&oe(r,`code`)},t[21]=oe,t[22]=r,t[23]=ce):ce=t[23];let I=ce,le;t[24]===n.expiresAt?le=t[25]:(le=si(n.expiresAt),t[24]=n.expiresAt,t[25]=le);let ue=le,L=n.label??`Pairing link`,de;t[26]!==o||t[27]!==k||t[28]!==v?(de=Gn(k,v,o),t[26]=o,t[27]=k,t[28]=v,t[29]=de):de=t[29];let fe=de,R=fe?.url??j,pe=fe?.qrShareable??!0;if(p<=f)return null;let me;t[30]===d?me=t[31]:(me=hi(d),t[30]=d,t[31]=me);let he;t[32]===n.createdAt?he=t[33]:(he=si(n.createdAt),t[32]=n.createdAt,t[33]=he);let _e=`Link created at ${he}`,ve;t[34]===_e?ve=t[35]:(ve=(0,Q.jsx)(X,{tooltipText:_e,dotClassName:`bg-warning`}),t[34]=_e,t[35]=ve);let ye;t[36]===L?ye=t[37]:(ye=(0,Q.jsx)(`h3`,{className:`text-sm font-medium text-foreground`,children:L}),t[36]=L,t[37]=ye);let be;t[38]!==ve||t[39]!==ye?(be=(0,Q.jsxs)(`div`,{className:`flex min-h-5 items-center gap-1.5`,children:[ve,ye]}),t[38]=ve,t[39]=ye,t[40]=be):be=t[40];let B;t[41]===Symbol.for(`react.memo_cache_sentinel`)?(B=(0,Q.jsx)(`span`,{}),t[41]=B):B=t[41];let xe;t[42]!==f||t[43]!==n.expiresAt?(xe=gt(n.expiresAt,f),t[42]=f,t[43]=n.expiresAt,t[44]=xe):xe=t[44];let Se;t[45]===xe?Se=t[46]:(Se=(0,Q.jsx)(Xe,{render:B,children:xe}),t[45]=xe,t[46]=Se);let Ce;t[47]===ue?Ce=t[48]:(Ce=(0,Q.jsx)(Ze,{side:`top`,children:ue}),t[47]=ue,t[48]=Ce);let V;t[49]!==Se||t[50]!==Ce?(V=(0,Q.jsxs)(Qe,{children:[Se,Ce]}),t[49]=Se,t[50]=Ce,t[51]=V):V=t[51];let we;t[52]===Symbol.for(`react.memo_cache_sentinel`)?(we=(0,Q.jsx)(`span`,{"aria-hidden":!0,children:` · `}),t[52]=we):we=t[52];let Te;t[53]===n.scopes?Te=t[54]:(Te=(0,Q.jsx)(ci,{scopes:n.scopes,label:`Pairing link scopes`}),t[53]=n.scopes,t[54]=Te);let Ee;t[55]!==V||t[56]!==Te?(Ee=(0,Q.jsxs)(`p`,{className:`text-xs text-muted-foreground`,children:[V,we,Te]}),t[55]=V,t[56]=Te,t[57]=Ee):Ee=t[57];let De;t[58]!==r||t[59]!==j?(De=r?j===null?(0,Q.jsx)(`p`,{className:`text-2xs text-muted-foreground/70`,children:`Copy the token and pair from another client using this backend's reachable host.`}):null:(0,Q.jsx)(`p`,{className:`text-2xs text-muted-foreground/70`,children:`Create a new link to share from this client.`}),t[58]=r,t[59]=j,t[60]=De):De=t[60];let Oe;t[61]!==be||t[62]!==Ee||t[63]!==De?(Oe=(0,Q.jsxs)(`div`,{className:`min-w-0 flex-1 space-y-1`,children:[be,Ee,De]}),t[61]=be,t[62]=Ee,t[63]=De,t[64]=Oe):Oe=t[64];let ke;t[65]!==g||t[66]!==b||t[67]!==j?(ke=j&&ne?(0,Q.jsxs)(z,{size:`xs`,variant:`outline`,"aria-expanded":g,"aria-controls":b,onClick:()=>_($i),children:[(0,Q.jsx)(T,{"aria-hidden":!0}),`Share`]}):null,t[65]=g,t[66]=b,t[67]=j,t[68]=ke):ke=t[68];let Ae=r!==void 0&&m,je;t[69]===Symbol.for(`react.memo_cache_sentinel`)?(je=e=>{h(e),e||N(null)},t[69]=je):je=t[69];let Me;t[70]!==r||t[71]!==I||t[72]!==j?(Me=r?ne?j?null:(0,Q.jsx)(z,{size:`xs`,variant:`outline`,onClick:I,children:`Copy code`}):(0,Q.jsx)(jt,{render:(0,Q.jsx)(z,{size:`xs`,variant:`outline`}),children:j?`Show link`:`Show code`}):null,t[70]=r,t[71]=I,t[72]=j,t[73]=Me):Me=t[73];let Ne=F?ee?`Hosted app pairing link`:`Pairing link`:`Pairing code`,Pe;t[74]===Ne?Pe=t[75]:(Pe=(0,Q.jsx)(kt,{children:Ne}),t[74]=Ne,t[75]=Pe);let Fe=F?ee?`Clipboard copy is unavailable here. Open or manually copy this hosted app link on the device you want to connect.`:`Clipboard copy is unavailable here. Open or manually copy this full pairing URL on the device you want to connect.`:`Clipboard copy is unavailable here. Manually copy this code into another client.`,H;t[76]===Fe?H=t[77]:(H=(0,Q.jsx)(Pt,{children:Fe}),t[76]=Fe,t[77]=H);let Ie;t[78]!==Pe||t[79]!==H?(Ie=(0,Q.jsxs)(Ot,{children:[Pe,H]}),t[78]=Pe,t[79]=H,t[80]=Ie):Ie=t[80];let W=F?4:3,Le;t[81]!==P||t[82]!==W?(Le=(0,Q.jsx)(vt,{readOnly:!0,value:P,rows:W,onFocus:ea,onClick:ta}),t[81]=P,t[82]=W,t[83]=Le):Le=t[83];let Re;t[84]!==te||t[85]!==F||t[86]!==P?(Re=F&&te?(0,Q.jsx)(`div`,{className:`flex justify-center rounded-xl border border-border/60 bg-muted/30 p-4`,children:(0,Q.jsx)(Hn,{value:P,size:132,level:`M`,marginSize:2,title:`Pairing link — scan to open on another device`})}):null,t[84]=te,t[85]=F,t[86]=P,t[87]=Re):Re=t[87];let ze;t[88]!==Le||t[89]!==Re?(ze=(0,Q.jsxs)(Nt,{children:[Le,Re]}),t[88]=Le,t[89]=Re,t[90]=ze):ze=t[90];let Be;t[91]===Symbol.for(`react.memo_cache_sentinel`)?(Be=(0,Q.jsx)(z,{variant:`outline`,onClick:()=>h(!1),children:`Done`}),t[91]=Be):Be=t[91];let Ve;t[92]===I?Ve=t[93]:(Ve=ne?(0,Q.jsx)(z,{variant:`outline`,onClick:I,children:`Copy code`}):null,t[92]=I,t[93]=Ve);let He;t[94]===Ve?He=t[95]:(He=(0,Q.jsxs)(At,{variant:`bare`,children:[Be,Ve]}),t[94]=Ve,t[95]=He);let Ue;t[96]!==Ie||t[97]!==ze||t[98]!==He?(Ue=(0,Q.jsxs)(Ft,{className:`max-w-md`,children:[Ie,ze,He]}),t[96]=Ie,t[97]=ze,t[98]=He,t[99]=Ue):Ue=t[99];let G;t[100]!==Ae||t[101]!==Me||t[102]!==Ue?(G=(0,Q.jsxs)(It,{open:Ae,onOpenChange:je,children:[Me,Ue]}),t[100]=Ae,t[101]=Me,t[102]=Ue,t[103]=G):G=t[103];let We=!u||c===n.id,Ge;t[104]!==l||t[105]!==n.id?(Ge=()=>void l(n.id),t[104]=l,t[105]=n.id,t[106]=Ge):Ge=t[106];let Ke=c===n.id?`Revoking…`:`Revoke`,qe;t[107]!==We||t[108]!==Ge||t[109]!==Ke?(qe=(0,Q.jsx)(z,{size:`xs`,variant:`destructive-outline`,disabled:We,onClick:Ge,children:Ke}),t[107]=We,t[108]=Ge,t[109]=Ke,t[110]=qe):qe=t[110];let Je;t[111]!==ke||t[112]!==G||t[113]!==qe?(Je=(0,Q.jsxs)(`div`,{className:`flex w-full shrink-0 items-center gap-2 sm:w-auto sm:justify-end`,children:[ke,G,qe]}),t[111]=ke,t[112]=G,t[113]=qe,t[114]=Je):Je=t[114];let K;t[115]!==Oe||t[116]!==Je?(K=(0,Q.jsxs)(`div`,{className:Jn,children:[Oe,Je]}),t[115]=Oe,t[116]=Je,t[117]=K):K=t[117];let $e=g&&R!==null,et;t[118]!==pe||t[119]!==oe||t[120]!==k||t[121]!==I||t[122]!==R||t[123]!==b||t[124]!==fe?.id?(et=R===null?null:(0,Q.jsxs)(`div`,{id:b,className:`mt-3 flex flex-col gap-4 border-t border-border/50 pt-3 sm:flex-row sm:items-start sm:justify-between`,children:[(0,Q.jsxs)(`div`,{className:`min-w-0 flex-1 space-y-3`,children:[k.length>1?(0,Q.jsxs)(`div`,{className:`space-y-1.5`,role:`radiogroup`,"aria-label":`Endpoint the pairing QR code and URL use`,children:[(0,Q.jsx)(`p`,{className:`text-2xs text-muted-foreground/70`,children:`Reach this machine via`}),k.map(e=>{let t=e.id===fe?.id;return(0,Q.jsxs)(`button`,{type:`button`,role:`radio`,"aria-checked":t,className:ge(`flex w-full items-baseline gap-2 rounded-lg border px-2.5 py-1.5 text-left outline-none focus-visible:ring-2 focus-visible:ring-inset focus-visible:ring-ring`,t?`border-foreground/60 bg-muted/30`:`border-border/50 hover:bg-muted/20`),onClick:()=>y(e.id),children:[(0,Q.jsx)(`span`,{className:ge(`text-xs font-medium`,t?`text-foreground`:`text-muted-foreground`),children:e.label}),(0,Q.jsx)(`span`,{className:`min-w-0 truncate text-2xs text-muted-foreground/70`,children:e.detail})]},e.id)})]}):null,(0,Q.jsxs)(`div`,{className:`flex items-center gap-2 rounded-lg border border-border/60 bg-muted/30 px-2.5 py-1.5`,children:[(0,Q.jsxs)(Qe,{children:[(0,Q.jsx)(Xe,{render:(0,Q.jsx)(`code`,{className:`min-w-0 flex-1 truncate font-mono text-2xs text-muted-foreground`,children:R})}),(0,Q.jsx)(Ze,{side:`top`,children:R})]}),(0,Q.jsx)(z,{size:`xs`,variant:`ghost`,className:`shrink-0`,onClick:()=>oe(R,se(R)),children:`Copy link`})]}),(0,Q.jsx)(z,{size:`xs`,variant:`ghost`,onClick:I,children:`Copy code only`})]}),pe?(0,Q.jsx)(`div`,{className:`w-fit shrink-0 self-center rounded-xl bg-white p-3 sm:self-start`,children:(0,Q.jsx)(Hn,{value:R,size:168,level:`M`,marginSize:1,title:`Pairing link — scan to open on another device`})}):(0,Q.jsx)(`div`,{className:`flex size-[192px] shrink-0 items-center justify-center self-center rounded-xl border border-border/50 p-4 sm:self-start`,children:(0,Q.jsx)(`p`,{className:`text-center text-2xs text-muted-foreground/70`,children:`No QR for this endpoint. Another device scanning a loopback link would dial itself; copy the URL for use on this machine instead.`})})]}),t[118]=pe,t[119]=oe,t[120]=k,t[121]=I,t[122]=R,t[123]=b,t[124]=fe?.id,t[125]=et):et=t[125];let tt;t[126]===et?tt=t[127]:(tt=(0,Q.jsx)(kn,{children:et}),t[126]=et,t[127]=tt);let J;t[128]!==$e||t[129]!==tt?(J=(0,Q.jsx)(zn,{open:$e,children:tt}),t[128]=$e,t[129]=tt,t[130]=J):J=t[130];let nt;return t[131]!==me||t[132]!==K||t[133]!==J?(nt=(0,Q.jsxs)(`div`,{className:me,children:[K,J]}),t[131]=me,t[132]=K,t[133]=J,t[134]=nt):nt=t[134],nt}),Ai=(0,$.memo)(function(e){let t=(0,Z.c)(54),{clientSession:n,presentation:r,revokingClientSessionId:i,onRevokeSession:a,canRevoke:o}=e,s=r===void 0?`current`:r,c=yn(1e3),l=n.current||n.connected,u=n.lastConnectedAt,d;t[0]!==l||t[1]!==u||t[2]!==c?(d=l?u?`Connected for ${_t(u,c)}`:`Connected`:u?`Last connected at ${si(u)}`:`Not connected yet.`,t[0]=l,t[1]=u,t[2]=c,t[3]=d):d=t[3];let f=d,p;t[4]===n.client.deviceType?p=t[5]:(p=n.client.deviceType===`unknown`?null:n.client.deviceType[0]?.toUpperCase()+n.client.deviceType.slice(1),t[4]=n.client.deviceType,t[5]=p);let m=n.client.os??null,h=n.client.browser??null,g=n.client.ipAddress??null,_;t[6]!==p||t[7]!==m||t[8]!==h||t[9]!==g?(_=[p,m,h,g].filter(na),t[6]=p,t[7]=m,t[8]=h,t[9]=g,t[10]=_):_=t[10];let v=_,y;t[11]!==n.client.browser||t[12]!==n.client.label||t[13]!==n.client.os||t[14]!==n.subject?(y=n.client.label??([n.client.os,n.client.browser].filter(Boolean).join(` · `)||n.subject),t[11]=n.client.browser,t[12]=n.client.label,t[13]=n.client.os,t[14]=n.subject,t[15]=y):y=t[15];let b=y,x;t[16]===s?x=t[17]:(x=hi(s),t[16]=s,t[17]=x);let S=l?`bg-success`:`bg-muted-foreground/30`,C=l?`bg-success/60 duration-2000`:null,w;t[18]!==f||t[19]!==S||t[20]!==C?(w=(0,Q.jsx)(X,{tooltipText:f,dotClassName:S,pingClassName:C}),t[18]=f,t[19]=S,t[20]=C,t[21]=w):w=t[21];let T;t[22]===b?T=t[23]:(T=(0,Q.jsx)(`h3`,{className:`text-sm font-medium text-foreground`,children:b}),t[22]=b,t[23]=T);let E;t[24]===n.current?E=t[25]:(E=n.current?(0,Q.jsx)(`span`,{className:`text-3xs text-muted-foreground/80 rounded-md border border-border/50 bg-muted/50 px-1 py-0.5`,children:`This device`}):null,t[24]=n.current,t[25]=E);let D;t[26]!==w||t[27]!==T||t[28]!==E?(D=(0,Q.jsxs)(`div`,{className:`flex min-h-5 items-center gap-1.5`,children:[w,T,E]}),t[26]=w,t[27]=T,t[28]=E,t[29]=D):D=t[29];let O;t[30]===v?O=t[31]:(O=v.length>0?(0,Q.jsxs)(Q.Fragment,{children:[v.join(` · `),(0,Q.jsx)(`span`,{"aria-hidden":!0,children:` · `})]}):null,t[30]=v,t[31]=O);let k;t[32]===n.scopes?k=t[33]:(k=(0,Q.jsx)(ci,{scopes:n.scopes,label:`Client scopes`}),t[32]=n.scopes,t[33]=k);let A;t[34]!==O||t[35]!==k?(A=(0,Q.jsxs)(`p`,{className:`text-xs text-muted-foreground`,children:[O,k]}),t[34]=O,t[35]=k,t[36]=A):A=t[36];let j;t[37]!==D||t[38]!==A?(j=(0,Q.jsxs)(`div`,{className:`min-w-0 flex-1 space-y-1`,children:[D,A]}),t[37]=D,t[38]=A,t[39]=j):j=t[39];let M;t[40]!==o||t[41]!==n.current||t[42]!==n.sessionId||t[43]!==a||t[44]!==i?(M=n.current?null:(0,Q.jsx)(z,{size:`xs`,variant:`destructive-outline`,disabled:!o||i===n.sessionId,onClick:()=>void a(n.sessionId),children:i===n.sessionId?`Revoking…`:`Revoke`}),t[40]=o,t[41]=n.current,t[42]=n.sessionId,t[43]=a,t[44]=i,t[45]=M):M=t[45];let N;t[46]===M?N=t[47]:(N=(0,Q.jsx)(`div`,{className:`flex w-full shrink-0 items-center gap-2 sm:w-auto sm:justify-end`,children:M}),t[46]=M,t[47]=N);let P;t[48]!==j||t[49]!==N?(P=(0,Q.jsxs)(`div`,{className:Jn,children:[j,N]}),t[48]=j,t[49]=N,t[50]=P):P=t[50];let F;return t[51]!==P||t[52]!==x?(F=(0,Q.jsx)(`div`,{className:x,children:P}),t[51]=P,t[52]=x,t[53]=F):F=t[53],F}),ji=(0,$.memo)(function({onPairingLinkCreated:e,clientSessions:t,isRevokingOtherClients:n,onRevokeOtherClients:r,delegatableScopes:i}){let a=J(),[o,s]=(0,$.useState)(!1),[c,u]=(0,$.useState)(``),[d,f]=(0,$.useState)([...D]),p=d.filter(e=>i.includes(e)),[m,h]=(0,$.useState)(!1),g=(0,$.useCallback)(async()=>{if(a!==null&&p.length!==0&&st(a,`access:write`)&&p.every(e=>st(a,e))){h(!0);try{e(await xn({label:c,scopes:p})),u(``),f(D.filter(e=>i.includes(e))),s(!1)}catch(e){let t=e instanceof Error?e.message:`Failed to create pairing URL.`;q.add(ht({type:`error`,title:`Could not create pairing URL`,description:t}))}finally{h(!1)}}},[i,e,c,a,p]),_=(0,$.useCallback)((e,t)=>{f(n=>Wn(n,e,t))},[]);return(0,Q.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,Q.jsx)(z,{size:`xs`,variant:`destructive-outline`,disabled:n||!Pn(t),onClick:()=>void r(),children:n?`Revoking…`:`Revoke others`}),(0,Q.jsxs)(It,{open:o,onOpenChange:e=>{s(e),e||(u(``),f(D.filter(e=>i.includes(e))))},children:[(0,Q.jsx)(jt,{render:(0,Q.jsxs)(z,{size:`xs`,variant:`default`,children:[(0,Q.jsx)(S,{className:`size-3`}),`Create link`]})}),(0,Q.jsxs)(Ft,{className:`max-w-md`,children:[(0,Q.jsxs)(Ot,{children:[(0,Q.jsx)(kt,{children:`Create pairing link`}),(0,Q.jsx)(Pt,{children:`Generate a one-time link that another device can use to pair with this backend as an authorized client.`})]}),(0,Q.jsxs)(Nt,{children:[(0,Q.jsxs)(`label`,{className:`block`,children:[(0,Q.jsx)(`span`,{className:`mb-1.5 block text-xs font-medium text-foreground`,children:`Client label (optional)`}),(0,Q.jsx)(Et,{value:c,onChange:e=>u(e.target.value),placeholder:`e.g. Living room iPad`,disabled:m,autoFocus:!0})]}),(0,Q.jsxs)(`section`,{className:`space-y-3`,children:[(0,Q.jsxs)(`div`,{className:`flex items-center justify-between gap-3`,children:[(0,Q.jsxs)(`div`,{children:[(0,Q.jsx)(`h3`,{className:`text-xs font-medium text-foreground`,children:`Permissions`}),(0,Q.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:`Limit what the paired client can do.`})]}),(0,Q.jsxs)(`div`,{className:`flex gap-1`,children:[(0,Q.jsx)(z,{size:`xs`,variant:`outline`,disabled:m,onClick:()=>f([ye,R,ve,l].filter(e=>i.includes(e))),children:`Read only`}),(0,Q.jsx)(z,{size:`xs`,variant:`outline`,disabled:m,onClick:()=>f(D.filter(e=>i.includes(e))),children:`Standard`})]})]}),(0,Q.jsx)(`div`,{className:`divide-y divide-border/60 rounded-lg border border-input bg-muted/25`,children:cr.filter(({scope:e})=>i.includes(e)).map(({scope:e,title:t,description:n})=>(0,Q.jsxs)(`label`,{className:`flex cursor-pointer items-start gap-3 px-3 py-2.5 transition-colors hover:bg-muted/40`,children:[(0,Q.jsx)(Zt,{className:`mt-0.5`,checked:d.includes(e),disabled:m,onCheckedChange:t=>_(e,t===!0)}),(0,Q.jsxs)(`span`,{className:`min-w-0`,children:[(0,Q.jsx)(`span`,{className:`block text-xs font-medium text-foreground`,children:t}),(0,Q.jsx)(`span`,{className:`block text-xs leading-snug text-muted-foreground`,children:n})]})]},e))}),p.length===0?(0,Q.jsx)(`p`,{className:`text-xs text-destructive`,children:`Select at least one permission.`}):p.includes(`access:write`)?(0,Q.jsx)(`p`,{className:`text-xs text-warning`,children:`This client can create or revoke access for other devices.`}):null]})]}),(0,Q.jsxs)(At,{variant:`bare`,children:[(0,Q.jsx)(z,{variant:`outline`,disabled:m,onClick:()=>s(!1),children:`Cancel`}),(0,Q.jsx)(z,{disabled:m||p.length===0,onClick:()=>void g(),children:m?`Creating…`:`Create link`})]})]})]})]})}),Mi=(0,$.memo)(function(e){let t=(0,Z.c)(39),{endpointUrl:n,endpoints:r,defaultEndpointKey:i,presentation:a,isLoading:o,pairingLinks:s,createdPairingCredentials:c,clientSessions:l,revokingPairingLinkId:u,revokingClientSessionId:d,onRevokePairingLink:f,onRevokeClientSession:p,canRevoke:m}=e,h=a===void 0?`current`:a,g;if(t[0]!==m||t[1]!==c||t[2]!==i||t[3]!==n||t[4]!==r||t[5]!==f||t[6]!==s||t[7]!==h||t[8]!==u){let e;t[10]!==m||t[11]!==c||t[12]!==i||t[13]!==n||t[14]!==r||t[15]!==f||t[16]!==h||t[17]!==u?(e=e=>(0,Q.jsx)(ki,{pairingLink:e,credential:c.get(e.id),endpointUrl:n,endpoints:r,defaultEndpointKey:i,presentation:h,revokingPairingLinkId:u,onRevoke:f,canRevoke:m},e.id),t[10]=m,t[11]=c,t[12]=i,t[13]=n,t[14]=r,t[15]=f,t[16]=h,t[17]=u,t[18]=e):e=t[18],g=s.map(e),t[0]=m,t[1]=c,t[2]=i,t[3]=n,t[4]=r,t[5]=f,t[6]=s,t[7]=h,t[8]=u,t[9]=g}else g=t[9];let _;if(t[19]!==m||t[20]!==l||t[21]!==p||t[22]!==h||t[23]!==d){let e;t[25]!==m||t[26]!==p||t[27]!==h||t[28]!==d?(e=e=>(0,Q.jsx)(Ai,{clientSession:e,presentation:h,revokingClientSessionId:d,onRevokeSession:p,canRevoke:m},e.sessionId),t[25]=m,t[26]=p,t[27]=h,t[28]=d,t[29]=e):e=t[29],_=l.map(e),t[19]=m,t[20]=l,t[21]=p,t[22]=h,t[23]=d,t[24]=_}else _=t[24];let v;t[30]!==l.length||t[31]!==o||t[32]!==s.length||t[33]!==h?(v=s.length===0&&l.length===0&&!o?(0,Q.jsx)(`div`,{className:hi(h),children:(0,Q.jsx)(`p`,{className:`text-xs text-muted-foreground/60`,children:`No pairing links or client sessions.`})}):null,t[30]=l.length,t[31]=o,t[32]=s.length,t[33]=h,t[34]=v):v=t[34];let y;return t[35]!==g||t[36]!==_||t[37]!==v?(y=(0,Q.jsxs)(Q.Fragment,{children:[g,_,v]}),t[35]=g,t[36]=_,t[37]=v,t[38]=y):y=t[38],y}),Ni=(0,$.memo)(function(e){let t=(0,Z.c)(50),{endpoint:n,isDefault:r,presentation:i,onSetDefault:a,onSetupTailscaleServe:o,onDisableTailscaleServe:s,isUpdatingTailscaleServe:c}=e,l=i===void 0?`current`:i,u=n.status===`available`,d;t[0]===n?d=t[1]:(d=Ci(n)&&n.status!==`available`,t[0]=n,t[1]=d);let f=d,p;t[2]===n?p=t[3]:(p=Ci(n)&&n.status===`available`,t[2]=n,t[3]=p);let m=p,h=!f,g=l===`endpoint-rail`,_;t[4]!==u||t[5]!==l?(_=gi(l,u),t[4]=u,t[5]=l,t[6]=_):_=t[6];let v;t[7]!==r||t[8]!==g?(v=g&&r?(0,Q.jsx)(`span`,{className:`absolute inset-y-2 left-0 w-1 rounded-r-full bg-primary`,"aria-hidden":!0}):null,t[7]=r,t[8]=g,t[9]=v):v=t[9];let y;t[10]===n.label?y=t[11]:(y=(0,Q.jsx)(`h3`,{className:`shrink-0 text-sm leading-5 font-medium text-foreground`,children:n.label}),t[10]=n.label,t[11]=y);let b;t[12]!==n.httpBaseUrl||t[13]!==h?(b=h?(0,Q.jsxs)(Qe,{children:[(0,Q.jsx)(Xe,{render:(0,Q.jsx)(`p`,{className:`min-w-0 truncate text-xs leading-5 text-muted-foreground`,children:n.httpBaseUrl})}),(0,Q.jsx)(Ze,{side:`top`,children:n.httpBaseUrl})]}):null,t[12]=n.httpBaseUrl,t[13]=h,t[14]=b):b=t[14];let x;t[15]===u?x=t[16]:(x=u?null:(0,Q.jsx)(`span`,{className:`shrink-0 rounded-md border border-border/70 px-1 py-0.5 text-3xs text-muted-foreground`,children:`Setup required`}),t[15]=u,t[16]=x);let S;t[17]!==y||t[18]!==b||t[19]!==x?(S=(0,Q.jsxs)(`div`,{className:`flex min-w-0 items-baseline gap-3`,children:[y,b,x]}),t[17]=y,t[18]=b,t[19]=x,t[20]=S):S=t[20];let C;t[21]===r?C=t[22]:(C=r?(0,Q.jsx)(`span`,{className:`rounded-md border border-primary/30 bg-primary/10 px-1 py-0.5 text-3xs text-primary`,children:`Default`}):null,t[21]=r,t[22]=C);let w;t[23]!==n||t[24]!==c||t[25]!==f||t[26]!==o?(w=f?(0,Q.jsx)(z,{size:`xs`,variant:`outline`,onClick:()=>o(n),disabled:c,children:c?`Restarting…`:`Setup`}):null,t[23]=n,t[24]=c,t[25]=f,t[26]=o,t[27]=w):w=t[27];let T;t[28]!==m||t[29]!==n||t[30]!==c||t[31]!==s?(T=m?(0,Q.jsx)(z,{size:`xs`,variant:`destructive-outline`,onClick:()=>s(n),disabled:c,children:c?`Restarting…`:`Disable`}):null,t[28]=m,t[29]=n,t[30]=c,t[31]=s,t[32]=T):T=t[32];let E;t[33]!==n||t[34]!==r||t[35]!==f||t[36]!==a?(E=!f&&!r?(0,Q.jsx)(z,{size:`xs`,variant:`outline`,onClick:()=>a(n),children:`Set as default`}):null,t[33]=n,t[34]=r,t[35]=f,t[36]=a,t[37]=E):E=t[37];let D;t[38]!==C||t[39]!==w||t[40]!==T||t[41]!==E?(D=(0,Q.jsxs)(`div`,{className:`ml-auto flex min-h-6 shrink-0 items-center justify-end gap-2`,children:[C,w,T,E]}),t[38]=C,t[39]=w,t[40]=T,t[41]=E,t[42]=D):D=t[42];let O;t[43]!==D||t[44]!==S?(O=(0,Q.jsxs)(`div`,{className:`flex min-h-6 min-w-0 flex-col gap-2 sm:-my-0.5 sm:flex-row sm:items-center`,children:[S,D]}),t[43]=D,t[44]=S,t[45]=O):O=t[45];let k;return t[46]!==O||t[47]!==_||t[48]!==v?(k=(0,Q.jsxs)(`div`,{className:_,children:[v,O]}),t[46]=O,t[47]=_,t[48]=v,t[49]=k):k=t[49],k});function Pi(e){let t=(0,Z.c)(14),{endpoint:n,hiddenEndpointCount:r,expanded:i,onToggleExpanded:a,fallback:o}=e;if(!n)return o;let s;t[0]===n.httpBaseUrl?s=t[1]:(s=(0,Q.jsx)(`span`,{className:`min-w-0 truncate`,children:n.httpBaseUrl}),t[0]=n.httpBaseUrl,t[1]=s);let c;t[2]!==i||t[3]!==r?(c=r>0?(0,Q.jsx)(`span`,{className:`shrink-0 text-xs font-medium`,children:i?`Hide`:`+${r}`}):null,t[2]=i,t[3]=r,t[4]=c):c=t[4];let l;t[5]!==s||t[6]!==c?(l=(0,Q.jsxs)(Q.Fragment,{children:[s,c]}),t[5]=s,t[6]=c,t[7]=l):l=t[7];let u=l,d;t[8]===Symbol.for(`react.memo_cache_sentinel`)?(d=(0,Q.jsx)(`span`,{className:`shrink-0`,children:`Reachable at`}),t[8]=d):d=t[8];let f;return t[9]!==i||t[10]!==r||t[11]!==a||t[12]!==u?(f=(0,Q.jsxs)(`span`,{className:`inline-flex min-w-0 max-w-full items-baseline gap-1`,children:[d,r>0?(0,Q.jsx)(`button`,{type:`button`,className:`inline-flex min-w-0 max-w-full items-baseline gap-2 border-b border-dotted border-muted-foreground/60 text-left text-muted-foreground underline-offset-4 hover:border-foreground hover:text-foreground`,onClick:a,"aria-expanded":i,children:u}):(0,Q.jsx)(`span`,{className:`inline-flex min-w-0 max-w-full items-baseline gap-2`,children:u})]}),t[9]=i,t[10]=r,t[11]=a,t[12]=u,t[13]=f):f=t[13],f}function Fi(e){if(!e.entry.enabled&&e.connection.phase!==`unsupported`)return{text:`Off`,tone:`muted`};let{connection:t}=e;switch(t.phase){case`connected`:return{text:`Connected`,tone:`muted`};case`connecting`:return{text:`Connecting`,tone:`muted`};case`reconnecting`:return{text:t.error?`Reconnecting: ${t.error}`:`Reconnecting`,tone:`error`};case`unsupported`:return{text:`Client not supported`,tone:`muted`};case`error`:return{text:t.error?`Connection failed: ${t.error}`:`Connection failed`,tone:`error`};case`offline`:return{text:`Offline`,tone:`muted`};case`available`:return{text:`Not connected`,tone:`muted`}}}function Ii(e){let t=(0,Z.c)(161),{environment:n,removingEnvironmentId:r,onSetEnabled:i,onRemove:o,onAddRoute:s}=e,[c,l]=(0,$.useState)(!1),[u,p]=(0,$.useState)(!1),h=n.environmentId,g=n.connection.phase===`unsupported`,_=n.entry.enabled&&!g,v=n.connection.phase===`connected`,y=r===h,b=n.connection.traceId,S;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(S={target:`trace ID`,onCopy:Wi,onError:Ui},t[0]=S):S=t[0];let{copyToClipboard:C}=Ye(S),w;t[1]===C?w=t[2]:(w=e=>{C(e,{traceId:e})},t[1]=C,t[2]=w);let T=w,E;t[3]===Symbol.for(`react.memo_cache_sentinel`)?(E={target:`MCP URL`,onCopy:Hi,onError:Vi},t[3]=E):E=t[3];let{copyToClipboard:D}=Ye(E),O;t[4]===n.serverConfig?O=t[5]:(O=Un(n.serverConfig),t[4]=n.serverConfig,t[5]=O);let k=O,A;t[6]===h?A=t[7]:(A=nt.updateStateAtom(h),t[6]=h,t[7]=A);let j=N(A),F=j.status===`running`&&j.stage===`resuming`,ee;t[8]===n?ee=t[9]:(ee=Fi(n),t[8]=n,t[9]=ee);let te=ee,ne=n.serverConfig?.environment.serverVersion??null,re=et(),ie;t[10]!==h||t[11]!==re.environments?(ie=x(re.environments.get(h)?.status??a())?.descriptor,t[10]=h,t[11]=re.environments,t[12]=ie):ie=t[12];let ae=ie,[oe,se]=(0,$.useState)(ae);ae!==void 0&&ae!==oe&&se(ae);let ce;t[13]!==h||t[14]!==re.environments?(ce=re.environments.get(h)?.environment.endpoint.httpBaseUrl,t[13]=h,t[14]=re.environments,t[15]=ce):ce=t[15];let I=ce,[le,ue]=(0,$.useState)(I);I!==void 0&&I!==le&&ue(I);let L=ct(h),de=v&&L._tag===`Some`?L.value.target:null,R=I??le,pe;t[16]!==de||t[17]!==n.entry||t[18]!==R?(pe=Be({entry:n.entry,relayHttpBaseUrl:R,connectedTarget:de}),t[16]=de,t[17]=n.entry,t[18]=R,t[19]=pe):pe=t[19];let me=pe,he;t[20]!==n.serverConfig||t[21]!==oe?(he=n.serverConfig??(oe===void 0?null:{environment:oe}),t[20]=n.serverConfig,t[21]=oe,t[22]=he):he=t[22];let ve;t[23]===he?ve=t[24]:(ve=Ce(he),t[23]=he,t[24]=ve);let ye=ve,B;t[25]===n.entry?B=t[26]:(B=Ne(n.entry),t[25]=n.entry,t[26]=B);let xe=B.length,Se;t[27]!==de||t[28]!==n?(Se=xr(n,de),t[27]=de,t[28]=n,t[29]=Se):Se=t[29];let V=F?`Restarting`:te.text,we=_&&k?ne:null,Te;t[30]!==Se||t[31]!==V||t[32]!==we?(Te=[Se,V,we].filter(Bi),t[30]=Se,t[31]=V,t[32]=we,t[33]=Te):Te=t[33];let Ee=Te.join(` · `),De=_&&v&&k!==null&&(j.status===`idle`||j.status===`failed`),Oe;t[34]!==_||t[35]!==n.connection||t[36]!==g?(Oe=g?n.connection.error??Ue(n.connection):_?Ue(n.connection):`Switched off`,t[34]=_,t[35]=n.connection,t[36]=g,t[37]=Oe):Oe=t[37];let ke=`${Oe}${k?`\nUpdate available: ${k.serverVersion} → ${k.clientVersion}`:``}`,Ae=n.label,je=!_,Me=_&&te.tone===`error`&&!F&&`text-destructive`,Pe;t[38]===Me?Pe=t[39]:(Pe=ge(`min-w-0 truncate`,Me),t[38]=Me,t[39]=Pe);let Fe;t[40]===Pe?Fe=t[41]:(Fe=(0,Q.jsx)(`span`,{className:Pe}),t[40]=Pe,t[41]=Fe);let H;t[42]!==ke||t[43]!==Ee||t[44]!==Fe?(H=(0,Q.jsx)(Xe,{payload:ke,render:Fe,children:Ee}),t[42]=ke,t[43]=Ee,t[44]=Fe,t[45]=H):H=t[45];let Ie;t[46]===ke?Ie=t[47]:(Ie=(0,Q.jsx)(Ze,{side:`top`,className:`whitespace-pre-wrap`,children:ke}),t[46]=ke,t[47]=Ie);let U;t[48]!==H||t[49]!==Ie?(U=(0,Q.jsxs)(Qe,{children:[H,Ie]}),t[48]=H,t[49]=Ie,t[50]=U):U=t[50];let W;t[51]===Symbol.for(`react.memo_cache_sentinel`)?(W=(0,Q.jsx)(`span`,{"aria-hidden":!0,className:`shrink-0`,children:`·`}),t[51]=W):W=t[51];let Le;t[52]===Symbol.for(`react.memo_cache_sentinel`)?(Le=()=>l(zi),t[52]=Le):Le=t[52];let ze=xe===1?`Routes`:`${xe} routes`,Ve=c&&`rotate-90`,He;t[53]===Ve?He=t[54]:(He=ge(`size-3 shrink-0 transition-transform duration-150 motion-reduce:transition-none`,Ve),t[53]=Ve,t[54]=He);let G;t[55]===He?G=t[56]:(G=(0,Q.jsx)(be,{"aria-hidden":!0,className:He}),t[55]=He,t[56]=G);let We;t[57]!==c||t[58]!==ze||t[59]!==G?(We=(0,Q.jsxs)(`button`,{type:`button`,"aria-expanded":c,onClick:Le,className:`inline-flex shrink-0 items-center gap-0.5 rounded-sm text-muted-foreground outline-none hover:text-foreground focus-visible:ring-1 focus-visible:ring-inset focus-visible:ring-ring`,children:[ze,G]}),t[57]=c,t[58]=ze,t[59]=G,t[60]=We):We=t[60];let Ge;t[61]===Symbol.for(`react.memo_cache_sentinel`)?(Ge=(0,Q.jsx)(`span`,{"aria-hidden":!0,className:`shrink-0`,children:`·`}),t[61]=Ge):Ge=t[61];let Ke=`remote-permissions-${h}`,qe;t[62]===Symbol.for(`react.memo_cache_sentinel`)?(qe=()=>p(Ri),t[62]=qe):qe=t[62];let Je=u&&`rotate-90`,K;t[63]===Je?K=t[64]:(K=ge(`size-3 shrink-0 transition-transform duration-150 motion-reduce:transition-none`,Je),t[63]=Je,t[64]=K);let q;t[65]===K?q=t[66]:(q=(0,Q.jsx)(be,{"aria-hidden":!0,className:K}),t[65]=K,t[66]=q);let $e;t[67]!==u||t[68]!==Ke||t[69]!==q?($e=(0,Q.jsxs)(`button`,{type:`button`,"aria-expanded":u,"aria-controls":Ke,onClick:qe,className:`inline-flex shrink-0 items-center gap-0.5 rounded-sm text-muted-foreground outline-none hover:text-foreground focus-visible:ring-1 focus-visible:ring-inset focus-visible:ring-ring`,children:[`Permissions`,q]}),t[67]=u,t[68]=Ke,t[69]=q,t[70]=$e):$e=t[70];let tt;t[71]!==U||t[72]!==We||t[73]!==$e?(tt=(0,Q.jsxs)(`span`,{className:`flex min-w-0 items-center gap-1`,children:[U,W,We,Ge,$e]}),t[71]=U,t[72]=We,t[73]=$e,t[74]=tt):tt=t[74];let J;t[75]===j?J=t[76]:(J=j.status===`idle`?null:(0,Q.jsx)(`div`,{className:`mt-1 max-w-md`,children:(0,Q.jsx)(Xn,{state:j})}),t[75]=j,t[76]=J);let rt;t[77]!==n||t[78]!==s||t[79]!==c?(rt=c&&(0,Q.jsx)(gr,{environment:n,onAddRoute:()=>s(n)}),t[77]=n,t[78]=s,t[79]=c,t[80]=rt):rt=t[80];let it;t[81]!==h||t[82]!==v||t[83]!==u?(it=u&&(0,Q.jsx)(`div`,{id:`remote-permissions-${h}`,className:`mt-2 border-t border-border/50`,children:(0,Q.jsx)(lr,{environmentId:h,connected:v,routeContext:!0})}),t[81]=h,t[82]=v,t[83]=u,t[84]=it):it=t[84];let at;t[85]!==rt||t[86]!==it?(at=(0,Q.jsxs)(Q.Fragment,{children:[rt,it]}),t[85]=rt,t[86]=it,t[87]=at):at=t[87];let ot;t[88]!==n.entry.serverUpdateRequired||t[89]!==n.label||t[90]!==h||t[91]!==oe?.serverVersion||t[92]!==j.status||t[93]!==g?(ot=g&&n.entry.serverUpdateRequired===!0&&j.status!==`running`?(0,Q.jsx)(nr,{environmentId:h,serverLabel:`${n.label} server`,fromVersion:oe?.serverVersion,targetVersion:Re,label:j.status===`failed`?`Retry update`:`Update`}):null,t[88]=n.entry.serverUpdateRequired,t[89]=n.label,t[90]=h,t[91]=oe?.serverVersion,t[92]=j.status,t[93]=g,t[94]=ot):ot=t[94];let st;t[95]!==n.label||t[96]!==n.serverConfig||t[97]!==h||t[98]!==j.status||t[99]!==De||t[100]!==k?(st=De?(0,Q.jsx)(Zn,{environmentId:h,serverLabel:`${n.label} server`,selfUpdate:On(n.serverConfig),installation:n.serverConfig?.environment.capabilities.serverInstallation,desktopAppUpdate:Rn(n.serverConfig),threadContinuation:tr(n.serverConfig),targetVersion:k.clientVersion,label:j.status===`failed`?`Retry update`:`Update`,appearance:`icon`}):null,t[95]=n.label,t[96]=n.serverConfig,t[97]=h,t[98]=j.status,t[99]=De,t[100]=k,t[101]=st):st=t[101];let lt=y||g,ut=`${_?`Switch off`:`Switch on`} ${n.label}`,dt;t[102]!==h||t[103]!==i?(dt=e=>i(h,e),t[102]=h,t[103]=i,t[104]=dt):dt=t[104];let ft;t[105]!==_||t[106]!==lt||t[107]!==ut||t[108]!==dt?(ft=(0,Q.jsx)(Xe,{render:(0,Q.jsx)(Fn,{size:`sm`,checked:_,disabled:lt,"aria-label":ut,onCheckedChange:dt})}),t[105]=_,t[106]=lt,t[107]=ut,t[108]=dt,t[109]=ft):ft=t[109];let Y=g?`Client not supported`:_?`Switch off`:`Switch on`,pt;t[110]===Y?pt=t[111]:(pt=(0,Q.jsx)(Ze,{side:`top`,children:Y}),t[110]=Y,t[111]=pt);let mt;t[112]!==ft||t[113]!==pt?(mt=(0,Q.jsxs)(Qe,{children:[ft,pt]}),t[112]=ft,t[113]=pt,t[114]=mt):mt=t[114];let ht=`More actions for ${n.label}`,gt;t[115]!==y||t[116]!==ht?(gt=(0,Q.jsx)(z,{type:`button`,variant:`ghost-muted`,size:`icon-xs`,disabled:y,"aria-label":ht}),t[115]=y,t[116]=ht,t[117]=gt):gt=t[117];let _t;t[118]===Symbol.for(`react.memo_cache_sentinel`)?(_t=(0,Q.jsx)(d,{className:`size-3.5`}),t[118]=_t):_t=t[118];let vt;t[119]===gt?vt=t[120]:(vt=(0,Q.jsx)(fe,{render:gt,children:_t}),t[119]=gt,t[120]=vt);let yt;t[121]!==n.serverConfig||t[122]!==h?(yt=(0,Q.jsx)(hr,{environmentId:h,serverConfig:n.serverConfig}),t[121]=n.serverConfig,t[122]=h,t[123]=yt):yt=t[123];let bt,xt;t[124]===Symbol.for(`react.memo_cache_sentinel`)?(bt=()=>l(Li),xt=(0,Q.jsx)(m,{}),t[124]=bt,t[125]=xt):(bt=t[124],xt=t[125]);let St=c?`Hide routes`:`Routes`,Ct;t[126]===St?Ct=t[127]:(Ct=(0,Q.jsxs)(M,{onClick:bt,children:[xt,St]}),t[126]=St,t[127]=Ct);let wt;t[128]!==D||t[129]!==me?(wt=me?(0,Q.jsx)(M,{onClick:()=>D(me,{url:me}),children:`Copy MCP URL`}):null,t[128]=D,t[129]=me,t[130]=wt):wt=t[130];let Tt;t[131]!==T||t[132]!==b?(Tt=b?(0,Q.jsx)(M,{onClick:()=>T(b),children:`Copy trace ID`}):null,t[131]=T,t[132]=b,t[133]=Tt):Tt=t[133];let Et;t[134]===Symbol.for(`react.memo_cache_sentinel`)?(Et=(0,Q.jsx)(_e,{}),t[134]=Et):Et=t[134];let Dt;t[135]!==n||t[136]!==o?(Dt=()=>o(n),t[135]=n,t[136]=o,t[137]=Dt):Dt=t[137];let Ot=y?`Removing…`:`Remove from this device…`,kt;t[138]!==Dt||t[139]!==Ot?(kt=(0,Q.jsx)(M,{variant:`destructive`,onClick:Dt,children:Ot}),t[138]=Dt,t[139]=Ot,t[140]=kt):kt=t[140];let At;t[141]!==yt||t[142]!==Ct||t[143]!==wt||t[144]!==Tt||t[145]!==kt?(At=(0,Q.jsxs)(P,{align:`end`,children:[yt,Ct,wt,Tt,Et,kt]}),t[141]=yt,t[142]=Ct,t[143]=wt,t[144]=Tt,t[145]=kt,t[146]=At):At=t[146];let jt;t[147]!==vt||t[148]!==At?(jt=(0,Q.jsxs)(f,{children:[vt,At]}),t[147]=vt,t[148]=At,t[149]=jt):jt=t[149];let Mt;return t[150]!==n.label||t[151]!==ye||t[152]!==je||t[153]!==tt||t[154]!==J||t[155]!==at||t[156]!==ot||t[157]!==st||t[158]!==mt||t[159]!==jt?(Mt=(0,Q.jsxs)(Sr,{kind:ye,label:Ae,dimmed:je,subtitle:tt,below:J,detail:at,children:[ot,st,mt,jt]}),t[150]=n.label,t[151]=ye,t[152]=je,t[153]=tt,t[154]=J,t[155]=at,t[156]=ot,t[157]=st,t[158]=mt,t[159]=jt,t[160]=Mt):Mt=t[160],Mt}function Li(e){return!e}function Ri(e){return!e}function zi(e){return!e}function Bi(e){return e!==null}function Vi(e){q.add(ht({type:`error`,title:`Could not copy MCP URL`,description:e.message}))}function Hi(e){let{url:t}=e;q.add({type:`success`,title:`MCP URL copied`,description:`Add it to an agent, e.g. claude mcp add --transport http p4 ${t}`})}function Ui(e){q.add(ht({type:`error`,title:`Could not copy trace ID`,description:e.message}))}function Wi(e){let{traceId:t}=e;q.add({type:`success`,title:`Trace ID copied`,description:t})}function Gi(e){let t=(0,Z.c)(10),{checked:n,disabled:r,disabledReason:i,onCheckedChange:a,ariaLabel:o}=e,s=o===void 0?`Enable P4 Connect`:o,c;t[0]===a?c=t[1]:(c=a?{onCheckedChange:a}:{},t[0]=a,t[1]=c);let l;t[2]!==s||t[3]!==n||t[4]!==r||t[5]!==c?(l=(0,Q.jsx)(Fn,{"aria-label":s,checked:n,disabled:r,...c}),t[2]=s,t[3]=n,t[4]=r,t[5]=c,t[6]=l):l=t[6];let u=l,d;return t[7]!==u||t[8]!==i?(d=i?(0,Q.jsxs)(Qe,{children:[(0,Q.jsx)(Xe,{render:(0,Q.jsx)(`span`,{className:`inline-flex`,children:u})}),(0,Q.jsx)(Ze,{side:`top`,children:i})]}):u,t[7]=u,t[8]=i,t[9]=d):d=t[9],d}function Ki(e){let t=(0,Z.c)(44),{canManageRelay:n}=e,r=J(),{isSignedIn:i,linkState:a,linkRevoked:o,managedTunnelActive:s,managedTunnelOutOfSync:c,publishAgentActivity:l,holdWebhooksWhileOffline:u,operationError:d,reconcileCloudState:f}=ir(),[p,m]=(0,$.useState)(!1),[h,g]=(0,$.useState)(!1),_=i?n?null:`Your session does not have permission to manage P4 Connect access.`:`Sign in to P4 Connect to manage this environment.`,v=p||h,y;t[0]!==r||t[1]!==l||t[2]!==f?(y=async e=>{r!==null&&st(r,`relay:write`)&&(m(!0),await f({managedTunnel:e,publish:l})&&q.add({type:`success`,title:e?`P4 Connect linked`:l?`P4 Connect tunnel disabled`:`P4 Connect unlinked`,description:e?`This environment is available through P4 Connect.`:l?`The managed tunnel was removed. Agent activity publishing stays on.`:`This environment is no longer available through P4 Connect.`}),m(!1))},t[0]=r,t[1]=l,t[2]=f,t[3]=y):y=t[3];let b=y,x;t[4]!==s||t[5]!==r||t[6]!==f?(x=async e=>{r!==null&&st(r,`relay:write`)&&(g(!0),await f({managedTunnel:s,publish:e})&&q.add({type:`success`,title:e?`Agent activity enabled`:`Agent activity disabled`,description:e?`This environment publishes agent activity to your mobile clients.`:`This environment will stop publishing agent activity.`}),g(!1))},t[4]=s,t[5]=r,t[6]=f,t[7]=x):x=t[7];let S=x,C;t[8]!==s||t[9]!==l||t[10]!==f?(C=async e=>{g(!0),await f({managedTunnel:s,publish:l,holdWebhooksWhileOffline:e})&&q.add({type:`success`,title:e?`Webhooks held while offline`:`Webhooks no longer held`,description:e?`P4 Connect keeps webhook requests for up to 24 hours while this environment is offline.`:`Requests to an offline environment now fail. Anything already held is still delivered.`}),g(!1)},t[8]=s,t[9]=l,t[10]=f,t[11]=C):C=t[11];let w=C,T;t[12]!==n||t[13]!==_||t[14]!==v||t[15]!==i||t[16]!==o||t[17]!==s||t[18]!==c||t[19]!==d||t[20]!==a||t[21]!==b?(T=window.desktopBridge?(0,Q.jsx)(gn,{title:$n(`t3-connect`).title,description:o?`This environment was removed from P4 Connect. Turn it on to link it again.`:s?`This environment is available to your other devices through P4 Connect.`:c?`P4 Connect is out of sync. This environment is linked only to publish agent activity, so other devices cannot connect. Turn P4 Connect on to repair it.`:`Make this environment available to your other devices through P4 Connect.`,status:d??a.error,control:(0,Q.jsx)(Gi,{checked:s,disabled:!n||!i||a.data===null||a.isPending||v,disabledReason:_,onCheckedChange:e=>void b(e)})}):o?(0,Q.jsx)(gn,{title:$n(`t3-connect`).title,description:"This environment was removed from P4 Connect. Run `p4c connect link` on the host to link it again."}):null,t[12]=n,t[13]=_,t[14]=v,t[15]=i,t[16]=o,t[17]=s,t[18]=c,t[19]=d,t[20]=a,t[21]=b,t[22]=T):T=t[22];let E;t[23]===Symbol.for(`react.memo_cache_sentinel`)?(E=$n(`publish-agent-activity`),t[23]=E):E=t[23];let D=!n||!i||a.data===null||a.isPending||v,O;t[24]===S?O=t[25]:(O=e=>void S(e),t[24]=S,t[25]=O);let k;t[26]!==_||t[27]!==l||t[28]!==D||t[29]!==O?(k=(0,Q.jsx)(gn,{title:E.title,description:`Send activity to mobile notifications and Live Activities without P4 Connect.`,control:(0,Q.jsx)(Gi,{ariaLabel:`Publish agent activity to mobile clients`,checked:l,disabled:D,disabledReason:_,onCheckedChange:O})}),t[26]=_,t[27]=l,t[28]=D,t[29]=O,t[30]=k):k=t[30];let A;t[31]!==n||t[32]!==_||t[33]!==u||t[34]!==v||t[35]!==i||t[36]!==s||t[37]!==a||t[38]!==w?(A=s?(0,Q.jsx)(gn,{title:$n(`hold-webhooks-while-offline`).title,description:`Keep webhook requests for up to 24 hours while this environment is offline, then deliver them. Off: P4 Connect only forwards requests and stores nothing.`,control:(0,Q.jsx)(Gi,{ariaLabel:`Hold webhook requests while this environment is offline`,checked:u,disabled:!n||!i||a.isPending||v,disabledReason:_,onCheckedChange:e=>void w(e)})}):null,t[31]=n,t[32]=_,t[33]=u,t[34]=v,t[35]=i,t[36]=s,t[37]=a,t[38]=w,t[39]=A):A=t[39];let j;return t[40]!==T||t[41]!==k||t[42]!==A?(j=(0,Q.jsxs)(Q.Fragment,{children:[T,k,A]}),t[40]=T,t[41]=k,t[42]=A,t[43]=j):j=t[43],j}function qi(e){let t=(0,Z.c)(3),{canReadRelay:n,canManageRelay:r}=e;if(!Pe())return null;if(!n){let e;return t[0]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,Q.jsx)(gn,{title:`P4 Connect`,description:`To edit these settings, pair this connection with both View relay and Manage relay permissions.`}),t[0]=e):e=t[0],e}let i;return t[1]===r?i=t[2]:(i=(0,Q.jsx)(Ki,{canManageRelay:r}),t[1]=r,t[2]=i),i}function Ji(e){let t=(0,Z.c)(4),{cloudEnabled:n}=e,r=n===void 0||n,i;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(i=(0,Q.jsx)(Rt,{variant:`icon`,children:(0,Q.jsx)(re,{})}),t[0]=i):i=t[0];let a;t[1]===Symbol.for(`react.memo_cache_sentinel`)?(a=(0,Q.jsx)(Bt,{children:`No saved remote environments`}),t[1]=a):a=t[1];let o=r?`Click “Add environment” to pair another environment, or connect one from P4 Connect.`:`Click “Add environment” to pair another environment.`,s;return t[2]===o?s=t[3]:(s=(0,Q.jsxs)(Ht,{className:`min-h-52`,children:[i,(0,Q.jsxs)(zt,{children:[a,(0,Q.jsx)(Vt,{children:o})]})]}),t[2]=o,t[3]=s),s}function Yi(e){let t=(0,Z.c)(3),{primaryEnvironmentId:n,savedEnvironments:r}=e,i;return t[0]!==n||t[1]!==r?(i=Pe()?(0,Q.jsx)(rr,{primaryEnvironmentId:n,savedEnvironments:r,empty:(0,Q.jsx)(Ji,{})}):r.length===0?(0,Q.jsx)(Ji,{cloudEnabled:!1}):null,t[0]=n,t[1]=r,t[2]=i):i=t[2],i}function Xi(){let e=window.desktopBridge,t=N(it),{environments:n}=$e(),r=tt(),a=ut(En,{reportFailure:!1}),o=ut(Tn,{reportFailure:!1}),s=ut(rt.remove,{reportFailure:!1}),c=ut(rt.register,{reportFailure:!1}),l=et(),u=ut(rt.setEnabled,{reportFailure:!1}),p=r?.environmentId??null,m=wn(),h=m.data?.authenticated?m.data.permissions??m.data.scopes??null:null,_=e?null:m.data?.auth.policy??null,v=(0,$.useMemo)(()=>n.filter(e=>e.entry.target._tag!==`PrimaryConnectionTarget`),[n]),y=(0,$.useMemo)(()=>v.filter(e=>!He(e.entry.target)),[v]),b=(0,$.useMemo)(()=>i(e=>v.map(t=>({environment:t,updateStatus:e(nt.updateStateAtom(t.environmentId)).status}))),[v]),x=N(b),C=(0,$.useMemo)(()=>x.flatMap(({environment:e,updateStatus:t})=>{let n=Un(e.serverConfig),r=On(e.serverConfig),i=Rn(e.serverConfig);return!n||t===`running`||!e.entry.enabled||e.connection.phase!==`connected`||He(e.entry.target)||r===null||r===`desktop-managed`&&!i?[]:[{environmentId:e.environmentId,serverLabel:e.label,selfUpdate:r,installation:e.serverConfig?.environment.capabilities.serverInstallation,desktopAppUpdate:i,threadContinuation:tr(e.serverConfig),continueThreadsAfterServerUpdate:e.serverConfig?.settings.continueThreadsAfterServerUpdate??!1,targetVersion:n.clientVersion}]}),[x]),w=(0,$.useMemo)(()=>[...r?[r]:[],...v.filter(e=>e.entry.enabled)],[r,v]),T=(0,$.useMemo)(()=>{let e=new Set;for(let t of v){let n=t.entry.profile;if(t.entry.target._tag!==`SshConnectionTarget`||g(n)||n.value._tag!==`SshConnectionProfile`)continue;let r=n.value.target;e.add(r.alias),e.add(br(r))}return e},[v]),[D,O]=(0,$.useState)(null),[k,A]=(0,$.useState)(null),[j,M]=(0,$.useState)(()=>new Map),F=(0,$.useCallback)(e=>{M(t=>new Map(t).set(e.id,e.credential))},[]),[te,ne]=(0,$.useState)(null),[ie,oe]=(0,$.useState)(null),[se,ce]=(0,$.useState)(!1),[I,le]=(0,$.useState)(!1),[L,de]=(0,$.useState)(null),[R,pe]=(0,$.useState)(`remote`),[he,_e]=(0,$.useState)(``),[ve,ye]=(0,$.useState)(``),[B,Se]=(0,$.useState)(``),[V,we]=(0,$.useState)(``),[Te,Ee]=(0,$.useState)(``),[Oe,Ae]=(0,$.useState)(!1),Me=(0,$.useRef)(void 0),[Ne,H]=(0,$.useState)(null),[U,W]=(0,$.useState)(!1),[Le,Re]=(0,$.useState)(null),[ze,Be]=(0,$.useState)(!1),[Ve,Ue]=(0,$.useState)(!1),[G,Ye]=(0,$.useState)(!1),[J,at]=(0,$.useState)(!1),[ct,ft]=(0,$.useState)(null),[Y,pt]=(0,$.useState)(null),mt=Y!==null,[gt,_t]=(0,$.useState)(null),[vt,Lt]=(0,$.useState)(!1),[Rt,zt]=(0,$.useState)(String(ti)),[Bt,Vt]=(0,$.useState)(null),Ht=r?.serverConfig??null,Jt=Un(Ht),Yt=N(nt.updateStateAtom(p)),[Xt,Zt]=(0,$.useState)(!1),Qt=$t(e=>e.defaultAdvertisedEndpointKey),en=$t(e=>e.setDefaultAdvertisedEndpointKey),tn=ot(p,me),nn=ot(p,ue),rn=ot(p,xe),an=ot(p,ae),on=ot(p,E),sn=!Ie()&&an,cn=lt(tn&&p!==null?Br.accessChanges({environmentId:p,input:null}):null),ln=lt(sn&&e?qr:null),un=e!==void 0&&I&&R===`ssh`,dn=lt(un?ei:null),pn=dn.refresh;(0,$.useEffect)(()=>{un&&pn()},[un,pn]);let yn=lt(sn&&e?Kn:null),X=yn.data,xn=ct??yn.error,kn=yn.isPending&&yn.data===null,Pn=dn.data??ri,zn=(0,$.useMemo)(()=>Pn.filter(e=>{let t=br(e);return!T.has(e.alias)&&!T.has(t)}),[Pn,T]),Hn=(0,$.useMemo)(()=>Yr(zn,B),[B,zn]),Wn=dn.isPending&&dn.data===null,Gn=dn.error,Jn=e!==void 0&&(Wn||zn.length>0),Yn=ln.data?.serverExposureState??null,Qn=ln.data?.advertisedEndpoints??ni,nr=D??ln.error,rr=k??cn.error,ir=cn.isPending&&cn.data===null,ar=(0,$.useMemo)(()=>{let e=cn.data;return e?.type===`snapshot`?_i(e.payload.pairingLinks.map(e=>bi(e))):[]},[cn.data]),or=(0,$.useMemo)(()=>{let e=cn.data;return e?.type===`snapshot`?yi(e.payload.clientSessions.map(e=>xi(e))):[]},[cn.data]),Z=e?Yn?.mode===`network-accessible`:_===`remote-reachable`,cr=Rt.trim(),ur=Number(cr),dr=/^\d+$/u.test(cr)&&Number.isInteger(ur)&&ur>=1&&ur<=65535,pr=(0,$.useMemo)(()=>{if(!gt)return null;if(!dr||ur===ti)return gt.httpBaseUrl;try{let e=new URL(gt.httpBaseUrl);return e.port=String(ur),e.toString().replace(/\/$/u,``)}catch{return gt.httpBaseUrl}},[dr,ur,gt]),mr=(0,$.useCallback)(async t=>{if(e&&p!==null&&st(p,`environment:maintain`)){Be(!0),O(null);try{await e.setServerExposureMode(t?`network-accessible`:`local-only`),Jr(),Ue(!1),Be(!1)}catch(e){let t=e instanceof Error?e.message:`Failed to update network exposure.`;Ue(!1),O(t),q.add(ht({type:`error`,title:`Could not update network access`,description:t})),Be(!1)}}},[e,p]),gr=(0,$.useCallback)(()=>{Bt!==null&&mr(Bt===`network-accessible`)},[mr,Bt]),_r=(0,$.useCallback)(async()=>{if(e&&p!==null&&st(p,`environment:maintain`)&&dr){Ye(!0),O(null);try{await e.setTailscaleServeEnabled({enabled:!0,port:ur}),Jr(),_t(null)}catch(e){let t=e instanceof Error?e.message:`Failed to configure Tailscale HTTPS.`;O(t),q.add(ht({type:`error`,title:`Could not set up Tailscale HTTPS`,description:t}))}finally{Ye(!1)}}},[e,dr,ur,p]),vr=(0,$.useCallback)(e=>{zt(String(Yn?.tailscaleServePort??ti)),_t(e)},[Yn?.tailscaleServePort]),yr=(0,$.useCallback)(async()=>{if(e&&p!==null&&st(p,`environment:maintain`)){Ye(!0),O(null);try{await e.setTailscaleServeEnabled({enabled:!1,port:Yn?.tailscaleServePort??ti}),Jr(),Lt(!1)}catch(e){let t=e instanceof Error?e.message:`Failed to disable Tailscale HTTPS.`;O(t),q.add(ht({type:`error`,title:`Could not disable Tailscale HTTPS`,description:t}))}finally{Ye(!1)}}},[e,Yn,p]),xr=(0,$.useCallback)(e=>{Lt(!0)},[]),Sr=(0,$.useCallback)(async e=>{if(p!==null&&st(p,`access:write`)){ne(e),A(null);try{await Cn(e)}catch(e){let t=e instanceof Error?e.message:`Failed to revoke pairing link.`;A(t),q.add(ht({type:`error`,title:`Could not revoke pairing link`,description:t}))}finally{ne(null)}}},[p]),Cr=(0,$.useCallback)(async e=>{if(p!==null&&st(p,`access:write`)){oe(e),A(null);try{await Sn(e)}catch(e){let t=e instanceof Error?e.message:`Failed to revoke client access.`;A(t),q.add(ht({type:`error`,title:`Could not revoke client access`,description:t}))}finally{oe(null)}}},[p]),wr=(0,$.useCallback)(async()=>{if(p!==null&&st(p,`access:write`)){ce(!0),A(null);try{let e=await bn();q.add({type:`success`,title:e===1?`Revoked 1 other client`:`Revoked ${e} clients`,description:`Other paired clients will need a new pairing link before reconnecting.`})}catch(e){let t=e instanceof Error?e.message:`Failed to revoke other clients.`;A(t),q.add(ht({type:`error`,title:`Could not revoke other clients`,description:t}))}finally{ce(!1)}}},[p]),Tr=(0,$.useCallback)(async e=>{W(!0),H(null);let t=await o({target:e,label:``,...L?{expectedEnvironmentId:L.environmentId}:{}});if(t._tag===`Failure`){ke(t)||H(pi(je(t))),W(!1);return}_e(``),ye(``),Se(``),we(``),Ee(``),le(!1),q.add({type:`success`,title:L?`Route added`:`Environment connected`,description:L?`${L.label} can now be reached over SSH ${e.alias}.`:`${e.alias} is ready over an SSH-managed tunnel.`}),W(!1)},[o,L]),Er=(0,$.useCallback)(async()=>{if(R===`ssh`){let e;try{e=ui({host:B,username:V,port:Te})}catch(e){H(pi(e));return}await Tr(e);return}W(!0),H(null);let e;try{e=fi({host:he,pairingCode:ve})}catch(e){let t=e instanceof Error?e.message:`Failed to add backend.`;H(t),q.add(ht({type:`error`,title:`Could not add backend`,description:t})),W(!1);return}let t=await a({...e,...L?{expectedEnvironmentId:L.environmentId}:{}});if(t._tag===`Failure`){if(!ke(t)){let e=je(t),n=e instanceof Error?e.message:`Failed to add backend.`;H(n),q.add(ht({type:`error`,title:`Could not add backend`,description:n}))}W(!1);return}_e(``),ye(``),Se(``),we(``),Ee(``),le(!1),q.add(L?{type:`success`,title:`Route added`,description:`${L.label} now has another way to connect.`}:{type:`success`,title:`Backend added`,description:`The environment is saved and will reconnect on app startup.`}),W(!1)},[L,a,Tr,he,R,ve,B,Te,V]),Or=(0,$.useCallback)(e=>{e.nativeEvent.isComposing||e.keyCode===229||e.key===`Enter`&&B.trim().length>0&&(e.preventDefault(),Er())},[Er,B]),kr=(0,$.useCallback)(async t=>{if(U||!e)return;W(!0),H(null),Se(t.alias);let n;try{n=await e.resolveSshHost(t.alias)}catch(e){H(pi(e)),W(!1);return}we(n.username??``),Ee(n.port===null?``:String(n.port)),await Tr(n)},[Tr,e,U]),Ar=(0,$.useCallback)(e=>{if(e.nativeEvent.isComposing||e.keyCode===229)return;let n=Oe&&Jn;if(n){let n=Gt(e,t,{platform:navigator.platform,context:{modelPickerOpen:!1}}),r=Kt(n??``),i=r===null?void 0:Hn[r];if(i){e.preventDefault(),e.stopPropagation(),Ae(!1),kr(i);return}if(e.key===`Escape`){e.preventDefault(),e.stopPropagation();return}}let r=n&&Me.current!==void 0;!e.defaultPrevented&&!r&&e.key===`Enter`&&B.trim().length>0&&(e.preventDefault(),Er())},[Hn,Er,kr,Jn,t,B,Oe]),jr=(0,$.useCallback)(async(e,t)=>{H(null);let n=await u({environmentId:e,enabled:t});if(n._tag===`Failure`&&!ke(n)){let e=je(n),r=e instanceof Error?e.message:`Failed to switch the backend ${t?`on`:`off`}.`;H(r),q.add(ht({type:`error`,title:`Could not switch backend ${t?`on`:`off`}`,description:r}))}},[u]),Nr=(0,$.useCallback)(async e=>{let t=e.environmentId;Re(t),H(null);let n=await s(t);if(Re(null),n._tag===`Failure`&&!ke(n)){let e=je(n),t=e instanceof Error?e.message:`Failed to remove backend.`;H(t),q.add(ht({type:`error`,title:`Could not remove backend`,description:t}))}},[s]),[Fr,Ir]=(0,$.useState)(null),Lr=(0,$.useCallback)(async e=>{if(e.relayManaged&&Pe()){Ir(e);return}await dt(`Remove ${e.label} from this device?\nThis forgets its pairing, credentials, and cached threads here. Switch it off instead to keep it saved.`,{variant:`destructive`})===!0&&await Nr(e)},[Nr]),Rr=ar,zr=(0,$.useMemo)(()=>Qn.find(Ci)??null,[Qn]),Vr=(0,$.useMemo)(()=>Z?Qn.filter(e=>!Ci(e)):[],[Qn,Z]),Hr=(0,$.useMemo)(()=>zr?[...Vr,zr]:Vr,[zr,Vr]),Ur=(0,$.useMemo)(()=>Si(Vr,Qt),[Qt,Vr]),Wr=(0,$.useMemo)(()=>Ur??Si(zr?[zr]:[],Qt),[Qt,Ur,zr]),Gr=Wr?wi(Wr):null,Kr=(0,$.useCallback)(e=>{en(wi(e))},[en]),Xr=(0,$.useCallback)(e=>{let t=di(e);if(t){_e(t.host),ye(t.pairingCode);return}_e(e)},[]),Zr=e=>{let t=R===e.mode;return(0,Q.jsxs)(`button`,{type:`button`,"aria-pressed":t,className:ge(`group flex min-h-24 items-start gap-3 rounded-lg border p-4 text-left`,t?`border-primary/50 bg-primary/5`:`border-border/60 hover:bg-muted/40`),disabled:U,onClick:()=>{pe(e.mode)},children:[e.icon?(0,Q.jsx)(`span`,{className:ge(`mt-0.5 flex size-8 shrink-0 items-center justify-center rounded-md border`,t?`border-primary/30 bg-primary/10 text-primary`:`border-border/70 bg-background text-muted-foreground group-hover:text-foreground`),children:e.icon}):null,(0,Q.jsxs)(`span`,{className:`min-w-0`,children:[(0,Q.jsx)(`span`,{className:`block text-sm font-medium text-foreground`,children:e.title}),(0,Q.jsx)(`span`,{className:`mt-1 block text-xs leading-relaxed text-muted-foreground`,children:e.description})]})]})},Qr=()=>(0,Q.jsxs)(`div`,{className:`space-y-3`,children:[(0,Q.jsxs)(`div`,{className:`grid gap-3 sm:grid-cols-[minmax(0,1fr)_10rem]`,children:[(0,Q.jsxs)(`label`,{className:`block`,children:[(0,Q.jsx)(`span`,{className:`mb-1.5 block text-xs font-medium text-foreground`,children:`Host`}),(0,Q.jsx)(Et,{value:he,onChange:e=>Xr(e.target.value),placeholder:`backend.example.com`,disabled:U,spellCheck:!1})]}),(0,Q.jsxs)(`label`,{className:`block`,children:[(0,Q.jsx)(`span`,{className:`mb-1.5 block text-xs font-medium text-foreground`,children:`Pairing code`}),(0,Q.jsx)(Et,{value:ve,onChange:e=>ye(e.target.value),placeholder:`PAIRCODE`,disabled:U,spellCheck:!1})]})]}),(0,Q.jsx)(`div`,{children:(0,Q.jsx)(`span`,{className:`mt-1 block text-2xs text-muted-foreground`,children:`Paste a full pairing URL here to fill both fields automatically.`})})]}),$r=L!==null&&!L.relayManaged&&l.environments.has(L.environmentId)?l.environments.get(L.environmentId).environment:null,oi=async()=>{if($r===null||L===null)return;W(!0);let e=await c(new Fe({target:new De({environmentId:$r.environmentId,label:L.label})}));if(W(!1),e._tag===`Failure`){if(!ke(e)){let t=je(e);H(t instanceof Error?t.message:`Could not add the route.`)}return}le(!1),q.add({type:`success`,title:`Route added`,description:`${L.label} falls back to P4 Connect when its other routes are unreachable.`})},si=()=>(0,Q.jsxs)(`div`,{className:`space-y-4`,children:[$r===null?null:(0,Q.jsxs)(`div`,{className:`flex items-center justify-between gap-3 rounded-md border border-border px-3 py-2`,children:[(0,Q.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:`This machine is on your P4 Connect account. Use it as a fallback route.`}),(0,Q.jsx)(z,{size:`xs`,variant:`outline`,disabled:U,onClick:()=>void oi(),children:`Add P4 Connect`})]}),Qr(),Ne?(0,Q.jsx)(`p`,{className:`text-xs text-destructive`,children:Ne}):null,(0,Q.jsxs)(z,{variant:`outline`,className:`w-full`,disabled:U,onClick:()=>void Er(),children:[(0,Q.jsx)(S,{className:`size-3.5`}),U?`Adding…`:L?`Add route`:`Add environment`]})]}),ci=()=>(0,Q.jsx)(`div`,{className:`space-y-4`,children:(0,Q.jsxs)(`div`,{className:`space-y-3`,children:[(0,Q.jsxs)(`div`,{className:`block`,children:[(0,Q.jsx)(`label`,{htmlFor:`saved-backend-ssh-host`,className:`mb-1.5 block text-xs font-medium text-foreground`,children:`SSH host or alias`}),(0,Q.jsxs)(xt,{items:Hn,itemToStringValue:e=>e.alias,mode:`none`,openOnInputClick:!0,open:Oe,onOpenChange:Ae,onItemHighlighted:e=>{Me.current=e},value:B,onValueChange:(e,t)=>{if(Se(e),t.reason!==`item-press`)return;let n=Hn.find(t=>t.alias===e);n&&kr(n)},children:[(0,Q.jsx)(Ct,{id:`saved-backend-ssh-host`,onKeyDown:Ar,placeholder:`Search hosts or type devbox`,disabled:U,spellCheck:!1}),Jn?(0,Q.jsx)(wt,{children:Wn?(0,Q.jsx)(`div`,{className:`px-3 py-2 text-xs text-muted-foreground`,children:`Loading hosts…`}):Hn.length>0?(0,Q.jsx)(bt,{className:`max-h-72`,children:Hn.map((e,n)=>{let r=br(e),i=n<9?Wt(n):null,a=i?qt(t,i,navigator.platform):null;return(0,Q.jsxs)(Tt,{value:e,className:`h-8 min-h-8 whitespace-nowrap`,children:[(0,Q.jsx)(`span`,{className:`min-w-0 truncate text-sm font-medium`,children:e.alias}),r===e.alias?(0,Q.jsx)(`span`,{className:`flex-1`}):(0,Q.jsx)(`span`,{className:`min-w-0 flex-1 truncate text-xs text-muted-foreground`,children:r}),a?(0,Q.jsx)(St,{className:`shrink-0`,children:a}):null]},`${e.alias}:${e.hostname}:${e.port??``}`)})}):(0,Q.jsxs)(yt,{className:`break-all`,children:[`No hosts match "`,B.trim(),`".`]})}):null]})]}),(0,Q.jsxs)(`div`,{className:`grid gap-3 sm:grid-cols-[minmax(0,1fr)_7rem]`,children:[(0,Q.jsxs)(`label`,{className:`block`,children:[(0,Q.jsx)(`span`,{className:`mb-1.5 block text-xs font-medium text-foreground`,children:`Username`}),(0,Q.jsx)(Et,{value:V,onChange:e=>we(e.target.value),onKeyDown:Or,placeholder:`root`,disabled:U,spellCheck:!1})]}),(0,Q.jsxs)(`label`,{className:`block`,children:[(0,Q.jsx)(`span`,{className:`mb-1.5 block text-xs font-medium text-foreground`,children:`Port`}),(0,Q.jsx)(Et,{value:Te,onChange:e=>Ee(e.target.value),onKeyDown:Or,placeholder:`22`,inputMode:`numeric`,disabled:U,spellCheck:!1})]})]}),Ne||Gn?(0,Q.jsx)(hn,{variant:`error`,children:(0,Q.jsx)(mn,{children:Ne??Gn})}):null,(0,Q.jsxs)(z,{variant:`outline`,className:`w-full`,disabled:U,onClick:()=>void Er(),children:[(0,Q.jsx)(S,{className:`size-3.5`}),U?`Adding…`:L?`Add route`:`Add environment`]})]})}),li=()=>(0,Q.jsx)(Fn,{checked:Yn?.mode===`network-accessible`,disabled:!Yn||ze,onCheckedChange:e=>{Vt(e?`network-accessible`:`local-only`),Ue(!0)},"aria-label":`Enable network access`}),mi=e=>Xt?Vr.map(t=>{let n=wi(t);return(0,Q.jsx)(Ni,{endpoint:t,isDefault:n===Gr,presentation:e,onSetDefault:Kr,onSetupTailscaleServe:vr,onDisableTailscaleServe:xr,isUpdatingTailscaleServe:G},t.id)}):null,gi=(0,$.useCallback)(async t=>{if(e&&p!==null&&st(p,`environment:maintain`)){at(!0),ft(null);try{await t(),Vn()}catch(e){let t=e instanceof Error?e.message:`Failed to update WSL backend.`;ft(t),q.add(ht({type:`error`,title:`Could not change WSL backend`,description:t})),Vn()}finally{at(!1)}}},[e,p]),Ti=(0,$.useCallback)(()=>{ft(null),Vn()},[]),Ei=(0,$.useMemo)(()=>n.some(e=>He(e.entry.target)),[n]),Di=(0,$.useCallback)(t=>{if(!e||!X)return;let n=X.distros.find(e=>e.isDefault)?.name??null;if(t===ai){if(!X.enabled&&!X.wslOnly)return;let t=X.wslOnly;if(Ei||t){pt({kind:`disable`,wasWslOnly:t});return}gi(()=>e.setWslBackendEnabled(!1));return}let r=t===ii?null:t,i=r??n;if(!X.enabled){pt({kind:`enable`,nextDistro:r});return}if((X.distro??n)!==i){if(Ei||X.wslOnly){pt({kind:`distro`,nextDistro:r});return}gi(()=>e.setWslDistro(r))}},[gi,e,X,Ei]),Oi=(0,$.useCallback)(t=>{if(!e||!Y||Y.kind!==`enable`)return;let n=Y.nextDistro;pt(null);let r=X?.distro??null;gi(()=>jn({bridge:e,mode:t,nextDistro:n,persistedDistro:r}))},[gi,e,X,Y]),ki=(0,$.useCallback)(t=>{e&&X&&X.wslOnly!==t&&pt({kind:`wsl-only`,nextValue:t})},[e,X]),Ai=(0,$.useCallback)(()=>{if(!e||!Y)return;let t=Y;if(t.kind!==`enable`){if(pt(null),t.kind===`disable`){gi(async()=>{let n=await e.setWslBackendEnabled(!1);return t.wasWslOnly?await e.setWslOnly(!1):n});return}if(t.kind===`distro`){gi(()=>e.setWslDistro(t.nextDistro));return}gi(()=>e.setWslOnly(t.nextValue))}},[gi,e,Y]),Fi=()=>{if(!X)return Nn({state:null,error:xn})&&sn?(0,Q.jsx)(gn,{...$n(`wsl-backend`),description:`Couldn't load the WSL backend state.`,status:(0,Q.jsx)(`span`,{className:`block text-destructive`,children:xn}),control:(0,Q.jsx)(z,{size:`sm`,variant:`outline`,onClick:Ti,disabled:kn,children:kn?`Retrying…`:`Retry`})}):null;if(!Nn({state:X,error:xn}))return null;if(!X.available)return(0,Q.jsx)(gn,{...$n(`wsl-backend`),description:`WSL is unavailable, so Windows is running instead. Turn WSL off to clear this preference.`,status:xn?(0,Q.jsx)(`span`,{className:`block text-destructive`,children:xn}):null,control:(0,Q.jsx)(z,{size:`sm`,variant:`outline`,disabled:J,onClick:()=>Di(ai),children:`Switch to Windows`})});let e=X.distros.find(e=>e.isDefault)?.name??null,t=X.enabled?X.distro??e??ii:ai,n=t===ai?`Off`:t===ii?`Default distro`:t;return(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(gn,{...$n(`wsl-backend`),description:`Run the selected WSL distro alongside Windows. Projects remain on their current filesystem.`,status:xn?(0,Q.jsx)(`span`,{className:`block text-destructive`,children:xn}):X.preflightError?(0,Q.jsxs)(`span`,{className:`block text-destructive`,children:[`WSL backend couldn't start: `,X.preflightError]}):null,control:(0,Q.jsxs)(Je,{value:t,onValueChange:e=>{typeof e==`string`&&Di(e)},children:[(0,Q.jsx)(qe,{size:`sm`,className:`w-full sm:w-56`,"aria-label":`WSL backend`,disabled:J,children:(0,Q.jsx)(Ge,{children:n})}),(0,Q.jsxs)(Ke,{align:`end`,alignItemWithTrigger:!1,children:[(0,Q.jsx)(We,{hideIndicator:!0,value:ai,children:`Off`}),X.distros.length===0?(0,Q.jsx)(We,{hideIndicator:!0,value:ii,children:`Default distro`}):X.distros.map(e=>(0,Q.jsxs)(We,{hideIndicator:!0,value:e.name,children:[e.name,e.isDefault?` (default)`:``]},e.name))]})]})}),X.enabled?(0,Q.jsx)(gn,{title:`WSL only`,description:`Run only the WSL backend. P4 Code restarts when this changes.`,className:`bg-muted/20 pl-7 sm:pl-8`,control:(0,Q.jsx)(Fn,{checked:X.wslOnly,disabled:J,onCheckedChange:e=>ki(e),"aria-label":`Run WSL only`})}):null]})},Li=()=>(0,Q.jsx)(gn,{title:$n(`tailscale-https`).title,description:zr?zr.status===`available`?zr.httpBaseUrl:`Use Tailscale Serve to expose this backend through a MagicDNS HTTPS URL.`:`Start Tailscale to set up HTTPS access through MagicDNS.`,control:zr?(0,Q.jsx)(Fn,{checked:zr.status===`available`,disabled:G,onCheckedChange:e=>{if(e){vr(zr);return}xr(zr)},"aria-label":`Enable Tailscale HTTPS`}):null}),Ri=e=>(0,Q.jsxs)(Q.Fragment,{children:[rr?(0,Q.jsx)(`div`,{className:hi(e),children:(0,Q.jsx)(`p`,{className:`text-xs text-destructive`,children:rr})}):null,(0,Q.jsx)(Mi,{endpointUrl:Yn?.endpointUrl,endpoints:Hr,defaultEndpointKey:Gr,presentation:e,isLoading:ir,pairingLinks:Rr,createdPairingCredentials:j,clientSessions:or,revokingPairingLinkId:te,revokingClientSessionId:ie,onRevokePairingLink:Sr,onRevokeClientSession:Cr,canRevoke:nn})]}),zi=()=>(0,Q.jsx)(gn,{title:$n(`network-access`).title,description:Z?(0,Q.jsx)(Pi,{endpoint:Ur,hiddenEndpointCount:Math.max(Vr.length-1,0),expanded:Xt,onToggleExpanded:()=>Zt(e=>!e),fallback:Yn?.endpointUrl?`Reachable at ${Yn.endpointUrl}`:Yn?.advertisedHost?`Exposed on all interfaces. Pairing links use ${Yn.advertisedHost}.`:`Exposed on all interfaces.`}):Yn?`Limited to this machine.`:`Loading…`,status:nr?(0,Q.jsx)(`span`,{className:`block text-destructive`,children:nr}):null,control:li()}),Bi=()=>(0,Q.jsx)(gn,{title:$n(`network-access`).title,description:e?`This connection cannot view or change network exposure.`:_===`remote-reachable`?`Remote access is already configured. Change network exposure where the server starts.`:_===`loopback-browser`?`Only this machine can connect. Restart with a non-loopback host for remote pairing.`:`Network exposure information is unavailable.`,control:!e&&(_===`remote-reachable`||_===`loopback-browser`)?(0,Q.jsxs)(Qe,{children:[(0,Q.jsx)(Xe,{render:(0,Q.jsx)(`span`,{className:`inline-flex`,children:(0,Q.jsx)(Fn,{checked:Z,disabled:!0,"aria-label":`Enable network access`})})}),(0,Q.jsx)(Ze,{side:`top`,children:`Network exposure changes restart the backend and must be controlled where the server process is launched.`})]}):void 0}),Vi=(0,Q.jsx)(Q.Fragment,{children:p===null?(0,Q.jsxs)(vn,{...$n(`connections-environment`),children:[(0,Q.jsx)(gn,{title:`No environment selected`,description:`Connect an environment to view its settings and access.`}),(0,Q.jsx)(fr,{}),rn||on?(0,Q.jsx)(qi,{canReadRelay:rn,canManageRelay:on}):null]}):(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsxs)(vn,{...$n(`connections-environment`),title:r?.label??(e?`This machine`:`Primary environment`),icon:(0,Q.jsx)(fn,{"aria-hidden":!0,kind:Ht?Ce(Ht):`desktop`,className:`size-4`}),headerAction:p===null?null:(0,Q.jsxs)(f,{children:[(0,Q.jsx)(fe,{render:(0,Q.jsx)(z,{type:`button`,variant:`ghost-muted`,size:`icon-xs`,"aria-label":`More actions for this machine`}),children:(0,Q.jsx)(d,{className:`size-3.5`})}),(0,Q.jsx)(P,{align:`end`,children:(0,Q.jsx)(hr,{environmentId:p,serverConfig:Ht})})]}),children:[(0,Q.jsx)(fr,{}),sn?(0,Q.jsx)(gn,{title:`Version`,description:Yt.status===`idle`?[Ht?.environment.serverVersion??null,r?.displayUrl??null].filter(e=>e!==null).join(` · `)||`Loading…`:(0,Q.jsx)(Xn,{state:Yt}),control:Jt&&p!==null&&Yt.status!==`running`?(0,Q.jsx)(Zn,{size:`sm`,environmentId:p,serverLabel:r?`${r.label} server`:`server`,selfUpdate:On(Ht),installation:Ht?.environment.capabilities.serverInstallation,desktopAppUpdate:Rn(Ht),threadContinuation:tr(Ht),targetVersion:Jt.clientVersion,label:Yt.status===`failed`?`Retry update`:`Update to ${Jt.clientVersion}`}):Yt.status===`idle`&&Ht?(0,Q.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:`Up to date`}):void 0}):null,sn&&e?(0,Q.jsxs)(Q.Fragment,{children:[zi(),mi(`endpoint-rail`),Li(),Fi(),rn||on?(0,Q.jsx)(qi,{canReadRelay:rn,canManageRelay:on}):null]}):sn?(0,Q.jsxs)(Q.Fragment,{children:[Bi(),rn||on?(0,Q.jsx)(qi,{canReadRelay:rn,canManageRelay:on}):null]}):null,r?(0,Q.jsxs)(`details`,{className:`group px-3 sm:px-4`,children:[(0,Q.jsxs)(`summary`,{className:`flex min-h-11 cursor-pointer list-none items-center gap-2 rounded-md text-sm font-medium outline-none focus-visible:ring-2 focus-visible:ring-inset focus-visible:ring-ring [&::-webkit-details-marker]:hidden`,children:[`Permissions`,(0,Q.jsx)(be,{"aria-hidden":!0,className:`size-3 text-muted-foreground group-open:rotate-90`})]}),(0,Q.jsx)(lr,{environmentId:r.environmentId,connected:r.connection.phase===`connected`})]}):null]}),tn||nn?(0,Q.jsx)(sr,{id:`authorized-clients`,title:`Authorized clients`,summary:vi(or,Rr),control:nn?(0,Q.jsx)(ji,{delegatableScopes:h??[],onPairingLinkCreated:F,clientSessions:tn&&cn.error===null&&cn.data?.type===`snapshot`?or:null,isRevokingOtherClients:se,onRevokeOtherClients:wr}):void 0,children:(0,Q.jsx)(Dt,{scrollFade:!0,chainVerticalScroll:!0,className:`max-h-[22.5rem]`,"data-testid":`authorized-clients-scroll-area`,children:tn?Ri(`current`):(0,Q.jsx)(`p`,{className:`px-4 py-3 text-xs text-muted-foreground`,children:`This connection can create access links but cannot view authorized clients.`})})}):null,(0,Q.jsx)(Dn,{open:Ve&&sn,onOpenChange:e=>{ze||Ue(e)},onOpenChangeComplete:e=>{e||Vt(null)},children:(0,Q.jsxs)(An,{children:[(0,Q.jsxs)(Bn,{children:[(0,Q.jsx)(Mn,{children:Bt===`network-accessible`?`Enable network access?`:`Disable network access?`}),(0,Q.jsx)(In,{children:Bt===`network-accessible`?`Let your other devices connect to P4 Code over the network. Pair devices to give them access. P4 Code will restart.`:`Devices connected over your local network will disconnect. Existing tunnels, such as P4 Connect or Tailscale HTTPS, keep working. P4 Code will restart.`})]}),(0,Q.jsxs)(Ln,{children:[(0,Q.jsx)(er,{disabled:ze,render:(0,Q.jsx)(z,{variant:`outline`,disabled:ze}),children:(0,Q.jsx)(`span`,{className:`[text-box:trim-both_cap_alphabetic]`,children:`Cancel`})}),(0,Q.jsxs)(z,{variant:`default`,onClick:gr,disabled:!sn||Bt===null||ze,children:[ze&&(0,Q.jsx)(K,{size:`sm`}),(0,Q.jsx)(`span`,{className:`[text-box:trim-both_cap_alphabetic]`,children:ze?`Restarting…`:Bt===`network-accessible`?`Restart and enable`:`Restart and disable`})]})]})]})}),(0,Q.jsx)(Dn,{open:mt&&sn,onOpenChange:e=>{J||e||pt(null)},children:(0,Q.jsxs)(An,{children:[(0,Q.jsxs)(Bn,{children:[(0,Q.jsx)(Mn,{children:Y?.kind===`disable`?Y.wasWslOnly?`Turn off WSL and switch back to Windows?`:`Disable WSL backend?`:Y?.kind===`distro`?`Switch WSL distro?`:Y?.kind===`enable`?`Start the WSL backend`:Y?.nextValue?`Run only the WSL backend?`:`Re-enable the Windows backend?`}),(0,Q.jsx)(In,{children:Y?.kind===`disable`?Y.wasWslOnly?`P4 Code will restart on the Windows backend. Threads and projects opened against WSL stay safe inside the distro and become available again when you re-enable WSL.`:`The WSL backend will stop. Threads and projects opened against WSL stay safe inside the distro, but they'll be unavailable in P4 Code until you re-enable WSL.`:Y?.kind===`distro`?`P4 Code will restart the WSL backend on the new distro. Sessions still running on the current distro will be interrupted.`:Y?.kind===`enable`?`Run the WSL backend alongside the Windows one, or stop the Windows backend and use only WSL? You can change this later from Settings.`:Y?.nextValue?`P4 Code will restart and start only the WSL backend. Your Windows-side projects won't be accessible until you turn this off again.`:`P4 Code will restart and bring the Windows backend back up alongside WSL.`})]}),(0,Q.jsxs)(Ln,{children:[(0,Q.jsx)(er,{disabled:J,render:(0,Q.jsx)(z,{variant:`outline`,disabled:J}),children:`Cancel`}),Y?.kind===`enable`?(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(z,{variant:`outline`,onClick:()=>Oi(`wsl-only`),disabled:J||!sn,children:J?(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(K,{size:`sm`}),`Applying…`]}):`Use only WSL`}),(0,Q.jsx)(z,{variant:`default`,onClick:()=>Oi(`both`),disabled:J||!sn,children:J?(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(K,{size:`sm`}),`Applying…`]}):`Run both backends`})]}):(0,Q.jsx)(z,{variant:Y?.kind===`disable`||Y?.kind===`wsl-only`&&Y.nextValue?`destructive`:`default`,onClick:Ai,disabled:J||!sn,children:J?(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(K,{size:`sm`}),`Applying…`]}):Y?.kind===`disable`?Y.wasWslOnly?`Switch to Windows`:`Disable WSL`:Y?.kind===`distro`?`Switch distro`:Y?.nextValue?`Restart and enable`:`Restart and disable`})]})]})}),(0,Q.jsx)(Dn,{open:vt&&sn,onOpenChange:e=>{G||Lt(e)},children:(0,Q.jsxs)(An,{children:[(0,Q.jsxs)(Bn,{children:[(0,Q.jsx)(Mn,{children:`Disable Tailscale HTTPS?`}),(0,Q.jsx)(In,{children:`P4 Code will restart the local backend without Tailscale Serve.`})]}),(0,Q.jsxs)(Ln,{children:[(0,Q.jsx)(er,{disabled:G,render:(0,Q.jsx)(z,{variant:`outline`,disabled:G}),children:`Cancel`}),(0,Q.jsx)(z,{variant:`destructive`,onClick:()=>void yr(),disabled:G||!sn,children:G?(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(K,{size:`sm`}),`Restarting…`]}):`Restart and disable`})]})]})}),(0,Q.jsx)(It,{open:gt!==null,onOpenChange:e=>{G||e||_t(null)},children:(0,Q.jsxs)(Ft,{className:`max-w-md`,children:[(0,Q.jsxs)(Ot,{children:[(0,Q.jsx)(kt,{children:`Set up Tailscale HTTPS?`}),(0,Q.jsx)(Pt,{children:`P4 Code will restart the local backend with Tailscale Serve enabled and ask Tailscale to proxy HTTPS traffic to this backend.`})]}),(0,Q.jsxs)(Nt,{children:[(0,Q.jsxs)(`label`,{className:`block`,children:[(0,Q.jsx)(`span`,{className:`text-sm font-medium text-foreground`,children:`HTTPS port`}),(0,Q.jsx)(Et,{className:`mt-2`,type:`number`,inputMode:`numeric`,min:1,max:65535,step:1,value:Rt,onChange:e=>zt(e.target.value),disabled:G})]}),dr?null:(0,Q.jsx)(`p`,{className:`mt-2 text-xs text-destructive`,children:`Enter a port from 1 to 65535.`}),(0,Q.jsxs)(`div`,{className:`rounded-md border border-border/70 bg-muted/20 px-3 py-2`,children:[(0,Q.jsx)(`p`,{className:`text-xs font-medium text-muted-foreground`,children:`HTTPS endpoint`}),(0,Q.jsxs)(Qe,{children:[(0,Q.jsx)(Xe,{render:(0,Q.jsx)(`p`,{className:`mt-1 truncate text-sm text-foreground`,children:pr??`Pending MagicDNS endpoint`})}),pr?(0,Q.jsx)(Ze,{side:`top`,children:pr}):null]})]})]}),(0,Q.jsxs)(At,{children:[(0,Q.jsx)(Mt,{disabled:G,render:(0,Q.jsx)(z,{variant:`outline`,disabled:G}),children:`Cancel`}),(0,Q.jsx)(z,{onClick:()=>void _r(),disabled:G||!dr,children:G?(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(K,{size:`sm`}),`Restarting…`]}):`Enable`})]})]})})]})});return(0,Q.jsxs)(_n,{children:[Vi,(0,Q.jsxs)(vn,{...$n(`remote-environments`),title:`Environments`,headerAction:(0,Q.jsxs)(`div`,{className:`flex items-center gap-1`,children:[C.length>0?(0,Q.jsx)(qn,{targets:C,variant:`ghost-muted`}):null,(0,Q.jsxs)(It,{open:I,onOpenChange:e=>{le(e),e?de(null):H(null)},children:[(0,Q.jsxs)(Qe,{children:[(0,Q.jsx)(Xe,{render:(0,Q.jsx)(jt,{render:(0,Q.jsxs)(z,{size:`xs`,variant:`ghost-muted`,"aria-label":`Add environment`,children:[(0,Q.jsx)(S,{className:`size-3`}),(0,Q.jsx)(`span`,{children:`Add environment`})]})})}),(0,Q.jsx)(Ze,{side:`top`,children:`Add environment`})]}),(0,Q.jsxs)(Ft,{className:`max-h-[80dvh] sm:max-w-3xl`,children:[(0,Q.jsxs)(Ot,{children:[(0,Q.jsx)(kt,{children:L?`Add a route to ${L.label}`:`Add Environment`}),(0,Q.jsx)(Pt,{children:L?`Pair this machine again over another address, such as its Tailscale name. It joins the existing routes instead of adding a second machine.`:`Pair another environment to this client.`})]}),(0,Q.jsx)(Nt,{children:(0,Q.jsxs)(`div`,{className:`space-y-4`,children:[(0,Q.jsxs)(`div`,{className:`grid gap-3 sm:grid-cols-2`,children:[Zr({mode:`remote`,title:`Remote link`,description:`Enter a backend host and pairing code.`,icon:(0,Q.jsx)(re,{"aria-hidden":!0,className:`size-4`})}),e?Zr({mode:`ssh`,title:`SSH`,description:`Use local SSH config, agent, and tunnels for the backend.`,icon:(0,Q.jsx)(ee,{"aria-hidden":!0,className:`size-4`})}):null]}),(0,Q.jsx)(Ut,{children:R===`ssh`?ci():si()})]})})]})]})]}),children:[y.map(e=>(0,Q.jsx)(Ii,{environment:e,removingEnvironmentId:Le,onSetEnabled:jr,onRemove:Lr,onAddRoute:e=>{de(e),H(null),le(!0)}},e.environmentId)),(0,Q.jsx)(Yi,{primaryEnvironmentId:p,savedEnvironments:v})]}),Pe()?(0,Q.jsx)(Pr,{environmentLabel:Fr?.label??null,onCancel:()=>Ir(null),onConfirm:()=>{Fr&&(Ir(null),Nr(Fr))}}):null,(0,Q.jsx)(Dr,{environments:w}),(0,Q.jsx)(Mr,{environments:w})]})}function Zi(e){let{kind:t}=e;q.add({type:`success`,title:t===`hosted-link`?`Hosted app link copied`:t===`link`?`Pairing URL copied`:`Pairing code copied`,description:t===`hosted-link`?`Open it in the browser on the device you want to connect.`:t===`link`?`Open it in the client you want to pair to this environment.`:`Paste it into another client to finish pairing.`})}function Qi(e){return Di(e)?`hosted-link`:`link`}function $i(e){return!e}function ea(e){return e.currentTarget.select()}function ta(e){return e.currentTarget.select()}function na(e){return e!==null}var ra=Xi;export{ra as component};
|
|
2
|
-
//# sourceMappingURL=settings.connections-
|
|
1
|
+
import{i as e}from"./rolldown-runtime-Dd_uD5pT.js";import{r as t}from"./Icon-l19w4AjM.js";import{$b as n,$n as r,$o as i,BT as a,By as o,C_ as s,Cy as c,D_ as l,E_ as u,Gd as d,Gn as f,Go as p,Gp as m,Hg as h,IT as g,Kg as _,LT as v,Lc as y,NE as b,NT as x,Pp as S,Qn as C,Qo as w,Rp as T,S_ as E,T_ as D,Tf as O,Ub as k,Um as A,YS as j,Yn as M,Yo as N,Zn as P,__ as F,_m as ee,ar as te,b_ as ne,bd as re,cr as ie,f_ as ae,ir as oe,is as se,j_ as ce,jx as I,lE as le,l_ as ue,lv as L,m_ as de,or as fe,p_ as R,rr as pe,s_ as me,sr as z,ss as he,t as ge,tr as _e,u_ as ve,v_ as ye,vd as be,w_ as B,x_ as xe,y_ as Se,yl as Ce}from"./utils-Dx_TSvdC.js";import{Dt as V,Et as we,F as Te,Ht as Ee,On as De,Ot as Oe,R as ke,Ut as Ae,W as je,jt as Me,kt as Ne,o as Pe,on as Fe,tt as H,w as Ie,x as U}from"./runtime-D102A-Bu.js";import{E as W,Et as Le,F as Re,S as ze,St as Be,Tt as Ve,_ as He,bt as Ue,t as G}from"./runtime-BjJBBHTp.js";import{a as We,c as Ge,o as Ke,s as qe,t as Je}from"./select-BUFUt6O3.js";import{t as K}from"./spinner-DYnZ-Bpa.js";import{i as q,p as Ye}from"./toast-SPJYfh08.js";import{a as Xe,n as Ze,t as Qe}from"./tooltip-Cco13jKX.js";import{a as $e,l as et,o as tt,s as J}from"./environments-CjU9SGCA.js";import{f as nt,h as rt,s as it}from"./server-DTGT8WWf.js";import{a as at,i as ot,n as st,s as ct}from"./session-Dh8maTO3.js";import{n as lt}from"./query-CRswjQ7f.js";import{t as ut}from"./use-atom-command-BHmF32aL.js";import{W as dt,b as ft,c as Y,s as pt,v as mt}from"./useSettings-DUgjfqYw.js";import{n as ht}from"./toastHelpers-Dsph6LwL.js";import{i as gt,r as _t}from"./timestampFormat-wac2e_Jz.js";import{t as vt}from"./textarea-Dt0w6mtc.js";import{_ as yt,b as bt,g as xt,h as St,v as Ct,x as wt,y as Tt}from"./command-D1peviZr.js";import{t as Et}from"./input-CF-egQtG.js";import{t as Dt}from"./scroll-area-OkcD8f0Y.js";import{a as Ot,c as kt,i as At,l as jt,n as Mt,o as Nt,r as Pt,s as Ft,t as It}from"./dialog-BfenC7sz.js";import{n as Lt}from"./T3ConnectAccountPages-8GTdhVAB.js";import{a as Rt,i as zt,o as Bt,r as Vt,t as Ht}from"./empty-xf3NEL4p.js";import{t as Ut}from"./AnimatedHeight-CzFc8xri.js";import{C as Wt,_ as Gt,w as Kt,y as qt}from"./keybindings-BlEA4Dlt.js";import{i as Jt,o as Yt,t as Xt}from"./popover-BunL7s_L.js";import{t as Zt}from"./checkbox-EHQPSidC.js";import{a as Qt,b as $t,c as en,h as tn,i as nn,l as rn,m as an,n as on,o as sn,p as cn,s as ln,t as un,u as dn}from"./sortable.esm-KZlxUbRj.js";import{n as fn,t as pn}from"./EnvironmentMachineIcon-Czk_PJpp.js";import{r as mn,t as hn}from"./alert-CvIEaZOb.js";import{a as gn,i as _n,s as vn,u as yn}from"./settingsLayout-BRcW18Dy.js";import{t as X}from"./ConnectionStatusDot-uWbIqk3l.js";import{a as bn,n as xn,o as Sn,s as Cn,t as wn}from"./primary-BI3yNRjI.js";import{n as Tn,t as En}from"./onboarding-DQxSrthd.js";import{Ar as Dn,Er as On,Fa as kn,Fr as An,Gn as jn,Ir as Mn,Jn as Nn,Kn as Pn,La as Fn,Mr as In,Nr as Ln,Or as Rn,Pa as zn,Pr as Bn,Qn as Vn,T as Hn,Tr as Un,Xn as Wn,Yn as Gn,Zn as Kn,_r as qn,an as Jn,ci as Yn,gr as Xn,hr as Zn,in as Qn,ir as $n,jr as er,kr as tr,mr as nr,nn as rr,on as ir,qn as ar,si as or}from"./main-C58_iQqs.js";import{t as sr}from"./FoldedSettingsSection-G9y7luve.js";var Z=b(),cr=[{scope:ye,title:`View environment`,description:`Read threads, status, checkpoints, and configuration.`},{scope:F,title:`Operate tasks`,description:`Start, update, and stop tasks.`},{scope:s,title:`Change environment settings`,description:`Edit environment preferences and keybindings.`},{scope:ne,title:`Manage providers`,description:`Configure, install, sign in to, and update providers and usage sources.`},{scope:ae,title:`Maintain environment`,description:`Update the server and control environment processes.`},{scope:Se,title:`Control previews`,description:`Open browser previews and host browser automation.`},{scope:ve,title:`View diagnostics and usage`,description:`Read process diagnostics, resource history, and usage totals.`},{scope:l,title:`View terminals`,description:`Read existing terminal output and status.`},{scope:u,title:`Use terminals`,description:`Create terminals and send input to running shells.`},{scope:B,title:`Change source control`,description:`Commit, push, manage branches and repositories, and change pull requests.`},{scope:R,title:`Read files`,description:`Browse host files, search workspaces, and inspect local changes.`},{scope:de,title:`Write files`,description:`Edit workspace files and save plans to disk.`},{scope:me,title:`View access`,description:`Inspect pairing links and authorized clients.`},{scope:ue,title:`Manage access`,description:`Issue and revoke credentials for other clients.`},{scope:xe,title:`View relay`,description:`Inspect managed relay connectivity.`},{scope:E,title:`Manage relay`,description:`Change managed tunnel connectivity.`}],Q=e(le(),1);function lr(e){let t=(0,Z.c)(4),{environmentId:n,connected:r,routeContext:i}=e,a=i!==void 0&&i,o=at(n),s;return t[0]!==r||t[1]!==a||t[2]!==o?(s=r&&!o.hasError&&!o.isPending&&o.data?.authenticated?(0,Q.jsxs)(`div`,{className:`space-y-3 py-3 text-xs`,children:[(0,Q.jsx)(`p`,{className:`text-muted-foreground`,children:a?`These permissions apply to your active route. Other routes may have different permissions.`:`These permissions apply to this client’s current connection.`}),(0,Q.jsx)(`ul`,{className:`grid gap-x-6 gap-y-2 sm:grid-cols-2`,children:cr.map(e=>{let{scope:t,title:n}=e;return(0,Q.jsxs)(`li`,{className:`flex items-start justify-between gap-3`,children:[(0,Q.jsx)(`span`,{children:n}),(0,Q.jsx)(`span`,{className:`shrink-0 text-muted-foreground`,children:ce(o.data,t)?`Allowed`:`Not granted`})]},t)})})]}):(0,Q.jsx)(`p`,{className:`py-3 text-xs text-muted-foreground`,children:`Permissions not checked. Connect to this environment to view this session’s permissions.`}),t[0]=r,t[1]=a,t[2]=o,t[3]=s):s=t[3],s}var $=e(t(),1);function ur(e,t){let n=new URL(e);return n.pathname=`/pair`,Le(n,t).toString()}function dr(e,t){return new URL(e).protocol===`https:`?ze({host:e,token:t}):null}function fr(){let e=(0,Z.c)(48),t=window.desktopBridge?.setLocalEnvironmentEnabled,[n]=(0,$.useState)(pr),[r,i]=(0,$.useState)(!1),[a,o]=(0,$.useState)(!1),[s,c]=(0,$.useState)(null);if(!t)return null;let l;e[0]===n?l=e[1]:(l=async()=>{o(!0),c(null);try{await t(!n)}catch(e){let t=e;c(t instanceof Error?t.message:`Couldn't change this setting.`),o(!1)}},e[0]=n,e[1]=l);let u=l,d;e[2]===Symbol.for(`react.memo_cache_sentinel`)?(d=$n(`local-environment`),e[2]=d):d=e[2];let f=n?`Run agents on this computer. Turn off to use P4 Code only with remote environments.`:`Turned off. Agents only run in remote environments.`,p;e[3]===Symbol.for(`react.memo_cache_sentinel`)?(p=()=>i(!0),e[3]=p):p=e[3];let m;e[4]!==n||e[5]!==a?(m=(0,Q.jsx)(Fn,{checked:n,disabled:a,onCheckedChange:p,"aria-label":`Local environment`}),e[4]=n,e[5]=a,e[6]=m):m=e[6];let h;e[7]!==f||e[8]!==m?(h=(0,Q.jsx)(gn,{...d,description:f,control:m}),e[7]=f,e[8]=m,e[9]=h):h=e[9];let g;e[10]===a?g=e[11]:(g=e=>{a||(i(e),e||c(null))},e[10]=a,e[11]=g);let _=n?`Turn off local environment?`:`Turn on local environment?`,v;e[12]===_?v=e[13]:(v=(0,Q.jsx)(Mn,{children:_}),e[12]=_,e[13]=v);let y=n?`P4 Code will restart without running a server on this computer. Any agents and terminals running here will stop, and other devices will no longer be able to connect to this computer. Your projects, history, and remote environments are unaffected.`:`P4 Code will restart and start running a server on this computer again.`,b;e[14]===y?b=e[15]:(b=(0,Q.jsx)(In,{children:y}),e[14]=y,e[15]=b);let x;e[16]!==b||e[17]!==v?(x=(0,Q.jsxs)(Bn,{children:[v,b]}),e[16]=b,e[17]=v,e[18]=x):x=e[18];let S;e[19]===s?S=e[20]:(S=s?(0,Q.jsx)(`p`,{className:`px-6 pb-4 text-sm text-destructive`,children:s}):null,e[19]=s,e[20]=S);let C;e[21]===Symbol.for(`react.memo_cache_sentinel`)?(C=(0,Q.jsx)(z,{variant:`outline`}),e[21]=C):C=e[21];let w;e[22]===a?w=e[23]:(w=(0,Q.jsx)(er,{disabled:a,render:C,children:`Cancel`}),e[22]=a,e[23]=w);let T=n?`destructive`:`default`,E;e[24]===u?E=e[25]:(E=()=>void u(),e[24]=u,e[25]=E);let D;e[26]!==n||e[27]!==a?(D=a?(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(K,{size:`sm`}),`Restarting…`]}):n?`Restart and turn off`:`Restart and turn on`,e[26]=n,e[27]=a,e[28]=D):D=e[28];let O;e[29]!==a||e[30]!==T||e[31]!==E||e[32]!==D?(O=(0,Q.jsx)(z,{variant:T,disabled:a,onClick:E,children:D}),e[29]=a,e[30]=T,e[31]=E,e[32]=D,e[33]=O):O=e[33];let k;e[34]!==w||e[35]!==O?(k=(0,Q.jsxs)(Ln,{children:[w,O]}),e[34]=w,e[35]=O,e[36]=k):k=e[36];let A;e[37]!==x||e[38]!==S||e[39]!==k?(A=(0,Q.jsxs)(An,{children:[x,S,k]}),e[37]=x,e[38]=S,e[39]=k,e[40]=A):A=e[40];let j;e[41]!==r||e[42]!==A||e[43]!==g?(j=(0,Q.jsx)(Dn,{open:r,onOpenChange:g,children:A}),e[41]=r,e[42]=A,e[43]=g,e[44]=j):j=e[44];let M;return e[45]!==j||e[46]!==h?(M=(0,Q.jsxs)(Q.Fragment,{children:[h,j]}),e[45]=j,e[46]=h,e[47]=M):M=e[47],M}function pr(){return!Ie()}function mr(e){return e.serverConfig===null?`Connect to this environment to change its icon.`:e.serverConfig.environment.capabilities.environmentIcon===!0?e.operateAccess===`granted`?null:`Your session on this environment cannot change its settings.`:`This environment's server is too old to keep an icon. Update it to choose one.`}function hr(e){let t=(0,Z.c)(27),{environmentId:n,serverConfig:i}=e,a=ft(n),o=ot(n,`settings:write`)?`granted`:`denied`,s;t[0]!==o||t[1]!==i?(s=mr({serverConfig:i,operateAccess:o}),t[0]=o,t[1]=i,t[2]=s):s=t[2];let c=s,l=i?.environment.platform.machine??`server`,u;t[3]===i?u=t[4]:(u=Ce(i),t[3]=i,t[4]=u);let d=u,f;t[5]===d?f=t[6]:(f=(0,Q.jsxs)(te,{children:[(0,Q.jsx)(fn,{kind:d}),`Icon`]}),t[5]=d,t[6]=f);let p;t[7]===c?p=t[8]:(p=c===null?null:(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(M,{disabled:!0,className:`whitespace-normal`,children:c}),(0,Q.jsx)(_e,{})]}),t[7]=c,t[8]=p);let m;t[9]!==l||t[10]!==c||t[11]!==a?(m=e=>{c===null&&_(e)&&a({environmentIcon:e===l?null:e})},t[9]=l,t[10]=c,t[11]=a,t[12]=m):m=t[12];let g;t[13]!==l||t[14]!==c||t[15]!==i?.environment?(g=h.map(e=>(0,Q.jsx)(r,{value:e,disabled:c!==null,children:(0,Q.jsxs)(`span`,{className:`flex min-w-0 items-center gap-2`,children:[(0,Q.jsx)(fn,{kind:e,className:`size-3.5 shrink-0`}),(0,Q.jsx)(`span`,{className:`min-w-0 flex-1 truncate`,children:pn[e]}),e===l?(0,Q.jsx)(`span`,{className:`shrink-0 text-xs text-muted-foreground`,children:i?.environment.platform.machine?`detected`:`default`}):null]})},e)),t[13]=l,t[14]=c,t[15]=i?.environment,t[16]=g):g=t[16];let v;t[17]!==d||t[18]!==m||t[19]!==g?(v=(0,Q.jsx)(C,{value:d,onValueChange:m,children:g}),t[17]=d,t[18]=m,t[19]=g,t[20]=v):v=t[20];let y;t[21]!==p||t[22]!==v?(y=(0,Q.jsxs)(oe,{children:[p,v]}),t[21]=p,t[22]=v,t[23]=y):y=t[23];let b;return t[24]!==f||t[25]!==y?(b=(0,Q.jsxs)(pe,{children:[f,y]}),t[24]=f,t[25]=y,t[26]=b):b=t[26],b}function gr(e){let t=(0,Z.c)(31),{environment:n,onAddRoute:r}=e,i=Ne(n.entry),a=i.map(vr),[o,s]=(0,$.useState)(null),c=o!==null&&o.length===a.length&&o.some((e,t)=>e!==a[t])?[...o]:a,l=new Map(i.map(_r)),u=c.flatMap(e=>l.get(e)??[]),d=ct(n.environmentId),f;t[0]!==n.connection||t[1]!==d._tag||t[2]!==d.value?(f=d._tag===`Some`&&n.connection.phase===`connected`?V(d.value.target):null,t[0]=n.connection,t[1]=d._tag,t[2]=d.value,t[3]=f):f=t[3];let p=f,m=ut(rt.reorderRoutes,`Reorder routes`),h=ut(rt.removeRoute,`Remove route`),g;t[4]===Symbol.for(`react.memo_cache_sentinel`)?(g={activationConstraint:{distance:4}},t[4]=g):g=t[4];let _;t[5]===Symbol.for(`react.memo_cache_sentinel`)?(_={coordinateGetter:nn},t[5]=_):_=t[5];let v=an(cn(rn,g),cn(en,_)),y;t[6]!==n.environmentId||t[7]!==h?(y=async e=>{let t=we(e);await dt(`Remove ${Oe(e)} route?${t===null?``:`\n${t}`}`,{variant:`destructive`})===!0&&await h({environmentId:n.environmentId,routeId:V(e.target)})},t[6]=n.environmentId,t[7]=h,t[8]=y):y=t[8];let b=y,x=e=>{if(e.over===null||e.active.id===e.over.id)return;let t=on(c,c.indexOf(String(e.active.id)),c.indexOf(String(e.over.id)));s(t),m({environmentId:n.environmentId,routeIds:t}).then(e=>{e._tag===`Failure`&&s(null)})},C=ln,w=dn,T;t[9]===Symbol.for(`react.memo_cache_sentinel`)?(T=[Yn,or],t[9]=T):T=t[9];let E=un,D=sn,O=`Routes to ${n.label}, preferred first`,k=u.map((e,t)=>(0,Q.jsx)(yr,{route:e,position:t+1,inUse:V(e.target)===p,removable:u.length>1&&!Me(e),onRemove:()=>void b(e)},V(e.target))),A;t[10]!==k||t[11]!==O?(A=(0,Q.jsx)(`ol`,{"aria-label":O,children:k}),t[10]=k,t[11]=O,t[12]=A):A=t[12];let j;t[13]!==E||t[14]!==c||t[15]!==A||t[16]!==D?(j=(0,Q.jsx)(E,{items:c,strategy:D,children:A}),t[13]=E,t[14]=c,t[15]=A,t[16]=D,t[17]=j):j=t[17];let M;t[18]!==C||t[19]!==x||t[20]!==v||t[21]!==j||t[22]!==w||t[23]!==T?(M=(0,Q.jsx)(C,{sensors:v,collisionDetection:w,modifiers:T,onDragEnd:x,children:j}),t[18]=C,t[19]=x,t[20]=v,t[21]=j,t[22]=w,t[23]=T,t[24]=M):M=t[24];let N;t[25]===Symbol.for(`react.memo_cache_sentinel`)?(N=(0,Q.jsx)(S,{className:`size-3`}),t[25]=N):N=t[25];let P;t[26]===r?P=t[27]:(P=(0,Q.jsx)(`div`,{className:`-ml-1.5 pt-1`,children:(0,Q.jsxs)(z,{size:`xs`,variant:`ghost-muted`,onClick:r,children:[N,`Add route`]})}),t[26]=r,t[27]=P);let F;return t[28]!==M||t[29]!==P?(F=(0,Q.jsxs)(`div`,{className:`mt-2 border-t border-border/50 py-2`,children:[M,P]}),t[28]=M,t[29]=P,t[30]=F):F=t[30],F}function _r(e){return[V(e.target),e]}function vr(e){return V(e.target)}function yr(e){let t=(0,Z.c)(43),{route:n,position:r,inUse:i,removable:a,onRemove:o}=e,s;t[0]===n.target?s=t[1]:(s=V(n.target),t[0]=n.target,t[1]=s);let c=s,l;t[2]===n?l=t[3]:(l=Oe(n),t[2]=n,t[3]=l);let u=l,d;t[4]===n?d=t[5]:(d=we(n),t[4]=n,t[5]=d);let f=d,p;t[6]===c?p=t[7]:(p={id:c},t[6]=c,t[7]=p);let{attributes:m,listeners:h,setNodeRef:g,setActivatorNodeRef:_,transform:v,transition:y,isDragging:b}=Qt(p),x;t[8]===v?x=t[9]:(x=tn.Translate.toString(v),t[8]=v,t[9]=x);let S;t[10]!==x||t[11]!==y?(S={transform:x,transition:y},t[10]=x,t[11]=y,t[12]=S):S=t[12];let C=b&&`relative z-10 rounded-md bg-background shadow-md`,w;t[13]===C?w=t[14]:(w=ge(`flex items-center gap-2 py-2`,C),t[13]=C,t[14]=w);let T;t[15]===i?T=t[16]:(T=i?(0,Q.jsx)(`span`,{className:`rounded-sm bg-success/12 px-1 text-2xs font-normal text-success-foreground`,children:`In use`}):null,t[15]=i,t[16]=T);let E;t[17]!==u||t[18]!==T?(E=(0,Q.jsxs)(`p`,{className:`flex items-center gap-1.5 text-xs font-medium text-foreground`,children:[u,T]}),t[17]=u,t[18]=T,t[19]=E):E=t[19];let D;t[20]!==f||t[21]!==n?(D=f===null?null:(0,Q.jsxs)(`p`,{className:`truncate text-2xs text-muted-foreground`,children:[f,Me(n)?` · found automatically`:``]}),t[20]=f,t[21]=n,t[22]=D):D=t[22];let k;t[23]!==E||t[24]!==D?(k=(0,Q.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[E,D]}),t[23]=E,t[24]=D,t[25]=k):k=t[25];let j=`Reorder ${u}, position ${r}`,M;t[26]===Symbol.for(`react.memo_cache_sentinel`)?(M=(0,Q.jsx)(O,{className:`size-3.5`}),t[26]=M):M=t[26];let N;t[27]!==m||t[28]!==h||t[29]!==_||t[30]!==j?(N=(0,Q.jsx)(`button`,{type:`button`,ref:_,...m,...h,"aria-label":j,className:`flex size-6 shrink-0 cursor-grab touch-none items-center justify-center rounded text-muted-foreground/70 outline-none hover:text-foreground focus-visible:ring-2 focus-visible:ring-inset focus-visible:ring-ring active:cursor-grabbing`,children:M}),t[27]=m,t[28]=h,t[29]=_,t[30]=j,t[31]=N):N=t[31];let P;t[32]!==u||t[33]!==o||t[34]!==a?(P=a?(0,Q.jsxs)(Qe,{children:[(0,Q.jsx)(Xe,{render:(0,Q.jsx)(z,{type:`button`,variant:`ghost-muted`,size:`icon-xs`,"aria-label":`Remove ${u} route`,onClick:o}),children:(0,Q.jsx)(A,{className:`size-3`})}),(0,Q.jsx)(Ze,{side:`top`,children:`Remove route`})]}):null,t[32]=u,t[33]=o,t[34]=a,t[35]=P):P=t[35];let F;return t[36]!==g||t[37]!==k||t[38]!==N||t[39]!==P||t[40]!==S||t[41]!==w?(F=(0,Q.jsxs)(`li`,{ref:g,style:S,className:w,children:[k,N,P]}),t[36]=g,t[37]=k,t[38]=N,t[39]=P,t[40]=S,t[41]=w,t[42]=F):F=t[42],F}function br(e){let t=e.username?`${e.username}@${e.hostname}`:e.hostname;return e.port?`${t}:${e.port}`:t}function xr(e,t=null){let{entry:n}=e;if(n.target._tag===`PrimaryConnectionTarget`)return`This machine`;let r=Ne(n);if(r.length>1){let e=t===null?void 0:r.find(e=>V(e.target)===V(t));return e===void 0?Oe(r[0]):`via ${Oe(e)}`}return e.relayManaged?`P4 Connect`:He(n.target)?`WSL`:n.target._tag===`SshConnectionTarget`&&v(n.profile)&&n.profile.value._tag===`SshConnectionProfile`?`SSH ${br(n.profile.value.target)}`:e.displayUrl??`Remote link`}function Sr(e){let t=(0,Z.c)(23),{kind:n,label:r,subtitle:i,below:a,detail:o,dimmed:s,className:c,children:l}=e,u=s!==void 0&&s&&`opacity-60`,d;t[0]!==c||t[1]!==u?(d=ge(`grid grid-cols-[auto_minmax(0,1fr)_auto] items-center gap-x-3 px-3 py-2.5 sm:px-4`,u,c),t[0]=c,t[1]=u,t[2]=d):d=t[2];let f;t[3]===n?f=t[4]:(f=(0,Q.jsx)(fn,{"aria-hidden":!0,kind:n,className:`size-4 text-muted-foreground`}),t[3]=n,t[4]=f);let p;t[5]===r?p=t[6]:(p=(0,Q.jsx)(`p`,{className:`truncate text-sm font-medium text-foreground`,children:r}),t[5]=r,t[6]=p);let m;t[7]===i?m=t[8]:(m=(0,Q.jsx)(`div`,{className:`truncate text-xs text-muted-foreground`,children:i}),t[7]=i,t[8]=m);let h;t[9]!==a||t[10]!==p||t[11]!==m?(h=(0,Q.jsxs)(`div`,{className:`min-w-0`,children:[p,m,a]}),t[9]=a,t[10]=p,t[11]=m,t[12]=h):h=t[12];let g;t[13]===l?g=t[14]:(g=(0,Q.jsx)(`div`,{className:`flex shrink-0 items-center gap-1`,children:l}),t[13]=l,t[14]=g);let _;t[15]===o?_=t[16]:(_=o?(0,Q.jsx)(`div`,{className:`col-span-2 col-start-2 min-w-0`,children:o}):null,t[15]=o,t[16]=_);let v;return t[17]!==d||t[18]!==f||t[19]!==h||t[20]!==g||t[21]!==_?(v=(0,Q.jsxs)(`div`,{className:d,children:[f,h,g,_]}),t[17]=d,t[18]=f,t[19]=h,t[20]=g,t[21]=_,t[22]=v):v=t[22],v}var Cr=[{value:100,label:`Prefer`},{value:50,label:`Normal`},{value:25,label:`Less often`},{value:0,label:`Manual only`}];function wr(e){return e===void 0||e===50?50:e===0?0:e<50?25:100}function Tr(e){return Cr.find(t=>t.value===e).label}function Er(e,t){let n=e.flatMap(e=>{let n=wr(t[e.environmentId]);return n===50?[]:[`${e.label} ${Tr(n).toLowerCase()}`]});return n.length===0?null:n.join(` · `)}function Dr(e){let t=(0,Z.c)(27),{environments:n}=e,r=pt(),i=Y(),a=mt();if(n.length<2)return null;let o;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(o=$n(`load-balancing`),t[0]=o):o=t[0];let{id:s,title:c}=o,l;t[1]!==n||t[2]!==r.loadBalancingEnabled||t[3]!==r.loadBalancingWeights?(l=r.loadBalancingEnabled?Er(n,r.loadBalancingWeights):`Off`,t[1]=n,t[2]=r.loadBalancingEnabled,t[3]=r.loadBalancingWeights,t[4]=l):l=t[4];let u=!i,d;t[5]===a?d=t[6]:(d=e=>a({loadBalancingEnabled:e}),t[5]=a,t[6]=d);let f;t[7]!==r.loadBalancingEnabled||t[8]!==u||t[9]!==d?(f=(0,Q.jsx)(Fn,{"aria-label":`Automatically balance load`,checked:r.loadBalancingEnabled,disabled:u,onCheckedChange:d}),t[7]=r.loadBalancingEnabled,t[8]=u,t[9]=d,t[10]=f):f=t[10];let p;t[11]===Symbol.for(`react.memo_cache_sentinel`)?(p=(0,Q.jsx)(`p`,{className:`px-3 py-2.5 text-xs text-muted-foreground sm:px-4`,children:`New threads in shared projects start on the machine with the most free CPU and memory, weighted by each machine's preference.`}),t[11]=p):p=t[11];let m;if(t[12]!==n||t[13]!==r.loadBalancingEnabled||t[14]!==r.loadBalancingWeights||t[15]!==i||t[16]!==a){let e;t[18]!==r.loadBalancingEnabled||t[19]!==r.loadBalancingWeights||t[20]!==i||t[21]!==a?(e=e=>(0,Q.jsx)(Sr,{kind:Ce(e.serverConfig),label:e.label,subtitle:xr(e),children:(0,Q.jsxs)(Je,{items:Cr,value:wr(r.loadBalancingWeights[e.environmentId]),disabled:!i||!r.loadBalancingEnabled,onValueChange:t=>{t!==null&&a({loadBalancingWeights:{...r.loadBalancingWeights,[e.environmentId]:t}})},children:[(0,Q.jsx)(qe,{size:`xs`,className:`w-32`,"aria-label":`${e.label} load preference`,children:(0,Q.jsx)(Ge,{})}),(0,Q.jsx)(Ke,{align:`end`,alignItemWithTrigger:!1,children:Cr.map(Or)})]})},e.environmentId),t[18]=r.loadBalancingEnabled,t[19]=r.loadBalancingWeights,t[20]=i,t[21]=a,t[22]=e):e=t[22],m=n.map(e),t[12]=n,t[13]=r.loadBalancingEnabled,t[14]=r.loadBalancingWeights,t[15]=i,t[16]=a,t[17]=m}else m=t[17];let h;return t[23]!==l||t[24]!==f||t[25]!==m?(h=(0,Q.jsxs)(sr,{id:s,title:c,summary:l,control:f,children:[p,m]}),t[23]=l,t[24]=f,t[25]=m,t[26]=h):h=t[26],h}function Or(e){let{value:t,label:n}=e;return(0,Q.jsx)(We,{value:t,children:n},t)}var kr=[{value:`off`,label:`Off`},{value:`read`,label:`Read PRs`},{value:`read-write`,label:`Read and act`}],Ar={"read-write":`read and act`,read:`read PRs`};function jr(e){let t=[`read-write`,`read`].flatMap(t=>{let n=e.filter(e=>e.permission===t);return n.length===0?[]:[`${n.map(e=>e.label).join(`, `)} ${Ar[t]}`]});return t.length===0?null:t.join(` · `)}function Mr(e){let t=(0,Z.c)(19),{environments:n}=e,r=N(rt.githubRoutingPermissionsValueAtom),i=N(rt.catalogValueAtom),a=ut(rt.setGitHubRoutingPermission),[o,s]=(0,$.useState)(!1);if(n.length<2)return null;let c;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(c=$n(`github-routing`),t[0]=c):c=t[0];let{id:l,title:u}=c,d;t[1]!==n||t[2]!==r?(d=jr(n.map(e=>({label:e.label,permission:Ae(e.entry,r)})))??`Off`,t[1]=n,t[2]=r,t[3]=d):d=t[3];let f;t[4]===Symbol.for(`react.memo_cache_sentinel`)?(f=(0,Q.jsx)(`p`,{className:`px-3 py-2.5 text-xs text-muted-foreground sm:px-4`,children:`Machines you trust here can read PR data through each other's GitHub access. Enable both machines. Read and act may use broader permissions than the machine that owns them. This applies only to this device.`}),t[4]=f):f=t[4];let p;if(t[5]!==i||t[6]!==n||t[7]!==r||t[8]!==o||t[9]!==a){let e;t[11]!==i||t[12]!==r||t[13]!==o||t[14]!==a?(e=e=>(0,Q.jsx)(Sr,{kind:Ce(e.serverConfig),label:e.label,subtitle:xr(e),children:(0,Q.jsxs)(Je,{items:kr,value:Ae(e.entry,r),disabled:!i.isReady||o||Ee(e.entry)===null,onValueChange:t=>{t!==null&&(s(!0),a({environmentId:e.environmentId,permission:t}).then(e=>{s(!1),e._tag===`Failure`&&q.add({type:`error`,title:`Could not save GitHub routing permission`})}))},children:[(0,Q.jsx)(qe,{size:`xs`,className:`w-32`,"aria-label":`${e.label} GitHub routing`,children:(0,Q.jsx)(Ge,{})}),(0,Q.jsx)(Ke,{align:`end`,alignItemWithTrigger:!1,children:kr.map(Nr)})]})},e.environmentId),t[11]=i,t[12]=r,t[13]=o,t[14]=a,t[15]=e):e=t[15],p=n.map(e),t[5]=i,t[6]=n,t[7]=r,t[8]=o,t[9]=a,t[10]=p}else p=t[10];let m;return t[16]!==d||t[17]!==p?(m=(0,Q.jsxs)(sr,{id:l,title:u,summary:d,children:[f,p]}),t[16]=d,t[17]=p,t[18]=m):m=t[18],m}function Nr(e){let{value:t,label:n}=e;return(0,Q.jsx)(We,{value:t,children:n},t)}function Pr(e){let t=(0,Z.c)(26),{environmentLabel:n,onCancel:r,onConfirm:i}=e,a=Lt(),[o,s]=(0,$.useState)(n);n!==null&&n!==o&&s(n);let c=a.open,l=n!==null,u;t[0]===r?u=t[1]:(u=e=>{e||r()},t[0]=r,t[1]=u);let d;t[2]===o?d=t[3]:(d=(0,Q.jsxs)(Mn,{children:[`Remove `,o,` from this device?`]}),t[2]=o,t[3]=d);let f;t[4]===Symbol.for(`react.memo_cache_sentinel`)?(f=(0,Q.jsx)(In,{children:`This forgets its pairing, credentials, and cached threads here.`}),t[4]=f):f=t[4];let p;t[5]!==r||t[6]!==c?(p=c?(0,Q.jsx)(ie,{onClick:()=>{r(),c()},children:`P4 Connect settings`}):`P4 Connect settings`,t[5]=r,t[6]=c,t[7]=p):p=t[7];let m;t[8]===p?m=t[9]:(m=(0,Q.jsxs)(In,{children:[`It stays on your P4 Connect account and keeps its host space. Deregister it in`,` `,p,` `,`to free it.`]}),t[8]=p,t[9]=m);let h;t[10]!==d||t[11]!==m?(h=(0,Q.jsxs)(Bn,{children:[d,f,m]}),t[10]=d,t[11]=m,t[12]=h):h=t[12];let g;t[13]===Symbol.for(`react.memo_cache_sentinel`)?(g=(0,Q.jsx)(er,{render:(0,Q.jsx)(z,{variant:`outline`}),children:`Cancel`}),t[13]=g):g=t[13];let _;t[14]===i?_=t[15]:(_=(0,Q.jsxs)(Ln,{children:[g,(0,Q.jsx)(z,{variant:`destructive`,onClick:i,children:`Remove from this device`})]}),t[14]=i,t[15]=_);let v;t[16]!==h||t[17]!==_?(v=(0,Q.jsxs)(An,{children:[h,_]}),t[16]=h,t[17]=_,t[18]=v):v=t[18];let y;t[19]!==l||t[20]!==v||t[21]!==u?(y=(0,Q.jsx)(Dn,{open:l,onOpenChange:u,children:v}),t[19]=l,t[20]=v,t[21]=u,t[22]=y):y=t[22];let b;return t[23]!==a.portals||t[24]!==y?(b=(0,Q.jsxs)(Q.Fragment,{children:[y,a.portals]}),t[23]=a.portals,t[24]=y,t[25]=b):b=t[25],b}var Fr={pairingLinks:[],clientSessions:[]};function Ir(e,t,n){let r=n(t);return[...e.filter(e=>n(e)!==r),t]}function Lr(e,t){switch(t.type){case`snapshot`:return t.payload;case`pairingLinkUpserted`:return{...e,pairingLinks:Ir(e.pairingLinks,t.payload,e=>e.id)};case`pairingLinkRemoved`:return{...e,pairingLinks:e.pairingLinks.filter(e=>e.id!==t.payload.id)};case`clientUpserted`:return{...e,clientSessions:Ir(e.clientSessions,t.payload,e=>e.sessionId)};case`clientRemoved`:return{...e,clientSessions:e.clientSessions.filter(e=>e.sessionId!==t.payload.sessionId)}}}function Rr(e,t){let n=Lr(e,t);return[n,[{version:1,revision:t.revision,type:`snapshot`,payload:n}]]}function zr(e){return{accessChanges:Te(e,{label:`environment-data:server:auth-access-changes`,subscribe:e=>H(y.subscribeAuthAccess,{}).pipe(L(()=>Fr,Rr))})}}var Br=zr(G),Vr=3e4,Hr=class extends o()(`DesktopNetworkAccessUnavailableError`,{}){get message(){return`Desktop network access is unavailable.`}},Ur=class extends o()(`DesktopServerExposureStateLoadError`,{cause:c()}){get message(){return`Failed to load desktop server exposure state.`}},Wr=class extends o()(`DesktopAdvertisedEndpointsLoadError`,{cause:c()}){get message(){return`Failed to load advertised desktop endpoints.`}};function Gr(){return typeof window>`u`?void 0:window.desktopBridge}function Kr(e){let t=I(`loadDesktopNetworkAccess`)(function*(){let t=e();if(!t)return yield*new Hr;let[r,i]=yield*n([j({try:()=>t.getServerExposureState(),catch:e=>new Ur({cause:e})}),j({try:()=>t.getAdvertisedEndpoints(),catch:e=>new Wr({cause:e})})],{concurrency:`unbounded`});return{advertisedEndpoints:i,serverExposureState:r}});return i(t()).pipe(se({staleTime:Vr,revalidateOnMount:!0}),w,he(`desktop:network-access`))}var qr=Kr(Gr);function Jr(){p.refresh(qr)}function Yr(e,t){let n=t.trim().toLowerCase();if(n.length===0)return e;let r=[],i=[];for(let t of e){let e=t.alias.toLowerCase();e.startsWith(n)?r.push(t):e.includes(n)&&i.push(t)}return[...r,...i]}var Xr=class extends o()(`DesktopSshDiscoveryUnavailableError`,{}){get message(){return`Desktop SSH host discovery is unavailable.`}},Zr=class extends o()(`DesktopSshDiscoveryError`,{cause:c()}){get message(){return`Failed to discover SSH hosts.`}};function Qr(){return typeof window>`u`?void 0:window.desktopBridge}function $r(e){let t=I(`discoverDesktopSshHosts`)(function*(){let t=e();return t?yield*j({try:()=>t.discoverSshHosts(),catch:e=>new Zr({cause:e})}):yield*new Xr});return i(t()).pipe(se({staleTime:3e4,revalidateOnMount:!0}),w,he(`desktop:ssh-hosts`))}var ei=$r(Qr),ti=443,ni=[],ri=[],ii=`backend:default-wsl`,ai=`backend:wsl-off`,oi=new Intl.DateTimeFormat(void 0,{dateStyle:`medium`,timeStyle:`short`});function si(e){let t=new Date(e);return Number.isNaN(t.getTime())?e:oi.format(t)}function ci(e){let t=(0,Z.c)(13),{scopes:n,label:r}=e,i=`${n.length} ${n.length===1?`scope`:`scopes`}`,a=`${r}: show ${i}`,o;t[0]===a?o=t[1]:(o=(0,Q.jsx)(`button`,{type:`button`,"aria-label":a,className:`cursor-help underline decoration-border underline-offset-2 outline-hidden hover:text-foreground focus-visible:text-foreground`}),t[0]=a,t[1]=o);let s;t[2]!==i||t[3]!==o?(s=(0,Q.jsx)(Yt,{openOnHover:!0,delay:250,closeDelay:100,render:o,children:i}),t[2]=i,t[3]=o,t[4]=s):s=t[4];let c;t[5]===Symbol.for(`react.memo_cache_sentinel`)?(c=(0,Q.jsx)(`p`,{className:`mb-1 font-medium`,children:`Granted scopes`}),t[5]=c):c=t[5];let l;t[6]===n?l=t[7]:(l=n.map(li),t[6]=n,t[7]=l);let u;t[8]===l?u=t[9]:(u=(0,Q.jsxs)(Jt,{side:`top`,align:`start`,tooltipStyle:!0,className:`w-max max-w-80 whitespace-normal`,children:[c,(0,Q.jsx)(`div`,{className:`flex flex-col gap-0.5`,children:l})]}),t[8]=l,t[9]=u);let d;return t[10]!==s||t[11]!==u?(d=(0,Q.jsxs)(Xt,{children:[s,u]}),t[10]=s,t[11]=u,t[12]=d):d=t[12],d}function li(e){return(0,Q.jsx)(`code`,{className:`font-mono text-foreground/85`,children:e},e)}function ui(e){let t=e.host.trim();if(t.length===0)throw Error(`SSH host or alias is required.`);let n=t,r=e.username.trim()||null,i=null,a=n.lastIndexOf(`@`);if(a>0){let e=n.slice(0,a).trim();n=n.slice(a+1).trim(),!r&&e.length>0&&(r=e)}let o=/^\[([^\]]+)\](?::(\d+))?$/u.exec(n);if(o)n=o[1].trim(),o[2]&&(i=Number.parseInt(o[2],10));else{let e=n.split(`:`);e.length===2&&/^\d+$/u.test(e[1]??``)&&(n=e[0].trim(),i=Number.parseInt(e[1],10))}let s=e.port.trim();if(s.length>0&&(i=Number.parseInt(s,10)),n.length===0)throw Error(`SSH host or alias is required.`);if(i!==null&&(!Number.isInteger(i)||i<=0||i>65535))throw Error(`SSH port must be between 1 and 65535.`);return{alias:n,hostname:n,username:r,port:i}}function di(e){let t=e.trim();if(!t)return null;try{let e=/^[a-zA-Z][a-zA-Z\d+.-]*:\/\//u.test(t)||t.startsWith(`//`)?t:`https://${t}`,n=new URL(e,window.location.origin),r=W(n);if(r)return{host:r.host,pairingCode:r.token};let i=Ve(n);return i?{host:n.origin,pairingCode:i}:null}catch{return null}}function fi(e){let t=di(e.host);if(t)return t;let n=e.host.trim(),r=e.pairingCode.trim();if(!n)throw Error(`Enter a backend host.`);if(!r)throw Error(`Enter a pairing code.`);return{host:n,pairingCode:r}}function pi(e){let t=`Failed to connect SSH host.`;return(e instanceof Error?e.message:t).replace(/^Error invoking remote method 'desktop:ensure-ssh-environment':\s*/u,``).replace(/^Ssh[A-Za-z]+Error:\s*/u,``).trim()||t}var mi=`first:rounded-t-xl last:rounded-b-xl px-3 py-2.5 sm:px-4`;function hi(e){return Qn}function gi(e,t){return e===`endpoint-rail`?ge(`relative first:rounded-t-xl last:rounded-b-xl px-3 py-3 sm:px-4`,!t&&`bg-muted/15`):ge(mi,!t&&`bg-muted/24`)}function _i(e){return[...e].toSorted((e,t)=>new Date(t.createdAt).getTime()-new Date(e.createdAt).getTime())}function vi(e,t){return[`${e.length} ${e.length===1?`client`:`clients`}`,t.length>0?`${t.length} ${t.length===1?`pairing link`:`pairing links`}`:null].filter(e=>e!==null).join(` · `)}function yi(e){return[...e].toSorted((e,t)=>e.current===t.current?e.connected===t.connected?new Date(t.issuedAt).getTime()-new Date(e.issuedAt).getTime():e.connected?-1:1:e.current?-1:1)}function bi(e){return{...e,scopes:e.permissions??e.scopes,createdAt:k(e.createdAt),expiresAt:k(e.expiresAt)}}function xi(e){return{...e,scopes:e.permissions??e.scopes,issuedAt:k(e.issuedAt),expiresAt:k(e.expiresAt),lastConnectedAt:e.lastConnectedAt===null?null:k(e.lastConnectedAt)}}function Si(e,t){let n=e.filter(e=>e.status!==`unavailable`);if(t){let e=n.find(e=>wi(e)===t);if(e)return e}return n.find(e=>e.isDefault)??n.find(e=>e.reachability!==`loopback`)??n.find(e=>e.compatibility.hostedHttpsApp===`compatible`)??null}function Ci(e){return e.id.startsWith(`tailscale-magicdns:`)}function wi(e){if(e.id.startsWith(`desktop-loopback:`))return`desktop-core:loopback:http`;if(e.id.startsWith(`desktop-lan:`))return`desktop-core:lan:http`;if(e.id.startsWith(`tailscale-ip:`))return`tailscale:ip:http`;if(Ci(e))return`tailscale:magicdns:https`;let t=`unknown`;try{t=new URL(e.httpBaseUrl).protocol.replace(/:$/u,``)}catch{}return`${e.provider.id}:${e.reachability}:${t}:${e.label}`}function Ti(e,t){return e.compatibility.hostedHttpsApp===`compatible`?dr(e.httpBaseUrl,t)??ur(e.httpBaseUrl,t):ur(e.httpBaseUrl,t)}function Ei(e){let t=new URL(`/pair`,window.location.href);return Le(t,e).toString()}function Di(e){try{let t=new URL(e);return t.pathname===`/pair`&&t.searchParams.has(`host`)}catch{return!1}}function Oi(e,t){if(Di(t))return`Opens the hosted app, no install needed`;switch(e.reachability){case`lan`:return`Devices on the same network`;case`private-network`:return`Devices on your private network`;case`public`:return`Reachable from anywhere`;case`loopback`:return`Clients on this machine`}}var ki=(0,$.memo)(function(e){let t=(0,Z.c)(135),{pairingLink:n,credential:r,endpointUrl:i,endpoints:a,defaultEndpointKey:o,presentation:s,revokingPairingLinkId:c,onRevoke:l,canRevoke:u}=e,d=s===void 0?`current`:s,f=yn(1e3),p=new Date(n.expiresAt).getTime(),[m,h]=(0,$.useState)(!1),[g,_]=(0,$.useState)(!1),[v,y]=(0,$.useState)(null),b=(0,$.useId)(),x;t[0]===r?x=t[1]:(x=r?Ei(r):null,t[0]=r,t[1]=x);let S=x,C;t[2]!==r||t[3]!==i?(C=r&&i!=null&&i!==``?dr(i,r):null,t[2]=r,t[3]=i,t[4]=C):C=t[4];let w=C,E;if(t[5]!==r||t[6]!==o||t[7]!==a){let e=Si(a,o);E=e&&r?Ti(e,r):null,t[5]=r,t[6]=o,t[7]=a,t[8]=E}else E=t[8];let D=E,O;if(t[9]!==r||t[10]!==a){bb0:{let e=[];if(!r){O=e;break bb0}for(let t of a){if(t.status===`unavailable`)continue;let n=Ti(t,r);e.push({id:t.id,preferenceKey:wi(t),label:t.label,url:n,detail:Oi(t,n),qrShareable:ar(t)})}O=e}t[9]=r,t[10]=a,t[11]=O}else O=t[11];let k=O,A;t[12]!==r||t[13]!==S||t[14]!==D||t[15]!==i||t[16]!==w?(A=D??(r&&i!=null&&i!==``?w??ur(i,r):U(window.location.hostname)?null:S),t[12]=r,t[13]=S,t[14]=D,t[15]=i,t[16]=w,t[17]=A):A=t[17];let j=A,[M,N]=(0,$.useState)(null),P=M??j??r??``,F=P!==r,ee=F&&Di(P),te=k.find(e=>e.url===P)?.qrShareable??!0,ne=typeof window<`u`&&window.isSecureContext&&navigator.clipboard?.writeText!=null,re;t[18]===Symbol.for(`react.memo_cache_sentinel`)?(re={onCopy:Zi,onError:(e,t)=>{let{value:n,kind:r}=t;N(n),h(!0),q.add(ht({type:`error`,title:ne?r===`hosted-link`?`Could not copy hosted app link`:r===`link`?`Could not copy pairing URL`:`Could not copy pairing code`:`Clipboard copy unavailable`,description:ne?e.message:`Showing the full value instead.`}))}},t[18]=re):re=t[18];let{copyToClipboard:ie}=Ye(re),ae;t[19]===ie?ae=t[20]:(ae=(e,t)=>{ie(e,{value:e,kind:t})},t[19]=ie,t[20]=ae);let oe=ae,se=Qi,ce;t[21]!==oe||t[22]!==r?(ce=()=>{r&&oe(r,`code`)},t[21]=oe,t[22]=r,t[23]=ce):ce=t[23];let I=ce,le;t[24]===n.expiresAt?le=t[25]:(le=si(n.expiresAt),t[24]=n.expiresAt,t[25]=le);let ue=le,L=n.label??`Pairing link`,de;t[26]!==o||t[27]!==k||t[28]!==v?(de=Gn(k,v,o),t[26]=o,t[27]=k,t[28]=v,t[29]=de):de=t[29];let fe=de,R=fe?.url??j,pe=fe?.qrShareable??!0;if(p<=f)return null;let me;t[30]===d?me=t[31]:(me=hi(d),t[30]=d,t[31]=me);let he;t[32]===n.createdAt?he=t[33]:(he=si(n.createdAt),t[32]=n.createdAt,t[33]=he);let _e=`Link created at ${he}`,ve;t[34]===_e?ve=t[35]:(ve=(0,Q.jsx)(X,{tooltipText:_e,dotClassName:`bg-warning`}),t[34]=_e,t[35]=ve);let ye;t[36]===L?ye=t[37]:(ye=(0,Q.jsx)(`h3`,{className:`text-sm font-medium text-foreground`,children:L}),t[36]=L,t[37]=ye);let be;t[38]!==ve||t[39]!==ye?(be=(0,Q.jsxs)(`div`,{className:`flex min-h-5 items-center gap-1.5`,children:[ve,ye]}),t[38]=ve,t[39]=ye,t[40]=be):be=t[40];let B;t[41]===Symbol.for(`react.memo_cache_sentinel`)?(B=(0,Q.jsx)(`span`,{}),t[41]=B):B=t[41];let xe;t[42]!==f||t[43]!==n.expiresAt?(xe=gt(n.expiresAt,f),t[42]=f,t[43]=n.expiresAt,t[44]=xe):xe=t[44];let Se;t[45]===xe?Se=t[46]:(Se=(0,Q.jsx)(Xe,{render:B,children:xe}),t[45]=xe,t[46]=Se);let Ce;t[47]===ue?Ce=t[48]:(Ce=(0,Q.jsx)(Ze,{side:`top`,children:ue}),t[47]=ue,t[48]=Ce);let V;t[49]!==Se||t[50]!==Ce?(V=(0,Q.jsxs)(Qe,{children:[Se,Ce]}),t[49]=Se,t[50]=Ce,t[51]=V):V=t[51];let we;t[52]===Symbol.for(`react.memo_cache_sentinel`)?(we=(0,Q.jsx)(`span`,{"aria-hidden":!0,children:` · `}),t[52]=we):we=t[52];let Te;t[53]===n.scopes?Te=t[54]:(Te=(0,Q.jsx)(ci,{scopes:n.scopes,label:`Pairing link scopes`}),t[53]=n.scopes,t[54]=Te);let Ee;t[55]!==V||t[56]!==Te?(Ee=(0,Q.jsxs)(`p`,{className:`text-xs text-muted-foreground`,children:[V,we,Te]}),t[55]=V,t[56]=Te,t[57]=Ee):Ee=t[57];let De;t[58]!==r||t[59]!==j?(De=r?j===null?(0,Q.jsx)(`p`,{className:`text-2xs text-muted-foreground/70`,children:`Copy the token and pair from another client using this backend's reachable host.`}):null:(0,Q.jsx)(`p`,{className:`text-2xs text-muted-foreground/70`,children:`Create a new link to share from this client.`}),t[58]=r,t[59]=j,t[60]=De):De=t[60];let Oe;t[61]!==be||t[62]!==Ee||t[63]!==De?(Oe=(0,Q.jsxs)(`div`,{className:`min-w-0 flex-1 space-y-1`,children:[be,Ee,De]}),t[61]=be,t[62]=Ee,t[63]=De,t[64]=Oe):Oe=t[64];let ke;t[65]!==g||t[66]!==b||t[67]!==j?(ke=j&&ne?(0,Q.jsxs)(z,{size:`xs`,variant:`outline`,"aria-expanded":g,"aria-controls":b,onClick:()=>_($i),children:[(0,Q.jsx)(T,{"aria-hidden":!0}),`Share`]}):null,t[65]=g,t[66]=b,t[67]=j,t[68]=ke):ke=t[68];let Ae=r!==void 0&&m,je;t[69]===Symbol.for(`react.memo_cache_sentinel`)?(je=e=>{h(e),e||N(null)},t[69]=je):je=t[69];let Me;t[70]!==r||t[71]!==I||t[72]!==j?(Me=r?ne?j?null:(0,Q.jsx)(z,{size:`xs`,variant:`outline`,onClick:I,children:`Copy code`}):(0,Q.jsx)(jt,{render:(0,Q.jsx)(z,{size:`xs`,variant:`outline`}),children:j?`Show link`:`Show code`}):null,t[70]=r,t[71]=I,t[72]=j,t[73]=Me):Me=t[73];let Ne=F?ee?`Hosted app pairing link`:`Pairing link`:`Pairing code`,Pe;t[74]===Ne?Pe=t[75]:(Pe=(0,Q.jsx)(kt,{children:Ne}),t[74]=Ne,t[75]=Pe);let Fe=F?ee?`Clipboard copy is unavailable here. Open or manually copy this hosted app link on the device you want to connect.`:`Clipboard copy is unavailable here. Open or manually copy this full pairing URL on the device you want to connect.`:`Clipboard copy is unavailable here. Manually copy this code into another client.`,H;t[76]===Fe?H=t[77]:(H=(0,Q.jsx)(Pt,{children:Fe}),t[76]=Fe,t[77]=H);let Ie;t[78]!==Pe||t[79]!==H?(Ie=(0,Q.jsxs)(Ot,{children:[Pe,H]}),t[78]=Pe,t[79]=H,t[80]=Ie):Ie=t[80];let W=F?4:3,Le;t[81]!==P||t[82]!==W?(Le=(0,Q.jsx)(vt,{readOnly:!0,value:P,rows:W,onFocus:ea,onClick:ta}),t[81]=P,t[82]=W,t[83]=Le):Le=t[83];let Re;t[84]!==te||t[85]!==F||t[86]!==P?(Re=F&&te?(0,Q.jsx)(`div`,{className:`flex justify-center rounded-xl border border-border/60 bg-muted/30 p-4`,children:(0,Q.jsx)(Hn,{value:P,size:132,level:`M`,marginSize:2,title:`Pairing link — scan to open on another device`})}):null,t[84]=te,t[85]=F,t[86]=P,t[87]=Re):Re=t[87];let ze;t[88]!==Le||t[89]!==Re?(ze=(0,Q.jsxs)(Nt,{children:[Le,Re]}),t[88]=Le,t[89]=Re,t[90]=ze):ze=t[90];let Be;t[91]===Symbol.for(`react.memo_cache_sentinel`)?(Be=(0,Q.jsx)(z,{variant:`outline`,onClick:()=>h(!1),children:`Done`}),t[91]=Be):Be=t[91];let Ve;t[92]===I?Ve=t[93]:(Ve=ne?(0,Q.jsx)(z,{variant:`outline`,onClick:I,children:`Copy code`}):null,t[92]=I,t[93]=Ve);let He;t[94]===Ve?He=t[95]:(He=(0,Q.jsxs)(At,{variant:`bare`,children:[Be,Ve]}),t[94]=Ve,t[95]=He);let Ue;t[96]!==Ie||t[97]!==ze||t[98]!==He?(Ue=(0,Q.jsxs)(Ft,{className:`max-w-md`,children:[Ie,ze,He]}),t[96]=Ie,t[97]=ze,t[98]=He,t[99]=Ue):Ue=t[99];let G;t[100]!==Ae||t[101]!==Me||t[102]!==Ue?(G=(0,Q.jsxs)(It,{open:Ae,onOpenChange:je,children:[Me,Ue]}),t[100]=Ae,t[101]=Me,t[102]=Ue,t[103]=G):G=t[103];let We=!u||c===n.id,Ge;t[104]!==l||t[105]!==n.id?(Ge=()=>void l(n.id),t[104]=l,t[105]=n.id,t[106]=Ge):Ge=t[106];let Ke=c===n.id?`Revoking…`:`Revoke`,qe;t[107]!==We||t[108]!==Ge||t[109]!==Ke?(qe=(0,Q.jsx)(z,{size:`xs`,variant:`destructive-outline`,disabled:We,onClick:Ge,children:Ke}),t[107]=We,t[108]=Ge,t[109]=Ke,t[110]=qe):qe=t[110];let Je;t[111]!==ke||t[112]!==G||t[113]!==qe?(Je=(0,Q.jsxs)(`div`,{className:`flex w-full shrink-0 items-center gap-2 sm:w-auto sm:justify-end`,children:[ke,G,qe]}),t[111]=ke,t[112]=G,t[113]=qe,t[114]=Je):Je=t[114];let K;t[115]!==Oe||t[116]!==Je?(K=(0,Q.jsxs)(`div`,{className:Jn,children:[Oe,Je]}),t[115]=Oe,t[116]=Je,t[117]=K):K=t[117];let $e=g&&R!==null,et;t[118]!==pe||t[119]!==oe||t[120]!==k||t[121]!==I||t[122]!==R||t[123]!==b||t[124]!==fe?.id?(et=R===null?null:(0,Q.jsxs)(`div`,{id:b,className:`mt-3 flex flex-col gap-4 border-t border-border/50 pt-3 sm:flex-row sm:items-start sm:justify-between`,children:[(0,Q.jsxs)(`div`,{className:`min-w-0 flex-1 space-y-3`,children:[k.length>1?(0,Q.jsxs)(`div`,{className:`space-y-1.5`,role:`radiogroup`,"aria-label":`Endpoint the pairing QR code and URL use`,children:[(0,Q.jsx)(`p`,{className:`text-2xs text-muted-foreground/70`,children:`Reach this machine via`}),k.map(e=>{let t=e.id===fe?.id;return(0,Q.jsxs)(`button`,{type:`button`,role:`radio`,"aria-checked":t,className:ge(`flex w-full items-baseline gap-2 rounded-lg border px-2.5 py-1.5 text-left outline-none focus-visible:ring-2 focus-visible:ring-inset focus-visible:ring-ring`,t?`border-foreground/60 bg-muted/30`:`border-border/50 hover:bg-muted/20`),onClick:()=>y(e.id),children:[(0,Q.jsx)(`span`,{className:ge(`text-xs font-medium`,t?`text-foreground`:`text-muted-foreground`),children:e.label}),(0,Q.jsx)(`span`,{className:`min-w-0 truncate text-2xs text-muted-foreground/70`,children:e.detail})]},e.id)})]}):null,(0,Q.jsxs)(`div`,{className:`flex items-center gap-2 rounded-lg border border-border/60 bg-muted/30 px-2.5 py-1.5`,children:[(0,Q.jsxs)(Qe,{children:[(0,Q.jsx)(Xe,{render:(0,Q.jsx)(`code`,{className:`min-w-0 flex-1 truncate font-mono text-2xs text-muted-foreground`,children:R})}),(0,Q.jsx)(Ze,{side:`top`,children:R})]}),(0,Q.jsx)(z,{size:`xs`,variant:`ghost`,className:`shrink-0`,onClick:()=>oe(R,se(R)),children:`Copy link`})]}),(0,Q.jsx)(z,{size:`xs`,variant:`ghost`,onClick:I,children:`Copy code only`})]}),pe?(0,Q.jsx)(`div`,{className:`w-fit shrink-0 self-center rounded-xl bg-white p-3 sm:self-start`,children:(0,Q.jsx)(Hn,{value:R,size:168,level:`M`,marginSize:1,title:`Pairing link — scan to open on another device`})}):(0,Q.jsx)(`div`,{className:`flex size-[192px] shrink-0 items-center justify-center self-center rounded-xl border border-border/50 p-4 sm:self-start`,children:(0,Q.jsx)(`p`,{className:`text-center text-2xs text-muted-foreground/70`,children:`No QR for this endpoint. Another device scanning a loopback link would dial itself; copy the URL for use on this machine instead.`})})]}),t[118]=pe,t[119]=oe,t[120]=k,t[121]=I,t[122]=R,t[123]=b,t[124]=fe?.id,t[125]=et):et=t[125];let tt;t[126]===et?tt=t[127]:(tt=(0,Q.jsx)(kn,{children:et}),t[126]=et,t[127]=tt);let J;t[128]!==$e||t[129]!==tt?(J=(0,Q.jsx)(zn,{open:$e,children:tt}),t[128]=$e,t[129]=tt,t[130]=J):J=t[130];let nt;return t[131]!==me||t[132]!==K||t[133]!==J?(nt=(0,Q.jsxs)(`div`,{className:me,children:[K,J]}),t[131]=me,t[132]=K,t[133]=J,t[134]=nt):nt=t[134],nt}),Ai=(0,$.memo)(function(e){let t=(0,Z.c)(54),{clientSession:n,presentation:r,revokingClientSessionId:i,onRevokeSession:a,canRevoke:o}=e,s=r===void 0?`current`:r,c=yn(1e3),l=n.current||n.connected,u=n.lastConnectedAt,d;t[0]!==l||t[1]!==u||t[2]!==c?(d=l?u?`Connected for ${_t(u,c)}`:`Connected`:u?`Last connected at ${si(u)}`:`Not connected yet.`,t[0]=l,t[1]=u,t[2]=c,t[3]=d):d=t[3];let f=d,p;t[4]===n.client.deviceType?p=t[5]:(p=n.client.deviceType===`unknown`?null:n.client.deviceType[0]?.toUpperCase()+n.client.deviceType.slice(1),t[4]=n.client.deviceType,t[5]=p);let m=n.client.os??null,h=n.client.browser??null,g=n.client.ipAddress??null,_;t[6]!==p||t[7]!==m||t[8]!==h||t[9]!==g?(_=[p,m,h,g].filter(na),t[6]=p,t[7]=m,t[8]=h,t[9]=g,t[10]=_):_=t[10];let v=_,y;t[11]!==n.client.browser||t[12]!==n.client.label||t[13]!==n.client.os||t[14]!==n.subject?(y=n.client.label??([n.client.os,n.client.browser].filter(Boolean).join(` · `)||n.subject),t[11]=n.client.browser,t[12]=n.client.label,t[13]=n.client.os,t[14]=n.subject,t[15]=y):y=t[15];let b=y,x;t[16]===s?x=t[17]:(x=hi(s),t[16]=s,t[17]=x);let S=l?`bg-success`:`bg-muted-foreground/30`,C=l?`bg-success/60 duration-2000`:null,w;t[18]!==f||t[19]!==S||t[20]!==C?(w=(0,Q.jsx)(X,{tooltipText:f,dotClassName:S,pingClassName:C}),t[18]=f,t[19]=S,t[20]=C,t[21]=w):w=t[21];let T;t[22]===b?T=t[23]:(T=(0,Q.jsx)(`h3`,{className:`text-sm font-medium text-foreground`,children:b}),t[22]=b,t[23]=T);let E;t[24]===n.current?E=t[25]:(E=n.current?(0,Q.jsx)(`span`,{className:`text-3xs text-muted-foreground/80 rounded-md border border-border/50 bg-muted/50 px-1 py-0.5`,children:`This device`}):null,t[24]=n.current,t[25]=E);let D;t[26]!==w||t[27]!==T||t[28]!==E?(D=(0,Q.jsxs)(`div`,{className:`flex min-h-5 items-center gap-1.5`,children:[w,T,E]}),t[26]=w,t[27]=T,t[28]=E,t[29]=D):D=t[29];let O;t[30]===v?O=t[31]:(O=v.length>0?(0,Q.jsxs)(Q.Fragment,{children:[v.join(` · `),(0,Q.jsx)(`span`,{"aria-hidden":!0,children:` · `})]}):null,t[30]=v,t[31]=O);let k;t[32]===n.scopes?k=t[33]:(k=(0,Q.jsx)(ci,{scopes:n.scopes,label:`Client scopes`}),t[32]=n.scopes,t[33]=k);let A;t[34]!==O||t[35]!==k?(A=(0,Q.jsxs)(`p`,{className:`text-xs text-muted-foreground`,children:[O,k]}),t[34]=O,t[35]=k,t[36]=A):A=t[36];let j;t[37]!==D||t[38]!==A?(j=(0,Q.jsxs)(`div`,{className:`min-w-0 flex-1 space-y-1`,children:[D,A]}),t[37]=D,t[38]=A,t[39]=j):j=t[39];let M;t[40]!==o||t[41]!==n.current||t[42]!==n.sessionId||t[43]!==a||t[44]!==i?(M=n.current?null:(0,Q.jsx)(z,{size:`xs`,variant:`destructive-outline`,disabled:!o||i===n.sessionId,onClick:()=>void a(n.sessionId),children:i===n.sessionId?`Revoking…`:`Revoke`}),t[40]=o,t[41]=n.current,t[42]=n.sessionId,t[43]=a,t[44]=i,t[45]=M):M=t[45];let N;t[46]===M?N=t[47]:(N=(0,Q.jsx)(`div`,{className:`flex w-full shrink-0 items-center gap-2 sm:w-auto sm:justify-end`,children:M}),t[46]=M,t[47]=N);let P;t[48]!==j||t[49]!==N?(P=(0,Q.jsxs)(`div`,{className:Jn,children:[j,N]}),t[48]=j,t[49]=N,t[50]=P):P=t[50];let F;return t[51]!==P||t[52]!==x?(F=(0,Q.jsx)(`div`,{className:x,children:P}),t[51]=P,t[52]=x,t[53]=F):F=t[53],F}),ji=(0,$.memo)(function({onPairingLinkCreated:e,clientSessions:t,isRevokingOtherClients:n,onRevokeOtherClients:r,delegatableScopes:i}){let a=J(),[o,s]=(0,$.useState)(!1),[c,u]=(0,$.useState)(``),[d,f]=(0,$.useState)([...D]),p=d.filter(e=>i.includes(e)),[m,h]=(0,$.useState)(!1),g=(0,$.useCallback)(async()=>{if(a!==null&&p.length!==0&&st(a,`access:write`)&&p.every(e=>st(a,e))){h(!0);try{e(await xn({label:c,scopes:p})),u(``),f(D.filter(e=>i.includes(e))),s(!1)}catch(e){let t=e instanceof Error?e.message:`Failed to create pairing URL.`;q.add(ht({type:`error`,title:`Could not create pairing URL`,description:t}))}finally{h(!1)}}},[i,e,c,a,p]),_=(0,$.useCallback)((e,t)=>{f(n=>Wn(n,e,t))},[]);return(0,Q.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,Q.jsx)(z,{size:`xs`,variant:`destructive-outline`,disabled:n||!Pn(t),onClick:()=>void r(),children:n?`Revoking…`:`Revoke others`}),(0,Q.jsxs)(It,{open:o,onOpenChange:e=>{s(e),e||(u(``),f(D.filter(e=>i.includes(e))))},children:[(0,Q.jsx)(jt,{render:(0,Q.jsxs)(z,{size:`xs`,variant:`default`,children:[(0,Q.jsx)(S,{className:`size-3`}),`Create link`]})}),(0,Q.jsxs)(Ft,{className:`max-w-md`,children:[(0,Q.jsxs)(Ot,{children:[(0,Q.jsx)(kt,{children:`Create pairing link`}),(0,Q.jsx)(Pt,{children:`Generate a one-time link that another device can use to pair with this backend as an authorized client.`})]}),(0,Q.jsxs)(Nt,{children:[(0,Q.jsxs)(`label`,{className:`block`,children:[(0,Q.jsx)(`span`,{className:`mb-1.5 block text-xs font-medium text-foreground`,children:`Client label (optional)`}),(0,Q.jsx)(Et,{value:c,onChange:e=>u(e.target.value),placeholder:`e.g. Living room iPad`,disabled:m,autoFocus:!0})]}),(0,Q.jsxs)(`section`,{className:`space-y-3`,children:[(0,Q.jsxs)(`div`,{className:`flex items-center justify-between gap-3`,children:[(0,Q.jsxs)(`div`,{children:[(0,Q.jsx)(`h3`,{className:`text-xs font-medium text-foreground`,children:`Permissions`}),(0,Q.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:`Limit what the paired client can do.`})]}),(0,Q.jsxs)(`div`,{className:`flex gap-1`,children:[(0,Q.jsx)(z,{size:`xs`,variant:`outline`,disabled:m,onClick:()=>f([ye,R,ve,l].filter(e=>i.includes(e))),children:`Read only`}),(0,Q.jsx)(z,{size:`xs`,variant:`outline`,disabled:m,onClick:()=>f(D.filter(e=>i.includes(e))),children:`Standard`})]})]}),(0,Q.jsx)(`div`,{className:`divide-y divide-border/60 rounded-lg border border-input bg-muted/25`,children:cr.filter(({scope:e})=>i.includes(e)).map(({scope:e,title:t,description:n})=>(0,Q.jsxs)(`label`,{className:`flex cursor-pointer items-start gap-3 px-3 py-2.5 transition-colors hover:bg-muted/40`,children:[(0,Q.jsx)(Zt,{className:`mt-0.5`,checked:d.includes(e),disabled:m,onCheckedChange:t=>_(e,t===!0)}),(0,Q.jsxs)(`span`,{className:`min-w-0`,children:[(0,Q.jsx)(`span`,{className:`block text-xs font-medium text-foreground`,children:t}),(0,Q.jsx)(`span`,{className:`block text-xs leading-snug text-muted-foreground`,children:n})]})]},e))}),p.length===0?(0,Q.jsx)(`p`,{className:`text-xs text-destructive`,children:`Select at least one permission.`}):p.includes(`access:write`)?(0,Q.jsx)(`p`,{className:`text-xs text-warning`,children:`This client can create or revoke access for other devices.`}):null]})]}),(0,Q.jsxs)(At,{variant:`bare`,children:[(0,Q.jsx)(z,{variant:`outline`,disabled:m,onClick:()=>s(!1),children:`Cancel`}),(0,Q.jsx)(z,{disabled:m||p.length===0,onClick:()=>void g(),children:m?`Creating…`:`Create link`})]})]})]})]})}),Mi=(0,$.memo)(function(e){let t=(0,Z.c)(39),{endpointUrl:n,endpoints:r,defaultEndpointKey:i,presentation:a,isLoading:o,pairingLinks:s,createdPairingCredentials:c,clientSessions:l,revokingPairingLinkId:u,revokingClientSessionId:d,onRevokePairingLink:f,onRevokeClientSession:p,canRevoke:m}=e,h=a===void 0?`current`:a,g;if(t[0]!==m||t[1]!==c||t[2]!==i||t[3]!==n||t[4]!==r||t[5]!==f||t[6]!==s||t[7]!==h||t[8]!==u){let e;t[10]!==m||t[11]!==c||t[12]!==i||t[13]!==n||t[14]!==r||t[15]!==f||t[16]!==h||t[17]!==u?(e=e=>(0,Q.jsx)(ki,{pairingLink:e,credential:c.get(e.id),endpointUrl:n,endpoints:r,defaultEndpointKey:i,presentation:h,revokingPairingLinkId:u,onRevoke:f,canRevoke:m},e.id),t[10]=m,t[11]=c,t[12]=i,t[13]=n,t[14]=r,t[15]=f,t[16]=h,t[17]=u,t[18]=e):e=t[18],g=s.map(e),t[0]=m,t[1]=c,t[2]=i,t[3]=n,t[4]=r,t[5]=f,t[6]=s,t[7]=h,t[8]=u,t[9]=g}else g=t[9];let _;if(t[19]!==m||t[20]!==l||t[21]!==p||t[22]!==h||t[23]!==d){let e;t[25]!==m||t[26]!==p||t[27]!==h||t[28]!==d?(e=e=>(0,Q.jsx)(Ai,{clientSession:e,presentation:h,revokingClientSessionId:d,onRevokeSession:p,canRevoke:m},e.sessionId),t[25]=m,t[26]=p,t[27]=h,t[28]=d,t[29]=e):e=t[29],_=l.map(e),t[19]=m,t[20]=l,t[21]=p,t[22]=h,t[23]=d,t[24]=_}else _=t[24];let v;t[30]!==l.length||t[31]!==o||t[32]!==s.length||t[33]!==h?(v=s.length===0&&l.length===0&&!o?(0,Q.jsx)(`div`,{className:hi(h),children:(0,Q.jsx)(`p`,{className:`text-xs text-muted-foreground/60`,children:`No pairing links or client sessions.`})}):null,t[30]=l.length,t[31]=o,t[32]=s.length,t[33]=h,t[34]=v):v=t[34];let y;return t[35]!==g||t[36]!==_||t[37]!==v?(y=(0,Q.jsxs)(Q.Fragment,{children:[g,_,v]}),t[35]=g,t[36]=_,t[37]=v,t[38]=y):y=t[38],y}),Ni=(0,$.memo)(function(e){let t=(0,Z.c)(50),{endpoint:n,isDefault:r,presentation:i,onSetDefault:a,onSetupTailscaleServe:o,onDisableTailscaleServe:s,isUpdatingTailscaleServe:c}=e,l=i===void 0?`current`:i,u=n.status===`available`,d;t[0]===n?d=t[1]:(d=Ci(n)&&n.status!==`available`,t[0]=n,t[1]=d);let f=d,p;t[2]===n?p=t[3]:(p=Ci(n)&&n.status===`available`,t[2]=n,t[3]=p);let m=p,h=!f,g=l===`endpoint-rail`,_;t[4]!==u||t[5]!==l?(_=gi(l,u),t[4]=u,t[5]=l,t[6]=_):_=t[6];let v;t[7]!==r||t[8]!==g?(v=g&&r?(0,Q.jsx)(`span`,{className:`absolute inset-y-2 left-0 w-1 rounded-r-full bg-primary`,"aria-hidden":!0}):null,t[7]=r,t[8]=g,t[9]=v):v=t[9];let y;t[10]===n.label?y=t[11]:(y=(0,Q.jsx)(`h3`,{className:`shrink-0 text-sm leading-5 font-medium text-foreground`,children:n.label}),t[10]=n.label,t[11]=y);let b;t[12]!==n.httpBaseUrl||t[13]!==h?(b=h?(0,Q.jsxs)(Qe,{children:[(0,Q.jsx)(Xe,{render:(0,Q.jsx)(`p`,{className:`min-w-0 truncate text-xs leading-5 text-muted-foreground`,children:n.httpBaseUrl})}),(0,Q.jsx)(Ze,{side:`top`,children:n.httpBaseUrl})]}):null,t[12]=n.httpBaseUrl,t[13]=h,t[14]=b):b=t[14];let x;t[15]===u?x=t[16]:(x=u?null:(0,Q.jsx)(`span`,{className:`shrink-0 rounded-md border border-border/70 px-1 py-0.5 text-3xs text-muted-foreground`,children:`Setup required`}),t[15]=u,t[16]=x);let S;t[17]!==y||t[18]!==b||t[19]!==x?(S=(0,Q.jsxs)(`div`,{className:`flex min-w-0 items-baseline gap-3`,children:[y,b,x]}),t[17]=y,t[18]=b,t[19]=x,t[20]=S):S=t[20];let C;t[21]===r?C=t[22]:(C=r?(0,Q.jsx)(`span`,{className:`rounded-md border border-primary/30 bg-primary/10 px-1 py-0.5 text-3xs text-primary`,children:`Default`}):null,t[21]=r,t[22]=C);let w;t[23]!==n||t[24]!==c||t[25]!==f||t[26]!==o?(w=f?(0,Q.jsx)(z,{size:`xs`,variant:`outline`,onClick:()=>o(n),disabled:c,children:c?`Restarting…`:`Setup`}):null,t[23]=n,t[24]=c,t[25]=f,t[26]=o,t[27]=w):w=t[27];let T;t[28]!==m||t[29]!==n||t[30]!==c||t[31]!==s?(T=m?(0,Q.jsx)(z,{size:`xs`,variant:`destructive-outline`,onClick:()=>s(n),disabled:c,children:c?`Restarting…`:`Disable`}):null,t[28]=m,t[29]=n,t[30]=c,t[31]=s,t[32]=T):T=t[32];let E;t[33]!==n||t[34]!==r||t[35]!==f||t[36]!==a?(E=!f&&!r?(0,Q.jsx)(z,{size:`xs`,variant:`outline`,onClick:()=>a(n),children:`Set as default`}):null,t[33]=n,t[34]=r,t[35]=f,t[36]=a,t[37]=E):E=t[37];let D;t[38]!==C||t[39]!==w||t[40]!==T||t[41]!==E?(D=(0,Q.jsxs)(`div`,{className:`ml-auto flex min-h-6 shrink-0 items-center justify-end gap-2`,children:[C,w,T,E]}),t[38]=C,t[39]=w,t[40]=T,t[41]=E,t[42]=D):D=t[42];let O;t[43]!==D||t[44]!==S?(O=(0,Q.jsxs)(`div`,{className:`flex min-h-6 min-w-0 flex-col gap-2 sm:-my-0.5 sm:flex-row sm:items-center`,children:[S,D]}),t[43]=D,t[44]=S,t[45]=O):O=t[45];let k;return t[46]!==O||t[47]!==_||t[48]!==v?(k=(0,Q.jsxs)(`div`,{className:_,children:[v,O]}),t[46]=O,t[47]=_,t[48]=v,t[49]=k):k=t[49],k});function Pi(e){let t=(0,Z.c)(14),{endpoint:n,hiddenEndpointCount:r,expanded:i,onToggleExpanded:a,fallback:o}=e;if(!n)return o;let s;t[0]===n.httpBaseUrl?s=t[1]:(s=(0,Q.jsx)(`span`,{className:`min-w-0 truncate`,children:n.httpBaseUrl}),t[0]=n.httpBaseUrl,t[1]=s);let c;t[2]!==i||t[3]!==r?(c=r>0?(0,Q.jsx)(`span`,{className:`shrink-0 text-xs font-medium`,children:i?`Hide`:`+${r}`}):null,t[2]=i,t[3]=r,t[4]=c):c=t[4];let l;t[5]!==s||t[6]!==c?(l=(0,Q.jsxs)(Q.Fragment,{children:[s,c]}),t[5]=s,t[6]=c,t[7]=l):l=t[7];let u=l,d;t[8]===Symbol.for(`react.memo_cache_sentinel`)?(d=(0,Q.jsx)(`span`,{className:`shrink-0`,children:`Reachable at`}),t[8]=d):d=t[8];let f;return t[9]!==i||t[10]!==r||t[11]!==a||t[12]!==u?(f=(0,Q.jsxs)(`span`,{className:`inline-flex min-w-0 max-w-full items-baseline gap-1`,children:[d,r>0?(0,Q.jsx)(`button`,{type:`button`,className:`inline-flex min-w-0 max-w-full items-baseline gap-2 border-b border-dotted border-muted-foreground/60 text-left text-muted-foreground underline-offset-4 hover:border-foreground hover:text-foreground`,onClick:a,"aria-expanded":i,children:u}):(0,Q.jsx)(`span`,{className:`inline-flex min-w-0 max-w-full items-baseline gap-2`,children:u})]}),t[9]=i,t[10]=r,t[11]=a,t[12]=u,t[13]=f):f=t[13],f}function Fi(e){if(!e.entry.enabled&&e.connection.phase!==`unsupported`)return{text:`Off`,tone:`muted`};let{connection:t}=e;switch(t.phase){case`connected`:return{text:`Connected`,tone:`muted`};case`connecting`:return{text:`Connecting`,tone:`muted`};case`reconnecting`:return{text:t.error?`Reconnecting: ${t.error}`:`Reconnecting`,tone:`error`};case`unsupported`:return{text:`Client not supported`,tone:`muted`};case`error`:return{text:t.error?`Connection failed: ${t.error}`:`Connection failed`,tone:`error`};case`offline`:return{text:`Offline`,tone:`muted`};case`available`:return{text:`Not connected`,tone:`muted`}}}function Ii(e){let t=(0,Z.c)(161),{environment:n,removingEnvironmentId:r,onSetEnabled:i,onRemove:o,onAddRoute:s}=e,[c,l]=(0,$.useState)(!1),[u,p]=(0,$.useState)(!1),h=n.environmentId,g=n.connection.phase===`unsupported`,_=n.entry.enabled&&!g,v=n.connection.phase===`connected`,y=r===h,b=n.connection.traceId,S;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(S={target:`trace ID`,onCopy:Wi,onError:Ui},t[0]=S):S=t[0];let{copyToClipboard:C}=Ye(S),w;t[1]===C?w=t[2]:(w=e=>{C(e,{traceId:e})},t[1]=C,t[2]=w);let T=w,E;t[3]===Symbol.for(`react.memo_cache_sentinel`)?(E={target:`MCP URL`,onCopy:Hi,onError:Vi},t[3]=E):E=t[3];let{copyToClipboard:D}=Ye(E),O;t[4]===n.serverConfig?O=t[5]:(O=Un(n.serverConfig),t[4]=n.serverConfig,t[5]=O);let k=O,A;t[6]===h?A=t[7]:(A=nt.updateStateAtom(h),t[6]=h,t[7]=A);let j=N(A),F=j.status===`running`&&j.stage===`resuming`,ee;t[8]===n?ee=t[9]:(ee=Fi(n),t[8]=n,t[9]=ee);let te=ee,ne=n.serverConfig?.environment.serverVersion??null,re=et(),ie;t[10]!==h||t[11]!==re.environments?(ie=x(re.environments.get(h)?.status??a())?.descriptor,t[10]=h,t[11]=re.environments,t[12]=ie):ie=t[12];let ae=ie,[oe,se]=(0,$.useState)(ae);ae!==void 0&&ae!==oe&&se(ae);let ce;t[13]!==h||t[14]!==re.environments?(ce=re.environments.get(h)?.environment.endpoint.httpBaseUrl,t[13]=h,t[14]=re.environments,t[15]=ce):ce=t[15];let I=ce,[le,ue]=(0,$.useState)(I);I!==void 0&&I!==le&&ue(I);let L=ct(h),de=v&&L._tag===`Some`?L.value.target:null,R=I??le,pe;t[16]!==de||t[17]!==n.entry||t[18]!==R?(pe=Be({entry:n.entry,relayHttpBaseUrl:R,connectedTarget:de}),t[16]=de,t[17]=n.entry,t[18]=R,t[19]=pe):pe=t[19];let me=pe,he;t[20]!==n.serverConfig||t[21]!==oe?(he=n.serverConfig??(oe===void 0?null:{environment:oe}),t[20]=n.serverConfig,t[21]=oe,t[22]=he):he=t[22];let ve;t[23]===he?ve=t[24]:(ve=Ce(he),t[23]=he,t[24]=ve);let ye=ve,B;t[25]===n.entry?B=t[26]:(B=Ne(n.entry),t[25]=n.entry,t[26]=B);let xe=B.length,Se;t[27]!==de||t[28]!==n?(Se=xr(n,de),t[27]=de,t[28]=n,t[29]=Se):Se=t[29];let V=F?`Restarting`:te.text,we=_&&k?ne:null,Te;t[30]!==Se||t[31]!==V||t[32]!==we?(Te=[Se,V,we].filter(Bi),t[30]=Se,t[31]=V,t[32]=we,t[33]=Te):Te=t[33];let Ee=Te.join(` · `),De=_&&v&&k!==null&&(j.status===`idle`||j.status===`failed`),Oe;t[34]!==_||t[35]!==n.connection||t[36]!==g?(Oe=g?n.connection.error??Ue(n.connection):_?Ue(n.connection):`Switched off`,t[34]=_,t[35]=n.connection,t[36]=g,t[37]=Oe):Oe=t[37];let ke=`${Oe}${k?`\nUpdate available: ${k.serverVersion} → ${k.clientVersion}`:``}`,Ae=n.label,je=!_,Me=_&&te.tone===`error`&&!F&&`text-destructive`,Pe;t[38]===Me?Pe=t[39]:(Pe=ge(`min-w-0 truncate`,Me),t[38]=Me,t[39]=Pe);let Fe;t[40]===Pe?Fe=t[41]:(Fe=(0,Q.jsx)(`span`,{className:Pe}),t[40]=Pe,t[41]=Fe);let H;t[42]!==ke||t[43]!==Ee||t[44]!==Fe?(H=(0,Q.jsx)(Xe,{payload:ke,render:Fe,children:Ee}),t[42]=ke,t[43]=Ee,t[44]=Fe,t[45]=H):H=t[45];let Ie;t[46]===ke?Ie=t[47]:(Ie=(0,Q.jsx)(Ze,{side:`top`,className:`whitespace-pre-wrap`,children:ke}),t[46]=ke,t[47]=Ie);let U;t[48]!==H||t[49]!==Ie?(U=(0,Q.jsxs)(Qe,{children:[H,Ie]}),t[48]=H,t[49]=Ie,t[50]=U):U=t[50];let W;t[51]===Symbol.for(`react.memo_cache_sentinel`)?(W=(0,Q.jsx)(`span`,{"aria-hidden":!0,className:`shrink-0`,children:`·`}),t[51]=W):W=t[51];let Le;t[52]===Symbol.for(`react.memo_cache_sentinel`)?(Le=()=>l(zi),t[52]=Le):Le=t[52];let ze=xe===1?`Routes`:`${xe} routes`,Ve=c&&`rotate-90`,He;t[53]===Ve?He=t[54]:(He=ge(`size-3 shrink-0 transition-transform duration-150 motion-reduce:transition-none`,Ve),t[53]=Ve,t[54]=He);let G;t[55]===He?G=t[56]:(G=(0,Q.jsx)(be,{"aria-hidden":!0,className:He}),t[55]=He,t[56]=G);let We;t[57]!==c||t[58]!==ze||t[59]!==G?(We=(0,Q.jsxs)(`button`,{type:`button`,"aria-expanded":c,onClick:Le,className:`inline-flex shrink-0 items-center gap-0.5 rounded-sm text-muted-foreground outline-none hover:text-foreground focus-visible:ring-1 focus-visible:ring-inset focus-visible:ring-ring`,children:[ze,G]}),t[57]=c,t[58]=ze,t[59]=G,t[60]=We):We=t[60];let Ge;t[61]===Symbol.for(`react.memo_cache_sentinel`)?(Ge=(0,Q.jsx)(`span`,{"aria-hidden":!0,className:`shrink-0`,children:`·`}),t[61]=Ge):Ge=t[61];let Ke=`remote-permissions-${h}`,qe;t[62]===Symbol.for(`react.memo_cache_sentinel`)?(qe=()=>p(Ri),t[62]=qe):qe=t[62];let Je=u&&`rotate-90`,K;t[63]===Je?K=t[64]:(K=ge(`size-3 shrink-0 transition-transform duration-150 motion-reduce:transition-none`,Je),t[63]=Je,t[64]=K);let q;t[65]===K?q=t[66]:(q=(0,Q.jsx)(be,{"aria-hidden":!0,className:K}),t[65]=K,t[66]=q);let $e;t[67]!==u||t[68]!==Ke||t[69]!==q?($e=(0,Q.jsxs)(`button`,{type:`button`,"aria-expanded":u,"aria-controls":Ke,onClick:qe,className:`inline-flex shrink-0 items-center gap-0.5 rounded-sm text-muted-foreground outline-none hover:text-foreground focus-visible:ring-1 focus-visible:ring-inset focus-visible:ring-ring`,children:[`Permissions`,q]}),t[67]=u,t[68]=Ke,t[69]=q,t[70]=$e):$e=t[70];let tt;t[71]!==U||t[72]!==We||t[73]!==$e?(tt=(0,Q.jsxs)(`span`,{className:`flex min-w-0 items-center gap-1`,children:[U,W,We,Ge,$e]}),t[71]=U,t[72]=We,t[73]=$e,t[74]=tt):tt=t[74];let J;t[75]===j?J=t[76]:(J=j.status===`idle`?null:(0,Q.jsx)(`div`,{className:`mt-1 max-w-md`,children:(0,Q.jsx)(Xn,{state:j})}),t[75]=j,t[76]=J);let rt;t[77]!==n||t[78]!==s||t[79]!==c?(rt=c&&(0,Q.jsx)(gr,{environment:n,onAddRoute:()=>s(n)}),t[77]=n,t[78]=s,t[79]=c,t[80]=rt):rt=t[80];let it;t[81]!==h||t[82]!==v||t[83]!==u?(it=u&&(0,Q.jsx)(`div`,{id:`remote-permissions-${h}`,className:`mt-2 border-t border-border/50`,children:(0,Q.jsx)(lr,{environmentId:h,connected:v,routeContext:!0})}),t[81]=h,t[82]=v,t[83]=u,t[84]=it):it=t[84];let at;t[85]!==rt||t[86]!==it?(at=(0,Q.jsxs)(Q.Fragment,{children:[rt,it]}),t[85]=rt,t[86]=it,t[87]=at):at=t[87];let ot;t[88]!==n.entry.serverUpdateRequired||t[89]!==n.label||t[90]!==h||t[91]!==oe?.serverVersion||t[92]!==j.status||t[93]!==g?(ot=g&&n.entry.serverUpdateRequired===!0&&j.status!==`running`?(0,Q.jsx)(nr,{environmentId:h,serverLabel:`${n.label} server`,fromVersion:oe?.serverVersion,targetVersion:Re,label:j.status===`failed`?`Retry update`:`Update`}):null,t[88]=n.entry.serverUpdateRequired,t[89]=n.label,t[90]=h,t[91]=oe?.serverVersion,t[92]=j.status,t[93]=g,t[94]=ot):ot=t[94];let st;t[95]!==n.label||t[96]!==n.serverConfig||t[97]!==h||t[98]!==j.status||t[99]!==De||t[100]!==k?(st=De?(0,Q.jsx)(Zn,{environmentId:h,serverLabel:`${n.label} server`,selfUpdate:On(n.serverConfig),installation:n.serverConfig?.environment.capabilities.serverInstallation,desktopAppUpdate:Rn(n.serverConfig),threadContinuation:tr(n.serverConfig),targetVersion:k.clientVersion,label:j.status===`failed`?`Retry update`:`Update`,appearance:`icon`}):null,t[95]=n.label,t[96]=n.serverConfig,t[97]=h,t[98]=j.status,t[99]=De,t[100]=k,t[101]=st):st=t[101];let lt=y||g,ut=`${_?`Switch off`:`Switch on`} ${n.label}`,dt;t[102]!==h||t[103]!==i?(dt=e=>i(h,e),t[102]=h,t[103]=i,t[104]=dt):dt=t[104];let ft;t[105]!==_||t[106]!==lt||t[107]!==ut||t[108]!==dt?(ft=(0,Q.jsx)(Xe,{render:(0,Q.jsx)(Fn,{size:`sm`,checked:_,disabled:lt,"aria-label":ut,onCheckedChange:dt})}),t[105]=_,t[106]=lt,t[107]=ut,t[108]=dt,t[109]=ft):ft=t[109];let Y=g?`Client not supported`:_?`Switch off`:`Switch on`,pt;t[110]===Y?pt=t[111]:(pt=(0,Q.jsx)(Ze,{side:`top`,children:Y}),t[110]=Y,t[111]=pt);let mt;t[112]!==ft||t[113]!==pt?(mt=(0,Q.jsxs)(Qe,{children:[ft,pt]}),t[112]=ft,t[113]=pt,t[114]=mt):mt=t[114];let ht=`More actions for ${n.label}`,gt;t[115]!==y||t[116]!==ht?(gt=(0,Q.jsx)(z,{type:`button`,variant:`ghost-muted`,size:`icon-xs`,disabled:y,"aria-label":ht}),t[115]=y,t[116]=ht,t[117]=gt):gt=t[117];let _t;t[118]===Symbol.for(`react.memo_cache_sentinel`)?(_t=(0,Q.jsx)(d,{className:`size-3.5`}),t[118]=_t):_t=t[118];let vt;t[119]===gt?vt=t[120]:(vt=(0,Q.jsx)(fe,{render:gt,children:_t}),t[119]=gt,t[120]=vt);let yt;t[121]!==n.serverConfig||t[122]!==h?(yt=(0,Q.jsx)(hr,{environmentId:h,serverConfig:n.serverConfig}),t[121]=n.serverConfig,t[122]=h,t[123]=yt):yt=t[123];let bt,xt;t[124]===Symbol.for(`react.memo_cache_sentinel`)?(bt=()=>l(Li),xt=(0,Q.jsx)(m,{}),t[124]=bt,t[125]=xt):(bt=t[124],xt=t[125]);let St=c?`Hide routes`:`Routes`,Ct;t[126]===St?Ct=t[127]:(Ct=(0,Q.jsxs)(M,{onClick:bt,children:[xt,St]}),t[126]=St,t[127]=Ct);let wt;t[128]!==D||t[129]!==me?(wt=me?(0,Q.jsx)(M,{onClick:()=>D(me,{url:me}),children:`Copy MCP URL`}):null,t[128]=D,t[129]=me,t[130]=wt):wt=t[130];let Tt;t[131]!==T||t[132]!==b?(Tt=b?(0,Q.jsx)(M,{onClick:()=>T(b),children:`Copy trace ID`}):null,t[131]=T,t[132]=b,t[133]=Tt):Tt=t[133];let Et;t[134]===Symbol.for(`react.memo_cache_sentinel`)?(Et=(0,Q.jsx)(_e,{}),t[134]=Et):Et=t[134];let Dt;t[135]!==n||t[136]!==o?(Dt=()=>o(n),t[135]=n,t[136]=o,t[137]=Dt):Dt=t[137];let Ot=y?`Removing…`:`Remove from this device…`,kt;t[138]!==Dt||t[139]!==Ot?(kt=(0,Q.jsx)(M,{variant:`destructive`,onClick:Dt,children:Ot}),t[138]=Dt,t[139]=Ot,t[140]=kt):kt=t[140];let At;t[141]!==yt||t[142]!==Ct||t[143]!==wt||t[144]!==Tt||t[145]!==kt?(At=(0,Q.jsxs)(P,{align:`end`,children:[yt,Ct,wt,Tt,Et,kt]}),t[141]=yt,t[142]=Ct,t[143]=wt,t[144]=Tt,t[145]=kt,t[146]=At):At=t[146];let jt;t[147]!==vt||t[148]!==At?(jt=(0,Q.jsxs)(f,{children:[vt,At]}),t[147]=vt,t[148]=At,t[149]=jt):jt=t[149];let Mt;return t[150]!==n.label||t[151]!==ye||t[152]!==je||t[153]!==tt||t[154]!==J||t[155]!==at||t[156]!==ot||t[157]!==st||t[158]!==mt||t[159]!==jt?(Mt=(0,Q.jsxs)(Sr,{kind:ye,label:Ae,dimmed:je,subtitle:tt,below:J,detail:at,children:[ot,st,mt,jt]}),t[150]=n.label,t[151]=ye,t[152]=je,t[153]=tt,t[154]=J,t[155]=at,t[156]=ot,t[157]=st,t[158]=mt,t[159]=jt,t[160]=Mt):Mt=t[160],Mt}function Li(e){return!e}function Ri(e){return!e}function zi(e){return!e}function Bi(e){return e!==null}function Vi(e){q.add(ht({type:`error`,title:`Could not copy MCP URL`,description:e.message}))}function Hi(e){let{url:t}=e;q.add({type:`success`,title:`MCP URL copied`,description:`Add it to an agent, e.g. claude mcp add --transport http p4 ${t}`})}function Ui(e){q.add(ht({type:`error`,title:`Could not copy trace ID`,description:e.message}))}function Wi(e){let{traceId:t}=e;q.add({type:`success`,title:`Trace ID copied`,description:t})}function Gi(e){let t=(0,Z.c)(10),{checked:n,disabled:r,disabledReason:i,onCheckedChange:a,ariaLabel:o}=e,s=o===void 0?`Enable P4 Connect`:o,c;t[0]===a?c=t[1]:(c=a?{onCheckedChange:a}:{},t[0]=a,t[1]=c);let l;t[2]!==s||t[3]!==n||t[4]!==r||t[5]!==c?(l=(0,Q.jsx)(Fn,{"aria-label":s,checked:n,disabled:r,...c}),t[2]=s,t[3]=n,t[4]=r,t[5]=c,t[6]=l):l=t[6];let u=l,d;return t[7]!==u||t[8]!==i?(d=i?(0,Q.jsxs)(Qe,{children:[(0,Q.jsx)(Xe,{render:(0,Q.jsx)(`span`,{className:`inline-flex`,children:u})}),(0,Q.jsx)(Ze,{side:`top`,children:i})]}):u,t[7]=u,t[8]=i,t[9]=d):d=t[9],d}function Ki(e){let t=(0,Z.c)(44),{canManageRelay:n}=e,r=J(),{isSignedIn:i,linkState:a,linkRevoked:o,managedTunnelActive:s,managedTunnelOutOfSync:c,publishAgentActivity:l,holdWebhooksWhileOffline:u,operationError:d,reconcileCloudState:f}=ir(),[p,m]=(0,$.useState)(!1),[h,g]=(0,$.useState)(!1),_=i?n?null:`Your session does not have permission to manage P4 Connect access.`:`Sign in to P4 Connect to manage this environment.`,v=p||h,y;t[0]!==r||t[1]!==l||t[2]!==f?(y=async e=>{r!==null&&st(r,`relay:write`)&&(m(!0),await f({managedTunnel:e,publish:l})&&q.add({type:`success`,title:e?`P4 Connect linked`:l?`P4 Connect tunnel disabled`:`P4 Connect unlinked`,description:e?`This environment is available through P4 Connect.`:l?`The managed tunnel was removed. Agent activity publishing stays on.`:`This environment is no longer available through P4 Connect.`}),m(!1))},t[0]=r,t[1]=l,t[2]=f,t[3]=y):y=t[3];let b=y,x;t[4]!==s||t[5]!==r||t[6]!==f?(x=async e=>{r!==null&&st(r,`relay:write`)&&(g(!0),await f({managedTunnel:s,publish:e})&&q.add({type:`success`,title:e?`Agent activity enabled`:`Agent activity disabled`,description:e?`This environment publishes agent activity to your mobile clients.`:`This environment will stop publishing agent activity.`}),g(!1))},t[4]=s,t[5]=r,t[6]=f,t[7]=x):x=t[7];let S=x,C;t[8]!==s||t[9]!==l||t[10]!==f?(C=async e=>{g(!0),await f({managedTunnel:s,publish:l,holdWebhooksWhileOffline:e})&&q.add({type:`success`,title:e?`Webhooks held while offline`:`Webhooks no longer held`,description:e?`P4 Connect keeps webhook requests for up to 24 hours while this environment is offline.`:`Requests to an offline environment now fail. Anything already held is still delivered.`}),g(!1)},t[8]=s,t[9]=l,t[10]=f,t[11]=C):C=t[11];let w=C,T;t[12]!==n||t[13]!==_||t[14]!==v||t[15]!==i||t[16]!==o||t[17]!==s||t[18]!==c||t[19]!==d||t[20]!==a||t[21]!==b?(T=window.desktopBridge?(0,Q.jsx)(gn,{title:$n(`t3-connect`).title,description:o?`This environment was removed from P4 Connect. Turn it on to link it again.`:s?`This environment is available to your other devices through P4 Connect.`:c?`P4 Connect is out of sync. This environment is linked only to publish agent activity, so other devices cannot connect. Turn P4 Connect on to repair it.`:`Make this environment available to your other devices through P4 Connect.`,status:d??a.error,control:(0,Q.jsx)(Gi,{checked:s,disabled:!n||!i||a.data===null||a.isPending||v,disabledReason:_,onCheckedChange:e=>void b(e)})}):o?(0,Q.jsx)(gn,{title:$n(`t3-connect`).title,description:"This environment was removed from P4 Connect. Run `p4c connect link` on the host to link it again."}):null,t[12]=n,t[13]=_,t[14]=v,t[15]=i,t[16]=o,t[17]=s,t[18]=c,t[19]=d,t[20]=a,t[21]=b,t[22]=T):T=t[22];let E;t[23]===Symbol.for(`react.memo_cache_sentinel`)?(E=$n(`publish-agent-activity`),t[23]=E):E=t[23];let D=!n||!i||a.data===null||a.isPending||v,O;t[24]===S?O=t[25]:(O=e=>void S(e),t[24]=S,t[25]=O);let k;t[26]!==_||t[27]!==l||t[28]!==D||t[29]!==O?(k=(0,Q.jsx)(gn,{title:E.title,description:`Send activity to mobile notifications and Live Activities without P4 Connect.`,control:(0,Q.jsx)(Gi,{ariaLabel:`Publish agent activity to mobile clients`,checked:l,disabled:D,disabledReason:_,onCheckedChange:O})}),t[26]=_,t[27]=l,t[28]=D,t[29]=O,t[30]=k):k=t[30];let A;t[31]!==n||t[32]!==_||t[33]!==u||t[34]!==v||t[35]!==i||t[36]!==s||t[37]!==a||t[38]!==w?(A=s?(0,Q.jsx)(gn,{title:$n(`hold-webhooks-while-offline`).title,description:`Keep webhook requests for up to 24 hours while this environment is offline, then deliver them. Off: P4 Connect only forwards requests and stores nothing.`,control:(0,Q.jsx)(Gi,{ariaLabel:`Hold webhook requests while this environment is offline`,checked:u,disabled:!n||!i||a.isPending||v,disabledReason:_,onCheckedChange:e=>void w(e)})}):null,t[31]=n,t[32]=_,t[33]=u,t[34]=v,t[35]=i,t[36]=s,t[37]=a,t[38]=w,t[39]=A):A=t[39];let j;return t[40]!==T||t[41]!==k||t[42]!==A?(j=(0,Q.jsxs)(Q.Fragment,{children:[T,k,A]}),t[40]=T,t[41]=k,t[42]=A,t[43]=j):j=t[43],j}function qi(e){let t=(0,Z.c)(3),{canReadRelay:n,canManageRelay:r}=e;if(!Pe())return null;if(!n){let e;return t[0]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,Q.jsx)(gn,{title:`P4 Connect`,description:`To edit these settings, pair this connection with both View relay and Manage relay permissions.`}),t[0]=e):e=t[0],e}let i;return t[1]===r?i=t[2]:(i=(0,Q.jsx)(Ki,{canManageRelay:r}),t[1]=r,t[2]=i),i}function Ji(e){let t=(0,Z.c)(4),{cloudEnabled:n}=e,r=n===void 0||n,i;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(i=(0,Q.jsx)(Rt,{variant:`icon`,children:(0,Q.jsx)(re,{})}),t[0]=i):i=t[0];let a;t[1]===Symbol.for(`react.memo_cache_sentinel`)?(a=(0,Q.jsx)(Bt,{children:`No saved remote environments`}),t[1]=a):a=t[1];let o=r?`Click “Add environment” to pair another environment, or connect one from P4 Connect.`:`Click “Add environment” to pair another environment.`,s;return t[2]===o?s=t[3]:(s=(0,Q.jsxs)(Ht,{className:`min-h-52`,children:[i,(0,Q.jsxs)(zt,{children:[a,(0,Q.jsx)(Vt,{children:o})]})]}),t[2]=o,t[3]=s),s}function Yi(e){let t=(0,Z.c)(3),{primaryEnvironmentId:n,savedEnvironments:r}=e,i;return t[0]!==n||t[1]!==r?(i=Pe()?(0,Q.jsx)(rr,{primaryEnvironmentId:n,savedEnvironments:r,empty:(0,Q.jsx)(Ji,{})}):r.length===0?(0,Q.jsx)(Ji,{cloudEnabled:!1}):null,t[0]=n,t[1]=r,t[2]=i):i=t[2],i}function Xi(){let e=window.desktopBridge,t=N(it),{environments:n}=$e(),r=tt(),a=ut(En,{reportFailure:!1}),o=ut(Tn,{reportFailure:!1}),s=ut(rt.remove,{reportFailure:!1}),c=ut(rt.register,{reportFailure:!1}),l=et(),u=ut(rt.setEnabled,{reportFailure:!1}),p=r?.environmentId??null,m=wn(),h=m.data?.authenticated?m.data.permissions??m.data.scopes??null:null,_=e?null:m.data?.auth.policy??null,v=(0,$.useMemo)(()=>n.filter(e=>e.entry.target._tag!==`PrimaryConnectionTarget`),[n]),y=(0,$.useMemo)(()=>v.filter(e=>!He(e.entry.target)),[v]),b=(0,$.useMemo)(()=>i(e=>v.map(t=>({environment:t,updateStatus:e(nt.updateStateAtom(t.environmentId)).status}))),[v]),x=N(b),C=(0,$.useMemo)(()=>x.flatMap(({environment:e,updateStatus:t})=>{let n=Un(e.serverConfig),r=On(e.serverConfig),i=Rn(e.serverConfig);return!n||t===`running`||!e.entry.enabled||e.connection.phase!==`connected`||He(e.entry.target)||r===null||r===`desktop-managed`&&!i?[]:[{environmentId:e.environmentId,serverLabel:e.label,selfUpdate:r,installation:e.serverConfig?.environment.capabilities.serverInstallation,desktopAppUpdate:i,threadContinuation:tr(e.serverConfig),continueThreadsAfterServerUpdate:e.serverConfig?.settings.continueThreadsAfterServerUpdate??!1,targetVersion:n.clientVersion}]}),[x]),w=(0,$.useMemo)(()=>[...r?[r]:[],...v.filter(e=>e.entry.enabled)],[r,v]),T=(0,$.useMemo)(()=>{let e=new Set;for(let t of v){let n=t.entry.profile;if(t.entry.target._tag!==`SshConnectionTarget`||g(n)||n.value._tag!==`SshConnectionProfile`)continue;let r=n.value.target;e.add(r.alias),e.add(br(r))}return e},[v]),[D,O]=(0,$.useState)(null),[k,A]=(0,$.useState)(null),[j,M]=(0,$.useState)(()=>new Map),F=(0,$.useCallback)(e=>{M(t=>new Map(t).set(e.id,e.credential))},[]),[te,ne]=(0,$.useState)(null),[ie,oe]=(0,$.useState)(null),[se,ce]=(0,$.useState)(!1),[I,le]=(0,$.useState)(!1),[L,de]=(0,$.useState)(null),[R,pe]=(0,$.useState)(`remote`),[he,_e]=(0,$.useState)(``),[ve,ye]=(0,$.useState)(``),[B,Se]=(0,$.useState)(``),[V,we]=(0,$.useState)(``),[Te,Ee]=(0,$.useState)(``),[Oe,Ae]=(0,$.useState)(!1),Me=(0,$.useRef)(void 0),[Ne,H]=(0,$.useState)(null),[U,W]=(0,$.useState)(!1),[Le,Re]=(0,$.useState)(null),[ze,Be]=(0,$.useState)(!1),[Ve,Ue]=(0,$.useState)(!1),[G,Ye]=(0,$.useState)(!1),[J,at]=(0,$.useState)(!1),[ct,ft]=(0,$.useState)(null),[Y,pt]=(0,$.useState)(null),mt=Y!==null,[gt,_t]=(0,$.useState)(null),[vt,Lt]=(0,$.useState)(!1),[Rt,zt]=(0,$.useState)(String(ti)),[Bt,Vt]=(0,$.useState)(null),Ht=r?.serverConfig??null,Jt=Un(Ht),Yt=N(nt.updateStateAtom(p)),[Xt,Zt]=(0,$.useState)(!1),Qt=$t(e=>e.defaultAdvertisedEndpointKey),en=$t(e=>e.setDefaultAdvertisedEndpointKey),tn=ot(p,me),nn=ot(p,ue),rn=ot(p,xe),an=ot(p,ae),on=ot(p,E),sn=!Ie()&&an,cn=lt(tn&&p!==null?Br.accessChanges({environmentId:p,input:null}):null),ln=lt(sn&&e?qr:null),un=e!==void 0&&I&&R===`ssh`,dn=lt(un?ei:null),pn=dn.refresh;(0,$.useEffect)(()=>{un&&pn()},[un,pn]);let yn=lt(sn&&e?Kn:null),X=yn.data,xn=ct??yn.error,kn=yn.isPending&&yn.data===null,Pn=dn.data??ri,zn=(0,$.useMemo)(()=>Pn.filter(e=>{let t=br(e);return!T.has(e.alias)&&!T.has(t)}),[Pn,T]),Hn=(0,$.useMemo)(()=>Yr(zn,B),[B,zn]),Wn=dn.isPending&&dn.data===null,Gn=dn.error,Jn=e!==void 0&&(Wn||zn.length>0),Yn=ln.data?.serverExposureState??null,Qn=ln.data?.advertisedEndpoints??ni,nr=D??ln.error,rr=k??cn.error,ir=cn.isPending&&cn.data===null,ar=(0,$.useMemo)(()=>{let e=cn.data;return e?.type===`snapshot`?_i(e.payload.pairingLinks.map(e=>bi(e))):[]},[cn.data]),or=(0,$.useMemo)(()=>{let e=cn.data;return e?.type===`snapshot`?yi(e.payload.clientSessions.map(e=>xi(e))):[]},[cn.data]),Z=e?Yn?.mode===`network-accessible`:_===`remote-reachable`,cr=Rt.trim(),ur=Number(cr),dr=/^\d+$/u.test(cr)&&Number.isInteger(ur)&&ur>=1&&ur<=65535,pr=(0,$.useMemo)(()=>{if(!gt)return null;if(!dr||ur===ti)return gt.httpBaseUrl;try{let e=new URL(gt.httpBaseUrl);return e.port=String(ur),e.toString().replace(/\/$/u,``)}catch{return gt.httpBaseUrl}},[dr,ur,gt]),mr=(0,$.useCallback)(async t=>{if(e&&p!==null&&st(p,`environment:maintain`)){Be(!0),O(null);try{await e.setServerExposureMode(t?`network-accessible`:`local-only`),Jr(),Ue(!1),Be(!1)}catch(e){let t=e instanceof Error?e.message:`Failed to update network exposure.`;Ue(!1),O(t),q.add(ht({type:`error`,title:`Could not update network access`,description:t})),Be(!1)}}},[e,p]),gr=(0,$.useCallback)(()=>{Bt!==null&&mr(Bt===`network-accessible`)},[mr,Bt]),_r=(0,$.useCallback)(async()=>{if(e&&p!==null&&st(p,`environment:maintain`)&&dr){Ye(!0),O(null);try{await e.setTailscaleServeEnabled({enabled:!0,port:ur}),Jr(),_t(null)}catch(e){let t=e instanceof Error?e.message:`Failed to configure Tailscale HTTPS.`;O(t),q.add(ht({type:`error`,title:`Could not set up Tailscale HTTPS`,description:t}))}finally{Ye(!1)}}},[e,dr,ur,p]),vr=(0,$.useCallback)(e=>{zt(String(Yn?.tailscaleServePort??ti)),_t(e)},[Yn?.tailscaleServePort]),yr=(0,$.useCallback)(async()=>{if(e&&p!==null&&st(p,`environment:maintain`)){Ye(!0),O(null);try{await e.setTailscaleServeEnabled({enabled:!1,port:Yn?.tailscaleServePort??ti}),Jr(),Lt(!1)}catch(e){let t=e instanceof Error?e.message:`Failed to disable Tailscale HTTPS.`;O(t),q.add(ht({type:`error`,title:`Could not disable Tailscale HTTPS`,description:t}))}finally{Ye(!1)}}},[e,Yn,p]),xr=(0,$.useCallback)(e=>{Lt(!0)},[]),Sr=(0,$.useCallback)(async e=>{if(p!==null&&st(p,`access:write`)){ne(e),A(null);try{await Cn(e)}catch(e){let t=e instanceof Error?e.message:`Failed to revoke pairing link.`;A(t),q.add(ht({type:`error`,title:`Could not revoke pairing link`,description:t}))}finally{ne(null)}}},[p]),Cr=(0,$.useCallback)(async e=>{if(p!==null&&st(p,`access:write`)){oe(e),A(null);try{await Sn(e)}catch(e){let t=e instanceof Error?e.message:`Failed to revoke client access.`;A(t),q.add(ht({type:`error`,title:`Could not revoke client access`,description:t}))}finally{oe(null)}}},[p]),wr=(0,$.useCallback)(async()=>{if(p!==null&&st(p,`access:write`)){ce(!0),A(null);try{let e=await bn();q.add({type:`success`,title:e===1?`Revoked 1 other client`:`Revoked ${e} clients`,description:`Other paired clients will need a new pairing link before reconnecting.`})}catch(e){let t=e instanceof Error?e.message:`Failed to revoke other clients.`;A(t),q.add(ht({type:`error`,title:`Could not revoke other clients`,description:t}))}finally{ce(!1)}}},[p]),Tr=(0,$.useCallback)(async e=>{W(!0),H(null);let t=await o({target:e,label:``,...L?{expectedEnvironmentId:L.environmentId}:{}});if(t._tag===`Failure`){ke(t)||H(pi(je(t))),W(!1);return}_e(``),ye(``),Se(``),we(``),Ee(``),le(!1),q.add({type:`success`,title:L?`Route added`:`Environment connected`,description:L?`${L.label} can now be reached over SSH ${e.alias}.`:`${e.alias} is ready over an SSH-managed tunnel.`}),W(!1)},[o,L]),Er=(0,$.useCallback)(async()=>{if(R===`ssh`){let e;try{e=ui({host:B,username:V,port:Te})}catch(e){H(pi(e));return}await Tr(e);return}W(!0),H(null);let e;try{e=fi({host:he,pairingCode:ve})}catch(e){let t=e instanceof Error?e.message:`Failed to add backend.`;H(t),q.add(ht({type:`error`,title:`Could not add backend`,description:t})),W(!1);return}let t=await a({...e,...L?{expectedEnvironmentId:L.environmentId}:{}});if(t._tag===`Failure`){if(!ke(t)){let e=je(t),n=e instanceof Error?e.message:`Failed to add backend.`;H(n),q.add(ht({type:`error`,title:`Could not add backend`,description:n}))}W(!1);return}_e(``),ye(``),Se(``),we(``),Ee(``),le(!1),q.add(L?{type:`success`,title:`Route added`,description:`${L.label} now has another way to connect.`}:{type:`success`,title:`Backend added`,description:`The environment is saved and will reconnect on app startup.`}),W(!1)},[L,a,Tr,he,R,ve,B,Te,V]),Or=(0,$.useCallback)(e=>{e.nativeEvent.isComposing||e.keyCode===229||e.key===`Enter`&&B.trim().length>0&&(e.preventDefault(),Er())},[Er,B]),kr=(0,$.useCallback)(async t=>{if(U||!e)return;W(!0),H(null),Se(t.alias);let n;try{n=await e.resolveSshHost(t.alias)}catch(e){H(pi(e)),W(!1);return}we(n.username??``),Ee(n.port===null?``:String(n.port)),await Tr(n)},[Tr,e,U]),Ar=(0,$.useCallback)(e=>{if(e.nativeEvent.isComposing||e.keyCode===229)return;let n=Oe&&Jn;if(n){let n=Gt(e,t,{platform:navigator.platform,context:{modelPickerOpen:!1}}),r=Kt(n??``),i=r===null?void 0:Hn[r];if(i){e.preventDefault(),e.stopPropagation(),Ae(!1),kr(i);return}if(e.key===`Escape`){e.preventDefault(),e.stopPropagation();return}}let r=n&&Me.current!==void 0;!e.defaultPrevented&&!r&&e.key===`Enter`&&B.trim().length>0&&(e.preventDefault(),Er())},[Hn,Er,kr,Jn,t,B,Oe]),jr=(0,$.useCallback)(async(e,t)=>{H(null);let n=await u({environmentId:e,enabled:t});if(n._tag===`Failure`&&!ke(n)){let e=je(n),r=e instanceof Error?e.message:`Failed to switch the backend ${t?`on`:`off`}.`;H(r),q.add(ht({type:`error`,title:`Could not switch backend ${t?`on`:`off`}`,description:r}))}},[u]),Nr=(0,$.useCallback)(async e=>{let t=e.environmentId;Re(t),H(null);let n=await s(t);if(Re(null),n._tag===`Failure`&&!ke(n)){let e=je(n),t=e instanceof Error?e.message:`Failed to remove backend.`;H(t),q.add(ht({type:`error`,title:`Could not remove backend`,description:t}))}},[s]),[Fr,Ir]=(0,$.useState)(null),Lr=(0,$.useCallback)(async e=>{if(e.relayManaged&&Pe()){Ir(e);return}await dt(`Remove ${e.label} from this device?\nThis forgets its pairing, credentials, and cached threads here. Switch it off instead to keep it saved.`,{variant:`destructive`})===!0&&await Nr(e)},[Nr]),Rr=ar,zr=(0,$.useMemo)(()=>Qn.find(Ci)??null,[Qn]),Vr=(0,$.useMemo)(()=>Z?Qn.filter(e=>!Ci(e)):[],[Qn,Z]),Hr=(0,$.useMemo)(()=>zr?[...Vr,zr]:Vr,[zr,Vr]),Ur=(0,$.useMemo)(()=>Si(Vr,Qt),[Qt,Vr]),Wr=(0,$.useMemo)(()=>Ur??Si(zr?[zr]:[],Qt),[Qt,Ur,zr]),Gr=Wr?wi(Wr):null,Kr=(0,$.useCallback)(e=>{en(wi(e))},[en]),Xr=(0,$.useCallback)(e=>{let t=di(e);if(t){_e(t.host),ye(t.pairingCode);return}_e(e)},[]),Zr=e=>{let t=R===e.mode;return(0,Q.jsxs)(`button`,{type:`button`,"aria-pressed":t,className:ge(`group flex min-h-24 items-start gap-3 rounded-lg border p-4 text-left`,t?`border-primary/50 bg-primary/5`:`border-border/60 hover:bg-muted/40`),disabled:U,onClick:()=>{pe(e.mode)},children:[e.icon?(0,Q.jsx)(`span`,{className:ge(`mt-0.5 flex size-8 shrink-0 items-center justify-center rounded-md border`,t?`border-primary/30 bg-primary/10 text-primary`:`border-border/70 bg-background text-muted-foreground group-hover:text-foreground`),children:e.icon}):null,(0,Q.jsxs)(`span`,{className:`min-w-0`,children:[(0,Q.jsx)(`span`,{className:`block text-sm font-medium text-foreground`,children:e.title}),(0,Q.jsx)(`span`,{className:`mt-1 block text-xs leading-relaxed text-muted-foreground`,children:e.description})]})]})},Qr=()=>(0,Q.jsxs)(`div`,{className:`space-y-3`,children:[(0,Q.jsxs)(`div`,{className:`grid gap-3 sm:grid-cols-[minmax(0,1fr)_10rem]`,children:[(0,Q.jsxs)(`label`,{className:`block`,children:[(0,Q.jsx)(`span`,{className:`mb-1.5 block text-xs font-medium text-foreground`,children:`Host`}),(0,Q.jsx)(Et,{value:he,onChange:e=>Xr(e.target.value),placeholder:`backend.example.com`,disabled:U,spellCheck:!1})]}),(0,Q.jsxs)(`label`,{className:`block`,children:[(0,Q.jsx)(`span`,{className:`mb-1.5 block text-xs font-medium text-foreground`,children:`Pairing code`}),(0,Q.jsx)(Et,{value:ve,onChange:e=>ye(e.target.value),placeholder:`PAIRCODE`,disabled:U,spellCheck:!1})]})]}),(0,Q.jsx)(`div`,{children:(0,Q.jsx)(`span`,{className:`mt-1 block text-2xs text-muted-foreground`,children:`Paste a full pairing URL here to fill both fields automatically.`})})]}),$r=L!==null&&!L.relayManaged&&l.environments.has(L.environmentId)?l.environments.get(L.environmentId).environment:null,oi=async()=>{if($r===null||L===null)return;W(!0);let e=await c(new Fe({target:new De({environmentId:$r.environmentId,label:L.label})}));if(W(!1),e._tag===`Failure`){if(!ke(e)){let t=je(e);H(t instanceof Error?t.message:`Could not add the route.`)}return}le(!1),q.add({type:`success`,title:`Route added`,description:`${L.label} falls back to P4 Connect when its other routes are unreachable.`})},si=()=>(0,Q.jsxs)(`div`,{className:`space-y-4`,children:[$r===null?null:(0,Q.jsxs)(`div`,{className:`flex items-center justify-between gap-3 rounded-md border border-border px-3 py-2`,children:[(0,Q.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:`This machine is on your P4 Connect account. Use it as a fallback route.`}),(0,Q.jsx)(z,{size:`xs`,variant:`outline`,disabled:U,onClick:()=>void oi(),children:`Add P4 Connect`})]}),Qr(),Ne?(0,Q.jsx)(`p`,{className:`text-xs text-destructive`,children:Ne}):null,(0,Q.jsxs)(z,{variant:`outline`,className:`w-full`,disabled:U,onClick:()=>void Er(),children:[(0,Q.jsx)(S,{className:`size-3.5`}),U?`Adding…`:L?`Add route`:`Add environment`]})]}),ci=()=>(0,Q.jsx)(`div`,{className:`space-y-4`,children:(0,Q.jsxs)(`div`,{className:`space-y-3`,children:[(0,Q.jsxs)(`div`,{className:`block`,children:[(0,Q.jsx)(`label`,{htmlFor:`saved-backend-ssh-host`,className:`mb-1.5 block text-xs font-medium text-foreground`,children:`SSH host or alias`}),(0,Q.jsxs)(xt,{items:Hn,itemToStringValue:e=>e.alias,mode:`none`,openOnInputClick:!0,open:Oe,onOpenChange:Ae,onItemHighlighted:e=>{Me.current=e},value:B,onValueChange:(e,t)=>{if(Se(e),t.reason!==`item-press`)return;let n=Hn.find(t=>t.alias===e);n&&kr(n)},children:[(0,Q.jsx)(Ct,{id:`saved-backend-ssh-host`,onKeyDown:Ar,placeholder:`Search hosts or type devbox`,disabled:U,spellCheck:!1}),Jn?(0,Q.jsx)(wt,{children:Wn?(0,Q.jsx)(`div`,{className:`px-3 py-2 text-xs text-muted-foreground`,children:`Loading hosts…`}):Hn.length>0?(0,Q.jsx)(bt,{className:`max-h-72`,children:Hn.map((e,n)=>{let r=br(e),i=n<9?Wt(n):null,a=i?qt(t,i,navigator.platform):null;return(0,Q.jsxs)(Tt,{value:e,className:`h-8 min-h-8 whitespace-nowrap`,children:[(0,Q.jsx)(`span`,{className:`min-w-0 truncate text-sm font-medium`,children:e.alias}),r===e.alias?(0,Q.jsx)(`span`,{className:`flex-1`}):(0,Q.jsx)(`span`,{className:`min-w-0 flex-1 truncate text-xs text-muted-foreground`,children:r}),a?(0,Q.jsx)(St,{className:`shrink-0`,children:a}):null]},`${e.alias}:${e.hostname}:${e.port??``}`)})}):(0,Q.jsxs)(yt,{className:`break-all`,children:[`No hosts match "`,B.trim(),`".`]})}):null]})]}),(0,Q.jsxs)(`div`,{className:`grid gap-3 sm:grid-cols-[minmax(0,1fr)_7rem]`,children:[(0,Q.jsxs)(`label`,{className:`block`,children:[(0,Q.jsx)(`span`,{className:`mb-1.5 block text-xs font-medium text-foreground`,children:`Username`}),(0,Q.jsx)(Et,{value:V,onChange:e=>we(e.target.value),onKeyDown:Or,placeholder:`root`,disabled:U,spellCheck:!1})]}),(0,Q.jsxs)(`label`,{className:`block`,children:[(0,Q.jsx)(`span`,{className:`mb-1.5 block text-xs font-medium text-foreground`,children:`Port`}),(0,Q.jsx)(Et,{value:Te,onChange:e=>Ee(e.target.value),onKeyDown:Or,placeholder:`22`,inputMode:`numeric`,disabled:U,spellCheck:!1})]})]}),Ne||Gn?(0,Q.jsx)(hn,{variant:`error`,children:(0,Q.jsx)(mn,{children:Ne??Gn})}):null,(0,Q.jsxs)(z,{variant:`outline`,className:`w-full`,disabled:U,onClick:()=>void Er(),children:[(0,Q.jsx)(S,{className:`size-3.5`}),U?`Adding…`:L?`Add route`:`Add environment`]})]})}),li=()=>(0,Q.jsx)(Fn,{checked:Yn?.mode===`network-accessible`,disabled:!Yn||ze,onCheckedChange:e=>{Vt(e?`network-accessible`:`local-only`),Ue(!0)},"aria-label":`Enable network access`}),mi=e=>Xt?Vr.map(t=>{let n=wi(t);return(0,Q.jsx)(Ni,{endpoint:t,isDefault:n===Gr,presentation:e,onSetDefault:Kr,onSetupTailscaleServe:vr,onDisableTailscaleServe:xr,isUpdatingTailscaleServe:G},t.id)}):null,gi=(0,$.useCallback)(async t=>{if(e&&p!==null&&st(p,`environment:maintain`)){at(!0),ft(null);try{await t(),Vn()}catch(e){let t=e instanceof Error?e.message:`Failed to update WSL backend.`;ft(t),q.add(ht({type:`error`,title:`Could not change WSL backend`,description:t})),Vn()}finally{at(!1)}}},[e,p]),Ti=(0,$.useCallback)(()=>{ft(null),Vn()},[]),Ei=(0,$.useMemo)(()=>n.some(e=>He(e.entry.target)),[n]),Di=(0,$.useCallback)(t=>{if(!e||!X)return;let n=X.distros.find(e=>e.isDefault)?.name??null;if(t===ai){if(!X.enabled&&!X.wslOnly)return;let t=X.wslOnly;if(Ei||t){pt({kind:`disable`,wasWslOnly:t});return}gi(()=>e.setWslBackendEnabled(!1));return}let r=t===ii?null:t,i=r??n;if(!X.enabled){pt({kind:`enable`,nextDistro:r});return}if((X.distro??n)!==i){if(Ei||X.wslOnly){pt({kind:`distro`,nextDistro:r});return}gi(()=>e.setWslDistro(r))}},[gi,e,X,Ei]),Oi=(0,$.useCallback)(t=>{if(!e||!Y||Y.kind!==`enable`)return;let n=Y.nextDistro;pt(null);let r=X?.distro??null;gi(()=>jn({bridge:e,mode:t,nextDistro:n,persistedDistro:r}))},[gi,e,X,Y]),ki=(0,$.useCallback)(t=>{e&&X&&X.wslOnly!==t&&pt({kind:`wsl-only`,nextValue:t})},[e,X]),Ai=(0,$.useCallback)(()=>{if(!e||!Y)return;let t=Y;if(t.kind!==`enable`){if(pt(null),t.kind===`disable`){gi(async()=>{let n=await e.setWslBackendEnabled(!1);return t.wasWslOnly?await e.setWslOnly(!1):n});return}if(t.kind===`distro`){gi(()=>e.setWslDistro(t.nextDistro));return}gi(()=>e.setWslOnly(t.nextValue))}},[gi,e,Y]),Fi=()=>{if(!X)return Nn({state:null,error:xn})&&sn?(0,Q.jsx)(gn,{...$n(`wsl-backend`),description:`Couldn't load the WSL backend state.`,status:(0,Q.jsx)(`span`,{className:`block text-destructive`,children:xn}),control:(0,Q.jsx)(z,{size:`sm`,variant:`outline`,onClick:Ti,disabled:kn,children:kn?`Retrying…`:`Retry`})}):null;if(!Nn({state:X,error:xn}))return null;if(!X.available)return(0,Q.jsx)(gn,{...$n(`wsl-backend`),description:`WSL is unavailable, so Windows is running instead. Turn WSL off to clear this preference.`,status:xn?(0,Q.jsx)(`span`,{className:`block text-destructive`,children:xn}):null,control:(0,Q.jsx)(z,{size:`sm`,variant:`outline`,disabled:J,onClick:()=>Di(ai),children:`Switch to Windows`})});let e=X.distros.find(e=>e.isDefault)?.name??null,t=X.enabled?X.distro??e??ii:ai,n=t===ai?`Off`:t===ii?`Default distro`:t;return(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(gn,{...$n(`wsl-backend`),description:`Run the selected WSL distro alongside Windows. Projects remain on their current filesystem.`,status:xn?(0,Q.jsx)(`span`,{className:`block text-destructive`,children:xn}):X.preflightError?(0,Q.jsxs)(`span`,{className:`block text-destructive`,children:[`WSL backend couldn't start: `,X.preflightError]}):null,control:(0,Q.jsxs)(Je,{value:t,onValueChange:e=>{typeof e==`string`&&Di(e)},children:[(0,Q.jsx)(qe,{size:`sm`,className:`w-full sm:w-56`,"aria-label":`WSL backend`,disabled:J,children:(0,Q.jsx)(Ge,{children:n})}),(0,Q.jsxs)(Ke,{align:`end`,alignItemWithTrigger:!1,children:[(0,Q.jsx)(We,{hideIndicator:!0,value:ai,children:`Off`}),X.distros.length===0?(0,Q.jsx)(We,{hideIndicator:!0,value:ii,children:`Default distro`}):X.distros.map(e=>(0,Q.jsxs)(We,{hideIndicator:!0,value:e.name,children:[e.name,e.isDefault?` (default)`:``]},e.name))]})]})}),X.enabled?(0,Q.jsx)(gn,{title:`WSL only`,description:`Run only the WSL backend. P4 Code restarts when this changes.`,className:`bg-muted/20 pl-7 sm:pl-8`,control:(0,Q.jsx)(Fn,{checked:X.wslOnly,disabled:J,onCheckedChange:e=>ki(e),"aria-label":`Run WSL only`})}):null]})},Li=()=>(0,Q.jsx)(gn,{title:$n(`tailscale-https`).title,description:zr?zr.status===`available`?zr.httpBaseUrl:`Use Tailscale Serve to expose this backend through a MagicDNS HTTPS URL.`:`Start Tailscale to set up HTTPS access through MagicDNS.`,control:zr?(0,Q.jsx)(Fn,{checked:zr.status===`available`,disabled:G,onCheckedChange:e=>{if(e){vr(zr);return}xr(zr)},"aria-label":`Enable Tailscale HTTPS`}):null}),Ri=e=>(0,Q.jsxs)(Q.Fragment,{children:[rr?(0,Q.jsx)(`div`,{className:hi(e),children:(0,Q.jsx)(`p`,{className:`text-xs text-destructive`,children:rr})}):null,(0,Q.jsx)(Mi,{endpointUrl:Yn?.endpointUrl,endpoints:Hr,defaultEndpointKey:Gr,presentation:e,isLoading:ir,pairingLinks:Rr,createdPairingCredentials:j,clientSessions:or,revokingPairingLinkId:te,revokingClientSessionId:ie,onRevokePairingLink:Sr,onRevokeClientSession:Cr,canRevoke:nn})]}),zi=()=>(0,Q.jsx)(gn,{title:$n(`network-access`).title,description:Z?(0,Q.jsx)(Pi,{endpoint:Ur,hiddenEndpointCount:Math.max(Vr.length-1,0),expanded:Xt,onToggleExpanded:()=>Zt(e=>!e),fallback:Yn?.endpointUrl?`Reachable at ${Yn.endpointUrl}`:Yn?.advertisedHost?`Exposed on all interfaces. Pairing links use ${Yn.advertisedHost}.`:`Exposed on all interfaces.`}):Yn?`Limited to this machine.`:`Loading…`,status:nr?(0,Q.jsx)(`span`,{className:`block text-destructive`,children:nr}):null,control:li()}),Bi=()=>(0,Q.jsx)(gn,{title:$n(`network-access`).title,description:e?`This connection cannot view or change network exposure.`:_===`remote-reachable`?`Remote access is already configured. Change network exposure where the server starts.`:_===`loopback-browser`?`Only this machine can connect. Restart with a non-loopback host for remote pairing.`:`Network exposure information is unavailable.`,control:!e&&(_===`remote-reachable`||_===`loopback-browser`)?(0,Q.jsxs)(Qe,{children:[(0,Q.jsx)(Xe,{render:(0,Q.jsx)(`span`,{className:`inline-flex`,children:(0,Q.jsx)(Fn,{checked:Z,disabled:!0,"aria-label":`Enable network access`})})}),(0,Q.jsx)(Ze,{side:`top`,children:`Network exposure changes restart the backend and must be controlled where the server process is launched.`})]}):void 0}),Vi=(0,Q.jsx)(Q.Fragment,{children:p===null?(0,Q.jsxs)(vn,{...$n(`connections-environment`),children:[(0,Q.jsx)(gn,{title:`No environment selected`,description:`Connect an environment to view its settings and access.`}),(0,Q.jsx)(fr,{}),rn||on?(0,Q.jsx)(qi,{canReadRelay:rn,canManageRelay:on}):null]}):(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsxs)(vn,{...$n(`connections-environment`),title:r?.label??(e?`This machine`:`Primary environment`),icon:(0,Q.jsx)(fn,{"aria-hidden":!0,kind:Ht?Ce(Ht):`desktop`,className:`size-4`}),headerAction:p===null?null:(0,Q.jsxs)(f,{children:[(0,Q.jsx)(fe,{render:(0,Q.jsx)(z,{type:`button`,variant:`ghost-muted`,size:`icon-xs`,"aria-label":`More actions for this machine`}),children:(0,Q.jsx)(d,{className:`size-3.5`})}),(0,Q.jsx)(P,{align:`end`,children:(0,Q.jsx)(hr,{environmentId:p,serverConfig:Ht})})]}),children:[(0,Q.jsx)(fr,{}),sn?(0,Q.jsx)(gn,{title:`Version`,description:Yt.status===`idle`?[Ht?.environment.serverVersion??null,r?.displayUrl??null].filter(e=>e!==null).join(` · `)||`Loading…`:(0,Q.jsx)(Xn,{state:Yt}),control:Jt&&p!==null&&Yt.status!==`running`?(0,Q.jsx)(Zn,{size:`sm`,environmentId:p,serverLabel:r?`${r.label} server`:`server`,selfUpdate:On(Ht),installation:Ht?.environment.capabilities.serverInstallation,desktopAppUpdate:Rn(Ht),threadContinuation:tr(Ht),targetVersion:Jt.clientVersion,label:Yt.status===`failed`?`Retry update`:`Update to ${Jt.clientVersion}`}):Yt.status===`idle`&&Ht?(0,Q.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:`Up to date`}):void 0}):null,sn&&e?(0,Q.jsxs)(Q.Fragment,{children:[zi(),mi(`endpoint-rail`),Li(),Fi(),rn||on?(0,Q.jsx)(qi,{canReadRelay:rn,canManageRelay:on}):null]}):sn?(0,Q.jsxs)(Q.Fragment,{children:[Bi(),rn||on?(0,Q.jsx)(qi,{canReadRelay:rn,canManageRelay:on}):null]}):null,r?(0,Q.jsxs)(`details`,{className:`group px-3 sm:px-4`,children:[(0,Q.jsxs)(`summary`,{className:`flex min-h-11 cursor-pointer list-none items-center gap-2 rounded-md text-sm font-medium outline-none focus-visible:ring-2 focus-visible:ring-inset focus-visible:ring-ring [&::-webkit-details-marker]:hidden`,children:[`Permissions`,(0,Q.jsx)(be,{"aria-hidden":!0,className:`size-3 text-muted-foreground group-open:rotate-90`})]}),(0,Q.jsx)(lr,{environmentId:r.environmentId,connected:r.connection.phase===`connected`})]}):null]}),tn||nn?(0,Q.jsx)(sr,{id:`authorized-clients`,title:`Authorized clients`,summary:vi(or,Rr),control:nn?(0,Q.jsx)(ji,{delegatableScopes:h??[],onPairingLinkCreated:F,clientSessions:tn&&cn.error===null&&cn.data?.type===`snapshot`?or:null,isRevokingOtherClients:se,onRevokeOtherClients:wr}):void 0,children:(0,Q.jsx)(Dt,{scrollFade:!0,chainVerticalScroll:!0,className:`max-h-[22.5rem]`,"data-testid":`authorized-clients-scroll-area`,children:tn?Ri(`current`):(0,Q.jsx)(`p`,{className:`px-4 py-3 text-xs text-muted-foreground`,children:`This connection can create access links but cannot view authorized clients.`})})}):null,(0,Q.jsx)(Dn,{open:Ve&&sn,onOpenChange:e=>{ze||Ue(e)},onOpenChangeComplete:e=>{e||Vt(null)},children:(0,Q.jsxs)(An,{children:[(0,Q.jsxs)(Bn,{children:[(0,Q.jsx)(Mn,{children:Bt===`network-accessible`?`Enable network access?`:`Disable network access?`}),(0,Q.jsx)(In,{children:Bt===`network-accessible`?`Let your other devices connect to P4 Code over the network. Pair devices to give them access. P4 Code will restart.`:`Devices connected over your local network will disconnect. Existing tunnels, such as P4 Connect or Tailscale HTTPS, keep working. P4 Code will restart.`})]}),(0,Q.jsxs)(Ln,{children:[(0,Q.jsx)(er,{disabled:ze,render:(0,Q.jsx)(z,{variant:`outline`,disabled:ze}),children:(0,Q.jsx)(`span`,{className:`[text-box:trim-both_cap_alphabetic]`,children:`Cancel`})}),(0,Q.jsxs)(z,{variant:`default`,onClick:gr,disabled:!sn||Bt===null||ze,children:[ze&&(0,Q.jsx)(K,{size:`sm`}),(0,Q.jsx)(`span`,{className:`[text-box:trim-both_cap_alphabetic]`,children:ze?`Restarting…`:Bt===`network-accessible`?`Restart and enable`:`Restart and disable`})]})]})]})}),(0,Q.jsx)(Dn,{open:mt&&sn,onOpenChange:e=>{J||e||pt(null)},children:(0,Q.jsxs)(An,{children:[(0,Q.jsxs)(Bn,{children:[(0,Q.jsx)(Mn,{children:Y?.kind===`disable`?Y.wasWslOnly?`Turn off WSL and switch back to Windows?`:`Disable WSL backend?`:Y?.kind===`distro`?`Switch WSL distro?`:Y?.kind===`enable`?`Start the WSL backend`:Y?.nextValue?`Run only the WSL backend?`:`Re-enable the Windows backend?`}),(0,Q.jsx)(In,{children:Y?.kind===`disable`?Y.wasWslOnly?`P4 Code will restart on the Windows backend. Threads and projects opened against WSL stay safe inside the distro and become available again when you re-enable WSL.`:`The WSL backend will stop. Threads and projects opened against WSL stay safe inside the distro, but they'll be unavailable in P4 Code until you re-enable WSL.`:Y?.kind===`distro`?`P4 Code will restart the WSL backend on the new distro. Sessions still running on the current distro will be interrupted.`:Y?.kind===`enable`?`Run the WSL backend alongside the Windows one, or stop the Windows backend and use only WSL? You can change this later from Settings.`:Y?.nextValue?`P4 Code will restart and start only the WSL backend. Your Windows-side projects won't be accessible until you turn this off again.`:`P4 Code will restart and bring the Windows backend back up alongside WSL.`})]}),(0,Q.jsxs)(Ln,{children:[(0,Q.jsx)(er,{disabled:J,render:(0,Q.jsx)(z,{variant:`outline`,disabled:J}),children:`Cancel`}),Y?.kind===`enable`?(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(z,{variant:`outline`,onClick:()=>Oi(`wsl-only`),disabled:J||!sn,children:J?(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(K,{size:`sm`}),`Applying…`]}):`Use only WSL`}),(0,Q.jsx)(z,{variant:`default`,onClick:()=>Oi(`both`),disabled:J||!sn,children:J?(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(K,{size:`sm`}),`Applying…`]}):`Run both backends`})]}):(0,Q.jsx)(z,{variant:Y?.kind===`disable`||Y?.kind===`wsl-only`&&Y.nextValue?`destructive`:`default`,onClick:Ai,disabled:J||!sn,children:J?(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(K,{size:`sm`}),`Applying…`]}):Y?.kind===`disable`?Y.wasWslOnly?`Switch to Windows`:`Disable WSL`:Y?.kind===`distro`?`Switch distro`:Y?.nextValue?`Restart and enable`:`Restart and disable`})]})]})}),(0,Q.jsx)(Dn,{open:vt&&sn,onOpenChange:e=>{G||Lt(e)},children:(0,Q.jsxs)(An,{children:[(0,Q.jsxs)(Bn,{children:[(0,Q.jsx)(Mn,{children:`Disable Tailscale HTTPS?`}),(0,Q.jsx)(In,{children:`P4 Code will restart the local backend without Tailscale Serve.`})]}),(0,Q.jsxs)(Ln,{children:[(0,Q.jsx)(er,{disabled:G,render:(0,Q.jsx)(z,{variant:`outline`,disabled:G}),children:`Cancel`}),(0,Q.jsx)(z,{variant:`destructive`,onClick:()=>void yr(),disabled:G||!sn,children:G?(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(K,{size:`sm`}),`Restarting…`]}):`Restart and disable`})]})]})}),(0,Q.jsx)(It,{open:gt!==null,onOpenChange:e=>{G||e||_t(null)},children:(0,Q.jsxs)(Ft,{className:`max-w-md`,children:[(0,Q.jsxs)(Ot,{children:[(0,Q.jsx)(kt,{children:`Set up Tailscale HTTPS?`}),(0,Q.jsx)(Pt,{children:`P4 Code will restart the local backend with Tailscale Serve enabled and ask Tailscale to proxy HTTPS traffic to this backend.`})]}),(0,Q.jsxs)(Nt,{children:[(0,Q.jsxs)(`label`,{className:`block`,children:[(0,Q.jsx)(`span`,{className:`text-sm font-medium text-foreground`,children:`HTTPS port`}),(0,Q.jsx)(Et,{className:`mt-2`,type:`number`,inputMode:`numeric`,min:1,max:65535,step:1,value:Rt,onChange:e=>zt(e.target.value),disabled:G})]}),dr?null:(0,Q.jsx)(`p`,{className:`mt-2 text-xs text-destructive`,children:`Enter a port from 1 to 65535.`}),(0,Q.jsxs)(`div`,{className:`rounded-md border border-border/70 bg-muted/20 px-3 py-2`,children:[(0,Q.jsx)(`p`,{className:`text-xs font-medium text-muted-foreground`,children:`HTTPS endpoint`}),(0,Q.jsxs)(Qe,{children:[(0,Q.jsx)(Xe,{render:(0,Q.jsx)(`p`,{className:`mt-1 truncate text-sm text-foreground`,children:pr??`Pending MagicDNS endpoint`})}),pr?(0,Q.jsx)(Ze,{side:`top`,children:pr}):null]})]})]}),(0,Q.jsxs)(At,{children:[(0,Q.jsx)(Mt,{disabled:G,render:(0,Q.jsx)(z,{variant:`outline`,disabled:G}),children:`Cancel`}),(0,Q.jsx)(z,{onClick:()=>void _r(),disabled:G||!dr,children:G?(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(K,{size:`sm`}),`Restarting…`]}):`Enable`})]})]})})]})});return(0,Q.jsxs)(_n,{children:[Vi,(0,Q.jsxs)(vn,{...$n(`remote-environments`),title:`Environments`,headerAction:(0,Q.jsxs)(`div`,{className:`flex items-center gap-1`,children:[C.length>0?(0,Q.jsx)(qn,{targets:C,variant:`ghost-muted`}):null,(0,Q.jsxs)(It,{open:I,onOpenChange:e=>{le(e),e?de(null):H(null)},children:[(0,Q.jsxs)(Qe,{children:[(0,Q.jsx)(Xe,{render:(0,Q.jsx)(jt,{render:(0,Q.jsxs)(z,{size:`xs`,variant:`ghost-muted`,"aria-label":`Add environment`,children:[(0,Q.jsx)(S,{className:`size-3`}),(0,Q.jsx)(`span`,{children:`Add environment`})]})})}),(0,Q.jsx)(Ze,{side:`top`,children:`Add environment`})]}),(0,Q.jsxs)(Ft,{className:`max-h-[80dvh] sm:max-w-3xl`,children:[(0,Q.jsxs)(Ot,{children:[(0,Q.jsx)(kt,{children:L?`Add a route to ${L.label}`:`Add Environment`}),(0,Q.jsx)(Pt,{children:L?`Pair this machine again over another address, such as its Tailscale name. It joins the existing routes instead of adding a second machine.`:`Pair another environment to this client.`})]}),(0,Q.jsx)(Nt,{children:(0,Q.jsxs)(`div`,{className:`space-y-4`,children:[(0,Q.jsxs)(`div`,{className:`grid gap-3 sm:grid-cols-2`,children:[Zr({mode:`remote`,title:`Remote link`,description:`Enter a backend host and pairing code.`,icon:(0,Q.jsx)(re,{"aria-hidden":!0,className:`size-4`})}),e?Zr({mode:`ssh`,title:`SSH`,description:`Use local SSH config, agent, and tunnels for the backend.`,icon:(0,Q.jsx)(ee,{"aria-hidden":!0,className:`size-4`})}):null]}),(0,Q.jsx)(Ut,{children:R===`ssh`?ci():si()})]})})]})]})]}),children:[y.map(e=>(0,Q.jsx)(Ii,{environment:e,removingEnvironmentId:Le,onSetEnabled:jr,onRemove:Lr,onAddRoute:e=>{de(e),H(null),le(!0)}},e.environmentId)),(0,Q.jsx)(Yi,{primaryEnvironmentId:p,savedEnvironments:v})]}),Pe()?(0,Q.jsx)(Pr,{environmentLabel:Fr?.label??null,onCancel:()=>Ir(null),onConfirm:()=>{Fr&&(Ir(null),Nr(Fr))}}):null,(0,Q.jsx)(Dr,{environments:w}),(0,Q.jsx)(Mr,{environments:w})]})}function Zi(e){let{kind:t}=e;q.add({type:`success`,title:t===`hosted-link`?`Hosted app link copied`:t===`link`?`Pairing URL copied`:`Pairing code copied`,description:t===`hosted-link`?`Open it in the browser on the device you want to connect.`:t===`link`?`Open it in the client you want to pair to this environment.`:`Paste it into another client to finish pairing.`})}function Qi(e){return Di(e)?`hosted-link`:`link`}function $i(e){return!e}function ea(e){return e.currentTarget.select()}function ta(e){return e.currentTarget.select()}function na(e){return e!==null}var ra=Xi;export{ra as component};
|
|
2
|
+
//# sourceMappingURL=settings.connections-CKn7dmOC.js.map
|
package/dist/client/assets/{settings.data-controls-CZHmsfBq.js → settings.data-controls-B8uFJ36x.js}
RENAMED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{i as e}from"./rolldown-runtime-Dd_uD5pT.js";import{r as t}from"./Icon-l19w4AjM.js";import{Ks as n,Yo as r,__ as i,lE as a,sr as o}from"./utils-
|
|
2
|
-
//# sourceMappingURL=settings.data-controls-
|
|
1
|
+
import{i as e}from"./rolldown-runtime-Dd_uD5pT.js";import{r as t}from"./Icon-l19w4AjM.js";import{Ks as n,Yo as r,__ as i,lE as a,sr as o}from"./utils-Dx_TSvdC.js";import{W as s}from"./runtime-D102A-Bu.js";import{B as c,K as l,k as u,q as d}from"./entities-CyQRuOur.js";import{Lt as f,Pt as p}from"./runtime-BjJBBHTp.js";import{t as m}from"./link-BIudTto8.js";import{o as h}from"./session-Dh8maTO3.js";import{L as g}from"./useSettings-DUgjfqYw.js";import{g as _}from"./queries-DMjiMwzO.js";import{r as v}from"./SettingsPanels-B3TcgEEZ.js";import{l as y}from"./openFileInPreview-tPdJXpV4.js";import{B as b,a as x,i as S,s as C}from"./settingsLayout-BRcW18Dy.js";import{Mi as w,_i as T,ji as E}from"./main-C58_iQqs.js";import{t as D}from"./legalLinks-C4VP5hPh.js";var O=e(t(),1),k=e(a(),1);function A(){let{scope:e,search:t,connectedEnvironments:a}=b(),A=u(),j=r((0,O.useMemo)(()=>l({environmentIds:e.environmentIds,shellStateValueAtom:d.stateValueAtom}),[e.environmentIds])),M=E(e.environmentIds),N=h(a,i),{changedSettingLabels:P,restoreDefaults:F}=v(),I=w(c.archive,{reportFailure:!1}),{deleteThread:L}=T(),R=y(_.v2.threadProjection,{reportFailure:!1}),[z,B]=(0,O.useState)(null),V=(0,O.useRef)(!1),[H,U]=(0,O.useState)(null),[W,G]=(0,O.useState)(null),K=e.kind===`project`||e.kind===`checkout`?new Set(e.members.map(e=>`${e.environmentId}:${e.id}`)):null,q=[...new Map([...A,...M.snapshots.flatMap(({environmentId:e,snapshot:t})=>t.threads.map(t=>p(e,t)))].filter(t=>e.environmentIds.includes(t.environmentId)&&(K===null||K.has(`${t.environmentId}:${t.projectId}`))).map(e=>[`${e.environmentId}:${e.id}`,e])).values()],J=q.filter(e=>e.archivedAt===null&&f(e.runtime)),Y=j&&e.environmentIds.length>0&&!M.isLoading&&!M.error&&e.environmentIds.every(e=>a.some(t=>t.environmentId===e)&&M.snapshots.some(t=>t.environmentId===e)),X=Y&&e.environmentIds.every(e=>N.has(e)),Z=async t=>{if(V.current)return;V.current=!0,B(t===`export`?t:`confirm`),U(null),G(null);let r=t===`archive`?J:q,i=0;try{if(t!==`export`&&!await g().dialogs.confirm(t===`delete`?`Permanently delete all ${r.length} chats in ${e.label}, including archived chats? This cannot be undone.`:`Archive ${r.length} inactive chats in ${e.label}? Active chats stay open. You can restore archived chats later.`,{variant:t===`delete`?`destructive`:`default`}))return;B(t);let a=[];for(let e of r){let r=n(e.environmentId,e.id);if(t===`export`){let t=await R({environmentId:e.environmentId,input:{threadId:e.id}});if(t._tag===`Failure`)throw s(t);a.push({environmentId:e.environmentId,thread:t.value.thread,messages:t.value.messages})}else{let n=t===`archive`?await I({environmentId:e.environmentId,input:{threadId:e.id}}):await L(r);if(n._tag===`Failure`)throw s(n)}i++}if(t===`export`){let e=URL.createObjectURL(new Blob([JSON.stringify({version:1,exportedAt:new Date().toISOString(),conversations:a},null,2)],{type:`application/json`})),t=document.createElement(`a`);t.href=e,t.download=`p4-chats-${new Date().toISOString().slice(0,10)}.json`,t.click(),setTimeout(()=>URL.revokeObjectURL(e),1e3)}U(`${i} chats ${t===`archive`?`archived`:t===`delete`?`deleted`:`exported`}.`)}catch(e){G(`${i} of ${r.length} completed. ${e instanceof Error?e.message:`The action failed. Try again.`}`)}finally{M.refresh(),V.current=!1,B(null)}};return(0,k.jsxs)(S,{width:`wide`,children:[(0,k.jsx)(`h1`,{className:`text-2xl font-semibold`,children:`Data controls`}),(0,k.jsxs)(C,{title:`Data controls`,hideTitle:!0,id:`data-controls`,children:[(0,k.jsx)(x,{title:`Connected devices and access`,description:`Manage pairing links, devices, and access to your environments.`,control:(0,k.jsx)(o,{variant:`soft`,size:`sm`,render:(0,k.jsx)(m,{to:`/settings/connections`,search:t}),children:`Manage`})}),(0,k.jsx)(x,{title:`Model training`,description:`Your provider account controls how it uses your chats. P4 cannot change that preference for you.`,control:(0,k.jsx)(o,{variant:`soft`,size:`sm`,render:(0,k.jsx)(m,{to:`/settings/providers`,search:t}),children:`Providers`})}),(0,k.jsx)(x,{title:`Network access`,description:`Manage how devices connect to your P4 server.`,control:(0,k.jsx)(o,{variant:`soft`,size:`sm`,render:(0,k.jsx)(m,{to:`/settings/connections`,search:t}),children:`Manage`})}),(0,k.jsx)(x,{title:`Reset preferences`,description:`Restore default appearance and behavior settings. Your chats and provider credentials are kept.`,control:(0,k.jsx)(o,{variant:`destructive-outline`,size:`sm`,disabled:!!z||!P.length,onClick:()=>void F(),children:`Reset`})}),(0,k.jsx)(x,{title:`MCP access`,description:`Manage the MCP servers available to agents and their sign-ins.`,control:(0,k.jsx)(o,{variant:`soft`,size:`sm`,render:(0,k.jsx)(m,{to:`/settings/plugins`,hash:`mcp-servers`,search:t}),children:`Manage`})}),(0,k.jsx)(x,{title:`Archived chats`,control:(0,k.jsx)(o,{variant:`soft`,size:`sm`,render:(0,k.jsx)(m,{to:`/settings/archived`,search:t}),children:`Manage`})}),(0,k.jsx)(x,{title:`Archive all chats`,description:`Archives inactive chats in the selected scope.`,control:(0,k.jsx)(o,{variant:`soft`,size:`sm`,disabled:!!z||!X||!J.length,onClick:()=>void Z(`archive`),children:z===`archive`?`Archiving…`:`Archive all`})}),(0,k.jsx)(x,{title:`Delete all chats`,description:`Permanently deletes chats in the selected scope, including the archive.`,control:(0,k.jsx)(o,{variant:`destructive-outline`,size:`sm`,disabled:!!z||!X||!q.length,onClick:()=>void Z(`delete`),children:z===`delete`?`Deleting…`:`Delete all`})}),(0,k.jsx)(x,{title:`Export chat data`,description:`Download chat metadata and messages as JSON. Attachment files and tool output are not included.`,control:(0,k.jsx)(o,{variant:`soft`,size:`sm`,disabled:!!z||!Y||!q.length,onClick:()=>void Z(`export`),children:z===`export`?`Exporting…`:`Export`})}),(0,k.jsx)(x,{title:`Privacy policy`,control:(0,k.jsx)(o,{variant:`soft`,size:`sm`,render:(0,k.jsx)(`a`,{href:D,target:`_blank`,rel:`noreferrer`}),children:`Read`})})]}),W||M.error?(0,k.jsx)(`p`,{role:`alert`,className:`text-sm text-destructive-foreground`,children:W??M.error}):null,H?(0,k.jsx)(`p`,{role:`status`,className:`text-sm text-muted-foreground`,children:H}):null,Y?null:(0,k.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:`Connect all environments in this scope and wait for chats to load to use bulk actions.`})]})}var j=A;export{j as component};
|
|
2
|
+
//# sourceMappingURL=settings.data-controls-B8uFJ36x.js.map
|
package/dist/client/assets/{settings.decisions-C3WA_g2Z.js → settings.decisions-Cy46-IzS.js}
RENAMED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{i as e}from"./rolldown-runtime-Dd_uD5pT.js";import{r as t}from"./Icon-l19w4AjM.js";import{NE as n,ay as r,ib as i,lE as a,oy as o,sr as s}from"./utils-
|
|
2
|
-
//# sourceMappingURL=settings.decisions-
|
|
1
|
+
import{i as e}from"./rolldown-runtime-Dd_uD5pT.js";import{r as t}from"./Icon-l19w4AjM.js";import{NE as n,ay as r,ib as i,lE as a,oy as o,sr as s}from"./utils-Dx_TSvdC.js";import{a as c,c as l,o as u,s as d,t as f}from"./select-BUFUt6O3.js";import{t as p}from"./input-CF-egQtG.js";import{I as m,L as h,P as g,a as _,i as v,s as y}from"./settingsLayout-BRcW18Dy.js";import{La as b}from"./main-C58_iQqs.js";var x=n(),S=e(t(),1),C=e(a(),1);function w(){let e=(0,x.c)(28),t=g(T),n=h(),r=m(),[i,a]=(0,S.useState)(``),o;e[0]===Symbol.for(`react.memo_cache_sentinel`)?(o=[`decisionOpenRouterKey`],e[0]=o):o=e[0];let c;e[1]===Symbol.for(`react.memo_cache_sentinel`)?(c=(0,C.jsxs)(C.Fragment,{children:[`Used by Jev and Luna Decisions.`,` `,(0,C.jsx)(`a`,{href:`https://openrouter.ai/settings/keys`,target:`_blank`,rel:`noreferrer`,className:`underline underline-offset-2`,children:`Get an API key`})]}),e[1]=c):c=e[1];let l=t?`Key saved`:`No key saved`,u;e[2]!==r||e[3]!==i||e[4]!==n?(u=e=>{e.preventDefault(),i.trim()&&r&&(n({decisionOpenRouterKey:i.trim()}),a(``))},e[2]=r,e[3]=i,e[4]=n,e[5]=u):u=e[5];let d=!r,f=t?`Replace saved key`:`API key`,v;e[6]===Symbol.for(`react.memo_cache_sentinel`)?(v=e=>a(e.target.value),e[6]=v):v=e[6];let y;e[7]!==i||e[8]!==d||e[9]!==f?(y=(0,C.jsx)(`div`,{className:`min-w-40 flex-1`,children:(0,C.jsx)(p,{"aria-label":`OpenRouter API key`,type:`password`,autoComplete:`off`,value:i,disabled:d,placeholder:f,onChange:v})}),e[7]=i,e[8]=d,e[9]=f,e[10]=y):y=e[10];let b;e[11]!==r||e[12]!==i?(b=!r||!i.trim(),e[11]=r,e[12]=i,e[13]=b):b=e[13];let w;e[14]===b?w=e[15]:(w=(0,C.jsx)(s,{type:`submit`,size:`sm`,disabled:b,children:`Save`}),e[14]=b,e[15]=w);let E;e[16]!==r||e[17]!==t||e[18]!==n?(E=t&&(0,C.jsx)(s,{type:`button`,size:`sm`,variant:`outline`,disabled:!r,onClick:()=>n({decisionOpenRouterKey:``}),children:`Remove`}),e[16]=r,e[17]=t,e[18]=n,e[19]=E):E=e[19];let D;e[20]!==E||e[21]!==u||e[22]!==y||e[23]!==w?(D=(0,C.jsxs)(`form`,{className:`flex max-w-lg flex-wrap items-center gap-2`,onSubmit:u,children:[y,w,E]}),e[20]=E,e[21]=u,e[22]=y,e[23]=w,e[24]=D):D=e[24];let O;return e[25]!==D||e[26]!==l?(O=(0,C.jsx)(_,{title:`OpenRouter API key`,serverScoped:!0,settingKeys:o,description:c,status:l,children:D}),e[25]=D,e[26]=l,e[27]=O):O=e[27],O}function T(e){return!!e.decisionOpenRouterKey}function E(){let e=(0,x.c)(23),t=g(),n=h(),a=m(),s;e[0]===Symbol.for(`react.memo_cache_sentinel`)?(s=[`decisionModel`],e[0]=s):s=e[0];let c=!a,p;e[1]===n?p=e[2]:(p=e=>{i(o)(e)&&n({decisionModel:e})},e[1]=n,e[2]=p);let S=r[t.decisionModel],T;e[3]===S?T=e[4]:(T=(0,C.jsx)(d,{"aria-label":`Decision model`,children:(0,C.jsx)(l,{children:S})}),e[3]=S,e[4]=T);let E;e[5]===Symbol.for(`react.memo_cache_sentinel`)?(E=(0,C.jsx)(u,{children:o.literals.map(D)}),e[5]=E):E=e[5];let O;e[6]!==t.decisionModel||e[7]!==c||e[8]!==p||e[9]!==T?(O=(0,C.jsx)(_,{id:`decision-model`,title:`Decision model`,serverScoped:!0,settingKeys:s,description:`Fast, structured answers for agents, fit scores on question options, and Computer Use navigation.`,control:(0,C.jsxs)(f,{value:t.decisionModel,disabled:c,onValueChange:p,children:[T,E]})}),e[6]=t.decisionModel,e[7]=c,e[8]=p,e[9]=T,e[10]=O):O=e[10];let k;e[11]===Symbol.for(`react.memo_cache_sentinel`)?(k=(0,C.jsx)(w,{}),e[11]=k):k=e[11];let A;e[12]===Symbol.for(`react.memo_cache_sentinel`)?(A=[`decisionVisionEnabled`],e[12]=A):A=e[12];let j=!a,M;e[13]===n?M=e[14]:(M=e=>n({decisionVisionEnabled:e}),e[13]=n,e[14]=M);let N;e[15]!==t.decisionVisionEnabled||e[16]!==M||e[17]!==j?(N=(0,C.jsx)(_,{title:`Computer Use vision`,serverScoped:!0,settingKeys:A,description:`Use screenshots with Decisions to suggest navigation targets. Jev vision is experimental.`,control:(0,C.jsx)(b,{"aria-label":`Computer Use vision`,checked:t.decisionVisionEnabled,disabled:j,onCheckedChange:M})}),e[15]=t.decisionVisionEnabled,e[16]=M,e[17]=j,e[18]=N):N=e[18];let P;e[19]===Symbol.for(`react.memo_cache_sentinel`)?(P=(0,C.jsx)(_,{title:`What is shared`,description:`Decision requests send their text and any included images to the selected service. Computer Use vision also sends screenshots. Keys stay in this environment's secret store.`}),e[19]=P):P=e[19];let F;return e[20]!==N||e[21]!==O?(F=(0,C.jsx)(v,{children:(0,C.jsxs)(y,{title:`Decisions`,children:[O,k,N,P]})}),e[20]=N,e[21]=O,e[22]=F):F=e[22],F}function D(e){return(0,C.jsx)(c,{value:e,children:r[e]},e)}var O=E;export{O as component};
|
|
2
|
+
//# sourceMappingURL=settings.decisions-Cy46-IzS.js.map
|