@p4code/cli 0.8.34 → 0.8.35
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-CvWinVsO.mjs → binCli-26z5sNBT.mjs} +2242 -1476
- package/dist/client/.vite/manifest.json +2038 -2023
- package/dist/client/assets/{2NI2N5EU-Dlr3FZf7.js → 2NI2N5EU-BLnY4aCF.js} +2 -2
- package/dist/client/assets/{4UO7MD6I-Cy2sjs8O.js → 4UO7MD6I-BApNVkfU.js} +2 -2
- package/dist/client/assets/{5B3SVYGG-DaCwFaTp.js → 5B3SVYGG-Y7V7NdZO.js} +2 -2
- package/dist/client/assets/{5GK6JWQ2-BVM9871F.js → 5GK6JWQ2-BSIhKcw-.js} +2 -2
- package/dist/client/assets/{5N7A7DKN-BVMU2dmG.js → 5N7A7DKN-CNUCnWLs.js} +2 -2
- package/dist/client/assets/{5OC2THR4-2tkjJ38q.js → 5OC2THR4-Bne-pf_A.js} +2 -2
- package/dist/client/assets/{5S6HY5KT-BGTQzE2T.js → 5S6HY5KT-7d4UMONz.js} +2 -2
- package/dist/client/assets/{6IMQ5BUJ-DMdx9ktL.js → 6IMQ5BUJ-BWW19n-D.js} +2 -2
- package/dist/client/assets/{6OLKWJ4F-B0TXT19U.js → 6OLKWJ4F-CxTUuvA6.js} +2 -2
- package/dist/client/assets/{74OO7NKP-Cukz2OUS.js → 74OO7NKP-DByVTRKE.js} +2 -2
- package/dist/client/assets/{75O6YZUN-D3k2sZNm.js → 75O6YZUN-CZanyedf.js} +2 -2
- package/dist/client/assets/{77XECAW3-CjIq7P_x.js → 77XECAW3-TL2w7pHK.js} +2 -2
- package/dist/client/assets/{ABYRPUBD-hf0OeD7n.js → ABYRPUBD-CJboH7Uz.js} +2 -2
- package/dist/client/assets/AlertDialogRoot-9jRALQXL.js +2 -0
- package/dist/client/assets/{AnimatedHeight-CHpFDL1r.js → AnimatedHeight-OxEbW01v.js} +2 -2
- package/dist/client/assets/{AuthSurfaceShell-whDvSlDA.js → AuthSurfaceShell-KQXgPV4i.js} +2 -2
- package/dist/client/assets/{BB2UYUI2-RUQPN7sp.js → BB2UYUI2-BxW-R2h1.js} +2 -2
- package/dist/client/assets/{BUM34MOA-f5Ez9vSp.js → BUM34MOA-ngG-irUy.js} +2 -2
- package/dist/client/assets/{CEQABKGZ-C2ZheKpY.js → CEQABKGZ-C-u-W0bS.js} +2 -2
- package/dist/client/assets/{CXAC5362-B0KvwGJk.js → CXAC5362-DfFRkI7L.js} +2 -2
- package/dist/client/assets/ChatGptUsageButton-C3KgGt4z.js +2 -0
- package/dist/client/assets/{ChatMarkdown-C2KOLN1s.js → ChatMarkdown-9gWM0ED9.js} +9 -9
- package/dist/client/assets/{CheckboxIndicator-zwVHomgm.js → CheckboxIndicator-DbU3csPQ.js} +2 -2
- package/dist/client/assets/{ClippedText-Cx9jjhQp.js → ClippedText-CS_BYNco.js} +2 -2
- package/dist/client/assets/{CodexSetupSection.logic-150217tr.js → CodexSetupSection.logic-CNbTXxKb.js} +2 -2
- package/dist/client/assets/{ComboboxClear-tzFhNwrk.js → ComboboxClear-Bn_kslrf.js} +2 -2
- package/dist/client/assets/{ComboboxGroupLabel-C1Icd2UF.js → ComboboxGroupLabel-fL8lMA25.js} +2 -2
- package/dist/client/assets/{CommandBlock-D9QqOlDX.js → CommandBlock-DcQXu_lq.js} +2 -2
- package/dist/client/assets/ComposerPromptEditor-DQ9wFfKn.js +204 -0
- package/dist/client/assets/{CompositeRoot-BD0GlRg8.js → CompositeRoot-BuwzXGHT.js} +2 -2
- package/dist/client/assets/{ConnectionDiagnosisDetails-BQ3BFqRL.js → ConnectionDiagnosisDetails-DGbJY7Hw.js} +2 -2
- package/dist/client/assets/{ConnectionStatusDot-DLQm_zZ7.js → ConnectionStatusDot-CixsTBXI.js} +2 -2
- package/dist/client/assets/{DRLTVNUE-vgHnaBR1.js → DRLTVNUE-Cbb71R0Y.js} +2 -2
- package/dist/client/assets/{DYY6UVD2-BQAAF_8A.js → DYY6UVD2-BZn5fuF5.js} +2 -2
- package/dist/client/assets/{DevicePanel-Yd3YuPQd.js → DevicePanel-JP__PY1s.js} +2 -2
- package/dist/client/assets/{DeviceSetup-DW4g9NNK.js → DeviceSetup-D8qb_qBj.js} +2 -2
- package/dist/client/assets/{DialogTitle-DCMYEIWZ.js → DialogTitle-B_9LEmy3.js} +2 -2
- package/dist/client/assets/{DiffCommentAnnotation-BLItJ7Ia.js → DiffCommentAnnotation-WMKzOwCh.js} +2 -2
- package/dist/client/assets/{DiffFileTree-B1-D1WV6.js → DiffFileTree-BSbsOOmA.js} +2 -2
- package/dist/client/assets/DiffPanel-BWFuiHvv.js +2 -0
- package/dist/client/assets/{DiffWorkerPoolProvider-BzkGX7xm.js → DiffWorkerPoolProvider-BBk0lIX3.js} +2 -2
- package/dist/client/assets/EmbeddedDesign-B4RMmwTG.css +1 -0
- package/dist/client/assets/EmbeddedDesign-D5YUndkh.js +21 -0
- package/dist/client/assets/{EnvironmentMachineIcon-5-erc8l_.js → EnvironmentMachineIcon-Dpgx67FY.js} +2 -2
- package/dist/client/assets/{ExpandableText-D2jzDgm7.js → ExpandableText-Cpm1gOKG.js} +2 -2
- package/dist/client/assets/{FNOVOB4O-CE98DPML.js → FNOVOB4O-BkEIrB0k.js} +2 -2
- package/dist/client/assets/{FieldControl-CBMzQqd5.js → FieldControl-BHe6unoZ.js} +2 -2
- package/dist/client/assets/{FileDiff-2qSm00aV.js → FileDiff-C1vAOUga.js} +2 -2
- package/dist/client/assets/{FilePreviewPanel-Drpn6NuE.js → FilePreviewPanel-CbpNevZP.js} +4 -4
- package/dist/client/assets/{FoldedSettingsSection-Db7e_9rd.js → FoldedSettingsSection-DySTg20x.js} +2 -2
- package/dist/client/assets/{FormContext-BGRz6hhb.js → FormContext-CmvUzTS-.js} +2 -2
- package/dist/client/assets/{HDGCDEEZ-C0-Zci_l.js → HDGCDEEZ-CN-ckGDk.js} +2 -2
- package/dist/client/assets/{HSJLKHB7-4e5L-KC4.js → HSJLKHB7-B0BvmnZE.js} +2 -2
- package/dist/client/assets/{Icons-DwLGuyWf.js → Icons-B4l3TqYa.js} +2 -2
- package/dist/client/assets/Input-Cv-TKh6s.js +2 -0
- package/dist/client/assets/JZOYTAAL-CB_B_Rei.js +1 -0
- package/dist/client/assets/{K3MD6TGW-Gi4s7ooz.js → K3MD6TGW-IS0rWO1U.js} +2 -2
- package/dist/client/assets/{K7RP3OMA-BVc6P2bZ.js → K7RP3OMA-DcqjCOJO.js} +2 -2
- package/dist/client/assets/{KeybindingsSettings.logic-CU23l8mP.js → KeybindingsSettings.logic-mF9mJWrc.js} +2 -2
- package/dist/client/assets/{LHDIQX7Q-DbBCFdJr.js → LHDIQX7Q-CLMgIt4Y.js} +2 -2
- package/dist/client/assets/{LUXOKEGN-C4n0-A1h.js → LUXOKEGN-B1dkmN_M.js} +2 -2
- package/dist/client/assets/{MathTypeset--azkeKic.js → MathTypeset-qeRVy_bc.js} +2 -2
- package/dist/client/assets/{N3JZAHOW-2wC96xvZ.js → N3JZAHOW-C6sq5aqx.js} +2 -2
- package/dist/client/assets/{NUIALGQ3-Di1L_kRJ.js → NUIALGQ3-BG7xJ_qe.js} +2 -2
- package/dist/client/assets/{NoProjectsHero-CC3oMKUV.js → NoProjectsHero-B0KzU91d.js} +2 -2
- package/dist/client/assets/{O65XPQGZ-BeKB0m-p.js → O65XPQGZ-BEfVfDlS.js} +2 -2
- package/dist/client/assets/{O7XIQ6OM-1wrcdCMc.js → O7XIQ6OM-BUiRjV87.js} +2 -2
- package/dist/client/assets/{OFQON5FD-CsMmmhLT.js → OFQON5FD-DTgVPbd-.js} +2 -2
- package/dist/client/assets/{P4ConnectAccountPages-BDxb29bY.js → P4ConnectAccountPages-C4KYM5XU.js} +2 -2
- package/dist/client/assets/{P4ConnectSidebarSignIn-Dp5OsZBa.js → P4ConnectSidebarSignIn-DNPUNJl_.js} +2 -2
- package/dist/client/assets/{PJQHF43J-CY_GpbqJ.js → PJQHF43J-QRnhQpHu.js} +2 -2
- package/dist/client/assets/PanelLayoutControls-4VFKEoHg.js +216 -0
- package/dist/client/assets/{PierreEntryIcon-B5tjtDkE.js → PierreEntryIcon-DeI-j_7w.js} +2 -2
- package/dist/client/assets/{PopoverHandle-CZh3pqXt.js → PopoverHandle-DMB4QSp6.js} +2 -2
- package/dist/client/assets/PreviewPanel-CO66mekh.js +2 -0
- package/dist/client/assets/ProjectDefaultsSettings-BF-iyQ8T.js +2 -0
- package/dist/client/assets/{ProjectFavicon-CkSteHLT.js → ProjectFavicon-_6hkSNzm.js} +3 -3
- package/dist/client/assets/{ProjectIconPickerDialog-9heAZbVC.js → ProjectIconPickerDialog-DeL1rZxy.js} +2 -2
- package/dist/client/assets/{ProjectMonogram-DIqp1OmB.js → ProjectMonogram-Cn4l-YGU.js} +2 -2
- package/dist/client/assets/{ProviderAuthTerminal-BSsraub7.js → ProviderAuthTerminal-qGeMxZDy.js} +2 -2
- package/dist/client/assets/ProviderModelPicker-DJQYH_Pp.js +2 -0
- package/dist/client/assets/{ProviderSettingsForm-CAFBbrfr.js → ProviderSettingsForm-BSVuPnR0.js} +2 -2
- package/dist/client/assets/PullRequestCodeTab-0OaJE6XS.js +6 -0
- package/dist/client/assets/{RHNBAITX-BdiF8iR_.js → RHNBAITX-ChqB7inB.js} +2 -2
- package/dist/client/assets/{ReadOnlySourcePreview-BXDLfPcr.js → ReadOnlySourcePreview-B08Wms4m.js} +2 -2
- package/dist/client/assets/{RenderErrorBoundary-CR2cHAQ5.js → RenderErrorBoundary-BsOuLEci.js} +3 -3
- package/dist/client/assets/{SLD4V6NK-Bo1z-c9S.js → SLD4V6NK-IkYRGtTH.js} +2 -2
- package/dist/client/assets/ScheduledTasksSettings-1UDkELZo.js +4 -0
- package/dist/client/assets/{ScopedSwitch-CX4FTGjy.js → ScopedSwitch-Bhp6-hCj.js} +2 -2
- package/dist/client/assets/{ScrollAreaCorner-BCdJHqsj.js → ScrollAreaCorner-BPMuWLbs.js} +2 -2
- package/dist/client/assets/{SecretInput-BPPzPNI1.js → SecretInput-RlOzrLKL.js} +2 -2
- package/dist/client/assets/{SelectScrollUpArrow-CR3Z6_pf.js → SelectScrollUpArrow-6kh66YCd.js} +2 -2
- package/dist/client/assets/{SettingsPanels-DoJnxtp0.js → SettingsPanels-BfBUSBAG.js} +6 -6
- package/dist/client/assets/{SettingsPanels.logic-t7cG-B6z.js → SettingsPanels.logic-BsFZYDgm.js} +2 -2
- package/dist/client/assets/{SettingsScopeNotice-DD4QFo3v.js → SettingsScopeNotice-H7UzC9bb.js} +2 -2
- package/dist/client/assets/{T3PCR2KE-Cg6A465M.js → T3PCR2KE-BxaunvVy.js} +2 -2
- package/dist/client/assets/{TKWO2OVW-CWeCEb5C.js → TKWO2OVW-DFURsfqA.js} +2 -2
- package/dist/client/assets/{TSHNXIZL-DTjzxHgA.js → TSHNXIZL-CIukdyLy.js} +2 -2
- package/dist/client/assets/{ThemeEditorPanel-BwydY72w.js → ThemeEditorPanel-otrA-nTg.js} +3 -3
- package/dist/client/assets/{ThreadTerminalDrawer-QTFG89J_.js → ThreadTerminalDrawer-BQKZCFAC.js} +4 -4
- package/dist/client/assets/TooltipViewport-ZmVCer7P.js +2 -0
- package/dist/client/assets/{UQJE5E4I-DS4MjKhw.js → UQJE5E4I-CfqCotH2.js} +2 -2
- package/dist/client/assets/{USNYFO5S-Be1OZGok.js → USNYFO5S-CctAAheU.js} +2 -2
- package/dist/client/assets/{Virtualizer-BpizRoFL.js → Virtualizer-CImHNxBq.js} +2 -2
- package/dist/client/assets/{WEVWDWVA-oFS2VG1Y.js → WEVWDWVA-DS9YO9IT.js} +2 -2
- package/dist/client/assets/{WorkspaceBreadcrumb-ckARUoj9.js → WorkspaceBreadcrumb-BW_omYU1.js} +2 -2
- package/dist/client/assets/{WorkspacePageContainer-D5yW7_av.js → WorkspacePageContainer-BS8FWt_4.js} +2 -2
- package/dist/client/assets/{WorkspacePageHeader-CTWcEH7d.js → WorkspacePageHeader-CE_94tTR.js} +2 -2
- package/dist/client/assets/{X5RFHQXM-Bjw0rDxX.js → X5RFHQXM-B0KbwoE1.js} +2 -2
- package/dist/client/assets/{X62E3GBT-BPHYY59t.js → X62E3GBT-wpz8X9Yh.js} +2 -2
- package/dist/client/assets/{XBNEOJTC-W72qCYdc.js → XBNEOJTC-DFRK5c6Y.js} +2 -2
- package/dist/client/assets/{YHV2MVVZ-DA_drdwk.js → YHV2MVVZ-1NnqTTZ2.js} +2 -2
- package/dist/client/assets/{YURCZMG2-CsfrwNLG.js → YURCZMG2-rnzWY5ij.js} +2 -2
- package/dist/client/assets/{YVG2LODB-dXCBipzg.js → YVG2LODB-Dxuuk2M-.js} +2 -2
- package/dist/client/assets/_chat-1QGQLbCc.js +45 -0
- package/dist/client/assets/{_chat.design-KVMajkdX.js → _chat.design-z2pu_9A5.js} +2 -2
- package/dist/client/assets/{_chat.index-BknTP6QZ.js → _chat.index-D8X9o5jY.js} +2 -2
- package/dist/client/assets/{_chat.new-DLFV1XOJ.js → _chat.new-CGJw8cpo.js} +3 -3
- package/dist/client/assets/_chat.pull-requests-BfW9qMU1.js +2 -0
- package/dist/client/assets/{alert-Dh8AVuLe.js → alert-DO06etEs.js} +2 -2
- package/dist/client/assets/{assetUrls-C6W2_00u.js → assetUrls-CmOUMX2M.js} +2 -2
- package/dist/client/assets/assets-aBpLf8r4.js +2 -0
- package/dist/client/assets/{browserHistoryStore-CeBJcpoN.js → browserHistoryStore-tYgeZygn.js} +2 -2
- package/dist/client/assets/{browserLinkTarget-D5ew8rLG.js → browserLinkTarget-CQFfJKWJ.js} +2 -2
- package/dist/client/assets/{checkbox-Y4v7A1IZ.js → checkbox-BEQFb7GO.js} +2 -2
- package/dist/client/assets/{color-picker-DEWeNc5K.js → color-picker-CXfnfmuH.js} +2 -2
- package/dist/client/assets/{combobox-DGrx2JGy.js → combobox--XoXA5uu.js} +2 -2
- package/dist/client/assets/{command-DR1GjC1a.js → command-E2aLhsct.js} +2 -2
- package/dist/client/assets/composer-logic-BPTz1APL.js +6 -0
- package/dist/client/assets/{composerDraftUploads-DK6jH0cB.js → composerDraftUploads-b_0oxKs9.js} +2 -2
- package/dist/client/assets/{connect-B1NcR-kN.js → connect-CU9dNvTt.js} +2 -2
- package/dist/client/assets/{connect-agent-BNrm24qs.js → connect-agent-Byc9PCdW.js} +2 -2
- package/dist/client/assets/{design-CbG6XJYX.js → design-CoGbXd61.js} +2 -2
- package/dist/client/assets/{device-6R-yC55P.js → device-DmH6IHQ4.js} +2 -2
- package/dist/client/assets/{dialog-BwjzOzO6.js → dialog-CBBxT1gk.js} +2 -2
- package/dist/client/assets/{diffRendering-CG_sb5me.js → diffRendering-BOVFJuWd.js} +2 -2
- package/dist/client/assets/{dist-CFar2AY1.js → dist-B2P3f-0Q.js} +3 -3
- package/dist/client/assets/{draft-input-CpqOZR5i.js → draft-input-CSOOVntS.js} +2 -2
- package/dist/client/assets/{duoViewer-BhE8QUaC.js → duoViewer-BhHYrurM.js} +2 -2
- package/dist/client/assets/{dynamic-CIBySV57.js → dynamic-BhzrutAo.js} +2 -2
- package/dist/client/assets/{embeddedScripts-B0vXhhvs.js → embeddedScripts-43_R83vp.js} +2 -2
- package/dist/client/assets/{empty-C0oiFHy_.js → empty-FOL5U4KY.js} +2 -2
- package/dist/client/assets/entities-Bqo0n1Pb.js +2 -0
- package/dist/client/assets/{fileLinks-CP5NWXaI.js → fileLinks-D4GSqJYj.js} +2 -2
- package/dist/client/assets/{fileTreeExpansion-BKVd4HrC.js → fileTreeExpansion-BBT5F8P1.js} +2 -2
- package/dist/client/assets/{getDiffFileInput-CIK5OMl_.js → getDiffFileInput-CGw09SPI.js} +2 -2
- package/dist/client/assets/{guideRunStore-CegZr43-.js → guideRunStore-DvIkVECt.js} +2 -2
- package/dist/client/assets/{htmlRender-NqJI2UJ2.js → htmlRender-CmEeFzCo.js} +2 -2
- package/dist/client/assets/{index-Czsz7nXH.js → index-B1djVqM4.js} +3 -3
- package/dist/client/assets/{input-BCWES8Y7.js → input-ekYqAkUx.js} +2 -2
- package/dist/client/assets/{input-group-CfPOCEuC.js → input-group-C3pxk97H.js} +2 -2
- package/dist/client/assets/{kbd-EDrgCOls.js → kbd-3FPzNikV.js} +2 -2
- package/dist/client/assets/{keybindings-BG7j7M7S.js → keybindings-B3oDRRkK.js} +2 -2
- package/dist/client/assets/{lazy-D6W01WxZ.js → lazy-DyNR0b0B.js} +4 -4
- package/dist/client/assets/{lazyRouteComponent-B8CSLurY.js → lazyRouteComponent-BPxq_G_s.js} +2 -2
- package/dist/client/assets/{link-COzhJ6br.js → link-B3B5a5Ju.js} +2 -2
- package/dist/client/assets/{linkedPrompt-X4NBlFef.js → linkedPrompt-BsCPMHxQ.js} +2 -2
- package/dist/client/assets/main-BWh6jqG2.js +29 -0
- package/dist/client/assets/main-DdVSHl80.css +2 -0
- package/dist/client/assets/{mediaReference-CKap6oNP.js → mediaReference-Bb8H-qbI.js} +2 -2
- package/dist/client/assets/{mediaSource-DG5l5-5f.js → mediaSource-C2MsZgy8.js} +2 -2
- package/dist/client/assets/number-field-SoHEiP55.js +2 -0
- package/dist/client/assets/{observeResize-BUAH1dvA.js → observeResize-3Vj9DYOV.js} +2 -2
- package/dist/client/assets/{onboarding-CnVH7A6c.js → onboarding-CPgiVEVK.js} +2 -2
- package/dist/client/assets/{openFileInPreview-B0i3eZpu.js → openFileInPreview-BBWCOLh_.js} +2 -2
- package/dist/client/assets/{p4ProjectFile-0RRo3hX4.js → p4ProjectFile-qmvlbzKv.js} +2 -2
- package/dist/client/assets/{pair-B4KNAPh5.js → pair-CZnRGdd8.js} +2 -2
- package/dist/client/assets/{pendingSendStore-Dzn7x7Cg.js → pendingSendStore-L5KquCDf.js} +2 -2
- package/dist/client/assets/{phoneViewer-RhpfiwR2.js → phoneViewer-D-8v-sMf.js} +2 -2
- package/dist/client/assets/{pierre-icons-Cisj4-__.js → pierre-icons-jwqMPUxD.js} +2 -2
- package/dist/client/assets/{popover-BnqKHl4L.js → popover-OfG3wVsl.js} +2 -2
- package/dist/client/assets/{preview-CiojYkh4.js → preview-BYnEURcB.js} +2 -2
- package/dist/client/assets/{preview-Dwq2O7nm.js → preview-DGdQ5Ycc.js} +2 -2
- package/dist/client/assets/{previewMiniPlayerStore-ByZNhmNc.js → previewMiniPlayerStore-Dlbj5KrZ.js} +2 -2
- package/dist/client/assets/primary-B47ivN3o.js +2 -0
- package/dist/client/assets/primaryCloudLinkState-CreqR0gU.js +2 -0
- package/dist/client/assets/projectFilesQueryState-CanWrACx.js +2 -0
- package/dist/client/assets/{projectScriptEditor-B4iSq27p.js → projectScriptEditor-gWuw6vwd.js} +2 -2
- package/dist/client/assets/{providerSkills-C4Fu_qyq.js → providerSkills-C_Rxqah9.js} +2 -2
- package/dist/client/assets/{pullRequestDetail.logic-BmYDDw_8.js → pullRequestDetail.logic-RASi2EgP.js} +4 -4
- package/dist/client/assets/{pullRequestIcons-DFcQ9rtl.js → pullRequestIcons-ucGaXXG7.js} +2 -2
- package/dist/client/assets/{pullRequestReviewStore-BGzKslrq.js → pullRequestReviewStore-CEr41DEl.js} +2 -2
- package/dist/client/assets/pullRequests-Bw3Ui6hK.js +2 -0
- package/dist/client/assets/queries-EslKFJTV.js +2 -0
- package/dist/client/assets/query-d1pQlqP0.js +2 -0
- package/dist/client/assets/{radio-group-DOHTpBxX.js → radio-group-Ciy_K5uE.js} +2 -2
- package/dist/client/assets/{renderScheduler-Df4T8RWh.js → renderScheduler-CP-JkmKx.js} +2 -2
- package/dist/client/assets/rightPanelStore-D3KOmuPa.js +2 -0
- package/dist/client/assets/runtime-DR7JxgbQ.js +6 -0
- package/dist/client/assets/runtime-d6B1vJeH.js +3 -0
- package/dist/client/assets/runtimeModeConfig-Rxeb1uGg.js +2 -0
- package/dist/client/assets/{scheduledTasksSettings.logic-7E0KSnA7.js → scheduledTasksSettings.logic-CVIC4Kpr.js} +3 -3
- package/dist/client/assets/{scroll-area-B9LorBFb.js → scroll-area-yyfi3ycu.js} +2 -2
- package/dist/client/assets/{select-Ctq0UILH.js → select-DaYjjw1q.js} +2 -2
- package/dist/client/assets/selfImproveFindings-1XIHD-7i.js +2 -0
- package/dist/client/assets/server-sXApTCjZ.js +2 -0
- package/dist/client/assets/{session-C7ckxjAM.js → session-C949OsEI.js} +2 -2
- package/dist/client/assets/session-logic-DkSfwnHl.js +26 -0
- package/dist/client/assets/{settings-BqhxEPKC.js → settings-B0O54Q3P.js} +2 -2
- package/dist/client/assets/{settings.appearance-DljtCz6-.js → settings.appearance-BesXhA1a.js} +2 -2
- package/dist/client/assets/settings.archived-FtcZf_Ug.js +2 -0
- package/dist/client/assets/settings.computer-use-BeKmLbNe.js +2 -0
- package/dist/client/assets/settings.connections-D1UxckE0.js +2 -0
- package/dist/client/assets/{settings.data-controls-Cdccmn63.js → settings.data-controls-lPiIwMgc.js} +2 -2
- package/dist/client/assets/settings.decisions-D97jIUyr.js +2 -0
- package/dist/client/assets/{settings.designs-TeCw-uLf.js → settings.designs-B473PRvt.js} +2 -2
- package/dist/client/assets/settings.diagnostics-DDOaOIDg.js +2 -0
- package/dist/client/assets/{settings.general-uxwywmhh.js → settings.general-qzEOE2zF.js} +2 -2
- package/dist/client/assets/settings.integrations-D6ctQ9WI.js +2 -0
- package/dist/client/assets/{settings.keybindings-C0FBNk1_.js → settings.keybindings-BL57H4sD.js} +2 -2
- package/dist/client/assets/{settings.open-source-licenses-wMwaYCss.js → settings.open-source-licenses-DaS82UhN.js} +2 -2
- package/dist/client/assets/{settings.plugins-CFiDE3ms.js → settings.plugins-DnS3RrT2.js} +4 -4
- package/dist/client/assets/{settings.projects-DN0n2td7.js → settings.projects-D-ZICXey.js} +4 -4
- package/dist/client/assets/settings.providers-CFpCmv0o.js +3 -0
- package/dist/client/assets/{settings.scheduled-tasks-uCL4Wgvt.js → settings.scheduled-tasks-IEAC3STn.js} +2 -2
- package/dist/client/assets/{settings.snap-shot-C4OHP0nR.js → settings.snap-shot-BaOFk9WR.js} +2 -2
- package/dist/client/assets/{settings.source-control-pMBspYC4.js → settings.source-control-BW16AA5z.js} +2 -2
- package/dist/client/assets/{settings.storage-QCydiEyw.js → settings.storage-D4vBYBRP.js} +2 -2
- package/dist/client/assets/settingsLayout-CFQx1XDM.js +3 -0
- package/dist/client/assets/{sidebar-CRr8B41y.js → sidebar-C1E4GqL6.js} +2 -2
- package/dist/client/assets/{sidebarProjectGrouping-miDXfjI3.js → sidebarProjectGrouping-9cUrCOXH.js} +2 -2
- package/dist/client/assets/{skeleton-C9J-Xl06.js → skeleton-BCpBrYxh.js} +2 -2
- package/dist/client/assets/{sourceControl-C8nJMDiL.js → sourceControl-DwJWPP0h.js} +2 -2
- package/dist/client/assets/{sourceControlClients-DKONtKbZ.js → sourceControlClients-BBJW7ra4.js} +2 -2
- package/dist/client/assets/{spinner-CNva85zM.js → spinner-CSTrcxhP.js} +2 -2
- package/dist/client/assets/{terminal-links-BJzLp7ix.js → terminal-links-D18LpQ1T.js} +2 -2
- package/dist/client/assets/{terminalSessions-BPc8sBGR.js → terminalSessions-C2NUFncF.js} +2 -2
- package/dist/client/assets/{textarea-DjRGRzMg.js → textarea-R4UQ47Ns.js} +2 -2
- package/dist/client/assets/{themePalette-fhKYLCuU.js → themePalette-neUNWCzK.js} +3 -3
- package/dist/client/assets/toast-B84QdqqM.js +2 -0
- package/dist/client/assets/{toggle-Bbnow7xY.js → toggle-BH5BGBcD.js} +2 -2
- package/dist/client/assets/{toggle-group-Cilo8czD.js → toggle-group-Di3SFV73.js} +2 -2
- package/dist/client/assets/{tooltip-T5ePvxsH.js → tooltip-D-GRl-oZ.js} +2 -2
- package/dist/client/assets/{uiStateStore-D9r3BNZ-.js → uiStateStore-xSkh4_PU.js} +2 -2
- package/dist/client/assets/{usage-QBPLx2wr.js → usage-DUdXloVo.js} +2 -2
- package/dist/client/assets/{usageAccess-DUfVA8nU.js → usageAccess-DSLF-sRE.js} +2 -2
- package/dist/client/assets/{usageFormat-C-mTuUS7.js → usageFormat-Bzyvr9m4.js} +2 -2
- package/dist/client/assets/{usageShortcuts-CB6TvooP.js → usageShortcuts-D6nQeRtx.js} +2 -2
- package/dist/client/assets/{use-atom-command-BNkv9iyk.js → use-atom-command-DA6OG-Qk.js} +2 -2
- package/dist/client/assets/{useAriaLabelledBy-D5HM2KLM.js → useAriaLabelledBy-PLuOxvFb.js} +2 -2
- package/dist/client/assets/{useHandleNewThread-DntRaFvm.js → useHandleNewThread-Dm0SCq59.js} +2 -2
- package/dist/client/assets/{useLocation-DbWity7H.js → useLocation-Bqc94klS.js} +2 -2
- package/dist/client/assets/{useNavigate-Cxh24teV.js → useNavigate-DdjG4MB_.js} +2 -2
- package/dist/client/assets/{useNavigateBack-B5mTfIHJ.js → useNavigateBack-sP0LsL3p.js} +2 -2
- package/dist/client/assets/{useP4ConnectAuthPrompt-sjWWPvrn.js → useP4ConnectAuthPrompt-C9d7n33S.js} +2 -2
- package/dist/client/assets/{useParams-D9PdK0IA.js → useParams-DZQvRQLJ.js} +2 -2
- package/dist/client/assets/{usePermissionStatus-D6i3IaCj.js → usePermissionStatus-BzfAUU9X.js} +2 -2
- package/dist/client/assets/{usePullRequestActions-9274Vp3W.js → usePullRequestActions-DIjGLg1E.js} +3 -3
- package/dist/client/assets/{useRegisterFieldControl-DZyLTxKX.js → useRegisterFieldControl-CyBVe0G0.js} +2 -2
- package/dist/client/assets/{useScopedModelAvailability-CmlQi7Iz.js → useScopedModelAvailability-D4n22Nmm.js} +2 -2
- package/dist/client/assets/useSettings-CaJMqrvF.js +3 -0
- package/dist/client/assets/utils-BoMYW9A3.js +37 -0
- package/dist/client/assets/vcsRefInvalidation-w_CQ3i43.js +2 -0
- package/dist/client/assets/{welcome-DVusCS_L.js → welcome-BIKH3rbU.js} +2 -2
- package/dist/client/index.html +1 -1
- package/dist/{renderer-CJXpJ36b.mjs → renderer-CveKT929.mjs} +26 -3
- package/dist/{runtime-EqYv-lrV.mjs → runtime-DGGSjC6Q.mjs} +148 -4
- package/package.json +1 -1
- package/dist/client/assets/AlertDialogRoot-BUODcEy9.js +0 -2
- package/dist/client/assets/ChatGptUsageButton-CMIjZ66V.js +0 -2
- package/dist/client/assets/ComposerPromptEditor-D2ObH3Py.js +0 -204
- package/dist/client/assets/DiffPanel-BGnRzWM8.js +0 -2
- package/dist/client/assets/EmbeddedDesign-BV_FcJ4l.js +0 -21
- package/dist/client/assets/EmbeddedDesign-Cud7UEy4.css +0 -1
- package/dist/client/assets/Input-DLaKk0qb.js +0 -2
- package/dist/client/assets/JZOYTAAL-SLYGD65P.js +0 -1
- package/dist/client/assets/PanelLayoutControls-CqeL3uQz.js +0 -216
- package/dist/client/assets/PreviewPanel-CvBQAq3I.js +0 -2
- package/dist/client/assets/ProjectDefaultsSettings-DLJfUN7i.js +0 -2
- package/dist/client/assets/ProviderModelPicker-AkULlCAn.js +0 -2
- package/dist/client/assets/PullRequestCodeTab-BamXVeZz.js +0 -6
- package/dist/client/assets/ScheduledTasksSettings-DF_KhqLx.js +0 -4
- package/dist/client/assets/TooltipViewport-C14m3uB7.js +0 -2
- package/dist/client/assets/_chat-BIqme2Hz.js +0 -46
- package/dist/client/assets/_chat.pull-requests-BDLRkW2A.js +0 -2
- package/dist/client/assets/assets-D-xsxvzf.js +0 -2
- package/dist/client/assets/composer-logic-BW4G8aDL.js +0 -6
- package/dist/client/assets/entities-Om5Klild.js +0 -2
- package/dist/client/assets/main-BGaSDXjP.js +0 -29
- package/dist/client/assets/main-BP1f3auf.css +0 -2
- package/dist/client/assets/number-field-DGdBjQD2.js +0 -2
- package/dist/client/assets/primary-CMwTDEi1.js +0 -2
- package/dist/client/assets/primaryCloudLinkState-2j4MjqVh.js +0 -2
- package/dist/client/assets/projectFilesQueryState-DXrTSOqg.js +0 -2
- package/dist/client/assets/pullRequests-DT0oG7tF.js +0 -2
- package/dist/client/assets/queries-CXgT6mki.js +0 -2
- package/dist/client/assets/query-DlK0I8Jc.js +0 -2
- package/dist/client/assets/rightPanelStore-DXw7-xK3.js +0 -2
- package/dist/client/assets/runtime-BL7IF4n-.js +0 -3
- package/dist/client/assets/runtime-Dm3Pi31_.js +0 -6
- package/dist/client/assets/runtimeModeConfig-_-kQoAWi.js +0 -2
- package/dist/client/assets/server-BvxyePeo.js +0 -2
- package/dist/client/assets/session-logic-P8gC-UQc.js +0 -26
- package/dist/client/assets/settings.archived-SsFK0IFf.js +0 -2
- package/dist/client/assets/settings.computer-use-CVmc70Ib.js +0 -2
- package/dist/client/assets/settings.connections-BrPlTKQ_.js +0 -2
- package/dist/client/assets/settings.decisions-pkwqjsKP.js +0 -2
- package/dist/client/assets/settings.diagnostics-BZD1uMGP.js +0 -2
- package/dist/client/assets/settings.integrations-Du282Gn7.js +0 -2
- package/dist/client/assets/settings.providers-DeUZZg7C.js +0 -3
- package/dist/client/assets/settingsLayout-DFYjWgKN.js +0 -3
- package/dist/client/assets/toast-BcjbmUtS.js +0 -2
- package/dist/client/assets/useSettings-BL4ZWGQV.js +0 -3
- package/dist/client/assets/utils-CrFJwxSd.js +0 -37
- package/dist/client/assets/vcsRefInvalidation-BPy1eoDi.js +0 -2
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import{Lw as e,aE as t,as as n,is as r,rs as i}from"./utils-BoMYW9A3.js";function a(e){let t=new Map;for(let n of e){let e=n.turnId??`unknown-turn`,r=t.get(e)??{turnId:n.turnId,reviewIds:[],findings:[]};r.reviewIds.push(n.id);for(let[e,t]of n.findings.entries())r.findings.push({key:`${n.id}:${e}`,reviewId:n.id,finding:t});t.set(e,r)}return[...t].map(([e,t])=>({key:e,...t}))}var o=e=>e.priority>=4;function s(e){let t=e.scope===`global`?`Global`:`Project${e.project?` ${e.project}`:``}`;return`Priority ${e.priority} · ${e.confidence}% · ${t}`}var c=(e,t,n)=>JSON.stringify([e,t,n]),l=i(e=>n(null).pipe(r));function u(e,t){return e!==null&&e.reviewIds.some(e=>t.reviewIds.includes(e))?e:{reviewIds:t.reviewIds,expanded:!1,toggled:new Map,entered:!1,dismissed:[],receipt:null,undone:null,closed:!1,inFlight:null,error:null,errorMessage:null}}function d(e,t){let n=t.reviewIds.filter(t=>!e.dismissed.includes(t)),r=e.closed||n.length===0&&e.receipt===null,i=r?t.findings:t.findings.filter(t=>!e.dismissed.includes(t.reviewId)),a=t=>e.toggled.get(t.key)??o(t.finding);return{openReviewIds:n,findings:i,isSelected:a,selected:i.filter(a),done:r,receipt:e.receipt,undone:e.undone,busy:e.inFlight!==null||r,saving:e.inFlight===`save`,error:e.inFlight===null?e.error:null,errorMessage:e.inFlight===null?e.errorMessage:null}}function f(e,t,n,r){let i=l(t),a=u(e.get(i),n);e.set(i,{...r(a),reviewIds:[...new Set([...a.reviewIds,...n.reviewIds])]})}async function p(e,t,n,r,i){f(e,t,n,e=>({...e,inFlight:`dismiss`,error:null}));let a=await i(r).catch(()=>!1);f(e,t,n,e=>a?{...e,inFlight:null,dismissed:[...e.dismissed,...r]}:{...e,inFlight:null,error:`dismiss`,errorMessage:null})}function m(n,r){if(n._tag===`Success`)return{ok:!0,value:n.value};let i=e(n.cause),a=t(i)?i.value.message:void 0;return{ok:!1,message:typeof a==`string`&&a?a:r}}async function h(e,t,n,r){f(e,t,n,e=>({...e,inFlight:`save`,error:null,errorMessage:null}));let i=await r.save().catch(()=>({ok:!1,message:`Couldn't save.`}));f(e,t,n,e=>i.ok?{...e,inFlight:null,receipt:i.value,expanded:!0,dismissed:i.value.findings.some(e=>e.outcome!==`skipped`)?[...e.dismissed,...r.reviewIds]:e.dismissed}:{...e,inFlight:null,error:`save`,errorMessage:i.message})}async function g(e,t,n,r){let i=e.get(l(t))?.receipt?.saveId;if(!i)return;f(e,t,n,e=>({...e,inFlight:`undo`,error:null,errorMessage:null}));let a=await r(i).catch(()=>({ok:!1,message:`Couldn't undo.`}));f(e,t,n,e=>a.ok?{...e,inFlight:null,receipt:null,undone:null,closed:!1,dismissed:e.dismissed.filter(e=>!n.reviewIds.includes(e)),error:null,errorMessage:null}:{...e,inFlight:null,error:`undo`,errorMessage:a.message})}var _=(e,t)=>{let n=e.get(l(t));return n!==null&&!n.closed&&(n.receipt!==null||n.inFlight===`save`)};function v(e,t){if(t)return t.restored>0?`Save undone`:`Nothing to undo; the files changed since`;let n=e.findings.filter(e=>e.outcome!==`skipped`).length,r=e.findings.length-n;if(n===0)return r===1?`Nothing saved`:`Nothing saved, ${r} skipped`;let i=`Saved ${n} ${n===1?`memory`:`memories`}`;return r>0?`${i}, skipped ${r}`:i}function y(e){switch(e.status){case`off`:return null;case`unchanged`:return`Mirror already up to date.`;case`pushed`:return`Mirrored and pushed${e.detail?` (${e.detail})`:``}.`;case`failed`:return`Couldn't push the mirror: ${e.detail??`unknown error`}`}}function b(e,t){if(e.outcome===`skipped`)return`Skipped`;let n=e.file?.split(`/`).pop()??``;return t&&e.file!==null&&t.files.includes(e.file)?`Removed from ${n}`:`${e.outcome===`merged`?`Merged into`:`Added to`} ${n}`}export{s as a,c,y as d,v as f,f as h,m as i,d as l,g as m,u as n,_ as o,b as p,h as r,l as s,p as t,a as u};
|
|
2
|
+
//# sourceMappingURL=selfImproveFindings-1XIHD-7i.js.map
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import{Aw as e,Ic as t,Oh as n,Os as r,Qw as i,Sx as a,Vw as o,as as s,kS as c,ps as l,tE as u,uC as d}from"./utils-BoMYW9A3.js";import{I as f,k as p}from"./runtime-DR7JxgbQ.js";import{Bt as m,Ct as h,St as g,t as _,vt as v,wt as y,xt as b}from"./runtime-d6B1vJeH.js";import{t as x}from"./session-C949OsEI.js";var S=m(_);function C(t){return f(t,{label:`environment-data:server:update-outdated-server`,scheduler:p(),concurrency:{mode:`singleFlight`,key:({environmentId:e})=>e},execute:(t,n)=>{let r=y(t.environmentId),s=t.input.targetVersion,l=t.fromVersion??s,u=`downloading`,f=e=>d(()=>{u=e,n.set(r,{status:`running`,stage:e,fromVersion:l,targetVersion:s})});return f(u).pipe(a(b(t.environmentId,t.input,f)),c(t=>d(()=>{if(e(t)||o(t.cause)){n.set(r,{status:`idle`});return}n.set(r,{status:`failed`,stage:u,fromVersion:l,targetVersion:s,message:h(i(t.cause))})})))}})}var w=s(e=>{for(let[t,n]of e(S.catalogValueAtom).entries)if(n.target._tag===`PrimaryConnectionTarget`)return t;return null}).pipe(l(`web-primary-environment-id`)),T=g(_,{initialConfigValueAtom:x.initialConfigValueAtom,environmentThemes:!0,usageLimitSources:!0,usageLimitsCommand:!0}),E=C(_),D=v({catalogValueAtom:S.catalogValueAtom,serverConfigValueAtom:T.configValueAtom}),O=[],k=[],A={config:null,latestEvent:null,welcome:null},j=s(e=>{let t=e(w);if(t===null)return A;let n={environmentId:t,input:{}},i=u(r(e(T.configProjection(n)))),a=u(r(e(T.welcome(n))));return{config:e(T.configValueAtom(t)),latestEvent:i?.latestEvent??null,welcome:a}}).pipe(l(`web-primary-server-state`)),M=s(e=>e(j).config).pipe(l(`web-primary-server-config`)),N=s(e=>e(j).latestEvent).pipe(l(`web-primary-server-config-event`)),P=s(e=>e(j).welcome).pipe(l(`web-primary-server-welcome`)),F=s(e=>{let t=e(w);return t===null?null:u(r(e(T.legacyThreadMigration({environmentId:t,input:{}}))))}).pipe(l(`web-primary-server-legacy-thread-migration`)),I=s(e=>e(M)?.settings??n).pipe(l(`web-primary-server-settings`)),L=s(e=>e(M)?.providers??k).pipe(l(`web-primary-server-providers`)),R=s(e=>t(e(M)?.keybindings??[])).pipe(l(`web-primary-server-keybindings`)),z=s(e=>e(M)?.availableEditors??O).pipe(l(`web-primary-server-available-editors`)),B=[],V=s(e=>e(M)?.environmentThemes??B).pipe(l(`web-primary-server-environment-themes`));export{N as a,F as c,P as d,T as f,S as h,M as i,L as l,w as m,D as n,V as o,E as p,z as r,R as s,k as t,I as u};
|
|
2
|
+
//# sourceMappingURL=server-sXApTCjZ.js.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{n as e}from"./jsx-runtime-BnjsACtP.js";import{Os as t,Zo as n,as as r,
|
|
2
|
-
//# sourceMappingURL=session-
|
|
1
|
+
import{n as e}from"./jsx-runtime-BnjsACtP.js";import{Os as t,Zo as n,as as r,cE as i,ps as a,sv as o,tE as s,ts as c,ws as l}from"./utils-BoMYW9A3.js";import{at as u}from"./runtime-DR7JxgbQ.js";import{t as d}from"./runtime-d6B1vJeH.js";var f=e(),p=u(d),m=r(l());function h(e,t){let n=(0,f.c)(5),r;n[0]===e?r=n[1]:(r=e===null?m:p.sessionStateAtom(e),n[0]=e,n[1]=r);let i=c(r),a;return n[2]!==i||n[3]!==t?(a=g(i,t),n[2]=i,n[3]=t,n[4]=a):a=n[4],a}function g(e,n){let r=s(t(e));return e._tag!==`Failure`&&r!==null&&o(r,n)}function _(e,t){let n=(0,f.c)(3),i;return n[0]!==e||n[1]!==t?(i=r(n=>{let r=new Set;for(let{environmentId:i}of e)g(n(p.sessionStateAtom(i)),t)&&r.add(i);return r}),n[0]=e,n[1]=t,n[2]=i):i=n[2],c(i)}function v(e,t){return g(n.get(p.sessionStateAtom(e)),t)}var y=r(i()).pipe(a(`web-prepared-connection:empty`));function b(e){let t=(0,f.c)(2),n;return t[0]===e?n=t[1]:(n=e===null?y:p.preparedConnectionValueAtom(e),t[0]=e,t[1]=n),c(n)}function x(e){return s(n.get(p.preparedConnectionValueAtom(e)))}function S(e){let n=(0,f.c)(8),r;n[0]===e?r=n[1]:(r=p.sessionStateAtom(e),n[0]=e,n[1]=r);let i=c(r),a;n[2]===i?a=n[3]:(a=s(t(i)),n[2]=i,n[3]=a);let o=i._tag===`Failure`,l;return n[4]!==i.waiting||n[5]!==a||n[6]!==o?(l={data:a,hasError:o,isPending:i.waiting},n[4]=i.waiting,n[5]=a,n[6]=o,n[7]=l):l=n[7],l}export{S as a,h as i,v as n,_ as o,x as r,b as s,p as t};
|
|
2
|
+
//# sourceMappingURL=session-C949OsEI.js.map
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import{Bs as e,Du as t,Eu as n,Ot as r,Ou as i,Rs as a,Tu as o,V as s,_x as c,dx as l,e_ as u,ku as d,r_ as f,vE as p,wu as m,xE as h}from"./utils-BoMYW9A3.js";import{Kt as ee,Ut as g,an as te,d as _,in as ne,qt as re,yn as ie}from"./runtime-d6B1vJeH.js";import{h as ae}from"./htmlRender-CmEeFzCo.js";import{n as oe,t as se}from"./mediaSource-C2MsZgy8.js";import{l as ce}from"./usageFormat-Bzyvr9m4.js";function v(e){return typeof e==`object`&&e&&!Array.isArray(e)?e:void 0}function y(e){if(typeof e!=`string`)return;let t=e.trim();return t.length>0?t:void 0}function le(e,t){if(e!==`Skill`)return;let n=v(t),r=y(n?.skill);return r===void 0?void 0:{name:r,args:y(n?.args)}}function b(e){return e===`js`||e===`cua_repl.js`||e===`node_repl.js`}var ue={key:`computer-use`,name:`Computer Use`,kind:`computer`};function de(e,t){if(e===`cua_repl.js`)return`computer`;let n=v(t)?.code;return b(e)&&typeof n==`string`&&(/\bsky\s*\./u.test(n)||/["']@oai\/sky["']/u.test(n))?`computer`:void 0}function fe(e,t,n){if(b(e)){let r=y(n),i=r&&r.toLowerCase()!==`js`&&r.toLowerCase()!==e?.toLowerCase()?r:void 0;return y(v(t)?.title)??i??(de(e,t)===`computer`?`Computer use`:`Run JavaScript`)}let r=le(e,t);return r===void 0?void 0:`Skill: ${r.name}`}function pe(e){return e!==void 0&&Object.keys(e).length>0}var me=[`path`,`filePath`,`file_path`,`relativePath`,`filename`,`fileName`,`newPath`,`oldPath`];function x(e,t,n,r){if(r>4||t.length>=8)return;if(Array.isArray(e)){for(let i of e)if(x(i,t,n,r+1),t.length>=8)return;return}let i=v(e);if(i){for(let e of me){let r=y(i[e]);if(r&&!n.has(r)&&(n.add(r),t.push(r),t.length>=8))return}for(let e of[`locations`,`item`,`input`,`result`,`rawInput`,`data`,`changes`])if(e in i&&(x(i[e],t,n,r+1),t.length>=8))return}}function he(e){let t=[];return x(e,t,new Set,0),t}function ge(e){let t=y(e);if(t&&!/__|[./]/u.test(t))return t.replace(/[_\s-]/gu,``).toLowerCase()}function _e(e){let t=e.itemType??void 0,n=y(e.requestKind)?.toLowerCase(),r=y(e.data?.kind)?.toLowerCase(),i=ge(y(e.data?.toolName)??y(v(e.data?.item)?.tool));return t===`command_execution`?`command`:t===`image_view`?`read`:t===`file_change`?`file_change`:t===`web_search`?`search`:n===`command`||r===`execute`?`command`:n===`file-change`||r===`edit`||r===`move`||r===`delete`||r===`write`?`file_change`:r===`search`||i===`find`||i===`grep`||i===`glob`||i===`rg`||i===`ls`?`search`:n===`file-read`||r===`read`?`read`:i===`terminal`||i===`bash`||i===`shell`?`command`:i===`read`||i===`readfile`?`read`:`other`}var ve=[`pattern`,`query`,`searchTerm`,`regex`,`grep`,`needle`],ye=[`glob`,`globPattern`,`glob_pattern`,`include`,`filePattern`,`file_pattern`],be=[`path`,`target_directory`,`targetDirectory`,`directory`,`cwd`,`root`];function S(e,t){if(e)for(let n of t){let t=y(e[n]);if(t)return t}}function xe(e){return[e?.rawInput,e?.input,v(e?.item)?.input].map(v).find(e=>pe(e??void 0))??e}function Se(e){if(e)return e.split(/[\\/]/u).findLast(e=>e.length>0&&e!==`.`)}function Ce(e){let t=xe(e),n=S(t,ve),r=S(t,ye),i=Se(S(t,be));if(n&&i)return`Searched ${n} in ${i}`;if(r&&i)return`Searched files ${r} in ${i}`;if(r)return`Searched files ${r}`;if(n)return`Searched ${n}`;if(i)return`Searched in ${i}`}function we(e,t=0){let n=e.trim(),r=t>0?` +${t} more`:``;return n?`Read ${n}${r}`:`Read file${r}`}function C(e){return typeof e==`object`&&e&&!Array.isArray(e)?e:void 0}function w(e,t){if(typeof e!=`string`)return;let n=e.trim();return n&&n.length<=t?n:void 0}function T(e){let t=w(e,4096);if(t)try{let e=new URL(t);return e.protocol===`http:`||e.protocol===`https:`||e.protocol===`data:`?e.href:void 0}catch{return}}function Te(e){let t=w(e,4096);if(t)try{let e=new URL(t);return e.protocol===`http:`||e.protocol===`https:`?e.href:void 0}catch{return}}function Ee(e){let t=C(e),n=w(t?.appId,512);if(t?._tag===`app-id`&&n&&/^[A-Za-z0-9._-]+$/u.test(n))return{_tag:`app-id`,appId:n};let r=w(t?.displayName,160);if(t?._tag===`display-name`&&r)return{_tag:`display-name`,displayName:r}}function De(e){let t=C(e);if(t?._tag===`website`){let e=Te(t.pageUrl),n=T(t.faviconUrl),r=T(t.faviconUrlDark);if(e)return{_tag:`website`,pageUrl:e,...n?{faviconUrl:n}:{},...r?{faviconUrlDark:r}:{}}}if(t?._tag===`native-app`){let e=Ee(t.app);if(e)return{_tag:`native-app`,app:e}}if(t?._tag===`themed-logo`){let e=T(t.logoUrl),n=T(t.logoUrlDark);if(e)return{_tag:`themed-logo`,logoUrl:e,...n?{logoUrlDark:n}:{}}}}function Oe(e){let t=C(e),n=w(t?.key,512),r=w(t?.name,160),i=t?.kind;if(!n||!r||i!==`browser`&&i!==`computer`&&i!==`integration`)return;let a=De(t?.icon);return{key:n,name:r,kind:i,...a?{icon:a}:{}}}function ke(e){let t=C(e),n=Oe(t?.toolSource),r=t?.toolSurface===`browser`||t?.toolSurface===`computer`?t.toolSurface:n?.kind===`computer`||n?.kind===`browser`?n.kind:t?.type===`dynamic_tool`?de(typeof t.toolName==`string`?t.toolName:void 0,t.input):void 0,i=r===`computer`&&n?.kind!==`computer`?ue:n,a=De(t?.toolIcon),o=w(t?.viewedImagePath,4096);return{...r?{toolSurface:r}:{},...a?{toolIcon:a}:{},...i?{toolSource:i}:{},...o&&!/[\r\n]/.test(o)&&_(o)?{viewedImagePath:o}:{}}}var Ae=`2026-01-26`,E=`p4McpApp`,je=80,Me=2e3,Ne=32,Pe=256,Fe=256,Ie=4096,Le=/^(?:https?|wss?):\/\/(?:\*\.)?[a-z0-9-]+(?:\.[a-z0-9-]+)*(?::\d{1,5})?$/i;function Re(e){if(!Array.isArray(e))return;let t=e.filter(e=>typeof e==`string`&&e.length<=Pe&&Le.test(e)).slice(0,Ne);return t.length===0?void 0:t}function ze(e){if(!h(e))return;let t={};for(let n of[`connectDomains`,`resourceDomains`,`frameDomains`,`baseUriDomains`]){let r=Re(e[n]);r!==void 0&&(t[n]=r)}return Object.keys(t).length===0?void 0:t}var Be=[`camera`,`microphone`,`geolocation`,`clipboardWrite`];function Ve(e){if(!h(e))return;let t={};for(let n of Be)h(e[n])&&(t[n]={});return Object.keys(t).length===0?void 0:t}var D=e=>typeof e==`string`&&e.trim()!==``&&e.length<=Fe?e:void 0;function He(e){if(!h(e))return;let t=D(e.attachmentId),n=D(e.server),r=D(e.tool),i=typeof e.resourceUri==`string`&&e.resourceUri.length<=Ie?e.resourceUri:void 0;if(t===void 0||n===void 0||r===void 0||i===void 0||!i.startsWith(`ui://`))return;let a=ze(e.csp),o=Ve(e.permissions);return{attachmentId:t,server:n,tool:r,resourceUri:i,...a===void 0?{}:{csp:a},...o===void 0?{}:{permissions:o},...typeof e.prefersBorder==`boolean`?{prefersBorder:e.prefersBorder}:{}}}function Ue(e,t){return e.attachmentId===t.attachmentId&&e.server===t.server&&e.tool===t.tool&&e.resourceUri===t.resourceUri}function We(e){let t=[];return e?.camera&&t.push(`camera`),e?.microphone&&t.push(`microphone`),e?.geolocation&&t.push(`geolocation`),e?.clipboardWrite&&t.push(`clipboard-write`),t.join(`; `)}function Ge(e){return Number.isFinite(e)?Math.round(Math.min(Me,Math.max(je,e))):320}function Ke(e){return`${e.tool.replace(/[^\w.-]+/g,`-`).slice(0,80)||`app`}.html`}function O(e,t,n=`p4-code`,r=`${e[0]} ${e[3]}`){return{displayName:r,labels:e,icon:n,summaryAction:t}}var qe=new Set([`p4-code`,`p4_code`,`p4code`]),k={p4_computer_use:O([`Control`,`Controlling`,`Controlled`,`a computer`],`browser`,`browser`),p4_computer_use_reset:O([`Reset`,`Resetting`,`Reset`,`Computer Use`],`browser`,`browser`),p4_computer_use_hosts:O([`List`,`Listing`,`Listed`,`Computer Use hosts`],`browser`,`browser`),p4_decide:O([`Ask`,`Asking`,`Asked`,`Decisions`],`decide`),link_pull_request:O([`Link`,`Linking`,`Linked`,`a pull request`],`link-pr`,`pull-request`),unlink_pull_request:O([`Unlink`,`Unlinking`,`Unlinked`,`a pull request`],`unlink-pr`,`pull-request`),list_thread_pull_requests:O([`Check`,`Checking`,`Checked`,`linked pull requests`],`list-prs`,`pull-request`),watch_pull_request:O([`Watch`,`Watching`,`Watching`,`a pull request`],`watch-pr`,`pull-request`),unwatch_pull_request:O([`Stop watching`,`Stopping watching`,`Stopped watching`,`a pull request`],`unwatch-pr`,`pull-request`),write_pull_request_guides:O([`Write`,`Writing`,`Started`,`review guides`],`write-pr-guides`,`pull-request`),read_pull_request_guide:O([`Read`,`Reading`,`Read`,`a review guide`],`read-pr-guide`,`pull-request`),orchestrator_capabilities:O([`Get`,`Getting`,`Got`,`orchestration capabilities`],`capabilities`),delegate_task:O([`Delegate`,`Delegating`,`Delegated`,`a child task`],`delegate`),task_status:O([`Get`,`Getting`,`Got`,`delegated task status`],`task-status`),task_cancel:O([`Cancel`,`Canceling`,`Requested cancellation of`,`delegated task`],`task-cancel`),schedule_task:O([`Schedule`,`Scheduling`,`Scheduled`,`a recurring task`],`schedule-create`),list_scheduled_tasks:O([`List`,`Listing`,`Listed`,`scheduled tasks`],`schedule-list`),update_scheduled_task:O([`Update`,`Updating`,`Updated`,`a scheduled task`],`schedule-update`),delete_scheduled_task:O([`Delete`,`Deleting`,`Requested deletion of`,`a scheduled task`],`schedule-delete`),request_secret:O([`Ask for`,`Asking for`,`Asked for`,`a secret`],`secret-request`),create_threads:O([`Create`,`Creating`,`Created`,`P4 threads`],`thread-create`),p4_thread_start:O([`Start`,`Starting`,`Started`,`a P4 Code thread`],`thread-create`),p4_thread_list:O([`List`,`Listing`,`Listed`,`P4 threads`],`thread-list`),p4_thread_read:O([`Read`,`Reading`,`Read`,`a P4 Code thread`],`thread-read`),p4_thread_send:O([`Send`,`Sending`,`Sent`,`to a P4 Code thread`],`thread-send`),p4_thread_wait:O([`Wait`,`Waiting`,`Waited`,`for a P4 Code thread`],`thread-wait`),p4_workflow_stop:O([`Stop`,`Stopping`,`Requested a stop for`,`a workflow`],`workflow-stop`),p4_thread_interrupt:O([`Interrupt`,`Interrupting`,`Requested an interrupt of`,`a P4 Code thread`],`thread-interrupt`),p4_worktree_handoff:O([`Hand off`,`Handing off`,`Handed off`,`thread to a git worktree`],`worktree-handoff`),p4_worktree_status:O([`Get`,`Getting`,`Got`,`thread worktree status`],`worktree-status`),preview_status:O([`Get`,`Getting`,`Got`,`preview browser status`],`browser`,`browser`),preview_open:O([`Open`,`Opening`,`Opened`,`a page in the preview browser`],`browser`,`browser`),preview_navigate:O([`Navigate`,`Navigating`,`Navigated`,`the preview browser`],`browser`,`browser`),preview_dialog:O([`Respond`,`Responding`,`Responded`,`to a preview browser dialog`],`browser`,`browser`),preview_snapshot:O([`Take a snapshot of`,`Taking a snapshot of`,`Took a snapshot of`,`the preview page`],`browser`,`browser`,`Snapshot the preview page`),preview_click:O([`Click`,`Clicking`,`Clicked`,`in the preview browser`],`browser`,`browser`),preview_press:O([`Press`,`Pressing`,`Pressed`,`a key in the preview browser`],`browser`,`browser`),preview_type:O([`Type`,`Typing`,`Typed`,`in the preview browser`],`browser`,`browser`),preview_hover:O([`Hover`,`Hovering`,`Hovered`,`in the preview browser`],`browser`,`browser`),preview_select:O([`Choose`,`Choosing`,`Chose`,`an option in the preview browser`],`browser`,`browser`),preview_drag:O([`Drag`,`Dragging`,`Dragged`,`in the preview browser`],`browser`,`browser`),preview_upload:O([`Upload`,`Uploading`,`Uploaded`,`files to the preview browser`],`browser`,`browser`),preview_scroll:O([`Scroll`,`Scrolling`,`Scrolled`,`the preview browser`],`browser`,`browser`),preview_resize:O([`Resize`,`Resizing`,`Resized`,`the preview browser`],`browser`,`browser`),preview_evaluate:O([`Evaluate`,`Evaluating`,`Evaluated`,`script in the preview browser`],`browser`,`browser`),preview_wait_for:O([`Wait`,`Waiting`,`Waited`,`for the preview page`],`browser`,`browser`),preview_set_appearance:O([`Set`,`Setting`,`Set`,`preview browser appearance`],`browser`,`browser`),preview_recording_start:O([`Start`,`Starting`,`Started`,`recording the preview browser`],`browser`,`browser`),preview_recording_stop:O([`Stop`,`Stopping`,`Stopped`,`recording the preview browser`],`browser`,`browser`),device_list:O([`List`,`Listing`,`Listed`,`simulators and emulators`],`device`,`device`),device_open:O([`Open`,`Opening`,`Opened`,`a device in the Device panel`],`device`,`device`),device_screenshot:O([`Take a screenshot of`,`Taking a screenshot of`,`Took a screenshot of`,`the device`],`device`,`device`),device_close:O([`Close`,`Closing`,`Closed`,`a device`],`device`,`device`),run_scheduled_task_now:O([`Run`,`Running`,`Requested a run of`,`a scheduled task`],`schedule-run`),p4_queue_list:O([`List`,`Listing`,`Listed`,`queued messages`],`queue-list`),p4_queue_read:O([`Read`,`Reading`,`Read`,`a queued message`],`queue-read`),p4_queue_edit:O([`Edit`,`Editing`,`Edited`,`a queued message`],`queue-edit`),p4_queue_cancel:O([`Cancel`,`Canceling`,`Requested cancellation of`,`a queued run`],`queue-cancel`),p4_queue_reorder:O([`Reorder`,`Reordering`,`Reordered`,`a queued run`],`queue-reorder`),p4_queue_promote_to_steer:O([`Steer with`,`Steering with`,`Requested steering with`,`a queued message`],`queue-steer`),p4_pending_request_list:O([`List`,`Listing`,`Listed`,`pending requests`],`question-list`),p4_pending_request_read:O([`Read`,`Reading`,`Read`,`pending requests`],`question-read`),p4_pending_request_respond:O([`Respond to`,`Responding to`,`Responded to`,`pending requests`],`question-respond`),p4_thread_diff:O([`Read`,`Reading`,`Read`,`a thread diff`],`thread-read`),p4_thread_configuration:O([`Read`,`Reading`,`Read`,`thread configuration`],`thread-configuration`),p4_thread_configure:O([`Set`,`Setting`,`Set`,`thread model`],`thread-configure`),p4_thread_fork:O([`Fork`,`Forking`,`Requested a fork of`,`this thread`],`thread-fork`),p4_thread_merge_back:O([`Merge`,`Merging`,`Requested a merge of`,`thread context`],`thread-merge`),p4_thread_search:O([`Search`,`Searching`,`Searched`,`thread content`],`thread-search`),p4_thread_transfers:O([`Read`,`Reading`,`Read`,`thread transfers`],`thread-transfers`),p4_thread_organize:O([`Organize`,`Organizing`,`Organized`,`a thread`],`thread-organize`),p4_thread_update:O([`Update`,`Updating`,`Updated`,`P4 Code thread metadata`],`thread-update`),p4_worktree_list:O([`List`,`Listing`,`Listed`,`workspace branches`],`worktree-list`),p4_preview_list:O([`List`,`Listing`,`Listed`,`preview tabs`],`browser`,`browser`),p4_preview_close:O([`Close`,`Closing`,`Closed`,`a preview tab`],`browser`,`browser`),p4_environment_read:O([`Read`,`Reading`,`Read`,`environment preferences`],`environment-read`),p4_environment_preferences_update:O([`Update`,`Updating`,`Updated`,`environment preferences`],`environment-update`),p4_mcp_server_list:O([`List`,`Listing`,`Listed`,`MCP servers`],`environment-read`),p4_mcp_server_set_enabled:O([`Update`,`Updating`,`Updated`,`an MCP server`],`environment-update`),p4_thread_launch:O([`Launch`,`Launching`,`Launched`,`a project thread`],`thread-create`),p4_project_list:O([`List`,`Listing`,`Listed`,`projects`],`project-list`),p4_project_read:O([`Read`,`Reading`,`Read`,`a project`],`project-read`),p4_project_create:O([`Register`,`Registering`,`Registered`,`a project`],`project-create`),p4_project_update:O([`Update`,`Updating`,`Updated`,`a project`],`project-update`),p4_project_delete:O([`Delete`,`Deleting`,`Deleted`,`a project`],`project-delete`),p4_project_clone:O([`Clone`,`Cloning`,`Cloned`,`a repository`],`project-clone`),p4_attachment_prepare_upload:O([`Prepare`,`Preparing`,`Prepared`,`an attachment upload`],`attachment-prepare`),p4_attachment_discard:O([`Discard`,`Discarding`,`Discarded`,`a pending attachment`],`attachment-discard`),p4_thread_send_attachments:O([`Send`,`Sending`,`Sent`,`attachments`],`attachment-send`),html_preview:O([`Preview`,`Previewing`,`Previewed`,`an HTML page`],`html-preview`),html_render:O([`Render`,`Rendering`,`Rendered`,`an HTML page`],`html-render`)};new Set(Object.keys(k));function Je(e){return e.replace(/\s+(?:complete|completed)\s*$/i,``).trim()}function Ye(e){let t=Je(e),n=/^mcp__(?<server>.+?)__(?<tool>.+)$/i.exec(t);if(n?.groups){let{server:e,tool:t}=n.groups;return e!==void 0&&t!==void 0&&qe.has(e.toLowerCase())?t:null}let r=/^(?<server>p4[-_]?code)(?:[.:/]|\s*·\s*)(?<tool>.+)$/i.exec(t);if(r?.groups)return r.groups.tool??null;let i=/^(?:mcp[-_]{1,2})?p4[-_ ]?code(?:__|[-_.:/ ])(?<tool>.+)$/i.exec(t)?.groups?.tool??t;if(Object.hasOwn(k,i))return i;if(!/^p4-code-/i.test(t))return null;let a=null;for(let e of Object.keys(k))t.endsWith(`_${e}`)&&e.length>(a?.length??0)&&(a=e);return a}function Xe(e){let t=e==null?null:Ye(e);return t!==null&&Object.hasOwn(k,t)?t:null}function A(e){let t=e==null?null:Ye(e);return t!==null&&Object.hasOwn(k,t)?k[t]:null}var Ze=16384,Qe=8192,$e=256,et=100,tt=32,nt=4,rt=128,it=new TextEncoder;function j(e,t,n=0){if(n>nt||t.remainingNodes--<=0)return t.exceeded=!0,{failed:!1};if(typeof e==`string`){if(e.length>t.remainingBytes)return t.exceeded=!0,{failed:!1};let r=it.encode(e).byteLength;if(r>t.remainingBytes)return t.exceeded=!0,{failed:!1};t.remainingBytes-=r;try{return j(JSON.parse(e),t,n+1)}catch{return{failed:!1}}}if(Array.isArray(e)){if(e.length>tt)return t.exceeded=!0,{failed:!1};let r,i=!1;for(let a of e){let e=h(a)?a.text:void 0,o=j(h(e)?e.text??e:e,t,n+1);if(r??=o.data,i||=o.failed,t.exceeded)break}return{...r===void 0?{}:{data:r},failed:i}}if(!h(e))return{failed:!1};let r=e.isError===!0||e.is_error===!0||e._tag===`OrchestratorMcpFailure`||e.error!=null,i=e.structuredContent??e.content;if(i!==void 0){let e=j(i,t,n+1);return{...e,failed:r||e.failed}}return{data:e,failed:r}}function M(e){if(!(typeof e!=`string`||e.length>$e||e.trim()===``))return Array.from(e).join(``)}function at(e){let t={remainingBytes:Ze,remainingNodes:rt,exceeded:!1},n=j(e,t),r=n.failed?{isError:!0}:{},i=t.exceeded?void 0:n.data;if(i!==void 0){for(let e of[`threadId`,`messageId`,`taskId`,`scheduledTaskId`]){let t=M(i[e]);t!==void 0&&(r[e]=t)}i.status===`rolled_back`&&(r.status=`rolled_back`);let e=ae(i.htmlRender);e!==void 0&&(r.htmlRender=e);let t=He(i[E]);t!==void 0&&(r[E]=t);let n=h(i.thread)?M(i.thread.threadId):void 0;if(n!==void 0&&(r.thread={threadId:n}),Array.isArray(i.threads)){let e=i.threads.length<=et,t=[];if(e)for(let n of i.threads){if(!h(n)){e=!1;break}let r=M(n.threadId),i=n.status===`rolled_back`;if(r===void 0&&!i){e=!1;break}t.push({...r===void 0?{}:{threadId:r},...i?{status:`rolled_back`}:{}})}e?r.threads=t:(delete r.threadId,delete r.status)}}let a=()=>it.encode(JSON.stringify(r)).byteLength>Qe;a()&&(delete r.threads,delete r.threadId,delete r.status);let o=r[E];if(o?.csp!==void 0&&a()){let{csp:e,...t}=o;r[E]=t}return a()&&delete r[E],Object.keys(r).length===0?void 0:r}function ot(e){if(Xe(e.toolName)!==`html_render`)return;let t=at(e.output);return t?.isError?void 0:t?.htmlRender}function st(e){let t=at(e.output)?.[E];return t!==void 0&&e.toolName===`${t.server}.${t.tool}`?t:void 0}function ct(e){return/file not found|no files found|enoent|no such file|commandnotfoundexception|command not found|is not recognized as the name of a cmdlet|a parameter cannot be found that matches parameter name/i.test(e)||/cannot find path/i.test(e)&&/because it does not exist/i.test(e)||/is not recognized/i.test(e)&&/the term '/i.test(e)||/<exited with exit code\s+[1-9]\d*\s*>/i.test(e)||/exit(?:ed)? with exit code\s+[1-9]\d*/i.test(e)||/exit code\s*[:\s]\s*[1-9]\d*\b/i.test(e)}function lt(e){if(!h(e)||e.type!==`image`)return null;let t=h(e.source)?e.source:void 0;if(t!==void 0&&t.type!==`base64`)return null;let n=t===void 0?e.mimeType:t.media_type,r=t===void 0?e.data:t.data;if(typeof n!=`string`||!f(n))return null;let i={mimeType:n.toLowerCase()};return typeof r==`string`?{...i,data:r}:i}function ut(e){return Array.isArray(e)?e:h(e)&&Array.isArray(e.content)?e.content:[e]}Math.ceil(u/3)*4;function dt(e){let t=[];for(let n of ut(e))if(lt(n)!==null&&(t.push(n),t.length===8))break;return t}function ft(e){return dt(e).flatMap(e=>lt(e)??[])}var pt=4;function N(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}function mt(e){return N(e)&&e.truncated===!0&&typeof e.summary==`string`}function P(e,t){if(t>pt)return null;if(typeof e==`string`)return e;if(Array.isArray(e)){let n=e.map(e=>P(e,t+1));return n.every(e=>e!==null)?n.filter(e=>e!==``).join(`
|
|
2
|
+
`):null}if(!N(e))return null;if(e.type===`text`&&typeof e.text==`string`)return e.text;if(e.type===`image`)return lt(e)?``:`[image]`;if(e.type===`resource_link`&&typeof e.uri==`string`)return e.uri;if(e.type===`resource`&&N(e.resource)){let t=e.resource;if(typeof t.text==`string`)return t.text;if(typeof t.uri==`string`)return t.uri}let n=Object.keys(e).filter(e=>e!==`isError`&&e!==`is_error`);if(n.length===1&&n[0]===`content`)return P(e.content,t+1);if(n.length===2&&n.includes(`content`)&&n.includes(`structuredContent`)){let n=P(e.content,t+1);return n?.trim()?n:null}return null}function F(e){try{return JSON.parse(e)}catch{return}}function ht(e){let t=e.trim();if(!/^[[{]/.test(t))return e;let n=F(t);if(n!==void 0)return JSON.stringify(n,null,2);let r=t.split(`
|
|
3
|
+
`).filter(e=>e.trim()).map(e=>F(e.trim()));return r.some(e=>e===void 0)?e:r.map(e=>JSON.stringify(e,null,2)).join(`
|
|
4
|
+
|
|
5
|
+
`)}function gt(e,t=!1){if(e==null||t&&N(e)&&e.type===`image`)return null;let n=P(e,0);if(n!==null)return n.trim()?ht(n):null;let r;try{r=JSON.stringify(e,null,2)}catch{return String(e)}return r===void 0||r===`{}`||r===`[]`?null:r}function I(e){if(e.command!==void 0)return{command:e.command.trim()||null,args:null,argsText:null};let t=e.args;if(N(t)&&!mt(t)){let e=Object.entries(t).flatMap(([e,t])=>t===void 0?[]:[[e,typeof t==`string`&&t!==``?t:JSON.stringify(t)??String(t)]]);return{command:null,args:e.length>0?e:null,argsText:null}}return{command:null,args:null,argsText:gt(t)}}function _t(e){return e.command!==null||e.args!==null||e.argsText!==null}var vt=new Set([`idle`,`pending`,`running`,`waiting`]);function yt(e){return vt.has(e.status)?`live`:l(e.updatedAt)}function bt(e){switch(e.type){case`command_execution`:return e.outputOmitted===!0;case`dynamic_tool`:return e.outputOmitted===!0||mt(e.input);default:return!1}}function xt(e){if(!e.trimStart().startsWith(`{"stdout"`))return e;let t=F(e.trim());return!N(t)||typeof t.stdout!=`string`||typeof t.stderr!=`string`||typeof t.interrupted!=`boolean`?e:[t.stdout,t.stderr].filter(e=>typeof e==`string`&&e.trim().length>0).join(`
|
|
6
|
+
`)}function St(e){switch(e.type){case`command_execution`:return e.output?.trim()&&xt(e.output)||null;case`dynamic_tool`:return e.outputOmitted===!0?null:gt(e.output,e.viewedImagePath!==void 0);case`file_search`:return e.results?.length?e.results.map(e=>[`${e.fileName}${e.line===void 0?``:`:${e.line}`}`,e.preview?.trim()].filter(Boolean).join(`
|
|
7
|
+
`)).join(`
|
|
8
|
+
`):null;case`web_search`:return e.results?.length?e.results.map(e=>[e.title?.trim()||e.url,e.title?e.url:void 0,e.snippet?.trim()].filter(Boolean).join(`
|
|
9
|
+
`)).join(`
|
|
10
|
+
|
|
11
|
+
`):null;default:return null}}function Ct(e){return e.type!==`dynamic_tool`||e.outputOmitted===!0?[]:ft(e.output).map((t,n)=>({_tag:`tool-output-image`,threadId:e.threadId,itemId:e.id,index:n}))}function wt(e){switch(e.type){case`reasoning`:return e.text.trim().length>0;case`command_execution`:return I({command:e.input}).command!==null||e.outputOmitted===!0||!!e.output?.trim()||e.exitCode!==void 0&&e.exitCode!==0;case`file_change`:case`checkpoint`:case`fork`:case`handoff`:return!0;case`file_search`:return(e.results?.length??0)>0||!!e.pattern?.trim();case`web_search`:return(e.results?.length??0)>0||(e.patterns?.length??0)>0;case`dynamic_tool`:return e.outputOmitted===!0||_t(I({args:e.input}));case`approval_request`:return!!e.prompt?.trim();case`user_input_request`:return e.questions.length>0;case`notification`:return!!e.detail?.trim();case`system_notice`:return e.message.trim().length>0;case`error`:return e.failure.message.trim().length>0;case`proposed_plan`:return e.markdown.trim().length>0;case`todo_list`:return e.steps.length>0;case`subagent`:return e.childThreadId!==null;default:return!1}}var Tt=64,Et=new Set([`sh`,`bash`,`zsh`,`dash`,`ash`,`ksh`,`fish`]),Dt=new Set([`cmd`,`cmd.exe`,`powershell`,`powershell.exe`,`pwsh`,`pwsh.exe`]),Ot=new Set([`-o`,`-O`,`--rcfile`,`--init-file`]),kt=new Set([`builtin`,`command`,`exec`]),At=new Set([`nocorrect`,`noglob`,`time`]),jt=new Set([`pop-location`,`push-location`,`set-location`]),Mt=new Set([`-mta`,`-nologo`,`-noninteractive`,`-noprofile`,`-sta`]),Nt=new Set([`-configurationname`,`-executionpolicy`,`-inputformat`,`-outputformat`,`-version`,`-windowstyle`,`-workingdirectory`]),Pt=new Set([`-confirm`,`-debug`,`-loaduserprofile`,`-nonewwindow`,`-passthru`,`-usenewenvironment`,`-verbose`,`-wait`,`-whatif`]),Ft=new Set([`-argumentlist`,`-credential`,`-environment`,`-erroraction`,`-errorvariable`,`-informationaction`,`-informationvariable`,`-outbuffer`,`-outvariable`,`-pipelinevariable`,`-progressaction`,`-redirectstandarderror`,`-redirectstandardinput`,`-redirectstandardoutput`,`-verb`,`-warningaction`,`-warningvariable`,`-windowstyle`,`-workingdirectory`]),It=new Set([`[`,`[[`,`test`,`true`]),Lt="<>(){}[];|&$`#!%@:",Rt="){]}`",L=new Set(`!,#,.,:,[,[[,alias,and,autoload,begin,bg,bind,bindkey,break,builtin,caller,case,catch,cd,command,compgen,complete,compopt,continue,coproc,declare,dirs,disown,do,done,elif,else,enable,end,esac,eval,exec,exit,export,false,fc,fg,fi,finally,for,foreach,function,getopts,history,if,in,jobs,let,local,logout,mapfile,nocorrect,noglob,not,or,popd,pushd,read,readarray,readonly,repeat,return,select,set,setopt,shift,shopt,source,switch,suspend,test,then,time,times,trap,try,true,type,typeset,ulimit,umask,unalias,until,unset,unsetopt,wait,while`.split(`,`)),zt=new Set(`and.begin.break.case.catch.continue.coproc.do.done.elif.else.end.esac.eval.exec.exit.false.fi.finally.for.foreach.function.if.in.not.or.repeat.return.select.switch.then.try.until.while`.split(`.`));function Bt(e,t){for(let n=t;n<e.length;n+=1){let t=e[n];if(t===`--`||!t.startsWith(`-`))return null;if(Ot.has(t)){n+=1;continue}if(t===`--command`||/^-[a-zA-Z]*c[a-zA-Z]*$/.test(t))return n+1}return null}var Vt={env:new Set([`-C`,`--chdir`,`-S`,`--split-string`,`-u`,`--unset`]),sudo:new Set([`-C`,`--close-from`,`-D`,`--chdir`,`-g`,`--group`,`-u`,`--user`])},Ht={env:new Set([`-0`,`--null`,`-i`,`--ignore-environment`,`--debug`,`-v`]),sudo:new Set([`-A`,`--askpass`,`-b`,`--background`,`-E`,`-H`,`-i`,`-n`,`-S`])};function R(e){let t=e.trim(),n=[],r=``,i=null,a=!1,o=!1,s=0,c=0,l=!1;for(let e=0;e<t.length;e+=1){let u=t[e];if(a){r+=u,a=!1,l=!0;continue}if(u===`\\`&&i!==`'`){let n=t[e+1],o=i===null&&/^(?:[A-Za-z]:|\.{1,2})(?:\\[^\s]*)?$/u.test(r);if((i===`"`||o)&&n!==void 0&&n!==`"`&&n!==`\\`&&n!==`$`&&n!=="`"&&n!==`
|
|
12
|
+
`){r+=u,l=!0;continue}a=!0,l=!0;continue}if(o){r+=u,u==="`"&&(o=!1),l=!0;continue}if(i!==null){u===i?i=null:r+=u,l=!0;continue}if(u==="`"){r+=u,o=!0,l=!0;continue}if(u===`$`&&t[e+1]===`{`){r+="${",c+=1,l=!0,e+=1;continue}if(u===`{`&&c>0){r+=u,c+=1,l=!0;continue}if(u===`}`&&c>0){r+=u,--c,l=!0;continue}if(u===`$`&&t[e+1]===`(`){r+=`$(`,s+=1,l=!0,e+=1;continue}if(u===`(`){r+=u,s+=1,l=!0;continue}if(u===`)`&&s>0){r+=u,--s,l=!0;continue}if(u===`"`||u===`'`){i=u,l=!0;continue}if(/\s/u.test(u)){if(s>0||c>0){r+=u,l=!0;continue}l&&=(n.push(r),r=``,!1);continue}r+=u,l=!0}return i!==null||a||o||s>0||c>0?null:(l&&n.push(r),n)}function Ut(e,t,n){let r=``,i=0;for(let a of n){if(a.start>=t)break;r+=e.slice(i,a.start),i=Math.min(a.end,t)}return r+e.slice(i,t)}function Wt(e,t,n){let r=t;for(;e[r]===` `||e[r]===` `;)r+=1;let i=``,a=null,o=!1;for(;r<e.length;r+=1){let t=e[r];if(o){i+=t,o=!1;continue}if(t===`\\`&&a!==`'`){o=!0;continue}if(a!==null){t===a?a=null:i+=t;continue}if(t===`"`||t===`'`){a=t;continue}if(/\s/u.test(t)||`;&|<>()`.includes(t))break;i+=t}return!i||a!==null||o?null:{heredoc:{delimiter:i,stripTabs:n},end:r}}function Gt(e,t,n){let r=t;for(let t of n){let n=!1;for(;r<=e.length;){let i=e.indexOf(`
|
|
13
|
+
`,r),a=i===-1?e.length:i,o=e.slice(r,a).replace(/\r$/u,``),s=t.stripTabs?o.replace(/^\t+/u,``):o;if(r=i===-1?e.length:i+1,s===t.delimiter){n=!0;break}if(i===-1)break}if(!n)return null}return e.slice(r).trim()||null}function z(e){let t=null,n=null,r=!1,i=!1,a=!1,o=0,s=0,c=[],l=[],u=0,d=null;for(let f=0;f<e.length;f+=1){let p=e[f];if(n!==null){p===n&&e[f+1]===`@`&&(f===0||e[f-1]===`
|
|
14
|
+
`)&&(n=null,f+=1);continue}if(a){if(p!==`
|
|
15
|
+
`)continue;a=!1,l.push({start:u,end:f})}if(r){r=!1;continue}if(p===`\\`&&t!==`'`){r=!0;continue}if(i){p==="`"&&(i=!1);continue}if(t!==null){p===t&&(t=null);continue}if(p===`@`&&(e[f+1]===`"`||e[f+1]===`'`)&&(e[f+2]===`
|
|
16
|
+
`||e[f+2]===`\r`&&e[f+3]===`
|
|
17
|
+
`)){n=e[f+1],f+=1;continue}if(p===`"`||p===`'`){t=p;continue}if(p==="`"){i=!0;continue}if(p===`#`&&(f===0||/\s/u.test(e[f-1])||`;&|(`.includes(e[f-1]))){a=!0,u=f;continue}if(p===`$`&&e[f+1]===`{`){s+=1,f+=1;continue}if(p===`{`&&s>0){s+=1;continue}if(p===`}`&&s>0){--s;continue}if(p===`(`){o+=1;continue}if(p===`)`&&o>0){--o;continue}if(o>0||s>0)continue;if(p===`<`&&e[f+1]===`<`&&e[f+2]!==`<`){let t=e[f+2]===`-`,n=Wt(e,f+(t?3:2),t);if(n===null)return{firstCommand:e.trim(),remainingCommand:null,separator:null};c.push(n.heredoc),f=n.end-1;continue}let m=p===`&`&&e[f+1]===`&`||p===`|`&&(e[f+1]===`|`||e[f+1]===`&`),h=p===`&`&&(e[f-1]===`>`||e[f-1]===`<`||e[f+1]===`>`);if(!m&&!`;&|
|
|
18
|
+
`.includes(p)||h)continue;if(p===`
|
|
19
|
+
`&&c.length>0){let t=d;return{firstCommand:Ut(e,t?.index??f,l).trimStart(),remainingCommand:[t?e.slice(t.index+t.length,f).trim():``,Gt(e,f+1,c)].filter(e=>!!e).join(`
|
|
20
|
+
`)||null,separator:t?e.slice(t.index,t.index+t.length):`
|
|
21
|
+
`}}if(c.length>0){d??={index:f,length:m?2:1},m&&(f+=1);continue}let ee=Ut(e,f,l).trimStart(),g=f+(m?2:1);for(;/\s/u.test(e[g]??``);)g+=1;return{firstCommand:ee,remainingCommand:e.slice(g).trim()||null,separator:m?e.slice(f,f+2):p}}return a&&l.push({start:u,end:e.length}),{firstCommand:Ut(e,e.length,l).trim(),remainingCommand:null,separator:null}}function Kt(e){let t=e.trimStart();for(;t.startsWith(`#`);){let e=t.indexOf(`
|
|
22
|
+
`);if(e===-1)return null;t=t.slice(e+1).trimStart()}return t||null}function qt(e){let t=``,n=null,r=!1;for(let i=0;i<e.length;i+=1){let a=e[i];if(r){t+=a,r=!1;continue}if(a===`\\`&&n!==`'`){if(e[i+1]===`
|
|
23
|
+
`){i+=1;continue}if(e[i+1]===`\r`&&e[i+2]===`
|
|
24
|
+
`){i+=2;continue}t+=a,r=!0;continue}n===null?(a===`"`||a===`'`)&&(n=a):a===n&&(n=null),t+=a}return t}function B(e,t){let n=e[t];if(!n||/^[<>]\(/u.test(n))return null;let r=n.match(/^(?:(?:(?:\d+|\*|\{[A-Za-z_][A-Za-z0-9_]*\})?(?:<<<|<<-|<<|<>|>>|>\||<&|>&|<|>))|&>>|&>)(.*)$/u);return r?r[1]?t+1:e[t+1]===void 0?e.length+1:t+2:null}function Jt(e){return e.map(e=>`'${e.replaceAll(`'`,`'\\''`)}'`).join(` `)}function Yt(e,t,n){if(e===`bundle`)return t[n+1]===`exec`&&t[n+2]!==void 0?n+2:null;if(e===`nohup`){let e=n+1;t[e]===`--`&&(e+=1);let r=t[e];return r&&!r.startsWith(`-`)?e:null}return e===`script`?/^-[adkpqr]+$/u.test(t[n+1]??``)&&t[n+3]!==void 0?n+3:null:e===`arch`?/^-(?:arm64|arm64e|i386|x86_64)$/u.test(t[n+1]??``)?t[n+2]===void 0?null:n+2:t[n+1]===`-arch`&&t[n+3]!==void 0?n+3:null:(e===`timeout`||e===`gtimeout`)&&/^(?:\d+(?:\.\d*)?|\.\d+)[smhd]?$/u.test(t[n+1]??``)&&t[n+2]!==void 0?n+2:null}function V(e){let t=e.trim();if(!t||/^[A-Za-z][A-Za-z0-9+.-]*:(?![\\/])/u.test(t))return null;let n=t.split(/[\\/]/u).at(-1);return!n||/\s/u.test(n)&&!/[\\/]/u.test(t)||Lt.includes(n[0]??``)||Rt.includes(n.at(-1)??``)?null:n}function Xt(e){let t=e.trimStart(),n=t[0];if(n!==`"`&&n!==`'`)return V(t.match(/^\S+/u)?.[0]??``);let r=``;for(let e=1;e<t.length;e+=1){let i=t[e];if(i==="`"&&t[e+1]!==void 0){r+=t[e+1],e+=1;continue}if(i===n){if(n===`'`&&t[e+1]===`'`){r+=`'`,e+=1;continue}return V(r)}r+=i}return null}function Zt(e){let t=e.match(/^\s*&\s+([\s\S]*)$/u);return t?Xt(t[1]):void 0}function Qt(e,t,n,r){let i=e.match(/^\s*\$(?:(env|global|local|script):)?[A-Za-z_][A-Za-z0-9_]*\s*=\s*([\s\S]*)$/iu);if(!i)return{matched:!1,program:null};if(i[1]?.toLowerCase()===`env`)return{matched:!0,program:n?H(n,t,`shell`,r-1):null};let a=i[2].trim();if(/^(?:\[ordered\]\s*)?@\s*[{(]/iu.test(a))return{matched:!0,program:null};let o=Zt(a);if(o!==void 0)return{matched:!0,program:o};let s=a.match(/^(?:@?\(\s*)?([A-Za-z][A-Za-z0-9_.-]*)\b/u)?.[1];return s&&!L.has(s.toLowerCase())?{matched:!0,program:H(a,t+1,`shell`,r)??s}:{matched:!0,program:n?H(n,t,`shell`,r-1):null}}function $t(e,t,n,r,i,a,o){let s=e=>e?H(i&&a?`${e} ${a} ${i}`:e,r+1,`shell`,o):null;if(e===`cmd`||e===`cmd.exe`){for(let e=n;e<t.length;e+=1){let n=t[e].toLowerCase();if(n!==`/c`&&n!==`/k`)continue;let r=t[e+1];return{matched:!0,program:s(r)}}return{matched:!1,program:null}}for(let e=n;e<t.length;e+=1){let n=t[e].toLowerCase();if(n===`-command`||n===`-c`){let n=t[e+1];return{matched:!0,program:s(n)}}if(n===`-file`||n===`-f`)return{matched:!0,program:V(t[e+1]??``)};if(n===`-encodedcommand`||n===`-enc`||n===`-e`)return{matched:!0,program:null};if(Nt.has(n)){e+=1;continue}if(!Mt.has(n)&&!n.startsWith(`-`))return{matched:!0,program:V(t[e])}}return{matched:!1,program:null}}function en(e,t){for(let n=t;n<e.length;n+=1){let t=e[n],r=t.toLowerCase();if(r===`-filepath`)return V(e[n+1]??``);if(!Pt.has(r)){if(Ft.has(r)){if(e[n+1]===void 0)return null;n+=1;continue}return t.startsWith(`-`)?null:V(t)}}return null}function tn(e){let t=e.match(/^([A-Za-z_][A-Za-z0-9_]*)=(.*)$/su);if(!t)return null;let n=t[1],r=t[2].trim();if(!r||/[$`]/u.test(r))return{name:n,program:null};if(r.startsWith(`(`)&&r.endsWith(`)`))r=R(r.slice(1,-1))?.[0]??``;else if(/\s/u.test(r)&&!/[\\/]/u.test(r))return{name:n,program:null};return{name:n,program:V(r)}}function nn(e){let t=e.match(/^\$(?:([A-Za-z_][A-Za-z0-9_]*)|\{([A-Za-z_][A-Za-z0-9_]*)(?:\[@\])?\})$/u);return t?.[1]??t?.[2]??null}function rn(e){let t=new Map,n=e,r=0;for(let e=0;n&&e<64;e+=1){let e=Kt(n);if(e===null)return null;let i=z(e),a=R(qt(i.firstCommand));if(a===null)return null;let o=+(a[0]===`do`||a[0]===`then`);for(;o<a.length;){let e=B(a,o);if(e!==null&&e<=a.length){o=e;continue}if(/^[A-Za-z_][A-Za-z0-9_]*\+?=/u.test(a[o]??``)){o+=1;continue}break}let s=nn(a[o]??``),c=s?t.get(s):void 0;if(c)return c;let l=a[0];if((l===`fi`||l===`done`||l===`esac`)&&(r=Math.max(0,r-1)),(l===`if`||l===`for`||l===`while`||l===`until`||l===`select`||l===`case`)&&(r+=1),r===0&&l===`unset`)for(let e of a.slice(1))t.delete(e);let u=+(a[0]===`export`),d=a.slice(u).map(tn);if(r===0&&d.length>0&&d.every(e=>e!==null))for(let e of d)e.program?t.set(e.name,e.program):t.delete(e.name);n=i.remainingCommand}return null}function an(e,t,n,r,i,a){let o=n;if(e===`command`)for(;o<t.length;){let e=t[o];if(e===`--`){o+=1;break}if(!e.startsWith(`-`)||e===`-`)break;if(e!==`-p`)return null;o+=1}else if(e===`builtin`){if(t[o]===`--`)o+=1;else if(t[o]?.startsWith(`-`))return null}else if(e===`exec`)for(;o<t.length;){let e=t[o];if(e===`--`){o+=1;break}if(e===`-a`){if(t[o+1]===void 0)return null;o+=2;continue}if(/^-a.+/u.test(e)||/^-[cl]+$/u.test(e)){o+=1;continue}if(e.startsWith(`-`)&&e!==`-`)return null;break}let s=t.slice(o);if(s.length===0)return null;let c=0;for(;c<s.length;){let e=B(s,c);if(e===null||e>s.length)break;c=e}let l=s[c];if(l&&/^[A-Za-z_][A-Za-z0-9_]*\+?=/u.test(l))return null;let u=H(Jt(s),r+1,e===`exec`?`exec`:`shell`,a);return u===null?e!==`exec`&&l&&l===l.toLowerCase()&&L.has(l)&&!zt.has(l)&&i?H(i,r,`shell`,a-1):null:u}function on(e,t,n,r){if(t>=8||r<=0)return null;let i=Kt(e);if(i===null||/^(?:catch|finally|for|foreach|function|if|param|switch|try|while)\s*[{(]/iu.test(i)||/^[A-Za-z_][A-Za-z0-9_]*\s*\(\s*\)\s*\{/u.test(i)||i.startsWith(`[[`))return null;let a=z(i);if(/^@["'](?:\r?\n)/u.test(a.firstCommand.trimStart()))return a.remainingCommand?H(a.remainingCommand,t,`shell`,r-1):null;let o=Qt(a.firstCommand,t,a.remainingCommand,r);if(o.matched)return o.program;let s=a.firstCommand.match(/^\s*((?:\.{1,2}|%[A-Za-z_][A-Za-z0-9_]*%|\$env:[A-Za-z_][A-Za-z0-9_]*)\\\S+)/iu)?.[1];if(s)return V(s);let c=R(qt(a.firstCommand));if(c===null)return null;let l=a.firstCommand.trimStart()[0];if(c.length===1&&(l===`"`||l===`'`)&&/[\s()=]/u.test(c[0]??``)&&!/[\\/]/u.test(c[0]??``))return a.remainingCommand?H(a.remainingCommand,t,n,r-1):null;let u=0,d=null,f=n,p=!1,m=!1;for(;u<c.length;){let e=c[u];if(!e)return null;let n=B(c,u);if(n!==null){if(n>c.length)return null;m=!0,u=n;continue}if(/^[A-Za-z_][A-Za-z0-9_]*\+?=/.test(e)){p=!0,u+=1;continue}if(f===`shell`&&e===`:`)return a.remainingCommand?H(a.remainingCommand,t,f,r-1):null;if(Lt.includes(e[0]??``)&&!(e.startsWith(`$`)&&e.includes(`/`)))return f===`shell`&&e.startsWith(`[`)&&a.remainingCommand?H(a.remainingCommand,t,f,r-1):null;let i=e.split(/[\\/]/).at(-1),o=e===i;if(i===`env`||i===`sudo`){d=i,f=`exec`,u+=1;continue}if(d!==null&&e===`--`){d=null,u+=1;continue}if(d!==null&&e.startsWith(`-`)){if(d===`env`&&(e===`-S`||e===`--split-string`)){let e=c[u+1];return e?H(e,t+1,f,r):null}if(d===`env`&&e.startsWith(`--split-string=`))return H(e.slice(15),t+1,f,r);if(Vt[d].has(e)){if(c[u+1]===void 0)return null;u+=2;continue}if(Ht[d].has(e)){u+=1;continue}let n=e.indexOf(`=`);if(e.startsWith(`--`)&&n>2){if(!Vt[d].has(e.slice(0,n)))return null;u+=1;continue}if(/^-[A-Za-z].+/.test(e)&&!e.startsWith(`--`)){let t=!1;for(let[n,r]of e.slice(1).split(``).entries()){let i=`-${r}`;if(Vt[d].has(i)){t=n===e.length-2;break}if(!Ht[d].has(i))return null}if(t&&c[u+1]===void 0)return null;u+=t?2:1;continue}return null}if(i&&Et.has(i.replace(/\.exe$/i,``).toLowerCase())){let e=Bt(c,u+1);if(e!==null){let n=c[e];return n?H(n,t+1,`shell`,r):null}}let s=i?.toLowerCase();if(s&&Dt.has(s)){let e=$t(s,c,u+1,t,a.remainingCommand,a.separator,r);if(e.matched)return e.program}if(s===`start-process`){let e=en(c,u+1);if(e!==null)return e}if(f===`shell`&&o&&i&&At.has(i)){if(u+=1,i===`time`&&c[u]===`-p`&&(u+=1),c[u]?.startsWith(`-`))return null;continue}if(o&&i){let e=Yt(i,c,u);if(e!==null){let n=H(Jt(c.slice(e)),t+1,`exec`,r);if(n!==null)return n}}return o&&i&&kt.has(i)?an(i,c,u+1,t,a.remainingCommand,r):(f===`shell`||d===`sudo`&&i&&It.has(i))&&o&&i&&L.has(i)&&(!zt.has(i)||i===`false`&&a.separator!==`&&`)&&a.remainingCommand||f===`shell`&&o&&s&&jt.has(s)&&a.remainingCommand?H(a.remainingCommand,t,`shell`,r-1):!i||o&&L.has(i)||Lt.includes(i[0]??``)||Rt.includes(i.at(-1)??``)||i.endsWith(`()`)||/^[A-Za-z_][A-Za-z0-9_]*\(\)\{$/u.test(i)?null:i||null}return(p||m)&&d===null&&a.remainingCommand?H(a.remainingCommand,t,f,r-1):null}function H(e,t,n,r=Tt){if(r<=0)return null;let i=Zt(e);return i===void 0?on(e,t,n,r)??(n===`shell`?rn(e):null):i}function sn(e,t=0){return H(e,t,`shell`,Tt)}var cn=/[\u0000-\u0008\u000b\u000c\u000e-\u001f\u007f]/gu;function ln(e){return pn(mn(e))}var un=/[a-z][\w+.-]*:\/\/\S+|(?:\b[a-z]:)?[^\s"'`=,;:()<>|&]+/giu;function dn(e){if(e.includes(`://`)||/[*?[{]/u.test(e))return e;let t=e.replaceAll(`\\`,`/`).replace(/\/+$/u,``),n=t.lastIndexOf(`/`);if(n<0)return e;let r=t.slice(n+1);if(!/[a-z]/iu.test(r))return e;let i=/^(?:~|\.{1,2}|[a-z]:)?\//iu.test(t),a=/.\.[a-z0-9]+$/iu.test(r),o=t.split(`/`).length-1;return i||a||o>=2?r:e}function fn(e){return e.replace(un,dn)}function pn(e){return e.replace(cn,e=>e===``?`␡`:String.fromCharCode(9216+e.charCodeAt(0)))}function mn(e){let t=e.trim();if(z(t).remainingCommand!==null)return t;let n=R(t),r=n?.[0]?.split(/[\\/]/u).at(-1)?.replace(/\.exe$/iu,``);if(!n||!r||!Et.has(r))return t;let i=Bt(n,1);return i===null||i!==n.length-1?t:n[i]?.trim()||t}var hn=new Set([`powershell`,`pwsh`]),gn=new Set(`Add Approve Assert Backup Block Build Checkpoint Clear Close Compare Complete Compress Confirm Connect Convert ConvertFrom ConvertTo Copy Debug Deny Deploy Disable Disconnect Dismount Edit Enable Enter Exit Expand Export Find ForEach Format Get Grant Group Hide Import Initialize Install Invoke Join Limit Lock Measure Merge Mount Move New Open Optimize Out Ping Pop Protect Publish Push Read Receive Redo Register Remove Rename Repair Request Reset Resize Resolve Restart Restore Resume Revoke Save Search Select Send Set Show Skip Sort Split Start Step Stop Submit Suspend Switch Sync Tee Test Trace Unblock Undo Uninstall Unlock Unprotect Unpublish Unregister Update Use Wait Watch Where Write`.split(` `));function _n(e){let t=/^([A-Z][a-z]+(?:[A-Z][a-z]+)?)-[A-Z][A-Za-z]*$/u.exec(e);return t!==null&&gn.has(t[1])}function vn(e){let t=/^(?:&\s*)?(?:"([^"]*)"|'([^']*)'|(\S+))/u.exec(e.trim()),n=(t?.[1]??t?.[2]??t?.[3]??``).split(/[\\/]/u).at(-1)?.toLowerCase().replace(/\.exe$/u,``);return n&&hn.has(n)||yn(e)?`powershell`:`shellscript`}function yn(e){let t=e.trim();if(/^&\s*\S/u.test(t))return!0;for(let e=0;t&&e<Tt;e+=1){let{firstCommand:e,remainingCommand:n}=z(t),r=e.trim();if(/^\$(?:env|global|local|script):/iu.test(r)||/^\$[A-Za-z_]\w*\s+=/u.test(r)||_n(r.match(/^\S+/u)?.[0]??``))return!0;t=n}return!1}var bn=new Set([`cat`,`head`,`tail`,`nl`,`less`,`more`,`bat`,`sed`]),xn=new Set([`grep`,`egrep`,`fgrep`,`rg`,`ag`]),Sn=new Set([`ls`,`tree`,`find`]),Cn=new Set([`head`,`tail`,`wc`,`sort`,`uniq`,`cut`,`grep`,`cat`]),wn={head:new Set([`-n`,`-c`]),tail:new Set([`-n`,`-c`]),sed:new Set([`-e`,`-f`]),grep:new Set([`-e`,`-f`,`-m`,`-A`,`-B`,`-C`,`--regexp`,`--file`,`--max-count`]),rg:new Set([`-e`,`-f`,`-g`,`-t`,`-T`,`-m`,`-A`,`-B`,`-C`,`-M`,`--regexp`,`--file`,`--glob`,`--iglob`,`--type`,`--type-not`,`--max-count`,`--max-columns`,`--context`,`--after-context`,`--before-context`]),ag:new Set([`-G`,`-A`,`-B`,`-C`,`-m`]),tree:new Set([`-L`,`-I`,`-P`])};function Tn(e,t){let n=wn[e]??new Set,r=[],i=[],a=!1;for(let e=0;e<t.length;e+=1){let o=t[e];if(/^\d*(?:>>?|<|>&)/u.test(o)){/^\d*(?:>>?|<|>&)$/u.test(o)&&(e+=1);continue}if(!a&&o===`--`){a=!0;continue}if(!a&&o.startsWith(`-`)&&o!==`-`){if(n.has(o)){let n=t[e+1];(o===`-e`||o===`--regexp`)&&n!==void 0&&i.push(n),e+=1}else o.startsWith(`--regexp=`)&&i.push(o.slice(9));continue}r.push(o)}return{positionals:r,patterns:i}}function En(e){let t=R(e);if(!t||t.length===0)return null;let n=t[0].split(`/`).at(-1),{positionals:r,patterns:i}=Tn(n===`egrep`||n===`fgrep`?`grep`:n,t.slice(1));if(bn.has(n)){if(n===`sed`){if(!t.includes(`-n`)||t.includes(`-i`))return null;let e=i.length>0?r:r.slice(1);return e.length>0?{kind:`read`,paths:e}:null}return r.length>0?{kind:`read`,paths:r}:null}if(xn.has(n)){let e=i[0]??r[0];return e?{kind:`search`,query:e,targets:i.length>0?r:r.slice(1)}:null}return Sn.has(n)?{kind:`list`,target:n===`find`?t.slice(1).find(e=>!e.startsWith(`-`)&&e!==`(`)??null:r[0]??null}:null}function Dn(e){let t=mn(e).trim(),n=null,r=null;for(;t;){let e=z(t),i=e.firstCommand.trim();if(r===null){if(/^cd(?:\s|$)/u.test(i)&&e.separator===`&&`){t=e.remainingCommand;continue}if(r=En(i),r===null)return null}else{let e=R(i)?.[0]?.split(`/`).at(-1);if(n!==`|`||!e||!Cn.has(e))return null}n=e.separator,t=e.remainingCommand}return r}function On(e){return e.replace(/[\\/]+$/u,``).split(/[\\/]/u).at(-1)||e}function kn(e,t,n=On){let r=Dn(e);if(!r)return null;let i=t===`past`,a=e=>e[0]===void 0?``:`${n(e[0])}${e.length>1?` +${e.length-1} more`:``}`;switch(r.kind){case`read`:return`${i?`Read`:`Reading`} ${a(r.paths)}`;case`search`:{let e=a(r.targets);return`${i?`Searched`:`Searching`} for ${r.query}${e?` in ${e}`:``}`}case`list`:return`${i?`Listed`:`Listing`} files${r.target?` in ${a([r.target])}`:``}`}}function U(e){return typeof e==`object`&&e&&!Array.isArray(e)?e:void 0}function W(e){return typeof e==`string`&&e.trim()!==``?e:void 0}function G(e,t=0){if(t>4)return{failed:!1};if(typeof e==`string`)try{return G(JSON.parse(e),t+1)}catch{return{failed:!1}}if(Array.isArray(e)){let n,r=!1;for(let i of e){let e=U(i),a=e?.text??U(e?.content)?.text,o=G(U(a)?.text??a,t+1);n??=o.data,r||=o.failed}return{...n?{data:n}:{},failed:r}}let n=U(e);if(!n)return{failed:!1};let r=n.isError===!0||n.is_error===!0||typeof n._tag==`string`&&/(?:Error|Failure)$/.test(n._tag)||n.error!=null,i=n.structuredContent??n.content;if(i!==void 0){let e=G(i,t+1);return{...e.data?{data:e.data}:{},failed:r||e.failed}}return{data:n,failed:r}}function An(e){let t=G(e).data;return t&&typeof t.toolName==`string`?U(t.args):t}function jn(e){return G(e).failed}function K(e){return new Set(e.filter(e=>e!==void 0)).size+e.filter(e=>e===void 0).length}function q(e,t,n=`${t}s`){return`${e} ${e===1?t:n}`}function Mn(e,t){let n=t.map(e=>{let t=G(e.output);return{input:An(e.input),output:t.data,outcome:t.failed?`failed`:e.outcome}}),r=n.filter(e=>e.outcome===`completed`),i=n.filter(e=>e.outcome===`failed`).length,a=r.length>0?r:n,o=q(a.length,`time`),s=(e,t,n)=>`${r.length>0?e:`Tried to ${t}`} ${n}`,c=e=>a.map(t=>W(t.output?.[e])??W(t.input?.[e])),l=a.map(e=>W(e.output?.id)??W(e.output?.projectId)??W(e.input?.projectId)),u=a.map(e=>W(e.output?.threadId)??W(U(e.output?.thread)?.threadId)??W(e.input?.threadId)),d;switch(e){case`thread-send`:{let e=K(a.map(e=>W(e.output?.messageId))),t=u.every(e=>e!==void 0),n=new Set(u).size;d=s(`Sent`,`send`,t?e===n&&e>1?`messages to ${q(n,`thread`)}`:`${q(e,`message`)} to ${q(n,`thread`)}`:q(e,`message`));break}case`thread-create`:{let e=[];d=r.length>0&&r.every(t=>(Array.isArray(t.output?.threads)?t.output.threads:[t.output]).every(t=>{let n=U(t);if(n?.status===`rolled_back`)return!0;let r=W(n?.threadId);return r?(e.push(r),!0):!1}))?`Created ${q(new Set(e).size,`thread`)}`:`Requested thread creation ${o}`;break}case`delegate`:d=s(`Delegated`,`delegate`,q(K(c(`taskId`)),`task`));break;case`thread-read`:case`thread-wait`:{let t=u.every(e=>e!==void 0)?q(new Set(u).size,`thread`):`threads ${o}`;d=e===`thread-read`?s(`Read`,`read`,t):s(`Waited on`,`wait on`,t);break}case`thread-list`:d=s(`Listed`,`list`,`threads ${o}`);break;case`thread-interrupt`:d=s(`Requested interrupts for`,`interrupt`,q(K(u),`thread`));break;case`workflow-stop`:d=s(`Requested stops for`,`stop`,q(K(c(`subagentId`)),`workflow`));break;case`task-status`:d=s(`Checked`,`check`,`task status ${o}`);break;case`task-cancel`:d=s(`Requested cancellation of`,`cancel`,q(K(c(`taskId`)),`task`));break;case`schedule-create`:d=s(`Scheduled`,`schedule`,q(K(c(`scheduledTaskId`)),`task`));break;case`schedule-list`:d=s(`Listed`,`list`,`scheduled tasks ${o}`);break;case`schedule-update`:d=s(`Updated`,`update`,q(K(c(`scheduledTaskId`)),`scheduled task`));break;case`schedule-delete`:d=s(`Requested deletion of`,`delete`,q(K(c(`scheduledTaskId`)),`scheduled task`));break;case`schedule-run`:d=s(`Requested`,`request`,q(a.length,`scheduled task run`));break;case`thread-configuration`:d=s(`Checked`,`check`,`thread configuration ${o}`);break;case`thread-configure`:d=s(`Set`,`set`,`thread model ${o}`);break;case`thread-fork`:d=s(`Requested`,`request`,q(a.length,`thread fork`));break;case`thread-merge`:d=s(`Requested`,`request`,q(a.length,`context merge`));break;case`thread-search`:d=s(`Searched`,`search`,`threads ${o}`);break;case`thread-transfers`:d=s(`Checked`,`check`,`thread transfers ${o}`);break;case`thread-organize`:d=s(`Organized`,`organize`,`threads ${o}`);break;case`thread-update`:d=s(`Updated`,`update`,q(K(u),`thread`));break;case`queue-list`:d=s(`Listed`,`list`,`queued messages ${o}`);break;case`queue-read`:d=s(`Read`,`read`,q(K(c(`queuedRunId`)),`queued message`));break;case`queue-edit`:d=s(`Edited`,`edit`,q(K(c(`queuedRunId`)),`queued message`));break;case`queue-cancel`:d=s(`Requested cancellation of`,`cancel`,q(K(c(`queuedRunId`)),`queued run`));break;case`queue-reorder`:d=s(`Reordered`,`reorder`,q(K(c(`queuedRunId`)),`queued run`));break;case`queue-steer`:d=s(`Requested steering with`,`steer with`,q(K(c(`queuedRunId`)),`queued message`));break;case`question-list`:d=s(`Listed`,`list`,`pending requests ${o}`);break;case`question-read`:d=s(`Read`,`read`,q(K(c(`requestId`)),`pending request`));break;case`question-respond`:d=s(`Responded to`,`respond to`,q(K(c(`requestId`)),`pending request`));break;case`secret-request`:d=s(`Asked for`,`ask for`,q(a.length,`secret`));break;case`worktree-handoff`:d=s(`Handed off to`,`hand off to`,q(K(c(`worktreePath`)),`worktree`));break;case`worktree-list`:d=s(`Listed`,`list`,`workspace branches ${o}`);break;case`worktree-status`:d=s(`Checked`,`check`,`worktree status ${o}`);break;case`project-list`:d=s(`Listed`,`list`,`projects ${o}`);break;case`project-read`:d=s(`Read`,`read`,q(K(l),`project`));break;case`project-create`:d=s(`Registered`,`register`,q(K(l),`project`));break;case`project-update`:d=s(`Updated`,`update`,q(K(l),`project`));break;case`project-delete`:d=s(`Deleted`,`delete`,q(K(l),`project`));break;case`project-clone`:d=s(`Cloned`,`clone`,q(K(c(`cwd`)),`repository`,`repositories`));break;case`environment-read`:d=s(`Checked`,`check`,`environment preferences ${o}`);break;case`environment-update`:d=s(`Updated`,`update`,`environment preferences ${o}`);break;case`attachment-prepare`:d=s(`Prepared`,`prepare`,q(K(c(`attachmentId`)),`attachment upload`));break;case`attachment-discard`:d=s(`Discarded`,`discard`,q(K(c(`attachmentId`)),`pending attachment`));break;case`attachment-send`:{let e=new Map;a.forEach((t,n)=>e.set(W(t.output?.messageId)??`call-${n}`,t));let t=[...e.values()].reduce((e,t)=>e+(Array.isArray(t.input?.attachments)?t.input.attachments.length:0),0),n=[...e.values()].every(e=>Array.isArray(e.input?.attachments)&&e.input.attachments.length>0),r=u.every(e=>e!==void 0)?` to ${q(new Set(u).size,`thread`)}`:``;d=s(`Sent`,`send`,n?`${q(t,`attachment`)}${r}`:`attachments${r} ${o}`);break}case`link-pr`:d=s(`Linked`,`link`,q(a.length,`pull request`));break;case`unlink-pr`:d=s(`Unlinked`,`unlink`,q(a.length,`pull request`));break;case`watch-pr`:d=s(`Watching`,`watch`,q(a.length,`pull request`));break;case`unwatch-pr`:d=s(`Stopped watching`,`stop watching`,q(a.length,`pull request`));break;case`list-prs`:d=s(`Checked`,`check`,`linked pull requests${a.length===1?``:` ${o}`}`);break;case`write-pr-guides`:{let e=a.flatMap(e=>Array.isArray(e.output?.guides)?e.output.guides.map(e=>U(e)?.outcome):[]),t=e.filter(e=>e!==`failed`).length,n=e.length-t;i+=n,d=e.length>0&&t===0?`Could not start ${q(n,`review guide`)}`:s(`Started`,`start`,e.length===0?`review guides ${o}`:`${q(t,`review guide`)}${n>0?`, ${n} failed`:``}`);break}case`read-pr-guide`:d=s(`Read`,`read`,q(a.length,`review guide`));break;case`browser`:d=s(`Used`,`use`,`browser ${o}`);break;case`decide`:d=s(`Asked`,`ask`,`Decisions ${o}`);break;case`device`:d=s(`Used`,`use`,`device controls ${o}`);break;case`html-preview`:d=s(`Previewed`,`preview`,q(a.length,`HTML page`));break;case`html-render`:d=s(`Rendered`,`render`,q(a.length,`HTML page`));break;case`capabilities`:d=s(`Checked`,`check`,`orchestration capabilities ${o}`)}return{label:d,failedCount:i}}function Nn(e){return e.status===`running`?`Compacting context`:e.beforeTokenCount!==void 0&&e.afterTokenCount!==void 0?`Context compacted ${ce(e.beforeTokenCount)} → ${ce(e.afterTokenCount)} tokens`:`Context compacted`}function Pn(e){return e.replace(/\s+(?:complete|completed)\s*$/i,``).trim()}function J(e){let t=e.structuredPayload;if(t?.type===`dynamic_tool`&&t.toolName)return t.toolName;let n=Y(e.toolData);return typeof n?.server==`string`&&typeof n.tool==`string`?`${n.server}.${n.tool}`:typeof n?.toolName==`string`?n.toolName:A(e.toolTitle)?e.toolTitle:e.label}function Fn(e){let t=e.structuredPayload,n=Y(e.toolData);return t?.type===`dynamic_tool`?t.output:n?.output??n?.result??n?.rawOutput??n?.content}function In(e,t,n){if(!e)return null;let[r,i,a,o]=e.labels,s=t===`inProgress`?i:t===`completed`?a:t===`failed`?`Failed to ${r.toLowerCase()}`:t===`declined`?`Declined to ${r.toLowerCase()}`:t===`stopped`?`Stopped ${i.toLowerCase()}`:i,c=e.summaryAction===`link-pr`||e.summaryAction===`unlink-pr`||e.summaryAction===`list-prs`||e.summaryAction===`watch-pr`||e.summaryAction===`unwatch-pr`?e.summaryAction:void 0,l=Y(n),u=Y(l?.arguments)??Y(l?.input)??Y(l?.rawInput),d=(typeof u?.url==`string`?ie(u.url):null)?.number??u?.number;return{displayName:`${s} ${c!==void 0&&c!==`list-prs`&&typeof d==`number`&&Number.isSafeInteger(d)&&d>0?`PR #${d}`:o}`,icon:e.icon,...c===void 0?{}:{action:c}}}function Ln(e,t){return e===`failed`||e===`declined`||e===`stopped`||e===`idle`?e:t||e===`inProgress`?`inProgress`:`completed`}function Rn(e,t){let n=A(J(e)),r=e.toolLifecycleStatus??t;return In(n,n&&jn(Fn(e))?`failed`:r,e.toolData)}function Y(e){return typeof e==`object`&&e&&!Array.isArray(e)?e:null}function zn(e){return e.tone===`tool`||e.tone===`thinking`||e.tone===`error`||e.command!==void 0&&e.command.trim().length>0||e.requestKind!==void 0||e.itemType!==void 0&&d(e.itemType)}function Bn(e,t){if(e.tone===`error`||e.toolLifecycleStatus===`failed`||e.toolLifecycleStatus===`declined`)return!0;if(!zn(e))return!1;if(A(J(e))&&jn(Fn(e)))return!0;let n=e.structuredPayload;if(n?.type===`command_execution`&&(n.outputIndicatesFailure||n.exitCode!==void 0&&n.exitCode!==0||n.output&&ct(n.output.slice(0,32768))))return!0;let r=t?[e.detail,e.command].filter(Boolean).join(`
|
|
25
|
+
`):e.detail??``;return r.length>0&&ct(r)}function Vn(e){return Bn(e,!0)}function Hn(e){return Bn(e,!1)}function Un(e){return e.itemType===`file_search`||e.itemType===`web_search`&&/\bgrep\b/i.test(Pn(e.toolTitle??e.label))}function X(e){if(e.itemType===`thread_created`)return`thread-create`;let t=Rn(e);if(t?.action!==void 0)return t.action;if(t?.icon===`browser`)return`browser`;if(t?.icon===`device`)return`device`;if(e.requestKind===`file-read`||e.viewedImagePath!==void 0)return`read`;if(e.itemType===`approval_request`||e.itemType===`user_input_request`)return zn(e)?`other`:`update`;let n=e.itemType===`command_execution`&&e.command?Dn(e.command):null;if(n)return n.kind===`read`?`read`:`code-search`;let r=Y(e.toolData)??{},i=e.structuredPayload?.type===`dynamic_tool`?e.structuredPayload.toolName:typeof r.toolName==`string`?r.toolName:e.toolTitle,a=_e({itemType:e.itemType===`command_execution`||e.itemType===`file_change`||e.itemType===`web_search`?e.itemType:e.itemType===`dynamic_tool`?`dynamic_tool_call`:void 0,title:e.toolTitle??e.label,data:{...r,...i?{toolName:i}:{}}});return a===`read`?`read`:a===`file_change`||e.itemType===`file_change`?`edit`:a===`command`||e.itemType===`command_execution`||e.command?`command`:a===`search`?e.itemType===`web_search`&&!Un(e)?`search`:`code-search`:Un(e)?`code-search`:e.itemType===`web_search`?`search`:(e.changedFiles?.length??0)>0?`edit`:zn(e)?`other`:`update`}function Wn(e){let t=e.viewedImagePath?.trim();if(t!==void 0&&!/[\r\n]/.test(t)&&_(t))return t;let n=e.detail?.trim();return X(e)===`read`&&n!==void 0&&!/[\r\n]/.test(n)&&_(n)?n:null}function Gn(e,t){let n=oe(e,t.workspaceRoot??`.`);if(n._tag!==`WorkspaceFile`)return null;let r=t.workspaceRoot==null&&n.path.startsWith(`./`)?n.path.slice(2):n.path,i=se(e,{threadId:t.threadId,workspaceRoot:t.workspaceRoot,resolvedFilePath:r});return i===null||i.access!==`environment`?null:{resource:i.resource,alt:i.name,srcFragment:i.srcFragment}}function Kn(e,t){if(e!==`edit`)return t.length;let n=new Set,r=0;for(let e of t)if(!e.changedFiles||e.changedFiles.length===0)r+=1;else for(let t of e.changedFiles)n.add(t);return n.size+r}function qn(e,t){switch(e){case`link-pr`:return`Linked ${t} ${t===1?`pull request`:`pull requests`}`;case`unlink-pr`:return`Unlinked ${t} ${t===1?`pull request`:`pull requests`}`;case`watch-pr`:return`Watching ${t} ${t===1?`pull request`:`pull requests`}`;case`unwatch-pr`:return`Stopped watching ${t} ${t===1?`pull request`:`pull requests`}`;case`list-prs`:return t===1?`Checked linked pull requests`:`Checked linked pull requests ${t} times`;case`read`:return`Read ${t} ${t===1?`file`:`files`}`;case`edit`:return`Changed ${t} ${t===1?`file`:`files`}`;case`command`:return`Ran ${t} ${t===1?`command`:`commands`}`;case`thread-create`:return`Created ${t} ${t===1?`thread`:`threads`}`;case`device`:return`Used device controls ${t} ${t===1?`time`:`times`}`;case`browser`:return`Used browser ${t} ${t===1?`time`:`times`}`;case`search`:return`Searched the web ${t} ${t===1?`time`:`times`}`;case`code-search`:return`Searched code ${t} ${t===1?`time`:`times`}`;case`other`:return`Used ${t} ${t===1?`tool`:`tools`}`;case`update`:return`Received ${t} ${t===1?`update`:`updates`}`}}function Jn(e){let t=e.structuredPayload,n=e.toolData!==null&&typeof e.toolData==`object`?e.toolData:void 0;return{input:t?.type===`dynamic_tool`?t.input:n?.arguments??n?.input??n?.rawInput,output:Fn(e),outcome:e.toolLifecycleStatus===`failed`||e.toolLifecycleStatus===`declined`||e.tone===`error`?`failed`:e.toolLifecycleStatus===`completed`?`completed`:`unfinished`}}function Yn(e){switch(e){case`command`:case`edit`:case`delegate`:case`task-cancel`:case`thread-create`:case`thread-send`:case`thread-interrupt`:case`workflow-stop`:case`schedule-create`:case`schedule-update`:case`schedule-delete`:case`schedule-run`:case`thread-configure`:case`thread-fork`:case`thread-merge`:case`thread-organize`:case`thread-update`:case`queue-edit`:case`queue-cancel`:case`queue-reorder`:case`queue-steer`:case`question-respond`:case`worktree-handoff`:case`project-create`:case`project-update`:case`project-delete`:case`project-clone`:case`environment-update`:case`attachment-prepare`:case`attachment-discard`:case`attachment-send`:return 0;case`other`:case`update`:return 2;default:return 1}}function Xn(e){let t=e.filter(e=>e.itemType!==`reasoning`);if(e.length>0&&t.length===0)return{summary:e.length===1?`Thought`:`Thought (×${e.length})`,hasFailure:!1};e=t;let n=new Map,r=new Map;for(let t of e){let e=A(J(t))?.summaryAction??null;if(t.toolSource&&e===null){r.set(t.toolSource.key,t.toolSource);continue}let i=X(t),a=e??i,o=n.get(a);o?o.entries.push(t):n.set(a,{action:i,p4Action:e,entries:[t]})}let i=[...n].map(([e,t],n)=>({index:n,count:t.entries.length,priority:Yn(e),...t.p4Action?Mn(t.p4Action,t.entries.map(Jn)):{label:qn(t.action,Kn(t.action,t.entries)),failedCount:t.entries.filter(Hn).length}})),a=[...i].sort((e,t)=>e.priority-t.priority||e.index-t.index).slice(0,2).sort((e,t)=>e.index-t.index),o=a.map(({label:e})=>e);if(r.size>0){let e=[...r.values()],t=[...new Set(e.map(e=>e.name))],n=t.length<2?t[0]:t.length===2?t.join(` and `):`${t.slice(0,-1).join(`, `)}, and ${t.at(-1)}`,i=e.every(e=>e.kind===`integration`);o.unshift(`Used ${n}${i?` ${t.length===1?`integration`:`integrations`}`:``}`)}let s=e.filter(e=>e.toolSource!==void 0&&A(J(e))===null).length,c=e.length-s-a.reduce((e,t)=>e+t.count,0);c>0&&o.push(`Performed ${c} other ${c===1?`action`:`actions`}`);let l=o.map((e,t)=>t===0?e:e.charAt(0).toLowerCase()+e.slice(1));return{summary:l.length<3?l.join(` and `):`${l.slice(0,-1).join(`, `)}, and ${l.at(-1)}`,hasFailure:i.some(e=>e.failedCount>0)}}function Zn(e){let t=e.filter(e=>e.itemType!==`reasoning`);if(e.length>0&&t.length===0)return`reasoning`;if(e=t,e.length>0&&e.every(e=>Rn(e)?.icon===`pull-request`))return`pull-request`;let n=new Set(e.map(X));if(n.size!==1)return`mixed`;let r=n.values().next().value;if(r!==`other`)return r;let i=new Set(e.map(e=>e.itemType===`dynamic_tool`?`dynamic-tool`:e.itemType===`subagent`||e.tone===`thinking`?`agent-tool`:e.tone===`tool`?`tone-tool`:`other`));return i.size===1?i.values().next().value:`mixed`}function Qn(e){let t=/^\s*\*\*([^*\r\n]+)\*\*[ \t]*\r?(?:\n|$)/.exec(e)?.[1],n=(t??e).replace(/!?\[([^\]]*)\]\([^)]*\)/g,`$1`).replace(/^[ \t]*(?:#{1,6}|[-*+]|\d+\.)[ \t]+/gm,``).replace(/`+|\*\*|~~/g,``).replace(/(^|[^\w*])[*_]([^*_\n]+)[*_](?![\w*])/g,`$1$2`).replace(/\s+/g,` `).trim();if(t!==void 0)return n;let r=/[.?!]["'”’)]?(?=\s)/.exec(n);return r?n.slice(0,r.index+r[0].length):n}function $n(e,t){if(e?.status!==`failed`)return null;let n=null;for(let r of t)r.type===`error`&&r.status===`failed`&&r.runId===e.id&&r.nodeId===e.rootNodeId&&(n===null||c(r.updatedAt)>c(n.updatedAt)||c(r.updatedAt)===c(n.updatedAt)&&(r.ordinal>n.ordinal||r.ordinal===n.ordinal&&r.id>n.id))&&(n=r);return n?.failure??null}function er(e,t){let n=t!==null&&t!==e?.message?null:e;return{usageLimitResetAt:n?.class===`usage_limit`?n.resetAt??null:null,lastError:t??e?.message??null,lastErrorClass:t!==null&&t!==e?.message?null:e?.class??null}}function tr(e){let t=null;for(let n of e)n.status!==`queued`&&(n.status!==`cancelled`||n.startedAt!==null)&&(t===null||nr(n,t))&&(t=n);return t}function nr(e,t){let n=e=>e.completedAt?c(e.completedAt):1/0;return n(e)===n(t)?e.ordinal>t.ordinal:n(e)>n(t)}function rr(e,t,n){let r=tr(e);return r?.status===`failed`&&er($n(r,t),n).lastErrorClass===`usage_limit`?r:null}function ir(e,t,n){let r=rr(e,t,n);return r!==null&&e.some(e=>e.ordinal>r.ordinal)?r:null}function ar(e){let t=null;for(let n of e)(n.status!==`queued`||n.queueHeld!==!0)&&(t===null||n.ordinal>t.ordinal)&&(t=n);return t}function or(e,t){if(e.startedAt===null)return null;let n=m(e.status)?t:e.completedAt===null?null:Date.parse(e.completedAt);if(n===null)return null;let r=Date.parse(e.startedAt);return Number.isFinite(r)&&Number.isFinite(n)?Math.max(0,n-r):null}function sr(e){if(!Number.isFinite(e)||e<0)return`0ms`;if(e<1e3)return`${Math.max(1,Math.round(e))}ms`;if(e<1e4){let t=Math.round(e/100)/10;return t>=10?`10s`:`${t.toFixed(1)}s`}if(e<6e4)return`${Math.round(e/1e3)}s`;let t=Math.round(e/1e3),n=Math.floor(t/3600),r=Math.floor(t%3600/60),i=t%60,a=[];return n>0&&a.push(`${n}h`),r>0&&a.push(`${r}m`),i>0&&a.push(`${i}s`),a.join(` `)}var cr=new Set([`preparing`,`starting`,`running`,`waiting`]),lr=new Set([`preparing`,`starting`,`running`]);function ur(e,t){return e.runs.reduce((e,n)=>t(n)&&(e===null||n.ordinal>e.ordinal)?n:e,null)}function dr(e,t){let r=cr.has(t.status)?n(e.providerTurns,t.activeAttemptId)?.status:void 0;return{runId:t.id,status:t.status,requestedAt:l(t.requestedAt),startedAt:t.startedAt===null?null:l(t.startedAt),completedAt:t.completedAt===null?null:l(t.completedAt),assistantMessageId:e.messages.findLast(e=>e.runId===t.id&&e.role===`assistant`)?.id??null,...r===void 0||r===`pending`||r===`running`?{}:{turnEnded:!0},...t.sourcePlanRef===void 0?{}:{sourcePlanRef:t.sourcePlanRef}}}function fr(e){let t=e.providerSessions.findLast(t=>t.providerInstanceId===e.thread.providerInstanceId);return ir(e.runs,e.turnItems,t?.lastError??null)}function pr(e){return fr(e)??ar(e.runs)}function mr(e){let t=pr(e);return t===null?null:dr(e,t)}function hr(e){let t=ur(e,e=>cr.has(e.status))??pr(e);return t===null?null:dr(e,t)}function gr(e){let t=_r(e);return t!==null&&m(t.status)?t.startedAt:null}function _r(e){if(!o(e.thread))return null;let t=e.nodes.findLast(e=>e.kind===`root_turn`&&e.runId===null);return t===void 0?null:{status:t.status,startedAt:t.startedAt===null?null:l(t.startedAt),completedAt:t.completedAt===null?null:l(t.completedAt)}}function vr(e){return e.providerThreads.find(t=>t.id===e.thread.activeProviderThreadId&&t.providerInstanceId===e.thread.modelSelection.instanceId)?.nativeMetadata?.modelSelection??null}var yr=[`reasoningEffort`,`effort`,`reasoning`,`variant`];function br(t,n=[],r){let i=n.find(e=>e.slug===t.model)?.capabilities;if(!i)return null;let o=e({caps:i,selections:t.options});for(let e of yr){let n=o.find(t=>t.id===e);if(n?.type!==`select`)continue;let i=a(n,t,r);if(i)return i}return null}var xr={idle:`Idle`,pending:`Working`,running:`Working`,waiting:`Waiting`,completed:`Completed`,interrupted:`Interrupted`,failed:`Failed`,cancelled:`Cancelled`,rolled_back:`Cancelled`};function Sr(e,t){if(e===null)return`Starting`;let n=xr[e.status],r=m(e.status);if(!r&&e.status!==`completed`)return n;let i=e.startedAt===null?NaN:Date.parse(e.startedAt),a=r?t:e.completedAt===null?NaN:Date.parse(e.completedAt);if(!Number.isFinite(i)||!Number.isFinite(a))return n;let o=sr(Math.max(1e3,Math.floor((a-i)/1e3)*1e3));return r?`${n} ${o}`:`${n} in ${o}`}function Cr(e){let n=mr(e),r=e.providerSessions.findLast(t=>t.providerInstanceId===e.thread.providerInstanceId),i=fr(e),a=pr(e),o=hr(e),s=ur(e,e=>cr.has(e.status)),c=ne(te({latestRun:a,providerThreads:e.providerThreads,turnItems:e.turnItems,activeProviderThreadId:e.thread.activeProviderThreadId,runs:e.runs,pullRequests:e.thread.pullRequests}));if(n===null&&e.thread.activeProviderThreadId===null&&!c)return null;let u=ur(e,e=>lr.has(e.status))?.id??null;return{status:i?`failed`:c&&a?.status!==`failed`?`idle`:o?.status??`idle`,activeRunId:u,activityStartedAt:s===null?null:l(t(s)),providerInstanceId:e.thread.providerInstanceId,providerName:r?.driver??null,...er($n(a,e.turnItems),r?.lastError??null),updatedAt:l(e.updatedAt)}}function wr(e){return ee(e)&&e?.activeRunId!==null&&e?.activeRunId!==void 0}var Z={subagent:{order:0,singular:`subagent`,plural:`subagents`},command:{order:1,singular:`command`,plural:`commands`},monitor:{order:2,singular:`monitor`,plural:`monitors`},background_task:{order:3,singular:`background task`,plural:`background tasks`}};function Tr(e){return e.length<=1?e.join(``):`${e.slice(0,-1).join(`, `)} and ${e.at(-1)}`}function Er(e){if(e.length===0)return null;let t=ne(e),n=e.map(e=>{let t=e.description?.trim(),n=e.kind===`subagent`&&t!==void 0?re(t).trim():t;return{taskId:e.taskId,kind:e.kind,label:n===void 0||n.length===0?Z[e.kind].singular:n,childThreadId:e.kind===`subagent`?e.childThreadId:void 0}}).sort((e,t)=>Z[e.kind].order-Z[t.kind].order),[r]=n;if(n.length===1&&r!==void 0){let e=Z[r.kind].singular,i=r.label!==e;return{title:t?i?`${r.kind===`monitor`?``:`Waiting on ${e} `}${r.label}`:`Waiting on a ${e}`:i?`Running: ${r.label}`:`Running a ${e}`,items:n,waiting:t}}let i=new Map;for(let e of n)i.set(e.kind,(i.get(e.kind)??0)+1);let a=Array.from(i,([e,t])=>{let{singular:n,plural:r}=Z[e];return`${t} ${t===1?n:r}`});return{title:`${t?`Waiting on`:`Running`} ${Tr(a)}`,items:n,waiting:t}}var Dr={active:`Pursuing goal`,paused:`Goal paused`,blocked:`Goal blocked`,usage_limited:`Goal hit a usage limit`,budget_limited:`Goal reached its token budget`,complete:`Goal complete`};function Or(e){return e<1e3?`${e}`:e<1e6?`${Math.round(e/1e3)}k`:`${(e/1e6).toFixed(1).replace(/\.0$/,``)}m`}function kr(e,t){let n=[];return e.tokensUsed!==void 0&&e.tokensUsed>0&&n.push(e.tokenBudget==null?`${Or(e.tokensUsed)} tokens`:`${Or(e.tokensUsed)} / ${Or(e.tokenBudget)} tokens`),e.timeUsedSeconds!==void 0&&e.timeUsedSeconds>=60&&n.push(sr(e.timeUsedSeconds*1e3)),e.checks!==void 0&&e.checks>0&&n.push(`${e.checks} ${e.checks===1?`check`:`checks`}`),{title:e.status===`active`&&!t?`Goal set`:Dr[e.status],objective:e.objective,usage:n.length===0?null:n.join(` · `),canResume:e.status!==`active`&&e.status!==`complete`}}function Ar(e){switch(e.kind){case`subagent`:case`delegated_task`:return e.childThreadId;case`command`:case`monitor`:case`background_task`:case`system`:return;default:return}}var jr=`Preparing workspace`;function Mr(e){return e.type===`command_execution`&&e.input===jr||e.type===`error`&&e.status===`cancelled`&&e.failure.code===`workspace_preparation_failed`}function Nr(e,t){let n=new Set(e.flatMap(e=>e.status===`failed`&&e.workspacePreparation!==void 0?[e.id]:[])),r=new Set;if(n.size===0)return r;for(let e of t)e.type===`error`&&e.status===`failed`&&e.failure.code===`workspace_preparation_failed`&&e.runId!==null&&n.has(e.runId)&&r.add(e.runId);return r}function Pr(e){return e.tone===`tool`||e.tone===`thinking`||e.tone===`error`||e.command!==void 0||e.requestKind!==void 0}function Fr(e){return e.itemType===`error`}function Ir(e){if(!Pr(e)||Vn(e)||e.tone===`thinking`&&e.itemType!==`reasoning`)return!1;let t=e.toolLifecycleStatus;return t!==`failed`&&t!==`declined`&&t!==`inProgress`&&t!==`stopped`&&t!==`idle`}function Lr(e){return Pr(e)&&!Vn(e)&&!Ir(e)}function Rr(e,t){return e===null||e.status===`preparing`||e.status===`queued`||e.status===`starting`||e.status===`running`||e.status===`waiting`?!1:t?.activeRunId!==e.runId}function zr(e,t,n){return g({latestRun:e,runtime:t})??(t?.activeRunId==null?n:null)}function Br(e){return[...e].toSorted((e,t)=>e.createdAt.localeCompare(t.createdAt))}function Vr(e){return[...e].toSorted((e,t)=>e.createdAt.localeCompare(t.createdAt))}function Hr(e,t){if(e===null)return null;let n=e.plans.filter(e=>e.kind===`todo_list`),r=[...n].toReversed().find(e=>e.runId===t)??n.at(-1)??null;return r===null||r.steps.length===0?null:{createdAt:Q(e,r.id),runId:r.runId,explanation:r.explanation??null,steps:r.steps.map(({text:e,status:t,durationMs:n})=>({step:e,status:t===`running`?`inProgress`:t,...n===void 0?{}:{durationMs:n}}))}}function Q(e,t){let n=e.turnItems.findLast(e=>(e.type===`proposed_plan`||e.type===`todo_list`)&&e.planId===t);return l(n?.updatedAt??e.updatedAt)}function Ur(e,t){let n=Q(e,t.id);return{id:t.id,createdAt:n,updatedAt:n,runId:t.runId,planMarkdown:t.markdown,status:t.status}}function Wr(e,t){if(e===null)return null;let n=e.plans.filter(e=>e.kind===`proposed_plan`),r=t?n.filter(e=>e.runId===t):n,i=[...r.length>0?r:n].toSorted((t,n)=>Q(e,t.id).localeCompare(Q(e,n.id))||t.id.localeCompare(n.id)).at(-1);return i===void 0?null:Ur(e,i)}function Gr(e){return e?.status===`active`}var Kr=new Set([`fork`,`handoff`,`run_interrupt_request`,`run_interrupt_result`,`secret_request`,`subagent`]),qr=new Set([`fork`,`thread_created`,`secret_request`]);function Jr(e){return e.kind===`event`&&qr.has(e.projectedItem.item.type)}function $(e){return l(e.item.startedAt??e.item.updatedAt)}function Yr(e){switch(e.status){case`pending`:case`running`:case`waiting`:return`inProgress`;case`completed`:return`completed`;case`idle`:return`idle`;case`failed`:return`failed`;case`cancelled`:case`interrupted`:return`stopped`}}function Xr(e){if(e.type===`error`)return`info`;if(e.type===`reasoning`)return`thinking`;switch(e.type){case`command_execution`:case`file_change`:case`file_search`:case`web_search`:case`dynamic_tool`:case`subagent`:case`thread_created`:case`user_input_request`:case`approval_request`:return`tool`;default:return`info`}}function Zr(e){if(e.retry===void 0)return{label:e.failure.class===`usage_limit`?`Usage limit reached`:e.title?.trim()||`Provider error`,detail:e.failure.message};let t=e.retry.maxAttempts===null?`${e.retry.attempt}`:`${e.retry.attempt}/${e.retry.maxAttempts}`,n=e.status===`running`?`Retrying provider (${t})`:e.status===`completed`?`Provider recovered (${t} retries)`:e.status===`failed`?`${e.failure.class===`usage_limit`?`Usage limit reached`:`Provider error`} after ${t} retries`:`Provider retry stopped (${t})`,r=e.status===`running`&&e.retry.retryDelayMs!==null&&e.retry.retryDelayMs>0?e.retry.retryDelayMs<1e3?` Retrying in ${e.retry.retryDelayMs}ms.`:` Retrying in ${(e.retry.retryDelayMs/1e3).toFixed(1).replace(/\.0$/u,``)}s.`:``;return{label:n,detail:`${e.failure.message}${r}`}}function Qr(e){let{item:t}=e,n=t.title?.trim()||null,r={id:t.id,createdAt:$(e),runId:t.runId,tone:Xr(t),itemType:t.type,toolLifecycleStatus:Yr(t),structuredPayload:t,projectedItem:e,...ke(t)};switch(t.type){case`thread_created`:return{...r,label:`Created thread`};case`compaction`:return{...r,label:Nn(t),sourceActivityKind:`context-compaction`,...t.summary?{detail:t.summary}:{}};case`reasoning`:return{...r,label:n??`Thinking`,...t.text?{detail:t.text}:{}};case`command_execution`:return{...r,label:n??`Ran command`,command:t.input,rawCommand:t.input,toolTitle:n??`Command`,toolData:t};case`file_change`:return{...r,label:n??(t.changes!==void 0&&t.changes.length>1?`Changed ${t.changes.length} files`:`Changed ${t.fileName}`),changedFiles:t.changes?.map(e=>e.path)??[t.fileName],toolTitle:n??`File change`,toolData:t};case`file_search`:return{...r,label:n??Ce(t)??`Searched files`,...t.pattern?{detail:t.pattern}:{},toolTitle:n??`File search`,toolData:t};case`web_search`:return{...r,label:n??`Searched the web`,...t.patterns?.length?{detail:t.patterns.join(`, `)}:{},toolTitle:n??`Web search`,toolData:t};case`checkpoint`:return{...r,label:n??`Checkpoint captured`,changedFiles:t.files.map(e=>e.path),toolData:t};case`system_notice`:return{...r,label:t.message,...i(t)?{}:{sourceActivityKind:`runtime.warning`}};case`error`:{let e=Zr(t);return{...r,...e,...t.failure.class===`usage_limit`&&t.status!==`completed`?{sourceActivityKind:`runtime.warning`}:t.retry===void 0?{sourceActivityKind:`runtime.error`}:{},toolData:t}}case`dynamic_tool`:{let e=_e({itemType:`dynamic_tool_call`,data:{toolName:t.toolName??void 0,input:t.input}}),[i]=he({input:t.input});return{...r,label:n??(e===`read`?we(i??``):e===`search`?Ce({input:t.input})??t.toolName??`Tool call`:t.toolName??`Tool call`),toolTitle:n??t.toolName??`Tool`,toolData:{input:t.input,output:t.output}}}case`approval_request`:return{...r,label:n??`Approval requested`,detail:t.prompt??t.requestKind,toolData:t};case`user_input_request`:return{...r,label:n??(t.questionAnswer?`Answered questions`:`Input requested`),...t.questionAnswer?{questionAnswer:t.questionAnswer}:{},toolData:t};default:return{...r,label:n??t.type.replaceAll(`_`,` `),toolData:t}}}function $r(e){let t=new Set,n=[],r=new Map((e.attempts??[]).map(e=>[e.rootNodeId,e])),i=new Map((e.nodes??[]).map(e=>[e.id,e])),a=new Map((e.plans??[]).map(e=>[e.id,e])),o=e=>{if(e.nodeId===null||e.runId===null)return;let t=e.nodeId,n=new Set;for(;t!==null&&!n.has(t);){n.add(t);let a=r.get(t);if(a?.runId===e.runId)return a;let o=i.get(t);if(o===void 0)return;let s=r.get(o.rootNodeId);if(s?.runId===e.runId)return s;t=o.parentNodeId}},s=new Set(e.visibleTurnItems.flatMap(({item:e})=>e.type===`user_input_request`&&e.questionAnswer?[`async-answer:${e.questionAnswer.requestId}`]:[]));for(let r of e.visibleTurnItems){let{item:i}=r;if(Mr(i)||i.type===`todo_list`||i.type===`checkpoint`||i.type===`user_message`&&s.has(i.messageId))continue;let c=$(r),u=o(i),d=u===void 0?{}:{attempt:u};if(i.type===`notification`){n.push({id:i.id,kind:`work`,createdAt:c,entry:{id:i.id,createdAt:c,runId:i.runId,label:i.summary,tone:`info`,itemType:i.type,structuredPayload:i,projectedItem:r},...d});continue}if(i.type===`user_message`||i.type===`assistant_message`){let a={id:i.messageId,role:i.type===`user_message`?`user`:`assistant`,text:i.text,...i.type===`user_message`&&i.context?{context:i.context}:{},...(i.attachments?.length??0)>0?{attachments:(i.attachments??[]).map(t=>{let n=e.attachmentUrlById?.get(t.id);return n?{...t,previewUrl:n}:t})}:{},runId:i.runId,streaming:i.type===`assistant_message`&&i.streaming,...i.type===`user_message`?{createdBy:i.createdBy,creationSource:i.creationSource,...i.senderThreadId===void 0?{}:{senderThreadId:i.senderThreadId},...i.scheduledTaskId===void 0?{}:{scheduledTaskId:i.scheduledTaskId}}:{},createdAt:c,updatedAt:l(i.updatedAt),...i.type===`user_message`?{inputIntent:i.inputIntent}:{}};t.add(a.id),n.push({id:a.id,kind:`message`,createdAt:c,message:a,projectedItem:r,...d});continue}if(i.type===`proposed_plan`){let e=a.get(i.planId),t={id:i.planId,runId:i.runId,planMarkdown:i.markdown,status:e?.kind===`proposed_plan`?e.status:`active`,createdAt:c,updatedAt:l(i.updatedAt)};n.push({id:i.id,kind:`proposed-plan`,createdAt:c,proposedPlan:t,...d});continue}let f=i.type===`dynamic_tool`&&i.status===`completed`?ot(i):void 0;if(f!==void 0){n.push({id:i.id,kind:`html-render`,createdAt:c,runId:i.runId,htmlRender:f,...d});continue}let p=i.type===`dynamic_tool`&&i.status===`completed`?st(i):void 0;if(p!==void 0){n.push({id:i.id,kind:`mcp-app`,createdAt:c,runId:i.runId,sourceThreadId:r.sourceThreadId,itemId:r.sourceItemId,revision:yt(i),mcpApp:p,...d});continue}if(Kr.has(i.type)){n.push({id:i.id,kind:`event`,createdAt:c,projectedItem:r,...d});continue}n.push({id:i.id,kind:`work`,createdAt:c,entry:Qr(r),...d})}let c=new Set([...t,...s]);for(let t of e.anchoredMessages??[]){if(c.has(t.id))continue;c.add(t.id);let e={id:t.id,kind:`message`,createdAt:t.createdAt,message:t},r=n.findIndex(e=>e.createdAt>t.createdAt);r===-1?n.push(e):n.splice(r,0,e)}for(let t of e.optimisticMessages)t.inputIntent!==`queued_turn`&&!c.has(t.id)&&(c.add(t.id),n.push({id:t.id,kind:`message`,createdAt:t.createdAt,message:t}));return n}var ei=Object.freeze([]);function ti(e){let t=new Set;for(let n of e??[]){if(!r(n))continue;let e=n.previewUrl;e?.startsWith(`blob:`)||e?.startsWith(`data:`)||t.add(n.id)}return t.size===0?ei:Array.from(t,e=>({_tag:`attachment`,attachmentId:e}))}function ni(e,t){if(Object.keys(t).length===0)return ei;let n=new Set;for(let i of e??[])if(i.role===`user`&&t[i.id]?.length)for(let e of i.attachments??[])r(e)&&n.add(e.id);return n.size===0?ei:Array.from(n,e=>({_tag:`attachment`,attachmentId:e}))}function ri(){let e=new WeakMap,t=new WeakMap;return(n,r)=>{let i=n.attachments;if(!i||i.length===0)return n;let a=e.get(i)??i,o,s=!1;for(let[e,t]of i.entries()){let n=r(t),i=`previewUrl`in t?t.previewUrl:void 0,c=a[e],l=`previewUrl`in c?c.previewUrl:void 0,u=!n||n===i?t:n===l?c:{...t,previewUrl:n};s||=u!==t,u!==c&&(o??=a.slice(),o[e]=u)}let c=s?o??a:i;if(e.set(i,c),c===i)return t.delete(n),n;let l=t.get(n);if(l?.attachments===c)return l;let u={...n,attachments:c};return t.set(n,u),u}}function ii(e,t){if(e.role!==`assistant`||t.role!==`assistant`||!e.streaming||!t.streaming)return!1;let{text:n,updatedAt:r,...i}=e,{text:a,updatedAt:o,...c}=t;return s(i,c)}function ai(e,t){let{item:n,...r}=e,{item:i,...a}=t;if(n.type!==`assistant_message`||i.type!==`assistant_message`||!n.streaming||!i.streaming||!s(r,a)||$(e)!==$(t))return!1;let{text:o,updatedAt:c,...l}=n,{text:u,updatedAt:d,...f}=i;return p(l,f)}function oi(e,t){let n=t.input;if(e.visibleTurnItems.length<n.visibleTurnItems.length||!s(e.optimisticMessages,n.optimisticMessages)||!s(e.anchoredMessages,n.anchoredMessages)||!s(e.attachmentUrlById,n.attachmentUrlById)||!s(e.attempts,n.attempts)||!s(e.nodes,n.nodes)||!s(e.plans,n.plans))return null;let r=e.visibleTurnItems.length>n.visibleTurnItems.length;if(r&&(e.optimisticMessages.length>0||(e.anchoredMessages?.length??0)>0)||r&&e.visibleTurnItems.slice(n.visibleTurnItems.length).some(({item:e})=>e.type===`user_input_request`&&e.questionAnswer!==void 0||e.type===`user_message`&&e.messageId.startsWith(`async-answer:`)))return null;let i=new Map;for(let[t,r]of n.visibleTurnItems.entries()){let n=e.visibleTurnItems[t];if(n!==r){if(!ai(r,n))return null;i.set(r,n)}}if(i.size===0&&!r)return t.entries;let a=t.entries.map(e=>{let t=e.kind===`message`&&e.projectedItem!==void 0?i.get(e.projectedItem):void 0;return e.kind!==`message`||t?.item.type!==`assistant_message`?e:{...e,projectedItem:t,message:{...e.message,text:t.item.text,updatedAt:l(t.item.updatedAt)}}});return r&&a.push(...$r({...e,visibleTurnItems:e.visibleTurnItems.slice(n.visibleTurnItems.length)})),a}function si(e,t=null){let n=t===null?null:oi(e,t);if(n!==null)return{input:e,entries:n};let r=$r(e);if(t===null||!s(e.attachmentUrlById,t.input.attachmentUrlById))return{input:e,entries:r};let i=new Map(t.entries.flatMap(e=>e.kind===`message`?[[e.id,e]]:[]));return{input:e,entries:r.map(e=>{if(e.kind!==`message`||e.projectedItem===void 0)return e;let t=i.get(e.id);return t?.projectedItem===e.projectedItem?t.attempt===e.attempt?t:{...e,message:t.message}:e})}}function ci(e){return Object.fromEntries(e.flatMap(e=>e.runId===null?[]:[[e.runId,e.checkpointTurnCount]]))}function li(e){let t=new Map;for(let n of e.checkpoints)n.status===`ready`&&t.set(n.runId,n);let n=new Map;for(let r of e.timelineEntries){if(r.kind!==`message`||r.message.role!==`user`||r.message.inputIntent!==`turn_start`&&r.message.inputIntent!==`queued_turn`||r.message.runId===null)continue;let e=t.get(r.message.runId);e!==void 0&&n.set(r.message.id,Math.max(0,e.checkpointTurnCount-1))}return n}function ui(e){return e===null?`disconnected`:e.status===`preparing`||e.status===`starting`||e.status===`queued`?`connecting`:e.status===`running`||e.status===`waiting`?`running`:`ready`}function di(e,t){return e&&(ui(t)===`running`||wr(t))}export{sn as $,br as A,ir as B,Nr as C,gr as D,vr as E,or as F,Rn as G,Qn as H,sr as I,Zn as J,Xn as K,tr as L,Ar as M,Er as N,hr as O,kr as P,vn as Q,$n as R,Pr as S,b as St,_r as T,Pn as U,Ln as V,Gn as W,Wn as X,Hn as Y,ln as Z,ni as _,le as _t,Br as a,wt as at,Lr as b,we as bt,li as c,St as ct,Gr as d,Me as dt,fn as et,ci as f,Ae as ft,Zr as g,Ue as gt,ai as h,Ke as ht,di as i,yt as it,Sr as j,Cr as k,si as l,at as lt,ii as m,We as mt,Hr as n,pn as nt,Vr as o,bt as ot,Rr as p,Ge as pt,X as q,zr as r,I as rt,ui as s,Ct as st,ri as t,kn as tt,Wr as u,A as ut,ti as v,he as vt,mr as w,Fr as x,Ce as xt,Jr as y,fe as yt,ar as z};
|
|
26
|
+
//# sourceMappingURL=session-logic-DkSfwnHl.js.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{a as e,t}from"./react-DH3P2YXY.js";import{n,t as r}from"./jsx-runtime-BnjsACtP.js";import{dr as i,
|
|
2
|
-
//# sourceMappingURL=settings-
|
|
1
|
+
import{a as e,t}from"./react-DH3P2YXY.js";import{n,t as r}from"./jsx-runtime-BnjsACtP.js";import{dr as i,im as a}from"./utils-BoMYW9A3.js";import{t as o}from"./useLocation-Bqc94klS.js";import{t as s}from"./useNavigateBack-sP0LsL3p.js";import{E as c}from"./useSettings-CaJMqrvF.js";import{r as l}from"./SettingsPanels-BfBUSBAG.js";import{t as u}from"./env-wK1YYxA8.js";import{o as d}from"./sidebar-C1E4GqL6.js";import{B as f,V as p,i as m,z as h}from"./settingsLayout-CFQx1XDM.js";import{$n as g,Da as _,d as v,er as y,nr as b,tr as x,zr as S}from"./main-BWh6jqG2.js";import{t as C}from"./WorkspacePageHeader-CE_94tTR.js";import{n as w,r as T,t as E}from"./WorkspaceBreadcrumb-BW_omYU1.js";import{t as D}from"./SettingsScopeNotice-H7UzC9bb.js";var O=e(t()),k=n(),A=e(r(),1),j={...g,"/settings/diagnostics":`Diagnostics`,"/settings/open-source-licenses":`Open source licenses`};function M(e){return j[e.replace(/\/+$/,``)||`/`]??null}function N(e){let t=(0,k.c)(9),{pathname:n}=e,r;t[0]===n?r=t[1]:(r=M(n),t[0]=n,t[1]=r);let i=r,a;t[2]===i?a=t[3]:(a=i?(0,A.jsxs)(A.Fragment,{children:[(0,A.jsx)(w,{children:`Settings`}),(0,A.jsx)(T,{})]}):null,t[2]=i,t[3]=a);let o=i??`Settings`,s;t[4]===o?s=t[5]:(s=(0,A.jsx)(w,{current:!0,className:`truncate`,children:o}),t[4]=o,t[5]=s);let c;return t[6]!==a||t[7]!==s?(c=(0,A.jsxs)(E,{ariaLabel:`Settings breadcrumb`,children:[a,s]}),t[6]=a,t[7]=s,t[8]=c):c=t[8],c}function P(e){let t=(0,k.c)(6),{onRestored:n}=e,{changedSettingLabels:r,restoreDefaults:o}=l(n),s=r.length===0,c;t[0]===o?c=t[1]:(c=()=>void o(),t[0]=o,t[1]=c);let u;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(u=(0,A.jsx)(a,{className:`mx-1 size-3.5`}),t[2]=u):u=t[2];let d;return t[3]!==s||t[4]!==c?(d=(0,A.jsxs)(i,{size:`xs`,variant:`ghost`,disabled:s,onClick:c,children:[u,`Restore device defaults`]}),t[3]=s,t[4]=c,t[5]=d):d=t[5],d}function F(e){let t=(0,k.c)(19),{pathname:n,children:r}=e,{scope:i,connectedEnvironments:a}=p(),{environments:s}=c(),l;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(l={select:I},t[0]=l):l=t[0];let u=o(l),d,f,g;if(t[1]!==s||t[2]!==u||t[3]!==i){g=Symbol.for(`react.early_return_sentinel`);bb0:{d=y(u);let e=d?.requiresThreadAutoSettlement?x(s,i):null;if(i.kind!==`unavailable`&&d&&e&&!e.isTargetAvailable){let n=e.eligibleEnvironmentIds.length>0?`${d.title} requires a supporting environment. Choose one to continue.`:`${d.title} requires a supporting environment. Connect or update an environment to continue.`,r;t[7]!==e.eligibleEnvironmentIds||t[8]!==u||t[9]!==n?(r=(0,A.jsx)(D,{target:`environment`,targetId:u,eligibleEnvironmentIds:e.eligibleEnvironmentIds,children:n}),t[7]=e.eligibleEnvironmentIds,t[8]=u,t[9]=n,t[10]=r):r=t[10],g=r;break bb0}f=i.kind!==`unavailable`&&d&&!b(d.scope,i.kind)}t[1]=s,t[2]=u,t[3]=i,t[4]=d,t[5]=f,t[6]=g}else d=t[4],f=t[5],g=t[6];if(g!==Symbol.for(`react.early_return_sentinel`))return g;if(f){let e=d.scope===`environment`||d.scope===`project`||d.scope===`checkout`?d.scope:`all`,n=`${d.title} is not available for the selected target. Choose its owning scope to continue.`,r;return t[11]!==u||t[12]!==n||t[13]!==e?(r=(0,A.jsx)(D,{target:e,targetId:u,children:n}),t[11]=u,t[12]=n,t[13]=e,t[14]=r):r=t[14],r}if(h.has(n)||n===`/settings/projects`)return r;if(i.kind===`unavailable`){let e;return t[15]===i.message?e=t[16]:(e=(0,A.jsx)(m,{children:(0,A.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:i.message})}),t[15]=i.message,t[16]=e),e}if(i.kind===`environment`&&a.length===0){let e;return t[17]===i.label?e=t[18]:(e=(0,A.jsx)(m,{children:(0,A.jsxs)(`p`,{className:`text-sm text-muted-foreground`,children:[`Reconnect `,i.label,` to change its settings.`]})}),t[17]=i.label,t[18]=e),e}return r}function I(e){return e.hash}function L(){let e=(0,k.c)(19),t=o(),n=S();s(n);let{search:r,environment:i}=p(),a;e[0]!==i?.environmentId||e[1]!==t.pathname||e[2]!==r?(a=t.pathname===`/settings/diagnostics`||t.pathname===`/settings/providers`?i?.environmentId:JSON.stringify(r),e[0]=i?.environmentId,e[1]=t.pathname,e[2]=r,e[3]=a):a=e[3];let c=a,[l,f]=(0,O.useState)(0),m,h;e[4]===t.pathname?(m=e[5],h=e[6]):(m=(0,A.jsx)(N,{pathname:t.pathname}),h=t.pathname===`/settings/general`?(0,A.jsx)(`div`,{className:`ms-auto flex shrink-0 items-center`,children:(0,A.jsx)(P,{onRestored:()=>f(R)})}):null,e[4]=t.pathname,e[5]=m,e[6]=h);let g;e[7]!==m||e[8]!==h?(g=(0,A.jsx)(C,{electron:u,children:(0,A.jsxs)(`div`,{className:`flex w-full items-center gap-3`,children:[m,h]})}),e[7]=m,e[8]=h,e[9]=g):g=e[9];let v=`${c}:${l}`,y;e[10]===Symbol.for(`react.memo_cache_sentinel`)?(y=(0,A.jsx)(_,{}),e[10]=y):y=e[10];let b;e[11]===t.pathname?b=e[12]:(b=(0,A.jsx)(F,{pathname:t.pathname,children:y}),e[11]=t.pathname,e[12]=b);let x;e[13]!==v||e[14]!==b?(x=(0,A.jsx)(`div`,{className:`min-h-0 flex flex-1 flex-col`,children:b},v),e[13]=v,e[14]=b,e[15]=x):x=e[15];let w;return e[16]!==g||e[17]!==x?(w=(0,A.jsx)(d,{className:`h-dvh min-h-0 overflow-hidden overscroll-y-none isolate`,children:(0,A.jsxs)(`div`,{className:`flex min-h-0 min-w-0 flex-1 flex-col bg-background text-foreground`,children:[g,x]})}),e[16]=g,e[17]=x,e[18]=w):w=e[18],w}function R(e){return e+1}function z(){let e=(0,k.c)(9),t=v.useSearch(),n=v.useNavigate(),r;e[0]===Symbol.for(`react.memo_cache_sentinel`)?(r={select:B},e[0]=r):r=e[0];let i=o(r),a=i===`/settings/providers`||i===`/settings/plugins`,s;e[1]!==n||e[2]!==i?(s=e=>{n({to:i,search:()=>({project:e.project,machine:e.machine,checkout:e.checkout}),hash:``,resetScroll:!1})},e[1]=n,e[2]=i,e[3]=s):s=e[3];let c;e[4]===Symbol.for(`react.memo_cache_sentinel`)?(c=(0,A.jsx)(L,{}),e[4]=c):c=e[4];let l;return e[5]!==t||e[6]!==a||e[7]!==s?(l=(0,A.jsx)(f,{search:t,singleEnvironment:a,onChange:s,children:c}),e[5]=t,e[6]=a,e[7]=s,e[8]=l):l=e[8],l}function B(e){return e.pathname}export{z as component};
|
|
2
|
+
//# sourceMappingURL=settings-B0O54Q3P.js.map
|
package/dist/client/assets/{settings.appearance-DljtCz6-.js → settings.appearance-BesXhA1a.js}
RENAMED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{a as e}from"./react-DH3P2YXY.js";import{n as t,t as n}from"./jsx-runtime-BnjsACtP.js";import{t as r}from"./SettingsPanels-
|
|
2
|
-
//# sourceMappingURL=settings.appearance-
|
|
1
|
+
import{a as e}from"./react-DH3P2YXY.js";import{n as t,t as n}from"./jsx-runtime-BnjsACtP.js";import{t as r}from"./SettingsPanels-BfBUSBAG.js";var i=t(),a=e(n());function o(){let e=(0,i.c)(1),t;return e[0]===Symbol.for(`react.memo_cache_sentinel`)?(t=(0,a.jsx)(r,{}),e[0]=t):t=e[0],t}export{o as component};
|
|
2
|
+
//# sourceMappingURL=settings.appearance-BesXhA1a.js.map
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import{a as e,t}from"./react-DH3P2YXY.js";import{n,t as r}from"./jsx-runtime-BnjsACtP.js";import{Dy as i,Id as a,dr as o,nd as s,om as c}from"./utils-BoMYW9A3.js";import{t as l}from"./useNavigate-DdjG4MB_.js";import{n as u,t as d}from"./kbd-3FPzNikV.js";import{F as f,I as p,L as m,R as h,V as g,a as _,i as v,s as y}from"./settingsLayout-CFQx1XDM.js";import{ga as b,ha as x,va as S}from"./main-BWh6jqG2.js";var C=n(),w=e(t(),1),T=e(r(),1);function E(e){let t=(0,C.c)(10),n,r;t[0]===e?(n=t[1],r=t[2]):({icon:n,...r}=e,t[0]=e,t[1]=n,t[2]=r);let i;t[3]===n?i=t[4]:(i=(0,T.jsx)(`span`,{className:`mt-3 ml-4 flex size-10 shrink-0 items-center justify-center rounded-xl bg-muted text-muted-foreground`,children:(0,T.jsx)(n,{"aria-hidden":!0,className:`size-5`})}),t[3]=n,t[4]=i);let a;t[5]===r?a=t[6]:(a=(0,T.jsx)(_,{...r,className:`min-w-0 flex-1`}),t[5]=r,t[6]=a);let o;return t[7]!==i||t[8]!==a?(o=(0,T.jsxs)(`div`,{className:`flex items-start`,children:[i,a]}),t[7]=i,t[8]=a,t[9]=o):o=t[9],o}function D(e){let t=(0,C.c)(9),{mode:n,chromeOpened:r}=e,i;t[0]===n?i=t[1]:(i=n===`store`?[`In the Chrome Web Store tab, click Add to Chrome.`,`Confirm with Add extension.`]:[`In Chrome, go to chrome://extensions.`,`Turn on Developer mode.`,`Click Load unpacked.`,(0,T.jsxs)(T.Fragment,{children:[`Press`,` `,(0,T.jsxs)(u,{children:[(0,T.jsx)(d,{children:`⌘`}),(0,T.jsx)(d,{children:`⇧`}),(0,T.jsx)(d,{children:`G`})]}),`, paste the copied folder path, press Return, then click Select.`]})],t[0]=n,t[1]=i);let a=i,o;t[2]===r?o=t[3]:(o=r?null:(0,T.jsx)(`li`,{children:`Open Google Chrome.`}),t[2]=r,t[3]=o);let s;t[4]===a?s=t[5]:(s=a.map(O),t[4]=a,t[5]=s);let c;return t[6]!==o||t[7]!==s?(c=(0,T.jsxs)(`ol`,{className:`list-decimal space-y-1.5 py-3 pl-5 text-xs text-muted-foreground`,role:`status`,children:[o,s]}),t[6]=o,t[7]=s,t[8]=c):c=t[8],c}function O(e,t){return(0,T.jsx)(`li`,{children:e},t)}function k(){let e=l(),{search:t}=g(),n=f(),r=h(),u=m(),d=p([`decisionVisionEnabled`]),_=!!n.decisionOpenRouterKey,C=window.desktopBridge,[O,k]=(0,w.useState)([]),[A,j]=(0,w.useState)(!!C?.listComputerUsePermissionHosts),[M,N]=(0,w.useState)(``),[P,F]=(0,w.useState)(!1),[I,L]=(0,w.useState)(),[R,z]=(0,w.useState)(),[B,V]=(0,w.useState)(!1),H=new Set(O.flatMap(e=>e.permissions?.chromeProfiles??[])).size;(0,w.useEffect)(()=>{let e=!0,t=async()=>{if(C?.getComputerUseChromeStatus?.().then(t=>e&&L(t),()=>{}),C?.listComputerUsePermissionHosts&&C.requestComputerUsePermission)try{let t=await C.listComputerUsePermissionHosts(),n=await Promise.all(t.map(async e=>({...e,permissions:await C.requestComputerUsePermission({...e,action:`status`})})));e&&(k(n),N(``))}catch{e&&N(`Could not read helper status. Refresh to try again.`)}finally{e&&j(!1)}};t();let n=C?.onComputerUsePermissionHostsChanged?.(()=>void t()),r=()=>void t();return window.addEventListener(`focus`,r),()=>{e=!1,n?.(),window.removeEventListener(`focus`,r)}},[C]);let U=async e=>{F(!0),N(``);try{await e()}catch(e){N(e instanceof Error?e.message:`Computer Use setup failed.`)}finally{F(!1)}},W=(e,t)=>U(async()=>{let n=await C?.requestComputerUsePermission?.({environmentId:e.environmentId,hostId:e.hostId,action:t});n&&k(t=>t.map(t=>t.hostId===e.hostId?{...t,permissions:n}:t))});return(0,T.jsxs)(v,{children:[(0,T.jsxs)(`header`,{className:`space-y-2 px-3 sm:px-4`,children:[(0,T.jsx)(`h1`,{className:`text-2xl font-semibold tracking-tight`,children:`Computer Use`}),(0,T.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:`Manage how agents interact with apps and browsers on your computer.`})]}),(0,T.jsxs)(y,{title:`Control`,variant:`plain`,children:[(0,T.jsxs)(`div`,{className:`divide-y divide-border overflow-hidden rounded-2xl border border-border`,children:[(0,T.jsx)(E,{icon:s,title:`Desktop apps`,description:`Control apps through the P4 Code desktop helper. Stop active control from the menu bar.`,status:A?`Checking helper…`:O.length?`Connected`:window.desktopBridge?`No helper connected`:`Open the desktop app to set up app control.`,control:C?.revealComputerUseHelper?(0,T.jsx)(o,{size:`sm`,variant:`outline`,disabled:P,onClick:()=>void U(()=>C.revealComputerUseHelper()),children:`Reveal in Finder`}):void 0,children:O.map(e=>(0,T.jsxs)(`div`,{className:`space-y-2 py-3`,children:[(0,T.jsx)(`p`,{className:`text-xs font-medium`,children:e.label}),(0,T.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:`Allow app interaction and screenshots in macOS settings, then refresh the status.`}),(0,T.jsxs)(`div`,{className:`flex flex-wrap gap-2`,children:[(0,T.jsxs)(o,{size:`sm`,variant:`outline`,disabled:P,onClick:()=>void W(e,e.permissions?.accessibility?`open-accessibility`:`allow-accessibility`),children:[`Accessibility: `,e.permissions?.accessibility?`Allowed`:`Allow`]}),(0,T.jsxs)(o,{size:`sm`,variant:`outline`,disabled:P,onClick:()=>void W(e,e.permissions?.screenRecording?`open-screen-recording`:`allow-screen-recording`),children:[`Screen Recording: `,e.permissions?.screenRecording?`Allowed`:`Allow`]}),(0,T.jsx)(o,{size:`sm`,variant:`ghost`,disabled:P,onClick:()=>void W(e,`status`),children:`Refresh`})]})]},`${e.environmentId}:${e.hostId}`))}),(0,T.jsx)(E,{icon:a,title:`Google Chrome`,description:`Let agents use your Chrome tabs, and chat about any page from Chrome's side panel.`,status:C?.setupComputerUseChrome?B?`Bridge removed. To remove the extension too, use Remove on chrome://extensions.`:H>0?(0,T.jsxs)(`span`,{className:`flex items-center gap-1.5`,role:`status`,children:[(0,T.jsx)(`span`,{"aria-hidden":!0,className:`size-1.5 rounded-full bg-success`}),`Connected in `,H,` Chrome`,` `,H===1?`profile`:`profiles`,`.`]}):I?.bridgeInstalled&&!R?`Bridge installed. Waiting for the extension to connect.`:void 0:`Install the Chrome extension from the desktop app.`,control:C?.setupComputerUseChrome?(0,T.jsxs)(`div`,{className:`flex gap-2`,children:[I?.bridgeInstalled&&C.removeComputerUseChrome?(0,T.jsx)(o,{size:`sm`,variant:`ghost`,disabled:P,onClick:()=>void U(async()=>{await C.removeComputerUseChrome(),z(void 0),V(!0),L(await C.getComputerUseChromeStatus?.())}),children:`Remove`}):null,H===0||B?(0,T.jsx)(o,{size:`sm`,variant:`outline`,disabled:P,onClick:()=>void U(async()=>{let e=await C.setupComputerUseChrome();V(!1),z({mode:e.mode,chromeOpened:e.chromeOpened}),L(await C.getComputerUseChromeStatus?.())}),children:`Install Chrome extension`}):null]}):void 0,children:(0,T.jsx)(x,{open:R!==void 0&&H===0,children:(0,T.jsx)(b,{children:R?(0,T.jsx)(D,{...R}):null})})})]}),M?(0,T.jsx)(`p`,{className:`px-4 text-sm text-destructive`,role:`alert`,children:M}):null]}),(0,T.jsx)(y,{title:`Navigation`,variant:`plain`,children:(0,T.jsx)(`div`,{className:`overflow-hidden rounded-2xl border border-border`,children:(0,T.jsx)(E,{icon:c,id:`computer-use-faster-navigation`,title:`Faster navigation`,description:`Use screenshot suggestions from Jev or Luna Decisions to find navigation targets.`,serverScoped:!0,settingKeys:[`decisionVisionEnabled`],control:(0,T.jsx)(S,{"aria-label":`Faster navigation`,checked:n.decisionVisionEnabled,mixed:d,disabled:!u,onCheckedChange:e=>r({decisionVisionEnabled:e})}),children:(0,T.jsxs)(`div`,{className:`space-y-3 py-3`,children:[(0,T.jsxs)(`div`,{className:`flex flex-wrap items-center gap-3`,children:[(0,T.jsxs)(`span`,{className:`text-xs text-muted-foreground`,children:[i[n.decisionModel],` ·`,` `,_?`API key saved`:`API key needed`]}),(0,T.jsx)(o,{size:`sm`,variant:`outline`,onClick:()=>void e({to:`/settings/decisions`,search:t.machine?{machine:t.machine}:{}}),children:`Model and API key`})]}),n.decisionVisionEnabled&&!_?(0,T.jsx)(`p`,{role:`status`,className:`text-xs text-muted-foreground`,children:`Add an API key in Decisions to use faster navigation.`}):null,(0,T.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:`When enabled, screenshots go to the selected service. Suggestions never click by themselves.`})]})})})})]})}var A=k;export{A as component};
|
|
2
|
+
//# sourceMappingURL=settings.computer-use-BeKmLbNe.js.map
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import{a as e,t}from"./react-DH3P2YXY.js";import{n,t as r}from"./jsx-runtime-BnjsACtP.js";import{$_ as i,$n as a,$p as o,$x as s,B_ as c,Dl as l,Gy as u,H_ as d,J_ as f,Kl as p,L_ as m,Md as h,Pd as g,Q_ as _,S_ as v,U_ as y,Uc as b,W_ as x,X_ as S,Y_ as C,Yn as w,Yp as T,Z_ as E,Zo as D,_C as O,aE as k,af as A,ar as j,as as M,cE as N,cb as P,cr as F,dr as I,dx as ee,ev as te,fr as ne,iE as re,is as ie,jm as ae,kv as oe,lr as se,nr as ce,nv as le,om as ue,ps as de,q_ as fe,ql as L,rh as pe,rr as me,rv as he,sr as ge,sv as R,t as _e,tE as ve,tr as ye,ts as be,tv as xe,ur as Se,us as z,v_ as Ce,xx as we,z_ as Te,zf as Ee}from"./utils-BoMYW9A3.js";import{Dt as B,Et as De,F as Oe,Ht as ke,On as Ae,Ot as je,R as Me,Ut as Ne,W as Pe,jt as V,kt as H,o as Fe,on as Ie,tt as Le,w as Re,x as ze}from"./runtime-DR7JxgbQ.js";import{E as Be,Et as Ve,F as He,Mt as Ue,Ot as We,S as U,_ as Ge,jt as Ke,t as W}from"./runtime-d6B1vJeH.js";import{a as qe,c as Je,o as Ye,s as Xe,t as Ze}from"./select-DaYjjw1q.js";import{t as G}from"./spinner-CSTrcxhP.js";import{i as K,p as Qe}from"./toast-B84QdqqM.js";import{A as $e,D as et,E as tt,O as nt,b as rt,c as q,et as it,s as at,v as ot}from"./useSettings-CaJMqrvF.js";import{f as st,h as ct,s as lt}from"./server-sXApTCjZ.js";import{a as ut,i as dt,n as J,s as ft}from"./session-C949OsEI.js";import{n as pt}from"./query-d1pQlqP0.js";import{t as mt}from"./use-atom-command-DA6OG-Qk.js";import{t as Y}from"./toastHelpers-DxXYm50b.js";import{i as ht,r as gt}from"./timestampFormat-wac2e_Jz.js";import{a as _t,n as vt,t as yt}from"./tooltip-D-GRl-oZ.js";import{t as bt}from"./textarea-R4UQ47Ns.js";import{t as xt}from"./input-ekYqAkUx.js";import{t as St}from"./scroll-area-yyfi3ycu.js";import{a as Ct,c as wt,i as Tt,l as Et,n as Dt,o as Ot,r as kt,s as At,t as jt}from"./dialog-CBBxT1gk.js";import{n as Mt}from"./P4ConnectAccountPages-C4KYM5XU.js";import{a as Nt,i as Pt,o as Ft,r as It,t as Lt}from"./empty-FOL5U4KY.js";import{t as Rt}from"./AnimatedHeight-OxEbW01v.js";import{C as zt,_ as Bt,w as Vt,y as Ht}from"./keybindings-B3oDRRkK.js";import{i as Ut,o as Wt,t as Gt}from"./popover-OfG3wVsl.js";import{t as Kt}from"./checkbox-BEQFb7GO.js";import{_ as qt,a as Jt,c as Yt,d as Xt,f as Zt,g as Qt,i as $t,l as en,p as tn,r as nn,s as rn,u as an,v as on}from"./uiStateStore-xSkh4_PU.js";import{n as sn,t as X}from"./EnvironmentMachineIcon-Dpgx67FY.js";import{r as cn,t as ln}from"./alert-DO06etEs.js";import{a as un,i as dn,s as fn,u as pn}from"./settingsLayout-CFQx1XDM.js";import{_ as mn,b as hn,g as gn,h as _n,v as vn,x as yn,y as bn}from"./command-E2aLhsct.js";import{t as xn}from"./ConnectionStatusDot-CixsTBXI.js";import{a as Sn,n as Cn,o as wn,s as Tn,t as En}from"./primary-B47ivN3o.js";import{n as Dn,t as On}from"./onboarding-CPgiVEVK.js";import{Ar as kn,Er as An,Fr as jn,Gn as Mn,Ir as Nn,Jn as Pn,Jt as Fn,Kn as In,Kt as Ln,Mr as Rn,Nr as zn,Or as Bn,Pr as Vn,Qn as Hn,T as Un,Tr as Wn,Wt as Gn,Xn as Kn,Yn as qn,Zn as Jn,_r as Yn,ga as Xn,gr as Zn,ha as Qn,hr as $n,ir as er,jr as tr,kr as nr,li as rr,mr as ir,qn as ar,qt as or,ui as sr,va as cr}from"./main-BWh6jqG2.js";import{i as lr,n as ur,r as dr}from"./ConnectionDiagnosisDetails-DGbJY7Hw.js";import{t as fr}from"./FoldedSettingsSection-DySTg20x.js";var Z=n(),pr=[{scope:f,title:`View environment`,description:`Read threads, status, checkpoints, and configuration.`},{scope:fe,title:`Operate tasks`,description:`Start, update, and stop tasks.`},{scope:i,title:`Change environment settings`,description:`Edit environment preferences and keybindings.`},{scope:S,title:`Manage providers`,description:`Configure, install, sign in to, and update providers and usage sources.`},{scope:d,title:`Maintain environment`,description:`Update the server and control environment processes.`},{scope:C,title:`Control previews`,description:`Open browser previews and host browser automation.`},{scope:c,title:`View diagnostics and usage`,description:`Read process diagnostics, resource history, and usage totals.`},{scope:he,title:`View terminals`,description:`Read existing terminal output and status.`},{scope:le,title:`Use terminals`,description:`Create terminals and send input to running shells.`},{scope:te,title:`Change source control`,description:`Commit, push, manage branches and repositories, and change pull requests.`},{scope:y,title:`Read files`,description:`Browse host files, search workspaces, and inspect local changes.`},{scope:x,title:`Write files`,description:`Edit workspace files and save plans to disk.`},{scope:m,title:`View access`,description:`Inspect pairing links and authorized clients.`},{scope:Te,title:`Manage access`,description:`Issue and revoke credentials for other clients.`},{scope:E,title:`View relay`,description:`Inspect managed relay connectivity.`},{scope:_,title:`Manage relay`,description:`Change managed tunnel connectivity.`}],Q=e(r(),1);function mr(e){let t=(0,Z.c)(4),{environmentId:n,connected:r,routeContext:i}=e,a=i!==void 0&&i,o=ut(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:pr.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:R(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 hr(e,t){let n=new URL(e);return n.pathname=`/pair`,Ue(n,t).toString()}function gr(e,t){return new URL(e).protocol===`https:`?U({host:e,token:t}):null}function _r(){let e=(0,Z.c)(48),t=window.desktopBridge?.setLocalEnvironmentEnabled,[n]=(0,$.useState)(vr),[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=er(`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)(cr,{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)(un,{...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)(Nn,{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)(Rn,{children:y}),e[14]=y,e[15]=b);let x;e[16]!==b||e[17]!==v?(x=(0,Q.jsxs)(Vn,{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)(I,{variant:`outline`}),e[21]=C):C=e[21];let w;e[22]===a?w=e[23]:(w=(0,Q.jsx)(tr,{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)(G,{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)(I,{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)(zn,{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)(jn,{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)(kn,{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 vr(){return!Re()}function yr(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 br(e){let t=(0,Z.c)(27),{environmentId:n,serverConfig:r}=e,i=rt(n),o=dt(n,`settings:write`)?`granted`:`denied`,s;t[0]!==o||t[1]!==r?(s=yr({serverConfig:r,operateAccess:o}),t[0]=o,t[1]=r,t[2]=s):s=t[2];let c=s,u=r?.environment.platform.machine??`server`,d;t[3]===r?d=t[4]:(d=l(r),t[3]=r,t[4]=d);let f=d,p;t[5]===f?p=t[6]:(p=(0,Q.jsxs)(se,{children:[(0,Q.jsx)(sn,{kind:f}),`Icon`]}),t[5]=f,t[6]=p);let m;t[7]===c?m=t[8]:(m=c===null?null:(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(a,{disabled:!0,className:`whitespace-normal`,children:c}),(0,Q.jsx)(j,{})]}),t[7]=c,t[8]=m);let h;t[9]!==u||t[10]!==c||t[11]!==i?(h=e=>{c===null&&v(e)&&i({environmentIcon:e===u?null:e})},t[9]=u,t[10]=c,t[11]=i,t[12]=h):h=t[12];let g;t[13]!==u||t[14]!==c||t[15]!==r?.environment?(g=Ce.map(e=>(0,Q.jsx)(me,{value:e,disabled:c!==null,children:(0,Q.jsxs)(`span`,{className:`flex min-w-0 items-center gap-2`,children:[(0,Q.jsx)(sn,{kind:e,className:`size-3.5 shrink-0`}),(0,Q.jsx)(`span`,{className:`min-w-0 flex-1 truncate`,children:X[e]}),e===u?(0,Q.jsx)(`span`,{className:`shrink-0 text-xs text-muted-foreground`,children:r?.environment.platform.machine?`detected`:`default`}):null]})},e)),t[13]=u,t[14]=c,t[15]=r?.environment,t[16]=g):g=t[16];let _;t[17]!==f||t[18]!==h||t[19]!==g?(_=(0,Q.jsx)(ce,{value:f,onValueChange:h,children:g}),t[17]=f,t[18]=h,t[19]=g,t[20]=_):_=t[20];let y;t[21]!==m||t[22]!==_?(y=(0,Q.jsxs)(F,{children:[m,_]}),t[21]=m,t[22]=_,t[23]=y):y=t[23];let b;return t[24]!==p||t[25]!==y?(b=(0,Q.jsxs)(ge,{children:[p,y]}),t[24]=p,t[25]=y,t[26]=b):b=t[26],b}function xr(e){let t=(0,Z.c)(31),{environment:n,onAddRoute:r}=e,i=H(n.entry),a=i.map(Cr),[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(Sr)),u=c.flatMap(e=>l.get(e)??[]),d=ft(n.environmentId),f;t[0]!==n.connection||t[1]!==d._tag||t[2]!==d.value?(f=d._tag===`Some`&&n.connection.phase===`connected`?B(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=mt(ct.reorderRoutes,`Reorder routes`),h=mt(ct.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:rn},t[5]=_):_=t[5];let v=qt(Qt(Zt,g),Qt(Xt,_)),y;t[6]!==n.environmentId||t[7]!==h?(y=async e=>{let t=De(e);await it(`Remove ${je(e)} route?${t===null?``:`\n${t}`}`,{variant:`destructive`})===!0&&await h({environmentId:n.environmentId,routeId:B(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=Jt(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)})},S=an,C=tn,w;t[9]===Symbol.for(`react.memo_cache_sentinel`)?(w=[sr,rr],t[9]=w):w=t[9];let E=$t,D=en,O=`Routes to ${n.label}, preferred first`,k=u.map((e,t)=>(0,Q.jsx)(wr,{route:e,position:t+1,inUse:B(e.target)===p,removable:u.length>1&&!V(e),onRemove:()=>void b(e)},B(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]!==S||t[19]!==x||t[20]!==v||t[21]!==j||t[22]!==C||t[23]!==w?(M=(0,Q.jsx)(S,{sensors:v,collisionDetection:C,modifiers:w,onDragEnd:x,children:j}),t[18]=S,t[19]=x,t[20]=v,t[21]=j,t[22]=C,t[23]=w,t[24]=M):M=t[24];let N;t[25]===Symbol.for(`react.memo_cache_sentinel`)?(N=(0,Q.jsx)(T,{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)(I,{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 Sr(e){return[B(e.target),e]}function Cr(e){return B(e.target)}function wr(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=B(n.target),t[0]=n.target,t[1]=s);let c=s,l;t[2]===n?l=t[3]:(l=je(n),t[2]=n,t[3]=l);let u=l,d;t[4]===n?d=t[5]:(d=De(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}=Yt(p),x;t[8]===v?x=t[9]:(x=on.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=_e(`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,V(n)?` · found automatically`:``]}),t[20]=f,t[21]=n,t[22]=D):D=t[22];let O;t[23]!==E||t[24]!==D?(O=(0,Q.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[E,D]}),t[23]=E,t[24]=D,t[25]=O):O=t[25];let k=`Reorder ${u}, position ${r}`,A;t[26]===Symbol.for(`react.memo_cache_sentinel`)?(A=(0,Q.jsx)(Ee,{className:`size-3.5`}),t[26]=A):A=t[26];let j;t[27]!==m||t[28]!==h||t[29]!==_||t[30]!==k?(j=(0,Q.jsx)(`button`,{type:`button`,ref:_,...m,...h,"aria-label":k,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:A}),t[27]=m,t[28]=h,t[29]=_,t[30]=k,t[31]=j):j=t[31];let M;t[32]!==u||t[33]!==o||t[34]!==a?(M=a?(0,Q.jsxs)(yt,{children:[(0,Q.jsx)(_t,{render:(0,Q.jsx)(I,{type:`button`,variant:`ghost-muted`,size:`icon-xs`,"aria-label":`Remove ${u} route`,onClick:o}),children:(0,Q.jsx)(pe,{className:`size-3`})}),(0,Q.jsx)(vt,{side:`top`,children:`Remove route`})]}):null,t[32]=u,t[33]=o,t[34]=a,t[35]=M):M=t[35];let N;return t[36]!==g||t[37]!==O||t[38]!==j||t[39]!==M||t[40]!==S||t[41]!==w?(N=(0,Q.jsxs)(`li`,{ref:g,style:S,className:w,children:[O,j,M]}),t[36]=g,t[37]=O,t[38]=j,t[39]=M,t[40]=S,t[41]=w,t[42]=N):N=t[42],N}function Tr(e){let t=e.username?`${e.username}@${e.hostname}`:e.hostname;return e.port?`${t}:${e.port}`:t}function Er(e,t=null){let{entry:n}=e;if(n.target._tag===`PrimaryConnectionTarget`)return`This machine`;let r=H(n);if(r.length>1){let e=t===null?void 0:r.find(e=>B(e.target)===B(t));return e===void 0?je(r[0]):`via ${je(e)}`}return e.relayManaged?`P4 Connect`:Ge(n.target)?`WSL`:n.target._tag===`SshConnectionTarget`&&k(n.profile)&&n.profile.value._tag===`SshConnectionProfile`?`SSH ${Tr(n.profile.value.target)}`:e.displayUrl??`Remote link`}function Dr(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=_e(`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)(sn,{"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 Or=[{value:100,label:`Prefer`},{value:50,label:`Normal`},{value:25,label:`Less often`},{value:0,label:`Manual only`}];function kr(e){return e===void 0||e===50?50:e===0?0:e<50?25:100}function Ar(e){return Or.find(t=>t.value===e).label}function jr(e,t){let n=e.flatMap(e=>{let n=kr(t[e.environmentId]);return n===50?[]:[`${e.label} ${Ar(n).toLowerCase()}`]});return n.length===0?null:n.join(` · `)}function Mr(e){let t=(0,Z.c)(27),{environments:n}=e,r=at(),i=q(),a=ot();if(n.length<2)return null;let o;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(o=er(`load-balancing`),t[0]=o):o=t[0];let{id:s,title:c}=o,u;t[1]!==n||t[2]!==r.loadBalancingEnabled||t[3]!==r.loadBalancingWeights?(u=r.loadBalancingEnabled?jr(n,r.loadBalancingWeights):`Off`,t[1]=n,t[2]=r.loadBalancingEnabled,t[3]=r.loadBalancingWeights,t[4]=u):u=t[4];let d=!i,f;t[5]===a?f=t[6]:(f=e=>a({loadBalancingEnabled:e}),t[5]=a,t[6]=f);let p;t[7]!==r.loadBalancingEnabled||t[8]!==d||t[9]!==f?(p=(0,Q.jsx)(cr,{"aria-label":`Automatically balance load`,checked:r.loadBalancingEnabled,disabled:d,onCheckedChange:f}),t[7]=r.loadBalancingEnabled,t[8]=d,t[9]=f,t[10]=p):p=t[10];let m;t[11]===Symbol.for(`react.memo_cache_sentinel`)?(m=(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]=m):m=t[11];let h;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)(Dr,{kind:l(e.serverConfig),label:e.label,subtitle:Er(e),children:(0,Q.jsxs)(Ze,{items:Or,value:kr(r.loadBalancingWeights[e.environmentId]),disabled:!i||!r.loadBalancingEnabled,onValueChange:t=>{t!==null&&a({loadBalancingWeights:{...r.loadBalancingWeights,[e.environmentId]:t}})},children:[(0,Q.jsx)(Xe,{size:`xs`,className:`w-32`,"aria-label":`${e.label} load preference`,children:(0,Q.jsx)(Je,{})}),(0,Q.jsx)(Ye,{align:`end`,alignItemWithTrigger:!1,children:Or.map(Nr)})]})},e.environmentId),t[18]=r.loadBalancingEnabled,t[19]=r.loadBalancingWeights,t[20]=i,t[21]=a,t[22]=e):e=t[22],h=n.map(e),t[12]=n,t[13]=r.loadBalancingEnabled,t[14]=r.loadBalancingWeights,t[15]=i,t[16]=a,t[17]=h}else h=t[17];let g;return t[23]!==u||t[24]!==p||t[25]!==h?(g=(0,Q.jsxs)(fr,{id:s,title:c,summary:u,control:p,children:[m,h]}),t[23]=u,t[24]=p,t[25]=h,t[26]=g):g=t[26],g}function Nr(e){let{value:t,label:n}=e;return(0,Q.jsx)(qe,{value:t,children:n},t)}var Pr=[{value:`off`,label:`Off`},{value:`read`,label:`Read PRs`},{value:`read-write`,label:`Read and act`}],Fr={"read-write":`read and act`,read:`read PRs`};function Ir(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(`, `)} ${Fr[t]}`]});return t.length===0?null:t.join(` · `)}function Lr(e){let t=(0,Z.c)(19),{environments:n}=e,r=be(ct.githubRoutingPermissionsValueAtom),i=be(ct.catalogValueAtom),a=mt(ct.setGitHubRoutingPermission),[o,s]=(0,$.useState)(!1);if(n.length<2)return null;let c;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(c=er(`github-routing`),t[0]=c):c=t[0];let{id:u,title:d}=c,f;t[1]!==n||t[2]!==r?(f=Ir(n.map(e=>({label:e.label,permission:Ne(e.entry,r)})))??`Off`,t[1]=n,t[2]=r,t[3]=f):f=t[3];let p;t[4]===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:`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]=p):p=t[4];let m;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)(Dr,{kind:l(e.serverConfig),label:e.label,subtitle:Er(e),children:(0,Q.jsxs)(Ze,{items:Pr,value:Ne(e.entry,r),disabled:!i.isReady||o||ke(e.entry)===null,onValueChange:t=>{t!==null&&(s(!0),a({environmentId:e.environmentId,permission:t}).then(e=>{s(!1),e._tag===`Failure`&&K.add({type:`error`,title:`Could not save GitHub routing permission`})}))},children:[(0,Q.jsx)(Xe,{size:`xs`,className:`w-32`,"aria-label":`${e.label} GitHub routing`,children:(0,Q.jsx)(Je,{})}),(0,Q.jsx)(Ye,{align:`end`,alignItemWithTrigger:!1,children:Pr.map(Rr)})]})},e.environmentId),t[11]=i,t[12]=r,t[13]=o,t[14]=a,t[15]=e):e=t[15],m=n.map(e),t[5]=i,t[6]=n,t[7]=r,t[8]=o,t[9]=a,t[10]=m}else m=t[10];let h;return t[16]!==f||t[17]!==m?(h=(0,Q.jsxs)(fr,{id:u,title:d,summary:f,children:[p,m]}),t[16]=f,t[17]=m,t[18]=h):h=t[18],h}function Rr(e){let{value:t,label:n}=e;return(0,Q.jsx)(qe,{value:t,children:n},t)}function zr(e){let t=(0,Z.c)(26),{environmentLabel:n,onCancel:r,onConfirm:i}=e,a=Mt(),[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)(Nn,{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)(Rn,{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)(ne,{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)(Rn,{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)(Vn,{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)(tr,{render:(0,Q.jsx)(I,{variant:`outline`}),children:`Cancel`}),t[13]=g):g=t[13];let _;t[14]===i?_=t[15]:(_=(0,Q.jsxs)(zn,{children:[g,(0,Q.jsx)(I,{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)(jn,{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)(kn,{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 Br={pairingLinks:[],clientSessions:[]};function Vr(e,t,n){let r=n(t);return[...e.filter(e=>n(e)!==r),t]}function Hr(e,t){switch(t.type){case`snapshot`:return t.payload;case`pairingLinkUpserted`:return{...e,pairingLinks:Vr(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:Vr(e.clientSessions,t.payload,e=>e.sessionId)};case`clientRemoved`:return{...e,clientSessions:e.clientSessions.filter(e=>e.sessionId!==t.payload.sessionId)}}}function Ur(e,t){let n=Hr(e,t);return[n,[{version:1,revision:t.revision,type:`snapshot`,payload:n}]]}function Wr(e){return{accessChanges:Oe(e,{label:`environment-data:server:auth-access-changes`,subscribe:e=>Le(b.subscribeAuthAccess,{}).pipe(oe(()=>Br,Ur))})}}var Gr=Wr(W),Kr=3e4,qr=class extends P()(`DesktopNetworkAccessUnavailableError`,{}){get message(){return`Desktop network access is unavailable.`}},Jr=class extends P()(`DesktopServerExposureStateLoadError`,{cause:u()}){get message(){return`Failed to load desktop server exposure state.`}},Yr=class extends P()(`DesktopAdvertisedEndpointsLoadError`,{cause:u()}){get message(){return`Failed to load advertised desktop endpoints.`}};function Xr(){return typeof window>`u`?void 0:window.desktopBridge}function Zr(e){let t=s(`loadDesktopNetworkAccess`)(function*(){let t=e();if(!t)return yield*new qr;let[n,r]=yield*we([O({try:()=>t.getServerExposureState(),catch:e=>new Jr({cause:e})}),O({try:()=>t.getAdvertisedEndpoints(),catch:e=>new Yr({cause:e})})],{concurrency:`unbounded`});return{advertisedEndpoints:r,serverExposureState:n}});return M(t()).pipe(z({staleTime:Kr,revalidateOnMount:!0}),ie,de(`desktop:network-access`))}var Qr=Zr(Xr);function $r(){D.refresh(Qr)}function ei(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 ti=class extends P()(`DesktopSshDiscoveryUnavailableError`,{}){get message(){return`Desktop SSH host discovery is unavailable.`}},ni=class extends P()(`DesktopSshDiscoveryError`,{cause:u()}){get message(){return`Failed to discover SSH hosts.`}};function ri(){return typeof window>`u`?void 0:window.desktopBridge}function ii(e){let t=s(`discoverDesktopSshHosts`)(function*(){let t=e();return t?yield*O({try:()=>t.discoverSshHosts(),catch:e=>new ni({cause:e})}):yield*new ti});return M(t()).pipe(z({staleTime:3e4,revalidateOnMount:!0}),ie,de(`desktop:ssh-hosts`))}var ai=ii(ri),oi=443,si=[],ci=[],li=`backend:default-wsl`,ui=`backend:wsl-off`,di=new Intl.DateTimeFormat(void 0,{dateStyle:`medium`,timeStyle:`short`});function fi(e){let t=new Date(e);return Number.isNaN(t.getTime())?e:di.format(t)}function pi(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)(Wt,{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(mi),t[6]=n,t[7]=l);let u;t[8]===l?u=t[9]:(u=(0,Q.jsxs)(Ut,{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)(Gt,{children:[s,u]}),t[10]=s,t[11]=u,t[12]=d):d=t[12],d}function mi(e){return(0,Q.jsx)(`code`,{className:`font-mono text-foreground/85`,children:e},e)}function hi(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 gi(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=Be(n);if(r)return{host:r.host,pairingCode:r.token};let i=Ke(n);return i?{host:n.origin,pairingCode:i}:null}catch{return null}}function _i(e){let t=gi(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 vi(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 yi=`first:rounded-t-xl last:rounded-b-xl px-3 py-2.5 sm:px-4`;function bi(e){return Ln}function xi(e,t){return e===`endpoint-rail`?_e(`relative first:rounded-t-xl last:rounded-b-xl px-3 py-3 sm:px-4`,!t&&`bg-muted/15`):_e(yi,!t&&`bg-muted/24`)}function Si(e){return[...e].toSorted((e,t)=>new Date(t.createdAt).getTime()-new Date(e.createdAt).getTime())}function Ci(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 wi(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 Ti(e){return{...e,scopes:e.permissions??e.scopes,createdAt:ee(e.createdAt),expiresAt:ee(e.expiresAt)}}function Ei(e){return{...e,scopes:e.permissions??e.scopes,issuedAt:ee(e.issuedAt),expiresAt:ee(e.expiresAt),lastConnectedAt:e.lastConnectedAt===null?null:ee(e.lastConnectedAt)}}function Di(e,t){let n=e.filter(e=>e.status!==`unavailable`);if(t){let e=n.find(e=>ki(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 Oi(e){return e.id.startsWith(`tailscale-magicdns:`)}function ki(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(Oi(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 Ai(e,t){return e.compatibility.hostedHttpsApp===`compatible`?gr(e.httpBaseUrl,t)??hr(e.httpBaseUrl,t):hr(e.httpBaseUrl,t)}function ji(e){let t=new URL(`/pair`,window.location.href);return Ue(t,e).toString()}function Mi(e){try{let t=new URL(e);return t.pathname===`/pair`&&t.searchParams.has(`host`)}catch{return!1}}function Ni(e,t){if(Mi(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 Pi=(0,$.memo)(function(e){let t=(0,Z.c)(135),{pairingLink:n,credential:r,endpointUrl:i,endpoints:a,defaultEndpointKey:s,presentation:c,revokingPairingLinkId:l,onRevoke:u,canRevoke:d}=e,f=c===void 0?`current`:c,p=pn(1e3),m=new Date(n.expiresAt).getTime(),[h,g]=(0,$.useState)(!1),[_,v]=(0,$.useState)(!1),[y,b]=(0,$.useState)(null),x=(0,$.useId)(),S;t[0]===r?S=t[1]:(S=r?ji(r):null,t[0]=r,t[1]=S);let C=S,w;t[2]!==r||t[3]!==i?(w=r&&i!=null&&i!==``?gr(i,r):null,t[2]=r,t[3]=i,t[4]=w):w=t[4];let T=w,E;if(t[5]!==r||t[6]!==s||t[7]!==a){let e=Di(a,s);E=e&&r?Ai(e,r):null,t[5]=r,t[6]=s,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=Ai(t,r);e.push({id:t.id,preferenceKey:ki(t),label:t.label,url:n,detail:Ni(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]!==C||t[14]!==D||t[15]!==i||t[16]!==T?(A=D??(r&&i!=null&&i!==``?T??hr(i,r):ze(window.location.hostname)?null:C),t[12]=r,t[13]=C,t[14]=D,t[15]=i,t[16]=T,t[17]=A):A=t[17];let j=A,[M,N]=(0,$.useState)(null),P=M??j??r??``,F=P!==r,ee=F&&Mi(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:ra,onError:(e,t)=>{let{value:n,kind:r}=t;N(n),g(!0),K.add(Y({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}=Qe(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=ia,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 le=ce,ue;t[24]===n.expiresAt?ue=t[25]:(ue=fi(n.expiresAt),t[24]=n.expiresAt,t[25]=ue);let de=ue,fe=n.label??`Pairing link`,L;t[26]!==s||t[27]!==k||t[28]!==y?(L=qn(k,y,s),t[26]=s,t[27]=k,t[28]=y,t[29]=L):L=t[29];let pe=L,me=pe?.url??j,he=pe?.qrShareable??!0;if(m<=p)return null;let ge;t[30]===f?ge=t[31]:(ge=bi(f),t[30]=f,t[31]=ge);let R;t[32]===n.createdAt?R=t[33]:(R=fi(n.createdAt),t[32]=n.createdAt,t[33]=R);let ve=`Link created at ${R}`,ye;t[34]===ve?ye=t[35]:(ye=(0,Q.jsx)(xn,{tooltipText:ve,dotClassName:`bg-warning`}),t[34]=ve,t[35]=ye);let be;t[36]===fe?be=t[37]:(be=(0,Q.jsx)(`h3`,{className:`text-sm font-medium text-foreground`,children:fe}),t[36]=fe,t[37]=be);let xe;t[38]!==ye||t[39]!==be?(xe=(0,Q.jsxs)(`div`,{className:`flex min-h-5 items-center gap-1.5`,children:[ye,be]}),t[38]=ye,t[39]=be,t[40]=xe):xe=t[40];let Se;t[41]===Symbol.for(`react.memo_cache_sentinel`)?(Se=(0,Q.jsx)(`span`,{}),t[41]=Se):Se=t[41];let z;t[42]!==p||t[43]!==n.expiresAt?(z=ht(n.expiresAt,p),t[42]=p,t[43]=n.expiresAt,t[44]=z):z=t[44];let Ce;t[45]===z?Ce=t[46]:(Ce=(0,Q.jsx)(_t,{render:Se,children:z}),t[45]=z,t[46]=Ce);let we;t[47]===de?we=t[48]:(we=(0,Q.jsx)(vt,{side:`top`,children:de}),t[47]=de,t[48]=we);let Te;t[49]!==Ce||t[50]!==we?(Te=(0,Q.jsxs)(yt,{children:[Ce,we]}),t[49]=Ce,t[50]=we,t[51]=Te):Te=t[51];let Ee;t[52]===Symbol.for(`react.memo_cache_sentinel`)?(Ee=(0,Q.jsx)(`span`,{"aria-hidden":!0,children:` · `}),t[52]=Ee):Ee=t[52];let B;t[53]===n.scopes?B=t[54]:(B=(0,Q.jsx)(pi,{scopes:n.scopes,label:`Pairing link scopes`}),t[53]=n.scopes,t[54]=B);let De;t[55]!==Te||t[56]!==B?(De=(0,Q.jsxs)(`p`,{className:`text-xs text-muted-foreground`,children:[Te,Ee,B]}),t[55]=Te,t[56]=B,t[57]=De):De=t[57];let Oe;t[58]!==r||t[59]!==j?(Oe=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]=Oe):Oe=t[60];let ke;t[61]!==xe||t[62]!==De||t[63]!==Oe?(ke=(0,Q.jsxs)(`div`,{className:`min-w-0 flex-1 space-y-1`,children:[xe,De,Oe]}),t[61]=xe,t[62]=De,t[63]=Oe,t[64]=ke):ke=t[64];let Ae;t[65]!==_||t[66]!==x||t[67]!==j?(Ae=j&&ne?(0,Q.jsxs)(I,{size:`xs`,variant:`outline`,"aria-expanded":_,"aria-controls":x,onClick:()=>v(aa),children:[(0,Q.jsx)(o,{"aria-hidden":!0}),`Share`]}):null,t[65]=_,t[66]=x,t[67]=j,t[68]=Ae):Ae=t[68];let je=r!==void 0&&h,Me;t[69]===Symbol.for(`react.memo_cache_sentinel`)?(Me=e=>{g(e),e||N(null)},t[69]=Me):Me=t[69];let Ne;t[70]!==r||t[71]!==le||t[72]!==j?(Ne=r?ne?j?null:(0,Q.jsx)(I,{size:`xs`,variant:`outline`,onClick:le,children:`Copy code`}):(0,Q.jsx)(Et,{render:(0,Q.jsx)(I,{size:`xs`,variant:`outline`}),children:j?`Show link`:`Show code`}):null,t[70]=r,t[71]=le,t[72]=j,t[73]=Ne):Ne=t[73];let Pe=F?ee?`Hosted app pairing link`:`Pairing link`:`Pairing code`,V;t[74]===Pe?V=t[75]:(V=(0,Q.jsx)(wt,{children:Pe}),t[74]=Pe,t[75]=V);let H=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.`,Fe;t[76]===H?Fe=t[77]:(Fe=(0,Q.jsx)(kt,{children:H}),t[76]=H,t[77]=Fe);let Ie;t[78]!==V||t[79]!==Fe?(Ie=(0,Q.jsxs)(Ct,{children:[V,Fe]}),t[78]=V,t[79]=Fe,t[80]=Ie):Ie=t[80];let Le=F?4:3,Re;t[81]!==P||t[82]!==Le?(Re=(0,Q.jsx)(bt,{readOnly:!0,value:P,rows:Le,onFocus:oa,onClick:sa}),t[81]=P,t[82]=Le,t[83]=Re):Re=t[83];let Be;t[84]!==te||t[85]!==F||t[86]!==P?(Be=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)(Un,{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]=Be):Be=t[87];let Ve;t[88]!==Re||t[89]!==Be?(Ve=(0,Q.jsxs)(Ot,{children:[Re,Be]}),t[88]=Re,t[89]=Be,t[90]=Ve):Ve=t[90];let He;t[91]===Symbol.for(`react.memo_cache_sentinel`)?(He=(0,Q.jsx)(I,{variant:`outline`,onClick:()=>g(!1),children:`Done`}),t[91]=He):He=t[91];let Ue;t[92]===le?Ue=t[93]:(Ue=ne?(0,Q.jsx)(I,{variant:`outline`,onClick:le,children:`Copy code`}):null,t[92]=le,t[93]=Ue);let We;t[94]===Ue?We=t[95]:(We=(0,Q.jsxs)(Tt,{variant:`bare`,children:[He,Ue]}),t[94]=Ue,t[95]=We);let U;t[96]!==Ie||t[97]!==Ve||t[98]!==We?(U=(0,Q.jsxs)(At,{className:`max-w-md`,children:[Ie,Ve,We]}),t[96]=Ie,t[97]=Ve,t[98]=We,t[99]=U):U=t[99];let Ge;t[100]!==je||t[101]!==Ne||t[102]!==U?(Ge=(0,Q.jsxs)(jt,{open:je,onOpenChange:Me,children:[Ne,U]}),t[100]=je,t[101]=Ne,t[102]=U,t[103]=Ge):Ge=t[103];let Ke=!d||l===n.id,W;t[104]!==u||t[105]!==n.id?(W=()=>void u(n.id),t[104]=u,t[105]=n.id,t[106]=W):W=t[106];let qe=l===n.id?`Revoking…`:`Revoke`,Je;t[107]!==Ke||t[108]!==W||t[109]!==qe?(Je=(0,Q.jsx)(I,{size:`xs`,variant:`destructive-outline`,disabled:Ke,onClick:W,children:qe}),t[107]=Ke,t[108]=W,t[109]=qe,t[110]=Je):Je=t[110];let Ye;t[111]!==Ae||t[112]!==Ge||t[113]!==Je?(Ye=(0,Q.jsxs)(`div`,{className:`flex w-full shrink-0 items-center gap-2 sm:w-auto sm:justify-end`,children:[Ae,Ge,Je]}),t[111]=Ae,t[112]=Ge,t[113]=Je,t[114]=Ye):Ye=t[114];let Xe;t[115]!==ke||t[116]!==Ye?(Xe=(0,Q.jsxs)(`div`,{className:or,children:[ke,Ye]}),t[115]=ke,t[116]=Ye,t[117]=Xe):Xe=t[117];let Ze=_&&me!==null,G;t[118]!==he||t[119]!==oe||t[120]!==k||t[121]!==le||t[122]!==me||t[123]!==x||t[124]!==pe?.id?(G=me===null?null:(0,Q.jsxs)(`div`,{id:x,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===pe?.id;return(0,Q.jsxs)(`button`,{type:`button`,role:`radio`,"aria-checked":t,className:_e(`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:()=>b(e.id),children:[(0,Q.jsx)(`span`,{className:_e(`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)(yt,{children:[(0,Q.jsx)(_t,{render:(0,Q.jsx)(`code`,{className:`min-w-0 flex-1 truncate font-mono text-2xs text-muted-foreground`,children:me})}),(0,Q.jsx)(vt,{side:`top`,children:me})]}),(0,Q.jsx)(I,{size:`xs`,variant:`ghost`,className:`shrink-0`,onClick:()=>oe(me,se(me)),children:`Copy link`})]}),(0,Q.jsx)(I,{size:`xs`,variant:`ghost`,onClick:le,children:`Copy code only`})]}),he?(0,Q.jsx)(`div`,{className:`w-fit shrink-0 self-center rounded-xl bg-white p-3 sm:self-start`,children:(0,Q.jsx)(Un,{value:me,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]=he,t[119]=oe,t[120]=k,t[121]=le,t[122]=me,t[123]=x,t[124]=pe?.id,t[125]=G):G=t[125];let $e;t[126]===G?$e=t[127]:($e=(0,Q.jsx)(Xn,{children:G}),t[126]=G,t[127]=$e);let et;t[128]!==Ze||t[129]!==$e?(et=(0,Q.jsx)(Qn,{open:Ze,children:$e}),t[128]=Ze,t[129]=$e,t[130]=et):et=t[130];let tt;return t[131]!==ge||t[132]!==Xe||t[133]!==et?(tt=(0,Q.jsxs)(`div`,{className:ge,children:[Xe,et]}),t[131]=ge,t[132]=Xe,t[133]=et,t[134]=tt):tt=t[134],tt}),Fi=(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=pn(1e3),l=n.current||n.connected,u=n.lastConnectedAt,d;t[0]!==l||t[1]!==u||t[2]!==c?(d=l?u?`Connected for ${gt(u,c)}`:`Connected`:u?`Last connected at ${fi(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(ca),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=bi(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)(xn,{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)(pi,{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)(I,{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:or,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}),Ii=(0,$.memo)(function({onPairingLinkCreated:e,clientSessions:t,isRevokingOtherClients:n,onRevokeOtherClients:r,delegatableScopes:i}){let a=nt(),[o,s]=(0,$.useState)(!1),[l,u]=(0,$.useState)(``),[d,p]=(0,$.useState)([...xe]),m=d.filter(e=>i.includes(e)),[h,g]=(0,$.useState)(!1),_=(0,$.useCallback)(async()=>{if(a!==null&&m.length!==0&&J(a,`access:write`)&&m.every(e=>J(a,e))){g(!0);try{e(await Cn({label:l,scopes:m})),u(``),p(xe.filter(e=>i.includes(e))),s(!1)}catch(e){let t=e instanceof Error?e.message:`Failed to create pairing URL.`;K.add(Y({type:`error`,title:`Could not create pairing URL`,description:t}))}finally{g(!1)}}},[i,e,l,a,m]),v=(0,$.useCallback)((e,t)=>{p(n=>Kn(n,e,t))},[]);return(0,Q.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,Q.jsx)(I,{size:`xs`,variant:`destructive-outline`,disabled:n||!In(t),onClick:()=>void r(),children:n?`Revoking…`:`Revoke others`}),(0,Q.jsxs)(jt,{open:o,onOpenChange:e=>{s(e),e||(u(``),p(xe.filter(e=>i.includes(e))))},children:[(0,Q.jsx)(Et,{render:(0,Q.jsxs)(I,{size:`xs`,variant:`default`,children:[(0,Q.jsx)(T,{className:`size-3`}),`Create link`]})}),(0,Q.jsxs)(At,{className:`max-w-md`,children:[(0,Q.jsxs)(Ct,{children:[(0,Q.jsx)(wt,{children:`Create pairing link`}),(0,Q.jsx)(kt,{children:`Generate a one-time link that another device can use to pair with this backend as an authorized client.`})]}),(0,Q.jsxs)(Ot,{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)(xt,{value:l,onChange:e=>u(e.target.value),placeholder:`e.g. Living room iPad`,disabled:h,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)(I,{size:`xs`,variant:`outline`,disabled:h,onClick:()=>p([f,y,c,he].filter(e=>i.includes(e))),children:`Read only`}),(0,Q.jsx)(I,{size:`xs`,variant:`outline`,disabled:h,onClick:()=>p(xe.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:pr.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)(Kt,{className:`mt-0.5`,checked:d.includes(e),disabled:h,onCheckedChange:t=>v(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))}),m.length===0?(0,Q.jsx)(`p`,{className:`text-xs text-destructive`,children:`Select at least one permission.`}):m.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)(Tt,{variant:`bare`,children:[(0,Q.jsx)(I,{variant:`outline`,disabled:h,onClick:()=>s(!1),children:`Cancel`}),(0,Q.jsx)(I,{disabled:h||m.length===0,onClick:()=>void _(),children:h?`Creating…`:`Create link`})]})]})]})]})}),Li=(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)(Pi,{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)(Fi,{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:bi(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}),Ri=(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=Oi(n)&&n.status!==`available`,t[0]=n,t[1]=d);let f=d,p;t[2]===n?p=t[3]:(p=Oi(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?(_=xi(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)(yt,{children:[(0,Q.jsx)(_t,{render:(0,Q.jsx)(`p`,{className:`min-w-0 truncate text-xs leading-5 text-muted-foreground`,children:n.httpBaseUrl})}),(0,Q.jsx)(vt,{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)(I,{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)(I,{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)(I,{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 zi(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 Bi(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 Vi(e){let t=(0,Z.c)(177),{environment:n,removingEnvironmentId:r,onSetEnabled:i,onRemove:o,onAddRoute:s}=e,[c,u]=(0,$.useState)(!1),[d,f]=(0,$.useState)(!1),[p,m]=(0,$.useState)(!1),g=n.environmentId,_=n.connection.phase===`unsupported`,v=n.entry.enabled&&!_,y=n.connection.phase===`connected`,b=r===g,x=n.connection.traceId,S;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(S={target:`trace ID`,onCopy:Xi,onError:Yi},t[0]=S):S=t[0];let{copyToClipboard:C}=Qe(S),T;t[1]===C?T=t[2]:(T=e=>{C(e,{traceId:e})},t[1]=C,t[2]=T);let E=T,D;t[3]===Symbol.for(`react.memo_cache_sentinel`)?(D={target:`MCP URL`,onCopy:Ji,onError:qi},t[3]=D):D=t[3];let{copyToClipboard:O}=Qe(D),k;t[4]===n.serverConfig?k=t[5]:(k=Wn(n.serverConfig),t[4]=n.serverConfig,t[5]=k);let M=k,P;t[6]===g?P=t[7]:(P=st.updateStateAtom(g),t[6]=g,t[7]=P);let F=be(P),ee=F.status===`running`&&F.stage===`resuming`,te;t[8]===n?te=t[9]:(te=Bi(n),t[8]=n,t[9]=te);let ne=te,re=n.serverConfig?.environment.serverVersion??null,ie=$e(),ae;t[10]!==g||t[11]!==ie.environments?(ae=ve(ie.environments.get(g)?.status??N())?.descriptor,t[10]=g,t[11]=ie.environments,t[12]=ae):ae=t[12];let oe=ae,[se,ce]=(0,$.useState)(oe);oe!==void 0&&oe!==se&&ce(oe);let le;t[13]!==g||t[14]!==ie.environments?(le=ie.environments.get(g)?.environment.endpoint.httpBaseUrl,t[13]=g,t[14]=ie.environments,t[15]=le):le=t[15];let de=le,[fe,L]=(0,$.useState)(de);de!==void 0&&de!==fe&&L(de);let pe=mt(ct.retryNow),{diagnosis:me,state:he,relayOnly:ge}=lr(n),R=ee?null:me,xe=ft(g),z=y&&xe._tag===`Some`?xe.value.target:null,Ce=de??fe,we;t[16]!==z||t[17]!==n.entry||t[18]!==Ce?(we=We({entry:n.entry,relayHttpBaseUrl:Ce,connectedTarget:z}),t[16]=z,t[17]=n.entry,t[18]=Ce,t[19]=we):we=t[19];let Te=we,Ee;t[20]!==n.serverConfig||t[21]!==se?(Ee=n.serverConfig??(se===void 0?null:{environment:se}),t[20]=n.serverConfig,t[21]=se,t[22]=Ee):Ee=t[22];let B;t[23]===Ee?B=t[24]:(B=l(Ee),t[23]=Ee,t[24]=B);let De=B,Oe;t[25]===n.entry?Oe=t[26]:(Oe=H(n.entry),t[25]=n.entry,t[26]=Oe);let ke=Oe.length,Ae;t[27]!==z||t[28]!==n?(Ae=Er(n,z),t[27]=z,t[28]=n,t[29]=Ae):Ae=t[29];let je=R?null:ee?`Restarting`:ne.text,Me=v&&M?re:null,Ne;t[30]!==Ae||t[31]!==je||t[32]!==Me?(Ne=[Ae,je,Me].filter(Ki),t[30]=Ae,t[31]=je,t[32]=Me,t[33]=Ne):Ne=t[33];let Pe=Ne.join(` · `),V=v&&y&&M!==null&&(F.status===`idle`||F.status===`failed`),Fe;t[34]!==v||t[35]!==n.connection||t[36]!==_?(Fe=_?n.connection.error??Ve(n.connection):v?Ve(n.connection):`Switched off`,t[34]=v,t[35]=n.connection,t[36]=_,t[37]=Fe):Fe=t[37];let Ie=`${Fe}${M?`\nUpdate available: ${M.serverVersion} → ${M.clientVersion}`:``}`,Le=n.label,Re=!v,ze=v&&ne.tone===`error`&&!ee&&!R&&`text-destructive`,Be;t[38]===ze?Be=t[39]:(Be=_e(`min-w-0 truncate`,ze),t[38]=ze,t[39]=Be);let Ue;t[40]===Be?Ue=t[41]:(Ue=(0,Q.jsx)(`span`,{className:Be}),t[40]=Be,t[41]=Ue);let U;t[42]!==Ie||t[43]!==Pe||t[44]!==Ue?(U=(0,Q.jsx)(_t,{payload:Ie,render:Ue,children:Pe}),t[42]=Ie,t[43]=Pe,t[44]=Ue,t[45]=U):U=t[45];let Ge;t[46]===Ie?Ge=t[47]:(Ge=(0,Q.jsx)(vt,{side:`top`,className:`whitespace-pre-wrap`,children:Ie}),t[46]=Ie,t[47]=Ge);let Ke;t[48]!==U||t[49]!==Ge?(Ke=(0,Q.jsxs)(yt,{children:[U,Ge]}),t[48]=U,t[49]=Ge,t[50]=Ke):Ke=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 qe;t[52]===Symbol.for(`react.memo_cache_sentinel`)?(qe=()=>u(Gi),t[52]=qe):qe=t[52];let Je=ke===1?`Routes`:`${ke} routes`,Ye=c&&`rotate-90`,Xe;t[53]===Ye?Xe=t[54]:(Xe=_e(`size-3 shrink-0 transition-transform duration-150 motion-reduce:transition-none`,Ye),t[53]=Ye,t[54]=Xe);let Ze;t[55]===Xe?Ze=t[56]:(Ze=(0,Q.jsx)(h,{"aria-hidden":!0,className:Xe}),t[55]=Xe,t[56]=Ze);let G;t[57]!==c||t[58]!==Je||t[59]!==Ze?(G=(0,Q.jsxs)(`button`,{type:`button`,"aria-expanded":c,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:[Je,Ze]}),t[57]=c,t[58]=Je,t[59]=Ze,t[60]=G):G=t[60];let K;t[61]===Symbol.for(`react.memo_cache_sentinel`)?(K=(0,Q.jsx)(`span`,{"aria-hidden":!0,className:`shrink-0`,children:`·`}),t[61]=K):K=t[61];let et=`remote-permissions-${g}`,tt;t[62]===Symbol.for(`react.memo_cache_sentinel`)?(tt=()=>f(Wi),t[62]=tt):tt=t[62];let nt=d&&`rotate-90`,rt;t[63]===nt?rt=t[64]:(rt=_e(`size-3 shrink-0 transition-transform duration-150 motion-reduce:transition-none`,nt),t[63]=nt,t[64]=rt);let q;t[65]===rt?q=t[66]:(q=(0,Q.jsx)(h,{"aria-hidden":!0,className:rt}),t[65]=rt,t[66]=q);let it;t[67]!==d||t[68]!==et||t[69]!==q?(it=(0,Q.jsxs)(`button`,{type:`button`,"aria-expanded":d,"aria-controls":et,onClick:tt,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]=d,t[68]=et,t[69]=q,t[70]=it):it=t[70];let at;t[71]!==Ke||t[72]!==G||t[73]!==it?(at=(0,Q.jsxs)(`span`,{className:`flex min-w-0 items-center gap-1`,children:[Ke,W,G,K,it]}),t[71]=Ke,t[72]=G,t[73]=it,t[74]=at):at=t[74];let ot;t[75]!==he||t[76]!==R||t[77]!==p?(ot=R?(0,Q.jsx)(dr,{diagnosis:R,retryAt:he.phase===`backoff`?he.retryAt:null,attempt:he.attempt,expanded:p,onToggle:()=>m(Ui)}):null,t[75]=he,t[76]=R,t[77]=p,t[78]=ot):ot=t[78];let lt;t[79]===F?lt=t[80]:(lt=F.status===`idle`?null:(0,Q.jsx)(`div`,{className:`mt-1 max-w-md`,children:(0,Q.jsx)(Zn,{state:F})}),t[79]=F,t[80]=lt);let ut;t[81]!==ot||t[82]!==lt?(ut=(0,Q.jsxs)(Q.Fragment,{children:[ot,lt]}),t[81]=ot,t[82]=lt,t[83]=ut):ut=t[83];let dt;t[84]!==R||t[85]!==p||t[86]!==n||t[87]!==g||t[88]!==s||t[89]!==ge||t[90]!==pe?(dt=R&&p?(0,Q.jsx)(ur,{hostLabel:n.label,diagnosis:R,onRetry:()=>void pe(g),onAddRoute:ge?()=>s(n):null}):null,t[84]=R,t[85]=p,t[86]=n,t[87]=g,t[88]=s,t[89]=ge,t[90]=pe,t[91]=dt):dt=t[91];let J;t[92]!==n||t[93]!==s||t[94]!==c?(J=c&&(0,Q.jsx)(xr,{environment:n,onAddRoute:()=>s(n)}),t[92]=n,t[93]=s,t[94]=c,t[95]=J):J=t[95];let pt;t[96]!==g||t[97]!==y||t[98]!==d?(pt=d&&(0,Q.jsx)(`div`,{id:`remote-permissions-${g}`,className:`mt-2 border-t border-border/50`,children:(0,Q.jsx)(mr,{environmentId:g,connected:y,routeContext:!0})}),t[96]=g,t[97]=y,t[98]=d,t[99]=pt):pt=t[99];let Y;t[100]!==dt||t[101]!==J||t[102]!==pt?(Y=(0,Q.jsxs)(Q.Fragment,{children:[dt,J,pt]}),t[100]=dt,t[101]=J,t[102]=pt,t[103]=Y):Y=t[103];let ht;t[104]!==n.entry.serverUpdateRequired||t[105]!==n.label||t[106]!==g||t[107]!==se?.serverVersion||t[108]!==F.status||t[109]!==_?(ht=_&&n.entry.serverUpdateRequired===!0&&F.status!==`running`?(0,Q.jsx)(ir,{environmentId:g,serverLabel:`${n.label} server`,fromVersion:se?.serverVersion,targetVersion:He,label:F.status===`failed`?`Retry update`:`Update`}):null,t[104]=n.entry.serverUpdateRequired,t[105]=n.label,t[106]=g,t[107]=se?.serverVersion,t[108]=F.status,t[109]=_,t[110]=ht):ht=t[110];let gt;t[111]!==n.label||t[112]!==n.serverConfig||t[113]!==g||t[114]!==F.status||t[115]!==V||t[116]!==M?(gt=V?(0,Q.jsx)($n,{environmentId:g,serverLabel:`${n.label} server`,selfUpdate:An(n.serverConfig),installation:n.serverConfig?.environment.capabilities.serverInstallation,desktopAppUpdate:Bn(n.serverConfig),threadContinuation:nr(n.serverConfig),targetVersion:M.clientVersion,label:F.status===`failed`?`Retry update`:`Update`,appearance:`icon`}):null,t[111]=n.label,t[112]=n.serverConfig,t[113]=g,t[114]=F.status,t[115]=V,t[116]=M,t[117]=gt):gt=t[117];let bt=b||_,xt=`${v?`Switch off`:`Switch on`} ${n.label}`,St;t[118]!==g||t[119]!==i?(St=e=>i(g,e),t[118]=g,t[119]=i,t[120]=St):St=t[120];let Ct;t[121]!==v||t[122]!==bt||t[123]!==xt||t[124]!==St?(Ct=(0,Q.jsx)(_t,{render:(0,Q.jsx)(cr,{size:`sm`,checked:v,disabled:bt,"aria-label":xt,onCheckedChange:St})}),t[121]=v,t[122]=bt,t[123]=xt,t[124]=St,t[125]=Ct):Ct=t[125];let wt=_?`Client not supported`:v?`Switch off`:`Switch on`,Tt;t[126]===wt?Tt=t[127]:(Tt=(0,Q.jsx)(vt,{side:`top`,children:wt}),t[126]=wt,t[127]=Tt);let Et;t[128]!==Ct||t[129]!==Tt?(Et=(0,Q.jsxs)(yt,{children:[Ct,Tt]}),t[128]=Ct,t[129]=Tt,t[130]=Et):Et=t[130];let Dt=`More actions for ${n.label}`,Ot;t[131]!==b||t[132]!==Dt?(Ot=(0,Q.jsx)(I,{type:`button`,variant:`ghost-muted`,size:`icon-xs`,disabled:b,"aria-label":Dt}),t[131]=b,t[132]=Dt,t[133]=Ot):Ot=t[133];let kt;t[134]===Symbol.for(`react.memo_cache_sentinel`)?(kt=(0,Q.jsx)(A,{className:`size-3.5`}),t[134]=kt):kt=t[134];let At;t[135]===Ot?At=t[136]:(At=(0,Q.jsx)(Se,{render:Ot,children:kt}),t[135]=Ot,t[136]=At);let jt;t[137]!==n.serverConfig||t[138]!==g?(jt=(0,Q.jsx)(br,{environmentId:g,serverConfig:n.serverConfig}),t[137]=n.serverConfig,t[138]=g,t[139]=jt):jt=t[139];let Mt,Nt;t[140]===Symbol.for(`react.memo_cache_sentinel`)?(Mt=()=>u(Hi),Nt=(0,Q.jsx)(ue,{}),t[140]=Mt,t[141]=Nt):(Mt=t[140],Nt=t[141]);let Pt=c?`Hide routes`:`Routes`,Ft;t[142]===Pt?Ft=t[143]:(Ft=(0,Q.jsxs)(a,{onClick:Mt,children:[Nt,Pt]}),t[142]=Pt,t[143]=Ft);let It;t[144]!==O||t[145]!==Te?(It=Te?(0,Q.jsx)(a,{onClick:()=>O(Te,{url:Te}),children:`Copy MCP URL`}):null,t[144]=O,t[145]=Te,t[146]=It):It=t[146];let Lt;t[147]!==E||t[148]!==x?(Lt=x?(0,Q.jsx)(a,{onClick:()=>E(x),children:`Copy trace ID`}):null,t[147]=E,t[148]=x,t[149]=Lt):Lt=t[149];let Rt;t[150]===Symbol.for(`react.memo_cache_sentinel`)?(Rt=(0,Q.jsx)(j,{}),t[150]=Rt):Rt=t[150];let zt;t[151]!==n||t[152]!==o?(zt=()=>o(n),t[151]=n,t[152]=o,t[153]=zt):zt=t[153];let Bt=b?`Removing…`:`Remove from this device…`,Vt;t[154]!==zt||t[155]!==Bt?(Vt=(0,Q.jsx)(a,{variant:`destructive`,onClick:zt,children:Bt}),t[154]=zt,t[155]=Bt,t[156]=Vt):Vt=t[156];let Ht;t[157]!==jt||t[158]!==Ft||t[159]!==It||t[160]!==Lt||t[161]!==Vt?(Ht=(0,Q.jsxs)(ye,{align:`end`,children:[jt,Ft,It,Lt,Rt,Vt]}),t[157]=jt,t[158]=Ft,t[159]=It,t[160]=Lt,t[161]=Vt,t[162]=Ht):Ht=t[162];let Ut;t[163]!==At||t[164]!==Ht?(Ut=(0,Q.jsxs)(w,{children:[At,Ht]}),t[163]=At,t[164]=Ht,t[165]=Ut):Ut=t[165];let Wt;return t[166]!==n.label||t[167]!==De||t[168]!==Re||t[169]!==at||t[170]!==ut||t[171]!==Y||t[172]!==ht||t[173]!==gt||t[174]!==Et||t[175]!==Ut?(Wt=(0,Q.jsxs)(Dr,{kind:De,label:Le,dimmed:Re,subtitle:at,below:ut,detail:Y,children:[ht,gt,Et,Ut]}),t[166]=n.label,t[167]=De,t[168]=Re,t[169]=at,t[170]=ut,t[171]=Y,t[172]=ht,t[173]=gt,t[174]=Et,t[175]=Ut,t[176]=Wt):Wt=t[176],Wt}function Hi(e){return!e}function Ui(e){return!e}function Wi(e){return!e}function Gi(e){return!e}function Ki(e){return e!==null}function qi(e){K.add(Y({type:`error`,title:`Could not copy MCP URL`,description:e.message}))}function Ji(e){let{url:t}=e;K.add({type:`success`,title:`MCP URL copied`,description:`Add it to an agent, e.g. claude mcp add --transport http p4 ${t}`})}function Yi(e){K.add(Y({type:`error`,title:`Could not copy trace ID`,description:e.message}))}function Xi(e){let{traceId:t}=e;K.add({type:`success`,title:`Trace ID copied`,description:t})}function Zi(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)(cr,{"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)(yt,{children:[(0,Q.jsx)(_t,{render:(0,Q.jsx)(`span`,{className:`inline-flex`,children:u})}),(0,Q.jsx)(vt,{side:`top`,children:i})]}):u,t[7]=u,t[8]=i,t[9]=d):d=t[9],d}function Qi(e){let t=(0,Z.c)(53),{canManageRelay:n}=e,r=nt(),{isSignedIn:i,linkState:a,linkRevoked:o,managedTunnelActive:s,managedTunnelOutOfSync:c,publishAgentActivity:l,holdWebhooksWhileOffline:u,operationError:d,reconcileCloudState:f}=Fn(),[m,h]=(0,$.useState)(!1),[g,_]=(0,$.useState)(!1),v=i?n?null:`Your session does not have permission to manage P4 Connect access.`:`Sign in to P4 Connect to manage this environment.`,y=m||g,b=(0,$.useEffectEvent)(a.refresh),x;t[0]===b?x=t[1]:(x=()=>{let e=window.setInterval(()=>b(),3e4);return()=>window.clearInterval(e)},t[0]=b,t[1]=x);let S;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(S=[],t[2]=S):S=t[2],(0,$.useEffect)(x,S);let C=s?a.data?.reachability:void 0,w;t[3]===C?w=t[4]:(w=C?.status===`reachable`?L(C):C?.status===`unreachable`?(0,Q.jsxs)(`span`,{className:`block text-destructive`,children:[[C.reason,C.hint,`Fix: ${C.fix}`].filter(Boolean).join(` `),` `,(0,Q.jsx)(`a`,{href:p(C.cause),target:`_blank`,rel:`noreferrer`,className:`underline underline-offset-2`,children:`More info`})]}):null,t[3]=C,t[4]=w);let T=w,E;t[5]!==r||t[6]!==l||t[7]!==f?(E=async e=>{r!==null&&J(r,`relay:write`)&&(h(!0),await f({managedTunnel:e,publish:l})&&K.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.`}),h(!1))},t[5]=r,t[6]=l,t[7]=f,t[8]=E):E=t[8];let D=E,O;t[9]!==s||t[10]!==r||t[11]!==f?(O=async e=>{r!==null&&J(r,`relay:write`)&&(_(!0),await f({managedTunnel:s,publish:e})&&K.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.`}),_(!1))},t[9]=s,t[10]=r,t[11]=f,t[12]=O):O=t[12];let k=O,A;t[13]!==s||t[14]!==l||t[15]!==f?(A=async e=>{_(!0),await f({managedTunnel:s,publish:l,holdWebhooksWhileOffline:e})&&K.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.`}),_(!1)},t[13]=s,t[14]=l,t[15]=f,t[16]=A):A=t[16];let j=A,M;t[17]!==n||t[18]!==v||t[19]!==y||t[20]!==i||t[21]!==o||t[22]!==s||t[23]!==c||t[24]!==d||t[25]!==a.data||t[26]!==a.error||t[27]!==a.isPending||t[28]!==C?.status||t[29]!==T||t[30]!==D?(M=window.desktopBridge?(0,Q.jsx)(un,{title:er(`p4-connect`).title,description:o?`This environment was removed from P4 Connect. Turn it on to link it again.`:s?C?.status===`unreachable`?`P4 Connect is on, but other devices cannot reach this environment.`:C?.status===`reachable`?`This environment is available to your other devices through P4 Connect.`:`P4 Connect is on. Reachability has not been checked yet.`: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??T,control:(0,Q.jsx)(Zi,{checked:s,disabled:!n||!i||a.data===null||a.isPending||y,disabledReason:v,onCheckedChange:e=>void D(e)})}):o?(0,Q.jsx)(un,{title:er(`p4-connect`).title,description:"This environment was removed from P4 Connect. Run `p4c connect link` on the host to link it again."}):null,t[17]=n,t[18]=v,t[19]=y,t[20]=i,t[21]=o,t[22]=s,t[23]=c,t[24]=d,t[25]=a.data,t[26]=a.error,t[27]=a.isPending,t[28]=C?.status,t[29]=T,t[30]=D,t[31]=M):M=t[31];let N;t[32]===Symbol.for(`react.memo_cache_sentinel`)?(N=er(`publish-agent-activity`),t[32]=N):N=t[32];let P=!n||!i||a.data===null||a.isPending||y,F;t[33]===k?F=t[34]:(F=e=>void k(e),t[33]=k,t[34]=F);let I;t[35]!==v||t[36]!==l||t[37]!==F||t[38]!==P?(I=(0,Q.jsx)(un,{title:N.title,description:`Send activity to mobile notifications and Live Activities without P4 Connect.`,control:(0,Q.jsx)(Zi,{ariaLabel:`Publish agent activity to mobile clients`,checked:l,disabled:P,disabledReason:v,onCheckedChange:F})}),t[35]=v,t[36]=l,t[37]=F,t[38]=P,t[39]=I):I=t[39];let ee;t[40]!==n||t[41]!==v||t[42]!==u||t[43]!==y||t[44]!==i||t[45]!==s||t[46]!==a.isPending||t[47]!==j?(ee=s?(0,Q.jsx)(un,{title:er(`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)(Zi,{ariaLabel:`Hold webhook requests while this environment is offline`,checked:u,disabled:!n||!i||a.isPending||y,disabledReason:v,onCheckedChange:e=>void j(e)})}):null,t[40]=n,t[41]=v,t[42]=u,t[43]=y,t[44]=i,t[45]=s,t[46]=a.isPending,t[47]=j,t[48]=ee):ee=t[48];let te;return t[49]!==I||t[50]!==ee||t[51]!==M?(te=(0,Q.jsxs)(Q.Fragment,{children:[M,I,ee]}),t[49]=I,t[50]=ee,t[51]=M,t[52]=te):te=t[52],te}function $i(e){let t=(0,Z.c)(3),{canReadRelay:n,canManageRelay:r}=e;if(!Fe())return null;if(!n){let e;return t[0]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,Q.jsx)(un,{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)(Qi,{canManageRelay:r}),t[1]=r,t[2]=i),i}function ea(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)(Nt,{variant:`icon`,children:(0,Q.jsx)(g,{})}),t[0]=i):i=t[0];let a;t[1]===Symbol.for(`react.memo_cache_sentinel`)?(a=(0,Q.jsx)(Ft,{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)(Lt,{className:`min-h-52`,children:[i,(0,Q.jsxs)(Pt,{children:[a,(0,Q.jsx)(It,{children:o})]})]}),t[2]=o,t[3]=s),s}function ta(e){let t=(0,Z.c)(3),{primaryEnvironmentId:n,savedEnvironments:r}=e,i;return t[0]!==n||t[1]!==r?(i=Fe()?(0,Q.jsx)(Gn,{primaryEnvironmentId:n,savedEnvironments:r,empty:(0,Q.jsx)(ea,{})}):r.length===0?(0,Q.jsx)(ea,{cloudEnabled:!1}):null,t[0]=n,t[1]=r,t[2]=i):i=t[2],i}function na(){let e=window.desktopBridge,t=be(lt),{environments:n}=tt(),r=et(),i=mt(On,{reportFailure:!1}),a=mt(Dn,{reportFailure:!1}),o=mt(ct.remove,{reportFailure:!1}),s=mt(ct.register,{reportFailure:!1}),c=$e(),u=mt(ct.setEnabled,{reportFailure:!1}),f=r?.environmentId??null,p=En(),v=p.data?.authenticated?p.data.permissions??p.data.scopes??null:null,y=e?null:p.data?.auth.policy??null,b=(0,$.useMemo)(()=>n.filter(e=>e.entry.target._tag!==`PrimaryConnectionTarget`),[n]),x=(0,$.useMemo)(()=>b.filter(e=>!Ge(e.entry.target)),[b]),S=(0,$.useMemo)(()=>M(e=>b.map(t=>({environment:t,updateStatus:e(st.updateStateAtom(t.environmentId)).status}))),[b]),C=be(S),D=(0,$.useMemo)(()=>C.flatMap(({environment:e,updateStatus:t})=>{let n=Wn(e.serverConfig),r=An(e.serverConfig),i=Bn(e.serverConfig);return!n||t===`running`||!e.entry.enabled||e.connection.phase!==`connected`||Ge(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:nr(e.serverConfig),continueThreadsAfterServerUpdate:e.serverConfig?.settings.continueThreadsAfterServerUpdate??!1,targetVersion:n.clientVersion}]}),[C]),O=(0,$.useMemo)(()=>[...r?[r]:[],...b.filter(e=>e.entry.enabled)],[r,b]),k=(0,$.useMemo)(()=>{let e=new Set;for(let t of b){let n=t.entry.profile;if(t.entry.target._tag!==`SshConnectionTarget`||re(n)||n.value._tag!==`SshConnectionProfile`)continue;let r=n.value.target;e.add(r.alias),e.add(Tr(r))}return e},[b]),[j,N]=(0,$.useState)(null),[P,F]=(0,$.useState)(null),[ee,te]=(0,$.useState)(()=>new Map),ne=(0,$.useCallback)(e=>{te(t=>new Map(t).set(e.id,e.credential))},[]),[ie,oe]=(0,$.useState)(null),[se,ce]=(0,$.useState)(null),[le,ue]=(0,$.useState)(!1),[de,fe]=(0,$.useState)(!1),[L,pe]=(0,$.useState)(null),[me,he]=(0,$.useState)(`remote`),[ge,R]=(0,$.useState)(``),[ve,xe]=(0,$.useState)(``),[z,Ce]=(0,$.useState)(``),[we,Ee]=(0,$.useState)(``),[B,De]=(0,$.useState)(``),[Oe,ke]=(0,$.useState)(!1),je=(0,$.useRef)(void 0),[Ne,V]=(0,$.useState)(null),[H,Le]=(0,$.useState)(!1),[ze,Be]=(0,$.useState)(null),[Ve,He]=(0,$.useState)(!1),[Ue,We]=(0,$.useState)(!1),[U,Ke]=(0,$.useState)(!1),[W,Qe]=(0,$.useState)(!1),[nt,rt]=(0,$.useState)(null),[q,at]=(0,$.useState)(null),ot=q!==null,[ut,ft]=(0,$.useState)(null),[ht,gt]=(0,$.useState)(!1),[bt,Mt]=(0,$.useState)(String(oi)),[Nt,Pt]=(0,$.useState)(null),Ft=r?.serverConfig??null,It=Wn(Ft),Lt=be(st.updateStateAtom(f)),[Ut,Wt]=(0,$.useState)(!1),Gt=nn(e=>e.defaultAdvertisedEndpointKey),Kt=nn(e=>e.setDefaultAdvertisedEndpointKey),qt=dt(f,m),Jt=dt(f,Te),Yt=dt(f,E),Xt=dt(f,d),Zt=dt(f,_),Qt=!Re()&&Xt,$t=pt(qt&&f!==null?Gr.accessChanges({environmentId:f,input:null}):null),en=pt(Qt&&e?Qr:null),tn=e!==void 0&&de&&me===`ssh`,rn=pt(tn?ai:null),an=rn.refresh;(0,$.useEffect)(()=>{tn&&an()},[tn,an]);let on=pt(Qt&&e?Jn:null),X=on.data,pn=nt??on.error,xn=on.isPending&&on.data===null,Cn=rn.data??ci,Fn=(0,$.useMemo)(()=>Cn.filter(e=>{let t=Tr(e);return!k.has(e.alias)&&!k.has(t)}),[Cn,k]),In=(0,$.useMemo)(()=>ei(Fn,z),[z,Fn]),Ln=rn.isPending&&rn.data===null,Un=rn.error,Gn=e!==void 0&&(Ln||Fn.length>0),Kn=en.data?.serverExposureState??null,qn=en.data?.advertisedEndpoints??si,Xn=j??en.error,Qn=P??$t.error,rr=$t.isPending&&$t.data===null,ir=(0,$.useMemo)(()=>{let e=$t.data;return e?.type===`snapshot`?Si(e.payload.pairingLinks.map(e=>Ti(e))):[]},[$t.data]),ar=(0,$.useMemo)(()=>{let e=$t.data;return e?.type===`snapshot`?wi(e.payload.clientSessions.map(e=>Ei(e))):[]},[$t.data]),or=e?Kn?.mode===`network-accessible`:y===`remote-reachable`,sr=bt.trim(),lr=Number(sr),ur=/^\d+$/u.test(sr)&&Number.isInteger(lr)&&lr>=1&&lr<=65535,dr=(0,$.useMemo)(()=>{if(!ut)return null;if(!ur||lr===oi)return ut.httpBaseUrl;try{let e=new URL(ut.httpBaseUrl);return e.port=String(lr),e.toString().replace(/\/$/u,``)}catch{return ut.httpBaseUrl}},[ur,lr,ut]),Z=(0,$.useCallback)(async t=>{if(e&&f!==null&&J(f,`environment:maintain`)){He(!0),N(null);try{await e.setServerExposureMode(t?`network-accessible`:`local-only`),$r(),We(!1),He(!1)}catch(e){let t=e instanceof Error?e.message:`Failed to update network exposure.`;We(!1),N(t),K.add(Y({type:`error`,title:`Could not update network access`,description:t})),He(!1)}}},[e,f]),pr=(0,$.useCallback)(()=>{Nt!==null&&Z(Nt===`network-accessible`)},[Z,Nt]),hr=(0,$.useCallback)(async()=>{if(e&&f!==null&&J(f,`environment:maintain`)&&ur){Ke(!0),N(null);try{await e.setTailscaleServeEnabled({enabled:!0,port:lr}),$r(),ft(null)}catch(e){let t=e instanceof Error?e.message:`Failed to configure Tailscale HTTPS.`;N(t),K.add(Y({type:`error`,title:`Could not set up Tailscale HTTPS`,description:t}))}finally{Ke(!1)}}},[e,ur,lr,f]),gr=(0,$.useCallback)(e=>{Mt(String(Kn?.tailscaleServePort??oi)),ft(e)},[Kn?.tailscaleServePort]),vr=(0,$.useCallback)(async()=>{if(e&&f!==null&&J(f,`environment:maintain`)){Ke(!0),N(null);try{await e.setTailscaleServeEnabled({enabled:!1,port:Kn?.tailscaleServePort??oi}),$r(),gt(!1)}catch(e){let t=e instanceof Error?e.message:`Failed to disable Tailscale HTTPS.`;N(t),K.add(Y({type:`error`,title:`Could not disable Tailscale HTTPS`,description:t}))}finally{Ke(!1)}}},[e,Kn,f]),yr=(0,$.useCallback)(e=>{gt(!0)},[]),xr=(0,$.useCallback)(async e=>{if(f!==null&&J(f,`access:write`)){oe(e),F(null);try{await Tn(e)}catch(e){let t=e instanceof Error?e.message:`Failed to revoke pairing link.`;F(t),K.add(Y({type:`error`,title:`Could not revoke pairing link`,description:t}))}finally{oe(null)}}},[f]),Sr=(0,$.useCallback)(async e=>{if(f!==null&&J(f,`access:write`)){ce(e),F(null);try{await wn(e)}catch(e){let t=e instanceof Error?e.message:`Failed to revoke client access.`;F(t),K.add(Y({type:`error`,title:`Could not revoke client access`,description:t}))}finally{ce(null)}}},[f]),Cr=(0,$.useCallback)(async()=>{if(f!==null&&J(f,`access:write`)){ue(!0),F(null);try{let e=await Sn();K.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.`;F(t),K.add(Y({type:`error`,title:`Could not revoke other clients`,description:t}))}finally{ue(!1)}}},[f]),wr=(0,$.useCallback)(async e=>{Le(!0),V(null);let t=await a({target:e,label:``,...L?{expectedEnvironmentId:L.environmentId}:{}});if(t._tag===`Failure`){Me(t)||V(vi(Pe(t))),Le(!1);return}R(``),xe(``),Ce(``),Ee(``),De(``),fe(!1),K.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.`}),Le(!1)},[a,L]),Er=(0,$.useCallback)(async()=>{if(me===`ssh`){let e;try{e=hi({host:z,username:we,port:B})}catch(e){V(vi(e));return}await wr(e);return}Le(!0),V(null);let e;try{e=_i({host:ge,pairingCode:ve})}catch(e){let t=e instanceof Error?e.message:`Failed to add backend.`;V(t),K.add(Y({type:`error`,title:`Could not add backend`,description:t})),Le(!1);return}let t=await i({...e,...L?{expectedEnvironmentId:L.environmentId}:{}});if(t._tag===`Failure`){if(!Me(t)){let e=Pe(t),n=e instanceof Error?e.message:`Failed to add backend.`;V(n),K.add(Y({type:`error`,title:`Could not add backend`,description:n}))}Le(!1);return}R(``),xe(``),Ce(``),Ee(``),De(``),fe(!1),K.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.`}),Le(!1)},[L,i,wr,ge,me,ve,z,B,we]),Dr=(0,$.useCallback)(e=>{e.nativeEvent.isComposing||e.keyCode===229||e.key===`Enter`&&z.trim().length>0&&(e.preventDefault(),Er())},[Er,z]),Or=(0,$.useCallback)(async t=>{if(H||!e)return;Le(!0),V(null),Ce(t.alias);let n;try{n=await e.resolveSshHost(t.alias)}catch(e){V(vi(e)),Le(!1);return}Ee(n.username??``),De(n.port===null?``:String(n.port)),await wr(n)},[wr,e,H]),kr=(0,$.useCallback)(e=>{if(e.nativeEvent.isComposing||e.keyCode===229)return;let n=Oe&&Gn;if(n){let n=Bt(e,t,{platform:navigator.platform,context:{modelPickerOpen:!1}}),r=Vt(n??``),i=r===null?void 0:In[r];if(i){e.preventDefault(),e.stopPropagation(),ke(!1),Or(i);return}if(e.key===`Escape`){e.preventDefault(),e.stopPropagation();return}}let r=n&&je.current!==void 0;!e.defaultPrevented&&!r&&e.key===`Enter`&&z.trim().length>0&&(e.preventDefault(),Er())},[In,Er,Or,Gn,t,z,Oe]),Ar=(0,$.useCallback)(async(e,t)=>{V(null);let n=await u({environmentId:e,enabled:t});if(n._tag===`Failure`&&!Me(n)){let e=Pe(n),r=e instanceof Error?e.message:`Failed to switch the backend ${t?`on`:`off`}.`;V(r),K.add(Y({type:`error`,title:`Could not switch backend ${t?`on`:`off`}`,description:r}))}},[u]),jr=(0,$.useCallback)(async e=>{let t=e.environmentId;Be(t),V(null);let n=await o(t);if(Be(null),n._tag===`Failure`&&!Me(n)){let e=Pe(n),t=e instanceof Error?e.message:`Failed to remove backend.`;V(t),K.add(Y({type:`error`,title:`Could not remove backend`,description:t}))}},[o]),[Nr,Pr]=(0,$.useState)(null),Fr=(0,$.useCallback)(async e=>{if(e.relayManaged&&Fe()){Pr(e);return}await it(`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 jr(e)},[jr]),Ir=ir,Rr=(0,$.useMemo)(()=>qn.find(Oi)??null,[qn]),Br=(0,$.useMemo)(()=>or?qn.filter(e=>!Oi(e)):[],[qn,or]),Vr=(0,$.useMemo)(()=>Rr?[...Br,Rr]:Br,[Rr,Br]),Hr=(0,$.useMemo)(()=>Di(Br,Gt),[Gt,Br]),Ur=(0,$.useMemo)(()=>Hr??Di(Rr?[Rr]:[],Gt),[Gt,Hr,Rr]),Wr=Ur?ki(Ur):null,Kr=(0,$.useCallback)(e=>{Kt(ki(e))},[Kt]),qr=(0,$.useCallback)(e=>{let t=gi(e);if(t){R(t.host),xe(t.pairingCode);return}R(e)},[]),Jr=e=>{let t=me===e.mode;return(0,Q.jsxs)(`button`,{type:`button`,"aria-pressed":t,className:_e(`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:H,onClick:()=>{he(e.mode)},children:[e.icon?(0,Q.jsx)(`span`,{className:_e(`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})]})]})},Yr=()=>(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)(xt,{value:ge,onChange:e=>qr(e.target.value),placeholder:`backend.example.com`,disabled:H,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)(xt,{value:ve,onChange:e=>xe(e.target.value),placeholder:`PAIRCODE`,disabled:H,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.`})})]}),Xr=L!==null&&!L.relayManaged&&c.environments.has(L.environmentId)?c.environments.get(L.environmentId).environment:null,Zr=async()=>{if(Xr===null||L===null)return;Le(!0);let e=await s(new Ie({target:new Ae({environmentId:Xr.environmentId,label:L.label})}));if(Le(!1),e._tag===`Failure`){if(!Me(e)){let t=Pe(e);V(t instanceof Error?t.message:`Could not add the route.`)}return}fe(!1),K.add({type:`success`,title:`Route added`,description:`${L.label} falls back to P4 Connect when its other routes are unreachable.`})},ti=()=>(0,Q.jsxs)(`div`,{className:`space-y-4`,children:[Xr===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)(I,{size:`xs`,variant:`outline`,disabled:H,onClick:()=>void Zr(),children:`Add P4 Connect`})]}),Yr(),Ne?(0,Q.jsx)(`p`,{className:`text-xs text-destructive`,children:Ne}):null,(0,Q.jsxs)(I,{variant:`outline`,className:`w-full`,disabled:H,onClick:()=>void Er(),children:[(0,Q.jsx)(T,{className:`size-3.5`}),H?`Adding…`:L?`Add route`:`Add environment`]})]}),ni=()=>(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)(gn,{items:In,itemToStringValue:e=>e.alias,mode:`none`,openOnInputClick:!0,open:Oe,onOpenChange:ke,onItemHighlighted:e=>{je.current=e},value:z,onValueChange:(e,t)=>{if(Ce(e),t.reason!==`item-press`)return;let n=In.find(t=>t.alias===e);n&&Or(n)},children:[(0,Q.jsx)(vn,{id:`saved-backend-ssh-host`,onKeyDown:kr,placeholder:`Search hosts or type devbox`,disabled:H,spellCheck:!1}),Gn?(0,Q.jsx)(yn,{children:Ln?(0,Q.jsx)(`div`,{className:`px-3 py-2 text-xs text-muted-foreground`,children:`Loading hosts…`}):In.length>0?(0,Q.jsx)(hn,{className:`max-h-72`,children:In.map((e,n)=>{let r=Tr(e),i=n<9?zt(n):null,a=i?Ht(t,i,navigator.platform):null;return(0,Q.jsxs)(bn,{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)(_n,{className:`shrink-0`,children:a}):null]},`${e.alias}:${e.hostname}:${e.port??``}`)})}):(0,Q.jsxs)(mn,{className:`break-all`,children:[`No hosts match "`,z.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)(xt,{value:we,onChange:e=>Ee(e.target.value),onKeyDown:Dr,placeholder:`root`,disabled:H,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)(xt,{value:B,onChange:e=>De(e.target.value),onKeyDown:Dr,placeholder:`22`,inputMode:`numeric`,disabled:H,spellCheck:!1})]})]}),Ne||Un?(0,Q.jsx)(ln,{variant:`error`,children:(0,Q.jsx)(cn,{children:Ne??Un})}):null,(0,Q.jsxs)(I,{variant:`outline`,className:`w-full`,disabled:H,onClick:()=>void Er(),children:[(0,Q.jsx)(T,{className:`size-3.5`}),H?`Adding…`:L?`Add route`:`Add environment`]})]})}),ri=()=>(0,Q.jsx)(cr,{checked:Kn?.mode===`network-accessible`,disabled:!Kn||Ve,onCheckedChange:e=>{Pt(e?`network-accessible`:`local-only`),We(!0)},"aria-label":`Enable network access`}),ii=e=>Ut?Br.map(t=>{let n=ki(t);return(0,Q.jsx)(Ri,{endpoint:t,isDefault:n===Wr,presentation:e,onSetDefault:Kr,onSetupTailscaleServe:gr,onDisableTailscaleServe:yr,isUpdatingTailscaleServe:U},t.id)}):null,di=(0,$.useCallback)(async t=>{if(e&&f!==null&&J(f,`environment:maintain`)){Qe(!0),rt(null);try{await t(),Hn()}catch(e){let t=e instanceof Error?e.message:`Failed to update WSL backend.`;rt(t),K.add(Y({type:`error`,title:`Could not change WSL backend`,description:t})),Hn()}finally{Qe(!1)}}},[e,f]),fi=(0,$.useCallback)(()=>{rt(null),Hn()},[]),pi=(0,$.useMemo)(()=>n.some(e=>Ge(e.entry.target)),[n]),mi=(0,$.useCallback)(t=>{if(!e||!X)return;let n=X.distros.find(e=>e.isDefault)?.name??null;if(t===ui){if(!X.enabled&&!X.wslOnly)return;let t=X.wslOnly;if(pi||t){at({kind:`disable`,wasWslOnly:t});return}di(()=>e.setWslBackendEnabled(!1));return}let r=t===li?null:t,i=r??n;if(!X.enabled){at({kind:`enable`,nextDistro:r});return}if((X.distro??n)!==i){if(pi||X.wslOnly){at({kind:`distro`,nextDistro:r});return}di(()=>e.setWslDistro(r))}},[di,e,X,pi]),yi=(0,$.useCallback)(t=>{if(!e||!q||q.kind!==`enable`)return;let n=q.nextDistro;at(null);let r=X?.distro??null;di(()=>Mn({bridge:e,mode:t,nextDistro:n,persistedDistro:r}))},[di,e,X,q]),xi=(0,$.useCallback)(t=>{e&&X&&X.wslOnly!==t&&at({kind:`wsl-only`,nextValue:t})},[e,X]),Ai=(0,$.useCallback)(()=>{if(!e||!q)return;let t=q;if(t.kind!==`enable`){if(at(null),t.kind===`disable`){di(async()=>{let n=await e.setWslBackendEnabled(!1);return t.wasWslOnly?await e.setWslOnly(!1):n});return}if(t.kind===`distro`){di(()=>e.setWslDistro(t.nextDistro));return}di(()=>e.setWslOnly(t.nextValue))}},[di,e,q]),ji=()=>{if(!X)return Pn({state:null,error:pn})&&Qt?(0,Q.jsx)(un,{...er(`wsl-backend`),description:`Couldn't load the WSL backend state.`,status:(0,Q.jsx)(`span`,{className:`block text-destructive`,children:pn}),control:(0,Q.jsx)(I,{size:`sm`,variant:`outline`,onClick:fi,disabled:xn,children:xn?`Retrying…`:`Retry`})}):null;if(!Pn({state:X,error:pn}))return null;if(!X.available)return(0,Q.jsx)(un,{...er(`wsl-backend`),description:`WSL is unavailable, so Windows is running instead. Turn WSL off to clear this preference.`,status:pn?(0,Q.jsx)(`span`,{className:`block text-destructive`,children:pn}):null,control:(0,Q.jsx)(I,{size:`sm`,variant:`outline`,disabled:W,onClick:()=>mi(ui),children:`Switch to Windows`})});let e=X.distros.find(e=>e.isDefault)?.name??null,t=X.enabled?X.distro??e??li:ui,n=t===ui?`Off`:t===li?`Default distro`:t;return(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(un,{...er(`wsl-backend`),description:`Run the selected WSL distro alongside Windows. Projects remain on their current filesystem.`,status:pn?(0,Q.jsx)(`span`,{className:`block text-destructive`,children:pn}):X.preflightError?(0,Q.jsxs)(`span`,{className:`block text-destructive`,children:[`WSL backend couldn't start: `,X.preflightError]}):null,control:(0,Q.jsxs)(Ze,{value:t,onValueChange:e=>{typeof e==`string`&&mi(e)},children:[(0,Q.jsx)(Xe,{size:`sm`,className:`w-full sm:w-56`,"aria-label":`WSL backend`,disabled:W,children:(0,Q.jsx)(Je,{children:n})}),(0,Q.jsxs)(Ye,{align:`end`,alignItemWithTrigger:!1,children:[(0,Q.jsx)(qe,{hideIndicator:!0,value:ui,children:`Off`}),X.distros.length===0?(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(qe,{hideIndicator:!0,value:li,children:`Default distro`}),X.distro===null?null:(0,Q.jsx)(qe,{hideIndicator:!0,value:X.distro,children:X.distro})]}):X.distros.map(e=>(0,Q.jsxs)(qe,{hideIndicator:!0,value:e.name,children:[e.name,e.isDefault?` (default)`:``]},e.name))]})]})}),X.enabled?(0,Q.jsx)(un,{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)(cr,{checked:X.wslOnly,disabled:W,onCheckedChange:e=>xi(e),"aria-label":`Run WSL only`})}):null]})},Mi=()=>(0,Q.jsx)(un,{title:er(`tailscale-https`).title,description:Rr?Rr.status===`available`?Rr.httpBaseUrl:`Use Tailscale Serve to expose this backend through a MagicDNS HTTPS URL.`:`Start Tailscale to set up HTTPS access through MagicDNS.`,control:Rr?(0,Q.jsx)(cr,{checked:Rr.status===`available`,disabled:U,onCheckedChange:e=>{if(e){gr(Rr);return}yr(Rr)},"aria-label":`Enable Tailscale HTTPS`}):null}),Ni=e=>(0,Q.jsxs)(Q.Fragment,{children:[Qn?(0,Q.jsx)(`div`,{className:bi(e),children:(0,Q.jsx)(`p`,{className:`text-xs text-destructive`,children:Qn})}):null,(0,Q.jsx)(Li,{endpointUrl:Kn?.endpointUrl,endpoints:Vr,defaultEndpointKey:Wr,presentation:e,isLoading:rr,pairingLinks:Ir,createdPairingCredentials:ee,clientSessions:ar,revokingPairingLinkId:ie,revokingClientSessionId:se,onRevokePairingLink:xr,onRevokeClientSession:Sr,canRevoke:Jt})]}),Pi=()=>(0,Q.jsx)(un,{title:er(`network-access`).title,description:or?(0,Q.jsx)(zi,{endpoint:Hr,hiddenEndpointCount:Math.max(Br.length-1,0),expanded:Ut,onToggleExpanded:()=>Wt(e=>!e),fallback:Kn?.endpointUrl?`Reachable at ${Kn.endpointUrl}`:Kn?.advertisedHost?`Exposed on all interfaces. Pairing links use ${Kn.advertisedHost}.`:`Exposed on all interfaces.`}):Kn?`Limited to this machine.`:`Loading…`,status:Xn?(0,Q.jsx)(`span`,{className:`block text-destructive`,children:Xn}):null,control:ri()}),Fi=()=>(0,Q.jsx)(un,{title:er(`network-access`).title,description:e?`This connection cannot view or change network exposure.`:y===`remote-reachable`?`Remote access is already configured. Change network exposure where the server starts.`:y===`loopback-browser`?`Only this machine can connect. Restart with a non-loopback host for remote pairing.`:`Network exposure information is unavailable.`,control:!e&&(y===`remote-reachable`||y===`loopback-browser`)?(0,Q.jsxs)(yt,{children:[(0,Q.jsx)(_t,{render:(0,Q.jsx)(`span`,{className:`inline-flex`,children:(0,Q.jsx)(cr,{checked:or,disabled:!0,"aria-label":`Enable network access`})})}),(0,Q.jsx)(vt,{side:`top`,children:`Network exposure changes restart the backend and must be controlled where the server process is launched.`})]}):void 0}),Bi=(0,Q.jsx)(Q.Fragment,{children:f===null?(0,Q.jsxs)(fn,{...er(`connections-environment`),children:[(0,Q.jsx)(un,{title:`No environment selected`,description:`Connect an environment to view its settings and access.`}),(0,Q.jsx)(_r,{}),Yt||Zt?(0,Q.jsx)($i,{canReadRelay:Yt,canManageRelay:Zt}):null]}):(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsxs)(fn,{...er(`connections-environment`),title:r?.label??(e?`This machine`:`Primary environment`),icon:(0,Q.jsx)(sn,{"aria-hidden":!0,kind:Ft?l(Ft):`desktop`,className:`size-4`}),headerAction:f===null?null:(0,Q.jsxs)(w,{children:[(0,Q.jsx)(Se,{render:(0,Q.jsx)(I,{type:`button`,variant:`ghost-muted`,size:`icon-xs`,"aria-label":`More actions for this machine`}),children:(0,Q.jsx)(A,{className:`size-3.5`})}),(0,Q.jsx)(ye,{align:`end`,children:(0,Q.jsx)(br,{environmentId:f,serverConfig:Ft})})]}),children:[(0,Q.jsx)(_r,{}),Qt?(0,Q.jsx)(un,{title:`Version`,description:Lt.status===`idle`?[Ft?.environment.serverVersion??null,r?.displayUrl??null].filter(e=>e!==null).join(` · `)||`Loading…`:(0,Q.jsx)(Zn,{state:Lt}),control:It&&f!==null&&Lt.status!==`running`?(0,Q.jsx)($n,{size:`sm`,environmentId:f,serverLabel:r?`${r.label} server`:`server`,selfUpdate:An(Ft),installation:Ft?.environment.capabilities.serverInstallation,desktopAppUpdate:Bn(Ft),threadContinuation:nr(Ft),targetVersion:It.clientVersion,label:Lt.status===`failed`?`Retry update`:`Update to ${It.clientVersion}`}):Lt.status===`idle`&&Ft?(0,Q.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:`Up to date`}):void 0}):null,Qt&&e?(0,Q.jsxs)(Q.Fragment,{children:[Pi(),ii(`endpoint-rail`),Mi(),ji(),Yt||Zt?(0,Q.jsx)($i,{canReadRelay:Yt,canManageRelay:Zt}):null]}):Qt?(0,Q.jsxs)(Q.Fragment,{children:[Fi(),Yt||Zt?(0,Q.jsx)($i,{canReadRelay:Yt,canManageRelay:Zt}):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)(h,{"aria-hidden":!0,className:`size-3 text-muted-foreground group-open:rotate-90`})]}),(0,Q.jsx)(mr,{environmentId:r.environmentId,connected:r.connection.phase===`connected`})]}):null]}),qt||Jt?(0,Q.jsx)(fr,{id:`authorized-clients`,title:`Authorized clients`,summary:Ci(ar,Ir),control:Jt?(0,Q.jsx)(Ii,{delegatableScopes:v??[],onPairingLinkCreated:ne,clientSessions:qt&&$t.error===null&&$t.data?.type===`snapshot`?ar:null,isRevokingOtherClients:le,onRevokeOtherClients:Cr}):void 0,children:(0,Q.jsx)(St,{scrollFade:!0,chainVerticalScroll:!0,className:`max-h-[22.5rem]`,"data-testid":`authorized-clients-scroll-area`,children:qt?Ni(`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)(kn,{open:Ue&&Qt,onOpenChange:e=>{Ve||We(e)},onOpenChangeComplete:e=>{e||Pt(null)},children:(0,Q.jsxs)(jn,{children:[(0,Q.jsxs)(Vn,{children:[(0,Q.jsx)(Nn,{children:Nt===`network-accessible`?`Enable network access?`:`Disable network access?`}),(0,Q.jsx)(Rn,{children:Nt===`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)(zn,{children:[(0,Q.jsx)(tr,{disabled:Ve,render:(0,Q.jsx)(I,{variant:`outline`,disabled:Ve}),children:(0,Q.jsx)(`span`,{className:`[text-box:trim-both_cap_alphabetic]`,children:`Cancel`})}),(0,Q.jsxs)(I,{variant:`default`,onClick:pr,disabled:!Qt||Nt===null||Ve,children:[Ve&&(0,Q.jsx)(G,{size:`sm`}),(0,Q.jsx)(`span`,{className:`[text-box:trim-both_cap_alphabetic]`,children:Ve?`Restarting…`:Nt===`network-accessible`?`Restart and enable`:`Restart and disable`})]})]})]})}),(0,Q.jsx)(kn,{open:ot&&Qt,onOpenChange:e=>{W||e||at(null)},children:(0,Q.jsxs)(jn,{children:[(0,Q.jsxs)(Vn,{children:[(0,Q.jsx)(Nn,{children:q?.kind===`disable`?q.wasWslOnly?`Turn off WSL and switch back to Windows?`:`Disable WSL backend?`:q?.kind===`distro`?`Switch WSL distro?`:q?.kind===`enable`?`Start the WSL backend`:q?.nextValue?`Run only the WSL backend?`:`Re-enable the Windows backend?`}),(0,Q.jsx)(Rn,{children:q?.kind===`disable`?q.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.`:q?.kind===`distro`?`P4 Code will restart the WSL backend on the new distro. Sessions still running on the current distro will be interrupted.`:q?.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.`:q?.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)(zn,{children:[(0,Q.jsx)(tr,{disabled:W,render:(0,Q.jsx)(I,{variant:`outline`,disabled:W}),children:`Cancel`}),q?.kind===`enable`?(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(I,{variant:`outline`,onClick:()=>yi(`wsl-only`),disabled:W||!Qt,children:W?(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(G,{size:`sm`}),`Applying…`]}):`Use only WSL`}),(0,Q.jsx)(I,{variant:`default`,onClick:()=>yi(`both`),disabled:W||!Qt,children:W?(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(G,{size:`sm`}),`Applying…`]}):`Run both backends`})]}):(0,Q.jsx)(I,{variant:q?.kind===`disable`||q?.kind===`wsl-only`&&q.nextValue?`destructive`:`default`,onClick:Ai,disabled:W||!Qt,children:W?(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(G,{size:`sm`}),`Applying…`]}):q?.kind===`disable`?q.wasWslOnly?`Switch to Windows`:`Disable WSL`:q?.kind===`distro`?`Switch distro`:q?.nextValue?`Restart and enable`:`Restart and disable`})]})]})}),(0,Q.jsx)(kn,{open:ht&&Qt,onOpenChange:e=>{U||gt(e)},children:(0,Q.jsxs)(jn,{children:[(0,Q.jsxs)(Vn,{children:[(0,Q.jsx)(Nn,{children:`Disable Tailscale HTTPS?`}),(0,Q.jsx)(Rn,{children:`P4 Code will restart the local backend without Tailscale Serve.`})]}),(0,Q.jsxs)(zn,{children:[(0,Q.jsx)(tr,{disabled:U,render:(0,Q.jsx)(I,{variant:`outline`,disabled:U}),children:`Cancel`}),(0,Q.jsx)(I,{variant:`destructive`,onClick:()=>void vr(),disabled:U||!Qt,children:U?(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(G,{size:`sm`}),`Restarting…`]}):`Restart and disable`})]})]})}),(0,Q.jsx)(jt,{open:ut!==null,onOpenChange:e=>{U||e||ft(null)},children:(0,Q.jsxs)(At,{className:`max-w-md`,children:[(0,Q.jsxs)(Ct,{children:[(0,Q.jsx)(wt,{children:`Set up Tailscale HTTPS?`}),(0,Q.jsx)(kt,{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)(Ot,{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)(xt,{className:`mt-2`,type:`number`,inputMode:`numeric`,min:1,max:65535,step:1,value:bt,onChange:e=>Mt(e.target.value),disabled:U})]}),ur?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)(yt,{children:[(0,Q.jsx)(_t,{render:(0,Q.jsx)(`p`,{className:`mt-1 truncate text-sm text-foreground`,children:dr??`Pending MagicDNS endpoint`})}),dr?(0,Q.jsx)(vt,{side:`top`,children:dr}):null]})]})]}),(0,Q.jsxs)(Tt,{children:[(0,Q.jsx)(Dt,{disabled:U,render:(0,Q.jsx)(I,{variant:`outline`,disabled:U}),children:`Cancel`}),(0,Q.jsx)(I,{onClick:()=>void hr(),disabled:U||!ur,children:U?(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(G,{size:`sm`}),`Restarting…`]}):`Enable`})]})]})})]})});return(0,Q.jsxs)(dn,{children:[Bi,(0,Q.jsxs)(fn,{...er(`remote-environments`),title:`Environments`,headerAction:(0,Q.jsxs)(`div`,{className:`flex items-center gap-1`,children:[D.length>0?(0,Q.jsx)(Yn,{targets:D,variant:`ghost-muted`}):null,(0,Q.jsxs)(jt,{open:de,onOpenChange:e=>{fe(e),e?pe(null):V(null)},children:[(0,Q.jsxs)(yt,{children:[(0,Q.jsx)(_t,{render:(0,Q.jsx)(Et,{render:(0,Q.jsxs)(I,{size:`xs`,variant:`ghost-muted`,"aria-label":`Add environment`,children:[(0,Q.jsx)(T,{className:`size-3`}),(0,Q.jsx)(`span`,{children:`Add environment`})]})})}),(0,Q.jsx)(vt,{side:`top`,children:`Add environment`})]}),(0,Q.jsxs)(At,{className:`max-h-[80dvh] sm:max-w-3xl`,children:[(0,Q.jsxs)(Ct,{children:[(0,Q.jsx)(wt,{children:L?`Add a route to ${L.label}`:`Add Environment`}),(0,Q.jsx)(kt,{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)(Ot,{children:(0,Q.jsxs)(`div`,{className:`space-y-4`,children:[(0,Q.jsxs)(`div`,{className:`grid gap-3 sm:grid-cols-2`,children:[Jr({mode:`remote`,title:`Remote link`,description:`Enter a backend host and pairing code.`,icon:(0,Q.jsx)(g,{"aria-hidden":!0,className:`size-4`})}),e?Jr({mode:`ssh`,title:`SSH`,description:`Use local SSH config, agent, and tunnels for the backend.`,icon:(0,Q.jsx)(ae,{"aria-hidden":!0,className:`size-4`})}):null]}),(0,Q.jsx)(Rt,{children:me===`ssh`?ni():ti()})]})})]})]})]}),children:[x.map(e=>(0,Q.jsx)(Vi,{environment:e,removingEnvironmentId:ze,onSetEnabled:Ar,onRemove:Fr,onAddRoute:e=>{pe(e),V(null),fe(!0)}},e.environmentId)),(0,Q.jsx)(ta,{primaryEnvironmentId:f,savedEnvironments:b})]}),Fe()?(0,Q.jsx)(zr,{environmentLabel:Nr?.label??null,onCancel:()=>Pr(null),onConfirm:()=>{Nr&&(Pr(null),jr(Nr))}}):null,(0,Q.jsx)(Mr,{environments:O}),(0,Q.jsx)(Lr,{environments:O})]})}function ra(e){let{kind:t}=e;K.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 ia(e){return Mi(e)?`hosted-link`:`link`}function aa(e){return!e}function oa(e){return e.currentTarget.select()}function sa(e){return e.currentTarget.select()}function ca(e){return e!==null}var la=na;export{la as component};
|
|
2
|
+
//# sourceMappingURL=settings.connections-D1UxckE0.js.map
|